@fileverse-dev/dsheet 4.1.12 → 4.1.13-b

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 (28) hide show
  1. package/dist/{es-yR2JIXsz.js → es-S4GKlN-t.js} +15 -11
  2. package/dist/{executeStringFunction-BaZeRysE.js → executeStringFunction-D1IXrBP2.js} +4128 -4040
  3. package/dist/formula.js +1 -1
  4. package/dist/{hi-DRcLnrnZ.js → hi-DMMTDTxZ.js} +15 -11
  5. package/dist/{index-D0OdnFi2.js → index-7Fa_Mod8.js} +11742 -11669
  6. package/dist/index.es.js +7 -7
  7. package/dist/persistence-compaction-CIxc1USC.js +123 -0
  8. package/dist/persistence-compaction.d.ts +15 -0
  9. package/dist/persistence.js +57 -51
  10. package/dist/sheet-engine/core/index.d.ts +2 -2
  11. package/dist/sheet-engine/core/modules/date-base-locale.d.ts +2 -0
  12. package/dist/sheet-engine/core/modules/index.d.ts +1 -1
  13. package/dist/sheet-engine/core/modules/validation.date.test.d.ts +1 -0
  14. package/dist/sheet-engine/core/utils/freeze.d.ts +15 -0
  15. package/dist/sheet-engine/core/utils/index.d.ts +2 -1
  16. package/dist/sheet-engine/core/utils/sheet-name-ref.d.ts +21 -0
  17. package/dist/sheet-engine/core/utils/sheet-name-ref.test.d.ts +1 -0
  18. package/dist/sheet-engine/formula-parser/quoted-sheet-ref.test.d.ts +1 -0
  19. package/dist/sheet-engine/react/hooks/useLastFormulaCaretOffset.d.ts +14 -0
  20. package/dist/style.css +1 -1
  21. package/dist/{use-xlsx-import-impl-Cfz1iq04.js → use-xlsx-import-impl-Br6nyaAS.js} +4 -4
  22. package/dist/{xlsx-defined-names-CQYS45zi.js → xlsx-defined-names-CUwiqOuM.js} +2 -2
  23. package/dist/{xlsx-export-impl-06gHB4Bx.js → xlsx-export-impl-CYyAFJGw.js} +4 -4
  24. package/dist/{xlsx-hyperlink-inline-DQRkchZf.js → xlsx-hyperlink-inline-CKQmxa8u.js} +2 -2
  25. package/dist/{zh-B1KUs68q.js → zh-Bv4KIDiJ.js} +15 -11
  26. package/dist/{zh_tw-B9_7WgLO.js → zh_tw-BdpsK45h.js} +15 -11
  27. package/package.json +2 -2
  28. package/dist/persistence-utils-BXFajzvq.js +0 -98
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { C as s, d as o, f as t, S as r, g as l, h as n, j as d, T as S, k as c, l as i, n as m, o as h, p, q as C, t as u, u as E, v as F, w as g, x, z as R, A as f, B as A, D as I, E as L, F as T, G as w, H as y, I as v, J as D, K as M, L as b, M as k, N as z, O, P } from "./index-D0OdnFi2.js";
2
- import { cy as G, cz as K, cA as U, cG as X, bs as _, e as j, f as B, l as H, a as q, di as J, dj as N, bb as Y, dk as Z, dl as Q, dq as W, dr as $, dt as ee, I as ae, dI as se, ef as oe, b4 as te } from "./executeStringFunction-BaZeRysE.js";
1
+ import { C as s, d as o, f as t, S as r, g as l, h as n, j as d, T as S, k as c, l as i, n as m, o as h, p, q as C, t as u, u as E, v as F, w as g, x, z as R, A, B as f, D as I, E as L, F as T, G as w, H as y, I as v, J as D, K as M, L as b, M as k, N as z, O, P } from "./index-7Fa_Mod8.js";
2
+ import { cy as G, cz as K, cA as U, cG as X, bs as _, e as j, f as B, l as H, a as J, dj as N, dk as q, bb as Y, dl as Z, dm as Q, dr as W, ds as $, du as ee, I as ae, dJ as se, eg as oe, b4 as te } from "./executeStringFunction-D1IXrBP2.js";
3
3
  import { FLVURL as le } from "@fileverse-dev/formulajs";
4
4
  import { E as de, S as Se } from "./constants-8Ij49Lxv.js";
