@fileverse-dev/dsheet 2.0.33-rtc-g → 2.0.34-smb

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 (36) hide show
  1. package/dist/{constants-yStXQJiK.js → constants-CnhOvijG.js} +14 -35
  2. package/dist/constants.d.ts +0 -4
  3. package/dist/constants.js +3 -6
  4. package/dist/editor/contexts/editor-context.d.ts +5 -13
  5. package/dist/editor/dsheet-editor.d.ts +1 -1
  6. package/dist/editor/hooks/use-editor-collaboration.d.ts +9 -0
  7. package/dist/editor/hooks/use-editor-data.d.ts +1 -1
  8. package/dist/editor/hooks/use-editor-sync.d.ts +6 -9
  9. package/dist/editor/types.d.ts +2 -2
  10. package/dist/{executeStringFunction-9cGLblM5.js → executeStringFunction-DmSriw-r.js} +222 -242
  11. package/dist/formula.js +1 -1
  12. package/dist/index-K5wvW66i.js +40192 -0
  13. package/dist/index.d.ts +0 -2
  14. package/dist/index.es.js +29 -30
  15. package/dist/sheet-engine/core/index.d.ts +1 -1
  16. package/dist/sheet-engine/core/modules/index.d.ts +1 -1
  17. package/dist/sheet-engine/core/settings.d.ts +1 -2
  18. package/dist/sheet-engine/core/types.d.ts +0 -1
  19. package/dist/sheet-engine/react/constants.d.ts +12 -2
  20. package/dist/sheet-engine/react/utils/convertCellsToCrypto.d.ts +1 -1
  21. package/dist/style.css +1 -1
  22. package/dist/{use-xlsx-import-impl-BknTr9B-.js → use-xlsx-import-impl-CVZz9FqM.js} +2 -2
  23. package/dist/{xlsx-export-impl-DVg8rluj.js → xlsx-export-impl-C7VFyndH.js} +295 -293
  24. package/package.json +10 -14
  25. package/dist/editor/components/collab-status-chip.d.ts +0 -8
  26. package/dist/editor/hooks/use-collab-awareness.d.ts +0 -17
  27. package/dist/index-DJ9rTJnP.js +0 -50816
  28. package/dist/sync-local/SyncManager.d.ts +0 -67
  29. package/dist/sync-local/collabStateMachine.d.ts +0 -23
  30. package/dist/sync-local/crypto/index.d.ts +0 -6
  31. package/dist/sync-local/index.d.ts +0 -3
  32. package/dist/sync-local/socketClient.d.ts +0 -68
  33. package/dist/sync-local/types/index.d.ts +0 -211
  34. package/dist/sync-local/useSyncManager.d.ts +0 -12
  35. package/dist/sync-local/utils/createAwarenessUpdateHandler.d.ts +0 -8
  36. package/dist/sync-local/utils/objectToFile.d.ts +0 -1
