canvu-react 0.4.37 → 0.4.38

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/native.d.cts CHANGED
@@ -373,6 +373,7 @@ type SvgPathNode = {
373
373
  readonly strokeOpacity?: number;
374
374
  readonly strokeLinecap?: string;
375
375
  readonly strokeLinejoin?: string;
376
+ readonly strokeDasharray?: string;
376
377
  readonly shapeRendering?: string;
377
378
  readonly vectorEffect?: string;
378
379
  };
package/dist/native.d.ts CHANGED
@@ -373,6 +373,7 @@ type SvgPathNode = {
373
373
  readonly strokeOpacity?: number;
374
374
  readonly strokeLinecap?: string;
375
375
  readonly strokeLinejoin?: string;
376
+ readonly strokeDasharray?: string;
376
377
  readonly shapeRendering?: string;
377
378
  readonly vectorEffect?: string;
378
379
  };
package/dist/native.js CHANGED
@@ -1713,6 +1713,11 @@ function rgbaFromHexAndOpacity(hex, opacity) {
1713
1713
  function toNum(v) {
1714
1714
  return typeof v === "number" ? v : Number(v) || 0;
1715
1715
  }
1716
+ function dashIntervalsFromStrokeDasharray(strokeDasharray) {
1717
+ if (!strokeDasharray) return null;
1718
+ const intervals = strokeDasharray.split(/[\s,]+/).map((part) => Number(part)).filter((part) => Number.isFinite(part) && part > 0);
1719
+ return intervals.length > 0 ? intervals : null;
1720
+ }
1716
1721
  function SvgNodeRenderer({ nodes }) {
1717
1722
  return /* @__PURE__ */ jsx(Fragment, { children: nodes.map((node, i) => /* @__PURE__ */ jsx(SvgNodeItem, { node }, i)) });
1718
1723
  }
@@ -1827,6 +1832,7 @@ function SvgNodeItem({ node }) {
1827
1832
  const stroke = rgbaFromHexAndOpacity(node.stroke, node.strokeOpacity);
1828
1833
  const fill = isFill ? rgbaFromHexAndOpacity(node.fill, node.fillOpacity) ?? node.fill : void 0;
1829
1834
  const style = fill && fill !== "none" ? "fill" : "stroke";
1835
+ const intervals = style === "stroke" ? dashIntervalsFromStrokeDasharray(node.strokeDasharray) : null;
1830
1836
  return /* @__PURE__ */ jsx(
1831
1837
  Path,
1832
1838
  {
@@ -1837,7 +1843,8 @@ function SvgNodeItem({ node }) {
1837
1843
  strokeCap: node.strokeLinecap === "round" ? "round" : "butt",
1838
1844
  strokeJoin: node.strokeLinejoin === "round" ? "round" : "miter",
1839
1845
  fillType: node.fillRule === "evenodd" ? "evenOdd" : "winding",
1840
- antiAlias: true
1846
+ antiAlias: true,
1847
+ children: intervals ? /* @__PURE__ */ jsx(DashPathEffect, { intervals }) : null
1841
1848
  }
1842
1849
  );
1843
1850
  }
@@ -2020,6 +2027,7 @@ function parsePathNode(attrs) {
2020
2027
  strokeOpacity: parseNumOpt(attrs["stroke-opacity"]),
2021
2028
  strokeLinecap: attrs["stroke-linecap"],
2022
2029
  strokeLinejoin: attrs["stroke-linejoin"],
2030
+ strokeDasharray: attrs["stroke-dasharray"],
2023
2031
  shapeRendering: attrs["shape-rendering"],
2024
2032
  vectorEffect: attrs["vector-effect"]
2025
2033
  };
@@ -2644,7 +2652,7 @@ function pointsToSmoothPathD(points) {
2644
2652
  const d = smoothFreehandPointsToPathD(points);
2645
2653
  return d || null;
2646
2654
  }
2647
- function dashIntervalsFromStrokeDasharray(strokeDasharray) {
2655
+ function dashIntervalsFromStrokeDasharray2(strokeDasharray) {
2648
2656
  if (!strokeDasharray) return null;
2649
2657
  const intervals = strokeDasharray.split(/\s+/).map((part) => Number(part)).filter((part) => Number.isFinite(part) && part > 0);
2650
2658
  return intervals.length > 0 ? intervals : null;
@@ -2934,7 +2942,7 @@ function NativeInteractionOverlay({
2934
2942
  );
2935
2943
  }
2936
2944
  if (payload.kind === "strokePath") {
2937
- const intervals = dashIntervalsFromStrokeDasharray(payload.strokeDasharray);
2945
+ const intervals = dashIntervalsFromStrokeDasharray2(payload.strokeDasharray);
2938
2946
  return /* @__PURE__ */ jsx(
2939
2947
  Path,
2940
2948
  {