@typed/ui 1.0.0-beta.5 → 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/TreeGrid.js CHANGED
@@ -8,6 +8,8 @@
8
8
  * the state and pure operations without mounting UI, or supply custom hosts without replacing native
9
9
  * events and browser-owned focus.
10
10
  *
11
+ * Learn the interaction in the [TreeGrid guide](/explore/ui-tree-grid).
12
+ *
11
13
  * @since 1.0.0
12
14
  * @category modules
13
15
  * @packageDocumentation
@@ -23,15 +25,6 @@ import * as Tree from "./Tree.js";
23
25
  * Effect Schema used by makeState to encode, decode, and hydrate TreeGrid state.
24
26
  *
25
27
  * @remarks
26
- * ## Why
27
- *
28
- * A public schema makes hydration and serialized state use the same runtime validation as direct
29
- * construction.
30
- *
31
- * ## Ownership and lifetime
32
- *
33
- * This declaration is data or schema metadata and acquires no resources.
34
- *
35
28
  * @example
36
29
  * ```ts
37
30
  * import * as Schema from "effect/Schema";
@@ -40,19 +33,13 @@ import * as Tree from "./Tree.js";
40
33
  * const decodeState = Schema.decodeUnknownEffect(TreeGrid.StateSchema);
41
34
  * ```
42
35
  * @since 1.0.0
43
- * @category schemas
36
+ * @category Hierarchy and cell focus
44
37
  */
45
38
  export const StateSchema = Tree.StateSchema;
46
39
  /**
47
40
  * Creates hydrated TreeGrid state. Uses Tree state and defaults.
48
41
  *
49
42
  * @remarks
50
- * ## Why
51
- *
52
- * State and collection ownership can be composed and tested independently from any renderer.
53
- *
54
- * ## Ownership and lifetime
55
- *
56
43
  * The returned Effect creates the RefSubject when run. That state is renderer-independent;
57
44
  * collection registrations belong to the separate Scope that runs register or ref, not to state
58
45
  * creation.
@@ -71,7 +58,7 @@ export const StateSchema = Tree.StateSchema;
71
58
  * );
72
59
  * ```
73
60
  * @since 1.0.0
74
- * @category constructors
61
+ * @category Hierarchy and cell focus
75
62
  */
76
63
  export const makeState = Tree.makeState;
77
64
  /**
@@ -79,13 +66,9 @@ export const makeState = Tree.makeState;
79
66
  * the TreeGrid entrypoint.
80
67
  *
81
68
  * @remarks
82
- * ## Why
83
- *
84
69
  * Separating this deterministic policy from event wiring lets applications test it directly and
85
70
  * reuse it in custom composites.
86
71
  *
87
- * ## Ownership and lifetime
88
- *
89
72
  * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
90
73
  * state, event, or DOM.
91
74
  *
@@ -96,89 +79,46 @@ export const makeState = Tree.makeState;
96
79
  * const expanded = TreeGrid.isExpanded({ activeId: null, expandedIds: ["parent"], loop: true }, "parent");
97
80
  * ```
98
81
  * @since 1.0.0
99
- * @category combinators
82
+ * @category Row expansion
100
83
  */
101
84
  export const isExpanded = Tree.isExpanded;
102
85
  /**
103
86
  * Adds a row id once to expandedIds using the Tree state transition.
104
87
  *
105
88
  * @remarks
106
- * ## Why
107
- *
108
89
  * The operation exposes TreeGrid's transition directly so callers can compose it in Effect
109
90
  * programs and native event handlers.
110
91
  *
111
- * ## Ownership and lifetime
112
- *
113
- * The returned Effect performs the update or DOM side effect only when run, preserves the declared
114
- * error and service channels, and retains no resources after completion.
115
- *
116
- * ## Example
117
- *
118
- * Import with `import { expand } from "@typed/ui/TreeGrid";` Extend the [TreeGrid.makeState
119
- * runnable setup](/reference/%40typed%2Fui%2FTreeGrid%23makeState). Inside the linked Effect
120
- * program run `yield* expand(state, "parent")`, then read state to observe the id in expandedIds.
121
92
  * @since 1.0.0
122
- * @category combinators
93
+ * @category Row expansion
123
94
  */
