@pixldocs/canvas-renderer 0.5.212 → 0.5.214
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-B1QDVK5k.js → index-CDdfs3IB.js} +31 -25
- package/dist/index-CDdfs3IB.js.map +1 -0
- package/dist/{index-DB8j0PV0.cjs → index-Cy2_ElDZ.cjs} +31 -25
- package/dist/index-Cy2_ElDZ.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-zGrrm-iT.cjs → vectorPdfExport-BBG0QRse.cjs} +7 -5
- package/dist/vectorPdfExport-BBG0QRse.cjs.map +1 -0
- package/dist/{vectorPdfExport-CN-N0DE8.js → vectorPdfExport-CjIUU8on.js} +7 -5
- package/dist/vectorPdfExport-CjIUU8on.js.map +1 -0
- package/package.json +1 -1
- package/dist/index-B1QDVK5k.js.map +0 -1
- package/dist/index-DB8j0PV0.cjs.map +0 -1
- package/dist/vectorPdfExport-CN-N0DE8.js.map +0 -1
- package/dist/vectorPdfExport-zGrrm-iT.cjs.map +0 -1
|
@@ -6884,8 +6884,9 @@ function buildTextShadow(element) {
|
|
|
6884
6884
|
if (!color || color === "transparent") return null;
|
|
6885
6885
|
const type = element.textShadowType;
|
|
6886
6886
|
if (type && type !== "drop") return null;
|
|
6887
|
-
const
|
|
6888
|
-
|
|
6887
|
+
const alpha = resolveShadowAlpha(element);
|
|
6888
|
+
if (alpha <= 0) return null;
|
|
6889
|
+
const finalColor = applyAlphaMultiplier(String(color), alpha);
|
|
6889
6890
|
return new fabric.Shadow({
|
|
6890
6891
|
color: finalColor,
|
|
6891
6892
|
blur: blur || 0,
|
|
@@ -6895,27 +6896,28 @@ function buildTextShadow(element) {
|
|
|
6895
6896
|
nonScaling: false
|
|
6896
6897
|
});
|
|
6897
6898
|
}
|
|
6898
|
-
function
|
|
6899
|
+
function resolveShadowAlpha(element) {
|
|
6899
6900
|
const raw = element.textShadowStrength;
|
|
6900
|
-
const s = typeof raw === "number" && Number.isFinite(raw) ? Math.max(0, Math.min(100, raw)) :
|
|
6901
|
-
|
|
6902
|
-
if (s <= 25) return { perPassAlpha: s / 25, passes: 1 };
|
|
6903
|
-
const passes = Math.min(4, Math.ceil(s / 25));
|
|
6904
|
-
return { perPassAlpha: 1, passes };
|
|
6901
|
+
const s = typeof raw === "number" && Number.isFinite(raw) ? Math.max(0, Math.min(100, raw)) : 100;
|
|
6902
|
+
return s / 100;
|
|
6905
6903
|
}
|
|
6906
6904
|
function applyTextShadow(textbox, element) {
|
|
6907
|
-
const
|
|
6908
|
-
const { passes } = resolveShadowStrength(element);
|
|
6905
|
+
const canonicalShadow = buildTextShadow(element);
|
|
6909
6906
|
const obj = textbox;
|
|
6910
|
-
if (
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6907
|
+
if (obj.__pdShadowOrigRender) {
|
|
6908
|
+
try {
|
|
6909
|
+
obj.render = obj.__pdShadowOrigRender;
|
|
6910
|
+
} catch {
|
|
6911
|
+
}
|
|
6912
|
+
obj.__pdShadowOrigRender = void 0;
|
|
6913
|
+
obj.__pdShadowPassAlphas = void 0;
|
|
6914
|
+
obj.__pdShadowBaseColor = void 0;
|
|
6915
|
+
obj.__pdShadowBlur = void 0;
|
|
6916
|
+
obj.__pdShadowOX = void 0;
|
|
6917
|
+
obj.__pdShadowOY = void 0;
|
|
6916
6918
|
}
|
|
6917
|
-
obj.
|
|
6918
|
-
textbox.set("shadow",
|
|
6919
|
+
obj.__pdShadowAlpha = canonicalShadow ? resolveShadowAlpha(element) : 1;
|
|
6920
|
+
textbox.set("shadow", canonicalShadow ?? null);
|
|
6919
6921
|
}
|
|
6920
6922
|
function applyAlphaMultiplier(c, mult) {
|
|
6921
6923
|
const m = Math.max(0, Math.min(1, mult));
|
|
@@ -7296,7 +7298,9 @@ function applyTextBackground(obj, cfg) {
|
|
|
7296
7298
|
const by = shadowBounds.y - pad;
|
|
7297
7299
|
const bw = shadowBounds.w + pad * 2;
|
|
7298
7300
|
const bh = shadowBounds.h + pad * 2;
|
|
7299
|
-
const
|
|
7301
|
+
const alphaRaw = Number(this.__pdShadowAlpha);
|
|
7302
|
+
const shadowAlpha = Number.isFinite(alphaRaw) ? Math.max(0, Math.min(1, alphaRaw)) : 1;
|
|
7303
|
+
const dataAttrs = `data-blur="${blur.toFixed(3)}" data-ox="${ox.toFixed(3)}" data-oy="${oy.toFixed(3)}" data-bx="${bx.toFixed(3)}" data-by="${by.toFixed(3)}" data-bw="${bw.toFixed(3)}" data-bh="${bh.toFixed(3)}" data-color="${escapeXmlAttr(shadowColor)}" data-alpha="${shadowAlpha.toFixed(3)}"`;
|
|
7300
7304
|
const wrapShadow = (markup) => blur <= 0 ? `<g transform="translate(${ox.toFixed(3)} ${oy.toFixed(3)})">${markup}</g>` : `<g class="__pdShadowRaster" ${dataAttrs}>${markup}</g>`;
|
|
7301
7305
|
if (hasBg && (bg == null ? void 0 : bg.shadowAffectsBg) !== false) {
|
|
7302
7306
|
const shadowOpacityAttr = bgOpacity < 1 ? ` fill-opacity="${bgOpacity}"` : "";
|
|
@@ -19012,9 +19016,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
19012
19016
|
}
|
|
19013
19017
|
return svgString;
|
|
19014
19018
|
}
|
|
19015
|
-
const resolvedPackageVersion = "0.5.
|
|
19019
|
+
const resolvedPackageVersion = "0.5.214";
|
|
19016
19020
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
19017
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
19021
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.214";
|
|
19018
19022
|
const roundParityValue = (value) => {
|
|
19019
19023
|
if (typeof value !== "number") return value;
|
|
19020
19024
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -19706,7 +19710,7 @@ class PixldocsRenderer {
|
|
|
19706
19710
|
await this.waitForCanvasScene(container, cloned, i);
|
|
19707
19711
|
}
|
|
19708
19712
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
19709
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
19713
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CjIUU8on.js");
|
|
19710
19714
|
const prepared = preparePagesForExport(
|
|
19711
19715
|
cloned.pages,
|
|
19712
19716
|
canvasWidth,
|
|
@@ -21683,10 +21687,12 @@ async function rasterizeShadowMarkers(svg) {
|
|
|
21683
21687
|
img.setAttribute("y", String(by));
|
|
21684
21688
|
img.setAttribute("width", String(bw));
|
|
21685
21689
|
img.setAttribute("height", String(bh));
|
|
21686
|
-
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION));
|
|
21687
21690
|
img.setAttribute("preserveAspectRatio", "none");
|
|
21688
21691
|
img.setAttributeNS(XLINK_NS, "xlink:href", dataUrl);
|
|
21689
21692
|
img.setAttribute("href", dataUrl);
|
|
21693
|
+
const alphaRaw = parseFloat(marker.getAttribute("data-alpha") || "1");
|
|
21694
|
+
const shadowAlpha = Number.isFinite(alphaRaw) ? Math.max(0, Math.min(1, alphaRaw)) : 1;
|
|
21695
|
+
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION * shadowAlpha));
|
|
21690
21696
|
(_e = marker.parentNode) == null ? void 0 : _e.replaceChild(img, marker);
|
|
21691
21697
|
} catch (e) {
|
|
21692
21698
|
console.warn("[pdf-export] rasterizeShadowMarkers failed for one marker:", e);
|
|
@@ -21892,7 +21898,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
21892
21898
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
21893
21899
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
21894
21900
|
try {
|
|
21895
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
21901
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CjIUU8on.js");
|
|
21896
21902
|
try {
|
|
21897
21903
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
21898
21904
|
} catch {
|
|
@@ -22292,4 +22298,4 @@ export {
|
|
|
22292
22298
|
buildTeaserBlurFlatKeys as y,
|
|
22293
22299
|
collectFontDescriptorsFromConfig as z
|
|
22294
22300
|
};
|
|
22295
|
-
//# sourceMappingURL=index-
|
|
22301
|
+
//# sourceMappingURL=index-CDdfs3IB.js.map
|