@fileverse-dev/dsheet 4.0.5-edit-mode-4 → 4.0.5-edit-mode-6

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.
@@ -25,6 +25,7 @@ interface EditorWorkbookProps {
25
25
  sidebarPortalRegistry?: SidebarPortalRegistryHandle | null;
26
26
  sidebarPortalRenderers?: Record<string, SidebarPortalRenderer>;
27
27
  permissionMode?: DSheetPermissionMode | null;
28
+ onEnterEdit?: () => void;
28
29
  theme?: ThemeKey;
29
30
  }
30
31
  export declare const EditorWorkbook: React.NamedExoticComponent<EditorWorkbookProps>;
@@ -13,6 +13,10 @@ export declare const getPermissionChipConfig: (mode: DSheetPermissionMode) => {
13
13
  readonly label: "Edit";
14
14
  readonly modifier: "edit";
15
15
  };
16
+ export declare const canShowEditElevation: ({ mode, onEnterEdit, }: {
17
+ mode: DSheetPermissionMode;
18
+ onEnterEdit?: () => void;
19
+ }) => boolean;
16
20
  export declare const resolvePermissionChipMode: ({ allowComments, isReadOnly, permissionMode, }: {
17
21
  allowComments: boolean;
18
22
  isReadOnly: boolean;
@@ -3,6 +3,7 @@ import { DSheetPermissionMode } from '../types';
3
3
 
4
4
  interface PermissionChipProps {
5
5
  mode: DSheetPermissionMode;
6
+ onEnterEdit?: () => void;
6
7
  }
7
8
  export declare const PermissionChip: React.FC<PermissionChipProps>;
8
9
  export {};
@@ -11,7 +11,7 @@ import { CollaborationProps, CollabState, CollabUser } from '../../sync-local/ty
11
11
  import { Awareness } from 'y-protocols/awareness';
12
12
  import { DSheetContentSnapshot } from '../../persistence';
13
13
 
14
- import * as Y from "yjs";
14
+ import * as Y from 'yjs';
15
15
  export interface EditorContextType {
16
16
  setIsDataLoaded: React.Dispatch<React.SetStateAction<boolean>>;
17
17
  handleOnChangePortalUpdate: () => void;
@@ -44,7 +44,7 @@ export interface EditorContextType {
44
44
  loading: boolean;
45
45
  forceSheetRender: number;
46
46
  setForceSheetRender: React.Dispatch<React.SetStateAction<number>>;
47
- syncStatus: "initializing" | "syncing" | "synced" | "error";
47
+ syncStatus: 'initializing' | 'syncing' | 'synced' | 'error';
48
48
  collabEnabled?: boolean;
49
49
  isLiveCollabSession: boolean;
50
50
  collabIsOwner?: boolean;
@@ -101,7 +101,7 @@ interface EditorProviderProps {
101
101
  apiKeyStorage?: ApiKeyStorage;
102
102
  onDataBlockEvent?: (event: DataBlockEvent) => void;
103
103
  smartContracts?: SmartContractConfig;
104
- onContentSyncStatusChange?: (status: "initializing" | "syncing" | "synced" | "error") => void;
104
+ onContentSyncStatusChange?: (status: 'initializing' | 'syncing' | 'synced' | 'error') => void;
105
105
  onIndexedDbError?: (error: Error) => void;
106
106
  }
107
107
  export declare const EditorProvider: React.FC<EditorProviderProps>;
@@ -1,6 +1,6 @@
1
1
  import { IndexeddbPersistence } from 'y-indexeddb';
2
2
  import { CollaborationProps } from '../../sync-local/types';
3
- import * as Y from "yjs";
3
+ import * as Y from 'yjs';
4
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>;
@@ -8,9 +8,9 @@ import { ApiKeyStorage } from './utils/api-key-storage';
8
8
  import { ThemeKey } from '../sheet-engine/core/theme';
9
9
  import { DSheetContentSnapshot } from '../persistence';
10
10
 
11
- import * as Y from "yjs";
11
+ import * as Y from 'yjs';
12
12
  export type { ThemeKey } from '../sheet-engine/core/theme';
13
- export type DSheetPermissionMode = "view" | "comment" | "edit";
13
+ export type DSheetPermissionMode = 'view' | 'comment' | 'edit';
14
14
  export type { CommentThread, CommentReply, CommentActionParams, CommentsConfig, } from './types/comments';
15
15
  export { CommentAction } from './types/comments';
16
16
  export interface SheetUpdateData {
@@ -50,7 +50,7 @@ export type OnboardingHandlerType = (params: {
50
50
  row: number;
51
51
  column: number;
52
52
  };
53
- export type DataBlockEventType = "success" | "error" | "api-key-required" | "api-key-saved" | "retry";
53
+ export type DataBlockEventType = 'success' | 'error' | 'api-key-required' | 'api-key-saved' | 'retry';
54
54
  export interface DataBlockEvent {
55
55
  type: DataBlockEventType;
56
56
  functionName?: string;
@@ -86,6 +86,9 @@ export interface DsheetProps {
86
86
  /** Permission status displayed above the toolbar. When omitted, read-only
87
87
  * sheets retain the existing View/View-and-comment behavior. */
88
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;
89
92
  allowSheetDownload?: boolean;
90
93
  isTemplateOpen?: boolean;
91
94
  selectedTemplate?: string;
@@ -107,7 +110,7 @@ export interface DsheetProps {
107
110
  /** Fires whenever local content-sync status changes. Host apps should gate
108
111
  * collab start/resume on 'synced' — starting before local content is fully
109
112
  * synced is what let the RTC layer bind to a stale doc in the past. */
110
- onContentSyncStatusChange?: (status: "initializing" | "syncing" | "synced" | "error") => void;
113
+ onContentSyncStatusChange?: (status: 'initializing' | 'syncing' | 'synced' | 'error') => void;
111
114
  editorStateRef?: React.MutableRefObject<{
112
115
  refreshIndexedDB: () => Promise<void>;
113
116
  getContentSnapshot: () => DSheetContentSnapshot;