domma-cms 1.32.0 → 1.34.0

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 (113) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/CLAUDE.md +1 -1
  3. package/admin/js/lib/admin-brand.js +1 -1
  4. package/admin/js/lib/admin-theme.js +1 -1
  5. package/admin/js/lib/shortcode-context-menu.js +2 -2
  6. package/admin/js/lib/shortcode-registry.js +1 -1
  7. package/admin/js/lib/sidebar-frequent.js +1 -1
  8. package/admin/js/lib/sidebar-notify.js +1 -1
  9. package/admin/js/lib/sidebar-renderer.js +4 -4
  10. package/admin/js/lib/site-settings-arrange.js +2 -2
  11. package/admin/js/lib/theme-aware-logo.js +1 -0
  12. package/admin/js/templates/settings.html +7 -1
  13. package/admin/js/views/settings.js +2 -2
  14. package/docs/markdown-shortcodes.md +13 -0
  15. package/docs/starter-blocks.md +37 -1
  16. package/package.json +1 -1
  17. package/plugins/_lib/admin/mail/body-menu.js +1 -1
  18. package/plugins/_lib/admin/mail/cms-host.js +1 -1
  19. package/plugins/_lib/admin/mail/compose-window.js +1 -1
  20. package/plugins/_lib/admin/mail/contacts.js +1 -1
  21. package/plugins/_lib/admin/mail/diagnostics-section.js +1 -1
  22. package/plugins/_lib/admin/mail/drag-drop.js +1 -1
  23. package/plugins/_lib/admin/mail/folder-tree.js +1 -1
  24. package/plugins/_lib/admin/mail/font-controls.js +1 -1
  25. package/plugins/_lib/admin/mail/fonts.js +1 -1
  26. package/plugins/_lib/admin/mail/host-context.js +1 -1
  27. package/plugins/_lib/admin/mail/identity.js +1 -1
  28. package/plugins/_lib/admin/mail/image-senders-section.js +1 -1
  29. package/plugins/_lib/admin/mail/keyboard.js +1 -1
  30. package/plugins/_lib/admin/mail/mail.html +1 -1
  31. package/plugins/_lib/admin/mail/message-actions.js +1 -1
  32. package/plugins/_lib/admin/mail/oauth-panel.js +1 -1
  33. package/plugins/_lib/admin/mail/panes.js +1 -1
  34. package/plugins/_lib/admin/mail/reader-kit.js +1 -1
  35. package/plugins/_lib/admin/mail/reader-runtime.js +2 -1
  36. package/plugins/_lib/admin/mail/reader-view.js +1 -1
  37. package/plugins/_lib/admin/mail/resizable.js +1 -1
  38. package/plugins/_lib/admin/mail/restore-spam.js +1 -1
  39. package/plugins/_lib/admin/mail/rules.js +1 -1
  40. package/plugins/_lib/admin/mail/scheduling.js +1 -1
  41. package/plugins/_lib/admin/mail/section-kit.js +1 -1
  42. package/plugins/_lib/admin/mail/security-note.js +1 -1
  43. package/plugins/_lib/admin/mail/settings-section.js +12 -4
  44. package/plugins/_lib/admin/mail/templates.js +1 -1
  45. package/plugins/_lib/admin/mail/threads.js +1 -1
  46. package/plugins/_lib/admin/mail/vacation.js +1 -1
  47. package/plugins/_lib/admin/mail/when-closed.js +1 -1
  48. package/plugins/_lib/admin/ui/dates.js +1 -1
  49. package/plugins/_lib/admin/ui/resizable.js +1 -1
  50. package/plugins/_lib/domma-mail.lock.json +80 -80
  51. package/plugins/_lib/mail/accountFileStore.js +1 -1
  52. package/plugins/_lib/mail/accountRepository.js +23 -2
  53. package/plugins/_lib/mail/accountRoutes.js +1 -1
  54. package/plugins/_lib/mail/accounts.js +1 -1
  55. package/plugins/_lib/mail/bodyTokenProvider.js +1 -1
  56. package/plugins/_lib/mail/bodyTokens.js +1 -1
  57. package/plugins/_lib/mail/compose.js +1 -1
  58. package/plugins/_lib/mail/defaults.js +1 -1
  59. package/plugins/_lib/mail/envelope.js +1 -1
  60. package/plugins/_lib/mail/folderActions.js +1 -1
  61. package/plugins/_lib/mail/folderRuntime.js +1 -1
  62. package/plugins/_lib/mail/folders.js +1 -1
  63. package/plugins/_lib/mail/imapPoolRuntime.js +1 -1
  64. package/plugins/_lib/mail/mbox.js +1 -1
  65. package/plugins/_lib/mail/message-action.js +1 -1
  66. package/plugins/_lib/mail/messageSecurity.js +1 -1
  67. package/plugins/_lib/mail/messageSecurityProvider.js +1 -1
  68. package/plugins/_lib/mail/networkAddresses.js +1 -1
  69. package/plugins/_lib/mail/networkPolicy.js +1 -1
  70. package/plugins/_lib/mail/oauthAccounts.js +1 -1
  71. package/plugins/_lib/mail/oauthRouteRuntime.js +1 -1
  72. package/plugins/_lib/mail/oauthRuntime.js +1 -1
  73. package/plugins/_lib/mail/pollSchedule.js +1 -1
  74. package/plugins/_lib/mail/poller.js +1 -1
  75. package/plugins/_lib/mail/pollerRuntime.js +1 -1
  76. package/plugins/_lib/mail/priority.js +1 -1
  77. package/plugins/_lib/mail/publicMailbox.js +1 -1
  78. package/plugins/_lib/mail/readRuntime.js +1 -1
  79. package/plugins/_lib/mail/render.js +1 -1
  80. package/plugins/_lib/mail/ruleRunner.js +1 -1
  81. package/plugins/_lib/mail/schedulerRuntime.js +1 -1
  82. package/plugins/_lib/mail/secretProvider.js +1 -1
  83. package/plugins/_lib/mail/secretbox.js +1 -1
  84. package/plugins/_lib/mail/senderAuth.js +1 -1
  85. package/plugins/_lib/mail/sieve.js +1 -1
  86. package/plugins/_lib/mail/smtpService.js +1 -1
  87. package/plugins/_lib/mail/snoozeRuntime.js +1 -1
  88. package/plugins/_lib/mail/store.js +1 -1
  89. package/plugins/_lib/mail/subscriptions.js +1 -1
  90. package/plugins/_lib/mail/syncPlan.js +1 -1
  91. package/plugins/_lib/mail/syncRuntime.js +1 -1
  92. package/plugins/_lib/mail/syncSelection.js +8 -3
  93. package/plugins/_lib/mail/unreadBadge.js +1 -1
  94. package/plugins/_lib/mail/unsubscribe.js +1 -1
  95. package/plugins/_lib/mail/vacationRuntime.js +1 -1
  96. package/plugins/_lib/mail/write.js +1 -1
  97. package/server/blocks/catalog.json +24 -0
  98. package/server/blocks/domma-block-comparison-card.css +20 -0
  99. package/server/blocks/domma-block-comparison-card.html +18 -0
  100. package/server/blocks/domma-block-comparison-card.meta.json +7 -0
  101. package/server/blocks/domma-block-cta-card.css +20 -0
  102. package/server/blocks/domma-block-cta-card.html +15 -0
  103. package/server/blocks/domma-block-cta-card.meta.json +7 -0
  104. package/server/blocks/domma-block-feature-card.css +20 -0
  105. package/server/blocks/domma-block-feature-card.html +15 -0
  106. package/server/blocks/domma-block-feature-card.meta.json +7 -0
  107. package/server/blocks/domma-block-image-card.css +20 -0
  108. package/server/blocks/domma-block-image-card.html +17 -0
  109. package/server/blocks/domma-block-image-card.meta.json +7 -0
  110. package/server/services/adminBrand.js +4 -1
  111. package/server/services/embedCsp.js +1 -1
  112. package/server/services/markdown.js +65 -6
  113. package/server/services/sidebarFrequent.js +1 -1
