@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.
Files changed (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +54 -10
  3. package/dist/Alert.d.ts +72 -0
  4. package/dist/Alert.d.ts.map +1 -0
  5. package/dist/Alert.js +40 -0
  6. package/dist/Button.d.ts +100 -0
  7. package/dist/Button.d.ts.map +1 -0
  8. package/dist/Button.js +42 -0
  9. package/dist/Carousel.d.ts +346 -0
  10. package/dist/Carousel.d.ts.map +1 -0
  11. package/dist/Carousel.js +264 -0
  12. package/dist/Checkbox.d.ts +168 -0
  13. package/dist/Checkbox.d.ts.map +1 -0
  14. package/dist/Checkbox.js +146 -0
  15. package/dist/Collection.d.ts +254 -0
  16. package/dist/Collection.d.ts.map +1 -0
  17. package/dist/Collection.js +218 -0
  18. package/dist/Combobox.d.ts +367 -0
  19. package/dist/Combobox.d.ts.map +1 -0
  20. package/dist/Combobox.js +300 -0
  21. package/dist/Composite.d.ts +823 -0
  22. package/dist/Composite.d.ts.map +1 -0
  23. package/dist/Composite.js +615 -0
  24. package/dist/Dialog.d.ts +544 -0
  25. package/dist/Dialog.d.ts.map +1 -0
  26. package/dist/Dialog.js +357 -0
  27. package/dist/Disclosure.d.ts +219 -0
  28. package/dist/Disclosure.d.ts.map +1 -0
  29. package/dist/Disclosure.js +128 -0
  30. package/dist/Dom/Events.d.ts +122 -0
  31. package/dist/Dom/Events.d.ts.map +1 -0
  32. package/dist/Dom/Events.js +192 -0
  33. package/dist/Dom/Props.d.ts +161 -0
  34. package/dist/Dom/Props.d.ts.map +1 -0
  35. package/dist/Dom/Props.js +110 -0
  36. package/dist/Dom/Refs.d.ts +58 -0
  37. package/dist/Dom/Refs.d.ts.map +1 -0
  38. package/dist/Dom/Refs.js +61 -0
  39. package/dist/Dom/Render.d.ts +59 -0
  40. package/dist/Dom/Render.d.ts.map +1 -0
  41. package/dist/Dom/Render.js +71 -0
  42. package/dist/Dom/Types.d.ts +570 -0
  43. package/dist/Dom/Types.d.ts.map +1 -0
  44. package/dist/Dom/Types.js +1 -0
  45. package/dist/Dom/index.d.ts +20 -0
  46. package/dist/Dom/index.d.ts.map +1 -0
  47. package/dist/Dom/index.js +8 -0
  48. package/dist/Dom.d.ts +14 -0
  49. package/dist/Dom.d.ts.map +1 -0
  50. package/dist/Dom.js +13 -0
  51. package/dist/Focusable.d.ts +85 -0
  52. package/dist/Focusable.d.ts.map +1 -0
  53. package/dist/Focusable.js +35 -0
  54. package/dist/Form.d.ts +1727 -0
  55. package/dist/Form.d.ts.map +1 -0
  56. package/dist/Form.js +1142 -0
  57. package/dist/Grid.d.ts +388 -0
  58. package/dist/Grid.d.ts.map +1 -0
  59. package/dist/Grid.js +284 -0
  60. package/dist/Group.d.ts +128 -0
  61. package/dist/Group.d.ts.map +1 -0
  62. package/dist/Group.js +71 -0
  63. package/dist/Heading.d.ts +87 -0
  64. package/dist/Heading.d.ts.map +1 -0
  65. package/dist/Heading.js +58 -0
  66. package/dist/Hovercard.d.ts +297 -0
  67. package/dist/Hovercard.d.ts.map +1 -0
  68. package/dist/Hovercard.js +188 -0
  69. package/dist/HttpRouter.d.ts +129 -6
  70. package/dist/HttpRouter.d.ts.map +1 -1
  71. package/dist/HttpRouter.js +198 -55
  72. package/dist/Link.d.ts +63 -28
  73. package/dist/Link.d.ts.map +1 -1
  74. package/dist/Link.js +84 -37
  75. package/dist/Listbox.d.ts +305 -0
  76. package/dist/Listbox.d.ts.map +1 -0
  77. package/dist/Listbox.js +245 -0
  78. package/dist/Menu.d.ts +663 -0
  79. package/dist/Menu.d.ts.map +1 -0
  80. package/dist/Menu.js +569 -0
  81. package/dist/Menubar.d.ts +249 -0
  82. package/dist/Menubar.d.ts.map +1 -0
  83. package/dist/Menubar.js +207 -0
  84. package/dist/Meter.d.ts +157 -0
  85. package/dist/Meter.d.ts.map +1 -0
  86. package/dist/Meter.js +87 -0
  87. package/dist/NativeDetails.d.ts +41 -0
  88. package/dist/NativeDetails.d.ts.map +1 -0
  89. package/dist/NativeDetails.js +40 -0
  90. package/dist/NativeDialog.d.ts +66 -0
  91. package/dist/NativeDialog.d.ts.map +1 -0
  92. package/dist/NativeDialog.js +88 -0
  93. package/dist/NativePopover.d.ts +43 -0
  94. package/dist/NativePopover.d.ts.map +1 -0
  95. package/dist/NativePopover.js +84 -0
  96. package/dist/Popover.d.ts +240 -0
  97. package/dist/Popover.d.ts.map +1 -0
  98. package/dist/Popover.js +140 -0
  99. package/dist/RadioGroup.d.ts +330 -0
  100. package/dist/RadioGroup.d.ts.map +1 -0
  101. package/dist/RadioGroup.js +241 -0
  102. package/dist/Role.d.ts +64 -0
  103. package/dist/Role.d.ts.map +1 -0
  104. package/dist/Role.js +27 -0
  105. package/dist/Select.d.ts +418 -0
  106. package/dist/Select.d.ts.map +1 -0
  107. package/dist/Select.js +357 -0
  108. package/dist/Separator.d.ts +58 -0
  109. package/dist/Separator.d.ts.map +1 -0
  110. package/dist/Separator.js +32 -0
  111. package/dist/Slider.d.ts +141 -0
  112. package/dist/Slider.d.ts.map +1 -0
  113. package/dist/Slider.js +101 -0
  114. package/dist/SpinButton.d.ts +141 -0
  115. package/dist/SpinButton.d.ts.map +1 -0
  116. package/dist/SpinButton.js +101 -0
  117. package/dist/Storybook.d.ts +76 -0
  118. package/dist/Storybook.d.ts.map +1 -0
  119. package/dist/Storybook.js +102 -0
  120. package/dist/Switch.d.ts +148 -0
  121. package/dist/Switch.d.ts.map +1 -0
  122. package/dist/Switch.js +110 -0
  123. package/dist/Tab.d.ts +26 -0
  124. package/dist/Tab.d.ts.map +1 -0
  125. package/dist/Tab.js +25 -0
  126. package/dist/Tabs.d.ts +411 -0
  127. package/dist/Tabs.d.ts.map +1 -0
  128. package/dist/Tabs.js +262 -0
  129. package/dist/Toolbar.d.ts +248 -0
  130. package/dist/Toolbar.d.ts.map +1 -0
  131. package/dist/Toolbar.js +187 -0
  132. package/dist/Tooltip.d.ts +296 -0
  133. package/dist/Tooltip.d.ts.map +1 -0
  134. package/dist/Tooltip.js +172 -0
  135. package/dist/Tree.d.ts +405 -0
  136. package/dist/Tree.d.ts.map +1 -0
  137. package/dist/Tree.js +333 -0
  138. package/dist/TreeGrid.d.ts +426 -0
  139. package/dist/TreeGrid.d.ts.map +1 -0
  140. package/dist/TreeGrid.js +308 -0
  141. package/dist/VisuallyHidden.d.ts +68 -0
  142. package/dist/VisuallyHidden.d.ts.map +1 -0
  143. package/dist/VisuallyHidden.js +44 -0
  144. package/dist/WindowSplitter.d.ts +336 -0
  145. package/dist/WindowSplitter.d.ts.map +1 -0
  146. package/dist/WindowSplitter.js +305 -0
  147. package/dist/index.d.ts +48 -0
  148. package/dist/index.d.ts.map +1 -1
  149. package/dist/index.js +48 -0
  150. package/package.json +48 -20
  151. package/src/HttpRouter.test.ts +0 -294
  152. package/src/HttpRouter.ts +0 -168
  153. package/src/Link.test.ts +0 -84
  154. package/src/Link.ts +0 -107
  155. package/src/index.ts +0 -2
@@ -0,0 +1,218 @@
1
+ /**
2
+ * Collection is the scoped registry shared by composite widgets. Registration order is not
3
+ * navigation order: byDomOrder reads the mounted nodes with compareDocumentPosition, and each
4
+ * register Effect removes its own item when that Effect's Scope closes.
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 Architecture overview
13
+ * @packageDocumentation
14
+ */
15
+ import * as Effect from "effect/Effect";
16
+ import * as Equal from "effect/Equal";
17
+ import * as Scope from "effect/Scope";
18
+ import { RefSubject } from "@typed/fx";
19
+ import * as Equivalence from "effect/Equivalence";
20
+ /**
21
+ * Creates hydrated Collection state. The collection starts with the supplied immutable item array,
22
+ * or empty.
23
+ *
24
+ * @remarks
25
+ * ## Why
26
+ *
27
+ * State and collection ownership can be composed and tested independently from any renderer.
28
+ *
29
+ * ## Ownership and lifetime
30
+ *
31
+ * The returned Effect creates the RefSubject when run. That state is renderer-independent;
32
+ * collection registrations belong to the separate Scope that runs register or ref, not to state
33
+ * creation.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import * as Effect from "effect/Effect";
38
+ * import * as Collection from "@typed/ui/Collection";
39
+ *
40
+ * const program = Effect.scoped(
41
+ * Effect.gen(function* () {
42
+ * const collection = yield* Collection.makeState<string>();
43
+ * return yield* collection;
44
+ * }),
45
+ * );
46
+ * ```
47
+ * @since 1.0.0
48
+ * @category Collection state
49
+ */
50
+ export function makeState(initial = []) {
51
+ // DOM elements are runtime handles; structural equality would traverse browser internals.
52
+ return RefSubject.make(initial, { eq: Equivalence.Array(itemEquivalence()) });
53
+ }
54
+ /**
55
+ * Upserts an item immediately and installs a finalizer in the Scope that runs this Effect; the
56
+ * finalizer removes only that exact registration.
57
+ *
58
+ * @remarks
59
+ * ## Why
60
+ *
61
+ * The operation exposes Collection's transition directly so callers can compose it in Effect
62
+ * programs and native event handlers.
63
+ *
64
+ * ## Ownership and lifetime
65
+ *
66
+ * Registration is owned by the Scope in which the registration Effect runs. Closing that Scope
67
+ * removes the exact registered item; creating the collection or state does not own this cleanup.
68
+ *
69
+ * ## Example
70
+ *
71
+ * Import with `import { register } from "@typed/ui/Collection";` Extend the [Collection.makeState
72
+ * runnable setup](/reference/%40typed%2Fui%2FCollection%23makeState). Inside the linked Effect
73
+ * program invoke `yield* register(collection, { id: "save", value: "save" })`, then read the
74
+ * collection to observe the inserted item.
75
+ * @since 1.0.0
76
+ * @category Item registration
77
+ */
78
+ export function register(collection, item) {
79
+ return Effect.gen(function* () {
80
+ yield* RefSubject.update(collection, (items) => upsert(items, item)).pipe(Effect.asVoid);
81
+ const services = yield* Effect.context();
82
+ const scope = yield* Effect.scope;
83
+ yield* Scope.addFinalizer(scope, unregisterRegistered(collection, item).pipe(Effect.provide(services), Effect.ignore({ log: true })));
84
+ });
85
+ }
86
+ /**
87
+ * Registers a mounted element and removes it automatically with the Scope in which the returned
88
+ * Effect is run.
89
+ *
90
+ * @remarks
91
+ * ## Why
92
+ *
93
+ * The operation exposes Collection's transition directly so callers can compose it in Effect
94
+ * programs and native event handlers.
95
+ *
96
+ * ## Ownership and lifetime
97
+ *
98
+ * Registration is owned by the Scope in which the registration Effect runs. Closing that Scope
99
+ * removes the exact registered item; creating the collection or state does not own this cleanup.
100
+ *
101
+ * ## Example
102
+ *
103
+ * Import with `import { ref } from "@typed/ui/Collection";` Extend the [Collection.makeState
104
+ * runnable setup](/reference/%40typed%2Fui%2FCollection%23makeState). Inside the linked Effect
105
+ * program create `const attach = ref(collection, { id: "save", value: "save" })`, then run `yield*
106
+ * attach(document.createElement("button"))` and read the collection before Scope close.
107
+ * @since 1.0.0
108
+ * @category Item registration
109
+ */
110
+ export function ref(collection, item) {
111
+ return Effect.fn((element) => register(collection, { ...item, element }));
112
+ }
113
+ /**
114
+ * Removes every registered item with the supplied id and retains the remaining order.
115
+ *
116
+ * @remarks
117
+ * ## Why
118
+ *
119
+ * The operation exposes Collection's transition directly so callers can compose it in Effect
120
+ * programs and native event handlers.
121
+ *
122
+ * ## Ownership and lifetime
123
+ *
124
+ * The returned Effect performs the update or DOM side effect only when run, preserves the declared
125
+ * error and service channels, and retains no resources after completion.
126
+ *
127
+ * ## Example
128
+ *
129
+ * Import with `import { unregister } from "@typed/ui/Collection";` Extend the [Collection.makeState
130
+ * runnable setup](/reference/%40typed%2Fui%2FCollection%23makeState). Inside the linked Effect
131
+ * program first register `"save"`, run `yield* unregister(collection, "save")`, then read the
132
+ * collection to observe that only the matching id was removed.
133
+ * @since 1.0.0
134
+ * @category Item registration
135
+ */
136
+ export function unregister(collection, id) {
137
+ return RefSubject.update(collection, (items) => items.filter((item) => item.id !== id)).pipe(Effect.asVoid);
138
+ }
139
+ /**
140
+ * Returns a new array excluding only items whose disabled flag is exactly true.
141
+ *
142
+ * @remarks
143
+ * ## Why
144
+ *
145
+ * Separating this deterministic policy from event wiring lets applications test it directly and
146
+ * reuse it in custom composites.
147
+ *
148
+ * ## Ownership and lifetime
149
+ *
150
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
151
+ * state, event, or DOM.
152
+ *
153
+ * @example
154
+ * ```ts
155
+ * import * as Collection from "@typed/ui/Collection";
156
+ *
157
+ * const enabled = Collection.enabledItems([{ id: "a" }, { id: "b", disabled: true }]);
158
+ * ```
159
+ * @since 1.0.0
160
+ * @category Collection ordering
161
+ */
162
+ export function enabledItems(items) {
163
+ return items.filter((item) => item.disabled !== true);
164
+ }
165
+ /**
166
+ * Returns a sorted copy using compareDocumentPosition; items without comparable mounted elements
167
+ * retain an equivalent ordering position.
168
+ *
169
+ * @remarks
170
+ * ## Why
171
+ *
172
+ * Separating this deterministic policy from event wiring lets applications test it directly and
173
+ * reuse it in custom composites.
174
+ *
175
+ * ## Ownership and lifetime
176
+ *
177
+ * This is a synchronous calculation. It acquires no resources and does not mutate the input array,
178
+ * state, event, or DOM.
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * import * as Collection from "@typed/ui/Collection";
183
+ *
184
+ * const ordered = Collection.byDomOrder([{ id: "body", element: document.body }]);
185
+ * ```
186
+ * @since 1.0.0
187
+ * @category Collection ordering
188
+ */
189
+ export function byDomOrder(items) {
190
+ return items.toSorted((left, right) => {
191
+ if (left.element === undefined || right.element === undefined)
192
+ return 0;
193
+ const compareDocumentPosition = Reflect.get(left.element, "compareDocumentPosition");
194
+ if (typeof compareDocumentPosition !== "function")
195
+ return 0;
196
+ const position = compareDocumentPosition.call(left.element, right.element);
197
+ if (position & 2)
198
+ return 1;
199
+ if (position & 4)
200
+ return -1;
201
+ return 0;
202
+ });
203
+ }
204
+ function unregisterRegistered(collection, item) {
205
+ return RefSubject.update(collection, (items) => items.filter((current) => current.id !== item.id || current !== item)).pipe(Effect.asVoid);
206
+ }
207
+ function upsert(items, item) {
208
+ const index = items.findIndex((current) => current.id === item.id);
209
+ return index === -1 ? [...items, item] : items.toSpliced(index, 1, item);
210
+ }
211
+ function itemEquivalence() {
212
+ return Equivalence.make((left, right) => left.id === right.id &&
213
+ left.element === right.element &&
214
+ left.disabled === right.disabled &&
215
+ left.submenu === right.submenu &&
216
+ left.textValue === right.textValue &&
217
+ Equal.equals(left.value, right.value));
218
+ }
@@ -0,0 +1,367 @@
1
+ /**
2
+ * Combobox keeps focus on its native input and exposes the active option through
3
+ * aria-activedescendant. Input, a manual native popover, and options share explicit value, open,
4
+ * and active state.
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 [Combobox guide](/explore/ui-combobox).
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 Composite from "./Composite.js";
25
+ import * as Dom from "./Dom.js";
26
+ import type { HostResult } from "./Dom/Types.js";
27
+ /**
28
+ * Editable query text, popup visibility, and the active suggestion identity.
29
+ * `value` can contain unmatched text; active suggestion focus does not validate a domain choice.
30
+ *
31
+ * @since 1.0.0
32
+ * @category Query and popup state
33
+ */
34
+ export interface State extends Omit<Composite.State, "orientation"> {
35
+ /**
36
+ * Axis used to interpret Arrow-key movement.
37
+ * @since 1.0.0
38
+ * @category Keyboard navigation
39
+ */
40
+ readonly orientation: "vertical";
41
+ /**
42
+ * Stable id used for collection identity and ARIA relationships.
43
+ * @since 1.0.0
44
+ * @category Identity and relationships
45
+ */
46
+ readonly id: string;
47
+ /**
48
+ * Current semantic value selected or edited by the widget.
49
+ * @since 1.0.0
50
+ * @category Current value
51
+ */
52
+ readonly value: string;
53
+ /**
54
+ * Whether the associated native popover is open.
55
+ * @since 1.0.0
56
+ * @category Popup visibility
57
+ */
58
+ readonly open: boolean;
59
+ }
60
+ /**
61
+ * Initial Combobox values. value defaults to an empty string, open to false, activeId to null,
62
+ * loop to true, and virtual focus is enabled.
63
+ *
64
+ * @since 1.0.0
65
+ * @category Query and popup state
66
+ */
67
+ export interface InitialState {
68
+ /**
69
+ * Stable id used for collection identity and ARIA relationships.
70
+ * @since 1.0.0
71
+ * @category Identity and relationships
72
+ */
73
+ readonly id: string;
74
+ /**
75
+ * Current semantic value selected or edited by the widget.
76
+ * @since 1.0.0
77
+ * @category Current value
78
+ */
79
+ readonly value?: string;
80
+ /**
81
+ * Whether the associated native popover is open.
82
+ * @since 1.0.0
83
+ * @category Popup visibility
84
+ */
85
+ readonly open?: boolean;
86
+ /**
87
+ * Id currently active for keyboard navigation; null means no active item.
88
+ * @since 1.0.0
89
+ * @category Keyboard focus
90
+ */
91
+ readonly activeId?: string | null;
92
+ /**
93
+ * Whether movement wraps between the first and last enabled items.
94
+ * @since 1.0.0
95
+ * @category Keyboard navigation
96
+ */
97
+ readonly loop?: boolean;
98
+ }
99
+ /**
100
+ * Effect Schema used by makeState to encode, decode, and hydrate Combobox state.
101
+ *
102
+ * @remarks
103
+ * @example
104
+ * ```ts
105
+ * import * as Schema from "effect/Schema";
106
+ * import * as Combobox from "@typed/ui/Combobox";
107
+ *
108
+ * const decodeState = Schema.decodeUnknownEffect(Combobox.StateSchema);
109
+ * ```
110
+ * @since 1.0.0
111
+ * @category Query and popup state
112
+ */
113
+ export declare const StateSchema: Schema.Struct<{
114
+ readonly id: Schema.String;
115
+ readonly value: Schema.String;
116
+ readonly open: Schema.Boolean;
117
+ readonly activeId: Schema.NullOr<Schema.String>;
118
+ readonly orientation: Schema.Literals<readonly ["vertical"]>;
119
+ readonly loop: Schema.Boolean;
120
+ readonly rtl: Schema.Boolean;
121
+ readonly virtualFocus: Schema.Boolean;
122
+ }>;
123
+ /**
124
+ * Creates hydrated Combobox state. value defaults to an empty string, open to false, activeId to
125
+ * null, loop to true, and virtual focus is enabled.
126
+ *
127
+ * @remarks
128
+ * The returned Effect creates the RefSubject when run. That state is renderer-independent;
129
+ * collection registrations belong to the separate Scope that runs register or ref, not to state
130
+ * creation.
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * import * as Effect from "effect/Effect";
135
+ * import * as Combobox from "@typed/ui/Combobox";
136
+ *
137
+ * const program = Effect.scoped(
138
+ * Effect.gen(function* () {
139
+ * const state = yield* Combobox.makeState({ id: "city" });
140
+ * const collection = yield* Combobox.makeCollection();
141
+ * return { state: yield* state, collection: yield* collection };
142
+ * }),
143
+ * );
144
+ * ```
145
+ * @since 1.0.0
146
+ * @category Query and popup state
147
+ */
148
+ export declare function makeState(initial: InitialState): Effect.Effect<RefSubject.HydratedRefSubject<{
149
+ readonly id: string;
150
+ readonly value: string;
151
+ readonly open: boolean;
152
+ readonly activeId: string | null;
153
+ readonly orientation: "vertical";
154
+ readonly loop: boolean;
155
+ readonly rtl: boolean;
156
+ readonly virtualFocus: boolean;
157
+ }, Schema.SchemaError, never, never>, never, Scope.Scope>;
158
+ /**
159
+ * Creates a scoped Collection for Combobox items.
160
+ *
161
+ * @remarks
162
+ * The returned Effect allocates the RefSubject in the caller's Scope. Each later registration is
163
+ * owned by the Scope that runs register, independently of this construction Effect.
164
+ *
165
+ * @example
166
+ * ```ts
167
+ * import * as Effect from "effect/Effect";
168
+ * import * as Combobox from "@typed/ui/Combobox";
169
+ *
170
+ * const program = Effect.scoped(
171
+ * Effect.gen(function* () {
172
+ * const collection = yield* Combobox.makeCollection();
173
+ * return yield* collection;
174
+ * }),
175
+ * );
176
+ * ```
177
+ * @since 1.0.0
178
+ * @category Suggestion registration
179
+ */
180
+ export declare const makeCollection: (initial?: Collection.State<string, Element>) => Effect.Effect<RefSubject.RefSubject<Collection.State<string, Element>, never, never>, never, Scope.Scope>;
181
+ /**
182
+ * Stores the input value, clears activeId, and opens the popup in one state update.
183
+ *
184
+ * @remarks
185
+ * The operation exposes Combobox's transition directly so callers can compose it in Effect
186
+ * programs and native event handlers.
187
+ *
188
+ * @since 1.0.0
189
+ * @category Query and popup state
190
+ */
191
+ export declare function setValue<E, R>(state: RefSubject.RefSubject<State, E, R>, value: string): Effect.Effect<State, E, R>;
192
+ /**
193
+ * Inputs accepted by Combobox.Input in addition to the shared DOM host options.
194
+ *
195
+ * @since 1.0.0
196
+ * @category Editable input
197
+ */
198
+ export interface InputOptions extends Dom.HostOptions<HTMLInputElement> {
199
+ /**
200
+ * Renderer-independent RefSubject state consumed by this component or operation.
201
+ * @since 1.0.0
202
+ * @category State connection
203
+ */
204
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
205
+ /**
206
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
207
+ * @since 1.0.0
208
+ * @category Item registration
209
+ */
210
+ readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
211
+ /**
212
+ * Native input placeholder text.
213
+ * @since 1.0.0
214
+ * @category Input prompt
215
+ */
216
+ readonly placeholder?: string;
217
+ }
218
+ declare function inputProps<const Options extends InputOptions>(options: Options): () => {
219
+ readonly id: RefSubject.Computed<string, Schema.SchemaError, never>;
220
+ readonly role: "combobox";
221
+ readonly "aria-autocomplete": "list";
222
+ readonly "aria-controls": RefSubject.Computed<string, Schema.SchemaError, never>;
223
+ readonly "aria-expanded": RefSubject.Computed<boolean, Schema.SchemaError, never>;
224
+ readonly "aria-activedescendant": RefSubject.Computed<string | undefined, Schema.SchemaError, never>;
225
+ readonly placeholder: string | undefined;
226
+ readonly ".value": RefSubject.Computed<string, Schema.SchemaError, never>;
227
+ readonly oninput: EventHandler.EventHandler<Event, Schema.SchemaError, never>;
228
+ readonly onfocus: Effect.Effect<State, Schema.SchemaError, never>;
229
+ readonly onkeydown: EventHandler.EventHandler<KeyboardEvent, Schema.SchemaError, never> | undefined;
230
+ };
231
+ type InputProps<Options extends InputOptions> = ReturnType<ReturnType<typeof inputProps<Options>>>;
232
+ /**
233
+ * Renders the native combobox input, keeps its value property synchronized, opens on focus, and
234
+ * handles Arrow, Enter, and Escape when a collection is supplied.
235
+ *
236
+ * @remarks
237
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
238
+ * collection registrations only when rendered. The rendering Scope removes those resources;
239
+ * unrelated nodes and attributes remain caller-owned.
240
+ *
241
+ * @since 1.0.0
242
+ * @category Editable input
243
+ */
244
+ export declare function Input<const Options extends InputOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, InputProps<Options>>, "", Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
245
+ /**
246
+ * Inputs accepted by Combobox.Popover in addition to the shared DOM host options.
247
+ *
248
+ * @since 1.0.0
249
+ * @category Suggestion popup
250
+ */
251
+ export interface PopoverOptions extends Dom.HostOptions<HTMLDivElement> {
252
+ /**
253
+ * Renderer-independent RefSubject state consumed by this component or operation.
254
+ * @since 1.0.0
255
+ * @category State connection
256
+ */
257
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
258
+ /**
259
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
260
+ * @since 1.0.0
261
+ * @category Item registration
262
+ */
263
+ readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
264
+ /**
265
+ * Renderable child content for the component host.
266
+ * @since 1.0.0
267
+ * @category Rendered content
268
+ */
269
+ readonly content: Renderable.Any;
270
+ }
271
+ declare function popoverProps<const Options extends PopoverOptions>(options: Options): () => {
272
+ readonly id: RefSubject.Computed<string, Schema.SchemaError, never>;
273
+ readonly role: "listbox";
274
+ readonly "aria-labelledby": RefSubject.Computed<string, Schema.SchemaError, never>;
275
+ readonly popover: "manual";
276
+ readonly ontoggle: EventHandler.EventHandler<Event, Schema.SchemaError, never>;
277
+ readonly ref: import("./Dom/Refs.js").ComposedRef<RefSubject.HydratedRefSubject<State, Schema.SchemaError, never, never>, (element: HTMLElement) => Effect.Effect<void, Schema.SchemaError, Scope.Scope>> | undefined;
278
+ };
279
+ type PopoverProps<Options extends PopoverOptions> = ReturnType<ReturnType<typeof popoverProps<Options>>>;
280
+ /**
281
+ * Renders manual-popover listbox content, mirrors native toggle events into open state, and
282
+ * scrolls the selected option when opened.
283
+ *
284
+ * @remarks
285
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
286
+ * collection registrations only when rendered. The rendering Scope removes those resources;
287
+ * unrelated nodes and attributes remain caller-owned.
288
+ *
289
+ * @since 1.0.0
290
+ * @category Suggestion popup
291
+ */
292
+ export declare function Popover<const Options extends PopoverOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, PopoverProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
293
+ /**
294
+ * Inputs accepted by Combobox.Item in addition to the shared DOM host options.
295
+ *
296
+ * @since 1.0.0
297
+ * @category Suggestions
298
+ */
299
+ export interface ItemOptions extends Dom.HostOptions<HTMLDivElement> {
300
+ /**
301
+ * Renderer-independent RefSubject state consumed by this component or operation.
302
+ * @since 1.0.0
303
+ * @category State connection
304
+ */
305
+ readonly state: RefSubject.HydratedRefSubject<State, Schema.SchemaError>;
306
+ /**
307
+ * Item registry used for collection-driven keyboard behavior and mounted ordering.
308
+ * @since 1.0.0
309
+ * @category Item registration
310
+ */
311
+ readonly collection?: RefSubject.RefSubject<Collection.State<string>>;
312
+ /**
313
+ * Stable id used for collection identity and ARIA relationships.
314
+ * @since 1.0.0
315
+ * @category Identity and relationships
316
+ */
317
+ readonly id: string;
318
+ /**
319
+ * Current semantic value selected or edited by the widget.
320
+ * @since 1.0.0
321
+ * @category Current value
322
+ */
323
+ readonly value: string;
324
+ /**
325
+ * Renderable child content for the component host.
326
+ * @since 1.0.0
327
+ * @category Rendered content
328
+ */
329
+ readonly content: Renderable.Any;
330
+ /**
331
+ * Search text used by typeahead independently of rendered markup.
332
+ * @since 1.0.0
333
+ * @category Text matching
334
+ */
335
+ readonly textValue?: string;
336
+ /**
337
+ * Flag used by collection movement and widget handlers to skip activation by default.
338
+ * @since 1.0.0
339
+ * @category Availability
340
+ */
341
+ readonly disabled?: boolean;
342
+ }
343
+ declare function itemProps<const Options extends ItemOptions>(options: Options): () => {
344
+ readonly id: string;
345
+ readonly role: "option";
346
+ readonly "aria-selected": RefSubject.Computed<boolean, Schema.SchemaError, never>;
347
+ readonly "aria-disabled": boolean;
348
+ readonly tabindex: RefSubject.Computed<-1 | 0, Schema.SchemaError, never>;
349
+ readonly onclick: Effect.Effect<void, never, never> | Effect.Effect<State, Schema.SchemaError, never>;
350
+ readonly ref: ((element: Element & HTMLDivElement & RefSubject.HydrationElement) => Effect.Effect<void, any, any>) | undefined;
351
+ };
352
+ type ItemProps<Options extends ItemOptions> = ReturnType<ReturnType<typeof itemProps<Options>>>;
353
+ /**
354
+ * Renders and optionally registers one option; disabled options expose aria-disabled and do not
355
+ * select on click.
356
+ *
357
+ * @remarks
358
+ * The returned Fx installs DOM refs, native listeners, state subscriptions, and optional
359
+ * collection registrations only when rendered. The rendering Scope removes those resources;
360
+ * unrelated nodes and attributes remain caller-owned.
361
+ *
362
+ * @since 1.0.0
363
+ * @category Suggestions
364
+ */
365
+ export declare function Item<const Options extends ItemOptions, const Host extends HostResult = never>(options: Options, host?: Dom.HostOverride<Dom.RenderHostProps<Options, ItemProps<Options>>, Options["content"], Host>): Fx<RenderEvent, Renderable.Error<Options | Host>, Renderable.Services<Options | Host> | Scope.Scope | RenderTemplate>;
366
+ export {};
367
+ //# sourceMappingURL=Combobox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../src/Combobox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,MAAM,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