layerchart 0.50.0 → 0.51.1
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/ChartContext.svelte +1 -1
- package/dist/components/ChartContext.svelte.d.ts +4 -4
- package/dist/components/charts/AreaChart.svelte +12 -1
- package/dist/components/charts/AreaChart.svelte.d.ts +2 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +1 -1
- package/dist/utils/event.js +1 -1
- package/dist/utils/scales.js +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!-- Wrapper to allow getting LayerCake context from <Chart> and exposing with a strongly type context getter -->
|
|
2
|
-
<script context="module">import { createScale } from '../
|
|
2
|
+
<script context="module">import { createScale } from '../utils/scales.js';
|
|
3
3
|
import { createEventDispatcher, getContext, onMount, setContext, } from 'svelte';
|
|
4
4
|
import { derived, writable } from 'svelte/store';
|
|
5
5
|
export const chartContextKey = Symbol();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import { type AnyScale } from '../
|
|
2
|
+
import { type AnyScale } from '../utils/scales.js';
|
|
3
3
|
import type { HierarchyNode } from 'd3-hierarchy';
|
|
4
4
|
import { type Readable } from 'svelte/store';
|
|
5
5
|
export declare const chartContextKey: unique symbol;
|
|
@@ -98,7 +98,7 @@ declare class __sveltets_Render<TData> {
|
|
|
98
98
|
props(): {
|
|
99
99
|
x1?: import("../utils/common.js").Accessor<TData>;
|
|
100
100
|
x1Scale?: AnyScale<any, any, any, any> | undefined;
|
|
101
|
-
x1Domain?: import("../
|
|
101
|
+
x1Domain?: import("../utils/scales.js").DomainType | undefined;
|
|
102
102
|
x1Range?: string[] | number[] | ((args: {
|
|
103
103
|
xScale: AnyScale;
|
|
104
104
|
width: number;
|
|
@@ -106,7 +106,7 @@ declare class __sveltets_Render<TData> {
|
|
|
106
106
|
}) => number[] | string[]) | undefined;
|
|
107
107
|
y1?: import("../utils/common.js").Accessor<TData>;
|
|
108
108
|
y1Scale?: AnyScale<any, any, any, any> | undefined;
|
|
109
|
-
y1Domain?: import("../
|
|
109
|
+
y1Domain?: import("../utils/scales.js").DomainType | undefined;
|
|
110
110
|
y1Range?: string[] | number[] | ((args: {
|
|
111
111
|
yScale: AnyScale;
|
|
112
112
|
width: number;
|
|
@@ -114,7 +114,7 @@ declare class __sveltets_Render<TData> {
|
|
|
114
114
|
}) => number[] | string[]) | undefined;
|
|
115
115
|
c?: import("../utils/common.js").Accessor<TData>;
|
|
116
116
|
cScale?: AnyScale<any, any, any, any> | undefined;
|
|
117
|
-
cDomain?: import("../
|
|
117
|
+
cDomain?: import("../utils/scales.js").DomainType | undefined;
|
|
118
118
|
cRange?: string[] | undefined;
|
|
119
119
|
/** Use radial instead of cartesian coordinates, mapping `x` to `angle` and `y`` to radial. Radial lines are positioned relative to the origin, use transform (ex. `<Group center>`) to change the origin */ radial?: boolean;
|
|
120
120
|
data?: SankeyGraph<any, any> | TData[] | HierarchyNode<TData> | undefined;
|
|
@@ -8,6 +8,7 @@ import Axis from '../Axis.svelte';
|
|
|
8
8
|
import Chart from '../Chart.svelte';
|
|
9
9
|
import Highlight from '../Highlight.svelte';
|
|
10
10
|
import Labels from '../Labels.svelte';
|
|
11
|
+
import Line from '../Line.svelte';
|
|
11
12
|
import Points from '../Points.svelte';
|
|
12
13
|
import Svg from '../layout/Svg.svelte';
|
|
13
14
|
import * as Tooltip from '../tooltip/index.js';
|
|
@@ -94,6 +95,12 @@ $: xScale = accessor(x)(chartData[0]) instanceof Date ? scaleTime() : scaleLinea
|
|
|
94
95
|
|
|
95
96
|
<slot name="marks" {...slotProps}>
|
|
96
97
|
{#each series as s, i}
|
|
98
|
+
{@const lineProps = {
|
|
99
|
+
...props.line,
|
|
100
|
+
...(typeof props.area?.line === 'object' ? props.area.line : null),
|
|
101
|
+
...(typeof s.props?.line === 'object' ? s.props.line : null),
|
|
102
|
+
}}
|
|
103
|
+
|
|
97
104
|
<Area
|
|
98
105
|
data={s.data}
|
|
99
106
|
y0={stackSeries
|
|
@@ -106,11 +113,15 @@ $: xScale = accessor(x)(chartData[0]) instanceof Date ? scaleTime() : scaleLinea
|
|
|
106
113
|
: Array.isArray(s.value)
|
|
107
114
|
? s.value[1]
|
|
108
115
|
: (s.value ?? s.key)}
|
|
109
|
-
line={{ class: 'stroke-2', stroke: s.color }}
|
|
110
116
|
fill={s.color}
|
|
111
117
|
fill-opacity={0.3}
|
|
112
118
|
{...props.area}
|
|
113
119
|
{...s.props}
|
|
120
|
+
line={{
|
|
121
|
+
class: !('stroke-width' in lineProps) ? 'stroke-2' : '',
|
|
122
|
+
stroke: s.color,
|
|
123
|
+
...lineProps,
|
|
124
|
+
}}
|
|
114
125
|
/>
|
|
115
126
|
{/each}
|
|
116
127
|
</slot>
|
|
@@ -4,6 +4,7 @@ import Area from '../Area.svelte';
|
|
|
4
4
|
import Axis from '../Axis.svelte';
|
|
5
5
|
import Highlight from '../Highlight.svelte';
|
|
6
6
|
import Labels from '../Labels.svelte';
|
|
7
|
+
import Line from '../Line.svelte';
|
|
7
8
|
import Points from '../Points.svelte';
|
|
8
9
|
import { type Accessor } from '../../utils/common.js';
|
|
9
10
|
declare class __sveltets_Render<TData> {
|
|
@@ -234,6 +235,7 @@ declare class __sveltets_Render<TData> {
|
|
|
234
235
|
xAxis?: Partial<ComponentProps<Axis>>;
|
|
235
236
|
yAxis?: Partial<ComponentProps<Axis>>;
|
|
236
237
|
area?: Partial<ComponentProps<Area>>;
|
|
238
|
+
line?: Partial<ComponentProps<Line>>;
|
|
237
239
|
points?: Partial<ComponentProps<Points>>;
|
|
238
240
|
highlight?: Partial<ComponentProps<Highlight>>;
|
|
239
241
|
labels?: Partial<ComponentProps<Labels>>;
|
|
@@ -55,7 +55,6 @@ export { default as Threshold } from './Threshold.svelte';
|
|
|
55
55
|
export { default as TileImage } from './TileImage.svelte';
|
|
56
56
|
export * as Tooltip from './tooltip/index.js';
|
|
57
57
|
export { default as TransformContext, transformContext } from './TransformContext.svelte';
|
|
58
|
-
export { default as TransformControls } from './TransformControls.svelte';
|
|
59
58
|
export { default as Tree } from './Tree.svelte';
|
|
60
59
|
export { default as Treemap } from './Treemap.svelte';
|
|
61
60
|
export { default as Voronoi } from './Voronoi.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -56,7 +56,7 @@ export { default as Threshold } from './Threshold.svelte';
|
|
|
56
56
|
export { default as TileImage } from './TileImage.svelte';
|
|
57
57
|
export * as Tooltip from './tooltip/index.js';
|
|
58
58
|
export { default as TransformContext, transformContext } from './TransformContext.svelte';
|
|
59
|
-
export { default as TransformControls } from './TransformControls.svelte';
|
|
59
|
+
// export { default as TransformControls } from './TransformControls.svelte'; // TODO: Restore once no longer using `svelet-ux` or `@mdi/js` (as they are dev dependencies)
|
|
60
60
|
export { default as Tree } from './Tree.svelte';
|
|
61
61
|
export { default as Treemap } from './Treemap.svelte';
|
|
62
62
|
export { default as Voronoi } from './Voronoi.svelte';
|
package/dist/utils/event.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isSVGElement, isSVGGraphicsElement, isSVGSVGElement, isTouchEvent } from '
|
|
1
|
+
import { isSVGElement, isSVGGraphicsElement, isSVGSVGElement, isTouchEvent, } from '@layerstack/utils';
|
|
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)
|
package/dist/utils/scales.js
CHANGED
|
@@ -2,7 +2,7 @@ import { derived } from 'svelte/store';
|
|
|
2
2
|
import { tweened, spring } from 'svelte/motion';
|
|
3
3
|
import { motionStore } from '../stores/motionStore.js';
|
|
4
4
|
import { scaleBand } from 'd3-scale';
|
|
5
|
-
import { unique } from '
|
|
5
|
+
import { unique } from '@layerstack/utils/array';
|
|
6
6
|
/**
|
|
7
7
|
* Implemenation for missing `scaleBand().invert()`
|
|
8
8
|
*
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"author": "Sean Lynch <techniq35@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "techniq/layerchart",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.51.1",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@changesets/cli": "^2.27.7",
|
|
10
10
|
"@mdi/js": "^7.4.47",
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
},
|
|
69
69
|
"type": "module",
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@layerstack/svelte-actions": "^0.0.
|
|
72
|
-
"@layerstack/svelte-stores": "^0.0.
|
|
73
|
-
"@layerstack/tailwind": "^0.0.
|
|
74
|
-
"@layerstack/utils": "^0.0.
|
|
71
|
+
"@layerstack/svelte-actions": "^0.0.4",
|
|
72
|
+
"@layerstack/svelte-stores": "^0.0.4",
|
|
73
|
+
"@layerstack/tailwind": "^0.0.6",
|
|
74
|
+
"@layerstack/utils": "^0.0.4",
|
|
75
75
|
"d3-array": "^3.2.4",
|
|
76
76
|
"d3-color": "^3.1.0",
|
|
77
77
|
"d3-delaunay": "^6.0.4",
|