# @salmonui/pivot-table/engine API reference

> 64 exported symbols of @salmonui/pivot-table/engine: 11 functions, 2 classes, 30 interfaces, 18 types and 3 constants.

Canonical: https://salmonui.dev/docs/reference/pivot-table/engine

```ts
import { … } from '@salmonui/pivot-table/engine';
```

## Functions

### compileFormula

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/compileFormula

```ts
function compileFormula(formula: string, fields?: readonly string[]): CompiledFormula;
```

Compiles a calculated field formula. `fields` are the source field names a
reference may name (an empty list accepts any field). Throws
`PivotFormulaError` with the offending position.

### computePivot

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/computePivot

```ts
function computePivot<Row>(options: PivotEngineOptions<Row>): PivotResult;
```

One-shot compute (SSR, servers).

### createPivotEngine

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/createPivotEngine

```ts
function createPivotEngine<Row>(options: PivotEngineOptions<Row>): PivotEngine<Row>;
```

### createPivotJob

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/createPivotJob

```ts
function createPivotJob<Row>(options: PivotEngineOptions<Row>): PivotJob;
```

A resumable compute for time slicing on the main thread or a Worker.

### createPivotWorkerEngine

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/createPivotWorkerEngine

```ts
function createPivotWorkerEngine(worker: WorkerLike, options: PivotWorkerEngineOptions): AsyncPivotEngine;
```

### headersIn

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/headersIn

```ts
function headersIn(roots: readonly PivotHeaderNode[], start: number, end: number): PivotHeaderNode[];
```

Header nodes (any depth) whose span overlaps `[start, end)`, outer levels first per branch.

### measureId

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/measureId

```ts
function measureId(values: readonly PivotValueField[], k: number): string;
```

Measure id of the value field at `k` (types.ts "Measure ids"): the field,
`field#aggregate` when another value field uses the same field, and
`field#aggregate#k` when even that repeats.

### normalizePivotModel

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/normalizePivotModel

```ts
function normalizePivotModel(input?: PivotModelInput): PivotModel;
```

Fills every default of a report model. The result is deeply frozen plain
JSON; normalizing a normalized model returns an equal model.

### parseCsv

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/parseCsv

```ts
function parseCsv(text: string, options?: ParseCsvOptions): Record<string, unknown>[];
```

Parses CSV text into row objects keyed by the header (quoted fields, escaped quotes, CRLF, BOM).

### stableStringifyModel

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/stableStringifyModel

```ts
function stableStringifyModel(model: PivotModel | PivotModelInput): string;
```

Key-sorted JSON of a model with its default-valued fields omitted (stable cache and URL key).

### windowOf

Kind: function

Page: https://salmonui.dev/docs/reference/pivot-table/engine/windowOf

```ts
function windowOf(r: PivotResult, request: PivotWindowRequest): PivotWindow;
```

Computes one window of a result (used by the worker and by in-process hosts).

## Classes

### PivotFormulaError

Kind: class

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotFormulaError

```ts
class PivotFormulaError extends Error {
    readonly position: number;
    constructor(message: string, position: number);
}
```

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `position` | `readonly position: number;` |  | Zero-based character offset of the error in the formula. |

### PivotWorkerError

Kind: class

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotWorkerError

```ts
class PivotWorkerError extends Error {
    readonly position: number | undefined;
    constructor(name: string, message: string, position?: number);
}
```

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `position` | `readonly position: number \| undefined;` |  |  |

## Interfaces

### AsyncPivotEngine

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/AsyncPivotEngine

```ts
interface AsyncPivotEngine {
    readonly ready: Promise<PivotSummary>;
    subscribe(listener: () => void): () => void;
    getSnapshot(): PivotSummary | null;
    getStatus(): PivotComputeStatus;
    getModel(): PivotModel;
    setModel(input: PivotModelInput | ((model: PivotModel) => PivotModelInput)): Promise<PivotSummary>;
    setData(rows: readonly unknown[]): Promise<PivotSummary>;
    expand(path: PivotMemberPath): Promise<PivotSummary>;
    collapse(path: PivotMemberPath): Promise<PivotSummary>;
    expandAll(axis?: 'rows' | 'columns'): Promise<PivotSummary>;
    collapseAll(axis?: 'rows' | 'columns'): Promise<PivotSummary>;
    refresh(): Promise<PivotSummary>;
    getWindow(request: PivotWindowRequest): Promise<PivotWindow>;
    getFields(): Promise<readonly PivotFieldInfo[]>;
    getMembers(field: string, options?: {
        readonly search?: string;
        readonly limit?: number;
    }): Promise<readonly PivotMember[]>;
    drillThrough(rowIndex: number, columnIndex: number): Promise<readonly unknown[]>;
    getRawRows(indexes: readonly number[]): Promise<readonly unknown[]>;
    destroy(): void;
}
```

The window-based engine running in a Worker; every call resolves once the worker is done.

