@floegence/floe-webapp-core 0.101.30 → 0.101.33
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/layout/ActivityBar.js +82 -77
- package/dist/components/layout/barReorder.js +109 -91
- package/dist/components/ui/Dialog.js +84 -83
- package/dist/components/ui/Dropdown.js +103 -103
- package/dist/components/ui/Tooltip.d.ts +3 -0
- package/dist/components/ui/Tooltip.js +77 -38
- package/dist/components/ui/dialogSurfaceScope.js +68 -67
- package/dist/components/workbench/WorkbenchFilterBar.js +135 -135
- package/dist/hooks/useOverlayMask.js +81 -80
- package/dist/utils/domScope.d.ts +6 -0
- package/dist/utils/domScope.js +30 -0
- package/package.json +1 -1
|
@@ -1,66 +1,67 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { lockBodyStyle as
|
|
3
|
-
import { deferAfterPaint as
|
|
4
|
-
import { getFocusableElements as
|
|
5
|
-
import { matchKeybind as
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { createEffect as $, onCleanup as ee } from "solid-js";
|
|
2
|
+
import { lockBodyStyle as te } from "../utils/bodyStyleLock.js";
|
|
3
|
+
import { deferAfterPaint as N } from "../utils/defer.js";
|
|
4
|
+
import { getFocusableElements as q, getFirstFocusableElement as ne } from "../utils/focus.js";
|
|
5
|
+
import { matchKeybind as oe } from "../utils/keybind.js";
|
|
6
|
+
import { deepActiveElement as y, composedEventTarget as r, composedContains as M } from "../utils/domScope.js";
|
|
7
|
+
const T = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
function z(t) {
|
|
8
9
|
return typeof Node < "u" && t instanceof Node;
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
11
|
+
function g(t, o, u) {
|
|
12
|
+
return u ? u(o) : !t || !z(o) ? !1 : M(t, o);
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
14
|
+
function j(t, o, u, m) {
|
|
15
|
+
return u === "none" ? !1 : u === "all" ? !0 : !g(t, o, m);
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function re(t) {
|
|
17
18
|
return typeof t == "function" ? t() ?? [] : t ?? [];
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function f(t, o) {
|
|
20
21
|
return typeof t == "function" ? t() ?? o : t ?? o;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
for (const
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
23
|
+
function ce(t, o) {
|
|
24
|
+
for (const u of re(o)) {
|
|
25
|
+
const m = u.trim();
|
|
26
|
+
if (m && oe(t, m))
|
|
26
27
|
return !0;
|
|
27
28
|
}
|
|
28
29
|
return !1;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
const o = () =>
|
|
32
|
-
const
|
|
31
|
+
function me(t) {
|
|
32
|
+
const o = () => f(t.lockBodyScroll, !0), u = () => f(t.trapFocus, !0), m = () => {
|
|
33
|
+
const v = f(
|
|
33
34
|
t.closeOnEscape,
|
|
34
35
|
!0
|
|
35
36
|
);
|
|
36
|
-
return
|
|
37
|
-
},
|
|
38
|
-
|
|
37
|
+
return v === !1 ? "none" : v === "inside" ? "inside" : v === "none" ? "none" : "always";
|
|
38
|
+
}, V = () => f(t.blockHotkeys, !0), G = () => f(t.restoreFocus, !0), J = () => f(t.blockWheel, "none"), Q = () => f(t.blockTouchMove, "none"), U = () => f(t.autoFocus, !0);
|
|
39
|
+
$(() => {
|
|
39
40
|
if (!t.open() || typeof document > "u") return;
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
global:
|
|
44
|
-
contains: (e) =>
|
|
41
|
+
const v = o(), B = u(), p = m(), E = f(t.escapeKeyPhase, "capture"), X = V(), Y = G(), w = J(), L = Q(), O = U(), h = T.get(document) ?? [];
|
|
42
|
+
T.set(document, h);
|
|
43
|
+
const l = {
|
|
44
|
+
global: v || p === "always",
|
|
45
|
+
contains: (e) => g(t.root(), e, t.containsTarget)
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
-
let
|
|
48
|
-
const
|
|
49
|
-
|
|
47
|
+
h.push(l);
|
|
48
|
+
let F = !0;
|
|
49
|
+
const s = (e) => F && !h.slice(h.indexOf(l) + 1).some((n) => n.global || n.contains(e)), C = y(document), k = C instanceof HTMLElement ? C : null, Z = v ? te({ overflow: "hidden" }) : null;
|
|
50
|
+
N(() => {
|
|
50
51
|
const e = t.root();
|
|
51
|
-
if (!e?.isConnected || !
|
|
52
|
-
const n = typeof
|
|
52
|
+
if (!e?.isConnected || !s(e) || O === !1 || l.contains(y(document))) return;
|
|
53
|
+
const n = typeof O == "object" ? O.selector : void 0, c = (n ? e.querySelector(n) : null) ?? e.querySelector("[data-floe-autofocus]") ?? ne(e) ?? e;
|
|
53
54
|
try {
|
|
54
|
-
|
|
55
|
+
c.focus({ preventScroll: !0 });
|
|
55
56
|
} catch {
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
|
-
const
|
|
59
|
-
if (e.key !== "Tab" || !
|
|
59
|
+
const S = (e) => {
|
|
60
|
+
if (e.key !== "Tab" || !s(r(e)) || !l.global && !l.contains(r(e))) return;
|
|
60
61
|
const n = t.root();
|
|
61
62
|
if (!n) return;
|
|
62
|
-
const
|
|
63
|
-
if (!
|
|
63
|
+
const a = t.focusRoots?.() ?? [n], c = t.focusRoots ? [...new Set(a.flatMap(q))].filter((i) => i.tabIndex >= 0 && !i.closest('[hidden], [inert], [aria-hidden="true"]')) : q(n);
|
|
64
|
+
if (!c.length) {
|
|
64
65
|
e.preventDefault();
|
|
65
66
|
try {
|
|
66
67
|
n.focus();
|
|
@@ -68,36 +69,36 @@ function se(t) {
|
|
|
68
69
|
}
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
|
-
const
|
|
72
|
+
const W = c[0], A = c[c.length - 1], R = y(document), d = R instanceof HTMLElement ? R : null;
|
|
72
73
|
if (t.focusRoots) {
|
|
73
|
-
const
|
|
74
|
-
e.preventDefault(),
|
|
74
|
+
const i = d ? c.indexOf(d) : -1, _ = i < 0 ? e.shiftKey ? c.length - 1 : 0 : (i + (e.shiftKey ? -1 : 1) + c.length) % c.length;
|
|
75
|
+
e.preventDefault(), c[_]?.focus({ preventScroll: !0 });
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
78
|
if (e.shiftKey) {
|
|
78
|
-
if (
|
|
79
|
+
if (d === W || !d || !a.some((i) => M(i, d))) {
|
|
79
80
|
e.preventDefault();
|
|
80
81
|
try {
|
|
81
|
-
|
|
82
|
+
A.focus();
|
|
82
83
|
} catch {
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
} else if (
|
|
86
|
+
} else if (d === A || !d || !a.some((i) => M(i, d))) {
|
|
86
87
|
e.preventDefault();
|
|
87
88
|
try {
|
|
88
|
-
|
|
89
|
+
W.focus();
|
|
89
90
|
} catch {
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
},
|
|
93
|
-
if (e.key !== "Escape" || !
|
|
94
|
-
const n = t.root(),
|
|
93
|
+
}, P = (e) => {
|
|
94
|
+
if (e.key !== "Escape" || !s(r(e)) || E === "bubble" && (e.defaultPrevented || e.isComposing) || p === "none") return;
|
|
95
|
+
const n = t.root(), a = g(
|
|
95
96
|
n,
|
|
96
|
-
|
|
97
|
+
z(r(e)) ? r(e) : y(document),
|
|
97
98
|
t.containsTarget
|
|
98
99
|
);
|
|
99
|
-
if (
|
|
100
|
-
if (
|
|
100
|
+
if (p === "inside") {
|
|
101
|
+
if (a) {
|
|
101
102
|
e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
@@ -105,43 +106,43 @@ function se(t) {
|
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
108
|
e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
|
|
108
|
-
},
|
|
109
|
-
if (!
|
|
109
|
+
}, D = (e) => {
|
|
110
|
+
if (!s(r(e))) return;
|
|
110
111
|
const n = t.root();
|
|
111
|
-
n &&
|
|
112
|
-
},
|
|
113
|
-
if (!
|
|
112
|
+
n && X && g(n, r(e), t.containsTarget) && (ce(e, t.allowHotkeys) || e.stopPropagation());
|
|
113
|
+
}, K = (e) => {
|
|
114
|
+
if (!s(r(e))) return;
|
|
114
115
|
const n = t.root();
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
if (!
|
|
116
|
+
j(n, r(e), w, t.containsTarget) && e.cancelable && e.preventDefault();
|
|
117
|
+
}, x = (e) => {
|
|
118
|
+
s(r(e)) && e.stopPropagation();
|
|
119
|
+
}, I = (e) => {
|
|
120
|
+
if (!s(r(e))) return;
|
|
120
121
|
const n = t.root();
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
e.composedPath().some((
|
|
122
|
+
j(n, r(e), L, t.containsTarget) && e.cancelable && e.preventDefault();
|
|
123
|
+
}, b = (e) => {
|
|
124
|
+
e.composedPath().some((a) => !s(a) || l.contains(a)) || s(e.target) && !l.contains(e.target) && t.onInteractOutside?.(e);
|
|
124
125
|
};
|
|
125
|
-
t.onInteractOutside && (document.addEventListener("pointerdown",
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
t.onInteractOutside && (document.addEventListener("pointerdown", b, !0), document.addEventListener("focusin", b)), B && document.addEventListener("keydown", S, !0);
|
|
127
|
+
const H = E === "capture" ? window : document;
|
|
128
|
+
p !== "none" && H.addEventListener(
|
|
128
129
|
"keydown",
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
), document.addEventListener("keydown",
|
|
130
|
+
P,
|
|
131
|
+
E === "capture"
|
|
132
|
+
), document.addEventListener("keydown", D), w !== "none" && (document.addEventListener("wheel", K, { capture: !0, passive: !1 }), document.addEventListener("wheel", x)), L !== "none" && document.addEventListener("touchmove", I, {
|
|
132
133
|
capture: !0,
|
|
133
134
|
passive: !1
|
|
134
|
-
}),
|
|
135
|
-
|
|
135
|
+
}), ee(() => {
|
|
136
|
+
F = !1, document.removeEventListener("pointerdown", b, !0), document.removeEventListener("focusin", b), h.splice(h.indexOf(l), 1), B && document.removeEventListener("keydown", S, !0), p !== "none" && H.removeEventListener(
|
|
136
137
|
"keydown",
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
), document.removeEventListener("keydown",
|
|
140
|
-
if (typeof document > "u" ||
|
|
141
|
-
const e = document
|
|
138
|
+
P,
|
|
139
|
+
E === "capture"
|
|
140
|
+
), document.removeEventListener("keydown", D), w !== "none" && (document.removeEventListener("wheel", K, !0), document.removeEventListener("wheel", x)), L !== "none" && document.removeEventListener("touchmove", I, !0), Z?.(), Y && k && k.isConnected && N(() => {
|
|
141
|
+
if (typeof document > "u" || T.get(document)?.some((n) => !n.contains(k))) return;
|
|
142
|
+
const e = y(document);
|
|
142
143
|
if (!(e && e !== document.body && e !== document.documentElement))
|
|
143
144
|
try {
|
|
144
|
-
|
|
145
|
+
k.focus({ preventScroll: !0 });
|
|
145
146
|
} catch {
|
|
146
147
|
}
|
|
147
148
|
});
|
|
@@ -149,5 +150,5 @@ function se(t) {
|
|
|
149
150
|
});
|
|
150
151
|
}
|
|
151
152
|
export {
|
|
152
|
-
|
|
153
|
+
me as useOverlayMask
|
|
153
154
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Resolve the actual control while document listeners see a retargeted shadow host. */
|
|
2
|
+
export declare function composedEventTarget(event: Event): EventTarget | null;
|
|
3
|
+
export declare function deepActiveElement(root: Document | ShadowRoot): Element | null;
|
|
4
|
+
export declare function composedParent(node: Node): Node | null;
|
|
5
|
+
export declare function composedContains(root: Node, target: EventTarget | null): boolean;
|
|
6
|
+
export declare function composedClosest(target: EventTarget | null, selector: string): Element | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function i(e) {
|
|
2
|
+
return e.composedPath()[0] ?? e.target;
|
|
3
|
+
}
|
|
4
|
+
function r(e) {
|
|
5
|
+
let n = e.activeElement;
|
|
6
|
+
for (; n?.shadowRoot?.activeElement; ) n = n.shadowRoot.activeElement;
|
|
7
|
+
return n;
|
|
8
|
+
}
|
|
9
|
+
function o(e) {
|
|
10
|
+
return e instanceof Element && e.assignedSlot ? e.assignedSlot : e.parentNode ?? (e instanceof ShadowRoot ? e.host : null);
|
|
11
|
+
}
|
|
12
|
+
function l(e, n) {
|
|
13
|
+
if (typeof Node > "u") return !1;
|
|
14
|
+
for (let t = n instanceof Node ? n : null; t; t = o(t))
|
|
15
|
+
if (t === e) return !0;
|
|
16
|
+
return !1;
|
|
17
|
+
}
|
|
18
|
+
function f(e, n) {
|
|
19
|
+
if (typeof Node > "u") return null;
|
|
20
|
+
for (let t = e instanceof Node ? e : null; t; t = o(t))
|
|
21
|
+
if (t instanceof Element && t.matches(n)) return t;
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
f as composedClosest,
|
|
26
|
+
l as composedContains,
|
|
27
|
+
i as composedEventTarget,
|
|
28
|
+
o as composedParent,
|
|
29
|
+
r as deepActiveElement
|
|
30
|
+
};
|