@bian-womp/spark-workbench 0.2.91 → 0.2.93
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 +12 -12
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/misc/WorkbenchCanvas.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/misc/thumbnail-utils.d.ts +4 -0
- package/lib/cjs/src/misc/thumbnail-utils.d.ts.map +1 -1
- package/lib/esm/index.js +12 -12
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/misc/WorkbenchCanvas.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/misc/thumbnail-utils.d.ts +4 -0
- package/lib/esm/src/misc/thumbnail-utils.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/cjs/index.cjs
CHANGED
|
@@ -3369,16 +3369,16 @@ function extractNodes(viewport, visibleBounds, options = {}) {
|
|
|
3369
3369
|
* Creates SVG element with dot pattern background (matching React Flow)
|
|
3370
3370
|
*/
|
|
3371
3371
|
function createSVGElement(width, height, options = {}) {
|
|
3372
|
-
const { exportBackgroundPattern = true, backgroundPatternColor = "#f1f1f1" } = options;
|
|
3372
|
+
const { exportBackgroundPattern = true, backgroundPatternColor = "#f1f1f1", backgroundColor = "#ffffff", } = options;
|
|
3373
3373
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3374
3374
|
svg.setAttribute("width", String(width));
|
|
3375
3375
|
svg.setAttribute("height", String(height));
|
|
3376
3376
|
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
3377
|
-
// Create background rectangle with
|
|
3377
|
+
// Create background rectangle with configurable background color
|
|
3378
3378
|
const bgRect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
3379
3379
|
bgRect.setAttribute("width", String(width));
|
|
3380
3380
|
bgRect.setAttribute("height", String(height));
|
|
3381
|
-
bgRect.setAttribute("fill",
|
|
3381
|
+
bgRect.setAttribute("fill", backgroundColor);
|
|
3382
3382
|
svg.appendChild(bgRect);
|
|
3383
3383
|
// Create dot pattern if enabled
|
|
3384
3384
|
if (exportBackgroundPattern) {
|
|
@@ -3501,7 +3501,7 @@ function renderContentToSVG(group, nodes, edges, transformX, transformY, options
|
|
|
3501
3501
|
* @returns Promise resolving to SVG data URL string, or null if capture fails
|
|
3502
3502
|
*/
|
|
3503
3503
|
async function captureCanvasThumbnail(containerElement, options = {}) {
|
|
3504
|
-
const { ignoreViewport = true, padding = 40, exportHandles = true, exportNodeTitle = true, exportBackgroundPattern = true, nodeBackgroundColor, backgroundPatternColor, } = options;
|
|
3504
|
+
const { ignoreViewport = true, padding = 40, exportHandles = true, exportNodeTitle = true, exportBackgroundPattern = true, nodeBackgroundColor, backgroundPatternColor, backgroundColor, } = options;
|
|
3505
3505
|
if (!containerElement) {
|
|
3506
3506
|
console.warn("[flowThumbnail] Container element is null");
|
|
3507
3507
|
return null;
|
|
@@ -3584,6 +3584,7 @@ async function captureCanvasThumbnail(containerElement, options = {}) {
|
|
|
3584
3584
|
const { svg, group } = createSVGElement(contentWidth, contentHeight, {
|
|
3585
3585
|
exportBackgroundPattern,
|
|
3586
3586
|
backgroundPatternColor,
|
|
3587
|
+
backgroundColor,
|
|
3587
3588
|
});
|
|
3588
3589
|
// Render content with options
|
|
3589
3590
|
renderContentToSVG(group, nodes, edges, -contentMinX, -contentMinY, {
|
|
@@ -3656,6 +3657,7 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, overrides, uiVer
|
|
|
3656
3657
|
const [systemErrors, setSystemErrors] = React.useState([]);
|
|
3657
3658
|
const [registryErrors, setRegistryErrors] = React.useState([]);
|
|
3658
3659
|
const [inputValidationErrors, setInputValidationErrors] = React.useState([]);
|
|
3660
|
+
const [registryVersion, setRegistryVersion] = React.useState(0);
|
|
3659
3661
|
const clearSystemErrors = React.useCallback(() => setSystemErrors([]), []);
|
|
3660
3662
|
const clearRegistryErrors = React.useCallback(() => setRegistryErrors([]), []);
|
|
3661
3663
|
const clearInputValidationErrors = React.useCallback(() => setInputValidationErrors([]), []);
|
|
@@ -4318,6 +4320,8 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, overrides, uiVer
|
|
|
4318
4320
|
try {
|
|
4319
4321
|
setRegistry(newReg);
|
|
4320
4322
|
wb.setRegistry(newReg);
|
|
4323
|
+
// Increment registry version to trigger UI updates
|
|
4324
|
+
setRegistryVersion((v) => v + 1);
|
|
4321
4325
|
// Trigger a graph update so the UI revalidates with new types/enums/nodes
|
|
4322
4326
|
try {
|
|
4323
4327
|
await runner.update(wb.def);
|
|
@@ -4515,6 +4519,7 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, overrides, uiVer
|
|
|
4515
4519
|
updateEdgeType,
|
|
4516
4520
|
triggerExternal,
|
|
4517
4521
|
uiVersion,
|
|
4522
|
+
registryVersion,
|
|
4518
4523
|
overrides,
|
|
4519
4524
|
getNodeDisplayName,
|
|
4520
4525
|
setNodeName,
|
|
@@ -4556,6 +4561,7 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, overrides, uiVer
|
|
|
4556
4561
|
wb,
|
|
4557
4562
|
runner,
|
|
4558
4563
|
uiVersion,
|
|
4564
|
+
registryVersion,
|
|
4559
4565
|
overrides,
|
|
4560
4566
|
getNodeDisplayName,
|
|
4561
4567
|
setNodeName,
|
|
@@ -5537,10 +5543,9 @@ function useKeyboardShortcutToast() {
|
|
|
5537
5543
|
}
|
|
5538
5544
|
|
|
5539
5545
|
const WorkbenchCanvas = React.forwardRef(({ showValues, toString, toElement, getDefaultNodeSize }, ref) => {
|
|
5540
|
-
const { wb, registry, inputsMap, inputDefaultsMap, outputsMap, outputTypesMap, valuesTick, nodeStatus, edgeStatus, validationByNode, validationByEdge, uiVersion, runner, engineKind, overrides, } = useWorkbenchContext();
|
|
5546
|
+
const { wb, registry, inputsMap, inputDefaultsMap, outputsMap, outputTypesMap, valuesTick, nodeStatus, edgeStatus, validationByNode, validationByEdge, uiVersion, registryVersion, runner, engineKind, overrides, } = useWorkbenchContext();
|
|
5541
5547
|
const nodeValidation = validationByNode;
|
|
5542
5548
|
const edgeValidation = validationByEdge.errors;
|
|
5543
|
-
const [registryVersion, setRegistryVersion] = React.useState(0);
|
|
5544
5549
|
const [historyState, setHistoryState] = React.useState(wb.getHistory());
|
|
5545
5550
|
const prevNodesRef = React.useRef([]);
|
|
5546
5551
|
const prevEdgesRef = React.useRef([]);
|
|
@@ -5634,6 +5639,7 @@ const WorkbenchCanvas = React.forwardRef(({ showValues, toString, toElement, get
|
|
|
5634
5639
|
const resolver = (nodeTypeId) => custom.has(nodeTypeId) ? `spark-${nodeTypeId}` : "spark-default";
|
|
5635
5640
|
return { nodeTypes: types, resolveNodeType: resolver };
|
|
5636
5641
|
// Include uiVersion to recompute when custom renderers are registered
|
|
5642
|
+
// Include registryVersion to recompute when registry enums/types change
|
|
5637
5643
|
}, [wb, registry, uiVersion, ui]);
|
|
5638
5644
|
const edgeTypes = React.useMemo(() => {
|
|
5639
5645
|
// Use default edge renderer override if registered, otherwise use DefaultEdge
|
|
@@ -5921,12 +5927,6 @@ const WorkbenchCanvas = React.forwardRef(({ showValues, toString, toElement, get
|
|
|
5921
5927
|
const onCloseSelectionMenu = React.useCallback(() => {
|
|
5922
5928
|
setSelectionMenuOpen(false);
|
|
5923
5929
|
}, []);
|
|
5924
|
-
React.useEffect(() => {
|
|
5925
|
-
const off = runner.on("registry", () => {
|
|
5926
|
-
setRegistryVersion((v) => v + 1);
|
|
5927
|
-
});
|
|
5928
|
-
return () => off();
|
|
5929
|
-
}, [runner]);
|
|
5930
5930
|
React.useEffect(() => {
|
|
5931
5931
|
const off = wb.on("historyChanged", (event) => {
|
|
5932
5932
|
setHistoryState(event.history);
|