serverside_pivot 0.0.95 → 0.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +5 -4
  2. package/dist/react/chunks/ContextMenu-DQGCdUhU.mjs +211 -0
  3. package/dist/react/chunks/{DetailDrawer-DCKIxSpW.mjs → DetailDrawer-yMFRd6Td.mjs} +1 -1
  4. package/dist/react/chunks/{DetailSidePanel-DgUWPBQk.mjs → DetailSidePanel-B6fYMnn7.mjs} +1 -1
  5. package/dist/react/chunks/{DetailSurfaceContent-BEL6xuaZ.mjs → DetailSurfaceContent-B9cfLYti.mjs} +52 -53
  6. package/dist/react/chunks/{ECharts2dRenderer-Dgkp9_1P.mjs → ECharts2dRenderer-ER6rHtch.mjs} +1 -1
  7. package/dist/react/chunks/{ECharts3dRenderer-70VOp8V0.mjs → ECharts3dRenderer-BMVfbpXH.mjs} +1 -1
  8. package/dist/react/chunks/{EditSidePanel-CygqVXLX.mjs → EditSidePanel-BjJd5BaX.mjs} +1 -1
  9. package/dist/react/chunks/{InlineDetailPanel-BUBRWdFW.mjs → InlineDetailPanel-Bbkpv9jz.mjs} +1 -1
  10. package/dist/react/chunks/{PivotCharts-VX5-mEEp.mjs → PivotCharts-P5cBJcwu.mjs} +1209 -1193
  11. package/dist/react/chunks/{ReportEditor-B5j-CU9-.mjs → ReportEditor-P4UZ97Ik.mjs} +493 -468
  12. package/dist/react/chunks/SidebarPanel-DRoxHRhK.mjs +3959 -0
  13. package/dist/react/chunks/{SparklineDetailGraph-Cfe2KcOp.mjs → SparklineDetailGraph-C9UX-feP.mjs} +22 -22
  14. package/dist/react/chunks/clientCoreRuntime-n2guUxhp.mjs +790 -0
  15. package/dist/react/chunks/{installCanvasRenderer-C4h5pc1p.mjs → installCanvasRenderer-BR0XmdVX.mjs} +1 -1
  16. package/dist/react/chunks/react-B5JcZShu.mjs +36775 -0
  17. package/dist/react/chunks/{xlsx.mini.min-CzdkdH3N.mjs → xlsx.mini.min-YUTWASKG.mjs} +1 -1
  18. package/dist/react/components/DashTanstackPivot.react.d.ts +10 -0
  19. package/dist/react/components/GlobalSearchInput.d.ts +17 -0
  20. package/dist/react/components/LiveCellDisplay.d.ts +25 -0
  21. package/dist/react/components/LiveExplainSidePanel.d.ts +15 -0
  22. package/dist/react/components/LiveStreamDiffBar.d.ts +15 -0
  23. package/dist/react/components/ShimmerFallback.d.ts +11 -0
  24. package/dist/react/components/ThemedSelect.d.ts +8 -0
  25. package/dist/react/contexts/PivotThemeContext.d.ts +1 -0
  26. package/dist/react/hooks/useColumnDefs.d.ts +1 -1
  27. package/dist/react/hooks/useDismiss.d.ts +43 -0
  28. package/dist/react/hooks/usePivotNormalization.d.ts +4 -0
  29. package/dist/react/hooks/usePrefersReducedMotion.d.ts +8 -0
  30. package/dist/react/hooks/useRenderHelpers.d.ts +1 -1
  31. package/dist/react/hooks/useRowCache.d.ts +2 -0
  32. package/dist/react/hooks/useServerSideRowModel.d.ts +1 -1
  33. package/dist/react/index.mjs +28 -19
  34. package/dist/react/react.d.ts +7 -2
  35. package/dist/react/runtime/client/clientPivotTransport.d.ts +17 -0
  36. package/dist/react/runtime/client/clientResponsePostProcessor.d.ts +8 -1
  37. package/dist/react/runtime/client/clientSubscriptionEngine.d.ts +88 -0
  38. package/dist/react/runtime/client/duckdbWasmExecutor.d.ts +25 -0
  39. package/dist/react/runtime/client/index.d.ts +1 -0
  40. package/dist/react/runtime/client/types.d.ts +18 -0
  41. package/dist/react/runtime/core/clientCoreRuntime.d.ts +46 -0
  42. package/dist/react/runtime/core/duckdbSqlEmitter.d.ts +37 -0
  43. package/dist/react/runtime/core/semanticIr.generated.d.ts +196 -0
  44. package/dist/react/runtime/responseQueue.d.ts +21 -0
  45. package/dist/react/runtime/rowIdentity.d.ts +20 -0
  46. package/dist/react/runtime/runtimeDomains.d.ts +101 -2
  47. package/dist/react/runtime/streamingTypes.d.ts +182 -0
  48. package/dist/react/runtime/useRuntimeColumnAutoSizing.d.ts +1 -1
  49. package/dist/react/runtime/useRuntimeViewSnapshot.d.ts +1 -1
  50. package/dist/react/runtime/useRuntimeViewportTableData.d.ts +1 -1
  51. package/dist/react/runtime/useViewportSubscriptionStore.d.ts +112 -0
  52. package/dist/react/runtime/useWorkspaceStatusPresentation.d.ts +1 -1
  53. package/dist/react/utils/dataBars.d.ts +1 -0
  54. package/dist/react/utils/domEvents.d.ts +1 -0
  55. package/dist/react/utils/helpers.d.ts +6 -1
  56. package/dist/react/utils/pivotLayoutUtils.d.ts +5 -1
  57. package/dist/react/utils/rowMotion.d.ts +108 -0
  58. package/dist/react/utils/sorting.d.ts +1 -1
  59. package/dist/react/utils/styles.d.ts +1 -0
  60. package/package.json +6 -8
  61. package/dist/react/chunks/ContextMenu-1G-o1ms9.mjs +0 -195
  62. package/dist/react/chunks/SidebarPanel-LXUE6nPd.mjs +0 -3742
  63. package/dist/react/chunks/react-CDa-ADnG.mjs +0 -31199
