layerchart 0.7.5 → 0.8.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/Area.svelte +1 -1
- package/components/Chart.svelte +17 -2
- package/components/Chart.svelte.d.ts +8 -1
- package/components/Labels.svelte +2 -2
- package/components/Legend.svelte +18 -0
- package/components/Legend.svelte.d.ts +22 -0
- package/components/Path.svelte +1 -1
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/docs/Layout.svelte +9 -8
- package/docs/Layout.svelte.d.ts +6 -4
- package/package.json +3 -2
package/components/Area.svelte
CHANGED
package/components/Chart.svelte
CHANGED
|
@@ -52,6 +52,21 @@ $: if (yBaseline != null) {
|
|
|
52
52
|
$: yReverse = yScale ? !isScaleBand(yScale) : true;
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
|
-
<LayerCake
|
|
56
|
-
|
|
55
|
+
<LayerCake
|
|
56
|
+
{data}
|
|
57
|
+
{x}
|
|
58
|
+
{xDomain}
|
|
59
|
+
{y}
|
|
60
|
+
{yScale}
|
|
61
|
+
{yDomain}
|
|
62
|
+
{yReverse}
|
|
63
|
+
{...$$restProps}
|
|
64
|
+
let:aspectRatio
|
|
65
|
+
let:containerHeight
|
|
66
|
+
let:containerWidth
|
|
67
|
+
let:height
|
|
68
|
+
let:width
|
|
69
|
+
let:element
|
|
70
|
+
>
|
|
71
|
+
<slot {aspectRatio} {containerHeight} {containerWidth} {height} {width} {element} />
|
|
57
72
|
</LayerCake>
|
|
@@ -15,7 +15,14 @@ declare const __propDef: {
|
|
|
15
15
|
[evt: string]: CustomEvent<any>;
|
|
16
16
|
};
|
|
17
17
|
slots: {
|
|
18
|
-
default: {
|
|
18
|
+
default: {
|
|
19
|
+
aspectRatio: number;
|
|
20
|
+
containerHeight: number;
|
|
21
|
+
containerWidth: number;
|
|
22
|
+
height: number;
|
|
23
|
+
width: number;
|
|
24
|
+
element: Element;
|
|
25
|
+
};
|
|
19
26
|
};
|
|
20
27
|
};
|
|
21
28
|
export declare type ChartProps = typeof __propDef.props;
|
package/components/Labels.svelte
CHANGED
|
@@ -10,7 +10,7 @@ import Text from './Text.svelte';
|
|
|
10
10
|
import { formatNumberAsStyle } from 'svelte-ux/utils/number';
|
|
11
11
|
import { isScaleBand } from '../utils/scales';
|
|
12
12
|
import { greatestAbs, unique } from 'svelte-ux/utils/array';
|
|
13
|
-
const {
|
|
13
|
+
const { flatData, xGet, yRange, xScale, yScale, x, y, custom } = getContext('LayerCake');
|
|
14
14
|
export let orientation = 'auto';
|
|
15
15
|
export let significantDigits = 3;
|
|
16
16
|
export let formatStyle = null;
|
|
@@ -82,7 +82,7 @@ $: getValue = (item) => {
|
|
|
82
82
|
</script>
|
|
83
83
|
|
|
84
84
|
<g class="label-group">
|
|
85
|
-
{#each $
|
|
85
|
+
{#each $flatData as item, index}
|
|
86
86
|
<Text
|
|
87
87
|
class="group-rect"
|
|
88
88
|
textAnchor="middle"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
const { rScale } = getContext('LayerCake');
|
|
3
|
+
const domain = $rScale.domain();
|
|
4
|
+
const range = $rScale.range();
|
|
5
|
+
// zip values together
|
|
6
|
+
export let items = domain.map((d, i) => ({ label: d, color: range[i] }));
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<slot {items} scale={$rScale}>
|
|
10
|
+
<div {...$$restProps}>
|
|
11
|
+
{#each items as { label, color }}
|
|
12
|
+
<div class="flex items-center gap-1">
|
|
13
|
+
<div class="h-4 w-4 rounded-full" style:background-color={color} />
|
|
14
|
+
{label}
|
|
15
|
+
</div>
|
|
16
|
+
{/each}
|
|
17
|
+
</div>
|
|
18
|
+
</slot>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
items?: any;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {
|
|
11
|
+
default: {
|
|
12
|
+
items: any;
|
|
13
|
+
scale: any;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare type LegendProps = typeof __propDef.props;
|
|
18
|
+
export declare type LegendEvents = typeof __propDef.events;
|
|
19
|
+
export declare type LegendSlots = typeof __propDef.slots;
|
|
20
|
+
export default class Legend extends SvelteComponentTyped<LegendProps, LegendEvents, LegendSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
package/components/Path.svelte
CHANGED
|
@@ -7,7 +7,7 @@ import { line as d3Line } from 'd3-shape';
|
|
|
7
7
|
// import { interpolateString } from 'd3-interpolate';
|
|
8
8
|
import { interpolatePath } from 'd3-interpolate-path';
|
|
9
9
|
import { motionStore } from '../stores/motionStore';
|
|
10
|
-
const { data: contextData, xGet, yGet
|
|
10
|
+
const { data: contextData, xGet, yGet } = getContext('LayerCake');
|
|
11
11
|
// Properties to override what is used from context
|
|
12
12
|
export let data = undefined; // TODO: Update Type
|
|
13
13
|
export let x = undefined; // TODO: Update Type
|
package/components/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { default as Group } from './Group.svelte';
|
|
|
16
16
|
export { default as HighlightLine } from './HighlightLine.svelte';
|
|
17
17
|
export { default as HighlightRect } from './HighlightRect.svelte';
|
|
18
18
|
export { default as Labels } from './Labels.svelte';
|
|
19
|
+
export { default as Legend } from './Legend.svelte';
|
|
19
20
|
export { default as Line } from './Line.svelte';
|
|
20
21
|
export { default as LinearGradient } from './LinearGradient.svelte';
|
|
21
22
|
export { default as Link } from './Link.svelte';
|
package/components/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { default as Group } from './Group.svelte';
|
|
|
16
16
|
export { default as HighlightLine } from './HighlightLine.svelte';
|
|
17
17
|
export { default as HighlightRect } from './HighlightRect.svelte';
|
|
18
18
|
export { default as Labels } from './Labels.svelte';
|
|
19
|
+
export { default as Legend } from './Legend.svelte';
|
|
19
20
|
export { default as Line } from './Line.svelte';
|
|
20
21
|
export { default as LinearGradient } from './LinearGradient.svelte';
|
|
21
22
|
export { default as Link } from './Link.svelte';
|
package/docs/Layout.svelte
CHANGED
|
@@ -13,31 +13,32 @@
|
|
|
13
13
|
|
|
14
14
|
<script>
|
|
15
15
|
// frontmatter: https://mdsvex.com/docs#frontmatter-1
|
|
16
|
-
export let
|
|
17
|
-
export let
|
|
16
|
+
export let name;
|
|
17
|
+
export let sourceUrl;
|
|
18
|
+
export let docUrl;
|
|
18
19
|
export let description;
|
|
19
20
|
</script>
|
|
20
21
|
|
|
21
|
-
{#if
|
|
22
|
+
{#if name}
|
|
22
23
|
<div class="flex items-center gap-2">
|
|
23
|
-
<span class="text-2xl font-bold">{
|
|
24
|
-
{#if
|
|
24
|
+
<span class="text-2xl font-bold">{name}</span>
|
|
25
|
+
{#if sourceUrl}
|
|
25
26
|
<Tooltip title="View source">
|
|
26
27
|
<Button
|
|
27
28
|
class="text-black/50"
|
|
28
29
|
icon={mdiCodeTags}
|
|
29
|
-
href="https://github.com/techniq/layerchart/blob/master/
|
|
30
|
+
href="https://github.com/techniq/layerchart/blob/master/{sourceUrl}"
|
|
30
31
|
target="_blank"
|
|
31
32
|
/>
|
|
32
33
|
</Tooltip>
|
|
33
34
|
{/if}
|
|
34
35
|
|
|
35
|
-
{#if
|
|
36
|
+
{#if docUrl}
|
|
36
37
|
<Tooltip title="Edit this page">
|
|
37
38
|
<Button
|
|
38
39
|
class="text-black/50"
|
|
39
40
|
icon={mdiFileDocumentEditOutline}
|
|
40
|
-
href="https://github.com/techniq/layerchart/blob/master/{
|
|
41
|
+
href="https://github.com/techniq/layerchart/blob/master/{docUrl}"
|
|
41
42
|
target="_blank"
|
|
42
43
|
/>
|
|
43
44
|
</Tooltip>
|
package/docs/Layout.svelte.d.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} LayoutEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} LayoutSlots */
|
|
4
4
|
export default class Layout extends SvelteComponentTyped<{
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
name: any;
|
|
6
|
+
sourceUrl: any;
|
|
7
|
+
docUrl: any;
|
|
7
8
|
description: any;
|
|
8
9
|
}, {
|
|
9
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -21,8 +22,9 @@ import h1 from "./Header1.svelte";
|
|
|
21
22
|
import { SvelteComponentTyped } from "svelte";
|
|
22
23
|
declare const __propDef: {
|
|
23
24
|
props: {
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
name: any;
|
|
26
|
+
sourceUrl: any;
|
|
27
|
+
docUrl: any;
|
|
26
28
|
description: any;
|
|
27
29
|
};
|
|
28
30
|
events: {
|
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.8.0",
|
|
7
7
|
"devDependencies": {
|
|
8
8
|
"@rollup/plugin-dsv": "^2.0.3",
|
|
9
9
|
"@sveltejs/adapter-vercel": "^1.0.0-next.59",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"date-fns": "^2.28.0",
|
|
50
50
|
"layercake": "^6.1.0",
|
|
51
51
|
"lodash-es": "^4.17.21",
|
|
52
|
-
"svelte-ux": "^0.
|
|
52
|
+
"svelte-ux": "^0.7.0"
|
|
53
53
|
},
|
|
54
54
|
"exports": {
|
|
55
55
|
"./package.json": "./package.json",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"./components/HighlightLine.svelte": "./components/HighlightLine.svelte",
|
|
72
72
|
"./components/HighlightRect.svelte": "./components/HighlightRect.svelte",
|
|
73
73
|
"./components/Labels.svelte": "./components/Labels.svelte",
|
|
74
|
+
"./components/Legend.svelte": "./components/Legend.svelte",
|
|
74
75
|
"./components/Line.svelte": "./components/Line.svelte",
|
|
75
76
|
"./components/LinearGradient.svelte": "./components/LinearGradient.svelte",
|
|
76
77
|
"./components/Link.svelte": "./components/Link.svelte",
|