@fileverse-dev/ddoc 3.0.80 → 3.0.82-focus-mode-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.
@@ -4,7 +4,7 @@ import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
4
4
  import { Tab } from './tabs/utils/tab-utils';
5
5
 
6
6
  import * as Y from 'yjs';
7
- declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onDocxImport, isLoading, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, }: {
7
+ declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onDocxImport, isLoading, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, }: {
8
8
  editor: Editor | null;
9
9
  onError?: (errorString: string) => void;
10
10
  zoomLevel: string;
@@ -27,6 +27,7 @@ declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavb
27
27
  isConnected?: boolean;
28
28
  tabs: Tab[];
29
29
  ydoc: Y.Doc;
30
+ toggleFocusMode?: () => void;
30
31
  onRegisterExportTrigger?: ((trigger: ((format?: string, name?: string) => void) | null) => void) | undefined;
31
32
  }) => import("react/jsx-runtime").JSX.Element;
32
33
  export default TiptapToolBar;
@@ -0,0 +1,14 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { DdocProps } from '../types';
3
+
4
+ type FullScreenToolbarProps = {
5
+ dropdownOpen: boolean;
6
+ setDropdownOpen: Dispatch<SetStateAction<boolean>>;
7
+ zoomLevel: DdocProps['zoomLevel'];
8
+ setZoomLevel: DdocProps['setZoomLevel'];
9
+ showTOC: DdocProps['showTOC'];
10
+ setShowTOC: DdocProps['setShowTOC'];
11
+ toggleFocusMode: () => Promise<void>;
12
+ };
13
+ export declare const FullScreenToolbar: ({ dropdownOpen, setDropdownOpen, zoomLevel, setZoomLevel, showTOC, setShowTOC, toggleFocusMode, }: FullScreenToolbarProps) => import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -4,18 +4,42 @@ export interface Tab {
4
4
  name: string;
5
5
  emoji: string | null;
6
6
  }
7
+ export interface TabsYdocNodes {
8
+ order: Y.Array<string>;
9
+ nameById: Y.Map<string>;
10
+ emojiById: Y.Map<string | null>;
11
+ tabState: Y.Map<unknown>;
12
+ deletedById: Y.Map<boolean>;
13
+ }
14
+ export interface SyncedTabsYdocNodes extends TabsYdocNodes {
15
+ didWrite: boolean;
16
+ }
17
+ interface TabSyncOptions {
18
+ createDefaultTabIfMissing?: boolean;
19
+ }
7
20
  export declare const DEFAULT_TAB_ID = "default";
8
21
  export declare const DEFAULT_TAB_NAME = "Tab 1";
9
- export declare function deriveTabsFromEncodedState(yjsEncodedState: string, doc: Y.Doc, options?: {
10
- createDefaultTabIfMissing?: boolean;
11
- }): {
22
+ export declare const LEGACY_ROOT_KEY = "ddocTabs";
23
+ export declare const ORDER_ROOT_KEY = "tabs_order";
24
+ export declare const NAME_ROOT_KEY = "tabs_name_registry";
25
+ export declare const EMOJI_ROOT_KEY = "tabs_emoji_registry";
26
+ export declare const STATE_ROOT_KEY = "tabs_state";
27
+ export declare const DELETED_ROOT_KEY = "tabs_delete_registry";
28
+ export declare const ACTIVE_TAB_STATE_KEY = "activeTabId";
29
+ export declare function syncTabState(doc: Y.Doc, options?: TabSyncOptions, transactionOrigin?: unknown): boolean;
30
+ export declare function deriveTabsFromEncodedState(yjsEncodedState: string | string[] | null | undefined, doc: Y.Doc, options?: TabSyncOptions): {
12
31
  tabList: Tab[];
13
32
  activeTabId: string;
33
+ didWrite: boolean;
14
34
  };
15
- export declare function getTabsYdocNodes(doc: Y.Doc): {
16
- root: Y.Map<unknown>;
17
- order: Y.Array<string>;
18
- tabs: Y.Map<Y.Map<string | null>>;
19
- activeTab: Y.Text;
20
- };
35
+ export declare function getTabsYdocNodes(doc: Y.Doc): TabsYdocNodes;
36
+ export declare function syncTabStateAndGetNodes(doc: Y.Doc, options?: TabSyncOptions, transactionOrigin?: unknown): SyncedTabsYdocNodes;
37
+ export declare function mergeTabAwareYjsUpdates(encodedUpdates: string[], options?: TabSyncOptions): string;
38
+ export declare function getActiveTabIdFromNodes(tabNodes: Pick<TabsYdocNodes, 'tabState'>): string | null;
39
+ export declare function getTabMetadata(tabNodes: Pick<TabsYdocNodes, 'nameById' | 'emojiById'>, tabId: string): {
40
+ name: string;
41
+ emoji: string | null;
42
+ } | null;
43
+ export declare function getTabListFromNodes(tabNodes: Pick<TabsYdocNodes, 'order' | 'nameById' | 'emojiById'>): Tab[];
21
44
  export declare function cloneFragmentContent(fragment: Y.XmlFragment): (Y.XmlElement | Y.XmlText)[];
45
+ export {};
@@ -0,0 +1,16 @@
1
+ import { JSONContent } from '@tiptap/core';
2
+
3
+ type TabSummary = {
4
+ id: string;
5
+ name: string;
6
+ };
7
+ export type VersionTabSnapshot = {
8
+ hasTabState: boolean;
9
+ tabs: TabSummary[];
10
+ activeTabId: string | null;
11
+ defaultTabId: string;
12
+ docDefault: JSONContent | null;
13
+ docByTabId: Record<string, JSONContent | null>;
14
+ };
15
+ export declare function buildVersionDiffSnapshot(content: string): VersionTabSnapshot;
16
+ export {};
@@ -40,16 +40,16 @@ export declare const CANVAS_DIMENSIONS: {
40
40
  readonly minHeight: "100%";
41
41
  };
42
42
  readonly '1.4': {
43
- readonly width: "70%";
44
- readonly minHeight: "200%";
43
+ readonly width: 1190;
44
+ readonly minHeight: "140%";
45
45
  };
46
46
  readonly '1.5': {
47
- readonly width: 1062.5;
48
- readonly minHeight: "100%";
47
+ readonly width: 1275;
48
+ readonly minHeight: "150%";
49
49
  };
50
50
  readonly '2': {
51
- readonly width: 1548;
52
- readonly minHeight: undefined;
51
+ readonly width: 1700;
52
+ readonly minHeight: "200%";
53
53
  };
54
54
  };
