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

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 (128) hide show
  1. package/dist/Alert.d.ts +35 -41
  2. package/dist/Alert.d.ts.map +1 -1
  3. package/dist/Alert.js +23 -20
  4. package/dist/Button.d.ts +34 -78
  5. package/dist/Button.d.ts.map +1 -1
  6. package/dist/Button.js +16 -12
  7. package/dist/Carousel.d.ts +35 -236
  8. package/dist/Carousel.d.ts.map +1 -1
  9. package/dist/Carousel.js +13 -136
  10. package/dist/Checkbox.d.ts +55 -90
  11. package/dist/Checkbox.d.ts.map +1 -1
  12. package/dist/Checkbox.js +44 -38
  13. package/dist/Collection.d.ts +15 -15
  14. package/dist/Collection.js +7 -7
  15. package/dist/Combobox.d.ts +38 -187
  16. package/dist/Combobox.d.ts.map +1 -1
  17. package/dist/Combobox.js +9 -80
  18. package/dist/Component.d.ts +30 -24
  19. package/dist/Component.d.ts.map +1 -1
  20. package/dist/Component.js +23 -12
  21. package/dist/Composite.d.ts +50 -50
  22. package/dist/Composite.js +20 -20
  23. package/dist/Dialog.d.ts +34 -34
  24. package/dist/Dialog.d.ts.map +1 -1
  25. package/dist/Dialog.js +16 -14
  26. package/dist/Disclosure.d.ts +15 -15
  27. package/dist/Disclosure.js +6 -6
  28. package/dist/Dom/Events.d.ts +4 -4
  29. package/dist/Dom/Events.js +4 -4
  30. package/dist/Dom/Props.d.ts +9 -9
  31. package/dist/Dom/Props.js +4 -4
  32. package/dist/Dom/Refs.d.ts +2 -2
  33. package/dist/Dom/Refs.js +1 -1
  34. package/dist/Dom/Render.d.ts +2 -2
  35. package/dist/Dom/Render.js +2 -2
  36. package/dist/Dom/Types.d.ts +33 -33
  37. package/dist/Dom/index.d.ts +5 -5
  38. package/dist/Dom/index.d.ts.map +1 -1
  39. package/dist/Dom/index.js +4 -4
  40. package/dist/Dom.d.ts +1 -1
  41. package/dist/Dom.js +1 -1
  42. package/dist/Focusable.d.ts +5 -5
  43. package/dist/Focusable.js +1 -1
  44. package/dist/Form.d.ts +565 -533
  45. package/dist/Form.d.ts.map +1 -1
  46. package/dist/Form.js +350 -195
  47. package/dist/Grid.d.ts +39 -220
  48. package/dist/Grid.d.ts.map +1 -1
  49. package/dist/Grid.js +12 -107
  50. package/dist/Group.d.ts +50 -69
  51. package/dist/Group.d.ts.map +1 -1
  52. package/dist/Group.js +33 -25
  53. package/dist/Heading.d.ts +41 -40
  54. package/dist/Heading.d.ts.map +1 -1
  55. package/dist/Heading.js +26 -16
  56. package/dist/Hovercard.d.ts +18 -18
  57. package/dist/Hovercard.js +6 -6
  58. package/dist/HttpRouter.d.ts +3 -3
  59. package/dist/HttpRouter.js +5 -5
  60. package/dist/Link.d.ts +17 -21
  61. package/dist/Link.d.ts.map +1 -1
  62. package/dist/Link.js +11 -0
  63. package/dist/Listbox.d.ts +31 -163
  64. package/dist/Listbox.d.ts.map +1 -1
  65. package/dist/Listbox.js +9 -80
  66. package/dist/Menu.d.ts +67 -376
  67. package/dist/Menu.d.ts.map +1 -1
  68. package/dist/Menu.js +17 -179
  69. package/dist/Menubar.d.ts +24 -142
  70. package/dist/Menubar.d.ts.map +1 -1
  71. package/dist/Menubar.js +8 -66
  72. package/dist/Meter.d.ts +72 -132
  73. package/dist/Meter.d.ts.map +1 -1
  74. package/dist/Meter.js +35 -42
  75. package/dist/NativeDetails.d.ts +1 -1
  76. package/dist/NativeDetails.js +1 -1
  77. package/dist/NativeDialog.d.ts +7 -5
  78. package/dist/NativeDialog.d.ts.map +1 -1
  79. package/dist/NativeDialog.js +42 -4
  80. package/dist/NativePopover.d.ts +6 -4
  81. package/dist/NativePopover.d.ts.map +1 -1
  82. package/dist/NativePopover.js +43 -5
  83. package/dist/Popover.d.ts +18 -19
  84. package/dist/Popover.d.ts.map +1 -1
  85. package/dist/Popover.js +7 -8
  86. package/dist/RadioGroup.d.ts +86 -188
  87. package/dist/RadioGroup.d.ts.map +1 -1
  88. package/dist/RadioGroup.js +55 -105
  89. package/dist/Role.d.ts +4 -4
  90. package/dist/Role.js +1 -1
  91. package/dist/Select.d.ts +109 -220
  92. package/dist/Select.d.ts.map +1 -1
  93. package/dist/Select.js +67 -117
  94. package/dist/Separator.d.ts +30 -26
  95. package/dist/Separator.d.ts.map +1 -1
  96. package/dist/Separator.js +16 -10
  97. package/dist/Slider.d.ts +64 -111
  98. package/dist/Slider.d.ts.map +1 -1
  99. package/dist/Slider.js +47 -42
  100. package/dist/SpinButton.d.ts +64 -111
  101. package/dist/SpinButton.d.ts.map +1 -1
  102. package/dist/SpinButton.js +47 -42
  103. package/dist/Storybook.d.ts +2 -2
  104. package/dist/Storybook.js +1 -1
  105. package/dist/Switch.d.ts +52 -91
  106. package/dist/Switch.d.ts.map +1 -1
  107. package/dist/Switch.js +30 -36
  108. package/dist/Tabs.d.ts +44 -224
  109. package/dist/Tabs.d.ts.map +1 -1
  110. package/dist/Tabs.js +10 -94
  111. package/dist/Toolbar.d.ts +24 -142
  112. package/dist/Toolbar.d.ts.map +1 -1
  113. package/dist/Toolbar.js +8 -66
  114. package/dist/Tooltip.d.ts +20 -20
  115. package/dist/Tooltip.js +6 -6
  116. package/dist/Tree.d.ts +43 -229
  117. package/dist/Tree.d.ts.map +1 -1
  118. package/dist/Tree.js +12 -113
  119. package/dist/TreeGrid.d.ts +45 -264
  120. package/dist/TreeGrid.d.ts.map +1 -1
  121. package/dist/TreeGrid.js +13 -125
  122. package/dist/VisuallyHidden.d.ts +41 -27
  123. package/dist/VisuallyHidden.d.ts.map +1 -1
  124. package/dist/VisuallyHidden.js +27 -10
  125. package/dist/WindowSplitter.d.ts +68 -108
  126. package/dist/WindowSplitter.d.ts.map +1 -1
  127. package/dist/WindowSplitter.js +106 -23
  128. package/package.json +9 -8
