foldkit-primitives 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { A as ScrollLock, C as targetOf, D as MoveStarted, E as MoveEnded, M as tabbableWithin, O as Moved, S as Targets, T as Move, _ as boxOf, a as TextEdited, b as TargetHovered, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as PointerDrag, h as DraggedOver, i as TextCommitted, j as FocusScope, k as HideOutside, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as zoneOf, w as Fact, x as TargetPressed, y as TargetFact } from "../editable-text-CKkS_mWt.mjs";
1
+ import { A as ScrollLock, C as targetOf, D as MoveStarted, E as MoveEnded, M as tabbableWithin, O as Moved, S as Targets, T as Move, _ as boxOf, a as TextEdited, b as TargetHovered, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as PointerDrag, h as DraggedOver, i as TextCommitted, j as FocusScope, k as HideOutside, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as zoneOf, w as Fact, x as TargetPressed, y as TargetFact } from "../editable-text-BbsPOATY.mjs";
2
2
  import { Schema, Stream } from "effect";
3
3
  import * as Mount from "foldkit/mount";
4
4
  import { Command } from "foldkit/command";
@@ -1,4 +1,4 @@
1
- import { C as MoveEnded, D as ScrollLock, E as HideOutside, O as FocusScope, S as Move, T as Moved, _ as zoneOf, a as TextCommitted, b as Targets, c as DRAG_THRESHOLD, d as DragPlace, f as DragStarted, g as boxOf, h as PointerDrag, i as TextCancelled, k as tabbableWithin, l as DragCancelled, m as DraggedOver, n as EditAsked, o as TextEdited, p as DragZone, r as EditableText, s as textOf, t as FollowTabStop, u as DragDropped, v as TargetHovered, w as MoveStarted, x as targetOf, y as TargetPressed } from "../follow-tab-stop-BSZsUrrk.mjs";
1
+ import { C as MoveEnded, D as ScrollLock, E as HideOutside, O as FocusScope, S as Move, T as Moved, _ as zoneOf, a as TextCommitted, b as Targets, c as DRAG_THRESHOLD, d as DragPlace, f as DragStarted, g as boxOf, h as PointerDrag, i as TextCancelled, k as tabbableWithin, l as DragCancelled, m as DraggedOver, n as EditAsked, o as TextEdited, p as DragZone, r as EditableText, s as textOf, t as FollowTabStop, u as DragDropped, v as TargetHovered, w as MoveStarted, x as targetOf, y as TargetPressed } from "../follow-tab-stop-BDxyoUPQ.mjs";
2
2
  import { Effect, Option, Queue, Schema, Stream } from "effect";
3
3
  import * as Mount from "foldkit/mount";
4
4
  import { defineMessageUnion } from "foldkit/message";
