@graphysdk/viz-engine 0.0.1-plugins.5 → 0.0.1-plugins.7

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.
package/dist/index.d.ts CHANGED
@@ -1,24 +1,44 @@
1
1
  import { internal } from 'arquero';
2
2
 
3
+ /**
4
+ * The aesthetic mapping: data columns (or constants) bound to visual channels. Seeded globally by
5
+ * `createSpec({...})` and overridable per layer via `geom.x({ aes })`. Every field is optional; a channel
6
+ * left unset is simply not driven by data. Each channel binds to the like-named scale (e.g. `color` →
7
+ * `scale.color.*`, `size` → `scale.size.*`); position channels additionally require `scale.x()`/`scale.y()`
8
+ * to be declared (they are NOT auto-inferred).
9
+ */
3
10
  export declare interface AesMapping {
11
+ /** Horizontal position. Binds to `scale.x`. Categorical/temporal x needs `scale.x.discrete()`. */
4
12
  x?: AestheticValue;
13
+ /** Vertical position. Binds to `scale.y` (or `scale.ySecondary` when the layer sets `yScaleType: 'secondary'`). */
5
14
  y?: AestheticValue;
15
+ /** Text drawn on the observation (data labels, slice labels). Binds to no scale; rendered as-is. */
6
16
  label?: AestheticValue;
17
+ /** Series/category color. Binds to `scale.color.*`; mapping a column splits the geom into series and shows a legend. */
7
18
  color?: AestheticValue;
19
+ /** Mark size — point radius / bubble area. Binds to `scale.size.continuous({ range })`. */
8
20
  size?: AestheticValue;
21
+ /** Per-observation opacity in `[0,1]` after scaling. Binds to `scale.alpha.*`. */
9
22
  alpha?: AestheticValue;
23
+ /**
24
+ * Explicit grouping key for which observations form one connected mark (one line/area). Defaults to the
25
+ * `color` column when unset; set it to split lines/areas without colouring them differently.
26
+ */
10
27
  group?: AestheticValue;
28
+ /** Stroke thickness as a data-driven channel. Binds to `scale.strokeWidth.*`; for a fixed width use line `params.lineWidth`. */
11
29
  strokeWidth?: AestheticValue;
30
+ /** Dash style (`'solid'`/`'dashed'`/`'dotted'`). Binds to `scale.lineType.discrete({ domain, range })`; great for actual-vs-forecast lines. */
12
31
  lineType?: AestheticValue;
13
32
  }
14
33
 
34
+ /** The set of built-in aesthetic channel names — the keys of {@link AesMapping}. */
15
35
  export declare type AestheticKey = keyof AesMapping;
16
36
 
17
37
  /**
18
- * Aesthetic value can be:
19
- * - string (shorthand for { variable: string })
20
- * - { variable: string } (explicit variable mapping)
21
- * - { value: DataValue } (constant value applied to every observation)
38
+ * How a single aesthetic channel is fed. One of three forms:
39
+ * - a bare string (`'revenue'`) — shorthand for `{ variable: 'revenue' }`, the common case;
40
+ * - `{ variable: 'revenue' }` the same column binding, written explicitly;
41
+ * - `{ value: 2500 }` — a constant {@link ValueMapping} applied to every observation.
22
42
  */
23
43
  declare type AestheticValue = string | VariableMapping | ValueMapping;
24
44
 
@@ -27,22 +47,28 @@ declare function aggregate(options: AggregateOptions): AggregateTransformInput;
27
47
  /***************************************************************
28
48
  * Aggregate Transform
29
49
  ***************************************************************/
50
+ /** A single group-wise reduction applied by `transform.aggregate`. */
30
51
  declare interface AggregateOperation {
31
- /** The aggregation function to apply. */
52
+ /** Reduction to apply: `'count'` | `'sum'` | `'mean'` | `'median'` | `'mode'` | `'min'` | `'max'`. */
32
53
  op: AggregationFunction;
33
- /** The variable to aggregate. */
54
+ /** The variable to reduce within each group. */
34
55
  variableName: VariableName;
35
- /** The name of the output variable. */
56
+ /** Name of the output variable holding the reduced value. */
36
57
  as: VariableName;
37
58
  }
38
59
 
60
+ /**
61
+ * Options for `transform.aggregate` — groups observations by `groupby`, then reduces each group
62
+ * to one observation via `operations`. The idiom for pre-summarizing data (e.g. sum revenue per region).
63
+ */
39
64
  declare interface AggregateOptions {
40
- /** Variables to group by before aggregating. */
65
+ /** Variables to group by; one output observation is produced per distinct combination. */
41
66
  groupby: VariableName[];
42
- /** Aggregation operations to apply per group. */
67
+ /** One or more reductions to compute per group. */
43
68
  operations: AggregateOperation[];
44
69
  }
45
70
 
