@pixldocs/canvas-renderer 0.5.472 → 0.5.474
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-Dj1v0e7c.cjs → index-D2hncOO0.cjs} +33 -12
- package/dist/index-D2hncOO0.cjs.map +1 -0
- package/dist/{index-CHObHx1T.js → index-DsthQYTx.js} +33 -12
- package/dist/index-DsthQYTx.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DkOHXPHf.cjs → vectorPdfExport-Cgw2jQ1F.cjs} +4 -4
- package/dist/{vectorPdfExport-DkOHXPHf.cjs.map → vectorPdfExport-Cgw2jQ1F.cjs.map} +1 -1
- package/dist/{vectorPdfExport-Xza25bm4.js → vectorPdfExport-auFctmty.js} +4 -4
- package/dist/{vectorPdfExport-Xza25bm4.js.map → vectorPdfExport-auFctmty.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CHObHx1T.js.map +0 -1
- package/dist/index-Dj1v0e7c.cjs.map +0 -1
|
@@ -8548,6 +8548,25 @@ function buildRoundedRectPath2D(ctx, x, y, w, h, rTL, rTR, rBR, rBL) {
|
|
|
8548
8548
|
if (tl > 0) ctx.quadraticCurveTo(x, y, x + tl, y);
|
|
8549
8549
|
ctx.closePath();
|
|
8550
8550
|
}
|
|
8551
|
+
function buildRoundedRectPath2DObject(x, y, w, h, rTL, rTR, rBR, rBL) {
|
|
8552
|
+
const maxR = Math.min(w, h) / 2;
|
|
8553
|
+
const tl = Math.min(Math.max(0, rTL), maxR);
|
|
8554
|
+
const tr = Math.min(Math.max(0, rTR), maxR);
|
|
8555
|
+
const br = Math.min(Math.max(0, rBR), maxR);
|
|
8556
|
+
const bl = Math.min(Math.max(0, rBL), maxR);
|
|
8557
|
+
const p = new Path2D();
|
|
8558
|
+
p.moveTo(x + tl, y);
|
|
8559
|
+
p.lineTo(x + w - tr, y);
|
|
8560
|
+
if (tr > 0) p.quadraticCurveTo(x + w, y, x + w, y + tr);
|
|
8561
|
+
p.lineTo(x + w, y + h - br);
|
|
8562
|
+
if (br > 0) p.quadraticCurveTo(x + w, y + h, x + w - br, y + h);
|
|
8563
|
+
p.lineTo(x + bl, y + h);
|
|
8564
|
+
if (bl > 0) p.quadraticCurveTo(x, y + h, x, y + h - bl);
|
|
8565
|
+
p.lineTo(x, y + tl);
|
|
8566
|
+
if (tl > 0) p.quadraticCurveTo(x, y, x + tl, y);
|
|
8567
|
+
p.closePath();
|
|
8568
|
+
return p;
|
|
8569
|
+
}
|
|
8551
8570
|
function measureLineGlyphWidth(obj, lineIndex) {
|
|
8552
8571
|
var _a2, _b2, _c2, _d, _e, _f;
|
|
8553
8572
|
try {
|
|
@@ -8735,9 +8754,9 @@ function applyTextBackground(obj, cfg) {
|
|
|
8735
8754
|
ctx.transform(1, shearTransform.slope, 0, 1, 0, shearTransform.dy);
|
|
8736
8755
|
}
|
|
8737
8756
|
const rects = bgRectsForFill;
|
|
8757
|
+
const combined = new Path2D();
|
|
8738
8758
|
for (const r of rects) {
|
|
8739
|
-
|
|
8740
|
-
ctx,
|
|
8759
|
+
const sub = buildRoundedRectPath2DObject(
|
|
8741
8760
|
r.x,
|
|
8742
8761
|
r.y,
|
|
8743
8762
|
r.w,
|
|
@@ -8747,8 +8766,9 @@ function applyTextBackground(obj, cfg) {
|
|
|
8747
8766
|
bg.rxBR ?? 0,
|
|
8748
8767
|
bg.rxBL ?? 0
|
|
8749
8768
|
);
|
|
8750
|
-
|
|
8769
|
+
combined.addPath(sub);
|
|
8751
8770
|
}
|
|
8771
|
+
ctx.fill(combined);
|
|
8752
8772
|
}
|
|
8753
8773
|
ctx.restore();
|
|
8754
8774
|
}
|
|
@@ -9626,8 +9646,9 @@ function gradientToFabric(gradient, width, height) {
|
|
|
9626
9646
|
});
|
|
9627
9647
|
}
|
|
9628
9648
|
function applyInitialGradients(obj, element) {
|
|
9629
|
-
const
|
|
9630
|
-
const
|
|
9649
|
+
const isLine = element.type === "line";
|
|
9650
|
+
const w = typeof obj.width === "number" && obj.width > 0 ? obj.width : (Number(element.width) || 0) * (isLine ? Number(element.scaleX) || 1 : 1);
|
|
9651
|
+
const h = typeof obj.height === "number" && obj.height > 0 ? obj.height : isLine ? Math.max(Number(element.strokeWidth) || 0, 1) : Number(element.height) || 0;
|
|
9631
9652
|
if (w <= 0 || h <= 0) return;
|
|
9632
9653
|
const fg = element.fillGradient;
|
|
9633
9654
|
if (fg && isGradientConfig(fg)) {
|
|
@@ -19291,7 +19312,7 @@ const PageCanvas = react.forwardRef(
|
|
|
19291
19312
|
}
|
|
19292
19313
|
if (element.fillGradient && isGradientConfig(element.fillGradient)) {
|
|
19293
19314
|
const objWidth = typeof obj.width === "number" ? obj.width : rW;
|
|
19294
|
-
const objHeight = typeof obj.height === "number" ? obj.height : rH;
|
|
19315
|
+
const objHeight = isLine ? Math.max(typeof obj.height === "number" ? obj.height : 0, typeof element.strokeWidth === "number" ? element.strokeWidth : 0, 1) : typeof obj.height === "number" ? obj.height : rH;
|
|
19295
19316
|
if (objWidth > 0 && objHeight > 0) {
|
|
19296
19317
|
obj.set({
|
|
19297
19318
|
fill: gradientToFabric(element.fillGradient, objWidth, objHeight),
|
|
@@ -19307,7 +19328,7 @@ const PageCanvas = react.forwardRef(
|
|
|
19307
19328
|
}
|
|
19308
19329
|
if (element.strokeGradient && isGradientConfig(element.strokeGradient)) {
|
|
19309
19330
|
const objWidth = typeof obj.width === "number" ? obj.width : rW;
|
|
19310
|
-
const objHeight = typeof obj.height === "number" ? obj.height : rH;
|
|
19331
|
+
const objHeight = isLine ? Math.max(typeof obj.height === "number" ? obj.height : 0, typeof element.strokeWidth === "number" ? element.strokeWidth : 0, 1) : typeof obj.height === "number" ? obj.height : rH;
|
|
19311
19332
|
if (objWidth > 0 && objHeight > 0) {
|
|
19312
19333
|
obj.set({
|
|
19313
19334
|
stroke: gradientToFabric(element.strokeGradient, objWidth, objHeight),
|
|
@@ -26326,9 +26347,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26326
26347
|
}
|
|
26327
26348
|
return svgString;
|
|
26328
26349
|
}
|
|
26329
|
-
const resolvedPackageVersion = "0.5.
|
|
26350
|
+
const resolvedPackageVersion = "0.5.474";
|
|
26330
26351
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26331
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26352
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.474";
|
|
26332
26353
|
const roundParityValue = (value) => {
|
|
26333
26354
|
if (typeof value !== "number") return value;
|
|
26334
26355
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27142,7 +27163,7 @@ class PixldocsRenderer {
|
|
|
27142
27163
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27143
27164
|
}
|
|
27144
27165
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27145
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27166
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Cgw2jQ1F.cjs"));
|
|
27146
27167
|
const prepared = preparePagesForExport(
|
|
27147
27168
|
cloned.pages,
|
|
27148
27169
|
canvasWidth,
|
|
@@ -29462,7 +29483,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29462
29483
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29463
29484
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29464
29485
|
try {
|
|
29465
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
29486
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-Cgw2jQ1F.cjs"));
|
|
29466
29487
|
try {
|
|
29467
29488
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29468
29489
|
} catch {
|
|
@@ -29776,4 +29797,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29776
29797
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29777
29798
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29778
29799
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29779
|
-
//# sourceMappingURL=index-
|
|
29800
|
+
//# sourceMappingURL=index-D2hncOO0.cjs.map
|