@fileverse-dev/dsheet 2.0.33-comment → 2.0.33-rtc

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 (32) hide show
  1. package/dist/editor/components/collab-status-chip.d.ts +8 -0
  2. package/dist/editor/contexts/editor-context.d.ts +9 -5
  3. package/dist/editor/dsheet-editor.d.ts +1 -1
  4. package/dist/editor/hooks/use-collab-awareness.d.ts +11 -0
  5. package/dist/editor/hooks/use-editor-data.d.ts +1 -1
  6. package/dist/editor/hooks/use-editor-sync.d.ts +9 -6
  7. package/dist/editor/types.d.ts +2 -2
  8. package/dist/{executeStringFunction-CqY9CxQI.js → executeStringFunction-9cGLblM5.js} +221 -201
  9. package/dist/formula.js +1 -1
  10. package/dist/index-DkB-BZN7.js +50679 -0
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.es.js +4 -4
  13. package/dist/sheet-engine/core/index.d.ts +1 -1
  14. package/dist/sheet-engine/core/modules/index.d.ts +1 -1
  15. package/dist/sheet-engine/core/settings.d.ts +1 -1
  16. package/dist/sheet-engine/core/types.d.ts +1 -0
  17. package/dist/style.css +1 -1
  18. package/dist/sync-local/SyncManager.d.ts +67 -0
  19. package/dist/sync-local/collabStateMachine.d.ts +23 -0
  20. package/dist/sync-local/constants.d.ts +1 -0
  21. package/dist/sync-local/crypto/index.d.ts +6 -0
  22. package/dist/sync-local/index.d.ts +3 -0
  23. package/dist/sync-local/socketClient.d.ts +68 -0
  24. package/dist/sync-local/types/index.d.ts +208 -0
  25. package/dist/sync-local/useSyncManager.d.ts +12 -0
  26. package/dist/sync-local/utils/createAwarenessUpdateHandler.d.ts +8 -0
  27. package/dist/sync-local/utils/objectToFile.d.ts +1 -0
  28. package/dist/{use-xlsx-import-impl-DgedLtO_.js → use-xlsx-import-impl-DUEM4eBB.js} +2 -2
  29. package/dist/{xlsx-export-impl-1HOQoC6f.js → xlsx-export-impl-BLwdk5y1.js} +293 -295
  30. package/package.json +7 -3
  31. package/dist/editor/hooks/use-editor-collaboration.d.ts +0 -9
  32. package/dist/index-D9nJayaD.js +0 -40174
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { CollabState } from '../../sync-local/types';
3
+
4
+ interface Props {
5
+ state: CollabState;
6
+ }
7
+ export declare const CollabStatusChip: React.FC<Props>;
8
+ export {};
@@ -2,6 +2,8 @@ import { default as React } from 'react';
2
2
  import { LiveQueryData, Sheet, WorkbookInstance } from '../../sheet-engine/react';
3
3
  import { IndexeddbPersistence } from 'y-indexeddb';
4
4
  import { DataBlockApiKeyHandlerType, SheetUpdateData } from '../types';
5
+ import { CollaborationProps, CollabState } from '../../sync-local/types';
6
+ import { Awareness } from 'y-protocols/awareness';
5
7
 
6
8
  import * as Y from 'yjs';
