layerchart 1.0.6 → 2.0.0-next.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/Arc.svelte +3 -1
- package/dist/components/Area.svelte +4 -2
- package/dist/components/Bar.svelte +10 -9
- package/dist/components/Bars.svelte +4 -0
- package/dist/components/Circle.svelte +4 -1
- package/dist/components/GeoPath.svelte +4 -2
- package/dist/components/GeoPath.svelte.d.ts +1 -0
- package/dist/components/Graticule.svelte.d.ts +2 -0
- package/dist/components/Highlight.svelte +1 -1
- package/dist/components/Legend.svelte +1 -1
- package/dist/components/Line.svelte +4 -1
- package/dist/components/LinearGradient.svelte +12 -6
- package/dist/components/LinearGradient.svelte.d.ts +1 -0
- package/dist/components/Points.svelte +2 -0
- package/dist/components/Points.svelte.d.ts +1 -0
- package/dist/components/Rect.svelte +4 -1
- package/dist/components/Spline.svelte +4 -2
- package/dist/components/Text.svelte +19 -2
- package/dist/components/TransformControls.svelte +1 -1
- package/dist/components/charts/AreaChart.svelte +2 -1
- package/dist/components/charts/BarChart.svelte +2 -1
- package/dist/components/charts/LineChart.svelte +2 -1
- package/dist/components/charts/PieChart.svelte +9 -8
- package/dist/components/charts/ScatterChart.svelte +2 -1
- package/dist/components/tooltip/Tooltip.svelte +1 -1
- package/dist/components/tooltip/TooltipSeparator.svelte +1 -1
- package/dist/docs/Blockquote.svelte +1 -1
- package/dist/docs/Code.svelte +2 -2
- package/dist/docs/GeoDebug.svelte +4 -2
- package/dist/docs/Preview.svelte +2 -2
- package/dist/docs/TransformDebug.svelte +3 -1
- package/dist/docs/ViewSourceButton.svelte +1 -1
- package/dist/utils/canvas.js +1 -1
- package/package.json +9 -10
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
export let fillOpacity: number | undefined = undefined;
|
|
81
81
|
export let stroke: string | undefined = 'none';
|
|
82
82
|
export let strokeWidth: number | undefined = undefined;
|
|
83
|
+
export let opacity: number | undefined = undefined;
|
|
83
84
|
|
|
84
85
|
let className: string | undefined = undefined;
|
|
85
86
|
export { className as class };
|
|
@@ -221,9 +222,10 @@
|
|
|
221
222
|
pathData={arc()}
|
|
222
223
|
transform="translate({xOffset}, {yOffset})"
|
|
223
224
|
{fill}
|
|
224
|
-
|
|
225
|
+
{fillOpacity}
|
|
225
226
|
{stroke}
|
|
226
227
|
stroke-width={strokeWidth}
|
|
228
|
+
{opacity}
|
|
227
229
|
class={className}
|
|
228
230
|
{...$$restProps}
|
|
229
231
|
{onclick}
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
export let fillOpacity: number | undefined = undefined;
|
|
62
62
|
export let stroke: string | undefined = undefined;
|
|
63
63
|
export let strokeWidth: number | undefined = undefined;
|
|
64
|
+
export let opacity: number | undefined = undefined;
|
|
64
65
|
|
|
65
66
|
let className: string | undefined = undefined;
|
|
66
67
|
export { className as class };
|
|
@@ -166,7 +167,7 @@
|
|
|
166
167
|
styleOverrides
|
|
167
168
|
? merge({ styles: { strokeWidth } }, styleOverrides)
|
|
168
169
|
: {
|
|
169
|
-
styles: { fill, fillOpacity, stroke, strokeWidth },
|
|
170
|
+
styles: { fill, fillOpacity, stroke, strokeWidth, opacity },
|
|
170
171
|
classes: className,
|
|
171
172
|
}
|
|
172
173
|
);
|
|
@@ -178,7 +179,7 @@
|
|
|
178
179
|
|
|
179
180
|
$: if (renderContext === 'canvas') {
|
|
180
181
|
// Redraw when props change
|
|
181
|
-
fillKey && fillOpacity && strokeKey && strokeWidth && className;
|
|
182
|
+
fillKey && fillOpacity && strokeKey && strokeWidth && opacity && className;
|
|
182
183
|
canvasContext.invalidate();
|
|
183
184
|
}
|
|
184
185
|
|
|
@@ -228,6 +229,7 @@
|
|
|
228
229
|
fill-opacity={fillOpacity}
|
|
229
230
|
{stroke}
|
|
230
231
|
stroke-width={strokeWidth}
|
|
232
|
+
{opacity}
|
|
231
233
|
{...$$restProps}
|
|
232
234
|
class={cls('path-area', className)}
|
|
233
235
|
on:click={onclick}
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
import Rect from './Rect.svelte';
|
|
6
6
|
import Spline from './Spline.svelte';
|
|
7
7
|
|
|
8
|
-
import { getRenderContext } from './Chart.svelte';
|
|
9
|
-
import { getCanvasContext } from './layout/Canvas.svelte';
|
|
10
8
|
import { createDimensionGetter, type Insets } from '../utils/rect.js';
|
|
11
9
|
import { isScaleBand } from '../utils/scales.js';
|
|
12
10
|
import { accessor, type Accessor } from '../utils/common.js';
|
|
@@ -37,8 +35,10 @@
|
|
|
37
35
|
export let y1: Accessor = undefined;
|
|
38
36
|
|
|
39
37
|
export let fill: string | undefined = undefined;
|
|
38
|
+
export let fillOpacity: number | undefined = undefined;
|
|
40
39
|
export let stroke = 'black';
|
|
41
40
|
export let strokeWidth = 0;
|
|
41
|
+
export let opacity: number | undefined = undefined;
|
|
42
42
|
export let radius = 0;
|
|
43
43
|
|
|
44
44
|
/** Control which corners are rounded with radius. Uses <path> instead of <rect> when not set to `all` */
|
|
@@ -113,19 +113,18 @@
|
|
|
113
113
|
z`
|
|
114
114
|
.split('\n')
|
|
115
115
|
.join('');
|
|
116
|
-
|
|
117
|
-
const renderContext = getRenderContext();
|
|
118
|
-
const canvasContext = getCanvasContext();
|
|
119
116
|
</script>
|
|
120
117
|
|
|
121
118
|
{#if _rounded === 'all' || _rounded === 'none' || radius === 0}
|
|
122
119
|
<Rect
|
|
123
120
|
{fill}
|
|
124
|
-
{
|
|
125
|
-
{tweened}
|
|
121
|
+
{fillOpacity}
|
|
126
122
|
{stroke}
|
|
127
123
|
{strokeWidth}
|
|
124
|
+
{opacity}
|
|
128
125
|
rx={_rounded === 'none' ? 0 : radius}
|
|
126
|
+
{spring}
|
|
127
|
+
{tweened}
|
|
129
128
|
{onclick}
|
|
130
129
|
{onpointerenter}
|
|
131
130
|
{onpointermove}
|
|
@@ -138,10 +137,12 @@
|
|
|
138
137
|
<Spline
|
|
139
138
|
{pathData}
|
|
140
139
|
{fill}
|
|
141
|
-
{
|
|
142
|
-
{tweened}
|
|
140
|
+
{fillOpacity}
|
|
143
141
|
{stroke}
|
|
144
142
|
{strokeWidth}
|
|
143
|
+
{opacity}
|
|
144
|
+
{spring}
|
|
145
|
+
{tweened}
|
|
145
146
|
{onclick}
|
|
146
147
|
{onpointerenter}
|
|
147
148
|
{onpointermove}
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
export let strokeWidth = 0;
|
|
39
39
|
export let radius = 0;
|
|
40
40
|
export let fill: string | undefined = undefined;
|
|
41
|
+
export let fillOpacity: number | undefined = undefined;
|
|
42
|
+
export let opacity: number | undefined = undefined;
|
|
41
43
|
|
|
42
44
|
/** Inset the rect for amount of padding. Useful with multiple bars (bullet, overlap, etc) */
|
|
43
45
|
export let insets: Insets | undefined = undefined;
|
|
@@ -64,8 +66,10 @@
|
|
|
64
66
|
{x1}
|
|
65
67
|
{y1}
|
|
66
68
|
fill={fill ?? ($config.c ? $cGet(d) : null)}
|
|
69
|
+
{fillOpacity}
|
|
67
70
|
{stroke}
|
|
68
71
|
{strokeWidth}
|
|
72
|
+
{opacity}
|
|
69
73
|
{radius}
|
|
70
74
|
{insets}
|
|
71
75
|
{spring}
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
export let fillOpacity: number | undefined = undefined;
|
|
27
27
|
export let stroke: string | undefined = undefined;
|
|
28
28
|
export let strokeWidth: number | undefined = undefined;
|
|
29
|
+
export let opacity: number | undefined = undefined;
|
|
29
30
|
|
|
30
31
|
let className: string | undefined = undefined;
|
|
31
32
|
export { className as class };
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
styleOverrides
|
|
60
61
|
? merge({ styles: { strokeWidth } }, styleOverrides)
|
|
61
62
|
: {
|
|
62
|
-
styles: { fill, fillOpacity, stroke, strokeWidth },
|
|
63
|
+
styles: { fill, fillOpacity, stroke, strokeWidth, opacity },
|
|
63
64
|
classes: className,
|
|
64
65
|
}
|
|
65
66
|
);
|
|
@@ -78,6 +79,7 @@
|
|
|
78
79
|
fillOpacity &&
|
|
79
80
|
strokeKey &&
|
|
80
81
|
strokeWidth &&
|
|
82
|
+
opacity &&
|
|
81
83
|
className;
|
|
82
84
|
canvasContext.invalidate();
|
|
83
85
|
}
|
|
@@ -114,6 +116,7 @@
|
|
|
114
116
|
fill-opacity={fillOpacity}
|
|
115
117
|
{stroke}
|
|
116
118
|
stroke-width={strokeWidth}
|
|
119
|
+
{opacity}
|
|
117
120
|
class={cls(fill == null && 'fill-surface-content', className)}
|
|
118
121
|
{...$$restProps}
|
|
119
122
|
on:click={onclick}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
export let fill: string | undefined = undefined;
|
|
25
25
|
export let stroke: string | undefined = undefined;
|
|
26
26
|
export let strokeWidth: number | undefined = undefined;
|
|
27
|
+
export let opacity: number | undefined = undefined;
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Tooltip context to setup pointer events to show tooltip for related data
|
|
@@ -87,7 +88,7 @@
|
|
|
87
88
|
styleOverrides
|
|
88
89
|
? merge({ styles: { strokeWidth } }, styleOverrides)
|
|
89
90
|
: {
|
|
90
|
-
styles: { fill, stroke, strokeWidth },
|
|
91
|
+
styles: { fill, stroke, strokeWidth, opacity },
|
|
91
92
|
classes: className,
|
|
92
93
|
}
|
|
93
94
|
);
|
|
@@ -100,7 +101,7 @@
|
|
|
100
101
|
|
|
101
102
|
$: if (renderContext === 'canvas') {
|
|
102
103
|
// Redraw when geojson, projection, or class change
|
|
103
|
-
geojson && _projection && fillKey && strokeKey && strokeWidth && className;
|
|
104
|
+
geojson && _projection && fillKey && strokeKey && strokeWidth && opacity && className;
|
|
104
105
|
canvasContext.invalidate();
|
|
105
106
|
}
|
|
106
107
|
|
|
@@ -153,6 +154,7 @@
|
|
|
153
154
|
{fill}
|
|
154
155
|
{stroke}
|
|
155
156
|
stroke-width={strokeWidth}
|
|
157
|
+
{opacity}
|
|
156
158
|
on:click={_onClick}
|
|
157
159
|
on:pointerenter={_onPointerEnter}
|
|
158
160
|
on:pointermove={_onPointerMove}
|
|
@@ -10,6 +10,7 @@ declare const __propDef: {
|
|
|
10
10
|
fill?: string | undefined | undefined;
|
|
11
11
|
stroke?: string | undefined | undefined;
|
|
12
12
|
strokeWidth?: number | undefined | undefined;
|
|
13
|
+
opacity?: number | undefined | undefined;
|
|
13
14
|
tooltip?: TooltipContextValue | undefined;
|
|
14
15
|
onclick?: ((e: MouseEvent, geoPath: ReturnType<typeof geoCurvePath>) => void) | undefined | undefined;
|
|
15
16
|
onpointerenter?: ((e: PointerEvent) => void) | undefined | undefined;
|
|
@@ -8,6 +8,7 @@ declare const __propDef: {
|
|
|
8
8
|
fill?: string | undefined | undefined;
|
|
9
9
|
stroke?: string | undefined | undefined;
|
|
10
10
|
strokeWidth?: number | undefined | undefined;
|
|
11
|
+
opacity?: number | undefined | undefined;
|
|
11
12
|
tooltip?: import("./tooltip/TooltipContext.svelte").TooltipContextValue | undefined;
|
|
12
13
|
onclick?: ((e: MouseEvent, geoPath: ReturnType<typeof import("..").geoCurvePath>) => void) | undefined | undefined;
|
|
13
14
|
onpointerenter?: ((e: PointerEvent) => void) | undefined | undefined;
|
|
@@ -25,6 +26,7 @@ declare const __propDef: {
|
|
|
25
26
|
fill?: string | undefined | undefined;
|
|
26
27
|
stroke?: string | undefined | undefined;
|
|
27
28
|
strokeWidth?: number | undefined | undefined;
|
|
29
|
+
opacity?: number | undefined | undefined;
|
|
28
30
|
tooltip?: import("./tooltip/TooltipContext.svelte").TooltipContextValue | undefined;
|
|
29
31
|
onclick?: ((e: MouseEvent, geoPath: ReturnType<typeof import("..").geoCurvePath>) => void) | undefined | undefined;
|
|
30
32
|
onpointerenter?: ((e: PointerEvent) => void) | undefined | undefined;
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
strokeWidth={6}
|
|
413
413
|
{...typeof points === 'object' ? points : null}
|
|
414
414
|
class={cls(
|
|
415
|
-
'stroke-white [paint-order:stroke] drop-shadow',
|
|
415
|
+
'stroke-white [paint-order:stroke] drop-shadow-sm',
|
|
416
416
|
!point.fill && (typeof points === 'boolean' || !points.fill) && 'fill-primary',
|
|
417
417
|
typeof points === 'object' ? points.class : null
|
|
418
418
|
)}
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
export let fill: string | undefined = undefined;
|
|
29
29
|
export let stroke: string | undefined = undefined;
|
|
30
30
|
export let strokeWidth: number | undefined = undefined;
|
|
31
|
+
export let opacity: number | undefined = undefined;
|
|
31
32
|
|
|
32
33
|
let className: string | undefined = undefined;
|
|
33
34
|
export { className as class };
|
|
@@ -79,7 +80,7 @@
|
|
|
79
80
|
styleOverrides
|
|
80
81
|
? merge({ styles: { strokeWidth } }, styleOverrides)
|
|
81
82
|
: {
|
|
82
|
-
styles: { fill, stroke, strokeWidth },
|
|
83
|
+
styles: { fill, stroke, strokeWidth, opacity },
|
|
83
84
|
classes: className,
|
|
84
85
|
}
|
|
85
86
|
);
|
|
@@ -98,6 +99,7 @@
|
|
|
98
99
|
fillKey &&
|
|
99
100
|
strokeKey &&
|
|
100
101
|
strokeWidth &&
|
|
102
|
+
opacity &&
|
|
101
103
|
className;
|
|
102
104
|
canvasContext.invalidate();
|
|
103
105
|
}
|
|
@@ -133,6 +135,7 @@
|
|
|
133
135
|
{fill}
|
|
134
136
|
{stroke}
|
|
135
137
|
stroke-width={strokeWidth}
|
|
138
|
+
{opacity}
|
|
136
139
|
marker-start={markerStartId ? `url(#${markerStartId})` : undefined}
|
|
137
140
|
marker-end={markerEndId ? `url(#${markerEndId})` : undefined}
|
|
138
141
|
class={cls(stroke === undefined && 'stroke-surface-content', className)}
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
/** Define the coordinate system for attributes (i.e. gradientUnits) */
|
|
30
30
|
export let units: 'objectBoundingBox' | 'userSpaceOnUse' = 'objectBoundingBox';
|
|
31
31
|
|
|
32
|
+
let className: string | undefined = undefined;
|
|
33
|
+
export { className as class };
|
|
34
|
+
|
|
32
35
|
const { width, height, padding } = chartContext();
|
|
33
36
|
|
|
34
37
|
const renderContext = getRenderContext();
|
|
@@ -42,13 +45,13 @@
|
|
|
42
45
|
if (Array.isArray(stop)) {
|
|
43
46
|
const { fill } = getComputedStyles(ctx.canvas, {
|
|
44
47
|
styles: { fill: stop[1] },
|
|
45
|
-
classes:
|
|
48
|
+
classes: className,
|
|
46
49
|
});
|
|
47
50
|
return { offset: parsePercent(stop[0]), color: fill };
|
|
48
51
|
} else {
|
|
49
52
|
const { fill } = getComputedStyles(ctx.canvas, {
|
|
50
53
|
styles: { fill: stop },
|
|
51
|
-
classes:
|
|
54
|
+
classes: className,
|
|
52
55
|
});
|
|
53
56
|
return { offset: i / (stops.length - 1), color: fill };
|
|
54
57
|
}
|
|
@@ -68,8 +71,7 @@
|
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
$: if (renderContext === 'canvas') {
|
|
71
|
-
|
|
72
|
-
x1 && y1 && x2 && y2 && stops;
|
|
74
|
+
x1 && y1 && x2 && y2 && stops && className;
|
|
73
75
|
canvasContext.invalidate();
|
|
74
76
|
}
|
|
75
77
|
|
|
@@ -103,9 +105,13 @@
|
|
|
103
105
|
{#if stops}
|
|
104
106
|
{#each stops as stop, i}
|
|
105
107
|
{#if Array.isArray(stop)}
|
|
106
|
-
<stop offset={stop[0]} stop-color={stop[1]} />
|
|
108
|
+
<stop offset={stop[0]} stop-color={stop[1]} class={className} />
|
|
107
109
|
{:else}
|
|
108
|
-
<stop
|
|
110
|
+
<stop
|
|
111
|
+
offset="{i * (100 / (stops.length - 1))}%"
|
|
112
|
+
stop-color={stop}
|
|
113
|
+
class={className}
|
|
114
|
+
/>
|
|
109
115
|
{/if}
|
|
110
116
|
{/each}
|
|
111
117
|
{/if}
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
export let fillOpacity: number | undefined = undefined;
|
|
51
51
|
export let stroke: string | undefined = undefined;
|
|
52
52
|
export let strokeWidth: number | undefined = undefined;
|
|
53
|
+
export let opacity: number | undefined = undefined;
|
|
53
54
|
|
|
54
55
|
let className: string | undefined = undefined;
|
|
55
56
|
export { className as class };
|
|
@@ -188,6 +189,7 @@
|
|
|
188
189
|
{fillOpacity}
|
|
189
190
|
{stroke}
|
|
190
191
|
{strokeWidth}
|
|
192
|
+
{opacity}
|
|
191
193
|
class={className}
|
|
192
194
|
{...$$restProps}
|
|
193
195
|
/>
|
|
@@ -24,6 +24,7 @@ declare const __propDef: {
|
|
|
24
24
|
fillOpacity?: number | undefined | undefined;
|
|
25
25
|
stroke?: string | undefined | undefined;
|
|
26
26
|
strokeWidth?: number | undefined | undefined;
|
|
27
|
+
opacity?: number | undefined | undefined;
|
|
27
28
|
class?: string | undefined | undefined;
|
|
28
29
|
};
|
|
29
30
|
events: {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
export let fillOpacity: number | undefined = undefined;
|
|
35
35
|
export let stroke: string | undefined = undefined;
|
|
36
36
|
export let strokeWidth: number | undefined = undefined;
|
|
37
|
+
export let opacity: number | undefined = undefined;
|
|
37
38
|
|
|
38
39
|
let className: ClassValue | undefined = undefined;
|
|
39
40
|
export { className as class };
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
styleOverrides
|
|
75
76
|
? merge({ styles: { strokeWidth } }, styleOverrides)
|
|
76
77
|
: {
|
|
77
|
-
styles: { fill, fillOpacity, stroke, strokeWidth },
|
|
78
|
+
styles: { fill, fillOpacity, stroke, strokeWidth, opacity },
|
|
78
79
|
classes: className,
|
|
79
80
|
}
|
|
80
81
|
);
|
|
@@ -93,6 +94,7 @@
|
|
|
93
94
|
fillKey &&
|
|
94
95
|
strokeKey &&
|
|
95
96
|
strokeWidth &&
|
|
97
|
+
opacity &&
|
|
96
98
|
className;
|
|
97
99
|
canvasContext.invalidate();
|
|
98
100
|
}
|
|
@@ -133,6 +135,7 @@
|
|
|
133
135
|
fill-opacity={fillOpacity}
|
|
134
136
|
{stroke}
|
|
135
137
|
stroke-width={strokeWidth}
|
|
138
|
+
{opacity}
|
|
136
139
|
class={cls(fill == null && 'fill-surface-content', className)}
|
|
137
140
|
{...$$restProps}
|
|
138
141
|
on:click={onclick}
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
export let defined: Parameters<Line<any>['defined']>[0] | undefined = undefined;
|
|
68
68
|
|
|
69
69
|
export let fill: string | undefined = undefined;
|
|
70
|
+
export let fillOpacity: number | undefined = undefined;
|
|
70
71
|
export let stroke: string | undefined = undefined;
|
|
71
72
|
export let strokeWidth: number | undefined = undefined;
|
|
72
73
|
export let opacity: number | undefined = undefined;
|
|
@@ -192,7 +193,7 @@
|
|
|
192
193
|
styleOverrides
|
|
193
194
|
? merge({ styles: { strokeWidth } }, styleOverrides)
|
|
194
195
|
: {
|
|
195
|
-
styles: { fill, stroke, strokeWidth, opacity },
|
|
196
|
+
styles: { fill, fillOpacity, stroke, strokeWidth, opacity },
|
|
196
197
|
classes: className,
|
|
197
198
|
}
|
|
198
199
|
);
|
|
@@ -204,7 +205,7 @@
|
|
|
204
205
|
|
|
205
206
|
$: if (renderContext === 'canvas') {
|
|
206
207
|
// Redraw when props change
|
|
207
|
-
$tweened_d && fillKey && strokeKey && strokeWidth && className;
|
|
208
|
+
$tweened_d && fillKey && fillOpacity && strokeKey && strokeWidth && className;
|
|
208
209
|
canvasContext.invalidate();
|
|
209
210
|
}
|
|
210
211
|
|
|
@@ -274,6 +275,7 @@
|
|
|
274
275
|
{...$$restProps}
|
|
275
276
|
class={cls('path-line', !fill && 'fill-none', !stroke && 'stroke-surface-content', className)}
|
|
276
277
|
{fill}
|
|
278
|
+
fill-opacity={fillOpacity}
|
|
277
279
|
{stroke}
|
|
278
280
|
stroke-width={strokeWidth}
|
|
279
281
|
{opacity}
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
export let fillOpacity: number | undefined = undefined;
|
|
68
68
|
export let stroke: string | undefined = undefined;
|
|
69
69
|
export let strokeWidth: number | undefined = undefined;
|
|
70
|
+
export let opacity: number | undefined = undefined;
|
|
70
71
|
|
|
71
72
|
let className: string | undefined = undefined;
|
|
72
73
|
export { className as class };
|
|
@@ -202,7 +203,15 @@
|
|
|
202
203
|
styleOverrides
|
|
203
204
|
? merge({ styles: { strokeWidth } }, styleOverrides)
|
|
204
205
|
: {
|
|
205
|
-
styles: {
|
|
206
|
+
styles: {
|
|
207
|
+
fill,
|
|
208
|
+
fillOpacity,
|
|
209
|
+
stroke,
|
|
210
|
+
strokeWidth,
|
|
211
|
+
opacity,
|
|
212
|
+
paintOrder: 'stroke',
|
|
213
|
+
textAnchor,
|
|
214
|
+
},
|
|
206
215
|
classes: cls(fill === undefined && 'fill-surface-content', className),
|
|
207
216
|
}
|
|
208
217
|
);
|
|
@@ -215,7 +224,14 @@
|
|
|
215
224
|
|
|
216
225
|
$: if (renderContext === 'canvas') {
|
|
217
226
|
// Redraw when props change
|
|
218
|
-
value &&
|
|
227
|
+
value &&
|
|
228
|
+
$tweened_x &&
|
|
229
|
+
$tweened_y &&
|
|
230
|
+
fillKey &&
|
|
231
|
+
strokeKey &&
|
|
232
|
+
strokeWidth &&
|
|
233
|
+
opacity &&
|
|
234
|
+
className;
|
|
219
235
|
canvasContext.invalidate();
|
|
220
236
|
}
|
|
221
237
|
|
|
@@ -246,6 +262,7 @@
|
|
|
246
262
|
fill-opacity={fillOpacity}
|
|
247
263
|
{stroke}
|
|
248
264
|
stroke-width={strokeWidth}
|
|
265
|
+
{opacity}
|
|
249
266
|
class={cls(fill === undefined && 'fill-surface-content', className)}
|
|
250
267
|
>
|
|
251
268
|
{#each wordsByLines as line, index}
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
67
67
|
<div
|
|
68
68
|
class={cls(
|
|
69
|
-
'bg-surface-300/50 border rounded-full m-1 backdrop-blur z-10 flex',
|
|
69
|
+
'bg-surface-300/50 border rounded-full m-1 backdrop-blur-sm z-10 flex',
|
|
70
70
|
orientation === 'vertical' && 'flex-col',
|
|
71
71
|
{
|
|
72
72
|
'top-left': 'absolute top-0 left-0',
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
data?: TData[];
|
|
69
69
|
color?: string;
|
|
70
70
|
props?: Partial<ComponentProps<Area>>;
|
|
71
|
-
}[] = [{ key: 'default', value: y, color: '
|
|
71
|
+
}[] = [{ key: 'default', value: y, color: 'var(--color-primary)' }];
|
|
72
72
|
$: isDefaultSeries = series.length === 1 && series[0].key === 'default';
|
|
73
73
|
|
|
74
74
|
/** Determine how to layout series. Overlap (default) or stack */
|
|
@@ -346,6 +346,7 @@
|
|
|
346
346
|
getAreaProps,
|
|
347
347
|
getLabelsProps,
|
|
348
348
|
getPointsProps,
|
|
349
|
+
highlightSeriesKey,
|
|
349
350
|
setHighlightSeriesKey,
|
|
350
351
|
}}
|
|
351
352
|
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
{y1Domain}
|
|
315
315
|
{y1Range}
|
|
316
316
|
c={isVertical ? y : x}
|
|
317
|
-
cRange={['
|
|
317
|
+
cRange={['var(--color-primary)']}
|
|
318
318
|
padding={defaultChartPadding(axis, legend)}
|
|
319
319
|
{...$$restProps}
|
|
320
320
|
tooltip={$$props.tooltip === false
|
|
@@ -353,6 +353,7 @@
|
|
|
353
353
|
visibleSeries,
|
|
354
354
|
getBarsProps,
|
|
355
355
|
getLabelsProps,
|
|
356
|
+
highlightSeriesKey,
|
|
356
357
|
setHighlightSeriesKey,
|
|
357
358
|
}}
|
|
358
359
|
<slot {...slotProps}>
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
data?: TData[];
|
|
65
65
|
color?: string;
|
|
66
66
|
props?: Partial<ComponentProps<Spline>>;
|
|
67
|
-
}[] = [{ key: 'default', value: y, color: '
|
|
67
|
+
}[] = [{ key: 'default', value: y, color: 'var(--color-primary)' }];
|
|
68
68
|
$: isDefaultSeries = series.length === 1 && series[0].key === 'default';
|
|
69
69
|
|
|
70
70
|
export let axis: ComponentProps<Axis> | 'x' | 'y' | boolean = true;
|
|
@@ -277,6 +277,7 @@
|
|
|
277
277
|
getLabelsProps,
|
|
278
278
|
getPointsProps,
|
|
279
279
|
getSplineProps,
|
|
280
|
+
highlightSeriesKey,
|
|
280
281
|
setHighlightSeriesKey,
|
|
281
282
|
}}
|
|
282
283
|
<slot {...slotProps}>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
maxValue?: number;
|
|
71
71
|
color?: string;
|
|
72
72
|
props?: Partial<ComponentProps<Arc>>;
|
|
73
|
-
}[] = [{ key: 'default', value: value /*, color: '
|
|
73
|
+
}[] = [{ key: 'default', value: value /*, color: 'var(--color-primary)'*/ }];
|
|
74
74
|
|
|
75
75
|
export let legend: ComponentProps<Legend> | boolean = false;
|
|
76
76
|
|
|
@@ -183,12 +183,12 @@
|
|
|
183
183
|
: c !== key
|
|
184
184
|
? chartData.map((d) => cAccessor(d))
|
|
185
185
|
: [
|
|
186
|
-
'
|
|
187
|
-
'
|
|
188
|
-
'
|
|
189
|
-
'
|
|
190
|
-
'
|
|
191
|
-
'
|
|
186
|
+
'var(--color-primary)',
|
|
187
|
+
'var(--color-secondary)',
|
|
188
|
+
'var(--color-info)',
|
|
189
|
+
'var(--color-success)',
|
|
190
|
+
'var(--color-warning)',
|
|
191
|
+
'var(--color-danger)',
|
|
192
192
|
]}
|
|
193
193
|
padding={{ bottom: legend === true ? 32 : 0 }}
|
|
194
194
|
{...$$restProps}
|
|
@@ -221,6 +221,7 @@
|
|
|
221
221
|
tooltip,
|
|
222
222
|
series,
|
|
223
223
|
visibleData,
|
|
224
|
+
highlightKey,
|
|
224
225
|
setHighlightKey,
|
|
225
226
|
}}
|
|
226
227
|
<slot {...slotProps}>
|
|
@@ -257,7 +258,7 @@
|
|
|
257
258
|
{cornerRadius}
|
|
258
259
|
{padAngle}
|
|
259
260
|
fill={s.color ?? cScale?.(c(d))}
|
|
260
|
-
track={{ fill: s.color ?? cScale?.(c(d)),
|
|
261
|
+
track={{ fill: s.color ?? cScale?.(c(d)), fillOpacity: 0.1 }}
|
|
261
262
|
{tooltip}
|
|
262
263
|
data={d}
|
|
263
264
|
onclick={(e) => {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
data: TData[];
|
|
56
56
|
color?: string;
|
|
57
57
|
props?: Partial<ComponentProps<Points>>;
|
|
58
|
-
}[] = [{ key: 'default', data: chartDataArray(data), color: '
|
|
58
|
+
}[] = [{ key: 'default', data: chartDataArray(data), color: 'var(--color-primary)' }];
|
|
59
59
|
$: isDefaultSeries = series.length === 1 && series[0].key === 'default';
|
|
60
60
|
|
|
61
61
|
export let axis: ComponentProps<Axis> | 'x' | 'y' | boolean = true;
|
|
@@ -240,6 +240,7 @@
|
|
|
240
240
|
visibleSeries,
|
|
241
241
|
getLabelsProps,
|
|
242
242
|
getPointsProps,
|
|
243
|
+
highlightSeriesKey,
|
|
243
244
|
setHighlightSeriesKey,
|
|
244
245
|
}}
|
|
245
246
|
{@const activeSeries = tooltip.data
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
>
|
|
217
217
|
<div
|
|
218
218
|
class={cls(
|
|
219
|
-
variant !== 'none' && ['text-sm py-1 px-2 h-full rounded elevation-1'],
|
|
219
|
+
variant !== 'none' && ['text-sm py-1 px-2 h-full rounded-sm elevation-1'],
|
|
220
220
|
{
|
|
221
221
|
default: [
|
|
222
222
|
'bg-surface-100/90 dark:bg-surface-300/90 backdrop-filter backdrop-blur-[2px] text-surface-content',
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<div
|
|
8
8
|
class={cls(
|
|
9
|
-
'bg-primary/10 border border-l-[6px] border-primary/30 border-l-primary text-primary px-4 py-2 my-4 rounded flex items-center gap-2 text-sm',
|
|
9
|
+
'bg-primary/10 border border-l-[6px] border-primary/30 border-l-primary text-primary px-4 py-2 my-4 rounded-sm flex items-center gap-2 text-sm',
|
|
10
10
|
'[&>a]:font-medium [&>a]:underline [&>a]:decoration-dashed [&>a]:decoration-primary/50 [&>a]:underline-offset-2'
|
|
11
11
|
)}
|
|
12
12
|
>
|
package/dist/docs/Code.svelte
CHANGED
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
} = {};
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
|
-
<div class={cls('Code', 'rounded', classes.root, $$props.class)}>
|
|
20
|
+
<div class={cls('Code', 'rounded-sm', classes.root, $$props.class)}>
|
|
21
21
|
{#if source}
|
|
22
22
|
<div class="relative">
|
|
23
23
|
<pre
|
|
24
|
-
class={cls('language-{language} rounded', classes.pre)}
|
|
24
|
+
class={cls('language-{language} rounded-sm', classes.pre)}
|
|
25
25
|
style="margin: 0; white-space: normal;">
|
|
26
26
|
<code class={cls('language-{language}', classes.code)}>{@html highlightedSource}</code>
|
|
27
27
|
</pre>
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
let showCenter = false;
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
class={cls('bg-surface-300/50 rounded-sm m-1 backdrop-blur-sm p-2 tabular-nums', $$props.class)}
|
|
17
|
+
>
|
|
16
18
|
<div class="grid gap-2 text-xs">
|
|
17
19
|
<div><span class="opacity-50">scale:</span> {format($geo.scale(), 'decimal')}</div>
|
|
18
20
|
|
|
@@ -48,6 +50,6 @@
|
|
|
48
50
|
|
|
49
51
|
{#if showCenter}
|
|
50
52
|
<div
|
|
51
|
-
class="absolute w-2 h-2 bg-danger/80 rounded-full z-
|
|
53
|
+
class="absolute w-2 h-2 bg-danger/80 rounded-full z-1 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
52
54
|
></div>
|
|
53
55
|
{/if}
|
package/dist/docs/Preview.svelte
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
|
-
<div class={cls('Preview border rounded bg-surface-100', $$props.class)}>
|
|
44
|
+
<div class={cls('Preview border rounded-sm bg-surface-100', $$props.class)}>
|
|
45
45
|
<div class="p-4">
|
|
46
46
|
<slot />
|
|
47
47
|
</div>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
<Dialog
|
|
71
71
|
{open}
|
|
72
72
|
on:close={toggleOff}
|
|
73
|
-
class="max-h-[98dvh] md:max-h-[90dvh] max-w-[98vw] md:max-w-[90vw] grid grid-rows-[
|
|
73
|
+
class="max-h-[98dvh] md:max-h-[90dvh] max-w-[98vw] md:max-w-[90vw] grid grid-rows-[auto_1fr_auto]"
|
|
74
74
|
>
|
|
75
75
|
<div class="grid grid-cols-[1fr_auto] gap-3 items-center p-4">
|
|
76
76
|
<div class="overflow-auto">
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
const { translate, scale } = transform;
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
|
-
<div
|
|
11
|
+
<div
|
|
12
|
+
class={cls('bg-surface-300/50 rounded-sm m-1 backdrop-blur-sm p-2 tabular-nums', $$props.class)}
|
|
13
|
+
>
|
|
12
14
|
<div class="grid gap-2 text-xs">
|
|
13
15
|
<div><span class="opacity-50">scale:</span> {format($scale, 'decimal')}</div>
|
|
14
16
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<Dialog
|
|
18
18
|
{open}
|
|
19
19
|
on:close={toggleOff}
|
|
20
|
-
class="max-h-[98dvh] md:max-h-[90dvh] max-w-[98vw] md:max-w-[90vw] grid grid-rows-[
|
|
20
|
+
class="max-h-[98dvh] md:max-h-[90dvh] max-w-[98vw] md:max-w-[90vw] grid grid-rows-[auto_1fr_auto]"
|
|
21
21
|
>
|
|
22
22
|
<div class="grid grid-cols-[1fr_auto] gap-3 items-center p-4">
|
|
23
23
|
<div class="overflow-auto">
|
package/dist/utils/canvas.js
CHANGED
|
@@ -3,7 +3,7 @@ import { memoize } from 'lodash-es';
|
|
|
3
3
|
export const DEFAULT_FILL = 'rgb(0, 0, 0)';
|
|
4
4
|
const CANVAS_STYLES_ELEMENT_ID = '__layerchart_canvas_styles_id';
|
|
5
5
|
/**
|
|
6
|
-
* Appends or reuses `<svg>` element below `<canvas>` to resolve CSS variables and classes (ex. `stroke:
|
|
6
|
+
* Appends or reuses `<svg>` element below `<canvas>` to resolve CSS variables and classes (ex. `stroke: var(--color-primary)` => `stroke: rgb(...)` )
|
|
7
7
|
*/
|
|
8
8
|
export function getComputedStyles(canvas, { styles, classes } = {}) {
|
|
9
9
|
try {
|
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": "
|
|
7
|
+
"version": "2.0.0-next.0",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@changesets/cli": "^2.28.1",
|
|
10
10
|
"@mdi/js": "^7.4.47",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"@sveltejs/package": "^2.3.10",
|
|
15
15
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
16
16
|
"@svitejs/changesets-changelog-github-compact": "^1.2.0",
|
|
17
|
+
"@tailwindcss/postcss": "^4.0.12",
|
|
17
18
|
"@tailwindcss/typography": "^0.5.16",
|
|
18
19
|
"@types/d3-array": "^3.2.1",
|
|
19
20
|
"@types/d3-color": "^3.1.3",
|
|
@@ -53,9 +54,9 @@
|
|
|
53
54
|
"svelte": "5.20.4",
|
|
54
55
|
"svelte-check": "^4.1.4",
|
|
55
56
|
"svelte-json-tree": "^2.2.0",
|
|
56
|
-
"svelte-ux": "
|
|
57
|
+
"svelte-ux": "2.0.0-next.1",
|
|
57
58
|
"svelte2tsx": "^0.7.34",
|
|
58
|
-
"tailwindcss": "^
|
|
59
|
+
"tailwindcss": "^4.0.12",
|
|
59
60
|
"topojson-client": "^3.1.0",
|
|
60
61
|
"topojson-simplify": "^3.0.3",
|
|
61
62
|
"tslib": "^2.8.1",
|
|
@@ -68,10 +69,10 @@
|
|
|
68
69
|
"type": "module",
|
|
69
70
|
"dependencies": {
|
|
70
71
|
"@dagrejs/dagre": "^1.1.4",
|
|
71
|
-
"@layerstack/svelte-actions": "
|
|
72
|
-
"@layerstack/svelte-stores": "
|
|
73
|
-
"@layerstack/tailwind": "
|
|
74
|
-
"@layerstack/utils": "
|
|
72
|
+
"@layerstack/svelte-actions": "1.0.1-next.0",
|
|
73
|
+
"@layerstack/svelte-stores": "1.0.2-next.0",
|
|
74
|
+
"@layerstack/tailwind": "2.0.0-next.1",
|
|
75
|
+
"@layerstack/utils": "1.1.0-next.0",
|
|
75
76
|
"d3-array": "^3.2.4",
|
|
76
77
|
"d3-color": "^3.1.0",
|
|
77
78
|
"d3-delaunay": "^6.0.4",
|
|
@@ -93,9 +94,7 @@
|
|
|
93
94
|
"d3-time": "^3.1.0",
|
|
94
95
|
"date-fns": "^4.1.0",
|
|
95
96
|
"layercake": "^8.4.2",
|
|
96
|
-
"lodash-es": "^4.17.21"
|
|
97
|
-
"shapefile": "^0.6.6",
|
|
98
|
-
"topojson-client": "^3.1.0"
|
|
97
|
+
"lodash-es": "^4.17.21"
|
|
99
98
|
},
|
|
100
99
|
"peerDependencies": {
|
|
101
100
|
"svelte": "^3.56.0 || ^4.0.0 || ^5.0.0"
|