@pixldocs/canvas-renderer 0.5.187 → 0.5.189
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/README.md +59 -9
- package/dist/{index-DgMi1JSR.cjs → index-CmrxeQ_K.cjs} +200 -132
- package/dist/index-CmrxeQ_K.cjs.map +1 -0
- package/dist/{index-C9H38u7P.js → index-lQXXPpb8.js} +231 -163
- package/dist/index-lQXXPpb8.js.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -20
- package/dist/index.js +32 -31
- package/dist/{vectorPdfExport-BknzMTNP.cjs → vectorPdfExport-BAAJU0RL.cjs} +4 -4
- package/dist/{vectorPdfExport-BknzMTNP.cjs.map → vectorPdfExport-BAAJU0RL.cjs.map} +1 -1
- package/dist/{vectorPdfExport-BkERGCkM.js → vectorPdfExport-Ch-qwcNJ.js} +4 -4
- package/dist/{vectorPdfExport-BkERGCkM.js.map → vectorPdfExport-Ch-qwcNJ.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-C9H38u7P.js.map +0 -1
- package/dist/index-DgMi1JSR.cjs.map +0 -1
|
@@ -16115,10 +16115,122 @@ async function getTemplateForm(options) {
|
|
|
16115
16115
|
initialSectionState
|
|
16116
16116
|
};
|
|
16117
16117
|
}
|
|
16118
|
+
const OVERLAY_ID_PREFIX = "__pb_";
|
|
16119
|
+
function getNumber(v, fallback = 0) {
|
|
16120
|
+
return typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
16121
|
+
}
|
|
16122
|
+
function resolveSize(node, key) {
|
|
16123
|
+
const v = node == null ? void 0 : node[key];
|
|
16124
|
+
if (typeof v === "number" && Number.isFinite(v)) return v;
|
|
16125
|
+
return 0;
|
|
16126
|
+
}
|
|
16127
|
+
function collectOverlays(node, parentLeft, parentTop, inheritedBlur, extraBaseIds, extraExactIds, out) {
|
|
16128
|
+
if (!node || typeof node !== "object") return;
|
|
16129
|
+
const matchesBase = !!(extraBaseIds && typeof node.id === "string" && extraBaseIds.has(baseId(node.id)));
|
|
16130
|
+
const matchesExact = !!(extraExactIds && typeof node.id === "string" && extraExactIds.has(node.id));
|
|
16131
|
+
const isBlurred = inheritedBlur || node.previewBlur === true || matchesBase || matchesExact;
|
|
16132
|
+
const absLeft = parentLeft + getNumber(node.left, 0);
|
|
16133
|
+
const absTop = parentTop + getNumber(node.top, 0);
|
|
16134
|
+
if (node.type === "group") {
|
|
16135
|
+
const children = node.children || node.elements;
|
|
16136
|
+
if (Array.isArray(children)) {
|
|
16137
|
+
for (const child of children) {
|
|
16138
|
+
collectOverlays(child, absLeft, absTop, isBlurred, extraBaseIds, extraExactIds, out);
|
|
16139
|
+
}
|
|
16140
|
+
}
|
|
16141
|
+
return;
|
|
16142
|
+
}
|
|
16143
|
+
if (!isBlurred) return;
|
|
16144
|
+
const scaleX = getNumber(node.scaleX, 1) || 1;
|
|
16145
|
+
const scaleY = getNumber(node.scaleY, 1) || 1;
|
|
16146
|
+
const w = Math.max(4, resolveSize(node, "width") * scaleX);
|
|
16147
|
+
const h = Math.max(4, resolveSize(node, "height") * scaleY);
|
|
16148
|
+
out.push({
|
|
16149
|
+
left: absLeft,
|
|
16150
|
+
top: absTop,
|
|
16151
|
+
width: w,
|
|
16152
|
+
height: h,
|
|
16153
|
+
hintFill: typeof node.fill === "string" ? node.fill : void 0
|
|
16154
|
+
});
|
|
16155
|
+
}
|
|
16156
|
+
function parseColor$1(c) {
|
|
16157
|
+
if (!c) return null;
|
|
16158
|
+
const s = c.trim();
|
|
16159
|
+
const hex = s.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);
|
|
16160
|
+
if (hex) {
|
|
16161
|
+
let h = hex[1];
|
|
16162
|
+
if (h.length === 3) h = h.split("").map((x) => x + x).join("");
|
|
16163
|
+
return {
|
|
16164
|
+
r: parseInt(h.slice(0, 2), 16),
|
|
16165
|
+
g: parseInt(h.slice(2, 4), 16),
|
|
16166
|
+
b: parseInt(h.slice(4, 6), 16)
|
|
16167
|
+
};
|
|
16168
|
+
}
|
|
16169
|
+
const rgb = s.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
|
|
16170
|
+
if (rgb) return { r: +rgb[1], g: +rgb[2], b: +rgb[3] };
|
|
16171
|
+
return null;
|
|
16172
|
+
}
|
|
16173
|
+
function buildOverlay(b, idx) {
|
|
16174
|
+
const c = parseColor$1(b.hintFill);
|
|
16175
|
+
const lum = c ? (0.299 * c.r + 0.587 * c.g + 0.114 * c.b) / 255 : 0.2;
|
|
16176
|
+
const isLightGlass = lum < 0.5;
|
|
16177
|
+
const baseFill = isLightGlass ? "rgba(245,245,245,0.68)" : "rgba(30,30,30,0.62)";
|
|
16178
|
+
return {
|
|
16179
|
+
id: `${OVERLAY_ID_PREFIX}${idx}`,
|
|
16180
|
+
type: "shape",
|
|
16181
|
+
shapeType: "rounded-rect",
|
|
16182
|
+
left: b.left,
|
|
16183
|
+
top: b.top,
|
|
16184
|
+
width: b.width,
|
|
16185
|
+
height: b.height,
|
|
16186
|
+
cornerRadius: 0,
|
|
16187
|
+
fill: baseFill,
|
|
16188
|
+
stroke: "transparent",
|
|
16189
|
+
strokeWidth: 0,
|
|
16190
|
+
opacity: 1,
|
|
16191
|
+
selectable: false,
|
|
16192
|
+
locked: true,
|
|
16193
|
+
visible: true,
|
|
16194
|
+
scaleX: 1,
|
|
16195
|
+
scaleY: 1
|
|
16196
|
+
};
|
|
16197
|
+
}
|
|
16198
|
+
function injectPreviewBlur(config, options) {
|
|
16199
|
+
const cloned = typeof structuredClone === "function" ? structuredClone(config) : JSON.parse(JSON.stringify(config));
|
|
16200
|
+
const extraBase = (options == null ? void 0 : options.extraElementBaseIds) && options.extraElementBaseIds.size > 0 ? options.extraElementBaseIds : void 0;
|
|
16201
|
+
const extraExact = (options == null ? void 0 : options.extraElementExactIds) && options.extraElementExactIds.size > 0 ? options.extraElementExactIds : void 0;
|
|
16202
|
+
let idx = 0;
|
|
16203
|
+
for (const page of cloned.pages || []) {
|
|
16204
|
+
const children = page.children || page.elements;
|
|
16205
|
+
if (!Array.isArray(children)) continue;
|
|
16206
|
+
const overlays = [];
|
|
16207
|
+
for (const child of children) {
|
|
16208
|
+
collectOverlays(child, 0, 0, false, extraBase, extraExact, overlays);
|
|
16209
|
+
}
|
|
16210
|
+
if (overlays.length === 0) continue;
|
|
16211
|
+
for (const b of overlays) {
|
|
16212
|
+
children.push(buildOverlay(b, idx++));
|
|
16213
|
+
}
|
|
16214
|
+
}
|
|
16215
|
+
return cloned;
|
|
16216
|
+
}
|
|
16217
|
+
function hasAnyPreviewBlur(config) {
|
|
16218
|
+
function walk(node) {
|
|
16219
|
+
if (!node || typeof node !== "object") return false;
|
|
16220
|
+
if (node.previewBlur === true) return true;
|
|
16221
|
+
const children = node.children || node.elements;
|
|
16222
|
+
if (Array.isArray(children)) {
|
|
16223
|
+
for (const c of children) if (walk(c)) return true;
|
|
16224
|
+
}
|
|
16225
|
+
return false;
|
|
16226
|
+
}
|
|
16227
|
+
for (const page of config.pages || []) if (walk(page)) return true;
|
|
16228
|
+
return false;
|
|
16229
|
+
}
|
|
16118
16230
|
function stripFieldPrefix(s) {
|
|
16119
16231
|
return s.startsWith("field_") ? s.slice("field_".length) : s;
|
|
16120
16232
|
}
|
|
16121
|
-
function
|
|
16233
|
+
function addAllToSet(val, out) {
|
|
16122
16234
|
if (!val) return false;
|
|
16123
16235
|
if (Array.isArray(val)) {
|
|
16124
16236
|
for (const v of val) out.add(v);
|
|
@@ -16127,6 +16239,23 @@ function addAll(val, out) {
|
|
|
16127
16239
|
out.add(val);
|
|
16128
16240
|
return true;
|
|
16129
16241
|
}
|
|
16242
|
+
function collectPageTreeElementIds(config, pageIndex = "all") {
|
|
16243
|
+
const out = /* @__PURE__ */ new Set();
|
|
16244
|
+
const pages = config == null ? void 0 : config.pages;
|
|
16245
|
+
if (!Array.isArray(pages)) return out;
|
|
16246
|
+
const targets = pageIndex === "all" ? pages : pages[pageIndex] != null ? [pages[pageIndex]] : [];
|
|
16247
|
+
const walk = (node) => {
|
|
16248
|
+
if (!node || typeof node !== "object") return;
|
|
16249
|
+
if (typeof node.id === "string") out.add(node.id);
|
|
16250
|
+
const children = node.children || node.elements;
|
|
16251
|
+
if (Array.isArray(children)) for (const c of children) walk(c);
|
|
16252
|
+
};
|
|
16253
|
+
for (const page of targets) {
|
|
16254
|
+
const children = (page == null ? void 0 : page.children) || (page == null ? void 0 : page.elements);
|
|
16255
|
+
if (Array.isArray(children)) for (const c of children) walk(c);
|
|
16256
|
+
}
|
|
16257
|
+
return out;
|
|
16258
|
+
}
|
|
16130
16259
|
function resolveBlurElementExactIdsFromFlatFormKeys(config, flatFormKeys, options) {
|
|
16131
16260
|
const cloneIdMap = (config == null ? void 0 : config.__cloneIdMap) || {};
|
|
16132
16261
|
if (!cloneIdMap || typeof cloneIdMap !== "object") return [];
|
|
@@ -16147,12 +16276,67 @@ function resolveBlurElementExactIdsFromFlatFormKeys(config, flatFormKeys, option
|
|
|
16147
16276
|
}
|
|
16148
16277
|
for (const k of candidates) {
|
|
16149
16278
|
if (k in cloneIdMap) {
|
|
16150
|
-
if (
|
|
16279
|
+
if (addAllToSet(cloneIdMap[k], out)) break;
|
|
16151
16280
|
}
|
|
16152
16281
|
}
|
|
16153
16282
|
}
|
|
16154
|
-
|
|
16283
|
+
if (out.size === 0) return [];
|
|
16284
|
+
if (options == null ? void 0 : options.skipTreeVerification) return Array.from(out);
|
|
16285
|
+
const treeIds = collectPageTreeElementIds(
|
|
16286
|
+
config,
|
|
16287
|
+
(options == null ? void 0 : options.pageIndex) ?? "all"
|
|
16288
|
+
);
|
|
16289
|
+
if (treeIds.size === 0) return Array.from(out);
|
|
16290
|
+
const verified = [];
|
|
16291
|
+
for (const id of out) if (treeIds.has(id)) verified.push(id);
|
|
16292
|
+
return verified;
|
|
16293
|
+
}
|
|
16294
|
+
function buildTeaserBlurFlatKeys(sectionState, sections, options) {
|
|
16295
|
+
const afterRow = Math.max(0, options.afterRow | 0);
|
|
16296
|
+
const bindings = options.bindings ?? "value";
|
|
16297
|
+
const out = [];
|
|
16298
|
+
if (!sectionState || !Array.isArray(sections)) return out;
|
|
16299
|
+
const repeatables = sections.filter((s) => (s == null ? void 0 : s.type) === "repeatable");
|
|
16300
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
16301
|
+
for (const r of repeatables) {
|
|
16302
|
+
if (!r.parentId) continue;
|
|
16303
|
+
const arr = childrenByParent.get(r.parentId) || [];
|
|
16304
|
+
arr.push(r);
|
|
16305
|
+
childrenByParent.set(r.parentId, arr);
|
|
16306
|
+
}
|
|
16307
|
+
const emitForEntryFields = (section, keyPrefix, entryIdx1) => {
|
|
16308
|
+
const fields = section.entryFields || [];
|
|
16309
|
+
for (const f of fields) {
|
|
16310
|
+
if (!(f == null ? void 0 : f.key)) continue;
|
|
16311
|
+
if (bindings === "value" && f.key !== "value") continue;
|
|
16312
|
+
out.push(`${keyPrefix}_${f.key}`);
|
|
16313
|
+
}
|
|
16314
|
+
};
|
|
16315
|
+
const walkRepeatable = (section, parentKeyPrefix) => {
|
|
16316
|
+
const entries = sectionState == null ? void 0 : sectionState[section.id];
|
|
16317
|
+
if (!Array.isArray(entries)) return;
|
|
16318
|
+
for (let i = 0; i < entries.length; i++) {
|
|
16319
|
+
const entryIdx1 = i + 1;
|
|
16320
|
+
const isBlurred = entryIdx1 > afterRow;
|
|
16321
|
+
const keyPrefix = parentKeyPrefix ? `${parentKeyPrefix}_field_${section.id}_${entryIdx1}` : `field_${section.id}_${entryIdx1}`;
|
|
16322
|
+
if (isBlurred) emitForEntryFields(section, keyPrefix);
|
|
16323
|
+
const children = childrenByParent.get(section.id) || [];
|
|
16324
|
+
for (const child of children) walkRepeatable(child, keyPrefix);
|
|
16325
|
+
}
|
|
16326
|
+
};
|
|
16327
|
+
for (const r of repeatables) {
|
|
16328
|
+
if (r.parentId) continue;
|
|
16329
|
+
walkRepeatable(r, "");
|
|
16330
|
+
}
|
|
16331
|
+
return out;
|
|
16155
16332
|
}
|
|
16333
|
+
const previewBlur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
16334
|
+
__proto__: null,
|
|
16335
|
+
buildTeaserBlurFlatKeys,
|
|
16336
|
+
hasAnyPreviewBlur,
|
|
16337
|
+
injectPreviewBlur,
|
|
16338
|
+
resolveBlurElementExactIdsFromFlatFormKeys
|
|
16339
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
16156
16340
|
const PREVIEW_DEBUG_PREFIX = "[canvas-renderer][preview-debug]";
|
|
16157
16341
|
function computeFontSignature(config) {
|
|
16158
16342
|
var _a;
|
|
@@ -16633,9 +16817,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
16633
16817
|
}
|
|
16634
16818
|
return svgString;
|
|
16635
16819
|
}
|
|
16636
|
-
const resolvedPackageVersion = "0.5.
|
|
16820
|
+
const resolvedPackageVersion = "0.5.189";
|
|
16637
16821
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
16638
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
16822
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.189";
|
|
16639
16823
|
const roundParityValue = (value) => {
|
|
16640
16824
|
if (typeof value !== "number") return value;
|
|
16641
16825
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -17143,7 +17327,7 @@ class PixldocsRenderer {
|
|
|
17143
17327
|
await this.waitForCanvasScene(container, cloned, i);
|
|
17144
17328
|
}
|
|
17145
17329
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
17146
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
17330
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Ch-qwcNJ.js");
|
|
17147
17331
|
const prepared = preparePagesForExport(
|
|
17148
17332
|
cloned.pages,
|
|
17149
17333
|
canvasWidth,
|
|
@@ -17985,7 +18169,7 @@ function collectFontSpecsFromMarkup(markup) {
|
|
|
17985
18169
|
}
|
|
17986
18170
|
return Array.from(specs);
|
|
17987
18171
|
}
|
|
17988
|
-
function parseColor
|
|
18172
|
+
function parseColor(color) {
|
|
17989
18173
|
if (!color) return null;
|
|
17990
18174
|
const raw = color.trim().toLowerCase();
|
|
17991
18175
|
if (!raw || raw === "transparent" || raw === "none") return null;
|
|
@@ -18538,7 +18722,7 @@ function stripSuspiciousFullPageOverlayNodes(svg) {
|
|
|
18538
18722
|
if (!(pageWidth > 0 && pageHeight > 0)) return;
|
|
18539
18723
|
const isNear = (a, b, tolerance = 0.75) => Math.abs(a - b) <= tolerance;
|
|
18540
18724
|
const isDarkPaint = (value) => {
|
|
18541
|
-
const rgb = value ? parseColor
|
|
18725
|
+
const rgb = value ? parseColor(value) : null;
|
|
18542
18726
|
return rgb ? rgb.r <= 32 && rgb.g <= 32 && rgb.b <= 32 : false;
|
|
18543
18727
|
};
|
|
18544
18728
|
const removeIfSuspicious = (el) => {
|
|
@@ -18651,13 +18835,13 @@ function inlineComputedStyles(svg) {
|
|
|
18651
18835
|
const fill = cs.fill;
|
|
18652
18836
|
const stroke = cs.stroke;
|
|
18653
18837
|
if (fill && fill !== "none" && fill !== "rgba(0, 0, 0, 0)") {
|
|
18654
|
-
const parsed = parseColor
|
|
18838
|
+
const parsed = parseColor(fill);
|
|
18655
18839
|
if (parsed) el.setAttribute("fill", rgbToHex(parsed.r, parsed.g, parsed.b));
|
|
18656
18840
|
} else if (fill === "rgba(0, 0, 0, 0)" || fill === "transparent") {
|
|
18657
18841
|
el.setAttribute("fill", "none");
|
|
18658
18842
|
}
|
|
18659
18843
|
if (stroke && stroke !== "none" && stroke !== "rgba(0, 0, 0, 0)") {
|
|
18660
|
-
const parsed = parseColor
|
|
18844
|
+
const parsed = parseColor(stroke);
|
|
18661
18845
|
if (parsed) el.setAttribute("stroke", rgbToHex(parsed.r, parsed.g, parsed.b));
|
|
18662
18846
|
}
|
|
18663
18847
|
}
|
|
@@ -18805,7 +18989,7 @@ function setPdfColorFromSvg(pdf, svg, _elementId) {
|
|
|
18805
18989
|
const { fill, stroke } = getFirstExplicitColorFromSvg(svg);
|
|
18806
18990
|
const setColor = (hex, setter) => {
|
|
18807
18991
|
if (!hex) return;
|
|
18808
|
-
const c = parseColor
|
|
18992
|
+
const c = parseColor(hex);
|
|
18809
18993
|
if (c) pdf[setter](c.r, c.g, c.b);
|
|
18810
18994
|
};
|
|
18811
18995
|
setColor(fill, "setFillColor");
|
|
@@ -19288,7 +19472,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
19288
19472
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
19289
19473
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
19290
19474
|
try {
|
|
19291
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
19475
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Ch-qwcNJ.js");
|
|
19292
19476
|
try {
|
|
19293
19477
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
19294
19478
|
} catch {
|
|
@@ -19308,7 +19492,7 @@ function drawPageBackground(pdf, pageIndex, pageWidth, pageHeight, backgroundCol
|
|
|
19308
19492
|
if (backgroundGradient && ((_a = backgroundGradient.stops) == null ? void 0 : _a.length) >= 2) {
|
|
19309
19493
|
const grad = backgroundGradient;
|
|
19310
19494
|
const colorStops = grad.stops.map((s) => {
|
|
19311
|
-
const c = parseColor
|
|
19495
|
+
const c = parseColor(s.color);
|
|
19312
19496
|
return {
|
|
19313
19497
|
offset: Math.max(0, Math.min(1, Number(s.offset))),
|
|
19314
19498
|
color: c ? [c.r, c.g, c.b] : [0, 0, 0]
|
|
@@ -19364,7 +19548,7 @@ function drawPageBackground(pdf, pageIndex, pageWidth, pageHeight, backgroundCol
|
|
|
19364
19548
|
pdf.rect(0, 0, pageWidth, pageHeight, "F");
|
|
19365
19549
|
}
|
|
19366
19550
|
} else {
|
|
19367
|
-
const bgColor = parseColor
|
|
19551
|
+
const bgColor = parseColor(backgroundColor && backgroundColor !== "transparent" ? backgroundColor : "#ffffff");
|
|
19368
19552
|
if (bgColor) {
|
|
19369
19553
|
pdf.setFillColor(bgColor.r, bgColor.g, bgColor.b);
|
|
19370
19554
|
pdf.rect(0, 0, pageWidth, pageHeight, "F");
|
|
@@ -19487,123 +19671,6 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
|
|
|
19487
19671
|
pages: svgResults.map((p) => ({ width: p.width, height: p.height }))
|
|
19488
19672
|
};
|
|
19489
19673
|
}
|
|
19490
|
-
const OVERLAY_ID_PREFIX = "__pb_";
|
|
19491
|
-
function getNumber(v, fallback = 0) {
|
|
19492
|
-
return typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
19493
|
-
}
|
|
19494
|
-
function resolveSize(node, key) {
|
|
19495
|
-
const v = node == null ? void 0 : node[key];
|
|
19496
|
-
if (typeof v === "number" && Number.isFinite(v)) return v;
|
|
19497
|
-
return 0;
|
|
19498
|
-
}
|
|
19499
|
-
function collectOverlays(node, parentLeft, parentTop, inheritedBlur, extraBaseIds, extraExactIds, out) {
|
|
19500
|
-
if (!node || typeof node !== "object") return;
|
|
19501
|
-
const matchesBase = !!(extraBaseIds && typeof node.id === "string" && extraBaseIds.has(baseId(node.id)));
|
|
19502
|
-
const matchesExact = !!(extraExactIds && typeof node.id === "string" && extraExactIds.has(node.id));
|
|
19503
|
-
const isBlurred = inheritedBlur || node.previewBlur === true || matchesBase || matchesExact;
|
|
19504
|
-
const absLeft = parentLeft + getNumber(node.left, 0);
|
|
19505
|
-
const absTop = parentTop + getNumber(node.top, 0);
|
|
19506
|
-
if (node.type === "group") {
|
|
19507
|
-
const children = node.children || node.elements;
|
|
19508
|
-
if (Array.isArray(children)) {
|
|
19509
|
-
for (const child of children) {
|
|
19510
|
-
collectOverlays(child, absLeft, absTop, isBlurred, extraBaseIds, extraExactIds, out);
|
|
19511
|
-
}
|
|
19512
|
-
}
|
|
19513
|
-
return;
|
|
19514
|
-
}
|
|
19515
|
-
if (!isBlurred) return;
|
|
19516
|
-
const scaleX = getNumber(node.scaleX, 1) || 1;
|
|
19517
|
-
const scaleY = getNumber(node.scaleY, 1) || 1;
|
|
19518
|
-
const w = Math.max(4, resolveSize(node, "width") * scaleX);
|
|
19519
|
-
const h = Math.max(4, resolveSize(node, "height") * scaleY);
|
|
19520
|
-
out.push({
|
|
19521
|
-
left: absLeft,
|
|
19522
|
-
top: absTop,
|
|
19523
|
-
width: w,
|
|
19524
|
-
height: h,
|
|
19525
|
-
hintFill: typeof node.fill === "string" ? node.fill : void 0
|
|
19526
|
-
});
|
|
19527
|
-
}
|
|
19528
|
-
function parseColor(c) {
|
|
19529
|
-
if (!c) return null;
|
|
19530
|
-
const s = c.trim();
|
|
19531
|
-
const hex = s.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);
|
|
19532
|
-
if (hex) {
|
|
19533
|
-
let h = hex[1];
|
|
19534
|
-
if (h.length === 3) h = h.split("").map((x) => x + x).join("");
|
|
19535
|
-
return {
|
|
19536
|
-
r: parseInt(h.slice(0, 2), 16),
|
|
19537
|
-
g: parseInt(h.slice(2, 4), 16),
|
|
19538
|
-
b: parseInt(h.slice(4, 6), 16)
|
|
19539
|
-
};
|
|
19540
|
-
}
|
|
19541
|
-
const rgb = s.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
|
|
19542
|
-
if (rgb) return { r: +rgb[1], g: +rgb[2], b: +rgb[3] };
|
|
19543
|
-
return null;
|
|
19544
|
-
}
|
|
19545
|
-
function buildOverlay(b, idx) {
|
|
19546
|
-
const c = parseColor(b.hintFill);
|
|
19547
|
-
const lum = c ? (0.299 * c.r + 0.587 * c.g + 0.114 * c.b) / 255 : 0.2;
|
|
19548
|
-
const isLightGlass = lum < 0.5;
|
|
19549
|
-
const baseFill = isLightGlass ? "rgba(245,245,245,0.68)" : "rgba(30,30,30,0.62)";
|
|
19550
|
-
return {
|
|
19551
|
-
id: `${OVERLAY_ID_PREFIX}${idx}`,
|
|
19552
|
-
type: "shape",
|
|
19553
|
-
shapeType: "rounded-rect",
|
|
19554
|
-
left: b.left,
|
|
19555
|
-
top: b.top,
|
|
19556
|
-
width: b.width,
|
|
19557
|
-
height: b.height,
|
|
19558
|
-
cornerRadius: 0,
|
|
19559
|
-
fill: baseFill,
|
|
19560
|
-
stroke: "transparent",
|
|
19561
|
-
strokeWidth: 0,
|
|
19562
|
-
opacity: 1,
|
|
19563
|
-
selectable: false,
|
|
19564
|
-
locked: true,
|
|
19565
|
-
visible: true,
|
|
19566
|
-
scaleX: 1,
|
|
19567
|
-
scaleY: 1
|
|
19568
|
-
};
|
|
19569
|
-
}
|
|
19570
|
-
function injectPreviewBlur(config, options) {
|
|
19571
|
-
const cloned = typeof structuredClone === "function" ? structuredClone(config) : JSON.parse(JSON.stringify(config));
|
|
19572
|
-
const extraBase = (options == null ? void 0 : options.extraElementBaseIds) && options.extraElementBaseIds.size > 0 ? options.extraElementBaseIds : void 0;
|
|
19573
|
-
const extraExact = (options == null ? void 0 : options.extraElementExactIds) && options.extraElementExactIds.size > 0 ? options.extraElementExactIds : void 0;
|
|
19574
|
-
let idx = 0;
|
|
19575
|
-
for (const page of cloned.pages || []) {
|
|
19576
|
-
const children = page.children || page.elements;
|
|
19577
|
-
if (!Array.isArray(children)) continue;
|
|
19578
|
-
const overlays = [];
|
|
19579
|
-
for (const child of children) {
|
|
19580
|
-
collectOverlays(child, 0, 0, false, extraBase, extraExact, overlays);
|
|
19581
|
-
}
|
|
19582
|
-
if (overlays.length === 0) continue;
|
|
19583
|
-
for (const b of overlays) {
|
|
19584
|
-
children.push(buildOverlay(b, idx++));
|
|
19585
|
-
}
|
|
19586
|
-
}
|
|
19587
|
-
return cloned;
|
|
19588
|
-
}
|
|
19589
|
-
function hasAnyPreviewBlur(config) {
|
|
19590
|
-
function walk(node) {
|
|
19591
|
-
if (!node || typeof node !== "object") return false;
|
|
19592
|
-
if (node.previewBlur === true) return true;
|
|
19593
|
-
const children = node.children || node.elements;
|
|
19594
|
-
if (Array.isArray(children)) {
|
|
19595
|
-
for (const c of children) if (walk(c)) return true;
|
|
19596
|
-
}
|
|
19597
|
-
return false;
|
|
19598
|
-
}
|
|
19599
|
-
for (const page of config.pages || []) if (walk(page)) return true;
|
|
19600
|
-
return false;
|
|
19601
|
-
}
|
|
19602
|
-
const previewBlur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
19603
|
-
__proto__: null,
|
|
19604
|
-
hasAnyPreviewBlur,
|
|
19605
|
-
injectPreviewBlur
|
|
19606
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
19607
19674
|
const SELECT_COLUMNS = "id,name,description,category,thumbnail_url,preview_images,price,download_count,workspace_id,sort_order,created_at,updated_at";
|
|
19608
19675
|
async function listPublishedTemplates(options) {
|
|
19609
19676
|
const { workspaceId, supabaseUrl, supabaseAnonKey, category, limit = 200, offset = 0 } = options;
|
|
@@ -19743,41 +19810,42 @@ function setAutoShrinkDebug(enabled) {
|
|
|
19743
19810
|
}
|
|
19744
19811
|
}
|
|
19745
19812
|
export {
|
|
19746
|
-
|
|
19813
|
+
resolveFromForm as $,
|
|
19747
19814
|
API_URL as A,
|
|
19748
|
-
|
|
19749
|
-
|
|
19815
|
+
collectFontsFromConfig as B,
|
|
19816
|
+
collectImageUrls as C,
|
|
19750
19817
|
DEPLOYMENT_VERSION_MARKER as D,
|
|
19751
|
-
|
|
19818
|
+
configHasAutoShrinkText$1 as E,
|
|
19752
19819
|
FONT_FALLBACK_DEVANAGARI as F,
|
|
19753
|
-
|
|
19754
|
-
|
|
19755
|
-
|
|
19756
|
-
|
|
19757
|
-
|
|
19758
|
-
|
|
19759
|
-
|
|
19760
|
-
|
|
19761
|
-
|
|
19820
|
+
dumpSvgTextDiagnostics as G,
|
|
19821
|
+
embedFont as H,
|
|
19822
|
+
embedFontsForConfig as I,
|
|
19823
|
+
embedFontsInPdf as J,
|
|
19824
|
+
ensureFontsForResolvedConfig as K,
|
|
19825
|
+
extractFontFamiliesFromSvgs as L,
|
|
19826
|
+
getEmbeddedJsPDFFontName as M,
|
|
19827
|
+
getPublishedTemplate as N,
|
|
19828
|
+
getTemplateForm as O,
|
|
19762
19829
|
PACKAGE_VERSION as P,
|
|
19763
|
-
|
|
19764
|
-
|
|
19765
|
-
|
|
19830
|
+
hasAnyPreviewBlur as Q,
|
|
19831
|
+
injectPreviewBlur as R,
|
|
19832
|
+
isBundledAssetUrl as S,
|
|
19766
19833
|
TRIANGLE_STROKE_MITER_LIMIT as T,
|
|
19767
|
-
|
|
19768
|
-
|
|
19769
|
-
|
|
19770
|
-
|
|
19771
|
-
|
|
19772
|
-
|
|
19773
|
-
|
|
19834
|
+
isFontAvailable as U,
|
|
19835
|
+
isPrivateUrl as V,
|
|
19836
|
+
listPublishedTemplates as W,
|
|
19837
|
+
loadGoogleFontCSS as X,
|
|
19838
|
+
normalizeFontFamily as Y,
|
|
19839
|
+
resolveBlurElementExactIdsFromFlatFormKeys as Z,
|
|
19840
|
+
resolveFontWeight as _,
|
|
19774
19841
|
getAbsoluteBounds as a,
|
|
19775
|
-
|
|
19776
|
-
|
|
19777
|
-
|
|
19778
|
-
|
|
19779
|
-
|
|
19780
|
-
|
|
19842
|
+
resolveTemplateData as a0,
|
|
19843
|
+
rewriteSvgFontsForJsPDF as a1,
|
|
19844
|
+
setAutoShrinkDebug as a2,
|
|
19845
|
+
setBundledAssetPrefixes as a3,
|
|
19846
|
+
warmResolvedTemplateForPreview as a4,
|
|
19847
|
+
warmTemplateFromForm as a5,
|
|
19848
|
+
canvasImageLoader as a6,
|
|
19781
19849
|
getProxiedImageUrl as b,
|
|
19782
19850
|
captureFabricCanvasSvgForPdf as c,
|
|
19783
19851
|
bakeEdgeFade as d,
|
|
@@ -19801,7 +19869,7 @@ export {
|
|
|
19801
19869
|
applyThemeToConfig as v,
|
|
19802
19870
|
assemblePdfFromSvgs as w,
|
|
19803
19871
|
awaitFontsForConfig as x,
|
|
19804
|
-
|
|
19805
|
-
|
|
19872
|
+
buildTeaserBlurFlatKeys as y,
|
|
19873
|
+
collectFontDescriptorsFromConfig as z
|
|
19806
19874
|
};
|
|
19807
|
-
//# sourceMappingURL=index-
|
|
19875
|
+
//# sourceMappingURL=index-lQXXPpb8.js.map
|