@fileverse-dev/ddoc 3.0.97-sepia-3 → 3.0.98

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.
@@ -1,5 +1,5 @@
1
1
  import { Editor } from '@tiptap/react';
2
- import { IpfsImageFetchPayload, DdocProps, ThemeKey } from '../../types';
2
+ import { IpfsImageFetchPayload, DdocProps } from '../../types';
3
3
 
4
4
  interface PresentationModeProps {
5
5
  editor: Editor;
@@ -22,7 +22,7 @@ interface PresentationModeProps {
22
22
  }>;
23
23
  documentStyling?: DdocProps['documentStyling'];
24
24
  fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
25
- theme?: ThemeKey;
25
+ theme?: 'light' | 'dark';
26
26
  }
27
27
  export declare const PresentationMode: ({ editor, onClose, isFullscreen, setIsFullscreen, onError, setCommentDrawerOpen, sharedSlidesLink, isPreviewMode, documentName, onSlidesShare, slides, setSlides, renderThemeToggle, isContentLoading, ipfsImageFetchFn, documentStyling, fetchV1ImageFn, theme, }: PresentationModeProps) => import("react/jsx-runtime").JSX.Element | null;
28
28
  export {};
@@ -1,11 +1,11 @@
1
- import { DdocProps, ThemeKey } from '../../types';
1
+ import { DdocProps } from '../../types';
2
2
 
3
3
  interface PreviewPanelProps {
4
4
  slides: string[];
5
5
  currentSlide: number;
6
6
  setCurrentSlide: (index: number) => void;
7
7
  documentStyling?: DdocProps['documentStyling'];
8
- theme?: ThemeKey;
8
+ theme?: 'light' | 'dark';
9
9
  }
10
10
  export declare const PreviewPanel: ({ slides, currentSlide, setCurrentSlide, documentStyling, theme, }: PreviewPanelProps) => import("react/jsx-runtime").JSX.Element;
11
11
  export {};
@@ -1,9 +1,9 @@
1
1
  import { default as React, ReactNode } from 'react';
2
- import { DocumentStyling, ThemeKey } from '../types';
2
+ import { DocumentStyling } from '../types';
3
3
 
4
4
  interface EditorContextType {
5
5
  documentStyling?: DocumentStyling;
6
- theme: ThemeKey;
6
+ theme: 'light' | 'dark';
7
7
  isFocusMode: boolean;
8
8
  }
9
9
  export declare const EditorContext: React.Context<EditorContextType | null>;
@@ -11,7 +11,7 @@ export declare const useEditorContext: () => EditorContextType;
11
11
  export declare const EditorProvider: React.FC<{
12
12
  children: ReactNode;
13
13
  documentStyling?: DocumentStyling;
14
- theme?: ThemeKey;
14
+ theme?: 'light' | 'dark';
15
15
  isFocusMode?: boolean;
16
16
  }>;
17
17
  export {};
@@ -1,5 +1,5 @@
1
1
  import { Dispatch, MutableRefObject, SetStateAction } from 'react';
2
- import { DdocProps, ThemeKey } from '../types';
2
+ import { DdocProps } from '../types';
3
3
  import { AnyExtension, Editor } from '@tiptap/react';
4
4
  import { ToCItemType } from '../components/toc/types';
5
5
  import { CollabConnectionConfig, CollaborationProps } from '../sync-local/types';
@@ -45,10 +45,10 @@ interface UseTabEditorArgs {
45
45
  externalExtensions?: Record<string, AnyExtension>;
46
46
  isContentLoading?: boolean;
47
47
  activeTabId: string;
48
- theme?: ThemeKey;
48
+ theme?: 'dark' | 'light';
49
49
  editorRef?: MutableRefObject<Editor | null>;
50
50
  }
