@pixldocs/canvas-renderer 0.5.372 → 0.5.374
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-BAK60IJl.js → index-DQyoK8Nv.js} +121 -90
- package/dist/index-DQyoK8Nv.js.map +1 -0
- package/dist/{index-CLgDLK4-.cjs → index-DpwFuxG9.cjs} +121 -90
- package/dist/index-DpwFuxG9.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-Cy6COeh4.cjs → vectorPdfExport-Cfe50WTF.cjs} +4 -4
- package/dist/{vectorPdfExport-Cy6COeh4.cjs.map → vectorPdfExport-Cfe50WTF.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CwD3b9HF.js → vectorPdfExport-HghwbAxV.js} +4 -4
- package/dist/{vectorPdfExport-CwD3b9HF.js.map → vectorPdfExport-HghwbAxV.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BAK60IJl.js.map +0 -1
- package/dist/index-CLgDLK4-.cjs.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
var _a, _b;
|
|
5
|
+
var _a, _b, _c;
|
|
6
6
|
const jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
const react = require("react");
|
|
8
8
|
const reactDom = require("react-dom");
|
|
@@ -311,14 +311,14 @@ function lineToString(line) {
|
|
|
311
311
|
return Array.isArray(line) ? line.join("") : String(line ?? "");
|
|
312
312
|
}
|
|
313
313
|
function measureTextLineWithCanvas(textbox, lineText, lineIndex) {
|
|
314
|
-
var _a2, _b2,
|
|
314
|
+
var _a2, _b2, _c2, _d, _e;
|
|
315
315
|
if (!lineText) return 0;
|
|
316
316
|
const ctx = getMeasureContext();
|
|
317
317
|
if (!ctx) return null;
|
|
318
318
|
const tb = textbox;
|
|
319
319
|
const fontSize = Number(((_a2 = tb.getValueOfPropertyAt) == null ? void 0 : _a2.call(tb, lineIndex, 0, "fontSize")) ?? textbox.fontSize ?? 16);
|
|
320
320
|
const fontStyle = String(((_b2 = tb.getValueOfPropertyAt) == null ? void 0 : _b2.call(tb, lineIndex, 0, "fontStyle")) ?? textbox.fontStyle ?? "normal");
|
|
321
|
-
const fontWeight = String(((
|
|
321
|
+
const fontWeight = String(((_c2 = tb.getValueOfPropertyAt) == null ? void 0 : _c2.call(tb, lineIndex, 0, "fontWeight")) ?? textbox.fontWeight ?? "400");
|
|
322
322
|
const fontFamily = String(((_d = tb.getValueOfPropertyAt) == null ? void 0 : _d.call(tb, lineIndex, 0, "fontFamily")) ?? textbox.fontFamily ?? "Open Sans");
|
|
323
323
|
const charSpacing = Number(((_e = tb.getValueOfPropertyAt) == null ? void 0 : _e.call(tb, lineIndex, 0, "charSpacing")) ?? textbox.charSpacing ?? 0);
|
|
324
324
|
ctx.save();
|
|
@@ -3638,14 +3638,14 @@ const clearFontCacheAndRerender = (canvas, options = {}) => {
|
|
|
3638
3638
|
canvas.requestRenderAll();
|
|
3639
3639
|
};
|
|
3640
3640
|
const ensureFontLoaded = async (fontFamily) => {
|
|
3641
|
-
var _a2, _b2,
|
|
3641
|
+
var _a2, _b2, _c2;
|
|
3642
3642
|
if (!fontFamily) return;
|
|
3643
3643
|
if (LOCAL_FONTS.has(fontFamily)) {
|
|
3644
3644
|
try {
|
|
3645
3645
|
const isLoaded = (_a2 = document.fonts) == null ? void 0 : _a2.check(`16px "${fontFamily}"`);
|
|
3646
3646
|
if (isLoaded) return;
|
|
3647
3647
|
await ((_b2 = document.fonts) == null ? void 0 : _b2.load(`16px "${fontFamily}"`));
|
|
3648
|
-
await ((
|
|
3648
|
+
await ((_c2 = document.fonts) == null ? void 0 : _c2.load(`bold 16px "${fontFamily}"`));
|
|
3649
3649
|
} catch (e) {
|
|
3650
3650
|
console.warn(`Failed to ensure local font loaded: ${fontFamily}`, e);
|
|
3651
3651
|
}
|
|
@@ -4139,7 +4139,7 @@ function createImageClipPath(element, imgWidth, imgHeight) {
|
|
|
4139
4139
|
}
|
|
4140
4140
|
}
|
|
4141
4141
|
async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef, isTransforming) {
|
|
4142
|
-
var _a2, _b2,
|
|
4142
|
+
var _a2, _b2, _c2, _d;
|
|
4143
4143
|
const imageUrl = element.src || element.imageUrl;
|
|
4144
4144
|
if (!imageUrl) return;
|
|
4145
4145
|
const nextSvgColorMap = element.svgColorMap ? JSON.stringify(element.svgColorMap) : "";
|
|
@@ -4304,7 +4304,7 @@ async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef
|
|
|
4304
4304
|
const existingImg = (_a2 = existingCropGroup.__cropData) == null ? void 0 : _a2._img;
|
|
4305
4305
|
if (existingImg) {
|
|
4306
4306
|
panX = ((_b2 = existingImg._ct) == null ? void 0 : _b2.panX) ?? existingImg.__panX ?? 0.5;
|
|
4307
|
-
panY = ((
|
|
4307
|
+
panY = ((_c2 = existingImg._ct) == null ? void 0 : _c2.panY) ?? existingImg.__panY ?? 0.5;
|
|
4308
4308
|
zoom = ((_d = existingImg._ct) == null ? void 0 : _d.zoom) ?? 1;
|
|
4309
4309
|
}
|
|
4310
4310
|
}
|
|
@@ -4539,7 +4539,7 @@ async function detectMaskType(svgUrl) {
|
|
|
4539
4539
|
}
|
|
4540
4540
|
}
|
|
4541
4541
|
async function applySvgMaskToCropGroup(cropGroup, svgUrl) {
|
|
4542
|
-
var _a2, _b2,
|
|
4542
|
+
var _a2, _b2, _c2;
|
|
4543
4543
|
if (!isCropGroup(cropGroup)) {
|
|
4544
4544
|
throw new Error("Selected object is not a crop group / image");
|
|
4545
4545
|
}
|
|
@@ -4569,7 +4569,7 @@ async function applySvgMaskToCropGroup(cropGroup, svgUrl) {
|
|
|
4569
4569
|
child.dirty = true;
|
|
4570
4570
|
}
|
|
4571
4571
|
}
|
|
4572
|
-
(
|
|
4572
|
+
(_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
|
|
4573
4573
|
}
|
|
4574
4574
|
function loadSvgAsImage(svgUrl) {
|
|
4575
4575
|
return new Promise((resolve, reject) => {
|
|
@@ -4630,7 +4630,7 @@ async function buildLuminanceAlphaCanvas(svgUrl, frameW, frameH) {
|
|
|
4630
4630
|
return canvas;
|
|
4631
4631
|
}
|
|
4632
4632
|
async function applyLuminanceMaskToCropGroup(cropGroup, svgUrl) {
|
|
4633
|
-
var _a2, _b2,
|
|
4633
|
+
var _a2, _b2, _c2;
|
|
4634
4634
|
if (!isCropGroup(cropGroup)) {
|
|
4635
4635
|
throw new Error("Selected object is not a crop group / image");
|
|
4636
4636
|
}
|
|
@@ -4665,7 +4665,7 @@ async function applyLuminanceMaskToCropGroup(cropGroup, svgUrl) {
|
|
|
4665
4665
|
child.dirty = true;
|
|
4666
4666
|
}
|
|
4667
4667
|
}
|
|
4668
|
-
(
|
|
4668
|
+
(_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
|
|
4669
4669
|
}
|
|
4670
4670
|
async function applyMaskToCropGroup(cropGroup, svgUrl, maskType) {
|
|
4671
4671
|
if (maskType === "luminance") {
|
|
@@ -4684,7 +4684,7 @@ function getAppliedSvgMaskType(obj) {
|
|
|
4684
4684
|
return t === "luminance" || t === "shape" ? t : null;
|
|
4685
4685
|
}
|
|
4686
4686
|
function clearSvgMaskFromCropGroup(cropGroup) {
|
|
4687
|
-
var _a2, _b2,
|
|
4687
|
+
var _a2, _b2, _c2;
|
|
4688
4688
|
if (!isCropGroup(cropGroup)) return;
|
|
4689
4689
|
const frameW = ((_a2 = cropGroup._ct) == null ? void 0 : _a2.frameW) ?? cropGroup.width ?? 0;
|
|
4690
4690
|
const frameH = ((_b2 = cropGroup._ct) == null ? void 0 : _b2.frameH) ?? cropGroup.height ?? 0;
|
|
@@ -4706,7 +4706,7 @@ function clearSvgMaskFromCropGroup(cropGroup) {
|
|
|
4706
4706
|
delete cropGroup.__svgMaskUrl;
|
|
4707
4707
|
delete cropGroup.__svgMaskType;
|
|
4708
4708
|
cropGroup.dirty = true;
|
|
4709
|
-
(
|
|
4709
|
+
(_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
|
|
4710
4710
|
}
|
|
4711
4711
|
const svgMaskApply = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4712
4712
|
__proto__: null,
|
|
@@ -6198,7 +6198,7 @@ function calculateScaleSnapGuides(scalingObj, corner, canvas, canvasWidth, canva
|
|
|
6198
6198
|
const MIN_SNAP_BOX = 20;
|
|
6199
6199
|
const SNAP_HYSTERESIS_PX = 6;
|
|
6200
6200
|
function applyScaleSnapToBox(box, corner, canvas, canvasWidth, canvasHeight, snapToGuides, snapThreshold, excludeObjectId, options) {
|
|
6201
|
-
var _a2, _b2,
|
|
6201
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h;
|
|
6202
6202
|
const hysteresis = (options == null ? void 0 : options.hysteresis) ?? SNAP_HYSTERESIS_PX;
|
|
6203
6203
|
const activeSnapRef = options == null ? void 0 : options.activeSnapRef;
|
|
6204
6204
|
const roundSnappedOnly = (options == null ? void 0 : options.roundSnappedOnly) ?? false;
|
|
@@ -6294,7 +6294,7 @@ function applyScaleSnapToBox(box, corner, canvas, canvasWidth, canvasHeight, sna
|
|
|
6294
6294
|
let snappedTop = false;
|
|
6295
6295
|
let snappedBottom = false;
|
|
6296
6296
|
if (resizingLeft) {
|
|
6297
|
-
const stick = (
|
|
6297
|
+
const stick = (_c2 = activeSnapRef == null ? void 0 : activeSnapRef.current) == null ? void 0 : _c2.left;
|
|
6298
6298
|
if (stick !== void 0) {
|
|
6299
6299
|
const dist = Math.abs(box.left - stick);
|
|
6300
6300
|
if (dist <= releaseDist) {
|
|
@@ -6948,7 +6948,7 @@ function scaleLocalToScreen(target, p) {
|
|
|
6948
6948
|
return new fabric__namespace.Point(p.x * sx * zx, p.y * sy * zy);
|
|
6949
6949
|
}
|
|
6950
6950
|
function applyTextPathControls(textbox) {
|
|
6951
|
-
var _a2, _b2,
|
|
6951
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
6952
6952
|
const obj = textbox;
|
|
6953
6953
|
if (!hasActiveTextPath(obj)) {
|
|
6954
6954
|
obj.__pdTextPathHovered = false;
|
|
@@ -6971,7 +6971,7 @@ function applyTextPathControls(textbox) {
|
|
|
6971
6971
|
delete obj.controls.bzMidT1;
|
|
6972
6972
|
delete obj.controls.tpRot;
|
|
6973
6973
|
delete obj.controls.tpPivot;
|
|
6974
|
-
(
|
|
6974
|
+
(_c2 = obj.setControlsVisibility) == null ? void 0 : _c2.call(obj, { tl: true, tr: true, bl: true, br: true, mt: true, mb: true, ml: true, mr: true, mtr: true });
|
|
6975
6975
|
obj.hasBorders = true;
|
|
6976
6976
|
obj.__pdTextPathControls = false;
|
|
6977
6977
|
obj.setCoords();
|
|
@@ -7671,10 +7671,10 @@ function textPathBoundsContainScenePoint(obj, point) {
|
|
|
7671
7671
|
}
|
|
7672
7672
|
}
|
|
7673
7673
|
function drawTextPathBounds(ctx, obj, bounds, hostCanvas) {
|
|
7674
|
-
var _a2, _b2,
|
|
7674
|
+
var _a2, _b2, _c2;
|
|
7675
7675
|
const host = hostCanvas || obj.canvas || ((_a2 = obj.group) == null ? void 0 : _a2.canvas);
|
|
7676
7676
|
if (!host) return;
|
|
7677
|
-
const retina = ((_b2 = host.getRetinaScaling) == null ? void 0 : _b2.call(host)) || ((
|
|
7677
|
+
const retina = ((_b2 = host.getRetinaScaling) == null ? void 0 : _b2.call(host)) || ((_c2 = obj.getCanvasRetinaScaling) == null ? void 0 : _c2.call(obj)) || 1;
|
|
7678
7678
|
const matrix = fabric__namespace.util.multiplyTransformMatrices(host.viewportTransform || [1, 0, 0, 1, 0, 0], obj.calcTransformMatrix());
|
|
7679
7679
|
const corners = [
|
|
7680
7680
|
new fabric__namespace.Point(bounds.minX, bounds.minY),
|
|
@@ -7696,8 +7696,8 @@ function drawTextPathBounds(ctx, obj, bounds, hostCanvas) {
|
|
|
7696
7696
|
}
|
|
7697
7697
|
if (typeof TextboxProto._renderControls === "function" && !TextboxProto.__pixldocsOrigRenderControls) {
|
|
7698
7698
|
let drawWarpGuides = function(ctx) {
|
|
7699
|
-
var _a2, _b2,
|
|
7700
|
-
const hostCanvas = this.canvas || ((_a2 = this.group) == null ? void 0 : _a2.canvas) || ((
|
|
7699
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
|
|
7700
|
+
const hostCanvas = this.canvas || ((_a2 = this.group) == null ? void 0 : _a2.canvas) || ((_c2 = (_b2 = this.group) == null ? void 0 : _b2.group) == null ? void 0 : _c2.canvas);
|
|
7701
7701
|
if (!hostCanvas) return;
|
|
7702
7702
|
const hoverBounds = getTextPathHitBounds(this);
|
|
7703
7703
|
const active = (_d = hostCanvas.getActiveObject) == null ? void 0 : _d.call(hostCanvas);
|
|
@@ -8120,14 +8120,14 @@ function buildRoundedRectPath2D(ctx, x, y, w, h, rTL, rTR, rBR, rBL) {
|
|
|
8120
8120
|
ctx.closePath();
|
|
8121
8121
|
}
|
|
8122
8122
|
function measureLineGlyphWidth(obj, lineIndex) {
|
|
8123
|
-
var _a2, _b2,
|
|
8123
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
8124
8124
|
try {
|
|
8125
8125
|
const rawLine = (_a2 = obj == null ? void 0 : obj._textLines) == null ? void 0 : _a2[lineIndex];
|
|
8126
8126
|
const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
|
|
8127
8127
|
if (!lineText) return 0;
|
|
8128
8128
|
const fontSize = Number(((_b2 = obj.getValueOfPropertyAt) == null ? void 0 : _b2.call(obj, lineIndex, 0, "fontSize")) ?? obj.fontSize ?? 0);
|
|
8129
8129
|
if (!fontSize) return 0;
|
|
8130
|
-
const fontStyle = String(((
|
|
8130
|
+
const fontStyle = String(((_c2 = obj.getValueOfPropertyAt) == null ? void 0 : _c2.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
|
|
8131
8131
|
const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
|
|
8132
8132
|
const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
|
|
8133
8133
|
const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
|
|
@@ -9518,7 +9518,7 @@ function createShape(element) {
|
|
|
9518
9518
|
}
|
|
9519
9519
|
}
|
|
9520
9520
|
function createText(element) {
|
|
9521
|
-
var _a2, _b2,
|
|
9521
|
+
var _a2, _b2, _c2, _d, _e;
|
|
9522
9522
|
const overflowPolicy = element.overflowPolicy || "grow-and-push";
|
|
9523
9523
|
let text = element.text ?? "";
|
|
9524
9524
|
let fontSize = element.fontSize || 16;
|
|
@@ -9734,7 +9734,7 @@ function createText(element) {
|
|
|
9734
9734
|
} catch {
|
|
9735
9735
|
}
|
|
9736
9736
|
try {
|
|
9737
|
-
const baseCtrls = (_d = (
|
|
9737
|
+
const baseCtrls = (_d = (_c2 = fabric__namespace.Object) == null ? void 0 : _c2.prototype) == null ? void 0 : _d.controls;
|
|
9738
9738
|
if (baseCtrls) {
|
|
9739
9739
|
textbox.controls = {
|
|
9740
9740
|
...textbox.controls || {},
|
|
@@ -10592,13 +10592,13 @@ try {
|
|
|
10592
10592
|
};
|
|
10593
10593
|
const COLLAPSE_THRESHOLD_PX = 32;
|
|
10594
10594
|
const shouldCollapseHandles = (fabricObject) => {
|
|
10595
|
-
var _a2, _b2,
|
|
10595
|
+
var _a2, _b2, _c2;
|
|
10596
10596
|
try {
|
|
10597
10597
|
const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
|
|
10598
10598
|
if (!canvas) return false;
|
|
10599
10599
|
const zoom = ((_a2 = canvas.getZoom) == null ? void 0 : _a2.call(canvas)) ?? 1;
|
|
10600
10600
|
const w = (((_b2 = fabricObject.getScaledWidth) == null ? void 0 : _b2.call(fabricObject)) ?? fabricObject.width ?? 0) * zoom;
|
|
10601
|
-
const h = (((
|
|
10601
|
+
const h = (((_c2 = fabricObject.getScaledHeight) == null ? void 0 : _c2.call(fabricObject)) ?? fabricObject.height ?? 0) * zoom;
|
|
10602
10602
|
return Math.min(w, h) < COLLAPSE_THRESHOLD_PX;
|
|
10603
10603
|
} catch {
|
|
10604
10604
|
return false;
|
|
@@ -10616,11 +10616,11 @@ try {
|
|
|
10616
10616
|
control.__pixldocsCollapseVisibilityWrapped = true;
|
|
10617
10617
|
};
|
|
10618
10618
|
const renderPill = (ctx, left, top, _styleOverride, fabricObject, orientation, controlKey) => {
|
|
10619
|
-
var _a2, _b2,
|
|
10619
|
+
var _a2, _b2, _c2;
|
|
10620
10620
|
const action = (_b2 = (_a2 = fabricObject.canvas) == null ? void 0 : _a2._currentTransform) == null ? void 0 : _b2.action;
|
|
10621
10621
|
if (action === "drag" && fabricObject.__pixldocsDragMoved) return;
|
|
10622
10622
|
if (shouldCollapseHandles(fabricObject) && !isVisibleControlWhenCollapsed(controlKey)) return;
|
|
10623
|
-
const angle = ((
|
|
10623
|
+
const angle = ((_c2 = fabricObject.getTotalAngle) == null ? void 0 : _c2.call(fabricObject)) ?? (fabricObject.angle ?? 0);
|
|
10624
10624
|
const p = getHoverProgress(fabricObject, controlKey);
|
|
10625
10625
|
const scale = getVisualScale(fabricObject);
|
|
10626
10626
|
const pillLen = PILL_LEN * scale;
|
|
@@ -10817,7 +10817,7 @@ try {
|
|
|
10817
10817
|
mtr.x = 0;
|
|
10818
10818
|
mtr.y = -0.5;
|
|
10819
10819
|
mtr.cursorStyle = getRotateCursor(null);
|
|
10820
|
-
mtr.cursorStyleHandler = (_e,
|
|
10820
|
+
mtr.cursorStyleHandler = (_e, _c2, fabricObject) => {
|
|
10821
10821
|
const cursor = getRotateCursor(fabricObject);
|
|
10822
10822
|
try {
|
|
10823
10823
|
const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
|
|
@@ -10960,6 +10960,35 @@ try {
|
|
|
10960
10960
|
}
|
|
10961
10961
|
return controls;
|
|
10962
10962
|
};
|
|
10963
|
+
const ControlProto = (_b = fabric__namespace.Control) == null ? void 0 : _b.prototype;
|
|
10964
|
+
if (ControlProto && !ControlProto.__pixldocsCanvaRenderFallback) {
|
|
10965
|
+
const originalControlRender = ControlProto.render;
|
|
10966
|
+
ControlProto.render = function(ctx, left, top, styleOverride, fabricObject) {
|
|
10967
|
+
const actionName = String(this.actionName ?? "");
|
|
10968
|
+
if (actionName !== "rotate" && actionName !== "drag") {
|
|
10969
|
+
const x = Number(this.x ?? 0);
|
|
10970
|
+
const y = Number(this.y ?? 0);
|
|
10971
|
+
const atLeftRight = Math.abs(Math.abs(x) - 0.5) < 1e-3;
|
|
10972
|
+
const atTopBottom = Math.abs(Math.abs(y) - 0.5) < 1e-3;
|
|
10973
|
+
const atCenterX = Math.abs(x) < 1e-3;
|
|
10974
|
+
const atCenterY = Math.abs(y) < 1e-3;
|
|
10975
|
+
if (atLeftRight && atCenterY) {
|
|
10976
|
+
const key = x < 0 ? "ml" : "mr";
|
|
10977
|
+
return renderPill(ctx, left, top, styleOverride, fabricObject, "vertical", key);
|
|
10978
|
+
}
|
|
10979
|
+
if (atCenterX && atTopBottom) {
|
|
10980
|
+
const key = y < 0 ? "mt" : "mb";
|
|
10981
|
+
return renderPill(ctx, left, top, styleOverride, fabricObject, "horizontal", key);
|
|
10982
|
+
}
|
|
10983
|
+
if (atLeftRight && atTopBottom) {
|
|
10984
|
+
const key = `${y < 0 ? "t" : "b"}${x < 0 ? "l" : "r"}`;
|
|
10985
|
+
return renderCornerDot(ctx, left, top, styleOverride, fabricObject, key);
|
|
10986
|
+
}
|
|
10987
|
+
}
|
|
10988
|
+
return originalControlRender.call(this, ctx, left, top, styleOverride, fabricObject);
|
|
10989
|
+
};
|
|
10990
|
+
ControlProto.__pixldocsCanvaRenderFallback = true;
|
|
10991
|
+
}
|
|
10963
10992
|
ensureCanvaControlRenders = (obj) => {
|
|
10964
10993
|
try {
|
|
10965
10994
|
if (obj && obj.controls) installPillRenders(obj.controls);
|
|
@@ -10990,7 +11019,9 @@ try {
|
|
|
10990
11019
|
wrapClassCreateControls(fabric__namespace.FabricObject);
|
|
10991
11020
|
wrapClassCreateControls(fabric__namespace.Textbox);
|
|
10992
11021
|
wrapClassCreateControls(fabric__namespace.IText);
|
|
10993
|
-
|
|
11022
|
+
wrapClassCreateControls(fabric__namespace.ActiveSelection);
|
|
11023
|
+
wrapClassCreateControls(fabric__namespace.Group);
|
|
11024
|
+
const CanvasProto = (_c = fabric__namespace.Canvas) == null ? void 0 : _c.prototype;
|
|
10994
11025
|
if (CanvasProto && typeof CanvasProto._setCursorFromEvent === "function") {
|
|
10995
11026
|
const origSet = CanvasProto._setCursorFromEvent;
|
|
10996
11027
|
CanvasProto._setCursorFromEvent = function(e, target) {
|
|
@@ -11138,14 +11169,14 @@ const matrixForRotDriftLog = (matrix) => {
|
|
|
11138
11169
|
return matrix.map((entry) => roundRotDriftNumber(entry));
|
|
11139
11170
|
};
|
|
11140
11171
|
const summarizeRotDriftObject = (obj, worldMatrix) => {
|
|
11141
|
-
var _a2, _b2,
|
|
11172
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
11142
11173
|
if (!obj) return null;
|
|
11143
11174
|
const anyObj = obj;
|
|
11144
11175
|
try {
|
|
11145
11176
|
const ownMatrix = (_a2 = obj.calcOwnMatrix) == null ? void 0 : _a2.call(obj);
|
|
11146
11177
|
const calcWorld = worldMatrix ?? ((_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj));
|
|
11147
11178
|
const decomposed = calcWorld ? fabric__namespace.util.qrDecompose(calcWorld) : null;
|
|
11148
|
-
const center = (
|
|
11179
|
+
const center = (_c2 = obj.getCenterPoint) == null ? void 0 : _c2.call(obj);
|
|
11149
11180
|
const rect = (_d = obj.getBoundingRect) == null ? void 0 : _d.call(obj);
|
|
11150
11181
|
return {
|
|
11151
11182
|
id: getObjectId(obj),
|
|
@@ -12676,7 +12707,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12676
12707
|
clearSectionGroupTransientSnapshot();
|
|
12677
12708
|
});
|
|
12678
12709
|
const syncSelectionToStore = () => {
|
|
12679
|
-
var _a2, _b2,
|
|
12710
|
+
var _a2, _b2, _c2, _d;
|
|
12680
12711
|
if (!isActiveRef.current || isRebuildingRef.current || isSyncingSelectionToFabricRef.current || !allowSelection) return;
|
|
12681
12712
|
const walkToTopmostGroup = (childId, children, activeEditingGroupId) => {
|
|
12682
12713
|
let topmost = null;
|
|
@@ -12745,7 +12776,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12745
12776
|
}
|
|
12746
12777
|
if (ids.length > 1 && !(active instanceof fabric__namespace.ActiveSelection && active.__pixldocsGroupSelection)) {
|
|
12747
12778
|
const state = useEditorStore.getState();
|
|
12748
|
-
const currentPage2 = (
|
|
12779
|
+
const currentPage2 = (_c2 = state.canvas.pages) == null ? void 0 : _c2.find((p) => p.id === pageId);
|
|
12749
12780
|
const children = (currentPage2 == null ? void 0 : currentPage2.children) ?? [];
|
|
12750
12781
|
const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
|
|
12751
12782
|
const involvedGroupIds = /* @__PURE__ */ new Set();
|
|
@@ -12886,7 +12917,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12886
12917
|
}
|
|
12887
12918
|
});
|
|
12888
12919
|
fabricCanvas.on("mouse:dblclick", (opt) => {
|
|
12889
|
-
var _a2, _b2,
|
|
12920
|
+
var _a2, _b2, _c2;
|
|
12890
12921
|
const target = opt == null ? void 0 : opt.target;
|
|
12891
12922
|
if (!target) return;
|
|
12892
12923
|
if (target.isEditing) return;
|
|
@@ -12982,7 +13013,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12982
13013
|
const selectedId = selectionIdx < 0 ? childId : chain[selectionIdx].id;
|
|
12983
13014
|
selectElements([selectedId], false, false);
|
|
12984
13015
|
try {
|
|
12985
|
-
(
|
|
13016
|
+
(_c2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c2.call(fabricCanvas);
|
|
12986
13017
|
} catch {
|
|
12987
13018
|
}
|
|
12988
13019
|
});
|
|
@@ -13133,7 +13164,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13133
13164
|
};
|
|
13134
13165
|
const isMultiSelectModifier = (event) => !!((event == null ? void 0 : event.shiftKey) || (event == null ? void 0 : event.metaKey) || (event == null ? void 0 : event.ctrlKey));
|
|
13135
13166
|
const pickChildInActiveSelectionAtPointer = (selection, event) => {
|
|
13136
|
-
var _a2, _b2,
|
|
13167
|
+
var _a2, _b2, _c2, _d, _e;
|
|
13137
13168
|
try {
|
|
13138
13169
|
const pointer = fabricCanvas.getPointer(event);
|
|
13139
13170
|
const viewportPointer = (_a2 = fabricCanvas.getViewportPoint) == null ? void 0 : _a2.call(fabricCanvas, event);
|
|
@@ -13144,7 +13175,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13144
13175
|
const obj = members[i];
|
|
13145
13176
|
const id = getObjectId(obj);
|
|
13146
13177
|
if (!id || id === "__background__" || obj.visible === false) continue;
|
|
13147
|
-
(
|
|
13178
|
+
(_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
|
|
13148
13179
|
const containsScene = typeof obj.containsPoint === "function" && obj.containsPoint(pointer);
|
|
13149
13180
|
const containsViewport = !!(viewportPointer && typeof obj.containsPoint === "function" && obj.containsPoint(viewportPointer));
|
|
13150
13181
|
if (containsScene || containsViewport) return obj;
|
|
@@ -13178,7 +13209,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13178
13209
|
};
|
|
13179
13210
|
let pendingShiftMultiSelect = null;
|
|
13180
13211
|
const applyShiftMultiSelect = (target, event, baselineActive = fabricCanvas.getActiveObject(), baselineObjects = fabricCanvas.getActiveObjects()) => {
|
|
13181
|
-
var _a2, _b2,
|
|
13212
|
+
var _a2, _b2, _c2;
|
|
13182
13213
|
if (!target || !target.selectable) return false;
|
|
13183
13214
|
const active = baselineActive;
|
|
13184
13215
|
if (!active || ((_a2 = active.getActiveControl) == null ? void 0 : _a2.call(active))) return false;
|
|
@@ -13213,7 +13244,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13213
13244
|
});
|
|
13214
13245
|
}
|
|
13215
13246
|
(_b2 = event == null ? void 0 : event.preventDefault) == null ? void 0 : _b2.call(event);
|
|
13216
|
-
(
|
|
13247
|
+
(_c2 = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _c2.call(event);
|
|
13217
13248
|
return true;
|
|
13218
13249
|
};
|
|
13219
13250
|
const markMixedLogicalSelection = (selection, groupIds, groupMemberIds) => {
|
|
@@ -13250,9 +13281,9 @@ const PageCanvas = react.forwardRef(
|
|
|
13250
13281
|
return !!(((_a2 = o == null ? void 0 : o._ct) == null ? void 0 : _a2.isCropGroup) || (o == null ? void 0 : o.__cropGroup));
|
|
13251
13282
|
};
|
|
13252
13283
|
const promoteToCropGroup = (opt) => {
|
|
13253
|
-
var _a2, _b2,
|
|
13284
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
13254
13285
|
const t = opt.target;
|
|
13255
|
-
if (((_a2 = opt.e) == null ? void 0 : _a2.type) !== "mousedown" && ((_b2 = opt.e) == null ? void 0 : _b2.type) !== "pointerdown" && ((
|
|
13286
|
+
if (((_a2 = opt.e) == null ? void 0 : _a2.type) !== "mousedown" && ((_b2 = opt.e) == null ? void 0 : _b2.type) !== "pointerdown" && ((_c2 = opt.e) == null ? void 0 : _c2.type) !== "touchstart") {
|
|
13256
13287
|
if (t && isCropGroup2(t)) {
|
|
13257
13288
|
fabricCanvas._hoveredTarget = t;
|
|
13258
13289
|
} else if ((t == null ? void 0 : t.group) && isCropGroup2(t.group)) {
|
|
@@ -13422,14 +13453,14 @@ const PageCanvas = react.forwardRef(
|
|
|
13422
13453
|
};
|
|
13423
13454
|
fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
|
|
13424
13455
|
fabricCanvas.on("mouse:down:before", (opt) => {
|
|
13425
|
-
var _a2, _b2,
|
|
13456
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
13426
13457
|
const activeBeforeMouseDown = fabricCanvas.getActiveObject();
|
|
13427
13458
|
if (editLockRef.current) {
|
|
13428
13459
|
const active = fabricCanvas.getActiveObject();
|
|
13429
13460
|
if (active && (((_a2 = active._ct) == null ? void 0 : _a2.isCropGroup) || active.__cropGroup)) {
|
|
13430
13461
|
opt.target = active;
|
|
13431
13462
|
if (opt.e) {
|
|
13432
|
-
(
|
|
13463
|
+
(_c2 = (_b2 = opt.e).preventDefault) == null ? void 0 : _c2.call(_b2);
|
|
13433
13464
|
(_e = (_d = opt.e).stopPropagation) == null ? void 0 : _e.call(_d);
|
|
13434
13465
|
}
|
|
13435
13466
|
}
|
|
@@ -13685,7 +13716,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13685
13716
|
o.__lockScaleDuringCrop = false;
|
|
13686
13717
|
});
|
|
13687
13718
|
fabricCanvas.on("mouse:up", (e) => {
|
|
13688
|
-
var _a2, _b2,
|
|
13719
|
+
var _a2, _b2, _c2;
|
|
13689
13720
|
clearTransforming();
|
|
13690
13721
|
setGuides([]);
|
|
13691
13722
|
setRotationLabel(null);
|
|
@@ -13779,7 +13810,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13779
13810
|
}
|
|
13780
13811
|
}
|
|
13781
13812
|
const activeObj = fabricCanvas.getActiveObject();
|
|
13782
|
-
if (activeObj && (activeObj.__cropGroup || ((
|
|
13813
|
+
if (activeObj && (activeObj.__cropGroup || ((_c2 = activeObj._ct) == null ? void 0 : _c2.isCropGroup))) {
|
|
13783
13814
|
activeObj.__lockScaleDuringCrop = false;
|
|
13784
13815
|
if (activeObj.__cropDrag) {
|
|
13785
13816
|
delete activeObj.__cropDrag;
|
|
@@ -13875,7 +13906,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13875
13906
|
fabricCanvas.on("selection:cleared", () => {
|
|
13876
13907
|
});
|
|
13877
13908
|
fabricCanvas.on("object:scaling", (e) => {
|
|
13878
|
-
var _a2, _b2,
|
|
13909
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h;
|
|
13879
13910
|
if (!isActiveRef.current) return;
|
|
13880
13911
|
const t = e.target;
|
|
13881
13912
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
@@ -14051,7 +14082,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14051
14082
|
time: Math.round(performance.now()),
|
|
14052
14083
|
corner,
|
|
14053
14084
|
groupSelectionId: obj.__pixldocsGroupSelection,
|
|
14054
|
-
currentTransformAction: (
|
|
14085
|
+
currentTransformAction: (_c2 = fabricCanvas._currentTransform) == null ? void 0 : _c2.action,
|
|
14055
14086
|
selection: summarizeFabricObjectForResizeDebug(obj),
|
|
14056
14087
|
textChildren: obj.getObjects().filter((child) => child instanceof fabric__namespace.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
|
|
14057
14088
|
};
|
|
@@ -14569,7 +14600,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14569
14600
|
});
|
|
14570
14601
|
let cropGroupSaveTimer = null;
|
|
14571
14602
|
fabricCanvas.on("object:modified", (e) => {
|
|
14572
|
-
var _a2, _b2,
|
|
14603
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
|
|
14573
14604
|
try {
|
|
14574
14605
|
if (suppressObjectModifiedDuringInternalReselectRef.current) return;
|
|
14575
14606
|
dragStarted = false;
|
|
@@ -14724,12 +14755,12 @@ const PageCanvas = react.forwardRef(
|
|
|
14724
14755
|
clearTimeout(cropGroupSaveTimer);
|
|
14725
14756
|
}
|
|
14726
14757
|
cropGroupSaveTimer = setTimeout(() => {
|
|
14727
|
-
var _a3, _b3,
|
|
14758
|
+
var _a3, _b3, _c3;
|
|
14728
14759
|
const { updateElement: updateElement2 } = useEditorStore.getState();
|
|
14729
14760
|
const img = ct._img;
|
|
14730
14761
|
const zoom3 = ((_a3 = img == null ? void 0 : img._ct) == null ? void 0 : _a3.zoom) ?? 1;
|
|
14731
14762
|
const panX = ((_b3 = img == null ? void 0 : img._ct) == null ? void 0 : _b3.panX) ?? 0.5;
|
|
14732
|
-
const panY = ((
|
|
14763
|
+
const panY = ((_c3 = img == null ? void 0 : img._ct) == null ? void 0 : _c3.panY) ?? 0.5;
|
|
14733
14764
|
const stateCrop = useEditorStore.getState();
|
|
14734
14765
|
const pageCrop = stateCrop.canvas.pages.find((p) => p.id === pageId);
|
|
14735
14766
|
const pageChildrenCrop = (pageCrop == null ? void 0 : pageCrop.children) ?? [];
|
|
@@ -14759,7 +14790,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14759
14790
|
}
|
|
14760
14791
|
if (active && active instanceof fabric__namespace.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
|
|
14761
14792
|
const groupId = getObjectId(active);
|
|
14762
|
-
const pageChildrenSec = ((
|
|
14793
|
+
const pageChildrenSec = ((_c2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c2.children) ?? [];
|
|
14763
14794
|
const modifiedTarget2 = e == null ? void 0 : e.target;
|
|
14764
14795
|
const resizeScaleTarget = lastResizeScaleTargetRef.current;
|
|
14765
14796
|
lastResizeScaleTargetRef.current = null;
|
|
@@ -15894,7 +15925,7 @@ const PageCanvas = react.forwardRef(
|
|
|
15894
15925
|
visibilityUpdateInProgressRef.current = false;
|
|
15895
15926
|
}
|
|
15896
15927
|
doSyncRef.current = () => {
|
|
15897
|
-
var _a2, _b2,
|
|
15928
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
15898
15929
|
const shouldSkipUpdates2 = syncLockedRef.current || editLockRef.current;
|
|
15899
15930
|
const state = useEditorStore.getState();
|
|
15900
15931
|
const elementsToSync = elements;
|
|
@@ -15938,7 +15969,7 @@ const PageCanvas = react.forwardRef(
|
|
|
15938
15969
|
const activeObjId = activeObj ? getObjectId(activeObj) : null;
|
|
15939
15970
|
const isTextBeingEdited = activeObjId && editingTextIdRef.current === activeObjId;
|
|
15940
15971
|
const isMultiSelect = activeObj instanceof fabric__namespace.ActiveSelection;
|
|
15941
|
-
if (activeObj && isMultiSelect && !(((
|
|
15972
|
+
if (activeObj && isMultiSelect && !(((_c2 = activeObj._ct) == null ? void 0 : _c2.isCropGroup) || activeObj.__cropGroup) && !isTextBeingEdited) {
|
|
15942
15973
|
fc.discardActiveObject();
|
|
15943
15974
|
}
|
|
15944
15975
|
}
|
|
@@ -17096,7 +17127,7 @@ const PageCanvas = react.forwardRef(
|
|
|
17096
17127
|
return unsub;
|
|
17097
17128
|
}, []);
|
|
17098
17129
|
const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
|
|
17099
|
-
var _a2, _b2,
|
|
17130
|
+
var _a2, _b2, _c2;
|
|
17100
17131
|
const fc = fabricRef.current;
|
|
17101
17132
|
if (fc && isTransforming(fc)) {
|
|
17102
17133
|
return;
|
|
@@ -17617,7 +17648,7 @@ const PageCanvas = react.forwardRef(
|
|
|
17617
17648
|
} catch {
|
|
17618
17649
|
}
|
|
17619
17650
|
obj.dirty = true;
|
|
17620
|
-
(
|
|
17651
|
+
(_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
|
|
17621
17652
|
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
17622
17653
|
c: element.textBgColor ?? null,
|
|
17623
17654
|
g: element.textBgGradient ?? null,
|
|
@@ -17925,7 +17956,7 @@ const PageCanvas = react.forwardRef(
|
|
|
17925
17956
|
return Math.max(min, Math.min(max, v));
|
|
17926
17957
|
};
|
|
17927
17958
|
const applyEdgeFadeFrameClipPath = (group, element, frameW, frameH, shape, rxRatio) => {
|
|
17928
|
-
var _a2, _b2,
|
|
17959
|
+
var _a2, _b2, _c2;
|
|
17929
17960
|
const fadeElement = element;
|
|
17930
17961
|
const fadeGroup = group;
|
|
17931
17962
|
const inputKey = edgeFadeKey(fadeElement);
|
|
@@ -18060,10 +18091,10 @@ const PageCanvas = react.forwardRef(
|
|
|
18060
18091
|
children.forEach((child) => {
|
|
18061
18092
|
child.dirty = true;
|
|
18062
18093
|
});
|
|
18063
|
-
(
|
|
18094
|
+
(_c2 = group.canvas) == null ? void 0 : _c2.requestRenderAll();
|
|
18064
18095
|
};
|
|
18065
18096
|
const loadImageAsync2 = async (element, placeholder, fc) => {
|
|
18066
|
-
var _a2, _b2,
|
|
18097
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
18067
18098
|
const imageUrl = element.src || element.imageUrl;
|
|
18068
18099
|
if (!imageUrl) return;
|
|
18069
18100
|
const elementId = element.id;
|
|
@@ -18098,7 +18129,7 @@ const PageCanvas = react.forwardRef(
|
|
|
18098
18129
|
const willUseCropGroupForFade = imageFitForFade !== "fill" || clipShapeForFade && clipShapeForFade !== "none";
|
|
18099
18130
|
try {
|
|
18100
18131
|
if (hasEdgeFade(element) && !willUseCropGroupForFade) {
|
|
18101
|
-
const srcEl = (
|
|
18132
|
+
const srcEl = (_c2 = img.getElement) == null ? void 0 : _c2.call(img);
|
|
18102
18133
|
if (srcEl) {
|
|
18103
18134
|
const baked = bakeEdgeFade(srcEl, element);
|
|
18104
18135
|
img.setElement(baked);
|
|
@@ -18865,14 +18896,14 @@ function PreviewCanvas({
|
|
|
18865
18896
|
onDynamicFieldClick,
|
|
18866
18897
|
onReady
|
|
18867
18898
|
}) {
|
|
18868
|
-
var _a2, _b2,
|
|
18899
|
+
var _a2, _b2, _c2, _d, _e;
|
|
18869
18900
|
const canvasRef = react.useRef(null);
|
|
18870
18901
|
const containerRef = react.useRef(null);
|
|
18871
18902
|
const [containerWidth, setContainerWidth] = react.useState(0);
|
|
18872
18903
|
const [hoveredFieldId, setHoveredFieldId] = react.useState(null);
|
|
18873
18904
|
const page = (_a2 = config == null ? void 0 : config.pages) == null ? void 0 : _a2[pageIndex];
|
|
18874
18905
|
const canvasWidth = ((_b2 = config == null ? void 0 : config.canvas) == null ? void 0 : _b2.width) || 612;
|
|
18875
|
-
const canvasHeight = ((
|
|
18906
|
+
const canvasHeight = ((_c2 = config == null ? void 0 : config.canvas) == null ? void 0 : _c2.height) || 792;
|
|
18876
18907
|
const elementToFieldMap = react.useMemo(
|
|
18877
18908
|
() => buildElementToFieldMap(config == null ? void 0 : config.dynamicFields),
|
|
18878
18909
|
[config == null ? void 0 : config.dynamicFields]
|
|
@@ -18928,7 +18959,7 @@ function PreviewCanvas({
|
|
|
18928
18959
|
};
|
|
18929
18960
|
}, [(_d = page == null ? void 0 : page.settings) == null ? void 0 : _d.backgroundColor, (_e = page == null ? void 0 : page.settings) == null ? void 0 : _e.backgroundGradient]);
|
|
18930
18961
|
const projectSettings = react.useMemo(() => {
|
|
18931
|
-
var _a3, _b3,
|
|
18962
|
+
var _a3, _b3, _c3;
|
|
18932
18963
|
const vars = ((_a3 = config.themeConfig) == null ? void 0 : _a3.variables) || {};
|
|
18933
18964
|
return {
|
|
18934
18965
|
showGrid: false,
|
|
@@ -18937,7 +18968,7 @@ function PreviewCanvas({
|
|
|
18937
18968
|
snapToGuides: false,
|
|
18938
18969
|
snapThreshold: 5,
|
|
18939
18970
|
primaryColor: (_b3 = vars.primary) == null ? void 0 : _b3.value,
|
|
18940
|
-
secondaryColor: (
|
|
18971
|
+
secondaryColor: (_c3 = vars.secondary) == null ? void 0 : _c3.value
|
|
18941
18972
|
};
|
|
18942
18973
|
}, [config.themeConfig]);
|
|
18943
18974
|
const handleDynamicFieldClick = react.useCallback((elementId) => {
|
|
@@ -19088,7 +19119,7 @@ const PreviewCanvas$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
|
|
|
19088
19119
|
PreviewCanvas
|
|
19089
19120
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
19090
19121
|
function applyThemeToConfig(config, themeOverrides) {
|
|
19091
|
-
var _a2, _b2,
|
|
19122
|
+
var _a2, _b2, _c2;
|
|
19092
19123
|
if (!themeOverrides || Object.keys(themeOverrides).length === 0) return config;
|
|
19093
19124
|
const cloned = JSON.parse(JSON.stringify(config));
|
|
19094
19125
|
if ((_a2 = cloned.themeConfig) == null ? void 0 : _a2.variables) {
|
|
@@ -19120,7 +19151,7 @@ function applyThemeToConfig(config, themeOverrides) {
|
|
|
19120
19151
|
}
|
|
19121
19152
|
}
|
|
19122
19153
|
for (const page of cloned.pages || []) {
|
|
19123
|
-
const bgBinding = (
|
|
19154
|
+
const bgBinding = (_c2 = page.themeBindings) == null ? void 0 : _c2.backgroundColor;
|
|
19124
19155
|
if (bgBinding && varMap.has(bgBinding) && page.settings) {
|
|
19125
19156
|
page.settings.backgroundColor = varMap.get(bgBinding);
|
|
19126
19157
|
}
|
|
@@ -20039,7 +20070,7 @@ function getNestedRepeatableEntryCount(parentId, parentIndex, childId, formValue
|
|
|
20039
20070
|
return Math.max(1, maxIndex);
|
|
20040
20071
|
}
|
|
20041
20072
|
function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsFromSchema, repeatableEntryCounts, repeatableNestedEntryCounts, displayFormatMap, repeatablePagesFromSchema) {
|
|
20042
|
-
var _a2, _b2,
|
|
20073
|
+
var _a2, _b2, _c2;
|
|
20043
20074
|
const cloned = JSON.parse(JSON.stringify(config));
|
|
20044
20075
|
if (!cloned.pages) return cloned;
|
|
20045
20076
|
const dynamicFields = cloned.dynamicFields;
|
|
@@ -20603,7 +20634,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
|
|
|
20603
20634
|
}
|
|
20604
20635
|
}
|
|
20605
20636
|
for (const page of pages) {
|
|
20606
|
-
if ((
|
|
20637
|
+
if ((_c2 = page.children) == null ? void 0 : _c2.length) {
|
|
20607
20638
|
page.children = applyStackReflowToPageTree(page.children, { preserveExplicitTextHeights: true });
|
|
20608
20639
|
}
|
|
20609
20640
|
}
|
|
@@ -20816,7 +20847,7 @@ function splitNestedForOverflow(flowStack, stayChildren, overflowChildren, overf
|
|
|
20816
20847
|
return { stayChildren: newStay, overflowChildren: newOverflow };
|
|
20817
20848
|
}
|
|
20818
20849
|
function paginateSinglePage(sourcePage, pageOffsetIndex) {
|
|
20819
|
-
var _a2, _b2,
|
|
20850
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
20820
20851
|
const contentTop = (_a2 = sourcePage.settings) == null ? void 0 : _a2.contentTop;
|
|
20821
20852
|
const contentBottom = (_b2 = sourcePage.settings) == null ? void 0 : _b2.contentBottom;
|
|
20822
20853
|
if (contentTop == null || contentBottom == null || contentBottom <= contentTop) {
|
|
@@ -20893,7 +20924,7 @@ function paginateSinglePage(sourcePage, pageOffsetIndex) {
|
|
|
20893
20924
|
children: applyStackReflowToPageTree(updatedContChildren)
|
|
20894
20925
|
};
|
|
20895
20926
|
if (nextOverflowChildren.length > 0) {
|
|
20896
|
-
const originalFlowStack = ((
|
|
20927
|
+
const originalFlowStack = ((_c2 = currentOverflows[si]) == null ? void 0 : _c2.flowStack) ?? contFlowStack;
|
|
20897
20928
|
nextOverflows.push({ flowStack: originalFlowStack, overflowChildren: nextOverflowChildren });
|
|
20898
20929
|
}
|
|
20899
20930
|
}
|
|
@@ -23087,7 +23118,7 @@ async function resolveTemplateData(options) {
|
|
|
23087
23118
|
};
|
|
23088
23119
|
}
|
|
23089
23120
|
async function resolveFromForm(options) {
|
|
23090
|
-
var _a2, _b2,
|
|
23121
|
+
var _a2, _b2, _c2;
|
|
23091
23122
|
const { templateId, formSchemaId, sectionState, flatFormData: directFlatFormData, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
|
|
23092
23123
|
const hasSectionStateInput = !!sectionState && Object.keys(sectionState).length > 0;
|
|
23093
23124
|
if (!formSchemaId && !hasSectionStateInput) {
|
|
@@ -23289,7 +23320,7 @@ async function resolveFromForm(options) {
|
|
|
23289
23320
|
displayFormatMap.size > 0 ? displayFormatMap : void 0,
|
|
23290
23321
|
buildRepeatablePagesInputForApply(formSchema, mergedSectionState)
|
|
23291
23322
|
);
|
|
23292
|
-
if ((
|
|
23323
|
+
if ((_c2 = resolvedConfig.themeConfig) == null ? void 0 : _c2.variables) {
|
|
23293
23324
|
const baseOverrides = {};
|
|
23294
23325
|
for (const [key, def] of Object.entries(resolvedConfig.themeConfig.variables)) {
|
|
23295
23326
|
baseOverrides[key] = def.value;
|
|
@@ -23324,12 +23355,12 @@ function themeBaseId(id) {
|
|
|
23324
23355
|
return out;
|
|
23325
23356
|
}
|
|
23326
23357
|
function applyThemeVariantToConfig(config, themeConfig, themeId) {
|
|
23327
|
-
var _a2, _b2,
|
|
23358
|
+
var _a2, _b2, _c2, _d;
|
|
23328
23359
|
if (!themeConfig) return config;
|
|
23329
23360
|
const variant = themeId && themeId !== "default" ? (_a2 = themeConfig.variants) == null ? void 0 : _a2.find((v) => v.id === themeId) : null;
|
|
23330
23361
|
const shouldApplyDefaults = !variant && ((_b2 = themeConfig.properties) == null ? void 0 : _b2.length);
|
|
23331
23362
|
if (!variant && !shouldApplyDefaults) return config;
|
|
23332
|
-
if (!((
|
|
23363
|
+
if (!((_c2 = themeConfig.properties) == null ? void 0 : _c2.length)) return config;
|
|
23333
23364
|
const result = JSON.parse(JSON.stringify(config));
|
|
23334
23365
|
const cloneIdMap = config.__cloneIdMap || {};
|
|
23335
23366
|
const pageElements = result.pages.map((page) => flattenAll(page.children || []));
|
|
@@ -24240,7 +24271,7 @@ function ensureFabricGradientDef(doc, obj, width, height) {
|
|
|
24240
24271
|
return `url(#${id})`;
|
|
24241
24272
|
}
|
|
24242
24273
|
function warpTextboxSvgAlongPath(svg, obj) {
|
|
24243
|
-
var _a2, _b2,
|
|
24274
|
+
var _a2, _b2, _c2, _d, _e;
|
|
24244
24275
|
const tp = obj == null ? void 0 : obj.textPath;
|
|
24245
24276
|
if (!tp || !tp.preset || tp.preset === "none") return svg;
|
|
24246
24277
|
if (tp.preset === "rise" || tp.preset === "angle") {
|
|
@@ -24344,7 +24375,7 @@ function warpTextboxSvgAlongPath(svg, obj) {
|
|
|
24344
24375
|
for (const el of Array.from(doc.querySelectorAll("*"))) stripFilter(el);
|
|
24345
24376
|
for (const filter of Array.from(doc.querySelectorAll("filter"))) {
|
|
24346
24377
|
try {
|
|
24347
|
-
(
|
|
24378
|
+
(_c2 = filter.parentNode) == null ? void 0 : _c2.removeChild(filter);
|
|
24348
24379
|
} catch {
|
|
24349
24380
|
}
|
|
24350
24381
|
}
|
|
@@ -24679,9 +24710,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24679
24710
|
}
|
|
24680
24711
|
return svgString;
|
|
24681
24712
|
}
|
|
24682
|
-
const resolvedPackageVersion = "0.5.
|
|
24713
|
+
const resolvedPackageVersion = "0.5.374";
|
|
24683
24714
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24684
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24715
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.374";
|
|
24685
24716
|
const roundParityValue = (value) => {
|
|
24686
24717
|
if (typeof value !== "number") return value;
|
|
24687
24718
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24858,12 +24889,12 @@ function installUnderlineFix(fab) {
|
|
|
24858
24889
|
if (!TextProto || typeof TextProto._renderTextDecoration !== "function") return;
|
|
24859
24890
|
const original = TextProto._renderTextDecoration;
|
|
24860
24891
|
const measureLineTextWidth = (obj, ctx, lineIndex) => {
|
|
24861
|
-
var _a3, _b2,
|
|
24892
|
+
var _a3, _b2, _c2, _d, _e, _f;
|
|
24862
24893
|
const rawLine = (_a3 = obj._textLines) == null ? void 0 : _a3[lineIndex];
|
|
24863
24894
|
const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
|
|
24864
24895
|
if (!lineText) return 0;
|
|
24865
24896
|
const fontSize = Number(((_b2 = obj.getValueOfPropertyAt) == null ? void 0 : _b2.call(obj, lineIndex, 0, "fontSize")) ?? obj.fontSize ?? 0);
|
|
24866
|
-
const fontStyle = String(((
|
|
24897
|
+
const fontStyle = String(((_c2 = obj.getValueOfPropertyAt) == null ? void 0 : _c2.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
|
|
24867
24898
|
const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
|
|
24868
24899
|
const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
|
|
24869
24900
|
const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
|
|
@@ -25495,7 +25526,7 @@ class PixldocsRenderer {
|
|
|
25495
25526
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25496
25527
|
}
|
|
25497
25528
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25498
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
25529
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Cfe50WTF.cjs"));
|
|
25499
25530
|
const prepared = preparePagesForExport(
|
|
25500
25531
|
cloned.pages,
|
|
25501
25532
|
canvasWidth,
|
|
@@ -26179,7 +26210,7 @@ class PixldocsRenderer {
|
|
|
26179
26210
|
logJsonLine("[canvas-renderer][fabric-text-parity]", { stage, textboxes: sample.length, sample });
|
|
26180
26211
|
}
|
|
26181
26212
|
async waitForStableTextMetrics(container, config, options = {}) {
|
|
26182
|
-
var _a2, _b2,
|
|
26213
|
+
var _a2, _b2, _c2;
|
|
26183
26214
|
if (typeof document !== "undefined") {
|
|
26184
26215
|
void ensureFontsForResolvedConfig(config);
|
|
26185
26216
|
await this.waitForRelevantFonts(config);
|
|
@@ -26223,7 +26254,7 @@ class PixldocsRenderer {
|
|
|
26223
26254
|
(_a2 = fabricInstance.calcOffset) == null ? void 0 : _a2.call(fabricInstance);
|
|
26224
26255
|
(_b2 = fabricInstance.renderAll) == null ? void 0 : _b2.call(fabricInstance);
|
|
26225
26256
|
await waitForPaint();
|
|
26226
|
-
(
|
|
26257
|
+
(_c2 = fabricInstance.renderAll) == null ? void 0 : _c2.call(fabricInstance);
|
|
26227
26258
|
await waitForPaint();
|
|
26228
26259
|
this.logFabricTextParitySnapshot("after-stable-text-metrics", fabricInstance);
|
|
26229
26260
|
}
|
|
@@ -26737,7 +26768,7 @@ function normalizeSvgExplicitColors(svg) {
|
|
|
26737
26768
|
function bakeGroupOpacityIntoChildren(svg) {
|
|
26738
26769
|
const DRAWABLE = /* @__PURE__ */ new Set(["path", "rect", "circle", "ellipse", "polygon", "polyline", "line", "text", "tspan"]);
|
|
26739
26770
|
function walkAndBake(el, inheritedOpacity) {
|
|
26740
|
-
var _a2, _b2,
|
|
26771
|
+
var _a2, _b2, _c2, _d;
|
|
26741
26772
|
if (isInSvgDefinitionSubtree(el)) {
|
|
26742
26773
|
for (let i = 0; i < el.children.length; i++) walkAndBake(el.children[i], 1);
|
|
26743
26774
|
return;
|
|
@@ -26749,7 +26780,7 @@ function bakeGroupOpacityIntoChildren(svg) {
|
|
|
26749
26780
|
const combinedOpacity = inheritedOpacity * ownOpacity;
|
|
26750
26781
|
if (ownOpacity < 0.999 && tag !== "image") {
|
|
26751
26782
|
el.removeAttribute("opacity");
|
|
26752
|
-
if ((
|
|
26783
|
+
if ((_c2 = el.style) == null ? void 0 : _c2.opacity) el.style.removeProperty("opacity");
|
|
26753
26784
|
}
|
|
26754
26785
|
if (DRAWABLE.has(tag) && combinedOpacity < 0.999) {
|
|
26755
26786
|
multiplySvgOpacityAttr(el, "fill-opacity", combinedOpacity);
|
|
@@ -27546,7 +27577,7 @@ async function convertSvgTextDecorationsToLinesString(svgStr) {
|
|
|
27546
27577
|
}
|
|
27547
27578
|
}
|
|
27548
27579
|
async function rasterizeShadowMarkers(svg) {
|
|
27549
|
-
var _a2, _b2,
|
|
27580
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
27550
27581
|
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
27551
27582
|
const markers = Array.from(svg.querySelectorAll("g.__pdShadowRaster"));
|
|
27552
27583
|
if (markers.length === 0) return;
|
|
@@ -27578,7 +27609,7 @@ async function rasterizeShadowMarkers(svg) {
|
|
|
27578
27609
|
);
|
|
27579
27610
|
try {
|
|
27580
27611
|
const fontSpecs = collectFontSpecsFromMarkup(innerXml);
|
|
27581
|
-
if (fontSpecs.length > 0 && ((
|
|
27612
|
+
if (fontSpecs.length > 0 && ((_c2 = document.fonts) == null ? void 0 : _c2.load)) {
|
|
27582
27613
|
await Promise.all(
|
|
27583
27614
|
fontSpecs.map(
|
|
27584
27615
|
(spec) => document.fonts.load(spec).catch(() => void 0)
|
|
@@ -27815,7 +27846,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27815
27846
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27816
27847
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27817
27848
|
try {
|
|
27818
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27849
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-Cfe50WTF.cjs"));
|
|
27819
27850
|
try {
|
|
27820
27851
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27821
27852
|
} catch {
|
|
@@ -28212,4 +28243,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
28212
28243
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
28213
28244
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
28214
28245
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
28215
|
-
//# sourceMappingURL=index-
|
|
28246
|
+
//# sourceMappingURL=index-DpwFuxG9.cjs.map
|