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
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum extends DataRow> {
9
9
  dy: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
10
10
  fill: import("../types").ChannelAccessor<Record<string | symbol, import("../types").RawValue>>;
11
11
  fillOpacity: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
12
- sort: {
12
+ sort: ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | {
13
13
  channel: string;
14
14
  order?: "ascending" | "descending";
15
- } | ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | import("../types").ConstantAccessor<import("../types").RawValue, Record<string | symbol, import("../types").RawValue>>;
15
+ } | import("../types").ConstantAccessor<import("../types").RawValue, Record<string | symbol, import("../types").RawValue>>;
16
16
  stroke: import("../types").ChannelAccessor<Record<string | symbol, import("../types").RawValue>>;
17
17
  strokeWidth: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
18
18
  strokeOpacity: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
@@ -80,7 +80,7 @@ declare class __sveltets_Render<Datum extends DataRow> {
80
80
  textStrokeWidth?: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
81
81
  lineClass?: import("../types").ConstantAccessor<string, Record<string | symbol, import("../types").RawValue>>;
82
82
  canvas?: boolean;
83
- }, "y" | "data"> & {
83
+ }, "data" | "y"> & {
84
84
  data: Datum[];
85
85
  };
86
86
  events(): {};
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum extends DataRow> {
9
9
  dy: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
10
10
  fill: import("../types").ChannelAccessor<Record<string | symbol, import("../types").RawValue>>;
11
11
  fillOpacity: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
12
- sort: {
12
+ sort: ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | {
13
13
  channel: string;
14
14
  order?: "ascending" | "descending";
15
- } | ((a: import("../types").RawValue, b: import("../types").RawValue) => number) | import("../types").ConstantAccessor<import("../types").RawValue, Record<string | symbol, import("../types").RawValue>>;
15
+ } | import("../types").ConstantAccessor<import("../types").RawValue, Record<string | symbol, import("../types").RawValue>>;
16
16
  stroke: import("../types").ChannelAccessor<Record<string | symbol, import("../types").RawValue>>;
17
17
  strokeWidth: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
18
18
  strokeOpacity: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
@@ -80,7 +80,7 @@ declare class __sveltets_Render<Datum extends DataRow> {
80
80
  textStrokeWidth?: import("../types").ConstantAccessor<number, Record<string | symbol, import("../types").RawValue>>;
81
81
  lineClass?: import("../types").ConstantAccessor<string, Record<string | symbol, import("../types").RawValue>>;
82
82
  canvas?: boolean;
83
- }, "x" | "data"> & {
83
+ }, "data" | "x"> & {
84
84
  data: Datum[];
85
85
  };
86
86
  events(): {};
@@ -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],
@@ -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: RawValue, b: RawValue) => number) | {
14
14
  channel: string;
15
15
  order?: "ascending" | "descending";
16
- } | ((a: RawValue, b: RawValue) => number) | ConstantAccessor<RawValue, Datum>;
16
+ } | ConstantAccessor<RawValue, Datum>;
17
17
  stroke: ChannelAccessor<Datum>;
18
18
  strokeWidth: ConstantAccessor<number, Datum>;
19
19
  strokeOpacity: ConstantAccessor<number, 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,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").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, Datum>;
15
+ } | import("../types/index.js").ConstantAccessor<import("../types/data").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>;
@@ -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],
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum = DataRecord | RawValue> {
9
9
  dy: ConstantAccessor<number, Datum>;
10
10
  fill: ChannelAccessor<Datum>;
11
11
  fillOpacity: 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) | ConstantAccessor<RawValue, Datum>;
15
+ } | ConstantAccessor<RawValue, Datum>;
16
16
  stroke: ChannelAccessor<Datum>;
17
17
  strokeWidth: ConstantAccessor<number, Datum>;
18
18
  strokeOpacity: ConstantAccessor<number, 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],
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum = DataRecord> {
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").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) | ConstantAccessor<import("../types/data").RawValue, Datum>;
15
+ } | ConstantAccessor<import("../types/data").RawValue, Datum>;
16
16
  stroke: ChannelAccessor<Datum>;
17
17
  strokeWidth: ConstantAccessor<number, Datum>;
