@ishibashi0112/spreadsheet-grid-core 0.46.0 → 0.47.0

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 (62) hide show
  1. package/dist/controllers/changeHighlightController.cjs +1 -0
  2. package/dist/controllers/changeHighlightController.d.ts +31 -0
  3. package/dist/controllers/changeHighlightController.js +97 -0
  4. package/dist/controllers/clipboardController.cjs +1 -1
  5. package/dist/controllers/clipboardController.d.ts +1 -0
  6. package/dist/controllers/clipboardController.js +1 -1
  7. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  8. package/dist/controllers/columnHeaderDragController.d.ts +1 -0
  9. package/dist/controllers/columnHeaderDragController.js +132 -74
  10. package/dist/controllers/findController.cjs +1 -0
  11. package/dist/controllers/findController.d.ts +38 -0
  12. package/dist/controllers/findController.js +137 -0
  13. package/dist/controllers/keyboardController.cjs +1 -1
  14. package/dist/controllers/keyboardController.d.ts +1 -0
  15. package/dist/controllers/keyboardController.js +14 -10
  16. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  17. package/dist/controllers/pointerInteractionsController.d.ts +1 -0
  18. package/dist/controllers/pointerInteractionsController.js +1 -1
  19. package/dist/controllers/reducedMotionStore.cjs +1 -0
  20. package/dist/controllers/reducedMotionStore.d.ts +5 -0
  21. package/dist/controllers/reducedMotionStore.js +18 -0
  22. package/dist/controllers/rowDragController.cjs +1 -1
  23. package/dist/controllers/rowDragController.d.ts +1 -0
  24. package/dist/controllers/rowDragController.js +121 -70
  25. package/dist/controllers/rowEnterController.cjs +1 -0
  26. package/dist/controllers/rowEnterController.d.ts +19 -0
  27. package/dist/controllers/rowEnterController.js +88 -0
  28. package/dist/controllers/saveStatusController.cjs +1 -0
  29. package/dist/controllers/saveStatusController.d.ts +30 -0
  30. package/dist/controllers/saveStatusController.js +74 -0
  31. package/dist/controllers/scrollSyncController.cjs +1 -1
  32. package/dist/controllers/scrollSyncController.d.ts +2 -0
  33. package/dist/controllers/scrollSyncController.js +36 -34
  34. package/dist/controllers/serverSideRowModel.cjs +1 -1
  35. package/dist/controllers/serverSideRowModel.d.ts +8 -0
  36. package/dist/controllers/serverSideRowModel.js +21 -6
  37. package/dist/controllers/tooltipController.cjs +1 -1
  38. package/dist/controllers/tooltipController.js +1 -1
  39. package/dist/engine/createGridEngine.cjs +1 -1
  40. package/dist/engine/createGridEngine.d.ts +10 -0
  41. package/dist/engine/createGridEngine.js +56 -46
  42. package/dist/engine/gridApi.cjs +1 -1
  43. package/dist/engine/gridApi.d.ts +6 -0
  44. package/dist/engine/gridApi.js +12 -0
  45. package/dist/logic/conditionalFormat.cjs +1 -0
  46. package/dist/logic/conditionalFormat.d.ts +19 -0
  47. package/dist/logic/conditionalFormat.js +88 -0
  48. package/dist/logic/find.cjs +1 -0
  49. package/dist/logic/find.d.ts +27 -0
  50. package/dist/logic/find.js +56 -0
  51. package/dist/logic/motion.cjs +1 -0
  52. package/dist/logic/motion.d.ts +4 -0
  53. package/dist/logic/motion.js +4 -0
  54. package/dist/logic/selectionOverlayGeometry.cjs +1 -0
  55. package/dist/logic/selectionOverlayGeometry.d.ts +15 -0
  56. package/dist/logic/selectionOverlayGeometry.js +43 -0
  57. package/dist/model/gridStore.cjs +1 -1
  58. package/dist/model/gridStore.d.ts +13 -1
  59. package/dist/model/gridStore.js +11 -5
  60. package/dist/model/gridTypes.core.d.ts +198 -0
  61. package/dist/model/gridTypes.unbound.d.ts +1 -0
  62. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs");var t=`ssg-body-cell--changed`,n=5e3,r=2e3,i=200,a=1500,o=260,s=(e,t,n)=>e.valueFormatter?e.valueFormatter({value:n,row:t,column:e}):String(n??``),c=e=>typeof e==`number`&&Number.isFinite(e),l=(e,t)=>{if(!e)return t;let n=e.trim(),r=/^(-?[\d.]+)\s*(ms|s)$/.exec(n);if(!r)return t;let i=Number(r[1]);return Number.isFinite(i)?r[2]===`s`?i*1e3:i:t},u=(t,n,r,i,a)=>{if(t.length!==r.length)return null;let o=[],s=0;for(let c=0;c<r.length;c+=1){let l=t[c],u=r[c];if(l===u)continue;if(s+=1,s>5e3)return null;let d=i(u,c);if(n(l,c)!==d)return null;for(let t of a){let n=e.getCellValue(l,t),r=e.getCellValue(u,t);if(!Object.is(n,r)&&(o.push({rowKey:d,column:t,row:u,prevValue:n,nextValue:r}),o.length>2e3))return null}}return o},d=e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`),f=()=>{let e=null,n=new Map,r=new Set,i=e=>{e.classList.remove(t);let r=n.get(e);r!==void 0&&(clearTimeout(r),n.delete(e))},f=e=>{i(e),e.offsetWidth,e.classList.add(t);let r=()=>{e.removeEventListener(`animationend`,r),i(e)};e.addEventListener(`animationend`,r),n.set(e,setTimeout(()=>{e.removeEventListener(`animationend`,r),i(e)},a))},p=e=>{let t=e.firstElementChild;if(!t||t.childNodes.length!==1)return null;let n=t.firstChild;return n&&n.nodeType===Node.TEXT_NODE?n:null},m=(e,t,n)=>{if(!c(t.prevValue)||!c(t.nextValue)||n<=0||typeof requestAnimationFrame!=`function`)return;let i=p(e);if(!i)return;let a=i.nodeValue??``,o=t.prevValue,l=t.nextValue,u=/\.(\d+)$/.exec(String(l)),d=Math.min(2,u?u[1].length:0),f=performance.now();i.nodeValue=s(t.column,t.row,o);let m=e=>{r.delete(h);let c=Math.min(1,(e-f)/n);if(c>=1||i.parentNode===null){i.nodeValue=a;return}let u=1-(1-c)**3,p=Number((o+(l-o)*u).toFixed(d));i.nodeValue=s(t.column,t.row,p),h=requestAnimationFrame(m),r.add(h)},h=requestAnimationFrame(m);r.add(h)};return{update:t=>{let{enabled:n,rows:r,rowKeyGetter:i,columns:a,scrollContainerRef:s}=t,c=e;if(e={rows:r,rowKeyGetter:i},!n||c===null||c.rows===r)return;let p=s.current;if(!p)return;let h=u(c.rows,c.rowKeyGetter,r,i,a);if(!h||h.length===0)return;let g=l(getComputedStyle(p).getPropertyValue(`--ssg-motion-base`),o),_=h.length<=200;for(let e of h){let t=`.ssg-body-row[data-row-key="${d(String(e.rowKey))}"] .ssg-body-cell[data-ssg-col-key="${d(String(e.column.key))}"]`;p.querySelectorAll(t).forEach(t=>{f(t),_&&!e.column.renderCell&&m(t,e,g)})}},dispose:()=>{for(let e of Array.from(n.keys()))i(e);if(typeof cancelAnimationFrame==`function`)for(let e of r)cancelAnimationFrame(e);r.clear(),e=null}}};exports.CHANGED_CLASS_NAME=t,exports.CHANGED_FALLBACK_MS=a,exports.MAX_CHANGED_ROWS=n,exports.MAX_FLASH_CELLS=r,exports.MAX_TWEEN_CELLS=i,exports.createChangeHighlightController=f,exports.diffChangedCells=u,exports.parseCssDuration=l;
