svelteplot 0.4.7 → 0.4.8

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 (88) hide show
  1. package/dist/Mark.svelte.d.ts +2 -2
  2. package/dist/core/Plot.svelte +54 -31
  3. package/dist/hooks/plotDefaults.d.ts +3 -0
  4. package/dist/hooks/plotDefaults.js +16 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +2 -0
  7. package/dist/marks/Area.svelte +2 -1
  8. package/dist/marks/Area.svelte.d.ts +2 -2
  9. package/dist/marks/AreaX.svelte +4 -3
  10. package/dist/marks/AreaX.svelte.d.ts +2 -2
  11. package/dist/marks/AreaY.svelte +4 -5
  12. package/dist/marks/Arrow.svelte +3 -2
  13. package/dist/marks/Arrow.svelte.d.ts +2 -2
  14. package/dist/marks/AxisX.svelte +3 -4
  15. package/dist/marks/AxisX.svelte.d.ts +3 -3
  16. package/dist/marks/AxisY.svelte +3 -4
  17. package/dist/marks/AxisY.svelte.d.ts +8 -9
  18. package/dist/marks/BarX.svelte +4 -4
  19. package/dist/marks/BarX.svelte.d.ts +2 -2
  20. package/dist/marks/BarY.svelte +3 -3
  21. package/dist/marks/BarY.svelte.d.ts +2 -2
  22. package/dist/marks/BollingerX.svelte.d.ts +2 -2
  23. package/dist/marks/BollingerY.svelte.d.ts +2 -2
  24. package/dist/marks/BoxX.svelte +4 -4
  25. package/dist/marks/BoxY.svelte +4 -4
  26. package/dist/marks/BoxY.svelte.d.ts +67 -6
  27. package/dist/marks/Brush.svelte +13 -7
  28. package/dist/marks/Brush.svelte.d.ts +10 -1
  29. package/dist/marks/BrushX.svelte +4 -4
  30. package/dist/marks/BrushY.svelte +4 -4
  31. package/dist/marks/Cell.svelte +3 -4
  32. package/dist/marks/Cell.svelte.d.ts +2 -2
  33. package/dist/marks/ColorLegend.svelte +5 -4
  34. package/dist/marks/CustomMark.svelte.d.ts +2 -2
  35. package/dist/marks/CustomMarkHTML.svelte.d.ts +1 -1
  36. package/dist/marks/DifferenceY.svelte +3 -3
  37. package/dist/marks/DifferenceY.svelte.d.ts +2 -2
  38. package/dist/marks/Dot.svelte +2 -2
  39. package/dist/marks/Dot.svelte.d.ts +2 -2
  40. package/dist/marks/DotX.svelte.d.ts +3 -3
  41. package/dist/marks/DotY.svelte.d.ts +3 -3
  42. package/dist/marks/Frame.svelte +2 -2
  43. package/dist/marks/Geo.svelte +2 -2
  44. package/dist/marks/Geo.svelte.d.ts +2 -2
  45. package/dist/marks/Graticule.svelte +3 -3
  46. package/dist/marks/GridX.svelte +3 -3
  47. package/dist/marks/GridX.svelte.d.ts +2 -2
  48. package/dist/marks/GridY.svelte +4 -9
  49. package/dist/marks/GridY.svelte.d.ts +2 -2
  50. package/dist/marks/Line.svelte +3 -2
  51. package/dist/marks/Line.svelte.d.ts +2 -2
  52. package/dist/marks/LineX.svelte.d.ts +3 -3
  53. package/dist/marks/LineY.svelte.d.ts +3 -3
  54. package/dist/marks/Link.svelte +3 -3
  55. package/dist/marks/Link.svelte.d.ts +2 -2
  56. package/dist/marks/Pointer.svelte +3 -3
  57. package/dist/marks/Rect.svelte +2 -3
  58. package/dist/marks/Rect.svelte.d.ts +2 -2
  59. package/dist/marks/RectX.svelte +4 -3
  60. package/dist/marks/RectY.svelte +4 -3
  61. package/dist/marks/RuleX.svelte +3 -3
  62. package/dist/marks/RuleX.svelte.d.ts +2 -2
  63. package/dist/marks/RuleY.svelte +4 -4
  64. package/dist/marks/RuleY.svelte.d.ts +2 -2
  65. package/dist/marks/Sphere.svelte +2 -2
  66. package/dist/marks/Spike.svelte +4 -3
  67. package/dist/marks/Spike.svelte.d.ts +3 -3
  68. package/dist/marks/Text.svelte +4 -4
  69. package/dist/marks/Text.svelte.d.ts +4 -4
  70. package/dist/marks/TickX.svelte +3 -3
  71. package/dist/marks/TickX.svelte.d.ts +2 -2
  72. package/dist/marks/TickY.svelte +4 -4
  73. package/dist/marks/TickY.svelte.d.ts +2 -2
  74. package/dist/marks/Vector.svelte +3 -3
  75. package/dist/marks/Vector.svelte.d.ts +2 -2
  76. package/dist/marks/helpers/CanvasLayer.svelte +1 -1
  77. package/dist/marks/helpers/Marker.svelte +2 -1
  78. package/dist/marks/helpers/MarkerPath.svelte +4 -4
  79. package/dist/marks/helpers/MarkerPath.svelte.d.ts +175 -2
  80. package/dist/marks/helpers/RectPath.svelte.d.ts +2 -2
  81. package/dist/transforms/bollinger.d.ts +2 -2
  82. package/dist/transforms/interval.d.ts +4 -4
  83. package/dist/transforms/select.d.ts +14 -14
  84. package/dist/transforms/sort.d.ts +4 -4
  85. package/dist/transforms/window.d.ts +4 -4
  86. package/dist/types/plot.d.ts +15 -8
  87. package/package.json +1 -1
  88. package/dist/marks/AreaY.svelte.d.ts +0 -99
