@fileverse-dev/ddoc 2.2.9-update-image-arch-3 → 2.2.9-webllm-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 (27) hide show
  1. package/README.md +1 -2
  2. package/dist/{ccip-CQ8-9ZUe.mjs → ccip-l8ihOsjW.mjs} +1 -1
  3. package/dist/{index-B94UPSTo.mjs → index-DxRcjag5.mjs} +26361 -26413
  4. package/dist/index.es.js +1 -1
  5. package/dist/package/components/editor-bubble-menu/props.d.ts +0 -5
  6. package/dist/package/components/editor-bubble-menu/types.d.ts +1 -6
  7. package/dist/package/components/editor-toolbar.d.ts +2 -7
  8. package/dist/package/components/editor-utils.d.ts +2 -7
  9. package/dist/package/components/mobile-toolbar.d.ts +2 -7
  10. package/dist/package/components/presentation-mode/presentation-mode.d.ts +1 -6
  11. package/dist/package/extensions/ai-autocomplete/workers/webllm.worker.d.ts +1 -0
  12. package/dist/package/extensions/d-block/dblock.d.ts +1 -2
  13. package/dist/package/extensions/default-extension.d.ts +1 -11
  14. package/dist/package/extensions/iframe/iframe.d.ts +0 -5
  15. package/dist/package/extensions/mardown-paste-handler/index.d.ts +3 -10
  16. package/dist/package/extensions/resizable-media/media-paste-drop-plugin/media-paste-drop-plugin.d.ts +1 -2
  17. package/dist/package/extensions/resizable-media/resizable-media-node-view.d.ts +1 -5
  18. package/dist/package/extensions/resizable-media/resizable-media.d.ts +3 -6
  19. package/dist/package/extensions/slash-command/slash-comand.d.ts +1 -2
  20. package/dist/package/extensions/slash-command/slash-command-utils.d.ts +2 -3
  21. package/dist/package/types.d.ts +2 -18
  22. package/dist/package/use-ddoc-editor.d.ts +1 -1
  23. package/dist/package/utils/md-to-slides.d.ts +1 -5
  24. package/dist/package/utils/upload-images.d.ts +1 -2
  25. package/dist/style.css +1 -1
  26. package/package.json +2 -1
  27. package/dist/package/components/secure-image-v2.d.ts +0 -20
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-B94UPSTo.mjs";
1
+ import { D as d, E as r, P as s, R as a, h as t, u as i } from "./index-DxRcjag5.mjs";
2
2
  export {
3
3
  d as DdocEditor,
4
4
  r as Editor,
@@ -54,11 +54,6 @@ export declare const bubbleMenuProps: (props: EditorBubbleMenuProps) => {
54
54
  commentDrawerOpen?: boolean;
55
55
  setCommentDrawerOpen?: React.Dispatch<import('react').SetStateAction<boolean>>;
56
56
  isCollabDocumentPublished?: boolean | undefined;
57
- ipfsImageUploadFn?: (file: File) => Promise<import('../../types').IpfsImageUploadResponse>;
58
- ipfsImageFetchFn?: (_data: import('../../types').IpfsImageFetchPayload) => Promise<{
59
- url: string;
60
- file: File;
61
- }>;
62
57
  onReminderCreate?: (reminder: import('../../..').Reminder, type: string) => void;
63
58
  isConnected?: boolean;
64
59
  };
@@ -1,6 +1,6 @@
1
1
  import { BubbleMenuProps, Editor } from '@tiptap/react';
2
2
  import { SetStateAction } from 'react';
3
- import { InlineCommentData, IpfsImageFetchPayload, IpfsImageUploadResponse } from '../../types';
3
+ import { InlineCommentData } from '../../types';
4
4
  import { Reminder } from '../../extensions/reminder-block/types';
5
5
 
6
6
  export interface BubbleMenuItem {
@@ -24,11 +24,6 @@ export type EditorBubbleMenuProps = Omit<BubbleMenuProps, 'children'> & {
24
24
  commentDrawerOpen?: boolean;
25
25
  setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
26
26
  isCollabDocumentPublished?: boolean | undefined;
27
- ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
28
- ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
29
- url: string;
30
- file: File;
31
- }>;
32
27
  onReminderCreate?: (reminder: Reminder, type: string) => void;
33
28
  isConnected?: boolean;
34
29
  };
@@ -1,22 +1,17 @@
1
1
  import { default as React } from 'react';
2
2
  import { Editor } from '@tiptap/react';
3
- import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
4
3
 
5
- declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, isLoading, ipfsImageFetchFn, }: {
4
+ declare const TiptapToolBar: ({ editor, onError, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, secureImageUploadUrl, onMarkdownExport, onMarkdownImport, onPdfExport, isLoading, }: {
6
5
  editor: Editor | null;
7
6
  onError?: (errorString: string) => void;
8
7
  zoomLevel: string;
9
8
  setZoomLevel: (zoom: string) => void;
10
9
  isNavbarVisible: boolean;
11
10
  setIsNavbarVisible: React.Dispatch<React.SetStateAction<boolean>>;
12
- ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
11
+ secureImageUploadUrl?: string;
13
12
  onMarkdownExport?: () => void;
14
13
  onMarkdownImport?: () => void;
15
14
  onPdfExport?: () => void;
16
15
  isLoading: boolean;
17
- ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
18
- url: string;
19
- file: File;
20
- }>;
21
16
  }) => import("react/jsx-runtime").JSX.Element;
