@typed/ui 1.0.0-beta.1 → 1.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +54 -10
- package/dist/Alert.d.ts +72 -0
- package/dist/Alert.d.ts.map +1 -0
- package/dist/Alert.js +40 -0
- package/dist/Button.d.ts +100 -0
- package/dist/Button.d.ts.map +1 -0
- package/dist/Button.js +42 -0
- package/dist/Carousel.d.ts +346 -0
- package/dist/Carousel.d.ts.map +1 -0
- package/dist/Carousel.js +264 -0
- package/dist/Checkbox.d.ts +168 -0
- package/dist/Checkbox.d.ts.map +1 -0
- package/dist/Checkbox.js +146 -0
- package/dist/Collection.d.ts +254 -0
- package/dist/Collection.d.ts.map +1 -0
- package/dist/Collection.js +218 -0
- package/dist/Combobox.d.ts +367 -0
- package/dist/Combobox.d.ts.map +1 -0
- package/dist/Combobox.js +300 -0
- package/dist/Composite.d.ts +823 -0
- package/dist/Composite.d.ts.map +1 -0
- package/dist/Composite.js +615 -0
- package/dist/Dialog.d.ts +544 -0
- package/dist/Dialog.d.ts.map +1 -0
- package/dist/Dialog.js +357 -0
- package/dist/Disclosure.d.ts +219 -0
- package/dist/Disclosure.d.ts.map +1 -0
- package/dist/Disclosure.js +128 -0
- package/dist/Dom/Events.d.ts +122 -0
- package/dist/Dom/Events.d.ts.map +1 -0
- package/dist/Dom/Events.js +192 -0
- package/dist/Dom/Props.d.ts +161 -0
- package/dist/Dom/Props.d.ts.map +1 -0
- package/dist/Dom/Props.js +110 -0
- package/dist/Dom/Refs.d.ts +58 -0
- package/dist/Dom/Refs.d.ts.map +1 -0
- package/dist/Dom/Refs.js +61 -0
- package/dist/Dom/Render.d.ts +59 -0
- package/dist/Dom/Render.d.ts.map +1 -0
- package/dist/Dom/Render.js +71 -0
- package/dist/Dom/Types.d.ts +570 -0
- package/dist/Dom/Types.d.ts.map +1 -0
- package/dist/Dom/Types.js +1 -0
- package/dist/Dom/index.d.ts +20 -0
- package/dist/Dom/index.d.ts.map +1 -0
- package/dist/Dom/index.js +8 -0
- package/dist/Dom.d.ts +14 -0
- package/dist/Dom.d.ts.map +1 -0
- package/dist/Dom.js +13 -0
- package/dist/Focusable.d.ts +85 -0
- package/dist/Focusable.d.ts.map +1 -0
- package/dist/Focusable.js +35 -0
- package/dist/Form.d.ts +1727 -0
- package/dist/Form.d.ts.map +1 -0
- package/dist/Form.js +1142 -0
- package/dist/Grid.d.ts +388 -0
- package/dist/Grid.d.ts.map +1 -0
- package/dist/Grid.js +284 -0
- package/dist/Group.d.ts +128 -0
- package/dist/Group.d.ts.map +1 -0
- package/dist/Group.js +71 -0
- package/dist/Heading.d.ts +87 -0
- package/dist/Heading.d.ts.map +1 -0
- package/dist/Heading.js +58 -0
- package/dist/Hovercard.d.ts +297 -0
- package/dist/Hovercard.d.ts.map +1 -0
- package/dist/Hovercard.js +188 -0
- package/dist/HttpRouter.d.ts +129 -6
- package/dist/HttpRouter.d.ts.map +1 -1
- package/dist/HttpRouter.js +198 -55
- package/dist/Link.d.ts +63 -28
- package/dist/Link.d.ts.map +1 -1
- package/dist/Link.js +84 -37
- package/dist/Listbox.d.ts +305 -0
- package/dist/Listbox.d.ts.map +1 -0
- package/dist/Listbox.js +245 -0
- package/dist/Menu.d.ts +663 -0
- package/dist/Menu.d.ts.map +1 -0
- package/dist/Menu.js +569 -0
- package/dist/Menubar.d.ts +249 -0
- package/dist/Menubar.d.ts.map +1 -0
- package/dist/Menubar.js +207 -0
- package/dist/Meter.d.ts +157 -0
- package/dist/Meter.d.ts.map +1 -0
- package/dist/Meter.js +87 -0
- package/dist/NativeDetails.d.ts +41 -0
- package/dist/NativeDetails.d.ts.map +1 -0
- package/dist/NativeDetails.js +40 -0
- package/dist/NativeDialog.d.ts +66 -0
- package/dist/NativeDialog.d.ts.map +1 -0
- package/dist/NativeDialog.js +88 -0
- package/dist/NativePopover.d.ts +43 -0
- package/dist/NativePopover.d.ts.map +1 -0
- package/dist/NativePopover.js +84 -0
- package/dist/Popover.d.ts +240 -0
- package/dist/Popover.d.ts.map +1 -0
- package/dist/Popover.js +140 -0
- package/dist/RadioGroup.d.ts +330 -0
- package/dist/RadioGroup.d.ts.map +1 -0
- package/dist/RadioGroup.js +241 -0
- package/dist/Role.d.ts +64 -0
- package/dist/Role.d.ts.map +1 -0
- package/dist/Role.js +27 -0
- package/dist/Select.d.ts +418 -0
- package/dist/Select.d.ts.map +1 -0
- package/dist/Select.js +357 -0
- package/dist/Separator.d.ts +58 -0
- package/dist/Separator.d.ts.map +1 -0
- package/dist/Separator.js +32 -0
- package/dist/Slider.d.ts +141 -0
- package/dist/Slider.d.ts.map +1 -0
- package/dist/Slider.js +101 -0
- package/dist/SpinButton.d.ts +141 -0
- package/dist/SpinButton.d.ts.map +1 -0
- package/dist/SpinButton.js +101 -0
- package/dist/Storybook.d.ts +76 -0
- package/dist/Storybook.d.ts.map +1 -0
- package/dist/Storybook.js +102 -0
- package/dist/Switch.d.ts +148 -0
- package/dist/Switch.d.ts.map +1 -0
- package/dist/Switch.js +110 -0
- package/dist/Tab.d.ts +26 -0
- package/dist/Tab.d.ts.map +1 -0
- package/dist/Tab.js +25 -0
- package/dist/Tabs.d.ts +411 -0
- package/dist/Tabs.d.ts.map +1 -0
- package/dist/Tabs.js +262 -0
- package/dist/Toolbar.d.ts +248 -0
- package/dist/Toolbar.d.ts.map +1 -0
- package/dist/Toolbar.js +187 -0
- package/dist/Tooltip.d.ts +296 -0
- package/dist/Tooltip.d.ts.map +1 -0
- package/dist/Tooltip.js +172 -0
- package/dist/Tree.d.ts +405 -0
- package/dist/Tree.d.ts.map +1 -0
- package/dist/Tree.js +333 -0
- package/dist/TreeGrid.d.ts +426 -0
- package/dist/TreeGrid.d.ts.map +1 -0
- package/dist/TreeGrid.js +308 -0
- package/dist/VisuallyHidden.d.ts +68 -0
- package/dist/VisuallyHidden.d.ts.map +1 -0
- package/dist/VisuallyHidden.js +44 -0
- package/dist/WindowSplitter.d.ts +336 -0
- package/dist/WindowSplitter.d.ts.map +1 -0
- package/dist/WindowSplitter.js +305 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -0
- package/package.json +48 -20
- package/src/HttpRouter.test.ts +0 -294
- package/src/HttpRouter.ts +0 -168
- package/src/Link.test.ts +0 -84
- package/src/Link.ts +0 -107
- package/src/index.ts +0 -2
package/dist/Tree.d.ts
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
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
|
+
* Learn the interaction in the [Tree guide](/explore/ui-tree).
|
|
12
|
+
*
|
|
13
|
+
* @since 1.0.0
|
|
14
|
+
* @category modules
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
import * as Effect from "effect/Effect";
|
|
18
|
+
import type * as Scope from "effect/Scope";
|
|
19
|
+
import * as Schema from "effect/Schema";
|
|
20
|
+
import type { Fx } from "@typed/fx/Fx";
|
|
21
|
+
import { RefSubject } from "@typed/fx";
|
|
22
|
+
import { EventHandler, type Renderable, type RenderEvent, type RenderTemplate } from "@typed/template";
|
|
23
|
+
import * as Collection from "./Collection.js";
|
|
24
|
+
import * as Dom from "./Dom.js";
|
|
25
|
+
import type { HostResult } from "./Dom/Types.js";
|
|
26
|
+
/**
|
|
27
|
+
* The focused node and expanded parent identities.
|
|
28
|
+
* Expansion controls visible traversal; file selection or opening is a separate application action.
|
|
29
|
+
*
|
|
30
|
+
* @since 1.0.0
|
|
31
|
+
* @category Hierarchy state
|
|
32
|
+
*/
|
|
33
|
+
export interface State {
|
|
34
|
+
/**
|
|
35
|
+
* Id currently active for keyboard navigation; null means no active item.
|
|
36
|
+
* @since 1.0.0
|
|
37
|
+
* @category Keyboard focus
|
|
38
|
+
*/
|
|
39
|
+
readonly activeId: string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Ids whose child tree groups are currently visible.
|
|
42
|
+
* @since 1.0.0
|
|
43
|
+
* @category Expansion
|
|
44
|
+
*/
|
|
45
|
+
readonly expandedIds: readonly string[];
|
|
46
|
+
/**
|
|
47
|
+
* Whether movement wraps between the first and last enabled items.
|
|
48
|
+
* @since 1.0.0
|
|
49
|
+
* @category Keyboard navigation
|
|
50
|
+
*/
|
|
51
|
+
readonly loop: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Initial Tree values. activeId defaults null and expandedIds defaults empty.
|
|
55
|
+
*
|
|
56
|
+
* @since 1.0.0
|
|
57
|
+
* @category Hierarchy state
|
|
58
|
+
*/
|
|
59
|
+
export interface InitialState {
|
|
60
|
+
/**
|
|
61
|
+
* Id currently active for keyboard navigation; null means no active item.
|
|
62
|
+
* @since 1.0.0
|
|
63
|
+
* @category Keyboard focus
|
|
64
|
+
*/
|
|
65
|
+
readonly activeId?: string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Ids whose child tree groups are currently visible.
|
|
68
|
+
* @since 1.0.0
|
|
69
|
+
* @category Expansion
|
|
70
|
+
*/
|
|
71
|
+
readonly expandedIds?: readonly string[];
|
|
72
|
+
/**
|
|
73
|
+
* Whether movement wraps between the first and last enabled items.
|
|
74
|
+
* @since 1.0.0
|
|
75
|
+
* @category Keyboard navigation
|
|
76
|
+
*/
|
|
77
|
+
readonly loop?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Effect Schema used by makeState to encode, decode, and hydrate Tree state.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* import * as Schema from "effect/Schema";
|
|
86
|
+
* import * as Tree from "@typed/ui/Tree";
|
|
87
|
+
*
|
|
88
|
+
* const decodeState = Schema.decodeUnknownEffect(Tree.StateSchema);
|
|
89
|
+
* ```
|
|
90
|
+
* @since 1.0.0
|
|
91
|
+
* @category Hierarchy state
|
|
92
|
+
*/
|
|
93
|
+
export declare const StateSchema: Schema.Struct<{
|
|
94
|
+
readonly activeId: Schema.NullOr<Schema.String>;
|
|
95
|
+
readonly expandedIds: Schema.$Array<Schema.String>;
|
|
96
|
+
readonly loop: Schema.Boolean;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Creates hydrated Tree state. activeId defaults null and expandedIds defaults empty.
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* The returned Effect creates the RefSubject when run. That state is renderer-independent;
|
|
103
|
+
* collection registrations belong to the separate Scope that runs register or ref, not to state
|
|
104
|
+
* creation.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* import * as Effect from "effect/Effect";
|
|
109
|
+
* import * as Tree from "@typed/ui/Tree";
|
|
110
|
+
*
|
|
111
|
+
* const program = Effect.scoped(
|
|
112
|
+
* Effect.gen(function* () {
|
|
113
|
+
* const state = yield* Tree.makeState({});
|
|
114
|
+
* const collection = yield* Tree.makeCollection();
|
|
115
|
+
* return { state: yield* state, collection: yield* collection };
|
|
116
|
+
* }),
|
|
117
|
+
* );
|
|
118
|
+
* ```
|
|
119
|
+
* @since 1.0.0
|
|
120
|
+
* @category Hierarchy state
|
|
121
|
+
*/
|
|
122
|
+
export declare function makeState(initial?: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
|
|
123
|
+
readonly activeId: string | null;
|
|
124
|
+
readonly expandedIds: readonly string[];
|
|
125
|
+
readonly loop: boolean;
|
|
126
|
+
}, Schema.SchemaError, never, never>, never, Scope.Scope>;
|
|
127
|
+
/**
|
|
128
|
+
* Tree collection value recording an item's parent relationship.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* The public model lets custom composites reuse Tree's deterministic policy without copying an
|
|
132
|
+
* internal shape.
|
|
133
|
+
*
|
|
134
|
+
* @since 1.0.0
|
|
135
|
+
* @category Node registration
|
|
136
|
+
*/
|
|
137
|
+
export interface ItemValue {
|
|
138
|
+
/**
|
|
139
|
+
* Id whose expansion controls this descendant group.
|
|
140
|
+
* @since 1.0.0
|
|
141
|
+
* @category Hierarchy
|
|
142
|
+
*/
|
|
143
|
+
readonly parentId?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Whether aria-expanded is emitted and hierarchical keys may open descendants.
|
|
146
|
+
* @since 1.0.0
|
|
147
|
+
* @category Hierarchy
|
|
148
|
+
*/
|
|
149
|
+
readonly hasChildren: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Creates a scoped Collection for Tree items.
|
|
153
|
+
*
|
|
154
|
+
* @remarks
|
|
155
|
+
* The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
|
|
156
|
+
* owned by the Scope that runs register, independently of this construction Effect.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* import * as Effect from "effect/Effect";
|
|
161
|
+
* import * as Tree from "@typed/ui/Tree";
|
|
162
|
+
*
|
|
163
|
+
* const program = Effect.scoped(
|
|
164
|
+
* Effect.gen(function* () {
|
|
165
|
+
* const collection = yield* Tree.makeCollection();
|
|
166
|
+
* return yield* collection;
|
|
167
|
+
* }),
|
|
168
|
+
* );
|
|
169
|
+
* ```
|
|
170
|
+
* @since 1.0.0
|
|
171
|
+
* @category Node registration
|
|
172
|
+
*/
|
|
173
|
+
export declare const makeCollection: (initial?: Collection.State<ItemValue, Element>) => Effect.Effect<RefSubject.RefSubject<Collection.State<ItemValue, Element>, never, never>, never, Scope.Scope>;
|
|
174
|
+
/**
|
|
175
|
+
* Tests membership in expandedIds without touching the DOM.
|
|
176
|
+
*
|
|
177
|
+
* @remarks
|
|
178
|
+
* Separating this deterministic policy from event wiring lets applications test it directly and
|
|
179
|
+
* reuse it in custom composites.
|
|
180
|
+
*
|
|
181
|
+
* This is a synchronous calculation. It acquires no resources and does not mutate the input array,
|
|
182
|
+
* state, event, or DOM.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* import * as Tree from "@typed/ui/Tree";
|
|
187
|
+
*
|
|
188
|
+
* const expanded = Tree.isExpanded({ activeId: null, expandedIds: ["parent"], loop: true }, "parent");
|
|
189
|
+
* ```
|
|
190
|
+
* @since 1.0.0
|
|
191
|
+
* @category Expansion
|
|
192
|
+
*/
|
|
193
|
+
export declare function isExpanded(state: State, id: string): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Adds an id once to expandedIds.
|
|
196
|
+
*
|
|
197
|
+
* @remarks
|
|
198
|
+
* The operation exposes Tree's transition directly so callers can compose it in Effect programs
|
|
199
|
+
* and native event handlers.
|
|
200
|
+
*
|
|
201
|
+
* @since 1.0.0
|
|
202
|
+
* @category Expansion
|
|
203
|
+
*/
|
|
204
|
+
export declare function expand<E, R>(state: RefSubject.RefSubject<State, E, R>, id: string): Effect.Effect<State, E, R>;
|
|
205
|
+
/**
|
|
206
|
+
* Removes an id from expandedIds.
|
|
207
|
+
*
|
|
208
|
+
* @remarks
|
|
209
|
+
* The operation exposes Tree's transition directly so callers can compose it in Effect programs
|
|
210
|
+
* and native event handlers.
|
|
211
|
+
*
|
|
212
|
+
* @since 1.0.0
|
|
213
|
+
* @category Expansion
|
|
214
|
+
*/
|
|
215
|
+
export declare function collapse<E, R>(state: RefSubject.RefSubject<State, E, R>, id: string): Effect.Effect<State, E, R>;
|
|
216
|
+
/**
|
|
217
|
+
* Sets the active tree item id without changing expansion.
|
|
218
|
+
*
|
|
219
|
+
* @remarks
|
|
220
|
+
* The operation exposes Tree's transition directly so callers can compose it in Effect programs
|
|
221
|
+
* and native event handlers.
|
|
222
|
+
*
|
|
223
|
+
* @since 1.0.0
|
|
224
|
+
* @category Node focus
|
|
225
|
+
*/
|
|
226
|
+
export declare function activate<E, R>(state: RefSubject.RefSubject<State, E, R>, activeId: string | null): Effect.Effect<State, E, R>;
|
|
227
|
+
/**
|
|
228
|
+
* Inputs accepted by Tree.Root in addition to the shared DOM host options.
|
|
229
|
+
*
|
|
230
|
+
* @since 1.0.0
|
|
231
|
+
* @category Tree surface
|
|
232
|
+
*/
|
|
233
|
+
export interface RootOptions extends Dom.HostOptions<HTMLDivElement> {
|
|
234
|
+
/**
|
|
235
|
+
* Renderer-independent RefSubject state consumed by this component or operation.
|
|
236
|
+
* @since 1.0.0
|
|
237
|
+
* @category State connection
|
|
238
|
+
*/
|
|
239
|
+
readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
|
|
240
|
+
/**
|
|
241
|
+
* Item registry used for collection-driven keyboard behavior and mounted ordering.
|
|
242
|
+
* @since 1.0.0
|
|
243
|
+
* @category Item registration
|
|
244
|
+
*/
|
|
245
|
+
readonly collection?: RefSubject.RefSubject<Collection.State<ItemValue>>;
|
|
246
|
+
/**
|
|
247
|
+
* Accessible label rendered through aria-label.
|
|
248
|
+
* @since 1.0.0
|
|
249
|
+
* @category Accessible naming
|
|
250
|
+
*/
|
|
251
|
+
readonly label: Renderable.Any<string | null | undefined>;
|
|
252
|
+
/**
|
|
253
|
+
* Renderable child content for the component host.
|
|
254
|
+
* @since 1.0.0
|
|
255
|
+
* @category Rendered content
|
|
256
|
+
*/
|
|
257
|
+
readonly content: Renderable.Any;
|
|
258
|
+
}
|
|
259
|
+
declare function rootInternalProps<const Options extends RootOptions>(options: Options): ({ property }: Dom.InternalPropsHelpers<Options>) => {
|
|
260
|
+
readonly role: "tree";
|
|
261
|
+
readonly "aria-label": Exclude<Dom.Property<Options, "label">, Dom.Nullish> | undefined;
|
|
262
|
+
readonly tabindex: RefSubject.Computed<-1 | 0, Schema.SchemaError, never>;
|
|
263
|
+
readonly onfocus: Effect.Effect<void, Schema.SchemaError, never> | undefined;
|
|
264
|
+
readonly onkeydown: EventHandler.EventHandler<KeyboardEvent, Schema.SchemaError, never> | undefined;
|
|
265
|
+
readonly ref: RefSubject.HydratedRefSubject<State, Schema.SchemaError, never, never>;
|
|
266
|
+
};
|
|
267
|
+
type RootInternalProps<Options extends RootOptions> = ReturnType<ReturnType<typeof rootInternalProps<Options>>>;
|
|
268
|
+
/**
|
|
269
|
+
* Renders the tree root and applies hierarchy-aware keyboard navigation to registered items.
|
|
270
|
+
*
|
|
271
|
+
* @remarks
|
|
272
|
+
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
273
|
+
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
274
|
+
* unrelated nodes and attributes remain caller-owned.
|
|
275
|
+
*
|
|
276
|
+
* @since 1.0.0
|
|
277
|
+
* @category Tree surface
|
|
278
|
+
*/
|
|
279
|
+
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>;
|
|
280
|
+
/**
|
|
281
|
+
* Inputs accepted by Tree.Item in addition to the shared DOM host options.
|
|
282
|
+
*
|
|
283
|
+
* @since 1.0.0
|
|
284
|
+
* @category Tree nodes
|
|
285
|
+
*/
|
|
286
|
+
export interface ItemOptions extends Dom.HostOptions<HTMLDivElement> {
|
|
287
|
+
/**
|
|
288
|
+
* Renderer-independent RefSubject state consumed by this component or operation.
|
|
289
|
+
* @since 1.0.0
|
|
290
|
+
* @category State connection
|
|
291
|
+
*/
|
|
292
|
+
readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
|
|
293
|
+
/**
|
|
294
|
+
* Item registry used for collection-driven keyboard behavior and mounted ordering.
|
|
295
|
+
* @since 1.0.0
|
|
296
|
+
* @category Item registration
|
|
297
|
+
*/
|
|
298
|
+
readonly collection?: RefSubject.RefSubject<Collection.State<ItemValue>>;
|
|
299
|
+
/**
|
|
300
|
+
* Stable id used for collection identity and ARIA relationships.
|
|
301
|
+
* @since 1.0.0
|
|
302
|
+
* @category Identity and relationships
|
|
303
|
+
*/
|
|
304
|
+
readonly id: string;
|
|
305
|
+
/**
|
|
306
|
+
* Id whose expansion controls this descendant group.
|
|
307
|
+
* @since 1.0.0
|
|
308
|
+
* @category Hierarchy
|
|
309
|
+
*/
|
|
310
|
+
readonly parentId?: string;
|
|
311
|
+
/**
|
|
312
|
+
* One-based hierarchy level exposed through aria-level.
|
|
313
|
+
* @since 1.0.0
|
|
314
|
+
* @category Hierarchy
|
|
315
|
+
*/
|
|
316
|
+
readonly level?: number;
|
|
317
|
+
/**
|
|
318
|
+
* Whether aria-expanded is emitted and hierarchical keys may open descendants.
|
|
319
|
+
* @since 1.0.0
|
|
320
|
+
* @category Hierarchy
|
|
321
|
+
*/
|
|
322
|
+
readonly hasChildren?: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Flag used by collection movement and widget handlers to skip activation by default.
|
|
325
|
+
* @since 1.0.0
|
|
326
|
+
* @category Availability
|
|
327
|
+
*/
|
|
328
|
+
readonly disabled?: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Renderable child content for the component host.
|
|
331
|
+
* @since 1.0.0
|
|
332
|
+
* @category Rendered content
|
|
333
|
+
*/
|
|
334
|
+
readonly content: Renderable.Any;
|
|
335
|
+
}
|
|
336
|
+
declare function itemInternalProps<const Options extends ItemOptions>(options: Options): ({ property }: Dom.InternalPropsHelpers<Options>) => {
|
|
337
|
+
readonly id: string;
|
|
338
|
+
readonly role: "treeitem";
|
|
339
|
+
readonly "aria-level": 1 | Exclude<Dom.Property<Options, "level">, Dom.Nullish>;
|
|
340
|
+
readonly "aria-expanded": RefSubject.Computed<boolean, Schema.SchemaError, never> | undefined;
|
|
341
|
+
readonly "aria-disabled": boolean;
|
|
342
|
+
readonly tabindex: RefSubject.Computed<-1 | 0, Schema.SchemaError, never>;
|
|
343
|
+
readonly onfocus: Effect.Effect<State, Schema.SchemaError, never>;
|
|
344
|
+
readonly onclick: Effect.Effect<void, never, never> | Effect.Effect<State, Schema.SchemaError, never>;
|
|
345
|
+
readonly ref: ((element: Element & HTMLDivElement & RefSubject.HydrationElement) => Effect.Effect<void, any, any>) | undefined;
|
|
346
|
+
};
|
|
347
|
+
type ItemInternalProps<Options extends ItemOptions> = ReturnType<ReturnType<typeof itemInternalProps<Options>>>;
|
|
348
|
+
/**
|
|
349
|
+
* Renders and optionally registers a treeitem with level, expanded, disabled, and roving-focus
|
|
350
|
+
* state.
|
|
351
|
+
*
|
|
352
|
+
* @remarks
|
|
353
|
+
* The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
|
|
354
|
+
* collection registrations only when rendered. The rendering Scope removes those resources;
|
|
355
|
+
* unrelated nodes and attributes remain caller-owned.
|
|
356
|
+
*
|
|
357
|
+
* @since 1.0.0
|
|
358
|
+
* @category Tree nodes
|
|
359
|
+
*/
|
|
360
|
+
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>;
|
|
361
|
+
/**
|
|
362
|
+
* Inputs accepted by Tree.Group in addition to the shared DOM host options.
|
|
363
|
+
*
|
|
364
|
+
* @since 1.0.0
|
|
365
|
+
* @category Child visibility
|
|
366
|
+
*/
|
|
367
|
+
export interface GroupOptions extends Dom.HostOptions<HTMLDivElement> {
|
|
368
|
+
/**
|
|
369
|
+
* Renderer-independent RefSubject state consumed by this component or operation.
|
|
370
|
+
* @since 1.0.0
|
|
371
|
+
* @category State connection
|
|
372
|
+
*/
|
|
373
|
+
readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
|
|
374
|
+
/**
|
|
375
|
+
* Id whose expansion controls this descendant group.
|
|
376
|
+
* @since 1.0.0
|
|
377
|
+
* @category Hierarchy
|
|
378
|
+
*/
|
|
379
|
+
readonly parentId: string;
|
|
380
|
+
/**
|
|
381
|
+
* Renderable child content for the component host.
|
|
382
|
+
* @since 1.0.0
|
|
383
|
+
* @category Rendered content
|
|
384
|
+
*/
|
|
385
|
+
readonly content: Renderable.Any;
|
|
386
|
+
}
|
|
387
|
+
declare function groupInternalProps<const Options extends GroupOptions>(options: Options): () => {
|
|
388
|
+
readonly role: "group";
|
|
389
|
+
readonly "?hidden": RefSubject.Computed<boolean, Schema.SchemaError, never>;
|
|
390
|
+
};
|
|
391
|
+
type GroupInternalProps<Options extends GroupOptions> = ReturnType<ReturnType<typeof groupInternalProps<Options>>>;
|
|
392
|
+
/**
|
|
393
|
+
* Renders a child group and hides it while its parent id is not expanded.
|
|
394
|
+
*
|
|
395
|
+
* @remarks
|
|
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
|
+
* @since 1.0.0
|
|
401
|
+
* @category Child visibility
|
|
402
|
+
*/
|
|
403
|
+
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>;
|
|
404
|
+
export {};
|
|
405
|
+
//# sourceMappingURL=Tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../src/Tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAA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