svelteplot 0.4.7-pr-216.0 → 0.4.7-pr-219.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/core/Plot.svelte +4 -3
  2. package/dist/hooks/plotDefaults.d.ts +3 -0
  3. package/dist/hooks/plotDefaults.js +16 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +2 -0
  6. package/dist/marks/Area.svelte +2 -1
  7. package/dist/marks/AreaX.svelte +4 -3
  8. package/dist/marks/AreaY.svelte +4 -5
  9. package/dist/marks/Arrow.svelte +3 -2
  10. package/dist/marks/AxisX.svelte +3 -4
  11. package/dist/marks/AxisY.svelte +3 -4
  12. package/dist/marks/AxisY.svelte.d.ts +5 -6
  13. package/dist/marks/BarX.svelte +4 -4
  14. package/dist/marks/BarY.svelte +3 -3
  15. package/dist/marks/BoxX.svelte +4 -4
  16. package/dist/marks/BoxY.svelte +4 -4
  17. package/dist/marks/BoxY.svelte.d.ts +1 -0
  18. package/dist/marks/Brush.svelte +13 -7
  19. package/dist/marks/Brush.svelte.d.ts +10 -1
  20. package/dist/marks/BrushX.svelte +4 -4
  21. package/dist/marks/BrushY.svelte +4 -4
  22. package/dist/marks/Cell.svelte +3 -4
  23. package/dist/marks/ColorLegend.svelte +3 -2
  24. package/dist/marks/DifferenceY.svelte +3 -3
  25. package/dist/marks/Dot.svelte +2 -2
  26. package/dist/marks/Frame.svelte +2 -2
  27. package/dist/marks/Geo.svelte +2 -2
  28. package/dist/marks/Graticule.svelte +3 -3
  29. package/dist/marks/GridX.svelte +3 -3
  30. package/dist/marks/GridY.svelte +4 -9
  31. package/dist/marks/Line.svelte +3 -2
  32. package/dist/marks/Link.svelte +3 -3
  33. package/dist/marks/Pointer.svelte +3 -3
  34. package/dist/marks/Rect.svelte +2 -3
  35. package/dist/marks/RectX.svelte +4 -3
  36. package/dist/marks/RectY.svelte +4 -3
  37. package/dist/marks/RuleX.svelte +3 -3
  38. package/dist/marks/RuleY.svelte +4 -4
  39. package/dist/marks/Sphere.svelte +2 -2
  40. package/dist/marks/Spike.svelte +4 -3
  41. package/dist/marks/Text.svelte +4 -4
  42. package/dist/marks/TickX.svelte +3 -3
  43. package/dist/marks/TickY.svelte +4 -4
  44. package/dist/marks/Vector.svelte +3 -3
  45. package/dist/marks/helpers/Marker.svelte +2 -1
  46. package/dist/marks/helpers/MarkerPath.svelte +4 -4
  47. package/dist/marks/helpers/MarkerPath.svelte.d.ts +17 -2
  48. package/dist/types/plot.d.ts +1 -1
  49. package/package.json +1 -1
  50. package/dist/marks/AreaY.svelte.d.ts +0 -100
@@ -8,7 +8,7 @@
8
8
  this component.
9
9
  -->
10
10
  <script lang="ts">
11
- import { getContext, setContext } from 'svelte';
11
+ import { setContext } from 'svelte';
12
12
  import { SvelteMap } from 'svelte/reactivity';
13
13
  import { writable } from 'svelte/store';
14
14
 
@@ -29,6 +29,7 @@
29
29
  import mergeDeep from '../helpers/mergeDeep.js';
30
30
  import { computeScales, projectXY } from '../helpers/scales.js';
31
31
  import { CHANNEL_SCALE, SCALES } from '../constants.js';
32
+ import { getPlotDefaults, setPlotDefaults } from '../hooks/plotDefaults.js';
32
33
 
33
34
  // automatic margins can be applied by the marks, registered
34
35
  // with their respective unique identifier as keys
@@ -52,7 +53,7 @@
52
53
  const maxMarginBottom = $derived(Math.max(...$autoMarginBottom.values()));
53
54
  const maxMarginTop = $derived(Math.max(...$autoMarginTop.values()));
54
55
 
55
- const USER_DEFAULTS = getContext<Partial<PlotDefaults>>('svelteplot/defaults') || {};
56
+ const USER_DEFAULTS = getPlotDefaults();
56
57
 
57
58
  // default settings in the plot and marks can be overwritten by
58
59
  // defining the svelteplot/defaults context outside of Plot
@@ -117,7 +118,7 @@
117
118
 
118
119
  let width = $state(DEFAULTS.initialWidth);
119
120
 
120
- setContext('svelteplot/_defaults', DEFAULTS);
121
+ setPlotDefaults(DEFAULTS);
121
122
 
122
123
  // information that influences the default plot options
123
124
  type PlotOptionsParameters = {
@@ -0,0 +1,3 @@
1
+ import type { PlotDefaults } from '../types';
2
+ export declare function setPlotDefaults(plotDefaults: Partial<PlotDefaults>): void;
3
+ export declare function getPlotDefaults(): Partial<PlotDefaults>;
@@ -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
@@ -3,3 +3,4 @@ export { default as PlotCore } from './core/Plot.svelte';
3
3
  export * from './marks/index.js';
4
4
  export * from './transforms/index.js';
5
5
  export { formatMonth } from './helpers/formats.js';
6
+ export * from './hooks/plotDefaults.js';
package/dist/index.js CHANGED
@@ -4,3 +4,5 @@ export * from './marks/index.js';
4
4
  export * from './transforms/index.js';
5
5
  // helpers
6
6
  export { formatMonth } from './helpers/formats.js';
7
+ // hooks
8
+ export * from './hooks/plotDefaults.js';
@@ -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
- ...getContext<PlotDefaults>('svelteplot/_defaults').area
53
+ ...getPlotDefaults().area
53
54
  };
