foldkit-primitives 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +514 -43
- package/dist/device/index.d.mts +11 -11
- package/dist/device/index.d.mts.map +1 -1
- package/dist/device/index.mjs +95 -87
- package/dist/device/index.mjs.map +1 -1
- package/dist/dom/index.d.mts +71 -1
- package/dist/dom/index.d.mts.map +1 -1
- package/dist/dom/index.mjs +303 -5
- package/dist/dom/index.mjs.map +1 -1
- package/dist/editable-text-CKkS_mWt.d.mts +235 -0
- package/dist/editable-text-CKkS_mWt.d.mts.map +1 -0
- package/dist/events/index.d.mts +10 -1
- package/dist/events/index.d.mts.map +1 -1
- package/dist/events/index.mjs +34 -18
- package/dist/events/index.mjs.map +1 -1
- package/dist/follow-tab-stop-DpxwLXvU.mjs +800 -0
- package/dist/follow-tab-stop-DpxwLXvU.mjs.map +1 -0
- package/dist/index-Cppf-lBx.d.mts +130 -0
- package/dist/index-Cppf-lBx.d.mts.map +1 -0
- package/dist/index.d.mts +8 -6
- package/dist/index.mjs +8 -6
- package/dist/input-modality-DGOhAknO.d.mts +26 -0
- package/dist/input-modality-DGOhAknO.d.mts.map +1 -0
- package/dist/input-modality-m6v7__Xs.mjs +43 -0
- package/dist/input-modality-m6v7__Xs.mjs.map +1 -0
- package/dist/interaction/index.d.mts +1017 -0
- package/dist/interaction/index.d.mts.map +1 -0
- package/dist/interaction/index.mjs +1647 -0
- package/dist/interaction/index.mjs.map +1 -0
- package/dist/internal-DP-xLKbT.mjs +37 -0
- package/dist/internal-DP-xLKbT.mjs.map +1 -0
- package/dist/media/index.d.mts.map +1 -1
- package/dist/media/index.mjs +3 -3
- package/dist/media/index.mjs.map +1 -1
- package/dist/motion/index.d.mts +2 -112
- package/dist/motion/index.mjs +2 -208
- package/dist/motion-DGGBZ0wt.mjs +240 -0
- package/dist/motion-DGGBZ0wt.mjs.map +1 -0
- package/dist/net/index.d.mts +68 -4
- package/dist/net/index.d.mts.map +1 -1
- package/dist/net/index.mjs +139 -56
- package/dist/net/index.mjs.map +1 -1
- package/dist/observers/index.d.mts +1 -1
- package/dist/observers/index.mjs +3 -0
- package/dist/observers/index.mjs.map +1 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/state/index.d.mts +57 -15
- package/dist/state/index.d.mts.map +1 -1
- package/dist/state/index.mjs +198 -90
- package/dist/state/index.mjs.map +1 -1
- package/dist/time/index.d.mts +21 -1
- package/dist/time/index.d.mts.map +1 -1
- package/dist/time/index.mjs +48 -19
- package/dist/time/index.mjs.map +1 -1
- package/package.json +31 -8
- package/dist/motion/index.d.mts.map +0 -1
- package/dist/motion/index.mjs.map +0 -1
|
@@ -0,0 +1,1017 @@
|
|
|
1
|
+
import { A as ScrollLock, C as targetOf, D as MoveStarted, E as MoveEnded, M as tabbableWithin, O as Moved, S as Targets, T as Move, _ as boxOf, a as TextEdited, b as TargetHovered, c as DRAG_THRESHOLD, d as DragFact, f as DragPlace, g as PointerDrag, h as DraggedOver, i as TextCommitted, j as FocusScope, k as HideOutside, l as DragCancelled, m as DragZone, n as EditableText, o as TextFact, p as DragStarted, r as TextCancelled, s as textOf, t as EditAsked, u as DragDropped, v as zoneOf, w as Fact$1, x as TargetPressed, y as TargetFact } from "../editable-text-CKkS_mWt.mjs";
|
|
2
|
+
import { a as modalityOfKey, i as Modality, r as InputModalityModel, t as InputModality } from "../input-modality-DGOhAknO.mjs";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
import * as Mount from "foldkit/mount";
|
|
5
|
+
import { Bundle, Declared } from "foldkit-bundle";
|
|
6
|
+
import { Behavior, Behaviors, SlotItem } from "foldkit-mixins";
|
|
7
|
+
import { Attribute, Html, HtmlBuilder, KeyboardModifiers } from "foldkit/html";
|
|
8
|
+
declare namespace dismiss_layer_d_exports {
|
|
9
|
+
export { BehaviorOptions$14 as BehaviorOptions, Dismiss, LAYER_ATTRIBUTE, Layer$1 as Layer, Message$9 as Message, Model$9 as Model, TRIGGER_ATTRIBUTE, behavior$14 as behavior, bundle$9 as bundle, layersOnPath, toDismiss };
|
|
10
|
+
}
|
|
11
|
+
declare const LAYER_ATTRIBUTE = "data-foldkit-plus-layer";
|
|
12
|
+
declare const TRIGGER_ATTRIBUTE = "data-foldkit-plus-layer-trigger";
|
|
13
|
+
/** An open layer as the document showed it: bottom to top is DOM order. */
|
|
14
|
+
declare const Layer$1: Schema.Struct<{
|
|
15
|
+
readonly id: Schema.String;
|
|
16
|
+
/** Dismiss on a press outside it. */
|
|
17
|
+
readonly outside: Schema.Boolean;
|
|
18
|
+
/** Dismiss on Escape when topmost. */
|
|
19
|
+
readonly escape: Schema.Boolean;
|
|
20
|
+
}>;
|
|
21
|
+
type Layer$1 = typeof Layer$1.Type;
|
|
22
|
+
declare const Model$9: Schema.Struct<{
|
|
23
|
+
/** The open layers at the last event, bottom to top. */
|
|
24
|
+
readonly layers: Schema.$Array<Schema.Struct<{
|
|
25
|
+
readonly id: Schema.String;
|
|
26
|
+
/** Dismiss on a press outside it. */
|
|
27
|
+
readonly outside: Schema.Boolean;
|
|
28
|
+
/** Dismiss on Escape when topmost. */
|
|
29
|
+
readonly escape: Schema.Boolean;
|
|
30
|
+
}>>;
|
|
31
|
+
}>;
|
|
32
|
+
type Model$9 = typeof Model$9.Type;
|
|
33
|
+
declare const Message$9: import("foldkit/message").MessageUnion<{
|
|
34
|
+
/** A pointer went down; `inside` are the layers whose element or trigger was on the event's path. */
|
|
35
|
+
readonly PressedAt: {
|
|
36
|
+
readonly layers: Schema.$Array<Schema.Struct<{
|
|
37
|
+
readonly id: Schema.String;
|
|
38
|
+
/** Dismiss on a press outside it. */
|
|
39
|
+
readonly outside: Schema.Boolean;
|
|
40
|
+
/** Dismiss on Escape when topmost. */
|
|
41
|
+
readonly escape: Schema.Boolean;
|
|
42
|
+
}>>;
|
|
43
|
+
readonly inside: Schema.$Array<Schema.String>;
|
|
44
|
+
};
|
|
45
|
+
readonly PressedEscape: {
|
|
46
|
+
readonly layers: Schema.$Array<Schema.Struct<{
|
|
47
|
+
readonly id: Schema.String;
|
|
48
|
+
/** Dismiss on a press outside it. */
|
|
49
|
+
readonly outside: Schema.Boolean;
|
|
50
|
+
/** Dismiss on Escape when topmost. */
|
|
51
|
+
readonly escape: Schema.Boolean;
|
|
52
|
+
}>>;
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
55
|
+
type Message$9 = typeof Message$9.Type;
|
|
56
|
+
declare const Dismiss: Schema.TaggedStruct<"Dismiss", {
|
|
57
|
+
readonly ids: Schema.$Array<Schema.String>;
|
|
58
|
+
}>;
|
|
59
|
+
type Dismiss = typeof Dismiss.Type;
|
|
60
|
+
/** Which layers a press inside `inside` dismisses: every layer above the topmost one hit, or all when none was. */
|
|
61
|
+
declare const toDismiss: (layers: ReadonlyArray<Layer$1>, inside: ReadonlyArray<string>) => ReadonlyArray<string>;
|
|
62
|
+
declare const bundle$9: Bundle.Bundle<"DismissLayer", void, {
|
|
63
|
+
readonly layers: readonly {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly outside: boolean;
|
|
66
|
+
readonly escape: boolean;
|
|
67
|
+
}[];
|
|
68
|
+
}, {
|
|
69
|
+
readonly _tag: "PressedAt";
|
|
70
|
+
readonly layers: readonly {
|
|
71
|
+
readonly id: string;
|
|
72
|
+
readonly outside: boolean;
|
|
73
|
+
readonly escape: boolean;
|
|
74
|
+
}[];
|
|
75
|
+
readonly inside: readonly string[];
|
|
76
|
+
} | {
|
|
77
|
+
readonly _tag: "PressedEscape";
|
|
78
|
+
readonly layers: readonly {
|
|
79
|
+
readonly id: string;
|
|
80
|
+
readonly outside: boolean;
|
|
81
|
+
readonly escape: boolean;
|
|
82
|
+
}[];
|
|
83
|
+
}, {
|
|
84
|
+
readonly _tag: "Dismiss";
|
|
85
|
+
readonly ids: readonly string[];
|
|
86
|
+
}, never, never, void, {}, {}>;
|
|
87
|
+
/** The layer ids whose element or trigger is on the event's composed path. */
|
|
88
|
+
declare const layersOnPath: (path: ReadonlyArray<EventTarget>) => ReadonlyArray<string>;
|
|
89
|
+
interface BehaviorOptions$14<Input, Slots> {
|
|
90
|
+
/** The layer's root, rendered only while the layer is open. */
|
|
91
|
+
readonly layer: keyof Slots & string;
|
|
92
|
+
/** The element that opens the layer, so a press on it is inside. */
|
|
93
|
+
readonly trigger?: keyof Slots & string;
|
|
94
|
+
readonly id: (input: Input) => string;
|
|
95
|
+
/** Dismiss on a press outside. Default `true`. */
|
|
96
|
+
readonly outsidePress?: boolean;
|
|
97
|
+
/** Dismiss on Escape when topmost. Default `true`. */
|
|
98
|
+
readonly escape?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Marks the layer's container and trigger for the placed stack. The layer
|
|
102
|
+
* takes part only while its element is rendered, so an `open` flag in the
|
|
103
|
+
* parent Model is the whole lifecycle. Not for an element with `popover`,
|
|
104
|
+
* which the browser dismisses itself.
|
|
105
|
+
*/
|
|
106
|
+
declare const behavior$14: <Field extends string>(_declared: Declared<typeof bundle$9, Field>) => <Slots>(slots: Slots) => <Input, ParentMessage>(options: BehaviorOptions$14<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
107
|
+
declare namespace editable_text_d_exports {
|
|
108
|
+
export { BehaviorOptions$13 as BehaviorOptions, EditAsked, TextCancelled, TextCommitted, TextEdited, TextFact, behavior$13 as behavior, EditableText as mount, textOf };
|
|
109
|
+
}
|
|
110
|
+
interface BehaviorOptions$13<Slots, ParentMessage> {
|
|
111
|
+
/** The slot holding the fields. */
|
|
112
|
+
readonly container: keyof Slots & string;
|
|
113
|
+
/** The attribute that marks a field, holding its name. */
|
|
114
|
+
readonly attribute: string;
|
|
115
|
+
/** Turns each fact into the view's Message. */
|
|
116
|
+
readonly toMessage: (fact: TextFact) => ParentMessage;
|
|
117
|
+
}
|
|
118
|
+
declare const behavior$13: <Slots>(slots: Slots) => <Input, ParentMessage>(options: BehaviorOptions$13<Slots, ParentMessage>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
119
|
+
declare namespace focus_scope_d_exports {
|
|
120
|
+
export { BehaviorOptions$12 as BehaviorOptions, behavior$12 as behavior, FocusScope as mount, tabbableWithin };
|
|
121
|
+
}
|
|
122
|
+
interface BehaviorOptions$12<Slots> {
|
|
123
|
+
readonly container: keyof Slots & string;
|
|
124
|
+
/** Keep Tab, Shift+Tab, and a stray focus inside. Default `true`. */
|
|
125
|
+
readonly contain?: boolean;
|
|
126
|
+
/** Give focus back to what had it when the container unmounts. Default `true`. */
|
|
127
|
+
readonly restore?: boolean;
|
|
128
|
+
/** A selector inside the container to focus first. */
|
|
129
|
+
readonly initialFocus?: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* On insert the container focuses `initialFocus`, else its first tabbable
|
|
133
|
+
* descendant, else itself; with `contain`, Tab and Shift+Tab wrap inside and
|
|
134
|
+
* focus that lands outside comes back to the first tabbable; on unmount, with
|
|
135
|
+
* `restore`, focus returns to the element that had it. A dialog that is not
|
|
136
|
+
* a native `<dialog>`, a menu, or a command palette takes this.
|
|
137
|
+
*/
|
|
138
|
+
declare const behavior$12: <Slots>(slots: Slots) => <Input, ParentMessage>(options: BehaviorOptions$12<Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
139
|
+
declare namespace focus_visible_d_exports {
|
|
140
|
+
export { BehaviorOptions$11 as BehaviorOptions, Modality, InputModalityModel as Model, behavior$11 as behavior, InputModality as bundle, modalityOfKey };
|
|
141
|
+
}
|
|
142
|
+
interface BehaviorOptions$11<Slots> {
|
|
143
|
+
readonly target: keyof Slots & string;
|
|
144
|
+
}
|
|
145
|
+
declare const behavior$11: <Field extends string>(declared: Declared<typeof InputModality, Field>) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: InputModalityModel; }, ParentMessage>(options: BehaviorOptions$11<Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
146
|
+
declare namespace roving_tabindex_d_exports {
|
|
147
|
+
export { Args$8 as Args, BehaviorOptions$10 as BehaviorOptions, Direction, Message$8 as Message, Model$8 as Model, MoveOptions$1 as MoveOptions, Orientation, behavior$10 as behavior, bundle$8 as bundle, idSelector, itemAttributes, move$2 as move, tabStop$1 as tabStop };
|
|
148
|
+
}
|
|
149
|
+
declare const Orientation: Schema.Literals<readonly ["vertical", "horizontal", "both"]>;
|
|
150
|
+
type Orientation = typeof Orientation.Type;
|
|
151
|
+
declare const Model$8: Schema.Struct<{
|
|
152
|
+
/** The current item's id, or `null` before any item has been focused. */
|
|
153
|
+
readonly current: Schema.NullOr<Schema.String>;
|
|
154
|
+
}>;
|
|
155
|
+
type Model$8 = typeof Model$8.Type;
|
|
156
|
+
declare const Message$8: import("foldkit/message").MessageUnion<{
|
|
157
|
+
/** An item became current: the user focused it, or a key moved there. */
|
|
158
|
+
readonly Focused: {
|
|
159
|
+
readonly id: Schema.String;
|
|
160
|
+
};
|
|
161
|
+
}>;
|
|
162
|
+
type Message$8 = typeof Message$8.Type;
|
|
163
|
+
declare const Args$8: Schema.Struct<{
|
|
164
|
+
readonly orientation: Schema.Literals<readonly ["vertical", "horizontal", "both"]>;
|
|
165
|
+
/** Wrap from the last enabled item to the first, and back. */
|
|
166
|
+
readonly loop: Schema.Boolean;
|
|
167
|
+
/** Keep DOM focus on the container and point at the current item with
|
|
168
|
+
* `aria-activedescendant` instead of moving focus. */
|
|
169
|
+
readonly virtual: Schema.Boolean;
|
|
170
|
+
}>;
|
|
171
|
+
type Args$8 = typeof Args$8.Type;
|
|
172
|
+
declare const bundle$8: Bundle.Bundle<"RovingTabindex", {
|
|
173
|
+
readonly orientation: "vertical" | "horizontal" | "both";
|
|
174
|
+
readonly loop: boolean;
|
|
175
|
+
readonly virtual: boolean;
|
|
176
|
+
}, {
|
|
177
|
+
readonly current: string | null;
|
|
178
|
+
}, {
|
|
179
|
+
readonly _tag: "Focused";
|
|
180
|
+
readonly id: string;
|
|
181
|
+
}, never, never, never, void, {}, {}>;
|
|
182
|
+
type Direction = 'ltr' | 'rtl';
|
|
183
|
+
interface MoveOptions$1 {
|
|
184
|
+
readonly orientation: Orientation;
|
|
185
|
+
readonly loop: boolean;
|
|
186
|
+
readonly direction: Direction;
|
|
187
|
+
/** How many enabled items PageUp and PageDown move; absent, they are not handled. */
|
|
188
|
+
readonly page?: number;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The index the key moves to from `current`, over the enabled indices only, or
|
|
192
|
+
* `undefined` when the key is not a navigation key here. `current` may be
|
|
193
|
+
* `-1` (nothing current yet): arrows then land on the first or last enabled
|
|
194
|
+
* item. Under `rtl`, left and right swap. PageUp and PageDown move by `page`
|
|
195
|
+
* and clamp at the ends, never wrapping.
|
|
196
|
+
*/
|
|
197
|
+
declare const move$2: (enabled: ReadonlyArray<number>, current: number, key: string, modifiers: KeyboardModifiers, options: MoveOptions$1) => number | undefined;
|
|
198
|
+
/** The item that holds the tab stop: the current one, else the first enabled. */
|
|
199
|
+
declare const tabStop$1: (items: Behaviors.Collection.Items<unknown>, current: string | null) => number;
|
|
200
|
+
interface BehaviorOptions$10<Input, Slots> {
|
|
201
|
+
/** The slot that receives the arrow keys. */
|
|
202
|
+
readonly container: keyof Slots & string;
|
|
203
|
+
/** The slot rendered once per item; must carry the item's id (see `Behaviors.Collection`). */
|
|
204
|
+
readonly item: keyof Slots & string;
|
|
205
|
+
readonly items: (input: Input) => Behaviors.Collection.Items<unknown>;
|
|
206
|
+
/** Default `'ltr'`; return `'rtl'` to swap left and right. */
|
|
207
|
+
readonly direction?: (input: Input) => Direction;
|
|
208
|
+
}
|
|
209
|
+
/** A selector for an element by id, safe for any id. */
|
|
210
|
+
declare const idSelector: (id: string) => string;
|
|
211
|
+
/**
|
|
212
|
+
* The attributes one item gets: `tabindex` 0 when it holds the tab stop and
|
|
213
|
+
* -1 otherwise (none under `virtual`), and `OnFocus` reporting it current.
|
|
214
|
+
* Shared with `ListNavigation`.
|
|
215
|
+
*/
|
|
216
|
+
declare const itemAttributes: <ParentMessage>(h: HtmlBuilder<ParentMessage>, items: Behaviors.Collection.Items<unknown>, current: string | null, item: SlotItem, virtual: boolean, focused: (id: string) => ParentMessage) => ReadonlyArray<Attribute<ParentMessage>>;
|
|
217
|
+
/**
|
|
218
|
+
* Wires a placed `RovingTabindex` to the slots: the container's arrow, Home
|
|
219
|
+
* and End keys focus the next item (synchronously, then dispatch), each item
|
|
220
|
+
* gets `tabindex` 0 or -1 and reports `Focused` when focused. Under `virtual`
|
|
221
|
+
* DOM focus never leaves the container: the key only dispatches, the
|
|
222
|
+
* container carries `aria-activedescendant`, and items keep no `tabindex`.
|
|
223
|
+
*
|
|
224
|
+
* Every handled key is default-prevented. Nothing is written on dispose: the
|
|
225
|
+
* attributes are data, so a view that no longer attaches this leaves no
|
|
226
|
+
* `tabindex` behind.
|
|
227
|
+
*/
|
|
228
|
+
declare const behavior$10: <Field extends string>(declared: Declared<typeof bundle$8, Field>, args: Args$8) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$8; }, ParentMessage>(options: BehaviorOptions$10<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
229
|
+
declare namespace grid_navigation_d_exports {
|
|
230
|
+
export { Args$7 as Args, BehaviorOptions$9 as BehaviorOptions, Message$7 as Message, Model$7 as Model, MoveOptions, behavior$9 as behavior, bundle$7 as bundle, move$1 as move };
|
|
231
|
+
}
|
|
232
|
+
declare const Model$7: Schema.Struct<{
|
|
233
|
+
/** The current cell's id, or `null` before any cell has been focused. */
|
|
234
|
+
readonly current: Schema.NullOr<Schema.String>;
|
|
235
|
+
}>;
|
|
236
|
+
type Model$7 = typeof Model$7.Type;
|
|
237
|
+
declare const Message$7: import("foldkit/message").MessageUnion<{
|
|
238
|
+
/** A cell became current: the user focused it, or a key moved there. */
|
|
239
|
+
readonly Focused: {
|
|
240
|
+
readonly id: Schema.String;
|
|
241
|
+
};
|
|
242
|
+
}>;
|
|
243
|
+
type Message$7 = typeof Message$7.Type;
|
|
244
|
+
declare const Args$7: Schema.Struct<{
|
|
245
|
+
/** Cells per row; the last row may be short. */
|
|
246
|
+
readonly columns: Schema.Number;
|
|
247
|
+
/** Left and right continue into the previous and next row; up and down
|
|
248
|
+
* continue into the previous and next column. Off, they stop at the edge. */
|
|
249
|
+
readonly wrap: Schema.Boolean;
|
|
250
|
+
/** Keep DOM focus on the container and point at the current cell with
|
|
251
|
+
* `aria-activedescendant` instead of moving focus. */
|
|
252
|
+
readonly virtual: Schema.Boolean;
|
|
253
|
+
}>;
|
|
254
|
+
type Args$7 = typeof Args$7.Type;
|
|
255
|
+
declare const bundle$7: Bundle.Bundle<"GridNavigation", {
|
|
256
|
+
readonly columns: number;
|
|
257
|
+
readonly wrap: boolean;
|
|
258
|
+
readonly virtual: boolean;
|
|
259
|
+
}, {
|
|
260
|
+
readonly current: string | null;
|
|
261
|
+
}, {
|
|
262
|
+
readonly _tag: "Focused";
|
|
263
|
+
readonly id: string;
|
|
264
|
+
}, never, never, never, void, {}, {}>;
|
|
265
|
+
interface MoveOptions {
|
|
266
|
+
readonly columns: number;
|
|
267
|
+
readonly wrap: boolean;
|
|
268
|
+
readonly direction: Direction;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* The index the key moves to from `current` over a grid of `count` cells in
|
|
272
|
+
* rows of `columns`, skipping cells not in `enabled`, or `undefined` when the
|
|
273
|
+
* key is not a grid key. Left and right step within the row, and across rows
|
|
274
|
+
* under `wrap`; up and down step within the column, and across columns under
|
|
275
|
+
* `wrap`. Home and End are the row's first and last enabled cell; with Ctrl
|
|
276
|
+
* they are the grid's. At an edge without `wrap` the key is consumed and
|
|
277
|
+
* `current` is returned. From `-1` (nothing current) a forward key lands on
|
|
278
|
+
* the first enabled cell and a backward key on the last. Under `rtl`, left
|
|
279
|
+
* and right swap.
|
|
280
|
+
*/
|
|
281
|
+
declare const move$1: (enabled: ReadonlyArray<number>, count: number, current: number, key: string, modifiers: KeyboardModifiers, options: MoveOptions) => number | undefined;
|
|
282
|
+
interface BehaviorOptions$9<Input, Slots> {
|
|
283
|
+
/** The slot that receives the arrow keys. */
|
|
284
|
+
readonly container: keyof Slots & string;
|
|
285
|
+
/** The slot rendered once per cell; must carry the cell's id (see `Behaviors.Collection`). */
|
|
286
|
+
readonly item: keyof Slots & string;
|
|
287
|
+
readonly items: (input: Input) => Behaviors.Collection.Items<unknown>;
|
|
288
|
+
/** Default `'ltr'`; return `'rtl'` to swap left and right. */
|
|
289
|
+
readonly direction?: (input: Input) => Direction;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Wires a placed `GridNavigation` to the slots exactly as `RovingTabindex`
|
|
293
|
+
* does, with `move` above deciding the cell: the container's arrows, Home and
|
|
294
|
+
* End focus the next cell (synchronously, then dispatch) or, under `virtual`,
|
|
295
|
+
* only dispatch and point with `aria-activedescendant`; each cell gets
|
|
296
|
+
* `tabindex` 0 or -1 and reports `Focused` when focused.
|
|
297
|
+
*/
|
|
298
|
+
declare const behavior$9: <Field extends string>(declared: Declared<typeof bundle$7, Field>, args: Args$7) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$7; }, ParentMessage>(options: BehaviorOptions$9<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
299
|
+
declare namespace layers_d_exports {
|
|
300
|
+
export { hideOutside, HideOutside as hideOutsideMount, scrollLock, ScrollLock as scrollLockMount };
|
|
301
|
+
}
|
|
302
|
+
/** Locks the document's scroll while the container is mounted; nested locks release together. */
|
|
303
|
+
declare const scrollLock: <Slots>(slots: Slots) => <Input, ParentMessage>(options: {
|
|
304
|
+
readonly container: keyof Slots & string;
|
|
305
|
+
}) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
306
|
+
/** Marks everything outside the container inert while it is mounted. */
|
|
307
|
+
declare const hideOutside: <Slots>(slots: Slots) => <Input, ParentMessage>(options: {
|
|
308
|
+
readonly container: keyof Slots & string;
|
|
309
|
+
}) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
310
|
+
declare namespace live_announce_d_exports {
|
|
311
|
+
export { Args$6 as Args, Message$6 as Message, Model$6 as Model, Politeness, REGION_ATTRIBUTE, bundle$6 as bundle, reread, say, view };
|
|
312
|
+
}
|
|
313
|
+
declare const Politeness: Schema.Literals<readonly ["polite", "assertive"]>;
|
|
314
|
+
type Politeness = typeof Politeness.Type;
|
|
315
|
+
declare const Model$6: Schema.Struct<{
|
|
316
|
+
readonly polite: Schema.String;
|
|
317
|
+
readonly assertive: Schema.String;
|
|
318
|
+
/** Waiting for the debounce to read. */
|
|
319
|
+
readonly pending: Schema.NullOr<Schema.Struct<{
|
|
320
|
+
readonly message: Schema.String;
|
|
321
|
+
readonly politeness: Schema.Literals<readonly ["polite", "assertive"]>;
|
|
322
|
+
}>>;
|
|
323
|
+
readonly generation: Schema.Number;
|
|
324
|
+
}>;
|
|
325
|
+
type Model$6 = typeof Model$6.Type;
|
|
326
|
+
declare const Message$6: import("foldkit/message").MessageUnion<{
|
|
327
|
+
readonly Announced: {
|
|
328
|
+
readonly message: Schema.String;
|
|
329
|
+
readonly politeness: Schema.Literals<readonly ["polite", "assertive"]>;
|
|
330
|
+
};
|
|
331
|
+
readonly Read: {
|
|
332
|
+
readonly generation: Schema.Number;
|
|
333
|
+
};
|
|
334
|
+
readonly Cleared: {
|
|
335
|
+
readonly generation: Schema.Number;
|
|
336
|
+
};
|
|
337
|
+
}>;
|
|
338
|
+
type Message$6 = typeof Message$6.Type;
|
|
339
|
+
declare const Args$6: Schema.Struct<{
|
|
340
|
+
/** A burst of announcements inside this window reads once, the last one. */
|
|
341
|
+
readonly debounceMs: Schema.Number;
|
|
342
|
+
/** How long the text stays in the region. */
|
|
343
|
+
readonly clearAfterMs: Schema.Number;
|
|
344
|
+
}>;
|
|
345
|
+
type Args$6 = typeof Args$6.Type;
|
|
346
|
+
/** The text to put in the region so that `next` is read even when it equals `current`. */
|
|
347
|
+
declare const reread: (current: string, next: string) => string;
|
|
348
|
+
declare const bundle$6: Bundle.Bundle<"LiveAnnounce", {
|
|
349
|
+
readonly debounceMs: number;
|
|
350
|
+
readonly clearAfterMs: number;
|
|
351
|
+
}, {
|
|
352
|
+
readonly polite: string;
|
|
353
|
+
readonly assertive: string;
|
|
354
|
+
readonly pending: {
|
|
355
|
+
readonly message: string;
|
|
356
|
+
readonly politeness: "polite" | "assertive";
|
|
357
|
+
} | null;
|
|
358
|
+
readonly generation: number;
|
|
359
|
+
}, {
|
|
360
|
+
readonly _tag: "Cleared";
|
|
361
|
+
readonly generation: number;
|
|
362
|
+
} | {
|
|
363
|
+
readonly _tag: "Announced";
|
|
364
|
+
readonly message: string;
|
|
365
|
+
readonly politeness: "polite" | "assertive";
|
|
366
|
+
} | {
|
|
367
|
+
readonly _tag: "Read";
|
|
368
|
+
readonly generation: number;
|
|
369
|
+
}, never, never, never, void, {}, {}>;
|
|
370
|
+
/** The parent Message that announces `text`, to return from `update` or `onOut`. */
|
|
371
|
+
declare const say: <Field extends string>(declared: Declared<typeof bundle$6, Field>) => <ParentMessage>(text: string, politeness?: Politeness) => ParentMessage;
|
|
372
|
+
declare const REGION_ATTRIBUTE = "data-foldkit-plus-live";
|
|
373
|
+
/**
|
|
374
|
+
* The two live regions. Render once, anywhere in the page, and hide them
|
|
375
|
+
* visually with a rule on `[data-foldkit-plus-live]`; they must stay in the
|
|
376
|
+
* accessibility tree, so no `display: none`.
|
|
377
|
+
*/
|
|
378
|
+
declare const view: <ParentMessage>(model: Model$6, h: HtmlBuilder<ParentMessage>) => Html;
|
|
379
|
+
declare namespace list_navigation_d_exports {
|
|
380
|
+
export { Args$5 as Args, BehaviorOptions$8 as BehaviorOptions, KeyOutcome, Message$5 as Message, Model$5 as Model, behavior$8 as behavior, bundle$5 as bundle, keyOutcome };
|
|
381
|
+
}
|
|
382
|
+
declare const Model$5: Schema.Struct<{
|
|
383
|
+
readonly current: Schema.NullOr<Schema.String>;
|
|
384
|
+
readonly query: Schema.String;
|
|
385
|
+
readonly generation: Schema.Number;
|
|
386
|
+
}>;
|
|
387
|
+
type Model$5 = typeof Model$5.Type;
|
|
388
|
+
declare const Message$5: import("foldkit/message").MessageUnion<{
|
|
389
|
+
/** An item became current: focused, or reached by a key. */
|
|
390
|
+
readonly Focused: {
|
|
391
|
+
readonly id: Schema.String;
|
|
392
|
+
};
|
|
393
|
+
/** A printable key extended the query; `match` is the item it now picks, if any. */
|
|
394
|
+
readonly Typed: {
|
|
395
|
+
readonly char: Schema.String;
|
|
396
|
+
readonly match: Schema.NullOr<Schema.String>;
|
|
397
|
+
};
|
|
398
|
+
readonly Expired: {
|
|
399
|
+
readonly generation: Schema.Number;
|
|
400
|
+
};
|
|
401
|
+
readonly Cleared: {};
|
|
402
|
+
}>;
|
|
403
|
+
type Message$5 = typeof Message$5.Type;
|
|
404
|
+
declare const Args$5: Schema.Struct<{
|
|
405
|
+
readonly orientation: Schema.Literals<readonly ["vertical", "horizontal", "both"]>;
|
|
406
|
+
readonly loop: Schema.Boolean;
|
|
407
|
+
readonly virtual: Schema.Boolean;
|
|
408
|
+
/** How long the typeahead query survives after the last key. */
|
|
409
|
+
readonly timeoutMs: Schema.Number;
|
|
410
|
+
/** How many enabled items PageUp and PageDown move. */
|
|
411
|
+
readonly page: Schema.Number;
|
|
412
|
+
}>;
|
|
413
|
+
type Args$5 = typeof Args$5.Type;
|
|
414
|
+
declare const bundle$5: Bundle.Bundle<"ListNavigation", {
|
|
415
|
+
readonly orientation: "vertical" | "horizontal" | "both";
|
|
416
|
+
readonly loop: boolean;
|
|
417
|
+
readonly virtual: boolean;
|
|
418
|
+
readonly timeoutMs: number;
|
|
419
|
+
readonly page: number;
|
|
420
|
+
}, {
|
|
421
|
+
readonly current: string | null;
|
|
422
|
+
readonly query: string;
|
|
423
|
+
readonly generation: number;
|
|
424
|
+
}, {
|
|
425
|
+
readonly _tag: "Cleared";
|
|
426
|
+
} | {
|
|
427
|
+
readonly _tag: "Typed";
|
|
428
|
+
readonly char: string;
|
|
429
|
+
readonly match: string | null;
|
|
430
|
+
} | {
|
|
431
|
+
readonly _tag: "Expired";
|
|
432
|
+
readonly generation: number;
|
|
433
|
+
} | {
|
|
434
|
+
readonly _tag: "Focused";
|
|
435
|
+
readonly id: string;
|
|
436
|
+
}, never, never, never, void, {}, {}>;
|
|
437
|
+
interface BehaviorOptions$8<Input, Slots> {
|
|
438
|
+
readonly container: keyof Slots & string;
|
|
439
|
+
/** The slot rendered once per item; must carry the item's id (see `Behaviors.Collection`). */
|
|
440
|
+
readonly item: keyof Slots & string;
|
|
441
|
+
readonly items: (input: Input) => Behaviors.Collection.Items<unknown>;
|
|
442
|
+
/** The text an item is matched by when typing. */
|
|
443
|
+
readonly text: (input: Input, index: number) => string;
|
|
444
|
+
readonly direction?: (input: Input) => Direction;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* The key's outcome, before it is turned into an attribute: navigation to an
|
|
448
|
+
* id, a typed character with its match, or nothing.
|
|
449
|
+
*/
|
|
450
|
+
type KeyOutcome = {
|
|
451
|
+
readonly _tag: 'Navigate';
|
|
452
|
+
readonly id: string;
|
|
453
|
+
} | {
|
|
454
|
+
readonly _tag: 'Type';
|
|
455
|
+
readonly char: string;
|
|
456
|
+
readonly match: string | null;
|
|
457
|
+
};
|
|
458
|
+
declare const keyOutcome: (items: Behaviors.Collection.Items<unknown>, texts: ReadonlyArray<string>, state: {
|
|
459
|
+
readonly current: string | null;
|
|
460
|
+
readonly query: string;
|
|
461
|
+
}, key: string, modifiers: KeyboardModifiers, options: MoveOptions$1) => KeyOutcome | undefined;
|
|
462
|
+
/**
|
|
463
|
+
* Wires a placed `ListNavigation` to the slots. The container gets one key
|
|
464
|
+
* handler: arrows, Home, End, PageUp and PageDown move by id; a printable key
|
|
465
|
+
* extends the query and moves to its match. Each item gets `tabindex` and
|
|
466
|
+
* `OnFocus` as under `RovingTabindex`. Under `virtual` nothing takes DOM focus
|
|
467
|
+
* and the container carries `aria-activedescendant`.
|
|
468
|
+
*/
|
|
469
|
+
declare const behavior$8: <Field extends string>(declared: Declared<typeof bundle$5, Field>, args: Args$5) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$5; }, ParentMessage>(options: BehaviorOptions$8<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
470
|
+
declare namespace long_press_d_exports {
|
|
471
|
+
export { Args$4 as Args, BehaviorOptions$7 as BehaviorOptions, LongPressed, Message$4 as Message, Model$4 as Model, behavior$7 as behavior, bundle$4 as bundle };
|
|
472
|
+
}
|
|
473
|
+
declare const Model$4: Schema.Struct<{
|
|
474
|
+
/** Down, and the threshold has not passed. */
|
|
475
|
+
readonly holding: Schema.Boolean;
|
|
476
|
+
readonly pointerId: Schema.NullOr<Schema.Number>;
|
|
477
|
+
readonly key: Schema.NullOr<Schema.String>;
|
|
478
|
+
readonly generation: Schema.Number;
|
|
479
|
+
}>;
|
|
480
|
+
type Model$4 = typeof Model$4.Type;
|
|
481
|
+
declare const Message$4: import("foldkit/message").MessageUnion<{
|
|
482
|
+
readonly PointerDown: {
|
|
483
|
+
readonly pointerId: Schema.Number;
|
|
484
|
+
readonly button: Schema.Number;
|
|
485
|
+
readonly pointerType: Schema.String;
|
|
486
|
+
};
|
|
487
|
+
readonly PointerUp: {
|
|
488
|
+
readonly pointerId: Schema.Number;
|
|
489
|
+
readonly pointerType: Schema.String;
|
|
490
|
+
readonly shiftKey: Schema.Boolean;
|
|
491
|
+
};
|
|
492
|
+
readonly PointerCancelled: {
|
|
493
|
+
readonly pointerId: Schema.Number;
|
|
494
|
+
};
|
|
495
|
+
readonly KeyDown: {
|
|
496
|
+
readonly key: Schema.String;
|
|
497
|
+
readonly repeat: Schema.Boolean;
|
|
498
|
+
};
|
|
499
|
+
readonly KeyUp: {
|
|
500
|
+
readonly key: Schema.String;
|
|
501
|
+
readonly shiftKey: Schema.Boolean;
|
|
502
|
+
};
|
|
503
|
+
readonly Clicked: {
|
|
504
|
+
readonly detail: Schema.Number;
|
|
505
|
+
readonly shiftKey: Schema.Boolean;
|
|
506
|
+
};
|
|
507
|
+
readonly Elapsed: {
|
|
508
|
+
readonly generation: Schema.Number;
|
|
509
|
+
readonly pointerType: Schema.Literals<readonly ["mouse", "touch", "pen", "keyboard", "virtual"]>;
|
|
510
|
+
};
|
|
511
|
+
}>;
|
|
512
|
+
type Message$4 = typeof Message$4.Type;
|
|
513
|
+
declare const LongPressed: Schema.TaggedStruct<"LongPressed", {
|
|
514
|
+
readonly pointerType: Schema.Literals<readonly ["mouse", "touch", "pen", "keyboard", "virtual"]>;
|
|
515
|
+
}>;
|
|
516
|
+
type LongPressed = typeof LongPressed.Type;
|
|
517
|
+
declare const Args$4: Schema.Struct<{
|
|
518
|
+
readonly thresholdMs: Schema.Number;
|
|
519
|
+
}>;
|
|
520
|
+
type Args$4 = typeof Args$4.Type;
|
|
521
|
+
declare const bundle$4: Bundle.Bundle<"LongPress", {
|
|
522
|
+
readonly thresholdMs: number;
|
|
523
|
+
}, {
|
|
524
|
+
readonly holding: boolean;
|
|
525
|
+
readonly pointerId: number | null;
|
|
526
|
+
readonly key: string | null;
|
|
527
|
+
readonly generation: number;
|
|
528
|
+
}, {
|
|
529
|
+
readonly _tag: "PointerDown";
|
|
530
|
+
readonly pointerId: number;
|
|
531
|
+
readonly button: number;
|
|
532
|
+
readonly pointerType: string;
|
|
533
|
+
} | {
|
|
534
|
+
readonly _tag: "PointerUp";
|
|
535
|
+
readonly pointerId: number;
|
|
536
|
+
readonly pointerType: string;
|
|
537
|
+
readonly shiftKey: boolean;
|
|
538
|
+
} | {
|
|
539
|
+
readonly _tag: "PointerCancelled";
|
|
540
|
+
readonly pointerId: number;
|
|
541
|
+
} | {
|
|
542
|
+
readonly _tag: "KeyDown";
|
|
543
|
+
readonly key: string;
|
|
544
|
+
readonly repeat: boolean;
|
|
545
|
+
} | {
|
|
546
|
+
readonly _tag: "KeyUp";
|
|
547
|
+
readonly key: string;
|
|
548
|
+
readonly shiftKey: boolean;
|
|
549
|
+
} | {
|
|
550
|
+
readonly _tag: "Clicked";
|
|
551
|
+
readonly detail: number;
|
|
552
|
+
readonly shiftKey: boolean;
|
|
553
|
+
} | {
|
|
554
|
+
readonly _tag: "Elapsed";
|
|
555
|
+
readonly generation: number;
|
|
556
|
+
readonly pointerType: "keyboard" | "virtual" | "mouse" | "touch" | "pen";
|
|
557
|
+
}, {
|
|
558
|
+
readonly _tag: "LongPressed";
|
|
559
|
+
readonly pointerType: "keyboard" | "virtual" | "mouse" | "touch" | "pen";
|
|
560
|
+
}, never, never, void, {}, {}>;
|
|
561
|
+
interface BehaviorOptions$7<Slots> {
|
|
562
|
+
readonly target: keyof Slots & string;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Attaches `Press.events` to the target, mapped into this placement's
|
|
566
|
+
* Messages, and writes `data-holding` while the element is down. `Press` and
|
|
567
|
+
* `LongPress` on one slot are refused by the resolver (two Mounts of one
|
|
568
|
+
* name), so today a slot takes one of them.
|
|
569
|
+
*/
|
|
570
|
+
declare const behavior$7: <Field extends string>(declared: Declared<typeof bundle$4, Field>) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$4; }, ParentMessage>(options: BehaviorOptions$7<Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
571
|
+
declare namespace move_d_exports {
|
|
572
|
+
export { BehaviorOptions$6 as BehaviorOptions, Fact$1 as Fact, MoveEnded, MoveStarted, Moved, behavior$6 as behavior, Move as mount };
|
|
573
|
+
}
|
|
574
|
+
interface BehaviorOptions$6<Slots, ParentMessage> {
|
|
575
|
+
readonly handle: keyof Slots & string;
|
|
576
|
+
/** Turns each fact into the view's Message. */
|
|
577
|
+
readonly toMessage: (fact: Fact$1) => ParentMessage;
|
|
578
|
+
}
|
|
579
|
+
declare const behavior$6: <Slots>(slots: Slots) => <Input, ParentMessage>(options: BehaviorOptions$6<Slots, ParentMessage>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
580
|
+
declare namespace press_d_exports {
|
|
581
|
+
export { Args$3 as Args, BehaviorOptions$5 as BehaviorOptions, Fact, Message$3 as Message, Model$3 as Model, PointerType, Pressed, behavior$5 as behavior, bundle$3 as bundle, events };
|
|
582
|
+
}
|
|
583
|
+
declare const PointerType: Schema.Literals<readonly ["mouse", "touch", "pen", "keyboard", "virtual"]>;
|
|
584
|
+
type PointerType = typeof PointerType.Type;
|
|
585
|
+
declare const Model$3: Schema.Struct<{
|
|
586
|
+
/** Down and not yet released or cancelled. For styling. */
|
|
587
|
+
readonly pressed: Schema.Boolean;
|
|
588
|
+
/** The pointer that pressed, so another pointer's up cannot release it. */
|
|
589
|
+
readonly pointerId: Schema.NullOr<Schema.Number>;
|
|
590
|
+
/** Enter or Space is down. */
|
|
591
|
+
readonly key: Schema.NullOr<Schema.String>;
|
|
592
|
+
/** A click arriving before this generation's window ends is the ghost of a pointer press. */
|
|
593
|
+
readonly suppressing: Schema.NullOr<Schema.Number>;
|
|
594
|
+
readonly generation: Schema.Number;
|
|
595
|
+
}>;
|
|
596
|
+
type Model$3 = typeof Model$3.Type;
|
|
597
|
+
declare const Message$3: import("foldkit/message").MessageUnion<{
|
|
598
|
+
readonly PointerDown: {
|
|
599
|
+
readonly pointerId: Schema.Number;
|
|
600
|
+
readonly button: Schema.Number;
|
|
601
|
+
readonly pointerType: Schema.String;
|
|
602
|
+
};
|
|
603
|
+
readonly PointerUp: {
|
|
604
|
+
readonly pointerId: Schema.Number;
|
|
605
|
+
readonly pointerType: Schema.String;
|
|
606
|
+
readonly shiftKey: Schema.Boolean;
|
|
607
|
+
};
|
|
608
|
+
readonly PointerCancelled: {
|
|
609
|
+
readonly pointerId: Schema.Number;
|
|
610
|
+
};
|
|
611
|
+
readonly KeyDown: {
|
|
612
|
+
readonly key: Schema.String;
|
|
613
|
+
readonly repeat: Schema.Boolean;
|
|
614
|
+
};
|
|
615
|
+
readonly KeyUp: {
|
|
616
|
+
readonly key: Schema.String;
|
|
617
|
+
readonly shiftKey: Schema.Boolean;
|
|
618
|
+
};
|
|
619
|
+
/** `detail` is 0 for a click no pointer made: keyboard on a native control, or assistive technology. */
|
|
620
|
+
readonly Clicked: {
|
|
621
|
+
readonly detail: Schema.Number;
|
|
622
|
+
readonly shiftKey: Schema.Boolean;
|
|
623
|
+
};
|
|
624
|
+
readonly Unsuppressed: {
|
|
625
|
+
readonly generation: Schema.Number;
|
|
626
|
+
};
|
|
627
|
+
}>;
|
|
628
|
+
type Message$3 = typeof Message$3.Type;
|
|
629
|
+
declare const Pressed: Schema.TaggedStruct<"Pressed", {
|
|
630
|
+
readonly pointerType: Schema.Literals<readonly ["mouse", "touch", "pen", "keyboard", "virtual"]>;
|
|
631
|
+
/** Shift was held, for a range selection. */
|
|
632
|
+
readonly shiftKey: Schema.Boolean;
|
|
633
|
+
}>;
|
|
634
|
+
type Pressed = typeof Pressed.Type;
|
|
635
|
+
declare const Args$3: Schema.Struct<{
|
|
636
|
+
/** How long after a pointer press a `click` is taken for its ghost. */
|
|
637
|
+
readonly clickSuppressionMs: Schema.Number;
|
|
638
|
+
}>;
|
|
639
|
+
type Args$3 = typeof Args$3.Type;
|
|
640
|
+
declare const bundle$3: Bundle.Bundle<"Press", {
|
|
641
|
+
readonly clickSuppressionMs: number;
|
|
642
|
+
}, {
|
|
643
|
+
readonly pressed: boolean;
|
|
644
|
+
readonly pointerId: number | null;
|
|
645
|
+
readonly key: string | null;
|
|
646
|
+
readonly suppressing: number | null;
|
|
647
|
+
readonly generation: number;
|
|
648
|
+
}, {
|
|
649
|
+
readonly _tag: "PointerDown";
|
|
650
|
+
readonly pointerId: number;
|
|
651
|
+
readonly button: number;
|
|
652
|
+
readonly pointerType: string;
|
|
653
|
+
} | {
|
|
654
|
+
readonly _tag: "PointerUp";
|
|
655
|
+
readonly pointerId: number;
|
|
656
|
+
readonly pointerType: string;
|
|
657
|
+
readonly shiftKey: boolean;
|
|
658
|
+
} | {
|
|
659
|
+
readonly _tag: "PointerCancelled";
|
|
660
|
+
readonly pointerId: number;
|
|
661
|
+
} | {
|
|
662
|
+
readonly _tag: "KeyDown";
|
|
663
|
+
readonly key: string;
|
|
664
|
+
readonly repeat: boolean;
|
|
665
|
+
} | {
|
|
666
|
+
readonly _tag: "KeyUp";
|
|
667
|
+
readonly key: string;
|
|
668
|
+
readonly shiftKey: boolean;
|
|
669
|
+
} | {
|
|
670
|
+
readonly _tag: "Clicked";
|
|
671
|
+
readonly detail: number;
|
|
672
|
+
readonly shiftKey: boolean;
|
|
673
|
+
} | {
|
|
674
|
+
readonly _tag: "Unsuppressed";
|
|
675
|
+
readonly generation: number;
|
|
676
|
+
}, {
|
|
677
|
+
readonly _tag: "Pressed";
|
|
678
|
+
readonly pointerType: "keyboard" | "virtual" | "mouse" | "touch" | "pen";
|
|
679
|
+
readonly shiftKey: boolean;
|
|
680
|
+
}, never, never, void, {}, {}>;
|
|
681
|
+
/** What the element reports; `Unsuppressed` comes from the timer, not the DOM. */
|
|
682
|
+
type Fact = Exclude<Message$3, {
|
|
683
|
+
readonly _tag: 'Unsuppressed';
|
|
684
|
+
}>;
|
|
685
|
+
/**
|
|
686
|
+
* The element's press-relevant events as facts. Enter and Space key downs
|
|
687
|
+
* are default-prevented so a native control does not also click, and Space
|
|
688
|
+
* does not scroll; the Bundle owns activation. An element marked
|
|
689
|
+
* `aria-disabled="true"` (which the Behavior writes) reports nothing, read
|
|
690
|
+
* at event time so a toggle needs no remount. Nothing else is decided here.
|
|
691
|
+
*/
|
|
692
|
+
declare const events: Mount.MountDefinitionNoArgs<"PressEvents", {
|
|
693
|
+
readonly _tag: "PointerDown";
|
|
694
|
+
readonly pointerId: number;
|
|
695
|
+
readonly button: number;
|
|
696
|
+
readonly pointerType: string;
|
|
697
|
+
} | {
|
|
698
|
+
readonly _tag: "PointerUp";
|
|
699
|
+
readonly pointerId: number;
|
|
700
|
+
readonly pointerType: string;
|
|
701
|
+
readonly shiftKey: boolean;
|
|
702
|
+
} | {
|
|
703
|
+
readonly _tag: "PointerCancelled";
|
|
704
|
+
readonly pointerId: number;
|
|
705
|
+
} | {
|
|
706
|
+
readonly _tag: "KeyDown";
|
|
707
|
+
readonly key: string;
|
|
708
|
+
readonly repeat: boolean;
|
|
709
|
+
} | {
|
|
710
|
+
readonly _tag: "KeyUp";
|
|
711
|
+
readonly key: string;
|
|
712
|
+
readonly shiftKey: boolean;
|
|
713
|
+
} | {
|
|
714
|
+
readonly _tag: "Clicked";
|
|
715
|
+
readonly detail: number;
|
|
716
|
+
readonly shiftKey: boolean;
|
|
717
|
+
}>;
|
|
718
|
+
interface BehaviorOptions$5<Input, Slots> {
|
|
719
|
+
readonly target: keyof Slots & string;
|
|
720
|
+
/** Marks the target `aria-disabled`, which also silences its events. */
|
|
721
|
+
readonly disabled?: (input: Input) => boolean;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Attaches the events Mount to the target slot, mapped into the placement's
|
|
725
|
+
* Messages, and writes `data-pressed` while down for styling. The element
|
|
726
|
+
* decides nothing; a click, a touch, Enter, Space, or an assistive
|
|
727
|
+
* technology's click all reach `update` and come out as one `Pressed`.
|
|
728
|
+
*/
|
|
729
|
+
declare const behavior$5: <Field extends string>(declared: Declared<typeof bundle$3, Field>) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$3; }, ParentMessage>(options: BehaviorOptions$5<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
730
|
+
declare namespace selection_d_exports {
|
|
731
|
+
export { Args$2 as Args, BehaviorOptions$4 as BehaviorOptions, Message$2 as Message, Mode, Model$2 as Model, behavior$4 as behavior, between, bundle$2 as bundle };
|
|
732
|
+
}
|
|
733
|
+
declare const Mode: Schema.Literals<readonly ["single", "multiple", "none"]>;
|
|
734
|
+
type Mode = typeof Mode.Type;
|
|
735
|
+
declare const Model$2: Schema.Struct<{
|
|
736
|
+
/** In selection order. */
|
|
737
|
+
readonly selected: Schema.$Array<Schema.String>;
|
|
738
|
+
/** Where the last plain selection happened; a range extends from it. */
|
|
739
|
+
readonly anchor: Schema.NullOr<Schema.String>;
|
|
740
|
+
}>;
|
|
741
|
+
type Model$2 = typeof Model$2.Type;
|
|
742
|
+
declare const Message$2: import("foldkit/message").MessageUnion<{
|
|
743
|
+
/** A plain activation: replaces in single mode, toggles in multiple mode. */
|
|
744
|
+
readonly Activated: {
|
|
745
|
+
readonly id: Schema.String;
|
|
746
|
+
};
|
|
747
|
+
/** A Shift activation: selects everything between the anchor and `id` in `order`. */
|
|
748
|
+
readonly Ranged: {
|
|
749
|
+
readonly id: Schema.String;
|
|
750
|
+
readonly order: Schema.$Array<Schema.String>;
|
|
751
|
+
};
|
|
752
|
+
readonly Replaced: {
|
|
753
|
+
readonly ids: Schema.$Array<Schema.String>;
|
|
754
|
+
};
|
|
755
|
+
readonly Cleared: {};
|
|
756
|
+
}>;
|
|
757
|
+
type Message$2 = typeof Message$2.Type;
|
|
758
|
+
declare const Args$2: Schema.Struct<{
|
|
759
|
+
readonly mode: Schema.Literals<readonly ["single", "multiple", "none"]>;
|
|
760
|
+
/** In single mode, whether activating the selected item deselects it. */
|
|
761
|
+
readonly allowEmpty: Schema.Boolean;
|
|
762
|
+
}>;
|
|
763
|
+
type Args$2 = typeof Args$2.Type;
|
|
764
|
+
/** The ids between `from` and `to` in `order`, inclusive, in `order`'s order. */
|
|
765
|
+
declare const between: (order: ReadonlyArray<string>, from: string | null, to: string) => ReadonlyArray<string>;
|
|
766
|
+
declare const bundle$2: Bundle.Bundle<"Selection", {
|
|
767
|
+
readonly mode: "single" | "multiple" | "none";
|
|
768
|
+
readonly allowEmpty: boolean;
|
|
769
|
+
}, {
|
|
770
|
+
readonly selected: readonly string[];
|
|
771
|
+
readonly anchor: string | null;
|
|
772
|
+
}, {
|
|
773
|
+
readonly _tag: "Cleared";
|
|
774
|
+
} | {
|
|
775
|
+
readonly _tag: "Activated";
|
|
776
|
+
readonly id: string;
|
|
777
|
+
} | {
|
|
778
|
+
readonly _tag: "Ranged";
|
|
779
|
+
readonly id: string;
|
|
780
|
+
readonly order: readonly string[];
|
|
781
|
+
} | {
|
|
782
|
+
readonly _tag: "Replaced";
|
|
783
|
+
readonly ids: readonly string[];
|
|
784
|
+
}, never, never, never, void, {}, {}>;
|
|
785
|
+
interface BehaviorOptions$4<Input, Slots> {
|
|
786
|
+
/** The slot holding the items, for `aria-multiselectable`. */
|
|
787
|
+
readonly container?: keyof Slots & string;
|
|
788
|
+
/** The slot rendered once per item; must carry the item's id. */
|
|
789
|
+
readonly item: keyof Slots & string;
|
|
790
|
+
readonly items: (input: Input) => Behaviors.Collection.Items<unknown>;
|
|
791
|
+
/** Wire a plain click on each item to `Activated`. Default `true`; turn off
|
|
792
|
+
* when `Press` or the view owns the click. */
|
|
793
|
+
readonly click?: boolean;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Writes `aria-selected` on each item from the placed slice, and
|
|
797
|
+
* `aria-multiselectable` on the container in multiple mode; wires `OnClick`
|
|
798
|
+
* to `Activated` unless told not to. A disabled item gets no click.
|
|
799
|
+
*/
|
|
800
|
+
declare const behavior$4: <Field extends string>(declared: Declared<typeof bundle$2, Field>, args: Args$2) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$2; }, ParentMessage>(options: BehaviorOptions$4<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
801
|
+
declare namespace targets_d_exports {
|
|
802
|
+
export { BehaviorOptions$3 as BehaviorOptions, TargetFact, TargetHovered, TargetPressed, behavior$3 as behavior, Targets as mount, targetOf };
|
|
803
|
+
}
|
|
804
|
+
interface BehaviorOptions$3<Slots, ParentMessage> {
|
|
805
|
+
/** The slot holding the marked descendants. */
|
|
806
|
+
readonly container: keyof Slots & string;
|
|
807
|
+
/** The attribute that marks a descendant, holding its id. */
|
|
808
|
+
readonly attribute: string;
|
|
809
|
+
/** Prevent a press's default, such as a link navigating. Default `false`. */
|
|
810
|
+
readonly preventDefault?: boolean;
|
|
811
|
+
/** Turns each fact into the view's Message. */
|
|
812
|
+
readonly toMessage: (fact: TargetFact) => ParentMessage;
|
|
813
|
+
}
|
|
814
|
+
declare const behavior$3: <Slots>(slots: Slots) => <Input, ParentMessage>(options: BehaviorOptions$3<Slots, ParentMessage>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
815
|
+
declare namespace pointer_drag_d_exports {
|
|
816
|
+
export { BehaviorOptions$2 as BehaviorOptions, DRAG_THRESHOLD, DragCancelled, DragDropped, DragFact, DragPlace, DragStarted, DragZone, DraggedOver, behavior$2 as behavior, boxOf, PointerDrag as mount, zoneOf };
|
|
817
|
+
}
|
|
818
|
+
interface BehaviorOptions$2<Slots, ParentMessage> {
|
|
819
|
+
/** The slot holding the marked descendants. */
|
|
820
|
+
readonly container: keyof Slots & string;
|
|
821
|
+
/** The attribute that marks a descendant, holding its id. */
|
|
822
|
+
readonly attribute: string;
|
|
823
|
+
/**
|
|
824
|
+
* Where a drag may land when not among the container's own: elements marked
|
|
825
|
+
* by `attribute` inside the one `within` selects, such as a page for a palette.
|
|
826
|
+
*/
|
|
827
|
+
readonly targets?: {
|
|
828
|
+
readonly attribute: string;
|
|
829
|
+
readonly within: string;
|
|
830
|
+
};
|
|
831
|
+
/** Turns each fact into the view's Message. */
|
|
832
|
+
readonly toMessage: (fact: DragFact) => ParentMessage;
|
|
833
|
+
}
|
|
834
|
+
declare const behavior$2: <Slots>(slots: Slots) => <Input, ParentMessage>(options: BehaviorOptions$2<Slots, ParentMessage>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
835
|
+
declare namespace tree_navigation_d_exports {
|
|
836
|
+
export { Action, Args$1 as Args, BehaviorOptions$1 as BehaviorOptions, Message$1 as Message, Model$1 as Model, Row, Shown, behavior$1 as behavior, bundle$1 as bundle, isOpen, move, shown, tabStop };
|
|
837
|
+
}
|
|
838
|
+
declare const Model$1: Schema.Struct<{
|
|
839
|
+
/** The current row's id, or `null` before any row has been focused. */
|
|
840
|
+
readonly current: Schema.NullOr<Schema.String>;
|
|
841
|
+
/** The rows whose open state differs from `openByDefault`. */
|
|
842
|
+
readonly toggled: Schema.$Array<Schema.String>;
|
|
843
|
+
}>;
|
|
844
|
+
type Model$1 = typeof Model$1.Type;
|
|
845
|
+
declare const Message$1: import("foldkit/message").MessageUnion<{
|
|
846
|
+
/** A row became current: the user focused it, or a key moved there. */
|
|
847
|
+
readonly Focused: {
|
|
848
|
+
readonly id: Schema.String;
|
|
849
|
+
};
|
|
850
|
+
readonly Opened: {
|
|
851
|
+
readonly id: Schema.String;
|
|
852
|
+
};
|
|
853
|
+
readonly Closed: {
|
|
854
|
+
readonly id: Schema.String;
|
|
855
|
+
};
|
|
856
|
+
}>;
|
|
857
|
+
type Message$1 = typeof Message$1.Type;
|
|
858
|
+
declare const Args$1: Schema.Struct<{
|
|
859
|
+
/** Whether a row with children starts open. */
|
|
860
|
+
readonly openByDefault: Schema.Boolean;
|
|
861
|
+
}>;
|
|
862
|
+
type Args$1 = typeof Args$1.Type;
|
|
863
|
+
/** Whether a row is open, given the default and what was toggled. */
|
|
864
|
+
declare const isOpen: (model: Model$1, args: Args$1, id: string) => boolean;
|
|
865
|
+
declare const bundle$1: Bundle.Bundle<"TreeNavigation", {
|
|
866
|
+
readonly openByDefault: boolean;
|
|
867
|
+
}, {
|
|
868
|
+
readonly current: string | null;
|
|
869
|
+
readonly toggled: readonly string[];
|
|
870
|
+
}, {
|
|
871
|
+
readonly _tag: "Focused";
|
|
872
|
+
readonly id: string;
|
|
873
|
+
} | {
|
|
874
|
+
readonly _tag: "Opened";
|
|
875
|
+
readonly id: string;
|
|
876
|
+
} | {
|
|
877
|
+
readonly _tag: "Closed";
|
|
878
|
+
readonly id: string;
|
|
879
|
+
}, never, never, never, void, {}, {}>;
|
|
880
|
+
/** One row of the tree, in tree order: a parent comes before its children. */
|
|
881
|
+
interface Row {
|
|
882
|
+
readonly id: string;
|
|
883
|
+
/** The parent's id, or `null` for a top-level row. */
|
|
884
|
+
readonly parent: string | null;
|
|
885
|
+
/** Whether it has children, so it can be opened and closed. */
|
|
886
|
+
readonly branch: boolean;
|
|
887
|
+
readonly disabled?: boolean;
|
|
888
|
+
}
|
|
889
|
+
/** A row as it is showing: where it sits, for its ARIA attributes. */
|
|
890
|
+
interface Shown extends Row {
|
|
891
|
+
/** 1 for a top-level row. */
|
|
892
|
+
readonly level: number;
|
|
893
|
+
/** Its place among its siblings, from 1, and how many there are. */
|
|
894
|
+
readonly position: number;
|
|
895
|
+
readonly siblings: number;
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* The rows that are showing: every row whose ancestors are all open, with its
|
|
899
|
+
* level and its place among its siblings. A row whose parent is not a row is
|
|
900
|
+
* treated as top-level.
|
|
901
|
+
*/
|
|
902
|
+
declare const shown: (rows: ReadonlyArray<Row>, model: Model$1, args: Args$1) => ReadonlyArray<Shown>;
|
|
903
|
+
/** What a key does: move to a row, or open or close one. */
|
|
904
|
+
type Action = {
|
|
905
|
+
readonly _tag: 'Focus';
|
|
906
|
+
readonly id: string;
|
|
907
|
+
} | {
|
|
908
|
+
readonly _tag: 'Open';
|
|
909
|
+
readonly id: string;
|
|
910
|
+
} | {
|
|
911
|
+
readonly _tag: 'Close';
|
|
912
|
+
readonly id: string;
|
|
913
|
+
};
|
|
914
|
+
/**
|
|
915
|
+
* What a key does from the current row, over the rows that are showing, or
|
|
916
|
+
* `undefined` when it is not a key the tree handles. Disabled rows are stepped
|
|
917
|
+
* over. With nothing current, Down and Home land on the first row, Up and End
|
|
918
|
+
* on the last. Right and Left swap under `rtl`.
|
|
919
|
+
*/
|
|
920
|
+
declare const move: (rows: ReadonlyArray<Shown>, current: string | null, key: string, modifiers: KeyboardModifiers, model: Model$1, args: Args$1, direction?: "ltr" | "rtl") => Action | undefined;
|
|
921
|
+
/** The row that holds the tab stop: the current one while it is showing, else the first. */
|
|
922
|
+
declare const tabStop: (rows: ReadonlyArray<Shown>, current: string | null) => string | undefined;
|
|
923
|
+
interface BehaviorOptions$1<Input, Slots> {
|
|
924
|
+
/** The slot that receives the keys: the element with `role="tree"`. */
|
|
925
|
+
readonly container: keyof Slots & string;
|
|
926
|
+
/** The slot rendered once per showing row, with `item.id` or `item.index` into `shown`. */
|
|
927
|
+
readonly item: keyof Slots & string;
|
|
928
|
+
/** Every row, open or not, in tree order. */
|
|
929
|
+
readonly rows: (input: Input) => ReadonlyArray<Row>;
|
|
930
|
+
/** The DOM id a row's element carries. Default: the row's own id. */
|
|
931
|
+
readonly domId?: (id: string) => string;
|
|
932
|
+
readonly direction?: (input: Input) => 'ltr' | 'rtl';
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Wires a placed `TreeNavigation` to the slots. The container's keys move focus
|
|
936
|
+
* to the row they pick, or open or close the current row with focus left where
|
|
937
|
+
* it is. Each showing row gets its id, `role="treeitem"`, `aria-level` (and
|
|
938
|
+
* the same level as `--fk-tree-level`, so one `calc` indents any depth),
|
|
939
|
+
* `aria-posinset`, `aria-setsize`, `aria-expanded` when it has children,
|
|
940
|
+
* `aria-disabled` when disabled, a roving `tabindex`, and `OnFocus` reporting
|
|
941
|
+
* it current. Every handled key is default-prevented.
|
|
942
|
+
*/
|
|
943
|
+
declare const behavior$1: <Field extends string>(declared: Declared<typeof bundle$1, Field>, args: Args$1) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model$1; }, ParentMessage>(options: BehaviorOptions$1<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
944
|
+
declare namespace typeahead_d_exports {
|
|
945
|
+
export { Args, BehaviorOptions, Message, Model, behavior, bundle, isPrintable, match };
|
|
946
|
+
}
|
|
947
|
+
declare const Model: Schema.Struct<{
|
|
948
|
+
readonly query: Schema.String;
|
|
949
|
+
/** Bumped per keystroke, carried by the clear it schedules, so a superseded
|
|
950
|
+
* timer's `Expired` changes nothing. */
|
|
951
|
+
readonly generation: Schema.Number;
|
|
952
|
+
}>;
|
|
953
|
+
type Model = typeof Model.Type;
|
|
954
|
+
declare const Message: import("foldkit/message").MessageUnion<{
|
|
955
|
+
/** A printable key was pressed with no ctrl, alt or meta. */
|
|
956
|
+
readonly Typed: {
|
|
957
|
+
readonly char: Schema.String;
|
|
958
|
+
};
|
|
959
|
+
/** The clear timer fired for `generation`. */
|
|
960
|
+
readonly Expired: {
|
|
961
|
+
readonly generation: Schema.Number;
|
|
962
|
+
};
|
|
963
|
+
/** The query was dropped on purpose (a blur, a selection). */
|
|
964
|
+
readonly Cleared: {};
|
|
965
|
+
}>;
|
|
966
|
+
type Message = typeof Message.Type;
|
|
967
|
+
declare const Args: Schema.Struct<{
|
|
968
|
+
/** How long the query survives after the last key. */
|
|
969
|
+
readonly timeoutMs: Schema.Number;
|
|
970
|
+
}>;
|
|
971
|
+
type Args = typeof Args.Type;
|
|
972
|
+
declare const bundle: Bundle.Bundle<"Typeahead", {
|
|
973
|
+
readonly timeoutMs: number;
|
|
974
|
+
}, {
|
|
975
|
+
readonly query: string;
|
|
976
|
+
readonly generation: number;
|
|
977
|
+
}, {
|
|
978
|
+
readonly _tag: "Typed";
|
|
979
|
+
readonly char: string;
|
|
980
|
+
} | {
|
|
981
|
+
readonly _tag: "Expired";
|
|
982
|
+
readonly generation: number;
|
|
983
|
+
} | {
|
|
984
|
+
readonly _tag: "Cleared";
|
|
985
|
+
}, never, never, never, void, {}, {}>;
|
|
986
|
+
/**
|
|
987
|
+
* The enabled index whose text starts with `query`, searching forward from
|
|
988
|
+
* `current` and wrapping, or `undefined`. A query of one character, or one
|
|
989
|
+
* character repeated (`aaa`), starts *after* the current item so repeated
|
|
990
|
+
* presses cycle through the items that begin with it; a longer query starts
|
|
991
|
+
* *at* the current item, since the user is refining a match. Case and leading
|
|
992
|
+
* whitespace are ignored.
|
|
993
|
+
*/
|
|
994
|
+
declare const match: (texts: ReadonlyArray<string>, enabled: ReadonlyArray<number>, query: string, current: number) => number | undefined;
|
|
995
|
+
/** A single character with no ctrl, alt or meta: a typeahead key. */
|
|
996
|
+
declare const isPrintable: (key: string, modifiers: KeyboardModifiers) => boolean;
|
|
997
|
+
interface BehaviorOptions<Input, Slots> {
|
|
998
|
+
/** The slot that receives the keys. */
|
|
999
|
+
readonly host: keyof Slots & string;
|
|
1000
|
+
readonly items: (input: Input) => Behaviors.Collection.Items<unknown>;
|
|
1001
|
+
/** The text an item is matched by. */
|
|
1002
|
+
readonly text: (input: Input, index: number) => string;
|
|
1003
|
+
/** The current item's id, so the search starts from it; a placed
|
|
1004
|
+
* `RovingTabindex` is the usual source. */
|
|
1005
|
+
readonly current: (input: Input) => string | null;
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Wires a placed `Typeahead` to the host slot: a printable key extends the
|
|
1009
|
+
* query, focuses the matching item by its id (which then reports itself
|
|
1010
|
+
* current, through `RovingTabindex`'s `OnFocus`), and dispatches `Typed`.
|
|
1011
|
+
* With no match the key still extends the query, so the next one can match;
|
|
1012
|
+
* a space with an empty query is left to the host (it activates).
|
|
1013
|
+
*/
|
|
1014
|
+
declare const behavior: <Field extends string>(declared: Declared<typeof bundle, Field>) => <Slots>(slots: Slots) => <Input extends { readonly [K in Field]: Model; }, ParentMessage>(options: BehaviorOptions<Input, Slots>) => Behavior.NamedBehavior<Slots, Input, ParentMessage>;
|
|
1015
|
+
//#endregion
|
|
1016
|
+
export { dismiss_layer_d_exports as DismissLayer, editable_text_d_exports as EditableText, focus_scope_d_exports as FocusScope, focus_visible_d_exports as FocusVisible, grid_navigation_d_exports as GridNavigation, layers_d_exports as Layers, list_navigation_d_exports as ListNavigation, live_announce_d_exports as LiveAnnounce, long_press_d_exports as LongPress, move_d_exports as Move, pointer_drag_d_exports as PointerDrag, press_d_exports as Press, roving_tabindex_d_exports as RovingTabindex, selection_d_exports as Selection, targets_d_exports as Targets, tree_navigation_d_exports as TreeNavigation, typeahead_d_exports as Typeahead };
|
|
1017
|
+
//# sourceMappingURL=index.d.mts.map
|