Members (18):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `ready` | `readonly ready: Promise<PivotSummary>;` |  | Resolves with the first result summary. |
| `subscribe` | `subscribe(listener: () => void): () => void;` |  |  |
| `getSnapshot` | `getSnapshot(): PivotSummary \| null;` |  | The latest summary (null until ready). |
| `getStatus` | `getStatus(): PivotComputeStatus;` |  |  |
| `getModel` | `getModel(): PivotModel;` |  | The latest model requested (applied optimistically). |
| `setModel` | `setModel(input: PivotModelInput \| ((model: PivotModel) => PivotModelInput)): Promise<PivotSummary>;` |  |  |
| `setData` | `setData(rows: readonly unknown[]): Promise<PivotSummary>;` |  |  |
| `expand` | `expand(path: PivotMemberPath): Promise<PivotSummary>;` |  |  |
| `collapse` | `collapse(path: PivotMemberPath): Promise<PivotSummary>;` |  |  |
| `expandAll` | `expandAll(axis?: 'rows' \| 'columns'): Promise<PivotSummary>;` |  |  |
| `collapseAll` | `collapseAll(axis?: 'rows' \| 'columns'): Promise<PivotSummary>;` |  |  |
| `refresh` | `refresh(): Promise<PivotSummary>;` |  |  |
| `getWindow` | `getWindow(request: PivotWindowRequest): Promise<PivotWindow>;` |  |  |
| `getFields` | `getFields(): Promise<readonly PivotFieldInfo[]>;` |  |  |
| `getMembers` | `getMembers(field: string, options?: {     readonly search?: string;     readonly limit?: number; }): Promise<readonly PivotMember[]>;` |  |  |
| `drillThrough` | `drillThrough(rowIndex: number, columnIndex: number): Promise<readonly unknown[]>;` |  |  |
| `getRawRows` | `getRawRows(indexes: readonly number[]): Promise<readonly unknown[]>;` |  |  |
| `destroy` | `destroy(): void;` |  | Rejects pending calls and terminates the worker. |

### CompiledFormula

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/CompiledFormula

