@fileverse-dev/ddoc 3.0.43 → 3.0.45-patch-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.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D as d, E as r, P as s, R as a, h as t, u as i } from "./index-DocacLHn.mjs";
1
+ import { D as d, E as r, P as s, R as a, h as t, u as i } from "./index-kMgeOa9X.mjs";
2
2
  export {
3
3
  d as DdocEditor,
4
4
  r as Editor,
@@ -0,0 +1,10 @@
1
+ interface ExportAsModalProps {
2
+ open: boolean;
3
+ onOpenChange: (open: boolean) => void;
4
+ onExport?: (data: {
5
+ format: string;
6
+ tab: string;
7
+ }) => void;
8
+ }
9
+ export declare const ExportAsModal: ({ open, onOpenChange, onExport, }: ExportAsModalProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,20 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { DocumentOutlineProps } from '../toc/types';
3
+ import { Tab } from './utils/tab-utils';
4
+
5
+ export interface DocumentMobileTabPanelProps {
6
+ tabs: Tab[];
7
+ setTabs: Dispatch<SetStateAction<Tab[]>>;
8
+ activeTabId: string;
9
+ setActiveTabId: (id: string) => void;
10
+ editor: DocumentOutlineProps['editor'];
11
+ items: DocumentOutlineProps['items'];
12
+ setItems: DocumentOutlineProps['setItems'];
13
+ orientation?: DocumentOutlineProps['orientation'];
14
+ renameTab: (tabId: string, payload: {
15
+ newName?: string;
16
+ emoji?: string;
17
+ }) => void;
18
+ duplicateTab: (tabId: string) => void;
19
+ }
20
+ export declare const DocumentMobileTabPanel: ({ tabs, activeTabId, setActiveTabId, editor, items, setItems, orientation, renameTab, duplicateTab, }: DocumentMobileTabPanelProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { default as React } from 'react';
2
+ import { DocumentOutlineProps } from '../toc/types';
3
+ import { Tab } from './utils/tab-utils';
4
+ import { Editor } from '@tiptap/core';
5
+
6
+ import * as Y from 'yjs';
7
+ export interface DocumentTabsSidebarProps {
8
+ tabs: Tab[];
9
+ setTabs: React.Dispatch<React.SetStateAction<Tab[]>>;
10
+ activeTabId: string;
11
+ setActiveTabId: (id: string) => void;
12
+ showTOC: DocumentOutlineProps['showTOC'];
13
+ setShowTOC: DocumentOutlineProps['setShowTOC'];
14
+ hasToC: DocumentOutlineProps['hasToC'];
15
+ isPreviewMode: DocumentOutlineProps['isPreviewMode'];
16
+ editor: DocumentOutlineProps['editor'];
17
+ items: DocumentOutlineProps['items'];
18
+ setItems: DocumentOutlineProps['setItems'];
19
+ orientation?: DocumentOutlineProps['orientation'];
20
+ createTab: () => void;
21
+ renameTab: (tabId: string, payload: {
22
+ newName?: string;
23
+ emoji?: string;
24
+ }) => void;
25
+ duplicateTab: (tabId: string) => void;
26
+ orderTab: (destinationTabId: string, activeTabId: string) => void;
27
+ ydoc: Y.Doc;
28
+ }
29
+ export declare const DocumentTabsSidebar: ({ tabs, activeTabId, setActiveTabId, showTOC, setShowTOC, hasToC, isPreviewMode, editor, items, setItems, orientation, createTab, renameTab, duplicateTab, orderTab, ydoc, }: DocumentTabsSidebarProps) => import("react/jsx-runtime").JSX.Element;
30
+ export declare const DdocTab: ({ tab, handleEmojiChange, handleNameChange, onClick, editor, tocItem, setTocItems, orientation, activeTabId, duplicateTab, activeDragId, ydoc, }: {
31
+ tab: Tab;
32
+ handleNameChange: (tabId: string, nextName: string) => void;
33
+ handleEmojiChange: (tabId: string, nextEmoji: string) => void;
34
+ onClick: () => void;
35
+ editor: Editor;
36
+ tocItem: DocumentOutlineProps["items"];
37
+ setTocItems: DocumentOutlineProps["setItems"];
38
+ orientation: DocumentOutlineProps["orientation"];
39
+ activeTabId: string;
40
+ duplicateTab: (tabId: string) => void;
41
+ activeDragId: string | null;
42
+ ydoc: Y.Doc;
43
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { EmojiPickerListCategoryHeaderProps, EmojiPickerListEmojiProps, EmojiPickerListRowProps, EmojiPicker as EmojiPickerPrimitive } from 'frimousse';
2
+
3
+ export declare const TabEmojiPicker: ({ emoji, setEmoji, isEditing, }: {
4
+ emoji: string;
5
+ setEmoji: (emoji: string) => void;
6
+ isEditing: boolean;
7
+ }) => import("react/jsx-runtime").JSX.Element;
8
+ export declare function EmojiPicker({ className, ...props }: React.ComponentProps<typeof EmojiPickerPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
9
+ export declare function EmojiPickerSearch({ className, ...props }: React.ComponentProps<typeof EmojiPickerPrimitive.Search>): import("react/jsx-runtime").JSX.Element;
10
+ export declare function EmojiPickerRow({ children, ...props }: EmojiPickerListRowProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function EmojiPickerEmoji({ emoji, className, ...props }: EmojiPickerListEmojiProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function EmojiPickerCategoryHeader({ category, ...props }: EmojiPickerListCategoryHeaderProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function EmojiPickerContent({ className, ...props }: React.ComponentProps<typeof EmojiPickerPrimitive.Viewport>): import("react/jsx-runtime").JSX.Element;
14
+ export declare function EmojiPickerFooter({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ export declare const SortableTabItem: (props: any) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const TabItem: ({ tabId, name, emoji, onNameChange, onEmojiChange, onClick, isActive, onDuplicate, dragHandleProps, hideContentMenu, }: {
3
+ tabId: string;
4
+ name: string;
5
+ emoji: string;
6
+ onNameChange: (name: string) => void;
7
+ onEmojiChange: (emoji: string) => void;
8
+ onClick: () => void;
9
+ isActive: boolean;
10
+ onDuplicate?: (id: string) => void;
11
+ dragHandleProps?: any;
12
+ hideContentMenu?: boolean;
13
+ }) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const TabDragPreview: ({ name, emoji, }: {
15
+ name: string;
16
+ emoji: string;
17
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import * as Y from 'yjs';
2
+ export interface Tab {
3
+ id: string;
4
+ name: string;
5
+ showOutline: boolean;
6
+ emoji: string | null;
7
+ }
8
+ export declare function deriveTabsFromEncodedState(yjsEncodedState: string, doc: Y.Doc): {
9
+ tabList: Tab[];
10
+ activeTabId: string;
11
+ };
12
+ export declare function getTabsYdocNodes(doc: Y.Doc): {
13
+ root: Y.Map<unknown>;
14
+ order: Y.Array<any>;
15
+ tabs: Y.Map<any>;
16
+ activeTab: Y.Text | null;
17
+ };
18
+ export declare function cloneFragmentContent(fragment: Y.XmlFragment): (Y.XmlElement | Y.XmlText)[];
@@ -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, }: 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, }: DocumentOutlineProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+
3
+ export declare const MemorizedToC: React.MemoExoticComponent<React.MemoExoticComponent<({ items, editor, setItems, orientation }: import('./types').ToCProps) => import("react/jsx-runtime").JSX.Element>>;
@@ -1,6 +1,8 @@
1
1
  import { Editor } from '@tiptap/react';
2
- import { SetStateAction } from 'react';
2
+ import { default as React, Dispatch, SetStateAction } from 'react';
3
+ import { Tab } from '../tabs/utils/tab-utils';
3
4
 
5
+ import * as Y from 'yjs';
4
6
  export interface ToCItemType {
5
7
  id: string;
6
8
  level: number;
@@ -27,7 +29,19 @@ export interface DocumentOutlineProps {
27
29
  items: ToCItemType[];
28
30
  setItems: (items: ToCItemType[] | ((prev: ToCItemType[]) => ToCItemType[])) => void;
29
31
  showTOC: boolean | undefined;
30
- setShowTOC: React.Dispatch<SetStateAction<boolean>> | undefined;
32
+ setShowTOC: Dispatch<SetStateAction<boolean>> | undefined;
31
33
  isPreviewMode: boolean;
32
34
  orientation?: 'portrait' | 'landscape';
35
+ tabs: Tab[];
36
+ setTabs: Dispatch<SetStateAction<Tab[]>>;
37
+ activeTabId: string;
38
+ setActiveTabId: (id: string) => void;
39
+ createTab: () => void;
40
+ renameTab: (tabId: string, payload: {
41
+ newName?: string;
42
+ emoji?: string;
43
+ }) => void;
44
+ duplicateTab: (tabId: string) => void;
45
+ orderTab: (destinationTabId: string, activeTabId: string) => void;
46
+ ydoc: Y.Doc;
33
47
  }
@@ -0,0 +1,57 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { DdocProps } from '../types';
3
+ import { AnyExtension, Editor } from '@tiptap/react';
4
+ import { ToCItemType } from '../components/toc/types';
5
+ import { IConnectConf } from '../sync-local/useSyncMachine';
6
+
7
+ import * as Y from 'yjs';
8
+ interface UseTabEditorArgs {
9
+ ydoc: Y.Doc;
10
+ isPreviewMode?: boolean;
11
+ initialContent: DdocProps['initialContent'];
12
+ enableCollaboration?: boolean;
13
+ collabConfig?: DdocProps['collabConfig'];
14
+ isReady?: boolean;
15
+ awareness?: any;
16
+ disableInlineComment?: boolean;
17
+ onCommentInteraction?: DdocProps['onCommentInteraction'];
18
+ onError?: DdocProps['onError'];
19
+ ipfsImageUploadFn?: DdocProps['ipfsImageUploadFn'];
20
+ metadataProxyUrl?: string;
21
+ onCopyHeadingLink?: DdocProps['onCopyHeadingLink'];
22
+ ipfsImageFetchFn?: DdocProps['ipfsImageFetchFn'];
23
+ fetchV1ImageFn?: DdocProps['fetchV1ImageFn'];
24
+ isConnected?: boolean;
25
+ activeModel?: DdocProps['activeModel'];
26
+ maxTokens?: number;
27
+ isAIAgentEnabled?: boolean;
28
+ setCharacterCount?: DdocProps['setCharacterCount'];
29
+ setWordCount?: DdocProps['setWordCount'];
30
+ setIsContentLoading: Dispatch<SetStateAction<boolean>>;
31
+ setIsCollabContentLoading: Dispatch<SetStateAction<boolean>>;
32
+ unFocused?: boolean;
33
+ zoomLevel?: string;
34
+ isPresentationMode?: boolean;
35
+ onInvalidContentError?: DdocProps['onInvalidContentError'];
36
+ ignoreCorruptedData?: boolean;
37
+ onCollaboratorChange?: DdocProps['onCollaboratorChange'];
38
+ onConnect: (connectConfig: IConnectConf) => void;
39
+ hasCollabContentInitialised?: boolean;
40
+ initialiseYjsIndexedDbProvider: () => Promise<void>;
41
+ externalExtensions?: Record<string, AnyExtension>;
42
+ isContentLoading?: boolean;
43
+ activeTabId: string;
44
+ }
45
+ export declare const useTabEditor: ({ ydoc, isPreviewMode, initialContent, enableCollaboration, collabConfig, isReady, awareness, disableInlineComment, onCommentInteraction, onError, ipfsImageUploadFn, metadataProxyUrl, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, setCharacterCount, setWordCount, setIsContentLoading, setIsCollabContentLoading, unFocused, zoomLevel, isPresentationMode, onInvalidContentError, ignoreCorruptedData, onCollaboratorChange, onConnect, hasCollabContentInitialised, initialiseYjsIndexedDbProvider, externalExtensions, isContentLoading, activeTabId, }: UseTabEditorArgs) => {
46
+ editor: Editor | null;
47
+ ref: import('react').RefObject<HTMLDivElement>;
48
+ slides: string[];
49
+ setSlides: Dispatch<SetStateAction<string[]>>;
50
+ tocItems: ToCItemType[];
51
+ setTocItems: Dispatch<SetStateAction<ToCItemType[]>>;
52
+ activeCommentId: string | null;
53
+ setActiveCommentId: Dispatch<SetStateAction<string | null>>;
54
+ focusCommentWithActiveId: (id: string) => void;
55
+ isContentLoading: boolean | undefined;
56
+ };
57
+ export {};
@@ -0,0 +1,23 @@
1
+ import { DdocProps } from '../types';
2
+ import { Tab } from '../components/tabs/utils/tab-utils';
3
+ import * as Y from 'yjs';
4
+ interface UseTabManagerArgs {
5
+ ydoc: Y.Doc;
6
+ initialContent: DdocProps['initialContent'];
7
+ enableCollaboration: DdocProps['enableCollaboration'];
8
+ }
9
+ export declare const useTabManager: ({ ydoc, initialContent, enableCollaboration, }: UseTabManagerArgs) => {
10
+ tabs: Tab[];
11
+ activeTabId: string;
12
+ setTabs: import('react').Dispatch<import('react').SetStateAction<Tab[]>>;
13
+ setActiveTabId: import('react').Dispatch<import('react').SetStateAction<string>>;
14
+ createTab: () => string;
15
+ deleteTab: (tabId: string) => void;
16
+ renameTab: (tabId: string, { newName, emoji }: {
17
+ newName?: string;
18
+ emoji?: string;
19
+ }) => void;
20
+ duplicateTab: (tabId: string) => string | undefined;
21
+ orderTab: (destinationTabId: string, movedTabId: string) => void;
22
+ };
23
+ export {};
@@ -0,0 +1,27 @@
1
+ import { JSONContent } from '@tiptap/react';
2
+ import { DdocProps } from '../types';
3
+ import * as Y from 'yjs';
4
+ interface UseYjsSetupArgs {
5
+ onChange?: (updatedDocContent: string | JSONContent, updateChunk: string) => void;
6
+ enableIndexeddbSync?: boolean;
7
+ ddocId?: string;
8
+ enableCollaboration?: boolean;
9
+ onIndexedDbError?: (error: Error) => void;
10
+ onCollabError?: DdocProps['onCollabError'];
11
+ onCollaborationConnectCallback?: DdocProps['onCollaborationConnectCallback'];
12
+ onCollaborationCommit?: DdocProps['onCollaborationCommit'];
13
+ onFetchCommitContent?: DdocProps['onFetchCommitContent'];
14
+ onCollabSessionTermination?: () => void;
15
+ onUnMergedUpdates?: (state: boolean) => void;
16
+ }
17
+ export declare const useYjsSetup: ({ onChange, enableIndexeddbSync, ddocId, enableCollaboration, onIndexedDbError, onCollabError, onCollaborationConnectCallback, onCollaborationCommit, onFetchCommitContent, onCollabSessionTermination, onUnMergedUpdates, }: UseYjsSetupArgs) => {
18
+ ydoc: Y.Doc;
19
+ onConnect: (connectConfig: import('../sync-local/useSyncMachine').IConnectConf) => void;
20
+ isReady: boolean;
21
+ terminateSession: () => void;
22
+ awareness: any;
23
+ hasCollabContentInitialised: boolean;
24
+ initialiseYjsIndexedDbProvider: () => Promise<void>;
25
+ refreshYjsIndexedDbProvider: () => Promise<void>;
26
+ };
27
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { SyncMachineContext } from '.';
2
2
 
3
- interface IConnectConf {
3
+ export interface IConnectConf {
4
4
  username?: string;
5
5
  roomKey: string;
6
6
  roomId: string;
@@ -36,4 +36,3 @@ export declare const useSyncMachine: (config: Partial<SyncMachineContext>) => {
36
36
  data: any;
37
37
  }, import('xstate').BaseActionObject, import('xstate').ServiceMap>>;
38
38
  };
39
- export {};
@@ -1,19 +1,29 @@
1
1
  import { DdocProps } from './types';
2
- import { ToCItemType } from './components/toc/types';
3
2
 
4
- import * as Y from 'yjs';
5
3
  export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, onChange, onCollaboratorChange, onCommentInteraction, onError, setCharacterCount, setWordCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, fetchV1ImageFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, collabConfig, onIndexedDbError, disableInlineComment, ...rest }: Partial<DdocProps>) => {
6
- editor: import('@tiptap/core').Editor | null;
4
+ ydoc: import('yjs').Doc;
5
+ refreshYjsIndexedDbProvider: () => Promise<void>;
6
+ terminateSession: () => void;
7
7
  isContentLoading: boolean;
8
+ tabs: import('./components/tabs/utils/tab-utils').Tab[];
9
+ activeTabId: string;
10
+ setTabs: import('react').Dispatch<import('react').SetStateAction<import('./components/tabs/utils/tab-utils').Tab[]>>;
11
+ setActiveTabId: import('react').Dispatch<import('react').SetStateAction<string>>;
12
+ createTab: () => string;
13
+ deleteTab: (tabId: string) => void;
14
+ renameTab: (tabId: string, { newName, emoji }: {
15
+ newName?: string;
16
+ emoji?: string;
17
+ }) => void;
18
+ duplicateTab: (tabId: string) => string | undefined;
19
+ orderTab: (destinationTabId: string, movedTabId: string) => void;
20
+ editor: import('@tiptap/core').Editor | null;
8
21
  ref: import('react').RefObject<HTMLDivElement>;
9
- ydoc: Y.Doc;
10
- refreshYjsIndexedDbProvider: () => Promise<void>;
22
+ slides: string[];
23
+ setSlides: import('react').Dispatch<import('react').SetStateAction<string[]>>;
24
+ tocItems: import('./components/toc/types').ToCItemType[];
25
+ setTocItems: import('react').Dispatch<import('react').SetStateAction<import('./components/toc/types').ToCItemType[]>>;
11
26
  activeCommentId: string | null;
12
27
  setActiveCommentId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
13
28
  focusCommentWithActiveId: (id: string) => void;
14
- slides: string[];
15
- setSlides: import('react').Dispatch<import('react').SetStateAction<string[]>>;
16
- tocItems: ToCItemType[];
17
- setTocItems: import('react').Dispatch<import('react').SetStateAction<ToCItemType[]>>;
18
- terminateSession: () => void;
19
29
  };