@fileverse-dev/dsheet 4.1.23-stabilise-package-8 → 4.1.24

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 (123) hide show
  1. package/README.md +0 -10
  2. package/dist/editor/contexts/editor-context.d.ts +0 -9
  3. package/dist/editor/hooks/use-celldata-compaction.d.ts +2 -44
  4. package/dist/editor/hooks/use-editor-data.d.ts +0 -1
  5. package/dist/editor/hooks/use-editor-sync.d.ts +1 -5
  6. package/dist/editor/types.d.ts +1 -41
  7. package/dist/editor/utils/after-update-cell.d.ts +0 -6
  8. package/dist/editor/utils/apply-comment-markers.d.ts +1 -3
  9. package/dist/editor/utils/editor-handle.d.ts +1 -1
  10. package/dist/editor/utils/remote-apply-guard.d.ts +0 -45
  11. package/dist/editor/utils/sheet-ydoc-sync-utils.d.ts +4 -13
  12. package/dist/editor/utils/update-ydoc.d.ts +1 -9
  13. package/dist/{executeStringFunction-CN6ZZqZM.js → executeStringFunction-B3Tw7e1U.js} +13166 -13690
  14. package/dist/formula.js +1 -1
  15. package/dist/{index-Dbl7Dh2_.js → index-DvpQioe4.js} +22321 -23599
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.es.js +21 -21
  18. package/dist/persistence-utils-BXFajzvq.js +98 -0
  19. package/dist/persistence-utils.d.ts +0 -2
  20. package/dist/persistence.d.ts +0 -13
  21. package/dist/persistence.js +74 -122
  22. package/dist/sheet-engine/core/api/cell.d.ts +1 -25
  23. package/dist/sheet-engine/core/api/sheet-flowdata-lifecycle.d.ts +0 -1
  24. package/dist/sheet-engine/core/index.d.ts +1 -1
  25. package/dist/sheet-engine/core/modules/border.d.ts +0 -9
  26. package/dist/sheet-engine/core/modules/dataVerification.d.ts +0 -15
  27. package/dist/sheet-engine/core/modules/formula-arrow-mode.d.ts +81 -0
  28. package/dist/sheet-engine/core/modules/formula-async-eval.d.ts +0 -5
  29. package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +0 -2
  30. package/dist/sheet-engine/core/modules/formula-transitive-deps.d.ts +1 -26
  31. package/dist/sheet-engine/core/modules/formula.d.ts +33 -88
  32. package/dist/sheet-engine/core/modules/index.d.ts +3 -4
  33. package/dist/sheet-engine/core/modules/rowcol.d.ts +0 -8
  34. package/dist/sheet-engine/core/paste-helpers/calculate-range-cell-size.d.ts +0 -14
  35. package/dist/sheet-engine/core/settings.d.ts +1 -11
  36. package/dist/sheet-engine/core/utils/ydoc-celldata-changes.d.ts +2 -29
  37. package/dist/sheet-engine/react/components/ContextMenu/FilterMenu.d.ts +2 -2
  38. package/dist/sheet-engine/react/components/ContextMenu/SheetTab.d.ts +2 -2
  39. package/dist/sheet-engine/react/components/ContextMenu/index.d.ts +2 -2
  40. package/dist/sheet-engine/react/components/SVGDefines.d.ts +2 -2
  41. package/dist/sheet-engine/react/components/SheetTab/index.d.ts +2 -2
  42. package/dist/sheet-engine/react/components/Toolbar/index.d.ts +2 -2
  43. package/dist/sheet-engine/react/components/Workbook/api.d.ts +0 -4
  44. package/dist/sheet-engine/react/components/Workbook/index.d.ts +0 -2
  45. package/dist/sheet-engine/react/context/index.d.ts +0 -15
  46. package/dist/style.css +1 -1
  47. package/dist/sync-local/SyncManager.d.ts +2 -2
  48. package/dist/sync-local/types/index.d.ts +1 -2
  49. package/dist/{use-xlsx-import-impl-sGRvmOlI.js → use-xlsx-import-impl-DWkIjd5v.js} +119 -120
  50. package/dist/{xlsx-defined-names-C6c8LJn5.js → xlsx-defined-names-776Vg9GT.js} +2 -2
  51. package/dist/{xlsx-export-impl-Dno93LqB.js → xlsx-export-impl-C60SB8Ve.js} +4 -4
  52. package/dist/{xlsx-hyperlink-inline-DjtQMKIL.js → xlsx-hyperlink-inline-DaxgypSu.js} +2 -2
  53. package/package.json +1 -1
  54. package/dist/editor/utils/active-sheet-keeper.test.d.ts +0 -1
  55. package/dist/editor/utils/after-update-cell.test.d.ts +0 -1
  56. package/dist/editor/utils/apply-comment-markers.test.d.ts +0 -1
  57. package/dist/editor/utils/calc-chain-ydoc-update.test.d.ts +0 -1
  58. package/dist/editor/utils/content-change.d.ts +0 -48
  59. package/dist/editor/utils/content-change.test.d.ts +0 -1
  60. package/dist/editor/utils/content-fingerprint.d.ts +0 -37
  61. package/dist/editor/utils/content-fingerprint.test.d.ts +0 -1
  62. package/dist/editor/utils/format-gate.d.ts +0 -27
  63. package/dist/editor/utils/format-gate.test.d.ts +0 -1
  64. package/dist/editor/utils/legacy-on-change.d.ts +0 -20
  65. package/dist/editor/utils/legacy-on-change.test.d.ts +0 -1
  66. package/dist/editor/utils/patch-plain-celldata.d.ts +0 -19
  67. package/dist/editor/utils/patch-plain-celldata.test.d.ts +0 -1
  68. package/dist/editor/utils/rebuild-indexeddb-store.d.ts +0 -19
  69. package/dist/editor/utils/rebuild-indexeddb-store.failure.test.d.ts +0 -1
  70. package/dist/editor/utils/rebuild-indexeddb-store.test.d.ts +0 -1
  71. package/dist/editor/utils/remote-apply-guard.test.d.ts +0 -1
  72. package/dist/editor/utils/sheet-ydoc-sync-utils.test.d.ts +0 -1
  73. package/dist/editor/utils/structural-edit-formula-sync.test.d.ts +0 -1
  74. package/dist/editor/utils/structural-edit-other-tabs.test.d.ts +0 -1
  75. package/dist/editor/utils/wait-for-sync.d.ts +0 -35
  76. package/dist/editor/utils/wait-for-sync.test.d.ts +0 -1
  77. package/dist/persistence-utils-CSKBobX8.js +0 -151
  78. package/dist/persistence.append.test.d.ts +0 -1
  79. package/dist/persistence.fingerprint.test.d.ts +0 -1
  80. package/dist/sheet-engine/core/api/remote-apply.test.d.ts +0 -1
  81. package/dist/sheet-engine/core/api/sheet-flowdata-lifecycle.test.d.ts +0 -1
  82. package/dist/sheet-engine/core/modules/b6-ydoc-writes.test.d.ts +0 -1
  83. package/dist/sheet-engine/core/modules/cell-shift.d.ts +0 -11
  84. package/dist/sheet-engine/core/modules/cell.commit-ydoc.test.d.ts +0 -1
  85. package/dist/sheet-engine/core/modules/engine-hot-spots.test.d.ts +0 -1
  86. package/dist/sheet-engine/core/modules/formula-dep-text.d.ts +0 -23
  87. package/dist/sheet-engine/core/modules/formula-dep-text.test.d.ts +0 -1
  88. package/dist/sheet-engine/core/modules/formula-edge-update.d.ts +0 -13
  89. package/dist/sheet-engine/core/modules/formula-narrowing.test.d.ts +0 -1
  90. package/dist/sheet-engine/core/modules/formula-tab-load.test.d.ts +0 -1
  91. package/dist/sheet-engine/core/modules/formula-warmup.d.ts +0 -33
  92. package/dist/sheet-engine/core/modules/formula-warmup.test.d.ts +0 -1
  93. package/dist/sheet-engine/core/modules/formula.dep-graph.test.d.ts +0 -1
  94. package/dist/sheet-engine/core/modules/formula.str-change.test.d.ts +0 -1
  95. package/dist/sheet-engine/core/modules/formula.wide-seed.test.d.ts +0 -1
  96. package/dist/sheet-engine/core/modules/history-calc-chain.d.ts +0 -39
  97. package/dist/sheet-engine/core/modules/history-calc-chain.test.d.ts +0 -1
  98. package/dist/sheet-engine/core/modules/history-celldata.d.ts +0 -25
  99. package/dist/sheet-engine/core/modules/history-grid-size.d.ts +0 -16
  100. package/dist/sheet-engine/core/modules/history-grid-size.test.d.ts +0 -1
  101. package/dist/sheet-engine/core/modules/rowcol-refused-edit.test.d.ts +0 -1
  102. package/dist/sheet-engine/core/modules/rowcol-unloaded-history.test.d.ts +0 -1
  103. package/dist/sheet-engine/core/modules/structural-edit-prep.d.ts +0 -36
  104. package/dist/sheet-engine/core/modules/structural-edit-prep.test.d.ts +0 -1
  105. package/dist/sheet-engine/core/paste/paste-dep-graph.test.d.ts +0 -1
  106. package/dist/sheet-engine/core/paste-helpers/calculate-range-cell-size.test.d.ts +0 -1
  107. package/dist/sheet-engine/react/components/NotationBoxes/shown-comments.d.ts +0 -20
  108. package/dist/sheet-engine/react/components/NotationBoxes/shown-comments.test.d.ts +0 -1
  109. package/dist/sheet-engine/react/components/SheetOverlay/editing-as-formula.d.ts +0 -7
  110. package/dist/sheet-engine/react/components/SheetOverlay/editing-as-formula.test.d.ts +0 -1
  111. package/dist/sheet-engine/react/components/SheetOverlay/hover-tracker.d.ts +0 -44
  112. package/dist/sheet-engine/react/components/SheetOverlay/hover-tracker.test.d.ts +0 -1
  113. package/dist/sheet-engine/react/components/Toolbar/FunctionList/group-functions.d.ts +0 -9
  114. package/dist/sheet-engine/react/components/Toolbar/FunctionList/group-functions.test.d.ts +0 -1
  115. package/dist/sheet-engine/react/components/Workbook/denomination-scan.d.ts +0 -16
  116. package/dist/sheet-engine/react/components/Workbook/denomination-scan.test.d.ts +0 -1
  117. package/dist/sheet-engine/react/components/Workbook/stable-handle.d.ts +0 -8
  118. package/dist/sheet-engine/react/components/Workbook/stable-handle.test.d.ts +0 -1
  119. package/dist/sheet-engine/react/context/use-workbook-store.d.ts +0 -30
  120. package/dist/sheet-engine/react/context/workbook-store.d.ts +0 -30
  121. package/dist/sheet-engine/react/context/workbook-store.test.d.ts +0 -1
  122. package/dist/sync-local/SyncManager.remote-apply.test.d.ts +0 -1
  123. /package/dist/{editor/hooks/use-celldata-compaction.test.d.ts → sheet-engine/core/modules/formula-arrow-mode.test.d.ts} +0 -0
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Pure (DOM-free, ctx-free) logic that decides what an arrow key does while a
3
+ * formula is being edited.
4
+ *
5
+ * GRID - not editing: arrows move the grid selection
6
+ * TEXT_EDIT - arrows move the text caret
7
+ * REFERENCE_READY - next arrow inserts a new cell reference at the caret
8
+ * REFERENCE_ACTIVE - arrows move/extend the reference that was just inserted
9
+ */
10
+ export type FormulaArrowMode = 'GRID' | 'TEXT_EDIT' | 'REFERENCE_READY' | 'REFERENCE_ACTIVE';
11
+ /** Sticky, user-controlled (F2). `null` = automatic behavior. */
12
+ export type FormulaArrowOverride = null | 'TEXT_EDIT' | 'REFERENCE';
13
+ export type TokenKind = 'EQ' | 'SPACE' | 'STRING' | 'REF' | 'NAME' | 'NUMBER' | 'FUNC_NAME' | 'LPAREN' | 'RPAREN' | 'COMMA' | 'OPERATOR' | 'POSTFIX' | 'UNKNOWN';
14
+ export type Token = {
15
+ kind: TokenKind;
16
+ start: number;
17
+ end: number;
18
+ text: string;
19
+ /** STRING / quoted sheet name: closing quote present. */
20
+ terminated?: boolean;
21
+ /** REF that is not (yet) a complete reference, e.g. `A1:A`, `A1:`. */
22
+ partial?: boolean;
23
+ };
24
+ /** Never throws. Offsets index into `text` as given. */
25
+ export declare function tokenizeFormula(text: string): Token[];
26
+ export type CaretContext = {
27
+ inString: boolean;
28
+ /** Caret strictly inside a non-string token (e.g. `A|1`, `SU|M(`). */
29
+ insideToken: Token | null;
30
+ /** REF token the caret is inside or right after (start < caret <= end). */
31
+ touchingRef: Token | null;
32
+ prevSig: Token | null;
33
+ nextSig: Token | null;
34
+ };
35
+ export declare function getCaretContext(tokens: Token[], caret: number): CaretContext;
36
+ /**
37
+ * True when a new operand (cell reference) can be entered at the caret:
38
+ * the previous significant token wants an operand, the caret is not inside a
39
+ * string or token, and no operand sits immediately to the right.
40
+ */
41
+ export declare function isOperandSlot(ctx: CaretContext): boolean;
42
+ export type ArrowModeInput = {
43
+ editing: boolean;
44
+ /** Full editor text (offsets of `caretOffset` index into it). */
45
+ text: string;
46
+ /** null when the caret is not inside the editor. */
47
+ caretOffset: number | null;
48
+ override: FormulaArrowOverride;
49
+ /** false for sessions opened on an existing formula (F2 / dblclick / bar). */
50
+ autoAllowed: boolean;
51
+ /**
52
+ * The engine is driving a reference right now (mouse drag, or a reference the
53
+ * keyboard just inserted and the caret is still on).
54
+ */
55
+ refActive: boolean;
56
+ };
57
+ /** Decision priority from the product spec, evaluated in this exact order. */
58
+ export declare function resolveArrowMode(input: ArrowModeInput): FormulaArrowMode;
59
+ /**
60
+ * F2 while editing a formula: flip between caret and reference selection.
61
+ *
62
+ * Toggles the stored override once one exists, so a second press always undoes
63
+ * the first, even at a caret where the derived mode cannot change (e.g. after
64
+ * `)`). With no stored override, flips from the mode the user is looking at.
65
+ */
66
+ export declare function overrideAfterF2(mode: FormulaArrowMode, current?: FormulaArrowOverride): FormulaArrowOverride;
67
+ /**
68
+ * Rule 4: keys typed while a reference is active end the arrow-driven
69
+ * reference. The next mode is then derived from the caret position
70
+ * (operator or `,` -> READY, `)` or anything else -> TEXT_EDIT).
71
+ * keyCode based because it is called from keyup/keydown handlers.
72
+ */
73
+ export declare function isTextChangingKeyCode(kcode: number): boolean;
74
+ /**
75
+ * Keys that edit characters *inside* a reference token (letters, digits incl.
76
+ * numpad digits, Backspace/Delete). Typing them over an arrow-inserted
77
+ * reference makes it a hand-edited token, so its highlight must be dropped.
78
+ * Operators, commas and spaces are not here: they end the reference but leave
79
+ * its highlight alone (see `isTextChangingKeyCode`).
80
+ */
81
+ export declare function isReferenceDirtyingKeyCode(kcode: number): boolean;
@@ -37,11 +37,6 @@ export type FormulaAsyncEvalJob = {
37
37
  impactedByCircular: string[];
38
38
  cycleNodes: string[];
39
39
  workerSnapshotKey: string;
40
- /**
41
- * Set on a forced full pass: the dependency-graph epoch it started at. The
42
- * last chunk marks the graph complete if the epoch is unchanged (C8).
43
- */
44
- fullPassEpoch?: number | null;
45
40
  nextIndex: number;
46
41
  total: number;
47
42
  debug?: FormulaEvalDebug;
@@ -20,8 +20,6 @@ export type SnapshotFormulaResult = {
20
20
  spe?: unknown;
21
21
  deps: string[];
22
22
  isError: boolean;
23
- /** Read a sheet name that doesn't exist; the main thread keeps it on every commit's run list (C8). */
24
- unresolvedSheetRef?: boolean;
25
23
  };
26
24
  export type SnapshotEvalInput = {
27
25
  sheets: SnapshotSheet[];
@@ -1,32 +1,7 @@
1
1
  /** Cell / formula key format used in depsByCell and revDepsByCell. */
2
2
  export declare function toFormulaDepCellKey(sheetId: string, r: number, c: number): string;
3
- /** A range a wide formula reads (more cells than get individual edges). */
4
- export type WideRange = {
5
- sheetId: string;
6
- startRow: number;
7
- endRow: number;
8
- startCol: number;
9
- endCol: number;
10
- };
11
- /**
12
- * Wide formulas (ranges over MAX_RANGE_DEPS cells record no cell edges).
13
- * `ranges` holds the ranges of those whose ranges could be read; a key in
14
- * `keys` without an entry in `ranges` can't be bounded, so it joins every walk.
15
- */
16
- export type WideFormulaIndex = {
17
- keys: Iterable<string>;
18
- ranges: Map<string, WideRange[]>;
19
- };
20
3
  /**
21
4
  * Walk revDepsByCell from a changed cell to collect every formula cell that
22
5
  * must recalculate (direct + transitive dependents).
23
- *
24
- * `extraFormulaSeeds` are formulas that run on every commit whatever the
25
- * graph says (named ranges covering the edited cell). They join the same
26
- * walk, so formulas that read their results are reached too.
27
- *
28
- * A wide formula joins the walk only when one of its ranges holds the edited
29
- * cell or a formula cell the walk reaches; one whose ranges can't be read
30
- * joins every walk. It then seeds the walk like any other formula.
31
6
  */
32
- export declare function collectTransitiveFormulaDependents(originCellKey: string, revDepsByCell: Map<string, Set<string>>, extraFormulaSeeds?: Iterable<string>, wide?: WideFormulaIndex): Set<string>;
7
+ export declare function collectTransitiveFormulaDependents(originCellKey: string, revDepsByCell: Map<string, Set<string>>): Set<string>;
@@ -1,8 +1,8 @@
1
1
  import { Cell, CellMatrix, Rect, Selection } from '../types';
2
2
  import { Context } from '../context';
3
+ import { FormulaArrowMode, FormulaArrowOverride } from './formula-arrow-mode';
3
4
  import { FormulaAsyncEvalJob } from './formula-async-eval';
4
5
  import { RangePassCacheEntry } from './formula-range-cache';
5
- import { WideRange } from './formula-transitive-deps';
6
6
  import { SnapshotEvalOutput } from './formula-snapshot-eval';
7
7
 
8
8
  /** True when the formula is only numeric ops on TODAY()/NOW() (incl. unary +/−); used to display serials as dates. */
@@ -29,6 +29,9 @@ export declare class FormulaCache {
29
29
  rangedrag_row_start?: boolean;
30
30
  rangeSelectionActive?: boolean | null;
31
31
  keyboardRangeSelectionLock?: boolean;
32
+ arrowOverride?: FormulaArrowOverride;
33
+ arrowAutoAllowed?: boolean;
34
+ arrowSessionCell?: [number, number];
32
35
  /** True after arrow/Shift+arrow moved `func_selectedrange` without updating yellow selection. */
33
36
  formulaKeyboardRefSync?: boolean;
34
37
  formulaEditorOwner?: 'cell' | 'fx' | null;
@@ -52,32 +55,6 @@ export declare class FormulaCache {
52
55
  * affect them even when no precise reverse edge exists.
53
56
  */
54
57
  formulasWithWideRangeDeps: Set<string>;
55
- /**
56
- * The ranges of the wide formulas whose ranges could be read, by formula
57
- * key. A wide formula joins a commit's walk only when one of these holds the
58
- * edited cell or a formula cell the walk reaches. A key in
59
- * `formulasWithWideRangeDeps` with no entry here (an unresolved tab, an
60
- * unreadable range) joins every walk.
61
- */
62
- wideRangesByFormula: Map<string, WideRange[]>;
63
- /**
64
- * True once a full pass has evaluated every formula in the chain since the
65
- * indexes were last reset, so `revDepsByCell` lists every dependent of every
66
- * cell (C8). While true, a commit to a cell with no dependents runs no
67
- * formula pass. Cleared by `markDepGraphIncomplete`.
68
- */
69
- depGraphComplete: boolean;
70
- /**
71
- * Bumped each time the flag is cleared. A deferred full pass records it at
72
- * start and sets the flag only if nothing cleared it while it ran.
73
- */
74
- depGraphEpoch: number;
75
- /**
76
- * Grid size (`rows x cols`) of each dense tab when the graph was completed.
77
- * Whole-row and whole-column references were recorded at that size, so a
78
- * commit to a tab that has grown since takes the full pass again.
79
- */
80
- depGraphSheetSizes: Map<string, string>;
81
58
  /**
82
59
  * Dependency collection state for the currently-parsed formula, set by `execfunction`.
83
60
  * When null, dependency recording is disabled.
@@ -86,10 +63,6 @@ export declare class FormulaCache {
86
63
  originKey: string;
87
64
  deps: Set<string>;
88
65
  hasWideRangeDep: boolean;
89
- /** Ranges over the cap, in the order they were read. */
90
- wideRanges: WideRange[];
91
- /** A wide dependency whose range can't be bounded (unresolved tab). */
92
- wideUnreadable: boolean;
93
66
  };
94
67
  /** Step 2: per execFunctionGroup pass cache for materialized range reads. */
95
68
  rangeValuePassCache?: Map<string, RangePassCacheEntry>;
@@ -97,21 +70,6 @@ export declare class FormulaCache {
97
70
  hits: number;
98
71
  misses: number;
99
72
  };
100
- /**
101
- * Drop every recorded formula dependency, back to the state a fresh mount
102
- * has. Used when a sheet's formula list is replaced from outside the
103
- * engine (a collaborator's calcChain change, A4).
104
- */
105
- resetDependencyIndexes(): void;
106
- /**
107
- * The graph may miss edges: formulas moved, were rewritten or entered the
108
- * chain without being evaluated. Commits take the full pass again until the
109
- * next full pass completes.
110
- */
111
- markDepGraphIncomplete(): void;
112
- /** Called after each `markDepGraphIncomplete` (the C8 warm-up re-runs). */
113
- depGraphIncompleteListeners: Set<() => void>;
114
- onDepGraphIncomplete(listener: () => void): () => void;
115
73
  constructor();
116
74
  materializeFullRangeFragment(context: Context, sheetId: string, flowdata: CellMatrix | null | undefined, startRow: number, endRow: number, startCol: number, endCol: number): {
117
75
  fragment: any[][];
@@ -123,46 +81,10 @@ export declare class FormulaCache {
123
81
  export declare function iscelldata(txt: string): boolean;
124
82
  export declare function getcellrange(ctx: Context, txt: string, formulaId?: string): any;
125
83
  export declare function getAllFunctionGroup(ctx: Context): any[];
126
- /** Remove the dependency edges recorded for a cell that is no longer a formula. */
127
- export declare function dropDependencyEdges(ctx: Context, r: number, c: number, id: string): void;
128
- /**
129
- * delFunctionGroup for many cells of one sheet: the chain and the dynamic
130
- * array list are filtered once, not scanned and copied per cell. Same result
131
- * as calling delFunctionGroup for each cell.
132
- */
133
- export declare function delFunctionGroupBatch(ctx: Context, id: string, cells: {
134
- r: number;
135
- c: number;
136
- }[]): void;
137
84
  export declare function delFunctionGroup(ctx: Context, r: number, c: number, id?: string): void;
138
85
  export declare function insertUpdateFunctionGroup(ctx: Context, r: number, c: number, id?: string, calcChainSet?: Set<string>): void;
139
- /**
140
- * Drop every recorded formula dependency, back to a fresh mount's state, and
141
- * mark the graph incomplete (A4, C8).
142
- */
143
- export declare function resetFormulaDependencyIndexes(ctx: Context): void;
144
- /**
145
- * End of a full pass that started at `epoch` (C8): every formula in the chain
146
- * has recorded its dependencies, unless the graph was invalidated meanwhile.
147
- */
148
- export declare function finishFullFormulaPass(ctx: Context, epoch: number | null | undefined): void;
149
- /**
150
- * A tab that is loaded after the graph was completed keeps the flag on (K60,
151
- * PR 466): loading builds the grid from `celldata` and does not change the
152
- * tab's structure, and the text index already treated a whole-row or column
153
- * reference to a tab with no grid as wide. Without a recorded size the first
154
- * commit on the tab would take the full pass and clear the flag.
155
- */
156
- export declare function recordLoadedSheetSize(ctx: Context, sheetId: string | undefined, data: CellMatrix | null | undefined): void;
157
- /**
158
- * INDIRECT and OFFSET would resolve references at run time, which the graph
159
- * cannot see. Today both evaluate to an error (formulajs implements neither),
160
- * but formulas using them are kept on every commit's run list regardless.
161
- */
162
- export declare const RUNTIME_REFERENCE_RE: RegExp;
163
86
  export declare function execfunction(ctx: Context, txt: string, r: number, c: number, id?: string, calcChainSet?: Set<string>, isrefresh?: boolean, notInsertFunc?: boolean): any[];
164
87
  export declare function groupValuesRefresh(ctx: Context): void;
165
- export declare function mergeFormulaDeps(ctx: Context, originKey: string, deps: Iterable<string>): void;
166
88
  /** Apply worker chunk output onto the live context (main thread only). */
167
89
  export declare function applyWorkerFormulaChunkResults(ctx: Context, output: SnapshotEvalOutput, impactedByCircular: Set<string>, cycleNodes: Set<string>, calcChainKeys?: string[], data?: CellMatrix | null): void;
168
90
  /** Run up to `chunkSize` formulas from an async job. Returns true when job is complete. */
@@ -180,6 +102,14 @@ export declare function execFunctionGroup(ctx: Context, origin_r: number, origin
180
102
  * without resizing `luckysheet_select_save`.
181
103
  */
182
104
  export declare function seedFormulaFuncSelectedRangeFromLastSelection(ctx: Context): boolean;
105
+ /**
106
+ * Explicit reference selection (F2) with the caret on an existing reference:
107
+ * seed the keyboard range from *that reference*, so the first arrow moves it
108
+ * from where it is (`=SUM(A1|)` + Right -> `=SUM(B1)`), not from the edited
109
+ * cell. Replaces any stale `func_selectedrange`. Returns false when the caret
110
+ * is not on a complete reference on the visible sheet.
111
+ */
112
+ export declare function seedFormulaFuncSelectedRangeFromTouchedReference(ctx: Context): boolean;
183
113
  export declare function createFormulaRangeSelect(ctx: Context, select: {
184
114
  rangeIndex: number;
185
115
  } & Rect): void;
@@ -228,7 +158,7 @@ export declare function isBareCellOrRangeOnlyFormula(formulaText: string): boole
228
158
  * disable sheet-driven range selection until the caret reaches a fresh insertion slot
229
159
  * (comma, open paren, operator, etc.) or the user starts an active range drag.
230
160
  */
231
- export declare function suppressFormulaRangeSelectionForInitialEdit(ctx: Context): void;
161
+ export declare function suppressFormulaRangeSelectionForInitialEdit(ctx: Context, cell?: [number, number]): void;
232
162
  export declare function isCaretAtValidFormulaRangeInsertionPoint(editor: HTMLElement | null): boolean;
233
163
  export declare function markRangeSelectionDirty(ctx: Context): void;
234
164
  /**
@@ -240,16 +170,31 @@ export declare function markRangeSelectionDirty(ctx: Context): void;
240
170
  export declare function getFormulaRangeIndexForKeyboardSync($editor: HTMLDivElement): number | null;
241
171
  export declare function handleFormulaInput(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement, kcode: number, preText?: string, refreshRangeSelect?: boolean): void;
242
172
  export declare function toggleFormulaAbsoluteReferenceAtCaret(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement | null | undefined): boolean;
243
- export type FormulaTabs = {
244
- editedTab: string;
245
- formulaTab: string;
246
- };
247
173
  /** True while picking a range for a formula (sheet selection drives references). */
248
174
  export declare function isLegacyFormulaRangeMode(ctx: Context): boolean;
249
175
  export declare function israngeseleciton(ctx: Context, istooltip?: boolean): boolean;
176
+ /**
177
+ * Start (or end) an arrow-key session with the defaults: automatic reference
178
+ * selection on, no F2 override. Call when a session opens on a cell that does
179
+ * not hold a formula, and when one ends.
180
+ */
181
+ export declare function resetFormulaArrowSession(ctx: Context): void;
182
+ /** The F2 override / auto flag in effect for the cell being edited right now. */
183
+ export declare function getFormulaArrowSession(ctx: Context): {
184
+ override: FormulaArrowOverride;
185
+ autoAllowed: boolean;
186
+ };
187
+ /** F2 pressed while editing: store the new override for this cell's session. */
188
+ export declare function setFormulaArrowOverride(ctx: Context, override: FormulaArrowOverride): void;
189
+ /**
190
+ * Single source of truth for what an arrow key does while editing.
191
+ * Thin ctx/DOM adapter over the pure `resolveArrowMode`.
192
+ */
193
+ export declare function getFormulaArrowMode(ctx: Context): FormulaArrowMode;
194
+ /** True while arrows should drive a cell reference (READY or ACTIVE). */
250
195
  export declare function isFormulaReferenceInputMode(ctx: Context): boolean;
251
196
  export declare function maybeRecoverDirtyRangeSelection(ctx: Context): boolean;
252
- export declare function functionStrChange(txt: string, type: string, rc: 'row' | 'col', orient: string | null, stindex: number, step: number, tabs: FormulaTabs): string;
197
+ export declare function functionStrChange(txt: string, type: string, rc: 'row' | 'col', orient: string | null, stindex: number, step: number): string;
253
198
  export declare function rangeSetValue(ctx: Context, cellInput: HTMLDivElement, selected: any, fxInput?: HTMLDivElement | null): void;
254
199
  export declare function onFormulaRangeDragEnd(ctx: Context): void;
255
200
  export declare function rangeDrag(ctx: Context, e: MouseEvent, cellInput: HTMLDivElement, scrollLeft: number, scrollTop: number, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
@@ -4,7 +4,7 @@ export { default as clipboard } from './clipboard';
4
4
  export { moveToEnd, getRangeRectsByCharacterOffset } from './cursor';
5
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
- 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';
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, resetFormulaArrowSession, 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';
9
9
  export type { FormulaAsyncEvalJob } from './formula-async-eval';
10
10
  export { initFreeze } from './freeze';
@@ -33,17 +33,16 @@ export { cfSplitRange } from './conditionalFormat';
33
33
  export { CFSplitRange } from './ConditionFormat';
34
34
  export { updateMoreCell, getRegStr, getDataArr } from './splitColumn';
35
35
  export { applyLocation, getOptionValue, getSelectRange, } from './locationCondition';
36
- export { getDropdownList, setDropdownValue, confirmMessage, cellFocus, validateCellData, splitDropdownOptions, getDropdownOptions, } from './dataVerification';
36
+ export { getDropdownList, setDropdownValue, confirmMessage, cellFocus, validateCellData, } from './dataVerification';
37
37
  export { setConditionRules, CF_DATE_DEFAULT_FORMAT, parseCfDateConditionForUi, formatCfDatePresetSnapshot, parseDdMmYyyyToSerial, } from './ConditionFormat';
38
38
  export { handleOverlayTouchStart, handleOverlayTouchEnd } from './mobile';
39
39
  export { MAX_ZOOM_RATIO, MIN_ZOOM_RATIO } from './zoom';
40
40
  export { jfrefreshgrid } from './refresh';
41
- export { deleteCellsShift, insertCellsShift } from './cell-shift';
42
41
  export { sanitizeDuneUrl, insertDuneChart, onIframeMoveStart, onIframeResizeStart, onIframeMove, onIframeMoveEnd, onIframeResize, onIframeResizeEnd, } from './iframe';
43
42
  export { setCellError, clearCellError, overShowError, } from './error-state-helpers';
44
43
  export { checkCellIsLocked } from './protection';
45
44
  export { detectDateFormat, isdatatypemulti, diff, isdatetime, isRealNull, isRealNum, isNumericCellType, } from './validation';
46
- export { iscelldata, getcellrange, execfunction, execFunctionGroup, refreshFormulasUsingDefinedNames, runFormulaEvalChunk, applyWorkerFormulaChunkResults, finishFullFormulaPass, resetFormulaDependencyIndexes, insertUpdateFunctionGroup, functionCopy, } from './formula';
45
+ export { iscelldata, getcellrange, execfunction, execFunctionGroup, refreshFormulasUsingDefinedNames, runFormulaEvalChunk, applyWorkerFormulaChunkResults, insertUpdateFunctionGroup, functionCopy, } from './formula';
47
46
  export { checkCF, getComputeMap } from './ConditionFormat';
48
47
  export { isValidDefinedNameIdentifier, getDefinedNameDisplayRange, findDefinedNameForSelection, findDefinedNameByName, resolveDefinedNameForFormula, addDefinedName, updateDefinedName, deleteDefinedName, selectDefinedName, openNamedRangesSidebar, scheduleDefinedNamesSync, shiftDefinedNamesOnInsert, shiftDefinedNamesOnDelete, removeDefinedNamesForSheet, } from './namedRanges';
49
48
  export { getdatabyselection, getQKBorder } from './cell';
@@ -1,13 +1,5 @@
1
1
  import { Context } from '../context';
2
- import { Sheet } from '../types';
3
2
 
4
- /**
5
- * True when the edit would change a cross-tab formula in the tab's celldata.
6
- * It is the test the rewrite below applies, so the tabs loaded before an edit
7
- * are the ones it would rewrite (PR 466 N1: `=C1-A!B5` names tab A, but the
8
- * sheet-name regex reads `C1-A`).
9
- */
10
- export declare const celldataFormulaWouldChange: (sheet: Sheet, mode: "add" | "del", rc: "row" | "col", orient: "lefttop" | "rightbottom" | null, stindex: number, step: number, editedTab: string) => boolean;
11
3
  /**
12
4
  * 增加行列
13
5
  * @param {string} type 行或列 ['row', 'column'] 之一
@@ -1,18 +1,5 @@
1
1
  import { Context } from '../context';
2
2
 
3
- type Measure2d = {
4
- measureText(t: string): {
5
- width: number;
6
- };
7
- font: string;
8
- };
9
- /** Drop cached widths, e.g. after web fonts load and change the metrics. */
10
- export declare function clearSingleLineCache(): void;
11
- /**
12
- * Width of one line of text in `font`, from canvas measureText, cached by
13
- * (font, text). No DOM layout is involved.
14
- */
15
- export declare function measureSingleLine(font: string, text: string, ctx2d: Measure2d): number;
16
3
  export declare function calculateRangeCellSize(ctx: Context, sheetId: string, startRow: number, endRow: number, startCol: number, endCol: number, maxColumnWidth?: number): {
17
4
  rowMax: Record<number, number>;
18
5
  colMax: Record<number, number>;
@@ -22,4 +9,3 @@ export declare const updateSheetCellSizes: (ctx: Context, sheetIndex: number, me
22
9
  rowMax: Record<number, number>;
23
10
  colMax: Record<number, number>;
24
11
  }, maxColumnWidth?: number) => void;
25
- export {};
@@ -29,17 +29,7 @@ export type Hooks = {
29
29
  beforeUpdateCell?: (r: number, c: number, value: any) => boolean;
30
30
  /** Clears RTC remote-apply lock so local edits can run data-block formulas. */
31
31
  onLocalCellEdit?: () => void;
32
- afterUpdateCell?: (row: number, column: number, oldValue: any, newValue: any,
33
- /** Sheet that held the cell when it was committed (updateCell only). */
34
- sheetId?: string,
35
- /**
36
- * `skipPersist`: the caller writes this cell to Yjs in its own batch (paste
37
- * and fill), after the cell is final. Persisting here too wrote the
38
- * pre-format value first, so every formula was written twice.
39
- */
40
- options?: {
41
- skipPersist?: boolean;
42
- }) => void;
32
+ afterUpdateCell?: (row: number, column: number, oldValue: any, newValue: any) => void;
43
33
  afterSelectionChange?: (sheetId: string, selection: Selection) => void;
44
34
  beforeRenderRowHeaderCell?: (rowNumber: string, rowIndex: number, top: number, width: number, height: number, ctx: CanvasRenderingContext2D) => boolean;
45
35
  afterRenderRowHeaderCell?: (rowNumber: string, rowIndex: number, top: number, width: number, height: number, ctx: CanvasRenderingContext2D) => void;
@@ -1,17 +1,6 @@
1
1
  import { Context } from '../context';
2
2
  import { Cell, CellWithRowAndCol } from '../types';
3
3
 
4
- /** Receives changes instead of the updateCellYdoc hook (see createYdocBatch). */
5
- export type YdocChangeSink = (changes: any[]) => void;
6
- /**
7
- * Collect the Yjs changes of one structural edit and send them in a single
8
- * updateCellYdoc call, so the edit is one transaction and one update for peers
9
- * (an insert used to send four and a delete five).
10
- */
11
- export declare function createYdocBatch(ctx: Context): {
12
- sink: YdocChangeSink;
13
- flush: () => void;
14
- };
15
4
  export type CelldataYdocChange = {
16
5
  sheetId: string;
17
6
  path: string[];
@@ -28,29 +17,13 @@ export declare function cellsEqualForYdocPersist(before: unknown, after: unknown
28
17
  export declare function snapshotPersistedCelldataInRange(data: unknown[][] | null | undefined, r1: number, r2: number, c1: number, c2: number, celldata?: CellWithRowAndCol[] | null): Map<string, Cell | string | number | boolean>;
29
18
  export declare function appendCelldataDiffChange(changes: CelldataYdocChange[], sheetId: string, r: number, c: number, cell: unknown, beforePersisted?: Map<string, Cell | string | number | boolean>): void;
30
19
  export declare function buildCelldataChangesForRange(sheetId: string, data: unknown[][], r1: number, r2: number, c1: number, c2: number, beforePersisted?: Map<string, Cell | string | number | boolean>): CelldataYdocChange[];
31
- export declare function emitCelldataRangeDiffToYdoc(ctx: Context, sheetId: string, data: unknown[][], r1: number, r2: number, c1: number, c2: number, beforePersisted?: Map<string, Cell | string | number | boolean>, sink?: YdocChangeSink): void;
32
- /** Formula text per tab and cell key, taken before a structural edit rewrites it. */
33
- export type FormulaTextSnapshot = Map<string, Map<string, string>>;
34
- /**
35
- * Snapshot formula text on every hydrated tab. A row/column insert or delete
36
- * rewrites formulas on all tabs, but only the edited tab's shifted range is
37
- * diffed to Yjs, so the rest has to be found by comparing against this.
38
- */
39
- export declare function snapshotFormulaTexts(ctx: Context): FormulaTextSnapshot;
40
- /**
41
- * Emit cells whose formula text changed since `before`, so peers see the
42
- * rewrite. On the edited tab, cells at or past (`editedFromR`, `editedFromC`)
43
- * are skipped: the range diff already writes them. `before` keys are
44
- * pre-edit coordinates, which equal post-edit ones for every cell outside
45
- * that range.
46
- */
47
- export declare function emitRewrittenFormulasToYdoc(ctx: Context, before: FormulaTextSnapshot, editedSheetId: string, editedFromR: number, editedFromC: number, sink?: YdocChangeSink): void;
20
+ export declare function emitCelldataRangeDiffToYdoc(ctx: Context, sheetId: string, data: unknown[][], r1: number, r2: number, c1: number, c2: number, beforePersisted?: Map<string, Cell | string | number | boolean>): void;
48
21
  /**
49
22
  * After delete row/col, emit deletes for persisted keys that now sit past the
50
23
  * shrunken grid. Range diffs only visit coordinates still inside `data`, so
51
24
  * tail keys would otherwise resurrect on peers/reload.
52
25
  */
53
- export declare function emitCelldataDeletesBeyondGrid(ctx: Context, sheetId: string, beforePersisted: Map<string, Cell | string | number | boolean> | undefined, rowCount: number, colCount: number, sink?: YdocChangeSink): void;
26
+ export declare function emitCelldataDeletesBeyondGrid(ctx: Context, sheetId: string, beforePersisted: Map<string, Cell | string | number | boolean> | undefined, rowCount: number, colCount: number): void;
54
27
  export type MergeBounds = {
55
28
  minR: number;
56
29
  minC: number;
@@ -1,4 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
 
3
- declare const _default: React.NamedExoticComponent<{}>;
4
- export default _default;
3
+ declare const FilterMenu: React.FC;
4
+ export default FilterMenu;
@@ -1,4 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
 
3
- declare const _default: React.NamedExoticComponent<{}>;
4
- export default _default;
3
+ declare const SheetTabContextMenu: React.FC;
4
+ export default SheetTabContextMenu;
@@ -1,4 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
 
3
- declare const _default: React.NamedExoticComponent<{}>;
4
- export default _default;
3
+ declare const ContextMenu: React.FC;
4
+ export default ContextMenu;
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
 
3
- declare const _default: React.NamedExoticComponent<{
3
+ declare const SVGDefines: React.FC<{
4
4
  currency: string;
5
5
  }>;
6
- export default _default;
6
+ export default SVGDefines;
@@ -1,4 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
 
3
- declare const _default: React.NamedExoticComponent<{}>;
4
- export default _default;
3
+ declare const SheetTab: React.FC;
4
+ export default SheetTab;
@@ -7,11 +7,11 @@ export declare const CurrencySelector: ({ cell, defaultTextFormat, toolTipText,
7
7
  defaultTextFormat: string;
8
8
  toolTipText: string;
9
9
  }) => import("react/jsx-runtime").JSX.Element;
10
- declare const _default: React.NamedExoticComponent<{
10
+ declare const Toolbar: React.FC<{
11
11
  setMoreItems: React.Dispatch<React.SetStateAction<React.ReactNode>>;
12
12
  moreItemsOpen: boolean;
13
13
  onMoreToolbarItemsClose?: () => void;
14
14
  moreToolbarItems?: React.ReactNode;
15
15
  trailingContent?: React.ReactNode;
16
16
  }>;
17
- export default _default;
17
+ export default Toolbar;
@@ -31,10 +31,6 @@ export declare function generateAPIs(context: Context, setContext: (recipe: (ctx
31
31
  applyRemoteCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
32
32
  type?: keyof Cell;
33
33
  }) => void;
34
- /** Remote formula-list change, applied in place (A4). */
35
- setSheetCalcChain: (calcChain: Sheet["calcChain"], options?: api.CommonOptions) => void;
36
- /** Remote cell batch: one quiet update, off the local undo stack (A5). */
37
- applyRemoteCells: (cells: api.RemoteCellChange[], options?: api.CommonOptions, onSkip?: (cell: api.RemoteCellChange, error: unknown) => void) => void;
38
34
  setCellError: (row: number, column: number, errorMessage: {
39
35
  title: string;
40
36
  message: string;
@@ -33,8 +33,6 @@ declare const Workbook: React.ForwardRefExoticComponent<Settings & AdditionalPro
33
33
  applyRemoteCellValue: (row: number, column: number, value: any, options?: api.CommonOptions & {
34
34
  type?: keyof import('../../../core').Cell;
35
35
  }) => void;
36
- setSheetCalcChain: (calcChain: SheetType["calcChain"], options?: api.CommonOptions) => void;
37
- applyRemoteCells: (cells: api.RemoteCellChange[], options?: api.CommonOptions, onSkip?: (cell: api.RemoteCellChange, error: unknown) => void) => void;
38
36
  setCellError: (row: number, column: number, errorMessage: {
39
37
  title: string;
40
38
  message: string;
@@ -1,6 +1,5 @@
1
1
  import { default as React } from 'react';
2
2
  import { Context, Settings, GlobalCache, PatchOptions } from '../../core';
3
- import { WorkbookStore } from './workbook-store';
4
3
 
5
4
  export type RefValues = {
6
5
  globalCache: GlobalCache;
@@ -24,18 +23,4 @@ declare const WorkbookContext: React.Context<{
24
23
  handleUndo: () => void;
25
24
  handleRedo: () => void;
26
25
  }>;
27
- /**
28
- * The parts of the workbook that rarely change (setters, settings, refs) plus
29
- * the store holding the latest context. Components that must not render on
30
- * every update read this instead of `WorkbookContext` (E2).
31
- */
32
- export type WorkbookStable = {
33
- store: WorkbookStore<Context>;
34
- setContext: (recipe: (ctx: Context) => void, options?: SetContextOptions) => void;
35
- settings: Required<Settings>;
36
- refs: RefValues;
37
- handleUndo: () => void;
38
- handleRedo: () => void;
39
- };
40
- export declare const WorkbookStableContext: React.Context<WorkbookStable>;
41
26
  export default WorkbookContext;