@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.d.ts CHANGED
@@ -221,7 +221,7 @@ export declare function normalizeFontFamily(fontStack: string): string;
221
221
  * Package version banner. Bump alongside package.json so we can confirm
222
222
  * (via browser:log) that the deployed bundle matches the expected build.
223
223
  */
224
- export declare const PACKAGE_VERSION = "0.5.44";
224
+ export declare const PACKAGE_VERSION = "0.5.45";
225
225
 
226
226
  export declare interface PageSettings {
227
227
  backgroundColor?: string;
package/dist/index.js CHANGED
@@ -4919,7 +4919,8 @@ function applyTextBackground(obj, cfg) {
4919
4919
  const bgPath = hasBg ? `<path d="${bgD}" fill="${escapeXmlAttr(bgFill)}" />` : "";
4920
4920
  svg = svg.replace(/style="[^"]*filter:\s*url\([^)]+\)[^"]*"/i, "");
4921
4921
  svg = svg.replace(/<filter[\s\S]*?<\/filter>/gi, "");
4922
- let shadowLayer = "";
4922
+ let bgShadowLayer = "";
4923
+ let textShadowLayer = "";
4923
4924
  if (hasShadow) {
4924
4925
  const ox = Number(shadow.offsetX ?? 0) || 0;
4925
4926
  const oy = Number(shadow.offsetY ?? 0) || 0;
@@ -4928,7 +4929,13 @@ function applyTextBackground(obj, cfg) {
4928
4929
  const shadowBgPath = hasBg ? `<path d="${bgD}" fill="${escapeXmlAttr(shadowColor)}" />` : "";
4929
4930
  const inner = extractGInnerMarkup(svg);
4930
4931
  const recoloredText = recolorSvgFills(inner, shadowColor);
4931
- const layers = [];
4932
+ const bgLayers = [];
4933
+ const textLayers = [];
4934
+ const pushShadowPass = (tx, ty, opacity) => {
4935
+ const attrs = `transform="translate(${tx.toFixed(3)} ${ty.toFixed(3)})"${opacity ? ` opacity="${opacity}"` : ""}`;
4936
+ if (shadowBgPath) bgLayers.push(`<g ${attrs}>${shadowBgPath}</g>`);
4937
+ if (recoloredText) textLayers.push(`<g ${attrs}>${recoloredText}</g>`);
4938
+ };
4932
4939
  if (blur > 0) {
4933
4940
  const ringCount = Math.min(6, Math.max(2, Math.round(blur / 2)));
4934
4941
  for (let i = 1; i <= ringCount; i++) {
@@ -4946,23 +4953,18 @@ function applyTextBackground(obj, cfg) {
4946
4953
  [-dist * 0.7, -dist * 0.7]
4947
4954
  ];
4948
4955
  for (const [dx, dy] of ringOffsets) {
4949
- layers.push(
4950
- `<g transform="translate(${(ox + dx).toFixed(3)} ${(oy + dy).toFixed(3)})" opacity="${op}">${shadowBgPath}${recoloredText}</g>`
4951
- );
4956
+ pushShadowPass(ox + dx, oy + dy, op);
4952
4957
  }
4953
4958
  }
4954
- layers.push(
4955
- `<g transform="translate(${ox.toFixed(3)} ${oy.toFixed(3)})" opacity="0.25">${shadowBgPath}${recoloredText}</g>`
4956
- );
4959
+ pushShadowPass(ox, oy, "0.25");
4957
4960
  } else {
4958
- layers.push(
4959
- `<g transform="translate(${ox.toFixed(3)} ${oy.toFixed(3)})">${shadowBgPath}${recoloredText}</g>`
4960
- );
4961
+ pushShadowPass(ox, oy);
4961
4962
  }
4962
- shadowLayer = layers.join("");
4963
+ bgShadowLayer = bgLayers.join("");
4964
+ textShadowLayer = textLayers.join("");
4963
4965
  }
4964
4966
  const openTagMatch = svg.match(/^\s*<g\b[^>]*>/);
4965
- const inserted = shadowLayer + bgPath;
4967
+ const inserted = bgShadowLayer + bgPath + textShadowLayer;
4966
4968
  if (openTagMatch) {
4967
4969
  const openTag = openTagMatch[0];
4968
4970
  return svg.replace(openTag, openTag + inserted);
@@ -12341,7 +12343,7 @@ function PixldocsPreview(props) {
12341
12343
  !canvasSettled && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
12342
12344
  ] });
12343
12345
  }
12344
- const PACKAGE_VERSION = "0.5.44";
12346
+ const PACKAGE_VERSION = "0.5.45";
12345
12347
  let __underlineFixInstalled = false;
12346
12348
  function installUnderlineFix(fab) {
12347
12349
  var _a;