22
17
  export default TiptapToolBar;
@@ -1,7 +1,6 @@
1
1
  import { default as React, Dispatch, SetStateAction } from 'react';
2
2
  import { IEditorTool } from '../hooks/use-visibility';
3
3
  import { Editor } from '@tiptap/react';
4
- import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
5
4
 
6
5
  interface IEditorToolElement {
7
6
  icon: any;
@@ -37,17 +36,13 @@ export declare const IMG_UPLOAD_SETTINGS: {
37
36
  errorMsg: string;
38
37
  };
39
38
  };
40
- export declare const useEditorToolbar: ({ editor, onError, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, ipfsImageFetchFn, }: {
39
+ export declare const useEditorToolbar: ({ editor, onError, secureImageUploadUrl, onMarkdownExport, onMarkdownImport, onPdfExport, }: {
41
40
  editor: Editor | null;
42
41
  onError?: (errorString: string) => void;
43
- ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
42
+ secureImageUploadUrl?: string;
44
43
  onMarkdownExport?: () => void;
45
44
  onMarkdownImport?: () => void;
46
45
  onPdfExport?: () => void;
47
- ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
48
- url: string;
49
- file: File;
50
- }>;
51
46
  }) => {
52
47
  undoRedoTools: (IEditorToolElement | null)[];
53
48
  toolbar: (IEditorToolElement | null)[];
@@ -1,17 +1,12 @@
1
1
  import { Editor } from '@tiptap/react';
2
- import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
3
2
 
4
- declare const MobileToolbar: ({ editor, onError, isKeyboardVisible, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, isLoading, ipfsImageFetchFn, }: {
3
+ declare const MobileToolbar: ({ editor, onError, isKeyboardVisible, isNavbarVisible, setIsNavbarVisible, secureImageUploadUrl, isLoading, }: {
5
4
  editor: Editor | null;
6
5
  onError?: (errorString: string) => void;
7
6
  isKeyboardVisible: boolean;
8
7
  isNavbarVisible: boolean;
9
8
  setIsNavbarVisible: React.Dispatch<React.SetStateAction<boolean>>;
10
- ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
9
+ secureImageUploadUrl?: string;
11
10
  isLoading: boolean;
12
- ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
13
- url: string;
14
- file: File;
15
- }>;
16
11
  }) => import("react/jsx-runtime").JSX.Element;
17
12
  export default MobileToolbar;
@@ -1,5 +1,4 @@
1
1
  import { Editor } from '@tiptap/react';
2
- import { IpfsImageFetchPayload } from '../../types';
3
2
 
4
3
  interface PresentationModeProps {
5
4
  editor: Editor;
@@ -16,10 +15,6 @@ interface PresentationModeProps {
16
15
  setSlides: React.Dispatch<React.SetStateAction<string[]>>;
17
16
  renderThemeToggle?: () => JSX.Element;
18
17
  isContentLoading: boolean;
19
- ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
20
- url: string;
21
- file: File;
22
- }>;
23
18
  }
24
- export declare const PresentationMode: ({ editor, onClose, isFullscreen, setIsFullscreen, onError, setCommentDrawerOpen, sharedSlidesLink, isPreviewMode, documentName, onSlidesShare, slides, setSlides, renderThemeToggle, isContentLoading, ipfsImageFetchFn, }: PresentationModeProps) => import("react/jsx-runtime").JSX.Element | null;
19
+ export declare const PresentationMode: ({ editor, onClose, isFullscreen, setIsFullscreen, onError, setCommentDrawerOpen, sharedSlidesLink, isPreviewMode, documentName, onSlidesShare, slides, setSlides, renderThemeToggle, isContentLoading, }: PresentationModeProps) => import("react/jsx-runtime").JSX.Element | null;
25
20
  export {};
@@ -1,9 +1,8 @@
1
1
  import { Node } from '@tiptap/core';
2
- import { IpfsImageUploadResponse } from '../../types';
3
2
 
4
3
  export interface DBlockOptions {
5
4
  HTMLAttributes: Record<string, any>;
6
- ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
5
+ secureImageUploadUrl?: string;
7
6
  onCopyHeadingLink?: (link: string) => void;
8
7
  hasAvailableModels: boolean;
9
8
  }
@@ -1,15 +1,5 @@
1
1
  import { NodeType } from '@tiptap/pm/model';
2
2
  import { InputRule } from '@tiptap/core';
3
- import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
4
3
 
5
- export declare const defaultExtensions: ({ ipfsImageFetchFn, onError, metadataProxyUrl, onCopyHeadingLink, ipfsImageUploadFn, }: {
6
- ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
7
- url: string;
8
- file: File;
9
- }>;
10
- onError: (error: string) => void;
11
- ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
12
- metadataProxyUrl?: string;
13
- onCopyHeadingLink?: (link: string) => void;
14
- }) => (import('@tiptap/core').Extension<any, any> | import('@tiptap/core').Node<any, any> | import('@tiptap/core').Mark<any, any>)[];
4
+ export declare const defaultExtensions: (onError: (error: string) => void, secureImageUploadUrl?: string, metadataProxyUrl?: string, onCopyHeadingLink?: (link: string) => void) => (import('@tiptap/core').Extension<any, any> | import('@tiptap/core').Node<any, any> | import('@tiptap/core').Mark<any, any>)[];
15
5
  export declare const createInputRule: (pattern: RegExp, data: string, type: NodeType) => InputRule;
@@ -1,5 +1,4 @@
1
1
  import { Node } from '@tiptap/core';
2
- import { IpfsImageFetchPayload } from '../../types';
3
2
 
4
3
  export interface IframeOptions {
5
4
  allowFullscreen: boolean;
@@ -8,10 +7,6 @@ export interface IframeOptions {
8
7
  };
9
8
  width?: number;
10
9
  height?: number;
11
- ipfsImageFetchFn: (_data: IpfsImageFetchPayload) => Promise<{
12
- url: string;
13
- file: File;
14
- }>;
15
10
  }
16
11
  declare module '@tiptap/core' {
17
12
  interface Commands<ReturnType> {
@@ -1,25 +1,18 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
  import { Node as PMNode } from 'prosemirror-model';
3
3
  import { default as TurndownService } from 'turndown';
4
- import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../../types';
5
4
 
6
5
  export declare const turndownService: TurndownService;
7
6
  declare module '@tiptap/core' {
8
7
  interface Commands {
9
8
  uploadMarkdownFile: {
10
- uploadMarkdownFile: (ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>) => any;
9
+ uploadMarkdownFile: (secureImageUploadUrl?: string) => any;
11
10
  };
12
11
  exportMarkdownFile: {
13
12
  exportMarkdownFile: () => any;
14
13
  };
15
14
  }
16
15
  }
17
- declare const MarkdownPasteHandler: (ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>, ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
18
- url: string;
19
- file: File;
20
- }>) => Extension<any, any>;
16
+ declare const MarkdownPasteHandler: (secureImageUploadUrl?: string) => Extension<any, any>;
21
17
  export default MarkdownPasteHandler;
22
- export declare function searchForSecureImageNodeAndEmbedImageContent(originalDoc: PMNode, ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
23
- url: string;
24
- file: File;
25
- }>): Promise<PMNode>;
18
+ export declare function searchForSecureImageNodeAndEmbedImageContent(originalDoc: PMNode): Promise<PMNode>;
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
- import { IpfsImageUploadResponse } from '../../../types.ts';
3
2
 
4
3
  export type UploadFnType = (image: File) => Promise<string>;
5
4
  /**
@@ -10,4 +9,4 @@ export type UploadFnType = (image: File) => Promise<string>;
10
9
  * If no upload function is provided, it reads the media file as DataURL and uses this in the new node.
11
10
  * The function returns a new instance of the Plugin.
12
11
  */
13
- export declare const getMediaPasteDropPlugin: (onError: (error: string) => void, ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>) => Plugin<any>;
12
+ export declare const getMediaPasteDropPlugin: (upload: UploadFnType, onError: (error: string) => void, secureImageUploadUrl?: string) => Plugin<any>;
@@ -1,7 +1,3 @@
1
1
  import { NodeViewProps } from '@tiptap/react';
2
- import { IpfsImageFetchPayload } from '../../types.ts';
3
2
 
4
- export declare const getResizableMediaNodeView: (ipfsImageFetchFn: (_data: IpfsImageFetchPayload) => Promise<{
5
- url: string;
6
- file: File;
7
- }>) => ({ node, updateAttributes, deleteNode }: NodeViewProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const ResizableMediaNodeView: ({ node, updateAttributes, deleteNode, }: NodeViewProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { Node } from '@tiptap/core';
2
- import { IpfsImageFetchPayload, IpfsImageUploadResponse } from '../../types';
2
+ import { UploadFnType } from './media-paste-drop-plugin';
3
3
 
4
4
  declare module '@tiptap/core' {
5
5
  interface Commands<ReturnType> {
@@ -20,12 +20,9 @@ declare module '@tiptap/core' {
20
20
  }
21
21
  export interface MediaOptions {
22
22
  HTMLAttributes: Record<string, any>;
23
+ uploadFn: UploadFnType;
23
24
  onError: (error: string) => void;
24
- ipfsImageUploadFn: (file: File) => Promise<IpfsImageUploadResponse>;
25
- ipfsImageFetchFn: (_data: IpfsImageFetchPayload) => Promise<{
26
- url: string;
27
- file: File;
28
- }>;
25
+ secureImageUploadUrl?: string;
29
26
  }
30
27
  export declare const IMAGE_INPUT_REGEX: RegExp;
31
28
  export declare const VIDEO_INPUT_REGEX: RegExp;
@@ -1,6 +1,5 @@
1
1
  import { Extension } from '@tiptap/core';
2
- import { IpfsImageUploadResponse } from '../../types';
3
2
 
4
3
  export declare const Command: Extension<any, any>;
5
- declare const SlashCommand: (onError?: (errorString: string) => void, ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>, isConnected?: boolean, hasAvailableModels?: boolean) => Extension<any, any>;
4
+ declare const SlashCommand: (onError?: (errorString: string) => void, secureImageUploadUrl?: string, isConnected?: boolean, hasAvailableModels?: boolean) => Extension<any, any>;
6
5
  export default SlashCommand;
@@ -1,10 +1,9 @@
1
1
  import { CommandProps } from './types';
2
- import { IpfsImageUploadResponse } from '../../types';
3
2
 
4
- export declare const getSuggestionItems: ({ query, onError, ipfsImageUploadFn, hasAvailableModels, editor, }: {
3
+ export declare const getSuggestionItems: ({ query, onError, secureImageUploadUrl, hasAvailableModels, editor, }: {
5
4
  query: string;
6
5
  onError?: (errorString: string) => void;
7
- ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
6
+ secureImageUploadUrl?: string;
8
7
  isConnected?: boolean;
9
8
  hasAvailableModels?: boolean;
10
9
  editor?: any;
@@ -34,10 +34,6 @@ export interface CustomModel {
34
34
  }
35
35
  export interface DdocProps extends CommentAccountProps {
36
36
  isCollabDocumentPublished?: boolean;
37
- ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
38
- url: string;
39
- file: File;
40
- }>;
41
37
  disableInlineComment?: boolean;
42
38
  commentDrawerOpen?: boolean;
43
39
  setCommentDrawerOpen?: React.Dispatch<SetStateAction<boolean>>;
@@ -67,7 +63,7 @@ export interface DdocProps extends CommentAccountProps {
67
63
  collaborationId?: string;
68
64
  isPreviewMode: boolean;
69
65
  ensResolutionUrl?: string;
70
- ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
66
+ secureImageUploadUrl?: string;
71
67
  enableIndexeddbSync?: boolean;
72
68
  ddocId?: string;
73
69
  initialContent?: JSONContent | string | string[] | null;
@@ -100,6 +96,7 @@ export interface DdocProps extends CommentAccountProps {
100
96
  onMarkdownExport?: () => void;
101
97
  onMarkdownImport?: () => void;
102
98
  onPdfExport?: () => void;
99
+ onPromptUsage?: () => void;
103
100
  sharedSlidesLink?: string;
104
101
  documentName?: string;
105
102
  onInvalidContentError?: (e: unknown) => void;
@@ -128,16 +125,3 @@ export interface IUser {
128
125
  isEns: boolean;
129
126
  }
130
127
  export { type IComment };
131
- export interface IpfsImageUploadResponse {
132
- encryptionKey: string;
133
- nonce: string;
134
- ipfsUrl: string;
135
- ipfsHash: string;
136
- }
137
- export interface IpfsImageFetchPayload {
138
- encryptionKey: string;
139
- nonce: string;
140
- ipfsUrl: string;
141
- ipfsHash: string;
142
- mimeType: string;
143
- }
@@ -1,7 +1,7 @@
1
1
  import { DdocProps } from './types';
2
2
 
3
3
  import * as Y from 'yjs';
4
- export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, ensResolutionUrl, onError, setCharacterCount, setWordCount, ipfsImageUploadFn, ddocId, enableIndexeddbSync, unFocused, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, proExtensions, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, ipfsImageFetchFn, isConnected, activeModel, maxTokens, isAIAgentEnabled, }: Partial<DdocProps>) => {
4
+ export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, ensResolutionUrl, onError, setCharacterCount, setWordCount, secureImageUploadUrl, ddocId, enableIndexeddbSync, unFocused, zoomLevel, onInvalidContentError, ignoreCorruptedData, isPresentationMode, proExtensions, metadataProxyUrl, extensions: externalExtensions, onCopyHeadingLink, isConnected, activeModel, maxTokens, isAIAgentEnabled, }: Partial<DdocProps>) => {
5
5
  editor: import('@tiptap/core').Editor | null;
6
6
  isContentLoading: boolean;
7
7
  ref: import('react').RefObject<HTMLDivElement>;
@@ -1,6 +1,5 @@
1
1
  import { default as MarkdownIt } from 'markdown-it';
2
2
  import { Editor } from '@tiptap/react';
3
- import { IpfsImageFetchPayload } from '../types';
4
3
 
5
4
  interface SlideContent {
6
5
  type: 'h1' | 'h2' | 'content' | 'image' | 'table';
@@ -10,9 +9,6 @@ export interface Slides {
10
9
  [key: number]: SlideContent[];
11
10
  }
12
11
  export declare const md: MarkdownIt;
13
- export declare const convertToMarkdown: (editor: Editor, ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
14
- url: string;
15
- file: File;
16
- }>) => Promise<string>;
12
+ export declare const convertToMarkdown: (editor: Editor) => Promise<string>;
17
13
  export declare const processMarkdownContent: (markdown: string) => Slides;
18
14
  export {};
@@ -1,10 +1,9 @@
1
1
  import { Plugin } from '@tiptap/pm/state';
2
2
  import { DecorationSet, EditorView } from '@tiptap/pm/view';
3
- import { IpfsImageUploadResponse } from '../types';
4
3
 
5
4
  declare const UploadImagesPlugin: () => Plugin<DecorationSet>;
6
5
  export default UploadImagesPlugin;
7
- export declare function startImageUpload(file: File, view: EditorView, pos: number, ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>): Promise<void>;
6
+ export declare function startImageUpload(file: File, view: EditorView, pos: number, secureImageUploadUrl?: string): Promise<void>;
8
7
  export declare const uploadFn: (image: File) => Promise<string>;
9
8
  export declare const uploadSecureImage: (url: string, image: File, publicKey: ArrayBuffer) => Promise<any>;
10
9
  export declare const handleDecryptImage: (url: string, encryptedKey: string, privateKey: string, iv: string) => Promise<string | undefined>;