@fileverse-dev/ddoc 5.1.10 → 6.0.0-drop-in.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 (31) hide show
  1. package/README.md +89 -18
  2. package/dist/headless-editor-utils.es.js +3 -3
  3. package/dist/{index-DtE1zaH8.mjs → index-8MQH4TSF.mjs} +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.es.js +11105 -10860
  6. package/dist/{markdown-source-pane-CA4cDQyu.mjs → markdown-source-pane-CXO7aIOp.mjs} +1 -1
  7. package/dist/package/components/editor-navbar.d.ts +12 -0
  8. package/dist/package/components/editor-toolbar.d.ts +2 -1
  9. package/dist/package/components/fullscreen-toolbar.d.ts +2 -2
  10. package/dist/package/components/mobile-toolbar.d.ts +2 -1
  11. package/dist/package/components/tabs/document-mobile-tab-panel.d.ts +3 -1
  12. package/dist/package/components/tabs/document-tabs-sidebar.d.ts +2 -1
  13. package/dist/package/components/toc/document-outline.d.ts +1 -1
  14. package/dist/package/components/toc/toc.d.ts +1 -1
  15. package/dist/package/components/toc/types.d.ts +7 -0
  16. package/dist/package/hooks/use-canvas-metrics.d.ts +16 -0
  17. package/dist/package/hooks/use-controllable-state.d.ts +3 -0
  18. package/dist/package/hooks/use-editor-media-query.d.ts +4 -0
  19. package/dist/package/hooks/use-focus-mode.d.ts +1 -3
  20. package/dist/package/hooks/use-tab-editor.d.ts +4 -1
  21. package/dist/package/types.d.ts +41 -5
  22. package/dist/package/use-ddoc-editor.d.ts +3 -1
  23. package/dist/package/utils/container-query-support.d.ts +1 -0
  24. package/dist/package/utils/editor-width-store.d.ts +6 -0
  25. package/dist/package/utils/responsive.d.ts +3 -1
  26. package/dist/package/utils/stats-publisher.d.ts +8 -0
  27. package/dist/{split-view-toolbar-8eYCwI8J.mjs → split-view-toolbar-BnfwwwTs.mjs} +1 -1
  28. package/dist/style.css +1 -1
  29. package/dist/{use-headless-editor-tZq6fxul.mjs → use-headless-editor-Buqsz3UI.mjs} +7628 -7612
  30. package/package.json +1 -1
  31. package/tailwind.preset.cjs +42 -0
