layerchart 0.38.1 → 0.38.2
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/components/Chart.svelte +1 -0
- package/dist/components/TooltipContext.svelte.d.ts +1 -1
- package/dist/components/TransformContext.svelte +4 -4
- package/dist/components/TransformContext.svelte.d.ts +3 -3
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/threshold.js +1 -1
- package/package.json +2 -2
|
@@ -122,6 +122,7 @@ onMount(() => {
|
|
|
122
122
|
{#key isMounted}
|
|
123
123
|
<TransformContext
|
|
124
124
|
bind:this={transformContext}
|
|
125
|
+
mode={transform?.mode ?? geo?.applyTransform?.length ? 'manual' : 'none'}
|
|
125
126
|
initialTranslate={initialTransform?.translate}
|
|
126
127
|
initialScale={initialTransform?.scale}
|
|
127
128
|
processTranslate={geo
|
|
@@ -14,7 +14,7 @@ declare const __propDef: {
|
|
|
14
14
|
props: {
|
|
15
15
|
/**
|
|
16
16
|
* @type {'bisect-x' | 'bisect-y' | 'band' | 'bisect-band' | 'bounds' | 'voronoi' | 'quadtree' | 'manual'}
|
|
17
|
-
*/ mode?: "bisect-x" | "bisect-y" | "band" | "bisect-band" | "bounds" | "voronoi" | "quadtree" |
|
|
17
|
+
*/ mode?: "manual" | "bisect-x" | "bisect-y" | "band" | "bisect-band" | "bounds" | "voronoi" | "quadtree" | undefined;
|
|
18
18
|
/**
|
|
19
19
|
* @type {'closest' | 'left' | 'right'}
|
|
20
20
|
*/ findTooltipData?: "left" | "right" | "closest" | undefined;
|
|
@@ -33,7 +33,7 @@ export let processTranslate = (x, y, deltaX, deltaY, scale) => {
|
|
|
33
33
|
y: y + deltaY / scale,
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
/** Disable pointer events including move/dragging */
|
|
36
|
+
/** Disable pointer events including move/dragging. Useful for `mode="canvas" but only want zoomTo() interactions */
|
|
37
37
|
export let disablePointer = false;
|
|
38
38
|
/** Action to take during wheel scroll */
|
|
39
39
|
export let scroll = 'none';
|
|
@@ -88,7 +88,7 @@ setTransformContext({
|
|
|
88
88
|
zoomTo,
|
|
89
89
|
});
|
|
90
90
|
function onPointerDown(e) {
|
|
91
|
-
if (disablePointer)
|
|
91
|
+
if (mode === 'none' || disablePointer)
|
|
92
92
|
return;
|
|
93
93
|
e.preventDefault();
|
|
94
94
|
pointerDown = true;
|
|
@@ -125,13 +125,13 @@ function onClick(e) {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
function onDoubleClick(e) {
|
|
128
|
-
if (disablePointer)
|
|
128
|
+
if (mode === 'none' || disablePointer)
|
|
129
129
|
return;
|
|
130
130
|
const point = localPoint(e);
|
|
131
131
|
scaleTo(e.shiftKey ? 0.5 : 2, point);
|
|
132
132
|
}
|
|
133
133
|
function onWheel(e) {
|
|
134
|
-
if (
|
|
134
|
+
if (mode === 'none' || disablePointer || scroll === 'none')
|
|
135
135
|
return;
|
|
136
136
|
e.preventDefault();
|
|
137
137
|
const point = (startPoint = localPoint(e));
|
|
@@ -2,7 +2,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
import { type Readable, type Writable } from 'svelte/store';
|
|
3
3
|
export declare const transformContextKey: unique symbol;
|
|
4
4
|
export type TransformContextValue = {
|
|
5
|
-
mode: 'canvas' | 'none';
|
|
5
|
+
mode: 'canvas' | 'manual' | 'none';
|
|
6
6
|
scale: Writable<number>;
|
|
7
7
|
translate: Writable<{
|
|
8
8
|
x: number;
|
|
@@ -26,7 +26,7 @@ export declare function transformContext(): TransformContext;
|
|
|
26
26
|
import { motionStore } from '../stores/motionStore.js';
|
|
27
27
|
declare const __propDef: {
|
|
28
28
|
props: {
|
|
29
|
-
mode?: "none" | "canvas" | undefined;
|
|
29
|
+
mode?: "none" | "canvas" | "manual" | undefined;
|
|
30
30
|
translateOnScale?: boolean | undefined;
|
|
31
31
|
spring?: boolean | Parameters<typeof motionStore>[1]['spring'];
|
|
32
32
|
tweened?: boolean | Parameters<typeof motionStore>[1]['tweened'];
|
|
@@ -34,7 +34,7 @@ declare const __propDef: {
|
|
|
34
34
|
x: number;
|
|
35
35
|
y: number;
|
|
36
36
|
}) | undefined;
|
|
37
|
-
/** Disable pointer events including move/dragging */ disablePointer?: boolean | undefined;
|
|
37
|
+
/** Disable pointer events including move/dragging. Useful for `mode="canvas" but only want zoomTo() interactions */ disablePointer?: boolean | undefined;
|
|
38
38
|
/** Action to take during wheel scroll */ scroll?: "none" | "scale" | "translate" | undefined;
|
|
39
39
|
/** Distance/threshold to consider drag vs click (disable click propagation) */ clickDistance?: number | undefined;
|
|
40
40
|
initialTranslate?: {
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/dist/utils/threshold.js
CHANGED
|
@@ -5,7 +5,7 @@ import { scaleTime } from 'd3-scale';
|
|
|
5
5
|
* https://observablehq.com/@d3/d3-bin-time-thresholds
|
|
6
6
|
*/
|
|
7
7
|
export function thresholdTime(n) {
|
|
8
|
-
// TODO: Unable to
|
|
8
|
+
// TODO: Unable to satisfy `ThresholdNumberArrayGenerator<Value extends number>` with `Date`
|
|
9
9
|
return (data, min, max) => {
|
|
10
10
|
return scaleTime().domain([min, max]).ticks(n);
|
|
11
11
|
};
|
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.38.
|
|
7
|
+
"version": "0.38.2",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@changesets/cli": "^2.27.5",
|
|
10
10
|
"@mdi/js": "^7.4.47",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"lodash-es": "^4.17.21",
|
|
88
88
|
"posthog-js": "^1.136.2",
|
|
89
89
|
"shapefile": "^0.6.6",
|
|
90
|
-
"svelte-ux": "^0.66.
|
|
90
|
+
"svelte-ux": "^0.66.4",
|
|
91
91
|
"topojson-client": "^3.1.0"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|