@fundar/data-chart-telling 1.17.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/configuration/config.svelte.js +3 -2
  3. package/dist/index.d.ts +7 -2
  4. package/dist/index.js +2 -0
  5. package/dist/layout/geometry/GeometryLayout.svelte +188 -54
  6. package/dist/layout/hover/HoverDefaults.d.ts +52 -0
  7. package/dist/layout/hover/HoverDefaults.js +96 -0
  8. package/dist/layout/hover/HoverLayers.d.ts +35 -0
  9. package/dist/layout/hover/HoverLayers.js +122 -0
  10. package/dist/layout/hover/HoverSettings.d.ts +1 -3
  11. package/dist/layout/hover/HoverSettings.js +3 -2
  12. package/dist/layout/hover/HoverShapes.d.ts +44 -0
  13. package/dist/layout/hover/HoverShapes.js +103 -0
  14. package/dist/layout/hover/PlotHover.svelte.d.ts +18 -0
  15. package/dist/layout/hover/PlotHover.svelte.js +54 -1
  16. package/dist/layout/legend/LegendState.svelte.d.ts +2 -0
  17. package/dist/layout/legend/LegendState.svelte.js +5 -0
  18. package/dist/layout/plot/Core.svelte +2 -2
  19. package/dist/layout/plot/PublicPlotContext.d.ts +6 -0
  20. package/dist/layout/plot/PublicPlotContext.js +8 -0
  21. package/dist/layout/styles/ValueLabels.d.ts +12 -4
  22. package/dist/layout/styles/ValueLabels.js +22 -13
  23. package/dist/layout/tooltip/TooltipState.svelte.d.ts +8 -9
  24. package/dist/layout/tooltip/TooltipState.svelte.js +28 -29
  25. package/dist/markers/MarkerKinds.d.ts +5 -0
  26. package/dist/markers/MarkerKinds.js +1 -0
  27. package/dist/markers/band/BandMarker.svelte +74 -0
  28. package/dist/markers/band/BandMarker.svelte.d.ts +7 -0
  29. package/dist/markers/band/Bands.d.ts +16 -0
  30. package/dist/markers/band/Bands.js +48 -0
  31. package/dist/markers/bar/BarMarker.svelte +23 -66
  32. package/dist/markers/hover/HoverMarker.svelte +7 -265
  33. package/dist/markers/hover/HoverMarker.svelte.d.ts +4 -27
  34. package/dist/markers/utils/PointPixel.d.ts +37 -0
  35. package/dist/markers/utils/PointPixel.js +44 -0
  36. package/dist/phases/Pipeline.d.ts +7 -7
  37. package/dist/phases/Pipeline.js +12 -9
  38. package/dist/phases/context/ContextPhase.d.ts +22 -0
  39. package/dist/phases/context/ContextPhase.js +23 -0
  40. package/dist/phases/context/RowContext.d.ts +35 -0
  41. package/dist/phases/context/RowContext.js +95 -0
  42. package/dist/phases/data/DataPhase.d.ts +4 -4
  43. package/dist/phases/data/DataPhase.js +7 -7
  44. package/dist/phases/hover/HoverPhase.d.ts +6 -7
  45. package/dist/phases/hover/HoverPhase.js +28 -23
  46. package/dist/phases/mapping/MappingPhase.d.ts +4 -4
  47. package/dist/phases/mapping/MappingPhase.js +2 -2
  48. package/dist/phases/markers/MarkerStyles.d.ts +8 -0
  49. package/dist/phases/markers/MarkerStyles.js +15 -0
  50. package/dist/phases/markers/MarkersPhase.d.ts +4 -4
  51. package/dist/phases/markers/MarkersPhase.js +4 -4
  52. package/dist/phases/scales/ScalesPhase.d.ts +4 -4
  53. package/dist/phases/scales/ScalesPhase.js +4 -4
  54. package/dist/phases/sharedScales/SharedScalesPhase.d.ts +2 -2
  55. package/dist/phases/sharedScales/SharedScalesPhase.js +2 -2
  56. package/dist/phases/statistics/MarkerGrouping.d.ts +0 -9
  57. package/dist/phases/statistics/MarkerGrouping.js +0 -16
  58. package/dist/phases/styles/StylesPhase.d.ts +3 -3
  59. package/dist/phases/styles/StylesPhase.js +2 -2
  60. package/dist/phases/tooltip/TooltipPhase.d.ts +4 -4
  61. package/dist/phases/tooltip/TooltipPhase.js +10 -7
  62. package/dist/phases/transforms/TransformsPhase.d.ts +3 -3
  63. package/dist/phases/transforms/TransformsPhase.js +2 -2
  64. package/dist/plots/correlation/heatmap/defaults.d.ts +2 -2
  65. package/dist/plots/correlation/heatmap/defaults.js +21 -6
  66. package/dist/plots/correlation/heatmap/markers.d.ts +2 -2
  67. package/dist/plots/correlation/heatmap/markers.js +4 -3
  68. package/dist/plots/correlation/scatter/defaults.d.ts +2 -2
  69. package/dist/plots/correlation/scatter/defaults.js +9 -3
  70. package/dist/plots/correlation/scatter/markers.d.ts +2 -2
  71. package/dist/plots/correlation/scatter/markers.js +4 -3
  72. package/dist/plots/distribution/box/BoxSummaries.d.ts +17 -8
  73. package/dist/plots/distribution/box/BoxSummaries.js +90 -40
  74. package/dist/plots/distribution/box/defaults.d.ts +2 -2
  75. package/dist/plots/distribution/box/defaults.js +9 -6
  76. package/dist/plots/distribution/box/markers.d.ts +2 -2
  77. package/dist/plots/distribution/box/markers.js +3 -3
  78. package/dist/plots/distribution/density/defaults.d.ts +2 -2
  79. package/dist/plots/distribution/density/defaults.js +17 -1
  80. package/dist/plots/distribution/density/markers.d.ts +2 -2
  81. package/dist/plots/distribution/density/markers.js +4 -4
  82. package/dist/plots/distribution/histogram/defaults.d.ts +2 -2
  83. package/dist/plots/distribution/histogram/defaults.js +20 -25
  84. package/dist/plots/distribution/histogram/markers.d.ts +2 -2
  85. package/dist/plots/distribution/histogram/markers.js +5 -4
  86. package/dist/plots/distribution/pyramid/defaults.d.ts +2 -2
  87. package/dist/plots/distribution/pyramid/defaults.js +4 -1
  88. package/dist/plots/distribution/pyramid/markers.d.ts +2 -2
  89. package/dist/plots/distribution/pyramid/markers.js +4 -3
  90. package/dist/plots/distribution/violin/defaults.d.ts +2 -2
  91. package/dist/plots/distribution/violin/defaults.js +9 -7
  92. package/dist/plots/distribution/violin/markers.d.ts +2 -2
  93. package/dist/plots/distribution/violin/markers.js +3 -3
  94. package/dist/plots/evolution/area/defaults.d.ts +2 -2
  95. package/dist/plots/evolution/area/defaults.js +1 -1
  96. package/dist/plots/evolution/area/markers.d.ts +2 -2
  97. package/dist/plots/evolution/area/markers.js +4 -4
  98. package/dist/plots/evolution/line/defaults.d.ts +2 -2
  99. package/dist/plots/evolution/line/defaults.js +1 -1
  100. package/dist/plots/evolution/line/markers.d.ts +2 -2
  101. package/dist/plots/evolution/line/markers.js +3 -3
  102. package/dist/plots/evolution/slope/defaults.d.ts +2 -2
  103. package/dist/plots/evolution/slope/defaults.js +8 -4
  104. package/dist/plots/evolution/slope/markers.d.ts +2 -2
  105. package/dist/plots/evolution/slope/markers.js +3 -3
  106. package/dist/plots/evolution/sparkline/defaults.d.ts +2 -2
  107. package/dist/plots/evolution/sparkline/defaults.js +5 -2
  108. package/dist/plots/evolution/sparkline/markers.d.ts +2 -2
  109. package/dist/plots/evolution/sparkline/markers.js +3 -3
  110. package/dist/plots/map/geo/Core.svelte +3 -3
  111. package/dist/plots/map/geo/defaults.d.ts +2 -2
  112. package/dist/plots/map/geo/phases/data.d.ts +1 -1
  113. package/dist/plots/map/geo/phases/data.js +1 -1
  114. package/dist/plots/map/geo/phases/hover.d.ts +2 -2
  115. package/dist/plots/map/geo/phases/hover.js +3 -3
  116. package/dist/plots/map/geo/phases/markers.d.ts +2 -2
  117. package/dist/plots/map/geo/phases/markers.js +3 -3
  118. package/dist/plots/map/geo/phases/scales.d.ts +2 -2
  119. package/dist/plots/map/geo/phases/scales.js +2 -2
  120. package/dist/plots/part-of-a-whole/treemap/defaults.d.ts +2 -2
  121. package/dist/plots/part-of-a-whole/treemap/defaults.js +37 -21
  122. package/dist/plots/ranking/bar/defaults.d.ts +2 -2
  123. package/dist/plots/ranking/bar/defaults.js +13 -7
  124. package/dist/plots/ranking/bar/markers.d.ts +3 -3
  125. package/dist/plots/ranking/bar/markers.js +8 -7
  126. package/dist/plots/ranking/bullet/defaults.d.ts +2 -2
  127. package/dist/plots/ranking/bullet/defaults.js +4 -4
  128. package/dist/plots/ranking/bullet/markers.d.ts +3 -3
  129. package/dist/plots/ranking/bullet/markers.js +9 -9
  130. package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +3 -3
  131. package/dist/plots/ranking/cleveland/ClevelandMarkers.js +11 -10
  132. package/dist/plots/ranking/cleveland/defaults.d.ts +2 -2
  133. package/dist/plots/ranking/cleveland/defaults.js +7 -4
  134. package/dist/plots/ranking/dumbbell/defaults.d.ts +2 -2
  135. package/dist/plots/ranking/forest/defaults.d.ts +2 -2
  136. package/dist/plots/ranking/lollipop/defaults.d.ts +2 -2
  137. package/dist/types/configuration/styling.d.ts +4 -0
  138. package/dist/types/layout/context.d.ts +21 -0
  139. package/dist/types/layout/context.js +1 -0
  140. package/dist/types/layout/hover.d.ts +3 -0
  141. package/dist/types/layout/styles/values.d.ts +8 -2
  142. package/dist/types/layout/tooltip.d.ts +5 -10
  143. package/dist/types/markers/axis/axisBasedMarkersConfig.d.ts +2 -1
  144. package/dist/types/markers/axis/band.d.ts +24 -0
  145. package/dist/types/markers/axis/band.js +1 -0
  146. package/dist/types/markers/axis/bar.d.ts +2 -2
  147. package/dist/types/markers/axis/hover.d.ts +60 -15
  148. package/dist/types/markers/channels/commonMarkerConfig.d.ts +6 -2
  149. package/dist/types/markers/common.d.ts +1 -0
  150. package/dist/types/markers/common.js +1 -0
  151. package/dist/types/phases/context/phase.d.ts +7 -0
  152. package/dist/types/phases/context/phase.js +1 -0
  153. package/dist/types/phases/data/phase.d.ts +2 -2
  154. package/dist/types/phases/hover/phase.d.ts +10 -7
  155. package/dist/types/phases/index.d.ts +2 -1
  156. package/dist/types/phases/kind.d.ts +11 -8
  157. package/dist/types/phases/mapping/phase.d.ts +2 -2
  158. package/dist/types/phases/markers/phase.d.ts +3 -3
  159. package/dist/types/phases/scales/phase.d.ts +4 -4
  160. package/dist/types/phases/stage.d.ts +3 -3
  161. package/dist/types/phases/state.d.ts +1 -1
  162. package/dist/types/phases/styles/phase.d.ts +3 -2
  163. package/dist/types/phases/transforms/phase.d.ts +2 -2
  164. package/dist/types/plots/constants.d.ts +3 -5
  165. package/dist/types/plots/correlation/heatmap/state.d.ts +2 -2
  166. package/dist/types/plots/correlation/scatter/state.d.ts +2 -2
  167. package/dist/types/plots/distribution/box/props.d.ts +23 -1
  168. package/dist/types/plots/distribution/box/state.d.ts +6 -17
  169. package/dist/types/plots/distribution/density/state.d.ts +2 -2
  170. package/dist/types/plots/distribution/histogram/props.d.ts +14 -1
  171. package/dist/types/plots/distribution/histogram/state.d.ts +2 -2
  172. package/dist/types/plots/distribution/pyramid/state.d.ts +2 -2
  173. package/dist/types/plots/distribution/violin/props.d.ts +2 -1
  174. package/dist/types/plots/distribution/violin/state.d.ts +2 -2
  175. package/dist/types/plots/evolution/area/state.d.ts +2 -2
  176. package/dist/types/plots/evolution/line/state.d.ts +2 -2
  177. package/dist/types/plots/evolution/slope/state.d.ts +2 -2
  178. package/dist/types/plots/evolution/sparkline/state.d.ts +2 -2
  179. package/dist/types/plots/map/geo/state.d.ts +1 -1
  180. package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +14 -4
  181. package/dist/types/plots/part-of-a-whole/treemap/state.d.ts +2 -2
  182. package/dist/types/plots/props.d.ts +3 -0
  183. package/dist/types/plots/ranking/bar/state.d.ts +2 -2
  184. package/dist/types/plots/ranking/bullet/state.d.ts +2 -2
  185. package/dist/types/plots/ranking/cleveland/state.d.ts +2 -2
  186. package/dist/types/plots/ranking/dumbbell/state.d.ts +2 -2
  187. package/dist/types/plots/ranking/forest/state.d.ts +2 -2
  188. package/dist/types/plots/ranking/lollipop/state.d.ts +2 -2
  189. package/docs/markers.md +34 -2
  190. package/docs/plots/evolution/line.md +1 -1
  191. package/docs/plots/evolution/slope.md +1 -1
  192. package/docs/plots/part-of-a-whole/treemap.md +36 -2
  193. package/docs/plots/ranking/bar.md +1 -0
  194. package/docs/plots/ranking/cleveland.md +1 -1
  195. package/docs/state.md +33 -0
  196. package/docs/styles-and-segments.md +2 -2
  197. package/docs/theming.md +2 -1
  198. package/docs/tooltip-and-hover.md +81 -3
  199. package/examples/LineDates.svelte +1 -1
  200. package/examples/ResponsiveLine.svelte +3 -1
  201. package/examples/TreemapHover.svelte +25 -0
  202. package/examples/ValueLabels.svelte +1 -1
  203. package/llms-full.txt +8 -6
  204. package/llms.txt +2 -1
  205. package/package.json +1 -1