7
9
  export interface EditorContextType {
@@ -35,10 +37,13 @@ export interface EditorContextType {
35
37
  loading: boolean;
36
38
  forceSheetRender: number;
37
39
  setForceSheetRender: React.Dispatch<React.SetStateAction<number>>;
38
- activeUsers: string[];
39
- collaborationStatus: 'disconnected' | 'connecting' | 'connected' | 'error';
40
40
  syncStatus: 'initializing' | 'syncing' | 'synced' | 'error';
41
- isCollaborative?: boolean;
41
+ collabState?: CollabState;
42
+ isCollabReady?: boolean;
43
+ isCollabSyncing?: boolean;
44
+ hasCollabContentInitialised?: boolean;
45
+ awareness?: Awareness | null;
46
+ terminateSession?: () => void;
42
47
  handleLiveQuery: (subsheetIndex: number, data: LiveQueryData) => void;
43
48
  }
44
49
  interface EditorProviderProps {
@@ -53,11 +58,10 @@ interface EditorProviderProps {
53
58
  username?: string;
54
59
  portalContent?: string;
55
60
  enableIndexeddbSync?: boolean;
56
- enableWebrtc?: boolean;
57
61
  isReadOnly?: boolean;
58
62
  onChange?: (data: SheetUpdateData, encodedUpdate?: string) => void;
63
+ collaboration?: CollaborationProps;
59
64
  externalEditorRef?: React.MutableRefObject<WorkbookInstance | null>;
60
- isCollaborative?: boolean;
61
65
  commentData?: object;
62
66
  editorStateRef?: React.MutableRefObject<{
63
67
  refreshIndexedDB: () => Promise<void>;
@@ -7,5 +7,5 @@ import { DsheetProps } from './types';
7
7
  * @param props - Component properties
8
8
  * @returns The SpreadsheetEditor component
9
9
  */
10
- declare const SpreadsheetEditor: ({ isCollaborative, isReadOnly, allowSheetDownload, allowComments, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, enableWebrtc, onboardingComplete, onboardingCompleteLocalStorageKey, onboardingHandler, commentData, getCommentCellUI, dataBlockApiKeyHandler, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, storeApiKey, onDuneChartEmbed, onSheetCountChange, onDataBlockApiResponse, isAuthorized, getDocumentTitle, updateDocumentTitle, setShowSmartContractModal, editorStateRef, handleSmartContractQuery, setSelectedTemplate, isNewSheet, liveQueryRefreshRate, enableLiveQuery, }: DsheetProps) => JSX.Element;
10
+ declare const SpreadsheetEditor: ({ isReadOnly, allowSheetDownload, allowComments, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, onboardingComplete, onboardingCompleteLocalStorageKey, onboardingHandler, commentData, getCommentCellUI, dataBlockApiKeyHandler, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, storeApiKey, onDuneChartEmbed, onSheetCountChange, onDataBlockApiResponse, isAuthorized, getDocumentTitle, updateDocumentTitle, setShowSmartContractModal, editorStateRef, handleSmartContractQuery, setSelectedTemplate, isNewSheet, liveQueryRefreshRate, enableLiveQuery, collaboration, }: DsheetProps) => JSX.Element;
11
11
  export default SpreadsheetEditor;
@@ -0,0 +1,11 @@
1
+ import { Awareness } from 'y-protocols/awareness';
2
+ import { WorkbookInstance } from '../../sheet-engine/react';
3
+
4
+ /**
5
+ * Reads remote cursor positions from Yjs awareness and keeps Fortune sheet's
6
+ * native presence list in sync. Fortune renders colored cell borders + username
7
+ * labels automatically via context.presences[].
8
+ */
9
+ export declare const useCollabAwareness: (awareness: Awareness | null | undefined, sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>) => {
10
+ localColor: string;
11
+ };
@@ -14,7 +14,7 @@ export declare const useEditorData: (ydocRef: React.MutableRefObject<Y.Doc | nul
14
14
  [key: string]: {
15
15
  [key: string]: any;
16
16
  };
17
- }>>, enableLiveQuery?: boolean, liveQueryRefreshRate?: number, dataBlockApiKeyHandler?: DataBlockApiKeyHandlerType, allowComments?: boolean) => {
17
+ }>>, enableLiveQuery?: boolean, liveQueryRefreshRate?: number, dataBlockApiKeyHandler?: DataBlockApiKeyHandlerType, allowComments?: boolean, hasCollabContentInitialised?: boolean) => {
18
18
  sheetData: Sheet[];
19
19
  setSheetData: import('react').Dispatch<import('react').SetStateAction<Sheet[]>>;
20
20
  currentDataRef: import('react').MutableRefObject<Sheet[]>;
@@ -1,13 +1,16 @@
1
1
  import { IndexeddbPersistence } from 'y-indexeddb';
2
+ import { CollaborationProps } from '../../sync-local/types';
2
3
  import * as Y from 'yjs';
3
- /**
4
- * Hook for setting up YJS document and persistence
5
- * Handles initialization of YJS document and optional IndexedDB persistence
6
- */
7
- export declare const useEditorSync: (dsheetId: string, enableIndexeddbSync?: boolean, isReadOnly?: boolean) => {
4
+ export declare const useEditorSync: (dsheetId: string, enableIndexeddbSync?: boolean, isReadOnly?: boolean, collaboration?: CollaborationProps, onCollabUpdate?: (fullState: string, updateChunk: string) => void) => {
8
5
  ydocRef: import('react').MutableRefObject<Y.Doc | null>;
9
6
  persistenceRef: import('react').MutableRefObject<IndexeddbPersistence | null>;
10
- syncStatus: "error" | "initializing" | "syncing" | "synced";
7
+ syncStatus: "error" | "syncing" | "initializing" | "synced";
11
8
  isSyncedRef: import('react').MutableRefObject<boolean>;
12
9
  refreshIndexedDB: () => Promise<void>;
10
+ collabState: import('../..').CollabState;
11
+ isCollabReady: boolean;
12
+ isCollabSyncing: boolean;
13
+ terminateSession: () => void;
14
+ awareness: import('y-protocols/awareness.js').Awareness | null;
15
+ hasCollabContentInitialised: boolean;
13
16
  };
@@ -2,6 +2,7 @@ import { Sheet, Workbook, WorkbookInstance, Cell } from '../sheet-engine/react';
2
2
  import { ComponentProps, RefObject } from 'react';
3
3
  import { ERROR_MESSAGES_FLAG } from './constants/shared-constants';
4
4
  import { SmartContractQueryHandler } from './utils/after-update-cell';
5
+ import { CollaborationProps } from '../sync-local/types';
5
6
 
6
7
  import * as Y from 'yjs';
7
8
  export interface SheetUpdateData {
@@ -55,13 +56,12 @@ export interface DsheetProps {
55
56
  enableIndexeddbSync?: boolean;
56
57
  dsheetId: string;
57
58
  onChange?: (updateData: SheetUpdateData, encodedUpdate?: string) => void;
59
+ collaboration?: CollaborationProps;
58
60
  username?: string;
59
- enableWebrtc?: boolean;
60
61
  portalContent?: string;
61
62
  isReadOnly?: boolean;
62
63
  allowSheetDownload?: boolean;
63
64
  isTemplateOpen?: boolean;
64
- isCollaborative?: boolean;
65
65
  selectedTemplate?: string;
66
66
  onboardingComplete?: boolean;
67
67
  /** When `onboardingComplete` is omitted, read `localStorage.getItem(key)==='true'` (default key `onboardingComplete`). */