layerchart 0.28.0-next.2 → 0.30.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/dist/components/Area.svelte.d.ts +2 -2
- package/dist/components/Axis.svelte.d.ts +2 -3
- package/dist/components/Bounds.svelte +1 -1
- package/dist/components/Calendar.svelte.d.ts +2 -2
- package/dist/components/Chart.svelte.d.ts +2 -2
- package/dist/components/Circle.svelte +2 -0
- package/dist/components/ClipPath.svelte +9 -3
- package/dist/components/ClipPath.svelte.d.ts +1 -0
- package/dist/components/GeoCircle.svelte +12 -0
- package/dist/components/GeoCircle.svelte.d.ts +19 -0
- package/dist/components/Graticule.svelte +2 -2
- package/dist/components/Graticule.svelte.d.ts +2 -2
- package/dist/components/Highlight.svelte.d.ts +20 -12
- package/dist/components/Legend.svelte.d.ts +1 -2
- package/dist/components/Line.svelte +2 -0
- package/dist/components/Pie.svelte.d.ts +2 -2
- package/dist/components/Points.svelte.d.ts +2 -2
- package/dist/components/Rect.svelte +2 -0
- package/dist/components/Rule.svelte +2 -2
- package/dist/components/Spline.svelte +10 -1
- package/dist/components/Text.svelte +1 -1
- package/dist/components/TileImage.svelte +1 -7
- package/dist/components/TooltipItem.svelte.d.ts +1 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/docs/Code.svelte +3 -3
- package/dist/docs/Code.svelte.d.ts +1 -1
- package/dist/docs/GeoDebug.svelte +1 -1
- package/dist/docs/Preview.svelte.d.ts +1 -1
- package/dist/docs/TilesetField.svelte +19 -16
- package/dist/docs/TilesetField.svelte.d.ts +2 -0
- package/dist/utils/geo.d.ts +5 -0
- package/dist/utils/geo.js +7 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/stack.js +1 -1
- package/dist/utils/ticks.d.ts +1 -1
- package/dist/utils/ticks.js +15 -16
- package/package.json +46 -39
- package/dist/utils/string.d.ts +0 -4
|
@@ -14,7 +14,7 @@ declare const __propDef: {
|
|
|
14
14
|
clipPath?: string | undefined;
|
|
15
15
|
curve?: CurveFactory | undefined;
|
|
16
16
|
defined?: Parameters<Area<any>['defined']>[0] | undefined;
|
|
17
|
-
line?: boolean | {
|
|
17
|
+
line?: boolean | Partial<{
|
|
18
18
|
[x: string]: any;
|
|
19
19
|
data?: any;
|
|
20
20
|
pathData?: string | null | undefined;
|
|
@@ -24,7 +24,7 @@ declare const __propDef: {
|
|
|
24
24
|
draw?: boolean | import("svelte/transition").DrawParams | undefined;
|
|
25
25
|
curve?: CurveFactory | import("d3-shape").CurveFactoryLineOnly | undefined;
|
|
26
26
|
defined?: ((d: any, index: number, data: any[]) => boolean) | undefined;
|
|
27
|
-
} | undefined;
|
|
27
|
+
}> | undefined;
|
|
28
28
|
};
|
|
29
29
|
events: {
|
|
30
30
|
click: MouseEvent;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import { type ComponentProps } from 'svelte';
|
|
3
3
|
import type { SVGAttributes } from 'svelte/elements';
|
|
4
|
-
import { type FormatType } from 'svelte-ux';
|
|
5
4
|
import Text from './Text.svelte';
|
|
6
5
|
declare const __propDef: {
|
|
7
6
|
props: {
|
|
@@ -10,8 +9,8 @@ declare const __propDef: {
|
|
|
10
9
|
/** Draw a grid lines */ grid?: boolean | SVGAttributes<SVGLineElement> | undefined;
|
|
11
10
|
/** Control the number of ticks*/ ticks?: number | any[] | Function | undefined;
|
|
12
11
|
/** Length of the tick line */ tickSize?: number | undefined;
|
|
13
|
-
format?:
|
|
14
|
-
labelProps?: ComponentProps<Text
|
|
12
|
+
format?: any;
|
|
13
|
+
labelProps?: Partial<ComponentProps<Text>> | undefined;
|
|
15
14
|
};
|
|
16
15
|
events: {
|
|
17
16
|
[evt: string]: CustomEvent<any>;
|
|
@@ -9,7 +9,7 @@ export let tweened = undefined;
|
|
|
9
9
|
function getExtents(extents, axis, fallback) {
|
|
10
10
|
const resolvedExtents = typeof extents === 'function' ? extents({ width: $width, height: $height }) : extents;
|
|
11
11
|
return [
|
|
12
|
-
resolvedExtents?.[axis + '0'] ?? 0,
|
|
12
|
+
resolvedExtents?.[axis + '0'] ?? 0, // x0 or y0
|
|
13
13
|
resolvedExtents?.[axis + '1'] ?? fallback // x1 or y1, fallback as $width or $height
|
|
14
14
|
];
|
|
15
15
|
}
|
|
@@ -6,11 +6,11 @@ declare const __propDef: {
|
|
|
6
6
|
start: Date;
|
|
7
7
|
end: Date;
|
|
8
8
|
cellSize?: number | [number, number] | undefined;
|
|
9
|
-
monthPath?: boolean | {
|
|
9
|
+
monthPath?: boolean | Partial<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
date: Date;
|
|
12
12
|
cellSize: number | [number, number];
|
|
13
|
-
} | undefined;
|
|
13
|
+
}> | undefined;
|
|
14
14
|
tooltip?: TooltipContextValue | undefined;
|
|
15
15
|
};
|
|
16
16
|
events: {
|
|
@@ -16,8 +16,8 @@ declare const __propDef: {
|
|
|
16
16
|
yScale?: Function | undefined;
|
|
17
17
|
xBaseline?: number | null | undefined;
|
|
18
18
|
yBaseline?: number | null | undefined;
|
|
19
|
-
tooltip?: ComponentProps<TooltipContext
|
|
20
|
-
geo?: ComponentProps<GeoContext
|
|
19
|
+
tooltip?: Partial<ComponentProps<TooltipContext>> | boolean | undefined;
|
|
20
|
+
geo?: Partial<ComponentProps<GeoContext>> | undefined;
|
|
21
21
|
};
|
|
22
22
|
events: {
|
|
23
23
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>import { tick } from 'svelte';
|
|
2
|
+
import { cls } from 'svelte-ux';
|
|
2
3
|
import { motionStore } from '../stores/motionStore';
|
|
3
4
|
export let cx = 0;
|
|
4
5
|
export let initialCx = cx;
|
|
@@ -22,6 +23,7 @@ $: tick().then(() => {
|
|
|
22
23
|
cx={$tweened_cx}
|
|
23
24
|
cy={$tweened_cy}
|
|
24
25
|
r={$tweened_r}
|
|
26
|
+
class={cls($$props.fill === undefined && 'fill-surface-content')}
|
|
25
27
|
{...$$restProps}
|
|
26
28
|
on:click
|
|
27
29
|
on:mousemove
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
export let id = uniqueId('clipPath-');
|
|
4
4
|
/** Use existing path or shape (by id) for clipPath */
|
|
5
5
|
export let useId = undefined;
|
|
6
|
+
/** Disable clipping (show all) */
|
|
7
|
+
export let disabled = false;
|
|
6
8
|
</script>
|
|
7
9
|
|
|
8
10
|
<defs>
|
|
@@ -16,7 +18,11 @@ export let useId = undefined;
|
|
|
16
18
|
</defs>
|
|
17
19
|
|
|
18
20
|
{#if $$slots.default}
|
|
19
|
-
|
|
20
|
-
<slot
|
|
21
|
-
|
|
21
|
+
{#if disabled}
|
|
22
|
+
<slot />
|
|
23
|
+
{:else}
|
|
24
|
+
<g style:clip-path="url(#{id})" on:click on:mousemove on:mouseleave on:keydown>
|
|
25
|
+
<slot {id} url="url(#{id})" {useId} />
|
|
26
|
+
</g>
|
|
27
|
+
{/if}
|
|
22
28
|
{/if}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script>import { geoCircle } from 'd3-geo';
|
|
2
|
+
import GeoPath from './GeoPath.svelte';
|
|
3
|
+
/** Radius in degrees. Default: 90 */
|
|
4
|
+
export let radius = 90;
|
|
5
|
+
/** Center point of circle in degree ([longitude, latitude]). Default [0, 0] */
|
|
6
|
+
export let center = [0, 0];
|
|
7
|
+
/** sets the circle precision to the specified angle in degrees */
|
|
8
|
+
export let precision = 6;
|
|
9
|
+
$: geojson = geoCircle().radius(radius).center(center)();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<GeoPath {geojson} {...$$restProps} />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
radius?: number | undefined;
|
|
6
|
+
center?: [number, number] | undefined;
|
|
7
|
+
precision?: number | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type GeoCircleProps = typeof __propDef.props;
|
|
15
|
+
export type GeoCircleEvents = typeof __propDef.events;
|
|
16
|
+
export type GeoCircleSlots = typeof __propDef.slots;
|
|
17
|
+
export default class GeoCircle extends SvelteComponentTyped<GeoCircleProps, GeoCircleEvents, GeoCircleSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -16,11 +16,11 @@ $: graticule.step(step);
|
|
|
16
16
|
|
|
17
17
|
{#if lines}
|
|
18
18
|
{#each graticule.lines() as line}
|
|
19
|
-
<GeoPath geojson={line} {...lines} />
|
|
19
|
+
<GeoPath geojson={line} {...typeof lines === 'object' ? lines : null} />
|
|
20
20
|
{/each}
|
|
21
21
|
{/if}
|
|
22
22
|
|
|
23
23
|
{#if outline}
|
|
24
|
-
<GeoPath geojson={graticule.outline()} {...outline} />
|
|
24
|
+
<GeoPath geojson={graticule.outline()} {...typeof outline === 'object' ? outline : null} />
|
|
25
25
|
{/if}
|
|
26
26
|
</g>
|
|
@@ -4,8 +4,8 @@ import GeoPath from './GeoPath.svelte';
|
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
[x: string]: any;
|
|
7
|
-
lines?:
|
|
8
|
-
outline?:
|
|
7
|
+
lines?: Partial<ComponentProps<GeoPath>> | boolean | undefined;
|
|
8
|
+
outline?: Partial<ComponentProps<GeoPath>> | boolean | undefined;
|
|
9
9
|
step?: [number, number] | undefined;
|
|
10
10
|
};
|
|
11
11
|
events: {
|
|
@@ -2,7 +2,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
axis?: 'x' | 'y' | 'both' | 'none' | undefined;
|
|
5
|
-
/** Show points and pass props to Circles */ points?: boolean | {
|
|
5
|
+
/** Show points and pass props to Circles */ points?: boolean | Partial<{
|
|
6
6
|
[x: string]: any;
|
|
7
7
|
cx?: number | undefined;
|
|
8
8
|
initialCx?: number | undefined;
|
|
@@ -12,8 +12,8 @@ declare const __propDef: {
|
|
|
12
12
|
initialR?: number | undefined;
|
|
13
13
|
spring?: boolean | import("svelte/motion").SpringOpts | undefined;
|
|
14
14
|
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
15
|
-
} | undefined;
|
|
16
|
-
/** Show lines and pass props to Lines */ lines?: boolean | {
|
|
15
|
+
}> | undefined;
|
|
16
|
+
/** Show lines and pass props to Lines */ lines?: boolean | Partial<{
|
|
17
17
|
[x: string]: any;
|
|
18
18
|
x1: number;
|
|
19
19
|
initialX1?: number | undefined;
|
|
@@ -25,8 +25,8 @@ declare const __propDef: {
|
|
|
25
25
|
initialY2?: number | undefined;
|
|
26
26
|
spring?: boolean | import("svelte/motion").SpringOpts | undefined;
|
|
27
27
|
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
28
|
-
} | undefined;
|
|
29
|
-
/** Show area and pass props to Rect */ area?: boolean | {
|
|
28
|
+
}> | undefined;
|
|
29
|
+
/** Show area and pass props to Rect */ area?: boolean | Partial<{
|
|
30
30
|
[x: string]: any;
|
|
31
31
|
x?: number | undefined;
|
|
32
32
|
initialX?: number | undefined;
|
|
@@ -42,8 +42,8 @@ declare const __propDef: {
|
|
|
42
42
|
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | {
|
|
43
43
|
[prop: string]: import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
44
44
|
} | undefined;
|
|
45
|
-
} | undefined;
|
|
46
|
-
/** Show bar and pass props to Rect */ bar?: boolean | {
|
|
45
|
+
}> | undefined;
|
|
46
|
+
/** Show bar and pass props to Rect */ bar?: boolean | Partial<{
|
|
47
47
|
[x: string]: any;
|
|
48
48
|
x?: number | undefined;
|
|
49
49
|
initialX?: number | undefined;
|
|
@@ -59,7 +59,7 @@ declare const __propDef: {
|
|
|
59
59
|
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | {
|
|
60
60
|
[prop: string]: import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
61
61
|
} | undefined;
|
|
62
|
-
} | undefined;
|
|
62
|
+
}> | undefined;
|
|
63
63
|
};
|
|
64
64
|
events: {
|
|
65
65
|
click: MouseEvent;
|
|
@@ -76,7 +76,7 @@ declare const __propDef: {
|
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
78
|
bar: {
|
|
79
|
-
bar: boolean | {
|
|
79
|
+
bar: boolean | Partial<{
|
|
80
80
|
[x: string]: any;
|
|
81
81
|
x?: number | undefined;
|
|
82
82
|
initialX?: number | undefined;
|
|
@@ -92,13 +92,21 @@ declare const __propDef: {
|
|
|
92
92
|
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | {
|
|
93
93
|
[prop: string]: import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
94
94
|
} | undefined;
|
|
95
|
-
}
|
|
95
|
+
}>;
|
|
96
96
|
};
|
|
97
97
|
lines: {
|
|
98
|
-
lines:
|
|
98
|
+
lines: {
|
|
99
|
+
x1: number;
|
|
100
|
+
y1: number;
|
|
101
|
+
x2: number;
|
|
102
|
+
y2: number;
|
|
103
|
+
}[];
|
|
99
104
|
};
|
|
100
105
|
points: {
|
|
101
|
-
points:
|
|
106
|
+
points: {
|
|
107
|
+
x: number;
|
|
108
|
+
y: number;
|
|
109
|
+
}[];
|
|
102
110
|
};
|
|
103
111
|
};
|
|
104
112
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { type FormatType } from 'svelte-ux';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
@@ -8,7 +7,7 @@ declare const __propDef: {
|
|
|
8
7
|
width?: number | undefined;
|
|
9
8
|
height?: number | undefined;
|
|
10
9
|
ticks?: number | undefined;
|
|
11
|
-
tickFormat?:
|
|
10
|
+
tickFormat?: any;
|
|
12
11
|
tickValues?: any[] | undefined;
|
|
13
12
|
tickFontSize?: number | undefined;
|
|
14
13
|
tickSize?: number | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>import { tick } from 'svelte';
|
|
2
|
+
import { cls } from 'svelte-ux';
|
|
2
3
|
import { motionStore } from '../stores/motionStore';
|
|
3
4
|
export let x1;
|
|
4
5
|
export let initialX1 = x1;
|
|
@@ -27,6 +28,7 @@ $: tick().then(() => {
|
|
|
27
28
|
y1={$tweened_y1}
|
|
28
29
|
x2={$tweened_x2}
|
|
29
30
|
y2={$tweened_y2}
|
|
31
|
+
class={cls($$props.stroke === undefined && 'stroke-surface-content')}
|
|
30
32
|
{...$$restProps}
|
|
31
33
|
on:click
|
|
32
34
|
on:mousemove
|
|
@@ -19,10 +19,10 @@ declare const __propDef: {
|
|
|
19
19
|
* value > 0: percent of `outerRadius`
|
|
20
20
|
* value < 0: offset of `outerRadius`
|
|
21
21
|
* default: yRange min
|
|
22
|
-
*/ innerRadius?: undefined;
|
|
22
|
+
*/ innerRadius?: number | undefined;
|
|
23
23
|
/**
|
|
24
24
|
* Define outerRadius. Defaults to yRange max/2 (ie. chart height / 2)
|
|
25
|
-
*/ outerRadius?: undefined;
|
|
25
|
+
*/ outerRadius?: number | undefined;
|
|
26
26
|
cornerRadius?: number | undefined;
|
|
27
27
|
padAngle?: number | undefined;
|
|
28
28
|
spring?: boolean | Parameters<typeof springStore>[1];
|
|
@@ -5,7 +5,7 @@ declare const __propDef: {
|
|
|
5
5
|
r?: number | undefined;
|
|
6
6
|
offsetX?: number | ((value: number, context: any) => number) | undefined;
|
|
7
7
|
offsetY?: number | ((value: number, context: any) => number) | undefined;
|
|
8
|
-
links?: boolean | {
|
|
8
|
+
links?: boolean | Partial<{
|
|
9
9
|
[x: string]: any;
|
|
10
10
|
data?: any;
|
|
11
11
|
sankey?: boolean | undefined;
|
|
@@ -16,7 +16,7 @@ declare const __propDef: {
|
|
|
16
16
|
y?: ((d: any) => any) | undefined;
|
|
17
17
|
curve?: import("d3-shape").CurveFactory | undefined;
|
|
18
18
|
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
19
|
-
} | undefined;
|
|
19
|
+
}> | undefined;
|
|
20
20
|
};
|
|
21
21
|
events: {
|
|
22
22
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>import { tick } from 'svelte';
|
|
2
|
+
import { cls } from 'svelte-ux';
|
|
2
3
|
import { motionStore, resolveOptions, } from '../stores/motionStore';
|
|
3
4
|
export let x = 0;
|
|
4
5
|
export let initialX = x;
|
|
@@ -28,6 +29,7 @@ $: tick().then(() => {
|
|
|
28
29
|
y={$tweened_y}
|
|
29
30
|
width={$tweened_width}
|
|
30
31
|
height={$tweened_height}
|
|
32
|
+
class={cls($$props.fill === undefined && 'fill-surface-content')}
|
|
31
33
|
{...$$restProps}
|
|
32
34
|
on:click
|
|
33
35
|
on:mouseover
|
|
@@ -31,7 +31,7 @@ export let y = false;
|
|
|
31
31
|
y1={$yRange[0] || 0}
|
|
32
32
|
y2={$yRange[1] || 0}
|
|
33
33
|
{...$$restProps}
|
|
34
|
-
class={cls('stroke-
|
|
34
|
+
class={cls('stroke-surface-content/50', $$props.class)}
|
|
35
35
|
/>
|
|
36
36
|
{/if}
|
|
37
37
|
|
|
@@ -42,7 +42,7 @@ export let y = false;
|
|
|
42
42
|
y1={y === true || y === 'bottom' ? yRangeMax : y === 'top' ? yRangeMin : $yScale(y)}
|
|
43
43
|
y2={y === true || y === 'bottom' ? yRangeMax : y === 'top' ? yRangeMin : $yScale(y)}
|
|
44
44
|
{...$$restProps}
|
|
45
|
-
class={cls('stroke-
|
|
45
|
+
class={cls('stroke-surface-content/50', $$props.class)}
|
|
46
46
|
/>
|
|
47
47
|
{/if}
|
|
48
48
|
</g>
|
|
@@ -22,6 +22,15 @@ export let y = undefined; // TODO: Update Type
|
|
|
22
22
|
export let tweened = undefined;
|
|
23
23
|
/** Draw path over time. Works best without `tweened` enabled */
|
|
24
24
|
export let draw = undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Curve of spline drawn. Imported via d3-shape.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* import { curveNatural } from 'd3-shape';
|
|
30
|
+
* <Spline curve={curveNatrual} />
|
|
31
|
+
*
|
|
32
|
+
* @type {CurveFactory | CurveFactoryLineOnly | undefined}
|
|
33
|
+
*/
|
|
25
34
|
export let curve = undefined;
|
|
26
35
|
export let defined = undefined;
|
|
27
36
|
let d = '';
|
|
@@ -81,7 +90,7 @@ $: {
|
|
|
81
90
|
<path
|
|
82
91
|
d={$tweened_d}
|
|
83
92
|
{...$$restProps}
|
|
84
|
-
class={cls('path-line fill-none', !$$props.stroke && 'stroke-
|
|
93
|
+
class={cls('path-line fill-none', !$$props.stroke && 'stroke-surface-content', $$props.class)}
|
|
85
94
|
in:drawTransition|global={typeof draw === 'object' ? draw : undefined}
|
|
86
95
|
on:click
|
|
87
96
|
on:mousemove
|
|
@@ -130,7 +130,7 @@ function isValidXOrY(xOrY) {
|
|
|
130
130
|
{transform}
|
|
131
131
|
text-anchor={textAnchor}
|
|
132
132
|
{...$$restProps}
|
|
133
|
-
class={cls('fill-surface-content', $$props.class)}
|
|
133
|
+
class={cls($$props.fill === undefined && 'fill-surface-content', $$props.class)}
|
|
134
134
|
>
|
|
135
135
|
{#each wordsByLines as line, index}
|
|
136
136
|
<tspan {x} dy={index === 0 ? startDy : lineHeight}>
|
|
@@ -65,13 +65,7 @@ $: if (!disableCache) {
|
|
|
65
65
|
/>
|
|
66
66
|
<image xlink:href={href} x={(x + tx) * k} y={(y + ty) * k} width={k} height={k} />
|
|
67
67
|
{#if debug}
|
|
68
|
-
<rect
|
|
69
|
-
x={(x + tx) * k}
|
|
70
|
-
y={(y + ty) * k}
|
|
71
|
-
width={k}
|
|
72
|
-
height={k}
|
|
73
|
-
class="stroke-red-500/50 fill-none"
|
|
74
|
-
/>
|
|
68
|
+
<rect x={(x + tx) * k} y={(y + ty) * k} width={k} height={k} class="stroke-danger/50 fill-none" />
|
|
75
69
|
<Text
|
|
76
70
|
x={(x + tx) * k}
|
|
77
71
|
y={(y + ty) * k}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { type FormatType } from 'svelte-ux';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
6
5
|
label: any;
|
|
7
6
|
value?: any;
|
|
8
|
-
format?:
|
|
7
|
+
format?: any;
|
|
9
8
|
valueAlign?: "center" | "left" | "right" | undefined;
|
|
10
9
|
classes?: {
|
|
11
10
|
label?: string | undefined;
|
|
@@ -13,6 +13,7 @@ export { default as CircleClipPath } from './CircleClipPath.svelte';
|
|
|
13
13
|
export { default as ClipPath } from './ClipPath.svelte';
|
|
14
14
|
export { default as ColorRamp } from './ColorRamp.svelte';
|
|
15
15
|
export { default as Frame } from './Frame.svelte';
|
|
16
|
+
export { default as GeoCircle } from './GeoCircle.svelte';
|
|
16
17
|
export { default as GeoContext, geoContext } from './GeoContext.svelte';
|
|
17
18
|
export { default as GeoPath } from './GeoPath.svelte';
|
|
18
19
|
export { default as GeoPoint } from './GeoPoint.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { default as CircleClipPath } from './CircleClipPath.svelte';
|
|
|
13
13
|
export { default as ClipPath } from './ClipPath.svelte';
|
|
14
14
|
export { default as ColorRamp } from './ColorRamp.svelte';
|
|
15
15
|
export { default as Frame } from './Frame.svelte';
|
|
16
|
+
export { default as GeoCircle } from './GeoCircle.svelte';
|
|
16
17
|
export { default as GeoContext, geoContext } from './GeoContext.svelte';
|
|
17
18
|
export { default as GeoPath } from './GeoPath.svelte';
|
|
18
19
|
export { default as GeoPoint } from './GeoPoint.svelte';
|
package/dist/docs/Code.svelte
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script>import Prism from 'prismjs';
|
|
2
2
|
import 'prism-svelte';
|
|
3
|
-
import { CopyButton, cls,
|
|
3
|
+
import { CopyButton, cls, getComponentClasses } from 'svelte-ux';
|
|
4
4
|
export let source = null;
|
|
5
5
|
export let language = 'svelte';
|
|
6
6
|
export let highlightedSource = source
|
|
7
7
|
? Prism.highlight(source, Prism.languages[language] ?? Prism.languages.text, language)
|
|
8
8
|
: '';
|
|
9
9
|
export let classes = {};
|
|
10
|
-
const
|
|
10
|
+
const settingsClasses = getComponentClasses('Code');
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<div class={cls('Code', 'rounded',
|
|
13
|
+
<div class={cls('Code', 'rounded', settingsClasses.root, classes.root, $$props.class)}>
|
|
14
14
|
{#if source}
|
|
15
15
|
<div class="relative">
|
|
16
16
|
<pre
|
|
@@ -39,6 +39,6 @@ let showCenter = false;
|
|
|
39
39
|
|
|
40
40
|
{#if showCenter}
|
|
41
41
|
<div
|
|
42
|
-
class="absolute w-2 h-2 bg-
|
|
42
|
+
class="absolute w-2 h-2 bg-danger/80 rounded-full z-[1] left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
43
43
|
/>
|
|
44
44
|
{/if}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { SelectField, Switch } from 'svelte-ux';
|
|
2
2
|
export let doubleScale = devicePixelRatio > 1;
|
|
3
3
|
// TODO: Access via context, or possibly global state
|
|
4
4
|
const ACCESS_TOKEN = 'pk.eyJ1IjoidGVjaG5pcTM1IiwiYSI6ImNsZTR5cDd0ZjAyNm8zdnFvczhzdnFpcXkifQ.-LAr8sl5BZ3y-H0pDyD1qA';
|
|
@@ -25,7 +25,7 @@ const arcgisVector = (tileset) => (x, y, z) => {
|
|
|
25
25
|
return `https://basemaps.arcgis.com/arcgis/rest/services/${tileset}/VectorTileServer/tile/${z}/${y}/${x}.pbf`;
|
|
26
26
|
// https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/tile/12/1572/1108.pbf
|
|
27
27
|
};
|
|
28
|
-
$:
|
|
28
|
+
$: services = {
|
|
29
29
|
'mapbox v1': {
|
|
30
30
|
'streets-v11': mapboxv1('streets-v11'),
|
|
31
31
|
'light-v10': mapboxv1('light-v10'),
|
|
@@ -66,28 +66,31 @@ $: serviceOptions = {
|
|
|
66
66
|
// 'Community Map', url: arcgisVector('World_Basemap_v2'),
|
|
67
67
|
// }
|
|
68
68
|
};
|
|
69
|
-
$:
|
|
69
|
+
$: serviceOptions = Object.entries(services).flatMap(([group, service]) => {
|
|
70
|
+
return Object.entries(service).map(([label, value]) => {
|
|
71
|
+
return { label, value: `${group}:${label}`, group, serviceUrl: value };
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
$: defaultServiceUrl = services['mapbox v1']['streets-v11'];
|
|
70
75
|
export let serviceUrl = defaultServiceUrl;
|
|
71
76
|
$: getServiceUrl = (option) => {
|
|
72
77
|
const [selectedService, selectedTileset] = selected.split(':');
|
|
73
|
-
return
|
|
78
|
+
return services[selectedService][selectedTileset];
|
|
74
79
|
};
|
|
75
80
|
let selected = 'mapbox v1:streets-v11';
|
|
76
81
|
$: serviceUrl = getServiceUrl(selected);
|
|
77
82
|
</script>
|
|
78
83
|
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
</select>
|
|
89
|
-
<div slot="append">
|
|
84
|
+
<SelectField
|
|
85
|
+
label="Tileset"
|
|
86
|
+
options={serviceOptions}
|
|
87
|
+
bind:value={selected}
|
|
88
|
+
clearable={false}
|
|
89
|
+
toggleIcon={null}
|
|
90
|
+
stepper
|
|
91
|
+
>
|
|
92
|
+
<div slot="append" on:click|stopPropagation>
|
|
90
93
|
<div class="text-[10px] text-surface-content/50 text-center">2x</div>
|
|
91
94
|
<Switch bind:checked={doubleScale} size="md" />
|
|
92
95
|
</div>
|
|
93
|
-
</
|
|
96
|
+
</SelectField>
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/dist/utils/stack.js
CHANGED
|
@@ -16,7 +16,7 @@ export function createStackData(data, options) {
|
|
|
16
16
|
//console.log({ series })
|
|
17
17
|
return series.flatMap((s) => {
|
|
18
18
|
return {
|
|
19
|
-
...itemData[0],
|
|
19
|
+
...itemData[0], // TODO: More than one should use stacks or aggregate values?
|
|
20
20
|
keys: options.stackBy ? [...groupKeys, series.key] : groupKeys,
|
|
21
21
|
values: options.stackBy ? [s[0], s[1]] : [0, sum(itemData, (d) => d.value)],
|
|
22
22
|
};
|
package/dist/utils/ticks.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function getMajorTicks(start: Date, end: Date): import("d3-time").TimeInterval | null;
|
|
2
|
-
export declare function formatMajorTick(date: Date, rangeStart: Date, rangeEnd: Date):
|
|
2
|
+
export declare function formatMajorTick(date: Date, rangeStart: Date, rangeEnd: Date): string;
|
|
3
3
|
export declare function getMinorTicks(start: Date, end: Date): import("d3-time").TimeInterval | null;
|
package/dist/utils/ticks.js
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
import { timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond, } from 'd3-time';
|
|
2
2
|
import { format } from 'date-fns';
|
|
3
|
-
import { formatDate, PeriodType } from 'svelte-ux
|
|
4
|
-
import { getDuration } from 'svelte-ux/utils/duration';
|
|
3
|
+
import { formatDate, PeriodType, getDuration } from 'svelte-ux';
|
|
5
4
|
import { fail } from 'svelte-ux';
|
|
6
5
|
// TODO: Use PeriodType along with Duration to format (and possibly select intervals)
|
|
7
6
|
const majorTicks = [
|
|
8
7
|
{
|
|
9
|
-
predicate: (duration) => duration == null,
|
|
10
|
-
interval: timeYear.every(1),
|
|
8
|
+
predicate: (duration) => duration == null, // Unknown
|
|
9
|
+
interval: timeYear.every(1), // Better than rendering a lot of items
|
|
11
10
|
format: (date) => date.toString(),
|
|
12
11
|
},
|
|
13
12
|
{
|
|
14
13
|
predicate: (duration) => duration.years > 1,
|
|
15
14
|
interval: timeYear.every(1),
|
|
16
|
-
format: (date) => formatDate(date, PeriodType.CalendarYear, 'short'),
|
|
15
|
+
format: (date) => formatDate(date, PeriodType.CalendarYear, { variant: 'short' }),
|
|
17
16
|
},
|
|
18
17
|
{
|
|
19
18
|
predicate: (duration) => duration.years,
|
|
20
19
|
interval: timeMonth.every(1),
|
|
21
|
-
format: (date) => formatDate(date, PeriodType.Month, 'short'),
|
|
20
|
+
format: (date) => formatDate(date, PeriodType.Month, { variant: 'short' }),
|
|
22
21
|
},
|
|
23
22
|
{
|
|
24
23
|
predicate: (duration) => duration.days > 30,
|
|
25
24
|
interval: timeMonth.every(1),
|
|
26
|
-
format: (date) => formatDate(date, PeriodType.Month, 'short'),
|
|
25
|
+
format: (date) => formatDate(date, PeriodType.Month, { variant: 'short' }),
|
|
27
26
|
},
|
|
28
27
|
{
|
|
29
28
|
predicate: (duration) => duration.days,
|
|
30
29
|
interval: timeDay.every(1),
|
|
31
|
-
format: (date) => formatDate(date, PeriodType.Day, 'short'),
|
|
30
|
+
format: (date) => formatDate(date, PeriodType.Day, { variant: 'short' }),
|
|
32
31
|
},
|
|
33
32
|
{
|
|
34
33
|
predicate: (duration) => duration.hours,
|
|
@@ -56,36 +55,36 @@ const majorTicks = [
|
|
|
56
55
|
format: (date) => format(date, 'h:mm:ss'),
|
|
57
56
|
},
|
|
58
57
|
{
|
|
59
|
-
predicate: (duration) => true,
|
|
58
|
+
predicate: (duration) => true, // 0 or more milliseconds
|
|
60
59
|
interval: timeMillisecond.every(100),
|
|
61
60
|
format: (date) => format(date, 'h:mm:ss.SSS'),
|
|
62
61
|
},
|
|
63
62
|
];
|
|
64
63
|
const minorTicks = [
|
|
65
64
|
{
|
|
66
|
-
predicate: (duration) => duration == null,
|
|
67
|
-
interval: timeYear.every(1),
|
|
65
|
+
predicate: (duration) => duration == null, // Unknown
|
|
66
|
+
interval: timeYear.every(1), // Better than rendering a lot of items
|
|
68
67
|
format: (date) => date.toString(),
|
|
69
68
|
},
|
|
70
69
|
{
|
|
71
70
|
predicate: (duration) => duration.years,
|
|
72
71
|
interval: timeMonth.every(1),
|
|
73
|
-
format: (date) => formatDate(date, PeriodType.Month, 'short'),
|
|
72
|
+
format: (date) => formatDate(date, PeriodType.Month, { variant: 'short' }),
|
|
74
73
|
},
|
|
75
74
|
{
|
|
76
75
|
predicate: (duration) => duration.days > 90,
|
|
77
76
|
interval: timeMonth.every(1),
|
|
78
|
-
format: (date) => formatDate(date, PeriodType.Month, 'short'),
|
|
77
|
+
format: (date) => formatDate(date, PeriodType.Month, { variant: 'short' }),
|
|
79
78
|
},
|
|
80
79
|
{
|
|
81
80
|
predicate: (duration) => duration.days > 30,
|
|
82
81
|
interval: timeWeek.every(1),
|
|
83
|
-
format: (date) => formatDate(date, PeriodType.WeekSun, 'short'),
|
|
82
|
+
format: (date) => formatDate(date, PeriodType.WeekSun, { variant: 'short' }),
|
|
84
83
|
},
|
|
85
84
|
{
|
|
86
85
|
predicate: (duration) => duration.days > 7,
|
|
87
86
|
interval: timeDay.every(1),
|
|
88
|
-
format: (date) => formatDate(date, PeriodType.Day, 'short'),
|
|
87
|
+
format: (date) => formatDate(date, PeriodType.Day, { variant: 'short' }),
|
|
89
88
|
},
|
|
90
89
|
{
|
|
91
90
|
predicate: (duration) => duration.days > 3,
|
|
@@ -123,7 +122,7 @@ const minorTicks = [
|
|
|
123
122
|
format: (date) => format(date, 'h:mm:ss'),
|
|
124
123
|
},
|
|
125
124
|
{
|
|
126
|
-
predicate: (duration) => true,
|
|
125
|
+
predicate: (duration) => true, // 0 or more milliseconds
|
|
127
126
|
interval: timeMillisecond.every(10),
|
|
128
127
|
format: (date) => format(date, 'h:mm:ss.SSS'),
|
|
129
128
|
},
|
package/package.json
CHANGED
|
@@ -4,24 +4,14 @@
|
|
|
4
4
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "techniq/layerchart",
|
|
7
|
-
"version": "0.
|
|
8
|
-
"scripts": {
|
|
9
|
-
"dev": "vite dev",
|
|
10
|
-
"build": "vite build",
|
|
11
|
-
"preview": "vite preview",
|
|
12
|
-
"package": "svelte-package",
|
|
13
|
-
"prepublishOnly": "svelte-package",
|
|
14
|
-
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
15
|
-
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
|
16
|
-
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. .",
|
|
17
|
-
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. .",
|
|
18
|
-
"prepare": "svelte-kit sync"
|
|
19
|
-
},
|
|
7
|
+
"version": "0.30.0",
|
|
20
8
|
"devDependencies": {
|
|
9
|
+
"@changesets/cli": "^2.27.1",
|
|
10
|
+
"@mdi/js": "^7.4.47",
|
|
21
11
|
"@rollup/plugin-dsv": "^3.0.4",
|
|
22
|
-
"@sveltejs/adapter-auto": "^
|
|
23
|
-
"@sveltejs/kit": "^
|
|
24
|
-
"@sveltejs/package": "^2.2.
|
|
12
|
+
"@sveltejs/adapter-auto": "^3.1.0",
|
|
13
|
+
"@sveltejs/kit": "^2.3.2",
|
|
14
|
+
"@sveltejs/package": "^2.2.5",
|
|
25
15
|
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
|
|
26
16
|
"@tailwindcss/typography": "^0.5.10",
|
|
27
17
|
"@types/d3-array": "^3.2.1",
|
|
@@ -31,43 +21,50 @@
|
|
|
31
21
|
"@types/d3-hierarchy": "^3.1.6",
|
|
32
22
|
"@types/d3-interpolate": "^3.0.4",
|
|
33
23
|
"@types/d3-interpolate-path": "^2.0.3",
|
|
34
|
-
"@types/d3-quadtree": "^3.0.
|
|
24
|
+
"@types/d3-quadtree": "^3.0.6",
|
|
35
25
|
"@types/d3-random": "^3.0.3",
|
|
36
26
|
"@types/d3-sankey": "^0.12.4",
|
|
37
27
|
"@types/d3-scale": "^4.0.8",
|
|
38
|
-
"@types/d3-scale-chromatic": "^3.0.
|
|
39
|
-
"@types/d3-shape": "^3.1.
|
|
40
|
-
"@types/
|
|
28
|
+
"@types/d3-scale-chromatic": "^3.0.3",
|
|
29
|
+
"@types/d3-shape": "^3.1.6",
|
|
30
|
+
"@types/d3-time": "^3.0.2",
|
|
31
|
+
"@types/lodash-es": "^4.17.12",
|
|
41
32
|
"@types/marked": "^6.0.0",
|
|
33
|
+
"@types/prismjs": "^1.26.3",
|
|
42
34
|
"@types/shapefile": "^0.6.4",
|
|
43
35
|
"@types/topojson-client": "^3.1.4",
|
|
44
36
|
"autoprefixer": "^10.4.16",
|
|
45
|
-
"
|
|
37
|
+
"d3-color": "^3.1.0",
|
|
46
38
|
"execa": "^8.0.1",
|
|
47
|
-
"marked": "^
|
|
39
|
+
"marked": "^11.1.1",
|
|
48
40
|
"mdsvex": "^0.11.0",
|
|
49
|
-
"
|
|
50
|
-
"prettier
|
|
41
|
+
"posthog-js": "^1.95.1",
|
|
42
|
+
"prettier": "^3.2.2",
|
|
43
|
+
"prettier-plugin-svelte": "^3.1.2",
|
|
44
|
+
"prism-svelte": "^0.5.0",
|
|
51
45
|
"prism-themes": "^1.9.0",
|
|
46
|
+
"prismjs": "^1.29.0",
|
|
52
47
|
"rehype-slug": "^6.0.0",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
48
|
+
"shapefile": "^0.6.6",
|
|
49
|
+
"solar-calculator": "^0.3.0",
|
|
50
|
+
"svelte": "^4.2.8",
|
|
51
|
+
"svelte-check": "^3.6.3",
|
|
55
52
|
"svelte-json-tree": "^2.2.0",
|
|
56
|
-
"svelte-preprocess": "^5.1.
|
|
57
|
-
"svelte2tsx": "^0.
|
|
58
|
-
"tailwindcss": "^3.
|
|
53
|
+
"svelte-preprocess": "^5.1.3",
|
|
54
|
+
"svelte2tsx": "^0.7.0",
|
|
55
|
+
"tailwindcss": "^3.4.1",
|
|
56
|
+
"topojson-client": "^3.1.0",
|
|
59
57
|
"tslib": "^2.6.2",
|
|
60
|
-
"typescript": "^5.
|
|
58
|
+
"typescript": "^5.3.3",
|
|
61
59
|
"unist-util-visit": "^5.0.0",
|
|
62
60
|
"us-atlas": "^3.0.1",
|
|
63
|
-
"vite": "^
|
|
61
|
+
"vite": "^5.0.11"
|
|
64
62
|
},
|
|
65
63
|
"type": "module",
|
|
66
64
|
"dependencies": {
|
|
67
|
-
"@
|
|
68
|
-
"@mdi/js": "^7.3.67",
|
|
69
|
-
"@types/d3-time": "^3.0.2",
|
|
65
|
+
"@sveltejs/vite-plugin-svelte": "^3.0.1",
|
|
70
66
|
"d3-array": "^3.2.4",
|
|
67
|
+
"d3-color": "^3.1.0",
|
|
71
68
|
"d3-delaunay": "^6.0.4",
|
|
72
69
|
"d3-dsv": "^3.0.1",
|
|
73
70
|
"d3-geo": "^3.1.0",
|
|
@@ -82,12 +79,12 @@
|
|
|
82
79
|
"d3-shape": "^3.2.0",
|
|
83
80
|
"d3-tile": "^1.0.0",
|
|
84
81
|
"d3-time": "^3.1.0",
|
|
85
|
-
"date-fns": "^2.
|
|
82
|
+
"date-fns": "^3.2.0",
|
|
86
83
|
"layercake": "^8.0.2",
|
|
87
84
|
"lodash-es": "^4.17.21",
|
|
88
|
-
"posthog-js": "^1.
|
|
85
|
+
"posthog-js": "^1.100.0",
|
|
89
86
|
"shapefile": "^0.6.6",
|
|
90
|
-
"svelte-ux": "0.
|
|
87
|
+
"svelte-ux": "0.60.0",
|
|
91
88
|
"topojson-client": "^3.1.0"
|
|
92
89
|
},
|
|
93
90
|
"peerDependencies": {
|
|
@@ -103,5 +100,15 @@
|
|
|
103
100
|
"files": [
|
|
104
101
|
"dist"
|
|
105
102
|
],
|
|
106
|
-
"svelte": "./dist/index.js"
|
|
107
|
-
|
|
103
|
+
"svelte": "./dist/index.js",
|
|
104
|
+
"scripts": {
|
|
105
|
+
"dev": "vite dev",
|
|
106
|
+
"build": "vite build",
|
|
107
|
+
"preview": "vite preview",
|
|
108
|
+
"package": "svelte-package",
|
|
109
|
+
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
110
|
+
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
|
111
|
+
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. .",
|
|
112
|
+
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
|
|
113
|
+
}
|
|
114
|
+
}
|
package/dist/utils/string.d.ts
DELETED