layerchart 0.43.8 → 0.44.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.
|
@@ -102,7 +102,7 @@ onMount(() => {
|
|
|
102
102
|
? geoFitObjectTransform(geo.projection(), [width, height], geo.fitGeojson)
|
|
103
103
|
: undefined}
|
|
104
104
|
|
|
105
|
-
<ChartContext {data} let:data let:flatData>
|
|
105
|
+
<ChartContext {data} let:data let:flatData on:resize>
|
|
106
106
|
{#key isMounted}
|
|
107
107
|
<TransformContext
|
|
108
108
|
bind:this={transformContext}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!-- Wrapper to allow getting LayerCake context from <Chart> and exposing with a strongly type context getter -->
|
|
2
|
-
<script context="module">import { getContext, setContext } from 'svelte';
|
|
2
|
+
<script context="module">import { createEventDispatcher, getContext, onMount, setContext } from 'svelte';
|
|
3
3
|
import {} from 'svelte/store';
|
|
4
4
|
export const chartContextKey = Symbol();
|
|
5
5
|
export function chartContext() {
|
|
@@ -10,8 +10,23 @@ function setChartContext(context) {
|
|
|
10
10
|
}
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<script generics="TData">const
|
|
13
|
+
<script generics="TData">const dispatch = createEventDispatcher();
|
|
14
|
+
const layerCakeContext = getContext('LayerCake');
|
|
14
15
|
setChartContext(layerCakeContext);
|
|
16
|
+
const { width, height, containerWidth, containerHeight } = layerCakeContext;
|
|
17
|
+
$: if (isMounted) {
|
|
18
|
+
dispatch('resize', {
|
|
19
|
+
width: $width,
|
|
20
|
+
height: $height,
|
|
21
|
+
containerWidth: $containerWidth,
|
|
22
|
+
containerHeight: $containerHeight,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
// Track when mounted since LayerCake initializes width/height with `100` until binded `clientWidth`/`clientWidth` can run
|
|
26
|
+
let isMounted = false;
|
|
27
|
+
onMount(() => {
|
|
28
|
+
isMounted = true;
|
|
29
|
+
});
|
|
15
30
|
// Added to try to pass TData downward
|
|
16
31
|
export let data = []; // Same as `ComponentProps<Chart<TData>>` but causes circular reference
|
|
17
32
|
</script>
|
|
@@ -64,6 +64,16 @@ type LayerCakeContext<TData> = {
|
|
|
64
64
|
rScale: Readable<AnyScale>;
|
|
65
65
|
rGet: Readable<any>;
|
|
66
66
|
};
|
|
67
|
+
export type ChartEvents = {
|
|
68
|
+
resize: ChartResizeDetail;
|
|
69
|
+
};
|
|
70
|
+
export type ChartResizeDetail = {
|
|
71
|
+
width: number;
|
|
72
|
+
height: number;
|
|
73
|
+
containerWidth: number;
|
|
74
|
+
containerHeight: number;
|
|
75
|
+
};
|
|
76
|
+
export type ChartResizeEvent = CustomEvent<ChartResizeDetail>;
|
|
67
77
|
export type ChartContext<TData> = LayerCakeContext<TData> & {};
|
|
68
78
|
export declare function chartContext<TData = any>(): ChartContext<TData>;
|
|
69
79
|
import type { SankeyGraph } from 'd3-sankey';
|
package/package.json
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "techniq/layerchart",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.44.0",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@changesets/cli": "^2.27.7",
|
|
10
10
|
"@mdi/js": "^7.4.47",
|
|
11
11
|
"@rollup/plugin-dsv": "^3.0.4",
|
|
12
|
-
"@sveltejs/adapter-cloudflare": "^4.7.
|
|
13
|
-
"@sveltejs/kit": "^2.5.
|
|
14
|
-
"@sveltejs/package": "^2.3.
|
|
12
|
+
"@sveltejs/adapter-cloudflare": "^4.7.2",
|
|
13
|
+
"@sveltejs/kit": "^2.5.22",
|
|
14
|
+
"@sveltejs/package": "^2.3.4",
|
|
15
15
|
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
|
16
16
|
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
|
|
17
17
|
"@tailwindcss/typography": "^0.5.14",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"svelte-json-tree": "^2.2.0",
|
|
56
56
|
"svelte-preprocess": "^6.0.2",
|
|
57
57
|
"svelte2tsx": "^0.7.15",
|
|
58
|
-
"tailwindcss": "^3.4.
|
|
58
|
+
"tailwindcss": "^3.4.10",
|
|
59
59
|
"topojson-client": "^3.1.0",
|
|
60
60
|
"topojson-simplify": "^3.0.3",
|
|
61
61
|
"tslib": "^2.6.3",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
"date-fns": "^3.6.0",
|
|
89
89
|
"layercake": "^8.3.4",
|
|
90
90
|
"lodash-es": "^4.17.21",
|
|
91
|
-
"posthog-js": "^1.
|
|
91
|
+
"posthog-js": "^1.155.4",
|
|
92
92
|
"shapefile": "^0.6.6",
|
|
93
|
-
"svelte-ux": "^0.74.
|
|
93
|
+
"svelte-ux": "^0.74.4",
|
|
94
94
|
"topojson-client": "^3.1.0"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|