@fileverse-dev/dsheet 0.0.14 → 0.0.16

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.
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+
3
+ /**
4
+ * ApiKeyModal component
5
+ *
6
+ * A modal dialog that prompts users to name their document before sharing it
7
+ */
8
+ export declare const ApiKeyModal: ({ openApiKeyModal, setOpenApiKeyModal, openApiKeyModalRef, contextApiKeyName, }: {
9
+ openApiKeyModal: boolean;
10
+ setOpenApiKeyModal: React.Dispatch<React.SetStateAction<boolean>>;
11
+ openApiKeyModalRef: React.MutableRefObject<boolean>;
12
+ contextApiKeyName: React.MutableRefObject<string | null>;
13
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { WorkbookInstance } from '@fileverse-dev/fortune-react';
2
+
3
+ export declare const OnboardingUI: ({ sheetEditorRef, }: {
4
+ sheetEditorRef: React.RefObject<WorkbookInstance | null>;
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,11 @@
1
- import { DsheetProp } from './types';
1
+ import { DsheetProps } from './types';
2
2
 
3
- declare const SpreadsheetEditor: import('react').ForwardRefExoticComponent<DsheetProp & import('react').RefAttributes<unknown>>;
3
+ /**
4
+ * SpreadsheetEditor component that provides a collaborative spreadsheet interface
5
+ * with various import/export capabilities and template support.
6
+ *
7
+ * @param props - Component properties
8
+ * @returns The SpreadsheetEditor component
9
+ */
10
+ declare const SpreadsheetEditor: ({ isCollaborative, isReadOnly, renderNavbar, initialSheetData, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, enableWebrtc, sheetEditorRef: externalSheetEditorRef, }: DsheetProps) => JSX.Element;
4
11
  export default SpreadsheetEditor;
@@ -0,0 +1,9 @@
1
+ import { Sheet } from '@fileverse-dev/fortune-core';
2
+ import { SheetUpdateData } from '../types';
3
+ import * as Y from 'yjs';
4
+ export declare const useSheetData: (ydoc: Y.Doc | null, dsheetId: string, onChange?: (updateData: SheetUpdateData, encodedUpdate?: string) => void) => {
5
+ sheetData: Sheet[] | null;
6
+ setSheetData: import('react').Dispatch<import('react').SetStateAction<Sheet[] | null>>;
7
+ currentDataRef: import('react').MutableRefObject<Sheet[] | null>;
8
+ remoteUpdateRef: import('react').MutableRefObject<boolean>;
9
+ };
@@ -0,0 +1,7 @@
1
+ import { WebsocketProvider } from 'y-websocket';
2
+ import { Awareness } from 'y-protocols/awareness';
3
+ import * as Y from 'yjs';
4
+ export declare const useWebRTCConnection: (ydoc: Y.Doc | null, dsheetId: string, username: string, enableWebrtc: boolean, portalContent: string) => {
5
+ webrtcProviderRef: import('react').MutableRefObject<WebsocketProvider | null>;
6
+ awarenessRef: import('react').MutableRefObject<Awareness | null>;
7
+ };
@@ -0,0 +1,6 @@
1
+ import { IndexeddbPersistence } from 'y-indexeddb';
2
+ import * as Y from 'yjs';
3
+ export declare const useYjsDocument: (dsheetId: string, enableIndexeddbSync: boolean, isReadOnly?: boolean) => {
4
+ ydocRef: import('react').MutableRefObject<Y.Doc | null>;
5
+ persistenceRef: import('react').MutableRefObject<IndexeddbPersistence | null>;
6
+ };
@@ -1,11 +1,22 @@
1
1
  import { Sheet } from '@fileverse-dev/fortune-core';
2
+ import { RefObject } from 'react';
3
+ import { WorkbookInstance } from '@fileverse-dev/fortune-react';
2
4
 
3
- export interface DsheetProp {
4
- renderNavbar?: () => JSX.Element;
5
+ import * as Y from 'yjs';
6
+ export interface SheetUpdateData {
7
+ data: Sheet[];
8
+ }
9
+ export interface EditorValues {
10
+ sheetEditorRef: RefObject<WorkbookInstance>;
11
+ currentDataRef: React.MutableRefObject<Sheet[] | null>;
12
+ ydocRef: React.RefObject<Y.Doc | null>;
13
+ }
14
+ export interface DsheetProps {
15
+ renderNavbar?: (editorValues?: EditorValues) => JSX.Element;
5
16
  initialSheetData?: Sheet[];
6
17
  enableIndexeddbSync?: boolean;
7
18
  dsheetId: string;
8
- onChange?: (updatedSheetContent: string, updateChunk: string) => void;
19
+ onChange?: (updateData: SheetUpdateData, encodedUpdate?: string) => void;
9
20
  username?: string;
10
21
  enableWebrtc?: boolean;
11
22
  portalContent?: string;
@@ -15,4 +26,5 @@ export interface DsheetProp {
15
26
  selectedTemplate?: string;
16
27
  setForceSheetRender?: React.Dispatch<React.SetStateAction<number>>;
17
28
  toggleTemplateSidebar?: () => void;
29
+ sheetEditorRef?: RefObject<WorkbookInstance>;
18
30
  }
@@ -1,7 +1,8 @@
1
1
  import { Sheet } from '@fileverse-dev/fortune-core';
2
- import { DsheetProp } from './types';
2
+ import { DsheetProps } from './types';
3
+
3
4
  import * as Y from 'yjs';
4
- export declare const useDsheetEditor: ({ initialSheetData, enableIndexeddbSync, dsheetId, onChange, username, enableWebrtc, portalContent, }: Partial<DsheetProp>) => {
5
+ export declare const useDsheetEditor: ({ enableIndexeddbSync, dsheetId, onChange, username, enableWebrtc, portalContent, sheetEditorRef: externalSheetEditorRef, initialSheetData, setForceSheetRender, isReadOnly, }: Partial<DsheetProps>) => {
5
6
  sheetEditorRef: import('react').RefObject<{
6
7
  applyOp: (ops: import('@fileverse-dev/fortune-core').Op[]) => void;
7
8
  getCellValue: (row: number, column: number, options?: import('@fileverse-dev/fortune-core/dist/api').CommonOptions & {
@@ -1,4 +1,17 @@
1
1
  import { Cell } from '@fileverse-dev/fortune-core';
2
2
  import { WorkbookInstance } from '@fileverse-dev/fortune-react';
3
3
 
4
- export declare const afterUpdateCell: (row: number, column: number, oldValue: Cell, newValue: Cell, sheetEditorRef: React.RefObject<WorkbookInstance | null>) => void;
4
+ /**
5
+ * Handles logic after a cell is updated, including processing formula results
6
+ *
7
+ * @param row - The row index of the updated cell
8
+ * @param column - The column index of the updated cell
9
+ * @param oldValue - The previous value of the cell
10
+ * @param newValue - The new value of the cell
11
+ * @param sheetEditorRef - Reference to the workbook instance
12
+ * @param setOpenApiKeyModal - Function to set the API key modal open state
13
+ * @param openApiKeyModalRef - Ref object tracking if the API key modal is open
14
+ * @param contextApiKeyName - Ref object for the current API key name context
15
+ * @returns {Promise<void>}
16
+ */
17
+ export declare const afterUpdateCell: (row: number, column: number, oldValue: Cell, newValue: Cell, sheetEditorRef: React.RefObject<WorkbookInstance | null>, setOpenApiKeyModal: React.Dispatch<React.SetStateAction<boolean>>, openApiKeyModalRef: React.MutableRefObject<boolean>, contextApiKeyName: React.MutableRefObject<string | null>) => Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { Sheet } from '@fileverse-dev/fortune-core';
2
+ import { WorkbookInstance } from '@fileverse-dev/fortune-react';
3
+ import * as Y from 'yjs';
4
+ export declare const updateSheetData: (ydoc: Y.Doc | null, dsheetId: string, data: Sheet[], sheetEditor: WorkbookInstance | null) => void;
5
+ export declare const formatSheetData: (data: Sheet[], preSheetArray: Sheet[], sheetEditor: WorkbookInstance) => Sheet[];