@elia-ori/editor 0.1.0
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.cjs +4928 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +128 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.js +4893 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/editor.css +277 -0
- package/dist/styles/editor.css.map +1 -0
- package/dist/styles/editor.d.cts +2 -0
- package/dist/styles/editor.d.ts +2 -0
- package/package.json +92 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { LucideProps } from 'lucide-react';
|
|
4
|
+
import * as React$1 from 'react';
|
|
5
|
+
import { ComponentType } from 'react';
|
|
6
|
+
import { ClassValue } from 'clsx';
|
|
7
|
+
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
8
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
9
|
+
import { Node } from '@tiptap/core';
|
|
10
|
+
|
|
11
|
+
type ToolbarButtonConfig = {
|
|
12
|
+
key: string;
|
|
13
|
+
icon: ComponentType<LucideProps>;
|
|
14
|
+
title: string;
|
|
15
|
+
isActive: (editor: Editor) => boolean;
|
|
16
|
+
action: (editor: Editor) => void;
|
|
17
|
+
};
|
|
18
|
+
type ToolbarItem = 'heading' | 'list' | 'format' | 'script' | 'align' | 'color' | 'link' | 'image' | 'table' | 'callout' | 'themeToggle';
|
|
19
|
+
interface ToolbarProps {
|
|
20
|
+
editor: Editor | null;
|
|
21
|
+
config?: ToolbarItem[] | ToolbarItem[][] | 'all' | 'none';
|
|
22
|
+
toolbarStart?: React.ReactNode;
|
|
23
|
+
toolbarEnd?: React.ReactNode;
|
|
24
|
+
theme?: string;
|
|
25
|
+
onThemeToggle?: () => void;
|
|
26
|
+
onImageUpload?: (file: File) => void;
|
|
27
|
+
}
|
|
28
|
+
declare function Toolbar({ editor, config, toolbarStart, toolbarEnd, theme, onThemeToggle, onImageUpload, }: ToolbarProps): react_jsx_runtime.JSX.Element | null;
|
|
29
|
+
|
|
30
|
+
interface EliaEditorProps {
|
|
31
|
+
content?: string;
|
|
32
|
+
onChange?: (html: string) => void;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
toolbar?: ToolbarItem[] | ToolbarItem[][] | 'all' | 'none';
|
|
35
|
+
header?: React.ReactNode;
|
|
36
|
+
toolbarStart?: React.ReactNode;
|
|
37
|
+
toolbarEnd?: React.ReactNode;
|
|
38
|
+
footer?: React.ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
editorClassName?: string;
|
|
41
|
+
autofocus?: boolean;
|
|
42
|
+
readOnly?: boolean;
|
|
43
|
+
theme?: string;
|
|
44
|
+
onThemeToggle?: () => void;
|
|
45
|
+
onImageUpload?: (file: File) => void;
|
|
46
|
+
}
|
|
47
|
+
declare function EliaEditor({ content, onChange, placeholder, toolbar, header, toolbarStart, toolbarEnd, footer, className, editorClassName, autofocus, readOnly, theme, onThemeToggle, onImageUpload, }: EliaEditorProps): react_jsx_runtime.JSX.Element;
|
|
48
|
+
|
|
49
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
50
|
+
|
|
51
|
+
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
52
|
+
variant?: 'default' | 'ghost' | 'outline';
|
|
53
|
+
size?: 'default' | 'sm' | 'lg';
|
|
54
|
+
}
|
|
55
|
+
declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
56
|
+
|
|
57
|
+
interface ToggleProps extends React$1.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> {
|
|
58
|
+
size?: 'default' | 'sm';
|
|
59
|
+
}
|
|
60
|
+
declare const Toggle: React$1.ForwardRefExoticComponent<ToggleProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
61
|
+
|
|
62
|
+
declare const DropdownMenu: React$1.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
63
|
+
declare const DropdownMenuTrigger: React$1.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
64
|
+
declare const DropdownMenuContent: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
65
|
+
declare const DropdownMenuItem: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
66
|
+
declare const DropdownMenuSeparator: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
|
|
68
|
+
interface ToolbarButtonProps {
|
|
69
|
+
pressed: boolean;
|
|
70
|
+
onPressedChange: () => void;
|
|
71
|
+
disabled?: boolean;
|
|
72
|
+
children: React.ReactNode;
|
|
73
|
+
title?: string;
|
|
74
|
+
}
|
|
75
|
+
declare function ToolbarButton({ pressed, onPressedChange, disabled, children, title, }: ToolbarButtonProps): react_jsx_runtime.JSX.Element;
|
|
76
|
+
|
|
77
|
+
declare function ToolbarDivider(): react_jsx_runtime.JSX.Element;
|
|
78
|
+
|
|
79
|
+
interface HeadingDropdownProps {
|
|
80
|
+
editor: Editor;
|
|
81
|
+
iconSize?: string;
|
|
82
|
+
}
|
|
83
|
+
declare function HeadingDropdown({ editor, iconSize }: HeadingDropdownProps): react_jsx_runtime.JSX.Element;
|
|
84
|
+
|
|
85
|
+
interface ListDropdownProps {
|
|
86
|
+
editor: Editor;
|
|
87
|
+
iconSize?: string;
|
|
88
|
+
}
|
|
89
|
+
declare function ListDropdown({ editor, iconSize }: ListDropdownProps): react_jsx_runtime.JSX.Element;
|
|
90
|
+
|
|
91
|
+
interface TableDropdownProps {
|
|
92
|
+
editor: Editor;
|
|
93
|
+
iconSize?: string;
|
|
94
|
+
}
|
|
95
|
+
declare function TableDropdown({ editor, iconSize }: TableDropdownProps): react_jsx_runtime.JSX.Element;
|
|
96
|
+
|
|
97
|
+
interface CalloutDropdownProps {
|
|
98
|
+
editor: Editor;
|
|
99
|
+
iconSize?: string;
|
|
100
|
+
}
|
|
101
|
+
declare function CalloutDropdown({ editor, iconSize }: CalloutDropdownProps): react_jsx_runtime.JSX.Element;
|
|
102
|
+
|
|
103
|
+
interface ColorPickerProps {
|
|
104
|
+
editor: Editor;
|
|
105
|
+
iconSize?: string;
|
|
106
|
+
}
|
|
107
|
+
declare function ColorPicker({ editor, iconSize }: ColorPickerProps): react_jsx_runtime.JSX.Element;
|
|
108
|
+
|
|
109
|
+
type CalloutType = 'success' | 'warning' | 'error' | 'info';
|
|
110
|
+
interface CalloutOptions {
|
|
111
|
+
HTMLAttributes: Record<string, unknown>;
|
|
112
|
+
}
|
|
113
|
+
declare module "@tiptap/core" {
|
|
114
|
+
interface Commands<ReturnType> {
|
|
115
|
+
callout: {
|
|
116
|
+
setCallout: (attributes?: {
|
|
117
|
+
type: CalloutType;
|
|
118
|
+
}) => ReturnType;
|
|
119
|
+
toggleCallout: (attributes?: {
|
|
120
|
+
type: CalloutType;
|
|
121
|
+
}) => ReturnType;
|
|
122
|
+
unsetCallout: () => ReturnType;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
declare const Callout: Node<CalloutOptions, any>;
|
|
127
|
+
|
|
128
|
+
export { Button, type ButtonProps, Callout, CalloutDropdown, type CalloutDropdownProps, type CalloutOptions, type CalloutType, ColorPicker, type ColorPickerProps, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EliaEditor, type EliaEditorProps, HeadingDropdown, type HeadingDropdownProps, ListDropdown, type ListDropdownProps, TableDropdown, type TableDropdownProps, Toggle, type ToggleProps, Toolbar, ToolbarButton, type ToolbarButtonConfig, type ToolbarButtonProps, ToolbarDivider, type ToolbarItem, type ToolbarProps, cn };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Editor } from '@tiptap/react';
|
|
3
|
+
import { LucideProps } from 'lucide-react';
|
|
4
|
+
import * as React$1 from 'react';
|
|
5
|
+
import { ComponentType } from 'react';
|
|
6
|
+
import { ClassValue } from 'clsx';
|
|
7
|
+
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
8
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
9
|
+
import { Node } from '@tiptap/core';
|
|
10
|
+
|
|
11
|
+
type ToolbarButtonConfig = {
|
|
12
|
+
key: string;
|
|
13
|
+
icon: ComponentType<LucideProps>;
|
|
14
|
+
title: string;
|
|
15
|
+
isActive: (editor: Editor) => boolean;
|
|
16
|
+
action: (editor: Editor) => void;
|
|
17
|
+
};
|
|
18
|
+
type ToolbarItem = 'heading' | 'list' | 'format' | 'script' | 'align' | 'color' | 'link' | 'image' | 'table' | 'callout' | 'themeToggle';
|
|
19
|
+
interface ToolbarProps {
|
|
20
|
+
editor: Editor | null;
|
|
21
|
+
config?: ToolbarItem[] | ToolbarItem[][] | 'all' | 'none';
|
|
22
|
+
toolbarStart?: React.ReactNode;
|
|
23
|
+
toolbarEnd?: React.ReactNode;
|
|
24
|
+
theme?: string;
|
|
25
|
+
onThemeToggle?: () => void;
|
|
26
|
+
onImageUpload?: (file: File) => void;
|
|
27
|
+
}
|
|
28
|
+
declare function Toolbar({ editor, config, toolbarStart, toolbarEnd, theme, onThemeToggle, onImageUpload, }: ToolbarProps): react_jsx_runtime.JSX.Element | null;
|
|
29
|
+
|
|
30
|
+
interface EliaEditorProps {
|
|
31
|
+
content?: string;
|
|
32
|
+
onChange?: (html: string) => void;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
toolbar?: ToolbarItem[] | ToolbarItem[][] | 'all' | 'none';
|
|
35
|
+
header?: React.ReactNode;
|
|
36
|
+
toolbarStart?: React.ReactNode;
|
|
37
|
+
toolbarEnd?: React.ReactNode;
|
|
38
|
+
footer?: React.ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
editorClassName?: string;
|
|
41
|
+
autofocus?: boolean;
|
|
42
|
+
readOnly?: boolean;
|
|
43
|
+
theme?: string;
|
|
44
|
+
onThemeToggle?: () => void;
|
|
45
|
+
onImageUpload?: (file: File) => void;
|
|
46
|
+
}
|
|
47
|
+
declare function EliaEditor({ content, onChange, placeholder, toolbar, header, toolbarStart, toolbarEnd, footer, className, editorClassName, autofocus, readOnly, theme, onThemeToggle, onImageUpload, }: EliaEditorProps): react_jsx_runtime.JSX.Element;
|
|
48
|
+
|
|
49
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
50
|
+
|
|
51
|
+
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
52
|
+
variant?: 'default' | 'ghost' | 'outline';
|
|
53
|
+
size?: 'default' | 'sm' | 'lg';
|
|
54
|
+
}
|
|
55
|
+
declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
56
|
+
|
|
57
|
+
interface ToggleProps extends React$1.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> {
|
|
58
|
+
size?: 'default' | 'sm';
|
|
59
|
+
}
|
|
60
|
+
declare const Toggle: React$1.ForwardRefExoticComponent<ToggleProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
61
|
+
|
|
62
|
+
declare const DropdownMenu: React$1.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
63
|
+
declare const DropdownMenuTrigger: React$1.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
64
|
+
declare const DropdownMenuContent: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
65
|
+
declare const DropdownMenuItem: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
66
|
+
declare const DropdownMenuSeparator: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
|
|
68
|
+
interface ToolbarButtonProps {
|
|
69
|
+
pressed: boolean;
|
|
70
|
+
onPressedChange: () => void;
|
|
71
|
+
disabled?: boolean;
|
|
72
|
+
children: React.ReactNode;
|
|
73
|
+
title?: string;
|
|
74
|
+
}
|
|
75
|
+
declare function ToolbarButton({ pressed, onPressedChange, disabled, children, title, }: ToolbarButtonProps): react_jsx_runtime.JSX.Element;
|
|
76
|
+
|
|
77
|
+
declare function ToolbarDivider(): react_jsx_runtime.JSX.Element;
|
|
78
|
+
|
|
79
|
+
interface HeadingDropdownProps {
|
|
80
|
+
editor: Editor;
|
|
81
|
+
iconSize?: string;
|
|
82
|
+
}
|
|
83
|
+
declare function HeadingDropdown({ editor, iconSize }: HeadingDropdownProps): react_jsx_runtime.JSX.Element;
|
|
84
|
+
|
|
85
|
+
interface ListDropdownProps {
|
|
86
|
+
editor: Editor;
|
|
87
|
+
iconSize?: string;
|
|
88
|
+
}
|
|
89
|
+
declare function ListDropdown({ editor, iconSize }: ListDropdownProps): react_jsx_runtime.JSX.Element;
|
|
90
|
+
|
|
91
|
+
interface TableDropdownProps {
|
|
92
|
+
editor: Editor;
|
|
93
|
+
iconSize?: string;
|
|
94
|
+
}
|
|
95
|
+
declare function TableDropdown({ editor, iconSize }: TableDropdownProps): react_jsx_runtime.JSX.Element;
|
|
96
|
+
|
|
97
|
+
interface CalloutDropdownProps {
|
|
98
|
+
editor: Editor;
|
|
99
|
+
iconSize?: string;
|
|
100
|
+
}
|
|
101
|
+
declare function CalloutDropdown({ editor, iconSize }: CalloutDropdownProps): react_jsx_runtime.JSX.Element;
|
|
102
|
+
|
|
103
|
+
interface ColorPickerProps {
|
|
104
|
+
editor: Editor;
|
|
105
|
+
iconSize?: string;
|
|
106
|
+
}
|
|
107
|
+
declare function ColorPicker({ editor, iconSize }: ColorPickerProps): react_jsx_runtime.JSX.Element;
|
|
108
|
+
|
|
109
|
+
type CalloutType = 'success' | 'warning' | 'error' | 'info';
|
|
110
|
+
interface CalloutOptions {
|
|
111
|
+
HTMLAttributes: Record<string, unknown>;
|
|
112
|
+
}
|
|
113
|
+
declare module "@tiptap/core" {
|
|
114
|
+
interface Commands<ReturnType> {
|
|
115
|
+
callout: {
|
|
116
|
+
setCallout: (attributes?: {
|
|
117
|
+
type: CalloutType;
|
|
118
|
+
}) => ReturnType;
|
|
119
|
+
toggleCallout: (attributes?: {
|
|
120
|
+
type: CalloutType;
|
|
121
|
+
}) => ReturnType;
|
|
122
|
+
unsetCallout: () => ReturnType;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
declare const Callout: Node<CalloutOptions, any>;
|
|
127
|
+
|
|
128
|
+
export { Button, type ButtonProps, Callout, CalloutDropdown, type CalloutDropdownProps, type CalloutOptions, type CalloutType, ColorPicker, type ColorPickerProps, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EliaEditor, type EliaEditorProps, HeadingDropdown, type HeadingDropdownProps, ListDropdown, type ListDropdownProps, TableDropdown, type TableDropdownProps, Toggle, type ToggleProps, Toolbar, ToolbarButton, type ToolbarButtonConfig, type ToolbarButtonProps, ToolbarDivider, type ToolbarItem, type ToolbarProps, cn };
|