55
55
  readonly landscape: {
@@ -66,16 +66,16 @@ export declare const CANVAS_DIMENSIONS: {
66
66
  readonly minHeight: "100%";
67
67
  };
68
68
  readonly '1.4': {
69
- readonly width: "90%";
70
- readonly minHeight: "200%";
69
+ readonly width: 1666;
70
+ readonly minHeight: "140%";
71
71
  };
72
72
  readonly '1.5': {
73
- readonly width: 1487.5;
74
- readonly minHeight: "100%";
73
+ readonly width: 1785;
74
+ readonly minHeight: "150%";
75
75
  };
76
76
  readonly '2': {
77
- readonly width: 2166;
78
- readonly minHeight: undefined;
77
+ readonly width: 2380;
78
+ readonly minHeight: "200%";
79
79
  };
80
80
  };
81
81
  };
@@ -0,0 +1,4 @@
1
+ export declare const zoomLevels: {
2
+ title: string;
3
+ value: string;
4
+ }[];
@@ -4,6 +4,7 @@ import { DocumentStyling } from '../types';
4
4
  interface EditorContextType {
5
5
  documentStyling?: DocumentStyling;
6
6
  theme: 'light' | 'dark';
7
+ isFocusMode: boolean;
7
8
  }
8
9
  export declare const EditorContext: React.Context<EditorContextType | null>;
9
10
  export declare const useEditorContext: () => EditorContextType;
@@ -11,5 +12,6 @@ export declare const EditorProvider: React.FC<{
11
12
  children: ReactNode;
12
13
  documentStyling?: DocumentStyling;
13
14
  theme?: 'light' | 'dark';
15
+ isFocusMode?: boolean;
14
16
  }>;
15
17
  export {};
@@ -0,0 +1,8 @@
1
+ type UseFocusModeOptions = {
2
+ onFocusMode?: (isFocusMode: boolean) => void;
3
+ };
4
+ export declare const useFocusMode: ({ onFocusMode }?: UseFocusModeOptions) => {
5
+ isFocusMode: boolean;
6
+ toggleFocusMode: () => Promise<void>;
7
+ };
8
+ export {};
@@ -158,6 +158,7 @@ export interface DdocProps extends CommentAccountProps {
158
158
  setIsPresentationMode?: React.Dispatch<SetStateAction<boolean>>;
159
159
  onComment?: () => void;
160
160
  onInlineComment?: () => void;
161
+ onFocusMode?: (isFocusMode: boolean) => void;
161
162
  onMarkdownExport?: () => void;
162
163
  onMarkdownImport?: () => void;
163
164
  onPdfExport?: () => void;
@@ -0,0 +1,5 @@
1
+ export declare const getEditorScrollContainer: ({ targetElement, editorRoot, }: {
2
+ targetElement: HTMLElement;
3
+ editorRoot?: HTMLElement | null;
4
+ }) => HTMLElement | null;
5
+ export default getEditorScrollContainer;