@getartisanflow/alpineflow 0.2.3-alpha → 0.2.5-alpha
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/README.md +1 -0
- package/dist/alpineflow-collab.esm.js.map +1 -1
- package/dist/alpineflow-collab.js.map +1 -1
- package/dist/alpineflow-schema.esm.js +785 -679
- package/dist/alpineflow-schema.esm.js.map +1 -1
- package/dist/alpineflow-workflow.esm.js.map +1 -1
- package/dist/alpineflow.bundle.esm.js +7007 -6869
- package/dist/alpineflow.bundle.esm.js.map +1 -1
- package/dist/alpineflow.esm.js +2 -2
- package/dist/alpineflow.js +1 -1
- package/dist/{index-B8jw3ALY.js → index-iNX5XDHl.js} +6086 -5948
- package/dist/index-iNX5XDHl.js.map +1 -0
- package/dist/locales/de.json +62 -0
- package/dist/locales/en.json +62 -0
- package/dist/types/lib/collab.d.ts +2 -2
- package/dist/types/lib/core.d.ts +2 -2
- package/dist/types/lib/dagre.d.ts +1 -1
- package/dist/types/lib/elk.d.ts +1 -1
- package/dist/types/lib/force.d.ts +1 -1
- package/dist/types/lib/hierarchy.d.ts +1 -1
- package/dist/types/lib/schema.d.ts +2 -2
- package/dist/types/lib/whiteboard.d.ts +1 -1
- package/dist/types/lib/workflow.d.ts +2 -2
- package/dist/types/src/animate/animator.d.ts +6 -6
- package/dist/types/src/animate/clamp-dimensions.d.ts +1 -1
- package/dist/types/src/animate/flow-group.d.ts +1 -1
- package/dist/types/src/animate/handle-registry.d.ts +1 -1
- package/dist/types/src/animate/index.d.ts +19 -19
- package/dist/types/src/animate/interpolators.d.ts +1 -1
- package/dist/types/src/animate/motion/decay.d.ts +1 -1
- package/dist/types/src/animate/motion/index.d.ts +7 -7
- package/dist/types/src/animate/motion/inertia.d.ts +1 -1
- package/dist/types/src/animate/motion/keyframes.d.ts +1 -1
- package/dist/types/src/animate/motion/presets.d.ts +1 -1
- package/dist/types/src/animate/motion/spring.d.ts +1 -1
- package/dist/types/src/animate/particle-renderers.d.ts +1 -1
- package/dist/types/src/animate/recording/event-cursor.d.ts +1 -1
- package/dist/types/src/animate/recording/index.d.ts +7 -7
- package/dist/types/src/animate/recording/recorder.d.ts +1 -1
- package/dist/types/src/animate/recording/recording.d.ts +1 -1
- package/dist/types/src/animate/recording/replay.d.ts +2 -2
- package/dist/types/src/animate/recording/thumbnail.d.ts +1 -1
- package/dist/types/src/animate/recording/types.d.ts +3 -3
- package/dist/types/src/animate/recording/virtual-engine.d.ts +1 -1
- package/dist/types/src/animate/timeline.d.ts +5 -5
- package/dist/types/src/animate/transaction.d.ts +1 -1
- package/dist/types/src/collab/awareness.d.ts +1 -1
- package/dist/types/src/collab/bridge.d.ts +2 -2
- package/dist/types/src/collab/directives/flow-cursors.d.ts +1 -1
- package/dist/types/src/collab/index.d.ts +9 -9
- package/dist/types/src/collab/providers/in-memory.d.ts +1 -1
- package/dist/types/src/collab/providers/reverb.d.ts +1 -1
- package/dist/types/src/collab/providers/websocket.d.ts +1 -1
- package/dist/types/src/collab/store.d.ts +2 -2
- package/dist/types/src/core/__fixtures__/nodes.d.ts +1 -1
- package/dist/types/src/core/announcer.d.ts +10 -3
- package/dist/types/src/core/child-layout.d.ts +1 -1
- package/dist/types/src/core/child-validation.d.ts +1 -1
- package/dist/types/src/core/clipboard.d.ts +1 -1
- package/dist/types/src/core/collapse.d.ts +1 -1
- package/dist/types/src/core/compute.d.ts +1 -1
- package/dist/types/src/core/connections.d.ts +1 -1
- package/dist/types/src/core/controls-panel.d.ts +3 -0
- package/dist/types/src/core/crossing-reduction.d.ts +2 -2
- package/dist/types/src/core/drag.d.ts +1 -1
- package/dist/types/src/core/edge-paths/avoidant.d.ts +3 -3
- package/dist/types/src/core/edge-paths/bezier.d.ts +2 -2
- package/dist/types/src/core/edge-paths/editable.d.ts +2 -2
- package/dist/types/src/core/edge-paths/index.d.ts +7 -7
- package/dist/types/src/core/edge-paths/orthogonal.d.ts +2 -2
- package/dist/types/src/core/edge-paths/smoothstep.d.ts +2 -2
- package/dist/types/src/core/edge-paths/straight.d.ts +1 -1
- package/dist/types/src/core/edge-paths/utils.d.ts +1 -1
- package/dist/types/src/core/edge-utils.d.ts +3 -3
- package/dist/types/src/core/endpoint-spread.d.ts +1 -1
- package/dist/types/src/core/export.d.ts +1 -1
- package/dist/types/src/core/floating-edge.d.ts +1 -1
- package/dist/types/src/core/geometry.d.ts +1 -1
- package/dist/types/src/core/gradients.d.ts +1 -1
- package/dist/types/src/core/graph.d.ts +1 -1
- package/dist/types/src/core/helper-lines.d.ts +1 -1
- package/dist/types/src/core/history.d.ts +1 -1
- package/dist/types/src/core/index.d.ts +17 -17
- package/dist/types/src/core/intersection.d.ts +1 -1
- package/dist/types/src/core/lasso-hit-test.d.ts +1 -1
- package/dist/types/src/core/lasso.d.ts +2 -2
- package/dist/types/src/core/layout/dagre.d.ts +1 -1
- package/dist/types/src/core/layout/elk.d.ts +1 -1
- package/dist/types/src/core/layout/force.d.ts +1 -1
- package/dist/types/src/core/layout/hierarchy.d.ts +1 -1
- package/dist/types/src/core/minimap.d.ts +1 -1
- package/dist/types/src/core/pan-zoom.d.ts +10 -4
- package/dist/types/src/core/proximity-connect.d.ts +1 -1
- package/dist/types/src/core/render-plan.d.ts +1 -1
- package/dist/types/src/core/resize.d.ts +1 -1
- package/dist/types/src/core/schema-geometry.d.ts +1 -1
- package/dist/types/src/core/selection-box.d.ts +1 -1
- package/dist/types/src/core/shapes.d.ts +1 -1
- package/dist/types/src/core/sub-flow.d.ts +1 -1
- package/dist/types/src/core/translations.d.ts +175 -0
- package/dist/types/src/core/types.d.ts +29 -11
- package/dist/types/src/index.d.ts +31 -30
- package/dist/types/src/plugin/connection-utils.d.ts +3 -3
- package/dist/types/src/plugin/data/__real-canvas-harness.d.ts +1 -1
- package/dist/types/src/plugin/data/__test-utils.d.ts +1 -1
- package/dist/types/src/plugin/data/canvas-animation.d.ts +13 -13
- package/dist/types/src/plugin/data/canvas-batch.d.ts +1 -1
- package/dist/types/src/plugin/data/canvas-collapse.d.ts +1 -1
- package/dist/types/src/plugin/data/canvas-compute.d.ts +2 -2
- package/dist/types/src/plugin/data/canvas-condense.d.ts +1 -1
- package/dist/types/src/plugin/data/canvas-config.d.ts +1 -1
- package/dist/types/src/plugin/data/canvas-context.d.ts +22 -22
- package/dist/types/src/plugin/data/canvas-dom.d.ts +2 -2
- package/dist/types/src/plugin/data/canvas-edges.d.ts +2 -2
- package/dist/types/src/plugin/data/canvas-history.d.ts +2 -2
- package/dist/types/src/plugin/data/canvas-layout.d.ts +4 -4
- package/dist/types/src/plugin/data/canvas-nodes.d.ts +2 -2
- package/dist/types/src/plugin/data/canvas-particles.d.ts +2 -2
- package/dist/types/src/plugin/data/canvas-rows.d.ts +2 -2
- package/dist/types/src/plugin/data/canvas-selection.d.ts +1 -1
- package/dist/types/src/plugin/data/canvas-validation.d.ts +2 -2
- package/dist/types/src/plugin/data/canvas-viewport.d.ts +4 -4
- package/dist/types/src/plugin/directives/flow-edge.d.ts +1 -1
- package/dist/types/src/plugin/directives/flow-handle-validate.d.ts +1 -1
- package/dist/types/src/plugin/directives/flow-handle.d.ts +2 -2
- package/dist/types/src/plugin/drag-validation.d.ts +1 -1
- package/dist/types/src/plugin/handle-index.d.ts +1 -1
- package/dist/types/src/schema/canvas-augmentation.test-d.d.ts +1 -1
- package/dist/types/src/schema/diff.d.ts +1 -1
- package/dist/types/src/schema/dot.d.ts +1 -1
- package/dist/types/src/schema/field-ops.d.ts +1 -1
- package/dist/types/src/schema/history.d.ts +1 -1
- package/dist/types/src/schema/index.d.ts +24 -24
- package/dist/types/src/schema/layout.d.ts +1 -1
- package/dist/types/src/schema/references.d.ts +1 -1
- package/dist/types/src/schema/serialization.d.ts +1 -1
- package/dist/types/src/schema/types.d.ts +1 -1
- package/dist/types/src/schema/validate.d.ts +1 -1
- package/dist/types/src/workflow/condition.d.ts +1 -1
- package/dist/types/src/workflow/index.d.ts +3 -3
- package/dist/types/src/workflow/replay.d.ts +1 -1
- package/dist/types/src/workflow/run.d.ts +1 -1
- package/dist/types/src/workflow/types.d.ts +3 -3
- package/package.json +5 -2
- package/dist/index-B8jw3ALY.js.map +0 -1
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
return typeof globalThis < "u" ? (globalThis[
|
|
1
|
+
const X = "__alpineflow_registry__";
|
|
2
|
+
function he() {
|
|
3
|
+
return typeof globalThis < "u" ? (globalThis[X] || (globalThis[X] = /* @__PURE__ */ new Map()), globalThis[X]) : /* @__PURE__ */ new Map();
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
5
|
+
function ye(e, t) {
|
|
6
|
+
he().set(e, t);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
return { edges: e.map((
|
|
11
|
-
let
|
|
12
|
-
return
|
|
13
|
-
}), cascadedIds:
|
|
8
|
+
function Ee(e, t, r, n) {
|
|
9
|
+
const i = [];
|
|
10
|
+
return { edges: e.map((s) => {
|
|
11
|
+
let c = s;
|
|
12
|
+
return s.source === t && s.sourceHandle === r && (c = { ...c, sourceHandle: n }), s.target === t && s.targetHandle === r && (c = { ...c, targetHandle: n }), c !== s && i.push(s.id), c;
|
|
13
|
+
}), cascadedIds: i };
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
15
|
+
function ve(e, t, r) {
|
|
16
|
+
const n = [];
|
|
17
17
|
return { edges: e.filter((d) => {
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
}), droppedIds:
|
|
18
|
+
const s = d.source === t && d.sourceHandle === r || d.target === t && d.targetHandle === r;
|
|
19
|
+
return s && n.push(d.id), !s;
|
|
20
|
+
}), droppedIds: n };
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
function
|
|
24
|
-
return typeof e == "string" && e.length <=
|
|
22
|
+
const we = /^[a-z][a-z0-9_]*$/, be = 40;
|
|
23
|
+
function pe(e) {
|
|
24
|
+
return typeof e == "string" && e.length <= be && we.test(e);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
26
|
+
function W(e, t, r) {
|
|
27
|
+
const n = e?.el ?? e?._container;
|
|
28
|
+
if (!n || typeof n.dispatchEvent != "function")
|
|
29
29
|
return;
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const i = [], d = typeof window < "u" ? window : void 0, s = (c) => {
|
|
31
|
+
i.push(c.error ?? c.message), c.preventDefault();
|
|
32
32
|
};
|
|
33
|
-
d && typeof d.addEventListener == "function" && d.addEventListener("error",
|
|
33
|
+
d && typeof d.addEventListener == "function" && d.addEventListener("error", s, !0);
|
|
34
34
|
try {
|
|
35
|
-
|
|
36
|
-
} catch (
|
|
37
|
-
|
|
35
|
+
n.dispatchEvent(new CustomEvent(t, { detail: r, bubbles: !0 }));
|
|
36
|
+
} catch (c) {
|
|
37
|
+
i.push(c);
|
|
38
38
|
} finally {
|
|
39
|
-
d && typeof d.removeEventListener == "function" && d.removeEventListener("error",
|
|
39
|
+
d && typeof d.removeEventListener == "function" && d.removeEventListener("error", s, !0);
|
|
40
40
|
}
|
|
41
|
-
for (const
|
|
42
|
-
console.error("[alpineflow/schema] listener threw while handling", t,
|
|
41
|
+
for (const c of i)
|
|
42
|
+
console.error("[alpineflow/schema] listener threw while handling", t, c);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function V(e, t) {
|
|
45
45
|
return e?.nodes?.find((r) => r.id === t) ?? null;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
const
|
|
49
|
-
return
|
|
47
|
+
function Se(e, t, r) {
|
|
48
|
+
const n = V(e, t);
|
|
49
|
+
return n ? pe(r?.name) ? (n.data || (n.data = { label: t, fields: [] }), (n.data.fields ?? []).some((d) => d.name === r.name) ? { applied: !1, reason: "duplicate" } : (Array.isArray(n.data.fields) || (n.data.fields = []), n.data.fields.push({ ...r }), W(e, "schema:field-added", { nodeId: t, field: { ...r } }), { applied: !0 })) : { applied: !1, reason: "invalid-name" } : { applied: !1, reason: "no-node" };
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
if (r ===
|
|
51
|
+
function Ae(e, t, r, n) {
|
|
52
|
+
if (r === n)
|
|
53
53
|
return { applied: !1, reason: "unchanged", cascadedEdgeIds: [] };
|
|
54
|
-
if (!
|
|
54
|
+
if (!pe(n))
|
|
55
55
|
return { applied: !1, reason: "invalid-name", cascadedEdgeIds: [] };
|
|
56
|
-
const
|
|
57
|
-
if (!s)
|
|
58
|
-
return { applied: !1, reason: "no-node", cascadedEdgeIds: [] };
|
|
59
|
-
const d = s.data?.fields ?? [], i = d.find((u) => u.name === r);
|
|
56
|
+
const i = V(e, t);
|
|
60
57
|
if (!i)
|
|
58
|
+
return { applied: !1, reason: "no-node", cascadedEdgeIds: [] };
|
|
59
|
+
const d = i.data?.fields ?? [], s = d.find((u) => u.name === r);
|
|
60
|
+
if (!s)
|
|
61
61
|
return { applied: !1, reason: "no-field", cascadedEdgeIds: [] };
|
|
62
|
-
if (d.some((u) => u.name ===
|
|
62
|
+
if (d.some((u) => u.name === n))
|
|
63
63
|
return { applied: !1, reason: "duplicate", cascadedEdgeIds: [] };
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
const u = new Map(
|
|
64
|
+
s.name = n;
|
|
65
|
+
const c = e.edges ?? [], { edges: o, cascadedIds: a } = Ee(c, t, r, n);
|
|
66
|
+
if (a.length > 0) {
|
|
67
|
+
const u = new Map(o.map((l) => [l.id, l]));
|
|
68
68
|
for (const l of e.edges) {
|
|
69
|
-
const
|
|
70
|
-
!
|
|
69
|
+
const m = u.get(l.id);
|
|
70
|
+
!m || m === l || (l.sourceHandle !== m.sourceHandle && (l.sourceHandle = m.sourceHandle), l.targetHandle !== m.targetHandle && (l.targetHandle = m.targetHandle));
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
return
|
|
73
|
+
return W(e, "schema:field-renamed", {
|
|
74
74
|
nodeId: t,
|
|
75
75
|
oldName: r,
|
|
76
|
-
newName:
|
|
77
|
-
cascadedEdgeIds:
|
|
78
|
-
}),
|
|
76
|
+
newName: n,
|
|
77
|
+
cascadedEdgeIds: a
|
|
78
|
+
}), a.length > 0 && W(e, "schema:edges-cascaded", {
|
|
79
79
|
nodeId: t,
|
|
80
|
-
fieldName:
|
|
81
|
-
edgeIds:
|
|
80
|
+
fieldName: n,
|
|
81
|
+
edgeIds: a,
|
|
82
82
|
operation: "rename"
|
|
83
|
-
}), { applied: !0, cascadedEdgeIds:
|
|
83
|
+
}), { applied: !0, cascadedEdgeIds: a };
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
85
|
+
function Ie(e, t, r) {
|
|
86
|
+
const n = V(e, t);
|
|
87
|
+
if (!n)
|
|
88
88
|
return { applied: !1, reason: "no-node", droppedEdgeIds: [] };
|
|
89
|
-
const d = (
|
|
89
|
+
const d = (n.data?.fields ?? []).findIndex((o) => o.name === r);
|
|
90
90
|
if (d === -1)
|
|
91
91
|
return { applied: !1, reason: "no-field", droppedEdgeIds: [] };
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
95
|
-
const
|
|
96
|
-
for (let
|
|
97
|
-
|
|
92
|
+
n.data.fields.splice(d, 1);
|
|
93
|
+
const s = e.edges ?? [], { droppedIds: c } = ve(s, t, r);
|
|
94
|
+
if (c.length > 0) {
|
|
95
|
+
const o = new Set(c);
|
|
96
|
+
for (let a = e.edges.length - 1; a >= 0; a--)
|
|
97
|
+
o.has(e.edges[a].id) && e.edges.splice(a, 1);
|
|
98
98
|
e._rebuildEdgeMap?.();
|
|
99
99
|
}
|
|
100
|
-
return
|
|
100
|
+
return W(e, "schema:field-removed", {
|
|
101
101
|
nodeId: t,
|
|
102
102
|
fieldName: r,
|
|
103
|
-
droppedEdgeIds:
|
|
104
|
-
}),
|
|
103
|
+
droppedEdgeIds: c
|
|
104
|
+
}), c.length > 0 && W(e, "schema:edges-cascaded", {
|
|
105
105
|
nodeId: t,
|
|
106
106
|
fieldName: r,
|
|
107
|
-
edgeIds:
|
|
107
|
+
edgeIds: c,
|
|
108
108
|
operation: "remove"
|
|
109
|
-
}), { applied: !0, droppedEdgeIds:
|
|
109
|
+
}), { applied: !0, droppedEdgeIds: c };
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function Ne(e, t, r) {
|
|
112
112
|
if (!Array.isArray(r))
|
|
113
113
|
return { applied: !1, reason: "mismatch" };
|
|
114
114
|
if (new Set(r).size !== r.length)
|
|
115
115
|
return { applied: !1, reason: "mismatch" };
|
|
116
|
-
const
|
|
117
|
-
if (!
|
|
116
|
+
const n = V(e, t);
|
|
117
|
+
if (!n)
|
|
118
118
|
return { applied: !1, reason: "no-node" };
|
|
119
|
-
const
|
|
120
|
-
if (r.length !==
|
|
119
|
+
const i = n.data?.fields ?? [];
|
|
120
|
+
if (r.length !== i.length)
|
|
121
121
|
return { applied: !1, reason: "mismatch" };
|
|
122
|
-
const d = new Set(
|
|
123
|
-
if (d.size !==
|
|
122
|
+
const d = new Set(i.map((a) => a.name)), s = new Set(r);
|
|
123
|
+
if (d.size !== s.size)
|
|
124
124
|
return { applied: !1, reason: "mismatch" };
|
|
125
|
-
for (const
|
|
126
|
-
if (!d.has(
|
|
125
|
+
for (const a of r)
|
|
126
|
+
if (!d.has(a))
|
|
127
127
|
return { applied: !1, reason: "mismatch" };
|
|
128
|
-
const
|
|
129
|
-
for (const
|
|
130
|
-
a
|
|
131
|
-
const
|
|
132
|
-
return
|
|
128
|
+
const c = /* @__PURE__ */ Object.create(null);
|
|
129
|
+
for (const a of i)
|
|
130
|
+
c[a.name] = a;
|
|
131
|
+
const o = r.map((a) => c[a]);
|
|
132
|
+
return n.data.fields.splice(0, n.data.fields.length, ...o), { applied: !0 };
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function me(e) {
|
|
135
135
|
const t = /* @__PURE__ */ new Map();
|
|
136
|
-
for (const
|
|
137
|
-
t.set(
|
|
136
|
+
for (const n of e)
|
|
137
|
+
t.set(n.id, n);
|
|
138
138
|
const r = [];
|
|
139
|
-
for (const
|
|
140
|
-
const
|
|
141
|
-
for (const d of
|
|
139
|
+
for (const n of e) {
|
|
140
|
+
const i = n.data?.fields ?? [];
|
|
141
|
+
for (const d of i) {
|
|
142
142
|
if (typeof d?.name != "string" || !d.name.endsWith("_id"))
|
|
143
143
|
continue;
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
144
|
+
const s = d.name.slice(0, -3);
|
|
145
|
+
if (!s)
|
|
146
146
|
continue;
|
|
147
|
-
const
|
|
148
|
-
if (!
|
|
147
|
+
const c = t.get(s);
|
|
148
|
+
if (!c || c.id === n.id)
|
|
149
149
|
continue;
|
|
150
|
-
const
|
|
150
|
+
const o = c.data?.fields ?? [], u = o.find((l) => l.key === "primary")?.name ?? o[0]?.name ?? "id";
|
|
151
151
|
r.push({
|
|
152
|
-
fromNodeId:
|
|
152
|
+
fromNodeId: n.id,
|
|
153
153
|
fromFieldName: d.name,
|
|
154
|
-
toNodeId:
|
|
154
|
+
toNodeId: c.id,
|
|
155
155
|
toFieldName: u,
|
|
156
156
|
confidence: "exact"
|
|
157
157
|
});
|
|
@@ -159,337 +159,337 @@ function de(e) {
|
|
|
159
159
|
}
|
|
160
160
|
return r;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function Ce(e, t) {
|
|
163
163
|
return e === t ? !0 : e === void 0 || t === void 0 ? e === t : JSON.stringify(e) === JSON.stringify(t);
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
const
|
|
167
|
-
for (const
|
|
168
|
-
const
|
|
169
|
-
if (!
|
|
170
|
-
d.push(
|
|
165
|
+
function se(e, t, r = {}) {
|
|
166
|
+
const n = r.deleteMissing ?? !0, i = new Map(e.map((s) => [s.id, s])), d = [];
|
|
167
|
+
for (const s of t) {
|
|
168
|
+
const c = i.get(s.id);
|
|
169
|
+
if (!c) {
|
|
170
|
+
d.push(s);
|
|
171
171
|
continue;
|
|
172
172
|
}
|
|
173
|
-
if (
|
|
174
|
-
for (const
|
|
175
|
-
|
|
176
|
-
for (const [
|
|
177
|
-
|
|
178
|
-
d.push(
|
|
173
|
+
if (n)
|
|
174
|
+
for (const o of Object.keys(c))
|
|
175
|
+
o !== "id" && !(o in s) && delete c[o];
|
|
176
|
+
for (const [o, a] of Object.entries(s))
|
|
177
|
+
o === "id" || o === "__proto__" || o === "constructor" || o === "prototype" || Ce(c[o], a) || (c[o] = a);
|
|
178
|
+
d.push(c);
|
|
179
179
|
}
|
|
180
180
|
return d;
|
|
181
181
|
}
|
|
182
182
|
function K(e) {
|
|
183
|
-
const t = (e.nodes ?? []).map((
|
|
184
|
-
id:
|
|
185
|
-
label:
|
|
186
|
-
fields: (
|
|
187
|
-
position: { x:
|
|
188
|
-
})), r = (e.edges ?? []).map((
|
|
189
|
-
const
|
|
190
|
-
return
|
|
183
|
+
const t = (e.nodes ?? []).map((n) => ({
|
|
184
|
+
id: n.id,
|
|
185
|
+
label: n.data?.label ?? "",
|
|
186
|
+
fields: (n.data?.fields ?? []).map((i) => ({ ...i })),
|
|
187
|
+
position: { x: n.position?.x ?? 0, y: n.position?.y ?? 0 }
|
|
188
|
+
})), r = (e.edges ?? []).map((n) => {
|
|
189
|
+
const i = { id: n.id, source: n.source, target: n.target };
|
|
190
|
+
return n.sourceHandle !== void 0 && (i.sourceHandle = n.sourceHandle), n.targetHandle !== void 0 && (i.targetHandle = n.targetHandle), n.label !== void 0 && (i.label = n.label), i;
|
|
191
191
|
});
|
|
192
192
|
return { version: 1, nodes: t, edges: r };
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function ge(e, t) {
|
|
195
195
|
if (!t || typeof t.version != "number")
|
|
196
196
|
throw new Error("[alpineflow/schema] schemaFromJSON: missing or invalid version");
|
|
197
197
|
if (t.version !== 1)
|
|
198
198
|
throw new Error(`[alpineflow/schema] schemaFromJSON: unsupported version ${t.version}`);
|
|
199
|
-
const r = (t.nodes ?? []).map((
|
|
200
|
-
id:
|
|
201
|
-
position: { x:
|
|
199
|
+
const r = (t.nodes ?? []).map((s) => ({
|
|
200
|
+
id: s.id,
|
|
201
|
+
position: { x: s.position?.x ?? 0, y: s.position?.y ?? 0 },
|
|
202
202
|
data: {
|
|
203
|
-
label:
|
|
204
|
-
fields: (
|
|
203
|
+
label: s.label,
|
|
204
|
+
fields: (s.fields ?? []).map((c) => ({ ...c }))
|
|
205
205
|
}
|
|
206
|
-
})),
|
|
207
|
-
const
|
|
208
|
-
return
|
|
209
|
-
}),
|
|
210
|
-
e.nodes.splice(0, e.nodes.length, ...
|
|
211
|
-
const d =
|
|
206
|
+
})), n = (t.edges ?? []).map((s) => {
|
|
207
|
+
const c = { id: s.id, source: s.source, target: s.target };
|
|
208
|
+
return s.sourceHandle !== void 0 && (c.sourceHandle = s.sourceHandle), s.targetHandle !== void 0 && (c.targetHandle = s.targetHandle), s.label !== void 0 && (c.label = s.label), c;
|
|
209
|
+
}), i = se(e.nodes, r, { deleteMissing: !1 });
|
|
210
|
+
e.nodes.splice(0, e.nodes.length, ...i);
|
|
211
|
+
const d = se(e.edges, n, { deleteMissing: !1 });
|
|
212
212
|
e.edges.splice(0, e.edges.length, ...d), e._rebuildNodeMap?.(), e._rebuildEdgeMap?.(), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
|
|
213
213
|
e._layoutAnimTick = (e._layoutAnimTick ?? 0) + 1;
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
|
-
function
|
|
217
|
-
for (const
|
|
218
|
-
if (
|
|
216
|
+
function Le(e, t) {
|
|
217
|
+
for (const o of t)
|
|
218
|
+
if (o && typeof o.source == "string" && o.source === o.target)
|
|
219
219
|
return !0;
|
|
220
|
-
const r = /* @__PURE__ */ new Map(),
|
|
221
|
-
let
|
|
222
|
-
return
|
|
220
|
+
const r = /* @__PURE__ */ new Map(), n = (o) => {
|
|
221
|
+
let a = r.get(o);
|
|
222
|
+
return a || (a = [], r.set(o, a)), a;
|
|
223
223
|
};
|
|
224
|
-
for (const
|
|
225
|
-
|
|
226
|
-
for (const
|
|
227
|
-
!
|
|
228
|
-
const
|
|
229
|
-
for (const
|
|
230
|
-
|
|
231
|
-
for (const
|
|
232
|
-
if (
|
|
233
|
-
const
|
|
234
|
-
for (
|
|
235
|
-
const u =
|
|
224
|
+
for (const o of e)
|
|
225
|
+
o && typeof o.id == "string" && n(o.id);
|
|
226
|
+
for (const o of t)
|
|
227
|
+
!o || typeof o.source != "string" || typeof o.target != "string" || (n(o.source).push(o.target), n(o.target));
|
|
228
|
+
const i = 0, d = 1, s = 2, c = /* @__PURE__ */ new Map();
|
|
229
|
+
for (const o of r.keys())
|
|
230
|
+
c.set(o, i);
|
|
231
|
+
for (const o of r.keys()) {
|
|
232
|
+
if (c.get(o) !== i) continue;
|
|
233
|
+
const a = [{ node: o, idx: 0 }];
|
|
234
|
+
for (c.set(o, d); a.length > 0; ) {
|
|
235
|
+
const u = a[a.length - 1], l = r.get(u.node) ?? [];
|
|
236
236
|
if (u.idx < l.length) {
|
|
237
|
-
const
|
|
238
|
-
if (
|
|
237
|
+
const m = l[u.idx++], g = c.get(m);
|
|
238
|
+
if (g === d)
|
|
239
239
|
return !0;
|
|
240
|
-
|
|
240
|
+
g === i && (c.set(m, d), a.push({ node: m, idx: 0 }));
|
|
241
241
|
} else
|
|
242
|
-
|
|
242
|
+
c.set(u.node, s), a.pop();
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
return !1;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
const t = [], r = Array.isArray(e?.nodes) ? e.nodes : [],
|
|
249
|
-
for (const
|
|
250
|
-
!
|
|
251
|
-
for (const
|
|
247
|
+
function Re(e) {
|
|
248
|
+
const t = [], r = Array.isArray(e?.nodes) ? e.nodes : [], n = Array.isArray(e?.edges) ? e.edges : [], i = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
|
|
249
|
+
for (const o of r)
|
|
250
|
+
!o || typeof o.id != "string" || (i.has(o.id) && d.add(o.id), i.add(o.id));
|
|
251
|
+
for (const o of d)
|
|
252
252
|
t.push({
|
|
253
253
|
severity: "error",
|
|
254
254
|
code: "duplicate-node-id",
|
|
255
|
-
nodeId:
|
|
256
|
-
message: `Duplicate node id "${
|
|
255
|
+
nodeId: o,
|
|
256
|
+
message: `Duplicate node id "${o}".`
|
|
257
257
|
});
|
|
258
|
-
for (const
|
|
259
|
-
if (!
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
258
|
+
for (const o of r) {
|
|
259
|
+
if (!o || typeof o.id != "string") continue;
|
|
260
|
+
const a = Array.isArray(o.data?.fields) ? o.data.fields : [];
|
|
261
|
+
if (a.length === 0) continue;
|
|
262
262
|
const u = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
|
|
263
|
-
for (const
|
|
264
|
-
!
|
|
265
|
-
for (const
|
|
263
|
+
for (const g of a)
|
|
264
|
+
!g || typeof g.name != "string" || (u.has(g.name) && l.add(g.name), u.add(g.name));
|
|
265
|
+
for (const g of l)
|
|
266
266
|
t.push({
|
|
267
267
|
severity: "error",
|
|
268
268
|
code: "duplicate-field",
|
|
269
|
-
nodeId:
|
|
270
|
-
fieldName:
|
|
271
|
-
message: `Duplicate field "${
|
|
269
|
+
nodeId: o.id,
|
|
270
|
+
fieldName: g,
|
|
271
|
+
message: `Duplicate field "${g}" on node "${o.id}".`
|
|
272
272
|
});
|
|
273
|
-
|
|
273
|
+
a.some((g) => g && g.key === "primary") || t.push({
|
|
274
274
|
severity: "warning",
|
|
275
275
|
code: "missing-primary-key",
|
|
276
|
-
nodeId:
|
|
277
|
-
message: `Node "${
|
|
276
|
+
nodeId: o.id,
|
|
277
|
+
message: `Node "${o.id}" has no primary-key field.`
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
|
-
for (const
|
|
281
|
-
if (!
|
|
282
|
-
const
|
|
283
|
-
(typeof
|
|
280
|
+
for (const o of n) {
|
|
281
|
+
if (!o) continue;
|
|
282
|
+
const a = typeof o.id == "string" ? o.id : void 0;
|
|
283
|
+
(typeof o.source != "string" || !i.has(o.source)) && t.push({
|
|
284
284
|
severity: "error",
|
|
285
285
|
code: "dangling-edge",
|
|
286
|
-
edgeId:
|
|
287
|
-
nodeId: typeof
|
|
288
|
-
message: `Edge ${
|
|
289
|
-
}), (typeof
|
|
286
|
+
edgeId: a,
|
|
287
|
+
nodeId: typeof o.source == "string" ? o.source : void 0,
|
|
288
|
+
message: `Edge ${a ? `"${a}" ` : ""}references missing source node "${o.source}".`
|
|
289
|
+
}), (typeof o.target != "string" || !i.has(o.target)) && t.push({
|
|
290
290
|
severity: "error",
|
|
291
291
|
code: "dangling-edge",
|
|
292
|
-
edgeId:
|
|
293
|
-
nodeId: typeof
|
|
294
|
-
message: `Edge ${
|
|
292
|
+
edgeId: a,
|
|
293
|
+
nodeId: typeof o.target == "string" ? o.target : void 0,
|
|
294
|
+
message: `Edge ${a ? `"${a}" ` : ""}references missing target node "${o.target}".`
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
const
|
|
298
|
-
for (const
|
|
299
|
-
|
|
300
|
-
for (const
|
|
301
|
-
!
|
|
297
|
+
const s = /* @__PURE__ */ new Set();
|
|
298
|
+
for (const o of n)
|
|
299
|
+
o && (typeof o.source == "string" && s.add(o.source), typeof o.target == "string" && s.add(o.target));
|
|
300
|
+
for (const o of r)
|
|
301
|
+
!o || typeof o.id != "string" || s.has(o.id) || t.push({
|
|
302
302
|
severity: "warning",
|
|
303
303
|
code: "disconnected-node",
|
|
304
|
-
nodeId:
|
|
305
|
-
message: `Node "${
|
|
304
|
+
nodeId: o.id,
|
|
305
|
+
message: `Node "${o.id}" has no connected edges.`
|
|
306
306
|
});
|
|
307
|
-
return
|
|
307
|
+
return Le(r, n) && t.push({
|
|
308
308
|
severity: "warning",
|
|
309
309
|
code: "cycle",
|
|
310
310
|
message: "Directed cycle detected in edge graph."
|
|
311
|
-
}), { valid: !t.some((
|
|
311
|
+
}), { valid: !t.some((o) => o.severity === "error"), issues: t };
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function ie(e) {
|
|
314
314
|
return !e || !Array.isArray(e.nodes) ? [] : e.nodes.filter((t) => !!t && typeof t.id == "string");
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function de(e) {
|
|
317
317
|
return !e || !Array.isArray(e.edges) ? [] : e.edges.filter((t) => !!t && typeof t.id == "string");
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function ce(e) {
|
|
320
320
|
const t = /* @__PURE__ */ new Map(), r = Array.isArray(e.fields) ? e.fields : [];
|
|
321
|
-
for (const
|
|
322
|
-
|
|
321
|
+
for (const n of r)
|
|
322
|
+
n && typeof n.name == "string" && t.set(n.name, n);
|
|
323
323
|
return t;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
const
|
|
327
|
-
for (const f of
|
|
328
|
-
|
|
329
|
-
const
|
|
330
|
-
for (const f of
|
|
331
|
-
|
|
332
|
-
const
|
|
333
|
-
for (const f of
|
|
334
|
-
|
|
335
|
-
for (const f of
|
|
336
|
-
|
|
337
|
-
const l = [],
|
|
325
|
+
function Fe(e, t, r = {}) {
|
|
326
|
+
const n = ie(e), i = ie(t), d = de(e), s = de(t), c = /* @__PURE__ */ new Map();
|
|
327
|
+
for (const f of n)
|
|
328
|
+
c.set(f.id, f);
|
|
329
|
+
const o = /* @__PURE__ */ new Map();
|
|
330
|
+
for (const f of i)
|
|
331
|
+
o.set(f.id, f);
|
|
332
|
+
const a = [], u = [];
|
|
333
|
+
for (const f of o.keys())
|
|
334
|
+
c.has(f) || a.push(f);
|
|
335
|
+
for (const f of c.keys())
|
|
336
|
+
o.has(f) || u.push(f);
|
|
337
|
+
const l = [], m = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set();
|
|
338
338
|
if (r.detectRenames) {
|
|
339
|
-
const f = (h) => (Array.isArray(h.fields) ? h.fields : []).filter((
|
|
339
|
+
const f = (h) => (Array.isArray(h.fields) ? h.fields : []).filter((x) => x && typeof x.name == "string").map((x) => x.name).sort().join("\0");
|
|
340
340
|
for (const h of u) {
|
|
341
|
-
const I =
|
|
341
|
+
const I = c.get(h);
|
|
342
342
|
if (!I) continue;
|
|
343
|
-
const
|
|
344
|
-
for (const
|
|
345
|
-
if (
|
|
346
|
-
const C =
|
|
347
|
-
C && f(C) ===
|
|
343
|
+
const x = f(I), _ = [];
|
|
344
|
+
for (const R of a) {
|
|
345
|
+
if (m.has(R)) continue;
|
|
346
|
+
const C = o.get(R);
|
|
347
|
+
C && f(C) === x && _.push(R);
|
|
348
348
|
}
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
l.push({ from: h, to:
|
|
349
|
+
if (_.length === 1) {
|
|
350
|
+
const R = _[0];
|
|
351
|
+
l.push({ from: h, to: R }), m.add(R), g.add(h);
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
const
|
|
356
|
-
for (const f of
|
|
357
|
-
|
|
355
|
+
const v = a.filter((f) => !m.has(f)), b = u.filter((f) => !g.has(f)), p = [];
|
|
356
|
+
for (const f of c.keys())
|
|
357
|
+
o.has(f) && p.push({ beforeId: f, afterId: f });
|
|
358
358
|
for (const f of l)
|
|
359
|
-
|
|
360
|
-
const
|
|
359
|
+
p.push({ beforeId: f.from, afterId: f.to });
|
|
360
|
+
const y = /* @__PURE__ */ new Map();
|
|
361
361
|
for (const f of r.fieldRenames ?? []) {
|
|
362
362
|
if (!f || typeof f.nodeId != "string" || typeof f.from != "string" || typeof f.to != "string") continue;
|
|
363
|
-
let h =
|
|
364
|
-
h || (h = [],
|
|
363
|
+
let h = y.get(f.nodeId);
|
|
364
|
+
h || (h = [], y.set(f.nodeId, h)), h.push({ from: f.from, to: f.to });
|
|
365
365
|
}
|
|
366
|
-
const
|
|
366
|
+
const w = /* @__PURE__ */ new Map();
|
|
367
367
|
for (const f of l)
|
|
368
|
-
|
|
368
|
+
w.set(f.from, f.to);
|
|
369
369
|
for (const f of r.fieldRenames ?? []) {
|
|
370
370
|
if (!f || typeof f.nodeId != "string") continue;
|
|
371
|
-
const h =
|
|
372
|
-
if (h && !
|
|
373
|
-
const I =
|
|
374
|
-
|
|
371
|
+
const h = w.get(f.nodeId);
|
|
372
|
+
if (h && !y.has(h)) {
|
|
373
|
+
const I = y.get(f.nodeId) ?? [];
|
|
374
|
+
y.set(h, I);
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
const
|
|
378
|
-
for (const { beforeId: f, afterId: h } of
|
|
379
|
-
const I =
|
|
380
|
-
if (!I || !
|
|
381
|
-
const
|
|
382
|
-
for (const
|
|
383
|
-
const B =
|
|
384
|
-
if (!B || !M || P.has(
|
|
385
|
-
|
|
386
|
-
const
|
|
387
|
-
|
|
377
|
+
const E = [], A = [], F = [], N = [];
|
|
378
|
+
for (const { beforeId: f, afterId: h } of p) {
|
|
379
|
+
const I = c.get(f), x = o.get(h);
|
|
380
|
+
if (!I || !x) continue;
|
|
381
|
+
const _ = ce(I), R = ce(x), C = y.get(h) ?? y.get(f) ?? [], P = /* @__PURE__ */ new Set(), Z = /* @__PURE__ */ new Set();
|
|
382
|
+
for (const S of C) {
|
|
383
|
+
const B = _.get(S.from), M = R.get(S.to);
|
|
384
|
+
if (!B || !M || P.has(S.from) || Z.has(S.to)) continue;
|
|
385
|
+
E.push({ nodeId: h, from: S.from, to: S.to }), P.add(S.from), Z.add(S.to);
|
|
386
|
+
const j = typeof B.type == "string" ? B.type : "", z = typeof M.type == "string" ? M.type : "";
|
|
387
|
+
j !== z && N.push({
|
|
388
388
|
nodeId: h,
|
|
389
|
-
fieldName:
|
|
390
|
-
from:
|
|
391
|
-
to:
|
|
389
|
+
fieldName: S.to,
|
|
390
|
+
from: j,
|
|
391
|
+
to: z
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
|
-
for (const [
|
|
395
|
-
|
|
396
|
-
for (const [
|
|
397
|
-
P.has(
|
|
398
|
-
for (const [
|
|
399
|
-
if (P.has(
|
|
400
|
-
const M =
|
|
394
|
+
for (const [S] of R)
|
|
395
|
+
Z.has(S) || _.has(S) || A.push({ nodeId: h, fieldName: S });
|
|
396
|
+
for (const [S] of _)
|
|
397
|
+
P.has(S) || R.has(S) || F.push({ nodeId: h, fieldName: S });
|
|
398
|
+
for (const [S, B] of _) {
|
|
399
|
+
if (P.has(S)) continue;
|
|
400
|
+
const M = R.get(S);
|
|
401
401
|
if (!M) continue;
|
|
402
|
-
const
|
|
403
|
-
|
|
402
|
+
const j = typeof B.type == "string" ? B.type : "", z = typeof M.type == "string" ? M.type : "";
|
|
403
|
+
j !== z && N.push({
|
|
404
404
|
nodeId: h,
|
|
405
|
-
fieldName:
|
|
406
|
-
from:
|
|
407
|
-
to:
|
|
405
|
+
fieldName: S,
|
|
406
|
+
from: j,
|
|
407
|
+
to: z
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
|
-
const
|
|
412
|
-
for (const f of d)
|
|
411
|
+
const T = /* @__PURE__ */ new Set();
|
|
412
|
+
for (const f of d) T.add(f.id);
|
|
413
413
|
const $ = /* @__PURE__ */ new Set();
|
|
414
|
-
for (const f of
|
|
415
|
-
const
|
|
414
|
+
for (const f of s) $.add(f.id);
|
|
415
|
+
const D = [], q = [];
|
|
416
416
|
for (const f of $)
|
|
417
|
-
|
|
418
|
-
for (const f of
|
|
417
|
+
T.has(f) || D.push(f);
|
|
418
|
+
for (const f of T)
|
|
419
419
|
$.has(f) || q.push(f);
|
|
420
|
-
|
|
420
|
+
v.sort(), b.sort(), l.sort((f, h) => f.from.localeCompare(h.from));
|
|
421
421
|
const L = (f) => `${f.nodeId}\0${f.fieldName}`;
|
|
422
|
-
return A.sort((f, h) => L(f).localeCompare(L(h))),
|
|
422
|
+
return A.sort((f, h) => L(f).localeCompare(L(h))), F.sort((f, h) => L(f).localeCompare(L(h))), E.sort((f, h) => {
|
|
423
423
|
const I = f.nodeId.localeCompare(h.nodeId);
|
|
424
424
|
return I !== 0 ? I : f.from.localeCompare(h.from);
|
|
425
|
-
}), N.sort((f, h) => L(f).localeCompare(L(h))),
|
|
426
|
-
addedNodes:
|
|
427
|
-
removedNodes:
|
|
425
|
+
}), N.sort((f, h) => L(f).localeCompare(L(h))), D.sort(), q.sort(), {
|
|
426
|
+
addedNodes: v,
|
|
427
|
+
removedNodes: b,
|
|
428
428
|
renamedNodes: l,
|
|
429
429
|
addedFields: A,
|
|
430
|
-
removedFields:
|
|
431
|
-
renamedFields:
|
|
430
|
+
removedFields: F,
|
|
431
|
+
renamedFields: E,
|
|
432
432
|
changedFieldTypes: N,
|
|
433
|
-
addedEdges:
|
|
433
|
+
addedEdges: D,
|
|
434
434
|
removedEdges: q
|
|
435
435
|
};
|
|
436
436
|
}
|
|
437
|
-
const
|
|
437
|
+
const xe = {
|
|
438
438
|
rankdir: "LR",
|
|
439
439
|
nodeShape: "plaintext",
|
|
440
440
|
includeFieldTypes: !0,
|
|
441
441
|
includeFieldKeys: !0,
|
|
442
442
|
graphName: "schema"
|
|
443
443
|
};
|
|
444
|
-
function
|
|
444
|
+
function Y(e) {
|
|
445
445
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function H(e) {
|
|
448
448
|
return e.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
449
449
|
}
|
|
450
|
-
function
|
|
451
|
-
const r = String(e?.id ?? ""),
|
|
452
|
-
|
|
453
|
-
` <TR><TD BGCOLOR="#f0f0f0" COLSPAN="${d}"><B>${
|
|
450
|
+
function Te(e, t) {
|
|
451
|
+
const r = String(e?.id ?? ""), n = String(e?.data?.label ?? ""), i = Array.isArray(e?.data?.fields) ? e.data.fields : [], d = 1 + (t.includeFieldKeys ? 1 : 0) + (t.includeFieldTypes ? 1 : 0), s = [];
|
|
452
|
+
s.push(
|
|
453
|
+
` <TR><TD BGCOLOR="#f0f0f0" COLSPAN="${d}"><B>${Y(n)}</B></TD></TR>`
|
|
454
454
|
);
|
|
455
|
-
for (const
|
|
456
|
-
const
|
|
455
|
+
for (const c of i) {
|
|
456
|
+
const o = String(c?.name ?? ""), a = [];
|
|
457
457
|
if (t.includeFieldKeys) {
|
|
458
|
-
const u =
|
|
459
|
-
|
|
458
|
+
const u = c?.key === "primary" ? "PK" : c?.key === "foreign" ? "FK" : "";
|
|
459
|
+
a.push(`<TD>${u}</TD>`);
|
|
460
460
|
}
|
|
461
|
-
|
|
461
|
+
a.push(`<TD PORT="${Y(o)}">${Y(o)}</TD>`), t.includeFieldTypes && a.push(`<TD>${Y(String(c?.type ?? ""))}</TD>`), s.push(` <TR>${a.join("")}</TR>`);
|
|
462
462
|
}
|
|
463
|
-
return ` "${
|
|
463
|
+
return ` "${H(r)}" [label=<
|
|
464
464
|
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
|
|
465
|
-
${
|
|
465
|
+
${s.join(`
|
|
466
466
|
`)}
|
|
467
467
|
</TABLE>
|
|
468
468
|
>];`;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
const t = `"${
|
|
472
|
-
return ` ${t}${
|
|
470
|
+
function _e(e) {
|
|
471
|
+
const t = `"${H(String(e?.source ?? ""))}"`, r = `"${H(String(e?.target ?? ""))}"`, n = e?.sourceHandle ? `:"${H(String(e.sourceHandle))}"` : "", i = e?.targetHandle ? `:"${H(String(e.targetHandle))}"` : "", d = e?.label ? ` [label="${H(String(e.label))}"]` : "";
|
|
472
|
+
return ` ${t}${n} -> ${r}${i}${d};`;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
475
|
-
const r = { ...
|
|
476
|
-
|
|
477
|
-
for (const
|
|
478
|
-
|
|
479
|
-
for (const
|
|
480
|
-
|
|
481
|
-
return
|
|
474
|
+
function De(e, t = {}) {
|
|
475
|
+
const r = { ...xe, ...t }, n = [];
|
|
476
|
+
n.push(`digraph "${H(r.graphName)}" {`), n.push(` rankdir=${r.rankdir};`), n.push(` node [shape=${r.nodeShape}];`);
|
|
477
|
+
for (const i of e?.nodes ?? [])
|
|
478
|
+
n.push(Te(i, r));
|
|
479
|
+
for (const i of e?.edges ?? [])
|
|
480
|
+
n.push(_e(i));
|
|
481
|
+
return n.push("}"), n.join(`
|
|
482
482
|
`);
|
|
483
483
|
}
|
|
484
|
-
const
|
|
485
|
-
async function
|
|
486
|
-
const r = t.direction ?? "LR",
|
|
484
|
+
const ke = ["dagre", "tree", "grid"];
|
|
485
|
+
async function $e(e, t = {}) {
|
|
486
|
+
const r = t.direction ?? "LR", n = t.nodeSpacing ?? 80, i = t.rankSpacing ?? 160, d = Me(t.algorithm), s = t.deriveFromReferences ? He(e) : null;
|
|
487
487
|
try {
|
|
488
|
-
for (const
|
|
489
|
-
if (
|
|
488
|
+
for (const c of d) {
|
|
489
|
+
if (c === "dagre" && Oe(e, r, n, i) || c === "tree" && qe(e, r, n, i))
|
|
490
490
|
return;
|
|
491
|
-
if (
|
|
492
|
-
|
|
491
|
+
if (c === "grid") {
|
|
492
|
+
Pe(e.nodes ?? [], n, i, r);
|
|
493
493
|
return;
|
|
494
494
|
}
|
|
495
495
|
}
|
|
@@ -497,151 +497,151 @@ async function Fe(e, t = {}) {
|
|
|
497
497
|
'[alpineflow/schema] schemaLayout: no layout algorithm available. Register @getartisanflow/alpineflow/dagre (or hierarchy), or pass { algorithm: "grid" } for the always-available fallback.'
|
|
498
498
|
);
|
|
499
499
|
} finally {
|
|
500
|
-
|
|
500
|
+
s && s.restore();
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
function
|
|
504
|
-
return e ? [e] : [...
|
|
503
|
+
function Me(e) {
|
|
504
|
+
return e ? [e] : [...ke];
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function He(e) {
|
|
507
507
|
const t = e.edges;
|
|
508
508
|
if (!Array.isArray(t))
|
|
509
509
|
return null;
|
|
510
|
-
const r = t.slice(),
|
|
510
|
+
const r = t.slice(), n = me(e.nodes ?? []).map((i, d) => ({
|
|
511
511
|
id: `schema-layout-inferred-${d}`,
|
|
512
|
-
source:
|
|
513
|
-
target:
|
|
514
|
-
sourceHandle:
|
|
515
|
-
targetHandle:
|
|
512
|
+
source: i.fromNodeId,
|
|
513
|
+
target: i.toNodeId,
|
|
514
|
+
sourceHandle: i.fromFieldName,
|
|
515
|
+
targetHandle: i.toFieldName
|
|
516
516
|
}));
|
|
517
|
-
return t.splice(0, t.length, ...
|
|
517
|
+
return t.splice(0, t.length, ...n), {
|
|
518
518
|
restore: () => {
|
|
519
519
|
t.splice(0, t.length, ...r);
|
|
520
520
|
}
|
|
521
521
|
};
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function Oe(e, t, r, n) {
|
|
524
524
|
if (typeof e.layout != "function")
|
|
525
525
|
return !1;
|
|
526
526
|
try {
|
|
527
527
|
return e.layout({
|
|
528
528
|
direction: t,
|
|
529
529
|
nodesep: r,
|
|
530
|
-
ranksep:
|
|
530
|
+
ranksep: n
|
|
531
531
|
}), !0;
|
|
532
532
|
} catch {
|
|
533
533
|
return !1;
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function qe(e, t, r, n) {
|
|
537
537
|
if (typeof e.treeLayout != "function")
|
|
538
538
|
return !1;
|
|
539
539
|
try {
|
|
540
540
|
return e.treeLayout({
|
|
541
541
|
direction: t,
|
|
542
542
|
nodeWidth: r + 200,
|
|
543
|
-
nodeHeight:
|
|
543
|
+
nodeHeight: n + 80
|
|
544
544
|
}), !0;
|
|
545
545
|
} catch {
|
|
546
546
|
return !1;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
function
|
|
550
|
-
const
|
|
551
|
-
if (
|
|
549
|
+
function Pe(e, t, r, n) {
|
|
550
|
+
const i = e.length;
|
|
551
|
+
if (i === 0)
|
|
552
552
|
return;
|
|
553
|
-
const d = Math.max(1, Math.ceil(Math.sqrt(
|
|
554
|
-
for (let
|
|
555
|
-
const u =
|
|
556
|
-
let
|
|
557
|
-
|
|
553
|
+
const d = Math.max(1, Math.ceil(Math.sqrt(i))), s = Math.ceil(i / d), c = t + 300, o = r + 200;
|
|
554
|
+
for (let a = 0; a < i; a++) {
|
|
555
|
+
const u = a % d, l = Math.floor(a / d);
|
|
556
|
+
let m = u * c, g = l * o;
|
|
557
|
+
n === "BT" ? g = (s - 1 - l) * o : n === "RL" && (m = (d - 1 - u) * c), e[a].position = { x: m, y: g };
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
const
|
|
560
|
+
const ae = [
|
|
561
561
|
"schema:field-added",
|
|
562
562
|
"schema:field-renamed",
|
|
563
563
|
"schema:field-removed",
|
|
564
564
|
"schema:edges-cascaded"
|
|
565
565
|
];
|
|
566
|
-
function
|
|
567
|
-
const r = Math.max(1, t.limit ?? 50),
|
|
568
|
-
let d = 0,
|
|
569
|
-
const
|
|
570
|
-
if (!
|
|
571
|
-
return
|
|
566
|
+
function ct(e, t = {}) {
|
|
567
|
+
const r = Math.max(1, t.limit ?? 50), n = [], i = [];
|
|
568
|
+
let d = 0, s = 0, c = null, o = !1;
|
|
569
|
+
const a = e?.el ?? e?._container ?? null;
|
|
570
|
+
if (!a || typeof a.addEventListener != "function")
|
|
571
|
+
return Be();
|
|
572
572
|
const u = () => {
|
|
573
|
-
for (;
|
|
574
|
-
|
|
575
|
-
}, l = (
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
},
|
|
579
|
-
|
|
573
|
+
for (; n.length > r && n.length > 1; )
|
|
574
|
+
n.shift();
|
|
575
|
+
}, l = (p) => {
|
|
576
|
+
const y = n[n.length - 1];
|
|
577
|
+
y !== void 0 && JSON.stringify(y) === JSON.stringify(p) || (n.push(p), u(), i.length = 0);
|
|
578
|
+
}, m = () => {
|
|
579
|
+
o || d > 0 || s > 0 || l(K(e));
|
|
580
580
|
};
|
|
581
|
-
|
|
582
|
-
const
|
|
583
|
-
|
|
581
|
+
n.push(K(e));
|
|
582
|
+
const g = () => {
|
|
583
|
+
m();
|
|
584
584
|
};
|
|
585
|
-
for (const
|
|
586
|
-
|
|
587
|
-
const
|
|
585
|
+
for (const p of ae)
|
|
586
|
+
a.addEventListener(p, g);
|
|
587
|
+
const v = (p) => {
|
|
588
588
|
d++;
|
|
589
589
|
try {
|
|
590
|
-
|
|
590
|
+
ge(e, p);
|
|
591
591
|
} finally {
|
|
592
592
|
d--;
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
595
|
return {
|
|
596
596
|
get canUndo() {
|
|
597
|
-
return
|
|
597
|
+
return n.length > 1;
|
|
598
598
|
},
|
|
599
599
|
get canRedo() {
|
|
600
|
-
return
|
|
600
|
+
return i.length > 0;
|
|
601
601
|
},
|
|
602
602
|
undo() {
|
|
603
|
-
if (
|
|
603
|
+
if (o || n.length <= 1)
|
|
604
604
|
return !1;
|
|
605
|
-
const
|
|
606
|
-
|
|
607
|
-
const
|
|
608
|
-
return
|
|
605
|
+
const p = n.pop();
|
|
606
|
+
i.push(p);
|
|
607
|
+
const y = n[n.length - 1];
|
|
608
|
+
return v(y), !0;
|
|
609
609
|
},
|
|
610
610
|
redo() {
|
|
611
|
-
if (
|
|
611
|
+
if (o || i.length === 0)
|
|
612
612
|
return !1;
|
|
613
|
-
const
|
|
614
|
-
return
|
|
613
|
+
const p = i.pop();
|
|
614
|
+
return n.push(p), v(p), !0;
|
|
615
615
|
},
|
|
616
616
|
clear() {
|
|
617
|
-
|
|
617
|
+
n.length = 0, i.length = 0, o || n.push(K(e));
|
|
618
618
|
},
|
|
619
|
-
batch(
|
|
620
|
-
if (
|
|
621
|
-
return
|
|
622
|
-
|
|
619
|
+
batch(p) {
|
|
620
|
+
if (o)
|
|
621
|
+
return p();
|
|
622
|
+
s === 0 && (c = K(e)), s++;
|
|
623
623
|
try {
|
|
624
|
-
const
|
|
625
|
-
return
|
|
626
|
-
} catch (
|
|
627
|
-
if (
|
|
628
|
-
const
|
|
629
|
-
|
|
624
|
+
const y = p();
|
|
625
|
+
return s--, s === 0 && (c = null, d === 0 && !o && l(K(e))), y;
|
|
626
|
+
} catch (y) {
|
|
627
|
+
if (s--, s === 0) {
|
|
628
|
+
const w = c;
|
|
629
|
+
c = null, w && !o && v(w);
|
|
630
630
|
}
|
|
631
|
-
throw
|
|
631
|
+
throw y;
|
|
632
632
|
}
|
|
633
633
|
},
|
|
634
634
|
dispose() {
|
|
635
|
-
if (!
|
|
636
|
-
|
|
637
|
-
for (const
|
|
638
|
-
|
|
639
|
-
|
|
635
|
+
if (!o) {
|
|
636
|
+
o = !0;
|
|
637
|
+
for (const p of ae)
|
|
638
|
+
a.removeEventListener(p, g);
|
|
639
|
+
n.length = 0, i.length = 0, c = null;
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
};
|
|
643
643
|
}
|
|
644
|
-
function
|
|
644
|
+
function Be() {
|
|
645
645
|
return {
|
|
646
646
|
get canUndo() {
|
|
647
647
|
return !1;
|
|
@@ -660,7 +660,113 @@ function He() {
|
|
|
660
660
|
}
|
|
661
661
|
};
|
|
662
662
|
}
|
|
663
|
-
|
|
663
|
+
const Ke = {
|
|
664
|
+
"controls.label": "Flow controls",
|
|
665
|
+
"controls.zoomIn": "Zoom in",
|
|
666
|
+
"controls.zoomOut": "Zoom out",
|
|
667
|
+
"controls.fitView": "Fit view",
|
|
668
|
+
"controls.toggleInteractive": "Toggle interactivity",
|
|
669
|
+
"controls.lockInteractive": "Lock interactivity",
|
|
670
|
+
"controls.unlockInteractive": "Unlock interactivity",
|
|
671
|
+
"controls.resetPanels": "Reset panels",
|
|
672
|
+
"controls.toggleFullscreen": "Toggle fullscreen",
|
|
673
|
+
"controls.enterFullscreen": "Enter fullscreen",
|
|
674
|
+
"controls.exitFullscreen": "Exit fullscreen",
|
|
675
|
+
"canvas.label": "Flow diagram",
|
|
676
|
+
"canvas.loading": "Loading…",
|
|
677
|
+
"canvas.selectionMode": "Selection Mode — tap with two fingers to exit",
|
|
678
|
+
"a11y.nodeLabel": "Node: :label",
|
|
679
|
+
"a11y.nodeId": "Node :id",
|
|
680
|
+
"a11y.edgeLabel": "Edge: :label",
|
|
681
|
+
"a11y.edgeEndpoints": "Edge from :source to :target",
|
|
682
|
+
"a11y.sourceHandle": "source handle :id",
|
|
683
|
+
"a11y.targetHandle": "target handle :id",
|
|
684
|
+
"a11y.addControlPoint": "Double-click to add control point",
|
|
685
|
+
"announce.nodeAdded": "Added node: :label",
|
|
686
|
+
"announce.nodesAdded_one": "Added :count node",
|
|
687
|
+
"announce.nodesAdded_other": "Added :count nodes",
|
|
688
|
+
"announce.nodeRemoved": "Removed node: :label",
|
|
689
|
+
"announce.nodesRemoved_one": "Removed :count node",
|
|
690
|
+
"announce.nodesRemoved_other": "Removed :count nodes",
|
|
691
|
+
"announce.connected": "Connected :source to :target",
|
|
692
|
+
"announce.connectionsAdded_one": "Added :count connection",
|
|
693
|
+
"announce.connectionsAdded_other": "Added :count connections",
|
|
694
|
+
"announce.disconnected": "Removed connection from :source to :target",
|
|
695
|
+
"announce.connectionsRemoved_one": "Removed :count connection",
|
|
696
|
+
"announce.connectionsRemoved_other": "Removed :count connections",
|
|
697
|
+
"announce.selectionCleared": "Selection cleared",
|
|
698
|
+
"announce.nodesSelected_one": ":count node",
|
|
699
|
+
"announce.nodesSelected_other": ":count nodes",
|
|
700
|
+
"announce.edgesSelected_one": ":count edge",
|
|
701
|
+
"announce.edgesSelected_other": ":count edges",
|
|
702
|
+
"announce.selectionJoin": ":nodes and :edges",
|
|
703
|
+
"announce.selected": ":items selected",
|
|
704
|
+
"announce.viewportZoom": "Viewport: zoom :percent%",
|
|
705
|
+
"announce.viewFitted": "Fitted view to content",
|
|
706
|
+
"announce.node": "node",
|
|
707
|
+
"announce.reparented": "Moved :name into :parent",
|
|
708
|
+
"announce.detached": "Detached :name from :parent",
|
|
709
|
+
"workflow.condition": "Condition",
|
|
710
|
+
"workflow.customEvaluator": "[custom evaluator]",
|
|
711
|
+
"workflow.wait": "Wait",
|
|
712
|
+
"schema.inspector.noNode": "No node selected.",
|
|
713
|
+
"schema.inspector.noEdge": "No edge selected.",
|
|
714
|
+
"schema.inspector.noRow": "No row selected.",
|
|
715
|
+
"schema.inspector.missingRow": "Selected row no longer exists.",
|
|
716
|
+
"schema.inspector.label": "label",
|
|
717
|
+
"schema.inspector.name": "name",
|
|
718
|
+
"schema.inspector.type": "type",
|
|
719
|
+
"schema.inspector.required": "required",
|
|
720
|
+
"schema.inspector.remove": "remove",
|
|
721
|
+
"schema.inspector.delete": "delete",
|
|
722
|
+
"schema.inspector.add": "add",
|
|
723
|
+
"schema.inspector.fieldName": "field name"
|
|
724
|
+
}, Ue = Ke, G = "en", le = /* @__PURE__ */ new Map();
|
|
725
|
+
function Q(e) {
|
|
726
|
+
const r = e.trim().replace(/_/g, "-") || G;
|
|
727
|
+
let n = le.get(r);
|
|
728
|
+
if (!n) {
|
|
729
|
+
try {
|
|
730
|
+
n = new Intl.PluralRules(r);
|
|
731
|
+
} catch {
|
|
732
|
+
n = Q(G);
|
|
733
|
+
}
|
|
734
|
+
le.set(r, n);
|
|
735
|
+
}
|
|
736
|
+
return n;
|
|
737
|
+
}
|
|
738
|
+
function U(e) {
|
|
739
|
+
return typeof e == "string" && e !== "" ? e : void 0;
|
|
740
|
+
}
|
|
741
|
+
function fe(e, t, r, n) {
|
|
742
|
+
return r === void 0 ? U(e[t]) ?? U(e[`${t}_other`]) : U(e[`${t}_${n.select(r)}`]) ?? U(e[`${t}_other`]) ?? U(e[t]);
|
|
743
|
+
}
|
|
744
|
+
const ue = /* @__PURE__ */ new Map();
|
|
745
|
+
function Je(e, t) {
|
|
746
|
+
const r = Object.keys(t).sort((d, s) => s.length - d.length);
|
|
747
|
+
if (r.length === 0) return e;
|
|
748
|
+
const n = r.join("\0");
|
|
749
|
+
let i = ue.get(n);
|
|
750
|
+
return i || (i = new RegExp(`:(${r.map((d) => d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`, "g"), ue.set(n, i)), e.replace(i, (d, s) => String(t[s]));
|
|
751
|
+
}
|
|
752
|
+
function je(e, t) {
|
|
753
|
+
const r = {};
|
|
754
|
+
for (const [d, s] of Object.entries({})) {
|
|
755
|
+
const c = U(s);
|
|
756
|
+
c !== void 0 && (r[d] = c);
|
|
757
|
+
}
|
|
758
|
+
const n = Q(t), i = Q(G);
|
|
759
|
+
return (d, s = {}) => {
|
|
760
|
+
const c = typeof s.count == "number" ? s.count : void 0, o = fe(r, d, c, n) ?? fe(Ue, d, c, i) ?? d;
|
|
761
|
+
return Je(o, s);
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
const ze = je(void 0, G);
|
|
765
|
+
function ee(e) {
|
|
766
|
+
const t = e;
|
|
767
|
+
return typeof t?.t != "function" ? ze : (r, n) => t.t(r, n);
|
|
768
|
+
}
|
|
769
|
+
function k(e) {
|
|
664
770
|
if (!e || e.size === 0)
|
|
665
771
|
return null;
|
|
666
772
|
let t = null;
|
|
@@ -668,43 +774,43 @@ function H(e) {
|
|
|
668
774
|
t = r;
|
|
669
775
|
return t;
|
|
670
776
|
}
|
|
671
|
-
function
|
|
777
|
+
function We(e) {
|
|
672
778
|
if (!e)
|
|
673
779
|
return null;
|
|
674
780
|
const t = e.indexOf(".");
|
|
675
781
|
return t < 1 || t === e.length - 1 ? null : { nodeId: e.slice(0, t), fieldName: e.slice(t + 1) };
|
|
676
782
|
}
|
|
677
|
-
function
|
|
783
|
+
function te(e, t) {
|
|
678
784
|
const r = t.closest(".flow-container");
|
|
679
785
|
if (r)
|
|
680
786
|
try {
|
|
681
787
|
return e.$data(r) ?? null;
|
|
682
788
|
} catch {
|
|
683
789
|
}
|
|
684
|
-
const
|
|
685
|
-
if (
|
|
790
|
+
const n = document.querySelectorAll(".flow-container");
|
|
791
|
+
if (n.length === 1)
|
|
686
792
|
try {
|
|
687
|
-
return e.$data(
|
|
793
|
+
return e.$data(n[0]) ?? null;
|
|
688
794
|
} catch {
|
|
689
795
|
}
|
|
690
|
-
return
|
|
796
|
+
return n.length > 1 && !window.__alpineflowSchemaMultiCanvasWarned && (window.__alpineflowSchemaMultiCanvasWarned = !0, console.warn(
|
|
691
797
|
"[alpineflow/schema] inspector directive found multiple .flow-container elements on the page; place inspector inside the canvas OR scope the directive expression to a specific canvas (multi-canvas scope selector is on the v0.2.2 roadmap)."
|
|
692
798
|
)), null;
|
|
693
799
|
}
|
|
694
|
-
function
|
|
800
|
+
function ne(e) {
|
|
695
801
|
return e.querySelector(
|
|
696
802
|
":scope > template[x-schema-default-ui]"
|
|
697
803
|
);
|
|
698
804
|
}
|
|
699
|
-
function
|
|
805
|
+
function J(e) {
|
|
700
806
|
const t = e.querySelector(":scope > [data-schema-default-ui-root]");
|
|
701
807
|
t && t.remove();
|
|
702
808
|
}
|
|
703
|
-
function
|
|
809
|
+
function oe(e) {
|
|
704
810
|
const t = document.createElement("div");
|
|
705
811
|
return t.setAttribute("data-schema-default-ui-root", ""), e.appendChild(t), t;
|
|
706
812
|
}
|
|
707
|
-
function
|
|
813
|
+
function re(e) {
|
|
708
814
|
if (!e)
|
|
709
815
|
return null;
|
|
710
816
|
const t = document.activeElement;
|
|
@@ -713,27 +819,27 @@ function ee(e) {
|
|
|
713
819
|
const r = t.getAttribute("data-field");
|
|
714
820
|
if (!r)
|
|
715
821
|
return null;
|
|
716
|
-
let
|
|
822
|
+
let n = null, i = null;
|
|
717
823
|
if (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement)
|
|
718
824
|
try {
|
|
719
|
-
|
|
825
|
+
n = t.selectionStart, i = t.selectionEnd;
|
|
720
826
|
} catch {
|
|
721
827
|
}
|
|
722
828
|
return {
|
|
723
829
|
field: r,
|
|
724
830
|
tagName: t.tagName.toLowerCase(),
|
|
725
|
-
selectionStart:
|
|
726
|
-
selectionEnd:
|
|
831
|
+
selectionStart: n,
|
|
832
|
+
selectionEnd: i
|
|
727
833
|
};
|
|
728
834
|
}
|
|
729
|
-
function
|
|
835
|
+
function Ye(e) {
|
|
730
836
|
return typeof globalThis.CSS < "u" && typeof globalThis.CSS.escape == "function" ? globalThis.CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
|
|
731
837
|
}
|
|
732
838
|
function O(e, t) {
|
|
733
839
|
if (!e || !t)
|
|
734
840
|
return;
|
|
735
841
|
const r = e.querySelector(
|
|
736
|
-
`[data-field="${
|
|
842
|
+
`[data-field="${Ye(t.field)}"]`
|
|
737
843
|
);
|
|
738
844
|
if (r && r.tagName.toLowerCase() === t.tagName)
|
|
739
845
|
try {
|
|
@@ -741,140 +847,140 @@ function O(e, t) {
|
|
|
741
847
|
} catch {
|
|
742
848
|
}
|
|
743
849
|
}
|
|
744
|
-
function
|
|
850
|
+
function Ge(e) {
|
|
745
851
|
e.directive(
|
|
746
852
|
"schema-node-inspector",
|
|
747
|
-
(t, r, { effect:
|
|
748
|
-
const d = t,
|
|
749
|
-
if (!
|
|
853
|
+
(t, r, { effect: n, cleanup: i }) => {
|
|
854
|
+
const d = t, s = te(e, d);
|
|
855
|
+
if (!s)
|
|
750
856
|
return;
|
|
751
|
-
const
|
|
857
|
+
const c = ne(d), o = {
|
|
752
858
|
addField(u) {
|
|
753
|
-
const l =
|
|
754
|
-
return l ?
|
|
859
|
+
const l = k(s.selectedNodes);
|
|
860
|
+
return l ? s.addField?.(l, u) ?? { applied: !1, reason: "no-helper" } : { applied: !1, reason: "no-selection" };
|
|
755
861
|
},
|
|
756
862
|
renameField(u, l) {
|
|
757
|
-
const
|
|
758
|
-
return
|
|
863
|
+
const m = k(s.selectedNodes);
|
|
864
|
+
return m ? s.renameField?.(m, u, l) ?? {
|
|
759
865
|
applied: !1,
|
|
760
866
|
reason: "no-helper",
|
|
761
867
|
cascadedEdgeIds: []
|
|
762
868
|
} : { applied: !1, reason: "no-selection", cascadedEdgeIds: [] };
|
|
763
869
|
},
|
|
764
870
|
removeField(u) {
|
|
765
|
-
const l =
|
|
766
|
-
return l ?
|
|
871
|
+
const l = k(s.selectedNodes);
|
|
872
|
+
return l ? s.removeField?.(l, u) ?? {
|
|
767
873
|
applied: !1,
|
|
768
874
|
reason: "no-helper",
|
|
769
875
|
droppedEdgeIds: []
|
|
770
876
|
} : { applied: !1, reason: "no-selection", droppedEdgeIds: [] };
|
|
771
877
|
},
|
|
772
878
|
reorderFields(u) {
|
|
773
|
-
const l =
|
|
774
|
-
return l ?
|
|
879
|
+
const l = k(s.selectedNodes);
|
|
880
|
+
return l ? s.reorderFields?.(l, u) ?? {
|
|
775
881
|
applied: !1,
|
|
776
882
|
reason: "no-helper"
|
|
777
883
|
} : { applied: !1, reason: "no-selection" };
|
|
778
884
|
}
|
|
779
|
-
},
|
|
780
|
-
inspector:
|
|
885
|
+
}, a = e.addScopeToNode(d, {
|
|
886
|
+
inspector: o,
|
|
781
887
|
get selectedNode() {
|
|
782
|
-
const u =
|
|
783
|
-
return u ?
|
|
888
|
+
const u = k(s.selectedNodes);
|
|
889
|
+
return u ? s.nodes?.find((l) => l.id === u) ?? null : null;
|
|
784
890
|
}
|
|
785
891
|
});
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
}),
|
|
789
|
-
|
|
892
|
+
c && n(() => {
|
|
893
|
+
Ve(d, s);
|
|
894
|
+
}), i(() => {
|
|
895
|
+
J(d), a?.();
|
|
790
896
|
});
|
|
791
897
|
}
|
|
792
898
|
);
|
|
793
899
|
}
|
|
794
|
-
function
|
|
795
|
-
const r = e.querySelector(
|
|
900
|
+
function Ve(e, t) {
|
|
901
|
+
const r = ee(t), n = e.querySelector(
|
|
796
902
|
":scope > [data-schema-default-ui-root]"
|
|
797
|
-
),
|
|
798
|
-
|
|
799
|
-
const
|
|
800
|
-
if (!
|
|
801
|
-
const
|
|
802
|
-
|
|
903
|
+
), i = re(n);
|
|
904
|
+
J(e);
|
|
905
|
+
const d = oe(e), s = k(t.selectedNodes), c = s ? t.nodes?.find((p) => p.id === s) : null;
|
|
906
|
+
if (!c) {
|
|
907
|
+
const p = document.createElement("div");
|
|
908
|
+
p.setAttribute("data-schema-inspector-empty", ""), p.textContent = r("schema.inspector.noNode"), d.appendChild(p), O(d, i);
|
|
803
909
|
return;
|
|
804
910
|
}
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
const
|
|
810
|
-
for (const
|
|
911
|
+
const o = document.createElement("header");
|
|
912
|
+
o.setAttribute("data-schema-inspector-label", ""), o.textContent = String(c.data?.label ?? c.id), d.appendChild(o);
|
|
913
|
+
const a = document.createElement("ul");
|
|
914
|
+
a.setAttribute("data-schema-inspector-fields", "");
|
|
915
|
+
const u = Array.isArray(c.data?.fields) ? c.data.fields : [];
|
|
916
|
+
for (const p of u) {
|
|
811
917
|
const y = document.createElement("li");
|
|
812
|
-
y.setAttribute("data-schema-inspector-field", ""), y.dataset.fieldName = String(
|
|
813
|
-
const
|
|
814
|
-
if (
|
|
815
|
-
const
|
|
816
|
-
|
|
918
|
+
y.setAttribute("data-schema-inspector-field", ""), y.dataset.fieldName = String(p?.name ?? "");
|
|
919
|
+
const w = document.createElement("span");
|
|
920
|
+
if (w.textContent = String(p?.name ?? ""), y.appendChild(w), p?.type) {
|
|
921
|
+
const A = document.createElement("span");
|
|
922
|
+
A.setAttribute("data-field-type", ""), A.textContent = String(p.type), y.appendChild(A);
|
|
817
923
|
}
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
t.removeField?.(
|
|
821
|
-
}), y.appendChild(
|
|
924
|
+
const E = document.createElement("button");
|
|
925
|
+
E.type = "button", E.setAttribute("data-action", "remove"), E.textContent = r("schema.inspector.remove"), E.addEventListener("click", () => {
|
|
926
|
+
t.removeField?.(c.id, p.name);
|
|
927
|
+
}), y.appendChild(E), a.appendChild(y);
|
|
822
928
|
}
|
|
823
|
-
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
let
|
|
830
|
-
if (
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
for (const y of
|
|
834
|
-
const
|
|
835
|
-
|
|
929
|
+
d.appendChild(a);
|
|
930
|
+
const l = document.createElement("form");
|
|
931
|
+
l.setAttribute("data-schema-inspector-add-field", "");
|
|
932
|
+
const m = document.createElement("input");
|
|
933
|
+
m.setAttribute("data-field", "name"), m.placeholder = r("schema.inspector.fieldName"), l.appendChild(m);
|
|
934
|
+
const g = Array.isArray(t._config?.fieldTypeRegistry) ? t._config.fieldTypeRegistry : null;
|
|
935
|
+
let v;
|
|
936
|
+
if (g && g.length > 0) {
|
|
937
|
+
const p = document.createElement("select");
|
|
938
|
+
p.setAttribute("data-field", "type");
|
|
939
|
+
for (const y of g) {
|
|
940
|
+
const w = document.createElement("option");
|
|
941
|
+
w.value = y, w.textContent = y, p.appendChild(w);
|
|
836
942
|
}
|
|
837
|
-
|
|
943
|
+
p.value = g[0], v = p;
|
|
838
944
|
} else {
|
|
839
|
-
const
|
|
840
|
-
|
|
945
|
+
const p = document.createElement("input");
|
|
946
|
+
p.setAttribute("data-field", "type"), p.placeholder = r("schema.inspector.type"), p.value = "text", v = p;
|
|
841
947
|
}
|
|
842
|
-
|
|
948
|
+
l.appendChild(v);
|
|
843
949
|
const b = document.createElement("button");
|
|
844
|
-
b.type = "submit", b.textContent = "add",
|
|
845
|
-
|
|
846
|
-
const y =
|
|
950
|
+
b.type = "submit", b.textContent = r("schema.inspector.add"), l.appendChild(b), l.addEventListener("submit", (p) => {
|
|
951
|
+
p.preventDefault();
|
|
952
|
+
const y = m.value.trim();
|
|
847
953
|
if (!y)
|
|
848
954
|
return;
|
|
849
|
-
const
|
|
850
|
-
t.addField?.(
|
|
851
|
-
}),
|
|
955
|
+
const w = v.value, E = (typeof w == "string" ? w.trim() : "") || "text";
|
|
956
|
+
t.addField?.(c.id, { name: y, type: E })?.applied && (m.value = "");
|
|
957
|
+
}), d.appendChild(l), O(d, i);
|
|
852
958
|
}
|
|
853
|
-
function
|
|
959
|
+
function Ze(e) {
|
|
854
960
|
e.directive(
|
|
855
961
|
"schema-row-inspector",
|
|
856
|
-
(t, r, { effect:
|
|
857
|
-
const d = t,
|
|
858
|
-
if (!
|
|
962
|
+
(t, r, { effect: n, cleanup: i }) => {
|
|
963
|
+
const d = t, s = te(e, d);
|
|
964
|
+
if (!s)
|
|
859
965
|
return;
|
|
860
|
-
const
|
|
861
|
-
const
|
|
862
|
-
if (!
|
|
966
|
+
const c = ne(d), o = () => We(k(s.selectedRows)), a = () => {
|
|
967
|
+
const m = o();
|
|
968
|
+
if (!m)
|
|
863
969
|
return null;
|
|
864
|
-
const
|
|
865
|
-
return
|
|
970
|
+
const g = s.nodes?.find((b) => b.id === m.nodeId);
|
|
971
|
+
return g ? (g.data?.fields ?? []).find((b) => b?.name === m.fieldName) ?? null : null;
|
|
866
972
|
}, u = {
|
|
867
|
-
renameField(
|
|
868
|
-
const
|
|
869
|
-
return
|
|
973
|
+
renameField(m) {
|
|
974
|
+
const g = o();
|
|
975
|
+
return g ? s.renameField?.(g.nodeId, g.fieldName, m) ?? {
|
|
870
976
|
applied: !1,
|
|
871
977
|
reason: "no-helper",
|
|
872
978
|
cascadedEdgeIds: []
|
|
873
979
|
} : { applied: !1, reason: "no-selection", cascadedEdgeIds: [] };
|
|
874
980
|
},
|
|
875
981
|
removeField() {
|
|
876
|
-
const
|
|
877
|
-
return
|
|
982
|
+
const m = o();
|
|
983
|
+
return m ? s.removeField?.(m.nodeId, m.fieldName) ?? {
|
|
878
984
|
applied: !1,
|
|
879
985
|
reason: "no-helper",
|
|
880
986
|
droppedEdgeIds: []
|
|
@@ -885,209 +991,209 @@ function qe(e) {
|
|
|
885
991
|
* field in place. For name changes, use `renameField` so edges
|
|
886
992
|
* cascade correctly.
|
|
887
993
|
*/
|
|
888
|
-
updateField(
|
|
889
|
-
const
|
|
890
|
-
if (!
|
|
994
|
+
updateField(m) {
|
|
995
|
+
const g = a();
|
|
996
|
+
if (!g)
|
|
891
997
|
return { applied: !1, reason: "no-selection" };
|
|
892
|
-
for (const [
|
|
893
|
-
|
|
998
|
+
for (const [v, b] of Object.entries(m))
|
|
999
|
+
v !== "name" && (g[v] = b);
|
|
894
1000
|
return { applied: !0 };
|
|
895
1001
|
}
|
|
896
1002
|
}, l = e.addScopeToNode(d, {
|
|
897
1003
|
inspector: u,
|
|
898
1004
|
get selectedRow() {
|
|
899
|
-
return
|
|
1005
|
+
return o();
|
|
900
1006
|
}
|
|
901
1007
|
});
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
}),
|
|
905
|
-
|
|
1008
|
+
c && n(() => {
|
|
1009
|
+
Xe(d, s, o());
|
|
1010
|
+
}), i(() => {
|
|
1011
|
+
J(d), l?.();
|
|
906
1012
|
});
|
|
907
1013
|
}
|
|
908
1014
|
);
|
|
909
1015
|
}
|
|
910
|
-
function
|
|
911
|
-
const
|
|
1016
|
+
function Xe(e, t, r) {
|
|
1017
|
+
const n = ee(t), i = e.querySelector(
|
|
912
1018
|
":scope > [data-schema-default-ui-root]"
|
|
913
|
-
),
|
|
914
|
-
|
|
915
|
-
const
|
|
1019
|
+
), d = re(i);
|
|
1020
|
+
J(e);
|
|
1021
|
+
const s = oe(e);
|
|
916
1022
|
if (!r) {
|
|
917
|
-
const
|
|
918
|
-
|
|
1023
|
+
const p = document.createElement("div");
|
|
1024
|
+
p.setAttribute("data-schema-inspector-empty", ""), p.textContent = n("schema.inspector.noRow"), s.appendChild(p), O(s, d);
|
|
919
1025
|
return;
|
|
920
1026
|
}
|
|
921
|
-
const
|
|
922
|
-
if (!
|
|
923
|
-
const
|
|
924
|
-
|
|
1027
|
+
const o = t.nodes?.find((p) => p.id === r.nodeId)?.data?.fields?.find((p) => p?.name === r.fieldName) ?? null;
|
|
1028
|
+
if (!o) {
|
|
1029
|
+
const p = document.createElement("div");
|
|
1030
|
+
p.setAttribute("data-schema-inspector-empty", ""), p.textContent = n("schema.inspector.missingRow"), s.appendChild(p), O(s, d);
|
|
925
1031
|
return;
|
|
926
1032
|
}
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
const
|
|
932
|
-
!
|
|
933
|
-
}),
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
const l = document.createElement("input");
|
|
937
|
-
l.setAttribute("data-field", "type"), l.value = String(a.type ?? ""), l.addEventListener("change", () => {
|
|
938
|
-
a.type = l.value;
|
|
939
|
-
}), u.appendChild(l), d.appendChild(u);
|
|
940
|
-
const p = document.createElement("label");
|
|
941
|
-
p.textContent = "required ";
|
|
1033
|
+
const a = document.createElement("label");
|
|
1034
|
+
a.textContent = n("schema.inspector.name") + " ";
|
|
1035
|
+
const u = document.createElement("input");
|
|
1036
|
+
u.setAttribute("data-field", "name"), u.value = String(o.name ?? ""), u.addEventListener("change", () => {
|
|
1037
|
+
const p = u.value.trim();
|
|
1038
|
+
!p || p === o.name || t.renameField?.(r.nodeId, r.fieldName, p);
|
|
1039
|
+
}), a.appendChild(u), s.appendChild(a);
|
|
1040
|
+
const l = document.createElement("label");
|
|
1041
|
+
l.textContent = n("schema.inspector.type") + " ";
|
|
942
1042
|
const m = document.createElement("input");
|
|
943
|
-
m.
|
|
944
|
-
|
|
945
|
-
}),
|
|
1043
|
+
m.setAttribute("data-field", "type"), m.value = String(o.type ?? ""), m.addEventListener("change", () => {
|
|
1044
|
+
o.type = m.value;
|
|
1045
|
+
}), l.appendChild(m), s.appendChild(l);
|
|
1046
|
+
const g = document.createElement("label");
|
|
1047
|
+
g.textContent = n("schema.inspector.required") + " ";
|
|
1048
|
+
const v = document.createElement("input");
|
|
1049
|
+
v.type = "checkbox", v.setAttribute("data-field", "required"), v.checked = !!o.required, v.addEventListener("change", () => {
|
|
1050
|
+
o.required = v.checked;
|
|
1051
|
+
}), g.appendChild(v), s.appendChild(g);
|
|
946
1052
|
const b = document.createElement("button");
|
|
947
|
-
b.type = "button", b.setAttribute("data-action", "remove"), b.textContent = "remove", b.addEventListener("click", () => {
|
|
1053
|
+
b.type = "button", b.setAttribute("data-action", "remove"), b.textContent = n("schema.inspector.remove"), b.addEventListener("click", () => {
|
|
948
1054
|
t.removeField?.(r.nodeId, r.fieldName);
|
|
949
|
-
}),
|
|
1055
|
+
}), s.appendChild(b), O(s, d);
|
|
950
1056
|
}
|
|
951
|
-
function
|
|
1057
|
+
function Qe(e) {
|
|
952
1058
|
e.directive(
|
|
953
1059
|
"schema-edge-inspector",
|
|
954
|
-
(t, r, { effect:
|
|
955
|
-
const d = t,
|
|
956
|
-
if (!
|
|
1060
|
+
(t, r, { effect: n, cleanup: i }) => {
|
|
1061
|
+
const d = t, s = te(e, d);
|
|
1062
|
+
if (!s)
|
|
957
1063
|
return;
|
|
958
|
-
const
|
|
959
|
-
const l =
|
|
960
|
-
return l ?
|
|
961
|
-
},
|
|
1064
|
+
const c = ne(d), o = () => {
|
|
1065
|
+
const l = k(s.selectedEdges);
|
|
1066
|
+
return l ? s.edges?.find((m) => m.id === l) ?? null : null;
|
|
1067
|
+
}, a = {
|
|
962
1068
|
updateEdge(l) {
|
|
963
|
-
const
|
|
964
|
-
if (!
|
|
1069
|
+
const m = o();
|
|
1070
|
+
if (!m)
|
|
965
1071
|
return { applied: !1, reason: "no-selection" };
|
|
966
|
-
for (const [
|
|
967
|
-
|
|
1072
|
+
for (const [g, v] of Object.entries(l))
|
|
1073
|
+
m[g] = v;
|
|
968
1074
|
return { applied: !0 };
|
|
969
1075
|
},
|
|
970
1076
|
setLabel(l) {
|
|
971
1077
|
return this.updateEdge({ label: l });
|
|
972
1078
|
},
|
|
973
1079
|
removeEdge() {
|
|
974
|
-
const l =
|
|
1080
|
+
const l = o();
|
|
975
1081
|
if (!l)
|
|
976
1082
|
return { applied: !1, reason: "no-selection" };
|
|
977
|
-
if (typeof
|
|
978
|
-
return
|
|
979
|
-
const
|
|
980
|
-
return
|
|
1083
|
+
if (typeof s.removeEdges == "function")
|
|
1084
|
+
return s.removeEdges([l.id]), { applied: !0 };
|
|
1085
|
+
const m = s.edges?.findIndex((g) => g.id === l.id) ?? -1;
|
|
1086
|
+
return m === -1 ? { applied: !1, reason: "no-helper" } : (s.edges.splice(m, 1), { applied: !0 });
|
|
981
1087
|
}
|
|
982
1088
|
}, u = e.addScopeToNode(d, {
|
|
983
|
-
inspector:
|
|
1089
|
+
inspector: a,
|
|
984
1090
|
get selectedEdge() {
|
|
985
|
-
return
|
|
1091
|
+
return o();
|
|
986
1092
|
}
|
|
987
1093
|
});
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
}),
|
|
991
|
-
|
|
1094
|
+
c && n(() => {
|
|
1095
|
+
et(d, s, o());
|
|
1096
|
+
}), i(() => {
|
|
1097
|
+
J(d), u?.();
|
|
992
1098
|
});
|
|
993
1099
|
}
|
|
994
1100
|
);
|
|
995
1101
|
}
|
|
996
|
-
function
|
|
997
|
-
const
|
|
1102
|
+
function et(e, t, r) {
|
|
1103
|
+
const n = ee(t), i = e.querySelector(
|
|
998
1104
|
":scope > [data-schema-default-ui-root]"
|
|
999
|
-
),
|
|
1000
|
-
|
|
1001
|
-
const
|
|
1105
|
+
), d = re(i);
|
|
1106
|
+
J(e);
|
|
1107
|
+
const s = oe(e);
|
|
1002
1108
|
if (!r) {
|
|
1003
|
-
const
|
|
1004
|
-
|
|
1109
|
+
const u = document.createElement("div");
|
|
1110
|
+
u.setAttribute("data-schema-inspector-empty", ""), u.textContent = n("schema.inspector.noEdge"), s.appendChild(u), O(s, d);
|
|
1005
1111
|
return;
|
|
1006
1112
|
}
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1011
|
-
r.label =
|
|
1012
|
-
}),
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1113
|
+
const c = document.createElement("label");
|
|
1114
|
+
c.textContent = n("schema.inspector.label") + " ";
|
|
1115
|
+
const o = document.createElement("input");
|
|
1116
|
+
o.setAttribute("data-field", "label"), o.value = String(r.label ?? ""), o.addEventListener("input", () => {
|
|
1117
|
+
r.label = o.value;
|
|
1118
|
+
}), c.appendChild(o), s.appendChild(c);
|
|
1119
|
+
const a = document.createElement("button");
|
|
1120
|
+
a.type = "button", a.setAttribute("data-action", "delete"), a.textContent = n("schema.inspector.delete"), a.addEventListener("click", () => {
|
|
1015
1121
|
if (typeof t.removeEdges == "function")
|
|
1016
1122
|
t.removeEdges([r.id]);
|
|
1017
1123
|
else {
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1124
|
+
const u = t.edges?.findIndex((l) => l.id === r.id) ?? -1;
|
|
1125
|
+
u !== -1 && t.edges.splice(u, 1);
|
|
1020
1126
|
}
|
|
1021
|
-
}),
|
|
1127
|
+
}), s.appendChild(a), O(s, d);
|
|
1022
1128
|
}
|
|
1023
|
-
const
|
|
1024
|
-
function
|
|
1129
|
+
const tt = 4;
|
|
1130
|
+
function nt(e) {
|
|
1025
1131
|
e.directive(
|
|
1026
1132
|
"schema-reorderable",
|
|
1027
|
-
(t, r, { cleanup:
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1030
|
-
let d = !1,
|
|
1133
|
+
(t, r, { cleanup: n }) => {
|
|
1134
|
+
const i = t;
|
|
1135
|
+
i.classList.add("flow-schema-reorderable"), i.style.touchAction = "none";
|
|
1136
|
+
let d = !1, s = !1, c = 0, o = 0, a = 0, u = null;
|
|
1031
1137
|
const l = () => {
|
|
1032
|
-
const
|
|
1033
|
-
return
|
|
1034
|
-
|
|
1138
|
+
const E = i.parentElement;
|
|
1139
|
+
return E ? Array.from(
|
|
1140
|
+
E.querySelectorAll(":scope > .flow-schema-row")
|
|
1035
1141
|
) : [];
|
|
1036
|
-
},
|
|
1037
|
-
for (const
|
|
1038
|
-
|
|
1039
|
-
},
|
|
1040
|
-
const A =
|
|
1041
|
-
if (!A) return
|
|
1042
|
-
const
|
|
1142
|
+
}, m = () => {
|
|
1143
|
+
for (const E of l())
|
|
1144
|
+
E.classList.remove("flow-schema-row-drop-target");
|
|
1145
|
+
}, g = (E) => {
|
|
1146
|
+
const A = i.parentElement;
|
|
1147
|
+
if (!A) return o;
|
|
1148
|
+
const F = Array.from(
|
|
1043
1149
|
A.querySelectorAll(":scope > .flow-schema-row")
|
|
1044
|
-
).filter((
|
|
1045
|
-
if (
|
|
1150
|
+
).filter((T) => T !== i);
|
|
1151
|
+
if (F.length === 0) return o;
|
|
1046
1152
|
let N = 0;
|
|
1047
|
-
for (const
|
|
1048
|
-
const $ =
|
|
1049
|
-
$.top + $.height / 2 <
|
|
1153
|
+
for (const T of F) {
|
|
1154
|
+
const $ = T.getBoundingClientRect();
|
|
1155
|
+
$.top + $.height / 2 < E && N++;
|
|
1050
1156
|
}
|
|
1051
1157
|
return N;
|
|
1052
|
-
},
|
|
1053
|
-
|
|
1158
|
+
}, v = (E) => {
|
|
1159
|
+
m();
|
|
1054
1160
|
const A = l();
|
|
1055
|
-
let
|
|
1056
|
-
|
|
1057
|
-
const N = A[
|
|
1058
|
-
N && N !==
|
|
1059
|
-
},
|
|
1060
|
-
|
|
1061
|
-
},
|
|
1062
|
-
if (d ||
|
|
1063
|
-
d = !0,
|
|
1161
|
+
let F = E;
|
|
1162
|
+
E >= o && (F = E + 1);
|
|
1163
|
+
const N = A[F] ?? A[E];
|
|
1164
|
+
N && N !== i && N.classList.add("flow-schema-row-drop-target");
|
|
1165
|
+
}, b = () => {
|
|
1166
|
+
i.style.transform = "", i.classList.remove("flow-schema-row-dragging"), m();
|
|
1167
|
+
}, p = (E) => {
|
|
1168
|
+
if (d || E.button !== void 0 && E.button !== 0) return;
|
|
1169
|
+
d = !0, s = !1, c = E.clientY, u = E.pointerId ?? null, o = l().indexOf(i), a = o, i.classList.add("flow-schema-row-dragging");
|
|
1064
1170
|
try {
|
|
1065
|
-
u !== null && typeof
|
|
1171
|
+
u !== null && typeof i.setPointerCapture == "function" && i.setPointerCapture(u);
|
|
1066
1172
|
} catch {
|
|
1067
1173
|
}
|
|
1068
|
-
document.addEventListener("pointermove",
|
|
1069
|
-
},
|
|
1174
|
+
document.addEventListener("pointermove", y), document.addEventListener("pointerup", w), document.addEventListener("pointercancel", w);
|
|
1175
|
+
}, y = (E) => {
|
|
1070
1176
|
if (!d) return;
|
|
1071
|
-
const A =
|
|
1072
|
-
!
|
|
1073
|
-
},
|
|
1177
|
+
const A = E.clientY - c;
|
|
1178
|
+
!s && Math.abs(A) > tt && (s = !0), i.style.transform = `translateY(${A}px)`, s && (a = g(E.clientY), v(a));
|
|
1179
|
+
}, w = (E) => {
|
|
1074
1180
|
if (!d) return;
|
|
1075
|
-
const A =
|
|
1181
|
+
const A = s, F = a, N = o;
|
|
1076
1182
|
try {
|
|
1077
|
-
u !== null && typeof
|
|
1183
|
+
u !== null && typeof i.releasePointerCapture == "function" && typeof i.hasPointerCapture == "function" && i.hasPointerCapture(u) && i.releasePointerCapture(u);
|
|
1078
1184
|
} catch {
|
|
1079
1185
|
}
|
|
1080
|
-
if (document.removeEventListener("pointermove",
|
|
1186
|
+
if (document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", w), document.removeEventListener("pointercancel", w), d = !1, u = null, b(), !A)
|
|
1081
1187
|
return;
|
|
1082
|
-
const
|
|
1188
|
+
const T = (C) => {
|
|
1083
1189
|
C.stopImmediatePropagation(), C.stopPropagation(), C.preventDefault();
|
|
1084
1190
|
};
|
|
1085
|
-
|
|
1086
|
-
|
|
1191
|
+
i.addEventListener("click", T, { capture: !0, once: !0 }), setTimeout(() => {
|
|
1192
|
+
i.removeEventListener("click", T, { capture: !0 });
|
|
1087
1193
|
}, 0);
|
|
1088
|
-
const
|
|
1089
|
-
if (!
|
|
1090
|
-
const q =
|
|
1194
|
+
const D = i.closest("[data-flow-node-id]")?.getAttribute("data-flow-node-id") ?? null;
|
|
1195
|
+
if (!D) return;
|
|
1196
|
+
const q = i.closest(".flow-container");
|
|
1091
1197
|
if (!q) return;
|
|
1092
1198
|
let L;
|
|
1093
1199
|
try {
|
|
@@ -1096,143 +1202,143 @@ function Je(e) {
|
|
|
1096
1202
|
return;
|
|
1097
1203
|
}
|
|
1098
1204
|
if (!L || typeof L.reorderFields != "function") return;
|
|
1099
|
-
const h = (L.nodes ?? []).find((C) => C?.id ===
|
|
1205
|
+
const h = (L.nodes ?? []).find((C) => C?.id === D)?.data?.fields ?? [];
|
|
1100
1206
|
if (!Array.isArray(h) || h.length < 2) return;
|
|
1101
1207
|
const I = h.map((C) => C.name);
|
|
1102
1208
|
if (N < 0 || N >= I.length) return;
|
|
1103
|
-
const [
|
|
1104
|
-
I.splice(
|
|
1209
|
+
const [x] = I.splice(N, 1), _ = Math.max(0, Math.min(F, I.length));
|
|
1210
|
+
I.splice(_, 0, x), !I.every(
|
|
1105
1211
|
(C, P) => h[P]?.name === C
|
|
1106
|
-
) && L.reorderFields(
|
|
1212
|
+
) && L.reorderFields(D, I);
|
|
1107
1213
|
};
|
|
1108
|
-
|
|
1214
|
+
i.addEventListener("pointerdown", p), n(() => {
|
|
1109
1215
|
try {
|
|
1110
|
-
|
|
1216
|
+
i.removeEventListener("pointerdown", p), typeof document < "u" && (document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", w), document.removeEventListener("pointercancel", w)), i.classList.remove("flow-schema-reorderable"), i.classList.remove("flow-schema-row-dragging"), m(), i.style.transform = "", i.style.touchAction = "";
|
|
1111
1217
|
} catch {
|
|
1112
1218
|
}
|
|
1113
1219
|
});
|
|
1114
1220
|
}
|
|
1115
1221
|
);
|
|
1116
1222
|
}
|
|
1117
|
-
function
|
|
1223
|
+
function ot(e) {
|
|
1118
1224
|
const t = e.parentElement;
|
|
1119
1225
|
return t ? Array.from(
|
|
1120
1226
|
t.querySelectorAll(":scope > .flow-schema-row")
|
|
1121
1227
|
) : [];
|
|
1122
1228
|
}
|
|
1123
|
-
function
|
|
1124
|
-
const r =
|
|
1125
|
-
if (
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1229
|
+
function rt(e, t) {
|
|
1230
|
+
const r = ot(e), n = r.indexOf(e);
|
|
1231
|
+
if (n === -1) return;
|
|
1232
|
+
const i = r[n + t];
|
|
1233
|
+
i && i.focus();
|
|
1128
1234
|
}
|
|
1129
|
-
function
|
|
1235
|
+
function st(e, t) {
|
|
1130
1236
|
const r = e.closest("[data-flow-node-id]");
|
|
1131
1237
|
if (!r) return !1;
|
|
1132
|
-
const
|
|
1133
|
-
if (!
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1136
|
-
), d =
|
|
1238
|
+
const n = e.closest(".flow-container");
|
|
1239
|
+
if (!n) return !1;
|
|
1240
|
+
const i = Array.from(
|
|
1241
|
+
n.querySelectorAll("[data-flow-node-id]")
|
|
1242
|
+
), d = i.indexOf(r);
|
|
1137
1243
|
if (d === -1) return !1;
|
|
1138
|
-
const
|
|
1139
|
-
if (!
|
|
1140
|
-
const
|
|
1141
|
-
const
|
|
1142
|
-
return
|
|
1244
|
+
const s = i[d + t];
|
|
1245
|
+
if (!s) return !1;
|
|
1246
|
+
const c = t === 1 ? s.querySelector(".flow-schema-row") : (() => {
|
|
1247
|
+
const o = s.querySelectorAll(".flow-schema-row");
|
|
1248
|
+
return o.length > 0 ? o[o.length - 1] : null;
|
|
1143
1249
|
})();
|
|
1144
|
-
return
|
|
1250
|
+
return c ? (c.focus(), !0) : !1;
|
|
1145
1251
|
}
|
|
1146
|
-
function
|
|
1252
|
+
function it(e) {
|
|
1147
1253
|
e.click();
|
|
1148
1254
|
}
|
|
1149
|
-
function
|
|
1255
|
+
function dt(e) {
|
|
1150
1256
|
e.directive(
|
|
1151
1257
|
"schema-keyboard-nav",
|
|
1152
|
-
(t, r, { effect:
|
|
1258
|
+
(t, r, { effect: n, cleanup: i }) => {
|
|
1153
1259
|
const d = t;
|
|
1154
|
-
d.setAttribute("tabindex", "0"), d.setAttribute("role", "row"),
|
|
1155
|
-
const
|
|
1260
|
+
d.setAttribute("tabindex", "0"), d.setAttribute("role", "row"), n(() => {
|
|
1261
|
+
const c = d.dataset.flowSchemaField ?? "", a = d.querySelector(".flow-schema-row-type")?.textContent ?? "";
|
|
1156
1262
|
d.setAttribute(
|
|
1157
1263
|
"aria-label",
|
|
1158
|
-
`${
|
|
1264
|
+
`${c}${a ? " (" + a + ")" : ""}`
|
|
1159
1265
|
);
|
|
1160
1266
|
});
|
|
1161
|
-
const
|
|
1162
|
-
const
|
|
1163
|
-
if (
|
|
1164
|
-
|
|
1267
|
+
const s = (c) => {
|
|
1268
|
+
const o = c.key;
|
|
1269
|
+
if (o === "ArrowDown" || o === "ArrowUp") {
|
|
1270
|
+
c.preventDefault(), c.stopPropagation(), rt(d, o === "ArrowDown" ? 1 : -1);
|
|
1165
1271
|
return;
|
|
1166
1272
|
}
|
|
1167
|
-
if (
|
|
1168
|
-
|
|
1273
|
+
if (o === "Tab") {
|
|
1274
|
+
st(d, c.shiftKey ? -1 : 1) && c.preventDefault();
|
|
1169
1275
|
return;
|
|
1170
1276
|
}
|
|
1171
|
-
if (
|
|
1172
|
-
|
|
1277
|
+
if (o === "Enter" || o === " ") {
|
|
1278
|
+
c.preventDefault(), it(d);
|
|
1173
1279
|
return;
|
|
1174
1280
|
}
|
|
1175
|
-
if (
|
|
1281
|
+
if (o === "Escape") {
|
|
1176
1282
|
d.blur();
|
|
1177
1283
|
return;
|
|
1178
1284
|
}
|
|
1179
1285
|
};
|
|
1180
|
-
d.addEventListener("keydown",
|
|
1286
|
+
d.addEventListener("keydown", s), i(() => {
|
|
1181
1287
|
try {
|
|
1182
|
-
d.removeEventListener("keydown",
|
|
1288
|
+
d.removeEventListener("keydown", s), d.removeAttribute("tabindex"), d.removeAttribute("role"), d.removeAttribute("aria-label");
|
|
1183
1289
|
} catch {
|
|
1184
1290
|
}
|
|
1185
1291
|
});
|
|
1186
1292
|
}
|
|
1187
1293
|
);
|
|
1188
1294
|
}
|
|
1189
|
-
function
|
|
1190
|
-
e && typeof e.directive == "function" && (
|
|
1295
|
+
function at(e) {
|
|
1296
|
+
e && typeof e.directive == "function" && (Ge(e), Ze(e), Qe(e), nt(e), dt(e)), ye("schema", {
|
|
1191
1297
|
setup(t) {
|
|
1192
|
-
!t.el && t._container && (t.el = t._container), t.addField = function(r,
|
|
1193
|
-
return
|
|
1194
|
-
}, t.renameField = function(r,
|
|
1195
|
-
return
|
|
1196
|
-
}, t.removeField = function(r,
|
|
1197
|
-
return
|
|
1198
|
-
}, t.reorderFields = function(r,
|
|
1199
|
-
return
|
|
1298
|
+
!t.el && t._container && (t.el = t._container), t.addField = function(r, n) {
|
|
1299
|
+
return Se(this, r, n);
|
|
1300
|
+
}, t.renameField = function(r, n, i) {
|
|
1301
|
+
return Ae(this, r, n, i);
|
|
1302
|
+
}, t.removeField = function(r, n) {
|
|
1303
|
+
return Ie(this, r, n);
|
|
1304
|
+
}, t.reorderFields = function(r, n) {
|
|
1305
|
+
return Ne(this, r, n);
|
|
1200
1306
|
}, t.inferReferences = function() {
|
|
1201
|
-
return
|
|
1307
|
+
return me(this.nodes ?? []);
|
|
1202
1308
|
}, t.schemaToJSON = function() {
|
|
1203
1309
|
return K(this);
|
|
1204
1310
|
}, t.schemaFromJSON = function(r) {
|
|
1205
|
-
return
|
|
1311
|
+
return ge(this, r);
|
|
1206
1312
|
}, t.validateSchema = function() {
|
|
1207
|
-
return
|
|
1208
|
-
}, t.diffSchemas = function(r,
|
|
1209
|
-
return
|
|
1313
|
+
return Re(this);
|
|
1314
|
+
}, t.diffSchemas = function(r, n, i) {
|
|
1315
|
+
return Fe(r, n, i);
|
|
1210
1316
|
}, t.toDot = function(r) {
|
|
1211
|
-
return
|
|
1317
|
+
return De(this, r);
|
|
1212
1318
|
}, t.schemaLayout = function(r) {
|
|
1213
|
-
return
|
|
1319
|
+
return $e(this, r);
|
|
1214
1320
|
};
|
|
1215
1321
|
}
|
|
1216
1322
|
});
|
|
1217
1323
|
}
|
|
1218
1324
|
export {
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1325
|
+
Se as addField,
|
|
1326
|
+
ct as attachSchemaHistory,
|
|
1327
|
+
at as default,
|
|
1328
|
+
Fe as diffSchemas,
|
|
1329
|
+
me as inferReferences,
|
|
1330
|
+
Qe as registerEdgeInspectorDirective,
|
|
1331
|
+
Ge as registerNodeInspectorDirective,
|
|
1332
|
+
Ze as registerRowInspectorDirective,
|
|
1333
|
+
dt as registerSchemaKeyboardNavDirective,
|
|
1334
|
+
nt as registerSchemaReorderableDirective,
|
|
1335
|
+
Ie as removeField,
|
|
1336
|
+
Ae as renameField,
|
|
1337
|
+
Ne as reorderFields,
|
|
1338
|
+
ge as schemaFromJSON,
|
|
1339
|
+
$e as schemaLayout,
|
|
1234
1340
|
K as schemaToJSON,
|
|
1235
|
-
|
|
1236
|
-
|
|
1341
|
+
De as toDot,
|
|
1342
|
+
Re as validateSchema
|
|
1237
1343
|
};
|
|
1238
1344
|
//# sourceMappingURL=alpineflow-schema.esm.js.map
|