@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.
- package/CHANGELOG.md +258 -0
- package/README.md +397 -381
- package/dist/RowPreviewChildren-DT0y0lKC.js +4 -0
- package/dist/RowPreviewChildren-OsbF7_vu.js +4 -0
- package/dist/RowPreviewLegacyComponent-BV4b5bHQ.js +487 -0
- package/dist/RowPreviewLegacyComponent-C08MGJVT.js +487 -0
- package/dist/RowPreviewRow-ByxeBYV8.js +112 -0
- package/dist/RowPreviewRow-N-hh5l_H.js +112 -0
- package/dist/adapters/errors.d.ts +59 -0
- package/dist/adapters/index.d.ts +31 -0
- package/dist/adapters/types.d.ts +68 -0
- package/dist/brand.d.ts +15 -0
- package/dist/components/DesktopOnlyNotice.vue.d.ts +20 -0
- package/dist/components/features/emailBuilder/EmailEditor.vue.d.ts +182 -0
- package/dist/components/features/emailBuilder/assistant/AssistantPanel.vue.d.ts +37 -0
- package/dist/components/features/emailBuilder/blocks/AnchorBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/blocks/ButtonBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/blocks/DividerBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/blocks/HeadingBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/blocks/ImageBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/blocks/ListBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/blocks/MenuBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/blocks/ParagraphBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/blocks/SocialsBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/blocks/SpacerBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/blocks/VideoBlock.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/canvas/Canvas.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/canvas/CanvasColumn.vue.d.ts +49 -0
- package/dist/components/features/emailBuilder/canvas/CanvasComponent.vue.d.ts +56 -0
- package/dist/components/features/emailBuilder/canvas/CanvasElement.vue.d.ts +21 -0
- package/dist/components/features/emailBuilder/canvas/CanvasRow.vue.d.ts +49 -0
- package/dist/components/features/emailBuilder/canvas/CanvasRowSpacer.vue.d.ts +40 -0
- package/dist/components/features/emailBuilder/health/HealthIndicator.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/layout/Header.vue.d.ts +54 -0
- package/dist/components/features/emailBuilder/layout/SendEmail.vue.d.ts +21 -0
- package/dist/components/features/emailBuilder/layout/SidebarLeft.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/layout/SidebarRight.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/AnchorPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/ButtonPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/DividerPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/HeadingPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/ImagePanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/ListPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/MenuPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/ParagraphPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/RowColumnPanel.vue.d.ts +13 -0
- package/dist/components/features/emailBuilder/panels/RowPanel.vue.d.ts +13 -0
- package/dist/components/features/emailBuilder/panels/RowSpacerPanel.vue.d.ts +13 -0
- package/dist/components/features/emailBuilder/panels/SocialsPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/SpacerPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/VideoPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/panels/shared/DeviceTabs.vue.d.ts +19 -0
- package/dist/components/features/emailBuilder/panels/shared/LinkFieldMergeTags.vue.d.ts +31 -0
- package/dist/components/features/emailBuilder/panels/shared/OverrideBadge.vue.d.ts +9 -0
- package/dist/components/features/emailBuilder/panels/shared/PreviewBadge.vue.d.ts +11 -0
- package/dist/components/features/emailBuilder/panels/shared/TextFieldMergeTags.vue.d.ts +25 -0
- package/dist/components/features/emailBuilder/panels/ui/BoxStylingSection.vue.d.ts +7 -0
- package/dist/components/features/emailBuilder/panels/ui/PropertyAlignment.vue.d.ts +30 -0
- package/dist/components/features/emailBuilder/panels/ui/PropertyColor.vue.d.ts +75 -0
- package/dist/components/features/emailBuilder/panels/ui/PropertyGradientColor.vue.d.ts +27 -0
- package/dist/components/features/emailBuilder/panels/ui/PropertyNumberSlider.vue.d.ts +74 -0
- package/dist/components/features/emailBuilder/panels/ui/PropertySection.vue.d.ts +17 -0
- package/dist/components/features/emailBuilder/panels/ui/PropertySelect.vue.d.ts +74 -0
- package/dist/components/features/emailBuilder/panels/ui/PropertyTextStyle.vue.d.ts +52 -0
- package/dist/components/features/emailBuilder/panels/ui/PropertyTextStylePanel.vue.d.ts +72 -0
- package/dist/components/features/emailBuilder/panels/ui/PropertyToggle.vue.d.ts +45 -0
- package/dist/components/features/emailBuilder/panels/ui/PropertyVisibility.vue.d.ts +32 -0
- package/dist/components/features/emailBuilder/panels/ui/SpacingControl.vue.d.ts +19 -0
- package/dist/components/features/emailBuilder/panels/ui/color-picker/AlphaSlider.vue.d.ts +28 -0
- package/dist/components/features/emailBuilder/panels/ui/color-picker/ColorPickerPanel.vue.d.ts +31 -0
- package/dist/components/features/emailBuilder/panels/ui/color-picker/HueSlider.vue.d.ts +19 -0
- package/dist/components/features/emailBuilder/panels/ui/color-picker/RecentColors.vue.d.ts +20 -0
- package/dist/components/features/emailBuilder/panels/ui/color-picker/SVPanel.vue.d.ts +39 -0
- package/dist/components/features/emailBuilder/panels/ui/visibility-rule/Rule.vue.d.ts +28 -0
- package/dist/components/features/emailBuilder/preview/PreviewScreen.vue.d.ts +7 -0
- package/dist/components/features/emailBuilder/preview/ui/PreviewCanvas.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/preview/ui/PreviewCapabilityBadges.vue.d.ts +12 -0
- package/dist/components/features/emailBuilder/preview/ui/PreviewClientCard.vue.d.ts +20 -0
- package/dist/components/features/emailBuilder/preview/ui/PreviewClientList.vue.d.ts +21 -0
- package/dist/components/features/emailBuilder/preview/ui/PreviewClientPicker.vue.d.ts +16 -0
- package/dist/components/features/emailBuilder/preview/ui/PreviewComponent.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/preview/ui/PreviewDetailView.vue.d.ts +41 -0
- package/dist/components/features/emailBuilder/preview/ui/PreviewRendered.vue.d.ts +8 -0
- package/dist/components/features/emailBuilder/product/RowPreview.vue.d.ts +8 -0
- package/dist/components/features/emailBuilder/product/RowPreviewChildren.vue.d.ts +14 -0
- package/dist/components/features/emailBuilder/product/RowPreviewLegacyComponent.vue.d.ts +14 -0
- package/dist/components/features/emailBuilder/product/RowPreviewRow.vue.d.ts +9 -0
- package/dist/components/features/emailBuilder/product/SavedRowsPanel.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/product/SavedTemplatesPanel.vue.d.ts +13 -0
- package/dist/components/features/emailBuilder/product/VersionHistoryPanel.vue.d.ts +14 -0
- package/dist/components/features/emailBuilder/sidebar/SidebarBlockButton.vue.d.ts +35 -0
- package/dist/components/features/emailBuilder/tabs/GeneralTab.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/tabs/LayoutTab.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/tabs/content/ContentTab.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/tabs/content/LayersPanel.vue.d.ts +7 -0
- package/dist/components/features/emailBuilder/tabs/general/MergeTagsTab.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/tabs/general/StylesTab.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/tabs/general/VisibilityTab.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/tabs/general/VisibilityWrapESPTab.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/tabs/general/merge-tags/LinkTagTab.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/tabs/general/merge-tags/MergeTagTab.vue.d.ts +3 -0
- package/dist/components/features/emailBuilder/ui/LinkInputDialog.vue.d.ts +17 -0
- package/dist/components/features/emailBuilder/ui/canvas/CanvasRowDropZone.vue.d.ts +12 -0
- package/dist/components/features/emailBuilder/ui/canvas/DropZone.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/canvas/Loader.vue.d.ts +19 -0
- package/dist/components/features/emailBuilder/ui/layers-panel/ComponentIcon.vue.d.ts +7 -0
- package/dist/components/features/emailBuilder/ui/layers-panel/LayerColumnChildren.vue.d.ts +42 -0
- package/dist/components/features/emailBuilder/ui/layers-panel/LayerDropLine.vue.d.ts +8 -0
- package/dist/components/features/emailBuilder/ui/renderers/AnchorRenderer.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/renderers/DividerRenderer.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/renderers/HeadingRenderer.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/renderers/ImageRenderer.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/renderers/ListRenderer.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/renderers/MenuRenderer.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/renderers/ParagraphRenderer.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/renderers/SocialsRenderer.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/renderers/SpacerRenderer.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/renderers/VideoRenderer.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/rich-text-editor/RichTextEditor.vue.d.ts +12 -0
- package/dist/components/features/emailBuilder/ui/rich-text-editor/pickers/MergeTagPicker.vue.d.ts +18 -0
- package/dist/components/features/emailBuilder/ui/rich-text-editor/pickers/RichTextColorPicker.vue.d.ts +15 -0
- package/dist/components/features/emailBuilder/ui/visibility/SupportBadge.vue.d.ts +10 -0
- package/dist/components/features/emailBuilder/ui/visibility/VisibilityPopover.vue.d.ts +45 -0
- package/dist/components/ui/ConfirmDialog.vue.d.ts +3 -0
- package/dist/components/ui/Icon.vue.d.ts +33 -0
- package/dist/components/ui/InfoDialog.vue.d.ts +12 -0
- package/dist/components/ui/Loading.vue.d.ts +6 -0
- package/dist/components/ui/ShadowSafeToast.vue.d.ts +3 -0
- package/dist/components/ui/primitives/Button.vue.d.ts +23 -0
- package/dist/components/ui/primitives/DatePicker.vue.d.ts +16 -0
- package/dist/components/ui/primitives/Dialog.vue.d.ts +34 -0
- package/dist/components/ui/primitives/InputText.vue.d.ts +29 -0
- package/dist/components/ui/primitives/Message.vue.d.ts +20 -0
- package/dist/components/ui/primitives/Select.vue.d.ts +22 -0
- package/dist/composables/emailBuilder/components/useSystemRows.d.ts +22 -0
- package/dist/composables/emailBuilder/core/ui/useLayerHoverScroll.d.ts +10 -10
- package/dist/composables/emailBuilder/core/useEmailBuilder.d.ts +18 -0
- package/dist/composables/emailBuilder/export/logic/espLogicWrapper.d.ts +4 -4
- package/dist/composables/emailBuilder/export/targets/templateSnapshot.d.ts +24 -0
- package/dist/composables/emailBuilder/persistence/useEmailBuilderPersistence.d.ts +1 -1
- package/dist/composables/system/useColorScheme.d.ts +16 -0
- package/dist/editor.css +1072 -682
- package/dist/element-C2ZH0Z_i.js +86561 -0
- package/dist/element-scoped-styles.css +1072 -682
- package/dist/element.d.ts +1 -1
- package/dist/element.js +5 -2
- package/dist/estree-DBJlF9un.js +4876 -0
- package/dist/html-3PMDtB0V.js +3123 -0
- package/dist/index-DhFg3uKs.js +75864 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +16 -67053
- package/dist/init.d.ts +95 -2
- package/dist/init.js +166 -122
- package/dist/standalone-DKWMQftY.js +2391 -0
- package/dist/theme.d.ts +68 -17
- package/dist/types/assistant.d.ts +56 -0
- package/dist/typescript-l6-4tT8s.js +13240 -0
- package/package.json +6 -3
- package/dist/RowPreviewLegacyComponent-CXsY4P-R.js +0 -439
- package/dist/RowPreviewLegacyComponent-yjHSkZLz.js +0 -439
- package/dist/RowPreviewRow-CBfAnQ6o.js +0 -107
- package/dist/RowPreviewRow-CeowK6Q_.js +0 -107
- package/dist/composables/emailBuilder/transform/pipeline/optimizeAI.d.ts +0 -125
- package/dist/element-CMhqxYnE.js +0 -67099
- package/dist/estree-B67dfAo1.js +0 -7989
- package/dist/html-DGrfikay.js +0 -7353
- package/dist/standalone-Bd2oQFm3.js +0 -3639
- package/dist/typescript-C_Ru9PRN.js +0 -23184
- 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
|
|
7
|
-
* cascades into the
|
|
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
|
-
* `
|
|
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
|
-
/**
|
|
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
|
|
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
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
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
|
+
}
|