layerchart 0.18.1 → 0.18.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/Tooltip.svelte +15 -5
- package/dist/components/Tooltip.svelte.d.ts +6 -0
- package/dist/components/TooltipItem.svelte +3 -1
- 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/package.json +3 -1
|
@@ -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>;
|
|
@@ -3,9 +3,10 @@ export let label;
|
|
|
3
3
|
export let value = undefined; // Can be pass as slot
|
|
4
4
|
export let format = undefined;
|
|
5
5
|
export let valueAlign = 'left';
|
|
6
|
+
export let classes = {};
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
|
-
<div class=
|
|
9
|
+
<div class={cls('text-xs text-white/75 text-right whitespace-nowrap', classes.label)}>
|
|
9
10
|
<slot name="label">{label}:</slot>
|
|
10
11
|
</div>
|
|
11
12
|
|
|
@@ -16,6 +17,7 @@ export let valueAlign = 'left';
|
|
|
16
17
|
'text-right': valueAlign === 'right',
|
|
17
18
|
'text-center': valueAlign === 'center'
|
|
18
19
|
},
|
|
20
|
+
classes.value,
|
|
19
21
|
$$props.class
|
|
20
22
|
)}
|
|
21
23
|
>
|
|
@@ -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 {};
|
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.18.
|
|
6
|
+
"version": "0.18.2",
|
|
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",
|