@maily-to/core 0.3.7 → 2.0.0-beta.10

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 (40) hide show
  1. package/LICENSE +21 -0
  2. package/dist/blocks/index.cjs +29 -305
  3. package/dist/blocks/index.d.cts +1 -59
  4. package/dist/blocks/index.d.mts +46 -0
  5. package/dist/blocks/index.d.mts.map +1 -0
  6. package/dist/blocks/index.mjs +2 -273
  7. package/dist/extensions/index.cjs +354 -9100
  8. package/dist/extensions/index.d.cts +1 -448
  9. package/dist/extensions/index.d.mts +282 -0
  10. package/dist/extensions/index.d.mts.map +1 -0
  11. package/dist/extensions/index.mjs +322 -9052
  12. package/dist/index.cjs +10225 -12221
  13. package/dist/index.d.cts +1 -63
  14. package/dist/index.d.mts +743 -0
  15. package/dist/index.d.mts.map +1 -0
  16. package/dist/index.mjs +10103 -12273
  17. package/dist/slash-command-BrwA1bHs.d.mts +38 -0
  18. package/dist/slash-command-BrwA1bHs.d.mts.map +1 -0
  19. package/dist/theme-D1CI7_8s.d.mts +70 -0
  20. package/dist/theme-D1CI7_8s.d.mts.map +1 -0
  21. package/dist/typography-BdOKvXfQ.mjs +911 -0
  22. package/dist/typography-D-VnwOSw.cjs +970 -0
  23. package/dist/typography-DW7VApAR.cjs +1072 -0
  24. package/dist/use-maily-editor-Atvy2kSO.cjs +3993 -0
  25. package/dist/use-maily-editor-CByaDhmT.cjs +4955 -0
  26. package/dist/use-maily-editor-idL0RNsG.mjs +4504 -0
  27. package/package.json +115 -180
  28. package/readme.md +356 -195
  29. package/src/styles/index.css +2537 -0
  30. package/dist/blocks/index.cjs.map +0 -1
  31. package/dist/blocks/index.d.ts +0 -59
  32. package/dist/blocks/index.mjs.map +0 -1
  33. package/dist/extensions/index.cjs.map +0 -1
  34. package/dist/extensions/index.d.ts +0 -448
  35. package/dist/extensions/index.mjs.map +0 -1
  36. package/dist/index.cjs.map +0 -1
  37. package/dist/index.css +0 -2487
  38. package/dist/index.css.map +0 -1
  39. package/dist/index.d.ts +0 -63
  40. package/dist/index.mjs.map +0 -1
