@seliseblocks/mailcraft 0.2.0 → 0.2.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/DOCS.md +10 -8
- package/README.md +4 -3
- package/README.md.txt +4 -3
- package/dist/mailcraft-editor.bundle.js +90 -51
- package/dist/mailcraft-editor.bundle.js.map +3 -3
- package/examples/templates/activate-your-account.html +1 -1
- package/examples/templates/back-in-stock.html +1 -1
- package/examples/templates/cart-left-behind.html +1 -1
- package/examples/templates/community-giveaway.html +1 -1
- package/examples/templates/frontend-futures-invite.html +1 -1
- package/examples/templates/give-25-get-25.html +1 -1
- package/examples/templates/invoice-paid.html +1 -1
- package/examples/templates/meet-nova-launch.html +1 -1
- package/examples/templates/mega-weekend-sale.html +1 -1
- package/examples/templates/order-confirmed.html +1 -1
- package/examples/templates/rate-your-headphones.html +1 -1
- package/examples/templates/reset-your-password.html +1 -1
- package/examples/templates/thankyou-promo-code.html +1 -1
- package/examples/templates/the-sunday-brief.html +1 -1
- package/examples/templates/welcome-to-your-workspace.html +1 -1
- package/examples/templates/your-order-shipped.html +1 -1
- package/examples/templates/your-password-was-changed.html +1 -1
- package/examples/templates/your-signin-code.html +1 -1
- package/examples/vanilla.html +27 -25
- package/package.json +1 -1
- package/src/core/binder.js +21 -1
- package/src/core/editor-core.js +12 -2
- package/src/core/export.js +19 -3
- package/src/core/i18n/ar.js +0 -1
- package/src/core/i18n/bg.js +0 -1
- package/src/core/i18n/bn.js +0 -1
- package/src/core/i18n/ca.js +0 -1
- package/src/core/i18n/cs.js +0 -1
- package/src/core/i18n/da.js +0 -1
- package/src/core/i18n/de-CH.js +0 -1
- package/src/core/i18n/de.js +0 -1
- package/src/core/i18n/dz.js +0 -1
- package/src/core/i18n/el.js +0 -1
- package/src/core/i18n/en.js +0 -1
- package/src/core/i18n/es.js +0 -1
- package/src/core/i18n/et.js +0 -1
- package/src/core/i18n/fi.js +0 -1
- package/src/core/i18n/fr.js +0 -1
- package/src/core/i18n/hr.js +0 -1
- package/src/core/i18n/hu.js +0 -1
- package/src/core/i18n/it.js +0 -1
- package/src/core/i18n/loaders.js +78 -0
- package/src/core/i18n/lt.js +0 -1
- package/src/core/i18n/lv.js +0 -1
- package/src/core/i18n/nb.js +0 -1
- package/src/core/i18n/nl.js +0 -1
- package/src/core/i18n/pl.js +0 -1
- package/src/core/i18n/pt.js +0 -1
- package/src/core/i18n/ro.js +0 -1
- package/src/core/i18n/ru.js +0 -1
- package/src/core/i18n/sk.js +0 -1
- package/src/core/i18n/sl.js +0 -1
- package/src/core/i18n/sv.js +0 -1
- package/src/core/i18n/tables.js +5 -4
- package/src/core/i18n/tr.js +0 -1
- package/src/core/i18n/uk.js +0 -1
- package/src/core/import-html.js +31 -0
- package/src/core/storage-limits.js +16 -11
- package/src/core/storage.js +1 -1
- package/src/core/theme.js +15 -1
- package/src/index.js +1 -0
- package/src/mailcraft-editor.js +79 -23
- package/src/render/canvas.js +43 -6
- package/src/render/fields.js +17 -0
- package/src/render/screenshot.js +7 -1
- package/src/render/style.js +503 -460
- package/types/index.d.ts +14 -2
package/DOCS.md
CHANGED
|
@@ -84,11 +84,11 @@ You write those functions next to the auth and base URL you already own, and poi
|
|
|
84
84
|
|
|
85
85
|
The same applies to AI (`.aiProvider` is one `async (prompt) => text` function) and to social icons (`.iconProvider`).
|
|
86
86
|
|
|
87
|
-
### 3. Upload policy belongs to the host
|
|
87
|
+
### 3. Upload policy belongs to the host — formats excepted
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
Sizes and counts ship undefaulted: what an email may carry depends on the sending platform's caps and the host's own product rules — none of which this package can know. With a provider wired and no `maxBytes` declared, uploads are refused rather than waved through.
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
Formats are the one default: **every image type is allowed** — JPEG, PNG, GIF, WebP, BMP, TIFF, ICO, AVIF, HEIC — unless `accept` lists a narrower set. SVG keeps its own gate below.
|
|
92
92
|
|
|
93
93
|
Two supporting details:
|
|
94
94
|
|
|
@@ -269,12 +269,12 @@ A start marker's expression field suggests the host's `variables` in a dropdown
|
|
|
269
269
|
|
|
270
270
|
## Image uploads
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
A provider and a `maxBytes` ceiling are both required. The package ships no files of its own: with no provider the library opens empty and holds only what is dropped into it — data URIs, kept in the local draft, which no email client renders. With a provider but no `maxBytes` every upload is refused.
|
|
273
273
|
|
|
274
274
|
```js
|
|
275
275
|
editor.storageLimits = {
|
|
276
|
-
accept: ['image/jpeg', 'image/png', 'image/gif'],
|
|
277
276
|
maxBytes: 2 * 1024 * 1024,
|
|
277
|
+
accept: ['image/jpeg', 'image/png', 'image/gif'], // optional: omit to allow every image type
|
|
278
278
|
maxWidth: 1600, maxHeight: 1600, // optional
|
|
279
279
|
maxFilesPerDrop: 20, // optional
|
|
280
280
|
allowSvg: false, // SVG needs this AND a place in `accept`
|
|
@@ -316,7 +316,7 @@ A provider may also carry its own `limits` object, for a backend that knows its
|
|
|
316
316
|
editor.storageProvider = { list, upload, limits: { accept: [...], maxBytes: 5e6 } };
|
|
317
317
|
```
|
|
318
318
|
|
|
319
|
-
The two are merged **per key**, with `editor.storageLimits` winning — so a provider can ship sane defaults and the host can still tighten one number without restating the rest. Either source satisfies the "
|
|
319
|
+
The two are merged **per key**, with `editor.storageLimits` winning — so a provider can ship sane defaults and the host can still tighten one number without restating the rest. Either source satisfies the "`maxBytes` is required" rule; only a file that passes the merged result reaches `upload`.
|
|
320
320
|
|
|
321
321
|
Setting `editor.storageProvider = null` drops back to that empty local library.
|
|
322
322
|
|
|
@@ -419,6 +419,8 @@ Hiding the strip collapses its row — the canvas keeps every pixel it had.
|
|
|
419
419
|
|
|
420
420
|
31 locales ship. `dir` follows the locale automatically (`locale="ar"` gives RTL) and can be overridden. While `theme` is set the host owns light/dark and the editor hides its own toggle.
|
|
421
421
|
|
|
422
|
+
Tables load lazily: in a bundled app each locale is its own code-split chunk, fetched the first time its tag is used, so you ship only the languages you render (English is always built in). The chrome shows English for the instant the chunk takes to arrive; call `loadLocale(tag)` ahead of time to have it ready before you flip the attribute. The single-file CDN bundle carries every table, so switching there is always instant.
|
|
423
|
+
|
|
422
424
|
Override any individual string:
|
|
423
425
|
|
|
424
426
|
```js
|
|
@@ -509,7 +511,7 @@ template, not to your app.
|
|
|
509
511
|
| `.accent` | string |
|
|
510
512
|
| `.messages` | `{ key: string }` |
|
|
511
513
|
| `.storageProvider` | `{ list, upload, folders?, remove?, limits? }` — `null` drops back to the empty local library |
|
|
512
|
-
| `.storageLimits` | `{ accept
|
|
514
|
+
| `.storageLimits` | `{ accept?, maxBytes, maxWidth?, maxHeight?, maxFilesPerDrop?, allowSvg? }`, merged over `provider.limits` per key |
|
|
513
515
|
| `.aiProvider` | `async (prompt) => text` |
|
|
514
516
|
| `.iconProvider` | `(platformKey, { label, size, color }) => Node` — social-icon override; falls back to the built-in icon when it is unset, throws, or returns a non-node |
|
|
515
517
|
|
|
@@ -521,6 +523,7 @@ template, not to your app.
|
|
|
521
523
|
| `isReady()` | whether the custom element is registered |
|
|
522
524
|
| `MailCraftEditor` | the element class |
|
|
523
525
|
| `LOCALES`, `LOCALE_TABLES`, `createTranslator` | i18n: the shipped tags, their tables, and the translator the editor uses |
|
|
526
|
+
| `LOCALE_LOADERS`, `loadLocale(tag)` | lazy per-locale table loading — what the `locale` attribute resolves through, so a bundled app ships only the locales it uses. `loadLocale` prefetches one (e.g. before flipping `locale` at runtime) |
|
|
524
527
|
| `defineMessages(base, overrides)` | merge a shipped locale with your own overrides — the supported way to build a `.messages` value |
|
|
525
528
|
| `missingKeys(locale, base)` | keys `base` has that `locale` does not translate. What a translator has left to do |
|
|
526
529
|
| `EN`, `MESSAGE_KEYS` | the English table and every key in it — listed in [Every message key](#every-message-key) |
|
|
@@ -686,7 +689,6 @@ The complete catalog of UI strings that `.messages` accepts — every key the ed
|
|
|
686
689
|
| `storage.errDimensions` | {name} is {w}×{ht}px — the limit is {maxW}×{maxH}px. |
|
|
687
690
|
| `storage.errFormat` | {name} is a {type} file, which is not allowed here. |
|
|
688
691
|
| `storage.errLoadFailed` | The file library could not be loaded — {reason} |
|
|
689
|
-
| `storage.errNoAccept` | Uploads are switched off: no file formats have been allowed. |
|
|
690
692
|
| `storage.errNoLimits` | Uploads are switched off: this app has not set any upload limits. |
|
|
691
693
|
| `storage.errNoMaxBytes` | Uploads are switched off: no maximum file size has been set. |
|
|
692
694
|
| `storage.errSvg` | {name} is an SVG, which this app does not accept. |
|
package/README.md
CHANGED
|
@@ -102,9 +102,10 @@ KEYS Bound on window, so they survive toolbar="none":
|
|
|
102
102
|
Ctrl/Cmd+E (export dialog), Ctrl/Cmd+K (link, while editing),
|
|
103
103
|
Ctrl/Cmd+D (duplicate), Backspace|Delete (delete selection).
|
|
104
104
|
|
|
105
|
-
UPLOADS
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
UPLOADS A provider plus `maxBytes` are required, or every upload is refused;
|
|
106
|
+
every image type is allowed unless `accept` narrows it.
|
|
107
|
+
editor.storageLimits = { maxBytes: 2*1024*1024,
|
|
108
|
+
accept:['image/jpeg','image/png'] } // accept optional
|
|
108
109
|
editor.storageProvider = { list(q), upload(file, o), folders?(), remove?(a),
|
|
109
110
|
limits? }
|
|
110
111
|
provider.limits is merged per key under .storageLimits, and satisfies
|
package/README.md.txt
CHANGED
|
@@ -102,9 +102,10 @@ KEYS Bound on window, so they survive toolbar="none":
|
|
|
102
102
|
Ctrl/Cmd+E (export dialog), Ctrl/Cmd+K (link, while editing),
|
|
103
103
|
Ctrl/Cmd+D (duplicate), Backspace|Delete (delete selection).
|
|
104
104
|
|
|
105
|
-
UPLOADS
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
UPLOADS A provider plus `maxBytes` are required, or every upload is refused;
|
|
106
|
+
every image type is allowed unless `accept` narrows it.
|
|
107
|
+
editor.storageLimits = { maxBytes: 2*1024*1024,
|
|
108
|
+
accept:['image/jpeg','image/png'] } // accept optional
|
|
108
109
|
editor.storageProvider = { list(q), upload(file, o), folders?(), remove?(a),
|
|
109
110
|
limits? }
|
|
110
111
|
provider.limits is merged per key under .storageLimits, and satisfies
|