124
95
  export const expand = Tree.expand;
125
96
  /**
126
97
  * Removes a row id from expandedIds using the Tree state transition.
127
98
  *
128
99
  * @remarks
129
- * ## Why
130
- *
131
100
  * The operation exposes TreeGrid's transition directly so callers can compose it in Effect
132
101
  * programs and native event handlers.
133
102
  *
134
- * ## Ownership and lifetime
135
- *
136
- * The returned Effect performs the update or DOM side effect only when run, preserves the declared
137
- * error and service channels, and retains no resources after completion.
138
- *
139
- * ## Example
140
- *
141
- * Import with `import { collapse } from "@typed/ui/TreeGrid";` Extend the [TreeGrid.makeState
142
- * runnable setup](/reference/%40typed%2Fui%2FTreeGrid%23makeState). Inside the linked Effect
143
- * program run `yield* collapse(state, "parent")`, then read state to observe the id removed from
144
- * expandedIds.
145
103
  * @since 1.0.0
146
- * @category combinators
104
+ * @category Row expansion
147
105
  */
148
106
  export const collapse = Tree.collapse;
149
107
  /**
150
108
  * Sets the active TreeGrid row or cell id without changing expansion.
151
109
  *
152
110
  * @remarks
153
- * ## Why
154
- *
155
111
  * The operation exposes TreeGrid's transition directly so callers can compose it in Effect
156
112
  * programs and native event handlers.
157
113
  *
158
- * ## Ownership and lifetime
159
- *
160
- * The returned Effect performs the update or DOM side effect only when run, preserves the declared
161
- * error and service channels, and retains no resources after completion.
162
- *
163
- * ## Example
164
- *
165
- * Import with `import { activate } from "@typed/ui/TreeGrid";` Extend the [TreeGrid.makeState
166
- * runnable setup](/reference/%40typed%2Fui%2FTreeGrid%23makeState). Inside the linked Effect
167
- * program run `yield* activate(state, "cell-1")`, then read state to observe activeId.
168
114
  * @since 1.0.0
169
- * @category combinators
115
+ * @category Hierarchy and cell focus
170
116
  */
171
117
  export const activate = Tree.activate;
172
118
  /**
173
119
  * Creates a scoped Collection for TreeGrid items.
174
120
  *
175
121
  * @remarks
176
- * ## Why
177
- *
178
- * State and collection ownership can be composed and tested independently from any renderer.
179
- *
180
- * ## Ownership and lifetime
181
- *
182
122
  * The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
183
123
  * owned by the Scope that runs register, independently of this construction Effect.
184
124
  *
@@ -195,7 +135,7 @@ export const activate = Tree.activate;
195
135
  * );
196
136
  * ```
197
137
  * @since 1.0.0
198
- * @category constructors
138
+ * @category Cell registration
199
139
  */
200
140
  export const makeCollection = Collection.makeState;
