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.cjs CHANGED
@@ -1719,6 +1719,11 @@ function rgbaFromHexAndOpacity(hex, opacity) {
1719
1719
  function toNum(v) {
1720
1720
  return typeof v === "number" ? v : Number(v) || 0;
1721
1721
  }
1722
+ function dashIntervalsFromStrokeDasharray(strokeDasharray) {
1723
+ if (!strokeDasharray) return null;
1724
+ const intervals = strokeDasharray.split(/[\s,]+/).map((part) => Number(part)).filter((part) => Number.isFinite(part) && part > 0);
1725
+ return intervals.length > 0 ? intervals : null;
1726
+ }
1722
1727
  function SvgNodeRenderer({ nodes }) {
1723
1728
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: nodes.map((node, i) => /* @__PURE__ */ jsxRuntime.jsx(SvgNodeItem, { node }, i)) });
1724
1729
  }
@@ -1833,6 +1838,7 @@ function SvgNodeItem({ node }) {
1833
1838
  const stroke = rgbaFromHexAndOpacity(node.stroke, node.strokeOpacity);
1834
1839
  const fill = isFill ? rgbaFromHexAndOpacity(node.fill, node.fillOpacity) ?? node.fill : void 0;
1835
1840
  const style = fill && fill !== "none" ? "fill" : "stroke";
1841
+ const intervals = style === "stroke" ? dashIntervalsFromStrokeDasharray(node.strokeDasharray) : null;
1836
1842
  return /* @__PURE__ */ jsxRuntime.jsx(
1837
1843
  reactNativeSkia.Path,
1838
1844
  {
@@ -1843,7 +1849,8 @@ function SvgNodeItem({ node }) {
1843
1849
  strokeCap: node.strokeLinecap === "round" ? "round" : "butt",
1844
1850
  strokeJoin: node.strokeLinejoin === "round" ? "round" : "miter",
1845
1851
  fillType: node.fillRule === "evenodd" ? "evenOdd" : "winding",
1846
- antiAlias: true
1852
+ antiAlias: true,
1853
+ children: intervals ? /* @__PURE__ */ jsxRuntime.jsx(reactNativeSkia.DashPathEffect, { intervals }) : null
1847
1854
  }
1848
1855
  );
1849
1856
  }
@@ -2026,6 +2033,7 @@ function parsePathNode(attrs) {
2026
2033
  strokeOpacity: parseNumOpt(attrs["stroke-opacity"]),
2027
2034
  strokeLinecap: attrs["stroke-linecap"],
2028
2035
  strokeLinejoin: attrs["stroke-linejoin"],
2036
+ strokeDasharray: attrs["stroke-dasharray"],
2029
2037
  shapeRendering: attrs["shape-rendering"],
2030
2038
  vectorEffect: attrs["vector-effect"]
2031
2039
  };
@@ -2650,7 +2658,7 @@ function pointsToSmoothPathD(points) {
2650
2658
  const d = smoothFreehandPointsToPathD(points);
2651
2659
  return d || null;
2652
2660
  }
2653
- function dashIntervalsFromStrokeDasharray(strokeDasharray) {
2661
+ function dashIntervalsFromStrokeDasharray2(strokeDasharray) {
2654
2662
  if (!strokeDasharray) return null;
2655
2663
  const intervals = strokeDasharray.split(/\s+/).map((part) => Number(part)).filter((part) => Number.isFinite(part) && part > 0);
2656
2664
  return intervals.length > 0 ? intervals : null;
@@ -2940,7 +2948,7 @@ function NativeInteractionOverlay({
2940
2948
  );
2941
2949
  }
2942
2950
  if (payload.kind === "strokePath") {
2943
- const intervals = dashIntervalsFromStrokeDasharray(payload.strokeDasharray);
2951
+ const intervals = dashIntervalsFromStrokeDasharray2(payload.strokeDasharray);
2944
2952
  return /* @__PURE__ */ jsxRuntime.jsx(
2945
2953
  reactNativeSkia.Path,
2946
2954
  {