svelteplot 0.4.7 → 0.4.8-pr-222.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/core/Plot.svelte +54 -31
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/index.d.ts +2 -2
- package/dist/helpers/scales.d.ts +1 -1
- package/dist/helpers/typeChecks.d.ts +4 -4
- package/dist/hooks/plotDefaults.d.ts +3 -0
- package/dist/hooks/plotDefaults.js +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/marks/Area.svelte +2 -1
- package/dist/marks/AreaX.svelte +4 -3
- package/dist/marks/AreaX.svelte.d.ts +2 -1
- package/dist/marks/AreaY.svelte +4 -5
- package/dist/marks/Arrow.svelte +3 -2
- package/dist/marks/AxisX.svelte +3 -4
- package/dist/marks/AxisX.svelte.d.ts +1 -1
- package/dist/marks/AxisY.svelte +3 -4
- package/dist/marks/AxisY.svelte.d.ts +6 -7
- package/dist/marks/BarX.svelte +4 -4
- package/dist/marks/BarX.svelte.d.ts +1 -1
- package/dist/marks/BarY.svelte +3 -3
- package/dist/marks/BollingerX.svelte.d.ts +2 -74
- package/dist/marks/BollingerY.svelte.d.ts +2 -74
- package/dist/marks/BoxX.svelte +4 -4
- package/dist/marks/BoxY.svelte +4 -4
- package/dist/marks/BoxY.svelte.d.ts +1 -0
- package/dist/marks/Brush.svelte +13 -7
- package/dist/marks/Brush.svelte.d.ts +10 -1
- package/dist/marks/BrushX.svelte +4 -4
- package/dist/marks/BrushY.svelte +4 -4
- package/dist/marks/Cell.svelte +3 -4
- package/dist/marks/ColorLegend.svelte +5 -4
- package/dist/marks/CustomMark.svelte.d.ts +2 -81
- package/dist/marks/DifferenceY.svelte +3 -3
- package/dist/marks/DifferenceY.svelte.d.ts +7 -67
- package/dist/marks/Dot.svelte +2 -2
- package/dist/marks/Frame.svelte +2 -2
- package/dist/marks/Geo.svelte +2 -2
- package/dist/marks/Graticule.svelte +3 -3
- package/dist/marks/GridX.svelte +3 -3
- package/dist/marks/GridY.svelte +4 -9
- package/dist/marks/Line.svelte +3 -2
- package/dist/marks/Line.svelte.d.ts +2 -2
- package/dist/marks/LineX.svelte.d.ts +2 -1
- package/dist/marks/LineY.svelte.d.ts +2 -1
- package/dist/marks/Link.svelte +3 -3
- package/dist/marks/Pointer.svelte +3 -3
- package/dist/marks/Rect.svelte +2 -3
- package/dist/marks/RectX.svelte +4 -3
- package/dist/marks/RectY.svelte +4 -3
- package/dist/marks/RuleX.svelte +3 -3
- package/dist/marks/RuleY.svelte +4 -4
- package/dist/marks/Sphere.svelte +2 -2
- package/dist/marks/Spike.svelte +4 -3
- package/dist/marks/Text.svelte +4 -4
- package/dist/marks/TickX.svelte +3 -3
- package/dist/marks/TickY.svelte +4 -4
- package/dist/marks/Vector.svelte +3 -3
- package/dist/marks/helpers/CanvasLayer.svelte +1 -1
- package/dist/marks/helpers/Marker.svelte +2 -1
- package/dist/marks/helpers/MarkerPath.svelte +4 -4
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +17 -2
- package/dist/marks/helpers/RectPath.svelte.d.ts +3 -63
- package/dist/transforms/bollinger.d.ts +1 -67
- package/dist/transforms/group.d.ts +4 -12
- package/dist/transforms/interval.d.ts +2 -124
- package/dist/transforms/recordize.d.ts +1 -4
- package/dist/transforms/select.d.ts +7 -434
- package/dist/transforms/sort.d.ts +3 -246
- package/dist/transforms/stack.d.ts +3 -23
- package/dist/transforms/window.d.ts +2 -130
- package/dist/types/plot.d.ts +15 -8
- package/package.json +128 -127
- package/dist/marks/AreaY.svelte.d.ts +0 -99
package/dist/core/Plot.svelte
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
this component.
|
|
9
9
|
-->
|
|
10
10
|
<script lang="ts">
|
|
11
|
-
import {
|
|
11
|
+
import { setContext } from 'svelte';
|
|
12
12
|
import { SvelteMap } from 'svelte/reactivity';
|
|
13
13
|
import { writable } from 'svelte/store';
|
|
14
14
|
|
|
@@ -21,13 +21,15 @@
|
|
|
21
21
|
PlotScale,
|
|
22
22
|
PlotDefaults,
|
|
23
23
|
PlotState,
|
|
24
|
-
RawValue
|
|
24
|
+
RawValue,
|
|
25
|
+
PlotMargin
|
|
25
26
|
} from '../types/index.js';
|
|
26
27
|
import FacetGrid from './FacetGrid.svelte';
|
|
27
28
|
|
|
28
29
|
import mergeDeep from '../helpers/mergeDeep.js';
|
|
29
30
|
import { computeScales, projectXY } from '../helpers/scales.js';
|
|
30
31
|
import { CHANNEL_SCALE, SCALES } from '../constants.js';
|
|
32
|
+
import { getPlotDefaults, setPlotDefaults } from '../hooks/plotDefaults.js';
|
|
31
33
|
|
|
32
34
|
// automatic margins can be applied by the marks, registered
|
|
33
35
|
// with their respective unique identifier as keys
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
const maxMarginBottom = $derived(Math.max(...$autoMarginBottom.values()));
|
|
52
54
|
const maxMarginTop = $derived(Math.max(...$autoMarginTop.values()));
|
|
53
55
|
|
|
54
|
-
const USER_DEFAULTS =
|
|
56
|
+
const USER_DEFAULTS = getPlotDefaults();
|
|
55
57
|
|
|
56
58
|
// default settings in the plot and marks can be overwritten by
|
|
57
59
|
// defining the svelteplot/defaults context outside of Plot
|
|
@@ -59,6 +61,7 @@
|
|
|
59
61
|
height: 350,
|
|
60
62
|
initialWidth: 500,
|
|
61
63
|
inset: 0,
|
|
64
|
+
margin: 'auto',
|
|
62
65
|
colorScheme: 'turbo',
|
|
63
66
|
unknown: '#cccccc99',
|
|
64
67
|
|
|
@@ -115,14 +118,14 @@
|
|
|
115
118
|
|
|
116
119
|
let width = $state(DEFAULTS.initialWidth);
|
|
117
120
|
|
|
118
|
-
|
|
121
|
+
setPlotDefaults(DEFAULTS);
|
|
119
122
|
|
|
120
123
|
// information that influences the default plot options
|
|
121
124
|
type PlotOptionsParameters = {
|
|
122
125
|
explicitScales: Set<ScaleName>;
|
|
123
126
|
explicitDomains: Set<ScaleName>;
|
|
124
127
|
hasProjection: boolean;
|
|
125
|
-
|
|
128
|
+
margin?: number | 'auto';
|
|
126
129
|
inset?: number;
|
|
127
130
|
};
|
|
128
131
|
|
|
@@ -173,7 +176,7 @@
|
|
|
173
176
|
explicitScales,
|
|
174
177
|
explicitDomains,
|
|
175
178
|
hasProjection: !!initialOpts.projection,
|
|
176
|
-
|
|
179
|
+
margin: initialOpts.margin,
|
|
177
180
|
inset: initialOpts.inset
|
|
178
181
|
})
|
|
179
182
|
);
|
|
@@ -363,6 +366,38 @@
|
|
|
363
366
|
return mergeDeep<PlotOptions>({}, smartDefaultPlotOptions(opts), initialOpts);
|
|
364
367
|
}
|
|
365
368
|
|
|
369
|
+
function maybeMargin(
|
|
370
|
+
// the margin option provided to the <Plot> component
|
|
371
|
+
margin: number | 'auto' | PlotMargin | undefined,
|
|
372
|
+
// direction to extract from the margin object
|
|
373
|
+
direction: 'left' | 'right' | 'top' | 'bottom',
|
|
374
|
+
// the margin option defined in the plot defaults
|
|
375
|
+
defaultValue: PlotMargin | number | 'auto',
|
|
376
|
+
// automatic margins computed from the marks
|
|
377
|
+
autoMargins: {
|
|
378
|
+
left: number;
|
|
379
|
+
right: number;
|
|
380
|
+
top: number;
|
|
381
|
+
bottom: number;
|
|
382
|
+
}
|
|
383
|
+
): number {
|
|
384
|
+
// direction-specific margin value takes precedence
|
|
385
|
+
const marginValue =
|
|
386
|
+
typeof margin === 'object' && margin[direction] != null
|
|
387
|
+
? margin[direction]
|
|
388
|
+
: // use the margin value if it's a number
|
|
389
|
+
typeof margin === 'number' || margin === 'auto'
|
|
390
|
+
? margin
|
|
391
|
+
: // use direction-specific default value if defined
|
|
392
|
+
typeof defaultValue === 'object' && defaultValue[direction] != null
|
|
393
|
+
? defaultValue[direction]
|
|
394
|
+
: typeof defaultValue === 'number' || defaultValue === 'auto'
|
|
395
|
+
? defaultValue
|
|
396
|
+
: 'auto';
|
|
397
|
+
|
|
398
|
+
return marginValue === 'auto' ? autoMargins[direction] : marginValue;
|
|
399
|
+
}
|
|
400
|
+
|
|
366
401
|
/**
|
|
367
402
|
* compute smart default options for the plot based on the scales and marks
|
|
368
403
|
*/
|
|
@@ -370,43 +405,31 @@
|
|
|
370
405
|
explicitScales,
|
|
371
406
|
explicitDomains,
|
|
372
407
|
hasProjection,
|
|
373
|
-
|
|
408
|
+
margin
|
|
374
409
|
}: PlotOptionsParameters): PlotOptions {
|
|
375
410
|
const autoXAxis = explicitScales.has('x') || explicitDomains.has('x');
|
|
376
411
|
const autoYAxis = explicitScales.has('y') || explicitDomains.has('y');
|
|
377
412
|
const isOneDimensional = autoXAxis !== autoYAxis;
|
|
378
413
|
const oneDimX = autoXAxis && !autoYAxis;
|
|
379
414
|
const oneDimY = autoYAxis && !autoXAxis;
|
|
415
|
+
|
|
416
|
+
const autoMargins = {
|
|
417
|
+
left: hasProjection ? 0 : Math.max(maxMarginLeft + 1, 1),
|
|
418
|
+
right: hasProjection ? 0 : oneDimY ? 0 : Math.max(maxMarginRight + 1, 4),
|
|
419
|
+
top: hasProjection ? 0 : oneDimX ? 0 : Math.max(5, maxMarginTop),
|
|
420
|
+
bottom: hasProjection ? 0 : Math.max(5, maxMarginBottom)
|
|
421
|
+
};
|
|
422
|
+
|
|
380
423
|
return {
|
|
381
424
|
title: '',
|
|
382
425
|
subtitle: '',
|
|
383
426
|
caption: '',
|
|
384
427
|
height: 'auto',
|
|
385
428
|
// maxWidth: oneDimY ? `${60 * e}px` : undefined,
|
|
386
|
-
marginLeft:
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
: Math.max(maxMarginLeft + 1, 1),
|
|
391
|
-
marginRight: hasProjection
|
|
392
|
-
? 0
|
|
393
|
-
: margins != null
|
|
394
|
-
? margins
|
|
395
|
-
: oneDimY
|
|
396
|
-
? 0
|
|
397
|
-
: Math.max(maxMarginRight + 1, 4),
|
|
398
|
-
marginTop: hasProjection
|
|
399
|
-
? 0
|
|
400
|
-
: margins != null
|
|
401
|
-
? margins
|
|
402
|
-
: oneDimX
|
|
403
|
-
? 0
|
|
404
|
-
: Math.max(5, maxMarginTop),
|
|
405
|
-
marginBottom: hasProjection
|
|
406
|
-
? 0
|
|
407
|
-
: margins != null
|
|
408
|
-
? margins
|
|
409
|
-
: Math.max(5, maxMarginBottom),
|
|
429
|
+
marginLeft: maybeMargin(margin, 'left', DEFAULTS.margin, autoMargins),
|
|
430
|
+
marginRight: maybeMargin(margin, 'right', DEFAULTS.margin, autoMargins),
|
|
431
|
+
marginTop: maybeMargin(margin, 'top', DEFAULTS.margin, autoMargins),
|
|
432
|
+
marginBottom: maybeMargin(margin, 'bottom', DEFAULTS.margin, autoMargins),
|
|
410
433
|
inset: isOneDimensional ? 10 : DEFAULTS.inset,
|
|
411
434
|
grid: (DEFAULTS.gridX?.implicit ?? false) && (DEFAULTS.gridY?.implicit ?? false),
|
|
412
435
|
axes: (DEFAULTS.axisX?.implicit ?? false) && (DEFAULTS.axisY?.implicit ?? false),
|
package/dist/helpers/colors.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type SchemeGetter = (n: number) => readonly string[];
|
|
|
6
6
|
export declare function isOrdinalScheme(scheme: ColorScheme): boolean;
|
|
7
7
|
export declare function ordinalScheme(scheme: string): SchemeGetter | undefined;
|
|
8
8
|
export declare function ordinalRange(scheme: string, length: number): readonly string[] | undefined;
|
|
9
|
-
export declare function maybeBooleanRange(domain: boolean[], scheme?: string):
|
|
9
|
+
export declare function maybeBooleanRange(domain: boolean[], scheme?: string): any[] | undefined;
|
|
10
10
|
export declare function isQuantitativeScheme(scheme: string): boolean;
|
|
11
11
|
export declare function quantitativeScheme(scheme: string): typeof interpolateBrBG | undefined;
|
|
12
12
|
export declare function isDivergingScheme(scheme: string): boolean;
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns first argument that is not null or undefined
|
|
5
5
|
*/
|
|
6
|
-
export declare function coalesce(...args: (RawValue | undefined | null)[]):
|
|
7
|
-
export declare function testFilter<T>(datum: T, options: Channels<T>):
|
|
6
|
+
export declare function coalesce(...args: (RawValue | undefined | null)[]): any;
|
|
7
|
+
export declare function testFilter<T>(datum: T, options: Channels<T>): any;
|
|
8
8
|
export declare function randomId(): string;
|
|
9
9
|
export declare function isSnippet(value: unknown): value is Snippet;
|
|
10
10
|
export declare function isValid(value: RawValue | undefined): value is number | Date | string;
|
package/dist/helpers/scales.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare function createScale<T extends ScaleOptions>(name: ScaleName, sca
|
|
|
15
15
|
autoTitle?: undefined;
|
|
16
16
|
} | {
|
|
17
17
|
type: ScaleType;
|
|
18
|
-
domain:
|
|
18
|
+
domain: any;
|
|
19
19
|
range: any;
|
|
20
20
|
fn: any;
|
|
21
21
|
skip: Map<ScaledChannelName, Set<symbol>>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RawValue } from '../types/index.js';
|
|
2
|
-
export declare function isBooleanOrNull(v: RawValue):
|
|
2
|
+
export declare function isBooleanOrNull(v: RawValue): boolean;
|
|
3
3
|
export declare function isDate(v: RawValue): v is Date;
|
|
4
|
-
export declare function isDateOrNull(v: RawValue | null | undefined):
|
|
4
|
+
export declare function isDateOrNull(v: RawValue | null | undefined): boolean;
|
|
5
5
|
export declare function isNumberOrNull(v: RawValue | null | undefined): boolean;
|
|
6
6
|
export declare function isNumberOrNullOrNaN(v: RawValue | null | undefined): boolean;
|
|
7
|
-
export declare function isStringOrNull(v: RawValue | null | undefined):
|
|
7
|
+
export declare function isStringOrNull(v: RawValue | null | undefined): boolean;
|
|
8
8
|
export declare function isSymbolOrNull(v: RawValue | null | undefined): boolean;
|
|
9
|
-
export declare function isColorOrNull(v: RawValue | null | undefined):
|
|
9
|
+
export declare function isColorOrNull(v: RawValue | null | undefined): any;
|
|
10
10
|
export declare function isOpacityOrNull(v: RawValue): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getContext, hasContext, setContext } from 'svelte';
|
|
2
|
+
const PLOT_DEFAULTS_KEY = Symbol('svelteplot/defaults');
|
|
3
|
+
export function setPlotDefaults(plotDefaults) {
|
|
4
|
+
const existingDefaults = getPlotDefaults();
|
|
5
|
+
const mergedDefaults = { ...existingDefaults, ...plotDefaults };
|
|
6
|
+
setContext(PLOT_DEFAULTS_KEY, mergedDefaults);
|
|
7
|
+
}
|
|
8
|
+
export function getPlotDefaults() {
|
|
9
|
+
return hasContext(PLOT_DEFAULTS_KEY)
|
|
10
|
+
? getContext(PLOT_DEFAULTS_KEY)
|
|
11
|
+
: // Fallback for backward compatibility
|
|
12
|
+
hasContext('svelteplot/defaults')
|
|
13
|
+
? (console.error(`svelteplot: Please use new setPlotDefaults hook instead of 'svelteplot/defaults' context`),
|
|
14
|
+
getContext('svelteplot/defaults'))
|
|
15
|
+
: {};
|
|
16
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/marks/Area.svelte
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
} from '../types/index.js';
|
|
43
43
|
import type { StackOptions } from '../transforms/stack.js';
|
|
44
44
|
import { addEventHandlers } from './helpers/events';
|
|
45
|
+
import { getPlotDefaults } from '../hooks/plotDefaults.js';
|
|
45
46
|
|
|
46
47
|
let markProps: AreaMarkProps = $props();
|
|
47
48
|
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
fill: 'currentColor',
|
|
50
51
|
curve: 'linear' as CurveName,
|
|
51
52
|
tension: 0,
|
|
52
|
-
...
|
|
53
|
+
...getPlotDefaults().area
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
const {
|
package/dist/marks/AreaX.svelte
CHANGED
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
import { renameChannels } from '../transforms/rename.js';
|
|
12
12
|
import { stackX } from '../transforms/stack.js';
|
|
13
13
|
import { recordizeX } from '../transforms/recordize.js';
|
|
14
|
-
import type { ChannelAccessor, DataRow
|
|
15
|
-
import {
|
|
14
|
+
import type { ChannelAccessor, DataRow } from '../types/index.js';
|
|
15
|
+
import { type ComponentProps } from 'svelte';
|
|
16
|
+
import { getPlotDefaults } from '../hooks/plotDefaults.js';
|
|
16
17
|
|
|
17
18
|
let markProps: AreaXMarkProps = $props();
|
|
18
19
|
|
|
19
|
-
const DEFAULTS =
|
|
20
|
+
const DEFAULTS = getPlotDefaults().areaX;
|
|
20
21
|
|
|
21
22
|
const { data, stack, ...options }: AreaXMarkProps = $derived({
|
|
22
23
|
...(markProps.x == undefined ? { x1: 0, x2: 0 } : {}),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { renameChannels } from '../transforms/rename.js';
|
|
1
2
|
import type { ChannelAccessor, DataRow } from '../types/index.js';
|
|
2
3
|
declare class __sveltets_Render<Datum extends DataRow> {
|
|
3
4
|
props(): Omit<Partial<{
|
|
@@ -72,7 +73,7 @@ declare class __sveltets_Render<Datum extends DataRow> {
|
|
|
72
73
|
sort?: import("../types/index.js").ConstantAccessor<import("../types/data").RawValue> | {
|
|
73
74
|
channel: "stroke" | "fill";
|
|
74
75
|
};
|
|
75
|
-
stack?: Partial<
|
|
76
|
+
stack?: Partial<renameChannels>;
|
|
76
77
|
canvas?: boolean;
|
|
77
78
|
}, "y1" | "y2"> & {
|
|
78
79
|
x?: ChannelAccessor<Datum>;
|
package/dist/marks/AreaY.svelte
CHANGED
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
import Area from './Area.svelte';
|
|
11
11
|
import { renameChannels } from '../transforms/rename.js';
|
|
12
12
|
import { stackY } from '../transforms/stack.js';
|
|
13
|
-
import {
|
|
14
|
-
import type { ChannelAccessor, DataRow
|
|
15
|
-
import {
|
|
16
|
-
import { area } from 'd3-shape';
|
|
13
|
+
import { recordizeY } from '../transforms/recordize.js';
|
|
14
|
+
import type { ChannelAccessor, DataRow } from '../types/index.js';
|
|
15
|
+
import { getPlotDefaults } from '../hooks/plotDefaults.js';
|
|
17
16
|
|
|
18
17
|
let markProps: AreaYMarkProps = $props();
|
|
19
18
|
|
|
20
|
-
const DEFAULTS =
|
|
19
|
+
const DEFAULTS = getPlotDefaults().areaY;
|
|
21
20
|
|
|
22
21
|
const { data, stack, ...options }: AreaYMarkProps = $derived({
|
|
23
22
|
...(markProps.y == undefined ? { y1: 0, y2: 0 } : {}),
|
package/dist/marks/Arrow.svelte
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
RawValue,
|
|
48
48
|
PlotDefaults
|
|
49
49
|
} from '../types/index.js';
|
|
50
|
-
import {
|
|
50
|
+
import { resolveProp, resolveStyles } from '../helpers/resolve.js';
|
|
51
51
|
import { coalesce, maybeNumber } from '../helpers/index.js';
|
|
52
52
|
import Mark from '../Mark.svelte';
|
|
53
53
|
import { arrowPath, maybeSweep, type SweepOption } from '../helpers/arrowPath.js';
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
import GroupMultiple from './helpers/GroupMultiple.svelte';
|
|
57
57
|
import { sort } from '../transforms/sort.js';
|
|
58
58
|
import { indexData } from '../transforms/recordize.js';
|
|
59
|
+
import { getPlotDefaults } from '../hooks/plotDefaults.js';
|
|
59
60
|
|
|
60
61
|
let markProps: ArrowMarkProps = $props();
|
|
61
62
|
|
|
@@ -63,7 +64,7 @@
|
|
|
63
64
|
headAngle: 60,
|
|
64
65
|
headLength: 8,
|
|
65
66
|
inset: 0,
|
|
66
|
-
...
|
|
67
|
+
...getPlotDefaults().arrow
|
|
67
68
|
};
|
|
68
69
|
|
|
69
70
|
const {
|
package/dist/marks/AxisX.svelte
CHANGED
|
@@ -11,14 +11,13 @@
|
|
|
11
11
|
RawValue,
|
|
12
12
|
ConstantAccessor,
|
|
13
13
|
FacetContext,
|
|
14
|
-
PlotDefaults,
|
|
15
14
|
ChannelName
|
|
16
15
|
} from '../types/index.js';
|
|
17
16
|
import type * as CSS from 'csstype';
|
|
18
17
|
import autoTimeFormat from '../helpers/autoTimeFormat.js';
|
|
19
|
-
import { derived } from 'svelte/store';
|
|
20
18
|
import { autoTicks } from '../helpers/autoTicks.js';
|
|
21
19
|
import { resolveScaledStyles } from '../helpers/resolve.js';
|
|
20
|
+
import { getPlotDefaults } from '../hooks/plotDefaults.js';
|
|
22
21
|
|
|
23
22
|
interface AxisXMarkProps
|
|
24
23
|
extends Omit<
|
|
@@ -64,8 +63,8 @@
|
|
|
64
63
|
textAnchor: 'auto',
|
|
65
64
|
opacity: 0.8,
|
|
66
65
|
anchor: 'bottom',
|
|
67
|
-
...
|
|
68
|
-
...
|
|
66
|
+
...getPlotDefaults().axis,
|
|
67
|
+
...getPlotDefaults().axisX
|
|
69
68
|
};
|
|
70
69
|
|
|
71
70
|
const {
|
|
@@ -61,7 +61,7 @@ declare class __sveltets_Render<Datum extends RawValue> {
|
|
|
61
61
|
class?: string;
|
|
62
62
|
style?: string;
|
|
63
63
|
cursor: ConstantAccessor<CSS.Property.Cursor, Datum>;
|
|
64
|
-
}>, "fillOpacity" | "href" | "target" | "
|
|
64
|
+
}>, "fillOpacity" | "href" | "target" | "title" | "paintOrder"> & {
|
|
65
65
|
data?: Datum[] | undefined;
|
|
66
66
|
automatic?: boolean;
|
|
67
67
|
title?: string | false | null;
|
package/dist/marks/AxisY.svelte
CHANGED
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
BaseMarkProps,
|
|
11
11
|
RawValue,
|
|
12
12
|
FacetContext,
|
|
13
|
-
PlotDefaults,
|
|
14
13
|
ChannelName,
|
|
15
14
|
ConstantAccessor
|
|
16
15
|
} from '../types/index.js';
|
|
17
|
-
import type * as CSS from 'csstype';
|
|
18
16
|
import autoTimeFormat from '../helpers/autoTimeFormat.js';
|
|
19
17
|
import { autoTicks } from '../helpers/autoTicks.js';
|
|
20
18
|
import { resolveScaledStyles } from '../helpers/resolve.js';
|
|
19
|
+
import { getPlotDefaults } from '../hooks/plotDefaults.js';
|
|
21
20
|
|
|
22
21
|
interface AxisYMarkProps
|
|
23
22
|
extends Omit<
|
|
@@ -62,8 +61,8 @@
|
|
|
62
61
|
opacity: 0.8,
|
|
63
62
|
anchor: 'left',
|
|
64
63
|
textAnchor: 'auto',
|
|
65
|
-
...
|
|
66
|
-
...
|
|
64
|
+
...getPlotDefaults().axis,
|
|
65
|
+
...getPlotDefaults().axisY
|
|
67
66
|
};
|
|
68
67
|
|
|
69
68
|
const {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { RawValue, ConstantAccessor } from '../types/index.js';
|
|
2
|
-
import type * as CSS from 'csstype';
|
|
3
2
|
declare class __sveltets_Render<Datum extends RawValue> {
|
|
4
3
|
props(): Omit<Partial<{
|
|
5
4
|
filter?: ConstantAccessor<boolean, Datum>;
|
|
@@ -17,16 +16,16 @@ declare class __sveltets_Render<Datum extends RawValue> {
|
|
|
17
16
|
stroke: import("../types/channel").ChannelAccessor<Datum>;
|
|
18
17
|
strokeWidth: ConstantAccessor<number, Datum>;
|
|
19
18
|
strokeOpacity: ConstantAccessor<number, Datum>;
|
|
20
|
-
strokeLinejoin: ConstantAccessor<
|
|
21
|
-
strokeLinecap: ConstantAccessor<
|
|
19
|
+
strokeLinejoin: ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
|
|
20
|
+
strokeLinecap: ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
|
|
22
21
|
strokeMiterlimit: ConstantAccessor<number, Datum>;
|
|
23
22
|
opacity: import("../types/channel").ChannelAccessor<Datum>;
|
|
24
23
|
strokeDasharray: ConstantAccessor<string, Datum>;
|
|
25
24
|
strokeDashoffset: ConstantAccessor<number, Datum>;
|
|
26
|
-
mixBlendMode: ConstantAccessor<
|
|
25
|
+
mixBlendMode: ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
|
|
27
26
|
clipPath: string;
|
|
28
27
|
imageFilter: ConstantAccessor<string, Datum>;
|
|
29
|
-
shapeRendering: ConstantAccessor<
|
|
28
|
+
shapeRendering: ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
|
|
30
29
|
paintOrder: ConstantAccessor<string, Datum>;
|
|
31
30
|
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
32
31
|
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
@@ -60,8 +59,8 @@ declare class __sveltets_Render<Datum extends RawValue> {
|
|
|
60
59
|
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
61
60
|
class?: string;
|
|
62
61
|
style?: string;
|
|
63
|
-
cursor: ConstantAccessor<
|
|
64
|
-
}>, "fillOpacity" | "href" | "target" | "
|
|
62
|
+
cursor: ConstantAccessor<import("csstype").Property.Cursor, Datum>;
|
|
63
|
+
}>, "fillOpacity" | "href" | "target" | "title" | "paintOrder"> & {
|
|
65
64
|
data?: Datum[] | undefined;
|
|
66
65
|
automatic?: boolean;
|
|
67
66
|
title?: string | false | null;
|
package/dist/marks/BarX.svelte
CHANGED
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
BaseMarkProps,
|
|
34
34
|
BaseRectMarkProps,
|
|
35
35
|
ChannelAccessor,
|
|
36
|
-
LinkableMarkProps
|
|
37
|
-
PlotDefaults
|
|
36
|
+
LinkableMarkProps
|
|
38
37
|
} from '../types/index.js';
|
|
38
|
+
import { getPlotDefaults } from '../hooks/plotDefaults.js';
|
|
39
39
|
|
|
40
40
|
const DEFAULTS = {
|
|
41
41
|
fill: 'currentColor',
|
|
42
|
-
...
|
|
43
|
-
...
|
|
42
|
+
...getPlotDefaults().bar,
|
|
43
|
+
...getPlotDefaults().barX
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
let markProps: BarXMarkProps = $props();
|
|
@@ -14,7 +14,7 @@ declare class __sveltets_Render<Datum extends DataRow> {
|
|
|
14
14
|
sort: {
|
|
15
15
|
channel: string;
|
|
16
16
|
order?: "ascending" | "descending";
|
|
17
|
-
} | ((a: import("../types/
|
|
17
|
+
} | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Datum>;
|
|
18
18
|
stroke: ChannelAccessor<Datum>;
|
|
19
19
|
strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
20
20
|
strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
|
package/dist/marks/BarY.svelte
CHANGED
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
BaseRectMarkProps,
|
|
35
35
|
ChannelAccessor,
|
|
36
36
|
DataRow,
|
|
37
|
-
PlotDefaults,
|
|
38
37
|
LinkableMarkProps
|
|
39
38
|
} from '../types/index.js';
|
|
39
|
+
import { getPlotDefaults } from '../hooks/plotDefaults.js';
|
|
40
40
|
|
|
41
41
|
const { getPlotState } = getContext<PlotContext>('svelteplot');
|
|
42
42
|
const plot = $derived(getPlotState());
|
|
43
43
|
|
|
44
44
|
const DEFAULTS = {
|
|
45
|
-
...
|
|
46
|
-
...
|
|
45
|
+
...getPlotDefaults().bar,
|
|
46
|
+
...getPlotDefaults().barY
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
let markProps: BarYMarkProps = $props();
|
|
@@ -1,78 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DataRecord } from '../types/index.js';
|
|
2
2
|
declare class __sveltets_Render<Datum extends DataRecord> {
|
|
3
|
-
props():
|
|
4
|
-
filter?: import("../types/index.js").ConstantAccessor<boolean, Datum>;
|
|
5
|
-
facet?: "auto" | "include" | "exclude";
|
|
6
|
-
fx: ChannelAccessor<Datum>;
|
|
7
|
-
fy: ChannelAccessor<Datum>;
|
|
8
|
-
dx: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
9
|
-
dy: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
10
|
-
fill: ChannelAccessor<Datum>;
|
|
11
|
-
fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
12
|
-
sort: {
|
|
13
|
-
channel: string;
|
|
14
|
-
order?: "ascending" | "descending";
|
|
15
|
-
} | ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Datum>;
|
|
16
|
-
stroke: ChannelAccessor<Datum>;
|
|
17
|
-
strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
18
|
-
strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
19
|
-
strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
|
|
20
|
-
strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
|
|
21
|
-
strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
22
|
-
opacity: ChannelAccessor<Datum>;
|
|
23
|
-
strokeDasharray: import("../types/index.js").ConstantAccessor<string, Datum>;
|
|
24
|
-
strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
25
|
-
mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
|
|
26
|
-
clipPath: string;
|
|
27
|
-
imageFilter: import("../types/index.js").ConstantAccessor<string, Datum>;
|
|
28
|
-
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
|
|
29
|
-
paintOrder: import("../types/index.js").ConstantAccessor<string, Datum>;
|
|
30
|
-
onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
31
|
-
ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
32
|
-
onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
33
|
-
onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
34
|
-
onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
35
|
-
onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
36
|
-
onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
37
|
-
onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
38
|
-
onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
39
|
-
onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
40
|
-
onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
41
|
-
onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
42
|
-
onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
43
|
-
onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
44
|
-
onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
45
|
-
onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
46
|
-
onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
47
|
-
ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
48
|
-
ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
49
|
-
ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
50
|
-
ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
51
|
-
ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
52
|
-
ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
53
|
-
ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
54
|
-
ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
55
|
-
ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
56
|
-
ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
57
|
-
ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
58
|
-
oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
59
|
-
onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
|
|
60
|
-
class?: string;
|
|
61
|
-
style?: string;
|
|
62
|
-
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
|
|
63
|
-
}> & {
|
|
64
|
-
data: Datum[];
|
|
65
|
-
x?: ChannelAccessor<Datum>;
|
|
66
|
-
y?: ChannelAccessor<Datum>;
|
|
67
|
-
/**
|
|
68
|
-
* the window size (the window transform's k option), an integer; defaults to 20
|
|
69
|
-
*/
|
|
70
|
-
n?: number;
|
|
71
|
-
/**
|
|
72
|
-
* the band radius, a number representing a multiple of standard deviations; defaults to 2
|
|
73
|
-
*/
|
|
74
|
-
k?: number;
|
|
75
|
-
};
|
|
3
|
+
props(): any;
|
|
76
4
|
events(): {};
|
|
77
5
|
slots(): {};
|
|
78
6
|
bindings(): "";
|