ConstraintInput
@whittakertech/mosaic / ConstraintInput
Interface: ConstraintInput
Defined in: constraints.ts:57
The input to a drag-and-drop constraint evaluation.
Passed as a single object so the constraint surface can grow across the v0.3 milestone (drop-target kind here in #11; ancestor chain and group options in #12/#13) without churning call sites.
Properties
container?
optional container: HTMLElement;Defined in: constraints.ts:99
The element the dragged node would be inserted into, mirroring ResolvedTarget.container (#12). Used to detect circular nesting — dropping a node into itself or one of its own descendants.
crossGroupDrag?
optional crossGroupDrag: boolean;Defined in: constraints.ts:92
Whether cross-group drops are permitted for this drag (mirrors
MosaicOptions.crossGroupDrag). Defaults to false when omitted.
depth?
optional depth: number;Defined in: constraints.ts:106
Nesting depth of the resolved target, mirroring ResolvedTarget.depth (#12). Compared against MosaicOptions.maxNestingDepth when both are provided.
dragged
dragged: HTMLElement;Defined in: constraints.ts:59
The element being dragged.
kind?
optional kind: TargetKind;Defined in: constraints.ts:71
The resolved kind of the drop target, when known.
Supplied by the resolveTarget resolver. Omitted for self-drops and for direct callers that have not resolved a kind; validity is then derived from the selectors.
maxNestingDepth?
optional maxNestingDepth: number;Defined in: constraints.ts:112
Caps nesting depth for this drag (mirrors
MosaicOptions.maxNestingDepth). undefined means unlimited.
selectors
selectors: object;Defined in: constraints.ts:74
The active selector configuration.
children?
optional children: string;Optional selector identifying child elements within a draggable node.
Remarks
This selector is intended for structural clarity and future extensibility. It is not required for basic drag-and-drop behavior.
dropTarget?
optional dropTarget: string;Optional selector identifying explicit drop destinations.
Remarks
When provided, elements matching this selector become valid drop targets
in addition to draggable nodes, and are distinguished from nodes via the
targetType field on hover events and the dropTarget CSS class.
When omitted, v0.2 behavior is preserved — draggable nodes are the only valid drop targets.
group?
optional group: string;Optional selector identifying logical grouping elements.
Remarks
When provided, group-container elements scope drag behavior: a node
dragged within its group reorders only among siblings in that group,
and drops outside the group are rejected (reason "group-boundary")
unless MosaicOptions.crossGroupDrag is enabled.
handle?
optional handle: string;Optional selector identifying a drag handle within a node.
Remarks
When provided, pointerdown only initiates a drag when its target
matches (or is a descendant of) an element matching this selector
within the node — the handle may be nested at any depth. A
pointerdown elsewhere on the node is ignored.
When omitted, the entire node remains draggable (v0.2 behavior).
node
node: string;Selector matching draggable nodes.
This selector defines which elements participate in drag operations.
sourceGroup?
optional sourceGroup: HTMLElement | null;Defined in: constraints.ts:80
The dragged node’s group container at drag start, or null/undefined
when ungrouped. Populated via resolveGroup (#13).
sourceInstanceId?
optional sourceInstanceId: string;Defined in: constraints.ts:120
The dragging (origin) Mosaic instance’s mosaicInstanceId (#160/
RM-21.4). Only populated for a cross-container drop — a linked
peer’s DOM, per MosaicOptions.crossContainerConstraints —
undefined for a same-instance drop.
target
target: HTMLElement;Defined in: constraints.ts:62
The proposed drop target element.
targetGroup?
optional targetGroup: HTMLElement | null;Defined in: constraints.ts:86
The resolved drop target’s group container, or null/undefined when
ungrouped. Populated via resolveGroup (#13).
targetInstanceId?
optional targetInstanceId: string;Defined in: constraints.ts:127
The receiving (target/peer) Mosaic instance’s mosaicInstanceId
(#160/RM-21.4). Only populated for a cross-container drop;
undefined for a same-instance drop.