@pixldocs/canvas-renderer 0.5.468 → 0.5.469
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-DoJk8IkH.cjs → index-C4lq9hLY.cjs} +39 -27
- package/dist/{index-DoJk8IkH.cjs.map → index-C4lq9hLY.cjs.map} +1 -1
- package/dist/{index-CGFOtPDx.js → index-P777JY1z.js} +39 -27
- package/dist/{index-CGFOtPDx.js.map → index-P777JY1z.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-C7FmPpVD.js → vectorPdfExport-CKIO3hJy.js} +4 -4
- package/dist/{vectorPdfExport-C7FmPpVD.js.map → vectorPdfExport-CKIO3hJy.js.map} +1 -1
- package/dist/{vectorPdfExport-CsY4HpZu.cjs → vectorPdfExport-CUb2Bf6z.cjs} +4 -4
- package/dist/{vectorPdfExport-CsY4HpZu.cjs.map → vectorPdfExport-CUb2Bf6z.cjs.map} +1 -1
- package/package.json +1 -1
|
@@ -20249,27 +20249,32 @@ PageCanvas.displayName = "PageCanvas";
|
|
|
20249
20249
|
function buildElementToFieldMap(dynamicFields) {
|
|
20250
20250
|
const map = /* @__PURE__ */ new Map();
|
|
20251
20251
|
if (!dynamicFields) return map;
|
|
20252
|
-
|
|
20252
|
+
const ordered = dynamicFields.map((f, idx) => ({ f, idx })).sort((a, b) => {
|
|
20253
|
+
const ao = a.f.order ?? Number.POSITIVE_INFINITY;
|
|
20254
|
+
const bo = b.f.order ?? Number.POSITIVE_INFINITY;
|
|
20255
|
+
if (ao !== bo) return ao - bo;
|
|
20256
|
+
return a.idx - b.idx;
|
|
20257
|
+
});
|
|
20258
|
+
const push = (elementId, info) => {
|
|
20259
|
+
const list = map.get(elementId);
|
|
20260
|
+
if (list) list.push(info);
|
|
20261
|
+
else map.set(elementId, [info]);
|
|
20262
|
+
};
|
|
20263
|
+
ordered.forEach(({ f: field }, formIndex) => {
|
|
20253
20264
|
if (field.mappings && Array.isArray(field.mappings)) {
|
|
20254
20265
|
for (const mapping of field.mappings) {
|
|
20255
20266
|
if (mapping.elementId) {
|
|
20256
|
-
|
|
20257
|
-
fieldId: field.id,
|
|
20258
|
-
label: field.label
|
|
20259
|
-
});
|
|
20267
|
+
push(mapping.elementId, { fieldId: field.id, label: field.label, formIndex });
|
|
20260
20268
|
}
|
|
20261
20269
|
}
|
|
20262
20270
|
} else if (field.elementIds && Array.isArray(field.elementIds)) {
|
|
20263
20271
|
for (const elementId of field.elementIds) {
|
|
20264
20272
|
if (elementId) {
|
|
20265
|
-
|
|
20266
|
-
fieldId: field.id,
|
|
20267
|
-
label: field.label
|
|
20268
|
-
});
|
|
20273
|
+
push(elementId, { fieldId: field.id, label: field.label, formIndex });
|
|
20269
20274
|
}
|
|
20270
20275
|
}
|
|
20271
20276
|
}
|
|
20272
|
-
}
|
|
20277
|
+
});
|
|
20273
20278
|
return map;
|
|
20274
20279
|
}
|
|
20275
20280
|
function PreviewCanvas({
|
|
@@ -20360,9 +20365,9 @@ function PreviewCanvas({
|
|
|
20360
20365
|
};
|
|
20361
20366
|
}, [config.themeConfig]);
|
|
20362
20367
|
const handleDynamicFieldClick = react.useCallback((elementId) => {
|
|
20363
|
-
const
|
|
20364
|
-
if (
|
|
20365
|
-
onDynamicFieldClick(elementId,
|
|
20368
|
+
const infos = elementToFieldMap.get(elementId);
|
|
20369
|
+
if (infos && infos.length && onDynamicFieldClick) {
|
|
20370
|
+
onDynamicFieldClick(elementId, infos.map((i) => i.fieldId));
|
|
20366
20371
|
}
|
|
20367
20372
|
}, [elementToFieldMap, onDynamicFieldClick]);
|
|
20368
20373
|
const dynamicFieldElements = react.useMemo(() => {
|
|
@@ -20370,10 +20375,14 @@ function PreviewCanvas({
|
|
|
20370
20375
|
const seenIds = /* @__PURE__ */ new Set();
|
|
20371
20376
|
for (const element of elements) {
|
|
20372
20377
|
if (seenIds.has(element.id)) continue;
|
|
20373
|
-
const
|
|
20374
|
-
if (
|
|
20378
|
+
const infos = elementToFieldMap.get(element.id);
|
|
20379
|
+
if (infos && infos.length) {
|
|
20375
20380
|
seenIds.add(element.id);
|
|
20376
|
-
result.push({
|
|
20381
|
+
result.push({
|
|
20382
|
+
element,
|
|
20383
|
+
label: infos[0].label,
|
|
20384
|
+
extraCount: Math.max(0, infos.length - 1)
|
|
20385
|
+
});
|
|
20377
20386
|
}
|
|
20378
20387
|
}
|
|
20379
20388
|
return result;
|
|
@@ -20447,7 +20456,7 @@ function PreviewCanvas({
|
|
|
20447
20456
|
onReady
|
|
20448
20457
|
}
|
|
20449
20458
|
),
|
|
20450
|
-
onDynamicFieldClick && dynamicFieldElements.map(({ element, label }) => {
|
|
20459
|
+
onDynamicFieldClick && dynamicFieldElements.map(({ element, label, extraCount }) => {
|
|
20451
20460
|
const bounds = actualBounds.get(element.id);
|
|
20452
20461
|
const isHovered = hoveredFieldId === element.id;
|
|
20453
20462
|
let left, top, width, height;
|
|
@@ -20481,17 +20490,20 @@ function PreviewCanvas({
|
|
|
20481
20490
|
onMouseEnter: () => setHoveredFieldId(element.id),
|
|
20482
20491
|
onMouseLeave: () => setHoveredFieldId(null),
|
|
20483
20492
|
onClick: () => {
|
|
20484
|
-
const
|
|
20485
|
-
if (
|
|
20486
|
-
onDynamicFieldClick(element.id,
|
|
20493
|
+
const infos = elementToFieldMap.get(element.id);
|
|
20494
|
+
if (infos && infos.length && onDynamicFieldClick) {
|
|
20495
|
+
onDynamicFieldClick(element.id, infos.map((i) => i.fieldId));
|
|
20487
20496
|
}
|
|
20488
20497
|
},
|
|
20489
|
-
children: isHovered && /* @__PURE__ */ jsxRuntime.
|
|
20498
|
+
children: isHovered && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20490
20499
|
"div",
|
|
20491
20500
|
{
|
|
20492
20501
|
className: "absolute -top-6 left-0 bg-primary text-primary-foreground text-xs px-2 py-0.5 rounded shadow-sm whitespace-nowrap",
|
|
20493
20502
|
style: { fontSize: 10 },
|
|
20494
|
-
children:
|
|
20503
|
+
children: [
|
|
20504
|
+
label,
|
|
20505
|
+
extraCount > 0 ? ` +${extraCount} more` : ""
|
|
20506
|
+
]
|
|
20495
20507
|
}
|
|
20496
20508
|
)
|
|
20497
20509
|
},
|
|
@@ -26313,9 +26325,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26313
26325
|
}
|
|
26314
26326
|
return svgString;
|
|
26315
26327
|
}
|
|
26316
|
-
const resolvedPackageVersion = "0.5.
|
|
26328
|
+
const resolvedPackageVersion = "0.5.469";
|
|
26317
26329
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26318
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26330
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.469";
|
|
26319
26331
|
const roundParityValue = (value) => {
|
|
26320
26332
|
if (typeof value !== "number") return value;
|
|
26321
26333
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27129,7 +27141,7 @@ class PixldocsRenderer {
|
|
|
27129
27141
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27130
27142
|
}
|
|
27131
27143
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27132
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27144
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CUb2Bf6z.cjs"));
|
|
27133
27145
|
const prepared = preparePagesForExport(
|
|
27134
27146
|
cloned.pages,
|
|
27135
27147
|
canvasWidth,
|
|
@@ -29449,7 +29461,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29449
29461
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29450
29462
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29451
29463
|
try {
|
|
29452
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
29464
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CUb2Bf6z.cjs"));
|
|
29453
29465
|
try {
|
|
29454
29466
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29455
29467
|
} catch {
|
|
@@ -29763,4 +29775,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29763
29775
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29764
29776
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29765
29777
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29766
|
-
//# sourceMappingURL=index-
|
|
29778
|
+
//# sourceMappingURL=index-C4lq9hLY.cjs.map
|