@floegence/floe-webapp-core 0.50.2 → 0.50.4
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 +0 -6
- package/dist/components/chat/input/ChatInput.js +50 -49
- package/dist/components/file-browser/FileBrowserToolbar.js +2 -2
- package/dist/components/ui/CommandPalette.js +1 -1
- package/dist/components/ui/Dialog.d.ts +7 -0
- package/dist/components/ui/Dialog.js +82 -76
- package/dist/components/ui/DirectoryInput.js +31 -30
- package/dist/components/ui/Input.js +133 -129
- package/dist/components/ui/Pagination.js +2 -2
- package/dist/floe.css +43 -1
- package/dist/hooks/useOverlayMask.d.ts +2 -0
- package/dist/hooks/useOverlayMask.js +61 -41
- package/dist/styles.css +1 -1
- package/dist/workbench.css +0 -4
- package/package.json +1 -1
|
@@ -1,53 +1,56 @@
|
|
|
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 N, onCleanup as q } from "solid-js";
|
|
2
|
+
import { lockBodyStyle as j } from "../utils/bodyStyleLock.js";
|
|
3
|
+
import { deferAfterPaint as M } from "../utils/defer.js";
|
|
4
|
+
import { getFocusableElements as x, getFirstFocusableElement as z } from "../utils/focus.js";
|
|
5
|
+
import { matchKeybind as R } from "../utils/keybind.js";
|
|
6
|
+
function C(e) {
|
|
7
7
|
return typeof Node < "u" && e instanceof Node;
|
|
8
8
|
}
|
|
9
9
|
function h(e, o, r) {
|
|
10
|
-
return r ? r(o) : !e || !
|
|
10
|
+
return r ? r(o) : !e || !C(o) ? !1 : e.contains(o);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function O(e, o, r, s) {
|
|
13
13
|
return r === "none" ? !1 : r === "all" ? !0 : !h(e, o, s);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function V(e) {
|
|
16
16
|
return typeof e == "function" ? e() ?? [] : e ?? [];
|
|
17
17
|
}
|
|
18
18
|
function c(e, o) {
|
|
19
19
|
return typeof e == "function" ? e() ?? o : e ?? o;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
for (const r of
|
|
21
|
+
function G(e, o) {
|
|
22
|
+
for (const r of V(o)) {
|
|
23
23
|
const s = r.trim();
|
|
24
|
-
if (s &&
|
|
24
|
+
if (s && R(e, s))
|
|
25
25
|
return !0;
|
|
26
26
|
}
|
|
27
27
|
return !1;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function _(e) {
|
|
30
30
|
const o = () => c(e.lockBodyScroll, !0), r = () => c(e.trapFocus, !0), s = () => {
|
|
31
|
-
const a = c(
|
|
31
|
+
const a = c(
|
|
32
|
+
e.closeOnEscape,
|
|
33
|
+
!0
|
|
34
|
+
);
|
|
32
35
|
return a === !1 ? "none" : a === "inside" ? "inside" : a === "none" ? "none" : "always";
|
|
33
|
-
},
|
|
34
|
-
|
|
36
|
+
}, P = () => c(e.blockHotkeys, !0), D = () => c(e.restoreFocus, !0), S = () => c(e.blockWheel, "none"), H = () => c(e.blockTouchMove, "none"), K = () => c(e.autoFocus, !0);
|
|
37
|
+
N(() => {
|
|
35
38
|
if (!e.open() || typeof document > "u") return;
|
|
36
|
-
const a = o(),
|
|
37
|
-
|
|
39
|
+
const a = o(), E = r(), l = s(), f = c(e.escapeKeyPhase, "capture"), W = P(), A = D(), m = S(), v = H(), y = K(), p = document.activeElement instanceof HTMLElement ? document.activeElement : null, I = a ? j({ overflow: "hidden" }) : null;
|
|
40
|
+
M(() => {
|
|
38
41
|
const t = e.root();
|
|
39
|
-
if (!t ||
|
|
40
|
-
const n = typeof
|
|
42
|
+
if (!t || y === !1) return;
|
|
43
|
+
const n = typeof y == "object" ? y.selector : void 0, i = (n ? t.querySelector(n) : null) ?? t.querySelector("[data-floe-autofocus]") ?? z(t) ?? t;
|
|
41
44
|
try {
|
|
42
|
-
|
|
45
|
+
i.focus();
|
|
43
46
|
} catch {
|
|
44
47
|
}
|
|
45
48
|
});
|
|
46
|
-
const
|
|
49
|
+
const k = (t) => {
|
|
47
50
|
if (t.key !== "Tab") return;
|
|
48
51
|
const n = e.root();
|
|
49
52
|
if (!n) return;
|
|
50
|
-
const u =
|
|
53
|
+
const u = x(n);
|
|
51
54
|
if (!u.length) {
|
|
52
55
|
t.preventDefault();
|
|
53
56
|
try {
|
|
@@ -56,25 +59,29 @@ function Y(e) {
|
|
|
56
59
|
}
|
|
57
60
|
return;
|
|
58
61
|
}
|
|
59
|
-
const
|
|
62
|
+
const i = u[0], F = u[u.length - 1], d = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
60
63
|
if (t.shiftKey) {
|
|
61
|
-
if (
|
|
64
|
+
if (d === i || !d || !n.contains(d)) {
|
|
62
65
|
t.preventDefault();
|
|
63
66
|
try {
|
|
64
|
-
|
|
67
|
+
F.focus();
|
|
65
68
|
} catch {
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
|
-
} else if (
|
|
71
|
+
} else if (d === F) {
|
|
69
72
|
t.preventDefault();
|
|
70
73
|
try {
|
|
71
|
-
|
|
74
|
+
i.focus();
|
|
72
75
|
} catch {
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
|
-
},
|
|
76
|
-
if (t.key !== "Escape" || l === "none") return;
|
|
77
|
-
const n = e.root(), u = h(
|
|
78
|
+
}, b = (t) => {
|
|
79
|
+
if (t.key !== "Escape" || f === "bubble" && (t.defaultPrevented || t.isComposing) || l === "none") return;
|
|
80
|
+
const n = e.root(), u = h(
|
|
81
|
+
n,
|
|
82
|
+
C(t.target) ? t.target : document.activeElement,
|
|
83
|
+
e.containsTarget
|
|
84
|
+
);
|
|
78
85
|
if (l === "inside") {
|
|
79
86
|
if (u) {
|
|
80
87
|
t.preventDefault(), t.stopImmediatePropagation(), e.onClose?.();
|
|
@@ -84,25 +91,38 @@ function Y(e) {
|
|
|
84
91
|
return;
|
|
85
92
|
}
|
|
86
93
|
t.preventDefault(), t.stopImmediatePropagation(), e.onClose?.();
|
|
87
|
-
},
|
|
94
|
+
}, g = (t) => {
|
|
88
95
|
const n = e.root();
|
|
89
|
-
n &&
|
|
96
|
+
n && W && h(n, t.target, e.containsTarget) && (G(t, e.allowHotkeys) || t.stopPropagation());
|
|
90
97
|
}, w = (t) => {
|
|
91
98
|
const n = e.root();
|
|
92
|
-
|
|
93
|
-
}, g = (t) => {
|
|
94
|
-
t.stopPropagation();
|
|
99
|
+
O(n, t.target, m, e.containsTarget) && t.cancelable && t.preventDefault();
|
|
95
100
|
}, L = (t) => {
|
|
101
|
+
t.stopPropagation();
|
|
102
|
+
}, T = (t) => {
|
|
96
103
|
const n = e.root();
|
|
97
|
-
|
|
104
|
+
O(n, t.target, v, e.containsTarget) && t.cancelable && t.preventDefault();
|
|
98
105
|
};
|
|
99
|
-
|
|
100
|
-
|
|
106
|
+
E && document.addEventListener("keydown", k, !0);
|
|
107
|
+
const B = f === "capture" ? window : document;
|
|
108
|
+
l !== "none" && B.addEventListener(
|
|
109
|
+
"keydown",
|
|
110
|
+
b,
|
|
111
|
+
f === "capture"
|
|
112
|
+
), document.addEventListener("keydown", g), m !== "none" && (document.addEventListener("wheel", w, { capture: !0, passive: !1 }), document.addEventListener("wheel", L)), v !== "none" && document.addEventListener("touchmove", T, {
|
|
113
|
+
capture: !0,
|
|
114
|
+
passive: !1
|
|
115
|
+
}), q(() => {
|
|
116
|
+
E && document.removeEventListener("keydown", k, !0), l !== "none" && B.removeEventListener(
|
|
117
|
+
"keydown",
|
|
118
|
+
b,
|
|
119
|
+
f === "capture"
|
|
120
|
+
), document.removeEventListener("keydown", g), m !== "none" && (document.removeEventListener("wheel", w, !0), document.removeEventListener("wheel", L)), v !== "none" && document.removeEventListener("touchmove", T, !0), I?.(), A && p && p.isConnected && M(() => {
|
|
101
121
|
if (typeof document > "u") return;
|
|
102
122
|
const t = document.activeElement;
|
|
103
123
|
if (!(t && t !== document.body && t !== document.documentElement))
|
|
104
124
|
try {
|
|
105
|
-
|
|
125
|
+
p.focus();
|
|
106
126
|
} catch {
|
|
107
127
|
}
|
|
108
128
|
});
|
|
@@ -110,5 +130,5 @@ function Y(e) {
|
|
|
110
130
|
});
|
|
111
131
|
}
|
|
112
132
|
export {
|
|
113
|
-
|
|
133
|
+
_ as useOverlayMask
|
|
114
134
|
};
|