@@ -1,28 +1,89 @@
1
+ import type { ChannelAccessor, DataRecord } from '../types';
1
2
  declare class __sveltets_Render<Datum extends DataRecord> {
2
- props(): Pick<BaseMarkProps<Datum_1>, "fill" | "stroke" | "fx" | "fy" | "class"> & {
3
+ props(): Pick<Partial<{
4
+ filter?: import("../types").ConstantAccessor<boolean, Datum>;
5
+ facet?: "auto" | "include" | "exclude";
6
+ fx: ChannelAccessor<Datum>;
7
+ fy: ChannelAccessor<Datum>;
8
+ dx: import("../types").ConstantAccessor<number, Datum>;
9
+ dy: import("../types").ConstantAccessor<number, Datum>;
10
+ fill: ChannelAccessor<Datum>;
11
+ fillOpacity: import("../types").ConstantAccessor<number, Datum>;
12
+ sort: ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | {
13
+ channel: string;
14
+ order?: "ascending" | "descending";
15
+ } | import("../types").ConstantAccessor<import("../types").RawValue, Datum>;
16
+ stroke: ChannelAccessor<Datum>;
17
+ strokeWidth: import("../types").ConstantAccessor<number, Datum>;
18
+ strokeOpacity: import("../types").ConstantAccessor<number, Datum>;
19
+ strokeLinejoin: import("../types").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
20
+ strokeLinecap: import("../types").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
21
+ strokeMiterlimit: import("../types").ConstantAccessor<number, Datum>;
22
+ opacity: ChannelAccessor<Datum>;
23
+ strokeDasharray: import("../types").ConstantAccessor<string, Datum>;
24
+ strokeDashoffset: import("../types").ConstantAccessor<number, Datum>;
25
+ mixBlendMode: import("../types").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
26
+ clipPath: string;
27
+ imageFilter: import("../types").ConstantAccessor<string, Datum>;
28
+ shapeRendering: import("../types").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
29
+ paintOrder: import("../types").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").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
63
+ }>, "fx" | "fy" | "fill" | "stroke" | "class"> & {
3
64
  data: Datum[];
4
65
  x: ChannelAccessor;
5
66
  y: ChannelAccessor;
6
67
  /**
7
68
  * Options for the rule marks that represent the min/max range
8
69
  */
9
- rule: Record<string, ChannelAccessor<Datum_1>>;
70
+ rule: Record<string, ChannelAccessor<Datum>>;
10
71
  /**
11
72
  * Options for the bar marks that represent the IQR range
12
73
  */
13
- bar: Record<string, ChannelAccessor<Datum_1>>;
74
+ bar: Record<string, ChannelAccessor<Datum>>;
14
75
  /**
15
76
  * Options for the tick marks that represent the median
16
77
  */
17
- tickMedian: Record<string, ChannelAccessor<Datum_1>> | boolean;
78
+ tickMedian: boolean | Record<string, ChannelAccessor<Datum>>;
18
79
  /**
19
80
  * Options for the tick marks that represent the min/max range
20
81
  */
21
- tickMinMax: Record<string, ChannelAccessor<Datum_1>> | boolean;
82
+ tickMinMax: boolean | Record<string, ChannelAccessor<Datum>>;
22
83
  /**
23
84
  * Options for the dot marks that represent the outliers
24
85
  */
25
- dot: Record<string, ChannelAccessor<Datum_1>>;
86
+ dot: Record<string, ChannelAccessor<Datum>>;
26
87
  };
27
88
  events(): {};
28
89
  slots(): {};
@@ -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 {
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum extends DataRecord> {
9
9
  dy: import("../types/index.js").ConstantAccessor<number, Datum>;
10
10
  fill: ChannelAccessor<Datum>;
11
11
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
12
- sort: {
12
+ sort: ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | {
13
13
  channel: string;
14
14
  order?: "ascending" | "descending";
15
- } | ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data.js").RawValue, Datum>;
15
+ } | import("../types/index.js").ConstantAccessor<import("../types/data.js").RawValue, Datum>;
16
16
  stroke: ChannelAccessor<Datum>;
17
17
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
18
18
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
@@ -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);
@@ -88,7 +89,7 @@
88
89
  ).slice(1)}
89
90
  <Plot
90
91
  maxWidth="240px"
91
- margins={1}
92
+ margin={1}
92
93
  marginLeft={1}
93
94
  marginRight={1}
94
95
  marginTop={6}
@@ -121,7 +122,7 @@
121
122
 
122
123
  <Plot
123
124
  maxWidth="240px"
124
- margins={1}
125
+ margin={1}
125
126
  marginLeft={10}
126
127
  marginRight={10}
127
128
  marginTop={6}
@@ -10,10 +10,10 @@ declare class __sveltets_Render<Datum extends DataRecord> {
10
10
  dy: import("../types/index.js").ConstantAccessor<number, Datum>;
11
11
  fill: ChannelAccessor<Datum>;
12
12
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
13
- sort: {
13
+ sort: ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | {
14
14
  channel: string;
15
15
  order?: "ascending" | "descending";
16
- } | ((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
+ } | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Datum>;
17
17
  stroke: ChannelAccessor<Datum>;
18
18
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
19
19
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
@@ -5,7 +5,7 @@ declare class __sveltets_Render<Datum extends DataRecord> {
5
5
  data: Datum[];
6
6
  x?: ChannelAccessor<Datum>;
7
7
  y?: ChannelAccessor<Datum>;
8
- frameAnchor?: ConstantAccessor<"bottom" | "top" | "left" | "right" | "center" | "top-left" | "bottom-left" | "top-right" | "bottom-right", Datum>;
8
+ frameAnchor?: ConstantAccessor<"top" | "bottom" | "left" | "center" | "right" | "top-left" | "bottom-left" | "top-right" | "bottom-right", Datum>;
9
9
  class: string | null;
10
10
  children: Snippet<{
11
11
  datum: Datum;
@@ -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 {
@@ -10,10 +10,10 @@ declare class __sveltets_Render<Datum extends DataRecord> {
10
10
  dy: import("../types/index.js").ConstantAccessor<number, Datum>;
11
11
  fill: ChannelAccessor<Datum>;
12
12
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
13
- sort: {
13
+ sort: ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | {
14
14
  channel: string;
15
15
  order?: "ascending" | "descending";
16
- } | ((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
+ } | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Datum>;
17
17
  stroke: ChannelAccessor<Datum>;
18
18
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
19
19
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
@@ -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();
@@ -10,10 +10,10 @@ declare class __sveltets_Render<Datum extends DataRecord> {
10
10
  dy: ConstantAccessor<number, Datum>;
11
11
  fill: ChannelAccessor<Datum>;
12
12
  fillOpacity: ConstantAccessor<number, Datum>;
13
- sort: {
13
+ sort: ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | {
14
14
  channel: string;
15
15
  order?: "ascending" | "descending";
16
- } | ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | ConstantAccessor<import("../types/data.js").RawValue, Datum>;
16
+ } | ConstantAccessor<import("../types/data.js").RawValue, Datum>;
17
17
  stroke: ChannelAccessor<Datum>;
18
18
  strokeWidth: ConstantAccessor<number, Datum>;
19
19
  strokeOpacity: ConstantAccessor<number, Datum>;
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum extends DataRow> {
9
9
  dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
10
10
  fill: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
11
11
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
12
- sort: {
12
+ sort: ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | {
13
13
  channel: string;
14
14
  order?: "ascending" | "descending";
15
- } | ((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>>;
15
+ } | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Record<string | symbol, import("../types/data").RawValue>>;
16
16
  stroke: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
17
17
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
18
18
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
@@ -68,7 +68,7 @@ declare class __sveltets_Render<Datum extends DataRow> {
68
68
  symbol?: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>> | import("svelte").Snippet<[number, string]>;
69
69
  canvas?: boolean;
70
70
  dotClass?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
71
- }, "y" | "data"> & {
71
+ }, "data" | "y"> & {
72
72
  data: Datum[];
73
73
  };
74
74
  events(): {};
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum extends DataRow> {
9
9
  dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
10
10
  fill: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
11
11
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
12
- sort: {
12
+ sort: ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | {
13
13
  channel: string;
14
14
  order?: "ascending" | "descending";
15
- } | ((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>>;
15
+ } | import("../types/index.js").ConstantAccessor<import("../types/data").RawValue, Record<string | symbol, import("../types/data").RawValue>>;
16
16
  stroke: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>>;
17
17
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
18
18
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
@@ -68,7 +68,7 @@ declare class __sveltets_Render<Datum extends DataRow> {
68
68
  symbol?: import("../types/channel").ChannelAccessor<Record<string | symbol, import("../types/data").RawValue>> | import("svelte").Snippet<[number, string]>;
69
69
  canvas?: boolean;
70
70
  dotClass?: import("../types/index.js").ConstantAccessor<string, Record<string | symbol, import("../types/data").RawValue>>;
71
- }, "x" | "data"> & {
71
+ }, "data" | "x"> & {
72
72
  data: Datum[];
73
73
  };
74
74
  events(): {};
@@ -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 {
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum = DataRecord | GeoJSON.GeoJsonObject> {
9
9
  dy: ConstantAccessor<number, Datum>;
10
10
  fill: ChannelAccessor<Datum>;
11
11
  fillOpacity: ConstantAccessor<number, Datum>;
12
- sort: {
12
+ sort: ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | {
13
13
  channel: string;
14
14
  order?: "ascending" | "descending";
15
- } | ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | ConstantAccessor<import("../types/data.js").RawValue, Datum>;
15
+ } | ConstantAccessor<import("../types/data.js").RawValue, Datum>;
16
16
  stroke: ChannelAccessor<Datum>;
17
17
  strokeWidth: ConstantAccessor<number, Datum>;
18
18
  strokeOpacity: ConstantAccessor<number, Datum>;
@@ -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 {
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum = RawValue> {
9
9
  dy: import("../types/index.js").ConstantAccessor<number, Datum>;
10
10
  fill: ChannelAccessor<Datum>;
11
11
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
12
- sort: {
12
+ sort: ((a: RawValue, b: RawValue) => number) | {
13
13
  channel: string;
14
14
  order?: "ascending" | "descending";
15
- } | ((a: RawValue, b: RawValue) => number) | import("../types/index.js").ConstantAccessor<RawValue, Datum>;
15
+ } | import("../types/index.js").ConstantAccessor<RawValue, Datum>;
16
16
  stroke: ChannelAccessor<Datum>;
17
17
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
18
18
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
@@ -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 {
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum = RawValue> {
9
9
  dy: import("../types/index.js").ConstantAccessor<number, Datum>;
10
10
  fill: ChannelAccessor<Datum>;
11
11
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
12
- sort: {
12
+ sort: ((a: RawValue, b: RawValue) => number) | {
13
13
  channel: string;
14
14
  order?: "ascending" | "descending";
15
- } | ((a: RawValue, b: RawValue) => number) | import("../types/index.js").ConstantAccessor<RawValue, Datum>;
15
+ } | import("../types/index.js").ConstantAccessor<RawValue, Datum>;
16
16
  stroke: ChannelAccessor<Datum>;
17
17
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
18
18
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
@@ -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 {
@@ -11,10 +11,10 @@ declare class __sveltets_Render<Datum extends DataRecord> {
11
11
  dy: ConstantAccessor<number, Datum>;
12
12
  fill: ChannelAccessor<Datum>;
13
13
  fillOpacity: ConstantAccessor<number, Datum>;
14
- sort: {
14
+ sort: ((a: RawValue, b: RawValue) => number) | {
15
15
  channel: string;
16
16
  order?: "ascending" | "descending";
17
- } | ((a: RawValue, b: RawValue) => number) | ConstantAccessor<RawValue, Datum>;
17
+ } | ConstantAccessor<RawValue, Datum>;
18
18
  stroke: ChannelAccessor<Datum>;
19
19
  strokeWidth: ConstantAccessor<number, Datum>;
20
20
  strokeOpacity: ConstantAccessor<number, Datum>;