@pixldocs/canvas-renderer 0.5.151 → 0.5.152
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-Clvky1Ne.cjs → index-CM_LXIKO.cjs} +27 -7
- package/dist/index-CM_LXIKO.cjs.map +1 -0
- package/dist/{index-Dp8yJxTW.js → index-DjobDQ7X.js} +27 -7
- package/dist/index-DjobDQ7X.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-TF3IGImZ.js → vectorPdfExport-RiNowoiG.js} +4 -4
- package/dist/{vectorPdfExport-TF3IGImZ.js.map → vectorPdfExport-RiNowoiG.js.map} +1 -1
- package/dist/{vectorPdfExport-BEohav7Y.cjs → vectorPdfExport-gHfbrQfT.cjs} +4 -4
- package/dist/{vectorPdfExport-BEohav7Y.cjs.map → vectorPdfExport-gHfbrQfT.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-Clvky1Ne.cjs.map +0 -1
- package/dist/index-Dp8yJxTW.js.map +0 -1
|
@@ -5762,7 +5762,7 @@ function recolorSvgFills(svg, color) {
|
|
|
5762
5762
|
return _recolorSvgFills(svg, color);
|
|
5763
5763
|
}
|
|
5764
5764
|
function bakeTextSvgToFabricLineStarts(svg, obj, w) {
|
|
5765
|
-
var _a;
|
|
5765
|
+
var _a, _b, _c;
|
|
5766
5766
|
try {
|
|
5767
5767
|
const lines = (obj == null ? void 0 : obj._textLines) ?? [];
|
|
5768
5768
|
if (!Array.isArray(lines) || lines.length === 0) return svg;
|
|
@@ -5770,12 +5770,25 @@ function bakeTextSvgToFabricLineStarts(svg, obj, w) {
|
|
|
5770
5770
|
const lineXs = [];
|
|
5771
5771
|
for (let i = 0; i < lines.length; i++) {
|
|
5772
5772
|
let lineLeft = 0;
|
|
5773
|
+
let firstGlyphAdjust = 0;
|
|
5773
5774
|
try {
|
|
5774
5775
|
lineLeft = ((_a = obj._getLineLeftOffset) == null ? void 0 : _a.call(obj, i)) ?? 0;
|
|
5775
5776
|
} catch {
|
|
5776
5777
|
lineLeft = 0;
|
|
5777
5778
|
}
|
|
5778
|
-
|
|
5779
|
+
try {
|
|
5780
|
+
const firstBox = (_c = (_b = obj.__charBounds) == null ? void 0 : _b[i]) == null ? void 0 : _c[0];
|
|
5781
|
+
const kerned = Number(firstBox == null ? void 0 : firstBox.kernedWidth);
|
|
5782
|
+
const glyphW = Number(firstBox == null ? void 0 : firstBox.width);
|
|
5783
|
+
if (Number.isFinite(kerned) && Number.isFinite(glyphW)) {
|
|
5784
|
+
firstGlyphAdjust = kerned - glyphW;
|
|
5785
|
+
}
|
|
5786
|
+
} catch {
|
|
5787
|
+
firstGlyphAdjust = 0;
|
|
5788
|
+
}
|
|
5789
|
+
lineXs.push(
|
|
5790
|
+
-halfW + (Number.isFinite(lineLeft) ? lineLeft : 0) + (Number.isFinite(firstGlyphAdjust) ? firstGlyphAdjust : 0)
|
|
5791
|
+
);
|
|
5779
5792
|
}
|
|
5780
5793
|
const textOpenRe = /<text\b([^>]*)>/i;
|
|
5781
5794
|
const textOpenMatch = svg.match(textOpenRe);
|
|
@@ -5792,9 +5805,16 @@ function bakeTextSvgToFabricLineStarts(svg, obj, w) {
|
|
|
5792
5805
|
);
|
|
5793
5806
|
const newTextOpen = `<text${textAttrs}>`;
|
|
5794
5807
|
let lineIdx = 0;
|
|
5808
|
+
let lastY = "";
|
|
5795
5809
|
const newSvg = svg.replace(textOpenMatch[0], newTextOpen).replace(
|
|
5796
5810
|
/<tspan\b([^>]*?)\sx="([^"]*)"([^>]*)>/gi,
|
|
5797
5811
|
(_m, pre, _oldX, post) => {
|
|
5812
|
+
const attrs = `${pre} ${post}`;
|
|
5813
|
+
const yMatch = attrs.match(/\sy\s*=\s*"([^"]*)"/i);
|
|
5814
|
+
const y = (yMatch == null ? void 0 : yMatch[1]) ?? "";
|
|
5815
|
+
const isLineStart = y !== "" ? y !== lastY : lineIdx < lineXs.length;
|
|
5816
|
+
if (!isLineStart) return _m;
|
|
5817
|
+
if (y !== "") lastY = y;
|
|
5798
5818
|
const x = lineXs[lineIdx];
|
|
5799
5819
|
lineIdx += 1;
|
|
5800
5820
|
if (typeof x !== "number" || !Number.isFinite(x)) return _m;
|
|
@@ -16027,9 +16047,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
16027
16047
|
}
|
|
16028
16048
|
return svgString;
|
|
16029
16049
|
}
|
|
16030
|
-
const resolvedPackageVersion = "0.5.
|
|
16050
|
+
const resolvedPackageVersion = "0.5.152";
|
|
16031
16051
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
16032
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
16052
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.152";
|
|
16033
16053
|
const roundParityValue = (value) => {
|
|
16034
16054
|
if (typeof value !== "number") return value;
|
|
16035
16055
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -16464,7 +16484,7 @@ class PixldocsRenderer {
|
|
|
16464
16484
|
await this.waitForCanvasScene(container, cloned, i);
|
|
16465
16485
|
}
|
|
16466
16486
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
16467
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
16487
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-gHfbrQfT.cjs"));
|
|
16468
16488
|
const prepared = preparePagesForExport(
|
|
16469
16489
|
cloned.pages,
|
|
16470
16490
|
canvasWidth,
|
|
@@ -18566,7 +18586,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
18566
18586
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
18567
18587
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
18568
18588
|
try {
|
|
18569
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
18589
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-gHfbrQfT.cjs"));
|
|
18570
18590
|
try {
|
|
18571
18591
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
18572
18592
|
} catch {
|
|
@@ -18913,4 +18933,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
18913
18933
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
18914
18934
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
18915
18935
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
18916
|
-
//# sourceMappingURL=index-
|
|
18936
|
+
//# sourceMappingURL=index-CM_LXIKO.cjs.map
|