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
@@ -1,4 +1,4 @@
1
- import { g as Zf } from "./react-CDa-ADnG.mjs";
1
+ import { g as Zf } from "./react-B5JcZShu.mjs";
2
2
  function qf(Rt, wr) {
3
3
  for (var Zt = 0; Zt < wr.length; Zt++) {
4
4
  const St = wr[Zt];
@@ -103,6 +103,9 @@ export interface DashTanstackPivotProps {
103
103
  activeReportId?: string;
104
104
  rowSelection?: string | boolean;
105
105
  selectedRows?: Array<string>;
106
+ streamingConfig?: object;
107
+ streamUpdates?: object;
108
+ diffConfig?: object;
106
109
  }
107
110
  /** Value-axis configuration accepted by the public Dash API. */
108
111
  export interface DashValueConfig {
@@ -126,6 +129,8 @@ export interface DashValueConfig {
126
129
  headerBg?: string;
127
130
  headerColor?: string;
128
131
  headerTextColor?: string;
132
+ displayVariant?: string;
133
+ dataBars?: boolean;
129
134
  sparkline?: boolean | object;
130
135
  }
131
136
  /** Chart visual settings stored on a chart-canvas pane. */
@@ -219,6 +224,8 @@ declare namespace DashTanstackPivot {
219
224
  headerBg: PropTypes.Requireable<string>;
220
225
  headerColor: PropTypes.Requireable<string>;
221
226
  headerTextColor: PropTypes.Requireable<string>;
227
+ displayVariant: PropTypes.Requireable<string>;
228
+ dataBars: PropTypes.Requireable<boolean>;
222
229
  sparkline: PropTypes.Requireable<NonNullable<boolean | object | null | undefined>>;
223
230
  }> | null | undefined)[]>;
224
231
  measureAxis: PropTypes.Requireable<PropTypes.InferProps<{
@@ -403,6 +410,9 @@ declare namespace DashTanstackPivot {
403
410
  activeReportId: PropTypes.Requireable<string>;
404
411
  rowSelection: PropTypes.Requireable<NonNullable<string | boolean | null | undefined>>;
405
412
  selectedRows: PropTypes.Requireable<(string | null | undefined)[]>;
413
+ streamingConfig: PropTypes.Requireable<object>;
414
+ streamUpdates: PropTypes.Requireable<object>;
415
+ diffConfig: PropTypes.Requireable<object>;
406
416
  };
407
417
  }
408
418
  export default DashTanstackPivot;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The global search box. Typing updates the box at once; the ``filters.global`` change, and with it
3
+ * the server request, is committed once typing pauses, so a typed word is one request instead of
4
+ * one per keystroke. Clearing the box commits immediately. A value changed elsewhere (saved view,
5
+ * reset) replaces the draft.
6
+ * @param {{ value: string, onCommit: (value: string) => void, style?: React.CSSProperties, placeholder?: string }} props
7
+ * @returns {any}
8
+ */
9
+ export function GlobalSearchInput({ value, onCommit, style, placeholder }: {
10
+ value: string;
11
+ onCommit: (value: string) => void;
12
+ style?: React.CSSProperties;
13
+ placeholder?: string;
14
+ }): any;
15
+ /** Quiet time after the last keystroke before the search becomes a filter (one data request). */
16
+ export const GLOBAL_SEARCH_COMMIT_DELAY_MS: 250;
17
+ import React from 'react';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Granular Per-Cell Reactive Live & Diff Renderer (Component 6).
3
+ *
4
+ * Subscribes ONLY to its own `(rowKey, colId)` entry inside `ViewportSubscriptionStore`:
5
+ * - Triggers compositor-only tick flashes (an overlay's opacity via `Element.animate()`, ZERO React timers)
6
+ * with a ▲/▼ glyph so the direction is never conveyed by colour alone.
7
+ * - Renders 4-way Diff Display (`Value`, `Δ`, `%Δ` or `pp`, `Split`) with tabular-nums.
8
+ * - Renders `NEW` / `REMOVED` row badges on hierarchy cells & `softStale` syncing indicator.
9
+ * - Renders an institutional **PnL Explain & 30-Point Rolling Sparkline** popover on hover.
10
+ */
11
+ import React from 'react';
12
+ import { type ViewportSubscriptionStore } from '../runtime/useViewportSubscriptionStore';
13
+ export interface LiveCellDisplayProps {
14
+ readonly store: ViewportSubscriptionStore;
15
+ readonly rowKey: string;
16
+ readonly colId: string;
17
+ readonly rowLabel?: string;
18
+ readonly colLabel?: string;
19
+ readonly isHierarchy?: boolean;
20
+ readonly softStale?: boolean;
21
+ readonly isDark?: boolean;
22
+ readonly theme?: Record<string, unknown> | null;
23
+ readonly fallbackContent: React.ReactNode;
24
+ }
25
+ export declare const LiveCellDisplay: React.FC<LiveCellDisplayProps>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Docked Live PnL Explain & Trajectory Side Panel.
3
+ *
4
+ * Opened by clicking any cell's hover PnL Explain card (just like docked chart / detail
5
+ * side panels). Subscribes directly to the pinned `(rowKey, colId)` inside
6
+ * `ViewportSubscriptionStore`, updating live on every tick with zero grid re-renders.
7
+ */
8
+ import React from 'react';
9
+ import { type ViewportSubscriptionStore } from '../runtime/useViewportSubscriptionStore';
10
+ export interface LiveExplainSidePanelProps {
11
+ readonly store?: ViewportSubscriptionStore | null;
12
+ readonly theme?: Record<string, unknown> | null;
13
+ readonly width?: number;
14
+ }
15
+ export declare const LiveExplainSidePanel: React.FC<LiveExplainSidePanelProps>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Institutional Live Stream & Baseline Diff Control Strip.
3
+ *
4
+ * Renders directly above the pivot grid ONLY when streaming or baseline diff is active.
5
+ * Subscribes exclusively to `ViewportSubscriptionStore.subscribeStatus`, isolating
6
+ * toolbar updates from grid cells.
7
+ * Sized to fit cleanly on a single row even inside constrained 580px center panes.
8
+ */
9
+ import React from 'react';
10
+ import { type ViewportSubscriptionStore } from '../runtime/useViewportSubscriptionStore';
11
+ export interface LiveStreamDiffBarProps {
12
+ readonly store?: ViewportSubscriptionStore | null;
13
+ readonly theme?: Record<string, unknown> | null;
14
+ }
15
+ export declare const LiveStreamDiffBar: React.FC<LiveStreamDiffBarProps>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Lightweight Apple-style shimmer skeleton used as Suspense fallback for lazy UI panels.
3
+ * @param {{ variant?: string, height?: any, width?: any, style?: any }} [props]
4
+ * @returns {any}
5
+ */
6
+ export default function ShimmerFallback({ variant, height, width, style }?: {
7
+ variant?: string;
8
+ height?: any;
9
+ width?: any;
10
+ style?: any;
11
+ }): any;
@@ -0,0 +1,8 @@
1
+ export default ThemedSelect;
2
+ /**
3
+ * Accessible custom themed dropdown replacing native <select> elements.
4
+ * Supports both an `options` array and standard JSX `<option>`/`<optgroup>` children,
5
+ * emitting a synthetic `{ target: { value }, currentTarget: { value } }` event to `onChange`.
6
+ * @type {any}
7
+ */
8
+ declare const ThemedSelect: any;
@@ -7,4 +7,5 @@ export function PivotThemeProvider({ theme, styles, children }: {
7
7
  children?: any;
8
8
  }): React.JSX.Element;
9
9
  export function usePivotTheme(): any;
10
+ export const PivotThemeContext: React.Context<any>;
10
11
  import React from 'react';
@@ -13,5 +13,5 @@
13
13
  * isColExpanded, toggleCol, pendingRowTransitions: read at render time
14
14
  * from current scope; same stable-ref / render-time-read pattern
15
15
  @param {any} p0 @returns {any} */
16
- export function useColumnDefs({ sortOptions, sorting, serverSide, showRowNumbers, layoutMode, viewMode, rowFields, colFields, valConfigs, customDimensions, treeConfig, minMax, colorScaleMode, colExpanded, isRowSelecting, rowDragStart, props, measureAxis, cachedColSchema, responseColumns, filteredData, rowCount, theme, defaultColumnWidths, validationRules, onCellEdit, onEditBlocked, resolveEditorPresentation, rowEditMode, getRowEditSession, onRequestRowStart, onRowDraftChange, onRequestRowSave, onRequestRowCancel, requestEditorOptions, renderRowEditActions, handleContextMenu, handleRowSelect, handleRowRangeSelect, setIsRowSelecting, setRowDragStart, renderedOffset, isColExpanded, toggleCol, pendingRowTransitions, decimalPlaces, defaultValueFormat, numberGroupSeparator, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, cellFormatRules, pivotMode, reportDef, showReportConfigColumn, onConfigureReportLine, detailMode, isDetailOpenForRow, onToggleDetail, resolveCellDisplayValue, editValueDisplayMode, openSparklineDataModalRef, rowCheckboxSelection, selectedRowKeys, toggleRowCheckbox, themeRef, dataBarsColumnsRef, rowHeaderLabel, measureGroups, valueScale, unitSuffix, }: any): any;
16
+ export function useColumnDefs({ sortOptions, sorting, serverSide, showRowNumbers, layoutMode, viewMode, rowFields, colFields, valConfigs, customDimensions, treeConfig, minMax, colorScaleMode, colExpanded, isRowSelecting, rowDragStart, props, measureAxis, cachedColSchema, responseColumns, filteredData, rowCount, theme, defaultColumnWidths, validationRules, onCellEdit, onEditBlocked, resolveEditorPresentation, rowEditMode, getRowEditSession, onRequestRowStart, onRowDraftChange, onRequestRowSave, onRequestRowCancel, requestEditorOptions, renderRowEditActions, handleContextMenu, handleRowSelect, handleRowRangeSelect, setIsRowSelecting, setRowDragStart, renderedOffset, isColExpanded, toggleCol, pendingRowTransitions, pendingRowTransitionsRef, decimalPlaces, defaultValueFormat, numberGroupSeparator, columnDecimalOverrides, columnFormatOverrides, columnGroupSeparatorOverrides, cellFormatRules, pivotMode, reportDef, showReportConfigColumn, onConfigureReportLine, detailMode, isDetailOpenForRow, onToggleDetail, resolveCellDisplayValue, editValueDisplayMode, openSparklineDataModalRef, rowCheckboxSelection, selectedRowKeys, toggleRowCheckbox, themeRef, dataBarsColumnsRef, rowHeaderLabel, measureGroups, valueScale, unitSuffix, }: any): any;
17
17
  export function applyMeasureHeaderGroups(cols?: any, idPrefix?: any): any;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Shared overlay dismissal hook: handles Escape (capture phase), outside clicks,
3
+ * and clean focus restoration to the previously focused trigger element.
4
+ *
5
+ * @param {object} options
6
+ * @param {boolean} options.open
7
+ * @param {(() => void) | null | undefined} options.onClose
8
+ * @param {Array<React.RefObject<any> | Element | null | undefined>} [options.refs]
9
+ * @param {boolean} [options.restoreFocus]
10
+ * @param {boolean} [options.enabled]
11
+ */
12
+ export function useDismiss({ open, onClose, refs, restoreFocus, enabled, }: {
13
+ open: boolean;
14
+ onClose: (() => void) | null | undefined;
15
+ refs?: (Element | React.RefObject<any> | null | undefined)[] | undefined;
16
+ restoreFocus?: boolean | undefined;
17
+ enabled?: boolean | undefined;
18
+ }): void;
19
+ /**
20
+ * Resolves the safest portal container: ShadowRoot host container if mounted inside
21
+ * a ShadowRoot (e.g. Streamlit/web component), otherwise `document.body`.
22
+ * Returns `null` in SSR or pure-Node VDOM tests.
23
+ *
24
+ * @param {any} [anchorEl]
25
+ * @returns {Element | DocumentFragment | null}
26
+ */
27
+ export function resolveOverlayPortalTarget(anchorEl?: any): Element | DocumentFragment | null;
28
+ /**
29
+ * Renders floating overlay content into a top-level portal while preserving
30
+ * `data-pivot-workspace-root` selectors, `--sp-*` CSS tokens, colorScheme,
31
+ * and `@media (prefers-reduced-motion: reduce)` rules.
32
+ *
33
+ * @param {{ children: React.ReactNode, theme?: any, anchorEl?: any, zIndex?: number }} props
34
+ * @returns {any}
35
+ */
36
+ export function OverlayPortal({ children, theme, anchorEl, zIndex }: {
37
+ children: React.ReactNode;
38
+ theme?: any;
39
+ anchorEl?: any;
40
+ zIndex?: number;
41
+ }): any;
42
+ export default useDismiss;
43
+ import React from 'react';
@@ -137,6 +137,10 @@ export function clampSidebarWidth(value?: any, fallback?: any): any;
137
137
  export function clampDecimalPlaces(value?: any, fallback?: any): any;
138
138
  export function normalizeDefaultValueFormat(value?: any): any;
139
139
  export function mergeSparseColSchema(previousSchema?: any, incomingSchema?: any, fallbackSize?: any): any;
140
+ export function deliveredSchemaWindow(columns?: any): {
141
+ start: number | null;
142
+ end: number | null;
143
+ };
140
144
  export function isSparseSchemaRangeLoaded(schema?: any, start?: any, end?: any): any;
141
145
  export function normalizePerformanceConfigValue(value?: any): any;
142
146
  export function buildLargeColumnAdvisory({ serverSide, totalCenterCols, colFields }: any): any;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns true when the user has requested reduced motion at the OS/browser level.
3
+ * SSR- and JSDOM-safe: returns false when `window.matchMedia` is unavailable.
4
+ *
5
+ * @returns {boolean}
6
+ */
7
+ export function usePrefersReducedMotion(): boolean;
8
+ export default usePrefersReducedMotion;
@@ -13,5 +13,5 @@
13
13
  * hoveredHeaderId, focusedHeaderId, theme — all are read synchronously when
14
14
  * renderHeaderCell is called, capturing the value from the current render pass.
15
15
  @param {any} p0 @returns {any} */
16
- export function useRenderHelpers({ serverSide, selectedCells, fillRange, dragStart, theme, getStickyStyle, isDarkTheme, handleCellMouseDown, handleCellMouseEnter, handleContextMenu, handleFillMouseDown, visibleLeafColIndexMap, lastSelected, styles, getConditionalStyle, rowHeight, headerHeight: headerHeightProp, rowFields, tableRef, leftCols, centerCols, rightCols, columnPinning, sorting, handleHeaderContextMenu, autoSizeColumn, autoSizeBounds, hoveredHeaderIdRef, setHoveredHeaderId, focusedHeaderIdRef, setFocusedHeaderId, onDragStart, onHeaderDrop, onHeaderDragOver, onHeaderDragEnd, onHeaderKeyboardMove, onHeaderKeyboardPin, dragOverHeaderId, dragOverSide, handleFilterClick, handleHeaderFilter, activeFilterCol, filterAnchorEl, closeFilterPopover, activeFilterOptions, activeFilterOptionMeta, requestFilterOptions, filters, selectedCols, getHeaderStickyStyle, dataBarsColumns, dataBarMaximums, colorScaleStats, cellFormatRules, resolveEditedCellMarker, resolveCellDisplayValue, editedCellEpoch, headerFormatting, getLocaleText, wrapHeaders, table, selectedRowKeys, toggleRowCheckbox, rowCheckboxMode, }: any): any;
16
+ export function useRenderHelpers({ serverSide, selectedCells, fillRange, dragStart, theme, getStickyStyle, isDarkTheme, handleCellMouseDown, handleCellMouseEnter, handleContextMenu, handleFillMouseDown, visibleLeafColIndexMap, lastSelected, styles, getConditionalStyle, rowHeight, headerHeight: headerHeightProp, rowFields, tableRef, leftCols, centerCols, rightCols, columnPinning, sorting, sortOptions, fontFamily, fontSize, handleHeaderContextMenu, autoSizeColumn, autoSizeBounds, hoveredHeaderIdRef, setHoveredHeaderId, focusedHeaderIdRef, setFocusedHeaderId, onDragStart, onHeaderDrop, onHeaderDragOver, onHeaderDragEnd, onHeaderKeyboardMove, onHeaderKeyboardPin, dragOverHeaderId, dragOverSide, handleFilterClick, handleHeaderFilter, activeFilterCol, filterAnchorEl, closeFilterPopover, activeFilterOptions, activeFilterOptionMeta, requestFilterOptions, filters, selectedCols, getHeaderStickyStyle, dataBarsColumns, dataBarMaximums, dataBarVariant, colorScaleStats, cellFormatRules, resolveEditedCellMarker, resolveCellDisplayValue, editedCellEpoch, headerFormatting, getLocaleText, wrapHeaders, table, selectedRowKeys, toggleRowCheckbox, rowCheckboxMode, liveSubscriptionStore, }: any): any;
17
17
  export function resolveHeaderRowSpan(header?: any): any;
@@ -10,11 +10,13 @@ export function useRowCache({ blockSize, maxBlocks }?: {
10
10
  invalidateFromBlock: (...args: any[]) => any;
11
11
  softInvalidateFromBlock: (...args: any[]) => any;
12
12
  softInvalidateRange: (...args: any[]) => any;
13
+ patchRowsByKey: (...args: any[]) => any;
13
14
  pruneToRange: (...args: any[]) => any;
14
15
  setPinnedRange: (...args: any[]) => any;
15
16
  getRow: (...args: any[]) => any;
16
17
  getLoadedBlocks: (...args: any[]) => any;
17
18
  cacheVersion: any;
19
+ blockStructureVersion: any;
18
20
  blockSize: number;
19
21
  currentEpochRef: any;
20
22
  };
@@ -1 +1 @@
1
- export function useServerSideRowModel({ parentRef, serverSide, rowCount, rowHeight, data, dataOffset, dataVersion, dataStateEpoch, setProps, blockSize, maxBlocksInCache, blockLoadDebounceMs, rowOverscan, prefetchColumns, estimateRowHeight, keyMapper, cacheKey, excludeGrandTotal, immersiveMode, stateEpoch, sessionId, clientInstance, tableName, abortGeneration, structuralInFlight, requestVersionRef: externalRequestVersionRef, colStart, colEnd, responseColStart, responseColEnd, needsColSchema, columnRangeUrgencyToken, onViewportRequest, layoutMode, showSubtotals, layoutRequestFields, }: any): any;
1
+ export function useServerSideRowModel({ parentRef, serverSide, rowCount, rowHeight, data, dataOffset, dataVersion, dataStateEpoch, setProps, blockSize, maxBlocksInCache, blockLoadDebounceMs, rowOverscan, prefetchColumns, estimateRowHeight, keyMapper, cacheKey, excludeGrandTotal, immersiveMode, stateEpoch, sessionId, clientInstance, tableName, abortGeneration, structuralInFlight, stateEpochRef, structuralPendingVersionRef, pendingExpansionRef, requestVersionRef: externalRequestVersionRef, colStart, colEnd, responseColStart, responseColEnd, needsColSchema, columnRangeUrgencyToken, onViewportRequest, layoutMode, showSubtotals, layoutRequestFields, }: any): any;
@@ -1,22 +1,31 @@
1
- import { ap as s, aq as t, ar as o, as as i, at as r, au as n, av as l, aw as p, ax as u, ay as c, az as m, aA as v, aB as d, aC as C, aD as h, aE as E, aF as P, aG as T, aH as x } from "./chunks/react-CDa-ADnG.mjs";
1
+ import { as as s, at as i, au as t, av as r, aw as o, ax as n, ay as l, az as c, aA as p, aB as u, aC as m, aD as v, aE as d, aF as S, aG as C, aH as D, aI as E, aJ as P, aK as T, aL as V, aM as h, aN as x, aO as L, aP as W, aQ as b, aR as f, aS as g, aT as y } from "./chunks/react-B5JcZShu.mjs";
2
2
  export {
3
3
  s as ClientPivotTransport,
4
- t as ClientResponsePostProcessor,
5
- o as ClientSqlPlanner,
6
- i as DuckDbWasmExecutor,
7
- r as HttpPivotTransport,
8
- n as LatestViewportScheduler,
9
- l as PivotWorkspace,
10
- p as buildThemeCssVars,
11
- u as computeFitToWidthLayout,
12
- c as formatValue,
13
- m as injectThemeCssVars,
14
- v as isDisplayNegative,
15
- d as normalizeClientEngineKind,
16
- C as normalizeExecutionMode,
17
- h as resolveClientEngineKind,
18
- E as resolveExecutionMode,
19
- P as resolveThemeOverrides,
20
- T as scaleValueForDisplay,
21
- x as themes
4
+ i as ClientResponsePostProcessor,
5
+ t as ClientSqlPlanner,
6
+ r as ClientSubscriptionEngine,
7
+ o as DuckDbWasmExecutor,
8
+ n as HttpPivotTransport,
9
+ l as LatestViewportScheduler,
10
+ c as LiveCellDisplay,
11
+ p as LiveExplainSidePanel,
12
+ u as LiveStreamDiffBar,
13
+ m as PivotWorkspace,
14
+ v as ViewportSubscriptionStore,
15
+ d as buildThemeCssVars,
16
+ S as computeFitToWidthLayout,
17
+ C as decodeWireNumeric,
18
+ D as formatValue,
19
+ E as formatWireDecimalString,
20
+ P as injectThemeCssVars,
21
+ T as isDisplayNegative,
22
+ V as isWireDecimal,
23
+ h as normalizeClientEngineKind,
24
+ x as normalizeExecutionMode,
25
+ L as resolveClientEngineKind,
26
+ W as resolveExecutionMode,
27
+ b as resolveThemeOverrides,
28
+ f as scaleValueForDisplay,
29
+ g as themes,
30
+ y as useViewportSubscriptionStore
22
31
  };
@@ -5,7 +5,12 @@ export { themes, injectThemeCssVars } from './utils/styles';
5
5
  export { resolveThemeOverrides, buildThemeCssVars } from './utils/styles';
6
6
  export { isDisplayNegative, formatValue, scaleValueForDisplay } from './utils/helpers';
7
7
  export { computeFitToWidthLayout } from './utils/pivotLayoutUtils';
8
- export { ClientPivotTransport, DuckDbWasmExecutor, ClientSqlPlanner, ClientResponsePostProcessor, resolveExecutionMode, resolveClientEngineKind, normalizeExecutionMode, normalizeClientEngineKind, type ExecutionMode, type ClientEngineKind, type ClientRuntimeConfig, type ClientEngineTelemetry, type LogicalPivotPlan, } from './runtime/client/index';
8
+ export { ClientPivotTransport, ClientSubscriptionEngine, DuckDbWasmExecutor, ClientSqlPlanner, ClientResponsePostProcessor, resolveExecutionMode, resolveClientEngineKind, normalizeExecutionMode, normalizeClientEngineKind, type ExecutionMode, type ClientEngineKind, type ClientRuntimeConfig, type ClientEngineTelemetry, type LogicalPivotPlan, } from './runtime/client/index';
9
+ export { ViewportSubscriptionStore, useViewportSubscriptionStore, } from './runtime/useViewportSubscriptionStore';
10
+ export { LiveStreamDiffBar } from './components/LiveStreamDiffBar';
11
+ export { LiveCellDisplay } from './components/LiveCellDisplay';
12
+ export { LiveExplainSidePanel } from './components/LiveExplainSidePanel';
13
+ export { isWireDecimal, decodeWireNumeric, formatWireDecimalString, type StreamingConfig, type DiffConfig, type DiffDisplayMode, type SortLockMode, type StreamUpdateBatch, type ProtocolV2Frame, type StreamCellPatch, type StreamRowPatch, type BaselineCellDiff, type BaselineDescriptor, type VarianceDriver, type CellLiveMeta, type PinnedExplainCell, type SubscriptionStatusSnapshot, type WireDecimal, } from './runtime/streamingTypes';
9
14
  export type { PivotWorkspaceProps } from './components/PivotWorkspace';
10
- export type { PivotRuntimeProps, PivotThemeName, PivotValueConfig, ValConfig, FilterCondition, FilterConfig, SortConfig, ChartDefinition, } from './runtime/runtimeDomains';
15
+ export type { PivotRuntimeProps, PivotThemeName, PivotThemeOverrides, PivotValueConfig, ValConfig, FilterCondition, FilterConfig, SortConfig, ChartDefinition, } from './runtime/runtimeDomains';
11
16
  export type { RuntimeRequestV1, RuntimeResponseV1, RuntimeRequestSchemaV1, RuntimeResponseSchemaV1, } from './runtime/runtimeContract';
@@ -1,5 +1,7 @@
1
1
  import type { PayloadReference, RuntimeTransportRequestOptions } from '../httpTransport';
2
2
  import { type JsonObject, type RuntimeRequestV1, type RuntimeResponseV1 } from '../runtimeContract';
3
+ import { ClientSubscriptionEngine } from './clientSubscriptionEngine';
4
+ import type { BaselineDescriptor, StreamUpdateBatch } from '../streamingTypes';
3
5
  import type { ClientEngineTelemetry, ClientPivotTransportInterface, ClientRuntimeConfig, DrillThroughQuery, DrillThroughResult } from './types';
4
6
  export interface ClientPivotTransportOptions extends ClientRuntimeConfig {
5
7
  data?: Array<{
@@ -13,19 +15,34 @@ export declare class ClientPivotTransport implements ClientPivotTransportInterfa
13
15
  private payloadStore;
14
16
  private exportStore;
15
17
  private exportJobStore;
18
+ private subscriptionEngine;
16
19
  constructor(options?: ClientPivotTransportOptions);
20
+ /** Release DuckDB-Wasm resources (the transport stays usable and re-initialises lazily). */
21
+ dispose(): void;
17
22
  setData(rows: Array<{
18
23
  [key: string]: unknown;
19
24
  }>): void;
25
+ applyStreamUpdates(batch: StreamUpdateBatch): number;
26
+ captureBaseline(label?: string): BaselineDescriptor;
27
+ freezeSnapshot(label?: string): BaselineDescriptor;
28
+ listBaselines(): BaselineDescriptor[];
29
+ getSubscriptionEngine(): ClientSubscriptionEngine;
20
30
  getData(): Array<{
21
31
  [key: string]: unknown;
22
32
  }>;
33
+ getAvailableFields(): string[];
23
34
  updateConfig(config: Partial<ClientRuntimeConfig>): void;
24
35
  getTelemetry(): ClientEngineTelemetry;
25
36
  private retainExportPayload;
26
37
  private retainExportJob;
27
38
  private loadXlsxWriter;
28
39
  request(request: RuntimeRequestV1, options?: RuntimeTransportRequestOptions): Promise<RuntimeResponseV1>;
40
+ /**
41
+ * Answer a data request with the semantic core: the IR is emitted as DuckDB SQL and run on the
42
+ * DuckDB-Wasm connection. ``null`` (legacy path) only when DuckDB cannot run here or the request
43
+ * uses a feature the core does not express; the reason is in the telemetry.
44
+ */
45
+ private serveDataFromCore;
29
46
  queryDrillThrough(query: DrillThroughQuery): Promise<DrillThroughResult>;
30
47
  fetchPayload(reference: PayloadReference, _options?: RuntimeTransportRequestOptions): Promise<JsonObject>;
31
48
  fetchExportPayload(reference: PayloadReference, _options?: RuntimeTransportRequestOptions): Promise<Blob>;
@@ -11,7 +11,14 @@ export declare function evaluateSafeFormula(expression: string, context: {
11
11
  };
12
12
  export declare class ClientResponsePostProcessor {
13
13
  static buildResponse(plan: LogicalPivotPlan, executed: ClientExecutedDataset): RuntimeResponseV1;
14
- static buildDataResponse(plan: LogicalPivotPlan, executed: ClientExecutedDataset): RuntimeResponseV1;
14
+ static buildDataResponse(plan: LogicalPivotPlan, executed: ClientExecutedDataset, prebuilt?: {
15
+ rows: Array<{
16
+ [key: string]: unknown;
17
+ }>;
18
+ grandTotalRow: {
19
+ [key: string]: unknown;
20
+ } | null;
21
+ }): RuntimeResponseV1;
15
22
  static buildFilterOptionsResponse(plan: LogicalPivotPlan, executed: ClientExecutedDataset): RuntimeResponseV1;
16
23
  static buildChartResponse(plan: LogicalPivotPlan, executed: ClientExecutedDataset): RuntimeResponseV1;
17
24
  static executeDrillThroughQuery(allRows: Array<{
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Client-side implementation of the Protocol V2 Snapshot + Diff Subscription Engine.
3
+ *
4
+ * Mirrors the Python backend's exact mathematical & lifecycle contracts in the browser
5
+ * for `ClientPivotTransport` (in-memory & DuckDB-Wasm execution modes):
6
+ * - Monotonic `sourceRevision`, `eventSeq` (`baseSeq -> seq`), `queryEpoch`, `serverEpochId`
7
+ * - Exact valid-masked weighted averages (`x != null && w != null`)
8
+ * - Measure-specific removed-group diff rules (`SUM`/`COUNT` -> 0 / -B / -100%; `AVG`/`WAVG`/`MIN`/`MAX`/ratio -> null)
9
+ * - `0 -> 0` safe percentage delta (`delta = 0`, `pctDelta = null`)
10
+ * - Top-3 child variance attribution (`_varianceDrivers` for PnL Explain)
11
+ * - Distinct `Pause Live` (visual hold + buffered updates) vs `Freeze Snapshot` (immutable frozen view)
12
+ * - `Sort Lock` (`in_place` vs `live_rank`) & `changedOnly` filtering
13
+ */
14
+ import type { BaselineDescriptor, ProtocolV2Frame, SortLockMode, StreamUpdateBatch } from '../streamingTypes';
15
+ import type { NormalizedValConfig } from './types';
16
+ export interface ClientQueryShape {
17
+ readonly table: string;
18
+ readonly rowFields: readonly string[];
19
+ readonly colFields: readonly string[];
20
+ readonly valConfigs: readonly NormalizedValConfig[];
21
+ readonly sorting?: readonly {
22
+ id: string;
23
+ desc?: boolean;
24
+ }[];
25
+ }
26
+ export interface ClientSubscriptionState {
27
+ readonly subscriptionId: string;
28
+ shape: ClientQueryShape;
29
+ seq: number;
30
+ lastAckSeq: number;
31
+ queryEpoch: number;
32
+ paused: boolean;
33
+ bufferedUpdates: number;
34
+ frozenSnapshotId: string | null;
35
+ baselineId: string | null;
36
+ sortLock: SortLockMode;
37
+ changedOnly: boolean;
38
+ pinnedRowOrder: string[];
39
+ lastRowsByKey: Map<string, Record<string, unknown>>;
40
+ lastGrandTotal: Record<string, unknown> | null;
41
+ listener?: (frame: ProtocolV2Frame) => void;
42
+ }
43
+ export declare class ClientSubscriptionEngine {
44
+ readonly serverEpochId: string;
45
+ private sourceRevision;
46
+ private schemaVersion;
47
+ private rows;
48
+ private snapshots;
49
+ private subscriptions;
50
+ private onRowsReplaced?;
51
+ constructor(initialRows?: readonly Record<string, unknown>[], onRowsReplaced?: (rows: Record<string, unknown>[]) => void);
52
+ private computeSchemaVersion;
53
+ getSourceRevision(): number;
54
+ setRows(nextRows: readonly Record<string, unknown>[]): void;
55
+ getRows(): Record<string, unknown>[];
56
+ /** Apply an atomic insert/update/upsert/delete batch to the client dataset and notify subscribers. */
57
+ applyStreamUpdates(batch: StreamUpdateBatch): number;
58
+ captureSnapshot(label?: string, kind?: 'baseline' | 'freeze_snapshot'): BaselineDescriptor;
59
+ listBaselines(): BaselineDescriptor[];
60
+ subscribe(shape: ClientQueryShape, options?: {
61
+ baselineId?: string | null;
62
+ sortLock?: SortLockMode;
63
+ changedOnly?: boolean;
64
+ listener?: (frame: ProtocolV2Frame) => void;
65
+ }): {
66
+ subscription: ClientSubscriptionState;
67
+ initialFrame: ProtocolV2Frame;
68
+ };
69
+ unsubscribe(subscriptionId: string): void;
70
+ acknowledge(subscriptionId: string, seq: number): void;
71
+ pause(subscriptionId: string): ProtocolV2Frame | null;
72
+ resume(subscriptionId: string): ProtocolV2Frame | null;
73
+ freeze(subscriptionId: string, label?: string): {
74
+ descriptor: BaselineDescriptor;
75
+ frame: ProtocolV2Frame;
76
+ } | null;
77
+ unfreeze(subscriptionId: string): ProtocolV2Frame | null;
78
+ setBaseline(subscriptionId: string, baselineId: string | null): ProtocolV2Frame | null;
79
+ updateOptions(subscriptionId: string, opts: {
80
+ sortLock?: SortLockMode;
81
+ changedOnly?: boolean;
82
+ shape?: ClientQueryShape;
83
+ }): ProtocolV2Frame | null;
84
+ private materializeRows;
85
+ private buildSnapshotFrame;
86
+ private buildHeartbeatFrame;
87
+ private broadcastUpdates;
88
+ }
@@ -17,7 +17,10 @@ export declare class DuckDbWasmExecutor {
17
17
  private wasmRetryAfter;
18
18
  private dbInstance;
19
19
  private dbConn;
20
+ private worker;
20
21
  private registeredTableSignature;
22
+ private preparedCache;
23
+ private cachedAvailableFields;
21
24
  private telemetry;
22
25
  constructor(initialRows?: Array<{
23
26
  [key: string]: unknown;
@@ -28,9 +31,31 @@ export declare class DuckDbWasmExecutor {
28
31
  getData(): Array<{
29
32
  [key: string]: unknown;
30
33
  }>;
34
+ getAvailableFields(): string[];
31
35
  updateConfig(config: Partial<ClientRuntimeConfig>): void;
36
+ /**
37
+ * Release the DuckDB connection, database and worker. The executor stays usable:
38
+ * the next request re-initialises DuckDB-Wasm (safe under React StrictMode remounts).
39
+ */
40
+ dispose(): void;
32
41
  getTelemetry(): ClientEngineTelemetry;
33
42
  private tryInitializeWasm;
34
43
  private ensureTableRegistered;
44
+ /**
45
+ * The DuckDB connection with ``table`` registered, initialising DuckDB-Wasm when it can run,
46
+ * or ``null`` when it cannot (no bundle, offline file origin, no Worker).
47
+ */
48
+ coreConnection(table: string): Promise<{
49
+ query: (sql: string) => Promise<unknown>;
50
+ } | null>;
51
+ /** Record a request answered by the semantic core (or the reason it was not). */
52
+ recordCoreOutcome(outcome: {
53
+ served: true;
54
+ sql: string;
55
+ executionMs: number;
56
+ } | {
57
+ served: false;
58
+ reason: string;
59
+ }): void;
35
60
  execute(plan: LogicalPivotPlan): Promise<ClientExecutedDataset>;
36
61
  }
@@ -3,4 +3,5 @@ export * from './modeResolver';
3
3
  export * from './clientSqlPlanner';
4
4
  export * from './duckdbWasmExecutor';
5
5
  export * from './clientResponsePostProcessor';
6
+ export * from './clientSubscriptionEngine';
6
7
  export * from './clientPivotTransport';
@@ -13,8 +13,10 @@ export interface ClientRuntimeConfig {
13
13
  duckdbWasmCdnUrl?: string;
14
14
  duckdbBundleUrl?: string;
15
15
  duckdbWasmInstance?: unknown;
16
+ duckdbLoader?: () => Promise<unknown>;
16
17
  legacyClientTable?: boolean;
17
18
  tableName?: string;
19
+ showGrandTotal?: boolean;
18
20
  xlsxLoader?: () => Promise<unknown>;
19
21
  }
20
22
  export interface ClientEngineTelemetry {
@@ -26,13 +28,18 @@ export interface ClientEngineTelemetry {
26
28
  rowCount: number;
27
29
  networkRoundtrips: number;
28
30
  lastUpdatedAt: number;
31
+ /** 'core' when the semantic core (emitted SQL on DuckDB) answered; else why the legacy path did. */
32
+ coreServed?: boolean;
33
+ coreFallbackReason?: string;
29
34
  }
30
35
  export interface NormalizedValConfig {
31
36
  field: string;
32
37
  agg: string;
33
38
  id: string;
34
39
  label: string;
40
+ shortLabel?: string;
35
41
  weightField?: string;
42
+ orderBy?: string;
36
43
  windowFn?: string;
37
44
  formula?: string;
38
45
  formulaScope?: 'measures' | 'columns';
@@ -101,8 +108,17 @@ export interface LogicalPivotPlan {
101
108
  absoluteSort?: boolean;
102
109
  };
103
110
  };
111
+ columnOptions?: {
112
+ [key: string]: {
113
+ sortType?: string;
114
+ sortKeyField?: string;
115
+ absoluteSort?: boolean;
116
+ };
117
+ };
104
118
  };
105
119
  expandedAll: boolean;
120
+ /** An expanded/collapsed display path has an empty member (NULL vs "" cannot be told apart). */
121
+ expandedAmbiguous?: boolean;
106
122
  expandedPaths: string[][];
107
123
  collapsedPaths: string[][];
108
124
  measureAxis: {
@@ -167,6 +183,7 @@ export interface ClientExecutedDataset {
167
183
  allRows: Array<{
168
184
  [key: string]: unknown;
169
185
  }>;
186
+ availableFields?: string[];
170
187
  colCombinations: string[];
171
188
  engineUsed: 'duckdb-wasm' | 'memory';
172
189
  executionMs: number;
@@ -201,6 +218,7 @@ export interface ClientPivotTransportInterface extends PivotTransport {
201
218
  setData: (rows: Array<{
202
219
  [key: string]: unknown;
203
220
  }>) => void;
221
+ getAvailableFields?: () => string[];
204
222
  updateConfig: (config: Partial<ClientRuntimeConfig>) => void;
205
223
  getTelemetry: () => ClientEngineTelemetry;
206
224
  queryDrillThrough: (query: DrillThroughQuery) => Promise<DrillThroughResult>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Client mode on the semantic core (M3).
3
+ *
4
+ * A client `LogicalPivotPlan` (from `ClientSqlPlanner.compile`) is mapped to
5
+ * the same semantic IR the server bridge builds (`transport/core_bridge.py`),
6
+ * emitted as DuckDB SQL (`duckdbSqlEmitter.ts`), executed on the DuckDB-Wasm
7
+ * connection, and shaped into the client row format. Numbers therefore come
8
+ * from DuckDB with the core's semantics, not from JavaScript aggregation.
9
+ *
10
+ * Anything that cannot be mapped exactly throws `EmitterUnsupported`; the
11
+ * caller then serves the request through the legacy client path.
12
+ */
13
+ import type { LogicalPivotPlan } from '../client/types';
14
+ import { EmitterUnsupported, type ColumnInfo, type TypeFamily } from './duckdbSqlEmitter';
15
+ import type { PivotQuery } from './semanticIr.generated';
16
+ export { EmitterUnsupported };
17
+ type Row = {
18
+ [key: string]: unknown;
19
+ };
20
+ export interface QueryConnection {
21
+ query: (sql: string) => Promise<unknown>;
22
+ }
23
+ /** Python `repr(float)`: shortest round-trip digits, scientific below 1e-4 or from 1e16. */
24
+ export declare function pythonFloatRepr(x: number): string;
25
+ export declare function canonicalScalar(value: unknown, family: TypeFamily): string;
26
+ /** `CanonicalPathCodec.encode`: "[]" for the grand total. */
27
+ export declare function canonicalPath(values: unknown[], families: TypeFamily[]): string;
28
+ export interface ClientCoreQuery {
29
+ query: PivotQuery;
30
+ families: TypeFamily[];
31
+ }
32
+ /** Map a client plan to the semantic IR (before column members are known). */
33
+ export declare function planToQuery(plan: LogicalPivotPlan, columns: Record<string, ColumnInfo>): ClientCoreQuery;
34
+ export interface ClientCoreResult {
35
+ rows: Row[];
36
+ grandTotalRow: Row | null;
37
+ colCombinations: string[];
38
+ }
39
+ /** Shape core records (rows dims, value columns, __depth) into the client row format. */
40
+ export declare function shapeRows(plan: LogicalPivotPlan, core: ClientCoreQuery, records: Row[]): ClientCoreResult;
41
+ export declare function familyOf(sqlType: string): TypeFamily;
42
+ export declare function describeColumns(conn: QueryConnection, table: string): Promise<Record<string, ColumnInfo>>;
43
+ /** Serve a client data request from DuckDB with the core's semantics. */
44
+ export declare function runClientCore(plan: LogicalPivotPlan, conn: QueryConnection, table: string): Promise<ClientCoreResult & {
45
+ sql: string;
46
+ }>;