@pixldocs/canvas-renderer 0.5.244 → 0.5.245
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-xJBNIfjT.js → index-FE8QLDiA.js} +92 -8
- package/dist/index-FE8QLDiA.js.map +1 -0
- package/dist/{index-Bu8x_hs7.cjs → index-o3TKXqkj.cjs} +92 -8
- package/dist/index-o3TKXqkj.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-BUlPzdRT.cjs → vectorPdfExport-00z0fojJ.cjs} +4 -4
- package/dist/{vectorPdfExport-BUlPzdRT.cjs.map → vectorPdfExport-00z0fojJ.cjs.map} +1 -1
- package/dist/{vectorPdfExport-BWQ8fyXp.js → vectorPdfExport-qzZ0kZCI.js} +4 -4
- package/dist/{vectorPdfExport-BWQ8fyXp.js.map → vectorPdfExport-qzZ0kZCI.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-Bu8x_hs7.cjs.map +0 -1
- package/dist/index-xJBNIfjT.js.map +0 -1
|
@@ -11138,6 +11138,8 @@ const PageCanvas = react.forwardRef(
|
|
|
11138
11138
|
const [guides, setGuides] = react.useState([]);
|
|
11139
11139
|
const [gridResizeLabel, setGridResizeLabel] = react.useState(null);
|
|
11140
11140
|
const [hoverBounds, setHoverBounds] = react.useState(null);
|
|
11141
|
+
const [drilledGroupBounds, setDrilledGroupBounds] = react.useState(null);
|
|
11142
|
+
const drilledGroupIdRef = react.useRef(null);
|
|
11141
11143
|
const [rotationLabel, setRotationLabel] = react.useState(null);
|
|
11142
11144
|
const [sizeLabel, setSizeLabel] = react.useState(null);
|
|
11143
11145
|
const [ready, setReady] = react.useState(false);
|
|
@@ -12005,16 +12007,29 @@ const PageCanvas = react.forwardRef(
|
|
|
12005
12007
|
}
|
|
12006
12008
|
});
|
|
12007
12009
|
fabricCanvas.on("object:scaling", () => {
|
|
12010
|
+
var _a2;
|
|
12008
12011
|
fabricCanvas.__isUserTransforming = true;
|
|
12012
|
+
if (drilledGroupIdRef.current) {
|
|
12013
|
+
try {
|
|
12014
|
+
(_a2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _a2.call(fabricCanvas);
|
|
12015
|
+
} catch {
|
|
12016
|
+
}
|
|
12017
|
+
}
|
|
12009
12018
|
});
|
|
12010
12019
|
fabricCanvas.on("object:moving", () => {
|
|
12011
|
-
var _a2;
|
|
12020
|
+
var _a2, _b2;
|
|
12012
12021
|
fabricCanvas.__isUserTransforming = true;
|
|
12013
12022
|
didTransformRef.current = true;
|
|
12023
|
+
if (drilledGroupIdRef.current) {
|
|
12024
|
+
try {
|
|
12025
|
+
(_a2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _a2.call(fabricCanvas);
|
|
12026
|
+
} catch {
|
|
12027
|
+
}
|
|
12028
|
+
}
|
|
12014
12029
|
const active = fabricCanvas.getActiveObject();
|
|
12015
12030
|
if (!active) return;
|
|
12016
12031
|
const state = useEditorStore.getState();
|
|
12017
|
-
const canvasPage = (
|
|
12032
|
+
const canvasPage = (_b2 = state.canvas.pages) == null ? void 0 : _b2.find((p) => p.id === pageId);
|
|
12018
12033
|
const children = (canvasPage == null ? void 0 : canvasPage.children) ?? [];
|
|
12019
12034
|
if (!canvasPage) return;
|
|
12020
12035
|
const ids = state.canvas.selectedIds ?? [];
|
|
@@ -12045,8 +12060,15 @@ const PageCanvas = react.forwardRef(
|
|
|
12045
12060
|
}
|
|
12046
12061
|
});
|
|
12047
12062
|
fabricCanvas.on("object:rotating", () => {
|
|
12063
|
+
var _a2;
|
|
12048
12064
|
fabricCanvas.__isUserTransforming = true;
|
|
12049
12065
|
didTransformRef.current = true;
|
|
12066
|
+
if (drilledGroupIdRef.current) {
|
|
12067
|
+
try {
|
|
12068
|
+
(_a2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _a2.call(fabricCanvas);
|
|
12069
|
+
} catch {
|
|
12070
|
+
}
|
|
12071
|
+
}
|
|
12050
12072
|
});
|
|
12051
12073
|
const syncSelectionToStore = () => {
|
|
12052
12074
|
var _a2, _b2, _c, _d;
|
|
@@ -12257,7 +12279,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12257
12279
|
}
|
|
12258
12280
|
});
|
|
12259
12281
|
fabricCanvas.on("mouse:dblclick", (opt) => {
|
|
12260
|
-
var _a2, _b2;
|
|
12282
|
+
var _a2, _b2, _c;
|
|
12261
12283
|
const target = opt == null ? void 0 : opt.target;
|
|
12262
12284
|
if (!target) return;
|
|
12263
12285
|
if (target.isEditing) return;
|
|
@@ -12352,6 +12374,10 @@ const PageCanvas = react.forwardRef(
|
|
|
12352
12374
|
}
|
|
12353
12375
|
const selectedId = selectionIdx < 0 ? childId : chain[selectionIdx].id;
|
|
12354
12376
|
selectElements([selectedId], false, false);
|
|
12377
|
+
try {
|
|
12378
|
+
(_c = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c.call(fabricCanvas);
|
|
12379
|
+
} catch {
|
|
12380
|
+
}
|
|
12355
12381
|
});
|
|
12356
12382
|
fabricCanvas.on("selection:cleared", () => {
|
|
12357
12383
|
if (!isActiveRef.current || isRebuildingRef.current || !allowSelection) return;
|
|
@@ -12359,6 +12385,8 @@ const PageCanvas = react.forwardRef(
|
|
|
12359
12385
|
groupBoundsResizingRef.current = false;
|
|
12360
12386
|
if (!preserveEditingScopeOnSelectionClearRef.current) {
|
|
12361
12387
|
fabricCanvas.__activeEditingGroupId = null;
|
|
12388
|
+
setDrilledGroupBounds(null);
|
|
12389
|
+
drilledGroupIdRef.current = null;
|
|
12362
12390
|
}
|
|
12363
12391
|
const preservedGroupSelection = preserveActiveSelectionAfterTransformRef.current;
|
|
12364
12392
|
const shouldRestoreGroupSelection = !!((preservedGroupSelection == null ? void 0 : preservedGroupSelection.groupSelectionId) && (!preservedGroupSelection.expiresAt || preservedGroupSelection.expiresAt > Date.now()));
|
|
@@ -12762,6 +12790,32 @@ const PageCanvas = react.forwardRef(
|
|
|
12762
12790
|
}
|
|
12763
12791
|
return pick;
|
|
12764
12792
|
};
|
|
12793
|
+
const updateDrilledGroupOutline = () => {
|
|
12794
|
+
const gid = fabricCanvas.__activeEditingGroupId ?? null;
|
|
12795
|
+
drilledGroupIdRef.current = gid;
|
|
12796
|
+
if (!gid) {
|
|
12797
|
+
setDrilledGroupBounds(null);
|
|
12798
|
+
return;
|
|
12799
|
+
}
|
|
12800
|
+
const pageNow = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId);
|
|
12801
|
+
const node = pageNow ? findNodeById(pageNow.children ?? [], gid) : null;
|
|
12802
|
+
if (!node || !isGroup(node) || node.backgroundColor) {
|
|
12803
|
+
setDrilledGroupBounds(null);
|
|
12804
|
+
return;
|
|
12805
|
+
}
|
|
12806
|
+
const b = groupFabricUnionBBox(node);
|
|
12807
|
+
if (!b) {
|
|
12808
|
+
setDrilledGroupBounds(null);
|
|
12809
|
+
return;
|
|
12810
|
+
}
|
|
12811
|
+
setDrilledGroupBounds({
|
|
12812
|
+
left: b.left,
|
|
12813
|
+
top: b.top,
|
|
12814
|
+
width: b.right - b.left,
|
|
12815
|
+
height: b.bottom - b.top
|
|
12816
|
+
});
|
|
12817
|
+
};
|
|
12818
|
+
fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
|
|
12765
12819
|
fabricCanvas.on("mouse:down:before", (opt) => {
|
|
12766
12820
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
12767
12821
|
if (editLockRef.current) {
|
|
@@ -12896,7 +12950,11 @@ const PageCanvas = react.forwardRef(
|
|
|
12896
12950
|
opt.target = effectiveTarget;
|
|
12897
12951
|
pendingGroupPromotionRef.current = null;
|
|
12898
12952
|
pendingGroupDrillInRef.current = { groupId: drillGroup.id, childId: effectiveTargetId, target: effectiveTarget };
|
|
12953
|
+
effectiveTarget.selected = false;
|
|
12954
|
+
effectiveTarget.__lastSelected = false;
|
|
12955
|
+
effectiveTarget.__corner = void 0;
|
|
12899
12956
|
selectElements([effectiveTargetId], false, false);
|
|
12957
|
+
updateDrilledGroupOutline();
|
|
12900
12958
|
fabricCanvas.requestRenderAll();
|
|
12901
12959
|
}
|
|
12902
12960
|
} else if (!target || targetId === "__background__") {
|
|
@@ -13064,6 +13122,9 @@ const PageCanvas = react.forwardRef(
|
|
|
13064
13122
|
(_b2 = (_a2 = pendingDrillIn.target).set) == null ? void 0 : _b2.call(_a2, { selectable: true, evented: true, hasBorders: true, hasControls: true });
|
|
13065
13123
|
fabricCanvas.setActiveObject(pendingDrillIn.target);
|
|
13066
13124
|
pendingDrillIn.target.setCoords();
|
|
13125
|
+
pendingDrillIn.target.selected = false;
|
|
13126
|
+
pendingDrillIn.target.__lastSelected = false;
|
|
13127
|
+
pendingDrillIn.target.__corner = void 0;
|
|
13067
13128
|
fabricCanvas.requestRenderAll();
|
|
13068
13129
|
} finally {
|
|
13069
13130
|
requestAnimationFrame(() => {
|
|
@@ -13071,6 +13132,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13071
13132
|
});
|
|
13072
13133
|
}
|
|
13073
13134
|
selectElements([pendingDrillIn.childId], false, false);
|
|
13135
|
+
updateDrilledGroupOutline();
|
|
13074
13136
|
}
|
|
13075
13137
|
}
|
|
13076
13138
|
const pendingPromotion = pendingGroupPromotionRef.current;
|
|
@@ -17199,6 +17261,28 @@ const PageCanvas = react.forwardRef(
|
|
|
17199
17261
|
)
|
|
17200
17262
|
}
|
|
17201
17263
|
),
|
|
17264
|
+
drilledGroupBounds && /* @__PURE__ */ jsxRuntime.jsx(
|
|
17265
|
+
"svg",
|
|
17266
|
+
{
|
|
17267
|
+
className: "absolute inset-0 pointer-events-none",
|
|
17268
|
+
style: { width: scaledWidth, height: scaledHeight },
|
|
17269
|
+
viewBox: `0 0 ${canvasWidth} ${canvasHeight}`,
|
|
17270
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17271
|
+
"rect",
|
|
17272
|
+
{
|
|
17273
|
+
x: drilledGroupBounds.left,
|
|
17274
|
+
y: drilledGroupBounds.top,
|
|
17275
|
+
width: drilledGroupBounds.width,
|
|
17276
|
+
height: drilledGroupBounds.height,
|
|
17277
|
+
fill: "none",
|
|
17278
|
+
stroke: "rgba(100, 116, 139, 0.7)",
|
|
17279
|
+
strokeWidth: 1,
|
|
17280
|
+
strokeDasharray: "4 4",
|
|
17281
|
+
vectorEffect: "non-scaling-stroke"
|
|
17282
|
+
}
|
|
17283
|
+
)
|
|
17284
|
+
}
|
|
17285
|
+
),
|
|
17202
17286
|
canvas.projectSettings.showGrid && (() => {
|
|
17203
17287
|
const ps = canvas.projectSettings;
|
|
17204
17288
|
const gx = Math.max(1, ps.gridSizeX ?? ps.gridSize ?? 0);
|
|
@@ -23310,9 +23394,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23310
23394
|
}
|
|
23311
23395
|
return svgString;
|
|
23312
23396
|
}
|
|
23313
|
-
const resolvedPackageVersion = "0.5.
|
|
23397
|
+
const resolvedPackageVersion = "0.5.245";
|
|
23314
23398
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23315
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23399
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.245";
|
|
23316
23400
|
const roundParityValue = (value) => {
|
|
23317
23401
|
if (typeof value !== "number") return value;
|
|
23318
23402
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24126,7 +24210,7 @@ class PixldocsRenderer {
|
|
|
24126
24210
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24127
24211
|
}
|
|
24128
24212
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24129
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
24213
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-00z0fojJ.cjs"));
|
|
24130
24214
|
const prepared = preparePagesForExport(
|
|
24131
24215
|
cloned.pages,
|
|
24132
24216
|
canvasWidth,
|
|
@@ -26446,7 +26530,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26446
26530
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26447
26531
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26448
26532
|
try {
|
|
26449
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
26533
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-00z0fojJ.cjs"));
|
|
26450
26534
|
try {
|
|
26451
26535
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26452
26536
|
} catch {
|
|
@@ -26843,4 +26927,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
26843
26927
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
26844
26928
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
26845
26929
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
26846
|
-
//# sourceMappingURL=index-
|
|
26930
|
+
//# sourceMappingURL=index-o3TKXqkj.cjs.map
|