5
5
  export {
@@ -31,15 +31,15 @@ export {
31
31
  H as getFlowdata,
32
32
  E as getRemoveDuplicatesErrorMessage,
33
33
  F as getRemoveDuplicatesPreview,
34
- q as getSheetIndex,
34
+ J as getSheetIndex,
35
35
  g as handleCSVUpload,
36
36
  x as handleCopy,
37
37
  R as handleExportToCSV,
38
- f as handleExportToJSON,
39
- A as handleExportToODS,
38
+ A as handleExportToJSON,
39
+ f as handleExportToODS,
40
40
  I as handleExportToXLSX,
41
- J as handleFreeze,
42
- N as handleHorizontalAlign,
41
+ N as handleFreeze,
42
+ q as handleHorizontalAlign,
43
43
  Y as handleLink,
44
44
  Z as handleMerge,
45
45
  L as handlePasteByClick,
@@ -0,0 +1,123 @@
1
+ import * as i from "yjs";
2
+ const p = typeof Buffer == "function";
3
+ typeof TextDecoder == "function" && new TextDecoder();
4
+ typeof TextEncoder == "function" && new TextEncoder();
5
+ const C = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", l = Array.prototype.slice.call(C), u = ((t) => {
6
+ let e = {};
7
+ return t.forEach((r, o) => e[r] = o), e;
8
+ })(l), x = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, d = String.fromCharCode.bind(String), b = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (t) => new Uint8Array(Array.prototype.slice.call(t, 0)), B = (t) => t.replace(/=/g, "").replace(/[+\/]/g, (e) => e == "+" ? "-" : "_"), E = (t) => t.replace(/[^A-Za-z0-9\+\/]/g, ""), P = (t) => {
9
+ let e, r, o, n, a = "";
10
+ const s = t.length % 3;
11
+ for (let c = 0; c < t.length; ) {
12
+ if ((r = t.charCodeAt(c++)) > 255 || (o = t.charCodeAt(c++)) > 255 || (n = t.charCodeAt(c++)) > 255)
13
+ throw new TypeError("invalid character found");
14
+ e = r << 16 | o << 8 | n, a += l[e >> 18 & 63] + l[e >> 12 & 63] + l[e >> 6 & 63] + l[e & 63];
15
+ }
16
+ return s ? a.slice(0, s - 3) + "===".substring(s) : a;
17
+ }, v = typeof btoa == "function" ? (t) => btoa(t) : p ? (t) => Buffer.from(t, "binary").toString("base64") : P, A = p ? (t) => Buffer.from(t).toString("base64") : (t) => {
18
+ let r = [];
19
+ for (let o = 0, n = t.length; o < n; o += 4096)
20
+ r.push(d.apply(null, t.subarray(o, o + 4096)));
21
+ return v(r.join(""));
22
+ }, S = (t, e = !1) => e ? B(A(t)) : A(t), R = (t) => {
23
+ if (t = t.replace(/\s+/g, ""), !x.test(t))
24
+ throw new TypeError("malformed base64.");
25
+ t += "==".slice(2 - (t.length & 3));
26
+ let e, r, o, n = [];
27
+ for (let a = 0; a < t.length; )
28
+ e = u[t.charAt(a++)] << 18 | u[t.charAt(a++)] << 12 | (r = u[t.charAt(a++)]) << 6 | (o = u[t.charAt(a++)]), r === 64 ? n.push(d(e >> 16 & 255)) : o === 64 ? n.push(d(e >> 16 & 255, e >> 8 & 255)) : n.push(d(e >> 16 & 255, e >> 8 & 255, e & 255));
29
+ return n.join("");
30
+ }, k = typeof atob == "function" ? (t) => atob(E(t)) : p ? (t) => Buffer.from(t, "base64").toString("binary") : R, z = p ? (t) => b(Buffer.from(t, "base64")) : (t) => b(k(t).split("").map((e) => e.charCodeAt(0))), I = (t) => z(Z(t)), Z = (t) => E(t.replace(/[-_]/g, (e) => e == "-" ? "+" : "/")), q = 8e3, j = (t) => t instanceof Error ? t : new Error(String(t)), K = (t, e, r = "dsheet-package-ingress") => {
31
+ const o = I(e), n = new i.Doc();
32
+ try {
33
+ i.applyUpdate(n, o);
34
+ } finally {
35
+ n.destroy();
36
+ }
37
+ let a = !1;
38
+ const s = () => {
39
+ a = !0;
40
+ };
41
+ t.on("update", s);
42
+ try {
43
+ return i.applyUpdate(t, o, r), a;
44
+ } finally {
45
+ t.off("update", s);
46
+ }
47
+ }, M = async (t, e) => {
48
+ let r;
49
+ try {
50
+ return await Promise.race([
51
+ t,
52
+ new Promise((o, n) => {
53
+ r = setTimeout(
54
+ () => n(new Error("dSheet IndexedDB operation timed out")),
55
+ e
56
+ );
57
+ })
58
+ ]);
59
+ } finally {
60
+ r && clearTimeout(r);
61
+ }
62
+ }, w = (t, e, r) => ({
63
+ dsheetId: t,
64
+ status: e,
65
+ encodedState: null,
66
+ stateVector: null,
67
+ ...r ? { error: j(r) } : {}
68
+ }), V = (t, e) => {
69
+ const r = i.encodeStateAsUpdate(e);
70
+ return {
71
+ dsheetId: t,
72
+ status: r.length <= 2 ? "empty" : "available",
73
+ encodedState: S(r),
74
+ stateVector: S(i.encodeStateVector(e))
75
+ };
76
+ }, N = (t, e, r) => {
77
+ if (!r)
78
+ return w(
79
+ t,
80
+ "unavailable",
81
+ new Error("dSheet document is not ready")
82
+ );
83
+ try {
84
+ return K(r, e, "dsheet-package-ingress"), V(t, r);
85
+ } catch (o) {
86
+ return w(t, "corrupt", o);
87
+ }
88
+ }, y = "updates", O = async (t, e = 2) => {
89
+ if (t._destroyed) return 0;
90
+ const r = await t._db;
91
+ if (!r.objectStoreNames.contains(y)) return 0;
92
+ const o = await new Promise((n, a) => {
93
+ const s = r.transaction(y, "readwrite"), c = s.objectStore(y);
94
+ let h = 0;
95
+ const m = c.getAllKeys();
96
+ m.onsuccess = () => {
97
+ const f = m.result;
98
+ if (f.length < e) return;
99
+ const g = c.getAll();
100
+ g.onsuccess = () => {
101
+ const U = g.result.filter(
102
+ (T) => T instanceof Uint8Array
103
+ ), _ = i.mergeUpdates([
104
+ ...U,
105
+ i.encodeStateAsUpdate(t.doc)
106
+ ]), D = f[f.length - 1];
107
+ c.delete(IDBKeyRange.upperBound(D)), c.add(_), h = f.length;
108
+ };
109
+ }, s.oncomplete = () => n(h), s.onerror = () => a(s.error), s.onabort = () => a(s.error ?? new Error("compaction aborted"));
110
+ });
111
+ return o > 0 && (t._dbsize = 1), o;
112
+ };
113
+ export {
114
+ q as D,
115
+ N as a,
116
+ O as c,
117
+ S as f,
118
+ K as m,
119
+ V as s,
120
+ I as t,
121
+ w as u,
122
+ M as w
123
+ };
@@ -0,0 +1,15 @@
1
+ import { IndexeddbPersistence } from 'y-indexeddb';
2
+
3
+ /**
4
+ * y-indexeddb appends a FULL copy of the doc every time a provider is attached
5
+ * to a Y.Doc that already holds content, and only trims after 500 rows. dSheet
6
+ * attaches to pre-filled docs on every open (published content, remote merges),
7
+ * so the store grows by one full copy per open and every load replays them all.
8
+ *
9
+ * This collapses the store into a single row. It runs in ONE readwrite
10
+ * transaction and merges every stored row (not just this provider's doc), so
11
+ * rows written by another tab/provider in the meantime are never lost.
12
+ *
13
+ * Returns the number of rows removed (0 when nothing needed compacting).
14
+ */
15
+ export declare const compactDsheetPersistence: (persistence: IndexeddbPersistence, minRows?: number) => Promise<number>;
@@ -1,118 +1,124 @@
1
- import { t as D, f as h, D as b, u as p, w as S, s as w } from "./persistence-utils-BXFajzvq.js";
1
+ import { t as D, f as g, D as b, u as p, w as S, c as v, s as w } from "./persistence-compaction-CIxc1USC.js";
2
2
  import * as u from "yjs";