@@ -0,0 +1,31 @@
1
+ import type { GridColumn, GridRowKey } from '../model/gridTypes.unbound.js';
2
+ type ReadonlyRef<V> = {
3
+ readonly current: V;
4
+ };
5
+ export type ChangeHighlightArgs<T> = {
6
+ enabled: boolean;
7
+ rows: readonly T[];
8
+ rowKeyGetter: (row: T, index: number) => GridRowKey;
9
+ columns: readonly GridColumn<T>[];
10
+ scrollContainerRef: ReadonlyRef<HTMLElement | null>;
11
+ };
12
+ export type ChangeHighlightController<T> = {
13
+ update: (args: ChangeHighlightArgs<T>) => void;
14
+ dispose: () => void;
15
+ };
16
+ export declare const CHANGED_CLASS_NAME = "ssg-body-cell--changed";
17
+ export declare const MAX_CHANGED_ROWS = 5000;
18
+ export declare const MAX_FLASH_CELLS = 2000;
19
+ export declare const MAX_TWEEN_CELLS = 200;
20
+ export declare const CHANGED_FALLBACK_MS = 1500;
21
+ type ChangedCell<T> = {
22
+ rowKey: GridRowKey;
23
+ column: GridColumn<T>;
24
+ row: T;
25
+ prevValue: unknown;
26
+ nextValue: unknown;
27
+ };
28
+ export declare const parseCssDuration: (raw: string | null | undefined, fallback: number) => number;
29
+ export declare const diffChangedCells: <T>(prevRows: readonly T[], prevKeyOf: (row: T, index: number) => GridRowKey, nextRows: readonly T[], nextKeyOf: (row: T, index: number) => GridRowKey, columns: readonly GridColumn<T>[]) => ChangedCell<T>[] | null;
30
+ export declare const createChangeHighlightController: <T>() => ChangeHighlightController<T>;
31
+ export {};
@@ -0,0 +1,97 @@
1
+ import { getCellValue as e } from "../utils/permissions.js";
2
+ //#region src/controllers/changeHighlightController.ts
3
+ var t = "ssg-body-cell--changed", n = 5e3, r = 2e3, i = 200, a = 1500, o = 260, s = (e, t, n) => e.valueFormatter ? e.valueFormatter({
4
+ value: n,
5
+ row: t,
6
+ column: e
7
+ }) : String(n ?? ""), c = (e) => typeof e == "number" && Number.isFinite(e), l = (e, t) => {
8
+ if (!e) return t;
9
+ let n = e.trim(), r = /^(-?[\d.]+)\s*(ms|s)$/.exec(n);
10
+ if (!r) return t;
11
+ let i = Number(r[1]);
12
+ return Number.isFinite(i) ? r[2] === "s" ? i * 1e3 : i : t;
13
+ }, u = (t, n, r, i, a) => {
14
+ if (t.length !== r.length) return null;
15
+ let o = [], s = 0;
16
+ for (let c = 0; c < r.length; c += 1) {
17
+ let l = t[c], u = r[c];
18
+ if (l === u) continue;
19
+ if (s += 1, s > 5e3) return null;
20
+ let d = i(u, c);
21
+ if (n(l, c) !== d) return null;
22
+ for (let t of a) {
23
+ let n = e(l, t), r = e(u, t);
24
+ if (!Object.is(n, r) && (o.push({
25
+ rowKey: d,
26
+ column: t,
27
+ row: u,
28
+ prevValue: n,
29
+ nextValue: r
30
+ }), o.length > 2e3)) return null;
31
+ }
32
+ }
33
+ return o;
34
+ }, d = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&"), f = () => {
35
+ let e = null, n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = (e) => {
36
+ e.classList.remove(t);
37
+ let r = n.get(e);
38
+ r !== void 0 && (clearTimeout(r), n.delete(e));
39
+ }, f = (e) => {
40
+ i(e), e.offsetWidth, e.classList.add(t);
41
+ let r = () => {
42
+ e.removeEventListener("animationend", r), i(e);
43
+ };
44
+ e.addEventListener("animationend", r), n.set(e, setTimeout(() => {
45
+ e.removeEventListener("animationend", r), i(e);
46
+ }, a));
47
+ }, p = (e) => {
48
+ let t = e.firstElementChild;
49
+ if (!t || t.childNodes.length !== 1) return null;
50
+ let n = t.firstChild;
51
+ return n && n.nodeType === Node.TEXT_NODE ? n : null;
52
+ }, m = (e, t, n) => {
53
+ if (!c(t.prevValue) || !c(t.nextValue) || n <= 0 || typeof requestAnimationFrame != "function") return;
54
+ let i = p(e);
55
+ if (!i) return;
56
+ let a = i.nodeValue ?? "", o = t.prevValue, l = t.nextValue, u = /\.(\d+)$/.exec(String(l)), d = Math.min(2, u ? u[1].length : 0), f = performance.now();
57
+ i.nodeValue = s(t.column, t.row, o);
58
+ let m = (e) => {
59
+ r.delete(h);
60
+ let c = Math.min(1, (e - f) / n);
61
+ if (c >= 1 || i.parentNode === null) {
62
+ i.nodeValue = a;
63
+ return;
64
+ }
65
+ let u = 1 - (1 - c) ** 3, p = Number((o + (l - o) * u).toFixed(d));
66
+ i.nodeValue = s(t.column, t.row, p), h = requestAnimationFrame(m), r.add(h);
67
+ }, h = requestAnimationFrame(m);
68
+ r.add(h);
69
+ };
70
+ return {
71
+ update: (t) => {
72
+ let { enabled: n, rows: r, rowKeyGetter: i, columns: a, scrollContainerRef: s } = t, c = e;
73
+ if (e = {
74
+ rows: r,
75
+ rowKeyGetter: i
76
+ }, !n || c === null || c.rows === r) return;
77
+ let p = s.current;
78
+ if (!p) return;
79
+ let h = u(c.rows, c.rowKeyGetter, r, i, a);
80
+ if (!h || h.length === 0) return;
81
+ let g = l(getComputedStyle(p).getPropertyValue("--ssg-motion-base"), o), _ = h.length <= 200;
82
+ for (let e of h) {
83
+ let t = `.ssg-body-row[data-row-key="${d(String(e.rowKey))}"] .ssg-body-cell[data-ssg-col-key="${d(String(e.column.key))}"]`;
84
+ p.querySelectorAll(t).forEach((t) => {
85
+ f(t), _ && !e.column.renderCell && m(t, e, g);
86
+ });
87
+ }
88
+ },
89
+ dispose: () => {
90
+ for (let e of Array.from(n.keys())) i(e);
91
+ if (typeof cancelAnimationFrame == "function") for (let e of r) cancelAnimationFrame(e);
92
+ r.clear(), e = null;
93
+ }
94
+ };
95
+ };
96
+ //#endregion
97
+ export { t as CHANGED_CLASS_NAME, a as CHANGED_FALLBACK_MS, n as MAX_CHANGED_ROWS, r as MAX_FLASH_CELLS, i as MAX_TWEEN_CELLS, f as createChangeHighlightController, u as diffChangedCells, l as parseCssDuration };
@@ -1,2 +1,2 @@
1
1
  Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("../model/gridActions.cjs"),n=require("../logic/geometry.cjs"),r=require("../logic/domGuards.cjs"),i=require("../utils/clipboard.cjs"),a=require("../logic/labelRows.cjs");var o=(e,t,n)=>{if(t===0||n===0||e?.type!==`cell`)return!1;let{start:r,end:i}=e.range,a=Math.min(r.row,i.row),o=Math.min(r.col,i.col),s=Math.max(r.row,i.row),c=Math.max(r.col,i.col);return a===0&&o===0&&s===t-1&&c===n-1},s=()=>{let s=null,c=e=>{s=e},l=e=>{let{isRowExportable:t,rowModel:n}=e;if(t)return(e,r)=>t(e,{viewRowIndex:r,rowKey:n.getRowKey(r)??r})},u=t=>{let{rowModel:n,visibleColumns:r}=t,a=n.getRowCount();if(a===0||r.length===0)return``;let o=l(t),s=[];for(let t=0;t<a;t+=1){let a=n.getRow(t);if(!a||o&&!o(a,t))continue;let c=r.map(t=>{let n=e.getCellValue(a,t);return t.formatClipboardValue?t.formatClipboardValue(n,a):String(n??``)});s.push(i.joinTsvRow(c))}return s.join(`
2
- `)};return{update:c,handleCopy:async()=>{if(s===null)return;let e=s,{rowModel:t,visibleColumns:n,uiState:r}=e,a=o(r.selection,t.getRowCount(),n.length)?u(e):i.serializeSelectionToTsv(t.getRow,t.getRowCount(),n,r.selection,l(e));a&&await i.writeTextToClipboard(a)},handlePaste:o=>{if(s===null)return;let{rows:c,rowModel:l,columns:u,visibleColumns:d,uiState:f,readOnly:p,canEditCell:m,createRow:h,createOverflowColumn:g,onRowsChange:_,onColumnsChange:v,applyServerSideCellEdits:y,dispatch:b}=s;if(f.editingCell||r.shouldIgnoreGridKeydown(o.target??null)||p||!_&&!y||!f.activeCell)return;let x=o.clipboardData?.getData(`text/plain`)??``;if(!x)return;o.preventDefault();let S=i.parseClipboardText(x);if(S.length===0)return;let C=S.reduce((e,t)=>Math.max(e,t.length),0);if(C===0)return;let w=f.activeCell.row,T=f.activeCell.col,E=l.getLabelRow===void 0?null:a.resolvePasteTargetViewIndexes(l,w,S.length),D=e=>E?E[e-w]:e,O=E?E[E.length-1]:f.activeCell.row+Math.max(S.length-1,0);if(y){let r=i.buildClipboardCellEdits(e=>l.getRow(D(e)),d,S,w,T,(t,n,r,i)=>e.isCellEditable({readOnly:p,canEditCell:m},D(t),n,r,i)).map(e=>({...e,viewIndex:D(e.viewIndex)}));r.length>0&&y(r);let a=n.clamp(O,0,Math.max(l.getRowCount()-1,0)),o=n.clamp(f.activeCell.col+Math.max(C-1,0),0,Math.max(d.length-1,0));b(t.gridActions.startSelection(f.activeCell)),b(t.gridActions.updateSelection({row:a,col:o})),b(t.gridActions.endSelection()),b(t.gridActions.activateCell(f.activeCell));return}if(!_||l.getSourceIndex(w)===void 0)return;let k=f.activeCell.col,A=[...c],j=[...d],M=l.getRowCount(),N=A.length,P=e=>{let t=D(e);return t<M?l.getSourceIndex(t):N+(t-M)},F=Math.max(O+1-M,0),I=A.length+F;if(I>A.length&&h)for(;A.length<I;)A.push(h());let L=k+C;if(L>j.length&&v&&g){let e=[];for(;j.length<L;){let t=g(j.length);j.push(t),e.push(t)}v(u?[...u,...e]:j)}let R=i.applyClipboardMatrixToRows(A,P,j,S,w,k,(t,n,r,i)=>e.isCellEditable({readOnly:p,canEditCell:m},t,n,r,i)),z=n.clamp(O,0,Math.max(Math.max(l.getRowCount()-1,0),O)),B=n.clamp(f.activeCell.col+Math.max((S[0]?.length??1)-1,0),0,Math.max(Math.max(j.length-1,0),k+C-1));_(R),b(t.gridActions.startSelection(f.activeCell)),b(t.gridActions.updateSelection({row:z,col:B})),b(t.gridActions.endSelection()),b(t.gridActions.activateCell(f.activeCell))}}};exports.computeIsWholeGridSelected=o,exports.createClipboardController=s;
2
+ `)};return{update:c,handleCopy:async()=>{if(s===null)return;let e=s,{rowModel:t,visibleColumns:n,uiState:r}=e,a=o(r.selection,t.getRowCount(),n.length)?u(e):i.serializeSelectionToTsv(t.getRow,t.getRowCount(),n,r.selection,l(e));a&&await i.writeTextToClipboard(a)&&r.selection&&e.onCopied?.(r.selection)},handlePaste:o=>{if(s===null)return;let{rows:c,rowModel:l,columns:u,visibleColumns:d,uiState:f,readOnly:p,canEditCell:m,createRow:h,createOverflowColumn:g,onRowsChange:_,onColumnsChange:v,applyServerSideCellEdits:y,dispatch:b}=s;if(f.editingCell||r.shouldIgnoreGridKeydown(o.target??null)||p||!_&&!y||!f.activeCell)return;let x=o.clipboardData?.getData(`text/plain`)??``;if(!x)return;o.preventDefault();let S=i.parseClipboardText(x);if(S.length===0)return;let C=S.reduce((e,t)=>Math.max(e,t.length),0);if(C===0)return;let w=f.activeCell.row,T=f.activeCell.col,E=l.getLabelRow===void 0?null:a.resolvePasteTargetViewIndexes(l,w,S.length),D=e=>E?E[e-w]:e,O=E?E[E.length-1]:f.activeCell.row+Math.max(S.length-1,0);if(y){let r=i.buildClipboardCellEdits(e=>l.getRow(D(e)),d,S,w,T,(t,n,r,i)=>e.isCellEditable({readOnly:p,canEditCell:m},D(t),n,r,i)).map(e=>({...e,viewIndex:D(e.viewIndex)}));r.length>0&&y(r);let a=n.clamp(O,0,Math.max(l.getRowCount()-1,0)),o=n.clamp(f.activeCell.col+Math.max(C-1,0),0,Math.max(d.length-1,0));b(t.gridActions.startSelection(f.activeCell)),b(t.gridActions.updateSelection({row:a,col:o})),b(t.gridActions.endSelection()),b(t.gridActions.activateCell(f.activeCell));return}if(!_||l.getSourceIndex(w)===void 0)return;let k=f.activeCell.col,A=[...c],j=[...d],M=l.getRowCount(),N=A.length,P=e=>{let t=D(e);return t<M?l.getSourceIndex(t):N+(t-M)},F=Math.max(O+1-M,0),I=A.length+F;if(I>A.length&&h)for(;A.length<I;)A.push(h());let L=k+C;if(L>j.length&&v&&g){let e=[];for(;j.length<L;){let t=g(j.length);j.push(t),e.push(t)}v(u?[...u,...e]:j)}let R=i.applyClipboardMatrixToRows(A,P,j,S,w,k,(t,n,r,i)=>e.isCellEditable({readOnly:p,canEditCell:m},t,n,r,i)),z=n.clamp(O,0,Math.max(Math.max(l.getRowCount()-1,0),O)),B=n.clamp(f.activeCell.col+Math.max((S[0]?.length??1)-1,0),0,Math.max(Math.max(j.length-1,0),k+C-1));_(R),b(t.gridActions.startSelection(f.activeCell)),b(t.gridActions.updateSelection({row:z,col:B})),b(t.gridActions.endSelection()),b(t.gridActions.activateCell(f.activeCell))}}};exports.computeIsWholeGridSelected=o,exports.createClipboardController=s;
@@ -23,6 +23,7 @@ export type ClipboardControllerArgs<T extends object> = {
23
23
  applyServerSideCellEdits?: (edits: ServerSideCellEditInput<T>[]) => number;
24
24
  isRowExportable?: SpreadsheetGridProps<T>['isRowExportable'];
25
25
  dispatch: (action: GridUiAction) => void;
26
+ onCopied?: (selection: NonNullable<GridSelection>) => void;
26
27
  };
27
28
  export type ClipboardController<T extends object> = {
28
29
  update: (args: ClipboardControllerArgs<T>) => void;
@@ -38,7 +38,7 @@ var f = (e, t, n) => {
38
38
  handleCopy: async () => {
39
39
  if (p === null) return;
40
40
  let e = p, { rowModel: t, visibleColumns: n, uiState: r } = e, i = f(r.selection, t.getRowCount(), n.length) ? g(e) : l(t.getRow, t.getRowCount(), n, r.selection, h(e));
41
- i && await u(i);
41
+ i && await u(i) && r.selection && e.onCopied?.(r.selection);
42
42
  },
43
43
  handlePaste: (e) => {
44
44
  if (p === null) return;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/geometry.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/slotDom.cjs");function i(e,n,r,i){let a=e.find(e=>e.key===n);if(!a)return null;let o=t.getColumnPane(a),s={left:[],center:[],right:[]},c=new Map;for(let n of e)s[t.getColumnPane(n)].push(n.key),c.set(n.key,n.visible!==!1);let l=s[r].filter(e=>c.get(e)).indexOf(n),u=s[o].indexOf(n);if(u<0)return null;s[o].splice(u,1);let d=i;o===r&&l>=0&&d>l&&--d;let f=s[r].filter(e=>c.get(e));if(d=Math.max(0,Math.min(d,f.length)),o===r&&l>=0&&d===l)return null;let p;return p=d>=f.length?s[r].length:s[r].indexOf(f[d]),s[r].splice(p,0,n),[...s.left,...s.center,...s.right]}var a=32,o=2,s=14,c=12,l=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="5 9 2 12 5 15"/><polyline points="9 5 12 2 15 5"/><polyline points="15 19 12 22 9 19"/><polyline points="19 9 22 12 19 15"/><line x1="2" y1="12" x2="22" y2="12"/><line x1="12" y1="2" x2="12" y2="22"/></svg>`,u=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="17" x2="12" y2="22"/><path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"/></svg>`,d=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="4.9" y1="4.9" x2="19.1" y2="19.1"/></svg>`,f=`0.5`,p=200,m=`cubic-bezier(0.2, 0.7, 0.3, 1)`,h=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,g=t=>{if(!t)return null;let n=new Map;return t.querySelectorAll(`[data-ssg-col-key]`).forEach(r=>{if(e.isInsideDetailCardOf(t,r))return;let i=r.dataset.ssgColKey;i&&!n.has(i)&&n.set(i,r.getBoundingClientRect().left)}),n},_=()=>{let _=null,v=null,y=null,b=null,x={x:0,y:0},S=null,C=!1,w=null,T=null,E=null,D=null,O=null,k=()=>({left:_?.leftIndicatorRef.current??null,center:_?.centerIndicatorRef.current??null,right:_?.rightIndicatorRef.current??null}),A=()=>{for(let e of Object.values(k()))e&&(e.style.display=`none`)},j=e=>{if(E)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),_?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),t.style.cssText=[`position:fixed`,`top:0`,`left:0`,`display:inline-flex`,`align-items:center`,`gap:7px`,`padding:7px 12px 7px 10px`,`border-radius:9px`,`border:1px solid var(--ssg-ghost-border)`,`background:var(--ssg-ghost-bg)`,`color:var(--ssg-ghost-text)`,`font-size:12px`,`font-weight:600`,`line-height:1`,`white-space:nowrap`,`box-shadow:var(--ssg-ghost-shadow)`,`pointer-events:none`,`user-select:none`,`z-index:9999`,`will-change:transform`,`transform:translate(-9999px,-9999px)`].join(`;`),r.applySlotToElement(t,_?.ghostSlot);let n=document.createElement(`span`);n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none`;let i=document.createElement(`span`);i.textContent=e,t.appendChild(n),t.appendChild(i),document.body.appendChild(t),E=t,D=n,O=null},M=e=>{let t=E;if(!t)return;t.style.transform=`translate(`+(x.x+s)+`px,`+(x.y+c)+`px)`;let n=e??`out`;if(O===n)return;O=n;let r=D;n===`out`?(t.style.opacity=f,r&&(r.innerHTML=d)):(t.style.opacity=`1`,r&&(r.innerHTML=n===`center`?l:u))},N=()=>{E&&E.parentNode&&E.parentNode.removeChild(E),E=null,D=null,O=null},P=(e,n)=>{if(_===null)return null;let{paneLayout:r,leftPaneScrollRef:i,rightPaneScrollRef:s,bodyScrollRef:c,scrollContainerRef:l,leftLeadingWidth:u,centerLeadingWidth:d,rightLeadingWidth:f}=_,p=l.current;if(p){let t=p.getBoundingClientRect();if(e<t.left||e>t.right||n<t.top||n>t.bottom)return null}let m=i.current,h=s.current;if(m&&r.left.entries.length===0&&e<=m.getBoundingClientRect().left+a)return{pane:`left`,slot:0,leftPx:o};if(m&&r.left.entries.length>0){let n=m.getBoundingClientRect();if(e<n.right){let i=e-n.left-u,a=t.findPaneDropSlot(r.left,i);return{pane:`left`,slot:a,leftPx:u+t.paneDropSlotBoundaryX(r.left,a)}}}if(h&&r.right.entries.length===0&&e>=h.getBoundingClientRect().left-a)return{pane:`right`,slot:0,leftPx:-2};if(h&&r.right.entries.length>0){let n=h.getBoundingClientRect();if(e>=n.left){let i=e-n.left-f,a=t.findPaneDropSlot(r.right,i);return{pane:`right`,slot:a,leftPx:f+t.paneDropSlotBoundaryX(r.right,a)}}}let g=c.current;if(g&&r.center.entries.length>0){let n=g.getBoundingClientRect(),i=g.scrollLeft+e-n.left-d,a=t.findPaneDropSlot(r.center,Math.max(i,0));return{pane:`center`,slot:a,leftPx:d+t.paneDropSlotBoundaryX(r.center,a)}}return null},F=()=>{let e=P(x.x,x.y);if(M(e?e.pane:null),!e){y=null,A();return}y={pane:e.pane,slot:e.slot};let t=k();for(let n of[`left`,`center`,`right`]){let r=t[n];r&&(n===e.pane?(r.style.left=`${e.leftPx}px`,r.style.display=`block`):r.style.display=`none`)}},I=()=>{if(v===null){T=null;return}let e=_?.scrollContainerRef.current??null;if(e&&(C||(!S||n.hasPointerLeftActivationRadius(S,x,6))&&(C=!0),C)){let t=e.getBoundingClientRect(),r=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight}),i=n.resolveAutoScrollAxisDirection(x.x,r.left,r.right,24),a=n.computeNextScrollPosition(e.scrollLeft,i,18,e.scrollWidth-e.clientWidth);a!==e.scrollLeft&&e.scrollTo({left:a,behavior:`auto`})}F(),T=requestAnimationFrame(I)},L=e=>{T!==null&&(cancelAnimationFrame(T),T=null),document.body.style.cursor=``,A(),N();let n=v,r=y;if(v=null,y=null,!e||!n||!r||_===null)return;let{columns:a,applyColumnOrderAndPin:o,scrollContainerRef:s}=_,c=i(a,n,r.pane,r.slot);if(!c)return;let l=a.find(e=>e.key===n),u=l?t.getColumnPane(l):null;b=u!==null&&u===r.pane&&!h()?g(s.current):null,o(c,new Map([[n,r.pane===`center`?void 0:r.pane]]))};return{update:e=>{_=e},onColumnDragHandlePointerDown:(e,t)=>{if(_===null||!_.enabled||t.button!==0)return;t.stopPropagation(),t.preventDefault(),v=e.key,x={x:t.clientX,y:t.clientY},S={x:t.clientX,y:t.clientY},C=!1,document.body.style.cursor=`grabbing`,j(e.title||e.key);let n=t.currentTarget,r=t.pointerId;try{n.setPointerCapture(r)}catch{}let i=e=>{e.pointerId===r&&(x={x:e.clientX,y:e.clientY},F())},a=()=>{window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,s),w=null;try{n.releasePointerCapture(r)}catch{}};function o(e){e.pointerId===r&&(a(),L(!0))}function s(e){e.pointerId===r&&(a(),L(!1))}window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,s),w=a,F(),T=requestAnimationFrame(I)},applyReorderSettle:()=>{let t=b;if(b=null,!t)return;let n=_?.scrollContainerRef.current??null;if(!n)return;let r=new Map,i=new Map;n.querySelectorAll(`[data-ssg-col-key]`).forEach(a=>{if(e.isInsideDetailCardOf(n,a))return;let o=a.dataset.ssgColKey;if(!o||!t.has(o))return;let s=r.get(o);s?s.push(a):(r.set(o,[a]),i.set(o,a.getBoundingClientRect().left))});let a=[];if(r.forEach((e,n)=>{let r=t.get(n),o=i.get(n);if(r===void 0||o===void 0)return;let s=r-o;if(!(Math.abs(s)<.5))for(let t of e)t.style.transition=`none`,t.style.transform=`translateX(${s}px)`,t.style.willChange=`transform`,a.push(t)}),a.length!==0){n.getBoundingClientRect();for(let e of a)e.style.transition=`transform ${p}ms ${m}`,e.style.transform=`translateX(0)`;window.setTimeout(()=>{for(let e of a)e.style.transition=``,e.style.transform=``,e.style.willChange=``},280)}},dispose:()=>{w?.(),w=null,T!==null&&(cancelAnimationFrame(T),T=null),v=null,y=null,document.body.style.cursor=``,N()}}};exports.computeHeaderReorderedKeys=i,exports.createColumnHeaderDragController=_;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/geometry.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/slotDom.cjs");function i(e,n,r,i){let a=e.find(e=>e.key===n);if(!a)return null;let o=t.getColumnPane(a),s={left:[],center:[],right:[]},c=new Map;for(let n of e)s[t.getColumnPane(n)].push(n.key),c.set(n.key,n.visible!==!1);let l=s[r].filter(e=>c.get(e)).indexOf(n),u=s[o].indexOf(n);if(u<0)return null;s[o].splice(u,1);let d=i;o===r&&l>=0&&d>l&&--d;let f=s[r].filter(e=>c.get(e));if(d=Math.max(0,Math.min(d,f.length)),o===r&&l>=0&&d===l)return null;let p;return p=d>=f.length?s[r].length:s[r].indexOf(f[d]),s[r].splice(p,0,n),[...s.left,...s.center,...s.right]}var a=32,o=2,s=14,c=12,l=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="5 9 2 12 5 15"/><polyline points="9 5 12 2 15 5"/><polyline points="15 19 12 22 9 19"/><polyline points="19 9 22 12 19 15"/><line x1="2" y1="12" x2="22" y2="12"/><line x1="12" y1="2" x2="12" y2="22"/></svg>`,u=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="17" x2="12" y2="22"/><path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"/></svg>`,d=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="4.9" y1="4.9" x2="19.1" y2="19.1"/></svg>`,f=`0.5`,p=200,m=`cubic-bezier(0.2, 0.7, 0.3, 1)`,h=e=>e?.closest(`.ssg-motion-off`)!=null,g=`transform 160ms ${m}`,_=`data-ssg-col-dragging`,v=`4`,y=t=>{let n=[];return t.querySelectorAll(`[data-ssg-col-key]`).forEach(r=>{e.isInsideDetailCardOf(t,r)||n.push(r)}),n},b=t=>{if(!t)return null;let n=new Map;return t.querySelectorAll(`[data-ssg-col-key]`).forEach(r=>{if(e.isInsideDetailCardOf(t,r))return;let i=r.dataset.ssgColKey;i&&!n.has(i)&&n.set(i,r.getBoundingClientRect().left)}),n},x=()=>{let x=null,S=null,C=null,w=null,T={x:0,y:0},E=null,D=!1,O=null,k=null,A=null,j=null,M=null,N=null,P=0,F=null,I=null,L=``,R=()=>x?.motion===`live`,z=()=>({left:x?.leftIndicatorRef.current??null,center:x?.centerIndicatorRef.current??null,right:x?.rightIndicatorRef.current??null}),B=()=>{for(let e of Object.values(z()))e&&(e.style.display=`none`)},V=e=>{if(A)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),x?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),x?.scrollContainerRef.current?.closest(`.ssg-motion-off`)!=null&&t.classList.add(`ssg-motion-off`),t.style.cssText=[`position:fixed`,`top:0`,`left:0`,`display:inline-flex`,`align-items:center`,`gap:7px`,`padding:7px 12px 7px 10px`,`border-radius:9px`,`border:1px solid var(--ssg-ghost-border)`,`background:var(--ssg-ghost-bg)`,`color:var(--ssg-ghost-text)`,`font-size:12px`,`font-weight:600`,`line-height:1`,`white-space:nowrap`,`box-shadow:var(--ssg-ghost-shadow)`,`pointer-events:none`,`user-select:none`,`z-index:9999`,`will-change:transform`,`transform:translate(-9999px,-9999px)`].join(`;`),r.applySlotToElement(t,x?.ghostSlot);let n=document.createElement(`span`);n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none`;let i=document.createElement(`span`);i.textContent=e,t.appendChild(n),t.appendChild(i),document.body.appendChild(t),A=t,j=n,M=null},H=e=>{let t=A;if(!t)return;t.style.transform=`translate(`+(T.x+s)+`px,`+(T.y+c)+`px)`;let n=e??`out`;if(M===n)return;M=n;let r=j;n===`out`?(t.style.opacity=f,r&&(r.innerHTML=d)):(t.style.opacity=`1`,r&&(r.innerHTML=n===`center`?l:u))},U=()=>{A&&A.parentNode&&A.parentNode.removeChild(A),A=null,j=null,M=null},W=(e,n)=>{if(x===null)return null;let{paneLayout:r,leftPaneScrollRef:i,rightPaneScrollRef:s,bodyScrollRef:c,scrollContainerRef:l,leftLeadingWidth:u,centerLeadingWidth:d,rightLeadingWidth:f}=x,p=l.current;if(p){let t=p.getBoundingClientRect();if(e<t.left||e>t.right||n<t.top||n>t.bottom)return null}let m=i.current,h=s.current;if(m&&r.left.entries.length===0&&e<=m.getBoundingClientRect().left+a)return{pane:`left`,slot:0,leftPx:o};if(m&&r.left.entries.length>0){let n=m.getBoundingClientRect();if(e<n.right){let i=e-n.left-u,a=t.findPaneDropSlot(r.left,i);return{pane:`left`,slot:a,leftPx:u+t.paneDropSlotBoundaryX(r.left,a)}}}if(h&&r.right.entries.length===0&&e>=h.getBoundingClientRect().left-a)return{pane:`right`,slot:0,leftPx:-2};if(h&&r.right.entries.length>0){let n=h.getBoundingClientRect();if(e>=n.left){let i=e-n.left-f,a=t.findPaneDropSlot(r.right,i);return{pane:`right`,slot:a,leftPx:f+t.paneDropSlotBoundaryX(r.right,a)}}}let g=c.current;if(g&&r.center.entries.length>0){let n=g.getBoundingClientRect(),i=g.scrollLeft+e-n.left-d,a=t.findPaneDropSlot(r.center,Math.max(i,0));return{pane:`center`,slot:a,leftPx:d+t.paneDropSlotBoundaryX(r.center,a)}}return null},G=e=>{let t=z();for(let n of[`left`,`center`,`right`]){let r=t[n];r&&(n===e.pane?(r.style.left=`${e.leftPx}px`,r.style.display=`block`):r.style.display=`none`)}},K=(e,t)=>{let n=I?.get(t);n!==void 0&&I?.delete(t),e.set(t,n??t.style.zIndex)},q=(e,t)=>{let n=F,r=S,i=N;if(!n||r===null||i===null||x===null)return;let a=x.scrollContainerRef.current;if(!a)return;let o=x.paneLayout[i].entries,s=o.findIndex(e=>e.column.key===r);if(s<0)return;let c=o[s].paneLocalSize,l=!t||e===null?s:e>s?e-1:e,u=new Map;for(let e=Math.min(s,l);e<=Math.max(s,l);e+=1)e!==s&&u.set(o[e].column.key,e>s?-c:c);let d=i===`center`?a.scrollLeft-P:0,f=(E?T.x-E.x:0)+d;for(let e of y(a)){let i=e.dataset.ssgColKey;if(i===void 0)continue;if(i===r){n.has(e)||(K(n,e),e.style.zIndex=v,e.style.willChange=`transform`),t?(e.setAttribute(_,`live`),e.style.transition=`none`,e.style.transform=`translateX(${f}px)`):(e.removeAttribute(_),e.style.transition=g,e.style.transform=`translateX(0px)`);continue}let a=u.get(i)??0;if(a===0&&!n.has(e))continue;n.has(e)||K(n,e);let o=`translateX(${a}px)`;e.style.transform!==o&&(e.style.transition=g,e.style.transform=o)}},J=e=>{e.forEach((e,t)=>{t.style.transition=``,t.style.transform=``,t.style.willChange=``,t.style.zIndex=e,t.removeAttribute(_)})},Y=()=>{let e=W(T.x,T.y);if(R()){e&&(C={pane:e.pane,slot:e.slot});let t=C;if(t!==null&&t.pane!==N){V(L),H(t.pane),e&&G(e),q(null,!1);return}U(),B(),q(t===null?null:t.slot,!0);return}if(H(e?e.pane:null),!e){C=null,B();return}C={pane:e.pane,slot:e.slot},G(e)},X=()=>{if(S===null){k=null;return}let e=x?.scrollContainerRef.current??null;if(e&&(D||(!E||n.hasPointerLeftActivationRadius(E,T,6))&&(D=!0),D)){let t=e.getBoundingClientRect(),r=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight}),i=n.resolveAutoScrollAxisDirection(T.x,r.left,r.right,24),a=n.computeNextScrollPosition(e.scrollLeft,i,18,e.scrollWidth-e.clientWidth);a!==e.scrollLeft&&e.scrollTo({left:a,behavior:`auto`})}Y(),k=requestAnimationFrame(X)},Z=e=>{k!==null&&(cancelAnimationFrame(k),k=null),document.body.style.cursor=``,B(),U();let n=S,r=C;S=null,C=null,E=null;let a=F;F=null,N=null;let o=e&&n&&r&&x!==null?i(x.columns,n,r.pane,r.slot):null;if(a&&!o&&(a.forEach((e,t)=>{t.isConnected&&(t.style.transition=g,t.style.transform=`translateX(0px)`)}),I=a,window.setTimeout(()=>{J(a),I===a&&(I=null)},200)),!o||!n||!r||x===null)return;let{columns:s,applyColumnOrderAndPin:c,scrollContainerRef:l}=x,u=s.find(e=>e.key===n),d=u?t.getColumnPane(u):null;w=d!==null&&d===r.pane&&!h(l.current)?b(l.current):null,a&&J(a),c(o,new Map([[n,r.pane===`center`?void 0:r.pane]]))};return{update:e=>{x=e},onColumnDragHandlePointerDown:(e,n)=>{if(x===null||!x.enabled||n.button!==0)return;n.stopPropagation(),n.preventDefault(),S=e.key,C=null,T={x:n.clientX,y:n.clientY},E={x:n.clientX,y:n.clientY},D=!1,document.body.style.cursor=`grabbing`,L=e.title||e.key,R()?(N=t.getColumnPane(e),P=x.scrollContainerRef.current?.scrollLeft??0,F=new Map):V(L);let r=n.currentTarget,i=n.pointerId;try{r.setPointerCapture(i)}catch{}let a=e=>{e.pointerId===i&&(T={x:e.clientX,y:e.clientY},Y())},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),window.removeEventListener(`keydown`,l),O=null;try{r.releasePointerCapture(i)}catch{}};function s(e){e.pointerId===i&&(o(),Z(!0))}function c(e){e.pointerId===i&&(o(),Z(!1))}function l(e){e.key===`Escape`&&(o(),Z(!1))}window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,c),window.addEventListener(`keydown`,l),O=o,Y(),k=requestAnimationFrame(X)},applyReorderSettle:()=>{let t=w;if(w=null,!t)return;let n=x?.scrollContainerRef.current??null;if(!n)return;let r=new Map,i=new Map;n.querySelectorAll(`[data-ssg-col-key]`).forEach(a=>{if(e.isInsideDetailCardOf(n,a))return;let o=a.dataset.ssgColKey;if(!o||!t.has(o))return;let s=r.get(o);s?s.push(a):(r.set(o,[a]),i.set(o,a.getBoundingClientRect().left))});let a=[];if(r.forEach((e,n)=>{let r=t.get(n),o=i.get(n);if(r===void 0||o===void 0)return;let s=r-o;if(!(Math.abs(s)<.5))for(let t of e)t.style.transition=`none`,t.style.transform=`translateX(${s}px)`,t.style.willChange=`transform`,a.push(t)}),a.length!==0){n.getBoundingClientRect();for(let e of a)e.style.transition=`transform ${p}ms ${m}`,e.style.transform=`translateX(0)`;window.setTimeout(()=>{for(let e of a)e.style.transition=``,e.style.transform=``,e.style.willChange=``},280)}},dispose:()=>{O?.(),O=null,k!==null&&(cancelAnimationFrame(k),k=null),S=null,C=null,document.body.style.cursor=``,U(),F&&J(F),F=null,N=null}}};exports.computeHeaderReorderedKeys=i,exports.createColumnHeaderDragController=x;
