@maildeno/editor 0.1.3 → 0.4.2

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 (169) hide show
  1. package/CHANGELOG.md +258 -0
  2. package/README.md +397 -381
  3. package/dist/RowPreviewChildren-DT0y0lKC.js +4 -0
  4. package/dist/RowPreviewChildren-OsbF7_vu.js +4 -0
  5. package/dist/RowPreviewLegacyComponent-BV4b5bHQ.js +487 -0
  6. package/dist/RowPreviewLegacyComponent-C08MGJVT.js +487 -0
  7. package/dist/RowPreviewRow-ByxeBYV8.js +112 -0
  8. package/dist/RowPreviewRow-N-hh5l_H.js +112 -0
  9. package/dist/adapters/errors.d.ts +59 -0
  10. package/dist/adapters/index.d.ts +31 -0
  11. package/dist/adapters/types.d.ts +68 -0
  12. package/dist/brand.d.ts +15 -0
  13. package/dist/components/DesktopOnlyNotice.vue.d.ts +20 -0
  14. package/dist/components/features/emailBuilder/EmailEditor.vue.d.ts +182 -0
  15. package/dist/components/features/emailBuilder/assistant/AssistantPanel.vue.d.ts +37 -0
  16. package/dist/components/features/emailBuilder/blocks/AnchorBlock.vue.d.ts +3 -0
  17. package/dist/components/features/emailBuilder/blocks/ButtonBlock.vue.d.ts +3 -0
  18. package/dist/components/features/emailBuilder/blocks/DividerBlock.vue.d.ts +3 -0
  19. package/dist/components/features/emailBuilder/blocks/HeadingBlock.vue.d.ts +3 -0
  20. package/dist/components/features/emailBuilder/blocks/ImageBlock.vue.d.ts +3 -0
  21. package/dist/components/features/emailBuilder/blocks/ListBlock.vue.d.ts +3 -0
  22. package/dist/components/features/emailBuilder/blocks/MenuBlock.vue.d.ts +3 -0
  23. package/dist/components/features/emailBuilder/blocks/ParagraphBlock.vue.d.ts +3 -0
  24. package/dist/components/features/emailBuilder/blocks/SocialsBlock.vue.d.ts +3 -0
  25. package/dist/components/features/emailBuilder/blocks/SpacerBlock.vue.d.ts +3 -0
  26. package/dist/components/features/emailBuilder/blocks/VideoBlock.vue.d.ts +3 -0
  27. package/dist/components/features/emailBuilder/canvas/Canvas.vue.d.ts +3 -0
  28. package/dist/components/features/emailBuilder/canvas/CanvasColumn.vue.d.ts +49 -0
  29. package/dist/components/features/emailBuilder/canvas/CanvasComponent.vue.d.ts +56 -0
  30. package/dist/components/features/emailBuilder/canvas/CanvasElement.vue.d.ts +21 -0
  31. package/dist/components/features/emailBuilder/canvas/CanvasRow.vue.d.ts +49 -0
  32. package/dist/components/features/emailBuilder/canvas/CanvasRowSpacer.vue.d.ts +40 -0
  33. package/dist/components/features/emailBuilder/health/HealthIndicator.vue.d.ts +3 -0
  34. package/dist/components/features/emailBuilder/layout/Header.vue.d.ts +54 -0
  35. package/dist/components/features/emailBuilder/layout/SendEmail.vue.d.ts +21 -0
  36. package/dist/components/features/emailBuilder/layout/SidebarLeft.vue.d.ts +3 -0
  37. package/dist/components/features/emailBuilder/layout/SidebarRight.vue.d.ts +3 -0
  38. package/dist/components/features/emailBuilder/panels/AnchorPanel.vue.d.ts +3 -0
  39. package/dist/components/features/emailBuilder/panels/ButtonPanel.vue.d.ts +3 -0
  40. package/dist/components/features/emailBuilder/panels/DividerPanel.vue.d.ts +3 -0
  41. package/dist/components/features/emailBuilder/panels/HeadingPanel.vue.d.ts +3 -0
  42. package/dist/components/features/emailBuilder/panels/ImagePanel.vue.d.ts +3 -0
  43. package/dist/components/features/emailBuilder/panels/ListPanel.vue.d.ts +3 -0
  44. package/dist/components/features/emailBuilder/panels/MenuPanel.vue.d.ts +3 -0
  45. package/dist/components/features/emailBuilder/panels/ParagraphPanel.vue.d.ts +3 -0
  46. package/dist/components/features/emailBuilder/panels/RowColumnPanel.vue.d.ts +13 -0
  47. package/dist/components/features/emailBuilder/panels/RowPanel.vue.d.ts +13 -0
  48. package/dist/components/features/emailBuilder/panels/RowSpacerPanel.vue.d.ts +13 -0
  49. package/dist/components/features/emailBuilder/panels/SocialsPanel.vue.d.ts +3 -0
  50. package/dist/components/features/emailBuilder/panels/SpacerPanel.vue.d.ts +3 -0
  51. package/dist/components/features/emailBuilder/panels/VideoPanel.vue.d.ts +3 -0
  52. package/dist/components/features/emailBuilder/panels/shared/DeviceTabs.vue.d.ts +19 -0
  53. package/dist/components/features/emailBuilder/panels/shared/LinkFieldMergeTags.vue.d.ts +31 -0
  54. package/dist/components/features/emailBuilder/panels/shared/OverrideBadge.vue.d.ts +9 -0
  55. package/dist/components/features/emailBuilder/panels/shared/PreviewBadge.vue.d.ts +11 -0
  56. package/dist/components/features/emailBuilder/panels/shared/TextFieldMergeTags.vue.d.ts +25 -0
  57. package/dist/components/features/emailBuilder/panels/ui/BoxStylingSection.vue.d.ts +7 -0
  58. package/dist/components/features/emailBuilder/panels/ui/PropertyAlignment.vue.d.ts +30 -0
  59. package/dist/components/features/emailBuilder/panels/ui/PropertyColor.vue.d.ts +75 -0
  60. package/dist/components/features/emailBuilder/panels/ui/PropertyGradientColor.vue.d.ts +27 -0
  61. package/dist/components/features/emailBuilder/panels/ui/PropertyNumberSlider.vue.d.ts +74 -0
  62. package/dist/components/features/emailBuilder/panels/ui/PropertySection.vue.d.ts +17 -0
  63. package/dist/components/features/emailBuilder/panels/ui/PropertySelect.vue.d.ts +74 -0
  64. package/dist/components/features/emailBuilder/panels/ui/PropertyTextStyle.vue.d.ts +52 -0
  65. package/dist/components/features/emailBuilder/panels/ui/PropertyTextStylePanel.vue.d.ts +72 -0
  66. package/dist/components/features/emailBuilder/panels/ui/PropertyToggle.vue.d.ts +45 -0
  67. package/dist/components/features/emailBuilder/panels/ui/PropertyVisibility.vue.d.ts +32 -0
  68. package/dist/components/features/emailBuilder/panels/ui/SpacingControl.vue.d.ts +19 -0
  69. package/dist/components/features/emailBuilder/panels/ui/color-picker/AlphaSlider.vue.d.ts +28 -0
  70. package/dist/components/features/emailBuilder/panels/ui/color-picker/ColorPickerPanel.vue.d.ts +31 -0
  71. package/dist/components/features/emailBuilder/panels/ui/color-picker/HueSlider.vue.d.ts +19 -0
  72. package/dist/components/features/emailBuilder/panels/ui/color-picker/RecentColors.vue.d.ts +20 -0
  73. package/dist/components/features/emailBuilder/panels/ui/color-picker/SVPanel.vue.d.ts +39 -0
  74. package/dist/components/features/emailBuilder/panels/ui/visibility-rule/Rule.vue.d.ts +28 -0
  75. package/dist/components/features/emailBuilder/preview/PreviewScreen.vue.d.ts +7 -0
  76. package/dist/components/features/emailBuilder/preview/ui/PreviewCanvas.vue.d.ts +10 -0
  77. package/dist/components/features/emailBuilder/preview/ui/PreviewCapabilityBadges.vue.d.ts +12 -0
  78. package/dist/components/features/emailBuilder/preview/ui/PreviewClientCard.vue.d.ts +20 -0
  79. package/dist/components/features/emailBuilder/preview/ui/PreviewClientList.vue.d.ts +21 -0
  80. package/dist/components/features/emailBuilder/preview/ui/PreviewClientPicker.vue.d.ts +16 -0
  81. package/dist/components/features/emailBuilder/preview/ui/PreviewComponent.vue.d.ts +10 -0
  82. package/dist/components/features/emailBuilder/preview/ui/PreviewDetailView.vue.d.ts +41 -0
  83. package/dist/components/features/emailBuilder/preview/ui/PreviewRendered.vue.d.ts +8 -0
  84. package/dist/components/features/emailBuilder/product/RowPreview.vue.d.ts +8 -0
  85. package/dist/components/features/emailBuilder/product/RowPreviewChildren.vue.d.ts +14 -0
  86. package/dist/components/features/emailBuilder/product/RowPreviewLegacyComponent.vue.d.ts +14 -0
  87. package/dist/components/features/emailBuilder/product/RowPreviewRow.vue.d.ts +9 -0
  88. package/dist/components/features/emailBuilder/product/SavedRowsPanel.vue.d.ts +3 -0
  89. package/dist/components/features/emailBuilder/product/SavedTemplatesPanel.vue.d.ts +13 -0
  90. package/dist/components/features/emailBuilder/product/VersionHistoryPanel.vue.d.ts +14 -0
  91. package/dist/components/features/emailBuilder/sidebar/SidebarBlockButton.vue.d.ts +35 -0
  92. package/dist/components/features/emailBuilder/tabs/GeneralTab.vue.d.ts +3 -0
  93. package/dist/components/features/emailBuilder/tabs/LayoutTab.vue.d.ts +3 -0
  94. package/dist/components/features/emailBuilder/tabs/content/ContentTab.vue.d.ts +3 -0
  95. package/dist/components/features/emailBuilder/tabs/content/LayersPanel.vue.d.ts +7 -0
  96. package/dist/components/features/emailBuilder/tabs/general/MergeTagsTab.vue.d.ts +3 -0
  97. package/dist/components/features/emailBuilder/tabs/general/StylesTab.vue.d.ts +3 -0
  98. package/dist/components/features/emailBuilder/tabs/general/VisibilityTab.vue.d.ts +3 -0
  99. package/dist/components/features/emailBuilder/tabs/general/VisibilityWrapESPTab.vue.d.ts +3 -0
  100. package/dist/components/features/emailBuilder/tabs/general/merge-tags/LinkTagTab.vue.d.ts +3 -0
  101. package/dist/components/features/emailBuilder/tabs/general/merge-tags/MergeTagTab.vue.d.ts +3 -0
  102. package/dist/components/features/emailBuilder/ui/LinkInputDialog.vue.d.ts +17 -0
  103. package/dist/components/features/emailBuilder/ui/canvas/CanvasRowDropZone.vue.d.ts +12 -0
  104. package/dist/components/features/emailBuilder/ui/canvas/DropZone.vue.d.ts +10 -0
  105. package/dist/components/features/emailBuilder/ui/canvas/Loader.vue.d.ts +19 -0
  106. package/dist/components/features/emailBuilder/ui/layers-panel/ComponentIcon.vue.d.ts +7 -0
  107. package/dist/components/features/emailBuilder/ui/layers-panel/LayerColumnChildren.vue.d.ts +42 -0
  108. package/dist/components/features/emailBuilder/ui/layers-panel/LayerDropLine.vue.d.ts +8 -0
  109. package/dist/components/features/emailBuilder/ui/renderers/AnchorRenderer.vue.d.ts +10 -0
  110. package/dist/components/features/emailBuilder/ui/renderers/DividerRenderer.vue.d.ts +10 -0
  111. package/dist/components/features/emailBuilder/ui/renderers/HeadingRenderer.vue.d.ts +10 -0
  112. package/dist/components/features/emailBuilder/ui/renderers/ImageRenderer.vue.d.ts +10 -0
  113. package/dist/components/features/emailBuilder/ui/renderers/ListRenderer.vue.d.ts +10 -0
  114. package/dist/components/features/emailBuilder/ui/renderers/MenuRenderer.vue.d.ts +10 -0
  115. package/dist/components/features/emailBuilder/ui/renderers/ParagraphRenderer.vue.d.ts +10 -0
  116. package/dist/components/features/emailBuilder/ui/renderers/SocialsRenderer.vue.d.ts +10 -0
  117. package/dist/components/features/emailBuilder/ui/renderers/SpacerRenderer.vue.d.ts +10 -0
  118. package/dist/components/features/emailBuilder/ui/renderers/VideoRenderer.vue.d.ts +10 -0
  119. package/dist/components/features/emailBuilder/ui/rich-text-editor/RichTextEditor.vue.d.ts +12 -0
  120. package/dist/components/features/emailBuilder/ui/rich-text-editor/pickers/MergeTagPicker.vue.d.ts +18 -0
  121. package/dist/components/features/emailBuilder/ui/rich-text-editor/pickers/RichTextColorPicker.vue.d.ts +15 -0
  122. package/dist/components/features/emailBuilder/ui/visibility/SupportBadge.vue.d.ts +10 -0
  123. package/dist/components/features/emailBuilder/ui/visibility/VisibilityPopover.vue.d.ts +45 -0
  124. package/dist/components/ui/ConfirmDialog.vue.d.ts +3 -0
  125. package/dist/components/ui/Icon.vue.d.ts +33 -0
  126. package/dist/components/ui/InfoDialog.vue.d.ts +12 -0
  127. package/dist/components/ui/Loading.vue.d.ts +6 -0
  128. package/dist/components/ui/ShadowSafeToast.vue.d.ts +3 -0
  129. package/dist/components/ui/primitives/Button.vue.d.ts +23 -0
  130. package/dist/components/ui/primitives/DatePicker.vue.d.ts +16 -0
  131. package/dist/components/ui/primitives/Dialog.vue.d.ts +34 -0
  132. package/dist/components/ui/primitives/InputText.vue.d.ts +29 -0
  133. package/dist/components/ui/primitives/Message.vue.d.ts +20 -0
  134. package/dist/components/ui/primitives/Select.vue.d.ts +22 -0
  135. package/dist/composables/emailBuilder/components/useSystemRows.d.ts +22 -0
  136. package/dist/composables/emailBuilder/core/ui/useLayerHoverScroll.d.ts +10 -10
  137. package/dist/composables/emailBuilder/core/useEmailBuilder.d.ts +18 -0
  138. package/dist/composables/emailBuilder/export/logic/espLogicWrapper.d.ts +4 -4
  139. package/dist/composables/emailBuilder/export/targets/templateSnapshot.d.ts +24 -0
  140. package/dist/composables/emailBuilder/persistence/useEmailBuilderPersistence.d.ts +1 -1
  141. package/dist/composables/system/useColorScheme.d.ts +16 -0
  142. package/dist/editor.css +1072 -682
  143. package/dist/element-C2ZH0Z_i.js +86561 -0
  144. package/dist/element-scoped-styles.css +1072 -682
  145. package/dist/element.d.ts +1 -1
  146. package/dist/element.js +5 -2
  147. package/dist/estree-DBJlF9un.js +4876 -0
  148. package/dist/html-3PMDtB0V.js +3123 -0
  149. package/dist/index-DhFg3uKs.js +75864 -0
  150. package/dist/index.d.ts +4 -2
  151. package/dist/index.js +16 -67053
  152. package/dist/init.d.ts +95 -2
  153. package/dist/init.js +166 -122
  154. package/dist/standalone-DKWMQftY.js +2391 -0
  155. package/dist/theme.d.ts +68 -17
  156. package/dist/types/assistant.d.ts +56 -0
  157. package/dist/typescript-l6-4tT8s.js +13240 -0
  158. package/package.json +6 -3
  159. package/dist/RowPreviewLegacyComponent-CXsY4P-R.js +0 -439
  160. package/dist/RowPreviewLegacyComponent-yjHSkZLz.js +0 -439
  161. package/dist/RowPreviewRow-CBfAnQ6o.js +0 -107
  162. package/dist/RowPreviewRow-CeowK6Q_.js +0 -107
  163. package/dist/composables/emailBuilder/transform/pipeline/optimizeAI.d.ts +0 -125
  164. package/dist/element-CMhqxYnE.js +0 -67099
  165. package/dist/estree-B67dfAo1.js +0 -7989
  166. package/dist/html-DGrfikay.js +0 -7353
  167. package/dist/standalone-Bd2oQFm3.js +0 -3639
  168. package/dist/typescript-C_Ru9PRN.js +0 -23184
  169. package/dist/vue.runtime.esm-bundler-CfYyFhW6.js +0 -9097
