@templatical/editor 0.59.0 → 0.59.1

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 (62) hide show
  1. package/dist/{AiRewriteMenu-CjXiI-n4.js → AiRewriteMenu-DH6j1jOA.js} +1 -1
  2. package/dist/{BlockPreviewCanvas-3FzYSsPm.js → BlockPreviewCanvas-BLJxLwTT.js} +2 -2
  3. package/dist/{CloudPanels-CSFN-eLV.js → CloudPanels-qW-MObRD.js} +1 -1
  4. package/dist/{LanguageMenu-CEKRbNhA.js → LanguageMenu-D_xbvq3D.js} +1 -1
  5. package/dist/{ParagraphEditor-Vz90-hhN.js → ParagraphEditor-DpOsnnai.js} +2 -2
  6. package/dist/{RestoreVersionDialog-BgrtpVl1.js → RestoreVersionDialog-JQEkVIh5.js} +1 -1
  7. package/dist/{SaveBlockDialog-DRvLFKWJ.js → SaveBlockDialog-BPf6tDhg.js} +3 -3
  8. package/dist/{SavedBlocksBrowserModal-Dw0uF-NT.js → SavedBlocksBrowserModal-DnDCfwSv.js} +3 -3
  9. package/dist/{SavedBlocksPanels-BReNi8sg.js → SavedBlocksPanels-D5YaVCem.js} +1 -1
  10. package/dist/{SavedBlocksPickBar-BQX4g7OE.js → SavedBlocksPickBar-OQ7ey3MD.js} +1 -1
  11. package/dist/{TestEmailModal-BiCUiRFo.js → TestEmailModal-BDp85wIp.js} +4 -3
  12. package/dist/{TestEmailPanel-Bfr-sGrI.js → TestEmailPanel-DkJx0Ptk.js} +1 -1
  13. package/dist/{TitleEditor-B8thQPgg.js → TitleEditor-wzknZqu_.js} +1 -1
  14. package/dist/{TplModal-BIqO0owX.js → TplModal-C57J-uF0.js} +1 -1
  15. package/dist/{VersionHistoryPanels-C91mfsMA.js → VersionHistoryPanels-BZ0GT52h.js} +1 -1
  16. package/dist/{WrapperBlock-BAqgP8hm.js → WrapperBlock-C4XrJkx5.js} +1 -1
  17. package/dist/bundle-stats.json +6 -6
  18. package/dist/cdn/chunks/{AiRewriteMenu-99qbfCZI.js → AiRewriteMenu-B23ozFnP.js} +2 -2
  19. package/dist/cdn/chunks/{AiRewriteMenu-99qbfCZI.js.map → AiRewriteMenu-B23ozFnP.js.map} +1 -1
  20. package/dist/cdn/chunks/{BlockPreviewCanvas-BF0yCTKP.js → BlockPreviewCanvas-CaRneMZ8.js} +3 -3
  21. package/dist/cdn/chunks/{BlockPreviewCanvas-BF0yCTKP.js.map → BlockPreviewCanvas-CaRneMZ8.js.map} +1 -1
  22. package/dist/cdn/chunks/{CloudPanels-gV2WFHQk.js → CloudPanels-xAEirqNC.js} +2 -2
  23. package/dist/cdn/chunks/{CloudPanels-gV2WFHQk.js.map → CloudPanels-xAEirqNC.js.map} +1 -1
  24. package/dist/cdn/chunks/{LanguageMenu-fL4DRGGQ.js → LanguageMenu-Cl0ajnXZ.js} +2 -2
  25. package/dist/cdn/chunks/{LanguageMenu-fL4DRGGQ.js.map → LanguageMenu-Cl0ajnXZ.js.map} +1 -1
  26. package/dist/cdn/chunks/{ParagraphEditor-A_OEuQ1Q.js → ParagraphEditor-BoGELRr-.js} +3 -3
  27. package/dist/cdn/chunks/{ParagraphEditor-A_OEuQ1Q.js.map → ParagraphEditor-BoGELRr-.js.map} +1 -1
  28. package/dist/cdn/chunks/{RestoreVersionDialog-Ca_lUsk4.js → RestoreVersionDialog-CaKiSq-9.js} +2 -2
  29. package/dist/cdn/chunks/{RestoreVersionDialog-Ca_lUsk4.js.map → RestoreVersionDialog-CaKiSq-9.js.map} +1 -1
  30. package/dist/cdn/chunks/{SaveBlockDialog-BXRCqrZX.js → SaveBlockDialog-BAR0G4UO.js} +4 -4
  31. package/dist/cdn/chunks/{SaveBlockDialog-BXRCqrZX.js.map → SaveBlockDialog-BAR0G4UO.js.map} +1 -1
  32. package/dist/cdn/chunks/{SavedBlocksBrowserModal-DdaBcSOI.js → SavedBlocksBrowserModal-C-KYaLkQ.js} +4 -4
  33. package/dist/cdn/chunks/{SavedBlocksBrowserModal-DdaBcSOI.js.map → SavedBlocksBrowserModal-C-KYaLkQ.js.map} +1 -1
  34. package/dist/cdn/chunks/{SavedBlocksPanels-BcVFZDKI.js → SavedBlocksPanels-C3OF0EeB.js} +2 -2
  35. package/dist/cdn/chunks/{SavedBlocksPanels-BcVFZDKI.js.map → SavedBlocksPanels-C3OF0EeB.js.map} +1 -1
  36. package/dist/cdn/chunks/{SavedBlocksPickBar-o66PhlTo.js → SavedBlocksPickBar-BnyPXw5W.js} +2 -2
  37. package/dist/cdn/chunks/{SavedBlocksPickBar-o66PhlTo.js.map → SavedBlocksPickBar-BnyPXw5W.js.map} +1 -1
  38. package/dist/cdn/chunks/{TestEmailModal-WOC7bmF_.js → TestEmailModal-B9d3ZsH7.js} +5 -4
  39. package/dist/cdn/chunks/TestEmailModal-B9d3ZsH7.js.map +1 -0
  40. package/dist/cdn/chunks/{TestEmailPanel-DUWH9xsZ.js → TestEmailPanel--fPi6QjN.js} +2 -2
  41. package/dist/cdn/chunks/{TestEmailPanel-DUWH9xsZ.js.map → TestEmailPanel--fPi6QjN.js.map} +1 -1
  42. package/dist/cdn/chunks/{TitleEditor-EHW0lgG4.js → TitleEditor-Cn4fnSpa.js} +2 -2
  43. package/dist/cdn/chunks/{TitleEditor-EHW0lgG4.js.map → TitleEditor-Cn4fnSpa.js.map} +1 -1
  44. package/dist/cdn/chunks/{TplModal-B9DVglkN.js → TplModal-jMfK19PC.js} +2 -2
  45. package/dist/cdn/chunks/{TplModal-B9DVglkN.js.map → TplModal-jMfK19PC.js.map} +1 -1
  46. package/dist/cdn/chunks/{VersionHistoryPanels-DO-kcL28.js → VersionHistoryPanels-DJpySkvq.js} +2 -2
  47. package/dist/cdn/chunks/{VersionHistoryPanels-DO-kcL28.js.map → VersionHistoryPanels-DJpySkvq.js.map} +1 -1
  48. package/dist/cdn/chunks/{WrapperBlock-CyD_pW18.js → WrapperBlock-Bi9XgDmX.js} +2 -2
  49. package/dist/cdn/chunks/{WrapperBlock-CyD_pW18.js.map → WrapperBlock-Bi9XgDmX.js.map} +1 -1
  50. package/dist/cdn/chunks/{composables-CN9j_FH4.js → composables-Cp6gZ7qV.js} +5 -3
  51. package/dist/cdn/chunks/composables-Cp6gZ7qV.js.map +1 -0
  52. package/dist/cdn/chunks/src-CVHGPKSW.js.map +1 -1
  53. package/dist/cdn/chunks/{src-BXrhjqCv.js → src-aFRxbwqP.js} +2 -2
  54. package/dist/cdn/chunks/{src-BXrhjqCv.js.map → src-aFRxbwqP.js.map} +1 -1
  55. package/dist/cdn/editor.js +8 -8
  56. package/dist/cdn/editor.js.map +1 -1
  57. package/dist/{composables-DbqKYIRE.js → composables-jTnTSqdm.js} +4 -2
  58. package/dist/index.d.ts +29 -7
  59. package/dist/templatical-editor.js +7 -7
  60. package/package.json +7 -7
  61. package/dist/cdn/chunks/TestEmailModal-WOC7bmF_.js.map +0 -1
  62. package/dist/cdn/chunks/composables-CN9j_FH4.js.map +0 -1
