foldkit 0.119.0 → 0.120.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/dom/dom.d.ts +9 -9
- package/dist/dom/dom.d.ts.map +1 -1
- package/dist/dom/dom.js +9 -9
- package/dist/dom/index.d.ts +1 -1
- package/dist/dom/index.d.ts.map +1 -1
- package/dist/dom/index.js +1 -1
- package/dist/dom/public.d.ts +1 -1
- package/dist/dom/public.d.ts.map +1 -1
- package/dist/dom/public.js +1 -1
- package/dist/html/index.d.ts +640 -0
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +129 -1
- package/dist/subscription/fromEvent.d.ts +59 -0
- package/dist/subscription/fromEvent.d.ts.map +1 -0
- package/dist/subscription/fromEvent.js +50 -0
- package/dist/subscription/public.d.ts +2 -0
- package/dist/subscription/public.d.ts.map +1 -1
- package/dist/subscription/public.js +1 -0
- package/dist/test/apps/svgAttributes.d.ts +11 -0
- package/dist/test/apps/svgAttributes.d.ts.map +1 -0
- package/dist/test/apps/svgAttributes.js +106 -0
- package/package.json +1 -1
package/dist/dom/dom.d.ts
CHANGED
|
@@ -48,44 +48,44 @@ export declare const focus: (selector: string, options?: Readonly<{
|
|
|
48
48
|
*
|
|
49
49
|
* Pass `focusSelector` to focus an element inside the dialog when it opens.
|
|
50
50
|
*
|
|
51
|
-
* Records the element that had focus when the dialog opened so `
|
|
51
|
+
* Records the element that had focus when the dialog opened so `closeDialog`
|
|
52
52
|
* can return focus there, the way `showModal()` would natively.
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```typescript
|
|
56
|
-
* Dom.
|
|
57
|
-
* Dom.
|
|
56
|
+
* Dom.showDialog('#my-dialog')
|
|
57
|
+
* Dom.showDialog('#my-dialog', { focusSelector: '#search-input' })
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
|
-
export declare const
|
|
60
|
+
export declare const showDialog: (selector: string, options?: Readonly<{
|
|
61
61
|
focusSelector?: string;
|
|
62
62
|
}>) => Effect.Effect<void, ElementNotFound>;
|
|
63
63
|
/**
|
|
64
64
|
* Closes a dialog element using `.close()`.
|
|
65
|
-
* Cleans up the keyboard handlers installed by `
|
|
65
|
+
* Cleans up the keyboard handlers installed by `showDialog` and restores focus to
|
|
66
66
|
* the element that was focused before the dialog opened (the trigger, or the
|
|
67
67
|
* dialog beneath it when closing a stacked dialog).
|
|
68
68
|
* Fails with `ElementNotFound` if the selector does not match an `HTMLDialogElement`.
|
|
69
69
|
*
|
|
70
70
|
* @example
|
|
71
71
|
* ```typescript
|
|
72
|
-
* Dom.
|
|
72
|
+
* Dom.closeDialog('#my-dialog')
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
|
-
export declare const
|
|
75
|
+
export declare const closeDialog: (selector: string) => Effect.Effect<void, ElementNotFound>;
|
|
76
76
|
/**
|
|
77
77
|
* Releases the framework hygiene a dialog holds while open: the focus-trap
|
|
78
78
|
* keyboard handler, the recorded return focus, the dialog stack entry, the
|
|
79
79
|
* z-index counter, and one page scroll lock. Use this as a backstop for the
|
|
80
80
|
* case where a dialog's element is removed from the DOM without a purposeful
|
|
81
81
|
* close, the classic example being navigation away from a route-keyed subtree
|
|
82
|
-
* that contains the dialog. The normal close path (`
|
|
82
|
+
* that contains the dialog. The normal close path (`closeDialog` plus the
|
|
83
83
|
* Dialog component's `unlockScroll` Command) already releases these, so this
|
|
84
84
|
* is the missing teardown when no close Message ever flows through `update`.
|
|
85
85
|
*
|
|
86
86
|
* Addressed by the dialog's id, not a selector, because the element is
|
|
87
87
|
* typically already gone from the DOM by the time this runs (that is the whole
|
|
88
|
-
* point of the backstop). The hygiene installed by `
|
|
88
|
+
* point of the backstop). The hygiene installed by `showDialog` is tracked by
|
|
89
89
|
* id so it can be reclaimed without a live element handle. The id must be
|
|
90
90
|
* non-empty and unique within the document, since it keys this cleanup
|
|
91
91
|
* accounting; a duplicate or empty id would release the wrong dialog's hygiene.
|
package/dist/dom/dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/dom/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAMP,MAAM,QAAQ,CAAA;AAGf,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AA4C5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,KAAK,GAChB,UAAU,MAAM,EAChB,UAAU,QAAQ,CAAC;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACvE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAQlC,CAAA;AAEJ;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/dom/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAMP,MAAM,QAAQ,CAAA;AAGf,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AA4C5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,KAAK,GAChB,UAAU,MAAM,EAChB,UAAU,QAAQ,CAAC;IAAE,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACvE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAQlC,CAAA;AAEJ;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,GACrB,UAAU,MAAM,EAChB,UAAU,QAAQ,CAAC;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,KAC7C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAyElC,CAAA;AAuBJ;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,W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I,EAAE,eAAe,CAiClC,CAAA"}
|
package/dist/dom/dom.js
CHANGED
|
@@ -72,16 +72,16 @@ export const focus = (selector, options) => Effect.gen(function* () {
|
|
|
72
72
|
*
|
|
73
73
|
* Pass `focusSelector` to focus an element inside the dialog when it opens.
|
|
74
74
|
*
|
|
75
|
-
* Records the element that had focus when the dialog opened so `
|
|
75
|
+
* Records the element that had focus when the dialog opened so `closeDialog`
|
|
76
76
|
* can return focus there, the way `showModal()` would natively.
|
|
77
77
|
*
|
|
78
78
|
* @example
|
|
79
79
|
* ```typescript
|
|
80
|
-
* Dom.
|
|
81
|
-
* Dom.
|
|
80
|
+
* Dom.showDialog('#my-dialog')
|
|
81
|
+
* Dom.showDialog('#my-dialog', { focusSelector: '#search-input' })
|
|
82
82
|
* ```
|
|
83
83
|
*/
|
|
84
|
-
export const
|
|
84
|
+
export const showDialog = (selector, options) => Effect.gen(function* () {
|
|
85
85
|
yield* afterCommit;
|
|
86
86
|
const element = document.querySelector(selector);
|
|
87
87
|
if (!(element instanceof HTMLDialogElement)) {
|
|
@@ -146,17 +146,17 @@ const trapFocusWithinDialog = (event, dialog) => {
|
|
|
146
146
|
};
|
|
147
147
|
/**
|
|
148
148
|
* Closes a dialog element using `.close()`.
|
|
149
|
-
* Cleans up the keyboard handlers installed by `
|
|
149
|
+
* Cleans up the keyboard handlers installed by `showDialog` and restores focus to
|
|
150
150
|
* the element that was focused before the dialog opened (the trigger, or the
|
|
151
151
|
* dialog beneath it when closing a stacked dialog).
|
|
152
152
|
* Fails with `ElementNotFound` if the selector does not match an `HTMLDialogElement`.
|
|
153
153
|
*
|
|
154
154
|
* @example
|
|
155
155
|
* ```typescript
|
|
156
|
-
* Dom.
|
|
156
|
+
* Dom.closeDialog('#my-dialog')
|
|
157
157
|
* ```
|
|
158
158
|
*/
|
|
159
|
-
export const
|
|
159
|
+
export const closeDialog = (selector) => Effect.suspend(() => {
|
|
160
160
|
const element = document.querySelector(selector);
|
|
161
161
|
if (element instanceof HTMLDialogElement) {
|
|
162
162
|
element.close();
|
|
@@ -186,13 +186,13 @@ const releaseDialogHygieneById = (id) => {
|
|
|
186
186
|
* z-index counter, and one page scroll lock. Use this as a backstop for the
|
|
187
187
|
* case where a dialog's element is removed from the DOM without a purposeful
|
|
188
188
|
* close, the classic example being navigation away from a route-keyed subtree
|
|
189
|
-
* that contains the dialog. The normal close path (`
|
|
189
|
+
* that contains the dialog. The normal close path (`closeDialog` plus the
|
|
190
190
|
* Dialog component's `unlockScroll` Command) already releases these, so this
|
|
191
191
|
* is the missing teardown when no close Message ever flows through `update`.
|
|
192
192
|
*
|
|
193
193
|
* Addressed by the dialog's id, not a selector, because the element is
|
|
194
194
|
* typically already gone from the DOM by the time this runs (that is the whole
|
|
195
|
-
* point of the backstop). The hygiene installed by `
|
|
195
|
+
* point of the backstop). The hygiene installed by `showDialog` is tracked by
|
|
196
196
|
* id so it can be reclaimed without a live element handle. The id must be
|
|
197
197
|
* non-empty and unique within the document, since it keys this cleanup
|
|
198
198
|
* accounting; a duplicate or empty id would release the wrong dialog's hygiene.
|
package/dist/dom/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ElementNotFound } from './error.js';
|
|
2
|
-
export { advanceFocus, clickElement,
|
|
2
|
+
export { advanceFocus, clickElement, closeDialog, focus, releaseDialogResources, scrollIntoView, scrollIntoViewAfterPaint, scrollIntoViewIfNotVisible, showDialog, } from './dom.js';
|
|
3
3
|
export type { FocusDirection } from './dom.js';
|
|
4
4
|
export { detectElementMovement } from './elementMovement.js';
|
|
5
5
|
export { inertOthers, restoreInert } from './inert.js';
|
package/dist/dom/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dom/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dom/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,sBAAsB,EACtB,cAAc,EACd,wBAAwB,EACxB,0BAA0B,EAC1B,UAAU,GACX,MAAM,UAAU,CAAA;AACjB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA"}
|
package/dist/dom/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ElementNotFound } from './error.js';
|
|
2
|
-
export { advanceFocus, clickElement,
|
|
2
|
+
export { advanceFocus, clickElement, closeDialog, focus, releaseDialogResources, scrollIntoView, scrollIntoViewAfterPaint, scrollIntoViewIfNotVisible, showDialog, } from './dom.js';
|
|
3
3
|
export { detectElementMovement } from './elementMovement.js';
|
|
4
4
|
export { inertOthers, restoreInert } from './inert.js';
|
|
5
5
|
export { lockScroll, unlockScroll } from './scrollLock.js';
|
package/dist/dom/public.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ElementNotFound, advanceFocus, clickElement,
|
|
1
|
+
export { ElementNotFound, advanceFocus, clickElement, closeDialog, detectElementMovement, focus, inertOthers, lockScroll, releaseDialogResources, restoreInert, scrollIntoView, scrollIntoViewAfterPaint, scrollIntoViewIfNotVisible, showDialog, unlockScroll, waitForAnimationSettled, } from './index.js';
|
|
2
2
|
export type { FocusDirection } from './index.js';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
package/dist/dom/public.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/dom/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/dom/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,KAAK,EACL,WAAW,EACX,UAAU,EACV,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,wBAAwB,EACxB,0BAA0B,EAC1B,UAAU,EACV,YAAY,EACZ,uBAAuB,GACxB,MAAM,YAAY,CAAA;AACnB,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/dom/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ElementNotFound, advanceFocus, clickElement,
|
|
1
|
+
export { ElementNotFound, advanceFocus, clickElement, closeDialog, detectElementMovement, focus, inertOthers, lockScroll, releaseDialogResources, restoreInert, scrollIntoView, scrollIntoViewAfterPaint, scrollIntoViewIfNotVisible, showDialog, unlockScroll, waitForAnimationSettled, } from './index.js';
|