201
141
  function rootInternalProps(options) {
@@ -226,25 +166,12 @@ function rootInternalProps(options) {
226
166
  * Renders the focus-owning treegrid root and applies combined grid and expansion keys.
227
167
  *
228
168
  * @remarks
229
- * ## Why
230
- *
231
- * The component applies the family behavior while leaving callers free to supply a custom host
232
- * through the shared DOM boundary.
233
- *
234
- * ## Ownership and lifetime
235
- *
236
169
  * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
237
170
  * collection registrations only when rendered. The rendering Scope removes those resources;
238
171
  * unrelated nodes and attributes remain caller-owned.
239
172
  *
240
- * ## Example
241
- *
242
- * Import with `import { Root } from "@typed/ui/TreeGrid";` Extend the [TreeGrid.makeState runnable
243
- * setup](/reference/%40typed%2Fui%2FTreeGrid%23makeState). Replace the linked program's final
244
- * snapshot read with `Root({ state, label: "Files", content: "Rows" })`; render that Fx before the
245
- * same Scope closes.
246
173
  * @since 1.0.0
247
- * @category components
174
+ * @category Treegrid surface
248
175
  */
249
176
  export function Root(options, host) {
250
177
  return Dom.renderHost()(options, host, rootInternalProps(options), options.content, (props, content) => {
@@ -266,25 +193,12 @@ function rowInternalProps(options) {
266
193
  * Renders a hierarchical row with level and optional expanded state.
267
194
  *
268
195
  * @remarks
269
- * ## Why
270
- *
271
- * The component applies the family behavior while leaving callers free to supply a custom host
272
- * through the shared DOM boundary.
273
- *
274
- * ## Ownership and lifetime
275
- *
276
196
  * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
277
197
  * collection registrations only when rendered. The rendering Scope removes those resources;
278
198
  * unrelated nodes and attributes remain caller-owned.
279
199
  *
280
- * ## Example
281
- *
282
- * Import with `import { Row } from "@typed/ui/TreeGrid";` Extend the [TreeGrid.makeState runnable
283
- * setup](/reference/%40typed%2Fui%2FTreeGrid%23makeState). Replace the linked program's final
284
- * snapshot read with `Row({ state, rowId: "src", content: "Cells" })`; render that Fx before the
285
- * same Scope closes.
286
200
  * @since 1.0.0
287
- * @category components
201
+ * @category Hierarchical rows
288
202
  */
289
203
  export function Row(options, host) {
290
204
  return Dom.renderHost()(options, host, rowInternalProps(options), options.content, (props, content) => html `<div ...${props}>${content}</div>`);
@@ -315,25 +229,12 @@ function cellInternalProps(options) {
315
229
  * Renders and optionally registers one gridcell with row and column coordinates.
316
230
  *
317
231
  * @remarks
318
- * ## Why
319
- *
320
- * The component applies the family behavior while leaving callers free to supply a custom host
321
- * through the shared DOM boundary.
322
- *
323
- * ## Ownership and lifetime
324
- *
325
232
  * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
326
233
  * collection registrations only when rendered. The rendering Scope removes those resources;
327
234
  * unrelated nodes and attributes remain caller-owned.
328
235
  *
329
- * ## Example
330
- *
331
- * Import with `import { Cell } from "@typed/ui/TreeGrid";` Extend the [TreeGrid.makeState runnable
332
- * setup](/reference/%40typed%2Fui%2FTreeGrid%23makeState). Replace the linked program's final
333
- * snapshot read with `Cell({ state, id: "src-name", rowId: "src", columnIndex: 1, content: "src"
334
- * })`; render that Fx before the same Scope closes.
335
236
  * @since 1.0.0
336
- * @category components
237
+ * @category Navigable cells
337
238
  */
338
239
  export function Cell(options, host) {
339
240
  return Dom.renderHost()(options, host, cellInternalProps(options), options.content, (props, content) => {
@@ -350,25 +251,12 @@ function groupInternalProps(options) {
350
251
  * Renders a rowgroup and hides it while its parent row is collapsed.
351
252
  *
352
253
  * @remarks
353
- * ## Why
354
- *
355
- * The component applies the family behavior while leaving callers free to supply a custom host
356
- * through the shared DOM boundary.
357
- *
358
- * ## Ownership and lifetime
359
- *
360
254
  * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
361
255
  * collection registrations only when rendered. The rendering Scope removes those resources;
362
256
  * unrelated nodes and attributes remain caller-owned.
363
257
  *
364
- * ## Example
365
- *
366
- * Import with `import { Group } from "@typed/ui/TreeGrid";` Extend the [TreeGrid.makeState runnable
367
- * setup](/reference/%40typed%2Fui%2FTreeGrid%23makeState). Replace the linked program's final
368
- * snapshot read with `Group({ state, parentId: "src", content: "Rows" })`; render that Fx before
369
- * the same Scope closes.
370
258
  * @since 1.0.0
371
- * @category components
259
+ * @category Child row visibility
372
260
  */
373
261
  export function Group(options, host) {
374
262
  return Dom.renderHost()(options, host, groupInternalProps(options), options.content, (props, content) => html `<div ...${props}>${content}</div>`);
@@ -1,29 +1,26 @@
1
+ /**
2
+ * Text clipped visually but retained for accessible names and descriptions.
3
+ * The clipping style has no focus-reveal behavior and must not hide interactive descendants.
4
+ *
5
+ * Read the [VisuallyHidden guide](/explore/ui-visually-hidden) for a complete example.
6
+ *
7
+ * [Platform reference](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden).
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 content hidden visually but retained for assistive technology.
8
- * @remarks
9
- * ## Why
10
- * Some controls need an accessible name or instruction that should not alter
11
- * the visual layout.
12
- * ## Ownership and lifetime
13
- * The options are inert; dynamic content follows the rendered Scope.
14
- * @since 1.0.0
15
- * @category models
16
18
  */
17
19
  export interface VisuallyHiddenOptions extends Dom.HostOptions<HTMLSpanElement> {
18
- /** Content retained in the document and accessibility tree.
19
- * @remarks
20
- * ## Why
21
- * Unlike `hidden` or `display: none`, clipped content remains perceivable to
22
- * screen readers.
23
- * ## Ownership and lifetime
24
- * Dynamic content is released when the component Scope closes.
20
+ /**
21
+ * Content retained in the document and accessibility tree.
25
22
  * @since 1.0.0
26
- * @category content
23
+ * @category Rendered content
27
24
  */
28
25
  readonly content: Renderable.Any;
29
26
  }
@@ -32,22 +29,39 @@ declare function internalProps(): {
32
29
  };
33
30
  type VisuallyHiddenInternalProps = ReturnType<typeof internalProps>;
34
31
  /**
35
- * Renders screen-reader-accessible content with standard clipping styles.
32
+ * Clips text visually while retaining it for accessible naming and reading.
33
+ *
36
34
  * @remarks
37
- * ## Why
38
- * The primitive supplies a tested visual-hiding recipe without removing the
39
- * node from semantic layout or the accessibility tree.
40
- * ## Ownership and lifetime
41
- * Running the Fx owns the rendered span and dynamic content in its Effect
42
- * Scope. A custom host must preserve the supplied clipping styles.
35
+ * The span uses absolute positioning and a one-pixel clipping recipe. It has no focus-reveal
36
+ * behavior: do not hide interactive controls or use it alone as a skip link. An aria-hidden
37
+ * ancestor still removes its content from accessibility exposure. Custom hosts must preserve the
38
+ * supplied style.
39
+ *
43
40
  * @example
44
41
  * ```ts
45
- * import { VisuallyHidden } from "@typed/ui/VisuallyHidden"
42
+ * import { RefSubject } from "@typed/fx";
43
+ * import { html } from "@typed/template";
44
+ * import { Button } from "@typed/ui/Button";
45
+ * import { component } from "@typed/ui/Component";
46
+ * import { VisuallyHidden } from "@typed/ui/VisuallyHidden";
46
47
  *
47
- * const label = VisuallyHidden({ content: "Open navigation" })
48
+ * export const ResetCounter = component(function* () {
49
+ * const count = yield* RefSubject.make(3);
50
+ * return html`<div>
51
+ * <p>Selected items: ${count}</p>
52
+ * ${Button({
53
+ * content: html`
54
+ * <span aria-hidden="true">×</span>
55
+ * ${VisuallyHidden({ content: "Clear selection" })}
56
+ * `,
57
+ * props: { class: "icon-action" },
58
+ * onclick: RefSubject.set(count, 0),
59
+ * })}
60
+ * </div>`;
61
+ * });
48
62
  * ```
49
63
  * @since 1.0.0
50
- * @category components
64
+ * @category Structure and naming
51
65
  */
52
66
  export declare function VisuallyHidden<const Options extends VisuallyHiddenOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, VisuallyHiddenInternalProps>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
53
67
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"VisuallyHidden.d.ts","sourceRoot":"","sources":["../src/VisuallyHidden.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;AAKjD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,qBAAsB,SAAQ,GAAG,CAAC,WAAW,CAAC,eAAe,CAAC;IAC7E;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC;CAClC;AAED,iBAAS,aAAa;;EAErB;AAED,KAAK,2BAA2B,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,KAAK,CAAC,OAAO,SAAS,qBAAqB,EAC3C,KAAK,CAAC,IAAI,SAAS,UAAU,GAAG,KAAK,EAErC,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,GAAG,CAAC,YAAY,CACrB,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,2BAA2B,CAAC,EACzD,OAAO,CAAC,SAAS,CAAC,EAClB,IAAI,CACL,GACA,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":"VisuallyHidden.d.ts","sourceRoot":"","sources":["../src/VisuallyHidden.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;AAKjD;GACG;AACH,MAAM,WAAW,qBAAsB,SAAQ,GAAG,CAAC,WAAW,CAAC,eAAe,CAAC;IAC7E;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC;CAClC;AAED,iBAAS,aAAa;;EAErB;AAED,KAAK,2BAA2B,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,cAAc,CAC5B,KAAK,CAAC,OAAO,SAAS,qBAAqB,EAC3C,KAAK,CAAC,IAAI,SAAS,UAAU,GAAG,KAAK,EAErC,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,GAAG,CAAC,YAAY,CACrB,GAAG,CAAC,eAAe,CAAC,OAAO,EAAE,2BAA2B,CAAC,EACzD,OAAO,CAAC,SAAS,CAAC,EAClB,IAAI,CACL,GACA,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"}
@@ -5,22 +5,39 @@ function internalProps() {
5
5
  return { style };
6
6
  }
7
7
  /**
8
- * Renders screen-reader-accessible content with standard clipping styles.
8
+ * Clips text visually while retaining it for accessible naming and reading.
9
+ *
9
10
  * @remarks
10
- * ## Why
11
- * The primitive supplies a tested visual-hiding recipe without removing the
12
- * node from semantic layout or the accessibility tree.
13
- * ## Ownership and lifetime
14
- * Running the Fx owns the rendered span and dynamic content in its Effect
15
- * Scope. A custom host must preserve the supplied clipping styles.
11
+ * The span uses absolute positioning and a one-pixel clipping recipe. It has no focus-reveal
12
+ * behavior: do not hide interactive controls or use it alone as a skip link. An aria-hidden
13
+ * ancestor still removes its content from accessibility exposure. Custom hosts must preserve the
14
+ * supplied style.
15
+ *
16
16
  * @example
17
17
  * ```ts
18
- * import { VisuallyHidden } from "@typed/ui/VisuallyHidden"
18
+ * import { RefSubject } from "@typed/fx";
19
+ * import { html } from "@typed/template";
20
+ * import { Button } from "@typed/ui/Button";
21
+ * import { component } from "@typed/ui/Component";
22
+ * import { VisuallyHidden } from "@typed/ui/VisuallyHidden";
19
23
  *
20
- * const label = VisuallyHidden({ content: "Open navigation" })
24
+ * export const ResetCounter = component(function* () {
25
+ * const count = yield* RefSubject.make(3);
26
+ * return html`<div>
27
+ * <p>Selected items: ${count}</p>
28
+ * ${Button({
29
+ * content: html`
30
+ * <span aria-hidden="true">×</span>
31
+ * ${VisuallyHidden({ content: "Clear selection" })}
32
+ * `,
33
+ * props: { class: "icon-action" },
34
+ * onclick: RefSubject.set(count, 0),
35
+ * })}
36
+ * </div>`;
37
+ * });
21
38
  * ```
22
39
  * @since 1.0.0
23
- * @category components
40
+ * @category Structure and naming
24
41
  */
25
42
  export function VisuallyHidden(options, host) {
26
43
  return Dom.renderHost()(options, host, internalProps, options.content, (props, content) => html `<span ...${props}>${content}</span>`);