@maily-to/core 0.0.15 → 0.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maily-to/core",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "Powerful editor for creating beautiful, pre-designed, mobile-ready emails.",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",
@@ -10,15 +10,26 @@
10
10
  "dist/**"
11
11
  ],
12
12
  "exports": {
13
+ "./package.json": "./package.json",
13
14
  ".": {
14
- "import": {
15
- "types": "./dist/index.d.ts",
16
- "default": "./dist/index.mjs"
17
- },
18
- "require": {
19
- "types": "./dist/index.d.ts",
20
- "default": "./dist/index.js"
21
- }
15
+ "browser": "./dist/index.mjs",
16
+ "import": "./dist/index.mjs",
17
+ "require": "./dist/index.js"
18
+ },
19
+ "./blocks": {
20
+ "browser": "./dist/blocks/index.mjs",
21
+ "import": "./dist/blocks/index.mjs",
22
+ "require": "./dist/blocks/index.js"
23
+ }
24
+ },
25
+ "typesVersions": {
26
+ "*": {
27
+ "*": [
28
+ "dist/index.d.ts"
29
+ ],
30
+ "blocks": [
31
+ "dist/blocks/index.d.ts"
32
+ ]
22
33
  }
23
34
  },
24
35
  "scripts": {
@@ -44,43 +55,47 @@
44
55
  "node": ">=18.0.0"
45
56
  },
46
57
  "dependencies": {
47
- "@radix-ui/react-popover": "^1.1.1",
58
+ "@radix-ui/react-dropdown-menu": "^2.1.2",
59
+ "@radix-ui/react-popover": "^1.1.2",
48
60
  "@radix-ui/react-slot": "^1.1.0",
49
- "@tiptap/core": "^2.6.6",
50
- "@tiptap/extension-color": "^2.6.6",
51
- "@tiptap/extension-document": "^2.6.6",
52
- "@tiptap/extension-focus": "^2.6.6",
53
- "@tiptap/extension-heading": "^2.6.6",
54
- "@tiptap/extension-horizontal-rule": "^2.6.6",
55
- "@tiptap/extension-image": "^2.6.6",
56
- "@tiptap/extension-link": "^2.6.6",
57
- "@tiptap/extension-list-item": "^2.6.6",
58
- "@tiptap/extension-mention": "^2.6.6",
59
- "@tiptap/extension-paragraph": "^2.6.6",
60
- "@tiptap/extension-placeholder": "^2.6.6",
61
- "@tiptap/extension-text-align": "^2.6.6",
62
- "@tiptap/extension-text-style": "^2.6.6",
63
- "@tiptap/extension-underline": "^2.6.6",
64
- "@tiptap/pm": "^2.6.6",
65
- "@tiptap/react": "^2.6.6",
66
- "@tiptap/starter-kit": "^2.6.6",
67
- "@tiptap/suggestion": "^2.6.6",
61
+ "@radix-ui/react-tooltip": "^1.1.3",
62
+ "@tiptap/core": "^2.9.1",
63
+ "@tiptap/extension-color": "^2.9.1",
64
+ "@tiptap/extension-document": "^2.9.1",
65
+ "@tiptap/extension-dropcursor": "^2.9.1",
66
+ "@tiptap/extension-focus": "^2.9.1",
67
+ "@tiptap/extension-heading": "^2.9.1",
68
+ "@tiptap/extension-horizontal-rule": "^2.9.1",
69
+ "@tiptap/extension-image": "^2.9.1",
70
+ "@tiptap/extension-link": "^2.9.1",
71
+ "@tiptap/extension-list-item": "^2.9.1",
72
+ "@tiptap/extension-mention": "^2.9.1",
73
+ "@tiptap/extension-paragraph": "^2.9.1",
74
+ "@tiptap/extension-placeholder": "^2.9.1",
75
+ "@tiptap/extension-text-align": "^2.9.1",
76
+ "@tiptap/extension-text-style": "^2.9.1",
77
+ "@tiptap/extension-underline": "^2.9.1",
78
+ "@tiptap/pm": "^2.9.1",
79
+ "@tiptap/react": "^2.9.1",
80
+ "@tiptap/starter-kit": "^2.9.1",
81
+ "@tiptap/suggestion": "^2.9.1",
68
82
  "clsx": "^2.1.1",
83
+ "echo-drag-handle-plugin": "^0.0.2",
69
84
  "fast-deep-equal": "^3.1.3",
70
- "lucide-react": "^0.439.0",
85
+ "lucide-react": "^0.453.0",
71
86
  "react-colorful": "^5.6.1",
72
- "tailwind-merge": "^2.5.2",
73
- "tailwindcss": "^3.4.10",
87
+ "tailwind-merge": "^2.5.4",
88
+ "tailwindcss": "^3.4.14",
74
89
  "tippy.js": "^6.3.7",
75
90
  "uuid": "^10.0.0"
76
91
  },
