@pixldocs/canvas-renderer 0.5.275 → 0.5.277
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-CRmR2BYr.cjs → index-DcwU_VE_.cjs} +76 -32
- package/dist/index-DcwU_VE_.cjs.map +1 -0
- package/dist/{index-Cs7F2355.js → index-uuizjIPx.js} +76 -32
- package/dist/index-uuizjIPx.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CZa1TypE.js → vectorPdfExport-CateNrsD.js} +4 -4
- package/dist/{vectorPdfExport-CZa1TypE.js.map → vectorPdfExport-CateNrsD.js.map} +1 -1
- package/dist/{vectorPdfExport-2pqCA90u.cjs → vectorPdfExport-D1OXNkaD.cjs} +4 -4
- package/dist/{vectorPdfExport-2pqCA90u.cjs.map → vectorPdfExport-D1OXNkaD.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CRmR2BYr.cjs.map +0 -1
- package/dist/index-Cs7F2355.js.map +0 -1
|
@@ -10494,6 +10494,10 @@ const SELECTION_PRIMARY = "hsl(217, 91%, 60%)";
|
|
|
10494
10494
|
const SELECTION_BORDER_SCALE = 2;
|
|
10495
10495
|
let ensureCanvaControlRenders = () => {
|
|
10496
10496
|
};
|
|
10497
|
+
const shouldLogGroupMove = () => {
|
|
10498
|
+
if (typeof window === "undefined") return false;
|
|
10499
|
+
return window.__pixldocsDebugGroupMove !== false;
|
|
10500
|
+
};
|
|
10497
10501
|
try {
|
|
10498
10502
|
const InteractiveBase = fabric__namespace.InteractiveFabricObject ?? fabric__namespace.Object;
|
|
10499
10503
|
if ((InteractiveBase == null ? void 0 : InteractiveBase.prototype) && !InteractiveBase.prototype.__pixldocsCenteredSelectionBorder) {
|
|
@@ -10943,20 +10947,31 @@ try {
|
|
|
10943
10947
|
} catch (e) {
|
|
10944
10948
|
}
|
|
10945
10949
|
};
|
|
10946
|
-
const
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10950
|
+
const tryPatchFactory = (target, key, bindTarget = target) => {
|
|
10951
|
+
try {
|
|
10952
|
+
if (!target || typeof target[key] !== "function") return;
|
|
10953
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
10954
|
+
if (descriptor && descriptor.writable === false && !descriptor.set) return;
|
|
10955
|
+
const original = target[key].bind(bindTarget);
|
|
10956
|
+
target[key] = () => installPillRenders(original());
|
|
10957
|
+
} catch {
|
|
10958
|
+
}
|
|
10959
|
+
};
|
|
10960
|
+
tryPatchFactory(cu, "createObjectDefaultControls");
|
|
10961
|
+
tryPatchFactory(cu, "createTextboxDefaultControls");
|
|
10952
10962
|
const wrapClassCreateControls = (Klass) => {
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10963
|
+
try {
|
|
10964
|
+
if (!Klass || typeof Klass.createControls !== "function") return;
|
|
10965
|
+
const descriptor = Object.getOwnPropertyDescriptor(Klass, "createControls");
|
|
10966
|
+
if (descriptor && descriptor.writable === false && !descriptor.set) return;
|
|
10967
|
+
const orig = Klass.createControls.bind(Klass);
|
|
10968
|
+
Klass.createControls = () => {
|
|
10969
|
+
const res = orig();
|
|
10970
|
+
if (res && res.controls) installPillRenders(res.controls);
|
|
10971
|
+
return res;
|
|
10972
|
+
};
|
|
10973
|
+
} catch {
|
|
10974
|
+
}
|
|
10960
10975
|
};
|
|
10961
10976
|
wrapClassCreateControls(fabric__namespace.InteractiveFabricObject);
|
|
10962
10977
|
wrapClassCreateControls(fabric__namespace.FabricObject);
|
|
@@ -10979,8 +10994,7 @@ try {
|
|
|
10979
10994
|
};
|
|
10980
10995
|
}
|
|
10981
10996
|
}
|
|
10982
|
-
} catch
|
|
10983
|
-
console.warn("[PageCanvas] Failed to install Canva-style control handles:", e);
|
|
10997
|
+
} catch {
|
|
10984
10998
|
}
|
|
10985
10999
|
const scaleTextPathConfig = (textPath, sx, sy, uniform) => {
|
|
10986
11000
|
if (!textPath || typeof textPath !== "object") return textPath;
|
|
@@ -13908,9 +13922,23 @@ const PageCanvas = react.forwardRef(
|
|
|
13908
13922
|
});
|
|
13909
13923
|
let cropGroupSaveTimer = null;
|
|
13910
13924
|
fabricCanvas.on("object:modified", (e) => {
|
|
13911
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
|
13925
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
13912
13926
|
try {
|
|
13913
13927
|
dragStarted = false;
|
|
13928
|
+
if (shouldLogGroupMove()) {
|
|
13929
|
+
const t = e.target;
|
|
13930
|
+
console.log("[GRP-MOVE] object:modified fired", {
|
|
13931
|
+
targetType: (_a2 = t == null ? void 0 : t.constructor) == null ? void 0 : _a2.name,
|
|
13932
|
+
isActiveSelection: t instanceof fabric__namespace.ActiveSelection,
|
|
13933
|
+
groupSelectionId: t ? t.__pixldocsGroupSelection : null,
|
|
13934
|
+
memberIds: t instanceof fabric__namespace.ActiveSelection ? t.getObjects().map((o) => getObjectId(o)) : [getObjectId(t)],
|
|
13935
|
+
targetLeft: t == null ? void 0 : t.left,
|
|
13936
|
+
targetTop: t == null ? void 0 : t.top,
|
|
13937
|
+
scaleX: t == null ? void 0 : t.scaleX,
|
|
13938
|
+
scaleY: t == null ? void 0 : t.scaleY,
|
|
13939
|
+
angle: t == null ? void 0 : t.angle
|
|
13940
|
+
});
|
|
13941
|
+
}
|
|
13914
13942
|
setGuides([]);
|
|
13915
13943
|
setGroupOverlayLiveBoundsRef.current(null);
|
|
13916
13944
|
objectResizeActiveSnapRef.current = null;
|
|
@@ -13952,7 +13980,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13952
13980
|
const active = fabricCanvas.getActiveObject();
|
|
13953
13981
|
const activeId = active ? getObjectId(active) : null;
|
|
13954
13982
|
if (active && activeId && activeId !== "__background__" && !(active instanceof fabric__namespace.Group)) {
|
|
13955
|
-
const pageChildrenForParent = ((
|
|
13983
|
+
const pageChildrenForParent = ((_b2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _b2.children) ?? [];
|
|
13956
13984
|
const parentGroup = findParentGroup(pageChildrenForParent, activeId);
|
|
13957
13985
|
if (parentGroup && isGroup(parentGroup) && parentGroup.backgroundColor) {
|
|
13958
13986
|
let fabricSectionGroup = active.group && active.group instanceof fabric__namespace.Group ? active.group : null;
|
|
@@ -14034,7 +14062,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14034
14062
|
useEditorStore.getState().reflowStackGroupInPage(pageId, groupId);
|
|
14035
14063
|
}
|
|
14036
14064
|
const stateAfter = useEditorStore.getState();
|
|
14037
|
-
const pageAfter = ((
|
|
14065
|
+
const pageAfter = ((_c = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
|
|
14038
14066
|
const groupNodeAfter = findNodeById(pageAfter, groupId);
|
|
14039
14067
|
if (groupNodeAfter) {
|
|
14040
14068
|
const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
|
|
@@ -14096,7 +14124,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14096
14124
|
}
|
|
14097
14125
|
if (active && active instanceof fabric__namespace.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
|
|
14098
14126
|
const groupId = getObjectId(active);
|
|
14099
|
-
const pageChildrenSec = ((
|
|
14127
|
+
const pageChildrenSec = ((_d = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
|
|
14100
14128
|
const modifiedTarget2 = e == null ? void 0 : e.target;
|
|
14101
14129
|
const resizeScaleTarget = lastResizeScaleTargetRef.current;
|
|
14102
14130
|
lastResizeScaleTargetRef.current = null;
|
|
@@ -14127,7 +14155,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14127
14155
|
const node = findNodeById(pageChildrenSec, groupId);
|
|
14128
14156
|
if (isChildModified && node && !groupMoved) {
|
|
14129
14157
|
const stateAfter = useEditorStore.getState();
|
|
14130
|
-
const pageAfter = ((
|
|
14158
|
+
const pageAfter = ((_e = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
|
|
14131
14159
|
const groupNodeAfter = findNodeById(pageAfter, groupId);
|
|
14132
14160
|
if (groupNodeAfter) {
|
|
14133
14161
|
const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
|
|
@@ -14143,7 +14171,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14143
14171
|
}
|
|
14144
14172
|
if (active && active instanceof fabric__namespace.Group && !(active instanceof fabric__namespace.ActiveSelection) && getObjectId(active)) {
|
|
14145
14173
|
const groupId = getObjectId(active);
|
|
14146
|
-
const pageChildren3 = ((
|
|
14174
|
+
const pageChildren3 = ((_f = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _f.children) ?? [];
|
|
14147
14175
|
const w = (active.width ?? 0) * (active.scaleX ?? 1);
|
|
14148
14176
|
const h = (active.height ?? 0) * (active.scaleY ?? 1);
|
|
14149
14177
|
const centerX = active.left ?? 0;
|
|
@@ -14165,7 +14193,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14165
14193
|
}
|
|
14166
14194
|
const activeObj = fabricCanvas.getActiveObject();
|
|
14167
14195
|
let activeObjects = fabricCanvas.getActiveObjects();
|
|
14168
|
-
const activeSelectionMoveStart = activeObj instanceof fabric__namespace.ActiveSelection && ((
|
|
14196
|
+
const activeSelectionMoveStart = activeObj instanceof fabric__namespace.ActiveSelection && ((_g = activeSelectionMoveStartRef.current) == null ? void 0 : _g.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
|
|
14169
14197
|
const activeSelectionDelta = activeObj instanceof fabric__namespace.ActiveSelection && activeSelectionMoveStart ? (() => {
|
|
14170
14198
|
const rect = activeObj.getBoundingRect();
|
|
14171
14199
|
return {
|
|
@@ -14256,6 +14284,22 @@ const PageCanvas = react.forwardRef(
|
|
|
14256
14284
|
return memberIds.every((mid) => selectedSet.has(mid));
|
|
14257
14285
|
})();
|
|
14258
14286
|
const groupToMove = candidateIsStack || allMembersSelected ? candidateGroup : null;
|
|
14287
|
+
if (shouldLogGroupMove()) {
|
|
14288
|
+
console.log("[GRP-MOVE] entry", {
|
|
14289
|
+
selectedElementIds,
|
|
14290
|
+
isActiveSelection,
|
|
14291
|
+
activeSelectionGroupId: activeObj instanceof fabric__namespace.ActiveSelection ? activeObj.__pixldocsGroupSelection : null,
|
|
14292
|
+
parentGroupIds: parentGroups.map((g) => g.id),
|
|
14293
|
+
sameDirectParent,
|
|
14294
|
+
commonAncestorId: commonAncestor == null ? void 0 : commonAncestor.id,
|
|
14295
|
+
candidateGroupId: candidateGroup == null ? void 0 : candidateGroup.id,
|
|
14296
|
+
candidateIsStack,
|
|
14297
|
+
allMembersSelected,
|
|
14298
|
+
groupToMoveId: (groupToMove == null ? void 0 : groupToMove.id) ?? null,
|
|
14299
|
+
activeSelectionHadTransform,
|
|
14300
|
+
selectedLogicalGroupIds
|
|
14301
|
+
});
|
|
14302
|
+
}
|
|
14259
14303
|
if (groupToMove) {
|
|
14260
14304
|
const activeGroupSelectionId = activeObj instanceof fabric__namespace.ActiveSelection ? activeObj.__pixldocsGroupSelection : void 0;
|
|
14261
14305
|
const transformStart = activeGroupSelectionId === groupToMove.id ? groupSelectionTransformStartRef.current : null;
|
|
@@ -14316,7 +14360,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14316
14360
|
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
14317
14361
|
const newLeft = (groupToMove.left ?? 0) + deltaX;
|
|
14318
14362
|
const newTop = (groupToMove.top ?? 0) + deltaY;
|
|
14319
|
-
const __dbg =
|
|
14363
|
+
const __dbg = shouldLogGroupMove();
|
|
14320
14364
|
if (__dbg) {
|
|
14321
14365
|
console.log("[GRP-MOVE] commit", {
|
|
14322
14366
|
groupId: groupToMove.id,
|
|
@@ -14349,7 +14393,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14349
14393
|
}
|
|
14350
14394
|
} catch {
|
|
14351
14395
|
}
|
|
14352
|
-
const pageAfterMove = ((
|
|
14396
|
+
const pageAfterMove = ((_h = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _h.children) ?? [];
|
|
14353
14397
|
const groupAfterMove = findNodeById(pageAfterMove, groupToMove.id);
|
|
14354
14398
|
const memberIdsAfterMove = groupAfterMove && isGroup(groupAfterMove) ? getAllElementIds(groupAfterMove.children ?? []) : targetObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__");
|
|
14355
14399
|
preservedGroupMemberIds = memberIdsAfterMove;
|
|
@@ -14368,7 +14412,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14368
14412
|
obj.set({ left: abs.left, top: abs.top });
|
|
14369
14413
|
}
|
|
14370
14414
|
obj.setCoords();
|
|
14371
|
-
if (
|
|
14415
|
+
if (shouldLogGroupMove()) {
|
|
14372
14416
|
console.log("[GRP-MOVE] rebake-member", {
|
|
14373
14417
|
id,
|
|
14374
14418
|
nodeType: node.type,
|
|
@@ -14664,7 +14708,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14664
14708
|
updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
|
|
14665
14709
|
obj.setCoords();
|
|
14666
14710
|
}
|
|
14667
|
-
const pageChildrenForReflow = ((
|
|
14711
|
+
const pageChildrenForReflow = ((_i = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _i.children) ?? [];
|
|
14668
14712
|
const stackGroupsToReflow = /* @__PURE__ */ new Set();
|
|
14669
14713
|
for (const id of modifiedIdsThisRound) {
|
|
14670
14714
|
const parent = findParentGroup(pageChildrenForReflow, id);
|
|
@@ -15622,7 +15666,7 @@ const PageCanvas = react.forwardRef(
|
|
|
15622
15666
|
} else {
|
|
15623
15667
|
const skipPositionBecauseSelection = preserveSelectionMemberPosition || !forceStorePositionSync && isSelected && (deltaX > 0.1 || deltaY > 0.1) && (wasJustModified || isBeingTransformed);
|
|
15624
15668
|
const anyChange = positionChanged || otherPropsChanged || forceApplyFromPanel;
|
|
15625
|
-
if (
|
|
15669
|
+
if (shouldLogGroupMove() && (forceStorePositionSync || preserveSelectionMemberPosition || (deltaX > 0.1 || deltaY > 0.1))) {
|
|
15626
15670
|
console.log("[GRP-MOVE] doSync-member", {
|
|
15627
15671
|
id: element.id,
|
|
15628
15672
|
type: element.type,
|
|
@@ -23825,9 +23869,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23825
23869
|
}
|
|
23826
23870
|
return svgString;
|
|
23827
23871
|
}
|
|
23828
|
-
const resolvedPackageVersion = "0.5.
|
|
23872
|
+
const resolvedPackageVersion = "0.5.277";
|
|
23829
23873
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23830
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23874
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.277";
|
|
23831
23875
|
const roundParityValue = (value) => {
|
|
23832
23876
|
if (typeof value !== "number") return value;
|
|
23833
23877
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24641,7 +24685,7 @@ class PixldocsRenderer {
|
|
|
24641
24685
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24642
24686
|
}
|
|
24643
24687
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24644
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
24688
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-D1OXNkaD.cjs"));
|
|
24645
24689
|
const prepared = preparePagesForExport(
|
|
24646
24690
|
cloned.pages,
|
|
24647
24691
|
canvasWidth,
|
|
@@ -26961,7 +27005,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26961
27005
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26962
27006
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26963
27007
|
try {
|
|
26964
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27008
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-D1OXNkaD.cjs"));
|
|
26965
27009
|
try {
|
|
26966
27010
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26967
27011
|
} catch {
|
|
@@ -27358,4 +27402,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
27358
27402
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
27359
27403
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
27360
27404
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
27361
|
-
//# sourceMappingURL=index-
|
|
27405
|
+
//# sourceMappingURL=index-DcwU_VE_.cjs.map
|