@foldkit/ui 0.158.1 → 0.158.2-canary.052c86603d9a
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/dialog/index.d.ts +12 -9
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +10 -5
- package/package.json +4 -4
package/dist/dialog/index.d.ts
CHANGED
|
@@ -81,9 +81,11 @@ type UpdateReturn = Update.ReturnWithOutMessage<Model, Message, OutMessage>;
|
|
|
81
81
|
/** Locks page scroll and opens the native dialog element through
|
|
82
82
|
* `Dom.showDialog`, which calls `show()` (not native `showModal()`) so other
|
|
83
83
|
* high-z-index overlays stay interactive. It layers the dialog with a high
|
|
84
|
-
* z-index
|
|
85
|
-
*
|
|
86
|
-
*
|
|
84
|
+
* z-index and traps focus. For an unhandled Escape on the topmost Dialog, the
|
|
85
|
+
* helper dispatches a `CustomEvent` named `cancel`; the Dialog view maps that
|
|
86
|
+
* signal to `RequestedClose` while suppressing native `cancel` events. The
|
|
87
|
+
* Dialog component supplies its own backdrop. If the dialog element is gone
|
|
88
|
+
* by the time the show runs, the lock is released and the Command reports
|
|
87
89
|
* `FailedShowDialog`. A closed dialog has no `OnUnmount`, so nothing else
|
|
88
90
|
* would release the lock. The update function then closes the Model. Without
|
|
89
91
|
* this close, the dialog would render open with no lock and no focus trap.
|
|
@@ -188,11 +190,12 @@ export declare const descriptionId: (model: Model) => string;
|
|
|
188
190
|
/** Render-time payload published to the consumer's `toView`.
|
|
189
191
|
*
|
|
190
192
|
* - `dialog`: attributes for the native `<dialog>` element. Carries
|
|
191
|
-
* the id, ARIA labelling, `open` prop, positioning style,
|
|
192
|
-
*
|
|
193
|
-
* `
|
|
194
|
-
*
|
|
195
|
-
*
|
|
193
|
+
* the id, ARIA labelling, `open` prop, positioning style, a `cancel` handler
|
|
194
|
+
* that prevents a file picker's native cancellation from closing the dialog
|
|
195
|
+
* while mapping `Dom.showDialog`'s Escape signal to `RequestedClose`,
|
|
196
|
+
* and an `OnUnmount` backstop that releases framework hygiene (scroll lock,
|
|
197
|
+
* focus trap, return focus) if the element is removed from the DOM while
|
|
198
|
+
* still open, such as navigating away from a route-keyed subtree.
|
|
196
199
|
* The consumer MUST render an `h.dialog(...)` element so the framework
|
|
197
200
|
* can open and close it, and so the unmount backstop can fire.
|
|
198
201
|
* - `backdrop`: attributes for the backdrop element. Includes the
|
|
@@ -239,7 +242,7 @@ export type ViewInputs = Readonly<{
|
|
|
239
242
|
/** Renders a headless dialog component backed by the native `<dialog>`
|
|
240
243
|
* element. `ShowDialog` opens it through `Dom.showDialog`, which uses `show()`
|
|
241
244
|
* (not native `showModal()`) with a high z-index, a focus trap, a
|
|
242
|
-
* component-supplied backdrop, and
|
|
245
|
+
* component-supplied backdrop, and topmost-only Escape handling. */
|
|
243
246
|
export declare const view: import("foldkit/submodel").View<{
|
|
244
247
|
readonly id: string;
|
|
245
248
|
readonly isOpen: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAA;AAC5D,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAE1C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,IAAI,EAAmB,MAAM,cAAc,CAAA;AAI9E,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAgBxC,6IAA6I;AAC7I,eAAO,MAAM,KAAK;;;;;;;;;;EAMhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,8DAA8D;AAC9D,eAAO,MAAM,OAAO;;;;;;;;;QAQK,OAAO;;;;;;;EAC9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAA;AAC7D,MAAM,MAA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AW,KAAK,KAAG,MAAoC,CAAA;AAE3E;;;;;;;qEAOqE;AACrE,eAAO,MAAM,aAAa,UAAW,KAAK,KAAG,MACX,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAqC4B;AAC5B,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACrC,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACvC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACpC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACpC,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IAC1C,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IAC3C,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IAC1C,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;CACrC,CAAC,CAAA;AAEF;;;qEAGqE;AACrE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAPP,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI;GAgGrC,CAAA"}
|
package/dist/dialog/index.js
CHANGED
|
@@ -62,9 +62,11 @@ export const initialFocusMarkerSelector = `[data-${initialFocusMarkerAttribute}]
|
|
|
62
62
|
/** Locks page scroll and opens the native dialog element through
|
|
63
63
|
* `Dom.showDialog`, which calls `show()` (not native `showModal()`) so other
|
|
64
64
|
* high-z-index overlays stay interactive. It layers the dialog with a high
|
|
65
|
-
* z-index
|
|
66
|
-
*
|
|
67
|
-
*
|
|
65
|
+
* z-index and traps focus. For an unhandled Escape on the topmost Dialog, the
|
|
66
|
+
* helper dispatches a `CustomEvent` named `cancel`; the Dialog view maps that
|
|
67
|
+
* signal to `RequestedClose` while suppressing native `cancel` events. The
|
|
68
|
+
* Dialog component supplies its own backdrop. If the dialog element is gone
|
|
69
|
+
* by the time the show runs, the lock is released and the Command reports
|
|
68
70
|
* `FailedShowDialog`. A closed dialog has no `OnUnmount`, so nothing else
|
|
69
71
|
* would release the lock. The update function then closes the Model. Without
|
|
70
72
|
* this close, the dialog would render open with no lock and no focus trap.
|
|
@@ -238,7 +240,7 @@ export const descriptionId = (model) => __foldkitBrandViewResult((`${model.id}-d
|
|
|
238
240
|
/** Renders a headless dialog component backed by the native `<dialog>`
|
|
239
241
|
* element. `ShowDialog` opens it through `Dom.showDialog`, which uses `show()`
|
|
240
242
|
* (not native `showModal()`) with a high z-index, a focus trap, a
|
|
241
|
-
* component-supplied backdrop, and
|
|
243
|
+
* component-supplied backdrop, and topmost-only Escape handling. */
|
|
242
244
|
export const view = defineView((model, viewInputs, h) => {
|
|
243
245
|
const { id, isOpen, animation: { transitionState }, } = model;
|
|
244
246
|
const { toView } = viewInputs;
|
|
@@ -262,7 +264,10 @@ export const view = defineView((model, viewInputs, h) => {
|
|
|
262
264
|
h.Id(id),
|
|
263
265
|
h.AriaLabelledBy(titleId(model)),
|
|
264
266
|
h.AriaDescribedBy(descriptionId(model)),
|
|
265
|
-
|
|
267
|
+
// NOTE: Chromium reports canceling a file picker as a native `cancel`
|
|
268
|
+
// event observed by the containing dialog. Dom.showDialog uses a
|
|
269
|
+
// CustomEvent for its unhandled-Escape signal, so the two are separable.
|
|
270
|
+
h.OnCancelPreventDefault(Message.RequestedClose()),
|
|
266
271
|
h.Open(isVisible),
|
|
267
272
|
h.Style({
|
|
268
273
|
width: '100%',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foldkit/ui",
|
|
3
|
-
"version": "0.158.
|
|
3
|
+
"version": "0.158.2-canary.052c86603d9a",
|
|
4
4
|
"description": "Headless, accessible UI components for Foldkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
],
|
|
123
123
|
"peerDependencies": {
|
|
124
124
|
"effect": "4.0.0-rc.112",
|
|
125
|
-
"foldkit": "
|
|
125
|
+
"foldkit": "0.158.2-canary.052c86603d9a"
|
|
126
126
|
},
|
|
127
127
|
"dependencies": {
|
|
128
128
|
"@floating-ui/dom": "^1.8.0"
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
"rimraf": "^6.1.3",
|
|
135
135
|
"typescript": "^7.0.2",
|
|
136
136
|
"vitest": "^4.1.11",
|
|
137
|
-
"@foldkit/vite-plugin": "0.20.
|
|
138
|
-
"foldkit": "0.158.
|
|
137
|
+
"@foldkit/vite-plugin": "0.20.2-canary.052c86603d9a",
|
|
138
|
+
"foldkit": "0.158.2-canary.052c86603d9a"
|
|
139
139
|
},
|
|
140
140
|
"keywords": [
|
|
141
141
|
"foldkit",
|