@fileverse-dev/dsheet 4.1.23 → 4.1.24-stabilise-package-2
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.
- package/README.md +10 -0
- package/dist/editor/components/skeleton-loader.d.ts +2 -1
- package/dist/editor/contexts/editor-context.d.ts +10 -0
- package/dist/editor/hooks/use-celldata-compaction.d.ts +44 -2
- package/dist/editor/hooks/use-celldata-compaction.test.d.ts +1 -0
- package/dist/editor/hooks/use-editor-data.d.ts +1 -0
- package/dist/editor/hooks/use-editor-sync.d.ts +5 -1
- package/dist/editor/hooks/use-editor-sync.test.d.ts +1 -0
- package/dist/editor/types.d.ts +44 -1
- package/dist/editor/utils/active-sheet-keeper.test.d.ts +1 -0
- package/dist/editor/utils/after-update-cell.d.ts +6 -0
- package/dist/editor/utils/after-update-cell.test.d.ts +1 -0
- package/dist/editor/utils/apply-comment-markers.d.ts +3 -1
- package/dist/editor/utils/apply-comment-markers.test.d.ts +1 -0
- package/dist/editor/utils/calc-chain-ydoc-update.test.d.ts +1 -0
- package/dist/editor/utils/content-change.d.ts +48 -0
- package/dist/editor/utils/content-change.test.d.ts +1 -0
- package/dist/editor/utils/content-fingerprint.d.ts +37 -0
- package/dist/editor/utils/content-fingerprint.test.d.ts +1 -0
- package/dist/editor/utils/editor-handle.d.ts +1 -1
- package/dist/editor/utils/format-gate.d.ts +27 -0
- package/dist/editor/utils/format-gate.test.d.ts +1 -0
- package/dist/editor/utils/legacy-on-change.d.ts +20 -0
- package/dist/editor/utils/legacy-on-change.test.d.ts +1 -0
- package/dist/editor/utils/patch-plain-celldata.d.ts +19 -0
- package/dist/editor/utils/patch-plain-celldata.test.d.ts +1 -0
- package/dist/editor/utils/rebuild-indexeddb-store.d.ts +19 -0
- package/dist/editor/utils/rebuild-indexeddb-store.failure.test.d.ts +1 -0
- package/dist/editor/utils/rebuild-indexeddb-store.test.d.ts +1 -0
- package/dist/editor/utils/remote-apply-guard.d.ts +45 -0
- package/dist/editor/utils/remote-apply-guard.test.d.ts +1 -0
- package/dist/editor/utils/sheet-ydoc-sync-utils.d.ts +13 -4
- package/dist/editor/utils/sheet-ydoc-sync-utils.test.d.ts +1 -0
- package/dist/editor/utils/structural-edit-formula-sync.test.d.ts +1 -0
- package/dist/editor/utils/structural-edit-other-tabs.test.d.ts +1 -0
- package/dist/editor/utils/update-ydoc.d.ts +9 -1
- package/dist/editor/utils/wait-for-sync.d.ts +35 -0
- package/dist/editor/utils/wait-for-sync.test.d.ts +1 -0
- package/dist/editor/utils/xlsx-export-impl.d.ts +1 -0
- package/dist/editor/utils/xlsx-export.d.ts +1 -0
- package/dist/{executeStringFunction-ZHYCWIpK.js → executeStringFunction--gHt0G5o.js} +13725 -12781
- package/dist/formula.js +1 -1
- package/dist/{index-8_qnUyMl.js → index-DTkdULNT.js} +23239 -21905
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +44 -43
- package/dist/persistence-utils-CSKBobX8.js +151 -0
- package/dist/persistence-utils.d.ts +2 -0
- package/dist/persistence.append.test.d.ts +1 -0
- package/dist/persistence.d.ts +13 -0
- package/dist/persistence.fingerprint.test.d.ts +1 -0
- package/dist/persistence.js +122 -74
- package/dist/sheet-engine/core/api/cell.d.ts +25 -1
- package/dist/sheet-engine/core/api/remote-apply.test.d.ts +1 -0
- package/dist/sheet-engine/core/api/sheet-flowdata-lifecycle.d.ts +1 -0
- package/dist/sheet-engine/core/api/sheet-flowdata-lifecycle.test.d.ts +1 -0
- package/dist/sheet-engine/core/index.d.ts +1 -1
- package/dist/sheet-engine/core/modules/b6-ydoc-writes.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/border.d.ts +9 -0
- package/dist/sheet-engine/core/modules/cell-shift-dep-graph.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/cell-shift.d.ts +11 -0
- package/dist/sheet-engine/core/modules/cell.commit-ydoc.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/dataVerification.d.ts +15 -0
- package/dist/sheet-engine/core/modules/engine-hot-spots.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula-arrow-mode.d.ts +81 -0
- package/dist/sheet-engine/core/modules/formula-arrow-mode.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula-async-eval.d.ts +5 -0
- package/dist/sheet-engine/core/modules/formula-dep-text.d.ts +23 -0
- package/dist/sheet-engine/core/modules/formula-dep-text.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula-edge-update.d.ts +13 -0
- package/dist/sheet-engine/core/modules/formula-narrowing.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula-snapshot-eval.d.ts +2 -0
- package/dist/sheet-engine/core/modules/formula-tab-load.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula-transitive-deps.d.ts +26 -1
- package/dist/sheet-engine/core/modules/formula-warmup.d.ts +33 -0
- package/dist/sheet-engine/core/modules/formula-warmup.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula.d.ts +119 -2
- package/dist/sheet-engine/core/modules/formula.dep-graph.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula.str-change.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/formula.wide-seed.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/history-calc-chain.d.ts +39 -0
- package/dist/sheet-engine/core/modules/history-calc-chain.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/history-celldata.d.ts +25 -0
- package/dist/sheet-engine/core/modules/history-grid-size.d.ts +16 -0
- package/dist/sheet-engine/core/modules/history-grid-size.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/index.d.ts +4 -3
- package/dist/sheet-engine/core/modules/rowcol-dep-graph.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/rowcol-refused-edit.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/rowcol-unloaded-history.test.d.ts +1 -0
- package/dist/sheet-engine/core/modules/rowcol.d.ts +8 -0
- package/dist/sheet-engine/core/modules/structural-edit-prep.d.ts +36 -0
- package/dist/sheet-engine/core/modules/structural-edit-prep.test.d.ts +1 -0
- package/dist/sheet-engine/core/paste/paste-dep-graph.test.d.ts +1 -0
- package/dist/sheet-engine/core/paste-helpers/calculate-range-cell-size.d.ts +14 -0
- package/dist/sheet-engine/core/paste-helpers/calculate-range-cell-size.test.d.ts +1 -0
- package/dist/sheet-engine/core/settings.d.ts +11 -1
- package/dist/sheet-engine/core/utils/ydoc-celldata-changes.d.ts +29 -2
- package/dist/sheet-engine/react/components/ContextMenu/FilterMenu.d.ts +2 -2
- package/dist/sheet-engine/react/components/ContextMenu/SheetTab.d.ts +2 -2
- package/dist/sheet-engine/react/components/ContextMenu/index.d.ts +2 -2
- package/dist/sheet-engine/react/components/NotationBoxes/shown-comments.d.ts +20 -0
- package/dist/sheet-engine/react/components/NotationBoxes/shown-comments.test.d.ts +1 -0
- package/dist/sheet-engine/react/components/SVGDefines.d.ts +2 -2
- package/dist/sheet-engine/react/components/SheetOverlay/editing-as-formula.d.ts +7 -0
- package/dist/sheet-engine/react/components/SheetOverlay/editing-as-formula.test.d.ts +1 -0
- package/dist/sheet-engine/react/components/SheetOverlay/hover-tracker.d.ts +44 -0
- package/dist/sheet-engine/react/components/SheetOverlay/hover-tracker.test.d.ts +1 -0
- package/dist/sheet-engine/react/components/SheetTab/index.d.ts +2 -2
- package/dist/sheet-engine/react/components/Toolbar/FunctionList/group-functions.d.ts +9 -0
- package/dist/sheet-engine/react/components/Toolbar/FunctionList/group-functions.test.d.ts +1 -0
- package/dist/sheet-engine/react/components/Toolbar/index.d.ts +2 -2
- package/dist/sheet-engine/react/components/Workbook/api.d.ts +4 -0
- package/dist/sheet-engine/react/components/Workbook/denomination-scan.d.ts +16 -0
- package/dist/sheet-engine/react/components/Workbook/denomination-scan.test.d.ts +1 -0
- package/dist/sheet-engine/react/components/Workbook/index.d.ts +2 -0
- package/dist/sheet-engine/react/components/Workbook/stable-handle.d.ts +8 -0
- package/dist/sheet-engine/react/components/Workbook/stable-handle.test.d.ts +1 -0
- package/dist/sheet-engine/react/context/index.d.ts +15 -0
- package/dist/sheet-engine/react/context/use-workbook-store.d.ts +30 -0
- package/dist/sheet-engine/react/context/workbook-store.d.ts +30 -0
- package/dist/sheet-engine/react/context/workbook-store.test.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/sync-local/SyncManager.d.ts +2 -2
- package/dist/sync-local/SyncManager.remote-apply.test.d.ts +1 -0
- package/dist/sync-local/SyncManager.test.d.ts +1 -0
- package/dist/sync-local/socketClient.d.ts +2 -0
- package/dist/sync-local/socketClient.test.d.ts +1 -0
- package/dist/sync-local/types/index.d.ts +5 -1
- package/dist/{use-xlsx-import-impl-cgDH14_y.js → use-xlsx-import-impl-DhCtyQw6.js} +120 -119
- package/dist/{xlsx-defined-names-DCK7aKIO.js → xlsx-defined-names-COueA4FW.js} +2 -2
- package/dist/xlsx-export-impl-lfDXFnFW.js +903 -0
- package/dist/{xlsx-hyperlink-inline-T4GsXFm7.js → xlsx-hyperlink-inline-Dyo_PyAb.js} +2 -2
- package/package.json +1 -1
- package/dist/persistence-utils-BXFajzvq.js +0 -98
- package/dist/xlsx-export-impl-BHDWz0aW.js +0 -880
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { Context } from '../context';
|
|
2
|
+
import { Sheet } from '../types';
|
|
2
3
|
|
|
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;
|
|
3
11
|
/**
|
|
4
12
|
* 增加行列
|
|
5
13
|
* @param {string} type 行或列 ['row', 'column'] 之一
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Context } from '../context';
|
|
2
|
+
|
|
3
|
+
export type StructuralEditOp = {
|
|
4
|
+
insertRowColOp?: {
|
|
5
|
+
type: 'row' | 'column';
|
|
6
|
+
id: string;
|
|
7
|
+
index: number;
|
|
8
|
+
count: number;
|
|
9
|
+
direction: 'lefttop' | 'rightbottom';
|
|
10
|
+
};
|
|
11
|
+
deleteRowColOp?: {
|
|
12
|
+
type: 'row' | 'column';
|
|
13
|
+
id: string;
|
|
14
|
+
start: number;
|
|
15
|
+
end: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Indexes of the tabs that are not loaded (no dense `data`) and that the edit
|
|
20
|
+
* rewrites (K6). A tab counts when the rewrite itself would change one of its
|
|
21
|
+
* formulas, or when one names the edited tab. The first is the test the
|
|
22
|
+
* rewrite uses, so the two cannot disagree: the sheet-name regex reads
|
|
23
|
+
* `=C1-A!B5` as a tab called `C1-A` and finds no tab A (PR 466 N1).
|
|
24
|
+
*/
|
|
25
|
+
export declare function unloadedTabsRewrittenBy(ctx: Context, op: StructuralEditOp): number[];
|
|
26
|
+
/**
|
|
27
|
+
* Load the tabs a structural edit will rewrite, before the edit and outside
|
|
28
|
+
* the change that history records (PR 466 N1, second review). The rewrite is
|
|
29
|
+
* then recorded as cell patches on `data`, which undo and redo replay for just
|
|
30
|
+
* the cells it touched: a peer's edits to the same tab are left alone, and the
|
|
31
|
+
* tab can be loaded or unloaded again at undo time (`handleUndo` loads it for
|
|
32
|
+
* `data` patches).
|
|
33
|
+
*
|
|
34
|
+
* Returns the same state object when nothing needs loading.
|
|
35
|
+
*/
|
|
36
|
+
export declare function loadTabsReadingSheet(ctx: Context, op: StructuralEditOp): Context;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,18 @@
|
|
|
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;
|
|
3
16
|
export declare function calculateRangeCellSize(ctx: Context, sheetId: string, startRow: number, endRow: number, startCol: number, endCol: number, maxColumnWidth?: number): {
|
|
4
17
|
rowMax: Record<number, number>;
|
|
5
18
|
colMax: Record<number, number>;
|
|
@@ -9,3 +22,4 @@ export declare const updateSheetCellSizes: (ctx: Context, sheetIndex: number, me
|
|
|
9
22
|
rowMax: Record<number, number>;
|
|
10
23
|
colMax: Record<number, number>;
|
|
11
24
|
}, maxColumnWidth?: number) => void;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -29,7 +29,17 @@ 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
|
|
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;
|
|
33
43
|
afterSelectionChange?: (sheetId: string, selection: Selection) => void;
|
|
34
44
|
beforeRenderRowHeaderCell?: (rowNumber: string, rowIndex: number, top: number, width: number, height: number, ctx: CanvasRenderingContext2D) => boolean;
|
|
35
45
|
afterRenderRowHeaderCell?: (rowNumber: string, rowIndex: number, top: number, width: number, height: number, ctx: CanvasRenderingContext2D) => void;
|
|
@@ -1,6 +1,17 @@
|
|
|
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
|
+
};
|
|
4
15
|
export type CelldataYdocChange = {
|
|
5
16
|
sheetId: string;
|
|
6
17
|
path: string[];
|
|
@@ -17,13 +28,29 @@ export declare function cellsEqualForYdocPersist(before: unknown, after: unknown
|
|
|
17
28
|
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>;
|
|
18
29
|
export declare function appendCelldataDiffChange(changes: CelldataYdocChange[], sheetId: string, r: number, c: number, cell: unknown, beforePersisted?: Map<string, Cell | string | number | boolean>): void;
|
|
19
30
|
export declare function buildCelldataChangesForRange(sheetId: string, data: unknown[][], r1: number, r2: number, c1: number, c2: number, beforePersisted?: Map<string, Cell | string | number | boolean>): CelldataYdocChange[];
|
|
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
|
|
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;
|
|
21
48
|
/**
|
|
22
49
|
* After delete row/col, emit deletes for persisted keys that now sit past the
|
|
23
50
|
* shrunken grid. Range diffs only visit coordinates still inside `data`, so
|
|
24
51
|
* tail keys would otherwise resurrect on peers/reload.
|
|
25
52
|
*/
|
|
26
|
-
export declare function emitCelldataDeletesBeyondGrid(ctx: Context, sheetId: string, beforePersisted: Map<string, Cell | string | number | boolean> | undefined, rowCount: number, colCount: number): void;
|
|
53
|
+
export declare function emitCelldataDeletesBeyondGrid(ctx: Context, sheetId: string, beforePersisted: Map<string, Cell | string | number | boolean> | undefined, rowCount: number, colCount: number, sink?: YdocChangeSink): void;
|
|
27
54
|
export type MergeBounds = {
|
|
28
55
|
minR: number;
|
|
29
56
|
minC: number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Cell } from '../../../core/types';
|
|
2
|
+
|
|
3
|
+
export type ShownCommentCell = {
|
|
4
|
+
r: number;
|
|
5
|
+
c: number;
|
|
6
|
+
/** Position, size and text of the pinned box (see `shownCommentsKey`). */
|
|
7
|
+
sig: string;
|
|
8
|
+
};
|
|
9
|
+
/** Cells whose comment popup is pinned open (`ps.isShow`), in row-major order. */
|
|
10
|
+
export declare function collectShownCommentCells(data: (Cell | null)[][]): ShownCommentCell[];
|
|
11
|
+
/**
|
|
12
|
+
* Identity of a shown-comment set. NotationBoxes applies `showComments` only
|
|
13
|
+
* when this changes, so an edit that leaves the set alone costs no second
|
|
14
|
+
* context update. The sheet id is part of the key so that switching to a sheet
|
|
15
|
+
* with an equal (for example empty) set still replaces the previous sheet's
|
|
16
|
+
* boxes. Moving or resizing a pinned box, or a peer editing its text, writes
|
|
17
|
+
* `ps` but not `commentBoxes`, so each shown cell's `ps` position, size and
|
|
18
|
+
* text are part of the key too.
|
|
19
|
+
*/
|
|
20
|
+
export declare function shownCommentsKey(sheetId: string | undefined, cells: ShownCommentCell[]): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True while a cell is being edited and either input holds a formula. The
|
|
3
|
+
* inputs' `innerText` is read only when `editing` is true (a read forces
|
|
4
|
+
* layout), and the formula bar is read only when the cell input did not
|
|
5
|
+
* already say yes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isEditingAsFormula(editing: boolean, readCellInputText: () => string | undefined, readFxInputText: () => string | undefined): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Context, GlobalCache } from '../../../core';
|
|
2
|
+
|
|
3
|
+
export type HoverCell = {
|
|
4
|
+
row: number;
|
|
5
|
+
col: number;
|
|
6
|
+
} | null;
|
|
7
|
+
type Rect = {
|
|
8
|
+
left: number;
|
|
9
|
+
top: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
type HoverTrackerOptions = {
|
|
14
|
+
/** Position of the cell area; read at most once per animation frame. */
|
|
15
|
+
getRect: () => Rect | undefined;
|
|
16
|
+
/** Cell under a page position, or null outside the cell area. */
|
|
17
|
+
locate: (pageX: number, pageY: number, rect: Rect | undefined) => HoverCell;
|
|
18
|
+
/** True while a drag, resize or popup needs every mouse move. */
|
|
19
|
+
isInteracting: () => boolean;
|
|
20
|
+
requestFrame: (cb: () => void) => void;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Decides whether a mouse move needs the full `setContext` pass. A move that
|
|
24
|
+
* stays in the same cell, with nothing being dragged or hovered, changes
|
|
25
|
+
* nothing, so it is skipped (E1).
|
|
26
|
+
*/
|
|
27
|
+
export declare function createHoverTracker({ getRect, locate, isInteracting, requestFrame, }: HoverTrackerOptions): {
|
|
28
|
+
shouldProcess(e: {
|
|
29
|
+
pageX: number;
|
|
30
|
+
pageY: number;
|
|
31
|
+
}): boolean;
|
|
32
|
+
reset(): void;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* True when `handleOverlayMouseMove` or `overShowLinkCard` do something that
|
|
36
|
+
* depends on more than the hovered cell: a comment box, image, cell or dialog
|
|
37
|
+
* drag, a popup that must see the pointer leave it, or one of the drag states
|
|
38
|
+
* after which `handleOverlayMouseMove` runs `mouseRender` on every move
|
|
39
|
+
* (`luckysheet_scroll_status` is set by every drag start). Outside the grid
|
|
40
|
+
* every position maps to "no cell", so auto-scroll and the resize guide need
|
|
41
|
+
* each move.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isHoverInteractionActive(ctx: Context, globalCache: GlobalCache): boolean;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type FunctionLocaleItem = {
|
|
2
|
+
n?: string;
|
|
3
|
+
t?: number | string;
|
|
4
|
+
};
|
|
5
|
+
/** Groups the locale's function list by category for the function picker. */
|
|
6
|
+
export declare function groupFunctions(functionlist: FunctionLocaleItem[]): {
|
|
7
|
+
categories: ("Text" | "Date" | "Other" | "Logical" | "All" | "Array" | "Database" | "Engineering" | "Datablock" | "Financial" | "Lookup" | "Math" | "Operator" | "Parser" | "Statistical" | "Info")[];
|
|
8
|
+
getFunctions: (categoryKey: string) => string[];
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
|
10
|
+
declare const _default: React.NamedExoticComponent<{
|
|
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
|
|
17
|
+
export default _default;
|
|
@@ -31,6 +31,10 @@ 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;
|
|
34
38
|
setCellError: (row: number, column: number, errorMessage: {
|
|
35
39
|
title: string;
|
|
36
40
|
message: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Cell } from '../../../core/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* True when any displayed value (`m`) contains BTC, ETH or SOL. Walks the grid
|
|
5
|
+
* in place and returns at the first hit; no intermediate cell list is built.
|
|
6
|
+
*/
|
|
7
|
+
export declare function hasDenominatedCell(data: (Cell | null)[][]): boolean;
|
|
8
|
+
type BannerDoc = Pick<Document, 'getElementById' | 'getElementsByClassName'>;
|
|
9
|
+
/**
|
|
10
|
+
* Show or hide the crypto-denomination banner and move the scrollbar and
|
|
11
|
+
* add-row bar to match. A no-op when the host has not mounted the banner
|
|
12
|
+
* element; call again later (for example on selection change) to retry.
|
|
13
|
+
* Returns true when the banner element was found.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyDenominationBanner(denominated: boolean, doc?: BannerDoc): boolean;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -33,6 +33,8 @@ 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;
|
|
36
38
|
setCellError: (row: number, column: number, errorMessage: {
|
|
37
39
|
title: string;
|
|
38
40
|
message: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An object with the keys of `getLatest()` whose identity never changes. Each
|
|
3
|
+
* function member calls the function of the same name on the latest api, and
|
|
4
|
+
* each other member reads the latest value, so a host that keeps the handle
|
|
5
|
+
* across renders always sees current state (E3). The key set is taken from the
|
|
6
|
+
* first call and is expected to stay the same.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createStableHandle<T extends object>(getLatest: () => T): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Context, Settings, GlobalCache, PatchOptions } from '../../core';
|
|
3
|
+
import { WorkbookStore } from './workbook-store';
|
|
3
4
|
|
|
4
5
|
export type RefValues = {
|
|
5
6
|
globalCache: GlobalCache;
|
|
@@ -23,4 +24,18 @@ declare const WorkbookContext: React.Context<{
|
|
|
23
24
|
handleUndo: () => void;
|
|
24
25
|
handleRedo: () => void;
|
|
25
26
|
}>;
|
|
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>;
|
|
26
41
|
export default WorkbookContext;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Context } from '../../core';
|
|
2
|
+
|
|
3
|
+
export declare function useWorkbookSelector<S>(selector: (ctx: Context) => S, isEqual?: (a: S, b: S) => boolean): S;
|
|
4
|
+
/**
|
|
5
|
+
* Drop-in for `useContext(WorkbookContext)` in components that should not
|
|
6
|
+
* render on every context update: it returns the same shape, but the
|
|
7
|
+
* component renders again only when `equal` says the context changed in a way
|
|
8
|
+
* it cares about (or when its own props or state change). The returned
|
|
9
|
+
* `context` is always the latest one.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useWorkbookContextWhen(equal: (previous: Context, next: Context) => boolean): {
|
|
12
|
+
context: Context;
|
|
13
|
+
setContext: (recipe: (ctx: Context) => void, options?: import('./index').SetContextOptions) => void;
|
|
14
|
+
settings: Required<import('../../core').Settings>;
|
|
15
|
+
refs: import('./index').RefValues;
|
|
16
|
+
handleUndo: () => void;
|
|
17
|
+
handleRedo: () => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* `useContext(WorkbookContext)` for components that must not render when only
|
|
21
|
+
* the scroll position or the row and column offsets changed (E2).
|
|
22
|
+
*/
|
|
23
|
+
export declare function useWorkbookContextIgnoringScroll(): {
|
|
24
|
+
context: Context;
|
|
25
|
+
setContext: (recipe: (ctx: Context) => void, options?: import('./index').SetContextOptions) => void;
|
|
26
|
+
settings: Required<import('../../core').Settings>;
|
|
27
|
+
refs: import('./index').RefValues;
|
|
28
|
+
handleUndo: () => void;
|
|
29
|
+
handleRedo: () => void;
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type WorkbookStore<T> = {
|
|
2
|
+
getState: () => T;
|
|
3
|
+
setState: (next: T) => void;
|
|
4
|
+
subscribe: (listener: () => void) => () => void;
|
|
5
|
+
};
|
|
6
|
+
/** A one-value store; Workbook sets the latest context after every commit (E2). */
|
|
7
|
+
export declare function createWorkbookStore<T>(initial: T): WorkbookStore<T>;
|
|
8
|
+
/**
|
|
9
|
+
* The snapshot logic behind `useWorkbookSelector`: `getSnapshot` returns the
|
|
10
|
+
* previously handed-out value while `isEqual` says the newly selected one is
|
|
11
|
+
* the same, so `useSyncExternalStore` sees no change and the component does
|
|
12
|
+
* not render. The selector runs once per state.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createSelection<T, S>(store: WorkbookStore<T>, selector: (state: T) => S, isEqual?: (a: S, b: S) => boolean): {
|
|
15
|
+
subscribe: (listener: () => void) => () => void;
|
|
16
|
+
getSnapshot(): S;
|
|
17
|
+
};
|
|
18
|
+
/** True when two states differ only in the listed keys. */
|
|
19
|
+
export declare function onlyIgnoredKeysChanged(ignored: readonly string[]): (a: object, b: object) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Context keys that change on scroll or when the row and column offsets are
|
|
22
|
+
* rebuilt after an edit, and that the components converted in E2 do not read:
|
|
23
|
+
* Toolbar and its popovers, SheetTab, ContextMenu, FilterMenu and
|
|
24
|
+
* SheetTabContextMenu. Checked with grep in those directories and in the
|
|
25
|
+
* helpers they call with the context (`updateCellsDecimalFormat`,
|
|
26
|
+
* `convertCellsToCrypto`, `isHyperlinkCreationBlocked`,
|
|
27
|
+
* `captureLinkEditorOpenSnapshot`).
|
|
28
|
+
*/
|
|
29
|
+
export declare const SCROLL_ONLY_KEYS: readonly ["scrollLeft", "scrollTop", "visibledatarow", "visibledatacolumn"];
|
|
30
|
+
export declare const contextEqualIgnoringScroll: (a: object, b: object) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|