@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
|
@@ -6902,8 +6902,9 @@ function buildTextShadow(element) {
|
|
|
6902
6902
|
if (!color || color === "transparent") return null;
|
|
6903
6903
|
const type = element.textShadowType;
|
|
6904
6904
|
if (type && type !== "drop") return null;
|
|
6905
|
-
const
|
|
6906
|
-
|
|
6905
|
+
const alpha = resolveShadowAlpha(element);
|
|
6906
|
+
if (alpha <= 0) return null;
|
|
6907
|
+
const finalColor = applyAlphaMultiplier(String(color), alpha);
|
|
6907
6908
|
return new fabric__namespace.Shadow({
|
|
6908
6909
|
color: finalColor,
|
|
6909
6910
|
blur: blur || 0,
|
|
@@ -6913,27 +6914,28 @@ function buildTextShadow(element) {
|
|
|
6913
6914
|
nonScaling: false
|
|
6914
6915
|
});
|
|
6915
6916
|
}
|
|
6916
|
-
function
|
|
6917
|
+
function resolveShadowAlpha(element) {
|
|
6917
6918
|
const raw = element.textShadowStrength;
|
|
6918
|
-
const s = typeof raw === "number" && Number.isFinite(raw) ? Math.max(0, Math.min(100, raw)) :
|
|
6919
|
-
|
|
6920
|
-
if (s <= 25) return { perPassAlpha: s / 25, passes: 1 };
|
|
6921
|
-
const passes = Math.min(4, Math.ceil(s / 25));
|
|
6922
|
-
return { perPassAlpha: 1, passes };
|
|
6919
|
+
const s = typeof raw === "number" && Number.isFinite(raw) ? Math.max(0, Math.min(100, raw)) : 100;
|
|
6920
|
+
return s / 100;
|
|
6923
6921
|
}
|
|
6924
6922
|
function applyTextShadow(textbox, element) {
|
|
6925
|
-
const
|
|
6926
|
-
const { passes } = resolveShadowStrength(element);
|
|
6923
|
+
const canonicalShadow = buildTextShadow(element);
|
|
6927
6924
|
const obj = textbox;
|
|
6928
|
-
if (
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6925
|
+
if (obj.__pdShadowOrigRender) {
|
|
6926
|
+
try {
|
|
6927
|
+
obj.render = obj.__pdShadowOrigRender;
|
|
6928
|
+
} catch {
|
|
6929
|
+
}
|
|
6930
|
+
obj.__pdShadowOrigRender = void 0;
|
|
6931
|
+
obj.__pdShadowPassAlphas = void 0;
|
|
6932
|
+
obj.__pdShadowBaseColor = void 0;
|
|
6933
|
+
obj.__pdShadowBlur = void 0;
|
|
6934
|
+
obj.__pdShadowOX = void 0;
|
|
6935
|
+
obj.__pdShadowOY = void 0;
|
|
6934
6936
|
}
|
|
6935
|
-
obj.
|
|
6936
|
-
textbox.set("shadow",
|
|
6937
|
+
obj.__pdShadowAlpha = canonicalShadow ? resolveShadowAlpha(element) : 1;
|
|
6938
|
+
textbox.set("shadow", canonicalShadow ?? null);
|
|
6937
6939
|
}
|
|
6938
6940
|
function applyAlphaMultiplier(c, mult) {
|
|
6939
6941
|
const m = Math.max(0, Math.min(1, mult));
|
|
@@ -7314,7 +7316,9 @@ function applyTextBackground(obj, cfg) {
|
|
|
7314
7316
|
const by = shadowBounds.y - pad;
|
|
7315
7317
|
const bw = shadowBounds.w + pad * 2;
|
|
7316
7318
|
const bh = shadowBounds.h + pad * 2;
|
|
7317
|
-
const
|
|
7319
|
+
const alphaRaw = Number(this.__pdShadowAlpha);
|
|
7320
|
+
const shadowAlpha = Number.isFinite(alphaRaw) ? Math.max(0, Math.min(1, alphaRaw)) : 1;
|
|
7321
|
+
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)}"`;
|
|
7318
7322
|
const wrapShadow = (markup) => blur <= 0 ? `<g transform="translate(${ox.toFixed(3)} ${oy.toFixed(3)})">${markup}</g>` : `<g class="__pdShadowRaster" ${dataAttrs}>${markup}</g>`;
|
|
7319
7323
|
if (hasBg && (bg == null ? void 0 : bg.shadowAffectsBg) !== false) {
|
|
7320
7324
|
const shadowOpacityAttr = bgOpacity < 1 ? ` fill-opacity="${bgOpacity}"` : "";
|
|
@@ -19030,9 +19034,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
19030
19034
|
}
|
|
19031
19035
|
return svgString;
|
|
19032
19036
|
}
|
|
19033
|
-
const resolvedPackageVersion = "0.5.
|
|
19037
|
+
const resolvedPackageVersion = "0.5.214";
|
|
19034
19038
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
19035
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
19039
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.214";
|
|
19036
19040
|
const roundParityValue = (value) => {
|
|
19037
19041
|
if (typeof value !== "number") return value;
|
|
19038
19042
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -19724,7 +19728,7 @@ class PixldocsRenderer {
|
|
|
19724
19728
|
await this.waitForCanvasScene(container, cloned, i);
|
|
19725
19729
|
}
|
|
19726
19730
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
19727
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
19731
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BBG0QRse.cjs"));
|
|
19728
19732
|
const prepared = preparePagesForExport(
|
|
19729
19733
|
cloned.pages,
|
|
19730
19734
|
canvasWidth,
|
|
@@ -21701,10 +21705,12 @@ async function rasterizeShadowMarkers(svg) {
|
|
|
21701
21705
|
img.setAttribute("y", String(by));
|
|
21702
21706
|
img.setAttribute("width", String(bw));
|
|
21703
21707
|
img.setAttribute("height", String(bh));
|
|
21704
|
-
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION));
|
|
21705
21708
|
img.setAttribute("preserveAspectRatio", "none");
|
|
21706
21709
|
img.setAttributeNS(XLINK_NS, "xlink:href", dataUrl);
|
|
21707
21710
|
img.setAttribute("href", dataUrl);
|
|
21711
|
+
const alphaRaw = parseFloat(marker.getAttribute("data-alpha") || "1");
|
|
21712
|
+
const shadowAlpha = Number.isFinite(alphaRaw) ? Math.max(0, Math.min(1, alphaRaw)) : 1;
|
|
21713
|
+
img.setAttribute("opacity", String(SHADOW_RASTER_ALPHA_COMPENSATION * shadowAlpha));
|
|
21708
21714
|
(_e = marker.parentNode) == null ? void 0 : _e.replaceChild(img, marker);
|
|
21709
21715
|
} catch (e) {
|
|
21710
21716
|
console.warn("[pdf-export] rasterizeShadowMarkers failed for one marker:", e);
|
|
@@ -21910,7 +21916,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
21910
21916
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
21911
21917
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
21912
21918
|
try {
|
|
21913
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
21919
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BBG0QRse.cjs"));
|
|
21914
21920
|
try {
|
|
21915
21921
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
21916
21922
|
} catch {
|
|
@@ -22307,4 +22313,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
22307
22313
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
22308
22314
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
22309
22315
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
22310
|
-
//# sourceMappingURL=index-
|
|
22316
|
+
//# sourceMappingURL=index-Cy2_ElDZ.cjs.map
|