@react-email/editor 0.0.0-experimental.26 → 0.0.0-experimental.27

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.
Files changed (44) hide show
  1. package/dist/{columns-ZSaLdkg9.cjs → columns-BXN-NNd4.cjs} +3 -183
  2. package/dist/{columns-CUxUEHje.mjs → columns-Cos2lqfu.mjs} +3 -171
  3. package/dist/columns-Cos2lqfu.mjs.map +1 -0
  4. package/dist/core/index.cjs +2 -2
  5. package/dist/core/index.d.cts +1 -1
  6. package/dist/core/index.d.mts +1 -1
  7. package/dist/core/index.mjs +2 -2
  8. package/dist/{core-DpfUR_iP.cjs → core-B1NP2Drs.cjs} +25 -109
  9. package/dist/{core-C0EkaM-K.mjs → core-Dr1J3aZd.mjs} +5 -77
  10. package/dist/core-Dr1J3aZd.mjs.map +1 -0
  11. package/dist/extensions/index.cjs +5 -4
  12. package/dist/extensions/index.d.cts +1 -1
  13. package/dist/extensions/index.d.mts +1 -1
  14. package/dist/extensions/index.mjs +3 -2
  15. package/dist/global-content-BRvA4PRG.cjs +89 -0
  16. package/dist/global-content-kdUzYcsA.mjs +78 -0
  17. package/dist/global-content-kdUzYcsA.mjs.map +1 -0
  18. package/dist/{index-BPjgJSQh.d.cts → index-jGyVEd5q.d.cts} +1 -1
  19. package/dist/{index-BPjgJSQh.d.cts.map → index-jGyVEd5q.d.cts.map} +1 -1
  20. package/dist/{index-4EvOA-Ll.d.mts → index-ozCcANmD.d.mts} +1 -1
  21. package/dist/{index-4EvOA-Ll.d.mts.map → index-ozCcANmD.d.mts.map} +1 -1
  22. package/dist/plugins/index.cjs +747 -0
  23. package/dist/plugins/index.d.cts +79 -0
  24. package/dist/plugins/index.d.cts.map +1 -0
  25. package/dist/plugins/index.d.mts +79 -0
  26. package/dist/plugins/index.d.mts.map +1 -0
  27. package/dist/plugins/index.mjs +742 -0
  28. package/dist/plugins/index.mjs.map +1 -0
  29. package/dist/{set-text-alignment-DZvgnbvz.mjs → set-text-alignment-BO24ieeE.mjs} +1 -1
  30. package/dist/{set-text-alignment-DZvgnbvz.mjs.map → set-text-alignment-BO24ieeE.mjs.map} +1 -1
  31. package/dist/styles-C-cCyJCn.cjs +211 -0
  32. package/dist/styles-DLviD0JK.mjs +194 -0
  33. package/dist/styles-DLviD0JK.mjs.map +1 -0
  34. package/dist/ui/index.cjs +2 -2
  35. package/dist/ui/index.d.cts +42 -42
  36. package/dist/ui/index.d.cts.map +1 -1
  37. package/dist/ui/index.d.mts +42 -42
  38. package/dist/ui/index.mjs +2 -2
  39. package/dist/utils/index.cjs +1 -1
  40. package/dist/utils/index.mjs +1 -1
  41. package/package.json +13 -3
  42. package/dist/columns-CUxUEHje.mjs.map +0 -1
  43. package/dist/core-C0EkaM-K.mjs.map +0 -1
  44. /package/dist/{set-text-alignment-Bx3bPteH.cjs → set-text-alignment-CbECklB4.cjs} +0 -0
@@ -25,6 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
+ const require_styles = require('./styles-C-cCyJCn.cjs');
28
29
  let _react_email_components = require("@react-email/components");
29
30
  let react_jsx_runtime = require("react/jsx-runtime");
30
31
  let _tiptap_core = require("@tiptap/core");
@@ -71,175 +72,6 @@ var EditorEventBus = class {
71
72
  };
72
73
  const editorEventBus = new EditorEventBus();
73
74
 