```ts
interface CompiledFormula {
    readonly formula: string;
    readonly references: readonly PivotFormulaReference[];
    evaluate(get: (aggregate: PivotAggregate, field: string) => number | null): number | null;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `formula` | `readonly formula: string;` |  |  |
| `references` | `readonly references: readonly PivotFormulaReference[];` |  | Measures the formula reads, deduplicated, in order of appearance. |
| `evaluate` | `evaluate(get: (aggregate: PivotAggregate, field: string) => number \| null): number \| null;` |  |  |

### ParseCsvOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/ParseCsvOptions

```ts
interface ParseCsvOptions {
    readonly delimiter?: string;
    readonly header?: boolean;
    readonly types?: Readonly<Record<string, PivotFieldType>>;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `delimiter` | `readonly delimiter?: string;` | optional | Field separator (default `,`). |
| `header` | `readonly header?: boolean;` | optional | First record holds the field names (default true); otherwise fields are named `0`, `1`, ... |
| `types` | `readonly types?: Readonly<Record<string, PivotFieldType>>;` | optional | Per-field conversion; fields not listed are inferred (all values numeric: number, else string). |

### PivotAxisField

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotAxisField

```ts
interface PivotAxisField {
    readonly field: string;
    readonly caption?: string;
    readonly showSubTotals?: boolean;
}
```

A field placed on the rows, columns or filters axis.

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `field` | `readonly field: string;` |  |  |
| `caption` | `readonly caption?: string;` | optional |  |
| `showSubTotals` | `readonly showSubTotals?: boolean;` | optional | Per-field subtotal visibility; overrides `totals.sub`. |

### PivotCalculatedField

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotCalculatedField

```ts
interface PivotCalculatedField {
    readonly name: string;
    readonly caption?: string;
    readonly formula: string;
    readonly format?: PivotFormat;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `name` | `readonly name: string;` |  | Measure name used by `values[].field`, value sort and value filters. |
| `caption` | `readonly caption?: string;` | optional |  |
| `formula` | `readonly formula: string;` |  | Formula over aggregated measures: `"Sum(Amount)" / "Count(Units)"`, `IF(...)`, ... |
| `format` | `readonly format?: PivotFormat;` | optional |  |

### PivotCell

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotCell

```ts
interface PivotCell {
    readonly rowIndex: number;
    readonly columnIndex: number;
    readonly rowKey: string;
    readonly columnKey: string;
    readonly measure: string | null;
    readonly value: number | null;
    readonly rawValue: number | null;
    readonly formattedValue: string;
    readonly kind: 'value' | 'subtotal' | 'grandTotal';
    readonly rowCount: number;
}
```

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `rowIndex` | `readonly rowIndex: number;` |  |  |
| `columnIndex` | `readonly columnIndex: number;` |  |  |
| `rowKey` | `readonly rowKey: string;` |  |  |
| `columnKey` | `readonly columnKey: string;` |  |  |
| `measure` | `readonly measure: string \| null;` |  |  |
| `value` | `readonly value: number \| null;` |  | Aggregated value (after calculated fields and show-values-as), or null for empty. |
| `rawValue` | `readonly rawValue: number \| null;` |  | Raw aggregate before show-values-as. |
| `formattedValue` | `readonly formattedValue: string;` |  |  |
| `kind` | `readonly kind: 'value' \| 'subtotal' \| 'grandTotal';` |  |  |
| `rowCount` | `readonly rowCount: number;` |  | Number of raw rows behind the cell (drill through). |

### PivotConditionalFormat

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotConditionalFormat

```ts
interface PivotConditionalFormat {
    readonly measure?: string;
    readonly operator: PivotValueOperator;
    readonly value: number;
    readonly value2?: number;
    readonly className?: string;
    readonly tone?: 'accent' | 'success' | 'warning' | 'danger' | 'neutral';
    readonly style?: Readonly<Record<string, string>>;
    readonly applyGrandTotals?: boolean;
}
```

Members (8):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `measure` | `readonly measure?: string;` | optional | Measure name; omitted = every value field. |
| `operator` | `readonly operator: PivotValueOperator;` |  |  |
| `value` | `readonly value: number;` |  |  |
| `value2` | `readonly value2?: number;` | optional |  |
| `className` | `readonly className?: string;` | optional | A class added to the cell, or one of the seed tones. |
| `tone` | `readonly tone?: 'accent' \| 'success' \| 'warning' \| 'danger' \| 'neutral';` | optional |  |
| `style` | `readonly style?: Readonly<Record<string, string>>;` | optional |  |
| `applyGrandTotals` | `readonly applyGrandTotals?: boolean;` | optional | Apply to grand total cells too (default true). |

### PivotCustomAggregator

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotCustomAggregator

```ts
interface PivotCustomAggregator<State = unknown> {
    init(): State;
    add(state: State, value: unknown): State;
    merge(a: State, b: State): State;
    result(state: State): number | null;
}
```

A custom mergeable aggregator (client-only, never on the wire).

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `init` | `init(): State;` |  |  |
| `add` | `add(state: State, value: unknown): State;` |  |  |
| `merge` | `merge(a: State, b: State): State;` |  |  |
| `result` | `result(state: State): number \| null;` |  |  |

### PivotDiagnostics

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotDiagnostics

```ts
interface PivotDiagnostics {
    readonly rows: number;
    readonly units: number;
    readonly compressed: boolean;
    readonly fullComputes: number;
    readonly incrementalUpdates: number;
}
```

Internal counters for tests and benchmarks (not a stable API).

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `rows` | `readonly rows: number;` |  |  |
| `units` | `readonly units: number;` |  | Aggregation units: raw rows, or pre-aggregated records when compressed. |
| `compressed` | `readonly compressed: boolean;` |  |  |
| `fullComputes` | `readonly fullComputes: number;` |  | Pipelines run from the filter stage on (data, axes, filters or measures changed). |
| `incrementalUpdates` | `readonly incrementalUpdates: number;` |  | Data replacements applied as row deltas. |

### PivotEngine

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotEngine

```ts
interface PivotEngine<Row> {
    subscribe(listener: () => void): () => void;
    getSnapshot(): PivotResult;
    getModel(): PivotModel;
    getFields(): readonly PivotFieldInfo[];
    getMembers(field: string, options?: {
        readonly search?: string;
        readonly limit?: number;
    }): readonly PivotMember[];
    setModel(input: PivotModelInput | ((model: PivotModel) => PivotModelInput)): PivotResult;
    setData(rows: readonly Row[]): PivotResult;
    expand(path: PivotMemberPath): PivotResult;
    collapse(path: PivotMemberPath): PivotResult;
    expandAll(axis?: 'rows' | 'columns'): PivotResult;
    collapseAll(axis?: 'rows' | 'columns'): PivotResult;
    getRawRows(indexes: readonly number[]): readonly Row[];
    drillThrough(rowIndex: number, columnIndex: number): readonly Row[];
    refresh(): PivotResult;
    destroy(): void;
    getDiagnostics(): PivotDiagnostics;
}
```

Members (16):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `subscribe` | `subscribe(listener: () => void): () => void;` |  |  |
| `getSnapshot` | `getSnapshot(): PivotResult;` |  | Changes identity only when the result changes. |
| `getModel` | `getModel(): PivotModel;` |  |  |
| `getFields` | `getFields(): readonly PivotFieldInfo[];` |  |  |
| `getMembers` | `getMembers(field: string, options?: {     readonly search?: string;     readonly limit?: number; }): readonly PivotMember[];` |  |  |
| `setModel` | `setModel(input: PivotModelInput \| ((model: PivotModel) => PivotModelInput)): PivotResult;` |  |  |
| `setData` | `setData(rows: readonly Row[]): PivotResult;` |  | Small changes (a few replaced rows, or appended rows) update the aggregates incrementally. |
| `expand` | `expand(path: PivotMemberPath): PivotResult;` |  |  |
| `collapse` | `collapse(path: PivotMemberPath): PivotResult;` |  |  |
| `expandAll` | `expandAll(axis?: 'rows' \| 'columns'): PivotResult;` |  |  |
| `collapseAll` | `collapseAll(axis?: 'rows' \| 'columns'): PivotResult;` |  |  |
| `getRawRows` | `getRawRows(indexes: readonly number[]): readonly Row[];` |  |  |
| `drillThrough` | `drillThrough(rowIndex: number, columnIndex: number): readonly Row[];` |  |  |
| `refresh` | `refresh(): PivotResult;` |  |  |
| `destroy` | `destroy(): void;` |  |  |
| `getDiagnostics` | `getDiagnostics(): PivotDiagnostics;` |  | Internal counters (compression, incremental updates); not a stable API. |

### PivotEngineOptions

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotEngineOptions

```ts
interface PivotEngineOptions<Row> {
    readonly data: readonly Row[];
    readonly fields?: readonly PivotFieldDefinition<Row>[];
    readonly model?: PivotModelInput;
    readonly locale?: string;
    readonly customAggregates?: Readonly<Record<string, PivotCustomAggregator>>;
    readonly getCellValue?: (cell: PivotCell) => number | null;
    readonly text?: PivotEngineText;
}
```

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `data` | `readonly data: readonly Row[];` |  |  |
| `fields` | `readonly fields?: readonly PivotFieldDefinition<Row>[];` | optional | Inferred from the first rows when omitted. |
| `model` | `readonly model?: PivotModelInput;` | optional |  |
| `locale` | `readonly locale?: string;` | optional |  |
| `customAggregates` | `readonly customAggregates?: Readonly<Record<string, PivotCustomAggregator>>;` | optional |  |
| `getCellValue` | `readonly getCellValue?: (cell: PivotCell) => number \| null;` | optional | Pure override of a cell value. |
| `text` | `readonly text?: PivotEngineText;` | optional |  |

### PivotEngineText

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotEngineText

```ts
interface PivotEngineText {
    readonly grandTotal?: string;
    readonly total?: string;
    readonly blank?: string;
}
```

Labels the engine writes into header nodes (`{label}` is replaced by the member label).

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `grandTotal` | `readonly grandTotal?: string;` | optional |  |
| `total` | `readonly total?: string;` | optional |  |
| `blank` | `readonly blank?: string;` | optional |  |

### PivotFieldDefinition

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotFieldDefinition

```ts
interface PivotFieldDefinition<Row = unknown> {
    readonly field: string;
    readonly caption?: string;
    readonly type?: PivotFieldType;
    readonly folder?: string;
    readonly hidden?: boolean;
    readonly sortable?: boolean;
    readonly filterable?: boolean;
    readonly removable?: boolean;
    readonly draggable?: boolean;
    readonly valueGetter?: (row: Row) => unknown;
}
```

One source field.

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `field` | `readonly field: string;` |  |  |
| `caption` | `readonly caption?: string;` | optional |  |
| `type` | `readonly type?: PivotFieldType;` | optional | Inferred from the first non-null value when omitted. |
| `folder` | `readonly folder?: string;` | optional | Field list folder. |
| `hidden` | `readonly hidden?: boolean;` | optional | Hidden from the field list and axis bar. |
| `sortable` | `readonly sortable?: boolean;` | optional |  |
| `filterable` | `readonly filterable?: boolean;` | optional |  |
| `removable` | `readonly removable?: boolean;` | optional |  |
| `draggable` | `readonly draggable?: boolean;` | optional |  |
| `valueGetter` | `readonly valueGetter?: (row: Row) => unknown;` | optional | Reads the raw value; defaults to `row[field]`. |

### PivotFieldInfo

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotFieldInfo

```ts
interface PivotFieldInfo {
    readonly field: string;
    readonly caption: string;
    readonly type: PivotFieldType;
    readonly folder?: string;
    readonly hidden: boolean;
    readonly sortable: boolean;
    readonly filterable: boolean;
    readonly removable: boolean;
    readonly draggable: boolean;
    readonly memberCount: number;
}
```

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `field` | `readonly field: string;` |  |  |
| `caption` | `readonly caption: string;` |  |  |
| `type` | `readonly type: PivotFieldType;` |  |  |
| `folder` | `readonly folder?: string;` | optional |  |
| `hidden` | `readonly hidden: boolean;` |  |  |
| `sortable` | `readonly sortable: boolean;` |  |  |
| `filterable` | `readonly filterable: boolean;` |  |  |
| `removable` | `readonly removable: boolean;` |  |  |
| `draggable` | `readonly draggable: boolean;` |  |  |
| `memberCount` | `readonly memberCount: number;` |  |  |

### PivotFormat

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotFormat

```ts
interface PivotFormat {
    readonly number?: Intl.NumberFormatOptions;
    readonly date?: Intl.DateTimeFormatOptions;
    readonly locale?: string;
}
```

`Intl.NumberFormat` options (or date options for date members) per value or field.

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `number` | `readonly number?: Intl.NumberFormatOptions;` | optional |  |
| `date` | `readonly date?: Intl.DateTimeFormatOptions;` | optional |  |
| `locale` | `readonly locale?: string;` | optional |  |

### PivotFormulaReference

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotFormulaReference

```ts
interface PivotFormulaReference {
    readonly aggregate: PivotAggregate;
    readonly field: string;
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `aggregate` | `readonly aggregate: PivotAggregate;` |  |  |
| `field` | `readonly field: string;` |  |  |

### PivotHeaderNode

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotHeaderNode

```ts
interface PivotHeaderNode {
    readonly key: string;
    readonly axis: 'rows' | 'columns';
    readonly kind: PivotHeaderKind;
    readonly path: readonly Json[];
    readonly field: string | null;
    readonly measure: string | null;
    readonly label: string;
    readonly depth: number;
    readonly position: number;
    readonly span: number;
    readonly expandable: boolean;
    readonly expanded: boolean;
    readonly children?: readonly PivotHeaderNode[];
}
```

A header node of the row or column tree (lazily materialized).

Members (13):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `key` | `readonly key: string;` |  | Stable key: member keys (and measure) joined, unique per axis. |
| `axis` | `readonly axis: 'rows' \| 'columns';` |  |  |
| `kind` | `readonly kind: PivotHeaderKind;` |  |  |
| `path` | `readonly path: readonly Json[];` |  | Member keys from the axis root. |
| `field` | `readonly field: string \| null;` |  | Field of the innermost member (null for grand totals and value headers). |
| `measure` | `readonly measure: string \| null;` |  | Measure name for `kind: 'value'` headers and for leaves under them. |
| `label` | `readonly label: string;` |  |  |
| `depth` | `readonly depth: number;` |  |  |
| `position` | `readonly position: number;` |  | First leaf position covered and the number of leaf positions. |
| `span` | `readonly span: number;` |  |  |
| `expandable` | `readonly expandable: boolean;` |  | Has children (expanded or not). |
| `expanded` | `readonly expanded: boolean;` |  |  |
| `children` | `readonly children?: readonly PivotHeaderNode[];` | optional |  |

### PivotJob

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotJob

```ts
interface PivotJob {
    run(budgetMs: number): {
        readonly done: boolean;
        readonly progress: number;
    };
    result(): PivotResult;
}
```

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `run` | `run(budgetMs: number): {     readonly done: boolean;     readonly progress: number; };` |  | Works for at most about `budgetMs`, then returns; `done` once the result is ready. |
| `result` | `result(): PivotResult;` |  | The result; throws until `run()` reported `done`. |

### PivotMember

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotMember

```ts
interface PivotMember {
    readonly key: Json;
    readonly label: string;
    readonly count: number;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `key` | `readonly key: Json;` |  |  |
| `label` | `readonly label: string;` |  |  |
| `count` | `readonly count: number;` |  |  |

### PivotModel

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotModel

```ts
interface PivotModel {
    readonly rows: readonly PivotAxisField[];
    readonly columns: readonly PivotAxisField[];
    readonly values: readonly PivotValueField[];
    readonly filters: readonly PivotAxisField[];
    readonly filterBy: Readonly<Record<string, PivotFilter>>;
    readonly sort: Readonly<Record<string, PivotMemberSort>>;
    readonly valueSort: PivotValueSort | null;
    readonly groups: Readonly<Record<string, PivotGrouping>>;
    readonly calculatedFields: readonly PivotCalculatedField[];
    readonly formats: Readonly<Record<string, PivotFormat>>;
    readonly conditionalFormats: readonly PivotConditionalFormat[];
    readonly expanded: readonly PivotMemberPath[] | 'all';
    readonly totals: PivotTotals;
    readonly valuesPlacement: {
        readonly axis: 'columns' | 'rows';
        readonly index: number;
    };
    readonly showEmptyMembers: boolean;
    readonly showValueHeader?: boolean;
}
```

Members (16):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `rows` | `readonly rows: readonly PivotAxisField[];` |  |  |
| `columns` | `readonly columns: readonly PivotAxisField[];` |  |  |
| `values` | `readonly values: readonly PivotValueField[];` |  |  |
| `filters` | `readonly filters: readonly PivotAxisField[];` |  |  |
| `filterBy` | `readonly filterBy: Readonly<Record<string, PivotFilter>>;` |  |  |
| `sort` | `readonly sort: Readonly<Record<string, PivotMemberSort>>;` |  |  |
| `valueSort` | `readonly valueSort: PivotValueSort \| null;` |  |  |
| `groups` | `readonly groups: Readonly<Record<string, PivotGrouping>>;` |  |  |
| `calculatedFields` | `readonly calculatedFields: readonly PivotCalculatedField[];` |  |  |
| `formats` | `readonly formats: Readonly<Record<string, PivotFormat>>;` |  |  |
| `conditionalFormats` | `readonly conditionalFormats: readonly PivotConditionalFormat[];` |  |  |
| `expanded` | `readonly expanded: readonly PivotMemberPath[] \| 'all';` |  |  |
| `totals` | `readonly totals: PivotTotals;` |  |  |
| `valuesPlacement` | `readonly valuesPlacement: {     readonly axis: 'columns' \| 'rows';     readonly index: number; };` |  |  |
| `showEmptyMembers` | `readonly showEmptyMembers: boolean;` |  |  |
| `showValueHeader` | `readonly showValueHeader?: boolean;` | optional |  |

### PivotModelError

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotModelError

```ts
interface PivotModelError {
    readonly name: string;
    readonly message: string;
    readonly position: number;
}
```

A calculated field whose formula does not compile (its cells are empty).

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `name` | `readonly name: string;` |  |  |
| `message` | `readonly message: string;` |  |  |
| `position` | `readonly position: number;` |  |  |

### PivotResult

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotResult

```ts
interface PivotResult {
    readonly version: number;
    readonly model: PivotModel;
    readonly rowCount: number;
    readonly columnCount: number;
    readonly rowTree: readonly PivotHeaderNode[];
    readonly columnTree: readonly PivotHeaderNode[];
    readonly columnDepth: number;
    readonly rowDepth: number;
    memberAt(axis: 'rows' | 'columns', index: number): PivotHeaderNode;
    valueAt(rowIndex: number, columnIndex: number): number | null;
    cellAt(rowIndex: number, columnIndex: number): PivotCell;
    rowsAt(rowIndex: number, columnIndex: number): readonly number[];
}
```

The result of one engine run. Header nodes and cells are materialized on demand.

Members (12):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `version` | `readonly version: number;` |  |  |
| `model` | `readonly model: PivotModel;` |  |  |
| `rowCount` | `readonly rowCount: number;` |  | Visible (expanded) leaf rows and columns. |
| `columnCount` | `readonly columnCount: number;` |  |  |
| `rowTree` | `readonly rowTree: readonly PivotHeaderNode[];` |  | Header roots per axis (grand total node included when shown). |
| `columnTree` | `readonly columnTree: readonly PivotHeaderNode[];` |  |  |
| `columnDepth` | `readonly columnDepth: number;` |  | Depth of the column header tree (header row count). |
| `rowDepth` | `readonly rowDepth: number;` |  |  |
| `memberAt` | `memberAt(axis: 'rows' \| 'columns', index: number): PivotHeaderNode;` |  | Leaf header of a visible row or column position. |
| `valueAt` | `valueAt(rowIndex: number, columnIndex: number): number \| null;` |  |  |
| `cellAt` | `cellAt(rowIndex: number, columnIndex: number): PivotCell;` |  |  |
| `rowsAt` | `rowsAt(rowIndex: number, columnIndex: number): readonly number[];` |  | Raw row indexes behind a cell (drill through). |

### PivotShowAs

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotShowAs

```ts
interface PivotShowAs {
    readonly kind: PivotShowAsKind;
    readonly baseField?: string;
    readonly baseItem?: Json;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `kind` | `readonly kind: PivotShowAsKind;` |  |  |
| `baseField` | `readonly baseField?: string;` | optional |  |
| `baseItem` | `readonly baseItem?: Json;` | optional |  |

### PivotSummary

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotSummary

```ts
interface PivotSummary {
    readonly version: number;
    readonly model: PivotModel;
    readonly rowCount: number;
    readonly columnCount: number;
    readonly rowDepth: number;
    readonly columnDepth: number;
    readonly errors: readonly PivotModelError[];
}
```

Result metadata without cells (what every state-changing call resolves to).

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `version` | `readonly version: number;` |  |  |
| `model` | `readonly model: PivotModel;` |  |  |
| `rowCount` | `readonly rowCount: number;` |  |  |
| `columnCount` | `readonly columnCount: number;` |  |  |
| `rowDepth` | `readonly rowDepth: number;` |  |  |
| `columnDepth` | `readonly columnDepth: number;` |  |  |
| `errors` | `readonly errors: readonly PivotModelError[];` |  |  |

### PivotTotals

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotTotals

```ts
interface PivotTotals {
    readonly grand: 'both' | 'rows' | 'columns' | 'none';
    readonly grandPosition: 'start' | 'end';
    readonly sub: boolean | Readonly<Record<string, boolean>>;
    readonly subPosition: 'start' | 'end' | 'auto';
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `grand` | `readonly grand: 'both' \| 'rows' \| 'columns' \| 'none';` |  |  |
| `grandPosition` | `readonly grandPosition: 'start' \| 'end';` |  |  |
| `sub` | `readonly sub: boolean \| Readonly<Record<string, boolean>>;` |  |  |
| `subPosition` | `readonly subPosition: 'start' \| 'end' \| 'auto';` |  |  |

### PivotValueField

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotValueField

```ts
interface PivotValueField {
    readonly field: string;
    readonly caption?: string;
    readonly aggregate: PivotAggregate;
    readonly customId?: string;
    readonly showAs?: PivotShowAs;
}
```

A value field (one measure of the result).

Measure ids: every value field has a measure id, unique within
`model.values`, used in `PivotHeaderNode.measure`, `PivotCell.measure`,
header keys (`...|<measure id>`), `valueSort.measure`, value filters and
`formats`. It is `field` when no other value field uses the same field,
`field#aggregate` when one does (`Freight#average`, `Freight#sampleStdev`),
and `field#aggregate#index` (position in `model.values`) when even that
repeats. `measureId(values, index)` computes it. `valueSort.measure`, value
filters and `formats` also accept the plain `field` (first match).

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `field` | `readonly field: string;` |  |  |
| `caption` | `readonly caption?: string;` | optional |  |
| `aggregate` | `readonly aggregate: PivotAggregate;` |  |  |
| `customId` | `readonly customId?: string;` | optional | `aggregate: 'custom'`: key into `PivotEngineOptions.customAggregates`. |
| `showAs` | `readonly showAs?: PivotShowAs;` | optional |  |

### PivotValueSort

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotValueSort

```ts
interface PivotValueSort {
    readonly columnKey: string;
    readonly measure: string;
    readonly direction: 'asc' | 'desc';
    readonly multipleAxis?: boolean;
}
```

Sort row members by the values of one column tuple.

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `columnKey` | `readonly columnKey: string;` |  | Column leaf key (`PivotHeaderNode.key`) whose values order the rows; `''` = the grand total column. |
| `measure` | `readonly measure: string;` |  | Value field (`PivotValueField` caption-independent name: `field` or calculated field `name`). |
| `direction` | `readonly direction: 'asc' \| 'desc';` |  |  |
| `multipleAxis` | `readonly multipleAxis?: boolean;` | optional | Sort every row level (true) or only the innermost one. |

### PivotWindow

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotWindow

```ts
interface PivotWindow extends PivotSummary {
    readonly request: PivotWindowRequest;
    readonly rows: readonly PivotHeaderNode[];
    readonly columns: readonly PivotHeaderNode[];
    readonly rowHeaders: readonly PivotHeaderNode[];
    readonly columnHeaders: readonly PivotHeaderNode[];
    readonly cells: readonly PivotCell[];
}
```

One window of a result: leaf headers per position, every header overlapping it, and the cells row-major.

Members (13):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `request` | `readonly request: PivotWindowRequest;` |  |  |
| `rows` | `readonly rows: readonly PivotHeaderNode[];` |  | Leaf header of each row / column position in the window. |
| `columns` | `readonly columns: readonly PivotHeaderNode[];` |  |  |
| `rowHeaders` | `readonly rowHeaders: readonly PivotHeaderNode[];` |  | Every header node (any depth, without `children`) whose span overlaps the window. |
| `columnHeaders` | `readonly columnHeaders: readonly PivotHeaderNode[];` |  |  |
| `cells` | `readonly cells: readonly PivotCell[];` |  | `(rowEnd - rowStart) * (columnEnd - columnStart)` cells, row-major. |
| `version` | `version: number;` | inherited |  |
| `model` | `model: PivotModel;` | inherited |  |
| `rowCount` | `rowCount: number;` | inherited |  |
| `columnCount` | `columnCount: number;` | inherited |  |
| `rowDepth` | `rowDepth: number;` | inherited |  |
| `columnDepth` | `columnDepth: number;` | inherited |  |
| `errors` | `errors: readonly PivotModelError[];` | inherited |  |

### PivotWindowRequest

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotWindowRequest

```ts
interface PivotWindowRequest {
    readonly rowStart: number;
    readonly rowEnd: number;
    readonly columnStart: number;
    readonly columnEnd: number;
}
```

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `rowStart` | `readonly rowStart: number;` |  |  |
| `rowEnd` | `readonly rowEnd: number;` |  |  |
| `columnStart` | `readonly columnStart: number;` |  |  |
| `columnEnd` | `readonly columnEnd: number;` |  |  |

### WorkerLike

Kind: interface

Page: https://salmonui.dev/docs/reference/pivot-table/engine/WorkerLike

```ts
interface WorkerLike {
    postMessage(message: unknown): void;
    addEventListener(type: 'message', listener: (event: {
        readonly data: unknown;
    }) => void): void;
    removeEventListener?(type: 'message', listener: (event: {
        readonly data: unknown;
    }) => void): void;
    terminate?(): void;
}
```

What `createPivotWorkerEngine` needs of a `Worker` (a DOM `Worker` or an adapter over `node:worker_threads`).

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `postMessage` | `postMessage(message: unknown): void;` |  |  |
| `addEventListener` | `addEventListener(type: 'message', listener: (event: {     readonly data: unknown; }) => void): void;` |  |  |
| `removeEventListener` | `removeEventListener?(type: 'message', listener: (event: {     readonly data: unknown; }) => void): void;` | optional |  |
| `terminate` | `terminate?(): void;` | optional |  |

## Types

### Json

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/Json

```ts
type Json = null | boolean | number | string | readonly Json[] | {
    readonly [key: string]: Json;
};
```

### PivotAggregate

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotAggregate

```ts
type PivotAggregate = 'sum' | 'product' | 'count' | 'distinctCount' | 'min' | 'max' | 'average' | 'median' | 'populationStdev' | 'sampleStdev' | 'populationVar' | 'sampleVar' | 'custom';
```

### PivotComputeStatus

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotComputeStatus

```ts
type PivotComputeStatus = 'idle' | 'computing' | 'ready' | 'error';
```

### PivotDatePart

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotDatePart

```ts
type PivotDatePart = 'years' | 'quarters' | 'quarterYear' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds';
```

### PivotFieldType

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotFieldType

```ts
type PivotFieldType = 'string' | 'number' | 'date' | 'boolean';
```

### PivotFilter

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotFilter

```ts
type PivotFilter = {
    readonly include: readonly Json[];
} | {
    readonly exclude: readonly Json[];
} | {
    readonly label: {
        readonly operator: PivotLabelOperator;
        readonly value: Json;
        readonly value2?: Json;
        readonly caseSensitive?: boolean;
    };
} | {
    readonly value: {
        readonly measure: string;
        readonly operator: PivotValueOperator;
        readonly value: number;
        readonly value2?: number;
    };
};
```

Member filter (include or exclude member keys), label filter or value filter (-03, -04).

### PivotGrouping

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotGrouping

```ts
type PivotGrouping = {
    readonly kind: 'number';
    readonly start?: number;
    readonly end?: number;
    readonly interval: number;
} | {
    readonly kind: 'date';
    readonly parts: readonly PivotDatePart[];
    readonly start?: string;
    readonly end?: string;
} | {
    readonly kind: 'custom';
    readonly groups: readonly {
        readonly caption: string;
        readonly members: readonly Json[];
    }[];
};
```

### PivotHeaderKind

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotHeaderKind

```ts
type PivotHeaderKind = 'member' | 'subtotal' | 'grandTotal' | 'value';
```

### PivotLabelOperator

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotLabelOperator

```ts
type PivotLabelOperator = 'equal' | 'notEqual' | 'contains' | 'doesNotContain' | 'startsWith' | 'doesNotStartWith' | 'endsWith' | 'doesNotEndWith' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'between' | 'notBetween';
```

Label filter operators reuse the Data Grid `FilterOperator` names.

### PivotMemberPath

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotMemberPath

```ts
type PivotMemberPath = readonly [
    axis: 'rows' | 'columns',
    ...members: Json[]
];
```

Member keys from the axis root, prefixed by the axis: `['rows', 'Asia', 'Japan']`.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `0` | `0: "columns" \| "rows";` | inherited |  |
| `length` | `length: number;` | inherited |  |

### PivotMemberSort

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotMemberSort

```ts
type PivotMemberSort = 'asc' | 'desc' | 'none' | {
    readonly order: readonly Json[];
};
```

### PivotModelInput

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotModelInput

```ts
type PivotModelInput = {
    readonly [K in keyof PivotModel]?: PivotModel[K];
};
```

Every field optional: what callers pass; `normalizePivotModel()` fills the defaults.

Members (16):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `rows` | `rows?: readonly PivotAxisField[];` | optional, inherited |  |
| `columns` | `columns?: readonly PivotAxisField[];` | optional, inherited |  |
| `values` | `values?: readonly PivotValueField[];` | optional, inherited |  |
| `filters` | `filters?: readonly PivotAxisField[];` | optional, inherited |  |
| `filterBy` | `filterBy?: Readonly<Record<string, PivotFilter>>;` | optional, inherited |  |
| `sort` | `sort?: Readonly<Record<string, PivotMemberSort>>;` | optional, inherited |  |
| `valueSort` | `valueSort?: PivotValueSort \| null;` | optional, inherited |  |
| `groups` | `groups?: Readonly<Record<string, PivotGrouping>>;` | optional, inherited |  |
| `calculatedFields` | `calculatedFields?: readonly PivotCalculatedField[];` | optional, inherited |  |
| `formats` | `formats?: Readonly<Record<string, PivotFormat>>;` | optional, inherited |  |
| `conditionalFormats` | `conditionalFormats?: readonly PivotConditionalFormat[];` | optional, inherited |  |
| `expanded` | `expanded?: "all" \| readonly PivotMemberPath[];` | optional, inherited |  |
| `totals` | `totals?: PivotTotals;` | optional, inherited |  |
| `valuesPlacement` | `valuesPlacement?: { readonly axis: "columns" \| "rows"; readonly index: number; };` | optional, inherited |  |
| `showEmptyMembers` | `showEmptyMembers?: boolean;` | optional, inherited |  |
| `showValueHeader` | `showValueHeader?: boolean;` | optional, inherited |  |

### PivotShowAsKind

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotShowAsKind

```ts
type PivotShowAsKind = 'percentOfGrandTotal' | 'percentOfColumnTotal' | 'percentOfRowTotal' | 'percentOfParentTotal' | 'percentOfParentColumnTotal' | 'percentOfParentRowTotal' | 'runningTotal' | 'percentOfRunningTotal' | 'differenceFrom' | 'percentOfDifferenceFrom' | 'index';
```

### PivotValueOperator

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotValueOperator

```ts
type PivotValueOperator = 'equal' | 'notEqual' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'between' | 'notBetween' | 'top' | 'bottom';
```

### PivotWorkerEngineOptions

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotWorkerEngineOptions

```ts
type PivotWorkerEngineOptions = Omit<PivotEngineOptions<unknown>, 'data' | 'customAggregates' | 'getCellValue'> & {
    readonly data: readonly unknown[];
    readonly chunkSize?: number;
};
```

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `fields` | `fields?: readonly PivotFieldDefinition<unknown>[];` | optional, inherited | Inferred from the first rows when omitted. |
| `model` | `model?: PivotModelInput;` | optional, inherited |  |
| `locale` | `locale?: string;` | optional, inherited |  |
| `text` | `text?: PivotEngineText;` | optional, inherited |  |
| `data` | `data: readonly unknown[];` | inherited |  |
| `chunkSize` | `chunkSize?: number;` | optional, inherited | Rows per transfer message (default 20,000). |

### PivotWorkerRequest

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotWorkerRequest

```ts
type PivotWorkerRequest = {
    readonly id: number;
    readonly op: 'chunk';
    readonly rows: readonly unknown[];
} | {
    readonly id: number;
    readonly op: 'init';
    readonly options: Record<string, unknown>;
} | {
    readonly id: number;
    readonly op: 'data';
} | {
    readonly id: number;
    readonly op: 'call';
    readonly method: string;
    readonly args: readonly unknown[];
} | {
    readonly id: number;
    readonly op: 'window';
    readonly request: PivotWindowRequest;
} | {
    readonly id: number;
    readonly op: 'fields';
} | {
    readonly id: number;
    readonly op: 'members';
    readonly field: string;
    readonly options?: {
        readonly search?: string;
        readonly limit?: number;
    };
} | {
    readonly id: number;
    readonly op: 'drill';
    readonly rowIndex: number;
    readonly columnIndex: number;
} | {
    readonly id: number;
    readonly op: 'rows';
    readonly indexes: readonly number[];
};
```

### PivotWorkerResponse

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/PivotWorkerResponse

```ts
type PivotWorkerResponse = {
    readonly id: number;
    readonly ok: true;
    readonly value: unknown;
} | {
    readonly id: number;
    readonly ok: false;
    readonly error: {
        readonly name: string;
        readonly message: string;
        readonly position?: number;
    };
};
```

### WorkerScopeLike

Kind: type

Page: https://salmonui.dev/docs/reference/pivot-table/engine/WorkerScopeLike

```ts
type WorkerScopeLike = WorkerLike;
```

The worker side: a `DedicatedWorkerGlobalScope` or an adapter over `parentPort`.

Members (4):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `postMessage` | `postMessage: (message: unknown) => void;` | inherited |  |
| `addEventListener` | `addEventListener: (type: "message", listener: (event: { readonly data: unknown; }) => void) => void;` | inherited |  |
| `removeEventListener` | `removeEventListener?: ((type: "message", listener: (event: { readonly data: unknown; }) => void) => void);` | optional, inherited |  |
| `terminate` | `terminate?: (() => void);` | optional, inherited |  |

## Constants

### DEFAULT_PIVOT_MODEL

Kind: const

Page: https://salmonui.dev/docs/reference/pivot-table/engine/DEFAULT_PIVOT_MODEL

```ts
const DEFAULT_PIVOT_MODEL: PivotModel;
```

The normalized default model: every field present, nothing placed.

### matchesValueOperator

Kind: const

Page: https://salmonui.dev/docs/reference/pivot-table/engine/matchesValueOperator

```ts
const matchesValueOperator: typeof compareValue;
```

Whether a pivot value operator matches (conditional formats reuse it).

### plainHeader

Kind: const

Page: https://salmonui.dev/docs/reference/pivot-table/engine/plainHeader

```ts
const plainHeader: (h: PivotHeaderNode) => PivotHeaderNode;
```

A header node without `children` (plain JSON, never materializes the subtree).