@@ -646,6 +646,7 @@ function ai(e) {
646
646
  r.value = !0;
647
647
  let l = {
648
648
  content: We(e.getContent()),
649
+ surface: e.surface,
649
650
  trigger: t,
650
651
  ...e.getRecipient?.() === void 0 ? {} : { recipient: e.getRecipient() }
651
652
  };
@@ -1792,7 +1793,7 @@ var Xa = ["innerHTML"], Za = /* @__PURE__ */ B({
1792
1793
  viewport: {}
1793
1794
  },
1794
1795
  setup(e) {
1795
- let t = e, n = oe(() => import("./ParagraphEditor-Vz90-hhN.js").then((e) => e.t)), { isEditing: r, blockRef: i, toolbarPosition: a, resolvedContent: o, handleDoubleClick: s, handleEditorDone: c } = Ya(() => t.block.content);
1796
+ let t = e, n = oe(() => import("./ParagraphEditor-DpOsnnai.js").then((e) => e.t)), { isEditing: r, blockRef: i, toolbarPosition: a, resolvedContent: o, handleDoubleClick: s, handleEditorDone: c } = Ya(() => t.block.content);
1796
1797
  return (t, l) => (m(), N("div", {
1797
1798
  ref_key: "blockRef",
1798
1799
  ref: i,
@@ -2489,7 +2490,7 @@ var Fo = /* @__PURE__ */ B({
2489
2490
  viewport: {}
2490
2491
  },
2491
2492
  setup(e) {
2492
- let t = e, n = oe(() => import("./TitleEditor-B8thQPgg.js")), r = bn(ln, "TitleBlock"), { isEditing: i, blockRef: a, toolbarPosition: o, resolvedContent: s, handleDoubleClick: c, handleEditorDone: l } = Ya(() => t.block.content), u = k(() => {
2493
+ let t = e, n = oe(() => import("./TitleEditor-wzknZqu_.js")), r = bn(ln, "TitleBlock"), { isEditing: i, blockRef: a, toolbarPosition: o, resolvedContent: s, handleDoubleClick: c, handleEditorDone: l } = Ya(() => t.block.content), u = k(() => {
2493
2494
  let e = {
2494
2495
  fontSize: `${st[t.block.level]}px`,
2495
2496
  lineHeight: String(St),
@@ -4539,6 +4540,7 @@ function mu(t) {
4539
4540
  g(Xt, ne);
4540
4541
  let re = ai({
4541
4542
  resolvePreview: r.resolvePreview,
4543
+ surface: "preview",
4542
4544
  getContent: () => {
4543
4545
  let e = n.content.value;
4544
4546
  if (!n.state.previewMode) return e;
package/dist/index.d.ts CHANGED
@@ -2092,12 +2092,14 @@ declare interface ParagraphBlock extends BaseBlock {
2092
2092
  /**
2093
2093
  * Context handed to `resolvePreview`.
2094
2094
  *
2095
- * `recipient` is present only on surfaces that have one — the test-email
2096
- * dialog — and absent in the editor's own preview mode. Treat its absence as
2097
- * "no particular recipient", not as an error: a resolver should still return
2098
- * something renderable, its own default or sample data, or obtain a recipient
2099
- * itself, for example by awaiting its own picker on `trigger: "open"` or
2100
- * `"refresh"` (see guide/preview-rendering).
2095
+ * `surface` tells the editor's own preview mode and the test-email dialog
2096
+ * apart; the presence of `recipient` does not. `recipient` is absent in preview
2097
+ * mode, and also in the test-email dialog while its recipient field is empty.
2098
+ * Treat its absence as "no particular recipient", not as an error: a resolver
2099
+ * should still return something renderable, its own default or sample data,
2100
+ * or obtain a recipient itself, for example by awaiting its own picker on
2101
+ * `surface: "preview"` with `trigger: "open"` or `"refresh"` (see
2102
+ * guide/preview-rendering).
2101
2103
  */
2102
2104
  export declare interface PreviewResolveContext {
2103
2105
  /**
@@ -2105,8 +2107,19 @@ export declare interface PreviewResolveContext {
2105
2107
  * effect on the editor, and returning it unchanged is a valid no-op.
2106
2108
  */
2107
2109
  content: TemplateContent;
2108
- /** The address the preview is being shown for, when the surface has one. */
2110
+ /**
2111
+ * The test-email dialog's recipient field value, set only while that field
2112
+ * is non-empty. A free-text field passes what the user has typed so far,
2113
+ * which may be an incomplete address: validate it before looking up
2114
+ * recipient data.
2115
+ */
2109
2116
  recipient?: string;
2117
+ /**
2118
+ * Which preview is calling, on every call including a refresh:
2119
+ * - "preview": the editor's own preview mode;
2120
+ * - "test-email": the test-email dialog's preview.
2121
+ */
2122
+ surface: PreviewSurface;
2110
2123
  /**
2111
2124
  * Why this call happened:
2112
2125
  * - "open": a preview surface opened (editor preview mode, or the test-email dialog);
@@ -2120,6 +2133,9 @@ export declare interface PreviewResolveContext {
2120
2133
  /** Why `resolvePreview` was called. */
2121
2134
  export declare type PreviewResolveTrigger = "open" | "refresh" | "recipient" | "locale";
2122
2135
 
2136
+ /** Which preview is calling `resolvePreview`. */
2137
+ export declare type PreviewSurface = "preview" | "test-email";
2138
+
2123
2139
  declare interface RemoveLocaleOperation {
2124
2140
  op: "removeLocale";
2125
2141
  locale: string;
@@ -3301,6 +3317,9 @@ export declare interface TemplaticalCloudEditorConfig {
3301
3317
  * test-email recipient changes, `"locale"` when the template language changes,
3302
3318
  * and `"refresh"` when the user clicks Refresh preview or calls
3303
3319
  * `refreshPreview()`. Recipient changes debounce; refresh runs immediately.
3320
+ * `surface` is `"preview"` for preview mode and `"test-email"` for the
3321
+ * test-email dialog; tell them apart by it, not by `recipient`, which the
3322
+ * dialog omits while its recipient field is empty.
3304
3323
  *
3305
3324
  * Supersedes `MergeTag.sample` when configured, and the Sample/Label switch
3306
3325
  * stops rendering.
@@ -3679,6 +3698,9 @@ export declare interface TemplaticalEditorConfig {
3679
3698
  * test-email recipient changes, `"locale"` when the template language changes,
3680
3699
  * and `"refresh"` when the user clicks Refresh preview or calls
3681
3700
  * `refreshPreview()`. Recipient changes debounce; refresh runs immediately.
3701
+ * `surface` is `"preview"` for preview mode and `"test-email"` for the
3702
+ * test-email dialog; tell them apart by it, not by `recipient`, which the
3703
+ * dialog omits while its recipient field is empty.
3682
3704
  * Display-only: the result never reaches `getContent()`, a send or
3683
3705
  * an export. Rejecting is safe — the preview falls back to the unresolved
3684
3706
  * template and says so.
@@ -11,8 +11,8 @@ import { B as Ge, E as Ke, I as qe, J as Je, K as Ye, M as Xe, O as Ze, Q as Qe,
11
11
  import { t as Ct } from "./plural-CyxrJXL1.js";
12
12
  import { t as wt } from "./languageName-DEEOhDWI.js";
13
13
  import { C as Tt, E as Et, T as Dt, b as Ot, h as kt, m as At, w as jt, x as Mt } from "./styleConstants-Br6CIRoS.js";
14
- import { t as Nt } from "./TplModal-BIqO0owX.js";
15
- import { A as Pt, D as Ft, F as It, G as Lt, I as Rt, M as zt, N as Bt, P as Vt, R as Ht, S as Ut, V as Wt, _ as Gt, a as Kt, b as qt, c as Jt, d as Yt, f as Xt, g as Zt, h as Qt, i as $t, j as en, k as tn, l as nn, m as rn, n as an, o as on, p as sn, r as cn, s as ln, t as un, u as dn, v as fn, x as pn, y as mn } from "./composables-DbqKYIRE.js";
14
+ import { t as Nt } from "./TplModal-C57J-uF0.js";
15
+ import { A as Pt, D as Ft, F as It, G as Lt, I as Rt, M as zt, N as Bt, P as Vt, R as Ht, S as Ut, V as Wt, _ as Gt, a as Kt, b as qt, c as Jt, d as Yt, f as Xt, g as Zt, h as Qt, i as $t, j as en, k as tn, l as nn, m as rn, n as an, o as on, p as sn, r as cn, s as ln, t as un, u as dn, v as fn, x as pn, y as mn } from "./composables-jTnTSqdm.js";
16
16
  import { a as hn, i as gn, n as _n, o as vn, t as yn } from "./normalizeMergeTagMarkup-fgoVMKAc.js";
17
17
  import { t as bn } from "./aiErrors-C3QEMB0x.js";
18
18
  import { n as xn, t as Sn } from "./aiImageContext-BQ5mQ6B5.js";
@@ -23,7 +23,7 @@ import { t as An } from "./refresh-cw-Ryg1j66N.js";
23
23
  import { t as jn } from "./rotate-ccw-D8j7gXXv.js";
24
24
  import { t as Mn } from "./createLucideIcon-CssArtUe.js";
25
25
  import { t as Nn } from "./sparkles-Dc3Undp5.js";
26
- import { t as Pn } from "./WrapperBlock-BAqgP8hm.js";
26
+ import { t as Pn } from "./WrapperBlock-C4XrJkx5.js";
27
27
  import { t as Fn } from "./package-D2fov5PU.js";
28
28
  import { t as In } from "./blockTypeIcons-VX_8UQ21.js";
29
29
  import { t as Ln } from "./templateSettingsFields-cjlP-jdw.js";
@@ -3225,7 +3225,7 @@ var xa = [
3225
3225
  ai: {}
3226
3226
  },
3227
3227
  setup(n) {
3228
- let r = I(() => import("./VersionHistoryMenu-6jMve6By.js")), l = I(() => import("./LanguageMenu-CEKRbNhA.js")), u = I(() => import("./CollaboratorBar-DsRjAaqd.js")), d = A(null), p = A(null), m = A(null), h = n, g = h.header?.actions, _ = h.header?.viewportToggle !== !1, y = h.header?.darkModeToggle !== !1, S = h.header?.previewToggle !== !1, { compact: w, fullWidth: T, statusLabel: E, invalidateContent: k } = ba(d, p, g), j = g?.getAttribute("slot"), M = null;
3228
+ let r = I(() => import("./VersionHistoryMenu-6jMve6By.js")), l = I(() => import("./LanguageMenu-D_xbvq3D.js")), u = I(() => import("./CollaboratorBar-DsRjAaqd.js")), d = A(null), p = A(null), m = A(null), h = n, g = h.header?.actions, _ = h.header?.viewportToggle !== !1, y = h.header?.darkModeToggle !== !1, S = h.header?.previewToggle !== !1, { compact: w, fullWidth: T, statusLabel: E, invalidateContent: k } = ba(d, p, g), j = g?.getAttribute("slot"), M = null;
3229
3229
  return g && t([w, () => h.core.resolvedTheme.value], ([e, t]) => {
3230
3230
  g.setAttribute("data-tpl-compact", String(e)), g.setAttribute("data-tpl-theme", t === "dark" ? "dark" : "light");
3231
3231
  }, {
@@ -3991,7 +3991,7 @@ var xa = [
3991
3991
  editor: _,
3992
3992
  onError: i.config.onError,
3993
3993
  isAvailable: i.cloud ? () => i.cloud.isSavedBlocksAvailable() : void 0
3994
- }) : null, P = I(() => import("./SavedBlocksPanels-BReNi8sg.js")), L = i.config.media || i.config.onRequestMedia ? ci({
3994
+ }) : null, P = I(() => import("./SavedBlocksPanels-D5YaVCem.js")), L = i.config.media || i.config.onRequestMedia ? ci({
3995
3995
  provider: i.config.media,
3996
3996
  onRequestMedia: i.config.onRequestMedia,
3997
3997
  getTemplateId: () => _.state.template?.id,
@@ -4003,7 +4003,7 @@ var xa = [
4003
4003
  usesLocalRenderer: i.usesLocalRenderer,
4004
4004
  onError: i.config.onError,
4005
4005
  isAvailable: i.cloud ? () => i.cloud.isTestEmailAvailable() : void 0
4006
- }) : null, V = I(() => import("./TestEmailPanel-Bfr-sGrI.js")), U = i.config.comments ? Kr({
4006
+ }) : null, V = I(() => import("./TestEmailPanel-DkJx0Ptk.js")), U = i.config.comments ? Kr({
4007
4007
  provider: i.config.comments,
4008
4008
  editor: _,
4009
4009
  user: i.config.user,
@@ -4061,7 +4061,7 @@ var xa = [
4061
4061
  }, n = ne.setDefaultLocale(e);
4062
4062
  return n.applied && (Y.value = t), n;
4063
4063
  } });
4064
- let re = I(() => import("./LocaleNotices-j4aMFfmc.js")), ie = I(() => import("./CollaborationNotices-D9GQ477K.js")), ae = I(() => import("./CloudPanels-CSFN-eLV.js")), oe = I(() => import("./CloudHeaderExtras-xrHubAHL.js")), se = I(() => import("./VersionHistoryPanels-C91mfsMA.js")), le = yi(i.config.templates?.autoSave, !1), ue = le && A !== null;
4064
+ let re = I(() => import("./LocaleNotices-j4aMFfmc.js")), ie = I(() => import("./CollaborationNotices-D9GQ477K.js")), ae = I(() => import("./CloudPanels-qW-MObRD.js")), oe = I(() => import("./CloudHeaderExtras-xrHubAHL.js")), se = I(() => import("./VersionHistoryPanels-BZ0GT52h.js")), le = yi(i.config.templates?.autoSave, !1), ue = le && A !== null;
4065
4065
  le && A !== null && !A.canSave.value && kn.warn("config.templates.autoSave is on but this provider's save is false — there is nothing to persist to. Give it a real save function, or use `onChange` to persist the content yourself."), i.config.changeDebounce !== void 0 && A !== null && i.config.templates?.autoSave === void 0 && !i.config.onChange && kn.warn("config.changeDebounce is set but nothing will use it — config.templates.autoSave is unset and there is no onChange either, so the timer has no consumer. Set config.templates.autoSave, or add onChange, so the debounce takes effect.");
4066
4066
  let de = i.config.onChange || ue ? {
4067
4067
  onChange: () => {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@templatical/editor",
3
3
  "description": "Vue 3 visual drag-and-drop email editor powered by Templatical",
4
- "version": "0.59.0",
4
+ "version": "0.59.1",
5
5
  "bugs": "https://github.com/templatical/sdk/issues",
6
6
  "devDependencies": {
7
7
  "@lucide/vue": "^1.70.0",
8
- "@templatical/core": "0.59.0",
9
- "@templatical/media-library": "0.59.0",
10
- "@templatical/types": "0.59.0",
8
+ "@templatical/core": "0.59.1",
9
+ "@templatical/media-library": "0.59.1",
10
+ "@templatical/types": "0.59.1",
11
11
  "@tiptap/core": "^3.33.0",
12
12
  "@tiptap/extension-color": "^3.33.0",
13
13
  "@tiptap/extension-font-family": "^3.33.0",
@@ -65,11 +65,11 @@
65
65
  "license": "FSL-1.1-MIT",
66
66
  "module": "./dist/templatical-editor.js",
67
67
  "optionalDependencies": {
68
- "@templatical/quality": "0.59.0"
68
+ "@templatical/quality": "0.59.1"
69
69
  },
70
70
  "peerDependencies": {
71
- "@templatical/quality": "0.59.0",
72
- "@templatical/renderer": "0.59.0",
71
+ "@templatical/quality": "0.59.1",
72
+ "@templatical/renderer": "0.59.1",
73
73
  "pusher-js": "^8.6.0"
74
74
  },
75
75
  "peerDependenciesMeta": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"TestEmailModal-WOC7bmF_.js","names":["_openBlock","_createBlock","TplModal","_withCtx","_createElementVNode","_toDisplayString","_unref","_createElementBlock","_withDirectives","_Fragment","_renderList","_vModelSelect","_vModelText","_createCommentVNode","MergeTagModeToggle","_createVNode","ViewportToggle","_normalizeClass","BlockPreviewCanvas","_createTextVNode","_sfc_main","defineComponent","openBlock","withCtx","watch","withDirectives","renderList","inject","onScopeDispose","createElementBlock","vModelSelect","createTextVNode","unref","normalizeClass","createCommentVNode","createBlock","createBaseVNode","toDisplayString","vModelText","computed","ref","Fragment","createVNode","trackActionBtnClass","primaryBtnClass","TplModal_default","BlockPreviewCanvas_default","ViewportToggle_default","MergeTagModeToggle_default","useI18n","RefreshCw","Check","LoaderCircle","resolveLocale","hasMergeTagSamples","applyLayout","MERGE_TAGS_KEY","MERGE_TAG_SAMPLE_MODE_KEY","LAYOUT_KEY","NO_MERGE_TAGS","REGISTER_DIALOG_PREVIEW_REFRESH_KEY","RESOLVE_PREVIEW_KEY","EDITOR_KEY","usePreviewResolution","IMPOSSIBLE_DOMAIN_CHARS","looksLikeEmail","trimmed","value","parts","local","domain","dot","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","TestEmailModal_default","__emit","props","__props","emit","editor","layout","recipient","visible","previewViewport","resolvePreviewHook","previewResolution","raw","locale","localized","registerDialogRefresh","unregisterDialogRefresh","sharedSampleMode","localSampleMode","sampleMode","on","previewBlocks","previewSettings","hasAllowlist","isSingleRecipient","isRecipientValid","canSend","showShapeHint","errorText","t","handleSend","handleClose","handleKeydown","event","_cache","$event","email","n"],"sources":["../../../src/utils/validateEmailShape.ts","../../../src/components/TestEmailModal.vue","../../../src/components/TestEmailModal.vue"],"sourcesContent":["/**\n * Characters that cannot appear in a domain but routinely arrive attached to one.\n *\n * A **denylist**, not an allowlist, so unicode domains keep working — an\n * allowlist of `[a-z0-9.-]` would be the stricter, more obviously \"correct\"\n * choice and would reject them. What this actually targets is the punctuation\n * that comes from pasting out of a list or a mail client: `user@example.com,`\n * and `<user@example.com>`.\n */\nconst IMPOSSIBLE_DOMAIN_CHARS = /[,;<>()[\\]\\\\\"'`|/?#@!$%^&*+=~{}]/;\n\n/**\n * Does this string look like an email address?\n *\n * Deliberately loose: non-empty, no whitespace, exactly one `@`, a non-empty\n * local part, and a domain containing a dot with something either side and no\n * impossible characters. That is enough to catch the mistakes a typo actually\n * produces — a missing `@`, a trailing comma, a half-typed domain — before the\n * user pays for a round-trip.\n *\n * **Do not \"improve\" this into an RFC-ish regex.** Those reliably reject valid\n * addresses (plus-addressing, long new gTLDs, unicode domains) and the resulting\n * bug reports cost far more than the malformed addresses they catch. Only the\n * receiving mail server can really tell, and the sending backend has to validate\n * anyway — this is a fast-feedback affordance, not a gate. `validateEmailShape`\n * has its own test file pinning the addresses that must keep passing.\n */\nexport function looksLikeEmail(value: string): boolean {\n const trimmed = value.trim();\n if (trimmed.length === 0) return false;\n if (/\\s/.test(trimmed)) return false;\n\n const parts = trimmed.split(\"@\");\n if (parts.length !== 2) return false;\n\n const [local, domain] = parts;\n if (local.length === 0) return false;\n if (IMPOSSIBLE_DOMAIN_CHARS.test(domain)) return false;\n\n // A dot with at least one character either side, so `a@b` and `a@b.` fail but\n // `a@b.c` and `a@sub.example.museum` pass.\n const dot = domain.indexOf(\".\");\n return dot > 0 && dot < domain.length - 1;\n}\n","<script setup lang=\"ts\">\nimport {\n primaryBtnClass,\n trackActionBtnClass,\n} from \"../constants/styleConstants\";\n/**\n * Send-a-test dialog, shared by the OSS and Cloud editors.\n *\n * The recipient control has three shapes, driven entirely by whether the\n * provider configured an allowlist:\n *\n * - **no allowlist** — free text, validated for shape only. This branch exists\n * for BYO senders; Cloud never takes it, because its list comes from a signed\n * JWT.\n * - **exactly one** — a read-only field. Preserved verbatim from the Cloud-only\n * version; there is nothing to choose, so offering an editable field would\n * imply otherwise.\n * - **several** — a picker of exactly those addresses.\n *\n * An empty allowlist never reaches here: the feature reports itself unavailable,\n * so no trigger renders. (The Cloud-only version fell through to `v-else` and\n * rendered a select with no options and a permanently disabled Send.)\n */\nimport TplModal from \"./TplModal.vue\";\n// Statically imported: this modal is already lazy-loaded as a whole, so the\n// preview rides its chunk rather than costing a second round-trip and flashing\n// an empty frame. Still shared with the saved-blocks surfaces, which lazy-load\n// it themselves.\nimport BlockPreviewCanvas from \"./BlockPreviewCanvas.vue\";\n// The editor header's own control, reused verbatim so the two viewport switches\n// are the same component rather than two things that resemble each other.\nimport ViewportToggle from \"./ViewportToggle.vue\";\nimport MergeTagModeToggle from \"./MergeTagModeToggle.vue\";\nimport { useI18n } from \"../composables/useI18n\";\nimport { looksLikeEmail } from \"../utils/validateEmailShape\";\nimport { Check, LoaderCircle, RefreshCw } from \"@lucide/vue\";\nimport { computed, inject, onScopeDispose, ref, watch } from \"vue\";\nimport {\n applyLayout,\n resolveLocale,\n hasMergeTagSamples,\n type ViewportSize,\n} from \"@templatical/types\";\nimport {\n EDITOR_KEY,\n LAYOUT_KEY,\n MERGE_TAGS_KEY,\n NO_MERGE_TAGS,\n MERGE_TAG_SAMPLE_MODE_KEY,\n RESOLVE_PREVIEW_KEY,\n REGISTER_DIALOG_PREVIEW_REFRESH_KEY,\n} from \"../keys\";\nimport { usePreviewResolution } from \"../composables/usePreviewResolution\";\nimport type { TestEmailError } from \"../composables/useTestEmailFeature\";\n\nconst props = defineProps<{\n visible: boolean;\n /** Omitted / undefined means unrestricted, so the field accepts free text. */\n allowedRecipients?: string[];\n defaultRecipient?: string;\n isSending: boolean;\n justSent: boolean;\n error: TestEmailError | null;\n}>();\n\nconst emit = defineEmits<{\n (e: \"send\", recipient: string): void;\n (e: \"close\"): void;\n}>();\n\nconst { t } = useI18n();\nconst editor = inject(EDITOR_KEY, null);\nconst layout = inject(LAYOUT_KEY, undefined);\n\n// Seed before the resolution instance installs its immediate watcher, so an\n// opening dialog makes one `open` call with the selected recipient.\nconst recipient = ref(\n props.visible\n ? (props.defaultRecipient ?? props.allowedRecipients?.[0] ?? \"\")\n : \"\",\n);\n\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n recipient.value =\n props.defaultRecipient ?? props.allowedRecipients?.[0] ?? \"\";\n }\n },\n { flush: \"sync\" },\n);\n\nconst previewViewport = ref<ViewportSize>(\"desktop\");\n\n/**\n * Its own resolution instance rather than the editor's, because this dialog has\n * a recipient and the editor's preview does not — resolving for \"whoever is\n * selected here\" is a different question from resolving for the canvas.\n * `isActive` is the dialog's own visibility.\n *\n * Compose the embedder shell while the dialog is showing. The send payload\n * stays unshelled.\n */\nconst resolvePreviewHook = inject(RESOLVE_PREVIEW_KEY, undefined);\nconst previewResolution = usePreviewResolution({\n resolvePreview: resolvePreviewHook ?? undefined,\n getContent: () => {\n const raw = editor?.content.value ?? { blocks: [], settings: {} as never };\n if (!props.visible) return raw;\n const locale = editor?.activeLocale?.value ?? raw.settings.locale ?? \"en\";\n const localized = resolveLocale(raw, locale);\n return layout\n ? applyLayout(\n resolveLocale(layout, locale, { missing: \"default\" }),\n localized,\n )\n : localized;\n },\n isActive: () => props.visible,\n getLocale: () =>\n editor?.activeLocale?.value ?? editor?.content.value.settings.locale,\n getRecipient: () => recipient.value || undefined,\n});\n\nconst registerDialogRefresh = inject(REGISTER_DIALOG_PREVIEW_REFRESH_KEY, null);\nlet unregisterDialogRefresh: (() => void) | null = null;\nwatch(\n () => props.visible,\n (visible) => {\n unregisterDialogRefresh?.();\n unregisterDialogRefresh = visible\n ? (registerDialogRefresh?.(previewResolution.refresh) ?? null)\n : null;\n },\n { immediate: true, flush: \"sync\" },\n);\nonScopeDispose(() => unregisterDialogRefresh?.());\n\n/**\n * Shared with the editor's own preview, so switching here and switching there\n * are the same choice — it is a property of how the user wants to read a\n * preview, not of one dialog. Falls back to a local ref for headless mounts.\n */\nconst sharedSampleMode = inject(MERGE_TAG_SAMPLE_MODE_KEY, null);\n// Seeded from availability, matching how `useEditorCore` seeds the shared ref.\n// A blanket `true` would make the dialog claim tags \"show example values\" for a\n// consumer who configured none — false, and with no toggle rendered to correct\n// it, since the toggle hides itself when nothing has a sample.\nconst localSampleMode = ref(\n hasMergeTagSamples(inject(MERGE_TAGS_KEY, NO_MERGE_TAGS).value),\n);\nconst sampleMode = computed({\n get: () =>\n // Off entirely while a resolver is configured — same rule as the canvas.\n previewResolution.isConfigured\n ? false\n : (sharedSampleMode?.value ?? localSampleMode.value),\n set: (on: boolean) => {\n if (sharedSampleMode) sharedSampleMode.value = on;\n else localSampleMode.value = on;\n },\n});\n\nconst previewBlocks = computed(\n () => previewResolution.content.value.blocks ?? [],\n);\n\nconst previewSettings = computed(\n () => previewResolution.content.value.settings,\n);\n\nconst hasAllowlist = computed(\n () =>\n props.allowedRecipients !== undefined && props.allowedRecipients.length > 0,\n);\nconst isSingleRecipient = computed(() => props.allowedRecipients?.length === 1);\n\n/** Shape-check free text only; a picker can't produce a malformed value. */\nconst isRecipientValid = computed(() =>\n hasAllowlist.value\n ? recipient.value.length > 0\n : looksLikeEmail(recipient.value),\n);\n\nconst canSend = computed(\n () => isRecipientValid.value && !props.isSending && !props.justSent,\n);\n\n/** Free text that's been typed into but isn't yet a plausible address. */\nconst showShapeHint = computed(\n () =>\n !hasAllowlist.value &&\n recipient.value.trim().length > 0 &&\n !isRecipientValid.value,\n);\n\nconst errorText = computed(() => {\n if (!props.error) return null;\n return props.error.kind === \"provider\"\n ? props.error.message\n : t.testEmail.recipientNotAllowed;\n});\n\nfunction handleSend(): void {\n if (!canSend.value) return;\n emit(\"send\", recipient.value.trim());\n}\n\nfunction handleClose(): void {\n // Sending is the one state that blocks dismissal; the success state closes\n // immediately rather than making the user wait out the timer.\n if (props.isSending) return;\n emit(\"close\");\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSend();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <!-- Grows to `max-w-3xl` only while the preview is open. A 600px email has\n to render at true size AND leave slack on both sides for the band of\n body background the preview draws beside it: at `max-w-2xl` the\n preview region's content box is exactly 600px, so the band would have\n nowhere to go and `settings.backgroundColor` would look unset for any\n template whose sections span the full width. Collapsed, it stays the\n compact form it was. `w-full` keeps it shrinking on narrow screens.\n `max-h-[90%]`\n with a `min-h-0 overflow-y-auto` preview region is the pattern the\n saved-blocks dialogs use: the cap bounds the panel to TplModal's\n backdrop (never to `vh` — see the note there), and `min-h-0` is what\n lets a flex child shrink below its content and actually scroll. -->\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSending\"\n aria-labelledby=\"tpl-test-email-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-full tpl:max-w-3xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-test-email-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.testEmail.title }}\n </h3>\n\n <!-- Recipient -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-test-email-recipient\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.testEmail.recipientLabel }}\n </label>\n\n <!-- Exactly one allowed address: nothing to choose. -->\n <input\n v-if=\"isSingleRecipient\"\n id=\"tpl-test-email-recipient\"\n type=\"text\"\n :value=\"recipient\"\n disabled\n data-testid=\"test-email-recipient\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:opacity-70 tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n />\n\n <!-- Several allowed addresses: pick one. -->\n <select\n v-else-if=\"hasAllowlist\"\n id=\"tpl-test-email-recipient\"\n v-model=\"recipient\"\n :disabled=\"isSending || justSent\"\n data-testid=\"test-email-recipient\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n >\n <option\n v-for=\"email in allowedRecipients\"\n :key=\"email\"\n :value=\"email\"\n >\n {{ email }}\n </option>\n </select>\n\n <!-- No allowlist: free text. -->\n <input\n v-else\n id=\"tpl-test-email-recipient\"\n v-model=\"recipient\"\n type=\"email\"\n autocomplete=\"email\"\n spellcheck=\"false\"\n :placeholder=\"t.testEmail.recipientPlaceholder\"\n :disabled=\"isSending || justSent\"\n data-testid=\"test-email-recipient\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n />\n\n <p\n v-if=\"showShapeHint\"\n class=\"tpl:mt-1.5 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.testEmail.invalidAddress }}\n </p>\n </div>\n\n <!-- Preview header: a label plus the viewport switch. Always shown — the\n preview is part of the dialog rather than something to opt into. -->\n <div class=\"tpl:mb-2 tpl:shrink-0\">\n <!-- Two segmented controls: `flex-wrap` so they drop to their own row\n rather than crushing the label on a narrow viewport. -->\n <div\n class=\"tpl:flex tpl:flex-wrap tpl:items-center tpl:justify-between tpl:gap-2\"\n >\n <span\n class=\"tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.testEmail.preview }}\n </span>\n\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <MergeTagModeToggle\n v-if=\"!previewResolution.supersedesSamples.value\"\n :sample-mode=\"sampleMode\"\n @change=\"sampleMode = $event\"\n />\n\n <!-- Without this the preview would silently show only the desktop\n variant of any responsive block. -->\n <ViewportToggle\n :viewport=\"previewViewport\"\n @change=\"previewViewport = $event\"\n />\n <!-- The switches' track recipe, so it reads as the viewport\n switch's neighbour at the same 38px. -->\n <button\n v-if=\"previewResolution.isConfigured\"\n type=\"button\"\n :aria-label=\"t.previewResolution.refresh\"\n :title=\"t.previewResolution.refresh\"\n :aria-busy=\"previewResolution.isResolving.value\"\n :class=\"[trackActionBtnClass, 'tpl:w-[38px]']\"\n @click=\"previewResolution.refresh()\"\n >\n <RefreshCw\n :size=\"18\"\n :stroke-width=\"1.5\"\n :class=\"{ 'tpl-spinner': previewResolution.isResolving.value }\"\n />\n </button>\n </div>\n </div>\n\n <!-- The hint has to follow the mode: \"shown unresolved\" is simply false\n once every tag renders a realistic value. -->\n <p\n data-testid=\"test-email-preview-hint\"\n class=\"tpl:mt-1 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{\n previewResolution.supersedesSamples.value\n ? t.previewResolution.hint\n : sampleMode\n ? t.testEmail.previewHintSample\n : t.testEmail.previewHint\n }}\n </p>\n </div>\n\n <!-- The one region allowed to grow: `flex-1 min-h-0` so it absorbs the\n remaining height and scrolls, leaving the form and actions fixed. -->\n <div\n id=\"tpl-test-email-preview\"\n data-testid=\"test-email-preview\"\n class=\"tpl:mb-3 tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto tpl:rounded-[var(--tpl-radius-sm)] tpl:p-3 tpl:bg-[var(--tpl-canvas-bg)]\"\n >\n <!-- Skeleton while a *first* resolve is outstanding, so the dialog never\n flashes the unresolved template before the resolved one. Sized like\n the frame it replaces to avoid a layout jump. A re-resolve (recipient\n change) keeps the previous result instead — `isInitialResolve`. -->\n <div\n v-if=\"previewResolution.isInitialResolve.value\"\n role=\"status\"\n aria-busy=\"true\"\n data-testid=\"preview-resolution-loading\"\n class=\"tpl:flex tpl:flex-col tpl:gap-3\"\n >\n <span class=\"tpl:sr-only\">{{ t.previewResolution.resolving }}</span>\n <div\n v-for=\"n in 3\"\n :key=\"n\"\n aria-hidden=\"true\"\n class=\"tpl-pulse tpl:h-16 tpl:rounded-md tpl:bg-[var(--tpl-bg-hover)]\"\n ></div>\n </div>\n\n <!-- Resolution failed: the unresolved template renders below, so the\n dialog degrades rather than showing an empty frame. -->\n <p\n v-else-if=\"previewResolution.hasFailed.value\"\n role=\"status\"\n data-testid=\"preview-resolution-failed\"\n class=\"tpl:mb-2 tpl:rounded-md tpl:px-3 tpl:py-2 tpl:text-xs tpl:text-[var(--tpl-text-muted)] tpl:bg-[var(--tpl-bg-hover)]\"\n >\n {{ t.previewResolution.failed }}\n </p>\n\n <BlockPreviewCanvas\n v-if=\"!previewResolution.isInitialResolve.value\"\n :blocks=\"previewBlocks\"\n :settings=\"previewSettings\"\n :viewport=\"previewViewport\"\n :apply-condition-filter=\"!previewResolution.isConfigured\"\n />\n </div>\n\n <!-- Success. Announced politely; the dialog closes itself shortly after. -->\n <p\n v-if=\"justSent\"\n role=\"status\"\n data-testid=\"test-email-success\"\n class=\"tpl:mb-3 tpl:flex tpl:shrink-0 tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-success,var(--tpl-primary))]\"\n >\n <Check :size=\"13\" :stroke-width=\"2.5\" />\n {{ t.testEmail.success }}\n </p>\n\n <!-- Failure. Stays open so the user can retry. -->\n <p\n v-else-if=\"errorText\"\n role=\"alert\"\n data-testid=\"test-email-error\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ errorText }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n data-testid=\"test-email-cancel\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-[var(--tpl-shadow-sm)] tpl:transition-all tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSending\"\n :class=\"{ 'tpl:cursor-not-allowed tpl:opacity-50': isSending }\"\n @click=\"handleClose\"\n >\n {{ t.testEmail.cancel }}\n </button>\n <button\n type=\"button\"\n data-testid=\"test-email-send\"\n :class=\"primaryBtnClass\"\n :disabled=\"!canSend\"\n @click=\"handleSend\"\n >\n <span v-if=\"isSending\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.testEmail.sending }}\n </span>\n <span v-else>\n {{ t.testEmail.send }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n","<script setup lang=\"ts\">\nimport {\n primaryBtnClass,\n trackActionBtnClass,\n} from \"../constants/styleConstants\";\n/**\n * Send-a-test dialog, shared by the OSS and Cloud editors.\n *\n * The recipient control has three shapes, driven entirely by whether the\n * provider configured an allowlist:\n *\n * - **no allowlist** — free text, validated for shape only. This branch exists\n * for BYO senders; Cloud never takes it, because its list comes from a signed\n * JWT.\n * - **exactly one** — a read-only field. Preserved verbatim from the Cloud-only\n * version; there is nothing to choose, so offering an editable field would\n * imply otherwise.\n * - **several** — a picker of exactly those addresses.\n *\n * An empty allowlist never reaches here: the feature reports itself unavailable,\n * so no trigger renders. (The Cloud-only version fell through to `v-else` and\n * rendered a select with no options and a permanently disabled Send.)\n */\nimport TplModal from \"./TplModal.vue\";\n// Statically imported: this modal is already lazy-loaded as a whole, so the\n// preview rides its chunk rather than costing a second round-trip and flashing\n// an empty frame. Still shared with the saved-blocks surfaces, which lazy-load\n// it themselves.\nimport BlockPreviewCanvas from \"./BlockPreviewCanvas.vue\";\n// The editor header's own control, reused verbatim so the two viewport switches\n// are the same component rather than two things that resemble each other.\nimport ViewportToggle from \"./ViewportToggle.vue\";\nimport MergeTagModeToggle from \"./MergeTagModeToggle.vue\";\nimport { useI18n } from \"../composables/useI18n\";\nimport { looksLikeEmail } from \"../utils/validateEmailShape\";\nimport { Check, LoaderCircle, RefreshCw } from \"@lucide/vue\";\nimport { computed, inject, onScopeDispose, ref, watch } from \"vue\";\nimport {\n applyLayout,\n resolveLocale,\n hasMergeTagSamples,\n type ViewportSize,\n} from \"@templatical/types\";\nimport {\n EDITOR_KEY,\n LAYOUT_KEY,\n MERGE_TAGS_KEY,\n NO_MERGE_TAGS,\n MERGE_TAG_SAMPLE_MODE_KEY,\n RESOLVE_PREVIEW_KEY,\n REGISTER_DIALOG_PREVIEW_REFRESH_KEY,\n} from \"../keys\";\nimport { usePreviewResolution } from \"../composables/usePreviewResolution\";\nimport type { TestEmailError } from \"../composables/useTestEmailFeature\";\n\nconst props = defineProps<{\n visible: boolean;\n /** Omitted / undefined means unrestricted, so the field accepts free text. */\n allowedRecipients?: string[];\n defaultRecipient?: string;\n isSending: boolean;\n justSent: boolean;\n error: TestEmailError | null;\n}>();\n\nconst emit = defineEmits<{\n (e: \"send\", recipient: string): void;\n (e: \"close\"): void;\n}>();\n\nconst { t } = useI18n();\nconst editor = inject(EDITOR_KEY, null);\nconst layout = inject(LAYOUT_KEY, undefined);\n\n// Seed before the resolution instance installs its immediate watcher, so an\n// opening dialog makes one `open` call with the selected recipient.\nconst recipient = ref(\n props.visible\n ? (props.defaultRecipient ?? props.allowedRecipients?.[0] ?? \"\")\n : \"\",\n);\n\nwatch(\n () => props.visible,\n (visible) => {\n if (visible) {\n recipient.value =\n props.defaultRecipient ?? props.allowedRecipients?.[0] ?? \"\";\n }\n },\n { flush: \"sync\" },\n);\n\nconst previewViewport = ref<ViewportSize>(\"desktop\");\n\n/**\n * Its own resolution instance rather than the editor's, because this dialog has\n * a recipient and the editor's preview does not — resolving for \"whoever is\n * selected here\" is a different question from resolving for the canvas.\n * `isActive` is the dialog's own visibility.\n *\n * Compose the embedder shell while the dialog is showing. The send payload\n * stays unshelled.\n */\nconst resolvePreviewHook = inject(RESOLVE_PREVIEW_KEY, undefined);\nconst previewResolution = usePreviewResolution({\n resolvePreview: resolvePreviewHook ?? undefined,\n getContent: () => {\n const raw = editor?.content.value ?? { blocks: [], settings: {} as never };\n if (!props.visible) return raw;\n const locale = editor?.activeLocale?.value ?? raw.settings.locale ?? \"en\";\n const localized = resolveLocale(raw, locale);\n return layout\n ? applyLayout(\n resolveLocale(layout, locale, { missing: \"default\" }),\n localized,\n )\n : localized;\n },\n isActive: () => props.visible,\n getLocale: () =>\n editor?.activeLocale?.value ?? editor?.content.value.settings.locale,\n getRecipient: () => recipient.value || undefined,\n});\n\nconst registerDialogRefresh = inject(REGISTER_DIALOG_PREVIEW_REFRESH_KEY, null);\nlet unregisterDialogRefresh: (() => void) | null = null;\nwatch(\n () => props.visible,\n (visible) => {\n unregisterDialogRefresh?.();\n unregisterDialogRefresh = visible\n ? (registerDialogRefresh?.(previewResolution.refresh) ?? null)\n : null;\n },\n { immediate: true, flush: \"sync\" },\n);\nonScopeDispose(() => unregisterDialogRefresh?.());\n\n/**\n * Shared with the editor's own preview, so switching here and switching there\n * are the same choice — it is a property of how the user wants to read a\n * preview, not of one dialog. Falls back to a local ref for headless mounts.\n */\nconst sharedSampleMode = inject(MERGE_TAG_SAMPLE_MODE_KEY, null);\n// Seeded from availability, matching how `useEditorCore` seeds the shared ref.\n// A blanket `true` would make the dialog claim tags \"show example values\" for a\n// consumer who configured none — false, and with no toggle rendered to correct\n// it, since the toggle hides itself when nothing has a sample.\nconst localSampleMode = ref(\n hasMergeTagSamples(inject(MERGE_TAGS_KEY, NO_MERGE_TAGS).value),\n);\nconst sampleMode = computed({\n get: () =>\n // Off entirely while a resolver is configured — same rule as the canvas.\n previewResolution.isConfigured\n ? false\n : (sharedSampleMode?.value ?? localSampleMode.value),\n set: (on: boolean) => {\n if (sharedSampleMode) sharedSampleMode.value = on;\n else localSampleMode.value = on;\n },\n});\n\nconst previewBlocks = computed(\n () => previewResolution.content.value.blocks ?? [],\n);\n\nconst previewSettings = computed(\n () => previewResolution.content.value.settings,\n);\n\nconst hasAllowlist = computed(\n () =>\n props.allowedRecipients !== undefined && props.allowedRecipients.length > 0,\n);\nconst isSingleRecipient = computed(() => props.allowedRecipients?.length === 1);\n\n/** Shape-check free text only; a picker can't produce a malformed value. */\nconst isRecipientValid = computed(() =>\n hasAllowlist.value\n ? recipient.value.length > 0\n : looksLikeEmail(recipient.value),\n);\n\nconst canSend = computed(\n () => isRecipientValid.value && !props.isSending && !props.justSent,\n);\n\n/** Free text that's been typed into but isn't yet a plausible address. */\nconst showShapeHint = computed(\n () =>\n !hasAllowlist.value &&\n recipient.value.trim().length > 0 &&\n !isRecipientValid.value,\n);\n\nconst errorText = computed(() => {\n if (!props.error) return null;\n return props.error.kind === \"provider\"\n ? props.error.message\n : t.testEmail.recipientNotAllowed;\n});\n\nfunction handleSend(): void {\n if (!canSend.value) return;\n emit(\"send\", recipient.value.trim());\n}\n\nfunction handleClose(): void {\n // Sending is the one state that blocks dismissal; the success state closes\n // immediately rather than making the user wait out the timer.\n if (props.isSending) return;\n emit(\"close\");\n}\n\nfunction handleKeydown(event: KeyboardEvent): void {\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n handleSend();\n }\n if (event.key === \"Escape\") {\n handleClose();\n }\n}\n</script>\n\n<template>\n <TplModal :visible=\"visible\" @close=\"handleClose\" @keydown=\"handleKeydown\">\n <!-- Grows to `max-w-3xl` only while the preview is open. A 600px email has\n to render at true size AND leave slack on both sides for the band of\n body background the preview draws beside it: at `max-w-2xl` the\n preview region's content box is exactly 600px, so the band would have\n nowhere to go and `settings.backgroundColor` would look unset for any\n template whose sections span the full width. Collapsed, it stays the\n compact form it was. `w-full` keeps it shrinking on narrow screens.\n `max-h-[90%]`\n with a `min-h-0 overflow-y-auto` preview region is the pattern the\n saved-blocks dialogs use: the cap bounds the panel to TplModal's\n backdrop (never to `vh` — see the note there), and `min-h-0` is what\n lets a flex child shrink below its content and actually scroll. -->\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-busy=\"isSending\"\n aria-labelledby=\"tpl-test-email-title\"\n class=\"tpl-scale-in tpl:flex tpl:max-h-[90%] tpl:w-full tpl:max-w-3xl tpl:flex-col tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5\"\n style=\"\n background-color: var(--tpl-bg-elevated);\n box-shadow: var(--tpl-shadow-xl);\n \"\n >\n <h3\n id=\"tpl-test-email-title\"\n class=\"tpl:mb-4 tpl:shrink-0 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ t.testEmail.title }}\n </h3>\n\n <!-- Recipient -->\n <div class=\"tpl:mb-3 tpl:shrink-0\">\n <label\n for=\"tpl-test-email-recipient\"\n class=\"tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.testEmail.recipientLabel }}\n </label>\n\n <!-- Exactly one allowed address: nothing to choose. -->\n <input\n v-if=\"isSingleRecipient\"\n id=\"tpl-test-email-recipient\"\n type=\"text\"\n :value=\"recipient\"\n disabled\n data-testid=\"test-email-recipient\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:opacity-70 tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n />\n\n <!-- Several allowed addresses: pick one. -->\n <select\n v-else-if=\"hasAllowlist\"\n id=\"tpl-test-email-recipient\"\n v-model=\"recipient\"\n :disabled=\"isSending || justSent\"\n data-testid=\"test-email-recipient\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n >\n <option\n v-for=\"email in allowedRecipients\"\n :key=\"email\"\n :value=\"email\"\n >\n {{ email }}\n </option>\n </select>\n\n <!-- No allowlist: free text. -->\n <input\n v-else\n id=\"tpl-test-email-recipient\"\n v-model=\"recipient\"\n type=\"email\"\n autocomplete=\"email\"\n spellcheck=\"false\"\n :placeholder=\"t.testEmail.recipientPlaceholder\"\n :disabled=\"isSending || justSent\"\n data-testid=\"test-email-recipient\"\n class=\"tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-[var(--tpl-shadow-sm)] tpl:outline-none tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[var(--tpl-ring)] tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]\"\n />\n\n <p\n v-if=\"showShapeHint\"\n class=\"tpl:mt-1.5 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ t.testEmail.invalidAddress }}\n </p>\n </div>\n\n <!-- Preview header: a label plus the viewport switch. Always shown — the\n preview is part of the dialog rather than something to opt into. -->\n <div class=\"tpl:mb-2 tpl:shrink-0\">\n <!-- Two segmented controls: `flex-wrap` so they drop to their own row\n rather than crushing the label on a narrow viewport. -->\n <div\n class=\"tpl:flex tpl:flex-wrap tpl:items-center tpl:justify-between tpl:gap-2\"\n >\n <span\n class=\"tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\"\n >\n {{ t.testEmail.preview }}\n </span>\n\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <MergeTagModeToggle\n v-if=\"!previewResolution.supersedesSamples.value\"\n :sample-mode=\"sampleMode\"\n @change=\"sampleMode = $event\"\n />\n\n <!-- Without this the preview would silently show only the desktop\n variant of any responsive block. -->\n <ViewportToggle\n :viewport=\"previewViewport\"\n @change=\"previewViewport = $event\"\n />\n <!-- The switches' track recipe, so it reads as the viewport\n switch's neighbour at the same 38px. -->\n <button\n v-if=\"previewResolution.isConfigured\"\n type=\"button\"\n :aria-label=\"t.previewResolution.refresh\"\n :title=\"t.previewResolution.refresh\"\n :aria-busy=\"previewResolution.isResolving.value\"\n :class=\"[trackActionBtnClass, 'tpl:w-[38px]']\"\n @click=\"previewResolution.refresh()\"\n >\n <RefreshCw\n :size=\"18\"\n :stroke-width=\"1.5\"\n :class=\"{ 'tpl-spinner': previewResolution.isResolving.value }\"\n />\n </button>\n </div>\n </div>\n\n <!-- The hint has to follow the mode: \"shown unresolved\" is simply false\n once every tag renders a realistic value. -->\n <p\n data-testid=\"test-email-preview-hint\"\n class=\"tpl:mt-1 tpl:text-xs tpl:text-[var(--tpl-text-dim)]\"\n >\n {{\n previewResolution.supersedesSamples.value\n ? t.previewResolution.hint\n : sampleMode\n ? t.testEmail.previewHintSample\n : t.testEmail.previewHint\n }}\n </p>\n </div>\n\n <!-- The one region allowed to grow: `flex-1 min-h-0` so it absorbs the\n remaining height and scrolls, leaving the form and actions fixed. -->\n <div\n id=\"tpl-test-email-preview\"\n data-testid=\"test-email-preview\"\n class=\"tpl:mb-3 tpl:min-h-0 tpl:flex-1 tpl:overflow-y-auto tpl:rounded-[var(--tpl-radius-sm)] tpl:p-3 tpl:bg-[var(--tpl-canvas-bg)]\"\n >\n <!-- Skeleton while a *first* resolve is outstanding, so the dialog never\n flashes the unresolved template before the resolved one. Sized like\n the frame it replaces to avoid a layout jump. A re-resolve (recipient\n change) keeps the previous result instead — `isInitialResolve`. -->\n <div\n v-if=\"previewResolution.isInitialResolve.value\"\n role=\"status\"\n aria-busy=\"true\"\n data-testid=\"preview-resolution-loading\"\n class=\"tpl:flex tpl:flex-col tpl:gap-3\"\n >\n <span class=\"tpl:sr-only\">{{ t.previewResolution.resolving }}</span>\n <div\n v-for=\"n in 3\"\n :key=\"n\"\n aria-hidden=\"true\"\n class=\"tpl-pulse tpl:h-16 tpl:rounded-md tpl:bg-[var(--tpl-bg-hover)]\"\n ></div>\n </div>\n\n <!-- Resolution failed: the unresolved template renders below, so the\n dialog degrades rather than showing an empty frame. -->\n <p\n v-else-if=\"previewResolution.hasFailed.value\"\n role=\"status\"\n data-testid=\"preview-resolution-failed\"\n class=\"tpl:mb-2 tpl:rounded-md tpl:px-3 tpl:py-2 tpl:text-xs tpl:text-[var(--tpl-text-muted)] tpl:bg-[var(--tpl-bg-hover)]\"\n >\n {{ t.previewResolution.failed }}\n </p>\n\n <BlockPreviewCanvas\n v-if=\"!previewResolution.isInitialResolve.value\"\n :blocks=\"previewBlocks\"\n :settings=\"previewSettings\"\n :viewport=\"previewViewport\"\n :apply-condition-filter=\"!previewResolution.isConfigured\"\n />\n </div>\n\n <!-- Success. Announced politely; the dialog closes itself shortly after. -->\n <p\n v-if=\"justSent\"\n role=\"status\"\n data-testid=\"test-email-success\"\n class=\"tpl:mb-3 tpl:flex tpl:shrink-0 tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-success,var(--tpl-primary))]\"\n >\n <Check :size=\"13\" :stroke-width=\"2.5\" />\n {{ t.testEmail.success }}\n </p>\n\n <!-- Failure. Stays open so the user can retry. -->\n <p\n v-else-if=\"errorText\"\n role=\"alert\"\n data-testid=\"test-email-error\"\n class=\"tpl:mb-3 tpl:shrink-0 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n >\n {{ errorText }}\n </p>\n\n <!-- Actions -->\n <div class=\"tpl:flex tpl:shrink-0 tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n data-testid=\"test-email-cancel\"\n class=\"tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-[var(--tpl-shadow-sm)] tpl:transition-all tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]\"\n :disabled=\"isSending\"\n :class=\"{ 'tpl:cursor-not-allowed tpl:opacity-50': isSending }\"\n @click=\"handleClose\"\n >\n {{ t.testEmail.cancel }}\n </button>\n <button\n type=\"button\"\n data-testid=\"test-email-send\"\n :class=\"primaryBtnClass\"\n :disabled=\"!canSend\"\n @click=\"handleSend\"\n >\n <span v-if=\"isSending\" class=\"tpl:flex tpl:items-center tpl:gap-1.5\">\n <LoaderCircle\n class=\"tpl:animate-spin\"\n :size=\"12\"\n :stroke-width=\"2\"\n />\n {{ t.testEmail.sending }}\n </span>\n <span v-else>\n {{ t.testEmail.send }}\n </span>\n </button>\n </div>\n </div>\n </TplModal>\n</template>\n"],"mappings":";;;;;;;;;;;AASA,IAAMgE,IAA0B;AAkBhC,SAAgBC,EAAe,GAAwB;CACrD,IAAMC,IAAUC,EAAM,KAAK;CAE3B,IADID,EAAQ,WAAW,KACnB,KAAK,KAAKA,CAAO,GAAG,OAAO;CAE/B,IAAME,IAAQF,EAAQ,MAAM,GAAG;CAC/B,IAAIE,EAAM,WAAW,GAAG,OAAO;CAE/B,IAAM,CAACC,GAAOC,KAAUF;CAExB,IADIC,EAAM,WAAW,KACjBL,EAAwB,KAAKM,CAAM,GAAG,OAAO;CAIjD,IAAMC,IAAMD,EAAO,QAAQ,GAAG;CAC9B,OAAOC,IAAM,KAAKA,IAAMD,EAAO,SAAS;AAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECYA,IAAM8B,IAAQC,GAURC,IAAOH,GAKP,EAAE,SAAMlD,GAAQ,GAChBsD,IAAS5E,E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