74
- //#endregion
75
- //#region src/utils/styles.ts
76
- const WHITE_SPACE_REGEX = /\s+/;
77
- const inlineCssToJs = (inlineStyle, options = {}) => {
78
- const styleObject = {};
79
- if (!inlineStyle || inlineStyle === "" || typeof inlineStyle === "object") return styleObject;
80
- inlineStyle.split(";").forEach((style) => {
81
- if (style.trim()) {
82
- const [key, value] = style.split(":");
83
- const valueTrimmed = value?.trim();
84
- if (!valueTrimmed) return;
85
- const formattedKey = key.trim().replace(/-\w/g, (match) => match[1].toUpperCase());
86
- styleObject[formattedKey] = options?.removeUnit ? valueTrimmed.replace(/px|%/g, "") : valueTrimmed;
87
- }
88
- });
89
- return styleObject;
90
- };
91
- /**
92
- * Expands CSS shorthand properties (margin, padding) into their longhand equivalents.
93
- * This prevents shorthand properties from overriding specific longhand properties in email clients.
94
- *
95
- * @param styles - Style object that may contain shorthand properties
96
- * @returns New style object with shorthand properties expanded to longhand
97
- *
98
- * @example
99
- * expandShorthandProperties({ margin: '0', paddingTop: '10px' })
100
- * // Returns: { marginTop: '0', marginRight: '0', marginBottom: '0', marginLeft: '0', paddingTop: '10px' }
101
- */
102
- function expandShorthandProperties(styles) {
103
- if (!styles || typeof styles !== "object") return {};
104
- const expanded = {};
105
- for (const key in styles) {
106
- const value = styles[key];
107
- if (value === void 0 || value === null || value === "") continue;
108
- switch (key) {
109
- case "margin": {
110
- const values = parseShorthandValue(value);
111
- expanded.marginTop = values.top;
112
- expanded.marginRight = values.right;
113
- expanded.marginBottom = values.bottom;
114
- expanded.marginLeft = values.left;
115
- break;
116
- }
117
- case "padding": {
118
- const values = parseShorthandValue(value);
119
- expanded.paddingTop = values.top;
120
- expanded.paddingRight = values.right;
121
- expanded.paddingBottom = values.bottom;
122
- expanded.paddingLeft = values.left;
123
- break;
124
- }
125
- case "border": {
126
- const values = convertBorderValue(value);
127
- expanded.borderStyle = values.style;
128
- expanded.borderWidth = values.width;
129
- expanded.borderColor = values.color;
130
- break;
131
- }
132
- case "borderTopLeftRadius":
133
- case "borderTopRightRadius":
134
- case "borderBottomLeftRadius":
135
- case "borderBottomRightRadius":
136
- expanded[key] = value;
137
- if (styles.borderTopLeftRadius && styles.borderTopRightRadius && styles.borderBottomLeftRadius && styles.borderBottomRightRadius) {
138
- const values = [
139
- styles.borderTopLeftRadius,
140
- styles.borderTopRightRadius,
141
- styles.borderBottomLeftRadius,
142
- styles.borderBottomRightRadius
143
- ];
144
- if (new Set(values).size === 1) expanded.borderRadius = values[0];
145
- }
146
- break;
147
- default: expanded[key] = value;
148
- }
149
- }
150
- return expanded;
151
- }
152
- /**
153
- * Parses CSS shorthand value (1-4 values) into individual side values.
154
- * Follows CSS specification for shorthand property value parsing.
155
- *
156
- * @param value - Shorthand value string (e.g., '0', '10px 20px', '5px 10px 15px 20px')
157
- * @returns Object with top, right, bottom, left values
158
- */
159
- function parseShorthandValue(value) {
160
- const stringValue = String(value).trim();
161
- const parts = stringValue.split(WHITE_SPACE_REGEX);
162
- const len = parts.length;
163
- if (len === 1) return {
164
- top: parts[0],
165
- right: parts[0],
166
- bottom: parts[0],
167
- left: parts[0]
168
- };
169
- if (len === 2) return {
170
- top: parts[0],
171
- right: parts[1],
172
- bottom: parts[0],
173
- left: parts[1]
174
- };
175
- if (len === 3) return {
176
- top: parts[0],
177
- right: parts[1],
178
- bottom: parts[2],
179
- left: parts[1]
180
- };
181
- if (len === 4) return {
182
- top: parts[0],
183
- right: parts[1],
184
- bottom: parts[2],
185
- left: parts[3]
186
- };
187
- return {
188
- top: stringValue,
189
- right: stringValue,
190
- bottom: stringValue,
191
- left: stringValue
192
- };
193
- }
194
- function convertBorderValue(value) {
195
- const stringValue = String(value).trim();
196
- const parts = stringValue.split(WHITE_SPACE_REGEX);
197
- switch (parts.length) {
198
- case 1: return {
199
- style: "solid",
200
- width: parts[0],
201
- color: "black"
202
- };
203
- case 2: return {
204
- style: parts[1],
205
- width: parts[0],
206
- color: "black"
207
- };
208
- case 3: return {
209
- style: parts[1],
210
- width: parts[0],
211
- color: parts[2]
212
- };
213
- case 4: return {
214
- style: parts[1],
215
- width: parts[0],
216
- color: parts[2]
217
- };
218
- default: return {
219
- style: "solid",
220
- width: stringValue,
221
- color: "black"
222
- };
223
- }
224
- }
225
- /**
226
- * Resolves conflicts between reset styles and inline styles by expanding
227
- * shorthand properties (margin, padding) to longhand before merging.
228
- * This prevents shorthand properties from overriding specific longhand properties.
229
- *
230
- * @param resetStyles - Base reset styles that may contain shorthand properties
231
- * @param inlineStyles - Inline styles that should override reset styles
232
- * @returns Merged styles with inline styles taking precedence
233
- */
234
- function resolveConflictingStyles(resetStyles, inlineStyles) {
235
- const expandedResetStyles = expandShorthandProperties(resetStyles);
236
- const expandedInlineStyles = expandShorthandProperties(inlineStyles);
237
- return {
238
- ...expandedResetStyles,
239
- ...expandedInlineStyles
240
- };
241
- }
242
-
243
75
  //#endregion
244
76
  //#region src/core/serializer/email-node.ts
245
77
  var EmailNode = class EmailNode extends _tiptap_core.Node {
@@ -430,7 +262,7 @@ function createColumnsNode(config, includeCommands) {
430
262
  } };
