@floegence/floe-webapp-core 0.86.34 → 0.86.37
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/chat.css +16 -10
- package/dist/components/ui/KeyedFor.d.ts +9 -0
- package/dist/components/ui/KeyedFor.js +32 -0
- package/dist/components/ui/Stepper.js +43 -33
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/full.js +354 -352
- package/dist/hooks/useOverlayMask.d.ts +2 -0
- package/dist/hooks/useOverlayMask.js +62 -60
- package/dist/styles.css +1 -1
- package/dist/ui.js +87 -85
- package/package.json +1 -1
|
@@ -8,6 +8,8 @@ export interface UseOverlayMaskOptions {
|
|
|
8
8
|
/** Ordered focus regions that belong to one overlay, including persistent navigation. */
|
|
9
9
|
focusRoots?: Accessor<readonly HTMLElement[]>;
|
|
10
10
|
onClose?: () => void;
|
|
11
|
+
/** Outside pointer/focus interactions routed only to the owning overlay layer. */
|
|
12
|
+
onInteractOutside?: (event: PointerEvent | FocusEvent) => void;
|
|
11
13
|
/** Treat additional nodes as part of the overlay surface (e.g. portaled layers). */
|
|
12
14
|
containsTarget?: (target: EventTarget | null) => boolean;
|
|
13
15
|
/** Optional alternate close path for Escape pressed outside the overlay surface. */
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { lockBodyStyle as
|
|
3
|
-
import { deferAfterPaint as
|
|
4
|
-
import { getFocusableElements as
|
|
5
|
-
import { matchKeybind as
|
|
1
|
+
import { createEffect as U, onCleanup as X } from "solid-js";
|
|
2
|
+
import { lockBodyStyle as Y } from "../utils/bodyStyleLock.js";
|
|
3
|
+
import { deferAfterPaint as x } from "../utils/defer.js";
|
|
4
|
+
import { getFocusableElements as I, getFirstFocusableElement as Z } from "../utils/focus.js";
|
|
5
|
+
import { matchKeybind as _ } from "../utils/keybind.js";
|
|
6
6
|
const H = /* @__PURE__ */ new WeakMap();
|
|
7
7
|
function A(t) {
|
|
8
8
|
return typeof Node < "u" && t instanceof Node;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function g(t, o, c) {
|
|
11
11
|
return c ? c(o) : !t || !A(o) ? !1 : t.contains(o);
|
|
12
12
|
}
|
|
13
|
-
function W(t, o, c,
|
|
14
|
-
return c === "none" ? !1 : c === "all" ? !0 : !
|
|
13
|
+
function W(t, o, c, f) {
|
|
14
|
+
return c === "none" ? !1 : c === "all" ? !0 : !g(t, o, f);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function $(t) {
|
|
17
17
|
return typeof t == "function" ? t() ?? [] : t ?? [];
|
|
18
18
|
}
|
|
19
19
|
function s(t, o) {
|
|
20
20
|
return typeof t == "function" ? t() ?? o : t ?? o;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
for (const c of
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
22
|
+
function ee(t, o) {
|
|
23
|
+
for (const c of $(o)) {
|
|
24
|
+
const f = c.trim();
|
|
25
|
+
if (f && _(t, f))
|
|
26
26
|
return !0;
|
|
27
27
|
}
|
|
28
28
|
return !1;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const o = () => s(t.lockBodyScroll, !0), c = () => s(t.trapFocus, !0),
|
|
32
|
-
const
|
|
30
|
+
function se(t) {
|
|
31
|
+
const o = () => s(t.lockBodyScroll, !0), c = () => s(t.trapFocus, !0), f = () => {
|
|
32
|
+
const l = s(
|
|
33
33
|
t.closeOnEscape,
|
|
34
34
|
!0
|
|
35
35
|
);
|
|
36
|
-
return
|
|
37
|
-
},
|
|
38
|
-
|
|
36
|
+
return l === !1 ? "none" : l === "inside" ? "inside" : l === "none" ? "none" : "always";
|
|
37
|
+
}, R = () => s(t.blockHotkeys, !0), N = () => s(t.restoreFocus, !0), q = () => s(t.blockWheel, "none"), j = () => s(t.blockTouchMove, "none"), z = () => s(t.autoFocus, !0);
|
|
38
|
+
U(() => {
|
|
39
39
|
if (!t.open() || typeof document > "u") return;
|
|
40
|
-
const
|
|
40
|
+
const l = o(), L = c(), v = f(), y = s(t.escapeKeyPhase, "capture"), V = R(), G = N(), E = q(), k = j(), b = z(), d = H.get(document) ?? [];
|
|
41
41
|
H.set(document, d);
|
|
42
|
-
const
|
|
43
|
-
global:
|
|
44
|
-
contains: (e) =>
|
|
42
|
+
const h = {
|
|
43
|
+
global: l || v === "always",
|
|
44
|
+
contains: (e) => g(t.root(), e, t.containsTarget)
|
|
45
45
|
};
|
|
46
|
-
d.push(
|
|
47
|
-
let
|
|
48
|
-
const
|
|
49
|
-
|
|
46
|
+
d.push(h);
|
|
47
|
+
let O = !0;
|
|
48
|
+
const a = (e) => O && !d.slice(d.indexOf(h) + 1).some((n) => n.global || n.contains(e)), w = document.activeElement instanceof HTMLElement ? document.activeElement : null, J = l ? Y({ overflow: "hidden" }) : null;
|
|
49
|
+
x(() => {
|
|
50
50
|
const e = t.root();
|
|
51
|
-
if (!e?.isConnected || !
|
|
52
|
-
const n = typeof
|
|
51
|
+
if (!e?.isConnected || !a(e) || b === !1 || h.contains(document.activeElement)) return;
|
|
52
|
+
const n = typeof b == "object" ? b.selector : void 0, r = (n ? e.querySelector(n) : null) ?? e.querySelector("[data-floe-autofocus]") ?? Z(e) ?? e;
|
|
53
53
|
try {
|
|
54
54
|
r.focus({ preventScroll: !0 });
|
|
55
55
|
} catch {
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
const
|
|
59
|
-
if (e.key !== "Tab" || !
|
|
58
|
+
const T = (e) => {
|
|
59
|
+
if (e.key !== "Tab" || !a(e.target)) return;
|
|
60
60
|
const n = t.root();
|
|
61
61
|
if (!n) return;
|
|
62
|
-
const m = t.focusRoots?.() ?? [n], r = t.focusRoots ? [...new Set(m.flatMap(
|
|
62
|
+
const m = t.focusRoots?.() ?? [n], r = t.focusRoots ? [...new Set(m.flatMap(I))].filter((u) => u.tabIndex >= 0 && !u.closest('[hidden], [inert], [aria-hidden="true"]')) : I(n);
|
|
63
63
|
if (!r.length) {
|
|
64
64
|
e.preventDefault();
|
|
65
65
|
try {
|
|
@@ -68,30 +68,30 @@ function ue(t) {
|
|
|
68
68
|
}
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const P = r[0], K = r[r.length - 1], i = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
72
72
|
if (t.focusRoots) {
|
|
73
|
-
const u =
|
|
74
|
-
e.preventDefault(), r[
|
|
73
|
+
const u = i ? r.indexOf(i) : -1, Q = u < 0 ? e.shiftKey ? r.length - 1 : 0 : (u + (e.shiftKey ? -1 : 1) + r.length) % r.length;
|
|
74
|
+
e.preventDefault(), r[Q]?.focus({ preventScroll: !0 });
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
if (e.shiftKey) {
|
|
78
|
-
if (
|
|
78
|
+
if (i === P || !i || !m.some((u) => u.contains(i))) {
|
|
79
79
|
e.preventDefault();
|
|
80
80
|
try {
|
|
81
|
-
|
|
81
|
+
K.focus();
|
|
82
82
|
} catch {
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
} else if (
|
|
85
|
+
} else if (i === K || !i || !m.some((u) => u.contains(i))) {
|
|
86
86
|
e.preventDefault();
|
|
87
87
|
try {
|
|
88
|
-
|
|
88
|
+
P.focus();
|
|
89
89
|
} catch {
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}, M = (e) => {
|
|
93
|
-
if (e.key !== "Escape" || !
|
|
94
|
-
const n = t.root(), m =
|
|
93
|
+
if (e.key !== "Escape" || !a(e.target) || y === "bubble" && (e.defaultPrevented || e.isComposing) || v === "none") return;
|
|
94
|
+
const n = t.root(), m = g(
|
|
95
95
|
n,
|
|
96
96
|
A(e.target) ? e.target : document.activeElement,
|
|
97
97
|
t.containsTarget
|
|
@@ -105,41 +105,43 @@ function ue(t) {
|
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
|
|
108
|
-
}, O = (e) => {
|
|
109
|
-
if (!l(e.target)) return;
|
|
110
|
-
const n = t.root();
|
|
111
|
-
n && z && p(n, e.target, t.containsTarget) && ($(e, t.allowHotkeys) || e.stopPropagation());
|
|
112
108
|
}, B = (e) => {
|
|
113
|
-
if (!
|
|
109
|
+
if (!a(e.target)) return;
|
|
114
110
|
const n = t.root();
|
|
115
|
-
|
|
111
|
+
n && V && g(n, e.target, t.containsTarget) && (ee(e, t.allowHotkeys) || e.stopPropagation());
|
|
116
112
|
}, F = (e) => {
|
|
117
|
-
|
|
113
|
+
if (!a(e.target)) return;
|
|
114
|
+
const n = t.root();
|
|
115
|
+
W(n, e.target, E, t.containsTarget) && e.cancelable && e.preventDefault();
|
|
118
116
|
}, S = (e) => {
|
|
119
|
-
|
|
117
|
+
a(e.target) && e.stopPropagation();
|
|
118
|
+
}, C = (e) => {
|
|
119
|
+
if (!a(e.target)) return;
|
|
120
120
|
const n = t.root();
|
|
121
121
|
W(n, e.target, k, t.containsTarget) && e.cancelable && e.preventDefault();
|
|
122
|
+
}, p = (e) => {
|
|
123
|
+
a(e.target) && !h.contains(e.target) && t.onInteractOutside?.(e);
|
|
122
124
|
};
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
v !== "none" &&
|
|
125
|
+
t.onInteractOutside && (document.addEventListener("pointerdown", p, !0), document.addEventListener("focusin", p)), L && document.addEventListener("keydown", T, !0);
|
|
126
|
+
const D = y === "capture" ? window : document;
|
|
127
|
+
v !== "none" && D.addEventListener(
|
|
126
128
|
"keydown",
|
|
127
129
|
M,
|
|
128
|
-
|
|
129
|
-
), document.addEventListener("keydown",
|
|
130
|
+
y === "capture"
|
|
131
|
+
), document.addEventListener("keydown", B), E !== "none" && (document.addEventListener("wheel", F, { capture: !0, passive: !1 }), document.addEventListener("wheel", S)), k !== "none" && document.addEventListener("touchmove", C, {
|
|
130
132
|
capture: !0,
|
|
131
133
|
passive: !1
|
|
132
|
-
}),
|
|
133
|
-
|
|
134
|
+
}), X(() => {
|
|
135
|
+
O = !1, document.removeEventListener("pointerdown", p, !0), document.removeEventListener("focusin", p), d.splice(d.indexOf(h), 1), L && document.removeEventListener("keydown", T, !0), v !== "none" && D.removeEventListener(
|
|
134
136
|
"keydown",
|
|
135
137
|
M,
|
|
136
|
-
|
|
137
|
-
), document.removeEventListener("keydown",
|
|
138
|
+
y === "capture"
|
|
139
|
+
), document.removeEventListener("keydown", B), E !== "none" && (document.removeEventListener("wheel", F, !0), document.removeEventListener("wheel", S)), k !== "none" && document.removeEventListener("touchmove", C, !0), J?.(), G && w && w.isConnected && x(() => {
|
|
138
140
|
if (typeof document > "u") return;
|
|
139
141
|
const e = document.activeElement;
|
|
140
142
|
if (!(e && e !== document.body && e !== document.documentElement))
|
|
141
143
|
try {
|
|
142
|
-
|
|
144
|
+
w.focus({ preventScroll: !0 });
|
|
143
145
|
} catch {
|
|
144
146
|
}
|
|
145
147
|
});
|
|
@@ -147,5 +149,5 @@ function ue(t) {
|
|
|
147
149
|
});
|
|
148
150
|
}
|
|
149
151
|
export {
|
|
150
|
-
|
|
152
|
+
se as useOverlayMask
|
|
151
153
|
};
|