@fileverse-dev/dsheet 4.0.6 → 4.1.1-edit-mode-14
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/editor/components/editor-workbook-controls.d.ts +11 -0
- package/dist/editor/components/editor-workbook-controls.test.d.ts +1 -0
- package/dist/editor/components/editor-workbook.d.ts +5 -1
- package/dist/editor/components/permission-chip-model.d.ts +34 -0
- package/dist/editor/components/permission-chip.d.ts +5 -1
- package/dist/editor/components/permission-chip.test.d.ts +1 -0
- package/dist/editor/contexts/editor-context.d.ts +11 -2
- package/dist/editor/dsheet-editor.d.ts +3 -2
- package/dist/editor/hooks/collaboration-lifecycle.d.ts +35 -0
- package/dist/editor/hooks/collaboration-lifecycle.test.d.ts +1 -0
- package/dist/editor/hooks/use-collab-awareness.d.ts +3 -6
- package/dist/editor/hooks/use-editor-data.d.ts +2 -2
- package/dist/editor/hooks/use-editor-sync.d.ts +6 -2
- package/dist/editor/types.d.ts +29 -3
- package/dist/editor/utils/detach-workbook-data.d.ts +8 -0
- package/dist/editor/utils/detach-workbook-data.test.d.ts +1 -0
- package/dist/editor/utils/editor-handle.d.ts +11 -0
- package/dist/editor/utils/editor-handle.test.d.ts +1 -0
- package/dist/{index-CQUhZB3J.js → index-DzwlrPIa.js} +19873 -18770
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +52 -48
- package/dist/persistence-utils-BXFajzvq.js +98 -0
- package/dist/persistence-utils.d.ts +6 -0
- package/dist/persistence-utils.test.d.ts +1 -0
- package/dist/persistence.js +1 -1
- package/dist/sheet-engine/react/components/Toolbar/index.d.ts +1 -0
- package/dist/sheet-engine/react/components/Workbook/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/sync-local/SyncManager.d.ts +54 -9
- package/dist/sync-local/crypto/room-key.d.ts +2 -0
- package/dist/sync-local/crypto/room-key.test.d.ts +1 -0
- package/dist/sync-local/floor.d.ts +8 -0
- package/dist/sync-local/floor.test.d.ts +1 -0
- package/dist/sync-local/index.d.ts +1 -1
- package/dist/sync-local/presence.d.ts +11 -0
- package/dist/sync-local/presence.test.d.ts +1 -0
- package/dist/sync-local/session-tools.d.ts +31 -0
- package/dist/sync-local/session-tools.test.d.ts +1 -0
- package/dist/sync-local/socketClient.d.ts +74 -8
- package/dist/sync-local/types/index.d.ts +111 -15
- package/dist/sync-local/useSyncManager.d.ts +4 -0
- package/dist/{use-xlsx-import-impl-DNTnmzDN.js → use-xlsx-import-impl-CeDHNaXi.js} +3 -3
- package/dist/{xlsx-defined-names-BHxDk83p.js → xlsx-defined-names-CPlC1afa.js} +1 -1
- package/dist/{xlsx-export-impl-r3bDoVjv.js → xlsx-export-impl-SyIbZKQB.js} +3 -3
- package/dist/{xlsx-hyperlink-inline-B5IR_SOR.js → xlsx-hyperlink-inline-Ch9f11g5.js} +1 -1
- package/package.json +6 -4
- package/dist/persistence-utils-DsM_MOB1.js +0 -89
- package/dist/sync-local/utils/objectToFile.d.ts +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface WorkbookControlItemsInput {
|
|
2
|
+
isReadOnly: boolean;
|
|
3
|
+
allowComments: boolean;
|
|
4
|
+
isRTCActive: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const getWorkbookControlItems: ({ isReadOnly, allowComments, }: WorkbookControlItemsInput) => {
|
|
7
|
+
cellContextMenu: string[];
|
|
8
|
+
headerContextMenu: string[];
|
|
9
|
+
toolbarItems: string[];
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { SidebarPortalRegistryHandle, SidebarPortalRenderer } from '../../sheet-engine/react';
|
|
3
3
|
import { ThemeKey } from '../../sheet-engine/core/theme';
|
|
4
|
-
import { OnboardingHandlerType } from '../types';
|
|
4
|
+
import { OnboardingHandlerType, DSheetPermissionMode } from '../types';
|
|
5
5
|
import { CommentsConfig } from '../types/comments';
|
|
6
6
|
|
|
7
7
|
type OnboardingHandler = OnboardingHandlerType;
|
|
@@ -24,6 +24,10 @@ interface EditorWorkbookProps {
|
|
|
24
24
|
sidebarActivePanel?: string | null;
|
|
25
25
|
sidebarPortalRegistry?: SidebarPortalRegistryHandle | null;
|
|
26
26
|
sidebarPortalRenderers?: Record<string, SidebarPortalRenderer>;
|
|
27
|
+
permissionMode?: DSheetPermissionMode | null;
|
|
28
|
+
onEnterEdit?: () => void;
|
|
29
|
+
onSignInToComment?: () => void;
|
|
30
|
+
onViewerModeChange?: (mode: 'comment' | 'view') => void;
|
|
27
31
|
theme?: ThemeKey;
|
|
28
32
|
}
|
|
29
33
|
export declare const EditorWorkbook: React.NamedExoticComponent<EditorWorkbookProps>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DSheetPermissionMode } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare const getPermissionChipConfig: (mode: DSheetPermissionMode) => {
|
|
4
|
+
readonly icon: "Eye";
|
|
5
|
+
readonly label: "View only";
|
|
6
|
+
readonly modifier: "view-only";
|
|
7
|
+
} | {
|
|
8
|
+
readonly icon: "MessageSquareText";
|
|
9
|
+
readonly label: "View and comment";
|
|
10
|
+
readonly modifier: "comment";
|
|
11
|
+
} | {
|
|
12
|
+
readonly icon: "Pencil";
|
|
13
|
+
readonly label: "Edit";
|
|
14
|
+
readonly modifier: "edit";
|
|
15
|
+
};
|
|
16
|
+
export declare const canShowEditElevation: ({ mode, onEnterEdit, }: {
|
|
17
|
+
mode: DSheetPermissionMode;
|
|
18
|
+
onEnterEdit?: () => void;
|
|
19
|
+
}) => boolean;
|
|
20
|
+
export declare const canShowViewerModeMenu: ({ mode, onViewerModeChange, }: {
|
|
21
|
+
mode: DSheetPermissionMode;
|
|
22
|
+
onViewerModeChange?: (mode: "comment" | "view") => void;
|
|
23
|
+
}) => boolean;
|
|
24
|
+
export declare const canShowCommentSignIn: ({ mode, onEnterEdit, onSignInToComment, onViewerModeChange, }: {
|
|
25
|
+
mode: DSheetPermissionMode;
|
|
26
|
+
onEnterEdit?: () => void;
|
|
27
|
+
onSignInToComment?: () => void;
|
|
28
|
+
onViewerModeChange?: (mode: "comment" | "view") => void;
|
|
29
|
+
}) => boolean;
|
|
30
|
+
export declare const resolvePermissionChipMode: ({ allowComments, isReadOnly, permissionMode, }: {
|
|
31
|
+
allowComments: boolean;
|
|
32
|
+
isReadOnly: boolean;
|
|
33
|
+
permissionMode?: DSheetPermissionMode;
|
|
34
|
+
}) => DSheetPermissionMode | null;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { DSheetPermissionMode } from '../types';
|
|
2
3
|
|
|
3
4
|
interface PermissionChipProps {
|
|
4
|
-
|
|
5
|
+
mode: DSheetPermissionMode;
|
|
6
|
+
onEnterEdit?: () => void;
|
|
7
|
+
onSignInToComment?: () => void;
|
|
8
|
+
onViewerModeChange?: (mode: 'comment' | 'view') => void;
|
|
5
9
|
}
|
|
6
10
|
export declare const PermissionChip: React.FC<PermissionChipProps>;
|
|
7
11
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { LiveQueryData, Sheet, WorkbookInstance } from '../../sheet-engine/react';
|
|
3
3
|
import { IndexeddbPersistence } from 'y-indexeddb';
|
|
4
|
-
import { SheetUpdateData, DataBlockEvent } from '../types';
|
|
4
|
+
import { SheetUpdateData, DataBlockEvent, DSheetEditorHandle } from '../types';
|
|
5
5
|
import { CommentsConfig } from '../types/comments';
|
|
6
6
|
import { ApiKeyStorage } from '../utils/api-key-storage';
|
|
7
7
|
import { OpenApiKeyModalFn } from '../utils/data-block-error-handler';
|
|
@@ -32,6 +32,7 @@ export interface EditorContextType {
|
|
|
32
32
|
}>>;
|
|
33
33
|
refreshIndexedDB: () => Promise<void>;
|
|
34
34
|
sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>;
|
|
35
|
+
setSheetEditorRef: React.RefCallback<WorkbookInstance>;
|
|
35
36
|
ydocRef: React.MutableRefObject<Y.Doc | null>;
|
|
36
37
|
persistenceRef: React.MutableRefObject<IndexeddbPersistence | null>;
|
|
37
38
|
sheetData: Sheet[];
|
|
@@ -45,6 +46,7 @@ export interface EditorContextType {
|
|
|
45
46
|
setForceSheetRender: React.Dispatch<React.SetStateAction<number>>;
|
|
46
47
|
syncStatus: 'initializing' | 'syncing' | 'synced' | 'error';
|
|
47
48
|
collabEnabled?: boolean;
|
|
49
|
+
isLiveCollabSession: boolean;
|
|
48
50
|
collabIsOwner?: boolean;
|
|
49
51
|
collabState?: CollabState;
|
|
50
52
|
isCollabReady?: boolean;
|
|
@@ -79,7 +81,8 @@ interface EditorProviderProps {
|
|
|
79
81
|
onContentUpdate?: () => void;
|
|
80
82
|
onChange?: (data: SheetUpdateData, encodedUpdate?: string) => void;
|
|
81
83
|
collaboration?: CollaborationProps;
|
|
82
|
-
externalEditorRef?: React.
|
|
84
|
+
externalEditorRef?: React.Ref<DSheetEditorHandle>;
|
|
85
|
+
legacyEditorRef?: React.Ref<DSheetEditorHandle>;
|
|
83
86
|
commentsConfig?: CommentsConfig;
|
|
84
87
|
editorStateRef?: React.MutableRefObject<{
|
|
85
88
|
refreshIndexedDB: () => Promise<void>;
|
|
@@ -87,6 +90,10 @@ interface EditorProviderProps {
|
|
|
87
90
|
mergeContent: (encodedState: string) => DSheetContentSnapshot;
|
|
88
91
|
terminateSession?: () => void;
|
|
89
92
|
updateCollaboratorName?: (name: string) => void;
|
|
93
|
+
updateSessionTitle?: (args: {
|
|
94
|
+
encryptedTitle: string;
|
|
95
|
+
documentTitle: string;
|
|
96
|
+
}) => void;
|
|
90
97
|
rehydrateAfterCollabSync?: (reason?: string) => boolean;
|
|
91
98
|
} | null>;
|
|
92
99
|
enableLiveQuery?: boolean;
|
|
@@ -95,6 +102,8 @@ interface EditorProviderProps {
|
|
|
95
102
|
onDataBlockEvent?: (event: DataBlockEvent) => void;
|
|
96
103
|
smartContracts?: SmartContractConfig;
|
|
97
104
|
onContentSyncStatusChange?: (status: 'initializing' | 'syncing' | 'synced' | 'error') => void;
|
|
105
|
+
onCollaborationInitializationComplete?: (result: 'ready' | 'error') => void;
|
|
106
|
+
onIndexedDbError?: (error: Error) => void;
|
|
98
107
|
}
|
|
99
108
|
export declare const EditorProvider: React.FC<EditorProviderProps>;
|
|
100
109
|
export declare const useEditor: () => EditorContextType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DSheetEditorHandle, DsheetProps } from './types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* SpreadsheetEditor component that provides a collaborative spreadsheet interface
|
|
@@ -7,5 +8,5 @@ import { DsheetProps } from './types';
|
|
|
7
8
|
* @param props - Component properties
|
|
8
9
|
* @returns The SpreadsheetEditor component
|
|
9
10
|
*/
|
|
10
|
-
declare const SpreadsheetEditor:
|
|
11
|
+
declare const SpreadsheetEditor: React.ForwardRefExoticComponent<DsheetProps & React.RefAttributes<DSheetEditorHandle>>;
|
|
11
12
|
export default SpreadsheetEditor;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CollabConnectionConfig, CollaborationProps } from '../../sync-local/types';
|
|
2
|
+
|
|
3
|
+
export declare const COLLAB_WARM_MS = 30000;
|
|
4
|
+
export declare const shouldKeepCollaborationSocketAlive: (connection: CollabConnectionConfig) => boolean;
|
|
5
|
+
export declare const isLiveCollaborationSession: (collaboration?: CollaborationProps) => boolean;
|
|
6
|
+
export declare const isQualifyingCollaborationEdit: (origin: unknown, indexeddbOrigin: unknown, isBootstrapReady: boolean) => boolean;
|
|
7
|
+
export declare const shouldRenderBootstrappedWorkbook: (collabEnabled: boolean, sheetCount: number) => boolean;
|
|
8
|
+
export declare const shouldInitializeDefaultWorkbook: (syncStatus: string | undefined, collabEnabled: boolean, collabStatus: string | undefined) => boolean;
|
|
9
|
+
export declare const getWorkbookHydrationReason: (status: string | undefined, previousStatus: string | undefined, hasHydratedReadyState: boolean) => "initial" | "reconnect" | null;
|
|
10
|
+
export declare const shouldRehydrateWorkbookOnReady: ({ reason, isOwner, hasUnmergedPeerUpdates, }: {
|
|
11
|
+
reason: "initial" | "reconnect";
|
|
12
|
+
isOwner: boolean;
|
|
13
|
+
hasUnmergedPeerUpdates: boolean;
|
|
14
|
+
}) => boolean;
|
|
15
|
+
export interface CollaborationConnectionController {
|
|
16
|
+
onYdocUpdate: (update: Uint8Array, origin: unknown) => void;
|
|
17
|
+
dispose: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const createCollaborationConnectionController: (args: {
|
|
20
|
+
connection: CollabConnectionConfig;
|
|
21
|
+
isSocketConnectedRef: {
|
|
22
|
+
current: boolean;
|
|
23
|
+
};
|
|
24
|
+
getIndexeddbOrigin: () => unknown;
|
|
25
|
+
isBootstrapReady: boolean;
|
|
26
|
+
connect: (connection: CollabConnectionConfig) => void;
|
|
27
|
+
disconnect: () => void;
|
|
28
|
+
}) => CollaborationConnectionController;
|
|
29
|
+
/**
|
|
30
|
+
* Merge the published artifact into the editor's one durable Y.Doc before
|
|
31
|
+
* IndexedDB replay and collaboration hydration. The `self` origin prevents a
|
|
32
|
+
* late package listener from treating the host seed as a live user edit;
|
|
33
|
+
* SyncManager's state-vector diff still sees it when the room is hydrated.
|
|
34
|
+
*/
|
|
35
|
+
export declare const mergePublishedContentIntoYdoc: (ydoc: import('yjs').Doc, encodedContent?: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { Awareness } from 'y-protocols/awareness';
|
|
2
2
|
import { WorkbookInstance } from '../../sheet-engine/react';
|
|
3
|
-
import { CollabUser } from '../../sync-local/types';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Reads remote cursor positions from Yjs awareness and keeps Fortune sheet's
|
|
7
6
|
* native presence list in sync. Fortune renders colored cell borders + username
|
|
8
7
|
* labels automatically via context.presences[].
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* ddoc's editor-layer awareness handler, which maps awareness.states →
|
|
13
|
-
* `{ clientId, ...user }` and fires on every awareness update + once on mount.
|
|
9
|
+
* The host collaborator roster is emitted by SocketClient from the
|
|
10
|
+
* authoritative server room-members list. This hook owns only cell cursors.
|
|
14
11
|
*/
|
|
15
|
-
export declare const useCollabAwareness: (awareness: Awareness | null | undefined, sheetEditorRef: React.MutableRefObject<WorkbookInstance | null
|
|
12
|
+
export declare const useCollabAwareness: (awareness: Awareness | null | undefined, sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>) => {
|
|
16
13
|
localColor: "#30bced" | "#6eeb83" | "#fa69d1" | "#ecd444" | "#ee6352" | "#db3041" | "#0ad7f2" | "#1bff39";
|
|
17
14
|
};
|
|
@@ -8,7 +8,7 @@ import * as Y from 'yjs';
|
|
|
8
8
|
* Hook for managing sheet data
|
|
9
9
|
* Handles initialization, updates, and persistence of sheet data
|
|
10
10
|
*/
|
|
11
|
-
export declare const useEditorData: (ydocRef: React.MutableRefObject<Y.Doc | null>, dsheetId: string, sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>, setForceSheetRender?: React.Dispatch<React.SetStateAction<number>>,
|
|
11
|
+
export declare const useEditorData: (ydocRef: React.MutableRefObject<Y.Doc | null>, dsheetId: string, sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>, setForceSheetRender?: React.Dispatch<React.SetStateAction<number>>, isReadOnly?: boolean, onChange?: (data: Sheet[]) => void, syncStatus?: "initializing" | "syncing" | "synced" | "error", isContentBootstrapReady?: boolean, commentData?: object, dataBlockCalcFunction?: {
|
|
12
12
|
[key: string]: {
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
};
|
|
@@ -16,7 +16,7 @@ export declare const useEditorData: (ydocRef: React.MutableRefObject<Y.Doc | nul
|
|
|
16
16
|
[key: string]: {
|
|
17
17
|
[key: string]: any;
|
|
18
18
|
};
|
|
19
|
-
}>>, enableLiveQuery?: boolean, liveQueryRefreshRate?: number, apiKeyStorage?: ApiKeyStorage, openApiKeyModal?: OpenApiKeyModalFn, onDataBlockEvent?: (event: DataBlockEvent) => void, allowComments?: boolean,
|
|
19
|
+
}>>, enableLiveQuery?: boolean, liveQueryRefreshRate?: number, apiKeyStorage?: ApiKeyStorage, openApiKeyModal?: OpenApiKeyModalFn, onDataBlockEvent?: (event: DataBlockEvent) => void, allowComments?: boolean, collabEnabled?: boolean) => {
|
|
20
20
|
sheetData: Sheet[];
|
|
21
21
|
setSheetData: import('react').Dispatch<import('react').SetStateAction<Sheet[]>>;
|
|
22
22
|
currentDataRef: import('react').MutableRefObject<Sheet[]>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IndexeddbPersistence } from 'y-indexeddb';
|
|
2
2
|
import { CollaborationProps } from '../../sync-local/types';
|
|
3
3
|
import * as Y from 'yjs';
|
|
4
|
-
export declare const useEditorSync: (dsheetId: string, enableIndexeddbSync?: boolean, isReadOnly?: boolean, collaboration?: CollaborationProps, onCollabUpdate?: (fullState: string, updateChunk: string) => void) => {
|
|
4
|
+
export declare const useEditorSync: (dsheetId: string, enableIndexeddbSync?: boolean, isReadOnly?: boolean, portalContent?: string, collaboration?: CollaborationProps, onCollabUpdate?: (fullState: string, updateChunk: string) => void, onIndexedDbError?: (error: Error) => void) => {
|
|
5
5
|
ydocRef: import('react').MutableRefObject<Y.Doc | null>;
|
|
6
6
|
persistenceRef: import('react').MutableRefObject<IndexeddbPersistence | null>;
|
|
7
7
|
syncStatus: "error" | "syncing" | "initializing" | "synced";
|
|
8
|
-
|
|
8
|
+
isContentBootstrapReady: boolean;
|
|
9
9
|
refreshIndexedDB: () => Promise<void>;
|
|
10
10
|
getContentSnapshot: () => import('../../persistence-utils').DSheetContentSnapshot;
|
|
11
11
|
mergeContent: (encodedState: string) => import('../../persistence-utils').DSheetContentSnapshot;
|
|
@@ -13,6 +13,10 @@ export declare const useEditorSync: (dsheetId: string, enableIndexeddbSync?: boo
|
|
|
13
13
|
isCollabReady: boolean;
|
|
14
14
|
isCollabSyncing: boolean;
|
|
15
15
|
terminateSession: () => void;
|
|
16
|
+
updateTitle: (args: {
|
|
17
|
+
encryptedTitle: string;
|
|
18
|
+
documentTitle: string;
|
|
19
|
+
}) => void;
|
|
16
20
|
awareness: import('y-protocols/awareness.js').Awareness | null;
|
|
17
21
|
hasCollabContentInitialised: boolean;
|
|
18
22
|
};
|
package/dist/editor/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { DSheetContentSnapshot } from '../persistence';
|
|
|
10
10
|
|
|
11
11
|
import * as Y from 'yjs';
|
|
12
12
|
export type { ThemeKey } from '../sheet-engine/core/theme';
|
|
13
|
+
export type DSheetPermissionMode = 'view' | 'comment' | 'edit';
|
|
13
14
|
export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, } from './types/comments';
|
|
14
15
|
export { CommentAction } from './types/comments';
|
|
15
16
|
export interface SheetUpdateData {
|
|
@@ -22,6 +23,15 @@ export interface EditorValues {
|
|
|
22
23
|
openPanel: (panelId: string) => void;
|
|
23
24
|
closePanel: () => void;
|
|
24
25
|
}
|
|
26
|
+
export type DSheetEditorHandle = WorkbookInstance & {
|
|
27
|
+
refreshIndexedDB: () => Promise<void>;
|
|
28
|
+
terminateSession: () => void;
|
|
29
|
+
updateCollaboratorName: (name: string) => void;
|
|
30
|
+
updateSessionTitle: (args: {
|
|
31
|
+
encryptedTitle: string;
|
|
32
|
+
documentTitle: string;
|
|
33
|
+
}) => void;
|
|
34
|
+
};
|
|
25
35
|
export interface PanelConfig {
|
|
26
36
|
id: string;
|
|
27
37
|
header: {
|
|
@@ -67,9 +77,23 @@ export interface DsheetProps {
|
|
|
67
77
|
onContentUpdate?: () => void;
|
|
68
78
|
onChange?: (updateData: SheetUpdateData, encodedUpdate?: string) => void;
|
|
69
79
|
collaboration?: CollaborationProps;
|
|
80
|
+
/** Called when local IndexedDB persistence fails. The editor and durable
|
|
81
|
+
* collaboration continue using the in-memory Y.Doc, matching dDoc. */
|
|
82
|
+
onIndexedDbError?: (error: Error) => void;
|
|
70
83
|
username?: string;
|
|
71
84
|
portalContent?: string;
|
|
72
85
|
isReadOnly?: boolean;
|
|
86
|
+
/** Permission status displayed above the toolbar. When omitted, read-only
|
|
87
|
+
* sheets retain the existing View/View-and-comment behavior. */
|
|
88
|
+
permissionMode?: DSheetPermissionMode;
|
|
89
|
+
/** Called when a read-only consumer asks to elevate to edit mode. The host
|
|
90
|
+
* owns access proof, loading, errors, and the resulting mode transition. */
|
|
91
|
+
onEnterEdit?: () => void;
|
|
92
|
+
/** Called when an invited commenter needs to authenticate before the host can
|
|
93
|
+
* recover comment capability. */
|
|
94
|
+
onSignInToComment?: () => void;
|
|
95
|
+
/** Lets the host toggle a recovered commenter between comment and view mode. */
|
|
96
|
+
onViewerModeChange?: (mode: 'comment' | 'view') => void;
|
|
73
97
|
allowSheetDownload?: boolean;
|
|
74
98
|
isTemplateOpen?: boolean;
|
|
75
99
|
selectedTemplate?: string;
|
|
@@ -80,9 +104,8 @@ export interface DsheetProps {
|
|
|
80
104
|
setForceSheetRender?: React.Dispatch<React.SetStateAction<number>>;
|
|
81
105
|
commentsConfig?: CommentsConfig;
|
|
82
106
|
toggleTemplateSidebar?: () => void;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}>;
|
|
107
|
+
/** Legacy ref prop. Standard React refs are also supported. */
|
|
108
|
+
sheetEditorRef?: React.Ref<DSheetEditorHandle>;
|
|
86
109
|
/** Override where datablock API keys are stored (default: localStorage). */
|
|
87
110
|
apiKeyStorage?: ApiKeyStorage;
|
|
88
111
|
/** Optional lifecycle events for analytics / side-effects. */
|
|
@@ -93,6 +116,9 @@ export interface DsheetProps {
|
|
|
93
116
|
* collab start/resume on 'synced' — starting before local content is fully
|
|
94
117
|
* synced is what let the RTC layer bind to a stale doc in the past. */
|
|
95
118
|
onContentSyncStatusChange?: (status: 'initializing' | 'syncing' | 'synced' | 'error') => void;
|
|
119
|
+
/** Fires once the first collaboration sync has been reconciled with the
|
|
120
|
+
* workbook, or when that reconciliation fails. */
|
|
121
|
+
onCollaborationInitializationComplete?: (result: 'ready' | 'error') => void;
|
|
96
122
|
editorStateRef?: React.MutableRefObject<{
|
|
97
123
|
refreshIndexedDB: () => Promise<void>;
|
|
98
124
|
getContentSnapshot: () => DSheetContentSnapshot;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a private data snapshot for the workbook. The workbook deep-freezes
|
|
3
|
+
* its input when storing it in Immer state, so passing currentDataRef directly
|
|
4
|
+
* would also freeze the Yjs-derived collaboration data. Later sync and comment
|
|
5
|
+
* marker updates would then throw when mutating that shared source. Cloning here
|
|
6
|
+
* keeps workbook state immutable while collaboration data remains mutable.
|
|
7
|
+
*/
|
|
8
|
+
export declare const detachWorkbookData: <T>(data: T) => T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { WorkbookInstance } from '../../sheet-engine/react';
|
|
3
|
+
import { DSheetEditorHandle } from '../types';
|
|
4
|
+
|
|
5
|
+
export type DSheetEditorMethods = Pick<DSheetEditorHandle, "refreshIndexedDB" | "terminateSession" | "updateCollaboratorName" | "updateSessionTitle">;
|
|
6
|
+
/**
|
|
7
|
+
* Compose Fortune's regenerated imperative handle with dSheet lifecycle methods.
|
|
8
|
+
* React callback refs invoke this again after every Workbook remount, so both
|
|
9
|
+
* standard forwarded refs and the legacy sheetEditorRef prop stay current.
|
|
10
|
+
*/
|
|
11
|
+
export declare const attachDSheetEditorHandle: (workbook: WorkbookInstance | null, methods: DSheetEditorMethods, refs: Array<Ref<DSheetEditorHandle> | undefined>) => DSheetEditorHandle | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|