@@ -0,0 +1 @@
1
+ export function isDarkAdminTheme(){if(typeof document>"u")return!1;const e=getComputedStyle(document.body),n=e.getPropertyValue("--dm-background").trim()||e.backgroundColor,t=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});if(!t)return!1;t.fillStyle=n,t.fillRect(0,0,1,1);const[o,r,a]=t.getImageData(0,0,1,1).data,l=[o,r,a].map(i=>{const s=i/255;return s<=.04045?s/12.92:((s+.055)/1.055)**2.4});return .2126*l[0]+.7152*l[1]+.0722*l[2]<.5}export function syncThemeAwareLogos(e=typeof document>"u"?null:document){if(!e)return;const n=[];if(e.matches?.("img[data-logo-light], img[data-logo-dark]")&&n.push(e),n.push(...e.querySelectorAll?.("img[data-logo-light], img[data-logo-dark]")||[]),!n.length)return;let c=!1;try{c=isDarkAdminTheme()}catch{}for(const t of n){const o=t.dataset.logoLight||"",r=t.dataset.logoDark||"",a=c?r||o:o||r;a&&t.getAttribute("src")!==a&&t.setAttribute("src",a)}}
@@ -119,10 +119,16 @@
119
119
  <button type="button" class="btn btn-sm btn-ghost" data-on-click="clearBrandImage('adminBrandLogo')">Remove</button>
120
120
  <img data-bind-src="adminBrandLogo.value" data-bind-hidden="!adminBrandLogo.value" alt="Admin logo image preview" style="display:block;max-width:180px;max-height:80px;object-fit:contain;margin-top:.75rem;">
121
121
  </div>
122
+ <div><label class="form-label" for="stx-adminBrandLogoDark">Admin logo for dark themes</label>
123
+ <input id="stx-adminBrandLogoDark" type="text" class="form-input" placeholder="Optional - uses the main logo when empty" data-model="adminBrandLogoDark.value">
124
+ <button type="button" class="btn btn-sm btn-ghost" data-on-click="pickBrandImage('adminBrandLogoDark')">Choose or upload image</button>
125
+ <button type="button" class="btn btn-sm btn-ghost" data-on-click="clearBrandImage('adminBrandLogoDark')">Remove</button>
126
+ <img data-bind-src="adminBrandLogoDark.value" data-bind-hidden="!adminBrandLogoDark.value" alt="Dark theme admin logo preview" style="display:block;max-width:180px;max-height:80px;object-fit:contain;margin-top:.75rem;background:#1f2430;padding:.25rem;border-radius:4px;">
127
+ </div>
122
128
  <div><label class="form-label" for="stx-adminBrandIcon">Admin icon</label>
123
129
  <div data-brand-icon="adminBrandIcon"></div>
124
130
  </div>
125
- </div><p class="text-muted">The logo takes priority over the icon. Leave both empty to use the default icon.</p></div>
131
+ </div><p class="text-muted">The logo takes priority over the icon. The optional dark theme logo is used when the admin theme has a dark background. Leave both empty to use the default icon.</p></div>
126
132
  </div>
127
133
  </div>
128
134
 
@@ -1,4 +1,4 @@
1
- import{api as B,apiRequest as k}from"../api.js";import{placeTools as Le}from"../lib/sidebar-grouping.js";import{addBannerAction as me}from"../lib/plugin-chrome.js";import{helpPopovers as Re}from"../lib/help-popover.js";import{openMenuAt as G,sidebarCount as fe}from"../lib/tool-kit.js";import{changedTabs as Ie,describeCacheKey as J,draftOf as Ae,expiresIn as Pe,formFromDraft as $e,siteSettingsForm as Be,homeValue as De,siteSettingsPayload as He,siteUrlError as he,settingsProblems as je,snapshot as ve,TAB_FIELDS as qe}from"../lib/site-settings-arrange.js";import{pickMedia as Ue}from"../lib/media-picker.js";import{makeIconInput as _e}from"../lib/shortcode-modal.js";import{fmtDateTime as Ke}from"../lib/dates.js";const Q=/^\/settings(\?.*)?$/,be="#/settings",g="settings.draft",Fe=`
1
+ import{api as D,apiRequest as k}from"../api.js";import{placeTools as Oe}from"../lib/sidebar-grouping.js";import{addBannerAction as me}from"../lib/plugin-chrome.js";import{helpPopovers as Re}from"../lib/help-popover.js";import{openMenuAt as G,sidebarCount as fe}from"../lib/tool-kit.js";import{changedTabs as Ie,describeCacheKey as J,draftOf as Ae,expiresIn as Pe,formFromDraft as Be,siteSettingsForm as De,homeValue as $e,siteSettingsPayload as He,siteUrlError as he,settingsProblems as je,snapshot as ve,TAB_FIELDS as qe}from"../lib/site-settings-arrange.js";import{pickMedia as Ue}from"../lib/media-picker.js";import{makeIconInput as _e}from"../lib/shortcode-modal.js";import{fmtDateTime as Ke}from"../lib/dates.js";const Q=/^\/settings(\?.*)?$/,be="#/settings",g="settings.draft",Fe=`
2
2
  <div class="stx-problem">
