@bian-womp/spark-workbench 0.2.91 → 0.2.92
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 +5 -4
- package/lib/cjs/index.cjs.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 +5 -4
- package/lib/esm/index.js.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
|
@@ -31,6 +31,10 @@ export interface ThumbnailOptions {
|
|
|
31
31
|
* Color of background dot pattern. Default: "#f1f1f1"
|
|
32
32
|
*/
|
|
33
33
|
backgroundPatternColor?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Background color of the SVG. Default: "#ffffff"
|
|
36
|
+
*/
|
|
37
|
+
backgroundColor?: string;
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
* Captures a React Flow container element as an SVG image and returns data URL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thumbnail-utils.d.ts","sourceRoot":"","sources":["../../../../src/misc/thumbnail-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2DH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"thumbnail-utils.d.ts","sourceRoot":"","sources":["../../../../src/misc/thumbnail-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2DH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAgsBD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,gBAAgB,EAAE,WAAW,GAAG,IAAI,EACpC,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA0IxB;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,gBAAgB,EAAE,WAAW,GAAG,IAAI,EACpC,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,OAAO,CAAC,CAoBlB"}
|
package/lib/esm/index.js
CHANGED
|
@@ -3367,16 +3367,16 @@ function extractNodes(viewport, visibleBounds, options = {}) {
|
|
|
3367
3367
|
* Creates SVG element with dot pattern background (matching React Flow)
|
|
3368
3368
|
*/
|
|
3369
3369
|
function createSVGElement(width, height, options = {}) {
|
|
3370
|
-
const { exportBackgroundPattern = true, backgroundPatternColor = "#f1f1f1" } = options;
|
|
3370
|
+
const { exportBackgroundPattern = true, backgroundPatternColor = "#f1f1f1", backgroundColor = "#ffffff", } = options;
|
|
3371
3371
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3372
3372
|
svg.setAttribute("width", String(width));
|
|
3373
3373
|
svg.setAttribute("height", String(height));
|
|
3374
3374
|
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
3375
|
-
// Create background rectangle with
|
|
3375
|
+
// Create background rectangle with configurable background color
|
|
3376
3376
|
const bgRect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
3377
3377
|
bgRect.setAttribute("width", String(width));
|
|
3378
3378
|
bgRect.setAttribute("height", String(height));
|
|
3379
|
-
bgRect.setAttribute("fill",
|
|
3379
|
+
bgRect.setAttribute("fill", backgroundColor);
|
|
3380
3380
|
svg.appendChild(bgRect);
|
|
3381
3381
|
// Create dot pattern if enabled
|
|
3382
3382
|
if (exportBackgroundPattern) {
|
|
@@ -3499,7 +3499,7 @@ function renderContentToSVG(group, nodes, edges, transformX, transformY, options
|
|
|
3499
3499
|
* @returns Promise resolving to SVG data URL string, or null if capture fails
|
|
3500
3500
|
*/
|
|
3501
3501
|
async function captureCanvasThumbnail(containerElement, options = {}) {
|
|
3502
|
-
const { ignoreViewport = true, padding = 40, exportHandles = true, exportNodeTitle = true, exportBackgroundPattern = true, nodeBackgroundColor, backgroundPatternColor, } = options;
|
|
3502
|
+
const { ignoreViewport = true, padding = 40, exportHandles = true, exportNodeTitle = true, exportBackgroundPattern = true, nodeBackgroundColor, backgroundPatternColor, backgroundColor, } = options;
|
|
3503
3503
|
if (!containerElement) {
|
|
3504
3504
|
console.warn("[flowThumbnail] Container element is null");
|
|
3505
3505
|
return null;
|
|
@@ -3582,6 +3582,7 @@ async function captureCanvasThumbnail(containerElement, options = {}) {
|
|
|
3582
3582
|
const { svg, group } = createSVGElement(contentWidth, contentHeight, {
|
|
3583
3583
|
exportBackgroundPattern,
|
|
3584
3584
|
backgroundPatternColor,
|
|
3585
|
+
backgroundColor,
|
|
3585
3586
|
});
|
|
3586
3587
|
// Render content with options
|
|
3587
3588
|
renderContentToSVG(group, nodes, edges, -contentMinX, -contentMinY, {
|