bonsai
-
bonsai
-
-
bonsai.bench
-
bonsai.example_chat_open_source_native
-
bonsai.example_chat_open_source_native_common
-
-
bonsai.extra
-
-
bonsai.focus_ring
-
bonsai.protocol
-
bonsai.tailwind_colors
-
bonsai.test
-
bonsai.test.dot
-
bonsai.web_test
-
bonsai.web_ui_common_components
-
bonsai.web_ui_drag_and_drop
-
bonsai.web_ui_element_size_hooks
-
bonsai.web_ui_file
-
bonsai.web_ui_file_from_web_file
-
bonsai.web_ui_form
-
-
bonsai.web_ui_freeform_multiselect
-
bonsai.web_ui_multi_select
-
-
bonsai.web_ui_query_box
-
bonsai.web_ui_reorderable_list
-
bonsai.web_ui_typeahead
Library
Module
Module type
Parameter
Class
Class type
module Model : sig ... end
Contains everything needed to build drag-and-drop components. Each value of this type represents its own universe of drag-and-drop attributes. Nodes which have the source
attribute from one universe cannot be dragged on top of drop_target
s from another universe.
val source :
( 'source_id, 'target_id ) t ->
id:'source_id ->
Virtual_dom.Vdom.Attr.t
A node with the source
attribute will set its universe's currently dragged value to the input 'source_id
.
val sentinel :
( 'source_id, 'target_id ) t ->
name:string ->
Virtual_dom.Vdom.Attr.t
While this attribute does nothing while the app is running, it facilitates testing by allowing tests to directly change the state of the universe.
val drop_target :
( 'source_id, 'target_id ) t ->
id:'target_id ->
Virtual_dom.Vdom.Attr.t
Designates a "drop zone" node in a particular universe
Extracts the current state of the universe. This is useful for providing visual feedback about what will happen if an item is dropped
val create :
Core.Source_code_position.t ->
source_id:(module Bonsai.Model with type t = 'source_id) ->
target_id:(module Bonsai.Model with type t = 'target_id) ->
on_drop:( 'source_id -> 'target_id -> unit Ui_effect.t ) Bonsai.Value.t ->
( 'source_id, 'target_id ) t Bonsai.Computation.t
Creates a new drag-and-drop universe.
val dragged_element :
( 'source_id, _ ) t Bonsai.Value.t ->
f:
( 'source_id Bonsai.Value.t ->
Virtual_dom.Vdom.Node.t Bonsai.Computation.t ) ->
Virtual_dom.Vdom.Node.t Bonsai.Computation.t
A node which is follows the mouse when something is being dragged, but is invisible otherwise. The result of f
is wrapped in a div
which has the same dimensions as the element which was originally dragged, allowing the drag operation to look visually seamless.
module For_testing : sig ... end