18
18
  strokeOpacity: ConstantAccessor<number, 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({
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum extends DataRecord> {
9
9
  dy: import("../types/index.js").ConstantAccessor<number, Record<string | symbol, import("../types/data").RawValue>>;
10
10
  fill: 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: 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>>;
@@ -71,7 +71,7 @@ declare class __sveltets_Render<Datum extends DataRecord> {
71
71
  shape?: "arrow" | "spike" | "arrow-filled" | import("./Vector.svelte").ShapeRenderer;
72
72
  children?: import("svelte").Snippet;
73
73
  canvas?: boolean;
74
- }, "r" | "length" | "x" | "y" | "data" | "rotate"> & {
74
+ }, "data" | "r" | "length" | "x" | "y" | "rotate"> & {
75
75
  data: Datum[];
76
76
  x: ChannelAccessor<Datum>;
77
77
  y: ChannelAccessor<Datum>;
@@ -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();
@@ -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: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | {
15
15
  channel: string;
16
16
  order?: "ascending" | "descending";
17
- } | ((a: import("../types/data").RawValue, b: import("../types/data").RawValue) => number) | ConstantAccessor<import("../types/data").RawValue, Datum>;
17
+ } | ConstantAccessor<import("../types/data").RawValue, Datum>;
18
18
  stroke: ChannelAccessor<Datum>;
19
19
  strokeWidth: ConstantAccessor<number, Datum>;
20
20
  strokeOpacity: ConstantAccessor<number, Datum>;
@@ -73,7 +73,7 @@ declare class __sveltets_Render<Datum extends DataRecord> {
73
73
  * the font size of the text
74
74
  */
75
75
  fontFamily?: ConstantAccessor<CSS.Property.FontFamily, Datum>;
76
- fontSize?: ConstantAccessor<number | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | (string & {}) | "small" | "medium" | "large" | "x-large" | "x-small" | "xx-large" | "xx-small" | "xxx-large" | "larger" | "smaller", Datum>;
76
+ fontSize?: ConstantAccessor<number | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | (string & {}) | "small" | "large" | "medium" | "x-large" | "x-small" | "xx-large" | "xx-small" | "xxx-large" | "larger" | "smaller", Datum>;
77
77
  fontWeight?: ConstantAccessor<CSS.Property.FontWeight, Datum>;
78
78
  fontStyle?: ConstantAccessor<CSS.Property.FontStyle, Datum>;
79
79
  fontVariant?: ConstantAccessor<CSS.Property.FontVariant, Datum>;
@@ -94,7 +94,7 @@ declare class __sveltets_Render<Datum extends DataRecord> {
94
94
  * @default 1.2
95
95
  */
96
96
  lineHeight?: ConstantAccessor<number, Datum>;
97
- frameAnchor?: ConstantAccessor<"bottom" | "top" | "left" | "right" | "middle" | "top-left" | "bottom-left" | "top-right" | "bottom-right", Datum>;
97
+ frameAnchor?: ConstantAccessor<"top" | "bottom" | "left" | "right" | "middle" | "top-left" | "bottom-left" | "top-right" | "bottom-right", Datum>;
98
98
  /**
99
99
  * rotate text by angle in degrees
100
100
  */
@@ -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 = [{}],
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum extends DataRow> {
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").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) | ConstantAccessor<import("../types/data").RawValue, Datum>;
15
+ } | ConstantAccessor<import("../types/data").RawValue, Datum>;
16
16
  stroke: ChannelAccessor<Datum>;
17
17
  strokeWidth: ConstantAccessor<number, Datum>;
18
18
  strokeOpacity: ConstantAccessor<number, Datum>;
@@ -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 = [{}],
@@ -9,10 +9,10 @@ declare class __sveltets_Render<Datum extends DataRow> {
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").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) | ConstantAccessor<import("../types/data").RawValue, Datum>;
15
+ } | ConstantAccessor<import("../types/data").RawValue, Datum>;
16
16
  stroke: ChannelAccessor<Datum>;
17
17
  strokeWidth: ConstantAccessor<number, Datum>;
18
18
  strokeOpacity: ConstantAccessor<number, Datum>;
@@ -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 = [{}],
@@ -14,10 +14,10 @@ declare class __sveltets_Render<Datum extends DataRecord> {
14
14
  dy: import("../types/index.js").ConstantAccessor<number, Datum>;
15
15
  fill: ChannelAccessor<Datum>;
16
16
  fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
17
- sort: {
17
+ sort: ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | {
18
18
  channel: string;
19
19
  order?: "ascending" | "descending";
20
- } | ((a: import("../types/data.js").RawValue, b: import("../types/data.js").RawValue) => number) | import("../types/index.js").ConstantAccessor<import("../types/data.js").RawValue, Datum>;
20
+ } | import("../types/index.js").ConstantAccessor<import("../types/data.js").RawValue, Datum>;
21
21
  stroke: ChannelAccessor<Datum>;
22
22
  strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
23
23
  strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { getContext } from 'svelte';
3
- import type { PlotContext } from '../../index.js';
3
+ import type { PlotContext } from '../../types/plot';
4
4
  import { devicePixelRatio } from 'svelte/reactivity/window';
5
5
  import { MediaQuery } from 'svelte/reactivity';
6
6
  import type { Attachment } from 'svelte/attachments';
@@ -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