A library for building dynamic webapps, using Js_of_ocaml
Module type
Class type
Library bonsai.web_ui_drag_and_drop
module Model : sig ... end
type ('source_id, 'target_id) t

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_targets 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

val model : ( 'source_id, 'target_id ) t -> ( 'source_id, 'target_id ) Model.t

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.

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