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,112 @@
1
+ /**
2
+ * Reactive External Viewport Subscription Store & Transport Orchestrator (Component 6).
3
+ *
4
+ * Design principles:
5
+ * - Single Value Truth: incoming PATCH cell values are written directly into `useRowCache`
6
+ * (via `onPatchRows`) while visual diff/tick/sparkline metadata lives in this external store.
7
+ * - Per-Cell Granular Subscription: each rendered leaf cell subscribes ONLY to its own
8
+ * `cellKey = `${rowId}::${colId}`` so ticking 3 cells triggers 3 leaf re-renders, never a
9
+ * full-table re-render.
10
+ * - React 16/17/18/19 compatible (`useSyncExternalStore` when present, safe state fallback otherwise).
11
+ * - Unified across all 3 transports:
12
+ * 1. FastAPI SSE (`POST /v1/runtime/stream` + `POST /v1/runtime/subscription`)
13
+ * 2. Dash Same-Origin Fast-Lane (`POST /_serverside_pivot/subscription`)
14
+ * 3. Client-Side Engine (`ClientPivotTransport.getSubscriptionEngine()`)
15
+ */
16
+ import { type CellLiveMeta, type DiffConfig, type DiffDisplayMode, type PinnedExplainCell, type ProtocolV2Frame, type RowLifecycleKind, type SortLockMode, type StreamingConfig, type StreamUpdateBatch, type SubscriptionStatusSnapshot } from './streamingTypes';
17
+ import type { ClientPivotTransport } from './client/clientPivotTransport';
18
+ import type { NormalizedValConfig } from './client/types';
19
+ export declare function makeLiveCellKey(rowKey: string, colId: string): string;
20
+ /** React 16/17/18/19 safe external-store subscription hook. */
21
+ export declare function useExternalStoreSnapshot<T>(subscribe: (listener: () => void) => () => void, getSnapshot: () => T): T;
22
+ export interface ViewportSubscriptionCallbacks {
23
+ onPatchRows?: (patchesByRowKey: Map<string, Record<string, unknown>>, sourceRevision: number, visibleRowKeys: Set<string>) => void;
24
+ onAuthoritativeSnapshot?: (frame: ProtocolV2Frame) => void;
25
+ onTriggerViewportRefresh?: () => void;
26
+ }
27
+ export interface SubscriptionQueryContext {
28
+ readonly table: string;
29
+ readonly rowFields: readonly string[];
30
+ readonly colFields: readonly string[];
31
+ readonly valConfigs: readonly NormalizedValConfig[];
32
+ readonly filters?: Record<string, unknown>;
33
+ readonly sorting?: readonly {
34
+ id: string;
35
+ desc?: boolean;
36
+ }[];
37
+ readonly expanded?: boolean | Record<string, unknown>;
38
+ readonly viewportStart?: number;
39
+ readonly viewportEnd?: number;
40
+ }
41
+ /**
42
+ * Imperative external store managing per-cell tick/diff metadata, rolling sparklines,
43
+ * row lifecycle badges, and toolbar control state.
44
+ */
45
+ export declare class ViewportSubscriptionStore {
46
+ /** Display keys of the last snapshot that name more than one canonical row. */
47
+ private ambiguousDisplay;
48
+ private cellMap;
49
+ private rowLifecycleMap;
50
+ private currentViewportRowKeys;
51
+ private changedRowKeys;
52
+ private cellListeners;
53
+ private rowListeners;
54
+ private statusListeners;
55
+ private status;
56
+ private callbacks;
57
+ private controlHandlers;
58
+ private transitionInFlight;
59
+ constructor(initial?: Partial<SubscriptionStatusSnapshot>);
60
+ setCallbacks(callbacks: ViewportSubscriptionCallbacks): void;
61
+ setControlHandlers(handlers: ViewportSubscriptionStore['controlHandlers']): void;
62
+ setTransitionInFlight(inFlight: boolean): void;
63
+ isTransitionInFlight(): boolean;
64
+ /**
65
+ * Clear cell/row maps on structural query changes (filter, sort, dimensions)
66
+ * so cells immediately display the authoritative new grid response without
67
+ * lingering pre-filter/pre-sort values.
68
+ */
69
+ resetForQueryChange(): void;
70
+ syncViewport: () => void;
71
+ getStatus: () => SubscriptionStatusSnapshot;
72
+ subscribeStatus: (listener: () => void) => (() => void);
73
+ getCellMeta(rowKey: string, colId: string): CellLiveMeta | null;
74
+ subscribeCell(rowKey: string, colId: string, listener: () => void): () => void;
75
+ getRowLifecycle(rowKey: string): RowLifecycleKind;
76
+ hasRowChanged(rowKey: string): boolean;
77
+ getChangedRowKeyCount(): number;
78
+ subscribeRow(rowKey: string, listener: () => void): () => void;
79
+ patchStatus(partial: Partial<SubscriptionStatusSnapshot>): void;
80
+ private emitCell;
81
+ private emitRow;
82
+ setDiffDisplayMode: (mode: DiffDisplayMode) => void;
83
+ pauseLive: () => void;
84
+ resumeLive: () => void;
85
+ freezeSnapshot: () => void;
86
+ unfreezeSnapshot: () => void;
87
+ captureBaseline: (label?: string) => void;
88
+ selectBaseline: (baselineId: string | null) => void;
89
+ setCadenceMs: (ms: number) => void;
90
+ setSortLock: (mode: SortLockMode) => void;
91
+ setChangedOnly: (enabled: boolean) => void;
92
+ reconnect: () => void;
93
+ openExplainPanel: (cell: PinnedExplainCell) => void;
94
+ closeExplainPanel: () => void;
95
+ /** Ingest any Protocol V2 frame (`SNAPSHOT`, `PATCH`, `HEARTBEAT`, `INVALIDATE`, `AUTH_REVOKED`). */
96
+ ingestFrame(frame: ProtocolV2Frame): void;
97
+ }
98
+ export interface UseViewportSubscriptionOptions {
99
+ readonly streamingConfig?: StreamingConfig | null;
100
+ readonly diffConfig?: DiffConfig | null;
101
+ readonly streamUpdates?: StreamUpdateBatch | null;
102
+ readonly serverSide: boolean;
103
+ readonly clientTransport?: ClientPivotTransport | null;
104
+ readonly transitionInFlight?: boolean;
105
+ readonly queryContext: SubscriptionQueryContext;
106
+ readonly callbacks?: ViewportSubscriptionCallbacks;
107
+ }
108
+ /**
109
+ * React hook owning a stable `ViewportSubscriptionStore` and binding it to
110
+ * FastAPI SSE, Dash fast-lane, or ClientPivotTransport depending on runtime mode.
111
+ */
112
+ export declare function useViewportSubscriptionStore(options: UseViewportSubscriptionOptions): ViewportSubscriptionStore;
@@ -5,4 +5,4 @@
5
5
  * status presentation from becoming a back-channel between grid, editing,
