@pixldocs/canvas-renderer 0.5.282 → 0.5.284
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-d5uaicum.js → index-BAQJjsT4.js} +40 -62
- package/dist/index-BAQJjsT4.js.map +1 -0
- package/dist/{index-DeBKmZZc.cjs → index-n9HBI3ow.cjs} +40 -62
- package/dist/index-n9HBI3ow.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CIvJyIlB.cjs → vectorPdfExport-C28yMJ_a.cjs} +4 -4
- package/dist/{vectorPdfExport-CIvJyIlB.cjs.map → vectorPdfExport-C28yMJ_a.cjs.map} +1 -1
- package/dist/{vectorPdfExport-DRVboAKK.js → vectorPdfExport-LTu10COA.js} +4 -4
- package/dist/{vectorPdfExport-DRVboAKK.js.map → vectorPdfExport-LTu10COA.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DeBKmZZc.cjs.map +0 -1
- package/dist/index-d5uaicum.js.map +0 -1
|
@@ -10478,7 +10478,7 @@ let ensureCanvaControlRenders = () => {
|
|
|
10478
10478
|
};
|
|
10479
10479
|
const shouldLogGroupMove = () => {
|
|
10480
10480
|
if (typeof window === "undefined") return false;
|
|
10481
|
-
return window.__pixldocsDebugGroupMove
|
|
10481
|
+
return window.__pixldocsDebugGroupMove === true;
|
|
10482
10482
|
};
|
|
10483
10483
|
try {
|
|
10484
10484
|
const InteractiveBase = fabric.InteractiveFabricObject ?? fabric.Object;
|
|
@@ -13905,7 +13905,7 @@ const PageCanvas = forwardRef(
|
|
|
13905
13905
|
let cropGroupSaveTimer = null;
|
|
13906
13906
|
let objectModifiedInFlight = false;
|
|
13907
13907
|
fabricCanvas.on("object:modified", (e) => {
|
|
13908
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j
|
|
13908
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
13909
13909
|
if (objectModifiedInFlight) {
|
|
13910
13910
|
if (shouldLogGroupMove()) {
|
|
13911
13911
|
console.log("[GRP-MOVE] object:modified re-entry skipped", {
|
|
@@ -14298,10 +14298,7 @@ const PageCanvas = forwardRef(
|
|
|
14298
14298
|
const groupAbs = getAbsoluteBounds(groupToMove, pageChildren2);
|
|
14299
14299
|
let movedGroupLeft = groupAbs.left;
|
|
14300
14300
|
let movedGroupTop = groupAbs.top;
|
|
14301
|
-
if (activeObj instanceof fabric.ActiveSelection &&
|
|
14302
|
-
movedGroupLeft = groupAbs.left + activeSelectionDelta.x;
|
|
14303
|
-
movedGroupTop = groupAbs.top + activeSelectionDelta.y;
|
|
14304
|
-
} else if (activeObj instanceof fabric.ActiveSelection && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
|
|
14301
|
+
if (activeObj instanceof fabric.ActiveSelection && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
|
|
14305
14302
|
const selectionRect = activeObj.getBoundingRect();
|
|
14306
14303
|
movedGroupLeft = transformStart.groupLeft + (selectionRect.left - transformStart.selectionLeft);
|
|
14307
14304
|
movedGroupTop = transformStart.groupTop + (selectionRect.top - transformStart.selectionTop);
|
|
@@ -14371,26 +14368,29 @@ const PageCanvas = forwardRef(
|
|
|
14371
14368
|
setDrilledGroupBounds(null);
|
|
14372
14369
|
drilledGroupIdRef.current = null;
|
|
14373
14370
|
const groupSelectionId = (isActiveSelection && activeObj instanceof fabric.ActiveSelection ? activeObj.__pixldocsGroupSelection : void 0) ?? groupToMove.id;
|
|
14374
|
-
const
|
|
14375
|
-
|
|
14376
|
-
|
|
14377
|
-
|
|
14378
|
-
|
|
14379
|
-
memberIds: preservedGroupMemberIds,
|
|
14380
|
-
groupSelectionId,
|
|
14381
|
-
expiresAt: Date.now() + 1200
|
|
14382
|
-
};
|
|
14383
|
-
preservedGroupMemberIds.forEach((id) => {
|
|
14384
|
-
justModifiedIdsRef.current.add(id);
|
|
14385
|
-
modifiedIdsThisRound.add(id);
|
|
14386
|
-
});
|
|
14387
|
-
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14371
|
+
const targetObjects = isActiveSelection && activeObj instanceof fabric.ActiveSelection ? activeObj.getObjects() : activeObjects;
|
|
14372
|
+
if (groupSelectionId && activeObj instanceof fabric.ActiveSelection) {
|
|
14373
|
+
restoreGroupSelectionVisualState(activeObj, groupSelectionId);
|
|
14374
|
+
fabricCanvas.setActiveObject(activeObj);
|
|
14375
|
+
activeObj.setCoords();
|
|
14388
14376
|
}
|
|
14389
14377
|
selectElements([groupSelectionId], false, false);
|
|
14390
14378
|
fabricCanvas.requestRenderAll();
|
|
14391
14379
|
elementsRef.current = getCurrentElements();
|
|
14380
|
+
for (const obj of targetObjects) {
|
|
14381
|
+
const objId = getObjectId(obj);
|
|
14382
|
+
if (objId && objId !== "__background__") {
|
|
14383
|
+
justModifiedIdsRef.current.add(objId);
|
|
14384
|
+
modifiedIdsThisRound.add(objId);
|
|
14385
|
+
}
|
|
14386
|
+
}
|
|
14387
|
+
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14392
14388
|
groupSelectionTransformStartRef.current = null;
|
|
14393
14389
|
activeSelectionMoveStartRef.current = null;
|
|
14390
|
+
restorePreservedGroupSelectionSoon({
|
|
14391
|
+
memberIds: targetObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__"),
|
|
14392
|
+
groupSelectionId
|
|
14393
|
+
});
|
|
14394
14394
|
unlockEditsSoon();
|
|
14395
14395
|
return;
|
|
14396
14396
|
}
|
|
@@ -14652,7 +14652,7 @@ const PageCanvas = forwardRef(
|
|
|
14652
14652
|
updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
|
|
14653
14653
|
obj.setCoords();
|
|
14654
14654
|
}
|
|
14655
|
-
const pageChildrenForReflow = ((
|
|
14655
|
+
const pageChildrenForReflow = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
|
|
14656
14656
|
const stackGroupsToReflow = /* @__PURE__ */ new Set();
|
|
14657
14657
|
for (const id of modifiedIdsThisRound) {
|
|
14658
14658
|
const parent = findParentGroup(pageChildrenForReflow, id);
|
|
@@ -15019,23 +15019,6 @@ const PageCanvas = forwardRef(
|
|
|
15019
15019
|
fc.discardActiveObject();
|
|
15020
15020
|
}
|
|
15021
15021
|
}
|
|
15022
|
-
const forceLogicalGroupStorePositionSyncIds = /* @__PURE__ */ new Set();
|
|
15023
|
-
const needsLooseLogicalGroupPositionSync = !!((activeSelectionSnapshot == null ? void 0 : activeSelectionSnapshot.groupSelectionId) && !syncTriggeredByPanelRef.current && !shouldSkipUpdates2 && !isTransforming2 && activeSelectionSnapshot.memberIds.some((id) => justModifiedIdsRef.current.has(id)));
|
|
15024
|
-
if (needsLooseLogicalGroupPositionSync) {
|
|
15025
|
-
activeSelectionSnapshot.memberIds.forEach((id) => forceLogicalGroupStorePositionSyncIds.add(id));
|
|
15026
|
-
const activeForLooseSync = fc.getActiveObject();
|
|
15027
|
-
if (activeForLooseSync instanceof fabric.ActiveSelection && activeForLooseSync.__pixldocsGroupSelection === activeSelectionSnapshot.groupSelectionId) {
|
|
15028
|
-
try {
|
|
15029
|
-
skipSelectionClearOnDiscardRef.current = true;
|
|
15030
|
-
skipActiveSelectionBakeOnClearRef.current = true;
|
|
15031
|
-
fc.discardActiveObject();
|
|
15032
|
-
} finally {
|
|
15033
|
-
skipActiveSelectionBakeOnClearRef.current = false;
|
|
15034
|
-
skipSelectionClearOnDiscardRef.current = false;
|
|
15035
|
-
}
|
|
15036
|
-
}
|
|
15037
|
-
activeSelectionSnapshot.memberIds.forEach((id) => justModifiedIdsRef.current.delete(id));
|
|
15038
|
-
}
|
|
15039
15022
|
const currentFabricObjects = /* @__PURE__ */ new Map();
|
|
15040
15023
|
fc.getObjects().forEach((obj) => {
|
|
15041
15024
|
const id = getObjectId(obj);
|
|
@@ -15049,8 +15032,7 @@ const PageCanvas = forwardRef(
|
|
|
15049
15032
|
const replacementById = !activeStillOnCanvas && activeId ? fc.getObjects().find((o) => getObjectId(o) === activeId) ?? null : null;
|
|
15050
15033
|
const restoreTarget = activeStillOnCanvas ? activeBeforeSync : replacementById;
|
|
15051
15034
|
const isActiveTextBeingEdited = activeId && editingTextIdRef.current === activeId && activeBeforeSync instanceof fabric.Textbox;
|
|
15052
|
-
|
|
15053
|
-
if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync && !keepLiveLogicalActiveSelection) {
|
|
15035
|
+
if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2) {
|
|
15054
15036
|
const freshMembers = activeSelectionSnapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
|
|
15055
15037
|
if (freshMembers.length > 1) {
|
|
15056
15038
|
isSyncingSelectionToFabricRef.current = true;
|
|
@@ -15060,9 +15042,7 @@ const PageCanvas = forwardRef(
|
|
|
15060
15042
|
applyLogicalGroupSelectionVisualState(newSel, activeSelectionSnapshot.groupSelectionId);
|
|
15061
15043
|
}
|
|
15062
15044
|
fc.setActiveObject(newSel);
|
|
15063
|
-
|
|
15064
|
-
newSel.setCoords();
|
|
15065
|
-
}
|
|
15045
|
+
newSel.setCoords();
|
|
15066
15046
|
fc.requestRenderAll();
|
|
15067
15047
|
} finally {
|
|
15068
15048
|
isSyncingSelectionToFabricRef.current = false;
|
|
@@ -15477,8 +15457,7 @@ const PageCanvas = forwardRef(
|
|
|
15477
15457
|
continue;
|
|
15478
15458
|
}
|
|
15479
15459
|
if (existingObj instanceof fabric.Group && existingObj.__cropGroup) {
|
|
15480
|
-
|
|
15481
|
-
updateFabricObject(existingObj, element, wasJustModified && !forceStorePositionSync2);
|
|
15460
|
+
updateFabricObject(existingObj, element, wasJustModified);
|
|
15482
15461
|
existingObj.set({
|
|
15483
15462
|
flipX: element.flipX ?? false,
|
|
15484
15463
|
flipY: element.flipY ?? false,
|
|
@@ -15489,7 +15468,7 @@ const PageCanvas = forwardRef(
|
|
|
15489
15468
|
if (wasJustModified) justModifiedIdsRef.current.delete(element.id);
|
|
15490
15469
|
continue;
|
|
15491
15470
|
}
|
|
15492
|
-
if (existingObj instanceof fabric.Textbox && wasJustModified && !syncTriggeredByPanelRef.current
|
|
15471
|
+
if (existingObj instanceof fabric.Textbox && wasJustModified && !syncTriggeredByPanelRef.current) {
|
|
15493
15472
|
justModifiedIdsRef.current.delete(element.id);
|
|
15494
15473
|
continue;
|
|
15495
15474
|
}
|
|
@@ -15508,8 +15487,7 @@ const PageCanvas = forwardRef(
|
|
|
15508
15487
|
return node ? getAbsoluteBounds(node, pageTree) : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15509
15488
|
})() : { left: element.left ?? 0, top: element.top ?? 0 };
|
|
15510
15489
|
const comparePosForImg = getObjectSyncComparePosition(existingObj);
|
|
15511
|
-
const
|
|
15512
|
-
const preserveSelectionMemberPosition = !forceStorePositionSync && shouldPreserveActiveSelectionMemberPosition(existingObj);
|
|
15490
|
+
const preserveSelectionMemberPosition = shouldPreserveActiveSelectionMemberPosition(existingObj);
|
|
15513
15491
|
const positionChanged = !preserveSelectionMemberPosition && (Math.abs(comparePosForImg.left - storePosForImg.left) > 0.1 || Math.abs(comparePosForImg.top - storePosForImg.top) > 0.1);
|
|
15514
15492
|
if (visibilityChanged && !positionChanged || visibilityUpdateInProgressRef.current) {
|
|
15515
15493
|
const isDynamicField = dynamicFieldIds.includes(element.id);
|
|
@@ -15525,7 +15503,7 @@ const PageCanvas = forwardRef(
|
|
|
15525
15503
|
previousVisibilityRef.current.set(element.id, currentVisible);
|
|
15526
15504
|
} else {
|
|
15527
15505
|
if (!visibilityUpdateInProgressRef.current) {
|
|
15528
|
-
updateFabricObject(existingObj, element, wasJustModified
|
|
15506
|
+
updateFabricObject(existingObj, element, wasJustModified || preserveSelectionMemberPosition);
|
|
15529
15507
|
}
|
|
15530
15508
|
const isDynamicField = dynamicFieldIds.includes(element.id);
|
|
15531
15509
|
const canBeEvented = isEditorMode || isPreviewMode && isDynamicField;
|
|
@@ -15558,14 +15536,13 @@ const PageCanvas = forwardRef(
|
|
|
15558
15536
|
const storeTop = storePos.top;
|
|
15559
15537
|
const deltaX = Math.abs(fabricLeft - storeLeft);
|
|
15560
15538
|
const deltaY = Math.abs(fabricTop - storeTop);
|
|
15561
|
-
const
|
|
15562
|
-
const preserveSelectionMemberPosition = !forceStorePositionSync && shouldPreserveActiveSelectionMemberPosition(existingObj);
|
|
15539
|
+
const preserveSelectionMemberPosition = shouldPreserveActiveSelectionMemberPosition(existingObj);
|
|
15563
15540
|
let positionChanged = !preserveSelectionMemberPosition && (deltaX > 0.1 || deltaY > 0.1);
|
|
15564
15541
|
const activeObj = fc.getActiveObject();
|
|
15565
15542
|
const isInActiveSelection = activeObj && (activeObj instanceof fabric.ActiveSelection ? activeObj.getObjects().includes(existingObj) : activeObj === existingObj);
|
|
15566
15543
|
const isInSelectedIds = selectedIdsFromStore.has(element.id);
|
|
15567
15544
|
const isSelected = isInActiveSelection || isInSelectedIds;
|
|
15568
|
-
if (positionChanged && isSelected && (wasJustModified || isBeingTransformed)
|
|
15545
|
+
if (positionChanged && isSelected && (wasJustModified || isBeingTransformed)) {
|
|
15569
15546
|
positionChanged = false;
|
|
15570
15547
|
}
|
|
15571
15548
|
const resolvedSizeForCompare = pageTree.length ? getNodeBounds(element, pageTree) : { width: typeof element.width === "number" ? element.width : 0, height: typeof element.height === "number" ? element.height : 0 };
|
|
@@ -15612,9 +15589,9 @@ const PageCanvas = forwardRef(
|
|
|
15612
15589
|
});
|
|
15613
15590
|
previousVisibilityRef.current.set(element.id, currentVisible);
|
|
15614
15591
|
} else {
|
|
15615
|
-
const skipPositionBecauseSelection = preserveSelectionMemberPosition ||
|
|
15592
|
+
const skipPositionBecauseSelection = preserveSelectionMemberPosition || isSelected && (deltaX > 0.1 || deltaY > 0.1) && (wasJustModified || isBeingTransformed);
|
|
15616
15593
|
const anyChange = positionChanged || otherPropsChanged || forceApplyFromPanel;
|
|
15617
|
-
if (shouldLogGroupMove() && (
|
|
15594
|
+
if (shouldLogGroupMove() && (preserveSelectionMemberPosition || (deltaX > 0.1 || deltaY > 0.1))) {
|
|
15618
15595
|
console.log("[GRP-MOVE] doSync-member", {
|
|
15619
15596
|
id: element.id,
|
|
15620
15597
|
type: element.type,
|
|
@@ -15622,7 +15599,6 @@ const PageCanvas = forwardRef(
|
|
|
15622
15599
|
store: { left: storeLeft, top: storeTop },
|
|
15623
15600
|
delta: { x: deltaX, y: deltaY },
|
|
15624
15601
|
flags: {
|
|
15625
|
-
forceStorePositionSync,
|
|
15626
15602
|
preserveSelectionMemberPosition,
|
|
15627
15603
|
isSelected,
|
|
15628
15604
|
wasJustModified,
|
|
@@ -15637,7 +15613,7 @@ const PageCanvas = forwardRef(
|
|
|
15637
15613
|
}
|
|
15638
15614
|
if (!visibilityUpdateInProgressRef.current) {
|
|
15639
15615
|
if (anyChange && !skipPositionBecauseSelection) {
|
|
15640
|
-
updateFabricObject(existingObj, element, wasJustModified
|
|
15616
|
+
updateFabricObject(existingObj, element, wasJustModified);
|
|
15641
15617
|
if (wasJustModified) justModifiedIdsRef.current.delete(element.id);
|
|
15642
15618
|
} else if (skipPositionBecauseSelection && anyChange) {
|
|
15643
15619
|
const savedLeft = existingObj.left;
|
|
@@ -15805,7 +15781,9 @@ const PageCanvas = forwardRef(
|
|
|
15805
15781
|
const groupSelectionId = activeAfterObjectSync.__pixldocsGroupSelection;
|
|
15806
15782
|
if (groupSelectionId) {
|
|
15807
15783
|
applyLogicalGroupSelectionVisualState(activeAfterObjectSync, groupSelectionId);
|
|
15808
|
-
activeAfterObjectSync.
|
|
15784
|
+
if (!activeAfterObjectSync.getObjects().every((obj) => !(obj instanceof fabric.Group))) {
|
|
15785
|
+
activeAfterObjectSync.setCoords();
|
|
15786
|
+
}
|
|
15809
15787
|
}
|
|
15810
15788
|
}
|
|
15811
15789
|
isRebuildingRef.current = false;
|
|
@@ -23816,9 +23794,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23816
23794
|
}
|
|
23817
23795
|
return svgString;
|
|
23818
23796
|
}
|
|
23819
|
-
const resolvedPackageVersion = "0.5.
|
|
23797
|
+
const resolvedPackageVersion = "0.5.284";
|
|
23820
23798
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23821
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23799
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.284";
|
|
23822
23800
|
const roundParityValue = (value) => {
|
|
23823
23801
|
if (typeof value !== "number") return value;
|
|
23824
23802
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24632,7 +24610,7 @@ class PixldocsRenderer {
|
|
|
24632
24610
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24633
24611
|
}
|
|
24634
24612
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24635
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
24613
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-LTu10COA.js");
|
|
24636
24614
|
const prepared = preparePagesForExport(
|
|
24637
24615
|
cloned.pages,
|
|
24638
24616
|
canvasWidth,
|
|
@@ -26952,7 +26930,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26952
26930
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26953
26931
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26954
26932
|
try {
|
|
26955
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
26933
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-LTu10COA.js");
|
|
26956
26934
|
try {
|
|
26957
26935
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26958
26936
|
} catch {
|
|
@@ -27352,4 +27330,4 @@ export {
|
|
|
27352
27330
|
buildTeaserBlurFlatKeys as y,
|
|
27353
27331
|
collectFontDescriptorsFromConfig as z
|
|
27354
27332
|
};
|
|
27355
|
-
//# sourceMappingURL=index-
|
|
27333
|
+
//# sourceMappingURL=index-BAQJjsT4.js.map
|