react-email-studio 3.3.0 → 3.4.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.d.cts CHANGED
@@ -96,59 +96,6 @@ type EmailHtmlOptions = {
96
96
  customCSS?: string;
97
97
  };
98
98
 
99
- /** Theme color tokens (subset used by the editor chrome). */
100
- type ThemeColors = (typeof THEMES)["light"];
101
- /** Known `options` keys for {@link ReactEmailEditor} — callers may pass extra keys; these are what the editor reads. */
102
- type ReactEmailEditorOptions = EmailHtmlOptions & {
103
- appearance?: {
104
- theme?: string;
105
- /** Shallow merge over the active theme (e.g. accent border). */
106
- colors?: Partial<ThemeColors>;
107
- /** Extra named palettes; keys appear in Settings → Color scheme. */
108
- customThemes?: Record<string, ThemeColors>;
109
- };
110
- locale?: string;
111
- features?: {
112
- autoSave?: {
113
- enabled?: boolean;
114
- interval?: number;
115
- };
116
- };
117
- tools?: Record<string, {
118
- enabled?: boolean;
119
- }>;
120
- /** Optional labels for block-library sections (row layouts + content blocks). */
121
- blockLibrary?: {
122
- groupHeadings?: {
123
- blocks?: string;
124
- };
125
- /** Override default palette group titles (keys: text, structure, media, actions, widgets). */
126
- paletteGroupLabels?: Partial<Record<BlockPaletteGroupKey, string>>;
127
- };
128
- };
129
- interface ReactEmailEditorRef {
130
- loadJson(input: string | Record<string, unknown>): void;
131
- /** Calls `cb` with the design as a JSON string (new `email_document` schema). */
132
- exportJson(cb: (json: string) => void, pretty?: boolean): void;
133
- }
134
- type ReactEmailEditorProps = {
135
- minHeight?: string;
136
- editorId?: string;
137
- options?: ReactEmailEditorOptions;
138
- style?: CSSProperties;
139
- onLoad?: (api: ReactEmailEditorRef) => void;
140
- onReady?: (api: ReactEmailEditorRef) => void;
141
- onUpload?: (file: File) => Promise<string>;
142
- templates?: {
143
- name: string;
144
- design: unknown;
145
- thumbnail?: string;
146
- }[];
147
- hideTemplates?: boolean;
148
- children?: ReactNode;
149
- };
150
- declare const ReactEmailEditor: react.ForwardRefExoticComponent<ReactEmailEditorProps & react.RefAttributes<ReactEmailEditorRef>>;
151
-
152
99
  type Padding = {
153
100
  top?: number;
154
101
  right?: number;
@@ -286,6 +233,61 @@ type JsonToHtmlOptions = EmailHtmlOptions;
286
233
  */
287
234
  declare function jsonToHtml(designInput: unknown, opts?: JsonToHtmlOptions): string;
288
235
 
236
+ /** Theme color tokens (subset used by the editor chrome). */
237
+ type ThemeColors = (typeof THEMES)["light"];
238
+ /** Known `options` keys for {@link ReactEmailEditor} — callers may pass extra keys; these are what the editor reads. */
239
+ type ReactEmailEditorOptions = EmailHtmlOptions & {
240
+ appearance?: {
241
+ theme?: string;
242
+ /** Shallow merge over the active theme (e.g. accent border). */
243
+ colors?: Partial<ThemeColors>;
244
+ /** Extra named palettes; keys appear in Settings → Color scheme. */
245
+ customThemes?: Record<string, ThemeColors>;
246
+ };
247
+ locale?: string;
248
+ features?: {
249
+ autoSave?: {
250
+ enabled?: boolean;
251
+ interval?: number;
252
+ };
253
+ };
254
+ tools?: Record<string, {
255
+ enabled?: boolean;
256
+ }>;
257
+ /** Optional labels for block-library sections (row layouts + content blocks). */
258
+ blockLibrary?: {
259
+ groupHeadings?: {
260
+ blocks?: string;
261
+ };
262
+ /** Override default palette group titles (keys: text, structure, media, actions, widgets). */
263
+ paletteGroupLabels?: Partial<Record<BlockPaletteGroupKey, string>>;
264
+ };
265
+ };
266
+ interface ReactEmailEditorRef {
267
+ loadJson(input: string | Record<string, unknown>): void;
268
+ /** Calls `cb` with the design as a JSON string (new `email_document` schema). */
269
+ exportJson(cb: (json: string) => void, pretty?: boolean): void;
270
+ }
271
+ type ReactEmailEditorProps = {
272
+ minHeight?: string;
273
+ editorId?: string;
274
+ options?: ReactEmailEditorOptions;
275
+ style?: CSSProperties;
276
+ onLoad?: (api: ReactEmailEditorRef) => void;
277
+ onReady?: (api: ReactEmailEditorRef) => void;
278
+ onUpload?: (file: File) => Promise<string>;
279
+ templates?: {
280
+ name: string;
281
+ design: unknown;
282
+ thumbnail?: string;
283
+ }[];
284
+ hideTemplates?: boolean;
285
+ children?: ReactNode;
286
+ };
287
+ declare const ReactEmailEditor: react.ForwardRefExoticComponent<ReactEmailEditorProps & react.RefAttributes<ReactEmailEditorRef>> & {
288
+ jsonToHtml: typeof jsonToHtml;
289
+ };
290
+
289
291
  /**
290
292
  * Pull usable HTML from a full document (`<!DOCTYPE` / `<html>`) or a fragment string.
291
293
  */
package/dist/index.d.ts CHANGED
@@ -96,59 +96,6 @@ type EmailHtmlOptions = {
96
96
  customCSS?: string;
97
97
  };
98
98
 
99
- /** Theme color tokens (subset used by the editor chrome). */
100
- type ThemeColors = (typeof THEMES)["light"];
101
- /** Known `options` keys for {@link ReactEmailEditor} — callers may pass extra keys; these are what the editor reads. */
102
- type ReactEmailEditorOptions = EmailHtmlOptions & {
103
- appearance?: {
104
- theme?: string;
105
- /** Shallow merge over the active theme (e.g. accent border). */
106
- colors?: Partial<ThemeColors>;
107
- /** Extra named palettes; keys appear in Settings → Color scheme. */
108
- customThemes?: Record<string, ThemeColors>;
109
- };
110
- locale?: string;
111
- features?: {
112
- autoSave?: {
113
- enabled?: boolean;
114
- interval?: number;
115
- };
116
- };
117
- tools?: Record<string, {
118
- enabled?: boolean;
119
- }>;
120
- /** Optional labels for block-library sections (row layouts + content blocks). */
121
- blockLibrary?: {
122
- groupHeadings?: {
123
- blocks?: string;
124
- };
125
- /** Override default palette group titles (keys: text, structure, media, actions, widgets). */
126
- paletteGroupLabels?: Partial<Record<BlockPaletteGroupKey, string>>;
127
- };
128
- };
129
- interface ReactEmailEditorRef {
130
- loadJson(input: string | Record<string, unknown>): void;
131
- /** Calls `cb` with the design as a JSON string (new `email_document` schema). */
132
- exportJson(cb: (json: string) => void, pretty?: boolean): void;
133
- }
134
- type ReactEmailEditorProps = {
135
- minHeight?: string;
136
- editorId?: string;
137
- options?: ReactEmailEditorOptions;
138
- style?: CSSProperties;
139
- onLoad?: (api: ReactEmailEditorRef) => void;
140
- onReady?: (api: ReactEmailEditorRef) => void;
141
- onUpload?: (file: File) => Promise<string>;
142
- templates?: {
143
- name: string;
144
- design: unknown;
145
- thumbnail?: string;
146
- }[];
147
- hideTemplates?: boolean;
148
- children?: ReactNode;
149
- };
150
- declare const ReactEmailEditor: react.ForwardRefExoticComponent<ReactEmailEditorProps & react.RefAttributes<ReactEmailEditorRef>>;
151
-
152
99
  type Padding = {
153
100
  top?: number;
154
101
  right?: number;
@@ -286,6 +233,61 @@ type JsonToHtmlOptions = EmailHtmlOptions;
286
233
  */
287
234
  declare function jsonToHtml(designInput: unknown, opts?: JsonToHtmlOptions): string;
288
235
 
236
+ /** Theme color tokens (subset used by the editor chrome). */
237
+ type ThemeColors = (typeof THEMES)["light"];
238
+ /** Known `options` keys for {@link ReactEmailEditor} — callers may pass extra keys; these are what the editor reads. */
239
+ type ReactEmailEditorOptions = EmailHtmlOptions & {
240
+ appearance?: {
241
+ theme?: string;
242
+ /** Shallow merge over the active theme (e.g. accent border). */
243
+ colors?: Partial<ThemeColors>;
244
+ /** Extra named palettes; keys appear in Settings → Color scheme. */
245
+ customThemes?: Record<string, ThemeColors>;
246
+ };
247
+ locale?: string;
248
+ features?: {
249
+ autoSave?: {
250
+ enabled?: boolean;
251
+ interval?: number;
252
+ };
253
+ };
254
+ tools?: Record<string, {
255
+ enabled?: boolean;
256
+ }>;
257
+ /** Optional labels for block-library sections (row layouts + content blocks). */
258
+ blockLibrary?: {
259
+ groupHeadings?: {
260
+ blocks?: string;
261
+ };
262
+ /** Override default palette group titles (keys: text, structure, media, actions, widgets). */
263
+ paletteGroupLabels?: Partial<Record<BlockPaletteGroupKey, string>>;
264
+ };
265
+ };
266
+ interface ReactEmailEditorRef {
267
+ loadJson(input: string | Record<string, unknown>): void;
268
+ /** Calls `cb` with the design as a JSON string (new `email_document` schema). */
269
+ exportJson(cb: (json: string) => void, pretty?: boolean): void;
270
+ }
271
+ type ReactEmailEditorProps = {
272
+ minHeight?: string;
273
+ editorId?: string;
274
+ options?: ReactEmailEditorOptions;
275
+ style?: CSSProperties;
276
+ onLoad?: (api: ReactEmailEditorRef) => void;
277
+ onReady?: (api: ReactEmailEditorRef) => void;
278
+ onUpload?: (file: File) => Promise<string>;
279
+ templates?: {
280
+ name: string;
281
+ design: unknown;
282
+ thumbnail?: string;
283
+ }[];
284
+ hideTemplates?: boolean;
285
+ children?: ReactNode;
286
+ };
287
+ declare const ReactEmailEditor: react.ForwardRefExoticComponent<ReactEmailEditorProps & react.RefAttributes<ReactEmailEditorRef>> & {
288
+ jsonToHtml: typeof jsonToHtml;
289
+ };
290
+
289
291
  /**
290
292
  * Pull usable HTML from a full document (`<!DOCTYPE` / `<html>`) or a fragment string.
291
293
  */
package/dist/index.js CHANGED
@@ -2210,7 +2210,7 @@ function layoutSplitChromeBorder(_C, preview) {
2210
2210
  };
2211
2211
  }
2212
2212
  var CONTENT_BLOCK_HOVER_BORDER = "1px dotted rgba(148, 163, 184, 0.5)";
2213
- var EMPTY_CELL_COLUMN_MIN_H = "min(320px, 42vh)";
2213
+ var DROP_HERE_HEIGHT_PX = 45;
2214
2214
  function blockLinkCaptureHandler(preview, e) {
2215
2215
  if (preview) return;
2216
2216
  const t = e.target;
@@ -2570,7 +2570,7 @@ function NestedRowBlock({
2570
2570
  style: {
2571
2571
  flex: p.ratios?.[ici] ?? 1,
2572
2572
  minWidth: 0,
2573
- minHeight: preview ? void 0 : EMPTY_CELL_COLUMN_MIN_H,
2573
+ minHeight: preview ? void 0 : DROP_HERE_HEIGHT_PX,
2574
2574
  display: "flex",
2575
2575
  flexDirection: "column",
2576
2576
  ...layoutSplitChromeBorder(C, preview),
@@ -2800,10 +2800,9 @@ function Cell({
2800
2800
  onDragLeave: handleDragLeave,
2801
2801
  onDrop: handleDrop,
2802
2802
  style: {
2803
- flex: cellEmpty ? 1 : void 0,
2804
2803
  display: "flex",
2805
2804
  flexDirection: "column",
2806
- minHeight: preview ? void 0 : cellEmpty ? 0 : 44,
2805
+ minHeight: preview ? void 0 : cellEmpty ? DROP_HERE_HEIGHT_PX : 44,
2807
2806
  borderRadius: 4,
2808
2807
  ...preview ? {} : insertAt !== null && !cellEmpty ? { border: `1px dotted ${C.accent}`, background: `${C.accent}0a` } : {},
2809
2808
  background: insertAt !== null && !cellEmpty ? `${C.accent}0a` : "transparent",
@@ -2816,12 +2815,14 @@ function Cell({
2816
2815
  "div",
2817
2816
  {
2818
2817
  style: {
2819
- flex: 1,
2818
+ height: DROP_HERE_HEIGHT_PX,
2819
+ minHeight: DROP_HERE_HEIGHT_PX,
2820
+ maxHeight: DROP_HERE_HEIGHT_PX,
2820
2821
  display: "flex",
2821
2822
  alignItems: "center",
2822
2823
  justifyContent: "center",
2823
- margin: 4,
2824
- borderRadius: 8,
2824
+ margin: 0,
2825
+ borderRadius: 6,
2825
2826
  boxSizing: "border-box",
2826
2827
  textAlign: "center",
2827
2828
  userSelect: "none",
@@ -2830,7 +2831,7 @@ function Cell({
2830
2831
  background: insertAt !== null ? `${C.accent}14` : `${C.canvas}`,
2831
2832
  boxShadow: insertAt !== null ? `inset 0 0 0 1px ${C.accent}22` : `inset 0 0 0 1px ${C.border}99`,
2832
2833
  color: insertAt !== null ? C.accent2 : C.muted,
2833
- fontSize: 11,
2834
+ fontSize: 10,
2834
2835
  fontWeight: insertAt !== null ? 700 : 500,
2835
2836
  letterSpacing: "0.02em"
2836
2837
  },
@@ -2925,7 +2926,7 @@ function LayoutRow({
2925
2926
  id: editorId ? `${editorId}-col-${row.id}-${ci}` : void 0,
2926
2927
  style: {
2927
2928
  flex: row.ratios[ci] ?? 1,
2928
- minHeight: preview ? 50 : EMPTY_CELL_COLUMN_MIN_H,
2929
+ minHeight: preview ? 50 : DROP_HERE_HEIGHT_PX,
2929
2930
  display: "flex",
2930
2931
  flexDirection: "column",
2931
2932
  ...backgroundLayerStyle(cS),
@@ -6508,8 +6509,8 @@ import { Fragment as Fragment7, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-ru
6508
6509
  var RIGHT_RAIL_DEFAULT_W = 328;
6509
6510
  var RIGHT_RAIL_MIN_W = 260;
6510
6511
  var RIGHT_RAIL_MAX_W = 720;
6511
- var ReactEmailEditor = forwardRef(
6512
- function ReactEmailEditor2({
6512
+ var ReactEmailEditorComponent = forwardRef(
6513
+ function ReactEmailEditor({
6513
6514
  minHeight = "100vh",
6514
6515
  editorId = "email-editor",
6515
6516
  onLoad,
@@ -8161,6 +8162,7 @@ var ReactEmailEditor = forwardRef(
8161
8162
  );
8162
8163
  }
8163
8164
  );
8165
+ var ReactEmailEditor2 = Object.assign(ReactEmailEditorComponent, { jsonToHtml });
8164
8166
 
8165
8167
  // src/lib/htmlToEmailDesign.ts
8166
8168
  var pad = (n) => ({ top: n, right: n, bottom: n, left: n });
@@ -8229,7 +8231,7 @@ function htmlToEmailDesignTemplate(html) {
8229
8231
  }
8230
8232
  export {
8231
8233
  PreviewModal as EmailPreviewModal,
8232
- ReactEmailEditor,
8234
+ ReactEmailEditor2 as ReactEmailEditor,
8233
8235
  base64ToUtf8,
8234
8236
  DEVICES as emailPreviewDevices,
8235
8237
  extractHtmlForDesign,