@@ -91,10 +91,15 @@ declare const Targets: Mount.MountDefinitionWithArgs<"Targets", {
91
91
  //#region src/dom/pointer-drag.d.ts
92
92
  declare const DragZone: Schema.Literals<readonly ["before", "inside", "after"]>;
93
93
  type DragZone = typeof DragZone.Type;
94
- /** A marked descendant under the pointer, and the zone of it the pointer is in. */
94
+ /**
95
+ * A marked descendant under the pointer, and the zone of it the pointer is in.
96
+ * `part` is the value of the `part` attribute on the element found, such as
97
+ * the empty Region of a node a drop goes into; a place with one is `inside`.
98
+ */
95
99
  declare const DragPlace: Schema.Struct<{
96
100
  readonly id: Schema.String;
97
101
  readonly zone: Schema.Literals<readonly ["before", "inside", "after"]>;
102
+ readonly part: Schema.optionalKey<Schema.String>;
98
103
  }>;
99
104
  type DragPlace = typeof DragPlace.Type;
100
105
  declare const DragStarted: Schema.TaggedStruct<"DragStarted", {
@@ -107,6 +112,7 @@ declare const DraggedOver: Schema.TaggedStruct<"DraggedOver", {
107
112
  readonly over: Schema.NullOr<Schema.Struct<{
108
113
  readonly id: Schema.String;
109
114
  readonly zone: Schema.Literals<readonly ["before", "inside", "after"]>;
115
+ readonly part: Schema.optionalKey<Schema.String>;
110
116
  }>>;
111
117
  /**
112
118
  * For a drag onto `targets`: whether the pointer is inside the region they
@@ -121,6 +127,7 @@ declare const DragDropped: Schema.TaggedStruct<"DragDropped", {
121
127
  readonly over: Schema.NullOr<Schema.Struct<{
122
128
  readonly id: Schema.String;
123
129
  readonly zone: Schema.Literals<readonly ["before", "inside", "after"]>;
130
+ readonly part: Schema.optionalKey<Schema.String>;
124
131
  }>>;
125
132
  /** As `DraggedOver`'s: released inside the `targets` region. */
126
133
  readonly region: Schema.optionalKey<Schema.Boolean>;
@@ -159,6 +166,11 @@ declare const PointerDrag: Mount.MountDefinitionWithArgs<"PointerDrag", {
159
166
  readonly attribute: Schema.String;
160
167
  readonly within: Schema.String;
161
168
  }>>;
169
+ /**
170
+ * An attribute that names a part of what a drop lands on, on an element
171
+ * also marked as one: a place over it carries the part and is `inside`.
172
+ */
173
+ part: Schema.optionalKey<Schema.String>;
162
174
  }, {
163
175
  readonly _tag: "DragStarted";
164
176
  readonly id: string;
@@ -167,6 +179,7 @@ declare const PointerDrag: Mount.MountDefinitionWithArgs<"PointerDrag", {
167
179
  readonly over: {
168
180
  readonly id: string;
169
181
  readonly zone: "inside" | "before" | "after";
182
+ readonly part?: string;
170
183
  } | null;
171
184
  readonly region?: boolean;
172
185
  } | {
@@ -175,6 +188,7 @@ declare const PointerDrag: Mount.MountDefinitionWithArgs<"PointerDrag", {
175
188
  readonly over: {
176
189
  readonly id: string;
177
190
  readonly zone: "inside" | "before" | "after";
191
+ readonly part?: string;
178
192
  } | null;
179
193
  readonly region?: boolean;
180
194
  } | {
@@ -232,4 +246,4 @@ declare const EditableText: Mount.MountDefinitionWithArgs<"EditableText", {
232
246
  }>;
233
247
  //#endregion
234
248
  export { ScrollLock as A, targetOf as C, MoveStarted as D, MoveEnded as E, tabbableWithin as M, Moved as O, Targets as S, Move as T, boxOf as _, TextEdited as a, TargetHovered as b, DRAG_THRESHOLD as c, DragFact as d, DragPlace as f, PointerDrag as g, DraggedOver as h, TextCommitted as i, FocusScope as j, HideOutside as k, DragCancelled as l, DragZone as m, EditableText as n, TextFact as o, DragStarted as p, TextCancelled as r, textOf as s, EditAsked as t, DragDropped as u, zoneOf as v, Fact as w, TargetPressed as x, TargetFact as y };
235
- //# sourceMappingURL=editable-text-CKkS_mWt.d.mts.map
249
+ //# sourceMappingURL=editable-text-BbsPOATY.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editable-text-BbsPOATY.d.mts","names":[],"sources":["../src/dom/focus-scope.ts","../src/dom/layers.ts","../src/dom/move.ts","../src/dom/targets.ts","../src/dom/pointer-drag.ts","../src/dom/editable-text.ts"],"mappings":";;;;cA0Ba,iBAAkB,MAAM,YAAU,cAAc;cAYhD,YAAU,MAAA;;;;;;;;;;;cCvBV,YAAU,MAAA;cAUV,aAAW,MAAA;;;cCfX,aAAW,OAAA;;;;KAIZ,qBAAqB,YAAY;cAEhC,OAAK,OAAA;;;;;;;KAON,eAAe,MAAM;cAEpB,WAAS,OAAA;;;;;KAKV,mBAAmB,UAAU;KAE7B,OAAO,cAAc,QAAQ;cAe5B,MAAI,MAAA;;;;;;;;;;;;;;;;;cClCJ,eAAa,OAAA;;;;KAId,uBAAuB,cAAc;cAEpC,eAAa,OAAA;;;;;;;KAOd,uBAAuB,cAAc;KAErC,aAAa,gBAAgB;;cAU5B,WAAY,WAAW,SAAS,MAAM,oBAAoB;cAM1D,SAAO,MAAA;;;;;;;;;;;;;;;;;;cC1BP,UAAQ,OAAA;KACT,kBAAkB,SAAS;;;;;;cAO1B,WAAS,OAAA;;;;;KAKV,mBAAmB,UAAU;cAE5B,aAAW,OAAA;;;;KAIZ,qBAAqB,YAAY;cAEhC,aAAW,OAAA;;;;;;;;;;;;;;KAUZ,qBAAqB,YAAY;cAEhC,aAAW,OAAA;;;;;;;;;;KAMZ,qBAAqB,YAAY;cAEhC,eAAa,OAAA;;;KACd,uBAAuB,cAAc;KAErC,WAAW,cAAc,cAAc,cAAc;;cAGpD;UAEH;WACC;WACA;;;cAIE,SAAU,KAAK,KAAK,cAAY;;;;;cAUhC,QAAS,SAAS,YAAU;cAgB5B,aAAW,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC1EX,YAAU,OAAA;;;;;KAKX,oBAAoB,WAAW;cAE9B,eAAa,OAAA;;;;KAId,uBAAuB,cAAc;cAEpC,eAAa,OAAA;;;;;KAKd,uBAAuB,cAAc;cAEpC,WAAS,OAAA;;;;KAIV,mBAAmB,UAAU;KAE7B,WAAW,aAAa,gBAAgB,gBAAgB;;;;;cASvD,SAAU,SAAS;cAoBnB,cAAY,MAAA"}
@@ -296,10 +296,15 @@ const DragZone = Schema.Literals([
296
296
  "inside",
297
297
  "after"
298
298
  ]);
299
- /** A marked descendant under the pointer, and the zone of it the pointer is in. */
299
+ /**
300
+ * A marked descendant under the pointer, and the zone of it the pointer is in.
301
+ * `part` is the value of the `part` attribute on the element found, such as
302
+ * the empty Region of a node a drop goes into; a place with one is `inside`.
303
+ */
300
304
  const DragPlace = Schema.Struct({
301
305
  id: Schema.String,
302
- zone: DragZone
306
+ zone: DragZone,
307
+ part: Schema.optionalKey(Schema.String)
303
308
  });
304
309
  const DragStarted = Schema.TaggedStruct("DragStarted", {
305
310
  /** The marked descendant being dragged. */
@@ -360,9 +365,14 @@ const PointerDrag = Mount.defineStream("PointerDrag", {
360
365
  targets: Schema.optionalKey(Schema.Struct({
361
366
  attribute: Schema.String,
362
367
  within: Schema.String
363
- }))
368
+ })),
369
+ /**
370
+ * An attribute that names a part of what a drop lands on, on an element
371
+ * also marked as one: a place over it carries the part and is `inside`.
372
+ */
373
+ part: Schema.optionalKey(Schema.String)
364
374
  },
365
- execute: ({ element, attribute, targets }) => Stream.callback((queue) => Effect.acquireRelease(Effect.sync(() => {
375
+ execute: ({ element, attribute, targets, part }) => Stream.callback((queue) => Effect.acquireRelease(Effect.sync(() => {
366
376
  const owner = element.ownerDocument;
367
377
  const landsOn = targets?.attribute ?? attribute;
368
378
  const regionOf = (within) => {
@@ -393,10 +403,15 @@ const PointerDrag = Mount.defineStream("PointerDrag", {
393
403
  const under = typeof owner.elementFromPoint === "function" && event.clientX !== void 0 ? owner.elementFromPoint(event.clientX, event.clientY ?? 0) : null;
394
404
  const { marked, inRegion: region } = find(under ?? event.target);
395
405
  const id = marked?.getAttribute(landsOn) ?? null;
406
+ const named = part === void 0 ? null : marked?.getAttribute(part) ?? null;
396
407
  return {
397
- place: marked === null || id === null || targets === void 0 && id === dragging ? null : {
408
+ place: marked === null || id === null || targets === void 0 && id === dragging ? null : named === null ? {
398
409
  id,
399
410
  zone: zoneOf(boxOf(marked), event.clientY ?? 0)
411
+ } : {
412
+ id,
413
+ zone: "inside",
414
+ part: named
400
415
  },
401
416
  region
402
417
  };
@@ -438,7 +453,7 @@ const PointerDrag = Mount.defineStream("PointerDrag", {
438
453
  Queue.offerUnsafe(queue, DragStarted.make({ id: dragging }));
439
454
  }
440
455
  const { place, region } = placeAt(positioned);
441
- if (place?.id === over?.id && place?.zone === over?.zone && region === inRegion) return;
456
+ if (place?.id === over?.id && place?.zone === over?.zone && place?.part === over?.part && region === inRegion) return;
442
457
  over = place;
443
458
  inRegion = region;
444
459
  Queue.offerUnsafe(queue, DraggedOver.make({
@@ -802,4 +817,4 @@ const FollowTabStop = Mount.defineStream("FollowTabStop", {
802
817
  //#endregion
803
818
  export { MoveEnded as C, ScrollLock as D, HideOutside as E, FocusScope as O, Move as S, Moved as T, zoneOf as _, TextCommitted as a, Targets as b, DRAG_THRESHOLD as c, DragPlace as d, DragStarted as f, boxOf as g, PointerDrag as h, TextCancelled as i, tabbableWithin as k, DragCancelled as l, DraggedOver as m, EditAsked as n, TextEdited as o, DragZone as p, EditableText as r, textOf as s, FollowTabStop as t, DragDropped as u, TargetHovered as v, MoveStarted as w, targetOf as x, TargetPressed as y };
804
819
 
805
- //# sourceMappingURL=follow-tab-stop-BSZsUrrk.mjs.map
820
+ //# sourceMappingURL=follow-tab-stop-BDxyoUPQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"follow-tab-stop-BDxyoUPQ.mjs","names":[],"sources":["../src/dom/focus-scope.ts","../src/dom/layers.ts","../src/dom/move.ts","../src/dom/targets.ts","../src/dom/pointer-drag.ts","../src/dom/editable-text.ts","../src/dom/follow-tab-stop.ts"],"sourcesContent":["/**\n * A focus scope as a Mount: on insert it remembers what was focused, focuses\n * an initial element inside, and with `contain` keeps Tab and Shift+Tab\n * cycling inside; on unmount it gives focus back. Nothing crosses to the\n * Model: which element had focus is a DOM fact, so this is element lifecycle,\n * not state. It emits no Messages.\n */\nimport { Effect, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\n\nconst FOCUSABLE = [\n 'a[href]',\n 'button:not([disabled])',\n 'input:not([disabled]):not([type=\"hidden\"])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]',\n '[contenteditable=\"true\"]',\n].join(', ')\n\nconst isVisible = (element: Element): boolean => {\n const probe = element as { checkVisibility?: () => boolean }\n return element.closest('[hidden], [inert]') === null && (probe.checkVisibility?.() ?? true)\n}\n\n/** Tabbable descendants in DOM order: focusable, visible, and not `tabindex=\"-1\"`. */\nexport const tabbableWithin = (root: Element): ReadonlyArray<HTMLElement> =>\n Array.from(root.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n element => element.tabIndex >= 0 && isVisible(element),\n )\n\nconst focusFirst = (elements: ReadonlyArray<HTMLElement>): boolean => {\n const first = elements[0]\n if (first === undefined) return false\n first.focus()\n return true\n}\n\nexport const FocusScope = Mount.defineStream('FocusScope', {\n messages: [Schema.Never],\n args: {\n /** Keep Tab, Shift+Tab, and a stray focus inside. */\n contain: Schema.Boolean,\n /** Give focus back to what had it, on unmount. */\n restore: Schema.Boolean,\n /** A selector inside the element to focus first; else the first tabbable\n * descendant, else the element itself when it is focusable. */\n initialFocus: Schema.NullOr(Schema.String),\n },\n execute: ({ element, contain, restore, initialFocus }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n Effect.sync(() => {\n const ownerDocument = element.ownerDocument\n const previous = ownerDocument.activeElement\n const initial =\n initialFocus === null ? null : element.querySelector<HTMLElement>(initialFocus)\n if (initial !== null) initial.focus()\n else if (!focusFirst(tabbableWithin(element)) && element instanceof HTMLElement) {\n element.focus()\n }\n const onKeyDown = (event: Event) => {\n const key = event as KeyboardEvent\n if (key.key !== 'Tab') return\n const tabbable = tabbableWithin(element)\n const first = tabbable[0]\n const last = tabbable[tabbable.length - 1]\n if (first === undefined || last === undefined) {\n key.preventDefault()\n return\n }\n const active = ownerDocument.activeElement\n if (key.shiftKey && (active === first || !element.contains(active))) {\n key.preventDefault()\n last.focus()\n } else if (!key.shiftKey && (active === last || !element.contains(active))) {\n key.preventDefault()\n first.focus()\n }\n }\n const onFocusIn = (event: Event) => {\n const target = event.target\n if (target instanceof Node && element.contains(target)) return\n focusFirst(tabbableWithin(element))\n }\n if (contain) {\n element.addEventListener('keydown', onKeyDown)\n ownerDocument.addEventListener('focusin', onFocusIn)\n }\n return { previous, onKeyDown, onFocusIn, ownerDocument }\n }),\n ({ previous, onKeyDown, onFocusIn, ownerDocument }) =>\n Effect.sync(() => {\n if (contain) {\n element.removeEventListener('keydown', onKeyDown)\n ownerDocument.removeEventListener('focusin', onFocusIn)\n }\n if (restore && previous instanceof HTMLElement && ownerDocument.contains(previous)) {\n previous.focus()\n }\n }),\n ),\n ),\n})\n","/**\n * Two Mounts over Foldkit's own DOM helpers, for an overlay that is not a\n * native `<dialog>` or `popover`:\n *\n * - `ScrollLock` locks the document's scroll while mounted. Foldkit's lock is\n * refcounted, so nested overlays release it only when the last one goes.\n * - `HideOutside` marks everything outside the element inert while mounted,\n * through `Dom.inertOthers`, keyed by an id this Mount mints.\n *\n * Both emit no Messages; they are element lifecycle.\n */\nimport { Effect, Schema, Stream } from 'effect'\nimport * as Dom from 'foldkit/dom'\nimport * as Mount from 'foldkit/mount'\n\nexport const ScrollLock = Mount.defineStream('ScrollLock', {\n messages: [Schema.Never],\n execute: () =>\n Stream.callback<never>(() => Effect.acquireRelease(Dom.lockScroll, () => Dom.unlockScroll)),\n})\n\nconst HIDE_OUTSIDE_ATTRIBUTE = 'data-foldkit-plus-hide-outside'\n\nlet minted = 0\n\nexport const HideOutside = Mount.defineStream('HideOutside', {\n messages: [Schema.Never],\n execute: ({ element }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n Effect.gen(function* () {\n // A per-mount id: Foldkit keys the inert set by it, so two overlays\n // restore independently. The attribute is how the element is found.\n const id = `hide-outside-${(minted += 1)}`\n element.setAttribute(HIDE_OUTSIDE_ATTRIBUTE, id)\n yield* Dom.inertOthers(id, [`[${HIDE_OUTSIDE_ATTRIBUTE}=\"${id}\"]`])\n return id\n }),\n id =>\n Effect.andThen(Dom.restoreInert(id), () =>\n Effect.sync(() => element.removeAttribute(HIDE_OUTSIDE_ATTRIBUTE)),\n ),\n ),\n ),\n})\n","/**\n * Pointer movement on an element as a Mount: a primary-button pointer down\n * captures the pointer, each move reports the delta from where it started,\n * and up, cancel, or lost capture ends it. Nothing is decided here: a drag\n * threshold, a snap, or a constraint is the parent's `update`. Capture is\n * released with the Mount.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\n\nexport const MoveStarted = Schema.TaggedStruct('MoveStarted', {\n pointerId: Schema.Number,\n pointerType: Schema.String,\n})\nexport type MoveStarted = typeof MoveStarted.Type\n\nexport const Moved = Schema.TaggedStruct('Moved', {\n pointerId: Schema.Number,\n /** From where the pointer went down, in CSS pixels. */\n deltaX: Schema.Number,\n deltaY: Schema.Number,\n pointerType: Schema.String,\n})\nexport type Moved = typeof Moved.Type\n\nexport const MoveEnded = Schema.TaggedStruct('MoveEnded', {\n pointerId: Schema.Number,\n /** `false` when the pointer was cancelled or capture was lost. */\n completed: Schema.Boolean,\n})\nexport type MoveEnded = typeof MoveEnded.Type\n\nexport type Fact = MoveStarted | Moved | MoveEnded\n\ntype PointerLike = Event & {\n readonly pointerId?: number\n readonly button?: number\n readonly pointerType?: string\n readonly clientX?: number\n readonly clientY?: number\n}\n\ntype Capturing = Element & {\n setPointerCapture?: (pointerId: number) => void\n releasePointerCapture?: (pointerId: number) => void\n}\n\nexport const Move = Mount.defineStream('Move', {\n messages: [MoveStarted, Moved, MoveEnded],\n execute: ({ element }) =>\n Stream.callback<Fact>(queue =>\n Effect.acquireRelease(\n Effect.sync(() => {\n const target = element as Capturing\n let active: {\n readonly pointerId: number\n readonly x: number\n readonly y: number\n } | null = null\n const offer = (fact: Fact) => Queue.offerUnsafe(queue, fact)\n const end = (pointerId: number, completed: boolean) => {\n if (active === null || active.pointerId !== pointerId) return\n active = null\n try {\n target.releasePointerCapture?.(pointerId)\n } catch {\n // Capture may already be gone; the end is still reported.\n }\n offer(MoveEnded.make({ pointerId, completed }))\n }\n const listeners: ReadonlyArray<readonly [string, (event: Event) => void]> = [\n [\n 'pointerdown',\n event => {\n const pointer = event as PointerLike\n if ((pointer.button ?? 0) !== 0 || active !== null) return\n const pointerId = pointer.pointerId ?? 0\n active = { pointerId, x: pointer.clientX ?? 0, y: pointer.clientY ?? 0 }\n try {\n target.setPointerCapture?.(pointerId)\n } catch {\n // Without capture the move still reports while over the element.\n }\n offer(MoveStarted.make({ pointerId, pointerType: pointer.pointerType ?? 'mouse' }))\n },\n ],\n [\n 'pointermove',\n event => {\n const pointer = event as PointerLike\n const pointerId = pointer.pointerId ?? 0\n if (active === null || active.pointerId !== pointerId) return\n offer(\n Moved.make({\n pointerId,\n deltaX: (pointer.clientX ?? 0) - active.x,\n deltaY: (pointer.clientY ?? 0) - active.y,\n pointerType: pointer.pointerType ?? 'mouse',\n }),\n )\n },\n ],\n ['pointerup', event => end((event as PointerLike).pointerId ?? 0, true)],\n ['pointercancel', event => end((event as PointerLike).pointerId ?? 0, false)],\n ['lostpointercapture', event => end((event as PointerLike).pointerId ?? 0, false)],\n ]\n for (const [type, listener] of listeners) element.addEventListener(type, listener)\n return { listeners, current: () => active }\n }),\n ({ listeners, current }) =>\n Effect.sync(() => {\n for (const [type, listener] of listeners) element.removeEventListener(type, listener)\n const pointer = current()\n if (pointer !== null) {\n try {\n ;(element as Capturing).releasePointerCapture?.(pointer.pointerId)\n } catch {\n // Already released.\n }\n }\n }),\n ),\n ),\n})\n","/**\n * Which marked descendant of an element the pointer is over, and which one was\n * pressed, as a Mount: one set of listeners on the container, not one per item.\n * A descendant is marked by an attribute whose value is its id, such as a\n * canvas's `data-composition-node` or a table's `data-row`. The nearest marked\n * ancestor of the event's target, inside the container, is the one reported.\n *\n * What hovering or pressing means (a selection, an outline, a menu) is the\n * parent's `update`.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\n\nexport const TargetHovered = Schema.TaggedStruct('TargetHovered', {\n /** The marked descendant under the pointer, or `null` when there is none. */\n id: Schema.NullOr(Schema.String),\n})\nexport type TargetHovered = typeof TargetHovered.Type\n\nexport const TargetPressed = Schema.TaggedStruct('TargetPressed', {\n id: Schema.String,\n shiftKey: Schema.Boolean,\n altKey: Schema.Boolean,\n ctrlKey: Schema.Boolean,\n metaKey: Schema.Boolean,\n})\nexport type TargetPressed = typeof TargetPressed.Type\n\nexport type TargetFact = TargetHovered | TargetPressed\n\ntype Modified = Event & {\n readonly shiftKey?: boolean\n readonly altKey?: boolean\n readonly ctrlKey?: boolean\n readonly metaKey?: boolean\n}\n\n/** The id of the nearest marked element at or above `from`, inside `container`. */\nexport const targetOf = (container: Element, from: EventTarget | null, attribute: string) => {\n if (!(from instanceof Element)) return null\n const marked = from.closest(`[${attribute}]`)\n return marked !== null && container.contains(marked) ? marked.getAttribute(attribute) : null\n}\n\nexport const Targets = Mount.defineStream('Targets', {\n messages: [TargetHovered, TargetPressed],\n args: {\n /** The attribute that marks a descendant, holding its id. */\n attribute: Schema.String,\n /** Prevent a press's default, such as a link navigating inside an editor's canvas. */\n preventDefault: Schema.Boolean,\n },\n execute: ({ element, attribute, preventDefault }) =>\n Stream.callback<TargetFact>(queue =>\n Effect.acquireRelease(\n Effect.sync(() => {\n let hovered: string | null = null\n const hover = (id: string | null) => {\n if (id === hovered) return\n hovered = id\n Queue.offerUnsafe(queue, TargetHovered.make({ id }))\n }\n const listeners: ReadonlyArray<readonly [string, (event: Event) => void]> = [\n ['pointerover', event => hover(targetOf(element, event.target, attribute))],\n ['pointerleave', () => hover(null)],\n [\n 'click',\n event => {\n const id = targetOf(element, event.target, attribute)\n if (id === null) return\n if (preventDefault) event.preventDefault()\n const modified = event as Modified\n Queue.offerUnsafe(\n queue,\n TargetPressed.make({\n id,\n shiftKey: modified.shiftKey === true,\n altKey: modified.altKey === true,\n ctrlKey: modified.ctrlKey === true,\n metaKey: modified.metaKey === true,\n }),\n )\n },\n ],\n ]\n for (const [type, listener] of listeners) element.addEventListener(type, listener)\n return listeners\n }),\n listeners =>\n Effect.sync(() => {\n for (const [type, listener] of listeners) element.removeEventListener(type, listener)\n }),\n ),\n ),\n})\n","/**\n * Dragging one marked descendant of an element onto another, as a Mount. A\n * descendant is marked by an attribute whose value is its id, as `Targets`\n * marks them; a press on one that then moves past a threshold starts a drag,\n * and the pointer's place over another marked descendant is reported with the\n * zone of it the pointer is in: its first third (`before`), its middle\n * (`inside`), or its last third (`after`). Releasing drops, and Escape or a\n * cancelled pointer ends the drag with nothing dropped.\n *\n * It writes no roles, no `tabindex` and no key handling, so the marked\n * elements can be anything: a tree's rows, a canvas's nodes. The keyboard's way\n * to do what a drag does is the parent's to give. Geometry is measured when the\n * pointer moves and never kept; what a drop means is the parent's `update`.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\nimport { targetOf } from './targets.js'\n\nexport const DragZone = Schema.Literals(['before', 'inside', 'after'])\nexport type DragZone = typeof DragZone.Type\n\n/**\n * A marked descendant under the pointer, and the zone of it the pointer is in.\n * `part` is the value of the `part` attribute on the element found, such as\n * the empty Region of a node a drop goes into; a place with one is `inside`.\n */\nexport const DragPlace = Schema.Struct({\n id: Schema.String,\n zone: DragZone,\n part: Schema.optionalKey(Schema.String),\n})\nexport type DragPlace = typeof DragPlace.Type\n\nexport const DragStarted = Schema.TaggedStruct('DragStarted', {\n /** The marked descendant being dragged. */\n id: Schema.String,\n})\nexport type DragStarted = typeof DragStarted.Type\n\nexport const DraggedOver = Schema.TaggedStruct('DraggedOver', {\n /** Where the pointer is, or `null` over nothing marked, or over what is dragged. */\n over: Schema.NullOr(DragPlace),\n /**\n * For a drag onto `targets`: whether the pointer is inside the region they\n * are in, so `over: null` with `region: true` is its empty space (an empty\n * page, the space below the last node). Absent for a drag among its own.\n */\n region: Schema.optionalKey(Schema.Boolean),\n})\nexport type DraggedOver = typeof DraggedOver.Type\n\nexport const DragDropped = Schema.TaggedStruct('DragDropped', {\n id: Schema.String,\n over: Schema.NullOr(DragPlace),\n /** As `DraggedOver`'s: released inside the `targets` region. */\n region: Schema.optionalKey(Schema.Boolean),\n})\nexport type DragDropped = typeof DragDropped.Type\n\nexport const DragCancelled = Schema.TaggedStruct('DragCancelled', { id: Schema.String })\nexport type DragCancelled = typeof DragCancelled.Type\n\nexport type DragFact = DragStarted | DraggedOver | DragDropped | DragCancelled\n\n/** How far, in CSS pixels, a press moves before it is a drag rather than a click. */\nexport const DRAG_THRESHOLD = 4\n\ninterface Box {\n readonly top: number\n readonly height: number\n}\n\n/** The zone of a box a vertical position falls in, by thirds. */\nexport const zoneOf = (box: Box, y: number): DragZone => {\n if (box.height <= 0) return 'inside'\n const at = (y - box.top) / box.height\n return at < 1 / 3 ? 'before' : at > 2 / 3 ? 'after' : 'inside'\n}\n\n/**\n * An element's box. An element drawn as `display: contents` has none, so its\n * first child's stands for it, as an editor's node wrapper's does.\n */\nexport const boxOf = (element: Element): Box => {\n const own = element.getBoundingClientRect()\n if (own.width > 0 || own.height > 0) return own\n const child = element.firstElementChild\n return child === null ? own : boxOf(child)\n}\n\ntype Positioned = Event & {\n readonly clientX?: number\n readonly clientY?: number\n readonly button?: number\n readonly buttons?: number\n readonly pointerId?: number\n readonly key?: string\n}\n\nexport const PointerDrag = Mount.defineStream('PointerDrag', {\n messages: [DragStarted, DraggedOver, DragDropped, DragCancelled],\n args: {\n /** The attribute that marks a descendant, holding its id. */\n attribute: Schema.String,\n /**\n * Where a drag may land, when not on the element's own marked descendants:\n * the elements marked by `attribute` inside the one `within` selects, such\n * as a palette's Blocks dragged onto a page. A drop's `over` is then one of\n * those; what is dragged is still one of the element's own. `within` is\n * looked for nearest first, under the element's closest ancestor that holds\n * a match, so two editors on one page each drop onto their own.\n */\n targets: Schema.optionalKey(Schema.Struct({ attribute: Schema.String, within: Schema.String })),\n /**\n * An attribute that names a part of what a drop lands on, on an element\n * also marked as one: a place over it carries the part and is `inside`.\n */\n part: Schema.optionalKey(Schema.String),\n },\n execute: ({ element, attribute, targets, part }) =>\n Stream.callback<DragFact>(queue =>\n Effect.acquireRelease(\n Effect.sync(() => {\n const owner = element.ownerDocument\n // What a drop lands on: the element's own marked descendants, or those of `targets`.\n const landsOn = targets?.attribute ?? attribute\n // Looked for at each move, so a redraw that replaced it is followed.\n const regionOf = (within: string): Element | null => {\n for (let at = element.parentElement; at !== null; at = at.parentElement) {\n const found = at.querySelector(within)\n if (found !== null) return found\n }\n return null\n }\n const find = (from: EventTarget | null) => {\n if (!(from instanceof Element)) return { marked: null, inRegion: false }\n const region = targets === undefined ? element : regionOf(targets.within)\n const marked = from.closest(`[${landsOn}]`)\n return {\n marked: marked !== null && region !== null && region.contains(marked) ? marked : null,\n // Only a drag onto `targets` tells its region's empty space from elsewhere.\n inRegion: targets !== undefined && region !== null && region.contains(from),\n }\n }\n // A press not yet a drag, or a drag under way: one pointer's, the first down.\n let pressed: {\n readonly id: string\n readonly pointer: number | undefined\n readonly x: number\n readonly y: number\n } | null = null\n let dragging: string | null = null\n let over: DragPlace | null = null\n let inRegion = false\n // The click that ends a drag is not a press on what it ends over.\n let swallowClick = false\n\n const placeAt = (event: Positioned) => {\n // Touch and pen capture the pointer to where it went down, so the\n // event's target is the dragged element: ask what is under it instead.\n const under =\n typeof owner.elementFromPoint === 'function' && event.clientX !== undefined\n ? owner.elementFromPoint(event.clientX, event.clientY ?? 0)\n : null\n const { marked, inRegion: region } = find(under ?? event.target)\n const id = marked?.getAttribute(landsOn) ?? null\n // Over itself is over nothing, where what is dragged is among what it lands on.\n const named = part === undefined ? null : (marked?.getAttribute(part) ?? null)\n const place: DragPlace | null =\n marked === null || id === null || (targets === undefined && id === dragging)\n ? null\n : named === null\n ? { id, zone: zoneOf(boxOf(marked), event.clientY ?? 0) }\n : { id, zone: 'inside', part: named }\n return { place, region }\n }\n /** The region flag a fact carries: only for a drag onto `targets`. */\n const withRegion = (region: boolean) => (targets === undefined ? {} : { region })\n const ours = (event: Positioned) =>\n pressed !== null &&\n (pressed.pointer === undefined || event.pointerId === pressed.pointer)\n // `inside`: the release was on the container, so its click will reach it.\n // The release is hit-tested again: the layout may have moved since\n // the last move (a scroll, a row that shifted), and the drop says\n // where the pointer was let go, not where it was last seen. A\n // release with no position of its own keeps the last move's answer.\n const end = (dropped: boolean, at?: Positioned, inside = false) => {\n const id = dragging\n if (id !== null && at?.clientX !== undefined && at.clientY !== undefined) {\n const { place, region } = placeAt(at)\n over = place\n inRegion = region\n }\n pressed = null\n dragging = null\n const last = over\n const lastRegion = inRegion\n over = null\n inRegion = false\n release()\n if (id === null) return\n swallowClick = dropped && inside\n Queue.offerUnsafe(\n queue,\n dropped\n ? DragDropped.make({ id, over: last, ...withRegion(lastRegion) })\n : DragCancelled.make({ id }),\n )\n }\n\n const onDocument: ReadonlyArray<readonly [string, (event: Event) => void]> = [\n [\n 'pointermove',\n event => {\n const positioned = event as Positioned\n if (!ours(positioned) || pressed === null) return\n // Released where no pointerup reached us, such as over a frame.\n if (positioned.buttons !== undefined && (positioned.buttons & 1) === 0)\n return end(false)\n if (dragging === null) {\n const moved = Math.hypot(\n (positioned.clientX ?? 0) - pressed.x,\n (positioned.clientY ?? 0) - pressed.y,\n )\n if (moved < DRAG_THRESHOLD) return\n dragging = pressed.id\n owner.getSelection()?.removeAllRanges()\n Queue.offerUnsafe(queue, DragStarted.make({ id: dragging }))\n }\n const { place, region } = placeAt(positioned)\n if (\n place?.id === over?.id &&\n place?.zone === over?.zone &&\n place?.part === over?.part &&\n region === inRegion\n )\n return\n over = place\n inRegion = region\n Queue.offerUnsafe(queue, DraggedOver.make({ over: place, ...withRegion(region) }))\n },\n ],\n [\n 'pointerup',\n event => {\n if (!ours(event as Positioned)) return\n if (dragging === null) end(false)\n else\n end(\n true,\n event as Positioned,\n event.target instanceof Node && element.contains(event.target),\n )\n },\n ],\n [\n 'pointercancel',\n event => {\n if (ours(event as Positioned)) end(false)\n },\n ],\n ]\n // Heard on the way down, and kept there: an Escape that ends a drag is the\n // drag's, not also the focused element's (a canvas that would deselect).\n const onEscape = (event: Event) => {\n if (pressed === null || (event as Positioned).key !== 'Escape') return\n event.preventDefault()\n event.stopPropagation()\n end(false)\n }\n // The document is listened to only while a press is under way.\n let listening = false\n const listen = () => {\n if (listening) return\n listening = true\n for (const [type, listener] of onDocument) owner.addEventListener(type, listener)\n owner.addEventListener('keydown', onEscape, true)\n }\n const release = () => {\n if (!listening) return\n listening = false\n for (const [type, listener] of onDocument) owner.removeEventListener(type, listener)\n owner.removeEventListener('keydown', onEscape, true)\n }\n\n const onElement: ReadonlyArray<readonly [string, (event: Event) => void, boolean]> = [\n [\n 'pointerdown',\n event => {\n const positioned = event as Positioned\n // Any press is past the drop a swallowed click was waiting for.\n swallowClick = false\n // A second pointer while one is down is not a new drag.\n if (pressed !== null) return\n if ((positioned.button ?? 0) !== 0) return\n // A press in text being edited selects text: it is no drag.\n if (\n event.target instanceof Element &&\n event.target.closest('[contenteditable]:not([contenteditable=\"false\"])') !== null\n )\n return\n const id = targetOf(element, event.target, attribute)\n if (id === null) return\n pressed = {\n id,\n pointer: positioned.pointerId,\n x: positioned.clientX ?? 0,\n y: positioned.clientY ?? 0,\n }\n listen()\n },\n false,\n ],\n [\n 'click',\n event => {\n if (!swallowClick) return\n swallowClick = false\n event.preventDefault()\n event.stopImmediatePropagation()\n },\n true,\n ],\n // A link or an image would start the browser's own drag instead.\n ['dragstart', event => event.preventDefault(), false],\n ]\n for (const [type, listener, capture] of onElement)\n element.addEventListener(type, listener, capture)\n return { onElement, release }\n }),\n ({ onElement, release }) =>\n Effect.sync(() => {\n for (const [type, listener, capture] of onElement)\n element.removeEventListener(type, listener, capture)\n release()\n }),\n ),\n ),\n})\n","/**\n * Text typed into an editable descendant of an element, as a Mount: one set of\n * listeners on the container, like `Targets`. A field is a descendant marked\n * by an attribute whose value names it, while it is `contenteditable`. The\n * view decides which one is; the Mount focuses it as it becomes so (made\n * editable, or drawn editable), with the caret at its end, and at no other\n * time. When Enter or Escape ends an edit and the view then removes the field\n * or makes it no longer editable, focus, left on nothing, comes back to the\n * container, so the next key reaches it; give the container a `tabindex`. A double-click on a marked field that is not editable yet asks for it\n * to be (`EditAsked`).\n *\n * It reads `innerText`, never `innerHTML`, so what arrives is text. A field is\n * one line unless it carries `aria-multiline=\"true\"`: in one line, a line\n * break becomes a space. Nothing is reported while an input method composes;\n * the composed text arrives once, when it is done.\n *\n * Enter commits (Shift+Enter breaks a line in a multiline field), and so does\n * leaving the field. Escape cancels, and puts the text the field had when\n * editing began back in the DOM, since a view that stopped redrawing the field\n * while it was edited will not. Where the browser lacks `plaintext-only`, a\n * paste is inserted as text. What an edit means is the parent's `update`.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\n\nexport const TextEdited = Schema.TaggedStruct('TextEdited', {\n /** The field, by its marking attribute's value. */\n field: Schema.String,\n text: Schema.String,\n})\nexport type TextEdited = typeof TextEdited.Type\n\nexport const TextCommitted = Schema.TaggedStruct('TextCommitted', {\n field: Schema.String,\n text: Schema.String,\n})\nexport type TextCommitted = typeof TextCommitted.Type\n\nexport const TextCancelled = Schema.TaggedStruct('TextCancelled', {\n field: Schema.String,\n /** The text the field had when editing began, which the DOM shows again. */\n initial: Schema.String,\n})\nexport type TextCancelled = typeof TextCancelled.Type\n\nexport const EditAsked = Schema.TaggedStruct('EditAsked', {\n /** A marked field, not editable yet, that was double-clicked. */\n field: Schema.String,\n})\nexport type EditAsked = typeof EditAsked.Type\n\nexport type TextFact = TextEdited | TextCommitted | TextCancelled | EditAsked\n\n/** Whether a field takes more than one line. */\nconst multiline = (element: HTMLElement) => element.getAttribute('aria-multiline') === 'true'\n\n/**\n * A field's text. A browser ends an edited element with a line break it adds\n * itself, which is not the author's; in one line, the author's breaks are spaces.\n */\nexport const textOf = (element: HTMLElement): string => {\n const text = element.innerText.replace(/\\r\\n?/g, '\\n').replace(/\\n$/, '')\n return multiline(element) ? text : text.replace(/\\n+/g, ' ')\n}\n\n/** Puts the caret at the end of a field, which focuses it too. */\nconst caretAtEnd = (field: HTMLElement) => {\n // Chromium also focuses on the selection below; no standard says a browser must.\n field.focus()\n const caret = document.createRange()\n caret.selectNodeContents(field)\n caret.collapse(false)\n const selection = window.getSelection()\n selection?.removeAllRanges()\n selection?.addRange(caret)\n}\n\n/** Whether a key press belongs to an input method still composing, not to the field. */\nconst composing = (event: KeyboardEvent) => event.isComposing || event.keyCode === 229\n\nexport const EditableText = Mount.defineStream('EditableText', {\n messages: [TextEdited, TextCommitted, TextCancelled, EditAsked],\n args: {\n /** The attribute that marks a field, holding its name. */\n attribute: Schema.String,\n },\n execute: ({ element, attribute }) =>\n Stream.callback<TextFact>(queue =>\n Effect.acquireRelease(\n Effect.sync(() => {\n /** The field being edited: its name, its text when editing began, and the last reported. */\n let current:\n | {\n readonly field: HTMLElement\n readonly name: string\n readonly initial: string\n reported: string\n ended: boolean\n }\n | undefined\n let composingText = false\n // A field whose edit a key ended: when it leaves with focus on nothing, focus\n // comes back to the container, where the keys that began the edit are.\n let ending: HTMLElement | undefined\n\n /** The marked field at or above an event's target, inside the container. */\n const markedOf = (target: EventTarget | null): HTMLElement | undefined => {\n if (!(target instanceof Element)) return undefined\n const field = target.closest(`[${attribute}]`)\n return field instanceof HTMLElement && element.contains(field) ? field : undefined\n }\n /** The same, while it is editable. */\n const fieldOf = (target: EventTarget | null): HTMLElement | undefined => {\n const field = markedOf(target)\n return field?.isContentEditable === true ? field : undefined\n }\n /** Begins an edit of `field`, unless one of it is under way: on focus, or typing. */\n const begin = (field: HTMLElement) => {\n if (current?.field === field && !current.ended) return current\n const text = textOf(field)\n current = {\n field,\n name: field.getAttribute(attribute) ?? '',\n initial: text,\n reported: text,\n ended: false,\n }\n return current\n }\n /**\n * The edit of `field`: the one under way or just ended, else one begun\n * now, for a field focused before these listeners came. An ended edit\n * reports nothing more, so the blur that follows a commit or a cancel\n * does not commit again.\n */\n const editOf = (field: HTMLElement) => (current?.field === field ? current : begin(field))\n const report = (field: HTMLElement) => {\n const edit = editOf(field)\n if (edit.ended) return\n const text = textOf(field)\n // A browser may follow a composition with an input of the same text.\n if (text === edit.reported) return\n edit.reported = text\n Queue.offerUnsafe(queue, TextEdited.make({ field: edit.name, text }))\n }\n const commit = (field: HTMLElement) => {\n const edit = editOf(field)\n if (edit.ended) return\n edit.ended = true\n Queue.offerUnsafe(queue, TextCommitted.make({ field: edit.name, text: textOf(field) }))\n }\n const cancel = (field: HTMLElement) => {\n const edit = editOf(field)\n if (edit.ended) return\n edit.ended = true\n field.innerText = edit.initial\n // Writing the text moved the caret to its start; typing on goes after it.\n caretAtEnd(field)\n Queue.offerUnsafe(\n queue,\n TextCancelled.make({ field: edit.name, initial: edit.initial }),\n )\n }\n\n const listeners: ReadonlyArray<readonly [string, (event: Event) => void]> = [\n [\n 'dblclick',\n event => {\n const field = markedOf(event.target)\n // In an editable field, a double-click selects a word.\n if (field === undefined || field.isContentEditable) return\n Queue.offerUnsafe(\n queue,\n EditAsked.make({ field: field.getAttribute(attribute) ?? '' }),\n )\n },\n ],\n [\n 'focusin',\n event => {\n // A composition that never ended, in a field left, holds no other field silent.\n composingText = false\n const field = fieldOf(event.target)\n if (field !== undefined) begin(field)\n },\n ],\n // Before the change: a field focused before these listeners came is begun here.\n [\n 'beforeinput',\n event => {\n const field = fieldOf(event.target)\n if (field !== undefined) begin(field)\n },\n ],\n ['compositionstart', () => (composingText = true)],\n [\n 'compositionend',\n event => {\n composingText = false\n const field = fieldOf(event.target)\n if (field !== undefined) report(field)\n },\n ],\n [\n 'input',\n event => {\n const field = fieldOf(event.target)\n if (field !== undefined && !composingText) report(field)\n },\n ],\n [\n 'keydown',\n event => {\n const field = fieldOf(event.target)\n const key = event as KeyboardEvent\n if (field === undefined || composing(key)) return\n if (key.key === 'Escape') {\n event.preventDefault()\n ending = field\n cancel(field)\n } else if (key.key === 'Enter' && !(key.shiftKey && multiline(field))) {\n event.preventDefault()\n ending = field\n commit(field)\n }\n },\n ],\n [\n 'focusout',\n event => {\n const field = fieldOf(event.target)\n if (field === undefined) return\n // Left while still there and editable, asked once the change that may have\n // taken it away is done: the author went elsewhere, and focus is theirs.\n queueMicrotask(() => {\n if (field === ending && field.isConnected && field.isContentEditable)\n ending = undefined\n })\n commit(field)\n },\n ],\n [\n 'paste',\n event => {\n const field = fieldOf(event.target)\n // `plaintext-only` pastes text itself; elsewhere, markup would arrive.\n if (field === undefined || field.contentEditable === 'plaintext-only') return\n const pasted = (event as ClipboardEvent).clipboardData?.getData('text/plain') ?? ''\n event.preventDefault()\n // `insertText` fires no `beforeinput`: begun here, a paste after Enter is an edit.\n begin(field)\n // As typing is, so the browser's undo takes it back; `textOf` makes one line of it.\n document.execCommand('insertText', false, pasted)\n },\n ],\n ]\n // Focuses a field as it becomes editable, and only then: made so, or drawn so.\n // A field editable all along, or another going away, moves no focus.\n const editable = `[${attribute}][contenteditable]:not([contenteditable=\"false\"])`\n const becoming = new MutationObserver(records => {\n if (ending !== undefined && !(ending.isConnected && ending.isContentEditable)) {\n ending = undefined\n const focused = document.activeElement\n if ((focused === null || focused === document.body) && element instanceof HTMLElement)\n element.focus({ preventScroll: true })\n }\n for (const record of records) {\n const changed =\n record.type === 'attributes' ? [record.target] : Array.from(record.addedNodes)\n for (const node of changed) {\n if (!(node instanceof HTMLElement)) continue\n const field = node.matches(editable) ? node : node.querySelector(editable)\n if (field instanceof HTMLElement) return caretAtEnd(field)\n }\n }\n })\n\n for (const [type, listener] of listeners) element.addEventListener(type, listener)\n // A field made editable, drawn editable, or leaving.\n becoming.observe(element, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['contenteditable'],\n })\n return { listeners, becoming }\n }),\n ({ listeners, becoming }) =>\n Effect.sync(() => {\n becoming.disconnect()\n for (const [type, listener] of listeners) element.removeEventListener(type, listener)\n }),\n ),\n ),\n})\n","/**\n * Keeps focus that is inside a container of roving tab stops on its stop, as a\n * Mount: when a transition moves the stop (a row made current by a command the\n * container did not see, such as a duplicate) or removes the focused\n * descendant (a deleted row), focus goes to the descendant with\n * `tabindex=\"0\"`. It sends no Message. Focus outside the container is never\n * taken, and focus the user moved away stays where it went.\n */\nimport { Effect, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\n\nexport const FollowTabStop = Mount.defineStream('FollowTabStop', {\n messages: [Schema.Never],\n execute: ({ element }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n Effect.sync(() => {\n let within = element.contains(document.activeElement)\n const entered = () => {\n within = true\n }\n const left = (event: Event) => {\n const next = (event as FocusEvent).relatedTarget\n if (next instanceof Node && element.contains(next)) return\n const from = event.target\n // Asked once the change that may have taken it away is done: a descendant\n // removed with focus in it keeps the claim, one the user left does not.\n queueMicrotask(() => {\n if (!(from instanceof Node) || from.isConnected) within = false\n })\n }\n const follow = () => {\n if (!within) return\n const stop = element.querySelector('[tabindex=\"0\"]')\n const focused = document.activeElement\n if (!(stop instanceof HTMLElement) || stop === focused) return\n const lost = focused === null || focused === document.body\n const passed =\n focused !== null &&\n element.contains(focused) &&\n focused.getAttribute('tabindex') === '-1'\n if (lost || passed) stop.focus()\n }\n const changes = new MutationObserver(follow)\n element.addEventListener('focusin', entered)\n element.addEventListener('focusout', left)\n // A stop moved, or a descendant drawn or removed.\n changes.observe(element, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['tabindex'],\n })\n return () => {\n changes.disconnect()\n element.removeEventListener('focusin', entered)\n element.removeEventListener('focusout', left)\n }\n }),\n stop => Effect.sync(stop),\n ),\n ),\n})\n"],"mappings":";;;;;;;;;;;AAUA,MAAM,YAAY;CAChB;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;AAEX,MAAM,aAAa,YAA8B;CAC/C,MAAM,QAAQ;CACd,OAAO,QAAQ,QAAQ,mBAAmB,MAAM,SAAS,MAAM,kBAAkB,KAAK;AACxF;;AAGA,MAAa,kBAAkB,SAC7B,MAAM,KAAK,KAAK,iBAA8B,SAAS,CAAC,CAAC,CAAC,QACxD,YAAW,QAAQ,YAAY,KAAK,UAAU,OAAO,CACvD;AAEF,MAAM,cAAc,aAAkD;CACpE,MAAM,QAAQ,SAAS;CACvB,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,MAAM;CACZ,OAAO;AACT;AAEA,MAAa,aAAa,MAAM,aAAa,cAAc;CACzD,UAAU,CAAC,OAAO,KAAK;CACvB,MAAM;;EAEJ,SAAS,OAAO;;EAEhB,SAAS,OAAO;;;EAGhB,cAAc,OAAO,OAAO,OAAO,MAAM;CAC3C;CACA,UAAU,EAAE,SAAS,SAAS,SAAS,mBACrC,OAAO,eACL,OAAO,eACL,OAAO,WAAW;EAChB,MAAM,gBAAgB,QAAQ;EAC9B,MAAM,WAAW,cAAc;EAC/B,MAAM,UACJ,iBAAiB,OAAO,OAAO,QAAQ,cAA2B,YAAY;EAChF,IAAI,YAAY,MAAM,QAAQ,MAAM;OAC/B,IAAI,CAAC,WAAW,eAAe,OAAO,CAAC,KAAK,mBAAmB,aAClE,QAAQ,MAAM;EAEhB,MAAM,aAAa,UAAiB;GAClC,MAAM,MAAM;GACZ,IAAI,IAAI,QAAQ,OAAO;GACvB,MAAM,WAAW,eAAe,OAAO;GACvC,MAAM,QAAQ,SAAS;GACvB,MAAM,OAAO,SAAS,SAAS,SA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M,UAAU,IAAI,iBAAiB,MAAM;EAC3C,QAAQ,iBAAiB,WAAW,OAAO;EAC3C,QAAQ,iBAAiB,YAAY,IAAI;EAEzC,QAAQ,QAAQ,SAAS;GACvB,SAAS;GACT,WAAW;GACX,YAAY;GACZ,iBAAiB,CAAC,UAAU;EAC9B,CAAC;EACD,aAAa;GACX,QAAQ,WAAW;GACnB,QAAQ,oBAAoB,WAAW,OAAO;GAC9C,QAAQ,oBAAoB,YAAY,IAAI;EAC9C;CACF,CAAC,IACD,SAAQ,OAAO,KAAK,IAAI,CAC1B,CACF;AACJ,CAAC"}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Coordinates, FullscreenMessage, Geolocation, GeolocationMessage, GeolocationModel, LiveStream, LiveStreamService, MediaDevice, MediaDevicesHandle, MediaDevicesMessage, MediaDevicesModel, MediaStreamConstraints, MediaStreamHandle, MediaStreamMessage, MediaStreamModel, MediaTrackHandle, PermissionState, PermissionStatusHandle, PermissionsHandle, PermissionsMessage, PermissionsModel, Watch, WatchService, enterFullscreen, exitFullscreen, fullscreenChanges, mediaDevices, mediaStream, permissions } from "./device/index.mjs";
2
- import { A as ScrollLock, C as targetOf, D as MoveStarted, E as MoveEnded, M as tabbableWithin, O as Moved, S as Targets, T as Move, _ as boxOf, a as TextEdited, b as TargetHovered, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as PointerDrag, h as DraggedOver, i as TextCommitted, j as FocusScope, k as HideOutside, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as zoneOf, w as Fact, x as TargetPressed, y as TargetFact } from "./editable-text-CKkS_mWt.mjs";
2
+ import { A as ScrollLock, C as targetOf, D as MoveStarted, E as MoveEnded, M as tabbableWithin, O as Moved, S as Targets, T as Move, _ as boxOf, a as TextEdited, b as TargetHovered, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as PointerDrag, h as DraggedOver, i as TextCommitted, j as FocusScope, k as HideOutside, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as zoneOf, w as Fact, x as TargetPressed, y as TargetFact } from "./editable-text-BbsPOATY.mjs";
3
3
  import { Autofocus, ClipboardMessage, ClipboardReadMessage, Focused, FollowTabStop, Input, InputMask, KeepInView, KeepScrollOptions, Measure, ScriptMessage, ShareData, ShareMessage, applyMask, copyText, keepScroll, loadScript, measured, readText, share } from "./dom/index.mjs";
4
4
  import { a as modalityOfKey, i as Modality, n as InputModalityMessage, r as InputModalityModel, t as InputModality } from "./input-modality-DGOhAknO.mjs";
5
5
  import { ActiveElementMessage, Idle, IdleMessage, IdleModel, KeyPress, KeyboardMessage, PointerMessage, ScrollMessage, Visibility, VisibilityMessage, VisibilityModel, WindowSize, WindowSizeMessage, WindowSizeModel, activeElementEvents, keyboardEvents, matchHotkey, pointerEvents, scrollEvents } from "./events/index.mjs";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as MoveEnded, D as ScrollLock, E as HideOutside, O as FocusScope, S as Move, T as Moved, _ as zoneOf, a as TextCommitted, b as Targets, c as DRAG_THRESHOLD, d as DragPlace, f as DragStarted, g as boxOf, h as PointerDrag, i as TextCancelled, k as tabbableWithin, l as DragCancelled, m as DraggedOver, n as EditAsked, o as TextEdited, p as DragZone, r as EditableText, s as textOf, t as FollowTabStop, u as DragDropped, v as TargetHovered, w as MoveStarted, x as targetOf, y as TargetPressed } from "./follow-tab-stop-BSZsUrrk.mjs";
1
+ import { C as MoveEnded, D as ScrollLock, E as HideOutside, O as FocusScope, S as Move, T as Moved, _ as zoneOf, a as TextCommitted, b as Targets, c as DRAG_THRESHOLD, d as DragPlace, f as DragStarted, g as boxOf, h as PointerDrag, i as TextCancelled, k as tabbableWithin, l as DragCancelled, m as DraggedOver, n as EditAsked, o as TextEdited, p as DragZone, r as EditableText, s as textOf, t as FollowTabStop, u as DragDropped, v as TargetHovered, w as MoveStarted, x as targetOf, y as TargetPressed } from "./follow-tab-stop-BDxyoUPQ.mjs";
2
2
  import { Autofocus, ClipboardMessage, ClipboardReadMessage, Focused, Input, InputMask, KeepInView, Measure, ScriptMessage, ShareData, ShareMessage, applyMask, copyText, keepScroll, loadScript, measured, readText, share } from "./dom/index.mjs";
3
3
  import { Coordinates, FullscreenMessage, Geolocation, GeolocationMessage, GeolocationModel, LiveStream, MediaDevice, MediaDevicesMessage, MediaDevicesModel, MediaStreamMessage, MediaStreamModel, PermissionState, PermissionsMessage, PermissionsModel, Watch, enterFullscreen, exitFullscreen, fullscreenChanges, mediaDevices, mediaStream, permissions } from "./device/index.mjs";
4
4
  import { a as modalityOfKey, i as Modality, n as InputModalityMessage, r as InputModalityModel, t as InputModality } from "./input-modality-m6v7__Xs.mjs";
@@ -1,9 +1,9 @@
1
- import { A as ScrollLock, C as targetOf, D as MoveStarted, E as MoveEnded, M as tabbableWithin, O as Moved, S as Targets, T as Move, _ as boxOf, a as TextEdited, b as TargetHovered, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as PointerDrag, h as DraggedOver, i as TextCommitted, j as FocusScope, k as HideOutside, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as zoneOf, w as Fact$1, x as TargetPressed, y as TargetFact } from "../editable-text-CKkS_mWt.mjs";
1
+ import { A as ScrollLock, C as targetOf, D as MoveStarted, E as MoveEnded, M as tabbableWithin, O as Moved, S as Targets, T as Move, _ as boxOf, a as TextEdited, b as TargetHovered, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as PointerDrag, h as DraggedOver, i as TextCommitted, j as FocusScope, k as HideOutside, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as zoneOf, w as Fact$1, x as TargetPressed, y as TargetFact } from "../editable-text-BbsPOATY.mjs";
2
2
  import { a as modalityOfKey, i as Modality, r as InputModalityModel, t as InputModality } from "../input-modality-DGOhAknO.mjs";
3
- import { Schema } from "effect";
3
+ import { Option, Schema } from "effect";
4
4
  import * as Mount from "foldkit/mount";
5
5
  import { Bundle, Declared } from "foldkit-bundle";
6
- import { Behavior, Behaviors, SlotItem } from "foldkit-mixins";
6
+ import { Behavior, Behaviors, NamedBehavior, SlotItem } from "foldkit-mixins";
7
7
  import { Attribute, Html, HtmlBuilder, KeyboardModifiers } from "foldkit/html";
8
8
  declare namespace dismiss_layer_d_exports {
9
9
  export { BehaviorOptions$14 as BehaviorOptions, Dismiss, LAYER_ATTRIBUTE, Layer$1 as Layer, Message$9 as Message, Model$9 as Model, TRIGGER_ATTRIBUTE, behavior$14 as behavior, bundle$9 as bundle, layersOnPath, toDismiss };
@@ -434,7 +434,7 @@ declare const bundle$5: Bundle.Bundle<"ListNavigation", {
434
434
  readonly _tag: "Focused";
435
435
  readonly id: string;
436
436
  }, never, never, never, void, {}, {}>;
437
- interface BehaviorOptions$8<Input, Slots> {
437
+ interface BehaviorOptions$8<Input, Slots, ParentMessage> {
438
438
  readonly container: keyof Slots & string;
439
439
  /** The slot rendered once per item; must carry the item's id (see `Behaviors.Collection`). */
440
440
  readonly item: keyof Slots & string;
@@ -442,6 +442,17 @@ interface BehaviorOptions$8<Input, Slots> {
442
442
  /** The text an item is matched by when typing. */
443
443
  readonly text: (input: Input, index: number) => string;
444
444
  readonly direction?: (input: Input) => Direction;
445
+ /**
446
+ * Whether a printable key moves the pointer. Off when the container is a
447
+ * text field: letters belong to the field, and arrows still navigate.
448
+ * Defaults to on.
449
+ */
450
+ readonly typeahead?: boolean;
451
+ /**
452
+ * Enter on the current enabled item. One handler with the arrows: a second
453
+ * key handler on the same slot would be a second owner of `keydown`.
454
+ */
455
+ readonly commit?: (input: Input, id: string) => ParentMessage;
445
456
  }
446
457
  /**
447
458
  * The key's outcome, before it is turned into an attribute: navigation to an
@@ -466,7 +477,7 @@ declare const keyOutcome: (items: Behaviors.Collection.Items<unknown>, texts: Re
466
477
  * `OnFocus` as under `RovingTabindex`. Under `virtual` nothing takes DOM focus
467
478
  * and the container carries `aria-activedescendant`.
468
479
  */
469
- declare const behavior$8: <Field extends string>(declared: Declared<typeof bundle$5, Field>, args: Args$5) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$5; }, ParentMessage>(options: BehaviorOptions$8<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
480
+ declare const behavior$8: <Field extends string>(declared: Declared<typeof bundle$5, Field>, args: Args$5) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$5; }, ParentMessage>(options: BehaviorOptions$8<Input, Slots, ParentMessage>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
470
481
  declare namespace long_press_d_exports {
471
482
  export { Args$4 as Args, BehaviorOptions$7 as BehaviorOptions, LongPressed, Message$4 as Message, Model$4 as Model, behavior$7 as behavior, bundle$4 as bundle };
472
483
  }
@@ -577,6 +588,50 @@ interface BehaviorOptions$6<Slots, ParentMessage> {
577
588
  readonly toMessage: (fact: Fact$1) => ParentMessage;
578
589
  }
579
590
  declare const behavior$6: <Slots>(slots: Slots) => <Input, ParentMessage>(options: BehaviorOptions$6<Slots, ParentMessage>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
591
+ declare namespace overlay_d_exports {
592
+ export { DismissPolicy, FocusPolicy, Policy, behaviors, modal, nonModal };
593
+ }
594
+ interface DismissPolicy {
595
+ /** Dismiss on a press outside. Default `true`. */
596
+ readonly outside: boolean;
597
+ /** Dismiss on Escape when topmost. Default `true`. */
598
+ readonly escape: boolean;
599
+ }
600
+ interface FocusPolicy {
601
+ /** Keep Tab, Shift+Tab, and stray focus inside. Default `true`. */
602
+ readonly contain: boolean;
603
+ /** Give focus back to what had it on unmount. Default `true`. */
604
+ readonly restore: boolean;
605
+ /** A selector inside the layer to focus first. */
606
+ readonly initialFocus?: string;
607
+ }
608
+ interface Policy {
609
+ readonly dismiss: DismissPolicy;
610
+ readonly focus: FocusPolicy;
611
+ /** Lock the document's scroll while mounted. */
612
+ readonly scroll: {
613
+ readonly lock: boolean;
614
+ };
615
+ /** Mark everything outside inert while mounted. */
616
+ readonly inert: boolean;
617
+ }
618
+ /** A modal overlay: dismissed by Escape and outside press, focused, locked, inert. */
619
+ declare const modal: Policy;
620
+ /** A modeless overlay: dismissed by Escape and outside press, focus restored, page usable. */
621
+ declare const nonModal: Policy;
622
+ /**
623
+ * The policy as behaviors, to spread into the view's pipe alongside the
624
+ * widget's own. Conditional pieces are included or left out when the list
625
+ * is built — a static policy per composition — so no slot carries a mount
626
+ * its policy never uses.
627
+ */
628
+ declare const behaviors: <Slots>(slots: Slots) => <Input, ParentMessage, StackField extends string>(options: {
629
+ readonly stack: Declared<typeof bundle$9, StackField>;
630
+ readonly layer: keyof Slots & string;
631
+ readonly trigger?: keyof Slots & string;
632
+ readonly id: (input: Input) => string;
633
+ readonly policy: Policy;
634
+ }) => ReadonlyArray<NamedBehavior<Slots, Input, ParentMessage>>;
580
635
  declare namespace press_d_exports {
581
636
  export { Args$3 as Args, BehaviorOptions$5 as BehaviorOptions, Fact, Message$3 as Message, Model$3 as Model, PointerType, Pressed, behavior$5 as behavior, bundle$3 as bundle, events };
582
637
  }
@@ -828,10 +883,97 @@ interface BehaviorOptions$2<Slots, ParentMessage> {
828
883
  readonly attribute: string;
829
884
  readonly within: string;
830
885
  };
886
+ /** An attribute naming a part of what a drop lands on, which the place then carries. */
887
+ readonly part?: string;
831
888
  /** Turns each fact into the view's Message. */
832
889
  readonly toMessage: (fact: DragFact) => ParentMessage;
833
890
  }
834
891
  declare const behavior$2: <Slots>(slots: Slots) => <Input, ParentMessage>(options: BehaviorOptions$2<Slots, ParentMessage>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
892
+ declare namespace placing_d_exports {
893
+ export { AnchorRect, KeepWithin, OriginRect, PanelRect, PlaceAt, PlaceAtPoint, Placed, PlacedAt, Viewport, ViewportPoint, keepWithin, placeAt, placeAtPoint, placeAtTrigger, placeFor, placedAbove, placedSide, placedTop, shiftIntoViewport };
894
+ }
895
+ interface PanelRect {
896
+ readonly top: number;
897
+ readonly right: number;
898
+ readonly bottom: number;
899
+ readonly height: number;
900
+ }
901
+ interface Viewport {
902
+ readonly width: number;
903
+ readonly height: number;
904
+ }
905
+ interface Placed {
906
+ /** Pixels to move left; `0` when the panel fits. */
907
+ readonly dx: number;
908
+ /** Whether the panel stands above its trigger instead of below. */
909
+ readonly flip: boolean;
910
+ }
911
+ /** Where the panel goes so it fits: left by the overflow, above when the
912
+ * bottom clears the window and the room overhead fits the panel. */
913
+ declare const placeFor: (rect: PanelRect, viewport: Viewport, margin?: number) => Placed;
914
+ /** Pixels to move a box up so its bottom sits `margin` inside the viewport.
915
+ * `0` when it already fits, or when its top is already at the margin. */
916
+ declare const shiftIntoViewport: (rect: {
917
+ readonly top: number;
918
+ readonly bottom: number;
919
+ }, viewportHeight: number, margin?: number) => number;
920
+ /** Attribute `keepWithin` sets to `placedAbove` when the panel flips. */
921
+ declare const placedSide = "data-fk-placed";
922
+ /** Value of `placedSide` while the panel stands above its anchor. */
923
+ declare const placedAbove = "above";
924
+ interface AnchorRect {
925
+ readonly left: number;
926
+ readonly top: number;
927
+ readonly bottom: number;
928
+ readonly width: number;
929
+ readonly height: number;
930
+ }
931
+ interface OriginRect {
932
+ readonly left: number;
933
+ readonly top: number;
934
+ }
935
+ interface PlacedAt {
936
+ readonly left: number;
937
+ readonly top: number;
938
+ }
939
+ /** Custom property `PlaceAt` writes. A panel reads it as `top` so a viewport
940
+ * flip, which sets the `top` property, still wins. */
941
+ declare const placedTop = "--fk-placed-top";
942
+ /** Where a popup sits under its trigger's left edge, in the offset parent's
943
+ * coordinates. A zero-size trigger (an inert document) stays at the origin. */
944
+ declare const placeAt: (trigger: AnchorRect, origin: OriginRect, gap?: number) => PlacedAt;
945
+ interface ViewportPoint {
946
+ readonly x: number;
947
+ readonly y: number;
948
+ }
949
+ /** Where a popup's top-left sits on a viewport point, in the offset parent's
950
+ * coordinates. A context menu uses it: the right-click event carries the
951
+ * point, and `OnContextMenu` does not. */
952
+ declare const placeAtPoint: (point: ViewportPoint, origin: OriginRect) => PlacedAt;
953
+ declare const KeepWithin: Mount.MountDefinitionNoArgs<"KeepWithin", never>;
954
+ declare const PlaceAt: Mount.MountDefinitionWithArgs<"PlaceAt", {
955
+ /** Element id of the trigger the popup opens under. */
956
+ triggerId: Schema.String;
957
+ /** Pixels between the trigger's bottom and the popup. */
958
+ gap: Schema.Number;
959
+ }, never>;
960
+ declare const PlaceAtPoint: Mount.MountDefinitionWithArgs<"PlaceAtPoint", {
961
+ /** Viewport x of the popup's top-left. */
962
+ x: Schema.Number;
963
+ /** Viewport y of the popup's top-left. */
964
+ y: Schema.Number;
965
+ }, never>;
966
+ declare const placeAtTrigger: <Slots>(slots: Slots) => <Input, ParentMessage>(options: {
967
+ readonly panel: keyof Slots & string;
968
+ /** The trigger this open belongs to. Read at insert, so key the panel by it. */
969
+ readonly triggerId: (input: Input) => string;
970
+ readonly gap?: number;
971
+ /** A viewport point wins over the trigger. None places under `triggerId`. */
972
+ readonly at?: (input: Input) => Option.Option<ViewportPoint>;
973
+ }) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
974
+ declare const keepWithin: <Slots>(slots: Slots) => <Input, ParentMessage>(options: {
975
+ readonly panel: keyof Slots & string;
976
+ }) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
835
977
  declare namespace tree_navigation_d_exports {
836
978
  export { Action, Args$1 as Args, BehaviorOptions$1 as BehaviorOptions, Message$1 as Message, Model$1 as Model, Row, Shown, behavior$1 as behavior, bundle$1 as bundle, isOpen, move, shown, tabStop };
837
979
  }
@@ -1013,5 +1155,5 @@ interface BehaviorOptions<Input, Slots> {
1013
1155
  */
1014
1156
  declare const behavior: <Field extends string>(declared: Declared<typeof bundle, Field>) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model; }, ParentMessage>(options: BehaviorOptions<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
1015
1157
  //#endregion
1016
- export { dismiss_layer_d_exports as DismissLayer, editable_text_d_exports as EditableText, focus_scope_d_exports as FocusScope, focus_visible_d_exports as FocusVisible, grid_navigation_d_exports as GridNavigation, layers_d_exports as Layers, list_navigation_d_exports as ListNavigation, live_announce_d_exports as LiveAnnounce, long_press_d_exports as LongPress, move_d_exports as Move, pointer_drag_d_exports as PointerDrag, press_d_exports as Press, roving_tabindex_d_exports as RovingTabindex, selection_d_exports as Selection, targets_d_exports as Targets, tree_navigation_d_exports as TreeNavigation, typeahead_d_exports as Typeahead };
1158
+ export { dismiss_layer_d_exports as DismissLayer, editable_text_d_exports as EditableText, focus_scope_d_exports as FocusScope, focus_visible_d_exports as FocusVisible, grid_navigation_d_exports as GridNavigation, layers_d_exports as Layers, list_navigation_d_exports as ListNavigation, live_announce_d_exports as LiveAnnounce, long_press_d_exports as LongPress, move_d_exports as Move, overlay_d_exports as Overlay, placing_d_exports as Placing, pointer_drag_d_exports as PointerDrag, press_d_exports as Press, roving_tabindex_d_exports as RovingTabindex, selection_d_exports as Selection, targets_d_exports as Targets, tree_navigation_d_exports as TreeNavigation, typeahead_d_exports as Typeahead };
1017
1159
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/interaction/dismiss-layer.ts","../../src/interaction/editable-text.ts","../../src/interaction/focus-scope.ts","../../src/interaction/focus-visible.ts","../../src/interaction/roving-tabindex.ts","../../src/interaction/grid-navigation.ts","../../src/interaction/layers.ts","../../src/interaction/live-announce.ts","../../src/interaction/list-navigation.ts","../../src/interaction/long-press.ts","../../src/interaction/move.ts","../../src/interaction/press.ts","../../src/interaction/selection.ts","../../src/interaction/targets.ts","../../src/interaction/pointer-drag.ts","../../src/interaction/tree-navigation.ts","../../src/interaction/typeahead.ts"],"mappings":";;;;;;;;;;cAmBa;cACA;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;;;;;cAW1B,OACX,MAAM,cAAc,QACpB,wBACA,aACA,WAAW,mBACX,OAAO,SACP,MAAM,QACN,8BACC;;cA6BU,UAAW,MAAM,cAAc,QAAQ;UAKnC,kBAAgB,OAAO;;WAE7B,iBAAiB;;WAEjB,YAAY;;WAEZ,OAAO,OAAO,UAAU,cAAc;;WAEtC,SAAS;WACT,aAAa,OAAO;;;;;;;;;;;cAqBlB,aACV,sBAAsB,UAAU,gBAAgB,UAAQ,QAAQ,MAAM,YACtE,OAAO,OAAO,WACd,0BAA0B,KAAK,QAAQ,YAAS,eAC/C,SAAS,kBAAgB,OAAO,WAC/B,SAAS,cAAc,OAAO,OAAO;;;;cCtN7B,OAAK,OAAA;;;;;;KAMN,eAAe,MAAM;cAEpB,mCAAO;;;;;;;;;;;;KAQR,iBAAiB,QAAQ;cAExB,MAAI,OAAA;;;;KAOL,cAAc,KAAK;cAElB,QAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;cAuCN,QACX,OAAO,uBACP,SAAS,uBACT,eACA;;cAeW,cAAe,aAAa,WAAW;UAGnC,gBAAgB,OAAO;;WAE7B,YAAY;WACZ,QAAQ,OAAO,UAAU,UAAU,WAAW;;WAE9C,OAAO,OAAO,OAAO;;;WAGrB,UAAU,OAAO;;;;;;;;;cAUf,WACV,sBAAsB,UAAU,gBAAgB,QAAQ,YACxD,OAAO,OAAO,WACd,0BAA0B,KAAK,QAAQ,UAAS,eAC/C,SAAS,gBAAgB,OAAO,WAC/B,SAAS,cAAc,OAAO,OAAO"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/interaction/dismiss-layer.ts","../../src/interaction/editable-text.ts","../../src/interaction/focus-scope.ts","../../src/interaction/focus-visible.ts","../../src/interaction/roving-tabindex.ts","../../src/interaction/grid-navigation.ts","../../src/interaction/layers.ts","../../src/interaction/live-announce.ts","../../src/interaction/list-navigation.ts","../../src/interaction/long-press.ts","../../src/interaction/move.ts","../../src/interaction/overlay.ts","../../src/interaction/press.ts","../../src/interaction/selection.ts","../../src/interaction/targets.ts","../../src/interaction/pointer-drag.ts","../../src/interaction/placing.ts","../../src/interaction/tree-navigation.ts","../../src/interaction/typeahead.ts"],"mappings":";;;;;;;;;;cAmBa;cACA;;cAKA,SAAK,OAAA;;;;;;;KAON,iBAAe,QAAM;cAEpB,SAAK,OAAA;;;;;;;;;;KAIN,iBAAe,QAAM;cAEpB,qCAAO;;;;;;;;;;;;;;;;;;;;;;KAKR,mBAAiB,UAAQ;cAExB,SAAO,OAAA;;;KACR,iBAAiB,QAAQ;;cAGxB,YACX,QAAQ,cAAc,UACtB,QAAQ,0BACP;cAsBU,UAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;cAqCN,eAAgB,MAAM,cAAc,iBAAe;UA6C/C,mBAAgB,OAAO;;WAE7B,aAAa;;WAEb,gBAAgB;WAChB,KAAK,OAAO;;WAEZ;;WAEA;;;;;;;;cASE,cACV,sBAAsB,WAAW,gBAAgB,UAAQ,YACzD,OAAO,OAAO,WACd,OAAO,eACN,SAAS,mBAAgB,OAAO,WAC/B,SAAS,cAAc,OAAO,OAAO;;;;UCjKzB,mBAAgB,OAAO;;WAE7B,iBAAiB;;WAEjB;;WAEA,YAAY,MAAM,aAAa;;cAG7B,cACV,OAAO,OAAO,WACd,OAAO,eACN,SAAS,mBAAgB,OAAO,mBAC/B,SAAS,cAAc,OAAO,OAAO;;;;UCxBzB,mBAAgB;WACtB,iBAAiB;;WAEjB;;WAEA;;WAEA;;;;;;;;;cAUE,cACV,OAAO,OAAO,WACd,OAAO,eACN,SAAS,mBAAgB,WACxB,SAAS,cAAc,OAAO,OAAO;;;;UCfzB,mBAAgB;WACtB,cAAc;;cAGZ,cACV,sBAAsB,UAAU,gBAAgB,eAAe,YAC/D,OAAO,OAAO,WACd,0BAA0B,KAAK,QAAQ,uBAAsB,eAC5D,SAAS,mBAAgB,WACxB,SAAS,cAAc,OAAO,OAAO;;;;cCT7B,aAAW,OAAA;KACZ,qBAAqB,YAA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