@fileverse-dev/dsheet 4.1.23-stabilise-package-3 → 4.1.23-stabilise-package-5

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 (39) hide show
  1. package/dist/editor/contexts/editor-context.d.ts +2 -0
  2. package/dist/editor/hooks/use-celldata-compaction.d.ts +23 -2
  3. package/dist/editor/hooks/use-celldata-compaction.test.d.ts +1 -0
  4. package/dist/editor/utils/active-sheet-keeper.test.d.ts +1 -0
  5. package/dist/editor/utils/remote-apply-guard.d.ts +10 -13
  6. package/dist/editor/utils/structural-edit-other-tabs.test.d.ts +1 -0
  7. package/dist/{executeStringFunction-D5BTPrXL.js → executeStringFunction-BEXVKyb4.js} +1219 -1196
  8. package/dist/formula.js +1 -1
  9. package/dist/{index-BXNWi7s5.js → index-B2qRWUrt.js} +19478 -19112
  10. package/dist/index.es.js +2 -2
  11. package/dist/sheet-engine/core/modules/formula-dep-text.d.ts +15 -0
  12. package/dist/sheet-engine/core/modules/formula-dep-text.test.d.ts +1 -0
  13. package/dist/sheet-engine/core/modules/formula-warmup.d.ts +2 -7
  14. package/dist/sheet-engine/core/modules/formula.d.ts +6 -0
  15. package/dist/sheet-engine/react/components/ContextMenu/FilterMenu.d.ts +2 -2
  16. package/dist/sheet-engine/react/components/ContextMenu/SheetTab.d.ts +2 -2
  17. package/dist/sheet-engine/react/components/ContextMenu/index.d.ts +2 -2
  18. package/dist/sheet-engine/react/components/NotationBoxes/shown-comments.d.ts +16 -0
  19. package/dist/sheet-engine/react/components/NotationBoxes/shown-comments.test.d.ts +1 -0
  20. package/dist/sheet-engine/react/components/SVGDefines.d.ts +2 -2
  21. package/dist/sheet-engine/react/components/SheetOverlay/editing-as-formula.d.ts +7 -0
  22. package/dist/sheet-engine/react/components/SheetOverlay/editing-as-formula.test.d.ts +1 -0
  23. package/dist/sheet-engine/react/components/SheetOverlay/hover-tracker.d.ts +40 -0
  24. package/dist/sheet-engine/react/components/SheetOverlay/hover-tracker.test.d.ts +1 -0
  25. package/dist/sheet-engine/react/components/SheetTab/index.d.ts +2 -2
  26. package/dist/sheet-engine/react/components/Toolbar/FunctionList/group-functions.d.ts +9 -0
  27. package/dist/sheet-engine/react/components/Toolbar/FunctionList/group-functions.test.d.ts +1 -0
  28. package/dist/sheet-engine/react/components/Toolbar/index.d.ts +2 -2
  29. package/dist/sheet-engine/react/components/Workbook/stable-handle.d.ts +8 -0
  30. package/dist/sheet-engine/react/components/Workbook/stable-handle.test.d.ts +1 -0
  31. package/dist/sheet-engine/react/context/index.d.ts +15 -0
  32. package/dist/sheet-engine/react/context/use-workbook-store.d.ts +30 -0
  33. package/dist/sheet-engine/react/context/workbook-store.d.ts +30 -0
  34. package/dist/sheet-engine/react/context/workbook-store.test.d.ts +1 -0
  35. package/dist/{use-xlsx-import-impl-gsG9w9qV.js → use-xlsx-import-impl-C8P5kg6K.js} +4 -4
  36. package/dist/{xlsx-defined-names-dZveijsB.js → xlsx-defined-names-BPf5_A0O.js} +2 -2
  37. package/dist/{xlsx-export-impl-B10lK_L2.js → xlsx-export-impl-GUjuzWHG.js} +4 -4
  38. package/dist/{xlsx-hyperlink-inline-BFbPe75M.js → xlsx-hyperlink-inline-yhXVMMJ9.js} +2 -2
  39. package/package.json +1 -1
