@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
var _a, _b;
|
|
4
|
+
var _a, _b, _c;
|
|
5
5
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
6
6
|
import { forwardRef, useRef, useState, useCallback, useMemo, useEffect, useImperativeHandle, createElement } from "react";
|
|
7
7
|
import { flushSync } from "react-dom";
|
|
@@ -293,14 +293,14 @@ function lineToString(line) {
|
|
|
293
293
|
return Array.isArray(line) ? line.join("") : String(line ?? "");
|
|
294
294
|
}
|
|
295
295
|
function measureTextLineWithCanvas(textbox, lineText, lineIndex) {
|
|
296
|
-
var _a2, _b2,
|
|
296
|
+
var _a2, _b2, _c2, _d, _e;
|
|
297
297
|
if (!lineText) return 0;
|
|
298
298
|
const ctx = getMeasureContext();
|
|
299
299
|
if (!ctx) return null;
|
|
300
300
|
const tb = textbox;
|
|
301
301
|
const fontSize = Number(((_a2 = tb.getValueOfPropertyAt) == null ? void 0 : _a2.call(tb, lineIndex, 0, "fontSize")) ?? textbox.fontSize ?? 16);
|
|
302
302
|
const fontStyle = String(((_b2 = tb.getValueOfPropertyAt) == null ? void 0 : _b2.call(tb, lineIndex, 0, "fontStyle")) ?? textbox.fontStyle ?? "normal");
|
|
303
|
-
const fontWeight = String(((
|
|
303
|
+
const fontWeight = String(((_c2 = tb.getValueOfPropertyAt) == null ? void 0 : _c2.call(tb, lineIndex, 0, "fontWeight")) ?? textbox.fontWeight ?? "400");
|
|
304
304
|
const fontFamily = String(((_d = tb.getValueOfPropertyAt) == null ? void 0 : _d.call(tb, lineIndex, 0, "fontFamily")) ?? textbox.fontFamily ?? "Open Sans");
|
|
305
305
|
const charSpacing = Number(((_e = tb.getValueOfPropertyAt) == null ? void 0 : _e.call(tb, lineIndex, 0, "charSpacing")) ?? textbox.charSpacing ?? 0);
|
|
306
306
|
ctx.save();
|
|
@@ -3620,14 +3620,14 @@ const clearFontCacheAndRerender = (canvas, options = {}) => {
|
|
|
3620
3620
|
canvas.requestRenderAll();
|
|
3621
3621
|
};
|
|
3622
3622
|
const ensureFontLoaded = async (fontFamily) => {
|
|
3623
|
-
var _a2, _b2,
|
|
3623
|
+
var _a2, _b2, _c2;
|
|
3624
3624
|
if (!fontFamily) return;
|
|
3625
3625
|
if (LOCAL_FONTS.has(fontFamily)) {
|
|
3626
3626
|
try {
|
|
3627
3627
|
const isLoaded = (_a2 = document.fonts) == null ? void 0 : _a2.check(`16px "${fontFamily}"`);
|
|
3628
3628
|
if (isLoaded) return;
|
|
3629
3629
|
await ((_b2 = document.fonts) == null ? void 0 : _b2.load(`16px "${fontFamily}"`));
|
|
3630
|
-
await ((
|
|
3630
|
+
await ((_c2 = document.fonts) == null ? void 0 : _c2.load(`bold 16px "${fontFamily}"`));
|
|
3631
3631
|
} catch (e) {
|
|
3632
3632
|
console.warn(`Failed to ensure local font loaded: ${fontFamily}`, e);
|
|
3633
3633
|
}
|
|
@@ -4121,7 +4121,7 @@ function createImageClipPath(element, imgWidth, imgHeight) {
|
|
|
4121
4121
|
}
|
|
4122
4122
|
}
|
|
4123
4123
|
async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef, isTransforming) {
|
|
4124
|
-
var _a2, _b2,
|
|
4124
|
+
var _a2, _b2, _c2, _d;
|
|
4125
4125
|
const imageUrl = element.src || element.imageUrl;
|
|
4126
4126
|
if (!imageUrl) return;
|
|
4127
4127
|
const nextSvgColorMap = element.svgColorMap ? JSON.stringify(element.svgColorMap) : "";
|
|
@@ -4286,7 +4286,7 @@ async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef
|
|
|
4286
4286
|
const existingImg = (_a2 = existingCropGroup.__cropData) == null ? void 0 : _a2._img;
|
|
4287
4287
|
if (existingImg) {
|
|
4288
4288
|
panX = ((_b2 = existingImg._ct) == null ? void 0 : _b2.panX) ?? existingImg.__panX ?? 0.5;
|
|
4289
|
-
panY = ((
|
|
4289
|
+
panY = ((_c2 = existingImg._ct) == null ? void 0 : _c2.panY) ?? existingImg.__panY ?? 0.5;
|
|
4290
4290
|
zoom = ((_d = existingImg._ct) == null ? void 0 : _d.zoom) ?? 1;
|
|
4291
4291
|
}
|
|
4292
4292
|
}
|
|
@@ -4521,7 +4521,7 @@ async function detectMaskType(svgUrl) {
|
|
|
4521
4521
|
}
|
|
4522
4522
|
}
|
|
4523
4523
|
async function applySvgMaskToCropGroup(cropGroup, svgUrl) {
|
|
4524
|
-
var _a2, _b2,
|
|
4524
|
+
var _a2, _b2, _c2;
|
|
4525
4525
|
if (!isCropGroup(cropGroup)) {
|
|
4526
4526
|
throw new Error("Selected object is not a crop group / image");
|
|
4527
4527
|
}
|
|
@@ -4551,7 +4551,7 @@ async function applySvgMaskToCropGroup(cropGroup, svgUrl) {
|
|
|
4551
4551
|
child.dirty = true;
|
|
4552
4552
|
}
|
|
4553
4553
|
}
|
|
4554
|
-
(
|
|
4554
|
+
(_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
|
|
4555
4555
|
}
|
|
4556
4556
|
function loadSvgAsImage(svgUrl) {
|
|
4557
4557
|
return new Promise((resolve, reject) => {
|
|
@@ -4612,7 +4612,7 @@ async function buildLuminanceAlphaCanvas(svgUrl, frameW, frameH) {
|
|
|
4612
4612
|
return canvas;
|
|
4613
4613
|
}
|
|
4614
4614
|
async function applyLuminanceMaskToCropGroup(cropGroup, svgUrl) {
|
|
4615
|
-
var _a2, _b2,
|
|
4615
|
+
var _a2, _b2, _c2;
|
|
4616
4616
|
if (!isCropGroup(cropGroup)) {
|
|
4617
4617
|
throw new Error("Selected object is not a crop group / image");
|
|
4618
4618
|
}
|
|
@@ -4647,7 +4647,7 @@ async function applyLuminanceMaskToCropGroup(cropGroup, svgUrl) {
|
|
|
4647
4647
|
child.dirty = true;
|
|
4648
4648
|
}
|
|
4649
4649
|
}
|
|
4650
|
-
(
|
|
4650
|
+
(_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
|
|
4651
4651
|
}
|
|
4652
4652
|
async function applyMaskToCropGroup(cropGroup, svgUrl, maskType) {
|
|
4653
4653
|
if (maskType === "luminance") {
|
|
@@ -4666,7 +4666,7 @@ function getAppliedSvgMaskType(obj) {
|
|
|
4666
4666
|
return t === "luminance" || t === "shape" ? t : null;
|
|
4667
4667
|
}
|
|
4668
4668
|
function clearSvgMaskFromCropGroup(cropGroup) {
|
|
4669
|
-
var _a2, _b2,
|
|
4669
|
+
var _a2, _b2, _c2;
|
|
4670
4670
|
if (!isCropGroup(cropGroup)) return;
|
|
4671
4671
|
const frameW = ((_a2 = cropGroup._ct) == null ? void 0 : _a2.frameW) ?? cropGroup.width ?? 0;
|
|
4672
4672
|
const frameH = ((_b2 = cropGroup._ct) == null ? void 0 : _b2.frameH) ?? cropGroup.height ?? 0;
|
|
@@ -4688,7 +4688,7 @@ function clearSvgMaskFromCropGroup(cropGroup) {
|
|
|
4688
4688
|
delete cropGroup.__svgMaskUrl;
|
|
4689
4689
|
delete cropGroup.__svgMaskType;
|
|
4690
4690
|
cropGroup.dirty = true;
|
|
4691
|
-
(
|
|
4691
|
+
(_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
|
|
4692
4692
|
}
|
|
4693
4693
|
const svgMaskApply = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4694
4694
|
__proto__: null,
|
|
@@ -6180,7 +6180,7 @@ function calculateScaleSnapGuides(scalingObj, corner, canvas, canvasWidth, canva
|
|
|
6180
6180
|
const MIN_SNAP_BOX = 20;
|
|
6181
6181
|
const SNAP_HYSTERESIS_PX = 6;
|
|
6182
6182
|
function applyScaleSnapToBox(box, corner, canvas, canvasWidth, canvasHeight, snapToGuides, snapThreshold, excludeObjectId, options) {
|
|
6183
|
-
var _a2, _b2,
|
|
6183
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h;
|
|
6184
6184
|
const hysteresis = (options == null ? void 0 : options.hysteresis) ?? SNAP_HYSTERESIS_PX;
|
|
6185
6185
|
const activeSnapRef = options == null ? void 0 : options.activeSnapRef;
|
|
6186
6186
|
const roundSnappedOnly = (options == null ? void 0 : options.roundSnappedOnly) ?? false;
|
|
@@ -6276,7 +6276,7 @@ function applyScaleSnapToBox(box, corner, canvas, canvasWidth, canvasHeight, sna
|
|
|
6276
6276
|
let snappedTop = false;
|
|
6277
6277
|
let snappedBottom = false;
|
|
6278
6278
|
if (resizingLeft) {
|
|
6279
|
-
const stick = (
|
|
6279
|
+
const stick = (_c2 = activeSnapRef == null ? void 0 : activeSnapRef.current) == null ? void 0 : _c2.left;
|
|
6280
6280
|
if (stick !== void 0) {
|
|
6281
6281
|
const dist = Math.abs(box.left - stick);
|
|
6282
6282
|
if (dist <= releaseDist) {
|
|
@@ -6930,7 +6930,7 @@ function scaleLocalToScreen(target, p) {
|
|
|
6930
6930
|
return new fabric.Point(p.x * sx * zx, p.y * sy * zy);
|
|
6931
6931
|
}
|
|
6932
6932
|
function applyTextPathControls(textbox) {
|
|
6933
|
-
var _a2, _b2,
|
|
6933
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
6934
6934
|
const obj = textbox;
|
|
6935
6935
|
if (!hasActiveTextPath(obj)) {
|
|
6936
6936
|
obj.__pdTextPathHovered = false;
|
|
@@ -6953,7 +6953,7 @@ function applyTextPathControls(textbox) {
|
|
|
6953
6953
|
delete obj.controls.bzMidT1;
|
|
6954
6954
|
delete obj.controls.tpRot;
|
|
6955
6955
|
delete obj.controls.tpPivot;
|
|
6956
|
-
(
|
|
6956
|
+
(_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 });
|
|
6957
6957
|
obj.hasBorders = true;
|
|
6958
6958
|
obj.__pdTextPathControls = false;
|
|
6959
6959
|
obj.setCoords();
|
|
@@ -7653,10 +7653,10 @@ function textPathBoundsContainScenePoint(obj, point) {
|
|
|
7653
7653
|
}
|
|
7654
7654
|
}
|
|
7655
7655
|
function drawTextPathBounds(ctx, obj, bounds, hostCanvas) {
|
|
7656
|
-
var _a2, _b2,
|
|
7656
|
+
var _a2, _b2, _c2;
|
|
7657
7657
|
const host = hostCanvas || obj.canvas || ((_a2 = obj.group) == null ? void 0 : _a2.canvas);
|
|
7658
7658
|
if (!host) return;
|
|
7659
|
-
const retina = ((_b2 = host.getRetinaScaling) == null ? void 0 : _b2.call(host)) || ((
|
|
7659
|
+
const retina = ((_b2 = host.getRetinaScaling) == null ? void 0 : _b2.call(host)) || ((_c2 = obj.getCanvasRetinaScaling) == null ? void 0 : _c2.call(obj)) || 1;
|
|
7660
7660
|
const matrix = fabric.util.multiplyTransformMatrices(host.viewportTransform || [1, 0, 0, 1, 0, 0], obj.calcTransformMatrix());
|
|
7661
7661
|
const corners = [
|
|
7662
7662
|
new fabric.Point(bounds.minX, bounds.minY),
|
|
@@ -7678,8 +7678,8 @@ function drawTextPathBounds(ctx, obj, bounds, hostCanvas) {
|
|
|
7678
7678
|
}
|
|
7679
7679
|
if (typeof TextboxProto._renderControls === "function" && !TextboxProto.__pixldocsOrigRenderControls) {
|
|
7680
7680
|
let drawWarpGuides = function(ctx) {
|
|
7681
|
-
var _a2, _b2,
|
|
7682
|
-
const hostCanvas = this.canvas || ((_a2 = this.group) == null ? void 0 : _a2.canvas) || ((
|
|
7681
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
|
|
7682
|
+
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);
|
|
7683
7683
|
if (!hostCanvas) return;
|
|
7684
7684
|
const hoverBounds = getTextPathHitBounds(this);
|
|
7685
7685
|
const active = (_d = hostCanvas.getActiveObject) == null ? void 0 : _d.call(hostCanvas);
|
|
@@ -8102,14 +8102,14 @@ function buildRoundedRectPath2D(ctx, x, y, w, h, rTL, rTR, rBR, rBL) {
|
|
|
8102
8102
|
ctx.closePath();
|
|
8103
8103
|
}
|
|
8104
8104
|
function measureLineGlyphWidth(obj, lineIndex) {
|
|
8105
|
-
var _a2, _b2,
|
|
8105
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
8106
8106
|
try {
|
|
8107
8107
|
const rawLine = (_a2 = obj == null ? void 0 : obj._textLines) == null ? void 0 : _a2[lineIndex];
|
|
8108
8108
|
const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
|
|
8109
8109
|
if (!lineText) return 0;
|
|
8110
8110
|
const fontSize = Number(((_b2 = obj.getValueOfPropertyAt) == null ? void 0 : _b2.call(obj, lineIndex, 0, "fontSize")) ?? obj.fontSize ?? 0);
|
|
8111
8111
|
if (!fontSize) return 0;
|
|
8112
|
-
const fontStyle = String(((
|
|
8112
|
+
const fontStyle = String(((_c2 = obj.getValueOfPropertyAt) == null ? void 0 : _c2.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
|
|
8113
8113
|
const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
|
|
8114
8114
|
const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
|
|
8115
8115
|
const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
|
|
@@ -9500,7 +9500,7 @@ function createShape(element) {
|
|
|
9500
9500
|
}
|
|
9501
9501
|
}
|
|
9502
9502
|
function createText(element) {
|
|
9503
|
-
var _a2, _b2,
|
|
9503
|
+
var _a2, _b2, _c2, _d, _e;
|
|
9504
9504
|
const overflowPolicy = element.overflowPolicy || "grow-and-push";
|
|
9505
9505
|
let text = element.text ?? "";
|
|
9506
9506
|
let fontSize = element.fontSize || 16;
|
|
@@ -9716,7 +9716,7 @@ function createText(element) {
|
|
|
9716
9716
|
} catch {
|
|
9717
9717
|
}
|
|
9718
9718
|
try {
|
|
9719
|
-
const baseCtrls = (_d = (
|
|
9719
|
+
const baseCtrls = (_d = (_c2 = fabric.Object) == null ? void 0 : _c2.prototype) == null ? void 0 : _d.controls;
|
|
9720
9720
|
if (baseCtrls) {
|
|
9721
9721
|
textbox.controls = {
|
|
9722
9722
|
...textbox.controls || {},
|
|
@@ -10574,13 +10574,13 @@ try {
|
|
|
10574
10574
|
};
|
|
10575
10575
|
const COLLAPSE_THRESHOLD_PX = 32;
|
|
10576
10576
|
const shouldCollapseHandles = (fabricObject) => {
|
|
10577
|
-
var _a2, _b2,
|
|
10577
|
+
var _a2, _b2, _c2;
|
|
10578
10578
|
try {
|
|
10579
10579
|
const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
|
|
10580
10580
|
if (!canvas) return false;
|
|
10581
10581
|
const zoom = ((_a2 = canvas.getZoom) == null ? void 0 : _a2.call(canvas)) ?? 1;
|
|
10582
10582
|
const w = (((_b2 = fabricObject.getScaledWidth) == null ? void 0 : _b2.call(fabricObject)) ?? fabricObject.width ?? 0) * zoom;
|
|
10583
|
-
const h = (((
|
|
10583
|
+
const h = (((_c2 = fabricObject.getScaledHeight) == null ? void 0 : _c2.call(fabricObject)) ?? fabricObject.height ?? 0) * zoom;
|
|
10584
10584
|
return Math.min(w, h) < COLLAPSE_THRESHOLD_PX;
|
|
10585
10585
|
} catch {
|
|
10586
10586
|
return false;
|
|
@@ -10598,11 +10598,11 @@ try {
|
|
|
10598
10598
|
control.__pixldocsCollapseVisibilityWrapped = true;
|
|
10599
10599
|
};
|
|
10600
10600
|
const renderPill = (ctx, left, top, _styleOverride, fabricObject, orientation, controlKey) => {
|
|
10601
|
-
var _a2, _b2,
|
|
10601
|
+
var _a2, _b2, _c2;
|
|
10602
10602
|
const action = (_b2 = (_a2 = fabricObject.canvas) == null ? void 0 : _a2._currentTransform) == null ? void 0 : _b2.action;
|
|
10603
10603
|
if (action === "drag" && fabricObject.__pixldocsDragMoved) return;
|
|
10604
10604
|
if (shouldCollapseHandles(fabricObject) && !isVisibleControlWhenCollapsed(controlKey)) return;
|
|
10605
|
-
const angle = ((
|
|
10605
|
+
const angle = ((_c2 = fabricObject.getTotalAngle) == null ? void 0 : _c2.call(fabricObject)) ?? (fabricObject.angle ?? 0);
|
|
10606
10606
|
const p = getHoverProgress(fabricObject, controlKey);
|
|
10607
10607
|
const scale = getVisualScale(fabricObject);
|
|
10608
10608
|
const pillLen = PILL_LEN * scale;
|
|
@@ -10799,7 +10799,7 @@ try {
|
|
|
10799
10799
|
mtr.x = 0;
|
|
10800
10800
|
mtr.y = -0.5;
|
|
10801
10801
|
mtr.cursorStyle = getRotateCursor(null);
|
|
10802
|
-
mtr.cursorStyleHandler = (_e,
|
|
10802
|
+
mtr.cursorStyleHandler = (_e, _c2, fabricObject) => {
|
|
10803
10803
|
const cursor = getRotateCursor(fabricObject);
|
|
10804
10804
|
try {
|
|
10805
10805
|
const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
|
|
@@ -10942,6 +10942,35 @@ try {
|
|
|
10942
10942
|
}
|
|
10943
10943
|
return controls;
|
|
10944
10944
|
};
|
|
10945
|
+
const ControlProto = (_b = fabric.Control) == null ? void 0 : _b.prototype;
|
|
10946
|
+
if (ControlProto && !ControlProto.__pixldocsCanvaRenderFallback) {
|
|
10947
|
+
const originalControlRender = ControlProto.render;
|
|
10948
|
+
ControlProto.render = function(ctx, left, top, styleOverride, fabricObject) {
|
|
10949
|
+
const actionName = String(this.actionName ?? "");
|
|
10950
|
+
if (actionName !== "rotate" && actionName !== "drag") {
|
|
10951
|
+
const x = Number(this.x ?? 0);
|
|
10952
|
+
const y = Number(this.y ?? 0);
|
|
10953
|
+
const atLeftRight = Math.abs(Math.abs(x) - 0.5) < 1e-3;
|
|
10954
|
+
const atTopBottom = Math.abs(Math.abs(y) - 0.5) < 1e-3;
|
|
10955
|
+
const atCenterX = Math.abs(x) < 1e-3;
|
|
10956
|
+
const atCenterY = Math.abs(y) < 1e-3;
|
|
10957
|
+
if (atLeftRight && atCenterY) {
|
|
10958
|
+
const key = x < 0 ? "ml" : "mr";
|
|
10959
|
+
return renderPill(ctx, left, top, styleOverride, fabricObject, "vertical", key);
|
|
10960
|
+
}
|
|
10961
|
+
if (atCenterX && atTopBottom) {
|
|
10962
|
+
const key = y < 0 ? "mt" : "mb";
|
|
10963
|
+
return renderPill(ctx, left, top, styleOverride, fabricObject, "horizontal", key);
|
|
10964
|
+
}
|
|
10965
|
+
if (atLeftRight && atTopBottom) {
|
|
10966
|
+
const key = `${y < 0 ? "t" : "b"}${x < 0 ? "l" : "r"}`;
|
|
10967
|
+
return renderCornerDot(ctx, left, top, styleOverride, fabricObject, key);
|
|
10968
|
+
}
|
|
10969
|
+
}
|
|
10970
|
+
return originalControlRender.call(this, ctx, left, top, styleOverride, fabricObject);
|
|
10971
|
+
};
|
|
10972
|
+
ControlProto.__pixldocsCanvaRenderFallback = true;
|
|
10973
|
+
}
|
|
10945
10974
|
ensureCanvaControlRenders = (obj) => {
|
|
10946
10975
|
try {
|
|
10947
10976
|
if (obj && obj.controls) installPillRenders(obj.controls);
|
|
@@ -10972,7 +11001,9 @@ try {
|
|
|
10972
11001
|
wrapClassCreateControls(fabric.FabricObject);
|
|
10973
11002
|
wrapClassCreateControls(fabric.Textbox);
|
|
10974
11003
|
wrapClassCreateControls(fabric.IText);
|
|
10975
|
-
|
|
11004
|
+
wrapClassCreateControls(fabric.ActiveSelection);
|
|
11005
|
+
wrapClassCreateControls(fabric.Group);
|
|
11006
|
+
const CanvasProto = (_c = fabric.Canvas) == null ? void 0 : _c.prototype;
|
|
10976
11007
|
if (CanvasProto && typeof CanvasProto._setCursorFromEvent === "function") {
|
|
10977
11008
|
const origSet = CanvasProto._setCursorFromEvent;
|
|
10978
11009
|
CanvasProto._setCursorFromEvent = function(e, target) {
|
|
@@ -11120,14 +11151,14 @@ const matrixForRotDriftLog = (matrix) => {
|
|
|
11120
11151
|
return matrix.map((entry) => roundRotDriftNumber(entry));
|
|
11121
11152
|
};
|
|
11122
11153
|
const summarizeRotDriftObject = (obj, worldMatrix) => {
|
|
11123
|
-
var _a2, _b2,
|
|
11154
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
11124
11155
|
if (!obj) return null;
|
|
11125
11156
|
const anyObj = obj;
|
|
11126
11157
|
try {
|
|
11127
11158
|
const ownMatrix = (_a2 = obj.calcOwnMatrix) == null ? void 0 : _a2.call(obj);
|
|
11128
11159
|
const calcWorld = worldMatrix ?? ((_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj));
|
|
11129
11160
|
const decomposed = calcWorld ? fabric.util.qrDecompose(calcWorld) : null;
|
|
11130
|
-
const center = (
|
|
11161
|
+
const center = (_c2 = obj.getCenterPoint) == null ? void 0 : _c2.call(obj);
|
|
11131
11162
|
const rect = (_d = obj.getBoundingRect) == null ? void 0 : _d.call(obj);
|
|
11132
11163
|
return {
|
|
11133
11164
|
id: getObjectId(obj),
|
|
@@ -12658,7 +12689,7 @@ const PageCanvas = forwardRef(
|
|
|
12658
12689
|
clearSectionGroupTransientSnapshot();
|
|
12659
12690
|
});
|
|
12660
12691
|
const syncSelectionToStore = () => {
|
|
12661
|
-
var _a2, _b2,
|
|
12692
|
+
var _a2, _b2, _c2, _d;
|
|
12662
12693
|
if (!isActiveRef.current || isRebuildingRef.current || isSyncingSelectionToFabricRef.current || !allowSelection) return;
|
|
12663
12694
|
const walkToTopmostGroup = (childId, children, activeEditingGroupId) => {
|
|
12664
12695
|
let topmost = null;
|
|
@@ -12727,7 +12758,7 @@ const PageCanvas = forwardRef(
|
|
|
12727
12758
|
}
|
|
12728
12759
|
if (ids.length > 1 && !(active instanceof fabric.ActiveSelection && active.__pixldocsGroupSelection)) {
|
|
12729
12760
|
const state = useEditorStore.getState();
|
|
12730
|
-
const currentPage2 = (
|
|
12761
|
+
const currentPage2 = (_c2 = state.canvas.pages) == null ? void 0 : _c2.find((p) => p.id === pageId);
|
|
12731
12762
|
const children = (currentPage2 == null ? void 0 : currentPage2.children) ?? [];
|
|
12732
12763
|
const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
|
|
12733
12764
|
const involvedGroupIds = /* @__PURE__ */ new Set();
|
|
@@ -12868,7 +12899,7 @@ const PageCanvas = forwardRef(
|
|
|
12868
12899
|
}
|
|
12869
12900
|
});
|
|
12870
12901
|
fabricCanvas.on("mouse:dblclick", (opt) => {
|
|
12871
|
-
var _a2, _b2,
|
|
12902
|
+
var _a2, _b2, _c2;
|
|
12872
12903
|
const target = opt == null ? void 0 : opt.target;
|
|
12873
12904
|
if (!target) return;
|
|
12874
12905
|
if (target.isEditing) return;
|
|
@@ -12964,7 +12995,7 @@ const PageCanvas = forwardRef(
|
|
|
12964
12995
|
const selectedId = selectionIdx < 0 ? childId : chain[selectionIdx].id;
|
|
12965
12996
|
selectElements([selectedId], false, false);
|
|
12966
12997
|
try {
|
|
12967
|
-
(
|
|
12998
|
+
(_c2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c2.call(fabricCanvas);
|
|
12968
12999
|
} catch {
|
|
12969
13000
|
}
|
|
12970
13001
|
});
|
|
@@ -13115,7 +13146,7 @@ const PageCanvas = forwardRef(
|
|
|
13115
13146
|
};
|
|
13116
13147
|
const isMultiSelectModifier = (event) => !!((event == null ? void 0 : event.shiftKey) || (event == null ? void 0 : event.metaKey) || (event == null ? void 0 : event.ctrlKey));
|
|
13117
13148
|
const pickChildInActiveSelectionAtPointer = (selection, event) => {
|
|
13118
|
-
var _a2, _b2,
|
|
13149
|
+
var _a2, _b2, _c2, _d, _e;
|
|
13119
13150
|
try {
|
|
13120
13151
|
const pointer = fabricCanvas.getPointer(event);
|
|
13121
13152
|
const viewportPointer = (_a2 = fabricCanvas.getViewportPoint) == null ? void 0 : _a2.call(fabricCanvas, event);
|
|
@@ -13126,7 +13157,7 @@ const PageCanvas = forwardRef(
|
|
|
13126
13157
|
const obj = members[i];
|
|
13127
13158
|
const id = getObjectId(obj);
|
|
13128
13159
|
if (!id || id === "__background__" || obj.visible === false) continue;
|
|
13129
|
-
(
|
|
13160
|
+
(_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
|
|
13130
13161
|
const containsScene = typeof obj.containsPoint === "function" && obj.containsPoint(pointer);
|
|
13131
13162
|
const containsViewport = !!(viewportPointer && typeof obj.containsPoint === "function" && obj.containsPoint(viewportPointer));
|
|
13132
13163
|
if (containsScene || containsViewport) return obj;
|
|
@@ -13160,7 +13191,7 @@ const PageCanvas = forwardRef(
|
|
|
13160
13191
|
};
|
|
13161
13192
|
let pendingShiftMultiSelect = null;
|
|
13162
13193
|
const applyShiftMultiSelect = (target, event, baselineActive = fabricCanvas.getActiveObject(), baselineObjects = fabricCanvas.getActiveObjects()) => {
|
|
13163
|
-
var _a2, _b2,
|
|
13194
|
+
var _a2, _b2, _c2;
|
|
13164
13195
|
if (!target || !target.selectable) return false;
|
|
13165
13196
|
const active = baselineActive;
|
|
13166
13197
|
if (!active || ((_a2 = active.getActiveControl) == null ? void 0 : _a2.call(active))) return false;
|
|
@@ -13195,7 +13226,7 @@ const PageCanvas = forwardRef(
|
|
|
13195
13226
|
});
|
|
13196
13227
|
}
|
|
13197
13228
|
(_b2 = event == null ? void 0 : event.preventDefault) == null ? void 0 : _b2.call(event);
|
|
13198
|
-
(
|
|
13229
|
+
(_c2 = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _c2.call(event);
|
|
13199
13230
|
return true;
|
|
13200
13231
|
};
|
|
13201
13232
|
const markMixedLogicalSelection = (selection, groupIds, groupMemberIds) => {
|
|
@@ -13232,9 +13263,9 @@ const PageCanvas = forwardRef(
|
|
|
13232
13263
|
return !!(((_a2 = o == null ? void 0 : o._ct) == null ? void 0 : _a2.isCropGroup) || (o == null ? void 0 : o.__cropGroup));
|
|
13233
13264
|
};
|
|
13234
13265
|
const promoteToCropGroup = (opt) => {
|
|
13235
|
-
var _a2, _b2,
|
|
13266
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
13236
13267
|
const t = opt.target;
|
|
13237
|
-
if (((_a2 = opt.e) == null ? void 0 : _a2.type) !== "mousedown" && ((_b2 = opt.e) == null ? void 0 : _b2.type) !== "pointerdown" && ((
|
|
13268
|
+
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") {
|
|
13238
13269
|
if (t && isCropGroup2(t)) {
|
|
13239
13270
|
fabricCanvas._hoveredTarget = t;
|
|
13240
13271
|
} else if ((t == null ? void 0 : t.group) && isCropGroup2(t.group)) {
|
|
@@ -13404,14 +13435,14 @@ const PageCanvas = forwardRef(
|
|
|
13404
13435
|
};
|
|
13405
13436
|
fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
|
|
13406
13437
|
fabricCanvas.on("mouse:down:before", (opt) => {
|
|
13407
|
-
var _a2, _b2,
|
|
13438
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
13408
13439
|
const activeBeforeMouseDown = fabricCanvas.getActiveObject();
|
|
13409
13440
|
if (editLockRef.current) {
|
|
13410
13441
|
const active = fabricCanvas.getActiveObject();
|
|
13411
13442
|
if (active && (((_a2 = active._ct) == null ? void 0 : _a2.isCropGroup) || active.__cropGroup)) {
|
|
13412
13443
|
opt.target = active;
|
|
13413
13444
|
if (opt.e) {
|
|
13414
|
-
(
|
|
13445
|
+
(_c2 = (_b2 = opt.e).preventDefault) == null ? void 0 : _c2.call(_b2);
|
|
13415
13446
|
(_e = (_d = opt.e).stopPropagation) == null ? void 0 : _e.call(_d);
|
|
13416
13447
|
}
|
|
13417
13448
|
}
|
|
@@ -13667,7 +13698,7 @@ const PageCanvas = forwardRef(
|
|
|
13667
13698
|
o.__lockScaleDuringCrop = false;
|
|
13668
13699
|
});
|
|
13669
13700
|
fabricCanvas.on("mouse:up", (e) => {
|
|
13670
|
-
var _a2, _b2,
|
|
13701
|
+
var _a2, _b2, _c2;
|
|
13671
13702
|
clearTransforming();
|
|
13672
13703
|
setGuides([]);
|
|
13673
13704
|
setRotationLabel(null);
|
|
@@ -13761,7 +13792,7 @@ const PageCanvas = forwardRef(
|
|
|
13761
13792
|
}
|
|
13762
13793
|
}
|
|
13763
13794
|
const activeObj = fabricCanvas.getActiveObject();
|
|
13764
|
-
if (activeObj && (activeObj.__cropGroup || ((
|
|
13795
|
+
if (activeObj && (activeObj.__cropGroup || ((_c2 = activeObj._ct) == null ? void 0 : _c2.isCropGroup))) {
|
|
13765
13796
|
activeObj.__lockScaleDuringCrop = false;
|
|
13766
13797
|
if (activeObj.__cropDrag) {
|
|
13767
13798
|
delete activeObj.__cropDrag;
|
|
@@ -13857,7 +13888,7 @@ const PageCanvas = forwardRef(
|
|
|
13857
13888
|
fabricCanvas.on("selection:cleared", () => {
|
|
13858
13889
|
});
|
|
13859
13890
|
fabricCanvas.on("object:scaling", (e) => {
|
|
13860
|
-
var _a2, _b2,
|
|
13891
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h;
|
|
13861
13892
|
if (!isActiveRef.current) return;
|
|
13862
13893
|
const t = e.target;
|
|
13863
13894
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
@@ -14033,7 +14064,7 @@ const PageCanvas = forwardRef(
|
|
|
14033
14064
|
time: Math.round(performance.now()),
|
|
14034
14065
|
corner,
|
|
14035
14066
|
groupSelectionId: obj.__pixldocsGroupSelection,
|
|
14036
|
-
currentTransformAction: (
|
|
14067
|
+
currentTransformAction: (_c2 = fabricCanvas._currentTransform) == null ? void 0 : _c2.action,
|
|
14037
14068
|
selection: summarizeFabricObjectForResizeDebug(obj),
|
|
14038
14069
|
textChildren: obj.getObjects().filter((child) => child instanceof fabric.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
|
|
14039
14070
|
};
|
|
@@ -14551,7 +14582,7 @@ const PageCanvas = forwardRef(
|
|
|
14551
14582
|
});
|
|
14552
14583
|
let cropGroupSaveTimer = null;
|
|
14553
14584
|
fabricCanvas.on("object:modified", (e) => {
|
|
14554
|
-
var _a2, _b2,
|
|
14585
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
|
|
14555
14586
|
try {
|
|
14556
14587
|
if (suppressObjectModifiedDuringInternalReselectRef.current) return;
|
|
14557
14588
|
dragStarted = false;
|
|
@@ -14706,12 +14737,12 @@ const PageCanvas = forwardRef(
|
|
|
14706
14737
|
clearTimeout(cropGroupSaveTimer);
|
|
14707
14738
|
}
|
|
14708
14739
|
cropGroupSaveTimer = setTimeout(() => {
|
|
14709
|
-
var _a3, _b3,
|
|
14740
|
+
var _a3, _b3, _c3;
|
|
14710
14741
|
const { updateElement: updateElement2 } = useEditorStore.getState();
|
|
14711
14742
|
const img = ct._img;
|
|
14712
14743
|
const zoom3 = ((_a3 = img == null ? void 0 : img._ct) == null ? void 0 : _a3.zoom) ?? 1;
|
|
14713
14744
|
const panX = ((_b3 = img == null ? void 0 : img._ct) == null ? void 0 : _b3.panX) ?? 0.5;
|
|
14714
|
-
const panY = ((
|
|
14745
|
+
const panY = ((_c3 = img == null ? void 0 : img._ct) == null ? void 0 : _c3.panY) ?? 0.5;
|
|
14715
14746
|
const stateCrop = useEditorStore.getState();
|
|
14716
14747
|
const pageCrop = stateCrop.canvas.pages.find((p) => p.id === pageId);
|
|
14717
14748
|
const pageChildrenCrop = (pageCrop == null ? void 0 : pageCrop.children) ?? [];
|
|
@@ -14741,7 +14772,7 @@ const PageCanvas = forwardRef(
|
|
|
14741
14772
|
}
|
|
14742
14773
|
if (active && active instanceof fabric.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
|
|
14743
14774
|
const groupId = getObjectId(active);
|
|
14744
|
-
const pageChildrenSec = ((
|
|
14775
|
+
const pageChildrenSec = ((_c2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c2.children) ?? [];
|
|
14745
14776
|
const modifiedTarget2 = e == null ? void 0 : e.target;
|
|
14746
14777
|
const resizeScaleTarget = lastResizeScaleTargetRef.current;
|
|
14747
14778
|
lastResizeScaleTargetRef.current = null;
|
|
@@ -15876,7 +15907,7 @@ const PageCanvas = forwardRef(
|
|
|
15876
15907
|
visibilityUpdateInProgressRef.current = false;
|
|
15877
15908
|
}
|
|
15878
15909
|
doSyncRef.current = () => {
|
|
15879
|
-
var _a2, _b2,
|
|
15910
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
15880
15911
|
const shouldSkipUpdates2 = syncLockedRef.current || editLockRef.current;
|
|
15881
15912
|
const state = useEditorStore.getState();
|
|
15882
15913
|
const elementsToSync = elements;
|
|
@@ -15920,7 +15951,7 @@ const PageCanvas = forwardRef(
|
|
|
15920
15951
|
const activeObjId = activeObj ? getObjectId(activeObj) : null;
|
|
15921
15952
|
const isTextBeingEdited = activeObjId && editingTextIdRef.current === activeObjId;
|
|
15922
15953
|
const isMultiSelect = activeObj instanceof fabric.ActiveSelection;
|
|
15923
|
-
if (activeObj && isMultiSelect && !(((
|
|
15954
|
+
if (activeObj && isMultiSelect && !(((_c2 = activeObj._ct) == null ? void 0 : _c2.isCropGroup) || activeObj.__cropGroup) && !isTextBeingEdited) {
|
|
15924
15955
|
fc.discardActiveObject();
|
|
15925
15956
|
}
|
|
15926
15957
|
}
|
|
@@ -17078,7 +17109,7 @@ const PageCanvas = forwardRef(
|
|
|
17078
17109
|
return unsub;
|
|
17079
17110
|
}, []);
|
|
17080
17111
|
const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
|
|
17081
|
-
var _a2, _b2,
|
|
17112
|
+
var _a2, _b2, _c2;
|
|
17082
17113
|
const fc = fabricRef.current;
|
|
17083
17114
|
if (fc && isTransforming(fc)) {
|
|
17084
17115
|
return;
|
|
@@ -17599,7 +17630,7 @@ const PageCanvas = forwardRef(
|
|
|
17599
17630
|
} catch {
|
|
17600
17631
|
}
|
|
17601
17632
|
obj.dirty = true;
|
|
17602
|
-
(
|
|
17633
|
+
(_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
|
|
17603
17634
|
obj.__lastTextBgShadowJson = JSON.stringify({
|
|
17604
17635
|
c: element.textBgColor ?? null,
|
|
17605
17636
|
g: element.textBgGradient ?? null,
|
|
@@ -17907,7 +17938,7 @@ const PageCanvas = forwardRef(
|
|
|
17907
17938
|
return Math.max(min, Math.min(max, v));
|
|
17908
17939
|
};
|
|
17909
17940
|
const applyEdgeFadeFrameClipPath = (group, element, frameW, frameH, shape, rxRatio) => {
|
|
17910
|
-
var _a2, _b2,
|
|
17941
|
+
var _a2, _b2, _c2;
|
|
17911
17942
|
const fadeElement = element;
|
|
17912
17943
|
const fadeGroup = group;
|
|
17913
17944
|
const inputKey = edgeFadeKey(fadeElement);
|
|
@@ -18042,10 +18073,10 @@ const PageCanvas = forwardRef(
|
|
|
18042
18073
|
children.forEach((child) => {
|
|
18043
18074
|
child.dirty = true;
|
|
18044
18075
|
});
|
|
18045
|
-
(
|
|
18076
|
+
(_c2 = group.canvas) == null ? void 0 : _c2.requestRenderAll();
|
|
18046
18077
|
};
|
|
18047
18078
|
const loadImageAsync2 = async (element, placeholder, fc) => {
|
|
18048
|
-
var _a2, _b2,
|
|
18079
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
18049
18080
|
const imageUrl = element.src || element.imageUrl;
|
|
18050
18081
|
if (!imageUrl) return;
|
|
18051
18082
|
const elementId = element.id;
|
|
@@ -18080,7 +18111,7 @@ const PageCanvas = forwardRef(
|
|
|
18080
18111
|
const willUseCropGroupForFade = imageFitForFade !== "fill" || clipShapeForFade && clipShapeForFade !== "none";
|
|
18081
18112
|
try {
|
|
18082
18113
|
if (hasEdgeFade(element) && !willUseCropGroupForFade) {
|
|
18083
|
-
const srcEl = (
|
|
18114
|
+
const srcEl = (_c2 = img.getElement) == null ? void 0 : _c2.call(img);
|
|
18084
18115
|
if (srcEl) {
|
|
18085
18116
|
const baked = bakeEdgeFade(srcEl, element);
|
|
18086
18117
|
img.setElement(baked);
|
|
@@ -18847,14 +18878,14 @@ function PreviewCanvas({
|
|
|
18847
18878
|
onDynamicFieldClick,
|
|
18848
18879
|
onReady
|
|
18849
18880
|
}) {
|
|
18850
|
-
var _a2, _b2,
|
|
18881
|
+
var _a2, _b2, _c2, _d, _e;
|
|
18851
18882
|
const canvasRef = useRef(null);
|
|
18852
18883
|
const containerRef = useRef(null);
|
|
18853
18884
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
18854
18885
|
const [hoveredFieldId, setHoveredFieldId] = useState(null);
|
|
18855
18886
|
const page = (_a2 = config == null ? void 0 : config.pages) == null ? void 0 : _a2[pageIndex];
|
|
18856
18887
|
const canvasWidth = ((_b2 = config == null ? void 0 : config.canvas) == null ? void 0 : _b2.width) || 612;
|
|
18857
|
-
const canvasHeight = ((
|
|
18888
|
+
const canvasHeight = ((_c2 = config == null ? void 0 : config.canvas) == null ? void 0 : _c2.height) || 792;
|
|
18858
18889
|
const elementToFieldMap = useMemo(
|
|
18859
18890
|
() => buildElementToFieldMap(config == null ? void 0 : config.dynamicFields),
|
|
18860
18891
|
[config == null ? void 0 : config.dynamicFields]
|
|
@@ -18910,7 +18941,7 @@ function PreviewCanvas({
|
|
|
18910
18941
|
};
|
|
18911
18942
|
}, [(_d = page == null ? void 0 : page.settings) == null ? void 0 : _d.backgroundColor, (_e = page == null ? void 0 : page.settings) == null ? void 0 : _e.backgroundGradient]);
|
|
18912
18943
|
const projectSettings = useMemo(() => {
|
|
18913
|
-
var _a3, _b3,
|
|
18944
|
+
var _a3, _b3, _c3;
|
|
18914
18945
|
const vars = ((_a3 = config.themeConfig) == null ? void 0 : _a3.variables) || {};
|
|
18915
18946
|
return {
|
|
18916
18947
|
showGrid: false,
|
|
@@ -18919,7 +18950,7 @@ function PreviewCanvas({
|
|
|
18919
18950
|
snapToGuides: false,
|
|
18920
18951
|
snapThreshold: 5,
|
|
18921
18952
|
primaryColor: (_b3 = vars.primary) == null ? void 0 : _b3.value,
|
|
18922
|
-
secondaryColor: (
|
|
18953
|
+
secondaryColor: (_c3 = vars.secondary) == null ? void 0 : _c3.value
|
|
18923
18954
|
};
|
|
18924
18955
|
}, [config.themeConfig]);
|
|
18925
18956
|
const handleDynamicFieldClick = useCallback((elementId) => {
|
|
@@ -19070,7 +19101,7 @@ const PreviewCanvas$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
|
|
|
19070
19101
|
PreviewCanvas
|
|
19071
19102
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
19072
19103
|
function applyThemeToConfig(config, themeOverrides) {
|
|
19073
|
-
var _a2, _b2,
|
|
19104
|
+
var _a2, _b2, _c2;
|
|
19074
19105
|
if (!themeOverrides || Object.keys(themeOverrides).length === 0) return config;
|
|
19075
19106
|
const cloned = JSON.parse(JSON.stringify(config));
|
|
19076
19107
|
if ((_a2 = cloned.themeConfig) == null ? void 0 : _a2.variables) {
|
|
@@ -19102,7 +19133,7 @@ function applyThemeToConfig(config, themeOverrides) {
|
|
|
19102
19133
|
}
|
|
19103
19134
|
}
|
|
19104
19135
|
for (const page of cloned.pages || []) {
|
|
19105
|
-
const bgBinding = (
|
|
19136
|
+
const bgBinding = (_c2 = page.themeBindings) == null ? void 0 : _c2.backgroundColor;
|
|
19106
19137
|
if (bgBinding && varMap.has(bgBinding) && page.settings) {
|
|
19107
19138
|
page.settings.backgroundColor = varMap.get(bgBinding);
|
|
19108
19139
|
}
|
|
@@ -20021,7 +20052,7 @@ function getNestedRepeatableEntryCount(parentId, parentIndex, childId, formValue
|
|
|
20021
20052
|
return Math.max(1, maxIndex);
|
|
20022
20053
|
}
|
|
20023
20054
|
function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsFromSchema, repeatableEntryCounts, repeatableNestedEntryCounts, displayFormatMap, repeatablePagesFromSchema) {
|
|
20024
|
-
var _a2, _b2,
|
|
20055
|
+
var _a2, _b2, _c2;
|
|
20025
20056
|
const cloned = JSON.parse(JSON.stringify(config));
|
|
20026
20057
|
if (!cloned.pages) return cloned;
|
|
20027
20058
|
const dynamicFields = cloned.dynamicFields;
|
|
@@ -20585,7 +20616,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
|
|
|
20585
20616
|
}
|
|
20586
20617
|
}
|
|
20587
20618
|
for (const page of pages) {
|
|
20588
|
-
if ((
|
|
20619
|
+
if ((_c2 = page.children) == null ? void 0 : _c2.length) {
|
|
20589
20620
|
page.children = applyStackReflowToPageTree(page.children, { preserveExplicitTextHeights: true });
|
|
20590
20621
|
}
|
|
20591
20622
|
}
|
|
@@ -20798,7 +20829,7 @@ function splitNestedForOverflow(flowStack, stayChildren, overflowChildren, overf
|
|
|
20798
20829
|
return { stayChildren: newStay, overflowChildren: newOverflow };
|
|
20799
20830
|
}
|
|
20800
20831
|
function paginateSinglePage(sourcePage, pageOffsetIndex) {
|
|
20801
|
-
var _a2, _b2,
|
|
20832
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
20802
20833
|
const contentTop = (_a2 = sourcePage.settings) == null ? void 0 : _a2.contentTop;
|
|
20803
20834
|
const contentBottom = (_b2 = sourcePage.settings) == null ? void 0 : _b2.contentBottom;
|
|
20804
20835
|
if (contentTop == null || contentBottom == null || contentBottom <= contentTop) {
|
|
@@ -20875,7 +20906,7 @@ function paginateSinglePage(sourcePage, pageOffsetIndex) {
|
|
|
20875
20906
|
children: applyStackReflowToPageTree(updatedContChildren)
|
|
20876
20907
|
};
|
|
20877
20908
|
if (nextOverflowChildren.length > 0) {
|
|
20878
|
-
const originalFlowStack = ((
|
|
20909
|
+
const originalFlowStack = ((_c2 = currentOverflows[si]) == null ? void 0 : _c2.flowStack) ?? contFlowStack;
|
|
20879
20910
|
nextOverflows.push({ flowStack: originalFlowStack, overflowChildren: nextOverflowChildren });
|
|
20880
20911
|
}
|
|
20881
20912
|
}
|
|
@@ -23069,7 +23100,7 @@ async function resolveTemplateData(options) {
|
|
|
23069
23100
|
};
|
|
23070
23101
|
}
|
|
23071
23102
|
async function resolveFromForm(options) {
|
|
23072
|
-
var _a2, _b2,
|
|
23103
|
+
var _a2, _b2, _c2;
|
|
23073
23104
|
const { templateId, formSchemaId, sectionState, flatFormData: directFlatFormData, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
|
|
23074
23105
|
const hasSectionStateInput = !!sectionState && Object.keys(sectionState).length > 0;
|
|
23075
23106
|
if (!formSchemaId && !hasSectionStateInput) {
|
|
@@ -23271,7 +23302,7 @@ async function resolveFromForm(options) {
|
|
|
23271
23302
|
displayFormatMap.size > 0 ? displayFormatMap : void 0,
|
|
23272
23303
|
buildRepeatablePagesInputForApply(formSchema, mergedSectionState)
|
|
23273
23304
|
);
|
|
23274
|
-
if ((
|
|
23305
|
+
if ((_c2 = resolvedConfig.themeConfig) == null ? void 0 : _c2.variables) {
|
|
23275
23306
|
const baseOverrides = {};
|
|
23276
23307
|
for (const [key, def] of Object.entries(resolvedConfig.themeConfig.variables)) {
|
|
23277
23308
|
baseOverrides[key] = def.value;
|
|
@@ -23306,12 +23337,12 @@ function themeBaseId(id) {
|
|
|
23306
23337
|
return out;
|
|
23307
23338
|
}
|
|
23308
23339
|
function applyThemeVariantToConfig(config, themeConfig, themeId) {
|
|
23309
|
-
var _a2, _b2,
|
|
23340
|
+
var _a2, _b2, _c2, _d;
|
|
23310
23341
|
if (!themeConfig) return config;
|
|
23311
23342
|
const variant = themeId && themeId !== "default" ? (_a2 = themeConfig.variants) == null ? void 0 : _a2.find((v) => v.id === themeId) : null;
|
|
23312
23343
|
const shouldApplyDefaults = !variant && ((_b2 = themeConfig.properties) == null ? void 0 : _b2.length);
|
|
23313
23344
|
if (!variant && !shouldApplyDefaults) return config;
|
|
23314
|
-
if (!((
|
|
23345
|
+
if (!((_c2 = themeConfig.properties) == null ? void 0 : _c2.length)) return config;
|
|
23315
23346
|
const result = JSON.parse(JSON.stringify(config));
|
|
23316
23347
|
const cloneIdMap = config.__cloneIdMap || {};
|
|
23317
23348
|
const pageElements = result.pages.map((page) => flattenAll(page.children || []));
|
|
@@ -24222,7 +24253,7 @@ function ensureFabricGradientDef(doc, obj, width, height) {
|
|
|
24222
24253
|
return `url(#${id})`;
|
|
24223
24254
|
}
|
|
24224
24255
|
function warpTextboxSvgAlongPath(svg, obj) {
|
|
24225
|
-
var _a2, _b2,
|
|
24256
|
+
var _a2, _b2, _c2, _d, _e;
|
|
24226
24257
|
const tp = obj == null ? void 0 : obj.textPath;
|
|
24227
24258
|
if (!tp || !tp.preset || tp.preset === "none") return svg;
|
|
24228
24259
|
if (tp.preset === "rise" || tp.preset === "angle") {
|
|
@@ -24326,7 +24357,7 @@ function warpTextboxSvgAlongPath(svg, obj) {
|
|
|
24326
24357
|
for (const el of Array.from(doc.querySelectorAll("*"))) stripFilter(el);
|
|
24327
24358
|
for (const filter of Array.from(doc.querySelectorAll("filter"))) {
|
|
24328
24359
|
try {
|
|
24329
|
-
(
|
|
24360
|
+
(_c2 = filter.parentNode) == null ? void 0 : _c2.removeChild(filter);
|
|
24330
24361
|
} catch {
|
|
24331
24362
|
}
|
|
24332
24363
|
}
|
|
@@ -24661,9 +24692,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24661
24692
|
}
|
|
24662
24693
|
return svgString;
|
|
24663
24694
|
}
|
|
24664
|
-
const resolvedPackageVersion = "0.5.
|
|
24695
|
+
const resolvedPackageVersion = "0.5.374";
|
|
24665
24696
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24666
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24697
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.374";
|
|
24667
24698
|
const roundParityValue = (value) => {
|
|
24668
24699
|
if (typeof value !== "number") return value;
|
|
24669
24700
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24840,12 +24871,12 @@ function installUnderlineFix(fab) {
|
|
|
24840
24871
|
if (!TextProto || typeof TextProto._renderTextDecoration !== "function") return;
|
|
24841
24872
|
const original = TextProto._renderTextDecoration;
|
|
24842
24873
|
const measureLineTextWidth = (obj, ctx, lineIndex) => {
|
|
24843
|
-
var _a3, _b2,
|
|
24874
|
+
var _a3, _b2, _c2, _d, _e, _f;
|
|
24844
24875
|
const rawLine = (_a3 = obj._textLines) == null ? void 0 : _a3[lineIndex];
|
|
24845
24876
|
const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
|
|
24846
24877
|
if (!lineText) return 0;
|
|
24847
24878
|
const fontSize = Number(((_b2 = obj.getValueOfPropertyAt) == null ? void 0 : _b2.call(obj, lineIndex, 0, "fontSize")) ?? obj.fontSize ?? 0);
|
|
24848
|
-
const fontStyle = String(((
|
|
24879
|
+
const fontStyle = String(((_c2 = obj.getValueOfPropertyAt) == null ? void 0 : _c2.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
|
|
24849
24880
|
const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
|
|
24850
24881
|
const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
|
|
24851
24882
|
const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
|
|
@@ -25477,7 +25508,7 @@ class PixldocsRenderer {
|
|
|
25477
25508
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25478
25509
|
}
|
|
25479
25510
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25480
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25511
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-HghwbAxV.js");
|
|
25481
25512
|
const prepared = preparePagesForExport(
|
|
25482
25513
|
cloned.pages,
|
|
25483
25514
|
canvasWidth,
|
|
@@ -26161,7 +26192,7 @@ class PixldocsRenderer {
|
|
|
26161
26192
|
logJsonLine("[canvas-renderer][fabric-text-parity]", { stage, textboxes: sample.length, sample });
|
|
26162
26193
|
}
|
|
26163
26194
|
async waitForStableTextMetrics(container, config, options = {}) {
|
|
26164
|
-
var _a2, _b2,
|
|
26195
|
+
var _a2, _b2, _c2;
|
|
26165
26196
|
if (typeof document !== "undefined") {
|
|
26166
26197
|
void ensureFontsForResolvedConfig(config);
|
|
26167
26198
|
await this.waitForRelevantFonts(config);
|
|
@@ -26205,7 +26236,7 @@ class PixldocsRenderer {
|
|
|
26205
26236
|
(_a2 = fabricInstance.calcOffset) == null ? void 0 : _a2.call(fabricInstance);
|
|
26206
26237
|
(_b2 = fabricInstance.renderAll) == null ? void 0 : _b2.call(fabricInstance);
|
|
26207
26238
|
await waitForPaint();
|
|
26208
|
-
(
|
|
26239
|
+
(_c2 = fabricInstance.renderAll) == null ? void 0 : _c2.call(fabricInstance);
|
|
26209
26240
|
await waitForPaint();
|
|
26210
26241
|
this.logFabricTextParitySnapshot("after-stable-text-metrics", fabricInstance);
|
|
26211
26242
|
}
|
|
@@ -26719,7 +26750,7 @@ function normalizeSvgExplicitColors(svg) {
|
|
|
26719
26750
|
function bakeGroupOpacityIntoChildren(svg) {
|
|
26720
26751
|
const DRAWABLE = /* @__PURE__ */ new Set(["path", "rect", "circle", "ellipse", "polygon", "polyline", "line", "text", "tspan"]);
|
|
26721
26752
|
function walkAndBake(el, inheritedOpacity) {
|
|
26722
|
-
var _a2, _b2,
|
|
26753
|
+
var _a2, _b2, _c2, _d;
|
|
26723
26754
|
if (isInSvgDefinitionSubtree(el)) {
|
|
26724
26755
|
for (let i = 0; i < el.children.length; i++) walkAndBake(el.children[i], 1);
|
|
26725
26756
|
return;
|
|
@@ -26731,7 +26762,7 @@ function bakeGroupOpacityIntoChildren(svg) {
|
|
|
26731
26762
|
const combinedOpacity = inheritedOpacity * ownOpacity;
|
|
26732
26763
|
if (ownOpacity < 0.999 && tag !== "image") {
|
|
26733
26764
|
el.removeAttribute("opacity");
|
|
26734
|
-
if ((
|
|
26765
|
+
if ((_c2 = el.style) == null ? void 0 : _c2.opacity) el.style.removeProperty("opacity");
|
|
26735
26766
|
}
|
|
26736
26767
|
if (DRAWABLE.has(tag) && combinedOpacity < 0.999) {
|
|
26737
26768
|
multiplySvgOpacityAttr(el, "fill-opacity", combinedOpacity);
|
|
@@ -27528,7 +27559,7 @@ async function convertSvgTextDecorationsToLinesString(svgStr) {
|
|
|
27528
27559
|
}
|
|
27529
27560
|
}
|
|
27530
27561
|
async function rasterizeShadowMarkers(svg) {
|
|
27531
|
-
var _a2, _b2,
|
|
27562
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
27532
27563
|
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
27533
27564
|
const markers = Array.from(svg.querySelectorAll("g.__pdShadowRaster"));
|
|
27534
27565
|
if (markers.length === 0) return;
|
|
@@ -27560,7 +27591,7 @@ async function rasterizeShadowMarkers(svg) {
|
|
|
27560
27591
|
);
|
|
27561
27592
|
try {
|
|
27562
27593
|
const fontSpecs = collectFontSpecsFromMarkup(innerXml);
|
|
27563
|
-
if (fontSpecs.length > 0 && ((
|
|
27594
|
+
if (fontSpecs.length > 0 && ((_c2 = document.fonts) == null ? void 0 : _c2.load)) {
|
|
27564
27595
|
await Promise.all(
|
|
27565
27596
|
fontSpecs.map(
|
|
27566
27597
|
(spec) => document.fonts.load(spec).catch(() => void 0)
|
|
@@ -27797,7 +27828,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27797
27828
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27798
27829
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27799
27830
|
try {
|
|
27800
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27831
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-HghwbAxV.js");
|
|
27801
27832
|
try {
|
|
27802
27833
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27803
27834
|
} catch {
|
|
@@ -28197,4 +28228,4 @@ export {
|
|
|
28197
28228
|
buildTeaserBlurFlatKeys as y,
|
|
28198
28229
|
collectFontDescriptorsFromConfig as z
|
|
28199
28230
|
};
|
|
28200
|
-
//# sourceMappingURL=index-
|
|
28231
|
+
//# sourceMappingURL=index-DQyoK8Nv.js.map
|