@fileverse-dev/ddoc 4.2.0-durability-8 → 4.2.0-yjs-dedupe-1

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 (45) hide show
  1. package/dist/{index-DU1L3PC_.mjs → index-BfVM4ukb.mjs} +1 -1
  2. package/dist/{index-BSWmSm-6.mjs → index-DYlSDaET.mjs} +49123 -49943
  3. package/dist/index.d.ts +0 -4
  4. package/dist/index.es.js +5 -8
  5. package/dist/{markdown-source-pane-BscaPxrM.mjs → markdown-source-pane-ve9MJKFE.mjs} +2 -2
  6. package/dist/package/components/editor-bubble-menu/types.d.ts +1 -0
  7. package/dist/package/components/editor-utils.d.ts +25 -1
  8. package/dist/package/components/inline-comment/comment-drawer-desktop.d.ts +2 -1
  9. package/dist/package/components/inline-comment/comment-drawer-mobile.d.ts +2 -1
  10. package/dist/package/components/inline-comment/comment-drawer.d.ts +1 -1
  11. package/dist/package/components/inline-comment/comment-input-field.d.ts +2 -1
  12. package/dist/package/components/inline-comment/comment-reply-input.d.ts +2 -1
  13. package/dist/package/components/inline-comment/comment-section.d.ts +1 -1
  14. package/dist/package/components/inline-comment/floating-comment/comment-floating-container.d.ts +1 -1
  15. package/dist/package/components/inline-comment/floating-comment/suggestion-thread-floating-card.d.ts +1 -1
  16. package/dist/package/components/inline-comment/floating-comment/thread-floating-card.d.ts +1 -1
  17. package/dist/package/components/inline-comment/floating-comment/types.d.ts +2 -0
  18. package/dist/package/components/inline-comment/types.d.ts +2 -0
  19. package/dist/package/components/split-view/split-view-markdown-pane.d.ts +1 -3
  20. package/dist/package/extensions/mardown-paste-handler/index.d.ts +0 -6
  21. package/dist/package/hooks/use-focus-mode.d.ts +1 -6
  22. package/dist/package/hooks/use-headless-editor.d.ts +1 -9
  23. package/dist/package/hooks/use-tab-editor.d.ts +3 -3
  24. package/dist/package/hooks/use-yjs-setup.d.ts +1 -7
  25. package/dist/package/stores/comment-store-provider.d.ts +1 -3
  26. package/dist/package/stores/comment-store.d.ts +0 -15
  27. package/dist/package/sync-local/SyncManager.d.ts +7 -30
  28. package/dist/package/sync-local/socketClient.d.ts +8 -55
  29. package/dist/package/sync-local/types/index.d.ts +11 -82
  30. package/dist/package/sync-local/useSyncManager.d.ts +0 -4
  31. package/dist/package/types.d.ts +2 -20
  32. package/dist/package/use-ddoc-editor.d.ts +0 -5
  33. package/dist/package/utils/colors.d.ts +0 -1
  34. package/dist/{split-view-toolbar-PQWTjOnQ.mjs → split-view-toolbar-8avjvjIR.mjs} +2 -2
  35. package/dist/style.css +1 -1
  36. package/package.json +4 -3
  37. package/dist/package/components/split-view/split-view-css-accordion.d.ts +0 -13
  38. package/dist/package/hooks/use-editor-commands.d.ts +0 -20
  39. package/dist/package/sync-local/floor.d.ts +0 -6
  40. package/dist/package/sync-local/presence.d.ts +0 -11
  41. package/dist/package/utils/insert-commands.d.ts +0 -20
  42. package/dist/package/utils/make-editor.d.ts +0 -9
  43. package/dist/package/utils/sanitize-css.d.ts +0 -45
  44. package/dist/package/utils/selection-utils.d.ts +0 -35
  45. package/dist/package/utils/typography.d.ts +0 -26
package/dist/index.d.ts CHANGED
@@ -3,12 +3,8 @@ export { PreviewDdocEditor } from './package/preview-ddoc-editor';
3
3
  export { handleContentPrint } from './package/utils/handle-print';
4
4
  export { DdocExportModal } from './package/components/export-modal';
5
5
  export { useHeadlessEditor } from './package/hooks/use-headless-editor';
6
- export { useEditorCommands } from './package/hooks/use-editor-commands';
7
- export type { EditorCommand, EditorCommandId, UseEditorCommandsOptions, } from './package/hooks/use-editor-commands';
8
6
  export { useExportHeadlessEditorContent } from './package/hooks/use-export-headless-editor-content';
9
7
  export { mergeTabAwareYjsUpdates } from './package/components/tabs/utils/tab-utils';
10
- export { validateCustomCss, sanitizeCustomCss, } from './package/utils/sanitize-css';
11
- export type { CssDiagnostic, CssValidationResult, } from './package/utils/sanitize-css';
12
8
  export { buildVersionDiffSnapshot } from './package/components/tabs/utils/version-diff-snapshot';