package/dist/Select.js CHANGED
@@ -1,15 +1,13 @@
1
1
  /**
2
- * Select keeps popover visibility, active option, and selected value separate. A native button
3
- * targets manual-popover listbox content; keyboard movement and typeahead update active state
4
- * before selection closes the popover.
2
+ * A native popover-backed listbox with separate selection, focus, and visibility.
3
+ * Unlike Form.Select, these options are divs rather than native select options.
4
+ * Pass one collection to Content and its Options for registered keyboard navigation.
5
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.
6
+ * Read the [Select guide](/explore/ui-select) for a complete example.
10
7
  *
8
+ * [APG interaction reference](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/).
11
9
  * @since 1.0.0
12
- * @category modules
10
+ * @category Overview
13
11
  * @packageDocumentation
14
12
  */
15
13
  import * as Effect from "effect/Effect";
@@ -26,15 +24,9 @@ const invokers = new WeakMap();
26
24
  * Effect Schema used by makeState to encode, decode, and hydrate Select state.
27
25
  *
28
26
  * @remarks
29
- * ## Why
30
- *
31
27
  * A public schema makes hydration and serialized state use the same runtime validation as direct
32
28
  * construction.
33
29
  *
34
- * ## Ownership and lifetime
35
- *
36
- * This declaration is data or schema metadata and acquires no resources.
37
- *
38
30
  * @example
39
31
  * ```ts
40
32
  * import * as Schema from "effect/Schema";
@@ -43,7 +35,7 @@ const invokers = new WeakMap();
43
35
  * const decodeState = Schema.decodeUnknownEffect(Select.StateSchema);
44
36
  * ```
45
37
  * @since 1.0.0
46
- * @category schemas
38
+ * @category Hydration schemas
47
39
  */
