serverside_pivot 0.0.96 → 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 (52) hide show
  1. package/README.md +5 -4
  2. package/dist/react/chunks/ContextMenu-DQGCdUhU.mjs +211 -0
  3. package/dist/react/chunks/{DetailDrawer-DgKSC5Vu.mjs → DetailDrawer-yMFRd6Td.mjs} +1 -1
  4. package/dist/react/chunks/{DetailSidePanel-CC5Dugyl.mjs → DetailSidePanel-B6fYMnn7.mjs} +1 -1
  5. package/dist/react/chunks/{DetailSurfaceContent-CrQVHlcU.mjs → DetailSurfaceContent-B9cfLYti.mjs} +1 -1
  6. package/dist/react/chunks/{ECharts2dRenderer-46gLrUdf.mjs → ECharts2dRenderer-ER6rHtch.mjs} +1 -1
  7. package/dist/react/chunks/{ECharts3dRenderer-Dg4ta5Bl.mjs → ECharts3dRenderer-BMVfbpXH.mjs} +1 -1
  8. package/dist/react/chunks/{EditSidePanel-CkShaByb.mjs → EditSidePanel-BjJd5BaX.mjs} +1 -1
  9. package/dist/react/chunks/{InlineDetailPanel-mnwjoD0I.mjs → InlineDetailPanel-Bbkpv9jz.mjs} +1 -1
  10. package/dist/react/chunks/{PivotCharts-MX-Z7DlR.mjs → PivotCharts-P5cBJcwu.mjs} +5 -3
  11. package/dist/react/chunks/{ReportEditor-U0E42xKL.mjs → ReportEditor-P4UZ97Ik.mjs} +174 -175
  12. package/dist/react/chunks/{SidebarPanel-BzRW1Kgq.mjs → SidebarPanel-DRoxHRhK.mjs} +1039 -1024
  13. package/dist/react/chunks/{SparklineDetailGraph-35Tim_8B.mjs → SparklineDetailGraph-C9UX-feP.mjs} +22 -22
  14. package/dist/react/chunks/clientCoreRuntime-n2guUxhp.mjs +790 -0
  15. package/dist/react/chunks/{installCanvasRenderer-DRq0xpXO.mjs → installCanvasRenderer-BR0XmdVX.mjs} +1 -1
  16. package/dist/react/chunks/{react-CL4GbEOd.mjs → react-B5JcZShu.mjs} +17394 -13825
  17. package/dist/react/chunks/{xlsx.mini.min-kfIgXMVB.mjs → xlsx.mini.min-YUTWASKG.mjs} +1 -1
  18. package/dist/react/components/DashTanstackPivot.react.d.ts +6 -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/hooks/useDismiss.d.ts +43 -0
  24. package/dist/react/hooks/usePivotNormalization.d.ts +4 -0
  25. package/dist/react/hooks/usePrefersReducedMotion.d.ts +8 -0
  26. package/dist/react/hooks/useRenderHelpers.d.ts +1 -1
  27. package/dist/react/hooks/useRowCache.d.ts +2 -0
  28. package/dist/react/hooks/useServerSideRowModel.d.ts +1 -1
  29. package/dist/react/index.mjs +28 -19
  30. package/dist/react/react.d.ts +6 -1
  31. package/dist/react/runtime/client/clientPivotTransport.d.ts +16 -0
  32. package/dist/react/runtime/client/clientResponsePostProcessor.d.ts +8 -1
  33. package/dist/react/runtime/client/clientSubscriptionEngine.d.ts +88 -0
  34. package/dist/react/runtime/client/duckdbWasmExecutor.d.ts +22 -0
  35. package/dist/react/runtime/client/index.d.ts +1 -0
  36. package/dist/react/runtime/client/types.d.ts +6 -0
  37. package/dist/react/runtime/core/clientCoreRuntime.d.ts +46 -0
  38. package/dist/react/runtime/core/duckdbSqlEmitter.d.ts +37 -0
  39. package/dist/react/runtime/core/semanticIr.generated.d.ts +196 -0
  40. package/dist/react/runtime/responseQueue.d.ts +21 -0
  41. package/dist/react/runtime/rowIdentity.d.ts +20 -0
  42. package/dist/react/runtime/runtimeDomains.d.ts +8 -1
  43. package/dist/react/runtime/streamingTypes.d.ts +182 -0
  44. package/dist/react/runtime/useRuntimeViewportTableData.d.ts +1 -1
  45. package/dist/react/runtime/useViewportSubscriptionStore.d.ts +112 -0
  46. package/dist/react/runtime/useWorkspaceStatusPresentation.d.ts +1 -1
  47. package/dist/react/utils/helpers.d.ts +1 -1
  48. package/dist/react/utils/pivotLayoutUtils.d.ts +3 -3
  49. package/dist/react/utils/rowMotion.d.ts +108 -0
  50. package/dist/react/utils/styles.d.ts +1 -0
  51. package/package.json +6 -8
  52. package/dist/react/chunks/ContextMenu-DJuS4qTZ.mjs +0 -198