13
9
  export type { DdocExportModalProps, ExportFormatOption, ExportTabOption, } from './package/components/export-modal';
14
10
  export type { VersionTabSnapshot } from './package/components/tabs/utils/version-diff-snapshot';
package/dist/index.es.js CHANGED
@@ -1,15 +1,12 @@
1
- import { D as e, a as o, E as t, P as d, f as r, h as i, m as n, e as E, c as m, d as u, u as C, v as l } from "./index-BSWmSm-6.mjs";
1
+ import { D as e, a as o, E as d, P as t, d as r, h as i, m as n, c as E, u as l } from "./index-DYlSDaET.mjs";
2
2
  export {
3
3
  e as DdocEditor,
4
4
  o as DdocExportModal,
5
- t as Editor,
6
- d as PreviewDdocEditor,
5
+ d as Editor,
6
+ t as PreviewDdocEditor,
7
7
  r as buildVersionDiffSnapshot,
8
8
  i as handleContentPrint,
9
9
  n as mergeTabAwareYjsUpdates,
10
- E as sanitizeCustomCss,
11
- m as useEditorCommands,
12
- u as useExportHeadlessEditorContent,
13
- C as useHeadlessEditor,
14
- l as validateCustomCss
10
+ E as useExportHeadlessEditorContent,
11
+ l as useHeadlessEditor
15
12
  };
@@ -1,9 +1,9 @@
1
1
  var Vr = Object.defineProperty;
2
2
  var Wr = (t, e, O) => e in t ? Vr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: O }) : t[e] = O;
3
3
  var gt = (t, e, O) => Wr(t, typeof e != "symbol" ? e + "" : e, O);
4
- import { j as Cr } from "./index-BSWmSm-6.mjs";
4
+ import { j as Cr } from "./index-DYlSDaET.mjs";
5
5
  import { useRef as pe, useEffect as St } from "react";