48
40
  export const StateSchema = Schema.Struct({
49
41
  id: Schema.String,
@@ -60,12 +52,8 @@ export const StateSchema = Schema.Struct({
60
52
  * false, and loop true.
61
53
  *
62
54
  * @remarks
63
- * ## Why
64
- *
65
55
  * State and collection ownership can be composed and tested independently from any renderer.
66
56
  *
67
- * ## Ownership and lifetime
68
- *
69
57
  * The returned Effect creates the RefSubject when run. That state is renderer-independent;
70
58
  * collection registrations belong to the separate Scope that runs register or ref, not to state
71
59
  * creation.
@@ -84,7 +72,7 @@ export const StateSchema = Schema.Struct({
84
72
  * );
85
73
  * ```
86
74
  * @since 1.0.0
87
- * @category constructors
75
+ * @category State construction
88
76
  */
89
77
  export function makeState(initial) {
90
78
  return RefSubject.hydrate(StateSchema, {
@@ -102,12 +90,8 @@ export function makeState(initial) {
102
90
  * Creates a scoped Collection for Select items.
103
91
  *
104
92
  * @remarks
105
- * ## Why
106
- *
107
93
  * State and collection ownership can be composed and tested independently from any renderer.
108
94
  *
109
- * ## Ownership and lifetime
110
- *
111
95
  * The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
112
96
  * owned by the Scope that runs register, independently of this construction Effect.
113
97
  *
@@ -124,31 +108,18 @@ export function makeState(initial) {
124
108
  * );
125
109
  * ```
126
110
  * @since 1.0.0
127
- * @category constructors
111
+ * @category State construction
128
112
  */
129
113
  export const makeCollection = Collection.makeState;
130
114
  /**
131
- * Sets selected value and active id, then closes the popover.
115
+ * Commits an option ID and value, then marks the popup closed.
132
116
  *
133
117
  * @remarks
134
- * ## Why
135
- *
136
- * The operation exposes Select's transition directly so callers can compose it in Effect programs
137
- * and native event handlers.
138
- *
139
- * ## Ownership and lifetime
140
- *
141
- * The returned Effect performs the update or DOM side effect only when run, preserves the declared
142
- * error and service channels, and retains no resources after completion.
143
- *
144
- * ## Example
145
- *
146
- * Import with `import { select } from "@typed/ui/Select";` Extend the [Select.makeState runnable
147
- * setup](/reference/%40typed%2Fui%2FSelect%23makeState). Inside the linked Effect program invoke
148
- * `yield* select(state, "utc", "UTC")`, then read state to observe selection and active focus
149
- * update together while the popup closes.
118
+ * This Effect changes state only. It does not check collection membership or move focus itself;
119
+ * the mounted popover observes the visibility change. Keep id and value consistent with the
120
+ * option being selected.
150
121
  * @since 1.0.0
151
- * @category combinators
122
+ * @category State transitions
152
123
  */
153
124
  export function select(state, id, value) {
154
125
  return RefSubject.update(state, (current) => ({ ...current, activeId: id, value, open: false }));
@@ -194,54 +165,59 @@ function invokerRef(state) {
194
165
  });
195
166
  }
196
167
  /**
197
- * Renders the native button that targets listbox popover content and opens it on ArrowDown.
168
+ * Renders the native button that toggles the select listbox popover.
198
169
  *
199
170
  * @remarks
200
- * ## Why
201
- *
202
- * The component applies the family behavior while leaving callers free to supply a custom host
203
- * through the shared DOM boundary.
171
+ * The generated button ID labels Content; popovertarget points to state.id. ArrowDown invokes
172
+ * the native button click. Content synchronizes native toggle events with open state. Render a
173
+ * useful name containing the current choice; the trigger does not format selected values for
174
+ * you.
204
175
  *
205
- * ## Ownership and lifetime
206
- *
207
- * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
208
- * collection registrations only when rendered. The rendering Scope removes those resources;
209
- * unrelated nodes and attributes remain caller-owned.
210
- *
211
- * ## Example
176
+ * @example
177
+ * ```ts
178
+ * import { RefSubject } from "@typed/fx";
179
+ * import { html } from "@typed/template";
180
+ * import { component } from "@typed/ui/Component";
181
+ * import * as Select from "@typed/ui/Select";
212
182
  *
213
- * Import with `import { Trigger } from "@typed/ui/Select";` Extend the [Select.makeState runnable
214
- * setup](/reference/%40typed%2Fui%2FSelect%23makeState). Replace the linked program's final
215
- * snapshot read with `Trigger({ state, content: "Choose timezone" })`; render that Fx before the
216
- * same Scope closes.
183
+ * export const DensityPicker = component(function* () {
184
+ * const state = yield* Select.makeState({ id: "density-options", value: "comfortable" });
185
+ * const collection = yield* Select.makeCollection();
186
+ * const label = RefSubject.map(state, ({ value }) =>
187
+ * value === "compact" ? "Density: compact" : "Density: comfortable",
188
+ * );
189
+ * return html`<div class="density-picker">
190
+ * ${Select.Trigger({ state, content: label })}
191
+ * ${Select.Content({
192
+ * state, collection,
193
+ * content: [
194
+ * Select.Option({
195
+ * state, collection, id: "density-comfortable", value: "comfortable",
196
+ * textValue: "Comfortable", content: "Comfortable",
197
+ * }),
198
+ * Select.Option({
199
+ * state, collection, id: "density-compact", value: "compact",
200
+ * textValue: "Compact", content: "Compact",
201
+ * }),
202
+ * ],
203
+ * })}
204
+ * </div>`;
205
+ * });
206
+ * ```
217
207
  * @since 1.0.0
218
- * @category components
208
+ * @category Controls
219
209
  */
220
210
  export function Trigger(options, host) {
221
211
  return Dom.renderHost()(options, host, triggerProps(options), options.content, (props, content) => html `<button ...${props}>${content}</button>`);
222
212
  }
223
213
  /**
224
- * Consumer-facing alias of the canonical Select component with identical behavior and lifetime.
214
+ * Alias of Trigger.
225
215
  *
226
216
  * @remarks
227
- * ## Why
228
- *
229
- * The component applies the family behavior while leaving callers free to supply a custom host
230
- * through the shared DOM boundary.
231
- *
232
- * ## Ownership and lifetime
233
- *
234
- * The alias acquires nothing. Rendering it has exactly the canonical component's Scope and DOM
235
- * ownership contract.
236
- *
237
- * ## Example
238
- *
239
- * Import with `import { Select } from "@typed/ui/Select";` Extend the [Select.makeState runnable
240
- * setup](/reference/%40typed%2Fui%2FSelect%23makeState). Replace the linked program's final
241
- * snapshot read with `Select({ state, content: "Choose timezone" })`; render that Fx before the
242
- * same Scope closes.
217
+ * Calling Select alone creates only the invoker button. Compose Content and Option for the popup
218
+ * choice surface; use Form.Select for a native select element.
243
219
  * @since 1.0.0
244
- * @category components
220
+ * @category Controls
245
221
  */
246
222
  export const Select = Trigger;
247
223
  function contentProps(options) {
@@ -323,28 +299,16 @@ function contentProps(options) {
323
299
  });
324
300
  }
325
301
  /**
326
- * Renders manual-popover listbox content and handles Arrow keys, Enter, Escape, and typeahead.
302
+ * Renders the manual-popover listbox and coordinates registered keyboard movement.
327
303
  *
328
304
  * @remarks
329
- * ## Why
330
- *
331
- * The component applies the family behavior while leaving callers free to supply a custom host
332
- * through the shared DOM boundary.
333
- *
334
- * ## Ownership and lifetime
335
- *
336
- * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
337
- * collection registrations only when rendered. The rendering Scope removes those resources;
338
- * unrelated nodes and attributes remain caller-owned.
339
- *
340
- * ## Example
341
- *
342
- * Import with `import { Content } from "@typed/ui/Select";` Extend the [Select.makeState runnable
343
- * setup](/reference/%40typed%2Fui%2FSelect%23makeState). Replace the linked program's final
344
- * snapshot read with `Content({ state, content: "Timezones" })`; render that Fx before the same
345
- * Scope closes.
305
+ * With a collection, arrows and Home/End move focus, buffered typeahead locates options,
306
+ * Enter/Space commits the active choice, and Escape closes with invoker focus restoration.
307
+ * Opening focuses a registered option matching the selected value; an unmatched or null value
308
+ * does not choose the first option. Manual popover mode does not imply auto-mode outside-click
309
+ * dismissal.
346
310
  * @since 1.0.0
347
- * @category components
311
+ * @category Controls
348
312
  */
349
313
  export function Content(options, host) {
350
314
  return Dom.renderHost()(options, host, contentProps(options), options.content, (props, content) => {
@@ -375,29 +339,15 @@ function optionProps(options) {
375
339
  });
376
340
  }
377
341
  /**
378
- * Renders and optionally registers a selectable option; focus updates activeId and click selects
379
- * unless disabled.
342
+ * Renders a selectable listbox option with distinct active and selected state.
380
343
  *
381
344
  * @remarks
382
- * ## Why
383
- *
384
- * The component applies the family behavior while leaving callers free to supply a custom host
385
- * through the shared DOM boundary.
386
- *
387
- * ## Ownership and lifetime
388
- *
389
- * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
390
- * collection registrations only when rendered. The rendering Scope removes those resources;
391
- * unrelated nodes and attributes remain caller-owned.
392
- *
393
- * ## Example
394
- *
395
- * Import with `import { Option } from "@typed/ui/Select";` Extend the [Select.makeState runnable
396
- * setup](/reference/%40typed%2Fui%2FSelect%23makeState). Replace the linked program's final
397
- * snapshot read with `Option({ state, id: "utc", value: "UTC", content: "UTC" })`; render that Fx
398
- * before the same Scope closes.
345
+ * Click commits value and closes the popup; focus updates activeId without committing a new
346
+ * value. Register every option with the same collection used by Content for keyboard navigation.
347
+ * Supply textValue for readable typeahead when value is an internal code. This div is not a
348
+ * native form field.
399
349
  * @since 1.0.0
400
- * @category components
350
+ * @category Controls
401
351
  */
402
352
  export function Option(options, host) {
403
353
  return Dom.renderHost()(options, host, optionProps(options), options.content, (props, content) => html `<div ...${props}>${content}</div>`);
@@ -1,28 +1,26 @@
1
+ /**
2
+ * A non-focusable semantic boundary with an orientation attribute.
3
+ * CSS draws the line; WindowSplitter supplies the separate adjustable-pane interaction.
4
+ *
5
+ * Read the [Separator guide](/explore/ui-separator) for a complete example.
6
+ *
7
+ * [Platform reference](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/separator_role).
8
+ * @since 1.0.0
9
+ * @category Overview
10
+ * @packageDocumentation
11
+ */
1
12
  import type * as Scope from "effect/Scope";
2
13
  import type { Fx } from "@typed/fx/Fx";
3
14
  import { type Renderable, type RenderEvent, type RenderTemplate } from "@typed/template";
4
15
  import * as Dom from "./Dom.js";
5
16
  import type { HostResult } from "./Dom/Types.js";
6
17
  /**
7
- * Options for a non-interactive ARIA separator.
8
- * @remarks
9
- * ## Why
10
- * Orientation communicates whether the visual division is horizontal or
11
- * vertical without implying splitter interaction.
12
- * ## Ownership and lifetime
13
- * The model is inert; dynamic orientation follows the rendered Scope.
14
- * @since 1.0.0
15
- * @category models
16
18
  */
17
19
  export interface SeparatorOptions extends Dom.HostOptions<HTMLDivElement> {
18
- /** Separator orientation, defaulting to horizontal.
19
- * @remarks
20
- * ## Why
21
- * Assistive technology uses orientation to interpret the division.
22
- * ## Ownership and lifetime
23
- * The dynamic attribute subscription ends with the component Scope.
20
+ /**
21
+ * Separator orientation, defaulting to horizontal.
24
22
  * @since 1.0.0
25
- * @category accessibility
23
+ * @category Keyboard navigation
26
24
  */
27
25
  readonly orientation?: Renderable.Any<"horizontal" | "vertical" | null | undefined>;
28
26
  }
@@ -32,22 +30,28 @@ declare function internalProps<const Options extends SeparatorOptions>({ propert
32
30
  };
33
31
  type SeparatorInternalProps<Options extends SeparatorOptions> = ReturnType<typeof internalProps<Options>>;
34
32
  /**
35
- * Renders a non-focusable element with `role="separator"`.
33
+ * Renders a non-interactive semantic division.
34
+ *
36
35
  * @remarks
37
- * ## Why
38
- * This component expresses a semantic division. Use `WindowSplitter` when the
39
- * separator changes pane sizes and therefore requires keyboard interaction.
40
- * ## Ownership and lifetime
41
- * Running the Fx owns its reactive attribute until the Effect Scope closes. A
42
- * custom host must preserve the role and orientation.
36
+ * orientation defaults to horizontal and changes aria-orientation, not layout or dimensions.
37
+ * Supply the visible line through CSS. Do not make this host focusable to imitate a resizer;
38
+ * WindowSplitter owns that separate interaction.
39
+ *
43
40
  * @example
44
41
  * ```ts
45
- * import { Separator } from "@typed/ui/Separator"
42
+ * import { html } from "@typed/template";
43
+ * import { Heading } from "@typed/ui/Heading";
44
+ * import { Separator } from "@typed/ui/Separator";
46
45
  *
47
- * const divider = Separator({ orientation: "vertical" })
46
+ * export const AccountSummary = html`<section>
47
+ * ${Heading({ level: 2, content: "Account summary" })}
48
+ * <p>Personal account</p>
49
+ * ${Separator({ props: { class: "summary-divider" } })}
50
+ * <p>Next renewal: September 30</p>
51
+ * </section>`;
48
52
  * ```
49
53
  * @since 1.0.0
50
- * @category components
54
+ * @category Structure and naming
51
55
  */
52
56
  export declare function Separator<const Options extends SeparatorOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, SeparatorInternalProps<Options>>, "", Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
53
57
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../src/Separator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAQ,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAiB,SAAQ,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC;IACvE;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,YAAY,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACrF;AAED,iBAAS,aAAa,CAAC,KAAK,CAAC,OAAO,SAAS,gBAAgB,EAAE,EAC7D,QAAQ,GACT,EAAE,GAAG,CAAC,oBAAoB,CAAC,OAAO,CAAC;IACzB,IAAI;IAAe,kBAAkB;EAC/C;AAED,KAAK,sBAAsB,CAAC,OAAO,SAAS,gBAAgB,IAAI,UAAU,CACxE,OAAO,aAAa,CAAC,OAAO,CAAC,CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CACvB,KAAK,CAAC,OAAO,SAAS,gBAAgB,EACtC,KAAK,CAAC,IAAI,SAAS,UAAU,GAAG,KAAK,EAErC,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,GAC/F,EAAE,CACH,WAAW,EACX,UAAU,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,EAChC,UAAU,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,GAAG,cAAc,CACnE,CAQA"}
1
+ {"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../src/Separator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAQ,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;GACG;AACH,MAAM,WAAW,gBAAiB,SAAQ,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC;IACvE;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,YAAY,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACrF;AAED,iBAAS,aAAa,CAAC,KAAK,CAAC,OAAO,SAAS,gBAAgB,EAAE,EAC7D,QAAQ,GACT,EAAE,GAAG,CAAC,oBAAoB,CAAC,OAAO,CAAC;IACzB,IAAI;IAAe,kBAAkB;EAC/C;AAED,KAAK,sBAAsB,CAAC,OAAO,SAAS,gBAAgB,IAAI,UAAU,CACxE,OAAO,aAAa,CAAC,OAAO,CAAC,CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,SAAS,CACvB,KAAK,CAAC,OAAO,SAAS,gBAAgB,EACtC,KAAK,CAAC,IAAI,SAAS,UAAU,GAAG,KAAK,EAErC,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,GAC/F,EAAE,CACH,WAAW,EACX,UAAU,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,EAChC,UAAU,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,GAAG,cAAc,CACnE,CAQA"}
package/dist/Separator.js CHANGED
@@ -4,22 +4,28 @@ function internalProps({ property, }) {
4
4
  return { role: "separator", "aria-orientation": property("orientation", "horizontal") };
5
5
  }
6
6
  /**
7
- * Renders a non-focusable element with `role="separator"`.
7
+ * Renders a non-interactive semantic division.
8
+ *
8
9
  * @remarks
9
- * ## Why
10
- * This component expresses a semantic division. Use `WindowSplitter` when the
11
- * separator changes pane sizes and therefore requires keyboard interaction.
12
- * ## Ownership and lifetime
13
- * Running the Fx owns its reactive attribute until the Effect Scope closes. A
14
- * custom host must preserve the role and orientation.
10
+ * orientation defaults to horizontal and changes aria-orientation, not layout or dimensions.
11
+ * Supply the visible line through CSS. Do not make this host focusable to imitate a resizer;
12
+ * WindowSplitter owns that separate interaction.
13
+ *
15
14
  * @example
16
15
  * ```ts
17
- * import { Separator } from "@typed/ui/Separator"
16
+ * import { html } from "@typed/template";
17
+ * import { Heading } from "@typed/ui/Heading";
18
+ * import { Separator } from "@typed/ui/Separator";
18
19
  *
19
- * const divider = Separator({ orientation: "vertical" })
20
+ * export const AccountSummary = html`<section>
21
+ * ${Heading({ level: 2, content: "Account summary" })}
22
+ * <p>Personal account</p>
23
+ * ${Separator({ props: { class: "summary-divider" } })}
24
+ * <p>Next renewal: September 30</p>
25
+ * </section>`;
20
26
  * ```
21
27
  * @since 1.0.0
22
- * @category components
28
+ * @category Structure and naming
23
29
  */
24
30
  export function Separator(options, host) {
25
31
  return Dom.renderHost()(options, host, internalProps, "", (props) => html `<div ...${props}></div>`);
package/dist/Slider.d.ts CHANGED
@@ -1,68 +1,43 @@
1
+ /**
2
+ * Native range input publishing numeric updates during input.
3
+ * Keep programmatic values coherent with bounds and control expensive downstream work separately.
4
+ *
5
+ * Read the [Slider guide](/explore/ui-slider) for a complete example.
6
+ *
7
+ * [APG interaction reference](https://www.w3.org/WAI/ARIA/apg/patterns/slider/).
8
+ * @since 1.0.0
9
+ * @category Overview
10
+ * @packageDocumentation
11
+ */
1
12
  import * as Effect from "effect/Effect";
2
13
  import * as Schema from "effect/Schema";
3
14
  import { RefSubject } from "@typed/fx";
4
15
  import { EventHandler, type Renderable } from "@typed/template";
5
16
  import * as Dom from "./Dom.js";
6
17
  import type { HostResult } from "./Dom/Types.js";
7
- /** Current renderer-independent slider value.
8
- * @remarks
9
- * ## Why
10
- * Value logic remains testable without mounting a range input.
11
- * ## Ownership and lifetime
12
- * Plain state is resource-free; RefSubject ownership is Scope-based.
13
- * @since 1.0.0
14
- * @category state
18
+ /**
15
19
  */
16
20
  export interface State {
17
- /** Finite value reflected by the native input.
18
- * @remarks
19
- * ## Why
20
- * A single numeric source prevents state and DOM drift.
21
- * ## Ownership and lifetime
22
- * Plain data acquires no resources.
23
- * @since 1.0.0
24
- * @category state
21
+ /**
25
22
  */
26
23
  readonly value: number;
27
24
  }
28
- /** Initial slider value.
29
- * @remarks
30
- * ## Why
31
- * Explicit state gives SSR and hydration the same numeric snapshot.
32
- * ## Ownership and lifetime
33
- * Configuration is inert.
34
- * @since 1.0.0
35
- * @category state
25
+ /**
36
26
  */
37
27
  export interface InitialState {
38
- /** Finite initial value.
39
- * @remarks
40
- * ## Why
41
- * It seeds the synchronized input state.
42
- * ## Ownership and lifetime
43
- * Plain data retains no resources.
44
- * @since 1.0.0
45
- * @category state
28
+ /**
46
29
  */
47
30
  readonly value: number;
48
31
  }
49
- /** Schema for slider hydration state.
50
- * @remarks
51
- * ## Why
52
- * Finite validation prevents invalid serialized range values.
53
- * ## Ownership and lifetime
54
- * The immutable schema acquires no resources.
55
- * @since 1.0.0
56
- * @category schemas
32
+ /**
57
33
  */
58
34
  export declare const StateSchema: Schema.Struct<{
59
35
  readonly value: Schema.Finite;
60
36
  }>;
61
- /** Creates hydrated slider state.
37
+ /**
38
+ * Creates hydrated slider state.
62
39
  * @remarks
63
- * ## Why
64
40
  * State can be composed and tested independently of the renderer.
65
- * ## Ownership and lifetime
66
41
  * The calling Effect Scope owns the returned RefSubject.
67
42
  * @example
68
43
  * ```ts
@@ -74,80 +49,47 @@ export declare const StateSchema: Schema.Struct<{
74
49
  * })
75
50
  * ```
76
51
  * @since 1.0.0
77
- * @category constructors
52
+ * @category State construction
78
53
  */
79
54
  export declare function makeState(initial: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
80
55
  readonly value: number;
81
56
  }, Schema.SchemaError, never, never>, never, import("effect/Scope").Scope>;
82
- /** Updates the synchronized slider value.
83
- * @remarks
84
- * ## Why
85
- * An explicit Effect transition preserves RefSubject failures and services.
86
- * ## Ownership and lifetime
87
- * It uses the existing state lifetime and acquires no resource.
88
- * @example
89
- * ```ts
90
- * import { Effect } from "effect"
91
- * import * as Slider from "@typed/ui/Slider"
57
+ /**
58
+ * Assigns a range value without clamping or snapping it.
92
59
  *
93
- * const program = Effect.gen(function* () {
94
- * const state = yield* Slider.makeState({ value: 25 })
95
- * yield* Slider.setValue(state, 50)
96
- * })
97
- * ```
60
+ * @remarks
61
+ * min, max, and step belong to the native input options and are not consulted here. Validate or
62
+ * normalize programmatic values before assignment so the subject and browser-sanitized range
63
+ * value stay consistent.
98
64
  * @since 1.0.0
99
- * @category state
65
+ * @category State transitions
100
66
  */
101
67
  export declare function setValue<E, R>(state: RefSubject.RefSubject<State, E, R>, value: number): Effect.Effect<State, E, R>;
102
- /** Options for a native range input.
103
- * @remarks
104
- * ## Why
105
- * Native range semantics provide keyboard and accessibility behavior while
106
- * Typed synchronizes renderer-independent state.
107
- * ## Ownership and lifetime
108
- * Options are inert; the mounted component owns subscriptions by Scope.
109
- * @since 1.0.0
110
- * @category models
68
+ /**
111
69
  */
112
70
  export interface SliderOptions extends Dom.HostOptions<HTMLInputElement> {
113
- /** Hydrated state synchronized to the input.
114
- * @remarks
115
- * ## Why
116
- * One source serves SSR, UI, and state-only tests.
117
- * ## Ownership and lifetime
118
- * The component borrows state and subscribes only while mounted.
71
+ /**
72
+ * Hydrated state synchronized to the input.
119
73
  * @since 1.0.0
120
- * @category state
74
+ * @category State connection
121
75
  */
122
76
  readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
123
- /** Native minimum value.
124
- * @remarks
125
- * ## Why
126
- * The platform uses this bound for keyboard and constraint behavior.
127
- * ## Ownership and lifetime
128
- * Dynamic attributes follow the component Scope.
77
+ /**
78
+ * Native minimum value.
129
79
  * @since 1.0.0
130
- * @category attributes
80
+ * @category Numeric bounds
131
81
  */
132
82
  readonly min?: Renderable.Any<number | null | undefined>;
133
- /** Native maximum value.
134
- * @remarks
135
- * ## Why
136
- * The platform uses this bound for keyboard and constraint behavior.
137
- * ## Ownership and lifetime
138
- * Dynamic attributes follow the component Scope.
83
+ /**
84
+ * Native maximum value.
139
85
  * @since 1.0.0
140
- * @category attributes
86
+ * @category Numeric bounds
141
87
  */
142
88
  readonly max?: Renderable.Any<number | null | undefined>;
143
- /** Native step value or `"any"`.
144
- * @remarks
145
- * ## Why
146
- * Step semantics remain delegated to the input element.
147
- * ## Ownership and lifetime
148
- * Dynamic attributes follow the component Scope.
89
+ /**
90
+ * Native step value or `"any"`.
149
91
  * @since 1.0.0
150
- * @category attributes
92
+ * @category Numeric bounds
151
93
  */
152
94
  readonly step?: Renderable.Any<number | "any" | null | undefined>;
153
95
  }
@@ -162,26 +104,37 @@ declare function internalProps<const Options extends SliderOptions>(options: Opt
162
104
  readonly ref: RefSubject.HydratedRefSubject<State, Schema.SchemaError, never, never>;
163
105
  };
164
106
  type SliderInternalProps<Options extends SliderOptions> = ReturnType<ReturnType<typeof internalProps<Options>>>;
165
- /** Renders a native range input synchronized with hydrated state.
107
+ /**
108
+ * Renders a native range input whose input events update numeric state.
109
+ *
166
110
  * @remarks
167
- * ## Why
168
- * Browser pointer, keyboard, constraints, and accessibility remain intact;
169
- * input events update the same RefSubject consumed elsewhere.
170
- * ## Ownership and lifetime
171
- * Running the Fx owns native listeners and subscriptions in its Scope. A
172
- * custom host must preserve type, value, range props, and the hydration ref.
111
+ * Dragging publishes through input, so expensive downstream work should control its own update
112
+ * rate. Native min/max/step, keyboard interaction, and pointer behavior stay with the browser.
113
+ * Supply a label and a unit-bearing readout; a custom non-input host must implement the
114
+ * interaction itself.
115
+ *
173
116
  * @example
174
117
  * ```ts
175
- * import { Effect } from "effect"
176
- * import * as Slider from "@typed/ui/Slider"
118
+ * import { RefSubject } from "@typed/fx";
119
+ * import { html } from "@typed/template";
120
+ * import { component } from "@typed/ui/Component";
121
+ * import * as Slider from "@typed/ui/Slider";
177
122
  *
178
- * const program = Effect.gen(function* () {
179
- * const state = yield* Slider.makeState({ value: 50 })
180
- * return Slider.Slider({ state, min: 0, max: 100 })
181
- * })
123
+ * export const ZoomControl = component(function* () {
124
+ * const state = yield* Slider.makeState({ value: 100 });
125
+ * const percentage = RefSubject.map(state, ({ value }) => `${value}%`);
126
+ * return html`<div class="zoom-control">
127
+ * <label for="preview-zoom">Preview zoom</label>
128
+ * ${Slider.Slider({
129
+ * state, min: 50, max: 200, step: 10,
130
+ * props: { id: "preview-zoom", name: "zoom", "aria-valuetext": percentage },
131
+ * })}
132
+ * <output for="preview-zoom">${percentage}</output>
133
+ * </div>`;
134
+ * });
182
135
  * ```
183
136
  * @since 1.0.0
184
- * @category components
137
+ * @category Native controls
185
138
  */
186
139
  export declare function Slider<const Options extends SliderOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, SliderInternalProps<Options>>, "", Host>): import("./Dom/Types.js").HostComponent<Host | Options>;
187
140
  export {};