@boxcc/maildeno-editor 0.0.0-stage → 0.4.13
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 +479 -0
- package/README.md +441 -2
- package/dist/DatePicker-AdfGW0Tw.js +5347 -0
- package/dist/DatePicker-aNFlsoOb.js +5347 -0
- package/dist/Dialog-By0JLN8s.js +6294 -0
- package/dist/HealthIndicator-4Iw6N-g_.js +1216 -0
- package/dist/HealthIndicator-ZohgzF2_.js +1217 -0
- package/dist/PopperContent-N2nAEFeH.js +2538 -0
- package/dist/PopperContent-eLmz1Gjd.js +2578 -0
- package/dist/PreviewCanvas-DzpLghCo.js +534 -0
- package/dist/PreviewCanvas-QN4C68KA.js +534 -0
- package/dist/RichTextEditor-CmM4XRFC.js +12218 -0
- package/dist/RichTextEditor-Cz1-_ZtA.js +12217 -0
- package/dist/RowPreviewChildren-BYaMZID3.js +4 -0
- package/dist/RowPreviewChildren-_A9gPQCs.js +4 -0
- package/dist/RowPreviewLegacyComponent-Df_1HTly.js +403 -0
- package/dist/RowPreviewLegacyComponent-NECG3wpn.js +403 -0
- package/dist/RowPreviewRow-DPaSbxmB.js +81 -0
- package/dist/RowPreviewRow-Dx4ExtSN.js +81 -0
- package/dist/SavedRowsPanel-DqSHB6Jk.js +492 -0
- package/dist/SavedRowsPanel-DyXjSOEt.js +493 -0
- package/dist/_plugin-vue_export-helper-Dj7HTbfw.js +8 -0
- package/dist/adapters/errors.d.ts +59 -0
- package/dist/adapters/localStorageAdapter.d.ts +6 -0
- package/dist/adapters/types.d.ts +151 -0
- package/dist/babel-DV7WPQI0.js +10043 -0
- package/dist/blocks/registry.d.ts +23 -0
- package/dist/blocks/types.d.ts +73 -0
- package/dist/borderRadius-CkSa1lQ9.js +75 -0
- package/dist/components/features/emailBuilder/EmailEditor.vue.d.ts +182 -0
- package/dist/composables/emailBuilder/export/logic/espLogicWrapper.d.ts +76 -0
- package/dist/composables/emailBuilder/persistence/useEmailBuilderPersistence.d.ts +38 -0
- package/dist/composables/emailBuilder/transform/pipeline/optimize.d.ts +100 -0
- package/dist/composables/system/useColorScheme.d.ts +16 -0
- package/dist/element-B3gq8Xvd.js +21500 -0
- package/dist/element.d.ts +6 -0
- package/dist/element.js +5 -0
- package/dist/esp/registry.d.ts +33 -0
- package/dist/estree-DY9POgc0.js +8195 -0
- package/dist/html-wb0gSX1o.js +7273 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +14992 -0
- package/dist/init.d.ts +178 -0
- package/dist/init.js +137 -0
- package/dist/maildeno-editor.css +2 -0
- package/dist/merge-tags/registry.d.ts +33 -0
- package/dist/mergeTagDefinitions-Cler19nv.js +27 -0
- package/dist/standalone-DHvJ30Td.js +3554 -0
- package/dist/theme.d.ts +206 -0
- package/dist/types/assistant.d.ts +56 -0
- package/dist/useEmailBuilder-B19p-2yp.js +4924 -0
- package/dist/useEmailBuilder-BR4wfai1.js +4924 -0
- package/dist/useToast-DD11IxqP.js +194 -0
- package/dist/utils/border.d.ts +15 -0
- package/dist/utils/borderRadius.d.ts +10 -0
- package/dist/vue.runtime.esm-bundler-D2AjRP90.js +6117 -0
- package/package.json +100 -4
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theming via CSS custom properties.
|
|
3
|
+
*
|
|
4
|
+
* Setting variables rather than regenerating a stylesheet is what makes this
|
|
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 editor
|
|
7
|
+
* root cascades into the whole subtree and updates every rule reading it,
|
|
8
|
+
* live.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Every themeable token.
|
|
12
|
+
*
|
|
13
|
+
* Two layers, deliberately. Core tokens (`primary`, `surface`, `text`, …)
|
|
14
|
+
* re-theme the whole editor coherently. Semantic tokens (`headerBg`,
|
|
15
|
+
* `overlayBg`, `toolbarBg`, …) default to the core ones and exist for hosts
|
|
16
|
+
* that want to change one surface without redefining everything else.
|
|
17
|
+
*
|
|
18
|
+
* Anything left out keeps its default, so a partial theme is always coherent
|
|
19
|
+
* rather than half-applied — setting only `primary` cannot produce unreadable
|
|
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.
|
|
41
|
+
*/
|
|
42
|
+
export interface ThemeTokens {
|
|
43
|
+
/** Brand/accent colour. Drives the primary button, focus rings, selection. */
|
|
44
|
+
primary?: string;
|
|
45
|
+
primaryHover?: string;
|
|
46
|
+
/** Text/icon colour on top of `primary`. Set this when using a light brand
|
|
47
|
+
* colour, or the primary button's label will be unreadable. */
|
|
48
|
+
onPrimary?: string;
|
|
49
|
+
/** Page background behind the canvas. */
|
|
50
|
+
background?: string;
|
|
51
|
+
/** Panels, header, toolbars, popovers — and, because inputs read it
|
|
52
|
+
* directly, field backgrounds. */
|
|
53
|
+
surface?: string;
|
|
54
|
+
/** Subtle fills — inactive tabs, secondary buttons. */
|
|
55
|
+
surfaceMuted?: string;
|
|
56
|
+
/** Hover fill, and the background of a disabled input. */
|
|
57
|
+
surfaceHover?: string;
|
|
58
|
+
text?: string;
|
|
59
|
+
textMuted?: string;
|
|
60
|
+
/** Also the input placeholder colour. */
|
|
61
|
+
textSubtle?: string;
|
|
62
|
+
border?: string;
|
|
63
|
+
borderStrong?: string;
|
|
64
|
+
danger?: string;
|
|
65
|
+
onDanger?: string;
|
|
66
|
+
success?: string;
|
|
67
|
+
warning?: string;
|
|
68
|
+
info?: string;
|
|
69
|
+
/** Box-shadow used by popovers and dialogs. Feeds `overlayShadow`. */
|
|
70
|
+
shadow?: string;
|
|
71
|
+
/** Backdrop behind modal dialogs. */
|
|
72
|
+
scrim?: string;
|
|
73
|
+
headerBg?: string;
|
|
74
|
+
headerText?: string;
|
|
75
|
+
headerBorder?: string;
|
|
76
|
+
sidebarBg?: string;
|
|
77
|
+
sidebarText?: string;
|
|
78
|
+
sidebarBorder?: string;
|
|
79
|
+
/** Selected tab / segmented-control fill. Defaults to `primary`. */
|
|
80
|
+
accentBg?: string;
|
|
81
|
+
accentText?: string;
|
|
82
|
+
canvasBg?: string;
|
|
83
|
+
/** Dialogs, toasts, dropdowns, date picker and floating toolbars. */
|
|
84
|
+
overlayBg?: string;
|
|
85
|
+
overlayText?: string;
|
|
86
|
+
overlayBorder?: string;
|
|
87
|
+
overlayShadow?: string;
|
|
88
|
+
toolbarBg?: string;
|
|
89
|
+
toolbarText?: string;
|
|
90
|
+
toolbarBorder?: string;
|
|
91
|
+
/** Canvas component-selection accent. Drives hover/selected outlines on
|
|
92
|
+
* canvas components, the floating action bar's ring, and drag/drop
|
|
93
|
+
* indicators. Kept independent of `primary` so the brand button and the
|
|
94
|
+
* canvas's own interaction colour can differ — as they do by default
|
|
95
|
+
* (a dark brand button, a green canvas accent). */
|
|
96
|
+
selection?: string;
|
|
97
|
+
/** Pale fill for `selection` — hover backgrounds on the same controls. */
|
|
98
|
+
selectionBg?: string;
|
|
99
|
+
/** Readable text/icon tone for `selection` when placed on `selectionBg`. */
|
|
100
|
+
selectionFg?: string;
|
|
101
|
+
/** Same role as `selection`, one level up: row outlines, the row's
|
|
102
|
+
* floating toolbar, and "this is a row" indicators in the Layout tab
|
|
103
|
+
* and Layers panel. Separate token so components and rows can be told
|
|
104
|
+
* apart at a glance. */
|
|
105
|
+
rowSelection?: string;
|
|
106
|
+
rowSelectionBg?: string;
|
|
107
|
+
rowSelectionFg?: string;
|
|
108
|
+
/** Small dark tooltips on icon buttons throughout the canvas and
|
|
109
|
+
* toolbars. Kept distinct from `overlay` because tooltips are
|
|
110
|
+
* conventionally dark even in an otherwise light theme; set both if you
|
|
111
|
+
* want them to follow the rest of the theme instead. */
|
|
112
|
+
tooltipBg?: string;
|
|
113
|
+
tooltipText?: string;
|
|
114
|
+
/** The Save / Update button — the most commonly branded control. */
|
|
115
|
+
buttonPrimaryBg?: string;
|
|
116
|
+
buttonPrimaryText?: string;
|
|
117
|
+
buttonPrimaryHoverBg?: string;
|
|
118
|
+
buttonSecondaryBg?: string;
|
|
119
|
+
buttonSecondaryText?: string;
|
|
120
|
+
buttonSecondaryHoverBg?: string;
|
|
121
|
+
successBg?: string;
|
|
122
|
+
successFg?: string;
|
|
123
|
+
successBorder?: string;
|
|
124
|
+
infoBg?: string;
|
|
125
|
+
infoFg?: string;
|
|
126
|
+
infoBorder?: string;
|
|
127
|
+
warningBg?: string;
|
|
128
|
+
warningFg?: string;
|
|
129
|
+
warningBorder?: string;
|
|
130
|
+
dangerBg?: string;
|
|
131
|
+
dangerFg?: string;
|
|
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;
|
|
146
|
+
}
|
|
147
|
+
export interface ThemeOptions extends ThemeTokens {
|
|
148
|
+
/** Tokens applied only in light mode. */
|
|
149
|
+
light?: ThemeTokens;
|
|
150
|
+
/**
|
|
151
|
+
* Tokens applied only when the editor is in dark mode.
|
|
152
|
+
*
|
|
153
|
+
* Dark mode has its own complete set of defaults, so overriding a couple of
|
|
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.
|
|
161
|
+
*/
|
|
162
|
+
dark?: ThemeTokens;
|
|
163
|
+
/** @deprecated Use `primary`. */
|
|
164
|
+
primaryColor?: string;
|
|
165
|
+
/** @deprecated Use `surface`. */
|
|
166
|
+
surfaceColor?: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Applies theme tokens.
|
|
170
|
+
*
|
|
171
|
+
* ```ts
|
|
172
|
+
* setEditorTheme({
|
|
173
|
+
* primary: "#6366f1",
|
|
174
|
+
* buttonPrimaryText: "#ffffff",
|
|
175
|
+
* dark: { primary: "#818cf8", headerBg: "#0f172a" },
|
|
176
|
+
* });
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
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.
|
|
197
|
+
*/
|
|
198
|
+
export declare function setEditorTheme(options: ThemeOptions, target?: HTMLElement): void;
|
|
199
|
+
/**
|
|
200
|
+
* Expands one hex colour into a 50–950 shade scale.
|
|
201
|
+
*
|
|
202
|
+
* The editor's own tokens no longer need this — `primary` and
|
|
203
|
+
* `primaryHover` are set directly — but it stays exported because hosts use
|
|
204
|
+
* it to derive matching shades for their own UI around the editor.
|
|
205
|
+
*/
|
|
206
|
+
export declare function palette(hex: string): Record<string, string>;
|
|
@@ -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
|
+
}
|