71
+ /** Group-and-reduce transform produced by `transform.aggregate`. */
46
72
  declare interface AggregateTransformInput {
47
73
  type: 'transform';
48
74
  transformType: 'aggregate';
@@ -82,11 +108,63 @@ declare interface AnchorSegment {
82
108
  direction: 'positive' | 'negative';
83
109
  }
84
110
 
111
+ /**
112
+ * The angular span of an arc/wedge in a polar coord, in **radians** (0 = straight up, increasing
113
+ * clockwise — the d3-arc convention). Either endpoint is `null` when the observation declares no x
114
+ * interval. Returned by {@link getAngleExtent}.
115
+ */
85
116
  export declare interface AngleExtent {
86
117
  startAngle: NumericDataValue;
87
118
  endAngle: NumericDataValue;
88
119
  }
89
120
 
121
+ /**
122
+ * Builder for the built-in annotation kinds — the pipeable counterpart to setting the `annotations`
123
+ * field by hand. Each method returns an {@link AnnotationItem}; piped into `createSpec`/`pipe` it appends
124
+ * to the matching {@link AnnotationsInput} field, so annotations compose left-to-right like every other
125
+ * spec feature (geoms, scales, highlights). Multiple calls of the same kind accumulate.
126
+ *
127
+ * Anchoring differs per kind: only {@link annotation.differenceArrow} snaps to DATA (two observations);
128
+ * `shape`, `text`, and `freeformArrow` position in panel fractions (`[0,1]`, top-left origin). `sticker`,
129
+ * `pinnedNumber`, and `comment` compile but have NO painter in `@graphysdk/react-renderer` (editor-only) —
130
+ * avoid them when authoring for the React renderer. For a data-anchored callout/band beyond a difference
131
+ * arrow, register a custom kind via `createGraphyBuilder({ annotations })`; its `annotation` builder adds
132
+ * one method per registered kind alongside these built-ins.
133
+ *
134
+ * @example
135
+ * import { pipe, createSpec, geom, scale, annotation } from '@graphysdk/viz-engine';
136
+ *
137
+ * pipe(
138
+ * createSpec({ x: 'month', y: 'revenue', color: 'region' }),
139
+ * geom.line(),
140
+ * scale.x.discrete(),
141
+ * scale.y(),
142
+ * scale.color.palette(),
143
+ * annotation.differenceArrow({
144
+ * start: { anchorValue: 'Jan', groupValue: 'North' },
145
+ * end: { anchorValue: 'Jun', groupValue: 'North' },
146
+ * label: 'relative-difference',
147
+ * }),
148
+ * annotation.shape({ x: 0, y: 0.7, width: 1, height: 0.3, fillColor: '#e15759', fillOpacity: 0.12 }),
149
+ * );
150
+ */
151
+ export declare const annotation: {
152
+ /** A labelled delta between two data observations — the only built-in kind that snaps to data. */
153
+ differenceArrow(input: DifferenceArrowInput): AnnotationItem;
154
+ /** A shaded box positioned in panel fractions (`[0,1]`); does not snap to a data value. */
155
+ shape(input: ShapeInput): AnnotationItem;
156
+ /** A free-standing arrow with endpoints in panel fractions (`[0,1]`); does not snap to a data value. */
157
+ freeformArrow(input: FreeformArrowInput): AnnotationItem;
158
+ /** A free-standing rich-text label positioned in panel fractions (`[0,1]`); does not snap to a data value. */
159
+ text(input: TextAnnotationInput): AnnotationItem;
160
+ /** Editor-only: compiles but has NO painter in `@graphysdk/react-renderer`. */
161
+ sticker(input: StickerAnnotationInput): AnnotationItem;
162
+ /** Editor-only: compiles but has NO painter in `@graphysdk/react-renderer`. */
163
+ pinnedNumber(input: PinnedNumberAnnotationInput): AnnotationItem;
164
+ /** Editor-only: compiles but has NO painter in `@graphysdk/react-renderer`. */
165
+ comment(input: CommentAnnotationInput): AnnotationItem;
166
+ };
167
+
90
168
  /**
91
169
  * The compile-half definition of a custom annotation kind (ADR-035).
92
170
  *
@@ -95,9 +173,11 @@ export declare interface AngleExtent {
95
173
  * params })` from `TParams`, merge `defaultParams`, and enforce the optional coordinate arity. The
96
174
  * render-half `draw` lives in the renderer and binds to this definition by import (`defineAnnotationRenderer`).
97
175
  */
98
- /** Optional coordinate-count guardrail enforced by the builder; unbounded when omitted. */
176
+ /** Allowed coordinate count for an annotation kind; each bound is inclusive, unbounded when omitted. */
99
177
  export declare interface AnnotationArity {
178
+ /** Minimum coordinates required. */
100
179
  min?: number;
180
+ /** Maximum coordinates allowed. */
101
181
  max?: number;
102
182
  }
103
183
 
@@ -142,18 +222,59 @@ declare interface AnnotationDataPoint {
142
222
  rowValue?: DataValue;
143
223
  }
144
224
 
225
+ /**
226
+ * The compile-half definition produced by {@link defineAnnotation}. Pass an array of these to
227
+ * `createGraphyBuilder({ annotations })` to get a typed `annotation.<type>(...)` spec method; the
228
+ * render-half `draw` binds to it by import in `@graphysdk/react-renderer`.
229
+ */
145
230
  export declare interface AnnotationDef<TParams extends object = object, TType extends string = string> {
231
+ /** The registered kind name; keys the `annotation.<type>(...)` builder method and the render-side `draw`. */
146
232
  type: TType;
147
233
  /** Carrier that lets the builder recover `TParams` and merge defaults before a param reaches `draw`. */
148
234
  defaultParams: TParams;
235
+ /** Coordinate-count guardrail enforced by the builder; unbounded when omitted. */
149
236
  coordinates?: AnnotationArity;
150
237
  }
151
238
 
152
- /** Pipeable spec item produced by the registration-typed `annotation.<kind>(...)` builder. */
153
- declare interface AnnotationItem {
239
+ /**
240
+ * Pipeable spec item produced by an `annotation.*` builder. `kind` routes the carried input to the
241
+ * matching {@link AnnotationsInput} field when the item is folded onto a spec by `createSpec`/`pipe`:
242
+ * each built-in kind targets its like-named field, and `'custom'` carries a registered
243
+ * {@link CustomAnnotationInput} onto `annotations.custom`.
244
+ */
245
+ export declare type AnnotationItem = {
154
246
  type: 'annotation';
247
+ kind: 'differenceArrow';
248
+ annotation: DifferenceArrowInput;
249
+ } | {
250
+ type: 'annotation';
251
+ kind: 'shape';
252
+ annotation: ShapeInput;
253
+ } | {
254
+ type: 'annotation';
255
+ kind: 'freeformArrow';
256
+ annotation: FreeformArrowInput;
257
+ } | {
258
+ type: 'annotation';
259
+ kind: 'text';
260
+ annotation: TextAnnotationInput;
261
+ } | {
262
+ type: 'annotation';
263
+ kind: 'sticker';
264
+ annotation: StickerAnnotationInput;
265
+ } | {
266
+ type: 'annotation';
267
+ kind: 'pinnedNumber';
268
+ annotation: PinnedNumberAnnotationInput;
269
+ } | {
270
+ type: 'annotation';
271
+ kind: 'comment';
272
+ annotation: CommentAnnotationInput;
273
+ } | {
274
+ type: 'annotation';
275
+ kind: 'custom';
155
276
  annotation: CustomAnnotationInput;
156
- }
277
+ };
157
278
 
158
279
  /** Recovers an annotation definition's params type — carried structurally by its `defaultParams`. */
159
280
  declare type AnnotationParamsOf<Definition> = Definition extends AnnotationDef<infer TParams> ? TParams : never;
@@ -182,17 +303,38 @@ declare interface AnnotationsCompilerInput {
182
303
  scales: CompiledScales;
183
304
  }
184
305
 
306
+ /**
307
+ * Non-data marks layered onto the panel, set as the `annotations` field on a spec. Each field holds a
308
+ * different built-in kind.
309
+ *
310
+ * Anchoring differs per field and is the deciding detail: only `differenceArrows` snap to DATA (two
311
+ * observations). `shapes`, `textAnnotations` and `freeformArrows` position in panel fractions (`[0,1]`,
312
+ * top-left origin) — they re-flow on resize but do NOT snap to a data value. For a data-anchored callout,
313
+ * band, or marker beyond a difference arrow, author a `custom` annotation.
314
+ *
315
+ * `stickers`, `pinnedNumbers` and `comments` COMPILE but have no painter in `@graphysdk/react-renderer`
316
+ * (they draw only in the editor's legacy engine) — don't use them when authoring for the React renderer.
317
+ */
185
318
  export declare interface AnnotationsInput {
319
+ /** Labelled deltas between two data observations. The only built-in kind that anchors to data. */
186
320
  differenceArrows?: DifferenceArrowInput[];
321
+ /** Shaded boxes positioned in panel fractions (`[0,1]`), not data values. */
187
322
  shapes?: ShapeInput[];
323
+ /** Free-standing arrows positioned in panel fractions (`[0,1]`), not data values. */
188
324
  freeformArrows?: FreeformArrowInput[];
325
+ /** Free-standing rich-text labels positioned in panel fractions (`[0,1]`), not data values. */
189
326
  textAnnotations?: TextAnnotationInput[];
327
+ /** Compiles but has NO painter in `@graphysdk/react-renderer` (editor-only). Avoid here. */
190
328
  stickers?: StickerAnnotationInput[];
329
+ /** Compiles but has NO painter in `@graphysdk/react-renderer` (editor-only). Avoid here. */
191
330
  pinnedNumbers?: PinnedNumberAnnotationInput[];
331
+ /** Compiles but has NO painter in `@graphysdk/react-renderer` (editor-only). Avoid here. */
192
332
  comments?: CommentAnnotationInput[];
333
+ /** Registered custom-annotation instances; the data-anchorable escape hatch when no built-in fits. */
193
334
  custom?: CustomAnnotationInput[];
194
335
  }
195
336
 
337
+ /** Resolved form of {@link AnnotationsInput} — every field present, each entry defaulted. */
196
338
  export declare interface AnnotationsSpec {
197
339
  differenceArrows: DifferenceArrowSpec[];
198
340
  shapes: ShapeSpec[];
@@ -271,6 +413,13 @@ export declare interface AppearanceSpec {
271
413
  highlightStyle: HighlightStyle;
272
414
  }
273
415
 
416
+ /**
417
+ * Area marks — a line with the region below it filled. Same render knobs as line ({@link AreaGeomParams}).
418
+ * Use `position: 'stack'` for a stacked area chart or `'fill'` for a 100%-stacked one.
419
+ *
420
+ * @example
421
+ * pipe(createSpec({ x: 'month', y: 'sales', color: 'region' }), geom.area({ position: 'stack' }), scale.x(), scale.y(), scale.color.palette());
422
+ */
274
423
  declare function area(options?: GeomOptions<'area'>): LayerInputOf<'area'>;
275
424
 
276
425
  /**
@@ -291,21 +440,37 @@ declare class AreaGeom extends Geom {
291
440
  }
292
441
 
293
442
  /**
294
- * Area-specific parameters (same rendering knobs as line, but fills under the curve)
443
+ * Render parameters for `geom.area` — same knobs as {@link LineGeomParams}, but the region below the curve
444
+ * is filled. Passed under `params`.
295
445
  */
296
446
  export declare interface AreaGeomParams {
447
+ /**
448
+ * Outline stroke width in pixels, or `'auto'` to let the theme pick a width.
449
+ * @default 'auto'
450
+ */
297
451
  lineWidth: number | 'auto';
452
+ /**
453
+ * Interpolation method between points: `'linear'` for straight segments, `'catmull-rom'` for a smooth spline.
454
+ * @default 'linear'
455
+ */
298
456
  interpolate: InterpolateType;
457
+ /**
458
+ * How to handle missing (`null`) y-values: `'zero'` drops to zero, `'gap'` breaks the area, `'connect'`
459
+ * bridges across the gap.
460
+ * @default 'zero'
461
+ */
299
462
  missingValues: MissingValuesType;
300
463
  }
301
464
 
465
+ /** An arrow endpoint as a panel fraction (`[0,1]`, top-left origin). */
302
466
  export declare interface ArrowEndpoint {
303
- /** 0..1 of plot width. */
467
+ /** `[0,1]` of panel width (0 = left). */
304
468
  x: number;
305
- /** 0..1 of plot height. */
469
+ /** `[0,1]` of panel height (0 = top). */
306
470
  y: number;
307
471
  }
308
472
 
473
+ /** Arrowhead at an endpoint: `'none'` (bare line) or `'line-arrow'` (drawn head). */
309
474
  export declare type ArrowheadStyle = 'none' | 'line-arrow';
310
475
 
311
476
  export declare type ArrowLineStyle = 'solid' | 'dashed';
@@ -446,6 +611,14 @@ export declare type BackgroundSpec = {
446
611
  color?: string;
447
612
  };
448
613
 
614
+ /**
615
+ * Bar/column marks. Drives most categorical charts: plain, stacked (`position: 'stack'`), grouped
616
+ * (`'dodge'`), 100%-stacked (`'fill'`), horizontal (add `coord.flip()`), and pie/donut (`position: 'fill'`
617
+ * inside `coord.polar({ theta: 'y' })`). No render `params`.
618
+ *
619
+ * @example
620
+ * pipe(createSpec({ x: 'quarter', y: 'sales', color: 'region' }), geom.bar({ position: 'stack' }), scale.x(), scale.y(), scale.color.palette());
621
+ */
449
622
  declare function bar(options?: GeomOptions<'bar'>): LayerInputOf<'bar'>;
450
623
 
451
624
  /**
@@ -496,27 +669,68 @@ declare interface BarOptions {
496
669
  }
497
670
 
498
671
  /**
499
- * Base params shared by all coordinate systems
672
+ * Params shared by every coordinate system. Axis limits clamp the displayed range
673
+ * after scaling.
500
674
  */
501
675
  declare interface BaseCoordParams {
502
676
  /**
503
- * Limits for x-axis [min, max]
677
+ * Fixed x-axis range as `[min, max]` in data units, or `null` to auto-fit from data.
678
+ * @default null
504
679
  */
505
680
  xLimits: [number, number] | null;
506
681
  /**
507
- * Limits for y-axis [min, max]
682
+ * Fixed y-axis range as `[min, max]` in data units, or `null` to auto-fit from data.
683
+ * @default null
508
684
  */
509
685
  yLimits: [number, number] | null;
510
686
  }
511
687
 
688
+ /**
689
+ * Options accepted by every `geom.*` builder. All fields are optional; each builder fills defaults during
690
+ * resolution. The generic `T` is the per-geom `params` shape so `geom.line` accepts {@link LineGeomParams}
691
+ * while `geom.bar` accepts none.
692
+ */
512
693
  declare interface BaseGeomOptions<T extends GeomParams> {
694
+ /**
695
+ * Layer-level aesthetic overrides, shallow-merged OVER the spec-level mapping for this layer only.
696
+ * The place to retarget a channel per layer in a combo (`geom.line({ aes: { y: 'margin' } })`) or to pin a
697
+ * constant (`aes: { y: { value: 2500 } }` for a reference line).
698
+ */
513
699
  aes?: AesMapping;
700
+ /**
701
+ * Statistical transform applied to this layer's data before positioning. `'identity'` (default) plots rows
702
+ * as-is; `'count'` tallies observations per x; `stat.mean()` collapses to a single mean-of-`y` observation
703
+ * (average line); `stat.smooth({ method })` fits a regression curve (trendline).
704
+ * @default 'identity'
705
+ */
514
706
  stat?: StatName | StatInput;
707
+ /**
708
+ * How sibling marks sharing an x position are arranged. `'identity'` overlaps them; `'stack'` stacks by
709
+ * `color`; `'dodge'` places them side by side; `'fill'` stacks then normalises each column to 100% (also
710
+ * the basis of pie/donut under `coord.polar`). Default is per-geom: `area` → `'stack'`, `bar` → `'dodge'`,
711
+ * `point`/`line`/`rule` → `'identity'`.
712
+ */
515
713
  position?: PositionType;
714
+ /**
715
+ * Which Y axis this layer binds to. `'secondary'` puts it on the right-hand axis for dual-axis combos
716
+ * (pair with `scale.ySecondary()`); the layer still maps to the `y` channel.
717
+ * @default 'primary'
718
+ */
516
719
  yScaleType?: YScaleType;
720
+ /** Geom-specific render knobs — static styling only (widths, colors, interpolation), never data channels. */
517
721
  params?: Partial<T>;
722
+ /**
723
+ * Ordered transforms applied to this layer's view of the data, on top of the spec-level transforms. Use
724
+ * when this geom needs a different data shape than its siblings.
725
+ */
518
726
  transforms?: TransformInput[];
727
+ /**
728
+ * When `false`, the layer is excluded from hover hit-detection — set it on non-data overlays like
729
+ * average and trend lines so they don't steal the tooltip. Defaults to `true` for all geoms except `rule`,
730
+ * which defaults to `false`.
731
+ */
519
732
  interactive?: boolean;
733
+ /** Per-observation value labels drawn on the marks. Off by default; see {@link DataLabelsInput}. */
520
734
  dataLabels?: DataLabelsInput;
521
735
  }
522
736
 
@@ -851,6 +1065,17 @@ export declare interface CommandApplyResult {
851
1065
  readonly revert: Command;
852
1066
  }
853
1067
 
1068
+ /**
1069
+ * Descriptor that knows how to deserialize a specific command type.
1070
+ * Each concrete command co-locates its descriptor alongside the command class.
1071
+ *
1072
+ * Serialization is handled uniformly by the registry via `Command.params`.
1073
+ */
1074
+ declare interface CommandDescriptor<TParams extends Record<string, unknown> = Record<string, unknown>> {
1075
+ readonly type: string;
1076
+ deserialize: (params: TParams, metadata: CommandMetadata) => Command;
1077
+ }
1078
+
854
1079
  /**
855
1080
  * Unique identifier for commands.
856
1081
  */
@@ -870,6 +1095,33 @@ export declare interface CommandMetadata {
870
1095
  readonly author: string;
871
1096
  }
872
1097
 
1098
+ /**
1099
+ * Central registry mapping command types to their serialization descriptors.
1100
+ */
1101
+ export declare class CommandRegistry {
1102
+ private readonly descriptors;
1103
+ /**
1104
+ * Register a command descriptor. Throws if the type is already registered.
1105
+ */
1106
+ register<TParams extends Record<string, unknown>>(descriptor: CommandDescriptor<TParams>): void;
1107
+ /**
1108
+ * Serialize a command to its wire format.
1109
+ */
1110
+ serialize(command: Command): SerializedCommand;
1111
+ /**
1112
+ * Deserialize a command from its wire format.
1113
+ */
1114
+ deserialize(data: SerializedCommand): Command;
1115
+ /**
1116
+ * Get all registered command type names.
1117
+ */
1118
+ getRegisteredTypes(): string[];
1119
+ private getDescriptor;
1120
+ }
1121
+
1122
+ /** Default singleton registry instance. */
1123
+ export declare const commandRegistry: CommandRegistry;
1124
+
873
1125
  /**
874
1126
  * Event types emitted by CommandStackManager.
875
1127
  */
@@ -989,6 +1241,9 @@ export declare interface CommandStackSnapshot {
989
1241
  * Comment annotation: a marker dot pinned to a single observation, carrying
990
1242
  * rich-text content. The renderer's mini view shows a truncated comment; hover
991
1243
  * reveals the full text.
1244
+ *
1245
+ * NO PAINTER in `@graphysdk/react-renderer` — this compiles but never draws there (it renders only in
1246
+ * the editor's legacy engine). Don't reach for it when authoring for the React renderer.
992
1247
  */
993
1248
  declare interface CommentAnnotationInput {
994
1249
  id?: string;
@@ -996,6 +1251,7 @@ declare interface CommentAnnotationInput {
996
1251
  content: RichTextContent;
997
1252
  }
998
1253
 
1254
+ /** Resolved form of {@link CommentAnnotationInput} — defaults applied, anchor normalised. */
999
1255
  declare interface CommentAnnotationSpec {
1000
1256
  id: string;
1001
1257
  anchor: ObservationAnchor;
@@ -1114,10 +1370,25 @@ export declare interface CompiledFreeformArrow {
1114
1370
  hasStickerStyle: boolean;
1115
1371
  }
1116
1372
 
1373
+ /**
1374
+ * What {@link Geom.compile} returns — the reparameterised data plus any mapping the geom injects.
1375
+ * Everything here must be JSON-serialisable (it rides in the compiled spec): emit data columns and
1376
+ * plain mapping values only — no closures, no class instances.
1377
+ */
1117
1378
  export declare interface CompiledGeom {
1118
- /** The reparameterized dataset (may have new computed variables) */
1379
+ /**
1380
+ * The reparameterised dataset: the input dataset with the position columns the mark owns added. Write
1381
+ * each through `variableFor(axis, role | name)` — never a literal column string like `'yMin'` — so the
1382
+ * value readers and the coord projection find them. A geom writes only the columns it owns; the mapper
1383
+ * scales any `scalar` channel that declares an `aes` source in place from the author's mapping.
1384
+ */
1119
1385
  data: Dataset;
1120
- /** Any mapping overrides produced by the geom */
1386
+ /**
1387
+ * Mapping overrides the geom injects, merged over the layer's mapping. The common case is attaching a
1388
+ * scale a mark needs but the author never mapped — e.g. injecting `{ y: { variable } }` so a price
1389
+ * scale forms for an OHLC mark whose extent comes from a y-interval. Return `{}` to inject nothing;
1390
+ * never echo the author's own aesthetics back here.
1391
+ */
1121
1392
  mapping: AesMapping;
1122
1393
  /**
1123
1394
  * Extra single-observation tooltip rows this geom contributes (e.g. OHLC). The compiler derives
@@ -1555,7 +1826,37 @@ declare interface ComputeFreeformArrowParams {
1555
1826
  }
1556
1827
 
1557
1828
  /**
1558
- * Create a custom configuration
1829
+ * Pipeable spec item carrying chart-level configuration. Every group is
1830
+ * optional; only the keys you set override the resolved defaults. Accepts:
1831
+ *
1832
+ * - `content`: titles and attribution — `title` / `subtitle` / `caption`
1833
+ * (each a {@link TextContent}) plus `source` ({@link SourceContent}), each
1834
+ * paired with an `isXVisible` toggle.
1835
+ * - `legend`: `{ position }` — see {@link LegendPosition}.
1836
+ * - `axes`: per-axis `{ x, y, ySecondary }` overrides, e.g. `{ label }`.
1837
+ * - `numberFormat`: chart-wide number formatting — see {@link NumberFormatConfig}.
1838
+ * - `headline`: big-number summary figure — `show` / `compareWith` / `size` /
1839
+ * `position` (see {@link HeadlineShow}, highlights-headlines.md).
1840
+ * - `appearance`: render-only styling — `textScale`, `highlightStyle`,
1841
+ * `background`, `border`, `cornerRadius` (see {@link AppearanceSpec}).
1842
+ *
1843
+ * @example
1844
+ * import { pipe, createSpec, geom, scale, config } from '@graphysdk/viz-engine';
1845
+ *
1846
+ * pipe(
1847
+ * createSpec({ x: 'quarter', y: 'revenue', color: 'region' }),
1848
+ * geom.bar({ position: 'stack' }),
1849
+ * scale.x(),
1850
+ * scale.y(),
1851
+ * config({
1852
+ * content: { title: 'Quarterly revenue by region', source: { label: 'Finance', url: 'https://…' } },
1853
+ * legend: { position: 'top' },
1854
+ * axes: { y: { label: 'Revenue ($)' } },
1855
+ * numberFormat: { decimals: 0, abbreviation: 'auto', prefix: '$' },
1856
+ * headline: { show: 'total' },
1857
+ * appearance: { highlightStyle: 'dim' },
1858
+ * })
1859
+ * );
1559
1860
  */
1560
1861
  export declare function config(options: ConfigInput): ConfigItem;
1561
1862
 
@@ -1572,6 +1873,10 @@ declare interface ConfigCompilerInput {
1572
1873
  scales: CompiledScales;
1573
1874
  }
1574
1875
 
1876
+ /**
1877
+ * Author-facing argument to `config(...)`: a deep-partial of {@link ConfigSpec}.
1878
+ * Any omitted group or field falls back to its resolved default.
1879
+ */
1575
1880
  declare type ConfigInput = Omit<DeepPartial<ConfigSpec>, 'legend' | 'content'> & {
1576
1881
  legend?: LegendConfigInput;
1577
1882
  content?: ContentInput;
@@ -1586,8 +1891,9 @@ declare interface ConfigItem {
1586
1891
  }
1587
1892
 
1588
1893
  /**
1589
- * Feature configuration with resolved defaults.
1590
- * All fields are required and always populated after resolution.
1894
+ * Fully-resolved chart configuration: every group present with defaults
1895
+ * applied. This is the shape carried on a compiled spec; authors pass the
1896
+ * partial {@link ConfigInput} to `config(...)` instead.
1591
1897
  */
1592
1898
  export declare interface ConfigSpec {
1593
1899
  parsingLocale: Locale;
@@ -1624,15 +1930,20 @@ declare interface ConstantMappingCompilerOutput {
1624
1930
  /***************************************************************
1625
1931
  * Constant Transform
1626
1932
  ***************************************************************/
1933
+ /**
1934
+ * Options for `transform.constant` — adds a new variable with the same value on every observation.
1935
+ * Useful to synthesize a constant axis or a single-category grouping variable.
1936
+ */
1627
1937
  declare interface ConstantOptions {
1628
- /** The name of the new variable. */
1938
+ /** Name of the new variable to add. */
1629
1939
  variableName: VariableName;
1630
- /** The type of the new variable. */
1940
+ /** Data type of the new variable. */
1631
1941
  type: DataType;
1632
- /** The constant value to assign to every observation. */
1942
+ /** The constant value assigned to every observation. */
1633
1943
  value: DataValue;
1634
1944
  }
1635
1945
 
1946
+ /** Add-a-constant-column transform produced by `transform.constant`. */
1636
1947
  declare interface ConstantTransformInput {
1637
1948
  type: 'transform';
1638
1949
  transformType: 'constant';
@@ -1662,17 +1973,29 @@ declare interface Content {
1662
1973
  * hide cycles without losing the text the user typed.
1663
1974
  */
1664
1975
  export declare interface ContentConfig {
1976
+ /** Main chart title. `null` = unset. */
1665
1977
  title: TextContent | null;
1978
+ /** @default true */
1666
1979
  isTitleVisible: boolean;
1980
+ /** Secondary line shown under the title. `null` = unset. */
1667
1981
  subtitle: TextContent | null;
1982
+ /** @default true */
1668
1983
  isSubtitleVisible: boolean;
1984
+ /** Explanatory note shown below the plot. `null` = unset. */
1669
1985
  caption: TextContent | null;
1986
+ /** @default false */
1670
1987
  isCaptionVisible: boolean;
1988
+ /** Data-source attribution shown under the caption. `null` = unset. */
1671
1989
  source: SourceContent | null;
1990
+ /** @default false */
1672
1991
  isSourceVisible: boolean;
1673
1992
  }
1674
1993
 
1675
- /** Content input — all fields optional. */
1994
+ /**
1995
+ * Author-facing `content` argument to `config(...)`: all fields optional.
1996
+ * Setting a text slot does not show it unless the matching `isXVisible` flag is
1997
+ * also true (title and subtitle default visible; caption and source default hidden).
1998
+ */
1676
1999
  declare type ContentInput = Partial<ContentConfig>;
1677
2000
 
1678
2001
  declare type ContinuousScaleInput = {
@@ -1758,27 +2081,60 @@ declare type ContinuousScaleSpec = Required<ContinuousScaleInput>;
1758
2081
  */
1759
2082
  export declare function convertSpecToInput(spec: Spec): SpecInput;
1760
2083
 
2084
+ /**
2085
+ * Coordinate-system builder. A coord is a geom-agnostic projection applied AFTER scaling
2086
+ * that remaps the already-scaled `[0,1]` positions of any geom; it changes neither the data,
2087
+ * the scales, nor the chart's tier. Pipe at most one onto a spec — cartesian is assumed when
2088
+ * none is given.
2089
+ *
2090
+ * - `cartesian` — standard x→horizontal, y→vertical (the default).
2091
+ * - `flip` — swaps the x and y axes; the idiom for horizontal bars and long category labels.
2092
+ * - `polar` — wraps x/y around a centre; `theta` selects the angle aesthetic and the other
2093
+ * becomes the radius. The basis for pie, donut, and radar charts.
2094
+ *
2095
+ * @example
2096
+ * import { pipe, createSpec, geom, scale, coord } from '@graphysdk/viz-engine';
2097
+ *
2098
+ * // Donut: stacked value → angle, innerRadius > 0 carves the hole
2099
+ * pipe(
2100
+ * createSpec({ x: '', y: 'spend', color: 'department' }),
2101
+ * geom.bar({ position: 'fill' }),
2102
+ * coord.polar({ theta: 'y', innerRadius: 0.55 }),
2103
+ * scale.x(),
2104
+ * scale.y(),
2105
+ * scale.color.palette()
2106
+ * );
2107
+ */
1761
2108
  export declare const coord: {
1762
2109
  /**
1763
- * Standard cartesian (x-y) coordinate system. This is the default if no coord is specified.
2110
+ * Standard cartesian (x→horizontal, y→vertical) coordinate system. This is the default
2111
+ * when no coord is piped onto the spec; declare it explicitly only to set axis limits.
1764
2112
  *
1765
2113
  * @example coord.cartesian() // auto-scaled axes
1766
- * @example coord.cartesian({ yLimits: [0, 100] }) // fixed y-axis
2114
+ * @example coord.cartesian({ yLimits: [0, 100] }) // fixed y-axis range
1767
2115
  */
1768
2116
  cartesian: (params?: Partial<CartesianCoordParams>) => CartesianCoordInput;
1769
2117
  /**
1770
- * Flipped cartesian coordinates — swaps x and y axes.
1771
- * Useful for horizontal bar charts or when category labels are long.
2118
+ * Flipped cartesian coordinates — swaps the x and y axes so the x aesthetic runs
2119
+ * vertically and y runs horizontally. The idiom for horizontal bar charts and for
2120
+ * long category labels. The mapping stays the same; only the on-screen orientation flips.
1772
2121
  *
1773
- * @example coord.flip() // horizontal bars
2122
+ * @example coord.flip() // horizontal bars from a vertical-bar spec
1774
2123
  */
1775
2124
  flip: (params?: Partial<FlipCoordParams>) => FlipCoordInput;
1776
2125
  /**
1777
- * Polar coordinate system — maps data to angle (theta) and radius.
1778
- * Used for pie charts, donut charts, and radar/radial visualizations.
2126
+ * Polar coordinate system — wraps the scaled positions around a centre, mapping one
2127
+ * aesthetic to the angle (theta) and the other to the radius (scaled into
2128
+ * `[innerRadius, 1]`). `theta` defaults to `'x'`.
2129
+ *
2130
+ * - Pie / donut: `geom.bar({ position: 'fill' })` with `theta: 'y'` (stacked value → angle);
2131
+ * set `innerRadius > 0` for a donut.
2132
+ * - Radar / spider: `geom.line` or `geom.point` with `theta: 'x'` over a discrete x axis
2133
+ * (one evenly-spaced spoke per category).
1779
2134
  *
1780
- * @example coord.polar() // pie chart
1781
- * @example coord.polar({ innerRadius: 0.5 }) // donut chart
2135
+ * @example coord.polar({ theta: 'y' }) // pie: stacked value → angle
2136
+ * @example coord.polar({ theta: 'y', innerRadius: 0.5, startAngle: 90 }) // donut rotated 90°
2137
+ * @example coord.polar({ theta: 'x' }) // radar: category → spoke angle
1782
2138
  */
1783
2139
  polar: (params?: Partial<PolarCoordParams>) => PolarCoordInput;
1784
2140
  };
@@ -1797,7 +2153,10 @@ declare class CoordCompiler {
1797
2153
  }
1798
2154
 
1799
2155
  /**
1800
- * Discriminated union of all coordinate input specs (user-provided, optional params).
2156
+ * A coordinate system produced by the `coord` builder, before resolution.
2157
+ * A coord is a geom-agnostic projection applied AFTER scaling: it remaps the already-scaled
2158
+ * `[0,1]` positions of any geom without touching the data, the scales, or the chart's tier.
2159
+ * One coord per spec; defaults to cartesian when none is piped on.
1801
2160
  */
1802
2161
  declare type CoordInput = CartesianCoordInput | FlipCoordInput | PolarCoordInput;
1803
2162
 
@@ -1821,7 +2180,7 @@ declare type CoordSetupResult = {
1821
2180
  };
1822
2181
 
1823
2182
  /**
1824
- * Discriminated union of all resolved coordinate specs (params fully defaulted).
2183
+ * A fully resolved coordinate system (params defaulted) as it appears on the compiled spec.
1825
2184
  */
1826
2185
  declare type CoordSpec = CartesianCoordSpec | FlipCoordSpec | PolarCoordSpec;
1827
2186
 
@@ -1879,6 +2238,18 @@ export declare const createAlphaValueReader: (data: Dataset, mapping: AesMapping
1879
2238
 
1880
2239
  export declare const createColorValueReader: (data: Dataset, mapping: AesMapping) => (observation: Observation) => DataValue;
1881
2240
 
2241
+ /**
2242
+ * Create command metadata with defaults.
2243
+ */
2244
+ export declare function createCommandMetadata(options: CreateCommandMetadataOptions): CommandMetadata;
2245
+
2246
+ declare interface CreateCommandMetadataOptions {
2247
+ id?: string;
2248
+ timestamp?: number;
2249
+ description: string;
2250
+ author?: string;
2251
+ }
2252
+
1882
2253
  /**
1883
2254
  * Builds a compiler instance. Pass `geoms` to register custom (or override built-in) geom
1884
2255
  * definitions per-instance — there is no global registry to mutate, so injected geoms never bleed
@@ -1896,19 +2267,19 @@ export declare function createEmptyHighlight(strategy: HighlightStrategy | null)
1896
2267
 
1897
2268
  /**
1898
2269
  * Builds a Graphy authoring surface for a set of custom geoms and/or annotations: a `geom` builder that
1899
- * merges the built-in methods with one method per registered custom geom, an `annotation` builder with
1900
- * one method per registered annotation kind, plus the standard `createSpec`. The 90% case stays the
1901
- * plain `import { geom, createSpec }`; reach for this only when authoring custom geoms (decision 8) or
1902
- * custom annotations (ADR-035). Registration is per-instance — geoms are injected to
1903
- * `createCompiler({ geoms })`; annotations need no compile-side registry (coordinate resolution is
1904
- * generic), only the render plugin via `<GraphProvider annotationPlugins={[...]}>`.
2270
+ * merges the built-in methods with one method per registered custom geom, an `annotation` builder that
2271
+ * merges the built-in kinds with one method per registered annotation kind, plus the standard
2272
+ * `createSpec`. The 90% case stays the plain `import { geom, annotation, createSpec }`; reach for this only
2273
+ * when authoring custom geoms (decision 8) or custom annotations (ADR-035). Registration is per-instance —
2274
+ * geoms are injected to `createCompiler({ geoms })`; annotations need no compile-side registry (coordinate
2275
+ * resolution is generic), only the render plugin via `<GraphProvider annotationPlugins={[...]}>`.
1905
2276
  */
1906
2277
  export declare function createGraphyBuilder<const Geoms extends readonly Geom[] = readonly [], const Annotations extends readonly AnnotationDef[] = readonly []>(options: {
1907
2278
  geoms?: Geoms;
1908
2279
  annotations?: Annotations;
1909
2280
  }): {
1910
2281
  geom: typeof geom & CustomGeomBuilders<Geoms>;
1911
- annotation: CustomAnnotationBuilders<Annotations>;
2282
+ annotation: typeof annotation & CustomAnnotationBuilders<Annotations>;
1912
2283
  createSpec: typeof createSpec;
1913
2284
  };
1914
2285
 
@@ -1935,20 +2306,32 @@ export declare function createSegmentYReader(layer: CompiledLayer): (observation
1935
2306
  export declare const createSizeValueReader: (data: Dataset, mapping: AesMapping) => (observation: Observation) => DataValue;
1936
2307
 
1937
2308
  /**
1938
- * Create a new spec, optionally piping spec items in one call. Data is passed separately
1939
- * to {@link compile}.
2309
+ * Seed a spec the entry point for every chart. The first argument may be a bare {@link AesMapping}
2310
+ * (`{ x, y, color, ... }`), which becomes the spec's global aesthetic mapping; any further arguments are
2311
+ * pipeable spec items (geoms, scales, coords, transforms, config, ...) folded on in order. Data is supplied
2312
+ * separately to `compile` / `<GraphProvider data>`.
2313
+ *
2314
+ * This is the builder pattern: `createSpec` seeds the mapping, then `pipe` (or extra args here) folds each
2315
+ * item onto an immutable spec, accumulating layers/scales/etc. Always declare `scale.x()` / `scale.y()` for
2316
+ * any position channel — they are NOT auto-inferred and yield NaN positions if omitted.
1940
2317
  *
1941
2318
  * @example
1942
- * When the first arg is a mapping:
1943
- * createSpec({ x: 'date', y: 'value' })
2319
+ * import { createSpec, pipe, geom, scale } from '@graphysdk/viz-engine';
1944
2320
  *
1945
- * When piping spec items (more readable when chaining transforms):
1946
- * createSpec(
1947
- * transform.reshape({ reshape: ['revenue'], keyName: 'metric', valueName: 'amount' }),
1948
- * mapping({ x: 'month', y: 'amount', color: 'metric' }),
1949
- * geom.bar(),
1950
- * scale.x(),
1951
- * )
2321
+ * // Most common: mapping first, then pipe the rest.
2322
+ * const spec = pipe(createSpec({ x: 'category', y: 'revenue' }), geom.bar(), scale.x(), scale.y());
2323
+ *
2324
+ * @example
2325
+ * import { createSpec, transform, mapping, geom, scale } from '@graphysdk/viz-engine';
2326
+ *
2327
+ * // All-in-one form, clearer when a transform must run before the mapping is read.
2328
+ * const spec = createSpec(
2329
+ * transform.reshape({ reshape: ['revenue'], keyName: 'metric', valueName: 'amount' }),
2330
+ * mapping({ x: 'month', y: 'amount', color: 'metric' }),
2331
+ * geom.bar(),
2332
+ * scale.x(),
2333
+ * scale.y(),
2334
+ * );
1952
2335
  */
1953
2336
  export declare function createSpec(...items: Array<AesMapping | SpecItem>): SpecInput;
1954
2337
 
@@ -2002,6 +2385,7 @@ declare interface CustomAnnotationOptions<TParams extends object> {
2002
2385
  id?: string;
2003
2386
  }
2004
2387
 
2388
+ /** Resolved form of {@link CustomAnnotationInput} — params defaulted to `{}`, coordinates resolved. */
2005
2389
  export declare interface CustomAnnotationSpec {
2006
2390
  id: string;
2007
2391
  type: string;
@@ -2065,12 +2449,13 @@ declare type CustomPaletteInput = {
2065
2449
  export declare type CustomPalettesInput = Record<string, string[]>;
2066
2450
 
2067
2451
  /**
2068
- * Data to visualize. Structured as a table.
2452
+ * The raw input dataset to visualize, structured as a table of `columns` + `rows`. This is what you
2453
+ * hand to the compiler and to `<GraphProvider data>` — the untransformed, pre-compile shape, distinct
2454
+ * from the per-observation {@link Observation} records a geom reads after compilation.
2069
2455
  *
2070
- * The public-API contract. Row values must be {@link DataValue} (string, number,
2071
- * Date, or null). Internal entry points (e.g. the dataset parser) accept a
2072
- * looser row type — see {@link RawData} — because they must defensively handle
2073
- * malformed input.
2456
+ * The public-API contract: row values must be {@link DataValue} (string, number, Date, or null).
2457
+ * Internal entry points (e.g. the dataset parser) accept a looser row type — see {@link RawData} —
2458
+ * because they must defensively handle malformed input.
2074
2459
  */
2075
2460
  export declare interface Data {
2076
2461
  /**
@@ -2158,6 +2543,11 @@ export declare interface DataLabelsContent {
2158
2543
  labels: PlacedDataLabel[];
2159
2544
  }
2160
2545
 
2546
+ /**
2547
+ * User-facing data-labels options for a layer (`geom.x({ dataLabels })`). A partial of {@link DataLabelsConfig}
2548
+ * minus `labelSource` (the label source is derived from the geom, not set here); unset fields fall back to the
2549
+ * config defaults. Set `{ showDataLabels: true }` to turn labels on.
2550
+ */
2161
2551
  export declare type DataLabelsInput = DeepPartial<Omit<DataLabelsConfig, 'labelSource'>>;
2162
2552
 
2163
2553
  /**
@@ -2181,6 +2571,10 @@ export declare type DataLabelTextMeasurer = (kind: DataLabelKind, text: string)
2181
2571
  *
2182
2572
  * All transformation methods (filter, orderBy, addVariable etc.) return a new instance.
2183
2573
  *
2574
+ * In a geom, this is what a `compile()` half reparameterises (e.g. `addVariable` to write computed
2575
+ * columns) and what a render half receives as `layer.data` — iterate it (or `groupBy` it) to walk the
2576
+ * compiled {@link Observation}s and read each mark's positions with the value readers.
2577
+ *
2184
2578
  * @example
2185
2579
  * const data = new Dataset({
2186
2580
  * age: { type: 'numeric', values: [25, 30, 35, null] },
@@ -2472,6 +2866,10 @@ declare type DefaultPaletteConfig = {
2472
2866
  };
2473
2867
 
2474
2868
  /**
2869
+ * Declares the compile-half of a custom annotation kind: its `type` name, `defaultParams`, and optional
2870
+ * coordinate `arity`. There is no compile logic here — coordinate resolution is generic — so this only
2871
+ * exists to type and register the kind.
2872
+ *
2475
2873
  * `TType` is a `const` type parameter so the literal kind name (`'calloutBox'`) survives to the type
2476
2874
  * level — the registration-typed builder keys `annotation.<kind>(...)` off it, the same way
2477
2875
  * `createGraphyBuilder` captures a geom's name. `TParams` is recovered from `defaultParams`; annotate or
@@ -2509,25 +2907,34 @@ declare interface DifferenceArrowDimensions {
2509
2907
  }
2510
2908
 
2511
2909
  /**
2512
- * User-facing difference-arrow input. `size`, `color` and `labelCrossPosition`
2513
- * are defaulted by the resolver.
2910
+ * A labelled delta drawn between two data observations — the only built-in annotation that anchors to
2911
+ * DATA. Both endpoints are observation anchors (main-axis value + series), so the arrow snaps to the
2912
+ * dataset and survives resize. Only drawn under a cartesian coordinate system. `size`, `color` and
2913
+ * `labelCrossPosition` are defaulted by the resolver.
2514
2914
  */
2515
2915
  export declare interface DifferenceArrowInput {
2516
2916
  id?: string;
2917
+ /** Observation the arrow starts from. */
2517
2918
  start: ObservationAnchorInput;
2919
+ /** Observation the arrow points to. */
2518
2920
  end: ObservationAnchorInput;
2921
+ /** Which delta the label reports. */
2519
2922
  label: DifferenceArrowLabelKind;
2923
+ /** Arrow colour; `null`/omitted falls back to the theme default. @default null */
2520
2924
  color?: string | null;
2925
+ /** @default 'small' */
2521
2926
  size?: DifferenceArrowSize;
2927
+ /** Where the label sits along the arrow's cross-axis, as a `[0,1]` fraction. @default 0.5 */
2522
2928
  labelCrossPosition?: number;
2523
2929
  }
2524
2930
 
2931
+ /** What the arrow's label reports about the `start → end` delta. */
2525
2932
  export declare type DifferenceArrowLabelKind = 'absolute-difference' | 'relative-difference' | 'proportion';
2526
2933
 
2527
2934
  export declare type DifferenceArrowSize = 'small' | 'medium' | 'large';
2528
2935
 
2529
2936
  /**
2530
- * Resolved difference-arrow spec with all optional fields defaulted.
2937
+ * Resolved form of {@link DifferenceArrowInput} defaults applied, anchors normalised.
2531
2938
  */
2532
2939
  export declare interface DifferenceArrowSpec {
2533
2940
  id: string;
@@ -2619,15 +3026,19 @@ declare function filter(options: FilterOptions): FilterTransformInput;
2619
3026
  /***************************************************************
2620
3027
  * Filter Transform
2621
3028
  ***************************************************************/
3029
+ /**
3030
+ * Options for `transform.filter` — keeps only observations where `variableName <operator> value`.
3031
+ */
2622
3032
  declare interface FilterOptions {
2623
3033
  /** The variable to filter on. */
2624
3034
  variableName: VariableName;
2625
- /** The comparison operator. */
3035
+ /** Comparison operator: `'eq'` | `'neq'` | `'gt'` | `'gte'` | `'lt'` | `'lte'`. */
2626
3036
  operator: ComparisonOperator;
2627
- /** The value to compare against. */
3037
+ /** The value to compare each observation's `variableName` against. */
2628
3038
  value: DataValue;
2629
3039
  }
2630
3040
 
3041
+ /** Row-filtering transform produced by `transform.filter`. */
2631
3042
  declare interface FilterTransformInput {
2632
3043
  type: 'transform';
2633
3044
  transformType: 'filter';
@@ -2784,23 +3195,31 @@ export declare interface FormattedPerGroupHeadline {
2784
3195
  }
2785
3196
 
2786
3197
  /**
2787
- * Freeform arrow annotation. Endpoints sit in plot-fractional coordinates
2788
- * (0..1), so they re-flow with panel size. Distinct from
2789
- * {@link DifferenceArrowInput}, which anchors to dataset observations.
3198
+ * A free-standing arrow pointing at something on the panel. Both endpoints sit in panel fractions
3199
+ * (`[0,1]`, top-left origin), so they re-flow with panel size but do NOT snap to a data point. Distinct
3200
+ * from {@link DifferenceArrowInput}, which anchors to dataset observations.
2790
3201
  */
2791
3202
  export declare interface FreeformArrowInput {
2792
3203
  id?: string;
3204
+ /** Tail endpoint. */
2793
3205
  start: ArrowEndpoint;
3206
+ /** Head endpoint (the end pointed at). */
2794
3207
  end: ArrowEndpoint;
2795
- /** null falls back to the theme `defaultAnnotationArrowStroke`. */
3208
+ /** `null` falls back to the theme `defaultAnnotationArrowStroke`. @default null */
2796
3209
  color?: string | null;
3210
+ /** @default 'medium' */
2797
3211
  thickness?: ArrowThickness;
3212
+ /** Arrowhead at the `start` (tail) endpoint. @default 'none' */
2798
3213
  startArrowheadStyle?: ArrowheadStyle;
3214
+ /** Arrowhead at the `end` (head) endpoint. @default 'line-arrow' */
2799
3215
  endArrowheadStyle?: ArrowheadStyle;
3216
+ /** @default 'solid' */
2800
3217
  lineStyle?: ArrowLineStyle;
3218
+ /** Apply the editor's hand-drawn "sticker" styling. @default false */
2801
3219
  hasStickerStyle?: boolean;
2802
3220
  }
2803
3221
 
3222
+ /** Resolved form of {@link FreeformArrowInput} — defaults applied. */
2804
3223
  export declare interface FreeformArrowSpec {
2805
3224
  id: string;
2806
3225
  start: ArrowEndpoint;
@@ -2945,6 +3364,25 @@ export declare abstract class Geom<TParams extends object = object> {
2945
3364
  validateMapping?(input: GeomMappingValidationInput): ValidationIssue[];
2946
3365
  }
2947
3366
 
3367
+ /**
3368
+ * The built-in geom builders. Each is called with one {@link BaseGeomOptions} object and returns a pipeable
3369
+ * layer that `pipe`/`createSpec` folds onto the spec. Compose several to layer marks (e.g. bars + a trend
3370
+ * line). The five marks: `point` (scatter/bubble), `line`, `area`, `bar` (also pie/donut in polar), and
3371
+ * `rule` (a constant or data-driven reference line).
3372
+ *
3373
+ * @example
3374
+ * import { createSpec, pipe, geom, scale, config } from '@graphysdk/viz-engine';
3375
+ *
3376
+ * // Multi-series line; mapping `color` to a column splits series and adds a legend.
3377
+ * const spec = pipe(
3378
+ * createSpec({ x: 'month', y: 'sales', color: 'region' }),
3379
+ * geom.line(),
3380
+ * scale.x(),
3381
+ * scale.y(),
3382
+ * scale.color.palette(),
3383
+ * config({ legend: { position: 'top' } }),
3384
+ * );
3385
+ */
2948
3386
  export declare const geom: {
2949
3387
  point: typeof point;
2950
3388
  line: typeof line;
@@ -3004,12 +3442,31 @@ declare class GeomCompiler {
3004
3442
  resolveAnchorPosition(geomName: GeomIdentity, observation: Observation, coordSystem: CoordSystem): AnchorPosition | null;
3005
3443
  }
3006
3444
 
3445
+ /**
3446
+ * What {@link Geom.compile} receives. The geom reads these to compute its mark geometry and returns a
3447
+ * {@link CompiledGeom}. The pipeline has already run the layer's stat and resolved its aesthetics, so
3448
+ * `compile` sees finished input and only reparameterises it.
3449
+ */
3007
3450
  export declare interface GeomCompilerInput {
3008
- /** The dataset after stat transformation */
3451
+ /**
3452
+ * The dataset after stat transformation — one row per observation, columnar. Read a mapped channel's
3453
+ * column with `extractVariableName(mapping[channel])`, then `data.getValues(column, { type })`; write
3454
+ * computed columns with `data.addVariable` / `data.addConstantVariable` (each returns a new dataset —
3455
+ * the Dataset is immutable).
3456
+ */
3009
3457
  data: Dataset;
3010
- /** The effective mapping for the layer */
3458
+ /**
3459
+ * The effective mapping for the layer: which data column (or constant) backs each aesthetic the author
3460
+ * declared. The source of every channel column the geom reads — including the custom `aes` channels in
3461
+ * {@link Geom.requiredAesthetics} (an OHLC `open`, a box plot `q1`). Read a custom channel with
3462
+ * `readAesthetic(mapping, channel)`.
3463
+ */
3011
3464
  mapping: AesMapping;
3012
- /** Geom-specific params */
3465
+ /**
3466
+ * The geom's static params, already merged over {@link Geom.defaultParams} by the builder. Render
3467
+ * configuration only (widths, radii, colours) — never data columns that bind to a scale, which belong
3468
+ * in `aes`. Typed as the geom's `TParams` at the call site.
3469
+ */
3013
3470
  params: LayerSpec['params'];
3014
3471
  }
3015
3472
 
@@ -3079,12 +3536,27 @@ export declare interface GeomTooltipRow {
3079
3536
  variable: VariableName;
3080
3537
  }
3081
3538
 
3082
- /** Reads the resolved alpha (opacity) value from an observation. */
3539
+ /**
3540
+ * Reads the observation's resolved opacity in `[0,1]` (0 = transparent, 1 = opaque) — pass straight to
3541
+ * `fillOpacity`/`opacity`. The `alpha` aesthetic mapped through its scale. `null` when no `alpha`
3542
+ * aesthetic is mapped.
3543
+ */
3083
3544
  export declare function getAlpha(observation: Observation): NumericDataValue;
3084
3545
 
3546
+ /**
3547
+ * Reads a polar observation's angular extent — the x interval projected to angles. Use it to draw the
3548
+ * wedge of a pie/donut slice or polar bar; pair with {@link getRadiusExtent} for the radial span.
3549
+ * `startAngle`/`endAngle` are in **radians** (0 = straight up, increasing clockwise). The compiler has
3550
+ * already projected the x interval under `coord.polar()`, so no manual angle math is needed.
3551
+ */
3085
3552
  export declare function getAngleExtent(observation: Observation): AngleExtent;
3086
3553
 
3087
- /** Reads the resolved color string from an observation. */
3554
+ /**
3555
+ * Reads the observation's resolved fill/stroke colour as a paint-ready CSS colour string. The visual
3556
+ * mapper has already run the `color` aesthetic through the colour scale, so this is the final string to
3557
+ * hand to `fill`/`stroke` — no further lookup needed. `undefined` when the layer maps no `color`
3558
+ * aesthetic; supply your own series colour (e.g. via `useCategoricalColor`) in that case.
3559
+ */
3088
3560
  export declare function getColor(observation: Observation): string | undefined;
3089
3561
 
3090
3562
  /** Reads the coordinate lying on the cross axis of the coord system. */
@@ -3098,6 +3570,13 @@ export declare function getCrossAxisCoordinate(mainAxis: MainAxis, point: XYPoin
3098
3570
  */
3099
3571
  export declare const getDifferenceArrowDimensions: (size: DifferenceArrowSize, textScale: number) => DifferenceArrowDimensions;
3100
3572
 
3573
+ /**
3574
+ * Reads the observation's resolved series identity: the category the `group`/`color` aesthetic placed
3575
+ * it in, as a plain string. Use it to split a layer's observations into series (one polygon, line, or
3576
+ * colour per group) when painting. `null` when the layer maps no grouping aesthetic — a single,
3577
+ * ungrouped series. Reads the compiler-emitted `group` column, so the value survives any renaming of
3578
+ * the user's grouping mapping.
3579
+ */
3101
3580
  export declare const getGroup: (observation: Observation) => CategoricalDataValue;
3102
3581
 
3103
3582
  /**
@@ -3108,20 +3587,33 @@ export declare const getGroup: (observation: Observation) => CategoricalDataValu
3108
3587
  export declare const getIdentityKey: (observation: Observation) => string;
3109
3588
 
3110
3589
  /**
3111
- * Reads the resolved line type (stroke style) from an observation.
3112
- * Falls back to `'solid'` when no `lineType` variable was derived.
3590
+ * Reads the observation's resolved line style (`'solid'`, `'dashed'`, …) for use as a stroke pattern.
3591
+ * The `lineType` aesthetic mapped through its scale, falling back to `'solid'` when no `lineType`
3592
+ * aesthetic is mapped — so this reader, unlike the others, never returns `null`.
3113
3593
  */
3114
3594
  export declare function getLineType(observation: Observation): LineStyleType;
3115
3595
 
3116
3596
  /** Reads the coordinate lying on the main (independent) axis of the coord system. */
3117
3597
  export declare function getMainAxisCoordinate(mainAxis: MainAxis, point: XYPoint): number;
3118
3598
 
3599
+ /**
3600
+ * Reads a polar observation's radial extent — the y interval projected to radii. Use it with
3601
+ * {@link getAngleExtent} to draw a donut/polar-bar segment. `innerRadius`/`outerRadius` are in `[0,1]`
3602
+ * (0 = centre, 1 = outer ring); `outerRadius` falls back to the `point` y radius when the observation
3603
+ * carries no upper y endpoint (a pie slice, which has no inner cutout to oppose).
3604
+ */
3119
3605
  export declare function getRadiusExtent(observation: Observation): RadiusExtent;
3120
3606
 
3121
- /** Reads the resolved size value from an observation. */
3607
+ /**
3608
+ * Reads the observation's resolved size in **pixels** (e.g. a point's diameter or a mark's nominal
3609
+ * extent), already mapped through the `size` scale. `null` when no `size` aesthetic is mapped.
3610
+ */
3122
3611
  export declare function getSize(observation: Observation): NumericDataValue;
3123
3612
 
3124
- /** Reads the resolved stroke width value from an observation. */
3613
+ /**
3614
+ * Reads the observation's resolved stroke width in **pixels** — pass straight to `strokeWidth`. The
3615
+ * `strokeWidth` aesthetic mapped through its scale. `null` when no `strokeWidth` aesthetic is mapped.
3616
+ */
3125
3617
  export declare function getStrokeWidth(observation: Observation): NumericDataValue;
3126
3618
 
3127
3619
  declare interface GetValuesOptions {
@@ -3133,29 +3625,61 @@ declare interface GetValuesOptions {
3133
3625
  distinct?: boolean;
3134
3626
  }
3135
3627
 
3136
- /** Reads the normalized x position from an observation. */
3628
+ /**
3629
+ * Reads the observation's scaled x position: the value of the `point` x channel, already mapped
3630
+ * through the x scale to `[0,1]` of the panel width (0 = left edge, 1 = right edge). `null` when the
3631
+ * observation has no x position. Under `coord.polar({ theta: 'x' })` this returns the vertex **angle
3632
+ * in radians** instead (0 = straight up, increasing clockwise). The everyday position reader — pair
3633
+ * it with {@link getY} to place a point-anchored mark.
3634
+ */
3137
3635
  export declare function getX(observation: Observation): NumericDataValue;
3138
3636
 
3139
- /** Reads the normalized xMax (right band edge) from an observation. */
3637
+ /**
3638
+ * Reads the upper x endpoint of the observation's x interval, scaled to `[0,1]` of the panel width
3639
+ * (1 = right edge). The right edge of a band/bar or the end of a horizontal range bar. Pairs with
3640
+ * {@link getXMin}. `null` when the observation declares no x interval.
3641
+ */
3140
3642
  export declare function getXMax(observation: Observation): NumericDataValue;
3141
3643
 
3142
- /** Reads the normalized xMin (left band edge) from an observation. */
3644
+ /**
3645
+ * Reads the lower x endpoint of the observation's x interval, scaled to `[0,1]` of the panel width
3646
+ * (0 = left edge). The left edge of a band/bar, the start of a horizontal range bar, or a body's left
3647
+ * side. Pairs with {@link getXMax}; `getXMin`/`getXMax` preserve the values `compile()` wrote and are
3648
+ * never re-sorted, so `getXMin` can exceed `getXMax`. `null` when the observation declares no x interval.
3649
+ */
3143
3650
  export declare function getXMin(observation: Observation): NumericDataValue;
3144
3651
 
3145
- /** Reads the normalized y position from an observation. */
3652
+ /**
3653
+ * Reads the observation's scaled y position: the value of the `point` y channel, already mapped
3654
+ * through the y scale to `[0,1]` of the panel height with a **bottom origin** (0 = bottom, 1 = top).
3655
+ * SVG y grows downward, so paint with `1 - getY(...)`. `null` when the observation has no y position.
3656
+ * Under polar coords this returns the **radius in `[0,1]`** (0 = centre, 1 = outer ring). See
3657
+ * {@link getYRaw} to recover the pre-stack segment magnitude.
3658
+ */
3146
3659
  export declare function getY(observation: Observation): NumericDataValue;
3147
3660
 
3148
- /** Reads the normalized yMax (upper extent) from an observation. */
3661
+ /**
3662
+ * Reads the upper y endpoint of the observation's y interval, scaled to `[0,1]` of the panel height
3663
+ * with a **bottom origin** (1 = top; paint with `1 - getYMax(...)`). The bar top, the top of a
3664
+ * candlestick wick, or the end of a vertical range/gantt span. Pairs with {@link getYMin}.
3665
+ * `null` when the observation declares no y interval.
3666
+ */
3149
3667
  export declare function getYMax(observation: Observation): NumericDataValue;
3150
3668
 
3151
- /** Reads the normalized yMin (lower extent) from an observation. */
3669
+ /**
3670
+ * Reads the lower y endpoint of the observation's y interval, scaled to `[0,1]` of the panel height
3671
+ * with a **bottom origin** (0 = bottom; paint with `1 - getYMin(...)`). The bar baseline, the bottom of
3672
+ * a candlestick wick, or the start of a vertical range/gantt span. Pairs with {@link getYMax}; the pair
3673
+ * preserves the values `compile()` wrote and is never re-sorted, so `getYMin` can exceed `getYMax`.
3674
+ * `null` when the observation declares no y interval.
3675
+ */
3152
3676
  export declare function getYMin(observation: Observation): NumericDataValue;
3153
3677
 
3154
3678
  /**
3155
- * Reads the segment value written by stacking position adjusters.
3156
- *
3157
- * Survives theposition-mapper untouched, so renderers can recover original-unit values
3158
- * for stacked segments after `mapping.y` has been rewritten to the cumulative band top.
3679
+ * Reads the observation's pre-stack segment magnitude in **original data units** (not `[0,1]`).
3680
+ * Stacking position adjusters rewrite the mapped `y` to the cumulative band top and stash the segment's
3681
+ * own value here, so a renderer or data label can recover what the segment contributed before stacking.
3682
+ * `null` when the layer was not stacked (the column is written only when stacking along y).
3159
3683
  */
3160
3684
  export declare function getYRaw(observation: Observation): NumericDataValue;
3161
3685
 
@@ -3542,15 +4066,29 @@ export declare class HeuristicTextMeasurer implements TextMeasurer {
3542
4066
  }
3543
4067
 
3544
4068
  /**
3545
- * Create a pipeable highlight spec item.
4069
+ * Pipeable spec item that emphasises the observations matching `predicate` and
4070
+ * de-emphasises (dims or desaturates) everything else. Multiple `highlight(...)`
4071
+ * calls accumulate — their matches union. The de-emphasis style is chosen
4072
+ * separately via `config({ appearance: { highlightStyle: 'dim' | 'desaturate' } })`.
4073
+ *
4074
+ * @param predicate - which observations to emphasise (see {@link Predicate}).
4075
+ * @param options - `scope` ({@link HighlightScope}, default `'data-point'`),
4076
+ * `layerIndex` (target a single layer; omit to apply to all layers), and an
4077
+ * optional explicit `id`.
3546
4078
  *
3547
4079
  * @example
4080
+ * import { pipe, createSpec, geom, scale, highlight } from '@graphysdk/viz-engine';
4081
+ *
3548
4082
  * pipe(
3549
- * createSpec(data, { x: 'month', y: 'revenue', color: 'region' }),
4083
+ * createSpec({ x: 'month', y: 'revenue', color: 'region' }),
3550
4084
  * geom.bar(),
3551
- * highlight({ field: 'region', eq: 'EU' }),
3552
- * highlight({ field: 'region', eq: 'US' }, { scope: 'series' }),
3553
- * )
4085
+ * scale.x(),
4086
+ * scale.y(),
4087
+ * // emphasise one whole series; leave other layers untouched
4088
+ * highlight({ variable: 'region', eq: 'EU' }, { scope: 'series' }),
4089
+ * // and every observation at or above a threshold
4090
+ * highlight({ variable: 'revenue', gte: 2000 })
4091
+ * );
3554
4092
  */
3555
4093
  export declare function highlight(predicate: Predicate, options?: HighlightBuilderOptions): HighlightInput;
3556
4094
 
@@ -4169,8 +4707,9 @@ declare interface Legend {
4169
4707
  */
4170
4708
  declare interface LegendConfig {
4171
4709
  /**
4172
- * Position of the legend
4173
- * @default 'top'
4710
+ * Where the legend sits relative to the plot. See {@link LegendPosition} for the values;
4711
+ * `'auto'` lets the renderer pick based on chart type and series count.
4712
+ * @default 'auto'
4174
4713
  */
4175
4714
  position: LegendPosition;
4176
4715
  /**
@@ -4230,8 +4769,23 @@ declare interface LegendItemVisual {
4230
4769
  lineType?: LineStyleType;
4231
4770
  }
4232
4771
 
4772
+ /**
4773
+ * Where the legend sits relative to the plot, set via
4774
+ * `config({ legend: { position: … } })`.
4775
+ * - 'auto': let the compiler choose based on chart type (default).
4776
+ * - 'right' | 'left' | 'top' | 'bottom': pin to that edge.
4777
+ * - 'none': hide the legend entirely.
4778
+ */
4233
4779
  declare type LegendPosition = 'auto' | 'right' | 'left' | 'top' | 'bottom' | 'none';
4234
4780
 
4781
+ /**
4782
+ * Line marks — connected series. One line per `group` (defaults to the `color` column). Tune the stroke via
4783
+ * {@link LineGeomParams}. Pair with `stat.smooth()` for a trendline. Observations are connected in data
4784
+ * order, so sort by x first.
4785
+ *
4786
+ * @example
4787
+ * pipe(createSpec({ x: 'month', y: 'sales', color: 'region' }), geom.line(), scale.x(), scale.y(), scale.color.palette());
4788
+ */
4235
4789
  declare function line(options?: GeomOptions<'line'>): LayerInputOf<'line'>;
4236
4790
 
4237
4791
  /**
@@ -4254,17 +4808,22 @@ declare class LineGeom extends Geom {
4254
4808
  }
4255
4809
 
4256
4810
  /**
4257
- * Line-specific parameters
4811
+ * Render parameters for `geom.line`. Passed under `params`.
4258
4812
  */
4259
4813
  export declare interface LineGeomParams {
4814
+ /**
4815
+ * Stroke width in pixels, or `'auto'` to let the theme pick a width.
4816
+ * @default 'auto'
4817
+ */
4260
4818
  lineWidth: number | 'auto';
4261
4819
  /**
4262
- * Interpolation method to use for the line.
4820
+ * Interpolation method between points: `'linear'` for straight segments, `'catmull-rom'` for a smooth spline.
4263
4821
  * @default 'linear'
4264
4822
  */
4265
4823
  interpolate: InterpolateType;
4266
4824
  /**
4267
- * How to handle missing (NULL/undefined) values.
4825
+ * How to handle missing (`null`) y-values: `'gap'` breaks the line, `'zero'` drops to zero, `'connect'`
4826
+ * bridges across the gap.
4268
4827
  * @default 'gap'
4269
4828
  */
4270
4829
  missingValues: MissingValuesType;
@@ -4291,7 +4850,12 @@ export declare type Locale = (typeof LOCALES)[number];
4291
4850
  /** A BCP-47 string representing a supported locale. */
4292
4851
  declare const LOCALES: readonly ["en-GB", "en-US", "ar", "pt-PT"];
4293
4852
 
4294
- /** Logical composition of any predicate. */
4853
+ /**
4854
+ * Boolean composition of nested predicates:
4855
+ * - `and`: every sub-predicate matches.
4856
+ * - `or`: at least one matches.
4857
+ * - `not`: the sub-predicate does not match.
4858
+ */
4295
4859
  export declare type LogicalPredicate = {
4296
4860
  and: Predicate[];
4297
4861
  } | {
@@ -4326,7 +4890,9 @@ export declare type MainAxis = 'x' | 'y';
4326
4890
  declare type MappableAes<Definition extends Geom> = Definition['requiredAesthetics'][number] | Definition['visualAesthetics'][number] | 'group';
4327
4891
 
4328
4892
  /**
4329
- * Create a pipeable mapping spec item.
4893
+ * Create a pipeable mapping spec item. Use this form (rather than passing the mapping as the first
4894
+ * `createSpec` arg) when a transform must run before the mapping is read — e.g. reshaping wide columns
4895
+ * to long so a freshly-created column can be bound to a channel.
4330
4896
  *
4331
4897
  * @example
4332
4898
  * createSpec(
@@ -4339,7 +4905,8 @@ declare type MappableAes<Definition extends Geom> = Definition['requiredAestheti
4339
4905
  export declare function mapping(aes: AesMapping): MappingItem;
4340
4906
 
4341
4907
  /**
4342
- * A pipeable spec item that sets/merges the global aesthetic mapping.
4908
+ * A pipeable spec item that sets/merges the global {@link AesMapping}. Produced by {@link mapping} and
4909
+ * folded into the spec by `pipe`/`createSpec`; later mapping items shallow-merge over earlier channels.
4343
4910
  */
4344
4911
  declare interface MappingItem {
4345
4912
  type: 'mapping';
@@ -4455,14 +5022,16 @@ declare type NeonPaletteConfig = {
4455
5022
  declare type NeonPaletteVariant = 'default' | 'waterfall';
4456
5023
 
4457
5024
  /**
4458
- * Configuration for formatting a single number.
4459
- * Defines how numeric values should be displayed in the chart.
5025
+ * Chart-wide number formatting, applied by the renderer to every numeric value
5026
+ * (axis ticks, tooltips, data labels, headline figures). Set via
5027
+ * `config({ numberFormat: { … } })`.
4460
5028
  */
4461
5029
  export declare interface NumberFormatConfig {
4462
5030
  /**
4463
5031
  * Number of decimal places to display.
4464
5032
  * - number: Fixed decimal places (e.g., 2 → "1234.56")
4465
- * - 'auto': Automatic based on value magnitude (default)
5033
+ * - 'auto': Automatic based on value magnitude
5034
+ * @default 'auto'
4466
5035
  */
4467
5036
  decimals: number | 'auto';
4468
5037
  /**
@@ -4472,6 +5041,7 @@ export declare interface NumberFormatConfig {
4472
5041
  * - 'k': Force thousands (1234567 → "1,234.6K")
4473
5042
  * - 'm': Force millions (1234567 → "1.2M")
4474
5043
  * - 'b': Force billions (1234567890 → "1.2B")
5044
+ * @default 'auto'
4475
5045
  */
4476
5046
  abbreviation: 'auto' | 'k' | 'm' | 'b' | 'none';
4477
5047
  /**
@@ -4500,7 +5070,13 @@ declare interface NumericValueFormat {
4500
5070
  type: 'decimal' | 'integer' | 'percentage' | 'duration';
4501
5071
  }
4502
5072
 
4503
- /** A single row of data, mapping every variable name to the value in that row. */
5073
+ /**
5074
+ * One compiled per-observation record — the unit a geom's render half iterates and reads to paint a
5075
+ * single mark. Maps every variable name (the author's data columns plus the compiler's internal
5076
+ * position/visual/group columns) to that observation's value. Read positions and encodings off it with
5077
+ * the value readers ({@link getX}, {@link getYMin}, {@link getColor}, …) rather than indexing internal
5078
+ * keys by hand; read your own named columns with `readNumber`/`readString`.
5079
+ */
4504
5080
  export declare type Observation = Record<VariableName, DataValue>;
4505
5081
 
4506
5082
  /**
@@ -4519,13 +5095,16 @@ export declare interface ObservationAnchor {
4519
5095
  groupValue: DataValue;
4520
5096
  }
4521
5097
 
4522
- /** Points at a single observation by its anchor value and series. */
5098
+ /**
5099
+ * Snaps to a single data observation by its main-axis value and series. The annotation tracks that
5100
+ * observation across resize and re-layout (unlike panel-fractional positioning).
5101
+ */
4523
5102
  export declare interface ObservationAnchorInput {
4524
- /** Pick a specific layer when multiple share the same `(anchorValue, groupValue)` pair. */
5103
+ /** Pick a specific layer when multiple share the same `(anchorValue, groupValue)` pair. Index into the spec's layers. */
4525
5104
  layerIndex?: number;
4526
- /** Value on the main axis (x in cartesian, y in flipped). */
5105
+ /** Value on the main axis (x in cartesian, y in flipped) that selects the observation. */
4527
5106
  anchorValue: DataValue;
4528
- /** Series identity (the `group` aesthetic value). */
5107
+ /** Series identity the `color`/`group` aesthetic value that disambiguates within the axis value. */
4529
5108
  groupValue: DataValue;
4530
5109
  }
4531
5110
 
@@ -4620,19 +5199,29 @@ declare interface PieOptions {
4620
5199
  * Pinned-number annotation: a marker dot pinned to a single observation. The
4621
5200
  * renderer's mini view shows the observation's measurement value; hover reveals
4622
5201
  * the full tooltip (x + y + trend).
5202
+ *
5203
+ * NO PAINTER in `@graphysdk/react-renderer` — this compiles but never draws there (it renders only in
5204
+ * the editor's legacy engine). Don't reach for it when authoring for the React renderer.
4623
5205
  */
4624
5206
  declare interface PinnedNumberAnnotationInput {
4625
5207
  id?: string;
4626
5208
  anchor: ObservationAnchorInput;
4627
5209
  }
4628
5210
 
5211
+ /** Resolved form of {@link PinnedNumberAnnotationInput} — defaults applied, anchor normalised. */
4629
5212
  declare interface PinnedNumberAnnotationSpec {
4630
5213
  id: string;
4631
5214
  anchor: ObservationAnchor;
4632
5215
  }
4633
5216
 
4634
5217
  /**
4635
- * Pipe a spec through a series of spec items (left-to-right).
5218
+ * Fold a sequence of pipeable spec items onto an existing spec, left to right, returning a new spec.
5219
+ * Each item is appended by kind: layers accumulate (call `geom.*` once per mark), scales accumulate,
5220
+ * `config` deep-merges, `coord`/`mapping` overwrite/merge. The usual shape is
5221
+ * `pipe(createSpec({...}), geom.x(), scale.x(), scale.y(), ...)`.
5222
+ *
5223
+ * @example
5224
+ * pipe(createSpec({ x: 'month', y: 'sales', color: 'region' }), geom.line(), scale.x(), scale.y(), scale.color.palette());
4636
5225
  */
4637
5226
  export declare function pipe(spec: SpecInput, ...items: SpecItem[]): SpecInput;
4638
5227
 
@@ -4662,6 +5251,20 @@ export declare interface PlacedDataLabel {
4662
5251
  position: DataLabelPosition;
4663
5252
  }
4664
5253
 
5254
+ /**
5255
+ * Point marks — scatter plots and bubble charts. Map `size` to a column for a bubble chart and `color` for
5256
+ * categorical series. Sizing is controlled via {@link PointGeomParams} `size` or `scale.size.continuous`.
5257
+ *
5258
+ * @example
5259
+ * pipe(
5260
+ * createSpec({ x: 'gdp', y: 'lifeExp', size: 'population', color: 'continent' }),
5261
+ * geom.point(),
5262
+ * scale.x(),
5263
+ * scale.y(),
5264
+ * scale.size.continuous({ range: [4, 40] }),
5265
+ * scale.color.palette(),
5266
+ * );
5267
+ */
4665
5268
  declare function point(options?: GeomOptions<'point'>): LayerInputOf<'point'>;
4666
5269
 
4667
5270
  /**
@@ -4680,9 +5283,14 @@ declare class PointGeom extends Geom {
4680
5283
  }
4681
5284
 
4682
5285
  /**
4683
- * Point-specific parameters
5286
+ * Render parameters for `geom.point`. Passed under `params`.
4684
5287
  */
4685
5288
  declare interface PointGeomParams {
5289
+ /**
5290
+ * Mark diameter in pixels, used when `size` is not a data channel. To size by data instead, map the `size`
5291
+ * aesthetic and declare `scale.size.continuous({ range })`.
5292
+ * @default 8
5293
+ */
4686
5294
  size: number;
4687
5295
  }
4688
5296
 
@@ -4698,19 +5306,28 @@ declare interface PolarCoordInput {
4698
5306
  }
4699
5307
 
4700
5308
  /**
4701
- * Params for polar coordinate system
5309
+ * Resolved params for the polar coordinate system (defaults applied).
5310
+ * Drives pie, donut, and radar/radial layouts by mapping one scaled aesthetic to the
5311
+ * angle and the other to the radius.
4702
5312
  */
4703
5313
  declare interface PolarCoordParams extends BaseCoordParams {
4704
5314
  /**
4705
- * Which aesthetic maps to theta (angle): 'x' or 'y'
5315
+ * Which aesthetic becomes the angle (theta); the other aesthetic becomes the radius,
5316
+ * scaled into `[innerRadius, 1]`. Use `'y'` for pie/donut (stacked value → angle),
5317
+ * `'x'` for radar (one spoke per category).
5318
+ * @default 'x'
4706
5319
  */
4707
5320
  theta: 'x' | 'y';
4708
5321
  /**
4709
- * Starting angle in degrees
5322
+ * Rotation offset of the whole layout, in degrees. Shifts where the first datum begins;
5323
+ * the full sweep is 360°.
5324
+ * @default 0
4710
5325
  */
4711
5326
  startAngle: number;
4712
5327
  /**
4713
- * Inner radius as fraction 0-1 (for donut charts)
5328
+ * Hole radius as a fraction of the outer radius, `0`–`1`. `0` is a full pie;
5329
+ * any value `> 0` produces a donut (e.g. `0.55`).
5330
+ * @default 0
4714
5331
  */
4715
5332
  innerRadius: number;
4716
5333
  }
@@ -4880,6 +5497,10 @@ export declare type PositionType = 'stack' | 'dodge' | 'identity' | 'fill';
4880
5497
  */
4881
5498
  declare type PositionValueKind = 'value' | 'bandOffset';
4882
5499
 
5500
+ /**
5501
+ * Selects which observations a highlight emphasises: either a single-column
5502
+ * {@link VariablePredicate} or a {@link LogicalPredicate} combining several.
5503
+ */
4883
5504
  export declare type Predicate = VariablePredicate | LogicalPredicate;
4884
5505
 
4885
5506
  export declare const prefixInternalVariable: (name: string) => string;
@@ -4902,6 +5523,11 @@ declare interface QuantitativeScaleMethods {
4902
5523
  identity: (options?: IdentityScaleOptions) => IdentityScaleInput;
4903
5524
  }
4904
5525
 
5526
+ /**
5527
+ * The radial span of an arc/wedge in a polar coord, in `[0,1]` (0 = centre, 1 = outer ring).
5528
+ * `innerRadius` is `null` when the observation declares no y interval; `outerRadius` falls back to the
5529
+ * `point` radius when no upper endpoint exists. Returned by {@link getRadiusExtent}.
5530
+ */
4905
5531
  export declare interface RadiusExtent {
4906
5532
  innerRadius: NumericDataValue;
4907
5533
  outerRadius: NumericDataValue;
@@ -4916,19 +5542,28 @@ export declare interface RadiusExtent {
4916
5542
  export declare function readAesthetic(aesMapping: AesMapping, name: string): AestheticValue | undefined;
4917
5543
 
4918
5544
  /**
4919
- * Reads an author-named numeric column from an observation with the same null-discipline as the
4920
- * built-in position/visual readers (`getX`, `getColor`, ): a missing or wrong-typed value is
4921
- * `null`, never silently coerced to `0`. A custom geom writes its own columns and has no typed
4922
- * accessor for them; these readers fill that gap without re-deriving the coercion per geom.
5545
+ * Reads a value by **column name** from an observation, as a number. Use this for the columns a custom
5546
+ * geom named itself (via `variableFor(axis, name)` for scalar channels, or `addVariable` in `compile()`)
5547
+ * the position readers (`getX`, `getYMin`, …) and visual readers (`getColor`, …) cover the built-in
5548
+ * channels by their fixed internal keys, but there is no typed accessor for an author-named column, and
5549
+ * this fills that gap. The returned number is **whatever was written to that column** (a scalar channel
5550
+ * is already scaled to `[0,1]`; a plain `addVariable` value is in its original units — it carries no
5551
+ * scaling on its own).
4923
5552
  *
4924
- * Pass `fallback` to opt into a default for genuinely-missing values; the overload then narrows the
4925
- * return to `number`, so a geom that wants `0`-on-missing says so explicitly.
5553
+ * Shares the readers' null-discipline: a missing or wrong-typed value is `null`, never silently coerced
5554
+ * to `0`. Pass `fallback` to opt into a default for genuinely-missing values; the overload then narrows
5555
+ * the return to `number`, so a geom that wants `0`-on-missing says so explicitly.
4926
5556
  */
4927
5557
  export declare function readNumber(observation: Observation, key: string): number | null;
4928
5558
 
4929
5559
  export declare function readNumber(observation: Observation, key: string, fallback: number): number;
4930
5560
 
4931
- /** Reads an author-named string column from an observation; missing or wrong-typed is `null` unless a `fallback` is given. */
5561
+ /**
5562
+ * Reads a value by **column name** from an observation, as a string — the string counterpart to
5563
+ * {@link readNumber}, for author-named categorical/label columns a custom geom wrote in `compile()`.
5564
+ * A missing or wrong-typed value is `null` unless a `fallback` is given (the overload then narrows the
5565
+ * return to `string`).
5566
+ */
4932
5567
  export declare function readString(observation: Observation, key: string): string | null;
4933
5568
 
4934
5569
  export declare function readString(observation: Observation, key: string, fallback: string): string;
@@ -4992,6 +5627,11 @@ declare function reshape(options?: ReshapeOptions): ReshapeTransformInput;
4992
5627
  /***************************************************************
4993
5628
  * Reshape Transform
4994
5629
  ***************************************************************/
5630
+ /**
5631
+ * Options for `transform.reshape` — pivots a wide table to long ("tidy") form by collapsing
5632
+ * several numeric columns into two: a key column (the original column name) and a value column.
5633
+ * The idiom for turning a multi-metric table into a single series mappable by `color`.
5634
+ */
4995
5635
  declare interface ReshapeOptions {
4996
5636
  /**
4997
5637
  * Numeric variables to collapse into rows.
@@ -5015,6 +5655,7 @@ declare interface ReshapeOptions {
5015
5655
  valueName?: VariableName;
5016
5656
  }
5017
5657
 
5658
+ /** Pivot-to-long transform produced by `transform.reshape`. */
5018
5659
  declare interface ReshapeTransformInput {
5019
5660
  type: 'transform';
5020
5661
  transformType: 'reshape';
@@ -5098,15 +5739,35 @@ export declare function resolveYScaleAesthetic(yScaleType: YScaleType): ScaledAe
5098
5739
  */
5099
5740
  export declare const RESTING_HOVER_STATE: HoverState;
5100
5741
 
5101
- /** TipTap-compatible rich text node (no tiptap dependency). */
5742
+ /**
5743
+ * A node in a ProseMirror/TipTap-style rich-text document tree (no tiptap
5744
+ * dependency). NOT a plain string — it is a recursive node where `content`
5745
+ * holds child nodes and a leaf text node carries `text`. Used both for chart
5746
+ * titles/captions and for text annotation bodies.
5747
+ *
5748
+ * The root is a `{ type: 'doc' }` node; block children are `'paragraph'` or
5749
+ * `'heading'` (with `attrs.level`); inline runs are `'text'` nodes whose
5750
+ * `marks` apply styling (e.g. `{ type: 'bold' }`, `{ type: 'italic' }`,
5751
+ * `{ type: 'link', attrs: { href } }`). Plain prose is one paragraph of one
5752
+ * text node:
5753
+ *
5754
+ * ```ts
5755
+ * { type: 'doc', content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Quarterly sales' }] }] }
5756
+ * ```
5757
+ */
5102
5758
  export declare interface RichTextContent {
5759
+ /** Node kind: `'doc'` (root), `'paragraph'`, `'heading'`, `'text'`, etc. */
5103
5760
  type?: string;
5761
+ /** Child nodes. Present on container nodes; absent on `'text'` leaves. */
5104
5762
  content?: RichTextContent[];
5763
+ /** The literal string carried by a `'text'` leaf node. */
5105
5764
  text?: string;
5765
+ /** Inline formatting applied to a `'text'` node (bold, italic, link, …). */
5106
5766
  marks?: Array<{
5107
5767
  type: string;
5108
5768
  attrs?: Record<string, unknown>;
5109
5769
  }>;
5770
+ /** Node attributes, e.g. `{ level: 2 }` on a heading or `{ href }` on a link mark target. */
5110
5771
  attrs?: Record<string, unknown>;
5111
5772
  }
5112
5773
 
@@ -5121,6 +5782,18 @@ declare interface RolePositionChannel extends PositionChannelBase {
5121
5782
  name?: string;
5122
5783
  }
5123
5784
 
5785
+ /**
5786
+ * Rule marks — a single horizontal or vertical reference line, the built-in for goal/threshold/average
5787
+ * lines (no custom geom needed). Pin a constant with `aes: { y: { value } }` (horizontal) or
5788
+ * `aes: { x: { value } }` (vertical, numeric x), or compute a data-driven line with `stat.mean()`. Style and
5789
+ * label it via {@link RuleGeomParams}; set `interactive: false` so it doesn't take hover.
5790
+ *
5791
+ * @example
5792
+ * // Constant goal line at y = 2500
5793
+ * geom.rule({ aes: { y: { value: 2500 } }, params: { label: 'Target', lineType: 'dashed', labelPosition: 'start' } });
5794
+ * // Data-driven average line
5795
+ * geom.rule({ aes: { y: 'revenue' }, stat: stat.mean(), params: { label: 'Average' }, interactive: false });
5796
+ */
5124
5797
  declare function rule(options?: GeomOptions<'rule'>): LayerInputOf<'rule'>;
5125
5798
 
5126
5799
  /**
@@ -5143,20 +5816,34 @@ declare class RuleGeom extends Geom {
5143
5816
  }
5144
5817
 
5145
5818
  /**
5146
- * Rule-specific parameters.
5819
+ * Render parameters for `geom.rule`. Passed under `params`. The line's value comes from `aes`
5820
+ * (`{ y: { value } }` or `stat.mean()`), not from here — these are styling and labelling only.
5147
5821
  */
5148
5822
  export declare interface RuleGeomParams {
5149
- /** Stroke color; falls back to a theme token. */
5823
+ /** Stroke color (any CSS color). Falls back to a theme token when omitted. */
5150
5824
  color?: string;
5825
+ /**
5826
+ * Stroke width in pixels.
5827
+ * @default 1
5828
+ */
5151
5829
  strokeWidth: number;
5830
+ /**
5831
+ * Dash style of the line.
5832
+ * @default 'dashed'
5833
+ */
5152
5834
  lineType: LineStyleType;
5153
- /** Optional inline text label rendered alongside the line. */
5835
+ /** Optional inline text label rendered alongside the line (e.g. `'Target'`, `'Average'`). */
5154
5836
  label?: string;
5837
+ /**
5838
+ * Which end of the line the `label` is anchored to.
5839
+ * @default 'start'
5840
+ */
5155
5841
  labelPosition: RuleLabelPosition;
5156
5842
  }
5157
5843
 
5158
5844
  /**
5159
- * Where the optional inline label is anchored along a reference line.
5845
+ * Where the optional inline label sits along a reference line: `'start'` (left/top end) or `'end'`
5846
+ * (right/bottom end).
5160
5847
  */
5161
5848
  export declare type RuleLabelPosition = 'start' | 'end';
5162
5849
 
@@ -5188,6 +5875,31 @@ declare abstract class Scale {
5188
5875
  abstract compile(spec: ScaleSpec, values: DataValue[]): CompiledScale;
5189
5876
  }
5190
5877
 
5878
+ /**
5879
+ * Scale builder — declares how each mapped variable is turned into a visual value
5880
+ * (axis position, color, size, …). Pipe the result onto a spec.
5881
+ *
5882
+ * Position scales must be declared EXPLICITLY: the builder never auto-infers `x`/`y`,
5883
+ * so omitting `scale.x()` / `scale.y()` yields NaN positions. `scale.x`/`.y`/`.ySecondary`
5884
+ * are callable for an inferred scale (type auto-detected from the data) or expose explicit
5885
+ * sub-methods: `.continuous` / `.discrete` / `.datetime` / `.log` / `.sqrt`. Use
5886
+ * `scale.x.discrete()` for categorical or temporal-string axes.
5887
+ *
5888
+ * Non-position aesthetics auto-infer from the mapping, so their scale entry is optional —
5889
+ * add one only to override the default (e.g. `scale.color.palette()`, `scale.size.continuous({ range })`).
5890
+ *
5891
+ * @example
5892
+ * import { pipe, createSpec, geom, scale } from '@graphysdk/viz-engine';
5893
+ *
5894
+ * pipe(
5895
+ * createSpec({ x: 'gdp', y: 'lifeExp', size: 'population', color: 'continent' }),
5896
+ * geom.point(),
5897
+ * scale.x.log({ domainMin: 1 }),
5898
+ * scale.y.continuous({ zero: false, nice: true }),
5899
+ * scale.size.continuous({ range: [4, 40] }),
5900
+ * scale.color.palette()
5901
+ * );
5902
+ */
5191
5903
  export declare const scale: ScaleAPI;
5192
5904
 
5193
5905
  declare interface ScaleAPI {
@@ -5297,7 +6009,10 @@ declare type ScaledPositionAestheticKey = 'x' | 'y' | 'ySecondary';
5297
6009
  export declare type ScaledVisualAestheticKey = 'color' | 'size' | 'alpha' | 'strokeWidth' | 'lineType';
5298
6010
 
5299
6011
  /**
5300
- * Union type for all possible scale specifications (including inferred, pre-resolution).
6012
+ * Any value the `scale` builder produces, before resolution. Each pipe item carries the
6013
+ * target aesthetic plus its scale type and options; an `inferred` entry has its concrete
6014
+ * type chosen from the data during compilation. This is the type accepted by the spec
6015
+ * pipeline — author scales with the `scale` builder rather than constructing it by hand.
5301
6016
  */
5302
6017
  declare type ScaleInput = ContinuousScaleInput | DiscreteScaleInput | PaletteScaleInput | DatetimeScaleInput | IdentityScaleInput | InferredScaleInput;
5303
6018
 
@@ -5306,8 +6021,9 @@ declare class ScaleRegistry extends Registry<ScaleType, Scale> {
5306
6021
  }
5307
6022
 
5308
6023
  /**
5309
- * Union of scale specs that can appear after resolution (all fields required).
5310
- * InferredScaleInput is resolved to a concrete type during spec resolution.
6024
+ * A fully resolved scale (every option defaulted) as it appears on the compiled spec.
6025
+ * The `inferred` variant has already been collapsed to one of these concrete types
6026
+ * during resolution, so this union has no `inferred` member.
5311
6027
  */
5312
6028
  declare type ScaleSpec = ContinuousScaleSpec | DiscreteScaleSpec | DatetimeScaleSpec | IdentityScaleSpec | PaletteScaleSpec;
5313
6029
 
@@ -5521,27 +6237,37 @@ declare type SetScaleDomainParams = {
5521
6237
  };
5522
6238
 
5523
6239
  /**
5524
- * Freeform rectangle annotation. Position and size are expressed as
5525
- * fractions of the plot rect (0..1) so the annotation re-flows when the
5526
- * panel resizes.
6240
+ * A shaded box layered onto the panel. Position and size are panel fractions (`[0,1]`, top-left
6241
+ * origin) NOT data values so the shape re-flows on resize but does not snap to a data point. Use a
6242
+ * difference arrow or a custom annotation when you need data anchoring.
5527
6243
  */
5528
6244
  export declare interface ShapeInput {
5529
6245
  id?: string;
6246
+ /** @default 'rectangle' */
5530
6247
  kind?: ShapeKind;
6248
+ /** @default 'foreground' */
5531
6249
  zOrder?: ShapeZOrder;
6250
+ /** Left edge as a `[0,1]` fraction of panel width (0 = left). */
5532
6251
  x: number;
6252
+ /** Top edge as a `[0,1]` fraction of panel height (0 = top). */
5533
6253
  y: number;
6254
+ /** Width as a `[0,1]` fraction of panel width. */
5534
6255
  width: number;
6256
+ /** Height as a `[0,1]` fraction of panel height. */
5535
6257
  height: number;
6258
+ /** @default 'transparent' */
5536
6259
  fillColor?: string;
6260
+ /** Fill alpha, `[0,1]`. @default 1 */
5537
6261
  fillOpacity?: number;
6262
+ /** Stroke width in pixels. @default 1 */
5538
6263
  strokeWidth?: number;
5539
- /** null falls back to the theme `defaultAnnotationShapeStroke`. */
6264
+ /** `null` falls back to the theme `defaultAnnotationShapeStroke`. @default null */
5540
6265
  strokeColor?: string | null;
5541
6266
  }
5542
6267
 
5543
6268
  export declare type ShapeKind = 'rectangle';
5544
6269
 
6270
+ /** Resolved form of {@link ShapeInput} — defaults applied. */
5545
6271
  export declare interface ShapeSpec {
5546
6272
  id: string;
5547
6273
  kind: ShapeKind;
@@ -5562,7 +6288,9 @@ export declare interface ShapeSpec {
5562
6288
  export declare type ShapeZOrder = 'background' | 'foreground';
5563
6289
 
5564
6290
  /**
5565
- * Builder for the smooth stat.
6291
+ * Builder for the smooth stat — fits a regression trendline through the observations.
6292
+ * Pair with `geom.line` for a drawn trendline. `order` applies only to `'polynomial'`,
6293
+ * `bandwidth` only to `'loess'`; both are ignored by the other methods.
5566
6294
  *
5567
6295
  * @example
5568
6296
  * geom.line({ stat: stat.smooth({ method: 'linear' }) })
@@ -5576,7 +6304,14 @@ declare function smooth(options: {
5576
6304
  }): SmoothStatInput;
5577
6305
 
5578
6306
  /**
5579
- * Regression methods supported by the `smooth` stat.
6307
+ * Regression/trendline method fitted by the `smooth` stat through the observations:
6308
+ * - `'linear'` — straight line of best fit (`y = a + b·x`). The default.
6309
+ * - `'loess'` — locally weighted smoothing; follows local structure. Tune with `bandwidth`.
6310
+ * - `'exponential'` — `y = a·e^(b·x)`; constant-rate growth/decay.
6311
+ * - `'logarithmic'` — `y = a + b·ln(x)`; fast early then flattening.
6312
+ * - `'quadratic'` — parabola (`y = a + b·x + c·x²`); a single bend.
6313
+ * - `'power'` — `y = a·x^b`; scale-free relationships.
6314
+ * - `'polynomial'` — degree-`order` polynomial; multiple bends. Tune with `order`.
5580
6315
  */
5581
6316
  export declare type SmoothMethod = 'linear' | 'loess' | 'exponential' | 'logarithmic' | 'quadratic' | 'power' | 'polynomial';
5582
6317
 
@@ -5586,7 +6321,9 @@ export declare type SmoothMethod = 'linear' | 'loess' | 'exponential' | 'logarit
5586
6321
  declare interface SmoothStatInput {
5587
6322
  type: 'smooth';
5588
6323
  method: SmoothMethod;
6324
+ /** Polynomial degree. Only used when `method: 'polynomial'`. @default 3 */
5589
6325
  order?: number;
6326
+ /** LOESS smoothing window as a fraction (0–1) of the data. Only used when `method: 'loess'`. @default 0.3 */
5590
6327
  bandwidth?: number;
5591
6328
  }
5592
6329
 
@@ -5612,6 +6349,10 @@ export declare const sortByXIfContinuous: (data: Dataset, mapping: AesMapping) =
5612
6349
  /***************************************************************
5613
6350
  * Sort Transform
5614
6351
  ***************************************************************/
6352
+ /**
6353
+ * Options for `transform.sort` — reorders observations by one variable. Affects draw order
6354
+ * and the order categories are first seen (and thus discrete-scale domain order).
6355
+ */
5615
6356
  declare interface SortOptions {
5616
6357
  /** The variable to sort by. */
5617
6358
  variableName: VariableName;
@@ -5619,15 +6360,18 @@ declare interface SortOptions {
5619
6360
  direction?: 'asc' | 'desc';
5620
6361
  }
5621
6362
 
6363
+ /** Observation-ordering transform produced by `transform.sort`. */
5622
6364
  declare interface SortTransformInput {
5623
6365
  type: 'transform';
5624
6366
  transformType: 'sort';
5625
6367
  options: SortOptions;
5626
6368
  }
5627
6369
 
5628
- /** Data-source attribution shown under the caption. */
6370
+ /** Data-source attribution shown under the caption: a `label` and optional `url`. */
5629
6371
  export declare interface SourceContent {
6372
+ /** Displayed attribution text, e.g. `'Internal pipeline'`. */
5630
6373
  label?: string;
6374
+ /** Optional link the label points to. */
5631
6375
  url?: string;
5632
6376
  }
5633
6377
 
@@ -5701,17 +6445,30 @@ export declare interface Spec {
5701
6445
  }
5702
6446
 
5703
6447
  /**
5704
- * The canonical spec type — plain JSON, serializable. Data is provided separately
5705
- * (as a `Data` value to {@link compile}, or as a prop to `<GraphProvider>`).
6448
+ * The canonical spec type — plain JSON, serializable. Built by `createSpec`/`pipe`; data is provided
6449
+ * separately (as a `Data` value to {@link compile}, or as a prop to `<GraphProvider>`). Hand-construct it
6450
+ * only when you cannot use the builders; otherwise prefer `pipe(createSpec({...}), geom.x(), scale.x(), ...)`.
5706
6451
  */
5707
6452
  export declare interface SpecInput {
6453
+ /** Global aesthetic mapping (data columns → channels); layer `aes` overrides merge over this. */
5708
6454
  mapping: AesMapping;
6455
+ /** Geometry layers to render, in draw order. One entry per `geom.*` call. */
5709
6456
  layers: LayerInput[];
6457
+ /**
6458
+ * Scale declarations, one per aesthetic. Position scales (`scale.x`/`scale.y`/`scale.ySecondary`) are NOT
6459
+ * auto-inferred — declare them explicitly or position channels resolve to NaN. Visual scales
6460
+ * (`color`/`size`/...) are inferred from the data when omitted.
6461
+ */
5710
6462
  scales: ScaleInput[];
6463
+ /** Spec-level data transforms applied before any layer is compiled (reshape, filter, ...). */
5711
6464
  transforms: TransformInput[];
6465
+ /** Predicate-driven emphasis rules that dim or accentuate matching observations. */
5712
6466
  highlights: HighlightInput[];
6467
+ /** Annotation overlays — difference arrows, shapes, text, freeform arrows. Optional. */
5713
6468
  annotations?: AnnotationsInput;
6469
+ /** Coordinate system: cartesian (default), `coord.flip()`, or `coord.polar(...)`. Optional. */
5714
6470
  coords?: CoordInput;
6471
+ /** Chart configuration: titles/captions, legend, axes, number format, headline, appearance. */
5715
6472
  config: ConfigInput;
5716
6473
  }
5717
6474
 
@@ -5781,6 +6538,23 @@ declare abstract class Stat {
5781
6538
  protected abstract computeStat(input: StatCompilerInput): CompiledStat;
5782
6539
  }
5783
6540
 
6541
+ /**
6542
+ * Statistical-transform builder — sets a geom's `stat`, replacing each layer's raw observations
6543
+ * with a derived summary before positions are computed. Defaults to `identity` (raw data).
6544
+ *
6545
+ * - `identity()` — pass observations through unchanged (the default).
6546
+ * - `count()` — number of observations per x value, written to `y`; do NOT also map `y`.
6547
+ * - `mean()` — reduce the mapped `y` to its average (a single value); the idiom for an
6548
+ * average line (`geom.rule({ stat: stat.mean() })`).
6549
+ * - `smooth({ method })` — fit a regression trendline; the idiom for a trendline
6550
+ * (`geom.line({ stat: stat.smooth({ method: 'linear' }) })`).
6551
+ *
6552
+ * @example
6553
+ * import { geom, stat } from '@graphysdk/viz-engine';
6554
+ *
6555
+ * geom.rule({ aes: { y: 'revenue' }, stat: stat.mean(), params: { label: 'Average' } });
6556
+ * geom.line({ stat: stat.smooth({ method: 'linear' }), interactive: false });
6557
+ */
5784
6558
  export declare const stat: {
5785
6559
  identity: typeof identity;
5786
6560
  count: typeof count;
@@ -5816,7 +6590,9 @@ declare interface StatCompilerInput {
5816
6590
  }
5817
6591
 
5818
6592
  /**
5819
- * User-facing stat inputeither a {@link StatName} string shorthand or an object spec.
6593
+ * Any value the `stat` builder produces passed as the `stat` option of a geom.
6594
+ * The string-shorthand variants (`stat.identity()`, `stat.count()`, `stat.mean()`) carry only
6595
+ * a `type`; `smooth` additionally carries the regression parameters.
5820
6596
  */
5821
6597
  declare type StatInput = IdentityStatSpec | CountStatSpec | SmoothStatInput | MeanStatSpec;
5822
6598
 
@@ -5844,6 +6620,9 @@ declare type StatSpec = IdentityStatSpec | CountStatSpec | SmoothStatSpec | Mean
5844
6620
 
5845
6621
  /**
5846
6622
  * Sticker annotation: a built-in emoji-like image pinned to a single observation.
6623
+ *
6624
+ * NO PAINTER in `@graphysdk/react-renderer` — this compiles but never draws there (it renders only in
6625
+ * the editor's legacy engine). Don't reach for it when authoring for the React renderer.
5847
6626
  */
5848
6627
  declare interface StickerAnnotationInput {
5849
6628
  id?: string;
@@ -5851,6 +6630,7 @@ declare interface StickerAnnotationInput {
5851
6630
  sticker: StickerId;
5852
6631
  }
5853
6632
 
6633
+ /** Resolved form of {@link StickerAnnotationInput} — defaults applied, anchor normalised. */
5854
6634
  declare interface StickerAnnotationSpec {
5855
6635
  id: string;
5856
6636
  anchor: ObservationAnchor;
@@ -5901,26 +6681,33 @@ declare interface TemporalValueFormat {
5901
6681
  dateFormat?: string;
5902
6682
  }
5903
6683
 
6684
+ /** How `backgroundColor` is applied: `'fade'` (soft gradient) or `'opaque'` (flat fill). */
5904
6685
  export declare type TextAnnotationBackgroundColorStyle = 'fade' | 'opaque';
5905
6686
 
5906
6687
  /**
5907
- * Freeform rich-text annotation. Position and width are fractions of the plot
5908
- * rect (0..1). Height is intrinsic to the rendered content.
6688
+ * A free-standing text label on the panel. Positioned in panel fractions (`[0,1]`, top-left origin) —
6689
+ * NOT data values so it re-flows on resize but does not snap to a data point. There is no `height`
6690
+ * field: height is intrinsic to the rendered content. `content` is a structured {@link RichTextContent}
6691
+ * node tree (ProseMirror/TipTap-style), NOT a plain string — wrap a string as
6692
+ * `{ type: 'doc', content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Label' }] }] }`.
5909
6693
  */
5910
6694
  export declare interface TextAnnotationInput {
5911
6695
  id?: string;
6696
+ /** Rich-text node tree to render (not a plain string). */
5912
6697
  content: RichTextContent;
5913
- /** 0..1 of plot width top-left corner. */
6698
+ /** Left edge as a `[0,1]` fraction of panel width (0 = left, top-left corner). */
5914
6699
  x: number;
5915
- /** 0..1 of plot height top-left corner. */
6700
+ /** Top edge as a `[0,1]` fraction of panel height (0 = top, top-left corner). */
5916
6701
  y: number;
5917
- /** 0..1 of plot width. */
6702
+ /** Box width as a `[0,1]` fraction of panel width; text wraps within it (height is intrinsic). */
5918
6703
  width: number;
5919
- /** null falls back to a transparent background. */
6704
+ /** `null` falls back to a transparent background. @default null */
5920
6705
  backgroundColor?: string | null;
6706
+ /** @default 'opaque' */
5921
6707
  backgroundColorStyle?: TextAnnotationBackgroundColorStyle;
5922
6708
  }
5923
6709
 
6710
+ /** Resolved form of {@link TextAnnotationInput} — defaults applied. */
5924
6711
  export declare interface TextAnnotationSpec {
5925
6712
  id: string;
5926
6713
  content: RichTextContent;
@@ -5931,7 +6718,11 @@ export declare interface TextAnnotationSpec {
5931
6718
  backgroundColorStyle: TextAnnotationBackgroundColorStyle;
5932
6719
  }
5933
6720
 
5934
- /** A text value — plain string or structured rich text. */
6721
+ /**
6722
+ * A text value for a title, subtitle, or caption: either a plain `string`
6723
+ * (rendered as-is) or a structured {@link RichTextContent} document tree for
6724
+ * multi-style / multi-line text.
6725
+ */
5935
6726
  export declare type TextContent = string | RichTextContent;
5936
6727
 
5937
6728
  export declare interface TextMeasurer {
@@ -5975,6 +6766,29 @@ export declare interface TooltipRow {
5975
6766
  key: string;
5976
6767
  }
5977
6768
 
6769
+ /**
6770
+ * Data-transform builder — reshapes the dataset BEFORE any geom maps over it. Pipe one or more
6771
+ * onto a spec; they apply in order, ahead of stats and scaling, and affect every layer.
6772
+ *
6773
+ * - `reshape(opts?)` — pivot wide numeric columns to long form (key/value); the move for plotting
6774
+ * several metrics as one color-split series.
6775
+ * - `filter(opts)` — keep observations matching `variableName <operator> value`.
6776
+ * - `sort(opts)` — order observations by a variable (`'asc'` | `'desc'`).
6777
+ * - `aggregate(opts)` — group by variables and reduce each group (sum/mean/count/…).
6778
+ * - `constant(opts)` — add a column with a fixed value on every observation.
6779
+ *
6780
+ * @example
6781
+ * import { pipe, createSpec, geom, scale, transform } from '@graphysdk/viz-engine';
6782
+ *
6783
+ * pipe(
6784
+ * createSpec({ x: 'region', y: 'total', color: 'region' }),
6785
+ * transform.filter({ variableName: 'year', operator: 'eq', value: 2024 }),
6786
+ * transform.aggregate({ groupby: ['region'], operations: [{ op: 'sum', variableName: 'revenue', as: 'total' }] }),
6787
+ * geom.bar(),
6788
+ * scale.x(),
6789
+ * scale.y()
6790
+ * );
6791
+ */
5978
6792
  export declare const transform: {
5979
6793
  reshape: typeof reshape;
5980
6794
  filter: typeof filter;
@@ -6003,6 +6817,10 @@ declare interface TransformCompilerInput {
6003
6817
  /***************************************************************
6004
6818
  * Transform Input
6005
6819
  ***************************************************************/
6820
+ /**
6821
+ * Any value the `transform` builder produces. Transforms run before stats and scaling, in the
6822
+ * order they appear, reshaping the dataset that every layer then maps over.
6823
+ */
6006
6824
  declare type TransformInput = ReshapeTransformInput | FilterTransformInput | SortTransformInput | AggregateTransformInput | ConstantTransformInput;
6007
6825
 
6008
6826
  /**
@@ -6020,6 +6838,7 @@ declare interface TransformStrategy {
6020
6838
  apply: (data: Dataset, transform: TransformInput) => Dataset;
6021
6839
  }
6022
6840
 
6841
+ /** Discriminant tag of a {@link TransformInput}. */
6023
6842
  declare type TransformType = TransformInput['transformType'];
6024
6843
 
6025
6844
  declare type TrendlineType = 'linear' | 'loess' | 'exponential' | 'logarithmic' | 'quadratic' | 'power' | 'polynomial';
@@ -6066,10 +6885,12 @@ export declare interface ValueFormatterFactoryParams<T = ValueFormat> {
6066
6885
  }
6067
6886
 
6068
6887
  /**
6069
- * Constant mapping - a literal value applied to every observation.
6070
- * Analogous to Vega-Lite's `{datum: X}` / ggplot2's `aes(color = "literal")`.
6888
+ * Pins a channel to a single literal value applied to every observation, instead of reading a column.
6889
+ * Use it for reference-line constants (`geom.rule({ aes: { y: { value: 2500 } } })`) or to force a fixed
6890
+ * style (`aes: { lineType: { value: 'dashed' } }`). Analogous to Vega-Lite's `{datum: X}`.
6071
6891
  */
6072
6892
  declare interface ValueMapping {
6893
+ /** The constant — a number, string, Date, or null — shared by all observations. */
6073
6894
  value: DataValue;
6074
6895
  }
6075
6896
 
@@ -6092,9 +6913,11 @@ export declare function variableFor(axis: ChannelAxis, name: string): string;
6092
6913
  declare type VariableMap = Record<VariableName, Variable>;
6093
6914
 
6094
6915
  /**
6095
- * Variable mapping - references a column in the data
6916
+ * Binds a channel to a data column by name. `{ variable: 'revenue' }` reads the `revenue` column
6917
+ * per observation. Equivalent to the bare-string shorthand `'revenue'` in an {@link AesMapping}.
6096
6918
  */
6097
6919
  declare interface VariableMapping {
6920
+ /** Column key in the data, matching a `columns[i].key`. */
6098
6921
  variable: string;
6099
6922
  }
6100
6923
 
@@ -6103,15 +6926,20 @@ declare type VariableMetadata = Record<VariableName, {
6103
6926
  valueFormat: ValueFormat;
6104
6927
  }>;
6105
6928
 
6106
- /** A type alias for variable names. */
6929
+ /** A variable (column) name. Names with the internal prefix address compiler-emitted columns; address those through the value readers (`getX`, …) or `variableFor`, never by literal. */
6107
6930
  export declare type VariableName = string;
6108
6931
 
6109
6932
  /**
6110
- * Field-based predicates against post-transform user columns.
6933
+ * A value test against one post-transform user column. The selected operator
6934
+ * decides which observations a highlight emphasises:
6935
+ * - `eq`: column equals the value.
6936
+ * - `oneOf`: column is one of the listed values.
6937
+ * - `lt` / `lte` / `gt` / `gte`: ordering comparison (numeric / datetime only).
6938
+ * - `range`: inclusive `[min, max]` interval.
6111
6939
  *
6112
- * `lt`, `lte`, `gt`, `gte`, and `range` accept `DataValue`s and are coerced at
6113
- * evaluation time by the referenced column's `DataType`. Ordering operators
6114
- * against a categorical field are a resolve-time validation error.
6940
+ * Comparison values are `DataValue`s coerced at evaluation time by the
6941
+ * referenced column's `DataType`. Ordering operators against a categorical
6942
+ * field are a resolve-time validation error.
6115
6943
  */
6116
6944
  export declare type VariablePredicate = {
6117
6945
  variable: VariableName;