54
55
 
55
56
  const {
@@ -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, PlotDefaults } from '../types/index.js';
15
- import { getContext, type ComponentProps } from 'svelte';
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 = getContext<PlotDefaults>('svelteplot/_defaults').areaX;
20
+ const DEFAULTS = getPlotDefaults().areaX;
20
21
 
21
22
  const { data, stack, ...options }: AreaXMarkProps = $derived({
22
23
  ...(markProps.x == undefined ? { x1: 0, x2: 0 } : {}),
@@ -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 { RAW_VALUE, recordizeY } from '../transforms/recordize.js';
14
- import type { ChannelAccessor, DataRow, PlotDefaults } from '../types/index.js';
15
- import { getContext, type Component, type ComponentProps } from 'svelte';
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 = getContext<PlotDefaults>('svelteplot/_defaults').areaY;
19
+ const DEFAULTS = getPlotDefaults().areaY;
21
20
 
22
21
  const { data, stack, ...options }: AreaYMarkProps = $derived({
23
22
  ...(markProps.y == undefined ? { y1: 0, y2: 0 } : {}),
@@ -47,7 +47,7 @@
47
47
  RawValue,
48
48
  PlotDefaults
49
49
  } from '../types/index.js';
50
- import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
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
- ...getContext<PlotDefaults>('svelteplot/_defaults').arrow
67
+ ...getPlotDefaults().arrow
67
68
  };
68
69
 
69
70
  const {
@@ -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
- ...getContext<PlotDefaults>('svelteplot/_defaults').axis,
68
- ...getContext<PlotDefaults>('svelteplot/_defaults').axisX
66
+ ...getPlotDefaults().axis,
67
+ ...getPlotDefaults().axisX
69
68
  };
70
69
 
71
70
  const {
@@ -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
- ...getContext<PlotDefaults>('svelteplot/_defaults').axis,
66
- ...getContext<PlotDefaults>('svelteplot/_defaults').axisY
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<CSS.Property.StrokeLinejoin, Datum>;
21
- strokeLinecap: ConstantAccessor<CSS.Property.StrokeLinecap, Datum>;
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<CSS.Property.MixBlendMode, Datum>;
25
+ mixBlendMode: ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
27
26
  clipPath: string;
28
27
  imageFilter: ConstantAccessor<string, Datum>;
29
- shapeRendering: ConstantAccessor<CSS.Property.ShapeRendering, Datum>;
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,7 +59,7 @@ 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<CSS.Property.Cursor, Datum>;
62
+ cursor: ConstantAccessor<import("csstype").Property.Cursor, Datum>;
64
63
  }>, "fillOpacity" | "href" | "target" | "title" | "paintOrder"> & {
65
64
  data?: Datum[] | undefined;
66
65
  automatic?: boolean;
@@ -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
- ...getContext<PlotDefaults>('svelteplot/_defaults').bar,
43
- ...getContext<PlotDefaults>('svelteplot/_defaults').barX
42
+ ...getPlotDefaults().bar,
43
+ ...getPlotDefaults().barX
44
44
  };
45
45
 
46
46
  let markProps: BarXMarkProps = $props();
@@ -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
- ...getContext<PlotDefaults>('svelteplot/_defaults').bar,
46
- ...getContext<PlotDefaults>('svelteplot/_defaults').barY
45
+ ...getPlotDefaults().bar,
46
+ ...getPlotDefaults().barY
47
47
  };
48
48
 
49
49
  let markProps: BarYMarkProps = $props();
@@ -7,17 +7,17 @@
7
7
  import GroupMultiple from './helpers/GroupMultiple.svelte';
8
8
  import { BarX, TickX, RuleY, Dot, groupY } from '../index.js';
9
9
  import { resolveChannel } from '../helpers/resolve.js';
10
- import { getContext, type ComponentProps } from 'svelte';
11
- import type { PlotDefaults } from '../types/index.js';
10
+ import { type ComponentProps } from 'svelte';
12
11
  import type BoxY from './BoxY.svelte';
12
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
13
13
 
14
14
  let markProps: BoxXMarkProps = $props();
15
15
 
16
16
  const DEFAULTS = {
17
17
  tickMedian: true,
18
18
  tickMinMax: false,
19
- ...getContext<PlotDefaults>('svelteplot/_defaults').box,
20
- ...getContext<PlotDefaults>('svelteplot/_defaults').boxX
19
+ ...getPlotDefaults().box,
20
+ ...getPlotDefaults().boxX
21
21
  };
22
22
 
23
23
  const {
@@ -31,16 +31,16 @@
31
31
  import GroupMultiple from './helpers/GroupMultiple.svelte';
32
32
  import { groupX, BarY, TickY, RuleX, Dot } from '../index.js';
33
33
  import { resolveChannel } from '../helpers/resolve.js';
34
- import { getContext, type ComponentProps } from 'svelte';
35
- import type { PlotDefaults } from '../types/index.js';
34
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
35
+ import type { BaseMarkProps, ChannelAccessor, DataRecord } from '../types';
36
36
 
37
37
  let markProps: BoxYMarkProps = $props();
38
38
 
39
39
  const DEFAULTS = {
40
40
  tickMedian: true,
41
41
  tickMinMax: false,
42
- ...getContext<PlotDefaults>('svelteplot/_defaults').box,
43
- ...getContext<PlotDefaults>('svelteplot/_defaults').boxY
42
+ ...getPlotDefaults().box,
43
+ ...getPlotDefaults().boxY
44
44
  };
45
45
 
46
46
  const {
@@ -1,3 +1,4 @@
1
+ import type { ChannelAccessor, DataRecord } from '../types';
1
2
  declare class __sveltets_Render<Datum extends DataRecord> {
2
3
  props(): Pick<BaseMarkProps<Datum_1>, "fill" | "stroke" | "fx" | "fy" | "class"> & {
3
4
  data: Datum[];
@@ -35,14 +35,10 @@
35
35
  }
36
36
  import { getContext } from 'svelte';
37
37
  import Rect from './Rect.svelte';
38
- import type {
39
- BaseMarkProps,
40
- DataRecord,
41
- PlotContext,
42
- PlotDefaults
43
- } from '../types/index.js';
38
+ import type { BaseMarkProps, DataRecord, PlotContext } from '../types/index.js';
44
39
  import { clientToLayerCoordinates } from './helpers/events.js';
45
40
  import Frame from './Frame.svelte';
41
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
46
42
 
47
43
  let { brush = $bindable({ enabled: false }), ...markProps }: BrushMarkProps = $props();
48
44
 
@@ -52,9 +48,19 @@
52
48
  strokeOpacity: 0.6,
53
49
  resizeHandleSize: 10,
54
50
  constrainToDomain: false,
55
- ...getContext<PlotDefaults>('svelteplot/_defaults').brush
51
+ ...getPlotDefaults().brush
56
52
  };
57
53
 
54
+ type Brush = {
55
+ x1?: number | Date;
56
+ x2?: number | Date;
57
+ y1?: number | Date;
58
+ y2?: number | Date;
59
+ enabled: boolean;
60
+ };
61
+
62
+ type BrushEvent = MouseEvent & { brush: Brush };
63
+
58
64
  const {
59
65
  data = [{} as Datum],
60
66
  stroke,
@@ -1,4 +1,14 @@
1
1
  import type { BaseMarkProps, DataRecord } from '../types/index.js';
2
+ type Brush = {
3
+ x1?: number | Date;
4
+ x2?: number | Date;
5
+ y1?: number | Date;
6
+ y2?: number | Date;
7
+ enabled: boolean;
8
+ };
9
+ type BrushEvent = MouseEvent & {
10
+ brush: Brush;
11
+ };
2
12
  interface BrushMarkProps extends Pick<BaseMarkProps<Datum>, 'cursor' | 'stroke' | 'strokeDasharray' | 'strokeOpacity' | 'strokeWidth' | 'strokeLinecap' | 'strokeDashoffset' | 'strokeLinejoin' | 'strokeMiterlimit'> {
3
13
  brush: Brush;
4
14
  /**
@@ -33,5 +43,4 @@ interface $$IsomorphicComponent {
33
43
  }
34
44
  /** For creating a two-dimensional brush selection */
35
45
  declare const Brush: $$IsomorphicComponent;
36
- type Brush<Datum extends DataRecord> = InstanceType<typeof Brush<Datum>>;
37
46
  export default Brush;
@@ -6,13 +6,13 @@
6
6
  interface BrushXMarkProps extends Omit<ComponentProps<typeof Brush>, 'limitDimension'> {}
7
7
 
8
8
  import Brush from './Brush.svelte';
9
- import type { PlotDefaults } from '../types/index.js';
10
- import { getContext, type ComponentProps } from 'svelte';
9
+ import { type ComponentProps } from 'svelte';
10
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
11
11
 
12
12
  let { brush = $bindable({ enabled: false }), ...options }: BrushXMarkProps = $props();
13
13
  const DEFAULTS = {
14
- ...getContext<PlotDefaults>('svelteplot/_defaults').brush,
15
- ...getContext<PlotDefaults>('svelteplot/_defaults').brushX
14
+ ...getPlotDefaults().brush,
15
+ ...getPlotDefaults().brushX
16
16
  };
17
17
  </script>
18
18
 
@@ -4,15 +4,15 @@
4
4
  -->
5
5
  <script lang="ts">
6
6
  import Brush from './Brush.svelte';
7
- import type { PlotDefaults } from '../types/index.js';
8
- import { getContext, type ComponentProps } from 'svelte';
7
+ import { type ComponentProps } from 'svelte';
8
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
9
9
 
10
10
  interface BrushYMarkProps extends Omit<ComponentProps<typeof Brush>, 'limitDimension'> {}
11
11
 
12
12
  let { brush = $bindable({ enabled: false }), ...options }: BrushYMarkProps = $props();
13
13
  const DEFAULTS = {
14
- ...getContext<PlotDefaults>('svelteplot/_defaults').brush,
15
- ...getContext<PlotDefaults>('svelteplot/_defaults').brushY
14
+ ...getPlotDefaults().brush,
15
+ ...getPlotDefaults().brushY
16
16
  };
17
17
  </script>
18
18
 
@@ -17,9 +17,7 @@
17
17
  BaseMarkProps,
18
18
  BaseRectMarkProps,
19
19
  ChannelAccessor,
20
- PlotDefaults,
21
- LinkableMarkProps,
22
- MarkType
20
+ LinkableMarkProps
23
21
  } from '../types/index.js';
24
22
  import Mark from '../Mark.svelte';
25
23
  import { getContext } from 'svelte';
@@ -28,11 +26,12 @@
28
26
 
29
27
  import { isValid } from '../helpers/index.js';
30
28
  import RectPath from './helpers/RectPath.svelte';
29
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
31
30
 
32
31
  let markProps: CellMarkProps = $props();
33
32
 
34
33
  const DEFAULTS = {
35
- ...getContext<PlotDefaults>('svelteplot/_defaults').cell
34
+ ...getPlotDefaults().cell
36
35
  };
37
36
 
38
37
  const {
@@ -10,14 +10,15 @@
10
10
  import { range as d3Range, extent } from 'd3-array';
11
11
  import { maybeSymbol } from '../helpers/symbols.js';
12
12
 
13
- import type { PlotDefaults, PlotContext } from '../types/plot.js';
13
+ import type { PlotContext } from '../types/plot.js';
14
+ import { getPlotDefaults } from '../hooks/plotDefaults';
14
15
 
15
16
  let { class: className = null }: ColorLegendMarkProps = $props();
16
17
 
17
18
  const { getPlotState } = getContext<PlotContext>('svelteplot');
18
19
  const plot = $derived(getPlotState());
19
20
 
20
- const DEFAULTS = getContext<Partial<PlotDefaults>>('svelteplot/_defaults');
21
+ const DEFAULTS = getPlotDefaults();
21
22
 
22
23
  const legendTitle = $derived(plot.options.color.label);
23
24
  const scaleType = $derived(plot.scales.color.type);
@@ -50,8 +50,7 @@
50
50
  ChannelAccessor,
51
51
  CurveName,
52
52
  DataRecord,
53
- PlotContext,
54
- PlotDefaults
53
+ PlotContext
55
54
  } from '../types/index.js';
56
55
  import { Line, Area } from './index.js';
57
56
  import { randomId, coalesce } from '../helpers/index.js';
@@ -59,6 +58,7 @@
59
58
  import { extent, max, min } from 'd3-array';
60
59
  import { resolveChannel } from '../helpers/resolve.js';
61
60
  import type { CurveFactory } from 'd3-shape';
61
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
62
62
 
63
63
  const { getPlotState } = getContext<PlotContext>('svelteplot');
64
64
  let plot = $derived(getPlotState());
@@ -72,7 +72,7 @@
72
72
  negativeFillOpacity: 1,
73
73
  curve: 'linear' as CurveName,
74
74
  tension: 0,
75
- ...getContext<PlotDefaults>('svelteplot/_defaults').differenceY
75
+ ...getPlotDefaults().differenceY
76
76
  };
77
77
 
78
78
  const {
@@ -19,7 +19,6 @@
19
19
  BaseMarkProps,
20
20
  ConstantAccessor,
21
21
  ChannelAccessor,
22
- PlotDefaults,
23
22
  LinkableMarkProps
24
23
  } from '../types/index.js';
25
24
  import { resolveProp, resolveStyles } from '../helpers/resolve.js';
@@ -32,9 +31,10 @@
32
31
  import { recordizeXY } from '../transforms/recordize.js';
33
32
  import { addEventHandlers } from './helpers/events.js';
34
33
  import Anchor from './helpers/Anchor.svelte';
34
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
35
35
 
36
36
  const DEFAULTS = {
37
- ...getContext<PlotDefaults>('svelteplot/_defaults').dot
37
+ ...getPlotDefaults().dot
38
38
  };
39
39
 
40
40
  let markProps: DotMarkProps = $props();
@@ -25,12 +25,12 @@
25
25
  PlotContext,
26
26
  BaseRectMarkProps,
27
27
  LinkableMarkProps,
28
- PlotDefaults,
29
28
  DataRecord
30
29
  } from '../types/index.js';
31
30
  import type { BaseMarkProps } from '../types/index.js';
32
31
  import RectPath from './helpers/RectPath.svelte';
33
32
  import { resolveProp } from '../helpers/resolve';
33
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
34
34
 
35
35
  let markProps: FrameMarkProps = $props();
36
36
 
@@ -40,7 +40,7 @@
40
40
  stroke: undefined,
41
41
  fillOpacity: 1,
42
42
  strokeOpacity: 1,
43
- ...getContext<PlotDefaults>('svelteplot/_defaults').frame
43
+ ...getPlotDefaults().frame
44
44
  };
45
45
 
46
46
  const {
@@ -29,7 +29,6 @@
29
29
  BaseMarkProps,
30
30
  ConstantAccessor,
31
31
  LinkableMarkProps,
32
- PlotDefaults,
33
32
  ChannelAccessor
34
33
  } from '../types/index.js';
35
34
  import Mark from '../Mark.svelte';
@@ -42,6 +41,7 @@
42
41
  import { recordize } from '../transforms/recordize.js';
43
42
  import { GEOJSON_PREFER_STROKE } from '../helpers/index.js';
44
43
  import Anchor from './helpers/Anchor.svelte';
44
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
45
45
 
46
46
  const { getPlotState } = getContext<PlotContext>('svelteplot');
47
47
  const plot = $derived(getPlotState());
@@ -49,7 +49,7 @@
49
49
  let markProps: GeoMarkProps = $props();
50
50
 
51
51
  const DEFAULTS = {
52
- ...getContext<PlotDefaults>('svelteplot/_defaults').geo
52
+ ...getPlotDefaults().geo
53
53
  };
54
54
 
55
55
  const {
@@ -14,14 +14,14 @@
14
14
  }
15
15
  import Geo from './Geo.svelte';
16
16
  import { geoGraticule } from 'd3-geo';
17
- import { getContext } from 'svelte';
18
- import type { BaseMarkProps, PlotDefaults } from '../types/index.js';
17
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
18
+ import type { BaseMarkProps } from '../types/index.js';
19
19
 
20
20
  let markProps: GraticuleMarkProps = $props();
21
21
 
22
22
  const DEFAULTS = {
23
23
  step: 10,
24
- ...getContext<PlotDefaults>('svelteplot/_defaults').graticule
24
+ ...getPlotDefaults().graticule
25
25
  };
26
26
 
27
27
  const { class: className = '', ...options }: GraticuleMarkProps = $derived({
@@ -14,7 +14,6 @@
14
14
  PlotContext,
15
15
  BaseMarkProps,
16
16
  RawValue,
17
- PlotDefaults,
18
17
  DataRecord,
19
18
  ChannelAccessor
20
19
  } from '../types/index.js';
@@ -24,12 +23,13 @@
24
23
  import { RAW_VALUE } from '../transforms/recordize.js';
25
24
  import isDataRecord from '../helpers/isDataRecord';
26
25
  import { INDEX } from '../constants';
26
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
27
27
 
28
28
  let markProps: GridXMarkProps = $props();
29
29
 
30
30
  const DEFAULTS = {
31
- ...getContext<PlotDefaults>('svelteplot/_defaults').grid,
32
- ...getContext<PlotDefaults>('svelteplot/_defaults').gridX
31
+ ...getPlotDefaults().grid,
32
+ ...getPlotDefaults().gridX
33
33
  };
34
34
 
35
35
  const {
@@ -10,23 +10,18 @@
10
10
  }
11
11
  import { getContext } from 'svelte';
12
12
  import Mark from '../Mark.svelte';
13
- import type {
14
- PlotContext,
15
- BaseMarkProps,
16
- RawValue,
17
- PlotDefaults,
18
- ChannelAccessor
19
- } from '../types/index.js';
13
+ import type { PlotContext, BaseMarkProps, RawValue, ChannelAccessor } from '../types/index.js';
20
14
  import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
21
15
  import { autoTicks } from '../helpers/autoTicks.js';
22
16
  import { testFilter } from '../helpers/index.js';
23
17
  import { RAW_VALUE } from '../transforms/recordize.js';
18
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
24
19
 
25
20
  let markProps: GridYMarkProps = $props();
26
21
 
27
22
  const DEFAULTS = {
28
- ...getContext<PlotDefaults>('svelteplot/_defaults').grid,
29
- ...getContext<PlotDefaults>('svelteplot/_defaults').gridY
23
+ ...getPlotDefaults().grid,
24
+ ...getPlotDefaults().gridY
30
25
  };
31
26
 
32
27
  const {
@@ -42,11 +42,12 @@
42
42
  import { pick } from 'es-toolkit';
43
43
  import LineCanvas from './helpers/LineCanvas.svelte';
44
44
 
45
- import type { RawValue, PlotDefaults } from '../types/index.js';
45
+ import type { RawValue } from '../types/index.js';
46
46
  import { isValid } from '../helpers/index.js';
47
47
  import { sort } from '../transforms/sort.js';
48
48
  import { recordizeXY } from '../transforms/recordize.js';
49
49
  import GroupMultiple from './helpers/GroupMultiple.svelte';
50
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
50
51
 
51
52
  let markProps: LineMarkProps = $props();
52
53
 
@@ -56,7 +57,7 @@
56
57
  canvas: false,
57
58
  class: null,
58
59
  lineClass: null,
59
- ...getContext<Partial<PlotDefaults>>('svelteplot/_defaults').line
60
+ ...getPlotDefaults().line
60
61
  };
61
62
 
62
63
  const {
@@ -44,8 +44,7 @@
44
44
  CurveName,
45
45
  MarkerOptions,
46
46
  RawValue,
47
- ScaledDataRecord,
48
- PlotDefaults
47
+ ScaledDataRecord
49
48
  } from '../types/index.js';
50
49
  import { resolveChannel, resolveProp, resolveStyles } from '../helpers/resolve.js';
51
50
  import Mark from '../Mark.svelte';
@@ -58,10 +57,11 @@
58
57
  import { pick } from 'es-toolkit';
59
58
  import { sort } from '../transforms/sort.js';
60
59
  import { indexData } from '../transforms/recordize.js';
60
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
61
61
 
62
62
  let markProps: LinkMarkProps = $props();
63
63
  const DEFAULTS = {
64
- ...getContext<PlotDefaults>('svelteplot/_defaults').link
64
+ ...getPlotDefaults().link
65
65
  };
66
66
  const {
67
67
  data = [{} as Datum],
@@ -24,14 +24,14 @@
24
24
  }
25
25
 
26
26
  import { getContext, type Snippet } from 'svelte';
27
- import type { ChannelAccessor, DataRow, PlotContext, PlotDefaults } from '../types/index.js';
28
- import { groups as d3Groups } from 'd3-array';
27
+ import type { ChannelAccessor, DataRow, PlotContext } from '../types/index.js';
29
28
  import { resolveChannel } from '../helpers/resolve.js';
30
29
  import { quadtree } from 'd3-quadtree';
31
30
  import { projectXY } from '../helpers/scales.js';
32
31
  import isDataRecord from '../helpers/isDataRecord.js';
33
32
  import { indexData, RAW_VALUE } from '../transforms/recordize.js';
34
33
  import { groupFacetsAndZ } from '../helpers/group.js';
34
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
35
35
 
36
36
  const { getPlotState } = getContext<PlotContext>('svelteplot');
37
37
  const plot = $derived(getPlotState());
@@ -42,7 +42,7 @@
42
42
  let markProps: PointerMarkProps = $props();
43
43
 
44
44
  const DEFAULTS = {
45
- ...getContext<PlotDefaults>('svelteplot/_defaults').pointer
45
+ ...getPlotDefaults().pointer
46
46
  };
47
47
 
48
48
  const {
@@ -26,17 +26,16 @@
26
26
  BaseMarkProps,
27
27
  BaseRectMarkProps,
28
28
  ChannelAccessor,
29
- PlotDefaults,
30
29
  LinkableMarkProps
31
30
  } from '../types/index.js';
32
31
  import GroupMultiple from './helpers/GroupMultiple.svelte';
33
32
  import RectPath from './helpers/RectPath.svelte';
34
- import { resolveProp } from '../helpers/resolve';
33
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
35
34
 
36
35
  let markProps: RectMarkProps = $props();
37
36
 
38
37
  const DEFAULTS = {
39
- ...getContext<PlotDefaults>('svelteplot/_defaults').rect
38
+ ...getPlotDefaults().rect
40
39
  };
41
40
 
42
41
  const {
@@ -9,15 +9,16 @@
9
9
 
10
10
  import Rect from './Rect.svelte';
11
11
  import { intervalY, stackX, recordizeX } from '../index.js';
12
- import type { DataRecord, PlotContext, PlotDefaults } from '../types/index.js';
12
+ import type { DataRecord, PlotContext } from '../types/index.js';
13
13
  import { getContext, type ComponentProps } from 'svelte';
14
14
  import type { StackOptions } from '../transforms/stack.js';
15
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
15
16
 
16
17
  let markProps: RectXMarkProps = $props();
17
18
 
18
19
  const DEFAULTS = {
19
- ...getContext<PlotDefaults>('svelteplot/_defaults').rect,
20
- ...getContext<PlotDefaults>('svelteplot/_defaults').rectX
20
+ ...getPlotDefaults().rect,
21
+ ...getPlotDefaults().rectX
21
22
  };
22
23
 
23
24
  const {
@@ -7,15 +7,16 @@
7
7
  }
8
8
  import Rect from './Rect.svelte';
9
9
  import { intervalX, stackY, recordizeY } from '../index.js';
10
- import type { DataRecord, PlotContext, PlotDefaults } from '../types/index.js';
10
+ import type { DataRecord, PlotContext } from '../types/index.js';
11
11
  import { getContext, type ComponentProps } from 'svelte';
12
12
  import type { StackOptions } from '../transforms/stack.js';
13
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
13
14
 
14
15
  let markProps: RectYMarkProps = $props();
15
16
 
16
17
  const DEFAULTS = {
17
- ...getContext<PlotDefaults>('svelteplot/_defaults').rect,
18
- ...getContext<PlotDefaults>('svelteplot/_defaults').rectY
18
+ ...getPlotDefaults().rect,
19
+ ...getPlotDefaults().rectY
19
20
  };
20
21
 
21
22
  const {
@@ -22,14 +22,14 @@
22
22
  BaseMarkProps,
23
23
  ConstantAccessor,
24
24
  ChannelAccessor,
25
- PlotDefaults,
26
25
  RawValue
27
26
  } from '../types/index.js';
27
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
28
28
 
29
29
  let markProps: RuleXMarkProps = $props();
30
30
  const DEFAULTS = {
31
- ...getContext<PlotDefaults>('svelteplot/_defaults').rule,
32
- ...getContext<PlotDefaults>('svelteplot/_defaults').ruleX
31
+ ...getPlotDefaults().rule,
32
+ ...getPlotDefaults().ruleX
33
33
  };
34
34
  const {
35
35
  data = [{} as Datum],
@@ -21,14 +21,14 @@
21
21
  DataRecord,
22
22
  BaseMarkProps,
23
23
  ConstantAccessor,
24
- ChannelAccessor,
25
- PlotDefaults
24
+ ChannelAccessor
26
25
  } from '../types/index.js';
26
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
27
27
 
28
28
  let markProps: RuleYMarkProps = $props();
29
29
  const DEFAULTS = {
30
- ...getContext<PlotDefaults>('svelteplot/_defaults').rule,
31
- ...getContext<PlotDefaults>('svelteplot/_defaults').ruleY
30
+ ...getPlotDefaults().rule,
31
+ ...getPlotDefaults().ruleY
32
32
  };
33
33
  const {
34
34
  data = [{} as Datum],
@@ -6,14 +6,14 @@
6
6
  extends BaseMarkProps<GeoJSON.GeoJsonObject>,
7
7
  LinkableMarkProps<GeoJSON.GeoJsonObject> {}
8
8
 
9
- import { getContext } from 'svelte';
10
9
  import Geo from './Geo.svelte';
11
10
  import type { BaseMarkProps, LinkableMarkProps, PlotDefaults } from '../types/index.js';
11
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
12
12
 
13
13
  let markProps: SphereMarkProps = $props();
14
14
 
15
15
  const DEFAULTS = {
16
- ...getContext<PlotDefaults>('svelteplot/_defaults').sphere
16
+ ...getPlotDefaults().sphere
17
17
  };
18
18
 
19
19
  const { ...options }: SphereMarkProps = $derived({
@@ -16,8 +16,9 @@
16
16
  rotate?: ChannelAccessor<Datum>;
17
17
  }
18
18
  import Vector from './Vector.svelte';
19
- import type { ChannelAccessor, DataRecord, PlotDefaults } from '../types/index.js';
20
- import { getContext, type ComponentProps } from 'svelte';
19
+ import type { ChannelAccessor, DataRecord } from '../types/index.js';
20
+ import { type ComponentProps } from 'svelte';
21
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
21
22
 
22
23
  let markProps: SpikeMarkProps = $props();
23
24
 
@@ -29,7 +30,7 @@
29
30
  stroke: 'currentColor',
30
31
  sort: { channel: '-y' },
31
32
  shape: 'spike' as const,
32
- ...getContext<PlotDefaults>('svelteplot/_defaults').spike
33
+ ...getPlotDefaults().spike
33
34
  };
34
35
 
35
36
  const { data = [{} as Datum], ...options }: SpikeMarkProps = $derived({
@@ -56,22 +56,22 @@
56
56
  rotate?: ConstantAccessor<number, Datum>;
57
57
  }
58
58
 
59
- import { getContext, type Snippet } from 'svelte';
59
+ import { type Snippet } from 'svelte';
60
60
  import GroupMultiple from './helpers/GroupMultiple.svelte';
61
61
  import type {
62
62
  DataRecord,
63
63
  BaseMarkProps,
64
64
  ConstantAccessor,
65
65
  ChannelAccessor,
66
- PlotDefaults,
67
66
  LinkableMarkProps
68
67
  } from '../types/index.js';
69
- import { resolveProp, resolveStyles } from '../helpers/resolve.js';
68
+ import { resolveProp } from '../helpers/resolve.js';
70
69
  import Mark from '../Mark.svelte';
71
70
  import { sort } from '../index.js';
72
71
 
73
72
  import MultilineText from './helpers/MultilineText.svelte';
74
73
  import { indexData } from '../transforms/recordize';
74
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
75
75
 
76
76
  const DEFAULTS = {
77
77
  fontSize: 12,
@@ -80,7 +80,7 @@
80
80
  frameAnchor: 'middle' as const,
81
81
  lineHeight: 1.1,
82
82
  rotate: 0,
83
- ...getContext<PlotDefaults>('svelteplot/_defaults').text
83
+ ...getPlotDefaults().text
84
84
  };
85
85
 
86
86
  let markProps: TextMarkProps = $props();
@@ -30,21 +30,21 @@
30
30
  ChannelAccessor,
31
31
  DataRow,
32
32
  FacetContext,
33
- PlotDefaults,
34
33
  ConstantAccessor
35
34
  } from '../types/index.js';
36
35
  import { recordizeX } from '../index.js';
37
36
  import { projectX, projectY } from '../helpers/scales.js';
38
37
  import { isValid } from '../helpers/index.js';
39
38
  import { testFilter, parseInset } from '../helpers/index.js';
39
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
40
40
 
41
41
  const { getPlotState } = getContext<PlotContext>('svelteplot');
42
42
  let plot = $derived(getPlotState());
43
43
 
44
44
  let markProps: TickXMarkProps = $props();
45
45
  const DEFAULTS = {
46
- ...getContext<PlotDefaults>('svelteplot/_defaults').tick,
47
- ...getContext<PlotDefaults>('svelteplot/_defaults').tickX
46
+ ...getPlotDefaults().tick,
47
+ ...getPlotDefaults().tickX
48
48
  };
49
49
  const {
50
50
  data = [{}],
@@ -29,21 +29,21 @@
29
29
  ChannelAccessor,
30
30
  DataRow,
31
31
  FacetContext,
32
- ConstantAccessor,
33
- PlotDefaults
32
+ ConstantAccessor
34
33
  } from '../types/index.js';
35
34
  import { recordizeY } from '../index.js';
36
35
  import { projectX, projectY } from '../helpers/scales.js';
37
36
  import { isValid } from '../helpers/index.js';
38
37
  import { testFilter, parseInset } from '../helpers/index.js';
38
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
39
39
 
40
40
  const { getPlotState } = getContext<PlotContext>('svelteplot');
41
41
  let plot = $derived(getPlotState());
42
42
 
43
43
  let markProps: TickYMarkProps = $props();
44
44
  const DEFAULTS = {
45
- ...getContext<PlotDefaults>('svelteplot/_defaults').tick,
46
- ...getContext<PlotDefaults>('svelteplot/_defaults').tickY
45
+ ...getPlotDefaults().tick,
46
+ ...getPlotDefaults().tickY
47
47
  };
48
48
  const {
49
49
  data = [{}],
@@ -33,8 +33,7 @@
33
33
  DataRecord,
34
34
  BaseMarkProps,
35
35
  ChannelAccessor,
36
- FacetContext,
37
- PlotDefaults
36
+ FacetContext
38
37
  } from '../types/index.js';
39
38
 
40
39
  import { getContext, type Snippet } from 'svelte';
@@ -47,6 +46,7 @@
47
46
  import { isValid } from '../helpers/index.js';
48
47
  import { addEventHandlers } from './helpers/events.js';
49
48
  import { indexData } from '../transforms/recordize.js';
49
+ import { getPlotDefaults } from '../hooks/plotDefaults.js';
50
50
 
51
51
  const defaultRadius = 3.5;
52
52
 
@@ -58,7 +58,7 @@
58
58
 
59
59
  let markProps: VectorMarkProps = $props();
60
60
  const DEFAULTS = {
61
- ...getContext<PlotDefaults>('svelteplot/_defaults').vector
61
+ ...getPlotDefaults().vector
62
62
  };
63
63
  const {
64
64
  data = [{}],
@@ -16,6 +16,7 @@
16
16
 
17
17
  <script lang="ts">
18
18
  import { getContext } from 'svelte';
19
+ import { getPlotDefaults } from '../../hooks/plotDefaults';
19
20
 
20
21
  type MarkerProps = {
21
22
  id: string;
@@ -68,7 +69,7 @@
68
69
  }
69
70
  };
70
71
 
71
- const defaultDotRadius = getContext('svelteplot/_defaults').markerDotRadius;
72
+ const defaultDotRadius = getPlotDefaults().markerDotRadius;
72
73
 
73
74
  const markerColors = $derived({
74
75
  fill: 'none',
@@ -2,7 +2,7 @@
2
2
  @component
3
3
  Helper component for paths with markers and optional text along the path.
4
4
  -->
5
- <script lang="ts">
5
+ <script lang="ts" generics="Datum extends DataRecord">
6
6
  import Marker, { type MarkerShape } from './Marker.svelte';
7
7
  import { isSnippet, randomId } from '../../helpers/index.js';
8
8
  import { resolveProp } from '../../helpers/resolve.js';
@@ -17,12 +17,12 @@
17
17
  import { addEventHandlers } from './events.js';
18
18
  import { getContext } from 'svelte';
19
19
 
20
- type MarkerPathProps = BaseMarkProps & {
20
+ type MarkerPathProps = BaseMarkProps<Datum> & {
21
21
  /**
22
22
  * the datum associated with this path, usually the first
23
23
  * element of the data array group
24
24
  */
25
- datum: DataRecord;
25
+ datum: Datum;
26
26
  /**
27
27
  * the marker shape to use at the start of the path, defaults to
28
28
  * circle
@@ -52,7 +52,7 @@
52
52
  transform: string;
53
53
  color: string;
54
54
  strokeWidth: ConstantAccessor<number>;
55
- mark: Mark<BaseMarkProps>;
55
+ mark: Mark<BaseMarkProps<Datum>>;
56
56
  scales: PlotScales;
57
57
  };
58
58
 
@@ -1,4 +1,19 @@
1
+ import type { DataRecord } from '../../types/index.js';
2
+ declare class __sveltets_Render<Datum extends DataRecord> {
3
+ props(): any;
4
+ events(): {};
5
+ slots(): {};
6
+ bindings(): "";
7
+ exports(): {};
8
+ }
9
+ interface $$IsomorphicComponent {
10
+ new <Datum extends DataRecord>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Datum>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Datum>['props']>, ReturnType<__sveltets_Render<Datum>['events']>, ReturnType<__sveltets_Render<Datum>['slots']>> & {
11
+ $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
12
+ } & ReturnType<__sveltets_Render<Datum>['exports']>;
13
+ <Datum extends DataRecord>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
14
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
15
+ }
1
16
  /** Helper component for paths with markers and optional text along the path. */
2
- declare const MarkerPath: import("svelte").Component<any, {}, "">;
3
- type MarkerPath = ReturnType<typeof MarkerPath>;
17
+ declare const MarkerPath: $$IsomorphicComponent;
18
+ type MarkerPath<Datum extends DataRecord> = InstanceType<typeof MarkerPath<Datum>>;
4
19
  export default MarkerPath;
@@ -58,7 +58,7 @@ export type PlotMargin = {
58
58
  };
59
59
  /**
60
60
  * these are the default options for the plot marks that can be set using
61
- * the 'svelteplot/defaults' context.
61
+ * the setPlotDefaults hook
62
62
  */
63
63
  export type PlotDefaults = {
64
64
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelteplot",
3
- "version": "0.4.7-pr-216.0",
3
+ "version": "0.4.7-pr-219.1",
4
4
  "license": "ISC",
5
5
  "author": {
6
6
  "name": "Gregor Aisch",
@@ -1,100 +0,0 @@
1
- import { renameChannels } from '../transforms/rename.js';
2
- import type { ChannelAccessor, DataRow } from '../types/index.js';
3
- declare class __sveltets_Render<Datum extends DataRow> {
4
- props(): Omit<Partial<{
5
- filter?: import("../types/index.js").ConstantAccessor<boolean, Record<string | symbol, import("../types/data").RawValue>>;
6
- facet?: "auto" | "include" | "exclude";
7
- fx: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
8
- fy: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
9
- dx: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
10
- dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
11
- fill: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
12
- fillOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
13
- sort: {
14
- channel: string;
15
- order?: "ascending" | "descending";
16
- } | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Record<string | symbol, import("../types/data").RawValue>>;
17
- stroke: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
18
- strokeWidth: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
19
- strokeOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
20
- strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Record<string | symbol, import("../types/data").RawValue>>;
21
- strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Record<string | symbol, import("../types/data").RawValue>>;
22
- strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
23
- opacity: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
24
- strokeDasharray: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
25
- strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
26
- mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Record<string | symbol, import("../types/data").RawValue>>;
27
- clipPath: string;
28
- imageFilter: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
29
- shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Record<string | symbol, import("../types/data").RawValue>>;
30
- paintOrder: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
31
- onclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
32
- ondblclick?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
33
- onmouseup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
34
- onmousedown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
35
- onmouseenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
36
- onmousemove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
37
- onmouseleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
38
- onmouseout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
39
- onmouseover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
40
- onpointercancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
41
- onpointerdown?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
42
- onpointerup?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
43
- onpointerenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
44
- onpointerleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
45
- onpointermove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
46
- onpointerover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
47
- onpointerout?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
48
- ondrag?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
49
- ondrop?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
50
- ondragstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
51
- ondragenter?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
52
- ondragleave?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
53
- ondragover?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
54
- ondragend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
55
- ontouchstart?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
56
- ontouchmove?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
57
- ontouchend?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
58
- ontouchcancel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
59
- oncontextmenu?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
60
- onwheel?: import("svelte/elements").MouseEventHandler<SVGPathElement>;
61
- class?: string;
62
- style?: string;
63
- cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Record<string | symbol, import("../types/data").RawValue>>;
64
- }> & import("../types/mark").LinkableMarkProps<Record<string | symbol, import("../types/data").RawValue>> & {
65
- data: Record<string | symbol, import("../types/data").RawValue>[];
66
- x1?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
67
- x2?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
68
- y1?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
69
- y2?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
70
- z?: ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
71
- curve?: import("../types/index.js").CurveName | import("d3-shape").CurveFactory;
72
- tension?: number;
73
- sort?: import("../types/index.js").ConstantAccessor<import("../types/data").RawValue> | {
74
- channel: "stroke" | "fill";
75
- };
76
- stack?: Partial<renameChannels>;
77
- canvas?: boolean;
78
- }, "x1" | "x2"> & {
79
- x?: ChannelAccessor<Datum>;
80
- y?: ChannelAccessor<Datum>;
81
- };
82
- events(): {};
83
- slots(): {};
84
- bindings(): "";
85
- exports(): {};
86
- }
87
- interface $$IsomorphicComponent {
88
- new <Datum extends DataRow>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Datum>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Datum>['props']>, ReturnType<__sveltets_Render<Datum>['events']>, ReturnType<__sveltets_Render<Datum>['slots']>> & {
89
- $$bindings?: ReturnType<__sveltets_Render<Datum>['bindings']>;
90
- } & ReturnType<__sveltets_Render<Datum>['exports']>;
91
- <Datum extends DataRow>(internal: unknown, props: ReturnType<__sveltets_Render<Datum>['props']> & {}): ReturnType<__sveltets_Render<Datum>['exports']>;
92
- z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
93
- }
94
- /**
95
- * Creates a vertical area chart with y value and baseline. Areas are implicitly
96
- * stacked vertically if just the y channel is defined.
97
- */
98
- declare const AreaY: $$IsomorphicComponent;
99
- type AreaY<Datum extends DataRow> = InstanceType<typeof AreaY<Datum>>;
100
- export default AreaY;