@@ -1,5 +1,5 @@
1
- import { E as n, S as a } from "./crypto-constants-CqpCRs86.js";
2
- const E = n, d = a, f = [
1
+ import { E as e, S as t } from "./crypto-constants-CqpCRs86.js";
2
+ const o = e, a = t, l = [
3
3
  {
4
4
  id: "0",
5
5
  name: "Sheet1",
@@ -9,7 +9,7 @@ const E = n, d = a, f = [
9
9
  row: 500,
10
10
  column: 26
11
11
  }
12
- ], m = [
12
+ ], c = [
13
13
  "undo",
14
14
  "redo",
15
15
  "format-painter",
@@ -47,7 +47,7 @@ const E = n, d = a, f = [
47
47
  "quick-formula",
48
48
  "dataVerification",
49
49
  "search"
50
- ], u = [
50
+ ], n = [
51
51
  "cut",
52
52
  "copy",
53
53
  "paste",
@@ -84,7 +84,7 @@ const E = n, d = a, f = [
84
84
  "freeze-row",
85
85
  "|",
86
86
  "clear-format"
87
- ], S = [
87
+ ], i = [
88
88
  "cut",
89
89
  "copy",
90
90
  "paste",
@@ -121,41 +121,20 @@ const E = n, d = a, f = [
121
121
  "freeze-column",
122
122
  "|",
123
123
  "clear-format"
124
- ], _ = {
124
+ ], s = {
125
125
  height: null,
126
126
  isShow: !1,
127
127
  left: null,
128
128
  top: null,
129
129
  value: "",
130
130
  width: null
131
- }, l = "#5298FF", r = [
132
- "#30bced",
133
- "#6eeb83",
134
- "#fa69d1",
135
- "#ecd444",
136
- "#ee6352",
137
- "#db3041",
138
- "#0ad7f2",
139
- "#1bff39"
140
- ];
141
- function c(e) {
142
- return r[e % r.length];
143
- }
144
- function i() {
145
- return "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
146
- }
147
- function h(e, o, t) {
148
- return e ? l : o ?? (t != null ? c(t) : i());
149
- }
131
+ };
150
132
  export {
151
- _ as C,
152
- f as D,
153
- E,
154
- S as H,
155
- d as S,
156
- m as T,
157
- r as a,
158
- u as b,
159
- l as c,
160
- h as p
133
+ s as C,
134
+ l as D,
135
+ o as E,
136
+ i as H,
137
+ a as S,
138
+ c as T,
139
+ n as a
161
140
  };
@@ -1,5 +1 @@
1
1
  export { ERROR_MESSAGES_FLAG, SERVICES_API_KEY, } from './editor/constants/shared-constants';
2
- export declare const ENS_PRESENCE_COLOR = "#5298FF";
3
- export declare const COLLAB_PRESENCE_COLORS: readonly ["#30bced", "#6eeb83", "#fa69d1", "#ecd444", "#ee6352", "#db3041", "#0ad7f2", "#1bff39"];
4
- /** ENS brand color, else `color`, else palette by `clientId`, else random. */
5
- export declare function presenceColor(isEns: boolean | undefined, color?: string, clientId?: number): string;
package/dist/constants.js CHANGED
@@ -1,8 +1,5 @@
1
- import { a as R, c as _, E as C, S as a, p as s } from "./constants-yStXQJiK.js";
1
+ import { E as R, S as _ } from "./constants-CnhOvijG.js";
2
2
  export {
3
- R as COLLAB_PRESENCE_COLORS,
4
- _ as ENS_PRESENCE_COLOR,
5
- C as ERROR_MESSAGES_FLAG,
6
- a as SERVICES_API_KEY,
7
- s as presenceColor
3
+ R as ERROR_MESSAGES_FLAG,
4
+ _ as SERVICES_API_KEY
8
5
  };
@@ -2,8 +2,6 @@ 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, CollabUser } from '../../sync-local/types';
6
- import { Awareness } from 'y-protocols/awareness';
7
5
 
8
6
  import * as Y from 'yjs';
9
7
  export interface EditorContextType {
@@ -37,15 +35,10 @@ export interface EditorContextType {
37
35
  loading: boolean;
38
36
  forceSheetRender: number;
39
37
  setForceSheetRender: React.Dispatch<React.SetStateAction<number>>;
38
+ activeUsers: string[];
39
+ collaborationStatus: 'disconnected' | 'connecting' | 'connected' | 'error';
40
40
  syncStatus: 'initializing' | 'syncing' | 'synced' | 'error';
41
- collabEnabled?: boolean;
42
- collabState?: CollabState;
43
- isCollabReady?: boolean;
44
- isCollabSyncing?: boolean;
45
- hasCollabContentInitialised?: boolean;
46
- awareness?: Awareness | null;
47
- terminateSession?: () => void;
48
- onCollaboratorsChange?: (collaborators: CollabUser[]) => void;
41
+ isCollaborative?: boolean;
49
42
  handleLiveQuery: (subsheetIndex: number, data: LiveQueryData) => void;
50
43
  }
51
44
  interface EditorProviderProps {
@@ -60,15 +53,14 @@ interface EditorProviderProps {
60
53
  username?: string;
61
54
  portalContent?: string;
62
55
  enableIndexeddbSync?: boolean;
56
+ enableWebrtc?: boolean;
63
57
  isReadOnly?: boolean;
64
58
  onChange?: (data: SheetUpdateData, encodedUpdate?: string) => void;
65
- collaboration?: CollaborationProps;
66
59
  externalEditorRef?: React.MutableRefObject<WorkbookInstance | null>;
60
+ isCollaborative?: boolean;
67
61
  commentData?: object;
68
62
  editorStateRef?: React.MutableRefObject<{
69
63
  refreshIndexedDB: () => Promise<void>;
70
- terminateSession?: () => void;
71
- updateCollaboratorName?: (name: string) => void;
72
64
  } | null>;
73
65
  enableLiveQuery?: boolean;
74
66
  liveQueryRefreshRate?: number;
@@ -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: ({ 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;
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;
11
11
  export default SpreadsheetEditor;
@@ -0,0 +1,9 @@
1
+ import * as Y from 'yjs';
2
+ /**
3
+ * Hook for setting up WebRTC-based collaboration
4
+ * Handles real-time synchronization between peers
5
+ */
6
+ export declare const useEditorCollaboration: (ydoc: Y.Doc | null, dsheetId: string, username?: string, enableWebrtc?: boolean, signalData?: string) => {
7
+ collaborationStatus: "error" | "disconnected" | "connecting" | "connected";
8
+ activeUsers: string[];
9
+ };
@@ -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, hasCollabContentInitialised?: boolean, collabEnabled?: boolean) => {
17
+ }>>, enableLiveQuery?: boolean, liveQueryRefreshRate?: number, dataBlockApiKeyHandler?: DataBlockApiKeyHandlerType, allowComments?: boolean) => {
18
18
  sheetData: Sheet[];
19
19
  setSheetData: import('react').Dispatch<import('react').SetStateAction<Sheet[]>>;
20
20
  currentDataRef: import('react').MutableRefObject<Sheet[]>;
@@ -1,16 +1,13 @@
1
1
  import { IndexeddbPersistence } from 'y-indexeddb';
2
- import { CollaborationProps } from '../../sync-local/types';
3
2
  import * as Y from 'yjs';
4
- export declare const useEditorSync: (dsheetId: string, enableIndexeddbSync?: boolean, isReadOnly?: boolean, collaboration?: CollaborationProps, onCollabUpdate?: (fullState: string, updateChunk: string) => void) => {
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) => {
5
8
  ydocRef: import('react').MutableRefObject<Y.Doc | null>;
6
9
  persistenceRef: import('react').MutableRefObject<IndexeddbPersistence | null>;
7
- syncStatus: "error" | "syncing" | "initializing" | "synced";
10
+ syncStatus: "error" | "initializing" | "syncing" | "synced";
8
11
  isSyncedRef: import('react').MutableRefObject<boolean>;
9
12
  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;
16
13
  };
@@ -2,7 +2,6 @@ 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';
6
5
 
7
6
  import * as Y from 'yjs';
8
7
  export interface SheetUpdateData {
@@ -56,12 +55,13 @@ export interface DsheetProps {
56
55
  enableIndexeddbSync?: boolean;
57
56
  dsheetId: string;
58
57
  onChange?: (updateData: SheetUpdateData, encodedUpdate?: string) => void;
59
- collaboration?: CollaborationProps;
60
58
  username?: string;
59
+ enableWebrtc?: boolean;
61
60
  portalContent?: string;
62
61
  isReadOnly?: boolean;
63
62
  allowSheetDownload?: boolean;
64
63
  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`). */