@typed/ui 1.0.0-beta.3 → 1.0.0-beta.5

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.
Files changed (157) hide show
  1. package/README.md +53 -9
  2. package/dist/Alert.d.ts +78 -0
  3. package/dist/Alert.d.ts.map +1 -0
  4. package/dist/Alert.js +37 -0
  5. package/dist/Button.d.ts +144 -0
  6. package/dist/Button.d.ts.map +1 -0
  7. package/dist/Button.js +38 -0
  8. package/dist/Carousel.d.ts +547 -0
  9. package/dist/Carousel.d.ts.map +1 -0
  10. package/dist/Carousel.js +387 -0
  11. package/dist/Checkbox.d.ts +203 -0
  12. package/dist/Checkbox.d.ts.map +1 -0
  13. package/dist/Checkbox.js +140 -0
  14. package/dist/Collection.d.ts +254 -0
  15. package/dist/Collection.d.ts.map +1 -0
  16. package/dist/Collection.js +218 -0
  17. package/dist/Combobox.d.ts +516 -0
  18. package/dist/Combobox.d.ts.map +1 -0
  19. package/dist/Combobox.js +371 -0
  20. package/dist/Component.d.ts +127 -0
  21. package/dist/Component.d.ts.map +1 -0
  22. package/dist/Component.js +60 -0
  23. package/dist/Composite.d.ts +823 -0
  24. package/dist/Composite.d.ts.map +1 -0
  25. package/dist/Composite.js +615 -0
  26. package/dist/Dialog.d.ts +544 -0
  27. package/dist/Dialog.d.ts.map +1 -0
  28. package/dist/Dialog.js +355 -0
  29. package/dist/Disclosure.d.ts +219 -0
  30. package/dist/Disclosure.d.ts.map +1 -0
  31. package/dist/Disclosure.js +128 -0
  32. package/dist/Dom/Events.d.ts +122 -0
  33. package/dist/Dom/Events.d.ts.map +1 -0
  34. package/dist/Dom/Events.js +192 -0
  35. package/dist/Dom/Props.d.ts +161 -0
  36. package/dist/Dom/Props.d.ts.map +1 -0
  37. package/dist/Dom/Props.js +110 -0
  38. package/dist/Dom/Refs.d.ts +58 -0
  39. package/dist/Dom/Refs.d.ts.map +1 -0
  40. package/dist/Dom/Refs.js +61 -0
  41. package/dist/Dom/Render.d.ts +59 -0
  42. package/dist/Dom/Render.d.ts.map +1 -0
  43. package/dist/Dom/Render.js +71 -0
  44. package/dist/Dom/Types.d.ts +570 -0
  45. package/dist/Dom/Types.d.ts.map +1 -0
  46. package/dist/Dom/Types.js +1 -0
  47. package/dist/Dom/index.d.ts +20 -0
  48. package/dist/Dom/index.d.ts.map +1 -0
  49. package/dist/Dom/index.js +8 -0
  50. package/dist/Dom.d.ts +14 -0
  51. package/dist/Dom.d.ts.map +1 -0
  52. package/dist/Dom.js +13 -0
  53. package/dist/Focusable.d.ts +85 -0
  54. package/dist/Focusable.d.ts.map +1 -0
  55. package/dist/Focusable.js +35 -0
  56. package/dist/Form.d.ts +1695 -0
  57. package/dist/Form.d.ts.map +1 -0
  58. package/dist/Form.js +987 -0
  59. package/dist/Grid.d.ts +569 -0
  60. package/dist/Grid.d.ts.map +1 -0
  61. package/dist/Grid.js +379 -0
  62. package/dist/Group.d.ts +147 -0
  63. package/dist/Group.d.ts.map +1 -0
  64. package/dist/Group.js +63 -0
  65. package/dist/Heading.d.ts +86 -0
  66. package/dist/Heading.d.ts.map +1 -0
  67. package/dist/Heading.js +48 -0
  68. package/dist/Hovercard.d.ts +297 -0
  69. package/dist/Hovercard.d.ts.map +1 -0
  70. package/dist/Hovercard.js +188 -0
  71. package/dist/HttpRouter.d.ts +129 -6
  72. package/dist/HttpRouter.d.ts.map +1 -1
  73. package/dist/HttpRouter.js +197 -54
  74. package/dist/Link.d.ts +67 -28
  75. package/dist/Link.d.ts.map +1 -1
  76. package/dist/Link.js +91 -37
  77. package/dist/Listbox.d.ts +437 -0
  78. package/dist/Listbox.d.ts.map +1 -0
  79. package/dist/Listbox.js +316 -0
  80. package/dist/Menu.d.ts +972 -0
  81. package/dist/Menu.d.ts.map +1 -0
  82. package/dist/Menu.js +731 -0
  83. package/dist/Menubar.d.ts +367 -0
  84. package/dist/Menubar.d.ts.map +1 -0
  85. package/dist/Menubar.js +265 -0
  86. package/dist/Meter.d.ts +217 -0
  87. package/dist/Meter.d.ts.map +1 -0
  88. package/dist/Meter.js +94 -0
  89. package/dist/NativeDetails.d.ts +41 -0
  90. package/dist/NativeDetails.d.ts.map +1 -0
  91. package/dist/NativeDetails.js +40 -0
  92. package/dist/NativeDialog.d.ts +64 -0
  93. package/dist/NativeDialog.d.ts.map +1 -0
  94. package/dist/NativeDialog.js +50 -0
  95. package/dist/NativePopover.d.ts +41 -0
  96. package/dist/NativePopover.d.ts.map +1 -0
  97. package/dist/NativePopover.js +46 -0
  98. package/dist/Popover.d.ts +241 -0
  99. package/dist/Popover.d.ts.map +1 -0
  100. package/dist/Popover.js +141 -0
  101. package/dist/RadioGroup.d.ts +432 -0
  102. package/dist/RadioGroup.d.ts.map +1 -0
  103. package/dist/RadioGroup.js +291 -0
  104. package/dist/Role.d.ts +64 -0
  105. package/dist/Role.d.ts.map +1 -0
  106. package/dist/Role.js +27 -0
  107. package/dist/Select.d.ts +529 -0
  108. package/dist/Select.d.ts.map +1 -0
  109. package/dist/Select.js +407 -0
  110. package/dist/Separator.d.ts +54 -0
  111. package/dist/Separator.d.ts.map +1 -0
  112. package/dist/Separator.js +26 -0
  113. package/dist/Slider.d.ts +188 -0
  114. package/dist/Slider.d.ts.map +1 -0
  115. package/dist/Slider.js +96 -0
  116. package/dist/SpinButton.d.ts +188 -0
  117. package/dist/SpinButton.d.ts.map +1 -0
  118. package/dist/SpinButton.js +96 -0
  119. package/dist/Storybook.d.ts +76 -0
  120. package/dist/Storybook.d.ts.map +1 -0
  121. package/dist/Storybook.js +102 -0
  122. package/dist/Switch.d.ts +187 -0
  123. package/dist/Switch.d.ts.map +1 -0
  124. package/dist/Switch.js +116 -0
  125. package/dist/Tab.d.ts +26 -0
  126. package/dist/Tab.d.ts.map +1 -0
  127. package/dist/Tab.js +25 -0
  128. package/dist/Tabs.d.ts +591 -0
  129. package/dist/Tabs.d.ts.map +1 -0
  130. package/dist/Tabs.js +346 -0
  131. package/dist/Toolbar.d.ts +366 -0
  132. package/dist/Toolbar.d.ts.map +1 -0
  133. package/dist/Toolbar.js +245 -0
  134. package/dist/Tooltip.d.ts +296 -0
  135. package/dist/Tooltip.d.ts.map +1 -0
  136. package/dist/Tooltip.js +172 -0
  137. package/dist/Tree.d.ts +591 -0
  138. package/dist/Tree.d.ts.map +1 -0
  139. package/dist/Tree.js +434 -0
  140. package/dist/TreeGrid.d.ts +645 -0
  141. package/dist/TreeGrid.d.ts.map +1 -0
  142. package/dist/TreeGrid.js +420 -0
  143. package/dist/VisuallyHidden.d.ts +54 -0
  144. package/dist/VisuallyHidden.d.ts.map +1 -0
  145. package/dist/VisuallyHidden.js +27 -0
  146. package/dist/WindowSplitter.d.ts +376 -0
  147. package/dist/WindowSplitter.d.ts.map +1 -0
  148. package/dist/WindowSplitter.js +222 -0
  149. package/dist/index.d.ts +49 -0
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +49 -0
  152. package/package.json +42 -15
  153. package/src/HttpRouter.test.ts +0 -294
  154. package/src/HttpRouter.ts +0 -168
  155. package/src/Link.test.ts +0 -84
  156. package/src/Link.ts +0 -107
  157. package/src/index.ts +0 -2
