@floegence/floe-webapp-core 0.36.1 → 0.36.3
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/components/deck/DeckCell.js +4 -4
- package/dist/components/ui/Dialog.js +120 -87
- package/dist/components/ui/FloatingWindow.js +158 -144
- package/dist/components/ui/InfiniteCanvas.js +80 -77
- package/dist/components/ui/dialogSurfaceScope.d.ts +14 -0
- package/dist/components/ui/dialogSurfaceScope.js +45 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/localInteractionSurface.d.ts +11 -0
- package/dist/components/ui/localInteractionSurface.js +20 -0
- package/dist/components/workbench/WorkbenchCanvas.js +54 -60
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +25 -0
- package/dist/components/workbench/WorkbenchCanvasField.js +145 -0
- package/dist/components/workbench/WorkbenchWidget.d.ts +10 -2
- package/dist/components/workbench/WorkbenchWidget.js +74 -74
- package/dist/full.js +497 -492
- package/dist/hooks/useOverlayMask.d.ts +11 -9
- package/dist/hooks/useOverlayMask.js +54 -52
- package/dist/styles.css +1 -1
- package/dist/ui.js +90 -85
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Accessor } from 'solid-js';
|
|
2
2
|
export type OverlayScrollBlockMode = 'none' | 'outside' | 'all';
|
|
3
3
|
export type OverlayEscapeCloseMode = 'none' | 'inside' | 'always';
|
|
4
|
+
type MaybeAccessor<T> = T | Accessor<T>;
|
|
4
5
|
export interface UseOverlayMaskOptions {
|
|
5
6
|
open: Accessor<boolean>;
|
|
6
7
|
root: Accessor<HTMLElement | undefined>;
|
|
@@ -10,17 +11,17 @@ export interface UseOverlayMaskOptions {
|
|
|
10
11
|
/** Optional alternate close path for Escape pressed outside the overlay surface. */
|
|
11
12
|
onEscapeOutside?: () => void;
|
|
12
13
|
/** Lock `document.body` scroll while the overlay is open (default: true). */
|
|
13
|
-
lockBodyScroll?: boolean
|
|
14
|
+
lockBodyScroll?: MaybeAccessor<boolean | undefined>;
|
|
14
15
|
/** Prevent scroll via wheel events (default: none). */
|
|
15
|
-
blockWheel?: OverlayScrollBlockMode
|
|
16
|
+
blockWheel?: MaybeAccessor<OverlayScrollBlockMode | undefined>;
|
|
16
17
|
/** Prevent scroll via touch-move events (default: none). */
|
|
17
|
-
blockTouchMove?: OverlayScrollBlockMode
|
|
18
|
+
blockTouchMove?: MaybeAccessor<OverlayScrollBlockMode | undefined>;
|
|
18
19
|
/** Keep tab focus within the overlay root (default: true). */
|
|
19
|
-
trapFocus?: boolean
|
|
20
|
+
trapFocus?: MaybeAccessor<boolean | undefined>;
|
|
20
21
|
/** Close on Escape and never leak to underlying window handlers (default: always). */
|
|
21
|
-
closeOnEscape?: boolean | OverlayEscapeCloseMode
|
|
22
|
+
closeOnEscape?: MaybeAccessor<boolean | OverlayEscapeCloseMode | undefined>;
|
|
22
23
|
/** Stop bubbling keydown events to window-level hotkeys (default: true). */
|
|
23
|
-
blockHotkeys?: boolean
|
|
24
|
+
blockHotkeys?: MaybeAccessor<boolean | undefined>;
|
|
24
25
|
/**
|
|
25
26
|
* Allow a small set of global keybinds to continue bubbling to window-level handlers
|
|
26
27
|
* while the overlay is focused. This is primarily used by floating overlays that must
|
|
@@ -28,10 +29,11 @@ export interface UseOverlayMaskOptions {
|
|
|
28
29
|
*/
|
|
29
30
|
allowHotkeys?: readonly string[] | Accessor<readonly string[] | undefined>;
|
|
30
31
|
/** Auto-focus on open (default: true). */
|
|
31
|
-
autoFocus?: boolean | {
|
|
32
|
+
autoFocus?: MaybeAccessor<boolean | {
|
|
32
33
|
selector?: string;
|
|
33
|
-
}
|
|
34
|
+
} | undefined>;
|
|
34
35
|
/** Restore focus to the previously active element on close (default: true). */
|
|
35
|
-
restoreFocus?: boolean
|
|
36
|
+
restoreFocus?: MaybeAccessor<boolean | undefined>;
|
|
36
37
|
}
|
|
37
38
|
export declare function useOverlayMask(options: UseOverlayMaskOptions): void;
|
|
39
|
+
export {};
|
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { lockBodyStyle as
|
|
3
|
-
import { deferAfterPaint as
|
|
4
|
-
import { getFocusableElements as
|
|
5
|
-
import { matchKeybind as
|
|
6
|
-
function
|
|
1
|
+
import { createEffect as K, onCleanup as I } from "solid-js";
|
|
2
|
+
import { lockBodyStyle as N } from "../utils/bodyStyleLock.js";
|
|
3
|
+
import { deferAfterPaint as B } from "../utils/defer.js";
|
|
4
|
+
import { getFocusableElements as q, getFirstFocusableElement as j } from "../utils/focus.js";
|
|
5
|
+
import { matchKeybind as x } from "../utils/keybind.js";
|
|
6
|
+
function M(e) {
|
|
7
7
|
return typeof Node < "u" && e instanceof Node;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return r ? r(
|
|
9
|
+
function h(e, o, r) {
|
|
10
|
+
return r ? r(o) : !e || !M(o) ? !1 : e.contains(o);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return r === "none" ? !1 : r === "all" ? !0 : !
|
|
12
|
+
function F(e, o, r, s) {
|
|
13
|
+
return r === "none" ? !1 : r === "all" ? !0 : !h(e, o, s);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function z(e) {
|
|
16
16
|
return typeof e == "function" ? e() ?? [] : e ?? [];
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
function c(e, o) {
|
|
19
|
+
return typeof e == "function" ? e() ?? o : e ?? o;
|
|
20
|
+
}
|
|
21
|
+
function R(e, o) {
|
|
22
|
+
for (const r of z(o)) {
|
|
23
|
+
const s = r.trim();
|
|
24
|
+
if (s && x(e, s))
|
|
22
25
|
return !0;
|
|
23
26
|
}
|
|
24
27
|
return !1;
|
|
25
28
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
+
function Y(e) {
|
|
30
|
+
const o = () => c(e.lockBodyScroll, !0), r = () => c(e.trapFocus, !0), s = () => {
|
|
31
|
+
const a = c(e.closeOnEscape, !0);
|
|
32
|
+
return a === !1 ? "none" : a === "inside" ? "inside" : a === "none" ? "none" : "always";
|
|
33
|
+
}, O = () => c(e.blockHotkeys, !0), C = () => c(e.restoreFocus, !0), D = () => c(e.blockWheel, "none"), S = () => c(e.blockTouchMove, "none"), H = () => c(e.autoFocus, !0);
|
|
34
|
+
K(() => {
|
|
29
35
|
if (!e.open() || typeof document > "u") return;
|
|
30
|
-
const s = document.activeElement instanceof HTMLElement ? document.activeElement : null,
|
|
31
|
-
|
|
36
|
+
const a = o(), p = r(), l = s(), P = O(), W = C(), d = D(), m = S(), v = H(), y = document.activeElement instanceof HTMLElement ? document.activeElement : null, A = a ? N({ overflow: "hidden" }) : null;
|
|
37
|
+
B(() => {
|
|
32
38
|
const t = e.root();
|
|
33
|
-
if (!t) return;
|
|
34
|
-
const n =
|
|
35
|
-
if (n === !1) return;
|
|
36
|
-
const o = typeof n == "object" ? n.selector : void 0, f = (o ? t.querySelector(o) : null) ?? t.querySelector("[data-floe-autofocus]") ?? D(t) ?? t;
|
|
39
|
+
if (!t || v === !1) return;
|
|
40
|
+
const n = typeof v == "object" ? v.selector : void 0, f = (n ? t.querySelector(n) : null) ?? t.querySelector("[data-floe-autofocus]") ?? j(t) ?? t;
|
|
37
41
|
try {
|
|
38
42
|
f.focus();
|
|
39
43
|
} catch {
|
|
40
44
|
}
|
|
41
45
|
});
|
|
42
|
-
const
|
|
46
|
+
const E = (t) => {
|
|
43
47
|
if (t.key !== "Tab") return;
|
|
44
48
|
const n = e.root();
|
|
45
49
|
if (!n) return;
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
50
|
+
const u = q(n);
|
|
51
|
+
if (!u.length) {
|
|
48
52
|
t.preventDefault();
|
|
49
53
|
try {
|
|
50
54
|
n.focus();
|
|
@@ -52,29 +56,27 @@ function N(e) {
|
|
|
52
56
|
}
|
|
53
57
|
return;
|
|
54
58
|
}
|
|
55
|
-
const
|
|
59
|
+
const f = u[0], T = u[u.length - 1], i = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
56
60
|
if (t.shiftKey) {
|
|
57
|
-
if (
|
|
61
|
+
if (i === f || !i || !n.contains(i)) {
|
|
58
62
|
t.preventDefault();
|
|
59
63
|
try {
|
|
60
|
-
|
|
64
|
+
T.focus();
|
|
61
65
|
} catch {
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
|
-
} else if (
|
|
68
|
+
} else if (i === T) {
|
|
65
69
|
t.preventDefault();
|
|
66
70
|
try {
|
|
67
|
-
|
|
71
|
+
f.focus();
|
|
68
72
|
} catch {
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
|
-
},
|
|
72
|
-
if (t.key !== "Escape") return;
|
|
73
|
-
const n = u();
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
if (n === "inside") {
|
|
77
|
-
if (a) {
|
|
75
|
+
}, k = (t) => {
|
|
76
|
+
if (t.key !== "Escape" || l === "none") return;
|
|
77
|
+
const n = e.root(), u = h(n, M(t.target) ? t.target : document.activeElement, e.containsTarget);
|
|
78
|
+
if (l === "inside") {
|
|
79
|
+
if (u) {
|
|
78
80
|
t.preventDefault(), t.stopImmediatePropagation(), e.onClose?.();
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
@@ -82,25 +84,25 @@ function N(e) {
|
|
|
82
84
|
return;
|
|
83
85
|
}
|
|
84
86
|
t.preventDefault(), t.stopImmediatePropagation(), e.onClose?.();
|
|
85
|
-
},
|
|
87
|
+
}, b = (t) => {
|
|
88
|
+
const n = e.root();
|
|
89
|
+
n && P && h(n, t.target, e.containsTarget) && (R(t, e.allowHotkeys) || t.stopPropagation());
|
|
90
|
+
}, w = (t) => {
|
|
86
91
|
const n = e.root();
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
const n = e.blockWheel ?? "none", o = e.root();
|
|
90
|
-
p(o, t.target, n, e.containsTarget) && t.cancelable && t.preventDefault();
|
|
91
|
-
}, h = (t) => {
|
|
92
|
+
F(n, t.target, d, e.containsTarget) && t.cancelable && t.preventDefault();
|
|
93
|
+
}, g = (t) => {
|
|
92
94
|
t.stopPropagation();
|
|
93
|
-
},
|
|
94
|
-
const n = e.
|
|
95
|
-
|
|
95
|
+
}, L = (t) => {
|
|
96
|
+
const n = e.root();
|
|
97
|
+
F(n, t.target, m, e.containsTarget) && t.cancelable && t.preventDefault();
|
|
96
98
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
p && document.addEventListener("keydown", E, !0), l !== "none" && window.addEventListener("keydown", k, !0), document.addEventListener("keydown", b), d !== "none" && (document.addEventListener("wheel", w, { capture: !0, passive: !1 }), document.addEventListener("wheel", g)), m !== "none" && document.addEventListener("touchmove", L, { capture: !0, passive: !1 }), I(() => {
|
|
100
|
+
p && document.removeEventListener("keydown", E, !0), l !== "none" && window.removeEventListener("keydown", k, !0), document.removeEventListener("keydown", b), d !== "none" && (document.removeEventListener("wheel", w, !0), document.removeEventListener("wheel", g)), m !== "none" && document.removeEventListener("touchmove", L, !0), A?.(), W && y && y.isConnected && B(() => {
|
|
99
101
|
if (typeof document > "u") return;
|
|
100
102
|
const t = document.activeElement;
|
|
101
103
|
if (!(t && t !== document.body && t !== document.documentElement))
|
|
102
104
|
try {
|
|
103
|
-
|
|
105
|
+
y.focus();
|
|
104
106
|
} catch {
|
|
105
107
|
}
|
|
106
108
|
});
|
|
@@ -108,5 +110,5 @@ function N(e) {
|
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
112
|
export {
|
|
111
|
-
|
|
113
|
+
Y as useOverlayMask
|
|
112
114
|
};
|