@fundar/data-chart-telling 0.0.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 (106) hide show
  1. package/README.md +250 -0
  2. package/dist/charts/Chart.svelte +125 -0
  3. package/dist/charts/Chart.svelte.d.ts +42 -0
  4. package/dist/charts/bar/Chart.svelte +104 -0
  5. package/dist/charts/bar/Chart.svelte.d.ts +27 -0
  6. package/dist/charts/container/ChartContainer.svelte +127 -0
  7. package/dist/charts/container/ChartContainer.svelte.d.ts +14 -0
  8. package/dist/charts/heatmap/Chart.svelte +107 -0
  9. package/dist/charts/heatmap/Chart.svelte.d.ts +30 -0
  10. package/dist/charts/line/Chart.svelte +106 -0
  11. package/dist/charts/line/Chart.svelte.d.ts +27 -0
  12. package/dist/charts/pyramid/Chart.svelte +127 -0
  13. package/dist/charts/pyramid/Chart.svelte.d.ts +31 -0
  14. package/dist/configuration/config.svelte.d.ts +12 -0
  15. package/dist/configuration/config.svelte.js +159 -0
  16. package/dist/configuration/themes/compact.d.ts +2 -0
  17. package/dist/configuration/themes/compact.js +9 -0
  18. package/dist/configuration/themes/dark.d.ts +2 -0
  19. package/dist/configuration/themes/dark.js +17 -0
  20. package/dist/configuration/themes/default.d.ts +3 -0
  21. package/dist/configuration/themes/default.js +2 -0
  22. package/dist/configuration/themes/editorial.d.ts +2 -0
  23. package/dist/configuration/themes/editorial.js +14 -0
  24. package/dist/configuration/themes/index.d.ts +481 -0
  25. package/dist/configuration/themes/index.js +16 -0
  26. package/dist/index.d.ts +32 -0
  27. package/dist/index.js +27 -0
  28. package/dist/layout/facet/FacetLayout.svelte +97 -0
  29. package/dist/layout/facet/FacetLayout.svelte.d.ts +35 -0
  30. package/dist/layout/legend/ContinuousSection.svelte +95 -0
  31. package/dist/layout/legend/ContinuousSection.svelte.d.ts +7 -0
  32. package/dist/layout/legend/DiscreteSection.svelte +87 -0
  33. package/dist/layout/legend/DiscreteSection.svelte.d.ts +7 -0
  34. package/dist/layout/legend/LegendLayout.svelte +47 -0
  35. package/dist/layout/legend/LegendLayout.svelte.d.ts +7 -0
  36. package/dist/layout/plot/PlotLayout.svelte +236 -0
  37. package/dist/layout/plot/PlotLayout.svelte.d.ts +70 -0
  38. package/dist/layout/timeline/Timeline.svelte +86 -0
  39. package/dist/layout/timeline/Timeline.svelte.d.ts +11 -0
  40. package/dist/layout/timeline/TimelineLayout.svelte +181 -0
  41. package/dist/layout/timeline/TimelineLayout.svelte.d.ts +38 -0
  42. package/dist/layout/tooltip/Tooltip.svelte +55 -0
  43. package/dist/layout/tooltip/Tooltip.svelte.d.ts +12 -0
  44. package/dist/layout/tooltip/controller.svelte.d.ts +52 -0
  45. package/dist/layout/tooltip/controller.svelte.js +128 -0
  46. package/dist/layout/tooltip/hover.svelte.d.ts +7 -0
  47. package/dist/layout/tooltip/hover.svelte.js +28 -0
  48. package/dist/layout/tooltip/utils.d.ts +41 -0
  49. package/dist/layout/tooltip/utils.js +78 -0
  50. package/dist/plots/bar/Plot.svelte +176 -0
  51. package/dist/plots/bar/Plot.svelte.d.ts +26 -0
  52. package/dist/plots/heatmap/Plot.svelte +175 -0
  53. package/dist/plots/heatmap/Plot.svelte.d.ts +26 -0
  54. package/dist/plots/line/Plot.svelte +232 -0
  55. package/dist/plots/line/Plot.svelte.d.ts +26 -0
  56. package/dist/plots/markers/DeltaMarker.svelte +104 -0
  57. package/dist/plots/markers/DeltaMarker.svelte.d.ts +30 -0
  58. package/dist/plots/markers/DotMarker.svelte +41 -0
  59. package/dist/plots/markers/DotMarker.svelte.d.ts +31 -0
  60. package/dist/plots/markers/HoverMarker.svelte +78 -0
  61. package/dist/plots/markers/HoverMarker.svelte.d.ts +22 -0
  62. package/dist/plots/markers/PeakMarker.svelte +80 -0
  63. package/dist/plots/markers/PeakMarker.svelte.d.ts +13 -0
  64. package/dist/plots/markers/TextMarker.svelte +55 -0
  65. package/dist/plots/markers/TextMarker.svelte.d.ts +32 -0
  66. package/dist/plots/pyramid/Plot.svelte +282 -0
  67. package/dist/plots/pyramid/Plot.svelte.d.ts +26 -0
  68. package/dist/plots/utils/accessors.d.ts +6 -0
  69. package/dist/plots/utils/accessors.js +10 -0
  70. package/dist/plots/utils/delta.d.ts +12 -0
  71. package/dist/plots/utils/delta.js +69 -0
  72. package/dist/plots/utils/segments.d.ts +33 -0
  73. package/dist/plots/utils/segments.js +153 -0
  74. package/dist/stores/device.d.ts +7 -0
  75. package/dist/stores/device.js +39 -0
  76. package/dist/types/charts/common.d.ts +64 -0
  77. package/dist/types/charts/common.js +1 -0
  78. package/dist/types/charts/interpolate.d.ts +2 -0
  79. package/dist/types/charts/interpolate.js +1 -0
  80. package/dist/types/charts/legend.d.ts +29 -0
  81. package/dist/types/charts/legend.js +1 -0
  82. package/dist/types/charts/props.d.ts +35 -0
  83. package/dist/types/charts/props.js +1 -0
  84. package/dist/types/configuration/styling.d.ts +97 -0
  85. package/dist/types/configuration/styling.js +1 -0
  86. package/dist/types/layout/tooltip.d.ts +88 -0
  87. package/dist/types/layout/tooltip.js +1 -0
  88. package/dist/types/plots/common.d.ts +100 -0
  89. package/dist/types/plots/common.js +1 -0
  90. package/dist/types/plots/delta.d.ts +19 -0
  91. package/dist/types/plots/delta.js +1 -0
  92. package/dist/types/plots/markers.d.ts +56 -0
  93. package/dist/types/plots/markers.js +1 -0
  94. package/dist/types/plots/props.d.ts +23 -0
  95. package/dist/types/plots/props.js +1 -0
  96. package/dist/types/plots/styles.d.ts +176 -0
  97. package/dist/types/plots/styles.js +1 -0
  98. package/dist/types/viewport.d.ts +4 -0
  99. package/dist/types/viewport.js +1 -0
  100. package/dist/utils/color.d.ts +5 -0
  101. package/dist/utils/color.js +42 -0
  102. package/dist/utils/grouping.d.ts +14 -0
  103. package/dist/utils/grouping.js +36 -0
  104. package/dist/utils/interpolate.d.ts +30 -0
  105. package/dist/utils/interpolate.js +71 -0
  106. package/package.json +76 -0