@@ -21,6 +21,7 @@ export type ColumnHeaderDragArgs<T> = {
21
21
  rightLeadingWidth: number;
22
22
  applyColumnOrderAndPin: ApplyColumnOrderAndPin;
23
23
  ghostSlot?: GridResolvedSlot;
24
+ motion?: 'ghost' | 'live';
24
25
  };
25
26
  export type ColumnDragHandlePointerEvent = {
26
27
  button: number;
@@ -26,7 +26,12 @@ function l(e, t, r, i) {
26
26
  ...s.right
27
27
  ];
28
28
  }
29
- var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"5 9 2 12 5 15\"/><polyline points=\"9 5 12 2 15 5\"/><polyline points=\"15 19 12 22 9 19\"/><polyline points=\"19 9 22 12 19 15\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"/><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"/></svg>", h = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"22\"/><path d=\"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z\"/></svg>", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"4.9\" y1=\"4.9\" x2=\"19.1\" y2=\"19.1\"/></svg>", _ = "0.5", v = 200, y = "cubic-bezier(0.2, 0.7, 0.3, 1)", b = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, x = (t) => {
29
+ var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"5 9 2 12 5 15\"/><polyline points=\"9 5 12 2 15 5\"/><polyline points=\"15 19 12 22 9 19\"/><polyline points=\"19 9 22 12 19 15\"/><line x1=\"2\" y1=\"12\" x2=\"22\" y2=\"12\"/><line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"22\"/></svg>", h = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"12\" y1=\"17\" x2=\"12\" y2=\"22\"/><path d=\"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z\"/></svg>", g = "<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"4.9\" y1=\"4.9\" x2=\"19.1\" y2=\"19.1\"/></svg>", _ = "0.5", v = 200, y = "cubic-bezier(0.2, 0.7, 0.3, 1)", ee = (e) => e?.closest(".ssg-motion-off") != null, b = `transform 160ms ${y}`, x = "data-ssg-col-dragging", S = "4", C = (t) => {
30
+ let n = [];
31
+ return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
32
+ e(t, r) || n.push(r);
33
+ }), n;
34
+ }, te = (t) => {
30
35
  if (!t) return null;
31
36
  let n = /* @__PURE__ */ new Map();
32
37
  return t.querySelectorAll("[data-ssg-col-key]").forEach((r) => {
@@ -34,20 +39,20 @@ var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\"
34
39
  let i = r.dataset.ssgColKey;
35
40
  i && !n.has(i) && n.set(i, r.getBoundingClientRect().left);
36
41
  }), n;
37
- }, S = () => {
38
- let S = null, C = null, w = null, T = null, E = {
42
+ }, w = () => {
43
+ let w = null, T = null, E = null, D = null, O = {
39
44
  x: 0,
40
45
  y: 0
41
- }, D = null, O = !1, k = null, A = null, j = null, M = null, N = null, P = () => ({
42
- left: S?.leftIndicatorRef.current ?? null,
43
- center: S?.centerIndicatorRef.current ?? null,
44
- right: S?.rightIndicatorRef.current ?? null
45
- }), F = () => {
46
- for (let e of Object.values(P())) e && (e.style.display = "none");
47
- }, I = (e) => {
48
- if (j) return;
46
+ }, k = null, A = !1, j = null, M = null, N = null, P = null, F = null, I = null, L = 0, R = null, z = null, B = "", V = () => w?.motion === "live", H = () => ({
47
+ left: w?.leftIndicatorRef.current ?? null,
48
+ center: w?.centerIndicatorRef.current ?? null,
49
+ right: w?.rightIndicatorRef.current ?? null
50
+ }), U = () => {
51
+ for (let e of Object.values(H())) e && (e.style.display = "none");
52
+ }, W = (e) => {
53
+ if (N) return;
49
54
  let t = document.createElement("div");
50
- t.setAttribute("data-grid-drag-ghost", ""), S?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), t.style.cssText = [
55
+ t.setAttribute("data-grid-drag-ghost", ""), w?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), w?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
51
56
  "position:fixed",
52
57
  "top:0",
53
58
  "left:0",
@@ -69,25 +74,25 @@ var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\"
69
74
  "z-index:9999",
70
75
  "will-change:transform",
71
76
  "transform:translate(-9999px,-9999px)"
72
- ].join(";"), c(t, S?.ghostSlot);
77
+ ].join(";"), c(t, w?.ghostSlot);
73
78
  let n = document.createElement("span");
