@floegence/floe-webapp-core 0.101.20 → 0.101.28

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.
@@ -8,6 +8,8 @@ export interface GraphNodeRenderContext {
8
8
  }
9
9
  export interface GraphCanvasProps {
10
10
  layout: GraphLayout;
11
+ /** Animate layout changes with one geometry clock. Reduced motion settles immediately. */
12
+ animateLayout?: boolean;
11
13
  viewport: GraphViewport;
12
14
  onViewportChange: (viewport: GraphViewport) => void;
13
15
  ariaLabel: string;
@@ -1,111 +1,159 @@
1
- import { insert as S, createComponent as w, setAttribute as c, effect as z, setStyleProperty as L, className as J, template as B, memo as it, use as lt, delegateEvents as dt } from "solid-js/web";
2
- import { createUniqueId as ct, createSignal as Q, createMemo as v, onMount as ut, For as _, Show as N, onCleanup as st } from "solid-js";
3
- import { InfiniteCanvas as gt } from "../ui/InfiniteCanvas.js";
4
- import { resolveSurfaceInteractionTargetRole as ht } from "../ui/localInteractionSurface.js";
5
- import { graphRelatedEdges as Z, graphEdgeLabelPosition as vt, graphSectionPath as ft } from "./geometry.js";
6
- import { GraphMinimap as mt } from "./GraphMinimap.js";
7
- var bt = /* @__PURE__ */ B("<div data-floe-canvas-pan-surface=true role=group tabindex=0>"), xt = /* @__PURE__ */ B("<div role=region tabindex=0>"), yt = /* @__PURE__ */ B('<svg class=floe-graph__edges><defs><marker viewBox="0 0 8 8"refX=7 refY=4 markerWidth=7 markerHeight=7 orient=auto-start-reverse><path d="M1 1 L7 4 L1 7"fill=none stroke=context-stroke stroke-width=1.2>'), kt = /* @__PURE__ */ B("<svg><g><path class=floe-graph__edge></path><path class=floe-graph__edge-target tabindex=0 role=button data-floe-canvas-pan-surface=true></svg>", !1, !0, !1), wt = /* @__PURE__ */ B("<svg><text class=floe-graph__edge-label aria-hidden=true></svg>", !1, !0, !1);
8
- function It(o) {
9
- const V = `graph-arrow-${ct()}`;
10
- let f;
11
- const [p, tt] = Q(null), [F, et] = Q({
1
+ import { insert as A, createComponent as P, setAttribute as s, effect as p, setStyleProperty as L, memo as Me, className as le, template as z, use as ke, delegateEvents as Ce } from "solid-js/web";
2
+ import { createUniqueId as $e, createSignal as X, onMount as de, onCleanup as Z, createEffect as Le, untrack as Y, createMemo as x, For as ce, Show as _ } from "solid-js";
3
+ import { createStore as Ee, reconcile as q, unwrap as Se } from "solid-js/store";
4
+ import { createGraphLayoutTransition as Ie } from "./layout-motion.js";
5
+ import { InfiniteCanvas as Ae } from "../ui/InfiniteCanvas.js";
6
+ import { resolveSurfaceInteractionTargetRole as Pe } from "../ui/localInteractionSurface.js";
7
+ import { graphRelatedEdges as se, graphEdgeLabelPosition as Te, graphSectionPath as Fe } from "./geometry.js";
8
+ import { GraphMinimap as Ge } from "./GraphMinimap.js";
9
+ var Re = /* @__PURE__ */ z("<div data-floe-canvas-pan-surface=true role=group tabindex=0>"), pe = /* @__PURE__ */ z("<div role=region tabindex=0>"), ze = /* @__PURE__ */ z('<svg class=floe-graph__edges><defs><marker viewBox="0 0 8 8"refX=7 refY=4 markerWidth=7 markerHeight=7 orient=auto-start-reverse><path d="M1 1 L7 4 L1 7"fill=none stroke=context-stroke stroke-width=1.2>'), Be = /* @__PURE__ */ z("<svg><g><path class=floe-graph__edge></path><path class=floe-graph__edge-target tabindex=0 role=button data-floe-canvas-pan-surface=true></svg>", !1, !0, !1), He = /* @__PURE__ */ z("<svg><text class=floe-graph__edge-label aria-hidden=true></svg>", !1, !0, !1);
10
+ function Ke(i) {
11
+ const ee = `graph-arrow-${$e()}`;
12
+ let b;
13
+ const [V, ue] = X(null), [te, he] = X({
12
14
  width: 0,
13
15
  height: 0
14
- }), W = () => o.highlight === void 0 ? p() : o.highlight, j = v(() => o.layout.nodes), nt = v(() => new Map(j().map((t) => [t.id, t]))), rt = v(() => {
15
- const t = W();
16
- return t?.kind === "node" ? Z(o.layout, t.id) : new Set(t ? [t.id] : []);
17
- }), q = v(() => {
18
- const t = W();
19
- if (t?.kind !== "node") return null;
20
- const e = nt().get(t.id), r = e?.kind === "group" ? e.id : e?.parentId;
21
- return r ? Z(o.layout, r) : null;
22
- }), D = (t) => o.selected?.kind === t.kind && o.selected.id === t.id, H = (t) => {
16
+ }), ne = () => i.highlight === void 0 ? V() : i.highlight, [j, B] = Ee({
17
+ nodes: [],
18
+ edges: [],
19
+ bounds: {
20
+ x: 0,
21
+ y: 0,
22
+ width: 0,
23
+ height: 0
24
+ }
25
+ }), [M, H] = X(!1), [ge, ve] = X(!1);
26
+ let D = 0, re, ae = 0;
27
+ de(() => {
28
+ const e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () => ve(e.matches);
29
+ t(), e.addEventListener("change", t), Z(() => e.removeEventListener("change", t));
30
+ }), Le(() => {
31
+ const e = i.layout, t = ge() || typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, n = re !== e.nodes;
32
+ if (re = e.nodes, cancelAnimationFrame(D), !i.animateLayout) {
33
+ H(!1);
34
+ return;
35
+ }
36
+ if (!n && !Y(M) && Y(() => j.nodes.length)) {
37
+ B("edges", q(structuredClone(e.edges)));
38
+ return;
39
+ }
40
+ const o = Y(() => structuredClone(Se(j)));
41
+ if (t || !o.nodes.length || !n && !Y(M)) {
42
+ B(q(structuredClone(e))), H(!1);
43
+ return;
44
+ }
45
+ const a = Ie(o, structuredClone(e)), r = performance.now();
46
+ n && (ae = r + 280);
47
+ const l = Math.max(1, ae - r);
48
+ H(!0), B(q(a(0)));
49
+ const f = (y) => {
50
+ const d = Math.min(1, (y - r) / l);
51
+ B(q(a(1 - Math.pow(1 - d, 3)))), d < 1 ? D = requestAnimationFrame(f) : H(!1);
52
+ };
53
+ D = requestAnimationFrame(f);
54
+ }), Z(() => cancelAnimationFrame(D));
55
+ const E = () => i.animateLayout ? j : i.layout, W = x(() => E().nodes), oe = x(() => new Map(W().map((e) => [e.id, e]))), fe = x(() => {
56
+ const e = ne();
57
+ return e?.kind === "node" ? se(E(), e.id) : new Set(e ? [e.id] : []);
58
+ }), ie = x(() => {
59
+ const e = ne();
60
+ if (e?.kind !== "node") return null;
61
+ const t = oe().get(e.id), n = t?.kind === "group" ? t.id : t?.parentId;
62
+ return n ? se(E(), n) : null;
63
+ }), K = (e) => i.selected?.kind === e.kind && i.selected.id === e.id, O = (e) => {
23
64
  const {
24
- width: e,
25
- height: r
26
- } = F();
27
- if (!e || !r) return;
28
- const n = -t.x / t.scale - 240, a = -t.y / t.scale - 240, y = n + e / t.scale + 480, s = a + r / t.scale + 480;
65
+ width: t,
66
+ height: n
67
+ } = te();
68
+ if (!t || !n) return;
69
+ const o = -e.x / e.scale - 240, a = -e.y / e.scale - 240, r = o + t / e.scale + 480, l = a + n / e.scale + 480;
29
70
  return {
30
- left: n,
71
+ left: o,
31
72
  top: a,
32
- right: y,
33
- bottom: s
73
+ right: r,
74
+ bottom: l
34
75
  };
35
- }, at = (t) => {
36
- const e = H(t);
37
- if (!e) return j();
76
+ }, me = (e) => {
77
+ const t = O(e);
78
+ if (!t) return W();
38
79
  const {
39
- left: r,
40
- top: n,
80
+ left: n,
81
+ top: o,
41
82
  right: a,
42
- bottom: y
43
- } = e;
44
- return j().filter((s) => s.id === o.selected?.id || s.x + s.width >= r && s.x <= a && s.y + s.height >= n && s.y <= y);
45
- }, K = v(() => o.layout.edges.map((t) => ({
46
- edge: t,
47
- path: t.sections.map(ft).join(" "),
48
- label: vt(t.sections),
49
- segments: t.sections.flatMap((e) => e.slice(1).map((r, n) => ({
50
- left: Math.min(r.x, e[n].x),
51
- right: Math.max(r.x, e[n].x),
52
- top: Math.min(r.y, e[n].y),
53
- bottom: Math.max(r.y, e[n].y)
83
+ bottom: r
84
+ } = t;
85
+ return W().filter((l) => l.id === i.selected?.id || l.x + l.width >= n && l.x <= a && l.y + l.height >= o && l.y <= r);
86
+ }, U = x(() => E().edges.map((e) => ({
87
+ edge: e,
88
+ path: e.sections.map(Fe).join(" "),
89
+ label: Te(e.sections),
90
+ segments: e.sections.flatMap((t) => t.slice(1).map((n, o) => ({
91
+ left: Math.min(n.x, t[o].x),
92
+ right: Math.max(n.x, t[o].x),
93
+ top: Math.min(n.y, t[o].y),
94
+ bottom: Math.max(n.y, t[o].y)
54
95
  })))
55
- }))), ot = (t) => {
56
- const e = H(t);
57
- return e ? K().filter(({
58
- edge: r,
59
- segments: n
60
- }) => r.id === o.selected?.id || n.some((a) => a.left <= e.right && a.right >= e.left && a.top <= e.bottom && a.bottom >= e.top)) : K();
61
- }, m = (t) => {
62
- tt(t), o.onHover?.(t);
63
- }, $ = (t, e, r) => {
64
- const n = e.getBoundingClientRect();
96
+ }))), xe = x(() => new Map(U().map((e) => [e.edge.id, e]))), be = (e) => {
97
+ const t = O(e);
98
+ return t ? U().filter(({
99
+ edge: n,
100
+ segments: o
101
+ }) => n.id === i.selected?.id || o.some((a) => a.left <= t.right && a.right >= t.left && a.top <= t.bottom && a.bottom >= t.top)) : U();
102
+ }, k = (e) => {
103
+ ue(e), i.onHover?.(e);
104
+ }, N = (e) => {
105
+ !M() && (V()?.kind !== e.kind || V()?.id !== e.id) && k(e);
106
+ }, S = (e, t, n) => {
107
+ const o = t.getBoundingClientRect();
65
108
  return {
66
- object: t,
67
- owner: e,
68
- position: r && (r.clientX !== 0 || r.clientY !== 0) ? {
69
- x: r.clientX,
70
- y: r.clientY
109
+ object: e,
110
+ owner: t,
111
+ position: n && (n.clientX !== 0 || n.clientY !== 0) ? {
112
+ x: n.clientX,
113
+ y: n.clientY
71
114
  } : {
72
- x: n.left + n.width / 2,
73
- y: n.top + Math.min(32, n.height / 2)
115
+ x: o.left + o.width / 2,
116
+ y: o.top + Math.min(32, o.height / 2)
74
117
  }
75
118
  };
76
- }, X = (t, e) => {
77
- o.onContextMenu && (e.preventDefault(), e.stopPropagation(), o.onContextMenu($(t, e.currentTarget, e)));
78
- }, Y = (t, e) => {
79
- e.target === e.currentTarget && (e.key === "ContextMenu" || e.shiftKey && e.key === "F10" ? (e.preventDefault(), e.stopPropagation(), o.onContextMenu?.($(t, e.currentTarget))) : e.key === "Enter" ? (e.preventDefault(), e.stopPropagation(), o.onActivate?.($(t, e.currentTarget))) : e.key === "Escape" && (m(null), o.onActivate?.($(null, f))));
119
+ }, J = (e, t) => {
120
+ i.onContextMenu && (t.preventDefault(), t.stopPropagation(), i.onContextMenu(S(e, t.currentTarget, t)));
121
+ }, Q = (e, t) => {
122
+ t.target === t.currentTarget && (t.key === "ContextMenu" || t.shiftKey && t.key === "F10" ? (t.preventDefault(), t.stopPropagation(), i.onContextMenu?.(S(e, t.currentTarget))) : t.key === "Enter" ? (t.preventDefault(), t.stopPropagation(), i.onActivate?.(S(e, t.currentTarget))) : t.key === "Escape" && (k(null), i.onActivate?.(S(null, b))));
80
123
  };
81
- ut(() => {
82
- if (!f) return;
83
- const t = () => et({
84
- width: f.clientWidth,
85
- height: f.clientHeight
124
+ de(() => {
125
+ if (!b) return;
126
+ const e = () => he({
127
+ width: b.clientWidth,
128
+ height: b.clientHeight
86
129
  });
87
- t();
88
- const e = new ResizeObserver(t);
89
- e.observe(f), st(() => e.disconnect());
130
+ e();
131
+ const t = new ResizeObserver(e);
132
+ t.observe(b), Z(() => t.disconnect());
90
133
  });
91
- const O = (t) => {
92
- const e = {
134
+ const ye = (e) => {
135
+ if (!M() || !e.parentId) return;
136
+ const t = oe().get(e.parentId);
137
+ if (!t) return;
138
+ const n = Math.max(0, t.y - e.y), o = Math.max(0, t.x - e.x), a = Math.max(0, e.x + e.width - t.x - t.width), r = Math.max(0, e.y + e.height - t.y - t.height);
139
+ return n || o || a || r ? `inset(${n}px ${a}px ${r}px ${o}px)` : void 0;
140
+ }, we = (e) => {
141
+ const t = {
93
142
  kind: "node",
94
- id: t.id
95
- }, r = {
96
- selected: () => D(e),
97
- openMenu: (n) => X(e, n)
98
- };
143
+ id: e.id
144
+ }, n = {
145
+ selected: () => K(t),
146
+ openMenu: (a) => J(t, a)
147
+ }, o = x(() => e.kind === "group" && i.renderGroup ? i.renderGroup : i.renderNode);
99
148
  return (() => {
100
- var n = bt();
101
- return n.$$keydown = (a) => Y(e, a), n.$$contextmenu = (a) => X(e, a), n.$$click = (a) => {
102
- a.target.closest("button, a, input, select, textarea, [data-floe-canvas-interactive]") || (a.stopPropagation(), o.onActivate?.($(e, a.currentTarget, a)));
103
- }, n.$$focusout = () => m(null), n.$$focusin = () => m(e), n.addEventListener("pointerleave", () => m(null)), n.addEventListener("pointerenter", () => m(e)), S(n, (() => {
104
- var a = it(() => !!(t.kind === "group" && o.renderGroup));
105
- return () => a() ? o.renderGroup(t, r) : o.renderNode(t, r);
106
- })()), z((a) => {
107
- var y = t.kind === "group" ? "floe-graph__group" : "floe-graph__node", s = t.id, G = D(e), d = `${t.x}px`, C = `${t.y}px`, M = `${t.width}px`, l = `${t.height}px`, u = t.label;
108
- return y !== a.e && J(n, a.e = y), s !== a.t && c(n, "data-graph-object", a.t = s), G !== a.a && c(n, "data-selected", a.a = G), d !== a.o && L(n, "left", a.o = d), C !== a.i && L(n, "top", a.i = C), M !== a.n && L(n, "width", a.n = M), l !== a.s && L(n, "height", a.s = l), u !== a.h && c(n, "aria-label", a.h = u), a;
149
+ var a = Re();
150
+ return a.$$keydown = (r) => Q(t, r), a.$$contextmenu = (r) => J(t, r), a.$$click = (r) => {
151
+ r.target.closest("button, a, input, select, textarea, [data-floe-canvas-interactive]") || (r.stopPropagation(), i.onActivate?.(S(t, r.currentTarget, r)));
152
+ }, a.$$focusout = () => k(null), a.$$focusin = () => k(t), a.addEventListener("pointerleave", () => {
153
+ M() || k(null);
154
+ }), a.$$pointermove = () => N(t), a.addEventListener("pointerenter", () => N(t)), A(a, () => o()(e, n)), p((r) => {
155
+ var l = e.kind === "group" ? "floe-graph__group" : "floe-graph__node", f = e.id, y = K(t), d = `${e.x}px`, v = `${e.y}px`, w = `${e.width}px`, h = `${e.height}px`, C = e.opacity ?? 1, I = ye(e), g = e.exiting || void 0, T = e.exiting || void 0, u = e.label;
156
+ return l !== r.e && le(a, r.e = l), f !== r.t && s(a, "data-graph-object", r.t = f), y !== r.a && s(a, "data-selected", r.a = y), d !== r.o && L(a, "left", r.o = d), v !== r.i && L(a, "top", r.i = v), w !== r.n && L(a, "width", r.n = w), h !== r.s && L(a, "height", r.s = h), C !== r.h && L(a, "opacity", r.h = C), I !== r.r && L(a, "clip-path", r.r = I), g !== r.d && (a.inert = r.d = g), T !== r.l && s(a, "aria-hidden", r.l = T), u !== r.u && s(a, "aria-label", r.u = u), r;
109
157
  }, {
110
158
  e: void 0,
111
159
  t: void 0,
@@ -114,114 +162,112 @@ function It(o) {
114
162
  i: void 0,
115
163
  n: void 0,
116
164
  s: void 0,
117
- h: void 0
118
- }), n;
165
+ h: void 0,
166
+ r: void 0,
167
+ d: void 0,
168
+ l: void 0,
169
+ u: void 0
170
+ }), a;
119
171
  })();
120
172
  };
121
173
  return (() => {
122
- var t = xt();
123
- t.$$keydown = (r) => Y(null, r);
124
- var e = f;
125
- return typeof e == "function" ? lt(e, t) : f = t, S(t, w(gt, {
174
+ var e = pe();
175
+ e.$$keydown = (n) => Q(null, n);
176
+ var t = b;
177
+ return typeof t == "function" ? ke(t, e) : b = e, A(e, P(Ae, {
126
178
  get viewport() {
127
- return o.viewport;
179
+ return i.viewport;
128
180
  },
129
181
  minScale: 0.1,
130
182
  maxScale: 3,
131
183
  get ariaLabel() {
132
- return o.ariaLabel;
184
+ return i.ariaLabel;
133
185
  },
134
186
  get onViewportChange() {
135
- return o.onViewportChange;
187
+ return i.onViewportChange;
136
188
  },
137
- onViewportInteractionStart: () => o.onInteractionStart?.(),
138
- resolveTargetRole: (r) => (r.target instanceof Element ? r.target : null)?.closest('button, a, input, select, textarea, [data-floe-canvas-interactive="true"]') ? "local_surface" : ht(r),
139
- onCanvasPointerDown: (r) => {
140
- !(r.target instanceof Element) || r.target.closest("[data-graph-object]") || o.onActivate?.($(null, f, r));
189
+ onViewportInteractionStart: () => i.onInteractionStart?.(),
190
+ resolveTargetRole: (n) => (n.target instanceof Element ? n.target : null)?.closest('button, a, input, select, textarea, [data-floe-canvas-interactive="true"]') ? "local_surface" : Pe(n),
191
+ onCanvasPointerDown: (n) => {
192
+ !(n.target instanceof Element) || n.target.closest("[data-graph-object]") || i.onActivate?.(S(null, b, n));
141
193
  },
142
- onCanvasContextMenu: (r) => o.onContextMenu?.({
194
+ onCanvasContextMenu: (n) => i.onContextMenu?.({
143
195
  object: null,
144
- owner: f,
196
+ owner: b,
145
197
  position: {
146
- x: r.clientX,
147
- y: r.clientY
198
+ x: n.clientX,
199
+ y: n.clientY
148
200
  }
149
201
  }),
150
- children: (r) => {
151
- const n = v(() => {
152
- const d = H(r());
153
- if (d) return d;
202
+ children: (n) => {
203
+ const o = x(() => {
204
+ const l = O(n());
205
+ if (l) return l;
154
206
  const {
155
- x: C,
156
- y: M,
157
- width: l,
158
- height: u
159
- } = o.layout.bounds;
207
+ x: f,
208
+ y,
209
+ width: d,
210
+ height: v
211
+ } = E().bounds;
160
212
  return {
161
- left: C - 240,
162
- top: M - 240,
163
- right: C + l + 240,
164
- bottom: M + u + 240
213
+ left: f - 240,
214
+ top: y - 240,
215
+ right: f + d + 240,
216
+ bottom: y + v + 240
165
217
  };
166
- }), a = v(() => at(r())), y = v(() => a().filter((d) => d.kind === "group")), s = v(() => a().filter((d) => d.kind !== "group")), G = v(() => ot(r()));
167
- return [w(_, {
168
- get each() {
169
- return y();
170
- },
171
- children: O
172
- }), (() => {
173
- var d = yt(), C = d.firstChild, M = C.firstChild;
174
- return c(M, "id", V), S(d, w(_, {
218
+ }), a = x(() => me(n())), r = x(() => be(n()).map((l) => l.edge.id));
219
+ return [(() => {
220
+ var l = ze(), f = l.firstChild, y = f.firstChild;
221
+ return s(y, "id", ee), A(l, P(ce, {
175
222
  get each() {
176
- return G();
223
+ return r();
177
224
  },
178
- children: (l) => {
179
- const {
180
- edge: u
181
- } = l, b = {
225
+ children: (d) => {
226
+ const v = () => xe().get(d), w = () => v().edge, h = {
182
227
  kind: "edge",
183
- id: u.id
184
- }, I = () => l.path, R = () => l.label;
185
- return w(N, {
228
+ id: d
229
+ }, C = () => v().path, I = () => v().label;
230
+ return P(_, {
186
231
  get when() {
187
- return !q() || q().has(u.id);
232
+ return !ie() || ie().has(d);
188
233
  },
189
234
  get children() {
190
- var x = kt(), E = x.firstChild, g = E.nextSibling;
191
- return c(E, "marker-end", `url(#${V})`), S(x, w(N, {
235
+ var g = Be(), T = g.firstChild, u = T.nextSibling;
236
+ return s(g, "data-graph-object", d), s(T, "marker-end", `url(#${ee})`), A(g, P(_, {
192
237
  get when() {
193
- return R();
238
+ return I();
194
239
  },
195
- children: (i) => (() => {
196
- var k = wt();
197
- return S(k, () => u.label), z((h) => {
198
- var P = /^\d+$/.test(u.label), T = i().x, A = i().y - 6;
199
- return P !== h.e && c(k, "data-count", h.e = P), T !== h.t && c(k, "x", h.t = T), A !== h.a && c(k, "y", h.a = A), h;
240
+ children: (c) => (() => {
241
+ var $ = He();
242
+ return A($, () => w().label), p((m) => {
243
+ var F = /^\d+$/.test(w().label), G = c().x, R = c().y - 6;
244
+ return F !== m.e && s($, "data-count", m.e = F), G !== m.t && s($, "x", m.t = G), R !== m.a && s($, "y", m.a = R), m;
200
245
  }, {
201
246
  e: void 0,
202
247
  t: void 0,
203
248
  a: void 0
204
- }), k;
249
+ }), $;
205
250
  })()
206
- }), g), g.$$keydown = (i) => Y(b, i), g.$$contextmenu = (i) => X(b, i), g.$$click = (i) => {
207
- i.stopPropagation(), o.onActivate?.($(b, i.currentTarget, i));
208
- }, g.addEventListener("blur", () => m(null)), g.addEventListener("focus", () => m(b)), g.addEventListener("pointerleave", () => m(null)), g.addEventListener("pointerenter", () => m(b)), z((i) => {
209
- var k = u.id, h = rt().has(u.id), P = D(b), T = I(), A = I(), U = u.label;
210
- return k !== i.e && c(x, "data-graph-object", i.e = k), h !== i.t && c(x, "data-emphasized", i.t = h), P !== i.a && c(x, "data-selected", i.a = P), T !== i.o && c(E, "d", i.o = T), A !== i.i && c(g, "d", i.i = A), U !== i.n && c(g, "aria-label", i.n = U), i;
251
+ }), u), u.$$keydown = (c) => Q(h, c), u.$$contextmenu = (c) => J(h, c), u.$$click = (c) => {
252
+ c.stopPropagation(), i.onActivate?.(S(h, c.currentTarget, c));
253
+ }, u.addEventListener("blur", () => k(null)), u.addEventListener("focus", () => k(h)), u.addEventListener("pointerleave", () => {
254
+ M() || k(null);
255
+ }), u.$$pointermove = () => N(h), u.addEventListener("pointerenter", () => N(h)), p((c) => {
256
+ var $ = fe().has(d), m = K(h), F = C(), G = C(), R = w().label;
257
+ return $ !== c.e && s(g, "data-emphasized", c.e = $), m !== c.t && s(g, "data-selected", c.t = m), F !== c.a && s(T, "d", c.a = F), G !== c.o && s(u, "d", c.o = G), R !== c.i && s(u, "aria-label", c.i = R), c;
211
258
  }, {
212
259
  e: void 0,
213
260
  t: void 0,
214
261
  a: void 0,
215
262
  o: void 0,
216
- i: void 0,
217
- n: void 0
218
- }), x;
263
+ i: void 0
264
+ }), g;
219
265
  }
220
266
  });
221
267
  }
222
- }), null), z((l) => {
223
- var u = n().right - n().left, b = n().bottom - n().top, I = `${n().left} ${n().top} ${n().right - n().left} ${n().bottom - n().top}`, R = `${n().left}px`, x = `${n().top}px`, E = o.ariaLabel;
224
- return u !== l.e && c(d, "width", l.e = u), b !== l.t && c(d, "height", l.t = b), I !== l.a && c(d, "viewBox", l.a = I), R !== l.o && L(d, "left", l.o = R), x !== l.i && L(d, "top", l.i = x), E !== l.n && c(d, "aria-label", l.n = E), l;
268
+ }), null), p((d) => {
269
+ var v = o().right - o().left, w = o().bottom - o().top, h = `${o().left} ${o().top} ${o().right - o().left} ${o().bottom - o().top}`, C = `${o().left}px`, I = `${o().top}px`, g = i.ariaLabel;
270
+ return v !== d.e && s(l, "width", d.e = v), w !== d.t && s(l, "height", d.t = w), h !== d.a && s(l, "viewBox", d.a = h), C !== d.o && L(l, "left", d.o = C), I !== d.i && L(l, "top", d.i = I), g !== d.n && s(l, "aria-label", d.n = g), d;
225
271
  }, {
226
272
  e: void 0,
227
273
  t: void 0,
@@ -229,54 +275,56 @@ function It(o) {
229
275
  o: void 0,
230
276
  i: void 0,
231
277
  n: void 0
232
- }), d;
233
- })(), w(_, {
278
+ }), l;
279
+ })(), P(ce, {
234
280
  get each() {
235
- return s();
281
+ return a();
236
282
  },
237
- children: O
283
+ children: we
238
284
  })];
239
285
  }
240
- }), null), S(t, w(N, {
286
+ }), null), A(e, P(_, {
241
287
  get when() {
242
- return o.minimap;
288
+ return i.minimap;
243
289
  },
244
- children: (r) => w(mt, {
290
+ children: (n) => P(Ge, {
245
291
  get layout() {
246
- return o.layout;
292
+ return E();
247
293
  },
248
294
  get viewport() {
249
- return o.viewport;
295
+ return i.viewport;
250
296
  },
251
297
  get size() {
252
- return F();
298
+ return te();
253
299
  },
254
300
  get onViewportChange() {
255
- return o.onViewportChange;
301
+ return i.onViewportChange;
256
302
  },
257
303
  get onInteractionStart() {
258
- return o.onInteractionStart;
304
+ return i.onInteractionStart;
259
305
  },
260
306
  get ariaLabel() {
261
- return r().ariaLabel;
307
+ return n().ariaLabel;
262
308
  },
263
309
  get nodeStyle() {
264
- return r().nodeStyle;
310
+ return n().nodeStyle;
265
311
  },
266
312
  get edges() {
267
- return r().edges;
313
+ return Me(() => !!M())() ? E().edges : n().edges;
268
314
  }
269
315
  })
270
- }), null), S(t, () => o.overlay, null), z((r) => {
271
- var n = `floe-graph ${o.class ?? ""}`, a = o.ariaLabel;
272
- return n !== r.e && J(t, r.e = n), a !== r.t && c(t, "aria-label", r.t = a), r;
316
+ }), null), A(e, () => i.overlay, null), p((n) => {
317
+ var o = `floe-graph ${i.class ?? ""}`, a = M() || void 0, r = i.animateLayout || void 0, l = i.ariaLabel;
318
+ return o !== n.e && le(e, n.e = o), a !== n.t && s(e, "data-layout-moving", n.t = a), r !== n.a && s(e, "data-animate-layout", n.a = r), l !== n.o && s(e, "aria-label", n.o = l), n;
273
319
  }, {
274
320
  e: void 0,
275
- t: void 0
276
- }), t;
321
+ t: void 0,
322
+ a: void 0,
323
+ o: void 0
324
+ }), e;
277
325
  })();
278
326
  }
279
- dt(["focusin", "focusout", "click", "contextmenu", "keydown"]);
327
+ Ce(["pointermove", "focusin", "focusout", "click", "contextmenu", "keydown"]);
280
328
  export {
281
- It as GraphCanvas
329
+ Ke as GraphCanvas
282
330
  };
@@ -0,0 +1,10 @@
1
+ import type { GraphLayout, GraphLayoutNode } from './types';
2
+ export type MotionNode = GraphLayoutNode & {
3
+ opacity?: number;
4
+ exiting?: boolean;
5
+ };
6
+ export type MotionLayout = Omit<GraphLayout, 'nodes'> & {
7
+ nodes: readonly MotionNode[];
8
+ };
9
+ /** Presentation only: one clock moves boxes and routes; final worker geometry stays exact. */
10
+ export declare function createGraphLayoutTransition(from: MotionLayout, to: GraphLayout): (progress: number) => MotionLayout;
@@ -0,0 +1,88 @@
1
+ const u = (a, i, p) => a + (i - a) * p, l = (a, i, p) => ({
2
+ x: u(a.x, i.x, p),
3
+ y: u(a.y, i.y, p)
4
+ });
5
+ function v(a) {
6
+ const i = a.map(
7
+ (e, c) => c ? Math.hypot(e.x - a[c - 1].x, e.y - a[c - 1].y) : 0
8
+ );
9
+ let p = 0;
10
+ const g = i.map((e) => p += e);
11
+ return {
12
+ stops: g.map((e) => p ? e / p : 0),
13
+ at(e) {
14
+ const c = e * p, x = g.findIndex((M) => M >= c);
15
+ if (x <= 0) return a[0];
16
+ const b = g[x - 1];
17
+ return l(
18
+ a[x - 1],
19
+ a[x],
20
+ i[x] ? (c - b) / i[x] : 0
21
+ );
22
+ }
23
+ };
24
+ }
25
+ function q(a, i) {
26
+ const p = new Map(a.nodes.map((t) => [t.id, t])), g = new Map(i.nodes.map((t) => [t.id, t])), e = i.nodes.map((t) => {
27
+ const n = p.get(t.id), r = t.parentId ? p.get(t.parentId) : void 0, s = t.parentId ? g.get(t.parentId) : void 0, m = n ?? {
28
+ ...t,
29
+ x: r && s ? t.x + r.x - s.x : t.x,
30
+ y: r && s ? t.y + r.y - s.y + 12 : t.y + 12,
31
+ opacity: 0
32
+ };
33
+ return { node: t, start: m };
34
+ }), c = new Map(e.map(({ node: t, start: n }) => [t.id, n])), x = a.nodes.filter((t) => !g.has(t.id)), b = new Map(a.edges.map((t) => [t.id, t])), M = i.edges.map((t) => {
35
+ const n = b.get(t.id), r = t.sections.map((s, m) => {
36
+ let I = n?.source === t.source && n.target === t.target ? n.sections[m] : void 0;
37
+ if (!s.length) return () => s;
38
+ if (!I?.length) {
39
+ const h = g.get(t.source), y = g.get(t.target), d = c.get(t.source), E = c.get(t.target);
40
+ if (!h || !y || !d || !E) return () => s;
41
+ const G = (w, o, f) => ({
42
+ x: f.x - o.x + (w.x - o.x) / o.width * (f.width - o.width),
43
+ y: f.y - o.y + (w.y - o.y) / o.height * (f.height - o.height)
44
+ }), L = G(s[0], h, d), P = G(s[s.length - 1], y, E), T = v(s).stops;
45
+ I = s.map((w, o) => ({
46
+ x: w.x + u(L.x, P.x, T[o]),
47
+ y: w.y + u(L.y, P.y, T[o])
48
+ }));
49
+ }
50
+ const S = v(I), z = v(s), j = [.../* @__PURE__ */ new Set([...S.stops, ...z.stops, 1])].sort((h, y) => h - y).map((h) => [S.at(h), z.at(h)]);
51
+ return (h) => j.map(([y, d]) => l(y, d, h));
52
+ });
53
+ return { edge: t, sections: r };
54
+ });
55
+ return (t) => {
56
+ if (t >= 1) return i;
57
+ const n = Math.max(0, t);
58
+ return {
59
+ bounds: {
60
+ ...l(a.bounds, i.bounds, n),
61
+ width: u(a.bounds.width, i.bounds.width, n),
62
+ height: u(a.bounds.height, i.bounds.height, n)
63
+ },
64
+ nodes: [
65
+ ...e.map(({ node: r, start: s }) => ({
66
+ ...r,
67
+ ...l(s, r, n),
68
+ width: u(s.width, r.width, n),
69
+ height: u(s.height, r.height, n),
70
+ opacity: u(s.opacity ?? 1, 1, n),
71
+ exiting: !1
72
+ })),
73
+ ...x.map((r) => ({
74
+ ...r,
75
+ exiting: !0,
76
+ opacity: (r.opacity ?? 1) * Math.max(0, 1 - n * 2.5)
77
+ }))
78
+ ],
79
+ edges: M.map(({ edge: r, sections: s }) => ({
80
+ ...r,
81
+ sections: s.map((m) => m(n))
82
+ }))
83
+ };
84
+ };
85
+ }
86
+ export {
87
+ q as createGraphLayoutTransition
88
+ };
@@ -3,7 +3,7 @@ import { createSignal as g, createMemo as $, createEffect as T, untrack as j, on
3
3
  import { sandboxedMarkdownHtml as K } from "../chat/markdown/media.js";
4
4
  import { findTextRanges as _ } from "../ui/textSearch.js";
5
5
  import { secureRandomUUID as z } from "../../utils/secureRandom.js";
6
- var W = /* @__PURE__ */ p('<span data-floe-html-pending style="position:absolute;inset:0;z-index:1;background:var(--background, Canvas)">'), J = /* @__PURE__ */ p('<span role=status class="pointer-events-none absolute inset-x-0 top-3 z-10 flex justify-center px-3"><span class="rounded-md bg-background/95 px-3 py-2 text-xs text-foreground shadow-sm">'), V = /* @__PURE__ */ p('<span role=alert class="max-h-24 shrink-0 overflow-auto break-words bg-background px-3 py-2 text-xs text-destructive">'), X = /* @__PURE__ */ p('<span class="relative flex h-full min-h-0 w-full flex-col"><iframe sandbox="allow-scripts allow-pointer-lock"referrerpolicy=no-referrer style="display:block;width:100%;min-height:0;flex:1 1 0%;border:0">');
6
+ var W = /* @__PURE__ */ p('<span data-floe-html-pending style="position:absolute;inset:0;z-index:1;background:var(--background, Canvas)">'), J = /* @__PURE__ */ p('<span role=status class="pointer-events-none absolute inset-x-0 top-3 z-10 flex justify-center px-3"><span class="rounded-md bg-background px-3 py-2 text-xs text-foreground shadow-sm">'), V = /* @__PURE__ */ p('<span role=alert class="max-h-24 shrink-0 overflow-auto break-words bg-background px-3 py-2 text-xs text-destructive">'), X = /* @__PURE__ */ p('<span class="relative flex h-full min-h-0 w-full flex-col"><iframe sandbox="allow-scripts allow-pointer-lock"referrerpolicy=no-referrer style="display:block;width:100%;min-height:0;flex:1 1 0%;border:0">');
7
7
  function Y(e) {
8
8
  return `<script>(()=>{
9
9
  const channel=new MessageChannel();
@@ -6,6 +6,8 @@ export type ImageAnnotationSurfaceProps = ImageDimensions & {
6
6
  onChange?: (annotation: ImageAnnotation) => void;
7
7
  disabled?: boolean;
8
8
  zoom?: number;
9
+ /** Drag the zoomed viewport without changing its annotation. */
10
+ panning?: boolean;
9
11
  showAnnotation?: boolean;
10
12
  class?: string;
11
13
  };
@@ -1,62 +1,79 @@
1
- import { use as H, insert as q, createComponent as N, effect as K, setAttribute as c, setStyleProperty as S, memo as G, className as J, template as U, delegateEvents as Q } from "solid-js/web";
2
- import { createSignal as O, createMemo as V, onMount as Z, onCleanup as _, Show as p, For as tt } from "solid-js";
3
- import { validateImageAnnotation as T, imagePointFromClient as et, imageAnnotationMarkup as it } from "./imageAnnotation.js";
4
- var nt = /* @__PURE__ */ U("<div data-floe-image-annotation style=width:100%;height:100%;overflow:auto;overscroll-behavior:contain><div style=display:grid;place-items:center><svg xmlns=http://www.w3.org/2000/svg role=img style=display:block;user-select:none;flex:none><image></image><g data-annotation-target>"), ot = /* @__PURE__ */ U("<svg><rect data-annotation-target fill=white stroke=#111827></svg>", !1, !0, !1);
5
- function dt(e) {
6
- let m, v;
7
- const [z, W] = O({
1
+ import { use as H, insert as G, createComponent as N, effect as q, setAttribute as l, setStyleProperty as S, memo as J, className as Q, template as U, delegateEvents as V } from "solid-js/web";
2
+ import { createSignal as K, createMemo as Z, onMount as _, onCleanup as p, Show as tt, For as it } from "solid-js";
3
+ import { validateImageAnnotation as O, imagePointFromClient as et, imageAnnotationMarkup as nt } from "./imageAnnotation.js";
4
+ var rt = /* @__PURE__ */ U("<div data-floe-image-annotation style=width:100%;height:100%;overflow:auto;scrollbar-gutter:stable;overscroll-behavior:contain><div style=display:grid;place-items:center><svg xmlns=http://www.w3.org/2000/svg role=img style=display:block;user-select:none;flex:none><image></image><g data-annotation-target>"), ot = /* @__PURE__ */ U("<svg><rect data-annotation-target fill=white stroke=#111827></svg>", !1, !0, !1);
5
+ function lt(e) {
6
+ let u, g;
7
+ const [z, W] = K({
8
8
  width: 1,
9
9
  height: 1
10
- }), [D, f] = O();
11
- let u;
12
- const E = () => D() ?? e.annotation, l = V(() => Math.min(z().width / e.width, z().height / e.height) * Math.max(1, e.zoom ?? 1)), $ = () => e.showAnnotation !== !1 && E() && T(e, E()) ? it(e, E()) : "";
13
- Z(() => {
14
- const i = new ResizeObserver(() => W({
15
- width: m.clientWidth,
16
- height: m.clientHeight
17
- }));
18
- i.observe(m), _(() => i.disconnect());
10
+ }), [E, y] = K();
11
+ let v, f;
12
+ const L = () => E() ?? e.annotation, w = Z(() => Math.min(z().width / e.width, z().height / e.height) * Math.max(1, e.zoom ?? 1)), $ = () => e.showAnnotation !== !1 && L() && O(e, L()) ? nt(e, L()) : "";
13
+ _(() => {
14
+ let i = 0;
15
+ const o = () => {
16
+ i = 0;
17
+ const r = u.clientWidth, c = u.clientHeight;
18
+ W((s) => s.width === r && s.height === c ? s : {
19
+ width: r,
20
+ height: c
21
+ });
22
+ }, n = new ResizeObserver(() => {
23
+ i || (i = requestAnimationFrame(o));
24
+ });
25
+ n.observe(u), o(), p(() => {
26
+ n.disconnect(), cancelAnimationFrame(i);
27
+ });
19
28
  });
20
- const L = (i, r = !1) => et(e, v.getBoundingClientRect(), {
29
+ const X = (i, o = !1) => et(e, g.getBoundingClientRect(), {
21
30
  x: i.clientX,
22
31
  y: i.clientY
23
- }, r), g = () => !!e.onChange && !e.disabled, B = (i) => {
24
- const r = u;
25
- if (!r || r.id !== i.pointerId || r.src !== e.src || !g()) return;
26
- const n = L(i, !0);
32
+ }, o), m = () => !!e.onChange && !e.disabled && !e.panning, Y = (i) => {
33
+ if (f?.id === i.pointerId) {
34
+ u.scrollLeft = f.left + f.x - i.clientX, u.scrollTop = f.top + f.y - i.clientY;
35
+ return;
36
+ }
37
+ const o = v;
38
+ if (!o || o.id !== i.pointerId || o.src !== e.src || !m()) return;
39
+ const n = X(i, !0);
27
40
  if (!n) return;
28
- const a = r.original;
29
- if (a && r.corner === void 0) {
30
- const s = a.kind === "rectangle" ? a.width : 0, w = a.kind === "rectangle" ? a.height : 0;
31
- f({
32
- ...a,
33
- x: Math.max(0, Math.min(e.width - s, a.x + n.x - r.start.x)),
34
- y: Math.max(0, Math.min(e.height - w, a.y + n.y - r.start.y))
41
+ const r = o.original;
42
+ if (r && o.corner === void 0) {
43
+ const c = r.kind === "rectangle" ? r.width : 0, s = r.kind === "rectangle" ? r.height : 0;
44
+ y({
45
+ ...r,
46
+ x: Math.max(0, Math.min(e.width - c, r.x + n.x - o.start.x)),
47
+ y: Math.max(0, Math.min(e.height - s, r.y + n.y - o.start.y))
35
48
  });
36
49
  } else {
37
- const s = a?.kind === "rectangle" && r.corner !== void 0 ? {
38
- x: a.x + (r.corner % 2 ? 0 : a.width),
39
- y: a.y + (r.corner < 2 ? a.height : 0)
40
- } : r.start, w = Math.abs(n.x - s.x), y = Math.abs(n.y - s.y);
41
- Math.hypot(i.clientX - r.client.x, i.clientY - r.client.y) < 5 && !a ? f({
50
+ const c = r?.kind === "rectangle" && o.corner !== void 0 ? {
51
+ x: r.x + (o.corner % 2 ? 0 : r.width),
52
+ y: r.y + (o.corner < 2 ? r.height : 0)
53
+ } : o.start, s = Math.abs(n.x - c.x), x = Math.abs(n.y - c.y);
54
+ Math.hypot(i.clientX - o.client.x, i.clientY - o.client.y) < 5 && !r ? y({
42
55
  kind: "point",
43
- ...s
44
- }) : w > 0 && y > 0 && f({
56
+ ...c
57
+ }) : s > 0 && x > 0 && y({
45
58
  kind: "rectangle",
46
- x: Math.min(s.x, n.x),
47
- y: Math.min(s.y, n.y),
48
- width: w,
49
- height: y
59
+ x: Math.min(c.x, n.x),
60
+ y: Math.min(c.y, n.y),
61
+ width: s,
62
+ height: x
50
63
  });
51
64
  }
52
- }, P = (i, r = !1) => {
53
- const n = u;
65
+ }, D = (i, o = !1) => {
66
+ if (f?.id === i.pointerId) {
67
+ f = void 0, g.hasPointerCapture(i.pointerId) && g.releasePointerCapture(i.pointerId);
68
+ return;
69
+ }
70
+ const n = v;
54
71
  if (!n || n.id !== i.pointerId) return;
55
- r || B(i);
56
- const a = D();
57
- u = void 0, f(void 0), v.hasPointerCapture(i.pointerId) && v.releasePointerCapture(i.pointerId), !r && n.src === e.src && g() && a && T(e, a) && e.onChange?.(a);
72
+ o || Y(i);
73
+ const r = E();
74
+ v = void 0, y(void 0), g.hasPointerCapture(i.pointerId) && g.releasePointerCapture(i.pointerId), !o && n.src === e.src && m() && r && O(e, r) && e.onChange?.(r);
58
75
  }, j = () => {
59
- const i = E();
76
+ const i = L();
60
77
  return i?.kind === "rectangle" ? [{
61
78
  x: i.x,
62
79
  y: i.y
@@ -72,11 +89,11 @@ function dt(e) {
72
89
  }] : [];
73
90
  };
74
91
  return (() => {
75
- var i = nt(), r = i.firstChild, n = r.firstChild, a = n.firstChild, s = a.nextSibling, w = m;
76
- typeof w == "function" ? H(w, i) : m = i, n.$$keydown = (t) => {
77
- if (!g()) return;
92
+ var i = rt(), o = i.firstChild, n = o.firstChild, r = n.firstChild, c = r.nextSibling, s = u;
93
+ typeof s == "function" ? H(s, i) : u = i, n.$$keydown = (t) => {
94
+ if (!m()) return;
78
95
  if (t.key === "Escape") {
79
- u = void 0, f(void 0);
96
+ v = void 0, y(void 0);
80
97
  return;
81
98
  }
82
99
  const d = {
@@ -91,18 +108,28 @@ function dt(e) {
91
108
  kind: "point",
92
109
  x: e.width / 2,
93
110
  y: e.height / 2
94
- }, o = t.shiftKey ? 10 : 1;
111
+ }, a = t.shiftKey ? 10 : 1;
95
112
  e.onChange?.({
96
113
  ...h,
97
- x: Math.max(0, Math.min(e.width - (h.kind === "rectangle" ? h.width : 0), h.x + (d?.[0] ?? 0) * o)),
98
- y: Math.max(0, Math.min(e.height - (h.kind === "rectangle" ? h.height : 0), h.y + (d?.[1] ?? 0) * o))
114
+ x: Math.max(0, Math.min(e.width - (h.kind === "rectangle" ? h.width : 0), h.x + (d?.[0] ?? 0) * a)),
115
+ y: Math.max(0, Math.min(e.height - (h.kind === "rectangle" ? h.height : 0), h.y + (d?.[1] ?? 0) * a))
99
116
  });
100
- }, n.addEventListener("lostpointercapture", (t) => P(t, !0)), n.addEventListener("pointercancel", (t) => P(t, !0)), n.$$pointerup = (t) => P(t), n.$$pointermove = B, n.$$pointerdown = (t) => {
101
- if (!g() || t.button !== 0 || u) return;
102
- const d = L(t);
117
+ }, n.addEventListener("lostpointercapture", (t) => D(t, !0)), n.addEventListener("pointercancel", (t) => D(t, !0)), n.$$pointerup = (t) => D(t), n.$$pointermove = Y, n.$$pointerdown = (t) => {
118
+ if (e.panning && t.button === 0 && !f) {
119
+ f = {
120
+ id: t.pointerId,
121
+ x: t.clientX,
122
+ y: t.clientY,
123
+ left: u.scrollLeft,
124
+ top: u.scrollTop
125
+ }, g.setPointerCapture(t.pointerId), t.preventDefault();
126
+ return;
127
+ }
128
+ if (!m() || t.button !== 0 || v) return;
129
+ const d = X(t);
103
130
  if (!d) return;
104
- const h = t.target, o = h.getAttribute("data-corner");
105
- u = {
131
+ const h = t.target, a = h.getAttribute("data-corner");
132
+ v = {
106
133
  id: t.pointerId,
107
134
  start: d,
108
135
  client: {
@@ -113,31 +140,31 @@ function dt(e) {
113
140
  ...h.closest("[data-annotation-target]") ? {
114
141
  original: e.annotation
115
142
  } : {},
116
- ...o !== null ? {
117
- corner: Number(o)
143
+ ...a !== null ? {
144
+ corner: Number(a)
118
145
  } : {}
119
- }, f(u.original ?? {
146
+ }, y(v.original ?? {
120
147
  kind: "point",
121
148
  ...d
122
- }), v.setPointerCapture(t.pointerId), v.focus({
149
+ }), g.setPointerCapture(t.pointerId), g.focus({
123
150
  preventScroll: !0
124
151
  }), t.preventDefault();
125
152
  };
126
- var y = v;
127
- return typeof y == "function" ? H(y, n) : v = n, q(n, N(p, {
153
+ var x = g;
154
+ return typeof x == "function" ? H(x, n) : g = n, G(n, N(tt, {
128
155
  get when() {
129
- return G(() => !!g())() && e.showAnnotation !== !1;
156
+ return J(() => !!m())() && e.showAnnotation !== !1;
130
157
  },
131
158
  get children() {
132
- return N(tt, {
159
+ return N(it, {
133
160
  get each() {
134
161
  return j();
135
162
  },
136
163
  children: (t, d) => (() => {
137
164
  var h = ot();
138
- return K((o) => {
139
- var x = d(), k = t.x - 5 / l(), M = t.y - 5 / l(), b = 10 / l(), C = 10 / l(), A = 1 / l(), I = d() === 0 || d() === 3 ? "nwse-resize" : "nesw-resize";
140
- return x !== o.e && c(h, "data-corner", o.e = x), k !== o.t && c(h, "x", o.t = k), M !== o.a && c(h, "y", o.a = M), b !== o.o && c(h, "width", o.o = b), C !== o.i && c(h, "height", o.i = C), A !== o.n && c(h, "stroke-width", o.n = A), I !== o.s && S(h, "cursor", o.s = I), o;
165
+ return q((a) => {
166
+ var b = d(), k = t.x - 5 / w(), M = t.y - 5 / w(), C = 10 / w(), I = 10 / w(), A = 1 / w(), P = d() === 0 || d() === 3 ? "nwse-resize" : "nesw-resize";
167
+ return b !== a.e && l(h, "data-corner", a.e = b), k !== a.t && l(h, "x", a.t = k), M !== a.a && l(h, "y", a.a = M), C !== a.o && l(h, "width", a.o = C), I !== a.i && l(h, "height", a.i = I), A !== a.n && l(h, "stroke-width", a.n = A), P !== a.s && S(h, "cursor", a.s = P), a;
141
168
  }, {
142
169
  e: void 0,
143
170
  t: void 0,
@@ -150,9 +177,9 @@ function dt(e) {
150
177
  })()
151
178
  });
152
179
  }
153
- }), null), K((t) => {
154
- var d = e.class, h = `${Math.max(z().width, e.width * l())}px`, o = `${Math.max(z().height, e.height * l())}px`, x = e.width * l(), k = e.height * l(), M = `0 0 ${e.width} ${e.height}`, b = e.label, C = g() ? 0 : void 0, A = g() ? "none" : "auto", I = g() ? "crosshair" : "default", R = e.src, X = e.width, Y = e.height, F = $();
155
- return d !== t.e && J(i, t.e = d), h !== t.t && S(r, "width", t.t = h), o !== t.a && S(r, "height", t.a = o), x !== t.o && c(n, "width", t.o = x), k !== t.i && c(n, "height", t.i = k), M !== t.n && c(n, "viewBox", t.n = M), b !== t.s && c(n, "aria-label", t.s = b), C !== t.h && c(n, "tabindex", t.h = C), A !== t.r && S(n, "touch-action", t.r = A), I !== t.d && S(n, "cursor", t.d = I), R !== t.l && c(a, "href", t.l = R), X !== t.u && c(a, "width", t.u = X), Y !== t.c && c(a, "height", t.c = Y), F !== t.w && (s.innerHTML = t.w = F), t;
180
+ }), null), q((t) => {
181
+ var d = e.class, h = `${Math.max(z().width, e.width * w())}px`, a = `${Math.max(z().height, e.height * w())}px`, b = e.width * w(), k = e.height * w(), M = `0 0 ${e.width} ${e.height}`, C = e.label, I = m() ? 0 : void 0, A = m() || e.panning ? "none" : "auto", P = e.panning ? "grab" : m() ? "crosshair" : "default", F = e.src, B = e.width, R = e.height, T = $();
182
+ return d !== t.e && Q(i, t.e = d), h !== t.t && S(o, "width", t.t = h), a !== t.a && S(o, "height", t.a = a), b !== t.o && l(n, "width", t.o = b), k !== t.i && l(n, "height", t.i = k), M !== t.n && l(n, "viewBox", t.n = M), C !== t.s && l(n, "aria-label", t.s = C), I !== t.h && l(n, "tabindex", t.h = I), A !== t.r && S(n, "touch-action", t.r = A), P !== t.d && S(n, "cursor", t.d = P), F !== t.l && l(r, "href", t.l = F), B !== t.u && l(r, "width", t.u = B), R !== t.c && l(r, "height", t.c = R), T !== t.w && (c.innerHTML = t.w = T), t;
156
183
  }, {
157
184
  e: void 0,
158
185
  t: void 0,
@@ -171,7 +198,7 @@ function dt(e) {
171
198
  }), i;
172
199
  })();
173
200
  }
174
- Q(["pointerdown", "pointermove", "pointerup", "keydown"]);
201
+ V(["pointerdown", "pointermove", "pointerup", "keydown"]);
175
202
  export {
176
- dt as ImageAnnotationSurface
203
+ lt as ImageAnnotationSurface
177
204
  };
package/dist/graph.css CHANGED
@@ -184,3 +184,21 @@
184
184
  .floe-graph__edges [data-selected='true'] .floe-graph__edge-label {
185
185
  opacity: 1;
186
186
  }
187
+
188
+ /* New routes arrive quietly; keyed paths retain their identity while geometry moves. */
189
+ .floe-graph[data-animate-layout='true'] .floe-graph__edges > g {
190
+ animation: floe-graph-route-enter 160ms ease-out;
191
+ }
192
+ @keyframes floe-graph-route-enter {
193
+ from {
194
+ opacity: 0;
195
+ }
196
+ to {
197
+ opacity: 1;
198
+ }
199
+ }
200
+ @media (prefers-reduced-motion: reduce) {
201
+ .floe-graph[data-animate-layout='true'] .floe-graph__edges > g {
202
+ animation: none;
203
+ }
204
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.101.20",
3
+ "version": "0.101.28",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",