@floegence/floe-webapp-core 0.90.0 → 0.90.2
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/ui/Dropdown.js +199 -185
- package/dist/components/ui/FloatingWindow.js +37 -37
- package/dist/components/ui/Popover.js +78 -71
- package/dist/components/ui/SurfaceAnchoredLayer.js +45 -43
- package/dist/components/ui/Tabs.js +159 -162
- package/dist/components/ui/tabReorder.d.ts +1 -3
- package/dist/components/ui/tabReorder.js +83 -45
- package/dist/floe.css +43 -0
- package/dist/styles.css +1 -1
- package/dist/surface.css +36 -2
- package/package.json +1 -1
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { splitProps as N, createSignal as f, createEffect as M, onCleanup as R, onMount as Q, Show as U } from "solid-js";
|
|
3
|
-
import { SurfaceFloatingLayer as
|
|
4
|
-
import { resolveFloatingBoundary as
|
|
5
|
-
import { observeViewport as
|
|
1
|
+
import { createComponent as C, mergeProps as J, memo as K } from "solid-js/web";
|
|
2
|
+
import { splitProps as N, createSignal as f, createEffect as M, onCleanup as R, onMount as Q, Show as U, untrack as X } from "solid-js";
|
|
3
|
+
import { SurfaceFloatingLayer as Z } from "./SurfaceFloatingLayer.js";
|
|
4
|
+
import { resolveFloatingBoundary as _ } from "./surfaceFloatingBoundary.js";
|
|
5
|
+
import { observeViewport as ee } from "../../viewport.js";
|
|
6
6
|
import { resolveSurfacePortalHost as E } from "./dialogSurfaceScope.js";
|
|
7
|
-
function
|
|
8
|
-
const [o,
|
|
7
|
+
function se(L) {
|
|
8
|
+
const [o, H] = N(L, ["anchor", "revision", "topOffset", "reservedSpace", "placement", "gap", "children", "class", "style", "layerRef", "onAnchorDisconnect"]), [A, $] = f(!1), [k, q] = f({
|
|
9
9
|
x: 0,
|
|
10
10
|
y: 0
|
|
11
|
-
}), [
|
|
12
|
-
let
|
|
13
|
-
const [
|
|
11
|
+
}), [B, V] = f("above"), [F, v] = f(!1), [Y, D] = f(480), [O, T] = f();
|
|
12
|
+
let m, w = !1;
|
|
13
|
+
const [P, W] = f({
|
|
14
14
|
x: 0,
|
|
15
15
|
y: 0
|
|
16
|
-
}), [
|
|
17
|
-
|
|
18
|
-
const n = o.anchor, l =
|
|
16
|
+
}), [j, G] = f(0), S = () => {
|
|
17
|
+
m = void 0;
|
|
18
|
+
const n = o.anchor, l = O();
|
|
19
19
|
if (!n || !l) return;
|
|
20
20
|
if (!n.isConnected) {
|
|
21
21
|
v(!1), w || o.onAnchorDisconnect?.(), w = !0;
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
w = !1;
|
|
25
|
-
const t =
|
|
25
|
+
const t = _(E({
|
|
26
26
|
owner: n
|
|
27
27
|
}));
|
|
28
28
|
if (!t) {
|
|
29
29
|
v(!1);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const e = n.getBoundingClientRect(), s = o.reservedSpace,
|
|
33
|
-
D(Math.max(120, t.width - 24)),
|
|
32
|
+
const e = n.getBoundingClientRect(), s = o.reservedSpace, d = t.top + (window.matchMedia("(max-width:760px)").matches ? s?.narrowTop ?? s?.top ?? 12 : s?.top ?? 12);
|
|
33
|
+
D(Math.max(120, t.width - 24)), G(Math.max(0, t.bottom - (s?.bottom ?? 12) - d));
|
|
34
34
|
const r = l.getBoundingClientRect(), I = (Math.max(t.left, e.left) + Math.min(t.right, e.right)) / 2;
|
|
35
35
|
let p = Math.max(t.left + 12, Math.min(I - r.width / 2, t.right - r.width - 12));
|
|
36
|
-
const x = e.top - (o.topOffset ?? 0), i = Math.max(0, o.gap ?? 12),
|
|
37
|
-
let c =
|
|
36
|
+
const x = e.top - (o.topOffset ?? 0), i = Math.max(0, o.gap ?? 12), u = x - r.height - i, y = Math.max(d, t.bottom - (s?.bottom ?? 12) - r.height), g = (b) => Math.max(d, Math.min(b, y));
|
|
37
|
+
let c = u, a = "above";
|
|
38
38
|
if (o.placement === "right" || o.placement === "left") {
|
|
39
|
-
const b = e.right + i + r.width <= t.right - 12,
|
|
40
|
-
a = o.placement, a === "right" && !b &&
|
|
41
|
-
} else
|
|
42
|
-
|
|
39
|
+
const b = e.right + i + r.width <= t.right - 12, z = e.left - i - r.width >= t.left + 12;
|
|
40
|
+
a = o.placement, a === "right" && !b && z ? a = "left" : a === "left" && !z && b && (a = "right"), p = Math.max(t.left + 12, Math.min(a === "right" ? e.right + i : e.left - r.width - i, t.right - r.width - 12)), c = g(e.top + e.height / 2 - r.height / 2);
|
|
41
|
+
} else u < d ? e.bottom + i <= y ? (c = e.bottom + i, a = "below") : u >= t.top + 12 ? a = "above" : e.bottom + r.height + i <= t.bottom - 12 ? (c = e.bottom + i, a = "below") : e.right + r.width + i + 12 <= t.right ? (p = e.right + i, c = g(x), a = "right") : e.left - r.width - i - 12 >= t.left ? (p = e.left - r.width - i, c = g(x), a = "left") : (c = g(u), a = "edge") : c = Math.min(c, y);
|
|
42
|
+
W({
|
|
43
43
|
x: Math.max(18, Math.min(e.left + e.width / 2 - p, Math.max(18, r.width - 18))),
|
|
44
44
|
y: Math.max(18, Math.min(e.top + e.height / 2 - c, Math.max(18, r.height - 18)))
|
|
45
|
-
}),
|
|
45
|
+
}), V(a), q({
|
|
46
46
|
x: Math.round(p),
|
|
47
47
|
y: Math.round(c)
|
|
48
48
|
}), v(e.right > t.left && e.left < t.right && e.bottom > t.top && e.top < t.bottom);
|
|
49
49
|
}, h = () => {
|
|
50
|
-
|
|
50
|
+
m === void 0 && typeof requestAnimationFrame == "function" && (m = requestAnimationFrame(S));
|
|
51
51
|
};
|
|
52
52
|
return M(() => {
|
|
53
53
|
o.anchor, o.revision, o.topOffset, o.reservedSpace, o.placement, o.gap, h();
|
|
54
54
|
}), M(() => {
|
|
55
|
-
const n =
|
|
55
|
+
const n = O();
|
|
56
56
|
if (!n || typeof ResizeObserver > "u") return;
|
|
57
57
|
const l = new ResizeObserver(h);
|
|
58
58
|
l.observe(n), R(() => l.disconnect());
|
|
59
|
-
}), Q(() =>
|
|
60
|
-
if (!
|
|
59
|
+
}), Q(() => $(!0)), M(() => {
|
|
60
|
+
if (!A()) return;
|
|
61
61
|
const n = o.anchor, l = typeof ResizeObserver == "function" ? new ResizeObserver(h) : void 0, t = E({
|
|
62
62
|
owner: n
|
|
63
63
|
}).boundaryHost;
|
|
@@ -74,46 +74,48 @@ function ae(L) {
|
|
|
74
74
|
childList: !0
|
|
75
75
|
}), s !== t); )
|
|
76
76
|
s = s.parentElement;
|
|
77
|
-
const
|
|
77
|
+
const d = ee(window, h);
|
|
78
78
|
window.addEventListener("scroll", h, !0), h(), R(() => {
|
|
79
|
-
l?.disconnect(), e.disconnect(),
|
|
79
|
+
l?.disconnect(), e.disconnect(), d(), window.removeEventListener("scroll", h, !0);
|
|
80
80
|
});
|
|
81
81
|
}), R(() => {
|
|
82
|
-
|
|
83
|
-
}),
|
|
82
|
+
m !== void 0 && cancelAnimationFrame(m);
|
|
83
|
+
}), C(U, {
|
|
84
84
|
get when() {
|
|
85
|
-
return K(() => !!
|
|
85
|
+
return K(() => !!A())() && o.anchor;
|
|
86
86
|
},
|
|
87
87
|
get children() {
|
|
88
|
-
return
|
|
88
|
+
return C(Z, J(H, {
|
|
89
89
|
get owner() {
|
|
90
90
|
return o.anchor;
|
|
91
91
|
},
|
|
92
92
|
get position() {
|
|
93
|
-
return
|
|
93
|
+
return k();
|
|
94
94
|
},
|
|
95
95
|
get class() {
|
|
96
96
|
return o.class;
|
|
97
97
|
},
|
|
98
98
|
get "data-placement"() {
|
|
99
|
-
return
|
|
99
|
+
return B();
|
|
100
100
|
},
|
|
101
101
|
get inert() {
|
|
102
|
-
return !
|
|
102
|
+
return !F();
|
|
103
103
|
},
|
|
104
104
|
get style() {
|
|
105
105
|
return {
|
|
106
106
|
...o.style,
|
|
107
|
-
"--floe-anchored-layer-anchor-x": `${
|
|
108
|
-
"--floe-anchored-layer-anchor-y": `${
|
|
109
|
-
"--floe-anchored-layer-max-height": `${
|
|
110
|
-
visibility:
|
|
111
|
-
"max-width": `${
|
|
107
|
+
"--floe-anchored-layer-anchor-x": `${P().x}px`,
|
|
108
|
+
"--floe-anchored-layer-anchor-y": `${P().y}px`,
|
|
109
|
+
"--floe-anchored-layer-max-height": `${j()}px`,
|
|
110
|
+
visibility: F() ? "visible" : "hidden",
|
|
111
|
+
"max-width": `${Y()}px`,
|
|
112
112
|
"z-index": o.style?.["z-index"] ?? 60
|
|
113
113
|
};
|
|
114
114
|
},
|
|
115
115
|
layerRef: (n) => {
|
|
116
|
-
|
|
116
|
+
T(n), o.layerRef?.(n), queueMicrotask(() => X(() => {
|
|
117
|
+
n.isConnected && (m !== void 0 && cancelAnimationFrame(m), S());
|
|
118
|
+
}));
|
|
117
119
|
},
|
|
118
120
|
get children() {
|
|
119
121
|
return o.children;
|
|
@@ -123,5 +125,5 @@ function ae(L) {
|
|
|
123
125
|
});
|
|
124
126
|
}
|
|
125
127
|
export {
|
|
126
|
-
|
|
128
|
+
se as SurfaceAnchoredLayer
|
|
127
129
|
};
|