3
3
  <span class="stx-chip" data-bind-class="tone === 'danger' ? 'is-bad' : 'is-warn'">{{label}}</span>
4
4
  <span>{{text}}</span>
@@ -8,4 +8,4 @@ import{api as B,apiRequest as k}from"../api.js";import{placeTools as Le}from"../
8
8
  <span class="stx-main"><strong>{{path}}</strong><small>{{meta}}</small></span>
9
9
  <span class="stx-chip">{{expires}}</span>
10
10
  <button type="button" class="stx-kebab" aria-label="Actions for {{path}}" title="Actions">\u22EE</button>
11
- </div>`,D=["general","branding","email","cookies","cache"];async function Ne(c,l){const[r,w]=await Promise.all([H.get("/api/sidebar/menu").catch(()=>({items:[]})),H.get("/api/sidebar/registered-items").catch(()=>[])]),n=new Map([["/","Dashboard (built in)"]]),i=(v,u)=>{for(const o of v||[]){if(!o||o.hidden||o.restricted)continue;const m=typeof o.url=="string"?o.url:"";m.startsWith("#/")&&m.length>2&&!n.has(m.slice(1))&&n.set(m.slice(1),`${u?`${u} \u203A `:""}${o.text||m}`),i(o.items,o.url?u:o.text||u)}};i(Le(r?.items||[],w||[]),""),n.has(l)||n.set(l,`${l} (not in the sidebar)`),c.replaceChildren();for(const[v,u]of n){const o=document.createElement("option");o.value=v,o.textContent=u,c.appendChild(o)}}let f=null,ye=!1;function Ve(){ye||!window.R?.use||(ye=!0,R.use((c,l,r)=>!(Q.test(l?.path||"")&&!Q.test(c?.path||""))||!f?.dirty()?r():E.confirm("You have unsaved settings. Leave anyway? They are kept as a draft for your next visit (not the SMTP password).").then(n=>{n?r():history.replaceState(null,"","#/settings")})),M.subscribe("router:afterChange",({to:c}={})=>{if(f&&!Q.test(c?.path||"")){const l=f;f=null,l.dispose()}}))}export const settingsView={templateUrl:"/admin/js/templates/settings.html",async onMount(c){if(Ve(),f){const e=f;f=null,e.dispose()}const l=[],r=e=>(l.push(e),e);let w=!1;const n=c.get(0).querySelector(".stx")||c.get(0),i=()=>!w&&n.isConnected,v=E.loader(c.get(0),{type:"dots"});let u;try{u=await B.settings.get()}catch(e){v.destroy(),E.toast(`Could not load the settings: ${e.message||e}`,{type:"error"});return}if(v.destroy(),!n.isConnected)return;const o=M.observable(u||{}),m=Be(u||{}),a={};for(const[e,t]of Object.entries(m))a[e]=M.observable(t);const j=()=>Object.fromEntries(Object.keys(a).map(e=>[e,a[e].value])),X=()=>Object.fromEntries(Object.keys(a).map(e=>[e,a[e].peek()])),b=M.observable(m),q=M.computed(()=>ve(b.value)),C=M.computed(()=>ve(j())!==q.value),x=M.observable(!1),T=M.observable(""),Z=M.observable(!1);B.plugins.policy().then(e=>{i()&&(Z.value=e?.signedOnly===!1)}).catch(()=>{});const U=M.observable(!1),ee=M.computed(()=>{const e=new Set(Ie(j(),b.value));return Object.fromEntries(Object.keys(qe).map(t=>[t,e.has(t)]))}),_=M.observable([]);r(M.effect(()=>{_.value=je(j(),o.value).map(e=>({...e,label:e.tone==="danger"?"Mail":"Check"}))}));const te=M.observable(""),O=M.observable(!1),L=M.observable(""),A=M.observable(""),p=M.observable(null),K=M.observable([]),F=M.observable(""),z=M.observable(!0),N=M.observable(""),se=M.observable([]);r(M.effect(()=>{const e=F.value.trim().toLowerCase(),t=Date.now();se.value=[...K.value].reverse().filter(s=>!e||String(s.key).toLowerCase().includes(e)||(s.tags||[]).some(d=>String(d).toLowerCase().includes(e))).map(s=>{const d=J(s.key);return{id:s.key,path:d.path,meta:[d.page?`as ${d.role}`:"not a page",(s.tags||[]).join(", ")].filter(Boolean).join(" \xB7 "),expires:Pe(s.expiresAt,t)}})}));const ge={...a,saving:x,dirty:C,tabs:ee,problems:_,testTo:te,testing:O,testResult:L,testTone:A,cacheQuery:F,cacheLoading:z,cacheError:N,cacheRows:se,errorText:T,problemsText:M.computed(()=>_.value.length?"yes":""),siteUrlError:M.computed(()=>he(a.siteUrl.value)),noSmtp:M.computed(()=>!String(a.smtpHost.value||"").trim()),mayAllowInsecureTLS:Z,dirtyEmail:M.computed(()=>ee.value.email),cacheOn:M.computed(()=>p.value?.enabled===!0),cacheState:M.computed(()=>{const e=p.value;return e?e.enabled?`On (${e.driver})`:"Off":"Status unknown"}),cacheSize:M.computed(()=>{const e=p.value;return e?.enabled&&e.size!==null&&e.size!==void 0?`${e.size}${e.maxItems?` of ${e.maxItems}`:""} entries`:""}),cacheHits:M.computed(()=>{const e=p.value?.hitRate;return e==null?"":`${Math.round(e*100)}% served from the cache`}),cacheToggleText:M.computed(()=>p.value?.enabled?"Turn off":"Turn on"),cacheEmpty:M.computed(()=>F.value.trim()?"Nothing matches.":p.value?.enabled?"The cache is empty - pages are cached as visitors open them.":"The cache is off.")};async function V(){if(x.peek())return;const e=X(),t=b.peek(),s=he(e.siteUrl);if(s){E.toast(`Site URL: ${s}`,{type:"error"});return}x.value=!0,T.value="";const d=String(e.title).trim()!==String(t.title).trim();try{await B.settings.save(He(e,o.peek(),{adminHomeReady:U.peek()}));const $=await B.settings.get().catch(()=>null);if(!i())return;$&&(o.value=$);const Oe={...e,smtpPass:""};a.smtpPass.value="",b.value=Oe;try{S.remove?S.remove(g):S.set(g,null)}catch{}document.dispatchEvent(new CustomEvent("dm:admin-home-changed")),(d||["adminBrandEnabled","adminBrandTitle","adminBrandLogo","adminBrandIcon"].some(pe=>e[pe]!==t[pe]))&&document.dispatchEvent(new CustomEvent("dm:sidebar-rebuild")),fe(be),E.toast("Settings saved.",{type:"success"})}catch($){T.value=$.message||"Could not save the settings.",E.toast("Settings not saved - see the message at the top.",{type:"error"})}finally{x.value=!1}}async function we(){await E.confirm("Throw away your unsaved settings?")&&(ae(b.peek()),T.value="")}function ae(e){for(const[t,s]of Object.entries(e))a[t]&&(a[t].value=s)}async function ke(){if(!O.peek()){O.value=!0,A.value="",L.value="Sending\u2026";try{const e=await k("/settings/test-email",{method:"POST",body:JSON.stringify({to:te.peek().trim()||void 0})});if(!i())return;L.value=e?.message||"Test email sent.",A.value="is-ok"}catch(e){if(!i())return;L.value=e.message||"Could not send the test email.",A.value="is-bad"}finally{O.value=!1}}}async function P(){z.value=!0;try{const[e,t]=await Promise.all([k("/cache/status").catch(()=>null),k("/cache/keys")]);if(!i())return;p.value=e,K.value=Array.isArray(t?.entries)?t.entries:[],N.value=""}catch(e){if(!i())return;N.value=`Could not read the cache: ${e.message||e}`}finally{z.value=!1}}async function Ee(){if(await E.confirm("Clear the whole response cache? The next visitor to each page renders it afresh.")){try{await k("/cache/clear",{method:"POST"}),E.toast("Cache cleared.",{type:"success"})}catch(e){E.toast(e.message||"Could not clear the cache.",{type:"error"})}i()&&await P()}}async function Se(){const e=p.peek()?.enabled===!0;if(!(e&&!await E.confirm("Turn the response cache off? Every visit will render its page afresh until it is turned back on. The choice is saved (config/cache.json)."))){try{p.value=await k("/cache/toggle",{method:"POST",body:JSON.stringify({enabled:!e})}),E.toast(e?"Cache turned off.":"Cache turned on.",{type:"success"}),fe(be)}catch(t){E.toast(t.message||"Could not change the cache.",{type:"error"})}i()&&await P()}}const ne=e=>K.peek().find(t=>t.key===e);function Me(e){const t=ne(e);if(!t)return[];const s=J(t.key);return[{header:s.path},{label:"Open the page",icon:"external-link",disabled:!s.page,action:()=>window.open(s.path,"_blank","noopener")},{label:"Copy key",icon:"copy",action:async()=>{try{await navigator.clipboard.writeText(t.key),E.toast("Key copied.",{type:"success"})}catch{E.toast("Could not copy - your browser blocked the clipboard.",{type:"warning"})}}},...s.page?[{label:"Copy address",icon:"link",action:async()=>{try{await navigator.clipboard.writeText(new URL(s.path,location.origin).href),E.toast("Address copied.",{type:"success"})}catch{E.toast("Could not copy - your browser blocked the clipboard.",{type:"warning"})}}}]:[]]}n.querySelector(".stx-problems").innerHTML=Fe;const y=n.querySelector(".stx-list");y.innerHTML=ze;const W=E.tabs(n.querySelector(".stx-tabs"),{tabSelector:".tab-item",panelSelector:".tab-panel"}),oe=new URLSearchParams(location.hash.split("?")[1]||"").get("tab");D.includes(oe)&&W.activate(D.indexOf(oe));const Ce=M.applyBindings(ge,n,{methods:{save:V,discard:we,sendTest:ke,refreshCache:P,clearCache:Ee,toggleCache:Se,pickBrandImage:async e=>{const t=await Ue({title:"Choose a branding image",current:a[e].peek()});t&&i()&&(a[e].value=t)},clearBrandImage:e=>{a[e].value=""},goTab:e=>{const t=D.indexOf(e);t>=0&&W.activate(t)}}});r(()=>Ce.dispose());for(const e of n.querySelectorAll("[data-brand-icon]")){const t=e.dataset.brandIcon,s=_e("Choose an icon",a[t].peek());s.input.id=`stx-${t}`,s.input.classList.add("form-input");const d=()=>{a[t].value=s.input.value};s.input.addEventListener("input",d),r(()=>s.input.removeEventListener("input",d)),r(M.effect(()=>{s.input.value=a[t].value})),e.appendChild(s.el)}r(Re(n,{position:"bottom"}));const xe=e=>{const t=e.target.closest("[data-go]");if(!t)return;const s=D.indexOf(t.dataset.go);s>=0&&W.activate(s)};n.querySelector(".stx-problems").addEventListener("click",xe);const Y=n.querySelector("#stx-admin-home");Ne(Y,De(a.adminHome.peek())).then(()=>{i()&&(Y.value=a.adminHome.peek(),U.value=!0)}).catch(()=>{});const Te=E.contextMenu(y,{cursor:"glyph",match:".stx-row",inherit:!1,density:"compact",items:e=>Me(e.dataset.id)});r(()=>Te?.destroy?.());const re=e=>{const t=ne(e.dataset.id),s=t&&J(t.key);s?.page?window.open(s.path,"_blank","noopener"):G(e)},ie=e=>{const t=e.target.closest(".stx-row");if(!t)return;const s=e.target.closest(".stx-kebab");if(s){G(s);return}re(t)},ce=e=>{const t=e.target.closest(".stx-row");t&&(e.key==="F10"&&e.shiftKey?(e.preventDefault(),G(t)):e.key==="Enter"&&e.target===t&&re(t))};y.addEventListener("click",ie),y.addEventListener("keydown",ce),r(()=>{y.removeEventListener("click",ie),y.removeEventListener("keydown",ce)}),me(c,{id:"settings-view-site",icon:"external-link",title:"View site",onClick:()=>window.open("/","_blank","noopener")}),me(c,{id:"settings-save",icon:"save",title:"Save (Ctrl+S)",onClick:()=>V()});const le=e=>{!(e.ctrlKey||e.metaKey)||e.key!=="s"||(e.preventDefault(),e.stopImmediatePropagation(),V())};document.addEventListener("keydown",le,!0),r(()=>document.removeEventListener("keydown",le,!0));const ue=()=>{if(C.peek())try{S.set(g,{form:Ae(X()),base:q.peek(),at:new Date().toISOString()})}catch{}},de=e=>{C.peek()&&(ue(),e.preventDefault(),e.returnValue="")};window.addEventListener("beforeunload",de),r(()=>window.removeEventListener("beforeunload",de)),f={dirty:()=>C.peek(),dispose(){w=!0,ue(),l.splice(0).reverse().forEach(e=>{try{e()}catch{}})}},I.scan(n),P();let h=null;try{h=S.get(g)}catch{}if(h?.form){try{S.remove?S.remove(g):S.set(g,null)}catch{}const e=h.base&&h.base!==q.peek(),t=h.at?` (${Ke(h.at)})`:"",s=e?`You left unsaved settings${t}, but the saved settings have changed since. Restore your version anyway?`:`You left unsaved settings${t}. Restore them?`;await E.confirm(s)&&i()&&(ae($e(b.peek(),h.form)),U.peek()&&(Y.value=a.adminHome.peek()))}}};
11
+ </div>`,$=["general","branding","email","cookies","cache"];async function Ne(c,l){const[r,w]=await Promise.all([H.get("/api/sidebar/menu").catch(()=>({items:[]})),H.get("/api/sidebar/registered-items").catch(()=>[])]),n=new Map([["/","Dashboard (built in)"]]),i=(v,u)=>{for(const o of v||[]){if(!o||o.hidden||o.restricted)continue;const m=typeof o.url=="string"?o.url:"";m.startsWith("#/")&&m.length>2&&!n.has(m.slice(1))&&n.set(m.slice(1),`${u?`${u} \u203A `:""}${o.text||m}`),i(o.items,o.url?u:o.text||u)}};i(Oe(r?.items||[],w||[]),""),n.has(l)||n.set(l,`${l} (not in the sidebar)`),c.replaceChildren();for(const[v,u]of n){const o=document.createElement("option");o.value=v,o.textContent=u,c.appendChild(o)}}let f=null,ye=!1;function Ve(){ye||!window.R?.use||(ye=!0,R.use((c,l,r)=>!(Q.test(l?.path||"")&&!Q.test(c?.path||""))||!f?.dirty()?r():E.confirm("You have unsaved settings. Leave anyway? They are kept as a draft for your next visit (not the SMTP password).").then(n=>{n?r():history.replaceState(null,"","#/settings")})),M.subscribe("router:afterChange",({to:c}={})=>{if(f&&!Q.test(c?.path||"")){const l=f;f=null,l.dispose()}}))}export const settingsView={templateUrl:"/admin/js/templates/settings.html",async onMount(c){if(Ve(),f){const e=f;f=null,e.dispose()}const l=[],r=e=>(l.push(e),e);let w=!1;const n=c.get(0).querySelector(".stx")||c.get(0),i=()=>!w&&n.isConnected,v=E.loader(c.get(0),{type:"dots"});let u;try{u=await D.settings.get()}catch(e){v.destroy(),E.toast(`Could not load the settings: ${e.message||e}`,{type:"error"});return}if(v.destroy(),!n.isConnected)return;const o=M.observable(u||{}),m=De(u||{}),s={};for(const[e,t]of Object.entries(m))s[e]=M.observable(t);const j=()=>Object.fromEntries(Object.keys(s).map(e=>[e,s[e].value])),X=()=>Object.fromEntries(Object.keys(s).map(e=>[e,s[e].peek()])),b=M.observable(m),q=M.computed(()=>ve(b.value)),C=M.computed(()=>ve(j())!==q.value),x=M.observable(!1),T=M.observable(""),Z=M.observable(!1);D.plugins.policy().then(e=>{i()&&(Z.value=e?.signedOnly===!1)}).catch(()=>{});const U=M.observable(!1),ee=M.computed(()=>{const e=new Set(Ie(j(),b.value));return Object.fromEntries(Object.keys(qe).map(t=>[t,e.has(t)]))}),_=M.observable([]);r(M.effect(()=>{_.value=je(j(),o.value).map(e=>({...e,label:e.tone==="danger"?"Mail":"Check"}))}));const te=M.observable(""),L=M.observable(!1),O=M.observable(""),A=M.observable(""),p=M.observable(null),K=M.observable([]),F=M.observable(""),z=M.observable(!0),N=M.observable(""),ae=M.observable([]);r(M.effect(()=>{const e=F.value.trim().toLowerCase(),t=Date.now();ae.value=[...K.value].reverse().filter(a=>!e||String(a.key).toLowerCase().includes(e)||(a.tags||[]).some(d=>String(d).toLowerCase().includes(e))).map(a=>{const d=J(a.key);return{id:a.key,path:d.path,meta:[d.page?`as ${d.role}`:"not a page",(a.tags||[]).join(", ")].filter(Boolean).join(" \xB7 "),expires:Pe(a.expiresAt,t)}})}));const ge={...s,saving:x,dirty:C,tabs:ee,problems:_,testTo:te,testing:L,testResult:O,testTone:A,cacheQuery:F,cacheLoading:z,cacheError:N,cacheRows:ae,errorText:T,problemsText:M.computed(()=>_.value.length?"yes":""),siteUrlError:M.computed(()=>he(s.siteUrl.value)),noSmtp:M.computed(()=>!String(s.smtpHost.value||"").trim()),mayAllowInsecureTLS:Z,dirtyEmail:M.computed(()=>ee.value.email),cacheOn:M.computed(()=>p.value?.enabled===!0),cacheState:M.computed(()=>{const e=p.value;return e?e.enabled?`On (${e.driver})`:"Off":"Status unknown"}),cacheSize:M.computed(()=>{const e=p.value;return e?.enabled&&e.size!==null&&e.size!==void 0?`${e.size}${e.maxItems?` of ${e.maxItems}`:""} entries`:""}),cacheHits:M.computed(()=>{const e=p.value?.hitRate;return e==null?"":`${Math.round(e*100)}% served from the cache`}),cacheToggleText:M.computed(()=>p.value?.enabled?"Turn off":"Turn on"),cacheEmpty:M.computed(()=>F.value.trim()?"Nothing matches.":p.value?.enabled?"The cache is empty - pages are cached as visitors open them.":"The cache is off.")};async function V(){if(x.peek())return;const e=X(),t=b.peek(),a=he(e.siteUrl);if(a){E.toast(`Site URL: ${a}`,{type:"error"});return}x.value=!0,T.value="";const d=String(e.title).trim()!==String(t.title).trim();try{await D.settings.save(He(e,o.peek(),{adminHomeReady:U.peek()}));const B=await D.settings.get().catch(()=>null);if(!i())return;B&&(o.value=B);const Le={...e,smtpPass:""};s.smtpPass.value="",b.value=Le;try{S.remove?S.remove(g):S.set(g,null)}catch{}document.dispatchEvent(new CustomEvent("dm:admin-home-changed")),(d||["adminBrandEnabled","adminBrandTitle","adminBrandLogo","adminBrandLogoDark","adminBrandIcon"].some(pe=>e[pe]!==t[pe]))&&document.dispatchEvent(new CustomEvent("dm:sidebar-rebuild")),fe(be),E.toast("Settings saved.",{type:"success"})}catch(B){T.value=B.message||"Could not save the settings.",E.toast("Settings not saved - see the message at the top.",{type:"error"})}finally{x.value=!1}}async function we(){await E.confirm("Throw away your unsaved settings?")&&(se(b.peek()),T.value="")}function se(e){for(const[t,a]of Object.entries(e))s[t]&&(s[t].value=a)}async function ke(){if(!L.peek()){L.value=!0,A.value="",O.value="Sending\u2026";try{const e=await k("/settings/test-email",{method:"POST",body:JSON.stringify({to:te.peek().trim()||void 0})});if(!i())return;O.value=e?.message||"Test email sent.",A.value="is-ok"}catch(e){if(!i())return;O.value=e.message||"Could not send the test email.",A.value="is-bad"}finally{L.value=!1}}}async function P(){z.value=!0;try{const[e,t]=await Promise.all([k("/cache/status").catch(()=>null),k("/cache/keys")]);if(!i())return;p.value=e,K.value=Array.isArray(t?.entries)?t.entries:[],N.value=""}catch(e){if(!i())return;N.value=`Could not read the cache: ${e.message||e}`}finally{z.value=!1}}async function Ee(){if(await E.confirm("Clear the whole response cache? The next visitor to each page renders it afresh.")){try{await k("/cache/clear",{method:"POST"}),E.toast("Cache cleared.",{type:"success"})}catch(e){E.toast(e.message||"Could not clear the cache.",{type:"error"})}i()&&await P()}}async function Se(){const e=p.peek()?.enabled===!0;if(!(e&&!await E.confirm("Turn the response cache off? Every visit will render its page afresh until it is turned back on. The choice is saved (config/cache.json)."))){try{p.value=await k("/cache/toggle",{method:"POST",body:JSON.stringify({enabled:!e})}),E.toast(e?"Cache turned off.":"Cache turned on.",{type:"success"}),fe(be)}catch(t){E.toast(t.message||"Could not change the cache.",{type:"error"})}i()&&await P()}}const ne=e=>K.peek().find(t=>t.key===e);function Me(e){const t=ne(e);if(!t)return[];const a=J(t.key);return[{header:a.path},{label:"Open the page",icon:"external-link",disabled:!a.page,action:()=>window.open(a.path,"_blank","noopener")},{label:"Copy key",icon:"copy",action:async()=>{try{await navigator.clipboard.writeText(t.key),E.toast("Key copied.",{type:"success"})}catch{E.toast("Could not copy - your browser blocked the clipboard.",{type:"warning"})}}},...a.page?[{label:"Copy address",icon:"link",action:async()=>{try{await navigator.clipboard.writeText(new URL(a.path,location.origin).href),E.toast("Address copied.",{type:"success"})}catch{E.toast("Could not copy - your browser blocked the clipboard.",{type:"warning"})}}}]:[]]}n.querySelector(".stx-problems").innerHTML=Fe;const y=n.querySelector(".stx-list");y.innerHTML=ze;const W=E.tabs(n.querySelector(".stx-tabs"),{tabSelector:".tab-item",panelSelector:".tab-panel"}),oe=new URLSearchParams(location.hash.split("?")[1]||"").get("tab");$.includes(oe)&&W.activate($.indexOf(oe));const Ce=M.applyBindings(ge,n,{methods:{save:V,discard:we,sendTest:ke,refreshCache:P,clearCache:Ee,toggleCache:Se,pickBrandImage:async e=>{const t=await Ue({title:"Choose a branding image",current:s[e].peek()});t&&i()&&(s[e].value=t)},clearBrandImage:e=>{s[e].value=""},goTab:e=>{const t=$.indexOf(e);t>=0&&W.activate(t)}}});r(()=>Ce.dispose());for(const e of n.querySelectorAll("[data-brand-icon]")){const t=e.dataset.brandIcon,a=_e("Choose an icon",s[t].peek());a.input.id=`stx-${t}`,a.input.classList.add("form-input");const d=()=>{s[t].value=a.input.value};a.input.addEventListener("input",d),r(()=>a.input.removeEventListener("input",d)),r(M.effect(()=>{a.input.value=s[t].value})),e.appendChild(a.el)}r(Re(n,{position:"bottom"}));const xe=e=>{const t=e.target.closest("[data-go]");if(!t)return;const a=$.indexOf(t.dataset.go);a>=0&&W.activate(a)};n.querySelector(".stx-problems").addEventListener("click",xe);const Y=n.querySelector("#stx-admin-home");Ne(Y,$e(s.adminHome.peek())).then(()=>{i()&&(Y.value=s.adminHome.peek(),U.value=!0)}).catch(()=>{});const Te=E.contextMenu(y,{cursor:"glyph",match:".stx-row",inherit:!1,density:"compact",items:e=>Me(e.dataset.id)});r(()=>Te?.destroy?.());const re=e=>{const t=ne(e.dataset.id),a=t&&J(t.key);a?.page?window.open(a.path,"_blank","noopener"):G(e)},ie=e=>{const t=e.target.closest(".stx-row");if(!t)return;const a=e.target.closest(".stx-kebab");if(a){G(a);return}re(t)},ce=e=>{const t=e.target.closest(".stx-row");t&&(e.key==="F10"&&e.shiftKey?(e.preventDefault(),G(t)):e.key==="Enter"&&e.target===t&&re(t))};y.addEventListener("click",ie),y.addEventListener("keydown",ce),r(()=>{y.removeEventListener("click",ie),y.removeEventListener("keydown",ce)}),me(c,{id:"settings-view-site",icon:"external-link",title:"View site",onClick:()=>window.open("/","_blank","noopener")}),me(c,{id:"settings-save",icon:"save",title:"Save (Ctrl+S)",onClick:()=>V()});const le=e=>{!(e.ctrlKey||e.metaKey)||e.key!=="s"||(e.preventDefault(),e.stopImmediatePropagation(),V())};document.addEventListener("keydown",le,!0),r(()=>document.removeEventListener("keydown",le,!0));const ue=()=>{if(C.peek())try{S.set(g,{form:Ae(X()),base:q.peek(),at:new Date().toISOString()})}catch{}},de=e=>{C.peek()&&(ue(),e.preventDefault(),e.returnValue="")};window.addEventListener("beforeunload",de),r(()=>window.removeEventListener("beforeunload",de)),f={dirty:()=>C.peek(),dispose(){w=!0,ue(),l.splice(0).reverse().forEach(e=>{try{e()}catch{}})}},I.scan(n),P();let h=null;try{h=S.get(g)}catch{}if(h?.form){try{S.remove?S.remove(g):S.set(g,null)}catch{}const e=h.base&&h.base!==q.peek(),t=h.at?` (${Ke(h.at)})`:"",a=e?`You left unsaved settings${t}, but the saved settings have changed since. Restore your version anyway?`:`You left unsaved settings${t}. Restore them?`;await E.confirm(a)&&i()&&(se(Be(b.peek(),h.form)),U.peek()&&(Y.value=s.adminHome.peek()))}}};
@@ -959,6 +959,19 @@ shortcode preview.
959
959
 
