@fileverse-dev/dsheet 2.0.36-shortcut-2 → 2.0.36-shortcut-3
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/{constants-CnhOvijG.js → constants-yStXQJiK.js} +35 -14
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +6 -3
- package/dist/editor/components/collab-status-chip.d.ts +8 -0
- package/dist/editor/contexts/editor-context.d.ts +15 -5
- package/dist/editor/dsheet-editor.d.ts +1 -1
- package/dist/editor/hooks/use-collab-awareness.d.ts +17 -0
- package/dist/editor/hooks/use-editor-data.d.ts +2 -1
- package/dist/editor/hooks/use-editor-sync.d.ts +9 -6
- package/dist/editor/types.d.ts +2 -2
- package/dist/editor/utils/after-update-cell.d.ts +12 -0
- package/dist/editor/utils/formula-ui-sync.d.ts +3 -1
- package/dist/editor/utils/remote-apply-guard.d.ts +19 -0
- package/dist/{executeStringFunction-6r6Tl4Z6.js → executeStringFunction-tdvZ0KTi.js} +4646 -4612
- package/dist/formula.js +1 -1
- package/dist/index-D_IxoHMJ.js +52167 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +46 -41
- package/dist/sheet-engine/core/api/cell.d.ts +21 -0
- package/dist/sheet-engine/core/events/index.d.ts +1 -0
- package/dist/sheet-engine/core/events/keyboard-shortcut-utils.d.ts +61 -0
- package/dist/sheet-engine/core/index.d.ts +2 -2
- package/dist/sheet-engine/core/modules/filter.d.ts +13 -0
- package/dist/sheet-engine/core/modules/index.d.ts +2 -2
- package/dist/sheet-engine/core/modules/selection.d.ts +1 -0
- package/dist/sheet-engine/core/modules/zoom.d.ts +0 -1
- package/dist/sheet-engine/core/settings.d.ts +3 -0
- package/dist/sheet-engine/core/types.d.ts +1 -0
- package/dist/sheet-engine/react/components/Workbook/api.d.ts +23 -0
- package/dist/sheet-engine/react/components/Workbook/index.d.ts +15 -0
- package/dist/style.css +1 -1
- package/dist/sync-local/SyncManager.d.ts +69 -0
- package/dist/sync-local/collabStateMachine.d.ts +23 -0
- package/dist/sync-local/crypto/index.d.ts +6 -0
- package/dist/sync-local/index.d.ts +3 -0
- package/dist/sync-local/socketClient.d.ts +68 -0
- package/dist/sync-local/types/index.d.ts +212 -0
- package/dist/sync-local/useSyncManager.d.ts +12 -0
- package/dist/sync-local/utils/createAwarenessUpdateHandler.d.ts +8 -0
- package/dist/sync-local/utils/objectToFile.d.ts +1 -0
- package/dist/{use-xlsx-import-impl-CKG0a1fz.js → use-xlsx-import-impl-AI2QDZt1.js} +2 -2
- package/dist/{xlsx-export-impl-BLKOiPKJ.js → xlsx-export-impl-Buly1jC6.js} +293 -295
- package/package.json +13 -9
- package/dist/editor/hooks/use-editor-collaboration.d.ts +0 -9
- package/dist/index-DXRs6xeV.js +0 -40363
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
const
|
|
1
|
+
import { E as n, S as a } from "./crypto-constants-CqpCRs86.js";
|
|
2
|
+
const E = n, d = a, f = [
|
|
3
3
|
{
|
|
4
4
|
id: "0",
|
|
5
5
|
name: "Sheet1",
|
|
@@ -9,7 +9,7 @@ const o = e, a = t, l = [
|
|
|
9
9
|
row: 500,
|
|
10
10
|
column: 26
|
|
11
11
|
}
|
|
12
|
-
],
|
|
12
|
+
], m = [
|
|
13
13
|
"undo",
|
|
14
14
|
"redo",
|
|
15
15
|
"format-painter",
|
|
@@ -47,7 +47,7 @@ const o = e, a = t, l = [
|
|
|
47
47
|
"quick-formula",
|
|
48
48
|
"dataVerification",
|
|
49
49
|
"search"
|
|
50
|
-
],
|
|
50
|
+
], u = [
|
|
51
51
|
"cut",
|
|
52
52
|
"copy",
|
|
53
53
|
"paste",
|
|
@@ -84,7 +84,7 @@ const o = e, a = t, l = [
|
|
|
84
84
|
"freeze-row",
|
|
85
85
|
"|",
|
|
86
86
|
"clear-format"
|
|
87
|
-
],
|
|
87
|
+
], S = [
|
|
88
88
|
"cut",
|
|
89
89
|
"copy",
|
|
90
90
|
"paste",
|
|
@@ -121,20 +121,41 @@ const o = e, a = t, l = [
|
|
|
121
121
|
"freeze-column",
|
|
122
122
|
"|",
|
|
123
123
|
"clear-format"
|
|
124
|
-
],
|
|
124
|
+
], _ = {
|
|
125
125
|
height: null,
|
|
126
126
|
isShow: !1,
|
|
127
127
|
left: null,
|
|
128
128
|
top: null,
|
|
129
129
|
value: "",
|
|
130
130
|
width: null
|
|
131
|
-
}
|
|
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
|
+
}
|
|
132
150
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
|
140
161
|
};
|
package/dist/constants.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
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,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as R, c as _, E as C, S as a, p as s } from "./constants-yStXQJiK.js";
|
|
2
2
|
export {
|
|
3
|
-
R as
|
|
4
|
-
_ as
|
|
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
|
|
5
8
|
};
|
|
@@ -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, CollabUser } 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,16 @@ 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
|
-
|
|
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;
|
|
42
50
|
handleLiveQuery: (subsheetIndex: number, data: LiveQueryData) => void;
|
|
43
51
|
}
|
|
44
52
|
interface EditorProviderProps {
|
|
@@ -53,14 +61,16 @@ interface EditorProviderProps {
|
|
|
53
61
|
username?: string;
|
|
54
62
|
portalContent?: string;
|
|
55
63
|
enableIndexeddbSync?: boolean;
|
|
56
|
-
enableWebrtc?: boolean;
|
|
57
64
|
isReadOnly?: boolean;
|
|
58
65
|
onChange?: (data: SheetUpdateData, encodedUpdate?: string) => void;
|
|
66
|
+
collaboration?: CollaborationProps;
|
|
59
67
|
externalEditorRef?: React.MutableRefObject<WorkbookInstance | null>;
|
|
60
|
-
isCollaborative?: boolean;
|
|
61
68
|
commentData?: object;
|
|
62
69
|
editorStateRef?: React.MutableRefObject<{
|
|
63
70
|
refreshIndexedDB: () => Promise<void>;
|
|
71
|
+
terminateSession?: () => void;
|
|
72
|
+
updateCollaboratorName?: (name: string) => void;
|
|
73
|
+
rehydrateAfterCollabSync?: (reason?: string) => boolean;
|
|
64
74
|
} | null>;
|
|
65
75
|
enableLiveQuery?: boolean;
|
|
66
76
|
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: ({
|
|
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,17 @@
|
|
|
1
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
2
|
+
import { WorkbookInstance } from '../../sheet-engine/react';
|
|
3
|
+
import { CollabUser } from '../../sync-local/types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reads remote cursor positions from Yjs awareness and keeps Fortune sheet's
|
|
7
|
+
* native presence list in sync. Fortune renders colored cell borders + username
|
|
8
|
+
* labels automatically via context.presences[].
|
|
9
|
+
*
|
|
10
|
+
* Also emits the full collaborator list (including the local user) via
|
|
11
|
+
* `onCollaboratorsChange` so host apps can render navbar chips. This mirrors
|
|
12
|
+
* ddoc's editor-layer awareness handler, which maps awareness.states →
|
|
13
|
+
* `{ clientId, ...user }` and fires on every awareness update + once on mount.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useCollabAwareness: (awareness: Awareness | null | undefined, sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>, onCollaboratorsChange?: (collaborators: CollabUser[]) => void) => {
|
|
16
|
+
localColor: "#30bced" | "#6eeb83" | "#fa69d1" | "#ecd444" | "#ee6352" | "#db3041" | "#0ad7f2" | "#1bff39";
|
|
17
|
+
};
|
|
@@ -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, collabEnabled?: boolean) => {
|
|
18
18
|
sheetData: Sheet[];
|
|
19
19
|
setSheetData: import('react').Dispatch<import('react').SetStateAction<Sheet[]>>;
|
|
20
20
|
currentDataRef: import('react').MutableRefObject<Sheet[]>;
|
|
@@ -24,4 +24,5 @@ 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;
|
|
27
28
|
};
|
|
@@ -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" | "
|
|
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
|
};
|
package/dist/editor/types.d.ts
CHANGED
|
@@ -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`). */
|
|
@@ -41,7 +41,19 @@ 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>;
|
|
44
48
|
}
|
|
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;
|
|
45
57
|
export declare const isDatablockError: (value: any) => boolean;
|
|
46
58
|
/**
|
|
47
59
|
* Handles logic after a cell is updated, including processing formula results
|
|
@@ -7,10 +7,12 @@ 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[];
|
|
10
12
|
};
|
|
11
13
|
export declare function isUsdValue(str: string): boolean;
|
|
12
14
|
export declare const USD_FA: string;
|
|
13
|
-
export declare const formulaResponseUiSync: ({ row, column, newValue, apiData, sheetEditorRef, shouldIgnoreUsdValue, }: FormulaSyncType) => void;
|
|
15
|
+
export declare const formulaResponseUiSync: ({ row, column, newValue, apiData, sheetEditorRef, shouldIgnoreUsdValue, staticLinesAbove, }: FormulaSyncType) => void;
|
|
14
16
|
export declare const getCellClone: (r: number, c: number, sheetEditorRef: React.RefObject<WorkbookInstance | null>) => {
|
|
15
17
|
v?: string | number | boolean;
|
|
16
18
|
m?: string | number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Scoped guard for RTC remote → local apply.
|
|
5
|
+
*
|
|
6
|
+
* `remoteUpdateRef` used to stay true for seconds (holdRemoteApplyLock), which
|
|
7
|
+
* blocked real user metadata writes via guardRemoteEcho. Depth tracks only the
|
|
8
|
+
* synchronous remote-apply window (plus one paint for structural remounts).
|
|
9
|
+
*/
|
|
10
|
+
export type RemoteApplyGuardRefs = {
|
|
11
|
+
remoteApplyDepthRef: MutableRefObject<number>;
|
|
12
|
+
remoteUpdateRef: MutableRefObject<boolean>;
|
|
13
|
+
};
|
|
14
|
+
export declare function syncRemoteUpdateFlag(refs: RemoteApplyGuardRefs): void;
|
|
15
|
+
export declare function beginRemoteApply(refs: RemoteApplyGuardRefs): void;
|
|
16
|
+
export declare function endRemoteApply(refs: RemoteApplyGuardRefs): void;
|
|
17
|
+
export declare function runUnderRemoteApply(refs: RemoteApplyGuardRefs, fn: () => void): void;
|
|
18
|
+
/** End after Workbook remount hooks have flushed (2 rAF ≈ one paint). */
|
|
19
|
+
export declare function endRemoteApplyAfterPaint(refs: RemoteApplyGuardRefs): void;
|