@seliseblocks/mailcraft 0.2.14 → 0.2.16
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 +17 -0
- package/DOCS.md +5 -4
- package/README.md +2 -1
- package/README.md.txt +2 -1
- package/dist/mailcraft-editor.bundle.js +71 -71
- package/dist/mailcraft-editor.bundle.js.map +3 -3
- package/examples/templates/back-in-stock.html +1 -8
- package/examples/templates/cart-left-behind.html +1 -8
- package/examples/templates/meet-nova-launch.html +5 -0
- package/examples/templates/rate-your-headphones.html +1 -8
- package/examples/templates/the-sunday-brief.html +5 -0
- package/examples/templates/your-order-shipped.html +1 -0
- package/examples/vanilla.html +14 -24
- package/package.json +1 -1
- package/src/core/i18n/ar.js +2 -1
- package/src/core/i18n/bg.js +2 -1
- package/src/core/i18n/bn.js +2 -1
- package/src/core/i18n/ca.js +2 -1
- package/src/core/i18n/cs.js +2 -1
- package/src/core/i18n/da.js +2 -1
- package/src/core/i18n/de-CH.js +2 -1
- package/src/core/i18n/de.js +2 -1
- package/src/core/i18n/dz.js +2 -1
- package/src/core/i18n/el.js +2 -1
- package/src/core/i18n/en.js +2 -1
- package/src/core/i18n/es.js +2 -1
- package/src/core/i18n/et.js +2 -1
- package/src/core/i18n/fi.js +2 -1
- package/src/core/i18n/fr.js +2 -1
- package/src/core/i18n/hr.js +2 -1
- package/src/core/i18n/hu.js +2 -1
- package/src/core/i18n/index.js +83 -83
- package/src/core/i18n/it.js +2 -1
- package/src/core/i18n/lt.js +2 -1
- package/src/core/i18n/lv.js +2 -1
- package/src/core/i18n/nb.js +2 -1
- package/src/core/i18n/nl.js +2 -1
- package/src/core/i18n/pl.js +2 -1
- package/src/core/i18n/pt.js +2 -1
- package/src/core/i18n/ro.js +2 -1
- package/src/core/i18n/ru.js +2 -1
- package/src/core/i18n/sk.js +2 -1
- package/src/core/i18n/sl.js +2 -1
- package/src/core/i18n/sv.js +2 -1
- package/src/core/i18n/tr.js +2 -1
- package/src/core/i18n/uk.js +2 -1
- package/src/core/ids.js +1 -1
- package/src/core/layout-style.js +100 -100
- package/src/core/parse.js +10 -10
- package/src/core/placeholder.js +15 -15
- package/src/core/variables.js +11 -11
- package/src/mailcraft-editor.js +26 -10
- package/src/render/focus-preserve.js +158 -158
- package/src/render/screenshot.js +95 -7
- package/src/render/story.js +541 -415
- package/src/render/style.js +1 -1
- package/types/index.d.ts +22 -7
package/src/render/style.js
CHANGED
|
@@ -108,7 +108,7 @@ export const STYLE = `
|
|
|
108
108
|
@keyframes mcIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
|
|
109
109
|
@keyframes mcFade { from { opacity: 0; } to { opacity: 1; } }
|
|
110
110
|
@keyframes mcPulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
|
|
111
|
-
@keyframes mcStoryShimmer { from {
|
|
111
|
+
@keyframes mcStoryShimmer { from { transform: translateX(-110%); } to { transform: translateX(280%); } }
|
|
112
112
|
|
|
113
113
|
/*
|
|
114
114
|
* Hover/selection outlines on canvas rows and blocks. Re-rendering on every
|
package/types/index.d.ts
CHANGED
|
@@ -228,6 +228,16 @@ export interface Template {
|
|
|
228
228
|
build?: () => EmailDocument;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
/** Compression options for `screenshotPng` and `downloadScreenshot`. */
|
|
232
|
+
export interface ScreenshotOptions {
|
|
233
|
+
/** `'png'` (default) is lossless; `'jpeg'`/`'webp'` are compressed and much smaller. */
|
|
234
|
+
format?: 'png' | 'jpeg' | 'webp';
|
|
235
|
+
/** Encoder quality for the lossy formats, 0–1. Default 0.85. Ignored for PNG. */
|
|
236
|
+
quality?: number;
|
|
237
|
+
/** Device-pixel multiplier. Default 2; use 1 for a smaller file at screen resolution. */
|
|
238
|
+
scale?: number;
|
|
239
|
+
}
|
|
240
|
+
|
|
231
241
|
// ---------------------------------------------------------------------------
|
|
232
242
|
// The element
|
|
233
243
|
|
|
@@ -291,14 +301,19 @@ export class MailCraftEditor extends HTMLElement {
|
|
|
291
301
|
undo(): void;
|
|
292
302
|
redo(): void;
|
|
293
303
|
|
|
294
|
-
/**
|
|
295
|
-
|
|
304
|
+
/**
|
|
305
|
+
* The full template as an image Blob. PNG (the default) is lossless;
|
|
306
|
+
* `format: 'jpeg' | 'webp'` with an optional `quality` produces a much
|
|
307
|
+
* smaller, compressed file. Read the returned `blob.type` for what was
|
|
308
|
+
* actually encoded — a browser without a WebP encoder hands back PNG.
|
|
309
|
+
*/
|
|
310
|
+
screenshotPng(options?: ScreenshotOptions): Promise<Blob>;
|
|
296
311
|
|
|
297
|
-
/** Opens the story-style screenshot viewer. */
|
|
312
|
+
/** Opens the story-style screenshot viewer (it has its own PNG/JPG/WebP download toggle). */
|
|
298
313
|
previewScreenshot(): void;
|
|
299
314
|
|
|
300
|
-
/** Saves a screenshot — captures first if no blob is passed. */
|
|
301
|
-
downloadScreenshot(blob?: Blob): Promise<void>;
|
|
315
|
+
/** Saves a screenshot — captures first (with `options`) if no blob is passed. The filename extension follows the blob's actual type. */
|
|
316
|
+
downloadScreenshot(blob?: Blob, options?: ScreenshotOptions): Promise<void>;
|
|
302
317
|
|
|
303
318
|
/** Copies a screenshot to the clipboard — captures first if no blob is passed. */
|
|
304
319
|
copyScreenshot(blob?: Blob): Promise<void>;
|
|
@@ -377,9 +392,9 @@ export interface EditorHandle {
|
|
|
377
392
|
loadTemplate(tpl: Template): void;
|
|
378
393
|
undo(): void;
|
|
379
394
|
redo(): void;
|
|
380
|
-
screenshotPng(): Promise<Blob>;
|
|
395
|
+
screenshotPng(options?: ScreenshotOptions): Promise<Blob>;
|
|
381
396
|
previewScreenshot(): void;
|
|
382
|
-
downloadScreenshot(blob?: Blob): Promise<void>;
|
|
397
|
+
downloadScreenshot(blob?: Blob, options?: ScreenshotOptions): Promise<void>;
|
|
383
398
|
copyScreenshot(blob?: Blob): Promise<void>;
|
|
384
399
|
}
|
|
385
400
|
|