package/dist/theme.d.ts CHANGED
@@ -3,20 +3,41 @@
3
3
  *
4
4
  * Setting variables rather than regenerating a stylesheet is what makes this
5
5
  * work in the custom-element build: the bundled shadow-root CSS is static and
6
- * cannot be re-emitted at runtime, but a custom property set on the host
7
- * cascades into the shadow tree and updates every rule reading it, live.
6
+ * cannot be re-emitted at runtime, but a custom property set on the editor
7
+ * root cascades into the whole subtree and updates every rule reading it,
8
+ * live.
8
9
  */
9
10
  /**
10
11
  * Every themeable token.
11
12
  *
12
13
  * Two layers, deliberately. Core tokens (`primary`, `surface`, `text`, …)
13
14
  * re-theme the whole editor coherently. Semantic tokens (`headerBg`,
14
- * `inputBg`, `overlayBg`, …) default to the core ones and exist for hosts
15
+ * `overlayBg`, `toolbarBg`, …) default to the core ones and exist for hosts
15
16
  * that want to change one surface without redefining everything else.
16
17
  *
17
18
  * Anything left out keeps its default, so a partial theme is always coherent
18
19
  * rather than half-applied — setting only `primary` cannot produce unreadable
19
20
  * text, and setting only `headerBg` cannot leave the rest inconsistent.
21
+ *
22
+ * ── Every token here is read by something ───────────────────────────────────
23
+ * Twenty-one used to be listed that nothing in the package consumed:
24
+ * `ring`, the four `input*` tokens, `primarySoft*`, `primaryBorder`,
25
+ * `onPrimarySoft`, `onAccentSoft`, `inverseSurfaceHover`, `borderSubtle`,
26
+ * `surfaceSunken`, `shadowSm`, `shadowLg`, the four `code*` tokens and the two
27
+ * `skeleton*` tokens. They had CSS defaults, they type-checked, they appeared
28
+ * in the docs — and setting any of them did nothing, because no rule ever read
29
+ * the variable.
30
+ *
31
+ * The `input*` four are the ones worth knowing about: inputs are styled from
32
+ * `surface` / `border` / `text` / `textSubtle` directly, in the scoped CSS of
33
+ * InputText.vue, Select.vue and DatePicker.vue. The dark palette's "a field
34
+ * darker than its panel reads as an input" intent was never realised. Removing
35
+ * them changes nothing on screen — they were already inert — but it stops the
36
+ * type surface promising a control the editor does not offer. Wiring them up
37
+ * instead is three small scoped-CSS edits, if that look is wanted.
38
+ *
39
+ * `codeBg` and friends belong to the host dashboard's own CodeBlock component,
40
+ * never to the editor, which renders no code panels at all.
20
41
  */
