@pixldocs/canvas-renderer 0.5.162 → 0.5.164
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-D96xE7-z.cjs → index-BfBR4Koj.cjs} +15 -12
- package/dist/index-BfBR4Koj.cjs.map +1 -0
- package/dist/{index-C6rEqM4R.js → index-Gj2Xgcsf.js} +15 -12
- package/dist/index-Gj2Xgcsf.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-C5vnOg8Q.js → vectorPdfExport-C-XaAhxd.js} +35 -4
- package/dist/vectorPdfExport-C-XaAhxd.js.map +1 -0
- package/dist/{vectorPdfExport-KTzhlsHG.cjs → vectorPdfExport-gXz5yjal.cjs} +35 -4
- package/dist/vectorPdfExport-gXz5yjal.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/index-C6rEqM4R.js.map +0 -1
- package/dist/index-D96xE7-z.cjs.map +0 -1
- package/dist/vectorPdfExport-C5vnOg8Q.js.map +0 -1
- package/dist/vectorPdfExport-KTzhlsHG.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-BfBR4Koj.cjs");
|
|
4
4
|
exports.DEPLOYMENT_VERSION_MARKER = index.DEPLOYMENT_VERSION_MARKER;
|
|
5
5
|
exports.FONT_FALLBACK_DEVANAGARI = index.FONT_FALLBACK_DEVANAGARI;
|
|
6
6
|
exports.FONT_FALLBACK_MATH = index.FONT_FALLBACK_MATH;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, b, M, N, O, Q, R, S, U, V, W, X, Y, Z, _ } from "./index-
|
|
1
|
+
import { D, F, o, q, s, P, t, u, v, w, x, y, z, B, C, E, G, H, I, J, K, L, b, M, N, O, Q, R, S, U, V, W, X, Y, Z, _ } from "./index-Gj2Xgcsf.js";
|
|
2
2
|
export {
|
|
3
3
|
D as DEPLOYMENT_VERSION_MARKER,
|
|
4
4
|
F as FONT_FALLBACK_DEVANAGARI,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsPDF, ShadingPattern } from "jspdf";
|
|
2
2
|
import { svg2pdf } from "svg2pdf.js";
|
|
3
3
|
import * as fabric from "fabric";
|
|
4
|
-
import { g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, p as parseTextMarkdown, r as renderSmartElementToSvg, n as normalizeShapeType, h as hasEdgeFade, b as getProxiedImageUrl, d as bakeEdgeFade, i as isElement, e as isGroup, j as buildRoundedTrianglePath, A as API_URL, k as getImageProxyFetchOptions, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-
|
|
4
|
+
import { g as getCanvasForPage, c as captureFabricCanvasSvgForPdf, f as findNodeById, a as getAbsoluteBounds, p as parseTextMarkdown, r as renderSmartElementToSvg, n as normalizeShapeType, h as hasEdgeFade, b as getProxiedImageUrl, d as bakeEdgeFade, i as isElement, e as isGroup, j as buildRoundedTrianglePath, A as API_URL, k as getImageProxyFetchOptions, l as getRoundedRectRadii, T as TRIANGLE_STROKE_MITER_LIMIT, m as getTrianglePoints } from "./index-Gj2Xgcsf.js";
|
|
5
5
|
import { resetPdfFontRegistry, FONT_FALLBACK_SYMBOLS, FONT_FALLBACK_MATH, FONT_FALLBACK_DEVANAGARI, embedFontWithGoogleFallback, getEmbeddedVariantsList, isFontAvailable, isFamilyEmbedded, resolveBestRegisteredVariant, getEmbeddedJsPDFFontName, resolveFontWeight, doesVariantSupportChar } from "./pdfFonts-b3_bv7F0.js";
|
|
6
6
|
async function embedFontsForSvg(pdf, svgStr) {
|
|
7
7
|
var _a;
|
|
@@ -1896,6 +1896,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
1896
1896
|
}
|
|
1897
1897
|
}
|
|
1898
1898
|
async function drawPreparedLiveCanvasSvgPageToPdf(options) {
|
|
1899
|
+
var _a;
|
|
1899
1900
|
const { rawSvg, pdf, pageWidth, pageHeight, pageKey, stripPageBackground } = options;
|
|
1900
1901
|
const svgToDraw = await prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey, {
|
|
1901
1902
|
stripPageBackground
|
|
@@ -1907,6 +1908,36 @@ async function drawPreparedLiveCanvasSvgPageToPdf(options) {
|
|
|
1907
1908
|
pdf.saveGraphicsState();
|
|
1908
1909
|
setPdfColorFromSvg(pdf, svgToDraw);
|
|
1909
1910
|
const pdfToUse = pdfWithColorLogging(pdf);
|
|
1911
|
+
try {
|
|
1912
|
+
const texts = Array.from(svgToDraw.querySelectorAll("text"));
|
|
1913
|
+
for (let i = 0; i < texts.length; i++) {
|
|
1914
|
+
const t = texts[i];
|
|
1915
|
+
const content = (t.textContent || "").replace(/\s+/g, " ").trim().slice(0, 60);
|
|
1916
|
+
const tspans = Array.from(t.querySelectorAll("tspan")).map((s) => ({
|
|
1917
|
+
x: s.getAttribute("x"),
|
|
1918
|
+
y: s.getAttribute("y"),
|
|
1919
|
+
text: (s.textContent || "").slice(0, 40)
|
|
1920
|
+
}));
|
|
1921
|
+
const parentG = ((_a = t.parentElement) == null ? void 0 : _a.tagName) === "g" ? t.parentElement : null;
|
|
1922
|
+
console.log("[svg-parity-dump]", JSON.stringify({
|
|
1923
|
+
page: pageKey,
|
|
1924
|
+
idx: i,
|
|
1925
|
+
snippet: content,
|
|
1926
|
+
textAttrs: {
|
|
1927
|
+
x: t.getAttribute("x"),
|
|
1928
|
+
y: t.getAttribute("y"),
|
|
1929
|
+
anchor: t.getAttribute("text-anchor"),
|
|
1930
|
+
fontFamily: t.getAttribute("font-family"),
|
|
1931
|
+
fontSize: t.getAttribute("font-size"),
|
|
1932
|
+
fontWeight: t.getAttribute("font-weight")
|
|
1933
|
+
},
|
|
1934
|
+
parentTransform: (parentG == null ? void 0 : parentG.getAttribute("transform")) || null,
|
|
1935
|
+
tspans
|
|
1936
|
+
}));
|
|
1937
|
+
}
|
|
1938
|
+
} catch (e) {
|
|
1939
|
+
console.warn("[svg-parity-dump] failed:", e);
|
|
1940
|
+
}
|
|
1910
1941
|
await svg2pdfWithDomMount(svgToDraw, pdfToUse, svg2pdfOpts(0, 0, pageWidth, pageHeight));
|
|
1911
1942
|
pdf.restoreGraphicsState();
|
|
1912
1943
|
pdf.setFillColor(0, 0, 0);
|
|
@@ -2469,7 +2500,7 @@ async function fetchSvgAsElement(imageUrl, colorMap) {
|
|
|
2469
2500
|
async function getRecoloredSvgDataUrl(imageUrl, colorMap) {
|
|
2470
2501
|
if (!colorMap || Object.keys(colorMap).length === 0) return null;
|
|
2471
2502
|
try {
|
|
2472
|
-
const { getNormalizedSvgUrl } = await import("./index-
|
|
2503
|
+
const { getNormalizedSvgUrl } = await import("./index-Gj2Xgcsf.js").then((n) => n.$);
|
|
2473
2504
|
return await getNormalizedSvgUrl(imageUrl, colorMap);
|
|
2474
2505
|
} catch {
|
|
2475
2506
|
return null;
|
|
@@ -3250,7 +3281,7 @@ async function fetchImageAsBase64(imageUrl, opts = {}) {
|
|
|
3250
3281
|
}
|
|
3251
3282
|
let fetchUrl = imageUrl;
|
|
3252
3283
|
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
3253
|
-
const { isPrivateUrl } = await import("./index-
|
|
3284
|
+
const { isPrivateUrl } = await import("./index-Gj2Xgcsf.js").then((n) => n.$);
|
|
3254
3285
|
if (isPrivateUrl(imageUrl)) return null;
|
|
3255
3286
|
const proxyUrl = new URL(`${API_URL}/image-proxy`);
|
|
3256
3287
|
proxyUrl.searchParams.set("url", imageUrl);
|
|
@@ -5234,4 +5265,4 @@ export {
|
|
|
5234
5265
|
preparePagesForExport,
|
|
5235
5266
|
rewriteSvgFontsForJsPDFWithSourceMeta
|
|
5236
5267
|
};
|
|
5237
|
-
//# sourceMappingURL=vectorPdfExport-
|
|
5268
|
+
//# sourceMappingURL=vectorPdfExport-C-XaAhxd.js.map
|