960
960
  ---
961
961
 
962
+
963
+ ### `[map]`
964
+
965
+ A responsive Google Map of one place. Give `pin` (latitude, longitude), `lat` + `lon`, an `address` or a `postcode`.
966
+
967
+ ```text
968
+ [map postcode="SW1A 2AA" zoom="15" caption="Visit us" /]
969
+ [map pin="51.5034,-0.1276" zoom="14" title="Office" ratio="4:3" width="640" align="center" /]
970
+ ```
971
+
972
+ `zoom` is 1-20 (default 14); `ratio` is 16:9 (default), 4:3, 1:1 or 21:9; `width` in px or %; `align` left, center or
973
+ right; `caption` (or `title`) is shown under the map. Malformed coordinates show a notice instead of a map. Google's
974
+ embed host is always allowed to frame, so no `config/embeds.json` entry is needed.
962
975
  ### `[form]`
963
976
 
964
977
  Self-closing. Embeds a CMS-managed form by slug. Forms are configured under **Forms** in the sidebar.
@@ -1,6 +1,6 @@
1
1
  # Domma block library
2
2
 
3
- Seventeen free, editable Custom Blocks come with every Domma CMS site. There is
3
+ Twenty-one free, editable Custom Blocks come with every Domma CMS site. There is
4
4
  no extra licence or plugin to install. Search for `domma-block-` in **Blocks**
