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