@@ -37,6 +37,8 @@ export interface EditorContextType {
37
37
  rebuildLocalStore: () => Promise<void>;
38
38
  sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>;
39
39
  setSheetEditorRef: React.RefCallback<WorkbookInstance>;
40
+ /** Call when the active sheet changes or sheets appear; lets the keeper remember or restore it. */
41
+ notifyActiveSheetChange: () => void;
40
42
  ydocRef: React.MutableRefObject<Y.Doc | null>;
41
43
  persistenceRef: React.MutableRefObject<IndexeddbPersistence | null>;
42
44
  sheetData: Sheet[];
@@ -1,7 +1,8 @@
1
1
  import { MutableRefObject, RefObject } from 'react';
2
2
  import { WorkbookInstance, Sheet } from '../../sheet-engine/react';
3
+ import { planYdocCompaction } from '../utils/compact-committed-celldata';
3
4
 
4
- import type * as Y from 'yjs';
5
+ import * as Y from 'yjs';
5
6
  type UseCelldataCompactionArgs = {
6
7
  dsheetId: string;
7
8
  ydocRef: RefObject<Y.Doc | null>;
@@ -12,11 +13,31 @@ type UseCelldataCompactionArgs = {
12
13
  isDataLoaded: boolean;
13
14
  isReadOnly: boolean;
14
15
  remoteUpdateRef: MutableRefObject<boolean>;
16
+ /** True while a structural remote change waits to remount the Workbook. */
17
+ structuralRemountPendingRef?: MutableRefObject<boolean>;
15
18
  collabSyncing: boolean;
16
19
  };
20
+ /**
21
+ * False while a remote apply is running, while a structural remount is pending
22
+ * (the engine still has the old grid and the Yjs document has the new one) or
23
+ * while collaboration is still syncing.
24
+ */
25
+ export declare function canRunCompaction(refs: {
26
+ remoteUpdateRef: MutableRefObject<boolean>;
27
+ structuralRemountPendingRef?: MutableRefObject<boolean>;
28
+ }, collabSyncing: boolean): boolean;
29
+ /**
30
+ * Applies the plan chunk by chunk, yielding between chunks. The plan was made
31
+ * from the document as it was, and one change in it, the whole-value
32
+ * borderInfo write, would overwrite a newer value. So the run stops, leaving
33
+ * the compaction unfinished (it is retried on a later open), as soon as the
34
+ * document differs from what the previous chunk left. Returns true when every
35
+ * chunk was applied.
36
+ */
37
+ export declare function applyCompactionChangesInChunks(ydoc: Y.Doc, dsheetId: string, changes: ReturnType<typeof planYdocCompaction>['changes'], handleOnChangePortalUpdate: () => void, isCancelled: () => boolean, sheetEditorRef: RefObject<WorkbookInstance | null>, chunkSize?: number): Promise<boolean>;
17
38
  /**
18
39
  * One-shot background compaction (celldata + borderInfo). Completion is stored
19
40
  * on the anchor sheet's config in Yjs so it syncs across devices.
20
41
  */
21
- export declare function useCelldataCompaction({ dsheetId, ydocRef, sheetEditorRef, currentDataRef, handleOnChangePortalUpdate, syncStatus, isDataLoaded, isReadOnly, remoteUpdateRef, collabSyncing, }: UseCelldataCompactionArgs): void;
42
+ export declare function useCelldataCompaction({ dsheetId, ydocRef, sheetEditorRef, currentDataRef, handleOnChangePortalUpdate, syncStatus, isDataLoaded, isReadOnly, remoteUpdateRef, structuralRemountPendingRef, collabSyncing, }: UseCelldataCompactionArgs): void;
22
43
  export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -34,26 +34,23 @@ export type StructuralRemountRefs = RemoteApplyGuardRefs & {
34
34
  /**
35
35
  * Debounced structural remount under the remote-apply guard.
36
36
  *
37
- * The guard is begun once, right before `run`, and ended after paint, so each
38
- * remount owns exactly one begin and one end. It is NOT held while the timer
39
- * is merely pending or deferred by a cell edit: `remoteUpdateRef` makes
40
- * handleChange and the data-block work in afterUpdateCell drop local work, so
41
- * holding it across an edit would drop the user's typed edit. (The cell write
42
- * in afterUpdateCell and the commit-time write do not check it.) What must not
43
- * run while a remount is pending is the engine → Yjs echo hooks, which diff
44
- * the old grid against Yjs: they check `shouldSkipEchoWrite`. Events that
45
- * land while one is pending only re-arm its timer.
37
+ * Each pending remount owns exactly one begin and one end (B1): the guard is
38
+ * begun when the remount becomes pending (no remount was pending before),
39
+ * held while the timer is pending or deferred by a cell edit (B3), and ended
40
+ * after paint once `run` has finished. Events that land while one is pending
41
+ * only re-arm its timer.
46
42
  *
47
43
  * While `isEditing()` is true at fire time the timer re-arms (250 ms) and the
48
- * pending flag is kept; the remount runs once the edit ends.
44
+ * pending flag and guard depth are kept; the remount runs once the edit ends.
45
+ * The typed cell itself is still written: the commit-time write and the cell
46
+ * write in afterUpdateCell do not check the guard.
49
47
  */
50
48
  export declare function scheduleStructuralRemount(refs: StructuralRemountRefs, run: () => void, delayMs?: number, isEditing?: () => boolean): void;
51
49
  /** Re-arm interval while a cell edit blocks the remount. */
52
50
  export declare const STRUCTURAL_REMOUNT_EDIT_RETRY_MS = 250;
53
51
  /**
54
- * Drop a pending structural remount (observer teardown). The guard is only
55
- * held while `run` executes and until paint afterwards, so there is nothing
56
- * to release here.
52
+ * Drop a pending structural remount (observer teardown) and release the
53
+ * guard begun for it.
57
54
  */
58
55
  export declare function cancelStructuralRemount(refs: StructuralRemountRefs): void;
59
56
  /**