6
6
  * transport and chart coordination.
7
7
  @param {any} p0 @returns {any} */
8
- export function useWorkspaceStatusPresentation({ chartCanvasPanes, clearAllComparisonValueState, clearAllEditedCellMarkers, clearAllOptimisticCellValues, colFields, columnAdvisory, comparisonCellOriginalValuesRef, comparisonValueState, dispatchTransactionRequest, editedCellMarkersRef, editValueDisplayMode, filters, handleClearStatusFilters, handleClearStatusSelection, handleRedo, handleRefreshStatusViewport, handleUndo, isRequestPending, loadedRows, managedChartDefinitions, openSelectionChart, propagationLogRef, propagationLogEpoch, requestVisibleViewportRefresh, rowEditStatusSummary, rowFields, rows, selectedCells, serverSide, setEditValueDisplayMode, setPropagationLogEpoch, setPropsRef, showNotification, sorting, statusRowCount, supportsPatchTransactionRefresh, syncComparisonValueState, syncTransactionHistoryState, totalCenterCols, transactionHistoryState, valConfigs, viewMode, }: any): any;
8
+ export function useWorkspaceStatusPresentation({ chartCanvasPanes, clearAllComparisonValueState, clearAllEditedCellMarkers, clearAllOptimisticCellValues, colFields, columnAdvisory, comparisonCellOriginalValuesRef, comparisonValueState, dispatchTransactionRequest, editedCellMarkersRef, editValueDisplayMode, filters, handleClearStatusFilters, handleClearStatusSelection, handleRedo, handleRefreshStatusViewport, handleUndo, isRequestPending, loadedRows, managedChartDefinitions, openSelectionChart, propagationLogRef, propagationLogEpoch, requestVisibleViewportRefresh, resolveColumnValueFormat, numberGroupSeparator, rowEditStatusSummary, rowFields, rows, selectedCells, serverSide, setEditValueDisplayMode, setPropagationLogEpoch, setPropsRef, showNotification, sorting, statusRowCount, supportsPatchTransactionRefresh, syncComparisonValueState, syncTransactionHistoryState, totalCenterCols, transactionHistoryState, valConfigs, viewMode, }: any): any;
@@ -1,3 +1,4 @@
1
1
  export function normalizeDataBarMaximums(value?: any): any;