74
79
  n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
75
80
  let r = document.createElement("span");
76
- r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), j = t, M = n, N = null;
77
- }, L = (e) => {
78
- let t = j;
81
+ r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), N = t, P = n, F = null;
82
+ }, G = (e) => {
83
+ let t = N;
79
84
  if (!t) return;
80
- t.style.transform = "translate(" + (E.x + f) + "px," + (E.y + p) + "px)";
85
+ t.style.transform = "translate(" + (O.x + f) + "px," + (O.y + p) + "px)";
81
86
  let n = e ?? "out";
82
- if (N === n) return;
83
- N = n;
84
- let r = M;
87
+ if (F === n) return;
88
+ F = n;
89
+ let r = P;
85
90
  n === "out" ? (t.style.opacity = _, r && (r.innerHTML = g)) : (t.style.opacity = "1", r && (r.innerHTML = n === "center" ? m : h));
86
- }, R = () => {
87
- j && j.parentNode && j.parentNode.removeChild(j), j = null, M = null, N = null;
88
- }, z = (e, n) => {
89
- if (S === null) return null;
90
- let { paneLayout: i, leftPaneScrollRef: a, rightPaneScrollRef: o, bodyScrollRef: s, scrollContainerRef: c, leftLeadingWidth: l, centerLeadingWidth: f, rightLeadingWidth: p } = S, m = c.current;
91
+ }, K = () => {
92
+ N && N.parentNode && N.parentNode.removeChild(N), N = null, P = null, F = null;
93
+ }, ne = (e, n) => {
94
+ if (w === null) return null;
95
+ let { paneLayout: i, leftPaneScrollRef: a, rightPaneScrollRef: o, bodyScrollRef: s, scrollContainerRef: c, leftLeadingWidth: l, centerLeadingWidth: f, rightLeadingWidth: p } = w, m = c.current;
91
96
  if (m) {
92
97
  let t = m.getBoundingClientRect();
93
98
  if (e < t.left || e > t.right || n < t.top || n > t.bottom) return null;
@@ -135,17 +140,8 @@ var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\"
135
140
  };
136
141
  }
