@ghchinoy/litflow 0.2.8 → 0.3.0
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/CHANGELOG.md +5 -0
- package/dist/breadboard/data/common.d.ts +35 -0
- package/dist/breadboard/engine/loader/capability.d.ts +21 -0
- package/dist/breadboard/engine/loader/loader.d.ts +29 -0
- package/dist/breadboard/engine/loader/resolve-graph-urls.d.ts +16 -0
- package/dist/breadboard/engine/runtime/bubble.d.ts +23 -0
- package/dist/breadboard/engine/runtime/graph-based-node-handler.d.ts +16 -0
- package/dist/breadboard/engine/runtime/handler.d.ts +27 -0
- package/dist/breadboard/engine/runtime/harness/events.d.ts +145 -0
- package/dist/breadboard/engine/runtime/harness/local.d.ts +10 -0
- package/dist/breadboard/engine/runtime/harness/plan-runner.d.ts +25 -0
- package/dist/breadboard/engine/runtime/run/invoke-graph.d.ts +12 -0
- package/dist/breadboard/engine/runtime/run/node-invoker.d.ts +12 -0
- package/dist/breadboard/engine/runtime/run/run-graph.d.ts +12 -0
- package/dist/breadboard/engine/runtime/run.d.ts +29 -0
- package/dist/breadboard/engine/runtime/sandbox/capabilities-manager.d.ts +15 -0
- package/dist/breadboard/engine/runtime/sandbox/file-system-handler-factory.d.ts +15 -0
- package/dist/breadboard/engine/runtime/sandbox/invoke-describer.d.ts +10 -0
- package/dist/breadboard/engine/runtime/static/create-plan.d.ts +14 -0
- package/dist/breadboard/engine/runtime/static/orchestrator.d.ts +72 -0
- package/dist/breadboard/engine/runtime/traversal/index.d.ts +20 -0
- package/dist/breadboard/engine/runtime/traversal/iterator.d.ts +12 -0
- package/dist/breadboard/engine/runtime/traversal/machine.d.ts +14 -0
- package/dist/breadboard/engine/runtime/traversal/representation.d.ts +27 -0
- package/dist/breadboard/engine/runtime/traversal/result.d.ts +24 -0
- package/dist/breadboard/engine/runtime/traversal/state.d.ts +34 -0
- package/dist/breadboard/lit-flow-runner.d.ts +13 -0
- package/dist/breadboard/lit-flow-runner.test.d.ts +1 -0
- package/dist/breadboard/runner.d.ts +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/lit-chiclet.d.ts +9 -0
- package/dist/lit-schema-node.d.ts +13 -0
- package/dist/lit-schema-node.test.d.ts +1 -0
- package/dist/litflow.js +708 -442
- package/dist/litflow.js.map +1 -1
- package/package.json +15 -3
- package/src/breadboard/data/common.ts +450 -0
- package/src/breadboard/data/file-system.ts +54 -0
- package/src/breadboard/data/inline-all-content.ts +126 -0
- package/src/breadboard/data/recent-boards.ts +118 -0
- package/src/breadboard/data/save-outputs-as-file.ts +104 -0
- package/src/breadboard/engine/add-run-module.ts +168 -0
- package/src/breadboard/engine/editor/blank.ts +65 -0
- package/src/breadboard/engine/editor/edge.ts +27 -0
- package/src/breadboard/engine/editor/events.ts +64 -0
- package/src/breadboard/engine/editor/graph.ts +383 -0
- package/src/breadboard/engine/editor/history.ts +98 -0
- package/src/breadboard/engine/editor/index.ts +8 -0
- package/src/breadboard/engine/editor/operations/add-asset.ts +45 -0
- package/src/breadboard/engine/editor/operations/add-edge.ts +142 -0
- package/src/breadboard/engine/editor/operations/add-graph.ts +47 -0
- package/src/breadboard/engine/editor/operations/add-module.ts +64 -0
- package/src/breadboard/engine/editor/operations/add-node.ts +86 -0
- package/src/breadboard/engine/editor/operations/change-asset-metadata.ts +70 -0
- package/src/breadboard/engine/editor/operations/change-configuration.ts +82 -0
- package/src/breadboard/engine/editor/operations/change-edge-metadata.ts +58 -0
- package/src/breadboard/engine/editor/operations/change-edge.ts +111 -0
- package/src/breadboard/engine/editor/operations/change-graph-metadata.ts +52 -0
- package/src/breadboard/engine/editor/operations/change-metadata.ts +92 -0
- package/src/breadboard/engine/editor/operations/change-module.ts +64 -0
- package/src/breadboard/engine/editor/operations/error.ts +21 -0
- package/src/breadboard/engine/editor/operations/remove-asset.ts +48 -0
- package/src/breadboard/engine/editor/operations/remove-edge.ts +89 -0
- package/src/breadboard/engine/editor/operations/remove-graph.ts +49 -0
- package/src/breadboard/engine/editor/operations/remove-integration.ts +54 -0
- package/src/breadboard/engine/editor/operations/remove-module.ts +69 -0
- package/src/breadboard/engine/editor/operations/remove-node.ts +86 -0
- package/src/breadboard/engine/editor/operations/replace-graph.ts +52 -0
- package/src/breadboard/engine/editor/operations/toggle-export.ts +72 -0
- package/src/breadboard/engine/editor/operations/upsert-integration.ts +43 -0
- package/src/breadboard/engine/editor/selection.ts +58 -0
- package/src/breadboard/engine/editor/transforms/configure-sidewire.ts +73 -0
- package/src/breadboard/engine/editor/transforms/isolate-selection.ts +54 -0
- package/src/breadboard/engine/editor/transforms/merge-graph.ts +58 -0
- package/src/breadboard/engine/editor/transforms/move-to-graph.ts +102 -0
- package/src/breadboard/engine/editor/transforms/move-to-new-graph.ts +72 -0
- package/src/breadboard/engine/editor/transforms/sidewire-to-new-graph.ts +82 -0
- package/src/breadboard/engine/file-system/blob-transform.ts +44 -0
- package/src/breadboard/engine/file-system/composed-peristent-backend.ts +140 -0
- package/src/breadboard/engine/file-system/ephemeral-blob-store.ts +46 -0
- package/src/breadboard/engine/file-system/in-memory-blob-store.ts +87 -0
- package/src/breadboard/engine/file-system/index.ts +723 -0
- package/src/breadboard/engine/file-system/partial-persistent-backend.ts +109 -0
- package/src/breadboard/engine/file-system/path.ts +125 -0
- package/src/breadboard/engine/file-system/persistent-file.ts +66 -0
- package/src/breadboard/engine/file-system/readable-stream-file.ts +61 -0
- package/src/breadboard/engine/file-system/stub-file-system.ts +47 -0
- package/src/breadboard/engine/file-system/utils.ts +40 -0
- package/src/breadboard/engine/inspector/graph/bubbled-node.ts +162 -0
- package/src/breadboard/engine/inspector/graph/describe-cache.ts +78 -0
- package/src/breadboard/engine/inspector/graph/describe-type-cache.ts +48 -0
- package/src/breadboard/engine/inspector/graph/edge-cache.ts +118 -0
- package/src/breadboard/engine/inspector/graph/edge.ts +133 -0
- package/src/breadboard/engine/inspector/graph/event.ts +35 -0
- package/src/breadboard/engine/inspector/graph/exports-describer.ts +45 -0
- package/src/breadboard/engine/inspector/graph/graph-cache.ts +54 -0
- package/src/breadboard/engine/inspector/graph/graph-describer-manager.ts +338 -0
- package/src/breadboard/engine/inspector/graph/graph-descriptor-handle.ts +73 -0
- package/src/breadboard/engine/inspector/graph/graph-node-type.ts +111 -0
- package/src/breadboard/engine/inspector/graph/graph-queries.ts +256 -0
- package/src/breadboard/engine/inspector/graph/graph.ts +163 -0
- package/src/breadboard/engine/inspector/graph/inspectable-asset.ts +36 -0
- package/src/breadboard/engine/inspector/graph/kits.ts +208 -0
- package/src/breadboard/engine/inspector/graph/module.ts +69 -0
- package/src/breadboard/engine/inspector/graph/mutable-graph.ts +150 -0
- package/src/breadboard/engine/inspector/graph/node-cache.ts +123 -0
- package/src/breadboard/engine/inspector/graph/node-describer-manager.ts +279 -0
- package/src/breadboard/engine/inspector/graph/node-type-describer-manager.ts +122 -0
- package/src/breadboard/engine/inspector/graph/node.ts +149 -0
- package/src/breadboard/engine/inspector/graph/port-cache.ts +80 -0
- package/src/breadboard/engine/inspector/graph/ports.ts +292 -0
- package/src/breadboard/engine/inspector/graph/schemas.ts +131 -0
- package/src/breadboard/engine/inspector/graph/virtual-node.ts +184 -0
- package/src/breadboard/engine/inspector/graph-store.ts +629 -0
- package/src/breadboard/engine/inspector/index.ts +13 -0
- package/src/breadboard/engine/inspector/utils.ts +20 -0
- package/src/breadboard/engine/loader/capability.ts +184 -0
- package/src/breadboard/engine/loader/index.ts +14 -0
- package/src/breadboard/engine/loader/loader.ts +244 -0
- package/src/breadboard/engine/loader/resolve-graph-urls.ts +111 -0
- package/src/breadboard/engine/runtime/bubble.ts +269 -0
- package/src/breadboard/engine/runtime/graph-based-node-handler.ts +174 -0
- package/src/breadboard/engine/runtime/handler.ts +166 -0
- package/src/breadboard/engine/runtime/harness/diagnostics.ts +22 -0
- package/src/breadboard/engine/runtime/harness/events.ts +217 -0
- package/src/breadboard/engine/runtime/harness/index.ts +14 -0
- package/src/breadboard/engine/runtime/harness/local.ts +48 -0
- package/src/breadboard/engine/runtime/harness/plan-runner.ts +759 -0
- package/src/breadboard/engine/runtime/index.ts +8 -0
- package/src/breadboard/engine/runtime/legacy.ts +28 -0
- package/src/breadboard/engine/runtime/run/invoke-graph.ts +79 -0
- package/src/breadboard/engine/runtime/run/node-invoker.ts +137 -0
- package/src/breadboard/engine/runtime/run/run-graph.ts +186 -0
- package/src/breadboard/engine/runtime/run.ts +111 -0
- package/src/breadboard/engine/runtime/sandbox/capabilities-manager.ts +253 -0
- package/src/breadboard/engine/runtime/sandbox/file-system-handler-factory.ts +53 -0
- package/src/breadboard/engine/runtime/sandbox/invoke-describer.ts +125 -0
- package/src/breadboard/engine/runtime/static/condense.ts +155 -0
- package/src/breadboard/engine/runtime/static/create-plan.ts +134 -0
- package/src/breadboard/engine/runtime/static/nodes-to-subgraph.ts +168 -0
- package/src/breadboard/engine/runtime/static/orchestrator.ts +664 -0
- package/src/breadboard/engine/runtime/static/types.ts +77 -0
- package/src/breadboard/engine/runtime/traversal/index.ts +58 -0
- package/src/breadboard/engine/runtime/traversal/iterator.ts +124 -0
- package/src/breadboard/engine/runtime/traversal/machine.ts +58 -0
- package/src/breadboard/engine/runtime/traversal/representation.ts +115 -0
- package/src/breadboard/engine/runtime/traversal/result.ts +72 -0
- package/src/breadboard/engine/runtime/traversal/state.ts +115 -0
- package/src/breadboard/engine/telemetry.ts +121 -0
- package/src/breadboard/engine/types.ts +32 -0
- package/src/breadboard/lit-flow-runner.test.ts +44 -0
- package/src/breadboard/lit-flow-runner.ts +98 -0
- package/src/breadboard/runner.ts +80 -0
- package/src/index.ts +2 -0
- package/src/lit-chiclet.ts +69 -0
- package/src/lit-flow.ts +17 -7
- package/src/lit-schema-node.test.ts +65 -0
- package/src/lit-schema-node.ts +194 -0
package/dist/litflow.js
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { unsafeStatic as
|
|
3
|
-
import { property as d, customElement as
|
|
4
|
-
import { signal as
|
|
5
|
-
import { infiniteExtent as
|
|
6
|
-
import { m3Tokens as
|
|
7
|
-
|
|
1
|
+
import { LitElement as x, html as m, svg as Z, css as B } from "lit";
|
|
2
|
+
import { unsafeStatic as at, html as A } from "lit/static-html.js";
|
|
3
|
+
import { property as d, customElement as w, query as st, state as M } from "lit/decorators.js";
|
|
4
|
+
import { signal as G, SignalWatcher as H } from "@lit-labs/signals";
|
|
5
|
+
import { infiniteExtent as dt, Position as D, getBezierPath as J, adoptUserNodes as lt, updateAbsolutePositions as q, PanOnScrollMode as pt, XYPanZoom as ct, XYDrag as ht, getHandlePosition as tt, getSmoothStepPath as et, getStraightPath as ut, XYHandle as mt, ConnectionMode as yt, XYMinimap as ft, getBoundsOfRects as gt, getInternalNodesBounds as vt } from "@xyflow/system";
|
|
6
|
+
import { m3Tokens as Q } from "./theme.js";
|
|
7
|
+
import { map as ot } from "lit/directives/map.js";
|
|
8
|
+
function bt() {
|
|
8
9
|
return {
|
|
9
|
-
nodes:
|
|
10
|
-
edges:
|
|
10
|
+
nodes: G([]),
|
|
11
|
+
edges: G([]),
|
|
11
12
|
nodeLookup: /* @__PURE__ */ new Map(),
|
|
12
13
|
parentLookup: /* @__PURE__ */ new Map(),
|
|
13
|
-
nodeExtent:
|
|
14
|
+
nodeExtent: dt,
|
|
14
15
|
snapGrid: [15, 15],
|
|
15
16
|
snapToGrid: !1,
|
|
16
17
|
nodeOrigin: [0, 0],
|
|
17
18
|
multiSelectionActive: !1,
|
|
18
|
-
transform:
|
|
19
|
+
transform: G([0, 0, 1]),
|
|
19
20
|
autoPanOnNodeDrag: !0,
|
|
20
21
|
nodesDraggable: !0,
|
|
21
22
|
selectNodesOnDrag: !0,
|
|
22
23
|
nodeDragThreshold: 0,
|
|
23
24
|
panZoom: null,
|
|
24
25
|
domNode: null,
|
|
25
|
-
connectionInProgress:
|
|
26
|
+
connectionInProgress: G(null)
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
|
-
var
|
|
29
|
-
for (var
|
|
30
|
-
(n = t[i]) && (
|
|
31
|
-
return
|
|
29
|
+
var _t = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, k = (t, s, e, r) => {
|
|
30
|
+
for (var o = r > 1 ? void 0 : r ? xt(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
31
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
32
|
+
return r && o && _t(s, e, o), o;
|
|
32
33
|
};
|
|
33
|
-
let
|
|
34
|
+
let P = class extends H(x) {
|
|
34
35
|
constructor() {
|
|
35
36
|
super(...arguments), this.label = "", this.type = "default", this.data = {}, this.selected = !1, this.nodeId = "", this.positionX = 0, this.positionY = 0;
|
|
36
37
|
}
|
|
@@ -38,49 +39,49 @@ let $ = class extends j(P) {
|
|
|
38
39
|
return this;
|
|
39
40
|
}
|
|
40
41
|
render() {
|
|
41
|
-
return
|
|
42
|
+
return m`
|
|
42
43
|
<div class="label" style="font-size: var(--md-sys-typescale-body-medium-size); color: var(--md-sys-color-on-surface); pointer-events: none; font-family: var(--md-sys-typescale-body-medium-font);">${this.label}</div>
|
|
43
44
|
<slot></slot>
|
|
44
|
-
${this.type === "input" || this.type === "default" ?
|
|
45
|
-
${this.type === "output" || this.type === "default" ?
|
|
45
|
+
${this.type === "input" || this.type === "default" ? m`<lit-handle type="source" data-handlepos="bottom" data-nodeid="${this.nodeId}"></lit-handle>` : ""}
|
|
46
|
+
${this.type === "output" || this.type === "default" ? m`<lit-handle type="target" data-handlepos="top" data-nodeid="${this.nodeId}"></lit-handle>` : ""}
|
|
46
47
|
`;
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
|
-
|
|
50
|
+
k([
|
|
50
51
|
d({ type: String })
|
|
51
|
-
],
|
|
52
|
-
|
|
52
|
+
], P.prototype, "label", 2);
|
|
53
|
+
k([
|
|
53
54
|
d({ type: String, reflect: !0 })
|
|
54
|
-
],
|
|
55
|
-
|
|
55
|
+
], P.prototype, "type", 2);
|
|
56
|
+
k([
|
|
56
57
|
d({ type: Object })
|
|
57
|
-
],
|
|
58
|
-
|
|
58
|
+
], P.prototype, "data", 2);
|
|
59
|
+
k([
|
|
59
60
|
d({ type: Boolean, reflect: !0 })
|
|
60
|
-
],
|
|
61
|
-
|
|
61
|
+
], P.prototype, "selected", 2);
|
|
62
|
+
k([
|
|
62
63
|
d({ type: String, attribute: "data-id", reflect: !0 })
|
|
63
|
-
],
|
|
64
|
-
|
|
64
|
+
], P.prototype, "nodeId", 2);
|
|
65
|
+
k([
|
|
65
66
|
d({ type: Number, attribute: "position-x" })
|
|
66
|
-
],
|
|
67
|
-
|
|
67
|
+
], P.prototype, "positionX", 2);
|
|
68
|
+
k([
|
|
68
69
|
d({ type: Number, attribute: "position-y" })
|
|
69
|
-
],
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
],
|
|
73
|
-
var
|
|
74
|
-
for (var
|
|
75
|
-
(n = t[i]) && (
|
|
76
|
-
return
|
|
70
|
+
], P.prototype, "positionY", 2);
|
|
71
|
+
P = k([
|
|
72
|
+
w("lit-node")
|
|
73
|
+
], P);
|
|
74
|
+
var wt = Object.defineProperty, $t = Object.getOwnPropertyDescriptor, z = (t, s, e, r) => {
|
|
75
|
+
for (var o = r > 1 ? void 0 : r ? $t(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
76
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
77
|
+
return r && o && wt(s, e, o), o;
|
|
77
78
|
};
|
|
78
|
-
let
|
|
79
|
+
let $ = class extends H(x) {
|
|
79
80
|
constructor() {
|
|
80
81
|
super(...arguments), this.sourceX = 0, this.sourceY = 0, this.targetX = 0, this.targetY = 0, this.sourcePosition = D.Right, this.targetPosition = D.Left, this.selected = !1;
|
|
81
82
|
}
|
|
82
83
|
render() {
|
|
83
|
-
const [t] =
|
|
84
|
+
const [t] = J({
|
|
84
85
|
sourceX: this.sourceX,
|
|
85
86
|
sourceY: this.sourceY,
|
|
86
87
|
sourcePosition: this.sourcePosition,
|
|
@@ -88,12 +89,12 @@ let w = class extends j(P) {
|
|
|
88
89
|
targetY: this.targetY,
|
|
89
90
|
targetPosition: this.targetPosition
|
|
90
91
|
});
|
|
91
|
-
return
|
|
92
|
+
return Z`
|
|
92
93
|
<path d="${t}" />
|
|
93
94
|
`;
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
|
-
|
|
97
|
+
$.styles = B`
|
|
97
98
|
:host {
|
|
98
99
|
display: contents;
|
|
99
100
|
}
|
|
@@ -108,52 +109,52 @@ w.styles = A`
|
|
|
108
109
|
stroke: #555;
|
|
109
110
|
}
|
|
110
111
|
`;
|
|
111
|
-
|
|
112
|
+
z([
|
|
112
113
|
d({ type: Number })
|
|
113
|
-
],
|
|
114
|
-
|
|
114
|
+
], $.prototype, "sourceX", 2);
|
|
115
|
+
z([
|
|
115
116
|
d({ type: Number })
|
|
116
|
-
],
|
|
117
|
-
|
|
117
|
+
], $.prototype, "sourceY", 2);
|
|
118
|
+
z([
|
|
118
119
|
d({ type: Number })
|
|
119
|
-
],
|
|
120
|
-
|
|
120
|
+
], $.prototype, "targetX", 2);
|
|
121
|
+
z([
|
|
121
122
|
d({ type: Number })
|
|
122
|
-
],
|
|
123
|
-
|
|
123
|
+
], $.prototype, "targetY", 2);
|
|
124
|
+
z([
|
|
124
125
|
d({ type: String })
|
|
125
|
-
],
|
|
126
|
-
|
|
126
|
+
], $.prototype, "sourcePosition", 2);
|
|
127
|
+
z([
|
|
127
128
|
d({ type: String })
|
|
128
|
-
],
|
|
129
|
-
|
|
129
|
+
], $.prototype, "targetPosition", 2);
|
|
130
|
+
z([
|
|
130
131
|
d({ type: Boolean, reflect: !0 })
|
|
131
|
-
],
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
],
|
|
135
|
-
var
|
|
136
|
-
for (var
|
|
137
|
-
(n = t[i]) && (
|
|
138
|
-
return
|
|
132
|
+
], $.prototype, "selected", 2);
|
|
133
|
+
$ = z([
|
|
134
|
+
w("lit-edge")
|
|
135
|
+
], $);
|
|
136
|
+
var Ot = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, f = (t, s, e, r) => {
|
|
137
|
+
for (var o = r > 1 ? void 0 : r ? Pt(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
138
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
139
|
+
return r && o && Ot(s, e, o), o;
|
|
139
140
|
};
|
|
140
|
-
const
|
|
141
|
+
const S = {
|
|
141
142
|
fromAttribute: (t) => t !== "false" && t !== null,
|
|
142
143
|
toAttribute: (t) => t ? "" : null
|
|
143
144
|
};
|
|
144
|
-
let
|
|
145
|
+
let y = class extends H(x) {
|
|
145
146
|
constructor() {
|
|
146
|
-
super(...arguments), this._drags = /* @__PURE__ */ new Map(), this._state =
|
|
147
|
+
super(...arguments), this._drags = /* @__PURE__ */ new Map(), this._state = bt(), this.nodeTypes = {
|
|
147
148
|
default: "lit-node",
|
|
148
149
|
input: "lit-node",
|
|
149
150
|
output: "lit-node"
|
|
150
151
|
}, this.showControls = !1, this.showMinimap = !1, this.showGrid = !0, this.nodesDraggable = !0, this.nodesConnectable = !0, this.panOnDrag = !0, this.zoomOnScroll = !0, this.zoomOnPinch = !0, this.zoomOnDoubleClick = !0, this.promptOnDrop = !1, this.selectionMode = "pan", this._selectionRect = null, this._selectionStart = null, this._width = 0, this._height = 0, this.viewport = { x: 0, y: 0, zoom: 1 };
|
|
151
152
|
}
|
|
152
153
|
set nodes(t) {
|
|
153
|
-
this._state.nodes.set(t),
|
|
154
|
+
this._state.nodes.set(t), lt(t, this._state.nodeLookup, this._state.parentLookup, {
|
|
154
155
|
nodeOrigin: this._state.nodeOrigin,
|
|
155
156
|
nodeExtent: this._state.nodeExtent
|
|
156
|
-
}),
|
|
157
|
+
}), q(this._state.nodeLookup, this._state.parentLookup, {
|
|
157
158
|
nodeOrigin: this._state.nodeOrigin,
|
|
158
159
|
nodeExtent: this._state.nodeExtent
|
|
159
160
|
}), this._notifyChange();
|
|
@@ -175,7 +176,7 @@ let f = class extends j(P) {
|
|
|
175
176
|
if (this.nodes.length > 0) return;
|
|
176
177
|
const t = Array.from(this.querySelectorAll("lit-node"));
|
|
177
178
|
if (t.length > 0) {
|
|
178
|
-
const
|
|
179
|
+
const s = t.map((e) => ({
|
|
179
180
|
id: e.id || e.getAttribute("id") || `node-${Math.random().toString(36).substr(2, 9)}`,
|
|
180
181
|
type: e.type || e.getAttribute("type") || "default",
|
|
181
182
|
position: {
|
|
@@ -187,8 +188,8 @@ let f = class extends j(P) {
|
|
|
187
188
|
...e.data
|
|
188
189
|
}
|
|
189
190
|
}));
|
|
190
|
-
this.nodes =
|
|
191
|
-
e.nodeId =
|
|
191
|
+
this.nodes = s, t.forEach((e, r) => {
|
|
192
|
+
e.nodeId = s[r].id;
|
|
192
193
|
});
|
|
193
194
|
}
|
|
194
195
|
}
|
|
@@ -200,56 +201,56 @@ let f = class extends j(P) {
|
|
|
200
201
|
}
|
|
201
202
|
connectedCallback() {
|
|
202
203
|
super.connectedCallback(), this._discoverNodes(), this._resizeObserver = new ResizeObserver((t) => {
|
|
203
|
-
for (const
|
|
204
|
-
if (
|
|
205
|
-
this._width =
|
|
206
|
-
else if (
|
|
207
|
-
const e =
|
|
208
|
-
e && this._updateNodeDimensions(e,
|
|
204
|
+
for (const s of t)
|
|
205
|
+
if (s.target === this)
|
|
206
|
+
this._width = s.contentRect.width, this._height = s.contentRect.height;
|
|
207
|
+
else if (s.target !== this._renderer) {
|
|
208
|
+
const e = s.target.dataset.id;
|
|
209
|
+
e && this._updateNodeDimensions(e, s.target);
|
|
209
210
|
}
|
|
210
211
|
}), this._resizeObserver.observe(this);
|
|
211
212
|
}
|
|
212
213
|
disconnectedCallback() {
|
|
213
214
|
super.disconnectedCallback(), this._resizeObserver?.disconnect();
|
|
214
215
|
}
|
|
215
|
-
async _updateNodeDimensions(t,
|
|
216
|
+
async _updateNodeDimensions(t, s) {
|
|
216
217
|
const e = this._state.nodeLookup.get(t);
|
|
217
218
|
if (e) {
|
|
218
|
-
"updateComplete" in
|
|
219
|
-
const { width:
|
|
219
|
+
"updateComplete" in s && await s.updateComplete;
|
|
220
|
+
const { width: r, height: o } = s.getBoundingClientRect(), i = this._state.transform.get()[2];
|
|
220
221
|
e.measured = {
|
|
221
|
-
width:
|
|
222
|
-
height:
|
|
222
|
+
width: r / i,
|
|
223
|
+
height: o / i
|
|
223
224
|
};
|
|
224
|
-
const n = this.nodes.find((
|
|
225
|
+
const n = this.nodes.find((h) => h.id === t);
|
|
225
226
|
n && (n.measured = e.measured);
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
const l =
|
|
231
|
-
id:
|
|
232
|
-
type:
|
|
233
|
-
position:
|
|
227
|
+
const c = s.querySelectorAll("lit-handle");
|
|
228
|
+
if (c && c.length > 0) {
|
|
229
|
+
const h = [], a = [];
|
|
230
|
+
c.forEach((p) => {
|
|
231
|
+
const l = p.getBoundingClientRect(), u = s.getBoundingClientRect(), g = {
|
|
232
|
+
id: p.handleId || p.getAttribute("data-handleid") || null,
|
|
233
|
+
type: p.type || p.getAttribute("type"),
|
|
234
|
+
position: p.position || p.getAttribute("data-handlepos"),
|
|
234
235
|
x: (l.left - u.left) / i,
|
|
235
236
|
y: (l.top - u.top) / i,
|
|
236
237
|
width: l.width / i,
|
|
237
238
|
height: l.height / i
|
|
238
239
|
};
|
|
239
|
-
|
|
240
|
+
p.type === "source" ? h.push(g) : a.push(g);
|
|
240
241
|
}), e.internals.handleBounds = {
|
|
241
|
-
source:
|
|
242
|
+
source: h,
|
|
242
243
|
target: a
|
|
243
244
|
}, console.log(`Node ${t} handleBounds:`, e.internals.handleBounds);
|
|
244
245
|
}
|
|
245
|
-
|
|
246
|
+
q(this._state.nodeLookup, this._state.parentLookup, {
|
|
246
247
|
nodeOrigin: this._state.nodeOrigin,
|
|
247
248
|
nodeExtent: this._state.nodeExtent
|
|
248
249
|
}), this._state.nodes.set([...this.nodes]), this._notifyChange();
|
|
249
250
|
}
|
|
250
251
|
}
|
|
251
|
-
_selectNode(t,
|
|
252
|
-
const e = this.nodes.map((
|
|
252
|
+
_selectNode(t, s) {
|
|
253
|
+
const e = this.nodes.map((r) => r.id === t ? { ...r, selected: !r.selected } : s ? r : { ...r, selected: !1 });
|
|
253
254
|
this.nodes = e;
|
|
254
255
|
}
|
|
255
256
|
/**
|
|
@@ -257,10 +258,10 @@ let f = class extends j(P) {
|
|
|
257
258
|
* Useful for Drag & Drop and context menus.
|
|
258
259
|
*/
|
|
259
260
|
project(t) {
|
|
260
|
-
const [
|
|
261
|
+
const [s, e, r] = this._state.transform.get();
|
|
261
262
|
return {
|
|
262
|
-
x: (t.x -
|
|
263
|
-
y: (t.y - e) /
|
|
263
|
+
x: (t.x - s) / r,
|
|
264
|
+
y: (t.y - e) / r
|
|
264
265
|
};
|
|
265
266
|
}
|
|
266
267
|
/**
|
|
@@ -269,17 +270,17 @@ let f = class extends j(P) {
|
|
|
269
270
|
*/
|
|
270
271
|
async fitView(t = 50) {
|
|
271
272
|
if (!this._panZoom || this.nodes.length === 0) return;
|
|
272
|
-
const
|
|
273
|
-
if (
|
|
274
|
-
let e = 1 / 0,
|
|
275
|
-
|
|
276
|
-
const { x:
|
|
277
|
-
e = Math.min(e,
|
|
273
|
+
const s = Array.from(this._state.nodeLookup.values());
|
|
274
|
+
if (s.length === 0) return;
|
|
275
|
+
let e = 1 / 0, r = 1 / 0, o = -1 / 0, i = -1 / 0;
|
|
276
|
+
s.forEach((b) => {
|
|
277
|
+
const { x: v, y: C } = b.internals.positionAbsolute, F = b.measured.width || 0, nt = b.measured.height || 0;
|
|
278
|
+
e = Math.min(e, v), r = Math.min(r, C), o = Math.max(o, v + F), i = Math.max(i, C + nt);
|
|
278
279
|
});
|
|
279
|
-
const n =
|
|
280
|
-
if (
|
|
281
|
-
const
|
|
282
|
-
await this._panZoom.setViewport({ x:
|
|
280
|
+
const n = o - e, c = i - r, h = this.offsetWidth, a = this.offsetHeight;
|
|
281
|
+
if (h === 0 || a === 0) return;
|
|
282
|
+
const p = (h - t * 2) / n, l = (a - t * 2) / c, u = Math.min(p, l, 1), g = (h - n * u) / 2 - e * u, _ = (a - c * u) / 2 - r * u;
|
|
283
|
+
await this._panZoom.setViewport({ x: g, y: _, zoom: u }, { duration: 400 });
|
|
283
284
|
}
|
|
284
285
|
_updatePanZoom(t = !1) {
|
|
285
286
|
this._panZoom && this._panZoom.update({
|
|
@@ -288,7 +289,7 @@ let f = class extends j(P) {
|
|
|
288
289
|
preventScrolling: !0,
|
|
289
290
|
panOnScroll: !1,
|
|
290
291
|
panOnDrag: this.panOnDrag,
|
|
291
|
-
panOnScrollMode:
|
|
292
|
+
panOnScrollMode: pt.Free,
|
|
292
293
|
panOnScrollSpeed: 0.5,
|
|
293
294
|
userSelectionActive: t,
|
|
294
295
|
zoomOnPinch: this.zoomOnPinch,
|
|
@@ -303,7 +304,7 @@ let f = class extends j(P) {
|
|
|
303
304
|
});
|
|
304
305
|
}
|
|
305
306
|
firstUpdated() {
|
|
306
|
-
this._renderer && (this._state.domNode = this._renderer, this._resizeObserver?.observe(this._renderer), this._renderer.addEventListener("pointerdown", (t) => this._onPointerDown(t), { capture: !0 }), this._panZoom =
|
|
307
|
+
this._renderer && (this._state.domNode = this._renderer, this._resizeObserver?.observe(this._renderer), this._renderer.addEventListener("pointerdown", (t) => this._onPointerDown(t), { capture: !0 }), this._panZoom = ct({
|
|
307
308
|
domNode: this._renderer,
|
|
308
309
|
minZoom: 0.5,
|
|
309
310
|
maxZoom: 2,
|
|
@@ -311,8 +312,8 @@ let f = class extends j(P) {
|
|
|
311
312
|
viewport: this.viewport,
|
|
312
313
|
onDraggingChange: () => {
|
|
313
314
|
},
|
|
314
|
-
onPanZoom: (t, { x:
|
|
315
|
-
this.viewport = { x:
|
|
315
|
+
onPanZoom: (t, { x: s, y: e, zoom: r }) => {
|
|
316
|
+
this.viewport = { x: s, y: e, zoom: r }, this._state.transform.set([s, e, r]), this._viewport && (this._viewport.style.transform = `translate(${s}px,${e}px) scale(${r})`);
|
|
316
317
|
}
|
|
317
318
|
}), this._updatePanZoom(), this._state.panZoom = this._panZoom);
|
|
318
319
|
}
|
|
@@ -320,44 +321,44 @@ let f = class extends j(P) {
|
|
|
320
321
|
(t.has("nodes") || t.has("nodesDraggable")) && this._setupDrags(), this._panZoom && (t.has("panOnDrag") || t.has("zoomOnScroll") || t.has("zoomOnPinch") || t.has("zoomOnDoubleClick")) && this._updatePanZoom();
|
|
321
322
|
}
|
|
322
323
|
_setupDrags() {
|
|
323
|
-
const t = this.shadowRoot?.querySelectorAll(".xyflow__node"),
|
|
324
|
+
const t = this.shadowRoot?.querySelectorAll(".xyflow__node"), s = /* @__PURE__ */ new Set();
|
|
324
325
|
t?.forEach((e) => {
|
|
325
|
-
const
|
|
326
|
-
if (
|
|
327
|
-
if (
|
|
328
|
-
i.stopPropagation(), this._selectNode(
|
|
326
|
+
const r = e.dataset.id;
|
|
327
|
+
if (r) {
|
|
328
|
+
if (s.add(r), this._resizeObserver?.observe(e), e.onclick = (i) => {
|
|
329
|
+
i.stopPropagation(), this._selectNode(r, i.shiftKey || i.metaKey);
|
|
329
330
|
}, e.style.cursor = this.nodesDraggable ? "grab" : "default", !this.nodesDraggable) {
|
|
330
|
-
this._drags.delete(
|
|
331
|
+
this._drags.delete(r);
|
|
331
332
|
return;
|
|
332
333
|
}
|
|
333
|
-
let
|
|
334
|
-
|
|
334
|
+
let o = this._drags.get(r);
|
|
335
|
+
o || (o = ht({
|
|
335
336
|
getStoreItems: () => ({
|
|
336
337
|
...this._state,
|
|
337
338
|
nodes: this._state.nodes.get(),
|
|
338
339
|
edges: this._state.edges.get(),
|
|
339
340
|
transform: this._state.transform.get(),
|
|
340
341
|
panBy: async (i) => {
|
|
341
|
-
const { panZoom: n, nodeExtent:
|
|
342
|
+
const { panZoom: n, nodeExtent: c } = this._state, h = this._state.transform.get();
|
|
342
343
|
return n ? !!await n.setViewportConstrained(
|
|
343
344
|
{
|
|
344
|
-
x:
|
|
345
|
-
y:
|
|
346
|
-
zoom:
|
|
345
|
+
x: h[0] + i.x,
|
|
346
|
+
y: h[1] + i.y,
|
|
347
|
+
zoom: h[2]
|
|
347
348
|
},
|
|
348
349
|
[[0, 0], [this.offsetWidth, this.offsetHeight]],
|
|
349
|
-
|
|
350
|
+
c
|
|
350
351
|
) : !1;
|
|
351
352
|
},
|
|
352
353
|
updateNodePositions: (i) => {
|
|
353
|
-
i.forEach((n,
|
|
354
|
-
const
|
|
355
|
-
if (
|
|
356
|
-
|
|
357
|
-
const a = this.nodes.find((
|
|
354
|
+
i.forEach((n, c) => {
|
|
355
|
+
const h = this._state.nodeLookup.get(c);
|
|
356
|
+
if (h) {
|
|
357
|
+
h.position = n.position, h.internals.positionAbsolute = n.internals.positionAbsolute;
|
|
358
|
+
const a = this.nodes.find((p) => p.id === c);
|
|
358
359
|
a && (a.position = n.position);
|
|
359
360
|
}
|
|
360
|
-
}),
|
|
361
|
+
}), q(this._state.nodeLookup, this._state.parentLookup, {
|
|
361
362
|
nodeOrigin: this._state.nodeOrigin,
|
|
362
363
|
nodeExtent: this._state.nodeExtent
|
|
363
364
|
}), this._state.nodes.set([...this.nodes]), this._notifyChange();
|
|
@@ -365,33 +366,33 @@ let f = class extends j(P) {
|
|
|
365
366
|
unselectNodesAndEdges: () => {
|
|
366
367
|
}
|
|
367
368
|
})
|
|
368
|
-
}), this._drags.set(
|
|
369
|
+
}), this._drags.set(r, o)), o.update({
|
|
369
370
|
domNode: e,
|
|
370
|
-
nodeId:
|
|
371
|
+
nodeId: r
|
|
371
372
|
});
|
|
372
373
|
}
|
|
373
374
|
});
|
|
374
375
|
for (const e of this._drags.keys())
|
|
375
|
-
|
|
376
|
+
s.has(e) || this._drags.delete(e);
|
|
376
377
|
}
|
|
377
378
|
_renderEdge(t) {
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
380
|
-
const
|
|
381
|
-
if (
|
|
382
|
-
const i = (
|
|
383
|
-
(
|
|
384
|
-
) ||
|
|
379
|
+
const s = this._state.nodeLookup.get(t.source), e = this._state.nodeLookup.get(t.target);
|
|
380
|
+
if (!s || !e) return null;
|
|
381
|
+
const r = this.nodes.find((v) => v.id === t.source), o = this.nodes.find((v) => v.id === t.target);
|
|
382
|
+
if (r?.hidden || o?.hidden) return null;
|
|
383
|
+
const i = (s.internals.handleBounds?.source || []).find(
|
|
384
|
+
(v) => v.id === (t.sourceHandle || null)
|
|
385
|
+
) || s.internals.handleBounds?.source?.[0] || {
|
|
385
386
|
id: null,
|
|
386
387
|
type: "source",
|
|
387
388
|
nodeId: t.source,
|
|
388
389
|
position: D.Bottom,
|
|
389
|
-
x: (
|
|
390
|
-
y:
|
|
390
|
+
x: (s.measured.width || 0) / 2,
|
|
391
|
+
y: s.measured.height || 0,
|
|
391
392
|
width: 1,
|
|
392
393
|
height: 1
|
|
393
394
|
}, n = (e.internals.handleBounds?.target || []).find(
|
|
394
|
-
(
|
|
395
|
+
(v) => v.id === (t.targetHandle || null)
|
|
395
396
|
) || e.internals.handleBounds?.target?.[0] || {
|
|
396
397
|
id: null,
|
|
397
398
|
type: "target",
|
|
@@ -401,51 +402,51 @@ let f = class extends j(P) {
|
|
|
401
402
|
y: 0,
|
|
402
403
|
width: 1,
|
|
403
404
|
height: 1
|
|
404
|
-
},
|
|
405
|
-
let a = "",
|
|
405
|
+
}, c = tt(s, i, i.position, !0), h = tt(e, n, n.position, !0);
|
|
406
|
+
let a = "", p = 0, l = 0;
|
|
406
407
|
const u = {
|
|
407
|
-
sourceX:
|
|
408
|
-
sourceY:
|
|
408
|
+
sourceX: c.x,
|
|
409
|
+
sourceY: c.y,
|
|
409
410
|
sourcePosition: i.position,
|
|
410
|
-
targetX:
|
|
411
|
-
targetY:
|
|
411
|
+
targetX: h.x,
|
|
412
|
+
targetY: h.y,
|
|
412
413
|
targetPosition: n.position
|
|
413
414
|
};
|
|
414
415
|
switch (t.type) {
|
|
415
416
|
case "straight":
|
|
416
|
-
[a,
|
|
417
|
+
[a, p, l] = ut(u);
|
|
417
418
|
break;
|
|
418
419
|
case "smoothstep":
|
|
419
|
-
[a,
|
|
420
|
+
[a, p, l] = et(u);
|
|
420
421
|
break;
|
|
421
422
|
case "step":
|
|
422
|
-
[a,
|
|
423
|
+
[a, p, l] = et({ ...u, borderRadius: 0 });
|
|
423
424
|
break;
|
|
424
425
|
default:
|
|
425
|
-
[a,
|
|
426
|
+
[a, p, l] = J(u);
|
|
426
427
|
break;
|
|
427
428
|
}
|
|
428
|
-
const
|
|
429
|
-
if (!
|
|
430
|
-
const
|
|
431
|
-
return
|
|
432
|
-
},
|
|
433
|
-
return
|
|
429
|
+
const g = (v) => {
|
|
430
|
+
if (!v) return null;
|
|
431
|
+
const C = typeof v == "string" ? v : v.type;
|
|
432
|
+
return C ? `lit-flow__${C}${t.selected ? "-selected" : ""}` : null;
|
|
433
|
+
}, _ = g(t.markerEnd), b = g(t.markerStart);
|
|
434
|
+
return Z`
|
|
434
435
|
<g class="xyflow__edge">
|
|
435
436
|
<path
|
|
436
437
|
d="${a}"
|
|
437
438
|
fill="none"
|
|
438
439
|
stroke="${t.selected ? "var(--md-sys-color-primary)" : "var(--md-sys-color-outline-variant)"}"
|
|
439
440
|
stroke-width="${t.selected ? "3" : "2"}"
|
|
440
|
-
marker-end="${
|
|
441
|
-
marker-start="${
|
|
441
|
+
marker-end="${_ ? `url(#${_})` : ""}"
|
|
442
|
+
marker-start="${b ? `url(#${b})` : ""}"
|
|
442
443
|
style="pointer-events: none; transition: stroke 0.2s ease-in-out, stroke-width 0.2s ease-in-out;"
|
|
443
444
|
/>
|
|
444
|
-
${t.label ?
|
|
445
|
+
${t.label ? Z`
|
|
445
446
|
<foreignObject
|
|
446
447
|
width="100"
|
|
447
448
|
height="30"
|
|
448
|
-
x="${
|
|
449
|
+
x="${p - 50}"
|
|
449
450
|
y="${l - 15}"
|
|
450
451
|
requiredExtensions="http://www.w3.org/1999/xhtml"
|
|
451
452
|
>
|
|
@@ -461,20 +462,20 @@ let f = class extends j(P) {
|
|
|
461
462
|
return t instanceof HTMLElement || t instanceof SVGElement ? !!(t === this._renderer || t.classList.contains("xyflow__viewport") || t.classList.contains("xyflow__edges") || t.classList.contains("xyflow__nodes")) : !1;
|
|
462
463
|
}
|
|
463
464
|
_onPointerDown(t) {
|
|
464
|
-
const
|
|
465
|
-
if (
|
|
465
|
+
const s = this._isPaneClick(t.target), e = t.shiftKey || this.selectionMode === "select";
|
|
466
|
+
if (s && e) {
|
|
466
467
|
console.log("LitFlow: Selection started", { x: t.clientX, y: t.clientY, shift: t.shiftKey });
|
|
467
|
-
const
|
|
468
|
+
const r = this._renderer.getBoundingClientRect();
|
|
468
469
|
this._selectionStart = {
|
|
469
|
-
x: t.clientX -
|
|
470
|
-
y: t.clientY -
|
|
470
|
+
x: t.clientX - r.left,
|
|
471
|
+
y: t.clientY - r.top
|
|
471
472
|
}, this._selectionRect = { x: this._selectionStart.x, y: this._selectionStart.y, width: 0, height: 0 }, this._updatePanZoom(!0), this._renderer.setPointerCapture(t.pointerId), t.stopImmediatePropagation();
|
|
472
473
|
}
|
|
473
474
|
}
|
|
474
475
|
_onPointerMove(t) {
|
|
475
476
|
if (this._selectionStart && this._renderer) {
|
|
476
|
-
const
|
|
477
|
-
this._selectionRect = { x:
|
|
477
|
+
const s = this._renderer.getBoundingClientRect(), e = t.clientX - s.left, r = t.clientY - s.top, o = Math.min(this._selectionStart.x, e), i = Math.min(this._selectionStart.y, r), n = Math.abs(this._selectionStart.x - e), c = Math.abs(this._selectionStart.y - r);
|
|
478
|
+
this._selectionRect = { x: o, y: i, width: n, height: c }, this._performSelection(t.shiftKey);
|
|
478
479
|
}
|
|
479
480
|
}
|
|
480
481
|
_onPointerUp(t) {
|
|
@@ -482,29 +483,29 @@ let f = class extends j(P) {
|
|
|
482
483
|
}
|
|
483
484
|
_performSelection(t) {
|
|
484
485
|
if (!this._selectionRect) return;
|
|
485
|
-
const
|
|
486
|
+
const s = this.project({ x: this._selectionRect.x, y: this._selectionRect.y }), e = this.project({
|
|
486
487
|
x: this._selectionRect.x + this._selectionRect.width,
|
|
487
488
|
y: this._selectionRect.y + this._selectionRect.height
|
|
488
|
-
}),
|
|
489
|
-
x: Math.min(
|
|
490
|
-
y: Math.min(
|
|
491
|
-
width: Math.abs(
|
|
492
|
-
height: Math.abs(
|
|
489
|
+
}), r = {
|
|
490
|
+
x: Math.min(s.x, e.x),
|
|
491
|
+
y: Math.min(s.y, e.y),
|
|
492
|
+
width: Math.abs(s.x - e.x),
|
|
493
|
+
height: Math.abs(s.y - e.y)
|
|
493
494
|
};
|
|
494
|
-
let
|
|
495
|
+
let o = !1;
|
|
495
496
|
const i = this.nodes.map((a) => {
|
|
496
|
-
const
|
|
497
|
-
if (!
|
|
498
|
-
const l =
|
|
499
|
-
return
|
|
497
|
+
const p = this._state.nodeLookup.get(a.id);
|
|
498
|
+
if (!p) return a;
|
|
499
|
+
const l = p.internals.positionAbsolute, u = p.measured.width || 0, g = p.measured.height || 0, b = l.x >= r.x && l.y >= r.y && l.x + u <= r.x + r.width && l.y + g <= r.y + r.height || t && a.selected;
|
|
500
|
+
return b !== !!a.selected ? (o = !0, { ...a, selected: b }) : a;
|
|
500
501
|
});
|
|
501
|
-
|
|
502
|
+
o && (this.nodes = i);
|
|
502
503
|
let n = !1;
|
|
503
|
-
const
|
|
504
|
-
const
|
|
505
|
-
return
|
|
504
|
+
const c = new Map(i.map((a) => [a.id, !!a.selected])), h = this.edges.map((a) => {
|
|
505
|
+
const p = c.get(a.source), l = c.get(a.target), g = p && l || t && a.selected;
|
|
506
|
+
return g !== !!a.selected ? (n = !0, { ...a, selected: g }) : a;
|
|
506
507
|
});
|
|
507
|
-
n && (this.edges =
|
|
508
|
+
n && (this.edges = h), (o || n) && this.dispatchEvent(new CustomEvent("selection-change", {
|
|
508
509
|
detail: {
|
|
509
510
|
nodes: this.nodes.filter((a) => a.selected),
|
|
510
511
|
edges: this.edges.filter((a) => a.selected)
|
|
@@ -512,27 +513,27 @@ let f = class extends j(P) {
|
|
|
512
513
|
}));
|
|
513
514
|
}
|
|
514
515
|
_onHandlePointerDown(t) {
|
|
515
|
-
const { event:
|
|
516
|
+
const { event: s, handleId: e, nodeId: r, type: o, handleDomNode: i } = t.detail, n = o === "target";
|
|
516
517
|
if (this._state.connectionInProgress.get() || !this.nodesConnectable)
|
|
517
518
|
return;
|
|
518
|
-
const
|
|
519
|
+
const c = i.getBoundingClientRect(), h = i.parentElement?.getBoundingClientRect(), a = this._state.transform.get()[2], p = {
|
|
519
520
|
id: e,
|
|
520
|
-
nodeId:
|
|
521
|
-
type:
|
|
521
|
+
nodeId: r,
|
|
522
|
+
type: o,
|
|
522
523
|
position: i.position,
|
|
523
|
-
x: (
|
|
524
|
-
y: (
|
|
525
|
-
width:
|
|
526
|
-
height:
|
|
524
|
+
x: (c.left - (h?.left ?? 0)) / a,
|
|
525
|
+
y: (c.top - (h?.top ?? 0)) / a,
|
|
526
|
+
width: c.width / a,
|
|
527
|
+
height: c.height / a
|
|
527
528
|
};
|
|
528
|
-
|
|
529
|
+
mt.onPointerDown(s, {
|
|
529
530
|
handleId: e,
|
|
530
|
-
nodeId:
|
|
531
|
+
nodeId: r,
|
|
531
532
|
isTarget: n,
|
|
532
533
|
domNode: this._renderer,
|
|
533
534
|
handleDomNode: i,
|
|
534
535
|
nodeLookup: this._state.nodeLookup,
|
|
535
|
-
connectionMode:
|
|
536
|
+
connectionMode: yt.Strict,
|
|
536
537
|
lib: "lit",
|
|
537
538
|
autoPanOnConnect: !0,
|
|
538
539
|
flowId: "lit-flow",
|
|
@@ -546,7 +547,7 @@ let f = class extends j(P) {
|
|
|
546
547
|
}), !0) : !1;
|
|
547
548
|
},
|
|
548
549
|
getTransform: () => this._state.transform.get(),
|
|
549
|
-
getFromHandle: () =>
|
|
550
|
+
getFromHandle: () => p,
|
|
550
551
|
updateConnection: (l) => {
|
|
551
552
|
l.inProgress ? this._state.connectionInProgress.set(l) : this._state.connectionInProgress.set(null);
|
|
552
553
|
},
|
|
@@ -568,24 +569,24 @@ let f = class extends j(P) {
|
|
|
568
569
|
}
|
|
569
570
|
_onDrop(t) {
|
|
570
571
|
t.preventDefault();
|
|
571
|
-
const
|
|
572
|
-
if (typeof
|
|
572
|
+
const s = t.dataTransfer?.getData("application/litflow");
|
|
573
|
+
if (typeof s > "u" || !s)
|
|
573
574
|
return;
|
|
574
|
-
const e = this.getBoundingClientRect(),
|
|
575
|
+
const e = this.getBoundingClientRect(), r = this.project({
|
|
575
576
|
x: t.clientX - e.left,
|
|
576
577
|
y: t.clientY - e.top
|
|
577
578
|
});
|
|
578
|
-
let
|
|
579
|
+
let o = `${s} node`;
|
|
579
580
|
if (this.promptOnDrop) {
|
|
580
|
-
const n = window.prompt("Enter node label:",
|
|
581
|
+
const n = window.prompt("Enter node label:", o);
|
|
581
582
|
if (n === null) return;
|
|
582
|
-
|
|
583
|
+
o = n || o;
|
|
583
584
|
}
|
|
584
585
|
const i = {
|
|
585
586
|
id: `node_${Date.now()}`,
|
|
586
|
-
type:
|
|
587
|
-
position:
|
|
588
|
-
data: { label:
|
|
587
|
+
type: s,
|
|
588
|
+
position: r,
|
|
589
|
+
data: { label: o }
|
|
589
590
|
};
|
|
590
591
|
this.nodes = [...this.nodes, i], this.dispatchEvent(new CustomEvent("node-drop", {
|
|
591
592
|
detail: { node: i, event: t }
|
|
@@ -593,7 +594,7 @@ let f = class extends j(P) {
|
|
|
593
594
|
}
|
|
594
595
|
_renderConnectionLine(t) {
|
|
595
596
|
if (!t) return null;
|
|
596
|
-
const [
|
|
597
|
+
const [s] = J({
|
|
597
598
|
sourceX: t.from.x,
|
|
598
599
|
sourceY: t.from.y,
|
|
599
600
|
sourcePosition: t.fromPosition,
|
|
@@ -601,10 +602,10 @@ let f = class extends j(P) {
|
|
|
601
602
|
targetY: t.to.y,
|
|
602
603
|
targetPosition: t.toPosition
|
|
603
604
|
});
|
|
604
|
-
return
|
|
605
|
+
return Z`
|
|
605
606
|
<path
|
|
606
607
|
class="xyflow__connection-path"
|
|
607
|
-
d="${
|
|
608
|
+
d="${s}"
|
|
608
609
|
fill="none"
|
|
609
610
|
stroke="#b1b1b7"
|
|
610
611
|
stroke-width="2"
|
|
@@ -615,13 +616,13 @@ let f = class extends j(P) {
|
|
|
615
616
|
_onKeyDown(t) {
|
|
616
617
|
if (!(t.target instanceof HTMLInputElement || t.target instanceof HTMLTextAreaElement || t.target.isContentEditable)) {
|
|
617
618
|
if (t.key === "Delete" || t.key === "Backspace") {
|
|
618
|
-
const
|
|
619
|
-
if (
|
|
620
|
-
const
|
|
619
|
+
const s = this.nodes.filter((r) => r.selected), e = this.edges.filter((r) => r.selected);
|
|
620
|
+
if (s.length > 0 || e.length > 0) {
|
|
621
|
+
const r = new Set(s.map((i) => i.id)), o = new Set(e.map((i) => i.id));
|
|
621
622
|
this.edges.forEach((i) => {
|
|
622
|
-
(
|
|
623
|
-
}), this.nodes = this.nodes.filter((i) => !
|
|
624
|
-
detail: { nodes:
|
|
623
|
+
(r.has(i.source) || r.has(i.target)) && o.add(i.id);
|
|
624
|
+
}), this.nodes = this.nodes.filter((i) => !r.has(i.id)), this.edges = this.edges.filter((i) => !o.has(i.id)), this.dispatchEvent(new CustomEvent("nodes-delete", {
|
|
625
|
+
detail: { nodes: s }
|
|
625
626
|
})), this.dispatchEvent(new CustomEvent("edges-delete", {
|
|
626
627
|
detail: { edges: e }
|
|
627
628
|
}));
|
|
@@ -629,23 +630,23 @@ let f = class extends j(P) {
|
|
|
629
630
|
}
|
|
630
631
|
if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key) && this.nodes.filter((e) => e.selected).length > 0) {
|
|
631
632
|
t.preventDefault();
|
|
632
|
-
const e = t.shiftKey ? 10 : 1,
|
|
633
|
+
const e = t.shiftKey ? 10 : 1, r = {
|
|
633
634
|
x: t.key === "ArrowLeft" ? -e : t.key === "ArrowRight" ? e : 0,
|
|
634
635
|
y: t.key === "ArrowUp" ? -e : t.key === "ArrowDown" ? e : 0
|
|
635
636
|
};
|
|
636
|
-
this.nodes = this.nodes.map((
|
|
637
|
-
...
|
|
637
|
+
this.nodes = this.nodes.map((o) => o.selected ? {
|
|
638
|
+
...o,
|
|
638
639
|
position: {
|
|
639
|
-
x:
|
|
640
|
-
y:
|
|
640
|
+
x: o.position.x + r.x,
|
|
641
|
+
y: o.position.y + r.y
|
|
641
642
|
}
|
|
642
|
-
} :
|
|
643
|
+
} : o);
|
|
643
644
|
}
|
|
644
645
|
}
|
|
645
646
|
}
|
|
646
647
|
render() {
|
|
647
|
-
const t = this._state.transform.get(),
|
|
648
|
-
return
|
|
648
|
+
const t = this._state.transform.get(), s = this._state.connectionInProgress.get();
|
|
649
|
+
return A`
|
|
649
650
|
<div
|
|
650
651
|
class="xyflow__renderer ${this.showGrid ? "has-grid" : ""}"
|
|
651
652
|
tabindex="0"
|
|
@@ -655,7 +656,7 @@ let f = class extends j(P) {
|
|
|
655
656
|
@pointermove="${this._onPointerMove}"
|
|
656
657
|
@pointerup="${this._onPointerUp}"
|
|
657
658
|
@click="${(e) => {
|
|
658
|
-
this._isPaneClick(e.target) && (this.nodes = this.nodes.map((
|
|
659
|
+
this._isPaneClick(e.target) && (this.nodes = this.nodes.map((r) => ({ ...r, selected: !1 })), this.edges = this.edges.map((r) => ({ ...r, selected: !1 })));
|
|
659
660
|
}}"
|
|
660
661
|
>
|
|
661
662
|
<div
|
|
@@ -665,14 +666,14 @@ let f = class extends j(P) {
|
|
|
665
666
|
<div class="xyflow__nodes" @handle-pointer-down="${this._onHandlePointerDown}">
|
|
666
667
|
${this.nodes.map((e) => {
|
|
667
668
|
if (e.hidden) return null;
|
|
668
|
-
const
|
|
669
|
-
return
|
|
669
|
+
const o = this._state.nodeLookup.get(e.id)?.internals.positionAbsolute || e.position, i = this.nodeTypes[e.type || "default"] || this.nodeTypes.default, n = at(i), c = e.style || {}, h = Object.entries(c).map(([_, b]) => `${_.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${typeof b == "number" ? `${b}px` : b}`).join("; "), a = e.width || c.width, p = e.height || c.height, l = a ? `width: ${typeof a == "number" ? `${a}px` : a};` : "", u = p ? `height: ${typeof p == "number" ? `${p}px` : p};` : "", g = e.zIndex ? `z-index: ${e.zIndex};` : "";
|
|
670
|
+
return A`
|
|
670
671
|
<${n}
|
|
671
672
|
class="xyflow__node"
|
|
672
673
|
data-id="${e.id}"
|
|
673
674
|
type="${e.type || "default"}"
|
|
674
675
|
.nodeId="${e.id}"
|
|
675
|
-
style="transform: translate(${
|
|
676
|
+
style="transform: translate(${o.x}px, ${o.y}px); ${h} ${l} ${u} ${g}"
|
|
676
677
|
.data="${e.data}"
|
|
677
678
|
.label="${e.data.label}"
|
|
678
679
|
.type="${e.type || "default"}"
|
|
@@ -687,7 +688,7 @@ let f = class extends j(P) {
|
|
|
687
688
|
<marker
|
|
688
689
|
id="lit-flow__arrow"
|
|
689
690
|
viewBox="0 0 10 10"
|
|
690
|
-
refX="
|
|
691
|
+
refX="9"
|
|
691
692
|
refY="5"
|
|
692
693
|
markerWidth="6"
|
|
693
694
|
markerHeight="6"
|
|
@@ -698,7 +699,7 @@ let f = class extends j(P) {
|
|
|
698
699
|
<marker
|
|
699
700
|
id="lit-flow__arrowclosed"
|
|
700
701
|
viewBox="0 0 10 10"
|
|
701
|
-
refX="
|
|
702
|
+
refX="9"
|
|
702
703
|
refY="5"
|
|
703
704
|
markerWidth="6"
|
|
704
705
|
markerHeight="6"
|
|
@@ -709,7 +710,7 @@ let f = class extends j(P) {
|
|
|
709
710
|
<marker
|
|
710
711
|
id="lit-flow__arrow-selected"
|
|
711
712
|
viewBox="0 0 10 10"
|
|
712
|
-
refX="
|
|
713
|
+
refX="9"
|
|
713
714
|
refY="5"
|
|
714
715
|
markerWidth="6"
|
|
715
716
|
markerHeight="6"
|
|
@@ -720,7 +721,7 @@ let f = class extends j(P) {
|
|
|
720
721
|
<marker
|
|
721
722
|
id="lit-flow__arrowclosed-selected"
|
|
722
723
|
viewBox="0 0 10 10"
|
|
723
|
-
refX="
|
|
724
|
+
refX="9"
|
|
724
725
|
refY="5"
|
|
725
726
|
markerWidth="6"
|
|
726
727
|
markerHeight="6"
|
|
@@ -730,18 +731,18 @@ let f = class extends j(P) {
|
|
|
730
731
|
</marker>
|
|
731
732
|
</defs>
|
|
732
733
|
${this.edges.map((e) => this._renderEdge(e))}
|
|
733
|
-
${this._renderConnectionLine(
|
|
734
|
+
${this._renderConnectionLine(s)}
|
|
734
735
|
</svg>
|
|
735
736
|
</div>
|
|
736
|
-
${this._selectionRect ?
|
|
737
|
+
${this._selectionRect ? A`
|
|
737
738
|
<div
|
|
738
739
|
class="xyflow__selection"
|
|
739
740
|
style="transform: translate(${this._selectionRect.x}px, ${this._selectionRect.y}px); width: ${this._selectionRect.width}px; height: ${this._selectionRect.height}px;"
|
|
740
741
|
></div>
|
|
741
742
|
` : ""}
|
|
742
743
|
</div>
|
|
743
|
-
${this.showControls ?
|
|
744
|
-
${this.showMinimap ?
|
|
744
|
+
${this.showControls ? A`<lit-controls .panZoom="${this._panZoom}" @fit-view="${() => this.fitView()}"></lit-controls>` : ""}
|
|
745
|
+
${this.showMinimap ? A`
|
|
745
746
|
<lit-minimap
|
|
746
747
|
.panZoom="${this._panZoom}"
|
|
747
748
|
.nodeLookup="${this._state.nodeLookup}"
|
|
@@ -755,9 +756,9 @@ let f = class extends j(P) {
|
|
|
755
756
|
`;
|
|
756
757
|
}
|
|
757
758
|
};
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
759
|
+
y.styles = [
|
|
760
|
+
Q,
|
|
761
|
+
B`
|
|
761
762
|
:host {
|
|
762
763
|
display: block;
|
|
763
764
|
width: 100%;
|
|
@@ -839,6 +840,16 @@ f.styles = [
|
|
|
839
840
|
pointer-events: all;
|
|
840
841
|
}
|
|
841
842
|
|
|
843
|
+
/* Remove default styling for schema nodes which handle their own layout */
|
|
844
|
+
.xyflow__node[type="schema"],
|
|
845
|
+
.xyflow__node[type="gemini-prompt"],
|
|
846
|
+
.xyflow__node[type="gemini-image"] {
|
|
847
|
+
padding: 0;
|
|
848
|
+
border: none;
|
|
849
|
+
background: none;
|
|
850
|
+
box-shadow: none;
|
|
851
|
+
}
|
|
852
|
+
|
|
842
853
|
.xyflow__node[selected] {
|
|
843
854
|
border-color: var(--lit-flow-node-selected-border);
|
|
844
855
|
border-width: 3px;
|
|
@@ -943,81 +954,81 @@ f.styles = [
|
|
|
943
954
|
}
|
|
944
955
|
`
|
|
945
956
|
];
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
],
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
],
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
],
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
],
|
|
958
|
-
|
|
957
|
+
f([
|
|
958
|
+
st(".xyflow__renderer")
|
|
959
|
+
], y.prototype, "_renderer", 2);
|
|
960
|
+
f([
|
|
961
|
+
st(".xyflow__viewport")
|
|
962
|
+
], y.prototype, "_viewport", 2);
|
|
963
|
+
f([
|
|
964
|
+
M()
|
|
965
|
+
], y.prototype, "_panZoom", 2);
|
|
966
|
+
f([
|
|
967
|
+
M()
|
|
968
|
+
], y.prototype, "_state", 2);
|
|
969
|
+
f([
|
|
959
970
|
d({ type: Object })
|
|
960
|
-
],
|
|
961
|
-
|
|
971
|
+
], y.prototype, "nodeTypes", 2);
|
|
972
|
+
f([
|
|
962
973
|
d({ type: Boolean, attribute: "show-controls", reflect: !0 })
|
|
963
|
-
],
|
|
964
|
-
|
|
965
|
-
d({ type: Boolean, attribute: "show-minimap", reflect: !0, converter:
|
|
966
|
-
],
|
|
967
|
-
|
|
968
|
-
d({ type: Boolean, attribute: "show-grid", reflect: !0, converter:
|
|
969
|
-
],
|
|
970
|
-
|
|
971
|
-
d({ type: Boolean, attribute: "nodes-draggable", reflect: !0, converter:
|
|
972
|
-
],
|
|
973
|
-
|
|
974
|
-
d({ type: Boolean, attribute: "nodes-connectable", reflect: !0, converter:
|
|
975
|
-
],
|
|
976
|
-
|
|
977
|
-
d({ type: Boolean, attribute: "pan-on-drag", reflect: !0, converter:
|
|
978
|
-
],
|
|
979
|
-
|
|
980
|
-
d({ type: Boolean, attribute: "zoom-on-scroll", reflect: !0, converter:
|
|
981
|
-
],
|
|
982
|
-
|
|
983
|
-
d({ type: Boolean, attribute: "zoom-on-pinch", reflect: !0, converter:
|
|
984
|
-
],
|
|
985
|
-
|
|
986
|
-
d({ type: Boolean, attribute: "zoom-on-double-click", reflect: !0, converter:
|
|
987
|
-
],
|
|
988
|
-
|
|
989
|
-
d({ type: Boolean, attribute: "prompt-on-drop", reflect: !0, converter:
|
|
990
|
-
],
|
|
991
|
-
|
|
974
|
+
], y.prototype, "showControls", 2);
|
|
975
|
+
f([
|
|
976
|
+
d({ type: Boolean, attribute: "show-minimap", reflect: !0, converter: S })
|
|
977
|
+
], y.prototype, "showMinimap", 2);
|
|
978
|
+
f([
|
|
979
|
+
d({ type: Boolean, attribute: "show-grid", reflect: !0, converter: S })
|
|
980
|
+
], y.prototype, "showGrid", 2);
|
|
981
|
+
f([
|
|
982
|
+
d({ type: Boolean, attribute: "nodes-draggable", reflect: !0, converter: S })
|
|
983
|
+
], y.prototype, "nodesDraggable", 2);
|
|
984
|
+
f([
|
|
985
|
+
d({ type: Boolean, attribute: "nodes-connectable", reflect: !0, converter: S })
|
|
986
|
+
], y.prototype, "nodesConnectable", 2);
|
|
987
|
+
f([
|
|
988
|
+
d({ type: Boolean, attribute: "pan-on-drag", reflect: !0, converter: S })
|
|
989
|
+
], y.prototype, "panOnDrag", 2);
|
|
990
|
+
f([
|
|
991
|
+
d({ type: Boolean, attribute: "zoom-on-scroll", reflect: !0, converter: S })
|
|
992
|
+
], y.prototype, "zoomOnScroll", 2);
|
|
993
|
+
f([
|
|
994
|
+
d({ type: Boolean, attribute: "zoom-on-pinch", reflect: !0, converter: S })
|
|
995
|
+
], y.prototype, "zoomOnPinch", 2);
|
|
996
|
+
f([
|
|
997
|
+
d({ type: Boolean, attribute: "zoom-on-double-click", reflect: !0, converter: S })
|
|
998
|
+
], y.prototype, "zoomOnDoubleClick", 2);
|
|
999
|
+
f([
|
|
1000
|
+
d({ type: Boolean, attribute: "prompt-on-drop", reflect: !0, converter: S })
|
|
1001
|
+
], y.prototype, "promptOnDrop", 2);
|
|
1002
|
+
f([
|
|
992
1003
|
d({ type: String, attribute: "selection-mode" })
|
|
993
|
-
],
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
],
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
],
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
],
|
|
1003
|
-
|
|
1004
|
+
], y.prototype, "selectionMode", 2);
|
|
1005
|
+
f([
|
|
1006
|
+
M()
|
|
1007
|
+
], y.prototype, "_selectionRect", 2);
|
|
1008
|
+
f([
|
|
1009
|
+
M()
|
|
1010
|
+
], y.prototype, "_width", 2);
|
|
1011
|
+
f([
|
|
1012
|
+
M()
|
|
1013
|
+
], y.prototype, "_height", 2);
|
|
1014
|
+
f([
|
|
1004
1015
|
d({ type: Array })
|
|
1005
|
-
],
|
|
1006
|
-
|
|
1016
|
+
], y.prototype, "nodes", 1);
|
|
1017
|
+
f([
|
|
1007
1018
|
d({ type: Array })
|
|
1008
|
-
],
|
|
1009
|
-
|
|
1019
|
+
], y.prototype, "edges", 1);
|
|
1020
|
+
f([
|
|
1010
1021
|
d({ type: Object })
|
|
1011
|
-
],
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
],
|
|
1015
|
-
var
|
|
1016
|
-
for (var
|
|
1017
|
-
(n = t[i]) && (
|
|
1018
|
-
return
|
|
1022
|
+
], y.prototype, "viewport", 2);
|
|
1023
|
+
y = f([
|
|
1024
|
+
w("lit-flow")
|
|
1025
|
+
], y);
|
|
1026
|
+
var St = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, X = (t, s, e, r) => {
|
|
1027
|
+
for (var o = r > 1 ? void 0 : r ? kt(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
1028
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
1029
|
+
return r && o && St(s, e, o), o;
|
|
1019
1030
|
};
|
|
1020
|
-
let
|
|
1031
|
+
let N = class extends x {
|
|
1021
1032
|
constructor() {
|
|
1022
1033
|
super(), this.type = "source", this.position = D.Top, this.addEventListener("mousedown", (t) => this._onPointerDown(t)), this.addEventListener("touchstart", (t) => this._onPointerDown(t));
|
|
1023
1034
|
}
|
|
@@ -1026,14 +1037,14 @@ let E = class extends P {
|
|
|
1026
1037
|
}
|
|
1027
1038
|
_onPointerDown(t) {
|
|
1028
1039
|
t.stopPropagation();
|
|
1029
|
-
const
|
|
1040
|
+
const s = this.getAttribute("data-nodeid");
|
|
1030
1041
|
this.dispatchEvent(new CustomEvent("handle-pointer-down", {
|
|
1031
1042
|
bubbles: !0,
|
|
1032
1043
|
composed: !0,
|
|
1033
1044
|
detail: {
|
|
1034
1045
|
event: t,
|
|
1035
1046
|
handleId: this.handleId,
|
|
1036
|
-
nodeId:
|
|
1047
|
+
nodeId: s,
|
|
1037
1048
|
type: this.type,
|
|
1038
1049
|
handleDomNode: this
|
|
1039
1050
|
}
|
|
@@ -1046,7 +1057,7 @@ let E = class extends P {
|
|
|
1046
1057
|
(t.has("nodeId") || t.has("handleId") || t.has("type")) && this.setAttribute("data-id", `lit-flow-${this.nodeId || ""}-${this.handleId || ""}-${this.type}`);
|
|
1047
1058
|
}
|
|
1048
1059
|
render() {
|
|
1049
|
-
return
|
|
1060
|
+
return m`
|
|
1050
1061
|
<div style="
|
|
1051
1062
|
width: 100%;
|
|
1052
1063
|
height: 100%;
|
|
@@ -1057,27 +1068,27 @@ let E = class extends P {
|
|
|
1057
1068
|
`;
|
|
1058
1069
|
}
|
|
1059
1070
|
};
|
|
1060
|
-
|
|
1071
|
+
X([
|
|
1061
1072
|
d({ type: String, reflect: !0 })
|
|
1062
|
-
],
|
|
1063
|
-
|
|
1073
|
+
], N.prototype, "type", 2);
|
|
1074
|
+
X([
|
|
1064
1075
|
d({ type: String, reflect: !0, attribute: "data-handlepos" })
|
|
1065
|
-
],
|
|
1066
|
-
|
|
1076
|
+
], N.prototype, "position", 2);
|
|
1077
|
+
X([
|
|
1067
1078
|
d({ type: String, reflect: !0, attribute: "data-handleid" })
|
|
1068
|
-
],
|
|
1069
|
-
|
|
1079
|
+
], N.prototype, "handleId", 2);
|
|
1080
|
+
X([
|
|
1070
1081
|
d({ type: String, reflect: !0, attribute: "data-nodeid" })
|
|
1071
|
-
],
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
],
|
|
1075
|
-
var
|
|
1076
|
-
for (var
|
|
1077
|
-
(n = t[i]) && (
|
|
1078
|
-
return
|
|
1082
|
+
], N.prototype, "nodeId", 2);
|
|
1083
|
+
N = X([
|
|
1084
|
+
w("lit-handle")
|
|
1085
|
+
], N);
|
|
1086
|
+
var zt = Object.defineProperty, It = Object.getOwnPropertyDescriptor, rt = (t, s, e, r) => {
|
|
1087
|
+
for (var o = r > 1 ? void 0 : r ? It(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
1088
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
1089
|
+
return r && o && zt(s, e, o), o;
|
|
1079
1090
|
};
|
|
1080
|
-
let
|
|
1091
|
+
let U = class extends H(x) {
|
|
1081
1092
|
_zoomIn() {
|
|
1082
1093
|
this.panZoom?.scaleBy(1.2);
|
|
1083
1094
|
}
|
|
@@ -1091,7 +1102,7 @@ let Y = class extends j(P) {
|
|
|
1091
1102
|
}));
|
|
1092
1103
|
}
|
|
1093
1104
|
render() {
|
|
1094
|
-
return
|
|
1105
|
+
return m`
|
|
1095
1106
|
<button @click="${this._zoomIn}" title="Zoom In">
|
|
1096
1107
|
<svg viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
|
|
1097
1108
|
</button>
|
|
@@ -1104,7 +1115,7 @@ let Y = class extends j(P) {
|
|
|
1104
1115
|
`;
|
|
1105
1116
|
}
|
|
1106
1117
|
};
|
|
1107
|
-
|
|
1118
|
+
U.styles = B`
|
|
1108
1119
|
:host {
|
|
1109
1120
|
display: block;
|
|
1110
1121
|
position: absolute;
|
|
@@ -1147,26 +1158,26 @@ Y.styles = A`
|
|
|
1147
1158
|
fill: currentColor;
|
|
1148
1159
|
}
|
|
1149
1160
|
`;
|
|
1150
|
-
|
|
1161
|
+
rt([
|
|
1151
1162
|
d({ type: Object })
|
|
1152
|
-
],
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
],
|
|
1156
|
-
var
|
|
1157
|
-
for (var
|
|
1158
|
-
(n = t[i]) && (
|
|
1159
|
-
return
|
|
1163
|
+
], U.prototype, "panZoom", 2);
|
|
1164
|
+
U = rt([
|
|
1165
|
+
w("lit-controls")
|
|
1166
|
+
], U);
|
|
1167
|
+
var Ct = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, I = (t, s, e, r) => {
|
|
1168
|
+
for (var o = r > 1 ? void 0 : r ? Dt(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
1169
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
1170
|
+
return r && o && Ct(s, e, o), o;
|
|
1160
1171
|
};
|
|
1161
|
-
let
|
|
1172
|
+
let O = class extends H(x) {
|
|
1162
1173
|
constructor() {
|
|
1163
1174
|
super(...arguments), this.nodeLookup = /* @__PURE__ */ new Map(), this.transform = [0, 0, 1], this.translateExtent = [[-1 / 0, -1 / 0], [1 / 0, 1 / 0]], this.width = 0, this.height = 0;
|
|
1164
1175
|
}
|
|
1165
1176
|
updated(t) {
|
|
1166
1177
|
if (!this._minimapInstance && this.panZoom) {
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
domNode:
|
|
1178
|
+
const s = this.shadowRoot?.querySelector("svg");
|
|
1179
|
+
s && (this._minimapInstance = ft({
|
|
1180
|
+
domNode: s,
|
|
1170
1181
|
panZoom: this.panZoom,
|
|
1171
1182
|
getTransform: () => this.transform,
|
|
1172
1183
|
getViewScale: () => {
|
|
@@ -1188,30 +1199,30 @@ let x = class extends j(P) {
|
|
|
1188
1199
|
width: this.width / this.transform[2],
|
|
1189
1200
|
height: this.height / this.transform[2]
|
|
1190
1201
|
};
|
|
1191
|
-
return this.nodeLookup.size > 0 ?
|
|
1202
|
+
return this.nodeLookup.size > 0 ? gt(vt(this.nodeLookup), t) : t;
|
|
1192
1203
|
}
|
|
1193
1204
|
render() {
|
|
1194
|
-
const t = this._getBoundingRect(),
|
|
1205
|
+
const t = this._getBoundingRect(), s = {
|
|
1195
1206
|
x: -this.transform[0] / this.transform[2],
|
|
1196
1207
|
y: -this.transform[1] / this.transform[2],
|
|
1197
1208
|
width: this.width / this.transform[2],
|
|
1198
1209
|
height: this.height / this.transform[2]
|
|
1199
|
-
}, e = 200,
|
|
1200
|
-
return
|
|
1210
|
+
}, e = 200, r = 150, o = t.width / e, i = t.height / r, n = Math.max(o, i), c = n * e, h = n * r, a = 5 * n, p = t.x - (c - t.width) / 2 - a, l = t.y - (h - t.height) / 2 - a, u = c + a * 2, g = h + a * 2;
|
|
1211
|
+
return m`
|
|
1201
1212
|
<svg
|
|
1202
1213
|
width="${e}"
|
|
1203
|
-
height="${
|
|
1204
|
-
viewBox="${
|
|
1214
|
+
height="${r}"
|
|
1215
|
+
viewBox="${p} ${l} ${u} ${g}"
|
|
1205
1216
|
>
|
|
1206
|
-
${Array.from(this.nodeLookup.values()).map((
|
|
1207
|
-
const { x:
|
|
1208
|
-
return
|
|
1217
|
+
${Array.from(this.nodeLookup.values()).map((_) => {
|
|
1218
|
+
const { x: b, y: v } = _.internals.positionAbsolute, C = _.measured.width || 0, F = _.measured.height || 0;
|
|
1219
|
+
return Z`
|
|
1209
1220
|
<rect
|
|
1210
1221
|
class="minimap-node"
|
|
1211
|
-
x="${
|
|
1212
|
-
y="${
|
|
1213
|
-
width="${
|
|
1214
|
-
height="${
|
|
1222
|
+
x="${b}"
|
|
1223
|
+
y="${v}"
|
|
1224
|
+
width="${C}"
|
|
1225
|
+
height="${F}"
|
|
1215
1226
|
rx="2"
|
|
1216
1227
|
ry="2"
|
|
1217
1228
|
/>
|
|
@@ -1219,14 +1230,14 @@ let x = class extends j(P) {
|
|
|
1219
1230
|
})}
|
|
1220
1231
|
<path
|
|
1221
1232
|
class="minimap-mask"
|
|
1222
|
-
d="M${
|
|
1223
|
-
M${
|
|
1233
|
+
d="M${p - a},${l - a}h${u + a * 2}v${g + a * 2}h${-u - a * 2}z
|
|
1234
|
+
M${s.x},${s.y}h${s.width}v${s.height}h${-s.width}z"
|
|
1224
1235
|
/>
|
|
1225
1236
|
</svg>
|
|
1226
1237
|
`;
|
|
1227
1238
|
}
|
|
1228
1239
|
};
|
|
1229
|
-
|
|
1240
|
+
O.styles = B`
|
|
1230
1241
|
:host {
|
|
1231
1242
|
display: block;
|
|
1232
1243
|
position: absolute;
|
|
@@ -1255,36 +1266,36 @@ x.styles = A`
|
|
|
1255
1266
|
fill-rule: evenodd;
|
|
1256
1267
|
}
|
|
1257
1268
|
`;
|
|
1258
|
-
|
|
1269
|
+
I([
|
|
1259
1270
|
d({ type: Object })
|
|
1260
|
-
],
|
|
1261
|
-
|
|
1271
|
+
], O.prototype, "panZoom", 2);
|
|
1272
|
+
I([
|
|
1262
1273
|
d({ type: Object })
|
|
1263
|
-
],
|
|
1264
|
-
|
|
1274
|
+
], O.prototype, "nodeLookup", 2);
|
|
1275
|
+
I([
|
|
1265
1276
|
d({ type: Array })
|
|
1266
|
-
],
|
|
1267
|
-
|
|
1277
|
+
], O.prototype, "transform", 2);
|
|
1278
|
+
I([
|
|
1268
1279
|
d({ type: Array })
|
|
1269
|
-
],
|
|
1270
|
-
|
|
1280
|
+
], O.prototype, "translateExtent", 2);
|
|
1281
|
+
I([
|
|
1271
1282
|
d({ type: Number })
|
|
1272
|
-
],
|
|
1273
|
-
|
|
1283
|
+
], O.prototype, "width", 2);
|
|
1284
|
+
I([
|
|
1274
1285
|
d({ type: Number })
|
|
1275
|
-
],
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
],
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
],
|
|
1282
|
-
var
|
|
1283
|
-
for (var
|
|
1284
|
-
(n = t[i]) && (
|
|
1285
|
-
return
|
|
1286
|
+
], O.prototype, "height", 2);
|
|
1287
|
+
I([
|
|
1288
|
+
M()
|
|
1289
|
+
], O.prototype, "_minimapInstance", 2);
|
|
1290
|
+
O = I([
|
|
1291
|
+
w("lit-minimap")
|
|
1292
|
+
], O);
|
|
1293
|
+
var Et = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, it = (t, s, e, r) => {
|
|
1294
|
+
for (var o = r > 1 ? void 0 : r ? Lt(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
1295
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
1296
|
+
return r && o && Et(s, e, o), o;
|
|
1286
1297
|
};
|
|
1287
|
-
let
|
|
1298
|
+
let W = class extends x {
|
|
1288
1299
|
constructor() {
|
|
1289
1300
|
super(...arguments), this.nodeTypes = [
|
|
1290
1301
|
{ type: "default", label: "Default Node" },
|
|
@@ -1292,19 +1303,19 @@ let T = class extends P {
|
|
|
1292
1303
|
{ type: "output", label: "Output Node" }
|
|
1293
1304
|
];
|
|
1294
1305
|
}
|
|
1295
|
-
_onDragStart(t,
|
|
1296
|
-
t.dataTransfer && (t.dataTransfer.setData("application/litflow",
|
|
1306
|
+
_onDragStart(t, s) {
|
|
1307
|
+
t.dataTransfer && (t.dataTransfer.setData("application/litflow", s), t.dataTransfer.effectAllowed = "move");
|
|
1297
1308
|
}
|
|
1298
1309
|
render() {
|
|
1299
|
-
return
|
|
1310
|
+
return m`
|
|
1300
1311
|
<div class="sidebar-title">Node Palette</div>
|
|
1301
1312
|
<div class="node-palette">
|
|
1302
1313
|
${this.nodeTypes.map(
|
|
1303
|
-
(t) =>
|
|
1314
|
+
(t) => m`
|
|
1304
1315
|
<div
|
|
1305
1316
|
class="palette-item"
|
|
1306
1317
|
draggable="true"
|
|
1307
|
-
@dragstart="${(
|
|
1318
|
+
@dragstart="${(s) => this._onDragStart(s, t.type)}"
|
|
1308
1319
|
>
|
|
1309
1320
|
${t.label}
|
|
1310
1321
|
</div>
|
|
@@ -1314,9 +1325,9 @@ let T = class extends P {
|
|
|
1314
1325
|
`;
|
|
1315
1326
|
}
|
|
1316
1327
|
};
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1328
|
+
W.styles = [
|
|
1329
|
+
Q,
|
|
1330
|
+
B`
|
|
1320
1331
|
:host {
|
|
1321
1332
|
display: block;
|
|
1322
1333
|
width: 200px;
|
|
@@ -1364,18 +1375,18 @@ T.styles = [
|
|
|
1364
1375
|
}
|
|
1365
1376
|
`
|
|
1366
1377
|
];
|
|
1367
|
-
|
|
1378
|
+
it([
|
|
1368
1379
|
d({ type: Array })
|
|
1369
|
-
],
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
],
|
|
1373
|
-
var
|
|
1374
|
-
for (var
|
|
1375
|
-
(n = t[i]) && (
|
|
1376
|
-
return
|
|
1380
|
+
], W.prototype, "nodeTypes", 2);
|
|
1381
|
+
W = it([
|
|
1382
|
+
w("lit-sidebar")
|
|
1383
|
+
], W);
|
|
1384
|
+
var Nt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, K = (t, s, e, r) => {
|
|
1385
|
+
for (var o = r > 1 ? void 0 : r ? Rt(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
1386
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
1387
|
+
return r && o && Nt(s, e, o), o;
|
|
1377
1388
|
};
|
|
1378
|
-
let
|
|
1389
|
+
let Y = class extends x {
|
|
1379
1390
|
constructor() {
|
|
1380
1391
|
super(...arguments), this.nodeId = "", this._data = {}, this.prompt = "";
|
|
1381
1392
|
}
|
|
@@ -1389,15 +1400,15 @@ let M = class extends P {
|
|
|
1389
1400
|
return this._data;
|
|
1390
1401
|
}
|
|
1391
1402
|
_onInput(t) {
|
|
1392
|
-
const
|
|
1393
|
-
this.prompt =
|
|
1403
|
+
const s = t.target;
|
|
1404
|
+
this.prompt = s.value, this.dispatchEvent(new CustomEvent("node-data-change", {
|
|
1394
1405
|
bubbles: !0,
|
|
1395
1406
|
composed: !0,
|
|
1396
1407
|
detail: { id: this.nodeId, data: { prompt: this.prompt } }
|
|
1397
1408
|
}));
|
|
1398
1409
|
}
|
|
1399
1410
|
render() {
|
|
1400
|
-
return
|
|
1411
|
+
return m`
|
|
1401
1412
|
<div class="gemini-node prompt-node" style="
|
|
1402
1413
|
padding: 12px;
|
|
1403
1414
|
background: var(--md-sys-color-surface-container-high);
|
|
@@ -1453,24 +1464,24 @@ let M = class extends P {
|
|
|
1453
1464
|
`;
|
|
1454
1465
|
}
|
|
1455
1466
|
};
|
|
1456
|
-
|
|
1467
|
+
K([
|
|
1457
1468
|
d({ type: String, attribute: "data-id", reflect: !0 })
|
|
1458
|
-
],
|
|
1459
|
-
|
|
1469
|
+
], Y.prototype, "nodeId", 2);
|
|
1470
|
+
K([
|
|
1460
1471
|
d({ type: Object })
|
|
1461
|
-
],
|
|
1462
|
-
|
|
1472
|
+
], Y.prototype, "data", 1);
|
|
1473
|
+
K([
|
|
1463
1474
|
d({ type: String })
|
|
1464
|
-
],
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
],
|
|
1468
|
-
var
|
|
1469
|
-
for (var
|
|
1470
|
-
(n = t[i]) && (
|
|
1471
|
-
return
|
|
1475
|
+
], Y.prototype, "prompt", 2);
|
|
1476
|
+
Y = K([
|
|
1477
|
+
w("lit-gemini-prompt-node")
|
|
1478
|
+
], Y);
|
|
1479
|
+
var Bt = Object.defineProperty, Mt = Object.getOwnPropertyDescriptor, T = (t, s, e, r) => {
|
|
1480
|
+
for (var o = r > 1 ? void 0 : r ? Mt(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
1481
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
1482
|
+
return r && o && Bt(s, e, o), o;
|
|
1472
1483
|
};
|
|
1473
|
-
let
|
|
1484
|
+
let R = class extends x {
|
|
1474
1485
|
constructor() {
|
|
1475
1486
|
super(...arguments), this.nodeId = "", this._data = {}, this.imageUrl = "", this.status = "idle";
|
|
1476
1487
|
}
|
|
@@ -1484,7 +1495,7 @@ let L = class extends P {
|
|
|
1484
1495
|
return this._data;
|
|
1485
1496
|
}
|
|
1486
1497
|
render() {
|
|
1487
|
-
return
|
|
1498
|
+
return m`
|
|
1488
1499
|
<div class="gemini-node image-node" style="
|
|
1489
1500
|
padding: 12px;
|
|
1490
1501
|
background: var(--md-sys-color-surface-container-high);
|
|
@@ -1513,7 +1524,7 @@ let L = class extends P {
|
|
|
1513
1524
|
overflow: hidden;
|
|
1514
1525
|
border: 1px dashed var(--md-sys-color-outline);
|
|
1515
1526
|
">
|
|
1516
|
-
${this.status === "loading" ?
|
|
1527
|
+
${this.status === "loading" ? m`<div style="font-size: 12px; color: var(--md-sys-color-outline);">Generating...</div>` : this.imageUrl ? m`<img src="${this.imageUrl}" style="width: 100%; height: 100%; object-fit: cover;" />` : m`<div style="font-size: 12px; color: var(--md-sys-color-outline);">No image generated</div>`}
|
|
1517
1528
|
</div>
|
|
1518
1529
|
|
|
1519
1530
|
<lit-handle type="target" data-handlepos="${D.Top}" data-nodeid="${this.nodeId}"></lit-handle>
|
|
@@ -1521,32 +1532,287 @@ let L = class extends P {
|
|
|
1521
1532
|
`;
|
|
1522
1533
|
}
|
|
1523
1534
|
};
|
|
1524
|
-
|
|
1535
|
+
T([
|
|
1525
1536
|
d({ type: String, attribute: "data-id", reflect: !0 })
|
|
1526
|
-
],
|
|
1527
|
-
|
|
1537
|
+
], R.prototype, "nodeId", 2);
|
|
1538
|
+
T([
|
|
1528
1539
|
d({ type: Object })
|
|
1529
|
-
],
|
|
1530
|
-
|
|
1540
|
+
], R.prototype, "data", 1);
|
|
1541
|
+
T([
|
|
1542
|
+
d({ type: String })
|
|
1543
|
+
], R.prototype, "imageUrl", 2);
|
|
1544
|
+
T([
|
|
1545
|
+
d({ type: String })
|
|
1546
|
+
], R.prototype, "status", 2);
|
|
1547
|
+
R = T([
|
|
1548
|
+
w("lit-gemini-image-node")
|
|
1549
|
+
], R);
|
|
1550
|
+
var jt = Object.defineProperty, At = Object.getOwnPropertyDescriptor, V = (t, s, e, r) => {
|
|
1551
|
+
for (var o = r > 1 ? void 0 : r ? At(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
1552
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
1553
|
+
return r && o && jt(s, e, o), o;
|
|
1554
|
+
};
|
|
1555
|
+
let E = class extends x {
|
|
1556
|
+
constructor() {
|
|
1557
|
+
super(...arguments), this.label = "", this.value = "", this.type = "default", this.icon = "📄";
|
|
1558
|
+
}
|
|
1559
|
+
render() {
|
|
1560
|
+
return m`
|
|
1561
|
+
${this.icon ? m`<span class="icon">${this.icon}</span>` : ""}
|
|
1562
|
+
${this.label ? m`<span class="label">${this.label}:</span>` : ""}
|
|
1563
|
+
<span class="value">${this.value || "..."}</span>
|
|
1564
|
+
`;
|
|
1565
|
+
}
|
|
1566
|
+
};
|
|
1567
|
+
E.styles = [
|
|
1568
|
+
Q,
|
|
1569
|
+
B`
|
|
1570
|
+
:host {
|
|
1571
|
+
display: inline-flex;
|
|
1572
|
+
align-items: center;
|
|
1573
|
+
gap: 6px;
|
|
1574
|
+
padding: 4px 10px;
|
|
1575
|
+
background: var(--md-sys-color-secondary-container);
|
|
1576
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
1577
|
+
border-radius: 16px;
|
|
1578
|
+
font-family: var(--md-sys-typescale-body-medium-font);
|
|
1579
|
+
font-size: 11px;
|
|
1580
|
+
line-height: 1;
|
|
1581
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
1582
|
+
white-space: nowrap;
|
|
1583
|
+
user-select: none;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
.icon {
|
|
1587
|
+
font-size: 14px;
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
.value {
|
|
1591
|
+
font-weight: 500;
|
|
1592
|
+
max-width: 120px;
|
|
1593
|
+
overflow: hidden;
|
|
1594
|
+
text-overflow: ellipsis;
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
:host([type="generative"]) {
|
|
1598
|
+
background: #f3e5f5; /* Light Purple fallback */
|
|
1599
|
+
color: #4a148c;
|
|
1600
|
+
border-color: #ce93d8;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
:host([type="input"]) {
|
|
1604
|
+
background: var(--md-sys-color-primary-container);
|
|
1605
|
+
color: var(--md-sys-color-on-primary-container);
|
|
1606
|
+
}
|
|
1607
|
+
`
|
|
1608
|
+
];
|
|
1609
|
+
V([
|
|
1610
|
+
d({ type: String })
|
|
1611
|
+
], E.prototype, "label", 2);
|
|
1612
|
+
V([
|
|
1531
1613
|
d({ type: String })
|
|
1532
|
-
],
|
|
1533
|
-
|
|
1614
|
+
], E.prototype, "value", 2);
|
|
1615
|
+
V([
|
|
1616
|
+
d({ type: String, reflect: !0 })
|
|
1617
|
+
], E.prototype, "type", 2);
|
|
1618
|
+
V([
|
|
1619
|
+
d({ type: String })
|
|
1620
|
+
], E.prototype, "icon", 2);
|
|
1621
|
+
E = V([
|
|
1622
|
+
w("lit-chiclet")
|
|
1623
|
+
], E);
|
|
1624
|
+
var Zt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, j = (t, s, e, r) => {
|
|
1625
|
+
for (var o = r > 1 ? void 0 : r ? Yt(s, e) : s, i = t.length - 1, n; i >= 0; i--)
|
|
1626
|
+
(n = t[i]) && (o = (r ? n(s, e, o) : n(o)) || o);
|
|
1627
|
+
return r && o && Zt(s, e, o), o;
|
|
1628
|
+
};
|
|
1629
|
+
let L = class extends x {
|
|
1630
|
+
constructor() {
|
|
1631
|
+
super(...arguments), this.label = "Node", this.inputSchema = { properties: {} }, this.outputSchema = { properties: {} }, this.data = {}, this.status = "idle";
|
|
1632
|
+
}
|
|
1633
|
+
createRenderRoot() {
|
|
1634
|
+
return this;
|
|
1635
|
+
}
|
|
1636
|
+
render() {
|
|
1637
|
+
const t = this.inputSchema?.properties && Object.keys(this.inputSchema.properties).length > 0 ? this.inputSchema : this.data?.inputSchema || { properties: {} }, s = this.outputSchema?.properties && Object.keys(this.outputSchema.properties).length > 0 ? this.outputSchema : this.data?.outputSchema || { properties: {} }, e = Object.entries(t.properties || {}), r = Object.entries(s.properties || {});
|
|
1638
|
+
return m`
|
|
1639
|
+
<style>
|
|
1640
|
+
:host {
|
|
1641
|
+
--md-sys-color-surface-container: #f3edf7;
|
|
1642
|
+
--md-sys-color-on-surface: #1b1b1f;
|
|
1643
|
+
--md-sys-color-outline: #74777f;
|
|
1644
|
+
--md-sys-color-surface-container-high: #ece6f0;
|
|
1645
|
+
--md-sys-color-outline-variant: #c4c6d0;
|
|
1646
|
+
--md-sys-color-on-surface-variant: #44474f;
|
|
1647
|
+
--md-sys-color-primary: #005ac1;
|
|
1648
|
+
--md-sys-color-error: #ba1a1a;
|
|
1649
|
+
--md-sys-shape-corner-medium: 12px;
|
|
1650
|
+
--md-sys-elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
|
|
1651
|
+
display: block;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
.node-container {
|
|
1655
|
+
display: flex;
|
|
1656
|
+
flex-direction: column;
|
|
1657
|
+
min-width: 200px;
|
|
1658
|
+
background: var(--md-sys-color-surface-container);
|
|
1659
|
+
color: var(--md-sys-color-on-surface);
|
|
1660
|
+
border: 1px solid var(--md-sys-color-outline);
|
|
1661
|
+
border-radius: var(--md-sys-shape-corner-medium);
|
|
1662
|
+
box-shadow: var(--md-sys-elevation-1);
|
|
1663
|
+
box-sizing: border-box;
|
|
1664
|
+
position: relative;
|
|
1665
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
.node-container.working {
|
|
1669
|
+
border-color: var(--md-sys-color-primary);
|
|
1670
|
+
box-shadow: 0 0 8px rgba(0, 90, 193, 0.4);
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
.node-container.error {
|
|
1674
|
+
border-color: var(--md-sys-color-error);
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
/* Selected state style injection from parent would be needed, or we check attribute manually */
|
|
1678
|
+
:host([selected]) .node-container {
|
|
1679
|
+
border: 2px solid var(--md-sys-color-primary);
|
|
1680
|
+
margin: -1px;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
.header {
|
|
1684
|
+
background: var(--md-sys-color-surface-container-high);
|
|
1685
|
+
padding: 12px 16px;
|
|
1686
|
+
font-weight: 500;
|
|
1687
|
+
border-bottom: 1px solid var(--md-sys-color-outline-variant);
|
|
1688
|
+
display: flex;
|
|
1689
|
+
align-items: center;
|
|
1690
|
+
gap: 8px;
|
|
1691
|
+
border-radius: var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0 0;
|
|
1692
|
+
margin: 0;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
.content {
|
|
1696
|
+
padding: 16px;
|
|
1697
|
+
display: flex;
|
|
1698
|
+
flex-direction: column;
|
|
1699
|
+
gap: 12px;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
.port {
|
|
1703
|
+
position: relative;
|
|
1704
|
+
display: flex;
|
|
1705
|
+
align-items: center;
|
|
1706
|
+
min-height: 24px;
|
|
1707
|
+
width: 100%;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
.port.input {
|
|
1711
|
+
justify-content: flex-start;
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
.port.output {
|
|
1715
|
+
justify-content: flex-end;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
/* Handle Positioning */
|
|
1719
|
+
lit-handle {
|
|
1720
|
+
position: absolute;
|
|
1721
|
+
z-index: 10;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
.port.input lit-handle {
|
|
1725
|
+
left: -22px !important;
|
|
1726
|
+
top: 50%;
|
|
1727
|
+
transform: translateY(-50%);
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
.port.output lit-handle {
|
|
1731
|
+
left: auto !important;
|
|
1732
|
+
right: -22px !important;
|
|
1733
|
+
top: 50%;
|
|
1734
|
+
transform: translateY(-50%);
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
label {
|
|
1738
|
+
font-size: 12px;
|
|
1739
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
1740
|
+
pointer-events: none;
|
|
1741
|
+
}
|
|
1742
|
+
</style>
|
|
1743
|
+
<div class="node-container ${this.status}">
|
|
1744
|
+
<div class="header">
|
|
1745
|
+
<span class="icon">🧩</span>
|
|
1746
|
+
<span>${this.data?.label || this.label}</span>
|
|
1747
|
+
</div>
|
|
1748
|
+
<div class="content">
|
|
1749
|
+
${e.length > 0 ? m`
|
|
1750
|
+
<div class="inputs">
|
|
1751
|
+
${ot(e, ([o, i]) => m`
|
|
1752
|
+
<div class="port input">
|
|
1753
|
+
<lit-handle type="target" position="left" data-handleid="${o}" id="${o}"></lit-handle>
|
|
1754
|
+
${this.data?.[o] ? m`<lit-chiclet
|
|
1755
|
+
type="input"
|
|
1756
|
+
.label="${i.title || o}"
|
|
1757
|
+
.value="${this.data[o]}"
|
|
1758
|
+
icon="${i.behavior?.includes("llm-content") ? "✨" : "📄"}"
|
|
1759
|
+
></lit-chiclet>` : m`<label>${i.title || o}</label>`}
|
|
1760
|
+
</div>
|
|
1761
|
+
`)}
|
|
1762
|
+
</div>
|
|
1763
|
+
` : ""}
|
|
1764
|
+
|
|
1765
|
+
${r.length > 0 ? m`
|
|
1766
|
+
<div class="outputs">
|
|
1767
|
+
${ot(r, ([o, i]) => m`
|
|
1768
|
+
<div class="port output">
|
|
1769
|
+
${this.data?.[o] ? m`<lit-chiclet
|
|
1770
|
+
type="generative"
|
|
1771
|
+
.label="${i.title || o}"
|
|
1772
|
+
.value="${this.data[o]}"
|
|
1773
|
+
icon="🪄"
|
|
1774
|
+
></lit-chiclet>` : m`<label>${i.title || o}</label>`}
|
|
1775
|
+
<lit-handle type="source" position="right" data-handleid="${o}" id="${o}"></lit-handle>
|
|
1776
|
+
</div>
|
|
1777
|
+
`)}
|
|
1778
|
+
</div>
|
|
1779
|
+
` : ""}
|
|
1780
|
+
</div>
|
|
1781
|
+
</div>
|
|
1782
|
+
`;
|
|
1783
|
+
}
|
|
1784
|
+
};
|
|
1785
|
+
j([
|
|
1786
|
+
d({ type: String })
|
|
1787
|
+
], L.prototype, "label", 2);
|
|
1788
|
+
j([
|
|
1789
|
+
d({ type: Object })
|
|
1790
|
+
], L.prototype, "inputSchema", 2);
|
|
1791
|
+
j([
|
|
1792
|
+
d({ type: Object })
|
|
1793
|
+
], L.prototype, "outputSchema", 2);
|
|
1794
|
+
j([
|
|
1795
|
+
d({ type: Object })
|
|
1796
|
+
], L.prototype, "data", 2);
|
|
1797
|
+
j([
|
|
1534
1798
|
d({ type: String })
|
|
1535
1799
|
], L.prototype, "status", 2);
|
|
1536
|
-
L =
|
|
1537
|
-
|
|
1800
|
+
L = j([
|
|
1801
|
+
w("lit-schema-node")
|
|
1538
1802
|
], L);
|
|
1539
1803
|
export {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1804
|
+
E as LitChiclet,
|
|
1805
|
+
U as LitControls,
|
|
1806
|
+
$ as LitEdge,
|
|
1807
|
+
y as LitFlow,
|
|
1808
|
+
R as LitGeminiImageNode,
|
|
1809
|
+
Y as LitGeminiPromptNode,
|
|
1810
|
+
N as LitHandle,
|
|
1811
|
+
O as LitMinimap,
|
|
1812
|
+
P as LitNode,
|
|
1813
|
+
L as LitSchemaNode,
|
|
1814
|
+
W as LitSidebar,
|
|
1815
|
+
bt as createInitialState,
|
|
1816
|
+
Q as m3Tokens
|
|
1551
1817
|
};
|
|
1552
1818
|
//# sourceMappingURL=litflow.js.map
|