foldkit 0.82.8 → 0.83.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/dist/task/dom.d.ts +11 -1
- package/dist/task/dom.d.ts.map +1 -1
- package/dist/task/dom.js +44 -32
- 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 +18 -13
- package/dist/ui/combobox/shared.d.ts.map +1 -1
- package/dist/ui/combobox/shared.js +11 -1
- 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 +16 -11
- package/dist/ui/listbox/shared.d.ts.map +1 -1
- package/dist/ui/listbox/shared.js +11 -1
- 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 +15 -12
- package/dist/ui/menu/index.d.ts.map +1 -1
- package/dist/ui/menu/index.js +13 -3
- 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 +13 -10
- package/dist/ui/popover/index.d.ts.map +1 -1
- package/dist/ui/popover/index.js +13 -3
- 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 +7 -7
- package/dist/ui/tooltip/index.d.ts.map +1 -1
- package/dist/ui/tooltip/index.js +2 -2
- package/dist/ui/virtualList/index.d.ts +4 -4
- package/dist/ui/virtualList/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/task/dom.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
2
|
import { ElementNotFound } from './error.js';
|
|
3
3
|
/**
|
|
4
|
-
* Focuses an element matching the given selector
|
|
4
|
+
* Focuses an element matching the given selector after the next render has
|
|
5
|
+
* committed.
|
|
6
|
+
*
|
|
7
|
+
* For focus that should happen because an element just appeared (an input
|
|
8
|
+
* mounting, a dialog opening), prefer `OnMount` with a `Mount.define`'d
|
|
9
|
+
* action — focus is then a consequence of the element's lifecycle and runs
|
|
10
|
+
* synchronously inside the snabbdom insert hook with no race window.
|
|
11
|
+
* Reserve `Task.focus` for the post-Message case (returning focus to a
|
|
12
|
+
* trigger button after a popover closes, refocusing on blur, keyboard
|
|
13
|
+
* navigation across a stable layout).
|
|
14
|
+
*
|
|
5
15
|
* Fails with `ElementNotFound` if the selector does not match an `HTMLElement`.
|
|
6
16
|
*
|
|
7
17
|
* @example
|
package/dist/task/dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/task/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAMP,MAAM,QAAQ,CAAA;AAEf,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/task/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAMP,MAAM,QAAQ,CAAA;AAEf,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAsC5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,KAAK,GAAI,UAAU,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAKxE,CAAA;AAEJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,GACpB,UAAU,MAAM,EAChB,UAAU,QAAQ,CAAC;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,KAC7C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAgDlC,CAAA;AAuBJ;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,GACrB,UAAU,MAAM,KACf,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAclC,CAAA;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,MAAM,KACf,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAKlC,CAAA;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,MAAM,KACf,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAKlC,CAAA;AAEJ,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,CAAA;AAEhD;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,MAAM,EAChB,WAAW,cAAc,KACxB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAiClC,CAAA"}
|
package/dist/task/dom.js
CHANGED
|
@@ -11,8 +11,32 @@ const FOCUSABLE_SELECTOR = Array.join([
|
|
|
11
11
|
'textarea:not([disabled]):not([tabindex="-1"])',
|
|
12
12
|
'[tabindex]:not([tabindex="-1"])',
|
|
13
13
|
], ', ');
|
|
14
|
+
// NOTE: DOM tasks await one rAF before walking the tree. The runtime defers
|
|
15
|
+
// renders to the next animation frame and forks Commands on the microtask
|
|
16
|
+
// queue, so without this wait a Task that runs immediately after a dirtying
|
|
17
|
+
// Message would query the DOM before the matching VDOM patch has committed.
|
|
18
|
+
const awaitNextFrame = Effect.callback(resume => {
|
|
19
|
+
const handle = requestAnimationFrame(() => resume(Effect.void));
|
|
20
|
+
return Effect.sync(() => cancelAnimationFrame(handle));
|
|
21
|
+
});
|
|
22
|
+
const queryHTMLElement = (selector) => Effect.suspend(() => {
|
|
23
|
+
const element = document.querySelector(selector);
|
|
24
|
+
return element instanceof HTMLElement
|
|
25
|
+
? Effect.succeed(element)
|
|
26
|
+
: Effect.fail(new ElementNotFound({ selector }));
|
|
27
|
+
});
|
|
14
28
|
/**
|
|
15
|
-
* Focuses an element matching the given selector
|
|
29
|
+
* Focuses an element matching the given selector after the next render has
|
|
30
|
+
* committed.
|
|
31
|
+
*
|
|
32
|
+
* For focus that should happen because an element just appeared (an input
|
|
33
|
+
* mounting, a dialog opening), prefer `OnMount` with a `Mount.define`'d
|
|
34
|
+
* action — focus is then a consequence of the element's lifecycle and runs
|
|
35
|
+
* synchronously inside the snabbdom insert hook with no race window.
|
|
36
|
+
* Reserve `Task.focus` for the post-Message case (returning focus to a
|
|
37
|
+
* trigger button after a popover closes, refocusing on blur, keyboard
|
|
38
|
+
* navigation across a stable layout).
|
|
39
|
+
*
|
|
16
40
|
* Fails with `ElementNotFound` if the selector does not match an `HTMLElement`.
|
|
17
41
|
*
|
|
18
42
|
* @example
|
|
@@ -20,13 +44,10 @@ const FOCUSABLE_SELECTOR = Array.join([
|
|
|
20
44
|
* Task.focus('#email-input').pipe(Effect.ignore, Effect.as(CompletedFocusInput()))
|
|
21
45
|
* ```
|
|
22
46
|
*/
|
|
23
|
-
export const focus = (selector) => Effect.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return Effect.void;
|
|
28
|
-
}
|
|
29
|
-
return Effect.fail(new ElementNotFound({ selector }));
|
|
47
|
+
export const focus = (selector) => Effect.gen(function* () {
|
|
48
|
+
yield* awaitNextFrame;
|
|
49
|
+
const element = yield* queryHTMLElement(selector);
|
|
50
|
+
element.focus();
|
|
30
51
|
});
|
|
31
52
|
/**
|
|
32
53
|
* Opens a dialog element using `show()` with high z-index, focus trapping,
|
|
@@ -43,10 +64,11 @@ export const focus = (selector) => Effect.suspend(() => {
|
|
|
43
64
|
* Task.showModal('#my-dialog', { focusSelector: '#search-input' }).pipe(Effect.ignore, Effect.as(CompletedShowDialog()))
|
|
44
65
|
* ```
|
|
45
66
|
*/
|
|
46
|
-
export const showModal = (selector, options) => Effect.
|
|
67
|
+
export const showModal = (selector, options) => Effect.gen(function* () {
|
|
68
|
+
yield* awaitNextFrame;
|
|
47
69
|
const element = document.querySelector(selector);
|
|
48
70
|
if (!(element instanceof HTMLDialogElement)) {
|
|
49
|
-
return Effect.fail(new ElementNotFound({ selector }));
|
|
71
|
+
return yield* Effect.fail(new ElementNotFound({ selector }));
|
|
50
72
|
}
|
|
51
73
|
element.style.position = 'fixed';
|
|
52
74
|
element.style.inset = '0';
|
|
@@ -75,7 +97,6 @@ export const showModal = (selector, options) => Effect.suspend(() => {
|
|
|
75
97
|
focusTarget.focus();
|
|
76
98
|
}
|
|
77
99
|
}
|
|
78
|
-
return Effect.void;
|
|
79
100
|
});
|
|
80
101
|
const trapFocusWithinDialog = (event, dialog) => {
|
|
81
102
|
const focusable = Array.fromIterable(dialog.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
@@ -125,13 +146,10 @@ export const closeModal = (selector) => Effect.suspend(() => {
|
|
|
125
146
|
* Task.clickElement('#menu-item-2').pipe(Effect.ignore, Effect.as(CompletedClickItem()))
|
|
126
147
|
* ```
|
|
127
148
|
*/
|
|
128
|
-
export const clickElement = (selector) => Effect.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return Effect.void;
|
|
133
|
-
}
|
|
134
|
-
return Effect.fail(new ElementNotFound({ selector }));
|
|
149
|
+
export const clickElement = (selector) => Effect.gen(function* () {
|
|
150
|
+
yield* awaitNextFrame;
|
|
151
|
+
const element = yield* queryHTMLElement(selector);
|
|
152
|
+
element.click();
|
|
135
153
|
});
|
|
136
154
|
/**
|
|
137
155
|
* Scrolls an element into view by selector using `{ block: 'nearest' }`.
|
|
@@ -142,13 +160,10 @@ export const clickElement = (selector) => Effect.suspend(() => {
|
|
|
142
160
|
* Task.scrollIntoView('#active-item').pipe(Effect.ignore, Effect.as(CompletedScrollIntoView()))
|
|
143
161
|
* ```
|
|
144
162
|
*/
|
|
145
|
-
export const scrollIntoView = (selector) => Effect.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return Effect.void;
|
|
150
|
-
}
|
|
151
|
-
return Effect.fail(new ElementNotFound({ selector }));
|
|
163
|
+
export const scrollIntoView = (selector) => Effect.gen(function* () {
|
|
164
|
+
yield* awaitNextFrame;
|
|
165
|
+
const element = yield* queryHTMLElement(selector);
|
|
166
|
+
element.scrollIntoView({ block: 'nearest' });
|
|
152
167
|
});
|
|
153
168
|
/**
|
|
154
169
|
* Focuses the next or previous focusable element in the document relative to the element matching the given selector.
|
|
@@ -159,20 +174,17 @@ export const scrollIntoView = (selector) => Effect.suspend(() => {
|
|
|
159
174
|
* Task.advanceFocus('#menu-button', 'Next').pipe(Effect.ignore, Effect.as(CompletedAdvanceFocus()))
|
|
160
175
|
* ```
|
|
161
176
|
*/
|
|
162
|
-
export const advanceFocus = (selector, direction) => Effect.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return Effect.fail(new ElementNotFound({ selector }));
|
|
166
|
-
}
|
|
177
|
+
export const advanceFocus = (selector, direction) => Effect.gen(function* () {
|
|
178
|
+
yield* awaitNextFrame;
|
|
179
|
+
const reference = yield* queryHTMLElement(selector);
|
|
167
180
|
const focusableElements = Array.fromIterable(document.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
168
181
|
const referenceElementIndex = Array.findFirstIndex(focusableElements, Equal.equals(reference));
|
|
169
182
|
if (Option.isNone(referenceElementIndex)) {
|
|
170
|
-
return Effect.fail(new ElementNotFound({ selector }));
|
|
183
|
+
return yield* Effect.fail(new ElementNotFound({ selector }));
|
|
171
184
|
}
|
|
172
185
|
const offsetReferenceElementIndex = M.value(direction).pipe(M.when('Next', () => Number.increment), M.when('Previous', () => Number.decrement), M.exhaustive)(referenceElementIndex.value);
|
|
173
186
|
const nextElement = Array.get(focusableElements, offsetReferenceElementIndex);
|
|
174
187
|
if (Option.isSome(nextElement)) {
|
|
175
188
|
nextElement.value.focus();
|
|
176
189
|
}
|
|
177
|
-
return Effect.void;
|
|
178
190
|
});
|
package/dist/ui/anchor.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export type AnchorConfig = Readonly<{
|
|
|
7
7
|
padding?: number;
|
|
8
8
|
portal?: boolean;
|
|
9
9
|
}>;
|
|
10
|
+
/** Relocates an element into the shared `foldkit-portal-root` div appended to
|
|
11
|
+
* `document.body`, escaping any ancestor stacking context. Returns a cleanup
|
|
12
|
+
* function that removes the element from the portal root. Designed to be
|
|
13
|
+
* called from inside an `OnMount` action: the consumer wraps the call in
|
|
14
|
+
* `Effect.sync` and stashes the returned cleanup in the `Mount` result. */
|
|
15
|
+
export declare const portalToBody: (element: Element) => (() => void);
|
|
10
16
|
/** Positions a floating element relative to its button using Floating UI, then
|
|
11
17
|
* returns a cleanup function. Designed to be called inside an `OnMount`
|
|
12
18
|
* action: the consumer wraps the call in `Effect.sync` and stashes the
|
package/dist/ui/anchor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/ui/anchor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,oGAAoG;AACpG,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/ui/anchor.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,oGAAoG;AACpG,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC,CAAA;AAwBF;;;;4EAI4E;AAC5E,eAAO,MAAM,YAAY,GAAI,SAAS,OAAO,KAAG,CAAC,MAAM,IAAI,CAW1D,CAAA;AAED;;;;;;;;;;2DAU2D;AAC3D,eAAO,MAAM,WAAW,GACrB,QAAQ;IACP,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,YAAY,CAAA;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,MACA,OAAO,OAAO,KAAG,CAAC,MAAM,IAAI,CAiF5B,CAAA"}
|
package/dist/ui/anchor.js
CHANGED
|
@@ -7,7 +7,32 @@ const getOrCreatePortalRoot = () => {
|
|
|
7
7
|
}
|
|
8
8
|
const root = document.createElement('div');
|
|
9
9
|
root.id = PORTAL_ROOT_ID;
|
|
10
|
-
|
|
10
|
+
// NOTE: prepended (not appended) so portaled overlays sit BEFORE the page's
|
|
11
|
+
// listbox/popover/menu wrappers in tree order. Those wrappers are
|
|
12
|
+
// `position: relative; z-index: auto` and paint at CSS step 8 in tree order;
|
|
13
|
+
// a backdrop appended after them would paint on top of every button on the
|
|
14
|
+
// page, breaking click-outside detection. Prepending makes wrappers paint
|
|
15
|
+
// above the backdrop, while panels (z-10) still win via step 9.
|
|
16
|
+
document.body.insertBefore(root, document.body.firstChild);
|
|
17
|
+
return root;
|
|
18
|
+
};
|
|
19
|
+
/** Relocates an element into the shared `foldkit-portal-root` div appended to
|
|
20
|
+
* `document.body`, escaping any ancestor stacking context. Returns a cleanup
|
|
21
|
+
* function that removes the element from the portal root. Designed to be
|
|
22
|
+
* called from inside an `OnMount` action: the consumer wraps the call in
|
|
23
|
+
* `Effect.sync` and stashes the returned cleanup in the `Mount` result. */
|
|
24
|
+
export const portalToBody = (element) => {
|
|
25
|
+
getOrCreatePortalRoot().appendChild(element);
|
|
26
|
+
return () => {
|
|
27
|
+
try {
|
|
28
|
+
element.remove();
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// NOTE: a re-render may unmount the element before this cleanup fires,
|
|
32
|
+
// so the remove() call can throw on a node that's already been removed.
|
|
33
|
+
// Swallow the error.
|
|
34
|
+
}
|
|
35
|
+
};
|
|
11
36
|
};
|
|
12
37
|
/** Positions a floating element relative to its button using Floating UI, then
|
|
13
38
|
* returns a cleanup function. Designed to be called inside an `OnMount`
|
|
@@ -26,9 +51,7 @@ export const anchorSetup = (config) => (items) => {
|
|
|
26
51
|
return () => { };
|
|
27
52
|
}
|
|
28
53
|
const isPortal = config.anchor.portal ?? true;
|
|
29
|
-
|
|
30
|
-
getOrCreatePortalRoot().appendChild(items);
|
|
31
|
-
}
|
|
54
|
+
const portalCleanup = isPortal ? portalToBody(items) : undefined;
|
|
32
55
|
const { placement, gap, offset: crossAxis, padding } = config.anchor;
|
|
33
56
|
const shouldInterceptTab = config.interceptTab ?? true;
|
|
34
57
|
let isFirstUpdate = true;
|
|
@@ -72,18 +95,6 @@ export const anchorSetup = (config) => (items) => {
|
|
|
72
95
|
}
|
|
73
96
|
});
|
|
74
97
|
});
|
|
75
|
-
const portalCleanup = isPortal
|
|
76
|
-
? () => {
|
|
77
|
-
try {
|
|
78
|
-
items.remove();
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
// NOTE: a blur-triggered re-render may unmount the items element
|
|
82
|
-
// before this cleanup runs, so the remove() call can throw on a
|
|
83
|
-
// node that's already been removed. Swallow the error.
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
: undefined;
|
|
87
98
|
if (isPortal && shouldInterceptTab) {
|
|
88
99
|
const handleTabKey = (event) => {
|
|
89
100
|
if (event instanceof KeyboardEvent && event.key === 'Tab') {
|
|
@@ -5,11 +5,11 @@ export type { InitConfig } from './schema.js';
|
|
|
5
5
|
export { AdvancedAnimationFrame, EndedAnimation, Hid, init, Message, Model, OutMessage, Showed, StartedLeaveAnimating, TransitionState, TransitionedOut, };
|
|
6
6
|
export { RequestFrame, WaitForAnimationSettled, defaultLeaveCommand, update };
|
|
7
7
|
/** Configuration for rendering an animation with `view`. */
|
|
8
|
-
export type ViewConfig<
|
|
8
|
+
export type ViewConfig<ParentMessage> = Readonly<{
|
|
9
9
|
model: Model;
|
|
10
10
|
content: Html;
|
|
11
11
|
className?: string;
|
|
12
|
-
attributes?: ReadonlyArray<Attribute<
|
|
12
|
+
attributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
13
13
|
element?: TagName;
|
|
14
14
|
/** When true, wraps content in a CSS grid container that smoothly animates
|
|
15
15
|
* height via `grid-template-rows: 0fr → 1fr`. The element stays in the DOM
|
|
@@ -25,9 +25,9 @@ export type ViewConfig<Message> = Readonly<{
|
|
|
25
25
|
* - `data-leave` — leave animation is active
|
|
26
26
|
* - `data-transition` — any animation is active
|
|
27
27
|
*/
|
|
28
|
-
export declare const view: <
|
|
28
|
+
export declare const view: <ParentMessage>(config: ViewConfig<ParentMessage>) => Html;
|
|
29
29
|
/** Creates a memoized animation view. Static config (className, element, etc.)
|
|
30
30
|
* is captured in a closure. Dynamic fields — `model` and `content` — are
|
|
31
31
|
* compared by reference per render via `createLazy`. */
|
|
32
|
-
export declare const lazy: <
|
|
32
|
+
export declare const lazy: <ParentMessage>(staticConfig: Omit<ViewConfig<ParentMessage>, "model" | "content">) => ((model: Model, content: Html) => Html);
|
|
33
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/animation/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,OAAO,EAGb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,GAAG,EACH,OAAO,EACP,KAAK,EACL,UAAU,EACV,MAAM,EACN,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,IAAI,EACL,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,MAAM,EACP,MAAM,aAAa,CAAA;AAEpB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,GAAG,EACH,IAAI,EACJ,OAAO,EACP,KAAK,EACL,UAAU,EACV,MAAM,EACN,qBAAqB,EACrB,eAAe,EACf,eAAe,GAChB,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,EAAE,CAAA;AAI7E,4DAA4D;AAC5D,MAAM,MAAM,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/animation/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,OAAO,EAGb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,GAAG,EACH,OAAO,EACP,KAAK,EACL,UAAU,EACV,MAAM,EACN,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,IAAI,EACL,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,MAAM,EACP,MAAM,aAAa,CAAA;AAEpB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,GAAG,EACH,IAAI,EACJ,OAAO,EACP,KAAK,EACL,UAAU,EACV,MAAM,EACN,qBAAqB,EACrB,eAAe,EACf,eAAe,GAChB,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,EAAE,CAAA;AAI7E,4DAA4D;AAC5D,MAAM,MAAM,UAAU,CAAC,aAAa,IAAI,QAAQ,CAAC;IAC/C,KAAK,EAAE,KAAK,CAAA;IACZ,OAAO,EAAE,IAAI,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;IACpD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;2EAEuE;IACvE,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAC,CAAA;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,QAAQ,UAAU,CAAC,aAAa,CAAC,KAChC,IA+FF,CAAA;AAED;;yDAEyD;AACzD,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,cAAc,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,KACjE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,KAAK,IAAI,CAaxC,CAAA"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { Attribute } from '../../html/index.js';
|
|
2
2
|
import type { Html } from '../../html/index.js';
|
|
3
3
|
/** Attribute groups the button component provides to the consumer's `toView` callback. */
|
|
4
|
-
export type ButtonAttributes<
|
|
5
|
-
button: ReadonlyArray<Attribute<
|
|
4
|
+
export type ButtonAttributes<ParentMessage> = Readonly<{
|
|
5
|
+
button: ReadonlyArray<Attribute<ParentMessage>>;
|
|
6
6
|
}>;
|
|
7
7
|
/** Configuration for rendering a button with `view`. */
|
|
8
|
-
export type ViewConfig<
|
|
9
|
-
toView: (attributes: ButtonAttributes<
|
|
10
|
-
onClick?:
|
|
8
|
+
export type ViewConfig<ParentMessage> = Readonly<{
|
|
9
|
+
toView: (attributes: ButtonAttributes<ParentMessage>) => Html;
|
|
10
|
+
onClick?: ParentMessage;
|
|
11
11
|
isDisabled?: boolean;
|
|
12
12
|
type?: 'button' | 'submit' | 'reset';
|
|
13
13
|
isAutofocus?: boolean;
|
|
14
14
|
}>;
|
|
15
15
|
/** Renders an accessible button by building attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
16
|
-
export declare const view: <
|
|
16
|
+
export declare const view: <ParentMessage>(config: ViewConfig<ParentMessage>) => Html;
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/button/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAI/C,0FAA0F;AAC1F,MAAM,MAAM,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/button/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAI/C,0FAA0F;AAC1F,MAAM,MAAM,gBAAgB,CAAC,aAAa,IAAI,QAAQ,CAAC;IACrD,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAA;CAChD,CAAC,CAAA;AAEF,wDAAwD;AACxD,MAAM,MAAM,UAAU,CAAC,aAAa,IAAI,QAAQ,CAAC;IAC/C,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,aAAa,CAAC,KAAK,IAAI,CAAA;IAC7D,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;IACpC,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAC,CAAA;AAEF,2HAA2H;AAC3H,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,QAAQ,UAAU,CAAC,aAAa,CAAC,KAChC,IAgCF,CAAA"}
|
|
@@ -828,9 +828,9 @@ export const view = (config) => config.toView(M.value(config.model.viewMode).pip
|
|
|
828
828
|
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
829
829
|
export const lazy = (staticConfig) => {
|
|
830
830
|
const lazyView = createLazy();
|
|
831
|
-
return (model, toParentMessage) => lazyView((currentModel,
|
|
831
|
+
return (model, toParentMessage) => lazyView((currentModel, currentToParentMessage) => view({
|
|
832
832
|
...staticConfig,
|
|
833
833
|
model: currentModel,
|
|
834
|
-
toParentMessage:
|
|
834
|
+
toParentMessage: currentToParentMessage,
|
|
835
835
|
}), [model, toParentMessage]);
|
|
836
836
|
};
|
|
@@ -23,25 +23,25 @@ export declare const init: (config: InitConfig) => Model;
|
|
|
23
23
|
/** Processes a checkbox message and returns the next model and commands. */
|
|
24
24
|
export declare const update: (model: Model, _message: Message) => readonly [Model, ReadonlyArray<Command<Message>>];
|
|
25
25
|
/** Attribute groups the checkbox component provides to the consumer's `toView` callback. */
|
|
26
|
-
export type CheckboxAttributes<
|
|
27
|
-
checkbox: ReadonlyArray<Attribute<
|
|
28
|
-
label: ReadonlyArray<Attribute<
|
|
29
|
-
description: ReadonlyArray<Attribute<
|
|
30
|
-
hiddenInput: ReadonlyArray<Attribute<
|
|
26
|
+
export type CheckboxAttributes<ParentMessage> = Readonly<{
|
|
27
|
+
checkbox: ReadonlyArray<Attribute<ParentMessage>>;
|
|
28
|
+
label: ReadonlyArray<Attribute<ParentMessage>>;
|
|
29
|
+
description: ReadonlyArray<Attribute<ParentMessage>>;
|
|
30
|
+
hiddenInput: ReadonlyArray<Attribute<ParentMessage>>;
|
|
31
31
|
}>;
|
|
32
32
|
/** Configuration for rendering a checkbox with `view`. */
|
|
33
|
-
export type ViewConfig<
|
|
33
|
+
export type ViewConfig<ParentMessage> = Readonly<{
|
|
34
34
|
model: Model;
|
|
35
|
-
toParentMessage: (message: Toggled) =>
|
|
36
|
-
toView: (attributes: CheckboxAttributes<
|
|
35
|
+
toParentMessage: (message: Toggled) => ParentMessage;
|
|
36
|
+
toView: (attributes: CheckboxAttributes<ParentMessage>) => Html;
|
|
37
37
|
isDisabled?: boolean;
|
|
38
38
|
isIndeterminate?: boolean;
|
|
39
39
|
name?: string;
|
|
40
40
|
value?: string;
|
|
41
41
|
}>;
|
|
42
42
|
/** Renders an accessible checkbox by building ARIA attribute groups and delegating layout to the consumer's `toView` callback. */
|
|
43
|
-
export declare const view: <
|
|
43
|
+
export declare const view: <ParentMessage>(config: ViewConfig<ParentMessage>) => Html;
|
|
44
44
|
/** Creates a memoized checkbox view. Static config is captured in a closure;
|
|
45
45
|
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
46
|
-
export declare const lazy: <
|
|
46
|
+
export declare const lazy: <ParentMessage>(staticConfig: Omit<ViewConfig<ParentMessage>, "model" | "toParentMessage">) => ((model: Model, toParentMessage: ViewConfig<ParentMessage>["toParentMessage"]) => Html);
|
|
47
47
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAExD,OAAO,K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,aAAa,CAAC,KAAK,IAAI,CAAA;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC,CAAA;AAKF,kIAAkI;AAClI,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,QAAQ,UAAU,CAAC,aAAa,CAAC,KAChC,IA2EF,CAAA;AAED;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,cAAc,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC,KACzE,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,iBAAiB,CAAC,KAC1D,IAAI,CAgBR,CAAA"}
|
|
@@ -73,9 +73,9 @@ export const view = (config) => {
|
|
|
73
73
|
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
74
74
|
export const lazy = (staticConfig) => {
|
|
75
75
|
const lazyView = createLazy();
|
|
76
|
-
return (model, toParentMessage) => lazyView((currentModel,
|
|
76
|
+
return (model, toParentMessage) => lazyView((currentModel, currentToParentMessage) => view({
|
|
77
77
|
...staticConfig,
|
|
78
78
|
model: currentModel,
|
|
79
|
-
toParentMessage:
|
|
79
|
+
toParentMessage: currentToParentMessage,
|
|
80
80
|
}), [model, toParentMessage]);
|
|
81
81
|
};
|
|
@@ -95,6 +95,8 @@ export declare const update: (model: {
|
|
|
95
95
|
readonly _tag: "CompletedClickItem";
|
|
96
96
|
} | {
|
|
97
97
|
readonly _tag: "CompletedAnchorMount";
|
|
98
|
+
} | {
|
|
99
|
+
readonly _tag: "CompletedBackdropPortal";
|
|
98
100
|
} | {
|
|
99
101
|
readonly _tag: "Opened";
|
|
100
102
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
@@ -153,9 +155,9 @@ export declare const close: (model: Model) => readonly [Model, ReadonlyArray<Com
|
|
|
153
155
|
/** Programmatically toggles an item in the multi-select combobox. Use this in domain-event handlers when the combobox uses `onSelectedItem`. */
|
|
154
156
|
export declare const selectItem: (model: Model, item: string) => readonly [Model, ReadonlyArray<Command.Command<Message>>];
|
|
155
157
|
/** Configuration for rendering a multi-select combobox with `view`. */
|
|
156
|
-
export type ViewConfig<
|
|
158
|
+
export type ViewConfig<ParentMessage, Item extends string> = BaseViewConfig<ParentMessage, Item, Model>;
|
|
157
159
|
/** Renders a headless multi-select combobox with keyboard navigation, selection tracking, and aria-activedescendant focus management. */
|
|
158
|
-
export declare const view: <
|
|
160
|
+
export declare const view: <ParentMessage, Item extends string>(config: Readonly<{
|
|
159
161
|
model: {
|
|
160
162
|
readonly id: string;
|
|
161
163
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
@@ -184,8 +186,10 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
|
|
|
184
186
|
readonly _tag: "CompletedAttachPreventBlur";
|
|
185
187
|
} | {
|
|
186
188
|
readonly _tag: "CompletedAttachSelectOnFocus";
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
+
} | {
|
|
190
|
+
readonly _tag: "CompletedBackdropPortal";
|
|
191
|
+
}) => ParentMessage;
|
|
192
|
+
onSelectedItem?: (value: string) => ParentMessage;
|
|
189
193
|
items: readonly Item[];
|
|
190
194
|
itemToConfig: (item: Item, context: Readonly<{
|
|
191
195
|
isActive: boolean;
|
|
@@ -199,21 +203,21 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
|
|
|
199
203
|
itemToDisplayText: (item: Item, index: number) => string;
|
|
200
204
|
isItemDisabled?: (item: Item, index: number) => boolean;
|
|
201
205
|
inputClassName?: string;
|
|
202
|
-
inputAttributes?: readonly import("../../html/index.js").Attribute<
|
|
206
|
+
inputAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
203
207
|
inputPlaceholder?: string;
|
|
204
208
|
inputWrapperClassName?: string;
|
|
205
|
-
inputWrapperAttributes?: readonly import("../../html/index.js").Attribute<
|
|
209
|
+
inputWrapperAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
206
210
|
itemsClassName?: string;
|
|
207
|
-
itemsAttributes?: readonly import("../../html/index.js").Attribute<
|
|
211
|
+
itemsAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
208
212
|
itemsScrollClassName?: string;
|
|
209
|
-
itemsScrollAttributes?: readonly import("../../html/index.js").Attribute<
|
|
213
|
+
itemsScrollAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
210
214
|
backdropClassName?: string;
|
|
211
|
-
backdropAttributes?: readonly import("../../html/index.js").Attribute<
|
|
215
|
+
backdropAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
212
216
|
className?: string;
|
|
213
|
-
attributes?: readonly import("../../html/index.js").Attribute<
|
|
217
|
+
attributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
214
218
|
buttonContent?: Html;
|
|
215
219
|
buttonClassName?: string;
|
|
216
|
-
buttonAttributes?: readonly import("../../html/index.js").Attribute<
|
|
220
|
+
buttonAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
217
221
|
formName?: string;
|
|
218
222
|
isDisabled?: boolean;
|
|
219
223
|
isInvalid?: boolean;
|
|
@@ -224,9 +228,9 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
|
|
|
224
228
|
className?: string;
|
|
225
229
|
}> | undefined;
|
|
226
230
|
groupClassName?: string;
|
|
227
|
-
groupAttributes?: readonly import("../../html/index.js").Attribute<
|
|
231
|
+
groupAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
228
232
|
separatorClassName?: string;
|
|
229
|
-
separatorAttributes?: readonly import("../../html/index.js").Attribute<
|
|
233
|
+
separatorAttributes?: readonly import("../../html/index.js").Attribute<ParentMessage>[];
|
|
230
234
|
anchor?: Readonly<{
|
|
231
235
|
placement?: import("@floating-ui/dom").Placement;
|
|
232
236
|
gap?: number;
|
|
@@ -237,5 +241,5 @@ export declare const view: <Message, Item extends string>(config: Readonly<{
|
|
|
237
241
|
}>) => Html;
|
|
238
242
|
/** Creates a memoized multi-select combobox 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 extends string>(staticConfig: Omit<ViewConfig<ParentMessage, Item>, "model" | "toParentMessage" | "onSelectedItem">) => ((model: Model, toParentMessage: BaseViewConfig<ParentMessage, Item, Model>["toParentMessage"]) => Html);
|
|
241
245
|
//# sourceMappingURL=multi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi.d.ts","sourceRoot":"","sources":["../../../src/ui/combobox/multi.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,MAAM,EACN,YAAY,EAKb,MAAM,aAAa,CAAA;AAIpB,yIAAyI;AACzI,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;EAGhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,8RAA8R;AAC9R,MAAM,MAAM,UAAU,GAAG,cAAc,GACrC,QAAQ,CAAC;IACP,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACtC,CAAC,CAAA;AAEJ,2IAA2I;AAC3I,eAAO,MAAM,IAAI,GAAI,QAAQ,UAAU,KAAG,KAGxC,CAAA;AAcF,yJAAy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,CAAC,OAAO,CAAC,CAAC,CAClC,CAAA;AAEzB,gJAAgJ;AAChJ,eAAO,MAAM,UAAU,GACrB,OAAO,KAAK,EACZ,MAAM,MAAM,KACX,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CACD,CAAA;AAI1D,uEAAuE;AACvE,MAAM,MAAM,UAAU,CAAC,aAAa,EAAE,IAAI,SAAS,MAAM,IAAI,cAAc,CACzE,aAAa,EACb,IAAI,EACJ,KAAK,CACN,CAAA;AAED,yIAAyI;AACzI,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAIf,CAAA;AAEF;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,aAAa,EAAE,IAAI,SAAS,MAAM,EACrD,cAAc,IAAI,CAChB,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,EAC/B,OAAO,GAAG,iBAAiB,GAAG,gBAAgB,CAC/C,KACA,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,cAAc,CAC7B,aAAa,EACb,IAAI,EACJ,KAAK,CACN,CAAC,iBAAiB,CAAC,KACjB,IAAI,CAoBR,CAAA"}
|
|
@@ -56,9 +56,9 @@ export const view = makeView({
|
|
|
56
56
|
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
57
57
|
export const lazy = (staticConfig) => {
|
|
58
58
|
const lazyView = createLazy();
|
|
59
|
-
return (model, toParentMessage) => lazyView((currentModel,
|
|
59
|
+
return (model, toParentMessage) => lazyView((currentModel, currentToParentMessage) => view({
|
|
60
60
|
...staticConfig,
|
|
61
61
|
model: currentModel,
|
|
62
|
-
toParentMessage:
|
|
62
|
+
toParentMessage: currentToParentMessage,
|
|
63
63
|
}), [model, toParentMessage]);
|
|
64
64
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { init, update, open, close, selectItem, view, lazy, Model, } from './single.js';
|
|
2
|
-
export { Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedAttachPreventBlur, CompletedAttachSelectOnFocus, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusInput, ScrollIntoView, ClickItem, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
2
|
+
export { Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedAttachPreventBlur, CompletedAttachSelectOnFocus, CompletedBackdropPortal, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusInput, ScrollIntoView, ClickItem, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
3
3
|
export type { ActivationTrigger, Opened, Closed, BlurredInput, ActivatedItem, DeactivatedItem, MovedPointerOverItem, RequestedItemClick, UpdatedInputValue, PressedToggleButton, 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/combobox/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,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,SAAS,EACT,4BAA4B,GAC7B,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,YAAY,EACZ,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,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/combobox/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,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,uBAAuB,EACvB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,SAAS,EACT,4BAA4B,GAC7B,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,iBAAiB,EACjB,MAAM,EACN,MAAM,EACN,YAAY,EACZ,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,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, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedAttachPreventBlur, CompletedAttachSelectOnFocus, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusInput, ScrollIntoView, ClickItem, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
2
|
+
export { Message, SelectedItem, CompletedLockScroll, CompletedUnlockScroll, CompletedSetupInert, CompletedTeardownInert, CompletedFocusInput, CompletedScrollIntoView, CompletedClickItem, CompletedAnchorMount, CompletedAttachPreventBlur, CompletedAttachSelectOnFocus, CompletedBackdropPortal, GotAnimationMessage, LockScroll, UnlockScroll, InertOthers, RestoreInert, FocusInput, ScrollIntoView, ClickItem, DetectMovementOrAnimationEnd, } from './shared.js';
|
|
3
3
|
export * as Multi from './multiPublic.js';
|
|
@@ -95,6 +95,8 @@ export declare const CompletedAnchorMount: import("../../schema/index.js").Calla
|
|
|
95
95
|
export declare const CompletedAttachPreventBlur: import("../../schema/index.js").CallableTaggedStruct<"CompletedAttachPreventBlur", {}>;
|
|
96
96
|
/** Sent when the input mounts and the focus listener that auto-selects on focus is attached. Update no-ops; surfaces the listener-attach side effect for DevTools. */
|
|
97
97
|
export declare const CompletedAttachSelectOnFocus: import("../../schema/index.js").CallableTaggedStruct<"CompletedAttachSelectOnFocus", {}>;
|
|
98
|
+
/** Sent when the combobox backdrop mounts and is portaled to the document body. Update no-ops; surfaces the portal side effect for DevTools. */
|
|
99
|
+
export declare const CompletedBackdropPortal: import("../../schema/index.js").CallableTaggedStruct<"CompletedBackdropPortal", {}>;
|
|
98
100
|
/** Wraps an Animation submodel message for delegation. */
|
|
99
101
|
export declare const GotAnimationMessage: import("../../schema/index.js").CallableTaggedStruct<"GotAnimationMessage", {
|
|
100
102
|
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", {}>]>;
|
|
@@ -125,6 +127,7 @@ export declare const Message: S.Union<[
|
|
|
125
127
|
typeof CompletedAnchorMount,
|
|
126
128
|
typeof CompletedAttachPreventBlur,
|
|
127
129
|
typeof CompletedAttachSelectOnFocus,
|
|
130
|
+
typeof CompletedBackdropPortal,
|
|
128
131
|
typeof GotAnimationMessage,
|
|
129
132
|
typeof UpdatedInputValue,
|
|
130
133
|
typeof PressedToggleButton
|
|
@@ -226,6 +229,8 @@ export declare const makeUpdate: <Model extends BaseModel>(handlers: Readonly<{
|
|
|
226
229
|
readonly _tag: "CompletedClickItem";
|
|
227
230
|
} | {
|
|
228
231
|
readonly _tag: "CompletedAnchorMount";
|
|
232
|
+
} | {
|
|
233
|
+
readonly _tag: "CompletedBackdropPortal";
|
|
229
234
|
} | {
|
|
230
235
|
readonly _tag: "Opened";
|
|
231
236
|
readonly maybeActiveItemIndex: Option.Option<number>;
|
|
@@ -286,10 +291,10 @@ export type GroupHeading = Readonly<{
|
|
|
286
291
|
className?: string;
|
|
287
292
|
}>;
|
|
288
293
|
/** Configuration for rendering a combobox with `view`. */
|
|
289
|
-
export type BaseViewConfig<
|
|
294
|
+
export type BaseViewConfig<ParentMessage, Item extends string, Model extends BaseModel> = Readonly<{
|
|
290
295
|
model: Model;
|
|
291
|
-
toParentMessage: (message: Opened | Closed | BlurredInput | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | UpdatedInputValue | PressedToggleButton | typeof CompletedAnchorMount.Type | typeof CompletedAttachPreventBlur.Type | typeof CompletedAttachSelectOnFocus.Type) =>
|
|
292
|
-
onSelectedItem?: (value: string) =>
|
|
296
|
+
toParentMessage: (message: Opened | Closed | BlurredInput | ActivatedItem | DeactivatedItem | SelectedItem | MovedPointerOverItem | RequestedItemClick | UpdatedInputValue | PressedToggleButton | typeof CompletedAnchorMount.Type | typeof CompletedAttachPreventBlur.Type | typeof CompletedAttachSelectOnFocus.Type | typeof CompletedBackdropPortal.Type) => ParentMessage;
|
|
297
|
+
onSelectedItem?: (value: string) => ParentMessage;
|
|
293
298
|
items: ReadonlyArray<Item>;
|
|
294
299
|
itemToConfig: (item: Item, context: Readonly<{
|
|
295
300
|
isActive: boolean;
|
|
@@ -300,21 +305,21 @@ export type BaseViewConfig<Message, Item extends string, Model extends BaseModel
|
|
|
300
305
|
itemToDisplayText: (item: Item, index: number) => string;
|
|
301
306
|
isItemDisabled?: (item: Item, index: number) => boolean;
|
|
302
307
|
inputClassName?: string;
|
|
303
|
-
inputAttributes?: ReadonlyArray<Attribute<
|
|
308
|
+
inputAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
304
309
|
inputPlaceholder?: string;
|
|
305
310
|
inputWrapperClassName?: string;
|
|
306
|
-
inputWrapperAttributes?: ReadonlyArray<Attribute<
|
|
311
|
+
inputWrapperAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
307
312
|
itemsClassName?: string;
|
|
308
|
-
itemsAttributes?: ReadonlyArray<Attribute<
|
|
313
|
+
itemsAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
309
314
|
itemsScrollClassName?: string;
|
|
310
|
-
itemsScrollAttributes?: ReadonlyArray<Attribute<
|
|
315
|
+
itemsScrollAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
311
316
|
backdropClassName?: string;
|
|
312
|
-
backdropAttributes?: ReadonlyArray<Attribute<
|
|
317
|
+
backdropAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
313
318
|
className?: string;
|
|
314
|
-
attributes?: ReadonlyArray<Attribute<
|
|
319
|
+
attributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
315
320
|
buttonContent?: Html;
|
|
316
321
|
buttonClassName?: string;
|
|
317
|
-
buttonAttributes?: ReadonlyArray<Attribute<
|
|
322
|
+
buttonAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
318
323
|
formName?: string;
|
|
319
324
|
isDisabled?: boolean;
|
|
320
325
|
isInvalid?: boolean;
|
|
@@ -322,9 +327,9 @@ export type BaseViewConfig<Message, Item extends string, Model extends BaseModel
|
|
|
322
327
|
itemGroupKey?: (item: Item, index: number) => string;
|
|
323
328
|
groupToHeading?: (groupKey: string) => GroupHeading | undefined;
|
|
324
329
|
groupClassName?: string;
|
|
325
|
-
groupAttributes?: ReadonlyArray<Attribute<
|
|
330
|
+
groupAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
326
331
|
separatorClassName?: string;
|
|
327
|
-
separatorAttributes?: ReadonlyArray<Attribute<
|
|
332
|
+
separatorAttributes?: ReadonlyArray<Attribute<ParentMessage>>;
|
|
328
333
|
anchor?: AnchorConfig;
|
|
329
334
|
}>;
|
|
330
335
|
/** Variant-specific view behavior injected into the shared combobox view factory. */
|
|
@@ -333,5 +338,5 @@ export type ViewBehavior<Model extends BaseModel> = Readonly<{
|
|
|
333
338
|
ariaMultiSelectable: boolean;
|
|
334
339
|
}>;
|
|
335
340
|
/** Creates a combobox view function from variant-specific behavior. Shared rendering logic (input, items, transitions, keyboard navigation) is handled internally; only selection display varies by variant. */
|
|
336
|
-
export declare const makeView: <Model extends BaseModel>(behavior: ViewBehavior<Model>) => <
|
|
341
|
+
export declare const makeView: <Model extends BaseModel>(behavior: ViewBehavior<Model>) => <ParentMessage, Item extends string>(config: BaseViewConfig<ParentMessage, Item, Model>) => Html;
|
|
337
342
|
//# sourceMappingURL=shared.d.ts.map
|