2
+ export function normalizeDataBarVariant(value?: any): "fill" | "underbar";
2
3
  export function updateDataBarMaximums(previous?: any, columns?: any, maximum?: any): any;
3
4
  export function resolveDataBarMaximum(maximum?: any, stats?: any): any;
@@ -1 +1,2 @@
1
1
  export function isEventInsideElement(event?: any, element?: any): any;
2
+ export function isEventInsideSelector(event: any, selector: string): boolean;
@@ -2,11 +2,16 @@ export function getKey(prefix?: any, field?: any, agg?: any): any;
2
2
  export function formatDisplayLabel(value?: any): any;
3
3
  export function isWeightedAverageAgg(agg?: any): any;
4
4
  export function formatAggLabel(agg?: any, weightField?: any): any;
5
- export const DEFAULT_NUMBER_GROUP_SEPARATOR: "thin_space";
5
+ export function stripAggLabelSuffix(label?: any): string;
6
+ export const DEFAULT_NUMBER_GROUP_SEPARATOR: "comma";
6
7
  export const DEFAULT_CURRENCY_SYMBOL: "$";
7
8
  export function normalizeNumberGroupSeparator(value?: any): any;
8
9
  export function normalizeNegativeZero(value?: any): any;
9
10
  export function scaleValueForDisplay(value?: any, valueScale?: any): any;
11
+ export function unwrapNumericDisplayFormat(fmt?: any): {
12
+ isPill: boolean;
13
+ innerFormat: string;
14
+ };
10
15
  export function resolveNumericDisplayValue(value?: any, fmt?: any, decimalPlaces?: any, options?: any): any;
11
16
  export function isDisplayNegative(value?: any, fmt?: any, decimalPlaces?: any, options?: any): any;
12
17
  export function formatValue(value?: any, fmt?: any, decimalPlaces?: any, groupSeparator?: any, formatOptions?: any): any;
@@ -1,3 +1,7 @@
1
1
  export function getStickyHeaderHeight(headerGroupCount?: any, rowHeight?: any, showFloatingFilters?: any): any;
2
2
  export function formatLocaleTextTemplate(template?: any, values?: any): any;
