@octanejs/visx 0.1.56 → 0.1.58
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/visx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.58",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@floating-ui/dom": "^1.8.0",
|
|
84
|
+
"@octanejs/floating-ui": "0.1.62",
|
|
84
85
|
"@types/d3-array": "3.0.3",
|
|
85
86
|
"@types/d3-chord": "^1.0.14",
|
|
86
87
|
"@types/d3-color": "3.1.0",
|
|
@@ -118,11 +119,10 @@
|
|
|
118
119
|
"d3-voronoi": "^1.1.4",
|
|
119
120
|
"mitt": "^2.1.0",
|
|
120
121
|
"reduce-css-calc": "^1.3.0",
|
|
121
|
-
"svg-path-properties": "2.0.2"
|
|
122
|
-
"@octanejs/floating-ui": "0.1.60"
|
|
122
|
+
"svg-path-properties": "2.0.2"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
125
|
-
"octane": "^0.
|
|
125
|
+
"octane": "^0.10.0"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
128
|
"@juggle/resize-observer": "^3.4.0",
|
|
@@ -141,11 +141,11 @@
|
|
|
141
141
|
"@visx/zoom": "4.0.0",
|
|
142
142
|
"@vitest/coverage-istanbul": "4.1.10",
|
|
143
143
|
"esbuild": "^0.28.1",
|
|
144
|
+
"octane": "0.10.0",
|
|
144
145
|
"react": "19.2.7",
|
|
145
146
|
"react-dom": "19.2.7",
|
|
146
147
|
"typescript": "^5.9.3",
|
|
147
|
-
"vitest": "^4.1.10"
|
|
148
|
-
"octane": "0.9.0"
|
|
148
|
+
"vitest": "^4.1.10"
|
|
149
149
|
},
|
|
150
150
|
"scripts": {
|
|
151
151
|
"compile:check": "node scripts/check-tsrx-compile.mjs",
|
|
@@ -12,7 +12,7 @@ export default function defaultDomain<Scale extends D3Scale<number>>({
|
|
|
12
12
|
const end = domain[domain.length - 1];
|
|
13
13
|
if (typeof start === 'number' && typeof end === 'number') {
|
|
14
14
|
const step = (end - start) / (steps - 1);
|
|
15
|
-
return new Array(steps).fill(1).reduce((acc,
|
|
15
|
+
return new Array(steps).fill(1).reduce((acc, _cur, i) => {
|
|
16
16
|
acc.push(start + i * step);
|
|
17
17
|
return acc;
|
|
18
18
|
}, []);
|
|
@@ -8,7 +8,7 @@ export interface Bin {
|
|
|
8
8
|
|
|
9
9
|
const defaultCount: CountFunction = (idx, number) => Math.random() * (25 * (number - idx));
|
|
10
10
|
|
|
11
|
-
const defaultBin: BinFunction = (idx,
|
|
11
|
+
const defaultBin: BinFunction = (idx, _length) => idx * 150;
|
|
12
12
|
|
|
13
13
|
export default function genBin(
|
|
14
14
|
length: number,
|
|
@@ -16,7 +16,7 @@ export default function genBin(
|
|
|
16
16
|
count: CountFunction = defaultCount,
|
|
17
17
|
): Bin[] {
|
|
18
18
|
return new Array(length).fill(1).reduce(
|
|
19
|
-
(data,
|
|
19
|
+
(data, _d, i) =>
|
|
20
20
|
data.concat([
|
|
21
21
|
{
|
|
22
22
|
bin: bin(i, length),
|
package/src/scale/createScale.ts
CHANGED
|
@@ -24,63 +24,63 @@ import createRadialScale from './scales/radial';
|
|
|
24
24
|
|
|
25
25
|
function createScale<
|
|
26
26
|
Output = DefaultOutput,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
28
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
29
29
|
>(
|
|
30
30
|
config?: PickScaleConfig<'linear', Output> | PickScaleConfigWithoutType<'linear', Output>,
|
|
31
31
|
): PickD3Scale<'linear', Output>;
|
|
32
32
|
|
|
33
33
|
function createScale<
|
|
34
34
|
Output = DefaultOutput,
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
36
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
37
37
|
>(config: PickScaleConfig<'log', Output>): PickD3Scale<'log', Output>;
|
|
38
38
|
|
|
39
39
|
function createScale<
|
|
40
40
|
Output = DefaultOutput,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
42
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
43
43
|
>(config: PickScaleConfig<'pow', Output>): PickD3Scale<'pow', Output>;
|
|
44
44
|
|
|
45
45
|
function createScale<
|
|
46
46
|
Output = DefaultOutput,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
48
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
49
49
|
>(config: PickScaleConfig<'sqrt', Output>): PickD3Scale<'sqrt', Output>;
|
|
50
50
|
|
|
51
51
|
function createScale<
|
|
52
52
|
Output = DefaultOutput,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
54
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
55
55
|
>(config: PickScaleConfig<'symlog', Output>): PickD3Scale<'symlog', Output>;
|
|
56
56
|
|
|
57
57
|
function createScale<
|
|
58
58
|
Output = DefaultOutput,
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
60
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
61
61
|
>(config: PickScaleConfig<'time', Output>): PickD3Scale<'time', Output>;
|
|
62
62
|
|
|
63
63
|
function createScale<
|
|
64
64
|
Output = DefaultOutput,
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
66
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
67
67
|
>(config: PickScaleConfig<'utc', Output>): PickD3Scale<'utc', Output>;
|
|
68
68
|
|
|
69
69
|
function createScale<
|
|
70
70
|
Output = DefaultOutput,
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
72
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
73
73
|
>(config: PickScaleConfig<'quantile', Output>): PickD3Scale<'quantile', Output>;
|
|
74
74
|
|
|
75
75
|
function createScale<
|
|
76
76
|
Output = DefaultOutput,
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
78
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
79
79
|
>(config: PickScaleConfig<'quantize', Output>): PickD3Scale<'quantize', Output>;
|
|
80
80
|
|
|
81
81
|
function createScale<
|
|
82
82
|
Output = DefaultOutput,
|
|
83
|
-
|
|
83
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
84
84
|
ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
85
85
|
>(
|
|
86
86
|
config: PickScaleConfig<'threshold', Output, StringLike, ThresholdInput>,
|
|
@@ -89,7 +89,7 @@ function createScale<
|
|
|
89
89
|
function createScale<
|
|
90
90
|
Output = DefaultOutput,
|
|
91
91
|
DiscreteInput extends StringLike = StringLike,
|
|
92
|
-
|
|
92
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
93
93
|
>(
|
|
94
94
|
config: PickScaleConfig<'ordinal', Output, DiscreteInput>,
|
|
95
95
|
): PickD3Scale<'ordinal', Output, DiscreteInput>;
|
|
@@ -97,7 +97,7 @@ function createScale<
|
|
|
97
97
|
function createScale<
|
|
98
98
|
Output = DefaultOutput,
|
|
99
99
|
DiscreteInput extends StringLike = StringLike,
|
|
100
|
-
|
|
100
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
101
101
|
>(
|
|
102
102
|
config: PickScaleConfig<'point', Output, DiscreteInput>,
|
|
103
103
|
): PickD3Scale<'point', Output, DiscreteInput>;
|
|
@@ -105,15 +105,15 @@ function createScale<
|
|
|
105
105
|
function createScale<
|
|
106
106
|
Output = DefaultOutput,
|
|
107
107
|
DiscreteInput extends StringLike = StringLike,
|
|
108
|
-
|
|
108
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
109
109
|
>(
|
|
110
110
|
config: PickScaleConfig<'band', Output, DiscreteInput>,
|
|
111
111
|
): PickD3Scale<'band', Output, DiscreteInput>;
|
|
112
112
|
|
|
113
113
|
function createScale<
|
|
114
114
|
Output = DefaultOutput,
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
116
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
117
117
|
>(config: PickScaleConfig<'radial', Output>): PickD3Scale<'radial', Output>;
|
|
118
118
|
|
|
119
119
|
function createScale<
|
|
@@ -31,11 +31,11 @@ function useScale<Output = DefaultOutput>(config: PickScaleConfig<'quantize', Ou
|
|
|
31
31
|
|
|
32
32
|
function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike, ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput>(config: PickScaleConfig<'threshold', Output, DiscreteInput, ThresholdInput>): PickD3Scale<'threshold', Output, DiscreteInput, ThresholdInput>;
|
|
33
33
|
|
|
34
|
-
function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike,
|
|
34
|
+
function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike, _ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput>(config: PickScaleConfig<'ordinal', Output, DiscreteInput>): PickD3Scale<'ordinal', Output, DiscreteInput>;
|
|
35
35
|
|
|
36
|
-
function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike,
|
|
36
|
+
function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike, _ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput>(config: PickScaleConfig<'point', Output, DiscreteInput>): PickD3Scale<'point', Output, DiscreteInput>;
|
|
37
37
|
|
|
38
|
-
function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike,
|
|
38
|
+
function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike, _ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput>(config: PickScaleConfig<'band', Output, DiscreteInput>): PickD3Scale<'band', Output, DiscreteInput>;
|
|
39
39
|
|
|
40
40
|
function useScale<Output = DefaultOutput>(config: PickScaleConfig<'radial', Output>): PickD3Scale<'radial', Output>;
|
|
41
41
|
|
|
@@ -12,9 +12,9 @@ declare function useScale<Output = DefaultOutput>(config: PickScaleConfig<'utc',
|
|
|
12
12
|
declare function useScale<Output = DefaultOutput>(config: PickScaleConfig<'quantile', Output>): PickD3Scale<'quantile', Output>;
|
|
13
13
|
declare function useScale<Output = DefaultOutput>(config: PickScaleConfig<'quantize', Output>): PickD3Scale<'quantize', Output>;
|
|
14
14
|
declare function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike, ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput>(config: PickScaleConfig<'threshold', Output, DiscreteInput, ThresholdInput>): PickD3Scale<'threshold', Output, DiscreteInput, ThresholdInput>;
|
|
15
|
-
declare function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike,
|
|
16
|
-
declare function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike,
|
|
17
|
-
declare function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike,
|
|
15
|
+
declare function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike, _ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput>(config: PickScaleConfig<'ordinal', Output, DiscreteInput>): PickD3Scale<'ordinal', Output, DiscreteInput>;
|
|
16
|
+
declare function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike, _ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput>(config: PickScaleConfig<'point', Output, DiscreteInput>): PickD3Scale<'point', Output, DiscreteInput>;
|
|
17
|
+
declare function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike, _ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput>(config: PickScaleConfig<'band', Output, DiscreteInput>): PickD3Scale<'band', Output, DiscreteInput>;
|
|
18
18
|
declare function useScale<Output = DefaultOutput>(config: PickScaleConfig<'radial', Output>): PickD3Scale<'radial', Output>;
|
|
19
19
|
declare function useScale<Output = DefaultOutput, DiscreteInput extends StringLike = StringLike, ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput>(config: ScaleConfig<Output, DiscreteInput, ThresholdInput>): D3Scale<Output, DiscreteInput, ThresholdInput>;
|
|
20
20
|
export default useScale;
|
package/src/scale/updateScale.ts
CHANGED
|
@@ -12,8 +12,8 @@ const applyAllOperators = scaleOperator(...ALL_OPERATORS);
|
|
|
12
12
|
|
|
13
13
|
function updateScale<
|
|
14
14
|
Output = DefaultOutput,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
16
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
17
17
|
>(
|
|
18
18
|
scale: PickD3Scale<'linear', Output>,
|
|
19
19
|
config: PickScaleConfigWithoutType<'linear', Output>,
|
|
@@ -21,8 +21,8 @@ function updateScale<
|
|
|
21
21
|
|
|
22
22
|
function updateScale<
|
|
23
23
|
Output = DefaultOutput,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
25
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
26
26
|
>(
|
|
27
27
|
scale: PickD3Scale<'log', Output>,
|
|
28
28
|
config: PickScaleConfigWithoutType<'log', Output>,
|
|
@@ -30,8 +30,8 @@ function updateScale<
|
|
|
30
30
|
|
|
31
31
|
function updateScale<
|
|
32
32
|
Output = DefaultOutput,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
34
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
35
35
|
>(
|
|
36
36
|
scale: PickD3Scale<'pow', Output>,
|
|
37
37
|
config: PickScaleConfigWithoutType<'pow', Output>,
|
|
@@ -39,8 +39,8 @@ function updateScale<
|
|
|
39
39
|
|
|
40
40
|
function updateScale<
|
|
41
41
|
Output = DefaultOutput,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
43
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
44
44
|
>(
|
|
45
45
|
scale: PickD3Scale<'sqrt', Output>,
|
|
46
46
|
config: PickScaleConfigWithoutType<'sqrt', Output>,
|
|
@@ -48,8 +48,8 @@ function updateScale<
|
|
|
48
48
|
|
|
49
49
|
function updateScale<
|
|
50
50
|
Output = DefaultOutput,
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
52
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
53
53
|
>(
|
|
54
54
|
scale: PickD3Scale<'symlog', Output>,
|
|
55
55
|
config: PickScaleConfigWithoutType<'symlog', Output>,
|
|
@@ -57,8 +57,8 @@ function updateScale<
|
|
|
57
57
|
|
|
58
58
|
function updateScale<
|
|
59
59
|
Output = DefaultOutput,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
61
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
62
62
|
>(
|
|
63
63
|
scale: PickD3Scale<'time', Output>,
|
|
64
64
|
config: PickScaleConfigWithoutType<'time', Output>,
|
|
@@ -66,8 +66,8 @@ function updateScale<
|
|
|
66
66
|
|
|
67
67
|
function updateScale<
|
|
68
68
|
Output = DefaultOutput,
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
70
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
71
71
|
>(
|
|
72
72
|
scale: PickD3Scale<'utc', Output>,
|
|
73
73
|
config: PickScaleConfigWithoutType<'utc', Output>,
|
|
@@ -75,8 +75,8 @@ function updateScale<
|
|
|
75
75
|
|
|
76
76
|
function updateScale<
|
|
77
77
|
Output = DefaultOutput,
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
79
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
80
80
|
>(
|
|
81
81
|
scale: PickD3Scale<'quantile', Output>,
|
|
82
82
|
config: PickScaleConfigWithoutType<'quantile', Output>,
|
|
@@ -84,8 +84,8 @@ function updateScale<
|
|
|
84
84
|
|
|
85
85
|
function updateScale<
|
|
86
86
|
Output = DefaultOutput,
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
88
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
89
89
|
>(
|
|
90
90
|
scale: PickD3Scale<'quantize', Output>,
|
|
91
91
|
config: PickScaleConfigWithoutType<'quantize', Output>,
|
|
@@ -93,7 +93,7 @@ function updateScale<
|
|
|
93
93
|
|
|
94
94
|
function updateScale<
|
|
95
95
|
Output = DefaultOutput,
|
|
96
|
-
|
|
96
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
97
97
|
ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
98
98
|
>(
|
|
99
99
|
scale: PickD3Scale<'threshold', Output, StringLike, ThresholdInput>,
|
|
@@ -103,7 +103,7 @@ function updateScale<
|
|
|
103
103
|
function updateScale<
|
|
104
104
|
Output = DefaultOutput,
|
|
105
105
|
DiscreteInput extends StringLike = StringLike,
|
|
106
|
-
|
|
106
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
107
107
|
>(
|
|
108
108
|
scale: PickD3Scale<'ordinal', Output, DiscreteInput>,
|
|
109
109
|
config: PickScaleConfigWithoutType<'ordinal', Output, DiscreteInput>,
|
|
@@ -112,7 +112,7 @@ function updateScale<
|
|
|
112
112
|
function updateScale<
|
|
113
113
|
Output = DefaultOutput,
|
|
114
114
|
DiscreteInput extends StringLike = StringLike,
|
|
115
|
-
|
|
115
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
116
116
|
>(
|
|
117
117
|
scale: PickD3Scale<'point', Output, DiscreteInput>,
|
|
118
118
|
config: PickScaleConfigWithoutType<'point', Output, DiscreteInput>,
|
|
@@ -121,7 +121,7 @@ function updateScale<
|
|
|
121
121
|
function updateScale<
|
|
122
122
|
Output = DefaultOutput,
|
|
123
123
|
DiscreteInput extends StringLike = StringLike,
|
|
124
|
-
|
|
124
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
125
125
|
>(
|
|
126
126
|
scale: PickD3Scale<'band', Output, DiscreteInput>,
|
|
127
127
|
config: PickScaleConfigWithoutType<'band', Output, DiscreteInput>,
|
|
@@ -129,8 +129,8 @@ function updateScale<
|
|
|
129
129
|
|
|
130
130
|
function updateScale<
|
|
131
131
|
Output = DefaultOutput,
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
_DiscreteInput extends StringLike = StringLike,
|
|
133
|
+
_ThresholdInput extends DefaultThresholdInput = DefaultThresholdInput,
|
|
134
134
|
>(
|
|
135
135
|
scale: PickD3Scale<'radial', Output>,
|
|
136
136
|
config: PickScaleConfigWithoutType<'radial', Output>,
|