@floegence/floe-webapp-core 0.78.8 → 0.78.10
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/AppViewport.js +40 -21
- package/dist/components/ui/Dialog.js +45 -45
- package/dist/context/NotificationContext.js +9 -9
- package/dist/styles.css +1 -1
- package/dist/utils/focus.d.ts +2 -0
- package/dist/utils/focus.js +10 -6
- package/dist/viewport.d.ts +1 -1
- package/dist/viewport.js +62 -48
- package/dist/window-status.css +2 -2
- package/package.json +1 -1
package/dist/utils/focus.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/** Native editors that can request a software keyboard. */
|
|
2
|
+
export declare function isKeyboardEditingElement(element: Element | null): element is HTMLElement;
|
|
1
3
|
export declare function getFirstFocusableElement(root: ParentNode): HTMLElement | null;
|
|
2
4
|
export declare function getFocusableElements(root: ParentNode): HTMLElement[];
|
package/dist/utils/focus.js
CHANGED
|
@@ -7,19 +7,23 @@ const o = [
|
|
|
7
7
|
'[tabindex]:not([tabindex="-1"])',
|
|
8
8
|
'[contenteditable="true"]'
|
|
9
9
|
].join(",");
|
|
10
|
-
function
|
|
10
|
+
function u(t) {
|
|
11
|
+
return !t || typeof t.focus != "function" || t.matches(':disabled, [readonly], [inputmode="none"]') ? !1 : t.matches('textarea, input:not([type]), input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="tel"], input[type="password"], input[type="number"], [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]');
|
|
12
|
+
}
|
|
13
|
+
function l(t) {
|
|
11
14
|
if (typeof HTMLElement > "u") return null;
|
|
12
15
|
const e = t.querySelector(o);
|
|
13
16
|
return e instanceof HTMLElement ? e : null;
|
|
14
17
|
}
|
|
15
|
-
function
|
|
18
|
+
function r(t) {
|
|
16
19
|
if (typeof HTMLElement > "u") return [];
|
|
17
|
-
const e = [],
|
|
18
|
-
for (const n of
|
|
20
|
+
const e = [], i = t.querySelectorAll(o);
|
|
21
|
+
for (const n of i)
|
|
19
22
|
n instanceof HTMLElement && e.push(n);
|
|
20
23
|
return e;
|
|
21
24
|
}
|
|
22
25
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
l as getFirstFocusableElement,
|
|
27
|
+
r as getFocusableElements,
|
|
28
|
+
u as isKeyboardEditingElement
|
|
25
29
|
};
|
package/dist/viewport.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface ViewportSource {
|
|
|
49
49
|
editing: boolean;
|
|
50
50
|
touch: boolean;
|
|
51
51
|
}
|
|
52
|
-
export declare function resolveViewportSnapshot(source: ViewportSource): ViewportSnapshot;
|
|
52
|
+
export declare function resolveViewportSnapshot(source: ViewportSource, previous?: ViewportSnapshot): ViewportSnapshot;
|
|
53
53
|
export declare function readViewportSnapshot(view: Window): ViewportSnapshot;
|
|
54
54
|
/** One event-driven measurement owner per Window; releasing the last subscription removes it. */
|
|
55
55
|
export declare function observeViewport(view: Window, listener: (snapshot: ViewportSnapshot) => void): () => void;
|
package/dist/viewport.js
CHANGED
|
@@ -1,83 +1,97 @@
|
|
|
1
|
+
import { isKeyboardEditingElement as S } from "./utils/focus.js";
|
|
1
2
|
const p = (t, e) => Number.isFinite(t) && Number(t) > 0 ? Number(t) : Math.max(0, e);
|
|
2
|
-
function
|
|
3
|
-
const
|
|
3
|
+
function V(t, e) {
|
|
4
|
+
const o = t.visualViewport, a = p(o?.width, t.width), c = Math.abs((o?.scale ?? 1) - 1) < 0.01, r = e?.layout.width === t.width && e.layout.height === t.height, i = p(o?.height, r ? e.visible.height : t.height), s = t.fixedOrigin ?? { left: 0, top: 0 }, h = Math.max(0, (o?.offsetLeft || 0) + s.left), d = Math.max(0, (o?.offsetTop || 0) + s.top), f = t.touch && (t.editing || r && e.keyboardOpen) && c && t.height - i > 100;
|
|
4
5
|
return {
|
|
5
|
-
visible: { left:
|
|
6
|
+
visible: { left: h, top: d, width: a, height: i, right: h + a, bottom: d + i },
|
|
6
7
|
layout: { width: t.width, height: t.height },
|
|
7
|
-
safeArea: { ...t.safeArea, bottom:
|
|
8
|
-
keyboardOpen:
|
|
9
|
-
fixedOffset: { left: -
|
|
8
|
+
safeArea: { ...t.safeArea, bottom: f ? 0 : t.safeArea.bottom },
|
|
9
|
+
keyboardOpen: f,
|
|
10
|
+
fixedOffset: { left: -s.left, top: -s.top },
|
|
10
11
|
fixedScale: p(t.fixedScale, 1)
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function v(t) {
|
|
14
15
|
let e = t.activeElement;
|
|
15
16
|
for (; e?.shadowRoot?.activeElement; ) e = e.shadowRoot.activeElement;
|
|
16
|
-
return
|
|
17
|
+
return S(e);
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function E(t) {
|
|
19
20
|
const e = t.document.createElement("div");
|
|
20
21
|
return e.setAttribute("aria-hidden", "true"), e.style.cssText = "position:fixed;top:0;left:0;width:100%;height:100dvh;visibility:hidden;pointer-events:none;box-sizing:border-box;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)", t.document.documentElement.append(e), e;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
width:
|
|
26
|
-
height:
|
|
23
|
+
function b(t, e, o) {
|
|
24
|
+
const a = e.getBoundingClientRect(), c = t.getComputedStyle(e), r = (h) => Math.max(0, Number.parseFloat(h) || 0), i = (h) => h ? p(Number.parseFloat(t.getComputedStyle(h).zoom), 1) : 1, s = i(t.document.documentElement);
|
|
25
|
+
return V({
|
|
26
|
+
width: a.width || t.innerWidth,
|
|
27
|
+
height: a.height / s || t.innerHeight,
|
|
27
28
|
visualViewport: t.visualViewport,
|
|
28
|
-
fixedOrigin: { left:
|
|
29
|
-
fixedScale:
|
|
30
|
-
safeArea: { top:
|
|
31
|
-
editing:
|
|
29
|
+
fixedOrigin: { left: a.left, top: a.top },
|
|
30
|
+
fixedScale: s * i(t.document.body),
|
|
31
|
+
safeArea: { top: r(c.paddingTop), right: r(c.paddingRight), bottom: r(c.paddingBottom), left: r(c.paddingLeft) },
|
|
32
|
+
editing: v(t.document),
|
|
32
33
|
touch: t.matchMedia?.("(any-pointer: coarse)").matches ?? !1
|
|
33
|
-
});
|
|
34
|
+
}, o);
|
|
34
35
|
}
|
|
35
|
-
const
|
|
36
|
-
function
|
|
37
|
-
const e =
|
|
36
|
+
const m = /* @__PURE__ */ new WeakMap();
|
|
37
|
+
function A(t) {
|
|
38
|
+
const e = m.get(t);
|
|
38
39
|
if (e) return e.snapshot;
|
|
39
|
-
const o =
|
|
40
|
+
const o = E(t);
|
|
40
41
|
try {
|
|
41
|
-
return
|
|
42
|
+
return b(t, o);
|
|
42
43
|
} finally {
|
|
43
44
|
o.remove();
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
-
let o =
|
|
47
|
+
function F(t, e) {
|
|
48
|
+
let o = m.get(t);
|
|
48
49
|
if (!o) {
|
|
49
|
-
const
|
|
50
|
-
let r = 0;
|
|
51
|
-
const
|
|
50
|
+
const c = E(t);
|
|
51
|
+
let r = 0, i = 0, s;
|
|
52
|
+
const h = /* @__PURE__ */ new Set(), d = { snapshot: b(t, c), listeners: h, dispose: () => {
|
|
52
53
|
} }, f = () => {
|
|
53
54
|
r || (r = t.requestAnimationFrame(() => {
|
|
54
|
-
r = 0
|
|
55
|
-
for (const
|
|
55
|
+
r = 0;
|
|
56
|
+
for (const n of h) n(d.snapshot);
|
|
56
57
|
}));
|
|
57
|
-
},
|
|
58
|
+
}, x = () => {
|
|
59
|
+
i && t.clearTimeout(i), i = 0, s = void 0;
|
|
60
|
+
}, u = () => {
|
|
61
|
+
const n = b(t, c, d.snapshot), l = d.snapshot;
|
|
62
|
+
if (n.keyboardOpen && l.keyboardOpen && n.layout.width === l.layout.width && n.layout.height === l.layout.height && n.visible.height < l.visible.height) {
|
|
63
|
+
const O = s?.visible.height === n.visible.height;
|
|
64
|
+
if (s = n, O) return;
|
|
65
|
+
i && t.clearTimeout(i), i = t.setTimeout(() => {
|
|
66
|
+
i = 0, s && (d.snapshot = s, s = void 0, f());
|
|
67
|
+
}, 100);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
x(), d.snapshot = n, f();
|
|
71
|
+
}, g = [
|
|
58
72
|
[t, "resize"],
|
|
59
73
|
[t, "scroll"],
|
|
60
74
|
[t, "orientationchange"],
|
|
61
75
|
[t.document, "focusin"],
|
|
62
76
|
[t.document, "focusout"]
|
|
63
77
|
];
|
|
64
|
-
t.visualViewport &&
|
|
65
|
-
for (const [
|
|
66
|
-
const
|
|
67
|
-
for (const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
for (const [
|
|
71
|
-
|
|
72
|
-
},
|
|
78
|
+
t.visualViewport && g.push([t.visualViewport, "resize"], [t.visualViewport, "scroll"]);
|
|
79
|
+
for (const [n, l] of g) n.addEventListener(l, u);
|
|
80
|
+
const y = new MutationObserver(u);
|
|
81
|
+
for (const n of [t.document.documentElement, t.document.body])
|
|
82
|
+
n && y.observe(n, { attributes: !0, attributeFilter: ["class", "style"] });
|
|
83
|
+
d.dispose = () => {
|
|
84
|
+
for (const [n, l] of g) n.removeEventListener(l, u);
|
|
85
|
+
y.disconnect(), r && t.cancelAnimationFrame(r), x(), c.remove(), m.delete(t);
|
|
86
|
+
}, m.set(t, d), o = d;
|
|
73
87
|
}
|
|
74
88
|
o.listeners.add(e), e(o.snapshot);
|
|
75
|
-
const
|
|
89
|
+
const a = o;
|
|
76
90
|
return () => {
|
|
77
|
-
|
|
91
|
+
a.listeners.delete(e), a.listeners.size === 0 && a.dispose();
|
|
78
92
|
};
|
|
79
93
|
}
|
|
80
|
-
function
|
|
94
|
+
function T(t) {
|
|
81
95
|
const { visible: e, fixedScale: o } = t;
|
|
82
96
|
return {
|
|
83
97
|
position: "fixed",
|
|
@@ -88,8 +102,8 @@ function E(t) {
|
|
|
88
102
|
};
|
|
89
103
|
}
|
|
90
104
|
export {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
105
|
+
F as observeViewport,
|
|
106
|
+
A as readViewportSnapshot,
|
|
107
|
+
V as resolveViewportSnapshot,
|
|
108
|
+
T as viewportStyle
|
|
95
109
|
};
|
package/dist/window-status.css
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
),
|
|
21
21
|
var(--background);
|
|
22
22
|
font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif);
|
|
23
|
-
font-size:
|
|
23
|
+
font-size: var(--floe-type-body);
|
|
24
24
|
line-height: 1.7;
|
|
25
25
|
isolation: isolate;
|
|
26
26
|
}
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
max-width: 352px;
|
|
71
71
|
margin: 15px auto 0;
|
|
72
72
|
color: var(--muted-foreground);
|
|
73
|
-
font-size:
|
|
73
|
+
font-size: var(--floe-type-body);
|
|
74
74
|
line-height: 1.9;
|
|
75
75
|
text-wrap: pretty;
|
|
76
76
|
}
|