layerchart 2.0.0-next.37 → 2.0.0-next.39
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/AnnotationLine.svelte +15 -2
- package/dist/components/AnnotationPoint.svelte +13 -2
- package/dist/components/AnnotationRange.svelte +16 -2
- package/dist/components/Arc.svelte +3 -3
- package/dist/components/Area.svelte +10 -2
- package/dist/components/Axis.svelte +43 -26
- package/dist/components/Axis.svelte.d.ts +10 -3
- package/dist/components/Bar.svelte +6 -5
- package/dist/components/Bar.svelte.d.ts +2 -2
- package/dist/components/Bars.svelte +3 -3
- package/dist/components/Blur.svelte +2 -3
- package/dist/components/BrushContext.svelte +44 -44
- package/dist/components/Calendar.svelte +21 -4
- package/dist/components/Chart.svelte +1 -2
- package/dist/components/Chart.svelte.d.ts +10 -3
- package/dist/components/ChartClipPath.svelte +1 -1
- package/dist/components/Circle.svelte +44 -3
- package/dist/components/CircleClipPath.svelte +8 -1
- package/dist/components/ClipPath.svelte +1 -2
- package/dist/components/ColorRamp.svelte +1 -1
- package/dist/components/ComputedStyles.svelte +9 -2
- package/dist/components/Connector.svelte +1 -1
- package/dist/components/Ellipse.svelte +44 -3
- package/dist/components/ForceSimulation.svelte.d.ts +10 -3
- package/dist/components/Frame.svelte +1 -1
- package/dist/components/GeoCircle.svelte +1 -1
- package/dist/components/GeoEdgeFade.svelte +1 -1
- package/dist/components/GeoPath.svelte +18 -3
- package/dist/components/GeoPoint.svelte +3 -3
- package/dist/components/GeoSpline.svelte +1 -1
- package/dist/components/GeoTile.svelte +1 -1
- package/dist/components/Graticule.svelte +5 -5
- package/dist/components/Grid.svelte +57 -60
- package/dist/components/Group.svelte +11 -6
- package/dist/components/Group.svelte.d.ts +10 -3
- package/dist/components/Highlight.svelte +46 -22
- package/dist/components/Highlight.svelte.d.ts +4 -0
- package/dist/components/Hull.svelte +11 -4
- package/dist/components/Labels.svelte +21 -11
- package/dist/components/Labels.svelte.d.ts +10 -3
- package/dist/components/Legend.svelte +133 -67
- package/dist/components/Legend.svelte.d.ts +7 -3
- package/dist/components/Line.svelte +40 -3
- package/dist/components/LinearGradient.svelte +35 -4
- package/dist/components/Link.svelte +1 -1
- package/dist/components/Marker.svelte +37 -26
- package/dist/components/MonthPath.svelte +14 -3
- package/dist/components/MotionPath.svelte +1 -1
- package/dist/components/Pack.svelte.d.ts +10 -3
- package/dist/components/Partition.svelte.d.ts +10 -3
- package/dist/components/Pattern.svelte +5 -5
- package/dist/components/Pie.svelte +1 -2
- package/dist/components/Points.svelte +1 -3
- package/dist/components/Polygon.svelte +27 -3
- package/dist/components/RadialGradient.svelte +3 -3
- package/dist/components/Rect.svelte +55 -5
- package/dist/components/Rect.svelte.d.ts +2 -2
- package/dist/components/RectClipPath.svelte +4 -3
- package/dist/components/RectClipPath.svelte.d.ts +2 -2
- package/dist/components/Rule.svelte +30 -23
- package/dist/components/Spline.svelte +29 -10
- package/dist/components/Text.svelte +59 -13
- package/dist/components/TileImage.svelte +19 -4
- package/dist/components/TransformContext.svelte +9 -3
- package/dist/components/TransformControls.svelte +72 -17
- package/dist/components/Tree.svelte.d.ts +10 -3
- package/dist/components/Treemap.svelte.d.ts +10 -3
- package/dist/components/Voronoi.svelte +12 -13
- package/dist/components/charts/ArcChart.svelte +40 -69
- package/dist/components/charts/ArcChart.svelte.d.ts +10 -3
- package/dist/components/charts/AreaChart.svelte +19 -42
- package/dist/components/charts/AreaChart.svelte.d.ts +10 -3
- package/dist/components/charts/BarChart.svelte +7 -18
- package/dist/components/charts/BarChart.svelte.d.ts +10 -3
- package/dist/components/charts/DefaultTooltip.svelte +2 -2
- package/dist/components/charts/DefaultTooltip.svelte.d.ts +1 -1
- package/dist/components/charts/LineChart.svelte +61 -66
- package/dist/components/charts/LineChart.svelte.d.ts +21 -8
- package/dist/components/charts/PieChart.svelte +41 -69
- package/dist/components/charts/PieChart.svelte.d.ts +10 -3
- package/dist/components/charts/ScatterChart.svelte +8 -19
- package/dist/components/charts/ScatterChart.svelte.d.ts +10 -3
- package/dist/components/charts/utils.svelte.d.ts +1 -19
- package/dist/components/charts/utils.svelte.js +7 -39
- package/dist/components/layout/Canvas.svelte +29 -20
- package/dist/components/layout/Html.svelte +15 -9
- package/dist/components/layout/Svg.svelte +19 -11
- package/dist/components/layout/WebGL.svelte +26 -6
- package/dist/components/layout/WebGL.svelte.d.ts +5 -2
- package/dist/components/tooltip/Tooltip.svelte +60 -29
- package/dist/components/tooltip/Tooltip.svelte.d.ts +10 -3
- package/dist/components/tooltip/TooltipContext.svelte +73 -36
- package/dist/components/tooltip/TooltipContext.svelte.d.ts +17 -3
- package/dist/components/tooltip/TooltipHeader.svelte +27 -14
- package/dist/components/tooltip/TooltipItem.svelte +41 -33
- package/dist/components/tooltip/TooltipList.svelte +12 -10
- package/dist/components/tooltip/TooltipSeparator.svelte +18 -10
- package/dist/states/series.svelte.d.ts +30 -0
- package/dist/states/series.svelte.js +54 -0
- package/dist/styles/daisyui-5.css +6 -0
- package/dist/styles/shadcn-svelte.css +11 -0
- package/dist/styles/skeleton-3.css +15 -0
- package/dist/utils/attributes.d.ts +3 -13
- package/dist/utils/attributes.js +4 -18
- package/dist/utils/common.d.ts +9 -0
- package/dist/utils/common.js +18 -1
- package/dist/utils/common.test.js +26 -1
- package/dist/utils/graph/dagre.d.ts +4 -4
- package/dist/utils/graph/dagre.js +5 -7
- package/dist/utils/math.d.ts +17 -0
- package/dist/utils/math.js +17 -0
- package/dist/utils/scales.svelte.js +3 -3
- package/dist/utils/stack.js +1 -1
- package/dist/utils/types.d.ts +15 -2
- package/package.json +25 -22
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
import { renderCircle, type ComputedStylesOptions } from '../utils/canvas.js';
|
|
69
69
|
import type { SVGAttributes } from 'svelte/elements';
|
|
70
70
|
import { createKey } from '../utils/key.svelte.js';
|
|
71
|
-
import { layerClass } from '../utils/attributes.js';
|
|
72
71
|
|
|
73
72
|
let {
|
|
74
73
|
cx = 0,
|
|
@@ -115,7 +114,7 @@
|
|
|
115
114
|
? merge({ styles: { strokeWidth } }, styleOverrides)
|
|
116
115
|
: {
|
|
117
116
|
styles: { fill, fillOpacity, stroke, strokeWidth, opacity },
|
|
118
|
-
classes: className,
|
|
117
|
+
classes: cls('lc-circle', className),
|
|
119
118
|
}
|
|
120
119
|
);
|
|
121
120
|
}
|
|
@@ -161,7 +160,49 @@
|
|
|
161
160
|
{stroke}
|
|
162
161
|
stroke-width={strokeWidth}
|
|
163
162
|
{opacity}
|
|
164
|
-
class={cls(
|
|
163
|
+
class={cls('lc-circle', className)}
|
|
165
164
|
{...restProps}
|
|
166
165
|
/>
|
|
166
|
+
{:else if renderCtx === 'html'}
|
|
167
|
+
<div
|
|
168
|
+
style:position="absolute"
|
|
169
|
+
style:left="{motionCx.current}px"
|
|
170
|
+
style:top="{motionCy.current}px"
|
|
171
|
+
style:width="{motionR.current * 2}px"
|
|
172
|
+
style:height="{motionR.current * 2}px"
|
|
173
|
+
style:border-radius="50%"
|
|
174
|
+
style:background-color={fill}
|
|
175
|
+
style:opacity
|
|
176
|
+
style:border-width={strokeWidth}
|
|
177
|
+
style:border-color={stroke}
|
|
178
|
+
style:border-style="solid"
|
|
179
|
+
style:transform="translate(-50%, -50%)"
|
|
180
|
+
class={cls('lc-circle', className)}
|
|
181
|
+
{...restProps}
|
|
182
|
+
></div>
|
|
167
183
|
{/if}
|
|
184
|
+
|
|
185
|
+
<style>
|
|
186
|
+
@layer base {
|
|
187
|
+
:global(:where(.lc-circle)) {
|
|
188
|
+
--fill-color: var(--color-surface-content, currentColor);
|
|
189
|
+
--stroke-color: initial;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* Svg | Canvas layers */
|
|
193
|
+
:global(:where(.lc-layout-svg .lc-circle, svg.lc-circle):not([fill])) {
|
|
194
|
+
fill: var(--fill-color);
|
|
195
|
+
}
|
|
196
|
+
:global(:where(.lc-layout-svg .lc-circle, svg.lc-circle):not([stroke])) {
|
|
197
|
+
stroke: var(--stroke-color);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* Html layers */
|
|
201
|
+
:global(:where(.lc-layout-html .lc-circle):not([background-color])) {
|
|
202
|
+
background-color: var(--fill-color);
|
|
203
|
+
}
|
|
204
|
+
:global(:where(.lc-layout-html .lc-circle):not([border-color])) {
|
|
205
|
+
border-color: var(--stroke-color);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
</style>
|
|
@@ -80,6 +80,13 @@
|
|
|
80
80
|
|
|
81
81
|
<ClipPath {id} {disabled} {children}>
|
|
82
82
|
{#snippet clip()}
|
|
83
|
-
<Circle
|
|
83
|
+
<Circle
|
|
84
|
+
{cx}
|
|
85
|
+
{cy}
|
|
86
|
+
{r}
|
|
87
|
+
{motion}
|
|
88
|
+
{...extractLayerProps(restProps, 'lc-clip-path-circle')}
|
|
89
|
+
bind:ref
|
|
90
|
+
/>
|
|
84
91
|
{/snippet}
|
|
85
92
|
</ClipPath>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import { createId } from '../utils/createId.js';
|
|
3
3
|
import type { Without } from '../utils/types.js';
|
|
4
|
-
import { layerClass } from '../utils/attributes.js';
|
|
5
4
|
import type { Snippet } from 'svelte';
|
|
6
5
|
import type { SVGAttributes } from 'svelte/elements';
|
|
7
6
|
import { getRenderContext } from './Chart.svelte';
|
|
@@ -76,7 +75,7 @@
|
|
|
76
75
|
{#if disabled || renderContext !== 'svg'}
|
|
77
76
|
{@render children({ id, url, useId })}
|
|
78
77
|
{:else}
|
|
79
|
-
<g style:clip-path={url} class=
|
|
78
|
+
<g style:clip-path={url} class="lc-clip-path-g">
|
|
80
79
|
{@render children({ id, url, useId })}
|
|
81
80
|
</g>
|
|
82
81
|
{/if}
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
<script lang="ts">
|
|
14
14
|
import { computedStyles } from '@layerstack/svelte-actions';
|
|
15
15
|
import { cls } from '@layerstack/tailwind';
|
|
16
|
-
import { layerClass } from '../utils/attributes.js';
|
|
17
16
|
|
|
18
17
|
let { class: className, children }: ComputedStylesProps = $props();
|
|
19
18
|
|
|
@@ -21,8 +20,16 @@
|
|
|
21
20
|
</script>
|
|
22
21
|
|
|
23
22
|
<div
|
|
24
|
-
class={cls(
|
|
23
|
+
class={cls('lc-computed-styles', className)}
|
|
25
24
|
use:computedStyles={(_styles) => (styles = _styles)}
|
|
26
25
|
></div>
|
|
27
26
|
|
|
28
27
|
{@render children?.({ styles })}
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
@layer base {
|
|
31
|
+
:global(:where(.lc-computed-styles)) {
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
marker-start={markerStartId ? `url(#${markerStartId})` : undefined}
|
|
142
142
|
marker-mid={markerMidId ? `url(#${markerMidId})` : undefined}
|
|
143
143
|
marker-end={markerEndId ? `url(#${markerEndId})` : undefined}
|
|
144
|
-
{...extractLayerProps(restProps, 'connector')}
|
|
144
|
+
{...extractLayerProps(restProps, 'lc-connector')}
|
|
145
145
|
{...restProps}
|
|
146
146
|
/>
|
|
147
147
|
<MarkerWrapper id={markerStartId} marker={markerStart} />
|
|
@@ -82,7 +82,6 @@
|
|
|
82
82
|
import { renderEllipse, type ComputedStylesOptions } from '../utils/canvas.js';
|
|
83
83
|
import type { SVGAttributes } from 'svelte/elements';
|
|
84
84
|
import { createKey } from '../utils/key.svelte.js';
|
|
85
|
-
import { layerClass } from '../utils/attributes.js';
|
|
86
85
|
|
|
87
86
|
let {
|
|
88
87
|
cx = 0,
|
|
@@ -133,7 +132,7 @@
|
|
|
133
132
|
? merge({ styles: { strokeWidth } }, styleOverrides)
|
|
134
133
|
: {
|
|
135
134
|
styles: { fill, fillOpacity, stroke, strokeWidth, opacity },
|
|
136
|
-
classes: className,
|
|
135
|
+
classes: cls('lc-ellipse', className),
|
|
137
136
|
}
|
|
138
137
|
);
|
|
139
138
|
}
|
|
@@ -181,7 +180,49 @@
|
|
|
181
180
|
{stroke}
|
|
182
181
|
stroke-width={strokeWidth}
|
|
183
182
|
{opacity}
|
|
184
|
-
class={cls(
|
|
183
|
+
class={cls('lc-ellipse', className)}
|
|
185
184
|
{...restProps}
|
|
186
185
|
/>
|
|
186
|
+
{:else if renderCtx === 'html'}
|
|
187
|
+
<div
|
|
188
|
+
style:position="absolute"
|
|
189
|
+
style:left="{motionCx.current}px"
|
|
190
|
+
style:top="{motionCy.current}px"
|
|
191
|
+
style:width="{motionRx.current * 2}px"
|
|
192
|
+
style:height="{motionRy.current * 2}px"
|
|
193
|
+
style:border-radius="50%"
|
|
194
|
+
style:background-color={fill}
|
|
195
|
+
style:opacity
|
|
196
|
+
style:border-width={strokeWidth}
|
|
197
|
+
style:border-color={stroke}
|
|
198
|
+
style:border-style="solid"
|
|
199
|
+
style:transform="translate(-50%, -50%)"
|
|
200
|
+
class={cls('lc-ellipse', className)}
|
|
201
|
+
{...restProps}
|
|
202
|
+
></div>
|
|
187
203
|
{/if}
|
|
204
|
+
|
|
205
|
+
<style>
|
|
206
|
+
@layer base {
|
|
207
|
+
:global(:where(.lc-ellipse)) {
|
|
208
|
+
--fill-color: var(--color-surface-content, currentColor);
|
|
209
|
+
--stroke-color: initial;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* Svg | Canvas layers */
|
|
213
|
+
:global(:where(.lc-layout-svg .lc-ellipse, svg.lc-ellipse):not([fill])) {
|
|
214
|
+
fill: var(--fill-color);
|
|
215
|
+
}
|
|
216
|
+
:global(:where(.lc-layout-svg .lc-ellipse, svg.lc-ellipse):not([stroke])) {
|
|
217
|
+
stroke: var(--stroke-color);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* Html layers */
|
|
221
|
+
:global(:where(.lc-layout-html .lc-ellipse):not([background-color])) {
|
|
222
|
+
background-color: var(--fill-color);
|
|
223
|
+
}
|
|
224
|
+
:global(:where(.lc-layout-html .lc-ellipse):not([border-color])) {
|
|
225
|
+
border-color: var(--stroke-color);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
</style>
|
|
@@ -132,10 +132,17 @@ export type ForceSimulationProps<NodeDatum extends SimulationNodeDatum, LinkDatu
|
|
|
132
132
|
}
|
|
133
133
|
]>;
|
|
134
134
|
};
|
|
135
|
+
declare function $$render<NodeDatum extends SimulationNodeDatum, LinkDatum extends SimulationLinkDatum<NodeDatum> | undefined>(): {
|
|
136
|
+
props: ForceSimulationProps<NodeDatum, LinkDatum>;
|
|
137
|
+
exports: {};
|
|
138
|
+
bindings: "alpha";
|
|
139
|
+
slots: {};
|
|
140
|
+
events: {};
|
|
141
|
+
};
|
|
135
142
|
declare class __sveltets_Render<NodeDatum extends SimulationNodeDatum, LinkDatum extends SimulationLinkDatum<NodeDatum> | undefined> {
|
|
136
|
-
props():
|
|
137
|
-
events():
|
|
138
|
-
slots():
|
|
143
|
+
props(): ReturnType<typeof $$render<NodeDatum, LinkDatum>>['props'];
|
|
144
|
+
events(): ReturnType<typeof $$render<NodeDatum, LinkDatum>>['events'];
|
|
145
|
+
slots(): ReturnType<typeof $$render<NodeDatum, LinkDatum>>['slots'];
|
|
139
146
|
bindings(): "alpha";
|
|
140
147
|
exports(): {};
|
|
141
148
|
}
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
width={ctx.width + (full ? (ctx.padding?.left ?? 0) + (ctx.padding?.right ?? 0) : 0)}
|
|
38
38
|
height={ctx.height + (full ? (ctx.padding?.top ?? 0) + (ctx.padding?.bottom ?? 0) : 0)}
|
|
39
39
|
bind:ref
|
|
40
|
-
{...extractLayerProps(restProps, 'frame')}
|
|
40
|
+
{...extractLayerProps(restProps, 'lc-frame')}
|
|
41
41
|
/>
|
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
const opacity = $derived(opacityProp ?? clamper(fade(distance)));
|
|
57
57
|
</script>
|
|
58
58
|
|
|
59
|
-
<Group {opacity} bind:ref {...extractLayerProps(restProps, 'geo-edge-fade')}>
|
|
59
|
+
<Group {opacity} bind:ref {...extractLayerProps(restProps, 'lc-geo-edge-fade')}>
|
|
60
60
|
{@render children?.()}
|
|
61
61
|
</Group>
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
</script>
|
|
67
67
|
|
|
68
68
|
<script lang="ts">
|
|
69
|
-
import { cls } from '@layerstack/tailwind';
|
|
70
69
|
import { merge } from 'lodash-es';
|
|
71
70
|
|
|
72
71
|
import { getRenderContext } from './Chart.svelte';
|
|
@@ -74,7 +73,6 @@
|
|
|
74
73
|
import { geoCurvePath } from '../utils/geo.js';
|
|
75
74
|
import { getGeoContext } from './GeoContext.svelte';
|
|
76
75
|
import { createKey } from '../utils/key.svelte.js';
|
|
77
|
-
import { layerClass } from '../utils/attributes.js';
|
|
78
76
|
|
|
79
77
|
let {
|
|
80
78
|
fill,
|
|
@@ -199,6 +197,23 @@
|
|
|
199
197
|
onpointerenter={_onPointerEnter}
|
|
200
198
|
onpointermove={_onPointerMove}
|
|
201
199
|
onpointerleave={_onPointerLeave}
|
|
202
|
-
class={
|
|
200
|
+
class={['lc-geo-path', className]}
|
|
203
201
|
/>
|
|
204
202
|
{/if}
|
|
203
|
+
|
|
204
|
+
<style>
|
|
205
|
+
@layer base {
|
|
206
|
+
:global(:where(.lc-geo-path)) {
|
|
207
|
+
--fill-color: transparent;
|
|
208
|
+
--stroke-color: initial;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* Svg | Canvas layers */
|
|
212
|
+
:global(:where(.lc-layout-svg .lc-geo-path, svg.lc-geo-path):not([fill])) {
|
|
213
|
+
fill: var(--fill-color);
|
|
214
|
+
}
|
|
215
|
+
:global(:where(.lc-layout-svg .lc-geo-path, svg.lc-geo-path):not([stroke])) {
|
|
216
|
+
stroke: var(--stroke-color);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
</style>
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
|
|
54
54
|
{#if renderContext === 'svg'}
|
|
55
55
|
{#if children}
|
|
56
|
-
<Group {x} {y} {...extractLayerProps(restProps, 'geo-point-group')}>
|
|
56
|
+
<Group {x} {y} {...extractLayerProps(restProps, 'lc-geo-point-group')}>
|
|
57
57
|
{@render children({ x, y })}
|
|
58
58
|
</Group>
|
|
59
59
|
{:else}
|
|
60
|
-
<Circle cx={x} cy={y} {...extractLayerProps(restProps, 'geo-point')} />
|
|
60
|
+
<Circle cx={x} cy={y} {...extractLayerProps(restProps, 'lc-geo-point')} />
|
|
61
61
|
{/if}
|
|
62
62
|
{/if}
|
|
63
63
|
|
|
@@ -68,6 +68,6 @@
|
|
|
68
68
|
{@render children({ x, y })}
|
|
69
69
|
<!-- </Group> -->
|
|
70
70
|
{:else}
|
|
71
|
-
<Circle cx={x} cy={y} {...extractLayerProps(restProps, 'geo-point')} />
|
|
71
|
+
<Circle cx={x} cy={y} {...extractLayerProps(restProps, 'lc-geo-point')} />
|
|
72
72
|
{/if}
|
|
73
73
|
{/if}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<script lang="ts">
|
|
17
17
|
import { geoGraticule } from 'd3-geo';
|
|
18
|
-
import { extractLayerProps
|
|
18
|
+
import { extractLayerProps } from '../utils/attributes.js';
|
|
19
19
|
import Group from './Group.svelte';
|
|
20
20
|
|
|
21
21
|
let { lines, outline, step = [10, 10], ...restProps }: GraticuleProps = $props();
|
|
@@ -27,22 +27,22 @@
|
|
|
27
27
|
});
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
|
-
<Group class=
|
|
30
|
+
<Group class="lc-graticule-g">
|
|
31
31
|
<!-- TODO: Any reason to still render the single `MultiLineString` path if using `lines` and/or `outline` -->
|
|
32
32
|
{#if !lines && !outline}
|
|
33
|
-
<GeoPath geojson={graticule()} {...extractLayerProps(restProps, 'graticule-geo-path')} />
|
|
33
|
+
<GeoPath geojson={graticule()} {...extractLayerProps(restProps, 'lc-graticule-geo-path')} />
|
|
34
34
|
{/if}
|
|
35
35
|
|
|
36
36
|
{#if lines}
|
|
37
37
|
{#each graticule.lines() as line}
|
|
38
|
-
<GeoPath geojson={line} {...extractLayerProps(lines, 'graticule-geo-line')} />
|
|
38
|
+
<GeoPath geojson={line} {...extractLayerProps(lines, 'lc-graticule-geo-line')} />
|
|
39
39
|
{/each}
|
|
40
40
|
{/if}
|
|
41
41
|
|
|
42
42
|
{#if outline}
|
|
43
43
|
<GeoPath
|
|
44
44
|
geojson={graticule.outline()}
|
|
45
|
-
{...extractLayerProps(outline, 'graticule-geo-outline')}
|
|
45
|
+
{...extractLayerProps(outline, 'lc-graticule-geo-outline')}
|
|
46
46
|
/>
|
|
47
47
|
{/if}
|
|
48
48
|
</Group>
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
import Rule from './Rule.svelte';
|
|
99
99
|
import Spline from './Spline.svelte';
|
|
100
100
|
import { getChartContext } from './Chart.svelte';
|
|
101
|
-
import { extractLayerProps
|
|
101
|
+
import { extractLayerProps } from '../utils/attributes.js';
|
|
102
102
|
import { autoTickVals, type TicksConfig } from '../utils/ticks.js';
|
|
103
103
|
|
|
104
104
|
const ctx = getChartContext();
|
|
@@ -151,11 +151,11 @@
|
|
|
151
151
|
);
|
|
152
152
|
</script>
|
|
153
153
|
|
|
154
|
-
<Group bind:ref class={cls(
|
|
154
|
+
<Group bind:ref class={cls('lc-grid', classes.root, className)} {...restProps}>
|
|
155
155
|
{#if x}
|
|
156
|
-
{@const splineProps = extractLayerProps(x, 'grid-x-line')}
|
|
156
|
+
{@const splineProps = extractLayerProps(x, 'lc-grid-x-line')}
|
|
157
157
|
|
|
158
|
-
<Group {transitionIn} {transitionInParams} class=
|
|
158
|
+
<Group {transitionIn} {transitionInParams} class="lc-grid-x">
|
|
159
159
|
{#each xTickVals as x (x)}
|
|
160
160
|
{#if ctx.radial}
|
|
161
161
|
{@const [x1, y1] = pointRadial(ctx.xScale(x), ctx.yRange[0])}
|
|
@@ -167,12 +167,7 @@
|
|
|
167
167
|
{y2}
|
|
168
168
|
motion={tweenConfig}
|
|
169
169
|
{...splineProps}
|
|
170
|
-
class={cls(
|
|
171
|
-
layerClass('grid-x-radial-line'),
|
|
172
|
-
'stroke-surface-content/10',
|
|
173
|
-
classes.line,
|
|
174
|
-
splineProps?.class
|
|
175
|
-
)}
|
|
170
|
+
class={cls('lc-grid-x-radial-line', classes.line, splineProps?.class)}
|
|
176
171
|
/>
|
|
177
172
|
{:else}
|
|
178
173
|
<Rule
|
|
@@ -180,37 +175,28 @@
|
|
|
180
175
|
xOffset={xBandOffset}
|
|
181
176
|
{motion}
|
|
182
177
|
{...splineProps}
|
|
183
|
-
class={cls(
|
|
184
|
-
layerClass('grid-x-rule'),
|
|
185
|
-
'stroke-surface-content/10',
|
|
186
|
-
classes.line,
|
|
187
|
-
splineProps?.class
|
|
188
|
-
)}
|
|
178
|
+
class={cls('lc-grid-x-rule', classes.line, splineProps?.class)}
|
|
189
179
|
/>
|
|
190
180
|
{/if}
|
|
191
181
|
{/each}
|
|
192
182
|
|
|
193
183
|
<!-- Add extra rule after last band -->
|
|
194
184
|
{#if isScaleBand(ctx.xScale) && bandAlign === 'between' && !ctx.radial && xTickVals.length}
|
|
185
|
+
{@const x = ctx.xScale(xTickVals[xTickVals.length - 1])! + ctx.xScale.step() + xBandOffset}
|
|
195
186
|
<Rule
|
|
196
187
|
x={xTickVals[xTickVals.length - 1]}
|
|
197
188
|
xOffset={ctx.xScale.step() + xBandOffset}
|
|
198
189
|
{motion}
|
|
199
190
|
{...splineProps}
|
|
200
|
-
class={cls(
|
|
201
|
-
layerClass('grid-x-end-rule'),
|
|
202
|
-
'stroke-surface-content/10',
|
|
203
|
-
classes.line,
|
|
204
|
-
splineProps?.class
|
|
205
|
-
)}
|
|
191
|
+
class={cls('lc-grid-x-end-rule', classes.line, splineProps?.class)}
|
|
206
192
|
/>
|
|
207
193
|
{/if}
|
|
208
194
|
</Group>
|
|
209
195
|
{/if}
|
|
210
196
|
|
|
211
197
|
{#if y}
|
|
212
|
-
{@const splineProps = extractLayerProps(y, 'grid-y-line')}
|
|
213
|
-
<Group {transitionIn} {transitionInParams} class=
|
|
198
|
+
{@const splineProps = extractLayerProps(y, 'lc-grid-y-line')}
|
|
199
|
+
<Group {transitionIn} {transitionInParams} class="lc-grid-y">
|
|
214
200
|
{#each yTickVals as y (y)}
|
|
215
201
|
{#if ctx.radial}
|
|
216
202
|
{#if radialY === 'circle'}
|
|
@@ -218,12 +204,7 @@
|
|
|
218
204
|
r={ctx.yScale(y) + yBandOffset}
|
|
219
205
|
{motion}
|
|
220
206
|
{...splineProps}
|
|
221
|
-
class={cls(
|
|
222
|
-
layerClass('grid-y-radial-circle'),
|
|
223
|
-
'fill-none stroke-surface-content/10',
|
|
224
|
-
classes.line,
|
|
225
|
-
splineProps?.class
|
|
226
|
-
)}
|
|
207
|
+
class={cls('lc-grid-y-radial-circle', classes.line, splineProps?.class)}
|
|
227
208
|
/>
|
|
228
209
|
{:else}
|
|
229
210
|
<Spline
|
|
@@ -233,26 +214,18 @@
|
|
|
233
214
|
motion={tweenConfig}
|
|
234
215
|
curve={curveLinearClosed}
|
|
235
216
|
{...splineProps}
|
|
236
|
-
class={cls(
|
|
237
|
-
layerClass('grid-y-radial-line'),
|
|
238
|
-
'stroke-surface-content/10',
|
|
239
|
-
classes.line,
|
|
240
|
-
splineProps?.class
|
|
241
|
-
)}
|
|
217
|
+
class={cls('lc-grid-y-radial-line', classes.line, splineProps?.class)}
|
|
242
218
|
/>
|
|
243
219
|
{/if}
|
|
244
220
|
{:else}
|
|
245
|
-
<
|
|
246
|
-
{
|
|
247
|
-
|
|
221
|
+
<Line
|
|
222
|
+
x1={ctx.xRange[0]}
|
|
223
|
+
y1={ctx.yScale(y) + yBandOffset}
|
|
224
|
+
x2={ctx.xRange[1]}
|
|
225
|
+
y2={ctx.yScale(y) + yBandOffset}
|
|
248
226
|
{motion}
|
|
249
227
|
{...splineProps}
|
|
250
|
-
class={cls(
|
|
251
|
-
layerClass('grid-y-rule'),
|
|
252
|
-
'stroke-surface-content/10',
|
|
253
|
-
classes.line,
|
|
254
|
-
splineProps?.class
|
|
255
|
-
)}
|
|
228
|
+
class={cls('lc-grid-y-rule', classes.line, splineProps?.class)}
|
|
256
229
|
/>
|
|
257
230
|
{/if}
|
|
258
231
|
{/each}
|
|
@@ -264,28 +237,52 @@
|
|
|
264
237
|
r={ctx.yScale(yTickVals[yTickVals.length - 1])! + ctx.yScale.step() + yBandOffset}
|
|
265
238
|
{motion}
|
|
266
239
|
{...splineProps}
|
|
267
|
-
class={cls(
|
|
268
|
-
layerClass('grid-y-radial-circle'),
|
|
269
|
-
'fill-none stroke-surface-content/10',
|
|
270
|
-
classes.line,
|
|
271
|
-
splineProps?.class
|
|
272
|
-
)}
|
|
240
|
+
class={cls('lc-grid-y-radial-circle', classes.line, splineProps?.class)}
|
|
273
241
|
/>
|
|
274
242
|
{:else}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
243
|
+
{@const y =
|
|
244
|
+
ctx.yScale(yTickVals[yTickVals.length - 1])! + ctx.yScale.step() + yBandOffset}
|
|
245
|
+
<Line
|
|
246
|
+
x1={ctx.xRange[0]}
|
|
247
|
+
y1={y}
|
|
248
|
+
x2={ctx.xRange[1]}
|
|
249
|
+
y2={y}
|
|
278
250
|
{motion}
|
|
279
251
|
{...splineProps}
|
|
280
|
-
class={cls(
|
|
281
|
-
layerClass('grid-y-end-rule'),
|
|
282
|
-
'stroke-surface-content/10',
|
|
283
|
-
classes.line,
|
|
284
|
-
splineProps?.class
|
|
285
|
-
)}
|
|
252
|
+
class={cls('lc-grid-y-end-rule', classes.line, splineProps?.class)}
|
|
286
253
|
/>
|
|
287
254
|
{/if}
|
|
288
255
|
{/if}
|
|
289
256
|
</Group>
|
|
290
257
|
{/if}
|
|
291
258
|
</Group>
|
|
259
|
+
|
|
260
|
+
<style>
|
|
261
|
+
@layer components {
|
|
262
|
+
:global(
|
|
263
|
+
:where(
|
|
264
|
+
.lc-grid-x-rule,
|
|
265
|
+
.lc-grid-x-end-rule,
|
|
266
|
+
.lc-grid-x-radial-line,
|
|
267
|
+
.lc-grid-y-rule,
|
|
268
|
+
.lc-grid-y-end-rule,
|
|
269
|
+
.lc-grid-y-radial-line
|
|
270
|
+
)
|
|
271
|
+
) {
|
|
272
|
+
--stroke-color: color-mix(
|
|
273
|
+
in oklab,
|
|
274
|
+
var(--color-surface-content, currentColor) 10%,
|
|
275
|
+
transparent
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
:global(:where(.lc-grid-y-radial-circle)) {
|
|
280
|
+
--fill-color: none;
|
|
281
|
+
--stroke-color: color-mix(
|
|
282
|
+
in oklab,
|
|
283
|
+
var(--color-surface-content, currentColor) 10%,
|
|
284
|
+
transparent
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
</style>
|
|
@@ -83,13 +83,10 @@
|
|
|
83
83
|
import { fade } from 'svelte/transition';
|
|
84
84
|
import { cubicIn } from 'svelte/easing';
|
|
85
85
|
|
|
86
|
-
import { cls } from '@layerstack/tailwind';
|
|
87
|
-
|
|
88
86
|
import { getRenderContext } from './Chart.svelte';
|
|
89
87
|
import { registerCanvasComponent } from './layout/Canvas.svelte';
|
|
90
88
|
|
|
91
89
|
import { getChartContext } from './Chart.svelte';
|
|
92
|
-
import { layerClass } from '../utils/attributes.js';
|
|
93
90
|
|
|
94
91
|
const ctx = getChartContext();
|
|
95
92
|
|
|
@@ -178,7 +175,7 @@
|
|
|
178
175
|
{:else if renderCtx === 'svg'}
|
|
179
176
|
<g
|
|
180
177
|
style:transform
|
|
181
|
-
class={
|
|
178
|
+
class={['lc-group-g', className]}
|
|
182
179
|
in:transitionIn={transitionInParams}
|
|
183
180
|
{opacity}
|
|
184
181
|
{...restProps}
|
|
@@ -187,16 +184,24 @@
|
|
|
187
184
|
>
|
|
188
185
|
{@render children?.()}
|
|
189
186
|
</g>
|
|
190
|
-
{:else}
|
|
187
|
+
{:else if renderCtx === 'html'}
|
|
191
188
|
<div
|
|
192
189
|
bind:this={ref}
|
|
193
190
|
style:transform
|
|
194
191
|
style:opacity
|
|
195
192
|
in:transitionIn={transitionInParams}
|
|
196
193
|
{...restProps}
|
|
197
|
-
class={
|
|
194
|
+
class={['lc-group-div', className]}
|
|
198
195
|
ontouchmove={handleTouchMove}
|
|
199
196
|
>
|
|
200
197
|
{@render children?.()}
|
|
201
198
|
</div>
|
|
202
199
|
{/if}
|
|
200
|
+
|
|
201
|
+
<style>
|
|
202
|
+
@layer base {
|
|
203
|
+
:where(.lc-group-div) {
|
|
204
|
+
position: absolute;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
</style>
|
|
@@ -62,10 +62,17 @@ export type GroupPropsWithoutHTML<In extends Transition = Transition> = {
|
|
|
62
62
|
transitionInParams?: TransitionParams<In>;
|
|
63
63
|
};
|
|
64
64
|
export type GroupProps = GroupPropsWithoutHTML & Without<HTMLAttributes<Element>, GroupPropsWithoutHTML>;
|
|
65
|
+
declare function $$render<T extends Transition = Transition>(): {
|
|
66
|
+
props: GroupProps;
|
|
67
|
+
exports: {};
|
|
68
|
+
bindings: "ref";
|
|
69
|
+
slots: {};
|
|
70
|
+
events: {};
|
|
71
|
+
};
|
|
65
72
|
declare class __sveltets_Render<T extends Transition = Transition> {
|
|
66
|
-
props():
|
|
67
|
-
events():
|
|
68
|
-
slots():
|
|
73
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
74
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
75
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
69
76
|
bindings(): "ref";
|
|
70
77
|
exports(): {};
|
|
71
78
|
}
|