@pixldocs/canvas-renderer 0.5.44 → 0.5.45
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.cjs +16 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4938,7 +4938,8 @@ function applyTextBackground(obj, cfg) {
|
|
|
4938
4938
|
const bgPath = hasBg ? `<path d="${bgD}" fill="${escapeXmlAttr(bgFill)}" />` : "";
|
|
4939
4939
|
svg = svg.replace(/style="[^"]*filter:\s*url\([^)]+\)[^"]*"/i, "");
|
|
4940
4940
|
svg = svg.replace(/<filter[\s\S]*?<\/filter>/gi, "");
|
|
4941
|
-
let
|
|
4941
|
+
let bgShadowLayer = "";
|
|
4942
|
+
let textShadowLayer = "";
|
|
4942
4943
|
if (hasShadow) {
|
|
4943
4944
|
const ox = Number(shadow.offsetX ?? 0) || 0;
|
|
4944
4945
|
const oy = Number(shadow.offsetY ?? 0) || 0;
|
|
@@ -4947,7 +4948,13 @@ function applyTextBackground(obj, cfg) {
|
|
|
4947
4948
|
const shadowBgPath = hasBg ? `<path d="${bgD}" fill="${escapeXmlAttr(shadowColor)}" />` : "";
|
|
4948
4949
|
const inner = extractGInnerMarkup(svg);
|
|
4949
4950
|
const recoloredText = recolorSvgFills(inner, shadowColor);
|
|
4950
|
-
const
|
|
4951
|
+
const bgLayers = [];
|
|
4952
|
+
const textLayers = [];
|
|
4953
|
+
const pushShadowPass = (tx, ty, opacity) => {
|
|
4954
|
+
const attrs = `transform="translate(${tx.toFixed(3)} ${ty.toFixed(3)})"${opacity ? ` opacity="${opacity}"` : ""}`;
|
|
4955
|
+
if (shadowBgPath) bgLayers.push(`<g ${attrs}>${shadowBgPath}</g>`);
|
|
4956
|
+
if (recoloredText) textLayers.push(`<g ${attrs}>${recoloredText}</g>`);
|
|
4957
|
+
};
|
|
4951
4958
|
if (blur > 0) {
|
|
4952
4959
|
const ringCount = Math.min(6, Math.max(2, Math.round(blur / 2)));
|
|
4953
4960
|
for (let i = 1; i <= ringCount; i++) {
|
|
@@ -4965,23 +4972,18 @@ function applyTextBackground(obj, cfg) {
|
|
|
4965
4972
|
[-dist * 0.7, -dist * 0.7]
|
|
4966
4973
|
];
|
|
4967
4974
|
for (const [dx, dy] of ringOffsets) {
|
|
4968
|
-
|
|
4969
|
-
`<g transform="translate(${(ox + dx).toFixed(3)} ${(oy + dy).toFixed(3)})" opacity="${op}">${shadowBgPath}${recoloredText}</g>`
|
|
4970
|
-
);
|
|
4975
|
+
pushShadowPass(ox + dx, oy + dy, op);
|
|
4971
4976
|
}
|
|
4972
4977
|
}
|
|
4973
|
-
|
|
4974
|
-
`<g transform="translate(${ox.toFixed(3)} ${oy.toFixed(3)})" opacity="0.25">${shadowBgPath}${recoloredText}</g>`
|
|
4975
|
-
);
|
|
4978
|
+
pushShadowPass(ox, oy, "0.25");
|
|
4976
4979
|
} else {
|
|
4977
|
-
|
|
4978
|
-
`<g transform="translate(${ox.toFixed(3)} ${oy.toFixed(3)})">${shadowBgPath}${recoloredText}</g>`
|
|
4979
|
-
);
|
|
4980
|
+
pushShadowPass(ox, oy);
|
|
4980
4981
|
}
|
|
4981
|
-
|
|
4982
|
+
bgShadowLayer = bgLayers.join("");
|
|
4983
|
+
textShadowLayer = textLayers.join("");
|
|
4982
4984
|
}
|
|
4983
4985
|
const openTagMatch = svg.match(/^\s*<g\b[^>]*>/);
|
|
4984
|
-
const inserted =
|
|
4986
|
+
const inserted = bgShadowLayer + bgPath + textShadowLayer;
|
|
4985
4987
|
if (openTagMatch) {
|
|
4986
4988
|
const openTag = openTagMatch[0];
|
|
4987
4989
|
return svg.replace(openTag, openTag + inserted);
|
|
@@ -12360,7 +12362,7 @@ function PixldocsPreview(props) {
|
|
|
12360
12362
|
!canvasSettled && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
|
|
12361
12363
|
] });
|
|
12362
12364
|
}
|
|
12363
|
-
const PACKAGE_VERSION = "0.5.
|
|
12365
|
+
const PACKAGE_VERSION = "0.5.45";
|
|
12364
12366
|
let __underlineFixInstalled = false;
|
|
12365
12367
|
function installUnderlineFix(fab) {
|
|
12366
12368
|
var _a;
|