@react-email/editor 0.0.0-experimental.8 → 1.0.0-canary.51
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/columns-BItFgD76.mjs +273 -0
- package/dist/columns-BItFgD76.mjs.map +1 -0
- package/dist/columns-DqFvXgmK.cjs +394 -0
- package/dist/core/index.cjs +10 -0
- package/dist/core/index.d.cts +2 -0
- package/dist/core/index.d.mts +2 -0
- package/dist/core/index.mjs +4 -0
- package/dist/core-CbSTyrV4.mjs +151 -0
- package/dist/core-CbSTyrV4.mjs.map +1 -0
- package/dist/core-D7AzzMLI.cjs +167 -0
- package/dist/email-node-B-_g4X-S.mjs +254 -0
- package/dist/email-node-B-_g4X-S.mjs.map +1 -0
- package/dist/email-node-hLU5bGnX.cjs +288 -0
- package/dist/event-bus-CIJ___tH.cjs +65 -0
- package/dist/event-bus-CqrIUE24.mjs +55 -0
- package/dist/event-bus-CqrIUE24.mjs.map +1 -0
- package/dist/extension-BbjpP9mF.cjs +1625 -0
- package/dist/extension-C5qNDPZL.mjs +154 -0
- package/dist/extension-C5qNDPZL.mjs.map +1 -0
- package/dist/extension-Cs4Yq2gF.cjs +158 -0
- package/dist/extension-DlWknmE5.mjs +1495 -0
- package/dist/extension-DlWknmE5.mjs.map +1 -0
- package/dist/extensions/index.cjs +50 -0
- package/dist/extensions/index.d.cts +392 -0
- package/dist/extensions/index.d.cts.map +1 -0
- package/dist/extensions/index.d.mts +392 -0
- package/dist/extensions/index.d.mts.map +1 -0
- package/dist/extensions/index.mjs +4 -0
- package/dist/extensions-CHIQO3d-.mjs +1745 -0
- package/dist/extensions-CHIQO3d-.mjs.map +1 -0
- package/dist/extensions-DCrDvZ42.cjs +1981 -0
- package/dist/global-content-0-J-Te3N.mjs +77 -0
- package/dist/global-content-0-J-Te3N.mjs.map +1 -0
- package/dist/global-content-8M2KyrOL.cjs +87 -0
- package/dist/image-KwEYzhji.cjs +41 -0
- package/dist/image-Oc789YjV.mjs +37 -0
- package/dist/image-Oc789YjV.mjs.map +1 -0
- package/dist/index-CHAPu71g.d.cts +193 -0
- package/dist/index-CHAPu71g.d.cts.map +1 -0
- package/dist/index-D4UEWmJX.d.mts +193 -0
- package/dist/index-D4UEWmJX.d.mts.map +1 -0
- package/dist/index.cjs +216 -0
- package/dist/index.d.cts +38 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +33 -623
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +189 -2349
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/index.cjs +56 -0
- package/dist/plugins/index.d.cts +114 -0
- package/dist/plugins/index.d.cts.map +1 -0
- package/dist/plugins/index.d.mts +114 -0
- package/dist/plugins/index.d.mts.map +1 -0
- package/dist/plugins/index.mjs +34 -0
- package/dist/plugins/index.mjs.map +1 -0
- package/dist/root-CT5d4CKj.cjs +2798 -0
- package/dist/root-uvdshbyT.mjs +2295 -0
- package/dist/root-uvdshbyT.mjs.map +1 -0
- package/dist/set-text-alignment-BCRnE5So.mjs +19 -0
- package/dist/set-text-alignment-BCRnE5So.mjs.map +1 -0
- package/dist/set-text-alignment-Twg1EG4-.cjs +22 -0
- package/dist/style.css +974 -0
- package/dist/types-BG5XsXt9.d.mts +37 -0
- package/dist/types-BG5XsXt9.d.mts.map +1 -0
- package/dist/types-DnOcnDoO.d.mts +56 -0
- package/dist/types-DnOcnDoO.d.mts.map +1 -0
- package/dist/types-DzPTbbDC.d.cts +56 -0
- package/dist/types-DzPTbbDC.d.cts.map +1 -0
- package/dist/types-hURXpEIO.d.cts +37 -0
- package/dist/types-hURXpEIO.d.cts.map +1 -0
- package/dist/ui/bubble-menu/bubble-menu.css +291 -0
- package/dist/ui/index.cjs +2895 -0
- package/dist/ui/index.d.cts +1155 -0
- package/dist/ui/index.d.cts.map +1 -0
- package/dist/ui/index.d.mts +1157 -0
- package/dist/ui/index.d.mts.map +1 -0
- package/dist/ui/index.mjs +2784 -0
- package/dist/ui/index.mjs.map +1 -0
- package/dist/ui/inspector/inspector.css +293 -0
- package/dist/ui/slash-command/slash-command.css +44 -0
- package/dist/ui/themes/default.css +1140 -0
- package/dist/utils/index.cjs +3 -0
- package/dist/utils/index.d.cts +7 -0
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +7 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +2 -0
- package/package.json +100 -16
- package/readme.md +69 -0
- package/dist/index.d.ts +0 -628
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2461
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Node, mergeAttributes } from "@tiptap/core";
|
|
2
|
+
//#region src/extensions/global-content.ts
|
|
3
|
+
const GLOBAL_CONTENT_NODE_TYPE = "globalContent";
|
|
4
|
+
let cachedGlobalPosition = null;
|
|
5
|
+
function findGlobalContentPositions(doc) {
|
|
6
|
+
const positions = [];
|
|
7
|
+
doc.descendants((node, position) => {
|
|
8
|
+
if (node.type.name === GLOBAL_CONTENT_NODE_TYPE) positions.push(position);
|
|
9
|
+
});
|
|
10
|
+
return positions;
|
|
11
|
+
}
|
|
12
|
+
function getCachedGlobalContentPosition(doc) {
|
|
13
|
+
if (cachedGlobalPosition != null) try {
|
|
14
|
+
if (doc.nodeAt(cachedGlobalPosition)?.type.name === GLOBAL_CONTENT_NODE_TYPE) return cachedGlobalPosition;
|
|
15
|
+
} catch {
|
|
16
|
+
cachedGlobalPosition = null;
|
|
17
|
+
}
|
|
18
|
+
cachedGlobalPosition = findGlobalContentPositions(doc)[0] ?? null;
|
|
19
|
+
return cachedGlobalPosition;
|
|
20
|
+
}
|
|
21
|
+
function getGlobalContent(key, editor) {
|
|
22
|
+
const position = getCachedGlobalContentPosition(editor.state.doc);
|
|
23
|
+
if (cachedGlobalPosition == null) return null;
|
|
24
|
+
return editor.state.doc.nodeAt(position)?.attrs.data[key] ?? null;
|
|
25
|
+
}
|
|
26
|
+
const GlobalContent = Node.create({
|
|
27
|
+
name: GLOBAL_CONTENT_NODE_TYPE,
|
|
28
|
+
addOptions() {
|
|
29
|
+
return {
|
|
30
|
+
key: GLOBAL_CONTENT_NODE_TYPE,
|
|
31
|
+
data: {}
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
group: "block",
|
|
35
|
+
selectable: false,
|
|
36
|
+
draggable: false,
|
|
37
|
+
atom: true,
|
|
38
|
+
addAttributes() {
|
|
39
|
+
return { data: { default: this.options.data } };
|
|
40
|
+
},
|
|
41
|
+
parseHTML() {
|
|
42
|
+
return [{ tag: `div[data-type="${this.name}"]` }];
|
|
43
|
+
},
|
|
44
|
+
renderHTML({ HTMLAttributes }) {
|
|
45
|
+
return ["div", mergeAttributes(HTMLAttributes, {
|
|
46
|
+
"data-type": this.name,
|
|
47
|
+
style: "width: 100%; height: 1px; visibility: hidden; background-color: transparent;"
|
|
48
|
+
})];
|
|
49
|
+
},
|
|
50
|
+
addCommands() {
|
|
51
|
+
return { setGlobalContent: (key, value) => ({ tr, dispatch }) => {
|
|
52
|
+
const ensureGlobalPosition = () => {
|
|
53
|
+
const positions = findGlobalContentPositions(tr.doc);
|
|
54
|
+
for (let i = positions.length - 1; i > 0; i--) tr.delete(positions[i], positions[i] + 1);
|
|
55
|
+
const pos = positions[0] ?? -1;
|
|
56
|
+
if (pos >= 0) cachedGlobalPosition = pos;
|
|
57
|
+
else {
|
|
58
|
+
cachedGlobalPosition = 0;
|
|
59
|
+
tr.insert(0, this.type.create());
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
if (dispatch) {
|
|
63
|
+
ensureGlobalPosition();
|
|
64
|
+
if (cachedGlobalPosition == null) return false;
|
|
65
|
+
tr.setNodeAttribute(cachedGlobalPosition, "data", {
|
|
66
|
+
...tr.doc.nodeAt(cachedGlobalPosition)?.attrs.data,
|
|
67
|
+
[key]: value
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
} };
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
//#endregion
|
|
75
|
+
export { getGlobalContent as n, GlobalContent as t };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=global-content-0-J-Te3N.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-content-0-J-Te3N.mjs","names":[],"sources":["../src/extensions/global-content.ts"],"sourcesContent":["import { type Editor, mergeAttributes, Node } from '@tiptap/core';\n\nconst GLOBAL_CONTENT_NODE_TYPE = 'globalContent' as const;\n\nexport interface GlobalContentOptions {\n key: string;\n data: Record<string, unknown>;\n}\n\ndeclare module '@tiptap/core' {\n interface GlobalContent<ReturnType> {\n setGlobalContent: (key: string, value: unknown) => ReturnType;\n }\n\n interface Commands<ReturnType> {\n globalContent: GlobalContent<ReturnType>;\n }\n}\n\nlet cachedGlobalPosition: number | null = null;\n\nfunction findGlobalContentPositions(doc: Editor['state']['doc']) {\n const positions: number[] = [];\n\n doc.descendants((node, position) => {\n if (node.type.name === GLOBAL_CONTENT_NODE_TYPE) {\n positions.push(position);\n }\n });\n\n return positions;\n}\n\nfunction getCachedGlobalContentPosition(doc: Editor['state']['doc']) {\n if (cachedGlobalPosition != null) {\n try {\n if (\n doc.nodeAt(cachedGlobalPosition)?.type.name === GLOBAL_CONTENT_NODE_TYPE\n ) {\n return cachedGlobalPosition;\n }\n } catch {\n cachedGlobalPosition = null;\n }\n }\n\n const positions = findGlobalContentPositions(doc);\n cachedGlobalPosition = positions[0] ?? null;\n return cachedGlobalPosition;\n}\n\nexport function getGlobalContent(key: string, editor: Editor): unknown | null {\n const position = getCachedGlobalContentPosition(editor.state.doc);\n if (cachedGlobalPosition == null) {\n return null;\n }\n return editor.state.doc.nodeAt(position)?.attrs.data[key] ?? null;\n}\n\nexport const GlobalContent = Node.create<GlobalContentOptions>({\n name: GLOBAL_CONTENT_NODE_TYPE,\n\n addOptions() {\n return {\n key: GLOBAL_CONTENT_NODE_TYPE,\n data: {},\n };\n },\n\n group: 'block',\n\n selectable: false,\n draggable: false,\n atom: true,\n\n addAttributes() {\n return {\n data: {\n default: this.options.data,\n },\n };\n },\n\n parseHTML() {\n return [{ tag: `div[data-type=\"${this.name}\"]` }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, {\n 'data-type': this.name,\n // The node needs to have a width and height, so then\n // internal TipTap extension can find the first node position\n // and calculate the correct position of the document container\n style:\n 'width: 100%; height: 1px; visibility: hidden; background-color: transparent;',\n }),\n ];\n },\n\n addCommands() {\n return {\n setGlobalContent:\n (key: string, value: unknown) =>\n ({ tr, dispatch }) => {\n const ensureGlobalPosition = () => {\n const positions = findGlobalContentPositions(tr.doc);\n\n for (let i = positions.length - 1; i > 0; i--) {\n tr.delete(positions[i], positions[i] + 1);\n }\n\n const pos = positions[0] ?? -1;\n if (pos >= 0) {\n cachedGlobalPosition = pos;\n } else {\n cachedGlobalPosition = 0;\n tr.insert(0, this.type.create());\n }\n };\n\n if (dispatch) {\n ensureGlobalPosition();\n\n if (cachedGlobalPosition == null) {\n return false;\n }\n tr.setNodeAttribute(cachedGlobalPosition, 'data', {\n ...tr.doc.nodeAt(cachedGlobalPosition)?.attrs.data,\n [key]: value,\n });\n }\n\n return true;\n },\n };\n },\n});\n"],"mappings":";;AAEA,MAAM,2BAA2B;AAiBjC,IAAI,uBAAsC;AAE1C,SAAS,2BAA2B,KAA6B;CAC/D,MAAM,YAAsB,EAAE;AAE9B,KAAI,aAAa,MAAM,aAAa;AAClC,MAAI,KAAK,KAAK,SAAS,yBACrB,WAAU,KAAK,SAAS;GAE1B;AAEF,QAAO;;AAGT,SAAS,+BAA+B,KAA6B;AACnE,KAAI,wBAAwB,KAC1B,KAAI;AACF,MACE,IAAI,OAAO,qBAAqB,EAAE,KAAK,SAAS,yBAEhD,QAAO;SAEH;AACN,yBAAuB;;AAK3B,wBADkB,2BAA2B,IAAI,CAChB,MAAM;AACvC,QAAO;;AAGT,SAAgB,iBAAiB,KAAa,QAAgC;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ap/core");
|
|
3
|
+
//#region src/extensions/global-content.ts
|
|
4
|
+
const GLOBAL_CONTENT_NODE_TYPE = "globalContent";
|
|
5
|
+
let cachedGlobalPosition = null;
|
|
6
|
+
function findGlobalContentPositions(doc) {
|
|
7
|
+
const positions = [];
|
|
8
|
+
doc.descendants((node, position) => {
|
|
9
|
+
if (node.type.name === GLOBAL_CONTENT_NODE_TYPE) positions.push(position);
|
|
10
|
+
});
|
|
11
|
+
return positions;
|
|
12
|
+
}
|
|
13
|
+
function getCachedGlobalContentPosition(doc) {
|
|
14
|
+
if (cachedGlobalPosition != null) try {
|
|
15
|
+
if (doc.nodeAt(cachedGlobalPosition)?.type.name === GLOBAL_CONTENT_NODE_TYPE) return cachedGlobalPosition;
|
|
16
|
+
} catch {
|
|
17
|
+
cachedGlobalPosition = null;
|
|
18
|
+
}
|
|
19
|
+
cachedGlobalPosition = findGlobalContentPositions(doc)[0] ?? null;
|
|
20
|
+
return cachedGlobalPosition;
|
|
21
|
+
}
|
|
22
|
+
function getGlobalContent(key, editor) {
|
|
23
|
+
const position = getCachedGlobalContentPosition(editor.state.doc);
|
|
24
|
+
if (cachedGlobalPosition == null) return null;
|
|
25
|
+
return editor.state.doc.nodeAt(position)?.attrs.data[key] ?? null;
|
|
26
|
+
}
|
|
27
|
+
const GlobalContent = _tiptap_core.Node.create({
|
|
28
|
+
name: GLOBAL_CONTENT_NODE_TYPE,
|
|
29
|
+
addOptions() {
|
|
30
|
+
return {
|
|
31
|
+
key: GLOBAL_CONTENT_NODE_TYPE,
|
|
32
|
+
data: {}
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
group: "block",
|
|
36
|
+
selectable: false,
|
|
37
|
+
draggable: false,
|
|
38
|
+
atom: true,
|
|
39
|
+
addAttributes() {
|
|
40
|
+
return { data: { default: this.options.data } };
|
|
41
|
+
},
|
|
42
|
+
parseHTML() {
|
|
43
|
+
return [{ tag: `div[data-type="${this.name}"]` }];
|
|
44
|
+
},
|
|
45
|
+
renderHTML({ HTMLAttributes }) {
|
|
46
|
+
return ["div", (0, _tiptap_core.mergeAttributes)(HTMLAttributes, {
|
|
47
|
+
"data-type": this.name,
|
|
48
|
+
style: "width: 100%; height: 1px; visibility: hidden; background-color: transparent;"
|
|
49
|
+
})];
|
|
50
|
+
},
|
|
51
|
+
addCommands() {
|
|
52
|
+
return { setGlobalContent: (key, value) => ({ tr, dispatch }) => {
|
|
53
|
+
const ensureGlobalPosition = () => {
|
|
54
|
+
const positions = findGlobalContentPositions(tr.doc);
|
|
55
|
+
for (let i = positions.length - 1; i > 0; i--) tr.delete(positions[i], positions[i] + 1);
|
|
56
|
+
const pos = positions[0] ?? -1;
|
|
57
|
+
if (pos >= 0) cachedGlobalPosition = pos;
|
|
58
|
+
else {
|
|
59
|
+
cachedGlobalPosition = 0;
|
|
60
|
+
tr.insert(0, this.type.create());
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
if (dispatch) {
|
|
64
|
+
ensureGlobalPosition();
|
|
65
|
+
if (cachedGlobalPosition == null) return false;
|
|
66
|
+
tr.setNodeAttribute(cachedGlobalPosition, "data", {
|
|
67
|
+
...tr.doc.nodeAt(cachedGlobalPosition)?.attrs.data,
|
|
68
|
+
[key]: value
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
} };
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
//#endregion
|
|
76
|
+
Object.defineProperty(exports, "GlobalContent", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function() {
|
|
79
|
+
return GlobalContent;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "getGlobalContent", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function() {
|
|
85
|
+
return getGlobalContent;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require("./columns-DqFvXgmK.cjs");
|
|
2
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
3
|
+
//#region src/ui/icons/image.tsx
|
|
4
|
+
function ImageIcon({ size, width, height, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
width: size ?? width ?? 24,
|
|
8
|
+
height: size ?? height ?? 24,
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
fill: "none",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeWidth: 2,
|
|
13
|
+
strokeLinecap: "round",
|
|
14
|
+
strokeLinejoin: "round",
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
...props,
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
19
|
+
width: "18",
|
|
20
|
+
height: "18",
|
|
21
|
+
x: "3",
|
|
22
|
+
y: "3",
|
|
23
|
+
rx: "2",
|
|
24
|
+
ry: "2"
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
27
|
+
cx: "9",
|
|
28
|
+
cy: "9",
|
|
29
|
+
r: "2"
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
Object.defineProperty(exports, "ImageIcon", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function() {
|
|
39
|
+
return ImageIcon;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
//#region src/ui/icons/image.tsx
|
|
3
|
+
function ImageIcon({ size, width, height, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
5
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
+
width: size ?? width ?? 24,
|
|
7
|
+
height: size ?? height ?? 24,
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
fill: "none",
|
|
10
|
+
stroke: "currentColor",
|
|
11
|
+
strokeWidth: 2,
|
|
12
|
+
strokeLinecap: "round",
|
|
13
|
+
strokeLinejoin: "round",
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
...props,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx("rect", {
|
|
18
|
+
width: "18",
|
|
19
|
+
height: "18",
|
|
20
|
+
x: "3",
|
|
21
|
+
y: "3",
|
|
22
|
+
rx: "2",
|
|
23
|
+
ry: "2"
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ jsx("circle", {
|
|
26
|
+
cx: "9",
|
|
27
|
+
cy: "9",
|
|
28
|
+
r: "2"
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ jsx("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { ImageIcon as t };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=image-Oc789YjV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-Oc789YjV.mjs","names":[],"sources":["../src/ui/icons/image.tsx"],"sourcesContent":["import type { IconProps } from './types';\n\nexport function ImageIcon({ size, width, height, ...props }: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size ?? width ?? 24}\n height={size ?? height ?? 24}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n {...props}\n >\n <rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" ry=\"2\" />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" />\n </svg>\n );\n}\n"],"mappings":";;AAEA,SAAgB,UAAU,EAAE,MAAM,OAAO,QAAQ,GAAG,SAAoB;AACtE,QACE,qBAAC,OAAD;EACE,OAAM;EACN,OAAO,QAAQ,SAAS;EACxB,QAAQ,QAAQ,UAAU;EAC1B,SAAQ;EACR,MAAK;EACL,QAAO;EACP,aAAa;EACb,eAAc;EACd,gBAAe;EACf,eAAY;EACZ,GAAI;YAXN;GAaE,oBAAC,QAAD;IAAM,OAAM;IAAK,QAAO;IAAK,GAAE;IAAI,GAAE;IAAI,IAAG;IAAI,IAAG;IAAM,CAAA;GACzD,oBAAC,UAAD;IAAQ,IAAG;IAAI,IAAG;IAAI,GAAE;IAAM,CAAA;GAC9B,oBAAC,QAAD,EAAM,GAAE,6CAA8C,CAAA;GAClD"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { Attrs, Node } from "@tiptap/pm/model";
|
|
2
|
+
import { Editor, JSONContent, Mark, MarkConfig, MarkType, Node as Node$1, NodeConfig, NodeType } from "@tiptap/core";
|
|
3
|
+
|
|
4
|
+
//#region src/core/event-bus.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Base event map interface for the editor event bus.
|
|
7
|
+
*
|
|
8
|
+
* Components extend this via TypeScript module augmentation:
|
|
9
|
+
* ```ts
|
|
10
|
+
* declare module '@react-email/editor' {
|
|
11
|
+
* interface EditorEventMap {
|
|
12
|
+
* 'my-component:custom-event': { data: string };
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
interface EditorEventMap {
|
|
18
|
+
'bubble-menu:add-link': undefined;
|
|
19
|
+
'node-clicked': NodeClickedEvent$1;
|
|
20
|
+
}
|
|
21
|
+
type NodeClickedEvent$1 = {
|
|
22
|
+
nodeType: string;
|
|
23
|
+
nodeAttrs: Attrs;
|
|
24
|
+
nodePos: {
|
|
25
|
+
pos: number;
|
|
26
|
+
inside: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type EditorEventName = keyof EditorEventMap;
|
|
30
|
+
type EditorEventHandler<T extends EditorEventName> = (payload: EditorEventMap[T]) => void | Promise<void>;
|
|
31
|
+
interface EditorEventSubscription {
|
|
32
|
+
unsubscribe: () => void;
|
|
33
|
+
}
|
|
34
|
+
declare class EditorEventBus {
|
|
35
|
+
private prefixEventName;
|
|
36
|
+
dispatch<T extends EditorEventName>(eventName: T, payload: EditorEventMap[T], options?: {
|
|
37
|
+
target?: EventTarget;
|
|
38
|
+
}): void;
|
|
39
|
+
on<T extends EditorEventName>(eventName: T, handler: EditorEventHandler<T>, options?: AddEventListenerOptions & {
|
|
40
|
+
target?: EventTarget;
|
|
41
|
+
}): EditorEventSubscription;
|
|
42
|
+
}
|
|
43
|
+
declare const editorEventBus: EditorEventBus;
|
|
44
|
+
declare function useEditorEvent<T extends EditorEventName>(eventName: T, handler: EditorEventHandler<T>, options?: AddEventListenerOptions & {
|
|
45
|
+
target?: EventTarget;
|
|
46
|
+
}): void;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/core/is-document-visually-empty.d.ts
|
|
49
|
+
declare function isDocumentVisuallyEmpty(doc: Node): boolean;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/core/serializer/compose-react-email.d.ts
|
|
52
|
+
interface ComposeReactEmailResult {
|
|
53
|
+
html: string;
|
|
54
|
+
text: string;
|
|
55
|
+
}
|
|
56
|
+
declare const composeReactEmail: ({
|
|
57
|
+
editor,
|
|
58
|
+
preview
|
|
59
|
+
}: {
|
|
60
|
+
editor: Editor;
|
|
61
|
+
preview?: string;
|
|
62
|
+
}) => Promise<ComposeReactEmailResult>;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/core/serializer/email-mark.d.ts
|
|
65
|
+
type SerializedMark = NonNullable<JSONContent['marks']>[number];
|
|
66
|
+
type MarkRendererComponent = (props: {
|
|
67
|
+
mark: SerializedMark;
|
|
68
|
+
node: JSONContent;
|
|
69
|
+
style: React.CSSProperties;
|
|
70
|
+
children?: React.ReactNode;
|
|
71
|
+
extension: EmailMark<any, any>;
|
|
72
|
+
}) => React.ReactNode;
|
|
73
|
+
interface EmailMarkConfig<Options, Storage> extends MarkConfig<Options, Storage> {
|
|
74
|
+
renderToReactEmail: MarkRendererComponent;
|
|
75
|
+
}
|
|
76
|
+
type ConfigParameter$1<Options, Storage> = Partial<Omit<EmailMarkConfig<Options, Storage>, 'renderToReactEmail'>> & Pick<EmailMarkConfig<Options, Storage>, 'renderToReactEmail'> & ThisType<{
|
|
77
|
+
name: string;
|
|
78
|
+
options: Options;
|
|
79
|
+
storage: Storage;
|
|
80
|
+
editor: Editor;
|
|
81
|
+
type: MarkType;
|
|
82
|
+
parent: (...args: any[]) => any;
|
|
83
|
+
}>;
|
|
84
|
+
declare class EmailMark<Options = Record<string, never>, Storage = Record<string, never>> extends Mark<Options, Storage> {
|
|
85
|
+
config: EmailMarkConfig<Options, Storage>;
|
|
86
|
+
constructor(config: ConfigParameter$1<Options, Storage>);
|
|
87
|
+
/**
|
|
88
|
+
* Create a new Mark instance
|
|
89
|
+
* @param config - Mark configuration object or a function that returns a configuration object
|
|
90
|
+
*/
|
|
91
|
+
static create<O = Record<string, never>, S = Record<string, never>>(config: ConfigParameter$1<O, S> | (() => ConfigParameter$1<O, S>)): EmailMark<O, S>;
|
|
92
|
+
static from<O, S>(mark: Mark<O, S>, renderToReactEmail: MarkRendererComponent): EmailMark<O, S>;
|
|
93
|
+
configure(options?: Partial<Options>): EmailMark<Options, Storage>;
|
|
94
|
+
extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig extends MarkConfig<ExtendedOptions, ExtendedStorage> = EmailMarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: (() => Partial<ExtendedConfig>) | (Partial<ExtendedConfig> & ThisType<{
|
|
95
|
+
name: string;
|
|
96
|
+
options: ExtendedOptions;
|
|
97
|
+
storage: ExtendedStorage;
|
|
98
|
+
editor: Editor;
|
|
99
|
+
type: MarkType;
|
|
100
|
+
}>)): EmailMark<ExtendedOptions, ExtendedStorage>;
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/core/serializer/email-node.d.ts
|
|
104
|
+
type NodeRendererComponent = (props: {
|
|
105
|
+
node: JSONContent;
|
|
106
|
+
style: React.CSSProperties;
|
|
107
|
+
children?: React.ReactNode;
|
|
108
|
+
extension: EmailNode<any, any>;
|
|
109
|
+
}) => React.ReactNode;
|
|
110
|
+
interface EmailNodeConfig<Options, Storage> extends NodeConfig<Options, Storage> {
|
|
111
|
+
renderToReactEmail: NodeRendererComponent;
|
|
112
|
+
}
|
|
113
|
+
type ConfigParameter<Options, Storage> = Partial<Omit<EmailNodeConfig<Options, Storage>, 'renderToReactEmail'>> & Pick<EmailNodeConfig<Options, Storage>, 'renderToReactEmail'> & ThisType<{
|
|
114
|
+
name: string;
|
|
115
|
+
options: Options;
|
|
116
|
+
storage: Storage;
|
|
117
|
+
editor: Editor;
|
|
118
|
+
type: NodeType;
|
|
119
|
+
parent: (...args: any[]) => any;
|
|
120
|
+
}>;
|
|
121
|
+
declare class EmailNode<Options = Record<string, never>, Storage = Record<string, never>> extends Node$1<Options, Storage> {
|
|
122
|
+
config: EmailNodeConfig<Options, Storage>;
|
|
123
|
+
constructor(config: ConfigParameter<Options, Storage>);
|
|
124
|
+
/**
|
|
125
|
+
* Create a new Node instance
|
|
126
|
+
* @param config - Node configuration object or a function that returns a configuration object
|
|
127
|
+
*/
|
|
128
|
+
static create<O = Record<string, never>, S = Record<string, never>>(config: ConfigParameter<O, S> | (() => ConfigParameter<O, S>)): EmailNode<O, S>;
|
|
129
|
+
static from<O, S>(node: Node$1<O, S>, renderToReactEmail: NodeRendererComponent): EmailNode<O, S>;
|
|
130
|
+
configure(options?: Partial<Options>): EmailNode<Options, Storage>;
|
|
131
|
+
extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig extends NodeConfig<ExtendedOptions, ExtendedStorage> = EmailNodeConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: (() => Partial<ExtendedConfig>) | (Partial<ExtendedConfig> & ThisType<{
|
|
132
|
+
name: string;
|
|
133
|
+
options: ExtendedOptions;
|
|
134
|
+
storage: ExtendedStorage;
|
|
135
|
+
editor: Editor;
|
|
136
|
+
type: NodeType;
|
|
137
|
+
}>)): EmailNode<ExtendedOptions, ExtendedStorage>;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/core/types.d.ts
|
|
141
|
+
/**
|
|
142
|
+
* A single placeholder item with all metadata needed for rendering.
|
|
143
|
+
* Used by the event bus and placeholder plugin.
|
|
144
|
+
*/
|
|
145
|
+
interface PlaceholderItem {
|
|
146
|
+
/** Full placeholder string, e.g., '{{{contact.email}}}' */
|
|
147
|
+
id: string;
|
|
148
|
+
/** Display text shown in the dropdown, e.g., 'contact.email' */
|
|
149
|
+
displayKey: string;
|
|
150
|
+
/** Base key used for updates, e.g., 'contact' or the placeholder name */
|
|
151
|
+
placeholderKey: string;
|
|
152
|
+
/** Fallback value for the variable */
|
|
153
|
+
fallbackValue: string | null;
|
|
154
|
+
/** Category ID this variable belongs to */
|
|
155
|
+
category: string;
|
|
156
|
+
/** Placeholder type (string, number, boolean, object, list) - needed for loop item computation */
|
|
157
|
+
type?: string;
|
|
158
|
+
/** Override fallback warning for this specific item */
|
|
159
|
+
skipFallbackWarning?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Custom placeholder definition used in the placeholders plugin.
|
|
163
|
+
*/
|
|
164
|
+
type CustomPlaceholder = {
|
|
165
|
+
id: string;
|
|
166
|
+
key: string;
|
|
167
|
+
type: string;
|
|
168
|
+
fallback_value?: string | null;
|
|
169
|
+
};
|
|
170
|
+
declare module './event-bus' {
|
|
171
|
+
interface EditorEventMap {
|
|
172
|
+
'node-clicked': NodeClickedEvent;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Event handler function type.
|
|
177
|
+
*/
|
|
178
|
+
type EventHandler<T extends EditorEventName> = (payload: EditorEventMap[T]) => void | Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Subscription handle returned when subscribing to events.
|
|
181
|
+
*/
|
|
182
|
+
interface EventSubscription {
|
|
183
|
+
unsubscribe: () => void;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Options for dispatching events.
|
|
187
|
+
*/
|
|
188
|
+
interface DispatchOptions {
|
|
189
|
+
target?: EventTarget;
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
export { EditorEventName as _, PlaceholderItem as a, editorEventBus as b, NodeRendererComponent as c, MarkRendererComponent as d, SerializedMark as f, EditorEventMap as g, EditorEventHandler as h, EventSubscription as i, EmailMark as l, isDocumentVisuallyEmpty as m, DispatchOptions as n, EmailNode as o, composeReactEmail as p, EventHandler as r, EmailNodeConfig as s, CustomPlaceholder as t, EmailMarkConfig as u, EditorEventSubscription as v, useEditorEvent as x, NodeClickedEvent$1 as y };
|
|
193
|
+
//# sourceMappingURL=index-CHAPu71g.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CHAPu71g.d.cts","names":[],"sources":["../src/core/event-bus.ts","../src/core/is-document-visually-empty.ts","../src/core/serializer/compose-react-email.tsx","../src/core/serializer/email-mark.ts","../src/core/serializer/email-node.ts","../src/core/types.ts"],"mappings":";;;;;;;AAiBA;;;;;;;;;UAAiB,cAAA;EACf,sBAAA;EACA,cAAA,EAAgB,kBAAA;AAAA;AAAA,KAGN,kBAAA;EACV,QAAA;EACA,SAAA,EAAW,KAAA;EACX,OAAA;IAAW,GAAA;IAAa,MAAA;EAAA;AAAA;AAAA,KAGd,eAAA,SAAwB,cAAA;AAAA,KAExB,kBAAA,WAA6B,eAAA,KACvC,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AAA;IACA,OAAA,EAAS,eAAA;IACT,OAAA,EAAS,eAAA;IACT,MAAA,EAAQ,MAAA;IACR,IAAA,EAAM,QAAA;EAAA,MAEb,SAAA,CAAU,eAAA,EAAiB,eAAA;AAAA;;;;;;;UClFf,eAAA;ELQC;EKNhB,EAAA;ELMgC;EKJhC,UAAA;ELO0B;EKL1B,cAAA;ELOgB;EKLhB,aAAA;ELKA;EKHA,QAAA;ELIA;EKFA,IAAA;ELEwB;EKAxB,mBAAA;AAAA;ALGF;;;AAAA,KKGY,iBAAA;EACV,EAAA;EACA,GAAA;EACA,IAAA;EACA,cAAA;AAAA;AAAA;EAAA,UAIiB,cAAA;IACf,cAAA,EAAgB,gBAAA;EAAA;AAAA;;;;KAOR,YAAA,WAAuB,eAAA,KACjC,OAAA,EAAS,cAAA,CAAe,CAAA,aACd,OAAA;;;;UAKK,iBAAA;EACf,WAAA;AAAA;;;;UAMe,eAAA;EACf,MAAA,GAAS,WAAA;AAAA"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { Editor, JSONContent, Mark, MarkConfig, MarkType, Node, NodeConfig, NodeType } from "@tiptap/core";
|
|
2
|
+
import { Attrs, Node as Node$1 } from "@tiptap/pm/model";
|
|
3
|
+
|
|
4
|
+
//#region src/core/event-bus.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Base event map interface for the editor event bus.
|
|
7
|
+
*
|
|
8
|
+
* Components extend this via TypeScript module augmentation:
|
|
9
|
+
* ```ts
|
|
10
|
+
* declare module '@react-email/editor' {
|
|
11
|
+
* interface EditorEventMap {
|
|
12
|
+
* 'my-component:custom-event': { data: string };
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
interface EditorEventMap {
|
|
18
|
+
'bubble-menu:add-link': undefined;
|
|
19
|
+
'node-clicked': NodeClickedEvent$1;
|
|
20
|
+
}
|
|
21
|
+
type NodeClickedEvent$1 = {
|
|
22
|
+
nodeType: string;
|
|
23
|
+
nodeAttrs: Attrs;
|
|
24
|
+
nodePos: {
|
|
25
|
+
pos: number;
|
|
26
|
+
inside: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type EditorEventName = keyof EditorEventMap;
|
|
30
|
+
type EditorEventHandler<T extends EditorEventName> = (payload: EditorEventMap[T]) => void | Promise<void>;
|
|
31
|
+
interface EditorEventSubscription {
|
|
32
|
+
unsubscribe: () => void;
|
|
33
|
+
}
|
|
34
|
+
declare class EditorEventBus {
|
|
35
|
+
private prefixEventName;
|
|
36
|
+
dispatch<T extends EditorEventName>(eventName: T, payload: EditorEventMap[T], options?: {
|
|
37
|
+
target?: EventTarget;
|
|
38
|
+
}): void;
|
|
39
|
+
on<T extends EditorEventName>(eventName: T, handler: EditorEventHandler<T>, options?: AddEventListenerOptions & {
|
|
40
|
+
target?: EventTarget;
|
|
41
|
+
}): EditorEventSubscription;
|
|
42
|
+
}
|
|
43
|
+
declare const editorEventBus: EditorEventBus;
|
|
44
|
+
declare function useEditorEvent<T extends EditorEventName>(eventName: T, handler: EditorEventHandler<T>, options?: AddEventListenerOptions & {
|
|
45
|
+
target?: EventTarget;
|
|
46
|
+
}): void;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/core/is-document-visually-empty.d.ts
|
|
49
|
+
declare function isDocumentVisuallyEmpty(doc: Node$1): boolean;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/core/serializer/compose-react-email.d.ts
|
|
52
|
+
interface ComposeReactEmailResult {
|
|
53
|
+
html: string;
|
|
54
|
+
text: string;
|
|
55
|
+
}
|
|
56
|
+
declare const composeReactEmail: ({
|
|
57
|
+
editor,
|
|
58
|
+
preview
|
|
59
|
+
}: {
|
|
60
|
+
editor: Editor;
|
|
61
|
+
preview?: string;
|
|
62
|
+
}) => Promise<ComposeReactEmailResult>;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/core/serializer/email-mark.d.ts
|
|
65
|
+
type SerializedMark = NonNullable<JSONContent['marks']>[number];
|
|
66
|
+
type MarkRendererComponent = (props: {
|
|
67
|
+
mark: SerializedMark;
|
|
68
|
+
node: JSONContent;
|
|
69
|
+
style: React.CSSProperties;
|
|
70
|
+
children?: React.ReactNode;
|
|
71
|
+
extension: EmailMark<any, any>;
|
|
72
|
+
}) => React.ReactNode;
|
|
73
|
+
interface EmailMarkConfig<Options, Storage> extends MarkConfig<Options, Storage> {
|
|
74
|
+
renderToReactEmail: MarkRendererComponent;
|
|
75
|
+
}
|
|
76
|
+
type ConfigParameter$1<Options, Storage> = Partial<Omit<EmailMarkConfig<Options, Storage>, 'renderToReactEmail'>> & Pick<EmailMarkConfig<Options, Storage>, 'renderToReactEmail'> & ThisType<{
|
|
77
|
+
name: string;
|
|
78
|
+
options: Options;
|
|
79
|
+
storage: Storage;
|
|
80
|
+
editor: Editor;
|
|
81
|
+
type: MarkType;
|
|
82
|
+
parent: (...args: any[]) => any;
|
|
83
|
+
}>;
|
|
84
|
+
declare class EmailMark<Options = Record<string, never>, Storage = Record<string, never>> extends Mark<Options, Storage> {
|
|
85
|
+
config: EmailMarkConfig<Options, Storage>;
|
|
86
|
+
constructor(config: ConfigParameter$1<Options, Storage>);
|
|
87
|
+
/**
|
|
88
|
+
* Create a new Mark instance
|
|
89
|
+
* @param config - Mark configuration object or a function that returns a configuration object
|
|
90
|
+
*/
|
|
91
|
+
static create<O = Record<string, never>, S = Record<string, never>>(config: ConfigParameter$1<O, S> | (() => ConfigParameter$1<O, S>)): EmailMark<O, S>;
|
|
92
|
+
static from<O, S>(mark: Mark<O, S>, renderToReactEmail: MarkRendererComponent): EmailMark<O, S>;
|
|
93
|
+
configure(options?: Partial<Options>): EmailMark<Options, Storage>;
|
|
94
|
+
extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig extends MarkConfig<ExtendedOptions, ExtendedStorage> = EmailMarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: (() => Partial<ExtendedConfig>) | (Partial<ExtendedConfig> & ThisType<{
|
|
95
|
+
name: string;
|
|
96
|
+
options: ExtendedOptions;
|
|
97
|
+
storage: ExtendedStorage;
|
|
98
|
+
editor: Editor;
|
|
99
|
+
type: MarkType;
|
|
100
|
+
}>)): EmailMark<ExtendedOptions, ExtendedStorage>;
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/core/serializer/email-node.d.ts
|
|
104
|
+
type NodeRendererComponent = (props: {
|
|
105
|
+
node: JSONContent;
|
|
106
|
+
style: React.CSSProperties;
|
|
107
|
+
children?: React.ReactNode;
|
|
108
|
+
extension: EmailNode<any, any>;
|
|
109
|
+
}) => React.ReactNode;
|
|
110
|
+
interface EmailNodeConfig<Options, Storage> extends NodeConfig<Options, Storage> {
|
|
111
|
+
renderToReactEmail: NodeRendererComponent;
|
|
112
|
+
}
|
|
113
|
+
type ConfigParameter<Options, Storage> = Partial<Omit<EmailNodeConfig<Options, Storage>, 'renderToReactEmail'>> & Pick<EmailNodeConfig<Options, Storage>, 'renderToReactEmail'> & ThisType<{
|
|
114
|
+
name: string;
|
|
115
|
+
options: Options;
|
|
116
|
+
storage: Storage;
|
|
117
|
+
editor: Editor;
|
|
118
|
+
type: NodeType;
|
|
119
|
+
parent: (...args: any[]) => any;
|
|
120
|
+
}>;
|
|
121
|
+
declare class EmailNode<Options = Record<string, never>, Storage = Record<string, never>> extends Node<Options, Storage> {
|
|
122
|
+
config: EmailNodeConfig<Options, Storage>;
|
|
123
|
+
constructor(config: ConfigParameter<Options, Storage>);
|
|
124
|
+
/**
|
|
125
|
+
* Create a new Node instance
|
|
126
|
+
* @param config - Node configuration object or a function that returns a configuration object
|
|
127
|
+
*/
|
|
128
|
+
static create<O = Record<string, never>, S = Record<string, never>>(config: ConfigParameter<O, S> | (() => ConfigParameter<O, S>)): EmailNode<O, S>;
|
|
129
|
+
static from<O, S>(node: Node<O, S>, renderToReactEmail: NodeRendererComponent): EmailNode<O, S>;
|
|
130
|
+
configure(options?: Partial<Options>): EmailNode<Options, Storage>;
|
|
131
|
+
extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig extends NodeConfig<ExtendedOptions, ExtendedStorage> = EmailNodeConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: (() => Partial<ExtendedConfig>) | (Partial<ExtendedConfig> & ThisType<{
|
|
132
|
+
name: string;
|
|
133
|
+
options: ExtendedOptions;
|
|
134
|
+
storage: ExtendedStorage;
|
|
135
|
+
editor: Editor;
|
|
136
|
+
type: NodeType;
|
|
137
|
+
}>)): EmailNode<ExtendedOptions, ExtendedStorage>;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/core/types.d.ts
|
|
141
|
+
/**
|
|
142
|
+
* A single placeholder item with all metadata needed for rendering.
|
|
143
|
+
* Used by the event bus and placeholder plugin.
|
|
144
|
+
*/
|
|
145
|
+
interface PlaceholderItem {
|
|
146
|
+
/** Full placeholder string, e.g., '{{{contact.email}}}' */
|
|
147
|
+
id: string;
|
|
148
|
+
/** Display text shown in the dropdown, e.g., 'contact.email' */
|
|
149
|
+
displayKey: string;
|
|
150
|
+
/** Base key used for updates, e.g., 'contact' or the placeholder name */
|
|
151
|
+
placeholderKey: string;
|
|
152
|
+
/** Fallback value for the variable */
|
|
153
|
+
fallbackValue: string | null;
|
|
154
|
+
/** Category ID this variable belongs to */
|
|
155
|
+
category: string;
|
|
156
|
+
/** Placeholder type (string, number, boolean, object, list) - needed for loop item computation */
|
|
157
|
+
type?: string;
|
|
158
|
+
/** Override fallback warning for this specific item */
|
|
159
|
+
skipFallbackWarning?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Custom placeholder definition used in the placeholders plugin.
|
|
163
|
+
*/
|
|
164
|
+
type CustomPlaceholder = {
|
|
165
|
+
id: string;
|
|
166
|
+
key: string;
|
|
167
|
+
type: string;
|
|
168
|
+
fallback_value?: string | null;
|
|
169
|
+
};
|
|
170
|
+
declare module './event-bus' {
|
|
171
|
+
interface EditorEventMap {
|
|
172
|
+
'node-clicked': NodeClickedEvent;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Event handler function type.
|
|
177
|
+
*/
|
|
178
|
+
type EventHandler<T extends EditorEventName> = (payload: EditorEventMap[T]) => void | Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Subscription handle returned when subscribing to events.
|
|
181
|
+
*/
|
|
182
|
+
interface EventSubscription {
|
|
183
|
+
unsubscribe: () => void;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Options for dispatching events.
|
|
187
|
+
*/
|
|
188
|
+
interface DispatchOptions {
|
|
189
|
+
target?: EventTarget;
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
export { EditorEventName as _, PlaceholderItem as a, editorEventBus as b, NodeRendererComponent as c, MarkRendererComponent as d, SerializedMark as f, EditorEventMap as g, EditorEventHandler as h, EventSubscription as i, EmailMark as l, isDocumentVisuallyEmpty as m, DispatchOptions as n, EmailNode as o, composeReactEmail as p, EventHandler as r, EmailNodeConfig as s, CustomPlaceholder as t, EmailMarkConfig as u, EditorEventSubscription as v, useEditorEvent as x, NodeClickedEvent$1 as y };
|
|
193
|
+
//# sourceMappingURL=index-D4UEWmJX.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D4UEWmJX.d.mts","names":[],"sources":["../src/core/event-bus.ts","../src/core/is-document-visually-empty.ts","../src/core/serializer/compose-react-email.tsx","../src/core/serializer/email-mark.ts","../src/core/serializer/email-node.ts","../src/core/types.ts"],"mappings":";;;;;;;AAiBA;;;;;;;;;UAAiB,cAAA;EACf,sBAAA;EACA,cAAA,EAAgB,kBAAA;AAAA;AAAA,KAGN,kBAAA;EACV,QAAA;EACA,SAAA,EAAW,KAAA;EACX,OAAA;IAAW,GAAA;IAAa,MAAA;EAAA;AAAA;AAAA,KAGd,eAAA,SAAwB,cAAA;AAAA,KAExB,kBAAA,WAA6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