@typed/ui 1.0.0-beta.4 → 1.0.0-beta.6

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 +196 -53
  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 +45 -18
  153. package/src/HttpRouter.test.ts +0 -256
  154. package/src/HttpRouter.ts +0 -165
  155. package/src/Link.test.ts +0 -84
  156. package/src/Link.ts +0 -107
  157. package/src/index.ts +0 -2
package/dist/Grid.d.ts ADDED
@@ -0,0 +1,569 @@
1
+ /**
2
+ * Grid is a virtual-focus ARIA grid. The root retains DOM focus while the active cell id is
3
+ * exposed through aria-activedescendant; CellPosition supplies row and column coordinates for
4
+ * two-dimensional movement.
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 type * as Scope from "effect/Scope";
17
+ import * as Schema from "effect/Schema";
18
+ import type { Fx } from "@typed/fx/Fx";
19
+ import { RefSubject } from "@typed/fx";
20
+ import { EventHandler, type Renderable, type RenderEvent, type RenderTemplate } from "@typed/template";
21
+ import * as Collection from "./Collection.js";
22
+ import * as Dom from "./Dom.js";
23
+ import type { HostResult } from "./Dom/Types.js";
24
+ /**
25
+ * Complete renderer-independent state for Grid.
26
+ *
27
+ * @remarks
28
+ * ## Why
29
+ *
30
+ * Applications can inspect, update, and test Grid behavior without mounting or coupling the state
31
+ * to a renderer.
32
+ *
33
+ * ## Ownership and lifetime
34
+ *
35
+ * This declaration is data or schema metadata and acquires no resources.
36
+ *
37
+ * ## Example
38
+ *
39
+ * Import with `import type { State } from "@typed/ui/Grid";` Extend the [Grid.makeState runnable
40
+ * setup](/reference/%40typed%2Fui%2FGrid%23makeState). Inside the linked program,
41
+ * `const snapshot: State = yield* state` exposes the active grid-cell id.
42
+ * @since 1.0.0
43
+ * @category models
44
+ */
45
+ export interface State {
46
+ /**
47
+ * Id currently active for keyboard navigation; null means no active item.
48
+ * @since 1.0.0
49
+ * @category models
50
+ */
51
+ readonly activeId: string | null;
52
+ }
53
+ /**
54
+ * Initial Grid values. activeId defaults to null.
55
+ *
56
+ * @remarks
57
+ * ## Why
58
+ *
59
+ * Making initialization explicit documents hydration-sensitive defaults and lets servers and
60
+ * clients construct matching state.
61
+ *
62
+ * ## Ownership and lifetime
63
+ *
64
+ * This declaration is data or schema metadata and acquires no resources.
65
+ *
66
+ * ## Example
67
+ *
68
+ * Import with `import type { InitialState } from "@typed/ui/Grid";` Extend the [Grid.makeState
69
+ * runnable setup](/reference/%40typed%2Fui%2FGrid%23makeState). Construct state with
70
+ * `const initial: InitialState = { activeId: "r1c1" }; const state = yield* Grid.makeState(initial)`.
71
+ * @since 1.0.0
72
+ * @category models
73
+ */
74
+ export interface InitialState {
75
+ /**
76
+ * Id currently active for keyboard navigation; null means no active item.
77
+ * @since 1.0.0
78
+ * @category models
79
+ */
80
+ readonly activeId?: string | null;
81
+ }
82
+ /**
83
+ * Effect Schema used by makeState to encode, decode, and hydrate Grid state.
84
+ *
85
+ * @remarks
86
+ * ## Why
87
+ *
88
+ * A public schema makes hydration and serialized state use the same runtime validation as direct
89
+ * construction.
90
+ *
91
+ * ## Ownership and lifetime
92
+ *
93
+ * This declaration is data or schema metadata and acquires no resources.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * import * as Schema from "effect/Schema";
98
+ * import * as Grid from "@typed/ui/Grid";
99
+ *
100
+ * const decodeState = Schema.decodeUnknownEffect(Grid.StateSchema);
101
+ * ```
102
+ * @since 1.0.0
103
+ * @category schemas
104
+ */
105
+ export declare const StateSchema: Schema.Struct<{
106
+ readonly activeId: Schema.NullOr<Schema.String>;
107
+ }>;
108
+ /**
109
+ * Creates hydrated Grid state. activeId defaults to null.
110
+ *
111
+ * @remarks
112
+ * ## Why
113
+ *
114
+ * State and collection ownership can be composed and tested independently from any renderer.
115
+ *
116
+ * ## Ownership and lifetime
117
+ *
118
+ * The returned Effect creates the RefSubject when run. That state is renderer-independent;
119
+ * collection registrations belong to the separate Scope that runs register or ref, not to state
120
+ * creation.
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * import * as Effect from "effect/Effect";
125
+ * import * as Grid from "@typed/ui/Grid";
126
+ *
127
+ * const program = Effect.scoped(
128
+ * Effect.gen(function* () {
129
+ * const state = yield* Grid.makeState({});
130
+ * const collection = yield* Grid.makeCollection();
131
+ * return { state: yield* state, collection: yield* collection };
132
+ * }),
133
+ * );
134
+ * ```
135
+ * @since 1.0.0
136
+ * @category constructors
137
+ */
138
+ export declare function makeState(initial?: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
139
+ readonly activeId: string | null;
140
+ }, Schema.SchemaError, never, never>, never, Scope.Scope>;
141
+ /**
142
+ * Logical coordinates stored with each registered Grid cell.
143
+ *
144
+ * @remarks
145
+ * ## Why
146
+ *
147
+ * The public model lets custom composites reuse Grid's deterministic policy without copying an
148
+ * internal shape.
149
+ *
150
+ * ## Ownership and lifetime
151
+ *
152
+ * This declaration is data or schema metadata and acquires no resources.
153
+ *
154
+ * ## Example
155
+ *
156
+ * Import with `import type { CellPosition } from "@typed/ui/Grid";` Extend the [Grid.makeState
157
+ * runnable setup](/reference/%40typed%2Fui%2FGrid%23makeState). A registered cell identifies its
158
+ * logical row and one-based column:
159
+ * `const position: CellPosition = { rowId: "r1", columnIndex: 1 }`.
160
+ * @since 1.0.0
161
+ * @category models
162
+ */
163
+ export interface CellPosition {
164
+ /**
165
+ * Stable logical row identity used by vertical grid movement.
166
+ * @since 1.0.0
167
+ * @category models
168
+ */
169
+ readonly rowId: string;
170
+ /**
171
+ * Caller-supplied column index used for movement and emitted unchanged as aria-colindex; ARIA
172
+ * indexes are one-based.
173
+ * @since 1.0.0
174
+ * @category models
175
+ */
176
+ readonly columnIndex: number;
177
+ }
178
+ /**
179
+ * Creates a scoped Collection for Grid items.
180
+ *
181
+ * @remarks
182
+ * ## Why
183
+ *
184
+ * State and collection ownership can be composed and tested independently from any renderer.
185
+ *
186
+ * ## Ownership and lifetime
187
+ *
188
+ * The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
189
+ * owned by the Scope that runs register, independently of this construction Effect.
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * import * as Effect from "effect/Effect";
194
+ * import * as Grid from "@typed/ui/Grid";
195
+ *
196
+ * const program = Effect.scoped(
197
+ * Effect.gen(function* () {
198
+ * const collection = yield* Grid.makeCollection();
199
+ * return yield* collection;
200
+ * }),
201
+ * );
202
+ * ```
203
+ * @since 1.0.0
204
+ * @category constructors
205
+ */
206
+ export declare const makeCollection: (initial?: Collection.State<CellPosition, Element>) => Effect.Effect<RefSubject.RefSubject<Collection.State<CellPosition, Element>, never, never>, never, Scope.Scope>;
207
+ /**
208
+ * Sets activeId, including null to clear virtual focus.
209
+ *
210
+ * @remarks
211
+ * ## Why
212
+ *
213
+ * The operation exposes Grid's transition directly so callers can compose it in Effect programs
214
+ * and native event handlers.
215
+ *
216
+ * ## Ownership and lifetime
217
+ *
218
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
219
+ * error and service channels, and retains no resources after completion.
220
+ *
221
+ * ## Example
222
+ *
223
+ * Import with `import { activate } from "@typed/ui/Grid";` Extend the [Grid.makeState runnable
224
+ * setup](/reference/%40typed%2Fui%2FGrid%23makeState). Inside the linked Effect program invoke
225
+ * `yield* activate(state, "item-2")`, then read the state snapshot to observe the transition
226
+ * described above.
227
+ * @since 1.0.0
228
+ * @category combinators
229
+ */
230
+ export declare function activate<E, R>(state: RefSubject.RefSubject<State, E, R>, activeId: string | null): Effect.Effect<State, E, R>;
231
+ /**
232
+ * Inputs accepted by Grid.Root in addition to the shared DOM host options.
233
+ *
234
+ * @remarks
235
+ * ## Why
236
+ *
237
+ * The options type makes required state, content, accessible relationships, and custom-host inputs
238
+ * visible before rendering.
239
+ *
240
+ * ## Ownership and lifetime
241
+ *
242
+ * This declaration is data or schema metadata and acquires no resources.
243
+ *
244
+ * ## Example
245
+ *
246
+ * Import with `import type { RootOptions } from "@typed/ui/Grid";` Extend the [Grid.makeState
247
+ * runnable setup](/reference/%40typed%2Fui%2FGrid%23makeState). Wire keyboard navigation with
248
+ * `const options: RootOptions = { state, collection, label: "Schedule", content: "Rows" }`.
249
+ * @since 1.0.0
250
+ * @category models
251
+ */
252
+ export interface RootOptions extends Dom.HostOptions<HTMLDivElement> {
253
+ /**
254
+ * Renderer-independent RefSubject state consumed by this component or operation.
255
+ * @since 1.0.0
256
+ * @category models
257
+ */
258
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
259
+ /**
260
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
261
+ * @since 1.0.0
262
+ * @category models
263
+ */
264
+ readonly collection?: RefSubject.RefSubject<Collection.State<CellPosition>>;
265
+ /**
266
+ * Accessible label rendered through aria-label.
267
+ * @since 1.0.0
268
+ * @category models
269
+ */
270
+ readonly label: Renderable.Any<string | null | undefined>;
271
+ /**
272
+ * Renderable child content for the component host.
273
+ * @since 1.0.0
274
+ * @category models
275
+ */
276
+ readonly content: Renderable.Any;
277
+ /**
278
+ * Whether aria-multiselectable is announced on the grid.
279
+ * @since 1.0.0
280
+ * @category models
281
+ */
282
+ readonly multiselectable?: Renderable.Any<boolean | null | undefined>;
283
+ }
284
+ declare function rootInternalProps<const Options extends RootOptions>(options: Options): ({ property }: Dom.InternalPropsHelpers<Options>) => {
285
+ readonly role: "grid";
286
+ readonly tabindex: 0;
287
+ readonly "aria-label": Exclude<Dom.Property<Options, "label">, Dom.Nullish> | undefined;
288
+ readonly "aria-activedescendant": RefSubject.Computed<string | undefined, Schema.SchemaError, never>;
289
+ readonly "aria-multiselectable": false | Exclude<Dom.Property<Options, "multiselectable">, Dom.Nullish>;
290
+ readonly onfocus: Effect.Effect<void, Schema.SchemaError, never> | undefined;
291
+ readonly onkeydown: EventHandler.EventHandler<KeyboardEvent, Schema.SchemaError, never> | undefined;
292
+ readonly ref: RefSubject.HydratedRefSubject<State, Schema.SchemaError, never, never>;
293
+ };
294
+ type RootInternalProps<Options extends RootOptions> = ReturnType<ReturnType<typeof rootInternalProps<Options>>>;
295
+ /**
296
+ * Renders the focus-owning grid root and initializes the active cell from DOM order on first
297
+ * focus.
298
+ *
299
+ * @remarks
300
+ * ## Why
301
+ *
302
+ * The component applies the family behavior while leaving callers free to supply a custom host
303
+ * through the shared DOM boundary.
304
+ *
305
+ * ## Ownership and lifetime
306
+ *
307
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
308
+ * collection registrations only when rendered. The rendering Scope removes those resources;
309
+ * unrelated nodes and attributes remain caller-owned.
310
+ *
311
+ * ## Example
312
+ *
313
+ * Import with `import { Root } from "@typed/ui/Grid";` Extend the [Grid.makeState runnable
314
+ * setup](/reference/%40typed%2Fui%2FGrid%23makeState). Replace the linked program's final snapshot
315
+ * read with `Root({ state, label: "Schedule", content: "Rows" })`; render that Fx before the same
316
+ * Scope closes.
317
+ * @since 1.0.0
318
+ * @category components
319
+ */
320
+ export declare function Root<const Options extends RootOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, RootInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
321
+ /**
322
+ * Inputs accepted by Grid.Row in addition to the shared DOM host options.
323
+ *
324
+ * @remarks
325
+ * ## Why
326
+ *
327
+ * The options type makes required state, content, accessible relationships, and custom-host inputs
328
+ * visible before rendering.
329
+ *
330
+ * ## Ownership and lifetime
331
+ *
332
+ * This declaration is data or schema metadata and acquires no resources.
333
+ *
334
+ * ## Example
335
+ *
336
+ * Import with `import type { RowOptions } from "@typed/ui/Grid";` Extend the [Grid.makeState
337
+ * runnable setup](/reference/%40typed%2Fui%2FGrid%23makeState). Expose optional ARIA position with
338
+ * `const options: RowOptions = { rowIndex: 1, content: "Cells" }`.
339
+ * @since 1.0.0
340
+ * @category models
341
+ */
342
+ export interface RowOptions extends Dom.HostOptions<HTMLDivElement> {
343
+ /**
344
+ * Renderable child content for the component host.
345
+ * @since 1.0.0
346
+ * @category models
347
+ */
348
+ readonly content: Renderable.Any;
349
+ /**
350
+ * Optional one-based aria-rowindex value supplied by the caller.
351
+ * @since 1.0.0
352
+ * @category models
353
+ */
354
+ readonly rowIndex?: Renderable.Any<number | null | undefined>;
355
+ }
356
+ declare function rowInternalProps<const Options extends RowOptions>({ property, }: Dom.InternalPropsHelpers<Options>): {
357
+ readonly role: "row";
358
+ readonly "aria-rowindex": Exclude<Dom.Property<Options, "rowIndex">, Dom.Nullish> | undefined;
359
+ };
360
+ type RowInternalProps<Options extends RowOptions> = ReturnType<typeof rowInternalProps<Options>>;
361
+ /**
362
+ * Renders an ARIA row and forwards an optional one-based aria-rowindex.
363
+ *
364
+ * @remarks
365
+ * ## Why
366
+ *
367
+ * The component applies the family behavior while leaving callers free to supply a custom host
368
+ * through the shared DOM boundary.
369
+ *
370
+ * ## Ownership and lifetime
371
+ *
372
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
373
+ * collection registrations only when rendered. The rendering Scope removes those resources;
374
+ * unrelated nodes and attributes remain caller-owned.
375
+ *
376
+ * @example
377
+ * ```ts
378
+ * import * as Grid from "@typed/ui/Grid";
379
+ *
380
+ * const view = Grid.Row({ rowIndex: 1, content: "Cells" });
381
+ * ```
382
+ * @since 1.0.0
383
+ * @category components
384
+ */
385
+ export declare function Row<const Options extends RowOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, RowInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
386
+ /**
387
+ * Inputs accepted by Grid.Cell in addition to the shared DOM host options.
388
+ *
389
+ * @remarks
390
+ * ## Why
391
+ *
392
+ * The options type makes required state, content, accessible relationships, and custom-host inputs
393
+ * visible before rendering.
394
+ *
395
+ * ## Ownership and lifetime
396
+ *
397
+ * This declaration is data or schema metadata and acquires no resources.
398
+ *
399
+ * ## Example
400
+ *
401
+ * Import with `import type { CellOptions } from "@typed/ui/Grid";` Extend the [Grid.makeState
402
+ * runnable setup](/reference/%40typed%2Fui%2FGrid%23makeState). A navigable cell is
403
+ * `const options: CellOptions = { state, collection, id: "r1c1", rowId: "r1", columnIndex: 1, content: "Monday" }`.
404
+ * @since 1.0.0
405
+ * @category models
406
+ */
407
+ export interface CellOptions extends Dom.HostOptions<HTMLDivElement> {
408
+ /**
409
+ * Renderer-independent RefSubject state consumed by this component or operation.
410
+ * @since 1.0.0
411
+ * @category models
412
+ */
413
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
414
+ /**
415
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
416
+ * @since 1.0.0
417
+ * @category models
418
+ */
419
+ readonly collection?: RefSubject.RefSubject<Collection.State<CellPosition>>;
420
+ /**
421
+ * Stable id used for collection identity and ARIA relationships.
422
+ * @since 1.0.0
423
+ * @category models
424
+ */
425
+ readonly id: string;
426
+ /**
427
+ * Stable logical row identity used by vertical grid movement.
428
+ * @since 1.0.0
429
+ * @category models
430
+ */
431
+ readonly rowId: string;
432
+ /**
433
+ * Caller-supplied column index used for movement and emitted unchanged as aria-colindex; ARIA
434
+ * indexes are one-based.
435
+ * @since 1.0.0
436
+ * @category models
437
+ */
438
+ readonly columnIndex: number;
439
+ /**
440
+ * Optional one-based aria-rowindex value supplied by the caller.
441
+ * @since 1.0.0
442
+ * @category models
443
+ */
444
+ readonly rowIndex?: number;
445
+ /**
446
+ * Optional selected state exposed through aria-selected.
447
+ * @since 1.0.0
448
+ * @category models
449
+ */
450
+ readonly selected?: Renderable.Any<boolean | null | undefined>;
451
+ /**
452
+ * Renderable child content for the component host.
453
+ * @since 1.0.0
454
+ * @category models
455
+ */
456
+ readonly content: Renderable.Any;
457
+ }
458
+ declare function cellInternalProps<const Options extends CellOptions>(options: Options, role: "gridcell" | "columnheader" | "rowheader"): ({ property }: Dom.InternalPropsHelpers<Options>) => {
459
+ readonly id: string;
460
+ readonly role: "columnheader" | "gridcell" | "rowheader";
461
+ readonly "aria-colindex": number;
462
+ readonly "aria-rowindex": Exclude<Dom.Property<Options, "rowIndex">, Dom.Nullish> | undefined;
463
+ readonly "aria-selected": Exclude<Dom.Property<Options, "selected">, Dom.Nullish> | undefined;
464
+ readonly "?data-active": RefSubject.Computed<boolean, Schema.SchemaError, never>;
465
+ readonly ref: ((element: Element) => Effect.Effect<void, never, Scope.Scope>) | undefined;
466
+ };
467
+ type CellInternalProps<Options extends CellOptions> = ReturnType<ReturnType<typeof cellInternalProps<Options>>>;
468
+ /**
469
+ * Renders and optionally registers a gridcell with row and column coordinates.
470
+ *
471
+ * @remarks
472
+ * ## Why
473
+ *
474
+ * The component applies the family behavior while leaving callers free to supply a custom host
475
+ * through the shared DOM boundary.
476
+ *
477
+ * ## Ownership and lifetime
478
+ *
479
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
480
+ * collection registrations only when rendered. The rendering Scope removes those resources;
481
+ * unrelated nodes and attributes remain caller-owned.
482
+ *
483
+ * ## Example
484
+ *
485
+ * Import with `import { Cell } from "@typed/ui/Grid";` Extend the [Grid.makeState runnable
486
+ * setup](/reference/%40typed%2Fui%2FGrid%23makeState). Replace the linked program's final snapshot
487
+ * read with `Cell({ state, id: "r1c1", rowId: "r1", columnIndex: 1, content: "Monday" })`; render
488
+ * that Fx before the same Scope closes.
489
+ * @since 1.0.0
490
+ * @category components
491
+ */
492
+ export declare function Cell<const Options extends CellOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, CellInternalProps<Options>>, Options["content"], Host>): import("./Dom/Types.js").HostComponent<Host | Options>;
493
+ /**
494
+ * Renders the Cell contract with the columnheader role.
495
+ *
496
+ * @remarks
497
+ * ## Why
498
+ *
499
+ * The component applies the family behavior while leaving callers free to supply a custom host
500
+ * through the shared DOM boundary.
501
+ *
502
+ * ## Ownership and lifetime
503
+ *
504
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
505
+ * collection registrations only when rendered. The rendering Scope removes those resources;
506
+ * unrelated nodes and attributes remain caller-owned.
507
+ *
508
+ * ## Example
509
+ *
510
+ * Import with `import { ColumnHeader } from "@typed/ui/Grid";` Extend the [Grid.makeState runnable
511
+ * setup](/reference/%40typed%2Fui%2FGrid%23makeState). Replace the linked program's final snapshot
512
+ * read with `ColumnHeader({ state, id: "day", rowId: "headers", columnIndex: 1, content: "Day" })`;
513
+ * render that Fx before the same Scope closes.
514
+ * @since 1.0.0
515
+ * @category components
516
+ */
517
+ export declare function ColumnHeader<const Options extends CellOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, CellInternalProps<Options>>, Options["content"], Host>): import("./Dom/Types.js").HostComponent<Host | Options>;
518
+ /**
519
+ * Renders the Cell contract with the rowheader role.
520
+ *
521
+ * @remarks
522
+ * ## Why
523
+ *
524
+ * The component applies the family behavior while leaving callers free to supply a custom host
525
+ * through the shared DOM boundary.
526
+ *
527
+ * ## Ownership and lifetime
528
+ *
529
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
530
+ * collection registrations only when rendered. The rendering Scope removes those resources;
531
+ * unrelated nodes and attributes remain caller-owned.
532
+ *
533
+ * ## Example
534
+ *
535
+ * Import with `import { RowHeader } from "@typed/ui/Grid";` Extend the [Grid.makeState runnable
536
+ * setup](/reference/%40typed%2Fui%2FGrid%23makeState). Replace the linked program's final snapshot
537
+ * read with `RowHeader({ state, id: "week-1", rowId: "week-1", columnIndex: 1, content: "Week 1"
538
+ * })`; render that Fx before the same Scope closes.
539
+ * @since 1.0.0
540
+ * @category components
541
+ */
542
+ export declare function RowHeader<const Options extends CellOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, CellInternalProps<Options>>, Options["content"], Host>): import("./Dom/Types.js").HostComponent<Host | Options>;
543
+ /**
544
+ * Maps grid keys to a cell id: horizontal movement stays in-row, vertical movement stays
545
+ * in-column, and Ctrl+Home/End reaches grid endpoints.
546
+ *
547
+ * @remarks
548
+ * ## Why
549
+ *
550
+ * Separating this deterministic policy from event wiring lets applications test it directly and
551
+ * reuse it in custom composites.
552
+ *
553
+ * ## Ownership and lifetime
554
+ *
555
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
556
+ * state, event, or DOM.
557
+ *
558
+ * @example
559
+ * ```ts
560
+ * import * as Grid from "@typed/ui/Grid";
561
+ *
562
+ * const nextId = Grid.moveActiveId([{ id: "a", value: { rowId: "r1", columnIndex: 1 } }], "a", { key: "ArrowRight", ctrlKey: false });
563
+ * ```
564
+ * @since 1.0.0
565
+ * @category combinators
566
+ */
567
+ export declare function moveActiveId(items: readonly Collection.Item<CellPosition>[], activeId: string | null, event: Pick<KeyboardEvent, "key" | "ctrlKey">): string | undefined;
568
+ export {};
569
+ //# sourceMappingURL=Grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../src/Grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OA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