layerchart 2.0.0-next.2 → 2.0.0-next.20
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/components/AnnotationLine.svelte +17 -29
- package/dist/components/AnnotationLine.svelte.d.ts +4 -2
- package/dist/components/AnnotationPoint.svelte +11 -13
- package/dist/components/AnnotationPoint.svelte.d.ts +4 -2
- package/dist/components/AnnotationRange.svelte +3 -3
- package/dist/components/Arc.svelte +2 -2
- package/dist/components/Axis.svelte +52 -24
- package/dist/components/Axis.svelte.d.ts +14 -3
- package/dist/components/Bar.svelte +7 -4
- package/dist/components/Bar.svelte.d.ts +4 -1
- package/dist/components/Bars.svelte +9 -6
- package/dist/components/Bars.svelte.d.ts +3 -3
- package/dist/components/Blur.svelte +20 -12
- package/dist/components/Blur.svelte.d.ts +2 -5
- package/dist/components/Calendar.svelte +10 -6
- package/dist/components/Calendar.svelte.d.ts +2 -1
- package/dist/components/Chart.svelte +2 -2
- package/dist/components/ClipPath.svelte +14 -9
- package/dist/components/Connector.svelte +2 -2
- package/dist/components/Connector.svelte.d.ts +1 -1
- package/dist/components/Ellipse.svelte +187 -0
- package/dist/components/Ellipse.svelte.d.ts +64 -0
- package/dist/components/ForceSimulation.svelte +168 -50
- package/dist/components/ForceSimulation.svelte.d.ts +80 -21
- package/dist/components/GeoEdgeFade.svelte +4 -3
- package/dist/components/GeoEdgeFade.svelte.d.ts +2 -2
- package/dist/components/GeoPath.svelte +12 -5
- package/dist/components/GeoPoint.svelte +1 -2
- package/dist/components/GeoSpline.svelte +4 -4
- package/dist/components/GeoSpline.svelte.d.ts +1 -1
- package/dist/components/Graticule.svelte +3 -2
- package/dist/components/Grid.svelte +8 -7
- package/dist/components/Grid.svelte.d.ts +2 -1
- package/dist/components/Group.svelte +45 -5
- package/dist/components/Group.svelte.d.ts +32 -4
- package/dist/components/Highlight.svelte +1 -1
- package/dist/components/Hull.svelte +4 -4
- package/dist/components/Hull.svelte.d.ts +2 -2
- package/dist/components/Labels.svelte +6 -4
- package/dist/components/Labels.svelte.d.ts +2 -2
- package/dist/components/Legend.svelte +8 -5
- package/dist/components/Legend.svelte.d.ts +3 -3
- package/dist/components/MonthPath.svelte +14 -11
- package/dist/components/MonthPath.svelte.d.ts +4 -3
- package/dist/components/Polygon.svelte +285 -0
- package/dist/components/Polygon.svelte.d.ts +115 -0
- package/dist/components/RadialGradient.svelte +1 -3
- package/dist/components/Rule.svelte +3 -2
- package/dist/components/Spline.svelte +30 -18
- package/dist/components/Spline.svelte.d.ts +12 -4
- package/dist/components/Text.svelte +60 -48
- package/dist/components/Text.svelte.d.ts +6 -0
- package/dist/components/Treemap.svelte +63 -26
- package/dist/components/Treemap.svelte.d.ts +11 -11
- package/dist/components/Voronoi.svelte +55 -36
- package/dist/components/Voronoi.svelte.d.ts +5 -3
- package/dist/components/charts/ArcChart.svelte +2 -2
- package/dist/components/charts/AreaChart.svelte +9 -10
- package/dist/components/charts/BarChart.svelte +63 -53
- package/dist/components/charts/DefaultTooltip.svelte +1 -1
- package/dist/components/charts/LineChart.svelte +8 -5
- package/dist/components/charts/PieChart.svelte +2 -2
- package/dist/components/charts/ScatterChart.svelte +0 -2
- package/dist/components/charts/utils.svelte.d.ts +3 -3
- package/dist/components/charts/utils.svelte.js +7 -3
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/components/layout/Canvas.svelte +67 -49
- package/dist/components/layout/Canvas.svelte.d.ts +6 -0
- package/dist/components/layout/Layer.svelte +6 -4
- package/dist/components/layout/Layer.svelte.d.ts +6 -4
- package/dist/components/tooltip/Tooltip.svelte +14 -7
- package/dist/components/tooltip/TooltipContext.svelte +25 -8
- package/dist/components/tooltip/TooltipContext.svelte.d.ts +1 -1
- package/dist/components/tooltip/TooltipHeader.svelte +5 -4
- package/dist/components/tooltip/TooltipHeader.svelte.d.ts +3 -3
- package/dist/components/tooltip/TooltipItem.svelte +5 -4
- package/dist/components/tooltip/TooltipItem.svelte.d.ts +3 -3
- package/dist/components/tooltip/TooltipList.svelte +1 -1
- package/dist/components/tooltip/tooltipMetaContext.d.ts +2 -2
- package/dist/docs/Blockquote.svelte +3 -1
- package/dist/docs/Blockquote.svelte.d.ts +4 -19
- package/dist/docs/Code.svelte +20 -12
- package/dist/docs/Code.svelte.d.ts +9 -23
- package/dist/docs/Header1.svelte +4 -2
- package/dist/docs/Header1.svelte.d.ts +4 -28
- package/dist/docs/Json.svelte +11 -3
- package/dist/docs/Json.svelte.d.ts +9 -21
- package/dist/docs/Layout.svelte +10 -7
- package/dist/docs/Layout.svelte.d.ts +4 -19
- package/dist/docs/Link.svelte +7 -3
- package/dist/docs/Link.svelte.d.ts +4 -38
- package/dist/docs/TilesetField.svelte +20 -19
- package/dist/docs/TilesetField.svelte.d.ts +5 -22
- package/dist/docs/ViewSourceButton.svelte +7 -4
- package/dist/docs/ViewSourceButton.svelte.d.ts +7 -21
- package/dist/utils/arcText.svelte.js +4 -4
- package/dist/utils/canvas.d.ts +77 -0
- package/dist/utils/canvas.js +105 -41
- package/dist/utils/genData.d.ts +14 -0
- package/dist/utils/genData.js +24 -6
- package/dist/utils/path.d.ts +10 -0
- package/dist/utils/path.js +30 -0
- package/dist/utils/scales.svelte.d.ts +3 -2
- package/dist/utils/scales.svelte.js +7 -3
- package/dist/utils/shape.d.ts +43 -0
- package/dist/utils/shape.js +59 -0
- package/dist/utils/string.d.ts +49 -0
- package/dist/utils/string.js +4 -2
- package/dist/utils/ticks.d.ts +4 -4
- package/dist/utils/ticks.js +106 -159
- package/dist/utils/ticks.test.js +6 -16
- package/dist/utils/treemap.d.ts +1 -1
- package/package.json +25 -22
- package/dist/utils/object.js +0 -2
package/dist/utils/ticks.js
CHANGED
|
@@ -1,183 +1,130 @@
|
|
|
1
|
-
import { timeYear, timeMonth,
|
|
2
|
-
import { format } from '
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
interval: timeYear.every(1), // Better than rendering a lot of items
|
|
10
|
-
format: (date) => date.toString(),
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
predicate: (duration) => duration.years > 1,
|
|
14
|
-
interval: timeYear.every(1),
|
|
15
|
-
format: (date) => formatDate(date, PeriodType.CalendarYear, { variant: 'short' }),
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
predicate: (duration) => duration.years,
|
|
19
|
-
interval: timeMonth.every(1),
|
|
20
|
-
format: (date) => formatDate(date, PeriodType.Month, { variant: 'short' }),
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
predicate: (duration) => duration.days > 30,
|
|
24
|
-
interval: timeMonth.every(1),
|
|
25
|
-
format: (date) => formatDate(date, PeriodType.Month, { variant: 'short' }),
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
predicate: (duration) => duration.days,
|
|
29
|
-
interval: timeDay.every(1),
|
|
30
|
-
format: (date) => formatDate(date, PeriodType.Day, { variant: 'short' }),
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
predicate: (duration) => duration.hours,
|
|
34
|
-
interval: timeHour.every(1),
|
|
35
|
-
format: (date) => format(date, 'h:mm a'),
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
predicate: (duration) => duration.minutes > 10,
|
|
39
|
-
interval: timeMinute.every(10),
|
|
40
|
-
format: (date) => format(date, 'h:mm a'),
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
predicate: (duration) => duration.minutes,
|
|
44
|
-
interval: timeMinute.every(1),
|
|
45
|
-
format: (date) => format(date, 'h:mm a'),
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
predicate: (duration) => duration.seconds > 10,
|
|
49
|
-
interval: timeSecond.every(10),
|
|
50
|
-
format: (date) => format(date, 'h:mm:ss'),
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
predicate: (duration) => duration.seconds,
|
|
54
|
-
interval: timeSecond.every(1),
|
|
55
|
-
format: (date) => format(date, 'h:mm:ss'),
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
predicate: (duration) => true, // 0 or more milliseconds
|
|
59
|
-
interval: timeMillisecond.every(100),
|
|
60
|
-
format: (date) => format(date, 'h:mm:ss.SSS'),
|
|
61
|
-
},
|
|
62
|
-
];
|
|
63
|
-
const minorTicks = [
|
|
64
|
-
{
|
|
65
|
-
predicate: (duration) => duration == null, // Unknown
|
|
66
|
-
interval: timeYear.every(1), // Better than rendering a lot of items
|
|
67
|
-
format: (date) => date.toString(),
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
predicate: (duration) => duration.years,
|
|
71
|
-
interval: timeMonth.every(1),
|
|
72
|
-
format: (date) => formatDate(date, PeriodType.Month, { variant: 'short' }),
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
predicate: (duration) => duration.days > 90,
|
|
76
|
-
interval: timeMonth.every(1),
|
|
77
|
-
format: (date) => formatDate(date, PeriodType.Month, { variant: 'short' }),
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
predicate: (duration) => duration.days > 30,
|
|
81
|
-
interval: timeWeek.every(1),
|
|
82
|
-
format: (date) => formatDate(date, PeriodType.WeekSun, { variant: 'short' }),
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
predicate: (duration) => duration.days > 7,
|
|
86
|
-
interval: timeDay.every(1),
|
|
87
|
-
format: (date) => formatDate(date, PeriodType.Day, { variant: 'short' }),
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
predicate: (duration) => duration.days > 3,
|
|
91
|
-
interval: timeHour.every(8),
|
|
92
|
-
format: (date) => format(date, 'h:mm a'),
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
predicate: (duration) => duration.days,
|
|
96
|
-
interval: timeHour.every(1),
|
|
97
|
-
format: (date) => format(date, 'h:mm a'),
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
predicate: (duration) => duration.hours,
|
|
101
|
-
interval: timeMinute.every(15),
|
|
102
|
-
format: (date) => format(date, 'h:mm a'),
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
predicate: (duration) => duration.minutes > 10,
|
|
106
|
-
interval: timeMinute.every(10),
|
|
107
|
-
format: (date) => format(date, 'h:mm a'),
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
predicate: (duration) => duration.minutes > 2,
|
|
111
|
-
interval: timeMinute.every(1),
|
|
112
|
-
format: (date) => format(date, 'h:mm a'),
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
predicate: (duration) => duration.minutes,
|
|
116
|
-
interval: timeSecond.every(10),
|
|
117
|
-
format: (date) => format(date, 'h:mm:ss'),
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
predicate: (duration) => duration.seconds,
|
|
121
|
-
interval: timeSecond.every(1),
|
|
122
|
-
format: (date) => format(date, 'h:mm:ss'),
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
predicate: (duration) => true, // 0 or more milliseconds
|
|
126
|
-
interval: timeMillisecond.every(10),
|
|
127
|
-
format: (date) => format(date, 'h:mm:ss.SSS'),
|
|
128
|
-
},
|
|
129
|
-
];
|
|
130
|
-
export function getMajorTicks(start, end) {
|
|
131
|
-
const duration = getDuration(start, end);
|
|
132
|
-
for (var t of majorTicks) {
|
|
133
|
-
if (t.predicate(duration)) {
|
|
134
|
-
return t.interval;
|
|
1
|
+
import { timeYear, timeMonth, timeDay, timeTicks } from 'd3-time';
|
|
2
|
+
import { format, Duration, isLiteralObject, DateToken, } from '@layerstack/utils';
|
|
3
|
+
import { isScaleBand, isScaleTime } from './scales.svelte.js';
|
|
4
|
+
export function getDurationFormat(duration, multiline = false) {
|
|
5
|
+
return function (date, i) {
|
|
6
|
+
if (+duration >= +new Duration({ duration: { years: 1 } })) {
|
|
7
|
+
// Year
|
|
8
|
+
return format(date, 'year');
|
|
135
9
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
10
|
+
else if (+duration >= +new Duration({ duration: { days: 28 } })) {
|
|
11
|
+
// Month
|
|
12
|
+
const isFirst = i === 0 || +timeYear.floor(date) === +date;
|
|
13
|
+
if (multiline) {
|
|
14
|
+
return (format(date, 'month', { variant: 'short' }) + (isFirst ? `\n${format(date, 'year')}` : ''));
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return (format(date, 'month', { variant: 'short' }) +
|
|
18
|
+
(isFirst ? ` '${format(date, 'year', { variant: 'short' })}` : ''));
|
|
19
|
+
}
|
|
144
20
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
21
|
+
else if (+duration >= +new Duration({ duration: { days: 1 } })) {
|
|
22
|
+
// Day
|
|
23
|
+
const isFirst = i === 0 || date.getDate() <= duration.days;
|
|
24
|
+
if (multiline) {
|
|
25
|
+
return (format(date, 'custom', { custom: DateToken.DayOfMonth_numeric }) +
|
|
26
|
+
(isFirst ? `\n${format(date, 'month', { variant: 'short' })}` : ''));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return format(date, 'day', { variant: 'short' });
|
|
30
|
+
}
|
|
153
31
|
}
|
|
154
|
-
|
|
155
|
-
|
|
32
|
+
else if (+duration >= +new Duration({ duration: { hours: 1 } })) {
|
|
33
|
+
// Hours
|
|
34
|
+
const isFirst = i === 0 || +timeDay.floor(date) === +date;
|
|
35
|
+
if (multiline) {
|
|
36
|
+
return (format(date, 'custom', { custom: DateToken.Hour_numeric }) +
|
|
37
|
+
(isFirst ? `\n${format(date, 'day', { variant: 'short' })}` : ''));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return isFirst
|
|
41
|
+
? format(date, 'day', { variant: 'short' })
|
|
42
|
+
: format(date, 'custom', { custom: DateToken.Hour_numeric });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (+duration >= +new Duration({ duration: { minutes: 1 } })) {
|
|
46
|
+
// Minutes
|
|
47
|
+
const isFirst = i === 0 || +timeDay.floor(date) === +date;
|
|
48
|
+
if (multiline) {
|
|
49
|
+
return (format(date, 'time', { variant: 'short' }) +
|
|
50
|
+
(isFirst ? `\n${format(date, 'day', { variant: 'short' })}` : ''));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return format(date, 'time', { variant: 'short' });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (+duration >= +new Duration({ duration: { seconds: 1 } })) {
|
|
57
|
+
// Seconds
|
|
58
|
+
const isFirst = i === 0 || +timeDay.floor(date) === +date;
|
|
59
|
+
return (format(date, 'time') +
|
|
60
|
+
(multiline && isFirst ? `\n${format(date, 'day', { variant: 'short' })}` : ''));
|
|
61
|
+
}
|
|
62
|
+
else if (+duration >= +new Duration({ duration: { milliseconds: 1 } })) {
|
|
63
|
+
// Milliseconds
|
|
64
|
+
const isFirst = i === 0 || +timeDay.floor(date) === +date;
|
|
65
|
+
return (format(date, 'custom', {
|
|
66
|
+
custom: [
|
|
67
|
+
DateToken.Hour_2Digit,
|
|
68
|
+
DateToken.Minute_2Digit,
|
|
69
|
+
DateToken.Second_2Digit,
|
|
70
|
+
DateToken.MiliSecond_3,
|
|
71
|
+
DateToken.Hour_woAMPM,
|
|
72
|
+
],
|
|
73
|
+
}) + (multiline && isFirst ? `\n${format(date, 'day', { variant: 'short' })}` : ''));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return date.toString();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
156
79
|
}
|
|
157
|
-
export function resolveTickVals(scale, ticks,
|
|
80
|
+
export function resolveTickVals(scale, ticks, count) {
|
|
81
|
+
// Explicit ticks
|
|
158
82
|
if (Array.isArray(ticks))
|
|
159
83
|
return ticks;
|
|
84
|
+
// Function
|
|
160
85
|
if (typeof ticks === 'function')
|
|
161
86
|
return ticks(scale) ?? [];
|
|
87
|
+
// Interval
|
|
162
88
|
if (isLiteralObject(ticks) && 'interval' in ticks) {
|
|
163
89
|
if (ticks.interval === null || !('ticks' in scale) || typeof scale.ticks !== 'function') {
|
|
164
90
|
return []; // Explicitly return empty array for null interval or invalid scale
|
|
165
91
|
}
|
|
166
92
|
return scale.ticks(ticks.interval);
|
|
167
93
|
}
|
|
94
|
+
// Band (use domain)
|
|
168
95
|
if (isScaleBand(scale)) {
|
|
169
96
|
return ticks && typeof ticks === 'number'
|
|
170
97
|
? scale.domain().filter((_, i) => i % ticks === 0)
|
|
171
98
|
: scale.domain();
|
|
172
99
|
}
|
|
100
|
+
// Ticks from scale
|
|
173
101
|
if (scale.ticks && typeof scale.ticks === 'function') {
|
|
174
|
-
|
|
175
|
-
return scale.ticks(ticks ?? (placement === 'left' || placement === 'right' ? 4 : undefined));
|
|
176
|
-
}
|
|
177
|
-
return scale.ticks(ticks);
|
|
102
|
+
return scale.ticks(count ?? (typeof ticks === 'number' ? ticks : undefined));
|
|
178
103
|
}
|
|
179
104
|
return [];
|
|
180
105
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
106
|
+
export function resolveTickFormat(scale, ticks, count, formatType, multiline = false) {
|
|
107
|
+
// Explicit format
|
|
108
|
+
if (formatType) {
|
|
109
|
+
// @ts-expect-error - improve types
|
|
110
|
+
return (tick) => format(tick, formatType);
|
|
111
|
+
}
|
|
112
|
+
// Time scale
|
|
113
|
+
if (isScaleTime(scale) && count) {
|
|
114
|
+
if (isLiteralObject(ticks) && 'interval' in ticks && ticks.interval != null) {
|
|
115
|
+
const start = ticks.interval.floor(new Date());
|
|
116
|
+
const end = ticks.interval.ceil(new Date());
|
|
117
|
+
return getDurationFormat(new Duration({ start, end }), multiline);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
// Compare first 2 ticks to determine duration between ticks for formatting
|
|
121
|
+
const [start, end] = timeTicks(scale.domain()[0], scale.domain()[1], count);
|
|
122
|
+
return getDurationFormat(new Duration({ start, end }), multiline);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Format from scale
|
|
126
|
+
if (scale.tickFormat) {
|
|
127
|
+
return scale.tickFormat(count);
|
|
128
|
+
}
|
|
129
|
+
return (tick) => `${tick}`;
|
|
183
130
|
}
|
package/dist/utils/ticks.test.js
CHANGED
|
@@ -35,33 +35,23 @@ describe('resolveTickVals', () => {
|
|
|
35
35
|
const scale = { domain: mockDomain, bandwidth: vi.fn() };
|
|
36
36
|
expect(resolveTickVals(scale)).toEqual(['a', 'b', 'c', 'd', 'e']);
|
|
37
37
|
});
|
|
38
|
-
it('uses default 4 ticks for left placement', () => {
|
|
39
|
-
const scale = { ticks: vi.fn(() => [1, 2, 3, 4]) };
|
|
40
|
-
expect(resolveTickVals(scale, undefined, 'left')).toEqual([1, 2, 3, 4]);
|
|
41
|
-
expect(scale.ticks).toHaveBeenCalledWith(4);
|
|
42
|
-
});
|
|
43
|
-
it('uses default 4 ticks for right placement', () => {
|
|
44
|
-
const scale = { ticks: vi.fn(() => [1, 2, 3, 4]) };
|
|
45
|
-
expect(resolveTickVals(scale, undefined, 'right')).toEqual([1, 2, 3, 4]);
|
|
46
|
-
expect(scale.ticks).toHaveBeenCalledWith(4);
|
|
47
|
-
});
|
|
48
38
|
it('uses undefined for non-left/right placement', () => {
|
|
49
|
-
const scale = { ticks: vi.fn(() => [1, 2]) };
|
|
50
|
-
expect(resolveTickVals(scale, undefined,
|
|
39
|
+
const scale = { domain: mockDomain, ticks: vi.fn(() => [1, 2]) };
|
|
40
|
+
expect(resolveTickVals(scale, undefined, undefined)).toEqual([1, 2]);
|
|
51
41
|
expect(scale.ticks).toHaveBeenCalledWith(undefined);
|
|
52
42
|
});
|
|
53
43
|
it('passes number ticks to scale.ticks', () => {
|
|
54
|
-
const scale = { ticks: vi.fn(() => [10, 20]) };
|
|
44
|
+
const scale = { domain: mockDomain, ticks: vi.fn(() => [10, 20]) };
|
|
55
45
|
expect(resolveTickVals(scale, 5)).toEqual([10, 20]);
|
|
56
46
|
expect(scale.ticks).toHaveBeenCalledWith(5);
|
|
57
47
|
});
|
|
58
48
|
it('returns empty array for scale without ticks', () => {
|
|
59
|
-
const scale = {};
|
|
49
|
+
const scale = { domain: mockDomain };
|
|
60
50
|
expect(resolveTickVals(scale, 5)).toEqual([]);
|
|
61
51
|
});
|
|
62
52
|
it('handles null ticks with placement', () => {
|
|
63
|
-
const scale = { ticks: vi.fn(() => [1, 2, 3]) };
|
|
64
|
-
expect(resolveTickVals(scale, null,
|
|
53
|
+
const scale = { domain: mockDomain, ticks: vi.fn(() => [1, 2, 3]) };
|
|
54
|
+
expect(resolveTickVals(scale, null, undefined)).toEqual([1, 2, 3]);
|
|
65
55
|
expect(scale.ticks).toHaveBeenCalledWith(undefined);
|
|
66
56
|
});
|
|
67
57
|
});
|
package/dist/utils/treemap.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export declare function aspectTile(tile: TileFunc, width: number, height: number
|
|
|
9
9
|
/**
|
|
10
10
|
* Show if the node (a) is a child of the selected (b), or any parent above selected
|
|
11
11
|
*/
|
|
12
|
-
export declare function isNodeVisible(a: HierarchyNode<any>, b: HierarchyNode<any> | null): boolean;
|
|
12
|
+
export declare function isNodeVisible(a: HierarchyNode<any>, b: HierarchyNode<any> | null | undefined): boolean;
|
|
13
13
|
export {};
|
package/package.json
CHANGED
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "techniq/layerchart",
|
|
7
|
-
"version": "2.0.0-next.
|
|
7
|
+
"version": "2.0.0-next.20",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@changesets/cli": "^2.29.
|
|
9
|
+
"@changesets/cli": "^2.29.4",
|
|
10
|
+
"@iconify-json/lucide": "^1.2.44",
|
|
10
11
|
"@mdi/js": "^7.4.47",
|
|
11
12
|
"@rollup/plugin-dsv": "^3.0.5",
|
|
12
|
-
"@sveltejs/adapter-cloudflare": "^
|
|
13
|
-
"@sveltejs/kit": "^2.
|
|
13
|
+
"@sveltejs/adapter-cloudflare": "^7.0.3",
|
|
14
|
+
"@sveltejs/kit": "^2.21.1",
|
|
14
15
|
"@sveltejs/package": "^2.3.11",
|
|
15
16
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
16
17
|
"@svitejs/changesets-changelog-github-compact": "^1.2.0",
|
|
17
18
|
"@tailwindcss/typography": "^0.5.16",
|
|
18
|
-
"@tailwindcss/vite": "^4.1.
|
|
19
|
+
"@tailwindcss/vite": "^4.1.7",
|
|
19
20
|
"@types/d3": "^7.4.3",
|
|
20
21
|
"@types/d3-array": "^3.2.1",
|
|
21
22
|
"@types/d3-color": "^3.1.3",
|
|
@@ -41,39 +42,41 @@
|
|
|
41
42
|
"@types/topojson-simplify": "^3.0.3",
|
|
42
43
|
"@types/topojson-specification": "^1.0.5",
|
|
43
44
|
"marked": "^15.0.11",
|
|
44
|
-
"mdsvex": "0.12.3",
|
|
45
|
-
"posthog-js": "^1.
|
|
45
|
+
"mdsvex": "^0.12.3",
|
|
46
|
+
"posthog-js": "^1.245.1",
|
|
46
47
|
"prettier": "^3.5.3",
|
|
47
|
-
"prettier-plugin-svelte": "^3.
|
|
48
|
+
"prettier-plugin-svelte": "^3.4.0",
|
|
48
49
|
"prism-svelte": "^0.5.0",
|
|
49
50
|
"prism-themes": "^1.9.0",
|
|
50
51
|
"prismjs": "^1.30.0",
|
|
51
52
|
"rehype-slug": "^6.0.0",
|
|
53
|
+
"rollup-plugin-visualizer": "^6.0.3",
|
|
52
54
|
"shapefile": "^0.6.6",
|
|
53
55
|
"solar-calculator": "^0.3.0",
|
|
54
|
-
"svelte": "5.
|
|
55
|
-
"svelte-check": "^4.1
|
|
56
|
+
"svelte": "5.32.1",
|
|
57
|
+
"svelte-check": "^4.2.1",
|
|
56
58
|
"svelte-json-tree": "^2.2.0",
|
|
57
|
-
"svelte-ux": "2.0.0-next.
|
|
58
|
-
"svelte2tsx": "^0.7.
|
|
59
|
-
"tailwindcss": "^4.1.
|
|
59
|
+
"svelte-ux": "2.0.0-next.8",
|
|
60
|
+
"svelte2tsx": "^0.7.39",
|
|
61
|
+
"tailwindcss": "^4.1.7",
|
|
60
62
|
"topojson-client": "^3.1.0",
|
|
61
63
|
"topojson-simplify": "^3.0.3",
|
|
62
64
|
"tslib": "^2.8.1",
|
|
63
65
|
"typescript": "^5.8.3",
|
|
64
66
|
"unist-util-visit": "^5.0.0",
|
|
67
|
+
"unplugin-icons": "^22.1.0",
|
|
65
68
|
"us-atlas": "^3.0.1",
|
|
66
|
-
"vite": "^6.3.
|
|
67
|
-
"
|
|
69
|
+
"vite": "^6.3.5",
|
|
70
|
+
"vite-plugin-devtools-json": "^0.1.0",
|
|
71
|
+
"vitest": "^3.1.4"
|
|
68
72
|
},
|
|
69
73
|
"type": "module",
|
|
70
74
|
"dependencies": {
|
|
71
75
|
"@dagrejs/dagre": "^1.1.4",
|
|
72
|
-
"@layerstack/svelte-actions": "1.0.1-next.
|
|
73
|
-
"@layerstack/svelte-state": "0.1.0-next.
|
|
74
|
-
"@layerstack/
|
|
75
|
-
"@layerstack/
|
|
76
|
-
"@layerstack/utils": "1.1.0-next.0",
|
|
76
|
+
"@layerstack/svelte-actions": "1.0.1-next.11",
|
|
77
|
+
"@layerstack/svelte-state": "0.1.0-next.16",
|
|
78
|
+
"@layerstack/tailwind": "2.0.0-next.13",
|
|
79
|
+
"@layerstack/utils": "2.0.0-next.11",
|
|
77
80
|
"d3-array": "^3.2.4",
|
|
78
81
|
"d3-color": "^3.1.0",
|
|
79
82
|
"d3-delaunay": "^6.0.4",
|
|
@@ -93,9 +96,9 @@
|
|
|
93
96
|
"d3-shape": "^3.2.0",
|
|
94
97
|
"d3-tile": "^1.0.0",
|
|
95
98
|
"d3-time": "^3.1.0",
|
|
96
|
-
"date-fns": "^4.1.0",
|
|
97
99
|
"lodash-es": "^4.17.21",
|
|
98
|
-
"
|
|
100
|
+
"memoize": "^10.1.0",
|
|
101
|
+
"runed": "^0.28.0"
|
|
99
102
|
},
|
|
100
103
|
"peerDependencies": {
|
|
101
104
|
"svelte": "^5.0.0"
|
package/dist/utils/object.js
DELETED