@pixldocs/canvas-renderer 0.5.301 → 0.5.302
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-BUG1_dx7.cjs → index-Basn7lBW.cjs} +87 -8
- package/dist/index-Basn7lBW.cjs.map +1 -0
- package/dist/{index-CUodp3G_.js → index-ZeWTxoUj.js} +87 -8
- package/dist/index-ZeWTxoUj.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-wfJpS8kd.js → vectorPdfExport-Bje676YF.js} +4 -4
- package/dist/{vectorPdfExport-wfJpS8kd.js.map → vectorPdfExport-Bje676YF.js.map} +1 -1
- package/dist/{vectorPdfExport-hHMDys-j.cjs → vectorPdfExport-DXYVw9V2.cjs} +4 -4
- package/dist/{vectorPdfExport-hHMDys-j.cjs.map → vectorPdfExport-DXYVw9V2.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BUG1_dx7.cjs.map +0 -1
- package/dist/index-CUodp3G_.js.map +0 -1
|
@@ -1550,7 +1550,7 @@ const useEditorStore = zustand.create((set, get) => ({
|
|
|
1550
1550
|
}
|
|
1551
1551
|
let nextCanvas = updateCurrentPageChildren(state.canvas, () => nextChildren);
|
|
1552
1552
|
nextCanvas.selectedIds = state.canvas.selectedIds.filter(
|
|
1553
|
-
(id) => !
|
|
1553
|
+
(id) => !allDeletedIds.has(id) && !prunedGroupIds.has(id)
|
|
1554
1554
|
);
|
|
1555
1555
|
if (nextCanvas.themeConfig) {
|
|
1556
1556
|
const remainingProps = nextCanvas.themeConfig.properties.filter((p) => !allDeletedIds.has(p.elementId));
|
|
@@ -11305,6 +11305,41 @@ const PageCanvas = react.forwardRef(
|
|
|
11305
11305
|
const [groupResizeState, setGroupResizeState] = react.useState(null);
|
|
11306
11306
|
const [groupOverlayLiveBounds, setGroupOverlayLiveBounds] = react.useState(null);
|
|
11307
11307
|
const setGroupOverlayLiveBoundsRef = react.useRef(setGroupOverlayLiveBounds);
|
|
11308
|
+
const restoreSuppressedGroupMemberVisuals = react.useCallback(() => {
|
|
11309
|
+
const list = suppressGroupMemberBordersRef.current;
|
|
11310
|
+
if (!list || list.length === 0) return;
|
|
11311
|
+
for (const member of list) {
|
|
11312
|
+
const origBorders = member.__pixldocsOrigHasBorders;
|
|
11313
|
+
const origControls = member.__pixldocsOrigHasControls;
|
|
11314
|
+
const origLockX = member.__pixldocsOrigLockScalingX;
|
|
11315
|
+
if (origBorders !== void 0) member.hasBorders = origBorders;
|
|
11316
|
+
else member.hasBorders = true;
|
|
11317
|
+
if (origControls !== void 0) member.hasControls = origControls;
|
|
11318
|
+
else member.hasControls = true;
|
|
11319
|
+
if (origLockX !== void 0) {
|
|
11320
|
+
member.lockScalingX = origLockX;
|
|
11321
|
+
member.lockScalingY = member.__pixldocsOrigLockScalingY;
|
|
11322
|
+
}
|
|
11323
|
+
delete member.__pixldocsOrigHasBorders;
|
|
11324
|
+
delete member.__pixldocsOrigHasControls;
|
|
11325
|
+
delete member.__pixldocsOrigLockScalingX;
|
|
11326
|
+
delete member.__pixldocsOrigLockScalingY;
|
|
11327
|
+
}
|
|
11328
|
+
suppressGroupMemberBordersRef.current = [];
|
|
11329
|
+
}, []);
|
|
11330
|
+
const clearCanvasActiveVisuals = react.useCallback((fc) => {
|
|
11331
|
+
setGroupOverlayLiveBoundsRef.current(null);
|
|
11332
|
+
restoreSuppressedGroupMemberVisuals();
|
|
11333
|
+
try {
|
|
11334
|
+
fc.discardActiveObject();
|
|
11335
|
+
const topContext = fc.contextTop;
|
|
11336
|
+
if (topContext && typeof fc.clearContext === "function") {
|
|
11337
|
+
fc.clearContext(topContext);
|
|
11338
|
+
}
|
|
11339
|
+
fc.requestRenderAll();
|
|
11340
|
+
} catch {
|
|
11341
|
+
}
|
|
11342
|
+
}, [restoreSuppressedGroupMemberVisuals]);
|
|
11308
11343
|
const skipSelectionClearOnDiscardRef = react.useRef(false);
|
|
11309
11344
|
const skipActiveSelectionBakeOnClearRef = react.useRef(false);
|
|
11310
11345
|
const preserveEditingScopeOnSelectionClearRef = react.useRef(false);
|
|
@@ -11393,6 +11428,34 @@ const PageCanvas = react.forwardRef(
|
|
|
11393
11428
|
react.useEffect(() => {
|
|
11394
11429
|
selectedIdsRef.current = selectedIds;
|
|
11395
11430
|
}, [selectedIds]);
|
|
11431
|
+
react.useEffect(() => {
|
|
11432
|
+
const fc = fabricRef.current;
|
|
11433
|
+
if (!fc || !isActive || !currentPage) return;
|
|
11434
|
+
const pageChildren2 = currentPage.children ?? [];
|
|
11435
|
+
const hasMissingSelection = selectedIds.some((id) => !findNodeById(pageChildren2, id));
|
|
11436
|
+
const activeEditingGroupId = fc.__activeEditingGroupId ?? null;
|
|
11437
|
+
const activeEditingGroupMissing = !!activeEditingGroupId && !findNodeById(pageChildren2, activeEditingGroupId);
|
|
11438
|
+
const drilledGroupMissing = !!drilledGroupIdRef.current && !findNodeById(pageChildren2, drilledGroupIdRef.current);
|
|
11439
|
+
const hasGroupEditContext = !!activeEditingGroupId || !!drilledGroupIdRef.current;
|
|
11440
|
+
if (selectedIds.length === 0 && !hasGroupEditContext || hasMissingSelection || activeEditingGroupMissing || drilledGroupMissing) {
|
|
11441
|
+
fc.__activeEditingGroupId = null;
|
|
11442
|
+
drilledGroupIdRef.current = null;
|
|
11443
|
+
setDrilledGroupBounds(null);
|
|
11444
|
+
preserveActiveSelectionAfterTransformRef.current = null;
|
|
11445
|
+
recentGroupSelectionRestoreRef.current = null;
|
|
11446
|
+
clearCanvasActiveVisuals(fc);
|
|
11447
|
+
} else if (hasGroupEditContext) {
|
|
11448
|
+
requestAnimationFrame(() => {
|
|
11449
|
+
var _a2;
|
|
11450
|
+
if (fabricRef.current !== fc) return;
|
|
11451
|
+
try {
|
|
11452
|
+
(_a2 = fc.__updateDrilledGroupOutline) == null ? void 0 : _a2.call(fc);
|
|
11453
|
+
} catch {
|
|
11454
|
+
}
|
|
11455
|
+
fc.requestRenderAll();
|
|
11456
|
+
});
|
|
11457
|
+
}
|
|
11458
|
+
}, [selectedIds, currentPage, isActive, clearCanvasActiveVisuals]);
|
|
11396
11459
|
react.useEffect(() => {
|
|
11397
11460
|
isActiveRef.current = isActive;
|
|
11398
11461
|
if (isEditorMode && isActive && fabricRef.current) ;
|
|
@@ -15294,7 +15357,7 @@ const PageCanvas = react.forwardRef(
|
|
|
15294
15357
|
visibilityUpdateInProgressRef.current = false;
|
|
15295
15358
|
}
|
|
15296
15359
|
doSyncRef.current = () => {
|
|
15297
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
15360
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
15298
15361
|
const shouldSkipUpdates2 = syncLockedRef.current || editLockRef.current;
|
|
15299
15362
|
const state = useEditorStore.getState();
|
|
15300
15363
|
const elementsToSync = elements;
|
|
@@ -15319,10 +15382,20 @@ const PageCanvas = react.forwardRef(
|
|
|
15319
15382
|
const activeBeforeSync = fc.getActiveObject();
|
|
15320
15383
|
const transformSelectionId = preserveSelectionAfterTransformIdRef.current;
|
|
15321
15384
|
const isTransforming2 = !!fc._currentTransform;
|
|
15322
|
-
const
|
|
15385
|
+
const rawActiveSelectionSnapshot = activeBeforeSync instanceof fabric__namespace.ActiveSelection ? {
|
|
15323
15386
|
memberIds: activeBeforeSync.getObjects().map((o) => getObjectId(o)).filter((id) => !!id && id !== "__background__"),
|
|
15324
15387
|
groupSelectionId: activeBeforeSync.__pixldocsGroupSelection
|
|
15325
15388
|
} : preserveActiveSelectionAfterTransformRef.current;
|
|
15389
|
+
const activeSelectionSnapshot = rawActiveSelectionSnapshot ? (() => {
|
|
15390
|
+
let memberIds = rawActiveSelectionSnapshot.memberIds.filter((id) => allElementIds.has(id));
|
|
15391
|
+
const groupSelectionId = rawActiveSelectionSnapshot.groupSelectionId;
|
|
15392
|
+
if (groupSelectionId) {
|
|
15393
|
+
const groupNode = findNodeById(pageTree, groupSelectionId);
|
|
15394
|
+
if (!groupNode || !isGroup(groupNode)) return null;
|
|
15395
|
+
memberIds = getAllElementIds(groupNode.children ?? []).filter((id) => allElementIds.has(id));
|
|
15396
|
+
}
|
|
15397
|
+
return memberIds.length > 0 ? { ...rawActiveSelectionSnapshot, memberIds, groupSelectionId } : null;
|
|
15398
|
+
})() : null;
|
|
15326
15399
|
if (syncTriggeredByPanelRef.current && !transformSelectionId && !shouldSkipUpdates2 && !isTransforming2) {
|
|
15327
15400
|
const activeObj = fc.getActiveObject();
|
|
15328
15401
|
const activeObjId = activeObj ? getObjectId(activeObj) : null;
|
|
@@ -16116,6 +16189,12 @@ const PageCanvas = react.forwardRef(
|
|
|
16116
16189
|
}
|
|
16117
16190
|
}
|
|
16118
16191
|
}
|
|
16192
|
+
if (fc.__activeEditingGroupId) {
|
|
16193
|
+
try {
|
|
16194
|
+
(_k = fc.__updateDrilledGroupOutline) == null ? void 0 : _k.call(fc);
|
|
16195
|
+
} catch {
|
|
16196
|
+
}
|
|
16197
|
+
}
|
|
16119
16198
|
const recentGroupRestore = recentGroupSelectionRestoreRef.current;
|
|
16120
16199
|
if ((recentGroupRestore == null ? void 0 : recentGroupRestore.groupSelectionId) && recentGroupRestore.expiresAt > Date.now()) {
|
|
16121
16200
|
restoreGroupSelectionSnapshot(recentGroupRestore);
|
|
@@ -24043,9 +24122,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24043
24122
|
}
|
|
24044
24123
|
return svgString;
|
|
24045
24124
|
}
|
|
24046
|
-
const resolvedPackageVersion = "0.5.
|
|
24125
|
+
const resolvedPackageVersion = "0.5.302";
|
|
24047
24126
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24048
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24127
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.302";
|
|
24049
24128
|
const roundParityValue = (value) => {
|
|
24050
24129
|
if (typeof value !== "number") return value;
|
|
24051
24130
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24859,7 +24938,7 @@ class PixldocsRenderer {
|
|
|
24859
24938
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24860
24939
|
}
|
|
24861
24940
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24862
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
24941
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DXYVw9V2.cjs"));
|
|
24863
24942
|
const prepared = preparePagesForExport(
|
|
24864
24943
|
cloned.pages,
|
|
24865
24944
|
canvasWidth,
|
|
@@ -27179,7 +27258,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27179
27258
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27180
27259
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27181
27260
|
try {
|
|
27182
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27261
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DXYVw9V2.cjs"));
|
|
27183
27262
|
try {
|
|
27184
27263
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27185
27264
|
} catch {
|
|
@@ -27576,4 +27655,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
27576
27655
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
27577
27656
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
27578
27657
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
27579
|
-
//# sourceMappingURL=index-
|
|
27658
|
+
//# sourceMappingURL=index-Basn7lBW.cjs.map
|