layerchart 0.12.1 → 0.13.0
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/components/Arc.svelte +8 -1
- package/components/Arc.svelte.d.ts +2 -0
- package/components/Area.svelte +3 -0
- package/components/Area.svelte.d.ts +4 -0
- package/components/AreaStack.svelte +3 -3
- package/components/Chart.svelte +9 -1
- package/components/Chart.svelte.d.ts +3 -0
- package/components/Circle.svelte +9 -1
- package/components/Circle.svelte.d.ts +4 -0
- package/components/CircleClipPath.svelte +1 -1
- package/components/CircleClipPath.svelte.d.ts +2 -0
- package/components/Group.svelte +1 -1
- package/components/Group.svelte.d.ts +2 -0
- package/components/HighlightLine.svelte +78 -60
- package/components/HighlightLine.svelte.d.ts +5 -2
- package/components/HighlightRect.svelte +50 -45
- package/components/HighlightRect.svelte.d.ts +0 -1
- package/components/Line.svelte +10 -1
- package/components/Line.svelte.d.ts +4 -0
- package/components/Path.svelte +10 -1
- package/components/Path.svelte.d.ts +4 -0
- package/components/Pie.svelte +6 -0
- package/components/Pie.svelte.d.ts +4 -0
- package/components/RectClipPath.svelte +1 -1
- package/components/RectClipPath.svelte.d.ts +2 -0
- package/components/Sankey.svelte.d.ts +1 -1
- package/components/Tooltip.svelte +39 -343
- package/components/Tooltip.svelte.d.ts +2 -13
- package/components/TooltipContext.svelte +351 -0
- package/components/TooltipContext.svelte.d.ts +46 -0
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/package.json +26 -26
- package/components/TooltipContainer.svelte +0 -18
- package/components/TooltipContainer.svelte.d.ts +0 -19
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
<script context="module">import { getContext, setContext } from 'svelte';
|
|
2
|
+
export const tooltipContextKey = {};
|
|
3
|
+
const defaultContext = writable({
|
|
4
|
+
top: 0,
|
|
5
|
+
left: 0,
|
|
6
|
+
data: null,
|
|
7
|
+
show: () => { },
|
|
8
|
+
hide: () => { }
|
|
9
|
+
});
|
|
10
|
+
export function tooltipContext() {
|
|
11
|
+
return getContext(tooltipContextKey) ?? defaultContext;
|
|
12
|
+
}
|
|
13
|
+
function setTooltipContext(tooltip) {
|
|
14
|
+
setContext(tooltipContextKey, tooltip);
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script>import { createEventDispatcher } from 'svelte';
|
|
19
|
+
import { writable } from 'svelte/store';
|
|
20
|
+
import { bisector, max, min } from 'd3-array';
|
|
21
|
+
import { Delaunay } from 'd3-delaunay';
|
|
22
|
+
import { quadtree as d3Quadtree } from 'd3-quadtree';
|
|
23
|
+
import { Svg, Html } from './Chart.svelte';
|
|
24
|
+
import ChartClipPath from './ChartClipPath.svelte';
|
|
25
|
+
import { localPoint } from '../utils/event';
|
|
26
|
+
import { isScaleBand, scaleInvert } from '../utils/scales';
|
|
27
|
+
import { quadtreeRects } from '../utils/quadtree';
|
|
28
|
+
import { createPropertySortFunc, createSortFunc } from 'svelte-ux/utils/sort';
|
|
29
|
+
const dispatch = createEventDispatcher();
|
|
30
|
+
const { flatData, x, xScale, xGet, xRange, y, yScale, yGet, yRange, width, height, padding } = getContext('LayerCake');
|
|
31
|
+
/*
|
|
32
|
+
TODO: Defaults to consider (if possible to detect scale type, which might not be possible)
|
|
33
|
+
- scaleTime / scaleLinear: bisect
|
|
34
|
+
- scaleTime / scaleLinear (multi/stack): bisect
|
|
35
|
+
- scaleTime / scaleBand: bisect (or band)
|
|
36
|
+
- scaleTime (multi) / scaleBand: bounds (or possible band if not overlapping)
|
|
37
|
+
- scaleBand, scaleLinear: band (or bounds)
|
|
38
|
+
- scaleBand, scaleLinear: band (or bounds) - multiple (overlapping) bars
|
|
39
|
+
- scaleLinear, scaleLinear: voronoi (or quadtree)
|
|
40
|
+
*/
|
|
41
|
+
export let mode = 'bisect-x';
|
|
42
|
+
export let snapToDataX = false;
|
|
43
|
+
export let snapToDataY = false;
|
|
44
|
+
export let findTooltipData = 'closest';
|
|
45
|
+
export let radius = Infinity;
|
|
46
|
+
export let debug = false;
|
|
47
|
+
const tooltip = writable({ top: 0, left: 0, data: null, show: showTooltip, hide: hideTooltip });
|
|
48
|
+
setTooltipContext(tooltip);
|
|
49
|
+
let hideTimeoutId;
|
|
50
|
+
$: bisectX = bisector((d) => {
|
|
51
|
+
const value = $x(d);
|
|
52
|
+
if (Array.isArray(value)) {
|
|
53
|
+
// `x` accessor with multiple properties (ex. `x={['start', 'end']})`)
|
|
54
|
+
// Using first value. Consider using average, max, etc
|
|
55
|
+
// const midpoint = new Date((value[1].valueOf() + value[0].getTime()) / 2);
|
|
56
|
+
// return midpoint;
|
|
57
|
+
return value[0];
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
}).left;
|
|
63
|
+
$: bisectY = bisector((d) => {
|
|
64
|
+
const value = $y(d);
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
// `x` accessor with multiple properties (ex. `x={['start', 'end']})`)
|
|
67
|
+
// Using first value. Consider using average, max, etc
|
|
68
|
+
// const midpoint = new Date((value[1].valueOf() + value[0].getTime()) / 2);
|
|
69
|
+
// return midpoint;
|
|
70
|
+
return value[0];
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
}).left;
|
|
76
|
+
function findData(previousValue, currentValue, valueAtPoint, accessor) {
|
|
77
|
+
switch (findTooltipData) {
|
|
78
|
+
case 'closest':
|
|
79
|
+
if (currentValue === undefined) {
|
|
80
|
+
return previousValue;
|
|
81
|
+
}
|
|
82
|
+
else if (previousValue === undefined) {
|
|
83
|
+
return currentValue;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
return Number(valueAtPoint) - Number(accessor(previousValue)) >
|
|
87
|
+
Number(accessor(currentValue)) - Number(valueAtPoint)
|
|
88
|
+
? currentValue
|
|
89
|
+
: previousValue;
|
|
90
|
+
}
|
|
91
|
+
case 'left':
|
|
92
|
+
return previousValue;
|
|
93
|
+
case 'right':
|
|
94
|
+
default:
|
|
95
|
+
return currentValue;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function showTooltip(event, tooltipData) {
|
|
99
|
+
// Cancel hiding tooltip if from previous event loop
|
|
100
|
+
clearTimeout(hideTimeoutId);
|
|
101
|
+
const referenceNode = event.target.closest('.layercake-container');
|
|
102
|
+
const point = localPoint(referenceNode, event);
|
|
103
|
+
const localX = point?.x - $padding.left ?? 0;
|
|
104
|
+
const localY = point?.y - $padding.top ?? 0;
|
|
105
|
+
// If tooltipData not provided already (voronoi, etc), attempt to find it
|
|
106
|
+
// TODO: When using bisect-x/y/band, values should be sorted. Tyipcally are for `x`, but not `y` (and band depends on if x or y scale)
|
|
107
|
+
if (tooltipData == null) {
|
|
108
|
+
switch (mode) {
|
|
109
|
+
case 'quadtree': {
|
|
110
|
+
tooltipData = quadtree.find(localX, localY, radius);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
case 'bisect-band': {
|
|
114
|
+
// `x` and `y` values at mouse/touch coordinate
|
|
115
|
+
const xValueAtPoint = scaleInvert($xScale, localX);
|
|
116
|
+
const yValueAtPoint = scaleInvert($yScale, localY);
|
|
117
|
+
if (isScaleBand($xScale)) {
|
|
118
|
+
// Find point closest to pointer within the x band
|
|
119
|
+
const bandData = $flatData
|
|
120
|
+
.filter((d) => $x(d) === xValueAtPoint)
|
|
121
|
+
.sort(createSortFunc($y)); // sort for bisect
|
|
122
|
+
const index = bisectY(bandData, yValueAtPoint, 1);
|
|
123
|
+
const previousValue = bandData[index - 1];
|
|
124
|
+
const currentValue = bandData[index];
|
|
125
|
+
tooltipData = findData(previousValue, currentValue, yValueAtPoint, $y);
|
|
126
|
+
}
|
|
127
|
+
else if (isScaleBand($yScale)) {
|
|
128
|
+
// Find point closest to pointer within the y band
|
|
129
|
+
const bandData = $flatData
|
|
130
|
+
.filter((d) => $y(d) === yValueAtPoint)
|
|
131
|
+
.sort(createSortFunc($x)); // sort for bisect
|
|
132
|
+
const index = bisectX(bandData, xValueAtPoint, 1);
|
|
133
|
+
const previousValue = bandData[index - 1];
|
|
134
|
+
const currentValue = bandData[index];
|
|
135
|
+
tooltipData = findData(previousValue, currentValue, xValueAtPoint, $x);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
// TODO: Support `bisect-band` without band? Fallback to bisect?
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
case 'bisect-x': {
|
|
143
|
+
// `x` value at mouse/touch coordinate
|
|
144
|
+
const xValueAtPoint = scaleInvert($xScale, localX);
|
|
145
|
+
const index = bisectX($flatData, xValueAtPoint, 1);
|
|
146
|
+
const previousValue = $flatData[index - 1];
|
|
147
|
+
const currentValue = $flatData[index];
|
|
148
|
+
tooltipData = findData(previousValue, currentValue, xValueAtPoint, $x);
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
case 'bisect-y': {
|
|
152
|
+
// `y` value at mouse/touch coordinate
|
|
153
|
+
const yValueAtPoint = scaleInvert($yScale, localY);
|
|
154
|
+
const index = bisectY($flatData, yValueAtPoint, 1);
|
|
155
|
+
const previousValue = $flatData[index - 1];
|
|
156
|
+
const currentValue = $flatData[index];
|
|
157
|
+
tooltipData = findData(previousValue, currentValue, yValueAtPoint, $y);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (tooltipData) {
|
|
163
|
+
$tooltip = {
|
|
164
|
+
...$tooltip,
|
|
165
|
+
left: snapToDataX ? $xGet(tooltipData) : localX,
|
|
166
|
+
top: snapToDataY ? $yGet(tooltipData) : localY,
|
|
167
|
+
data: tooltipData
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
// Hide tooltip if unable to locate
|
|
172
|
+
hideTooltip();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function hideTooltip() {
|
|
176
|
+
// Wait an event loop tick in case `showTooltip` is called immediately on another element, to allow tweeneing (ex. moving between bands/bars)
|
|
177
|
+
hideTimeoutId = setTimeout(() => {
|
|
178
|
+
$tooltip = { ...$tooltip, data: null };
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
let points;
|
|
182
|
+
let voronoi;
|
|
183
|
+
$: if (mode === 'voronoi') {
|
|
184
|
+
points = $flatData.map((d) => {
|
|
185
|
+
const xValue = $xGet(d);
|
|
186
|
+
const yValue = $yGet(d);
|
|
187
|
+
const x = Array.isArray(xValue) ? min(xValue) : xValue;
|
|
188
|
+
const y = Array.isArray(yValue) ? min(yValue) : yValue;
|
|
189
|
+
const point = [x, y];
|
|
190
|
+
point.data = d;
|
|
191
|
+
return point;
|
|
192
|
+
});
|
|
193
|
+
voronoi = Delaunay.from(points).voronoi([0, 0, Math.max($width, 0), Math.max($height, 0)]); // width and/or height can sometimes be negative (when loading data remotely and updately)
|
|
194
|
+
}
|
|
195
|
+
let quadtree;
|
|
196
|
+
$: if (mode === 'quadtree') {
|
|
197
|
+
quadtree = d3Quadtree()
|
|
198
|
+
.extent([
|
|
199
|
+
[0, 0],
|
|
200
|
+
[$width, $height]
|
|
201
|
+
])
|
|
202
|
+
.x((d) => {
|
|
203
|
+
const value = $xGet(d);
|
|
204
|
+
if (Array.isArray(value)) {
|
|
205
|
+
// `x` accessor with multiple properties (ex. `x={['start', 'end']})`)
|
|
206
|
+
// Using first value. Consider using average, max, etc
|
|
207
|
+
// const midpoint = new Date((value[1].valueOf() + value[0].getTime()) / 2);
|
|
208
|
+
// return midpoint;
|
|
209
|
+
return min(value);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
return value;
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
.y((d) => {
|
|
216
|
+
const value = $yGet(d);
|
|
217
|
+
if (Array.isArray(value)) {
|
|
218
|
+
// `x` accessor with multiple properties (ex. `x={['start', 'end']})`)
|
|
219
|
+
// Using first value. Consider using average, max, etc
|
|
220
|
+
// const midpoint = new Date((value[1].valueOf() + value[0].getTime()) / 2);
|
|
221
|
+
// return midpoint;
|
|
222
|
+
return min(value);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
return value;
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
.addAll($flatData);
|
|
229
|
+
}
|
|
230
|
+
let rects = [];
|
|
231
|
+
$: if (mode === 'bounds' || mode === 'band') {
|
|
232
|
+
rects = $flatData
|
|
233
|
+
.map((d) => {
|
|
234
|
+
const xValue = $xGet(d);
|
|
235
|
+
const yValue = $yGet(d);
|
|
236
|
+
const x = Array.isArray(xValue) ? min(xValue) : xValue;
|
|
237
|
+
const y = Array.isArray(yValue) ? max(yValue) : yValue;
|
|
238
|
+
const xOffset = isScaleBand($xScale) ? ($xScale.padding() * $xScale.step()) / 2 : 0;
|
|
239
|
+
const yOffset = isScaleBand($yScale) ? ($yScale.padding() * $yScale.step()) / 2 : 0;
|
|
240
|
+
const fullWidth = max($xRange) - min($xRange);
|
|
241
|
+
const fullHeight = max($yRange) - min($yRange);
|
|
242
|
+
if (mode === 'band') {
|
|
243
|
+
// full band width/height regardless of value
|
|
244
|
+
return {
|
|
245
|
+
x: isScaleBand($xScale) ? x - xOffset : min($xRange),
|
|
246
|
+
y: isScaleBand($yScale) ? y - yOffset : min($yRange),
|
|
247
|
+
width: isScaleBand($xScale) ? $xScale.step() : fullWidth,
|
|
248
|
+
height: isScaleBand($yScale) ? $yScale.step() : fullHeight,
|
|
249
|
+
data: d
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
else if (mode === 'bounds') {
|
|
253
|
+
return {
|
|
254
|
+
x: isScaleBand($xScale) || Array.isArray(xValue) ? x - xOffset : min($xRange),
|
|
255
|
+
// y: isScaleBand($yScale) || Array.isArray(yValue) ? y - yOffset : min($yRange),
|
|
256
|
+
y: y - yOffset,
|
|
257
|
+
width: Array.isArray(xValue)
|
|
258
|
+
? xValue[1] - xValue[0]
|
|
259
|
+
: isScaleBand($xScale)
|
|
260
|
+
? $xScale.step()
|
|
261
|
+
: min($xRange) + x,
|
|
262
|
+
height: Array.isArray(yValue)
|
|
263
|
+
? yValue[1] - yValue[0]
|
|
264
|
+
: isScaleBand($yScale)
|
|
265
|
+
? $yScale.step()
|
|
266
|
+
: max($yRange) - y,
|
|
267
|
+
data: d
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
.sort(createPropertySortFunc('x'));
|
|
272
|
+
// console.log({ rects });
|
|
273
|
+
}
|
|
274
|
+
</script>
|
|
275
|
+
|
|
276
|
+
<slot tooltip={$tooltip} />
|
|
277
|
+
|
|
278
|
+
{#if ['bisect-x', 'bisect-y', 'bisect-band', 'quadtree'].includes(mode)}
|
|
279
|
+
<Html>
|
|
280
|
+
<div
|
|
281
|
+
class="absolute"
|
|
282
|
+
style="width: {$width}px; height: {$height}px; background: _red; z-index: 9999"
|
|
283
|
+
on:touchstart={showTooltip}
|
|
284
|
+
on:touchmove={showTooltip}
|
|
285
|
+
on:mousemove={showTooltip}
|
|
286
|
+
on:mouseleave={hideTooltip}
|
|
287
|
+
on:click={(e) => {
|
|
288
|
+
dispatch('click', { data: $tooltip?.data });
|
|
289
|
+
}}
|
|
290
|
+
/>
|
|
291
|
+
</Html>
|
|
292
|
+
{:else if mode === 'voronoi'}
|
|
293
|
+
<Svg>
|
|
294
|
+
{#each points as point, i}
|
|
295
|
+
<g class="tooltip-voronoi">
|
|
296
|
+
<path
|
|
297
|
+
d={voronoi.renderCell(i)}
|
|
298
|
+
style:fill={debug ? 'red' : 'transparent'}
|
|
299
|
+
style:fill-opacity={debug ? 0.1 : 0}
|
|
300
|
+
style:stroke={debug ? 'red' : 'transparent'}
|
|
301
|
+
on:mousemove={(e) => showTooltip(e, point.data)}
|
|
302
|
+
on:mouseleave={hideTooltip}
|
|
303
|
+
on:click={(e) => {
|
|
304
|
+
dispatch('click', { data: point.data });
|
|
305
|
+
}}
|
|
306
|
+
/>
|
|
307
|
+
</g>
|
|
308
|
+
{/each}
|
|
309
|
+
</Svg>
|
|
310
|
+
{:else if mode === 'bounds' || mode === 'band'}
|
|
311
|
+
<Svg>
|
|
312
|
+
<g class="tooltip-rects">
|
|
313
|
+
{#each rects as rect}
|
|
314
|
+
<rect
|
|
315
|
+
x={rect.x}
|
|
316
|
+
y={rect.y}
|
|
317
|
+
width={rect.width}
|
|
318
|
+
height={rect.height}
|
|
319
|
+
style:fill={debug ? 'red' : 'transparent'}
|
|
320
|
+
style:fill-opacity={debug ? 0.1 : 0}
|
|
321
|
+
style:stroke={debug ? 'red' : 'transparent'}
|
|
322
|
+
on:mousemove={(e) => showTooltip(e, rect.data)}
|
|
323
|
+
on:mouseleave={hideTooltip}
|
|
324
|
+
on:click={(e) => {
|
|
325
|
+
dispatch('click', { data: rect.data });
|
|
326
|
+
}}
|
|
327
|
+
/>
|
|
328
|
+
{/each}
|
|
329
|
+
</g>
|
|
330
|
+
</Svg>
|
|
331
|
+
{/if}
|
|
332
|
+
|
|
333
|
+
{#if mode === 'quadtree' && debug}
|
|
334
|
+
<Svg>
|
|
335
|
+
<ChartClipPath>
|
|
336
|
+
<g class="tooltip-quadtree">
|
|
337
|
+
{#each quadtreeRects(quadtree, false) as rect}
|
|
338
|
+
<rect
|
|
339
|
+
x={rect.x}
|
|
340
|
+
y={rect.y}
|
|
341
|
+
width={rect.width}
|
|
342
|
+
height={rect.height}
|
|
343
|
+
style:fill={debug ? 'red' : 'transparent'}
|
|
344
|
+
style:fill-opacity={debug ? 0.1 : 0}
|
|
345
|
+
stroke="red"
|
|
346
|
+
/>
|
|
347
|
+
{/each}
|
|
348
|
+
</g>
|
|
349
|
+
</ChartClipPath>
|
|
350
|
+
</Svg>
|
|
351
|
+
{/if}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { Readable } from 'svelte/store';
|
|
3
|
+
export declare const tooltipContextKey: {};
|
|
4
|
+
export type TooltipContextValue = {
|
|
5
|
+
top: number;
|
|
6
|
+
left: number;
|
|
7
|
+
data: any;
|
|
8
|
+
show(event: MouseEvent | TouchEvent, tooltipData?: any): any;
|
|
9
|
+
hide(event?: MouseEvent | TouchEvent): any;
|
|
10
|
+
};
|
|
11
|
+
export type TooltipContext = Readable<TooltipContextValue>;
|
|
12
|
+
export declare function tooltipContext(): TooltipContext;
|
|
13
|
+
declare const __propDef: {
|
|
14
|
+
props: {
|
|
15
|
+
mode?: 'bisect-x' | 'bisect-y' | 'band' | 'bisect-band' | 'bounds' | 'voronoi' | 'quadtree' | 'manual';
|
|
16
|
+
snapToDataX?: boolean;
|
|
17
|
+
snapToDataY?: boolean;
|
|
18
|
+
findTooltipData?: 'closest' | 'left' | 'right';
|
|
19
|
+
radius?: number;
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
};
|
|
22
|
+
events: {
|
|
23
|
+
click: CustomEvent<{
|
|
24
|
+
data: any;
|
|
25
|
+
}>;
|
|
26
|
+
} & {
|
|
27
|
+
[evt: string]: CustomEvent<any>;
|
|
28
|
+
};
|
|
29
|
+
slots: {
|
|
30
|
+
default: {
|
|
31
|
+
tooltip: {
|
|
32
|
+
top: number;
|
|
33
|
+
left: number;
|
|
34
|
+
data: any;
|
|
35
|
+
show: (event: MouseEvent | TouchEvent, tooltipData?: any) => void;
|
|
36
|
+
hide: () => void;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export type TooltipContextProps = typeof __propDef.props;
|
|
42
|
+
export type TooltipContextEvents = typeof __propDef.events;
|
|
43
|
+
export type TooltipContextSlots = typeof __propDef.slots;
|
|
44
|
+
export default class TooltipContext extends SvelteComponentTyped<TooltipContextProps, TooltipContextEvents, TooltipContextSlots> {
|
|
45
|
+
}
|
|
46
|
+
export {};
|
package/components/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export { default as Sankey } from './Sankey.svelte';
|
|
|
32
32
|
export { default as Text } from './Text.svelte';
|
|
33
33
|
export { default as Threshold } from './Threshold.svelte';
|
|
34
34
|
export { default as Tooltip } from './Tooltip.svelte';
|
|
35
|
-
export { default as
|
|
35
|
+
export { default as TooltipContext } from './TooltipContext.svelte';
|
|
36
36
|
export { default as TooltipItem } from './TooltipItem.svelte';
|
|
37
37
|
export { default as TooltipSeparator } from './TooltipSeparator.svelte';
|
|
38
38
|
export { default as Tree } from './Tree.svelte';
|
package/components/index.js
CHANGED
|
@@ -32,7 +32,7 @@ export { default as Sankey } from './Sankey.svelte';
|
|
|
32
32
|
export { default as Text } from './Text.svelte';
|
|
33
33
|
export { default as Threshold } from './Threshold.svelte';
|
|
34
34
|
export { default as Tooltip } from './Tooltip.svelte';
|
|
35
|
-
export { default as
|
|
35
|
+
export { default as TooltipContext } from './TooltipContext.svelte';
|
|
36
36
|
export { default as TooltipItem } from './TooltipItem.svelte';
|
|
37
37
|
export { default as TooltipSeparator } from './TooltipSeparator.svelte';
|
|
38
38
|
export { default as Tree } from './Tree.svelte';
|
package/package.json
CHANGED
|
@@ -3,42 +3,42 @@
|
|
|
3
3
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "techniq/layerchart",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.13.0",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@rollup/plugin-dsv": "^3.0.
|
|
9
|
-
"@sveltejs/adapter-vercel": "^1.0.
|
|
8
|
+
"@rollup/plugin-dsv": "^3.0.2",
|
|
9
|
+
"@sveltejs/adapter-vercel": "^1.0.5",
|
|
10
10
|
"@sveltejs/kit": "^1.0.0-next.567",
|
|
11
|
-
"@sveltejs/package": "^1.0.
|
|
12
|
-
"@tailwindcss/typography": "^0.5.
|
|
13
|
-
"@types/d3-array": "^3.0.
|
|
11
|
+
"@sveltejs/package": "^1.0.2",
|
|
12
|
+
"@tailwindcss/typography": "^0.5.9",
|
|
13
|
+
"@types/d3-array": "^3.0.4",
|
|
14
14
|
"@types/d3-delaunay": "^6.0.1",
|
|
15
|
-
"@types/d3-dsv": "^3.0.
|
|
16
|
-
"@types/d3-hierarchy": "^3.1.
|
|
15
|
+
"@types/d3-dsv": "^3.0.1",
|
|
16
|
+
"@types/d3-hierarchy": "^3.1.2",
|
|
17
17
|
"@types/d3-quadtree": "^3.0.2",
|
|
18
18
|
"@types/d3-sankey": "^0.12.0",
|
|
19
|
-
"@types/d3-scale": "^4.0.
|
|
20
|
-
"@types/d3-shape": "^3.1.
|
|
19
|
+
"@types/d3-scale": "^4.0.3",
|
|
20
|
+
"@types/d3-shape": "^3.1.1",
|
|
21
21
|
"@types/lodash-es": "^4.17.6",
|
|
22
22
|
"autoprefixer": "^10.4.13",
|
|
23
23
|
"mdsvex": "^0.10.6",
|
|
24
|
-
"prettier": "^2.8.
|
|
25
|
-
"prettier-plugin-svelte": "^2.
|
|
24
|
+
"prettier": "^2.8.3",
|
|
25
|
+
"prettier-plugin-svelte": "^2.9.0",
|
|
26
26
|
"prism-themes": "^1.9.0",
|
|
27
27
|
"rehype-slug": "^5.1.0",
|
|
28
|
-
"svelte-check": "^
|
|
29
|
-
"svelte-preprocess": "^
|
|
30
|
-
"svelte2tsx": "^0.
|
|
28
|
+
"svelte-check": "^3.0.3",
|
|
29
|
+
"svelte-preprocess": "^5.0.1",
|
|
30
|
+
"svelte2tsx": "^0.6.0",
|
|
31
31
|
"tailwindcss": "^3.2.4",
|
|
32
|
-
"tslib": "^2.
|
|
33
|
-
"typescript": "^4.9.
|
|
34
|
-
"unist-util-visit": "^4.1.
|
|
35
|
-
"vite": "^
|
|
32
|
+
"tslib": "^2.5.0",
|
|
33
|
+
"typescript": "^4.9.4",
|
|
34
|
+
"unist-util-visit": "^4.1.2",
|
|
35
|
+
"vite": "^4.0.4",
|
|
36
36
|
"vite-plugin-sveld": "^1.1.0"
|
|
37
37
|
},
|
|
38
38
|
"type": "module",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@mdi/js": "^7.
|
|
41
|
-
"d3-array": "^3.2.
|
|
40
|
+
"@mdi/js": "^7.1.96",
|
|
41
|
+
"d3-array": "^3.2.2",
|
|
42
42
|
"d3-delaunay": "^6.0.2",
|
|
43
43
|
"d3-dsv": "^3.0.1",
|
|
44
44
|
"d3-hierarchy": "^3.1.2",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"d3-sankey": "^0.12.3",
|
|
48
48
|
"d3-scale": "^4.0.2",
|
|
49
49
|
"d3-scale-chromatic": "^3.0.0",
|
|
50
|
-
"d3-shape": "^3.
|
|
50
|
+
"d3-shape": "^3.2.0",
|
|
51
51
|
"date-fns": "^2.29.3",
|
|
52
|
-
"layercake": "^7.
|
|
52
|
+
"layercake": "^7.2.2",
|
|
53
53
|
"lodash-es": "^4.17.21",
|
|
54
|
-
"svelte": "^3.
|
|
55
|
-
"svelte-ux": "
|
|
54
|
+
"svelte": "^3.55.1",
|
|
55
|
+
"svelte-ux": "^0.26.0"
|
|
56
56
|
},
|
|
57
57
|
"exports": {
|
|
58
58
|
"./package.json": "./package.json",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"./components/Text.svelte": "./components/Text.svelte",
|
|
91
91
|
"./components/Threshold.svelte": "./components/Threshold.svelte",
|
|
92
92
|
"./components/Tooltip.svelte": "./components/Tooltip.svelte",
|
|
93
|
-
"./components/
|
|
93
|
+
"./components/TooltipContext.svelte": "./components/TooltipContext.svelte",
|
|
94
94
|
"./components/TooltipItem.svelte": "./components/TooltipItem.svelte",
|
|
95
95
|
"./components/TooltipSeparator.svelte": "./components/TooltipSeparator.svelte",
|
|
96
96
|
"./components/Tree.svelte": "./components/Tree.svelte",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<script>export let header = undefined;
|
|
2
|
-
</script>
|
|
3
|
-
|
|
4
|
-
<div
|
|
5
|
-
class="bg-gray-900/90 backdrop-filter backdrop-blur-[2px] text-white rounded elevation-1 px-2 py-1"
|
|
6
|
-
>
|
|
7
|
-
{#if header || $$slots.header}
|
|
8
|
-
<div class="text-center font-semibold pb-1 whitespace-nowrap">
|
|
9
|
-
<slot name="header">
|
|
10
|
-
{header}
|
|
11
|
-
</slot>
|
|
12
|
-
</div>
|
|
13
|
-
{/if}
|
|
14
|
-
|
|
15
|
-
<div class="grid grid-cols-[1fr,auto] gap-x-2 gap-y-1 items-center">
|
|
16
|
-
<slot />
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
header?: any;
|
|
5
|
-
};
|
|
6
|
-
events: {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
};
|
|
9
|
-
slots: {
|
|
10
|
-
header: {};
|
|
11
|
-
default: {};
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export type TooltipContainerProps = typeof __propDef.props;
|
|
15
|
-
export type TooltipContainerEvents = typeof __propDef.events;
|
|
16
|
-
export type TooltipContainerSlots = typeof __propDef.slots;
|
|
17
|
-
export default class TooltipContainer extends SvelteComponentTyped<TooltipContainerProps, TooltipContainerEvents, TooltipContainerSlots> {
|
|
18
|
-
}
|
|
19
|
-
export {};
|