123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778open!Coreopen!Import(** A [Multi_factor.t] is a collection of [Single_factor.t]s (referred to as a "subwidget"
in this module), indexed by the [Arg.Key] type. This widget provides focus tracking
among the different subwidgets.
*)moduletypeKey=sigtypet[@@derivingequal,sexp]includeComparable.Swithtypet:=tvalto_string:t->string(** The human-language name of your type. E.g. if [t] represents some attributes of a
trade, you could use something like "trade property" here. *)valname_singular:string(** As above, but in the plural. *)valname_plural:stringendmoduletypeS=sigopen!Coreopen!ImportmoduleItem:Single_factor.ItemmoduleKey:KeymoduleSingle_factor:moduletypeofSingle_factor.Make(Item)moduleAction:sigtypet=|Cycle_focused_subwidgetof[`Next|`Prev]|Set_focused_subwidgetofKey.t|Subwidget_actionofKey.t*Single_factor.Action.t|Select_on_all_subwidgetsof[`All|`None]endmoduleResult:sigtypet={view:Vdom.Node.t;view_for_testing:stringLazy.t;key_handler:Vdom_keyboard.Keyboard_event_handler.t;inject:Action.t->unitVdom.Effect.t(** [selection] is the set of all selected items, by key. *);selection:Item.Set.tKey.Map.t}[@@derivingfields](** A DOM node very similar to [t.view], but with a keydown handler attached to deal
with keyboard events. We provide both this and [view] / [key_handler] separately,
as the latter is required when embedding this component into an incr_dom app --
since incr_dom likes to always have the root node be in focus, it is required that
one constructs one big overall Keyboard_event_handler.t for the entire page.
*)valview_with_keydown_handler:t->Vdom.Node.tendtypeper_subwidget={default_selection_status:Selection_status.t;all_items:Item.Set.t}valbonsai:?initial_model_settings:Single_factor.Initial_model_settings.tKey.Map.t->all_keys:Key.Set.t->id_prefix:stringValue.t->per_subwidgetKey.Map.tValue.t->Result.tComputation.tendmoduletypeMulti_factor=sigmoduletypeS=SmoduletypeKey=KeymoduleMake(Item:Single_factor.Item)(Key:Key):SwithmoduleItem:=ItemandmoduleKey:=Keyend