foldkit-primitives 0.15.1 → 0.15.3
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/dist/device/index.d.mts +8 -8
- package/dist/{index-BC8kcar9.d.mts → index-CmmxqSEi.d.mts} +4 -4
- package/dist/{index-BC8kcar9.d.mts.map → index-CmmxqSEi.d.mts.map} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/interaction/index.d.mts +37 -2
- package/dist/interaction/index.d.mts.map +1 -1
- package/dist/interaction/index.mjs +45 -12
- package/dist/interaction/index.mjs.map +1 -1
- package/dist/motion/index.d.mts +1 -1
- package/package.json +9 -9
package/dist/device/index.d.mts
CHANGED
|
@@ -225,10 +225,6 @@ export declare const mediaStream: <const Name extends string>(config: {
|
|
|
225
225
|
readonly status: "denied" | "idle" | "live" | "requesting";
|
|
226
226
|
readonly lastError: string | null;
|
|
227
227
|
}, {
|
|
228
|
-
readonly _tag: "Started";
|
|
229
|
-
} | {
|
|
230
|
-
readonly _tag: "Stopped";
|
|
231
|
-
} | {
|
|
232
228
|
readonly _tag: "Denied";
|
|
233
229
|
} | {
|
|
234
230
|
readonly _tag: "Ended";
|
|
@@ -237,15 +233,15 @@ export declare const mediaStream: <const Name extends string>(config: {
|
|
|
237
233
|
readonly message: string;
|
|
238
234
|
} | {
|
|
239
235
|
readonly _tag: "Live";
|
|
236
|
+
} | {
|
|
237
|
+
readonly _tag: "Started";
|
|
238
|
+
} | {
|
|
239
|
+
readonly _tag: "Stopped";
|
|
240
240
|
}, never, never, never, void, {
|
|
241
241
|
stream: ManagedResource.Entry<{
|
|
242
242
|
readonly status: "denied" | "idle" | "live" | "requesting";
|
|
243
243
|
readonly lastError: string | null;
|
|
244
244
|
}, {
|
|
245
|
-
readonly _tag: "Started";
|
|
246
|
-
} | {
|
|
247
|
-
readonly _tag: "Stopped";
|
|
248
|
-
} | {
|
|
249
245
|
readonly _tag: "Denied";
|
|
250
246
|
} | {
|
|
251
247
|
readonly _tag: "Ended";
|
|
@@ -254,6 +250,10 @@ export declare const mediaStream: <const Name extends string>(config: {
|
|
|
254
250
|
readonly message: string;
|
|
255
251
|
} | {
|
|
256
252
|
readonly _tag: "Live";
|
|
253
|
+
} | {
|
|
254
|
+
readonly _tag: "Started";
|
|
255
|
+
} | {
|
|
256
|
+
readonly _tag: "Stopped";
|
|
257
257
|
}, Option.Option<{
|
|
258
258
|
readonly audio: boolean;
|
|
259
259
|
readonly video: boolean;
|
|
@@ -134,16 +134,16 @@ declare const Tween: Bundle.Bundle<"Tween", {
|
|
|
134
134
|
readonly value: number;
|
|
135
135
|
readonly running: boolean;
|
|
136
136
|
}, {
|
|
137
|
-
readonly _tag: "Finished";
|
|
138
|
-
readonly value: number;
|
|
139
|
-
} | {
|
|
140
137
|
readonly _tag: "Started";
|
|
141
138
|
} | {
|
|
142
139
|
readonly _tag: "Stopped";
|
|
140
|
+
} | {
|
|
141
|
+
readonly _tag: "Finished";
|
|
142
|
+
readonly value: number;
|
|
143
143
|
} | {
|
|
144
144
|
readonly _tag: "Ticked";
|
|
145
145
|
readonly value: number;
|
|
146
146
|
}, never, never, never, void, {}, {}>;
|
|
147
147
|
//#endregion
|
|
148
148
|
export { SpringMessage as a, PresenceMessage as c, motion_d_exports as d, Spring as i, PresenceModel as l, TweenMessage as n, SpringModel as o, TweenModel as r, Presence as s, Tween as t, isVisible as u };
|
|
149
|
-
//# sourceMappingURL=index-
|
|
149
|
+
//# sourceMappingURL=index-CmmxqSEi.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-CmmxqSEi.d.mts","names":[],"sources":["../src/motion/motion.ts","../src/motion/presence.ts","../src/motion/spring.ts","../src/motion/tween.ts"],"mappings":";;;;;UAUiB;WACN,SAAS,OAAO;;;cAGd,eAAe;;cAGf,QAAK,qBAAuB,MAAM,MAAM;cAGxC,SAAS,MAAM,MAAM;cACrB,MAAM,MAAM,MAAM;;cAGlB,MAAM,MAAM,MAAM;;cAUlB,eAAe,OAAO;;;cC5BtB,eAAa,OAAA;;;;KAId,uBAAuB,cAAc;cAEpC,2CAAe;;;;IAGhB,YAAU,OAAA;;;KAEV,yBAAyB,gBAAgB;;cAGxC,YAAS,OAAW;;;;;;;cAQpB,UAAQ,OAAA;WAII;;;;;;;;;;;;;;cC1BZ,aAAW,OAAA;;;;;KAKZ,qBAAqB,YAAY;cAEhC,yCAAa;;;;IAGd,OAAK,OAAA;IAAiB,UAAQ,OAAA;;;;IAE5B,OAAK,OAAA;;;KAEP,uBAAuB,cAAc;;;;;;;;cAoBpC,QAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;;cClCN,YAAU,OAAA;;;;KACX,oBAAoB,WAAW;cAE9B,wCAAY;;;;IAGb,OAAK,OAAA;;;;IAEH,OAAK,OAAA;;;KAEP,sBAAsB,aAAa;;;;;;;cAQlC,OAAK,OAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { Autofocus, ClipboardMessage, ClipboardReadMessage, FLUID_HELD_ATTRIBUTE
|
|
|
4
4
|
import { a as modalityOfKey, i as Modality, n as InputModalityMessage, r as InputModalityModel, t as InputModality } from "./input-modality-BY-bSrEc.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";
|
|
6
6
|
import { Breakpoints, BreakpointsMessage, BreakpointsModel, MediaQuery, MediaQueryMessage, MediaQueryModel, Platform, PlatformHints, PrefersDark, PrefersReducedMotion, breakpointFor, isBrowser, isServer, platformFromUA } from "./media/index.mjs";
|
|
7
|
-
import { a as SpringMessage, c as PresenceMessage, d as motion_d_exports, i as Spring, l as PresenceModel, n as TweenMessage, o as SpringModel, r as TweenModel, s as Presence, t as Tween, u as isVisible } from "./index-
|
|
7
|
+
import { a as SpringMessage, c as PresenceMessage, d as motion_d_exports, i as Spring, l as PresenceModel, n as TweenMessage, o as SpringModel, r as TweenModel, s as Presence, t as Tween, u as isVisible } from "./index-CmmxqSEi.mjs";
|
|
8
8
|
import { Acquired, AcquiredSource, BroadcastChannelHandle, BroadcastMessage, Conversation, ConversationHandler, Online, OnlineMessage, OnlineModel, SharedHost, SharedHostConnection, SharedHostOptions, Socket, SocketHandle, SocketService, SocketView, Source, SourceHandle, SourceService, SseMessage, SseModel, SseView, StartHost, WebSocketMessage, WebSocketModel, broadcastMessages, isLive, isOpen, postBroadcast, sse, viewOf, viewOfSse, websocket } from "./net/index.mjs";
|
|
9
9
|
import { Bounds, Intersection, IntersectionChanged, Measured, Mutated, Mutation, Resize, Resized } from "./observers/index.mjs";
|
|
10
10
|
import { History, HistoryModel, Locale, LocaleMessage, LocaleModel, MasonryPlacement, MeasureRow, Pagination, PaginationMessage, PaginationModel, RowMeasured, SelectionSet, SelectionSetMessage, SelectionSetModel, Viewport, ViewportScrolled, Virtual, VirtualLayout, VirtualMessage, VirtualModel, VirtualWindow, canRedo, canUndo, distanceToEnd, history, isAtEnd, isSelected, masonry, offset, offsetFor, pageCount, range, stickyHeader, totalHeight, visibleRange, windowFor } from "./state/index.mjs";
|
|
@@ -2,9 +2,44 @@ import { A as Moved, C as TargetPressed, D as Move, E as Fact$1, M as ScrollLock
|
|
|
2
2
|
import { a as modalityOfKey, i as Modality, r as InputModalityModel, t as InputModality } from "../input-modality-BY-bSrEc.mjs";
|
|
3
3
|
import { Option, Schema } from "effect";
|
|
4
4
|
import * as Mount from "foldkit/mount";
|
|
5
|
+
import { MountAction } from "foldkit/mount";
|
|
5
6
|
import { Bundle, Declared } from "foldkit-bundle";
|
|
6
|
-
import { Behavior, Behaviors, NamedBehavior, SlotItem } from "foldkit-mixins";
|
|
7
|
+
import { Behavior, Behaviors, NamedBehavior, SlotAttributes, SlotItem, SlotRequirements } from "foldkit-mixins";
|
|
7
8
|
import { Attribute, Html, HtmlBuilder, KeyboardModifiers } from "foldkit/html";
|
|
9
|
+
declare namespace bundle_behavior_d_exports {
|
|
10
|
+
export { BundleBehavior, BundleBehaviorSpec, BundleMessageOf, BundleModelOf, BundleSlotOptions, fromBundle };
|
|
11
|
+
}
|
|
12
|
+
type BundleOf<D extends Declared<any, any>> = D extends Declared<infer B, any> ? B : never;
|
|
13
|
+
/** The Bundle's Model, which the parent's `Input` must hold at `declared.field`. */
|
|
14
|
+
type BundleModelOf<D extends Declared<any, any>> = Bundle.BundleParts<BundleOf<D>>['Model'];
|
|
15
|
+
/** The Bundle's Message, which `send` wraps for the parent. */
|
|
16
|
+
type BundleMessageOf<D extends Declared<any, any>> = Bundle.BundleParts<BundleOf<D>>['Message'];
|
|
17
|
+
interface BundleSlotOptions<D extends Declared<any, any>, Input, ParentMessage> {
|
|
18
|
+
readonly requires?: SlotRequirements;
|
|
19
|
+
readonly attributes?: (context: {
|
|
20
|
+
readonly input: Input;
|
|
21
|
+
readonly h: HtmlBuilder<ParentMessage>;
|
|
22
|
+
readonly item?: SlotItem;
|
|
23
|
+
/** The Bundle's Message as the parent's: what a handler the Behavior writes takes. */
|
|
24
|
+
readonly send: (message: BundleMessageOf<D>) => ParentMessage;
|
|
25
|
+
}) => SlotAttributes<ParentMessage>;
|
|
26
|
+
/** The Bundle's events, mounted on this slot and wrapped for the parent. */
|
|
27
|
+
readonly events?: MountAction<BundleMessageOf<D>, any>;
|
|
28
|
+
}
|
|
29
|
+
type BundleBehaviorSpec<D extends Declared<any, any>, Input, ParentMessage> = Readonly<Record<string, BundleSlotOptions<D, Input, ParentMessage>>>;
|
|
30
|
+
/**
|
|
31
|
+
* `fromBundle(declared)(slots)<Input, ParentMessage>(spec)` — a Behavior over
|
|
32
|
+
* `declared`, with every `events` mount and every `send` mapped through the
|
|
33
|
+
* placement's wrapper. `Input` must hold the Bundle's Model at the declared
|
|
34
|
+
* field, so attributes read the placed slice; the parent's `Message` includes
|
|
35
|
+
* the declared wrapper cases, so nothing can be sent outside it.
|
|
36
|
+
*/
|
|
37
|
+
declare const fromBundle: <D extends Declared<any, any>>(declared: D) => <Slots>(slots: Slots) => <Input extends { readonly [K in D['field']]: BundleModelOf<D>; }, ParentMessage>(spec: BundleBehaviorSpec<D, Input, ParentMessage>, options?: {
|
|
38
|
+
readonly name?: string;
|
|
39
|
+
}) => NamedBehavior<Slots, Input, ParentMessage>;
|
|
40
|
+
declare const BundleBehavior: {
|
|
41
|
+
readonly fromBundle: typeof fromBundle;
|
|
42
|
+
};
|
|
8
43
|
declare namespace dismiss_layer_d_exports {
|
|
9
44
|
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 };
|
|
10
45
|
}
|
|
@@ -1155,5 +1190,5 @@ interface BehaviorOptions<Input, Slots> {
|
|
|
1155
1190
|
*/
|
|
1156
1191
|
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>;
|
|
1157
1192
|
//#endregion
|
|
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 };
|
|
1193
|
+
export { bundle_behavior_d_exports as BundleBehavior, 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 };
|
|
1159
1194
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["Layer","Model","Message","bundle","BehaviorOptions","behavior","BehaviorOptions","behavior","BehaviorOptions","behavior","BehaviorOptions","behavior","Model","Message","Args","bundle","MoveOptions","move","tabStop","BehaviorOptions","behavior","Model","Message","Args","bundle","RovingTabindex.Direction","move","BehaviorOptions","behavior","Model","Message","Args","bundle","Model","Message","Args","bundle","BehaviorOptions","RovingTabindex.Direction","RovingTabindex.MoveOptions","behavior","Model","Message","Args","bundle","BehaviorOptions","behavior","BehaviorOptions","Fact","behavior","dismissLayerBundle","Model","Message","Args","bundle","BehaviorOptions","behavior","Model","Message","Args","bundle","BehaviorOptions","behavior","BehaviorOptions","behavior","BehaviorOptions","behavior","Model","Message","Args","bundle","BehaviorOptions","behavior"],"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-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,OAAO,UAAU,cAAc;;WAEtC,SAAS;WACT,aAAa,OAAO;;;;;;;;;;;cAqBlBC,aACV,sBAAoB,UAAY,gBAAgBF,UAAQ,QAAM,MAAQD,YACtE,OAAK,OAAS,WACd,0BAA0B,KAAK,QAAQF,YAAS,eAAa,SACnDI,kBAAgB,OAAO,WAC/B,SAAS,cAAc,OAAO,OAAO;;;;cCtN7B,OAAK,OAAA;;;;;;KAMN,eAAe,MAAM;cAEpB,mCAAO;;;IAET,MAAI,OAAA;;;;IAEF,YAAU,OAAA;;;;;KAIX,iBAAiB,QAAQ;cAExB,MAAI,OAAA;;sBAAJ,OAAA;;KAOD,cAAc,KAAK;cAElB,QAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;cAuCN,QAAK,OACT,uBAAqB,SACnB,uBAAqB,eACjB;;cAgBF,cAAW,aAAe,WAAa;UAGnC,gBAAgB,OAAO;;WAE7B,YAAY;WACZ,QAAQ,OAAO,UAAU,UAAU,WAAW;;WAE9C,OAAO,OAAO,OAAO;;;WAGrB,UAAU,OAAO;;;;;;;;;cAUf,WACV,sBAAoB,UAAY,gBAAgB,QAAQ,YACxD,OAAK,OAAS,WACd,0BAA0B,KAAK,QAAQ,UAAS,eAAa,SACnD,gBAAgB,OAAO,WAC/B,SAAS,cAAc,OAAO,OAAO"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["Layer","Model","Message","bundle","BehaviorOptions","behavior","BehaviorOptions","behavior","BehaviorOptions","behavior","BehaviorOptions","behavior","Model","Message","Args","bundle","MoveOptions","move","tabStop","BehaviorOptions","behavior","Model","Message","Args","bundle","RovingTabindex.Direction","move","BehaviorOptions","behavior","Model","Message","Args","bundle","Model","Message","Args","bundle","BehaviorOptions","RovingTabindex.Direction","RovingTabindex.MoveOptions","behavior","Model","Message","Args","bundle","BehaviorOptions","behavior","BehaviorOptions","Fact","behavior","dismissLayerBundle","Model","Message","Args","bundle","BehaviorOptions","behavior","Model","Message","Args","bundle","BehaviorOptions","behavior","BehaviorOptions","behavior","BehaviorOptions","behavior","Model","Message","Args","bundle","BehaviorOptions","behavior"],"sources":["../../src/interaction/bundle-behavior.ts","../../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":";;;;;;;;;;;KA+BK,SAAS,UAAU,sBAAsB,UAAU,eAAe,UAAU;;KAGrE,cAAc,UAAU,sBAAsB,OAAO,YAAY,SAAS;;KAG1E,gBAAgB,UAAU,sBAAsB,OAAO,YACjE,SAAS;UAGM,kBAAkB,UAAU,oBAAoB,OAAO;WAC7D,WAAW;WACX,cAAc;aACZ,OAAO;aACP,GAAG,YAAY;aACf,OAAO;;aAEP,OAAO,SAAS,gBAAgB,OAAO;QAC5C,eAAe;;WAEZ,SAAS,YAAY,gBAAgB;;KAGpC,mBAAmB,UAAU,oBAAoB,OAAO,iBAAiB,SACnF,eAAe,kBAAkB,GAAG,OAAO;;;;;;;;cAUhC,aACV,UAAU,oBAAkB,UAAY,OACxC,OAAK,OAAS,WACd,0BAA0B,KAAK,aAAa,cAAc,OAAM,eAAa,MACtE,mBAAmB,GAAG,OAAO,gBAAc;WAC5B;MACpB,cAAc,OAAO,OAAO;cAiCpB;8BAAA;;;;;cCrFA;cACA;;cAKAA,SAAK,OAAA;;;;;;;KAONA,iBAAeA,QAAM;cAEpBC,SAAK,OAAA;;;;;;;;;;KAINA,iBAAeA,QAAM;cAEpBC,qCAAO;;;IAEL,QAAM,OAAA,OAAA,OAAA;;;;;;;IAAuB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;;;KAMN,eAAe,MAAM;cAEpB,mCAAO;;;IAET,MAAI,OAAA;;;;IAEF,YAAU,OAAA;;;;;KAIX,iBAAiB,QAAQ;cAExB,MAAI,OAAA;;sBAAJ,OAAA;;KAOD,cAAc,KAAK;cAElB,QAAM,OAAA;;;;;;;;;;;;;;;;;;;;;;cAuCN,QAAK,OACT,uBAAqB,SACnB,uBAAqB,eACjB;;cAgBF,cAAW,aAAe,WAAa;UAGnC,gBAAgB,OAAO;;WAE7B,YAAY;WACZ,QAAQ,OAAO,UAAU,UAAU,WAAW;;WAE9C,OAAO,OAAO,OAAO;;;WAGrB,UAAU,OAAO;;;;;;;;;cAUf,WACV,sBAAoB,UAAY,gBAAgB,QAAQ,YACxD,OAAK,OAAS,WACd,0BAA0B,KAAK,QAAQ,UAAS,eAAa,SACnD,gBAAgB,OAAO,WAC/B,SAAS,cAAc,OAAO,OAAO"}
|
|
@@ -8,6 +8,40 @@ import { defineMessageUnion } from "foldkit/message";
|
|
|
8
8
|
import * as Subscription from "foldkit/subscription";
|
|
9
9
|
import { Bundle } from "foldkit-bundle";
|
|
10
10
|
import { Behavior, Capability } from "foldkit-mixins";
|
|
11
|
+
//#region src/interaction/bundle-behavior.ts
|
|
12
|
+
var bundle_behavior_exports = /* @__PURE__ */ __exportAll({
|
|
13
|
+
BundleBehavior: () => BundleBehavior,
|
|
14
|
+
fromBundle: () => fromBundle
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* `fromBundle(declared)(slots)<Input, ParentMessage>(spec)` — a Behavior over
|
|
18
|
+
* `declared`, with every `events` mount and every `send` mapped through the
|
|
19
|
+
* placement's wrapper. `Input` must hold the Bundle's Model at the declared
|
|
20
|
+
* field, so attributes read the placed slice; the parent's `Message` includes
|
|
21
|
+
* the declared wrapper cases, so nothing can be sent outside it.
|
|
22
|
+
*/
|
|
23
|
+
const fromBundle = (declared) => (slots) => (spec, options) => {
|
|
24
|
+
const send = (message) => declared.wrapper.make(message);
|
|
25
|
+
const built = Object.create(null);
|
|
26
|
+
for (const [name, slot] of Object.entries(spec)) {
|
|
27
|
+
if (slot === void 0) continue;
|
|
28
|
+
const { requires, attributes, events } = slot;
|
|
29
|
+
if (requires === void 0 && attributes === void 0 && events === void 0) continue;
|
|
30
|
+
built[name] = {
|
|
31
|
+
...requires === void 0 ? {} : { requires },
|
|
32
|
+
...attributes === void 0 ? {} : { attributes: (context) => attributes({
|
|
33
|
+
input: context.input,
|
|
34
|
+
h: context.h,
|
|
35
|
+
...context.item === void 0 ? {} : { item: context.item },
|
|
36
|
+
send
|
|
37
|
+
}) },
|
|
38
|
+
...events === void 0 ? {} : { mount: () => Mount.mapMessage(events, send) }
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return Behavior.forSlots(slots)(built, options);
|
|
42
|
+
};
|
|
43
|
+
const BundleBehavior = { fromBundle };
|
|
44
|
+
//#endregion
|
|
11
45
|
//#region src/interaction/dismiss-layer.ts
|
|
12
46
|
/**
|
|
13
47
|
* Dismissable layers: Escape closes the topmost open layer, a pointer press
|
|
@@ -1139,11 +1173,11 @@ const events = Mount.defineStream("PressEvents", {
|
|
|
1139
1173
|
* decides nothing; a click, a touch, Enter, Space, or an assistive
|
|
1140
1174
|
* technology's click all reach `update` and come out as one `Pressed`.
|
|
1141
1175
|
*/
|
|
1142
|
-
const behavior$6 = (declared) => (slots) => (options) =>
|
|
1176
|
+
const behavior$6 = (declared) => (slots) => (options) => BundleBehavior.fromBundle(declared)(slots)({ [options.target]: {
|
|
1143
1177
|
requires: { capability: Capability.Interactive },
|
|
1144
1178
|
attributes: ({ input, h }) => [...input[declared.field].pressed ? [h.DataAttribute("pressed", "true")] : [], ...options.disabled?.(input) === true ? [h.AriaDisabled(true)] : []],
|
|
1145
|
-
|
|
1146
|
-
}
|
|
1179
|
+
events: events()
|
|
1180
|
+
} }, { name: "Press" });
|
|
1147
1181
|
//#endregion
|
|
1148
1182
|
//#region src/interaction/long-press.ts
|
|
1149
1183
|
/**
|
|
@@ -1444,25 +1478,24 @@ const bundle$1 = Bundle.make("Selection", {
|
|
|
1444
1478
|
* to `Activated` unless told not to. A disabled item gets no click.
|
|
1445
1479
|
*/
|
|
1446
1480
|
const behavior$3 = (declared, args) => (slots) => (options) => {
|
|
1447
|
-
const wrap = (message) => declared.wrapper.make(message);
|
|
1448
1481
|
const itemsOf = perInput(options.items);
|
|
1449
1482
|
const selectedOf = perInput((input) => new Set(input[declared.field].selected));
|
|
1450
|
-
return
|
|
1451
|
-
...options.container === void 0 ? {} : { [options.container]:
|
|
1483
|
+
return BundleBehavior.fromBundle(declared)(slots)({
|
|
1484
|
+
...options.container === void 0 ? {} : { [options.container]: {
|
|
1452
1485
|
requires: { capability: Capability.Container },
|
|
1453
1486
|
attributes: ({ h }) => [h.AriaMultiSelectable(args.mode === "multiple")]
|
|
1454
|
-
}
|
|
1455
|
-
[options.item]:
|
|
1487
|
+
} },
|
|
1488
|
+
[options.item]: {
|
|
1456
1489
|
requires: { capability: Capability.Interactive },
|
|
1457
|
-
attributes: ({ input, h, item }) => {
|
|
1490
|
+
attributes: ({ input, h, item, send }) => {
|
|
1458
1491
|
if (item === void 0) return [];
|
|
1459
1492
|
const items = itemsOf(input);
|
|
1460
1493
|
const id = item.id ?? items.ids[item.index];
|
|
1461
1494
|
if (id === void 0) return [];
|
|
1462
1495
|
const clickable = options.click !== false && args.mode !== "none" && !items.isDisabled(item.index);
|
|
1463
|
-
return [h.AriaSelected(selectedOf(input).has(id)), ...clickable ? [h.OnClick(
|
|
1496
|
+
return [h.AriaSelected(selectedOf(input).has(id)), ...clickable ? [h.OnClick(send(Message$1.Activated({ id })))] : []];
|
|
1464
1497
|
}
|
|
1465
|
-
}
|
|
1498
|
+
}
|
|
1466
1499
|
}, { name: "Selection" });
|
|
1467
1500
|
};
|
|
1468
1501
|
//#endregion
|
|
@@ -1974,6 +2007,6 @@ const behavior = (declared, args) => (slots) => (options) => {
|
|
|
1974
2007
|
}, { name: "TreeNavigation" });
|
|
1975
2008
|
};
|
|
1976
2009
|
//#endregion
|
|
1977
|
-
export { dismiss_layer_exports as DismissLayer, editable_text_exports as EditableText, focus_scope_exports as FocusScope, focus_visible_exports as FocusVisible, grid_navigation_exports as GridNavigation, layers_exports as Layers, list_navigation_exports as ListNavigation, live_announce_exports as LiveAnnounce, long_press_exports as LongPress, move_exports as Move, overlay_exports as Overlay, placing_exports as Placing, pointer_drag_exports as PointerDrag, press_exports as Press, roving_tabindex_exports as RovingTabindex, selection_exports as Selection, targets_exports as Targets, tree_navigation_exports as TreeNavigation, typeahead_exports as Typeahead };
|
|
2010
|
+
export { bundle_behavior_exports as BundleBehavior, dismiss_layer_exports as DismissLayer, editable_text_exports as EditableText, focus_scope_exports as FocusScope, focus_visible_exports as FocusVisible, grid_navigation_exports as GridNavigation, layers_exports as Layers, list_navigation_exports as ListNavigation, live_announce_exports as LiveAnnounce, long_press_exports as LongPress, move_exports as Move, overlay_exports as Overlay, placing_exports as Placing, pointer_drag_exports as PointerDrag, press_exports as Press, roving_tabindex_exports as RovingTabindex, selection_exports as Selection, targets_exports as Targets, tree_navigation_exports as TreeNavigation, typeahead_exports as Typeahead };
|
|
1978
2011
|
|
|
1979
2012
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Layer","Model","Message","bundle","behavior","behavior","EditableTextMount","behavior","FocusScopeMount","behavior","Model","Message","Args","bundle","isPlain","move","tabStop","behavior","Model","Message","Args","bundle","move","behavior","RovingTabindex.tabStop","RovingTabindex.idSelector","RovingTabindex.itemAttributes","ScrollLockMount","HideOutsideMount","Model","Message","Args","bundle","Model","Message","Args","bundle","behavior","Model","Message","Args","RovingTabindex.Orientation","bundle","RovingTabindex.move","Typeahead.isPrintable","Typeahead.match","behavior","RovingTabindex.tabStop","RovingTabindex.idSelector","RovingTabindex.itemAttributes","Model","Message","Args","isActivationKey","bundle","behavior","Model","Message","Press.PointerType","Args","bundle","behavior","Press.events","behavior","MoveMount","dismissLayerBehavior","focusScopeBehavior","Model","Message","Args","bundle","behavior","behavior","TargetsMount","behavior","PointerDragMount"],"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/typeahead.ts","../../src/interaction/list-navigation.ts","../../src/interaction/press.ts","../../src/interaction/long-press.ts","../../src/interaction/move.ts","../../src/interaction/overlay.ts","../../src/interaction/selection.ts","../../src/interaction/targets.ts","../../src/interaction/pointer-drag.ts","../../src/interaction/placing.ts","../../src/interaction/tree-navigation.ts"],"sourcesContent":["/**\n * Dismissable layers: Escape closes the topmost open layer, a pointer press\n * outside closes the layers it is outside of. One Bundle, placed once, owns\n * the document listeners; each layer's Behavior marks its container (and its\n * trigger) with data attributes. The stack is the DOM order of the marked\n * elements at the moment of the event, so a layer opening or closing needs no\n * registration. A press inside a parent layer is outside its children, so the\n * parent stays and the children go; a press on a layer's trigger counts as\n * inside it, so a trigger never dismisses and reopens in one click. What a\n * dismissal does is the placement's `onOut`.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport type { HtmlBuilder } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Subscription from 'foldkit/subscription'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Capability } from 'foldkit-mixins'\n\nexport const LAYER_ATTRIBUTE = 'data-foldkit-plus-layer'\nexport const TRIGGER_ATTRIBUTE = 'data-foldkit-plus-layer-trigger'\nconst OUTSIDE_ATTRIBUTE = 'data-foldkit-plus-layer-outside'\nconst ESCAPE_ATTRIBUTE = 'data-foldkit-plus-layer-escape'\n\n/** An open layer as the document showed it: bottom to top is DOM order. */\nexport const Layer = Schema.Struct({\n id: Schema.String,\n /** Dismiss on a press outside it. */\n outside: Schema.Boolean,\n /** Dismiss on Escape when topmost. */\n escape: Schema.Boolean,\n})\nexport type Layer = typeof Layer.Type\n\nexport const Model = Schema.Struct({\n /** The open layers at the last event, bottom to top. */\n layers: Schema.Array(Layer),\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** A pointer went down; `inside` are the layers whose element or trigger was on the event's path. */\n PressedAt: { layers: Schema.Array(Layer), inside: Schema.Array(Schema.String) },\n PressedEscape: { layers: Schema.Array(Layer) },\n})\nexport type Message = typeof Message.Type\n\nexport const Dismiss = Schema.TaggedStruct('Dismiss', { ids: Schema.Array(Schema.String) })\nexport type Dismiss = typeof Dismiss.Type\n\n/** Which layers a press inside `inside` dismisses: every layer above the topmost one hit, or all when none was. */\nexport const toDismiss = (\n layers: ReadonlyArray<Layer>,\n inside: ReadonlyArray<string>,\n): ReadonlyArray<string> => {\n let topmostHit = -1\n layers.forEach((layer, index) => {\n if (inside.includes(layer.id)) topmostHit = index\n })\n return layers\n .slice(topmostHit + 1)\n .filter(layer => layer.outside)\n .map(layer => layer.id)\n}\n\ntype Return = Update.ReturnWithOutMessage<Model, Message, Dismiss>\n\nconst sameLayers = (a: ReadonlyArray<Layer>, b: ReadonlyArray<Layer>): boolean =>\n a.length === b.length &&\n a.every(\n (layer, index) =>\n layer.id === b[index]!.id &&\n layer.outside === b[index]!.outside &&\n layer.escape === b[index]!.escape,\n )\n\nexport const bundle = Bundle.make('DismissLayer', {\n Model,\n Message,\n init: () => ({ model: { layers: [] } }),\n update: (model, message): Return => {\n // Every press in the document reports the layers, which are usually the\n // ones already held: keep the Model, or each click re-renders the page.\n const next = sameLayers(model.layers, message.layers) ? model : { layers: message.layers }\n return Message.match<Return>(message, {\n PressedAt: ({ layers, inside }) => {\n const ids = toDismiss(layers, inside)\n return ids.length === 0\n ? { model: next }\n : { model: next, outMessage: Dismiss.make({ ids }) }\n },\n PressedEscape: ({ layers }) => {\n const top = layers[layers.length - 1]\n return top !== undefined && top.escape\n ? { model: next, outMessage: Dismiss.make({ ids: [top.id] }) }\n : { model: next }\n },\n })\n },\n subscriptions: () =>\n Subscription.make<Model, Message>()(() => ({\n document: Subscription.persistentEntry(documentEvents()),\n })),\n})\n\nconst openLayers = (root: ParentNode): ReadonlyArray<Layer> =>\n Array.from(root.querySelectorAll(`[${LAYER_ATTRIBUTE}]`)).map(element => ({\n id: element.getAttribute(LAYER_ATTRIBUTE) ?? '',\n outside: element.getAttribute(OUTSIDE_ATTRIBUTE) !== 'false',\n escape: element.getAttribute(ESCAPE_ATTRIBUTE) !== 'false',\n }))\n\n/** The layer ids whose element or trigger is on the event's composed path. */\nexport const layersOnPath = (path: ReadonlyArray<EventTarget>): ReadonlyArray<string> => {\n const ids: Array<string> = []\n for (const target of path) {\n if (!(target instanceof Element)) continue\n const id = target.getAttribute(LAYER_ATTRIBUTE) ?? target.getAttribute(TRIGGER_ATTRIBUTE)\n if (id !== null && !ids.includes(id)) ids.push(id)\n }\n return ids\n}\n\n/**\n * The facts are read inside the listener, not after: `composedPath()` is\n * empty once dispatch has finished, and the open layers must be the ones the\n * press saw, not the ones a later render left.\n */\nconst documentEvents = (): Stream.Stream<Message> => {\n if (typeof document === 'undefined') return Stream.empty\n return Stream.callback<Message>(queue =>\n Effect.acquireRelease(\n Effect.sync(() => {\n const onPointerDown = (event: Event) =>\n Queue.offerUnsafe(\n queue,\n Message.PressedAt({\n layers: openLayers(document),\n inside: layersOnPath(event.composedPath()),\n }),\n )\n const onKeyDown = (event: Event) => {\n if ((event as KeyboardEvent).key !== 'Escape') return\n Queue.offerUnsafe(queue, Message.PressedEscape({ layers: openLayers(document) }))\n }\n document.addEventListener('pointerdown', onPointerDown, { capture: true })\n document.addEventListener('keydown', onKeyDown, { capture: true })\n return { onPointerDown, onKeyDown }\n }),\n ({ onPointerDown, onKeyDown }) =>\n Effect.sync(() => {\n document.removeEventListener('pointerdown', onPointerDown, { capture: true })\n document.removeEventListener('keydown', onKeyDown, { capture: true })\n }),\n ),\n )\n}\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The layer's root, rendered only while the layer is open. */\n readonly layer: keyof Slots & string\n /** The element that opens the layer, so a press on it is inside. */\n readonly trigger?: keyof Slots & string\n readonly id: (input: Input) => string\n /** Dismiss on a press outside. Default `true`. */\n readonly outsidePress?: boolean\n /** Dismiss on Escape when topmost. Default `true`. */\n readonly escape?: boolean\n}\n\n/**\n * Marks the layer's container and trigger for the placed stack. The layer\n * takes part only while its element is rendered, so an `open` flag in the\n * parent Model is the whole lifecycle. Not for an element with `popover`,\n * which the browser dismisses itself.\n */\nexport const behavior =\n <Field extends string>(_declared: Declared<typeof bundle, Field>) =>\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.layer]: Behavior.slot({\n requires: { capability: Capability.Container },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => [\n h.Attribute(LAYER_ATTRIBUTE, options.id(input)),\n ...(options.outsidePress === false ? [h.Attribute(OUTSIDE_ATTRIBUTE, 'false')] : []),\n ...(options.escape === false ? [h.Attribute(ESCAPE_ATTRIBUTE, 'false')] : []),\n ],\n }),\n ...(options.trigger === undefined\n ? {}\n : {\n [options.trigger]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => [h.Attribute(TRIGGER_ATTRIBUTE, options.id(input))],\n }),\n }),\n // Keyed by values the caller chose; `forSlots` checks the keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'DismissLayer' },\n )\n","/**\n * `EditableText` as a Behavior: attaches the `foldkit-primitives/dom` Mount to\n * a container slot and maps what it reports into the view's Messages. No\n * Bundle: the text typed is a fact, and what it changes is the parent's\n * `update`.\n */\nimport * as Mount from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { EditableText as EditableTextMount, type TextFact } from '../dom/editable-text.js'\n\nexport {\n EditAsked,\n EditableText as mount,\n TextCancelled,\n TextCommitted,\n TextEdited,\n textOf,\n type TextFact,\n} from '../dom/editable-text.js'\n\nexport interface BehaviorOptions<Slots, ParentMessage> {\n /** The slot holding the fields. */\n readonly container: keyof Slots & string\n /** The attribute that marks a field, holding its name. */\n readonly attribute: string\n /** Turns each fact into the view's Message. */\n readonly toMessage: (fact: TextFact) => ParentMessage\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Slots, ParentMessage>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: () =>\n Mount.mapMessage(\n EditableTextMount({ attribute: options.attribute }),\n options.toMessage,\n ),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'EditableText' },\n )\n","/**\n * `FocusScope` as a Behavior: attaches the `foldkit-primitives/dom` Mount to a\n * container slot. No Bundle, because which element has focus is a DOM fact.\n */\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { FocusScope as FocusScopeMount } from '../dom/focus-scope.js'\n\nexport { FocusScope as mount, tabbableWithin } from '../dom/focus-scope.js'\n\nexport interface BehaviorOptions<Slots> {\n readonly container: keyof Slots & string\n /** Keep Tab, Shift+Tab, and a stray focus inside. Default `true`. */\n readonly contain?: boolean\n /** Give focus back to what had it when the container unmounts. Default `true`. */\n readonly restore?: boolean\n /** A selector inside the container to focus first. */\n readonly initialFocus?: string\n}\n\n/**\n * On insert the container focuses `initialFocus`, else its first tabbable\n * descendant, else itself; with `contain`, Tab and Shift+Tab wrap inside and\n * focus that lands outside comes back to the first tabbable; on unmount, with\n * `restore`, focus returns to the element that had it. A dialog that is not\n * a native `<dialog>`, a menu, or a command palette takes this.\n */\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: () =>\n FocusScopeMount({\n contain: options.contain ?? true,\n restore: options.restore ?? true,\n initialFocus: options.initialFocus ?? null,\n }),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'FocusScope' },\n )\n","/**\n * `FocusVisible` as a Behavior over a placed `InputModality`: the target gets\n * `data-focus-visible` while the page is being driven by keyboard, so a\n * stylesheet can show a ring with `[data-focus-visible]:focus` and hide it\n * for pointer users. CSS `:focus-visible` does this without any of it; this\n * is for a design system that must decide in the Model.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport type { Declared } from 'foldkit-bundle'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { InputModality, type InputModalityModel } from '../events/input-modality.js'\n\nexport { InputModality as bundle, Modality, modalityOfKey } from '../events/input-modality.js'\nexport type { InputModalityModel as Model } from '../events/input-modality.js'\n\nexport interface BehaviorOptions<Slots> {\n readonly target: keyof Slots & string\n}\n\nexport const behavior =\n <Field extends string>(declared: Declared<typeof InputModality, Field>) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: InputModalityModel }, ParentMessage>(\n options: BehaviorOptions<Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.target]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) =>\n input[declared.field].modality === 'keyboard'\n ? [h.DataAttribute('focus-visible', 'true')]\n : [],\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'FocusVisible' },\n )\n","/**\n * One tab stop for a set of items (a toolbar, a tab list, a listbox): arrows\n * move focus between them, the rest stay out of the tab order. The current\n * item's id is the Model slice, so a reorder keeps the same item current and a\n * resumed page knows where focus was. Which item comes next is a pure\n * function of the items and the key; the Behavior wires it to the slots.\n */\nimport { Option, Schema } from 'effect'\nimport type { Attribute, HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport { Bundle } from 'foldkit-bundle'\nimport { Behavior, Behaviors, Capability, type SlotItem } from 'foldkit-mixins'\nimport type { Declared } from 'foldkit-bundle'\nimport { perInput } from '../internal.js'\n\nexport const Orientation = Schema.Literals(['vertical', 'horizontal', 'both'])\nexport type Orientation = typeof Orientation.Type\n\nexport const Model = Schema.Struct({\n /** The current item's id, or `null` before any item has been focused. */\n current: Schema.NullOr(Schema.String),\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** An item became current: the user focused it, or a key moved there. */\n Focused: { id: Schema.String },\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n orientation: Orientation,\n /** Wrap from the last enabled item to the first, and back. */\n loop: Schema.Boolean,\n /** Keep DOM focus on the container and point at the current item with\n * `aria-activedescendant` instead of moving focus. */\n virtual: Schema.Boolean,\n})\nexport type Args = typeof Args.Type\n\nexport const bundle = Bundle.make('RovingTabindex', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { current: null } }),\n // Moving focus by key dispatches `Focused`, and the item's `OnFocus` reports it again.\n update: (model, message) =>\n model.current === message.id ? { model } : { model: { current: message.id } },\n})\n\nexport type Direction = 'ltr' | 'rtl'\n\nexport interface MoveOptions {\n readonly orientation: Orientation\n readonly loop: boolean\n readonly direction: Direction\n /** How many enabled items PageUp and PageDown move; absent, they are not handled. */\n readonly page?: number\n}\n\nconst isPlain = (modifiers: KeyboardModifiers): boolean =>\n !modifiers.ctrlKey && !modifiers.altKey && !modifiers.metaKey\n\n/**\n * The index the key moves to from `current`, over the enabled indices only, or\n * `undefined` when the key is not a navigation key here. `current` may be\n * `-1` (nothing current yet): arrows then land on the first or last enabled\n * item. Under `rtl`, left and right swap. PageUp and PageDown move by `page`\n * and clamp at the ends, never wrapping.\n */\nexport const move = (\n enabled: ReadonlyArray<number>,\n current: number,\n key: string,\n modifiers: KeyboardModifiers,\n options: MoveOptions,\n): number | undefined => {\n if (enabled.length === 0 || !isPlain(modifiers)) return undefined\n const first = enabled[0]!\n const last = enabled[enabled.length - 1]!\n if (key === 'Home') return first\n if (key === 'End') return last\n if (options.page !== undefined && (key === 'PageUp' || key === 'PageDown')) {\n const position = enabled.indexOf(current)\n if (position === -1) return key === 'PageDown' ? first : last\n const jumped = position + (key === 'PageDown' ? options.page : -options.page)\n return enabled[Math.min(enabled.length - 1, Math.max(0, jumped))]\n }\n const vertical = options.orientation !== 'horizontal'\n const horizontal = options.orientation !== 'vertical'\n const forwardKey = options.direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight'\n const backwardKey = options.direction === 'rtl' ? 'ArrowRight' : 'ArrowLeft'\n const step =\n (vertical && key === 'ArrowDown') || (horizontal && key === forwardKey)\n ? 1\n : (vertical && key === 'ArrowUp') || (horizontal && key === backwardKey)\n ? -1\n : 0\n if (step === 0) return undefined\n const position = enabled.indexOf(current)\n if (position === -1) return step === 1 ? first : last\n const next = position + step\n if (next < 0) return options.loop ? last : first\n if (next >= enabled.length) return options.loop ? first : last\n return enabled[next]\n}\n\n/** The item that holds the tab stop: the current one, else the first enabled. */\nexport const tabStop = (\n items: Behaviors.Collection.Items<unknown>,\n current: string | null,\n): number => {\n const index = current === null ? -1 : items.indexOf(current)\n if (index !== -1 && !items.isDisabled(index)) return index\n return items.enabled[0] ?? -1\n}\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot that receives the arrow keys. */\n readonly container: keyof Slots & string\n /** The slot rendered once per item; must carry the item's id (see `Behaviors.Collection`). */\n readonly item: keyof Slots & string\n readonly items: (input: Input) => Behaviors.Collection.Items<unknown>\n /** Default `'ltr'`; return `'rtl'` to swap left and right. */\n readonly direction?: (input: Input) => Direction\n}\n\n/** A selector for an element by id, safe for any id. */\nexport const idSelector = (id: string): string => `[id=\"${id.replace(/[\"\\\\]/g, '\\\\$&')}\"]`\n\n/**\n * The attributes one item gets: `tabindex` 0 when it holds the tab stop and\n * -1 otherwise (none under `virtual`), and `OnFocus` reporting it current.\n * Shared with `ListNavigation`.\n */\nexport const itemAttributes = <ParentMessage>(\n h: HtmlBuilder<ParentMessage>,\n items: Behaviors.Collection.Items<unknown>,\n current: string | null,\n item: SlotItem,\n virtual: boolean,\n focused: (id: string) => ParentMessage,\n): ReadonlyArray<Attribute<ParentMessage>> => {\n const id = item.id ?? items.ids[item.index]\n if (id === undefined) return []\n const isStop = tabStop(items, current) === item.index\n return [...(virtual ? [] : [h.Tabindex(isStop ? 0 : -1)]), h.OnFocus(focused(id))]\n}\n\n/**\n * Wires a placed `RovingTabindex` to the slots: the container's arrow, Home\n * and End keys focus the next item (synchronously, then dispatch), each item\n * gets `tabindex` 0 or -1 and reports `Focused` when focused. Under `virtual`\n * DOM focus never leaves the container: the key only dispatches, the\n * container carries `aria-activedescendant`, and items keep no `tabindex`.\n *\n * Every handled key is default-prevented. Nothing is written on dispose: the\n * attributes are data, so a view that no longer attaches this leaves no\n * `tabindex` behind.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>, args: Args) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (id: string): ParentMessage =>\n declared.wrapper.make(Message.Focused({ id })) as unknown as ParentMessage\n const slice = (input: Input): Model => input[declared.field]\n const itemsOf = perInput(options.items)\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => {\n const items = itemsOf(input)\n const current = slice(input).current\n const from = current === null ? -1 : items.indexOf(current)\n const direction = options.direction?.(input) ?? 'ltr'\n const stop = tabStop(items, current)\n const stopId = stop === -1 ? undefined : items.ids[stop]\n const target = (key: string, modifiers: KeyboardModifiers): string | undefined => {\n const next = move(items.enabled, from, key, modifiers, { ...args, direction })\n return next === undefined ? undefined : items.ids[next]\n }\n // Virtual: DOM focus stays on the container, only the pointer moves.\n if (args.virtual) {\n return [\n h.OnKeyDownPreventDefault((key, modifiers) =>\n Option.map(Option.fromNullishOr(target(key, modifiers)), wrap),\n ),\n ...(stopId === undefined ? [] : [h.AriaActiveDescendant(stopId)]),\n ]\n }\n return [\n h.OnKeyDownFocus((key, modifiers) =>\n Option.map(Option.fromNullishOr(target(key, modifiers)), id => ({\n focusSelector: idSelector(id),\n message: wrap(id),\n })),\n ),\n ]\n },\n }),\n [options.item]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n readonly item?: SlotItem\n }) => {\n if (item === undefined) return []\n return itemAttributes(h, itemsOf(input), slice(input).current, item, args.virtual, wrap)\n },\n }),\n // Keyed by values the caller chose; `forSlots` checks both keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'RovingTabindex' },\n )\n }\n","/**\n * Two-dimensional arrow keys over a set of items laid out in rows of\n * `columns` (a calendar grid, a color swatch picker, an emoji palette). The\n * Model slice is the current item's id, as with `RovingTabindex`, so a\n * reorder keeps the same item current. Which cell a key lands on is the pure\n * `move`; the Behavior wires it to a container slot and a per-item slot and\n * shares `RovingTabindex`'s item attributes, so the two are interchangeable\n * on a view.\n */\nimport { Option, Schema } from 'effect'\nimport type { HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Behaviors, Capability, type SlotItem } from 'foldkit-mixins'\nimport * as RovingTabindex from './roving-tabindex.js'\nimport { perInput } from '../internal.js'\n\nexport const Model = Schema.Struct({\n /** The current cell's id, or `null` before any cell has been focused. */\n current: Schema.NullOr(Schema.String),\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** A cell became current: the user focused it, or a key moved there. */\n Focused: { id: Schema.String },\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n /** Cells per row; the last row may be short. */\n columns: Schema.Number.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(1))),\n /** Left and right continue into the previous and next row; up and down\n * continue into the previous and next column. Off, they stop at the edge. */\n wrap: Schema.Boolean,\n /** Keep DOM focus on the container and point at the current cell with\n * `aria-activedescendant` instead of moving focus. */\n virtual: Schema.Boolean,\n})\nexport type Args = typeof Args.Type\n\nexport const bundle = Bundle.make('GridNavigation', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { current: null } }),\n // Moving focus by key dispatches `Focused`, and the cell's `OnFocus` reports it again.\n update: (model, message) =>\n model.current === message.id ? { model } : { model: { current: message.id } },\n})\n\nexport interface MoveOptions {\n readonly columns: number\n readonly wrap: boolean\n readonly direction: RovingTabindex.Direction\n}\n\n/**\n * The index the key moves to from `current` over a grid of `count` cells in\n * rows of `columns`, skipping cells not in `enabled`, or `undefined` when the\n * key is not a grid key. Left and right step within the row, and across rows\n * under `wrap`; up and down step within the column, and across columns under\n * `wrap`. Home and End are the row's first and last enabled cell; with Ctrl\n * they are the grid's. At an edge without `wrap` the key is consumed and\n * `current` is returned. From `-1` (nothing current) a forward key lands on\n * the first enabled cell and a backward key on the last. Under `rtl`, left\n * and right swap.\n */\nexport const move = (\n enabled: ReadonlyArray<number>,\n count: number,\n current: number,\n key: string,\n modifiers: KeyboardModifiers,\n options: MoveOptions,\n): number | undefined => {\n if (enabled.length === 0 || modifiers.altKey || modifiers.metaKey) return undefined\n const first = enabled[0]!\n const last = enabled[enabled.length - 1]!\n const isEnabled = (index: number) => enabled.includes(index)\n const { columns } = options\n const row = (index: number) => Math.floor(index / columns)\n\n if (key === 'Home' || key === 'End') {\n if (modifiers.ctrlKey || current === -1) return key === 'Home' ? first : last\n const inRow = enabled.filter(index => row(index) === row(current))\n return key === 'Home' ? (inRow[0] ?? current) : (inRow[inRow.length - 1] ?? current)\n }\n if (modifiers.ctrlKey) return undefined\n\n const forwardKey = options.direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight'\n const backwardKey = options.direction === 'rtl' ? 'ArrowRight' : 'ArrowLeft'\n const axis: 'row' | 'column' | undefined =\n key === forwardKey || key === backwardKey\n ? 'row'\n : key === 'ArrowDown' || key === 'ArrowUp'\n ? 'column'\n : undefined\n if (axis === undefined) return undefined\n const step = key === forwardKey || key === 'ArrowDown' ? 1 : -1\n if (current === -1) return step === 1 ? first : last\n\n if (axis === 'row') {\n // Reading order; without wrap the walk stops at the row's edge.\n for (let index = current + step; index >= 0 && index < count; index += step) {\n if (!options.wrap && row(index) !== row(current)) return current\n if (isEnabled(index)) return index\n }\n return current\n }\n // Column-major; without wrap the walk stops at the column's edge.\n const column = current % columns\n for (let index = current + step * columns; ; index += step * columns) {\n if (index < 0 || index >= count) {\n if (!options.wrap) return current\n const nextColumn = column + step\n if (nextColumn < 0 || nextColumn >= columns) return current\n // Continue from the top (or bottom) of the neighbouring column.\n const start =\n step === 1\n ? nextColumn\n : nextColumn + columns * Math.floor((count - 1 - nextColumn) / columns)\n for (let next = start; next >= 0 && next < count; next += step * columns) {\n if (isEnabled(next)) return next\n }\n return current\n }\n if (isEnabled(index)) return index\n }\n}\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot that receives the arrow keys. */\n readonly container: keyof Slots & string\n /** The slot rendered once per cell; must carry the cell's id (see `Behaviors.Collection`). */\n readonly item: keyof Slots & string\n readonly items: (input: Input) => Behaviors.Collection.Items<unknown>\n /** Default `'ltr'`; return `'rtl'` to swap left and right. */\n readonly direction?: (input: Input) => RovingTabindex.Direction\n}\n\n/**\n * Wires a placed `GridNavigation` to the slots exactly as `RovingTabindex`\n * does, with `move` above deciding the cell: the container's arrows, Home and\n * End focus the next cell (synchronously, then dispatch) or, under `virtual`,\n * only dispatch and point with `aria-activedescendant`; each cell gets\n * `tabindex` 0 or -1 and reports `Focused` when focused.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>, args: Args) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (id: string): ParentMessage =>\n declared.wrapper.make(Message.Focused({ id })) as unknown as ParentMessage\n const slice = (input: Input): Model => input[declared.field]\n const itemsOf = perInput(options.items)\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => {\n const items = itemsOf(input)\n const current = slice(input).current\n const from = current === null ? -1 : items.indexOf(current)\n const direction = options.direction?.(input) ?? 'ltr'\n const stop = RovingTabindex.tabStop(items, current)\n const stopId = stop === -1 ? undefined : items.ids[stop]\n const target = (key: string, modifiers: KeyboardModifiers): string | undefined => {\n const next = move(items.enabled, items.size, from, key, modifiers, {\n columns: args.columns,\n wrap: args.wrap,\n direction,\n })\n return next === undefined ? undefined : items.ids[next]\n }\n if (args.virtual) {\n return [\n h.OnKeyDownPreventDefault((key, modifiers) =>\n Option.map(Option.fromNullishOr(target(key, modifiers)), wrap),\n ),\n ...(stopId === undefined ? [] : [h.AriaActiveDescendant(stopId)]),\n ]\n }\n return [\n h.OnKeyDownFocus((key, modifiers) =>\n Option.map(Option.fromNullishOr(target(key, modifiers)), id => ({\n focusSelector: RovingTabindex.idSelector(id),\n message: wrap(id),\n })),\n ),\n ]\n },\n }),\n [options.item]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n readonly item?: SlotItem\n }) => {\n if (item === undefined) return []\n return RovingTabindex.itemAttributes(\n h,\n itemsOf(input),\n slice(input).current,\n item,\n args.virtual,\n wrap,\n )\n },\n }),\n // Keyed by values the caller chose; `forSlots` checks both keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'GridNavigation' },\n )\n }\n","/**\n * `ScrollLock` and `HideOutside` as Behaviors: each attaches its\n * `foldkit-primitives/dom` Mount to a container slot. No Bundle, because the\n * lock and the inert set are document facts Foldkit already refcounts and\n * keys.\n */\nimport type { MountAction } from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { HideOutside as HideOutsideMount, ScrollLock as ScrollLockMount } from '../dom/layers.js'\n\nexport { HideOutside as hideOutsideMount, ScrollLock as scrollLockMount } from '../dom/layers.js'\n\nconst mountOn =\n (name: string, mount: () => MountAction<never>) =>\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(options: {\n readonly container: keyof Slots & string\n }): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount,\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name },\n )\n\n/** Locks the document's scroll while the container is mounted; nested locks release together. */\nexport const scrollLock = mountOn('ScrollLock', () => ScrollLockMount())\n\n/** Marks everything outside the container inert while it is mounted. */\nexport const hideOutside = mountOn('HideOutside', () => HideOutsideMount())\n","/**\n * Announcements for assistive technology: one Bundle, placed once, holds the\n * text of a polite and an assertive live region. An announcement waits\n * `debounceMs` so a burst reads once, then clears after `clearAfterMs`, both\n * on Effect's clock with a generation so a superseded timer changes nothing.\n * The same text twice gets a trailing no-break space toggled, which is what\n * makes a screen reader read it again. `view` renders the two regions; put it\n * once in the page and style them visually hidden.\n */\nimport { Effect, Schema } from 'effect'\nimport type { Html, HtmlBuilder } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\n\nexport const Politeness = Schema.Literals(['polite', 'assertive'])\nexport type Politeness = typeof Politeness.Type\n\nexport const Model = Schema.Struct({\n polite: Schema.String,\n assertive: Schema.String,\n /** Waiting for the debounce to read. */\n pending: Schema.NullOr(Schema.Struct({ message: Schema.String, politeness: Politeness })),\n generation: Schema.Number,\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n Announced: { message: Schema.String, politeness: Politeness },\n Read: { generation: Schema.Number },\n Cleared: { generation: Schema.Number },\n})\nexport type Message = typeof Message.Type\n\nconst positive = Schema.Number.pipe(\n Schema.check(Schema.isGreaterThanOrEqualTo(0)),\n Schema.check(Schema.isFinite()),\n)\n\nexport const Args = Schema.Struct({\n /** A burst of announcements inside this window reads once, the last one. */\n debounceMs: positive,\n /** How long the text stays in the region. */\n clearAfterMs: positive,\n})\nexport type Args = typeof Args.Type\n\nconst NBSP = ' '\n\n/** The text to put in the region so that `next` is read even when it equals `current`. */\nexport const reread = (current: string, next: string): string =>\n current === next ? `${next}${NBSP}` : current === `${next}${NBSP}` ? next : next\n\ntype Return = Update.Return<Model, Message>\n\nconst after = (ms: number, message: Message, name: string, generation: number) => ({\n name,\n args: { generation },\n effect: Effect.as(Effect.sleep(ms), message),\n})\n\nexport const bundle = Bundle.make('LiveAnnounce', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { polite: '', assertive: '', pending: null, generation: 0 } }),\n update: (model, message, args): Return =>\n Message.match<Return>(message, {\n Announced: ({ message: text, politeness }) => {\n const generation = model.generation + 1\n return {\n model: { ...model, pending: { message: text, politeness }, generation },\n commands: [\n after(args.debounceMs, Message.Read({ generation }), 'LiveAnnounce.read', generation),\n ],\n }\n },\n Read: ({ generation }) => {\n if (generation !== model.generation || model.pending === null) return { model }\n const { message: text, politeness } = model.pending\n const region = politeness === 'polite' ? 'polite' : 'assertive'\n return {\n model: { ...model, pending: null, [region]: reread(model[region], text) },\n commands: [\n after(\n args.clearAfterMs,\n Message.Cleared({ generation }),\n 'LiveAnnounce.clear',\n generation,\n ),\n ],\n }\n },\n Cleared: ({ generation }) =>\n generation === model.generation\n ? { model: { ...model, polite: '', assertive: '' } }\n : { model },\n }),\n})\n\n/** The parent Message that announces `text`, to return from `update` or `onOut`. */\nexport const say =\n <Field extends string>(declared: Declared<typeof bundle, Field>) =>\n <ParentMessage>(text: string, politeness: Politeness = 'polite'): ParentMessage =>\n declared.wrapper.make(\n Message.Announced({ message: text, politeness }),\n ) as unknown as ParentMessage\n\nexport const REGION_ATTRIBUTE = 'data-foldkit-plus-live'\n\n/**\n * The two live regions. Render once, anywhere in the page, and hide them\n * visually with a rule on `[data-foldkit-plus-live]`; they must stay in the\n * accessibility tree, so no `display: none`.\n */\nexport const view = <ParentMessage>(model: Model, h: HtmlBuilder<ParentMessage>): Html =>\n h.div(\n [h.Attribute(REGION_ATTRIBUTE, 'regions')],\n [\n h.div(\n [h.Attribute(REGION_ATTRIBUTE, 'polite'), h.AriaLive('polite'), h.AriaAtomic(true)],\n [model.polite],\n ),\n h.div(\n [h.Attribute(REGION_ATTRIBUTE, 'assertive'), h.AriaLive('assertive'), h.AriaAtomic(true)],\n [model.assertive],\n ),\n ],\n )\n","/**\n * Typeahead over a set of items: printable keys build a query that a timer\n * clears, and the query picks the item to move to. The query lives in the\n * Model so a replay sees the same picks; the timer runs on Effect's clock so\n * TestClock drives it. Which item matches is a pure function.\n */\nimport { Effect, Option, Schema } from 'effect'\nimport type { HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Behaviors, Capability } from 'foldkit-mixins'\nimport { idSelector } from './roving-tabindex.js'\nimport { clearQuery } from '../internal.js'\n\nexport const Model = Schema.Struct({\n query: Schema.String,\n /** Bumped per keystroke, carried by the clear it schedules, so a superseded\n * timer's `Expired` changes nothing. */\n generation: Schema.Number,\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** A printable key was pressed with no ctrl, alt or meta. */\n Typed: { char: Schema.String },\n /** The clear timer fired for `generation`. */\n Expired: { generation: Schema.Number },\n /** The query was dropped on purpose (a blur, a selection). */\n Cleared: {},\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n /** How long the query survives after the last key. */\n timeoutMs: Schema.Number.pipe(\n Schema.check(Schema.isGreaterThan(0)),\n Schema.check(Schema.isFinite()),\n ),\n})\nexport type Args = typeof Args.Type\n\nexport const bundle = Bundle.make('Typeahead', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { query: '', generation: 0 } }),\n update: (model, message, args) =>\n Message.match<Update.Return<Model, Message>>(message, {\n Typed: ({ char }) => {\n const generation = model.generation + 1\n return {\n model: { query: model.query + char, generation },\n commands: [\n {\n name: 'Typeahead.expire',\n args: { generation },\n effect: Effect.as(Effect.sleep(args.timeoutMs), Message.Expired({ generation })),\n },\n ],\n }\n },\n Expired: ({ generation }) =>\n generation === model.generation ? clearQuery(model) : { model },\n Cleared: () => clearQuery(model),\n }),\n})\n\nconst normalize = (text: string): string => text.trimStart().toLocaleLowerCase()\n\nconst isRepeated = (query: string): boolean =>\n query.length > 1 && [...query].every(char => char === query[0])\n\n/**\n * The enabled index whose text starts with `query`, searching forward from\n * `current` and wrapping, or `undefined`. A query of one character, or one\n * character repeated (`aaa`), starts *after* the current item so repeated\n * presses cycle through the items that begin with it; a longer query starts\n * *at* the current item, since the user is refining a match. Case and leading\n * whitespace are ignored.\n */\nexport const match = (\n texts: ReadonlyArray<string>,\n enabled: ReadonlyArray<number>,\n query: string,\n current: number,\n): number | undefined => {\n if (query === '' || enabled.length === 0) return undefined\n const needle = normalize(isRepeated(query) ? query[0]! : query)\n const position = enabled.indexOf(current)\n const startAfter = needle.length === 1 || isRepeated(query)\n const start = position === -1 ? 0 : startAfter ? position + 1 : position\n for (let offset = 0; offset < enabled.length; offset += 1) {\n const index = enabled[(start + offset) % enabled.length]!\n if (normalize(texts[index] ?? '').startsWith(needle)) return index\n }\n return undefined\n}\n\n/** A single character with no ctrl, alt or meta: a typeahead key. */\nexport const isPrintable = (key: string, modifiers: KeyboardModifiers): boolean =>\n key.length === 1 && !modifiers.ctrlKey && !modifiers.altKey && !modifiers.metaKey\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot that receives the keys. */\n readonly host: keyof Slots & string\n readonly items: (input: Input) => Behaviors.Collection.Items<unknown>\n /** The text an item is matched by. */\n readonly text: (input: Input, index: number) => string\n /** The current item's id, so the search starts from it; a placed\n * `RovingTabindex` is the usual source. */\n readonly current: (input: Input) => string | null\n}\n\n/**\n * Wires a placed `Typeahead` to the host slot: a printable key extends the\n * query, focuses the matching item by its id (which then reports itself\n * current, through `RovingTabindex`'s `OnFocus`), and dispatches `Typed`.\n * With no match the key still extends the query, so the next one can match;\n * a space with an empty query is left to the host (it activates).\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (char: string): ParentMessage =>\n declared.wrapper.make(Message.Typed({ char })) as unknown as ParentMessage\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.host]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => {\n const items = options.items(input)\n const query = input[declared.field].query\n const currentId = options.current(input)\n const current = currentId === null ? -1 : items.indexOf(currentId)\n return [\n h.OnKeyDownFocus((key, modifiers) => {\n if (!isPrintable(key, modifiers)) return Option.none()\n if (key === ' ' && query === '') return Option.none()\n // Read on a key, not on every render.\n const texts = items.ids.map((_, index) => options.text(input, index))\n const found = match(texts, items.enabled, query + key, current)\n const target = found === undefined ? currentId : items.ids[found]\n return Option.some({\n // `:not(*)` matches nothing: no match and nothing current\n // moves no focus, but the key is still recorded.\n focusSelector:\n target === null || target === undefined ? ':not(*)' : idSelector(target),\n message: wrap(key),\n })\n }),\n ]\n },\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'Typeahead' },\n )\n }\n","/**\n * Keyboard navigation of a list in one placement: a roving tab stop, type to\n * find, and PageUp and PageDown. One Bundle holds the current item's id and\n * the typeahead query, so a printable key can move the pointer and extend the\n * query in one transition, which two placements cannot do under `virtual`.\n * The resolver allows one owner per event on a slot, so a host that needs\n * both arrows and typeahead takes this, not `RovingTabindex` plus `Typeahead`.\n */\nimport { Effect, Option, Schema } from 'effect'\nimport type { HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Behaviors, Capability, type SlotItem } from 'foldkit-mixins'\nimport * as RovingTabindex from './roving-tabindex.js'\nimport * as Typeahead from './typeahead.js'\nimport { clearQuery, perInput } from '../internal.js'\n\nexport const Model = Schema.Struct({\n current: Schema.NullOr(Schema.String),\n query: Schema.String,\n generation: Schema.Number,\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** An item became current: focused, or reached by a key. */\n Focused: { id: Schema.String },\n /** A printable key extended the query; `match` is the item it now picks, if any. */\n Typed: { char: Schema.String, match: Schema.NullOr(Schema.String) },\n Expired: { generation: Schema.Number },\n Cleared: {},\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n orientation: RovingTabindex.Orientation,\n loop: Schema.Boolean,\n virtual: Schema.Boolean,\n /** How long the typeahead query survives after the last key. */\n timeoutMs: Schema.Number.pipe(\n Schema.check(Schema.isGreaterThan(0)),\n Schema.check(Schema.isFinite()),\n ),\n /** How many enabled items PageUp and PageDown move. */\n page: Schema.Number.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThan(0))),\n})\nexport type Args = typeof Args.Type\n\nexport const bundle = Bundle.make('ListNavigation', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { current: null, query: '', generation: 0 } }),\n update: (model, message, args) =>\n Message.match<Update.Return<Model, Message>>(message, {\n // Moving focus by key dispatches `Focused`, and the item's `OnFocus` reports it again.\n Focused: ({ id }) =>\n model.current === id ? { model } : { model: { ...model, current: id } },\n Typed: ({ char, match }) => {\n const generation = model.generation + 1\n return {\n model: { current: match ?? model.current, query: model.query + char, generation },\n commands: [\n {\n name: 'ListNavigation.expire',\n args: { generation },\n effect: Effect.as(Effect.sleep(args.timeoutMs), Message.Expired({ generation })),\n },\n ],\n }\n },\n Expired: ({ generation }) =>\n generation === model.generation ? clearQuery(model) : { model },\n Cleared: () => clearQuery(model),\n }),\n})\n\nexport interface BehaviorOptions<Input, Slots, ParentMessage> {\n readonly container: keyof Slots & string\n /** The slot rendered once per item; must carry the item's id (see `Behaviors.Collection`). */\n readonly item: keyof Slots & string\n readonly items: (input: Input) => Behaviors.Collection.Items<unknown>\n /** The text an item is matched by when typing. */\n readonly text: (input: Input, index: number) => string\n readonly direction?: (input: Input) => RovingTabindex.Direction\n /**\n * Whether a printable key moves the pointer. Off when the container is a\n * text field: letters belong to the field, and arrows still navigate.\n * Defaults to on.\n */\n readonly typeahead?: boolean\n /**\n * Enter on the current enabled item. One handler with the arrows: a second\n * key handler on the same slot would be a second owner of `keydown`.\n */\n readonly commit?: (input: Input, id: string) => ParentMessage\n}\n\n/**\n * The key's outcome, before it is turned into an attribute: navigation to an\n * id, a typed character with its match, or nothing.\n */\nexport type KeyOutcome =\n | { readonly _tag: 'Navigate'; readonly id: string }\n | { readonly _tag: 'Type'; readonly char: string; readonly match: string | null }\n\nexport const keyOutcome = (\n items: Behaviors.Collection.Items<unknown>,\n texts: ReadonlyArray<string>,\n state: { readonly current: string | null; readonly query: string },\n key: string,\n modifiers: KeyboardModifiers,\n options: RovingTabindex.MoveOptions,\n): KeyOutcome | undefined => {\n const from = state.current === null ? -1 : items.indexOf(state.current)\n const moved = RovingTabindex.move(items.enabled, from, key, modifiers, options)\n const movedId = moved === undefined ? undefined : items.ids[moved]\n if (movedId !== undefined) return { _tag: 'Navigate', id: movedId }\n if (!Typeahead.isPrintable(key, modifiers)) return undefined\n if (key === ' ' && state.query === '') return undefined\n const found = Typeahead.match(texts, items.enabled, state.query + key, from)\n return { _tag: 'Type', char: key, match: found === undefined ? null : (items.ids[found] ?? null) }\n}\n\n/**\n * Wires a placed `ListNavigation` to the slots. The container gets one key\n * handler: arrows, Home, End, PageUp and PageDown move by id; a printable key\n * extends the query and moves to its match. Each item gets `tabindex` and\n * `OnFocus` as under `RovingTabindex`. Under `virtual` nothing takes DOM focus\n * and the container carries `aria-activedescendant`.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>, args: Args) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots, ParentMessage>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (message: Message): ParentMessage =>\n declared.wrapper.make(message) as unknown as ParentMessage\n const focused = (id: string): ParentMessage => wrap(Message.Focused({ id }))\n const slice = (input: Input): Model => input[declared.field]\n const itemsOf = perInput(options.items)\n const outcomeMessage = (outcome: KeyOutcome): ParentMessage =>\n outcome._tag === 'Navigate'\n ? focused(outcome.id)\n : wrap(Message.Typed({ char: outcome.char, match: outcome.match }))\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => {\n const items = itemsOf(input)\n const state = slice(input)\n const moveOptions: RovingTabindex.MoveOptions = {\n orientation: args.orientation,\n loop: args.loop,\n direction: options.direction?.(input) ?? 'ltr',\n page: args.page,\n }\n const typeahead = options.typeahead !== false\n // Commit is already a parent message. A key outcome still has to\n // become one, and the focus path needs the id it should move to.\n type Decision =\n | { readonly _tag: 'Commit'; readonly id: string; readonly message: ParentMessage }\n | { readonly _tag: 'Key'; readonly outcome: KeyOutcome }\n const decide = (key: string, modifiers: KeyboardModifiers): Option.Option<Decision> => {\n const current = state.current\n if (\n key === 'Enter' &&\n options.commit !== undefined &&\n !modifiers.shiftKey &&\n !modifiers.ctrlKey &&\n !modifiers.altKey &&\n !modifiers.metaKey &&\n current !== null\n ) {\n const currentIndex = items.indexOf(current)\n if (currentIndex !== -1 && !items.isDisabled(currentIndex)) {\n return Option.some({\n _tag: 'Commit',\n id: current,\n message: options.commit(input, current),\n })\n }\n }\n const result = keyOutcome(\n items,\n // Read on a key, not on every render.\n items.ids.map((_, index) => options.text(input, index)),\n state,\n key,\n modifiers,\n moveOptions,\n )\n // A text field owns printable keys. Arrows still move the pointer.\n if (!typeahead && result !== undefined && result._tag === 'Type') return Option.none()\n if (result === undefined) return Option.none()\n return Option.some({ _tag: 'Key', outcome: result })\n }\n const messageOf = (decision: Decision): ParentMessage => {\n if (decision._tag === 'Commit') return decision.message\n return outcomeMessage(decision.outcome)\n }\n const stop = RovingTabindex.tabStop(items, state.current)\n const stopId = stop === -1 ? undefined : items.ids[stop]\n if (args.virtual) {\n return [\n h.OnKeyDownPreventDefault((key, modifiers) =>\n Option.map(decide(key, modifiers), messageOf),\n ),\n ...(stopId === undefined ? [] : [h.AriaActiveDescendant(stopId)]),\n ]\n }\n return [\n h.OnKeyDownFocus((key, modifiers) =>\n Option.map(decide(key, modifiers), decision => {\n if (decision._tag === 'Commit') {\n return {\n focusSelector: RovingTabindex.idSelector(decision.id),\n message: decision.message,\n }\n }\n const result = decision.outcome\n const target =\n result._tag === 'Navigate' ? result.id : (result.match ?? state.current)\n return {\n // `:not(*)` matches nothing: a typed key with no match and\n // nothing current moves no focus but is still recorded.\n focusSelector: target === null ? ':not(*)' : RovingTabindex.idSelector(target),\n message: outcomeMessage(result),\n }\n }),\n ),\n ]\n },\n }),\n [options.item]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n readonly item?: SlotItem\n }) =>\n item === undefined\n ? []\n : RovingTabindex.itemAttributes(\n h,\n itemsOf(input),\n slice(input).current,\n item,\n args.virtual,\n focused,\n ),\n }),\n // Keyed by values the caller chose; `forSlots` checks both keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'ListNavigation' },\n )\n }\n","/**\n * Press: pointer and keyboard activation of one element as one fact. A Mount\n * reports what the element saw (pointer down, up, cancel, key down, up,\n * click) with the detail Foldkit's declarative attributes do not carry; the\n * Bundle's `update` decides what counts as a press; the ghost click that\n * follows a touch is suppressed by a timed Command on Effect's clock, never\n * by a clock read in a handler. Activation is an OutMessage, `Pressed`, so\n * the placement must say what a press does.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport type { HtmlBuilder } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Mount from 'foldkit/mount'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Capability } from 'foldkit-mixins'\n\nexport const PointerType = Schema.Literals(['mouse', 'touch', 'pen', 'keyboard', 'virtual'])\nexport type PointerType = typeof PointerType.Type\n\nexport const Model = Schema.Struct({\n /** Down and not yet released or cancelled. For styling. */\n pressed: Schema.Boolean,\n /** The pointer that pressed, so another pointer's up cannot release it. */\n pointerId: Schema.NullOr(Schema.Number),\n /** Enter or Space is down. */\n key: Schema.NullOr(Schema.String),\n /** A click arriving before this generation's window ends is the ghost of a pointer press. */\n suppressing: Schema.NullOr(Schema.Number),\n generation: Schema.Number,\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n PointerDown: { pointerId: Schema.Number, button: Schema.Number, pointerType: Schema.String },\n PointerUp: { pointerId: Schema.Number, pointerType: Schema.String, shiftKey: Schema.Boolean },\n PointerCancelled: { pointerId: Schema.Number },\n KeyDown: { key: Schema.String, repeat: Schema.Boolean },\n KeyUp: { key: Schema.String, shiftKey: Schema.Boolean },\n /** `detail` is 0 for a click no pointer made: keyboard on a native control, or assistive technology. */\n Clicked: { detail: Schema.Number, shiftKey: Schema.Boolean },\n Unsuppressed: { generation: Schema.Number },\n})\nexport type Message = typeof Message.Type\n\nexport const Pressed = Schema.TaggedStruct('Pressed', {\n pointerType: PointerType,\n /** Shift was held, for a range selection. */\n shiftKey: Schema.Boolean,\n})\nexport type Pressed = typeof Pressed.Type\n\nexport const Args = Schema.Struct({\n /** How long after a pointer press a `click` is taken for its ghost. */\n clickSuppressionMs: Schema.Number.pipe(\n Schema.check(Schema.isGreaterThanOrEqualTo(0)),\n Schema.check(Schema.isFinite()),\n ),\n})\nexport type Args = typeof Args.Type\n\nconst idle = (model: Model): Model => ({ ...model, pressed: false, pointerId: null, key: null })\n\nconst isActivationKey = (key: string): boolean => key === 'Enter' || key === ' '\n\nconst asPointerType = (raw: string): PointerType =>\n raw === 'touch' || raw === 'pen' ? raw : 'mouse'\n\ntype Return = Update.ReturnWithOutMessage<Model, Message, Pressed>\n\nexport const bundle = Bundle.make('Press', {\n Model,\n Message,\n args: Args,\n init: () => ({\n model: { pressed: false, pointerId: null, key: null, suppressing: null, generation: 0 },\n }),\n update: (model, message, args): Return =>\n Message.match<Return>(message, {\n PointerDown: ({ pointerId, button }) =>\n button !== 0 || model.pointerId !== null\n ? { model }\n : { model: { ...model, pressed: true, pointerId } },\n PointerUp: ({ pointerId, pointerType, shiftKey }) => {\n if (model.pointerId !== pointerId) return { model }\n const generation = model.generation + 1\n return {\n model: { ...idle(model), suppressing: generation, generation },\n commands: [\n {\n name: 'Press.unsuppress',\n args: { generation },\n effect: Effect.as(\n Effect.sleep(args.clickSuppressionMs),\n Message.Unsuppressed({ generation }),\n ),\n },\n ],\n outMessage: Pressed.make({ pointerType: asPointerType(pointerType), shiftKey }),\n }\n },\n PointerCancelled: ({ pointerId }) =>\n model.pointerId === pointerId ? { model: idle(model) } : { model },\n KeyDown: ({ key, repeat }) =>\n !isActivationKey(key) || repeat || model.key !== null || model.pointerId !== null\n ? { model }\n : { model: { ...model, pressed: true, key } },\n KeyUp: ({ key, shiftKey }) =>\n model.key === key\n ? { model: idle(model), outMessage: Pressed.make({ pointerType: 'keyboard', shiftKey }) }\n : { model },\n Clicked: ({ detail, shiftKey }) =>\n detail === 0\n ? { model, outMessage: Pressed.make({ pointerType: 'virtual', shiftKey }) }\n : model.suppressing !== null\n ? { model }\n : { model, outMessage: Pressed.make({ pointerType: 'mouse', shiftKey }) },\n Unsuppressed: ({ generation }) =>\n model.suppressing === generation ? { model: { ...model, suppressing: null } } : { model },\n }),\n})\n\ntype PointerLike = Event & {\n readonly pointerId?: number\n readonly button?: number\n readonly pointerType?: string\n readonly shiftKey?: boolean\n}\n\n/** What the element reports; `Unsuppressed` comes from the timer, not the DOM. */\nexport type Fact = Exclude<Message, { readonly _tag: 'Unsuppressed' }>\n\n/**\n * The element's press-relevant events as facts. Enter and Space key downs\n * are default-prevented so a native control does not also click, and Space\n * does not scroll; the Bundle owns activation. An element marked\n * `aria-disabled=\"true\"` (which the Behavior writes) reports nothing, read\n * at event time so a toggle needs no remount. Nothing else is decided here.\n */\nexport const events = Mount.defineStream('PressEvents', {\n messages: [\n Message.PointerDown,\n Message.PointerUp,\n Message.PointerCancelled,\n Message.KeyDown,\n Message.KeyUp,\n Message.Clicked,\n ],\n execute: ({ element }) =>\n Stream.callback<Fact>(queue =>\n Effect.acquireRelease(\n Effect.sync(() => {\n const offer = (message: Fact) => {\n if (element.getAttribute('aria-disabled') === 'true') return\n Queue.offerUnsafe(queue, message)\n }\n const listeners: ReadonlyArray<readonly [string, (event: Event) => void]> = [\n [\n 'pointerdown',\n event => {\n const pointer = event as PointerLike\n offer(\n Message.PointerDown({\n pointerId: pointer.pointerId ?? 0,\n button: pointer.button ?? 0,\n pointerType: pointer.pointerType ?? 'mouse',\n }),\n )\n },\n ],\n [\n 'pointerup',\n event => {\n const pointer = event as PointerLike\n offer(\n Message.PointerUp({\n pointerId: pointer.pointerId ?? 0,\n pointerType: pointer.pointerType ?? 'mouse',\n shiftKey: pointer.shiftKey ?? false,\n }),\n )\n },\n ],\n [\n 'pointerleave',\n event =>\n offer(\n Message.PointerCancelled({ pointerId: (event as PointerLike).pointerId ?? 0 }),\n ),\n ],\n [\n 'pointercancel',\n event =>\n offer(\n Message.PointerCancelled({ pointerId: (event as PointerLike).pointerId ?? 0 }),\n ),\n ],\n [\n 'keydown',\n event => {\n const key = event as KeyboardEvent\n if (isActivationKey(key.key)) key.preventDefault()\n offer(Message.KeyDown({ key: key.key, repeat: key.repeat }))\n },\n ],\n [\n 'keyup',\n event => {\n const key = event as KeyboardEvent\n offer(Message.KeyUp({ key: key.key, shiftKey: key.shiftKey }))\n },\n ],\n [\n 'click',\n event => {\n const click = event as MouseEvent\n offer(\n Message.Clicked({ detail: click.detail ?? 0, shiftKey: click.shiftKey ?? false }),\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\nexport interface BehaviorOptions<Input, Slots> {\n readonly target: keyof Slots & string\n /** Marks the target `aria-disabled`, which also silences its events. */\n readonly disabled?: (input: Input) => boolean\n}\n\n/**\n * Attaches the events Mount to the target slot, mapped into the placement's\n * Messages, and writes `data-pressed` while down for styling. The element\n * decides nothing; a click, a touch, Enter, Space, or an assistive\n * technology's click all reach `update` and come out as one `Pressed`.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.target]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => [\n ...(input[declared.field].pressed ? [h.DataAttribute('pressed', 'true')] : []),\n ...(options.disabled?.(input) === true ? [h.AriaDisabled(true)] : []),\n ],\n mount: () =>\n Mount.mapMessage(\n events(),\n (message): ParentMessage =>\n declared.wrapper.make(message) as unknown as ParentMessage,\n ),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'Press' },\n )\n","/**\n * LongPress: holding an element down for `thresholdMs` is one fact. It reads\n * the same facts `Press.events` reports; the threshold is a Command on\n * Effect's clock carrying a generation, so a release before it fires makes\n * its `Elapsed` a no-op. `LongPressed` is an OutMessage the placement must\n * handle. A short press is `Press`'s business, not this Bundle's.\n */\nimport { Effect, Schema } from 'effect'\nimport type { HtmlBuilder } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Mount from 'foldkit/mount'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport * as Press from './press.js'\n\nexport const Model = Schema.Struct({\n /** Down, and the threshold has not passed. */\n holding: Schema.Boolean,\n pointerId: Schema.NullOr(Schema.Number),\n key: Schema.NullOr(Schema.String),\n generation: Schema.Number,\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n PointerDown: { pointerId: Schema.Number, button: Schema.Number, pointerType: Schema.String },\n PointerUp: { pointerId: Schema.Number, pointerType: Schema.String, shiftKey: Schema.Boolean },\n PointerCancelled: { pointerId: Schema.Number },\n KeyDown: { key: Schema.String, repeat: Schema.Boolean },\n KeyUp: { key: Schema.String, shiftKey: Schema.Boolean },\n Clicked: { detail: Schema.Number, shiftKey: Schema.Boolean },\n Elapsed: { generation: Schema.Number, pointerType: Press.PointerType },\n})\nexport type Message = typeof Message.Type\n\nexport const LongPressed = Schema.TaggedStruct('LongPressed', { pointerType: Press.PointerType })\nexport type LongPressed = typeof LongPressed.Type\n\nexport const Args = Schema.Struct({\n thresholdMs: Schema.Number.pipe(\n Schema.check(Schema.isGreaterThan(0)),\n Schema.check(Schema.isFinite()),\n ),\n})\nexport type Args = typeof Args.Type\n\nconst isActivationKey = (key: string): boolean => key === 'Enter' || key === ' '\n\nconst released = (model: Model): Model => ({ ...model, holding: false, pointerId: null, key: null })\n\ntype Return = Update.ReturnWithOutMessage<Model, Message, LongPressed>\n\nconst start = (\n model: Model,\n args: Args,\n by: { readonly pointerId: number } | { readonly key: string },\n pointerType: Press.PointerType,\n): Return => {\n const generation = model.generation + 1\n return {\n model: {\n holding: true,\n pointerId: 'pointerId' in by ? by.pointerId : null,\n key: 'key' in by ? by.key : null,\n generation,\n },\n commands: [\n {\n name: 'LongPress.elapse',\n args: { generation },\n effect: Effect.as(\n Effect.sleep(args.thresholdMs),\n Message.Elapsed({ generation, pointerType }),\n ),\n },\n ],\n }\n}\n\nexport const bundle = Bundle.make('LongPress', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { holding: false, pointerId: null, key: null, generation: 0 } }),\n update: (model, message, args): Return =>\n Message.match<Return>(message, {\n PointerDown: ({ pointerId, button, pointerType }) =>\n button !== 0 || model.holding\n ? { model }\n : start(\n model,\n args,\n { pointerId },\n pointerType === 'touch' || pointerType === 'pen' ? pointerType : 'mouse',\n ),\n PointerUp: ({ pointerId }) =>\n model.pointerId === pointerId ? { model: released(model) } : { model },\n PointerCancelled: ({ pointerId }) =>\n model.pointerId === pointerId ? { model: released(model) } : { model },\n KeyDown: ({ key, repeat }) =>\n !isActivationKey(key) || repeat || model.holding\n ? { model }\n : start(model, args, { key }, 'keyboard'),\n KeyUp: ({ key }) => (model.key === key ? { model: released(model) } : { model }),\n Clicked: () => ({ model }),\n Elapsed: ({ generation, pointerType }) =>\n model.holding && model.generation === generation\n ? { model: released(model), outMessage: LongPressed.make({ pointerType }) }\n : { model },\n }),\n})\n\nexport interface BehaviorOptions<Slots> {\n readonly target: keyof Slots & string\n}\n\n/**\n * Attaches `Press.events` to the target, mapped into this placement's\n * Messages, and writes `data-holding` while the element is down. `Press` and\n * `LongPress` on one slot are refused by the resolver (two Mounts of one\n * name), so today a slot takes one of them.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.target]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => (input[declared.field].holding ? [h.DataAttribute('holding', 'true')] : []),\n mount: () =>\n Mount.mapMessage(\n Press.events(),\n // The facts are the same tagged structs; only the union differs.\n (fact): ParentMessage =>\n declared.wrapper.make(fact as unknown as Message) as unknown as ParentMessage,\n ),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'LongPress' },\n )\n","/**\n * `Move` as a Behavior: attaches the `foldkit-primitives/dom` Mount to a\n * draggable slot and maps its facts into the view's Messages. No Bundle: a\n * drag's meaning (a threshold, a snap, a reorder) is the parent's `update`,\n * and the deltas are already facts.\n */\nimport * as Mount from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { Move as MoveMount, type Fact } from '../dom/move.js'\n\nexport { Move as mount, MoveEnded, MoveStarted, Moved, type Fact } from '../dom/move.js'\n\nexport interface BehaviorOptions<Slots, ParentMessage> {\n readonly handle: keyof Slots & string\n /** Turns each fact into the view's Message. */\n readonly toMessage: (fact: Fact) => ParentMessage\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Slots, ParentMessage>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.handle]: Behavior.slot({\n requires: { capability: Capability.Draggable },\n mount: () => Mount.mapMessage(MoveMount(), options.toMessage),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'Move' },\n )\n","/**\n * One overlay policy value instead of nine subtly different overlay\n * implementations. `modal` and `nonModal` cover the two shapes; anything\n * else is an explicit `Policy`. `behaviors` turns a policy into the\n * existing pieces — `DismissLayer` marking, `FocusScope`, `ScrollLock`,\n * `HideOutside` — attached to one layer slot, with nothing reimplemented:\n * the mounts are the shared implementation, and the data attributes are the\n * stack's protocol. Positioning stays per-widget (`Anchor.behavior`\n * directly): it binds a floating element to an external id, a different\n * shape than this layer policy. Presence stays CSS (`data-open`): it needs\n * a per-overlay placement, which is the Drawer's, not the policy's.\n *\n * The `DismissLayer` stack bundle itself is placed once per app, not per\n * overlay; its `Dismiss` outmessage reaches the app through the placement's\n * `onOut`, which closes the dismissed layers. The id `behaviors` writes is\n * the layer attribute (`data-foldkit-plus-layer`), not an element id:\n * `aria-controls` has to name an element that exists.\n */\nimport type { Declared } from 'foldkit-bundle'\nimport { Behavior, type NamedBehavior } from 'foldkit-mixins'\nimport { behavior as dismissLayerBehavior, bundle as dismissLayerBundle } from './dismiss-layer.js'\nimport { behavior as focusScopeBehavior } from './focus-scope.js'\nimport { hideOutside, scrollLock } from './layers.js'\n\nexport interface DismissPolicy {\n /** Dismiss on a press outside. Default `true`. */\n readonly outside: boolean\n /** Dismiss on Escape when topmost. Default `true`. */\n readonly escape: boolean\n}\n\nexport interface FocusPolicy {\n /** Keep Tab, Shift+Tab, and stray focus inside. Default `true`. */\n readonly contain: boolean\n /** Give focus back to what had it on unmount. Default `true`. */\n readonly restore: boolean\n /** A selector inside the layer to focus first. */\n readonly initialFocus?: string\n}\n\nexport interface Policy {\n readonly dismiss: DismissPolicy\n readonly focus: FocusPolicy\n /** Lock the document's scroll while mounted. */\n readonly scroll: { readonly lock: boolean }\n /** Mark everything outside inert while mounted. */\n readonly inert: boolean\n}\n\n/** A modal overlay: dismissed by Escape and outside press, focused, locked, inert. */\nexport const modal: Policy = {\n dismiss: { outside: true, escape: true },\n focus: { contain: true, restore: true },\n scroll: { lock: true },\n inert: true,\n}\n\n/** A modeless overlay: dismissed by Escape and outside press, focus restored, page usable. */\nexport const nonModal: Policy = {\n dismiss: { outside: true, escape: true },\n focus: { contain: false, restore: true },\n scroll: { lock: false },\n inert: false,\n}\n\n/**\n * The policy as behaviors, to spread into the view's pipe alongside the\n * widget's own. Conditional pieces are included or left out when the list\n * is built — a static policy per composition — so no slot carries a mount\n * its policy never uses.\n */\nexport const behaviors =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage, StackField extends string>(options: {\n readonly stack: Declared<typeof dismissLayerBundle, StackField>\n readonly layer: keyof Slots & string\n readonly trigger?: keyof Slots & string\n readonly id: (input: Input) => string\n readonly policy: Policy\n }): ReadonlyArray<NamedBehavior<Slots, Input, ParentMessage>> => [\n dismissLayerBehavior(options.stack)(slots)<Input, ParentMessage>({\n layer: options.layer,\n ...(options.trigger === undefined ? {} : { trigger: options.trigger }),\n id: options.id,\n outsidePress: options.policy.dismiss.outside,\n escape: options.policy.dismiss.escape,\n }),\n focusScopeBehavior(slots)<Input, ParentMessage>({\n container: options.layer,\n contain: options.policy.focus.contain,\n restore: options.policy.focus.restore,\n ...(options.policy.focus.initialFocus === undefined\n ? {}\n : { initialFocus: options.policy.focus.initialFocus }),\n }),\n ...(options.policy.scroll.lock\n ? [scrollLock(slots)<Input, ParentMessage>({ container: options.layer })]\n : []),\n ...(options.policy.inert\n ? [hideOutside(slots)<Input, ParentMessage>({ container: options.layer })]\n : []),\n ]\n","/**\n * Selection over a set of items: which ids are selected, and the anchor a\n * range extends from. `mode` is `'single'` (a click replaces), `'multiple'`\n * (a click toggles), or `'none'`. Single mode keeps one item selected unless\n * `allowEmpty`. A range needs the items' order, which the view knows and the\n * Bundle does not, so `Ranged` carries it. The Behavior says the state in\n * ARIA and wires a plain click; a Shift range comes from `Press`, whose\n * `Pressed` carries `shiftKey`.\n */\nimport { Schema } from 'effect'\nimport type { HtmlBuilder } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Behaviors, Capability, type SlotItem } from 'foldkit-mixins'\nimport { perInput, sameIds } from '../internal.js'\n\nexport const Mode = Schema.Literals(['single', 'multiple', 'none'])\nexport type Mode = typeof Mode.Type\n\nexport const Model = Schema.Struct({\n /** In selection order. */\n selected: Schema.Array(Schema.String),\n /** Where the last plain selection happened; a range extends from it. */\n anchor: Schema.NullOr(Schema.String),\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** A plain activation: replaces in single mode, toggles in multiple mode. */\n Activated: { id: Schema.String },\n /** A Shift activation: selects everything between the anchor and `id` in `order`. */\n Ranged: { id: Schema.String, order: Schema.Array(Schema.String) },\n Replaced: { ids: Schema.Array(Schema.String) },\n Cleared: {},\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n mode: Mode,\n /** In single mode, whether activating the selected item deselects it. */\n allowEmpty: Schema.Boolean,\n})\nexport type Args = typeof Args.Type\n\nconst without = (ids: ReadonlyArray<string>, id: string) => ids.filter(other => other !== id)\n\n/** The ids between `from` and `to` in `order`, inclusive, in `order`'s order. */\nexport const between = (\n order: ReadonlyArray<string>,\n from: string | null,\n to: string,\n): ReadonlyArray<string> => {\n const end = order.indexOf(to)\n if (end === -1) return []\n const start = from === null ? -1 : order.indexOf(from)\n if (start === -1) return [to]\n return order.slice(Math.min(start, end), Math.max(start, end) + 1)\n}\n\nexport const bundle = Bundle.make('Selection', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { selected: [], anchor: null } }),\n update: (model, message, args) =>\n Message.match(message, {\n Activated: ({ id }) => {\n if (args.mode === 'none') return { model }\n const isSelected = model.selected.includes(id)\n if (args.mode === 'single') {\n return isSelected\n ? args.allowEmpty\n ? { model: { selected: [], anchor: id } }\n : { model }\n : { model: { selected: [id], anchor: id } }\n }\n return {\n model: {\n selected: isSelected ? without(model.selected, id) : [...model.selected, id],\n anchor: id,\n },\n }\n },\n Ranged: ({ id, order }) => {\n if (args.mode !== 'multiple') return { model }\n const range = between(order, model.anchor, id)\n const inRange = new Set(range)\n const selected = [...model.selected.filter(other => !inRange.has(other)), ...range]\n const anchor = model.anchor ?? id\n // Shift-clicking the same item twice ranges over what is selected already.\n return sameIds(selected, model.selected) && anchor === model.anchor\n ? { model }\n : { model: { selected, anchor } }\n },\n Replaced: ({ ids }) => {\n const selected = args.mode === 'none' ? [] : [...new Set(ids)]\n return sameIds(selected, model.selected)\n ? { model }\n : { model: { selected, anchor: model.anchor } }\n },\n Cleared: () =>\n model.selected.length === 0 ? { model } : { model: { selected: [], anchor: model.anchor } },\n }),\n})\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot holding the items, for `aria-multiselectable`. */\n readonly container?: keyof Slots & string\n /** The slot rendered once per item; must carry the item's id. */\n readonly item: keyof Slots & string\n readonly items: (input: Input) => Behaviors.Collection.Items<unknown>\n /** Wire a plain click on each item to `Activated`. Default `true`; turn off\n * when `Press` or the view owns the click. */\n readonly click?: boolean\n}\n\n/**\n * Writes `aria-selected` on each item from the placed slice, and\n * `aria-multiselectable` on the container in multiple mode; wires `OnClick`\n * to `Activated` unless told not to. A disabled item gets no click.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>, args: Args) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (message: Message): ParentMessage =>\n declared.wrapper.make(message) as unknown as ParentMessage\n const itemsOf = perInput(options.items)\n const selectedOf = perInput((input: Input) => new Set(input[declared.field].selected))\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n ...(options.container === undefined\n ? {}\n : {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n attributes: ({ h }: { readonly h: HtmlBuilder<ParentMessage> }) => [\n h.AriaMultiSelectable(args.mode === 'multiple'),\n ],\n }),\n }),\n [options.item]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n readonly item?: SlotItem\n }) => {\n if (item === undefined) return []\n const items = itemsOf(input)\n const id = item.id ?? items.ids[item.index]\n if (id === undefined) return []\n const clickable =\n options.click !== false && args.mode !== 'none' && !items.isDisabled(item.index)\n return [\n h.AriaSelected(selectedOf(input).has(id)),\n ...(clickable ? [h.OnClick(wrap(Message.Activated({ id })))] : []),\n ]\n },\n }),\n // Keyed by values the caller chose; `forSlots` checks the keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'Selection' },\n )\n }\n","/**\n * `Targets` as a Behavior: attaches the `foldkit-primitives/dom` Mount to a\n * container slot and maps what it reports into the view's Messages. No Bundle:\n * which descendant is under the pointer, or was pressed, is already a fact, and\n * what it means is the parent's `update`.\n */\nimport * as Mount from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { Targets as TargetsMount, type TargetFact } from '../dom/targets.js'\n\nexport {\n TargetHovered,\n TargetPressed,\n Targets as mount,\n targetOf,\n type TargetFact,\n} from '../dom/targets.js'\n\nexport interface BehaviorOptions<Slots, ParentMessage> {\n /** The slot holding the marked descendants. */\n readonly container: keyof Slots & string\n /** The attribute that marks a descendant, holding its id. */\n readonly attribute: string\n /** Prevent a press's default, such as a link navigating. Default `false`. */\n readonly preventDefault?: boolean\n /** Turns each fact into the view's Message. */\n readonly toMessage: (fact: TargetFact) => ParentMessage\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Slots, ParentMessage>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: () =>\n Mount.mapMessage(\n TargetsMount({\n attribute: options.attribute,\n preventDefault: options.preventDefault ?? false,\n }),\n options.toMessage,\n ),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'Targets' },\n )\n","/**\n * `PointerDrag` as a Behavior: attaches the `foldkit-primitives/dom` Mount to\n * a container slot and maps what it reports into the view's Messages. No\n * Bundle: what is dragged and where the pointer is are facts, and what a drop\n * means, and whether it is allowed, is the parent's `update`.\n */\nimport * as Mount from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { PointerDrag as PointerDragMount, type DragFact } from '../dom/pointer-drag.js'\n\nexport {\n DRAG_THRESHOLD,\n DragCancelled,\n DragDropped,\n DragPlace,\n DragStarted,\n DragZone,\n DraggedOver,\n PointerDrag as mount,\n boxOf,\n zoneOf,\n type DragFact,\n} from '../dom/pointer-drag.js'\n\nexport interface BehaviorOptions<Slots, ParentMessage> {\n /** The slot holding the marked descendants. */\n readonly container: keyof Slots & string\n /** The attribute that marks a descendant, holding its id. */\n readonly attribute: string\n /**\n * Where a drag may land when not among the container's own: elements marked\n * by `attribute` inside the one `within` selects, such as a page for a palette.\n */\n readonly targets?: { readonly attribute: string; readonly within: string }\n /** An attribute naming a part of what a drop lands on, which the place then carries. */\n readonly part?: string\n /** Turns each fact into the view's Message. */\n readonly toMessage: (fact: DragFact) => ParentMessage\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Slots, ParentMessage>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: () =>\n Mount.mapMessage(\n PointerDragMount({\n attribute: options.attribute,\n ...(options.targets === undefined ? {} : { targets: options.targets }),\n ...(options.part === undefined ? {} : { part: options.part }),\n }),\n options.toMessage,\n ),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'PointerDrag' },\n )\n","/**\n * Keeps a floating panel inside the viewport: on insert it shifts left past\n * the right edge and flips above its trigger when the bottom overflows and\n * the room overhead fits; on release every inline prop goes. `placeFor` is\n * pure geometry over rects, so the rule is unit-tested and the Mount only\n * reads and writes. Inert without layout (zero rects never overflow), with\n * no timers, observers, or reposition loops.\n *\n * `placeAt` is the other half, for a popup that must open under the trigger\n * that opened it. It writes `left` and `--fk-placed-top` once, relative to\n * the popup's offset parent; the panel's stylesheet reads the variable as\n * `top`, so `keepWithin` can still replace `top` when it flips. Key the\n * popup by the trigger: a Mount reads its args at insert and never again.\n * `placeAtPoint` is the same write for a viewport point, when the open\n * event carried coordinates the message builder dropped. The two mounts\n * start together, so the fit may run before that write; the write measures\n * again. A point that would hang past the bottom shifts up. A trigger still\n * flips, and the panel is marked `data-fk-placed=\"above\"` so a hover bridge\n * can follow the side that opened.\n * Zero-size rects stay at the origin, so an inert document writes nothing\n * a layout pass would have to undo.\n *\n * Three related pieces this is not:\n *\n * - `Anchor.behavior` (`foldkit-mixins-ui`) binds a floating element to\n * another element's id through floating-ui, with portals and continuous\n * repositioning. It relocates nodes out from under the runtime (portal by\n * default) and burns under zero geometry; reach for it when the panel must\n * track a moving anchor, not for a popup placed once.\n * - `KeepInView` (`foldkit-primitives/dom`) scrolls newly marked content\n * into view. Same verb, opposite direction: that one moves the page to\n * the panel, this one moves the panel into the page.\n * - `Overlay.behaviors` owns dismissal, focus, scroll lock, and inertness,\n * but no positioning; spread this alongside it for the full overlay.\n */\nimport { Effect, Option, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\n\nexport interface PanelRect {\n readonly top: number\n readonly right: number\n readonly bottom: number\n readonly height: number\n}\n\nexport interface Viewport {\n readonly width: number\n readonly height: number\n}\n\nexport interface Placed {\n /** Pixels to move left; `0` when the panel fits. */\n readonly dx: number\n /** Whether the panel stands above its trigger instead of below. */\n readonly flip: boolean\n}\n\n/** Where the panel goes so it fits: left by the overflow, above when the\n * bottom clears the window and the room overhead fits the panel. */\nexport const placeFor = (rect: PanelRect, viewport: Viewport, margin = 8): Placed => {\n const over = rect.right - viewport.width + margin\n return {\n dx: over > 0 ? -over : 0,\n flip: rect.bottom > viewport.height && rect.top - margin >= rect.height,\n }\n}\n\n/** Pixels to move a box up so its bottom sits `margin` inside the viewport.\n * `0` when it already fits, or when its top is already at the margin. */\nexport const shiftIntoViewport = (\n rect: { readonly top: number; readonly bottom: number },\n viewportHeight: number,\n margin = 8,\n): number => {\n const overflow = rect.bottom - (viewportHeight - margin)\n if (overflow <= 0) return 0\n const room = rect.top - margin\n if (room <= 0) return 0\n return Math.min(overflow, room)\n}\n\n/** Attribute `keepWithin` sets to `placedAbove` when the panel flips. */\nexport const placedSide = 'data-fk-placed'\n\n/** Value of `placedSide` while the panel stands above its anchor. */\nexport const placedAbove = 'above'\n\nexport interface AnchorRect {\n readonly left: number\n readonly top: number\n readonly bottom: number\n readonly width: number\n readonly height: number\n}\n\nexport interface OriginRect {\n readonly left: number\n readonly top: number\n}\n\nexport interface PlacedAt {\n readonly left: number\n readonly top: number\n}\n\n/** Custom property `PlaceAt` writes. A panel reads it as `top` so a viewport\n * flip, which sets the `top` property, still wins. */\nexport const placedTop = '--fk-placed-top'\n\n/** Where a popup sits under its trigger's left edge, in the offset parent's\n * coordinates. A zero-size trigger (an inert document) stays at the origin. */\nexport const placeAt = (trigger: AnchorRect, origin: OriginRect, gap = 4): PlacedAt => {\n if (trigger.width === 0 && trigger.height === 0) return { left: 0, top: 0 }\n return {\n left: trigger.left - origin.left,\n top: trigger.bottom - origin.top + gap,\n }\n}\n\nexport interface ViewportPoint {\n readonly x: number\n readonly y: number\n}\n\n/** Where a popup's top-left sits on a viewport point, in the offset parent's\n * coordinates. A context menu uses it: the right-click event carries the\n * point, and `OnContextMenu` does not. */\nexport const placeAtPoint = (point: ViewportPoint, origin: OriginRect): PlacedAt => ({\n left: point.x - origin.left,\n top: point.y - origin.top,\n})\n\nconst clearFit = (element: HTMLElement): void => {\n element.style.translate = ''\n element.style.top = ''\n element.style.bottom = ''\n element.removeAttribute(placedSide)\n}\n\nconst fitWithin = (element: HTMLElement): void => {\n // A previous fit may have flipped. Clear it before reading, or the next\n // decision would describe the flipped box.\n clearFit(element)\n const rect = element.getBoundingClientRect()\n const placed = placeFor(\n { top: rect.top, right: rect.right, bottom: rect.bottom, height: rect.height },\n { width: document.documentElement.clientWidth, height: window.innerHeight },\n )\n if (placed.dx !== 0) element.style.translate = `${placed.dx}px 0`\n if (placed.flip) {\n element.style.top = 'auto'\n element.style.bottom = 'calc(100% + 4px)'\n element.setAttribute(placedSide, placedAbove)\n }\n}\n\n// PlaceAt and KeepWithin start together (`Stream.mergeAll`), so the fit can\n// run before the placement write. The write calls whoever is waiting.\nconst refits = new WeakMap<HTMLElement, Set<() => void>>()\n\nconst onPlaced = (element: HTMLElement, refit: () => void): void => {\n const waiting = refits.get(element) ?? new Set()\n waiting.add(refit)\n refits.set(element, waiting)\n}\n\nconst offPlaced = (element: HTMLElement, refit: () => void): void => {\n const waiting = refits.get(element)\n if (waiting === undefined) return\n waiting.delete(refit)\n if (waiting.size === 0) refits.delete(element)\n}\n\nconst notifyPlaced = (element: HTMLElement): void => {\n const waiting = refits.get(element)\n if (waiting === undefined) return\n for (const refit of waiting) refit()\n}\n\nconst applyPlaced = (element: HTMLElement, placed: PlacedAt): void => {\n element.style.left = `${placed.left}px`\n element.style.setProperty(placedTop, `${placed.top}px`)\n}\n\nconst clearPlaced = (element: HTMLElement): void => {\n element.style.left = ''\n element.style.removeProperty(placedTop)\n}\n\nconst writePlaced = (element: HTMLElement, placed: PlacedAt, shift: boolean): void => {\n clearFit(element)\n applyPlaced(element, placed)\n if (shift) {\n const rect = element.getBoundingClientRect()\n const dy = shiftIntoViewport({ top: rect.top, bottom: rect.bottom }, window.innerHeight)\n if (dy !== 0) element.style.setProperty(placedTop, `${placed.top - dy}px`)\n }\n notifyPlaced(element)\n}\n\nexport const KeepWithin = Mount.defineStream('KeepWithin', {\n messages: [Schema.Never],\n execute: ({ element }) =>\n Stream.callback<never>(() => {\n if (!(element instanceof HTMLElement)) {\n return Effect.acquireRelease(Effect.void, () => Effect.void)\n }\n const node = element\n const refit = (): void => fitWithin(node)\n return Effect.acquireRelease(\n Effect.sync(() => {\n onPlaced(node, refit)\n refit()\n }),\n () =>\n Effect.sync(() => {\n offPlaced(node, refit)\n clearFit(node)\n }),\n )\n }),\n})\n\nconst paddingEdge = (node: HTMLElement): OriginRect => {\n const rect = node.getBoundingClientRect()\n // Absolute `left`/`top` start at the padding edge; the rect is the border box.\n return { left: rect.left + node.clientLeft, top: rect.top + node.clientTop }\n}\n\nconst originOf = (element: HTMLElement): OriginRect => {\n const originNode = element.offsetParent\n return originNode instanceof HTMLElement ? paddingEdge(originNode) : { left: 0, top: 0 }\n}\n\nexport const PlaceAt = Mount.defineStream('PlaceAt', {\n messages: [Schema.Never],\n args: {\n /** Element id of the trigger the popup opens under. */\n triggerId: Schema.String,\n /** Pixels between the trigger's bottom and the popup. */\n gap: Schema.Number,\n },\n execute: ({ element, triggerId, gap }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n Effect.sync(() => {\n if (!(element instanceof HTMLElement)) return\n const trigger = document.getElementById(triggerId)\n if (!(trigger instanceof HTMLElement)) return\n const rect = trigger.getBoundingClientRect()\n writePlaced(\n element,\n placeAt(\n {\n left: rect.left,\n top: rect.top,\n bottom: rect.bottom,\n width: rect.width,\n height: rect.height,\n },\n originOf(element),\n gap,\n ),\n false,\n )\n }),\n () =>\n Effect.sync(() => {\n if (!(element instanceof HTMLElement)) return\n clearPlaced(element)\n }),\n ),\n ),\n})\n\nexport const PlaceAtPoint = Mount.defineStream('PlaceAtPoint', {\n messages: [Schema.Never],\n args: {\n /** Viewport x of the popup's top-left. */\n x: Schema.Number,\n /** Viewport y of the popup's top-left. */\n y: Schema.Number,\n },\n execute: ({ element, x, y }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n Effect.sync(() => {\n if (!(element instanceof HTMLElement)) return\n // The offset parent is not the point. Shifting keeps the menu beside\n // it; flipping would send the menu above that parent.\n writePlaced(element, placeAtPoint({ x, y }, originOf(element)), true)\n }),\n () =>\n Effect.sync(() => {\n if (!(element instanceof HTMLElement)) return\n clearPlaced(element)\n }),\n ),\n ),\n})\n\nexport const placeAtTrigger =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(options: {\n readonly panel: keyof Slots & string\n /** The trigger this open belongs to. Read at insert, so key the panel by it. */\n readonly triggerId: (input: Input) => string\n readonly gap?: number\n /** A viewport point wins over the trigger. None places under `triggerId`. */\n readonly at?: (input: Input) => Option.Option<ViewportPoint>\n }): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.panel]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: input => {\n const at = options.at?.(input) ?? Option.none()\n return Option.isSome(at)\n ? PlaceAtPoint({ x: at.value.x, y: at.value.y })\n : PlaceAt({ triggerId: options.triggerId(input), gap: options.gap ?? 4 })\n },\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'PlaceAt' },\n )\n\nexport const keepWithin =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(options: {\n readonly panel: keyof Slots & string\n }): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.panel]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: () => KeepWithin(),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'KeepWithin' },\n )\n","/**\n * Keyboard navigation of a tree (a file explorer, a page's layers, a nested\n * menu), after the WAI-ARIA tree pattern: one tab stop, Up and Down through the\n * rows that are showing, Right to open a row or step into it, Left to close it\n * or step out to its parent, Home and End to the first and last row.\n *\n * The Model slice is the current row's id and which rows are open. Openness is\n * stored as the rows `toggled` away from a default, so a layers panel that\n * starts with everything open and a file tree that starts closed are the same\n * bundle with a different `openByDefault`, and neither stores every row.\n *\n * Which rows exist is the view's to say, each with its parent, in tree order.\n * What a key does is a pure function of those rows and the Model; the Behavior\n * wires it to the slots and writes the tree's ARIA attributes.\n */\nimport { Option, Schema } from 'effect'\nimport type { HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport { Bundle } from 'foldkit-bundle'\nimport type { Declared } from 'foldkit-bundle'\nimport { Behavior, Capability, type SlotItem } from 'foldkit-mixins'\nimport { FollowTabStop } from '../dom/follow-tab-stop.js'\nimport { idSelector } from './roving-tabindex.js'\nimport { perInput } from '../internal.js'\n\nexport const Model = Schema.Struct({\n /** The current row's id, or `null` before any row has been focused. */\n current: Schema.NullOr(Schema.String),\n /** The rows whose open state differs from `openByDefault`. */\n toggled: Schema.Array(Schema.String),\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** A row became current: the user focused it, or a key moved there. */\n Focused: { id: Schema.String },\n Opened: { id: Schema.String },\n Closed: { id: Schema.String },\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n /** Whether a row with children starts open. */\n openByDefault: Schema.Boolean,\n})\nexport type Args = typeof Args.Type\n\n/** Whether a row is open, given the default and what was toggled. */\nexport const isOpen = (model: Model, args: Args, id: string): boolean =>\n args.openByDefault !== model.toggled.includes(id)\n\nconst setOpen = (model: Model, args: Args, id: string, open: boolean): Model =>\n isOpen(model, args, id) === open\n ? model\n : {\n ...model,\n toggled: model.toggled.includes(id)\n ? model.toggled.filter(toggled => toggled !== id)\n : [...model.toggled, id],\n }\n\nexport const bundle = Bundle.make('TreeNavigation', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { current: null, toggled: [] } }),\n update: (model, message, args) => {\n switch (message._tag) {\n // Moving focus by key dispatches `Focused`, and the row's `OnFocus` reports it again.\n case 'Focused':\n return model.current === message.id\n ? { model }\n : { model: { ...model, current: message.id } }\n case 'Opened':\n return { model: setOpen(model, args, message.id, true) }\n case 'Closed':\n return { model: setOpen(model, args, message.id, false) }\n }\n },\n})\n\n/** One row of the tree, in tree order: a parent comes before its children. */\nexport interface Row {\n readonly id: string\n /** The parent's id, or `null` for a top-level row. */\n readonly parent: string | null\n /** Whether it has children, so it can be opened and closed. */\n readonly branch: boolean\n readonly disabled?: boolean\n}\n\n/** A row as it is showing: where it sits, for its ARIA attributes. */\nexport interface Shown extends Row {\n /** 1 for a top-level row. */\n readonly level: number\n /** Its place among its siblings, from 1, and how many there are. */\n readonly position: number\n readonly siblings: number\n}\n\n/**\n * The rows that are showing: every row whose ancestors are all open, with its\n * level and its place among its siblings. A row whose parent is not a row is\n * treated as top-level.\n */\nexport const shown = (rows: ReadonlyArray<Row>, model: Model, args: Args): ReadonlyArray<Shown> => {\n const byId = new Map(rows.map(row => [row.id, row]))\n // Each row's place among its siblings, counted once: a page of a thousand rows\n // under one parent is not a million steps.\n const siblingsOf = new Map<string | null, number>()\n const positionOf = new Map<string, number>()\n for (const row of rows) {\n const parent = row.parent !== null && byId.has(row.parent) ? row.parent : null\n const count = (siblingsOf.get(parent) ?? 0) + 1\n siblingsOf.set(parent, count)\n positionOf.set(row.id, count)\n }\n const levels = new Map<string, number>()\n const showing = new Map<string, boolean>()\n const result: Array<Shown> = []\n for (const row of rows) {\n const parent = row.parent !== null && byId.has(row.parent) ? row.parent : null\n const level = parent === null ? 1 : (levels.get(parent) ?? 0) + 1\n levels.set(row.id, level)\n const visible = parent === null || (showing.get(parent) === true && isOpen(model, args, parent))\n showing.set(row.id, visible)\n if (!visible) continue\n result.push({\n ...row,\n level,\n position: positionOf.get(row.id) ?? 1,\n siblings: siblingsOf.get(parent) ?? 1,\n })\n }\n return result\n}\n\n/** What a key does: move to a row, or open or close one. */\nexport type Action =\n | { readonly _tag: 'Focus'; readonly id: string }\n | { readonly _tag: 'Open'; readonly id: string }\n | { readonly _tag: 'Close'; readonly id: string }\n\nconst isPlain = (modifiers: KeyboardModifiers): boolean =>\n !modifiers.ctrlKey && !modifiers.altKey && !modifiers.metaKey\n\n/**\n * What a key does from the current row, over the rows that are showing, or\n * `undefined` when it is not a key the tree handles. Disabled rows are stepped\n * over. With nothing current, Down and Home land on the first row, Up and End\n * on the last. Right and Left swap under `rtl`.\n */\nexport const move = (\n rows: ReadonlyArray<Shown>,\n current: string | null,\n key: string,\n modifiers: KeyboardModifiers,\n model: Model,\n args: Args,\n direction: 'ltr' | 'rtl' = 'ltr',\n): Action | undefined => {\n const enabled = rows.filter(row => row.disabled !== true)\n if (enabled.length === 0 || !isPlain(modifiers)) return undefined\n const focus = (row: Row | undefined): Action | undefined =>\n row === undefined ? undefined : { _tag: 'Focus', id: row.id }\n const at = enabled.findIndex(row => row.id === current)\n const inward = direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight'\n const outward = direction === 'rtl' ? 'ArrowRight' : 'ArrowLeft'\n if (key === 'Home') return focus(enabled[0])\n if (key === 'End') return focus(enabled[enabled.length - 1])\n if (key === 'ArrowDown')\n return focus(at === -1 ? enabled[0] : enabled[Math.min(at + 1, enabled.length - 1)])\n if (key === 'ArrowUp')\n return focus(at === -1 ? enabled[enabled.length - 1] : enabled[Math.max(at - 1, 0)])\n const row = enabled[at]\n if (row === undefined) return key === inward || key === outward ? focus(enabled[0]) : undefined\n if (key === inward) {\n if (!row.branch) return undefined\n if (!isOpen(model, args, row.id)) return { _tag: 'Open', id: row.id }\n return focus(enabled.find(child => child.parent === row.id))\n }\n if (key === outward) {\n if (row.branch && isOpen(model, args, row.id)) return { _tag: 'Close', id: row.id }\n return focus(enabled.find(parent => parent.id === row.parent))\n }\n return undefined\n}\n\n/** The row that holds the tab stop: the current one while it is showing, else the first. */\nexport const tabStop = (rows: ReadonlyArray<Shown>, current: string | null): string | undefined => {\n const here = rows.find(row => row.id === current && row.disabled !== true)\n return (here ?? rows.find(row => row.disabled !== true))?.id\n}\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot that receives the keys: the element with `role=\"tree\"`. */\n readonly container: keyof Slots & string\n /** The slot rendered once per showing row, with `item.id` or `item.index` into `shown`. */\n readonly item: keyof Slots & string\n /** Every row, open or not, in tree order. */\n readonly rows: (input: Input) => ReadonlyArray<Row>\n /** The DOM id a row's element carries. Default: the row's own id. */\n readonly domId?: (id: string) => string\n readonly direction?: (input: Input) => 'ltr' | 'rtl'\n}\n\n/** The rows showing for one input, with what each row's attributes look up. */\ninterface Prepared {\n readonly model: Model\n readonly rows: ReadonlyArray<Shown>\n readonly byId: ReadonlyMap<string, Shown>\n readonly stop: string | undefined\n}\n\n/**\n * Wires a placed `TreeNavigation` to the slots. The container's keys move focus\n * to the row they pick, or open or close the current row with focus left where\n * it is. Each showing row gets its id, `role=\"treeitem\"`, `aria-level` (and\n * the same level as `--fk-tree-level`, so one `calc` indents any depth),\n * `aria-posinset`, `aria-setsize`, `aria-expanded` when it has children,\n * `aria-disabled` when disabled, a roving `tabindex`, and `OnFocus` reporting\n * it current. Every handled key is default-prevented.\n */\n\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>, args: Args) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (message: Message): ParentMessage =>\n declared.wrapper.make(message) as unknown as ParentMessage\n const slice = (input: Input): Model => input[declared.field]\n const domId = options.domId ?? ((id: string) => id)\n // Every row's attributes read the same rows: work them out once per input,\n // or a tree of n rows costs n times its whole.\n const prepare = perInput((input: Input): Prepared => {\n const model = slice(input)\n const rows = shown(options.rows(input), model, args)\n return {\n model,\n rows,\n byId: new Map(rows.map(row => [row.id, row])),\n stop: tabStop(rows, model.current),\n }\n })\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n // Focus in the tree stays on its stop when an edit elsewhere moves or removes it.\n mount: () => FollowTabStop(),\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => {\n const { model, rows } = prepare(input)\n const direction = options.direction?.(input) ?? 'ltr'\n return [\n h.OnKeyDownFocus((key, modifiers) => {\n const action = move(rows, model.current, key, modifiers, model, args, direction)\n if (action === undefined) return Option.none()\n // Opening or closing keeps focus on the row it acted on.\n const message =\n action._tag === 'Focus'\n ? Message.Focused({ id: action.id })\n : action._tag === 'Open'\n ? Message.Opened({ id: action.id })\n : Message.Closed({ id: action.id })\n return Option.some({\n focusSelector: idSelector(domId(action.id)),\n message: wrap(message),\n })\n }),\n ]\n },\n }),\n [options.item]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n readonly item?: SlotItem\n }) => {\n if (item === undefined) return []\n const { model, rows, byId, stop } = prepare(input)\n const row = item.id === undefined ? rows[item.index] : byId.get(item.id)\n if (row === undefined) return []\n return [\n h.Id(domId(row.id)),\n h.Role('treeitem'),\n h.AriaLevel(row.level),\n h.Style({ '--fk-tree-level': String(row.level) }),\n h.AriaPosinset(row.position),\n h.AriaSetsize(row.siblings),\n ...(row.branch ? [h.AriaExpanded(isOpen(model, args, row.id))] : []),\n ...(row.disabled === true ? [h.AriaDisabled(true)] : []),\n h.Tabindex(stop === row.id ? 0 : -1),\n h.OnFocus(wrap(Message.Focused({ id: row.id }))),\n ]\n },\n }),\n // Keyed by values the caller chose; `forSlots` checks both keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'TreeNavigation' },\n )\n }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,MAAa,kBAAkB;AAC/B,MAAa,oBAAoB;AACjC,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;;AAGzB,MAAaA,UAAQ,OAAO,OAAO;CACjC,IAAI,OAAO;;CAEX,SAAS,OAAO;;CAEhB,QAAQ,OAAO;AACjB,CAAC;AAGD,MAAaC,UAAQ,OAAO,OAAO;;AAEjC,QAAQ,OAAO,MAAMD,OAAK,EAC5B,CAAC;AAGD,MAAaE,YAAU,mBAAmB;;CAExC,WAAW;EAAE,QAAQ,OAAO,MAAMF,OAAK;EAAG,QAAQ,OAAO,MAAM,OAAO,MAAM;CAAE;CAC9E,eAAe,EAAE,QAAQ,OAAO,MAAMA,OAAK,EAAE;AAC/C,CAAC;AAGD,MAAa,UAAU,OAAO,aAAa,WAAW,EAAE,KAAK,OAAO,MAAM,OAAO,MAAM,EAAE,CAAC;;AAI1F,MAAa,aACX,QACA,WAC0B;CAC1B,IAAI,aAAa;CACjB,OAAO,SAAS,OAAO,UAAU;EAC/B,IAAI,OAAO,SAAS,M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KAClB,EAAE,KAAK,UAAU;KACjB,EAAE,UAAU,IAAI,KAAK;KACrB,EAAE,MAAM,EAAE,mBAAmB,OAAO,IAAI,KAAK,EAAE,CAAC;KAChD,EAAE,aAAa,IAAI,QAAQ;KAC3B,EAAE,YAAY,IAAI,QAAQ;KAC1B,GAAI,IAAI,SAAS,CAAC,EAAE,aAAa,OAAO,OAAO,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;KAClE,GAAI,IAAI,aAAa,OAAO,CAAC,EAAE,aAAa,IAAI,CAAC,IAAI,CAAC;KACtD,EAAE,SAAS,SAAS,IAAI,KAAK,IAAI,EAAE;KACnC,EAAE,QAAQ,KAAK,QAAQ,QAAQ,EAAE,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;IACjD;GACF;EACF,CAAC;CAEH,GACA,EAAE,MAAM,iBAAiB,CAC3B;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Layer","Model","Message","bundle","behavior","behavior","EditableTextMount","behavior","FocusScopeMount","behavior","Model","Message","Args","bundle","isPlain","move","tabStop","behavior","Model","Message","Args","bundle","move","behavior","RovingTabindex.tabStop","RovingTabindex.idSelector","RovingTabindex.itemAttributes","ScrollLockMount","HideOutsideMount","Model","Message","Args","bundle","Model","Message","Args","bundle","behavior","Model","Message","Args","RovingTabindex.Orientation","bundle","RovingTabindex.move","Typeahead.isPrintable","Typeahead.match","behavior","RovingTabindex.tabStop","RovingTabindex.idSelector","RovingTabindex.itemAttributes","Model","Message","Args","isActivationKey","bundle","behavior","Model","Message","Press.PointerType","Args","bundle","behavior","Press.events","behavior","MoveMount","dismissLayerBehavior","focusScopeBehavior","Model","Message","Args","bundle","behavior","behavior","TargetsMount","behavior","PointerDragMount"],"sources":["../../src/interaction/bundle-behavior.ts","../../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/typeahead.ts","../../src/interaction/list-navigation.ts","../../src/interaction/press.ts","../../src/interaction/long-press.ts","../../src/interaction/move.ts","../../src/interaction/overlay.ts","../../src/interaction/selection.ts","../../src/interaction/targets.ts","../../src/interaction/pointer-drag.ts","../../src/interaction/placing.ts","../../src/interaction/tree-navigation.ts"],"sourcesContent":["/**\n * The mixin half of a Bundle: a Behavior whose slots are wired to the\n * Bundle's Messages through its `Declared` placement.\n *\n * The Bundle owns the Model, its Message union and the transition; a parent\n * declares and places it (`Bundle.declare(...).at(...)`); this Behavior writes\n * the element's attributes from the placed slice and mounts the Bundle's\n * events, wrapping each Message with the placement's `wrapper` into the\n * parent's universe. A Behavior still owns no state, and a Message still has\n * one update: this is a bridge, not a second runtime.\n *\n * `attributes` receives `send`, the same wrap, for a handler it writes itself\n * (`h.OnClick(send(Message.Activated({ id })))`). `events` receives the\n * Bundle's own Mount (a `Mount.defineStream`), and the helper supplies the\n * mapping, so a caller never repeats `Mount.mapMessage(events, wrapper.make)`.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport type { MountAction } from 'foldkit/mount'\nimport * as Mount from 'foldkit/mount'\nimport type { Bundle, Declared } from 'foldkit-bundle'\nimport {\n Behavior,\n type BehaviorSlotOptions,\n type NamedBehavior,\n type SlotAttributes,\n type SlotItem,\n type SlotRequirements,\n} from 'foldkit-mixins'\n\n// `any` for the bundle and the field so a behavior's own generic `Field`\n// (`Declared<typeof bundle, Field>`) is accepted; the parts stay inferred.\ntype BundleOf<D extends Declared<any, any>> = D extends Declared<infer B, any> ? B : never\n\n/** The Bundle's Model, which the parent's `Input` must hold at `declared.field`. */\nexport type BundleModelOf<D extends Declared<any, any>> = Bundle.BundleParts<BundleOf<D>>['Model']\n\n/** The Bundle's Message, which `send` wraps for the parent. */\nexport type BundleMessageOf<D extends Declared<any, any>> = Bundle.BundleParts<\n BundleOf<D>\n>['Message']\n\nexport interface BundleSlotOptions<D extends Declared<any, any>, Input, ParentMessage> {\n readonly requires?: SlotRequirements\n readonly attributes?: (context: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n readonly item?: SlotItem\n /** The Bundle's Message as the parent's: what a handler the Behavior writes takes. */\n readonly send: (message: BundleMessageOf<D>) => ParentMessage\n }) => SlotAttributes<ParentMessage>\n /** The Bundle's events, mounted on this slot and wrapped for the parent. */\n readonly events?: MountAction<BundleMessageOf<D>, any>\n}\n\nexport type BundleBehaviorSpec<D extends Declared<any, any>, Input, ParentMessage> = Readonly<\n Record<string, BundleSlotOptions<D, Input, ParentMessage>>\n>\n\n/**\n * `fromBundle(declared)(slots)<Input, ParentMessage>(spec)` — a Behavior over\n * `declared`, with every `events` mount and every `send` mapped through the\n * placement's wrapper. `Input` must hold the Bundle's Model at the declared\n * field, so attributes read the placed slice; the parent's `Message` includes\n * the declared wrapper cases, so nothing can be sent outside it.\n */\nexport const fromBundle =\n <D extends Declared<any, any>>(declared: D) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in D['field']]: BundleModelOf<D> }, ParentMessage>(\n spec: BundleBehaviorSpec<D, Input, ParentMessage>,\n options?: { readonly name?: string },\n ): NamedBehavior<Slots, Input, ParentMessage> => {\n const send = (message: BundleMessageOf<D>): ParentMessage =>\n declared.wrapper.make(message) as unknown as ParentMessage\n const built: Record<string, BehaviorSlotOptions<Input, ParentMessage>> = Object.create(null)\n for (const [name, slot] of Object.entries(\n spec as Record<string, BundleSlotOptions<D, Input, ParentMessage> | undefined>,\n )) {\n if (slot === undefined) continue\n const { requires, attributes, events } = slot\n if (requires === undefined && attributes === undefined && events === undefined) continue\n built[name] = {\n ...(requires === undefined ? {} : { requires }),\n ...(attributes === undefined\n ? {}\n : {\n attributes: context =>\n attributes({\n input: context.input as Input,\n h: context.h,\n ...(context.item === undefined ? {} : { item: context.item }),\n send,\n }),\n }),\n ...(events === undefined ? {} : { mount: () => Mount.mapMessage(events, send) }),\n }\n }\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n // Built slot by slot from the same contract `forSlots` validates.\n built as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n options,\n )\n }\n\nexport const BundleBehavior = { fromBundle } as const\n","/**\n * Dismissable layers: Escape closes the topmost open layer, a pointer press\n * outside closes the layers it is outside of. One Bundle, placed once, owns\n * the document listeners; each layer's Behavior marks its container (and its\n * trigger) with data attributes. The stack is the DOM order of the marked\n * elements at the moment of the event, so a layer opening or closing needs no\n * registration. A press inside a parent layer is outside its children, so the\n * parent stays and the children go; a press on a layer's trigger counts as\n * inside it, so a trigger never dismisses and reopens in one click. What a\n * dismissal does is the placement's `onOut`.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport type { HtmlBuilder } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Subscription from 'foldkit/subscription'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Capability } from 'foldkit-mixins'\n\nexport const LAYER_ATTRIBUTE = 'data-foldkit-plus-layer'\nexport const TRIGGER_ATTRIBUTE = 'data-foldkit-plus-layer-trigger'\nconst OUTSIDE_ATTRIBUTE = 'data-foldkit-plus-layer-outside'\nconst ESCAPE_ATTRIBUTE = 'data-foldkit-plus-layer-escape'\n\n/** An open layer as the document showed it: bottom to top is DOM order. */\nexport const Layer = Schema.Struct({\n id: Schema.String,\n /** Dismiss on a press outside it. */\n outside: Schema.Boolean,\n /** Dismiss on Escape when topmost. */\n escape: Schema.Boolean,\n})\nexport type Layer = typeof Layer.Type\n\nexport const Model = Schema.Struct({\n /** The open layers at the last event, bottom to top. */\n layers: Schema.Array(Layer),\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** A pointer went down; `inside` are the layers whose element or trigger was on the event's path. */\n PressedAt: { layers: Schema.Array(Layer), inside: Schema.Array(Schema.String) },\n PressedEscape: { layers: Schema.Array(Layer) },\n})\nexport type Message = typeof Message.Type\n\nexport const Dismiss = Schema.TaggedStruct('Dismiss', { ids: Schema.Array(Schema.String) })\nexport type Dismiss = typeof Dismiss.Type\n\n/** Which layers a press inside `inside` dismisses: every layer above the topmost one hit, or all when none was. */\nexport const toDismiss = (\n layers: ReadonlyArray<Layer>,\n inside: ReadonlyArray<string>,\n): ReadonlyArray<string> => {\n let topmostHit = -1\n layers.forEach((layer, index) => {\n if (inside.includes(layer.id)) topmostHit = index\n })\n return layers\n .slice(topmostHit + 1)\n .filter(layer => layer.outside)\n .map(layer => layer.id)\n}\n\ntype Return = Update.ReturnWithOutMessage<Model, Message, Dismiss>\n\nconst sameLayers = (a: ReadonlyArray<Layer>, b: ReadonlyArray<Layer>): boolean =>\n a.length === b.length &&\n a.every(\n (layer, index) =>\n layer.id === b[index]!.id &&\n layer.outside === b[index]!.outside &&\n layer.escape === b[index]!.escape,\n )\n\nexport const bundle = Bundle.make('DismissLayer', {\n Model,\n Message,\n init: () => ({ model: { layers: [] } }),\n update: (model, message): Return => {\n // Every press in the document reports the layers, which are usually the\n // ones already held: keep the Model, or each click re-renders the page.\n const next = sameLayers(model.layers, message.layers) ? model : { layers: message.layers }\n return Message.match<Return>(message, {\n PressedAt: ({ layers, inside }) => {\n const ids = toDismiss(layers, inside)\n return ids.length === 0\n ? { model: next }\n : { model: next, outMessage: Dismiss.make({ ids }) }\n },\n PressedEscape: ({ layers }) => {\n const top = layers[layers.length - 1]\n return top !== undefined && top.escape\n ? { model: next, outMessage: Dismiss.make({ ids: [top.id] }) }\n : { model: next }\n },\n })\n },\n subscriptions: () =>\n Subscription.make<Model, Message>()(() => ({\n document: Subscription.persistentEntry(documentEvents()),\n })),\n})\n\nconst openLayers = (root: ParentNode): ReadonlyArray<Layer> =>\n Array.from(root.querySelectorAll(`[${LAYER_ATTRIBUTE}]`)).map(element => ({\n id: element.getAttribute(LAYER_ATTRIBUTE) ?? '',\n outside: element.getAttribute(OUTSIDE_ATTRIBUTE) !== 'false',\n escape: element.getAttribute(ESCAPE_ATTRIBUTE) !== 'false',\n }))\n\n/** The layer ids whose element or trigger is on the event's composed path. */\nexport const layersOnPath = (path: ReadonlyArray<EventTarget>): ReadonlyArray<string> => {\n const ids: Array<string> = []\n for (const target of path) {\n if (!(target instanceof Element)) continue\n const id = target.getAttribute(LAYER_ATTRIBUTE) ?? target.getAttribute(TRIGGER_ATTRIBUTE)\n if (id !== null && !ids.includes(id)) ids.push(id)\n }\n return ids\n}\n\n/**\n * The facts are read inside the listener, not after: `composedPath()` is\n * empty once dispatch has finished, and the open layers must be the ones the\n * press saw, not the ones a later render left.\n */\nconst documentEvents = (): Stream.Stream<Message> => {\n if (typeof document === 'undefined') return Stream.empty\n return Stream.callback<Message>(queue =>\n Effect.acquireRelease(\n Effect.sync(() => {\n const onPointerDown = (event: Event) =>\n Queue.offerUnsafe(\n queue,\n Message.PressedAt({\n layers: openLayers(document),\n inside: layersOnPath(event.composedPath()),\n }),\n )\n const onKeyDown = (event: Event) => {\n if ((event as KeyboardEvent).key !== 'Escape') return\n Queue.offerUnsafe(queue, Message.PressedEscape({ layers: openLayers(document) }))\n }\n document.addEventListener('pointerdown', onPointerDown, { capture: true })\n document.addEventListener('keydown', onKeyDown, { capture: true })\n return { onPointerDown, onKeyDown }\n }),\n ({ onPointerDown, onKeyDown }) =>\n Effect.sync(() => {\n document.removeEventListener('pointerdown', onPointerDown, { capture: true })\n document.removeEventListener('keydown', onKeyDown, { capture: true })\n }),\n ),\n )\n}\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The layer's root, rendered only while the layer is open. */\n readonly layer: keyof Slots & string\n /** The element that opens the layer, so a press on it is inside. */\n readonly trigger?: keyof Slots & string\n readonly id: (input: Input) => string\n /** Dismiss on a press outside. Default `true`. */\n readonly outsidePress?: boolean\n /** Dismiss on Escape when topmost. Default `true`. */\n readonly escape?: boolean\n}\n\n/**\n * Marks the layer's container and trigger for the placed stack. The layer\n * takes part only while its element is rendered, so an `open` flag in the\n * parent Model is the whole lifecycle. Not for an element with `popover`,\n * which the browser dismisses itself.\n */\nexport const behavior =\n <Field extends string>(_declared: Declared<typeof bundle, Field>) =>\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.layer]: Behavior.slot({\n requires: { capability: Capability.Container },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => [\n h.Attribute(LAYER_ATTRIBUTE, options.id(input)),\n ...(options.outsidePress === false ? [h.Attribute(OUTSIDE_ATTRIBUTE, 'false')] : []),\n ...(options.escape === false ? [h.Attribute(ESCAPE_ATTRIBUTE, 'false')] : []),\n ],\n }),\n ...(options.trigger === undefined\n ? {}\n : {\n [options.trigger]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => [h.Attribute(TRIGGER_ATTRIBUTE, options.id(input))],\n }),\n }),\n // Keyed by values the caller chose; `forSlots` checks the keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'DismissLayer' },\n )\n","/**\n * `EditableText` as a Behavior: attaches the `foldkit-primitives/dom` Mount to\n * a container slot and maps what it reports into the view's Messages. No\n * Bundle: the text typed is a fact, and what it changes is the parent's\n * `update`.\n */\nimport * as Mount from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { EditableText as EditableTextMount, type TextFact } from '../dom/editable-text.js'\n\nexport {\n EditAsked,\n EditableText as mount,\n TextCancelled,\n TextCommitted,\n TextEdited,\n textOf,\n type TextFact,\n} from '../dom/editable-text.js'\n\nexport interface BehaviorOptions<Slots, ParentMessage> {\n /** The slot holding the fields. */\n readonly container: keyof Slots & string\n /** The attribute that marks a field, holding its name. */\n readonly attribute: string\n /** Turns each fact into the view's Message. */\n readonly toMessage: (fact: TextFact) => ParentMessage\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Slots, ParentMessage>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: () =>\n Mount.mapMessage(\n EditableTextMount({ attribute: options.attribute }),\n options.toMessage,\n ),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'EditableText' },\n )\n","/**\n * `FocusScope` as a Behavior: attaches the `foldkit-primitives/dom` Mount to a\n * container slot. No Bundle, because which element has focus is a DOM fact.\n */\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { FocusScope as FocusScopeMount } from '../dom/focus-scope.js'\n\nexport { FocusScope as mount, tabbableWithin } from '../dom/focus-scope.js'\n\nexport interface BehaviorOptions<Slots> {\n readonly container: keyof Slots & string\n /** Keep Tab, Shift+Tab, and a stray focus inside. Default `true`. */\n readonly contain?: boolean\n /** Give focus back to what had it when the container unmounts. Default `true`. */\n readonly restore?: boolean\n /** A selector inside the container to focus first. */\n readonly initialFocus?: string\n}\n\n/**\n * On insert the container focuses `initialFocus`, else its first tabbable\n * descendant, else itself; with `contain`, Tab and Shift+Tab wrap inside and\n * focus that lands outside comes back to the first tabbable; on unmount, with\n * `restore`, focus returns to the element that had it. A dialog that is not\n * a native `<dialog>`, a menu, or a command palette takes this.\n */\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: () =>\n FocusScopeMount({\n contain: options.contain ?? true,\n restore: options.restore ?? true,\n initialFocus: options.initialFocus ?? null,\n }),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'FocusScope' },\n )\n","/**\n * `FocusVisible` as a Behavior over a placed `InputModality`: the target gets\n * `data-focus-visible` while the page is being driven by keyboard, so a\n * stylesheet can show a ring with `[data-focus-visible]:focus` and hide it\n * for pointer users. CSS `:focus-visible` does this without any of it; this\n * is for a design system that must decide in the Model.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport type { Declared } from 'foldkit-bundle'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { InputModality, type InputModalityModel } from '../events/input-modality.js'\n\nexport { InputModality as bundle, Modality, modalityOfKey } from '../events/input-modality.js'\nexport type { InputModalityModel as Model } from '../events/input-modality.js'\n\nexport interface BehaviorOptions<Slots> {\n readonly target: keyof Slots & string\n}\n\nexport const behavior =\n <Field extends string>(declared: Declared<typeof InputModality, Field>) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: InputModalityModel }, ParentMessage>(\n options: BehaviorOptions<Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.target]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) =>\n input[declared.field].modality === 'keyboard'\n ? [h.DataAttribute('focus-visible', 'true')]\n : [],\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'FocusVisible' },\n )\n","/**\n * One tab stop for a set of items (a toolbar, a tab list, a listbox): arrows\n * move focus between them, the rest stay out of the tab order. The current\n * item's id is the Model slice, so a reorder keeps the same item current and a\n * resumed page knows where focus was. Which item comes next is a pure\n * function of the items and the key; the Behavior wires it to the slots.\n */\nimport { Option, Schema } from 'effect'\nimport type { Attribute, HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport { Bundle } from 'foldkit-bundle'\nimport { Behavior, Behaviors, Capability, type SlotItem } from 'foldkit-mixins'\nimport type { Declared } from 'foldkit-bundle'\nimport { perInput } from '../internal.js'\n\nexport const Orientation = Schema.Literals(['vertical', 'horizontal', 'both'])\nexport type Orientation = typeof Orientation.Type\n\nexport const Model = Schema.Struct({\n /** The current item's id, or `null` before any item has been focused. */\n current: Schema.NullOr(Schema.String),\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** An item became current: the user focused it, or a key moved there. */\n Focused: { id: Schema.String },\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n orientation: Orientation,\n /** Wrap from the last enabled item to the first, and back. */\n loop: Schema.Boolean,\n /** Keep DOM focus on the container and point at the current item with\n * `aria-activedescendant` instead of moving focus. */\n virtual: Schema.Boolean,\n})\nexport type Args = typeof Args.Type\n\nexport const bundle = Bundle.make('RovingTabindex', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { current: null } }),\n // Moving focus by key dispatches `Focused`, and the item's `OnFocus` reports it again.\n update: (model, message) =>\n model.current === message.id ? { model } : { model: { current: message.id } },\n})\n\nexport type Direction = 'ltr' | 'rtl'\n\nexport interface MoveOptions {\n readonly orientation: Orientation\n readonly loop: boolean\n readonly direction: Direction\n /** How many enabled items PageUp and PageDown move; absent, they are not handled. */\n readonly page?: number\n}\n\nconst isPlain = (modifiers: KeyboardModifiers): boolean =>\n !modifiers.ctrlKey && !modifiers.altKey && !modifiers.metaKey\n\n/**\n * The index the key moves to from `current`, over the enabled indices only, or\n * `undefined` when the key is not a navigation key here. `current` may be\n * `-1` (nothing current yet): arrows then land on the first or last enabled\n * item. Under `rtl`, left and right swap. PageUp and PageDown move by `page`\n * and clamp at the ends, never wrapping.\n */\nexport const move = (\n enabled: ReadonlyArray<number>,\n current: number,\n key: string,\n modifiers: KeyboardModifiers,\n options: MoveOptions,\n): number | undefined => {\n if (enabled.length === 0 || !isPlain(modifiers)) return undefined\n const first = enabled[0]!\n const last = enabled[enabled.length - 1]!\n if (key === 'Home') return first\n if (key === 'End') return last\n if (options.page !== undefined && (key === 'PageUp' || key === 'PageDown')) {\n const position = enabled.indexOf(current)\n if (position === -1) return key === 'PageDown' ? first : last\n const jumped = position + (key === 'PageDown' ? options.page : -options.page)\n return enabled[Math.min(enabled.length - 1, Math.max(0, jumped))]\n }\n const vertical = options.orientation !== 'horizontal'\n const horizontal = options.orientation !== 'vertical'\n const forwardKey = options.direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight'\n const backwardKey = options.direction === 'rtl' ? 'ArrowRight' : 'ArrowLeft'\n const step =\n (vertical && key === 'ArrowDown') || (horizontal && key === forwardKey)\n ? 1\n : (vertical && key === 'ArrowUp') || (horizontal && key === backwardKey)\n ? -1\n : 0\n if (step === 0) return undefined\n const position = enabled.indexOf(current)\n if (position === -1) return step === 1 ? first : last\n const next = position + step\n if (next < 0) return options.loop ? last : first\n if (next >= enabled.length) return options.loop ? first : last\n return enabled[next]\n}\n\n/** The item that holds the tab stop: the current one, else the first enabled. */\nexport const tabStop = (\n items: Behaviors.Collection.Items<unknown>,\n current: string | null,\n): number => {\n const index = current === null ? -1 : items.indexOf(current)\n if (index !== -1 && !items.isDisabled(index)) return index\n return items.enabled[0] ?? -1\n}\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot that receives the arrow keys. */\n readonly container: keyof Slots & string\n /** The slot rendered once per item; must carry the item's id (see `Behaviors.Collection`). */\n readonly item: keyof Slots & string\n readonly items: (input: Input) => Behaviors.Collection.Items<unknown>\n /** Default `'ltr'`; return `'rtl'` to swap left and right. */\n readonly direction?: (input: Input) => Direction\n}\n\n/** A selector for an element by id, safe for any id. */\nexport const idSelector = (id: string): string => `[id=\"${id.replace(/[\"\\\\]/g, '\\\\$&')}\"]`\n\n/**\n * The attributes one item gets: `tabindex` 0 when it holds the tab stop and\n * -1 otherwise (none under `virtual`), and `OnFocus` reporting it current.\n * Shared with `ListNavigation`.\n */\nexport const itemAttributes = <ParentMessage>(\n h: HtmlBuilder<ParentMessage>,\n items: Behaviors.Collection.Items<unknown>,\n current: string | null,\n item: SlotItem,\n virtual: boolean,\n focused: (id: string) => ParentMessage,\n): ReadonlyArray<Attribute<ParentMessage>> => {\n const id = item.id ?? items.ids[item.index]\n if (id === undefined) return []\n const isStop = tabStop(items, current) === item.index\n return [...(virtual ? [] : [h.Tabindex(isStop ? 0 : -1)]), h.OnFocus(focused(id))]\n}\n\n/**\n * Wires a placed `RovingTabindex` to the slots: the container's arrow, Home\n * and End keys focus the next item (synchronously, then dispatch), each item\n * gets `tabindex` 0 or -1 and reports `Focused` when focused. Under `virtual`\n * DOM focus never leaves the container: the key only dispatches, the\n * container carries `aria-activedescendant`, and items keep no `tabindex`.\n *\n * Every handled key is default-prevented. Nothing is written on dispose: the\n * attributes are data, so a view that no longer attaches this leaves no\n * `tabindex` behind.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>, args: Args) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (id: string): ParentMessage =>\n declared.wrapper.make(Message.Focused({ id })) as unknown as ParentMessage\n const slice = (input: Input): Model => input[declared.field]\n const itemsOf = perInput(options.items)\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => {\n const items = itemsOf(input)\n const current = slice(input).current\n const from = current === null ? -1 : items.indexOf(current)\n const direction = options.direction?.(input) ?? 'ltr'\n const stop = tabStop(items, current)\n const stopId = stop === -1 ? undefined : items.ids[stop]\n const target = (key: string, modifiers: KeyboardModifiers): string | undefined => {\n const next = move(items.enabled, from, key, modifiers, { ...args, direction })\n return next === undefined ? undefined : items.ids[next]\n }\n // Virtual: DOM focus stays on the container, only the pointer moves.\n if (args.virtual) {\n return [\n h.OnKeyDownPreventDefault((key, modifiers) =>\n Option.map(Option.fromNullishOr(target(key, modifiers)), wrap),\n ),\n ...(stopId === undefined ? [] : [h.AriaActiveDescendant(stopId)]),\n ]\n }\n return [\n h.OnKeyDownFocus((key, modifiers) =>\n Option.map(Option.fromNullishOr(target(key, modifiers)), id => ({\n focusSelector: idSelector(id),\n message: wrap(id),\n })),\n ),\n ]\n },\n }),\n [options.item]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n readonly item?: SlotItem\n }) => {\n if (item === undefined) return []\n return itemAttributes(h, itemsOf(input), slice(input).current, item, args.virtual, wrap)\n },\n }),\n // Keyed by values the caller chose; `forSlots` checks both keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'RovingTabindex' },\n )\n }\n","/**\n * Two-dimensional arrow keys over a set of items laid out in rows of\n * `columns` (a calendar grid, a color swatch picker, an emoji palette). The\n * Model slice is the current item's id, as with `RovingTabindex`, so a\n * reorder keeps the same item current. Which cell a key lands on is the pure\n * `move`; the Behavior wires it to a container slot and a per-item slot and\n * shares `RovingTabindex`'s item attributes, so the two are interchangeable\n * on a view.\n */\nimport { Option, Schema } from 'effect'\nimport type { HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Behaviors, Capability, type SlotItem } from 'foldkit-mixins'\nimport * as RovingTabindex from './roving-tabindex.js'\nimport { perInput } from '../internal.js'\n\nexport const Model = Schema.Struct({\n /** The current cell's id, or `null` before any cell has been focused. */\n current: Schema.NullOr(Schema.String),\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** A cell became current: the user focused it, or a key moved there. */\n Focused: { id: Schema.String },\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n /** Cells per row; the last row may be short. */\n columns: Schema.Number.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(1))),\n /** Left and right continue into the previous and next row; up and down\n * continue into the previous and next column. Off, they stop at the edge. */\n wrap: Schema.Boolean,\n /** Keep DOM focus on the container and point at the current cell with\n * `aria-activedescendant` instead of moving focus. */\n virtual: Schema.Boolean,\n})\nexport type Args = typeof Args.Type\n\nexport const bundle = Bundle.make('GridNavigation', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { current: null } }),\n // Moving focus by key dispatches `Focused`, and the cell's `OnFocus` reports it again.\n update: (model, message) =>\n model.current === message.id ? { model } : { model: { current: message.id } },\n})\n\nexport interface MoveOptions {\n readonly columns: number\n readonly wrap: boolean\n readonly direction: RovingTabindex.Direction\n}\n\n/**\n * The index the key moves to from `current` over a grid of `count` cells in\n * rows of `columns`, skipping cells not in `enabled`, or `undefined` when the\n * key is not a grid key. Left and right step within the row, and across rows\n * under `wrap`; up and down step within the column, and across columns under\n * `wrap`. Home and End are the row's first and last enabled cell; with Ctrl\n * they are the grid's. At an edge without `wrap` the key is consumed and\n * `current` is returned. From `-1` (nothing current) a forward key lands on\n * the first enabled cell and a backward key on the last. Under `rtl`, left\n * and right swap.\n */\nexport const move = (\n enabled: ReadonlyArray<number>,\n count: number,\n current: number,\n key: string,\n modifiers: KeyboardModifiers,\n options: MoveOptions,\n): number | undefined => {\n if (enabled.length === 0 || modifiers.altKey || modifiers.metaKey) return undefined\n const first = enabled[0]!\n const last = enabled[enabled.length - 1]!\n const isEnabled = (index: number) => enabled.includes(index)\n const { columns } = options\n const row = (index: number) => Math.floor(index / columns)\n\n if (key === 'Home' || key === 'End') {\n if (modifiers.ctrlKey || current === -1) return key === 'Home' ? first : last\n const inRow = enabled.filter(index => row(index) === row(current))\n return key === 'Home' ? (inRow[0] ?? current) : (inRow[inRow.length - 1] ?? current)\n }\n if (modifiers.ctrlKey) return undefined\n\n const forwardKey = options.direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight'\n const backwardKey = options.direction === 'rtl' ? 'ArrowRight' : 'ArrowLeft'\n const axis: 'row' | 'column' | undefined =\n key === forwardKey || key === backwardKey\n ? 'row'\n : key === 'ArrowDown' || key === 'ArrowUp'\n ? 'column'\n : undefined\n if (axis === undefined) return undefined\n const step = key === forwardKey || key === 'ArrowDown' ? 1 : -1\n if (current === -1) return step === 1 ? first : last\n\n if (axis === 'row') {\n // Reading order; without wrap the walk stops at the row's edge.\n for (let index = current + step; index >= 0 && index < count; index += step) {\n if (!options.wrap && row(index) !== row(current)) return current\n if (isEnabled(index)) return index\n }\n return current\n }\n // Column-major; without wrap the walk stops at the column's edge.\n const column = current % columns\n for (let index = current + step * columns; ; index += step * columns) {\n if (index < 0 || index >= count) {\n if (!options.wrap) return current\n const nextColumn = column + step\n if (nextColumn < 0 || nextColumn >= columns) return current\n // Continue from the top (or bottom) of the neighbouring column.\n const start =\n step === 1\n ? nextColumn\n : nextColumn + columns * Math.floor((count - 1 - nextColumn) / columns)\n for (let next = start; next >= 0 && next < count; next += step * columns) {\n if (isEnabled(next)) return next\n }\n return current\n }\n if (isEnabled(index)) return index\n }\n}\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot that receives the arrow keys. */\n readonly container: keyof Slots & string\n /** The slot rendered once per cell; must carry the cell's id (see `Behaviors.Collection`). */\n readonly item: keyof Slots & string\n readonly items: (input: Input) => Behaviors.Collection.Items<unknown>\n /** Default `'ltr'`; return `'rtl'` to swap left and right. */\n readonly direction?: (input: Input) => RovingTabindex.Direction\n}\n\n/**\n * Wires a placed `GridNavigation` to the slots exactly as `RovingTabindex`\n * does, with `move` above deciding the cell: the container's arrows, Home and\n * End focus the next cell (synchronously, then dispatch) or, under `virtual`,\n * only dispatch and point with `aria-activedescendant`; each cell gets\n * `tabindex` 0 or -1 and reports `Focused` when focused.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>, args: Args) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (id: string): ParentMessage =>\n declared.wrapper.make(Message.Focused({ id })) as unknown as ParentMessage\n const slice = (input: Input): Model => input[declared.field]\n const itemsOf = perInput(options.items)\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => {\n const items = itemsOf(input)\n const current = slice(input).current\n const from = current === null ? -1 : items.indexOf(current)\n const direction = options.direction?.(input) ?? 'ltr'\n const stop = RovingTabindex.tabStop(items, current)\n const stopId = stop === -1 ? undefined : items.ids[stop]\n const target = (key: string, modifiers: KeyboardModifiers): string | undefined => {\n const next = move(items.enabled, items.size, from, key, modifiers, {\n columns: args.columns,\n wrap: args.wrap,\n direction,\n })\n return next === undefined ? undefined : items.ids[next]\n }\n if (args.virtual) {\n return [\n h.OnKeyDownPreventDefault((key, modifiers) =>\n Option.map(Option.fromNullishOr(target(key, modifiers)), wrap),\n ),\n ...(stopId === undefined ? [] : [h.AriaActiveDescendant(stopId)]),\n ]\n }\n return [\n h.OnKeyDownFocus((key, modifiers) =>\n Option.map(Option.fromNullishOr(target(key, modifiers)), id => ({\n focusSelector: RovingTabindex.idSelector(id),\n message: wrap(id),\n })),\n ),\n ]\n },\n }),\n [options.item]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n readonly item?: SlotItem\n }) => {\n if (item === undefined) return []\n return RovingTabindex.itemAttributes(\n h,\n itemsOf(input),\n slice(input).current,\n item,\n args.virtual,\n wrap,\n )\n },\n }),\n // Keyed by values the caller chose; `forSlots` checks both keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'GridNavigation' },\n )\n }\n","/**\n * `ScrollLock` and `HideOutside` as Behaviors: each attaches its\n * `foldkit-primitives/dom` Mount to a container slot. No Bundle, because the\n * lock and the inert set are document facts Foldkit already refcounts and\n * keys.\n */\nimport type { MountAction } from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { HideOutside as HideOutsideMount, ScrollLock as ScrollLockMount } from '../dom/layers.js'\n\nexport { HideOutside as hideOutsideMount, ScrollLock as scrollLockMount } from '../dom/layers.js'\n\nconst mountOn =\n (name: string, mount: () => MountAction<never>) =>\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(options: {\n readonly container: keyof Slots & string\n }): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount,\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name },\n )\n\n/** Locks the document's scroll while the container is mounted; nested locks release together. */\nexport const scrollLock = mountOn('ScrollLock', () => ScrollLockMount())\n\n/** Marks everything outside the container inert while it is mounted. */\nexport const hideOutside = mountOn('HideOutside', () => HideOutsideMount())\n","/**\n * Announcements for assistive technology: one Bundle, placed once, holds the\n * text of a polite and an assertive live region. An announcement waits\n * `debounceMs` so a burst reads once, then clears after `clearAfterMs`, both\n * on Effect's clock with a generation so a superseded timer changes nothing.\n * The same text twice gets a trailing no-break space toggled, which is what\n * makes a screen reader read it again. `view` renders the two regions; put it\n * once in the page and style them visually hidden.\n */\nimport { Effect, Schema } from 'effect'\nimport type { Html, HtmlBuilder } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\n\nexport const Politeness = Schema.Literals(['polite', 'assertive'])\nexport type Politeness = typeof Politeness.Type\n\nexport const Model = Schema.Struct({\n polite: Schema.String,\n assertive: Schema.String,\n /** Waiting for the debounce to read. */\n pending: Schema.NullOr(Schema.Struct({ message: Schema.String, politeness: Politeness })),\n generation: Schema.Number,\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n Announced: { message: Schema.String, politeness: Politeness },\n Read: { generation: Schema.Number },\n Cleared: { generation: Schema.Number },\n})\nexport type Message = typeof Message.Type\n\nconst positive = Schema.Number.pipe(\n Schema.check(Schema.isGreaterThanOrEqualTo(0)),\n Schema.check(Schema.isFinite()),\n)\n\nexport const Args = Schema.Struct({\n /** A burst of announcements inside this window reads once, the last one. */\n debounceMs: positive,\n /** How long the text stays in the region. */\n clearAfterMs: positive,\n})\nexport type Args = typeof Args.Type\n\nconst NBSP = ' '\n\n/** The text to put in the region so that `next` is read even when it equals `current`. */\nexport const reread = (current: string, next: string): string =>\n current === next ? `${next}${NBSP}` : current === `${next}${NBSP}` ? next : next\n\ntype Return = Update.Return<Model, Message>\n\nconst after = (ms: number, message: Message, name: string, generation: number) => ({\n name,\n args: { generation },\n effect: Effect.as(Effect.sleep(ms), message),\n})\n\nexport const bundle = Bundle.make('LiveAnnounce', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { polite: '', assertive: '', pending: null, generation: 0 } }),\n update: (model, message, args): Return =>\n Message.match<Return>(message, {\n Announced: ({ message: text, politeness }) => {\n const generation = model.generation + 1\n return {\n model: { ...model, pending: { message: text, politeness }, generation },\n commands: [\n after(args.debounceMs, Message.Read({ generation }), 'LiveAnnounce.read', generation),\n ],\n }\n },\n Read: ({ generation }) => {\n if (generation !== model.generation || model.pending === null) return { model }\n const { message: text, politeness } = model.pending\n const region = politeness === 'polite' ? 'polite' : 'assertive'\n return {\n model: { ...model, pending: null, [region]: reread(model[region], text) },\n commands: [\n after(\n args.clearAfterMs,\n Message.Cleared({ generation }),\n 'LiveAnnounce.clear',\n generation,\n ),\n ],\n }\n },\n Cleared: ({ generation }) =>\n generation === model.generation\n ? { model: { ...model, polite: '', assertive: '' } }\n : { model },\n }),\n})\n\n/** The parent Message that announces `text`, to return from `update` or `onOut`. */\nexport const say =\n <Field extends string>(declared: Declared<typeof bundle, Field>) =>\n <ParentMessage>(text: string, politeness: Politeness = 'polite'): ParentMessage =>\n declared.wrapper.make(\n Message.Announced({ message: text, politeness }),\n ) as unknown as ParentMessage\n\nexport const REGION_ATTRIBUTE = 'data-foldkit-plus-live'\n\n/**\n * The two live regions. Render once, anywhere in the page, and hide them\n * visually with a rule on `[data-foldkit-plus-live]`; they must stay in the\n * accessibility tree, so no `display: none`.\n */\nexport const view = <ParentMessage>(model: Model, h: HtmlBuilder<ParentMessage>): Html =>\n h.div(\n [h.Attribute(REGION_ATTRIBUTE, 'regions')],\n [\n h.div(\n [h.Attribute(REGION_ATTRIBUTE, 'polite'), h.AriaLive('polite'), h.AriaAtomic(true)],\n [model.polite],\n ),\n h.div(\n [h.Attribute(REGION_ATTRIBUTE, 'assertive'), h.AriaLive('assertive'), h.AriaAtomic(true)],\n [model.assertive],\n ),\n ],\n )\n","/**\n * Typeahead over a set of items: printable keys build a query that a timer\n * clears, and the query picks the item to move to. The query lives in the\n * Model so a replay sees the same picks; the timer runs on Effect's clock so\n * TestClock drives it. Which item matches is a pure function.\n */\nimport { Effect, Option, Schema } from 'effect'\nimport type { HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Behaviors, Capability } from 'foldkit-mixins'\nimport { idSelector } from './roving-tabindex.js'\nimport { clearQuery } from '../internal.js'\n\nexport const Model = Schema.Struct({\n query: Schema.String,\n /** Bumped per keystroke, carried by the clear it schedules, so a superseded\n * timer's `Expired` changes nothing. */\n generation: Schema.Number,\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** A printable key was pressed with no ctrl, alt or meta. */\n Typed: { char: Schema.String },\n /** The clear timer fired for `generation`. */\n Expired: { generation: Schema.Number },\n /** The query was dropped on purpose (a blur, a selection). */\n Cleared: {},\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n /** How long the query survives after the last key. */\n timeoutMs: Schema.Number.pipe(\n Schema.check(Schema.isGreaterThan(0)),\n Schema.check(Schema.isFinite()),\n ),\n})\nexport type Args = typeof Args.Type\n\nexport const bundle = Bundle.make('Typeahead', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { query: '', generation: 0 } }),\n update: (model, message, args) =>\n Message.match<Update.Return<Model, Message>>(message, {\n Typed: ({ char }) => {\n const generation = model.generation + 1\n return {\n model: { query: model.query + char, generation },\n commands: [\n {\n name: 'Typeahead.expire',\n args: { generation },\n effect: Effect.as(Effect.sleep(args.timeoutMs), Message.Expired({ generation })),\n },\n ],\n }\n },\n Expired: ({ generation }) =>\n generation === model.generation ? clearQuery(model) : { model },\n Cleared: () => clearQuery(model),\n }),\n})\n\nconst normalize = (text: string): string => text.trimStart().toLocaleLowerCase()\n\nconst isRepeated = (query: string): boolean =>\n query.length > 1 && [...query].every(char => char === query[0])\n\n/**\n * The enabled index whose text starts with `query`, searching forward from\n * `current` and wrapping, or `undefined`. A query of one character, or one\n * character repeated (`aaa`), starts *after* the current item so repeated\n * presses cycle through the items that begin with it; a longer query starts\n * *at* the current item, since the user is refining a match. Case and leading\n * whitespace are ignored.\n */\nexport const match = (\n texts: ReadonlyArray<string>,\n enabled: ReadonlyArray<number>,\n query: string,\n current: number,\n): number | undefined => {\n if (query === '' || enabled.length === 0) return undefined\n const needle = normalize(isRepeated(query) ? query[0]! : query)\n const position = enabled.indexOf(current)\n const startAfter = needle.length === 1 || isRepeated(query)\n const start = position === -1 ? 0 : startAfter ? position + 1 : position\n for (let offset = 0; offset < enabled.length; offset += 1) {\n const index = enabled[(start + offset) % enabled.length]!\n if (normalize(texts[index] ?? '').startsWith(needle)) return index\n }\n return undefined\n}\n\n/** A single character with no ctrl, alt or meta: a typeahead key. */\nexport const isPrintable = (key: string, modifiers: KeyboardModifiers): boolean =>\n key.length === 1 && !modifiers.ctrlKey && !modifiers.altKey && !modifiers.metaKey\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot that receives the keys. */\n readonly host: keyof Slots & string\n readonly items: (input: Input) => Behaviors.Collection.Items<unknown>\n /** The text an item is matched by. */\n readonly text: (input: Input, index: number) => string\n /** The current item's id, so the search starts from it; a placed\n * `RovingTabindex` is the usual source. */\n readonly current: (input: Input) => string | null\n}\n\n/**\n * Wires a placed `Typeahead` to the host slot: a printable key extends the\n * query, focuses the matching item by its id (which then reports itself\n * current, through `RovingTabindex`'s `OnFocus`), and dispatches `Typed`.\n * With no match the key still extends the query, so the next one can match;\n * a space with an empty query is left to the host (it activates).\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (char: string): ParentMessage =>\n declared.wrapper.make(Message.Typed({ char })) as unknown as ParentMessage\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.host]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => {\n const items = options.items(input)\n const query = input[declared.field].query\n const currentId = options.current(input)\n const current = currentId === null ? -1 : items.indexOf(currentId)\n return [\n h.OnKeyDownFocus((key, modifiers) => {\n if (!isPrintable(key, modifiers)) return Option.none()\n if (key === ' ' && query === '') return Option.none()\n // Read on a key, not on every render.\n const texts = items.ids.map((_, index) => options.text(input, index))\n const found = match(texts, items.enabled, query + key, current)\n const target = found === undefined ? currentId : items.ids[found]\n return Option.some({\n // `:not(*)` matches nothing: no match and nothing current\n // moves no focus, but the key is still recorded.\n focusSelector:\n target === null || target === undefined ? ':not(*)' : idSelector(target),\n message: wrap(key),\n })\n }),\n ]\n },\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'Typeahead' },\n )\n }\n","/**\n * Keyboard navigation of a list in one placement: a roving tab stop, type to\n * find, and PageUp and PageDown. One Bundle holds the current item's id and\n * the typeahead query, so a printable key can move the pointer and extend the\n * query in one transition, which two placements cannot do under `virtual`.\n * The resolver allows one owner per event on a slot, so a host that needs\n * both arrows and typeahead takes this, not `RovingTabindex` plus `Typeahead`.\n */\nimport { Effect, Option, Schema } from 'effect'\nimport type { HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Behaviors, Capability, type SlotItem } from 'foldkit-mixins'\nimport * as RovingTabindex from './roving-tabindex.js'\nimport * as Typeahead from './typeahead.js'\nimport { clearQuery, perInput } from '../internal.js'\n\nexport const Model = Schema.Struct({\n current: Schema.NullOr(Schema.String),\n query: Schema.String,\n generation: Schema.Number,\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** An item became current: focused, or reached by a key. */\n Focused: { id: Schema.String },\n /** A printable key extended the query; `match` is the item it now picks, if any. */\n Typed: { char: Schema.String, match: Schema.NullOr(Schema.String) },\n Expired: { generation: Schema.Number },\n Cleared: {},\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n orientation: RovingTabindex.Orientation,\n loop: Schema.Boolean,\n virtual: Schema.Boolean,\n /** How long the typeahead query survives after the last key. */\n timeoutMs: Schema.Number.pipe(\n Schema.check(Schema.isGreaterThan(0)),\n Schema.check(Schema.isFinite()),\n ),\n /** How many enabled items PageUp and PageDown move. */\n page: Schema.Number.pipe(Schema.check(Schema.isInt()), Schema.check(Schema.isGreaterThan(0))),\n})\nexport type Args = typeof Args.Type\n\nexport const bundle = Bundle.make('ListNavigation', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { current: null, query: '', generation: 0 } }),\n update: (model, message, args) =>\n Message.match<Update.Return<Model, Message>>(message, {\n // Moving focus by key dispatches `Focused`, and the item's `OnFocus` reports it again.\n Focused: ({ id }) =>\n model.current === id ? { model } : { model: { ...model, current: id } },\n Typed: ({ char, match }) => {\n const generation = model.generation + 1\n return {\n model: { current: match ?? model.current, query: model.query + char, generation },\n commands: [\n {\n name: 'ListNavigation.expire',\n args: { generation },\n effect: Effect.as(Effect.sleep(args.timeoutMs), Message.Expired({ generation })),\n },\n ],\n }\n },\n Expired: ({ generation }) =>\n generation === model.generation ? clearQuery(model) : { model },\n Cleared: () => clearQuery(model),\n }),\n})\n\nexport interface BehaviorOptions<Input, Slots, ParentMessage> {\n readonly container: keyof Slots & string\n /** The slot rendered once per item; must carry the item's id (see `Behaviors.Collection`). */\n readonly item: keyof Slots & string\n readonly items: (input: Input) => Behaviors.Collection.Items<unknown>\n /** The text an item is matched by when typing. */\n readonly text: (input: Input, index: number) => string\n readonly direction?: (input: Input) => RovingTabindex.Direction\n /**\n * Whether a printable key moves the pointer. Off when the container is a\n * text field: letters belong to the field, and arrows still navigate.\n * Defaults to on.\n */\n readonly typeahead?: boolean\n /**\n * Enter on the current enabled item. One handler with the arrows: a second\n * key handler on the same slot would be a second owner of `keydown`.\n */\n readonly commit?: (input: Input, id: string) => ParentMessage\n}\n\n/**\n * The key's outcome, before it is turned into an attribute: navigation to an\n * id, a typed character with its match, or nothing.\n */\nexport type KeyOutcome =\n | { readonly _tag: 'Navigate'; readonly id: string }\n | { readonly _tag: 'Type'; readonly char: string; readonly match: string | null }\n\nexport const keyOutcome = (\n items: Behaviors.Collection.Items<unknown>,\n texts: ReadonlyArray<string>,\n state: { readonly current: string | null; readonly query: string },\n key: string,\n modifiers: KeyboardModifiers,\n options: RovingTabindex.MoveOptions,\n): KeyOutcome | undefined => {\n const from = state.current === null ? -1 : items.indexOf(state.current)\n const moved = RovingTabindex.move(items.enabled, from, key, modifiers, options)\n const movedId = moved === undefined ? undefined : items.ids[moved]\n if (movedId !== undefined) return { _tag: 'Navigate', id: movedId }\n if (!Typeahead.isPrintable(key, modifiers)) return undefined\n if (key === ' ' && state.query === '') return undefined\n const found = Typeahead.match(texts, items.enabled, state.query + key, from)\n return { _tag: 'Type', char: key, match: found === undefined ? null : (items.ids[found] ?? null) }\n}\n\n/**\n * Wires a placed `ListNavigation` to the slots. The container gets one key\n * handler: arrows, Home, End, PageUp and PageDown move by id; a printable key\n * extends the query and moves to its match. Each item gets `tabindex` and\n * `OnFocus` as under `RovingTabindex`. Under `virtual` nothing takes DOM focus\n * and the container carries `aria-activedescendant`.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>, args: Args) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots, ParentMessage>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (message: Message): ParentMessage =>\n declared.wrapper.make(message) as unknown as ParentMessage\n const focused = (id: string): ParentMessage => wrap(Message.Focused({ id }))\n const slice = (input: Input): Model => input[declared.field]\n const itemsOf = perInput(options.items)\n const outcomeMessage = (outcome: KeyOutcome): ParentMessage =>\n outcome._tag === 'Navigate'\n ? focused(outcome.id)\n : wrap(Message.Typed({ char: outcome.char, match: outcome.match }))\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => {\n const items = itemsOf(input)\n const state = slice(input)\n const moveOptions: RovingTabindex.MoveOptions = {\n orientation: args.orientation,\n loop: args.loop,\n direction: options.direction?.(input) ?? 'ltr',\n page: args.page,\n }\n const typeahead = options.typeahead !== false\n // Commit is already a parent message. A key outcome still has to\n // become one, and the focus path needs the id it should move to.\n type Decision =\n | { readonly _tag: 'Commit'; readonly id: string; readonly message: ParentMessage }\n | { readonly _tag: 'Key'; readonly outcome: KeyOutcome }\n const decide = (key: string, modifiers: KeyboardModifiers): Option.Option<Decision> => {\n const current = state.current\n if (\n key === 'Enter' &&\n options.commit !== undefined &&\n !modifiers.shiftKey &&\n !modifiers.ctrlKey &&\n !modifiers.altKey &&\n !modifiers.metaKey &&\n current !== null\n ) {\n const currentIndex = items.indexOf(current)\n if (currentIndex !== -1 && !items.isDisabled(currentIndex)) {\n return Option.some({\n _tag: 'Commit',\n id: current,\n message: options.commit(input, current),\n })\n }\n }\n const result = keyOutcome(\n items,\n // Read on a key, not on every render.\n items.ids.map((_, index) => options.text(input, index)),\n state,\n key,\n modifiers,\n moveOptions,\n )\n // A text field owns printable keys. Arrows still move the pointer.\n if (!typeahead && result !== undefined && result._tag === 'Type') return Option.none()\n if (result === undefined) return Option.none()\n return Option.some({ _tag: 'Key', outcome: result })\n }\n const messageOf = (decision: Decision): ParentMessage => {\n if (decision._tag === 'Commit') return decision.message\n return outcomeMessage(decision.outcome)\n }\n const stop = RovingTabindex.tabStop(items, state.current)\n const stopId = stop === -1 ? undefined : items.ids[stop]\n if (args.virtual) {\n return [\n h.OnKeyDownPreventDefault((key, modifiers) =>\n Option.map(decide(key, modifiers), messageOf),\n ),\n ...(stopId === undefined ? [] : [h.AriaActiveDescendant(stopId)]),\n ]\n }\n return [\n h.OnKeyDownFocus((key, modifiers) =>\n Option.map(decide(key, modifiers), decision => {\n if (decision._tag === 'Commit') {\n return {\n focusSelector: RovingTabindex.idSelector(decision.id),\n message: decision.message,\n }\n }\n const result = decision.outcome\n const target =\n result._tag === 'Navigate' ? result.id : (result.match ?? state.current)\n return {\n // `:not(*)` matches nothing: a typed key with no match and\n // nothing current moves no focus but is still recorded.\n focusSelector: target === null ? ':not(*)' : RovingTabindex.idSelector(target),\n message: outcomeMessage(result),\n }\n }),\n ),\n ]\n },\n }),\n [options.item]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n readonly item?: SlotItem\n }) =>\n item === undefined\n ? []\n : RovingTabindex.itemAttributes(\n h,\n itemsOf(input),\n slice(input).current,\n item,\n args.virtual,\n focused,\n ),\n }),\n // Keyed by values the caller chose; `forSlots` checks both keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'ListNavigation' },\n )\n }\n","/**\n * Press: pointer and keyboard activation of one element as one fact. A Mount\n * reports what the element saw (pointer down, up, cancel, key down, up,\n * click) with the detail Foldkit's declarative attributes do not carry; the\n * Bundle's `update` decides what counts as a press; the ghost click that\n * follows a touch is suppressed by a timed Command on Effect's clock, never\n * by a clock read in a handler. Activation is an OutMessage, `Pressed`, so\n * the placement must say what a press does.\n */\nimport { Effect, Queue, Schema, Stream } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Mount from 'foldkit/mount'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { BundleBehavior } from './bundle-behavior.js'\n\nexport const PointerType = Schema.Literals(['mouse', 'touch', 'pen', 'keyboard', 'virtual'])\nexport type PointerType = typeof PointerType.Type\n\nexport const Model = Schema.Struct({\n /** Down and not yet released or cancelled. For styling. */\n pressed: Schema.Boolean,\n /** The pointer that pressed, so another pointer's up cannot release it. */\n pointerId: Schema.NullOr(Schema.Number),\n /** Enter or Space is down. */\n key: Schema.NullOr(Schema.String),\n /** A click arriving before this generation's window ends is the ghost of a pointer press. */\n suppressing: Schema.NullOr(Schema.Number),\n generation: Schema.Number,\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n PointerDown: { pointerId: Schema.Number, button: Schema.Number, pointerType: Schema.String },\n PointerUp: { pointerId: Schema.Number, pointerType: Schema.String, shiftKey: Schema.Boolean },\n PointerCancelled: { pointerId: Schema.Number },\n KeyDown: { key: Schema.String, repeat: Schema.Boolean },\n KeyUp: { key: Schema.String, shiftKey: Schema.Boolean },\n /** `detail` is 0 for a click no pointer made: keyboard on a native control, or assistive technology. */\n Clicked: { detail: Schema.Number, shiftKey: Schema.Boolean },\n Unsuppressed: { generation: Schema.Number },\n})\nexport type Message = typeof Message.Type\n\nexport const Pressed = Schema.TaggedStruct('Pressed', {\n pointerType: PointerType,\n /** Shift was held, for a range selection. */\n shiftKey: Schema.Boolean,\n})\nexport type Pressed = typeof Pressed.Type\n\nexport const Args = Schema.Struct({\n /** How long after a pointer press a `click` is taken for its ghost. */\n clickSuppressionMs: Schema.Number.pipe(\n Schema.check(Schema.isGreaterThanOrEqualTo(0)),\n Schema.check(Schema.isFinite()),\n ),\n})\nexport type Args = typeof Args.Type\n\nconst idle = (model: Model): Model => ({ ...model, pressed: false, pointerId: null, key: null })\n\nconst isActivationKey = (key: string): boolean => key === 'Enter' || key === ' '\n\nconst asPointerType = (raw: string): PointerType =>\n raw === 'touch' || raw === 'pen' ? raw : 'mouse'\n\ntype Return = Update.ReturnWithOutMessage<Model, Message, Pressed>\n\nexport const bundle = Bundle.make('Press', {\n Model,\n Message,\n args: Args,\n init: () => ({\n model: { pressed: false, pointerId: null, key: null, suppressing: null, generation: 0 },\n }),\n update: (model, message, args): Return =>\n Message.match<Return>(message, {\n PointerDown: ({ pointerId, button }) =>\n button !== 0 || model.pointerId !== null\n ? { model }\n : { model: { ...model, pressed: true, pointerId } },\n PointerUp: ({ pointerId, pointerType, shiftKey }) => {\n if (model.pointerId !== pointerId) return { model }\n const generation = model.generation + 1\n return {\n model: { ...idle(model), suppressing: generation, generation },\n commands: [\n {\n name: 'Press.unsuppress',\n args: { generation },\n effect: Effect.as(\n Effect.sleep(args.clickSuppressionMs),\n Message.Unsuppressed({ generation }),\n ),\n },\n ],\n outMessage: Pressed.make({ pointerType: asPointerType(pointerType), shiftKey }),\n }\n },\n PointerCancelled: ({ pointerId }) =>\n model.pointerId === pointerId ? { model: idle(model) } : { model },\n KeyDown: ({ key, repeat }) =>\n !isActivationKey(key) || repeat || model.key !== null || model.pointerId !== null\n ? { model }\n : { model: { ...model, pressed: true, key } },\n KeyUp: ({ key, shiftKey }) =>\n model.key === key\n ? { model: idle(model), outMessage: Pressed.make({ pointerType: 'keyboard', shiftKey }) }\n : { model },\n Clicked: ({ detail, shiftKey }) =>\n detail === 0\n ? { model, outMessage: Pressed.make({ pointerType: 'virtual', shiftKey }) }\n : model.suppressing !== null\n ? { model }\n : { model, outMessage: Pressed.make({ pointerType: 'mouse', shiftKey }) },\n Unsuppressed: ({ generation }) =>\n model.suppressing === generation ? { model: { ...model, suppressing: null } } : { model },\n }),\n})\n\ntype PointerLike = Event & {\n readonly pointerId?: number\n readonly button?: number\n readonly pointerType?: string\n readonly shiftKey?: boolean\n}\n\n/** What the element reports; `Unsuppressed` comes from the timer, not the DOM. */\nexport type Fact = Exclude<Message, { readonly _tag: 'Unsuppressed' }>\n\n/**\n * The element's press-relevant events as facts. Enter and Space key downs\n * are default-prevented so a native control does not also click, and Space\n * does not scroll; the Bundle owns activation. An element marked\n * `aria-disabled=\"true\"` (which the Behavior writes) reports nothing, read\n * at event time so a toggle needs no remount. Nothing else is decided here.\n */\nexport const events = Mount.defineStream('PressEvents', {\n messages: [\n Message.PointerDown,\n Message.PointerUp,\n Message.PointerCancelled,\n Message.KeyDown,\n Message.KeyUp,\n Message.Clicked,\n ],\n execute: ({ element }) =>\n Stream.callback<Fact>(queue =>\n Effect.acquireRelease(\n Effect.sync(() => {\n const offer = (message: Fact) => {\n if (element.getAttribute('aria-disabled') === 'true') return\n Queue.offerUnsafe(queue, message)\n }\n const listeners: ReadonlyArray<readonly [string, (event: Event) => void]> = [\n [\n 'pointerdown',\n event => {\n const pointer = event as PointerLike\n offer(\n Message.PointerDown({\n pointerId: pointer.pointerId ?? 0,\n button: pointer.button ?? 0,\n pointerType: pointer.pointerType ?? 'mouse',\n }),\n )\n },\n ],\n [\n 'pointerup',\n event => {\n const pointer = event as PointerLike\n offer(\n Message.PointerUp({\n pointerId: pointer.pointerId ?? 0,\n pointerType: pointer.pointerType ?? 'mouse',\n shiftKey: pointer.shiftKey ?? false,\n }),\n )\n },\n ],\n [\n 'pointerleave',\n event =>\n offer(\n Message.PointerCancelled({ pointerId: (event as PointerLike).pointerId ?? 0 }),\n ),\n ],\n [\n 'pointercancel',\n event =>\n offer(\n Message.PointerCancelled({ pointerId: (event as PointerLike).pointerId ?? 0 }),\n ),\n ],\n [\n 'keydown',\n event => {\n const key = event as KeyboardEvent\n if (isActivationKey(key.key)) key.preventDefault()\n offer(Message.KeyDown({ key: key.key, repeat: key.repeat }))\n },\n ],\n [\n 'keyup',\n event => {\n const key = event as KeyboardEvent\n offer(Message.KeyUp({ key: key.key, shiftKey: key.shiftKey }))\n },\n ],\n [\n 'click',\n event => {\n const click = event as MouseEvent\n offer(\n Message.Clicked({ detail: click.detail ?? 0, shiftKey: click.shiftKey ?? false }),\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\nexport interface BehaviorOptions<Input, Slots> {\n readonly target: keyof Slots & string\n /** Marks the target `aria-disabled`, which also silences its events. */\n readonly disabled?: (input: Input) => boolean\n}\n\n/**\n * Attaches the events Mount to the target slot, mapped into the placement's\n * Messages, and writes `data-pressed` while down for styling. The element\n * decides nothing; a click, a touch, Enter, Space, or an assistive\n * technology's click all reach `update` and come out as one `Pressed`.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n BundleBehavior.fromBundle(declared)(slots)<Input, ParentMessage>(\n {\n [options.target]: {\n requires: { capability: Capability.Interactive },\n attributes: ({ input, h }) => [\n ...(input[declared.field].pressed ? [h.DataAttribute('pressed', 'true')] : []),\n ...(options.disabled?.(input) === true ? [h.AriaDisabled(true)] : []),\n ],\n events: events(),\n },\n },\n { name: 'Press' },\n )\n","/**\n * LongPress: holding an element down for `thresholdMs` is one fact. It reads\n * the same facts `Press.events` reports; the threshold is a Command on\n * Effect's clock carrying a generation, so a release before it fires makes\n * its `Elapsed` a no-op. `LongPressed` is an OutMessage the placement must\n * handle. A short press is `Press`'s business, not this Bundle's.\n */\nimport { Effect, Schema } from 'effect'\nimport type { HtmlBuilder } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport * as Mount from 'foldkit/mount'\nimport type * as Update from 'foldkit/update'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport * as Press from './press.js'\n\nexport const Model = Schema.Struct({\n /** Down, and the threshold has not passed. */\n holding: Schema.Boolean,\n pointerId: Schema.NullOr(Schema.Number),\n key: Schema.NullOr(Schema.String),\n generation: Schema.Number,\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n PointerDown: { pointerId: Schema.Number, button: Schema.Number, pointerType: Schema.String },\n PointerUp: { pointerId: Schema.Number, pointerType: Schema.String, shiftKey: Schema.Boolean },\n PointerCancelled: { pointerId: Schema.Number },\n KeyDown: { key: Schema.String, repeat: Schema.Boolean },\n KeyUp: { key: Schema.String, shiftKey: Schema.Boolean },\n Clicked: { detail: Schema.Number, shiftKey: Schema.Boolean },\n Elapsed: { generation: Schema.Number, pointerType: Press.PointerType },\n})\nexport type Message = typeof Message.Type\n\nexport const LongPressed = Schema.TaggedStruct('LongPressed', { pointerType: Press.PointerType })\nexport type LongPressed = typeof LongPressed.Type\n\nexport const Args = Schema.Struct({\n thresholdMs: Schema.Number.pipe(\n Schema.check(Schema.isGreaterThan(0)),\n Schema.check(Schema.isFinite()),\n ),\n})\nexport type Args = typeof Args.Type\n\nconst isActivationKey = (key: string): boolean => key === 'Enter' || key === ' '\n\nconst released = (model: Model): Model => ({ ...model, holding: false, pointerId: null, key: null })\n\ntype Return = Update.ReturnWithOutMessage<Model, Message, LongPressed>\n\nconst start = (\n model: Model,\n args: Args,\n by: { readonly pointerId: number } | { readonly key: string },\n pointerType: Press.PointerType,\n): Return => {\n const generation = model.generation + 1\n return {\n model: {\n holding: true,\n pointerId: 'pointerId' in by ? by.pointerId : null,\n key: 'key' in by ? by.key : null,\n generation,\n },\n commands: [\n {\n name: 'LongPress.elapse',\n args: { generation },\n effect: Effect.as(\n Effect.sleep(args.thresholdMs),\n Message.Elapsed({ generation, pointerType }),\n ),\n },\n ],\n }\n}\n\nexport const bundle = Bundle.make('LongPress', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { holding: false, pointerId: null, key: null, generation: 0 } }),\n update: (model, message, args): Return =>\n Message.match<Return>(message, {\n PointerDown: ({ pointerId, button, pointerType }) =>\n button !== 0 || model.holding\n ? { model }\n : start(\n model,\n args,\n { pointerId },\n pointerType === 'touch' || pointerType === 'pen' ? pointerType : 'mouse',\n ),\n PointerUp: ({ pointerId }) =>\n model.pointerId === pointerId ? { model: released(model) } : { model },\n PointerCancelled: ({ pointerId }) =>\n model.pointerId === pointerId ? { model: released(model) } : { model },\n KeyDown: ({ key, repeat }) =>\n !isActivationKey(key) || repeat || model.holding\n ? { model }\n : start(model, args, { key }, 'keyboard'),\n KeyUp: ({ key }) => (model.key === key ? { model: released(model) } : { model }),\n Clicked: () => ({ model }),\n Elapsed: ({ generation, pointerType }) =>\n model.holding && model.generation === generation\n ? { model: released(model), outMessage: LongPressed.make({ pointerType }) }\n : { model },\n }),\n})\n\nexport interface BehaviorOptions<Slots> {\n readonly target: keyof Slots & string\n}\n\n/**\n * Attaches `Press.events` to the target, mapped into this placement's\n * Messages, and writes `data-holding` while the element is down. `Press` and\n * `LongPress` on one slot are refused by the resolver (two Mounts of one\n * name), so today a slot takes one of them.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.target]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => (input[declared.field].holding ? [h.DataAttribute('holding', 'true')] : []),\n mount: () =>\n Mount.mapMessage(\n Press.events(),\n // The facts are the same tagged structs; only the union differs.\n (fact): ParentMessage =>\n declared.wrapper.make(fact as unknown as Message) as unknown as ParentMessage,\n ),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'LongPress' },\n )\n","/**\n * `Move` as a Behavior: attaches the `foldkit-primitives/dom` Mount to a\n * draggable slot and maps its facts into the view's Messages. No Bundle: a\n * drag's meaning (a threshold, a snap, a reorder) is the parent's `update`,\n * and the deltas are already facts.\n */\nimport * as Mount from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { Move as MoveMount, type Fact } from '../dom/move.js'\n\nexport { Move as mount, MoveEnded, MoveStarted, Moved, type Fact } from '../dom/move.js'\n\nexport interface BehaviorOptions<Slots, ParentMessage> {\n readonly handle: keyof Slots & string\n /** Turns each fact into the view's Message. */\n readonly toMessage: (fact: Fact) => ParentMessage\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Slots, ParentMessage>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.handle]: Behavior.slot({\n requires: { capability: Capability.Draggable },\n mount: () => Mount.mapMessage(MoveMount(), options.toMessage),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'Move' },\n )\n","/**\n * One overlay policy value instead of nine subtly different overlay\n * implementations. `modal` and `nonModal` cover the two shapes; anything\n * else is an explicit `Policy`. `behaviors` turns a policy into the\n * existing pieces — `DismissLayer` marking, `FocusScope`, `ScrollLock`,\n * `HideOutside` — attached to one layer slot, with nothing reimplemented:\n * the mounts are the shared implementation, and the data attributes are the\n * stack's protocol. Positioning stays per-widget (`Anchor.behavior`\n * directly): it binds a floating element to an external id, a different\n * shape than this layer policy. Presence stays CSS (`data-open`): it needs\n * a per-overlay placement, which is the Drawer's, not the policy's.\n *\n * The `DismissLayer` stack bundle itself is placed once per app, not per\n * overlay; its `Dismiss` outmessage reaches the app through the placement's\n * `onOut`, which closes the dismissed layers. The id `behaviors` writes is\n * the layer attribute (`data-foldkit-plus-layer`), not an element id:\n * `aria-controls` has to name an element that exists.\n */\nimport type { Declared } from 'foldkit-bundle'\nimport { Behavior, type NamedBehavior } from 'foldkit-mixins'\nimport { behavior as dismissLayerBehavior, bundle as dismissLayerBundle } from './dismiss-layer.js'\nimport { behavior as focusScopeBehavior } from './focus-scope.js'\nimport { hideOutside, scrollLock } from './layers.js'\n\nexport interface DismissPolicy {\n /** Dismiss on a press outside. Default `true`. */\n readonly outside: boolean\n /** Dismiss on Escape when topmost. Default `true`. */\n readonly escape: boolean\n}\n\nexport interface FocusPolicy {\n /** Keep Tab, Shift+Tab, and stray focus inside. Default `true`. */\n readonly contain: boolean\n /** Give focus back to what had it on unmount. Default `true`. */\n readonly restore: boolean\n /** A selector inside the layer to focus first. */\n readonly initialFocus?: string\n}\n\nexport interface Policy {\n readonly dismiss: DismissPolicy\n readonly focus: FocusPolicy\n /** Lock the document's scroll while mounted. */\n readonly scroll: { readonly lock: boolean }\n /** Mark everything outside inert while mounted. */\n readonly inert: boolean\n}\n\n/** A modal overlay: dismissed by Escape and outside press, focused, locked, inert. */\nexport const modal: Policy = {\n dismiss: { outside: true, escape: true },\n focus: { contain: true, restore: true },\n scroll: { lock: true },\n inert: true,\n}\n\n/** A modeless overlay: dismissed by Escape and outside press, focus restored, page usable. */\nexport const nonModal: Policy = {\n dismiss: { outside: true, escape: true },\n focus: { contain: false, restore: true },\n scroll: { lock: false },\n inert: false,\n}\n\n/**\n * The policy as behaviors, to spread into the view's pipe alongside the\n * widget's own. Conditional pieces are included or left out when the list\n * is built — a static policy per composition — so no slot carries a mount\n * its policy never uses.\n */\nexport const behaviors =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage, StackField extends string>(options: {\n readonly stack: Declared<typeof dismissLayerBundle, StackField>\n readonly layer: keyof Slots & string\n readonly trigger?: keyof Slots & string\n readonly id: (input: Input) => string\n readonly policy: Policy\n }): ReadonlyArray<NamedBehavior<Slots, Input, ParentMessage>> => [\n dismissLayerBehavior(options.stack)(slots)<Input, ParentMessage>({\n layer: options.layer,\n ...(options.trigger === undefined ? {} : { trigger: options.trigger }),\n id: options.id,\n outsidePress: options.policy.dismiss.outside,\n escape: options.policy.dismiss.escape,\n }),\n focusScopeBehavior(slots)<Input, ParentMessage>({\n container: options.layer,\n contain: options.policy.focus.contain,\n restore: options.policy.focus.restore,\n ...(options.policy.focus.initialFocus === undefined\n ? {}\n : { initialFocus: options.policy.focus.initialFocus }),\n }),\n ...(options.policy.scroll.lock\n ? [scrollLock(slots)<Input, ParentMessage>({ container: options.layer })]\n : []),\n ...(options.policy.inert\n ? [hideOutside(slots)<Input, ParentMessage>({ container: options.layer })]\n : []),\n ]\n","/**\n * Selection over a set of items: which ids are selected, and the anchor a\n * range extends from. `mode` is `'single'` (a click replaces), `'multiple'`\n * (a click toggles), or `'none'`. Single mode keeps one item selected unless\n * `allowEmpty`. A range needs the items' order, which the view knows and the\n * Bundle does not, so `Ranged` carries it. The Behavior says the state in\n * ARIA and wires a plain click; a Shift range comes from `Press`, whose\n * `Pressed` carries `shiftKey`.\n */\nimport { Schema } from 'effect'\nimport { defineMessageUnion } from 'foldkit/message'\nimport { Bundle, type Declared } from 'foldkit-bundle'\nimport { Behavior, Behaviors, Capability } from 'foldkit-mixins'\nimport { perInput, sameIds } from '../internal.js'\nimport { BundleBehavior } from './bundle-behavior.js'\n\nexport const Mode = Schema.Literals(['single', 'multiple', 'none'])\nexport type Mode = typeof Mode.Type\n\nexport const Model = Schema.Struct({\n /** In selection order. */\n selected: Schema.Array(Schema.String),\n /** Where the last plain selection happened; a range extends from it. */\n anchor: Schema.NullOr(Schema.String),\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** A plain activation: replaces in single mode, toggles in multiple mode. */\n Activated: { id: Schema.String },\n /** A Shift activation: selects everything between the anchor and `id` in `order`. */\n Ranged: { id: Schema.String, order: Schema.Array(Schema.String) },\n Replaced: { ids: Schema.Array(Schema.String) },\n Cleared: {},\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n mode: Mode,\n /** In single mode, whether activating the selected item deselects it. */\n allowEmpty: Schema.Boolean,\n})\nexport type Args = typeof Args.Type\n\nconst without = (ids: ReadonlyArray<string>, id: string) => ids.filter(other => other !== id)\n\n/** The ids between `from` and `to` in `order`, inclusive, in `order`'s order. */\nexport const between = (\n order: ReadonlyArray<string>,\n from: string | null,\n to: string,\n): ReadonlyArray<string> => {\n const end = order.indexOf(to)\n if (end === -1) return []\n const start = from === null ? -1 : order.indexOf(from)\n if (start === -1) return [to]\n return order.slice(Math.min(start, end), Math.max(start, end) + 1)\n}\n\nexport const bundle = Bundle.make('Selection', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { selected: [], anchor: null } }),\n update: (model, message, args) =>\n Message.match(message, {\n Activated: ({ id }) => {\n if (args.mode === 'none') return { model }\n const isSelected = model.selected.includes(id)\n if (args.mode === 'single') {\n return isSelected\n ? args.allowEmpty\n ? { model: { selected: [], anchor: id } }\n : { model }\n : { model: { selected: [id], anchor: id } }\n }\n return {\n model: {\n selected: isSelected ? without(model.selected, id) : [...model.selected, id],\n anchor: id,\n },\n }\n },\n Ranged: ({ id, order }) => {\n if (args.mode !== 'multiple') return { model }\n const range = between(order, model.anchor, id)\n const inRange = new Set(range)\n const selected = [...model.selected.filter(other => !inRange.has(other)), ...range]\n const anchor = model.anchor ?? id\n // Shift-clicking the same item twice ranges over what is selected already.\n return sameIds(selected, model.selected) && anchor === model.anchor\n ? { model }\n : { model: { selected, anchor } }\n },\n Replaced: ({ ids }) => {\n const selected = args.mode === 'none' ? [] : [...new Set(ids)]\n return sameIds(selected, model.selected)\n ? { model }\n : { model: { selected, anchor: model.anchor } }\n },\n Cleared: () =>\n model.selected.length === 0 ? { model } : { model: { selected: [], anchor: model.anchor } },\n }),\n})\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot holding the items, for `aria-multiselectable`. */\n readonly container?: keyof Slots & string\n /** The slot rendered once per item; must carry the item's id. */\n readonly item: keyof Slots & string\n readonly items: (input: Input) => Behaviors.Collection.Items<unknown>\n /** Wire a plain click on each item to `Activated`. Default `true`; turn off\n * when `Press` or the view owns the click. */\n readonly click?: boolean\n}\n\n/**\n * Writes `aria-selected` on each item from the placed slice, and\n * `aria-multiselectable` on the container in multiple mode; wires `OnClick`\n * to `Activated` unless told not to. A disabled item gets no click.\n */\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>, args: Args) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const itemsOf = perInput(options.items)\n const selectedOf = perInput((input: Input) => new Set(input[declared.field].selected))\n return BundleBehavior.fromBundle(declared)(slots)<Input, ParentMessage>(\n {\n ...(options.container === undefined\n ? {}\n : {\n [options.container]: {\n requires: { capability: Capability.Container },\n attributes: ({ h }) => [h.AriaMultiSelectable(args.mode === 'multiple')],\n },\n }),\n [options.item]: {\n requires: { capability: Capability.Interactive },\n attributes: ({ input, h, item, send }) => {\n if (item === undefined) return []\n const items = itemsOf(input)\n const id = item.id ?? items.ids[item.index]\n if (id === undefined) return []\n const clickable =\n options.click !== false && args.mode !== 'none' && !items.isDisabled(item.index)\n return [\n h.AriaSelected(selectedOf(input).has(id)),\n ...(clickable ? [h.OnClick(send(Message.Activated({ id })))] : []),\n ]\n },\n },\n },\n { name: 'Selection' },\n )\n }\n","/**\n * `Targets` as a Behavior: attaches the `foldkit-primitives/dom` Mount to a\n * container slot and maps what it reports into the view's Messages. No Bundle:\n * which descendant is under the pointer, or was pressed, is already a fact, and\n * what it means is the parent's `update`.\n */\nimport * as Mount from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { Targets as TargetsMount, type TargetFact } from '../dom/targets.js'\n\nexport {\n TargetHovered,\n TargetPressed,\n Targets as mount,\n targetOf,\n type TargetFact,\n} from '../dom/targets.js'\n\nexport interface BehaviorOptions<Slots, ParentMessage> {\n /** The slot holding the marked descendants. */\n readonly container: keyof Slots & string\n /** The attribute that marks a descendant, holding its id. */\n readonly attribute: string\n /** Prevent a press's default, such as a link navigating. Default `false`. */\n readonly preventDefault?: boolean\n /** Turns each fact into the view's Message. */\n readonly toMessage: (fact: TargetFact) => ParentMessage\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Slots, ParentMessage>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: () =>\n Mount.mapMessage(\n TargetsMount({\n attribute: options.attribute,\n preventDefault: options.preventDefault ?? false,\n }),\n options.toMessage,\n ),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'Targets' },\n )\n","/**\n * `PointerDrag` as a Behavior: attaches the `foldkit-primitives/dom` Mount to\n * a container slot and maps what it reports into the view's Messages. No\n * Bundle: what is dragged and where the pointer is are facts, and what a drop\n * means, and whether it is allowed, is the parent's `update`.\n */\nimport * as Mount from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\nimport { PointerDrag as PointerDragMount, type DragFact } from '../dom/pointer-drag.js'\n\nexport {\n DRAG_THRESHOLD,\n DragCancelled,\n DragDropped,\n DragPlace,\n DragStarted,\n DragZone,\n DraggedOver,\n PointerDrag as mount,\n boxOf,\n zoneOf,\n type DragFact,\n} from '../dom/pointer-drag.js'\n\nexport interface BehaviorOptions<Slots, ParentMessage> {\n /** The slot holding the marked descendants. */\n readonly container: keyof Slots & string\n /** The attribute that marks a descendant, holding its id. */\n readonly attribute: string\n /**\n * Where a drag may land when not among the container's own: elements marked\n * by `attribute` inside the one `within` selects, such as a page for a palette.\n */\n readonly targets?: { readonly attribute: string; readonly within: string }\n /** An attribute naming a part of what a drop lands on, which the place then carries. */\n readonly part?: string\n /** Turns each fact into the view's Message. */\n readonly toMessage: (fact: DragFact) => ParentMessage\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(\n options: BehaviorOptions<Slots, ParentMessage>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: () =>\n Mount.mapMessage(\n PointerDragMount({\n attribute: options.attribute,\n ...(options.targets === undefined ? {} : { targets: options.targets }),\n ...(options.part === undefined ? {} : { part: options.part }),\n }),\n options.toMessage,\n ),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'PointerDrag' },\n )\n","/**\n * Keeps a floating panel inside the viewport: on insert it shifts left past\n * the right edge and flips above its trigger when the bottom overflows and\n * the room overhead fits; on release every inline prop goes. `placeFor` is\n * pure geometry over rects, so the rule is unit-tested and the Mount only\n * reads and writes. Inert without layout (zero rects never overflow), with\n * no timers, observers, or reposition loops.\n *\n * `placeAt` is the other half, for a popup that must open under the trigger\n * that opened it. It writes `left` and `--fk-placed-top` once, relative to\n * the popup's offset parent; the panel's stylesheet reads the variable as\n * `top`, so `keepWithin` can still replace `top` when it flips. Key the\n * popup by the trigger: a Mount reads its args at insert and never again.\n * `placeAtPoint` is the same write for a viewport point, when the open\n * event carried coordinates the message builder dropped. The two mounts\n * start together, so the fit may run before that write; the write measures\n * again. A point that would hang past the bottom shifts up. A trigger still\n * flips, and the panel is marked `data-fk-placed=\"above\"` so a hover bridge\n * can follow the side that opened.\n * Zero-size rects stay at the origin, so an inert document writes nothing\n * a layout pass would have to undo.\n *\n * Three related pieces this is not:\n *\n * - `Anchor.behavior` (`foldkit-mixins-ui`) binds a floating element to\n * another element's id through floating-ui, with portals and continuous\n * repositioning. It relocates nodes out from under the runtime (portal by\n * default) and burns under zero geometry; reach for it when the panel must\n * track a moving anchor, not for a popup placed once.\n * - `KeepInView` (`foldkit-primitives/dom`) scrolls newly marked content\n * into view. Same verb, opposite direction: that one moves the page to\n * the panel, this one moves the panel into the page.\n * - `Overlay.behaviors` owns dismissal, focus, scroll lock, and inertness,\n * but no positioning; spread this alongside it for the full overlay.\n */\nimport { Effect, Option, Schema, Stream } from 'effect'\nimport * as Mount from 'foldkit/mount'\nimport { Behavior, Capability } from 'foldkit-mixins'\n\nexport interface PanelRect {\n readonly top: number\n readonly right: number\n readonly bottom: number\n readonly height: number\n}\n\nexport interface Viewport {\n readonly width: number\n readonly height: number\n}\n\nexport interface Placed {\n /** Pixels to move left; `0` when the panel fits. */\n readonly dx: number\n /** Whether the panel stands above its trigger instead of below. */\n readonly flip: boolean\n}\n\n/** Where the panel goes so it fits: left by the overflow, above when the\n * bottom clears the window and the room overhead fits the panel. */\nexport const placeFor = (rect: PanelRect, viewport: Viewport, margin = 8): Placed => {\n const over = rect.right - viewport.width + margin\n return {\n dx: over > 0 ? -over : 0,\n flip: rect.bottom > viewport.height && rect.top - margin >= rect.height,\n }\n}\n\n/** Pixels to move a box up so its bottom sits `margin` inside the viewport.\n * `0` when it already fits, or when its top is already at the margin. */\nexport const shiftIntoViewport = (\n rect: { readonly top: number; readonly bottom: number },\n viewportHeight: number,\n margin = 8,\n): number => {\n const overflow = rect.bottom - (viewportHeight - margin)\n if (overflow <= 0) return 0\n const room = rect.top - margin\n if (room <= 0) return 0\n return Math.min(overflow, room)\n}\n\n/** Attribute `keepWithin` sets to `placedAbove` when the panel flips. */\nexport const placedSide = 'data-fk-placed'\n\n/** Value of `placedSide` while the panel stands above its anchor. */\nexport const placedAbove = 'above'\n\nexport interface AnchorRect {\n readonly left: number\n readonly top: number\n readonly bottom: number\n readonly width: number\n readonly height: number\n}\n\nexport interface OriginRect {\n readonly left: number\n readonly top: number\n}\n\nexport interface PlacedAt {\n readonly left: number\n readonly top: number\n}\n\n/** Custom property `PlaceAt` writes. A panel reads it as `top` so a viewport\n * flip, which sets the `top` property, still wins. */\nexport const placedTop = '--fk-placed-top'\n\n/** Where a popup sits under its trigger's left edge, in the offset parent's\n * coordinates. A zero-size trigger (an inert document) stays at the origin. */\nexport const placeAt = (trigger: AnchorRect, origin: OriginRect, gap = 4): PlacedAt => {\n if (trigger.width === 0 && trigger.height === 0) return { left: 0, top: 0 }\n return {\n left: trigger.left - origin.left,\n top: trigger.bottom - origin.top + gap,\n }\n}\n\nexport interface ViewportPoint {\n readonly x: number\n readonly y: number\n}\n\n/** Where a popup's top-left sits on a viewport point, in the offset parent's\n * coordinates. A context menu uses it: the right-click event carries the\n * point, and `OnContextMenu` does not. */\nexport const placeAtPoint = (point: ViewportPoint, origin: OriginRect): PlacedAt => ({\n left: point.x - origin.left,\n top: point.y - origin.top,\n})\n\nconst clearFit = (element: HTMLElement): void => {\n element.style.translate = ''\n element.style.top = ''\n element.style.bottom = ''\n element.removeAttribute(placedSide)\n}\n\nconst fitWithin = (element: HTMLElement): void => {\n // A previous fit may have flipped. Clear it before reading, or the next\n // decision would describe the flipped box.\n clearFit(element)\n const rect = element.getBoundingClientRect()\n const placed = placeFor(\n { top: rect.top, right: rect.right, bottom: rect.bottom, height: rect.height },\n { width: document.documentElement.clientWidth, height: window.innerHeight },\n )\n if (placed.dx !== 0) element.style.translate = `${placed.dx}px 0`\n if (placed.flip) {\n element.style.top = 'auto'\n element.style.bottom = 'calc(100% + 4px)'\n element.setAttribute(placedSide, placedAbove)\n }\n}\n\n// PlaceAt and KeepWithin start together (`Stream.mergeAll`), so the fit can\n// run before the placement write. The write calls whoever is waiting.\nconst refits = new WeakMap<HTMLElement, Set<() => void>>()\n\nconst onPlaced = (element: HTMLElement, refit: () => void): void => {\n const waiting = refits.get(element) ?? new Set()\n waiting.add(refit)\n refits.set(element, waiting)\n}\n\nconst offPlaced = (element: HTMLElement, refit: () => void): void => {\n const waiting = refits.get(element)\n if (waiting === undefined) return\n waiting.delete(refit)\n if (waiting.size === 0) refits.delete(element)\n}\n\nconst notifyPlaced = (element: HTMLElement): void => {\n const waiting = refits.get(element)\n if (waiting === undefined) return\n for (const refit of waiting) refit()\n}\n\nconst applyPlaced = (element: HTMLElement, placed: PlacedAt): void => {\n element.style.left = `${placed.left}px`\n element.style.setProperty(placedTop, `${placed.top}px`)\n}\n\nconst clearPlaced = (element: HTMLElement): void => {\n element.style.left = ''\n element.style.removeProperty(placedTop)\n}\n\nconst writePlaced = (element: HTMLElement, placed: PlacedAt, shift: boolean): void => {\n clearFit(element)\n applyPlaced(element, placed)\n if (shift) {\n const rect = element.getBoundingClientRect()\n const dy = shiftIntoViewport({ top: rect.top, bottom: rect.bottom }, window.innerHeight)\n if (dy !== 0) element.style.setProperty(placedTop, `${placed.top - dy}px`)\n }\n notifyPlaced(element)\n}\n\nexport const KeepWithin = Mount.defineStream('KeepWithin', {\n messages: [Schema.Never],\n execute: ({ element }) =>\n Stream.callback<never>(() => {\n if (!(element instanceof HTMLElement)) {\n return Effect.acquireRelease(Effect.void, () => Effect.void)\n }\n const node = element\n const refit = (): void => fitWithin(node)\n return Effect.acquireRelease(\n Effect.sync(() => {\n onPlaced(node, refit)\n refit()\n }),\n () =>\n Effect.sync(() => {\n offPlaced(node, refit)\n clearFit(node)\n }),\n )\n }),\n})\n\nconst paddingEdge = (node: HTMLElement): OriginRect => {\n const rect = node.getBoundingClientRect()\n // Absolute `left`/`top` start at the padding edge; the rect is the border box.\n return { left: rect.left + node.clientLeft, top: rect.top + node.clientTop }\n}\n\nconst originOf = (element: HTMLElement): OriginRect => {\n const originNode = element.offsetParent\n return originNode instanceof HTMLElement ? paddingEdge(originNode) : { left: 0, top: 0 }\n}\n\nexport const PlaceAt = Mount.defineStream('PlaceAt', {\n messages: [Schema.Never],\n args: {\n /** Element id of the trigger the popup opens under. */\n triggerId: Schema.String,\n /** Pixels between the trigger's bottom and the popup. */\n gap: Schema.Number,\n },\n execute: ({ element, triggerId, gap }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n Effect.sync(() => {\n if (!(element instanceof HTMLElement)) return\n const trigger = document.getElementById(triggerId)\n if (!(trigger instanceof HTMLElement)) return\n const rect = trigger.getBoundingClientRect()\n writePlaced(\n element,\n placeAt(\n {\n left: rect.left,\n top: rect.top,\n bottom: rect.bottom,\n width: rect.width,\n height: rect.height,\n },\n originOf(element),\n gap,\n ),\n false,\n )\n }),\n () =>\n Effect.sync(() => {\n if (!(element instanceof HTMLElement)) return\n clearPlaced(element)\n }),\n ),\n ),\n})\n\nexport const PlaceAtPoint = Mount.defineStream('PlaceAtPoint', {\n messages: [Schema.Never],\n args: {\n /** Viewport x of the popup's top-left. */\n x: Schema.Number,\n /** Viewport y of the popup's top-left. */\n y: Schema.Number,\n },\n execute: ({ element, x, y }) =>\n Stream.callback<never>(() =>\n Effect.acquireRelease(\n Effect.sync(() => {\n if (!(element instanceof HTMLElement)) return\n // The offset parent is not the point. Shifting keeps the menu beside\n // it; flipping would send the menu above that parent.\n writePlaced(element, placeAtPoint({ x, y }, originOf(element)), true)\n }),\n () =>\n Effect.sync(() => {\n if (!(element instanceof HTMLElement)) return\n clearPlaced(element)\n }),\n ),\n ),\n})\n\nexport const placeAtTrigger =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(options: {\n readonly panel: keyof Slots & string\n /** The trigger this open belongs to. Read at insert, so key the panel by it. */\n readonly triggerId: (input: Input) => string\n readonly gap?: number\n /** A viewport point wins over the trigger. None places under `triggerId`. */\n readonly at?: (input: Input) => Option.Option<ViewportPoint>\n }): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.panel]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: input => {\n const at = options.at?.(input) ?? Option.none()\n return Option.isSome(at)\n ? PlaceAtPoint({ x: at.value.x, y: at.value.y })\n : PlaceAt({ triggerId: options.triggerId(input), gap: options.gap ?? 4 })\n },\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'PlaceAt' },\n )\n\nexport const keepWithin =\n <Slots>(slots: Slots) =>\n <Input, ParentMessage>(options: {\n readonly panel: keyof Slots & string\n }): Behavior.NamedBehavior<Slots, Input, ParentMessage> =>\n Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.panel]: Behavior.slot({\n requires: { capability: Capability.Container },\n mount: () => KeepWithin(),\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'KeepWithin' },\n )\n","/**\n * Keyboard navigation of a tree (a file explorer, a page's layers, a nested\n * menu), after the WAI-ARIA tree pattern: one tab stop, Up and Down through the\n * rows that are showing, Right to open a row or step into it, Left to close it\n * or step out to its parent, Home and End to the first and last row.\n *\n * The Model slice is the current row's id and which rows are open. Openness is\n * stored as the rows `toggled` away from a default, so a layers panel that\n * starts with everything open and a file tree that starts closed are the same\n * bundle with a different `openByDefault`, and neither stores every row.\n *\n * Which rows exist is the view's to say, each with its parent, in tree order.\n * What a key does is a pure function of those rows and the Model; the Behavior\n * wires it to the slots and writes the tree's ARIA attributes.\n */\nimport { Option, Schema } from 'effect'\nimport type { HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport { defineMessageUnion } from 'foldkit/message'\nimport { Bundle } from 'foldkit-bundle'\nimport type { Declared } from 'foldkit-bundle'\nimport { Behavior, Capability, type SlotItem } from 'foldkit-mixins'\nimport { FollowTabStop } from '../dom/follow-tab-stop.js'\nimport { idSelector } from './roving-tabindex.js'\nimport { perInput } from '../internal.js'\n\nexport const Model = Schema.Struct({\n /** The current row's id, or `null` before any row has been focused. */\n current: Schema.NullOr(Schema.String),\n /** The rows whose open state differs from `openByDefault`. */\n toggled: Schema.Array(Schema.String),\n})\nexport type Model = typeof Model.Type\n\nexport const Message = defineMessageUnion({\n /** A row became current: the user focused it, or a key moved there. */\n Focused: { id: Schema.String },\n Opened: { id: Schema.String },\n Closed: { id: Schema.String },\n})\nexport type Message = typeof Message.Type\n\nexport const Args = Schema.Struct({\n /** Whether a row with children starts open. */\n openByDefault: Schema.Boolean,\n})\nexport type Args = typeof Args.Type\n\n/** Whether a row is open, given the default and what was toggled. */\nexport const isOpen = (model: Model, args: Args, id: string): boolean =>\n args.openByDefault !== model.toggled.includes(id)\n\nconst setOpen = (model: Model, args: Args, id: string, open: boolean): Model =>\n isOpen(model, args, id) === open\n ? model\n : {\n ...model,\n toggled: model.toggled.includes(id)\n ? model.toggled.filter(toggled => toggled !== id)\n : [...model.toggled, id],\n }\n\nexport const bundle = Bundle.make('TreeNavigation', {\n Model,\n Message,\n args: Args,\n init: () => ({ model: { current: null, toggled: [] } }),\n update: (model, message, args) => {\n switch (message._tag) {\n // Moving focus by key dispatches `Focused`, and the row's `OnFocus` reports it again.\n case 'Focused':\n return model.current === message.id\n ? { model }\n : { model: { ...model, current: message.id } }\n case 'Opened':\n return { model: setOpen(model, args, message.id, true) }\n case 'Closed':\n return { model: setOpen(model, args, message.id, false) }\n }\n },\n})\n\n/** One row of the tree, in tree order: a parent comes before its children. */\nexport interface Row {\n readonly id: string\n /** The parent's id, or `null` for a top-level row. */\n readonly parent: string | null\n /** Whether it has children, so it can be opened and closed. */\n readonly branch: boolean\n readonly disabled?: boolean\n}\n\n/** A row as it is showing: where it sits, for its ARIA attributes. */\nexport interface Shown extends Row {\n /** 1 for a top-level row. */\n readonly level: number\n /** Its place among its siblings, from 1, and how many there are. */\n readonly position: number\n readonly siblings: number\n}\n\n/**\n * The rows that are showing: every row whose ancestors are all open, with its\n * level and its place among its siblings. A row whose parent is not a row is\n * treated as top-level.\n */\nexport const shown = (rows: ReadonlyArray<Row>, model: Model, args: Args): ReadonlyArray<Shown> => {\n const byId = new Map(rows.map(row => [row.id, row]))\n // Each row's place among its siblings, counted once: a page of a thousand rows\n // under one parent is not a million steps.\n const siblingsOf = new Map<string | null, number>()\n const positionOf = new Map<string, number>()\n for (const row of rows) {\n const parent = row.parent !== null && byId.has(row.parent) ? row.parent : null\n const count = (siblingsOf.get(parent) ?? 0) + 1\n siblingsOf.set(parent, count)\n positionOf.set(row.id, count)\n }\n const levels = new Map<string, number>()\n const showing = new Map<string, boolean>()\n const result: Array<Shown> = []\n for (const row of rows) {\n const parent = row.parent !== null && byId.has(row.parent) ? row.parent : null\n const level = parent === null ? 1 : (levels.get(parent) ?? 0) + 1\n levels.set(row.id, level)\n const visible = parent === null || (showing.get(parent) === true && isOpen(model, args, parent))\n showing.set(row.id, visible)\n if (!visible) continue\n result.push({\n ...row,\n level,\n position: positionOf.get(row.id) ?? 1,\n siblings: siblingsOf.get(parent) ?? 1,\n })\n }\n return result\n}\n\n/** What a key does: move to a row, or open or close one. */\nexport type Action =\n | { readonly _tag: 'Focus'; readonly id: string }\n | { readonly _tag: 'Open'; readonly id: string }\n | { readonly _tag: 'Close'; readonly id: string }\n\nconst isPlain = (modifiers: KeyboardModifiers): boolean =>\n !modifiers.ctrlKey && !modifiers.altKey && !modifiers.metaKey\n\n/**\n * What a key does from the current row, over the rows that are showing, or\n * `undefined` when it is not a key the tree handles. Disabled rows are stepped\n * over. With nothing current, Down and Home land on the first row, Up and End\n * on the last. Right and Left swap under `rtl`.\n */\nexport const move = (\n rows: ReadonlyArray<Shown>,\n current: string | null,\n key: string,\n modifiers: KeyboardModifiers,\n model: Model,\n args: Args,\n direction: 'ltr' | 'rtl' = 'ltr',\n): Action | undefined => {\n const enabled = rows.filter(row => row.disabled !== true)\n if (enabled.length === 0 || !isPlain(modifiers)) return undefined\n const focus = (row: Row | undefined): Action | undefined =>\n row === undefined ? undefined : { _tag: 'Focus', id: row.id }\n const at = enabled.findIndex(row => row.id === current)\n const inward = direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight'\n const outward = direction === 'rtl' ? 'ArrowRight' : 'ArrowLeft'\n if (key === 'Home') return focus(enabled[0])\n if (key === 'End') return focus(enabled[enabled.length - 1])\n if (key === 'ArrowDown')\n return focus(at === -1 ? enabled[0] : enabled[Math.min(at + 1, enabled.length - 1)])\n if (key === 'ArrowUp')\n return focus(at === -1 ? enabled[enabled.length - 1] : enabled[Math.max(at - 1, 0)])\n const row = enabled[at]\n if (row === undefined) return key === inward || key === outward ? focus(enabled[0]) : undefined\n if (key === inward) {\n if (!row.branch) return undefined\n if (!isOpen(model, args, row.id)) return { _tag: 'Open', id: row.id }\n return focus(enabled.find(child => child.parent === row.id))\n }\n if (key === outward) {\n if (row.branch && isOpen(model, args, row.id)) return { _tag: 'Close', id: row.id }\n return focus(enabled.find(parent => parent.id === row.parent))\n }\n return undefined\n}\n\n/** The row that holds the tab stop: the current one while it is showing, else the first. */\nexport const tabStop = (rows: ReadonlyArray<Shown>, current: string | null): string | undefined => {\n const here = rows.find(row => row.id === current && row.disabled !== true)\n return (here ?? rows.find(row => row.disabled !== true))?.id\n}\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot that receives the keys: the element with `role=\"tree\"`. */\n readonly container: keyof Slots & string\n /** The slot rendered once per showing row, with `item.id` or `item.index` into `shown`. */\n readonly item: keyof Slots & string\n /** Every row, open or not, in tree order. */\n readonly rows: (input: Input) => ReadonlyArray<Row>\n /** The DOM id a row's element carries. Default: the row's own id. */\n readonly domId?: (id: string) => string\n readonly direction?: (input: Input) => 'ltr' | 'rtl'\n}\n\n/** The rows showing for one input, with what each row's attributes look up. */\ninterface Prepared {\n readonly model: Model\n readonly rows: ReadonlyArray<Shown>\n readonly byId: ReadonlyMap<string, Shown>\n readonly stop: string | undefined\n}\n\n/**\n * Wires a placed `TreeNavigation` to the slots. The container's keys move focus\n * to the row they pick, or open or close the current row with focus left where\n * it is. Each showing row gets its id, `role=\"treeitem\"`, `aria-level` (and\n * the same level as `--fk-tree-level`, so one `calc` indents any depth),\n * `aria-posinset`, `aria-setsize`, `aria-expanded` when it has children,\n * `aria-disabled` when disabled, a roving `tabindex`, and `OnFocus` reporting\n * it current. Every handled key is default-prevented.\n */\n\nexport const behavior =\n <Field extends string>(declared: Declared<typeof bundle, Field>, args: Args) =>\n <Slots>(slots: Slots) =>\n <Input extends { readonly [K in Field]: Model }, ParentMessage>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, ParentMessage> => {\n const wrap = (message: Message): ParentMessage =>\n declared.wrapper.make(message) as unknown as ParentMessage\n const slice = (input: Input): Model => input[declared.field]\n const domId = options.domId ?? ((id: string) => id)\n // Every row's attributes read the same rows: work them out once per input,\n // or a tree of n rows costs n times its whole.\n const prepare = perInput((input: Input): Prepared => {\n const model = slice(input)\n const rows = shown(options.rows(input), model, args)\n return {\n model,\n rows,\n byId: new Map(rows.map(row => [row.id, row])),\n stop: tabStop(rows, model.current),\n }\n })\n return Behavior.forSlots(slots)<Input, ParentMessage>(\n {\n [options.container]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n // Focus in the tree stays on its stop when an edit elsewhere moves or removes it.\n mount: () => FollowTabStop(),\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n }) => {\n const { model, rows } = prepare(input)\n const direction = options.direction?.(input) ?? 'ltr'\n return [\n h.OnKeyDownFocus((key, modifiers) => {\n const action = move(rows, model.current, key, modifiers, model, args, direction)\n if (action === undefined) return Option.none()\n // Opening or closing keeps focus on the row it acted on.\n const message =\n action._tag === 'Focus'\n ? Message.Focused({ id: action.id })\n : action._tag === 'Open'\n ? Message.Opened({ id: action.id })\n : Message.Closed({ id: action.id })\n return Option.some({\n focusSelector: idSelector(domId(action.id)),\n message: wrap(message),\n })\n }),\n ]\n },\n }),\n [options.item]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<ParentMessage>\n readonly item?: SlotItem\n }) => {\n if (item === undefined) return []\n const { model, rows, byId, stop } = prepare(input)\n const row = item.id === undefined ? rows[item.index] : byId.get(item.id)\n if (row === undefined) return []\n return [\n h.Id(domId(row.id)),\n h.Role('treeitem'),\n h.AriaLevel(row.level),\n h.Style({ '--fk-tree-level': String(row.level) }),\n h.AriaPosinset(row.position),\n h.AriaSetsize(row.siblings),\n ...(row.branch ? [h.AriaExpanded(isOpen(model, args, row.id))] : []),\n ...(row.disabled === true ? [h.AriaDisabled(true)] : []),\n h.Tabindex(stop === row.id ? 0 : -1),\n h.OnFocus(wrap(Message.Focused({ id: row.id }))),\n ]\n },\n }),\n // Keyed by values the caller chose; `forSlots` checks both keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, ParentMessage>,\n { name: 'TreeNavigation' },\n )\n }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAa,cACoB,cACvB,WAEN,MACA,YAC+C;CAC/C,MAAM,QAAQ,YACZ,SAAS,QAAQ,KAAK,OAAO;CAC/B,MAAM,QAAmE,OAAO,OAAO,IAAI;CAC3F,KAAK,MAAM,CAAC,MAAM,SAAS,OAAO,QAChC,IACF,GAAG;EACD,IAAI,SA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IAAI,KAAK,EAAE,CAAC;KAChD,EAAE,aAAa,IAAI,QAAQ;KAC3B,EAAE,YAAY,IAAI,QAAQ;KAC1B,GAAI,IAAI,SAAS,CAAC,EAAE,aAAa,OAAO,OAAO,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;KAClE,GAAI,IAAI,aAAa,OAAO,CAAC,EAAE,aAAa,IAAI,CAAC,IAAI,CAAC;KACtD,EAAE,SAAS,SAAS,IAAI,KAAK,IAAI,EAAE;KACnC,EAAE,QAAQ,KAAK,QAAQ,QAAQ,EAAE,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;IACjD;GACF;EACF,CAAC;CAEH,GACA,EAAE,MAAM,iBAAiB,CAC3B;AACF"}
|
package/dist/motion/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SpringMessage, c as PresenceMessage, d as motion_d_exports, i as Spring, l as PresenceModel, n as TweenMessage, o as SpringModel, r as TweenModel, s as Presence, t as Tween, u as isVisible } from "../index-
|
|
1
|
+
import { a as SpringMessage, c as PresenceMessage, d as motion_d_exports, i as Spring, l as PresenceModel, n as TweenMessage, o as SpringModel, r as TweenModel, s as Presence, t as Tween, u as isVisible } from "../index-CmmxqSEi.mjs";
|
|
2
2
|
export { motion_d_exports as Motion, Presence, PresenceMessage, PresenceModel, Spring, SpringMessage, SpringModel, Tween, TweenMessage, TweenModel, isVisible };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-primitives",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"description": "Ready-made primitives for the Elm architecture, packaged with foldkit-bundle: media queries, presence, timers, pagination, history, sockets, observers, clipboard, and interaction Bundles with their Behaviors.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -89,23 +89,23 @@
|
|
|
89
89
|
"LICENSE"
|
|
90
90
|
],
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"foldkit-bundle": "0.8.
|
|
92
|
+
"foldkit-bundle": "0.8.1"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"effect": "^4.0.0",
|
|
96
|
-
"foldkit": "^0.
|
|
97
|
-
"foldkit-mixins": "^0.
|
|
96
|
+
"foldkit": "^0.169.0",
|
|
97
|
+
"foldkit-mixins": "^0.19.1"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
|
-
"@effect/platform-browser": "^4.0.
|
|
100
|
+
"@effect/platform-browser": "^4.0.5",
|
|
101
101
|
"@types/ws": "^8.18.2",
|
|
102
|
-
"effect": "^4.0.
|
|
103
|
-
"foldkit": "0.
|
|
104
|
-
"jsdom": "30.1.
|
|
102
|
+
"effect": "^4.0.5",
|
|
103
|
+
"foldkit": "0.169.0",
|
|
104
|
+
"jsdom": "30.1.3",
|
|
105
105
|
"tsdown": "^0.23.1",
|
|
106
106
|
"typescript": "7.0.2",
|
|
107
107
|
"ws": "^8.22.0",
|
|
108
|
-
"foldkit-mixins": "0.
|
|
108
|
+
"foldkit-mixins": "0.19.1"
|
|
109
109
|
},
|
|
110
110
|
"peerDependenciesMeta": {
|
|
111
111
|
"foldkit-mixins": {
|