51
- export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
51
+ export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, theme, editorRef, }: UseTabEditorArgs) => {
52
52
  editor: Editor | null;
53
53
  ref: import('react').RefObject<HTMLDivElement>;
54
54
  slides: string[];
@@ -14,6 +14,9 @@ export declare class SyncManager {
14
14
  private uncommittedUpdatesIdList;
15
15
  private contentTobeAppliedQueue;
16
16
  private isProcessing;
17
+ private flushTimer;
18
+ private readonly FLUSH_INTERVAL_MS;
19
+ private readonly MAX_QUEUE_SIZE;
17
20
  private _awarenessUpdateHandler;
18
21
  private ydoc;
19
22
  private servicesRef;
@@ -34,6 +37,15 @@ export declare class SyncManager {
34
37
  disconnect(): Promise<void>;
35
38
  terminateSession(): Promise<void>;
36
39
  enqueueLocalUpdate(update: Uint8Array): void;
40
+ private flushUpdates;
41
+ private awaitFlush;
42
+ /**
43
+ * Fire-and-forget: merge all queued updates, encrypt, and emit via Socket.IO
44
+ * without awaiting the server ACK. The server broadcasts to peers immediately
45
+ * (before MongoDB write), so content reaches observers in near-real-time.
46
+ * ACK callback handles updateId tracking and auto-commit asynchronously.
47
+ */
48
+ private sendUpdateBatch;
37
49
  forceCleanup(): void;
38
50
  private handleConnectionError;
39
51
  private handleReconnection;
@@ -109,6 +109,10 @@ export interface SyncManagerConfig {
109
109
  services?: CollabServices;
110
110
  callbacks?: CollabCallbacks;
111
111
  onLocalUpdate?: (updatedDocContent: Data['editorJSONData'], updateChunk: string) => void;
112
+ /** Origins to ignore in the ydoc update handler (e.g. IndexedDB provider) */
113
+ ignoredOrigins?: Array<{
114
+ current: unknown;
115
+ }>;
112
116
  }
113
117
  export declare enum ServerErrorCode {
114
118
  AUTH_TOKEN_MISSING = "AUTH_TOKEN_MISSING",
@@ -40,12 +40,9 @@ export interface CustomModel {
40
40
  apiKey: string;
41
41
  systemPrompt: string;
42
42
  }
43
- export type ThemeKey = 'light' | 'dark' | 'theme-sepia' | 'theme-pink';
44
43
  export interface ThemeVariantValue {
45
44
  light: string;
46
45
  dark: string;
47
- sepia?: string;
48
- [key: string]: string | undefined;
49
46
  }
50
47
  export type DocumentStylingValue = string | ThemeVariantValue;
51
48
  /**
@@ -122,7 +119,7 @@ export interface DdocProps extends CommentAccountProps {
122
119
  setIsCommentSectionOpen?: React.Dispatch<SetStateAction<boolean>>;
123
120
  inlineCommentData?: InlineCommentData;
124
121
  setInlineCommentData?: React.Dispatch<React.SetStateAction<InlineCommentData>>;
125
- theme?: ThemeKey;
122
+ theme?: 'dark' | 'light';
126
123
  zoomLevel: string;
127
124
  setZoomLevel: React.Dispatch<SetStateAction<string>>;
128
125
  isNavbarVisible: boolean;
@@ -1,5 +1,3 @@
1
- import { ThemeKey } from '../types';
2
-
3
1
  export declare const colors: {
4
2
  color: string;
5
3
  code: string;
@@ -9,4 +7,4 @@ export declare const textColors: {
9
7
  light: string;
10
8
  dark: string;
11
9
  }[];
12
- export declare const getResponsiveColor: (color?: string, theme?: ThemeKey) => string | undefined;
10
+ export declare const getResponsiveColor: (color?: string, theme?: "light" | "dark") => string | undefined;
@@ -1,5 +1,5 @@
1
- import { DocumentStylingValue, ThemeKey, ThemeVariantValue } from '../types';
1
+ import { DocumentStylingValue, ThemeVariantValue } from '../types';
2
2
 
3
3
  export declare const isThemeVariantValue: (value: DocumentStylingValue | undefined) => value is ThemeVariantValue;
4
- export declare const getThemeStyle: (value?: DocumentStylingValue, theme?: ThemeKey) => string | undefined;
5
- export declare const getResponsiveThemeTextColor: (value?: DocumentStylingValue, theme?: ThemeKey) => string | undefined;
4
+ export declare const getThemeStyle: (value?: DocumentStylingValue, theme?: "light" | "dark") => string | undefined;
5
+ export declare const getResponsiveThemeTextColor: (value?: DocumentStylingValue, theme?: "light" | "dark") => string | undefined;