@@ -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;
@@ -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.96",
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,198 +0,0 @@
1
- import c, { useState as C, useRef as M, useCallback as b, useEffect as W, useLayoutEffect as K } from "react";
2
- import { I as z } from "./react-CL4GbEOd.mjs";
3
- const G = 80, J = 220, _ = ({ actions: n, theme: r, onClose: v, itemRefs: f, onItemMouseEnter: g, onKeyDown: D }) => /* @__PURE__ */ c.createElement(c.Fragment, null, n.map(
4
- /** @param {any} [action] @param {any} [i] @returns {any} */
5
- (i, l) => {
6
- if (i === "separator")
7
- return /* @__PURE__ */ c.createElement(
8
- "div",
9
- {
10
- key: l,
11
- role: "presentation",
12
- style: { height: "1px", background: (r == null ? void 0 : r.border) || "#e0e0e0", margin: "4px 0" }
13
- }
14
- );
15
- const p = !!i.disabled, d = Array.isArray(i.children) && i.children.length > 0;
16
- return /* @__PURE__ */ c.createElement(
17
- "div",
18
- {
19
- key: l,
20
- ref: (u) => {
21
- f && (f.current[l] = u);
22
- },
23
- className: "sp-menu-item",
24
- role: "menuitem",
25
- "aria-haspopup": d ? "menu" : void 0,
26
- "aria-disabled": p || void 0,
27
- tabIndex: p ? -1 : 0,
28
- title: i.title || (typeof i.label == "string" ? i.label : void 0),
29
- onMouseEnter: () => {
30
- g && g(l, d, p);
31
- },
32
- onClick: (u) => {
33
- if (p || d) {
34
- u.stopPropagation();
35
- return;
36
- }
37
- typeof i.onClick == "function" && i.onClick(), v();
38
- },
39
- onKeyDown: (u) => {
40
- p || (u.key === "Enter" || u.key === " " ? (u.preventDefault(), u.stopPropagation(), !d && typeof i.onClick == "function" && i.onClick(), d ? g && g(l, !0, !1) : v()) : D && D(u, l));
41
- },
42
- style: {
43
- padding: "7px 10px",
44
- cursor: p ? "not-allowed" : "pointer",
45
- display: "flex",
46
- alignItems: "center",
47
- gap: "8px",
48
- color: p ? (r == null ? void 0 : r.textSec) || "#757575" : (r == null ? void 0 : r.text) || "#111",
49
- opacity: p ? 0.48 : 1,
50
- userSelect: "none"
51
- }
52
- },
53
- i.icon && /* @__PURE__ */ c.createElement("span", { style: { color: (r == null ? void 0 : r.textSec) || "#757575", display: "flex", flexShrink: 0 } }, i.icon),
54
- /* @__PURE__ */ c.createElement("span", { style: { flex: 1 } }, i.label),
55
- d && /* @__PURE__ */ c.createElement("span", { "aria-hidden": "true", style: { color: (r == null ? void 0 : r.textSec) || "#9ca3af", display: "inline-flex", alignItems: "center", marginLeft: "4px" } }, z && z.ChevronRight ? /* @__PURE__ */ c.createElement(z.ChevronRight, null) : ">")
56
- );
57
- }
58
- )), O = (n) => ({
59
- background: `var(--sp-glass-bg, ${(n == null ? void 0 : n.surfaceBg) || (n == null ? void 0 : n.background) || "#fff"})`,
60
- backdropFilter: "blur(18px) saturate(180%)",
61
- WebkitBackdropFilter: "blur(18px) saturate(180%)",
62
- border: `1px solid ${(n == null ? void 0 : n.border) || "#ccc"}`,
63
- boxShadow: (n == null ? void 0 : n.shadow) || (n == null ? void 0 : n.shadowMd) || "0 14px 36px rgba(0,0,0,0.18)",
64
- padding: "5px",
65
- borderRadius: "10px",
66
- fontSize: "13px",
67
- minWidth: "190px",
68
- maxWidth: "300px",
69
- color: (n == null ? void 0 : n.text) || "#111"
70
- }), X = ({ x: n, y: r, onClose: v, actions: f, theme: g }) => {
71
- const [D, i] = C({ x: n, y: r }), [l, p] = C(null), [d, u] = C(null), B = M(null), F = M(null), k = M([]), A = M(null), E = b((e, t = 1) => {
72
- const o = f.length;
73
- for (let s = 0; s < o; s++) {
74
- const y = (e + s * t + o * 2) % o, a = f[y];
75
- if (a && a !== "separator" && !a.disabled && k.current[y]) {
76
- k.current[y].focus();
77
- return;
78
- }
79
- }
80
- }, [f]);
81
- W(() => {
82
- E(0, 1);
83
- }, [E]), W(() => () => clearTimeout(A.current), []);
84
- const N = b(() => {
85
- clearTimeout(A.current), A.current = setTimeout(() => {
86
- p(null), u(null);
87
- }, J);
88
- }, []), L = b(() => {
89
- clearTimeout(A.current);
90
- }, []), m = b((e) => {
91
- clearTimeout(A.current), A.current = setTimeout(() => {
92
- p(e);
93
- const t = k.current[e];
94
- t && u(t.getBoundingClientRect());
95
- }, l !== null ? 0 : G);
96
- }, [l]), U = b((e, t, o) => {
97
- o || (t ? m(e) : (L(), p(null), u(null)));
98
- }, [m, L]), Y = b((e, t) => {
99
- if (e.key === "Escape")
100
- e.preventDefault(), v();
101
- else if (e.key === "ArrowDown")
102
- e.preventDefault(), E(t + 1, 1);
103
- else if (e.key === "ArrowUp")
104
- e.preventDefault(), E(t - 1, -1);
105
- else if (e.key === "Home")
106
- e.preventDefault(), E(0, 1);
107
- else if (e.key === "End")
108
- e.preventDefault(), E(f.length - 1, -1);
109
- else if (e.key === "ArrowRight" && l === null && Number.isFinite(t) && t >= 0) {
110
- const o = f[t];
111
- o && o !== "separator" && Array.isArray(o.children) && (e.preventDefault(), m(t));
112
- }
113
- }, [v, E, f, l, m]);
114
- K(() => {
115
- const e = () => {
116
- var I;
117
- const t = window.innerWidth, o = window.innerHeight, s = (I = B.current) == null ? void 0 : I.getBoundingClientRect(), y = (s == null ? void 0 : s.width) || 200, a = (s == null ? void 0 : s.height) || f.length * 32 + 20, x = 8;
118
- let S = Math.max(x, Math.min(n, t - y - x)), q = Math.max(x, Math.min(r, o - a - x));
119
- i({ x: S, y: q });
120
- };
121
- return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
122
- window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
123
- };
124
- }, [n, r, f.length]);
125
- const [H, $] = C({ left: 0, top: 0 });
126
- K(() => {
127
- if (!d || l === null) return;
128
- const e = F.current;
129
- if (!e) return;
130
- const t = window.innerWidth, o = window.innerHeight, s = e.offsetWidth || 200, y = e.offsetHeight || 200, a = 6;
131
- let x = d.right + 2;
132
- x + s > t - a && (x = d.left - s - 2);
133
- let S = d.top - 6;
134
- S + y > o - a && (S = o - y - a), $({ left: Math.max(a, x), top: Math.max(a, S) });
135
- }, [d, l]);
136
- const P = l !== null ? f[l] : null, w = P && Array.isArray(P.children) ? P.children : null, R = M([]), T = b((e, t = 1) => {
137
- if (!w) return;
138
- const o = w.length;
139
- for (let s = 0; s < o; s++) {
140
- const y = (e + s * t + o * 2) % o, a = w[y];
141
- if (a && a !== "separator" && !a.disabled && R.current[y]) {
142
- R.current[y].focus();
143
- return;
144
- }
145
- }
146
- }, [w]);
147
- W(() => {
148
- w && (R.current = R.current.slice(0, w.length));
149
- }, [w]);
150
- const j = b((e, t) => {
151
- e.key === "Escape" || e.key === "ArrowLeft" ? (e.preventDefault(), e.stopPropagation(), p(null), u(null), l !== null && k.current[l] && k.current[l].focus()) : e.key === "ArrowDown" ? (e.preventDefault(), T(t + 1, 1)) : e.key === "ArrowUp" && (e.preventDefault(), T(t - 1, -1));
152
- }, [T, l]);
153
- return /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(
154
- "div",
155
- {
156
- ref: B,
157
- className: "sp-menu-surface",
158
- role: "menu",
159
- style: { position: "fixed", top: D.y, left: D.x, zIndex: 10001, ...O(g) },
160
- onMouseLeave: N,
161
- onMouseEnter: L
162
- },
163
- /* @__PURE__ */ c.createElement(
164
- _,
165
- {
166
- actions: f,
167
- theme: g,
168
- onClose: v,
169
- itemRefs: k,
170
- onItemMouseEnter: U,
171
- onKeyDown: Y
172
- }
173
- )
174
- ), w && /* @__PURE__ */ c.createElement(
175
- "div",
176
- {
177
- ref: F,
178
- className: "sp-menu-surface",
179
- role: "menu",
180
- style: { position: "fixed", top: H.top, left: H.left, zIndex: 10002, ...O(g) },
181
- onMouseEnter: L,
182
- onMouseLeave: N
183
- },
184
- /* @__PURE__ */ c.createElement(
185
- _,
186
- {
187
- actions: w,
188
- theme: g,
189
- onClose: v,
190
- itemRefs: R,
191
- onKeyDown: j
192
- }
193
- )
194
- ));
195
- };
196
- export {
197
- X as default
198
- };