layerchart 0.22.1 → 0.23.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 +43 -0
- package/dist/components/Blur.svelte +1 -1
- package/dist/components/Blur.svelte.d.ts +1 -0
- package/dist/components/Calendar.svelte +68 -0
- package/dist/components/Calendar.svelte.d.ts +37 -0
- package/dist/components/Chart.svelte +7 -1
- package/dist/components/Chart.svelte.d.ts +2 -0
- package/dist/components/CircleClipPath.svelte +2 -2
- package/dist/components/CircleClipPath.svelte.d.ts +1 -0
- package/dist/components/ClipPath.svelte +1 -1
- package/dist/components/ClipPath.svelte.d.ts +1 -0
- package/dist/components/Highlight.svelte +1 -1
- package/dist/components/Highlight.svelte.d.ts +74 -0
- package/dist/components/LinearGradient.svelte +1 -1
- package/dist/components/LinearGradient.svelte.d.ts +1 -0
- package/dist/components/MonthPath.svelte +25 -0
- package/dist/components/MonthPath.svelte.d.ts +18 -0
- package/dist/components/Points.svelte.d.ts +35 -0
- package/dist/components/Rect.svelte.d.ts +37 -0
- package/dist/components/RectClipPath.svelte +2 -2
- package/dist/components/RectClipPath.svelte.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/stores/motionStore.d.ts +1 -0
- package/dist/utils/path.d.ts +7 -0
- package/dist/utils/path.js +10 -0
- package/dist/utils/pivot.d.ts +1 -1
- package/dist/utils/rect.d.ts +1 -0
- package/dist/utils/scales.d.ts +4 -3
- package/package.json +31 -27
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { tweened as tweenedStore } from 'svelte/motion';
|
|
3
|
+
import { type Area } from 'd3-shape';
|
|
4
|
+
import type { CurveFactory } from 'd3-shape';
|
|
5
|
+
declare const __propDef: {
|
|
6
|
+
props: {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
data?: any;
|
|
9
|
+
pathData?: string | undefined | null;
|
|
10
|
+
x?: any;
|
|
11
|
+
y0?: any;
|
|
12
|
+
y1?: any;
|
|
13
|
+
tweened?: boolean | Parameters<typeof tweenedStore>[1];
|
|
14
|
+
clipPath?: string | undefined;
|
|
15
|
+
curve?: CurveFactory | undefined;
|
|
16
|
+
defined?: Parameters<Area<any>['defined']>[0] | undefined;
|
|
17
|
+
line?: boolean | {
|
|
18
|
+
[x: string]: any;
|
|
19
|
+
data?: any;
|
|
20
|
+
pathData?: string | null | undefined;
|
|
21
|
+
x?: any;
|
|
22
|
+
y?: any;
|
|
23
|
+
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
24
|
+
draw?: boolean | import("svelte/transition").DrawParams | undefined;
|
|
25
|
+
curve?: CurveFactory | import("d3-shape").CurveFactoryLineOnly | undefined;
|
|
26
|
+
defined?: ((d: any, index: number, data: any[]) => boolean) | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
};
|
|
29
|
+
events: {
|
|
30
|
+
click: MouseEvent;
|
|
31
|
+
mousemove: MouseEvent;
|
|
32
|
+
mouseleave: MouseEvent;
|
|
33
|
+
} & {
|
|
34
|
+
[evt: string]: CustomEvent<any>;
|
|
35
|
+
};
|
|
36
|
+
slots: {};
|
|
37
|
+
};
|
|
38
|
+
export type AreaProps = typeof __propDef.props;
|
|
39
|
+
export type AreaEvents = typeof __propDef.events;
|
|
40
|
+
export type AreaSlots = typeof __propDef.slots;
|
|
41
|
+
export default class Area extends SvelteComponentTyped<AreaProps, AreaEvents, AreaSlots> {
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import { timeDays, timeMonths, timeWeek, timeYear } from 'd3-time';
|
|
3
|
+
import Rect from './Rect.svelte';
|
|
4
|
+
import MonthPath from './MonthPath.svelte';
|
|
5
|
+
import { index } from 'd3-array';
|
|
6
|
+
export let start;
|
|
7
|
+
export let end;
|
|
8
|
+
/**
|
|
9
|
+
* Size of cell. If `number`, sets width/height as same value (square). If array, sets as [width,height]. If undefined, is derived from Chart width/height
|
|
10
|
+
*/
|
|
11
|
+
export let cellSize = undefined;
|
|
12
|
+
/** Enable drawing path around each month. If object, pass as props to underlying <path> */
|
|
13
|
+
export let monthPath = false;
|
|
14
|
+
/**
|
|
15
|
+
* Tooltip context to setup mouse events to show tooltip for related data
|
|
16
|
+
*/
|
|
17
|
+
export let tooltip = undefined;
|
|
18
|
+
const { width, height, x, rGet, data, config } = getContext('LayerCake');
|
|
19
|
+
$: yearDays = timeDays(start, end);
|
|
20
|
+
$: yearMonths = timeMonths(start, end);
|
|
21
|
+
$: yearWeeks = timeWeek.count(start, end);
|
|
22
|
+
$: chartCellWidth = $width / (yearWeeks + 1);
|
|
23
|
+
$: chartCellHeight = $height / 7;
|
|
24
|
+
$: chartCellSize = Math.min(chartCellWidth, chartCellHeight); // Use smallest to fit, and keep square aspect
|
|
25
|
+
$: [cellWidth, cellHeight] = Array.isArray(cellSize)
|
|
26
|
+
? cellSize
|
|
27
|
+
: typeof cellSize === 'number'
|
|
28
|
+
? [cellSize, cellSize]
|
|
29
|
+
: [chartCellSize, chartCellSize];
|
|
30
|
+
$: dataByDate = data && $config.x ? index($data, (d) => $x(d)) : new Map();
|
|
31
|
+
$: cells = yearDays.map((date) => {
|
|
32
|
+
const cellData = dataByDate.get(date) ?? { date };
|
|
33
|
+
return {
|
|
34
|
+
x: timeWeek.count(timeYear(date), date) * cellWidth,
|
|
35
|
+
y: date.getDay() * cellHeight,
|
|
36
|
+
width: cellWidth,
|
|
37
|
+
height: cellHeight,
|
|
38
|
+
color: $config.r ? $rGet(cellData) : 'transparent',
|
|
39
|
+
data: cellData,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<slot {cells}>
|
|
45
|
+
{#each cells as cell}
|
|
46
|
+
<Rect
|
|
47
|
+
x={cell.x}
|
|
48
|
+
y={cell.y}
|
|
49
|
+
width={cell.width}
|
|
50
|
+
height={cell.height}
|
|
51
|
+
fill={cell.color}
|
|
52
|
+
on:mousemove={(e) => tooltip?.show(e, cell.data)}
|
|
53
|
+
on:mouseleave={(e) => tooltip?.hide()}
|
|
54
|
+
class="stroke-black/5"
|
|
55
|
+
{...$$restProps}
|
|
56
|
+
/>
|
|
57
|
+
{/each}
|
|
58
|
+
</slot>
|
|
59
|
+
|
|
60
|
+
{#if monthPath}
|
|
61
|
+
{#each yearMonths as date}
|
|
62
|
+
<MonthPath
|
|
63
|
+
{date}
|
|
64
|
+
cellSize={[cellWidth, cellHeight]}
|
|
65
|
+
{...typeof monthPath === 'object' ? monthPath : null}
|
|
66
|
+
/>
|
|
67
|
+
{/each}
|
|
68
|
+
{/if}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { TooltipContextValue } from './TooltipContext.svelte';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
start: Date;
|
|
7
|
+
end: Date;
|
|
8
|
+
cellSize?: number | [number, number] | undefined;
|
|
9
|
+
monthPath?: boolean | {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
date: Date;
|
|
12
|
+
cellSize: number | [number, number];
|
|
13
|
+
} | undefined;
|
|
14
|
+
tooltip?: TooltipContextValue | undefined;
|
|
15
|
+
};
|
|
16
|
+
events: {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
};
|
|
19
|
+
slots: {
|
|
20
|
+
default: {
|
|
21
|
+
cells: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
color: any;
|
|
27
|
+
data: any;
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export type CalendarProps = typeof __propDef.props;
|
|
33
|
+
export type CalendarEvents = typeof __propDef.events;
|
|
34
|
+
export type CalendarSlots = typeof __propDef.slots;
|
|
35
|
+
export default class Calendar extends SvelteComponentTyped<CalendarProps, CalendarEvents, CalendarSlots> {
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// export { Svg, Html };
|
|
3
3
|
// TODO: Workaround for sveld error: `Cannot read properties of null (reading 'type')` in `ComponentParser`
|
|
4
4
|
// See: https://github.com/carbon-design-system/sveld/issues/104
|
|
5
|
-
import { LayerCake, Svg as _Svg, Html as _Html, Canvas as _Canvas, WebGL as _WebGL } from 'layercake';
|
|
5
|
+
import { LayerCake, Svg as _Svg, Html as _Html, Canvas as _Canvas, WebGL as _WebGL, } from 'layercake';
|
|
6
6
|
export const Svg = _Svg;
|
|
7
7
|
export const Html = _Html;
|
|
8
8
|
export const Canvas = _Canvas;
|
|
@@ -80,6 +80,8 @@ export let geo = undefined;
|
|
|
80
80
|
let:element
|
|
81
81
|
let:xScale
|
|
82
82
|
let:yScale
|
|
83
|
+
let:zScale
|
|
84
|
+
let:rScale
|
|
83
85
|
>
|
|
84
86
|
<GeoContext {...geo} let:projection>
|
|
85
87
|
{#if tooltip}
|
|
@@ -95,6 +97,8 @@ export let geo = undefined;
|
|
|
95
97
|
{tooltip}
|
|
96
98
|
{xScale}
|
|
97
99
|
{yScale}
|
|
100
|
+
{zScale}
|
|
101
|
+
{rScale}
|
|
98
102
|
/>
|
|
99
103
|
</TooltipContext>
|
|
100
104
|
{:else}
|
|
@@ -108,6 +112,8 @@ export let geo = undefined;
|
|
|
108
112
|
{projection}
|
|
109
113
|
{xScale}
|
|
110
114
|
{yScale}
|
|
115
|
+
{zScale}
|
|
116
|
+
{rScale}
|
|
111
117
|
/>
|
|
112
118
|
{/if}
|
|
113
119
|
</GeoContext>
|
|
@@ -164,7 +164,7 @@ $: if ($tooltip.data) {
|
|
|
164
164
|
spring
|
|
165
165
|
{..._area}
|
|
166
166
|
{...typeof area === 'object' ? area : null}
|
|
167
|
-
class={cls(!area.fill && 'fill-black/
|
|
167
|
+
class={cls(!area.fill && 'fill-black/5', typeof area === 'object' ? area.class : null)}
|
|
168
168
|
on:click
|
|
169
169
|
/>
|
|
170
170
|
</slot>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
axis?: 'x' | 'y' | 'both' | 'none' | undefined;
|
|
5
|
+
/** Show points and pass props to Circles */ points?: boolean | {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
cx?: number | undefined;
|
|
8
|
+
initialCx?: number | undefined;
|
|
9
|
+
cy?: number | undefined;
|
|
10
|
+
initialCy?: number | undefined;
|
|
11
|
+
r: number;
|
|
12
|
+
initialR?: number | undefined;
|
|
13
|
+
spring?: boolean | import("svelte/motion").SpringOpts | undefined;
|
|
14
|
+
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
/** Show lines and pass props to Lines */ lines?: boolean | {
|
|
17
|
+
[x: string]: any;
|
|
18
|
+
x1: number;
|
|
19
|
+
initialX1?: number | undefined;
|
|
20
|
+
y1: number;
|
|
21
|
+
initialY1?: number | undefined;
|
|
22
|
+
x2: number;
|
|
23
|
+
initialX2?: number | undefined;
|
|
24
|
+
y2: number;
|
|
25
|
+
initialY2?: number | undefined;
|
|
26
|
+
spring?: boolean | import("svelte/motion").SpringOpts | undefined;
|
|
27
|
+
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
/** Show area and pass props to Rect */ area?: boolean | {
|
|
30
|
+
[x: string]: any;
|
|
31
|
+
x?: number | undefined;
|
|
32
|
+
initialX?: number | undefined;
|
|
33
|
+
y?: number | undefined;
|
|
34
|
+
initialY?: number | undefined;
|
|
35
|
+
width: number;
|
|
36
|
+
initialWidth?: number | undefined;
|
|
37
|
+
height: number;
|
|
38
|
+
initialHeight?: number | undefined;
|
|
39
|
+
spring?: boolean | import("svelte/motion").SpringOpts | {
|
|
40
|
+
[prop: string]: import("svelte/motion").SpringOpts | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | {
|
|
43
|
+
[prop: string]: import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
};
|
|
47
|
+
events: {
|
|
48
|
+
click: MouseEvent;
|
|
49
|
+
} & {
|
|
50
|
+
[evt: string]: CustomEvent<any>;
|
|
51
|
+
};
|
|
52
|
+
slots: {
|
|
53
|
+
area: {
|
|
54
|
+
area: {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
lines: {
|
|
62
|
+
lines: any[];
|
|
63
|
+
};
|
|
64
|
+
points: {
|
|
65
|
+
points: any[];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export type HighlightProps = typeof __propDef.props;
|
|
70
|
+
export type HighlightEvents = typeof __propDef.events;
|
|
71
|
+
export type HighlightSlots = typeof __propDef.slots;
|
|
72
|
+
export default class Highlight extends SvelteComponentTyped<HighlightProps, HighlightEvents, HighlightSlots> {
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script>import { timeWeek, timeYear } from 'd3-time';
|
|
2
|
+
import { endOfMonth } from 'date-fns';
|
|
3
|
+
export let date;
|
|
4
|
+
/**
|
|
5
|
+
* Size of cell. If `number`, sets width/height as same. If array, sets [width,height]. If undefined, is based on Chart width/height
|
|
6
|
+
*/
|
|
7
|
+
export let cellSize;
|
|
8
|
+
$: [cellWidth, cellHeight] = Array.isArray(cellSize) ? cellSize : [cellSize, cellSize];
|
|
9
|
+
// start of month
|
|
10
|
+
$: startDayOfWeek = date.getDay();
|
|
11
|
+
$: startWeek = timeWeek.count(timeYear(date), date);
|
|
12
|
+
// end of month
|
|
13
|
+
$: monthEnd = endOfMonth(date);
|
|
14
|
+
$: endDayOfWeek = monthEnd.getDay();
|
|
15
|
+
$: endWeek = timeWeek.count(timeYear(monthEnd), monthEnd);
|
|
16
|
+
$: pathData = `
|
|
17
|
+
M${(startWeek + 1) * cellWidth},${startDayOfWeek * cellHeight}
|
|
18
|
+
H${startWeek * cellWidth} V${cellHeight * 7}
|
|
19
|
+
H${endWeek * cellWidth} V${(endDayOfWeek + 1) * cellHeight}
|
|
20
|
+
H${(endWeek + 1) * cellWidth} V0
|
|
21
|
+
H${(startWeek + 1) * cellWidth}Z
|
|
22
|
+
`;
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<path d={pathData} fill="none" stroke="black" {...$$restProps} />
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
date: Date;
|
|
6
|
+
cellSize: number | [number, number];
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type MonthPathProps = typeof __propDef.props;
|
|
14
|
+
export type MonthPathEvents = typeof __propDef.events;
|
|
15
|
+
export type MonthPathSlots = typeof __propDef.slots;
|
|
16
|
+
export default class MonthPath extends SvelteComponentTyped<MonthPathProps, MonthPathEvents, MonthPathSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
r?: number | undefined;
|
|
6
|
+
offsetX?: number | ((value: number, context: any) => number) | undefined;
|
|
7
|
+
offsetY?: number | ((value: number, context: any) => number) | undefined;
|
|
8
|
+
links?: boolean | {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
data?: any;
|
|
11
|
+
sankey?: boolean | undefined;
|
|
12
|
+
source?: ((d: any) => any) | undefined;
|
|
13
|
+
target?: ((d: any) => any) | undefined;
|
|
14
|
+
orientation?: "horizontal" | "vertical" | undefined;
|
|
15
|
+
x?: ((d: any) => any) | undefined;
|
|
16
|
+
y?: ((d: any) => any) | undefined;
|
|
17
|
+
curve?: import("d3-shape").CurveFactory | undefined;
|
|
18
|
+
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
};
|
|
21
|
+
events: {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
};
|
|
24
|
+
slots: {
|
|
25
|
+
default: {
|
|
26
|
+
points: any;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type PointsProps = typeof __propDef.props;
|
|
31
|
+
export type PointsEvents = typeof __propDef.events;
|
|
32
|
+
export type PointsSlots = typeof __propDef.slots;
|
|
33
|
+
export default class Points extends SvelteComponentTyped<PointsProps, PointsEvents, PointsSlots> {
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { type SpringOptions, type TweenedOptions } from '../stores/motionStore';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
x?: number | undefined;
|
|
7
|
+
initialX?: number | undefined;
|
|
8
|
+
y?: number | undefined;
|
|
9
|
+
initialY?: number | undefined;
|
|
10
|
+
width: number;
|
|
11
|
+
initialWidth?: number | undefined;
|
|
12
|
+
height: number;
|
|
13
|
+
initialHeight?: number | undefined;
|
|
14
|
+
spring?: boolean | import("svelte/motion").SpringOpts | {
|
|
15
|
+
[prop: string]: import("svelte/motion").SpringOpts | undefined;
|
|
16
|
+
} | undefined;
|
|
17
|
+
tweened?: boolean | import("svelte/motion").TweenedOptions<unknown> | {
|
|
18
|
+
[prop: string]: import("svelte/motion").TweenedOptions<unknown> | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
};
|
|
21
|
+
events: {
|
|
22
|
+
click: MouseEvent;
|
|
23
|
+
mouseover: MouseEvent;
|
|
24
|
+
mousemove: MouseEvent;
|
|
25
|
+
mouseout: MouseEvent;
|
|
26
|
+
mouseleave: MouseEvent;
|
|
27
|
+
} & {
|
|
28
|
+
[evt: string]: CustomEvent<any>;
|
|
29
|
+
};
|
|
30
|
+
slots: {};
|
|
31
|
+
};
|
|
32
|
+
export type RectProps = typeof __propDef.props;
|
|
33
|
+
export type RectEvents = typeof __propDef.events;
|
|
34
|
+
export type RectSlots = typeof __propDef.slots;
|
|
35
|
+
export default class Rect extends SvelteComponentTyped<RectProps, RectEvents, RectSlots> {
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -11,7 +11,7 @@ export let spring = undefined;
|
|
|
11
11
|
export let tweened = undefined;
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
|
-
<ClipPath {id}>
|
|
14
|
+
<ClipPath {id} let:url>
|
|
15
15
|
<Rect slot="clip" {x} {y} {width} {height} {spring} {tweened} {...$$restProps} />
|
|
16
|
-
<slot {id} />
|
|
16
|
+
<slot {id} {url} />
|
|
17
17
|
</ClipPath>
|
|
@@ -5,6 +5,7 @@ export { default as Axis } from './Axis.svelte';
|
|
|
5
5
|
export { default as Bars } from './Bars.svelte';
|
|
6
6
|
export { default as Blur } from './Blur.svelte';
|
|
7
7
|
export { default as Bounds } from './Bounds.svelte';
|
|
8
|
+
export { default as Calendar } from './Calendar.svelte';
|
|
8
9
|
export { default as Chart } from './Chart.svelte';
|
|
9
10
|
export { default as ChartClipPath } from './ChartClipPath.svelte';
|
|
10
11
|
export { default as Circle } from './Circle.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { default as Axis } from './Axis.svelte';
|
|
|
5
5
|
export { default as Bars } from './Bars.svelte';
|
|
6
6
|
export { default as Blur } from './Blur.svelte';
|
|
7
7
|
export { default as Bounds } from './Bounds.svelte';
|
|
8
|
+
export { default as Calendar } from './Calendar.svelte';
|
|
8
9
|
export { default as Chart } from './Chart.svelte';
|
|
9
10
|
export { default as ChartClipPath } from './ChartClipPath.svelte';
|
|
10
11
|
export { default as Circle } from './Circle.svelte';
|
package/dist/utils/path.d.ts
CHANGED
|
@@ -3,3 +3,10 @@
|
|
|
3
3
|
* see: https://svelte.dev/examples#easing
|
|
4
4
|
*/
|
|
5
5
|
export declare function getEasingPath(easing: (t: number) => number, count?: number): string;
|
|
6
|
+
/** Create circle using path data. Useful for labels. See also d3-shape's arc */
|
|
7
|
+
export declare function circlePath(dimensions: {
|
|
8
|
+
cx: number;
|
|
9
|
+
cy: number;
|
|
10
|
+
r: number;
|
|
11
|
+
sweep?: 'inside' | 'outside';
|
|
12
|
+
}): string;
|
package/dist/utils/path.js
CHANGED
|
@@ -12,3 +12,13 @@ export function getEasingPath(easing, count = 1000) {
|
|
|
12
12
|
}
|
|
13
13
|
return pathData;
|
|
14
14
|
}
|
|
15
|
+
/** Create circle using path data. Useful for labels. See also d3-shape's arc */
|
|
16
|
+
export function circlePath(dimensions) {
|
|
17
|
+
// sweep: 0 (inside), 1 (outside)
|
|
18
|
+
const { cx, cy, r, sweep = 'outside' } = dimensions;
|
|
19
|
+
return `
|
|
20
|
+
M ${cx - r} ${cy}
|
|
21
|
+
a ${r},${r} 0 1,${sweep} ${r * 2},0
|
|
22
|
+
a ${r},${r} 0 1,${sweep} -${r * 2},0
|
|
23
|
+
`;
|
|
24
|
+
}
|
package/dist/utils/pivot.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export declare function pivotLonger(data: any, columns: any, name: any, value: a
|
|
|
9
9
|
* Pivot wider (rows to columns)
|
|
10
10
|
* - see: https://github.com/d3/d3-array/issues/142#issuecomment-761861983
|
|
11
11
|
*/
|
|
12
|
-
export declare function pivotWider(data: any, column: any, name: any, value: any):
|
|
12
|
+
export declare function pivotWider(data: any, column: any, name: any, value: any): unknown[];
|
|
13
13
|
export declare function first(items: any): any;
|
|
14
14
|
export declare function last(items: any): any;
|
package/dist/utils/rect.d.ts
CHANGED
package/dist/utils/scales.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="svelte" />
|
|
1
2
|
import { tweened, spring } from 'svelte/motion';
|
|
2
3
|
import { type MotionOptions } from '../stores/motionStore';
|
|
3
4
|
import { type ScaleBand } from 'd3-scale';
|
|
@@ -29,7 +30,7 @@ export declare function groupScaleBand<Domain extends {
|
|
|
29
30
|
* Animate d3-scale as domain and/or range are updated using tweened store
|
|
30
31
|
*/
|
|
31
32
|
export declare function tweenedScale(scale: any, tweenedOptions?: Parameters<typeof tweened>[1]): {
|
|
32
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<any>, invalidate?: (
|
|
33
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<any>, invalidate?: import("svelte/store").Invalidator<any> | undefined) => import("svelte/store").Unsubscriber;
|
|
33
34
|
domain: (values: any) => Promise<void>;
|
|
34
35
|
range: (values: any) => Promise<void>;
|
|
35
36
|
};
|
|
@@ -37,7 +38,7 @@ export declare function tweenedScale(scale: any, tweenedOptions?: Parameters<typ
|
|
|
37
38
|
* Animate d3-scale as domain and/or range are updated using spring store
|
|
38
39
|
*/
|
|
39
40
|
export declare function springScale(scale: any, springOptions?: Parameters<typeof spring>[1]): {
|
|
40
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<any>, invalidate?: (
|
|
41
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<any>, invalidate?: import("svelte/store").Invalidator<any> | undefined) => import("svelte/store").Unsubscriber;
|
|
41
42
|
domain: (values: any) => Promise<void>;
|
|
42
43
|
range: (values: any) => Promise<void>;
|
|
43
44
|
};
|
|
@@ -45,7 +46,7 @@ export declare function springScale(scale: any, springOptions?: Parameters<typeo
|
|
|
45
46
|
* Create a store wrapper around a d3-scale which interpolates the domain and/or range using `tweened()` or `spring()` stores. Fallbacks to `writable()` store if not interpolating
|
|
46
47
|
*/
|
|
47
48
|
export declare function motionScale(scale: any, options: MotionOptions): {
|
|
48
|
-
subscribe: (this: void, run: import("svelte/store").Subscriber<any>, invalidate?: (
|
|
49
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<any>, invalidate?: import("svelte/store").Invalidator<any> | undefined) => import("svelte/store").Unsubscriber;
|
|
49
50
|
domain: (values: any) => void | Promise<void>;
|
|
50
51
|
range: (values: any) => void | Promise<void>;
|
|
51
52
|
};
|
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.23.0",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "vite dev",
|
|
9
9
|
"build": "vite build",
|
|
@@ -21,51 +21,52 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@rollup/plugin-dsv": "^3.0.2",
|
|
24
|
-
"@sveltejs/adapter-vercel": "^3.0.
|
|
25
|
-
"@sveltejs/kit": "^1.
|
|
26
|
-
"@sveltejs/package": "^2.2.
|
|
24
|
+
"@sveltejs/adapter-vercel": "^3.0.3",
|
|
25
|
+
"@sveltejs/kit": "^1.25.0",
|
|
26
|
+
"@sveltejs/package": "^2.2.2",
|
|
27
27
|
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
|
|
28
|
-
"@tailwindcss/typography": "^0.5.
|
|
29
|
-
"@types/d3-array": "^3.0.
|
|
28
|
+
"@tailwindcss/typography": "^0.5.10",
|
|
29
|
+
"@types/d3-array": "^3.0.7",
|
|
30
30
|
"@types/d3-delaunay": "^6.0.1",
|
|
31
|
-
"@types/d3-dsv": "^3.0.
|
|
32
|
-
"@types/d3-geo": "^3.0.
|
|
33
|
-
"@types/d3-hierarchy": "^3.1.
|
|
31
|
+
"@types/d3-dsv": "^3.0.2",
|
|
32
|
+
"@types/d3-geo": "^3.0.4",
|
|
33
|
+
"@types/d3-hierarchy": "^3.1.3",
|
|
34
34
|
"@types/d3-interpolate": "^3.0.1",
|
|
35
35
|
"@types/d3-interpolate-path": "^2.0.0",
|
|
36
36
|
"@types/d3-quadtree": "^3.0.2",
|
|
37
37
|
"@types/d3-random": "^3.0.1",
|
|
38
38
|
"@types/d3-sankey": "^0.12.1",
|
|
39
|
-
"@types/d3-scale": "^4.0.
|
|
40
|
-
"@types/d3-shape": "^3.1.
|
|
41
|
-
"@types/lodash-es": "^4.17.
|
|
39
|
+
"@types/d3-scale": "^4.0.4",
|
|
40
|
+
"@types/d3-shape": "^3.1.2",
|
|
41
|
+
"@types/lodash-es": "^4.17.9",
|
|
42
42
|
"@types/marked": "^5.0.1",
|
|
43
43
|
"@types/shapefile": "^0.6.1",
|
|
44
|
-
"@types/topojson-client": "^3.1.
|
|
45
|
-
"autoprefixer": "^10.4.
|
|
46
|
-
"execa": "^
|
|
47
|
-
"marked": "^
|
|
44
|
+
"@types/topojson-client": "^3.1.2",
|
|
45
|
+
"autoprefixer": "^10.4.15",
|
|
46
|
+
"execa": "^8.0.1",
|
|
47
|
+
"marked": "^9.0.0",
|
|
48
48
|
"mdsvex": "^0.11.0",
|
|
49
|
-
"prettier": "^3.0.
|
|
49
|
+
"prettier": "^3.0.3",
|
|
50
50
|
"prettier-plugin-svelte": "^3.0.3",
|
|
51
51
|
"prism-themes": "^1.9.0",
|
|
52
|
-
"rehype-slug": "^
|
|
53
|
-
"svelte
|
|
52
|
+
"rehype-slug": "^6.0.0",
|
|
53
|
+
"svelte": "^4.2.0",
|
|
54
|
+
"svelte-check": "^3.5.1",
|
|
54
55
|
"svelte-preprocess": "^5.0.4",
|
|
55
|
-
"svelte2tsx": "^0.6.
|
|
56
|
+
"svelte2tsx": "^0.6.21",
|
|
56
57
|
"tailwindcss": "^3.3.3",
|
|
57
|
-
"tslib": "^2.6.
|
|
58
|
-
"typescript": "^5.
|
|
58
|
+
"tslib": "^2.6.2",
|
|
59
|
+
"typescript": "^5.2.2",
|
|
59
60
|
"unist-util-visit": "^5.0.0",
|
|
60
61
|
"us-atlas": "^3.0.1",
|
|
61
|
-
"vite": "^4.4.
|
|
62
|
-
"vite-plugin-sveld": "^1.1.0"
|
|
62
|
+
"vite": "^4.4.9"
|
|
63
63
|
},
|
|
64
64
|
"type": "module",
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@changesets/cli": "^2.26.2",
|
|
67
67
|
"@mdi/js": "^7.2.96",
|
|
68
|
-
"@
|
|
68
|
+
"@types/d3-time": "^3.0.0",
|
|
69
|
+
"@vercel/analytics": "^1.0.2",
|
|
69
70
|
"d3-array": "^3.2.4",
|
|
70
71
|
"d3-delaunay": "^6.0.4",
|
|
71
72
|
"d3-dsv": "^3.0.1",
|
|
@@ -80,14 +81,17 @@
|
|
|
80
81
|
"d3-scale-chromatic": "^3.0.0",
|
|
81
82
|
"d3-shape": "^3.2.0",
|
|
82
83
|
"d3-tile": "^1.0.0",
|
|
84
|
+
"d3-time": "^3.1.0",
|
|
83
85
|
"date-fns": "^2.30.0",
|
|
84
86
|
"layercake": "^7.6.1",
|
|
85
87
|
"lodash-es": "^4.17.21",
|
|
86
88
|
"shapefile": "^0.6.6",
|
|
87
|
-
"svelte": "^
|
|
88
|
-
"svelte-ux": "^0.47.3",
|
|
89
|
+
"svelte-ux": "^0.49.0",
|
|
89
90
|
"topojson-client": "^3.1.0"
|
|
90
91
|
},
|
|
92
|
+
"peerDependencies": {
|
|
93
|
+
"svelte": "^3.56.0 || ^4.0.0"
|
|
94
|
+
},
|
|
91
95
|
"main": "./dist/index.js",
|
|
92
96
|
"exports": {
|
|
93
97
|
".": {
|