3
- export function computeFitToWidthLayout({ columns, containerWidth, baseFontSize, minFontSize, }?: any): any;
3
+ export function createTextWidthMeasurer(font?: any, fallbackCharPx?: any): any;
4
+ export function measureLongestHeaderWord(text?: any, measureFn?: any): any;
5
+ export function measureColumnFitMetric({ columnId, baseSize, minSize, rows, getCellRawValue, formatCellText, formatHierarchyLabel, getHierarchyLabel, headerLines, shortLabel, headerWrap, headerControlsMode, canSort, sortIndicator, measureBodyText, measureHeaderText, measureGroupHeaderText, cellPaddingX, headerPaddingX, numericPaddingRight, hierarchyIndentPx, hierarchyExpandPx, hierarchyLeafPx, cellOverscan, headerOverscan, }?: any): any;
6
+ export function computeCompactFitThemeOverrides(theme?: any, fitScale?: any, fittedFontSize?: any, minFontSize?: any, paddingScale?: number): any;
7
+ export function computeFitToWidthLayout({ columns, containerWidth, baseFontSize, minFontSize, theme, getFixedColumnSize, }?: any): any;
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Compute a cohesive, distance-scaled motion duration (ms) for row expand/collapse glides.
3
+ * Short 1-3 row shifts feel crisp (~215-240ms); larger multi-row unfolds breathe smoothly up to 300ms.
4
+ * @param {number} distancePx
5
+ * @returns {number}
6
+ */
7
+ export function computeSlideDurationMs(distancePx: number): number;
8
+ /**
9
+ * Compute deterministic, transform-free layout top for the bottom-pinned row group
10
+ * relative to the scroll container's top edge (immune to pending WAAPI transforms & forced reflow).
11
+ * @param {{
12
+ * stickyHeaderHeight: number,
13
+ * topPinnedCount: number,
14
+ * bottomPinnedCount: number,
15
+ * containerBodyHeight: number,
16
+ * rowHeight: number,
17
+ * scrollTop: number,
18
+ * clientHeight: number,
19
+ * }} params
20
+ * @returns {number}
21
+ */
22
+ export function computeBottomPinnedLayoutTop({ stickyHeaderHeight, topPinnedCount, bottomPinnedCount, containerBodyHeight, rowHeight, scrollTop, clientHeight, }: {
23
+ stickyHeaderHeight: number;
24
+ topPinnedCount: number;
25
+ bottomPinnedCount: number;
26
+ containerBodyHeight: number;
27
+ rowHeight: number;
28
+ scrollTop: number;
29
+ clientHeight: number;
30
+ }): number;
31
+ /**
32
+ * Build a rigid-sheet unfold plan for newly revealed child rows on expand.
33
+ * Each newly revealed child is grouped under its deepest pre-existing visible ancestor
34
+ * (present in prevTopByKey). Every child in a group glides by the exact same sheet travel
35
+ * distance as the siblings descending below it, maintaining constant row-height spacing
36
+ * and staying occluded behind the parent row (zIndex: 2 vs parent zIndex: 4) until clearing
37
+ * the parent's bottom border.
38
+ *
39
+ * @param {{
40
+ * committedSnapshots: Array<any>,
41
+ * prevTopByKey: Map<string, number>,
42
+ * hasRecentlyExpandedAncestor: (rowPath: string) => boolean,
43
+ * rowHeight: number,
44
+ * }} params
45
+ * @returns {{
46
+ * revealByKey: Map<string, { fromTop: number, toTop: number, travelPx: number, parentKey: string }>,
47
+ * maxRevealTravelPx: number,
48
+ * }}
49
+ */
50
+ export function buildExpandRevealPlan({ committedSnapshots, prevTopByKey, hasRecentlyExpandedAncestor, rowHeight, }: {
51
+ committedSnapshots: Array<any>;
52
+ prevTopByKey: Map<string, number>;
53
+ hasRecentlyExpandedAncestor: (rowPath: string) => boolean;
54
+ rowHeight: number;
55
+ }): {
56
+ revealByKey: Map<string, {
57
+ fromTop: number;
58
+ toTop: number;
59
+ travelPx: number;
60
+ parentKey: string;
61
+ }>;
62
+ maxRevealTravelPx: number;
63
+ };
64
+ /**
65
+ * Build a smooth top-to-bottom materialize plan for rows arriving after a query
66
+ * (skeleton -> data replacement or initial viewport arrival).
67
+ *
68
+ * - Full-viewport arrivals (initial mount, or structural queries where every visible
69
+ * slot was a skeleton such as Sort, Filter, Expand All, Collapse All, or field drags)
70
+ * cascade every visible arriving row uniformly even when rowCount grows.
71
+ * - Partial arrivals (e.g., scrolling into an uncached server block) animate only the
72
+ * slots that replaced skeletons, leaving surviving cached rows untouched.
73
+ *
74
+ * @param {{
75
+ * committedSnapshots: Array<any>,
76
+ * prevSkeletonIndices: Set<number>,
77
+ * prevTopByKey: Map<string, number>,
78
+ * expandRevealByKey?: Map<string, any> | null,
79
+ * isInitialMount?: boolean,
80
+ * }} params
81
+ * @returns {Map<string, { delayMs: number, durationMs: number, offsetYPx: number, order: number }>}
82
+ */
83
+ export function buildSkeletonFillPlan({ committedSnapshots, prevSkeletonIndices, prevTopByKey, expandRevealByKey, isInitialMount, }: {
84
+ committedSnapshots: Array<any>;
85
+ prevSkeletonIndices: Set<number>;
86
+ prevTopByKey: Map<string, number>;
87
+ expandRevealByKey?: Map<string, any> | null;
88
+ isInitialMount?: boolean;
89
+ }): Map<string, {
90
+ delayMs: number;
91
+ durationMs: number;
92
+ offsetYPx: number;
93
+ order: number;
94
+ }>;
95
+ /**
96
+ * Pure row-motion geometry & timing helpers shared by PivotTableBody.
97
+ * Kept side-effect-free so expand/collapse synchronization invariants can be
98
+ * verified directly in unit tests.
99
+ */
100
+ export const ROW_MOTION_EASING: "cubic-bezier(0.22, 1, 0.36, 1)";
101
+ export const MAX_FLIP_DISTANCE_PX: 1400;
102
+ export const MAX_SHEET_TRAVEL_PX: 480;
103
+ /** Height of the gap a slow expand opens beneath its row for the loading band. */
104
+ export const ROW_LOADER_BAND_HEIGHT_PX: 30;
105
+ export const SKELETON_FILL_DURATION_MS: 220;
106
+ export const SKELETON_FILL_STAGGER_MS: 14;
107
+ export const SKELETON_FILL_MAX_STAGGER_MS: 110;
108
+ export const SKELETON_FILL_OFFSET_Y_PX: -6;
@@ -2,7 +2,7 @@ export function isAbsoluteSortType(value?: any): any;
2
2
  export function isAbsoluteSortSpecifier(sortSpec?: any): any;