3
- import { clearDocument as v, IndexeddbPersistence as E } from "y-indexeddb";
4
- const f = /* @__PURE__ */ new Map(), M = (e) => {
5
- const o = new u.Doc();
3
+ import { clearDocument as x, IndexeddbPersistence as E } from "y-indexeddb";
4
+ const f = /* @__PURE__ */ new Map(), A = (e) => {
5
+ const a = new u.Doc();
6
6
  try {
7
7
  return u.applyUpdate(
8
- o,
8
+ a,
9
9
  typeof e == "string" ? D(e) : e
10
- ), h(u.encodeStateVector(o));
10
+ ), g(u.encodeStateVector(a));
11
11
  } finally {
12
- o.destroy();
12
+ a.destroy();
13
13
  }
14
- }, x = (e, o) => new Promise((s) => {
15
- const a = new u.Doc();
16
- let r = null, t = null, i = !1, m = !1;
17
- const y = (n) => {
18
- i || (i = !0, clearTimeout(g), r == null || r.close(), a.destroy(), s(n));
19
- }, c = (n, d) => y(p(e, n, d)), g = setTimeout(() => {
14
+ }, B = (e, a) => new Promise((c) => {
15
+ const s = new u.Doc();
16
+ let r = null, t = null, o = !1, y = !1;
17
+ const m = (n) => {
18
+ o || (o = !0, clearTimeout(h), r == null || r.close(), s.destroy(), c(n));
19
+ }, i = (n, d) => m(p(e, n, d)), h = setTimeout(() => {
20
20
  try {
21
21
  t == null || t.abort();
22
22
  } catch {
23
23
  }
24
- c("timed-out", new Error("dSheet IndexedDB read timed out"));
25
- }, o);
24
+ i("timed-out", new Error("dSheet IndexedDB read timed out"));
25
+ }, a);
26
26
  let l;
27
27
  try {
28
28
  l = indexedDB.open(e);
29
29
  } catch (n) {
30
- c("unavailable", n);
30
+ i("unavailable", n);
31
31
  return;
32
32
  }
33
33
  l.onupgradeneeded = () => {
34
34
  var n;
35
- m = !0, (n = l.transaction) == null || n.abort();
35
+ y = !0, (n = l.transaction) == null || n.abort();
36
36
  }, l.onerror = () => {
37
- m ? y(p(e, "missing")) : c("unavailable", l.error);
37
+ y ? m(p(e, "missing")) : i("unavailable", l.error);
38
38
  }, l.onsuccess = () => {
39
39
  if (r = l.result, !r.objectStoreNames.contains("updates") || !r.objectStoreNames.contains("custom")) {
40
- c("corrupt", new Error("dSheet IndexedDB schema is invalid"));
40
+ i("corrupt", new Error("dSheet IndexedDB schema is invalid"));
41
41
  return;
42
42
  }
43
43
  try {
44
44
  t = r.transaction("updates", "readonly");
45
45
  const n = t.objectStore("updates").getAll();
46
- n.onerror = () => c("unavailable", n.error), n.onsuccess = () => {
46
+ n.onerror = () => i("unavailable", n.error), n.onsuccess = () => {
47
47
  try {
48
48
  for (const d of n.result ?? []) {
49
49
  if (!(d instanceof Uint8Array))
50
50
  throw new Error("dSheet IndexedDB contains a non-Yjs update");
51
- u.applyUpdate(a, d);
51
+ u.applyUpdate(s, d);
52
52
  }
53
53
  } catch (d) {
54
- c("corrupt", d);
54
+ i("corrupt", d);
55
55
  }
56
- }, t.oncomplete = () => y(w(e, a)), t.onabort = () => {
57
- i || c("unavailable", t == null ? void 0 : t.error);
56
+ }, t.oncomplete = () => m(w(e, s)), t.onabort = () => {
57
+ o || i("unavailable", t == null ? void 0 : t.error);
58
58
  }, t.onerror = () => {
59
- i || c("unavailable", t == null ? void 0 : t.error);
59
+ o || i("unavailable", t == null ? void 0 : t.error);
60
60
  };
61
61
  } catch (n) {
62
- c("unavailable", n);
62
+ i("unavailable", n);
63
63
  }
64
64
  };
65
- }), B = async (e, o) => {
65
+ }), T = async (e, a) => {
66
66
  if (typeof indexedDB > "u")
67
67
  return p(
68
68
  e,
69
69
  "unavailable",
70
70
  new Error("IndexedDB is unavailable")
71
71
  );
72
- const s = indexedDB;
73
- if (s.databases)
72
+ const c = indexedDB;
73
+ if (c.databases)
74
74
  try {
75
- if (!(await s.databases()).some((r) => r.name === e))
75
+ if (!(await c.databases()).some((r) => r.name === e))
76
76
  return p(e, "missing");
77
77
  } catch {
78
78
  }
79
- return x(e, o);
80
- }, A = (e, o = {}) => {
81
- const s = f.get(e);
82
- if (s) return s;
83
- const a = B(
79
+ return B(e, a);
80
+ }, C = (e, a = {}) => {
81
+ const c = f.get(e);
82
+ if (c) return c;
83
+ const s = T(
84
84
  e,
85
- o.timeoutMs ?? b
85
+ a.timeoutMs ?? b
86
86
  ).finally(() => {
87
- f.get(e) === a && f.delete(e);
87
+ f.get(e) === s && f.delete(e);
88
88
  });
89
- return f.set(e, a), a;
90
- }, C = async (e, o, s = {}) => {
91
- const a = s.timeoutMs ?? b, r = new u.Doc();
89
+ return f.set(e, s), s;
90
+ }, P = async (e, a, c = {}) => {
91
+ const s = c.timeoutMs ?? b, r = new u.Doc();
92
92
  try {
93
- u.applyUpdate(r, D(o), "dsheet-package-ingress");
94
- } catch (i) {
95
- return r.destroy(), p(e, "corrupt", i);
93
+ u.applyUpdate(r, D(a), "dsheet-package-ingress");
94
+ } catch (o) {
95
+ return r.destroy(), p(e, "corrupt", o);
96
96
  }
97
97
  let t = null;
98
98
  try {
99
- return t = new E(e, r), await S(t.whenSynced, a), w(e, r);
100
- } catch (i) {
99
+ t = new E(e, r), await S(t.whenSynced, s);
100
+ try {
101
+ await v(t);
102
+ } catch (o) {
103
+ console.warn("[DSheet] IndexedDB compaction failed:", o);
104
+ }
105
+ return w(e, r);
106
+ } catch (o) {
101
107
  return p(
102
108
  e,
103
- /timed out/i.test(String(i)) ? "timed-out" : "unavailable",
104
- i
109
+ /timed out/i.test(String(o)) ? "timed-out" : "unavailable",
110
+ o
105
111
  );
106
112
  } finally {
107
113
  await (t == null ? void 0 : t.destroy().catch(() => {
108
114
  })), r.destroy();
109
115
  }
110
116
  }, j = async (e) => {
111
- f.delete(e), typeof indexedDB < "u" && await v(e);
117
+ f.delete(e), typeof indexedDB < "u" && await x(e);
112
118
  };
113
119
  export {
114
120
  j as deleteDsheetContent,
115
- M as getDsheetStateVector,
116
- C as mergeDsheetContent,
117
- A as readDsheetContent
121
+ A as getDsheetStateVector,
122
+ P as mergeDsheetContent,
123
+ C as readDsheetContent
118
124
  };
@@ -7,9 +7,9 @@ export { defaultSettings } from './settings';
7
7
  export type { Settings, Hooks, DateBaseLocale, CommentAnchorMove, } from './settings';
8
8
  export { handleCopy, handleGlobalKeyDown, handlePaste, handlePasteByClick, fixPositionOnFrozenCells, handleCellAreaMouseDown, handleCellAreaDoubleClick, handleContextMenu, mouseRender, handleOverlayMouseMove, handleOverlayMouseUp, handleRowHeaderMouseDown, handleColumnHeaderMouseDown, handleColSizeHandleMouseDown, handleColSizeHandleDoubleClick, handleRowSizeHandleMouseDown, handleColFreezeHandleMouseDown, handleRowFreezeHandleMouseDown, describeMatchedShortcut, isBrowserZoomShortcut, isOpenShortcutsModalShortcut, isFormulaListShortcut, } from './events';
9
9
  export * from './locale';
10
- export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, isValidRangeText, getInlineStringHTML, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, getDateBaseLocale, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, buildFiatCurrencyFormat, quoteSsfLiteral, FormulaCache, groupValuesRefresh, execFunctionGroup, runFormulaEvalChunk, applyWorkerFormulaChunkResults, isFormulaEvalPending, FORMULA_ASYNC_CHUNK_SIZE, FORMULA_ASYNC_EVAL_THRESHOLD, FORMULA_WORKER_CHUNK_SIZE, FORMULA_WORKER_THRESHOLD, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, ensureFormulaRangeToSheet, shouldPreserveFormulaEditOnSheetSwitch, activateSheetForNavigation, returnToFormulaOriginSheet, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, getFilterHiddenRowsUnionFromFilterMap, getFilterHiddenRowsUnion, ensureManualHiddenInitialized, rebuildRowHiddenUnion, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, defaultLuckysheetSelectRanges, normalizeSelection, syncPrimaryCellActiveFromSelection, selectionIsExactlyOneMergeBlock, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, mergeSelectionHasValues, handleSort, getRemoveDuplicatesPreview, removeDuplicates, getRemoveDuplicatesErrorMessage, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, isHyperlinkCreationBlocked, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, removeOverShowComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, copyActiveImage, cutActiveImage, pasteImageItem, loadImageFromFile, getImageClipboard, getImageCutSourceId, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, sortSheetBySelectedColumn, searchAll, searchNext, replace, replaceAll, replaceAllScoped, getSearchIndexArr, getSearchIndexArrAsync, getFindRangeOnCurrentSheet, getQuickSearchIndexArr, getQuickSearchHiddenConfig, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, expandCellRectForMerge, shouldQuickSearchUseAsync, runQuickSearchIndexArrAsync, QUICK_SEARCH_ASYNC_ROW_THRESHOLD, parseRangeText, getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, createFilterOptions, clearFilter, clearFilterForColumn, toggleViewerFilter, createFilter, applySheetFilterState, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, CF_DATE_DEFAULT_FORMAT, parseCfDateConditionForUi, formatCfDatePresetSnapshot, parseDdMmYyyyToSerial, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, detectDateFormat, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, remapFormulaReferencesByMap, refreshFormulasUsingDefinedNames, checkCF, getComputeMap, isValidDefinedNameIdentifier, getDefinedNameDisplayRange, findDefinedNameForSelection, findDefinedNameByName, resolveDefinedNameForFormula, addDefinedName, updateDefinedName, deleteDefinedName, selectDefinedName, openNamedRangesSidebar, scheduleDefinedNamesSync, shiftDefinedNamesOnInsert, shiftDefinedNamesOnDelete, removeDefinedNamesForSheet, cancelPaintModel, hideCRCount, getdatabyselection, } from './modules';
10
+ export { getBorderInfoComputeRange, getBorderInfoCompute, normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, isValidRangeText, getInlineStringHTML, applyLinkToSelection, getHyperlinksFromInlineSegments, getUniformLinkFromWindowSelectionInEditor, getHyperlinkAtCaretInContentEditable, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, clipboard, moveToEnd, getRangeRectsByCharacterOffset, getDateBaseLocale, getCanonicalDateDisplayFormat, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, buildFiatCurrencyFormat, quoteSsfLiteral, FormulaCache, groupValuesRefresh, execFunctionGroup, runFormulaEvalChunk, applyWorkerFormulaChunkResults, isFormulaEvalPending, FORMULA_ASYNC_CHUNK_SIZE, FORMULA_ASYNC_EVAL_THRESHOLD, FORMULA_WORKER_CHUNK_SIZE, FORMULA_WORKER_THRESHOLD, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, maybeRecoverDirtyRangeSelection, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, setFormulaEditorOwner, functionHTMLGenerate, suppressFormulaRangeSelectionForInitialEdit, ensureFormulaRangeToSheet, shouldPreserveFormulaEditOnSheetSwitch, activateSheetForNavigation, returnToFormulaOriginSheet, rangeSetValue, getFormulaRangeIndexForKeyboardSync, createFormulaRangeSelect, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, initFreeze, isInlineStringCell, getInlineStringNoStyle, rowLocation, rowLocationByIndex, colLocation, colLocationByIndex, insertRowCol, deleteRowCol, hideSelected, showSelected, isShowHidenCR, getFilterHiddenRowsUnionFromFilterMap, getFilterHiddenRowsUnion, ensureManualHiddenInitialized, rebuildRowHiddenUnion, scrollToHighlightCell, selectTitlesMap, selectTitlesRange, defaultLuckysheetSelectRanges, normalizeSelection, syncPrimaryCellActiveFromSelection, selectionIsExactlyOneMergeBlock, setPrimaryCellActive, advancePrimaryCellInLastMultiSelection, snapSheetSelectionFocusToCellPreserveMultiRange, moveHighlightCell, deleteSelectedCellText, selectAll, fixRowStyleOverflowInFreeze, fixColumnStyleOverflowInFreeze, calcSelectionInfo, addSheet, deleteSheet, editSheetName, changeSheet, updateFormat, autoSelectionFormula, handleBold, handleItalic, handleStrikeThrough, handleUnderline, handleHorizontalAlign, handleVerticalAlign, handleTextColor, handleTextBackground, handleBorder, handleMerge, mergeSelectionHasValues, handleSort, getRemoveDuplicatesPreview, removeDuplicates, getRemoveDuplicatesErrorMessage, handleFreeze, handleTextSize, handleSum, handleLink, captureLinkEditorOpenSnapshot, isHyperlinkCreationBlocked, toolbarItemClickHandler, toolbarItemSelectedFunc, handleScreenShot, insertImage, showImgChooser, drawArrow, setEditingComment, removeEditingComment, removeOverShowComment, newComment, editComment, deleteComment, showComments, showHideComment, showHideAllComments, onCommentBoxMoveStart, removeActiveImage, copyActiveImage, cutActiveImage, pasteImageItem, loadImageFromFile, getImageClipboard, getImageCutSourceId, cancelActiveImgItem, onImageMoveStart, onImageResizeStart, createDropCellRange, sortSelection, sortSheetBySelectedColumn, searchAll, searchNext, replace, replaceAll, replaceAllScoped, getSearchIndexArr, getSearchIndexArrAsync, getFindRangeOnCurrentSheet, getQuickSearchIndexArr, getQuickSearchHiddenConfig, getCellHyperlinks, getHyperlinkDisplayTextInCell, getInlineLinkPlainRange, getUniformLinkCoveringPlainRange, getUniformLinkAtPlainOffset, removeHyperlinkForLink, updateHyperlinkForLink, syncLinkCardAfterHyperlinkChange, expandCellRectForMerge, shouldQuickSearchUseAsync, runQuickSearchIndexArrAsync, QUICK_SEARCH_ASYNC_ROW_THRESHOLD, parseRangeText, getCellRowColumn, getCellHyperlink, saveHyperlink, removeHyperlink, showLinkCard, goToLink, isLinkValid, createFilterOptions, clearFilter, clearFilterForColumn, toggleViewerFilter, createFilter, applySheetFilterState, getFilterColumnValues, getFilterColumnColors, orderbydatafiler, saveFilter, onCellsMoveStart, cfSplitRange, updateMoreCell, getRegStr, getDataArr, applyLocation, getOptionValue, getSelectRange, getDropdownList, setDropdownValue, confirmMessage, setConditionRules, CF_DATE_DEFAULT_FORMAT, parseCfDateConditionForUi, formatCfDatePresetSnapshot, parseDdMmYyyyToSerial, handleOverlayTouchStart, handleOverlayTouchEnd, MAX_ZOOM_RATIO, MIN_ZOOM_RATIO, jfrefreshgrid, sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, setCellError, clearCellError, detectDateFormat, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, iscelldata, getcellrange, cancelFunctionrangeSelected, seletedHighlistByindex, spillSortResult, execfunction, insertUpdateFunctionGroup, remapFormulaReferencesByMap, refreshFormulasUsingDefinedNames, checkCF, getComputeMap, isValidDefinedNameIdentifier, getDefinedNameDisplayRange, findDefinedNameForSelection, findDefinedNameByName, resolveDefinedNameForFormula, addDefinedName, updateDefinedName, deleteDefinedName, selectDefinedName, openNamedRangesSidebar, scheduleDefinedNamesSync, shiftDefinedNamesOnInsert, shiftDefinedNamesOnDelete, removeDefinedNamesForSheet, cancelPaintModel, hideCRCount, getdatabyselection, } from './modules';
11
11
  export type { FilterDate, FilterValue, FilterColor } from './modules';
12
- export { getFreezeState, toggleFreeze, indexToColumnChar, escapeScriptTag, escapeHTMLTag, getSheetIndex, replaceHtml, isAllowEdit, isAllowEditReadOnly, filterPatch, patchToOp, opToPatch, inverseRowColOptions, } from './utils';
12
+ export { getFreezeState, getFrozenPixelBounds, toggleFreeze, indexToColumnChar, escapeScriptTag, escapeHTMLTag, getSheetIndex, replaceHtml, isAllowEdit, isAllowEditReadOnly, filterPatch, patchToOp, opToPatch, inverseRowColOptions, } from './utils';
13
13
  export type { PatchOptions, ChangedSheet } from './utils';
14
14
  export type { Op, Cell, CellWithRowAndCol, CellMatrix, HyperlinkEntry, Selection, Presence, Sheet, GlobalCache, SingleRange, Range, SearchResult, LinkCardProps, LiveQueryData, Freezen, DefinedName, } from './types';
15
15
  export type { RemoveDuplicatesColumnOption, RemoveDuplicatesError, RemoveDuplicatesOptions, RemoveDuplicatesPreview, RemoveDuplicatesResult, } from './modules';
@@ -3,6 +3,8 @@ export declare function normalizeDateBaseLocale(locale: unknown): DateBaseLocale
3
3
  export declare function setDateBaseLocale(locale: unknown): void;
4
4
  export declare function getDateBaseLocale(): DateBaseLocale;
5
5
  export declare function isUsDateBaseLocale(): boolean;
6
+ /** Standard Date toolbar / formula display format (no leading zeros). */
7
+ export declare function getCanonicalDateDisplayFormat(hasTime?: boolean): string;
6
8
  export declare function getCanonicalDateEditFormat(hasTime: boolean): string;
7
9
  export declare function shouldPreserveDateFormatForEdit(format: string): boolean;
8
10
  export declare function getDateEditFormatForCell(cellDateFormat: string, hasTime: boolean): string;
@@ -2,7 +2,7 @@ export { getBorderInfoComputeRange, getBorderInfoCompute } from './border';
2
2
  export { normalizedCellAttr, normalizedAttr, getCellValue, setCellValue, getRealCellValue, mergeBorder, cancelNormalSelected, updateCell, getRangetxt, getRangeByTxt, isValidRangeText, getInlineStringHTML, getStyleByCell, clearSelectedCellFormat, clearRowsCellsFormat, clearColumnsCellsFormat, cancelFunctionrangeSelected, } from './cell';
3
3
  export { default as clipboard } from './clipboard';
4
4
  export { moveToEnd, getRangeRectsByCharacterOffset } from './cursor';
5
- export { getDateBaseLocale, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, } from './date-base-locale';
5
+ export { getDateBaseLocale, getCanonicalDateDisplayFormat, getCanonicalDateEditFormat, getDateEditFormatForCell, isUsDateBaseLocale, normalizeDateBaseLocale, shouldPreserveDateFormatForEdit, setDateBaseLocale, } from './date-base-locale';
6
6
  export { update, is_date, valueShowEs, isTypedCurrencyDisplayFormat, isCurrencyLikeNumberFormat, buildFiatCurrencyFormat, quoteSsfLiteral, } from './format';
7
7
  export { FormulaCache, groupValuesRefresh, setCaretPosition, getrangeseleciton, getFormulaEditorOwner, rangeHightlightselected, handleFormulaInput, israngeseleciton, createRangeHightlight, createFormulaRangeSelect, maybeRecoverDirtyRangeSelection, delFunctionGroup, functionHTMLGenerate, onFormulaRangeDragEnd, rangeDrag, rangeSetValue, remapFormulaReferencesByMap, getFormulaRangeIndexAtCaret, isCaretAtValidFormulaRangeInsertionPoint, isLegacyFormulaRangeMode, markRangeSelectionDirty, getFormulaRangeIndexForKeyboardSync, isFormulaReferenceInputMode, seedFormulaFuncSelectedRangeFromLastSelection, functionStrChange, setFormulaEditorOwner, getAllFunctionGroup, suppressFormulaRangeSelectionForInitialEdit, ensureFormulaRangeToSheet, shouldPreserveFormulaEditOnSheetSwitch, activateSheetForNavigation, returnToFormulaOriginSheet, } from './formula';
8
8
  export { FORMULA_ASYNC_CHUNK_SIZE, FORMULA_ASYNC_EVAL_THRESHOLD, FORMULA_WORKER_CHUNK_SIZE, FORMULA_WORKER_THRESHOLD, isFormulaEvalPending, } from './formula-async-eval';
@@ -4,5 +4,20 @@ export declare const getFreezeState: (ctx: Context) => {
4
4
  isRowFrozen: boolean;
5
5
  isColFrozen: boolean;
6
6
  };
7
+ /**
8
+ * Pixel size (in the same zoomed screen-pixel space as visibledatarow /
9
+ * visibledatacolumn) of the frozen strip currently pinned to the top-left
10
+ * of the viewport. Zero on an axis that isn't frozen.
11
+ *
12
+ * Frozen rows/columns are only ever redrawn at a fixed on-screen position
13
+ * by the canvas itself -- there's no separate DOM layer for them -- so any
14
+ * DOM overlay positioned in document space (e.g. inserted images) needs
15
+ * this boundary to know when it has scrolled into the area the frozen
16
+ * pane owns and should stay hidden behind it.
17
+ */
18
+ export declare const getFrozenPixelBounds: (ctx: Context) => {
19
+ widthPx: number;
20
+ heightPx: number;
21
+ };
7
22
  export type FreezeType = 'row' | 'column' | 'both' | 'unfreeze-row' | 'unfreeze-column' | 'unfreeze-all';
8
23
  export declare const toggleFreeze: (ctx: Context, type: FreezeType) => void;
@@ -3,7 +3,8 @@ import { Sheet } from '../types';
3
3
 
4
4
  export { filterPatch, patchToOp, opToPatch, inverseRowColOptions, extractFormulaCellOps, } from './patch';
5
5
  export type { PatchOptions, ChangedSheet } from './patch';
6
- export { getFreezeState, toggleFreeze } from './freeze';
6
+ export { getFreezeState, getFrozenPixelBounds, toggleFreeze } from './freeze';
7
+ export { sheetNameNeedsQuotes, formatSheetNameForFormula, quoteSheetNamesInFormula, } from './sheet-name-ref';
7
8
  export type { FreezeType } from './freeze';
8
9
  export declare function generateRandomSheetName(file: Sheet[], isPivotTable: boolean, ctx: Context): any;
9
10
  export declare function rgbToHex(color: string): string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Helpers for sheet-qualified references in formulas (`Sheet1!A1`,
3
+ * `'Finance - 1'!A1`, `'It''s'!A1`).
4
+ *
5
+ * Like Google Sheets / Excel, a sheet name can only appear bare when it is a
6
+ * plain identifier. Anything else (spaces, `-`, punctuation, a leading digit,
7
+ * a name that looks like a cell such as `A1`, non-Latin scripts) must be
8
+ * wrapped in single quotes, with embedded `'` doubled.
9
+ */
10
+ export declare function sheetNameNeedsQuotes(name: string): boolean;
11
+ /** `Sheet1` -> `Sheet1`, `Finance - 1` -> `'Finance - 1'`, `It's` -> `'It''s'`. */
12
+ export declare function formatSheetNameForFormula(name: string): string;
13
+ /**
14
+ * Wraps bare references to existing sheets whose names need quoting, e.g.
15
+ * `=SUM(Sheet-4!H6,B2:C2)` -> `=SUM('Sheet-4'!H6,B2:C2)`.
16
+ *
17
+ * Only exact (case-insensitive) matches of an existing sheet name immediately
18
+ * followed by `!` are rewritten; text inside "strings" and already-quoted
19
+ * '...' names is left untouched.
20
+ */
21
+ export declare function quoteSheetNamesInFormula(formula: string, sheetNames: string[]): string;
@@ -0,0 +1,14 @@
1
+ import { RefObject } from 'react';
2
+
3
+ /**
4
+ * Remembers the last caret position (text offset) inside a formula editor.
5
+ *
6
+ * Clicking a sheet tab moves the DOM selection out of the editor, so by the
7
+ * time the sheet switch finishes the caret is gone. The value kept here lets
8
+ * the editor put the caret back exactly where the user left it (e.g. after the
9
+ * `,` in `=SUM('Sheet - 2'!B2,`) instead of guessing.
10
+ *
11
+ * The offset counts characters across text nodes, matching
12
+ * `setCursorPosition`. It resets to `null` when the edit session ends.
13
+ */
14
+ export declare function useLastFormulaCaretOffset(editorRef: RefObject<HTMLDivElement | null>, editSessionActive: boolean): RefObject<number | null>;