@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
|
@@ -191,6 +191,26 @@ function removeNodeFromTree(children, id) {
|
|
|
191
191
|
return node;
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
+
function pruneEmptyGroups(children) {
|
|
195
|
+
const prunedGroupIds = /* @__PURE__ */ new Set();
|
|
196
|
+
const walk = (nodes) => {
|
|
197
|
+
const next = [];
|
|
198
|
+
for (const node of nodes) {
|
|
199
|
+
if (isGroup(node)) {
|
|
200
|
+
const prunedChildren = walk(node.children);
|
|
201
|
+
if (prunedChildren.length === 0) {
|
|
202
|
+
prunedGroupIds.add(node.id);
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
next.push({ ...node, children: prunedChildren });
|
|
206
|
+
} else {
|
|
207
|
+
next.push(node);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return next;
|
|
211
|
+
};
|
|
212
|
+
return { children: walk(children), prunedGroupIds };
|
|
213
|
+
}
|
|
194
214
|
function addNodeToTree(children, node, parentId, index) {
|
|
195
215
|
if (!parentId) {
|
|
196
216
|
if (index !== void 0) {
|
|
@@ -1504,8 +1524,16 @@ const useEditorStore = create((set, get) => ({
|
|
|
1504
1524
|
if (rootLevelIds.has(id)) ;
|
|
1505
1525
|
nextChildren = removeNodeFromTree(nextChildren, id);
|
|
1506
1526
|
}
|
|
1527
|
+
const { children: prunedChildren, prunedGroupIds } = pruneEmptyGroups(nextChildren);
|
|
1528
|
+
nextChildren = prunedChildren;
|
|
1529
|
+
for (const gid of prunedGroupIds) {
|
|
1530
|
+
allDeletedIds.add(gid);
|
|
1531
|
+
if (rootLevelIds.has(gid)) ;
|
|
1532
|
+
}
|
|
1507
1533
|
let nextCanvas = updateCurrentPageChildren(state.canvas, () => nextChildren);
|
|
1508
|
-
nextCanvas.selectedIds = state.canvas.selectedIds.filter(
|
|
1534
|
+
nextCanvas.selectedIds = state.canvas.selectedIds.filter(
|
|
1535
|
+
(id) => !ids.includes(id) && !prunedGroupIds.has(id)
|
|
1536
|
+
);
|
|
1509
1537
|
if (nextCanvas.themeConfig) {
|
|
1510
1538
|
const remainingProps = nextCanvas.themeConfig.properties.filter((p) => !allDeletedIds.has(p.elementId));
|
|
1511
1539
|
if (remainingProps.length !== nextCanvas.themeConfig.properties.length) {
|
|
@@ -13414,7 +13442,7 @@ const PageCanvas = forwardRef(
|
|
|
13414
13442
|
fabricCanvas.on("selection:cleared", () => {
|
|
13415
13443
|
});
|
|
13416
13444
|
fabricCanvas.on("object:scaling", (e) => {
|
|
13417
|
-
var _a2, _b2;
|
|
13445
|
+
var _a2, _b2, _c;
|
|
13418
13446
|
if (!isActiveRef.current) return;
|
|
13419
13447
|
const t = e.target;
|
|
13420
13448
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
@@ -13600,6 +13628,48 @@ const PageCanvas = forwardRef(
|
|
|
13600
13628
|
const asRect0 = obj.getBoundingRect();
|
|
13601
13629
|
let didReflowTextChild = false;
|
|
13602
13630
|
for (const child of obj.getObjects()) {
|
|
13631
|
+
if (child instanceof fabric.Group && (child.__cropGroup || ((_b2 = child._ct) == null ? void 0 : _b2.isCropGroup))) {
|
|
13632
|
+
const ct = child.__cropData;
|
|
13633
|
+
if (!ct) continue;
|
|
13634
|
+
if (isXSide) {
|
|
13635
|
+
if (child.__asLiveOrigW == null) {
|
|
13636
|
+
const baseW = child.width ?? ct.frameW ?? 0;
|
|
13637
|
+
child.__asLiveOrigW = baseW * (child.scaleX ?? 1);
|
|
13638
|
+
}
|
|
13639
|
+
const origW = child.__asLiveOrigW;
|
|
13640
|
+
const newW = Math.max(20, origW * sAxis);
|
|
13641
|
+
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
13642
|
+
ct.frameW = newW;
|
|
13643
|
+
child._set("width", newW);
|
|
13644
|
+
child._set("scaleX", 1 / sAxis);
|
|
13645
|
+
try {
|
|
13646
|
+
updateCoverLayout(child);
|
|
13647
|
+
} catch {
|
|
13648
|
+
}
|
|
13649
|
+
child.setCoords();
|
|
13650
|
+
child.dirty = true;
|
|
13651
|
+
}
|
|
13652
|
+
} else {
|
|
13653
|
+
if (child.__asLiveOrigH == null) {
|
|
13654
|
+
const baseH = child.height ?? ct.frameH ?? 0;
|
|
13655
|
+
child.__asLiveOrigH = baseH * (child.scaleY ?? 1);
|
|
13656
|
+
}
|
|
13657
|
+
const origH = child.__asLiveOrigH;
|
|
13658
|
+
const newH = Math.max(20, origH * sAxis);
|
|
13659
|
+
if (Math.abs((child.height ?? 0) - newH) > 0.5) {
|
|
13660
|
+
ct.frameH = newH;
|
|
13661
|
+
child._set("height", newH);
|
|
13662
|
+
child._set("scaleY", 1 / sAxis);
|
|
13663
|
+
try {
|
|
13664
|
+
updateCoverLayout(child);
|
|
13665
|
+
} catch {
|
|
13666
|
+
}
|
|
13667
|
+
child.setCoords();
|
|
13668
|
+
child.dirty = true;
|
|
13669
|
+
}
|
|
13670
|
+
}
|
|
13671
|
+
continue;
|
|
13672
|
+
}
|
|
13603
13673
|
if (child instanceof fabric.FabricImage && !child.__cropGroup && !child.smartElementType) {
|
|
13604
13674
|
if (isXSide) {
|
|
13605
13675
|
if (child.__asLiveOrigW == null) {
|
|
@@ -13776,7 +13846,7 @@ const PageCanvas = forwardRef(
|
|
|
13776
13846
|
setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
|
|
13777
13847
|
if (drilledGroupIdRef.current) {
|
|
13778
13848
|
try {
|
|
13779
|
-
(
|
|
13849
|
+
(_c = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c.call(fabricCanvas);
|
|
13780
13850
|
} catch {
|
|
13781
13851
|
}
|
|
13782
13852
|
}
|
|
@@ -14507,8 +14577,8 @@ const PageCanvas = forwardRef(
|
|
|
14507
14577
|
if (ct) {
|
|
14508
14578
|
const sourceFrameW = Math.max(1, ct.frameW ?? obj.width ?? 1);
|
|
14509
14579
|
const sourceFrameH = Math.max(1, ct.frameH ?? obj.height ?? 1);
|
|
14510
|
-
const appliedScaleX =
|
|
14511
|
-
const appliedScaleY =
|
|
14580
|
+
const appliedScaleX = isActiveSelection && activeObj ? Math.abs((activeObj.scaleX ?? 1) * (obj.scaleX ?? 1)) : Math.abs(obj.scaleX ?? 1);
|
|
14581
|
+
const appliedScaleY = isActiveSelection && activeObj ? Math.abs((activeObj.scaleY ?? 1) * (obj.scaleY ?? 1)) : Math.abs(obj.scaleY ?? 1);
|
|
14512
14582
|
finalWidth = Math.max(1, sourceFrameW * appliedScaleX);
|
|
14513
14583
|
finalHeight = Math.max(1, sourceFrameH * appliedScaleY);
|
|
14514
14584
|
finalScaleX = 1;
|
|
@@ -23955,9 +24025,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23955
24025
|
}
|
|
23956
24026
|
return svgString;
|
|
23957
24027
|
}
|
|
23958
|
-
const resolvedPackageVersion = "0.5.
|
|
24028
|
+
const resolvedPackageVersion = "0.5.301";
|
|
23959
24029
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23960
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24030
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.301";
|
|
23961
24031
|
const roundParityValue = (value) => {
|
|
23962
24032
|
if (typeof value !== "number") return value;
|
|
23963
24033
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24771,7 +24841,7 @@ class PixldocsRenderer {
|
|
|
24771
24841
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24772
24842
|
}
|
|
24773
24843
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24774
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
24844
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-wfJpS8kd.js");
|
|
24775
24845
|
const prepared = preparePagesForExport(
|
|
24776
24846
|
cloned.pages,
|
|
24777
24847
|
canvasWidth,
|
|
@@ -27091,7 +27161,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27091
27161
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27092
27162
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27093
27163
|
try {
|
|
27094
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27164
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-wfJpS8kd.js");
|
|
27095
27165
|
try {
|
|
27096
27166
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27097
27167
|
} catch {
|
|
@@ -27491,4 +27561,4 @@ export {
|
|
|
27491
27561
|
buildTeaserBlurFlatKeys as y,
|
|
27492
27562
|
collectFontDescriptorsFromConfig as z
|
|
27493
27563
|
};
|
|
27494
|
-
//# sourceMappingURL=index-
|
|
27564
|
+
//# sourceMappingURL=index-CUodp3G_.js.map
|