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 +19 -4
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +1 -0
- package/dist/native.d.ts +1 -0
- package/dist/native.js +19 -4
- package/dist/native.js.map +1 -1
- package/package.json +1 -1
package/dist/native.d.cts
CHANGED
package/dist/native.d.ts
CHANGED
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
|
};
|
|
@@ -2172,6 +2180,11 @@ function rgba(hex, alpha) {
|
|
|
2172
2180
|
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) return hex;
|
|
2173
2181
|
return `rgba(${r},${g},${b},${alpha})`;
|
|
2174
2182
|
}
|
|
2183
|
+
function dashIntervalsFromStrokeDasharray2(strokeDasharray) {
|
|
2184
|
+
if (!strokeDasharray) return null;
|
|
2185
|
+
const intervals = strokeDasharray.split(/[\s,]+/).map((part) => Number(part)).filter((part) => Number.isFinite(part) && part > 0);
|
|
2186
|
+
return intervals.length > 0 ? intervals : null;
|
|
2187
|
+
}
|
|
2175
2188
|
function localBounds(bounds) {
|
|
2176
2189
|
const b = normalizeRect(bounds);
|
|
2177
2190
|
return { w: Math.max(0, b.width), h: Math.max(0, b.height) };
|
|
@@ -2461,6 +2474,7 @@ function NativeShapeRenderer({ item }) {
|
|
|
2461
2474
|
}
|
|
2462
2475
|
);
|
|
2463
2476
|
}
|
|
2477
|
+
const intervals = dashIntervalsFromStrokeDasharray2(payload.strokeDasharray);
|
|
2464
2478
|
return /* @__PURE__ */ jsx(
|
|
2465
2479
|
Path,
|
|
2466
2480
|
{
|
|
@@ -2470,7 +2484,8 @@ function NativeShapeRenderer({ item }) {
|
|
|
2470
2484
|
strokeWidth: payload.strokeWidth,
|
|
2471
2485
|
strokeCap: "round",
|
|
2472
2486
|
strokeJoin: "round",
|
|
2473
|
-
antiAlias: true
|
|
2487
|
+
antiAlias: true,
|
|
2488
|
+
children: intervals ? /* @__PURE__ */ jsx(DashPathEffect, { intervals }) : null
|
|
2474
2489
|
}
|
|
2475
2490
|
);
|
|
2476
2491
|
}
|
|
@@ -2644,7 +2659,7 @@ function pointsToSmoothPathD(points) {
|
|
|
2644
2659
|
const d = smoothFreehandPointsToPathD(points);
|
|
2645
2660
|
return d || null;
|
|
2646
2661
|
}
|
|
2647
|
-
function
|
|
2662
|
+
function dashIntervalsFromStrokeDasharray3(strokeDasharray) {
|
|
2648
2663
|
if (!strokeDasharray) return null;
|
|
2649
2664
|
const intervals = strokeDasharray.split(/\s+/).map((part) => Number(part)).filter((part) => Number.isFinite(part) && part > 0);
|
|
2650
2665
|
return intervals.length > 0 ? intervals : null;
|
|
@@ -2934,7 +2949,7 @@ function NativeInteractionOverlay({
|
|
|
2934
2949
|
);
|
|
2935
2950
|
}
|
|
2936
2951
|
if (payload.kind === "strokePath") {
|
|
2937
|
-
const intervals =
|
|
2952
|
+
const intervals = dashIntervalsFromStrokeDasharray3(payload.strokeDasharray);
|
|
2938
2953
|
return /* @__PURE__ */ jsx(
|
|
2939
2954
|
Path,
|
|
2940
2955
|
{
|