layerchart 0.18.1 → 0.19.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 -1
- package/dist/components/AreaStack.svelte.d.ts +4 -1
- package/dist/components/ChartClipPath.svelte.d.ts +1 -1
- package/dist/components/CircleClipPath.svelte +2 -7
- package/dist/components/CircleClipPath.svelte.d.ts +0 -4
- package/dist/components/ClipPath.svelte +13 -1
- package/dist/components/ClipPath.svelte.d.ts +10 -0
- package/dist/components/Path.svelte.d.ts +2 -2
- package/dist/components/Point.svelte +10 -0
- package/dist/components/Point.svelte.d.ts +21 -0
- package/dist/components/RectClipPath.svelte +2 -8
- package/dist/components/RectClipPath.svelte.d.ts +0 -4
- package/dist/components/Tooltip.svelte +15 -5
- package/dist/components/Tooltip.svelte.d.ts +6 -0
- package/dist/components/TooltipItem.svelte +5 -2
- package/dist/components/TooltipItem.svelte.d.ts +4 -0
- package/dist/components/TooltipSeparator.svelte +4 -1
- package/dist/components/TooltipSeparator.svelte.d.ts +6 -13
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/package.json +3 -1
- package/dist/components/ClipPathUse.svelte +0 -17
- package/dist/components/ClipPathUse.svelte.d.ts +0 -27
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { tweened as tweenedStore } from 'svelte/motion';
|
|
3
|
+
import { type Area } from 'd3-shape';
|
|
3
4
|
import type { CurveFactory } from 'd3-shape';
|
|
4
5
|
declare const __propDef: {
|
|
5
6
|
props: {
|
|
@@ -12,7 +13,7 @@ declare const __propDef: {
|
|
|
12
13
|
clipPath?: string | undefined;
|
|
13
14
|
tweened?: boolean | Parameters<typeof tweenedStore>[1];
|
|
14
15
|
curve?: CurveFactory | undefined;
|
|
15
|
-
defined?:
|
|
16
|
+
defined?: Parameters<Area<any>['defined']>[0] | undefined;
|
|
16
17
|
color?: string | undefined;
|
|
17
18
|
opacity?: number | undefined;
|
|
18
19
|
line?: boolean | any;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { type ComponentProps } from 'svelte';
|
|
3
|
+
import type { tweened as tweenedStore } from 'svelte/motion';
|
|
2
4
|
import type { CurveFactory } from 'd3-shape';
|
|
5
|
+
import Path from './Path.svelte';
|
|
3
6
|
declare const __propDef: {
|
|
4
7
|
props: {
|
|
5
8
|
curve?: CurveFactory | undefined;
|
|
6
|
-
defined?:
|
|
9
|
+
defined?: ComponentProps<Path>['defined'] | undefined;
|
|
7
10
|
opacity?: number | undefined;
|
|
8
11
|
line?: boolean | any;
|
|
9
12
|
tweened?: boolean | Parameters<typeof tweenedStore>[1];
|
|
@@ -11,11 +11,6 @@ export let tweened = undefined;
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<ClipPath {id}>
|
|
14
|
-
<Circle {cx} {cy} {r} {spring} {tweened} />
|
|
14
|
+
<Circle slot="clip" {cx} {cy} {r} {spring} {tweened} />
|
|
15
|
+
<slot {id} />
|
|
15
16
|
</ClipPath>
|
|
16
|
-
|
|
17
|
-
{#if $$slots.default}
|
|
18
|
-
<g style="clip-path: url(#{id})" on:click on:mousemove on:mouseleave>
|
|
19
|
-
<slot {id} />
|
|
20
|
-
</g>
|
|
21
|
-
{/if}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
<script>import { uniqueId } from 'svelte-ux';
|
|
2
2
|
/** Unique id for clipPath */
|
|
3
3
|
export let id = uniqueId('clipPath-');
|
|
4
|
+
/** Use existing path or shape (by id) for clipPath */
|
|
5
|
+
export let useId = undefined;
|
|
4
6
|
</script>
|
|
5
7
|
|
|
6
8
|
<defs>
|
|
7
9
|
<clipPath {id} {...$$restProps}>
|
|
8
|
-
<slot {id} />
|
|
10
|
+
<slot name="clip" {id} />
|
|
11
|
+
|
|
12
|
+
{#if useId}
|
|
13
|
+
<use href="#{useId}" />
|
|
14
|
+
{/if}
|
|
9
15
|
</clipPath>
|
|
10
16
|
</defs>
|
|
17
|
+
|
|
18
|
+
{#if $$slots.default}
|
|
19
|
+
<g style="clip-path: url(#{id})" on:click on:mousemove on:mouseleave on:keydown>
|
|
20
|
+
<slot {id} {useId} />
|
|
21
|
+
</g>
|
|
22
|
+
{/if}
|
|
@@ -3,13 +3,23 @@ declare const __propDef: {
|
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
id?: string | undefined;
|
|
6
|
+
useId?: string | undefined;
|
|
6
7
|
};
|
|
7
8
|
events: {
|
|
9
|
+
click: MouseEvent;
|
|
10
|
+
mousemove: MouseEvent;
|
|
11
|
+
mouseleave: MouseEvent;
|
|
12
|
+
keydown: KeyboardEvent;
|
|
13
|
+
} & {
|
|
8
14
|
[evt: string]: CustomEvent<any>;
|
|
9
15
|
};
|
|
10
16
|
slots: {
|
|
17
|
+
clip: {
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
11
20
|
default: {
|
|
12
21
|
id: string;
|
|
22
|
+
useId: string | undefined;
|
|
13
23
|
};
|
|
14
24
|
};
|
|
15
25
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { tweened as tweenedStore } from 'svelte/motion';
|
|
3
|
-
import type { CurveFactory, CurveFactoryLineOnly } from 'd3-shape';
|
|
3
|
+
import type { CurveFactory, CurveFactoryLineOnly, Line } from 'd3-shape';
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
[x: string]: any;
|
|
@@ -10,7 +10,7 @@ declare const __propDef: {
|
|
|
10
10
|
pathData?: string | undefined;
|
|
11
11
|
tweened?: boolean | Parameters<typeof tweenedStore>[1];
|
|
12
12
|
curve?: CurveFactory | CurveFactoryLineOnly | undefined;
|
|
13
|
-
defined?:
|
|
13
|
+
defined?: Parameters<Line<any>['defined']>[0] | undefined;
|
|
14
14
|
color?: string | undefined;
|
|
15
15
|
width?: undefined;
|
|
16
16
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
/** Single data point to translate to x/y */ d: any;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {
|
|
10
|
+
default: {
|
|
11
|
+
x: any;
|
|
12
|
+
y: any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type PointProps = typeof __propDef.props;
|
|
17
|
+
export type PointEvents = typeof __propDef.events;
|
|
18
|
+
export type PointSlots = typeof __propDef.slots;
|
|
19
|
+
export default class Point extends SvelteComponentTyped<PointProps, PointEvents, PointSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -12,12 +12,6 @@ export let tweened = undefined;
|
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<ClipPath {id}>
|
|
15
|
-
<Rect {x} {y} {width} {height} {spring} {tweened} />
|
|
15
|
+
<Rect slot="clip" {x} {y} {width} {height} {spring} {tweened} />
|
|
16
|
+
<slot {id} />
|
|
16
17
|
</ClipPath>
|
|
17
|
-
|
|
18
|
-
{#if $$slots.default}
|
|
19
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
20
|
-
<g style="clip-path: url(#{id})" on:click on:mousemove on:mouseleave>
|
|
21
|
-
<slot {id} />
|
|
22
|
-
</g>
|
|
23
|
-
{/if}
|
|
@@ -9,6 +9,7 @@ export let leftOffset = 10;
|
|
|
9
9
|
export let contained = 'container'; // TODO: Support 'window' using getBoundingClientRect()
|
|
10
10
|
export let animate = true;
|
|
11
11
|
export let header = undefined;
|
|
12
|
+
export let classes = {};
|
|
12
13
|
const { containerWidth, containerHeight } = getContext('LayerCake');
|
|
13
14
|
const tooltip = tooltipContext();
|
|
14
15
|
let tooltipWidth = 0;
|
|
@@ -37,7 +38,7 @@ $: if ($tooltip) {
|
|
|
37
38
|
|
|
38
39
|
{#if $tooltip.data}
|
|
39
40
|
<div
|
|
40
|
-
class={cls('absolute pointer-events-none z-50',
|
|
41
|
+
class={cls('absolute pointer-events-none z-50', classes.root)}
|
|
41
42
|
style:top="{$top}px"
|
|
42
43
|
style:left="{$left}px"
|
|
43
44
|
transition:fade={{ duration: 100 }}
|
|
@@ -45,18 +46,27 @@ $: if ($tooltip) {
|
|
|
45
46
|
bind:clientHeight={tooltipHeight}
|
|
46
47
|
>
|
|
47
48
|
<div
|
|
48
|
-
class=
|
|
49
|
+
class={cls(
|
|
50
|
+
'bg-gray-900/90 backdrop-filter backdrop-blur-[2px] text-white rounded elevation-1 px-2 py-1 h-full',
|
|
51
|
+
classes.container,
|
|
52
|
+
$$props.class
|
|
53
|
+
)}
|
|
49
54
|
>
|
|
50
55
|
{#if header || $$slots.header}
|
|
51
|
-
<div class=
|
|
56
|
+
<div class={cls('text-center font-semibold whitespace-nowrap', classes.header)}>
|
|
52
57
|
<slot name="header" data={$tooltip.data}>
|
|
53
|
-
{header($tooltip.data)}
|
|
58
|
+
{header?.($tooltip.data)}
|
|
54
59
|
</slot>
|
|
55
60
|
</div>
|
|
56
61
|
{/if}
|
|
57
62
|
|
|
58
63
|
{#if $$slots.default}
|
|
59
|
-
<div
|
|
64
|
+
<div
|
|
65
|
+
class={cls(
|
|
66
|
+
'grid grid-cols-[1fr,auto] gap-x-2 gap-y-1 items-center pt-1',
|
|
67
|
+
classes.content
|
|
68
|
+
)}
|
|
69
|
+
>
|
|
60
70
|
<slot data={$tooltip.data} />
|
|
61
71
|
</div>
|
|
62
72
|
{/if}
|
|
@@ -7,6 +7,12 @@ declare const __propDef: {
|
|
|
7
7
|
contained?: false | "container" | undefined;
|
|
8
8
|
animate?: boolean | undefined;
|
|
9
9
|
header?: ((data: any) => any) | undefined;
|
|
10
|
+
classes?: {
|
|
11
|
+
root?: string | undefined;
|
|
12
|
+
container?: string | undefined;
|
|
13
|
+
header?: string | undefined;
|
|
14
|
+
content?: string | undefined;
|
|
15
|
+
} | undefined;
|
|
10
16
|
};
|
|
11
17
|
events: {
|
|
12
18
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<script>import { cls, format as formatUtil } from 'svelte-ux';
|
|
2
2
|
export let label;
|
|
3
|
-
|
|
3
|
+
/** Value to be formatted and displayed. Can also be passed as default slot */
|
|
4
|
+
export let value = undefined;
|
|
4
5
|
export let format = undefined;
|
|
5
6
|
export let valueAlign = 'left';
|
|
7
|
+
export let classes = {};
|
|
6
8
|
</script>
|
|
7
9
|
|
|
8
|
-
<div class=
|
|
10
|
+
<div class={cls('text-xs text-white/75 text-right whitespace-nowrap', classes.label)}>
|
|
9
11
|
<slot name="label">{label}:</slot>
|
|
10
12
|
</div>
|
|
11
13
|
|
|
@@ -16,6 +18,7 @@ export let valueAlign = 'left';
|
|
|
16
18
|
'text-right': valueAlign === 'right',
|
|
17
19
|
'text-center': valueAlign === 'center'
|
|
18
20
|
},
|
|
21
|
+
classes.value,
|
|
19
22
|
$$props.class
|
|
20
23
|
)}
|
|
21
24
|
>
|
|
@@ -7,6 +7,10 @@ declare const __propDef: {
|
|
|
7
7
|
value?: any;
|
|
8
8
|
format?: FormatType;
|
|
9
9
|
valueAlign?: "left" | "right" | "center" | undefined;
|
|
10
|
+
classes?: {
|
|
11
|
+
label?: string | undefined;
|
|
12
|
+
value?: string | undefined;
|
|
13
|
+
} | undefined;
|
|
10
14
|
};
|
|
11
15
|
events: {
|
|
12
16
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} TooltipSeparatorProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} TooltipSeparatorEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} TooltipSeparatorSlots */
|
|
4
|
-
export default class TooltipSeparator extends SvelteComponentTyped<{
|
|
5
|
-
[x: string]: never;
|
|
6
|
-
}, {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {}> {
|
|
9
|
-
}
|
|
10
|
-
export type TooltipSeparatorProps = typeof __propDef.props;
|
|
11
|
-
export type TooltipSeparatorEvents = typeof __propDef.events;
|
|
12
|
-
export type TooltipSeparatorSlots = typeof __propDef.slots;
|
|
13
1
|
import { SvelteComponentTyped } from "svelte";
|
|
14
2
|
declare const __propDef: {
|
|
15
3
|
props: {
|
|
16
|
-
[x: string]:
|
|
4
|
+
[x: string]: any;
|
|
17
5
|
};
|
|
18
6
|
events: {
|
|
19
7
|
[evt: string]: CustomEvent<any>;
|
|
20
8
|
};
|
|
21
9
|
slots: {};
|
|
22
10
|
};
|
|
11
|
+
export type TooltipSeparatorProps = typeof __propDef.props;
|
|
12
|
+
export type TooltipSeparatorEvents = typeof __propDef.events;
|
|
13
|
+
export type TooltipSeparatorSlots = typeof __propDef.slots;
|
|
14
|
+
export default class TooltipSeparator extends SvelteComponentTyped<TooltipSeparatorProps, TooltipSeparatorEvents, TooltipSeparatorSlots> {
|
|
15
|
+
}
|
|
23
16
|
export {};
|
|
@@ -10,7 +10,6 @@ export { default as ChartClipPath } from './ChartClipPath.svelte';
|
|
|
10
10
|
export { default as Circle } from './Circle.svelte';
|
|
11
11
|
export { default as CircleClipPath } from './CircleClipPath.svelte';
|
|
12
12
|
export { default as ClipPath } from './ClipPath.svelte';
|
|
13
|
-
export { default as ClipPathUse } from './ClipPathUse.svelte';
|
|
14
13
|
export { default as ColorRamp } from './ColorRamp.svelte';
|
|
15
14
|
export { default as ConnectedPoints } from './ConnectedPoints.svelte';
|
|
16
15
|
export { default as Frame } from './Frame.svelte';
|
|
@@ -32,6 +31,7 @@ export { default as Partition } from './Partition.svelte';
|
|
|
32
31
|
export { default as Path } from './Path.svelte';
|
|
33
32
|
export { default as Pattern } from './Pattern.svelte';
|
|
34
33
|
export { default as Pie } from './Pie.svelte';
|
|
34
|
+
export { default as Point } from './Point.svelte';
|
|
35
35
|
export { default as Points } from './Points.svelte';
|
|
36
36
|
export { default as Rect } from './Rect.svelte';
|
|
37
37
|
export { default as RectClipPath } from './RectClipPath.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -10,7 +10,6 @@ export { default as ChartClipPath } from './ChartClipPath.svelte';
|
|
|
10
10
|
export { default as Circle } from './Circle.svelte';
|
|
11
11
|
export { default as CircleClipPath } from './CircleClipPath.svelte';
|
|
12
12
|
export { default as ClipPath } from './ClipPath.svelte';
|
|
13
|
-
export { default as ClipPathUse } from './ClipPathUse.svelte';
|
|
14
13
|
export { default as ColorRamp } from './ColorRamp.svelte';
|
|
15
14
|
export { default as ConnectedPoints } from './ConnectedPoints.svelte';
|
|
16
15
|
export { default as Frame } from './Frame.svelte';
|
|
@@ -32,6 +31,7 @@ export { default as Partition } from './Partition.svelte';
|
|
|
32
31
|
export { default as Path } from './Path.svelte';
|
|
33
32
|
export { default as Pattern } from './Pattern.svelte';
|
|
34
33
|
export { default as Pie } from './Pie.svelte';
|
|
34
|
+
export { default as Point } from './Point.svelte';
|
|
35
35
|
export { default as Points } from './Points.svelte';
|
|
36
36
|
export { default as Rect } from './Rect.svelte';
|
|
37
37
|
export { default as RectClipPath } from './RectClipPath.svelte';
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "techniq/layerchart",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.19.0",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "vite dev",
|
|
9
9
|
"build": "vite build",
|
|
@@ -36,9 +36,11 @@
|
|
|
36
36
|
"@types/d3-scale": "^4.0.3",
|
|
37
37
|
"@types/d3-shape": "^3.1.1",
|
|
38
38
|
"@types/lodash-es": "^4.17.7",
|
|
39
|
+
"@types/marked": "^5.0.0",
|
|
39
40
|
"@types/shapefile": "^0.6.1",
|
|
40
41
|
"@types/topojson-client": "^3.1.1",
|
|
41
42
|
"autoprefixer": "^10.4.14",
|
|
43
|
+
"marked": "^5.1.0",
|
|
42
44
|
"mdsvex": "^0.11.0",
|
|
43
45
|
"prettier": "^2.8.8",
|
|
44
46
|
"prettier-plugin-svelte": "^2.10.1",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script>import { uniqueId } from 'svelte-ux';
|
|
2
|
-
import ClipPath from './ClipPath.svelte';
|
|
3
|
-
/** Id of path or shape */
|
|
4
|
-
export let refId;
|
|
5
|
-
/** Unique id for clipPath */
|
|
6
|
-
export let clipPathId = uniqueId('clipPath-');
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<ClipPath id={clipPathId}>
|
|
10
|
-
<use href="#{refId}" />
|
|
11
|
-
</ClipPath>
|
|
12
|
-
|
|
13
|
-
{#if $$slots.default}
|
|
14
|
-
<g style="clip-path: url(#{clipPathId})" on:click on:mousemove on:mouseleave on:keydown>
|
|
15
|
-
<slot {refId} {clipPathId} />
|
|
16
|
-
</g>
|
|
17
|
-
{/if}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
/** Id of path or shape */ refId: string;
|
|
5
|
-
/** Unique id for clipPath */ clipPathId?: string | undefined;
|
|
6
|
-
};
|
|
7
|
-
events: {
|
|
8
|
-
click: MouseEvent;
|
|
9
|
-
mousemove: MouseEvent;
|
|
10
|
-
mouseleave: MouseEvent;
|
|
11
|
-
keydown: KeyboardEvent;
|
|
12
|
-
} & {
|
|
13
|
-
[evt: string]: CustomEvent<any>;
|
|
14
|
-
};
|
|
15
|
-
slots: {
|
|
16
|
-
default: {
|
|
17
|
-
refId: string;
|
|
18
|
-
clipPathId: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export type ClipPathUseProps = typeof __propDef.props;
|
|
23
|
-
export type ClipPathUseEvents = typeof __propDef.events;
|
|
24
|
-
export type ClipPathUseSlots = typeof __propDef.slots;
|
|
25
|
-
export default class ClipPathUse extends SvelteComponentTyped<ClipPathUseProps, ClipPathUseEvents, ClipPathUseSlots> {
|
|
26
|
-
}
|
|
27
|
-
export {};
|