layerchart 0.13.3 → 0.14.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 → dist/components}/AxisX.svelte.d.ts +1 -2
- package/{components → dist/components}/AxisY.svelte.d.ts +1 -2
- package/dist/components/Blur.svelte +16 -0
- package/dist/components/Blur.svelte.d.ts +21 -0
- package/{components → dist/components}/Chart.svelte +31 -8
- package/{components → dist/components}/Chart.svelte.d.ts +6 -1
- package/{components → dist/components}/ChartClipPath.svelte.d.ts +1 -1
- package/dist/components/ClipPathUse.svelte +17 -0
- package/dist/components/ClipPathUse.svelte.d.ts +27 -0
- package/dist/components/ColorRamp.svelte +19 -0
- package/dist/components/ColorRamp.svelte.d.ts +20 -0
- package/dist/components/GeoContext.svelte +55 -0
- package/dist/components/GeoContext.svelte.d.ts +40 -0
- package/dist/components/GeoPath.svelte +56 -0
- package/dist/components/GeoPath.svelte.d.ts +36 -0
- package/dist/components/GeoPoint.svelte +28 -0
- package/dist/components/GeoPoint.svelte.d.ts +23 -0
- package/dist/components/GeoTile.svelte +47 -0
- package/dist/components/GeoTile.svelte.d.ts +24 -0
- package/dist/components/Graticule.svelte +26 -0
- package/dist/components/Graticule.svelte.d.ts +21 -0
- package/{components → dist/components}/Labels.svelte.d.ts +3 -5
- package/dist/components/Legend.svelte +163 -0
- package/dist/components/Legend.svelte.d.ts +32 -0
- package/dist/components/TileImage.svelte +84 -0
- package/dist/components/TileImage.svelte.d.ts +24 -0
- package/{components → dist/components}/Tooltip.svelte +9 -11
- package/{components → dist/components}/TooltipContext.svelte +7 -1
- package/{components → dist/components}/TooltipContext.svelte.d.ts +1 -0
- package/{components → dist/components}/TooltipItem.svelte.d.ts +1 -2
- package/{components → dist/components}/Treemap.svelte.d.ts +1 -1
- package/dist/components/Zoom.svelte +185 -0
- package/{components → dist/components}/Zoom.svelte.d.ts +36 -9
- package/{components → dist/components}/index.d.ts +9 -0
- package/{components → dist/components}/index.js +9 -0
- package/dist/docs/GeoDebug.svelte +43 -0
- package/dist/docs/GeoDebug.svelte.d.ts +16 -0
- package/{docs → dist/docs}/Header1.svelte.d.ts +2 -2
- package/{docs → dist/docs}/Layout.svelte.d.ts +3 -3
- package/{docs → dist/docs}/Link.svelte.d.ts +2 -2
- package/{docs → dist/docs}/Preview.svelte +1 -7
- package/dist/docs/RangeField.svelte +18 -0
- package/dist/docs/RangeField.svelte.d.ts +20 -0
- package/dist/docs/TilesetField.svelte +93 -0
- package/dist/docs/TilesetField.svelte.d.ts +17 -0
- package/dist/docs/ZoomControls.svelte +50 -0
- package/dist/docs/ZoomControls.svelte.d.ts +19 -0
- package/{utils → dist/utils}/event.js +1 -1
- package/{utils → dist/utils}/ticks.d.ts +3 -3
- package/package.json +88 -123
- package/components/Legend.svelte +0 -17
- package/components/Legend.svelte.d.ts +0 -23
- package/components/Zoom.svelte +0 -133
- /package/{components → dist/components}/Arc.svelte +0 -0
- /package/{components → dist/components}/Arc.svelte.d.ts +0 -0
- /package/{components → dist/components}/Area.svelte +0 -0
- /package/{components → dist/components}/Area.svelte.d.ts +0 -0
- /package/{components → dist/components}/AreaStack.svelte +0 -0
- /package/{components → dist/components}/AreaStack.svelte.d.ts +0 -0
- /package/{components → dist/components}/AxisX.svelte +0 -0
- /package/{components → dist/components}/AxisY.svelte +0 -0
- /package/{components → dist/components}/Bars.svelte +0 -0
- /package/{components → dist/components}/Bars.svelte.d.ts +0 -0
- /package/{components → dist/components}/Baseline.svelte +0 -0
- /package/{components → dist/components}/Baseline.svelte.d.ts +0 -0
- /package/{components → dist/components}/Bounds.svelte +0 -0
- /package/{components → dist/components}/Bounds.svelte.d.ts +0 -0
- /package/{components → dist/components}/ChartClipPath.svelte +0 -0
- /package/{components → dist/components}/Circle.svelte +0 -0
- /package/{components → dist/components}/Circle.svelte.d.ts +0 -0
- /package/{components → dist/components}/CircleClipPath.svelte +0 -0
- /package/{components → dist/components}/CircleClipPath.svelte.d.ts +0 -0
- /package/{components → dist/components}/ClipPath.svelte +0 -0
- /package/{components → dist/components}/ClipPath.svelte.d.ts +0 -0
- /package/{components → dist/components}/ConnectedPoints.svelte +0 -0
- /package/{components → dist/components}/ConnectedPoints.svelte.d.ts +0 -0
- /package/{components → dist/components}/Group.svelte +0 -0
- /package/{components → dist/components}/Group.svelte.d.ts +0 -0
- /package/{components → dist/components}/HighlightLine.svelte +0 -0
- /package/{components → dist/components}/HighlightLine.svelte.d.ts +0 -0
- /package/{components → dist/components}/HighlightRect.svelte +0 -0
- /package/{components → dist/components}/HighlightRect.svelte.d.ts +0 -0
- /package/{components → dist/components}/Labels.svelte +0 -0
- /package/{components → dist/components}/Line.svelte +0 -0
- /package/{components → dist/components}/Line.svelte.d.ts +0 -0
- /package/{components → dist/components}/LinearGradient.svelte +0 -0
- /package/{components → dist/components}/LinearGradient.svelte.d.ts +0 -0
- /package/{components → dist/components}/Link.svelte +0 -0
- /package/{components → dist/components}/Link.svelte.d.ts +0 -0
- /package/{components → dist/components}/Pack.svelte +0 -0
- /package/{components → dist/components}/Pack.svelte.d.ts +0 -0
- /package/{components → dist/components}/Partition.svelte +0 -0
- /package/{components → dist/components}/Partition.svelte.d.ts +0 -0
- /package/{components → dist/components}/Path.svelte +0 -0
- /package/{components → dist/components}/Path.svelte.d.ts +0 -0
- /package/{components → dist/components}/Pattern.svelte +0 -0
- /package/{components → dist/components}/Pattern.svelte.d.ts +0 -0
- /package/{components → dist/components}/Pie.svelte +0 -0
- /package/{components → dist/components}/Pie.svelte.d.ts +0 -0
- /package/{components → dist/components}/Points.svelte +0 -0
- /package/{components → dist/components}/Points.svelte.d.ts +0 -0
- /package/{components → dist/components}/Rect.svelte +0 -0
- /package/{components → dist/components}/RectClipPath.svelte +0 -0
- /package/{components → dist/components}/RectClipPath.svelte.d.ts +0 -0
- /package/{components → dist/components}/Sankey.svelte +0 -0
- /package/{components → dist/components}/Sankey.svelte.d.ts +0 -0
- /package/{components → dist/components}/Text.svelte +0 -0
- /package/{components → dist/components}/Text.svelte.d.ts +0 -0
- /package/{components → dist/components}/Threshold.svelte +0 -0
- /package/{components → dist/components}/Threshold.svelte.d.ts +0 -0
- /package/{components → dist/components}/Tooltip.svelte.d.ts +0 -0
- /package/{components → dist/components}/TooltipItem.svelte +0 -0
- /package/{components → dist/components}/TooltipSeparator.svelte +0 -0
- /package/{components → dist/components}/TooltipSeparator.svelte.d.ts +0 -0
- /package/{components → dist/components}/Tree.svelte +0 -0
- /package/{components → dist/components}/Tree.svelte.d.ts +0 -0
- /package/{components → dist/components}/Treemap.svelte +0 -0
- /package/{docs → dist/docs}/Blockquote.svelte +0 -0
- /package/{docs → dist/docs}/Blockquote.svelte.d.ts +0 -0
- /package/{docs → dist/docs}/Code.svelte +0 -0
- /package/{docs → dist/docs}/Code.svelte.d.ts +0 -0
- /package/{docs → dist/docs}/Header1.svelte +0 -0
- /package/{docs → dist/docs}/Layout.svelte +0 -0
- /package/{docs → dist/docs}/Link.svelte +0 -0
- /package/{docs → dist/docs}/Preview.svelte.d.ts +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{stores → dist/stores}/motionStore.d.ts +0 -0
- /package/{stores → dist/stores}/motionStore.js +0 -0
- /package/{utils → dist/utils}/event.d.ts +0 -0
- /package/{utils → dist/utils}/genData.d.ts +0 -0
- /package/{utils → dist/utils}/genData.js +0 -0
- /package/{utils → dist/utils}/graph.d.ts +0 -0
- /package/{utils → dist/utils}/graph.js +0 -0
- /package/{utils → dist/utils}/hierarchy.d.ts +0 -0
- /package/{utils → dist/utils}/hierarchy.js +0 -0
- /package/{utils → dist/utils}/index.d.ts +0 -0
- /package/{utils → dist/utils}/index.js +0 -0
- /package/{utils → dist/utils}/math.d.ts +0 -0
- /package/{utils → dist/utils}/math.js +0 -0
- /package/{utils → dist/utils}/path.d.ts +0 -0
- /package/{utils → dist/utils}/path.js +0 -0
- /package/{utils → dist/utils}/pivot.d.ts +0 -0
- /package/{utils → dist/utils}/pivot.js +0 -0
- /package/{utils → dist/utils}/quadtree.d.ts +0 -0
- /package/{utils → dist/utils}/quadtree.js +0 -0
- /package/{utils → dist/utils}/scales.d.ts +0 -0
- /package/{utils → dist/utils}/scales.js +0 -0
- /package/{utils → dist/utils}/stack.d.ts +0 -0
- /package/{utils → dist/utils}/stack.js +0 -0
- /package/{utils → dist/utils}/string.d.ts +0 -0
- /package/{utils → dist/utils}/string.js +0 -0
- /package/{utils → dist/utils}/ticks.js +0 -0
- /package/{utils → dist/utils}/treemap.d.ts +0 -0
- /package/{utils → dist/utils}/treemap.js +0 -0
|
@@ -5,13 +5,21 @@ export { default as AxisX } from './AxisX.svelte';
|
|
|
5
5
|
export { default as AxisY } from './AxisY.svelte';
|
|
6
6
|
export { default as Bars } from './Bars.svelte';
|
|
7
7
|
export { default as Baseline } from './Baseline.svelte';
|
|
8
|
+
export { default as Blur } from './Blur.svelte';
|
|
8
9
|
export { default as Bounds } from './Bounds.svelte';
|
|
9
10
|
export { default as Chart } from './Chart.svelte';
|
|
10
11
|
export { default as ChartClipPath } from './ChartClipPath.svelte';
|
|
11
12
|
export { default as Circle } from './Circle.svelte';
|
|
12
13
|
export { default as CircleClipPath } from './CircleClipPath.svelte';
|
|
13
14
|
export { default as ClipPath } from './ClipPath.svelte';
|
|
15
|
+
export { default as ClipPathUse } from './ClipPathUse.svelte';
|
|
16
|
+
export { default as ColorRamp } from './ColorRamp.svelte';
|
|
14
17
|
export { default as ConnectedPoints } from './ConnectedPoints.svelte';
|
|
18
|
+
export { default as GeoContext } from './GeoContext.svelte';
|
|
19
|
+
export { default as GeoPath } from './GeoPath.svelte';
|
|
20
|
+
export { default as GeoPoint } from './GeoPoint.svelte';
|
|
21
|
+
export { default as GeoTile } from './GeoTile.svelte';
|
|
22
|
+
export { default as Graticule } from './Graticule.svelte';
|
|
15
23
|
export { default as Group } from './Group.svelte';
|
|
16
24
|
export { default as HighlightLine } from './HighlightLine.svelte';
|
|
17
25
|
export { default as HighlightRect } from './HighlightRect.svelte';
|
|
@@ -31,6 +39,7 @@ export { default as RectClipPath } from './RectClipPath.svelte';
|
|
|
31
39
|
export { default as Sankey } from './Sankey.svelte';
|
|
32
40
|
export { default as Text } from './Text.svelte';
|
|
33
41
|
export { default as Threshold } from './Threshold.svelte';
|
|
42
|
+
export { default as TileImage } from './TileImage.svelte';
|
|
34
43
|
export { default as Tooltip } from './Tooltip.svelte';
|
|
35
44
|
export { default as TooltipContext } from './TooltipContext.svelte';
|
|
36
45
|
export { default as TooltipItem } from './TooltipItem.svelte';
|
|
@@ -5,13 +5,21 @@ export { default as AxisX } from './AxisX.svelte';
|
|
|
5
5
|
export { default as AxisY } from './AxisY.svelte';
|
|
6
6
|
export { default as Bars } from './Bars.svelte';
|
|
7
7
|
export { default as Baseline } from './Baseline.svelte';
|
|
8
|
+
export { default as Blur } from './Blur.svelte';
|
|
8
9
|
export { default as Bounds } from './Bounds.svelte';
|
|
9
10
|
export { default as Chart } from './Chart.svelte';
|
|
10
11
|
export { default as ChartClipPath } from './ChartClipPath.svelte';
|
|
11
12
|
export { default as Circle } from './Circle.svelte';
|
|
12
13
|
export { default as CircleClipPath } from './CircleClipPath.svelte';
|
|
13
14
|
export { default as ClipPath } from './ClipPath.svelte';
|
|
15
|
+
export { default as ClipPathUse } from './ClipPathUse.svelte';
|
|
16
|
+
export { default as ColorRamp } from './ColorRamp.svelte';
|
|
14
17
|
export { default as ConnectedPoints } from './ConnectedPoints.svelte';
|
|
18
|
+
export { default as GeoContext } from './GeoContext.svelte';
|
|
19
|
+
export { default as GeoPath } from './GeoPath.svelte';
|
|
20
|
+
export { default as GeoPoint } from './GeoPoint.svelte';
|
|
21
|
+
export { default as GeoTile } from './GeoTile.svelte';
|
|
22
|
+
export { default as Graticule } from './Graticule.svelte';
|
|
15
23
|
export { default as Group } from './Group.svelte';
|
|
16
24
|
export { default as HighlightLine } from './HighlightLine.svelte';
|
|
17
25
|
export { default as HighlightRect } from './HighlightRect.svelte';
|
|
@@ -31,6 +39,7 @@ export { default as RectClipPath } from './RectClipPath.svelte';
|
|
|
31
39
|
export { default as Sankey } from './Sankey.svelte';
|
|
32
40
|
export { default as Text } from './Text.svelte';
|
|
33
41
|
export { default as Threshold } from './Threshold.svelte';
|
|
42
|
+
export { default as TileImage } from './TileImage.svelte';
|
|
34
43
|
export { default as Tooltip } from './Tooltip.svelte';
|
|
35
44
|
export { default as TooltipContext } from './TooltipContext.svelte';
|
|
36
45
|
export { default as TooltipItem } from './TooltipItem.svelte';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import { format, Checkbox } from 'svelte-ux';
|
|
3
|
+
import { cls } from 'svelte-ux/utils/styles';
|
|
4
|
+
import { geoContext } from '../components/GeoContext.svelte';
|
|
5
|
+
const { width, height } = getContext('LayerCake');
|
|
6
|
+
const geo = geoContext();
|
|
7
|
+
let showCenter = false;
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<div class={cls('bg-black/5 rounded m-1 backdrop-blur p-2', $$props.class)}>
|
|
11
|
+
<div class="grid gap-2 ml-2 text-xs">
|
|
12
|
+
<div><span class="text-black/50">scale:</span> {format.format($geo.scale(), 'decimal')}</div>
|
|
13
|
+
|
|
14
|
+
<div>
|
|
15
|
+
<span class="text-black/50">translate:</span>
|
|
16
|
+
{#each $geo.translate() as coord}
|
|
17
|
+
<div class="ml-2">{format.format(coord, 'decimal')}</div>
|
|
18
|
+
{/each}
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div>
|
|
22
|
+
<span class="text-black/50">rotate:</span>
|
|
23
|
+
{#each $geo.rotate() as angle}
|
|
24
|
+
<div class="ml-2">{format.format(angle, 'decimal')}</div>
|
|
25
|
+
{/each}
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div><span class="text-black/50">center:</span> {$geo.center?.()}</div>
|
|
29
|
+
|
|
30
|
+
<div>
|
|
31
|
+
<span class="text-black/50">long/lat: <Checkbox bind:checked={showCenter} size="xs" /></span>
|
|
32
|
+
{#each $geo.invert?.([$width / 2, $height / 2]) as coord}
|
|
33
|
+
<div class="ml-2">{format.format(coord, 'decimal')}</div>
|
|
34
|
+
{/each}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
{#if showCenter}
|
|
40
|
+
<div
|
|
41
|
+
class="absolute w-2 h-2 bg-red-500/80 rounded-full z-[1] left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
42
|
+
/>
|
|
43
|
+
{/if}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type GeoDebugProps = typeof __propDef.props;
|
|
12
|
+
export type GeoDebugEvents = typeof __propDef.events;
|
|
13
|
+
export type GeoDebugSlots = typeof __propDef.slots;
|
|
14
|
+
export default class GeoDebug extends SvelteComponentTyped<GeoDebugProps, GeoDebugEvents, GeoDebugSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} Header1Events */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} Header1Slots */
|
|
4
4
|
export default class Header1 extends SvelteComponentTyped<{
|
|
5
|
-
[x: string]:
|
|
5
|
+
[x: string]: any;
|
|
6
6
|
}, {
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
8
8
|
}, {
|
|
@@ -15,7 +15,7 @@ export type Header1Slots = typeof __propDef.slots;
|
|
|
15
15
|
import { SvelteComponentTyped } from "svelte";
|
|
16
16
|
declare const __propDef: {
|
|
17
17
|
props: {
|
|
18
|
-
[x: string]:
|
|
18
|
+
[x: string]: any;
|
|
19
19
|
};
|
|
20
20
|
events: {
|
|
21
21
|
[evt: string]: CustomEvent<any>;
|
|
@@ -16,9 +16,9 @@ export default class Layout extends SvelteComponentTyped<{
|
|
|
16
16
|
export type LayoutProps = typeof __propDef.props;
|
|
17
17
|
export type LayoutEvents = typeof __propDef.events;
|
|
18
18
|
export type LayoutSlots = typeof __propDef.slots;
|
|
19
|
-
import a from
|
|
20
|
-
import blockquote from
|
|
21
|
-
import h1 from
|
|
19
|
+
import a from './Link.svelte';
|
|
20
|
+
import blockquote from './Blockquote.svelte';
|
|
21
|
+
import h1 from './Header1.svelte';
|
|
22
22
|
import { SvelteComponentTyped } from "svelte";
|
|
23
23
|
declare const __propDef: {
|
|
24
24
|
props: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} LinkEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} LinkSlots */
|
|
4
4
|
export default class Link extends SvelteComponentTyped<{
|
|
5
|
-
[x: string]:
|
|
5
|
+
[x: string]: any;
|
|
6
6
|
}, {
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
8
8
|
}, {
|
|
@@ -15,7 +15,7 @@ export type LinkSlots = typeof __propDef.slots;
|
|
|
15
15
|
import { SvelteComponentTyped } from "svelte";
|
|
16
16
|
declare const __propDef: {
|
|
17
17
|
props: {
|
|
18
|
-
[x: string]:
|
|
18
|
+
[x: string]: any;
|
|
19
19
|
};
|
|
20
20
|
events: {
|
|
21
21
|
[evt: string]: CustomEvent<any>;
|
|
@@ -27,7 +27,6 @@ export let showCode = false;
|
|
|
27
27
|
<div class="absolute top-0 right-0 p-2">
|
|
28
28
|
<Button
|
|
29
29
|
icon={mdiContentCopy}
|
|
30
|
-
small
|
|
31
30
|
class=" text-white/70 hover:bg-white/20 py-1"
|
|
32
31
|
on:click={() => navigator.clipboard.writeText(code)}
|
|
33
32
|
>
|
|
@@ -39,12 +38,7 @@ export let showCode = false;
|
|
|
39
38
|
</div>
|
|
40
39
|
|
|
41
40
|
{#if code}
|
|
42
|
-
<Button
|
|
43
|
-
icon={mdiCodeTags}
|
|
44
|
-
small
|
|
45
|
-
class=" text-black/70 py-1"
|
|
46
|
-
on:click={() => (showCode = !showCode)}
|
|
47
|
-
>
|
|
41
|
+
<Button icon={mdiCodeTags} class=" text-black/70 py-1" on:click={() => (showCode = !showCode)}>
|
|
48
42
|
{showCode ? 'Hide' : 'Show'} Code
|
|
49
43
|
</Button>
|
|
50
44
|
{/if}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>import { mdiChevronLeft, mdiChevronRight } from '@mdi/js';
|
|
2
|
+
import { Button, Field } from 'svelte-ux';
|
|
3
|
+
export let value;
|
|
4
|
+
export let min = 0;
|
|
5
|
+
export let max = 100;
|
|
6
|
+
export let step = 1;
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Field let:id {...$$restProps}>
|
|
10
|
+
<Button icon={mdiChevronLeft} on:click={() => (value -= value > min ? step : 0)} class="mr-2" />
|
|
11
|
+
<input type="range" bind:value {min} {max} {step} {id} class="h-6 w-full" />
|
|
12
|
+
<span class="ml-2 text-sm text-black/50 tabular-nums text-right inline-grid">
|
|
13
|
+
<span class="col-span-full row-span-full invisible">{min}</span>
|
|
14
|
+
<span class="col-span-full row-span-full">{value}</span>
|
|
15
|
+
<span class="col-span-full row-span-full invisible">{max}</span>
|
|
16
|
+
</span>
|
|
17
|
+
<Button icon={mdiChevronRight} on:click={() => (value += value < max ? step : 0)} class="ml-2" />
|
|
18
|
+
</Field>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
value: number;
|
|
6
|
+
min?: number | undefined;
|
|
7
|
+
max?: number | undefined;
|
|
8
|
+
step?: number | undefined;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export type RangeFieldProps = typeof __propDef.props;
|
|
16
|
+
export type RangeFieldEvents = typeof __propDef.events;
|
|
17
|
+
export type RangeFieldSlots = typeof __propDef.slots;
|
|
18
|
+
export default class RangeField extends SvelteComponentTyped<RangeFieldProps, RangeFieldEvents, RangeFieldSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<script>import { Field, Switch } from 'svelte-ux';
|
|
2
|
+
export let doubleScale = devicePixelRatio > 1;
|
|
3
|
+
// TODO: Access via context, or possibly global state
|
|
4
|
+
const ACCESS_TOKEN = 'pk.eyJ1IjoidGVjaG5pcTM1IiwiYSI6ImNsZTR5cDd0ZjAyNm8zdnFvczhzdnFpcXkifQ.-LAr8sl5BZ3y-H0pDyD1qA';
|
|
5
|
+
// https://docs.mapbox.com/api/maps/styles/
|
|
6
|
+
$: mapboxv1 = (style) => (x, y, z) => {
|
|
7
|
+
return `https://api.mapbox.com/styles/v1/mapbox/${style}/tiles/${z}/${x}/${y}${doubleScale ? '@2x' : ''}?access_token=${ACCESS_TOKEN}`;
|
|
8
|
+
};
|
|
9
|
+
// https://docs.mapbox.com/api/maps/raster-tiles/
|
|
10
|
+
// https://docs.mapbox.com/data/tilesets/reference/mapbox-streets-v8/
|
|
11
|
+
$: mapboxv4 = (tileset) => (x, y, z) => {
|
|
12
|
+
return `https://${'abc'[Math.abs(x + y) % 3]}.tiles.mapbox.com/v4/${tileset}/${z}/${x}/${y}${doubleScale ? '@2x' : ''}.png?access_token=${ACCESS_TOKEN}`;
|
|
13
|
+
};
|
|
14
|
+
// https://apps.nationalmap.gov/services/
|
|
15
|
+
const nationalmap = (tileset) => (x, y, z) => {
|
|
16
|
+
return `https://basemap.nationalmap.gov/arcgis/rest/services/${tileset}/MapServer/tile/${z}/${y}/${x}`;
|
|
17
|
+
};
|
|
18
|
+
// https://services.arcgisonline.com/arcgis/rest/services
|
|
19
|
+
// https://www.arcgis.com/home/webmap/viewer.html?useExisting=1
|
|
20
|
+
// https://www.arcgis.com/apps/mapviewer/index.html
|
|
21
|
+
const arcgis = (tileset) => (x, y, z) => {
|
|
22
|
+
return `https://services.arcgisonline.com/ArcGIS/rest/services/${tileset}/MapServer/tile/${z}/${y}/${x}`;
|
|
23
|
+
};
|
|
24
|
+
const arcgisVector = (tileset) => (x, y, z) => {
|
|
25
|
+
return `https://basemaps.arcgis.com/arcgis/rest/services/${tileset}/VectorTileServer/tile/${z}/${y}/${x}.pbf`;
|
|
26
|
+
// https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/tile/12/1572/1108.pbf
|
|
27
|
+
};
|
|
28
|
+
$: serviceOptions = {
|
|
29
|
+
'mapbox v1': {
|
|
30
|
+
'streets-v11': mapboxv1('streets-v11'),
|
|
31
|
+
'light-v10': mapboxv1('light-v10'),
|
|
32
|
+
'dark-v10': mapboxv1('dark-v10'),
|
|
33
|
+
'outdoors-v12': mapboxv1('outdoors-v12'),
|
|
34
|
+
'satelllite-v9': mapboxv1('satellite-v9'),
|
|
35
|
+
'satelllite-streets-v12': mapboxv1('satellite-streets-v12'),
|
|
36
|
+
'navigation-day-v1': mapboxv1('navigation-day-v1'),
|
|
37
|
+
'navigation-night-v1': mapboxv1('navigation-night-v1')
|
|
38
|
+
},
|
|
39
|
+
'mapbox v4': {
|
|
40
|
+
'natural-earth-2': mapboxv4('mapbox.natural-earth-2'),
|
|
41
|
+
satellite: mapboxv4('mapbox.satellite'),
|
|
42
|
+
streets: mapboxv4('mapbox.mapbox-streets-v8'),
|
|
43
|
+
terrain: mapboxv4('mapbox.mapbox-terrain-v2'),
|
|
44
|
+
'terrain-dem': mapboxv4('mapbox.mapbox-terrain-dem-v1'),
|
|
45
|
+
traffic: mapboxv4('mapbox.mapbox-traffic-v1')
|
|
46
|
+
// 'transit (mapbox v4)': mapboxv4('mapbox.transit-v2'),
|
|
47
|
+
},
|
|
48
|
+
'National Map Services': {
|
|
49
|
+
Hydrography: nationalmap('USGSHydroCached'),
|
|
50
|
+
'USGS Imagery Topo Base Map': nationalmap('USGSImageryTopo'),
|
|
51
|
+
'USGS Imagery Only Base Map': nationalmap('USGSImageryOnly'),
|
|
52
|
+
'USGS Shaded Relief': nationalmap('USGSShadedReliefOnly'),
|
|
53
|
+
'USGS Topo Base Map': nationalmap('USGSTopo')
|
|
54
|
+
},
|
|
55
|
+
ArcGIS: {
|
|
56
|
+
'USA Topo Map': arcgis('USA_Topo_Maps'),
|
|
57
|
+
'National Geographic World Map': arcgis('NatGeo_World_Map'),
|
|
58
|
+
'World Imagery': arcgis('World_Imagery'),
|
|
59
|
+
'World Physicial Map': arcgis('World_Physical_Map'),
|
|
60
|
+
'World Shaded Relief': arcgis('World_Shaded_Relief'),
|
|
61
|
+
'World Street Map': arcgis('World_Street_Map'),
|
|
62
|
+
'World Terrain Base': arcgis('World_Terrain_Base'),
|
|
63
|
+
'World Topo Map': arcgis('World_Topo_Map')
|
|
64
|
+
}
|
|
65
|
+
// 'ArcGIS Vector': {
|
|
66
|
+
// 'Community Map', url: arcgisVector('World_Basemap_v2'),
|
|
67
|
+
// }
|
|
68
|
+
};
|
|
69
|
+
$: defaultServiceUrl = serviceOptions['mapbox v1']['streets-v11'];
|
|
70
|
+
export let serviceUrl = defaultServiceUrl;
|
|
71
|
+
$: getServiceUrl = (option) => {
|
|
72
|
+
const [selectedService, selectedTileset] = selected.split(':');
|
|
73
|
+
return serviceOptions[selectedService][selectedTileset];
|
|
74
|
+
};
|
|
75
|
+
let selected = 'mapbox v1:streets-v11';
|
|
76
|
+
$: serviceUrl = getServiceUrl(selected);
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<Field label="Tileset" let:id>
|
|
80
|
+
<select bind:value={selected} class="w-full outline-none appearance-none text-sm" {id}>
|
|
81
|
+
{#each Object.entries(serviceOptions) as [group, options]}
|
|
82
|
+
<optgroup label={group}>
|
|
83
|
+
{#each Object.keys(options) as option}
|
|
84
|
+
<option value="{group}:{option}">{option}</option>
|
|
85
|
+
{/each}
|
|
86
|
+
</optgroup>
|
|
87
|
+
{/each}
|
|
88
|
+
</select>
|
|
89
|
+
<div slot="append">
|
|
90
|
+
<div class="text-[10px] text-black/50 text-center">2x</div>
|
|
91
|
+
<Switch bind:checked={doubleScale} size="md" />
|
|
92
|
+
</div>
|
|
93
|
+
</Field>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
doubleScale?: boolean | undefined;
|
|
5
|
+
serviceUrl?: ((x: number, y: number, z: number) => string) | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type TilesetFieldProps = typeof __propDef.props;
|
|
13
|
+
export type TilesetFieldEvents = typeof __propDef.events;
|
|
14
|
+
export type TilesetFieldSlots = typeof __propDef.slots;
|
|
15
|
+
export default class TilesetField extends SvelteComponentTyped<TilesetFieldProps, TilesetFieldEvents, TilesetFieldSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script>import { Button, Tooltip } from 'svelte-ux';
|
|
2
|
+
import { cls } from 'svelte-ux/utils/styles';
|
|
3
|
+
import { mdiArrowULeftTop, mdiMagnifyPlusOutline, mdiMagnifyMinusOutline, mdiImageFilterCenterFocus } from '@mdi/js';
|
|
4
|
+
export let zoom;
|
|
5
|
+
export let placement = 'top-right';
|
|
6
|
+
export let orientation = 'vertical';
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div
|
|
10
|
+
class={cls(
|
|
11
|
+
'bg-black/5 rounded-full m-1 backdrop-blur z-10 flex',
|
|
12
|
+
orientation === 'vertical' && 'flex-col',
|
|
13
|
+
{
|
|
14
|
+
'top-left': 'absolute top-0 left-0',
|
|
15
|
+
top: 'absolute top-0 left-1/2 -translate-x-1/2',
|
|
16
|
+
'top-right': 'absolute top-0 right-0',
|
|
17
|
+
left: 'absolute top-1/2 left-0 -translate-y-1/2',
|
|
18
|
+
center: 'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2',
|
|
19
|
+
right: 'absolute top-1/2 right-0 -translate-y-1/2',
|
|
20
|
+
'bottom-left': 'absolute bottom-0 left-0',
|
|
21
|
+
bottom: 'absolute bottom-0 left-1/2 -translate-x-1/2',
|
|
22
|
+
'bottom-right': 'absolute bottom-0 right-0'
|
|
23
|
+
}[placement]
|
|
24
|
+
)}
|
|
25
|
+
>
|
|
26
|
+
<Tooltip title="Zoom in">
|
|
27
|
+
<Button
|
|
28
|
+
icon={mdiMagnifyPlusOutline}
|
|
29
|
+
on:click={() => zoom.increase()}
|
|
30
|
+
class="text-black/50 p-2"
|
|
31
|
+
/>
|
|
32
|
+
</Tooltip>
|
|
33
|
+
<Tooltip title="Zoom out">
|
|
34
|
+
<Button
|
|
35
|
+
icon={mdiMagnifyMinusOutline}
|
|
36
|
+
on:click={() => zoom.decrease()}
|
|
37
|
+
class="text-black/50 p-2"
|
|
38
|
+
/>
|
|
39
|
+
</Tooltip>
|
|
40
|
+
<Tooltip title="Center">
|
|
41
|
+
<Button
|
|
42
|
+
icon={mdiImageFilterCenterFocus}
|
|
43
|
+
on:click={() => zoom.translateCenter()}
|
|
44
|
+
class="text-black/50 p-2"
|
|
45
|
+
/>
|
|
46
|
+
</Tooltip>
|
|
47
|
+
<Tooltip title="Reset">
|
|
48
|
+
<Button icon={mdiArrowULeftTop} on:click={() => zoom.reset()} class="text-black/50 p-2" />
|
|
49
|
+
</Tooltip>
|
|
50
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type Zoom from '../components/Zoom.svelte';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
zoom: Zoom;
|
|
6
|
+
placement?: ("left" | "right" | "top" | "center" | "top-left" | "top-right" | "bottom-left" | "bottom" | "bottom-right") | undefined;
|
|
7
|
+
orientation?: "vertical" | "horizontal" | undefined;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export type ZoomControlsProps = typeof __propDef.props;
|
|
15
|
+
export type ZoomControlsEvents = typeof __propDef.events;
|
|
16
|
+
export type ZoomControlsSlots = typeof __propDef.slots;
|
|
17
|
+
export default class ZoomControls extends SvelteComponentTyped<ZoomControlsProps, ZoomControlsEvents, ZoomControlsSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isSVGElement, isSVGGraphicsElement, isSVGSVGElement, isTouchEvent } from 'svelte-ux
|
|
1
|
+
import { isSVGElement, isSVGGraphicsElement, isSVGSVGElement, isTouchEvent } from 'svelte-ux';
|
|
2
2
|
// See: https://github.com/airbnb/visx/blob/master/packages/visx-event/src/localPointGeneric.ts
|
|
3
3
|
// TODO: Matches event.layerX/Y, but are deprecated (https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/layerX).
|
|
4
4
|
// Similar and could be replaced by event.offsetX/Y (but not identical)
|
|
@@ -1,3 +1,3 @@
|
|
|
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):
|
|
3
|
-
export declare function getMinorTicks(start: Date, end: Date): import("d3-time").TimeInterval | null;
|
|
1
|
+
export declare function getMajorTicks(start: Date, end: Date): import("d3-time").TimeInterval | null | undefined;
|
|
2
|
+
export declare function formatMajorTick(date: Date, rangeStart: Date, rangeEnd: Date): any;
|
|
3
|
+
export declare function getMinorTicks(start: Date, end: Date): import("d3-time").TimeInterval | null | undefined;
|