react-tailwind-email-editor 0.0.6 → 0.0.7
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/README.md +1 -1
- package/dist/index.d.cts +6 -57
- package/dist/index.d.ts +6 -57
- package/dist/index.js +435 -147
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +417 -132
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# React Email Editor
|
|
2
2
|
|
|
3
|
-
A professional, fully customizable drag-and-drop email template editor built with React, Craft.js, Tailwind CSS
|
|
3
|
+
A professional, fully customizable drag-and-drop email template editor built with React, Craft.js, Tailwind CSS.
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="https://github.com/hemanth-user13/Email-Editor-Npm/blob/master/src/assets/emailEditor1.png" width="900"/>
|
package/dist/index.d.cts
CHANGED
|
@@ -4,74 +4,45 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
4
4
|
import { SerializedNodes } from '@craftjs/core';
|
|
5
5
|
|
|
6
6
|
interface EditorComponentConfig {
|
|
7
|
-
/** The React component to render in the editor canvas */
|
|
8
7
|
component: React.ComponentType<any>;
|
|
9
|
-
/** Display name in the toolbox */
|
|
10
8
|
label: string;
|
|
11
|
-
/** Short description shown below the label */
|
|
12
9
|
description?: string;
|
|
13
|
-
/** Lucide icon or custom icon component */
|
|
14
10
|
icon?: LucideIcon | React.ComponentType<{
|
|
15
11
|
className?: string;
|
|
16
12
|
}>;
|
|
17
|
-
/** Category grouping in the toolbox */
|
|
18
13
|
category?: string;
|
|
19
|
-
/** Default element to create when dragged (JSX element). If not provided, creates <Component /> */
|
|
20
14
|
createElement?: () => React.ReactElement;
|
|
21
15
|
}
|
|
22
16
|
type ComponentRegistry = Record<string, EditorComponentConfig>;
|
|
23
17
|
interface EditorThemeColors {
|
|
24
|
-
/** Primary accent color */
|
|
25
18
|
primary?: string;
|
|
26
|
-
/** Primary foreground (text on primary) */
|
|
27
19
|
primaryForeground?: string;
|
|
28
|
-
/** Background color of sidebars and panels */
|
|
29
20
|
panelBackground?: string;
|
|
30
|
-
/** Canvas/workspace background */
|
|
31
21
|
canvasBackground?: string;
|
|
32
|
-
/** Border color for panels and components */
|
|
33
22
|
border?: string;
|
|
34
|
-
/** Muted background for inactive elements */
|
|
35
23
|
muted?: string;
|
|
36
|
-
/** Text color for muted/secondary text */
|
|
37
24
|
mutedForeground?: string;
|
|
38
|
-
/** Destructive/delete action color */
|
|
39
25
|
destructive?: string;
|
|
40
|
-
/** Foreground/text color */
|
|
41
26
|
foreground?: string;
|
|
42
|
-
/** Background color */
|
|
43
27
|
background?: string;
|
|
44
28
|
}
|
|
45
29
|
interface EditorTheme {
|
|
46
|
-
/** Custom color overrides */
|
|
47
30
|
colors?: EditorThemeColors;
|
|
48
|
-
/** Border radius for UI elements */
|
|
49
31
|
borderRadius?: number;
|
|
50
|
-
/** Font family for editor UI */
|
|
51
32
|
fontFamily?: string;
|
|
52
|
-
/** Paper/canvas width in pixels */
|
|
53
33
|
paperWidth?: number;
|
|
54
|
-
/** Paper minimum height in pixels */
|
|
55
34
|
paperMinHeight?: number;
|
|
56
|
-
/** Paper default background */
|
|
57
35
|
paperBackground?: string;
|
|
58
36
|
}
|
|
59
37
|
interface EditorSlots {
|
|
60
|
-
/** Custom toolbar component (replaces the entire top bar) */
|
|
61
38
|
toolbar?: React.ComponentType<ToolbarSlotProps>;
|
|
62
|
-
/** Custom toolbox/sidebar component */
|
|
63
39
|
toolbox?: React.ComponentType<ToolboxSlotProps>;
|
|
64
|
-
/** Custom settings panel component */
|
|
65
40
|
settingsPanel?: React.ComponentType<SettingsPanelSlotProps>;
|
|
66
|
-
/** Custom empty state for settings panel when nothing is selected */
|
|
67
41
|
settingsEmptyState?: React.ComponentType;
|
|
68
|
-
/** Custom render node wrapper */
|
|
69
42
|
renderNode?: React.ComponentType<{
|
|
70
43
|
render: React.ReactNode;
|
|
71
44
|
}>;
|
|
72
|
-
/** Custom export dialog content */
|
|
73
45
|
exportDialog?: React.ComponentType<ExportDialogSlotProps>;
|
|
74
|
-
/** Custom preview dialog content */
|
|
75
46
|
previewDialog?: React.ComponentType<PreviewDialogSlotProps>;
|
|
76
47
|
}
|
|
77
48
|
interface ToolbarSlotProps {
|
|
@@ -103,60 +74,38 @@ interface PreviewDialogSlotProps {
|
|
|
103
74
|
onClose: () => void;
|
|
104
75
|
}
|
|
105
76
|
interface EmailTemplate {
|
|
106
|
-
/** Unique template identifier */
|
|
107
77
|
id: string;
|
|
108
|
-
/** Display name */
|
|
109
78
|
name: string;
|
|
110
|
-
/** Template description */
|
|
111
79
|
description?: string;
|
|
112
|
-
/** Lucide icon */
|
|
113
80
|
icon?: LucideIcon;
|
|
114
|
-
/** Serialized Craft.js JSON state */
|
|
115
81
|
data: string;
|
|
116
82
|
}
|
|
117
83
|
interface EditorCallbacks {
|
|
118
|
-
/** Called when HTML is exported */
|
|
119
84
|
onExport?: (html: string) => void;
|
|
120
|
-
/** Called when the editor state changes */
|
|
121
85
|
onChange?: (serializedState: string) => void;
|
|
122
|
-
/** Called when a template is loaded */
|
|
123
86
|
onTemplateLoad?: (templateId: string) => void;
|
|
124
|
-
/** Called when canvas is cleared */
|
|
125
87
|
onClear?: () => void;
|
|
88
|
+
/** Called when theme color changes via the built-in color picker */
|
|
89
|
+
onColorChange?: (primaryHsl: string) => void;
|
|
126
90
|
}
|
|
127
91
|
type HtmlRenderer = (typeName: string, props: Record<string, unknown>, childrenHtml: string, linkedNodes?: Record<string, string>) => string | null;
|
|
128
92
|
interface EmailEditorProps {
|
|
129
|
-
/** Additional components to register (merged with built-ins) */
|
|
130
93
|
components?: ComponentRegistry;
|
|
131
|
-
/** Replace ALL built-in components (use only your own) */
|
|
132
94
|
replaceBuiltins?: boolean;
|
|
133
|
-
/** Theme customization */
|
|
134
95
|
theme?: EditorTheme;
|
|
135
|
-
/** Slot overrides for UI sections */
|
|
136
96
|
slots?: EditorSlots;
|
|
137
|
-
/** Pre-defined templates */
|
|
138
97
|
templates?: EmailTemplate[];
|
|
139
|
-
/** Event callbacks */
|
|
140
98
|
callbacks?: EditorCallbacks;
|
|
141
|
-
/** Initial serialized state to load */
|
|
142
99
|
initialState?: string;
|
|
143
|
-
/** Default content to show (JSX children for the Frame) */
|
|
144
100
|
defaultContent?: React.ReactNode;
|
|
145
|
-
/** Editor title displayed in the toolbar */
|
|
146
101
|
title?: string;
|
|
147
|
-
/** Logo element for the toolbar */
|
|
148
102
|
logo?: React.ReactNode;
|
|
149
|
-
/** Custom HTML renderers for export (keyed by component resolved name) */
|
|
150
103
|
htmlRenderers?: Record<string, HtmlRenderer>;
|
|
151
|
-
/** Whether to show the toolbar */
|
|
152
104
|
showToolbar?: boolean;
|
|
153
|
-
/** Whether to show the left toolbox sidebar */
|
|
154
105
|
showToolbox?: boolean;
|
|
155
|
-
/**
|
|
156
|
-
|
|
157
|
-
/** Custom class name for the editor root */
|
|
106
|
+
/** Enable dark mode (applies `dark` class to editor root). Default: true */
|
|
107
|
+
darkMode?: boolean;
|
|
158
108
|
className?: string;
|
|
159
|
-
/** Custom inline styles for the editor root */
|
|
160
109
|
style?: React.CSSProperties;
|
|
161
110
|
}
|
|
162
111
|
|
|
@@ -173,12 +122,12 @@ interface EditorContextValue {
|
|
|
173
122
|
logo?: React.ReactNode;
|
|
174
123
|
showToolbar: boolean;
|
|
175
124
|
showToolbox: boolean;
|
|
176
|
-
showSettingsPanel
|
|
125
|
+
showSettingsPanel?: boolean;
|
|
177
126
|
}
|
|
178
127
|
declare const useEditorConfig: () => EditorContextValue;
|
|
179
128
|
interface EditorProviderProps {
|
|
180
129
|
children: React.ReactNode;
|
|
181
|
-
value: Omit<EditorContextValue,
|
|
130
|
+
value: Omit<EditorContextValue, "theme"> & {
|
|
182
131
|
theme: EditorTheme;
|
|
183
132
|
};
|
|
184
133
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,74 +4,45 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
4
4
|
import { SerializedNodes } from '@craftjs/core';
|
|
5
5
|
|
|
6
6
|
interface EditorComponentConfig {
|
|
7
|
-
/** The React component to render in the editor canvas */
|
|
8
7
|
component: React.ComponentType<any>;
|
|
9
|
-
/** Display name in the toolbox */
|
|
10
8
|
label: string;
|
|
11
|
-
/** Short description shown below the label */
|
|
12
9
|
description?: string;
|
|
13
|
-
/** Lucide icon or custom icon component */
|
|
14
10
|
icon?: LucideIcon | React.ComponentType<{
|
|
15
11
|
className?: string;
|
|
16
12
|
}>;
|
|
17
|
-
/** Category grouping in the toolbox */
|
|
18
13
|
category?: string;
|
|
19
|
-
/** Default element to create when dragged (JSX element). If not provided, creates <Component /> */
|
|
20
14
|
createElement?: () => React.ReactElement;
|
|
21
15
|
}
|
|
22
16
|
type ComponentRegistry = Record<string, EditorComponentConfig>;
|
|
23
17
|
interface EditorThemeColors {
|
|
24
|
-
/** Primary accent color */
|
|
25
18
|
primary?: string;
|
|
26
|
-
/** Primary foreground (text on primary) */
|
|
27
19
|
primaryForeground?: string;
|
|
28
|
-
/** Background color of sidebars and panels */
|
|
29
20
|
panelBackground?: string;
|
|
30
|
-
/** Canvas/workspace background */
|
|
31
21
|
canvasBackground?: string;
|
|
32
|
-
/** Border color for panels and components */
|
|
33
22
|
border?: string;
|
|
34
|
-
/** Muted background for inactive elements */
|
|
35
23
|
muted?: string;
|
|
36
|
-
/** Text color for muted/secondary text */
|
|
37
24
|
mutedForeground?: string;
|
|
38
|
-
/** Destructive/delete action color */
|
|
39
25
|
destructive?: string;
|
|
40
|
-
/** Foreground/text color */
|
|
41
26
|
foreground?: string;
|
|
42
|
-
/** Background color */
|
|
43
27
|
background?: string;
|
|
44
28
|
}
|
|
45
29
|
interface EditorTheme {
|
|
46
|
-
/** Custom color overrides */
|
|
47
30
|
colors?: EditorThemeColors;
|
|
48
|
-
/** Border radius for UI elements */
|
|
49
31
|
borderRadius?: number;
|
|
50
|
-
/** Font family for editor UI */
|
|
51
32
|
fontFamily?: string;
|
|
52
|
-
/** Paper/canvas width in pixels */
|
|
53
33
|
paperWidth?: number;
|
|
54
|
-
/** Paper minimum height in pixels */
|
|
55
34
|
paperMinHeight?: number;
|
|
56
|
-
/** Paper default background */
|
|
57
35
|
paperBackground?: string;
|
|
58
36
|
}
|
|
59
37
|
interface EditorSlots {
|
|
60
|
-
/** Custom toolbar component (replaces the entire top bar) */
|
|
61
38
|
toolbar?: React.ComponentType<ToolbarSlotProps>;
|
|
62
|
-
/** Custom toolbox/sidebar component */
|
|
63
39
|
toolbox?: React.ComponentType<ToolboxSlotProps>;
|
|
64
|
-
/** Custom settings panel component */
|
|
65
40
|
settingsPanel?: React.ComponentType<SettingsPanelSlotProps>;
|
|
66
|
-
/** Custom empty state for settings panel when nothing is selected */
|
|
67
41
|
settingsEmptyState?: React.ComponentType;
|
|
68
|
-
/** Custom render node wrapper */
|
|
69
42
|
renderNode?: React.ComponentType<{
|
|
70
43
|
render: React.ReactNode;
|
|
71
44
|
}>;
|
|
72
|
-
/** Custom export dialog content */
|
|
73
45
|
exportDialog?: React.ComponentType<ExportDialogSlotProps>;
|
|
74
|
-
/** Custom preview dialog content */
|
|
75
46
|
previewDialog?: React.ComponentType<PreviewDialogSlotProps>;
|
|
76
47
|
}
|
|
77
48
|
interface ToolbarSlotProps {
|
|
@@ -103,60 +74,38 @@ interface PreviewDialogSlotProps {
|
|
|
103
74
|
onClose: () => void;
|
|
104
75
|
}
|
|
105
76
|
interface EmailTemplate {
|
|
106
|
-
/** Unique template identifier */
|
|
107
77
|
id: string;
|
|
108
|
-
/** Display name */
|
|
109
78
|
name: string;
|
|
110
|
-
/** Template description */
|
|
111
79
|
description?: string;
|
|
112
|
-
/** Lucide icon */
|
|
113
80
|
icon?: LucideIcon;
|
|
114
|
-
/** Serialized Craft.js JSON state */
|
|
115
81
|
data: string;
|
|
116
82
|
}
|
|
117
83
|
interface EditorCallbacks {
|
|
118
|
-
/** Called when HTML is exported */
|
|
119
84
|
onExport?: (html: string) => void;
|
|
120
|
-
/** Called when the editor state changes */
|
|
121
85
|
onChange?: (serializedState: string) => void;
|
|
122
|
-
/** Called when a template is loaded */
|
|
123
86
|
onTemplateLoad?: (templateId: string) => void;
|
|
124
|
-
/** Called when canvas is cleared */
|
|
125
87
|
onClear?: () => void;
|
|
88
|
+
/** Called when theme color changes via the built-in color picker */
|
|
89
|
+
onColorChange?: (primaryHsl: string) => void;
|
|
126
90
|
}
|
|
127
91
|
type HtmlRenderer = (typeName: string, props: Record<string, unknown>, childrenHtml: string, linkedNodes?: Record<string, string>) => string | null;
|
|
128
92
|
interface EmailEditorProps {
|
|
129
|
-
/** Additional components to register (merged with built-ins) */
|
|
130
93
|
components?: ComponentRegistry;
|
|
131
|
-
/** Replace ALL built-in components (use only your own) */
|
|
132
94
|
replaceBuiltins?: boolean;
|
|
133
|
-
/** Theme customization */
|
|
134
95
|
theme?: EditorTheme;
|
|
135
|
-
/** Slot overrides for UI sections */
|
|
136
96
|
slots?: EditorSlots;
|
|
137
|
-
/** Pre-defined templates */
|
|
138
97
|
templates?: EmailTemplate[];
|
|
139
|
-
/** Event callbacks */
|
|
140
98
|
callbacks?: EditorCallbacks;
|
|
141
|
-
/** Initial serialized state to load */
|
|
142
99
|
initialState?: string;
|
|
143
|
-
/** Default content to show (JSX children for the Frame) */
|
|
144
100
|
defaultContent?: React.ReactNode;
|
|
145
|
-
/** Editor title displayed in the toolbar */
|
|
146
101
|
title?: string;
|
|
147
|
-
/** Logo element for the toolbar */
|
|
148
102
|
logo?: React.ReactNode;
|
|
149
|
-
/** Custom HTML renderers for export (keyed by component resolved name) */
|
|
150
103
|
htmlRenderers?: Record<string, HtmlRenderer>;
|
|
151
|
-
/** Whether to show the toolbar */
|
|
152
104
|
showToolbar?: boolean;
|
|
153
|
-
/** Whether to show the left toolbox sidebar */
|
|
154
105
|
showToolbox?: boolean;
|
|
155
|
-
/**
|
|
156
|
-
|
|
157
|
-
/** Custom class name for the editor root */
|
|
106
|
+
/** Enable dark mode (applies `dark` class to editor root). Default: true */
|
|
107
|
+
darkMode?: boolean;
|
|
158
108
|
className?: string;
|
|
159
|
-
/** Custom inline styles for the editor root */
|
|
160
109
|
style?: React.CSSProperties;
|
|
161
110
|
}
|
|
162
111
|
|
|
@@ -173,12 +122,12 @@ interface EditorContextValue {
|
|
|
173
122
|
logo?: React.ReactNode;
|
|
174
123
|
showToolbar: boolean;
|
|
175
124
|
showToolbox: boolean;
|
|
176
|
-
showSettingsPanel
|
|
125
|
+
showSettingsPanel?: boolean;
|
|
177
126
|
}
|
|
178
127
|
declare const useEditorConfig: () => EditorContextValue;
|
|
179
128
|
interface EditorProviderProps {
|
|
180
129
|
children: React.ReactNode;
|
|
181
|
-
value: Omit<EditorContextValue,
|
|
130
|
+
value: Omit<EditorContextValue, "theme"> & {
|
|
182
131
|
theme: EditorTheme;
|
|
183
132
|
};
|
|
184
133
|
}
|