@pixldocs/canvas-renderer 0.5.299 → 0.5.301
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/dist/{index-DUUr9uZ0.cjs → index-BUG1_dx7.cjs} +80 -10
- package/dist/index-BUG1_dx7.cjs.map +1 -0
- package/dist/{index-Ddn4TvlA.js → index-CUodp3G_.js} +80 -10
- package/dist/index-CUodp3G_.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DeL1bsjM.cjs → vectorPdfExport-hHMDys-j.cjs} +4 -4
- package/dist/{vectorPdfExport-DeL1bsjM.cjs.map → vectorPdfExport-hHMDys-j.cjs.map} +1 -1
- package/dist/{vectorPdfExport-C1obEkji.js → vectorPdfExport-wfJpS8kd.js} +4 -4
- package/dist/{vectorPdfExport-C1obEkji.js.map → vectorPdfExport-wfJpS8kd.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DUUr9uZ0.cjs.map +0 -1
- package/dist/index-Ddn4TvlA.js.map +0 -1
|
@@ -209,6 +209,26 @@ function removeNodeFromTree(children, id) {
|
|
|
209
209
|
return node;
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
+
function pruneEmptyGroups(children) {
|
|
213
|
+
const prunedGroupIds = /* @__PURE__ */ new Set();
|
|
214
|
+
const walk = (nodes) => {
|
|
215
|
+
const next = [];
|
|
216
|
+
for (const node of nodes) {
|
|
217
|
+
if (isGroup(node)) {
|
|
218
|
+
const prunedChildren = walk(node.children);
|
|
219
|
+
if (prunedChildren.length === 0) {
|
|
220
|
+
prunedGroupIds.add(node.id);
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
next.push({ ...node, children: prunedChildren });
|
|
224
|
+
} else {
|
|
225
|
+
next.push(node);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return next;
|
|
229
|
+
};
|
|
230
|
+
return { children: walk(children), prunedGroupIds };
|
|
231
|
+
}
|
|
212
232
|
function addNodeToTree(children, node, parentId, index) {
|
|
213
233
|
if (!parentId) {
|
|
214
234
|
if (index !== void 0) {
|
|
@@ -1522,8 +1542,16 @@ const useEditorStore = zustand.create((set, get) => ({
|
|
|
1522
1542
|
if (rootLevelIds.has(id)) ;
|
|
1523
1543
|
nextChildren = removeNodeFromTree(nextChildren, id);
|
|
1524
1544
|
}
|
|
1545
|
+
const { children: prunedChildren, prunedGroupIds } = pruneEmptyGroups(nextChildren);
|
|
1546
|
+
nextChildren = prunedChildren;
|
|
1547
|
+
for (const gid of prunedGroupIds) {
|
|
1548
|
+
allDeletedIds.add(gid);
|
|
1549
|
+
if (rootLevelIds.has(gid)) ;
|
|
1550
|
+
}
|
|
1525
1551
|
let nextCanvas = updateCurrentPageChildren(state.canvas, () => nextChildren);
|
|
1526
|
-
nextCanvas.selectedIds = state.canvas.selectedIds.filter(
|
|
1552
|
+
nextCanvas.selectedIds = state.canvas.selectedIds.filter(
|
|
1553
|
+
(id) => !ids.includes(id) && !prunedGroupIds.has(id)
|
|
1554
|
+
);
|
|
1527
1555
|
if (nextCanvas.themeConfig) {
|
|
1528
1556
|
const remainingProps = nextCanvas.themeConfig.properties.filter((p) => !allDeletedIds.has(p.elementId));
|
|
1529
1557
|
if (remainingProps.length !== nextCanvas.themeConfig.properties.length) {
|
|
@@ -13432,7 +13460,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13432
13460
|
fabricCanvas.on("selection:cleared", () => {
|
|
13433
13461
|
});
|
|
13434
13462
|
fabricCanvas.on("object:scaling", (e) => {
|
|
13435
|
-
var _a2, _b2;
|
|
13463
|
+
var _a2, _b2, _c;
|
|
13436
13464
|
if (!isActiveRef.current) return;
|
|
13437
13465
|
const t = e.target;
|
|
13438
13466
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
@@ -13618,6 +13646,48 @@ const PageCanvas = react.forwardRef(
|
|
|
13618
13646
|
const asRect0 = obj.getBoundingRect();
|
|
13619
13647
|
let didReflowTextChild = false;
|
|
13620
13648
|
for (const child of obj.getObjects()) {
|
|
13649
|
+
if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_b2 = child._ct) == null ? void 0 : _b2.isCropGroup))) {
|
|
13650
|
+
const ct = child.__cropData;
|
|
13651
|
+
if (!ct) continue;
|
|
13652
|
+
if (isXSide) {
|
|
13653
|
+
if (child.__asLiveOrigW == null) {
|
|
13654
|
+
const baseW = child.width ?? ct.frameW ?? 0;
|
|
13655
|
+
child.__asLiveOrigW = baseW * (child.scaleX ?? 1);
|
|
13656
|
+
}
|
|
13657
|
+
const origW = child.__asLiveOrigW;
|
|
13658
|
+
const newW = Math.max(20, origW * sAxis);
|
|
13659
|
+
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
13660
|
+
ct.frameW = newW;
|
|
13661
|
+
child._set("width", newW);
|
|
13662
|
+
child._set("scaleX", 1 / sAxis);
|
|
13663
|
+
try {
|
|
13664
|
+
updateCoverLayout(child);
|
|
13665
|
+
} catch {
|
|
13666
|
+
}
|
|
13667
|
+
child.setCoords();
|
|
13668
|
+
child.dirty = true;
|
|
13669
|
+
}
|
|
13670
|
+
} else {
|
|
13671
|
+
if (child.__asLiveOrigH == null) {
|
|
13672
|
+
const baseH = child.height ?? ct.frameH ?? 0;
|
|
13673
|
+
child.__asLiveOrigH = baseH * (child.scaleY ?? 1);
|
|
13674
|
+
}
|
|
13675
|
+
const origH = child.__asLiveOrigH;
|
|
13676
|
+
const newH = Math.max(20, origH * sAxis);
|
|
13677
|
+
if (Math.abs((child.height ?? 0) - newH) > 0.5) {
|
|
13678
|
+
ct.frameH = newH;
|
|
13679
|
+
child._set("height", newH);
|
|
13680
|
+
child._set("scaleY", 1 / sAxis);
|
|
13681
|
+
try {
|
|
13682
|
+
updateCoverLayout(child);
|
|
13683
|
+
} catch {
|
|
13684
|
+
}
|
|
13685
|
+
child.setCoords();
|
|
13686
|
+
child.dirty = true;
|
|
13687
|
+
}
|
|
13688
|
+
}
|
|
13689
|
+
continue;
|
|
13690
|
+
}
|
|
13621
13691
|
if (child instanceof fabric__namespace.FabricImage && !child.__cropGroup && !child.smartElementType) {
|
|
13622
13692
|
if (isXSide) {
|
|
13623
13693
|
if (child.__asLiveOrigW == null) {
|
|
@@ -13794,7 +13864,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13794
13864
|
setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
|
|
13795
13865
|
if (drilledGroupIdRef.current) {
|
|
13796
13866
|
try {
|
|
13797
|
-
(
|
|
13867
|
+
(_c = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c.call(fabricCanvas);
|
|
13798
13868
|
} catch {
|
|
13799
13869
|
}
|
|
13800
13870
|
}
|
|
@@ -14525,8 +14595,8 @@ const PageCanvas = react.forwardRef(
|
|
|
14525
14595
|
if (ct) {
|
|
14526
14596
|
const sourceFrameW = Math.max(1, ct.frameW ?? obj.width ?? 1);
|
|
14527
14597
|
const sourceFrameH = Math.max(1, ct.frameH ?? obj.height ?? 1);
|
|
14528
|
-
const appliedScaleX =
|
|
14529
|
-
const appliedScaleY =
|
|
14598
|
+
const appliedScaleX = isActiveSelection && activeObj ? Math.abs((activeObj.scaleX ?? 1) * (obj.scaleX ?? 1)) : Math.abs(obj.scaleX ?? 1);
|
|
14599
|
+
const appliedScaleY = isActiveSelection && activeObj ? Math.abs((activeObj.scaleY ?? 1) * (obj.scaleY ?? 1)) : Math.abs(obj.scaleY ?? 1);
|
|
14530
14600
|
finalWidth = Math.max(1, sourceFrameW * appliedScaleX);
|
|
14531
14601
|
finalHeight = Math.max(1, sourceFrameH * appliedScaleY);
|
|
14532
14602
|
finalScaleX = 1;
|
|
@@ -23973,9 +24043,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23973
24043
|
}
|
|
23974
24044
|
return svgString;
|
|
23975
24045
|
}
|
|
23976
|
-
const resolvedPackageVersion = "0.5.
|
|
24046
|
+
const resolvedPackageVersion = "0.5.301";
|
|
23977
24047
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23978
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24048
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.301";
|
|
23979
24049
|
const roundParityValue = (value) => {
|
|
23980
24050
|
if (typeof value !== "number") return value;
|
|
23981
24051
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24789,7 +24859,7 @@ class PixldocsRenderer {
|
|
|
24789
24859
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24790
24860
|
}
|
|
24791
24861
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24792
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
24862
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-hHMDys-j.cjs"));
|
|
24793
24863
|
const prepared = preparePagesForExport(
|
|
24794
24864
|
cloned.pages,
|
|
24795
24865
|
canvasWidth,
|
|
@@ -27109,7 +27179,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27109
27179
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27110
27180
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27111
27181
|
try {
|
|
27112
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27182
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-hHMDys-j.cjs"));
|
|
27113
27183
|
try {
|
|
27114
27184
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27115
27185
|
} catch {
|
|
@@ -27506,4 +27576,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
27506
27576
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
27507
27577
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
27508
27578
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
27509
|
-
//# sourceMappingURL=index-
|
|
27579
|
+
//# sourceMappingURL=index-BUG1_dx7.cjs.map
|