package/readme.md CHANGED
@@ -1,17 +1,15 @@
1
- <h1 align="center"><img height="150" src="https://maily.to/brand/icon.svg" /><br> @maily-to/core</h1>
1
+ [![@maily-to/core](../../_static/core.jpg)](https://maily.to)
2
2
 
3
3
  <p align="center">
4
- <a href="https://github.com/arikchakma/maily.to/blob/main/license">
4
+ <a href="https://github.com/arikchakma/maily.to/blob/main/LICENSE">
5
5
  <img src="https://img.shields.io/badge/License-MIT-222222.svg" />
6
6
  </a>
7
7
  <a href="https://maily.to">
8
- <img src="https://img.shields.io/badge/%E2%9C%A8-Get%20Editor-0a0a0a.svg?style=flat&colorA=0a0a0a" alt="Get Maily Editor" />
8
+ <img src="https://img.shields.io/badge/%E2%9C%A8-Get%20Editor-0a0a0a.svg?style=flat&colorA=222222" alt="Get Maily Editor" />
9
9
  </a>
10
10
  </p>
11
11
 
12
- > Currently, this package is under development. You can follow the progress [here](https://github.com/arikchakma/maily.to).
13
-
14
- ## Installation
12
+ ### Installation
15
13
 
16
14
  ```bash
17
15
  pnpm add @maily-to/core
@@ -20,269 +18,432 @@ pnpm add @maily-to/core
20
18
  pnpm add -D @tiptap/core
21
19
  ```
22
20
 
23
- ## Usage
21
+ ### Quick Start
22
+
23
+ The editor uses a **compound component** pattern — compose `Editor.Root`,
24
+ `Editor.Frame`, and `Editor.Content` to build your layout.
24
25
 
25
26
  ```tsx
26
27
  import '@maily-to/core/style.css';
27
28
 
28
29
  import { useState } from 'react';
29
30
  import { Editor } from '@maily-to/core';
30
- import type { Editor as TiptapEditor, JSONContent } from '@tiptap/core';
31
-
32
- type AppProps = {
33
- contentJson: JSONContent;
34
- };
31
+ import type { Editor as TiptapEditor } from '@tiptap/core';
35
32
 
36
- function App(props: AppProps) {
37
- const { contentJson: defaultContentJson } = props;
33
+ function App() {
38
34
  const [editor, setEditor] = useState<TiptapEditor>();
39
35
 
40
36
  return (
41
- <Editor
42
- contentJson={defaultContentJson}
43
- onCreate={setEditor}
44
- onUpdate={setEditor}
45
- />
37
+ <Editor.Root
38
+ content={defaultContentJson}
39
+ onCreate={({ editor }) => setEditor(editor)}
40
+ onUpdate={({ editor }) => setEditor(editor)}
41
+ >
42
+ <Editor.Frame>
43
+ <Editor.Content />
44
+ <Editor.BubbleMenus />
45
+ <Editor.DragContextHandle />
46
+ </Editor.Frame>
47
+ </Editor.Root>
46
48
  );
47
49
  }
48
50
  ```
49
51
 
50
- ### Slash Commands
52
+ #### Editor Components
51
53
 
52
- Slash commands let you interact with the editor by typing `/` followed by a command name. Commands are now organized into groups. Each group is an object with a `title` and a `commands` array. Every command within that array is a `BlockItem` that can either be a single command or a grouped command (with commands).
54
+ | Component | Description |
55
+ | -------------------------- | ---------------------------------------------------------------------- |
56
+ | `Editor.Root` | Top-level provider. Accepts content, extensions, and editor callbacks. |
57
+ | `Editor.Frame` | Renders the document's body and container shells. |
58
+ | `Editor.Content` | Renders the Tiptap editor. |
59
+ | `Editor.BubbleMenus` | Renders every node and text bubble menu. |
60
+ | `Editor.DragContextHandle` | Renders the drag handle and its context menu. |
53
61
 
54
- #### Basic Example
62
+ `Editor.Content` renders only the editor. Compose `Editor.BubbleMenus` and
63
+ `Editor.DragContextHandle` beside it to get Maily's chrome, and leave them out
64
+ for a bare canvas.
65
+
66
+ #### Reading the document
55
67
 
56
- Suppose you have a couple of basic blocks, such as a text block or a heading block. You would organize them into a group like this:
68
+ Pass a `ref` to `Editor.Root` to reach the editor and its content from outside.
57
69
 
58
70
  ```tsx
59
- // omitting imports
60
- import { text, heading1 } from '@maily-to/core/blocks';
61
-
62
- <Editor
63
- blocks={[
64
- {
65
- title: 'Basic Blocks',
66
- commands: [text, heading1],
67
- },
68
- ]}
69
- />
71
+ import { useRef } from 'react';
72
+ import { Editor } from '@maily-to/core';
73
+
74
+ function App() {
75
+ const editorRef = useRef<Editor.Root.Handle>(null);
76
+
77
+ const save = () => {
78
+ const json = editorRef.current?.getJSON();
79
+ // ...
80
+ };
81
+
82
+ return <Editor.Root ref={editorRef}>{/* ... */}</Editor.Root>;
83
+ }
84
+ ```
85
+
86
+ `Editor.Root.Props` types the props in the same way.
87
+
88
+ | Method | Returns |
89
+ | --------------- | -------------------------------- |
90
+ | `getEditor` | The underlying Tiptap `Editor` |
91
+ | `getJSON` | The document as a `DocumentNode` |
92
+ | `getEditorHTML` | The editor's HTML |
93
+ | `getText` | The document's plain text |
94
+
95
+ ### Toolbar
96
+
97
+ A composable toolbar with pre-built action buttons:
98
+
99
+ ```tsx
100
+ import { Editor, Toolbar } from '@maily-to/core';
101
+
102
+ <Editor.Root content={content}>
103
+ <Toolbar.Root>
104
+ <Toolbar.CommonActions />
105
+ </Toolbar.Root>
106
+ <Editor.Frame>
107
+ <Editor.Content />
108
+ <Editor.BubbleMenus />
109
+ </Editor.Frame>
110
+ </Editor.Root>;
111
+ ```
112
+
113
+ Or pick individual buttons:
114
+
115
+ ```tsx
116
+ <Toolbar.Root>
117
+ <Toolbar.Group>
118
+ <Toolbar.Undo />
119
+ <Toolbar.Redo />
120
+ </Toolbar.Group>
121
+ <Toolbar.Group>
122
+ <Toolbar.Bold />
123
+ <Toolbar.Italic />
124
+ <Toolbar.Underline />
125
+ <Toolbar.Strikethrough />
126
+ <Toolbar.Code />
127
+ </Toolbar.Group>
128
+ <Toolbar.Align />
129
+ <Toolbar.Direction />
130
+ </Toolbar.Root>
70
131
  ```
71
132
 
72
- > **Note:** The order of the groups and the order of commands within each group determine how they are displayed in the editor.
133
+ | Component | Description |
134
+ | ------------------------------------------------------------------ | ------------------------------------------------------- |
135
+ | `Toolbar.Root` | Toolbar container with tooltip provider |
136
+ | `Toolbar.Group` | Visual grouping for buttons |
137
+ | `Toolbar.CommonActions` | Pre-configured group with all common formatting actions |
138
+ | `Toolbar.Undo` / `Toolbar.Redo` | History actions |
139
+ | `Toolbar.Bold` / `Italic` / `Underline` / `Strikethrough` / `Code` | Mark toggles |
140
+ | `Toolbar.Align` | Text alignment popover (left, center, right) |
141
+ | `Toolbar.Direction` | Text direction popover (LTR, RTL) |
73
142
 
74
- #### Grouped Command Blocks with Subcommands
143
+ ### Slash Commands
75
144
 
76
- Sometimes, you may want a single command to open a list of commands. For this, define a command with an `id` and a `commands` array. The `id` is used for the slash command query (for example, typing `/headers.` will show its subcommands).
145
+ Slash commands let you interact with the editor by typing `/` followed by a
146
+ command name. Commands are organized into groups with a `title` and a `commands`
147
+ array.
148
+
149
+ #### Basic Example
77
150
 
78
151
  ```tsx
79
- // omitting imports
80
- <Editor
81
- blocks={[
82
- {
83
- title: 'Formatting',
152
+ import { heading1, text } from '@maily-to/core/blocks';
153
+ import { SlashCommandExtension } from '@maily-to/core/extensions';
154
+
155
+ <Editor.Root
156
+ extensions={[
157
+ SlashCommandExtension.configure({
84
158
  commands: [
85
159
  {
86
- title: 'Headers',
87
- // The id is used to filter commands; e.g. `/headers.` shows these subcommands.
88
- id: 'headers',
89
- searchTerms: ['header', 'title'],
90
- commands: [
91
- {
92
- title: 'Heading 1',
93
- searchTerms: ['h1', 'heading1'],
94
- command: ({ editor, range }) => {
95
- // Convert the current block to Heading 1.
96
- },
97
- },
98
- {
99
- title: 'Heading 2',
100
- searchTerms: ['h2', 'heading2'],
101
- command: ({ editor, range }) => {
102
- // Convert the current block to Heading 2.
103
- },
104
- },
105
- // Add more subcommands as needed.
106
- ],
160
+ title: 'Blocks',
161
+ commands: [text, heading1],
107
162
  },
108
163
  ],
109
- },
164
+ }),
110
165
  ]}
111
- />
166
+ >
167
+ ...
168
+ </Editor.Root>;
112
169
  ```
113
170
 
114
- In this setup, when the user types `/headers.`, the editor will display the available header subcommands.
171
+ `commands` takes groups, not blocks — every block belongs to a group with a
172
+ `title`. `DEFAULT_SLASH_COMMANDS` is the set the editor ships with, so extend it
173
+ rather than restate it when you only want to add one group.
174
+
175
+ > The order of the groups and commands determines how they are displayed in the editor.
176
+
177
+ #### Available Blocks
178
+
179
+ Import pre-built blocks from `@maily-to/core/blocks`:
180
+
181
+ **Typography:** `text`, `heading1`, `heading2`, `heading3`, `blockquote`, `hardBreak`, `clearLine`
182
+
183
+ **Layout:** `spacer`, `divider`, `section`, `columns`, `repeat`, `table`, `htmlCodeBlock`
184
+
185
+ **Content:** `button`, `image`, `inlineImage`, `linkCard`, `bulletList`, `orderedList`
115
186
 
116
- > **Note:** Currently it only supports one level of depth for subcommands.
187
+ **Headers:** `headerLogoWithCoverImage`, `headerLogoWithTextHorizontal`, `headerLogoWithTextVertical`
117
188
 
118
- #### Custom Rendered Blocks
189
+ **Footers:** `footer`, `footerCommunityFeedbackCta`, `footerCompanySignature`, `footerCopyrightText`
119
190
 
120
- To render a custom block, you can pass a `render` function to the block object. The `render` function will receive the editor instance as an argument. You can return `null` if you don't want to render anything based on the editor's state.
191
+ #### Grouped Commands with Subcommands
192
+
193
+ An item with an `id` and a `commands` array becomes a nested menu. Typing
194
+ `/headers.` then shows its subcommands.
121
195
 
122
196
  ```tsx
123
- // omitting imports
124
- <Editor
125
- blocks={[
126
- {
127
- title: 'Custom Blocks',
197
+ import { heading1, heading2, heading3 } from '@maily-to/core/blocks';
198
+ import { SlashCommandExtension } from '@maily-to/core/extensions';
199
+
200
+ <Editor.Root
201
+ extensions={[
202
+ SlashCommandExtension.configure({
128
203
  commands: [
129
204
  {
130
- title: 'Custom Block',
131
- searchTerms: ['custom'],
132
- render: (editor) => {
133
- return <div>Custom Block</div>;
134
- },
205
+ title: 'Blocks',
206
+ commands: [
207
+ {
208
+ title: 'Headers',
209
+ id: 'headers',
210
+ searchTerms: ['header', 'title'],
211
+ commands: [heading1, heading2, heading3],
212
+ },
213
+ ],
135
214
  },
136
215
  ],
137
- },
216
+ }),
138
217
  ]}
139
- />
218
+ >
219
+ ...
220
+ </Editor.Root>;
140
221
  ```
141
222
 
142
- ### Variables
223
+ The `id` and the nesting live on the **item**, not on the group — a group only
224
+ carries a `title` and its `commands`.
143
225
 
144
- By default, variables are required. You can make them optional by setting the `required` property to `false`. When a variable is optional and not provided, a placeholder will be displayed in its place.
145
-
146
- You can pass variables to the editor in two ways:
147
-
148
- 1. As an Array of Objects:
149
-
150
- For auto-suggestions of variables in the editor when you type `@`, pass the variables as an array of objects to the `variables` prop.
151
-
152
- ```tsx
153
- // (Omitted repeated imports)
154
- import { VariableExtension, getVariableSuggestions } from '@maily-to/core/extensions';
155
-
156
- <Editor
157
- extensions={[
158
- VariableExtension.configure({
159
- suggestion: getVariableSuggestions('@'),
160
- variables: [{
161
- name: 'currentTime',
162
- required: false,
163
- }],
164
- }),
165
- ]}
166
- />
167
- ```
168
-
169
- 2. As a Function:
170
-
171
- If the variables are dynamic and need to be generated based on the editor's state or other inputs, you can provide a function to the `variables` prop.
172
-
173
- ```tsx
174
- // (Omitted repeated imports)
175
- import { VariableExtension, getVariableSuggestions } from '@maily-to/core/extensions';
176
-
177
- <Editor
178
- extensions={[
179
- VariableExtension.configure({
180
- suggestion: 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
- name: 'first_name',
199
- required: false,
200
- // if you want to hide the default value
201
- // input in the popover
202
- hideDefaultValue: true,
203
- },
204
- ];
205
- },
206
- }),
207
- ]}
208
- />
209
- ```
210
-
211
- > Keep it in mind that if you pass an array of variable object Maily will take care of the filtering based on the query. But if you pass a function you have to take care of the filtering.
226
+ > Currently supports one level of depth for subcommands.
212
227
 
213
- ### Extensions
228
+ #### Writing a Block
214
229
 
215
- Extensions are a way to extend the editor's functionality. You can add custom blocks, marks, or extend the editor's functionality using extensions.
230
+ A block is an item with a `title`, `searchTerms`, and a `command` that runs
231
+ against the editor and the typed range.
216
232
 
217
233
  ```tsx
218
- // (Omitted repeated imports)
219
- import { MailyKit, VariableExtension, getVariableSuggestions } from '@maily-to/core/extensions';
234
+ {
235
+ title: 'Custom Block',
236
+ searchTerms: ['custom'],
237
+ command: ({ editor, range }) => {
238
+ editor.chain().deleteRange(range).run();
239
+ },
240
+ }
241
+ ```
220
242
 
221
- <Editor
222
- extensions={[
223
- MailyKit.configure({
224
- // do disable the link card node
225
- linkCard: false,
226
- }),
227
- // it will extend the variable extension
228
- // and provide suggestions for variables
229
- VariableExtension.extend({
230
- addNodeView() {
231
- // now you can replace the default
232
- // VariableView with your custom view
233
- return ReactNodeViewRenderer(VariableView, {
234
- className: 'mly:relative mly:inline-block',
235
- as: 'div',
236
- });
237
- },
238
- }).configure({
239
- suggestion: getVariableSuggestions(variableTriggerCharacter),
240
- }),
241
- ]}
242
- />
243
+ #### Controlling How a Block Appears
244
+
245
+ `render` decides whether an item shows and what its row looks like. Return
246
+ `null` to hide it, `true` for the default row, or JSX to replace the row.
247
+
248
+ ```tsx
249
+ {
250
+ title: 'Custom Block',
251
+ searchTerms: ['custom'],
252
+ command: ({ editor, range }) => {
253
+ editor.chain().deleteRange(range).run();
254
+ },
255
+ render: (editor) => {
256
+ return editor.isActive('section') ? null : true;
257
+ },
258
+ }
243
259
  ```
244
260
 
245
- Or, you can add your own custom extensions, like shown below:
261
+ Add `preview` to show a preview beside the row, and `description` or `icon` to
262
+ fill out the default one.
263
+
264
+ ### Variables
265
+
266
+ Variables are dynamic placeholders that get replaced at render time. Typing `{{`
267
+ opens the variable picker.
268
+
269
+ #### Array of Variables
246
270
 
247
271
  ```tsx
248
- // (Omitted repeated imports)
249
- import { CustomExtension } from './extensions/custom-extension';
272
+ import { VariableExtension } from '@maily-to/core/extensions';
250
273
 
251
- <Editor
274
+ <Editor.Root
252
275
  extensions={[
253
- CustomExtension.configure({
254
- // your configuration
276
+ VariableExtension.configure({
277
+ variables: [
278
+ { id: 'currentDate' },
279
+ { id: 'currentTime', required: false },
280
+ { id: 'first_name', required: false, isDefaultEditable: false },
281
+ ],
255
282
  }),
256
283
  ]}
257
- />
284
+ >
285
+ ...
286
+ </Editor.Root>;
258
287
  ```
259
288
 
260
- ### Image Upload
289
+ When passing an array, Maily handles query filtering automatically. A dynamic
290
+ entry is appended when no exact match exists, allowing users to create variables
291
+ on the fly.
292
+
293
+ #### Function-based Variables
261
294
 
262
- 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.
295
+ For dynamic variables based on editor state, pass a function:
263
296
 
264
297
  ```tsx
265
- // (Omitted repeated imports)
266
- import { ImageUploadExtension } from '@maily-to/core/extensions';
298
+ VariableExtension.configure({
299
+ variables: ({ query, editor }) => {
300
+ // You handle filtering yourself
301
+ return [{ id: 'notifications' }, { id: 'comments' }];
302
+ },
303
+ });
304
+ ```
305
+
306
+ ### Extensions
307
+
308
+ Extensions extend the editor's functionality. Maily's own extensions are
309
+ included by default — use the `extensions` prop to configure them, to override
310
+ one, or to add an opt-in extension.
267
311
 
268
- <Editor
312
+ ```tsx
313
+ import {
314
+ ImageUploadExtension,
315
+ LinkCardExtension,
316
+ VariableExtension,
317
+ } from '@maily-to/core/extensions';
318
+
319
+ <Editor.Root
269
320
  extensions={[
321
+ VariableExtension.configure({ variables: [...] }),
270
322
  ImageUploadExtension.configure({
271
323
  onImageUpload: async (file) => {
272
- // upload the image to wherever you want
273
324
  const url = await uploadImage(file);
274
325
  return url;
275
326
  },
276
327
  }),
328
+ LinkCardExtension,
277
329
  ]}
278
- />
330
+ >
331
+ ...
332
+ </Editor.Root>
279
333
  ```
280
334
 
281
- See the [@maily-to/render](../render) package for more information on how to render the editor content to HTML.
335
+ `LinkCardExtension` is opt-in — add it to get the link card node.
282
336
 
283
- <br/>
337
+ #### Image Upload
338
+
339
+ Handle file drops and pastes with the `ImageUploadExtension`:
340
+
341
+ ```tsx
342
+ import { ImageUploadExtension } from '@maily-to/core/extensions';
343
+
344
+ ImageUploadExtension.configure({
345
+ onImageUpload: async (file, context) => {
346
+ // context.position — insertion position in the document
347
+ // context.removeImage() — call to remove the placeholder on failure
348
+ const url = await uploadImage(file);
349
+ return url;
350
+ },
351
+ onImageUploadError: (error, file, context) => {
352
+ console.error('Upload failed:', error);
353
+ context.removeImage();
354
+ },
355
+ });
356
+ ```
357
+
358
+ Supports `image/jpeg`, `image/png`, `image/gif`, `image/webp`, and `image/svg+xml`.
359
+
360
+ #### AI Actions and Inline Suggestions
361
+
362
+ AI transformations and ghost-text autocomplete ship inside this package. The
363
+ text bubble menu renders `AIActionsDropdown` when the AI actions extension is
364
+ present. See [extension-ai-actions](../extension-ai-actions) and
365
+ [extension-inline-suggestion](../extension-inline-suggestion).
366
+
367
+ ### Theming
368
+
369
+ A document carries its own appearance. `ThemeExtension` writes a theme into the
370
+ document's `theme` attribute, and every node's `style` attribute is what the
371
+ renderer reads — so `@maily-to/render` applies no theme of its own and the email
372
+ matches the canvas.
373
+
374
+ ```tsx
375
+ import { BASIC_NODE_THEME } from '@maily-to/shared';
376
+ import { ThemeExtension } from '@maily-to/core/extensions';
377
+
378
+ <Editor.Root
379
+ extensions={[ThemeExtension.configure({ theme: BASIC_NODE_THEME })]}
380
+ >
381
+ ...
382
+ </Editor.Root>;
383
+ ```
384
+
385
+ `BASIC_NODE_THEME` is a plain starter theme. Omit `ThemeExtension`
386
+ entirely for an unthemed document — the editor stays fully usable and applies no
387
+ Maily appearance.
388
+
389
+ A theme is a `NodeThemeOptions` map from node type to an inline style:
390
+
391
+ ```ts
392
+ import type { NodeThemeOptions } from '@maily-to/shared';
393
+
394
+ const theme: NodeThemeOptions = {
395
+ body: { backgroundColor: '#ffffff', padding: '24px' },
396
+ container: { backgroundColor: '#f9fafb', maxWidth: '600px' },
397
+ button: { backgroundColor: '#4f46e5', color: '#ffffff' },
398
+ link: { color: '#2563eb' },
399
+ paragraph: { fontSize: '15px', lineHeight: '24px' },
400
+ };
401
+ ```
402
+
403
+ #### Editing the theme
404
+
405
+ `ThemeSettings` gives writers a panel for the theme the document holds. Each
406
+ part edits one group of declarations.
407
+
408
+ ```tsx
409
+ import { ThemeSettings } from '@maily-to/core';
410
+
411
+ <ThemeSettings.Root>
412
+ <ThemeSettings.Font />
413
+ <ThemeSettings.Layout />
414
+ <ThemeSettings.Button />
415
+ <ThemeSettings.Text />
416
+ </ThemeSettings.Root>;
417
+ ```
418
+
419
+ The `setNodeTheme`, `updateNodeTheme`, and `updateShellTheme` commands do the
420
+ same work from your own UI.
421
+
422
+ ## Text Direction
423
+
424
+ The editor supports LTR and RTL text directions. Set the initial direction with
425
+ the `textDirection` prop on `Editor.Root`:
426
+
427
+ ```tsx
428
+ <Editor.Root textDirection="rtl">
429
+ ```
430
+
431
+ Use `Toolbar.Direction` to let users toggle direction from the toolbar.
432
+
433
+ ## Entry Points
434
+
435
+ | Import path | Contents |
436
+ | --------------------------- | -------------------------------------------------------------------------------------------- |
437
+ | `@maily-to/core` | `Editor`, `Toolbar`, `ThemeSettings`, bubble menus, headless UI primitives, hooks, and types |
438
+ | `@maily-to/core/blocks` | Pre-built slash command block items and types |
439
+ | `@maily-to/core/extensions` | All Tiptap extensions and their option/storage types |
440
+ | `@maily-to/core/style.css` | Optional stylesheet — the editor works without it and carries no Maily visual styles |
441
+
442
+ See the [@maily-to/render](../render) package for converting editor content to
443
+ HTML email templates, and [@maily-to/migration](../migration) for loading v1
444
+ documents.
284
445
 
285
- ## Sponsors
446
+ ### Sponsors
286
447
 
287
448
  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).
288
449
 
@@ -309,6 +470,6 @@ Sponsorship at any level is appreciated and encouraged. If you built a paid prod
309
470
 
310
471
  <br/>
311
472
 
312
- ## License
473
+ ### License
313
474
 
314
- MIT &copy; [Arik Chakma](https://twitter.com/imarikchakma)
475
+ MIT &copy; [Arik Chakma](https://x.com/imarikchakma)