137
142
  return null;
138
- }, B = () => {
139
- let e = z(E.x, E.y);
140
- if (L(e ? e.pane : null), !e) {
141
- w = null, F();
142
- return;
143
- }
144
- w = {
145
- pane: e.pane,
146
- slot: e.slot
147
- };
148
- let t = P();
143
+ }, q = (e) => {
144
+ let t = H();
149
145
  for (let n of [
150
146
  "left",
151
147
  "center",
@@ -154,13 +150,66 @@ var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\"
154
150
  let r = t[n];
155
151
  r && (n === e.pane ? (r.style.left = `${e.leftPx}px`, r.style.display = "block") : r.style.display = "none");
156
152
  }
157
- }, V = () => {
158
- if (C === null) {
159
- A = null;
153
+ }, J = (e, t) => {
154
+ let n = z?.get(t);
155
+ n !== void 0 && z?.delete(t), e.set(t, n ?? t.style.zIndex);
156
+ }, Y = (e, t) => {
157
+ let n = R, r = T, i = I;
158
+ if (!n || r === null || i === null || w === null) return;
159
+ let a = w.scrollContainerRef.current;
160
+ if (!a) return;
161
+ let o = w.paneLayout[i].entries, s = o.findIndex((e) => e.column.key === r);
162
+ if (s < 0) return;
163
+ let c = o[s].paneLocalSize, l = !t || e === null ? s : e > s ? e - 1 : e, u = /* @__PURE__ */ new Map();
164
+ for (let e = Math.min(s, l); e <= Math.max(s, l); e += 1) e !== s && u.set(o[e].column.key, e > s ? -c : c);
165
+ let d = i === "center" ? a.scrollLeft - L : 0, f = (k ? O.x - k.x : 0) + d;
166
+ for (let e of C(a)) {
167
+ let i = e.dataset.ssgColKey;
168
+ if (i === void 0) continue;
169
+ if (i === r) {
170
+ n.has(e) || (J(n, e), e.style.zIndex = S, e.style.willChange = "transform"), t ? (e.setAttribute(x, "live"), e.style.transition = "none", e.style.transform = `translateX(${f}px)`) : (e.removeAttribute(x), e.style.transition = b, e.style.transform = "translateX(0px)");
171
+ continue;
172
+ }
173
+ let a = u.get(i) ?? 0;
174
+ if (a === 0 && !n.has(e)) continue;
175
+ n.has(e) || J(n, e);
176
+ let o = `translateX(${a}px)`;
177
+ e.style.transform !== o && (e.style.transition = b, e.style.transform = o);
178
+ }
179
+ }, X = (e) => {
180
+ e.forEach((e, t) => {
181
+ t.style.transition = "", t.style.transform = "", t.style.willChange = "", t.style.zIndex = e, t.removeAttribute(x);
182
+ });
183
+ }, Z = () => {
184
+ let e = ne(O.x, O.y);
185
+ if (V()) {
186
+ e && (E = {
187
+ pane: e.pane,
188
+ slot: e.slot
189
+ });
190
+ let t = E;
191
+ if (t !== null && t.pane !== I) {
192
+ W(B), G(t.pane), e && q(e), Y(null, !1);
193
+ return;
194
+ }
195
+ K(), U(), Y(t === null ? null : t.slot, !0);
196
+ return;
197
+ }
198
+ if (G(e ? e.pane : null), !e) {
199
+ E = null, U();
200
+ return;
201
+ }
202
+ E = {
203
+ pane: e.pane,
204
+ slot: e.slot
205
+ }, q(e);
206
+ }, Q = () => {
207
+ if (T === null) {
208
+ M = null;
160
209
  return;
161
210
  }
162
- let e = S?.scrollContainerRef.current ?? null;
163
- if (e && (O || (!D || a(D, E, 6)) && (O = !0), O)) {
211
+ let e = w?.scrollContainerRef.current ?? null;
212
+ if (e && (A || (!k || a(k, O, 6)) && (A = !0), A)) {
164
213
  let t = e.getBoundingClientRect(), n = s({
165
214
  rectLeft: t.left,
166
215
  rectTop: t.top,
@@ -168,62 +217,71 @@ var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\"
168
217
  clientTop: e.clientTop,
169
218
  clientWidth: e.clientWidth,
170
219
  clientHeight: e.clientHeight
171
- }), r = o(E.x, n.left, n.right, 24), a = i(e.scrollLeft, r, 18, e.scrollWidth - e.clientWidth);
220
+ }), r = o(O.x, n.left, n.right, 24), a = i(e.scrollLeft, r, 18, e.scrollWidth - e.clientWidth);
172
221
  a !== e.scrollLeft && e.scrollTo({
173
222
  left: a,
174
223
  behavior: "auto"
175
224
  });
176
225
  }
177
- B(), A = requestAnimationFrame(V);
178
- }, H = (e) => {
179
- A !== null && (cancelAnimationFrame(A), A = null), document.body.style.cursor = "", F(), R();
180
- let t = C, r = w;
181
- if (C = null, w = null, !e || !t || !r || S === null) return;
182
- let { columns: i, applyColumnOrderAndPin: a, scrollContainerRef: o } = S, s = l(i, t, r.pane, r.slot);
183
- if (!s) return;
184
- let c = i.find((e) => e.key === t), u = c ? n(c) : null;
185
- T = u !== null && u === r.pane && !b() ? x(o.current) : null, a(s, /* @__PURE__ */ new Map([[t, r.pane === "center" ? void 0 : r.pane]]));
226
+ Z(), M = requestAnimationFrame(Q);
227
+ }, $ = (e) => {
228
+ M !== null && (cancelAnimationFrame(M), M = null), document.body.style.cursor = "", U(), K();
229
+ let t = T, r = E;
230
+ T = null, E = null, k = null;
231
+ let i = R;
232
+ R = null, I = null;
233
+ let a = e && t && r && w !== null ? l(w.columns, t, r.pane, r.slot) : null;
234
+ if (i && !a && (i.forEach((e, t) => {
235
+ t.isConnected && (t.style.transition = b, t.style.transform = "translateX(0px)");
236
+ }), z = i, window.setTimeout(() => {
237
+ X(i), z === i && (z = null);
238
+ }, 200)), !a || !t || !r || w === null) return;
239
+ let { columns: o, applyColumnOrderAndPin: s, scrollContainerRef: c } = w, u = o.find((e) => e.key === t), d = u ? n(u) : null;
240
+ D = d !== null && d === r.pane && !ee(c.current) ? te(c.current) : null, i && X(i), s(a, /* @__PURE__ */ new Map([[t, r.pane === "center" ? void 0 : r.pane]]));
186
241
  };
187
242
  return {
188
243
  update: (e) => {
189
- S = e;
244
+ w = e;
190
245
  },
191
246
  onColumnDragHandlePointerDown: (e, t) => {
192
- if (S === null || !S.enabled || t.button !== 0) return;
193
- t.stopPropagation(), t.preventDefault(), C = e.key, E = {
247
+ if (w === null || !w.enabled || t.button !== 0) return;
248
+ t.stopPropagation(), t.preventDefault(), T = e.key, E = null, O = {
194
249
  x: t.clientX,
195
250
  y: t.clientY
196
- }, D = {
251
+ }, k = {
197
252
  x: t.clientX,
198
253
  y: t.clientY
199
- }, O = !1, document.body.style.cursor = "grabbing", I(e.title || e.key);
200
- let n = t.currentTarget, r = t.pointerId;
254
+ }, A = !1, document.body.style.cursor = "grabbing", B = e.title || e.key, V() ? (I = n(e), L = w.scrollContainerRef.current?.scrollLeft ?? 0, R = /* @__PURE__ */ new Map()) : W(B);
255
+ let r = t.currentTarget, i = t.pointerId;
201
256
  try {
202
- n.setPointerCapture(r);
257
+ r.setPointerCapture(i);
203
258
  } catch {}
204
- let i = (e) => {
205
- e.pointerId === r && (E = {
259
+ let a = (e) => {
260
+ e.pointerId === i && (O = {
206
261
  x: e.clientX,
207
262
  y: e.clientY
208
- }, B());
209
- }, a = () => {
210
- window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), k = null;
263
+ }, Z());
264
+ }, o = () => {
265
+ window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("keydown", l), j = null;
211
266
  try {
212
- n.releasePointerCapture(r);
267
+ r.releasePointerCapture(i);
213
268
  } catch {}
214
269
  };
215
- function o(e) {
216
- e.pointerId === r && (a(), H(!0));
217
- }
218
270
  function s(e) {
219
- e.pointerId === r && (a(), H(!1));
271
+ e.pointerId === i && (o(), $(!0));
272
+ }
273
+ function c(e) {
274
+ e.pointerId === i && (o(), $(!1));
275
+ }
276
+ function l(e) {
277
+ e.key === "Escape" && (o(), $(!1));
220
278
  }
221
- window.addEventListener("pointermove", i), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), k = a, B(), A = requestAnimationFrame(V);
279
+ window.addEventListener("pointermove", a), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l), j = o, Z(), M = requestAnimationFrame(Q);
222
280
  },
