cms-block-editor 1.0.12 → 1.0.14

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.d.mts CHANGED
@@ -1,13 +1,15 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { LexicalEditor, LexicalCommand } from 'lexical';
2
+ import { LexicalEditor, LexicalCommand, DecoratorNode, NodeKey, Spread, SerializedLexicalNode } from 'lexical';
3
+ import { JSX, ReactNode } from 'react';
3
4
 
4
5
  interface CMSBlockEditorProps {
5
6
  value?: string;
6
7
  onChange?: (state: any) => void;
7
8
  onImageAdded?: (file: File) => Promise<string>;
9
+ onVideoAdded?: (file: File) => Promise<string>;
8
10
  useBase64Url?: boolean;
9
11
  }
10
- declare function CMSBlockEditor({ value, onChange, onImageAdded, useBase64Url }: CMSBlockEditorProps): react_jsx_runtime.JSX.Element;
12
+ declare function CMSBlockEditor({ value, onChange, onImageAdded, onVideoAdded, useBase64Url }: CMSBlockEditorProps): react_jsx_runtime.JSX.Element;
11
13
 
12
14
  interface CMSRendererProps {
13
15
  content: string;
@@ -77,4 +79,178 @@ declare const OPEN_IMAGE_EDITOR_COMMAND: LexicalCommand<{
77
79
  src: string;
78
80
  }>;
79
81
 
80
- export { CMSBlockEditor, CMSRenderer, OPEN_IMAGE_EDITOR_COMMAND, appendHTML, copyMarkdownToClipboard, downloadHTML, downloadMarkdown, exportToHTML, exportToHTMLWithWrapper, exportToMarkdown, importFromHTML, importFromMarkdown, loadHTMLFromFile, loadMarkdownFromFile, pasteMarkdownFromClipboard };
82
+ type SerializedVideoNode = Spread<{
83
+ src: string;
84
+ width?: number;
85
+ height?: number;
86
+ autoplay?: boolean;
87
+ loop?: boolean;
88
+ muted?: boolean;
89
+ controls?: boolean;
90
+ }, SerializedLexicalNode>;
91
+ declare class VideoNode extends DecoratorNode<JSX.Element> {
92
+ __src: string;
93
+ __width?: number;
94
+ __height?: number;
95
+ __autoplay?: boolean;
96
+ __loop?: boolean;
97
+ __muted?: boolean;
98
+ __controls?: boolean;
99
+ static getType(): string;
100
+ static clone(node: VideoNode): VideoNode;
101
+ static isInline(): boolean;
102
+ constructor(src: string, width?: number, height?: number, autoplay?: boolean, loop?: boolean, muted?: boolean, controls?: boolean, key?: NodeKey);
103
+ createDOM(): HTMLElement;
104
+ updateDOM(): boolean;
105
+ decorate(editor: LexicalEditor): JSX.Element;
106
+ exportJSON(): SerializedVideoNode;
107
+ static importJSON(serializedNode: SerializedVideoNode): VideoNode;
108
+ }
109
+
110
+ type SerializedImageNode = Spread<{
111
+ src: string;
112
+ alt: string;
113
+ width?: number;
114
+ height?: number;
115
+ }, SerializedLexicalNode>;
116
+ declare class ImageNode extends DecoratorNode<JSX.Element> {
117
+ __src: string;
118
+ __alt: string;
119
+ __width?: number;
120
+ __height?: number;
121
+ static getType(): string;
122
+ static clone(node: ImageNode): ImageNode;
123
+ static isInline(): boolean;
124
+ constructor(src: string, alt?: string, width?: number, height?: number, key?: NodeKey);
125
+ createDOM(): HTMLElement;
126
+ updateDOM(): boolean;
127
+ decorate(editor: LexicalEditor): JSX.Element;
128
+ exportJSON(): SerializedImageNode;
129
+ static importJSON(serializedNode: SerializedImageNode): ImageNode;
130
+ }
131
+
132
+ interface ThemeColors {
133
+ primary: string;
134
+ primaryHover: string;
135
+ primaryLight: string;
136
+ primaryDark: string;
137
+ secondary: string;
138
+ secondaryHover: string;
139
+ background: string;
140
+ surface: string;
141
+ border: string;
142
+ divider: string;
143
+ textPrimary: string;
144
+ textSecondary: string;
145
+ textDisabled: string;
146
+ success: string;
147
+ warning: string;
148
+ error: string;
149
+ info: string;
150
+ editorBackground: string;
151
+ editorText: string;
152
+ editorPlaceholder: string;
153
+ toolbarBackground: string;
154
+ toolbarText: string;
155
+ toolbarBorder: string;
156
+ selection: string;
157
+ highlight: string;
158
+ focus: string;
159
+ }
160
+ interface ThemeTypography {
161
+ fontFamily: string;
162
+ fontFamilyMono: string;
163
+ fontSizeXs: string;
164
+ fontSizeSm: string;
165
+ fontSizeMd: string;
166
+ fontSizeLg: string;
167
+ fontSizeXl: string;
168
+ fontWeightNormal: number;
169
+ fontWeightMedium: number;
170
+ fontWeightBold: number;
171
+ lineHeightTight: number;
172
+ lineHeightNormal: number;
173
+ lineHeightRelaxed: number;
174
+ }
175
+ interface ThemeSpacing {
176
+ xs: string;
177
+ sm: string;
178
+ md: string;
179
+ lg: string;
180
+ xl: string;
181
+ xxl: string;
182
+ }
183
+ interface ThemeBorderRadius {
184
+ none: string;
185
+ sm: string;
186
+ md: string;
187
+ lg: string;
188
+ full: string;
189
+ }
190
+ interface ThemeShadows {
191
+ none: string;
192
+ sm: string;
193
+ md: string;
194
+ lg: string;
195
+ xl: string;
196
+ }
197
+ interface Theme {
198
+ name: string;
199
+ colors: ThemeColors;
200
+ typography: ThemeTypography;
201
+ spacing: ThemeSpacing;
202
+ borderRadius: ThemeBorderRadius;
203
+ shadows: ThemeShadows;
204
+ }
205
+ type ThemeMode = 'light' | 'dark' | 'auto';
206
+
207
+ declare const oceanTheme: Theme;
208
+ declare const forestTheme: Theme;
209
+ declare const sunsetTheme: Theme;
210
+ declare const roseTheme: Theme;
211
+ declare const midnightTheme: Theme;
212
+ declare const draculaTheme: Theme;
213
+ declare const monokaiTheme: Theme;
214
+ declare const minimalTheme: Theme;
215
+ declare const presetThemes: {
216
+ light: Theme;
217
+ dark: Theme;
218
+ ocean: Theme;
219
+ forest: Theme;
220
+ sunset: Theme;
221
+ rose: Theme;
222
+ midnight: Theme;
223
+ dracula: Theme;
224
+ monokai: Theme;
225
+ minimal: Theme;
226
+ };
227
+ type PresetThemeName = keyof typeof presetThemes;
228
+
229
+ interface ThemeContextValue {
230
+ theme: Theme;
231
+ mode: ThemeMode;
232
+ setTheme: (theme: Theme | PresetThemeName) => void;
233
+ setMode: (mode: ThemeMode) => void;
234
+ toggleMode: () => void;
235
+ }
236
+ interface ThemeProviderProps {
237
+ children: ReactNode;
238
+ defaultTheme?: Theme | PresetThemeName;
239
+ defaultMode?: ThemeMode;
240
+ storageKey?: string;
241
+ }
242
+ declare function ThemeProvider({ children, defaultTheme, defaultMode, storageKey, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
243
+ declare function useTheme(): ThemeContextValue;
244
+
245
+ interface ThemeSwitcherProps {
246
+ className?: string;
247
+ showModeToggle?: boolean;
248
+ showPresets?: boolean;
249
+ }
250
+ declare function ThemeSwitcher({ className, showModeToggle, showPresets }: ThemeSwitcherProps): react_jsx_runtime.JSX.Element;
251
+
252
+ declare const lightTheme: Theme;
253
+
254
+ declare const darkTheme: Theme;
255
+
256
+ export { CMSBlockEditor, CMSRenderer, ImageNode, OPEN_IMAGE_EDITOR_COMMAND, type PresetThemeName, type Theme, type ThemeColors, type ThemeMode, ThemeProvider, ThemeSwitcher, VideoNode, appendHTML, copyMarkdownToClipboard, darkTheme, downloadHTML, downloadMarkdown, draculaTheme, exportToHTML, exportToHTMLWithWrapper, exportToMarkdown, forestTheme, importFromHTML, importFromMarkdown, lightTheme, loadHTMLFromFile, loadMarkdownFromFile, midnightTheme, minimalTheme, monokaiTheme, oceanTheme, pasteMarkdownFromClipboard, presetThemes, roseTheme, sunsetTheme, useTheme };