@bian-womp/spark-workbench 0.2.3 → 0.2.4
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/lib/cjs/index.cjs +16 -2
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/misc/DefaultContextMenu.d.ts.map +1 -1
- package/lib/cjs/src/misc/context/WorkbenchContext.d.ts +1 -0
- package/lib/cjs/src/misc/context/WorkbenchContext.d.ts.map +1 -1
- package/lib/cjs/src/misc/context/WorkbenchContext.provider.d.ts.map +1 -1
- package/lib/cjs/src/runtime/AbstractGraphRunner.d.ts +1 -0
- package/lib/cjs/src/runtime/AbstractGraphRunner.d.ts.map +1 -1
- package/lib/cjs/src/runtime/IGraphRunner.d.ts +1 -0
- package/lib/cjs/src/runtime/IGraphRunner.d.ts.map +1 -1
- package/lib/cjs/src/runtime/RemoteGraphRunner.d.ts +1 -0
- package/lib/cjs/src/runtime/RemoteGraphRunner.d.ts.map +1 -1
- package/lib/esm/index.js +16 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/misc/DefaultContextMenu.d.ts.map +1 -1
- package/lib/esm/src/misc/context/WorkbenchContext.d.ts +1 -0
- package/lib/esm/src/misc/context/WorkbenchContext.d.ts.map +1 -1
- package/lib/esm/src/misc/context/WorkbenchContext.provider.d.ts.map +1 -1
- package/lib/esm/src/runtime/AbstractGraphRunner.d.ts +1 -0
- package/lib/esm/src/runtime/AbstractGraphRunner.d.ts.map +1 -1
- package/lib/esm/src/runtime/IGraphRunner.d.ts +1 -0
- package/lib/esm/src/runtime/IGraphRunner.d.ts.map +1 -1
- package/lib/esm/src/runtime/RemoteGraphRunner.d.ts +1 -0
- package/lib/esm/src/runtime/RemoteGraphRunner.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/cjs/index.cjs
CHANGED
|
@@ -350,6 +350,9 @@ class AbstractGraphRunner {
|
|
|
350
350
|
this.emit("value", { nodeId, handle, value, io: "input" });
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
+
triggerExternal(nodeId, event) {
|
|
354
|
+
this.engine?.triggerExternal(nodeId, event);
|
|
355
|
+
}
|
|
353
356
|
// Batch update multiple inputs on a node and trigger a single run
|
|
354
357
|
setInputs(nodeId, inputs) {
|
|
355
358
|
if (!inputs)
|
|
@@ -667,6 +670,14 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
667
670
|
flush() {
|
|
668
671
|
console.warn("Unsupported operation for remote runner");
|
|
669
672
|
}
|
|
673
|
+
triggerExternal(nodeId, event) {
|
|
674
|
+
this.ensureRemoteRunner().then(async (runner) => {
|
|
675
|
+
try {
|
|
676
|
+
await runner.getEngine().triggerExternal(nodeId, event);
|
|
677
|
+
}
|
|
678
|
+
catch { }
|
|
679
|
+
});
|
|
680
|
+
}
|
|
670
681
|
getOutputs(def) {
|
|
671
682
|
const out = {};
|
|
672
683
|
const cache = this.valueCache;
|
|
@@ -1392,6 +1403,7 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, children, }) {
|
|
|
1392
1403
|
wb.setPositions(pos);
|
|
1393
1404
|
}, [wb]);
|
|
1394
1405
|
const updateEdgeType = React.useCallback((edgeId, typeId) => wb.updateEdgeType(edgeId, typeId), [wb]);
|
|
1406
|
+
const triggerExternal = React.useCallback((nodeId, event) => runner.triggerExternal(nodeId, event), [runner]);
|
|
1395
1407
|
// Subscribe to runner/workbench events
|
|
1396
1408
|
React.useEffect(() => {
|
|
1397
1409
|
const add = (source, type) => (payload) => setEvents((prev) => {
|
|
@@ -1726,6 +1738,7 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, children, }) {
|
|
|
1726
1738
|
flush,
|
|
1727
1739
|
runAutoLayout,
|
|
1728
1740
|
updateEdgeType,
|
|
1741
|
+
triggerExternal,
|
|
1729
1742
|
}), [
|
|
1730
1743
|
wb,
|
|
1731
1744
|
runner,
|
|
@@ -1753,6 +1766,7 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, children, }) {
|
|
|
1753
1766
|
flush,
|
|
1754
1767
|
runAutoLayout,
|
|
1755
1768
|
wb,
|
|
1769
|
+
runner,
|
|
1756
1770
|
]);
|
|
1757
1771
|
return (jsxRuntime.jsx(WorkbenchContext.Provider, { value: value, children: children }));
|
|
1758
1772
|
}
|
|
@@ -2123,10 +2137,10 @@ function DefaultContextMenu({ open, clientPos, onAdd, onClose, }) {
|
|
|
2123
2137
|
onClose();
|
|
2124
2138
|
};
|
|
2125
2139
|
const renderTree = (tree, path = []) => {
|
|
2126
|
-
const entries = Object.entries(tree
|
|
2140
|
+
const entries = Object.entries(tree?.__children ?? {}).sort((a, b) => a[0].localeCompare(b[0]));
|
|
2127
2141
|
return (jsxRuntime.jsx("div", { children: entries.map(([key, child]) => {
|
|
2128
2142
|
const label = key;
|
|
2129
|
-
const hasChildren = Object.keys(child.__children).length > 0;
|
|
2143
|
+
const hasChildren = !!child?.__children && Object.keys(child.__children).length > 0;
|
|
2130
2144
|
const idKey = [...path, key].join(".");
|
|
2131
2145
|
if (!hasChildren) {
|
|
2132
2146
|
// Leaf: render only the action button, no group header
|