223
281
  applyReorderSettle: () => {
224
- let t = T;
225
- if (T = null, !t) return;
226
- let n = S?.scrollContainerRef.current ?? null;
282
+ let t = D;
283
+ if (D = null, !t) return;
284
+ let n = w?.scrollContainerRef.current ?? null;
227
285
  if (!n) return;
228
286
  let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
229
287
  n.querySelectorAll("[data-ssg-col-key]").forEach((a) => {
@@ -248,9 +306,9 @@ var u = 32, d = 2, f = 14, p = 12, m = "<svg viewBox=\"0 0 24 24\" width=\"14\"
248
306
  }
249
307
  },
250
308
  dispose: () => {
251
- k?.(), k = null, A !== null && (cancelAnimationFrame(A), A = null), C = null, w = null, document.body.style.cursor = "", R();
309
+ j?.(), j = null, M !== null && (cancelAnimationFrame(M), M = null), T = null, E = null, document.body.style.cursor = "", K(), R && X(R), R = null, I = null;
252
310
  }
253
311
  };
254
312
  };
255
313
  //#endregion
256
- export { l as computeHeaderReorderedKeys, S as createColumnHeaderDragController };
314
+ export { l as computeHeaderReorderedKeys, w as createColumnHeaderDragController };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/find.cjs");var i=1e4,a=new Map,o=()=>{let i=null,o=0,s=null,c=e.createValueStore({open:!1,query:``,matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1}),l=e=>{c.setSnapshot({...c.getSnapshot(),...e})},u=()=>{let e=c.getSnapshot();i?.onChange?.({query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open})},d=()=>{let e=c.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},f=()=>{o+=1,s=null,l({matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1})},p=e=>{let a=i,p=c.getSnapshot();if(!a||!p.open||p.query.length===0){f(),u();return}o+=1;let m=o,{rowModel:h,columns:g,caseSensitive:_}=a,v=p.query;s={rowModel:h,columns:g,query:v,caseSensitive:_};let y=p.currentIndex===null?null:p.matches[p.currentIndex]??null,b=[],x=!1,S=h.getRowCount();l({scanning:!0}),t.runChunked(S,e=>{if(x)return;let t=h.getRow(e);t!==void 0&&g.forEach((i,a)=>{if(x||n.isSyntheticColumnKey(i.key))return;let o=r.resolveFindCellText(i,t);for(let t of r.findRangesInText(o,v,_)){if(b.length>=1e4){x=!0;return}b.push({rowIndex:e,colIndex:a,columnKey:String(i.key),start:t.start,length:t.length})}})},{isCancelled:()=>o!==m}).then(t=>{if(!t||o!==m)return;let n=r.resolveCurrentAfterRescan(b,y);l({matches:b,index:r.buildFindIndex(b),currentIndex:n,scanning:!1,truncated:x}),u(),e&&d()})},m=()=>{let e=c.getSnapshot();return!i||!e.open||e.query.length===0?!1:s===null||s.rowModel!==i.rowModel||s.columns!==i.columns||s.query!==e.query||s.caseSensitive!==i.caseSensitive};return{update:e=>{let t=i;if(i=e,!e.enabled){c.getSnapshot().open&&(l({open:!1,query:``}),f(),u());return}t!==e&&m()&&p(!1)},open:e=>{if(!i?.enabled)return;let t=c.getSnapshot(),n=e??t.query;l({open:!0,query:n}),n!==t.query||!t.open?p(!0):u()},close:()=>{c.getSnapshot().open&&(l({open:!1,query:``}),f(),u())},setQuery:e=>{let t=c.getSnapshot();!t.open||e===t.query||(l({query:e}),p(!0))},next:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);l({currentIndex:t}),u(),d()},prev:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);l({currentIndex:t}),u(),d()},subscribe:c.subscribe,getSnapshot:c.getSnapshot,dispose:()=>{o+=1,i=null}}};exports.MAX_FIND_MATCHES=i,exports.createFindController=o;
@@ -0,0 +1,38 @@
1
+ import type { GridColumn, RowModel } from '../model/gridTypes.unbound.js';
2
+ import { type FindIndex, type FindMatch } from '../logic/find.js';
3
+ export type FindChangeParams = {
4
+ query: string;
5
+ matchCount: number;
6
+ currentIndex: number | null;
7
+ open: boolean;
8
+ };
9
+ export type FindArgs<T> = {
10
+ enabled: boolean;
11
+ rowModel: RowModel<T>;
12
+ columns: readonly GridColumn<T>[];
13
+ caseSensitive: boolean;
14
+ onNavigate: (rowIndex: number, colIndex: number) => void;
15
+ onChange?: (params: FindChangeParams) => void;
16
+ };
17
+ export type FindSnapshot = {
18
+ open: boolean;
19
+ query: string;
20
+ matches: readonly FindMatch[];
21
+ index: FindIndex;
22
+ currentIndex: number | null;
23
+ scanning: boolean;
24
+ truncated: boolean;
25
+ };
26
+ export type FindController<T> = {
27
+ update: (args: FindArgs<T>) => void;
28
+ open: (query?: string) => void;
29
+ close: () => void;
30
+ setQuery: (query: string) => void;
31
+ next: () => void;
32
+ prev: () => void;
33
+ subscribe: (listener: () => void) => () => void;
34
+ getSnapshot: () => FindSnapshot;
35
+ dispose: () => void;
36
+ };
37
+ export declare const MAX_FIND_MATCHES = 10000;
38
+ export declare const createFindController: <T>() => FindController<T>;