@@ -0,0 +1,95 @@
1
+ import { SERIES_ID_KEY, SERIES_KEY } from '../transforms/TransformsPhase';
2
+ import { ProcessedPositions } from '../transforms/ProcessedPositions';
3
+ import { PlotAxes } from '../data/PlotAxes';
4
+ import { resolveAccessor } from '../../utils/accessors';
5
+ import { seriesIdOf } from '../../utils/grouping';
6
+ /** Where a row's context is kept on it: under a symbol, which survives the copies svelteplot makes of a row. */
7
+ const KEY = Symbol('dct-row-context');
8
+ /**
9
+ * The context of the rows a plot draws ({@link PlotRowContext}): worked out once per row by the "context" phase,
10
+ * kept on the row itself, and read back from it - or from any copy of it - with {@link of}.
11
+ */
12
+ export class RowContext {
13
+ /**
14
+ * What the plot knows of `row`: its series, where it sits, the value it shows and whatever its kind works out
15
+ * for it, with the row itself. A row no plot drew reads as its series alone.
16
+ */
17
+ static of(row) {
18
+ if (row == null || typeof row !== 'object')
19
+ return {};
20
+ const record = row;
21
+ const own = record[KEY];
22
+ if (own)
23
+ return { ...own, row };
24
+ const series = record[SERIES_KEY];
25
+ return { ...(typeof series === 'string' ? { series } : {}), row };
26
+ }
27
+ /** Keeps `context` on `row`, for {@link of} to read back. */
28
+ static tag(row, context) {
29
+ row[KEY] = context;
30
+ }
31
+ /** Whether `row` carries a context already. */
32
+ static has(row) {
33
+ return row != null && typeof row === 'object' && KEY in row;
34
+ }
35
+ /** A reader of the rows of `state`: the context each carries, else the shared one, for a row no phase tagged. */
36
+ static reader(state) {
37
+ let shared;
38
+ return (row) => {
39
+ if (RowContext.has(row))
40
+ return RowContext.of(row);
41
+ shared ??= RowContext.shared(state);
42
+ return { ...shared(row), row };
43
+ };
44
+ }
45
+ /**
46
+ * The context every plot gives a processed row: its series; its `x` and `y` - each its series' own value
47
+ * (a stacked row's own, not the running total), else where the transforms put it (a density's estimate, a
48
+ * bin's centre); and its value on the plot's value axis, when that is a number.
49
+ */
50
+ static shared(state) {
51
+ const processed = state.processedData;
52
+ if (!processed)
53
+ return () => ({});
54
+ const valueAxis = PlotAxes.valueOf(state);
55
+ const placed = ProcessedPositions.of(processed, valueAxis);
56
+ const x = RowContext.#along(state, 'x', RowContext.#stacked(processed, 'x') ?? placed.x);
57
+ const y = RowContext.#along(state, 'y', RowContext.#stacked(processed, 'y') ?? placed.y);
58
+ return (row) => {
59
+ const series = row[SERIES_KEY];
60
+ const at = { x: x(row), y: y(row) };
61
+ const raw = at[valueAxis];
62
+ const value = raw instanceof Date || raw === null || raw === '' ? NaN : Number(raw);
63
+ return {
64
+ ...(typeof series === 'string' ? { series } : {}),
65
+ ...at,
66
+ ...(Number.isFinite(value) ? { value } : {})
67
+ };
68
+ };
69
+ }
70
+ /** A stacked row's own value along `axis` - its span, not the running total - or `undefined` with no stack there. */
71
+ static #stacked(processed, axis) {
72
+ const from = processed.channels[`${axis}1`];
73
+ const to = processed.channels[`${axis}2`];
74
+ const stack = axis === 'x' ? 'stackX' : 'stackY';
75
+ if (from === undefined || to === undefined)
76
+ return undefined;
77
+ if (!processed.transforms.some((t) => t.type === stack))
78
+ return undefined;
79
+ const low = resolveAccessor(from);
80
+ const high = resolveAccessor(to);
81
+ return (row) => Number(high(row)) - Number(low(row));
82
+ }
83
+ /** A row's value along `axis`: its series' own channel, else `placed`. */
84
+ static #along(state, axis, placed) {
85
+ const bySeries = new Map((state.resolvedSeries ?? []).flatMap((s) => {
86
+ const accessor = s[axis];
87
+ return accessor === undefined ? [] : [[seriesIdOf(s), resolveAccessor(accessor)]];
88
+ }));
89
+ return (row) => {
90
+ const own = bySeries.get(String(row[SERIES_ID_KEY]));
91
+ const value = own?.(row);
92
+ return value === undefined ? placed(row) : value;
93
+ };
94
+ }
95
+ }
@@ -1,4 +1,4 @@
1
- import type { AxisPlotState, AxisPlotCtx, DataStageOptions, PhaseStage } from '../../types/phases';
1
+ import type { AxisPlotState, AxisPlotEnv, DataStageOptions, PhaseStage } from '../../types/phases';
2
2
  type AnyAxisState = AxisPlotState<any, any, any, any>;
