@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
package/dist/Tree.d.ts ADDED
@@ -0,0 +1,591 @@
1
+ /**
2
+ * Tree stores active item and expanded ids independently. Its key policy follows hierarchical tree
3
+ * navigation, while Item and Group expose explicit levels, expansion, and visibility without
4
+ * reconstructing nodes.
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 Tree.
26
+ *
27
+ * @remarks
28
+ * ## Why
29
+ *
30
+ * Applications can inspect, update, and test Tree 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/Tree";` Extend the [Tree.makeState runnable
40
+ * setup](/reference/%40typed%2Fui%2FTree%23makeState). Inside the linked program,
41
+ * `const snapshot: State = yield* state` exposes active and expanded ids independently.
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
+ * Ids whose child tree groups are currently visible.
54
+ * @since 1.0.0
55
+ * @category models
56
+ */
57
+ readonly expandedIds: readonly string[];
58
+ /**
59
+ * Whether movement wraps between the first and last enabled items.
60
+ * @since 1.0.0
61
+ * @category models
62
+ */
63
+ readonly loop: boolean;
64
+ }
65
+ /**
66
+ * Initial Tree values. activeId defaults null and expandedIds defaults empty.
67
+ *
68
+ * @remarks
69
+ * ## Why
70
+ *
71
+ * Making initialization explicit documents hydration-sensitive defaults and lets servers and
72
+ * clients construct matching state.
73
+ *
74
+ * ## Ownership and lifetime
75
+ *
76
+ * This declaration is data or schema metadata and acquires no resources.
77
+ *
78
+ * ## Example
79
+ *
80
+ * Import with `import type { InitialState } from "@typed/ui/Tree";` Extend the [Tree.makeState
81
+ * runnable setup](/reference/%40typed%2Fui%2FTree%23makeState). Construct an expanded branch with
82
+ * `const initial: InitialState = { activeId: "src", expandedIds: ["src"] }; const state = yield* Tree.makeState(initial)`.
83
+ * @since 1.0.0
84
+ * @category models
85
+ */
86
+ export interface InitialState {
87
+ /**
88
+ * Id currently active for keyboard navigation; null means no active item.
89
+ * @since 1.0.0
90
+ * @category models
91
+ */
92
+ readonly activeId?: string | null;
93
+ /**
94
+ * Ids whose child tree groups are currently visible.
95
+ * @since 1.0.0
96
+ * @category models
97
+ */
98
+ readonly expandedIds?: readonly string[];
99
+ /**
100
+ * Whether movement wraps between the first and last enabled items.
101
+ * @since 1.0.0
102
+ * @category models
103
+ */
104
+ readonly loop?: boolean;
105
+ }
106
+ /**
107
+ * Effect Schema used by makeState to encode, decode, and hydrate Tree state.
108
+ *
109
+ * @remarks
110
+ * ## Why
111
+ *
112
+ * A public schema makes hydration and serialized state use the same runtime validation as direct
113
+ * construction.
114
+ *
115
+ * ## Ownership and lifetime
116
+ *
117
+ * This declaration is data or schema metadata and acquires no resources.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * import * as Schema from "effect/Schema";
122
+ * import * as Tree from "@typed/ui/Tree";
123
+ *
124
+ * const decodeState = Schema.decodeUnknownEffect(Tree.StateSchema);
125
+ * ```
126
+ * @since 1.0.0
127
+ * @category schemas
128
+ */
129
+ export declare const StateSchema: Schema.Struct<{
130
+ readonly activeId: Schema.NullOr<Schema.String>;
131
+ readonly expandedIds: Schema.$Array<Schema.String>;
132
+ readonly loop: Schema.Boolean;
133
+ }>;
134
+ /**
135
+ * Creates hydrated Tree state. activeId defaults null and expandedIds defaults empty.
136
+ *
137
+ * @remarks
138
+ * ## Why
139
+ *
140
+ * State and collection ownership can be composed and tested independently from any renderer.
141
+ *
142
+ * ## Ownership and lifetime
143
+ *
144
+ * The returned Effect creates the RefSubject when run. That state is renderer-independent;
145
+ * collection registrations belong to the separate Scope that runs register or ref, not to state
146
+ * creation.
147
+ *
148
+ * @example
149
+ * ```ts
150
+ * import * as Effect from "effect/Effect";
151
+ * import * as Tree from "@typed/ui/Tree";
152
+ *
153
+ * const program = Effect.scoped(
154
+ * Effect.gen(function* () {
155
+ * const state = yield* Tree.makeState({});
156
+ * const collection = yield* Tree.makeCollection();
157
+ * return { state: yield* state, collection: yield* collection };
158
+ * }),
159
+ * );
160
+ * ```
161
+ * @since 1.0.0
162
+ * @category constructors
163
+ */
164
+ export declare function makeState(initial?: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
165
+ readonly activeId: string | null;
166
+ readonly expandedIds: readonly string[];
167
+ readonly loop: boolean;
168
+ }, Schema.SchemaError, never, never>, never, Scope.Scope>;
169
+ /**
170
+ * Tree collection value recording an item's parent relationship.
171
+ *
172
+ * @remarks
173
+ * ## Why
174
+ *
175
+ * The public model lets custom composites reuse Tree's deterministic policy without copying an
176
+ * internal shape.
177
+ *
178
+ * ## Ownership and lifetime
179
+ *
180
+ * This declaration is data or schema metadata and acquires no resources.
181
+ *
182
+ * ## Example
183
+ *
184
+ * Import with `import type { ItemValue } from "@typed/ui/Tree";` Extend the [Tree.makeState
185
+ * runnable setup](/reference/%40typed%2Fui%2FTree%23makeState). A hierarchical collection value
186
+ * identifies child capability: `const value: ItemValue = { parentId: "root", hasChildren: true }`.
187
+ * @since 1.0.0
188
+ * @category models
189
+ */
190
+ export interface ItemValue {
191
+ /**
192
+ * Id whose expansion controls this descendant group.
193
+ * @since 1.0.0
194
+ * @category models
195
+ */
196
+ readonly parentId?: string;
197
+ /**
198
+ * Whether aria-expanded is emitted and hierarchical keys may open descendants.
199
+ * @since 1.0.0
200
+ * @category models
201
+ */
202
+ readonly hasChildren: boolean;
203
+ }
204
+ /**
205
+ * Creates a scoped Collection for Tree items.
206
+ *
207
+ * @remarks
208
+ * ## Why
209
+ *
210
+ * State and collection ownership can be composed and tested independently from any renderer.
211
+ *
212
+ * ## Ownership and lifetime
213
+ *
214
+ * The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
215
+ * owned by the Scope that runs register, independently of this construction Effect.
216
+ *
217
+ * @example
218
+ * ```ts
219
+ * import * as Effect from "effect/Effect";
220
+ * import * as Tree from "@typed/ui/Tree";
221
+ *
222
+ * const program = Effect.scoped(
223
+ * Effect.gen(function* () {
224
+ * const collection = yield* Tree.makeCollection();
225
+ * return yield* collection;
226
+ * }),
227
+ * );
228
+ * ```
229
+ * @since 1.0.0
230
+ * @category constructors
231
+ */
232
+ export declare const makeCollection: (initial?: Collection.State<ItemValue, Element>) => Effect.Effect<RefSubject.RefSubject<Collection.State<ItemValue, Element>, never, never>, never, Scope.Scope>;
233
+ /**
234
+ * Tests membership in expandedIds without touching the DOM.
235
+ *
236
+ * @remarks
237
+ * ## Why
238
+ *
239
+ * Separating this deterministic policy from event wiring lets applications test it directly and
240
+ * reuse it in custom composites.
241
+ *
242
+ * ## Ownership and lifetime
243
+ *
244
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
245
+ * state, event, or DOM.
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * import * as Tree from "@typed/ui/Tree";
250
+ *
251
+ * const expanded = Tree.isExpanded({ activeId: null, expandedIds: ["parent"], loop: true }, "parent");
252
+ * ```
253
+ * @since 1.0.0
254
+ * @category combinators
255
+ */
256
+ export declare function isExpanded(state: State, id: string): boolean;
257
+ /**
258
+ * Adds an id once to expandedIds.
259
+ *
260
+ * @remarks
261
+ * ## Why
262
+ *
263
+ * The operation exposes Tree's transition directly so callers can compose it in Effect programs
264
+ * and native event handlers.
265
+ *
266
+ * ## Ownership and lifetime
267
+ *
268
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
269
+ * error and service channels, and retains no resources after completion.
270
+ *
271
+ * ## Example
272
+ *
273
+ * Import with `import { expand } from "@typed/ui/Tree";` Extend the [Tree.makeState runnable
274
+ * setup](/reference/%40typed%2Fui%2FTree%23makeState). Inside the linked Effect program invoke
275
+ * `yield* expand(state, "item-2")`, then read the state snapshot to observe the transition
276
+ * described above.
277
+ * @since 1.0.0
278
+ * @category combinators
279
+ */
280
+ export declare function expand<E, R>(state: RefSubject.RefSubject<State, E, R>, id: string): Effect.Effect<State, E, R>;
281
+ /**
282
+ * Removes an id from expandedIds.
283
+ *
284
+ * @remarks
285
+ * ## Why
286
+ *
287
+ * The operation exposes Tree's transition directly so callers can compose it in Effect programs
288
+ * and native event handlers.
289
+ *
290
+ * ## Ownership and lifetime
291
+ *
292
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
293
+ * error and service channels, and retains no resources after completion.
294
+ *
295
+ * ## Example
296
+ *
297
+ * Import with `import { collapse } from "@typed/ui/Tree";` Extend the [Tree.makeState runnable
298
+ * setup](/reference/%40typed%2Fui%2FTree%23makeState). Inside the linked Effect program invoke
299
+ * `yield* collapse(state, "item-2")`, then read the state snapshot to observe the transition
300
+ * described above.
301
+ * @since 1.0.0
302
+ * @category combinators
303
+ */
304
+ export declare function collapse<E, R>(state: RefSubject.RefSubject<State, E, R>, id: string): Effect.Effect<State, E, R>;
305
+ /**
306
+ * Sets the active tree item id without changing expansion.
307
+ *
308
+ * @remarks
309
+ * ## Why
310
+ *
311
+ * The operation exposes Tree's transition directly so callers can compose it in Effect programs
312
+ * and native event handlers.
313
+ *
314
+ * ## Ownership and lifetime
315
+ *
316
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
317
+ * error and service channels, and retains no resources after completion.
318
+ *
319
+ * ## Example
320
+ *
321
+ * Import with `import { activate } from "@typed/ui/Tree";` Extend the [Tree.makeState runnable
322
+ * setup](/reference/%40typed%2Fui%2FTree%23makeState). Inside the linked Effect program invoke
323
+ * `yield* activate(state, "item-2")`, then read the state snapshot to observe the transition
324
+ * described above.
325
+ * @since 1.0.0
326
+ * @category combinators
327
+ */
328
+ export declare function activate<E, R>(state: RefSubject.RefSubject<State, E, R>, activeId: string | null): Effect.Effect<State, E, R>;
329
+ /**
330
+ * Inputs accepted by Tree.Root in addition to the shared DOM host options.
331
+ *
332
+ * @remarks
333
+ * ## Why
334
+ *
335
+ * The options type makes required state, content, accessible relationships, and custom-host inputs
336
+ * visible before rendering.
337
+ *
338
+ * ## Ownership and lifetime
339
+ *
340
+ * This declaration is data or schema metadata and acquires no resources.
341
+ *
342
+ * ## Example
343
+ *
344
+ * Import with `import type { RootOptions } from "@typed/ui/Tree";` Extend the [Tree.makeState
345
+ * runnable setup](/reference/%40typed%2Fui%2FTree%23makeState). Enable tree navigation with
346
+ * `const options: RootOptions = { state, collection, label: "Files", content: "Items" }`.
347
+ * @since 1.0.0
348
+ * @category models
349
+ */
350
+ export interface RootOptions extends Dom.HostOptions<HTMLDivElement> {
351
+ /**
352
+ * Renderer-independent RefSubject state consumed by this component or operation.
353
+ * @since 1.0.0
354
+ * @category models
355
+ */
356
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
357
+ /**
358
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
359
+ * @since 1.0.0
360
+ * @category models
361
+ */
362
+ readonly collection?: RefSubject.RefSubject<Collection.State<ItemValue>>;
363
+ /**
364
+ * Accessible label rendered through aria-label.
365
+ * @since 1.0.0
366
+ * @category models
367
+ */
368
+ readonly label: Renderable.Any<string | null | undefined>;
369
+ /**
370
+ * Renderable child content for the component host.
371
+ * @since 1.0.0
372
+ * @category models
373
+ */
374
+ readonly content: Renderable.Any;
375
+ }
376
+ declare function rootInternalProps<const Options extends RootOptions>(options: Options): ({ property }: Dom.InternalPropsHelpers<Options>) => {
377
+ readonly role: "tree";
378
+ readonly "aria-label": Exclude<Dom.Property<Options, "label">, Dom.Nullish> | undefined;
379
+ readonly tabindex: RefSubject.Computed<-1 | 0, Schema.SchemaError, never>;
380
+ readonly onfocus: Effect.Effect<void, Schema.SchemaError, never> | undefined;
381
+ readonly onkeydown: EventHandler.EventHandler<KeyboardEvent, Schema.SchemaError, never> | undefined;
382
+ readonly ref: RefSubject.HydratedRefSubject<State, Schema.SchemaError, never, never>;
383
+ };
384
+ type RootInternalProps<Options extends RootOptions> = ReturnType<ReturnType<typeof rootInternalProps<Options>>>;
385
+ /**
386
+ * Renders the tree root and applies hierarchy-aware keyboard navigation to registered items.
387
+ *
388
+ * @remarks
389
+ * ## Why
390
+ *
391
+ * The component applies the family behavior while leaving callers free to supply a custom host
392
+ * through the shared DOM boundary.
393
+ *
394
+ * ## Ownership and lifetime
395
+ *
396
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
397
+ * collection registrations only when rendered. The rendering Scope removes those resources;
398
+ * unrelated nodes and attributes remain caller-owned.
399
+ *
400
+ * ## Example
401
+ *
402
+ * Import with `import { Root } from "@typed/ui/Tree";` Extend the [Tree.makeState runnable
403
+ * setup](/reference/%40typed%2Fui%2FTree%23makeState). Replace the linked program's final snapshot
404
+ * read with `Root({ state, label: "Files", content: "Items" })`; render that Fx before the same
405
+ * Scope closes.
406
+ * @since 1.0.0
407
+ * @category components
408
+ */
409
+ 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>;
410
+ /**
411
+ * Inputs accepted by Tree.Item in addition to the shared DOM host options.
412
+ *
413
+ * @remarks
414
+ * ## Why
415
+ *
416
+ * The options type makes required state, content, accessible relationships, and custom-host inputs
417
+ * visible before rendering.
418
+ *
419
+ * ## Ownership and lifetime
420
+ *
421
+ * This declaration is data or schema metadata and acquires no resources.
422
+ *
423
+ * ## Example
424
+ *
425
+ * Import with `import type { ItemOptions } from "@typed/ui/Tree";` Extend the [Tree.makeState
426
+ * runnable setup](/reference/%40typed%2Fui%2FTree%23makeState). A branch item is
427
+ * `const options: ItemOptions = { state, collection, id: "src", level: 1, hasChildren: true, content: "src" }`.
428
+ * @since 1.0.0
429
+ * @category models
430
+ */
431
+ export interface ItemOptions extends Dom.HostOptions<HTMLDivElement> {
432
+ /**
433
+ * Renderer-independent RefSubject state consumed by this component or operation.
434
+ * @since 1.0.0
435
+ * @category models
436
+ */
437
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
438
+ /**
439
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
440
+ * @since 1.0.0
441
+ * @category models
442
+ */
443
+ readonly collection?: RefSubject.RefSubject<Collection.State<ItemValue>>;
444
+ /**
445
+ * Stable id used for collection identity and ARIA relationships.
446
+ * @since 1.0.0
447
+ * @category models
448
+ */
449
+ readonly id: string;
450
+ /**
451
+ * Id whose expansion controls this descendant group.
452
+ * @since 1.0.0
453
+ * @category models
454
+ */
455
+ readonly parentId?: string;
456
+ /**
457
+ * One-based hierarchy level exposed through aria-level.
458
+ * @since 1.0.0
459
+ * @category models
460
+ */
461
+ readonly level?: number;
462
+ /**
463
+ * Whether aria-expanded is emitted and hierarchical keys may open descendants.
464
+ * @since 1.0.0
465
+ * @category models
466
+ */
467
+ readonly hasChildren?: boolean;
468
+ /**
469
+ * Flag used by collection movement and widget handlers to skip activation by default.
470
+ * @since 1.0.0
471
+ * @category models
472
+ */
473
+ readonly disabled?: boolean;
474
+ /**
475
+ * Renderable child content for the component host.
476
+ * @since 1.0.0
477
+ * @category models
478
+ */
479
+ readonly content: Renderable.Any;
480
+ }
481
+ declare function itemInternalProps<const Options extends ItemOptions>(options: Options): ({ property }: Dom.InternalPropsHelpers<Options>) => {
482
+ readonly id: string;
483
+ readonly role: "treeitem";
484
+ readonly "aria-level": 1 | Exclude<Dom.Property<Options, "level">, Dom.Nullish>;
485
+ readonly "aria-expanded": RefSubject.Computed<boolean, Schema.SchemaError, never> | undefined;
486
+ readonly "aria-disabled": boolean;
487
+ readonly tabindex: RefSubject.Computed<-1 | 0, Schema.SchemaError, never>;
488
+ readonly onfocus: Effect.Effect<State, Schema.SchemaError, never>;
489
+ readonly onclick: Effect.Effect<void, never, never> | Effect.Effect<State, Schema.SchemaError, never>;
490
+ readonly ref: ((element: Element & HTMLDivElement & RefSubject.HydrationElement) => Effect.Effect<void, any, any>) | undefined;
491
+ };
492
+ type ItemInternalProps<Options extends ItemOptions> = ReturnType<ReturnType<typeof itemInternalProps<Options>>>;
493
+ /**
494
+ * Renders and optionally registers a treeitem with level, expanded, disabled, and roving-focus
495
+ * state.
496
+ *
497
+ * @remarks
498
+ * ## Why
499
+ *
500
+ * The component applies the family behavior while leaving callers free to supply a custom host
501
+ * through the shared DOM boundary.
502
+ *
503
+ * ## Ownership and lifetime
504
+ *
505
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
506
+ * collection registrations only when rendered. The rendering Scope removes those resources;
507
+ * unrelated nodes and attributes remain caller-owned.
508
+ *
509
+ * ## Example
510
+ *
511
+ * Import with `import { Item } from "@typed/ui/Tree";` Extend the [Tree.makeState runnable
512
+ * setup](/reference/%40typed%2Fui%2FTree%23makeState). Replace the linked program's final snapshot
513
+ * read with `Item({ state, id: "src", hasChildren: true, content: "src" })`; render that Fx before
514
+ * the same Scope closes.
515
+ * @since 1.0.0
516
+ * @category components
517
+ */
518
+ export declare function Item<const Options extends ItemOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, ItemInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
519
+ /**
520
+ * Inputs accepted by Tree.Group in addition to the shared DOM host options.
521
+ *
522
+ * @remarks
523
+ * ## Why
524
+ *
525
+ * The options type makes required state, content, accessible relationships, and custom-host inputs
526
+ * visible before rendering.
527
+ *
528
+ * ## Ownership and lifetime
529
+ *
530
+ * This declaration is data or schema metadata and acquires no resources.
531
+ *
532
+ * ## Example
533
+ *
534
+ * Import with `import type { GroupOptions } from "@typed/ui/Tree";` Extend the [Tree.makeState
535
+ * runnable setup](/reference/%40typed%2Fui%2FTree%23makeState). Relate descendants to their branch
536
+ * with `const options: GroupOptions = { state, parentId: "src", content: "Children" }`.
537
+ * @since 1.0.0
538
+ * @category models
539
+ */
540
+ export interface GroupOptions extends Dom.HostOptions<HTMLDivElement> {
541
+ /**
542
+ * Renderer-independent RefSubject state consumed by this component or operation.
543
+ * @since 1.0.0
544
+ * @category models
545
+ */
546
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
547
+ /**
548
+ * Id whose expansion controls this descendant group.
549
+ * @since 1.0.0
550
+ * @category models
551
+ */
552
+ readonly parentId: string;
553
+ /**
554
+ * Renderable child content for the component host.
555
+ * @since 1.0.0
556
+ * @category models
557
+ */
558
+ readonly content: Renderable.Any;
559
+ }
560
+ declare function groupInternalProps<const Options extends GroupOptions>(options: Options): () => {
561
+ readonly role: "group";
562
+ readonly "?hidden": RefSubject.Computed<boolean, Schema.SchemaError, never>;
563
+ };
564
+ type GroupInternalProps<Options extends GroupOptions> = ReturnType<ReturnType<typeof groupInternalProps<Options>>>;
565
+ /**
566
+ * Renders a child group and hides it while its parent id is not expanded.
567
+ *
568
+ * @remarks
569
+ * ## Why
570
+ *
571
+ * The component applies the family behavior while leaving callers free to supply a custom host
572
+ * through the shared DOM boundary.
573
+ *
574
+ * ## Ownership and lifetime
575
+ *
576
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
577
+ * collection registrations only when rendered. The rendering Scope removes those resources;
578
+ * unrelated nodes and attributes remain caller-owned.
579
+ *
580
+ * ## Example
581
+ *
582
+ * Import with `import { Group } from "@typed/ui/Tree";` Extend the [Tree.makeState runnable
583
+ * setup](/reference/%40typed%2Fui%2FTree%23makeState). Replace the linked program's final snapshot
584
+ * read with `Group({ state, parentId: "src", content: "Children" })`; render that Fx before the
585
+ * same Scope closes.
586
+ * @since 1.0.0
587
+ * @category components
588
+ */
589
+ export declare function Group<const Options extends GroupOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, GroupInternalProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
590
+ export {};
591
+ //# sourceMappingURL=Tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../src/Tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,MAAM,M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