layerchart 0.26.2 → 0.27.1
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.
|
@@ -88,7 +88,8 @@ export let geo = undefined;
|
|
|
88
88
|
>
|
|
89
89
|
<GeoContext {...geo} let:projection>
|
|
90
90
|
{#if tooltip}
|
|
91
|
-
|
|
91
|
+
{@const tooltipProps = typeof tooltip === 'object' ? tooltip : {}}
|
|
92
|
+
<TooltipContext {...tooltipProps} let:tooltip>
|
|
92
93
|
<slot
|
|
93
94
|
{aspectRatio}
|
|
94
95
|
{containerHeight}
|
|
@@ -16,7 +16,6 @@ function setTooltipContext(tooltip) {
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<script>import { raise } from 'layercake';
|
|
19
|
-
import { createEventDispatcher } from 'svelte';
|
|
20
19
|
import { writable } from 'svelte/store';
|
|
21
20
|
import { bisector, max, min } from 'd3-array';
|
|
22
21
|
import { Delaunay } from 'd3-delaunay';
|
|
@@ -27,7 +26,6 @@ import ChartClipPath from './ChartClipPath.svelte';
|
|
|
27
26
|
import { localPoint } from '../utils/event';
|
|
28
27
|
import { isScaleBand, scaleInvert } from '../utils/scales';
|
|
29
28
|
import { quadtreeRects } from '../utils/quadtree';
|
|
30
|
-
const dispatch = createEventDispatcher();
|
|
31
29
|
const { flatData, x, xScale, xGet, xRange, y, yScale, yGet, yRange, width, height, padding } = getContext('LayerCake');
|
|
32
30
|
/*
|
|
33
31
|
TODO: Defaults to consider (if possible to detect scale type, which might not be possible)
|
|
@@ -55,6 +53,7 @@ export let raiseTarget = false;
|
|
|
55
53
|
export let radius = Infinity;
|
|
56
54
|
/** Enable debug view (show hit targets, etc) */
|
|
57
55
|
export let debug = false;
|
|
56
|
+
export let onClick = () => { };
|
|
58
57
|
const tooltip = writable({ y: 0, x: 0, data: null, show: showTooltip, hide: hideTooltip });
|
|
59
58
|
setTooltipContext(tooltip);
|
|
60
59
|
let hideTimeoutId;
|
|
@@ -297,7 +296,7 @@ $: if (mode === 'bounds' || mode === 'band') {
|
|
|
297
296
|
on:mousemove={showTooltip}
|
|
298
297
|
on:mouseleave={hideTooltip}
|
|
299
298
|
on:click={(e) => {
|
|
300
|
-
|
|
299
|
+
onClick({ data: $tooltip?.data });
|
|
301
300
|
}}
|
|
302
301
|
/>
|
|
303
302
|
</Html>
|
|
@@ -313,7 +312,7 @@ $: if (mode === 'bounds' || mode === 'band') {
|
|
|
313
312
|
on:mousemove={(e) => showTooltip(e, point.data)}
|
|
314
313
|
on:mouseleave={hideTooltip}
|
|
315
314
|
on:click={(e) => {
|
|
316
|
-
|
|
315
|
+
onClick({ data: point.data });
|
|
317
316
|
}}
|
|
318
317
|
/>
|
|
319
318
|
</g>
|
|
@@ -334,7 +333,7 @@ $: if (mode === 'bounds' || mode === 'band') {
|
|
|
334
333
|
on:mousemove={(e) => showTooltip(e, rect.data)}
|
|
335
334
|
on:mouseleave={hideTooltip}
|
|
336
335
|
on:click={(e) => {
|
|
337
|
-
|
|
336
|
+
onClick({ data: rect.data });
|
|
338
337
|
}}
|
|
339
338
|
/>
|
|
340
339
|
{/each}
|
|
@@ -23,12 +23,11 @@ declare const __propDef: {
|
|
|
23
23
|
* @type {number}
|
|
24
24
|
*/ radius?: number | undefined;
|
|
25
25
|
/** Enable debug view (show hit targets, etc) */ debug?: boolean | undefined;
|
|
26
|
+
onClick?: (({ data }: {
|
|
27
|
+
data: any;
|
|
28
|
+
}) => any) | undefined;
|
|
26
29
|
};
|
|
27
30
|
events: {
|
|
28
|
-
click: CustomEvent<{
|
|
29
|
-
data: any;
|
|
30
|
-
}>;
|
|
31
|
-
} & {
|
|
32
31
|
[evt: string]: CustomEvent<any>;
|
|
33
32
|
};
|
|
34
33
|
slots: {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "techniq/layerchart",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.27.1",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "vite dev",
|
|
10
10
|
"build": "vite build",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@rollup/plugin-dsv": "^3.0.4",
|
|
22
|
-
"@sveltejs/adapter-
|
|
22
|
+
"@sveltejs/adapter-auto": "^2.1.1",
|
|
23
23
|
"@sveltejs/kit": "^1.27.6",
|
|
24
24
|
"@sveltejs/package": "^2.2.2",
|
|
25
25
|
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
"@changesets/cli": "^2.26.2",
|
|
67
67
|
"@mdi/js": "^7.3.67",
|
|
68
68
|
"@types/d3-time": "^3.0.2",
|
|
69
|
-
"@vercel/analytics": "^1.1.1",
|
|
70
69
|
"d3-array": "^3.2.4",
|
|
71
70
|
"d3-delaunay": "^6.0.4",
|
|
72
71
|
"d3-dsv": "^3.0.1",
|
|
@@ -85,6 +84,7 @@
|
|
|
85
84
|
"date-fns": "^2.30.0",
|
|
86
85
|
"layercake": "^8.0.2",
|
|
87
86
|
"lodash-es": "^4.17.21",
|
|
87
|
+
"posthog-js": "^1.95.1",
|
|
88
88
|
"shapefile": "^0.6.6",
|
|
89
89
|
"svelte-ux": "^0.56.0",
|
|
90
90
|
"topojson-client": "^3.1.0"
|