canvu-react 0.4.37 → 0.4.39

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
  };
@@ -2178,6 +2186,11 @@ function rgba(hex, alpha) {
2178
2186
  if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) return hex;
2179
2187
  return `rgba(${r},${g},${b},${alpha})`;
2180
2188
  }
2189
+ function dashIntervalsFromStrokeDasharray2(strokeDasharray) {
2190
+ if (!strokeDasharray) return null;
2191
+ const intervals = strokeDasharray.split(/[\s,]+/).map((part) => Number(part)).filter((part) => Number.isFinite(part) && part > 0);
2192
+ return intervals.length > 0 ? intervals : null;
2193
+ }
2181
2194
  function localBounds(bounds) {
2182
2195
  const b = normalizeRect(bounds);
2183
2196
  return { w: Math.max(0, b.width), h: Math.max(0, b.height) };
@@ -2467,6 +2480,7 @@ function NativeShapeRenderer({ item }) {
2467
2480
  }
2468
2481
  );
2469
2482
  }
2483
+ const intervals = dashIntervalsFromStrokeDasharray2(payload.strokeDasharray);
2470
2484
  return /* @__PURE__ */ jsxRuntime.jsx(
2471
2485
  reactNativeSkia.Path,
2472
2486
  {
@@ -2476,7 +2490,8 @@ function NativeShapeRenderer({ item }) {
2476
2490
  strokeWidth: payload.strokeWidth,
2477
2491
  strokeCap: "round",
2478
2492
  strokeJoin: "round",
2479
- antiAlias: true
2493
+ antiAlias: true,
2494
+ children: intervals ? /* @__PURE__ */ jsxRuntime.jsx(reactNativeSkia.DashPathEffect, { intervals }) : null
2480
2495
  }
2481
2496
  );
2482
2497
  }
@@ -2650,7 +2665,7 @@ function pointsToSmoothPathD(points) {
2650
2665
  const d = smoothFreehandPointsToPathD(points);
2651
2666
  return d || null;
2652
2667
  }
2653
- function dashIntervalsFromStrokeDasharray(strokeDasharray) {
2668
+ function dashIntervalsFromStrokeDasharray3(strokeDasharray) {
2654
2669
  if (!strokeDasharray) return null;
2655
2670
  const intervals = strokeDasharray.split(/\s+/).map((part) => Number(part)).filter((part) => Number.isFinite(part) && part > 0);
2656
2671
  return intervals.length > 0 ? intervals : null;
@@ -2940,7 +2955,7 @@ function NativeInteractionOverlay({
2940
2955
  );
2941
2956
  }
2942
2957
  if (payload.kind === "strokePath") {
2943
- const intervals = dashIntervalsFromStrokeDasharray(payload.strokeDasharray);
2958
+ const intervals = dashIntervalsFromStrokeDasharray3(payload.strokeDasharray);
2944
2959
  return /* @__PURE__ */ jsxRuntime.jsx(
2945
2960
  reactNativeSkia.Path,
2946
2961
  {