@@ -0,0 +1,37 @@
1
+ /**
2
+ * DuckDB SQL emitter for the semantic IR (client mode, M3).
3
+ *
4
+ * Emits, for one `PivotQuery` (the wire form in `semanticIr.generated.ts`,
5
+ * generated from `core/spec/semantic-ir.schema.json`), the same flattened,
6
+ * ordered, windowed tree as the Python core's reference strategy
7
+ * (`pivot_engine/core/logical.py` + `core/physical/union_all.py`):
8
+ *
9
+ * rows dims (NULL where rolled up), measures, derived measures, pivot cells, __depth
10
+ *
11
+ * Semantics are those of docs/semantics/SEMANTICS.md; the conformance test
12
+ * `tests/core/test_ts_emitter_conformance.py` executes this SQL on DuckDB
13
+ * (the engine DuckDB-Wasm runs) and requires it to equal the oracle.
14
+ *
15
+ * Everything the emitter cannot express throws `EmitterUnsupported`; it never
16
+ * approximates.
17
+ */
18
+ import type { PivotQuery } from './semanticIr.generated';
19
+ export type TypeFamily = 'string' | 'integer' | 'floating' | 'decimal' | 'boolean' | 'date' | 'timestamp' | 'other';
20
+ export interface ColumnInfo {
21
+ family: TypeFamily;
22
+ sqlType: string;
23
+ }
24
+ export interface EmitOptions {
25
+ table: string;
26
+ columns: Record<string, ColumnInfo>;
27
+ }
28
+ export declare class EmitterUnsupported extends Error {
29
+ constructor(message: string);
30
+ }
31
+ export declare const DEPTH = "__depth";
32
+ export declare function quoteIdent(name: string): string;
33
+ export declare function cellName(memberIndex: number, alias: string): string;
34
+ /** Output value columns: measures, derived measures, then cells (as `PivotQuery.value_columns`). */
35
+ export declare function valueColumns(query: PivotQuery): string[];
36
+ export declare function emitColumnMembersSql(query: PivotQuery, options: EmitOptions): string;
37
+ export declare function emitPivotSql(query: PivotQuery, options: EmitOptions): string;
@@ -0,0 +1,196 @@
1
+ /**
2
+ * This file was automatically generated by json-schema-to-typescript.
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
+ * and run json-schema-to-typescript to regenerate this file.
5
+ */
6
+ export type Filter = Predicate | Group;
7
+ /**
8
+ * Wire form of the semantic IR (pivot_engine.core.ir.PivotQuery). Shared by the Python core, the TS emitter (M3) and the conformance vectors. Aggregation names come from aggregation-registry.json.
9
+ */
10
+ export interface PivotQuery {
11
+ dataset?: string;
12
+ rows: string[];
13
+ /**
14
+ * @minItems 1
15
+ */
16
+ measures: [
17
+ {
18
+ alias: string;
19
+ agg: string;
20
+ field?: string | null;
21
+ weight?: string | null;
22
+ q?: number | null;
23
+ /**
24
+ * first / last (REQ-AGG-008): the field whose smallest / largest value picks the record.
25
+ */
26
+ orderBy?: string;
27
+ /**
28
+ * REQ-AGG-010: a formula's expression tree {op, args}, evaluated on each node's measures (agg 'formula').
29
+ */
30
+ expr?: {
31
+ [k: string]: unknown;
32
+ };
33
+ },
34
+ ...{
35
+ alias: string;
36
+ agg: string;
37
+ field?: string | null;
38
+ weight?: string | null;
39
+ q?: number | null;
40
+ /**
41
+ * first / last (REQ-AGG-008): the field whose smallest / largest value picks the record.
42
+ */
43
+ orderBy?: string;
44
+ /**
45
+ * REQ-AGG-010: a formula's expression tree {op, args}, evaluated on each node's measures (agg 'formula').
46
+ */
47
+ expr?: {
48
+ [k: string]: unknown;
49
+ };
50
+ }[]
51
+ ];
52
+ filters?: Filter[];
53
+ measureFilters?: {
54
+ level: number;
55
+ measure: string;
56
+ op: "=" | "!=" | ">" | ">=" | "<" | "<=";
57
+ value: unknown;
58
+ /**
59
+ * REQ-DIM-006: group by the level's path and every column dimension (a pivot cell's grain). Omitted when false.
60
+ */
61
+ cells?: boolean;
62
+ }[];
63
+ sort?: {
64
+ field: string;
65
+ desc?: boolean;
66
+ absolute?: boolean;
67
+ /**
68
+ * REQ-SORT-003: order a row dimension's members by MIN of this column over each member's records.
69
+ */
70
+ by?: string;
71
+ /**
72
+ * REQ-SORT-004: order a measure by the node's value within this column member (a pivot cell).
73
+ */
74
+ member?: unknown[];
75
+ /**
76
+ * REQ-SORT-005: order a text row dimension's members by a key computed from the member value.
77
+ */
78
+ semantic?: "tenor";
79
+ /**
80
+ * REQ-SORT-006: NULLs before every value, in both directions. Omitted when false.
81
+ */
82
+ nullsFirst?: boolean;
83
+ }[];
84
+ totals?: "visible" | "all_data";
85
+ /**
86
+ * REQ-LAYOUT-001: a group row before its descendants (pre-order, default) or after them (post-order). 'none' (REQ-LAYOUT-002): no group rows, the leaves as a flat table ordered by the sort entries.
87
+ */
88
+ subtotals?: "before" | "after" | "none";
89
+ expanded?: [unknown, ...unknown[]][] | null;
90
+ window?: {
91
+ offset?: number;
92
+ limit?: number | null;
93
+ };
94
+ columns?: string[];
95
+ columnMembers?: unknown[][];
96
+ derived?: {
97
+ alias: string;
98
+ func: "ratio" | "percent_of_total" | "rank" | "dense_rank" | "cumulative" | "moving_avg";
99
+ of: string;
100
+ of2?: string | null;
101
+ desc?: boolean;
102
+ /**
103
+ * @minItems 2
104
+ * @maxItems 2
105
+ */
106
+ frame?: [number | null, number | null] | null;
107
+ nullValue?: number | null;
108
+ }[];
109
+ /**
110
+ * REQ-DIM-001: user-defined dimension columns, computed in order before filters. Each record gets the label of the first rule whose condition holds, else the fallback.
111
+ */
112
+ categories?: {
113
+ name: string;
114
+ rules: {
115
+ when: Filter;
116
+ label: string | number;
117
+ }[];
118
+ fallback: string | number;
119
+ }[];
120
+ /**
121
+ * REQ-DIM-002: the measure axis. Each record becomes one record per member, with the member's label, its source value and its order; applied after the categories, before the row filters.
122
+ */
123
+ unpivot?: {
124
+ label: string;
125
+ value: string;
126
+ key: string;
127
+ dropNulls?: boolean;
128
+ /**
129
+ * @minItems 1
130
+ */
131
+ members: [
132
+ {
133
+ label: string;
134
+ field: string | null;
135
+ order: number;
136
+ /**
137
+ * REQ-DIM-003: the member's own aggregation (all members or none); the value measure is then agg 'member'.
138
+ */
139
+ agg?: string;
140
+ weight?: string;
141
+ q?: number;
142
+ orderBy?: string;
143
+ /**
144
+ * REQ-DIM-007: a formula member's expression (agg 'formula', no field).
145
+ */
146
+ expr?: {
147
+ [k: string]: unknown;
148
+ };
149
+ },
150
+ ...{
151
+ label: string;
152
+ field: string | null;
153
+ order: number;
154
+ /**
155
+ * REQ-DIM-003: the member's own aggregation (all members or none); the value measure is then agg 'member'.
156
+ */
157
+ agg?: string;
158
+ weight?: string;
159
+ q?: number;
160
+ orderBy?: string;
161
+ /**
162
+ * REQ-DIM-007: a formula member's expression (agg 'formula', no field).
163
+ */
164
+ expr?: {
165
+ [k: string]: unknown;
166
+ };
167
+ }[]
168
+ ];
169
+ };
170
+ /**
171
+ * REQ-DIM-005: a ragged hierarchy over these fields; the rows are its positional columns __rag1..n (a NULL there is no node).
172
+ */
173
+ ragged?: {
174
+ /**
175
+ * @minItems 1
176
+ */
177
+ fields: [string, ...string[]];
178
+ /**
179
+ * values that count as missing (default: the empty text); NULL and NaN always do
180
+ */
181
+ missing?: unknown[];
182
+ };
183
+ }
184
+ export interface Predicate {
185
+ field: string;
186
+ op: "!=" | "<" | "<=" | "=" | ">" | ">=" | "between" | "contains" | "ends_with" | "in" | "is_empty" | "is_not_empty" | "is_not_null" | "is_null" | "not_contains" | "not_in" | "starts_with";
187
+ value?: unknown;
188
+ caseSensitive?: boolean;
189
+ }
190
+ export interface Group {
191
+ op: "and" | "or";
192
+ /**
193
+ * @minItems 1
194
+ */
195
+ conditions: [Filter, ...Filter[]];
196
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Ordered delivery of runtime responses (M3).
3
+ *
4
+ * Responses of every kind (data, filter options, chart, detail, export...) reach
5
+ * the UI through one `runtimeResponse` value. Writing it as a single slot loses
6
+ * responses: two arriving in the same tick are batched by React and only the
7
+ * last is ever rendered, so e.g. filter options or a detail page vanish when a
8
+ * viewport response lands with them. The queue delivers each response, in
9
+ * arrival order, for one commit each; consumers keep their per-kind requestId
10
+ * and state-epoch checks, which reject superseded responses.
11
+ */
12
+ export interface ResponseQueueState<T> {
13
+ head: T | null;
14
+ pending: T[];
15
+ }
16
+ export declare const EMPTY_RESPONSE_QUEUE: ResponseQueueState<never>;
17
+ export declare function enqueueResponse<T>(state: ResponseQueueState<T>, response: T): ResponseQueueState<T>;
18
+ /** After consumers have seen `head`, move to the next pending response (no change when none is pending). */
19
+ export declare function advanceResponse<T>(state: ResponseQueueState<T>): ResponseQueueState<T>;
20
+ /** [response to render, enqueue]. Each queued response is rendered for at least one commit. */
21
+ export declare function useResponseQueue<T>(): [T | null, (response: T) => void];
@@ -0,0 +1,20 @@
1
+ /**
2
+ * One row identity for the whole frontend (REQ-ID-001).
3
+ *
4
+ * The canonical key is the typed path encoded by `CanonicalPathCodec`
5
+ * (`_rowKey` from the core, `_canonicalPath` from the live engine; same
6
+ * encoding, "[]" for the grand total). Display paths (`a|||b`) are ambiguous:
7
+ * NULL and "" render alike and members may contain the separator, so they are
8
+ * used only for rows that carry no canonical key (legacy responses).
9
+ */
10
+ type RowLike = {
11
+ [key: string]: unknown;
12
+ } | null | undefined;
13
+ export declare function canonicalRowKey(row: RowLike): string;
14
+ /** The display path, or null when the row has none ("" is a real, ambiguous display path). */
15
+ export declare function displayRowKey(row: RowLike): string | null;
16
+ /** The key to index and look up a row by: canonical when known, else its display path. */
17
+ export declare function rowIdentity(row: RowLike): string;
18
+ /** Display keys shared by more than one canonical row in a frame (they cannot identify a row). */
19
+ export declare function ambiguousDisplayKeys(rows: RowLike[]): Set<string>;
20
+ export {};
@@ -1,5 +1,7 @@
1
1
  import type React from 'react';
2
+ import type { DiffConfig, StreamUpdateBatch, StreamingConfig } from './streamingTypes';
2
3
  import type { JsonObject, RuntimeCommandKind, RuntimeRequestV1, RuntimeResponseV1 } from './runtimeContract';
4
+ import type { ViewportSubscriptionStore } from './useViewportSubscriptionStore';
3
5
  /** Public Dash props accepted by the runtime root. */
4
6
  export interface PivotRuntimeProps {
5
7
  id?: string;
@@ -20,6 +22,8 @@ export interface PivotRuntimeProps {
20
22
  showRowTotals?: boolean;
21
23
  showColTotals?: boolean;
22
24
  showSubtotals?: boolean;
25
+ /** Controls Grand Total row visibility in pivot, tree, and report modes. Defaults to `showColTotals` in pivot/report mode or `treeConfig.showGrandTotal` in tree mode. */
26
+ showGrandTotal?: boolean;
23
27
  grandTotalPosition?: 'top' | 'bottom';
24
28
  runtimeRequest?: PivotObject;
25
29
  runtimeResponse?: RuntimeResponseV1 | PivotObject;
@@ -66,7 +70,8 @@ export interface PivotRuntimeProps {
66
70
  sortLock?: boolean;
67
71
  defaultTheme?: PivotThemeName;
68
72
  theme?: PivotThemeName;
69
- themeOverrides?: PivotObject;
73
+ themeOverrides?: PivotThemeOverrides | PivotObject;
74
+ /** Opt in to loading Inter, JetBrains Mono and Plus Jakarta Sans from Google Fonts. Default false: no third-party requests; system UI fonts are used unless the host loads them. */
70
75
  loadWebFonts?: boolean;
71
76
  immersiveExitPosition?: 'top-right' | 'bottom-right' | 'hidden';
72
77
  groupAllowUnbalanced?: boolean;
@@ -75,7 +80,14 @@ export interface PivotRuntimeProps {
75
80
  rowHeaderLabel?: string | ((rowFields: readonly string[]) => string);
76
81
  valueScale?: number;
77
82
  unitSuffix?: string;
78
- fitToWidth?: boolean;
83
+ /** Fits columns to the container using formatted, loaded rows. At the font floor, wide values can require horizontal scrolling. */
84
+ fitToWidth?: boolean | {
85
+ enabled?: boolean;
86
+ minFontSize?: number;
87
+ };
88
+ /** Minimum font size (px) when `fitToWidth` scales text down. Can also be set via `themeOverrides.minFontSize`. Defaults to `10`. */
89
+ minFontSize?: number;
90
+ fitMinFontSize?: number;
79
91
  autoSizeStrategy?: 'fitGridWidth' | 'fitCellContents' | string;
80
92
  duckdbBundleUrl?: string;
81
93
  sortEvent?: PivotObject;
@@ -87,6 +99,9 @@ export interface PivotRuntimeProps {
87
99
  activeReportId?: string;
88
100
  rowSelection?: 'single' | 'multiple' | boolean;
89
101
  selectedRows?: readonly string[];
102
+ streamingConfig?: StreamingConfig;
103
+ streamUpdates?: StreamUpdateBatch;
104
+ diffConfig?: DiffConfig;
90
105
  }
91
106
  export interface PivotRuntimeRow {
92
107
  readonly id?: string | number;
@@ -95,6 +110,7 @@ export interface PivotRuntimeRow {
95
110
  }
96
111
  export type PivotThemeName = 'flash' | 'dark' | 'bloomberg_black' | 'bloomberg' | 'light' | 'material' | 'balham' | 'strata' | 'crystal' | 'alabaster' | 'satin' | (string & {});
97
112
  export interface ValConfig {
113
+ id?: string;
98
114
  field?: string;
99
115
  agg?: 'sum' | 'avg' | 'count' | 'min' | 'max' | 'weighted_avg' | 'wavg' | 'weighted_mean' | 'array_agg' | 'formula' | (string & {});
100
116
  weightField?: string;
@@ -104,6 +120,11 @@ export interface ValConfig {
104
120
  separator?: string;
105
121
  formula?: string;
106
122
  label?: string;
123
+ /** Compact header label used when the column is narrow (`< 80px` or narrower than full header label). */
124
+ shortLabel?: string;
125
+ headerGroup?: string;
126
+ valueScale?: number;
127
+ unitSuffix?: string;
107
128
  formulaRef?: string;
108
129
  formulaScope?: 'measures' | 'columns';
109
130
  headerStyle?: React.CSSProperties | PivotObject;
@@ -113,6 +134,81 @@ export interface ValConfig {
113
134
  sparkline?: boolean | PivotObject;
114
135
  [key: string]: unknown;
115
136
  }
137
+ /**
138
+ * Theme token overrides accepted by `themeOverrides`.
139
+ *
140
+ * Surface mapping:
141
+ * - Grid & chrome: `pageBg` / `background` (outer frame), `surfaceBg` (default cells), `headerBg` (top bar & regular column headers), `headerGroupBg` / `headerGroupText` (multi-level group headers, falling back to `headerSubtleBg` / `headerBg`).
142
+ * - Row-header / hierarchy column: `hierarchyBg` drives the `hierarchy` column header and body fallback; derives from overridden `headerSubtleBg` / `headerBg` / `surfaceInset` or `primary` when not explicitly set.
143
+ * - Body rows: `groupBg` / `groupText` / `groupFontWeight` (depth arrays or single values for parent/group rows) and `leafBg` / `leafFontWeight` (leaf rows).
144
+ * - Totals & pinned Grand Total: `totalBg` / `totalText` style subtotals & total columns; `totalBgStrong` / `totalTextStrong` style the pinned/summary Grand Total row (deriving from overridden `totalBg` / `totalText` when not explicitly set).
145
+ * - Headers & fitting: `headerWrap` (wraps on spaces), `headerControls` (`'always' | 'hover' | 'never'`), `showAbsoluteSortBadge`, `fontSize`, `minFontSize`.
146
+ */
147
+ export interface PivotThemeOverrides {
148
+ /** Outer brand accent & sort/focus border highlight. */
149
+ primary?: string;
150
+ border?: string;
151
+ borderStrong?: string;
152
+ pageBg?: string;
153
+ background?: string;
154
+ surfaceBg?: string;
155
+ surfaceMuted?: string;
156
+ surfaceInset?: string;
157
+ sidebarBg?: string;
158
+ /** Column header & app-bar background; also drives `hierarchyBg` fallback when overridden. */
159
+ headerBg?: string;
160
+ headerSubtleBg?: string;
161
+ headerGroupBg?: string;
162
+ headerGroupText?: string;
163
+ /** Row-header (`hierarchy`) column & header background. Derives from `headerBg`/`headerSubtleBg` when omitted. */
164
+ hierarchyBg?: string;
165
+ /** Depth-indexed or scalar fill for expandable parent rows. */
166
+ groupBg?: string | readonly string[];
167
+ groupText?: string | readonly string[];
168
+ groupFontWeight?: number | readonly number[];
169
+ /** Fill and weight for leaf rows. */
170
+ leafBg?: string;
171
+ leafFontWeight?: number;
172
+ /** Fill and text for subtotal rows & total columns; also drives `totalBgStrong`/`totalTextStrong` when omitted. */
173
+ totalBg?: string;
174
+ totalText?: string;
175
+ /** Fill and text for pinned / summary Grand Total rows & group headers. */
176
+ totalBgStrong?: string;
177
+ totalTextStrong?: string;
178
+ totalBorder?: string;
179
+ totalFontWeight?: number;
180
+ text?: string;
181
+ textSec?: string;
182
+ textSoft?: string;
183
+ hover?: string;
184
+ hoverStrong?: string;
185
+ rowHoverBg?: string;
186
+ select?: string;
187
+ gridLines?: 'both' | 'horizontal' | 'vertical' | 'none';
188
+ rowBorder?: string;
189
+ columnBorder?: string;
190
+ fontFamily?: string;
191
+ numericFontFamily?: string;
192
+ fontSize?: number | string;
193
+ /** Minimum font size (px) when `fitToWidth` scales text down. Defaults to `10`. */
194
+ minFontSize?: number;
195
+ fitMinFontSize?: number;
196
+ headerFontSize?: number | string;
197
+ headerGroupFontSize?: number | string;
198
+ headerLineHeight?: number | string;
199
+ headerWrap?: boolean;
200
+ headerControls?: 'always' | 'hover' | 'never';
201
+ /** Explicitly show or hide the `|x|` absolute-sort badge; defaults to following `headerControls`. */
202
+ showAbsoluteSortBadge?: boolean;
203
+ showSortPriority?: boolean;
204
+ sortIndicator?: 'arrow' | 'none' | string;
205
+ cellPaddingX?: number | string;
206
+ headerPaddingX?: number | string;
207
+ numericPaddingRight?: number | string;
208
+ rowHeight?: number;
209
+ headerHeight?: number;
210
+ [token: string]: unknown;
211
+ }
116
212
  export type PivotValueConfig = ValConfig;
117
213
  export interface FilterCondition {
118
214
  type?: string;
@@ -387,6 +483,7 @@ export interface WorkspacePresentation {
387
483
  readonly customDimensions: WorkspaceCollection;
388
484
  readonly dataBarsColumns: readonly string[];
389
485
  readonly dataBarMaximums: WorkspaceRecord;
486
+ readonly dataBarVariant?: 'fill' | 'underbar';
390
487
  readonly decimalPlaces: number;
391
488
  readonly defaultValueFormat: string;
392
489
  readonly detailConfig: WorkspaceRecord | null;
@@ -529,6 +626,7 @@ export interface WorkspacePresentation {
529
626
  readonly setCustomDimensions: RuntimeCommand;
530
627
  readonly setDataBarsColumns: RuntimeCommand;
531
628
  readonly setDataBarMaximums: RuntimeCommand;
629
+ readonly setDataBarVariant?: RuntimeCommand;
532
630
  readonly setDecimalPlaces: RuntimeCommand;
533
631
  readonly setDefaultValueFormat: RuntimeCommand;
534
632
  readonly setDetailSurface: RuntimeCommand;
@@ -609,6 +707,7 @@ export interface WorkspacePresentation {
609
707
  readonly virtualRows: WorkspaceCollection;
610
708
  readonly visibleLeafColumns: WorkspaceCollection;
611
709
  readonly zoomLevel: number;
710
+ readonly liveSubscriptionStore?: ViewportSubscriptionStore | null;
612
711
  }
613
712
  /** Narrow workspace-to-transport port for server chart request scheduling. */
614
713
  export interface WorkspaceChartRequestPort {
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Protocol V2 streaming & baseline diff contracts shared across:
3
+ * - Server-side FastAPI SSE (`/v1/runtime/stream` + `/v1/runtime/subscription`)
4
+ * - Server-side Dash same-origin fast-lane (`/_serverside_pivot/subscription`)
5
+ * - Client-side in-browser engine (`ClientSubscriptionEngine` over DuckDB-Wasm / memory)
6
+ */
7
+ export type DiffDisplayMode = 'value' | 'delta' | 'pctDelta' | 'split';
8
+ export type SortLockMode = 'in_place' | 'live_rank';
9
+ export type SourceCapabilityTier = 'exact_cdc' | 'tier_1_exact_cdc' | 'change_token' | 'tier_2_change_token' | 'time_travel_only' | 'tier_3_time_travel_only' | 'periodic_refresh' | 'tier_4_periodic_refresh';
10
+ export type SubscriptionTransportKind = 'auto' | 'sse' | 'dash' | 'client';
11
+ export interface WireDecimal {
12
+ readonly __decimal__: string;
13
+ readonly scale?: number;
14
+ }
15
+ export declare function isWireDecimal(value: unknown): value is WireDecimal;
16
+ /** Decode a Protocol V2 wire value into a JS number (for charts/bars) or keep primitive. */
17
+ export declare function decodeWireNumeric(value: unknown): number | null;
18
+ /** Format an exact WireDecimal string with optional grouping without IEEE-754 rounding loss. */
19
+ export declare function formatWireDecimalString(wire: WireDecimal, decimalPlaces?: number | null): string;
20
+ export interface StreamingConfig {
21
+ readonly enabled?: boolean;
22
+ readonly transport?: SubscriptionTransportKind;
23
+ /** FastAPI subscription endpoint (default `/v1/runtime/subscription`). */
24
+ readonly subscriptionEndpoint?: string;
25
+ /** FastAPI SSE endpoint (default `/v1/runtime/stream`). */
26
+ readonly streamEndpoint?: string;
27
+ /** Dash fast-lane endpoint (default `/_serverside_pivot/subscription`). */
28
+ readonly dashEndpoint?: string;
29
+ /** Flush / poll cadence in milliseconds (default 250). */
30
+ readonly cadenceMs?: number;
31
+ /** Default sort lock mode (`in_place` prevents row jumping during live ticks). */
32
+ readonly sortLock?: SortLockMode;
33
+ /** Enable GPU directional flash animations on cell ticks (default true). */
34
+ readonly flashEnabled?: boolean;
35
+ /** Flash duration in milliseconds (default 550). */
36
+ readonly flashDurationMs?: number;
37
+ /** Show live rolling 30-point sparkline inside cell hover tooltip (default true). */
38
+ readonly showSparklineTooltip?: boolean;
39
+ /** Primary key fields for client-side stream mutation batches. */
40
+ readonly keyFields?: readonly string[];
41
+ /** Optional HTTP headers forwarded to FastAPI endpoints. */
42
+ readonly headers?: Readonly<Record<string, string>>;
43
+ }
44
+ export interface DiffConfig {
45
+ readonly enabled?: boolean;
46
+ readonly baselineId?: string | null;
47
+ readonly baselineLabel?: string | null;
48
+ readonly displayMode?: DiffDisplayMode;
49
+ readonly changedOnly?: boolean;
50
+ readonly showPnlExplain?: boolean;
51
+ }
52
+ export interface StreamUpdateBatch {
53
+ readonly mode?: 'insert' | 'update' | 'upsert' | 'delete';
54
+ readonly rows?: readonly Record<string, unknown>[];
55
+ readonly keyFields?: readonly string[];
56
+ readonly batchId?: string | number;
57
+ }
58
+ export interface VarianceDriver {
59
+ readonly path: string;
60
+ readonly label: string;
61
+ readonly delta: unknown;
62
+ readonly pctDelta?: number | null;
63
+ }
64
+ export interface BaselineCellDiff {
65
+ readonly baselineValue: unknown;
66
+ readonly delta: unknown;
67
+ readonly pctDelta: number | null;
68
+ readonly deltaUnit?: 'abs' | 'pp';
69
+ }
70
+ export interface StreamCellPatch {
71
+ readonly rowKey: string;
72
+ readonly displayPath?: string;
73
+ readonly colId: string;
74
+ readonly value: unknown;
75
+ readonly prevValue?: unknown;
76
+ readonly delta?: unknown;
77
+ readonly pctDelta?: number | null;
78
+ readonly direction?: 'up' | 'down' | 'flat' | null;
79
+ readonly baseline?: BaselineCellDiff | null;
80
+ }
81
+ export interface StreamRowPatch {
82
+ readonly op: 'insert' | 'update' | 'remove';
83
+ readonly rowKey: string;
84
+ readonly displayPath?: string;
85
+ readonly row?: Record<string, unknown>;
86
+ readonly index?: number;
87
+ }
88
+ export interface BaselineDescriptor {
89
+ readonly snapshotId: string;
90
+ readonly label: string;
91
+ readonly kind: 'baseline' | 'freeze_snapshot';
92
+ readonly sourceRevision: number;
93
+ readonly schemaVersion?: string;
94
+ readonly strategy?: string;
95
+ readonly createdAt: number;
96
+ readonly expiresAt?: number;
97
+ readonly immutableVerified?: boolean;
98
+ }
99
+ export interface ProtocolV2Frame {
100
+ readonly type: 'SNAPSHOT' | 'PATCH' | 'HEARTBEAT' | 'INVALIDATE' | 'AUTH_REVOKED' | 'ERROR';
101
+ readonly protocolVersion?: number;
102
+ readonly subscriptionId?: string;
103
+ readonly serverEpochId?: string;
104
+ readonly queryEpoch?: number;
105
+ readonly schemaVersion?: string;
106
+ readonly sourceRevision?: number;
107
+ readonly seq?: number;
108
+ readonly baseSeq?: number;
109
+ readonly totalRows?: number;
110
+ readonly rows?: readonly Record<string, unknown>[];
111
+ readonly grandTotal?: Record<string, unknown> | null;
112
+ readonly cellPatches?: readonly StreamCellPatch[];
113
+ readonly rowPatches?: readonly StreamRowPatch[];
114
+ readonly bufferedUpdates?: number;
115
+ readonly paused?: boolean;
116
+ readonly frozenSnapshotId?: string | null;
117
+ readonly baselineId?: string | null;
118
+ readonly baselineLabel?: string | null;
119
+ readonly sortLock?: SortLockMode;
120
+ readonly capabilityTier?: SourceCapabilityTier;
121
+ readonly supportsExactRowDeltas?: boolean;
122
+ readonly reason?: string;
123
+ readonly error?: string;
124
+ readonly timestamp?: number;
125
+ }
126
+ export type RowLifecycleKind = 'normal' | 'new' | 'removed';
127
+ export interface CellLiveMeta {
128
+ readonly rowKey: string;
129
+ readonly colId: string;
130
+ readonly value: unknown;
131
+ readonly prevValue: unknown;
132
+ readonly tickSeq: number;
133
+ readonly tickDir: 'up' | 'down' | null;
134
+ readonly tickDelta: unknown;
135
+ readonly tickPct: number | null;
136
+ readonly baselineValue: unknown;
137
+ readonly baselineDelta: unknown;
138
+ readonly baselinePct: number | null;
139
+ readonly deltaUnit: 'abs' | 'pp';
140
+ readonly sparklineHistory: readonly number[];
141
+ readonly varianceDrivers: readonly VarianceDriver[];
142
+ readonly rowLifecycle: RowLifecycleKind;
143
+ readonly softStale: boolean;
144
+ readonly updatedAt: number;
145
+ }
146
+ export type ConnectionStatus = 'idle' | 'connecting' | 'live' | 'paused' | 'frozen' | 'resyncing' | 'auth_revoked' | 'error';
147
+ export interface PinnedExplainCell {
148
+ readonly rowKey: string;
149
+ readonly colId: string;
150
+ readonly rowLabel: string;
151
+ readonly colLabel: string;
152
+ }
153
+ export interface SubscriptionStatusSnapshot {
154
+ readonly active: boolean;
155
+ readonly connectionStatus: ConnectionStatus;
156
+ readonly capabilityTier: SourceCapabilityTier;
157
+ readonly supportsExactRowDeltas: boolean;
158
+ readonly subscriptionId: string | null;
159
+ readonly serverEpochId: string | null;
160
+ readonly sourceRevision: number;
161
+ readonly lastAckSeq: number;
162
+ readonly queryEpoch: number;
163
+ readonly paused: boolean;
164
+ readonly bufferedUpdates: number;
165
+ readonly frozenSnapshotId: string | null;
166
+ readonly frozenRevision: number | null;
167
+ readonly cadenceMs: number;
168
+ readonly sortLock: SortLockMode;
169
+ readonly diffDisplayMode: DiffDisplayMode;
170
+ readonly changedOnly: boolean;
171
+ readonly activeBaselineId: string | null;
172
+ readonly activeBaselineLabel: string | null;
173
+ readonly baselines: readonly BaselineDescriptor[];
174
+ readonly lastError: string | null;
175
+ readonly lastFrameAt: number | null;
176
+ readonly tickCount: number;
177
+ readonly flashEnabled: boolean;
178
+ readonly flashDurationMs: number;
179
+ readonly showSparklineTooltip: boolean;
180
+ readonly showPnlExplain: boolean;
181
+ readonly pinnedExplainCell: PinnedExplainCell | null;
182
+ }
@@ -1,2 +1,2 @@
1
1
  /** Owns measured column sizing and its toolbar command. @param {any} p0 @returns {any} */
2
- export function useRuntimeColumnAutoSizing({ autoSizeBounds, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, decimalPlaces, defaultValueFormat, fontFamily, fontSize, getAutoSizeSampleRows, getDisplayHeaderTextStackForColumn, getRenderedCellWidthForColumn, getRenderedHeaderWidthForColumn, matchesSelectedColumnToValueConfig, numberGroupSeparator, queueHeaderFitValidation, table, valConfigs, }: any): any;
2
+ export function useRuntimeColumnAutoSizing({ autoSizeBounds, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, decimalPlaces, defaultValueFormat, fontFamily, fontSize, getAutoSizeSampleRows, getDisplayHeaderTextStackForColumn, getRenderedCellWidthForColumn, getRenderedHeaderWidthForColumn, matchesSelectedColumnToValueConfig, numberGroupSeparator, queueHeaderFitValidation, table, valConfigs, valueScale, unitSuffix, }: any): any;
@@ -6,4 +6,4 @@
6
6
  * intentionally explicit: this is the persistence boundary for user-visible
7
7
  * workspace state, not another consumer of the mutable legacy environment.
8
8
  @param {any} p0 @returns {any} */
9
- export function useRuntimeViewSnapshot({ activeChartDefinitionId, activeReportId, cellFormatRules, chartCanvasPanes, chartPanelAxisMode, chartPanelBarLayout, chartPanelColumnLimit, chartPanelFloating, chartPanelFloatingRect, chartPanelGraphHeight, chartPanelHierarchyLevel, chartPanelInteractionMode, chartPanelLayers, chartPanelLocked, chartPanelLockedModel, chartPanelLockedRequest, chartPanelOpen, chartPanelOrientation, chartPanelRowLimit, chartPanelServerScope, chartPanelSortMode, chartPanelSource, chartPanelTitle, chartPanelType, chartPanelWidth, colExpanded, colFields, colSearch, colTypeFilter, colorPalette, colorScaleMode, colorScaleColumns, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, columnOrder, pivotLayoutOrder, pivotPinnedLayoutIds, columnPinning, columnSizing, columnVisibility, customDimensions, dataBarsColumns, dataBarMaximums, decimalPlaces, defaultValueFormat, detailConfig, detailMode, editValueDisplayMode, expanded, fieldPanelSizes, filters, frozenPivotConfig, grandTotalPinOverride, latestViewportRef, layoutMode, managedChartDefinitions, normalizedChartServerWindow, normalizedInitialValConfigs, numberGroupSeparator, parentRef, pivotColumnSorting, reportDef, rowFields, rowPinning, runtimeMeasureAxis, saveViewTrigger, savePersistedState, savedReports, serializedEditComparisonState, setPropsRef, showColTotals, showFloatingFilters, showNotification, showReportConfigColumn, showRowNumbers, showRowTotals, showSubtotals, sidebarOpen, sidebarTab, sidebarWidth, sorting, spacingMode, stickyHeaders, tableCanvasSize, tableName, themeName, themeOverrides, treeConfig, valConfigs, viewMode, zoomLevel, }: any): any;
9
+ export function useRuntimeViewSnapshot({ activeChartDefinitionId, activeReportId, cellFormatRules, chartCanvasPanes, chartPanelAxisMode, chartPanelBarLayout, chartPanelColumnLimit, chartPanelFloating, chartPanelFloatingRect, chartPanelGraphHeight, chartPanelHierarchyLevel, chartPanelInteractionMode, chartPanelLayers, chartPanelLocked, chartPanelLockedModel, chartPanelLockedRequest, chartPanelOpen, chartPanelOrientation, chartPanelRowLimit, chartPanelServerScope, chartPanelSortMode, chartPanelSource, chartPanelTitle, chartPanelType, chartPanelWidth, colExpanded, colFields, colSearch, colTypeFilter, colorPalette, colorScaleMode, colorScaleColumns, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, columnOrder, pivotLayoutOrder, pivotPinnedLayoutIds, columnPinning, columnSizing, columnVisibility, customDimensions, dataBarsColumns, dataBarMaximums, dataBarVariant, decimalPlaces, defaultValueFormat, detailConfig, detailMode, editValueDisplayMode, expanded, fieldPanelSizes, filters, frozenPivotConfig, grandTotalPinOverride, latestViewportRef, layoutMode, managedChartDefinitions, normalizedChartServerWindow, normalizedInitialValConfigs, numberGroupSeparator, parentRef, pivotColumnSorting, reportDef, rowFields, rowPinning, runtimeMeasureAxis, saveViewTrigger, savePersistedState, savedReports, serializedEditComparisonState, setPropsRef, showColTotals, showFloatingFilters, showNotification, showReportConfigColumn, showRowNumbers, showRowTotals, showSubtotals, sidebarOpen, sidebarTab, sidebarWidth, sorting, spacingMode, stickyHeaders, tableCanvasSize, tableName, themeName, themeOverrides, treeConfig, valConfigs, viewMode, zoomLevel, }: any): any;
@@ -1,2 +1,2 @@
1
1
  /** Builds the table's rendered rows while preserving server pinning and edit comparison state. @param {any} p0 @returns {any} */
2
- export function useRuntimeViewportTableData({ comparisonCellCountsRef, comparisonCellEpoch, comparisonCellOriginalValuesRef, comparisonValueState, editValueDisplayMode, filteredData, grandTotalRow, nodes, pinnedRowCacheRef, renderedData, rowPinning, serverSide, serverSidePinsGrandTotal, showColTotals, tableDataRef, total, }: any): any;
2
+ export function useRuntimeViewportTableData({ comparisonCellCountsRef, comparisonCellEpoch, comparisonCellOriginalValuesRef, comparisonValueState, editValueDisplayMode, filteredData, grandTotalRow, nodes, pinnedRowCacheRef, renderedData, rowPinning, serverSide, serverSidePinsGrandTotal, showColTotals, tableDataRef, total, liveSubscriptionStore, liveChangedOnly, liveChangedRevision, }: any): any;