@pixldocs/canvas-renderer 0.5.211 → 0.5.212
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-C0tTvSFQ.js → index-B1QDVK5k.js} +71 -11
- package/dist/index-B1QDVK5k.js.map +1 -0
- package/dist/{index-d8U2oDzI.cjs → index-DB8j0PV0.cjs} +71 -11
- package/dist/index-DB8j0PV0.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-BEGl71uB.js → vectorPdfExport-CN-N0DE8.js} +4 -4
- package/dist/{vectorPdfExport-BEGl71uB.js.map → vectorPdfExport-CN-N0DE8.js.map} +1 -1
- package/dist/{vectorPdfExport-QzySzFJJ.cjs → vectorPdfExport-zGrrm-iT.cjs} +4 -4
- package/dist/{vectorPdfExport-QzySzFJJ.cjs.map → vectorPdfExport-zGrrm-iT.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-C0tTvSFQ.js.map +0 -1
- package/dist/index-d8U2oDzI.cjs.map +0 -1
|
@@ -6884,8 +6884,10 @@ 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 { perPassAlpha } = resolveShadowStrength(element);
|
|
6888
|
+
const finalColor = applyAlphaMultiplier(String(color), perPassAlpha);
|
|
6887
6889
|
return new fabric.Shadow({
|
|
6888
|
-
color:
|
|
6890
|
+
color: finalColor,
|
|
6889
6891
|
blur: blur || 0,
|
|
6890
6892
|
offsetX: ox || 0,
|
|
6891
6893
|
offsetY: oy || 0,
|
|
@@ -6893,6 +6895,65 @@ function buildTextShadow(element) {
|
|
|
6893
6895
|
nonScaling: false
|
|
6894
6896
|
});
|
|
6895
6897
|
}
|
|
6898
|
+
function resolveShadowStrength(element) {
|
|
6899
|
+
const raw = element.textShadowStrength;
|
|
6900
|
+
const s = typeof raw === "number" && Number.isFinite(raw) ? Math.max(0, Math.min(100, raw)) : 25;
|
|
6901
|
+
if (s <= 0) return { perPassAlpha: 0, passes: 0 };
|
|
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 };
|
|
6905
|
+
}
|
|
6906
|
+
function applyTextShadow(textbox, element) {
|
|
6907
|
+
const shadow = buildTextShadow(element);
|
|
6908
|
+
const { passes } = resolveShadowStrength(element);
|
|
6909
|
+
const obj = textbox;
|
|
6910
|
+
if (!obj.__pdShadowOrigRender) {
|
|
6911
|
+
obj.__pdShadowOrigRender = obj.render.bind(obj);
|
|
6912
|
+
obj.render = function(ctx) {
|
|
6913
|
+
const n = Math.max(1, Number(obj.__pdShadowPasses || 1));
|
|
6914
|
+
for (let i = 0; i < n; i++) obj.__pdShadowOrigRender(ctx);
|
|
6915
|
+
};
|
|
6916
|
+
}
|
|
6917
|
+
obj.__pdShadowPasses = shadow ? Math.max(1, passes) : 1;
|
|
6918
|
+
textbox.set("shadow", shadow ?? null);
|
|
6919
|
+
}
|
|
6920
|
+
function applyAlphaMultiplier(c, mult) {
|
|
6921
|
+
const m = Math.max(0, Math.min(1, mult));
|
|
6922
|
+
const s = String(c).trim();
|
|
6923
|
+
const rgba = s.match(/^rgba?\s*\(([^)]+)\)$/i);
|
|
6924
|
+
if (rgba) {
|
|
6925
|
+
const parts = rgba[1].split(",").map((p) => p.trim());
|
|
6926
|
+
const [r, g, b] = parts;
|
|
6927
|
+
const baseA = parts.length >= 4 ? Math.max(0, Math.min(1, parseFloat(parts[3]) || 0)) : 1;
|
|
6928
|
+
return `rgba(${r}, ${g}, ${b}, ${Math.round(baseA * m * 1e3) / 1e3})`;
|
|
6929
|
+
}
|
|
6930
|
+
const hex8 = s.match(/^#([0-9a-f]{8})$/i);
|
|
6931
|
+
if (hex8) {
|
|
6932
|
+
const h = hex8[1];
|
|
6933
|
+
const r = parseInt(h.slice(0, 2), 16);
|
|
6934
|
+
const g = parseInt(h.slice(2, 4), 16);
|
|
6935
|
+
const b = parseInt(h.slice(4, 6), 16);
|
|
6936
|
+
const baseA = parseInt(h.slice(6, 8), 16) / 255;
|
|
6937
|
+
return `rgba(${r}, ${g}, ${b}, ${Math.round(baseA * m * 1e3) / 1e3})`;
|
|
6938
|
+
}
|
|
6939
|
+
const hex6 = s.match(/^#([0-9a-f]{6})$/i);
|
|
6940
|
+
if (hex6) {
|
|
6941
|
+
const h = hex6[1];
|
|
6942
|
+
const r = parseInt(h.slice(0, 2), 16);
|
|
6943
|
+
const g = parseInt(h.slice(2, 4), 16);
|
|
6944
|
+
const b = parseInt(h.slice(4, 6), 16);
|
|
6945
|
+
return `rgba(${r}, ${g}, ${b}, ${Math.round(m * 1e3) / 1e3})`;
|
|
6946
|
+
}
|
|
6947
|
+
const hex3 = s.match(/^#([0-9a-f]{3})$/i);
|
|
6948
|
+
if (hex3) {
|
|
6949
|
+
const h = hex3[1];
|
|
6950
|
+
const r = parseInt(h[0] + h[0], 16);
|
|
6951
|
+
const g = parseInt(h[1] + h[1], 16);
|
|
6952
|
+
const b = parseInt(h[2] + h[2], 16);
|
|
6953
|
+
return `rgba(${r}, ${g}, ${b}, ${Math.round(m * 1e3) / 1e3})`;
|
|
6954
|
+
}
|
|
6955
|
+
return `rgba(0, 0, 0, ${Math.round(m * 1e3) / 1e3})`;
|
|
6956
|
+
}
|
|
6896
6957
|
function buildRoundedRectPath2D(ctx, x, y, w, h, rTL, rTR, rBR, rBL) {
|
|
6897
6958
|
const maxR = Math.min(w, h) / 2;
|
|
6898
6959
|
const tl = Math.min(Math.max(0, rTL), maxR);
|
|
@@ -8457,8 +8518,7 @@ function createText(element) {
|
|
|
8457
8518
|
}));
|
|
8458
8519
|
}
|
|
8459
8520
|
applyTextBackground(textbox, extractTextBgConfig(element));
|
|
8460
|
-
|
|
8461
|
-
if (shadow) textbox.set("shadow", shadow);
|
|
8521
|
+
applyTextShadow(textbox, element);
|
|
8462
8522
|
return textbox;
|
|
8463
8523
|
}
|
|
8464
8524
|
function createLine(element) {
|
|
@@ -12265,8 +12325,7 @@ const PageCanvas = forwardRef(
|
|
|
12265
12325
|
obj.dirty = true;
|
|
12266
12326
|
try {
|
|
12267
12327
|
applyTextBackground(obj, extractTextBgConfig(element));
|
|
12268
|
-
|
|
12269
|
-
obj.set("shadow", shadow ?? null);
|
|
12328
|
+
applyTextShadow(obj, element);
|
|
12270
12329
|
try {
|
|
12271
12330
|
obj._cacheCanvas = null;
|
|
12272
12331
|
obj._cacheContext = null;
|
|
@@ -12294,7 +12353,8 @@ const PageCanvas = forwardRef(
|
|
|
12294
12353
|
sy: element.textShadowOffsetY ?? 0,
|
|
12295
12354
|
st: element.textShadowAffectsText !== false,
|
|
12296
12355
|
sa: element.textShadowAffectsBg !== false,
|
|
12297
|
-
sty: element.textShadowType ?? null
|
|
12356
|
+
sty: element.textShadowType ?? null,
|
|
12357
|
+
ss: element.textShadowStrength ?? null
|
|
12298
12358
|
});
|
|
12299
12359
|
obj.dirty = true;
|
|
12300
12360
|
} catch (err) {
|
|
@@ -18952,9 +19012,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
18952
19012
|
}
|
|
18953
19013
|
return svgString;
|
|
18954
19014
|
}
|
|
18955
|
-
const resolvedPackageVersion = "0.5.
|
|
19015
|
+
const resolvedPackageVersion = "0.5.212";
|
|
18956
19016
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
18957
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
19017
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.212";
|
|
18958
19018
|
const roundParityValue = (value) => {
|
|
18959
19019
|
if (typeof value !== "number") return value;
|
|
18960
19020
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -19646,7 +19706,7 @@ class PixldocsRenderer {
|
|
|
19646
19706
|
await this.waitForCanvasScene(container, cloned, i);
|
|
19647
19707
|
}
|
|
19648
19708
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
19649
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
19709
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CN-N0DE8.js");
|
|
19650
19710
|
const prepared = preparePagesForExport(
|
|
19651
19711
|
cloned.pages,
|
|
19652
19712
|
canvasWidth,
|
|
@@ -21832,7 +21892,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
21832
21892
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
21833
21893
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
21834
21894
|
try {
|
|
21835
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
21895
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CN-N0DE8.js");
|
|
21836
21896
|
try {
|
|
21837
21897
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
21838
21898
|
} catch {
|
|
@@ -22232,4 +22292,4 @@ export {
|
|
|
22232
22292
|
buildTeaserBlurFlatKeys as y,
|
|
22233
22293
|
collectFontDescriptorsFromConfig as z
|
|
22234
22294
|
};
|
|
22235
|
-
//# sourceMappingURL=index-
|
|
22295
|
+
//# sourceMappingURL=index-B1QDVK5k.js.map
|