431
263
  } },
432
264
  renderToReactEmail({ children, node, style }) {
433
- const inlineStyles = inlineCssToJs(node.attrs?.style);
265
+ const inlineStyles = require_styles.inlineCssToJs(node.attrs?.style);
434
266
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Row, {
435
267
  className: node.attrs?.class || void 0,
436
268
  style: {
@@ -505,7 +337,7 @@ const ColumnsColumn = EmailNode.create({
505
337
  };
506
338
  },
507
339
  renderToReactEmail({ children, node, style }) {
508
- const inlineStyles = inlineCssToJs(node.attrs?.style);
340
+ const inlineStyles = require_styles.inlineCssToJs(node.attrs?.style);
509
341
  const width = node.attrs?.width;
510
342
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_react_email_components.Column, {
511
343
  className: node.attrs?.class || void 0,
@@ -615,16 +447,4 @@ Object.defineProperty(exports, 'getColumnsDepth', {
615
447
  get: function () {
616
448
  return getColumnsDepth;
617
449
  }
618
- });
619
- Object.defineProperty(exports, 'inlineCssToJs', {
620
- enumerable: true,
621
- get: function () {
622
- return inlineCssToJs;
623
- }
624
- });
625
- Object.defineProperty(exports, 'resolveConflictingStyles', {
626
- enumerable: true,
627
- get: function () {
628
- return resolveConflictingStyles;
629
- }
630
450
  });
@@ -1,3 +1,4 @@
1
+ import { n as inlineCssToJs } from "./styles-DLviD0JK.mjs";
1
2
  import { Column, Row } from "@react-email/components";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  import { Node, mergeAttributes } from "@tiptap/core";
@@ -44,175 +45,6 @@ var EditorEventBus = class {
44
45
  };
45
46
  const editorEventBus = new EditorEventBus();
46
47
 
47
- //#endregion
48
- //#region src/utils/styles.ts
49
- const WHITE_SPACE_REGEX = /\s+/;
50
- const inlineCssToJs = (inlineStyle, options = {}) => {
51
- const styleObject = {};
52
- if (!inlineStyle || inlineStyle === "" || typeof inlineStyle === "object") return styleObject;
53
- inlineStyle.split(";").forEach((style) => {
54
- if (style.trim()) {
55
- const [key, value] = style.split(":");
56
- const valueTrimmed = value?.trim();
57
- if (!valueTrimmed) return;
58
- const formattedKey = key.trim().replace(/-\w/g, (match) => match[1].toUpperCase());
59
- styleObject[formattedKey] = options?.removeUnit ? valueTrimmed.replace(/px|%/g, "") : valueTrimmed;
60
- }
61
- });
62
- return styleObject;
63
- };
64
- /**
65
- * Expands CSS shorthand properties (margin, padding) into their longhand equivalents.
66
- * This prevents shorthand properties from overriding specific longhand properties in email clients.
67
- *
68
- * @param styles - Style object that may contain shorthand properties
69
- * @returns New style object with shorthand properties expanded to longhand
70
- *
71
- * @example
72
- * expandShorthandProperties({ margin: '0', paddingTop: '10px' })
73
- * // Returns: { marginTop: '0', marginRight: '0', marginBottom: '0', marginLeft: '0', paddingTop: '10px' }
74
- */
75
- function expandShorthandProperties(styles) {
76
- if (!styles || typeof styles !== "object") return {};
77
- const expanded = {};
78
- for (const key in styles) {
79
- const value = styles[key];
80
- if (value === void 0 || value === null || value === "") continue;
81
- switch (key) {
82
- case "margin": {
83
- const values = parseShorthandValue(value);
84
- expanded.marginTop = values.top;
85
- expanded.marginRight = values.right;
86
- expanded.marginBottom = values.bottom;
87
- expanded.marginLeft = values.left;
88
- break;
89
- }
90
- case "padding": {
91
- const values = parseShorthandValue(value);
92
- expanded.paddingTop = values.top;
93
- expanded.paddingRight = values.right;
94
- expanded.paddingBottom = values.bottom;
95
- expanded.paddingLeft = values.left;
96
- break;
97
- }
98
- case "border": {
99
- const values = convertBorderValue(value);
100
- expanded.borderStyle = values.style;
101
- expanded.borderWidth = values.width;
102
- expanded.borderColor = values.color;
103
- break;
104
- }
105
- case "borderTopLeftRadius":
106
- case "borderTopRightRadius":
107
- case "borderBottomLeftRadius":
108
- case "borderBottomRightRadius":
109
- expanded[key] = value;
110
- if (styles.borderTopLeftRadius && styles.borderTopRightRadius && styles.borderBottomLeftRadius && styles.borderBottomRightRadius) {
111
- const values = [
112
- styles.borderTopLeftRadius,
113
- styles.borderTopRightRadius,
114
- styles.borderBottomLeftRadius,
115
- styles.borderBottomRightRadius
116
- ];
117
- if (new Set(values).size === 1) expanded.borderRadius = values[0];
118
- }
119
- break;
120
- default: expanded[key] = value;
121
- }
122
- }
123
- return expanded;
124
- }
125
- /**
126
- * Parses CSS shorthand value (1-4 values) into individual side values.
127
- * Follows CSS specification for shorthand property value parsing.
128
- *
129
- * @param value - Shorthand value string (e.g., '0', '10px 20px', '5px 10px 15px 20px')
130
- * @returns Object with top, right, bottom, left values
131
- */
132
- function parseShorthandValue(value) {
133
- const stringValue = String(value).trim();
134
- const parts = stringValue.split(WHITE_SPACE_REGEX);
135
- const len = parts.length;
136
- if (len === 1) return {
137
- top: parts[0],
138
- right: parts[0],
139
- bottom: parts[0],
140
- left: parts[0]
141
- };
142
- if (len === 2) return {
143
- top: parts[0],
144
- right: parts[1],
145
- bottom: parts[0],
146
- left: parts[1]
147
- };
148
- if (len === 3) return {
149
- top: parts[0],
150
- right: parts[1],
151
- bottom: parts[2],
152
- left: parts[1]
153
- };
154
- if (len === 4) return {
155
- top: parts[0],
156
- right: parts[1],
157
- bottom: parts[2],
158
- left: parts[3]
159
- };
160
- return {
161
- top: stringValue,
162
- right: stringValue,
163
- bottom: stringValue,
164
- left: stringValue
165
- };
166
- }
167
- function convertBorderValue(value) {
168
- const stringValue = String(value).trim();
169
- const parts = stringValue.split(WHITE_SPACE_REGEX);
170
- switch (parts.length) {
171
- case 1: return {
172
- style: "solid",
173
- width: parts[0],
174
- color: "black"
175
- };
176
- case 2: return {
177
- style: parts[1],
178
- width: parts[0],
179
- color: "black"
180
- };
181
- case 3: return {
182
- style: parts[1],
183
- width: parts[0],
184
- color: parts[2]
185
- };
186
- case 4: return {
187
- style: parts[1],
188
- width: parts[0],
189
- color: parts[2]
190
- };
191
- default: return {
192
- style: "solid",
193
- width: stringValue,
194
- color: "black"
195
- };
196
- }
197
- }
198
- /**
199
- * Resolves conflicts between reset styles and inline styles by expanding
200
- * shorthand properties (margin, padding) to longhand before merging.
201
- * This prevents shorthand properties from overriding specific longhand properties.
202
- *
203
- * @param resetStyles - Base reset styles that may contain shorthand properties
204
- * @param inlineStyles - Inline styles that should override reset styles
205
- * @returns Merged styles with inline styles taking precedence
206
- */
207
- function resolveConflictingStyles(resetStyles, inlineStyles) {
208
- const expandedResetStyles = expandShorthandProperties(resetStyles);
209
- const expandedInlineStyles = expandShorthandProperties(inlineStyles);
210
- return {
211
- ...expandedResetStyles,
212
- ...expandedInlineStyles
213
- };
214
- }
215
-
216
48
  //#endregion
217
49
  //#region src/core/serializer/email-node.ts
218
50
  var EmailNode = class EmailNode extends Node {
@@ -493,5 +325,5 @@ const ColumnsColumn = EmailNode.create({
493
325
  });
494
326
 
495
327
  //#endregion
496
- export { editorEventBus as _, ThreeColumns as a, COMMON_HTML_ATTRIBUTES as c, TABLE_CELL_ATTRIBUTES as d, TABLE_HEADER_ATTRIBUTES as f, resolveConflictingStyles as g, inlineCssToJs as h, MAX_COLUMNS_DEPTH as i, LAYOUT_ATTRIBUTES as l, EmailNode as m, ColumnsColumn as n, TwoColumns as o, createStandardAttributes as p, FourColumns as r, getColumnsDepth as s, COLUMN_PARENT_TYPES as t, TABLE_ATTRIBUTES as u };
497
- //# sourceMappingURL=columns-CUxUEHje.mjs.map
328
+ export { ThreeColumns as a, COMMON_HTML_ATTRIBUTES as c, TABLE_CELL_ATTRIBUTES as d, TABLE_HEADER_ATTRIBUTES as f, editorEventBus as h, MAX_COLUMNS_DEPTH as i, LAYOUT_ATTRIBUTES as l, EmailNode as m, ColumnsColumn as n, TwoColumns as o, createStandardAttributes as p, FourColumns as r, getColumnsDepth as s, COLUMN_PARENT_TYPES as t, TABLE_ATTRIBUTES as u };
329
+ //# sourceMappingURL=columns-Cos2lqfu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columns-Cos2lqfu.mjs","names":[],"sources":["../src/core/event-bus.ts","../src/core/serializer/email-node.ts","../src/utils/attribute-helpers.ts","../src/extensions/columns.tsx"],"sourcesContent":["const EVENT_PREFIX = '@react-email/editor:';\n\n/**\n * Base event map interface for the editor event bus.\n *\n * Components extend this via TypeScript module augmentation:\n * ```ts\n * declare module '@react-email/editor' {\n * interface EditorEventMap {\n * 'my-component:custom-event': { data: string };\n * }\n * }\n * ```\n */\nexport interface EditorEventMap {\n 'bubble-menu:add-link': undefined;\n}\n\nexport type EditorEventName = keyof EditorEventMap;\n\nexport type EditorEventHandler<T extends EditorEventName> = (\n payload: EditorEventMap[T],\n) => void | Promise<void>;\n\nexport interface EditorEventSubscription {\n unsubscribe: () => void;\n}\n\nclass EditorEventBus {\n private prefixEventName(eventName: EditorEventName): string {\n return `${EVENT_PREFIX}${String(eventName)}`;\n }\n\n dispatch<T extends EditorEventName>(\n eventName: T,\n payload: EditorEventMap[T],\n options?: { target?: EventTarget },\n ): void {\n const target = options?.target ?? window;\n const prefixedEventName = this.prefixEventName(eventName);\n const event = new CustomEvent(prefixedEventName, {\n detail: payload,\n bubbles: false,\n cancelable: false,\n });\n target.dispatchEvent(event);\n }\n\n on<T extends EditorEventName>(\n eventName: T,\n handler: EditorEventHandler<T>,\n options?: AddEventListenerOptions & { target?: EventTarget },\n ): EditorEventSubscription {\n const target = options?.target ?? window;\n const prefixedEventName = this.prefixEventName(eventName);\n const abortController = new AbortController();\n\n const wrappedHandler = (event: Event) => {\n const customEvent = event as CustomEvent<EditorEventMap[T]>;\n const result = handler(customEvent.detail);\n\n if (result instanceof Promise) {\n result.catch((error) => {\n console.error(\n `Error in async event handler for ${prefixedEventName}:`,\n { event: customEvent.detail, error },\n );\n });\n }\n };\n\n target.addEventListener(prefixedEventName, wrappedHandler, {\n ...options,\n signal: abortController.signal,\n });\n\n return {\n unsubscribe: () => {\n abortController.abort();\n },\n };\n }\n}\n\nexport const editorEventBus = new EditorEventBus();\n","import {\n type Editor,\n type JSONContent,\n Node,\n type NodeConfig,\n type NodeType,\n} from '@tiptap/core';\n\nexport type NodeRendererComponent = (props: {\n node: JSONContent;\n style: React.CSSProperties;\n children?: React.ReactNode;\n\n extension: EmailNode<any, any>;\n}) => React.ReactNode;\n\nexport interface EmailNodeConfig<Options, Storage>\n extends NodeConfig<Options, Storage> {\n renderToReactEmail: NodeRendererComponent;\n}\n\ntype ConfigParameter<Options, Storage> = Partial<\n Omit<EmailNodeConfig<Options, Storage>, 'renderToReactEmail'>\n> &\n Pick<EmailNodeConfig<Options, Storage>, 'renderToReactEmail'> &\n ThisType<{\n name: string;\n options: Options;\n storage: Storage;\n editor: Editor;\n type: NodeType;\n parent: (...args: any[]) => any;\n }>;\n\nexport class EmailNode<\n Options = Record<string, never>,\n Storage = Record<string, never>,\n> extends Node<Options, Storage> {\n declare config: EmailNodeConfig<Options, Storage>;\n\n // biome-ignore lint/complexity/noUselessConstructor: This is only meant to change the types for config, hence why we keep it\n constructor(config: ConfigParameter<Options, Storage>) {\n super(config);\n }\n\n /**\n * Create a new Node instance\n * @param config - Node configuration object or a function that returns a configuration object\n */\n static create<O = Record<string, never>, S = Record<string, never>>(\n config: ConfigParameter<O, S> | (() => ConfigParameter<O, S>),\n ) {\n // If the config is a function, execute it to get the configuration object\n const resolvedConfig = typeof config === 'function' ? config() : config;\n return new EmailNode<O, S>(resolvedConfig);\n }\n\n static from<O, S>(\n node: Node<O, S>,\n renderToReactEmail: NodeRendererComponent,\n ): EmailNode<O, S> {\n const customNode = EmailNode.create({} as ConfigParameter<O, S>);\n // This only makes a shallow copy, so if there's nested objects here mutating things will be dangerous\n Object.assign(customNode, { ...node });\n customNode.config = { ...node.config, renderToReactEmail };\n return customNode;\n }\n\n // Subclass return types for configure/extend; safe at runtime. TipTap's Node typings cause TS2416 when returning EmailNode.\n // @ts-expect-error - EmailNode is a valid Node subclass; base typings don't support subclass return types\n configure(options?: Partial<Options>) {\n return super.configure(options) as EmailNode<Options, Storage>;\n }\n\n // @ts-expect-error - same as configure: extend returns EmailNode for chaining; base typings are incompatible\n extend<\n ExtendedOptions = Options,\n ExtendedStorage = Storage,\n ExtendedConfig extends NodeConfig<\n ExtendedOptions,\n ExtendedStorage\n > = EmailNodeConfig<ExtendedOptions, ExtendedStorage>,\n >(\n extendedConfig?:\n | (() => Partial<ExtendedConfig>)\n | (Partial<ExtendedConfig> &\n ThisType<{\n name: string;\n options: ExtendedOptions;\n storage: ExtendedStorage;\n editor: Editor;\n type: NodeType;\n }>),\n ): EmailNode<ExtendedOptions, ExtendedStorage> {\n // If the extended config is a function, execute it to get the configuration object\n const resolvedConfig =\n typeof extendedConfig === 'function' ? extendedConfig() : extendedConfig;\n return super.extend(resolvedConfig) as EmailNode<\n ExtendedOptions,\n ExtendedStorage\n >;\n }\n}\n","/**\n * Creates TipTap attribute definitions for a list of HTML attributes.\n * Each attribute will have the same pattern:\n * - default: null\n * - parseHTML: extracts the attribute from the element\n * - renderHTML: conditionally renders the attribute if it has a value\n *\n * @param attributeNames - Array of HTML attribute names to create definitions for\n * @returns Object with TipTap attribute definitions\n *\n * @example\n * const attrs = createStandardAttributes(['class', 'id', 'title']);\n * // Returns:\n * // {\n * // class: {\n * // default: null,\n * // parseHTML: (element) => element.getAttribute('class'),\n * // renderHTML: (attributes) => attributes.class ? { class: attributes.class } : {}\n * // },\n * // ...\n * // }\n */\nexport function createStandardAttributes(attributeNames: readonly string[]) {\n return Object.fromEntries(\n attributeNames.map((attr) => [\n attr,\n {\n default: null,\n parseHTML: (element: HTMLElement) => element.getAttribute(attr),\n renderHTML: (attributes: Record<string, unknown>) => {\n if (!attributes[attr]) {\n return {};\n }\n\n return {\n [attr]: attributes[attr],\n };\n },\n },\n ]),\n );\n}\n\n/**\n * Common HTML attributes used across multiple extensions.\n * These preserve attributes during HTML import and editing for better\n * fidelity when importing existing email templates.\n */\nexport const COMMON_HTML_ATTRIBUTES = [\n 'id',\n 'class',\n 'title',\n 'lang',\n 'dir',\n 'data-id',\n] as const;\n\n/**\n * Layout-specific HTML attributes used for positioning and sizing.\n */\nexport const LAYOUT_ATTRIBUTES = ['align', 'width', 'height'] as const;\n\n/**\n * Table-specific HTML attributes used for table layout and styling.\n */\nexport const TABLE_ATTRIBUTES = [\n 'border',\n 'cellpadding',\n 'cellspacing',\n] as const;\n\n/**\n * Table cell-specific HTML attributes.\n */\nexport const TABLE_CELL_ATTRIBUTES = [\n 'valign',\n 'bgcolor',\n 'colspan',\n 'rowspan',\n] as const;\n\n/**\n * Table header cell-specific HTML attributes.\n * These are additional attributes that only apply to <th> elements.\n */\nexport const TABLE_HEADER_ATTRIBUTES = [\n ...TABLE_CELL_ATTRIBUTES,\n 'scope',\n] as const;\n","import { Column, Row } from '@react-email/components';\nimport { type CommandProps, mergeAttributes } from '@tiptap/core';\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model';\nimport { TextSelection } from '@tiptap/pm/state';\nimport { EmailNode } from '../core/serializer/email-node';\nimport {\n COMMON_HTML_ATTRIBUTES,\n createStandardAttributes,\n LAYOUT_ATTRIBUTES,\n} from '../utils/attribute-helpers';\nimport { inlineCssToJs } from '../utils/styles';\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n columns: {\n insertColumns: (count: 2 | 3 | 4) => ReturnType;\n };\n }\n}\n\nexport const COLUMN_PARENT_TYPES = [\n 'twoColumns',\n 'threeColumns',\n 'fourColumns',\n] as const;\n\nconst COLUMN_PARENT_SET = new Set<string>(COLUMN_PARENT_TYPES);\n\nexport const MAX_COLUMNS_DEPTH = 3;\n\nexport function getColumnsDepth(doc: ProseMirrorNode, from: number): number {\n const $from = doc.resolve(from);\n let depth = 0;\n for (let d = $from.depth; d > 0; d--) {\n if (COLUMN_PARENT_SET.has($from.node(d).type.name)) {\n depth++;\n }\n }\n return depth;\n}\n\ninterface ColumnsVariantConfig {\n name: (typeof COLUMN_PARENT_TYPES)[number];\n columnCount: number;\n content: string;\n dataType: string;\n}\n\nconst VARIANTS: ColumnsVariantConfig[] = [\n {\n name: 'twoColumns',\n columnCount: 2,\n content: 'columnsColumn columnsColumn',\n dataType: 'two-columns',\n },\n {\n name: 'threeColumns',\n columnCount: 3,\n content: 'columnsColumn columnsColumn columnsColumn',\n dataType: 'three-columns',\n },\n {\n name: 'fourColumns',\n columnCount: 4,\n content: 'columnsColumn{4}',\n dataType: 'four-columns',\n },\n];\n\nconst NODE_TYPE_MAP: Record<number, (typeof COLUMN_PARENT_TYPES)[number]> = {\n 2: 'twoColumns',\n 3: 'threeColumns',\n 4: 'fourColumns',\n};\n\nfunction createColumnsNode(\n config: ColumnsVariantConfig,\n includeCommands: boolean,\n) {\n return EmailNode.create({\n name: config.name,\n group: 'block',\n content: config.content,\n isolating: true,\n defining: true,\n\n addAttributes() {\n return createStandardAttributes([\n ...LAYOUT_ATTRIBUTES,\n ...COMMON_HTML_ATTRIBUTES,\n ]);\n },\n\n parseHTML() {\n return [{ tag: `div[data-type=\"${config.dataType}\"]` }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(\n { 'data-type': config.dataType, class: 'node-columns' },\n HTMLAttributes,\n ),\n 0,\n ];\n },\n\n ...(includeCommands && {\n addCommands() {\n return {\n insertColumns:\n (count: 2 | 3 | 4) =>\n ({\n commands,\n state,\n }: CommandProps & {\n state: { doc: ProseMirrorNode; selection: { from: number } };\n }) => {\n if (\n getColumnsDepth(state.doc, state.selection.from) >=\n MAX_COLUMNS_DEPTH\n ) {\n return false;\n }\n const nodeType = NODE_TYPE_MAP[count];\n const children = Array.from({ length: count }, () => ({\n type: 'columnsColumn',\n content: [{ type: 'paragraph', content: [] }],\n }));\n return commands.insertContent({\n type: nodeType,\n content: children,\n });\n },\n };\n },\n }),\n\n renderToReactEmail({ children, node, style }) {\n const inlineStyles = inlineCssToJs(node.attrs?.style);\n return (\n <Row\n className={node.attrs?.class || undefined}\n style={{ ...style, ...inlineStyles }}\n >\n {children}\n </Row>\n );\n },\n });\n}\n\nexport const TwoColumns = createColumnsNode(VARIANTS[0], true);\nexport const ThreeColumns = createColumnsNode(VARIANTS[1], false);\nexport const FourColumns = createColumnsNode(VARIANTS[2], false);\n\nexport const ColumnsColumn = EmailNode.create({\n name: 'columnsColumn',\n group: 'columnsColumn',\n content: 'block+',\n isolating: true,\n\n addAttributes() {\n return {\n ...createStandardAttributes([\n ...LAYOUT_ATTRIBUTES,\n ...COMMON_HTML_ATTRIBUTES,\n ]),\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[data-type=\"column\"]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(\n { 'data-type': 'column', class: 'node-column' },\n HTMLAttributes,\n ),\n 0,\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n Backspace: ({ editor }) => {\n const { state } = editor;\n const { selection } = state;\n const { empty, $from } = selection;\n\n if (!empty) return false;\n\n for (let depth = $from.depth; depth >= 1; depth--) {\n if ($from.pos !== $from.start(depth)) break;\n\n const indexInParent = $from.index(depth - 1);\n\n if (indexInParent === 0) continue;\n\n const parent = $from.node(depth - 1);\n const prevNode = parent.child(indexInParent - 1);\n\n if (COLUMN_PARENT_SET.has(prevNode.type.name)) {\n const deleteFrom = $from.before(depth) - prevNode.nodeSize;\n const deleteTo = $from.before(depth);\n editor.view.dispatch(state.tr.delete(deleteFrom, deleteTo));\n return true;\n }\n\n break;\n }\n\n return false;\n },\n 'Mod-a': ({ editor }) => {\n const { state } = editor;\n const { $from } = state.selection;\n\n for (let d = $from.depth; d > 0; d--) {\n if ($from.node(d).type.name !== 'columnsColumn') {\n continue;\n }\n\n const columnStart = $from.start(d);\n const columnEnd = $from.end(d);\n const { from, to } = state.selection;\n\n if (from === columnStart && to === columnEnd) {\n return false;\n }\n\n editor.view.dispatch(\n state.tr.setSelection(\n TextSelection.create(state.doc, columnStart, columnEnd),\n ),\n );\n return true;\n }\n\n return false;\n },\n };\n },\n\n renderToReactEmail({ children, node, style }) {\n const inlineStyles = inlineCssToJs(node.attrs?.style);\n const width = node.attrs?.width;\n return (\n <Column\n className={node.attrs?.class || undefined}\n style={{\n ...style,\n ...inlineStyles,\n ...(width ? { width } : {}),\n }}\n >\n {children}\n </Column>\n );\n },\n});\n"],"mappings":";;;;;;;AAAA,MAAM,eAAe;AA4BrB,IAAM,iBAAN,MAAqB;CACnB,AAAQ,gBAAgB,WAAoC;AAC1D,SAAO,GAAG,eAAe,OAAO,UAAU;;CAG5C,SACE,WACA,SACA,SACM;EACN,MAAM,SAAS,SAAS,UAAU;EAClC,MAAM,oBAAoB,KAAK,gBAAgB,UAAU;EACzD,MAAM,QAAQ,IAAI,YAAY,mBAAmB;GAC/C,QAAQ;GACR,SAAS;GACT,YAAY;GACb,CAAC;AACF,SAAO,cAAc,MAAM;;CAG7B,GACE,WACA,SACA,SACyB;EACzB,MAAM,SAAS,SAAS,UAAU;EAClC,MAAM,oBAAoB,KAAK,gBAAgB,UAAU;EACzD,MAAM,kBAAkB,IAAI,iBAAiB;EAE7C,MAAM,kBAAkB,UAAiB;GACvC,MAAM,cAAc;GACpB,MAAM,SAAS,QAAQ,YAAY,OAAO;AAE1C,OAAI,kBAAkB,QACpB,QAAO,OAAO,UAAU;AACtB,YAAQ,MACN,oCAAoC,kBAAkB,IACtD;KAAE,OAAO,YAAY;KAAQ;KAAO,CACrC;KACD;;AAIN,SAAO,iBAAiB,mBAAmB,gBAAgB;GACzD,GAAG;GACH,QAAQ,gBAAgB;GACzB,CAAC;AAEF,SAAO,EACL,mBAAmB;AACjB,mBAAgB,OAAO;KAE1B;;;AAIL,MAAa,iBAAiB,IAAI,gBAAgB;;;;AClDlD,IAAa,YAAb,MAAa,kBAGH,KAAuB;CAI/B,YAAY,QAA2C;AACrD,QAAM,OAAO;;;;;;CAOf,OAAO,OACL,QACA;AAGA,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AI,MAAM,OAAO,IAAI,GAAG,KAAK;AACpC,SAAI,MAAM,KAAK,EAAE,CAAC,KAAK,SAAS,gBAC9B;KAGF,MAAM,cAAc,MAAM,MAAM,EAAE;KAClC,MAAM,YAAY,MAAM,IAAI,EAAE;KAC9B,MAAM,EAAE,MAAM,OAAO,MAAM;AAE3B,SAAI,SAAS,eAAe,OAAO,UACjC,QAAO;AAGT,YAAO,KAAK,SACV,MAAM,GAAG,aACP,cAAc,OAAO,MAAM,KAAK,aAAa,UAAU,CACxD,CACF;AACD,YAAO;;AAGT,WAAO;;GAEV;;CAGH,mBAAmB,EAAE,UAAU,MAAM,SAAS;EAC5C,MAAM,eAAe,cAAc,KAAK,OAAO,MAAM;EACrD,MAAM,QAAQ,KAAK,OAAO;AAC1B,SACE,oBAAC;GACC,WAAW,KAAK,OAAO,SAAS;GAChC,OAAO;IACL,GAAG;IACH,GAAG;IACH,GAAI,QAAQ,EAAE,OAAO,GAAG,EAAE;IAC3B;GAEA;IACM;;CAGd,CAAC"}
@@ -1,5 +1,5 @@
1
- const require_columns = require('../columns-ZSaLdkg9.cjs');
2
- const require_core = require('../core-DpfUR_iP.cjs');
1
+ const require_columns = require('../columns-BXN-NNd4.cjs');
2
+ const require_core = require('../core-B1NP2Drs.cjs');
3
3
 
4
4
  exports.EmailNode = require_columns.EmailNode;
5
5
  exports.composeReactEmail = require_core.composeReactEmail;
@@ -1,2 +1,2 @@
1
- import { a as composeReactEmail, c as EditorEventMap, d as editorEventBus, i as NodeRendererComponent, l as EditorEventName, n as EmailNode, o as isDocumentVisuallyEmpty, r as EmailNodeConfig, s as EditorEventHandler, t as useEditor, u as EditorEventSubscription } from "../index-BPjgJSQh.cjs";
1
+ import { a as composeReactEmail, c as EditorEventMap, d as editorEventBus, i as NodeRendererComponent, l as EditorEventName, n as EmailNode, o as isDocumentVisuallyEmpty, r as EmailNodeConfig, s as EditorEventHandler, t as useEditor, u as EditorEventSubscription } from "../index-jGyVEd5q.cjs";
2
2
  export { EditorEventHandler, EditorEventMap, EditorEventName, EditorEventSubscription, EmailNode, EmailNodeConfig, NodeRendererComponent, composeReactEmail, editorEventBus, isDocumentVisuallyEmpty, useEditor };
@@ -1,2 +1,2 @@
1
- import { a as composeReactEmail, c as EditorEventMap, d as editorEventBus, i as NodeRendererComponent, l as EditorEventName, n as EmailNode, o as isDocumentVisuallyEmpty, r as EmailNodeConfig, s as EditorEventHandler, t as useEditor, u as EditorEventSubscription } from "../index-4EvOA-Ll.mjs";
1
+ import { a as composeReactEmail, c as EditorEventMap, d as editorEventBus, i as NodeRendererComponent, l as EditorEventName, n as EmailNode, o as isDocumentVisuallyEmpty, r as EmailNodeConfig, s as EditorEventHandler, t as useEditor, u as EditorEventSubscription } from "../index-ozCcANmD.mjs";
2
2
  export { EditorEventHandler, EditorEventMap, EditorEventName, EditorEventSubscription, EmailNode, EmailNodeConfig, NodeRendererComponent, composeReactEmail, editorEventBus, isDocumentVisuallyEmpty, useEditor };
@@ -1,4 +1,4 @@
1
- import { _ as editorEventBus, m as EmailNode } from "../columns-CUxUEHje.mjs";
2
- import { B as isDocumentVisuallyEmpty, t as useEditor, z as composeReactEmail } from "../core-C0EkaM-K.mjs";
1
+ import { h as editorEventBus, m as EmailNode } from "../columns-Cos2lqfu.mjs";
2
+ import { L as composeReactEmail, R as isDocumentVisuallyEmpty, t as useEditor } from "../core-Dr1J3aZd.mjs";
3
3
 
4
4
  export { EmailNode, composeReactEmail, editorEventBus, isDocumentVisuallyEmpty, useEditor };