@bian-womp/spark-workbench 0.3.63 → 0.3.65
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 +18 -10
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/core/InMemoryWorkbench.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 -1
- package/lib/cjs/src/runtime/AbstractGraphRunner.d.ts.map +1 -1
- package/lib/cjs/src/runtime/IGraphRunner.d.ts +1 -1
- package/lib/cjs/src/runtime/IGraphRunner.d.ts.map +1 -1
- package/lib/cjs/src/runtime/LocalGraphRunner.d.ts +1 -1
- package/lib/cjs/src/runtime/LocalGraphRunner.d.ts.map +1 -1
- package/lib/cjs/src/runtime/RemoteGraphRunner.d.ts +1 -1
- package/lib/cjs/src/runtime/RemoteGraphRunner.d.ts.map +1 -1
- package/lib/esm/index.js +18 -10
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/core/InMemoryWorkbench.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 -1
- package/lib/esm/src/runtime/AbstractGraphRunner.d.ts.map +1 -1
- package/lib/esm/src/runtime/IGraphRunner.d.ts +1 -1
- package/lib/esm/src/runtime/IGraphRunner.d.ts.map +1 -1
- package/lib/esm/src/runtime/LocalGraphRunner.d.ts +1 -1
- package/lib/esm/src/runtime/LocalGraphRunner.d.ts.map +1 -1
- package/lib/esm/src/runtime/RemoteGraphRunner.d.ts +1 -1
- package/lib/esm/src/runtime/RemoteGraphRunner.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/cjs/index.cjs
CHANGED
|
@@ -416,8 +416,9 @@ class InMemoryWorkbench extends AbstractWorkbench {
|
|
|
416
416
|
setViewport(viewport) {
|
|
417
417
|
if (lod.isEqual(this.viewport, viewport))
|
|
418
418
|
return;
|
|
419
|
+
const init = this.viewport === null;
|
|
419
420
|
this.viewport = { ...viewport };
|
|
420
|
-
this.emit("graphUiChanged", { change: { type: "viewport" } });
|
|
421
|
+
this.emit("graphUiChanged", { change: { type: "viewport" }, init });
|
|
421
422
|
}
|
|
422
423
|
getViewport() {
|
|
423
424
|
return this.viewport ? { ...this.viewport } : null;
|
|
@@ -1371,10 +1372,15 @@ class LocalGraphRunner extends AbstractGraphRunner {
|
|
|
1371
1372
|
Array.isArray(this.extData)) {
|
|
1372
1373
|
this.extData = {};
|
|
1373
1374
|
}
|
|
1375
|
+
let hasCustomUpdate = false;
|
|
1374
1376
|
for (const { path, value } of updates) {
|
|
1375
1377
|
const pathSegments = sparkGraph.parseJsonPath(path);
|
|
1376
|
-
sparkGraph.setValueAtPathWithCreation(this.extData, pathSegments, value);
|
|
1378
|
+
const updated = sparkGraph.setValueAtPathWithCreation(this.extData, pathSegments, value);
|
|
1379
|
+
if (updated && pathSegments.length > 0 && pathSegments[0] === "custom") {
|
|
1380
|
+
hasCustomUpdate = true;
|
|
1381
|
+
}
|
|
1377
1382
|
}
|
|
1383
|
+
return hasCustomUpdate;
|
|
1378
1384
|
}
|
|
1379
1385
|
async snapshotFull() {
|
|
1380
1386
|
const def = undefined; // UI will supply def/positions on download for local
|
|
@@ -1687,7 +1693,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1687
1693
|
this.clientPromise = promise = (async () => {
|
|
1688
1694
|
// Build client config from backend config
|
|
1689
1695
|
const clientConfig = this.buildClientConfig(backend);
|
|
1690
|
-
// Wrap custom event handler to intercept
|
|
1696
|
+
// Wrap custom event handler to intercept viewport events and emit viewport event
|
|
1691
1697
|
const wrappedOnCustomEvent = (event) => {
|
|
1692
1698
|
const msg = event?.message;
|
|
1693
1699
|
if (msg &&
|
|
@@ -1979,7 +1985,7 @@ class RemoteGraphRunner extends AbstractGraphRunner {
|
|
|
1979
1985
|
}
|
|
1980
1986
|
async updateExtData(updates) {
|
|
1981
1987
|
const client = await this.ensureClient();
|
|
1982
|
-
await client.api.updateExtData(updates);
|
|
1988
|
+
return await client.api.updateExtData(updates);
|
|
1983
1989
|
}
|
|
1984
1990
|
async commit(reason) {
|
|
1985
1991
|
const client = await this.ensureClient();
|
|
@@ -4142,17 +4148,18 @@ function WorkbenchProvider({ wb, runner, overrides, uiVersion, children, }) {
|
|
|
4142
4148
|
// Helper to save runtime metadata and UI state to extData
|
|
4143
4149
|
const saveUiRuntimeMetadata = React.useCallback(async (workbench, graphRunner) => {
|
|
4144
4150
|
try {
|
|
4145
|
-
const
|
|
4146
|
-
const
|
|
4151
|
+
const currentRuntime = workbench.getRuntimeState() ?? { nodes: {} };
|
|
4152
|
+
const runtimeMetaData = { nodes: { ...currentRuntime.nodes } };
|
|
4153
|
+
const customMetaData = workbench.getCustomData();
|
|
4147
4154
|
// Clean up metadata for nodes that no longer exist
|
|
4148
4155
|
const nodeIds = new Set(workbench.def.nodes.map((n) => n.nodeId));
|
|
4149
|
-
for (const nodeId of Object.keys(
|
|
4156
|
+
for (const nodeId of Object.keys(runtimeMetaData.nodes)) {
|
|
4150
4157
|
if (!nodeIds.has(nodeId)) {
|
|
4151
|
-
delete
|
|
4158
|
+
delete runtimeMetaData.nodes[nodeId];
|
|
4152
4159
|
}
|
|
4153
4160
|
}
|
|
4154
4161
|
// Save cleaned metadata to workbench state
|
|
4155
|
-
workbench.setRuntimeState(
|
|
4162
|
+
workbench.setRuntimeState(runtimeMetaData);
|
|
4156
4163
|
const fullUiState = workbench.getUIState();
|
|
4157
4164
|
const uiWithoutViewport = excludeViewportFromUIState(fullUiState);
|
|
4158
4165
|
// Use updateExtData for efficient batched partial updates
|
|
@@ -4160,7 +4167,8 @@ function WorkbenchProvider({ wb, runner, overrides, uiVersion, children, }) {
|
|
|
4160
4167
|
if (Object.keys(uiWithoutViewport || {}).length > 0) {
|
|
4161
4168
|
updates.push({ path: "ui", value: uiWithoutViewport });
|
|
4162
4169
|
}
|
|
4163
|
-
updates.push({ path: "runtime", value:
|
|
4170
|
+
updates.push({ path: "runtime", value: runtimeMetaData });
|
|
4171
|
+
updates.push({ path: "custom", value: customMetaData });
|
|
4164
4172
|
await graphRunner.updateExtData(updates);
|
|
4165
4173
|
}
|
|
4166
4174
|
catch (err) {
|