@floegence/floe-webapp-core 0.101.37 → 0.101.40
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/graph/viewport-motion.d.ts +9 -0
- package/dist/components/graph/viewport-motion.js +36 -0
- package/dist/components/layout/ActivityBar.js +37 -38
- package/dist/components/layout/barReorder.js +105 -98
- package/dist/graph.d.ts +1 -0
- package/dist/graph.js +8 -6
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Setter } from 'solid-js';
|
|
2
|
+
import type { GraphViewport } from './types';
|
|
3
|
+
/** A controlled camera: direct input interrupts motion at the currently painted viewport. */
|
|
4
|
+
export declare function createGraphViewport(initial: GraphViewport): {
|
|
5
|
+
viewport: import("solid-js").Accessor<import("..").InfiniteCanvasPoint>;
|
|
6
|
+
setViewport: Setter<import("..").InfiniteCanvasPoint>;
|
|
7
|
+
animateTo: (next: GraphViewport) => void;
|
|
8
|
+
moving: import("solid-js").Accessor<boolean>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createSignal as u, onMount as y, onCleanup as f, untrack as M } from "solid-js";
|
|
2
|
+
function F(p) {
|
|
3
|
+
const [s, r] = u(p), [w, i] = u(!1);
|
|
4
|
+
let a = 0, o;
|
|
5
|
+
const n = () => {
|
|
6
|
+
cancelAnimationFrame(a), a = 0, o = void 0, i(!1);
|
|
7
|
+
}, m = (e) => (n(), r(e)), h = (e) => {
|
|
8
|
+
n();
|
|
9
|
+
const t = M(s);
|
|
10
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches || t.x === e.x && t.y === e.y && t.scale === e.scale) {
|
|
11
|
+
r(e);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
o = e;
|
|
15
|
+
const g = performance.now();
|
|
16
|
+
i(!0);
|
|
17
|
+
const l = (v) => {
|
|
18
|
+
const d = Math.min(1, (v - g) / 280), c = 1 - Math.pow(1 - d, 3);
|
|
19
|
+
r({
|
|
20
|
+
x: t.x + (e.x - t.x) * c,
|
|
21
|
+
y: t.y + (e.y - t.y) * c,
|
|
22
|
+
scale: t.scale + (e.scale - t.scale) * c
|
|
23
|
+
}), d < 1 ? a = requestAnimationFrame(l) : (r(e), n());
|
|
24
|
+
};
|
|
25
|
+
a = requestAnimationFrame(l);
|
|
26
|
+
};
|
|
27
|
+
return y(() => {
|
|
28
|
+
const e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () => {
|
|
29
|
+
e.matches && o && m(o);
|
|
30
|
+
};
|
|
31
|
+
e.addEventListener("change", t), f(() => e.removeEventListener("change", t));
|
|
32
|
+
}), f(n), { viewport: s, setViewport: m, animateTo: h, moving: w };
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
F as createGraphViewport
|
|
36
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { insert as g, createComponent as u, memo as I, effect as
|
|
2
|
-
import { createMemo as m, For as
|
|
1
|
+
import { insert as g, createComponent as u, memo as I, effect as w, className as k, setAttribute as s, template as y, use as q, Dynamic as L, setStyleProperty as B, delegateEvents as T } from "solid-js/web";
|
|
2
|
+
import { createMemo as m, For as K, untrack as N, Show as M, onMount as X, onCleanup as Y } from "solid-js";
|
|
3
3
|
import { cn as h } from "../../utils/cn.js";
|
|
4
4
|
import { deferNonBlocking as F } from "../../utils/defer.js";
|
|
5
5
|
import { Tooltip as H } from "../ui/Tooltip.js";
|
|
6
6
|
import { createBarReorder as U, createBarLayoutMotion as V } from "./barReorder.js";
|
|
7
|
-
import { resolveActivityBarClick as
|
|
8
|
-
import { isBarItemContextMenuKey as
|
|
9
|
-
var
|
|
10
|
-
function
|
|
7
|
+
import { resolveActivityBarClick as _ } from "./activityBarBehavior.js";
|
|
8
|
+
import { isBarItemContextMenuKey as z, keyboardBarItemContextMenuRequest as G } from "./barItemContextMenu.js";
|
|
9
|
+
var J = /* @__PURE__ */ y('<div class="flex flex-col">'), O = /* @__PURE__ */ y('<nav data-floe-shell-slot=activity-bar style=border-right-color:var(--activity-bar-border)><div class="flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden">'), Q = /* @__PURE__ */ y("<span aria-hidden=true style=position:absolute;left:6px;right:6px;height:2px;background:var(--ring);border-radius:2px>"), W = /* @__PURE__ */ y("<span>"), Z = /* @__PURE__ */ y("<button type=button data-floe-interactive=press style=transition:none><span aria-hidden=true>");
|
|
10
|
+
function le(t) {
|
|
11
11
|
let v;
|
|
12
12
|
const c = /* @__PURE__ */ new Map(), b = m(() => new Map(t.items.map((i) => [i.id, i]))), l = U({
|
|
13
13
|
keys: () => t.items.filter((i) => i.reorderable !== !1).map((i) => i.id),
|
|
@@ -22,15 +22,15 @@ function de(t) {
|
|
|
22
22
|
drag: l.translation,
|
|
23
23
|
axis: "y"
|
|
24
24
|
});
|
|
25
|
-
const f = m(() => t.activeId),
|
|
25
|
+
const f = m(() => t.activeId), A = m(() => t.collapsed ?? !1), x = m(() => t.onActiveChange), r = m(() => t.onCollapsedChange), C = (i) => {
|
|
26
26
|
if (i.onClick) {
|
|
27
27
|
F(() => i.onClick());
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const e =
|
|
30
|
+
const e = _({
|
|
31
31
|
clickedId: i.id,
|
|
32
32
|
activeId: f(),
|
|
33
|
-
collapsed:
|
|
33
|
+
collapsed: A(),
|
|
34
34
|
behavior: i.collapseBehavior
|
|
35
35
|
});
|
|
36
36
|
e.nextActiveId !== f() && (typeof e.openSidebar == "boolean" ? x()(e.nextActiveId, {
|
|
@@ -38,14 +38,14 @@ function de(t) {
|
|
|
38
38
|
}) : x()(e.nextActiveId)), typeof e.nextCollapsed == "boolean" && r()?.(e.nextCollapsed);
|
|
39
39
|
};
|
|
40
40
|
return (() => {
|
|
41
|
-
var i =
|
|
42
|
-
return typeof d == "function" ?
|
|
41
|
+
var i = O(), e = i.firstChild, d = v;
|
|
42
|
+
return typeof d == "function" ? q(d, e) : v = e, g(e, u(K, {
|
|
43
43
|
get each() {
|
|
44
44
|
return t.items.map((n) => n.id);
|
|
45
45
|
},
|
|
46
46
|
children: (n) => {
|
|
47
|
-
const o = m((a) => b().get(n) ?? a,
|
|
48
|
-
return u(
|
|
47
|
+
const o = m((a) => b().get(n) ?? a, N(() => b().get(n)));
|
|
48
|
+
return u(j, {
|
|
49
49
|
get item() {
|
|
50
50
|
return o();
|
|
51
51
|
},
|
|
@@ -76,12 +76,12 @@ function de(t) {
|
|
|
76
76
|
return t.bottomItems?.length;
|
|
77
77
|
},
|
|
78
78
|
get children() {
|
|
79
|
-
var n =
|
|
80
|
-
return g(n, u(
|
|
79
|
+
var n = J();
|
|
80
|
+
return g(n, u(K, {
|
|
81
81
|
get each() {
|
|
82
82
|
return t.bottomItems;
|
|
83
83
|
},
|
|
84
|
-
children: (o) => u(
|
|
84
|
+
children: (o) => u(j, {
|
|
85
85
|
item: o,
|
|
86
86
|
get isActive() {
|
|
87
87
|
return f() === o.id;
|
|
@@ -90,26 +90,26 @@ function de(t) {
|
|
|
90
90
|
})
|
|
91
91
|
})), n;
|
|
92
92
|
}
|
|
93
|
-
}), null),
|
|
93
|
+
}), null), w((n) => {
|
|
94
94
|
var o = h("w-10 md:w-12 flex flex-col justify-between shrink-0 min-h-0", "bg-activity-bar border-r border-[var(--floe-line-quiet)]", t.class), a = t.ariaLabel;
|
|
95
|
-
return o !== n.e &&
|
|
95
|
+
return o !== n.e && k(i, n.e = o), a !== n.t && s(i, "aria-label", n.t = a), n;
|
|
96
96
|
}, {
|
|
97
97
|
e: void 0,
|
|
98
98
|
t: void 0
|
|
99
99
|
}), i;
|
|
100
100
|
})();
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function j(t) {
|
|
103
103
|
let v;
|
|
104
104
|
const c = () => typeof t.item.badge == "function" ? t.item.badge() : t.item.badge, b = () => typeof t.item.ariaExpanded == "function" ? t.item.ariaExpanded() : t.item.ariaExpanded, l = () => t.isActive || b() === !0;
|
|
105
105
|
let f;
|
|
106
|
-
|
|
106
|
+
X(() => {
|
|
107
107
|
const r = t.item.buttonRef;
|
|
108
108
|
r?.(v ?? null), t.elementRef?.(v ?? null), f = () => {
|
|
109
109
|
r?.(null), t.elementRef?.(null);
|
|
110
110
|
};
|
|
111
|
-
}),
|
|
112
|
-
const
|
|
111
|
+
}), Y(() => f?.());
|
|
112
|
+
const A = (r) => {
|
|
113
113
|
t.item.onContextMenu && (r.preventDefault(), r.stopPropagation(), t.item.onContextMenu({
|
|
114
114
|
trigger: r.currentTarget,
|
|
115
115
|
clientX: r.clientX,
|
|
@@ -117,7 +117,7 @@ function q(t) {
|
|
|
117
117
|
source: "pointer"
|
|
118
118
|
}));
|
|
119
119
|
}, x = (r) => {
|
|
120
|
-
t.onReorderKey?.(r), !(r.defaultPrevented || !t.item.onContextMenu || !
|
|
120
|
+
t.onReorderKey?.(r), !(r.defaultPrevented || !t.item.onContextMenu || !z(r)) && (r.preventDefault(), r.stopPropagation(), t.item.onContextMenu(G(r.currentTarget)));
|
|
121
121
|
};
|
|
122
122
|
return u(H, {
|
|
123
123
|
get content() {
|
|
@@ -128,10 +128,10 @@ function q(t) {
|
|
|
128
128
|
triggerClass: "shrink-0",
|
|
129
129
|
portalScope: "viewport",
|
|
130
130
|
get children() {
|
|
131
|
-
var r =
|
|
132
|
-
r.$$keydown = x, r.$$contextmenu =
|
|
131
|
+
var r = Z(), C = r.firstChild;
|
|
132
|
+
r.$$keydown = x, r.$$contextmenu = A, r.$$click = (e) => t.onClick(e), r.addEventListener("dragstart", (e) => e.preventDefault()), r.$$pointerdown = (e) => t.onPointerDown?.(e);
|
|
133
133
|
var i = v;
|
|
134
|
-
return typeof i == "function" ?
|
|
134
|
+
return typeof i == "function" ? q(i, r) : v = r, g(r, u(L, {
|
|
135
135
|
get component() {
|
|
136
136
|
return t.item.icon;
|
|
137
137
|
},
|
|
@@ -146,10 +146,10 @@ function q(t) {
|
|
|
146
146
|
return t.dropEdge;
|
|
147
147
|
},
|
|
148
148
|
get children() {
|
|
149
|
-
var e =
|
|
150
|
-
return
|
|
149
|
+
var e = Q();
|
|
150
|
+
return w((d) => {
|
|
151
151
|
var n = t.dropEdge === "before" ? "0" : void 0, o = t.dropEdge === "after" ? "0" : void 0;
|
|
152
|
-
return n !== d.e &&
|
|
152
|
+
return n !== d.e && B(e, "top", d.e = n), o !== d.t && B(e, "bottom", d.t = o), d;
|
|
153
153
|
}, {
|
|
154
154
|
e: void 0,
|
|
155
155
|
t: void 0
|
|
@@ -160,15 +160,15 @@ function q(t) {
|
|
|
160
160
|
return c();
|
|
161
161
|
},
|
|
162
162
|
get children() {
|
|
163
|
-
var e =
|
|
163
|
+
var e = W();
|
|
164
164
|
return g(e, (() => {
|
|
165
165
|
var d = I(() => typeof c() == "number" && c() > 99);
|
|
166
166
|
return () => d() ? "99+" : c();
|
|
167
|
-
})()),
|
|
167
|
+
})()), w(() => k(e, h("absolute top-0.5 right-0.5 min-w-3.5 h-3.5 px-1", "flex items-center justify-center", "text-[length:var(--floe-type-caption)] font-medium rounded-full", "bg-activity-bar-badge text-activity-bar-badge-foreground"))), e;
|
|
168
168
|
}
|
|
169
|
-
}), null),
|
|
170
|
-
var d = t.item.id, n = t.reorderable ? "Alt+Shift+ArrowUp Alt+Shift+ArrowDown" : void 0, o = t.reorderable ? "none" : void 0, a =
|
|
171
|
-
return d !== e.e && s(r, "data-floe-bar-key", e.e = d), n !== e.t && s(r, "aria-keyshortcuts", e.t = n), o !== e.a &&
|
|
169
|
+
}), null), w((e) => {
|
|
170
|
+
var d = t.item.id, n = t.reorderable ? "Alt+Shift+ArrowUp Alt+Shift+ArrowDown" : void 0, o = t.reorderable ? "none" : void 0, a = h("group/activity-item relative w-full shrink-0 aspect-square flex items-center justify-center cursor-pointer", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset", "text-activity-bar-foreground", l() && "text-activity-bar-foreground-active"), R = t.item.label, D = t.isActive, E = b(), $ = t.item.ariaControls, S = t.item.ariaHasPopup ?? (t.item.onContextMenu ? "menu" : void 0), P = h("absolute inset-1 rounded-md", "transition-colors duration-[var(--floe-duration-fast)] ease-[var(--floe-ease-out)]", l() ? "bg-[var(--floe-state-selected)]" : "bg-transparent group-hover/activity-item:bg-[var(--floe-state-hover)]");
|
|
171
|
+
return d !== e.e && s(r, "data-floe-bar-key", e.e = d), n !== e.t && s(r, "aria-keyshortcuts", e.t = n), o !== e.a && B(r, "touch-action", e.a = o), a !== e.o && k(r, e.o = a), R !== e.i && s(r, "aria-label", e.i = R), D !== e.n && s(r, "aria-pressed", e.n = D), E !== e.s && s(r, "aria-expanded", e.s = E), $ !== e.h && s(r, "aria-controls", e.h = $), S !== e.r && s(r, "aria-haspopup", e.r = S), P !== e.d && k(C, e.d = P), e;
|
|
172
172
|
}, {
|
|
173
173
|
e: void 0,
|
|
174
174
|
t: void 0,
|
|
@@ -179,13 +179,12 @@ function q(t) {
|
|
|
179
179
|
s: void 0,
|
|
180
180
|
h: void 0,
|
|
181
181
|
r: void 0,
|
|
182
|
-
d: void 0
|
|
183
|
-
l: void 0
|
|
182
|
+
d: void 0
|
|
184
183
|
}), r;
|
|
185
184
|
}
|
|
186
185
|
});
|
|
187
186
|
}
|
|
188
|
-
|
|
187
|
+
T(["pointerdown", "click", "contextmenu", "keydown"]);
|
|
189
188
|
export {
|
|
190
|
-
|
|
189
|
+
le as ActivityBar
|
|
191
190
|
};
|
|
@@ -1,161 +1,168 @@
|
|
|
1
|
-
import { createSignal as
|
|
1
|
+
import { createSignal as $, createEffect as S, onCleanup as X, createMemo as L, untrack as K } from "solid-js";
|
|
2
2
|
import { startPointerSession as P } from "../ui/pointerSession.js";
|
|
3
|
-
const
|
|
4
|
-
function
|
|
3
|
+
const z = (t, s) => t === s || !!(t && s && t.key === s.key && t.edge === s.edge && t.order.length === s.order.length && t.order.every((e, p) => e === s.order[p]));
|
|
4
|
+
function I(t, s) {
|
|
5
5
|
return new Map([...t].map(([e, p]) => {
|
|
6
|
-
const g = p.getBoundingClientRect(), y = getComputedStyle(p).transform,
|
|
7
|
-
return [e,
|
|
6
|
+
const g = p.getBoundingClientRect(), y = getComputedStyle(p).transform, l = typeof DOMMatrix == "function" ? new DOMMatrix(y === "none" ? void 0 : y) : void 0;
|
|
7
|
+
return [e, s === "x" ? g.left - (l?.m41 ?? 0) + g.width / 2 : g.top - (l?.m42 ?? 0) + g.height / 2];
|
|
8
8
|
}));
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
if (!t.includes(
|
|
13
|
-
let a =
|
|
14
|
-
if (y?.has(
|
|
15
|
-
const w = e.get(
|
|
16
|
-
return g < (p === "x" ?
|
|
10
|
+
function q(t, s, e, p, g, y) {
|
|
11
|
+
const l = t.filter((n) => n !== s && e.has(n));
|
|
12
|
+
if (!t.includes(s) || !l.length) return;
|
|
13
|
+
let a = l.findIndex((n) => {
|
|
14
|
+
if (y?.has(n)) return g < y.get(n);
|
|
15
|
+
const w = e.get(n), i = w.getBoundingClientRect(), c = getComputedStyle(w).transform, m = typeof DOMMatrix == "function" ? new DOMMatrix(c === "none" ? void 0 : c) : void 0;
|
|
16
|
+
return g < (p === "x" ? i.left - (m?.m41 ?? 0) + i.width / 2 : i.top - (m?.m42 ?? 0) + i.height / 2);
|
|
17
17
|
});
|
|
18
|
-
a < 0 && (a =
|
|
19
|
-
const
|
|
20
|
-
return
|
|
18
|
+
a < 0 && (a = l.length);
|
|
19
|
+
const r = [...l];
|
|
20
|
+
return r.splice(a, 0, s), { key: l[Math.min(a, l.length - 1)], edge: a === l.length ? "after" : "before", order: r };
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function F(t, s, e, p) {
|
|
23
23
|
if (!e.altKey || !e.shiftKey || e.ctrlKey || e.metaKey || e.isComposing) return;
|
|
24
|
-
const g = e.key === (p === "x" ? "ArrowLeft" : "ArrowUp") ? -1 : e.key === (p === "x" ? "ArrowRight" : "ArrowDown") ? 1 : 0, y = t.indexOf(
|
|
24
|
+
const g = e.key === (p === "x" ? "ArrowLeft" : "ArrowUp") ? -1 : e.key === (p === "x" ? "ArrowRight" : "ArrowDown") ? 1 : 0, y = t.indexOf(s);
|
|
25
25
|
if (!g || y < 0) return;
|
|
26
26
|
e.preventDefault(), e.stopPropagation();
|
|
27
|
-
const
|
|
28
|
-
if (y ===
|
|
27
|
+
const l = Math.max(0, Math.min(t.length - 1, y + g));
|
|
28
|
+
if (y === l) return;
|
|
29
29
|
const a = [...t];
|
|
30
|
-
return a.splice(y, 1), a.splice(
|
|
30
|
+
return a.splice(y, 1), a.splice(l, 0, s), a;
|
|
31
31
|
}
|
|
32
32
|
function U(t) {
|
|
33
|
-
const [
|
|
34
|
-
let a,
|
|
35
|
-
const w = (
|
|
36
|
-
|
|
33
|
+
const [s, e] = $(), [p, g] = $(void 0, { equals: z }), [y, l] = $();
|
|
34
|
+
let a, r = !1, n = 0;
|
|
35
|
+
const w = (c) => {
|
|
36
|
+
c.key !== "Escape" || !a || (c.preventDefault(), c.stopPropagation(), a.stop({ commit: !1 }));
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
S(() => {
|
|
39
39
|
t.keys(), t.onReorder(), a?.stop({ commit: !1 });
|
|
40
|
-
}),
|
|
41
|
-
const
|
|
42
|
-
t.onReorder()?.(m), t.elements.get(
|
|
40
|
+
}), X(() => a?.stop({ commit: !1 }));
|
|
41
|
+
const i = (c, m) => {
|
|
42
|
+
t.onReorder()?.(m), t.elements.get(c)?.focus({ preventScroll: !0 });
|
|
43
43
|
};
|
|
44
44
|
return {
|
|
45
|
-
dragging:
|
|
45
|
+
dragging: s,
|
|
46
46
|
position: p,
|
|
47
47
|
translation: y,
|
|
48
|
-
keyDown(
|
|
48
|
+
keyDown(c, m) {
|
|
49
49
|
if (!t.onReorder()) return;
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const o = F(t.keys(), c, m, "y");
|
|
51
|
+
o && i(c, o);
|
|
52
52
|
},
|
|
53
|
-
consumeClick(
|
|
54
|
-
const m =
|
|
55
|
-
return
|
|
53
|
+
consumeClick(c) {
|
|
54
|
+
const m = r && c.detail !== 0;
|
|
55
|
+
return r = !1, m;
|
|
56
56
|
},
|
|
57
|
-
begin(
|
|
58
|
-
if (m.button !== 0 || (
|
|
57
|
+
begin(c, m) {
|
|
58
|
+
if (m.button !== 0 || (r = !1, !t.onReorder() || !t.keys().includes(c))) return;
|
|
59
59
|
a?.stop({ commit: !1 });
|
|
60
|
-
const
|
|
60
|
+
const o = m.currentTarget, x = m.clientY, d = m.clientX, M = t.container(), k = M?.scrollTop ?? 0, C = I(t.elements, "y"), D = getComputedStyle(o).transform, E = typeof DOMMatrix == "function" ? new DOMMatrix(D === "none" ? void 0 : D) : void 0, b = o.getBoundingClientRect();
|
|
61
61
|
let R = d, v = x, O = !1;
|
|
62
|
-
const
|
|
62
|
+
const Y = (u, f) => {
|
|
63
63
|
if (R = u, v = f, O ||= Math.hypot(u - d, f - x) >= 5, !O) return;
|
|
64
|
-
e(
|
|
65
|
-
const h = t.container()?.getBoundingClientRect(), B = (M?.scrollTop ?? 0) - k, A = h ? Math.max(h.top, Math.min(h.bottom -
|
|
66
|
-
|
|
64
|
+
e(c);
|
|
65
|
+
const h = t.container()?.getBoundingClientRect(), B = (M?.scrollTop ?? 0) - k, A = h ? Math.max(h.top, Math.min(h.bottom - b.height, b.top + f - x)) : b.top + f - x;
|
|
66
|
+
l({ key: c, x: 0, y: A - b.top + (E?.m42 ?? 0) + B }), g(h && u >= h.left - 24 && u <= h.right + 24 && f >= h.top && f <= h.bottom ? q(t.keys(), c, t.elements, "y", f + B, C) : void 0);
|
|
67
67
|
}, T = () => {
|
|
68
68
|
const u = t.container();
|
|
69
69
|
if (O && u) {
|
|
70
70
|
const f = u.getBoundingClientRect(), h = v < f.top + 28 ? v - f.top - 28 : v > f.bottom - 28 ? v - f.bottom + 28 : 0;
|
|
71
71
|
if (R >= f.left - 24 && R <= f.right + 24 && v >= f.top - 24 && v <= f.bottom + 24 && h) {
|
|
72
72
|
const B = u.scrollTop;
|
|
73
|
-
u.scrollTop += Math.sign(h) * Math.min(10, Math.abs(h) / 3), u.scrollTop !== B &&
|
|
73
|
+
u.scrollTop += Math.sign(h) * Math.min(10, Math.abs(h) / 3), u.scrollTop !== B && Y(R, v);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
n = requestAnimationFrame(T);
|
|
77
77
|
};
|
|
78
|
-
|
|
78
|
+
n = requestAnimationFrame(T), o.ownerDocument.addEventListener("keydown", w, !0), a = P({
|
|
79
79
|
pointerEvent: m,
|
|
80
|
-
captureEl:
|
|
81
|
-
onMove: (u) =>
|
|
80
|
+
captureEl: o,
|
|
81
|
+
onMove: (u) => Y(u.clientX, u.clientY),
|
|
82
82
|
onEnd: ({ commit: u, snapshot: f, reason: h }) => {
|
|
83
|
-
u &&= h === "pointer_up" || h === "buttons_released",
|
|
83
|
+
u &&= h === "pointer_up" || h === "buttons_released", Y(f.latestClientX, f.latestClientY);
|
|
84
84
|
const B = p();
|
|
85
|
-
cancelAnimationFrame(
|
|
85
|
+
cancelAnimationFrame(n), a = void 0, o.ownerDocument.removeEventListener("keydown", w, !0), e(void 0), l(void 0), g(void 0), r = O || !u, u && O && B && i(c, B.order);
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
93
|
-
let
|
|
94
|
-
for (let
|
|
95
|
-
|
|
96
|
-
return { scrollX:
|
|
97
|
-
}, g = (
|
|
98
|
-
for (const [
|
|
99
|
-
const
|
|
100
|
-
|
|
91
|
+
function Z(t) {
|
|
92
|
+
const s = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), p = (r) => {
|
|
93
|
+
let n = 0, w = 0;
|
|
94
|
+
for (let i = r.parentElement; i; i = i.parentElement)
|
|
95
|
+
n += i.scrollLeft, w += i.scrollTop;
|
|
96
|
+
return { scrollX: n, scrollY: w };
|
|
97
|
+
}, g = (r) => {
|
|
98
|
+
for (const [n, w] of s) {
|
|
99
|
+
const i = t.elements.get(n);
|
|
100
|
+
i && r.target instanceof Node && r.target.contains(i) && s.set(n, { ...w, ...p(i) });
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
typeof document < "u" && (document.addEventListener("scroll", g, !0),
|
|
104
|
-
let y = !1,
|
|
103
|
+
typeof document < "u" && (document.addEventListener("scroll", g, !0), X(() => document.removeEventListener("scroll", g, !0)));
|
|
104
|
+
let y = !1, l = 0;
|
|
105
105
|
const a = L(() => t.drag?.()?.key);
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
if (!
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
S(() => {
|
|
107
|
+
const r = a(), n = r ? t.elements.get(r) : void 0;
|
|
108
|
+
if (!n) return;
|
|
109
|
+
const w = n.style.zIndex, i = n.style.cursor;
|
|
110
|
+
n.style.zIndex = "1", n.style.cursor = "grabbing", X(() => {
|
|
111
|
+
n.style.zIndex = w, n.style.cursor = i;
|
|
112
|
+
});
|
|
113
|
+
}), S(() => {
|
|
114
|
+
const r = t.drag?.();
|
|
115
|
+
if (!r) return;
|
|
116
|
+
const n = t.elements.get(r.key);
|
|
117
|
+
e.get(r.key)?.cancel(), e.delete(r.key), n && (n.style.transform = `translate3d(${r.x}px, ${r.y}px, 0)`);
|
|
118
|
+
}), S(() => {
|
|
119
|
+
const r = [...t.keys()], n = t.preview(), w = a(), i = ++l;
|
|
113
120
|
queueMicrotask(() => {
|
|
114
|
-
if (
|
|
115
|
-
const
|
|
116
|
-
const x = t.elements.get(
|
|
121
|
+
if (l !== i) return;
|
|
122
|
+
const c = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, m = new Map(r.flatMap((o) => {
|
|
123
|
+
const x = t.elements.get(o);
|
|
117
124
|
if (!x) return [];
|
|
118
|
-
const d = x.getBoundingClientRect(), M = getComputedStyle(x).transform, k = typeof DOMMatrix == "function" ? new DOMMatrix(M === "none" ? void 0 : M) : void 0, { scrollX: C, scrollY:
|
|
119
|
-
return [[
|
|
125
|
+
const d = x.getBoundingClientRect(), M = getComputedStyle(x).transform, k = typeof DOMMatrix == "function" ? new DOMMatrix(M === "none" ? void 0 : M) : void 0, { scrollX: C, scrollY: D } = p(x);
|
|
126
|
+
return [[o, { left: d.left + C - (k?.m41 ?? 0), top: d.top + D - (k?.m42 ?? 0), scrollX: C, scrollY: D, dx: k?.m41 ?? 0, dy: k?.m42 ?? 0 }]];
|
|
120
127
|
}));
|
|
121
|
-
for (const
|
|
122
|
-
const x = t.elements.get(
|
|
128
|
+
for (const o of r) {
|
|
129
|
+
const x = t.elements.get(o), d = m.get(o);
|
|
123
130
|
if (!x || !d) continue;
|
|
124
|
-
const M =
|
|
125
|
-
if (w ===
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
131
|
+
const M = s.get(o);
|
|
132
|
+
if (w === o) {
|
|
133
|
+
s.set(o, d);
|
|
134
|
+
const b = K(() => t.drag?.());
|
|
135
|
+
b && (x.style.transform = `translate3d(${b.x}px, ${b.y}px, 0)`);
|
|
129
136
|
continue;
|
|
130
137
|
}
|
|
131
|
-
const k =
|
|
132
|
-
if (e.get(
|
|
133
|
-
const
|
|
134
|
-
if (!M || Math.abs(
|
|
138
|
+
const k = n ? r[n.indexOf(o)] : o, C = m.get(k) ?? d, D = t.axis === "x" ? C.left - d.left : 0, E = t.axis === "y" ? C.top - d.top : 0;
|
|
139
|
+
if (e.get(o)?.cancel(), e.delete(o), x.style.transform = `translate3d(${D}px, ${E}px, 0)`, !c && y && typeof x.animate == "function") {
|
|
140
|
+
const b = M ? M.left - M.scrollX - d.left + d.scrollX + d.dx : D, R = M ? M.top - M.scrollY - d.top + d.scrollY + d.dy : E;
|
|
141
|
+
if (!M || Math.abs(b - D) + Math.abs(R - E) > 0.5) {
|
|
135
142
|
const v = x.animate([
|
|
136
|
-
{ transform: `translate3d(${
|
|
137
|
-
{ transform: `translate3d(${
|
|
143
|
+
{ transform: `translate3d(${b}px, ${R}px, 0)`, ...M ? {} : { opacity: 0 } },
|
|
144
|
+
{ transform: `translate3d(${D}px, ${E}px, 0)`, ...M ? {} : { opacity: 1 } }
|
|
138
145
|
], { duration: 180, easing: "cubic-bezier(0.33, 1, 0.68, 1)" });
|
|
139
|
-
e.set(
|
|
140
|
-
e.get(
|
|
146
|
+
e.set(o, v), v.onfinish = () => {
|
|
147
|
+
e.get(o) === v && e.delete(o);
|
|
141
148
|
};
|
|
142
149
|
}
|
|
143
150
|
}
|
|
144
|
-
|
|
151
|
+
s.set(o, d);
|
|
145
152
|
}
|
|
146
|
-
for (const
|
|
153
|
+
for (const o of s.keys()) r.includes(o) || (s.delete(o), e.get(o)?.cancel(), e.delete(o));
|
|
147
154
|
y = !0;
|
|
148
155
|
});
|
|
149
|
-
}),
|
|
150
|
-
|
|
151
|
-
for (const
|
|
156
|
+
}), X(() => {
|
|
157
|
+
l += 1;
|
|
158
|
+
for (const r of e.values()) r.cancel();
|
|
152
159
|
});
|
|
153
160
|
}
|
|
154
161
|
export {
|
|
155
|
-
|
|
156
|
-
|
|
162
|
+
q as barDropPosition,
|
|
163
|
+
Z as createBarLayoutMotion,
|
|
157
164
|
U as createBarReorder,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
F as keyboardBarOrder,
|
|
166
|
+
I as measureBarSlots,
|
|
167
|
+
z as sameBarDropPosition
|
|
161
168
|
};
|
package/dist/graph.d.ts
CHANGED
package/dist/graph.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { fitGraphViewport as
|
|
1
|
+
import { fitGraphViewport as a, graphEdgeLabelPosition as o, graphRelatedEdges as p, graphSectionPath as t } from "./components/graph/geometry.js";
|
|
2
2
|
import { createGraphLayoutEngine as i } from "./components/graph/engine.js";
|
|
3
|
-
import { GraphCanvas as
|
|
4
|
-
import { GraphMinimap as
|
|
3
|
+
import { GraphCanvas as g } from "./components/graph/GraphCanvas.js";
|
|
4
|
+
import { GraphMinimap as n } from "./components/graph/GraphMinimap.js";
|
|
5
|
+
import { createGraphViewport as G } from "./components/graph/viewport-motion.js";
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
g as GraphCanvas,
|
|
8
|
+
n as GraphMinimap,
|
|
8
9
|
i as createGraphLayoutEngine,
|
|
9
|
-
|
|
10
|
+
G as createGraphViewport,
|
|
11
|
+
a as fitGraphViewport,
|
|
10
12
|
o as graphEdgeLabelPosition,
|
|
11
13
|
p as graphRelatedEdges,
|
|
12
14
|
t as graphSectionPath
|