layerchart 2.0.0-next.59 → 2.0.0-next.60
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/bench/GeoBench.svelte +1 -1
- package/dist/components/AnnotationLine.svelte +1 -3
- package/dist/components/AnnotationPoint.svelte +5 -11
- package/dist/components/BrushContext.svelte.test.js +21 -14
- package/dist/components/Chart.svelte +50 -17
- package/dist/components/Chart.svelte.d.ts +1 -1
- package/dist/components/ChartChildren.svelte +56 -30
- package/dist/components/ChartChildren.svelte.d.ts +12 -12
- package/dist/components/ComputedStyles.svelte +1 -1
- package/dist/components/Grid.svelte +14 -11
- package/dist/components/Highlight.svelte +10 -8
- package/dist/components/Highlight.svelte.d.ts +1 -1
- package/dist/components/Hull.svelte +1 -1
- package/dist/components/Link.svelte +8 -3
- package/dist/components/TransformContext.svelte.d.ts +1 -1
- package/dist/components/Voronoi.svelte +1 -1
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-clear-brush-when-x-prop-changes-to--null--null--1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-clear-brush-when-x-prop-changes-to--null--null--2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-show-brush-when-x-prop-is-provided-with-a-sub-domain-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-show-brush-when-x-prop-is-provided-with-a-sub-domain-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-update-brush-width-when-x-prop-changes-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-external-sync--x-y-props--should-update-brush-width-when-x-prop-changes-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-clear-brush-when-reset-programmatically-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-clear-brush-when-reset-programmatically-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-compute-correct-pixel-width-for-brush-move---1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-compute-correct-pixel-width-for-brush-move---2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-move-only-y-when-x-is-not-specified-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-move-only-y-when-x-is-not-specified-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-select-full-domain-with-selectAll-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-select-full-domain-with-selectAll-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-show-brush-when-moved-programmatically-via-context-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-show-brush-when-moved-programmatically-via-context-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-update-width-when-brush-move---is-called-again-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-programmatic-control-should-update-width-when-brush-move---is-called-again-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-rendering-should-render-brush-context-when-brush-is-enabled-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-rendering-should-render-brush-context-when-brush-is-enabled-2.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-zoomOnBrush-with-onBrushEnd-should-pass-brush-domain-values-to-onBrushEnd-before-resetting-1.png +0 -0
- package/dist/components/__screenshots__/BrushContext.svelte.test.ts/BrushContext-zoomOnBrush-with-onBrushEnd-should-pass-brush-domain-values-to-onBrushEnd-before-resetting-2.png +0 -0
- package/dist/components/charts/BarChart.svelte.test.js +8 -3
- package/dist/components/charts/DefaultTooltip.svelte +11 -2
- package/dist/components/charts/DefaultTooltip.svelte.test.js +19 -8
- package/dist/components/charts/LineChart.svelte.test.js +5 -2
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-legend-series-toggle-adjusts-group-scale-should-adjust-grouped-bar-widths-when-series-are-toggled-via-legend-1.png +0 -0
- package/dist/components/charts/__screenshots__/BarChart.svelte.test.ts/BarChart-legend-series-toggle-adjusts-group-scale-should-adjust-grouped-bar-widths-when-series-are-toggled-via-legend-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-fade-non-highlighted-tooltip-series-items-on-hover-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-fade-non-highlighted-tooltip-series-items-on-hover-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-header-and-all-series-items-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-header-and-all-series-items-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-series-colors-in-tooltip-items-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-series-colors-in-tooltip-items-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-single-series-without-total-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-AreaChart--multi-series--quadtree-x-mode--should-show-single-series-without-total-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-LineChart--multi-series--quadtree-x-mode--should-show-header-and-all-series-items-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-LineChart--multi-series--quadtree-x-mode--should-show-header-and-all-series-items-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-series-header-for-multi-series-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-series-header-for-multi-series-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-x--y--and-r-items-when-r-is-configured-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-x--y--and-r-items-when-r-is-configured-2.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-x-and-y-items-in-tooltip-1.png +0 -0
- package/dist/components/charts/__screenshots__/DefaultTooltip.svelte.test.ts/DefaultTooltip-ScatterChart--single-point--quadtree-mode--should-show-x-and-y-items-in-tooltip-2.png +0 -0
- package/dist/components/charts/__screenshots__/LineChart.svelte.test.ts/LineChart-tooltip-should-prefer-cScale-color-over-default-series-color-when-cScale-is-explicitly-provided-1.png +0 -0
- package/dist/components/charts/__screenshots__/LineChart.svelte.test.ts/LineChart-tooltip-should-prefer-cScale-color-over-default-series-color-when-cScale-is-explicitly-provided-2.png +0 -0
- package/dist/components/force/index.d.ts +2 -0
- package/dist/components/force/index.js +2 -0
- package/dist/components/{GeoCircle.svelte → geo/GeoCircle.svelte} +2 -2
- package/dist/components/{GeoCircle.svelte.d.ts → geo/GeoCircle.svelte.d.ts} +1 -1
- package/dist/components/{GeoClipPath.svelte → geo/GeoClipPath.svelte} +5 -5
- package/dist/components/{GeoClipPath.svelte.d.ts → geo/GeoClipPath.svelte.d.ts} +2 -2
- package/dist/components/{GeoEdgeFade.svelte → geo/GeoEdgeFade.svelte} +4 -4
- package/dist/components/{GeoEdgeFade.svelte.d.ts → geo/GeoEdgeFade.svelte.d.ts} +2 -2
- package/dist/components/{GeoLegend.svelte → geo/GeoLegend.svelte} +3 -3
- package/dist/components/{GeoLegend.svelte.d.ts → geo/GeoLegend.svelte.d.ts} +2 -2
- package/dist/components/{GeoPath.svelte → geo/GeoPath.svelte} +6 -6
- package/dist/components/{GeoPath.svelte.d.ts → geo/GeoPath.svelte.d.ts} +3 -3
- package/dist/components/{GeoPoint.svelte → geo/GeoPoint.svelte} +6 -6
- package/dist/components/{GeoPoint.svelte.d.ts → geo/GeoPoint.svelte.d.ts} +2 -2
- package/dist/components/{GeoProjection.svelte → geo/GeoProjection.svelte} +3 -3
- package/dist/components/{GeoProjection.svelte.d.ts → geo/GeoProjection.svelte.d.ts} +1 -1
- package/dist/components/{GeoRaster.svelte → geo/GeoRaster.svelte} +3 -3
- package/dist/components/{GeoSpline.svelte → geo/GeoSpline.svelte} +5 -5
- package/dist/components/{GeoSpline.svelte.d.ts → geo/GeoSpline.svelte.d.ts} +2 -2
- package/dist/components/{GeoTile.svelte → geo/GeoTile.svelte} +5 -5
- package/dist/components/{GeoTile.svelte.d.ts → geo/GeoTile.svelte.d.ts} +1 -1
- package/dist/components/{GeoVisible.svelte → geo/GeoVisible.svelte} +2 -2
- package/dist/components/{Graticule.svelte → geo/Graticule.svelte} +3 -3
- package/dist/components/{Graticule.svelte.d.ts → geo/Graticule.svelte.d.ts} +1 -1
- package/dist/components/{TileImage.svelte → geo/TileImage.svelte} +3 -3
- package/dist/components/{TileImage.svelte.d.ts → geo/TileImage.svelte.d.ts} +1 -1
- package/dist/components/geo/index.d.ts +26 -0
- package/dist/components/geo/index.js +26 -0
- package/dist/components/{Chord.svelte → graph/Chord.svelte} +1 -1
- package/dist/components/{Dagre.svelte → graph/Dagre.svelte} +2 -2
- package/dist/components/{Ribbon.svelte → graph/Ribbon.svelte} +4 -4
- package/dist/components/{Ribbon.svelte.d.ts → graph/Ribbon.svelte.d.ts} +3 -3
- package/dist/components/{Sankey.svelte → graph/Sankey.svelte} +1 -1
- package/dist/components/graph/index.d.ts +8 -0
- package/dist/components/graph/index.js +8 -0
- package/dist/components/{Pack.svelte → hierarchy/Pack.svelte} +1 -1
- package/dist/components/{Partition.svelte → hierarchy/Partition.svelte} +1 -1
- package/dist/components/{Tree.svelte → hierarchy/Tree.svelte} +1 -1
- package/dist/components/{Treemap.svelte → hierarchy/Treemap.svelte} +2 -2
- package/dist/components/hierarchy/index.d.ts +8 -0
- package/dist/components/hierarchy/index.js +8 -0
- package/dist/components/index.d.ts +0 -44
- package/dist/components/index.js +0 -44
- package/dist/components/tooltip/Tooltip.svelte +2 -2
- package/dist/components/tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/components/tooltip/TooltipContext.svelte +103 -83
- package/dist/components/tooltip/TooltipContext.svelte.d.ts +2 -2
- package/dist/force.d.ts +1 -0
- package/dist/force.js +1 -0
- package/dist/geo.d.ts +1 -0
- package/dist/geo.js +1 -0
- package/dist/graph.d.ts +1 -0
- package/dist/graph.js +1 -0
- package/dist/hierarchy.d.ts +1 -0
- package/dist/hierarchy.js +1 -0
- package/dist/states/chart.svelte.d.ts +2 -2
- package/dist/utils/graph/dagre.js +1 -1
- package/dist/utils/linkUtils.d.ts +1 -1
- package/dist/utils/linkUtils.js +1 -1
- package/package.json +25 -1
- /package/dist/components/{ForceSimulation.svelte → force/ForceSimulation.svelte} +0 -0
- /package/dist/components/{ForceSimulation.svelte.d.ts → force/ForceSimulation.svelte.d.ts} +0 -0
- /package/dist/components/{GeoRaster.svelte.d.ts → geo/GeoRaster.svelte.d.ts} +0 -0
- /package/dist/components/{GeoVisible.svelte.d.ts → geo/GeoVisible.svelte.d.ts} +0 -0
- /package/dist/components/{Chord.svelte.d.ts → graph/Chord.svelte.d.ts} +0 -0
- /package/dist/components/{Dagre.svelte.d.ts → graph/Dagre.svelte.d.ts} +0 -0
- /package/dist/components/{Sankey.svelte.d.ts → graph/Sankey.svelte.d.ts} +0 -0
- /package/dist/components/{Pack.svelte.d.ts → hierarchy/Pack.svelte.d.ts} +0 -0
- /package/dist/components/{Partition.svelte.d.ts → hierarchy/Partition.svelte.d.ts} +0 -0
- /package/dist/components/{Tree.svelte.d.ts → hierarchy/Tree.svelte.d.ts} +0 -0
- /package/dist/components/{Treemap.svelte.d.ts → hierarchy/Treemap.svelte.d.ts} +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -319,9 +319,14 @@ describe('BarChart', () => {
|
|
|
319
319
|
});
|
|
320
320
|
const initialWidths = getBarWidths();
|
|
321
321
|
const initialBarWidth = initialWidths[0];
|
|
322
|
-
// Click a legend button to select only that series (exclusive select)
|
|
323
|
-
|
|
324
|
-
|
|
322
|
+
// Click a legend button to select only that series (exclusive select).
|
|
323
|
+
// `Legend` is lazy-loaded inside `ChartChildren`, so wait for the buttons
|
|
324
|
+
// to mount before interacting.
|
|
325
|
+
let legendButtons = container.querySelectorAll('.lc-legend-swatch-button');
|
|
326
|
+
await vi.waitFor(() => {
|
|
327
|
+
legendButtons = container.querySelectorAll('.lc-legend-swatch-button');
|
|
328
|
+
expect(legendButtons.length).toBe(4);
|
|
329
|
+
});
|
|
325
330
|
legendButtons[1].click();
|
|
326
331
|
// After selecting one series, only that series' bars should remain and be wider
|
|
327
332
|
await vi.waitFor(() => {
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
// Shared tooltip logic across simplified chart components
|
|
2
|
+
// Shared tooltip logic across simplified chart components.
|
|
3
|
+
// Use explicit named imports instead of `import * as Tooltip from '../tooltip/index.js'`
|
|
4
|
+
// so this dynamically-imported chunk doesn't drag in `TooltipContext.svelte`
|
|
5
|
+
// (which is already in the static graph via Chart.svelte and would otherwise
|
|
6
|
+
// bloat the lazy chunk and trip Vite dev-server compilation in CI).
|
|
3
7
|
import { sum } from 'd3-array';
|
|
4
8
|
import { getChartContext } from '../../contexts/chart.js';
|
|
5
|
-
import
|
|
9
|
+
import Root from '../tooltip/Tooltip.svelte';
|
|
10
|
+
import Header from '../tooltip/TooltipHeader.svelte';
|
|
11
|
+
import List from '../tooltip/TooltipList.svelte';
|
|
12
|
+
import Item from '../tooltip/TooltipItem.svelte';
|
|
13
|
+
import Separator from '../tooltip/TooltipSeparator.svelte';
|
|
14
|
+
const Tooltip = { Root, Header, List, Item, Separator };
|
|
6
15
|
import { format } from '@layerstack/utils';
|
|
7
16
|
import type { ChartChildrenProps } from '../ChartChildren.svelte';
|
|
8
17
|
|
|
@@ -33,6 +33,17 @@ function triggerTooltip(el) {
|
|
|
33
33
|
el.dispatchEvent(new PointerEvent('pointerenter', eventInit));
|
|
34
34
|
el.dispatchEvent(new PointerEvent('pointermove', eventInit));
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Trigger the tooltip and wait for it to render. Retries the dispatch until
|
|
38
|
+
* the lazy DefaultTooltip + (when in quadtree mode) d3-quadtree chunks have
|
|
39
|
+
* resolved — both happen in the background after mount.
|
|
40
|
+
*/
|
|
41
|
+
async function dispatchAndWaitForTooltip(el) {
|
|
42
|
+
await vi.waitFor(() => {
|
|
43
|
+
triggerTooltip(el);
|
|
44
|
+
expect(document.querySelector('.lc-tooltip-item-root')).not.toBeNull();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
36
47
|
function triggerPointerEvent(el, type) {
|
|
37
48
|
el.dispatchEvent(new PointerEvent(type, { bubbles: true }));
|
|
38
49
|
}
|
|
@@ -48,7 +59,7 @@ describe('DefaultTooltip', () => {
|
|
|
48
59
|
});
|
|
49
60
|
const tooltipCtx = container.querySelector('.lc-tooltip-context');
|
|
50
61
|
await expect.element(tooltipCtx).toBeInTheDocument();
|
|
51
|
-
|
|
62
|
+
await dispatchAndWaitForTooltip(tooltipCtx);
|
|
52
63
|
await vi.waitFor(() => {
|
|
53
64
|
// Should have a header (portaled to body)
|
|
54
65
|
const header = document.querySelector('.lc-tooltip-header');
|
|
@@ -73,7 +84,7 @@ describe('DefaultTooltip', () => {
|
|
|
73
84
|
});
|
|
74
85
|
const tooltipCtx = container.querySelector('.lc-tooltip-context');
|
|
75
86
|
await expect.element(tooltipCtx).toBeInTheDocument();
|
|
76
|
-
|
|
87
|
+
await dispatchAndWaitForTooltip(tooltipCtx);
|
|
77
88
|
await vi.waitFor(() => {
|
|
78
89
|
const colorDots = document.querySelectorAll('.lc-tooltip-item-color');
|
|
79
90
|
expect(colorDots.length).toBe(3);
|
|
@@ -91,7 +102,7 @@ describe('DefaultTooltip', () => {
|
|
|
91
102
|
});
|
|
92
103
|
const tooltipCtx = container.querySelector('.lc-tooltip-context');
|
|
93
104
|
await expect.element(tooltipCtx).toBeInTheDocument();
|
|
94
|
-
|
|
105
|
+
await dispatchAndWaitForTooltip(tooltipCtx);
|
|
95
106
|
await vi.waitFor(() => {
|
|
96
107
|
const items = document.querySelectorAll('.lc-tooltip-item-root');
|
|
97
108
|
expect(items.length).toBe(4);
|
|
@@ -131,7 +142,7 @@ describe('DefaultTooltip', () => {
|
|
|
131
142
|
});
|
|
132
143
|
const tooltipCtx = container.querySelector('.lc-tooltip-context');
|
|
133
144
|
await expect.element(tooltipCtx).toBeInTheDocument();
|
|
134
|
-
|
|
145
|
+
await dispatchAndWaitForTooltip(tooltipCtx);
|
|
135
146
|
await vi.waitFor(() => {
|
|
136
147
|
const items = document.querySelectorAll('.lc-tooltip-item-root');
|
|
137
148
|
// 1 series item, no total
|
|
@@ -150,7 +161,7 @@ describe('DefaultTooltip', () => {
|
|
|
150
161
|
});
|
|
151
162
|
const tooltipCtx = container.querySelector('.lc-tooltip-context');
|
|
152
163
|
await expect.element(tooltipCtx).toBeInTheDocument();
|
|
153
|
-
|
|
164
|
+
await dispatchAndWaitForTooltip(tooltipCtx);
|
|
154
165
|
await vi.waitFor(() => {
|
|
155
166
|
const header = document.querySelector('.lc-tooltip-header');
|
|
156
167
|
expect(header).not.toBeNull();
|
|
@@ -174,7 +185,7 @@ describe('DefaultTooltip', () => {
|
|
|
174
185
|
});
|
|
175
186
|
const tooltipCtx = container.querySelector('.lc-tooltip-context');
|
|
176
187
|
await expect.element(tooltipCtx).toBeInTheDocument();
|
|
177
|
-
|
|
188
|
+
await dispatchAndWaitForTooltip(tooltipCtx);
|
|
178
189
|
await vi.waitFor(() => {
|
|
179
190
|
const items = document.querySelectorAll('.lc-tooltip-item-root');
|
|
180
191
|
// Should show x and y items
|
|
@@ -194,7 +205,7 @@ describe('DefaultTooltip', () => {
|
|
|
194
205
|
});
|
|
195
206
|
const tooltipCtx = container.querySelector('.lc-tooltip-context');
|
|
196
207
|
await expect.element(tooltipCtx).toBeInTheDocument();
|
|
197
|
-
|
|
208
|
+
await dispatchAndWaitForTooltip(tooltipCtx);
|
|
198
209
|
await vi.waitFor(() => {
|
|
199
210
|
const items = document.querySelectorAll('.lc-tooltip-item-root');
|
|
200
211
|
// Should show x, y, and r items
|
|
@@ -216,7 +227,7 @@ describe('DefaultTooltip', () => {
|
|
|
216
227
|
});
|
|
217
228
|
const tooltipCtx = container.querySelector('.lc-tooltip-context');
|
|
218
229
|
await expect.element(tooltipCtx).toBeInTheDocument();
|
|
219
|
-
|
|
230
|
+
await dispatchAndWaitForTooltip(tooltipCtx);
|
|
220
231
|
await vi.waitFor(() => {
|
|
221
232
|
// Should show a header with the series name
|
|
222
233
|
const header = document.querySelector('.lc-tooltip-header');
|
|
@@ -30,9 +30,12 @@ describe('LineChart', () => {
|
|
|
30
30
|
clientX: rect.x + rect.width / 2,
|
|
31
31
|
clientY: rect.y + rect.height / 2,
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
// Retry the dispatch inside vi.waitFor — DefaultTooltip is lazy-loaded
|
|
34
|
+
// by ChartChildren so the first pointer event may fire before its chunk
|
|
35
|
+
// resolves.
|
|
35
36
|
await vi.waitFor(() => {
|
|
37
|
+
tooltipRect.dispatchEvent(new PointerEvent('pointerenter', eventInit));
|
|
38
|
+
tooltipRect.dispatchEvent(new PointerEvent('pointermove', eventInit));
|
|
36
39
|
const colorDot = document.querySelector('.lc-tooltip-item-color');
|
|
37
40
|
expect(colorDot).not.toBeNull();
|
|
38
41
|
const color = colorDot.style.getPropertyValue('--color');
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import GeoPath, { type GeoPathProps } from './GeoPath.svelte';
|
|
3
|
-
import type { Without } from '
|
|
3
|
+
import type { Without } from '../../utils/types.js';
|
|
4
4
|
export type GeoCirclePropsWithoutHTML = {
|
|
5
5
|
/**
|
|
6
6
|
* The radius of the circle in degrees.
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
<script lang="ts">
|
|
29
29
|
import { geoCircle } from 'd3-geo';
|
|
30
|
-
import { extractLayerProps } from '
|
|
30
|
+
import { extractLayerProps } from '../../utils/attributes.js';
|
|
31
31
|
|
|
32
32
|
let { radius = 90, center = [0, 0], precision = 6, ...restProps }: GeoCircleProps = $props();
|
|
33
33
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { GeoPermissibleObjects } from 'd3-geo';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
|
|
5
|
-
import type { ClipPathPropsWithoutHTML } from '
|
|
5
|
+
import type { ClipPathPropsWithoutHTML } from '../ClipPath.svelte';
|
|
6
6
|
import type { GeoPathPropsWithoutHTML } from './GeoPath.svelte';
|
|
7
|
-
import type { Without } from '
|
|
7
|
+
import type { Without } from '../../utils/types.js';
|
|
8
8
|
|
|
9
9
|
export type BaseGeoClipPathPropsWithoutHTML = {
|
|
10
10
|
/**
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
<script lang="ts">
|
|
47
47
|
import { geoPath as d3GeoPath } from 'd3-geo';
|
|
48
48
|
|
|
49
|
-
import ClipPath from '
|
|
50
|
-
import { createId } from '
|
|
51
|
-
import { getGeoContext } from '
|
|
49
|
+
import ClipPath from '../ClipPath.svelte';
|
|
50
|
+
import { createId } from '../../utils/createId.js';
|
|
51
|
+
import { getGeoContext } from '../../contexts/geo.js';
|
|
52
52
|
|
|
53
53
|
const uid = $props.id();
|
|
54
54
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GeoPermissibleObjects } from 'd3-geo';
|
|
2
|
-
import type { ClipPathPropsWithoutHTML } from '
|
|
2
|
+
import type { ClipPathPropsWithoutHTML } from '../ClipPath.svelte';
|
|
3
3
|
import type { GeoPathPropsWithoutHTML } from './GeoPath.svelte';
|
|
4
|
-
import type { Without } from '
|
|
4
|
+
import type { Without } from '../../utils/types.js';
|
|
5
5
|
export type BaseGeoClipPathPropsWithoutHTML = {
|
|
6
6
|
/**
|
|
7
7
|
* A unique id for the clipPath.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { Without } from '
|
|
3
|
+
import type { Without } from '../../utils/types.js';
|
|
4
4
|
|
|
5
5
|
export type GeoEdgeFadePropsWithoutHTML = {
|
|
6
6
|
link: { source: [number, number]; target: [number, number] };
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
import { scaleLinear } from 'd3-scale';
|
|
22
22
|
import { geoDistance } from 'd3-geo';
|
|
23
23
|
|
|
24
|
-
import { getGeoContext } from '
|
|
25
|
-
import Group, { type GroupProps } from '
|
|
26
|
-
import { extractLayerProps } from '
|
|
24
|
+
import { getGeoContext } from '../../contexts/geo.js';
|
|
25
|
+
import Group, { type GroupProps } from '../Group.svelte';
|
|
26
|
+
import { extractLayerProps } from '../../utils/attributes.js';
|
|
27
27
|
|
|
28
28
|
let {
|
|
29
29
|
link,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { Without } from '
|
|
2
|
+
import type { Without } from '../../utils/types.js';
|
|
3
3
|
export type GeoEdgeFadePropsWithoutHTML = {
|
|
4
4
|
link: {
|
|
5
5
|
source: [number, number];
|
|
@@ -13,7 +13,7 @@ export type GeoEdgeFadePropsWithoutHTML = {
|
|
|
13
13
|
children?: Snippet;
|
|
14
14
|
};
|
|
15
15
|
export type GeoEdgeFadeProps = GeoEdgeFadePropsWithoutHTML & Without<GroupProps, GeoEdgeFadePropsWithoutHTML>;
|
|
16
|
-
import { type GroupProps } from '
|
|
16
|
+
import { type GroupProps } from '../Group.svelte';
|
|
17
17
|
declare const GeoEdgeFade: import("svelte").Component<GeoEdgeFadeProps, {}, "ref">;
|
|
18
18
|
type GeoEdgeFade = ReturnType<typeof GeoEdgeFade>;
|
|
19
19
|
export default GeoEdgeFade;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Placement } from '
|
|
3
|
-
import { asAny, type Without } from '
|
|
2
|
+
import type { Placement } from '../types.js';
|
|
3
|
+
import { asAny, type Without } from '../../utils/types.js';
|
|
4
4
|
|
|
5
5
|
export type GeoLegendUnits = 'km' | 'mi';
|
|
6
6
|
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
import { format, type FormatType, type FormatConfig } from '@layerstack/utils';
|
|
140
140
|
|
|
141
141
|
import { cls } from '@layerstack/tailwind';
|
|
142
|
-
import { getChartContext } from '
|
|
142
|
+
import { getChartContext } from '../../contexts/chart.js';
|
|
143
143
|
|
|
144
144
|
let {
|
|
145
145
|
units = 'mi',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Placement } from '
|
|
2
|
-
import { type Without } from '
|
|
1
|
+
import type { Placement } from '../types.js';
|
|
2
|
+
import { type Without } from '../../utils/types.js';
|
|
3
3
|
export type GeoLegendUnits = 'km' | 'mi';
|
|
4
4
|
export type GeoLegendVariant = 'bracket' | 'alternating';
|
|
5
5
|
export type GeoLegendPropsWithoutHTML = {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
} from 'd3-geo';
|
|
12
12
|
import { curveLinearClosed, type CurveFactory, type CurveFactoryLineOnly } from 'd3-shape';
|
|
13
13
|
|
|
14
|
-
import type { CommonStyleProps, Without } from '
|
|
15
|
-
import type { PathProps } from '
|
|
14
|
+
import type { CommonStyleProps, Without } from '../../utils/types.js';
|
|
15
|
+
import type { PathProps } from '../Path.svelte';
|
|
16
16
|
|
|
17
17
|
export type GeoPathPropsWithoutHTML = {
|
|
18
18
|
/**
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
<script lang="ts">
|
|
80
80
|
import { cls } from '@layerstack/tailwind';
|
|
81
81
|
|
|
82
|
-
import { geoCurvePath } from '
|
|
83
|
-
import { getChartContext } from '
|
|
84
|
-
import { getGeoContext } from '
|
|
85
|
-
import Path from '
|
|
82
|
+
import { geoCurvePath } from '../../utils/geo.js';
|
|
83
|
+
import { getChartContext } from '../../contexts/chart.js';
|
|
84
|
+
import { getGeoContext } from '../../contexts/geo.js';
|
|
85
|
+
import Path from '../Path.svelte';
|
|
86
86
|
|
|
87
87
|
let {
|
|
88
88
|
geoTransform,
|
|
@@ -2,8 +2,8 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import type { SVGAttributes } from 'svelte/elements';
|
|
3
3
|
import { type GeoIdentityTransform, type GeoPermissibleObjects, type GeoProjection, type GeoTransformPrototype } from 'd3-geo';
|
|
4
4
|
import { type CurveFactory, type CurveFactoryLineOnly } from 'd3-shape';
|
|
5
|
-
import type { CommonStyleProps, Without } from '
|
|
6
|
-
import type { PathProps } from '
|
|
5
|
+
import type { CommonStyleProps, Without } from '../../utils/types.js';
|
|
6
|
+
import type { PathProps } from '../Path.svelte';
|
|
7
7
|
export type GeoPathPropsWithoutHTML = {
|
|
8
8
|
/**
|
|
9
9
|
* GeoJSON data to render
|
|
@@ -45,7 +45,7 @@ export type GeoPathPropsWithoutHTML = {
|
|
|
45
45
|
}]>;
|
|
46
46
|
} & CommonStyleProps & Pick<PathProps, 'motion' | 'draw' | 'marker' | 'markerStart' | 'markerMid' | 'markerEnd' | 'startContent' | 'endContent'>;
|
|
47
47
|
export type GeoPathProps = GeoPathPropsWithoutHTML & Without<SVGAttributes<SVGPathElement>, GeoPathPropsWithoutHTML>;
|
|
48
|
-
import { geoCurvePath } from '
|
|
48
|
+
import { geoCurvePath } from '../../utils/geo.js';
|
|
49
49
|
declare const GeoPath: import("svelte").Component<GeoPathProps, {}, "ref">;
|
|
50
50
|
type GeoPath = ReturnType<typeof GeoPath>;
|
|
51
51
|
export default GeoPath;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import Circle, { type CircleProps } from '
|
|
4
|
-
import type { Without } from '
|
|
3
|
+
import Circle, { type CircleProps } from '../Circle.svelte';
|
|
4
|
+
import type { Without } from '../../utils/types.js';
|
|
5
5
|
|
|
6
6
|
export type GeoPointPropsWithoutHTML = {
|
|
7
7
|
/**
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
32
|
<script lang="ts">
|
|
33
|
-
import Group from '
|
|
34
|
-
import { getLayerContext } from '
|
|
35
|
-
import { getGeoContext } from '
|
|
36
|
-
import { extractLayerProps } from '
|
|
33
|
+
import Group from '../Group.svelte';
|
|
34
|
+
import { getLayerContext } from '../../contexts/layer.js';
|
|
35
|
+
import { getGeoContext } from '../../contexts/geo.js';
|
|
36
|
+
import { extractLayerProps } from '../../utils/attributes.js';
|
|
37
37
|
|
|
38
38
|
let {
|
|
39
39
|
lat,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import { type CircleProps } from '
|
|
3
|
-
import type { Without } from '
|
|
2
|
+
import { type CircleProps } from '../Circle.svelte';
|
|
3
|
+
import type { Without } from '../../utils/types.js';
|
|
4
4
|
export type GeoPointPropsWithoutHTML = {
|
|
5
5
|
/**
|
|
6
6
|
* Latitude of the point.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import { GeoState, type GeoStateProps } from '
|
|
3
|
+
import { GeoState, type GeoStateProps } from '../../states/geo.svelte.js';
|
|
4
4
|
|
|
5
5
|
export type GeoProjectionProps = GeoStateProps & {
|
|
6
6
|
children: Snippet;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<script lang="ts">
|
|
11
|
-
import { setGeoContext } from '
|
|
12
|
-
import { getChartContext } from '
|
|
11
|
+
import { setGeoContext } from '../../contexts/geo.js';
|
|
12
|
+
import { getChartContext } from '../../contexts/chart.js';
|
|
13
13
|
|
|
14
14
|
let { children, ...props }: GeoProjectionProps = $props();
|
|
15
15
|
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
import { untrack } from 'svelte';
|
|
71
71
|
import { geoPath } from 'd3-geo';
|
|
72
72
|
|
|
73
|
-
import { getChartContext } from '
|
|
74
|
-
import { getGeoContext } from '
|
|
75
|
-
import { getLayerContext } from '
|
|
73
|
+
import { getChartContext } from '../../contexts/chart.js';
|
|
74
|
+
import { getGeoContext } from '../../contexts/geo.js';
|
|
75
|
+
import { getLayerContext } from '../../contexts/layer.js';
|
|
76
76
|
|
|
77
77
|
let {
|
|
78
78
|
image,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import { curveNatural, type CurveFactory, type CurveFactoryLineOnly } from 'd3-shape';
|
|
3
|
-
import type { Without } from '
|
|
4
|
-
import type { PathProps } from '
|
|
3
|
+
import type { Without } from '../../utils/types.js';
|
|
4
|
+
import type { PathProps } from '../Path.svelte';
|
|
5
5
|
|
|
6
6
|
export type GeoSplinePropsWithoutHTML = {
|
|
7
7
|
/**
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
import { geoOrthographic, geoInterpolate } from 'd3-geo';
|
|
37
37
|
import { line as d3Line } from 'd3-shape';
|
|
38
38
|
|
|
39
|
-
import { getGeoContext } from '
|
|
40
|
-
import { extractLayerProps } from '
|
|
41
|
-
import Path from '
|
|
39
|
+
import { getGeoContext } from '../../contexts/geo.js';
|
|
40
|
+
import { extractLayerProps } from '../../utils/attributes.js';
|
|
41
|
+
import Path from '../Path.svelte';
|
|
42
42
|
|
|
43
43
|
let { link, loft = 1.0, curve = curveNatural, ...restProps }: GeoSplineProps = $props();
|
|
44
44
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CurveFactory, type CurveFactoryLineOnly } from 'd3-shape';
|
|
2
|
-
import type { Without } from '
|
|
3
|
-
import type { PathProps } from '
|
|
2
|
+
import type { Without } from '../../utils/types.js';
|
|
3
|
+
import type { PathProps } from '../Path.svelte';
|
|
4
4
|
export type GeoSplinePropsWithoutHTML = {
|
|
5
5
|
/**
|
|
6
6
|
* Link between two points on the globe.
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
// @ts-expect-error
|
|
45
45
|
import { tile as d3Tile } from 'd3-tile';
|
|
46
46
|
|
|
47
|
-
import { getChartContext } from '
|
|
48
|
-
import { getGeoContext } from '
|
|
49
|
-
import { getLayerContext } from '
|
|
50
|
-
import Group from '
|
|
47
|
+
import { getChartContext } from '../../contexts/chart.js';
|
|
48
|
+
import { getGeoContext } from '../../contexts/geo.js';
|
|
49
|
+
import { getLayerContext } from '../../contexts/layer.js';
|
|
50
|
+
import Group from '../Group.svelte';
|
|
51
51
|
import TileImage from './TileImage.svelte';
|
|
52
|
-
import { extractLayerProps } from '
|
|
52
|
+
import { extractLayerProps } from '../../utils/attributes.js';
|
|
53
53
|
|
|
54
54
|
let {
|
|
55
55
|
url,
|
|
@@ -33,7 +33,7 @@ export type GeoTilePropsWithoutHTML = {
|
|
|
33
33
|
tiles: any[];
|
|
34
34
|
}]>;
|
|
35
35
|
};
|
|
36
|
-
import Group from '
|
|
36
|
+
import Group from '../Group.svelte';
|
|
37
37
|
declare const GeoTile: import("svelte").Component<GeoTilePropsWithoutHTML, {}, "">;
|
|
38
38
|
type GeoTile = ReturnType<typeof GeoTile>;
|
|
39
39
|
export default GeoTile;
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<script lang="ts">
|
|
14
|
-
import { isVisible } from '
|
|
15
|
-
import { getGeoContext } from '
|
|
14
|
+
import { isVisible } from '../../utils/geo.js';
|
|
15
|
+
import { getGeoContext } from '../../contexts/geo.js';
|
|
16
16
|
|
|
17
17
|
let { lat, long, children }: GeoVisibleProps = $props();
|
|
18
18
|
const geo = getGeoContext();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Without } from '
|
|
2
|
+
import type { Without } from '../../utils/types.js';
|
|
3
3
|
import type { ComponentProps } from 'svelte';
|
|
4
4
|
import GeoPath, { type GeoPathProps } from './GeoPath.svelte';
|
|
5
5
|
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
<script lang="ts">
|
|
18
18
|
import { geoGraticule } from 'd3-geo';
|
|
19
|
-
import { extractLayerProps } from '
|
|
20
|
-
import Group from '
|
|
19
|
+
import { extractLayerProps } from '../../utils/attributes.js';
|
|
20
|
+
import Group from '../Group.svelte';
|
|
21
21
|
|
|
22
22
|
let { lines, outline, stepX = 10, stepY = 10, ...restProps }: GraticuleProps = $props();
|
|
23
23
|
|