3
3
  /**
4
4
  * The "data" phase every axis-based plot shares: its series (from `series`,
@@ -10,10 +10,10 @@ type AnyAxisState = AxisPlotState<any, any, any, any>;
10
10
  * Colors and axes come from every series, before any is omitted or split by
11
11
  * facet panel, so they stay put and every panel agrees.
12
12
  */
13
- export declare class DataPhase<TState extends AnyAxisState, TCtx extends AxisPlotCtx> implements PhaseStage<TState, TCtx> {
13
+ export declare class DataPhase<TState extends AnyAxisState, TEnv extends AxisPlotEnv> implements PhaseStage<TState, TEnv> {
14
14
  #private;
15
15
  readonly phase: "data";
16
- constructor(options?: DataStageOptions<TState, TCtx>);
17
- run: (state: TState, ctx: TCtx) => TState;
16
+ constructor(options?: DataStageOptions<TState, TEnv>);
17
+ run: (state: TState, env: TEnv) => TState;
18
18
  }
19
19
  export {};
@@ -22,7 +22,7 @@ export class DataPhase {
22
22
  constructor(options = {}) {
23
23
  this.#options = options;
24
24
  }
25
- run = (state, ctx) => {
25
+ run = (state, env) => {
26
26
  const options = this.#options;
27
27
  const { series, data, segments, scales } = state;
28
28
  const { connect = true, color: segmentColor } = options.segments ?? {};
@@ -35,8 +35,8 @@ export class DataPhase {
35
35
  given: { x: state.x !== undefined, y: state.y !== undefined },
36
36
  discrete: options.discreteAxes
37
37
  });
38
- const seriesColors = ColorRamp.resolve(scales.color, (options.colorOrder ? options.colorOrder(fullSeries) : fullSeries).map((s) => s.name), ctx.cfg.palette);
39
- const colorForPath = series ? undefined : DataPhase.#buildPathColors(state, ctx);
38
+ const seriesColors = ColorRamp.resolve(scales.color, (options.colorOrder ? options.colorOrder(fullSeries) : fullSeries).map((s) => s.name), env.cfg.palette);
39
+ const colorForPath = series ? undefined : DataPhase.#buildPathColors(state, env);
40
40
  // A plot that splits its series by every level colors each one by its path; a nested one by its outermost.
41
41
  const colorForSeries = colorForPath && !options.nested
42
42
  ? DataPhase.#byPath(state, colorForPath, seriesColors)
@@ -44,7 +44,7 @@ export class DataPhase {
44
44
  const panelSeries = state.panels && state.panelOf && !series
45
45
  ? FacetPanels.splitSeries(fullSeries, state.panels, state.panelOf)
46
46
  : fullSeries;
47
- const legend = ctx.interaction?.legend;
47
+ const legend = env.interaction?.legend;
48
48
  const resolvedSeries = legend?.withoutOmitted(panelSeries) ?? panelSeries;
49
49
  const removedSeries = legend?.removed(panelSeries);
50
50
  const baseFor = BasicStyles.of(state.styles, options.segments?.base);
@@ -75,14 +75,14 @@ export class DataPhase {
75
75
  ...(colorForPath ? { colorForPath } : {}),
76
76
  ...(gapFillMaps ? { gapFillMaps } : {})
77
77
  };
78
- return options.extend ? options.extend(next, ctx) : next;
78
+ return options.extend ? options.extend(next, env) : next;
79
79
  };
80
80
  /**
81
81
  * The color of a path of the plot's `grouping` levels, when `scales.color.depth` reaches past the outermost
82
82
  * one: each outermost value its categorical color, and every path down to `depth` a tone of it (see
83
83
  * {@link ColorTones.hierarchy}). `undefined` for a grouping of one level, or a depth of 1.
84
84
  */
85
- static #buildPathColors(state, ctx) {
85
+ static #buildPathColors(state, env) {
86
86
  const depth = state.scales.color?.depth ?? 1;
87
87
  const rows = state.data ?? [];
88
88
  const levels = Grouping.levels(state.grouping, rows).map((level) => resolveAccessor(level));
@@ -90,7 +90,7 @@ export class DataPhase {
90
90
  return undefined;
91
91
  const paths = rows.map((row) => levels.map((read) => String(read(row))));
92
92
  const outermost = [...new Set(paths.map((path) => path[0]))];
93
- const colorOf = ColorRamp.resolve(state.scales.color, outermost, ctx.cfg.palette);
93
+ const colorOf = ColorRamp.resolve(state.scales.color, outermost, env.cfg.palette);
94
94
  return ColorTones.hierarchy(paths, depth, (value) => colorOf(value));
95
95
  }
96
96
  /** A series' color as the color of its path - its name is the key its levels make together. */
@@ -1,6 +1,6 @@
1
1
  import type { HoverDisplayPoint, HoverPoint } from '../../types/layout/hover';
2
2
  import { LegendState } from '../../layout/legend/LegendState.svelte';
3
- import type { AxisPlotCtx, AxisPlotState, HoverPosition, HoverStageOptions, PhaseStage, ProcessedData } from '../../types/phases';
3
+ import type { AxisPlotEnv, AxisPlotState, HoverPosition, HoverStageOptions, PhaseStage, ProcessedData } from '../../types/phases';
4
4
  type AnyAxisState = AxisPlotState<any, any, any, any>;
5
5
  /**
6
6
  * The "hover" phase every axis-based plot shares: what the pointer can match
@@ -9,15 +9,16 @@ type AnyAxisState = AxisPlotState<any, any, any, any>;
9
9
  * hover `rows`) of the series the legend shows, except gap rows and rows
10
10
  * outside the legend's narrowed range.
11
11
  */
12
- export declare class HoverPhase<TState extends AnyAxisState, TCtx extends AxisPlotCtx> implements PhaseStage<TState, TCtx> {
12
+ export declare class HoverPhase<TState extends AnyAxisState, TEnv extends AxisPlotEnv> implements PhaseStage<TState, TEnv> {
13
13
  #private;
14
14
  readonly phase: "hover";
15
- constructor(options?: HoverStageOptions<TState, TCtx>);
16
- run: (state: TState, ctx: TCtx) => TState;
15
+ constructor(options?: HoverStageOptions<TState, TEnv>);
16
+ run: (state: TState, env: TEnv) => TState;
17
17
  /**
18
18
  * Hover candidates for a plot's own processed rows: each visible row at its
19
19
  * position (a stacked row's top, a bin's centre), in its series' color. A
20
- * series the legend turned off is left out, as is any row `include` rejects.
20
+ * series the legend hides, omits or rescales away is left out (a dimmed one
21
+ * stays), as is any row `include` rejects.
21
22
  */
22
23
  static buildProcessedHoverPoints<TRow extends Record<string, unknown>>(args: {
23
24
  processed: ProcessedData;
@@ -25,8 +26,6 @@ export declare class HoverPhase<TState extends AnyAxisState, TCtx extends AxisPl
25
26
  legendInteraction?: LegendState | null;
26
27
  label: (row: TRow) => string;
27
28
  include?: (row: TRow) => boolean;
28
- /** The row a hovered point reads as, e.g. with derived fields added. Defaults to the processed row. */
29
- row?: (row: TRow) => TRow;
30
29
  /** Fields to add to (or replace on) each point. */
31
30
  decorate?: (row: TRow) => Partial<HoverDisplayPoint>;
32
31
  /** Where a row sits, as is. Defaults to its processed position, with `y` as a number. */
@@ -1,10 +1,12 @@
1
1
  import { ProcessedPositions } from '../transforms/ProcessedPositions';
2
2
  import { GAP_VALUE, SERIES_KEY } from '../transforms/TransformsPhase';
3
3
  import { HoverSettings } from '../../layout/hover/HoverSettings';
4
+ import { RowContext } from '../context/RowContext';
4
5
  import { PlotAxes } from '../data/PlotAxes';
5
6
  import { NumberFormat } from '../../utils/NumberFormat';
6
7
  import { isGapValue } from '../../plots/utils/gaps';
7
8
  import { LegendState } from '../../layout/legend/LegendState.svelte';
9
+ import { HoverDefaults } from '../../layout/hover/HoverDefaults';
8
10
  /**
9
11
  * The "hover" phase every axis-based plot shares: what the pointer can match
10
12
  * (`hover`), the rows it hovers over (`hoverRows`) and where each sits
@@ -18,7 +20,7 @@ export class HoverPhase {
18
20
  constructor(options = {}) {
19
21
  this.#options = options;
20
22
  }
21
- run = (state, ctx) => {
23
+ run = (state, env) => {
22
24
  const options = this.#options;
23
25
  const valueAxis = PlotAxes.valueOf(state);
24
26
  const raw = options.position?.(state) ??
@@ -28,20 +30,23 @@ export class HoverPhase {
28
30
  const position = options.position || state.axes?.isDiscrete(valueAxis)
29
31
  ? raw
30
32
  : { ...raw, [valueAxis]: (row) => Number(raw[valueAxis](row)) };
33
+ // A row's label is the value its context gives it, else its value channel's.
31
34
  const label = options.label?.(state) ??
32
- ((row) => String(state.channels[valueAxis].accessor(row)));
35
+ ((row) => {
36
+ const { value } = RowContext.of(row);
37
+ return String(value ?? state.channels[valueAxis].accessor(row));
38
+ });
33
39
  const processed = options.rows
34
40
  ? { ...state.processedData, data: options.rows(state) }
35
41
  : state.processedData;
36
42
  const points = HoverPhase.buildProcessedHoverPoints({
37
43
  processed,
38
44
  colorFor: state.colorForSeries,
39
- legendInteraction: ctx.interaction?.legend,
45
+ legendInteraction: env.interaction?.legend,
40
46
  label: label,
41
47
  position,
42
- include: HoverPhase.#hoverable(state, ctx, raw, valueAxis),
43
- row: options.row?.(state),
44
- decorate: options.decorate?.(state, ctx)
48
+ include: HoverPhase.#hoverable(state, env, raw, valueAxis),
49
+ decorate: options.decorate?.(state, env)
45
50
  });
46
51
  const hover = HoverSettings.buildConfig({
47
52
  tooltip: state.tooltip,
@@ -52,13 +57,18 @@ export class HoverPhase {
52
57
  label: label,
53
58
  defaultStrategy: options.strategy ?? HoverSettings.strategyOf(state.axes),
54
59
  pointMatching: options.pointMatching,
55
- number: NumberFormat.of(NumberFormat.displayOf(state.tooltip), ctx.cfg),
56
- context: HoverPhase.#contextOf(options.context?.(state))
60
+ number: NumberFormat.of(NumberFormat.displayOf(state.tooltip), env.cfg)
57
61
  });
58
- const hitAreas = options.hitAreas?.(state, hover, ctx) ?? [];
62
+ const hitAreas = options.hitAreas?.(state, hover, env) ?? [];
63
+ const own = options.marker?.(state, env);
64
+ const look = typeof own === 'function'
65
+ ? own
66
+ : own
67
+ ? () => own
68
+ : (strategy) => HoverDefaults.of(strategy, hover.crosshair);
59
69
  return {
60
70
  ...state,
61
- hover,
71
+ hover: { ...hover, look },
62
72
  hoverPosition: position,
63
73
  hoverRows: processed.data,
64
74
  ...(hitAreas.length > 0 ? { markers: [...(state.markers ?? []), ...hitAreas] } : {})
@@ -67,10 +77,11 @@ export class HoverPhase {
67
77
  /**
68
78
  * Hover candidates for a plot's own processed rows: each visible row at its
69
79
  * position (a stacked row's top, a bin's centre), in its series' color. A
70
- * series the legend turned off is left out, as is any row `include` rejects.
80
+ * series the legend hides, omits or rescales away is left out (a dimmed one
81
+ * stays), as is any row `include` rejects.
71
82
  */
72
83
  static buildProcessedHoverPoints(args) {
73
- const { processed, colorFor, legendInteraction, label, include, row: rowOf, decorate } = args;
84
+ const { processed, colorFor, legendInteraction, label, include, decorate } = args;
74
85
  const processedPosition = ProcessedPositions.of(processed);
75
86
  const position = args.position ?? {
76
87
  x: processedPosition.x,
@@ -79,7 +90,7 @@ export class HoverPhase {
79
90
  const x = position.x;
80
91
  const y = position.y;
81
92
  return processed.data
82
- .filter((d) => !legendInteraction?.isOff(d[SERIES_KEY]))
93
+ .filter((d) => !legendInteraction?.isUnhoverable(d[SERIES_KEY]))
83
94
  .filter((d) => !include || include(d))
84
95
  .map((d) => {
85
96
  const row = d;
@@ -87,7 +98,8 @@ export class HoverPhase {
87
98
  return {
88
99
  x: x(d),
89
100
  y: y(d),
90
- row: rowOf ? rowOf(row) : row,
101
+ row,
102
+ context: RowContext.of(row),
91
103
  label: label(row),
92
104
  series: seriesName,
93
105
  color: colorFor(seriesName),
@@ -95,20 +107,13 @@ export class HoverPhase {
95
107
  };
96
108
  });
97
109
  }
98
- /** What the plot knows of a hovered row: its series, and whatever its kind adds. */
99
- static #contextOf(kind) {
100
- return (row) => {
101
- const series = row[SERIES_KEY];
102
- return { ...(typeof series === 'string' ? { series } : {}), ...kind?.(row) };
103
- };
104
- }
105
110
  /**
106
111
  * Which processed rows can be hovered: not a gap (no value where it sits, or
107
112
  * filled in by `styles.gaps`), and, while the legend narrows a continuous
108
113
  * color to a range, not outside it. A dimmed row stays drawn, never matched.
109
114
  */
110
- static #hoverable(state, ctx, position, valueAxis) {
111
- const range = ctx.interaction?.legend?.range;
115
+ static #hoverable(state, env, position, valueAxis) {
116
+ const range = env.interaction?.legend?.range;
112
117
  const color = state.channels?.color?.accessor;
113
118
  return (row) => {
114
119
  if (isGapValue(position[valueAxis](row)) || row[GAP_VALUE] !== undefined)
@@ -1,4 +1,4 @@
1
- import type { AxisPlotState, AxisPlotCtx, MappingStageOptions, PhaseStage } from '../../types/phases';
1
+ import type { AxisPlotState, AxisPlotEnv, MappingStageOptions, PhaseStage } from '../../types/phases';
2
2
  type AnyAxisState = AxisPlotState<any, any, any, any>;
3
3
  /**
4
4
  * The "mapping" phase every axis-based plot shares: every channel resolved to
@@ -8,10 +8,10 @@ type AnyAxisState = AxisPlotState<any, any, any, any>;
8
8
  * its prop is set, and a size channel given a number stays that literal size.
9
9
  * An unset `x`/`y` reads each row itself, with no `source`.
10
10
  */
11
- export declare class MappingPhase<TState extends AnyAxisState, TCtx extends AxisPlotCtx> implements PhaseStage<TState, TCtx> {
11
+ export declare class MappingPhase<TState extends AnyAxisState, TEnv extends AxisPlotEnv> implements PhaseStage<TState, TEnv> {
12
12
  #private;
13
13
  readonly phase: "mapping";
14
- constructor(options?: MappingStageOptions<TState, TCtx>);
15
- run: (state: TState, ctx: TCtx) => TState;
14
+ constructor(options?: MappingStageOptions<TState, TEnv>);
15
+ run: (state: TState, env: TEnv) => TState;
16
16
  }
17
17
  export {};
@@ -13,7 +13,7 @@ export class MappingPhase {
13
13
  constructor(options = {}) {
14
14
  this.#options = options;
15
15
  }
16
- run = (state, ctx) => {
16
+ run = (state, env) => {
17
17
  const first = state.resolvedSeries?.[0];
18
18
  const identity = { accessor: (d) => d };
19
19
  const size = (value) => typeof value === 'number' ? value : MappingPhase.#channel(value);
@@ -29,7 +29,7 @@ export class MappingPhase {
29
29
  value: MappingPhase.#channel(state.value)
30
30
  };
31
31
  const next = { ...state, channels };
32
- return this.#options.extend ? this.#options.extend(next, ctx) : next;
32
+ return this.#options.extend ? this.#options.extend(next, env) : next;
33
33
  };
34
34
  /** A channel prop resolved to a row accessor, keeping it as `source`, or left out when unset. */
35
35
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -15,4 +15,12 @@ export declare class MarkerStyles {
15
15
  cfg?: PlotStylesConfig;
16
16
  rows?: unknown[];
17
17
  }): T[];
18
+ /**
19
+ * `marker` resolved again after its styles changed (as the hover restyles a shape): a label written in the color
20
+ * that read best on the shape's old one reads best on its new one.
21
+ */
22
+ static restyle<T>(marker: T, plot?: {
23
+ cfg?: PlotStylesConfig;
24
+ rows?: unknown[];
25
+ }): T;
18
26
  }
@@ -17,6 +17,8 @@ export class MarkerStyles {
17
17
  };
18
18
  /** The style fields that take a dash pattern. */
19
19
  static #DASH_KEYS = new Set(['strokeDasharray', 'dotStrokeDasharray']);
20
+ /** The label colors this class chose for a shape's color, which a restyled shape chooses again. */
21
+ static #contrasts = new WeakSet();
20
22
  /** Fields that hold rows rather than config, which are never walked. */
21
23
  static #ROW_KEYS = new Set(['data', 'features']);
22
24
  /**
@@ -26,6 +28,18 @@ export class MarkerStyles {
26
28
  static resolveAll(markers, plot = {}) {
27
29
  return markers.map((marker) => MarkerStyles.#contrasted(MarkerStyles.#walk(marker), plot));
28
30
  }
31
+ /**
32
+ * `marker` resolved again after its styles changed (as the hover restyles a shape): a label written in the color
33
+ * that read best on the shape's old one reads best on its new one.
34
+ */
35
+ static restyle(marker, plot = {}) {
36
+ const label = marker.label;
37
+ const fill = label?.styles?.fill;
38
+ const fresh = typeof fill === 'function' && MarkerStyles.#contrasts.has(fill)
39
+ ? { ...marker, label: { ...label, styles: { ...label.styles, fill: undefined } } }
40
+ : marker;
41
+ return MarkerStyles.resolveAll([fresh], plot)[0];
42
+ }
29
43
  /** The marker with its label inside its shape written in the candidate that reads best on each row's color. */
30
44
  static #contrasted(marker, plot) {
31
45
  const { cfg } = plot;
@@ -48,6 +62,7 @@ export class MarkerStyles {
48
62
  const seen = CssColor.composite(color, opacityOf(row), cfg.background);
49
63
  return CssColor.contrastText(seen, candidates);
50
64
  };
65
+ MarkerStyles.#contrasts.add(fill);
51
66
  return { ...marker, label: { ...label, styles: { ...label.styles, fill } } };
52
67
  }
53
68
  /** The opacity each row's shape is drawn with: a number, the field of the rows a string names, a function of the row. */
@@ -1,4 +1,4 @@
1
- import type { AxisPlotCtx, AxisPlotState, MarkersStageOptions, PhaseStage } from '../../types/phases';
1
+ import type { AxisPlotEnv, AxisPlotState, MarkersStageOptions, PhaseStage } from '../../types/phases';
2
2
  /**
3
3
  * The shared "markers" phase: everything the plot draws, bottom to top - the
4
4
  * plot kind's own marks, then what the "statistics" phase left in
@@ -6,9 +6,9 @@ import type { AxisPlotCtx, AxisPlotState, MarkersStageOptions, PhaseStage } from
6
6
  * value labels when `styles.values.show` turns them on, each with what every
7
7
  * label shares ({@link ValueLabels.hooks}), and every style as svelteplot reads it ({@link MarkerStyles}).
8
8
  */
9
- export declare class MarkersPhase<TState extends AxisPlotState<any, any, any, any>, TCtx extends AxisPlotCtx> implements PhaseStage<TState, TCtx> {
9
+ export declare class MarkersPhase<TState extends AxisPlotState<any, any, any, any>, TEnv extends AxisPlotEnv> implements PhaseStage<TState, TEnv> {
10
10
  #private;
11
11
  readonly phase: "markers";
12
- constructor(options: MarkersStageOptions<TState, TCtx>);
13
- run: (state: TState, ctx: TCtx) => TState;
12
+ constructor(options: MarkersStageOptions<TState, TEnv>);
13
+ run: (state: TState, env: TEnv) => TState;
14
14
  }
@@ -13,18 +13,18 @@ export class MarkersPhase {
13
13
  constructor(options) {
14
14
  this.#options = options;
15
15
  }
16
- run = (state, ctx) => {
16
+ run = (state, env) => {
17
17
  const options = this.#options;
18
18
  const labels = state.valueLabels;
19
19
  const valueLabels = labels?.show && options.valueLabels
20
- ? options.valueLabels(labels, state, ctx).map((marker) => {
21
- const { styles, ...hooks } = labels.hooks(ctx);
20
+ ? options.valueLabels(labels, state, env).map((marker) => {
21
+ const { styles, ...hooks } = labels.hooks(env);
22
22
  return { ...hooks, ...marker, styles: { ...styles, ...marker.styles } };
23
23
  })
24
24
  : [];
25
25
  return {
26
26
  ...state,
27
- markers: MarkerStyles.resolveAll(MarkerChannels.inheritPosition(MarkerChannels.inheritAll([...options.marks(state, ctx), ...(state.markers ?? []), ...valueLabels], state.scales), state.processedData), { cfg: ctx.cfg, rows: state.processedData?.data })
27
+ markers: MarkerStyles.resolveAll(MarkerChannels.inheritPosition(MarkerChannels.inheritAll([...options.marks(state, env), ...(state.markers ?? []), ...valueLabels], state.scales), state.processedData), { cfg: env.cfg, rows: state.processedData?.data })
28
28
  };
29
29
  };
30
30
  }
@@ -1,6 +1,6 @@
1
1
  import { PlotAxes } from '../data/PlotAxes';
2
2
  import type { AxisChannelName } from '../../types/layout/mapping';
3
- import type { AxisPlotState, AxisPlotCtx, PhaseStage, ScalesStageOptions } from '../../types/phases';
3
+ import type { AxisPlotState, AxisPlotEnv, PhaseStage, ScalesStageOptions } from '../../types/phases';
4
4
  type AnyAxisState = AxisPlotState<any, any, any, any>;
5
5
  /**
6
6
  * The shared "scales" phase. Each axis the kind lays out as categories
@@ -10,10 +10,10 @@ type AnyAxisState = AxisPlotState<any, any, any, any>;
10
10
  * transforms gave the rows - from zero on the axes `zero` names. The author's
11
11
  * `scales` always win, and a kind adds its own on top (`defaults`, `fit`, `extend`).
12
12
  */
13
- export declare class ScalesPhase<TState extends AnyAxisState, TCtx extends AxisPlotCtx> implements PhaseStage<TState, TCtx> {
13
+ export declare class ScalesPhase<TState extends AnyAxisState, TEnv extends AxisPlotEnv> implements PhaseStage<TState, TEnv> {
14
14
  #private;
15
15
  readonly phase: "scales";
16
- constructor(options?: ScalesStageOptions<TState, TCtx>);
16
+ constructor(options?: ScalesStageOptions<TState, TEnv>);
17
17
  /** The axes whose marks grow from zero, in this state. */
18
18
  zeroAxes(state: {
19
19
  axes?: PlotAxes;
@@ -24,6 +24,6 @@ export declare class ScalesPhase<TState extends AnyAxisState, TCtx extends AxisP
24
24
  }): AxisChannelName[];
25
25
  /** Whether the kind keeps its categories in the order the data gives them. */
26
26
  get keepsDataOrder(): boolean;
27
- run: (state: TState, ctx: TCtx) => TState;
27
+ run: (state: TState, env: TEnv) => TState;
28
28
  }
29
29
  export {};
@@ -44,10 +44,10 @@ export class ScalesPhase {
44
44
  get keepsDataOrder() {
45
45
  return this.#options.bandOrder === 'data';
46
46
  }
47
- run = (state, ctx) => {
47
+ run = (state, env) => {
48
48
  const options = this.#options;
49
49
  const { axes, processedData, markers = [] } = state;
50
- const defaults = options.defaults?.(state, ctx) ?? {};
50
+ const defaults = options.defaults?.(state, env) ?? {};
51
51
  const symmetric = new Set(this.symmetricAxes(state));
52
52
  const zero = new Set(this.zeroAxes(state));
53
53
  const scales = { ...state.scales };
@@ -72,7 +72,7 @@ export class ScalesPhase {
72
72
  scales[axis] = { ...scales[axis], domain: [-reach, reach] };
73
73
  }
74
74
  }
75
- const fitted = options.fit?.({ ...state, scales }, ctx) ?? {};
75
+ const fitted = options.fit?.({ ...state, scales }, env) ?? {};
76
76
  const fittedAxes = [];
77
77
  for (const axis of AXES) {
78
78
  if (!fitted[axis])
@@ -111,7 +111,7 @@ export class ScalesPhase {
111
111
  : { ...author, domain: [lo, hi], nice: author?.nice ?? true };
112
112
  }
113
113
  const next = { ...state, scales, ...(fittedAxes.length ? { fittedAxes } : {}) };
114
- return options.extend ? options.extend(next, ctx) : next;
114
+ return options.extend ? options.extend(next, env) : next;
115
115
  };
116
116
  /** A category axis as a band scale: the kind's options under the author's, in the order the kind asks for. */
117
117
  #band(author, own, state, axis) {
@@ -30,11 +30,11 @@ type SharedScalesState = FacetStageState & {
30
30
  * can't happen there. Without options, a kind still shares its domains: it just
31
31
  * has no bands and nothing that starts from zero.
32
32
  */
33
- export declare class SharedScalesPhase<TState extends SharedScalesState, TCtx> implements PhaseStage<TState, TCtx> {
33
+ export declare class SharedScalesPhase<TState extends SharedScalesState, TEnv> implements PhaseStage<TState, TEnv> {
34
34
  #private;
35
35
  readonly phase: "sharedScales";
36
36
  constructor(options: SharedScalesOptions | undefined, scales?: ScalesPhase<any, any>);
37
- run: (state: TState, ctx: TCtx) => TState;
37
+ run: (state: TState, env: TEnv) => TState;
38
38
  /**
39
39
  * One axis' domain over some slices: sorted values on a band axis, `[min, max]`
40
40
  * otherwise, or `undefined`. A numeric extent is niced here, once, so every
@@ -34,7 +34,7 @@ export class SharedScalesPhase {
34
34
  this.#scales = scales;
35
35
  this.#kindScales = new Pipeline([scales]);
36
36
  }
37
- run = (state, ctx) => {
37
+ run = (state, env) => {
38
38
  const facet = state.facet;
39
39
  const panels = facet ? (state.panels ?? []) : [];
40
40
  // A symmetric axis has no domain but the one the kind's "scales" phase gives it.
@@ -54,7 +54,7 @@ export class SharedScalesPhase {
54
54
  const domainOver = (channel, members) => {
55
55
  if (fromPhase.has(channel)) {
56
56
  const scoped = members ? FacetPanels.narrowToPanels(state, members) : state;
57
- const scales = this.#kindScales.run(scoped, ctx).scales;
57
+ const scales = this.#kindScales.run(scoped, env).scales;
58
58
  const domain = scales?.[channel]?.domain;
59
59
  return domain === undefined ? undefined : { domain };
60
60
  }
@@ -35,14 +35,5 @@ export declare class MarkerGrouping {
35
35
  color?: unknown;
36
36
  defaultColor?: string;
37
37
  }): TMarker[];
38
- /**
39
- * Gives a scoped hover marker its series color through its own `dot` and
40
- * `text` styles, the way `withSeriesColor` does for other markers. A style the
41
- * marker sets itself keeps its own color.
42
- */
43
- static withHoverSeriesColor<T extends {
44
- dot?: object;
45
- text?: object;
46
- }>(marker: T, color: string | undefined): T;
47
38
  }
48
39
  export {};
@@ -94,20 +94,4 @@ export class MarkerGrouping {
94
94
  return Object.keys(updates).length ? { ...m, ...updates } : marker;
95
95
  });
96
96
  }
97
- /**
98
- * Gives a scoped hover marker its series color through its own `dot` and
99
- * `text` styles, the way `withSeriesColor` does for other markers. A style the
100
- * marker sets itself keeps its own color.
101
- */
102
- static withHoverSeriesColor(marker, color) {
103
- if (!color)
104
- return marker;
105
- const dot = (marker.dot ?? {});
106
- const text = (marker.text ?? {});
107
- return {
108
- ...marker,
109
- dot: { ...dot, dotFill: dot.dotFill ?? color, dotStroke: dot.dotStroke ?? color },
110
- text: { ...text, fill: text.fill ?? color }
111
- };
112
- }
113
97
  }
@@ -1,13 +1,13 @@
1
- import type { AxisPlotState, AxisPlotCtx, PhaseStage } from '../../types/phases';
1
+ import type { AxisPlotState, AxisPlotEnv, PhaseStage } from '../../types/phases';
2
2
  import type { StylesStageOptions } from '../../types/phases/styles/phase';
3
3
  /**
4
4
  * The shared "styles" phase: resolves the plot's `styles` against the plot
5
5
  * kind's own defaults - its value labels (`valueLabels`), with how far they
6
6
  * are expected to reach out, which its margins start from.
7
7
  */
8
- export declare class StylesPhase<TState extends AxisPlotState<any, any, any, any>, TCtx extends AxisPlotCtx> implements PhaseStage<TState, TCtx> {
8
+ export declare class StylesPhase<TState extends AxisPlotState<any, any, any, any>, TEnv extends AxisPlotEnv> implements PhaseStage<TState, TEnv> {
9
9
  #private;
10
10
  readonly phase: "styles";
11
11
  constructor(options?: StylesStageOptions<TState>);
12
- run: (state: TState, ctx: TCtx) => TState;
12
+ run: (state: TState, env: TEnv) => TState;
13
13
  }
@@ -10,8 +10,8 @@ export class StylesPhase {
10
10
  constructor(options = {}) {
11
11
  this.#options = options;
12
12
  }
13
- run = (state, ctx) => ({
13
+ run = (state, env) => ({
14
14
  ...state,
15
- valueLabels: ValueLabels.build(state.values, ctx.cfg, this.#options.values ?? {}, state)
15
+ valueLabels: ValueLabels.build(state.values, env.cfg, this.#options.values ?? {}, state)
16
16
  });
17
17
  }