@@ -3,7 +3,7 @@ var Wr = (t, e, O) => e in t ? Vr(t, e, { enumerable: !0, configurable: !0, writ
3
3
  var gt = (t, e, O) => Wr(t, typeof e != "symbol" ? e + "" : e, O);
4
4
  import { jsx as Cr } from "react/jsx-runtime";
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-DtE1zaH8.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-8MQH4TSF.mjs";
7
7
  class ua {
8
8
  /**
9
9
  Create a new completion context. (Mostly useful for testing
@@ -0,0 +1,12 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { DdocProps } from '../types';
3
+
4
+ type EditorNavbarProps = {
5
+ editor: Editor | null;
6
+ renderNavbar?: DdocProps['renderNavbar'];
7
+ /** undefined: in flow. null: host element not attached yet, render nothing. */
8
+ container?: HTMLElement | null;
9
+ isHidden: boolean;
10
+ };
11
+ export declare const EditorNavbar: ({ editor, renderNavbar, container, isHidden, }: EditorNavbarProps) => import("react/jsx-runtime").JSX.Element | null;
12
+ export {};
@@ -4,7 +4,7 @@ import { FontDescriptor, IpfsImageFetchPayload, IpfsImageUploadResponse } from '
4
4
  import { Tab } from './tabs/utils/tab-utils';
5
5
 
6
6
  import * as Y from 'yjs';
7
- declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onError, isPresentationMode, setIsPresentationMode, enableCollaboration, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, onDocxImport, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, isSplitView, onToggleSplitView, fonts: consumerFonts, renderToolbarLeading, }: {
7
+ declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onError, isPresentationMode, setIsPresentationMode, enableCollaboration, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, showNavbarToggle, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, onDocxImport, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, isSplitView, onToggleSplitView, fonts: consumerFonts, renderToolbarLeading, }: {
8
8
  editor: Editor | null;
9
9
  onError?: (errorString: string) => void;
10
10
  isPresentationMode?: boolean;
@@ -14,6 +14,7 @@ declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onErro
14
14
  setZoomLevel: (zoom: string) => void;
15
15
  isNavbarVisible: boolean;
16
16
  setIsNavbarVisible: React.Dispatch<React.SetStateAction<boolean>>;
17
+ showNavbarToggle?: boolean;
17
18
  ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
18
19
  onMarkdownExport?: () => void;
19
20
  onMarkdownImport?: () => void;
@@ -4,8 +4,8 @@ import { DdocProps } from '../types';
4
4
  type FullScreenToolbarProps = {
5
5
  dropdownOpen: boolean;
6
6
  setDropdownOpen: Dispatch<SetStateAction<boolean>>;
7
- zoomLevel: DdocProps['zoomLevel'];
8
- setZoomLevel: DdocProps['setZoomLevel'];
7
+ zoomLevel: string;
8
+ setZoomLevel: Dispatch<SetStateAction<string>>;
9
9
  showTOC: DdocProps['showTOC'];
10
10
  setShowTOC: DdocProps['setShowTOC'];
11
11
  toggleFocusMode: () => Promise<void>;
@@ -2,12 +2,13 @@ import { default as React } from 'react';
2
2
  import { Editor } from '@tiptap/react';
3
3
  import { FontDescriptor, IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
4
4
 
5
- declare const MemoizedMobileToolbar: React.MemoExoticComponent<({ editor, onError, isKeyboardVisible, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, ipfsImageFetchFn, fetchV1ImageFn, fonts, }: {
5
+ declare const MemoizedMobileToolbar: React.MemoExoticComponent<({ editor, onError, isKeyboardVisible, isNavbarVisible, setIsNavbarVisible, showNavbarToggle, ipfsImageUploadFn, ipfsImageFetchFn, fetchV1ImageFn, fonts, }: {
6
6
  editor: Editor | null;
7
7
  onError?: (errorString: string) => void;
8
8
  isKeyboardVisible: boolean;
9
9
  isNavbarVisible: boolean;
10
10
  setIsNavbarVisible: React.Dispatch<React.SetStateAction<boolean>>;
11
+ showNavbarToggle?: boolean;
11
12
  ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
12
13
  ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
13
14
  url: string;
@@ -25,5 +25,7 @@ export interface DocumentMobileTabPanelProps {
25
25
  isVersionHistoryMode: boolean;
26
26
  isConnected?: boolean;
27
27
  isFocusMode?: boolean;
28
+ layout?: DocumentOutlineProps['layout'];
29
+ tabPanelSlot?: HTMLElement | null;
28
30
  }
29
- export declare const DocumentMobileTabPanel: ({ tabs, activeTabId, setActiveTabId, editor, items, setItems, orientation, renameTab, createTab, duplicateTab, orderTab, deleteTab, tabCommentCounts, isPreviewMode, tabConfig, isVersionHistoryMode, isConnected, isFocusMode, }: DocumentMobileTabPanelProps) => import("react/jsx-runtime").JSX.Element;
31
+ export declare const DocumentMobileTabPanel: ({ tabs, activeTabId, setActiveTabId, editor, items, setItems, orientation, renameTab, createTab, duplicateTab, orderTab, deleteTab, tabCommentCounts, isPreviewMode, tabConfig, isVersionHistoryMode, isConnected, isFocusMode, layout, tabPanelSlot, }: DocumentMobileTabPanelProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -32,9 +32,10 @@ export interface DocumentTabsSidebarProps {
32
32
  deleteTab?: (tabId: string) => void;
33
33
  isConnected?: boolean;
34
34
  isFocusMode?: boolean;
35
+ layout?: DocumentOutlineProps['layout'];
35
36
  }
36
37
  export declare const DocumentTabsSidebar: ({ tabSectionContainer, ...rest }: DocumentTabsSidebarProps) => import("react/jsx-runtime").JSX.Element | null;
37
- export declare const TabSidebar: ({ tabs, activeTabId, setActiveTabId, showTOC, setShowTOC, hasToC, isPreviewMode, editor, items, setItems, orientation, createTab, renameTab, duplicateTab, orderTab, tabCommentCounts, isVersionHistoryMode, tabConfig, deleteTab, isConnected, isFocusMode, }: DocumentTabsSidebarProps) => import("react/jsx-runtime").JSX.Element;
38
+ export declare const TabSidebar: ({ tabs, activeTabId, setActiveTabId, showTOC, setShowTOC, hasToC, isPreviewMode, editor, items, setItems, orientation, createTab, renameTab, duplicateTab, orderTab, tabCommentCounts, isVersionHistoryMode, tabConfig, deleteTab, isConnected, isFocusMode, layout, }: DocumentTabsSidebarProps) => import("react/jsx-runtime").JSX.Element;
38
39
  export declare const DdocTab: ({ tab, tabIndex, tabCount, handleEmojiChange, handleNameChange, onClick, editor, tocItem, setTocItems, orientation, activeTabId, duplicateTab, commentCount, moveTabUp, moveTabDown, isPreviewMode, isVersionHistoryMode, tabConfig, onDelete, showOutline, onShowOutlineChange, isConnected, }: {
39
40
  tab: Tab;
40
41
  tabIndex: number;
@@ -1,3 +1,3 @@
1
1
  import { DocumentOutlineProps } from './types';
2
2
 
3
- export declare const DocumentOutline: ({ editor, hasToC, items, setItems, showTOC, setShowTOC, isPreviewMode, orientation, tabs, setTabs, activeTabId, setActiveTabId, createTab, renameTab, duplicateTab, orderTab, ydoc, tabCommentCounts, tabSectionContainer, isVersionHistoryMode, tabConfig, deleteTab, isConnected, isFocusMode, }: DocumentOutlineProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const DocumentOutline: ({ editor, hasToC, items, setItems, showTOC, setShowTOC, isPreviewMode, orientation, tabs, setTabs, activeTabId, setActiveTabId, createTab, renameTab, duplicateTab, orderTab, ydoc, tabCommentCounts, tabSectionContainer, isVersionHistoryMode, tabConfig, deleteTab, isConnected, isFocusMode, layout, tabPanelSlot, }: DocumentOutlineProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { ToCProps, ToCItemProps } from './types';
2
2
 
3
- export declare const ToCItem: import('react').MemoExoticComponent<({ item, onItemClick, index, orientation, }: ToCItemProps) => import("react/jsx-runtime").JSX.Element>;
3
+ export declare const ToCItem: import('react').MemoExoticComponent<({ item, onItemClick, index, orientation, isMobile, isWide, }: ToCItemProps) => import("react/jsx-runtime").JSX.Element>;
4
4
  export declare const ToCEmptyState: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
5
5
  export declare const ToC: import('react').MemoExoticComponent<({ items, editor, setItems, orientation }: ToCProps) => import("react/jsx-runtime").JSX.Element>;
@@ -22,6 +22,10 @@ export type ToCItemProps = {
22
22
  onItemRemove: (e: React.MouseEvent, id: string) => void;
23
23
  index: number;
24
24
  orientation?: 'portrait' | 'landscape';
25
+ /** At or below 1280px: the item is in the mobile list. */
26
+ isMobile?: boolean;
27
+ /** At or above 1280px: the item takes the rail's width caps. */
28
+ isWide?: boolean;
25
29
  };
26
30
  export interface DocumentOutlineProps {
27
31
  editor: Editor;
@@ -54,4 +58,7 @@ export interface DocumentOutlineProps {
54
58
  deleteTab?: (tabId: string) => void;
55
59
  isConnected?: boolean;
56
60
  isFocusMode?: boolean;
61
+ /** 'contained': sized from the editor canvas. Only DdocEditor passes it. */
62
+ layout?: 'viewport' | 'contained';
63
+ tabPanelSlot?: HTMLElement | null;
57
64
  }
@@ -0,0 +1,16 @@
1
+ import { RefObject } from 'react';
2
+ import { EditorWidthStore } from '../utils/editor-width-store';
3
+
4
+ export declare const computeWidthDecisions: (width: number, scaledWidth: number, leftWidth: number) => {
5
+ shouldHideRight: boolean;
6
+ shouldScroll: boolean;
7
+ };
8
+ type WidthDecisions = ReturnType<typeof computeWidthDecisions>;
9
+ export declare const useCanvasMetrics: ({ canvasRef, rootRef, scaledWidth, leftWidth, widthStore, }: {
10
+ canvasRef: RefObject<HTMLElement | null>;
11
+ rootRef: RefObject<HTMLElement | null>;
12
+ scaledWidth: number;
13
+ leftWidth: number;
14
+ widthStore?: EditorWidthStore;
15
+ }) => WidthDecisions;
16
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+
3
+ export declare const useControllableState: <T>(value: T | undefined, defaultValue: T, onChange?: (next: T) => void, legacySetter?: (next: T) => void) => [T, Dispatch<SetStateAction<T>>];
@@ -0,0 +1,4 @@
1
+ import { EditorWidthStore } from '../utils/editor-width-store';
2
+
3
+ export declare const EditorWidthContext: import('react').Context<EditorWidthStore | null>;
4
+ export declare const useEditorMediaQuery: (query: string, store?: EditorWidthStore) => boolean;
@@ -1,9 +1,7 @@
1
1
  type UseFocusModeOptions = {
2
- /** Notify callback — fires on every toggle in both modes (existing API). */
2
+ /** @deprecated Use onFocusModeChange. Still fires on every change. */
3
3
  onFocusMode?: (isFocusMode: boolean) => void;
4
- /** Controlled value (D6). Omit for the legacy internal-state behavior. */
5
4
  isFocusMode?: boolean;
6
- /** Controlled setter — receives the next value instead of internal mutation. */
7
5
  onFocusModeChange?: (isFocusMode: boolean) => void;
8
6
  };
9
7
  export declare const useFocusMode: ({ onFocusMode, isFocusMode: controlledValue, onFocusModeChange, }?: UseFocusModeOptions) => {
@@ -4,12 +4,14 @@ import { AnyExtension, Editor } from '@tiptap/react';
4
4
  import { CommentAnchor } from '../extensions/comment/comment-decoration-plugin';
5
5
  import { DBlockRuntimeStateRef } from '../extensions/d-block/dblock-runtime';
6
6
  import { ToCItemType } from '../components/toc/types';
7
+ import { EditorWidthStore } from '../utils/editor-width-store';
7
8
  import { CollabConnectionConfig, CollaborationProps } from '../sync-local/types';
8
9
 
9
10
  import * as Y from 'yjs';
10
11
  export declare const TAB_EDITOR_ATTRIBUTES: Record<string, string>;
11
12
  interface UseTabEditorArgs {
12
13
  ydoc: Y.Doc;
14
+ editorWidthStore?: EditorWidthStore;
13
15
  isVersionMode?: boolean;
14
16
  hasTabState?: boolean;
15
17
  versionId?: string;
@@ -36,6 +38,7 @@ interface UseTabEditorArgs {
36
38
  setWordCount?: DdocProps['setWordCount'];
37
39
  setSelectedWordCount?: DdocProps['setSelectedWordCount'];
38
40
  setPageCount?: DdocProps['setPageCount'];
41
+ onStatsChange?: DdocProps['onStatsChange'];
39
42
  setIsContentLoading: Dispatch<SetStateAction<boolean>>;
40
43
  setIsCollabContentLoading: Dispatch<SetStateAction<boolean>>;
41
44
  unFocused?: boolean;
@@ -58,7 +61,7 @@ interface UseTabEditorArgs {
58
61
  dBlockRuntimeStateRef?: DBlockRuntimeStateRef;
59
62
  docSchemaVersion?: number;
60
63
  }
61
- 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, docSchemaVersion, }: UseTabEditorArgs) => {
64
+ export declare const useTabEditor: ({ ydoc, editorWidthStore, 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, onStatsChange, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onConnect, onDisconnect, isIndexeddbSynced, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, tabIds, theme, editorRef, initialCommentAnchors, dBlockRuntimeStateRef, docSchemaVersion, }: UseTabEditorArgs) => {
62
65
  editor: Editor | null;
63
66
  cachedEditorEntries: import('./use-tab-editor-cache').CachedTabEditorRenderEntry[];
64
67
  ref: import('react').RefObject<HTMLDivElement>;
@@ -116,6 +116,13 @@ export interface DocumentStyling {
116
116
  */
117
117
  customCSS?: string;
118
118
  }
119
+ export type DdocStats = {
120
+ words: number;
121
+ characters: number;
122
+ selectedWords: number;
123
+ /** null until the active tab has been measured. */
124
+ pages: number | null;
125
+ };
119
126
  export interface DdocProps extends CommentAccountProps {
120
127
  /**
121
128
  * Optional catalog of fonts available to the editor in addition to the
@@ -143,6 +150,8 @@ export interface DdocProps extends CommentAccountProps {
143
150
  fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
144
151
  disableInlineComment?: boolean;
145
152
  commentDrawerOpen?: boolean;
153
+ onCommentDrawerOpenChange?: (open: boolean) => void;
154
+ /** @deprecated Use onCommentDrawerOpenChange. */
146
155
  setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
147
156
  initialComments?: IComment[];
148
157
  initialCommentAnchors?: SerializedCommentAnchor[];
@@ -156,6 +165,8 @@ export interface DdocProps extends CommentAccountProps {
156
165
  onDeleteComment?: (activeCommentId: string, meta?: CommentMutationMeta) => void;
157
166
  onDeleteReply?: (activeCommentId: string, replyId: string) => void;
158
167
  showTOC?: boolean;
168
+ onShowTOCChange?: (show: boolean) => void;
169
+ /** @deprecated Use onShowTOCChange. */
159
170
  setShowTOC?: React.Dispatch<SetStateAction<boolean>>;
160
171
  extensions?: Record<string, Extension | any>;
161
172
  selectedTags?: TagType[];
@@ -165,13 +176,19 @@ export interface DdocProps extends CommentAccountProps {
165
176
  inlineCommentData?: InlineCommentData;
166
177
  setInlineCommentData?: React.Dispatch<React.SetStateAction<InlineCommentData>>;
167
178
  theme?: ThemeKey;
168
- zoomLevel: string;
169
- setZoomLevel: React.Dispatch<SetStateAction<string>>;
170
- isNavbarVisible: boolean;
171
- setIsNavbarVisible: React.Dispatch<SetStateAction<boolean>>;
179
+ /** Defaults to '1' when omitted. */
180
+ zoomLevel?: string;
181
+ onZoomLevelChange?: (zoomLevel: string) => void;
182
+ /** @deprecated Use onZoomLevelChange. */
183
+ setZoomLevel?: React.Dispatch<SetStateAction<string>>;
184
+ /** Defaults to true when omitted. */
185
+ isNavbarVisible?: boolean;
186
+ onNavbarVisibleChange?: (visible: boolean) => void;
187
+ /** @deprecated Use onNavbarVisibleChange. */
188
+ setIsNavbarVisible?: React.Dispatch<SetStateAction<boolean>>;
172
189
  editorCanvasClassNames?: string;
173
190
  isCommentSectionOpen?: boolean;
174
- isPreviewMode: boolean;
191
+ isPreviewMode?: boolean;
175
192
  viewerMode?: 'suggest' | 'view-only';
176
193
  ensResolutionUrl?: string;
177
194
  ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
@@ -187,6 +204,13 @@ export interface DdocProps extends CommentAccountProps {
187
204
  walletAddress?: string | null;
188
205
  username?: string | null;
189
206
  setUsername?: React.Dispatch<SetStateAction<string>>;
207
+ /**
208
+ * Host element to render the navbar into. Omit to render it as the editor's
209
+ * first row. Pass null while the element is not attached yet.
210
+ */
211
+ navbarContainer?: HTMLElement | null;
212
+ /** Show the toolbar's navbar collapse chevron. Default true. */
213
+ showNavbarToggle?: boolean;
190
214
  renderNavbar?: ({ editor, liveEditor, }: {
191
215
  /** JSON snapshot — legacy field, unchanged. */
192
216
  editor: JSONContent;
@@ -206,9 +230,15 @@ export interface DdocProps extends CommentAccountProps {
206
230
  */
207
231
  enableFanficTemplate?: boolean;
208
232
  onError?: (error: string) => void;
233
+ /** Active-tab stats. Fires with all four fields whenever one changes. */
234
+ onStatsChange?: (stats: DdocStats) => void;
235
+ /** @deprecated Use onStatsChange. */
209
236
  setCharacterCount?: React.Dispatch<SetStateAction<number>>;
237
+ /** @deprecated Use onStatsChange. */
210
238
  setWordCount?: React.Dispatch<SetStateAction<number>>;
239
+ /** @deprecated Use onStatsChange. */
211
240
  setSelectedWordCount?: React.Dispatch<SetStateAction<number>>;
241
+ /** @deprecated Use onStatsChange. */
212
242
  setPageCount?: React.Dispatch<SetStateAction<number>>;
213
243
  tags?: Array<{
214
244
  name: string;
@@ -217,12 +247,17 @@ export interface DdocProps extends CommentAccountProps {
217
247
  className?: string;
218
248
  unFocused?: boolean;
219
249
  isPresentationMode?: boolean;
250
+ onPresentationModeChange?: (active: boolean) => void;
251
+ /** @deprecated Use onPresentationModeChange. */
220
252
  setIsPresentationMode?: React.Dispatch<SetStateAction<boolean>>;
221
253
  /** Split View: edit markdown on the left, see the read-only ddoc render on the right. */
222
254
  isSplitView?: boolean;
255
+ onSplitViewChange?: (active: boolean) => void;
256
+ /** @deprecated Use onSplitViewChange. */
223
257
  setIsSplitView?: React.Dispatch<SetStateAction<boolean>>;
224
258
  onComment?: () => void;
225
259
  onInlineComment?: () => void;
260
+ /** @deprecated Use onFocusModeChange. Still fires on every change. */
226
261
  onFocusMode?: (isFocusMode: boolean) => void;
227
262
  /** Controlled focus mode (D6). Omit for the legacy internal-state behavior. */
228
263
  isFocusMode?: boolean;
@@ -248,6 +283,7 @@ export interface DdocProps extends CommentAccountProps {
248
283
  renderToolbarLeading?: () => React.ReactNode;
249
284
  metadataProxyUrl?: string;
250
285
  onCopyHeadingLink?: (link: string) => void;
286
+ /** @deprecated No effect. The host footer sits outside the editor. */
251
287
  footerHeight?: string;
252
288
  activeModel?: CustomModel;
253
289
  maxTokens?: number;
@@ -1,10 +1,12 @@
1
1
  import { DdocProps } from './types';
2
2
  import { Editor } from '@tiptap/react';
3
3
  import { DBlockRuntimeState } from './extensions/d-block/dblock-runtime';
4
+ import { EditorWidthStore } from './utils/editor-width-store';
4
5
 
5
- export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, isFocusMode, theme, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, onIndexedDbError, disableInlineComment, initialCommentAnchors, isPreviewEditor, fonts, preferredSchemaVersion, ...rest }: Partial<DdocProps> & {
6
+ export declare const useDdocEditor: ({ isPreviewMode, viewerMode, initialContent, versionHistoryState, collaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, setSelectedWordCount, setPageCount, onStatsChange, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, isFocusMode, theme, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, onIndexedDbError, disableInlineComment, initialCommentAnchors, isPreviewEditor, fonts, preferredSchemaVersion, editorWidthStore, ...rest }: Partial<DdocProps> & {
6
7
  isFocusMode?: boolean;
7
8
  isPreviewEditor?: boolean;
9
+ editorWidthStore?: EditorWidthStore;
8
10
  }) => {
9
11
  ydoc: import('yjs').Doc;
10
12
  awareness: import('y-protocols/awareness.js').Awareness | null;
@@ -0,0 +1 @@
1
+ export declare const canUseEditorContainerQueries: () => boolean;
@@ -0,0 +1,6 @@
1
+ export type EditorWidthStore = {
2
+ get(): number | null;
3
+ set(width: number): void;
4
+ subscribe(listener: () => void): () => void;
5
+ };
6
+ export declare const createEditorWidthStore: () => EditorWidthStore;
@@ -1,4 +1,6 @@
1
- export declare const useResponsive: () => {
1
+ import { EditorWidthStore } from './editor-width-store';
2
+
3
+ export declare const useResponsive: (store?: EditorWidthStore) => {
2
4
  isBelow1024px: boolean;
3
5
  isBelow1280px: boolean;
4
6
  isMobileScreen: boolean;
@@ -0,0 +1,8 @@
1
+ import { DdocStats } from '../types';
2
+
3
+ export declare const createStatsPublisher: (emit: (stats: DdocStats) => void) => {
4
+ beginTab(pages: number | null): void;
5
+ publish(patch: Partial<DdocStats>, options?: {
6
+ tick?: boolean;
7
+ }): void;
8
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx as m, jsxs as L } from "react/jsx-runtime";
2
2
  import { useRef as D, useState as E, useEffect as A } from "react";
3
3
  import { DynamicDropdown as P, Tooltip as O, IconButton as T } from "@fileverse/ui";
4
- import { a3 as _, a4 as w, c as R } from "./index-DtE1zaH8.mjs";
4
+ import { a3 as _, a4 as w, c as R } from "./index-8MQH4TSF.mjs";
5
5
  const p = (e, n, o = n) => {
6
6
  const { state: i } = e, l = i.changeByRange((t) => {
7
7
  const d = i.sliceDoc(t.from, t.to), r = i.sliceDoc(