@floegence/floe-webapp-core 0.84.0 → 0.85.1

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.
@@ -1,6 +1,6 @@
1
1
  import { createComponent as o, Portal as N, insert as l, effect as u, className as $, memo as B, template as a, setAttribute as A } from "solid-js/web";
2
2
  import { createSignal as F, createEffect as V, createMemo as d, Show as m, For as j } from "solid-js";
3
- import { Presence as U, Motion as X } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.15/node_modules/solid-motionone/dist/index.js";
3
+ import { Presence as U, Motion as X } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.17/node_modules/solid-motionone/dist/index.js";
4
4
  import { cn as f } from "../../utils/cn.js";
5
5
  import { useFileBrowserDrag as G } from "../../context/FileBrowserDragContext.js";
6
6
  import { FileItemIcon as W } from "./FileIcons.js";
@@ -1,48 +1,48 @@
1
1
  import { applyGraphPositions as v } from "./positions.js";
2
2
  function $(i) {
3
- const n = /* @__PURE__ */ new Set(), p = (e) => {
4
- if (!e || n.has(e)) throw new Error(`Duplicate or empty graph ID: ${e}`);
5
- n.add(e);
6
- }, s = new Map(i.nodes.map((e) => [e.id, e]));
7
- for (const e of i.nodes) {
8
- if (p(e.id), ![e.width, e.height].every((r) => Number.isFinite(r) && r > 0))
9
- throw new Error(`Invalid dimensions for graph node: ${e.id}`);
10
- for (const r of e.ports ?? []) p(r.id);
11
- const a = /* @__PURE__ */ new Set([e.id]);
12
- let d = e.parentId;
3
+ const n = /* @__PURE__ */ new Set(), p = (t) => {
4
+ if (!t || n.has(t)) throw new Error(`Duplicate or empty graph ID: ${t}`);
5
+ n.add(t);
6
+ }, s = new Map(i.nodes.map((t) => [t.id, t]));
7
+ for (const t of i.nodes) {
8
+ if (p(t.id), ![t.width, t.height].every((r) => Number.isFinite(r) && r > 0))
9
+ throw new Error(`Invalid dimensions for graph node: ${t.id}`);
10
+ for (const r of t.ports ?? []) p(r.id);
11
+ const a = /* @__PURE__ */ new Set([t.id]);
12
+ let d = t.parentId;
13
13
  for (; d !== void 0; ) {
14
14
  const r = s.get(d);
15
15
  if (!r || r.kind !== "group")
16
- throw new Error(`Invalid parent for graph node: ${e.id}`);
17
- if (a.has(d)) throw new Error(`Cyclic graph containment: ${e.id}`);
16
+ throw new Error(`Invalid parent for graph node: ${t.id}`);
17
+ if (a.has(d)) throw new Error(`Cyclic graph containment: ${t.id}`);
18
18
  a.add(d), d = r.parentId;
19
19
  }
20
20
  }
21
- for (const e of i.edges) {
22
- p(e.id);
21
+ for (const t of i.edges) {
22
+ p(t.id);
23
23
  for (const [a, d] of [
24
- [e.source, e.sourcePort],
25
- [e.target, e.targetPort]
24
+ [t.source, t.sourcePort],
25
+ [t.target, t.targetPort]
26
26
  ]) {
27
27
  const r = s.get(a);
28
28
  if (!r || d !== void 0 && !r.ports?.some((c) => c.id === d))
29
- throw new Error(`Invalid endpoint for graph edge: ${e.id}`);
29
+ throw new Error(`Invalid endpoint for graph edge: ${t.id}`);
30
30
  }
31
31
  }
32
32
  }
33
33
  async function O(i, n, p) {
34
34
  $(i);
35
35
  const s = n.groupPadding ?? { top: 64, right: 28, bottom: 28, left: 28 };
36
- if (![...Object.values(s), n.spacing ?? 64].every((t) => Number.isFinite(t) && t >= 0))
36
+ if (![...Object.values(s), n.spacing ?? 64].every((e) => Number.isFinite(e) && e >= 0))
37
37
  throw new Error("Graph layout spacing must be finite and nonnegative");
38
- const e = /* @__PURE__ */ new Map();
39
- for (const t of i.nodes)
40
- e.set(t.id, {
41
- id: t.id,
42
- width: t.width,
43
- height: t.height,
44
- ...t.kind === "group" ? { children: [] } : {},
45
- ports: t.ports?.map((o) => ({
38
+ const t = /* @__PURE__ */ new Map();
39
+ for (const e of i.nodes)
40
+ t.set(e.id, {
41
+ id: e.id,
42
+ width: e.width,
43
+ height: e.height,
44
+ ...e.kind === "group" ? { children: [] } : {},
45
+ ports: e.ports?.map((o) => ({
46
46
  id: o.id,
47
47
  width: 1,
48
48
  height: 1,
@@ -54,21 +54,21 @@ async function O(i, n, p) {
54
54
  }
55
55
  });
56
56
  const a = [];
57
- for (const t of i.nodes)
58
- (t.parentId ? e.get(t.parentId).children : a).push(e.get(t.id));
57
+ for (const e of i.nodes)
58
+ (e.parentId ? t.get(e.parentId).children : a).push(t.get(e.id));
59
59
  const d = /* @__PURE__ */ new Set([
60
- ...i.nodes.flatMap((t) => [t.id, ...(t.ports ?? []).map((o) => o.id)]),
61
- ...i.edges.map((t) => t.id)
60
+ ...i.nodes.flatMap((e) => [e.id, ...(e.ports ?? []).map((o) => o.id)]),
61
+ ...i.edges.map((e) => e.id)
62
62
  ]);
63
63
  let r = "$graph";
64
64
  for (; d.has(r); ) r += "$";
65
65
  const c = await p.layout({
66
66
  id: r,
67
67
  children: a,
68
- edges: i.edges.map((t) => ({
69
- id: t.id,
70
- sources: [t.sourcePort ?? t.source],
71
- targets: [t.targetPort ?? t.target]
68
+ edges: i.edges.map((e) => ({
69
+ id: e.id,
70
+ sources: [e.sourcePort ?? e.source],
71
+ targets: [e.targetPort ?? e.target]
72
72
  })),
73
73
  layoutOptions: {
74
74
  "elk.algorithm": "layered",
@@ -80,9 +80,9 @@ async function O(i, n, p) {
80
80
  "elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES",
81
81
  "elk.randomSeed": "1"
82
82
  }
83
- }), f = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), I = (t) => {
84
- for (const o of t.edges ?? []) {
85
- const h = o.container ?? t.id, l = f.get(h) ?? { x: 0, y: 0 };
83
+ }), f = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), I = (e) => {
84
+ for (const o of e.edges ?? []) {
85
+ const h = o.container ?? e.id, l = f.get(h) ?? { x: 0, y: 0 };
86
86
  x.set(
87
87
  o.id,
88
88
  (o.sections ?? []).map(
@@ -93,30 +93,31 @@ async function O(i, n, p) {
93
93
  )
94
94
  );
95
95
  }
96
- for (const o of t.children ?? []) I(o);
97
- }, E = (t, o, h) => {
98
- const l = o + (t.x ?? 0), g = h + (t.y ?? 0);
99
- f.set(t.id, { x: l, y: g, width: t.width ?? 0, height: t.height ?? 0 });
100
- for (const w of t.children ?? []) E(w, l, g);
96
+ for (const o of e.children ?? []) I(o);
97
+ }, E = (e, o, h) => {
98
+ const l = o + (e.x ?? 0), g = h + (e.y ?? 0);
99
+ f.set(e.id, { x: l, y: g, width: e.width ?? 0, height: e.height ?? 0 });
100
+ for (const w of e.children ?? []) E(w, l, g);
101
101
  };
102
- for (const t of c.children ?? []) E(t, 0, 0);
102
+ for (const e of c.children ?? []) E(e, 0, 0);
103
103
  I(c);
104
- const y = !n.positions?.length && n.anchor && f.get(n.anchor.nodeId), m = y ? n.anchor.position.x - y.x : 0, u = y ? n.anchor.position.y - y.y : 0, k = i.nodes.map((t) => {
105
- const o = f.get(t.id);
106
- return { ...t, ...o, x: o.x + m, y: o.y + u };
104
+ const y = !n.positions?.length && n.anchor && f.get(n.anchor.nodeId), m = y ? n.anchor.position.x - y.x : 0, u = y ? n.anchor.position.y - y.y : 0, k = i.nodes.map((e) => {
105
+ const o = f.get(e.id);
106
+ return { ...e, ...o, x: o.x + m, y: o.y + u };
107
107
  });
108
108
  return v(
109
109
  {
110
110
  nodes: k,
111
- edges: i.edges.map((t) => ({
112
- ...t,
113
- sections: (x.get(t.id) ?? []).map(
111
+ edges: i.edges.map((e) => ({
112
+ ...e,
113
+ sections: (x.get(e.id) ?? []).map(
114
114
  (o) => o.map((h) => ({ x: h.x + m, y: h.y + u }))
115
115
  )
116
116
  })),
117
117
  bounds: { x: m, y: u, width: c.width ?? 0, height: c.height ?? 0 }
118
118
  },
119
- n
119
+ n,
120
+ i.nodes
120
121
  );
121
122
  }
122
123
  export {
@@ -1,3 +1,3 @@
1
- import type { GraphLayout, GraphLayoutOptions } from './types';
2
- /** Apply optional absolute world positions, retaining unpinned ELK geometry and group containment. */
3
- export declare function applyGraphPositions(layout: GraphLayout, options: GraphLayoutOptions): GraphLayout;
1
+ import type { GraphLayout, GraphLayoutOptions, GraphNode } from './types';
2
+ /** Apply explicit fixed or preferred positions, then route the resulting geometry once. */
3
+ export declare function applyGraphPositions(layout: GraphLayout, options: GraphLayoutOptions, input: readonly GraphNode[]): GraphLayout;
@@ -1,134 +1,169 @@
1
- const P = (s, e = 0) => ({
2
- left: s.x - e,
3
- top: s.y - e,
4
- right: s.x + s.width + e,
5
- bottom: s.y + s.height + e
6
- }), b = (s, e) => s.x > e.left && s.x < e.right && s.y > e.top && s.y < e.bottom, N = (s, e, y) => !y.some(
7
- (o) => s.x === e.x ? s.x > o.left && s.x < o.right && Math.max(s.y, e.y) > o.top && Math.min(s.y, e.y) < o.bottom : s.y > o.top && s.y < o.bottom && Math.max(s.x, e.x) > o.left && Math.min(s.x, e.x) < o.right
1
+ const H = (e, n = 0) => ({
2
+ left: e.x - n,
3
+ top: e.y - n,
4
+ right: e.x + e.width + n,
5
+ bottom: e.y + e.height + n
6
+ }), N = (e, n) => e.x > n.left && e.x < n.right && e.y > n.top && e.y < n.bottom, W = (e, n, v) => !v.some(
7
+ (r) => e.x === n.x ? e.x > r.left && e.x < r.right && Math.max(e.y, n.y) > r.top && Math.min(e.y, n.y) < r.bottom : e.y > r.top && e.y < r.bottom && Math.max(e.x, n.x) > r.left && Math.min(e.x, n.x) < r.right
8
8
  );
9
- function k(s, e, y) {
10
- if (y.some((i) => b(s, i) || b(e, i)))
9
+ function A(e, n, v) {
10
+ if (v.some((h) => N(e, h) || N(n, h)))
11
11
  throw new Error("Pinned graph positions obstruct an edge endpoint");
12
- const o = [
13
- .../* @__PURE__ */ new Set([s.x, e.x, ...y.flatMap((i) => [i.left, i.right])])
14
- ].sort((i, r) => i - r), d = [
15
- .../* @__PURE__ */ new Set([s.y, e.y, ...y.flatMap((i) => [i.top, i.bottom])])
16
- ].sort((i, r) => i - r), u = (i) => ({ x: o[i % o.length], y: d[Math.floor(i / o.length)] }), v = d.indexOf(s.y) * o.length + o.indexOf(s.x), E = d.indexOf(e.y) * o.length + o.indexOf(e.x), w = /* @__PURE__ */ new Map([[v, 0]]), I = /* @__PURE__ */ new Map(), h = [], T = (i) => {
17
- let r = h.length;
18
- for (h.push(i); r > 0; ) {
19
- const c = r - 1 >> 1;
20
- if (h[c].score <= i.score) break;
21
- h[r] = h[c], r = c;
12
+ const r = [
13
+ .../* @__PURE__ */ new Set([e.x, n.x, ...v.flatMap((h) => [h.left, h.right])])
14
+ ].sort((h, t) => h - t), I = [
15
+ .../* @__PURE__ */ new Set([e.y, n.y, ...v.flatMap((h) => [h.top, h.bottom])])
16
+ ].sort((h, t) => h - t), w = (h) => ({ x: r[h % r.length], y: I[Math.floor(h / r.length)] }), M = I.indexOf(e.y) * r.length + r.indexOf(e.x), b = I.indexOf(n.y) * r.length + r.indexOf(n.x), S = /* @__PURE__ */ new Map([[M, 0]]), O = /* @__PURE__ */ new Map(), y = [], E = (h) => {
17
+ let t = y.length;
18
+ for (y.push(h); t > 0; ) {
19
+ const c = t - 1 >> 1;
20
+ if (y[c].score <= h.score) break;
21
+ y[t] = y[c], t = c;
22
22
  }
23
- h[r] = i;
24
- }, t = () => {
25
- const i = h[0], r = h.pop();
26
- if (h.length) {
23
+ y[t] = h;
24
+ }, T = () => {
25
+ const h = y[0], t = y.pop();
26
+ if (y.length) {
27
27
  let c = 0;
28
- for (; c * 2 + 1 < h.length; ) {
29
- let a = c * 2 + 1;
30
- if (a + 1 < h.length && h[a + 1].score < h[a].score && a++, h[a].score >= r.score) break;
31
- h[c] = h[a], c = a;
28
+ for (; c * 2 + 1 < y.length; ) {
29
+ let p = c * 2 + 1;
30
+ if (p + 1 < y.length && y[p + 1].score < y[p].score && p++, y[p].score >= t.score) break;
31
+ y[c] = y[p], c = p;
32
32
  }
33
- h[c] = r;
33
+ y[c] = t;
34
34
  }
35
- return i;
35
+ return h;
36
36
  };
37
- T({ id: v, score: 0, cost: 0 });
38
- let g = 0;
39
- for (; h.length && g++ < 5e4; ) {
40
- const i = t();
41
- if (i.cost !== w.get(i.id)) continue;
42
- if (i.id === E) {
43
- const x = [u(E)];
44
- let f = E;
45
- for (; f !== v; )
46
- f = I.get(f), x.push(u(f));
47
- return x.reverse(), x.filter((l, p) => {
48
- const n = x[p - 1], M = x[p + 1];
49
- return !n || !M || !(n.x === l.x && l.x === M.x || n.y === l.y && l.y === M.y);
37
+ E({ id: M, score: 0, cost: 0 });
38
+ let P = 0;
39
+ for (; y.length && P++ < 5e4; ) {
40
+ const h = T();
41
+ if (h.cost !== S.get(h.id)) continue;
42
+ if (h.id === b) {
43
+ const x = [w(b)];
44
+ let s = b;
45
+ for (; s !== M; )
46
+ s = O.get(s), x.push(w(s));
47
+ return x.reverse(), x.filter((a, o) => {
48
+ const f = x[o - 1], m = x[o + 1];
49
+ return !f || !m || !(f.x === a.x && a.x === m.x || f.y === a.y && a.y === m.y);
50
50
  });
51
51
  }
52
- const r = u(i.id), c = i.id % o.length, a = Math.floor(i.id / o.length), S = [
53
- c ? i.id - 1 : -1,
54
- c + 1 < o.length ? i.id + 1 : -1,
55
- a ? i.id - o.length : -1,
56
- a + 1 < d.length ? i.id + o.length : -1
52
+ const t = w(h.id), c = h.id % r.length, p = Math.floor(h.id / r.length), d = [
53
+ c ? h.id - 1 : -1,
54
+ c + 1 < r.length ? h.id + 1 : -1,
55
+ p ? h.id - r.length : -1,
56
+ p + 1 < I.length ? h.id + r.length : -1
57
57
  ];
58
- for (const x of S) {
58
+ for (const x of d) {
59
59
  if (x < 0) continue;
60
- const f = u(x), l = i.cost + Math.abs(r.x - f.x) + Math.abs(r.y - f.y);
61
- l >= (w.get(x) ?? 1 / 0) || !N(r, f, y) || (w.set(x, l), I.set(x, i.id), T({ id: x, cost: l, score: l + Math.abs(f.x - e.x) + Math.abs(f.y - e.y) }));
60
+ const s = w(x), a = h.cost + Math.abs(t.x - s.x) + Math.abs(t.y - s.y);
61
+ a >= (S.get(x) ?? 1 / 0) || !W(t, s, v) || (S.set(x, a), O.set(x, h.id), E({ id: x, cost: a, score: a + Math.abs(s.x - n.x) + Math.abs(s.y - n.y) }));
62
62
  }
63
63
  }
64
64
  throw new Error("Pinned graph positions cannot be routed within the layout budget");
65
65
  }
66
- function H(s, e) {
67
- if (!e.positions?.length) return s;
68
- const y = new Map(s.nodes.map((t) => [t.id, { ...t }])), o = /* @__PURE__ */ new Map();
69
- for (const t of e.positions) {
70
- if (!y.has(t.nodeId) || o.has(t.nodeId) || !Number.isFinite(t.x) || !Number.isFinite(t.y))
66
+ function F(e, n, v) {
67
+ if (!n.positions?.length) return e;
68
+ const r = new Map(e.nodes.map((t) => [t.id, { ...t }])), I = /* @__PURE__ */ new Map();
69
+ for (const t of n.positions) {
70
+ if (!r.has(t.nodeId) || I.has(t.nodeId) || !Number.isFinite(t.x) || !Number.isFinite(t.y))
71
71
  throw new Error(`Invalid graph position: ${t.nodeId}`);
72
- o.set(t.nodeId, t);
72
+ I.set(t.nodeId, t);
73
73
  }
74
- const d = /* @__PURE__ */ new Map();
75
- for (const t of y.values())
74
+ const w = /* @__PURE__ */ new Map();
75
+ for (const t of r.values())
76
76
  if (t.parentId) {
77
- const g = d.get(t.parentId) ?? [];
78
- g.push(t), d.set(t.parentId, g);
77
+ const c = w.get(t.parentId) ?? [];
78
+ c.push(t), w.set(t.parentId, c);
79
79
  }
80
- const u = e.groupPadding ?? { top: 64, left: 28, right: 28, bottom: 28 }, v = (t, g, i) => {
81
- const r = { x: t.x, y: t.y }, c = o.get(t.id);
82
- t.x = c?.x ?? t.x + g, t.y = c?.y ?? t.y + i;
83
- const a = d.get(t.id) ?? [];
84
- for (const p of a) v(p, t.x - r.x, t.y - r.y);
85
- if (!a.length) return;
86
- const S = Math.min(...a.map((p) => p.x)) - u.left, x = Math.min(...a.map((p) => p.y)) - u.top;
87
- if (c && (S < t.x || x < t.y))
80
+ const M = n.groupPadding ?? { top: 64, left: 28, right: 28, bottom: 28 }, b = n.positionMode === "preferred", S = new Map(v.map((t) => [t.id, t])), O = (t, c, p) => {
81
+ const d = { x: t.x, y: t.y }, x = I.get(t.id);
82
+ t.x = x?.x ?? t.x + c, t.y = x?.y ?? t.y + p;
83
+ const s = w.get(t.id) ?? [];
84
+ for (const l of s) O(l, t.x - d.x, t.y - d.y);
85
+ if (!s.length || b) return;
86
+ const a = Math.min(...s.map((l) => l.x)) - M.left, o = Math.min(...s.map((l) => l.y)) - M.top;
87
+ if (x && (a < t.x || o < t.y))
88
88
  throw new Error(`Pinned child lies outside group content: ${t.id}`);
89
89
  const f = Math.max(
90
90
  t.x + t.width,
91
- ...a.map((p) => p.x + p.width + u.right)
92
- ), l = Math.max(
91
+ ...s.map((l) => l.x + l.width + M.right)
92
+ ), m = Math.max(
93
93
  t.y + t.height,
94
- ...a.map((p) => p.y + p.height + u.bottom)
94
+ ...s.map((l) => l.y + l.height + M.bottom)
95
95
  );
96
- c || (t.x = Math.min(t.x, S), t.y = Math.min(t.y, x)), t.width = f - t.x, t.height = l - t.y;
96
+ x || (t.x = Math.min(t.x, a), t.y = Math.min(t.y, o)), t.width = f - t.x, t.height = m - t.y;
97
97
  };
98
- for (const t of y.values()) t.parentId || v(t, 0, 0);
99
- const E = s.edges.map((t) => {
100
- const g = y.get(t.source), i = y.get(t.target), r = (n, M, m) => n.ports?.find((O) => O.id === M)?.side ?? m, c = g.x + g.width / 2 <= i.x + i.width / 2, a = (n, M) => {
101
- const m = { x: n.x + n.width / 2, y: n.y + n.height / 2 };
102
- return M === "NORTH" ? [
103
- { x: m.x, y: n.y },
104
- { x: m.x, y: n.y - 8 }
105
- ] : M === "SOUTH" ? [
106
- { x: m.x, y: n.y + n.height },
107
- { x: m.x, y: n.y + n.height + 8 }
108
- ] : M === "WEST" ? [
109
- { x: n.x, y: m.y },
110
- { x: n.x - 8, y: m.y }
98
+ for (const t of r.values()) t.parentId || O(t, 0, 0);
99
+ if (b) {
100
+ const t = Math.max(16, n.spacing ?? 64), c = (s, a, o) => {
101
+ s.x += a, s.y += o;
102
+ for (const f of w.get(s.id) ?? []) c(f, a, o);
103
+ }, p = (s) => {
104
+ const a = [];
105
+ for (const o of [...s].sort(
106
+ (f, m) => f.y - m.y || f.x - m.x || f.id.localeCompare(m.id)
107
+ )) {
108
+ const f = { x: o.x, y: o.y };
109
+ for (const i of [...a].sort((g, u) => g.x - u.x))
110
+ o.y < i.y + i.height + t && o.y + o.height + t > i.y && f.x < i.x + i.width + t && f.x + o.width + t > i.x && (f.x = i.x + i.width + t);
111
+ const m = { x: o.x, y: o.y };
112
+ for (const i of [...a].sort((g, u) => g.y - u.y))
113
+ o.x < i.x + i.width + t && o.x + o.width + t > i.x && m.y < i.y + i.height + t && m.y + o.height + t > i.y && (m.y = i.y + i.height + t);
114
+ const l = f.x - o.x < m.y - o.y ? f : m;
115
+ c(o, l.x - o.x, l.y - o.y), a.push(o);
116
+ }
117
+ }, d = (s) => {
118
+ const a = w.get(s.id) ?? [];
119
+ if (!a.length) return;
120
+ for (const g of a) d(g);
121
+ p(a);
122
+ const o = Math.max(12, M.left), f = Math.max(12, M.top), m = Math.max(12, M.right), l = Math.max(12, M.bottom), i = I.get(s.id);
123
+ s.x = Math.min(i?.x ?? 1 / 0, Math.min(...a.map((g) => g.x)) - o), s.y = Math.min(i?.y ?? 1 / 0, Math.min(...a.map((g) => g.y)) - f), s.width = Math.max(
124
+ S.get(s.id).width,
125
+ Math.max(...a.map((g) => g.x + g.width)) + m - s.x
126
+ ), s.height = Math.max(
127
+ S.get(s.id).height,
128
+ Math.max(...a.map((g) => g.y + g.height)) + l - s.y
129
+ );
130
+ }, x = [...r.values()].filter((s) => !s.parentId);
131
+ for (const s of x) d(s);
132
+ p(x);
133
+ }
134
+ const y = e.edges.map((t) => {
135
+ const c = r.get(t.source), p = r.get(t.target), d = (i, g, u) => i.ports?.find((k) => k.id === g)?.side ?? u, x = c.x + c.width / 2 <= p.x + p.width / 2, s = (i, g) => {
136
+ const u = { x: i.x + i.width / 2, y: i.y + i.height / 2 };
137
+ return g === "NORTH" ? [
138
+ { x: u.x, y: i.y },
139
+ { x: u.x, y: i.y - 8 }
140
+ ] : g === "SOUTH" ? [
141
+ { x: u.x, y: i.y + i.height },
142
+ { x: u.x, y: i.y + i.height + 8 }
143
+ ] : g === "WEST" ? [
144
+ { x: i.x, y: u.y },
145
+ { x: i.x - 8, y: u.y }
111
146
  ] : [
112
- { x: n.x + n.width, y: m.y },
113
- { x: n.x + n.width + 8, y: m.y }
147
+ { x: i.x + i.width, y: u.y },
148
+ { x: i.x + i.width + 8, y: u.y }
114
149
  ];
115
- }, [S, x] = a(g, r(g, t.sourcePort, c ? "EAST" : "WEST")), [f, l] = a(
116
- i,
117
- r(i, t.targetPort, g === i ? "NORTH" : c ? "WEST" : "EAST")
118
- ), p = [...y.values()].filter((n) => n.kind !== "group").map((n) => P(n, 4));
119
- return { ...t, sections: [[S, ...k(x, l, p), f]] };
120
- }), w = [...y.values()], I = E.flatMap((t) => t.sections.flat()), h = Math.min(...w.map((t) => t.x), ...I.map((t) => t.x)), T = Math.min(...w.map((t) => t.y), ...I.map((t) => t.y));
150
+ }, [a, o] = s(c, d(c, t.sourcePort, x ? "EAST" : "WEST")), [f, m] = s(
151
+ p,
152
+ d(p, t.targetPort, c === p ? "NORTH" : x ? "WEST" : "EAST")
153
+ ), l = [...r.values()].filter((i) => i.kind !== "group").map((i) => H(i, 4));
154
+ return { ...t, sections: [[a, ...A(o, m, l), f]] };
155
+ }), E = [...r.values()], T = y.flatMap((t) => t.sections.flat()), P = Math.min(...E.map((t) => t.x), ...T.map((t) => t.x)), h = Math.min(...E.map((t) => t.y), ...T.map((t) => t.y));
121
156
  return {
122
- nodes: w,
123
- edges: E,
157
+ nodes: E,
158
+ edges: y,
124
159
  bounds: {
125
- x: h,
126
- y: T,
127
- width: Math.max(...w.map((t) => t.x + t.width), ...I.map((t) => t.x)) - h,
128
- height: Math.max(...w.map((t) => t.y + t.height), ...I.map((t) => t.y)) - T
160
+ x: P,
161
+ y: h,
162
+ width: Math.max(...E.map((t) => t.x + t.width), ...T.map((t) => t.x)) - P,
163
+ height: Math.max(...E.map((t) => t.y + t.height), ...T.map((t) => t.y)) - h
129
164
  }
130
165
  };
131
166
  }
132
167
  export {
133
- H as applyGraphPositions
168
+ F as applyGraphPositions
134
169
  };
@@ -46,10 +46,12 @@ export interface GraphLayout {
46
46
  bounds: GraphBounds;
47
47
  }
48
48
  export interface GraphLayoutOptions {
49
- /** Absolute world positions. Descendants move with pinned groups; impossible containment or routing fails explicitly. */
49
+ /** Absolute world positions. Descendants move with their group. Invalid positions always fail. */
50
50
  positions?: readonly (GraphPoint & {
51
51
  nodeId: string;
52
52
  })[];
53
+ /** Fixed (default) rejects impossible geometry. Preferred retains clear positions and separates colliding siblings, resizing groups around their content before routing. */
54
+ positionMode?: 'fixed' | 'preferred';
53
55
  direction?: 'RIGHT' | 'DOWN' | 'LEFT' | 'UP';
54
56
  spacing?: number;
55
57
  groupPadding?: {
@@ -1,6 +1,6 @@
1
1
  import { createComponent as n, insert as l, addEventListener as v, effect as C, setAttribute as F, Portal as d, memo as P, template as c, delegateEvents as L } from "solid-js/web";
2
2
  import { createMemo as R, createEffect as f, onCleanup as _, Show as s } from "solid-js";
3
- import { Motion as w } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.15/node_modules/solid-motionone/dist/index.js";
3
+ import { Motion as w } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.17/node_modules/solid-motionone/dist/index.js";
4
4
  import { easing as B, duration as k } from "../../utils/animations.js";
5
5
  import { useOverlayMask as K } from "../../hooks/useOverlayMask.js";
6
6
  import { X as Z } from "../icons/index.js";
@@ -1,6 +1,6 @@
1
1
  import { insert as m, createComponent as d, effect as K, setAttribute as I, memo as B, className as He, template as $, Dynamic as Ke, Portal as We, setStyleProperty as Ne, use as Ve, delegateEvents as Ge } from "solid-js/web";
2
2
  import { createSignal as de, onCleanup as p, createEffect as ee, createMemo as A, Show as R, For as te, Index as Ue } from "solid-js";
3
- import { Motion as W } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.15/node_modules/solid-motionone/dist/index.js";
3
+ import { Motion as W } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.17/node_modules/solid-motionone/dist/index.js";
4
4
  import { easing as N, duration as V } from "../../utils/animations.js";
5
5
  import { Plus as qe } from "../icons/index.js";
6
6
  import { startHotInteraction as ze } from "../../utils/hotInteraction.js";
@@ -1,5 +1,5 @@
1
1
  import { insert as n, createComponent as c, memo as s, effect as d, setAttribute as u, template as k, delegateEvents as v } from "solid-js/web";
2
- import { Motion as m } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.15/node_modules/solid-motionone/dist/index.js";
2
+ import { Motion as m } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.17/node_modules/solid-motionone/dist/index.js";
3
3
  import { easing as f, duration as h } from "../../utils/animations.js";
4
4
  import { Lock as g, Unlock as _ } from "../icons/index.js";
5
5
  var L = /* @__PURE__ */ k("<button type=button class=workbench-lock-button data-floe-surface=floating data-floe-canvas-interactive=true><span class=workbench-lock-button__icon>"), w = /* @__PURE__ */ k("<span class=workbench-lock-button__kbd>");
@@ -1,6 +1,6 @@
1
1
  import { createComponent as r, insert as l, template as s, delegateEvents as y } from "solid-js/web";
2
2
  import { Show as f } from "solid-js";
3
- import { Motion as i } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.15/node_modules/solid-motionone/dist/index.js";
3
+ import { Motion as i } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.17/node_modules/solid-motionone/dist/index.js";
4
4
  import { easing as h, duration as c } from "../../utils/animations.js";
5
5
  import { useOverlayMask as b } from "../../hooks/useOverlayMask.js";
6
6
  import { X as v } from "../icons/index.js";
@@ -1,8 +1,8 @@
1
1
  import { createComponent as m, mergeProps as v, Dynamic as x } from "solid-js/web";
2
2
  import { createSignal as p, createContext as d, splitProps as P, useContext as l, createEffect as u, onCleanup as S, batch as c } from "solid-js";
3
- import { resolveFirst as E } from "../../../../@solid-primitives_refs@1.1.4_solid-js@1.9.15/node_modules/@solid-primitives/refs/dist/index.js";
4
- import { createSwitchTransition as y } from "../../../../@solid-primitives_transition-group@1.1.2_solid-js@1.9.15/node_modules/@solid-primitives/transition-group/dist/index.js";
5
- import { combineStyle as C } from "../../../../@solid-primitives_props@3.2.4_solid-js@1.9.15/node_modules/@solid-primitives/props/dist/combineProps.js";
3
+ import { resolveFirst as E } from "../../../../@solid-primitives_refs@1.1.4_solid-js@1.9.17/node_modules/@solid-primitives/refs/dist/index.js";
4
+ import { createSwitchTransition as y } from "../../../../@solid-primitives_transition-group@1.1.2_solid-js@1.9.17/node_modules/@solid-primitives/transition-group/dist/index.js";
5
+ import { combineStyle as C } from "../../../../@solid-primitives_props@3.2.4_solid-js@1.9.17/node_modules/@solid-primitives/props/dist/combineProps.js";
6
6
  import { createMotionState as h, mountedStates as M } from "../../../../@motionone_dom@10.18.0/node_modules/@motionone/dom/dist/state/index.es.js";
7
7
  import { createStyles as T } from "../../../../@motionone_dom@10.18.0/node_modules/@motionone/dom/dist/animate/utils/style-object.es.js";
8
8
  var g = d(), D = (t) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.84.0",
3
+ "version": "0.85.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -156,7 +156,7 @@
156
156
  "clean": "rm -rf dist *.tsbuildinfo"
157
157
  },
158
158
  "peerDependencies": {
159
- "solid-js": "^1.8.0"
159
+ "solid-js": "^1.9.17"
160
160
  },
161
161
  "dependencies": {
162
162
  "clsx": "^2.1.1",
@@ -173,7 +173,7 @@
173
173
  },
174
174
  "devDependencies": {
175
175
  "@tailwindcss/vite": "^4.3.3",
176
- "solid-js": "^1.9.15",
176
+ "solid-js": "^1.9.17",
177
177
  "tailwindcss": "^4.3.3",
178
178
  "typescript": "^5.9.3",
179
179
  "vite": "^7.3.6",