@daisychainapp/maily-to-core 0.1.3 → 0.2.8
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/blocks/index.cjs +305 -0
- package/dist/blocks/index.cjs.map +1 -0
- package/dist/blocks/index.d.cts +59 -0
- package/dist/blocks/index.d.ts +3 -1
- package/dist/blocks/index.mjs +40 -26
- package/dist/blocks/index.mjs.map +1 -1
- package/dist/extensions/index.cjs +6079 -0
- package/dist/extensions/index.cjs.map +1 -0
- package/dist/extensions/index.d.cts +425 -0
- package/dist/extensions/index.d.ts +237 -144
- package/dist/extensions/index.mjs +3912 -3105
- package/dist/extensions/index.mjs.map +1 -1
- package/dist/index.cjs +9057 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +2358 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +61 -0
- package/dist/index.d.ts +1 -22
- package/dist/index.mjs +5575 -4864
- package/dist/index.mjs.map +1 -1
- package/package.json +128 -50
- package/readme.md +91 -33
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daisychainapp/maily-to-core",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.2.8",
|
|
4
5
|
"description": "Powerful editor for creating beautiful, pre-designed, mobile-ready emails.",
|
|
5
6
|
"private": false,
|
|
6
|
-
"main": "./dist/index.
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
7
8
|
"module": "./dist/index.mjs",
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
9
10
|
"files": [
|
|
@@ -12,20 +13,102 @@
|
|
|
12
13
|
"exports": {
|
|
13
14
|
"./package.json": "./package.json",
|
|
14
15
|
".": {
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
"node": {
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"require": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.cjs"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"browser": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.mjs"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.cjs"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"default": {
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"default": "./dist/index.mjs"
|
|
40
|
+
},
|
|
41
|
+
"require": {
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"default": "./dist/index.cjs"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
18
46
|
},
|
|
19
47
|
"./blocks": {
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
48
|
+
"node": {
|
|
49
|
+
"import": {
|
|
50
|
+
"types": "./dist/blocks/index.d.ts",
|
|
51
|
+
"default": "./dist/blocks/index.mjs"
|
|
52
|
+
},
|
|
53
|
+
"require": {
|
|
54
|
+
"types": "./dist/blocks/index.d.ts",
|
|
55
|
+
"default": "./dist/blocks/index.cjs"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"browser": {
|
|
59
|
+
"import": {
|
|
60
|
+
"types": "./dist/blocks/index.d.ts",
|
|
61
|
+
"default": "./dist/blocks/index.mjs"
|
|
62
|
+
},
|
|
63
|
+
"require": {
|
|
64
|
+
"types": "./dist/blocks/index.d.ts",
|
|
65
|
+
"default": "./dist/blocks/index.cjs"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"default": {
|
|
69
|
+
"import": {
|
|
70
|
+
"types": "./dist/blocks/index.d.ts",
|
|
71
|
+
"default": "./dist/blocks/index.mjs"
|
|
72
|
+
},
|
|
73
|
+
"require": {
|
|
74
|
+
"types": "./dist/blocks/index.d.ts",
|
|
75
|
+
"default": "./dist/blocks/index.cjs"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
23
78
|
},
|
|
24
79
|
"./extensions": {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
80
|
+
"node": {
|
|
81
|
+
"import": {
|
|
82
|
+
"types": "./dist/extensions/index.d.ts",
|
|
83
|
+
"default": "./dist/extensions/index.mjs"
|
|
84
|
+
},
|
|
85
|
+
"require": {
|
|
86
|
+
"types": "./dist/extensions/index.d.ts",
|
|
87
|
+
"default": "./dist/extensions/index.cjs"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"browser": {
|
|
91
|
+
"import": {
|
|
92
|
+
"types": "./dist/extensions/index.d.ts",
|
|
93
|
+
"default": "./dist/extensions/index.mjs"
|
|
94
|
+
},
|
|
95
|
+
"require": {
|
|
96
|
+
"types": "./dist/extensions/index.d.ts",
|
|
97
|
+
"default": "./dist/extensions/index.cjs"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"default": {
|
|
101
|
+
"import": {
|
|
102
|
+
"types": "./dist/extensions/index.d.ts",
|
|
103
|
+
"default": "./dist/extensions/index.mjs"
|
|
104
|
+
},
|
|
105
|
+
"require": {
|
|
106
|
+
"types": "./dist/extensions/index.d.ts",
|
|
107
|
+
"default": "./dist/extensions/index.cjs"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"./style.css": "./dist/index.css"
|
|
29
112
|
},
|
|
30
113
|
"typesVersions": {
|
|
31
114
|
"*": {
|
|
@@ -63,60 +146,55 @@
|
|
|
63
146
|
"node": ">=18.0.0"
|
|
64
147
|
},
|
|
65
148
|
"dependencies": {
|
|
66
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
67
|
-
"@radix-ui/react-popover": "^1.1.
|
|
68
|
-
"@radix-ui/react-slot": "^1.1.
|
|
69
|
-
"@radix-ui/react-tooltip": "^1.1.
|
|
70
|
-
"@tiptap/core": "^2.
|
|
149
|
+
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
|
150
|
+
"@radix-ui/react-popover": "^1.1.6",
|
|
151
|
+
"@radix-ui/react-slot": "^1.1.2",
|
|
152
|
+
"@radix-ui/react-tooltip": "^1.1.8",
|
|
153
|
+
"@tiptap/core": "^2.11.5",
|
|
71
154
|
"@tiptap/extension-code-block-lowlight": "^2.11.5",
|
|
72
|
-
"@tiptap/extension-color": "^2.
|
|
73
|
-
"@tiptap/extension-document": "^2.
|
|
74
|
-
"@tiptap/extension-dropcursor": "^2.
|
|
75
|
-
"@tiptap/extension-focus": "^2.
|
|
76
|
-
"@tiptap/extension-heading": "^2.
|
|
77
|
-
"@tiptap/extension-horizontal-rule": "^2.
|
|
78
|
-
"@tiptap/extension-image": "^2.
|
|
79
|
-
"@tiptap/extension-link": "^2.
|
|
80
|
-
"@tiptap/extension-list-item": "^2.
|
|
81
|
-
"@tiptap/extension-mention": "^2.
|
|
82
|
-
"@tiptap/extension-paragraph": "^2.
|
|
83
|
-
"@tiptap/extension-placeholder": "^2.
|
|
84
|
-
"@tiptap/extension-text-align": "^2.
|
|
85
|
-
"@tiptap/extension-text-style": "^2.
|
|
86
|
-
"@tiptap/extension-underline": "^2.
|
|
87
|
-
"@tiptap/pm": "^2.
|
|
88
|
-
"@tiptap/react": "^2.
|
|
89
|
-
"@tiptap/starter-kit": "^2.
|
|
90
|
-
"@tiptap/suggestion": "^2.
|
|
155
|
+
"@tiptap/extension-color": "^2.11.5",
|
|
156
|
+
"@tiptap/extension-document": "^2.11.5",
|
|
157
|
+
"@tiptap/extension-dropcursor": "^2.11.5",
|
|
158
|
+
"@tiptap/extension-focus": "^2.11.5",
|
|
159
|
+
"@tiptap/extension-heading": "^2.11.5",
|
|
160
|
+
"@tiptap/extension-horizontal-rule": "^2.11.5",
|
|
161
|
+
"@tiptap/extension-image": "^2.11.5",
|
|
162
|
+
"@tiptap/extension-link": "^2.11.5",
|
|
163
|
+
"@tiptap/extension-list-item": "^2.11.5",
|
|
164
|
+
"@tiptap/extension-mention": "^2.11.5",
|
|
165
|
+
"@tiptap/extension-paragraph": "^2.11.5",
|
|
166
|
+
"@tiptap/extension-placeholder": "^2.11.5",
|
|
167
|
+
"@tiptap/extension-text-align": "^2.11.5",
|
|
168
|
+
"@tiptap/extension-text-style": "^2.11.5",
|
|
169
|
+
"@tiptap/extension-underline": "^2.11.5",
|
|
170
|
+
"@tiptap/pm": "^2.11.5",
|
|
171
|
+
"@tiptap/react": "^2.11.5",
|
|
172
|
+
"@tiptap/starter-kit": "^2.11.5",
|
|
173
|
+
"@tiptap/suggestion": "^2.11.5",
|
|
91
174
|
"clsx": "^2.1.1",
|
|
92
175
|
"fast-deep-equal": "^3.1.3",
|
|
93
176
|
"highlight.js": "^11.11.1",
|
|
94
177
|
"lowlight": "^3.3.0",
|
|
95
|
-
"lucide-react": "^0.
|
|
178
|
+
"lucide-react": "^0.483.0",
|
|
96
179
|
"react-colorful": "^5.6.1",
|
|
97
180
|
"tailwind-merge": "^2.5.4",
|
|
98
181
|
"tailwindcss": "^3.4.14",
|
|
99
182
|
"tippy.js": "^6.3.7",
|
|
100
|
-
"uuid": "^
|
|
101
|
-
"y-prosemirror": "^1.
|
|
183
|
+
"uuid": "^11.1.0",
|
|
184
|
+
"y-prosemirror": "^1.3.0"
|
|
102
185
|
},
|
|
103
186
|
"devDependencies": {
|
|
104
|
-
"@types/react": "^18.3.
|
|
105
|
-
"
|
|
106
|
-
"postcss": "^
|
|
187
|
+
"@types/react": "^18.3.18",
|
|
188
|
+
"postcss": "^8.5.3",
|
|
189
|
+
"postcss-replace": "^2.0.1",
|
|
107
190
|
"tailwind-config": "workspace:*",
|
|
108
191
|
"tsconfig": "workspace:*",
|
|
109
|
-
"typescript": "^5.
|
|
192
|
+
"typescript": "^5.8.2"
|
|
110
193
|
},
|
|
111
194
|
"peerDependencies": {
|
|
112
|
-
"react": "^18
|
|
195
|
+
"react": "^18 || ^19"
|
|
113
196
|
},
|
|
114
197
|
"publishConfig": {
|
|
115
198
|
"access": "public"
|
|
116
|
-
}
|
|
117
|
-
"license": "ISC",
|
|
118
|
-
"bugs": {
|
|
119
|
-
"url": "https://github.com/arikchakma/maily.to/issues"
|
|
120
|
-
},
|
|
121
|
-
"homepage": "https://github.com/arikchakma/maily.to#readme"
|
|
199
|
+
}
|
|
122
200
|
}
|
package/readme.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<a href="https://github.com/arikchakma/maily.to/blob/main/license">
|
|
5
|
-
<img src="https://img.shields.io/badge/License-MIT-
|
|
5
|
+
<img src="https://img.shields.io/badge/License-MIT-222222.svg" />
|
|
6
6
|
</a>
|
|
7
7
|
<a href="https://maily.to">
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
<img src="https://img.shields.io/badge/%E2%9C%A8-Get%20Editor-0a0a0a.svg?style=flat&colorA=0a0a0a" alt="Get Maily Editor" />
|
|
9
|
+
</a>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
> Currently, this package is under development. You can follow the progress [here](https://github.com/arikchakma/maily.to).
|
|
@@ -23,6 +23,8 @@ pnpm add -D @tiptap/core
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
|
+
import '@maily-to/core/style.css';
|
|
27
|
+
|
|
26
28
|
import { useState } from 'react';
|
|
27
29
|
import { Editor } from '@maily-to/core';
|
|
28
30
|
import type { Editor as TiptapEditor, JSONContent } from '@tiptap/core';
|
|
@@ -149,13 +151,17 @@ You can pass variables to the editor in two ways:
|
|
|
149
151
|
|
|
150
152
|
```tsx
|
|
151
153
|
// (Omitted repeated imports)
|
|
154
|
+
import { VariableExtension, getVariableSuggestions } from '@maily-to/core/extensions';
|
|
155
|
+
|
|
152
156
|
<Editor
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
extensions={[
|
|
158
|
+
VariableExtension.configure({
|
|
159
|
+
suggestions: getVariableSuggestions('@'),
|
|
160
|
+
variables: [{
|
|
161
|
+
name: 'currentTime',
|
|
162
|
+
required: false,
|
|
163
|
+
}],
|
|
164
|
+
}),
|
|
159
165
|
]}
|
|
160
166
|
/>
|
|
161
167
|
```
|
|
@@ -166,26 +172,32 @@ You can pass variables to the editor in two ways:
|
|
|
166
172
|
|
|
167
173
|
```tsx
|
|
168
174
|
// (Omitted repeated imports)
|
|
175
|
+
import { VariableExtension, getVariableSuggestions } from '@maily-to/core/extensions';
|
|
176
|
+
|
|
169
177
|
<Editor
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
178
|
+
extensions={[
|
|
179
|
+
VariableExtension.configure({
|
|
180
|
+
suggestions: getVariableSuggestions('@'),
|
|
181
|
+
variables: ({ query, from, editor }) => {
|
|
182
|
+
// magic goes here
|
|
183
|
+
// query: the text after the trigger character
|
|
184
|
+
// from: the context from where the variables are requested (repeat, variable)
|
|
185
|
+
// editor: the editor instance
|
|
186
|
+
if (from === 'repeat-variable') {
|
|
187
|
+
// return variables for the Repeat block `each` key
|
|
188
|
+
return [
|
|
189
|
+
{ name: 'notifications' },
|
|
190
|
+
{ name: 'comments' },
|
|
191
|
+
];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return [
|
|
195
|
+
{ name: 'currentDate' },
|
|
196
|
+
{ name: 'currentTime', required: false },
|
|
197
|
+
];
|
|
198
|
+
},
|
|
199
|
+
}),
|
|
200
|
+
]}
|
|
189
201
|
/>
|
|
190
202
|
```
|
|
191
203
|
|
|
@@ -217,11 +229,7 @@ import { MailyKit, VariableExtension, getVariableSuggestions } from '@maily-to/c
|
|
|
217
229
|
});
|
|
218
230
|
},
|
|
219
231
|
}).configure({
|
|
220
|
-
suggestions: getVariableSuggestions(
|
|
221
|
-
variables,
|
|
222
|
-
variableTriggerCharacter,
|
|
223
|
-
variableListComponent, // optional custom component for variable list
|
|
224
|
-
),
|
|
232
|
+
suggestions: getVariableSuggestions(variableTriggerCharacter),
|
|
225
233
|
}),
|
|
226
234
|
]}
|
|
227
235
|
/>
|
|
@@ -242,8 +250,58 @@ import { CustomExtension } from './extensions/custom-extension';
|
|
|
242
250
|
/>
|
|
243
251
|
```
|
|
244
252
|
|
|
253
|
+
### Image Upload
|
|
254
|
+
|
|
255
|
+
To enable image upload, you need to pass the `ImageUploadExtension` extension to the editor. The `onImageUpload` function will be called when an image is being uploaded. You can use this function to upload the image to your server and return the URL.
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
// (Omitted repeated imports)
|
|
259
|
+
import { ImageUploadExtension } from '@maily-to/core/extensions';
|
|
260
|
+
|
|
261
|
+
<Editor
|
|
262
|
+
extensions={[
|
|
263
|
+
ImageUploadExtension.configure({
|
|
264
|
+
onImageUpload: async (file) => {
|
|
265
|
+
// upload the image to wherever you want
|
|
266
|
+
const url = await uploadImage(file);
|
|
267
|
+
return url;
|
|
268
|
+
},
|
|
269
|
+
}),
|
|
270
|
+
]}
|
|
271
|
+
/>
|
|
272
|
+
```
|
|
273
|
+
|
|
245
274
|
See the [@maily-to/render](../render) package for more information on how to render the editor content to HTML.
|
|
246
275
|
|
|
276
|
+
<br/>
|
|
277
|
+
|
|
278
|
+
## Sponsors
|
|
279
|
+
|
|
280
|
+
Sponsorship at any level is appreciated and encouraged. If you built a paid product using Maily, consider one of the [sponsorship tiers](https://github.com/sponsors/arikchakma).
|
|
281
|
+
|
|
282
|
+
<br/>
|
|
283
|
+
|
|
284
|
+
<h3 align="center">Gold</h3>
|
|
285
|
+
|
|
286
|
+
<table align="center" style="justify-content: center;align-items: center;display: flex;">
|
|
287
|
+
<tr>
|
|
288
|
+
<td align="center">
|
|
289
|
+
<p></p>
|
|
290
|
+
<p></p>
|
|
291
|
+
<a href="https://novu.co?ref=maily.to">
|
|
292
|
+
<picture height="60px">
|
|
293
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/5e2b9ef1-5ded-4863-995d-62c7e40f946a">
|
|
294
|
+
<img alt="Novu Logo" height="60px" src="https://github.com/user-attachments/assets/d2fdaf14-2211-4946-ab67-a4ce547aabc0">
|
|
295
|
+
</picture>
|
|
296
|
+
</a>
|
|
297
|
+
<p></p>
|
|
298
|
+
<p></p>
|
|
299
|
+
</td>
|
|
300
|
+
</tr>
|
|
301
|
+
</table>
|
|
302
|
+
|
|
303
|
+
<br/>
|
|
304
|
+
|
|
247
305
|
## License
|
|
248
306
|
|
|
249
307
|
MIT © [Arik Chakma](https://twitter.com/imarikchakma)
|