layerchart 2.0.0-next.38 → 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/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/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/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/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/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/Pattern.svelte +5 -5
- package/dist/components/Pie.svelte +1 -2
- package/dist/components/Points.svelte +1 -1
- 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/Voronoi.svelte +12 -13
- package/dist/components/charts/ArcChart.svelte +40 -69
- package/dist/components/charts/AreaChart.svelte +19 -42
- package/dist/components/charts/BarChart.svelte +7 -18
- 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 +11 -5
- package/dist/components/charts/PieChart.svelte +41 -69
- package/dist/components/charts/ScatterChart.svelte +8 -19
- 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/TooltipContext.svelte +73 -36
- package/dist/components/tooltip/TooltipContext.svelte.d.ts +7 -0
- 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/math.d.ts +17 -0
- package/dist/utils/math.js +17 -0
- package/dist/utils/types.d.ts +15 -2
- package/package.json +5 -1
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
x2={line.x2}
|
|
131
131
|
y2={line.y2}
|
|
132
132
|
{...props?.line}
|
|
133
|
-
class={cls('
|
|
133
|
+
class={cls('lc-annotation-line', props?.line?.class)}
|
|
134
134
|
/>
|
|
135
135
|
|
|
136
136
|
{#if label}
|
|
@@ -138,6 +138,19 @@
|
|
|
138
138
|
value={label}
|
|
139
139
|
{...labelProps}
|
|
140
140
|
{...props?.label}
|
|
141
|
-
class={cls('
|
|
141
|
+
class={cls('lc-annotation-line-label', props?.label?.class)}
|
|
142
142
|
/>
|
|
143
143
|
{/if}
|
|
144
|
+
|
|
145
|
+
<style>
|
|
146
|
+
@layer components {
|
|
147
|
+
:global(:where(.lc-annotation-line)) {
|
|
148
|
+
--stroke-color: var(--color-surface-content, currentColor);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:global(:where(.lc-annotation-line-label)) {
|
|
152
|
+
font-size: 12px;
|
|
153
|
+
pointer-events: none;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
</style>
|
|
@@ -108,12 +108,14 @@
|
|
|
108
108
|
cx={point.x}
|
|
109
109
|
cy={point.y}
|
|
110
110
|
{r}
|
|
111
|
+
onpointermove={onPointerMove}
|
|
111
112
|
onmousemove={onPointerMove}
|
|
112
113
|
ontouchmove={onPointerMove}
|
|
114
|
+
onpointerleave={onPointerLeave}
|
|
113
115
|
onmouseleave={onPointerLeave}
|
|
114
116
|
ontouchend={onPointerLeave}
|
|
115
117
|
{...props?.circle}
|
|
116
|
-
class={cls('
|
|
118
|
+
class={cls('lc-annotation-point', props?.circle?.class)}
|
|
117
119
|
/>
|
|
118
120
|
|
|
119
121
|
{#if label}
|
|
@@ -121,6 +123,15 @@
|
|
|
121
123
|
value={label}
|
|
122
124
|
{...labelProps}
|
|
123
125
|
{...props?.label}
|
|
124
|
-
class={cls('
|
|
126
|
+
class={cls('lc-annotation-point-label', props?.label?.class)}
|
|
125
127
|
/>
|
|
126
128
|
{/if}
|
|
129
|
+
|
|
130
|
+
<style>
|
|
131
|
+
@layer components {
|
|
132
|
+
:global(:where(.lc-annotation-point-label)) {
|
|
133
|
+
font-size: 12px;
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
</style>
|
|
@@ -118,7 +118,12 @@
|
|
|
118
118
|
</script>
|
|
119
119
|
|
|
120
120
|
{#if fill || className}
|
|
121
|
-
<Rect
|
|
121
|
+
<Rect
|
|
122
|
+
{...rect}
|
|
123
|
+
{...props?.rect}
|
|
124
|
+
{fill}
|
|
125
|
+
class={cls('lc-annotation-range', props?.rect?.class, className)}
|
|
126
|
+
/>
|
|
122
127
|
{/if}
|
|
123
128
|
|
|
124
129
|
{#if gradient}
|
|
@@ -142,6 +147,15 @@
|
|
|
142
147
|
value={label}
|
|
143
148
|
{...labelProps}
|
|
144
149
|
{...props?.label}
|
|
145
|
-
class={cls('
|
|
150
|
+
class={cls('lc-annotation-range-label', props?.label?.class)}
|
|
146
151
|
/>
|
|
147
152
|
{/if}
|
|
153
|
+
|
|
154
|
+
<style>
|
|
155
|
+
@layer components {
|
|
156
|
+
:global(:where(.lc-annotation-range-label)) {
|
|
157
|
+
font-size: 12px;
|
|
158
|
+
pointer-events: none;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
</style>
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
|
|
190
190
|
import { degreesToRadians } from '../utils/math.js';
|
|
191
191
|
import { getChartContext } from './Chart.svelte';
|
|
192
|
-
import { extractLayerProps
|
|
192
|
+
import { extractLayerProps } from '../utils/attributes.js';
|
|
193
193
|
import { cls } from '@layerstack/tailwind';
|
|
194
194
|
import { max } from 'd3-array';
|
|
195
195
|
import {
|
|
@@ -402,7 +402,7 @@
|
|
|
402
402
|
pathData={trackArc()}
|
|
403
403
|
stroke="none"
|
|
404
404
|
bind:pathRef={trackRef}
|
|
405
|
-
{...extractLayerProps(track, 'arc-track')}
|
|
405
|
+
{...extractLayerProps(track, 'lc-arc-track')}
|
|
406
406
|
/>
|
|
407
407
|
{/if}
|
|
408
408
|
|
|
@@ -416,7 +416,7 @@
|
|
|
416
416
|
stroke-width={strokeWidth}
|
|
417
417
|
{opacity}
|
|
418
418
|
{...restProps}
|
|
419
|
-
class={cls(
|
|
419
|
+
class={cls('lc-arc-line', className)}
|
|
420
420
|
onpointerenter={onPointerEnter}
|
|
421
421
|
onpointermove={onPointerMove}
|
|
422
422
|
onpointerleave={onPointerLeave}
|
|
@@ -239,7 +239,15 @@
|
|
|
239
239
|
</script>
|
|
240
240
|
|
|
241
241
|
{#if line}
|
|
242
|
-
<Spline
|
|
242
|
+
<Spline
|
|
243
|
+
{data}
|
|
244
|
+
{x}
|
|
245
|
+
y={y1}
|
|
246
|
+
{curve}
|
|
247
|
+
{defined}
|
|
248
|
+
{motion}
|
|
249
|
+
{...extractLayerProps(line, 'lc-area-line')}
|
|
250
|
+
/>
|
|
243
251
|
{/if}
|
|
244
252
|
|
|
245
253
|
{#if renderCtx === 'svg'}
|
|
@@ -251,6 +259,6 @@
|
|
|
251
259
|
{stroke}
|
|
252
260
|
stroke-width={strokeWidth}
|
|
253
261
|
{opacity}
|
|
254
|
-
{...extractLayerProps(restProps, 'area-path')}
|
|
262
|
+
{...extractLayerProps(restProps, 'lc-area-path')}
|
|
255
263
|
/>
|
|
256
264
|
{/if}
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
import { isScaleBand } from '../utils/scales.svelte.js';
|
|
146
146
|
|
|
147
147
|
import { getChartContext } from './Chart.svelte';
|
|
148
|
-
import { extractLayerProps
|
|
148
|
+
import { extractLayerProps } from '../utils/attributes.js';
|
|
149
149
|
import { type MotionProp } from '../utils/motion.svelte.js';
|
|
150
150
|
import { autoTickVals, autoTickFormat, type TicksConfig } from '../utils/ticks.js';
|
|
151
151
|
|
|
@@ -422,28 +422,21 @@
|
|
|
422
422
|
capHeight: '7px',
|
|
423
423
|
lineHeight: '11px',
|
|
424
424
|
...labelProps,
|
|
425
|
-
class: cls(
|
|
426
|
-
layerClass('axis-label'),
|
|
427
|
-
'text-[10px] stroke-surface-100 [stroke-width:2px] font-light',
|
|
428
|
-
classes.label,
|
|
429
|
-
labelProps?.class
|
|
430
|
-
),
|
|
425
|
+
class: cls('lc-axis-label', classes.label, labelProps?.class),
|
|
431
426
|
}) satisfies ComponentProps<typeof Text>;
|
|
432
427
|
</script>
|
|
433
428
|
|
|
434
429
|
<Group
|
|
435
430
|
{...restProps}
|
|
436
431
|
data-placement={placement}
|
|
437
|
-
class={cls(
|
|
432
|
+
class={cls('lc-axis', `placement-${placement}`, classes.root, className)}
|
|
438
433
|
>
|
|
439
434
|
{#if rule !== false}
|
|
440
|
-
{@const ruleProps = extractLayerProps(rule, 'axis-rule')}
|
|
441
435
|
<Rule
|
|
442
436
|
x={placement === 'left' ? '$left' : placement === 'right' ? '$right' : placement === 'angle'}
|
|
443
437
|
y={placement === 'top' ? '$top' : placement === 'bottom' ? '$bottom' : placement === 'radius'}
|
|
444
438
|
{motion}
|
|
445
|
-
{...
|
|
446
|
-
class={cls('stroke-surface-content/50', classes.rule, ruleProps?.class)}
|
|
439
|
+
{...extractLayerProps(rule, 'lc-axis-rule', classes.rule ?? '')}
|
|
447
440
|
/>
|
|
448
441
|
{/if}
|
|
449
442
|
|
|
@@ -470,32 +463,21 @@
|
|
|
470
463
|
capHeight: '7px',
|
|
471
464
|
lineHeight: '11px',
|
|
472
465
|
...tickLabelProps,
|
|
473
|
-
class: cls(
|
|
474
|
-
layerClass('axis-tick-label'),
|
|
475
|
-
'text-[10px] stroke-surface-100 [stroke-width:2px] font-light',
|
|
476
|
-
classes.tickLabel,
|
|
477
|
-
tickLabelProps?.class
|
|
478
|
-
),
|
|
466
|
+
class: cls('lc-axis-tick-label', classes.tickLabel, tickLabelProps?.class),
|
|
479
467
|
}}
|
|
480
468
|
|
|
481
|
-
<Group {transitionIn} {transitionInParams} class=
|
|
469
|
+
<Group {transitionIn} {transitionInParams} class="lc-axis-tick-group">
|
|
482
470
|
{#if grid !== false}
|
|
483
|
-
{@const ruleProps = extractLayerProps(grid, 'axis-grid')}
|
|
484
471
|
<Rule
|
|
485
472
|
x={orientation === 'horizontal' || orientation === 'angle' ? tick : false}
|
|
486
473
|
y={orientation === 'vertical' || orientation === 'radius' ? tick : false}
|
|
487
474
|
{motion}
|
|
488
|
-
{...
|
|
489
|
-
class={cls('stroke-surface-content/10', classes.rule, ruleProps?.class)}
|
|
475
|
+
{...extractLayerProps(grid, 'lc-axis-grid', classes.rule ?? '')}
|
|
490
476
|
/>
|
|
491
477
|
{/if}
|
|
492
478
|
|
|
493
479
|
{#if tickMarks}
|
|
494
|
-
{@const tickClasses = cls(
|
|
495
|
-
layerClass('axis-tick'),
|
|
496
|
-
'stroke-surface-content/50',
|
|
497
|
-
classes.tick
|
|
498
|
-
)}
|
|
480
|
+
{@const tickClasses = cls('lc-axis-tick', classes.tick)}
|
|
499
481
|
{#if orientation === 'horizontal'}
|
|
500
482
|
<Line
|
|
501
483
|
x1={tickCoords.x}
|
|
@@ -534,3 +516,38 @@
|
|
|
534
516
|
</Group>
|
|
535
517
|
{/each}
|
|
536
518
|
</Group>
|
|
519
|
+
|
|
520
|
+
<style>
|
|
521
|
+
@layer components {
|
|
522
|
+
:global(:where(.lc-axis-rule)) {
|
|
523
|
+
--stroke-color: color-mix(
|
|
524
|
+
in oklab,
|
|
525
|
+
var(--color-surface-content, currentColor) 50%,
|
|
526
|
+
transparent
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
:global(:where(.lc-axis-tick)) {
|
|
531
|
+
--stroke-color: color-mix(
|
|
532
|
+
in oklab,
|
|
533
|
+
var(--color-surface-content, currentColor) 50%,
|
|
534
|
+
transparent
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
:global(:where(.lc-axis-grid)) {
|
|
539
|
+
--stroke-color: color-mix(
|
|
540
|
+
in oklab,
|
|
541
|
+
var(--color-surface-content, currentColor) 10%,
|
|
542
|
+
transparent
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
:global(:where(.lc-axis-label, .lc-axis-tick-label)) {
|
|
547
|
+
font-size: 10px;
|
|
548
|
+
stroke: var(--color-surface-100, light-dark(white, black));
|
|
549
|
+
stroke-width: 2px;
|
|
550
|
+
font-weight: 300;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
</style>
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
Without<
|
|
72
72
|
Omit<SVGAttributes<SVGElement>, 'width' | 'height' | 'x' | 'y' | 'offset'>,
|
|
73
73
|
BarPropsWithoutHTML
|
|
74
|
-
|
|
74
|
+
> &
|
|
75
|
+
CommonEvents;
|
|
75
76
|
</script>
|
|
76
77
|
|
|
77
78
|
<script lang="ts">
|
|
@@ -84,7 +85,7 @@
|
|
|
84
85
|
import { isScaleBand, isScaleTime } from '../utils/scales.svelte.js';
|
|
85
86
|
import { accessor, type Accessor } from '../utils/common.js';
|
|
86
87
|
import { getChartContext } from './Chart.svelte';
|
|
87
|
-
import type { CommonStyleProps, Without } from '../utils/types.js';
|
|
88
|
+
import type { CommonEvents, CommonStyleProps, Without } from '../utils/types.js';
|
|
88
89
|
import { extractLayerProps } from '../utils/attributes.js';
|
|
89
90
|
import { extractTweenConfig, type MotionProp } from '../utils/motion.svelte.js';
|
|
90
91
|
import Arc from './Arc.svelte';
|
|
@@ -183,7 +184,7 @@
|
|
|
183
184
|
{strokeWidth}
|
|
184
185
|
{opacity}
|
|
185
186
|
cornerRadius={radius}
|
|
186
|
-
{...extractLayerProps(restProps, 'bar')}
|
|
187
|
+
{...extractLayerProps(restProps, 'lc-bar')}
|
|
187
188
|
/>
|
|
188
189
|
{:else if rounded === 'all' || rounded === 'none' || radius === 0}
|
|
189
190
|
<Rect
|
|
@@ -199,7 +200,7 @@
|
|
|
199
200
|
{initialHeight}
|
|
200
201
|
{initialWidth}
|
|
201
202
|
{...dimensions}
|
|
202
|
-
{...extractLayerProps(restProps, 'bar')}
|
|
203
|
+
{...extractLayerProps(restProps, 'lc-bar')}
|
|
203
204
|
/>
|
|
204
205
|
{:else}
|
|
205
206
|
{@const tweenMotion = extractTweenConfig(motion)}
|
|
@@ -211,6 +212,6 @@
|
|
|
211
212
|
{strokeWidth}
|
|
212
213
|
{opacity}
|
|
213
214
|
motion={tweenMotion}
|
|
214
|
-
{...extractLayerProps(restProps, 'bar')}
|
|
215
|
+
{...extractLayerProps(restProps, 'lc-bar')}
|
|
215
216
|
/>
|
|
216
217
|
{/if}
|
|
@@ -41,10 +41,10 @@ export type BarPropsWithoutHTML = {
|
|
|
41
41
|
rounded?: 'all' | 'none' | 'edge' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
42
42
|
motion?: MotionProp<'x' | 'y' | 'width' | 'height'>;
|
|
43
43
|
} & CommonStyleProps;
|
|
44
|
-
export type BarProps = BarPropsWithoutHTML & Without<Omit<SVGAttributes<SVGElement>, 'width' | 'height' | 'x' | 'y' | 'offset'>, BarPropsWithoutHTML
|
|
44
|
+
export type BarProps = BarPropsWithoutHTML & Without<Omit<SVGAttributes<SVGElement>, 'width' | 'height' | 'x' | 'y' | 'offset'>, BarPropsWithoutHTML> & CommonEvents;
|
|
45
45
|
import type { SVGAttributes } from 'svelte/elements';
|
|
46
46
|
import { type Accessor } from '../utils/common.js';
|
|
47
|
-
import type { CommonStyleProps, Without } from '../utils/types.js';
|
|
47
|
+
import type { CommonEvents, CommonStyleProps, Without } from '../utils/types.js';
|
|
48
48
|
import { type MotionProp } from '../utils/motion.svelte.js';
|
|
49
49
|
declare const Bar: import("svelte").Component<BarProps, {}, "">;
|
|
50
50
|
type Bar = ReturnType<typeof Bar>;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
import { getChartContext } from './Chart.svelte';
|
|
36
36
|
import { chartDataArray } from '../utils/common.js';
|
|
37
|
-
import { extractLayerProps
|
|
37
|
+
import { extractLayerProps } from '../utils/attributes.js';
|
|
38
38
|
|
|
39
39
|
let {
|
|
40
40
|
fill,
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
const data = $derived(chartDataArray(dataProp ?? ctx.data));
|
|
53
53
|
</script>
|
|
54
54
|
|
|
55
|
-
<Group class=
|
|
55
|
+
<Group class="lc-bars">
|
|
56
56
|
{#if children}
|
|
57
57
|
{@render children()}
|
|
58
58
|
{:else}
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
{stroke}
|
|
65
65
|
fill={fill ?? (ctx.config.c ? ctx.cGet(d) : null)}
|
|
66
66
|
onclick={(e) => onBarClick(e, { data: d })}
|
|
67
|
-
{...extractLayerProps(restProps, 'bars-bar')}
|
|
67
|
+
{...extractLayerProps(restProps, 'lc-bars-bar')}
|
|
68
68
|
/>
|
|
69
69
|
{/each}
|
|
70
70
|
{/if}
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
import type { Snippet } from 'svelte';
|
|
25
25
|
import { getRenderContext } from './Chart.svelte';
|
|
26
26
|
import { createId } from '../utils/createId.js';
|
|
27
|
-
import { layerClass } from '../utils/attributes.js';
|
|
28
27
|
|
|
29
28
|
const uid = $props.id();
|
|
30
29
|
|
|
@@ -35,13 +34,13 @@
|
|
|
35
34
|
|
|
36
35
|
{#if renderContext === 'svg'}
|
|
37
36
|
<defs>
|
|
38
|
-
<filter {id} class=
|
|
37
|
+
<filter {id} class="lc-blur-filter">
|
|
39
38
|
<feGaussianBlur in="SourceGraphic" {stdDeviation} />
|
|
40
39
|
</filter>
|
|
41
40
|
</defs>
|
|
42
41
|
|
|
43
42
|
{#if children}
|
|
44
|
-
<g filter="url(#{id})" class=
|
|
43
|
+
<g filter="url(#{id})" class="lc-blur-g">
|
|
45
44
|
{@render children()}
|
|
46
45
|
</g>
|
|
47
46
|
{/if}
|
|
@@ -148,7 +148,6 @@
|
|
|
148
148
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
149
149
|
import { getChartContext } from './Chart.svelte';
|
|
150
150
|
import type { Snippet } from 'svelte';
|
|
151
|
-
import { layerClass } from '../utils/attributes.js';
|
|
152
151
|
|
|
153
152
|
const ctx = getChartContext();
|
|
154
153
|
|
|
@@ -463,7 +462,6 @@
|
|
|
463
462
|
{#if disabled}
|
|
464
463
|
{@render children?.({ brushContext })}
|
|
465
464
|
{:else}
|
|
466
|
-
{@const handleClass = layerClass('brush-handle')}
|
|
467
465
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
468
466
|
<div
|
|
469
467
|
bind:this={rootEl}
|
|
@@ -471,12 +469,12 @@
|
|
|
471
469
|
style:left="{ctx.padding.left}px"
|
|
472
470
|
style:width="{ctx.width}px"
|
|
473
471
|
style:height="{ctx.height}px"
|
|
474
|
-
class={cls(
|
|
472
|
+
class={cls('lc-brush-context')}
|
|
475
473
|
onpointerdown={createRange}
|
|
476
474
|
ondblclick={() => selectAll()}
|
|
477
475
|
>
|
|
478
476
|
<div
|
|
479
|
-
class={cls(
|
|
477
|
+
class={cls('lc-brush-container')}
|
|
480
478
|
style:top="-{ctx.padding.top ?? 0}px"
|
|
481
479
|
style:left="-{ctx.padding.left ?? 0}px"
|
|
482
480
|
style:width="{ctx.containerWidth}px"
|
|
@@ -492,13 +490,7 @@
|
|
|
492
490
|
style:top="{_range.y}px"
|
|
493
491
|
style:width="{_range.width}px"
|
|
494
492
|
style:height="{_range.height}px"
|
|
495
|
-
class={cls(
|
|
496
|
-
layerClass('brush-range'),
|
|
497
|
-
'absolute bg-surface-content/10 cursor-move select-none',
|
|
498
|
-
'z-10',
|
|
499
|
-
classes.range,
|
|
500
|
-
range?.class
|
|
501
|
-
)}
|
|
493
|
+
class={cls('lc-brush-range', classes.range, range?.class)}
|
|
502
494
|
onpointerdown={adjustRange}
|
|
503
495
|
ondblclick={() => reset()}
|
|
504
496
|
></div>
|
|
@@ -511,14 +503,7 @@
|
|
|
511
503
|
style:width="{_range.width}px"
|
|
512
504
|
style:height="{handleSize}px"
|
|
513
505
|
data-position="top"
|
|
514
|
-
class={cls(
|
|
515
|
-
handleClass,
|
|
516
|
-
'cursor-ns-resize select-none',
|
|
517
|
-
'range absolute',
|
|
518
|
-
'z-10',
|
|
519
|
-
classes.handle,
|
|
520
|
-
handle?.class
|
|
521
|
-
)}
|
|
506
|
+
class={cls('lc-brush-handle', classes.handle, handle?.class)}
|
|
522
507
|
onpointerdown={adjustTop}
|
|
523
508
|
ondblclick={(e) => {
|
|
524
509
|
e.stopPropagation();
|
|
@@ -536,15 +521,7 @@
|
|
|
536
521
|
style:width="{_range.width}px"
|
|
537
522
|
style:height="{handleSize}px"
|
|
538
523
|
data-position="bottom"
|
|
539
|
-
class={cls(
|
|
540
|
-
handleClass,
|
|
541
|
-
'handle bottom',
|
|
542
|
-
'cursor-ns-resize select-none',
|
|
543
|
-
'range absolute',
|
|
544
|
-
'z-10',
|
|
545
|
-
classes.handle,
|
|
546
|
-
handle?.class
|
|
547
|
-
)}
|
|
524
|
+
class={cls('lc-brush-handle', classes.handle, handle?.class)}
|
|
548
525
|
onpointerdown={adjustBottom}
|
|
549
526
|
ondblclick={(e) => {
|
|
550
527
|
e.stopPropagation();
|
|
@@ -564,14 +541,7 @@
|
|
|
564
541
|
style:width="{handleSize}px"
|
|
565
542
|
style:height="{_range.height}px"
|
|
566
543
|
data-position="left"
|
|
567
|
-
class={cls(
|
|
568
|
-
handleClass,
|
|
569
|
-
'cursor-ew-resize select-none',
|
|
570
|
-
'range absolute',
|
|
571
|
-
'z-10',
|
|
572
|
-
classes.handle,
|
|
573
|
-
handle?.class
|
|
574
|
-
)}
|
|
544
|
+
class={cls('lc-brush-handle', classes.handle, handle?.class)}
|
|
575
545
|
onpointerdown={adjustLeft}
|
|
576
546
|
ondblclick={(e) => {
|
|
577
547
|
e.stopPropagation();
|
|
@@ -589,14 +559,7 @@
|
|
|
589
559
|
style:width="{handleSize}px"
|
|
590
560
|
style:height="{_range.height}px"
|
|
591
561
|
data-position="right"
|
|
592
|
-
class={cls(
|
|
593
|
-
handleClass,
|
|
594
|
-
'cursor-ew-resize select-none',
|
|
595
|
-
'range absolute',
|
|
596
|
-
'z-10',
|
|
597
|
-
classes.handle,
|
|
598
|
-
handle?.class
|
|
599
|
-
)}
|
|
562
|
+
class={cls('lc-brush-handle', classes.handle, handle?.class)}
|
|
600
563
|
onpointerdown={adjustRight}
|
|
601
564
|
ondblclick={(e) => {
|
|
602
565
|
e.stopPropagation();
|
|
@@ -610,3 +573,40 @@
|
|
|
610
573
|
{/if}
|
|
611
574
|
</div>
|
|
612
575
|
{/if}
|
|
576
|
+
|
|
577
|
+
<style>
|
|
578
|
+
@layer base {
|
|
579
|
+
:where(.lc-brush-context) {
|
|
580
|
+
position: absolute;
|
|
581
|
+
touch-action: none;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
:where(.lc-brush-container) {
|
|
585
|
+
position: absolute;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
:where(.lc-brush-range) {
|
|
589
|
+
position: absolute;
|
|
590
|
+
cursor: move;
|
|
591
|
+
user-select: none;
|
|
592
|
+
z-index: 10;
|
|
593
|
+
background: color-mix(in oklab, var(--color-surface-content, currentColor) 10%, transparent);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
:where(.lc-brush-handle) {
|
|
597
|
+
position: absolute;
|
|
598
|
+
user-select: none;
|
|
599
|
+
z-index: 10;
|
|
600
|
+
|
|
601
|
+
&[data-position='top'],
|
|
602
|
+
&[data-position='bottom'] {
|
|
603
|
+
cursor: ns-resize;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
&[data-position='left'],
|
|
607
|
+
&[data-position='right'] {
|
|
608
|
+
cursor: ew-resize;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
</style>
|
|
@@ -128,14 +128,15 @@
|
|
|
128
128
|
fill={cell.color}
|
|
129
129
|
onpointermove={(e) => tooltip?.show(e, cell.data)}
|
|
130
130
|
onpointerleave={(e) => tooltip?.hide()}
|
|
131
|
-
{
|
|
131
|
+
strokeWidth={1}
|
|
132
|
+
{...extractLayerProps(restProps, 'lc-calendar-cell')}
|
|
132
133
|
/>
|
|
133
134
|
{/each}
|
|
134
135
|
{/if}
|
|
135
136
|
|
|
136
137
|
{#if monthPath}
|
|
137
138
|
{#each yearMonths as date}
|
|
138
|
-
<MonthPath {date} {cellSize} {...extractLayerProps(monthPath, 'calendar-month-path')} />
|
|
139
|
+
<MonthPath {date} {cellSize} {...extractLayerProps(monthPath, 'lc-calendar-month-path')} />
|
|
139
140
|
{/each}
|
|
140
141
|
{/if}
|
|
141
142
|
|
|
@@ -143,9 +144,25 @@
|
|
|
143
144
|
{#each yearMonths as date}
|
|
144
145
|
<Text
|
|
145
146
|
x={timeWeek.count(timeYear.floor(date), timeWeek.ceil(date)) * cellSize[0]}
|
|
146
|
-
y={-4}
|
|
147
147
|
value={format(date, 'month', { variant: 'short' })}
|
|
148
|
-
|
|
148
|
+
capHeight="7px"
|
|
149
|
+
{...extractLayerProps(monthLabel, 'lc-calendar-month-label')}
|
|
149
150
|
/>
|
|
150
151
|
{/each}
|
|
151
152
|
{/if}
|
|
153
|
+
|
|
154
|
+
<style>
|
|
155
|
+
@layer components {
|
|
156
|
+
:global(:where(.lc-calendar-cell)) {
|
|
157
|
+
--stroke-color: color-mix(
|
|
158
|
+
in oklab,
|
|
159
|
+
var(--color-surface-content, currentColor) 5%,
|
|
160
|
+
transparent
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:global(:where(.lc-calendar-month-label)) {
|
|
165
|
+
font-size: 12px;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
</style>
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
import { geoFitObjectTransform } from '../utils/geo.js';
|
|
42
42
|
import TransformContext, { type TransformContextValue } from './TransformContext.svelte';
|
|
43
43
|
import BrushContext, { type BrushContextValue } from './BrushContext.svelte';
|
|
44
|
-
import { layerClass } from '../utils/attributes.js';
|
|
45
44
|
import type { TimeInterval } from 'd3-time';
|
|
46
45
|
|
|
47
46
|
const defaultPadding = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
@@ -1394,7 +1393,7 @@
|
|
|
1394
1393
|
style:pointer-events={pointerEvents === false ? 'none' : null}
|
|
1395
1394
|
bind:clientWidth={containerWidth}
|
|
1396
1395
|
bind:clientHeight={containerHeight}
|
|
1397
|
-
class=
|
|
1396
|
+
class="lc-root-container"
|
|
1398
1397
|
>
|
|
1399
1398
|
{#key isMounted}
|
|
1400
1399
|
<!-- svelte-ignore ownership_invalid_binding -->
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
{disabled}
|
|
42
42
|
height={ctx.height + (full ? (ctx.padding?.top ?? 0) + (ctx.padding?.bottom ?? 0) : 0)}
|
|
43
43
|
width={ctx.width + (full ? (ctx.padding?.left ?? 0) + (ctx.padding?.right ?? 0) : 0)}
|
|
44
|
-
{...extractLayerProps(restProps, 'chart-clip-path')}
|
|
44
|
+
{...extractLayerProps(restProps, 'lc-chart-clip-path')}
|
|
45
45
|
/>
|
|
@@ -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>
|