@fileverse-dev/ddoc 2.0.3-sync-patch-3 → 2.0.3-sync-patch-5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.es.js +140989 -0
  3. package/dist/package/common/carousel.d.ts +22 -0
  4. package/dist/package/common/cutsom-tooltip.d.ts +8 -0
  5. package/dist/package/common/dropdown.d.ts +12 -0
  6. package/dist/package/common/spinner.d.ts +1 -0
  7. package/dist/package/common/surface.d.ts +7 -0
  8. package/dist/package/common/toolbar-button.d.ts +9 -0
  9. package/dist/package/common/toolbar.d.ts +13 -0
  10. package/dist/package/common/types.d.ts +19 -0
  11. package/dist/package/components/color-selector.d.ts +14 -0
  12. package/dist/package/components/editor-bubble-menu.d.ts +11 -0
  13. package/dist/package/components/editor-toolbar.d.ts +10 -0
  14. package/dist/package/components/editor-utils.d.ts +84 -0
  15. package/dist/package/components/mobile-toolbar.d.ts +10 -0
  16. package/dist/package/components/node-selector.d.ts +9 -0
  17. package/dist/package/components/slash-comand.d.ts +5 -0
  18. package/dist/package/components/utils-modal.d.ts +9 -0
  19. package/dist/package/ddoc-editor.d.ts +4 -0
  20. package/dist/package/extensions/action-button/action-button-node-view.d.ts +3 -0
  21. package/dist/package/extensions/action-button/action-button.d.ts +16 -0
  22. package/dist/package/extensions/action-button/index.d.ts +1 -0
  23. package/dist/package/extensions/action-button/modal.d.ts +8 -0
  24. package/dist/package/extensions/custom-keymap.d.ts +14 -0
  25. package/dist/package/extensions/d-block/dblock-node-view.d.ts +4 -0
  26. package/dist/package/extensions/d-block/dblock.d.ts +13 -0
  27. package/dist/package/extensions/d-block/index.d.ts +1 -0
  28. package/dist/package/extensions/default-extension.d.ts +5 -0
  29. package/dist/package/extensions/doc.d.ts +3 -0
  30. package/dist/package/extensions/document/document.d.ts +2 -0
  31. package/dist/package/extensions/document/index.d.ts +1 -0
  32. package/dist/package/extensions/footnote/footnote.d.ts +4 -0
  33. package/dist/package/extensions/horizontal-rule.d.ts +2 -0
  34. package/dist/package/extensions/iframe/iframe.d.ts +27 -0
  35. package/dist/package/extensions/iframe/index.d.ts +1 -0
  36. package/dist/package/extensions/mardown-paste-handler/index.d.ts +14 -0
  37. package/dist/package/extensions/multi-column/column-selection.d.ts +17 -0
  38. package/dist/package/extensions/multi-column/column.d.ts +4 -0
  39. package/dist/package/extensions/multi-column/columns.d.ts +18 -0
  40. package/dist/package/extensions/multi-column/index.d.ts +11 -0
  41. package/dist/package/extensions/multi-column/menus/columns-menu.d.ts +4 -0
  42. package/dist/package/extensions/multi-column/menus/index.d.ts +1 -0
  43. package/dist/package/extensions/multi-column/utils.d.ts +22 -0
  44. package/dist/package/extensions/resizable-media/index.d.ts +1 -0
  45. package/dist/package/extensions/resizable-media/media-paste-drop-plugin/index.d.ts +1 -0
  46. package/dist/package/extensions/resizable-media/media-paste-drop-plugin/media-paste-drop-plugin.d.ts +12 -0
  47. package/dist/package/extensions/resizable-media/resizable-media-menu-util.d.ts +16 -0
  48. package/dist/package/extensions/resizable-media/resizable-media-node-view.d.ts +3 -0
  49. package/dist/package/extensions/resizable-media/resizable-media.d.ts +27 -0
  50. package/dist/package/extensions/supercharged-table/extension-table/index.d.ts +5 -0
  51. package/dist/package/extensions/supercharged-table/extension-table/table-view.d.ts +18 -0
  52. package/dist/package/extensions/supercharged-table/extension-table/table.d.ts +56 -0
  53. package/dist/package/extensions/supercharged-table/extension-table/utilities/create-cell.d.ts +3 -0
  54. package/dist/package/extensions/supercharged-table/extension-table/utilities/create-table.d.ts +3 -0
  55. package/dist/package/extensions/supercharged-table/extension-table/utilities/delete-table-when-all-cells-selected.d.ts +3 -0
  56. package/dist/package/extensions/supercharged-table/extension-table/utilities/get-table-node-types.d.ts +5 -0
  57. package/dist/package/extensions/supercharged-table/extension-table/utilities/is-cell-selection.d.ts +3 -0
  58. package/dist/package/extensions/supercharged-table/extension-table-cell/index.d.ts +4 -0
  59. package/dist/package/extensions/supercharged-table/extension-table-cell/table-cell-node-view.d.ts +4 -0
  60. package/dist/package/extensions/supercharged-table/extension-table-cell/table-cell.d.ts +6 -0
  61. package/dist/package/extensions/supercharged-table/extension-table-header/index.d.ts +4 -0
  62. package/dist/package/extensions/supercharged-table/extension-table-header/table-header.d.ts +6 -0
  63. package/dist/package/extensions/supercharged-table/extension-table-row/index.d.ts +4 -0
  64. package/dist/package/extensions/supercharged-table/extension-table-row/table-row-node-view.d.ts +17 -0
  65. package/dist/package/extensions/supercharged-table/extension-table-row/table-row.d.ts +7 -0
  66. package/dist/package/extensions/supercharged-table/index.d.ts +5 -0
  67. package/dist/package/extensions/supercharged-table/supercharged-table-kit.d.ts +3 -0
  68. package/dist/package/extensions/sync-cursor.d.ts +12 -0
  69. package/dist/package/extensions/trailing-node/index.d.ts +1 -0
  70. package/dist/package/extensions/trailing-node/trailing-node.d.ts +12 -0
  71. package/dist/package/extensions/twitter-embed/embedded-tweet.d.ts +18 -0
  72. package/dist/package/extensions/twitter-embed/index.d.ts +1 -0
  73. package/dist/package/extensions/twitter-embed/tweet-component-node-view.d.ts +3 -0
  74. package/dist/package/hooks/use-content-item-actions.d.ts +10 -0
  75. package/dist/package/hooks/use-editing-context.d.ts +10 -0
  76. package/dist/package/hooks/use-visibility.d.ts +24 -0
  77. package/dist/package/types.d.ts +64 -0
  78. package/dist/package/use-ddoc-editor.d.ts +10 -0
  79. package/dist/package/utils/colors.d.ts +4 -0
  80. package/dist/package/utils/cursor.d.ts +5 -0
  81. package/dist/package/utils/debounce.d.ts +1 -0
  82. package/dist/package/utils/get-render-container.d.ts +4 -0
  83. package/dist/package/utils/getAddressName.d.ts +7 -0
  84. package/dist/package/utils/getTemplateContent.d.ts +3 -0
  85. package/dist/package/utils/template-utils.d.ts +15 -0
  86. package/dist/package/utils/upload-images.d.ts +7 -0
  87. package/dist/style.css +1 -0
  88. package/dist/vite.svg +1 -0
  89. package/package.json +2 -2
