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
|
@@ -112,16 +112,20 @@
|
|
|
112
112
|
<script lang="ts" generics="TData = any">
|
|
113
113
|
import type { Snippet } from 'svelte';
|
|
114
114
|
import { bisector, max, min } from 'd3-array';
|
|
115
|
-
|
|
115
|
+
// d3-quadtree (used only for quadtree* tooltip modes) is dynamically
|
|
116
|
+
// imported inside the $effect below so non-quadtree users don't pay for it.
|
|
117
|
+
import type { Quadtree } from 'd3-quadtree';
|
|
116
118
|
import { sortFunc, localPoint } from '@layerstack/utils';
|
|
117
119
|
import { cls } from '@layerstack/tailwind';
|
|
118
120
|
|
|
119
121
|
import { getChartContext } from '../../contexts/chart.js';
|
|
120
122
|
import { getGeoContext } from '../../contexts/geo.js';
|
|
121
123
|
import Svg from './../layers/Svg.svelte';
|
|
122
|
-
import Arc from '../Arc.svelte';
|
|
123
124
|
import ChartClipPath from './../ChartClipPath.svelte';
|
|
124
|
-
|
|
125
|
+
// Voronoi (used only when mode === 'voronoi') and Arc (used only for radial
|
|
126
|
+
// bounds/band mode) are dynamically imported inline in the markup via
|
|
127
|
+
// `{#await import(...)}` so non-voronoi/non-radial tooltip users don't pay
|
|
128
|
+
// for them. Voronoi alone pulls in d3-geo-voronoi + d3-geo.
|
|
125
129
|
|
|
126
130
|
import { isScaleBand, isScaleTime, scaleInvert } from '../../utils/scales.svelte.js';
|
|
127
131
|
import { cartesianToPolar } from '../../utils/math.js';
|
|
@@ -432,65 +436,77 @@
|
|
|
432
436
|
const xAccessorOverride = $derived(xProp != null ? accessor(xProp) : undefined);
|
|
433
437
|
const yAccessorOverride = $derived(yProp != null ? accessor(yProp) : undefined);
|
|
434
438
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
439
|
+
let quadtree = $state<Quadtree<[number, number]> | undefined>();
|
|
440
|
+
|
|
441
|
+
$effect(() => {
|
|
442
|
+
// Touch the dependencies the quadtree is built from so the effect re-runs
|
|
443
|
+
// on changes (mode, accessors, scales, data, projection).
|
|
444
|
+
if (!['quadtree', 'quadtree-x', 'quadtree-y'].includes(mode)) {
|
|
445
|
+
quadtree = undefined;
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
442
448
|
|
|
443
|
-
|
|
444
|
-
|
|
449
|
+
const m = mode;
|
|
450
|
+
const xAcc = xAccessorOverride;
|
|
451
|
+
const yAcc = yAccessorOverride;
|
|
452
|
+
const xScale = ctx.xScale;
|
|
453
|
+
const yScale = ctx.yScale;
|
|
454
|
+
const xGet = ctx.xGet;
|
|
455
|
+
const yGet = ctx.yGet;
|
|
456
|
+
const xAccCtx = ctx.x;
|
|
457
|
+
const yAccCtx = ctx.y;
|
|
458
|
+
const projection = geo.projection;
|
|
459
|
+
const flatData = ctx.flatData;
|
|
460
|
+
|
|
461
|
+
let cancelled = false;
|
|
462
|
+
import('d3-quadtree').then(({ quadtree: d3Quadtree }) => {
|
|
463
|
+
if (cancelled) return;
|
|
464
|
+
quadtree = d3Quadtree<[number, number]>()
|
|
465
|
+
.x((d) => {
|
|
466
|
+
if (m === 'quadtree-y') return 0;
|
|
467
|
+
if (xAcc) {
|
|
468
|
+
const scaled = xScale(xAcc(d));
|
|
445
469
|
return typeof scaled === 'number' ? scaled : 0;
|
|
446
470
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
const
|
|
450
|
-
const
|
|
451
|
-
const geoValue = geo.projection([lat, long]) ?? [0, 0];
|
|
471
|
+
if (projection) {
|
|
472
|
+
const lat = xAccCtx(d);
|
|
473
|
+
const long = yAccCtx(d);
|
|
474
|
+
const geoValue = projection([lat, long]) ?? [0, 0];
|
|
452
475
|
return geoValue[0];
|
|
453
476
|
}
|
|
454
|
-
|
|
455
|
-
const value = ctx.xGet(d);
|
|
456
|
-
|
|
477
|
+
const value = xGet(d);
|
|
457
478
|
if (Array.isArray(value)) {
|
|
458
479
|
// `x` accessor with multiple properties (ex. `x={['start', 'end']})`).
|
|
459
480
|
// Default to the max (typically the "target"/"end" endpoint); override
|
|
460
481
|
// via the `x` prop for explicit control.
|
|
461
482
|
return max(value);
|
|
462
|
-
} else {
|
|
463
|
-
return value;
|
|
464
483
|
}
|
|
484
|
+
return value;
|
|
465
485
|
})
|
|
466
486
|
.y((d) => {
|
|
467
|
-
if (
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
if (yAccessorOverride) {
|
|
472
|
-
const scaled = ctx.yScale(yAccessorOverride(d));
|
|
487
|
+
if (m === 'quadtree-x') return 0;
|
|
488
|
+
if (yAcc) {
|
|
489
|
+
const scaled = yScale(yAcc(d));
|
|
473
490
|
return typeof scaled === 'number' ? scaled : 0;
|
|
474
491
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
const
|
|
479
|
-
const geoValue = geo.projection([lat, long]) ?? [0, 0];
|
|
492
|
+
if (projection) {
|
|
493
|
+
const lat = xAccCtx(d);
|
|
494
|
+
const long = yAccCtx(d);
|
|
495
|
+
const geoValue = projection([lat, long]) ?? [0, 0];
|
|
480
496
|
return geoValue[1];
|
|
481
497
|
}
|
|
482
|
-
|
|
483
|
-
const value = ctx.yGet(d);
|
|
484
|
-
|
|
498
|
+
const value = yGet(d);
|
|
485
499
|
if (Array.isArray(value)) {
|
|
486
500
|
// `y` accessor with multiple properties — default to max endpoint.
|
|
487
501
|
return max(value);
|
|
488
|
-
} else {
|
|
489
|
-
return value;
|
|
490
502
|
}
|
|
503
|
+
return value;
|
|
491
504
|
})
|
|
492
|
-
.addAll(
|
|
493
|
-
}
|
|
505
|
+
.addAll(flatData as [number, number][]);
|
|
506
|
+
});
|
|
507
|
+
return () => {
|
|
508
|
+
cancelled = true;
|
|
509
|
+
};
|
|
494
510
|
});
|
|
495
511
|
|
|
496
512
|
const rects: Array<{ x: number; y: number; width: number; height: number; data: any }> =
|
|
@@ -701,56 +717,60 @@
|
|
|
701
717
|
{@render children?.({ state: tooltipState })}
|
|
702
718
|
|
|
703
719
|
{#if mode === 'voronoi'}
|
|
704
|
-
|
|
705
|
-
<
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (e.target?.hasPointerCapture(e.pointerId)) {
|
|
720
|
+
{#await import('../Voronoi.svelte') then { default: Voronoi }}
|
|
721
|
+
<Svg>
|
|
722
|
+
<Voronoi
|
|
723
|
+
x={xProp}
|
|
724
|
+
y={yProp}
|
|
725
|
+
r={radius}
|
|
726
|
+
onpointerenter={(e, { data }) => {
|
|
727
|
+
showTooltip(e, data);
|
|
728
|
+
}}
|
|
729
|
+
onpointermove={(e, { data }) => {
|
|
730
|
+
showTooltip(e, data);
|
|
731
|
+
}}
|
|
732
|
+
onpointerleave={() => hideTooltip()}
|
|
733
|
+
onpointerdown={(e) => {
|
|
719
734
|
// @ts-expect-error
|
|
720
|
-
e.target
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
735
|
+
if (e.target?.hasPointerCapture(e.pointerId)) {
|
|
736
|
+
// @ts-expect-error
|
|
737
|
+
e.target.releasePointerCapture(e.pointerId);
|
|
738
|
+
}
|
|
739
|
+
}}
|
|
740
|
+
onclick={(e, { data }) => {
|
|
741
|
+
onclick(e, { data });
|
|
742
|
+
}}
|
|
743
|
+
classes={{ path: cls('lc-tooltip-voronoi-path', debug && 'debug') }}
|
|
744
|
+
/>
|
|
745
|
+
</Svg>
|
|
746
|
+
{/await}
|
|
729
747
|
{:else if mode === 'bounds' || mode === 'band'}
|
|
730
748
|
<Svg center={ctx.radial}>
|
|
731
749
|
<g class="lc-tooltip-rects-g">
|
|
732
750
|
{#each rects as rect}
|
|
733
751
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
734
752
|
{#if ctx.radial}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
target
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
onclick(e
|
|
752
|
-
|
|
753
|
-
|
|
753
|
+
{#await import('../Arc.svelte') then { default: Arc }}
|
|
754
|
+
<Arc
|
|
755
|
+
innerRadius={rect.y}
|
|
756
|
+
outerRadius={rect.y + rect.height}
|
|
757
|
+
startAngle={rect.x}
|
|
758
|
+
endAngle={rect.x + rect.width}
|
|
759
|
+
class={cls('lc-tooltip-rect', debug && 'debug')}
|
|
760
|
+
onpointerenter={(e) => showTooltip(e, rect?.data)}
|
|
761
|
+
onpointermove={(e) => showTooltip(e, rect?.data)}
|
|
762
|
+
onpointerleave={() => hideTooltip()}
|
|
763
|
+
onpointerdown={(e) => {
|
|
764
|
+
const target = e.target as Element;
|
|
765
|
+
if (target?.hasPointerCapture(e.pointerId)) {
|
|
766
|
+
target.releasePointerCapture(e.pointerId);
|
|
767
|
+
}
|
|
768
|
+
}}
|
|
769
|
+
onclick={(e) => {
|
|
770
|
+
onclick(e, { data: rect?.data });
|
|
771
|
+
}}
|
|
772
|
+
/>
|
|
773
|
+
{/await}
|
|
754
774
|
{:else}
|
|
755
775
|
<rect
|
|
756
776
|
x={rect?.x}
|
|
@@ -87,7 +87,7 @@ import type { Snippet } from 'svelte';
|
|
|
87
87
|
declare function $$render<TData = any>(): {
|
|
88
88
|
props: TooltipContextProps<TData>;
|
|
89
89
|
exports: {};
|
|
90
|
-
bindings: "
|
|
90
|
+
bindings: "state" | "ref";
|
|
91
91
|
slots: {};
|
|
92
92
|
events: {};
|
|
93
93
|
};
|
|
@@ -95,7 +95,7 @@ declare class __sveltets_Render<TData = any> {
|
|
|
95
95
|
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
96
96
|
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
97
97
|
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
98
|
-
bindings(): "
|
|
98
|
+
bindings(): "state" | "ref";
|
|
99
99
|
exports(): {};
|
|
100
100
|
}
|
|
101
101
|
interface $$IsomorphicComponent {
|
package/dist/force.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/force/index.js';
|
package/dist/force.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/force/index.js';
|
package/dist/geo.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/geo/index.js';
|
package/dist/geo.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/geo/index.js';
|
package/dist/graph.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/graph/index.js';
|
package/dist/graph.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/graph/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/hierarchy/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/hierarchy/index.js';
|
|
@@ -95,8 +95,8 @@ export declare class ChartState<TData = any, XScale extends AnyScale = AnyScale,
|
|
|
95
95
|
containerHeight: number;
|
|
96
96
|
data: import("d3-sankey").SankeyGraph<any, any> | readonly TData[] | import("d3-hierarchy").HierarchyNode<TData>;
|
|
97
97
|
flatData: TData[];
|
|
98
|
-
_xScaleProp:
|
|
99
|
-
_yScaleProp:
|
|
98
|
+
_xScaleProp: import("d3-scale").ScaleTime<number, number, never> | import("d3-scale").ScaleBand<string> | AnyScale<any, any, any[]>;
|
|
99
|
+
_yScaleProp: import("d3-scale").ScaleTime<number, number, never> | import("d3-scale").ScaleBand<string> | AnyScale<any, any, any[]>;
|
|
100
100
|
_zScaleProp: AnyScale;
|
|
101
101
|
_rScaleProp: AnyScale | import("d3-scale").ScalePower<any, any, any>;
|
|
102
102
|
xRangeProp: import("../utils/types.js").BaseRange | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import dagre from '@dagrejs/dagre';
|
|
2
|
-
import { Align, EdgeLabelPosition, RankDir } from '../../components/Dagre.svelte';
|
|
2
|
+
import { Align, EdgeLabelPosition, RankDir, } from '../../components/graph/Dagre.svelte';
|
|
3
3
|
/**
|
|
4
4
|
* Build `dagre.graphlib.Graph` instance from DagreGraphData (`{ nodes, edges }`)
|
|
5
5
|
*/
|
|
@@ -38,5 +38,5 @@ type GetLinkRadialD3PathProps = {
|
|
|
38
38
|
target: LinkCoords;
|
|
39
39
|
curve?: CurveFactory;
|
|
40
40
|
};
|
|
41
|
-
export declare function getLinkRadialD3Path({ source, target, curve
|
|
41
|
+
export declare function getLinkRadialD3Path({ source, target, curve }: GetLinkRadialD3PathProps): string;
|
|
42
42
|
export {};
|
package/dist/utils/linkUtils.js
CHANGED
|
@@ -233,7 +233,7 @@ export function getLinkRadialPresetPath({ source, target, type, radius, bend = 2
|
|
|
233
233
|
const p2y = cornerY + radialDir * r * ts;
|
|
234
234
|
return `M${sx},${sy}L${p1x},${p1y}L${p2x},${p2y}L${tx},${ty}`;
|
|
235
235
|
}
|
|
236
|
-
export function getLinkRadialD3Path({ source, target, curve
|
|
236
|
+
export function getLinkRadialD3Path({ source, target, curve }) {
|
|
237
237
|
const g = radialGeometry(source, target);
|
|
238
238
|
const { sr, tr, sc, ss, tc, ts, sx, sy, tx, ty, sweepFlag } = g;
|
|
239
239
|
// Step curves render as polar arcs/radials rather than cartesian stairs.
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "techniq/layerchart",
|
|
7
7
|
"homepage": "https://layerchart.com",
|
|
8
|
-
"version": "2.0.0-next.
|
|
8
|
+
"version": "2.0.0-next.60",
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@changesets/cli": "^2.30.0",
|
|
11
11
|
"@napi-rs/canvas": "^0.1.97",
|
|
@@ -49,6 +49,9 @@
|
|
|
49
49
|
"vitest-browser-svelte": "^2.1.0"
|
|
50
50
|
},
|
|
51
51
|
"type": "module",
|
|
52
|
+
"sideEffects": [
|
|
53
|
+
"**/*.css"
|
|
54
|
+
],
|
|
52
55
|
"dependencies": {
|
|
53
56
|
"@dagrejs/dagre": "^2.0.4",
|
|
54
57
|
"@layerstack/svelte-actions": "1.0.1-next.18",
|
|
@@ -95,6 +98,26 @@
|
|
|
95
98
|
"svelte": "./dist/server/index.js",
|
|
96
99
|
"default": "./dist/server/index.js"
|
|
97
100
|
},
|
|
101
|
+
"./geo": {
|
|
102
|
+
"types": "./dist/geo.d.ts",
|
|
103
|
+
"svelte": "./dist/geo.js",
|
|
104
|
+
"default": "./dist/geo.js"
|
|
105
|
+
},
|
|
106
|
+
"./hierarchy": {
|
|
107
|
+
"types": "./dist/hierarchy.d.ts",
|
|
108
|
+
"svelte": "./dist/hierarchy.js",
|
|
109
|
+
"default": "./dist/hierarchy.js"
|
|
110
|
+
},
|
|
111
|
+
"./force": {
|
|
112
|
+
"types": "./dist/force.d.ts",
|
|
113
|
+
"svelte": "./dist/force.js",
|
|
114
|
+
"default": "./dist/force.js"
|
|
115
|
+
},
|
|
116
|
+
"./graph": {
|
|
117
|
+
"types": "./dist/graph.d.ts",
|
|
118
|
+
"svelte": "./dist/graph.js",
|
|
119
|
+
"default": "./dist/graph.js"
|
|
120
|
+
},
|
|
98
121
|
"./utils/*": {
|
|
99
122
|
"types": "./dist/utils/*.d.ts",
|
|
100
123
|
"svelte": "./dist/utils/*.js",
|
|
@@ -111,6 +134,7 @@
|
|
|
111
134
|
"svelte": "./dist/index.js",
|
|
112
135
|
"scripts": {
|
|
113
136
|
"dev": "pnpm package:watch",
|
|
137
|
+
"build": "svelte-package",
|
|
114
138
|
"package": "svelte-package",
|
|
115
139
|
"package:watch": "svelte-package --watch",
|
|
116
140
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|