3
3
  export function findSortSpecifier(sorting?: any, columnId?: any): any;
4
4
  export function mergeSortSpecifierMetadata(sortSpec?: any, previousSortSpec?: any): any;
5
- export function normalizeSortingState(sorting?: any, previousSorting?: any): any;
5
+ export function normalizeSortingState(sorting?: any, previousSorting?: any, sortOptions?: any): any;
6
6
  export function updateSortingForColumn({ sorting, columnId, desc, sortMetadata, append, }: any): any;
7
7
  export function resolveColumnSortOptions(sortOptions?: any, columnId?: any): any;
8
8
  export function shouldUseAbsoluteSort(sorting?: any, sortOptions?: any, columnId?: any): any;
@@ -78,6 +78,7 @@ export namespace themes {
78
78
  export let totalBgStrong: string;
79
79
  export let totalText: string;
80
80
  export let totalTextStrong: string;
81
+ export let totalBorder: string;
81
82
  let shadowSm_1: string;
82
83
  export { shadowSm_1 as shadowSm };
83
84
  let shadowMd_1: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serverside_pivot",
3
- "version": "0.0.95",
3
+ "version": "0.0.98",
4
4
  "description": "Enterprise-grade analytical pivot table & virtualized data grid for React. Dual-engine: zero-network in-browser analytics (DuckDB-WASM & in-memory) and scalable server-side pushdown. Built with TanStack Table v8, ECharts 6, and 2D virtualization.",
5
5
  "main": "./dist/react/index.mjs",
6
6
  "types": "./dist/react/react.d.ts",
@@ -46,7 +46,6 @@
46
46
  "echarts-gl": "^2.1.0",
47
47
  "file-saver": "^2.0.5",
48
48
  "ramda": "^0.26.1",
49
- "styled-components": "^5.3.11",
50
49
  "xlsx": "npm:@e965/xlsx@^0.20.3"
51
50
  },