@@ -0,0 +1,56 @@
1
+ import { Node, ParentConfig } from '@tiptap/core';
2
+ import { NodeView } from 'prosemirror-view';
3
+
4
+ export interface TableOptions {
5
+ HTMLAttributes: Record<string, never>;
6
+ resizable: boolean;
7
+ handleWidth: number;
8
+ cellMinWidth: number;
9
+ View: NodeView;
10
+ lastColumnResizable: boolean;
11
+ allowTableNodeSelection: boolean;
12
+ }
13
+ declare module '@tiptap/core' {
14
+ interface Commands<ReturnType> {
15
+ table: {
16
+ insertTable: (options?: {
17
+ rows?: number;
18
+ cols?: number;
19
+ withHeaderRow?: boolean;
20
+ }) => ReturnType;
21
+ addColumnBefore: () => ReturnType;
22
+ addColumnAfter: () => ReturnType;
23
+ deleteColumn: () => ReturnType;
24
+ addRowBefore: () => ReturnType;
25
+ addRowAfter: () => ReturnType;
26
+ deleteRow: () => ReturnType;
27
+ deleteTable: () => ReturnType;
28
+ mergeCells: () => ReturnType;
29
+ splitCell: () => ReturnType;
30
+ toggleHeaderColumn: () => ReturnType;
31
+ toggleHeaderRow: () => ReturnType;
32
+ toggleHeaderCell: () => ReturnType;
33
+ mergeOrSplit: () => ReturnType;
34
+ setCellAttribute: (name: string, value: never) => ReturnType;
35
+ goToNextCell: () => ReturnType;
36
+ goToPreviousCell: () => ReturnType;
37
+ fixTables: () => ReturnType;
38
+ setCellSelection: (position: {
39
+ anchorCell: number;
40
+ headCell?: number;
41
+ }) => ReturnType;
42
+ };
43
+ }
44
+ interface NodeConfig<Options, Storage> {
45
+ /**
46
+ * Table Role
47
+ */
48
+ tableRole?: string | ((this: {
49
+ name: string;
50
+ options: Options;
51
+ storage: Storage;
52
+ parent: ParentConfig<NodeConfig<Options>>['tableRole'];
53
+ }) => string);
54
+ }
55
+ }
56
+ export declare const Table: Node<TableOptions, any>;
@@ -0,0 +1,3 @@
1
+ import { Fragment, Node as ProsemirrorNode, NodeType } from 'prosemirror-model';
2
+
3
+ export declare function createCell(cellType: NodeType, cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>): ProsemirrorNode | null | undefined;
@@ -0,0 +1,3 @@
1
+ import { Fragment, Node as ProsemirrorNode, Schema } from 'prosemirror-model';
2
+
3
+ export declare function createTable(schema: Schema, rowsCount: number, colsCount: number, withHeaderRow: boolean, cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>): ProsemirrorNode;
@@ -0,0 +1,3 @@
1
+ import { KeyboardShortcutCommand } from '@tiptap/core';
2
+
3
+ export declare const deleteTableWhenAllCellsSelected: KeyboardShortcutCommand;
@@ -0,0 +1,5 @@
1
+ import { NodeType, Schema } from 'prosemirror-model';
2
+
3
+ export declare function getTableNodeTypes(schema: Schema): {
4
+ [key: string]: NodeType;
5
+ };
@@ -0,0 +1,3 @@
1
+ import { CellSelection } from '@_ueberdosis/prosemirror-tables';
2
+
3
+ export declare function isCellSelection(value: unknown): value is CellSelection;
@@ -0,0 +1,4 @@
1
+ import { TableCell } from './table-cell';
2
+
3
+ export * from './table-cell';
4
+ export default TableCell;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { NodeViewProps } from '@tiptap/react';
3
+
4
+ export declare const TableCellNodeView: FC<NodeViewProps>;
@@ -0,0 +1,6 @@
1
+ import { Node } from '@tiptap/core';
2
+
3
+ export interface TableCellOptions {
4
+ HTMLAttributes: Record<string, any>;
5
+ }
6
+ export declare const TableCell: Node<TableCellOptions, any>;
@@ -0,0 +1,4 @@
1
+ import { TableHeader } from './table-header';
2
+
3
+ export * from './table-header';
4
+ export default TableHeader;
@@ -0,0 +1,6 @@
1
+ import { Node } from '@tiptap/core';
2
+
3
+ export interface TableHeaderOptions {
4
+ HTMLAttributes: Record<string, any>;
5
+ }
6
+ export declare const TableHeader: Node<TableHeaderOptions, any>;
@@ -0,0 +1,4 @@
1
+ import { TableRow } from './table-row';
2
+
3
+ export * from './table-row';
4
+ export default TableRow;
@@ -0,0 +1,17 @@
1
+ import { Node as ProseMirrorNode } from 'prosemirror-model';
2
+ import { NodeView } from 'prosemirror-view';
3
+
4
+ export declare class TableRowNodeView implements NodeView {
5
+ node: ProseMirrorNode;
6
+ cellMinWidth: number;
7
+ dom: Element;
8
+ table: HTMLTableElement;
9
+ colgroup: Element;
10
+ contentDOM: HTMLElement;
11
+ constructor(node: ProseMirrorNode, cellMinWidth: number);
12
+ update(node: ProseMirrorNode): boolean;
13
+ ignoreMutation(mutation: MutationRecord | {
14
+ type: 'selection';
15
+ target: Element;
16
+ }): boolean;
17
+ }
@@ -0,0 +1,7 @@
1
+ import { Node } from '@tiptap/core';
2
+
3
+ export interface TableRowOptions {
4
+ HTMLAttributes: Record<string, any>;
5
+ }
6
+ export declare const stopPrevent: <T extends Event>(e: T) => T;
7
+ export declare const TableRow: Node<TableRowOptions, any>;
@@ -0,0 +1,5 @@
1
+ export * from './extension-table';
2
+ export * from './extension-table-cell';
3
+ export * from './extension-table-header';
4
+ export * from './extension-table-row';
5
+ export * from './supercharged-table-kit';
@@ -0,0 +1,3 @@
1
+ import { AnyExtension } from '@tiptap/core';
2
+
3
+ export declare const SuperchargedTableExtensions: AnyExtension[];
@@ -0,0 +1,12 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { CollaborationCursorOptions, CollaborationCursorStorage } from '../types';
3
+
4
+ declare module '@tiptap/core' {
5
+ interface Commands<ReturnType> {
6
+ collaborationCursor: {
7
+ updateUser: (attributes: Record<string, any>) => ReturnType;
8
+ user: (attributes: Record<string, any>) => ReturnType;
9
+ };
10
+ }
11
+ }
12
+ export declare const SyncCursor: Extension<CollaborationCursorOptions, CollaborationCursorStorage>;
@@ -0,0 +1 @@
1
+ export * from './trailing-node';
@@ -0,0 +1,12 @@
1
+ import { Extension } from '@tiptap/core';
2
+
3
+ /**
4
+ * Extension based on:
5
+ * - https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/extensions/TrailingNode.js
6
+ * - https://github.com/remirror/remirror/blob/e0f1bec4a1e8073ce8f5500d62193e52321155b9/packages/prosemirror-trailing-node/src/trailing-node-plugin.ts
7
+ */
8
+ export interface TrailingNodeOptions {
9
+ node: string;
10
+ notAfter: string[];
11
+ }
12
+ export declare const TrailingNode: Extension<TrailingNodeOptions, any>;
@@ -0,0 +1,18 @@
1
+ import { Node } from '@tiptap/react';
2
+
3
+ export interface EmbeddedTweetOptions {
4
+ HTMLAttributes: Record<string, any>;
5
+ }
6
+ declare module '@tiptap/core' {
7
+ interface Commands<ReturnType> {
8
+ embeddedTweet: {
9
+ /**
10
+ * Add an tweet embed
11
+ */
12
+ setTweetEmbed: (options: {
13
+ tweetId: string;
14
+ }) => ReturnType;
15
+ };
16
+ }
17
+ }
18
+ export declare const EmbeddedTweet: Node<EmbeddedTweetOptions, any>;
@@ -0,0 +1 @@
1
+ export * from './embedded-tweet';
@@ -0,0 +1,3 @@
1
+ import { NodeViewProps } from '@tiptap/core';
2
+
3
+ export declare const TweetComponentNodeView: ({ node, editor }: NodeViewProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { Node } from '@tiptap/pm/model';
2
+ import { Editor } from '@tiptap/react';
3
+
4
+ declare const useContentItemActions: (editor: Editor, currentNode: Node | null, currentNodePos: number) => {
5
+ resetTextFormatting: () => void;
6
+ duplicateNode: () => void;
7
+ copyNodeToClipboard: () => void;
8
+ deleteNode: () => void;
9
+ };
10
+ export default useContentItemActions;
@@ -0,0 +1,10 @@
1
+ import { default as React, ReactNode } from 'react';
2
+
3
+ type EditingContextType = boolean | null;
4
+ export declare const useEditingContext: () => EditingContextType;
5
+ type EditingProviderProps = {
6
+ children: ReactNode;
7
+ isPreviewMode: boolean;
8
+ };
9
+ export declare const EditingProvider: React.FC<EditingProviderProps>;
10
+ export {};
@@ -0,0 +1,24 @@
1
+ export declare enum IEditorTool {
2
+ NONE = 0,
3
+ HEADING = 1,
4
+ TEXT_COLOR = 2,
5
+ HIGHLIGHT = 3,
6
+ LINK = 4,
7
+ FONT_FAMILY = 5,
8
+ ALIGNMENT = 6,
9
+ LIST = 7,
10
+ TEXT_FORMATING = 8,
11
+ TEXT_COLOR_PICKER = 9,
12
+ LINK_POPUP = 10,
13
+ SCRIPTS = 11
14
+ }
15
+ export default function useComponentVisibility(initialIsVisible: boolean): {
16
+ ref: import('react').RefObject<HTMLDivElement>;
17
+ isComponentVisible: boolean;
18
+ setIsComponentVisible: import('react').Dispatch<import('react').SetStateAction<boolean>>;
19
+ };
20
+ export declare function useEditorToolVisiibility(initialIsVisible: IEditorTool): {
21
+ ref: import('react').RefObject<HTMLDivElement>;
22
+ toolVisibility: IEditorTool;
23
+ setToolVisibility: import('react').Dispatch<import('react').SetStateAction<IEditorTool>>;
24
+ };
@@ -0,0 +1,64 @@
1
+ import { JSONContent } from '@tiptap/core';
2
+ import { EditorProps } from '@tiptap/pm/view';
3
+ import { Editor } from '@tiptap/react';
4
+ import { default as React, SetStateAction } from 'react';
5
+
6
+ export declare const DdocEditorProps: EditorProps;
7
+ export interface IDocCollabUsers {
8
+ name: string;
9
+ isEns: string;
10
+ color: string;
11
+ }
12
+ export interface DdocProps {
13
+ enableCollaboration?: boolean;
14
+ collaborationId?: string;
15
+ isPreviewMode: boolean;
16
+ ensResolutionUrl?: string;
17
+ initialContent?: JSONContent | null;
18
+ walletAddress?: string | null;
19
+ username?: string | null;
20
+ renderNavbar?: ({ editor }: {
21
+ editor: JSONContent;
22
+ }) => JSX.Element;
23
+ onChange?: (changes: Data['editorJSONData']) => void;
24
+ onCollaboratorChange?: (collaborators: undefined | IDocCollabUsers[]) => void;
25
+ onTextSelection?: (data: IEditorSelectionData) => void;
26
+ onCommentInteraction?: (data: IEditorSelectionData) => void;
27
+ handleCommentButtonClick?: (e: Editor) => void;
28
+ showCommentButton?: boolean;
29
+ disableBottomToolbar?: boolean;
30
+ onError?: (error: string) => void;
31
+ setCharacterCount?: React.Dispatch<SetStateAction<number>>;
32
+ setWordCount?: React.Dispatch<SetStateAction<number>>;
33
+ collaborationKey?: string;
34
+ }
35
+ export interface IEditorSelectionData {
36
+ from: number;
37
+ to: number;
38
+ text: string;
39
+ isHighlightedYellow: boolean;
40
+ }
41
+ export interface Data {
42
+ editorJSONData: JSONContent;
43
+ }
44
+ export interface IUser {
45
+ name: string;
46
+ color: string;
47
+ isEns: boolean;
48
+ }
49
+ export type CollaborationCursorStorage = {
50
+ users: {
51
+ clientId: number;
52
+ [key: string]: any;
53
+ }[];
54
+ };
55
+ export interface CollaborationCursorOptions {
56
+ provider: any;
57
+ user: Record<string, any>;
58
+ render(user: Record<string, any>): HTMLElement;
59
+ selectionRender(user: Record<string, any>): any;
60
+ onUpdate: (users: {
61
+ clientId: number;
62
+ [key: string]: any;
63
+ }[]) => null;
64
+ }
@@ -0,0 +1,10 @@
1
+ import { DdocProps } from './types';
2
+
3
+ export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, onTextSelection, ensResolutionUrl, onError, setCharacterCount, setWordCount, collaborationKey, }: Partial<DdocProps>) => {
4
+ editor: import('@tiptap/core').Editor | null;
5
+ isContentLoading: boolean;
6
+ ref: import('react').RefObject<HTMLDivElement>;
7
+ connect: (username: string | null | undefined, isEns?: boolean) => void;
8
+ ydoc: import('yjs').Doc;
9
+ isCollaborationReady: boolean;
10
+ };
@@ -0,0 +1,4 @@
1
+ export declare const colors: {
2
+ color: string;
3
+ code: string;
4
+ }[];
@@ -0,0 +1,5 @@
1
+ import { IUser } from '../types';
2
+
3
+ export declare const getRegularUserCursor: (user: IUser) => HTMLSpanElement;
4
+ export declare const getEnsUserCursor: (user: IUser) => HTMLSpanElement;
5
+ export declare const getCursor: (user: IUser) => HTMLSpanElement;
@@ -0,0 +1 @@
1
+ export declare function debounce<T extends (...args: any) => any>(func: T, wait: number): T;
@@ -0,0 +1,4 @@
1
+ import { Editor } from '@tiptap/react';
2
+
3
+ export declare const getRenderContainer: (editor: Editor, nodeType: string) => Element | null;
4
+ export default getRenderContainer;
@@ -0,0 +1,7 @@
1
+ export declare const getAddressName: (address: string, ensProviderUrl: string) => Promise<{
2
+ name: string;
3
+ isEns: boolean;
4
+ }>;
5
+ export declare const resolveEnsAddress: (address: string, ensProviderUrl: string) => Promise<string | null>;
6
+ export declare const getEnsProvider: (network: string) => import('ethers').AbstractProvider;
7
+ export declare const getTrimmedName: (name: string, length: number, limit: number) => string;
@@ -0,0 +1,3 @@
1
+ import { JSONContent } from '@tiptap/react';
2
+
3
+ export declare const getTemplateContent: (templateQuery: string) => JSONContent | null;
@@ -0,0 +1,15 @@
1
+ import { JSONContent } from '@tiptap/react';
2
+ import { LucideIconProps } from '@fileverse/ui';
3
+
4
+ type IconType = LucideIconProps['name'] | string;
5
+ type TemplateButtonProps = {
6
+ label: string;
7
+ icon: IconType;
8
+ onClick: () => void;
9
+ content: JSONContent | null;
10
+ }[];
11
+ declare const renderIcon: (icon: IconType, className?: string) => import("react/jsx-runtime").JSX.Element | null;
12
+ declare const createTemplateButtons: (addTemplate: (template: JSONContent) => void) => TemplateButtonProps;
13
+ declare const createMoreTemplates: (addTemplate: (template: JSONContent) => void) => TemplateButtonProps;
14
+ declare const renderTemplateButtons: (templateButtons: TemplateButtonProps, moreTemplates: TemplateButtonProps, visibleTemplateCount: number, toggleAllTemplates: () => void, isExpanded: boolean) => import("react/jsx-runtime").JSX.Element;
15
+ export { renderIcon, createTemplateButtons, createMoreTemplates, renderTemplateButtons };
@@ -0,0 +1,7 @@
1
+ import { Plugin } from '@tiptap/pm/state';
2
+ import { DecorationSet, EditorView } from '@tiptap/pm/view';
3
+
4
+ declare const UploadImagesPlugin: () => Plugin<DecorationSet>;
5
+ export default UploadImagesPlugin;
6
+ export declare function startImageUpload(file: File, view: EditorView, pos: number): void;
7
+ export declare const uploadFn: (image: File) => Promise<string>;