@@ -0,0 +1,823 @@
1
+ /**
2
+ * Composite contains the reusable policy behind roving tabindex and virtual focus. Its pure
3
+ * helpers define orientation, RTL, wrapping, disabled-item, typeahead, and DOM-order rules; Effect
4
+ * helpers perform focus and scrolling only when run.
5
+ *
6
+ * @remarks
7
+ * The module keeps policy, state transitions, and DOM rendering separable so applications can use
8
+ * the state and pure operations without mounting UI, or supply custom hosts without replacing native
9
+ * events and browser-owned focus.
10
+ *
11
+ * @since 1.0.0
12
+ * @category modules
13
+ * @packageDocumentation
14
+ */
15
+ import * as Effect from "effect/Effect";
16
+ import * as Schema from "effect/Schema";
17
+ import { RefSubject } from "@typed/fx";
18
+ import * as Collection from "./Collection.js";
19
+ /**
20
+ * Supported composite movement axes.
21
+ *
22
+ * @remarks
23
+ * ## Why
24
+ *
25
+ * The public model lets custom composites reuse Composite's deterministic policy without copying
26
+ * an internal shape.
27
+ *
28
+ * ## Ownership and lifetime
29
+ *
30
+ * This declaration is data or schema metadata and acquires no resources.
31
+ *
32
+ * ## Example
33
+ *
34
+ * Import with `import type { Orientation } from "@typed/ui/Composite";` Extend the
35
+ * [Composite.makeState runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Choose an
36
+ * axis policy explicitly: `const orientation: Orientation = "horizontal"`.
37
+ * @since 1.0.0
38
+ * @category models
39
+ */
40
+ export type Orientation = "horizontal" | "vertical" | "both";
41
+ /**
42
+ * Logical movement operations independent of physical key names.
43
+ *
44
+ * @remarks
45
+ * ## Why
46
+ *
47
+ * The public model lets custom composites reuse Composite's deterministic policy without copying
48
+ * an internal shape.
49
+ *
50
+ * ## Ownership and lifetime
51
+ *
52
+ * This declaration is data or schema metadata and acquires no resources.
53
+ *
54
+ * ## Example
55
+ *
56
+ * Import with `import type { Move } from "@typed/ui/Composite";` Extend the [Composite.makeState
57
+ * runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Choose a supported movement
58
+ * operation explicitly: `const direction: Move = "next"`.
59
+ * @since 1.0.0
60
+ * @category models
61
+ */
62
+ export type Move = "next" | "previous" | "first" | "last";
63
+ /**
64
+ * Complete renderer-independent state for Composite.
65
+ *
66
+ * @remarks
67
+ * ## Why
68
+ *
69
+ * Applications can inspect, update, and test Composite behavior without mounting or coupling the
70
+ * state to a renderer.
71
+ *
72
+ * ## Ownership and lifetime
73
+ *
74
+ * This declaration is data or schema metadata and acquires no resources.
75
+ *
76
+ * ## Example
77
+ *
78
+ * Import with `import type { State } from "@typed/ui/Composite";` Extend the [Composite.makeState
79
+ * runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Inside the linked program,
80
+ * `const snapshot: State = yield* state` exposes focus, orientation, looping, RTL, and
81
+ * virtual-focus policy.
82
+ * @since 1.0.0
83
+ * @category models
84
+ */
85
+ export interface State {
86
+ /**
87
+ * Id currently active for keyboard navigation; null means no active item.
88
+ * @since 1.0.0
89
+ * @category models
90
+ */
91
+ readonly activeId: string | null;
92
+ /**
93
+ * Axis used to interpret Arrow-key movement.
94
+ * @since 1.0.0
95
+ * @category models
96
+ */
97
+ readonly orientation: Orientation;
98
+ /**
99
+ * Whether movement wraps between the first and last enabled items.
100
+ * @since 1.0.0
101
+ * @category models
102
+ */
103
+ readonly loop: boolean;
104
+ /**
105
+ * Whether horizontal Arrow-key meaning is reversed for right-to-left layout.
106
+ * @since 1.0.0
107
+ * @category models
108
+ */
109
+ readonly rtl: boolean;
110
+ /**
111
+ * Whether DOM focus remains on the root and activeId is exposed via aria-activedescendant.
112
+ * @since 1.0.0
113
+ * @category models
114
+ */
115
+ readonly virtualFocus: boolean;
116
+ }
117
+ /**
118
+ * Initial Composite values. activeId defaults to null, orientation to horizontal, loop to true,
119
+ * RTL and virtual focus to false.
120
+ *
121
+ * @remarks
122
+ * ## Why
123
+ *
124
+ * Making initialization explicit documents hydration-sensitive defaults and lets servers and
125
+ * clients construct matching state.
126
+ *
127
+ * ## Ownership and lifetime
128
+ *
129
+ * This declaration is data or schema metadata and acquires no resources.
130
+ *
131
+ * ## Example
132
+ *
133
+ * Import with `import type { InitialState } from "@typed/ui/Composite";` Extend the
134
+ * [Composite.makeState runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Construct
135
+ * policy explicitly with
136
+ * `const initial: InitialState = { activeId: null, orientation: "vertical", loop: false, rtl: false, virtualFocus: true }; const state = yield* Composite.makeState(initial)`.
137
+ * @since 1.0.0
138
+ * @category models
139
+ */
140
+ export interface InitialState {
141
+ /**
142
+ * Id currently active for keyboard navigation; null means no active item.
143
+ * @since 1.0.0
144
+ * @category models
145
+ */
146
+ readonly activeId?: string | null;
147
+ /**
148
+ * Axis used to interpret Arrow-key movement.
149
+ * @since 1.0.0
150
+ * @category models
151
+ */
152
+ readonly orientation?: Orientation;
153
+ /**
154
+ * Whether movement wraps between the first and last enabled items.
155
+ * @since 1.0.0
156
+ * @category models
157
+ */
158
+ readonly loop?: boolean;
159
+ /**
160
+ * Whether horizontal Arrow-key meaning is reversed for right-to-left layout.
161
+ * @since 1.0.0
162
+ * @category models
163
+ */
164
+ readonly rtl?: boolean;
165
+ /**
166
+ * Whether DOM focus remains on the root and activeId is exposed via aria-activedescendant.
167
+ * @since 1.0.0
168
+ * @category models
169
+ */
170
+ readonly virtualFocus?: boolean;
171
+ }
172
+ /**
173
+ * State, collection, and disabled-item policy consumed by Composite movement helpers.
174
+ *
175
+ * @remarks
176
+ * ## Why
177
+ *
178
+ * Keeping both RefSubjects and the disabled-item policy in one value preserves their independent
179
+ * error and service channels across movement, focus, and scrolling helpers.
180
+ *
181
+ * ## Ownership and lifetime
182
+ *
183
+ * This declaration is data or schema metadata and acquires no resources.
184
+ *
185
+ * ## Example
186
+ *
187
+ * Import with `import type { MoveOptions } from "@typed/ui/Composite";` Extend the
188
+ * [Composite.makeState runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Combine
189
+ * the only three inputs with
190
+ * `const options: MoveOptions<string, State> = { state, collection, includeDisabled: false }`.
191
+ * @since 1.0.0
192
+ * @category models
193
+ */
194
+ export interface MoveOptions<Value = unknown, CompositeState extends State = State, E = never, R = never, E2 = never, R2 = never, Element extends object = globalThis.Element> {
195
+ /**
196
+ * Renderer-independent RefSubject state consumed by this component or operation.
197
+ * @since 1.0.0
198
+ * @category models
199
+ */
200
+ readonly state: RefSubject.RefSubject<CompositeState, E, R>;
201
+ /**
202
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
203
+ * @since 1.0.0
204
+ * @category models
205
+ */
206
+ readonly collection: RefSubject.RefSubject<Collection.State<Value, Element>, E2, R2>;
207
+ /**
208
+ * Whether movement may land on disabled collection items.
209
+ * @since 1.0.0
210
+ * @category models
211
+ */
212
+ readonly includeDisabled?: boolean;
213
+ }
214
+ /**
215
+ * Public Composite.ActiveIdState behavioral model.
216
+ *
217
+ * @remarks
218
+ * ## Why
219
+ *
220
+ * The public model lets custom composites reuse Composite's deterministic policy without copying
221
+ * an internal shape.
222
+ *
223
+ * ## Ownership and lifetime
224
+ *
225
+ * This declaration is data or schema metadata and acquires no resources.
226
+ *
227
+ * ## Example
228
+ *
229
+ * Import with `import type { ActiveIdState } from "@typed/ui/Composite";` Extend the
230
+ * [Composite.makeState runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). A
231
+ * compatible focus state is observable directly: `const active: ActiveIdState = yield* state`.
232
+ * @since 1.0.0
233
+ * @category models
234
+ */
235
+ export interface ActiveIdState {
236
+ /**
237
+ * Id currently active for keyboard navigation; null means no active item.
238
+ * @since 1.0.0
239
+ * @category models
240
+ */
241
+ readonly activeId: string | null;
242
+ /**
243
+ * Whether movement wraps between the first and last enabled items.
244
+ * @since 1.0.0
245
+ * @category models
246
+ */
247
+ readonly loop: boolean;
248
+ }
249
+ /**
250
+ * Public Composite.KeyboardEventLike behavioral model.
251
+ *
252
+ * @remarks
253
+ * ## Why
254
+ *
255
+ * The public model lets custom composites reuse Composite's deterministic policy without copying
256
+ * an internal shape.
257
+ *
258
+ * ## Ownership and lifetime
259
+ *
260
+ * This declaration is data or schema metadata and acquires no resources.
261
+ *
262
+ * ## Example
263
+ *
264
+ * Import with `import type { KeyboardEventLike } from "@typed/ui/Composite";` Extend the
265
+ * [Composite.makeState runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Custom
266
+ * keyboard adapters need only the modeled surface:
267
+ * `const event: KeyboardEventLike = { key: "ArrowDown", preventDefault() {} }`.
268
+ * @since 1.0.0
269
+ * @category models
270
+ */
271
+ export interface KeyboardEventLike {
272
+ /**
273
+ * Native KeyboardEvent key value to interpret.
274
+ * @since 1.0.0
275
+ * @category models
276
+ */
277
+ readonly key: string;
278
+ /**
279
+ * Whether Alt modified the key event.
280
+ * @since 1.0.0
281
+ * @category models
282
+ */
283
+ readonly altKey?: boolean;
284
+ /**
285
+ * Whether Control modified the key event.
286
+ * @since 1.0.0
287
+ * @category models
288
+ */
289
+ readonly ctrlKey?: boolean;
290
+ /**
291
+ * Whether Meta modified the key event.
292
+ * @since 1.0.0
293
+ * @category models
294
+ */
295
+ readonly metaKey?: boolean;
296
+ /**
297
+ * Optional native-event callback invoked only for an internally handled key.
298
+ * @since 1.0.0
299
+ * @category models
300
+ */
301
+ preventDefault?: () => void;
302
+ }
303
+ /**
304
+ * Public Composite.TypeaheadBuffer behavioral model.
305
+ *
306
+ * @remarks
307
+ * ## Why
308
+ *
309
+ * The public model lets custom composites reuse Composite's deterministic policy without copying
310
+ * an internal shape.
311
+ *
312
+ * ## Ownership and lifetime
313
+ *
314
+ * This declaration is data or schema metadata and acquires no resources.
315
+ *
316
+ * ## Example
317
+ *
318
+ * Import with `import type { TypeaheadBuffer } from "@typed/ui/Composite";` Extend the
319
+ * [Composite.makeState runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Retain
320
+ * the exact typed query and timestamp with
321
+ * `const buffer: TypeaheadBuffer = { value: "Ty", updatedAt: 100 }`.
322
+ * @since 1.0.0
323
+ * @category models
324
+ */
325
+ export interface TypeaheadBuffer {
326
+ /**
327
+ * Buffered typeahead key sequence, preserving the supplied key case.
328
+ * @since 1.0.0
329
+ * @category models
330
+ */
331
+ readonly value: string;
332
+ /**
333
+ * Timestamp of the last typeahead key, used to decide whether to append or restart.
334
+ * @since 1.0.0
335
+ * @category models
336
+ */
337
+ readonly updatedAt: number;
338
+ }
339
+ /**
340
+ * Effect Schema used by makeState to encode, decode, and hydrate Composite state.
341
+ *
342
+ * @remarks
343
+ * ## Why
344
+ *
345
+ * A public schema makes hydration and serialized state use the same runtime validation as direct
346
+ * construction.
347
+ *
348
+ * ## Ownership and lifetime
349
+ *
350
+ * This declaration is data or schema metadata and acquires no resources.
351
+ *
352
+ * @example
353
+ * ```ts
354
+ * import * as Schema from "effect/Schema";
355
+ * import * as Composite from "@typed/ui/Composite";
356
+ *
357
+ * const decodeState = Schema.decodeUnknownEffect(Composite.StateSchema);
358
+ * ```
359
+ * @since 1.0.0
360
+ * @category schemas
361
+ */
362
+ export declare const StateSchema: Schema.Struct<{
363
+ readonly activeId: Schema.NullOr<Schema.String>;
364
+ readonly orientation: Schema.Literals<readonly ["horizontal", "vertical", "both"]>;
365
+ readonly loop: Schema.Boolean;
366
+ readonly rtl: Schema.Boolean;
367
+ readonly virtualFocus: Schema.Boolean;
368
+ }>;
369
+ /**
370
+ * Creates hydrated Composite state. activeId defaults to null, orientation to horizontal, loop to
371
+ * true, RTL and virtual focus to false.
372
+ *
373
+ * @remarks
374
+ * ## Why
375
+ *
376
+ * State and collection ownership can be composed and tested independently from any renderer.
377
+ *
378
+ * ## Ownership and lifetime
379
+ *
380
+ * The returned Effect creates the RefSubject when run. That state is renderer-independent;
381
+ * collection registrations belong to the separate Scope that runs register or ref, not to state
382
+ * creation.
383
+ *
384
+ * @example
385
+ * ```ts
386
+ * import * as Effect from "effect/Effect";
387
+ * import * as Collection from "@typed/ui/Collection";
388
+ * import * as Composite from "@typed/ui/Composite";
389
+ *
390
+ * const program = Effect.scoped(
391
+ * Effect.gen(function* () {
392
+ * const state = yield* Composite.makeState({});
393
+ * const collection = yield* Collection.makeState<string>();
394
+ * return { state: yield* state, collection: yield* collection };
395
+ * }),
396
+ * );
397
+ * ```
398
+ * @since 1.0.0
399
+ * @category constructors
400
+ */
401
+ export declare function makeState(initial?: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
402
+ readonly activeId: string | null;
403
+ readonly orientation: "both" | "horizontal" | "vertical";
404
+ readonly loop: boolean;
405
+ readonly rtl: boolean;
406
+ readonly virtualFocus: boolean;
407
+ }, Schema.SchemaError, never, never>, never, import("effect/Scope").Scope>;
408
+ /**
409
+ * Computes the next active id and updates state; collection and state failures/services are
410
+ * preserved in the returned Effect.
411
+ *
412
+ * @remarks
413
+ * ## Why
414
+ *
415
+ * The operation exposes Composite's transition directly so callers can compose it in Effect
416
+ * programs and native event handlers.
417
+ *
418
+ * ## Ownership and lifetime
419
+ *
420
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
421
+ * error and service channels, and retains no resources after completion.
422
+ *
423
+ * ## Example
424
+ *
425
+ * Import with `import { move } from "@typed/ui/Composite";` Extend the [Composite.makeState
426
+ * runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Inside the linked Effect
427
+ * program invoke `yield* move({ state, collection }, "next")`, then read state to observe the next
428
+ * enabled registered id selected under the current loop policy.
429
+ * @since 1.0.0
430
+ * @category combinators
431
+ */
432
+ export declare function move<Value, CompositeState extends State, E, R, E2, R2, Element extends object>(options: MoveOptions<Value, CompositeState, E, R, E2, R2, Element>, direction: Move): Effect.Effect<CompositeState, E | E2, R | R2>;
433
+ /**
434
+ * Derives 0 only for the active item under roving focus; virtual-focus items always receive -1.
435
+ *
436
+ * @remarks
437
+ * ## Why
438
+ *
439
+ * The operation exposes Composite's transition directly so callers can compose it in Effect
440
+ * programs and native event handlers.
441
+ *
442
+ * ## Ownership and lifetime
443
+ *
444
+ * Creating the Computed value acquires nothing eagerly. The Scope that subscribes to it owns
445
+ * observation of the source RefSubject.
446
+ *
447
+ * ## Example
448
+ *
449
+ * Import with `import { tabIndex } from "@typed/ui/Composite";` Extend the [Composite.makeState
450
+ * runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Inside the linked Effect
451
+ * program read `const value = yield* tabIndex(state, "item-2")`; it is `0` only while that item
452
+ * owns roving focus and is `-1` under virtual focus.
453
+ * @since 1.0.0
454
+ * @category combinators
455
+ */
456
+ export declare function tabIndex<CompositeState extends State, E, R>(state: RefSubject.RefSubject<CompositeState, E, R>, id: string): RefSubject.Computed<0 | -1, E, R>;
457
+ /**
458
+ * Derives activeId only under virtual focus, otherwise undefined.
459
+ *
460
+ * @remarks
461
+ * ## Why
462
+ *
463
+ * The operation exposes Composite's transition directly so callers can compose it in Effect
464
+ * programs and native event handlers.
465
+ *
466
+ * ## Ownership and lifetime
467
+ *
468
+ * Creating the Computed value acquires nothing eagerly. The Scope that subscribes to it owns
469
+ * observation of the source RefSubject.
470
+ *
471
+ * ## Example
472
+ *
473
+ * Import with `import { activeDescendant } from "@typed/ui/Composite";` Extend the
474
+ * [Composite.makeState runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Inside
475
+ * the linked Effect program read `const id = yield* activeDescendant(state)`; it is the active id
476
+ * only under virtual focus and otherwise `undefined`.
477
+ * @since 1.0.0
478
+ * @category combinators
479
+ */
480
+ export declare function activeDescendant<CompositeState extends State, E, R>(state: RefSubject.RefSubject<CompositeState, E, R>): RefSubject.Computed<string | undefined, E, R>;
481
+ /**
482
+ * Derives 0 when the root owns focus and -1 once a roving-focus item is active.
483
+ *
484
+ * @remarks
485
+ * ## Why
486
+ *
487
+ * The operation exposes Composite's transition directly so callers can compose it in Effect
488
+ * programs and native event handlers.
489
+ *
490
+ * ## Ownership and lifetime
491
+ *
492
+ * Creating the Computed value acquires nothing eagerly. The Scope that subscribes to it owns
493
+ * observation of the source RefSubject.
494
+ *
495
+ * ## Example
496
+ *
497
+ * Import with `import { rootTabIndex } from "@typed/ui/Composite";` Extend the [Composite.makeState
498
+ * runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Inside the linked Effect
499
+ * program read `const value = yield* rootTabIndex(state)`; it is `0` while the root owns focus and
500
+ * `-1` after a roving-focus item becomes active.
501
+ * @since 1.0.0
502
+ * @category combinators
503
+ */
504
+ export declare function rootTabIndex<CompositeState extends State, E, R>(state: RefSubject.RefSubject<CompositeState, E, R>): RefSubject.Computed<0 | -1, E, R>;
505
+ /**
506
+ * Maps Home/End and orientation-aware Arrow keys to movement, reversing horizontal arrows for RTL.
507
+ *
508
+ * @remarks
509
+ * ## Why
510
+ *
511
+ * Separating this deterministic policy from event wiring lets applications test it directly and
512
+ * reuse it in custom composites.
513
+ *
514
+ * ## Ownership and lifetime
515
+ *
516
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
517
+ * state, event, or DOM.
518
+ *
519
+ * @example
520
+ * ```ts
521
+ * import * as Composite from "@typed/ui/Composite";
522
+ *
523
+ * const direction = Composite.keyMove({ key: "ArrowLeft" }, { orientation: "horizontal", rtl: true });
524
+ * ```
525
+ * @since 1.0.0
526
+ * @category combinators
527
+ */
528
+ export declare function keyMove(event: Pick<KeyboardEventLike, "key">, options: {
529
+ readonly orientation?: Orientation;
530
+ readonly rtl?: boolean;
531
+ }): Move | undefined;
532
+ /**
533
+ * Prevents the native key default only when keyMove recognizes the key, then updates active state.
534
+ *
535
+ * @remarks
536
+ * ## Why
537
+ *
538
+ * The operation exposes Composite's transition directly so callers can compose it in Effect
539
+ * programs and native event handlers.
540
+ *
541
+ * ## Ownership and lifetime
542
+ *
543
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
544
+ * error and service channels, and retains no resources after completion.
545
+ *
546
+ * ## Example
547
+ *
548
+ * Import with `import { moveByKey } from "@typed/ui/Composite";` Extend the [Composite.makeState
549
+ * runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Inside the linked Effect
550
+ * program run `yield* moveByKey({ key: "ArrowDown" }, { state, collection })`, then read state to
551
+ * observe the active id selected by the current orientation and RTL policy.
552
+ * @since 1.0.0
553
+ * @category combinators
554
+ */
555
+ export declare function moveByKey<Value, CompositeState extends State, E, R, E2, R2, Element extends object>(event: KeyboardEventLike, options: MoveOptions<Value, CompositeState, E, R, E2, R2, Element>): Effect.Effect<boolean, E | E2, R | R2>;
556
+ /**
557
+ * Moves active state, then focuses and scrolls the mounted active item when virtual focus is
558
+ * disabled.
559
+ *
560
+ * @remarks
561
+ * ## Why
562
+ *
563
+ * The operation exposes Composite's transition directly so callers can compose it in Effect
564
+ * programs and native event handlers.
565
+ *
566
+ * ## Ownership and lifetime
567
+ *
568
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
569
+ * error and service channels, and retains no resources after completion.
570
+ *
571
+ * ## Example
572
+ *
573
+ * Import with `import { moveAndFocus } from "@typed/ui/Composite";` Extend the [Composite.makeState
574
+ * runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Inside the linked Effect
575
+ * program run `yield* moveAndFocus({ state, collection }, "next")`; the returned state names the
576
+ * next id and its registered element receives native focus.
577
+ * @since 1.0.0
578
+ * @category combinators
579
+ */
580
+ export declare function moveAndFocus<Value, CompositeState extends State, E, R, E2, R2, Element extends object>(options: MoveOptions<Value, CompositeState, E, R, E2, R2, Element>, direction: Move): Effect.Effect<CompositeState, E | E2, R | R2>;
581
+ /**
582
+ * Focuses the registered active element unless state uses virtual focus or has no active id.
583
+ *
584
+ * @remarks
585
+ * ## Why
586
+ *
587
+ * The operation exposes Composite's transition directly so callers can compose it in Effect
588
+ * programs and native event handlers.
589
+ *
590
+ * ## Ownership and lifetime
591
+ *
592
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
593
+ * error and service channels, and retains no resources after completion.
594
+ *
595
+ * ## Example
596
+ *
597
+ * Import with `import { focusActive } from "@typed/ui/Composite";` Extend the [Composite.makeState
598
+ * runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Inside the linked Effect
599
+ * program run `yield* focusActive({ state, collection })`; the active registered element receives
600
+ * native focus, with no state transition when no matching element exists.
601
+ * @since 1.0.0
602
+ * @category combinators
603
+ */
604
+ export declare function focusActive<Value, CompositeState extends State, E, R, E2, R2, Element extends object>(options: MoveOptions<Value, CompositeState, E, R, E2, R2, Element>): Effect.Effect<void, E | E2, R | R2>;
605
+ /**
606
+ * Calls an existing platform focus method inside Effect.sync and otherwise does nothing.
607
+ *
608
+ * @remarks
609
+ * ## Why
610
+ *
611
+ * The operation exposes Composite's transition directly so callers can compose it in Effect
612
+ * programs and native event handlers.
613
+ *
614
+ * ## Ownership and lifetime
615
+ *
616
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
617
+ * error and service channels, and retains no resources after completion.
618
+ *
619
+ * @example
620
+ * ```ts
621
+ * import * as Composite from "@typed/ui/Composite";
622
+ *
623
+ * const focused = Composite.focusElement(document.querySelector("button") ?? undefined);
624
+ * ```
625
+ * @since 1.0.0
626
+ * @category combinators
627
+ */
628
+ export declare function focusElement(element: object | undefined): Effect.Effect<void>;
629
+ /**
630
+ * Calls scrollIntoView with nearest block/inline alignment for the mounted active item.
631
+ *
632
+ * @remarks
633
+ * ## Why
634
+ *
635
+ * The operation exposes Composite's transition directly so callers can compose it in Effect
636
+ * programs and native event handlers.
637
+ *
638
+ * ## Ownership and lifetime
639
+ *
640
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
641
+ * error and service channels, and retains no resources after completion.
642
+ *
643
+ * ## Example
644
+ *
645
+ * Import with `import { scrollActive } from "@typed/ui/Composite";` Extend the [Composite.makeState
646
+ * runnable setup](/reference/%40typed%2Fui%2FComposite%23makeState). Inside the linked Effect
647
+ * program run `yield* scrollActive({ state, collection })`; the active registered element receives
648
+ * `scrollIntoView({ block: "nearest", inline: "nearest" })` when that method is available.
649
+ * @since 1.0.0
650
+ * @category combinators
651
+ */
652
+ export declare function scrollActive<Value, CompositeState extends State, E, R, E2, R2, Element extends object>(options: MoveOptions<Value, CompositeState, E, R, E2, R2, Element>): Effect.Effect<void, E | E2, R | R2>;
653
+ /**
654
+ * Returns the first enabled item id in DOM order whose textValue starts with the query.
655
+ *
656
+ * @remarks
657
+ * ## Why
658
+ *
659
+ * Separating this deterministic policy from event wiring lets applications test it directly and
660
+ * reuse it in custom composites.
661
+ *
662
+ * ## Ownership and lifetime
663
+ *
664
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
665
+ * state, event, or DOM.
666
+ *
667
+ * @example
668
+ * ```ts
669
+ * import * as Composite from "@typed/ui/Composite";
670
+ *
671
+ * const id = Composite.typeahead([{ id: "alpha", textValue: "Alpha" }], "al");
672
+ * ```
673
+ * @since 1.0.0
674
+ * @category combinators
675
+ */
676
+ export declare function typeahead<Item extends Collection.Item<unknown, object>>(items: readonly Item[], search: string, text?: (item: Item) => string, includeDisabled?: boolean): string | null;
677
+ /**
678
+ * Returns only the id selected by typeahead, or null when no item matches.
679
+ *
680
+ * @remarks
681
+ * ## Why
682
+ *
683
+ * Separating this deterministic policy from event wiring lets applications test it directly and
684
+ * reuse it in custom composites.
685
+ *
686
+ * ## Ownership and lifetime
687
+ *
688
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
689
+ * state, event, or DOM.
690
+ *
691
+ * @example
692
+ * ```ts
693
+ * import * as Composite from "@typed/ui/Composite";
694
+ *
695
+ * const id = Composite.typeaheadFrom([{ id: "alpha", textValue: "Alpha" }], "al", null);
696
+ * ```
697
+ * @since 1.0.0
698
+ * @category combinators
699
+ */
700
+ export declare function typeaheadFrom<Item extends Collection.Item<unknown, object>>(items: readonly Item[], search: string, activeId: string | null, text?: (item: Item) => string, includeDisabled?: boolean): string | null;
701
+ /**
702
+ * Returns an unmodified one-character key exactly as provided; modified and multi-character keys
703
+ * return null.
704
+ *
705
+ * @remarks
706
+ * ## Why
707
+ *
708
+ * Separating this deterministic policy from event wiring lets applications test it directly and
709
+ * reuse it in custom composites.
710
+ *
711
+ * ## Ownership and lifetime
712
+ *
713
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
714
+ * state, event, or DOM.
715
+ *
716
+ * @example
717
+ * ```ts
718
+ * import * as Composite from "@typed/ui/Composite";
719
+ *
720
+ * const key = Composite.typeaheadKey({ key: "A" });
721
+ * ```
722
+ * @since 1.0.0
723
+ * @category combinators
724
+ */
725
+ export declare function typeaheadKey(event: KeyboardEventLike): string | null;
726
+ /**
727
+ * Appends within the timeout window and starts a new query after the buffer expires.
728
+ *
729
+ * @remarks
730
+ * ## Why
731
+ *
732
+ * Separating this deterministic policy from event wiring lets applications test it directly and
733
+ * reuse it in custom composites.
734
+ *
735
+ * ## Ownership and lifetime
736
+ *
737
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
738
+ * state, event, or DOM.
739
+ *
740
+ * @example
741
+ * ```ts
742
+ * import * as Composite from "@typed/ui/Composite";
743
+ *
744
+ * const buffer = Composite.updateTypeaheadBuffer({ value: "a", updatedAt: 100 }, "b", 200);
745
+ * ```
746
+ * @since 1.0.0
747
+ * @category combinators
748
+ */
749
+ export declare function updateTypeaheadBuffer(buffer: TypeaheadBuffer, key: string, now: number, timeout?: number): TypeaheadBuffer;
750
+ /**
751
+ * Sorts a copy by mounted DOM order and then removes disabled items.
752
+ *
753
+ * @remarks
754
+ * ## Why
755
+ *
756
+ * Separating this deterministic policy from event wiring lets applications test it directly and
757
+ * reuse it in custom composites.
758
+ *
759
+ * ## Ownership and lifetime
760
+ *
761
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
762
+ * state, event, or DOM.
763
+ *
764
+ * @example
765
+ * ```ts
766
+ * import * as Composite from "@typed/ui/Composite";
767
+ *
768
+ * const items = Composite.orderedEnabledItems([{ id: "a" }, { id: "b", disabled: true }]);
769
+ * ```
770
+ * @since 1.0.0
771
+ * @category combinators
772
+ */
773
+ export declare function orderedEnabledItems<Item extends Collection.Item<unknown, object>>(items: readonly Item[]): readonly Item[];
774
+ /**
775
+ * Returns the id reached by first/last/next/previous with optional disabled inclusion and loop
776
+ * policy.
777
+ *
778
+ * @remarks
779
+ * ## Why
780
+ *
781
+ * Separating this deterministic policy from event wiring lets applications test it directly and
782
+ * reuse it in custom composites.
783
+ *
784
+ * ## Ownership and lifetime
785
+ *
786
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
787
+ * state, event, or DOM.
788
+ *
789
+ * @example
790
+ * ```ts
791
+ * import * as Composite from "@typed/ui/Composite";
792
+ *
793
+ * const id = Composite.moveActiveId([{ id: "a" }, { id: "b" }], { activeId: "a", loop: true }, "next");
794
+ * ```
795
+ * @since 1.0.0
796
+ * @category combinators
797
+ */
798
+ export declare function moveActiveId<Item extends Collection.Item<unknown, object>>(items: readonly Item[], state: ActiveIdState, direction: Move, includeDisabled?: boolean): string | null;
799
+ /**
800
+ * Returns the full item selected by moveActiveId, or undefined when no item is reachable.
801
+ *
802
+ * @remarks
803
+ * ## Why
804
+ *
805
+ * Separating this deterministic policy from event wiring lets applications test it directly and
806
+ * reuse it in custom composites.
807
+ *
808
+ * ## Ownership and lifetime
809
+ *
810
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
811
+ * state, event, or DOM.
812
+ *
813
+ * @example
814
+ * ```ts
815
+ * import * as Composite from "@typed/ui/Composite";
816
+ *
817
+ * const item = Composite.moveActiveItem([{ id: "a" }, { id: "b" }], { activeId: "a", loop: true }, "next");
818
+ * ```
819
+ * @since 1.0.0
820
+ * @category combinators
821
+ */
822
+ export declare function moveActiveItem<Item extends Collection.Item<unknown, object>>(items: readonly Item[], state: ActiveIdState, direction: Move, includeDisabled?: boolean): Item | undefined;
823
+ //# sourceMappingURL=Composite.d.ts.map