@floegence/floe-webapp-core 0.101.33 → 0.101.34
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.
|
@@ -51,8 +51,8 @@ function de(t) {
|
|
|
51
51
|
get isActive() {
|
|
52
52
|
return f() === n;
|
|
53
53
|
},
|
|
54
|
-
onClick: () => {
|
|
55
|
-
d.consumeClick() || C(o());
|
|
54
|
+
onClick: (a) => {
|
|
55
|
+
d.consumeClick(a) || C(o());
|
|
56
56
|
},
|
|
57
57
|
elementRef: (a) => {
|
|
58
58
|
a ? c.set(n, a) : c.delete(n);
|
|
@@ -128,7 +128,7 @@ function q(t) {
|
|
|
128
128
|
portalScope: "viewport",
|
|
129
129
|
get children() {
|
|
130
130
|
var r = p(), C = r.firstChild;
|
|
131
|
-
r.$$keydown = x, r.$$contextmenu = B, r.$$click = () => t.onClick(), r.addEventListener("dragstart", (e) => e.preventDefault()), r.$$pointerdown = (e) => t.onPointerDown?.(e);
|
|
131
|
+
r.$$keydown = x, r.$$contextmenu = B, r.$$click = (e) => t.onClick(e), r.addEventListener("dragstart", (e) => e.preventDefault()), r.$$pointerdown = (e) => t.onPointerDown?.(e);
|
|
132
132
|
var i = v;
|
|
133
133
|
return typeof i == "function" ? L(i, r) : v = r, g(r, u(T, {
|
|
134
134
|
get component() {
|
|
@@ -20,7 +20,7 @@ export declare function createBarReorder(options: {
|
|
|
20
20
|
order: string[];
|
|
21
21
|
}> | undefined>;
|
|
22
22
|
keyDown(key: string, event: KeyboardEvent): void;
|
|
23
|
-
consumeClick(): boolean;
|
|
23
|
+
consumeClick(event: MouseEvent): boolean;
|
|
24
24
|
begin(key: string, event: PointerEvent): void;
|
|
25
25
|
};
|
|
26
26
|
/** Keyed layout motion survives pin/unpin, reorder and interrupted previews. */
|
|
@@ -1,127 +1,124 @@
|
|
|
1
|
-
import { createSignal as D, createEffect as
|
|
2
|
-
import { startPointerSession as
|
|
3
|
-
function A(n, m,
|
|
4
|
-
const
|
|
5
|
-
if (!n.includes(m) || !
|
|
6
|
-
let
|
|
7
|
-
const
|
|
8
|
-
return
|
|
1
|
+
import { createSignal as D, createEffect as k, onCleanup as R } from "solid-js";
|
|
2
|
+
import { startPointerSession as E } from "../ui/pointerSession.js";
|
|
3
|
+
function A(n, m, o, h, g) {
|
|
4
|
+
const e = n.filter((M) => M !== m && o.has(M));
|
|
5
|
+
if (!n.includes(m) || !e.length) return;
|
|
6
|
+
let f = e.findIndex((M) => {
|
|
7
|
+
const w = o.get(M), t = w.getBoundingClientRect(), r = getComputedStyle(w).transform, i = typeof DOMMatrix == "function" ? new DOMMatrix(r === "none" ? void 0 : r) : void 0;
|
|
8
|
+
return g < (h === "x" ? t.left - (i?.m41 ?? 0) + t.width / 2 : t.top - (i?.m42 ?? 0) + t.height / 2);
|
|
9
9
|
});
|
|
10
|
-
|
|
11
|
-
const u = [...
|
|
12
|
-
return u.splice(
|
|
10
|
+
f < 0 && (f = e.length);
|
|
11
|
+
const u = [...e];
|
|
12
|
+
return u.splice(f, 0, m), { key: e[Math.min(f, e.length - 1)], edge: f === e.length ? "after" : "before", order: u };
|
|
13
13
|
}
|
|
14
|
-
function B(n, m,
|
|
15
|
-
if (!
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
14
|
+
function B(n, m, o, h) {
|
|
15
|
+
if (!o.altKey || !o.shiftKey || o.ctrlKey || o.metaKey || o.isComposing) return;
|
|
16
|
+
const g = o.key === (h === "x" ? "ArrowLeft" : "ArrowUp") ? -1 : o.key === (h === "x" ? "ArrowRight" : "ArrowDown") ? 1 : 0, e = n.indexOf(m);
|
|
17
|
+
if (!g || e < 0) return;
|
|
18
|
+
o.preventDefault(), o.stopPropagation();
|
|
19
|
+
const f = Math.max(0, Math.min(n.length - 1, e + g));
|
|
20
|
+
if (e === f) return;
|
|
21
21
|
const u = [...n];
|
|
22
|
-
return u.splice(
|
|
22
|
+
return u.splice(e, 1), u.splice(f, 0, m), u;
|
|
23
23
|
}
|
|
24
24
|
function Y(n) {
|
|
25
|
-
const [m,
|
|
26
|
-
let
|
|
27
|
-
const
|
|
28
|
-
|
|
25
|
+
const [m, o] = D(), [h, g] = D();
|
|
26
|
+
let e, f = !1, u = 0;
|
|
27
|
+
const M = (t) => {
|
|
28
|
+
t.key !== "Escape" || !e || (t.preventDefault(), t.stopPropagation(), e.stop({ commit: !1 }));
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
n.keys(), n.onReorder(),
|
|
32
|
-
}),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const e = (o, r) => {
|
|
36
|
-
n.onReorder()?.(r), n.elements.get(o)?.focus({ preventScroll: !0 });
|
|
30
|
+
k(() => {
|
|
31
|
+
n.keys(), n.onReorder(), e?.stop({ commit: !1 });
|
|
32
|
+
}), R(() => e?.stop({ commit: !1 }));
|
|
33
|
+
const w = (t, r) => {
|
|
34
|
+
n.onReorder()?.(r), n.elements.get(t)?.focus({ preventScroll: !0 });
|
|
37
35
|
};
|
|
38
36
|
return {
|
|
39
37
|
dragging: m,
|
|
40
|
-
position:
|
|
41
|
-
keyDown(
|
|
38
|
+
position: h,
|
|
39
|
+
keyDown(t, r) {
|
|
42
40
|
if (!n.onReorder()) return;
|
|
43
|
-
const
|
|
44
|
-
|
|
41
|
+
const i = B(n.keys(), t, r, "y");
|
|
42
|
+
i && w(t, i);
|
|
45
43
|
},
|
|
46
|
-
consumeClick() {
|
|
47
|
-
|
|
44
|
+
consumeClick(t) {
|
|
45
|
+
const r = f && t.detail !== 0;
|
|
46
|
+
return f = !1, r;
|
|
48
47
|
},
|
|
49
|
-
begin(
|
|
50
|
-
if (r.button !== 0 || !n.onReorder() || !n.keys().includes(
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
let
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
48
|
+
begin(t, r) {
|
|
49
|
+
if (r.button !== 0 || (f = !1, !n.onReorder() || !n.keys().includes(t))) return;
|
|
50
|
+
e?.stop({ commit: !1 });
|
|
51
|
+
const i = r.currentTarget, d = r.clientY, x = r.clientX;
|
|
52
|
+
let y = x, c = d, a = !1;
|
|
53
|
+
const b = (s, l) => {
|
|
54
|
+
if (y = s, c = l, a ||= Math.hypot(s - x, l - d) >= 5, !a) return;
|
|
55
|
+
o(t);
|
|
56
|
+
const p = n.container()?.getBoundingClientRect();
|
|
57
|
+
g(p && s >= p.left - 24 && s <= p.right + 24 && l >= p.top && l <= p.bottom ? A(n.keys(), t, n.elements, "y", l) : void 0);
|
|
59
58
|
}, C = () => {
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
const
|
|
65
|
-
|
|
59
|
+
const s = n.container();
|
|
60
|
+
if (a && s) {
|
|
61
|
+
const l = s.getBoundingClientRect(), p = c < l.top + 28 ? c - l.top - 28 : c > l.bottom - 28 ? c - l.bottom + 28 : 0;
|
|
62
|
+
if (y >= l.left - 24 && y <= l.right + 24 && c >= l.top - 24 && c <= l.bottom + 24 && p) {
|
|
63
|
+
const v = s.scrollTop;
|
|
64
|
+
s.scrollTop += Math.sign(p) * Math.min(10, Math.abs(p) / 3), s.scrollTop !== v && b(y, c);
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
u = requestAnimationFrame(C);
|
|
69
68
|
};
|
|
70
|
-
u = requestAnimationFrame(C),
|
|
69
|
+
u = requestAnimationFrame(C), i.ownerDocument.addEventListener("keydown", M, !0), e = E({
|
|
71
70
|
pointerEvent: r,
|
|
72
|
-
captureEl:
|
|
73
|
-
onMove: (
|
|
74
|
-
onEnd: ({ commit:
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
cancelAnimationFrame(u),
|
|
78
|
-
a = !1;
|
|
79
|
-
}, 0)), f && b && g && e(o, g.order);
|
|
71
|
+
captureEl: i,
|
|
72
|
+
onMove: (s) => b(s.clientX, s.clientY),
|
|
73
|
+
onEnd: ({ commit: s, snapshot: l }) => {
|
|
74
|
+
b(l.latestClientX, l.latestClientY);
|
|
75
|
+
const p = h();
|
|
76
|
+
cancelAnimationFrame(u), e = void 0, i.ownerDocument.removeEventListener("keydown", M, !0), o(void 0), g(void 0), f = a || !s, s && a && p && w(t, p.order);
|
|
80
77
|
}
|
|
81
78
|
});
|
|
82
79
|
}
|
|
83
80
|
};
|
|
84
81
|
}
|
|
85
82
|
function $(n) {
|
|
86
|
-
const m = /* @__PURE__ */ new Map(),
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
const
|
|
83
|
+
const m = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
84
|
+
let h = !1, g = 0;
|
|
85
|
+
k(() => {
|
|
86
|
+
const e = [...n.keys()], f = n.preview(), u = ++g;
|
|
90
87
|
queueMicrotask(() => {
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
95
|
-
const
|
|
96
|
-
let
|
|
97
|
-
for (let
|
|
98
|
-
|
|
99
|
-
return [[
|
|
88
|
+
if (g !== u) return;
|
|
89
|
+
const M = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, w = new Map(e.flatMap((t) => {
|
|
90
|
+
const r = n.elements.get(t);
|
|
91
|
+
if (!r) return [];
|
|
92
|
+
const i = r.getBoundingClientRect(), d = getComputedStyle(r).transform, x = typeof DOMMatrix == "function" ? new DOMMatrix(d === "none" ? void 0 : d) : void 0;
|
|
93
|
+
let y = 0, c = 0;
|
|
94
|
+
for (let a = r.parentElement; a; a = a.parentElement)
|
|
95
|
+
y += a.scrollLeft, c += a.scrollTop;
|
|
96
|
+
return [[t, { left: i.left + y - (x?.m41 ?? 0), top: i.top + c - (x?.m42 ?? 0), dx: x?.m41 ?? 0, dy: x?.m42 ?? 0 }]];
|
|
100
97
|
}));
|
|
101
|
-
for (const
|
|
102
|
-
const
|
|
103
|
-
if (!
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
const b =
|
|
107
|
-
if (!
|
|
108
|
-
const
|
|
109
|
-
{ transform: `translate3d(${b}px, ${
|
|
110
|
-
{ transform: `translate3d(${
|
|
98
|
+
for (const t of e) {
|
|
99
|
+
const r = n.elements.get(t), i = w.get(t);
|
|
100
|
+
if (!r || !i) continue;
|
|
101
|
+
const d = m.get(t), x = f ? e[f.indexOf(t)] : t, y = w.get(x) ?? i, c = n.axis === "x" ? y.left - i.left : 0, a = n.axis === "y" ? y.top - i.top : 0;
|
|
102
|
+
if (o.get(t)?.cancel(), o.delete(t), r.style.transform = c || a ? `translate3d(${c}px, ${a}px, 0)` : "", !M && h && typeof r.animate == "function") {
|
|
103
|
+
const b = d ? d.left - i.left + i.dx : c, C = d ? d.top - i.top + i.dy : a;
|
|
104
|
+
if (!d || Math.abs(b - c) + Math.abs(C - a) > 0.5) {
|
|
105
|
+
const s = r.animate([
|
|
106
|
+
{ transform: `translate3d(${b}px, ${C}px, 0)`, ...d ? {} : { opacity: 0 } },
|
|
107
|
+
{ transform: `translate3d(${c}px, ${a}px, 0)`, ...d ? {} : { opacity: 1 } }
|
|
111
108
|
], { duration: 180, easing: "cubic-bezier(0.33, 1, 0.68, 1)" });
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
o.set(t, s), s.onfinish = () => {
|
|
110
|
+
o.get(t) === s && o.delete(t);
|
|
114
111
|
};
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
|
-
m.set(
|
|
114
|
+
m.set(t, { left: i.left, top: i.top });
|
|
118
115
|
}
|
|
119
|
-
for (const
|
|
120
|
-
|
|
116
|
+
for (const t of m.keys()) e.includes(t) || (m.delete(t), o.get(t)?.cancel(), o.delete(t));
|
|
117
|
+
h = !0;
|
|
121
118
|
});
|
|
122
|
-
}),
|
|
123
|
-
|
|
124
|
-
for (const
|
|
119
|
+
}), R(() => {
|
|
120
|
+
g += 1;
|
|
121
|
+
for (const e of o.values()) e.cancel();
|
|
125
122
|
});
|
|
126
123
|
}
|
|
127
124
|
export {
|