@fileverse-dev/dsheet 2.0.36-rtc-9 → 2.0.36-shortcut

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 (43) 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 -15
  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 -2
  8. package/dist/editor/hooks/use-editor-sync.d.ts +6 -9
  9. package/dist/editor/types.d.ts +2 -2
  10. package/dist/editor/utils/after-update-cell.d.ts +0 -12
  11. package/dist/editor/utils/formula-ui-sync.d.ts +1 -3
  12. package/dist/{executeStringFunction-F9mb-SpN.js → executeStringFunction-6r6Tl4Z6.js} +4593 -4546
  13. package/dist/formula.js +1 -1
  14. package/dist/index-CYIKZDtd.js +40340 -0
  15. package/dist/index.d.ts +0 -2
  16. package/dist/index.es.js +35 -36
  17. package/dist/sheet-engine/core/api/cell.d.ts +0 -21
  18. package/dist/sheet-engine/core/events/shortcuts-v2.d.ts +7 -0
  19. package/dist/sheet-engine/core/index.d.ts +1 -1
  20. package/dist/sheet-engine/core/modules/filter.d.ts +0 -13
  21. package/dist/sheet-engine/core/modules/index.d.ts +1 -1
  22. package/dist/sheet-engine/core/modules/selection.d.ts +7 -0
  23. package/dist/sheet-engine/core/settings.d.ts +0 -3
  24. package/dist/sheet-engine/core/types.d.ts +0 -1
  25. package/dist/sheet-engine/react/components/Workbook/api.d.ts +0 -23
  26. package/dist/sheet-engine/react/components/Workbook/index.d.ts +0 -15
  27. package/dist/style.css +1 -1
  28. package/dist/{use-xlsx-import-impl-CxD2NAQy.js → use-xlsx-import-impl-DczoKg4D.js} +2 -2
  29. package/dist/{xlsx-export-impl-Dg1hG0qJ.js → xlsx-export-impl-BLKOiPKJ.js} +295 -293
  30. package/package.json +11 -14
  31. package/dist/editor/components/collab-status-chip.d.ts +0 -8
  32. package/dist/editor/hooks/use-collab-awareness.d.ts +0 -17
  33. package/dist/editor/utils/remote-apply-guard.d.ts +0 -19
  34. package/dist/index-BTXKOfeE.js +0 -51898
  35. package/dist/sync-local/SyncManager.d.ts +0 -69
  36. package/dist/sync-local/collabStateMachine.d.ts +0 -23
  37. package/dist/sync-local/crypto/index.d.ts +0 -6
  38. package/dist/sync-local/index.d.ts +0 -3
  39. package/dist/sync-local/socketClient.d.ts +0 -68
  40. package/dist/sync-local/types/index.d.ts +0 -211
  41. package/dist/sync-local/useSyncManager.d.ts +0 -12
  42. package/dist/sync-local/utils/createAwarenessUpdateHandler.d.ts +0 -8
  43. 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,16 +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
- collabIsOwner?: boolean;
43
- collabState?: CollabState;
44
- isCollabReady?: boolean;
45
- isCollabSyncing?: boolean;
46
- hasCollabContentInitialised?: boolean;
47
- awareness?: Awareness | null;
48
- terminateSession?: () => void;
49
- onCollaboratorsChange?: (collaborators: CollabUser[]) => void;
41
+ isCollaborative?: boolean;
50
42
  handleLiveQuery: (subsheetIndex: number, data: LiveQueryData) => void;
51
43
  }
52
44
  interface EditorProviderProps {
@@ -61,16 +53,14 @@ interface EditorProviderProps {
61
53
  username?: string;
62
54
  portalContent?: string;
63
55
  enableIndexeddbSync?: boolean;
56
+ enableWebrtc?: boolean;
64
57
  isReadOnly?: boolean;
65
58
  onChange?: (data: SheetUpdateData, encodedUpdate?: string) => void;
66
- collaboration?: CollaborationProps;
67
59
  externalEditorRef?: React.MutableRefObject<WorkbookInstance | null>;
60
+ isCollaborative?: boolean;
68
61
  commentData?: object;
69
62
  editorStateRef?: React.MutableRefObject<{
70
63
  refreshIndexedDB: () => Promise<void>;
71
- terminateSession?: () => void;
72
- updateCollaboratorName?: (name: string) => void;
73
- rehydrateAfterCollabSync?: (reason?: string) => boolean;
74
64
  } | null>;
75
65
  enableLiveQuery?: boolean;
76
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[]>;
@@ -24,5 +24,4 @@ export declare const useEditorData: (ydocRef: React.MutableRefObject<Y.Doc | nul
24
24
  handleChange: (_data: Sheet[]) => void;
25
25
  handleLiveQuery: (subsheetIndex: number, queryData: import('../../sheet-engine/react').LiveQueryData) => void;
26
26
  initialiseLiveQueryData: (sheets: Sheet[]) => void;
27
- rehydrateWorkbookFromYdoc: (reason?: string) => boolean;
28
27
  };
@@ -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`). */
@@ -41,19 +41,7 @@ interface AfterUpdateCellParams {
41
41
  [key: string]: any;
42
42
  };
43
43
  };
44
- collabEnabled?: boolean;
45
- collabIsOwner?: boolean;
46
- remoteUpdateRef?: React.MutableRefObject<boolean>;
47
- localUserEditRef?: React.MutableRefObject<boolean>;
48
44
  }
49
- /** True when data-block formulas (API / smart contract) should run for this edit. */
50
- export declare const shouldExecuteDataBlocks: (params: {
51
- collabEnabled?: boolean;
52
- collabIsOwner?: boolean;
53
- remoteUpdateRef?: React.MutableRefObject<boolean>;
54
- localUserEditRef?: React.MutableRefObject<boolean>;
55
- sheetEditorRef: React.RefObject<WorkbookInstance | null>;
56
- }) => boolean;
57
45
  export declare const isDatablockError: (value: any) => boolean;
58
46
  /**
59
47
  * Handles logic after a cell is updated, including processing formula results
@@ -7,12 +7,10 @@ export type FormulaSyncType = {
7
7
  apiData: Array<Record<string, object>> | Array<Array<string>>;
8
8
  sheetEditorRef: React.RefObject<WorkbookInstance | null>;
9
9
  shouldIgnoreUsdValue?: boolean;
10
- /** Instruction lines rendered above the formula table (synced to Yjs). */
11
- staticLinesAbove?: string[];
12
10
  };
13
11
  export declare function isUsdValue(str: string): boolean;
14
12
  export declare const USD_FA: string;
15
- export declare const formulaResponseUiSync: ({ row, column, newValue, apiData, sheetEditorRef, shouldIgnoreUsdValue, staticLinesAbove, }: FormulaSyncType) => void;
13
+ export declare const formulaResponseUiSync: ({ row, column, newValue, apiData, sheetEditorRef, shouldIgnoreUsdValue, }: FormulaSyncType) => void;
16
14
  export declare const getCellClone: (r: number, c: number, sheetEditorRef: React.RefObject<WorkbookInstance | null>) => {
17
15
  v?: string | number | boolean;
18
16
  m?: string | number;