6
- import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-DU1L3PC_.mjs";
6
+ import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-BfVM4ukb.mjs";
7
7
  class ua {
8
8
  /**
9
9
  Create a new completion context. (Mostly useful for testing
@@ -30,6 +30,7 @@ export type EditorBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
30
30
  file: File;
31
31
  }>;
32
32
  fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
33
+ enableCollaboration?: boolean;
33
34
  isCollabDocOwner?: boolean;
34
35
  };
35
36
  export interface NodeSelectorProps {
@@ -22,7 +22,30 @@ type PickerEntry = {
22
22
  };
23
23
  export declare const baselineFonts: PickerEntry[];
24
24
  export declare function buildPickerEntries(consumerFonts: FontDescriptor[]): PickerEntry[];
25
- export * from '../utils/typography';
25
+ export declare const FONT_SIZES: readonly [8, 9, 10, 11, 12, 14, 16, 18, 24, 30, 32, 36, 48, 60, 72, 96];
26
+ export declare const getFontSizeOptions: (editor?: Editor) => {
27
+ title: string;
28
+ value: string;
29
+ label: string;
30
+ command: (editor: Editor) => void;
31
+ isActive: () => boolean | undefined;
32
+ }[];
33
+ export declare const getCurrentFontSize: (editor: Editor | null, currentSize: string) => string;
34
+ export declare const uiValueToPercentage: (uiValue: string) => string;
35
+ export declare const percentageToUiValue: (percentage: string) => string;
36
+ export declare const LINE_HEIGHT_OPTIONS: {
37
+ value: string;
38
+ label: string;
39
+ uiValue: string;
40
+ description: string;
41
+ }[];
42
+ export declare const getLineHeightOptions: () => {
43
+ value: string;
44
+ label: string;
45
+ uiValue: string;
46
+ description: string;
47
+ }[];
48
+ export declare const getCurrentLineHeight: (editor: Editor | null, currentLineHeight?: string) => string;
26
49
  export declare const ERR_MSG_MAP: {
27
50
  IMAGE_SIZE: string;
28
51
  };
@@ -161,3 +184,4 @@ export declare const checkActiveListsAndDBlocks: (editor: Editor) => {
161
184
  state: import('prosemirror-state').EditorState;
162
185
  hasMultipleLists: boolean;
163
186
  };
187
+ export {};
@@ -9,6 +9,7 @@ interface CommentDrawerDesktopProps {
9
9
  commentType: string;
10
10
  commentTypeOptions: DrawerSelectOption[];
11
11
  filteredComments: IComment[];
12
+ isCollaborationEnabled: boolean;
12
13
  isCommentTypeSelectOpen: boolean;
13
14
  isConnected: boolean;
14
15
  isNavbarVisible: boolean;
@@ -30,5 +31,5 @@ interface CommentDrawerDesktopProps {
30
31
  tabList: DrawerSelectOption[];
31
32
  tabNameById: Record<string, string>;
32
33
  }
33
- export declare const CommentDrawerDesktop: ({ activeCommentId, commentType, commentTypeOptions, filteredComments, isCommentTypeSelectOpen, isConnected, isNavbarVisible, isOpen, isPresentationMode, isPreviewMode, isTabSelectOpen, newCommentTabId, onClose, onCommentFocus, onCommentTypeChange, onCommentTypeSelectOpenChange, onReset, onTabChange, onTabSelectOpenChange, sectionLabel, selectedTab, selectedTabLabel, tabList, tabNameById, }: CommentDrawerDesktopProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const CommentDrawerDesktop: ({ activeCommentId, commentType, commentTypeOptions, filteredComments, isCollaborationEnabled, isCommentTypeSelectOpen, isConnected, isNavbarVisible, isOpen, isPresentationMode, isPreviewMode, isTabSelectOpen, newCommentTabId, onClose, onCommentFocus, onCommentTypeChange, onCommentTypeSelectOpenChange, onReset, onTabChange, onTabSelectOpenChange, sectionLabel, selectedTab, selectedTabLabel, tabList, tabNameById, }: CommentDrawerDesktopProps) => import("react/jsx-runtime").JSX.Element;
34
35
  export {};
@@ -9,6 +9,7 @@ interface CommentDrawerMobileProps {
9
9
  canGoToNextMobileComment: boolean;
10
10
  canGoToPreviousMobileComment: boolean;
11
11
  comments: IComment[];
12
+ isCollaborationEnabled: boolean;
12
13
  isCommentMobileFocused: boolean;
13
14
  isConnected: boolean;
14
15
  isDiscardCommentOverlayVisible: boolean;
@@ -38,5 +39,5 @@ interface CommentDrawerMobileProps {
38
39
  tabNameById: Record<string, string>;
39
40
  username: string | null;
40
41
  }
41
- export declare const CommentDrawerMobile: ({ activeCommentId, activeDraft, activeDraftId, activeSuggestionDraftCard, canGoToNextMobileComment, canGoToPreviousMobileComment, comments, isCommentMobileFocused, isConnected, isDiscardCommentOverlayVisible, isDiscardSuggestionOverlayVisible, isInlineDraftOpen, isMobileDrawerVisible, isNavbarVisible, isPresentationMode, mobileActiveCommentsCount, mobileDraftRef, mobileFocusedCommentIndex, onAttemptCloseNewComment, onAttemptCloseSuggestionDraft, onCancelDiscardComment, onCancelDiscardSuggestion, onCloseDrawer, onCommentFocus, onCreateComment, onDiscardSuggestionDraft, onFocusSuggestionDraft, onNextMobileComment, onPreviousMobileComment, onStartNewMobileComment, onSubmitSuggestionDraft, onUpdateInlineDraftText, onViewAllComments, tabNameById, username, }: CommentDrawerMobileProps) => import("react/jsx-runtime").JSX.Element;
42
+ export declare const CommentDrawerMobile: ({ activeCommentId, activeDraft, activeDraftId, activeSuggestionDraftCard, canGoToNextMobileComment, canGoToPreviousMobileComment, comments, isCollaborationEnabled, isCommentMobileFocused, isConnected, isDiscardCommentOverlayVisible, isDiscardSuggestionOverlayVisible, isInlineDraftOpen, isMobileDrawerVisible, isNavbarVisible, isPresentationMode, mobileActiveCommentsCount, mobileDraftRef, mobileFocusedCommentIndex, onAttemptCloseNewComment, onAttemptCloseSuggestionDraft, onCancelDiscardComment, onCancelDiscardSuggestion, onCloseDrawer, onCommentFocus, onCreateComment, onDiscardSuggestionDraft, onFocusSuggestionDraft, onNextMobileComment, onPreviousMobileComment, onStartNewMobileComment, onSubmitSuggestionDraft, onUpdateInlineDraftText, onViewAllComments, tabNameById, username, }: CommentDrawerMobileProps) => import("react/jsx-runtime").JSX.Element;
42
43
  export {};
@@ -1,3 +1,3 @@
1
1
  import { CommentDrawerProps } from './types';
2
2
 
3
- export declare const CommentDrawer: ({ isOpen, onClose, isNavbarVisible, isPresentationMode, activeCommentId, activeTabId, onTabChange, isPreviewMode, tabs, }: CommentDrawerProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const CommentDrawer: ({ isOpen, onClose, isNavbarVisible, isPresentationMode, activeCommentId, activeTabId, onTabChange, isPreviewMode, tabs, isCollaborationEnabled, }: CommentDrawerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,4 @@
1
- export declare const CommentInputField: ({ tabId }: {
1
+ export declare const CommentInputField: ({ tabId, isCollaborationEnabled, }: {
2
2
  tabId?: string;
3
+ isCollaborationEnabled: boolean;
3
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,7 @@ interface CommentReplyInputProps {
2
2
  commentId: string;
3
3
  commentUsername?: string;
4
4
  replyCount: number;
5
+ isCollaborationEnabled: boolean;
5
6
  }
6
- export declare const CommentReplyInput: ({ commentId, replyCount, commentUsername, }: CommentReplyInputProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const CommentReplyInput: ({ commentId, replyCount, isCollaborationEnabled, commentUsername, }: CommentReplyInputProps) => import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -1,3 +1,3 @@
1
1
  import { CommentSectionProps } from './types';
2
2
 
3
- export declare const CommentSection: ({ activeCommentId, isNavbarVisible, isPresentationMode, isMobile, comments: commentsProp, commentType, tabNameById, selectedTabLabel, newCommentTabId, showNewCommentInput, onCommentFocus, onReset, }: CommentSectionProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const CommentSection: ({ activeCommentId, isNavbarVisible, isPresentationMode, isMobile, comments: commentsProp, commentType, tabNameById, selectedTabLabel, newCommentTabId, showNewCommentInput, onCommentFocus, onReset, isCollaborationEnabled, }: CommentSectionProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import { CommentFloatingContainerProps } from './types';
2
2
 
3
- export declare const CommentFloatingContainer: ({ editor, editorWrapperRef, scrollContainerRef, tabName, isHidden, }: CommentFloatingContainerProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export declare const CommentFloatingContainer: ({ editor, editorWrapperRef, scrollContainerRef, tabName, isHidden, isCollaborationEnabled, }: CommentFloatingContainerProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -12,4 +12,4 @@ import { ThreadFloatingCardProps } from './types';
12
12
  * uses — so once a draft is submitted, nothing else in the pipeline needs
13
13
  * to change to show the suggestion here.
14
14
  */
15
- export declare const SuggestionThreadFloatingCard: ({ thread, comment, isHidden, registerCardNode, }: ThreadFloatingCardProps) => import("react/jsx-runtime").JSX.Element | null;
15
+ export declare const SuggestionThreadFloatingCard: ({ thread, comment, isHidden, registerCardNode, isCollaborationEnabled, }: ThreadFloatingCardProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,3 +1,3 @@
1
1
  import { ThreadFloatingCardProps } from './types';
2
2
 
3
- export declare const ThreadFloatingCard: ({ thread, comment, tabName, isHidden, registerCardNode, }: ThreadFloatingCardProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const ThreadFloatingCard: ({ thread, comment, tabName, isHidden, registerCardNode, isCollaborationEnabled, }: ThreadFloatingCardProps) => import("react/jsx-runtime").JSX.Element;
@@ -10,6 +10,7 @@ export interface CommentFloatingContainerProps {
10
10
  scrollContainerRef: RefObject<HTMLDivElement>;
11
11
  tabName: string;
12
12
  isHidden: boolean;
13
+ isCollaborationEnabled?: boolean;
13
14
  }
14
15
  export interface FloatingCardShellProps {
15
16
  floatingCardId: string;
@@ -29,6 +30,7 @@ export interface ThreadFloatingCardProps {
29
30
  tabName: string;
30
31
  isHidden: boolean;
31
32
  registerCardNode: RegisterCardNode;
33
+ isCollaborationEnabled?: boolean;
32
34
  }
33
35
  export interface SuggestionDraftFloatingCardProps {
34
36
  card: SuggestionFloatingDraftCard;
@@ -36,6 +36,7 @@ export interface CommentDrawerProps {
36
36
  onTabChange?: (tabId: string) => void;
37
37
  isPreviewMode: boolean;
38
38
  tabs: Tab[];
39
+ isCollaborationEnabled: boolean;
39
40
  }
40
41
  export interface CommentCardProps extends IComment {
41
42
  comment?: string;
@@ -86,6 +87,7 @@ export interface CommentSectionProps {
86
87
  showNewCommentInput?: boolean;
87
88
  onCommentFocus?: (commentId: string, tabId?: string) => void;
88
89
  onReset?: () => void;
90
+ isCollaborationEnabled: boolean;
89
91
  }
90
92
  export interface UserDisplayProps {
91
93
  username: string;
@@ -6,8 +6,6 @@ interface SplitViewMarkdownPaneProps {
6
6
  /** Same uploader the editor uses — for the markdown toolbar's Image button. */
7
7
  ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
8
8
  onError?: (error: string) => void;
9
- /** Document custom CSS — shown read-only in a collapsible accordion. */
10
- customCSS?: string;
11
9
  /** Sizing for the resizable split (flex-grow set by the draggable splitter). */
12
10
  style?: React.CSSProperties;
13
11
  }
@@ -17,5 +15,5 @@ interface SplitViewMarkdownPaneProps {
17
15
  * real ddoc editor itself — see ddoc-editor.tsx, which keeps that editor mounted
18
16
  * in place (never a second <EditorContent>) so its React node views survive.
19
17
  */
20
- export declare const SplitViewMarkdownPane: ({ markdown, onMarkdownChange, ipfsImageUploadFn, onError, customCSS, style, }: SplitViewMarkdownPaneProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const SplitViewMarkdownPane: ({ markdown, onMarkdownChange, ipfsImageUploadFn, onError, style, }: SplitViewMarkdownPaneProps) => import("react/jsx-runtime").JSX.Element;
21
19
  export {};
@@ -5,13 +5,7 @@ import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../../types';
5
5
 
6
6
  export declare const turndownService: TurndownService;
7
7
  export declare const setMarkdownInlineStyles: (enabled: boolean) => void;
8
- export declare const setResolveColorVars: (enabled: boolean) => void;
9
8
  declare module '@tiptap/core' {
10
- interface Storage {
11
- markdownPasteHandler: {
12
- customCSS: string;
13
- };
14
- }
15
9
  interface Commands {
16
10
  uploadMarkdownFile: {
17
11
  uploadMarkdownFile: (ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>, onError?: (error: string) => void) => any;
@@ -1,12 +1,7 @@
1
1
  type UseFocusModeOptions = {
2
- /** Notify callback — fires on every toggle in both modes (existing API). */
3
2
  onFocusMode?: (isFocusMode: boolean) => void;
4
- /** Controlled value (D6). Omit for the legacy internal-state behavior. */
5
- isFocusMode?: boolean;
6
- /** Controlled setter — receives the next value instead of internal mutation. */
7
- onFocusModeChange?: (isFocusMode: boolean) => void;
8
3
  };
9
- export declare const useFocusMode: ({ onFocusMode, isFocusMode: controlledValue, onFocusModeChange, }?: UseFocusModeOptions) => {
4
+ export declare const useFocusMode: ({ onFocusMode }?: UseFocusModeOptions) => {
10
5
  isFocusMode: boolean;
11
6
  toggleFocusMode: () => Promise<void>;
12
7
  };
@@ -1,4 +1,4 @@
1
- import { AnyExtension, Editor, JSONContent } from '@tiptap/react';
1
+ import { Editor, JSONContent } from '@tiptap/react';
2
2
  import { handleMarkdownContent } from '../extensions/mardown-paste-handler';
3
3
  import { IpfsImageUploadResponse } from '../types';
4
4
 
@@ -6,14 +6,6 @@ import * as Y from 'yjs';
6
6
  export interface UseHeadlessEditorProps {
7
7
  optionalExtensions?: string[];
8
8
  }
9
- /**
10
- * The exact extension set the headless editor runs with. Exported so tests
11
- * can build an equivalent editor without the hook.
12
- */
13
- export declare const getHeadlessExtensions: (options?: {
14
- ydoc?: Y.Doc;
15
- optionalExtensions?: string[];
16
- }) => AnyExtension[];
17
9
  export declare const useHeadlessEditor: (props?: UseHeadlessEditorProps) => {
18
10
  setContent: (initialContent: string | string[] | JSONContent, editor: Editor, ydoc: Y.Doc) => void;
19
11
  getEditor: () => {
@@ -17,6 +17,7 @@ interface UseTabEditorArgs {
17
17
  initialContent: DdocProps['initialContent'];
18
18
  collaboration?: CollaborationProps;
19
19
  isReady?: boolean;
20
+ isSyncing?: boolean;
20
21
  awareness?: any;
21
22
  disableInlineComment?: boolean;
22
23
  isFocusMode?: boolean;
@@ -42,9 +43,8 @@ interface UseTabEditorArgs {
42
43
  isPresentationMode?: boolean;
43
44
  onInvalidContentError?: DdocProps['onInvalidContentError'];
44
45
  ignoreCorruptedData?: boolean;
46
+ onCollaboratorChange?: DdocProps['onCollaboratorChange'];
45
47
  onConnect: (connectConfig: CollabConnectionConfig) => void;
46
- onDisconnect: () => void;
47
- isIndexeddbSynced: boolean;
48
48
  hasCollabContentInitialised?: boolean;
49
49
  initialiseYjsIndexedDbProvider: () => Promise<void>;
50
50
  externalExtensions?: Record<string, AnyExtension>;
@@ -56,7 +56,7 @@ interface UseTabEditorArgs {
56
56
  initialCommentAnchors?: SerializedCommentAnchor[];
57
57
  dBlockRuntimeStateRef?: DBlockRuntimeStateRef;
58
58
  }
59
- export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, viewerMode, initialContent, collaboration, isReady, awareness, disableInlineComment, isFocusMode, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onConnect, onDisconnect, isIndexeddbSynced, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, tabIds, theme, editorRef, initialCommentAnchors, dBlockRuntimeStateRef, }: UseTabEditorArgs) => {
59
+ export declare const useTabEditor: ({ ydoc, isVersionMode, hasTabState, versionId, isPreviewMode, viewerMode, initialContent, collaboration, isReady, isSyncing, awareness, disableInlineComment, isFocusMode, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, tabIds, theme, editorRef, initialCommentAnchors, dBlockRuntimeStateRef, }: UseTabEditorArgs) => {
60
60
  editor: Editor | null;
61
61
  cachedEditorEntries: import('./use-tab-editor-cache').CachedTabEditorRenderEntry[];
62
62
  ref: import('react').RefObject<HTMLDivElement>;
@@ -6,20 +6,14 @@ interface UseYjsSetupArgs {
6
6
  enableIndexeddbSync?: boolean;
7
7
  ddocId?: string;
8
8
  collaboration?: CollaborationProps;
9
- onCollaboratorChange?: DdocProps['onCollaboratorChange'];
10
9
  onIndexedDbError?: (error: Error) => void;
11
10
  }
12
- export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId, collaboration, onCollaboratorChange, onIndexedDbError, }: UseYjsSetupArgs) => {
11
+ export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId, collaboration, onIndexedDbError, }: UseYjsSetupArgs) => {
13
12
  ydoc: Y.Doc;
14
13
  onConnect: (connectConfig: import('../types').CollabConnectionConfig) => void;
15
- onDisconnect: () => void;
16
14
  isReady: boolean;
17
15
  isSyncing: boolean;
18
16
  terminateSession: () => void;
19
- updateTitle: (args: {
20
- encryptedTitle: string;
21
- documentTitle: string;
22
- }) => void;
23
17
  awareness: import('y-protocols/awareness.js').Awareness | null;
24
18
  hasCollabContentInitialised: boolean;
25
19
  isIndexeddbSynced: boolean;
@@ -44,11 +44,9 @@ export interface CommentStoreProviderProps {
44
44
  isConnected?: boolean;
45
45
  isLoading?: boolean;
46
46
  isDDocOwner?: boolean;
47
- /** Inline comments usable — see ddoc-editor.tsx's derivation. */
48
- isInlineCommentAvailable?: boolean;
49
47
  setUsername?: React.Dispatch<React.SetStateAction<string>>;
50
48
  }
51
- export declare const CommentStoreProvider: ({ children, editor, ydoc, isFocusMode, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onEditComment, onEditReply, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onDeleteReply, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef, draftAnchorsRef, storeApiRef, initialCommentAnchors, setUsername: setUsernameProp, initialComments, username, activeCommentId, activeTabId, isConnected, isLoading, isDDocOwner, isInlineCommentAvailable, }: CommentStoreProviderProps) => import("react/jsx-runtime").JSX.Element;
49
+ export declare const CommentStoreProvider: ({ children, editor, ydoc, isFocusMode, setActiveCommentId, focusCommentWithActiveId, setInitialComments, onNewComment, onEditComment, onEditReply, onCommentReply, onResolveComment, onUnresolveComment, onDeleteComment, onDeleteReply, onInlineComment, onComment, setCommentDrawerOpen, connectViaWallet, connectViaUsername, ensResolutionUrl, commentAnchorsRef, draftAnchorsRef, storeApiRef, initialCommentAnchors, setUsername: setUsernameProp, initialComments, username, activeCommentId, activeTabId, isConnected, isLoading, isDDocOwner, }: CommentStoreProviderProps) => import("react/jsx-runtime").JSX.Element;
52
50
  interface CommentRefsContextType {
53
51
  commentsSectionRef: React.RefObject<HTMLDivElement>;
54
52
  replySectionRef: React.RefObject<HTMLDivElement>;
@@ -108,10 +108,6 @@ export interface CommentStoreState {
108
108
  isConnected: boolean;
109
109
  isLoading: boolean;
110
110
  isDDocOwner: boolean;
111
- /** Inline comments usable at all (not RTC, published, not disabled) —
112
- * synced from CommentStoreProvider's prop; drives insert.comment
113
- * enablement in useEditorCommands. */
114
- isInlineCommentAvailable: boolean;
115
111
  onComment: (() => void) | null;
116
112
  setCommentDrawerOpen: ((open: boolean) => void) | null;
117
113
  connectViaWallet: (() => Promise<void>) | null;
@@ -150,7 +146,6 @@ export interface CommentStoreState {
150
146
  setIsConnected: (connected: boolean) => void;
151
147
  setIsLoading: (loading: boolean) => void;
152
148
  setIsDDocOwner: (isOwner: boolean) => void;
153
- setIsInlineCommentAvailable: (value: boolean) => void;
154
149
  setOnComment: (fn: (() => void) | null) => void;
155
150
  setCommentDrawerOpenFn: (fn: ((open: boolean) => void) | null) => void;
156
151
  setConnectViaWallet: (fn: (() => Promise<void>) | null) => void;
@@ -289,14 +284,4 @@ export interface CommentStoreState {
289
284
  export declare const createCommentStore: () => import('zustand').StoreApi<CommentStoreState>;
290
285
  export declare const CommentStoreContext: React.Context<import('zustand').StoreApi<CommentStoreState> | null>;
291
286
  export declare function useCommentStore<T>(selector: (state: CommentStoreState) => T): T;
292
- /**
293
- * Non-throwing variant of useCommentStore: returns undefined when no
294
- * CommentStoreProvider is above the caller (e.g. useEditorCommands used
295
- * outside DdocEditor). The selector's RETURN VALUE must be Object.is-stable
296
- * for unchanged state (primitives or refs already held by the store) —
297
- * useSyncExternalStore compares snapshots with Object.is, so a selector
298
- * that constructs a fresh object/array per call would re-render forever.
299
- * Selector function identity itself doesn't matter.
300
- */
301
- export declare function useCommentStoreOptional<T>(selector: (state: CommentStoreState) => T): T | undefined;
302
287
  export {};
@@ -9,47 +9,32 @@ export declare class SyncManager {
9
9
  private socketClient;
10
10
  private roomKey;
11
11
  private roomKeyBytes;
12
- private encryptMirror;
13
- private fileKeyEpoch;
14
- private mirrorIdleTimer;
15
- private readonly MIRROR_IDLE_MS;
16
12
  private isOwner;
17
- private joinOnly;
18
13
  private updateQueue;
14
+ private uncommittedUpdatesIdList;
19
15
  private contentTobeAppliedQueue;
20
16
  private isProcessing;
21
- private syncId;
22
- private floor;
23
- private updatesSinceSnapshot;
24
- private isAuthoringSnapshot;
25
- private readonly SNAPSHOT_THRESHOLD;
26
17
  private flushTimer;
27
18
  private readonly FLUSH_INTERVAL_MS;
28
19
  private readonly MAX_QUEUE_SIZE;
29
20
  private _awarenessUpdateHandler;
30
21
  private ydoc;
22
+ private servicesRef;
31
23
  private callbacksRef;
32
24
  private onLocalUpdate?;
33
25
  constructor(config: SyncManagerConfig, onCollabStateChange: (state: CollabState) => void);
34
26
  /** Called by useSyncManager on every render to keep refs fresh */
35
- updateRefs(_services: CollabServices | undefined, callbacks: CollabCallbacks | undefined, onLocalUpdate?: (updatedDocContent: string, updateChunk: string) => void): void;
27
+ updateRefs(services: CollabServices | undefined, callbacks: CollabCallbacks | undefined, onLocalUpdate?: (updatedDocContent: string, updateChunk: string) => void): void;
36
28
  get isConnected(): boolean;
37
29
  get isReady(): boolean;
38
30
  get awareness(): Awareness | null;
39
31
  get status(): CollabStatus;
40
32
  get collabState(): CollabState;
41
- private beginSyncAttempt;
42
- private isCurrentSyncAttempt;
43
33
  private send;
44
34
  private runExitActions;
45
35
  private runEntryActions;
46
36
  connect(config: CollabConnectionConfig): Promise<void>;
47
37
  disconnect(): Promise<void>;
48
- /** Owner rename mid-session — see SocketClient.updateDocumentMeta. */
49
- updateTitle(args: {
50
- encryptedTitle: string;
51
- documentTitle: string;
52
- }): Promise<void>;
53
38
  terminateSession(): Promise<void>;
54
39
  enqueueLocalUpdate(update: Uint8Array): void;
55
40
  private flushUpdates;
@@ -58,29 +43,21 @@ export declare class SyncManager {
58
43
  * Fire-and-forget: merge all queued updates, encrypt, and emit via Socket.IO
59
44
  * without awaiting the server ACK. The server broadcasts to peers immediately
60
45
  * (before MongoDB write), so content reaches observers in near-real-time.
46
+ * ACK callback handles updateId tracking and auto-commit asynchronously.
61
47
  */
62
48
  private sendUpdateBatch;
63
- private isRevocationResponse;
64
- private classifyRevocation;
65
- private handleWriteRevocation;
66
- private maybeAuthorSnapshotAfterSend;
67
- private scheduleMirror;
68
- private authorMirror;
69
- buildPendingBeaconPayload(): string | null;
70
- fireBeacon(): void;
71
49
  forceCleanup(): void;
72
50
  private handleConnectionError;
73
51
  private handleReconnection;
74
52
  private connectSocket;
75
- private decodeInto;
76
- private catchUpFloor;
77
- private authorSnapshot;
78
- private hydrate;
53
+ private syncLatestCommit;
79
54
  private initializeAwareness;
80
55
  private cleanupAwareness;
56
+ private commitLocalContents;
81
57
  private broadcastLocalContents;
82
58
  private processUpdateQueue;
83
59
  private processNextUpdate;
60
+ private processCommit;
84
61
  private handleRemoteContentUpdate;
85
62
  private applyRemoteYjsUpdate;
86
63
  private applyQueuedRemoteContents;
@@ -1,4 +1,4 @@
1
- import { ISocketInitConfig, SocketStatusEnum, SendUpdateResponse, HydrationResponse, SnapshotResponse, AckResponse } from './types';
1
+ import { ISocketInitConfig, RoomMember, SocketStatusEnum, SendUpdateResponse, CommitResponse, AckResponse } from './types';
2
2
  import { Awareness } from 'y-protocols/awareness.js';
3
3
 
4
4
  interface ISocketClientConfig {
@@ -8,22 +8,6 @@ interface ISocketClientConfig {
8
8
  ownerEdSecret?: string;
9
9
  contractAddress?: string;
10
10
  ownerAddress?: string;
11
- ownerIdentityDid?: string;
12
- editLock?: string;
13
- encryptedTitle?: string;
14
- identityToken?: string;
15
- identityContractAddress?: string;
16
- editUcan?: string;
17
- refreshEditClaim?: () => Promise<{
18
- status: 'ok';
19
- token: string;
20
- } | {
21
- status: 'demoted';
22
- } | {
23
- status: 'unavailable';
24
- }>;
25
- actorHandle?: string;
26
- joinOnly?: boolean;
27
11
  onHandshakeData?: (response: {
28
12
  data: AckResponse;
29
13
  roomKey: string;
@@ -36,8 +20,6 @@ interface ISocketClientConfig {
36
20
  }
37
21
  export declare class SocketClient {
38
22
  private _socketUrl;
39
- private _restBase;
40
- private _lastSessionToken;
41
23
  private _socket;
42
24
  private _webSocketStatus;
43
25
  private _isIntentionalDisconnect;
@@ -45,26 +27,13 @@ export declare class SocketClient {
45
27
  get status(): SocketStatusEnum;
46
28
  private _websocketServiceDid;
47
29
  private roomId;
48
- roomMembers: string[];
49
- private _lastPresenceSignature;
50
- private _onPresenceChange?;
51
- private _pendingAwarenessUpdates;
30
+ roomMembers: RoomMember[];
52
31
  private collaborationKeyPair;
53
32
  private ownerKeyPair?;
54
33
  private contractAddress?;
55
34
  private ownerUcan?;
56
35
  private collaborationUcan?;
57
36
  private ownerAddress?;
58
- private ownerIdentityDid?;
59
- private editLock?;
60
- private encryptedTitle?;
61
- private identityToken?;
62
- private identityContractAddress?;
63
- private editUcan?;
64
- private refreshEditClaim?;
65
- private lastGoodEditUcan?;
66
- private actorHandle?;
67
- private joinOnly?;
68
37
  private roomKey;
69
38
  private roomInfo?;
70
39
  private awareness;
@@ -72,36 +41,20 @@ export declare class SocketClient {
72
41
  private _onHandshakeData;
73
42
  constructor(config: ISocketClientConfig);
74
43
  registerAwareness(awareness: Awareness): void;
75
- private _stampSocketId;
76
44
  private _emitWithAck;
77
45
  private _fetchRoomMembers;
78
- private _recomputePresence;
79
46
  sendUpdate({ update }: {
80
47
  update: string;
81
48
  }): Promise<SendUpdateResponse>;
82
- fetchHydrationRange(sinceSeq?: number): Promise<HydrationResponse>;
83
- sendSnapshot({ data, floorSeq, publishedMarker, }: {
84
- data: string;
85
- floorSeq: number;
86
- publishedMarker?: string | null;
87
- }): Promise<SnapshotResponse>;
88
- sendMirrorSnapshot({ data, fileKeyEpoch, }: {
89
- data: string;
90
- fileKeyEpoch: number;
91
- }): Promise<AckResponse<any>>;
92
- setDocumentMeta(): Promise<void>;
93
- /** Owner rename mid-session: refresh the connect-frozen title artifacts (so
94
- * every later /auth re-sends current values), persist server-side, and let
95
- * the server broadcast /document/meta_update to room peers. */
96
- updateDocumentMeta(args: {
97
- encryptedTitle: string;
98
- documentTitle: string;
99
- }): Promise<void>;
49
+ commitUpdates({ updates, cid }: {
50
+ updates: string[];
51
+ cid: string;
52
+ }): Promise<CommitResponse>;
53
+ fetchLatestCommit(): Promise<AckResponse<any>>;
54
+ getUncommittedChanges(): Promise<AckResponse<any>>;
100
55
  broadcastAwareness(awarenessUpdate: string): Promise<void>;
101
56
  disconnect: () => void;
102
- reauth: () => void;
103
57
  terminateSession: () => Promise<void>;
104
- flushBeacon(mergedUpdate: string): void;
105
58
  private getCollaborationKeyPair;
106
59
  private isUcanValid;
107
60
  private getOwnerToken;