@floegence/floe-webapp-core 0.71.0 → 0.73.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/AppViewport.d.ts +9 -0
- package/dist/components/layout/AppViewport.js +31 -0
- package/dist/components/layout/BottomBarCompanion.js +168 -154
- package/dist/components/layout/MobileTabBar.d.ts +1 -0
- package/dist/components/layout/MobileTabBar.js +42 -41
- package/dist/components/layout/Shell.d.ts +6 -0
- package/dist/components/layout/Shell.js +158 -141
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/ui/Dialog.d.ts +2 -2
- package/dist/components/ui/Dialog.js +135 -115
- package/dist/components/ui/FloatingWindow.js +195 -188
- package/dist/components/ui/SurfaceFloatingLayer.js +35 -26
- package/dist/components/ui/floatingWindowGeometry.d.ts +12 -3
- package/dist/components/ui/floatingWindowGeometry.js +37 -37
- package/dist/components/ui/surfaceFloatingBoundary.js +31 -40
- package/dist/floe.css +30 -10
- package/dist/full.js +598 -596
- package/dist/layout.js +36 -34
- package/dist/styles.css +1 -1
- package/dist/viewport.d.ts +54 -0
- package/dist/viewport.js +90 -0
- package/package.json +5 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { createComponent as S, Portal as v, use as h, spread as g, mergeProps as A, insert as P, template as R } from "solid-js/web";
|
|
2
|
+
import { observeViewport as w } from "../../viewport.js";
|
|
3
|
+
import { splitProps as _, createSignal as b, onMount as x, onCleanup as C, createMemo as s } from "solid-js";
|
|
4
|
+
import { cn as T } from "../../utils/cn.js";
|
|
5
|
+
import { LOCAL_INTERACTION_SURFACE_ATTR as z } from "./localInteractionSurface.js";
|
|
6
|
+
import { clampMenuPosition as M } from "./menuUtils.js";
|
|
7
|
+
import { readSurfaceSafeArea as F, resolveFloatingBoundary as L } from "./surfaceFloatingBoundary.js";
|
|
8
|
+
import { resolveSurfacePortalHost as $, SURFACE_FLOATING_LAYER_ATTR as E, resolveSurfacePortalMount as O, isSurfacePortalMode as B, projectSurfacePortalPosition as I } from "./dialogSurfaceScope.js";
|
|
9
|
+
var N = /* @__PURE__ */ R("<div>");
|
|
10
|
+
function j() {
|
|
10
11
|
return {
|
|
11
12
|
left: 0,
|
|
12
13
|
top: 0,
|
|
@@ -16,42 +17,50 @@ function B() {
|
|
|
16
17
|
height: 0
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
const [e,
|
|
20
|
+
function J(c) {
|
|
21
|
+
const [e, f] = _(c, ["position", "owner", "boundary", "estimatedSize", "clamp", "class", "style", "children", "layerRef"]), [a, p] = b();
|
|
22
|
+
x(() => C(w(window, p)));
|
|
23
|
+
const r = s(() => $({
|
|
21
24
|
owner: e.owner ?? null
|
|
22
|
-
})),
|
|
25
|
+
})), n = () => B(r()), u = s(() => (e.position, a()?.safeArea ?? F())), i = () => L(r(), e.boundary, u()) ?? j(), m = () => e.clamp !== !1 && !!e.estimatedSize, d = s(() => {
|
|
23
26
|
const t = e.position;
|
|
24
|
-
return !
|
|
25
|
-
}),
|
|
27
|
+
return !m() || !e.estimatedSize ? t : M(t, e.estimatedSize, i());
|
|
28
|
+
}), l = () => {
|
|
29
|
+
const t = I(d(), r()), o = a()?.fixedOffset;
|
|
30
|
+
return n() || !o ? t : {
|
|
31
|
+
x: t.x + o.left,
|
|
32
|
+
y: t.y + o.top
|
|
33
|
+
};
|
|
34
|
+
}, y = () => ({
|
|
26
35
|
...e.style ?? {},
|
|
27
|
-
...e.boundary !== void 0 && (
|
|
36
|
+
...e.boundary !== void 0 && (i().width <= 16 || i().height <= 16) ? {
|
|
28
37
|
visibility: "hidden",
|
|
29
38
|
"pointer-events": "none"
|
|
30
39
|
} : {},
|
|
31
|
-
left: `${
|
|
32
|
-
top: `${
|
|
40
|
+
left: `${l().x}px`,
|
|
41
|
+
top: `${l().y}px`
|
|
33
42
|
});
|
|
34
|
-
return
|
|
43
|
+
return S(v, {
|
|
35
44
|
get mount() {
|
|
36
|
-
return
|
|
45
|
+
return O(r());
|
|
37
46
|
},
|
|
38
47
|
get children() {
|
|
39
|
-
var t =
|
|
40
|
-
return typeof
|
|
48
|
+
var t = N(), o = e.layerRef;
|
|
49
|
+
return typeof o == "function" ? h(o, t) : e.layerRef = t, g(t, A(f, {
|
|
41
50
|
get class() {
|
|
42
|
-
return
|
|
51
|
+
return T(n() ? "absolute z-20" : "fixed z-50", e.class);
|
|
43
52
|
},
|
|
44
53
|
get style() {
|
|
45
|
-
return
|
|
54
|
+
return y();
|
|
46
55
|
}
|
|
47
56
|
}, {
|
|
48
|
-
[
|
|
57
|
+
[E]: "true"
|
|
49
58
|
}, () => ({
|
|
50
|
-
[
|
|
59
|
+
[z]: n() ? "true" : void 0
|
|
51
60
|
})), !1, !0), P(t, () => e.children), t;
|
|
52
61
|
}
|
|
53
62
|
});
|
|
54
63
|
}
|
|
55
64
|
export {
|
|
56
|
-
|
|
65
|
+
J as SurfaceFloatingLayer
|
|
57
66
|
};
|
|
@@ -35,7 +35,10 @@ interface ResolveFloatingWindowRectOptions {
|
|
|
35
35
|
resizeHandle: FloatingWindowResizeHandle;
|
|
36
36
|
minSize: Size;
|
|
37
37
|
maxSize: Size;
|
|
38
|
-
viewport: Size
|
|
38
|
+
viewport: Size & {
|
|
39
|
+
x?: number;
|
|
40
|
+
y?: number;
|
|
41
|
+
};
|
|
39
42
|
viewportInsets?: FloatingWindowViewportInsets;
|
|
40
43
|
mobile: boolean;
|
|
41
44
|
mobilePadding: number;
|
|
@@ -44,13 +47,19 @@ interface NormalizeFloatingWindowRectOptions {
|
|
|
44
47
|
rect: FloatingWindowRect;
|
|
45
48
|
minSize: Size;
|
|
46
49
|
maxSize: Size;
|
|
47
|
-
viewport: Size
|
|
50
|
+
viewport: Size & {
|
|
51
|
+
x?: number;
|
|
52
|
+
y?: number;
|
|
53
|
+
};
|
|
48
54
|
viewportInsets?: FloatingWindowViewportInsets;
|
|
49
55
|
mobile: boolean;
|
|
50
56
|
mobilePadding: number;
|
|
51
57
|
center?: boolean;
|
|
52
58
|
}
|
|
53
|
-
export declare function resolveFloatingWindowViewport(viewport: Size
|
|
59
|
+
export declare function resolveFloatingWindowViewport(viewport: Size & {
|
|
60
|
+
x?: number;
|
|
61
|
+
y?: number;
|
|
62
|
+
}, insets?: FloatingWindowViewportInsets): FloatingWindowViewport;
|
|
54
63
|
export declare function resolveFloatingWindowRect(options: ResolveFloatingWindowRectOptions): FloatingWindowRect;
|
|
55
64
|
export declare function normalizeFloatingWindowRect(options: NormalizeFloatingWindowRectOptions): FloatingWindowRect;
|
|
56
65
|
export {};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
function x(
|
|
2
|
-
return Math.max(i, Math.min(m,
|
|
1
|
+
function x(n, i, m) {
|
|
2
|
+
return Math.max(i, Math.min(m, n));
|
|
3
3
|
}
|
|
4
|
-
function l(
|
|
5
|
-
const s = Math.max(0, m), o = Math.min(
|
|
4
|
+
function l(n, i, m) {
|
|
5
|
+
const s = Math.max(0, m), o = Math.min(n, s), c = Math.max(o, Math.min(i, s));
|
|
6
6
|
return { min: o, max: c };
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const i = Number(
|
|
8
|
+
function v(n) {
|
|
9
|
+
const i = Number(n);
|
|
10
10
|
return Number.isFinite(i) && i > 0 ? i : 0;
|
|
11
11
|
}
|
|
12
|
-
function X(
|
|
13
|
-
const m = Math.max(0,
|
|
12
|
+
function X(n, i = {}) {
|
|
13
|
+
const m = Math.max(0, n.width), s = Math.max(0, n.height), o = Math.min(v(i.left), m), c = Math.min(v(i.top), s), e = Math.min(v(i.right), Math.max(0, m - o)), d = Math.min(v(i.bottom), Math.max(0, s - c));
|
|
14
14
|
return {
|
|
15
|
-
x: o,
|
|
16
|
-
y: c,
|
|
17
|
-
width: Math.max(0, m - o -
|
|
15
|
+
x: (n.x ?? 0) + o,
|
|
16
|
+
y: (n.y ?? 0) + c,
|
|
17
|
+
width: Math.max(0, m - o - e),
|
|
18
18
|
height: Math.max(0, s - c - d)
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function Y(
|
|
22
|
-
return
|
|
21
|
+
function Y(n) {
|
|
22
|
+
return n.x + n.width;
|
|
23
23
|
}
|
|
24
|
-
function H(
|
|
25
|
-
return
|
|
24
|
+
function H(n) {
|
|
25
|
+
return n.y + n.height;
|
|
26
26
|
}
|
|
27
|
-
function I(
|
|
27
|
+
function I(n) {
|
|
28
28
|
const {
|
|
29
29
|
mode: i,
|
|
30
30
|
pointer: m,
|
|
31
31
|
dragStartPos: s,
|
|
32
32
|
dragStartRect: o,
|
|
33
33
|
resizeStartPos: c,
|
|
34
|
-
resizeStartRect:
|
|
34
|
+
resizeStartRect: e,
|
|
35
35
|
resizeHandle: d,
|
|
36
36
|
minSize: r,
|
|
37
37
|
maxSize: t,
|
|
@@ -39,55 +39,55 @@ function I(e) {
|
|
|
39
39
|
viewportInsets: S,
|
|
40
40
|
mobile: y,
|
|
41
41
|
mobilePadding: f
|
|
42
|
-
} =
|
|
42
|
+
} = n, a = X(R, S), g = Y(a), M = H(a), u = m.x - (i === "drag" ? s.x : c.x), p = m.y - (i === "drag" ? s.y : c.y);
|
|
43
43
|
if (i === "drag") {
|
|
44
|
-
const h = Math.max(a.x, g - o.width),
|
|
44
|
+
const h = Math.max(a.x, g - o.width), w = Math.max(a.y, M - o.height);
|
|
45
45
|
return {
|
|
46
46
|
...o,
|
|
47
47
|
x: x(y ? a.x + f : o.x + u, a.x, h),
|
|
48
|
-
y: x(o.y + p, a.y,
|
|
48
|
+
y: x(o.y + p, a.y, w)
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
let b =
|
|
51
|
+
let b = e.width, z = e.height, W = e.x, F = e.y;
|
|
52
52
|
if (!y && d.includes("e")) {
|
|
53
|
-
const h = l(r.width, t.width, g -
|
|
54
|
-
b = x(
|
|
53
|
+
const h = l(r.width, t.width, g - e.x);
|
|
54
|
+
b = x(e.width + u, h.min, h.max);
|
|
55
55
|
}
|
|
56
56
|
if (!y && d.includes("w")) {
|
|
57
|
-
const h =
|
|
58
|
-
W = x(
|
|
57
|
+
const h = e.x + e.width, w = l(r.width, t.width, h - a.x), B = h - w.max, P = Math.max(B, h - w.min);
|
|
58
|
+
W = x(e.x + u, B, P), b = Math.max(0, h - W);
|
|
59
59
|
}
|
|
60
60
|
if (d.includes("s")) {
|
|
61
|
-
const h = l(r.height, t.height,
|
|
62
|
-
|
|
61
|
+
const h = l(r.height, t.height, M - e.y);
|
|
62
|
+
z = x(e.height + p, h.min, h.max);
|
|
63
63
|
}
|
|
64
64
|
if (d.includes("n")) {
|
|
65
|
-
const h =
|
|
66
|
-
F = x(
|
|
65
|
+
const h = e.y + e.height, w = l(r.height, t.height, h - a.y), B = h - w.max, P = Math.max(B, h - w.min);
|
|
66
|
+
F = x(e.y + p, B, P), z = Math.max(0, h - F);
|
|
67
67
|
}
|
|
68
68
|
return {
|
|
69
69
|
x: x(W, a.x, Math.max(a.x, g - b)),
|
|
70
|
-
y: x(F, a.y, Math.max(a.y,
|
|
70
|
+
y: x(F, a.y, Math.max(a.y, M - z)),
|
|
71
71
|
width: b,
|
|
72
|
-
height:
|
|
72
|
+
height: z
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
function V(
|
|
75
|
+
function V(n) {
|
|
76
76
|
const {
|
|
77
77
|
rect: i,
|
|
78
78
|
minSize: m,
|
|
79
79
|
maxSize: s,
|
|
80
80
|
viewport: o,
|
|
81
81
|
viewportInsets: c,
|
|
82
|
-
mobile:
|
|
82
|
+
mobile: e,
|
|
83
83
|
mobilePadding: d,
|
|
84
84
|
center: r = !1
|
|
85
|
-
} =
|
|
85
|
+
} = n, t = X(o, c), R = Y(t), S = H(t), y = e ? Math.max(0, t.width - d * 2) : t.width, f = l(m.width, s.width, y), a = l(m.height, s.height, t.height), g = e ? f.max : x(i.width, f.min, f.max), M = x(i.height, a.min, a.max), u = Math.max(t.x, R - g), p = Math.max(t.y, S - M);
|
|
86
86
|
return {
|
|
87
|
-
x:
|
|
88
|
-
y: r ? Math.max(t.y, Math.round(t.y + (t.height -
|
|
87
|
+
x: e ? x(t.x + d, t.x, u) : r ? Math.max(t.x, Math.round(t.x + (t.width - g) / 2)) : x(i.x, t.x, u),
|
|
88
|
+
y: r ? Math.max(t.y, Math.round(t.y + (t.height - M) / 2)) : x(i.y, t.y, p),
|
|
89
89
|
width: g,
|
|
90
|
-
height:
|
|
90
|
+
height: M
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
export {
|
|
@@ -1,53 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isSurfacePortalMode as
|
|
3
|
-
function m(...
|
|
4
|
-
const
|
|
5
|
-
return { left:
|
|
1
|
+
import { readViewportSnapshot as f } from "../../viewport.js";
|
|
2
|
+
import { isSurfacePortalMode as l, resolveSurfacePortalBoundaryRect as h } from "./dialogSurfaceScope.js";
|
|
3
|
+
function m(...i) {
|
|
4
|
+
const e = Math.max(...i.map((t) => t.left)), n = Math.max(...i.map((t) => t.top)), o = Math.max(e, Math.min(...i.map((t) => t.right))), r = Math.max(n, Math.min(...i.map((t) => t.bottom)));
|
|
5
|
+
return { left: e, top: n, right: o, bottom: r, width: o - e, height: r - n };
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
const e = document.createElement("div");
|
|
10
|
-
e.style.cssText = "position:fixed;visibility:hidden;pointer-events:none;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)", document.documentElement.append(e);
|
|
11
|
-
const t = getComputedStyle(e), i = (a) => Math.max(0, Number.parseFloat(a) || 0), o = {
|
|
12
|
-
top: i(t.paddingTop),
|
|
13
|
-
right: i(t.paddingRight),
|
|
14
|
-
bottom: i(t.paddingBottom),
|
|
15
|
-
left: i(t.paddingLeft)
|
|
16
|
-
};
|
|
17
|
-
return e.remove(), o;
|
|
7
|
+
function p() {
|
|
8
|
+
return typeof window > "u" ? { top: 0, right: 0, bottom: 0, left: 0 } : f(window).safeArea;
|
|
18
9
|
}
|
|
19
|
-
function c(
|
|
20
|
-
if (
|
|
21
|
-
const o =
|
|
22
|
-
left: o.
|
|
23
|
-
top:
|
|
24
|
-
right: o.
|
|
25
|
-
bottom:
|
|
26
|
-
width: o.
|
|
27
|
-
height: o.
|
|
10
|
+
function c(i, e, n = { top: 0, right: 0, bottom: 0, left: 0 }) {
|
|
11
|
+
if (e === null || typeof window > "u" || i.mode === "surface" && !l(i)) return null;
|
|
12
|
+
const { visible: o } = f(window), r = {
|
|
13
|
+
left: o.left + n.left,
|
|
14
|
+
top: o.top + n.top,
|
|
15
|
+
right: o.right - n.right,
|
|
16
|
+
bottom: o.bottom - n.bottom,
|
|
17
|
+
width: o.width,
|
|
18
|
+
height: o.height
|
|
28
19
|
};
|
|
29
|
-
let
|
|
30
|
-
if (
|
|
31
|
-
if (!
|
|
20
|
+
let t;
|
|
21
|
+
if (e instanceof HTMLElement) {
|
|
22
|
+
if (!e.isConnected || e.closest('[inert], [hidden], [aria-hidden="true"]'))
|
|
32
23
|
return null;
|
|
33
|
-
|
|
24
|
+
t = e.getBoundingClientRect();
|
|
34
25
|
} else
|
|
35
|
-
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
t = e;
|
|
27
|
+
return t && ![
|
|
28
|
+
t.left,
|
|
29
|
+
t.top,
|
|
30
|
+
t.right,
|
|
31
|
+
t.bottom,
|
|
32
|
+
t.width,
|
|
33
|
+
t.height
|
|
43
34
|
].every(Number.isFinite) ? null : m(
|
|
44
35
|
r,
|
|
45
|
-
|
|
46
|
-
...
|
|
36
|
+
...l(i) ? [h(i)] : [],
|
|
37
|
+
...t ? [t] : []
|
|
47
38
|
);
|
|
48
39
|
}
|
|
49
40
|
export {
|
|
50
41
|
m as intersectSurfaceRects,
|
|
51
|
-
|
|
42
|
+
p as readSurfaceSafeArea,
|
|
52
43
|
c as resolveFloatingBoundary
|
|
53
44
|
};
|
package/dist/floe.css
CHANGED
|
@@ -455,10 +455,29 @@
|
|
|
455
455
|
--floe-floating-exit-scale: 1;
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
+
.floe-side-drawer-overlay {
|
|
459
|
+
--floe-dialog-gap-y: 0px;
|
|
460
|
+
--floe-dialog-gap-x: 0px;
|
|
461
|
+
padding: 0;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.floe-side-drawer-panel {
|
|
465
|
+
height: 100%;
|
|
466
|
+
border-top-right-radius: 0;
|
|
467
|
+
border-bottom-right-radius: 0;
|
|
468
|
+
--floe-floating-enter-x: min(8rem, 18vw);
|
|
469
|
+
--floe-floating-exit-x: min(6rem, 14vw);
|
|
470
|
+
--floe-floating-enter-y: 0;
|
|
471
|
+
--floe-floating-exit-y: 0;
|
|
472
|
+
--floe-floating-enter-scale: 1;
|
|
473
|
+
--floe-floating-exit-scale: 1;
|
|
474
|
+
--floe-floating-origin: right center;
|
|
475
|
+
}
|
|
476
|
+
|
|
458
477
|
.floe-bottom-drawer-overlay {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
478
|
+
--floe-dialog-gap-y: 1.25rem;
|
|
479
|
+
--floe-dialog-gap-x: 1.5rem;
|
|
480
|
+
padding: var(--floe-dialog-gap-y) var(--floe-dialog-gap-x);
|
|
462
481
|
}
|
|
463
482
|
|
|
464
483
|
.floe-bottom-drawer-backdrop {
|
|
@@ -480,9 +499,8 @@
|
|
|
480
499
|
|
|
481
500
|
@media (max-width: 639px) {
|
|
482
501
|
.floe-bottom-drawer-overlay {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
max(0.75rem, env(safe-area-inset-left, 0px));
|
|
502
|
+
--floe-dialog-gap-y: 0.75rem;
|
|
503
|
+
--floe-dialog-gap-x: 0.75rem;
|
|
486
504
|
}
|
|
487
505
|
}
|
|
488
506
|
|
|
@@ -707,10 +725,6 @@
|
|
|
707
725
|
pointer-events: auto;
|
|
708
726
|
transform-origin: bottom center;
|
|
709
727
|
transition:
|
|
710
|
-
left 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
|
|
711
|
-
top 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
|
|
712
|
-
width 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
|
|
713
|
-
height 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
|
|
714
728
|
border-radius 200ms ease,
|
|
715
729
|
border-color 180ms ease,
|
|
716
730
|
opacity 120ms ease;
|
|
@@ -728,6 +742,12 @@
|
|
|
728
742
|
.floe-bottom-bar-companion[data-companion-phase='expanding'],
|
|
729
743
|
.floe-bottom-bar-companion[data-companion-phase='collapsing'] {
|
|
730
744
|
will-change: left, top, width, height;
|
|
745
|
+
transition:
|
|
746
|
+
left 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
|
|
747
|
+
top 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
|
|
748
|
+
width 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
|
|
749
|
+
height 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
|
|
750
|
+
border-radius 200ms ease, border-color 180ms ease, opacity 120ms ease;
|
|
731
751
|
}
|
|
732
752
|
|
|
733
753
|
.floe-bottom-bar-companion[data-companion-visibility='hidden'],
|