5
5
  or in the editor's **Add block** menu. Each block includes its own scoped CSS,
6
6
  a copyable example and documented parameters.
@@ -25,6 +25,10 @@ a copyable example and documented parameters.
25
25
  | `domma-block-team-card` | A team member photo, role and short introduction. |
26
26
  | `domma-block-image` | An uncropped image with an optional caption. |
27
27
  | `domma-block-logos` | A responsive row of up to four organisation logos. |
28
+ | `domma-block-feature-card` | Feature card with an icon, description and optional link. |
29
+ | `domma-block-comparison-card` | Comparison card with two labelled choices. |
30
+ | `domma-block-image-card` | Image card with a heading, description and optional link. |
31
+ | `domma-block-cta-card` | Compact call-to-action card with a heading and link. |
28
32
 
29
33
  ## Make it yours
30
34
 
@@ -180,6 +184,38 @@ A responsive row of up to four organisation logos.
180
184
  [domma-block-logos header="Who we work with" image1="/media/partner-logo.svg" alt1="Partner name" /]
181
185
  ```
182
186
 
187
+ ### domma-block-feature-card
188
+
189
+ Feature card with an icon, description and optional link.
190
+
191
+ ```text
192
+ [domma-block-feature-card header="Everything in one place" icon="grid" blurb="Explore the features included with your site." link="/features" label="See the features" /]
193
+ ```
194
+
195
+ ### domma-block-comparison-card
196
+
197
+ Comparison card with two labelled choices.
198
+
199
+ ```text
200
+ [domma-block-comparison-card header="Find your fit" icon="layers" first_label="Choose a hosted builder" first="For a quick template website." second_label="Choose a CMS" second="For more control over your content." /]
201
+ ```
202
+
203
+ ### domma-block-image-card
204
+
205
+ Image card with a heading, description and optional link.
206
+
207
+ ```text
208
+ [domma-block-image-card header="Our work" blurb="Take a closer look at a recent project." image="/media/project.jpg" alt="A recent project" link="/showcase" label="View the project" /]
209
+ ```
210
+
211
+ ### domma-block-cta-card
212
+
213
+ Compact call-to-action card with a heading and link.
214
+
215
+ ```text
216
+ [domma-block-cta-card header="Let us help" icon="mail" blurb="Tell us what you have in mind." link="/contact" label="Get in touch" /]
217
+ ```
218
+
183
219
  ## Blocks in headers, footers and menus
184
220
 
185
221
  The running CMS already supports custom blocks in **Site Settings > Footer**.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-cms",
3
- "version": "1.32.0",
3
+ "version": "1.34.0",
4
4
  "description": "File-based CMS powered by Domma and Fastify. Run npx domma-cms my-site to create a new project.",
5
5
  "type": "module",
6
6
  "main": "server/server.js",
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/body-menu.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/body-menu.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * The reading pane's right-click menu - the pure parts.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/cms-host.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/cms-host.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /** The CMS shell boundary. Standalone never imports this adapter. */
4
4
  const version = new URL(import.meta.url).searchParams.get('v') ?? '1';
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/compose-window.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/compose-window.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
4
4
  const {createMailHost} = await import(new URL(`./host-context.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/contacts.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/contacts.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Recipient suggestions from the host address book.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/diagnostics-section.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/diagnostics-section.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * The settings section that answers "which build is this, and what went wrong".
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/drag-drop.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/drag-drop.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /** Drag identities include the mailbox and source folder: UIDs alone are not unique. */
4
4
  const PROTECTED_USES = new Set(['\\Inbox', '\\Sent', '\\Drafts', '\\Trash', '\\Junk', '\\Archive', '\\All', '\\Flagged']);
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/folder-tree.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/folder-tree.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Mail folder presentation, shared by the Mail Reader and Email Pro.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/font-controls.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/font-controls.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
4
4
  /**
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/fonts.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/fonts.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * The fonts and sizes the mail editor offers - pure, so both the compose
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/host-context.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/host-context.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /** Services supplied by the application that hosts the shared mail interface. */
4
4
  export function createMailApi({getToken, fetch: request = globalThis.fetch, onUnauthorized = () => {}}) {
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/identity.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/identity.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Who a mailbox sends as, and what it signs off with.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/image-senders-section.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/image-senders-section.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * The settings section for senders whose images always load.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/keyboard.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/keyboard.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Keyboard navigation for the reader.
@@ -1,4 +1,4 @@
1
- <!-- Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/mail.html. -->
1
+ <!-- Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/mail.html. -->
2
2
  <div class="mail-layout">
3
3
 
4
4
  <!-- Folders -->
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/message-actions.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/message-actions.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * What other Tools add to a message's menu - Booking's "Book Sam...".
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/oauth-panel.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/oauth-panel.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * "Sign in with Microsoft / Google" for a mailbox - the part of the mailbox
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/panes.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/panes.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Pane sizing for the mail reader, shared by the Mail Reader and Email Pro.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/reader-kit.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/reader-kit.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * The reader view's decisions that need no DOM - escaping, the mailbox form's
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/reader-runtime.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/reader-runtime.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
4
4
  const {createMailHost} = await import(new URL(`./host-context.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
@@ -942,6 +942,7 @@ return {
942
942
  canWrite: features.write,
943
943
  canSend: features.send === true,
944
944
  sidebarUrl: mailHost.routeHash,
945
+ renderNotificationSettings: extensions.notificationSettings,
945
946
  host: mailHost,
946
947
  userId: mailHost.getUser()?.id,
947
948
  load: () => readDelaySeconds(S.get(READ_DELAY_KEY)),
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/reader-view.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/reader-view.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /** Existing CMS entry point for the shared mail view. */
4
4
  const version = new URL(import.meta.url).searchParams.get('v') ?? '1';
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/resizable.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/resizable.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * The mail reader's resizable slideovers.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/restore-spam.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/restore-spam.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /** Undo restores both junk status and the original folder, following each UID remap. */
4
4
  export async function restoreSpam({api, base, account, from, destination, uids, spam}) {
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/rules.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/rules.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Filing rules.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/scheduling.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/scheduling.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
4
4
  /**
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/section-kit.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/section-kit.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
4
4
  /**
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/security-note.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/security-note.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * What the reader says about a signed or encrypted (S/MIME) message.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/settings-section.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/settings-section.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /** Browser preferences for the shared mail reader. */
4
4
  export const READ_DELAY_KEY = 'domma-mail.mark-read-seconds';
@@ -128,7 +128,7 @@ export function permissionWords(permission) {
128
128
  * notifications hang off (admin/js/lib/sidebar-notify.js).
129
129
  * @returns {object}
130
130
  */
131
- export function createSettingsSection({canWrite, canSend = false, load, save, sidebarUrl = null, userId = null, host = null}) {
131
+ export function createSettingsSection({canWrite, canSend = false, load, save, sidebarUrl = null, userId = null, host = null, renderNotificationSettings = null}) {
132
132
  const S = host?.storage ?? globalThis.S;
133
133
  return {
134
134
  id: 'settings',
@@ -138,7 +138,7 @@ export function createSettingsSection({canWrite, canSend = false, load, save, si
138
138
  const kit = await import(new URL(`./section-kit.js?v=${ctx.assetVersion ?? '1'}`, import.meta.url).href);
139
139
  const notify = sidebarUrl ? (host?.helpers.notifications ?? null) : null;
140
140
  const who = userId ?? host?.getUser()?.id ?? null;
141
- kit.note(container, 'Settings are saved in this browser and apply to all your mailboxes.');
141
+ kit.note(container, 'Reading, composing, popup and sound preferences are saved in this browser and apply to all your mailboxes.');
142
142
 
143
143
  const saveSteps = [];
144
144
 
@@ -204,13 +204,21 @@ export function createSettingsSection({canWrite, canSend = false, load, save, si
204
204
  // ---- Notifications -------------------------------------------
205
205
  if (notify) {
206
206
  kit.heading(container, 'Notifications');
207
- kit.note(container, 'While the admin is open in any tab, new mail in the inbox can pop up a notification and play a sound - checked about once a minute.');
207
+ kit.note(container, 'While the admin is open in any tab, new mail can pop up a notification and play a sound - checked about once a minute.');
208
208
  const current = notify.readNotifyPrefs(who, sidebarUrl);
209
209
  const supported = typeof Notification === 'function';
210
210
  const {state} = kit.formIn(container, {
211
211
  popup: {type: 'boolean', label: 'Show new messages notification popups', formConfig: {disabled: !supported}},
212
212
  sound: {type: 'boolean', label: 'Sound notification'}
213
213
  }, {popup: current.popup && supported, sound: current.sound});
214
+ if (renderNotificationSettings && ctx.account) {
215
+ try {
216
+ const saveFolders = await renderNotificationSettings(container, ctx, kit);
217
+ if (saveFolders) saveSteps.push(() => saveFolders);
218
+ } catch (err) {
219
+ kit.note(container, `Notification folders could not be loaded: ${err.message || 'Try reopening Settings.'}`);
220
+ }
221
+ }
214
222
  const status = kit.note(container, permissionWords(supported ? Notification.permission : undefined));
215
223
  const tools = kit.box(container, 'flex gap-2 items-center mb-2');
216
224
  kit.button(tools, 'Play the sound', () => notify.playChime(), {icon: 'play'});
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/templates.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/templates.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
4
4
  /**
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/threads.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/threads.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Grouping messages into conversations.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/vacation.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/vacation.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * The automatic reply, and everything that must stop it.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/mail/when-closed.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/mail/when-closed.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Run code when a Domma modal or slideover actually closes.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/ui/dates.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/ui/dates.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Dates as a plugin shows them to a person: dd/mm/yyyy, and dd/mm/yyyy HH:mm
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.20.0, packages/core/src/admin/ui/resizable.js.
1
+ // Source: @domma-mail/core 0.21.0, packages/core/src/admin/ui/resizable.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Making a slideover resizable.