@fileverse-dev/dsheet 2.0.33-rtc-d → 2.0.33-rtc-e

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.
@@ -2,7 +2,7 @@ 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 } from '../../sync-local/types';
5
+ import { CollaborationProps, CollabState, CollabUser } from '../../sync-local/types';
6
6
  import { Awareness } from 'y-protocols/awareness';
7
7
 
8
8
  import * as Y from 'yjs';
@@ -45,6 +45,10 @@ export interface EditorContextType {
45
45
  hasCollabContentInitialised?: boolean;
46
46
  awareness?: Awareness | null;
47
47
  terminateSession?: () => void;
48
+ onCollaboratorsChange?: (collaborators: CollabUser[]) => void;
49
+ /** Attach collab methods to the WorkbookInstance — must be called from a
50
+ * callback ref so we re-attach every time Workbook regenerates its handle. */
51
+ augmentEditorRef?: (instance: WorkbookInstance | null) => void;
48
52
  handleLiveQuery: (subsheetIndex: number, data: LiveQueryData) => void;
49
53
  }
50
54
  interface EditorProviderProps {
@@ -1,11 +1,17 @@
1
1
  import { Awareness } from 'y-protocols/awareness';
2
2
  import { WorkbookInstance } from '../../sheet-engine/react';
3
+ import { CollabUser } from '../../sync-local/types';
3
4
 
4
5
  /**
5
6
  * Reads remote cursor positions from Yjs awareness and keeps Fortune sheet's
6
7
  * native presence list in sync. Fortune renders colored cell borders + username
7
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.
8
14
  */
9
- export declare const useCollabAwareness: (awareness: Awareness | null | undefined, sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>) => {
15
+ export declare const useCollabAwareness: (awareness: Awareness | null | undefined, sheetEditorRef: React.MutableRefObject<WorkbookInstance | null>, onCollaboratorsChange?: (collaborators: CollabUser[]) => void) => {
10
16
  localColor: "#30bced" | "#6eeb83" | "#fa69d1" | "#ecd444" | "#ee6352" | "#db3041" | "#0ad7f2" | "#1bff39";
11
17
  };