@@ -0,0 +1,64 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { Accessor, AxisValue } from '../plots/common';
3
+ import type { EasingName, EasingFn } from './interpolate';
4
+ export type TimeValue = number;
5
+ export type Orientation = 'horizontal' | 'vertical';
6
+ export type FacetColumns = number | {
7
+ desktop: number;
8
+ mobile: number;
9
+ };
10
+ export type ChartBoxContext = {
11
+ width: number;
12
+ height: number;
13
+ };
14
+ export type ChartBoxSnippet = Snippet<[ChartBoxContext]>;
15
+ export type FacetCellContext<TRow extends Record<string, unknown>> = {
16
+ facetValue: string;
17
+ data: TRow[];
18
+ width: number;
19
+ height: number;
20
+ };
21
+ export type FacetCellSnippet<TRow extends Record<string, unknown>> = Snippet<[
22
+ FacetCellContext<TRow>
23
+ ]>;
24
+ export type TimelineChildContext<TRow extends Record<string, unknown>> = {
25
+ selectedValue: TimeValue;
26
+ data: TRow[];
27
+ width: number;
28
+ height: number;
29
+ };
30
+ export type TimelineChildSnippet<TRow extends Record<string, unknown>> = Snippet<[
31
+ TimelineChildContext<TRow>
32
+ ]>;
33
+ export type ChartPlotContext<TRow extends Record<string, unknown>> = {
34
+ data: TRow[];
35
+ width: number;
36
+ height: number;
37
+ facetValue?: string;
38
+ selectedValue?: TimeValue;
39
+ };
40
+ export type ChartPlotSnippet<TRow extends Record<string, unknown>> = Snippet<[
41
+ ChartPlotContext<TRow>
42
+ ]>;
43
+ export type TimelineInterpolation<TRow extends Record<string, unknown>> = {
44
+ key?: Accessor<TRow, unknown>;
45
+ value?: Accessor<TRow, AxisValue>;
46
+ create?: (lower: TRow, upper: TRow, x: TimeValue, value: number) => TRow;
47
+ progressEasing?: EasingName | EasingFn;
48
+ segmentEasing?: EasingName | EasingFn;
49
+ };
50
+ export type TimelineConfig<TRow extends Record<string, unknown>> = {
51
+ accessor: Accessor<TRow, TimeValue>;
52
+ progress: number;
53
+ values?: TimeValue[];
54
+ orientation?: Orientation;
55
+ thickness?: number;
56
+ filterMode?: 'exact' | 'upTo';
57
+ interpolate?: boolean | TimelineInterpolation<TRow>;
58
+ };
59
+ export type FacetConfig<TRow extends Record<string, unknown>> = {
60
+ by: Accessor<TRow, unknown>;
61
+ columns?: FacetColumns;
62
+ values?: string[];
63
+ gap?: number;
64
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export type EasingName = 'linear' | 'quadIn' | 'quadOut' | 'cubicIn' | 'cubicOut' | 'quartIn' | 'quartOut' | 'expoOut';
2
+ export type EasingFn = (t: number) => number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { SymbolType, LineStyle } from '../plots/styles';
2
+ export type LegendSectionType = 'discrete' | 'continuous';
3
+ export type LegendItem = {
4
+ name: string;
5
+ label?: string;
6
+ color?: string;
7
+ symbol?: SymbolType;
8
+ opacity?: number;
9
+ lineStyle?: LineStyle;
10
+ };
11
+ export type DiscreteLegendSection = {
12
+ type: 'discrete';
13
+ title?: string;
14
+ items: LegendItem[];
15
+ columns?: number;
16
+ };
17
+ export type ContinuousLegendSection = {
18
+ type: 'continuous';
19
+ title?: string;
20
+ columns?: number;
21
+ min: number;
22
+ max: number;
23
+ colorMin?: string;
24
+ colorMax?: string;
25
+ ticks?: number[];
26
+ width?: number;
27
+ format?: (v: number) => string;
28
+ };
29
+ export type LegendSection = DiscreteLegendSection | ContinuousLegendSection;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ import type { Accessor, AxisValue, ScalesConfig, MarginConfig } from '../plots/common';
2
+ import type { PlotStyles, SegmentsMap } from '../plots/styles';
3
+ import type { Marker } from '../plots/markers';
4
+ import type { TooltipProp } from '../layout/tooltip';
5
+ import type { LegendSection } from './legend';
6
+ import type { FacetConfig, TimelineConfig } from './common';
7
+ /**
8
+ * Common props accepted by every chart component (bar, line, heatmap, pyramid,
9
+ * …). The `TSegmentStyle` parameter lets each chart narrow `segments` to its
10
+ * own style shape while keeping everything else shared.
11
+ *
12
+ * Note: `z` is optional here (bar/line charts) but individual charts may
13
+ * tighten it to required and/or narrow its value type (e.g. `number` for
14
+ * heatmap).
15
+ */
16
+ export type ChartProps<TRow extends Record<string, unknown>, TSegmentStyle extends object = object> = {
17
+ width: number;
18
+ height: number;
19
+ title?: string;
20
+ subtitle?: string;
21
+ caption?: string;
22
+ legend?: LegendSection[];
23
+ data: TRow[];
24
+ x: Accessor<TRow, AxisValue>;
25
+ y: Accessor<TRow, AxisValue>;
26
+ z?: Accessor<TRow, unknown>;
27
+ styles?: PlotStyles;
28
+ segments?: SegmentsMap<TSegmentStyle>;
29
+ markers?: Marker[];
30
+ scales?: ScalesConfig;
31
+ margins?: MarginConfig;
32
+ facet?: FacetConfig<TRow>;
33
+ timeline?: TimelineConfig<TRow>;
34
+ tooltip?: TooltipProp<TRow>;
35
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,97 @@
1
+ import type { StrokeStyle, DotStyle, FontStyle } from '../plots/styles';
2
+ export type TextStyle = {
3
+ /** font-family */
4
+ font: string;
5
+ /** font-size (any CSS length) */
6
+ size: string;
7
+ /** font-weight */
8
+ weight: number | string;
9
+ /** color */
10
+ color: string;
11
+ /** line-height */
12
+ leading: string;
13
+ /** letter-spacing */
14
+ spacing: string;
15
+ };
16
+ export type ChartConfig = {
17
+ font: string;
18
+ color: string;
19
+ background: string;
20
+ border: string;
21
+ spacing: {
22
+ headerPadding: string;
23
+ legendPadding: string;
24
+ captionPadding: string;
25
+ };
26
+ title: TextStyle;
27
+ subtitle: TextStyle;
28
+ caption: TextStyle;
29
+ legend: {
30
+ font: string;
31
+ size: string;
32
+ weight: number | string;
33
+ color: string;
34
+ titleSize: string;
35
+ titleWeight: number | string;
36
+ /** row/column gap between sections (CSS `gap` shorthand) */
37
+ gap: string;
38
+ /** swatch square size */
39
+ swatchSize: string;
40
+ };
41
+ axis: {
42
+ color: string;
43
+ fontSize: number;
44
+ labelFontSize: number;
45
+ titleFontSize: number;
46
+ xTickSize: number;
47
+ yTickSize: number;
48
+ xTickPadding: number;
49
+ yTickPadding: number;
50
+ grid: boolean;
51
+ };
52
+ tooltip: {
53
+ background: string;
54
+ color: string;
55
+ fontSize: string;
56
+ padding: string;
57
+ radius: string;
58
+ border: string;
59
+ };
60
+ margins: {
61
+ top: number;
62
+ right: number;
63
+ bottom: number;
64
+ left: number;
65
+ };
66
+ /** Discrete categorical palette (grouped series). */
67
+ palette: string[];
68
+ /** Continuous gradient endpoints + on-cell label colour. */
69
+ continuous: {
70
+ min: string;
71
+ max: string;
72
+ labelColor: string;
73
+ };
74
+ /** Default line geometry. */
75
+ line: {
76
+ strokeWidth: number;
77
+ dotRadius: number;
78
+ };
79
+ /** Timeline gutter styling. */
80
+ timeline: {
81
+ axisColor: string;
82
+ activeColor: string;
83
+ thickness: number;
84
+ };
85
+ /** In-SVG hover highlight (crosshair rule, dot, and value label). */
86
+ hover: {
87
+ rule: StrokeStyle;
88
+ dot: DotStyle;
89
+ font: FontStyle;
90
+ };
91
+ };
92
+ /** Deep-partial input accepted by `setConfiguration`. */
93
+ export type ChartConfigInput = DeepPartial<ChartConfig>;
94
+ type DeepPartial<T> = {
95
+ [K in keyof T]?: T[K] extends (infer U)[] ? U[] : T[K] extends object ? DeepPartial<T[K]> : T[K];
96
+ };
97
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,88 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { AxisValue } from '../plots/common';
3
+ /**
4
+ * How the hover highlight finds related points within a facet.
5
+ * - `'x'` all points sharing the hovered x (default for line / bar).
6
+ * - `'y'` all points sharing the hovered y (default for pyramid).
7
+ * - `'punctual'` exact XY match — one cell at a time (default for heatmap).
8
+ */
9
+ export type HoverStrategy = 'x' | 'y' | 'punctual';
10
+ /** Author-facing tooltip option on the chart kinds. `true` = enable with defaults. */
11
+ export type TooltipOptions<TRow extends Record<string, unknown>> = {
12
+ /** Matching strategy. Defaults to the chart kind's own default. */
13
+ strategy?: HoverStrategy;
14
+ /**
15
+ * Broadcast the hover to other facets. When `true` every facet with a
16
+ * matching point highlights it using the same strategy. Defaults to `false`.
17
+ */
18
+ sync?: boolean;
19
+ /** Custom tooltip text for a row (supports `\n`). Defaults per chart kind. */
20
+ format?: (row: TRow) => string;
21
+ /** Named subset of crossing series to include. Omitted = all matched. */
22
+ series?: string[];
23
+ /** Custom tooltip body; replaces `format` when given. */
24
+ content?: Snippet<[{
25
+ rows: TRow[];
26
+ }]>;
27
+ };
28
+ /** Either a bare on/off flag or the full option object. */
29
+ export type TooltipProp<TRow extends Record<string, unknown>> = boolean | TooltipOptions<TRow>;
30
+ /**
31
+ * Resolved tooltip config handed from a chart kind down to a plot. Presence of
32
+ * this object on a plot is what turns hovering on.
33
+ */
34
+ export type TooltipRuntime<TRow extends Record<string, unknown>> = {
35
+ format: (row: TRow) => string;
36
+ /** Identifies the originating facet (`''` when not faceted). */
37
+ facetId: string;
38
+ /** Strategy resolved by the chart; omitted → PlotLayout falls back to its own default. */
39
+ strategy?: HoverStrategy;
40
+ /** Whether to broadcast to other facets. */
41
+ sync: boolean;
42
+ series?: string[];
43
+ content?: Snippet<[{
44
+ rows: TRow[];
45
+ }]>;
46
+ };
47
+ /**
48
+ * Shared hover state for cross-facet tooltip syncing.
49
+ *
50
+ * {@link Chart} provides one store via context; every faceted plot reads the
51
+ * same instance, so a hover detected in one facet (which writes `activeX/Y` and
52
+ * stamps itself as `source`) is visible to the others. A standalone plot with no
53
+ * provider falls back to its own {@link createHover} store.
54
+ */
55
+ export type HoverStore = {
56
+ activeX: AxisValue | null;
57
+ activeY: AxisValue | null;
58
+ /** Series of the hovered row, when the plot kind has a series concept (line/bar). */
59
+ activeSeries: string | null;
60
+ /**
61
+ * Mouse position within the source facet's own box, as a fraction of its
62
+ * width/height (each in `[0, 1]`). Other facets reproject this onto their
63
+ * own box so a broadcast tooltip lands at the same *relative* spot the
64
+ * cursor is actually at, rather than a fixed corner.
65
+ */
66
+ cursorFrac: {
67
+ x: number;
68
+ y: number;
69
+ } | null;
70
+ /** Facet id that currently owns the hover (`''` when not faceted). */
71
+ source: string | null;
72
+ /** How related points are found within a facet. */
73
+ strategy: HoverStrategy;
74
+ /** Whether the hover is broadcast to other facets. */
75
+ sync: boolean;
76
+ };
77
+ /** A point ready to render: its plotted position plus its label. */
78
+ export type HoverDisplayPoint = {
79
+ x: AxisValue;
80
+ y: AxisValue;
81
+ label: string;
82
+ /** Owning series name; undefined for plot kinds with no series concept (heatmap). */
83
+ series?: string;
84
+ };
85
+ /** A candidate point for hover matching/highlighting — also carries its source row. */
86
+ export type HoverPoint<T> = HoverDisplayPoint & {
87
+ row: T;
88
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,100 @@
1
+ export type AxisValue = number | string | Date;
2
+ /** Partial margin override — only the sides you specify are overridden; the rest come from the theme. */
3
+ export type MarginConfig = Partial<{
4
+ top: number;
5
+ right: number;
6
+ bottom: number;
7
+ left: number;
8
+ }>;
9
+ /**
10
+ * Author-facing scale overrides for a plot axis. Mirrors svelteplot's
11
+ * `ScaleOptions` + `XScaleOptions` in full — `type`, `padding`, `domain`,
12
+ * `nice`, `reverse`, `label`, `tickFormat`, `labelAnchor`, etc.
13
+ *
14
+ * Used for both `x` and `y` entries in {@link ScalesConfig}. X-specific
15
+ * fields (`labelAnchor`, `tickRotate`) are accepted on `y` too; svelteplot
16
+ * silently ignores any inapplicable options.
17
+ */
18
+ export type AxisScale = {
19
+ type?: 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'symlog' | 'time' | 'utc' | 'point' | 'ordinal' | 'sequential' | 'band' | 'categorical' | 'cyclical' | 'threshold' | 'quantile-cont' | 'quantile' | 'quantize' | 'diverging' | 'diverging-log' | 'diverging-pow' | 'diverging-sqrt' | 'diverging-symlog';
20
+ domain?: (number | string | boolean | Date | null)[];
21
+ range?: (number | string | boolean | Date | null)[];
22
+ reverse?: boolean;
23
+ label?: string | false;
24
+ interval?: string | number;
25
+ clamp?: boolean;
26
+ nice?: boolean;
27
+ zero?: boolean;
28
+ round?: boolean;
29
+ percent?: boolean;
30
+ padding?: number;
31
+ align?: number;
32
+ paddingInner?: number;
33
+ paddingOuter?: number;
34
+ insetLeft?: number;
35
+ insetRight?: number;
36
+ insetTop?: number;
37
+ insetBottom?: number;
38
+ ticks?: (number | string | boolean | Date | null)[];
39
+ tickSpacing?: number;
40
+ tickSize?: number;
41
+ tickPadding?: number;
42
+ titleFontSize?: number;
43
+ base?: number;
44
+ constant?: number;
45
+ sort?: ((a: unknown, b: unknown) => number) | {
46
+ channel: string;
47
+ order: 'ascending' | 'descending';
48
+ };
49
+ grid?: boolean;
50
+ tickRotate?: number;
51
+ tickFormat?: false | Intl.NumberFormatOptions | Intl.DateTimeFormatOptions | ((d: unknown, index: number, ticks: unknown[]) => string | string[]);
52
+ };
53
+ /**
54
+ * Per-axis scale overrides, passed as a single `scales` prop to every plot
55
+ * kind.
56
+ */
57
+ export type ScalesConfig = {
58
+ x?: AxisScale;
59
+ y?: AxisScale;
60
+ z?: AxisScale;
61
+ };
62
+ /**
63
+ * A field key or accessor function. Mirrors the shorthand used across plots
64
+ * so chart-level encodings (`x`, `y`, `z`, facet, timeline) feel consistent
65
+ * with the plot-level series definitions.
66
+ */
67
+ export type Accessor<TRow extends Record<string, unknown>, V> = keyof TRow | ((d: TRow) => V);
68
+ /**
69
+ * A plot series: a name, x/y accessors and the rows it draws. Shared as-is by
70
+ * every mark (line, bar, …) — none of them need anything beyond this shape;
71
+ * visual styling lives separately in `segments`.
72
+ */
73
+ export type Series<T extends Record<string, unknown> = Record<string, unknown>> = {
74
+ name: string;
75
+ x: Accessor<T, AxisValue>;
76
+ y: Accessor<T, AxisValue>;
77
+ z?: Accessor<T, unknown>;
78
+ data: T[];
79
+ };
80
+ /**
81
+ * Pre-built series. Mutually exclusive with {@link DataProps} — takes
82
+ * precedence when both could apply.
83
+ */
84
+ export type SeriesProps<T extends Record<string, unknown>> = {
85
+ series: Series<T>[];
86
+ data?: never;
87
+ x?: never;
88
+ y?: never;
89
+ z?: never;
90
+ };
91
+ /**
92
+ * Flat rows to group into series, as an alternative to {@link SeriesProps}.
93
+ */
94
+ export type DataProps<T extends Record<string, unknown>> = {
95
+ series?: never;
96
+ data: T[];
97
+ x: Accessor<T, AxisValue>;
98
+ y: Accessor<T, AxisValue>;
99
+ z?: Accessor<T, unknown>;
100
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { AxisValue } from './common';
2
+ import type { StrokeStyle, FontStyle, DotStyle } from './styles';
3
+ export type DeltaTarget = {
4
+ type: 'series';
5
+ series: string;
6
+ } | {
7
+ type: 'axis';
8
+ value?: number;
9
+ };
10
+ export type DeltaConfig = {
11
+ axis: 'x' | 'y';
12
+ at: AxisValue;
13
+ from: DeltaTarget;
14
+ to?: DeltaTarget;
15
+ formatDiff?: (diff: number) => string;
16
+ strokeStyle?: StrokeStyle;
17
+ fontStyle?: FontStyle;
18
+ dotStyle?: DotStyle;
19
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,56 @@
1
+ import type { AxisValue } from './common';
2
+ import type { DotStyle, FontStyle, StrokeStyle } from './styles';
3
+ import type { HoverStrategy } from '../layout/tooltip';
4
+ /**
5
+ * Baseline props every marker component receives when mounted by a plot:
6
+ * `data` for the points/values it draws, plus `series`/`seriesColor` when
7
+ * mounted per-series via a `CustomComponentMarker`. Marker components extend
8
+ * this with whatever else they need (e.g. PeakMarker's `mode`, `label`).
9
+ */
10
+ export interface MarkerProps<TData = Record<string, unknown>> {
11
+ data?: TData[];
12
+ series?: string;
13
+ seriesColor?: string;
14
+ }
15
+ export type RuleXMarker = {
16
+ type: 'ruleX';
17
+ x: AxisValue;
18
+ style?: StrokeStyle;
19
+ };
20
+ export type RuleYMarker = {
21
+ type: 'ruleY';
22
+ y: AxisValue;
23
+ style?: StrokeStyle;
24
+ };
25
+ /**
26
+ * The in-SVG hover highlight (crosshair + dot + label), opt-in via `markers`
27
+ * so it can be combined freely with — or used entirely without — the HTML
28
+ * tooltip. Omitting `series` mounts it unscoped (all series); scoping it to
29
+ * one series follows the same targeting fields as {@link CustomComponentMarker}.
30
+ */
31
+ export type HoverMarkerConfig = {
32
+ type: 'hover';
33
+ series?: string;
34
+ /** Whether to render per segment or for the full series. Defaults to `'series'`. */
35
+ scope?: 'series' | 'segment';
36
+ /** Matching strategy — how related points are found. Defaults to the plot kind's own default. */
37
+ strategy?: HoverStrategy;
38
+ /** Broadcast the hover to other facets. Defaults to `false`. */
39
+ sync?: boolean;
40
+ ruleX?: boolean;
41
+ ruleY?: boolean;
42
+ showLabels?: boolean;
43
+ ruleStyle?: StrokeStyle;
44
+ dotStyle?: DotStyle;
45
+ fontStyle?: FontStyle;
46
+ };
47
+ export type CustomComponentMarker = {
48
+ type: 'component';
49
+ series?: string;
50
+ component: any;
51
+ props?: Record<string, unknown>;
52
+ data?: any[];
53
+ /** Whether to render per segment or for the full series. Defaults to `'series'`. */
54
+ scope?: 'series' | 'segment';
55
+ };
56
+ export type Marker = RuleXMarker | RuleYMarker | HoverMarkerConfig | CustomComponentMarker;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { Marker } from './markers';
2
+ import type { TooltipRuntime } from '../layout/tooltip';
3
+ import type { PlotStyles, SegmentsMap } from './styles';
4
+ import type { SeriesProps, DataProps, ScalesConfig, MarginConfig } from './common';
5
+ /**
6
+ * Common props accepted by every plot component (bar, line, heatmap, pyramid,
7
+ * …). The `TSegmentStyle` parameter lets each plot narrow `segments` to its
8
+ * own style shape ({@link BarSegmentStyle}, {@link LineSegmentStyle}, etc.)
9
+ * while keeping everything else shared.
10
+ *
11
+ * Data can be provided either as pre-built {@link SeriesProps} or as flat
12
+ * rows via {@link DataProps}.
13
+ */
14
+ export type PlotProps<TData extends Record<string, unknown>, TSegmentStyle extends object = object> = (SeriesProps<TData> | DataProps<TData>) & {
15
+ width: number;
16
+ height: number;
17
+ styles?: PlotStyles;
18
+ segments?: SegmentsMap<TSegmentStyle>;
19
+ markers?: Marker[];
20
+ scales?: ScalesConfig;
21
+ margins?: MarginConfig;
22
+ tooltip?: TooltipRuntime<TData>;
23
+ };
@@ -0,0 +1 @@
1
+ export {};