@ledgerhq/lumen-ui-react-visualization 0.1.1 → 0.1.3
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/lib/Components/CartesianChart/CartesianChart.d.ts +3 -0
- package/dist/lib/Components/CartesianChart/CartesianChart.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/CartesianChart.js +70 -0
- package/dist/lib/Components/CartesianChart/context/cartesianChartContext.d.ts +8 -0
- package/dist/lib/Components/CartesianChart/context/cartesianChartContext.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/context/cartesianChartContext.js +9 -0
- package/dist/lib/Components/CartesianChart/context/index.d.ts +3 -0
- package/dist/lib/Components/CartesianChart/context/index.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/context/useBuildChartContext.d.ts +23 -0
- package/dist/lib/Components/CartesianChart/context/useBuildChartContext.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/context/useBuildChartContext.js +61 -0
- package/dist/lib/Components/CartesianChart/index.d.ts +4 -0
- package/dist/lib/Components/CartesianChart/index.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/types.d.ts +48 -0
- package/dist/lib/Components/CartesianChart/types.d.ts.map +1 -0
- package/dist/lib/Components/Line/Line.d.ts +3 -0
- package/dist/lib/Components/Line/Line.d.ts.map +1 -0
- package/dist/lib/Components/Line/Line.js +53 -0
- package/dist/lib/Components/Line/index.d.ts +3 -0
- package/dist/lib/Components/Line/index.d.ts.map +1 -0
- package/dist/lib/Components/Line/types.d.ts +24 -0
- package/dist/lib/Components/Line/types.d.ts.map +1 -0
- package/dist/lib/Components/Line/utils.d.ts +19 -0
- package/dist/lib/Components/Line/utils.d.ts.map +1 -0
- package/dist/lib/Components/Line/utils.js +22 -0
- package/dist/lib/Components/LineChart/LineChart.d.ts +2 -8
- package/dist/lib/Components/LineChart/LineChart.d.ts.map +1 -1
- package/dist/lib/Components/LineChart/LineChart.js +78 -23
- package/dist/lib/Components/LineChart/index.d.ts +1 -0
- package/dist/lib/Components/LineChart/index.d.ts.map +1 -1
- package/dist/lib/Components/LineChart/types.d.ts +61 -0
- package/dist/lib/Components/LineChart/types.d.ts.map +1 -0
- package/dist/lib/Components/XAxis/XAxis.d.ts +4 -0
- package/dist/lib/Components/XAxis/XAxis.d.ts.map +1 -0
- package/dist/lib/Components/XAxis/XAxis.js +79 -0
- package/dist/lib/Components/XAxis/index.d.ts +3 -0
- package/dist/lib/Components/XAxis/index.d.ts.map +1 -0
- package/dist/lib/Components/XAxis/types.d.ts +3 -0
- package/dist/lib/Components/XAxis/types.d.ts.map +1 -0
- package/dist/lib/Components/YAxis/YAxis.d.ts +4 -0
- package/dist/lib/Components/YAxis/YAxis.d.ts.map +1 -0
- package/dist/lib/Components/YAxis/YAxis.js +79 -0
- package/dist/lib/Components/YAxis/index.d.ts +3 -0
- package/dist/lib/Components/YAxis/index.d.ts.map +1 -0
- package/dist/lib/Components/YAxis/types.d.ts +3 -0
- package/dist/lib/Components/YAxis/types.d.ts.map +1 -0
- package/dist/lib/utils/domain/domain.d.ts +17 -0
- package/dist/lib/utils/domain/domain.d.ts.map +1 -0
- package/dist/lib/utils/domain/domain.js +38 -0
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/scales/scales.d.ts +24 -0
- package/dist/lib/utils/scales/scales.d.ts.map +1 -0
- package/dist/lib/utils/scales/scales.js +25 -0
- package/dist/lib/utils/ticks/ticks.d.ts +27 -0
- package/dist/lib/utils/ticks/ticks.d.ts.map +1 -0
- package/dist/lib/utils/ticks/ticks.js +23 -0
- package/dist/lib/utils/types.d.ts +132 -6
- package/dist/lib/utils/types.d.ts.map +1 -1
- package/dist/libs/utils-shared/dist/index.js +35 -0
- package/dist/node_modules/d3-array/src/ascending.js +6 -0
- package/dist/node_modules/d3-array/src/bisect.js +9 -0
- package/dist/node_modules/d3-array/src/bisector.js +37 -0
- package/dist/node_modules/d3-array/src/descending.js +6 -0
- package/dist/node_modules/d3-array/src/number.js +6 -0
- package/dist/node_modules/d3-array/src/range.js +9 -0
- package/dist/node_modules/d3-array/src/ticks.js +32 -0
- package/dist/node_modules/d3-color/src/color.js +305 -0
- package/dist/node_modules/d3-color/src/define.js +12 -0
- package/dist/node_modules/d3-format/src/defaultLocale.js +15 -0
- package/dist/node_modules/d3-format/src/exponent.js +7 -0
- package/dist/node_modules/d3-format/src/formatDecimal.js +15 -0
- package/dist/node_modules/d3-format/src/formatGroup.js +10 -0
- package/dist/node_modules/d3-format/src/formatNumerals.js +10 -0
- package/dist/node_modules/d3-format/src/formatPrefixAuto.js +12 -0
- package/dist/node_modules/d3-format/src/formatRounded.js +10 -0
- package/dist/node_modules/d3-format/src/formatSpecifier.js +28 -0
- package/dist/node_modules/d3-format/src/formatTrim.js +19 -0
- package/dist/node_modules/d3-format/src/formatTypes.js +21 -0
- package/dist/node_modules/d3-format/src/identity.js +6 -0
- package/dist/node_modules/d3-format/src/locale.js +68 -0
- package/dist/node_modules/d3-format/src/precisionFixed.js +7 -0
- package/dist/node_modules/d3-format/src/precisionPrefix.js +7 -0
- package/dist/node_modules/d3-format/src/precisionRound.js +7 -0
- package/dist/node_modules/d3-interpolate/src/array.js +13 -0
- package/dist/node_modules/d3-interpolate/src/color.js +24 -0
- package/dist/node_modules/d3-interpolate/src/constant.js +4 -0
- package/dist/node_modules/d3-interpolate/src/date.js +9 -0
- package/dist/node_modules/d3-interpolate/src/number.js +8 -0
- package/dist/node_modules/d3-interpolate/src/numberArray.js +15 -0
- package/dist/node_modules/d3-interpolate/src/object.js +14 -0
- package/dist/node_modules/d3-interpolate/src/rgb.js +15 -0
- package/dist/node_modules/d3-interpolate/src/round.js +8 -0
- package/dist/node_modules/d3-interpolate/src/string.js +24 -0
- package/dist/node_modules/d3-interpolate/src/value.js +16 -0
- package/dist/node_modules/d3-path/src/path.js +64 -0
- package/dist/node_modules/d3-scale/src/band.js +41 -0
- package/dist/node_modules/d3-scale/src/constant.js +8 -0
- package/dist/node_modules/d3-scale/src/continuous.js +75 -0
- package/dist/node_modules/d3-scale/src/init.js +16 -0
- package/dist/node_modules/d3-scale/src/linear.js +39 -0
- package/dist/node_modules/d3-scale/src/log.js +86 -0
- package/dist/node_modules/d3-scale/src/nice.js +8 -0
- package/dist/node_modules/d3-scale/src/number.js +6 -0
- package/dist/node_modules/d3-scale/src/ordinal.js +31 -0
- package/dist/node_modules/d3-scale/src/tickFormat.js +32 -0
- package/dist/node_modules/d3-shape/src/area.js +56 -0
- package/dist/node_modules/d3-shape/src/array.js +6 -0
- package/dist/node_modules/d3-shape/src/constant.js +8 -0
- package/dist/node_modules/d3-shape/src/curve/bump.js +39 -0
- package/dist/node_modules/d3-shape/src/curve/linear.js +36 -0
- package/dist/node_modules/d3-shape/src/line.js +29 -0
- package/dist/node_modules/d3-shape/src/path.js +18 -0
- package/dist/node_modules/d3-shape/src/point.js +10 -0
- package/dist/node_modules/internmap/src/index.js +35 -0
- package/dist/package.json +14 -2
- package/package.json +14 -2
- package/dist/lib/utils/math/index.d.ts +0 -1
- package/dist/lib/utils/math/index.d.ts.map +0 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsxs as b, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as T } from "react";
|
|
3
|
+
import { buildTicksData as v } from "../../utils/ticks/ticks.js";
|
|
4
|
+
import { useCartesianChartContext as C } from "../CartesianChart/context/cartesianChartContext.js";
|
|
5
|
+
const l = 1, y = 4, E = 6, $ = 28;
|
|
6
|
+
function k({
|
|
7
|
+
position: n = "bottom",
|
|
8
|
+
showGrid: c = !1,
|
|
9
|
+
showLine: h = !1,
|
|
10
|
+
showTickMark: p = !1,
|
|
11
|
+
ticks: d,
|
|
12
|
+
tickLabelFormatter: x
|
|
13
|
+
}) {
|
|
14
|
+
const { getXScale: f, getXAxisConfig: g, drawingArea: e } = C(), i = f(), m = g(), a = T(
|
|
15
|
+
() => i ? v(i, m, d, x) : [],
|
|
16
|
+
[i, m, d, x]
|
|
17
|
+
);
|
|
18
|
+
if (!i || e.width <= 0)
|
|
19
|
+
return null;
|
|
20
|
+
const s = n === "top" ? e.y : e.y + e.height, u = n === "top" ? -1 : 1, A = s + u * (y + E);
|
|
21
|
+
return /* @__PURE__ */ b("g", { "data-testid": "x-axis", children: [
|
|
22
|
+
c && a.map((t, o) => /* @__PURE__ */ r(
|
|
23
|
+
"line",
|
|
24
|
+
{
|
|
25
|
+
x1: t.position,
|
|
26
|
+
y1: e.y,
|
|
27
|
+
x2: t.position,
|
|
28
|
+
y2: e.y + e.height,
|
|
29
|
+
style: { stroke: "var(--border-muted-subtle)" },
|
|
30
|
+
strokeWidth: l,
|
|
31
|
+
strokeDasharray: "2 2"
|
|
32
|
+
},
|
|
33
|
+
`grid-${t.value}-${o}`
|
|
34
|
+
)),
|
|
35
|
+
h && /* @__PURE__ */ r(
|
|
36
|
+
"line",
|
|
37
|
+
{
|
|
38
|
+
x1: e.x,
|
|
39
|
+
y1: s,
|
|
40
|
+
x2: e.x + e.width,
|
|
41
|
+
y2: s,
|
|
42
|
+
style: { stroke: "var(--border-muted)" },
|
|
43
|
+
strokeWidth: l,
|
|
44
|
+
shapeRendering: "crispEdges",
|
|
45
|
+
strokeLinecap: "square"
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
p && a.map((t, o) => /* @__PURE__ */ r(
|
|
49
|
+
"line",
|
|
50
|
+
{
|
|
51
|
+
x1: t.position,
|
|
52
|
+
y1: s,
|
|
53
|
+
x2: t.position,
|
|
54
|
+
y2: s + u * y,
|
|
55
|
+
style: { stroke: "var(--border-muted)" },
|
|
56
|
+
strokeWidth: l
|
|
57
|
+
},
|
|
58
|
+
`tick-${t.value}-${o}`
|
|
59
|
+
)),
|
|
60
|
+
a.map((t, o) => /* @__PURE__ */ r(
|
|
61
|
+
"text",
|
|
62
|
+
{
|
|
63
|
+
x: t.position,
|
|
64
|
+
y: A,
|
|
65
|
+
textAnchor: "middle",
|
|
66
|
+
dominantBaseline: n === "top" ? "auto" : "hanging",
|
|
67
|
+
style: { fill: "var(--text-muted)" },
|
|
68
|
+
fontSize: 11,
|
|
69
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
70
|
+
children: t.label
|
|
71
|
+
},
|
|
72
|
+
`label-${t.value}-${o}`
|
|
73
|
+
))
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
$ as DEFAULT_AXIS_HEIGHT,
|
|
78
|
+
k as XAxis
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/XAxis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/XAxis/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { YAxisProps } from './types';
|
|
2
|
+
export declare const DEFAULT_AXIS_WIDTH = 40;
|
|
3
|
+
export declare function YAxis({ position, showGrid, showLine, showTickMark, ticks: ticksProp, tickLabelFormatter, }: YAxisProps): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
//# sourceMappingURL=YAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YAxis.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/YAxis/YAxis.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAK1C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,wBAAgB,KAAK,CAAC,EACpB,QAAkB,EAClB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAkFZ"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsxs as T, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as b } from "react";
|
|
3
|
+
import { buildTicksData as v } from "../../utils/ticks/ticks.js";
|
|
4
|
+
import { useCartesianChartContext as C } from "../CartesianChart/context/cartesianChartContext.js";
|
|
5
|
+
const l = 1, m = 4, D = 6, $ = 40;
|
|
6
|
+
function k({
|
|
7
|
+
position: o = "start",
|
|
8
|
+
showGrid: u = !1,
|
|
9
|
+
showLine: f = !1,
|
|
10
|
+
showTickMark: h = !1,
|
|
11
|
+
ticks: d,
|
|
12
|
+
tickLabelFormatter: x
|
|
13
|
+
}) {
|
|
14
|
+
const { getYScale: p, getYAxisConfig: g, drawingArea: e } = C(), a = p(), y = g(), n = b(
|
|
15
|
+
() => a ? v(a, y, d, x) : [],
|
|
16
|
+
[a, y, d, x]
|
|
17
|
+
);
|
|
18
|
+
if (!a || e.height <= 0)
|
|
19
|
+
return null;
|
|
20
|
+
const s = o === "start" ? e.x : e.x + e.width, c = o === "start" ? -1 : 1, A = s + c * (m + D);
|
|
21
|
+
return /* @__PURE__ */ T("g", { "data-testid": "y-axis", children: [
|
|
22
|
+
u && n.map((t, r) => /* @__PURE__ */ i(
|
|
23
|
+
"line",
|
|
24
|
+
{
|
|
25
|
+
x1: e.x,
|
|
26
|
+
y1: t.position,
|
|
27
|
+
x2: e.x + e.width,
|
|
28
|
+
y2: t.position,
|
|
29
|
+
style: { stroke: "var(--border-muted-subtle)" },
|
|
30
|
+
strokeWidth: l,
|
|
31
|
+
strokeDasharray: "2 2"
|
|
32
|
+
},
|
|
33
|
+
`grid-${t.value}-${r}`
|
|
34
|
+
)),
|
|
35
|
+
f && /* @__PURE__ */ i(
|
|
36
|
+
"line",
|
|
37
|
+
{
|
|
38
|
+
x1: s,
|
|
39
|
+
y1: e.y,
|
|
40
|
+
x2: s,
|
|
41
|
+
y2: e.y + e.height,
|
|
42
|
+
style: { stroke: "var(--border-muted)" },
|
|
43
|
+
strokeWidth: l,
|
|
44
|
+
shapeRendering: "crispEdges",
|
|
45
|
+
strokeLinecap: "square"
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
h && n.map((t, r) => /* @__PURE__ */ i(
|
|
49
|
+
"line",
|
|
50
|
+
{
|
|
51
|
+
x1: s,
|
|
52
|
+
y1: t.position,
|
|
53
|
+
x2: s + c * m,
|
|
54
|
+
y2: t.position,
|
|
55
|
+
style: { stroke: "var(--border-muted)" },
|
|
56
|
+
strokeWidth: l
|
|
57
|
+
},
|
|
58
|
+
`tick-${t.value}-${r}`
|
|
59
|
+
)),
|
|
60
|
+
n.map((t, r) => /* @__PURE__ */ i(
|
|
61
|
+
"text",
|
|
62
|
+
{
|
|
63
|
+
x: A,
|
|
64
|
+
y: t.position,
|
|
65
|
+
textAnchor: o === "start" ? "end" : "start",
|
|
66
|
+
dominantBaseline: "central",
|
|
67
|
+
style: { fill: "var(--text-muted)" },
|
|
68
|
+
fontSize: 11,
|
|
69
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
70
|
+
children: t.label
|
|
71
|
+
},
|
|
72
|
+
`label-${t.value}-${r}`
|
|
73
|
+
))
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
$ as DEFAULT_AXIS_WIDTH,
|
|
78
|
+
k as YAxis
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/YAxis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/YAxis/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AxisBounds, AxisConfigProps, Series } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Compute the X domain (index-based) from series data and axis config.
|
|
4
|
+
* For the X axis the domain is typically 0..N-1 where N = longest series length,
|
|
5
|
+
* unless explicit `data` is provided on the axis config.
|
|
6
|
+
*/
|
|
7
|
+
export declare const computeXDomain: (series: Series[], axisConfig?: Partial<AxisConfigProps>) => AxisBounds;
|
|
8
|
+
/**
|
|
9
|
+
* Compute the Y domain (value-based) from series data and axis config.
|
|
10
|
+
* Scans all non-null values across all series to find min/max.
|
|
11
|
+
*/
|
|
12
|
+
export declare const computeYDomain: (series: Series[], axisConfig?: Partial<AxisConfigProps>) => AxisBounds;
|
|
13
|
+
/**
|
|
14
|
+
* Compute the data length (number of discrete positions on the index axis).
|
|
15
|
+
*/
|
|
16
|
+
export declare const computeDataLength: (series: Series[], axisConfig?: Partial<AxisConfigProps>) => number;
|
|
17
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/domain/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,eAAe,CAAC,KACpC,UA4BF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,eAAe,CAAC,KACpC,UAwBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,eAAe,CAAC,KACpC,MAKF,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const i = (m, t) => {
|
|
2
|
+
const n = t?.data;
|
|
3
|
+
let e;
|
|
4
|
+
if (n && n.length > 0)
|
|
5
|
+
if (typeof n[0] == "number") {
|
|
6
|
+
const l = n;
|
|
7
|
+
let u = l[0], o = l[0];
|
|
8
|
+
for (let a = 1; a < l.length; a += 1) {
|
|
9
|
+
const c = l[a];
|
|
10
|
+
c < u && (u = c), c > o && (o = c);
|
|
11
|
+
}
|
|
12
|
+
e = { min: u, max: o };
|
|
13
|
+
} else
|
|
14
|
+
e = { min: 0, max: n.length - 1 };
|
|
15
|
+
else {
|
|
16
|
+
const l = m.reduce(
|
|
17
|
+
(u, o) => Math.max(u, o.data?.length ?? 0),
|
|
18
|
+
0
|
|
19
|
+
);
|
|
20
|
+
e = { min: 0, max: Math.max(0, l - 1) };
|
|
21
|
+
}
|
|
22
|
+
return f(e, t?.domain);
|
|
23
|
+
}, r = (m, t) => {
|
|
24
|
+
let n = 0, e = 0, l = !1;
|
|
25
|
+
for (const o of m)
|
|
26
|
+
if (o.data)
|
|
27
|
+
for (const a of o.data)
|
|
28
|
+
a != null && (l ? (a < n && (n = a), a > e && (e = a)) : (n = a, e = a, l = !0));
|
|
29
|
+
return f(l ? { min: n, max: e } : { min: 0, max: 1 }, t?.domain);
|
|
30
|
+
}, s = (m, t) => t?.data && t.data.length > 0 ? t.data.length : m.reduce((n, e) => Math.max(n, e.data?.length ?? 0), 0), f = (m, t) => t ? typeof t == "function" ? t(m) : {
|
|
31
|
+
min: t.min ?? m.min,
|
|
32
|
+
max: t.max ?? m.max
|
|
33
|
+
} : m;
|
|
34
|
+
export {
|
|
35
|
+
s as computeDataLength,
|
|
36
|
+
i as computeXDomain,
|
|
37
|
+
r as computeYDomain
|
|
38
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type { AxisBounds, AxisConfigProps, CartesianChartContextValue, CategoricalScale, ChartInset, ChartScaleFunction, DrawingArea, NumericScale, Series, YAxisVisualProps, XAxisVisualProps, } from './types';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AxisBounds, AxisConfigProps, CategoricalScale, ChartScaleFunction, NumericScale } from '../types';
|
|
2
|
+
export declare const getNumericScale: ({ scaleType, domain, range, }: {
|
|
3
|
+
scaleType: "linear" | "log";
|
|
4
|
+
domain: AxisBounds;
|
|
5
|
+
range: AxisBounds;
|
|
6
|
+
}) => NumericScale;
|
|
7
|
+
export declare const getCategoricalScale: ({ domain, range, padding, }: {
|
|
8
|
+
domain: AxisBounds;
|
|
9
|
+
range: AxisBounds;
|
|
10
|
+
padding?: number;
|
|
11
|
+
}) => CategoricalScale;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a scale type config value refers to a band (categorical) scale.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isBandScaleType: (scaleType: AxisConfigProps["scaleType"]) => scaleType is "band";
|
|
16
|
+
/**
|
|
17
|
+
* Checks if a scale is a categorical scale.
|
|
18
|
+
*/
|
|
19
|
+
export declare const isCategoricalScale: (scale: ChartScaleFunction) => scale is CategoricalScale;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if a scale is a numeric scale.
|
|
22
|
+
*/
|
|
23
|
+
export declare const isNumericScale: (scale: ChartScaleFunction) => scale is NumericScale;
|
|
24
|
+
//# sourceMappingURL=scales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/scales/scales.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,eAAe,GAAI,+BAI7B;IACD,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;CACnB,KAAG,YAGH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,6BAIjC;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,gBAUH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,eAAe,CAAC,WAAW,CAAC,KACtC,SAAS,IAAI,MAA8B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,kBAAkB,KACxB,KAAK,IAAI,gBAEX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,kBAAkB,KACxB,KAAK,IAAI,YAEX,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import i from "../../../node_modules/d3-scale/src/band.js";
|
|
2
|
+
import o from "../../../node_modules/d3-scale/src/log.js";
|
|
3
|
+
import c from "../../../node_modules/d3-scale/src/linear.js";
|
|
4
|
+
const u = ({
|
|
5
|
+
scaleType: n,
|
|
6
|
+
domain: r,
|
|
7
|
+
range: t
|
|
8
|
+
}) => (n === "log" ? o() : c()).domain([r.min, r.max]).range([t.min, t.max]), p = ({
|
|
9
|
+
domain: n,
|
|
10
|
+
range: r,
|
|
11
|
+
padding: t = 0.1
|
|
12
|
+
}) => {
|
|
13
|
+
const a = Array.from(
|
|
14
|
+
{ length: n.max - n.min + 1 },
|
|
15
|
+
(l, e) => n.min + e
|
|
16
|
+
);
|
|
17
|
+
return i().domain(a).range([r.min, r.max]).paddingInner(t).paddingOuter(t / 2);
|
|
18
|
+
}, f = (n) => n === "band", m = (n) => "bandwidth" in n && typeof n.bandwidth == "function", x = (n) => !m(n);
|
|
19
|
+
export {
|
|
20
|
+
p as getCategoricalScale,
|
|
21
|
+
u as getNumericScale,
|
|
22
|
+
f as isBandScaleType,
|
|
23
|
+
m as isCategoricalScale,
|
|
24
|
+
x as isNumericScale
|
|
25
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AxisConfigProps, ChartScaleFunction } from '../types';
|
|
2
|
+
export declare const APPROXIMATE_TICK_COUNT = 5;
|
|
3
|
+
export type TickData = {
|
|
4
|
+
position: number;
|
|
5
|
+
value: number;
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Resolves which numeric tick values should appear on the axis.
|
|
10
|
+
* Explicit ticks take priority, then scale-specific defaults.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getTickValues: (scale: ChartScaleFunction, explicitTicks?: number[]) => number[];
|
|
13
|
+
/**
|
|
14
|
+
* Converts a tick value to its pixel position on the axis.
|
|
15
|
+
* Band scales are centered within the band.
|
|
16
|
+
*/
|
|
17
|
+
export declare const getTickPosition: (scale: ChartScaleFunction, tick: number) => number;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the display label for a tick value.
|
|
20
|
+
* Priority: formatter > string label lookup > raw value.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getTickLabel: (tick: number, axisData: AxisConfigProps["data"], formatter?: (value: number | string) => string) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Builds the complete tick data array from a scale and axis configuration.
|
|
25
|
+
*/
|
|
26
|
+
export declare const buildTicksData: (scale: ChartScaleFunction, axisConfig?: AxisConfigProps, explicitTicks?: number[], formatter?: (value: number | string) => string) => TickData[];
|
|
27
|
+
//# sourceMappingURL=ticks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticks.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/ticks/ticks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEpE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,kBAAkB,EACzB,gBAAgB,MAAM,EAAE,KACvB,MAAM,EAKR,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,kBAAkB,EACzB,MAAM,MAAM,KACX,MAKF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,EACZ,UAAU,eAAe,CAAC,MAAM,CAAC,EACjC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,KAC7C,MAeF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,kBAAkB,EACzB,aAAa,eAAe,EAC5B,gBAAgB,MAAM,EAAE,EACxB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,KAC7C,QAAQ,EASV,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isCategoricalScale as u, isNumericScale as s } from "../scales/scales.js";
|
|
2
|
+
const d = 5, f = (r, n) => n || (u(r) ? r.domain() : s(r) ? r.ticks(d) : []), S = (r, n) => u(r) ? (r(n) ?? 0) + r.bandwidth() / 2 : r(n), T = (r, n, t) => {
|
|
3
|
+
const o = n && Array.isArray(n) && typeof n[0] == "string";
|
|
4
|
+
if (t) {
|
|
5
|
+
const e = o && n[r] !== void 0 ? n[r] : r;
|
|
6
|
+
return String(t(e));
|
|
7
|
+
}
|
|
8
|
+
return o && n[r] !== void 0 ? String(n[r]) : String(r);
|
|
9
|
+
}, l = (r, n, t, o) => {
|
|
10
|
+
const e = f(r, t), g = n?.data;
|
|
11
|
+
return e.map((i) => ({
|
|
12
|
+
position: S(r, i),
|
|
13
|
+
value: i,
|
|
14
|
+
label: T(i, g, o)
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
d as APPROXIMATE_TICK_COUNT,
|
|
19
|
+
l as buildTicksData,
|
|
20
|
+
T as getTickLabel,
|
|
21
|
+
S as getTickPosition,
|
|
22
|
+
f as getTickValues
|
|
23
|
+
};
|
|
@@ -1,11 +1,137 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ScaleBand, ScaleLinear, ScaleLogarithmic } from 'd3-scale';
|
|
2
|
+
export type AxisBounds = {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
};
|
|
6
|
+
export type ChartInset = {
|
|
7
|
+
top: number;
|
|
8
|
+
right: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
left: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Pixel bounds of the drawable region.
|
|
14
|
+
*/
|
|
15
|
+
export type DrawingArea = {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
4
20
|
};
|
|
5
21
|
export type Series = {
|
|
22
|
+
/**
|
|
23
|
+
* Unique identifier for the series.
|
|
24
|
+
*/
|
|
6
25
|
id: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Numeric data points; `null` entries represent gaps.
|
|
28
|
+
*/
|
|
29
|
+
data?: Array<number | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Human-readable label used in legends and tooltips.
|
|
32
|
+
*/
|
|
33
|
+
label?: string;
|
|
34
|
+
/**
|
|
35
|
+
* CSS color applied to the series line/mark.
|
|
36
|
+
*/
|
|
37
|
+
stroke: string;
|
|
38
|
+
};
|
|
39
|
+
export type AxisConfigProps = {
|
|
40
|
+
/**
|
|
41
|
+
* Scale algorithm used by this axis.
|
|
42
|
+
* @default 'linear'
|
|
43
|
+
*/
|
|
44
|
+
scaleType?: 'linear' | 'log' | 'band';
|
|
45
|
+
/**
|
|
46
|
+
* Explicit data values for band scales or category labels.
|
|
47
|
+
* For band scales, provides the discrete domain. For numeric scales, string values
|
|
48
|
+
* are used as tick labels at corresponding indices.
|
|
49
|
+
*/
|
|
50
|
+
data?: string[] | number[];
|
|
51
|
+
/**
|
|
52
|
+
* Fixed domain bounds or a function that adjusts the computed bounds.
|
|
53
|
+
* A partial object overrides only the specified bound(s).
|
|
54
|
+
* A function receives the auto-computed bounds and returns adjusted ones.
|
|
55
|
+
*/
|
|
56
|
+
domain?: Partial<AxisBounds> | ((bounds: AxisBounds) => AxisBounds);
|
|
57
|
+
};
|
|
58
|
+
type AxisVisualProps = {
|
|
59
|
+
/**
|
|
60
|
+
* Whether to render grid lines at each tick.
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
showGrid?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether to render the axis baseline.
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
showLine?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to render tick marks at each tick position.
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
showTickMark?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Explicit tick positions along the axis.
|
|
76
|
+
* When omitted, ticks are computed automatically from the scale.
|
|
77
|
+
*/
|
|
78
|
+
ticks?: number[];
|
|
79
|
+
/**
|
|
80
|
+
* Formats a tick value into its display label.
|
|
81
|
+
* Receives the raw tick value (number or string label) and must return a string.
|
|
82
|
+
*/
|
|
83
|
+
tickLabelFormatter?: (value: number | string) => string;
|
|
84
|
+
};
|
|
85
|
+
export type XAxisVisualProps = {
|
|
86
|
+
/**
|
|
87
|
+
* Where the x-axis is rendered relative to the drawing area.
|
|
88
|
+
* @default 'bottom'
|
|
89
|
+
*/
|
|
90
|
+
position?: 'top' | 'bottom';
|
|
91
|
+
} & AxisVisualProps;
|
|
92
|
+
export type YAxisVisualProps = {
|
|
93
|
+
/**
|
|
94
|
+
* Where the y-axis is rendered relative to the drawing area.
|
|
95
|
+
* @default 'start'
|
|
96
|
+
*/
|
|
97
|
+
position?: 'start' | 'end';
|
|
98
|
+
} & AxisVisualProps;
|
|
99
|
+
export type NumericScale = ScaleLinear<number, number> | ScaleLogarithmic<number, number>;
|
|
100
|
+
export type CategoricalScale = ScaleBand<number>;
|
|
101
|
+
export type ChartScaleFunction = NumericScale | CategoricalScale;
|
|
102
|
+
export type CartesianChartContextValue = {
|
|
103
|
+
/**
|
|
104
|
+
* All data series registered in the chart.
|
|
105
|
+
*/
|
|
106
|
+
series: Series[];
|
|
107
|
+
/**
|
|
108
|
+
* Lookup map for series by ID. Stable reference when series identity is unchanged.
|
|
109
|
+
*/
|
|
110
|
+
seriesMap: Map<string, Series>;
|
|
111
|
+
/**
|
|
112
|
+
* Returns the x-axis scale. Accepts an optional axis ID for future multi-axis support.
|
|
113
|
+
*/
|
|
114
|
+
getXScale: (id?: string) => ChartScaleFunction | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Returns the y-axis scale. Accepts an optional axis ID for future multi-axis support.
|
|
117
|
+
*/
|
|
118
|
+
getYScale: (id?: string) => ChartScaleFunction | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the x-axis config. Accepts an optional axis ID for future multi-axis support.
|
|
121
|
+
*/
|
|
122
|
+
getXAxisConfig: (id?: string) => AxisConfigProps | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Returns the y-axis config. Accepts an optional axis ID for future multi-axis support.
|
|
125
|
+
*/
|
|
126
|
+
getYAxisConfig: (id?: string) => AxisConfigProps | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Pixel bounds of the drawable region.
|
|
129
|
+
*/
|
|
130
|
+
drawingArea: DrawingArea;
|
|
131
|
+
/**
|
|
132
|
+
* Number of data points along the x-axis.
|
|
133
|
+
*/
|
|
134
|
+
dataLength: number;
|
|
10
135
|
};
|
|
136
|
+
export {};
|
|
11
137
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as a, useRef as l, useContext as f } from "react";
|
|
3
|
+
function d(n, c) {
|
|
4
|
+
if (Object.is(n, c)) return !0;
|
|
5
|
+
const s = n, r = c, u = Object.keys(s), i = Object.keys(r);
|
|
6
|
+
return u.length !== i.length ? !1 : u.every(
|
|
7
|
+
(e) => Object.prototype.hasOwnProperty.call(r, e) && Object.is(s[e], r[e])
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
function b(n, c) {
|
|
11
|
+
const s = a(c), r = ({ children: i, value: e }) => {
|
|
12
|
+
const t = l(e);
|
|
13
|
+
return d(t.current, e) || (t.current = e), /* @__PURE__ */ o(s.Provider, { value: t.current, children: i });
|
|
14
|
+
};
|
|
15
|
+
r.displayName = n + "Provider";
|
|
16
|
+
function u({
|
|
17
|
+
consumerName: i,
|
|
18
|
+
contextRequired: e
|
|
19
|
+
}) {
|
|
20
|
+
const t = f(s);
|
|
21
|
+
if (t)
|
|
22
|
+
return t;
|
|
23
|
+
if (e)
|
|
24
|
+
throw new Error(
|
|
25
|
+
`${i} must be used within ${n}`
|
|
26
|
+
);
|
|
27
|
+
return c || {};
|
|
28
|
+
}
|
|
29
|
+
return [r, u];
|
|
30
|
+
}
|
|
31
|
+
b("Disabled", { disabled: !1 });
|
|
32
|
+
export {
|
|
33
|
+
b as createSafeContext,
|
|
34
|
+
d as shallowEqual
|
|
35
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import d from "./ascending.js";
|
|
2
|
+
import p from "./descending.js";
|
|
3
|
+
function b(c) {
|
|
4
|
+
let u, o, s;
|
|
5
|
+
c.length !== 2 ? (u = d, o = (n, e) => d(c(n), e), s = (n, e) => c(n) - e) : (u = c === d || c === p ? c : l, o = c, s = c);
|
|
6
|
+
function f(n, e, t = 0, r = n.length) {
|
|
7
|
+
if (t < r) {
|
|
8
|
+
if (u(e, e) !== 0) return r;
|
|
9
|
+
do {
|
|
10
|
+
const i = t + r >>> 1;
|
|
11
|
+
o(n[i], e) < 0 ? t = i + 1 : r = i;
|
|
12
|
+
} while (t < r);
|
|
13
|
+
}
|
|
14
|
+
return t;
|
|
15
|
+
}
|
|
16
|
+
function m(n, e, t = 0, r = n.length) {
|
|
17
|
+
if (t < r) {
|
|
18
|
+
if (u(e, e) !== 0) return r;
|
|
19
|
+
do {
|
|
20
|
+
const i = t + r >>> 1;
|
|
21
|
+
o(n[i], e) <= 0 ? t = i + 1 : r = i;
|
|
22
|
+
} while (t < r);
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
}
|
|
26
|
+
function g(n, e, t = 0, r = n.length) {
|
|
27
|
+
const i = f(n, e, t, r - 1);
|
|
28
|
+
return i > t && s(n[i - 1], e) > -s(n[i], e) ? i - 1 : i;
|
|
29
|
+
}
|
|
30
|
+
return { left: f, center: g, right: m };
|
|
31
|
+
}
|
|
32
|
+
function l() {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
b as default
|
|
37
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function l(n, e, a) {
|
|
2
|
+
n = +n, e = +e, a = (g = arguments.length) < 2 ? (e = n, n = 0, 1) : g < 3 ? 1 : +a;
|
|
3
|
+
for (var h = -1, g = Math.max(0, Math.ceil((e - n) / a)) | 0, i = new Array(g); ++h < g; )
|
|
4
|
+
i[h] = n + h * a;
|
|
5
|
+
return i;
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
l as default
|
|
9
|
+
};
|