52
51
  "devDependencies": {
@@ -67,9 +66,9 @@
67
66
  "json-schema-to-typescript": "^15.0.4",
68
67
  "npm": "^11.7.0",
69
68
  "prop-types": "^15.7.2",
70
- "react": "^16.8.6",
69
+ "react": "^18.3.1",
71
70
  "react-docgen": "^8.0.3",
72
- "react-dom": "^16.8.6",
71
+ "react-dom": "^18.3.1",
73
72
  "style-loader": "^0.23.1",
74
73
  "typescript": "^5.8.3",
75
74
  "vite": "^6.2.2",
@@ -79,12 +78,11 @@
79
78
  },
80
79
  "peerDependencies": {
81
80
  "react": ">=16.8.6",
82
- "react-dom": ">=16.8.6",
83
- "styled-components": ">=5.3.0"
81
+ "react-dom": ">=16.8.6"
84
82
  },
85
83
  "engines": {
86
- "node": ">=8.11.0",
87
- "npm": ">=6.1.0"
84
+ "node": ">=18.0.0",
85
+ "npm": ">=9.0.0"
88
86
  },
89
87
  "keywords": [
90
88
  "react",
@@ -1,195 +0,0 @@
1
- import p, { useState as T, useRef as R, useCallback as v, useEffect as B, useLayoutEffect as O } from "react";
2
- const G = 80, J = 220, N = ({ actions: e, theme: t, onClose: b, itemRefs: f, onItemMouseEnter: g, onKeyDown: D }) => /* @__PURE__ */ p.createElement(p.Fragment, null, e.map(
3
- /** @param {any} [action] @param {any} [i] @returns {any} */
4
- (u, o) => {
5
- if (u === "separator")
6
- return /* @__PURE__ */ p.createElement(
7
- "div",
8
- {
9
- key: o,
10
- role: "presentation",
11
- style: { height: "1px", background: (t == null ? void 0 : t.border) || "#e0e0e0", margin: "4px 0" }
12
- }
13
- );
14
- const a = !!u.disabled, d = Array.isArray(u.children) && u.children.length > 0;
15
- return /* @__PURE__ */ p.createElement(
16
- "div",
17
- {
18
- key: o,
19
- ref: (l) => {
20
- f && (f.current[o] = l);
21
- },
22
- role: "menuitem",
23
- "aria-haspopup": d ? "menu" : void 0,
24
- "aria-disabled": a || void 0,
25
- tabIndex: a ? -1 : 0,
26
- title: u.title || (typeof u.label == "string" ? u.label : void 0),
27
- onMouseEnter: (l) => {
28
- l.currentTarget.style.backgroundColor = a ? "" : (t == null ? void 0 : t.hover) || "#f5f5f5", g && g(o, d, a);
29
- },
30
- onMouseLeave: (l) => {
31
- l.currentTarget.style.backgroundColor = "";
32
- },
33
- onClick: (l) => {
34
- if (a || d) {
35
- l.stopPropagation();
36
- return;
37
- }
38
- typeof u.onClick == "function" && u.onClick(), b();
39
- },
40
- onKeyDown: (l) => {
41
- a || (l.key === "Enter" || l.key === " " ? (l.preventDefault(), l.stopPropagation(), !d && typeof u.onClick == "function" && u.onClick(), d ? g && g(o, !0, !1) : b()) : D && D(l, o));
42
- },
43
- style: {
44
- padding: "7px 12px 7px 14px",
45
- cursor: a ? "not-allowed" : "pointer",
46
- display: "flex",
47
- alignItems: "center",
48
- gap: "8px",
49
- color: a ? (t == null ? void 0 : t.textSec) || "#757575" : (t == null ? void 0 : t.text) || "#111",
50
- opacity: a ? 0.48 : 1,
51
- userSelect: "none"
52
- }
53
- },
54
- u.icon && /* @__PURE__ */ p.createElement("span", { style: { color: (t == null ? void 0 : t.textSec) || "#757575", display: "flex", flexShrink: 0 } }, u.icon),
55
- /* @__PURE__ */ p.createElement("span", { style: { flex: 1 } }, u.label),
56
- d && /* @__PURE__ */ p.createElement("span", { style: { color: (t == null ? void 0 : t.textSec) || "#9ca3af", fontSize: "10px", marginLeft: "4px" } }, "▶")
57
- );
58
- }
59
- )), U = (e) => ({
60
- background: (e == null ? void 0 : e.surfaceBg) || (e == null ? void 0 : e.background) || "#fff",
61
- border: `1px solid ${(e == null ? void 0 : e.border) || "#ccc"}`,
62
- boxShadow: (e == null ? void 0 : e.shadowMd) || "0 4px 20px rgba(0,0,0,0.15)",
63
- padding: "6px 0",
64
- borderRadius: (e == null ? void 0 : e.radiusSm) || "8px",
65
- fontSize: "13px",
66
- minWidth: "190px",
67
- maxWidth: "300px",
68
- color: (e == null ? void 0 : e.text) || "#111"
69
- }), V = ({ x: e, y: t, onClose: b, actions: f, theme: g }) => {
70
- const [D, u] = T({ x: e, y: t }), [o, a] = T(null), [d, l] = T(null), W = R(null), H = R(null), k = R([]), A = R(null), E = v((n, r = 1) => {
71
- const s = f.length;
72
- for (let i = 0; i < s; i++) {
73
- const y = (n + i * r + s * 2) % s, c = f[y];
74
- if (c && c !== "separator" && !c.disabled && k.current[y]) {
75
- k.current[y].focus();
76
- return;
77
- }
78
- }
79
- }, [f]);
80
- B(() => {
81
- E(0, 1);
82
- }, [E]), B(() => () => clearTimeout(A.current), []);
83
- const K = v(() => {
84
- clearTimeout(A.current), A.current = setTimeout(() => {
85
- a(null), l(null);
86
- }, J);
87
- }, []), L = v(() => {
88
- clearTimeout(A.current);
89
- }, []), C = v((n) => {
90
- clearTimeout(A.current), A.current = setTimeout(() => {
91
- a(n);
92
- const r = k.current[n];
93
- r && l(r.getBoundingClientRect());
94
- }, o !== null ? 0 : G);
95
- }, [o]), Y = v((n, r, s) => {
96
- s || (r ? C(n) : (L(), a(null), l(null)));
97
- }, [C, L]), I = v((n, r) => {
98
- if (n.key === "Escape")
99
- n.preventDefault(), b();
100
- else if (n.key === "ArrowDown")
101
- n.preventDefault(), E(r + 1, 1);
102
- else if (n.key === "ArrowUp")
103
- n.preventDefault(), E(r - 1, -1);
104
- else if (n.key === "Home")
105
- n.preventDefault(), E(0, 1);
106
- else if (n.key === "End")
107
- n.preventDefault(), E(f.length - 1, -1);
108
- else if (n.key === "ArrowRight" && o === null && Number.isFinite(r) && r >= 0) {
109
- const s = f[r];
110
- s && s !== "separator" && Array.isArray(s.children) && (n.preventDefault(), C(r));
111
- }
112
- }, [b, E, f, o, C]);
113
- O(() => {
114
- const n = () => {
115
- var F;
116
- const r = window.innerWidth, s = window.innerHeight, i = (F = W.current) == null ? void 0 : F.getBoundingClientRect(), y = (i == null ? void 0 : i.width) || 200, c = (i == null ? void 0 : i.height) || f.length * 32 + 20, x = 8;
117
- let M = Math.max(x, Math.min(e, r - y - x)), q = Math.max(x, Math.min(t, s - c - x));
118
- u({ x: M, y: q });
119
- };
120
- return n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
121
- window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
122
- };
123
- }, [e, t, f.length]);
124
- const [_, $] = T({ left: 0, top: 0 });
125
- O(() => {
126
- if (!d || o === null) return;
127
- const n = H.current;
128
- if (!n) return;
129
- const r = window.innerWidth, s = window.innerHeight, i = n.offsetWidth || 200, y = n.offsetHeight || 200, c = 6;
130
- let x = d.right + 2;
131
- x + i > r - c && (x = d.left - i - 2);
132
- let M = d.top - 6;
133
- M + y > s - c && (M = s - y - c), $({ left: Math.max(c, x), top: Math.max(c, M) });
134
- }, [d, o]);
135
- const P = o !== null ? f[o] : null, w = P && Array.isArray(P.children) ? P.children : null, S = R([]), z = v((n, r = 1) => {
136
- if (!w) return;
137
- const s = w.length;
138
- for (let i = 0; i < s; i++) {
139
- const y = (n + i * r + s * 2) % s, c = w[y];
140
- if (c && c !== "separator" && !c.disabled && S.current[y]) {
141
- S.current[y].focus();
142
- return;
143
- }
144
- }
145
- }, [w]);
146
- B(() => {
147
- w && (S.current = S.current.slice(0, w.length));
148
- }, [w]);
149
- const j = v((n, r) => {
150
- n.key === "Escape" || n.key === "ArrowLeft" ? (n.preventDefault(), n.stopPropagation(), a(null), l(null), o !== null && k.current[o] && k.current[o].focus()) : n.key === "ArrowDown" ? (n.preventDefault(), z(r + 1, 1)) : n.key === "ArrowUp" && (n.preventDefault(), z(r - 1, -1));
151
- }, [z, o]);
152
- return /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement(
153
- "div",
154
- {
155
- ref: W,
156
- role: "menu",
157
- style: { position: "fixed", top: D.y, left: D.x, zIndex: 10001, ...U(g) },
158
- onMouseLeave: K,
159
- onMouseEnter: L
160
- },
161
- /* @__PURE__ */ p.createElement(
162
- N,
163
- {
164
- actions: f,
165
- theme: g,
166
- onClose: b,
167
- itemRefs: k,
168
- onItemMouseEnter: Y,
169
- onKeyDown: I
170
- }
171
- )
172
- ), w && /* @__PURE__ */ p.createElement(
173
- "div",
174
- {
175
- ref: H,
176
- role: "menu",
177
- style: { position: "fixed", top: _.top, left: _.left, zIndex: 10002, ...U(g) },
178
- onMouseEnter: L,
179
- onMouseLeave: K
180
- },
181
- /* @__PURE__ */ p.createElement(
182
- N,
183
- {
184
- actions: w,
185
- theme: g,
186
- onClose: b,
187
- itemRefs: S,
188
- onKeyDown: j
189
- }
190
- )
191
- ));
192
- };
193
- export {
194
- V as default
195
- };