21
42
  export interface ThemeTokens {
22
43
  /** Brand/accent colour. Drives the primary button, focus rings, selection. */
@@ -27,13 +48,16 @@ export interface ThemeTokens {
27
48
  onPrimary?: string;
28
49
  /** Page background behind the canvas. */
29
50
  background?: string;
30
- /** Panels, header, toolbars, popovers. */
51
+ /** Panels, header, toolbars, popovers — and, because inputs read it
52
+ * directly, field backgrounds. */
31
53
  surface?: string;
32
54
  /** Subtle fills — inactive tabs, secondary buttons. */
33
55
  surfaceMuted?: string;
56
+ /** Hover fill, and the background of a disabled input. */
34
57
  surfaceHover?: string;
35
58
  text?: string;
36
59
  textMuted?: string;
60
+ /** Also the input placeholder colour. */
37
61
  textSubtle?: string;
38
62
  border?: string;
39
63
  borderStrong?: string;
@@ -42,9 +66,7 @@ export interface ThemeTokens {
42
66
  success?: string;
43
67
  warning?: string;
44
68
  info?: string;
45
- /** Focus ring colour. Defaults to `primary`. */
46
- ring?: string;
47
- /** Box-shadow used by popovers and dialogs. */
69
+ /** Box-shadow used by popovers and dialogs. Feeds `overlayShadow`. */
48
70
  shadow?: string;
49
71
  /** Backdrop behind modal dialogs. */
50
72
  scrim?: string;
@@ -58,10 +80,6 @@ export interface ThemeTokens {
58
80
  accentBg?: string;
59
81
  accentText?: string;
60
82
  canvasBg?: string;
61
- inputBg?: string;
62
- inputText?: string;
63
- inputBorder?: string;
64
- inputPlaceholder?: string;
65
83
  /** Dialogs, toasts, dropdowns, date picker and floating toolbars. */
66
84
  overlayBg?: string;
67
85
  overlayText?: string;
@@ -83,7 +101,7 @@ export interface ThemeTokens {
83
101
  /** Same role as `selection`, one level up: row outlines, the row's
84
102
  * floating toolbar, and "this is a row" indicators in the Layout tab
85
103
  * and Layers panel. Separate token so components and rows can be told
86
- * apart at a glance */
104
+ * apart at a glance. */
87
105
  rowSelection?: string;
88
106
  rowSelectionBg?: string;
89
107
  rowSelectionFg?: string;
@@ -112,15 +130,34 @@ export interface ThemeTokens {
112
130
  dangerBg?: string;
113
131
  dangerFg?: string;
114
132
  dangerBorder?: string;
133
+ /** The dark pill — primary CTA, active tab. FLIPS to a light fill in dark
134
+ * mode. Use this, not `text`, for any dark-filled control: a text token
135
+ * cannot invert that way without making body copy invisible. */
136
+ inverseSurface?: string;
137
+ onInverse?: string;
138
+ onInverseMuted?: string;
139
+ /** Secondary signal, distinct from `primary`. Used for AI surfaces and the
140
+ * row-selection family. */
141
+ accent?: string;
142
+ accentHover?: string;
143
+ onAccent?: string;
144
+ accentSoft?: string;
145
+ accentBorder?: string;
115
146
  }
116
147
  export interface ThemeOptions extends ThemeTokens {
117
148
  /** Tokens applied only in light mode. */
118
149
  light?: ThemeTokens;
119
150
  /**
120
- * Tokens applied only when the editor has the `dark` class.
151
+ * Tokens applied only when the editor is in dark mode.
121
152
  *
122
153
  * Dark mode has its own complete set of defaults, so overriding a couple of
123
154
  * tokens here is enough — you do not have to restate a whole palette.
155
+ *
156
+ * "In dark mode" means the editor root carries the `dark` class, which
157
+ * useColorScheme.ts puts there by mirroring the host page's own `.dark` on
158
+ * <html> or <body>. A host with a working theme switcher needs no wiring;
159
+ * one whose switcher works some other way passes `colorMode` to
160
+ * <EmailEditor> instead.
124
161
  */
125
162
  dark?: ThemeTokens;
126
163
  /** @deprecated Use `primary`. */
@@ -139,10 +176,24 @@ export interface ThemeOptions extends ThemeTokens {
139
176
  * });
140
177
  * ```
141
178
  *
142
- * @param target For the plain Vue build, omit defaults to
143
- * `document.documentElement`. For the custom-element build, pass the
144
- * `<maildeno-editor>` element, so the properties cascade into its shadow
145
- * tree. `handle.setTheme()` does this for you.
179
+ * @param target Where the tokens are declared. **This must be the editor's own
180
+ * root element**, and <EmailEditor> passes it for you — the default below is
181
+ * only for callers driving the CSS variables by hand, with no editor
182
+ * mounted.
183
+ *
184
+ * Why it matters: the library build runs every injected stylesheet through
185
+ * scopeInjectedCss.ts, which rewrites `:root`/`:host` to `.md-editor-scope`
186
+ * so the editor's CSS cannot restyle the host page. That puts the package's
187
+ * default tokens *directly on the editor root div*. A custom property
188
+ * declared on an element beats any value inherited from an ancestor,
189
+ * whatever the specificity — so a theme written to <html> is shadowed by the
190
+ * defaults and never reaches the editor at all. Writing to the same element
191
+ * the defaults land on puts the two in the same cascade, where the runtime
192
+ * sheet wins on source order.
193
+ *
194
+ * This is also why theming appeared to work when running from source (the
195
+ * playground aliases straight to `src` and never runs the scoper, so `:root`
196
+ * stays `:root`) and silently did nothing in a consuming app.
146
197
  */
147
198
  export declare function setEditorTheme(options: ThemeOptions, target?: HTMLElement): void;
148
199
  /**
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The canvas API handed to a host-supplied assistant panel.
3
+ *
4
+ * Defined once here rather than inline in each place it appears, because it
5
+ * shows up in three: the #assistant slot's prop, assistant.mount()'s second
6
+ * argument, and EditorHandle. Three structural copies would drift the first
7
+ * time a method is added, and the drift would be silent — a slot typed with
8
+ * five methods and a callback typed with four both compile fine.
9
+ *
10
+ * A read/write subset of what EmailEditor exposes, not the whole surface.
11
+ * An assistant needs to see the canvas, change it, and know when it moved.
12
+ * It has no business calling destroy() or re-theming the editor, so those
13
+ * are absent rather than present-and-discouraged.
14
+ */
15
+ export interface EditorWriteApi {
16
+ /** Current template as a plain object, or null when the canvas is empty. */
17
+ getJson(): Record<string, unknown> | null;
18
+ /**
19
+ * Replaces the canvas. Accepts what getJson() returns.
20
+ *
21
+ * Defaults to an undoable step, which is almost always what an assistant
22
+ * wants: a user who dislikes a generated design presses Ctrl+Z and has
23
+ * their own work back. Passing "reset" throws that away, so it is for
24
+ * document swaps rather than edits.
25
+ */
26
+ setJson(data: unknown, opts?: {
27
+ history?: "undoable" | "reset";
28
+ }): void;
29
+ /** The selected block, or null. `type` is the block type ("paragraph",
30
+ * "image"), which is what a "rewrite this heading" flow branches on. */
31
+ getSelection(): {
32
+ id: string;
33
+ type: string | null;
34
+ } | null;
35
+ /** Selects by id, or clears with null. False if no block has that id. */
36
+ setSelection(id: string | null): boolean;
37
+ /** Runs after each committed change. Returns an unsubscribe function —
38
+ * call it when the panel tears down, or the callback outlives the panel
39
+ * and fires against a dead component. */
40
+ onChange(cb: () => void): () => void;
41
+ }
42
+ /**
43
+ * How an init()/custom-element host fills the assistant drawer.
44
+ *
45
+ * Imperative rather than a component, because that path has no framework in
46
+ * common with the editor — a React host renders with createRoot into the
47
+ * element, a vanilla host sets innerHTML, and neither should need to know
48
+ * Vue exists.
49
+ */
50
+ export interface AssistantMount {
51
+ /** Called on first open, with the drawer's body element. */
52
+ mount: (el: HTMLElement, editor: EditorWriteApi) => void;
53
+ /** Called on close and on editor teardown. Tear down listeners and any
54
+ * framework root here; the editor only empties the element after this. */
55
+ unmount?: (el: HTMLElement) => void;
56
+ }