@fileverse-dev/dsheet 3.0.1-yjs-15 → 3.0.2-29July-1
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/dist/{constants-Cdz6oSCq.js → constants-Q8nzbvQO.js} +5 -3
- package/dist/constants.js +1 -1
- package/dist/editor/components/editor-workbook-sync.d.ts +1 -1
- package/dist/editor/constants/shared-constants.d.ts +2 -0
- package/dist/editor/hooks/use-xlsx-import-impl.d.ts +1 -2
- package/dist/editor/hooks/use-xlsx-import.d.ts +1 -2
- package/dist/editor/utils/apply-comment-markers.d.ts +22 -0
- package/dist/editor/utils/update-ydoc.d.ts +2 -2
- package/dist/{executeStringFunction-BHy-_q3d.js → executeStringFunction-C5hEkx9z.js} +9240 -14112
- package/dist/formula.js +1 -1
- package/dist/{index-OL2_pnvq.js → index-B5OjJYA0.js} +25764 -22624
- package/dist/index.es.js +39 -39
- package/dist/sheet-engine/core/api/cell.d.ts +20 -0
- package/dist/sheet-engine/core/api/common.d.ts +1 -2
- package/dist/sheet-engine/core/api/index.d.ts +0 -1
- package/dist/sheet-engine/core/api/sheet.d.ts +0 -5
- package/dist/sheet-engine/core/modules/formula-worker-bridge.d.ts +0 -1
- package/dist/sheet-engine/core/modules/sheet-metadata-hooks.d.ts +0 -4
- package/dist/sheet-engine/core/modules/sheet.d.ts +1 -17
- package/dist/sheet-engine/core/settings.d.ts +1 -1
- package/dist/sheet-engine/core/types.d.ts +0 -3
- package/dist/sheet-engine/react/components/Workbook/api.d.ts +1 -8
- package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -5
- package/dist/use-xlsx-import-impl-CevfOsNi.js +1556 -0
- package/dist/xlsx-export-impl-CiWHN8hx.js +3138 -0
- package/package.json +2 -2
- package/dist/editor/hooks/use-celldata-compaction.d.ts +0 -23
- package/dist/editor/utils/compact-committed-celldata.d.ts +0 -28
- package/dist/editor/utils/config-ydoc-update.d.ts +0 -20
- package/dist/sheet-engine/core/api/sheet-flowdata-lifecycle.d.ts +0 -17
- package/dist/sheet-engine/core/paste/paste-border-utils.d.ts +0 -23
- package/dist/sheet-engine/core/utils/border-config-utils.d.ts +0 -16
- package/dist/sheet-engine/core/utils/cell-persist-utils.d.ts +0 -10
- package/dist/sheet-engine/core/utils/range-format.d.ts +0 -71
- package/dist/sheet-engine/core/utils/ydoc-celldata-changes.d.ts +0 -40
- package/dist/use-xlsx-import-impl-Bvgo-6F2.js +0 -1554
- package/dist/xlsx-export-impl-CxyAa2j_.js +0 -3126
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@fileverse-dev/dsheet",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "DSheet",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.2-29July-1",
|
|
6
6
|
"main": "dist/index.es.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
8
8
|
"exports": {
|
|
@@ -112,4 +112,4 @@
|
|
|
112
112
|
"typescript": "^5.2.2",
|
|
113
113
|
"vite": "^5.0.0"
|
|
114
114
|
}
|
|
115
|
-
}
|
|
115
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { MutableRefObject, RefObject } from 'react';
|
|
2
|
-
import { WorkbookInstance, Sheet } from '../../sheet-engine/react';
|
|
3
|
-
|
|
4
|
-
import type * as Y from 'yjs';
|
|
5
|
-
type UseCelldataCompactionArgs = {
|
|
6
|
-
dsheetId: string;
|
|
7
|
-
ydocRef: RefObject<Y.Doc | null>;
|
|
8
|
-
sheetEditorRef: RefObject<WorkbookInstance | null>;
|
|
9
|
-
currentDataRef: MutableRefObject<Sheet[]>;
|
|
10
|
-
handleOnChangePortalUpdate: () => void;
|
|
11
|
-
syncStatus: 'initializing' | 'syncing' | 'synced' | 'error';
|
|
12
|
-
isDataLoaded: boolean;
|
|
13
|
-
isReadOnly: boolean;
|
|
14
|
-
remoteUpdateRef: MutableRefObject<boolean>;
|
|
15
|
-
collabSyncing: boolean;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* One-shot background compaction: remove committed celldata entries that copy/paste
|
|
19
|
-
* would never write (`shouldPersistCelldataCell` === false). Runs once per dsheetId
|
|
20
|
-
* after the editor is synced and idle so it does not compete with load or edits.
|
|
21
|
-
*/
|
|
22
|
-
export declare function useCelldataCompaction({ dsheetId, ydocRef, sheetEditorRef, currentDataRef, handleOnChangePortalUpdate, syncStatus, isDataLoaded, isReadOnly, remoteUpdateRef, collabSyncing, }: UseCelldataCompactionArgs): void;
|
|
23
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { CellMatrix, CellWithRowAndCol, Sheet } from '../../sheet-engine/core/types';
|
|
2
|
-
import { SheetChangePath } from './update-ydoc';
|
|
3
|
-
import * as Y from 'yjs';
|
|
4
|
-
export declare const CELLDATA_COMPACT_STORAGE_KEY_PREFIX = "dsheet-celldata-compact-v1:";
|
|
5
|
-
export type CelldataCompactionResult = {
|
|
6
|
-
removedFromYdoc: number;
|
|
7
|
-
clearedInMemory: number;
|
|
8
|
-
changes: SheetChangePath[];
|
|
9
|
-
};
|
|
10
|
-
export declare function celldataCompactStorageKey(dsheetId: string): string;
|
|
11
|
-
export declare function hasCelldataCompactionCompleted(dsheetId: string): boolean;
|
|
12
|
-
export declare function markCelldataCompactionCompleted(dsheetId: string): void;
|
|
13
|
-
/** Collect Yjs celldata keys that should not be persisted (format-only / empty ghosts). */
|
|
14
|
-
export declare function collectStaleCelldataKeys(celldataMap: Y.Map<unknown> | Record<string, unknown> | null | undefined): string[];
|
|
15
|
-
export declare function buildCelldataDeleteChanges(sheetId: string, keys: string[]): SheetChangePath[];
|
|
16
|
-
/** Null out dense-grid cells that should not be persisted. */
|
|
17
|
-
export declare function compactSheetDataMatrix(data: CellMatrix | null | undefined): number;
|
|
18
|
-
/** Drop sparse celldata entries that should not be persisted. */
|
|
19
|
-
export declare function compactSheetCelldataArray(celldata: CellWithRowAndCol[] | null | undefined): {
|
|
20
|
-
next: CellWithRowAndCol[];
|
|
21
|
-
removed: number;
|
|
22
|
-
};
|
|
23
|
-
export declare function compactInMemorySheets(sheets: Sheet[] | null | undefined): number;
|
|
24
|
-
/**
|
|
25
|
-
* Scan Y.Doc for committed celldata ghosts. Does not mutate — caller applies
|
|
26
|
-
* `changes` via `updateYdocSheetData`.
|
|
27
|
-
*/
|
|
28
|
-
export declare function planYdocCelldataCompaction(ydoc: Y.Doc, dsheetId: string): CelldataCompactionResult;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { WorkbookInstance } from '../../sheet-engine/react';
|
|
2
|
-
import { SheetChangePath } from './update-ydoc';
|
|
3
|
-
|
|
4
|
-
import * as Y from 'yjs';
|
|
5
|
-
/** Diff top-level config sub-keys and emit granular Yjs updates. */
|
|
6
|
-
export declare function buildConfigSubKeyChanges({ sheetId, oldConfig, newConfig, }: {
|
|
7
|
-
sheetId: string;
|
|
8
|
-
oldConfig: Record<string, any>;
|
|
9
|
-
newConfig: Record<string, any>;
|
|
10
|
-
}): SheetChangePath[];
|
|
11
|
-
/**
|
|
12
|
-
* Sync active sheet config sub-keys to Yjs (borderInfo, merge, rowlen, …).
|
|
13
|
-
* Replaces whole-config writes so only changed sub-keys are broadcast.
|
|
14
|
-
*/
|
|
15
|
-
export declare const configYdocUpdate: ({ sheetEditorRef, ydocRef, dsheetId, handleContentPortal, }: {
|
|
16
|
-
sheetEditorRef: React.RefObject<WorkbookInstance | null>;
|
|
17
|
-
ydocRef: React.RefObject<Y.Doc | null>;
|
|
18
|
-
dsheetId: string;
|
|
19
|
-
handleContentPortal?: any;
|
|
20
|
-
}) => void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Context } from '../context';
|
|
2
|
-
|
|
3
|
-
/** Drop cached dense-sheet set (e.g. after structural workbook changes). */
|
|
4
|
-
export declare function invalidateSheetsRequiredDenseCache(): void;
|
|
5
|
-
/**
|
|
6
|
-
* Sheets that must keep dense `data` while `activeSheetId` is active:
|
|
7
|
-
* the active tab, tabs its formulas read, and tabs with formulas that read it.
|
|
8
|
-
*/
|
|
9
|
-
export declare function getSheetsRequiredDense(ctx: Context, activeSheetId: string): Set<string>;
|
|
10
|
-
/** Sheets the formula worker needs dense — active refs plus any tab with formulas. */
|
|
11
|
-
export declare function getSheetsNeededForWorkerSnapshot(ctx: Context): Set<string>;
|
|
12
|
-
export declare function demoteSheetToCelldata(ctx: Context, sheetId: string): void;
|
|
13
|
-
/**
|
|
14
|
-
* On tab switch: persist outgoing config, demote tabs not needed dense,
|
|
15
|
-
* hydrate active tab + cross-sheet references.
|
|
16
|
-
*/
|
|
17
|
-
export declare function syncAndDemoteInactiveFlowdata(ctx: Context, activeSheetId: string, previousSheetId: string | null): Set<string>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare function isTransparentBorderColor(color: string): boolean;
|
|
2
|
-
export declare function isMeaningfulBorderSide(side: {
|
|
3
|
-
style?: number;
|
|
4
|
-
color?: string;
|
|
5
|
-
} | undefined): boolean;
|
|
6
|
-
export declare function filterMeaningfulBorderSides(sides: {
|
|
7
|
-
l?: {
|
|
8
|
-
style?: number;
|
|
9
|
-
color?: string;
|
|
10
|
-
};
|
|
11
|
-
r?: {
|
|
12
|
-
style?: number;
|
|
13
|
-
color?: string;
|
|
14
|
-
};
|
|
15
|
-
t?: {
|
|
16
|
-
style?: number;
|
|
17
|
-
color?: string;
|
|
18
|
-
};
|
|
19
|
-
b?: {
|
|
20
|
-
style?: number;
|
|
21
|
-
color?: string;
|
|
22
|
-
};
|
|
23
|
-
}): typeof sides;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Context } from '../context';
|
|
2
|
-
|
|
3
|
-
export type BorderSelection = {
|
|
4
|
-
row: [number, number];
|
|
5
|
-
column: [number, number];
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Remap borderInfo after a row/column reorder (header drag).
|
|
9
|
-
* Uses the same old→new index map as remapCellFormatRanges.
|
|
10
|
-
* O(border entries × span) — only runs on drag drop, not per-frame.
|
|
11
|
-
*/
|
|
12
|
-
export declare function remapBorderInfo(borderInfo: any[] | undefined, axis: 'row' | 'column', indexMap: Record<number, number>): any[];
|
|
13
|
-
/** Remove border entries overlapping a single selection (cell + range types). */
|
|
14
|
-
export declare function removeBorderInfoForSelection(borderInfo: any[], rowSt: number, rowEd: number, colSt: number, colEd: number): any[];
|
|
15
|
-
export declare function removeBorderInfoInSelections(borderInfo: any[] | undefined, selections: BorderSelection[]): any[];
|
|
16
|
-
export declare function syncBorderInfoToYdoc(ctx: Context, borderInfo: any[]): void;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Cell } from '../types';
|
|
2
|
-
|
|
3
|
-
export declare const CELL_FORMAT_ATTRS: readonly ["tb", "ht", "vt", "tr", "fs", "ff", "fc", "bl", "it", "un", "cl", "bg", "ct"];
|
|
4
|
-
export type CellFormatAttr = (typeof CELL_FORMAT_ATTRS)[number];
|
|
5
|
-
export declare function hasCellMeaningfulContent(cell: Cell | string | number | boolean | null | undefined): boolean;
|
|
6
|
-
export declare function isFormatOnlyEmptyCell(cell: Cell | string | number | boolean | null | undefined): boolean;
|
|
7
|
-
/** Pull only present format attrs from a format-only empty cell (cheap, no clone). */
|
|
8
|
-
export declare function extractCellFormatAttrs(cell: Cell | string | number | boolean | null | undefined): Partial<Record<CellFormatAttr, unknown>> | null;
|
|
9
|
-
export declare function shouldPersistCelldataCell(cell: Cell | string | number | boolean | null | undefined): boolean;
|
|
10
|
-
export declare function celldataEntryEqual(existing: unknown, next: unknown): boolean;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { Cell, CellMatrix, CellWithRowAndCol, Sheet } from '../types';
|
|
2
|
-
|
|
3
|
-
export type CellFormatRange = {
|
|
4
|
-
row: [number, number];
|
|
5
|
-
column: [number, number];
|
|
6
|
-
tb?: string;
|
|
7
|
-
ht?: number | string;
|
|
8
|
-
vt?: number | string;
|
|
9
|
-
tr?: string;
|
|
10
|
-
fs?: number;
|
|
11
|
-
ff?: number | string;
|
|
12
|
-
fc?: string;
|
|
13
|
-
bl?: number;
|
|
14
|
-
it?: number;
|
|
15
|
-
un?: number;
|
|
16
|
-
cl?: number;
|
|
17
|
-
bg?: string;
|
|
18
|
-
ct?: Cell["ct"];
|
|
19
|
-
};
|
|
20
|
-
declare function rangesEqual(a: CellFormatRange[] | undefined, b: CellFormatRange[] | undefined): boolean;
|
|
21
|
-
/** Merge overlapping/adjacent ranges that carry identical format attrs. */
|
|
22
|
-
export declare function normalizeCellFormatRanges(ranges: CellFormatRange[] | undefined): CellFormatRange[];
|
|
23
|
-
/**
|
|
24
|
-
* Remap format ranges after a row or column permutation, such as header
|
|
25
|
-
* drag-and-drop. A contiguous source range can become multiple rectangles
|
|
26
|
-
* when the moved indices are no longer contiguous.
|
|
27
|
-
*/
|
|
28
|
-
export declare function remapCellFormatRanges(ranges: CellFormatRange[] | undefined, axis: "row" | "column", indexMap: Record<number, number>): CellFormatRange[];
|
|
29
|
-
/**
|
|
30
|
-
* Move format ranges with a cut-and-paste cell block move. Formatting in both
|
|
31
|
-
* the old source and the overwritten destination is cleared; only the source
|
|
32
|
-
* intersection is translated to the target rectangle.
|
|
33
|
-
*/
|
|
34
|
-
export declare function moveCellFormatRanges(ranges: CellFormatRange[] | undefined, source: Pick<CellFormatRange, "row" | "column">, target: Pick<CellFormatRange, "row" | "column">): CellFormatRange[];
|
|
35
|
-
export declare function getCellFormatRangeGridBounds(ranges: CellFormatRange[] | undefined): {
|
|
36
|
-
maxRow: number;
|
|
37
|
-
maxCol: number;
|
|
38
|
-
} | null;
|
|
39
|
-
export declare function upsertCellFormatRange(ranges: CellFormatRange[] | undefined, rowSt: number, rowEd: number, colSt: number, colEd: number, attrs: Partial<CellFormatRange>): {
|
|
40
|
-
ranges: CellFormatRange[];
|
|
41
|
-
changed: boolean;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* When a cell loses meaningful content but keeps style, put that style back
|
|
45
|
-
* into cellFormatRanges as a 1x1 (normalize merges with neighbours).
|
|
46
|
-
*/
|
|
47
|
-
export declare function migrateFormatOnlyCellIntoRanges(ranges: CellFormatRange[] | undefined, r: number, c: number, cell: Cell | string | number | boolean | null | undefined): {
|
|
48
|
-
ranges: CellFormatRange[];
|
|
49
|
-
changed: boolean;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Scan a dense-data rectangle and move any format-only cells into
|
|
53
|
-
* cellFormatRanges. Adjacent identical styles merge via normalize.
|
|
54
|
-
*/
|
|
55
|
-
export declare function migrateFormatOnlyCellsFromData(ranges: CellFormatRange[] | undefined, data: CellMatrix | null | undefined, r1: number, r2: number, c1: number, c2: number): {
|
|
56
|
-
ranges: CellFormatRange[];
|
|
57
|
-
changed: boolean;
|
|
58
|
-
};
|
|
59
|
-
export declare function punchHoleInCellFormatRanges(ranges: CellFormatRange[] | undefined, r: number, c: number): CellFormatRange[];
|
|
60
|
-
export declare function punchRectHoleInCellFormatRanges(ranges: CellFormatRange[] | undefined, rowSt: number, rowEd: number, colSt: number, colEd: number): CellFormatRange[];
|
|
61
|
-
export declare function shiftCellFormatRangesOnInsert(ranges: CellFormatRange[] | undefined, type: "row" | "column", index: number, count: number, direction: "lefttop" | "rightbottom"): CellFormatRange[];
|
|
62
|
-
export declare function shiftCellFormatRangesOnDelete(ranges: CellFormatRange[] | undefined, type: "row" | "column", start: number, end: number): CellFormatRange[];
|
|
63
|
-
export declare function applyCellFormatRangesToData(data: CellMatrix | null | undefined, ranges: CellFormatRange[] | undefined): void;
|
|
64
|
-
export declare function buildSheetDataMatrixForExport(sheet: {
|
|
65
|
-
data?: CellMatrix | null;
|
|
66
|
-
celldata?: CellWithRowAndCol[];
|
|
67
|
-
row?: number;
|
|
68
|
-
column?: number;
|
|
69
|
-
config?: Sheet["config"];
|
|
70
|
-
}): CellMatrix;
|
|
71
|
-
export { rangesEqual };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Context } from '../context';
|
|
2
|
-
import { Cell, CellWithRowAndCol } from '../types';
|
|
3
|
-
|
|
4
|
-
export type CelldataYdocChange = {
|
|
5
|
-
sheetId: string;
|
|
6
|
-
path: string[];
|
|
7
|
-
key?: string;
|
|
8
|
-
value: any;
|
|
9
|
-
type?: 'update' | 'delete';
|
|
10
|
-
};
|
|
11
|
-
/** Cheap equality before deep compare — hot path for structural diffs. */
|
|
12
|
-
export declare function cellsEqualForYdocPersist(before: unknown, after: unknown): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Snapshot persisted cells in a range.
|
|
15
|
-
* Prefer sparse `celldata` when provided — O(populated cells), not O(range area).
|
|
16
|
-
*/
|
|
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>;
|
|
18
|
-
export declare function appendCelldataDiffChange(changes: CelldataYdocChange[], sheetId: string, r: number, c: number, cell: unknown, beforePersisted?: Map<string, Cell | string | number | boolean>): void;
|
|
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[];
|
|
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;
|
|
21
|
-
export type MergeBounds = {
|
|
22
|
-
minR: number;
|
|
23
|
-
minC: number;
|
|
24
|
-
maxR: number;
|
|
25
|
-
maxC: number;
|
|
26
|
-
};
|
|
27
|
-
/** Disturbed range for insert row/col — snapshot only rows/cols that may shift. */
|
|
28
|
-
export declare function getInsertRowColSnapshotBounds(type: 'row' | 'column', index: number, direction: 'lefttop' | 'rightbottom', rowCount: number, colCount: number, mergeBounds: MergeBounds | null): {
|
|
29
|
-
r1: number;
|
|
30
|
-
r2: number;
|
|
31
|
-
c1: number;
|
|
32
|
-
c2: number;
|
|
33
|
-
};
|
|
34
|
-
/** Disturbed range for delete row/col — from deletion point to sheet edge. */
|
|
35
|
-
export declare function getDeleteRowColSnapshotBounds(type: 'row' | 'column', start: number, rowCount: number, colCount: number, mergeBounds: MergeBounds | null): {
|
|
36
|
-
r1: number;
|
|
37
|
-
r2: number;
|
|
38
|
-
c1: number;
|
|
39
|
-
c2: number;
|
|
40
|
-
};
|