@pixldocs/canvas-renderer 0.5.468 → 0.5.470
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-CGFOtPDx.js → index-DqhyGc11.js} +44 -31
- package/dist/index-DqhyGc11.js.map +1 -0
- package/dist/{index-DoJk8IkH.cjs → index-M7J0Ghjm.cjs} +44 -31
- package/dist/index-M7J0Ghjm.cjs.map +1 -0
- 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-CV7d-_nM.js} +4 -4
- package/dist/{vectorPdfExport-C7FmPpVD.js.map → vectorPdfExport-CV7d-_nM.js.map} +1 -1
- package/dist/{vectorPdfExport-CsY4HpZu.cjs → vectorPdfExport-CimJkQAX.cjs} +4 -4
- package/dist/{vectorPdfExport-CsY4HpZu.cjs.map → vectorPdfExport-CimJkQAX.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CGFOtPDx.js.map +0 -1
- package/dist/index-DoJk8IkH.cjs.map +0 -1
|
@@ -12299,7 +12299,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12299
12299
|
if (id && id !== "__background__") {
|
|
12300
12300
|
const width = (obj.width ?? 0) * (obj.scaleX ?? 1);
|
|
12301
12301
|
const height = (obj.height ?? 0) * (obj.scaleY ?? 1);
|
|
12302
|
-
const angle = obj.angle ?? 0;
|
|
12302
|
+
const angle = typeof obj.getTotalAngle === "function" ? obj.getTotalAngle() ?? 0 : obj.angle ?? 0;
|
|
12303
12303
|
let left;
|
|
12304
12304
|
let top;
|
|
12305
12305
|
const centerFn = obj.getCenterPoint;
|
|
@@ -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;
|
|
@@ -20465,7 +20474,7 @@ function PreviewCanvas({
|
|
|
20465
20474
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20466
20475
|
"div",
|
|
20467
20476
|
{
|
|
20468
|
-
className: "absolute cursor-pointer
|
|
20477
|
+
className: "absolute cursor-pointer",
|
|
20469
20478
|
style: {
|
|
20470
20479
|
left,
|
|
20471
20480
|
top,
|
|
@@ -20475,23 +20484,27 @@ function PreviewCanvas({
|
|
|
20475
20484
|
backgroundColor: isHovered ? "rgba(59, 130, 246, 0.1)" : "transparent",
|
|
20476
20485
|
borderRadius: 4,
|
|
20477
20486
|
pointerEvents: "auto",
|
|
20478
|
-
transform: (bounds == null ? void 0 : bounds.angle)
|
|
20479
|
-
transformOrigin:
|
|
20487
|
+
transform: `rotate(${(bounds == null ? void 0 : bounds.angle) ?? 0}deg)`,
|
|
20488
|
+
transformOrigin: `${width / 2}px ${height / 2}px`,
|
|
20489
|
+
willChange: "transform"
|
|
20480
20490
|
},
|
|
20481
20491
|
onMouseEnter: () => setHoveredFieldId(element.id),
|
|
20482
20492
|
onMouseLeave: () => setHoveredFieldId(null),
|
|
20483
20493
|
onClick: () => {
|
|
20484
|
-
const
|
|
20485
|
-
if (
|
|
20486
|
-
onDynamicFieldClick(element.id,
|
|
20494
|
+
const infos = elementToFieldMap.get(element.id);
|
|
20495
|
+
if (infos && infos.length && onDynamicFieldClick) {
|
|
20496
|
+
onDynamicFieldClick(element.id, infos.map((i) => i.fieldId));
|
|
20487
20497
|
}
|
|
20488
20498
|
},
|
|
20489
|
-
children: isHovered && /* @__PURE__ */ jsxRuntime.
|
|
20499
|
+
children: isHovered && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20490
20500
|
"div",
|
|
20491
20501
|
{
|
|
20492
20502
|
className: "absolute -top-6 left-0 bg-primary text-primary-foreground text-xs px-2 py-0.5 rounded shadow-sm whitespace-nowrap",
|
|
20493
20503
|
style: { fontSize: 10 },
|
|
20494
|
-
children:
|
|
20504
|
+
children: [
|
|
20505
|
+
label,
|
|
20506
|
+
extraCount > 0 ? ` +${extraCount} more` : ""
|
|
20507
|
+
]
|
|
20495
20508
|
}
|
|
20496
20509
|
)
|
|
20497
20510
|
},
|
|
@@ -26313,9 +26326,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26313
26326
|
}
|
|
26314
26327
|
return svgString;
|
|
26315
26328
|
}
|
|
26316
|
-
const resolvedPackageVersion = "0.5.
|
|
26329
|
+
const resolvedPackageVersion = "0.5.470";
|
|
26317
26330
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26318
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26331
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.470";
|
|
26319
26332
|
const roundParityValue = (value) => {
|
|
26320
26333
|
if (typeof value !== "number") return value;
|
|
26321
26334
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27129,7 +27142,7 @@ class PixldocsRenderer {
|
|
|
27129
27142
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27130
27143
|
}
|
|
27131
27144
|
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-
|
|
27145
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CimJkQAX.cjs"));
|
|
27133
27146
|
const prepared = preparePagesForExport(
|
|
27134
27147
|
cloned.pages,
|
|
27135
27148
|
canvasWidth,
|
|
@@ -29449,7 +29462,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29449
29462
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29450
29463
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29451
29464
|
try {
|
|
29452
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
29465
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CimJkQAX.cjs"));
|
|
29453
29466
|
try {
|
|
29454
29467
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29455
29468
|
} catch {
|
|
@@ -29763,4 +29776,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29763
29776
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29764
29777
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29765
29778
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29766
|
-
//# sourceMappingURL=index-
|
|
29779
|
+
//# sourceMappingURL=index-M7J0Ghjm.cjs.map
|