77
92
  "devDependencies": {
78
- "@types/react": "^18.3.5",
93
+ "@types/react": "^18.3.12",
79
94
  "@types/uuid": "^10.0.0",
80
- "postcss": "^8.4.45",
95
+ "postcss": "^8.4.47",
81
96
  "tailwind-config": "workspace:*",
82
97
  "tsconfig": "workspace:*",
83
- "typescript": "^5.5.4"
98
+ "typescript": "^5.6.3"
84
99
  },
85
100
  "peerDependencies": {
86
101
  "react": "^18.3.1"
package/readme.md CHANGED
@@ -10,3 +10,82 @@
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).
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pnpm add @maily-to/core
18
+
19
+ # for types
20
+ pnpm add -D @tiptap/core
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```tsx
26
+ import { useState } from 'react';
27
+ import { Editor } from '@maily-to/core';
28
+ import type { Editor as TiptapEditor, JSONContent } from '@tiptap/core';
29
+
30
+ type AppProps = {
31
+ contentJson: JSONContent;
32
+ };
33
+
34
+ function App(props: AppProps) {
35
+ const { contentJson: defaultContentJson } = props;
36
+ const [editor, setEditor] = useState<TiptapEditor>();
37
+
38
+ return (
39
+ <Editor
40
+ contentJson={defaultContentJson}
41
+ onCreate={setEditor}
42
+ onUpdate={setEditor}
43
+ />
44
+ );
45
+ }
46
+ ```
47
+
48
+ ### Slash Commands
49
+
50
+ Slash commands are a way to interact with the editor using `/` followed by a command name. For example, `/heading1` will convert the current paragraph to a heading 1.
51
+
52
+ ```tsx
53
+ // (Omitted repeated imports)
54
+ import { text, heading1 } from '@maily-to/core/blocks';
55
+
56
+ <Editor
57
+ blocks={[text, heading1]}
58
+ />
59
+ ```
60
+
61
+ > Note: The order of the blocks matters. It will be shown in the order you provide.
62
+
63
+ ### Variables
64
+
65
+ By default, the variables are required. You can make them optional by setting the `required` property to `false`. So it will show a placeholder if the variable is not provided.
66
+
67
+ For auto-suggestions of the variables in the editor when you type `@` and pass the variables as an array of objects to the `variables` prop. The `iterable` property is used to indicate that the variable is an array of objects and can be used in `For` loop. The `keys` property is used to show the keys of the object in the auto-suggestions.
68
+
69
+ ```tsx
70
+ // (Omitted repeated imports)
71
+ <Editor
72
+ triggerSuggestionCharacter="@"
73
+ variables={[
74
+ {
75
+ name: 'currentDate',
76
+ required: false,
77
+ },
78
+ {
79
+ name: 'notifications',
80
+ iterable: true,
81
+ keys: ['id', 'title'],
82
+ }
83
+ ]}
84
+ />
85
+ ```
86
+
87
+ See the [@maily-to/render](../render) package for more information on how to render the editor content to HTML.
88
+
89
+ ## License
90
+
91
+ MIT &copy; [Arik Chakma](https://twitter.com/imarikchakma)