@pixldocs/canvas-renderer 0.5.276 → 0.5.278
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-AzU8Pmse.cjs → index-C_w-eu19.cjs} +61 -35
- package/dist/index-C_w-eu19.cjs.map +1 -0
- package/dist/{index-CszEZlZ7.js → index-Cui21a0a.js} +61 -35
- package/dist/index-Cui21a0a.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-C9akdCtS.js → vectorPdfExport-DZihV42S.js} +4 -4
- package/dist/{vectorPdfExport-C9akdCtS.js.map → vectorPdfExport-DZihV42S.js.map} +1 -1
- package/dist/{vectorPdfExport-CvLitjuI.cjs → vectorPdfExport-IKhMqJIE.cjs} +4 -4
- package/dist/{vectorPdfExport-CvLitjuI.cjs.map → vectorPdfExport-IKhMqJIE.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-AzU8Pmse.cjs.map +0 -1
- package/dist/index-CszEZlZ7.js.map +0 -1
|
@@ -10476,6 +10476,10 @@ const SELECTION_PRIMARY = "hsl(217, 91%, 60%)";
|
|
|
10476
10476
|
const SELECTION_BORDER_SCALE = 2;
|
|
10477
10477
|
let ensureCanvaControlRenders = () => {
|
|
10478
10478
|
};
|
|
10479
|
+
const shouldLogGroupMove = () => {
|
|
10480
|
+
if (typeof window === "undefined") return false;
|
|
10481
|
+
return window.__pixldocsDebugGroupMove !== false;
|
|
10482
|
+
};
|
|
10479
10483
|
try {
|
|
10480
10484
|
const InteractiveBase = fabric.InteractiveFabricObject ?? fabric.Object;
|
|
10481
10485
|
if ((InteractiveBase == null ? void 0 : InteractiveBase.prototype) && !InteractiveBase.prototype.__pixldocsCenteredSelectionBorder) {
|
|
@@ -10925,20 +10929,31 @@ try {
|
|
|
10925
10929
|
} catch (e) {
|
|
10926
10930
|
}
|
|
10927
10931
|
};
|
|
10928
|
-
const
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10932
|
+
const tryPatchFactory = (target, key, bindTarget = target) => {
|
|
10933
|
+
try {
|
|
10934
|
+
if (!target || typeof target[key] !== "function") return;
|
|
10935
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
10936
|
+
if (descriptor && descriptor.writable === false && !descriptor.set) return;
|
|
10937
|
+
const original = target[key].bind(bindTarget);
|
|
10938
|
+
target[key] = () => installPillRenders(original());
|
|
10939
|
+
} catch {
|
|
10940
|
+
}
|
|
10941
|
+
};
|
|
10942
|
+
tryPatchFactory(cu, "createObjectDefaultControls");
|
|
10943
|
+
tryPatchFactory(cu, "createTextboxDefaultControls");
|
|
10934
10944
|
const wrapClassCreateControls = (Klass) => {
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10945
|
+
try {
|
|
10946
|
+
if (!Klass || typeof Klass.createControls !== "function") return;
|
|
10947
|
+
const descriptor = Object.getOwnPropertyDescriptor(Klass, "createControls");
|
|
10948
|
+
if (descriptor && descriptor.writable === false && !descriptor.set) return;
|
|
10949
|
+
const orig = Klass.createControls.bind(Klass);
|
|
10950
|
+
Klass.createControls = () => {
|
|
10951
|
+
const res = orig();
|
|
10952
|
+
if (res && res.controls) installPillRenders(res.controls);
|
|
10953
|
+
return res;
|
|
10954
|
+
};
|
|
10955
|
+
} catch {
|
|
10956
|
+
}
|
|
10942
10957
|
};
|
|
10943
10958
|
wrapClassCreateControls(fabric.InteractiveFabricObject);
|
|
10944
10959
|
wrapClassCreateControls(fabric.FabricObject);
|
|
@@ -10961,8 +10976,7 @@ try {
|
|
|
10961
10976
|
};
|
|
10962
10977
|
}
|
|
10963
10978
|
}
|
|
10964
|
-
} catch
|
|
10965
|
-
console.warn("[PageCanvas] Failed to install Canva-style control handles:", e);
|
|
10979
|
+
} catch {
|
|
10966
10980
|
}
|
|
10967
10981
|
const scaleTextPathConfig = (textPath, sx, sy, uniform) => {
|
|
10968
10982
|
if (!textPath || typeof textPath !== "object") return textPath;
|
|
@@ -13889,14 +13903,24 @@ const PageCanvas = forwardRef(
|
|
|
13889
13903
|
}
|
|
13890
13904
|
});
|
|
13891
13905
|
let cropGroupSaveTimer = null;
|
|
13906
|
+
let objectModifiedInFlight = false;
|
|
13892
13907
|
fabricCanvas.on("object:modified", (e) => {
|
|
13893
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
13908
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
13909
|
+
if (objectModifiedInFlight) {
|
|
13910
|
+
if (shouldLogGroupMove()) {
|
|
13911
|
+
console.log("[GRP-MOVE] object:modified re-entry skipped", {
|
|
13912
|
+
targetType: (_b2 = (_a2 = e.target) == null ? void 0 : _a2.constructor) == null ? void 0 : _b2.name
|
|
13913
|
+
});
|
|
13914
|
+
}
|
|
13915
|
+
return;
|
|
13916
|
+
}
|
|
13917
|
+
objectModifiedInFlight = true;
|
|
13894
13918
|
try {
|
|
13895
13919
|
dragStarted = false;
|
|
13896
|
-
if (
|
|
13920
|
+
if (shouldLogGroupMove()) {
|
|
13897
13921
|
const t = e.target;
|
|
13898
13922
|
console.log("[GRP-MOVE] object:modified fired", {
|
|
13899
|
-
targetType: (
|
|
13923
|
+
targetType: (_c = t == null ? void 0 : t.constructor) == null ? void 0 : _c.name,
|
|
13900
13924
|
isActiveSelection: t instanceof fabric.ActiveSelection,
|
|
13901
13925
|
groupSelectionId: t ? t.__pixldocsGroupSelection : null,
|
|
13902
13926
|
memberIds: t instanceof fabric.ActiveSelection ? t.getObjects().map((o) => getObjectId(o)) : [getObjectId(t)],
|
|
@@ -13948,7 +13972,7 @@ const PageCanvas = forwardRef(
|
|
|
13948
13972
|
const active = fabricCanvas.getActiveObject();
|
|
13949
13973
|
const activeId = active ? getObjectId(active) : null;
|
|
13950
13974
|
if (active && activeId && activeId !== "__background__" && !(active instanceof fabric.Group)) {
|
|
13951
|
-
const pageChildrenForParent = ((
|
|
13975
|
+
const pageChildrenForParent = ((_d = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
|
|
13952
13976
|
const parentGroup = findParentGroup(pageChildrenForParent, activeId);
|
|
13953
13977
|
if (parentGroup && isGroup(parentGroup) && parentGroup.backgroundColor) {
|
|
13954
13978
|
let fabricSectionGroup = active.group && active.group instanceof fabric.Group ? active.group : null;
|
|
@@ -14030,7 +14054,7 @@ const PageCanvas = forwardRef(
|
|
|
14030
14054
|
useEditorStore.getState().reflowStackGroupInPage(pageId, groupId);
|
|
14031
14055
|
}
|
|
14032
14056
|
const stateAfter = useEditorStore.getState();
|
|
14033
|
-
const pageAfter = ((
|
|
14057
|
+
const pageAfter = ((_e = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
|
|
14034
14058
|
const groupNodeAfter = findNodeById(pageAfter, groupId);
|
|
14035
14059
|
if (groupNodeAfter) {
|
|
14036
14060
|
const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
|
|
@@ -14092,7 +14116,7 @@ const PageCanvas = forwardRef(
|
|
|
14092
14116
|
}
|
|
14093
14117
|
if (active && active instanceof fabric.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
|
|
14094
14118
|
const groupId = getObjectId(active);
|
|
14095
|
-
const pageChildrenSec = ((
|
|
14119
|
+
const pageChildrenSec = ((_f = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _f.children) ?? [];
|
|
14096
14120
|
const modifiedTarget2 = e == null ? void 0 : e.target;
|
|
14097
14121
|
const resizeScaleTarget = lastResizeScaleTargetRef.current;
|
|
14098
14122
|
lastResizeScaleTargetRef.current = null;
|
|
@@ -14123,7 +14147,7 @@ const PageCanvas = forwardRef(
|
|
|
14123
14147
|
const node = findNodeById(pageChildrenSec, groupId);
|
|
14124
14148
|
if (isChildModified && node && !groupMoved) {
|
|
14125
14149
|
const stateAfter = useEditorStore.getState();
|
|
14126
|
-
const pageAfter = ((
|
|
14150
|
+
const pageAfter = ((_g = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _g.children) ?? [];
|
|
14127
14151
|
const groupNodeAfter = findNodeById(pageAfter, groupId);
|
|
14128
14152
|
if (groupNodeAfter) {
|
|
14129
14153
|
const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
|
|
@@ -14139,7 +14163,7 @@ const PageCanvas = forwardRef(
|
|
|
14139
14163
|
}
|
|
14140
14164
|
if (active && active instanceof fabric.Group && !(active instanceof fabric.ActiveSelection) && getObjectId(active)) {
|
|
14141
14165
|
const groupId = getObjectId(active);
|
|
14142
|
-
const pageChildren3 = ((
|
|
14166
|
+
const pageChildren3 = ((_h = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _h.children) ?? [];
|
|
14143
14167
|
const w = (active.width ?? 0) * (active.scaleX ?? 1);
|
|
14144
14168
|
const h = (active.height ?? 0) * (active.scaleY ?? 1);
|
|
14145
14169
|
const centerX = active.left ?? 0;
|
|
@@ -14161,7 +14185,7 @@ const PageCanvas = forwardRef(
|
|
|
14161
14185
|
}
|
|
14162
14186
|
const activeObj = fabricCanvas.getActiveObject();
|
|
14163
14187
|
let activeObjects = fabricCanvas.getActiveObjects();
|
|
14164
|
-
const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((
|
|
14188
|
+
const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((_i = activeSelectionMoveStartRef.current) == null ? void 0 : _i.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
|
|
14165
14189
|
const activeSelectionDelta = activeObj instanceof fabric.ActiveSelection && activeSelectionMoveStart ? (() => {
|
|
14166
14190
|
const rect = activeObj.getBoundingRect();
|
|
14167
14191
|
return {
|
|
@@ -14252,7 +14276,7 @@ const PageCanvas = forwardRef(
|
|
|
14252
14276
|
return memberIds.every((mid) => selectedSet.has(mid));
|
|
14253
14277
|
})();
|
|
14254
14278
|
const groupToMove = candidateIsStack || allMembersSelected ? candidateGroup : null;
|
|
14255
|
-
if (
|
|
14279
|
+
if (shouldLogGroupMove()) {
|
|
14256
14280
|
console.log("[GRP-MOVE] entry", {
|
|
14257
14281
|
selectedElementIds,
|
|
14258
14282
|
isActiveSelection,
|
|
@@ -14328,7 +14352,7 @@ const PageCanvas = forwardRef(
|
|
|
14328
14352
|
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
14329
14353
|
const newLeft = (groupToMove.left ?? 0) + deltaX;
|
|
14330
14354
|
const newTop = (groupToMove.top ?? 0) + deltaY;
|
|
14331
|
-
const __dbg =
|
|
14355
|
+
const __dbg = shouldLogGroupMove();
|
|
14332
14356
|
if (__dbg) {
|
|
14333
14357
|
console.log("[GRP-MOVE] commit", {
|
|
14334
14358
|
groupId: groupToMove.id,
|
|
@@ -14361,7 +14385,7 @@ const PageCanvas = forwardRef(
|
|
|
14361
14385
|
}
|
|
14362
14386
|
} catch {
|
|
14363
14387
|
}
|
|
14364
|
-
const pageAfterMove = ((
|
|
14388
|
+
const pageAfterMove = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
|
|
14365
14389
|
const groupAfterMove = findNodeById(pageAfterMove, groupToMove.id);
|
|
14366
14390
|
const memberIdsAfterMove = groupAfterMove && isGroup(groupAfterMove) ? getAllElementIds(groupAfterMove.children ?? []) : targetObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__");
|
|
14367
14391
|
preservedGroupMemberIds = memberIdsAfterMove;
|
|
@@ -14380,7 +14404,7 @@ const PageCanvas = forwardRef(
|
|
|
14380
14404
|
obj.set({ left: abs.left, top: abs.top });
|
|
14381
14405
|
}
|
|
14382
14406
|
obj.setCoords();
|
|
14383
|
-
if (
|
|
14407
|
+
if (shouldLogGroupMove()) {
|
|
14384
14408
|
console.log("[GRP-MOVE] rebake-member", {
|
|
14385
14409
|
id,
|
|
14386
14410
|
nodeType: node.type,
|
|
@@ -14676,7 +14700,7 @@ const PageCanvas = forwardRef(
|
|
|
14676
14700
|
updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
|
|
14677
14701
|
obj.setCoords();
|
|
14678
14702
|
}
|
|
14679
|
-
const pageChildrenForReflow = ((
|
|
14703
|
+
const pageChildrenForReflow = ((_k = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _k.children) ?? [];
|
|
14680
14704
|
const stackGroupsToReflow = /* @__PURE__ */ new Set();
|
|
14681
14705
|
for (const id of modifiedIdsThisRound) {
|
|
14682
14706
|
const parent = findParentGroup(pageChildrenForReflow, id);
|
|
@@ -14745,6 +14769,8 @@ const PageCanvas = forwardRef(
|
|
|
14745
14769
|
} catch (e2) {
|
|
14746
14770
|
lastResizeScaleCornerRef.current = null;
|
|
14747
14771
|
unlockEditsSoon();
|
|
14772
|
+
} finally {
|
|
14773
|
+
objectModifiedInFlight = false;
|
|
14748
14774
|
}
|
|
14749
14775
|
});
|
|
14750
14776
|
fabricCanvas.on("before:selection:cleared", (e) => {
|
|
@@ -15634,7 +15660,7 @@ const PageCanvas = forwardRef(
|
|
|
15634
15660
|
} else {
|
|
15635
15661
|
const skipPositionBecauseSelection = preserveSelectionMemberPosition || !forceStorePositionSync && isSelected && (deltaX > 0.1 || deltaY > 0.1) && (wasJustModified || isBeingTransformed);
|
|
15636
15662
|
const anyChange = positionChanged || otherPropsChanged || forceApplyFromPanel;
|
|
15637
|
-
if (
|
|
15663
|
+
if (shouldLogGroupMove() && (forceStorePositionSync || preserveSelectionMemberPosition || (deltaX > 0.1 || deltaY > 0.1))) {
|
|
15638
15664
|
console.log("[GRP-MOVE] doSync-member", {
|
|
15639
15665
|
id: element.id,
|
|
15640
15666
|
type: element.type,
|
|
@@ -23837,9 +23863,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23837
23863
|
}
|
|
23838
23864
|
return svgString;
|
|
23839
23865
|
}
|
|
23840
|
-
const resolvedPackageVersion = "0.5.
|
|
23866
|
+
const resolvedPackageVersion = "0.5.278";
|
|
23841
23867
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23842
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23868
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.278";
|
|
23843
23869
|
const roundParityValue = (value) => {
|
|
23844
23870
|
if (typeof value !== "number") return value;
|
|
23845
23871
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24653,7 +24679,7 @@ class PixldocsRenderer {
|
|
|
24653
24679
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24654
24680
|
}
|
|
24655
24681
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24656
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
24682
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DZihV42S.js");
|
|
24657
24683
|
const prepared = preparePagesForExport(
|
|
24658
24684
|
cloned.pages,
|
|
24659
24685
|
canvasWidth,
|
|
@@ -26973,7 +26999,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26973
26999
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26974
27000
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26975
27001
|
try {
|
|
26976
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27002
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DZihV42S.js");
|
|
26977
27003
|
try {
|
|
26978
27004
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26979
27005
|
} catch {
|
|
@@ -27373,4 +27399,4 @@ export {
|
|
|
27373
27399
|
buildTeaserBlurFlatKeys as y,
|
|
27374
27400
|
collectFontDescriptorsFromConfig as z
|
|
27375
27401
|
};
|
|
27376
|
-
//# sourceMappingURL=index-
|
|
27402
|
+
//# sourceMappingURL=index-Cui21a0a.js.map
|