@bian-womp/spark-workbench 0.2.80 → 0.2.81
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 +46 -1
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/index.d.ts +2 -0
- package/lib/cjs/src/index.d.ts.map +1 -1
- package/lib/cjs/src/misc/load.d.ts.map +1 -1
- package/lib/cjs/src/misc/merge-utils.d.ts +7 -0
- package/lib/cjs/src/misc/merge-utils.d.ts.map +1 -0
- package/lib/cjs/src/misc/types.d.ts +14 -0
- package/lib/cjs/src/misc/types.d.ts.map +1 -0
- package/lib/esm/index.js +46 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/index.d.ts +2 -0
- package/lib/esm/src/index.d.ts.map +1 -1
- package/lib/esm/src/misc/load.d.ts.map +1 -1
- package/lib/esm/src/misc/merge-utils.d.ts +7 -0
- package/lib/esm/src/misc/merge-utils.d.ts.map +1 -0
- package/lib/esm/src/misc/types.d.ts +14 -0
- package/lib/esm/src/misc/types.d.ts.map +1 -0
- package/package.json +4 -4
package/lib/cjs/src/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export * from "./misc/hooks";
|
|
|
12
12
|
export * from "./misc/mapping";
|
|
13
13
|
export * from "./misc/load";
|
|
14
14
|
export * from "./misc/viewport-utils";
|
|
15
|
+
export * from "./misc/types";
|
|
16
|
+
export * from "./misc/merge-utils";
|
|
15
17
|
export * from "./misc/context/WorkbenchContext";
|
|
16
18
|
export * from "./misc/context/WorkbenchContext.provider";
|
|
17
19
|
export * from "./misc/context-menu/ContextMenuHelpers";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AAGnC,cAAc,iCAAiC,CAAC;AAChD,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AAEvD,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../src/misc/load.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../src/misc/load.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAsC5D,wBAAsB,QAAQ,CAC5B,EAAE,EAAE,iBAAiB,EACrB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED,wBAAsB,MAAM,CAC1B,MAAM,EAAE,OAAO,EACf,EAAE,EAAE,iBAAiB,EACrB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CA6Cf"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkbenchUIState } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Merge UI state from source into target, remapping node IDs using nodeIdMap.
|
|
4
|
+
* Preserves target state and adds/updates source state with remapped IDs.
|
|
5
|
+
*/
|
|
6
|
+
export declare function mergeUIState(targetUI: WorkbenchUIState | null | undefined, sourceUI: WorkbenchUIState | null | undefined, nodeIdMap: Record<string, string>): WorkbenchUIState;
|
|
7
|
+
//# sourceMappingURL=merge-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-utils.d.ts","sourceRoot":"","sources":["../../../../src/misc/merge-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,EAC7C,QAAQ,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,EAC7C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,gBAAgB,CAgDlB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Viewport } from "@bian-womp/spark-protocol";
|
|
2
|
+
export interface WorkbenchUIState {
|
|
3
|
+
positions?: Record<string, {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}>;
|
|
7
|
+
selection?: {
|
|
8
|
+
nodes: string[];
|
|
9
|
+
edges: string[];
|
|
10
|
+
};
|
|
11
|
+
nodeNames?: Record<string, string>;
|
|
12
|
+
viewport?: Viewport;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/misc/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB"}
|
package/lib/esm/index.js
CHANGED
|
@@ -2770,6 +2770,50 @@ async function upload(parsed, wb, runner) {
|
|
|
2770
2770
|
}
|
|
2771
2771
|
}
|
|
2772
2772
|
|
|
2773
|
+
/**
|
|
2774
|
+
* Merge UI state from source into target, remapping node IDs using nodeIdMap.
|
|
2775
|
+
* Preserves target state and adds/updates source state with remapped IDs.
|
|
2776
|
+
*/
|
|
2777
|
+
function mergeUIState(targetUI, sourceUI, nodeIdMap) {
|
|
2778
|
+
const result = {
|
|
2779
|
+
...targetUI,
|
|
2780
|
+
};
|
|
2781
|
+
if (!sourceUI)
|
|
2782
|
+
return result;
|
|
2783
|
+
// Merge positions (already handled by mergeSnapshotData, but included for completeness)
|
|
2784
|
+
if (sourceUI.positions) {
|
|
2785
|
+
result.positions = {
|
|
2786
|
+
...(targetUI?.positions || {}),
|
|
2787
|
+
...Object.fromEntries(Object.entries(sourceUI.positions).map(([oldId, pos]) => [
|
|
2788
|
+
nodeIdMap[oldId] || oldId,
|
|
2789
|
+
pos,
|
|
2790
|
+
])),
|
|
2791
|
+
};
|
|
2792
|
+
}
|
|
2793
|
+
// Merge selection: remap node IDs and edge IDs
|
|
2794
|
+
if (sourceUI.selection) {
|
|
2795
|
+
const remappedNodes = (sourceUI.selection.nodes || [])
|
|
2796
|
+
.map((id) => nodeIdMap[id] || id)
|
|
2797
|
+
.filter((id) => id); // Filter out invalid mappings
|
|
2798
|
+
const remappedEdges = sourceUI.selection.edges || []; // Edge IDs don't need remapping typically
|
|
2799
|
+
result.selection = {
|
|
2800
|
+
nodes: [...(targetUI?.selection?.nodes || []), ...remappedNodes],
|
|
2801
|
+
edges: [...(targetUI?.selection?.edges || []), ...remappedEdges],
|
|
2802
|
+
};
|
|
2803
|
+
}
|
|
2804
|
+
// Merge nodeNames: remap node IDs
|
|
2805
|
+
if (sourceUI.nodeNames) {
|
|
2806
|
+
result.nodeNames = {
|
|
2807
|
+
...(targetUI?.nodeNames || {}),
|
|
2808
|
+
...Object.fromEntries(Object.entries(sourceUI.nodeNames).map(([oldId, name]) => [
|
|
2809
|
+
nodeIdMap[oldId] || oldId,
|
|
2810
|
+
name,
|
|
2811
|
+
])),
|
|
2812
|
+
};
|
|
2813
|
+
}
|
|
2814
|
+
return result;
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2773
2817
|
const WorkbenchContext = createContext(null);
|
|
2774
2818
|
function useWorkbenchContext() {
|
|
2775
2819
|
const ctx = useContext(WorkbenchContext);
|
|
@@ -4291,7 +4335,7 @@ function DefaultNodeHeader({ id, typeId, title, validation, right, showId, onInv
|
|
|
4291
4335
|
const [editValue, setEditValue] = React.useState("");
|
|
4292
4336
|
const inputRef = React.useRef(null);
|
|
4293
4337
|
// Use getNodeDisplayName if typeId is provided, otherwise use title prop
|
|
4294
|
-
const displayName = typeId ? ctx.getNodeDisplayName(id) :
|
|
4338
|
+
const displayName = typeId ? ctx.getNodeDisplayName(id) : title ?? id;
|
|
4295
4339
|
const effectiveTypeId = typeId ?? title ?? id;
|
|
4296
4340
|
// Get the default display name (without custom name) for comparison
|
|
4297
4341
|
const getDefaultDisplayName = React.useCallback(() => {
|
|
@@ -5832,5 +5876,5 @@ function WorkbenchStudio({ engine, onEngineChange, example, onExampleChange, bac
|
|
|
5832
5876
|
return (jsx(WorkbenchProvider, { wb: wb, runner: runner, registry: registry, setRegistry: setRegistry, overrides: overrides, uiVersion: uiVersion, children: jsx(WorkbenchStudioCanvas, { setRegistry: setRegistry, autoScroll: autoScroll, onAutoScrollChange: onAutoScrollChange, example: example, onExampleChange: onExampleChange, engine: engine, onEngineChange: onEngineChange, backendKind: backendKind, onBackendKindChange: onBackendKindChangeWithDispose, httpBaseUrl: httpBaseUrl, onHttpBaseUrlChange: onHttpBaseUrlChange, wsUrl: wsUrl, onWsUrlChange: onWsUrlChange, debug: debug, onDebugChange: onDebugChange, showValues: showValues, onShowValuesChange: onShowValuesChange, hideWorkbench: hideWorkbench, onHideWorkbenchChange: onHideWorkbenchChange, overrides: overrides, onInit: onInit, onChange: onChange }) }));
|
|
5833
5877
|
}
|
|
5834
5878
|
|
|
5835
|
-
export { AbstractWorkbench, CLIWorkbench, DefaultNode, DefaultNodeContent, DefaultNodeHeader, DefaultUIExtensionRegistry, InMemoryWorkbench, Inspector, LocalGraphRunner, NodeHandles, RemoteGraphRunner, WorkbenchCanvas, WorkbenchContext, WorkbenchProvider, WorkbenchStudio, computeEffectiveHandles, countVisibleHandles, createCopyHandler, createDefaultContextMenuHandlers, createHandleBounds, createHandleLayout, createNodeContextMenuHandlers, createNodeCopyHandler, createSelectionContextMenuHandlers, download, estimateNodeSize, excludeViewportFromUIState, formatDataUrlAsLabel, formatDeclaredTypeSignature, getBakeableOutputs, getHandleBoundsX, getHandleBoundsY, getHandleClassName, getHandleLayoutY, getNodeBorderClassNames, isValidViewport, layoutNode, preformatValueForDisplay, prettyHandle, resolveOutputDisplay, summarizeDeep, toReactFlow, upload, useQueryParamBoolean, useQueryParamString, useThrottledValue, useWorkbenchBridge, useWorkbenchContext, useWorkbenchGraphTick, useWorkbenchGraphUiTick, useWorkbenchVersionTick };
|
|
5879
|
+
export { AbstractWorkbench, CLIWorkbench, DefaultNode, DefaultNodeContent, DefaultNodeHeader, DefaultUIExtensionRegistry, InMemoryWorkbench, Inspector, LocalGraphRunner, NodeHandles, RemoteGraphRunner, WorkbenchCanvas, WorkbenchContext, WorkbenchProvider, WorkbenchStudio, computeEffectiveHandles, countVisibleHandles, createCopyHandler, createDefaultContextMenuHandlers, createHandleBounds, createHandleLayout, createNodeContextMenuHandlers, createNodeCopyHandler, createSelectionContextMenuHandlers, download, estimateNodeSize, excludeViewportFromUIState, formatDataUrlAsLabel, formatDeclaredTypeSignature, getBakeableOutputs, getHandleBoundsX, getHandleBoundsY, getHandleClassName, getHandleLayoutY, getNodeBorderClassNames, isValidViewport, layoutNode, mergeUIState, preformatValueForDisplay, prettyHandle, resolveOutputDisplay, summarizeDeep, toReactFlow, upload, useQueryParamBoolean, useQueryParamString, useThrottledValue, useWorkbenchBridge, useWorkbenchContext, useWorkbenchGraphTick, useWorkbenchGraphUiTick, useWorkbenchVersionTick };
|
|
5836
5880
|
//# sourceMappingURL=index.js.map
|