@pixldocs/canvas-renderer 0.5.79 → 0.5.80

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 CHANGED
@@ -5224,6 +5224,17 @@ const stringifyDiag = (payload) => {
5224
5224
  return String(payload);
5225
5225
  }
5226
5226
  };
5227
+ function hasAnyCharStyleFlag(styles, flag) {
5228
+ if (!styles || typeof styles !== "object") return void 0;
5229
+ const lineEntries = Array.isArray(styles) ? styles : Object.values(styles);
5230
+ for (const lineStyle of lineEntries) {
5231
+ if (!lineStyle || typeof lineStyle !== "object") continue;
5232
+ for (const charStyle of Object.values(lineStyle)) {
5233
+ if (charStyle && charStyle[flag] === true) return true;
5234
+ }
5235
+ }
5236
+ return void 0;
5237
+ }
5227
5238
  function buildRoundedRectPath(w, h, tl, tr, br, bl) {
5228
5239
  return buildRoundedRectPath$1(w, h, getRoundedRectRadii(w, h, { rxTL: tl, rxTR: tr, rxBR: br, rxBL: bl }));
5229
5240
  }
@@ -5463,13 +5474,14 @@ function createText(element) {
5463
5474
  fontWeight: element.fontWeight || 400,
5464
5475
  textAlign: element.textAlign || "left",
5465
5476
  fontStyle: element.fontStyle || "normal",
5466
- underline: element.underline ?? false,
5467
- linethrough: element.linethrough ?? false,
5477
+ underline: element.underline ?? hasAnyCharStyleFlag(element.styles, "underline") ?? false,
5478
+ linethrough: element.linethrough ?? hasAnyCharStyleFlag(element.styles, "linethrough") ?? false,
5468
5479
  lineHeight: element.lineHeight || 1.2,
5469
5480
  charSpacing: element.charSpacing || 0,
5470
5481
  objectCaching: false,
5471
5482
  noScaleCache: true,
5472
- splitByGrapheme
5483
+ splitByGrapheme,
5484
+ ...element.styles ? { styles: element.styles } : {}
5473
5485
  });
5474
5486
  textbox.initDimensions();
5475
5487
  textbox.set({
@@ -12597,7 +12609,7 @@ function PixldocsPreview(props) {
12597
12609
  !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..." }) })
12598
12610
  ] });
12599
12611
  }
12600
- const PACKAGE_VERSION = "0.5.79";
12612
+ const PACKAGE_VERSION = "0.5.80";
12601
12613
  const roundParityValue = (value) => {
12602
12614
  if (typeof value !== "number") return value;
12603
12615
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;