foldkit 0.82.9 → 0.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/devTools/overlay.d.ts.map +1 -1
- package/dist/devTools/overlay.js +66 -4
- package/dist/devTools/protocol.d.ts +19 -2
- package/dist/devTools/protocol.d.ts.map +1 -1
- package/dist/devTools/protocol.js +5 -2
- package/dist/devTools/serialize.d.ts.map +1 -1
- package/dist/devTools/serialize.js +2 -0
- package/dist/devTools/store.d.ts +5 -1
- package/dist/devTools/store.d.ts.map +1 -1
- package/dist/devTools/store.js +37 -1
- package/dist/devTools/webSocketBridge.js +1 -0
- package/dist/html/index.d.ts +11 -0
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +58 -39
- package/dist/mount/index.d.ts +14 -1
- package/dist/mount/index.d.ts.map +1 -1
- package/dist/mount/index.js +9 -1
- package/dist/mount/public.d.ts +1 -1
- package/dist/mount/public.d.ts.map +1 -1
- package/dist/mount/public.js +1 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +38 -3
- package/dist/scene/public.d.ts +2 -0
- package/dist/scene/public.d.ts.map +1 -0
- package/dist/scene/public.js +1 -0
- package/dist/story/public.d.ts +2 -0
- package/dist/story/public.d.ts.map +1 -0
- package/dist/story/public.js +1 -0
- package/dist/test/apps/mountPanel.d.ts +42 -0
- package/dist/test/apps/mountPanel.d.ts.map +1 -0
- package/dist/test/apps/mountPanel.js +76 -0
- package/dist/test/internal.d.ts +38 -0
- package/dist/test/internal.d.ts.map +1 -1
- package/dist/test/internal.js +75 -0
- package/dist/test/scene.d.ts +37 -14
- package/dist/test/scene.d.ts.map +1 -1
- package/dist/test/scene.js +141 -8
- package/dist/test/story.d.ts +17 -13
- package/dist/test/story.d.ts.map +1 -1
- package/dist/test/story.js +19 -5
- package/dist/ui/anchor.d.ts +6 -0
- package/dist/ui/anchor.d.ts.map +1 -1
- package/dist/ui/anchor.js +27 -16
- package/dist/ui/animation/index.d.ts +4 -4
- package/dist/ui/animation/index.d.ts.map +1 -1
- package/dist/ui/button/index.d.ts +6 -6
- package/dist/ui/button/index.d.ts.map +1 -1
- package/dist/ui/calendar/index.js +2 -2
- package/dist/ui/checkbox/index.d.ts +10 -10
- package/dist/ui/checkbox/index.d.ts.map +1 -1
- package/dist/ui/checkbox/index.js +2 -2
- package/dist/ui/combobox/multi.d.ts +18 -14
- package/dist/ui/combobox/multi.d.ts.map +1 -1
- package/dist/ui/combobox/multi.js +2 -2
- package/dist/ui/combobox/public.d.ts +1 -1
- package/dist/ui/combobox/public.d.ts.map +1 -1
- package/dist/ui/combobox/public.js +1 -1
- package/dist/ui/combobox/shared.d.ts +44 -13
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +27 -4
- package/dist/ui/combobox/single.d.ts +18 -14
- package/dist/ui/combobox/single.d.ts.map +1 -1
- package/dist/ui/combobox/single.js +2 -2
- package/dist/ui/datePicker/index.d.ts +1 -1
- package/dist/ui/datePicker/index.js +2 -2
- package/dist/ui/dialog/index.d.ts +8 -8
- package/dist/ui/dialog/index.d.ts.map +1 -1
- package/dist/ui/dialog/index.js +2 -2
- package/dist/ui/disclosure/index.d.ts +8 -8
- package/dist/ui/disclosure/index.d.ts.map +1 -1
- package/dist/ui/disclosure/index.js +2 -2
- package/dist/ui/dragAndDrop/index.d.ts +5 -5
- package/dist/ui/dragAndDrop/index.d.ts.map +1 -1
- package/dist/ui/fieldset/index.d.ts +7 -7
- package/dist/ui/fieldset/index.d.ts.map +1 -1
- package/dist/ui/fileDrop/index.js +2 -2
- package/dist/ui/input/index.d.ts +8 -8
- package/dist/ui/input/index.d.ts.map +1 -1
- package/dist/ui/listbox/multi.d.ts +16 -12
- package/dist/ui/listbox/multi.d.ts.map +1 -1
- package/dist/ui/listbox/multi.js +2 -2
- package/dist/ui/listbox/public.d.ts +1 -1
- package/dist/ui/listbox/public.d.ts.map +1 -1
- package/dist/ui/listbox/public.js +1 -1
- package/dist/ui/listbox/shared.d.ts +35 -11
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +22 -3
- package/dist/ui/listbox/single.d.ts +16 -12
- package/dist/ui/listbox/single.d.ts.map +1 -1
- package/dist/ui/listbox/single.js +2 -2
- package/dist/ui/menu/index.d.ts +34 -12
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +24 -5
- package/dist/ui/menu/public.d.ts +1 -1
- package/dist/ui/menu/public.d.ts.map +1 -1
- package/dist/ui/menu/public.js +1 -1
- package/dist/ui/popover/index.d.ts +26 -10
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +20 -4
- package/dist/ui/popover/public.d.ts +1 -1
- package/dist/ui/popover/public.d.ts.map +1 -1
- package/dist/ui/popover/public.js +1 -1
- package/dist/ui/radioGroup/index.d.ts +13 -13
- package/dist/ui/radioGroup/index.d.ts.map +1 -1
- package/dist/ui/radioGroup/index.js +2 -2
- package/dist/ui/select/index.d.ts +8 -8
- package/dist/ui/select/index.d.ts.map +1 -1
- package/dist/ui/slider/index.d.ts +12 -12
- package/dist/ui/slider/index.d.ts.map +1 -1
- package/dist/ui/slider/index.js +2 -2
- package/dist/ui/switch/index.d.ts +10 -10
- package/dist/ui/switch/index.d.ts.map +1 -1
- package/dist/ui/switch/index.js +2 -2
- package/dist/ui/tabs/index.d.ts +11 -11
- package/dist/ui/tabs/index.d.ts.map +1 -1
- package/dist/ui/tabs/index.js +2 -2
- package/dist/ui/textarea/index.d.ts +8 -8
- package/dist/ui/textarea/index.d.ts.map +1 -1
- package/dist/ui/toast/index.js +2 -2
- package/dist/ui/tooltip/index.d.ts +14 -7
- package/dist/ui/tooltip/index.d.ts.map +1 -1
- package/dist/ui/tooltip/index.js +6 -3
- package/dist/ui/tooltip/public.d.ts +1 -1
- package/dist/ui/tooltip/public.d.ts.map +1 -1
- package/dist/ui/tooltip/public.js +1 -1
- package/dist/ui/virtualList/index.d.ts +4 -4
- package/dist/ui/virtualList/index.d.ts.map +1 -1
- package/package.json +9 -1
|
@@ -134,9 +134,9 @@ export const view = (config) => {
|
|
|
134
134
|
* `createLazy`. */
|
|
135
135
|
export const lazy = (staticConfig) => {
|
|
136
136
|
const lazyView = createLazy();
|
|
137
|
-
return (model, toParentMessage) => lazyView((currentModel,
|
|
137
|
+
return (model, toParentMessage) => lazyView((currentModel, currentToParentMessage) => view({
|
|
138
138
|
...staticConfig,
|
|
139
139
|
model: currentModel,
|
|
140
|
-
toParentMessage:
|
|
140
|
+
toParentMessage: currentToParentMessage,
|
|
141
141
|
}), [model, toParentMessage]);
|
|
142
142
|
};
|
package/dist/ui/input/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { Attribute } from '../../html/index.js';
|
|
2
2
|
import type { Html } from '../../html/index.js';
|
|
3
3
|
/** Attribute groups the input component provides to the consumer's `toView` callback. */
|
|
4
|
-
export type InputAttributes<
|
|
5
|
-
input: ReadonlyArray<Attribute<
|
|
6
|
-
label: ReadonlyArray<Attribute<
|
|
7
|
-
description: ReadonlyArray<Attribute<
|
|
4
|
+
export type InputAttributes<ParentMessage> = Readonly<{
|
|
5
|
+
input: ReadonlyArray<Attribute<ParentMessage>>;
|
|
6
|
+
label: ReadonlyArray<Attribute<ParentMessage>>;
|
|
7
|
+
description: ReadonlyArray<Attribute<ParentMessage>>;
|
|
8
8
|
}>;
|
|
9
9
|
/** Configuration for rendering an input with `view`. */
|
|
10
|
-
export type ViewConfig<
|
|
10
|
+
export type ViewConfig<ParentMessage> = Readonly<{
|
|
11
11
|
id: string;
|
|
12
|
-
toView: (attributes: InputAttributes<
|
|
13
|
-
onInput?: (value: string) =>
|
|
12
|
+
toView: (attributes: InputAttributes<ParentMessage>) => Html;
|
|
13
|
+
onInput?: (value: string) => ParentMessage;
|
|
14
14
|
value?: string;
|
|
15
15
|
isDisabled?: boolean;
|
|
16
16
|
isInvalid?: boolean;
|
|
@@ -22,5 +22,5 @@ export type ViewConfig<Message> = Readonly<{
|
|
|
22
22
|
/** Generates the description element ID from the input's base ID. */
|
|
23
23
|
export declare const descriptionId: (id: string) => string;
|
|
24
24
|
/** Renders an accessible input by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
25
|
-
export declare const view: <
|
|
25
|
+
export declare const view: <ParentMessage>(config: ViewConfig<ParentMessage>) => Html;
|
|
26
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/input/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAI/C,yFAAyF;AACzF,MAAM,MAAM,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/input/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAI/C,yFAAyF;AACzF,MAAM,MAAM,eAAe,CAAC,aAAa,IAAI,QAAQ,CAAC;IACpD,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IAC9C,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IAC9C,WAAW,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;CACrD,CAAC,CAAA;AAEF,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,aAAa,IAAI,QAAQ,CAAC;IAC/C,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,aAAa,CAAC,KAAK,IAAI,CAAA;IAC5D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,aAAa,CAAA;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC,CAAA;AAEF,qEAAqE;AACrE,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAA6B,CAAA;AAExE,+HAA+H;AAC/H,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,QAAQ,UAAU,CAAC,aAAa,CAAC,KAChC,IAyEF,CAAA"}
|
|
@@ -132,6 +132,8 @@ export declare const update: (model: {
|
|
|
132
132
|
readonly _tag: "CompletedAnchorMount";
|
|
133
133
|
} | {
|
|
134
134
|
readonly _tag: "CompletedFocusItemsOnMount";
|
|
135
|
+
} | {
|
|
136
|
+
readonly _tag: "CompletedBackdropPortal";
|
|
135
137
|
} | {
|
|
136
138
|
readonly _tag: "GotAnimationMessage";
|
|
137
139
|
readonly message: {
|
|
@@ -158,9 +160,9 @@ export declare const close: (model: Model) => readonly [Model, ReadonlyArray<Com
|
|
|
158
160
|
/** Programmatically toggles an item in the multi-select listbox. Use this in domain-event handlers when the listbox uses `onSelectedItem`. */
|
|
159
161
|
export declare const selectItem: (model: Model, item: string) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
160
162
|
/** Configuration for rendering a multi-select listbox with `view`. */
|
|
161
|
-
export type ViewConfig<
|
|
163
|
+
export type ViewConfig<ParentMessage, Item> = BaseViewConfig<ParentMessage, Item, Model>;
|
|
162
164
|
/** Renders a headless multi-select listbox with typeahead search, keyboard navigation, selection tracking, and aria-activedescendant focus management. */
|
|
163
|
-
export declare const view: <
|
|
165
|
+
export declare const view: <ParentMessage, Item>(config: Readonly<{
|
|
164
166
|
model: {
|
|
165
167
|
readonly id: string;
|
|
166
168
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
@@ -187,8 +189,10 @@ export declare const view: <Message, Item>(config: Readonly<{
|
|
|
187
189
|
readonly _tag: "CompletedAnchorMount";
|
|
188
190
|
} | {
|
|
189
191
|
readonly _tag: "CompletedFocusItemsOnMount";
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
+
} | {
|
|
193
|
+
readonly _tag: "CompletedBackdropPortal";
|
|
194
|
+
}) => ParentMessage;
|
|
195
|
+
onSelectedItem?: (value: string) => ParentMessage;
|
|
192
196
|
items: readonly Item[];
|
|
193
197
|
itemToConfig: (item: Item, context: Readonly<{
|
|
194
198
|
isActive: boolean;
|
|
@@ -204,24 +208,24 @@ export declare const view: <Message, Item>(config: Readonly<{
|
|
|
204
208
|
isButtonDisabled?: boolean;
|
|
205
209
|
buttonContent: Html;
|
|
206
210
|
buttonClassName?: string;
|
|
207
|
-
buttonAttributes?: readonly import("../../html/index.js").Attribute<
|
|
211
|
+
buttonAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
208
212
|
itemsClassName?: string;
|
|
209
|
-
itemsAttributes?: readonly import("../../html/index.js").Attribute<
|
|
213
|
+
itemsAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
210
214
|
itemsScrollClassName?: string;
|
|
211
|
-
itemsScrollAttributes?: readonly import("../../html/index.js").Attribute<
|
|
215
|
+
itemsScrollAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
212
216
|
backdropClassName?: string;
|
|
213
|
-
backdropAttributes?: readonly import("../../html/index.js").Attribute<
|
|
217
|
+
backdropAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
214
218
|
className?: string;
|
|
215
|
-
attributes?: readonly import("../../html/index.js").Attribute<
|
|
219
|
+
attributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
216
220
|
itemGroupKey?: (item: Item, index: number) => string;
|
|
217
221
|
groupToHeading?: (groupKey: string) => Readonly<{
|
|
218
222
|
content: Html;
|
|
219
223
|
className?: string;
|
|
220
224
|
}> | undefined;
|
|
221
225
|
groupClassName?: string;
|
|
222
|
-
groupAttributes?: readonly import("../../html/index.js").Attribute<
|
|
226
|
+
groupAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
223
227
|
separatorClassName?: string;
|
|
224
|
-
separatorAttributes?: readonly import("../../html/index.js").Attribute<
|
|
228
|
+
separatorAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
225
229
|
anchor?: Readonly<{
|
|
226
230
|
placement?: import("@floating-ui/dom").Placement;
|
|
227
231
|
gap?: number;
|
|
@@ -236,5 +240,5 @@ export declare const view: <Message, Item>(config: Readonly<{
|
|
|
236
240
|
}>) => Html;
|
|
237
241
|
/** Creates a memoized multi-select listbox view. Static config is captured in a closure;
|
|
238
242
|
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
239
|
-
export declare const lazy: <
|
|
243
|
+
export declare const lazy: <ParentMessage, Item>(staticConfig: Omit<ViewConfig<ParentMessage, Item>, "model" | "toParentMessage" | "onSelectedItem">) => ((model: Model, toParentMessage: BaseViewConfig<ParentMessage, Item, Model>["toParentMessage"]) => Html);
|
|
240
244
|
//# sourceMappingURL=multi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/multi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,IAAI,CAAC,EAAQ,MAAM,QAAQ,CAAA;AAEzD,OAAO,KAAK,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,qBAAqB,CAAA;AAE3D,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,MAAM,EACN,K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/ui/listbox/multi.js
CHANGED
|
@@ -39,9 +39,9 @@ export const view = makeView({
|
|
|
39
39
|
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
40
40
|
export const lazy = (staticConfig) => {
|
|
41
41
|
const lazyView = createLazy();
|
|
42
|
-
return (model, toParentMessage) => lazyView((currentModel,
|
|
42
|
+
return (model, toParentMessage) => lazyView((currentModel, currentToParentMessage) => view({
|
|
43
43
|
...staticConfig,
|
|
44
44
|
model: currentModel,
|
|
45
|
-
toParentMessage:
|
|
45
|
+
toParentMessage: currentToParentMessage,
|
|
46
46
|
}), [model, toParentMessage]);
|
|
47
47
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { init, update, open, close, selectItem, view, lazy, Model, } from './single.js';
|
|
2
|
-
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedFocusItemsOnMount, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusButton, FocusItems, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
2
|
+
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedFocusItemsOnMount, CompletedBackdropPortal, ListboxAnchor, ListboxFocusItemsOnMount, ListboxBackdropPortal, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusButton, FocusItems, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
3
3
|
export type { ActivationTrigger, Opened, Closed, BlurredItems, ActivatedItem, DeactivatedItem, MovedPointerOverItem, RequestedItemClick, Searched, PressedPointerOnButton, IgnoredMouseClick, SuppressedSpaceScroll, ItemConfig, GroupHeading, } from './shared.js';
|
|
4
4
|
export type { InitConfig, ViewConfig } from './single.js';
|
|
5
5
|
export type { AnchorConfig } from '../anchor.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,KAAK,GACN,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,YAAY,EACZ,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,YAAY,GACb,MAAM,aAAa,CAAA;AAEpB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEzD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,KAAK,GACN,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,EACb,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,YAAY,EACZ,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,QAAQ,EACR,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,YAAY,GACb,MAAM,aAAa,CAAA;AAEpB,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEzD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { init, update, open, close, selectItem, view, lazy, Model, } from './single.js';
|
|
2
|
-
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedFocusItemsOnMount, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusButton, FocusItems, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
2
|
+
export { Message, Orientation, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusButton, CompletedFocusItems, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedFocusItemsOnMount, CompletedBackdropPortal, ListboxAnchor, ListboxFocusItemsOnMount, ListboxBackdropPortal, ClearedSearch, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusButton, FocusItems, ScrollIntoView, ClickItem, DelayClearSearch, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
3
3
|
export * as Multi from './multiPublic.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Effect, Option, Schema as S } from 'effect';
|
|
2
2
|
import * as Command from '../../command/index.js';
|
|
3
3
|
import { type Attribute, type Html } from '../../html/index.js';
|
|
4
|
+
import * as Mount from '../../mount/index.js';
|
|
4
5
|
import type { AnchorConfig } from '../anchor.js';
|
|
5
6
|
import { resolveTypeaheadMatch } from '../typeahead.js';
|
|
6
7
|
export { resolveTypeaheadMatch };
|
|
@@ -104,6 +105,8 @@ export declare const SuppressedSpaceScroll: import("../../schema/index.js").Call
|
|
|
104
105
|
export declare const CompletedAnchorMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedAnchorMount", {}>;
|
|
105
106
|
/** Sent when the listbox items panel mounts and the no-anchor focus fallback runs. Update no-ops; surfaces the focus side effect for DevTools. */
|
|
106
107
|
export declare const CompletedFocusItemsOnMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedFocusItemsOnMount", {}>;
|
|
108
|
+
/** Sent when the listbox backdrop mounts and is portaled to the document body. Update no-ops; surfaces the portal side effect for DevTools. */
|
|
109
|
+
export declare const CompletedBackdropPortal: import("../../schema/index.js").CallableTaggedStruct<"CompletedBackdropPortal", {}>;
|
|
107
110
|
/** Wraps an Animation submodel message for delegation. */
|
|
108
111
|
export declare const GotAnimationMessage: import("../../schema/index.js").CallableTaggedStruct<"GotAnimationMessage", {
|
|
109
112
|
message: S.Union<[import("../../schema/index.js").CallableTaggedStruct<"Showed", {}>, import("../../schema/index.js").CallableTaggedStruct<"Hid", {}>, import("../../schema/index.js").CallableTaggedStruct<"AdvancedAnimationFrame", {}>, import("../../schema/index.js").CallableTaggedStruct<"EndedAnimation", {}>]>;
|
|
@@ -137,6 +140,7 @@ export declare const Message: S.Union<[
|
|
|
137
140
|
typeof SuppressedSpaceScroll,
|
|
138
141
|
typeof CompletedAnchorMount,
|
|
139
142
|
typeof CompletedFocusItemsOnMount,
|
|
143
|
+
typeof CompletedBackdropPortal,
|
|
140
144
|
typeof GotAnimationMessage,
|
|
141
145
|
typeof PressedPointerOnButton
|
|
142
146
|
]>;
|
|
@@ -272,6 +276,8 @@ export declare const makeUpdate: <Model extends BaseModel>(handleSelectedItem: (
|
|
|
272
276
|
readonly _tag: "CompletedAnchorMount";
|
|
273
277
|
} | {
|
|
274
278
|
readonly _tag: "CompletedFocusItemsOnMount";
|
|
279
|
+
} | {
|
|
280
|
+
readonly _tag: "CompletedBackdropPortal";
|
|
275
281
|
} | {
|
|
276
282
|
readonly _tag: "GotAnimationMessage";
|
|
277
283
|
readonly message: {
|
|
@@ -289,6 +295,24 @@ export declare const makeUpdate: <Model extends BaseModel>(handleSelectedItem: (
|
|
|
289
295
|
readonly pointerType: string;
|
|
290
296
|
}, never, never>;
|
|
291
297
|
}>[]];
|
|
298
|
+
/** The anchor-positioning Mount this Listbox renders when an anchor is
|
|
299
|
+
* configured. Exposed so Scene tests can call
|
|
300
|
+
* `Scene.Mount.resolve(ListboxAnchor, CompletedAnchorMount())`. */
|
|
301
|
+
export declare const ListboxAnchor: Mount.MountDefinition<"ListboxAnchor", {
|
|
302
|
+
readonly _tag: "CompletedAnchorMount";
|
|
303
|
+
}>;
|
|
304
|
+
/** The Mount this Listbox renders to focus its items container on open.
|
|
305
|
+
* Exposed so Scene tests can call
|
|
306
|
+
* `Scene.Mount.resolve(ListboxFocusItemsOnMount, CompletedFocusItemsOnMount())`. */
|
|
307
|
+
export declare const ListboxFocusItemsOnMount: Mount.MountDefinition<"ListboxFocusItemsOnMount", {
|
|
308
|
+
readonly _tag: "CompletedFocusItemsOnMount";
|
|
309
|
+
}>;
|
|
310
|
+
/** The backdrop-portaling Mount this Listbox renders. Exposed so Scene tests can
|
|
311
|
+
* call `Scene.Mount.resolve(ListboxBackdropPortal, CompletedBackdropPortal())` to
|
|
312
|
+
* acknowledge the mount produced by the rendered backdrop. */
|
|
313
|
+
export declare const ListboxBackdropPortal: Mount.MountDefinition<"ListboxBackdropPortal", {
|
|
314
|
+
readonly _tag: "CompletedBackdropPortal";
|
|
315
|
+
}>;
|
|
292
316
|
/** Configuration for an individual listbox item's appearance. */
|
|
293
317
|
export type ItemConfig = Readonly<{
|
|
294
318
|
className?: string;
|
|
@@ -300,10 +324,10 @@ export type GroupHeading = Readonly<{
|
|
|
300
324
|
className?: string;
|
|
301
325
|
}>;
|
|
302
326
|
/** Configuration for rendering a listbox with `view`. */
|
|
303
|
-
export type BaseViewConfig<
|
|
327
|
+
export type BaseViewConfig<ParentMessage, Item, Model extends BaseModel> = Readonly<{
|
|
304
328
|
model: Model;
|
|
305
|
-
toParentMessage: (message: Opened | Closed | BlurredItems | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | Searched | PressedPointerOnButton | IgnoredMouseClick | SuppressedSpaceScroll | typeof CompletedAnchorMount.Type | typeof CompletedFocusItemsOnMount.Type) =>
|
|
306
|
-
onSelectedItem?: (value: string) =>
|
|
329
|
+
toParentMessage: (message: Opened | Closed | BlurredItems | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | Searched | PressedPointerOnButton | IgnoredMouseClick | SuppressedSpaceScroll | typeof CompletedAnchorMount.Type | typeof CompletedFocusItemsOnMount.Type | typeof CompletedBackdropPortal.Type) => ParentMessage;
|
|
330
|
+
onSelectedItem?: (value: string) => ParentMessage;
|
|
307
331
|
items: ReadonlyArray<Item>;
|
|
308
332
|
itemToConfig: (item: Item, context: Readonly<{
|
|
309
333
|
isActive: boolean;
|
|
@@ -316,21 +340,21 @@ export type BaseViewConfig<Message, Item, Model extends BaseModel> = Readonly<{
|
|
|
316
340
|
isButtonDisabled?: boolean;
|
|
317
341
|
buttonContent: Html;
|
|
318
342
|
buttonClassName?: string;
|
|
319
|
-
buttonAttributes?: ReadonlyArray<Attribute<
|
|
343
|
+
buttonAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
320
344
|
itemsClassName?: string;
|
|
321
|
-
itemsAttributes?: ReadonlyArray<Attribute<
|
|
345
|
+
itemsAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
322
346
|
itemsScrollClassName?: string;
|
|
323
|
-
itemsScrollAttributes?: ReadonlyArray<Attribute<
|
|
347
|
+
itemsScrollAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
324
348
|
backdropClassName?: string;
|
|
325
|
-
backdropAttributes?: ReadonlyArray<Attribute<
|
|
349
|
+
backdropAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
326
350
|
className?: string;
|
|
327
|
-
attributes?: ReadonlyArray<Attribute<
|
|
351
|
+
attributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
328
352
|
itemGroupKey?: (item: Item, index: number) => string;
|
|
329
353
|
groupToHeading?: (groupKey: string) => GroupHeading | undefined;
|
|
330
354
|
groupClassName?: string;
|
|
331
|
-
groupAttributes?: ReadonlyArray<Attribute<
|
|
355
|
+
groupAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
332
356
|
separatorClassName?: string;
|
|
333
|
-
separatorAttributes?: ReadonlyArray<Attribute<
|
|
357
|
+
separatorAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
334
358
|
anchor?: AnchorConfig;
|
|
335
359
|
name?: string;
|
|
336
360
|
form?: string;
|
|
@@ -342,5 +366,5 @@ type ViewBehavior<Model extends BaseModel> = Readonly<{
|
|
|
342
366
|
selectedItemIndex: <Item>(model: Model, items: ReadonlyArray<Item>, itemToValue: (item: Item) => string) => Option.Option<number>;
|
|
343
367
|
ariaMultiSelectable: boolean;
|
|
344
368
|
}>;
|
|
345
|
-
export declare const makeView: <Model extends BaseModel>(behavior: ViewBehavior<Model>) => <
|
|
369
|
+
export declare const makeView: <Model extends BaseModel>(behavior: ViewBehavior<Model>) => <ParentMessage, Item>(config: BaseViewConfig<ParentMessage, Item, Model>) => Html;
|
|
346
370
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAIN,MAAM,EAEN,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EAGV,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAIN,MAAM,EAEN,MAAM,IAAI,CAAC,EAGZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EAGV,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAA;AAI7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAoBhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAEvD,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAIhC,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,8CAAsC,CAAA;AACpE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;AAE7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,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IACzD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IAC7D,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAC,CAAA;AAIF,KAAK,YAAY,CAAC,KAAK,SAAS,SAAS,IAAI,QAAQ,CAAC;IACpD,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAA;IAC5D,iBAAiB,EAAE,CAAC,IAAI,EACtB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,EAC1B,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,KAChC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1B,mBAAmB,EAAE,OAAO,CAAA;CAC7B,CAAC,CAAA;AAEF,eAAO,MAAM,QAAQ,GAClB,KAAK,SAAS,SAAS,EAAE,UAAU,YAAY,CAAC,KAAK,CAAC,MACtD,aAAa,EAAE,IAAI,EAClB,QAAQ,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,KACjD,IA0iBF,CAAA"}
|
|
@@ -6,7 +6,7 @@ import { m } from '../../message/index.js';
|
|
|
6
6
|
import * as Mount from '../../mount/index.js';
|
|
7
7
|
import { makeConstrainedEvo } from '../../struct/index.js';
|
|
8
8
|
import * as Task from '../../task/index.js';
|
|
9
|
-
import { anchorSetup } from '../anchor.js';
|
|
9
|
+
import { anchorSetup, portalToBody } from '../anchor.js';
|
|
10
10
|
// NOTE: Animation imports are split across schema + update to avoid a circular
|
|
11
11
|
// dependency: animation → html → runtime → devtools → listbox → animation.
|
|
12
12
|
// The barrel (../animation) imports from html, which starts the cycle.
|
|
@@ -110,6 +110,8 @@ export const SuppressedSpaceScroll = m('SuppressedSpaceScroll');
|
|
|
110
110
|
export const CompletedAnchorMount = m('CompletedAnchorMount');
|
|
111
111
|
/** Sent when the listbox items panel mounts and the no-anchor focus fallback runs. Update no-ops; surfaces the focus side effect for DevTools. */
|
|
112
112
|
export const CompletedFocusItemsOnMount = m('CompletedFocusItemsOnMount');
|
|
113
|
+
/** Sent when the listbox backdrop mounts and is portaled to the document body. Update no-ops; surfaces the portal side effect for DevTools. */
|
|
114
|
+
export const CompletedBackdropPortal = m('CompletedBackdropPortal');
|
|
113
115
|
/** Wraps an Animation submodel message for delegation. */
|
|
114
116
|
export const GotAnimationMessage = m('GotAnimationMessage', {
|
|
115
117
|
message: AnimationMessage,
|
|
@@ -143,6 +145,7 @@ export const Message = S.Union([
|
|
|
143
145
|
SuppressedSpaceScroll,
|
|
144
146
|
CompletedAnchorMount,
|
|
145
147
|
CompletedFocusItemsOnMount,
|
|
148
|
+
CompletedBackdropPortal,
|
|
146
149
|
GotAnimationMessage,
|
|
147
150
|
PressedPointerOnButton,
|
|
148
151
|
]);
|
|
@@ -370,11 +373,22 @@ export const makeUpdate = (handleSelectedItem) => {
|
|
|
370
373
|
SuppressedSpaceScroll: () => [model, []],
|
|
371
374
|
CompletedAnchorMount: () => [model, []],
|
|
372
375
|
CompletedFocusItemsOnMount: () => [model, []],
|
|
376
|
+
CompletedBackdropPortal: () => [model, []],
|
|
373
377
|
}));
|
|
374
378
|
};
|
|
375
379
|
};
|
|
376
|
-
|
|
377
|
-
|
|
380
|
+
/** The anchor-positioning Mount this Listbox renders when an anchor is
|
|
381
|
+
* configured. Exposed so Scene tests can call
|
|
382
|
+
* `Scene.Mount.resolve(ListboxAnchor, CompletedAnchorMount())`. */
|
|
383
|
+
export const ListboxAnchor = Mount.define('ListboxAnchor', CompletedAnchorMount);
|
|
384
|
+
/** The Mount this Listbox renders to focus its items container on open.
|
|
385
|
+
* Exposed so Scene tests can call
|
|
386
|
+
* `Scene.Mount.resolve(ListboxFocusItemsOnMount, CompletedFocusItemsOnMount())`. */
|
|
387
|
+
export const ListboxFocusItemsOnMount = Mount.define('ListboxFocusItemsOnMount', CompletedFocusItemsOnMount);
|
|
388
|
+
/** The backdrop-portaling Mount this Listbox renders. Exposed so Scene tests can
|
|
389
|
+
* call `Scene.Mount.resolve(ListboxBackdropPortal, CompletedBackdropPortal())` to
|
|
390
|
+
* acknowledge the mount produced by the rendered backdrop. */
|
|
391
|
+
export const ListboxBackdropPortal = Mount.define('ListboxBackdropPortal', CompletedBackdropPortal);
|
|
378
392
|
const focusItemsOnMount = ListboxFocusItemsOnMount((element) => Effect.sync(() => {
|
|
379
393
|
if (element instanceof HTMLElement) {
|
|
380
394
|
element.focus();
|
|
@@ -384,6 +398,10 @@ const focusItemsOnMount = ListboxFocusItemsOnMount((element) => Effect.sync(() =
|
|
|
384
398
|
cleanup: Function.constVoid,
|
|
385
399
|
};
|
|
386
400
|
}));
|
|
401
|
+
const portalBackdropOnMount = ListboxBackdropPortal((element) => Effect.sync(() => ({
|
|
402
|
+
message: CompletedBackdropPortal(),
|
|
403
|
+
cleanup: portalToBody(element),
|
|
404
|
+
})));
|
|
387
405
|
export const makeView = (behavior) => (config) => {
|
|
388
406
|
const { div, input, AriaActiveDescendant, AriaControls, AriaDisabled, AriaExpanded, AriaHasPopup, AriaLabelledBy, AriaMultiSelectable, AriaOrientation, AriaSelected, Attribute, Class, DataAttribute, Id, Name, OnBlur, OnClick, OnKeyDownPreventDefault, OnKeyUpPreventDefault, OnMount, OnPointerDown, OnPointerLeave, OnPointerMove, Role, Style, Tabindex, Type, Value, keyed, } = html();
|
|
389
407
|
const { model: { id, isOpen, orientation, animation: { transitionState }, maybeActiveItemIndex, searchQuery, maybeLastButtonPointerType, }, toParentMessage, onSelectedItem, items, itemToConfig, isItemDisabled, isButtonDisabled, buttonContent, buttonClassName, buttonAttributes = [], itemsClassName, itemsAttributes = [], itemsScrollClassName, itemsScrollAttributes = [], backdropClassName, backdropAttributes = [], className, attributes = [], itemGroupKey, groupToHeading, groupClassName, groupAttributes = [], separatorClassName, separatorAttributes = [], anchor, name, form, isDisabled, isInvalid, } = config;
|
|
@@ -605,6 +623,7 @@ export const makeView = (behavior) => (config) => {
|
|
|
605
623
|
});
|
|
606
624
|
};
|
|
607
625
|
const backdrop = keyed('div')(`${id}-backdrop`, [
|
|
626
|
+
OnMount(Mount.mapMessage(portalBackdropOnMount, toParentMessage)),
|
|
608
627
|
...(isLeaving ? [] : [OnClick(toParentMessage(Closed()))]),
|
|
609
628
|
...(backdropClassName ? [Class(backdropClassName)] : []),
|
|
610
629
|
...backdropAttributes,
|
|
@@ -132,6 +132,8 @@ export declare const update: (model: {
|
|
|
132
132
|
readonly _tag: "CompletedAnchorMount";
|
|
133
133
|
} | {
|
|
134
134
|
readonly _tag: "CompletedFocusItemsOnMount";
|
|
135
|
+
} | {
|
|
136
|
+
readonly _tag: "CompletedBackdropPortal";
|
|
135
137
|
} | {
|
|
136
138
|
readonly _tag: "GotAnimationMessage";
|
|
137
139
|
readonly message: {
|
|
@@ -159,9 +161,9 @@ export declare const close: (model: Model) => readonly [Model, ReadonlyArray<Com
|
|
|
159
161
|
* focus commands. Use this in domain-event handlers when the listbox uses `onSelectedItem`. */
|
|
160
162
|
export declare const selectItem: (model: Model, item: string) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
161
163
|
/** Configuration for rendering a single-select listbox with `view`. */
|
|
162
|
-
export type ViewConfig<
|
|
164
|
+
export type ViewConfig<ParentMessage, Item> = BaseViewConfig<ParentMessage, Item, Model>;
|
|
163
165
|
/** Renders a headless single-select listbox with typeahead search, keyboard navigation, selection tracking, and aria-activedescendant focus management. */
|
|
164
|
-
export declare const view: <
|
|
166
|
+
export declare const view: <ParentMessage, Item>(config: Readonly<{
|
|
165
167
|
model: {
|
|
166
168
|
readonly id: string;
|
|
167
169
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
@@ -188,8 +190,10 @@ export declare const view: <Message, Item>(config: Readonly<{
|
|
|
188
190
|
readonly _tag: "CompletedAnchorMount";
|
|
189
191
|
} | {
|
|
190
192
|
readonly _tag: "CompletedFocusItemsOnMount";
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
+
} | {
|
|
194
|
+
readonly _tag: "CompletedBackdropPortal";
|
|
195
|
+
}) => ParentMessage;
|
|
196
|
+
onSelectedItem?: (value: string) => ParentMessage;
|
|
193
197
|
items: readonly Item[];
|
|
194
198
|
itemToConfig: (item: Item, context: Readonly<{
|
|
195
199
|
isActive: boolean;
|
|
@@ -205,24 +209,24 @@ export declare const view: <Message, Item>(config: Readonly<{
|
|
|
205
209
|
isButtonDisabled?: boolean;
|
|
206
210
|
buttonContent: Html;
|
|
207
211
|
buttonClassName?: string;
|
|
208
|
-
buttonAttributes?: readonly import("../../html/index.js").Attribute<
|
|
212
|
+
buttonAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
209
213
|
itemsClassName?: string;
|
|
210
|
-
itemsAttributes?: readonly import("../../html/index.js").Attribute<
|
|
214
|
+
itemsAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
211
215
|
itemsScrollClassName?: string;
|
|
212
|
-
itemsScrollAttributes?: readonly import("../../html/index.js").Attribute<
|
|
216
|
+
itemsScrollAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
213
217
|
backdropClassName?: string;
|
|
214
|
-
backdropAttributes?: readonly import("../../html/index.js").Attribute<
|
|
218
|
+
backdropAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
215
219
|
className?: string;
|
|
216
|
-
attributes?: readonly import("../../html/index.js").Attribute<
|
|
220
|
+
attributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
217
221
|
itemGroupKey?: (item: Item, index: number) => string;
|
|
218
222
|
groupToHeading?: (groupKey: string) => Readonly<{
|
|
219
223
|
content: Html;
|
|
220
224
|
className?: string;
|
|
221
225
|
}> | undefined;
|
|
222
226
|
groupClassName?: string;
|
|
223
|
-
groupAttributes?: readonly import("../../html/index.js").Attribute<
|
|
227
|
+
groupAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
224
228
|
separatorClassName?: string;
|
|
225
|
-
separatorAttributes?: readonly import("../../html/index.js").Attribute<
|
|
229
|
+
separatorAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
226
230
|
anchor?: Readonly<{
|
|
227
231
|
placement?: import("@floating-ui/dom").Placement;
|
|
228
232
|
gap?: number;
|
|
@@ -237,5 +241,5 @@ export declare const view: <Message, Item>(config: Readonly<{
|
|
|
237
241
|
}>) => Html;
|
|
238
242
|
/** Creates a memoized single-select listbox view. Static config is captured in a closure;
|
|
239
243
|
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
240
|
-
export declare const lazy: <
|
|
244
|
+
export declare const lazy: <ParentMessage, Item>(staticConfig: Omit<ViewConfig<ParentMessage, Item>, "model" | "toParentMessage" | "onSelectedItem">) => ((model: Model, toParentMessage: BaseViewConfig<ParentMessage, Item, Model>["toParentMessage"]) => Html);
|
|
241
245
|
//# sourceMappingURL=single.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single.d.ts","sourceRoot":"","sources":["../../../src/ui/listbox/single.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEnD,OAAO,KAAK,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,qBAAqB,CAAA;AAE3D,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,MAAM,EACN,KAAK,OAAO,EACZ,MA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ared per render via `createLazy`. */
|
|
42
42
|
export const lazy = (staticConfig) => {
|
|
43
43
|
const lazyView = createLazy();
|
|
44
|
-
return (model, toParentMessage) => lazyView((currentModel,
|
|
44
|
+
return (model, toParentMessage) => lazyView((currentModel, currentToParentMessage) => view({
|
|
45
45
|
...staticConfig,
|
|
46
46
|
model: currentModel,
|
|
47
|
-
toParentMessage:
|
|
47
|
+
toParentMessage: currentToParentMessage,
|
|
48
48
|
}), [model, toParentMessage]);
|
|
49
49
|
};
|
package/dist/ui/menu/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Schema as S } from 'effect';
|
|
2
2
|
import * as Command from '../../command/index.js';
|
|
3
3
|
import { type Attribute, type Html } from '../../html/index.js';
|
|
4
|
+
import * as Mount from '../../mount/index.js';
|
|
4
5
|
import type { AnchorConfig } from '../anchor.js';
|
|
5
6
|
import { groupContiguous } from '../group.js';
|
|
6
7
|
import { resolveTypeaheadMatch } from '../typeahead.js';
|
|
@@ -98,6 +99,8 @@ export declare const SuppressedSpaceScroll: import("../../schema/index.js").Call
|
|
|
98
99
|
export declare const CompletedAnchorMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedAnchorMount", {}>;
|
|
99
100
|
/** Sent when the menu items panel mounts and the no-anchor focus fallback runs. Update no-ops; the side effect is the focus call, surfaced for DevTools observability. */
|
|
100
101
|
export declare const CompletedFocusItemsOnMount: import("../../schema/index.js").CallableTaggedStruct<"CompletedFocusItemsOnMount", {}>;
|
|
102
|
+
/** Sent when the menu backdrop mounts and is portaled to the document body. Update no-ops; surfaces the portal side effect for DevTools. */
|
|
103
|
+
export declare const CompletedBackdropPortal: import("../../schema/index.js").CallableTaggedStruct<"CompletedBackdropPortal", {}>;
|
|
101
104
|
/** Wraps an Animation submodel message for delegation. */
|
|
102
105
|
export declare const GotAnimationMessage: import("../../schema/index.js").CallableTaggedStruct<"GotAnimationMessage", {
|
|
103
106
|
message: S.Union<[import("../../schema/index.js").CallableTaggedStruct<"Showed", {}>, import("../../schema/index.js").CallableTaggedStruct<"Hid", {}>, import("../../schema/index.js").CallableTaggedStruct<"AdvancedAnimationFrame", {}>, import("../../schema/index.js").CallableTaggedStruct<"EndedAnimation", {}>]>;
|
|
@@ -141,6 +144,7 @@ export declare const Message: S.Union<[
|
|
|
141
144
|
typeof SuppressedSpaceScroll,
|
|
142
145
|
typeof CompletedAnchorMount,
|
|
143
146
|
typeof CompletedFocusItemsOnMount,
|
|
147
|
+
typeof CompletedBackdropPortal,
|
|
144
148
|
typeof GotAnimationMessage,
|
|
145
149
|
typeof PressedPointerOnButton,
|
|
146
150
|
typeof ReleasedPointerOnItems
|
|
@@ -221,6 +225,24 @@ export declare const DetectMovementOrAnimationEnd: Command.CommandDefinition<"De
|
|
|
221
225
|
}>;
|
|
222
226
|
/** Processes a menu message and returns the next model and commands. */
|
|
223
227
|
export declare const update: (model: Model, message: Message) => UpdateReturn;
|
|
228
|
+
/** The anchor-positioning Mount this Menu renders on its panel. Exposed so
|
|
229
|
+
* Scene tests can call `Scene.Mount.resolve(MenuAnchor, CompletedAnchorMount())`
|
|
230
|
+
* to acknowledge the mount produced by the rendered panel. */
|
|
231
|
+
export declare const MenuAnchor: Mount.MountDefinition<"MenuAnchor", {
|
|
232
|
+
readonly _tag: "CompletedAnchorMount";
|
|
233
|
+
}>;
|
|
234
|
+
/** The Mount this Menu renders to focus its first item on open. Exposed so
|
|
235
|
+
* Scene tests can call
|
|
236
|
+
* `Scene.Mount.resolve(MenuFocusItemsOnMount, CompletedFocusItemsOnMount())`. */
|
|
237
|
+
export declare const MenuFocusItemsOnMount: Mount.MountDefinition<"MenuFocusItemsOnMount", {
|
|
238
|
+
readonly _tag: "CompletedFocusItemsOnMount";
|
|
239
|
+
}>;
|
|
240
|
+
/** The backdrop-portaling Mount this Menu renders. Exposed so Scene tests can
|
|
241
|
+
* call `Scene.Mount.resolve(MenuBackdropPortal, CompletedBackdropPortal())` to
|
|
242
|
+
* acknowledge the mount produced by the rendered backdrop. */
|
|
243
|
+
export declare const MenuBackdropPortal: Mount.MountDefinition<"MenuBackdropPortal", {
|
|
244
|
+
readonly _tag: "CompletedBackdropPortal";
|
|
245
|
+
}>;
|
|
224
246
|
/** Programmatically opens the menu, updating the model and returning
|
|
225
247
|
* focus and modal commands. Use this in domain-event handlers to open the menu. */
|
|
226
248
|
export declare const open: (model: Model) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
@@ -241,10 +263,10 @@ export type GroupHeading = Readonly<{
|
|
|
241
263
|
className?: string;
|
|
242
264
|
}>;
|
|
243
265
|
/** Configuration for rendering a menu with `view`. */
|
|
244
|
-
export type ViewConfig<
|
|
266
|
+
export type ViewConfig<ParentMessage, Item extends string> = Readonly<{
|
|
245
267
|
model: Model;
|
|
246
|
-
toParentMessage: (message: Opened | Closed | BlurredItems | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | Searched | PressedPointerOnButton | ReleasedPointerOnItems | IgnoredMouseClick | SuppressedSpaceScroll | typeof CompletedAnchorMount.Type | typeof CompletedFocusItemsOnMount.Type) =>
|
|
247
|
-
onSelectedItem?: (index: number) =>
|
|
268
|
+
toParentMessage: (message: Opened | Closed | BlurredItems | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | Searched | PressedPointerOnButton | ReleasedPointerOnItems | IgnoredMouseClick | SuppressedSpaceScroll | typeof CompletedAnchorMount.Type | typeof CompletedFocusItemsOnMount.Type | typeof CompletedBackdropPortal.Type) => ParentMessage;
|
|
269
|
+
onSelectedItem?: (index: number) => ParentMessage;
|
|
248
270
|
items: ReadonlyArray<Item>;
|
|
249
271
|
itemToConfig: (item: Item, context: Readonly<{
|
|
250
272
|
isActive: boolean;
|
|
@@ -255,27 +277,27 @@ export type ViewConfig<Message, Item extends string> = Readonly<{
|
|
|
255
277
|
isButtonDisabled?: boolean;
|
|
256
278
|
buttonContent: Html;
|
|
257
279
|
buttonClassName?: string;
|
|
258
|
-
buttonAttributes?: ReadonlyArray<Attribute<
|
|
280
|
+
buttonAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
259
281
|
itemsClassName?: string;
|
|
260
|
-
itemsAttributes?: ReadonlyArray<Attribute<
|
|
282
|
+
itemsAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
261
283
|
itemsScrollClassName?: string;
|
|
262
|
-
itemsScrollAttributes?: ReadonlyArray<Attribute<
|
|
284
|
+
itemsScrollAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
263
285
|
backdropClassName?: string;
|
|
264
|
-
backdropAttributes?: ReadonlyArray<Attribute<
|
|
286
|
+
backdropAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
265
287
|
className?: string;
|
|
266
|
-
attributes?: ReadonlyArray<Attribute<
|
|
288
|
+
attributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
267
289
|
itemGroupKey?: (item: Item, index: number) => string;
|
|
268
290
|
groupToHeading?: (groupKey: string) => GroupHeading | undefined;
|
|
269
291
|
groupClassName?: string;
|
|
270
|
-
groupAttributes?: ReadonlyArray<Attribute<
|
|
292
|
+
groupAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
271
293
|
separatorClassName?: string;
|
|
272
|
-
separatorAttributes?: ReadonlyArray<Attribute<
|
|
294
|
+
separatorAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
273
295
|
anchor?: AnchorConfig;
|
|
274
296
|
}>;
|
|
275
297
|
export { groupContiguous, resolveTypeaheadMatch };
|
|
276
298
|
/** Renders a headless menu with typeahead search, keyboard navigation, and aria-activedescendant focus management. */
|
|
277
|
-
export declare const view: <
|
|
299
|
+
export declare const view: <ParentMessage, Item extends string>(config: ViewConfig<ParentMessage, Item>) => Html;
|
|
278
300
|
/** Creates a memoized menu view. Static config is captured in a closure;
|
|
279
301
|
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
280
|
-
export declare const lazy: <
|
|
302
|
+
export declare const lazy: <ParentMessage, Item extends string>(staticConfig: Omit<ViewConfig<ParentMessage, Item>, "model" | "toParentMessage" | "onSelectedItem">) => ((model: Model, toParentMessage: ViewConfig<ParentMessage, Item>["toParentMessage"]) => Html);
|
|
281
303
|
//# sourceMappingURL=index.d.ts.map
|