foldkit-primitives 0.9.0 → 0.10.1
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.
- package/README.md +31 -1
- package/dist/device/index.d.mts +69 -36
- package/dist/device/index.d.mts.map +1 -1
- package/dist/device/index.mjs +34 -34
- package/dist/device/index.mjs.map +1 -1
- package/dist/dom/index.d.mts +68 -19
- package/dist/dom/index.d.mts.map +1 -1
- package/dist/dom/index.mjs +32 -25
- package/dist/dom/index.mjs.map +1 -1
- package/dist/{editable-text-BbsPOATY.d.mts → editable-text-Dvm-Fuqs.d.mts} +65 -3
- package/dist/editable-text-Dvm-Fuqs.d.mts.map +1 -0
- package/dist/events/index.d.mts +52 -31
- package/dist/events/index.d.mts.map +1 -1
- package/dist/events/index.mjs +40 -28
- package/dist/events/index.mjs.map +1 -1
- package/dist/{follow-tab-stop-BDxyoUPQ.mjs → follow-tab-stop-Ci1tqAIW.mjs} +63 -61
- package/dist/follow-tab-stop-Ci1tqAIW.mjs.map +1 -0
- package/dist/{index-Cppf-lBx.d.mts → index-CmmxqSEi.d.mts} +34 -15
- package/dist/index-CmmxqSEi.d.mts.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/{input-modality-m6v7__Xs.mjs → input-modality-BXD383jg.mjs} +9 -9
- package/dist/input-modality-BXD383jg.mjs.map +1 -0
- package/dist/{input-modality-DGOhAknO.d.mts → input-modality-BY-bSrEc.d.mts} +9 -2
- package/dist/input-modality-BY-bSrEc.d.mts.map +1 -0
- package/dist/interaction/index.d.mts +118 -118
- package/dist/interaction/index.d.mts.map +1 -1
- package/dist/interaction/index.mjs +3 -3
- package/dist/interaction/index.mjs.map +1 -1
- package/dist/media/index.d.mts +24 -3
- package/dist/media/index.d.mts.map +1 -1
- package/dist/media/index.mjs +23 -13
- package/dist/media/index.mjs.map +1 -1
- package/dist/motion/index.d.mts +1 -1
- package/dist/motion/index.mjs +1 -2
- package/dist/{motion-DGGBZ0wt.mjs → motion-DmFDppRn.mjs} +20 -20
- package/dist/{motion-DGGBZ0wt.mjs.map → motion-DmFDppRn.mjs.map} +1 -1
- package/dist/net/index.d.mts +63 -25
- package/dist/net/index.d.mts.map +1 -1
- package/dist/net/index.mjs +31 -31
- package/dist/net/index.mjs.map +1 -1
- package/dist/observers/index.d.mts +25 -0
- package/dist/observers/index.d.mts.map +1 -1
- package/dist/observers/index.mjs +22 -22
- package/dist/observers/index.mjs.map +1 -1
- package/dist/state/index.d.mts +98 -44
- package/dist/state/index.d.mts.map +1 -1
- package/dist/state/index.mjs +39 -39
- package/dist/state/index.mjs.map +1 -1
- package/dist/time/index.d.mts +35 -5
- package/dist/time/index.d.mts.map +1 -1
- package/dist/time/index.mjs +20 -20
- package/dist/time/index.mjs.map +1 -1
- package/package.json +14 -14
- package/dist/editable-text-BbsPOATY.d.mts.map +0 -1
- package/dist/follow-tab-stop-BDxyoUPQ.mjs.map +0 -1
- package/dist/index-Cppf-lBx.d.mts.map +0 -1
- package/dist/input-modality-DGOhAknO.d.mts.map +0 -1
- package/dist/input-modality-m6v7__Xs.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
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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ources":["../src/motion/motion.ts","../src/motion/presence.ts","../src/motion/spring.ts","../src/motion/tween.ts"],"mappings":";;;;;UAUiB;WACN,SAAS,OAAO;;;cAGd,eAAe;;cAGf,QAAS,qBAAmB,MAAM,MAAM;cAGxC,SAAS,MAAM,MAAM;cACrB,MAAM,MAAM,MAAM;;cAGlB,MAAM,MAAM,MAAM;;cAUlB,eAAe,OAAO;;;cCtBtB,eAAa,OAAA;;;;KAId,uBAAuB,cAAc;cAEpC,2CAAe;;;;yBAAf,OAAA;;;KAKD,yBAAyB,gBAAgB;;cAGxC,YAAa,OAAO;cAEpB,UAAQ,OAAA;WAII;;;;;;;;;;;;;;cCnBZ,aAAW,OAAA;;;;;KAKZ,qBAAqB,YAAY;cAEhC,yCAAa;;;;;;;;;;;;KAOd,uBAAuB,cAAc;cAapC,QAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;;cC5BN,YAAU,OAAA;;;;KACX,oBAAoB,WAAW;cAE9B,wCAAY;;;;;;;;;;;KAOb,sBAAsB,aAAa;cAElC,OAAK,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-modality-DGOhAknO.d.mts","names":[],"sources":["../src/events/input-modality.ts"],"mappings":";;;cAYa,UAAQ,OAAA;KACT,kBAAkB,SAAS;cAE1B,oBAAkB,OAAA;;;KACnB,4BAA4B,mBAAmB;cAE9C,gDAAoB;;uBAApB,OAAA;;;KACD,8BAA8B,qBAAqB;;cAKlD,gBAAiB,gBAAc;cAmB/B,eAAa,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-modality-m6v7__Xs.mjs","names":[],"sources":["../src/events/input-modality.ts"],"sourcesContent":["/**\n * Input modality as a bundle: whether the user last drove the page by\n * keyboard or by pointer. The browser reports the facts; the Model keeps the\n * answer, so a view can show a focus ring only for keyboard users without\n * reading the DOM, and a replay sees the same answer. CSS `:focus-visible`\n * is the floor; this is for JavaScript that must know.\n */\nimport { Schema, Stream } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Subscription from 'foldkit/subscription'\nimport { Bundle } from 'foldkit-bundle'\n\nexport const Modality = Schema.Literals(['keyboard', 'pointer', 'unknown'])\nexport type Modality = typeof Modality.Type\n\nexport const InputModalityModel = Schema.Struct({ modality: Modality })\nexport type InputModalityModel = typeof InputModalityModel.Type\n\nexport const InputModalityMessage = defineMessageUnion({ Changed: { modality: Modality } })\nexport type InputModalityMessage = typeof InputModalityMessage.Type\n\nconst MODIFIERS = new Set(['Shift', 'Control', 'Alt', 'Meta', 'CapsLock'])\n\n/** A modifier alone says nothing about how the page is being driven. */\nexport const modalityOfKey = (key: string): Modality | null =>\n MODIFIERS.has(key) ? null : 'keyboard'\n\nconst modalityStream = (): Stream.Stream<InputModalityMessage> => {\n if (typeof window === 'undefined') return Stream.empty\n return Stream.mergeAll(\n [\n Stream.fromEventListener<KeyboardEvent>(window, 'keydown', { capture: true }).pipe(\n Stream.filter(event => modalityOfKey(event.key) !== null),\n Stream.map(() => InputModalityMessage.Changed({ modality: 'keyboard' })),\n ),\n Stream.fromEventListener(window, 'pointerdown', { capture: true }).pipe(\n Stream.map(() => InputModalityMessage.Changed({ modality: 'pointer' })),\n ),\n ],\n { concurrency: 'unbounded' },\n )\n}\n\nexport const InputModality = Bundle.make('InputModality', {\n Model: InputModalityModel,\n Message: InputModalityMessage,\n init: () => ({ model: { modality: 'unknown' as const } }),\n update: (model, message) =>\n model.modality === message.modality ? { model } : { model: { modality: message.modality } },\n subscriptions: (): Subscription.Subscriptions<InputModalityModel, InputModalityMessage> =>\n Subscription.make<InputModalityModel, InputModalityMessage>()(() => ({\n changes: Subscription.persistent(modalityStream()),\n })),\n})\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,WAAW,OAAO,SAAS;CAAC;CAAY;CAAW;AAAS,CAAC;AAG1E,MAAa,qBAAqB,OAAO,OAAO,EAAE,UAAU,SAAS,CAAC;AAGtE,MAAa,uBAAuB,mBAAmB,EAAE,SAAS,EAAE,UAAU,SAAS,EAAE,CAAC;AAG1F,MAAM,4BAAY,IAAI,IAAI;CAAC;CAAS;CAAW;CAAO;CAAQ;AAAU,CAAC;;AAGzE,MAAa,iBAAiB,QAC5B,UAAU,IAAI,GAAG,IAAI,OAAO;AAE9B,MAAM,uBAA4D;CAChE,IAAI,OAAO,WAAW,aAAa,OAAO,OAAO;CACjD,OAAO,OAAO,SACZ,CACE,OAAO,kBAAiC,QAAQ,WAAW,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,KAC5E,OAAO,QAAO,UAAS,cAAc,MAAM,GAAG,MAAM,IAAI,GACxD,OAAO,UAAU,qBAAqB,QAAQ,EAAE,UAAU,WAAW,CAAC,CAAC,CACzE,GACA,OAAO,kBAAkB,QAAQ,eAAe,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,KACjE,OAAO,UAAU,qBAAqB,QAAQ,EAAE,UAAU,UAAU,CAAC,CAAC,CACxE,CACF,GACA,EAAE,aAAa,YAAY,CAC7B;AACF;AAEA,MAAa,gBAAgB,OAAO,KAAK,iBAAiB;CACxD,OAAO;CACP,SAAS;CACT,aAAa,EAAE,OAAO,EAAE,UAAU,UAAmB,EAAE;CACvD,SAAS,OAAO,YACd,MAAM,aAAa,QAAQ,WAAW,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,UAAU,QAAQ,SAAS,EAAE;CAC5F,qBACE,aAAa,KAA+C,CAAC,QAAQ,EACnE,SAAS,aAAa,WAAW,eAAe,CAAC,EACnD,EAAE;AACN,CAAC"}
|