domma-cms 1.22.2 → 1.24.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.24.0] - 2026-10-30
4
+
5
+ - Page editor: add 16 text gradient presets, including newspaper, grey-fire, ice, summer and autumn. Show alignment in the text quick controls and offer Justify alongside Left, Centre and Right.
6
+
7
+ ## [1.23.0] - 2026-10-30
8
+
9
+ - Page Editor: select markup and choose **Convert selection to Domma Block…** from the right-click menu. Name the reusable block and replace the selection with its shortcode after saving succeeds. Existing block names are protected against overwrites, and the page remains unsaved for review.
10
+
3
11
  ## [1.22.2] - 2026-10-30
4
12
 
5
13
  - Motion: swooshing card rows (`[row reveal]`) now play when the row is already on screen as the page opens - the cards used to start visible, fade out and come straight back, so the swoosh was never seen. Cards below the window no longer fade out on every page load, and a row scrolled past in one jump (End, an anchor link, a restored scroll position) shows instead of staying hidden.
@@ -0,0 +1 @@
1
+ import{api as d}from"../api.js";import{replaceRange as g}from"./markdown-toolbar.js";export async function convertSelectionToBlock(a,i,p={}){const{prompt:m=(...e)=>E.prompt(...e),toast:t=(...e)=>E.toast(...e),save:h=(e,r)=>d.blocks.put(e,r),replace:u=g}=p,{start:o,end:n,source:c}=i,s=c.slice(o,n);if(!s.trim())return;const l=()=>a.isConnected!==!1&&a.value===c;try{const e=await m("Save the selected markup as a reusable Domma Block. Use lowercase letters, digits and hyphens for its name.",{title:"Convert selection to Domma Block",confirmText:"Create block",inputPlaceholder:"my-block"});if(e==null)return;const r=e.trim();if(!/^[a-z0-9][a-z0-9-]*$/.test(r)){t("Use a block name starting with a lowercase letter or digit, followed by lowercase letters, digits or hyphens.",{type:"error"});return}if(!l()){t("The page changed. Select the markup again to create a block.",{type:"warning"});return}if(await h(r,{content:s,createOnly:!0}),!l()){t("Block created, but the page changed. Insert the block from the Blocks menu.",{type:"warning"});return}u(a,o,n,`[block template="${r}" /]`),t("Block created. Review and save the page when ready.",{type:"success"})}catch(e){t(e.message||"Could not create the block. Your page has not been changed.",{type:"error"})}}
@@ -1,3 +1,3 @@
1
- import{EDITOR_TOOLS as Q,SHORTCODES as N}from"./shortcode-registry.js";import{EFFECTS as L,CELEBRATION_THEMES as Z,getEffectAttrs as D}from"./effect-defs.js";import{boolState as ee,boolValue as te,findEnclosingShortcode as ne,setAttr as R,setAttrs as W,effectAttrKeys as oe}from"./shortcode-tags.js";import{insertAtCursor as z,replaceRange as se}from"./markdown-toolbar.js";import{clearLookupCache as ie,lookupOptions as ae}from"./shortcode-lookups.js";import{insertMenuGroups as ce,insertShortcodeByName as j}from"./shortcode-insert.js";import{openShortcodeForm as A}from"./shortcode-form.js";import{pickMedia as le}from"./media-picker.js";import{blockTagSnippet as re}from"./block-tags.js";import{catalogueNow as de,dommaHelp as pe}from"./domma-catalogue.js";function me(e){return ae(e,l?.span?.attrs||{})}const ue=N.map(e=>({name:e.name,selfClosing:!!e.selfClosing})),F=new Map(N.map(e=>[e.name,e])),O=new Map(L.map(e=>[e.name,e])),fe=L.map(e=>({name:e.name,selfClosing:!!e.selfClosing})),he=[...ue,...fe],Y=new Set(["card","box","hero","banner","col","button"]);let l=null;const q="position:fixed;z-index:10000;min-width:210px;max-height:70vh;overflow-y:auto;background:var(--dm-surface,#1c1c30);border:1px solid var(--dm-border,#2a2a40);border-radius:6px;box-shadow:var(--dm-shadow-lg);padding:.3rem;font-size:.83rem;color:var(--dm-text,#e5e5e5);",u="display:flex;align-items:center;gap:.5rem;width:100%;text-align:left;padding:.35rem .55rem;border:none;background:transparent;color:inherit;border-radius:4px;cursor:pointer;font-size:.83rem;",T="padding:.3rem .55rem;color:var(--dm-text-muted,#8a8a9a);font-size:.68rem;text-transform:uppercase;letter-spacing:.06em;",P="flex:1;min-width:0;padding:.2rem .4rem;background:var(--dm-input-bg,#12121e);border:1px solid var(--dm-border,#333);border-radius:3px;color:var(--dm-text,#eee);font-size:.8rem;",xe="height:1px;background:var(--dm-border,#2a2a40);margin:.3rem .2rem;";function h(e){return e.addEventListener("mouseenter",()=>{e.style.background="var(--dm-primary,#4338ca)",e.style.color="var(--dm-primary-text,#fff)"}),e.addEventListener("mouseleave",()=>{e.style.background="transparent",e.style.color="inherit"}),e}export function attachContextMenu(e,{blocks:t=()=>[],openBlock:n=null}={}){const o=()=>{const i=t()||[],s=i.filter(c=>c.shortTag&&!F.has(c.name)&&!O.has(c.name));return{defs:i,specs:[...he,...s.map(c=>({name:c.name,selfClosing:!0}))]}},a=(i,s)=>{p();const{defs:c,specs:r}=o();G(e,ne(e,r),i,s,c,n)};return typeof Domma>"u"||!Domma.elements?.contextMenu?(e.addEventListener("contextmenu",i=>{i.preventDefault(),a(i.clientX,i.clientY)}),null):Domma.elements.contextMenu(e,{inherit:!1,cursor:!1,render:i=>{a(i.x,i.y)}})}function p(){l&&(k(),l.root.remove(),document.removeEventListener("mousedown",U,!0),document.removeEventListener("keydown",V,!0),window.removeEventListener("scroll",K,!0),l=null)}const U=e=>{l&&!l.root.contains(e.target)&&!(l.submenu&&l.submenu.contains(e.target))&&p()},K=e=>{l&&!l.root.contains(e.target)&&!(l.submenu&&l.submenu.contains(e.target))&&p()},V=e=>{e.key==="Escape"&&p()};function G(e,t,n,o,a=[],i=null){ie();const s=document.createElement("div");s.className="dm-sc-menu",s.style.cssText=q,l={root:s,textarea:e,span:t,submenu:null,blocks:a,openBlock:i,keepEmpty:!1};const c=new Map(a.map(b=>[b.name,b])),r=t&&(F.get(t.name)||O.get(t.name)),d=t&&(r?t.name==="block"?c.get(String(t.attrs.template||"")):null:c.get(t.name)),x=t&&Y.has(t.name)?L.filter(b=>b.name in t.attrs):[];r&&be(s,r),d&&ye(s,d,!!r);for(const b of x)Le(s,b);(r||d||x.length)&&s.appendChild(_()),s.appendChild(y("Celebrations\u2026",()=>_e())),s.appendChild(y("Add effect\u2026",()=>Se())),s.appendChild(y("Insert\u2026",()=>$e()));const m=e.selectionStart!==e.selectionEnd;(t||m)&&s.appendChild(y(m?"Wrap selection in\u2026":"Wrap in\u2026",()=>Me())),a.length&&(s.appendChild(_()),s.appendChild(y("Add block\u2026",()=>Ae()))),document.body.appendChild(s),J(s,n,o),document.addEventListener("mousedown",U,!0),document.addEventListener("keydown",V,!0),window.addEventListener("scroll",K,!0),window.I&&I.scan(s)}function _(){const e=document.createElement("div");return e.style.cssText=xe,e}function v(e){const t=document.createElement("div");return t.style.cssText=T,t.textContent=e,t}function be(e,t){e.appendChild(v(`${t.label} options`));const n=h(document.createElement("button"));n.type="button",n.style.cssText=u,n.innerHTML='<span data-icon="edit" data-icon-size="13" style="display:inline-flex;align-items:center;"></span>',n.appendChild(document.createTextNode(`Edit ${t.label}\u2026`)),n.addEventListener("click",()=>{const{textarea:i,span:s}=l;p(),A(i,{...t,attrs:D(t,s.attrs)},{span:s})}),e.appendChild(n);for(const i of t.actions||[]){const s=h(document.createElement("button"));s.type="button",s.style.cssText=u,s.innerHTML=`<span data-icon="${i.icon||"zap"}" data-icon-size="13" style="display:inline-flex;align-items:center;"></span>`,s.appendChild(document.createTextNode(i.label)),s.addEventListener("click",()=>{const{textarea:c,span:r}=l;if(i.remove){se(c,r.openTagStart,r.openTagEnd,""),p();return}l.span=W(c,r,i.set||{}),p()}),e.appendChild(s)}const o=Array.isArray(t.quickAttrs)?new Set(t.quickAttrs):null,a=D(t,l.span.attrs).filter(i=>!o||o.has(i.name));(t.actions||[]).length&&a.length&&e.appendChild(_());for(const i of a)e.appendChild(H(i))}function ye(e,t,n){const{span:o}=l;if(l.keepEmpty=!0,n&&e.appendChild(_()),e.appendChild(v(n?`${t.name} parameters`:`${t.name} block`)),t.description&&!n){const s=document.createElement("div");s.style.cssText="padding:0 .55rem .3rem;font-size:.75rem;color:var(--dm-text-muted,#9a9aac);max-width:260px;",s.textContent=t.description,e.appendChild(s)}const a=(s,c,r)=>{const d=h(document.createElement("button"));d.type="button",d.style.cssText=u,d.innerHTML=`<span data-icon="${s}" data-icon-size="13" style="display:inline-flex;align-items:center;"></span>`,d.appendChild(document.createTextNode(c)),d.addEventListener("click",r),e.appendChild(d)};t.attrs.length&&a("edit","Edit parameters\u2026",()=>{const{textarea:s}=l;p(),A(s,{...t,name:o.name,label:t.name},{span:o})});const{openBlock:i}=l;a(i?"layout":"external-link",i?"Edit the block":"Open the block",()=>{p(),i?i(t.name):location.hash=`#/blocks/edit/${encodeURIComponent(t.name)}`});for(const s of t.attrs)e.appendChild(H(s));if(!t.attrs.length){const s=document.createElement("div");s.style.cssText=T+"text-transform:none;letter-spacing:0;",s.textContent="This block takes no parameters.",e.appendChild(s)}}function H(e,t=e.name){const n=Ee(e,t),o=e.domma?pe(de(),e):"";return o&&n&&!n.title&&(n.title=o),n}function Ee(e,t){const n=l.span.attrs[t];switch(e.type){case"checkbox":return Ce(e,t,ee(n,e.default));case"select":return we(e,t,n);case"lookup":return ke(e,t,n);case"colour":return ve(e,t,n);case"icon":return Te(e,t,n);default:return ge(e,t,n)}}function w(e,t){if(l.span=R(l.textarea,l.span,e,l.keepEmpty&&t==null?"":t,{keepEmpty:l.keepEmpty}),e==="theme"){const{textarea:n,span:o,root:a}=l,i=a.getBoundingClientRect(),{blocks:s,openBlock:c}=l;p(),G(n,o,i.left,i.top,s,c)}}function Ce(e,t,n){const o=h(document.createElement("label"));o.style.cssText=u;const a=document.createElement("input");return a.type="checkbox",a.checked=n,a.addEventListener("change",()=>w(t,te(e,a.checked))),o.appendChild(a),o.appendChild(document.createTextNode(e.label)),o}function ge(e,t,n){const o=document.createElement("div");o.style.cssText=u+"cursor:default;";const a=document.createElement("span");a.textContent=e.label,a.style.cssText="white-space:nowrap;color:var(--dm-text-muted,#9a9aac);";const i=document.createElement("input");i.type=e.type==="number"?"number":"text",i.value=n===!0||n==null?"":n,e.default!=null&&e.default!==""&&(i.placeholder=String(e.default)),i.style.cssText=P;let s=null;if(i.addEventListener("input",()=>{clearTimeout(s),s=setTimeout(()=>w(t,i.value.trim()),180)}),i.addEventListener("mousedown",c=>c.stopPropagation()),o.appendChild(a),o.appendChild(i),e.type==="image"){const c=document.createElement("button");c.type="button",c.textContent="Browse",c.title="Choose from Media",c.style.cssText="padding:2px 8px;background:transparent;border:1px solid var(--dm-border,#333);border-radius:4px;color:inherit;cursor:pointer;flex-shrink:0;font:inherit;",c.addEventListener("mousedown",r=>r.stopPropagation()),c.addEventListener("click",async()=>{const{textarea:r,span:d}=l;p();const x=await le({current:i.value.trim()});x&&r.isConnected&&R(r,d,t,x)}),o.appendChild(c)}return o}function ve(e,t,n){const o=document.createElement("div");o.style.cssText=u+"cursor:default;";const a=document.createElement("span");a.textContent=e.label,a.style.flex="1";const i=document.createElement("input");return i.type="color",typeof n=="string"&&/^#/.test(n)?i.value=n:typeof e.default=="string"&&/^#/.test(e.default)&&(i.value=e.default),i.addEventListener("input",()=>w(t,i.value)),o.appendChild(a),o.appendChild(i),o}function we(e,t,n){const o=n==null||n===!0?e.default??"":n;return y(`${e.label}${o!==""?`: ${o}`:""}`,()=>{const a=C();for(const[i,s]of e.options||[]){const c=h(document.createElement("button"));c.type="button",c.style.cssText=u,c.textContent=s,i===o&&(c.style.fontWeight="700"),c.addEventListener("click",()=>{w(t,i),k()}),a.appendChild(c)}return a})}function Te(e,t,n){const o=n==null||n===!0?"":String(n),a=o?`${e.label}: ${o}`:e.label;return y(a,()=>{const i=C();i.style.width="232px";const s=document.createElement("input");s.type="text",s.placeholder="Search icons\u2026",s.style.cssText=P+"margin:6px;width:calc(100% - 12px);",s.addEventListener("mousedown",b=>b.stopPropagation()),i.appendChild(s);const c=h(document.createElement("button"));c.type="button",c.style.cssText=u,c.textContent="- none -",o||(c.style.fontWeight="700"),c.addEventListener("click",()=>{w(t,null),k()}),i.appendChild(c);const r=document.createElement("div");r.style.cssText="display:flex;flex-wrap:wrap;gap:2px;padding:4px 6px;max-height:220px;overflow-y:auto;",i.appendChild(r);const d=96,x=()=>{const b=typeof I<"u"&&typeof I.list=="function"?I.list():[],B=s.value.trim().toLowerCase(),S=B?b.filter(f=>f.toLowerCase().includes(B)):b;r.replaceChildren();for(const f of S.slice(0,d)){const g=h(document.createElement("button"));g.type="button",g.title=f,g.style.cssText="width:26px;height:26px;display:inline-flex;align-items:center;justify-content:center;background:none;border:1px solid transparent;border-radius:4px;cursor:pointer;color:inherit;",f===o&&(g.style.borderColor="var(--dm-primary,#5b8cff)");const $=document.createElement("span");$.setAttribute("data-icon",f),$.setAttribute("data-icon-size","15"),$.style.cssText="display:inline-flex;align-items:center;",g.appendChild($),g.addEventListener("click",()=>{w(t,f),k()}),r.appendChild(g)}if(S.length>d){const f=document.createElement("div");f.style.cssText=T,f.textContent=`${S.length-d} more - refine search`,r.appendChild(f)}if(!S.length){const f=document.createElement("div");f.style.cssText=T,f.textContent="No icons match",r.appendChild(f)}window.I&&I.scan(r)};let m=null;return s.addEventListener("input",()=>{clearTimeout(m),m=setTimeout(x,120)}),x(),setTimeout(()=>s.focus(),0),i})}function ke(e,t,n){const o=n==null||n===!0?e.default??"":n;return y(`${e.label}${o!==""?`: ${o}`:""}`,()=>{const a=C();a.style.minHeight="48px";const i=typeof E<"u"&&E.loader?E.loader(a,{type:"dots"}):null;return me(e.source).then(s=>{if(i&&i.destroy(),!l||l.submenu!==a)return;if(a.style.minHeight="",!s.length){const d=document.createElement("div");d.style.cssText=T,d.textContent="Nothing found",a.appendChild(d)}const c=s.some(([d])=>d===o),r=[["","- none -"],...s];o!==""&&!c&&r.push([o,`${o} (missing)`]);for(const[d,x]of r){const m=h(document.createElement("button"));m.type="button",m.style.cssText=u,m.textContent=x,d===o&&(m.style.fontWeight="700"),m.addEventListener("click",()=>{w(t,d===""?null:d),k()}),a.appendChild(m)}}),a})}function Le(e,t){e.appendChild(v(`Effect: ${t.label}`));for(const o of t.attrs||[])e.appendChild(H(o,`${t.name}-${o.name}`));const n=h(document.createElement("button"));n.type="button",n.style.cssText=u,n.innerHTML='<span data-icon="trash" data-icon-size="13" style="display:inline-flex;align-items:center;"></span> Remove effect',n.addEventListener("click",()=>{const o={};for(const a of oe(l.span.attrs,t.name))o[a]=null;W(l.textarea,l.span,o),p()}),e.appendChild(n)}function _e(){const e=C();e.appendChild(v("Seasonal themes"));for(const[t,n]of[["auto","Auto (date-detected)"],...Object.entries(Z).map(([o,a])=>[o,a.label])]){const o=h(document.createElement("button"));o.type="button",o.style.cssText=u,o.textContent=n,o.addEventListener("click",()=>{z(l.textarea,`[celebrate theme="${t}" /]`),p()}),e.appendChild(o)}e.appendChild(_()),e.appendChild(v("Celebration effects"));for(const t of["butterflies","ticker-tape","firework","fireworks"]){const n=O.get(t),o=h(document.createElement("button"));o.type="button",o.style.cssText=u,o.textContent=n.label,o.addEventListener("click",()=>{const a=l.textarea;p(),A(a,n)}),e.appendChild(o)}return e}function Se(){const e=C(),t=l.span,n=t&&Y.has(t.name)?t.name:null;for(const o of[...new Set(L.map(a=>a.category))]){const a=L.filter(i=>i.category===o);if(a.length){e.appendChild(v(o));for(const i of a){const s=n&&(i.hosts||[]).includes(n)&&!(i.name in t.attrs),c=h(document.createElement("button"));if(c.type="button",c.style.cssText=u+"justify-content:space-between;",c.appendChild(document.createTextNode(i.label)),s){const r=document.createElement("span");r.textContent=`inject \u2192 [${n}]`,r.style.cssText="opacity:.6;font-size:.7rem;",c.appendChild(r)}c.addEventListener("click",()=>{if(s)R(l.textarea,l.span,i.name,!0);else{const r=i.selfClosing?`[${i.name} /]`:`[${i.name}]
1
+ import{convertSelectionToBlock as Q}from"./selection-to-block.js";import{EDITOR_TOOLS as Z,SHORTCODES as R}from"./shortcode-registry.js";import{EFFECTS as _,CELEBRATION_THEMES as ee,getEffectAttrs as H}from"./effect-defs.js";import{boolState as te,boolValue as ne,findEnclosingShortcode as oe,setAttr as z,setAttrs as W,effectAttrKeys as se}from"./shortcode-tags.js";import{insertAtCursor as O,replaceRange as ie}from"./markdown-toolbar.js";import{clearLookupCache as ce,lookupOptions as ae}from"./shortcode-lookups.js";import{insertMenuGroups as le,insertShortcodeByName as j}from"./shortcode-insert.js";import{openShortcodeForm as M}from"./shortcode-form.js";import{pickMedia as re}from"./media-picker.js";import{blockTagSnippet as de}from"./block-tags.js";import{catalogueNow as pe,dommaHelp as me}from"./domma-catalogue.js";function ue(e){return ae(e,l?.span?.attrs||{})}const fe=R.map(e=>({name:e.name,selfClosing:!!e.selfClosing})),F=new Map(R.map(e=>[e.name,e])),B=new Map(_.map(e=>[e.name,e])),he=_.map(e=>({name:e.name,selfClosing:!!e.selfClosing})),be=[...fe,...he],Y=new Set(["card","box","hero","banner","col","button"]);let l=null;const q="position:fixed;z-index:10000;min-width:210px;max-height:70vh;overflow-y:auto;background:var(--dm-surface,#1c1c30);border:1px solid var(--dm-border,#2a2a40);border-radius:6px;box-shadow:var(--dm-shadow-lg);padding:.3rem;font-size:.83rem;color:var(--dm-text,#e5e5e5);",u="display:flex;align-items:center;gap:.5rem;width:100%;text-align:left;padding:.35rem .55rem;border:none;background:transparent;color:inherit;border-radius:4px;cursor:pointer;font-size:.83rem;",k="padding:.3rem .55rem;color:var(--dm-text-muted,#8a8a9a);font-size:.68rem;text-transform:uppercase;letter-spacing:.06em;",P="flex:1;min-width:0;padding:.2rem .4rem;background:var(--dm-input-bg,#12121e);border:1px solid var(--dm-border,#333);border-radius:3px;color:var(--dm-text,#eee);font-size:.8rem;",xe="height:1px;background:var(--dm-border,#2a2a40);margin:.3rem .2rem;";function f(e){return e.addEventListener("mouseenter",()=>{e.style.background="var(--dm-primary,#4338ca)",e.style.color="var(--dm-primary-text,#fff)"}),e.addEventListener("mouseleave",()=>{e.style.background="transparent",e.style.color="inherit"}),e}export function attachContextMenu(e,{blocks:t=()=>[],openBlock:n=null}={}){const o=()=>{const i=t()||[],s=i.filter(a=>a.shortTag&&!F.has(a.name)&&!B.has(a.name));return{defs:i,specs:[...be,...s.map(a=>({name:a.name,selfClosing:!0}))]}},c=(i,s)=>{p();const{defs:a,specs:r}=o();G(e,oe(e,r),i,s,a,n)};return typeof Domma>"u"||!Domma.elements?.contextMenu?(e.addEventListener("contextmenu",i=>{i.preventDefault(),c(i.clientX,i.clientY)}),null):Domma.elements.contextMenu(e,{inherit:!1,cursor:!1,render:i=>{c(i.x,i.y)}})}function p(){l&&(L(),l.root.remove(),document.removeEventListener("mousedown",U,!0),document.removeEventListener("keydown",V,!0),window.removeEventListener("scroll",K,!0),l=null)}const U=e=>{l&&!l.root.contains(e.target)&&!(l.submenu&&l.submenu.contains(e.target))&&p()},K=e=>{l&&!l.root.contains(e.target)&&!(l.submenu&&l.submenu.contains(e.target))&&p()},V=e=>{e.key==="Escape"&&p()};function G(e,t,n,o,c=[],i=null){ce();const s=document.createElement("div");s.className="dm-sc-menu",s.style.cssText=q,l={root:s,textarea:e,span:t,submenu:null,blocks:c,openBlock:i,keepEmpty:!1};const a=new Map(c.map(x=>[x.name,x])),r=t&&(F.get(t.name)||B.get(t.name)),d=t&&(r?t.name==="block"?a.get(String(t.attrs.template||"")):null:a.get(t.name)),b=t&&Y.has(t.name)?_.filter(x=>x.name in t.attrs):[];r&&ye(s,r),d&&Ee(s,d,!!r);for(const x of b)_e(s,x);(r||d||b.length)&&s.appendChild(S()),s.appendChild(C("Celebrations\u2026",()=>Se())),s.appendChild(C("Add effect\u2026",()=>$e())),s.appendChild(C("Insert\u2026",()=>Ae()));const m=e.selectionStart!==e.selectionEnd;if(m&&e.value.slice(e.selectionStart,e.selectionEnd).trim()){const x={start:e.selectionStart,end:e.selectionEnd,source:e.value},y=f(document.createElement("button"));y.type="button",y.style.cssText=u,y.textContent="Convert selection to Domma Block\u2026",y.addEventListener("click",()=>{p(),Q(e,x)}),s.appendChild(y)}(t||m)&&s.appendChild(C(m?"Wrap selection in\u2026":"Wrap in\u2026",()=>Ie())),c.length&&(s.appendChild(S()),s.appendChild(C("Add block\u2026",()=>Me()))),document.body.appendChild(s),J(s,n,o),document.addEventListener("mousedown",U,!0),document.addEventListener("keydown",V,!0),window.addEventListener("scroll",K,!0),window.I&&I.scan(s)}function S(){const e=document.createElement("div");return e.style.cssText=xe,e}function w(e){const t=document.createElement("div");return t.style.cssText=k,t.textContent=e,t}function ye(e,t){e.appendChild(w(`${t.label} options`));const n=f(document.createElement("button"));n.type="button",n.style.cssText=u,n.innerHTML='<span data-icon="edit" data-icon-size="13" style="display:inline-flex;align-items:center;"></span>',n.appendChild(document.createTextNode(`Edit ${t.label}\u2026`)),n.addEventListener("click",()=>{const{textarea:i,span:s}=l;p(),M(i,{...t,attrs:H(t,s.attrs)},{span:s})}),e.appendChild(n);for(const i of t.actions||[]){const s=f(document.createElement("button"));s.type="button",s.style.cssText=u,s.innerHTML=`<span data-icon="${i.icon||"zap"}" data-icon-size="13" style="display:inline-flex;align-items:center;"></span>`,s.appendChild(document.createTextNode(i.label)),s.addEventListener("click",()=>{const{textarea:a,span:r}=l;if(i.remove){ie(a,r.openTagStart,r.openTagEnd,""),p();return}l.span=W(a,r,i.set||{}),p()}),e.appendChild(s)}const o=Array.isArray(t.quickAttrs)?new Set(t.quickAttrs):null,c=H(t,l.span.attrs).filter(i=>!o||o.has(i.name));(t.actions||[]).length&&c.length&&e.appendChild(S());for(const i of c)e.appendChild(D(i))}function Ee(e,t,n){const{span:o}=l;if(l.keepEmpty=!0,n&&e.appendChild(S()),e.appendChild(w(n?`${t.name} parameters`:`${t.name} block`)),t.description&&!n){const s=document.createElement("div");s.style.cssText="padding:0 .55rem .3rem;font-size:.75rem;color:var(--dm-text-muted,#9a9aac);max-width:260px;",s.textContent=t.description,e.appendChild(s)}const c=(s,a,r)=>{const d=f(document.createElement("button"));d.type="button",d.style.cssText=u,d.innerHTML=`<span data-icon="${s}" data-icon-size="13" style="display:inline-flex;align-items:center;"></span>`,d.appendChild(document.createTextNode(a)),d.addEventListener("click",r),e.appendChild(d)};t.attrs.length&&c("edit","Edit parameters\u2026",()=>{const{textarea:s}=l;p(),M(s,{...t,name:o.name,label:t.name},{span:o})});const{openBlock:i}=l;c(i?"layout":"external-link",i?"Edit the block":"Open the block",()=>{p(),i?i(t.name):location.hash=`#/blocks/edit/${encodeURIComponent(t.name)}`});for(const s of t.attrs)e.appendChild(D(s));if(!t.attrs.length){const s=document.createElement("div");s.style.cssText=k+"text-transform:none;letter-spacing:0;",s.textContent="This block takes no parameters.",e.appendChild(s)}}function D(e,t=e.name){const n=Ce(e,t),o=e.domma?me(pe(),e):"";return o&&n&&!n.title&&(n.title=o),n}function Ce(e,t){const n=l.span.attrs[t];switch(e.type){case"checkbox":return ge(e,t,te(n,e.default));case"select":return Te(e,t,n);case"lookup":return Le(e,t,n);case"colour":return we(e,t,n);case"icon":return ke(e,t,n);default:return ve(e,t,n)}}function T(e,t){if(l.span=z(l.textarea,l.span,e,l.keepEmpty&&t==null?"":t,{keepEmpty:l.keepEmpty}),e==="theme"){const{textarea:n,span:o,root:c}=l,i=c.getBoundingClientRect(),{blocks:s,openBlock:a}=l;p(),G(n,o,i.left,i.top,s,a)}}function ge(e,t,n){const o=f(document.createElement("label"));o.style.cssText=u;const c=document.createElement("input");return c.type="checkbox",c.checked=n,c.addEventListener("change",()=>T(t,ne(e,c.checked))),o.appendChild(c),o.appendChild(document.createTextNode(e.label)),o}function ve(e,t,n){const o=document.createElement("div");o.style.cssText=u+"cursor:default;";const c=document.createElement("span");c.textContent=e.label,c.style.cssText="white-space:nowrap;color:var(--dm-text-muted,#9a9aac);";const i=document.createElement("input");i.type=e.type==="number"?"number":"text",i.value=n===!0||n==null?"":n,e.default!=null&&e.default!==""&&(i.placeholder=String(e.default)),i.style.cssText=P;let s=null;if(i.addEventListener("input",()=>{clearTimeout(s),s=setTimeout(()=>T(t,i.value.trim()),180)}),i.addEventListener("mousedown",a=>a.stopPropagation()),o.appendChild(c),o.appendChild(i),e.type==="image"){const a=document.createElement("button");a.type="button",a.textContent="Browse",a.title="Choose from Media",a.style.cssText="padding:2px 8px;background:transparent;border:1px solid var(--dm-border,#333);border-radius:4px;color:inherit;cursor:pointer;flex-shrink:0;font:inherit;",a.addEventListener("mousedown",r=>r.stopPropagation()),a.addEventListener("click",async()=>{const{textarea:r,span:d}=l;p();const b=await re({current:i.value.trim()});b&&r.isConnected&&z(r,d,t,b)}),o.appendChild(a)}return o}function we(e,t,n){const o=document.createElement("div");o.style.cssText=u+"cursor:default;";const c=document.createElement("span");c.textContent=e.label,c.style.flex="1";const i=document.createElement("input");return i.type="color",typeof n=="string"&&/^#/.test(n)?i.value=n:typeof e.default=="string"&&/^#/.test(e.default)&&(i.value=e.default),i.addEventListener("input",()=>T(t,i.value)),o.appendChild(c),o.appendChild(i),o}function Te(e,t,n){const o=n==null||n===!0?e.default??"":n;return C(`${e.label}${o!==""?`: ${o}`:""}`,()=>{const c=g();for(const[i,s]of e.options||[]){const a=f(document.createElement("button"));a.type="button",a.style.cssText=u,a.textContent=s,i===o&&(a.style.fontWeight="700"),a.addEventListener("click",()=>{T(t,i),L()}),c.appendChild(a)}return c})}function ke(e,t,n){const o=n==null||n===!0?"":String(n),c=o?`${e.label}: ${o}`:e.label;return C(c,()=>{const i=g();i.style.width="232px";const s=document.createElement("input");s.type="text",s.placeholder="Search icons\u2026",s.style.cssText=P+"margin:6px;width:calc(100% - 12px);",s.addEventListener("mousedown",x=>x.stopPropagation()),i.appendChild(s);const a=f(document.createElement("button"));a.type="button",a.style.cssText=u,a.textContent="- none -",o||(a.style.fontWeight="700"),a.addEventListener("click",()=>{T(t,null),L()}),i.appendChild(a);const r=document.createElement("div");r.style.cssText="display:flex;flex-wrap:wrap;gap:2px;padding:4px 6px;max-height:220px;overflow-y:auto;",i.appendChild(r);const d=96,b=()=>{const x=typeof I<"u"&&typeof I.list=="function"?I.list():[],y=s.value.trim().toLowerCase(),$=y?x.filter(h=>h.toLowerCase().includes(y)):x;r.replaceChildren();for(const h of $.slice(0,d)){const v=f(document.createElement("button"));v.type="button",v.title=h,v.style.cssText="width:26px;height:26px;display:inline-flex;align-items:center;justify-content:center;background:none;border:1px solid transparent;border-radius:4px;cursor:pointer;color:inherit;",h===o&&(v.style.borderColor="var(--dm-primary,#5b8cff)");const A=document.createElement("span");A.setAttribute("data-icon",h),A.setAttribute("data-icon-size","15"),A.style.cssText="display:inline-flex;align-items:center;",v.appendChild(A),v.addEventListener("click",()=>{T(t,h),L()}),r.appendChild(v)}if($.length>d){const h=document.createElement("div");h.style.cssText=k,h.textContent=`${$.length-d} more - refine search`,r.appendChild(h)}if(!$.length){const h=document.createElement("div");h.style.cssText=k,h.textContent="No icons match",r.appendChild(h)}window.I&&I.scan(r)};let m=null;return s.addEventListener("input",()=>{clearTimeout(m),m=setTimeout(b,120)}),b(),setTimeout(()=>s.focus(),0),i})}function Le(e,t,n){const o=n==null||n===!0?e.default??"":n;return C(`${e.label}${o!==""?`: ${o}`:""}`,()=>{const c=g();c.style.minHeight="48px";const i=typeof E<"u"&&E.loader?E.loader(c,{type:"dots"}):null;return ue(e.source).then(s=>{if(i&&i.destroy(),!l||l.submenu!==c)return;if(c.style.minHeight="",!s.length){const d=document.createElement("div");d.style.cssText=k,d.textContent="Nothing found",c.appendChild(d)}const a=s.some(([d])=>d===o),r=[["","- none -"],...s];o!==""&&!a&&r.push([o,`${o} (missing)`]);for(const[d,b]of r){const m=f(document.createElement("button"));m.type="button",m.style.cssText=u,m.textContent=b,d===o&&(m.style.fontWeight="700"),m.addEventListener("click",()=>{T(t,d===""?null:d),L()}),c.appendChild(m)}}),c})}function _e(e,t){e.appendChild(w(`Effect: ${t.label}`));for(const o of t.attrs||[])e.appendChild(D(o,`${t.name}-${o.name}`));const n=f(document.createElement("button"));n.type="button",n.style.cssText=u,n.innerHTML='<span data-icon="trash" data-icon-size="13" style="display:inline-flex;align-items:center;"></span> Remove effect',n.addEventListener("click",()=>{const o={};for(const c of se(l.span.attrs,t.name))o[c]=null;W(l.textarea,l.span,o),p()}),e.appendChild(n)}function Se(){const e=g();e.appendChild(w("Seasonal themes"));for(const[t,n]of[["auto","Auto (date-detected)"],...Object.entries(ee).map(([o,c])=>[o,c.label])]){const o=f(document.createElement("button"));o.type="button",o.style.cssText=u,o.textContent=n,o.addEventListener("click",()=>{O(l.textarea,`[celebrate theme="${t}" /]`),p()}),e.appendChild(o)}e.appendChild(S()),e.appendChild(w("Celebration effects"));for(const t of["butterflies","ticker-tape","firework","fireworks"]){const n=B.get(t),o=f(document.createElement("button"));o.type="button",o.style.cssText=u,o.textContent=n.label,o.addEventListener("click",()=>{const c=l.textarea;p(),M(c,n)}),e.appendChild(o)}return e}function $e(){const e=g(),t=l.span,n=t&&Y.has(t.name)?t.name:null;for(const o of[...new Set(_.map(c=>c.category))]){const c=_.filter(i=>i.category===o);if(c.length){e.appendChild(w(o));for(const i of c){const s=n&&(i.hosts||[]).includes(n)&&!(i.name in t.attrs),a=f(document.createElement("button"));if(a.type="button",a.style.cssText=u+"justify-content:space-between;",a.appendChild(document.createTextNode(i.label)),s){const r=document.createElement("span");r.textContent=`inject \u2192 [${n}]`,r.style.cssText="opacity:.6;font-size:.7rem;",a.appendChild(r)}a.addEventListener("click",()=>{if(s)z(l.textarea,l.span,i.name,!0);else{const r=i.selfClosing?`[${i.name} /]`:`[${i.name}]
2
2
  Content
3
- [/${i.name}]`;z(l.textarea,r)}p()}),e.appendChild(c)}}}return e}function y(e,t){const n=h(document.createElement("button"));n.type="button",n.style.cssText=u+"justify-content:space-between;",n.appendChild(document.createTextNode(e));const o=document.createElement("span");return o.setAttribute("data-icon","chevron-right"),o.setAttribute("data-icon-size","12"),o.style.cssText="opacity:.6;display:inline-flex;align-items:center;flex-shrink:0;",n.appendChild(o),n.addEventListener("mouseenter",()=>X(n,t)),n.addEventListener("click",a=>{a.stopPropagation(),X(n,t)}),n}function C(){const e=document.createElement("div");return e.className="dm-sc-submenu",e.style.cssText=q,e}function X(e,t){k();const n=t();l.submenu=n,document.body.appendChild(n);const o=e.getBoundingClientRect();J(n,o.right+2,o.top,o.left-2),window.I&&I.scan(n)}function k(){l&&l.submenu&&(l.submenu.remove(),l.submenu=null)}function M(e){const t=h(document.createElement("button"));if(t.type="button",t.style.cssText=u,e.icon){const n=document.createElement("span");n.setAttribute("data-icon",e.icon),n.setAttribute("data-icon-size","14"),n.style.cssText="opacity:.75;display:inline-flex;align-items:center;flex-shrink:0;",t.appendChild(n)}return t.appendChild(document.createTextNode(e.label)),t}function $e(){const e=C();for(const{category:t,items:n}of ce()){e.appendChild(v(t));for(const o of n){const a=M(o);a.addEventListener("click",()=>{const i=l.textarea;p(),j(o.name,i)}),e.appendChild(a)}}return e}function Ae(){const e=C();e.style.maxWidth="320px";const t=document.createElement("input");t.type="text",t.placeholder="Find a block\u2026",t.style.cssText=P+"margin:6px;width:calc(100% - 12px);",t.addEventListener("mousedown",a=>a.stopPropagation());const n=document.createElement("div");e.append(t,n);const o=()=>{const a=t.value.trim().toLowerCase(),i=l.blocks.filter(s=>!a||s.name.includes(a)||s.description.toLowerCase().includes(a));n.replaceChildren();for(const s of i){const c=M(s);if(s.description&&(c.title=s.description),!s.shortTag){const r=document.createElement("small");r.style.cssText="margin-left:auto;opacity:.6;",r.textContent="[block]",r.title='A built-in shortcode has this name, so it goes in as [block template="\u2026"]',c.appendChild(r)}c.addEventListener("click",()=>{const r=l.textarea;p();const d=r.selectionStart,x=re(s);z(r,x);const m=x.indexOf('=""');m>=0&&r.setSelectionRange(d+m+2,d+m+2),r.focus()}),n.appendChild(c)}if(!i.length){const s=document.createElement("div");s.style.cssText=T,s.textContent="No blocks match",n.appendChild(s)}window.I&&I.scan(n)};return t.addEventListener("input",o),o(),setTimeout(()=>t.focus(),0),e}function Me(){const e=C();for(const t of N.filter(n=>n.wrappable||n.container)){const n=M(t);n.addEventListener("click",()=>{const o=l.textarea;p(),A(o,t)}),e.appendChild(n)}for(const t of Q.filter(n=>n.wrappable)){const n=M(t);n.addEventListener("click",()=>{const o=l.textarea;p(),j(t.name,o)}),e.appendChild(n)}return e}function J(e,t,n,o){e.style.left="0px",e.style.top="0px";const a=e.getBoundingClientRect();let i=t;t+a.width>window.innerWidth-8&&(i=o!=null?o-a.width:t-a.width);let s=n;n+a.height>window.innerHeight-8&&(s=Math.max(8,window.innerHeight-a.height-8)),e.style.left=`${Math.max(8,i)}px`,e.style.top=`${Math.max(8,s)}px`}
3
+ [/${i.name}]`;O(l.textarea,r)}p()}),e.appendChild(a)}}}return e}function C(e,t){const n=f(document.createElement("button"));n.type="button",n.style.cssText=u+"justify-content:space-between;",n.appendChild(document.createTextNode(e));const o=document.createElement("span");return o.setAttribute("data-icon","chevron-right"),o.setAttribute("data-icon-size","12"),o.style.cssText="opacity:.6;display:inline-flex;align-items:center;flex-shrink:0;",n.appendChild(o),n.addEventListener("mouseenter",()=>X(n,t)),n.addEventListener("click",c=>{c.stopPropagation(),X(n,t)}),n}function g(){const e=document.createElement("div");return e.className="dm-sc-submenu",e.style.cssText=q,e}function X(e,t){L();const n=t();l.submenu=n,document.body.appendChild(n);const o=e.getBoundingClientRect();J(n,o.right+2,o.top,o.left-2),window.I&&I.scan(n)}function L(){l&&l.submenu&&(l.submenu.remove(),l.submenu=null)}function N(e){const t=f(document.createElement("button"));if(t.type="button",t.style.cssText=u,e.icon){const n=document.createElement("span");n.setAttribute("data-icon",e.icon),n.setAttribute("data-icon-size","14"),n.style.cssText="opacity:.75;display:inline-flex;align-items:center;flex-shrink:0;",t.appendChild(n)}return t.appendChild(document.createTextNode(e.label)),t}function Ae(){const e=g();for(const{category:t,items:n}of le()){e.appendChild(w(t));for(const o of n){const c=N(o);c.addEventListener("click",()=>{const i=l.textarea;p(),j(o.name,i)}),e.appendChild(c)}}return e}function Me(){const e=g();e.style.maxWidth="320px";const t=document.createElement("input");t.type="text",t.placeholder="Find a block\u2026",t.style.cssText=P+"margin:6px;width:calc(100% - 12px);",t.addEventListener("mousedown",c=>c.stopPropagation());const n=document.createElement("div");e.append(t,n);const o=()=>{const c=t.value.trim().toLowerCase(),i=l.blocks.filter(s=>!c||s.name.includes(c)||s.description.toLowerCase().includes(c));n.replaceChildren();for(const s of i){const a=N(s);if(s.description&&(a.title=s.description),!s.shortTag){const r=document.createElement("small");r.style.cssText="margin-left:auto;opacity:.6;",r.textContent="[block]",r.title='A built-in shortcode has this name, so it goes in as [block template="\u2026"]',a.appendChild(r)}a.addEventListener("click",()=>{const r=l.textarea;p();const d=r.selectionStart,b=de(s);O(r,b);const m=b.indexOf('=""');m>=0&&r.setSelectionRange(d+m+2,d+m+2),r.focus()}),n.appendChild(a)}if(!i.length){const s=document.createElement("div");s.style.cssText=k,s.textContent="No blocks match",n.appendChild(s)}window.I&&I.scan(n)};return t.addEventListener("input",o),o(),setTimeout(()=>t.focus(),0),e}function Ie(){const e=g();for(const t of R.filter(n=>n.wrappable||n.container)){const n=N(t);n.addEventListener("click",()=>{const o=l.textarea;p(),M(o,t)}),e.appendChild(n)}for(const t of Z.filter(n=>n.wrappable)){const n=N(t);n.addEventListener("click",()=>{const o=l.textarea;p(),j(t.name,o)}),e.appendChild(n)}return e}function J(e,t,n,o){e.style.left="0px",e.style.top="0px";const c=e.getBoundingClientRect();let i=t;t+c.width>window.innerWidth-8&&(i=o!=null?o-c.width:t-c.width);let s=n;n+c.height>window.innerHeight-8&&(s=Math.max(8,window.innerHeight-c.height-8)),e.style.left=`${Math.max(8,i)}px`,e.style.top=`${Math.max(8,s)}px`}
@@ -41,7 +41,7 @@ Optional body content.
41
41
  | Product | Price |
42
42
  | ------- | ----: |
43
43
  | Widget | $9.99 |
44
- [/table]`,attrs:[{name:"striped",type:"checkbox",label:"Striped"},{name:"bordered",type:"checkbox",label:"Bordered"},{name:"compact",type:"checkbox",label:"Compact"},{name:"caption",type:"text",label:"Caption"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"badge",label:"Badge",icon:"badge",category:"Content",selfClosing:!1,container:!1,wrappable:!1,template:'[badge variant="success"]New[/badge]',inline:!0,attrs:[{name:"variant",type:"select",label:"Variant",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"],["light","Light"],["dark","Dark"]]},{name:"pill",type:"checkbox",label:"Pill"},{name:"outline",type:"checkbox",label:"Outline"},{name:"size",type:"select",label:"Size",options:[["","Default"],["small","Small"],["large","Large"]]}]},{name:"text",label:"Text",icon:"text-style",preview:"text",category:"Content",selfClosing:!1,container:!0,wrappable:!0,template:"[text]Styled text[/text]",inline:!0,actions:[{label:"Highlight - gradient with a shine",icon:"star",set:{gradient:"sunset",shine:"hover"}},{label:"Highlight that sweeps by itself",icon:"star",set:{gradient:"sunset",shine:"sweep"}},{label:"Light up as you read",icon:"eye",set:{"light-up":"true"}},{label:"Rise in word by word",icon:"arrow-up",set:{words:"true"}},{label:"Plain - no highlight or motion",icon:"minimize",set:{gradient:null,shine:null,"light-up":null,words:null}}],quickAttrs:["gradient","shine","size","bold","color"],attrs:[{name:"size",type:"select",label:"Size",options:[["xs","XS"],["sm","Small"],["base","Base"],["lg","Large"],["xl","XL"],["2xl","2XL"],["3xl","3XL"],["4xl","4XL"]]},{name:"weight",type:"select",label:"Weight",options:[["thin","Thin"],["light","Light"],["normal","Normal"],["medium","Medium"],["semibold","Semibold"],["bold","Bold"],["extrabold","Extra bold"],["black","Black"]]},{name:"point-size",type:"number",label:"Point size"},{name:"bold",type:"checkbox",label:"Bold"},{name:"italic",type:"checkbox",label:"Italic"},{name:"color",type:"colour",label:"Colour"},{name:"font",type:"select",label:"Font",options:Object.keys(l).map(e=>[e,n(e)?`${e} (licensed)`:e])},{name:"transform",type:"select",label:"Transform",options:[["upper","Uppercase"],["lower","Lowercase"],["capitalize","Capitalise"],["none","None"]]},{name:"decoration",type:"select",label:"Decoration",options:[["underline","Underline"],["line-through","Line through"],["none","None"]]},{name:"spacing",type:"select",label:"Letter spacing",options:[["tight","Tight"],["normal","Normal"],["wide","Wide"],["wider","Wider"]]},{name:"align",type:"select",label:"Align",options:[["","None"],["left","Left"],["center","Centre"],["right","Right"]]},{name:"gradient",type:"select",label:"Gradient",options:[["","None"],["brand","Theme"],["sunset","Sunset"],["ocean","Ocean"],["forest","Forest"],["fire","Fire"],["candy","Candy"]]},{name:"shine",type:"select",label:"Shine (gradient)",options:[["","None"],["hover","Follows the pointer"],["sweep","Sweeps across"]]},{name:"light-up",type:"checkbox",label:"Words light up as you scroll"},{name:"words",type:"checkbox",label:"Rise in word by word"},{name:"style",type:"text",label:"Inline CSS"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"button",label:"Button",icon:"btn-insert",category:"Content",selfClosing:!0,container:!1,wrappable:!1,template:'[button href="/contact" variant="primary" label="Get in touch" /]',attrs:[{name:"href",type:"url",label:"Link"},{name:"label",type:"text",label:"Label"},{name:"variant",type:"select",label:"Variant",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"],["outline","Outline"],["ghost","Ghost"],["link","Link"],["outline-success","Outline success"],["outline-danger","Outline danger"],["outline-warning","Outline warning"],["outline-info","Outline info"]]},{name:"size",type:"select",label:"Size",options:[["","Default"],["sm","Small"],["lg","Large"]]},{name:"icon",type:"icon",label:"Icon (before)"},{name:"icon-after",type:"icon",label:"Icon (after)"},{name:"target",type:"text",label:"Target"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"link",label:"Link",icon:"link-shortcode",category:"Content",selfClosing:!0,container:!1,wrappable:!1,template:'[link href="/about" label="About us" /]',formats:[{value:"markdown",label:"Markdown link",emit:e=>Object.keys(e).some(t=>t!=="href"&&t!=="label"&&e[t])||!e.href?null:`[${e.label||e.href}](${e.href})`},{value:"shortcode",label:"Link shortcode"}],attrs:[{name:"href",type:"url",label:"Link"},{name:"label",type:"text",label:"Label"},{name:"target",type:"text",label:"Target"},{name:"class",type:"text",label:"CSS class"},{name:"icon",type:"icon",label:"Icon (before)"},{name:"icon-after",type:"icon",label:"Icon (after)"},{name:"id",type:"text",label:"ID"}]},{name:"listgroup",label:"List group",icon:"list",category:"Content",selfClosing:!1,container:!0,wrappable:!1,template:`[listgroup]
44
+ [/table]`,attrs:[{name:"striped",type:"checkbox",label:"Striped"},{name:"bordered",type:"checkbox",label:"Bordered"},{name:"compact",type:"checkbox",label:"Compact"},{name:"caption",type:"text",label:"Caption"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"badge",label:"Badge",icon:"badge",category:"Content",selfClosing:!1,container:!1,wrappable:!1,template:'[badge variant="success"]New[/badge]',inline:!0,attrs:[{name:"variant",type:"select",label:"Variant",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"],["light","Light"],["dark","Dark"]]},{name:"pill",type:"checkbox",label:"Pill"},{name:"outline",type:"checkbox",label:"Outline"},{name:"size",type:"select",label:"Size",options:[["","Default"],["small","Small"],["large","Large"]]}]},{name:"text",label:"Text",icon:"text-style",preview:"text",category:"Content",selfClosing:!1,container:!0,wrappable:!0,template:"[text]Styled text[/text]",inline:!0,actions:[{label:"Highlight - gradient with a shine",icon:"star",set:{gradient:"sunset",shine:"hover"}},{label:"Highlight that sweeps by itself",icon:"star",set:{gradient:"sunset",shine:"sweep"}},{label:"Light up as you read",icon:"eye",set:{"light-up":"true"}},{label:"Rise in word by word",icon:"arrow-up",set:{words:"true"}},{label:"Plain - no highlight or motion",icon:"minimize",set:{gradient:null,shine:null,"light-up":null,words:null}}],quickAttrs:["gradient","shine","align","size","bold","color"],attrs:[{name:"size",type:"select",label:"Size",options:[["xs","XS"],["sm","Small"],["base","Base"],["lg","Large"],["xl","XL"],["2xl","2XL"],["3xl","3XL"],["4xl","4XL"]]},{name:"weight",type:"select",label:"Weight",options:[["thin","Thin"],["light","Light"],["normal","Normal"],["medium","Medium"],["semibold","Semibold"],["bold","Bold"],["extrabold","Extra bold"],["black","Black"]]},{name:"point-size",type:"number",label:"Point size"},{name:"bold",type:"checkbox",label:"Bold"},{name:"italic",type:"checkbox",label:"Italic"},{name:"color",type:"colour",label:"Colour"},{name:"font",type:"select",label:"Font",options:Object.keys(l).map(e=>[e,n(e)?`${e} (licensed)`:e])},{name:"transform",type:"select",label:"Transform",options:[["upper","Uppercase"],["lower","Lowercase"],["capitalize","Capitalise"],["none","None"]]},{name:"decoration",type:"select",label:"Decoration",options:[["underline","Underline"],["line-through","Line through"],["none","None"]]},{name:"spacing",type:"select",label:"Letter spacing",options:[["tight","Tight"],["normal","Normal"],["wide","Wide"],["wider","Wider"]]},{name:"align",type:"select",label:"Align",options:[["","None"],["left","Left"],["center","Centre"],["right","Right"],["justify","Justify"]]},{name:"gradient",type:"select",label:"Gradient",options:[["","None"],["brand","Theme"],["sunset","Sunset"],["ocean","Ocean"],["forest","Forest"],["fire","Fire"],["candy","Candy"],["newspaper","Newspaper"],["grey-fire","Grey-fire"],["ice","Ice"],["summer","Summer"],["autumn","Autumn"],["spring","Spring"],["winter","Winter"],["aurora","Aurora"],["twilight","Twilight"],["rose-gold","Rose-gold"],["copper","Copper"],["amethyst","Amethyst"],["lagoon","Lagoon"],["cherry","Cherry"],["lavender","Lavender"],["midnight","Midnight"]]},{name:"shine",type:"select",label:"Shine (gradient)",options:[["","None"],["hover","Follows the pointer"],["sweep","Sweeps across"]]},{name:"light-up",type:"checkbox",label:"Words light up as you scroll"},{name:"words",type:"checkbox",label:"Rise in word by word"},{name:"style",type:"text",label:"Inline CSS"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"button",label:"Button",icon:"btn-insert",category:"Content",selfClosing:!0,container:!1,wrappable:!1,template:'[button href="/contact" variant="primary" label="Get in touch" /]',attrs:[{name:"href",type:"url",label:"Link"},{name:"label",type:"text",label:"Label"},{name:"variant",type:"select",label:"Variant",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"],["outline","Outline"],["ghost","Ghost"],["link","Link"],["outline-success","Outline success"],["outline-danger","Outline danger"],["outline-warning","Outline warning"],["outline-info","Outline info"]]},{name:"size",type:"select",label:"Size",options:[["","Default"],["sm","Small"],["lg","Large"]]},{name:"icon",type:"icon",label:"Icon (before)"},{name:"icon-after",type:"icon",label:"Icon (after)"},{name:"target",type:"text",label:"Target"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"link",label:"Link",icon:"link-shortcode",category:"Content",selfClosing:!0,container:!1,wrappable:!1,template:'[link href="/about" label="About us" /]',formats:[{value:"markdown",label:"Markdown link",emit:e=>Object.keys(e).some(t=>t!=="href"&&t!=="label"&&e[t])||!e.href?null:`[${e.label||e.href}](${e.href})`},{value:"shortcode",label:"Link shortcode"}],attrs:[{name:"href",type:"url",label:"Link"},{name:"label",type:"text",label:"Label"},{name:"target",type:"text",label:"Target"},{name:"class",type:"text",label:"CSS class"},{name:"icon",type:"icon",label:"Icon (before)"},{name:"icon-after",type:"icon",label:"Icon (after)"},{name:"id",type:"text",label:"ID"}]},{name:"listgroup",label:"List group",icon:"list",category:"Content",selfClosing:!1,container:!0,wrappable:!1,template:`[listgroup]
45
45
  [item]First item[/item]
46
46
  [item]Second item[/item]
47
47
  [/listgroup]`,children:{name:"item",min:1,max:20},attrs:[{name:"variant",type:"select",label:"Variant",options:[["","Default"],["flush","Flush"],["numbered","Numbered"],["horizontal","Horizontal"]]},{name:"size",type:"select",label:"Size",options:[["","Default"],["sm","Small"],["lg","Large"]]},{name:"itemvariant",type:"select",label:"Item variant",options:[["","Default"],["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"]]},{name:"action",type:"checkbox",label:"Actionable items"}]},{name:"collection",label:"Collection",icon:"database",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[collection slug="enquiries" display="table" /]',attrs:[{name:"slug",type:"lookup",source:"collections",label:"Collection"},{name:"display",type:"select",label:"Display",options:[["table","Table"],["cards","Cards"],["list","List"],["accordion","Accordion"],["timeline","Timeline"],["carousel","Carousel"],["block","Block"]]},{name:"fields",type:"text",label:"Fields (comma-separated)"},{name:"limit",type:"number",label:"Limit"},{name:"sort",type:"lookup",source:"collection-fields",label:"Sort field"},{name:"order",type:"select",label:"Order",options:[["desc","Descending"],["asc","Ascending"]]},{name:"title-field",type:"lookup",source:"collection-fields",label:"Title field"},{name:"image-field",type:"lookup",source:"collection-fields",label:"Image field"},{name:"body-field",type:"lookup",source:"collection-fields",label:"Body field"},{name:"mobile-popup",type:"checkbox",label:"Open carousel cards in a popup on mobile"},{name:"arrow-position",type:"select",label:"Arrow position",options:[["middle","Middle"],["top","Top"],["bottom","Bottom"]]},{name:"background",type:"colour",label:"Carousel background"},{name:"arrow-background",type:"colour",label:"Arrow background"},{name:"arrow-color",type:"colour",label:"Arrow colour"},{name:"autoplay",type:"checkbox",label:"Autoplay",domma:"carousel.autoplay"},{name:"interval",type:"number",label:"Interval (ms)",domma:"carousel.interval"},{name:"loop",type:"checkbox",label:"Loop",default:!0,domma:"carousel.loop"},{name:"animation",type:"select",label:"Animation",options:[["slide","Slide"],["fade","Fade"],["crossfade","Crossfade"]],domma:"carousel.animation"},{name:"animation-duration",type:"number",label:"Animation duration (ms)",domma:"carousel.animationDuration"},{name:"animation-easing",type:"text",label:"Animation easing",domma:"carousel.animationEasing"},{name:"height-mode",type:"select",label:"Image height",options:[["crop","Top-aligned crop (shortest image)"],["average","Average of shortest and tallest images"]],domma:"carousel.heightMode"},{name:"height",type:"number",label:"Fixed height (px, optional)",domma:"carousel.height"},{name:"columns",type:"number",label:"Card columns"},{name:"search",type:"checkbox",label:"Search (table)",default:!0},{name:"sortable",type:"checkbox",label:"Sortable (table)",default:!0},{name:"exportable",type:"checkbox",label:"CSV export"},{name:"page-size",type:"number",label:"Page size"},{name:"empty",type:"text",label:"Empty message"},{name:"scope",type:"select",label:"Scope",options:[["","All"],["mine","Current user"]]},{name:"cta",type:"lookup",source:"actions",label:"CTA action"},{name:"cta-label",type:"text",label:"CTA label"},{name:"cta-icon",type:"icon",label:"CTA icon"},{name:"cta-style",type:"select",label:"CTA style",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"]]},{name:"cta-confirm",type:"text",label:"CTA confirm text"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"view",label:"View",icon:"eye",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[view slug="products" display="table" limit="50" /]',attrs:[{name:"slug",type:"lookup",source:"views",label:"View"},{name:"display",type:"select",label:"Display",options:[["table","Table"],["cards","Cards"],["list","List"],["accordion","Accordion"],["timeline","Timeline"],["carousel","Carousel"],["block","Block"]]},{name:"limit",type:"number",label:"Limit"},{name:"fields",type:"text",label:"Fields (comma-separated)"},{name:"title-field",type:"text",label:"Title field"},{name:"image-field",type:"text",label:"Image field"},{name:"body-field",type:"text",label:"Body field"},{name:"mobile-popup",type:"checkbox",label:"Open carousel cards in a popup on mobile"},{name:"arrow-position",type:"select",label:"Arrow position",options:[["middle","Middle"],["top","Top"],["bottom","Bottom"]]},{name:"background",type:"colour",label:"Carousel background"},{name:"arrow-background",type:"colour",label:"Arrow background"},{name:"arrow-color",type:"colour",label:"Arrow colour"},{name:"autoplay",type:"checkbox",label:"Autoplay",domma:"carousel.autoplay"},{name:"interval",type:"number",label:"Interval (ms)",domma:"carousel.interval"},{name:"loop",type:"checkbox",label:"Loop",default:!0,domma:"carousel.loop"},{name:"animation",type:"select",label:"Animation",options:[["slide","Slide"],["fade","Fade"],["crossfade","Crossfade"]],domma:"carousel.animation"},{name:"animation-duration",type:"number",label:"Animation duration (ms)",domma:"carousel.animationDuration"},{name:"animation-easing",type:"text",label:"Animation easing",domma:"carousel.animationEasing"},{name:"height-mode",type:"select",label:"Image height",options:[["crop","Top-aligned crop (shortest image)"],["average","Average of shortest and tallest images"]],domma:"carousel.heightMode"},{name:"height",type:"number",label:"Fixed height (px, optional)",domma:"carousel.height"},{name:"columns",type:"number",label:"Card columns"},{name:"empty",type:"text",label:"Empty message"}]},{name:"block",label:"Block",icon:"layout",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[block template="post-card" title="My Post" /]',attrs:[{name:"template",type:"lookup",source:"blocks",label:"Template"}]},{name:"form",label:"Form",icon:"file-text",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[form name="contact" /]',attrs:[{name:"name",type:"lookup",source:"forms",label:"Form"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"cta",label:"CTA",icon:"mouse-pointer",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[cta action="send-welcome" entry="abc123" style="primary" label="Send" /]',attrs:[{name:"action",type:"lookup",source:"actions",label:"Action"},{name:"entry",type:"text",label:"Entry ID"},{name:"style",type:"select",label:"Style",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"]]},{name:"icon",type:"icon",label:"Icon"},{name:"size",type:"select",label:"Size",options:[["","Default"],["sm","Small"],["lg","Large"]]},{name:"confirm",type:"text",label:"Confirm text"},{name:"label",type:"text",label:"Label"}]},{name:"menu",label:"Menu",icon:"menu",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[menu slug="legal" /]',attrs:[{name:"slug",type:"lookup",source:"menus",label:"Menu"},{name:"location",type:"lookup",source:"menu-locations",label:"Location slot"},{name:"variant",type:"text",label:"Variant"},{name:"class",type:"text",label:"CSS class"},{name:"depth",type:"number",label:"Max depth"},{name:"orientation",type:"select",label:"Orientation",options:[["","Menu default"],["horizontal","Horizontal"],["vertical","Vertical"]]},{name:"float",type:"select",label:"Floating",options:[["","Menu default"],["no","Render inline here"]]}]},{name:"contents",label:"Page contents (this page)",icon:"list",category:"Layout",selfClosing:!0,container:!1,wrappable:!1,template:'[contents numbered="true" /]',actions:[{label:"Number the contents",icon:"hash",set:{numbered:"true"}},{label:"List H2 and H3 headings",icon:"list",set:{headings:"h2h3"}},{label:"Contents on the right",icon:"sidebar-right",set:{side:"right"}},{label:"Collapse the contents to a button",icon:"minimize",set:{collapsible:"true",collapsed:"true"}},{label:"Float the contents",icon:"move",set:{floating:"true","float-anchor":"TR",movable:"true"}},{label:"No contents on this page",icon:"eye-off",set:{hidden:"true"}},{label:"Remove this override",icon:"trash",remove:!0}],quickAttrs:["side","headings","numbered","title","collapsible","floating","hidden"],attrs:[{name:"side",type:"select",label:"Side",options:[["","Layout default"],["left","Left"],["right","Right"]]},{name:"width",type:"number",label:"Width (px, 160-480)"},{name:"headings",type:"select",label:"Headings",options:[["","Layout default"],["auto","Sections (H2s, else H3s)"],["h2","H2 only"],["h3","H3 only"],["h2h3","H2 and H3"]]},{name:"numbered",type:"select",label:"Numbered",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"title",type:"text",label:"Title above the list"},{name:"exclude",type:"text",label:"Leave out (headings, comma separated)"},{name:"sticky",type:"select",label:"Stays in view",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"scroll-spy",type:"select",label:"Marks the section being read",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"collapsible",type:"select",label:"Collapsible to a button",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"collapsed",type:"select",label:"Start collapsed",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"autohide",type:"select",label:"Autohide off its edge",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"floating",type:"select",label:"Floating panel",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"float-anchor",type:"select",label:"Float anchor",options:[["","Layout default"],["TL","Top left"],["TR","Top right"],["BL","Bottom left"],["BR","Bottom right"],["L","Left"],["R","Right"]]},{name:"movable",type:"select",label:"Visitors can move it",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"hidden",type:"select",label:"No contents on this page",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"hover",type:"text",label:"Hover effect"},{name:"selected",type:"text",label:"When selected"},{name:"accent",type:"colour",label:"Accent"},{name:"font",type:"text",label:"Font family"},{name:"font-size",type:"text",label:"Font size"},{name:"font-weight",type:"text",label:"Font weight"}]},{name:"navbar",label:"Navbar settings (this page)",icon:"sliders",category:"Layout",selfClosing:!0,container:!1,wrappable:!1,template:'[navbar collapsed="true" /]',actions:[{label:"Collapse the rail on this page",icon:"chevrons-right",set:{collapsible:"true",collapsed:"true",autohide:"false"}},{label:"Autohide the rail on this page",icon:"eye-off",set:{autohide:"true",collapsed:null}},{label:"Keep the rail open on this page",icon:"eye",set:{autohide:"false",collapsed:"false"}},{label:"Hide the bar on scroll on this page",icon:"arrow-up",set:{"hide-on-scroll":"true"}},{label:"Remove this override",icon:"trash",remove:!0}],quickAttrs:["position","width","collapsible","collapsed","autohide","hide-on-scroll"],attrs:[{name:"position",type:"select",label:"Position",options:[["","Menu default"],["sticky","Sticky"],["fixed","Fixed"],["static","Static"],["floating","Floating"]]},{name:"orientation",type:"select",label:"Orientation",options:[["","Menu default"],["horizontal","Horizontal"],["vertical","Vertical"]]},{name:"side",type:"select",label:"Rail side",options:[["","Menu default"],["left","Left"],["right","Right"]]},{name:"align",type:"select",label:"Alignment",options:[["","Menu default"],["left","Left"],["centre","Centre"],["right","Right"],["spread","Spread"]]},{name:"width",type:"number",label:"Rail width (px, 160-480)"},{name:"collapsible",type:"select",label:"Collapsible to icons",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"collapsed",type:"select",label:"Start collapsed",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"autohide",type:"select",label:"Autohide off-screen",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"hide-on-scroll",type:"select",label:"Hide on scroll (bar)",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"hover-open",type:"select",label:"Open dropdowns on hover",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"bar",type:"select",label:"Bar shape",options:[["","Menu default"],["pill","Pill"],["segmented","Segmented"],["underline","Underline glide"],["dock","Dock"],["neon","Neon"],["tabs","Tabs"],["tiles","Tiles"],["bubbles","Bubbles"],["brutalist","Brutalist"],["gradient","Gradient band"]]},{name:"shrink",type:"select",label:"Shrink on scroll",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"icons",type:"select",label:"Bar icons",options:[["","Menu default"],["rainbow","Rainbow"],["accent","Accent"]]},{name:"brand",type:"select",label:"Branding shape",options:[["","Menu default"],["pill","Pill"]]},{name:"strip",type:"select",label:"Bar background",options:[["","Menu default"],["none","None - floating pills"],["band","Strip - keep the band"]]},{name:"dropdown",type:"select",label:"Dropdown style",options:[["","Menu default"],["cards","Cards"]]},{name:"tiles",type:"select",label:"Icon tiles (cards)",options:[["","Menu default"],["rainbow","Rainbow"],["accent","Theme colour"],["neutral","Neutral"],["none","No tiles"]]},{name:"morph",type:"select",label:"Slide between cards",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"hover",type:"text",label:"Hover effect"},{name:"selected",type:"text",label:"When selected"},{name:"accent",type:"colour",label:"Highlight colour"},{name:"variant",type:"text",label:"Variant"},{name:"font",type:"text",label:"Font family"},{name:"font-size",type:"text",label:"Font size"},{name:"font-weight",type:"text",label:"Font weight"},{name:"letter-spacing",type:"text",label:"Letter spacing"},{name:"icon-size",type:"text",label:"Icon size"},{name:"float-anchor",type:"select",label:"Float anchor",options:[["","Menu default"],["TL","Top left"],["TR","Top right"],["BL","Bottom left"],["BR","Bottom right"],["L","Left"],["R","Right"]]},{name:"float-x",type:"number",label:"Float offset X (px)"},{name:"float-y",type:"number",label:"Float offset Y (px)"},{name:"float-width",type:"number",label:"Float width (px)"},{name:"float-collapsible",type:"select",label:"Float: collapsible",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"float-movable",type:"select",label:"Float: movable",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"class",type:"text",label:"CSS classes"}]},{name:"theme-switcher",label:"Theme switcher",icon:"palette",category:"Components",selfClosing:!0,container:!1,wrappable:!1,template:"[theme-switcher /]",attrs:[{name:"position",type:"select",label:"Position",options:[["","Inline - where the tag is"],["top-left","Top left"],["top-right","Top right"],["left-center","Left, centred"],["right-center","Right, centred"],["bottom-left","Bottom left"],["bottom-right","Bottom right"]]},{name:"offset-x",type:"number",label:"Offset from the side (px, pinned only)"},{name:"offset-y",type:"number",label:"Offset from the top/bottom (px, pinned only)"},{name:"themes",type:"text",label:"Themes (comma list - blank for the site's)"}]},{name:"icon",label:"Icon",icon:"icon-pick",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[icon name="arrow-right" /]',attrs:[{name:"name",type:"icon",label:"Icon name"},{name:"size",type:"number",label:"Size (px)"},{name:"color",type:"colour",label:"Colour"},{name:"class",type:"text",label:"CSS class"}]},{name:"embed",label:"Embed",icon:"video",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[embed url="https://youtu.be/dQw4w9WgXcQ" /]',custom:"embed",attrs:[{name:"url",type:"url",label:"URL"},{name:"ratio",type:"select",label:"Aspect ratio",options:[["16:9","16:9"],["4:3","4:3"],["1:1","1:1"],["21:9","21:9"],["9:16","9:16"],["3:4","3:4"]]},{name:"title",type:"text",label:"Title / caption"},{name:"width",type:"text",label:"Width"},{name:"align",type:"select",label:"Alignment",options:[["left","Left"],["center","Centre"],["right","Right"]]},{name:"autoplay",type:"checkbox",label:"Autoplay"},{name:"loop",type:"checkbox",label:"Loop"},{name:"muted",type:"checkbox",label:"Muted"}]}];for(const e of SHORTCODES){e.attrs||(e.attrs=[]);for(const a of o)e.attrs.some(t=>t.name===a.name)||e.attrs.push(a)}export const EDITOR_TOOLS=[{name:"image",label:"Image",icon:"image-add",category:"Media",custom:"image"},{name:"colourpick",label:"Colour picker",icon:"colour-picker",category:"Media",custom:"colourpick"},{name:"component",label:"Component",icon:"component",category:"Components",custom:"component"},{name:"scribe",label:"Scribe",icon:"scribe-insert",category:"Content",custom:"scribe"},{name:"highlight-text",label:"Highlight text",icon:"star",category:"Content",custom:"highlighttext",wrappable:!0}];
@@ -964,7 +964,8 @@ Body content in **Markdown** is supported.
964
964
  <ul>
965
965
  <li><code>[text gradient="sunset"]Around the clock.[/text]</code> - the words in a gradient.
966
966
  Named gradients: <code>brand</code> (your theme's colour), <code>sunset</code>,
967
- <code>ocean</code>, <code>forest</code>, <code>fire</code>, <code>candy</code>, or two
967
+ <code>ocean</code>, <code>forest</code>, <code>fire</code>, <code>candy</code>,
968
+ <code>newspaper</code>, <code>grey-fire</code>, <code>ice</code>, <code>summer</code>, <code>autumn</code>, <code>spring</code>, <code>winter</code>, <code>aurora</code>, <code>twilight</code>, <code>rose-gold</code>, <code>copper</code>, <code>amethyst</code>, <code>lagoon</code>, <code>cherry</code>, <code>lavender</code>, <code>midnight</code>, or two
968
969
  colours of your own: <code>gradient="#f26b3a,#8b5cf6"</code>.</li>
969
970
  <li><code>shine="hover"</code> - a highlight runs through the gradient words, following the
970
971
  pointer across the line. <code>shine="sweep"</code> - it sweeps across by itself every few
@@ -703,7 +703,7 @@ Wraps inline text in a `<span>` with custom styles. All attributes are optional.
703
703
  | `style` | Raw CSS declarations | Appended to the generated inline style |
704
704
  | `class` | CSS class name(s) | Added to the `<span>` element |
705
705
  | `id` | Element ID | Added to the `<span>` element |
706
- | `gradient` | `brand` `sunset` `ocean` `forest` `fire` `candy`, or two hex colours `"#f26b3a,#8b5cf6"`; a bare flag is `brand` | The words are painted in the gradient (`.dm-tg`) |
706
+ | `gradient` | `brand` `sunset` `ocean` `forest` `fire` `candy` `newspaper` `grey-fire` `ice` `summer` `autumn` `spring` `winter` `aurora` `twilight` `rose-gold` `copper` `amethyst` `lagoon` `cherry` `lavender` `midnight`, or two hex colours `"#f26b3a,#8b5cf6"`; a bare flag is `brand` | The words are painted in the gradient (`.dm-tg`) |
707
707
  | `shine` | `hover` `sweep` | With `gradient`: a highlight runs through the words - following the pointer, or sweeping across every few seconds |
708
708
  | `light-up` | flag | The text starts dim and lights up word by word as it scrolls up the window |
709
709
  | `words` | flag | The text rises into view word by word |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-cms",
3
- "version": "1.22.2",
3
+ "version": "1.24.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 +1 @@
1
- import{LICENSED_FONTS as l}from"./font-families.mjs?v=20261029-cms-fonts";export const SIZE_MAP={xs:".75rem",sm:".875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},WEIGHT_MAP={thin:"100",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},SPACING_MAP={tight:"-0.05em",normal:"0em",wide:"0.05em",wider:"0.1em"},COLOUR_TOKENS={primary:"var(--dm-color-primary)",secondary:"var(--dm-color-secondary)",muted:"var(--dm-text-muted)",danger:"var(--dm-color-danger)",success:"var(--dm-color-success)",warning:"var(--dm-color-warning)",info:"var(--dm-color-info)"},FONT_MAP={Georgia:"Georgia,serif",Arial:"Arial,sans-serif",Verdana:"Verdana,sans-serif","Courier New":"'Courier New',monospace","Times New Roman":"'Times New Roman',serif","Trebuchet MS":"'Trebuchet MS',sans-serif",Roboto:"'Roboto',sans-serif",Inter:"'Inter',sans-serif","Open Sans":"'Open Sans',sans-serif",Lato:"'Lato',sans-serif",Nunito:"'Nunito',sans-serif",Poppins:"'Poppins',sans-serif",Urbanist:"'Urbanist',sans-serif","Source Sans 3":"'Source Sans 3',sans-serif",Montserrat:"'Montserrat',sans-serif",Raleway:"'Raleway',sans-serif","DM Sans":"'DM Sans',sans-serif","Work Sans":"'Work Sans',sans-serif",Merriweather:"'Merriweather',serif","Playfair Display":"'Playfair Display',serif",Lora:"'Lora',serif","Roboto Slab":"'Roboto Slab',serif",Lexend:"'Lexend',sans-serif","Atkinson Hyperlegible":"'Atkinson Hyperlegible',sans-serif",Andika:"'Andika',sans-serif","Nunito Sans":"'Nunito Sans',sans-serif",Mulish:"'Mulish',sans-serif",...Object.fromEntries(l.map(e=>[e,`'${e}',sans-serif`]))},CMS_WEB_FONTS=Object.freeze(["Roboto","Inter","Open Sans","Lato","Nunito","Poppins","Urbanist","Source Sans 3","Montserrat","Raleway","DM Sans","Work Sans","Merriweather","Playfair Display","Lora","Roboto Slab","Lexend","Atkinson Hyperlegible","Andika","Nunito Sans","Mulish"]),TRANSFORM_MAP={upper:"uppercase",lower:"lowercase",capitalize:"capitalize",none:"none"},DECORATION_MAP={underline:"underline","line-through":"line-through",none:"none"};function a(e){return e!=null&&e!==!1&&e!=="false"&&e!=="0"}function r(e){return String(e).replace(/["<>]/g,"").trim()}export function buildTextStyle(e={}){const n=[];if(e.size&&n.push(`font-size:${SIZE_MAP[e.size]||r(e.size)}`),e["point-size"]){const i=parseFloat(e["point-size"]);!isNaN(i)&&i>0&&n.push(`font-size:${i}pt`)}a(e.bold)?n.push("font-weight:700"):e.weight&&WEIGHT_MAP[e.weight]&&n.push(`font-weight:${WEIGHT_MAP[e.weight]}`),a(e.italic)&&n.push("font-style:italic");const s=e.colour||e.color;return s&&n.push(`color:${COLOUR_TOKENS[s]||r(s)}`),e.font&&FONT_MAP[e.font]&&n.push(`font-family:${FONT_MAP[e.font]}`),e.transform&&TRANSFORM_MAP[e.transform]&&n.push(`text-transform:${TRANSFORM_MAP[e.transform]}`),e.decoration&&DECORATION_MAP[e.decoration]&&n.push(`text-decoration:${DECORATION_MAP[e.decoration]}`),e.spacing&&n.push(`letter-spacing:${SPACING_MAP[e.spacing]||r(e.spacing)}`),e.align&&(n.push("display:block"),n.push(`text-align:${r(e.align)}`)),e.style&&n.push(r(e.style).replace(/;+$/,"")),n.join(";")}export const TEXT_GRADIENTS={brand:["var(--dm-primary)","color-mix(in oklab, var(--dm-primary) 45%, #a855f7)"],sunset:["#f26b3a","#8b5cf6"],ocean:["#06b6d4","#3b82f6"],forest:["#10b981","#84cc16"],fire:["#f59e0b","#ef4444"],candy:["#ec4899","#8b5cf6"]},TEXT_SHINES=["hover","sweep"];const p=/^#[0-9a-f]{6}$/i;export function buildTextMotion(e={}){const n=[],s=[],i=e.gradient;if(i!=null&&i!==!1&&i!=="false"){let o=TEXT_GRADIENTS[i===!0||i===""||i==="true"?"brand":i];if(!o){const t=String(i).split(",").map(f=>f.trim());t.length===2&&t.every(f=>p.test(f))&&(o=t)}o&&(n.push("dm-tg"),s.push(`--dm-tg-a:${o[0]}`,`--dm-tg-b:${o[1]}`),TEXT_SHINES.includes(e.shine)&&n.push(`dm-tg--${e.shine}`))}return a(e["light-up"])&&n.push("dm-tm-ink"),a(e.words)&&n.push("dm-tm-words"),{classes:n,style:s.join(";")}}
1
+ import{LICENSED_FONTS as l}from"./font-families.mjs?v=20261029-cms-fonts";export const SIZE_MAP={xs:".75rem",sm:".875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},WEIGHT_MAP={thin:"100",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},SPACING_MAP={tight:"-0.05em",normal:"0em",wide:"0.05em",wider:"0.1em"},COLOUR_TOKENS={primary:"var(--dm-color-primary)",secondary:"var(--dm-color-secondary)",muted:"var(--dm-text-muted)",danger:"var(--dm-color-danger)",success:"var(--dm-color-success)",warning:"var(--dm-color-warning)",info:"var(--dm-color-info)"},FONT_MAP={Georgia:"Georgia,serif",Arial:"Arial,sans-serif",Verdana:"Verdana,sans-serif","Courier New":"'Courier New',monospace","Times New Roman":"'Times New Roman',serif","Trebuchet MS":"'Trebuchet MS',sans-serif",Roboto:"'Roboto',sans-serif",Inter:"'Inter',sans-serif","Open Sans":"'Open Sans',sans-serif",Lato:"'Lato',sans-serif",Nunito:"'Nunito',sans-serif",Poppins:"'Poppins',sans-serif",Urbanist:"'Urbanist',sans-serif","Source Sans 3":"'Source Sans 3',sans-serif",Montserrat:"'Montserrat',sans-serif",Raleway:"'Raleway',sans-serif","DM Sans":"'DM Sans',sans-serif","Work Sans":"'Work Sans',sans-serif",Merriweather:"'Merriweather',serif","Playfair Display":"'Playfair Display',serif",Lora:"'Lora',serif","Roboto Slab":"'Roboto Slab',serif",Lexend:"'Lexend',sans-serif","Atkinson Hyperlegible":"'Atkinson Hyperlegible',sans-serif",Andika:"'Andika',sans-serif","Nunito Sans":"'Nunito Sans',sans-serif",Mulish:"'Mulish',sans-serif",...Object.fromEntries(l.map(e=>[e,`'${e}',sans-serif`]))},CMS_WEB_FONTS=Object.freeze(["Roboto","Inter","Open Sans","Lato","Nunito","Poppins","Urbanist","Source Sans 3","Montserrat","Raleway","DM Sans","Work Sans","Merriweather","Playfair Display","Lora","Roboto Slab","Lexend","Atkinson Hyperlegible","Andika","Nunito Sans","Mulish"]),TRANSFORM_MAP={upper:"uppercase",lower:"lowercase",capitalize:"capitalize",none:"none"},DECORATION_MAP={underline:"underline","line-through":"line-through",none:"none"};function a(e){return e!=null&&e!==!1&&e!=="false"&&e!=="0"}function r(e){return String(e).replace(/["<>]/g,"").trim()}export function buildTextStyle(e={}){const n=[];if(e.size&&n.push(`font-size:${SIZE_MAP[e.size]||r(e.size)}`),e["point-size"]){const i=parseFloat(e["point-size"]);!isNaN(i)&&i>0&&n.push(`font-size:${i}pt`)}a(e.bold)?n.push("font-weight:700"):e.weight&&WEIGHT_MAP[e.weight]&&n.push(`font-weight:${WEIGHT_MAP[e.weight]}`),a(e.italic)&&n.push("font-style:italic");const s=e.colour||e.color;return s&&n.push(`color:${COLOUR_TOKENS[s]||r(s)}`),e.font&&FONT_MAP[e.font]&&n.push(`font-family:${FONT_MAP[e.font]}`),e.transform&&TRANSFORM_MAP[e.transform]&&n.push(`text-transform:${TRANSFORM_MAP[e.transform]}`),e.decoration&&DECORATION_MAP[e.decoration]&&n.push(`text-decoration:${DECORATION_MAP[e.decoration]}`),e.spacing&&n.push(`letter-spacing:${SPACING_MAP[e.spacing]||r(e.spacing)}`),e.align&&(n.push("display:block"),n.push(`text-align:${r(e.align)}`)),e.style&&n.push(r(e.style).replace(/;+$/,"")),n.join(";")}export const TEXT_GRADIENTS={brand:["var(--dm-primary)","color-mix(in oklab, var(--dm-primary) 45%, #a855f7)"],sunset:["#f26b3a","#8b5cf6"],ocean:["#06b6d4","#3b82f6"],forest:["#10b981","#84cc16"],fire:["#f59e0b","#ef4444"],candy:["#ec4899","#8b5cf6"],newspaper:["#292524","#a8a29e"],"grey-fire":["#64748b","#f97316"],ice:["#0891b2","#a5f3fc"],summer:["#eab308","#f43f5e"],autumn:["#b45309","#b91c1c"],spring:["#65a30d","#0d9488"],winter:["#475569","#60a5fa"],aurora:["#14b8a6","#a855f7"],twilight:["#6366f1","#db2777"],"rose-gold":["#be6b7c","#d4a34a"],copper:["#92400e","#ea9855"],amethyst:["#7e22ce","#c084fc"],lagoon:["#0f766e","#38bdf8"],cherry:["#be123c","#fb7185"],lavender:["#8b5cf6","#d8b4fe"],midnight:["#1e3a8a","#7c3aed"]},TEXT_SHINES=["hover","sweep"];const c=/^#[0-9a-f]{6}$/i;export function buildTextMotion(e={}){const n=[],s=[],i=e.gradient;if(i!=null&&i!==!1&&i!=="false"){let o=TEXT_GRADIENTS[i===!0||i===""||i==="true"?"brand":i];if(!o){const f=String(i).split(",").map(t=>t.trim());f.length===2&&f.every(t=>c.test(t))&&(o=f)}o&&(n.push("dm-tg"),s.push(`--dm-tg-a:${o[0]}`,`--dm-tg-b:${o[1]}`),TEXT_SHINES.includes(e.shine)&&n.push(`dm-tg--${e.shine}`))}return a(e["light-up"])&&n.push("dm-tm-ink"),a(e.words)&&n.push("dm-tm-words"),{classes:n,style:s.join(";")}}
@@ -338,15 +338,16 @@ export async function blocksRoutes(fastify) {
338
338
  // Create or update block
339
339
  fastify.put('/blocks/:name', canUpdate, async (request, reply) => {
340
340
  const {name} = request.params;
341
- const {content, bundled, css, meta} = request.body || {};
341
+ const {content, bundled, css, meta, createOnly} = request.body || {};
342
342
  if (typeof content !== 'string') return reply.status(400).send({error: 'content (string) is required'});
343
343
  if (css !== undefined && typeof css !== 'string') return reply.status(400).send({error: 'css must be a string'});
344
344
 
345
345
  try {
346
- return await saveBlock(name, content, {bundled: !!bundled, css, meta});
346
+ return await saveBlock(name, content, {bundled: !!bundled, css, meta, createOnly: createOnly === true});
347
347
  } catch (err) {
348
348
  if (err.code === 'INVALID_NAME') return reply.status(400).send({error: err.message});
349
349
  if (err.code === 'CSS_TOO_LARGE') return reply.status(400).send({error: err.message});
350
+ if (err.code === 'EEXIST') return reply.status(409).send({error: 'A block with this name already exists. Choose another name.'});
350
351
  throw err;
351
352
  }
352
353
  });
@@ -320,12 +320,13 @@ export async function getBlock(name) {
320
320
  * @param {string} name - Block name (without .html extension)
321
321
  * @param {string} content - HTML template content
322
322
  * @param {object} [opts]
323
+ * @param {boolean} [opts.createOnly] - Reject existing names with EEXIST, including concurrent creates
323
324
  * @param {boolean} [opts.bundled] - Include in fresh-install seed list
324
325
  * @param {string} [opts.css] - Companion CSS body; empty string removes the file
325
326
  * @returns {Promise<{success: boolean, name: string}>}
326
327
  * @throws {Error} With code INVALID_NAME on bad name, or CSS_TOO_LARGE when CSS exceeds cap
327
328
  */
328
- export async function saveBlock(name, content, {bundled, css, meta} = {}) {
329
+ export async function saveBlock(name, content, {bundled, css, meta, createOnly = false} = {}) {
329
330
  assertValidName(name);
330
331
  if (typeof css === 'string' && css.length > MAX_CSS_SIZE) {
331
332
  const err = new Error(`CSS exceeds ${MAX_CSS_SIZE} byte limit`);
@@ -333,7 +334,7 @@ export async function saveBlock(name, content, {bundled, css, meta} = {}) {
333
334
  throw err;
334
335
  }
335
336
  await fs.mkdir(BLOCKS_DIR, {recursive: true});
336
- await fs.writeFile(blockFilePath(name), content, 'utf8');
337
+ await fs.writeFile(blockFilePath(name), content, {encoding: 'utf8', flag: createOnly ? 'wx' : 'w'});
337
338
  const metaPath = blockMetaPath(name);
338
339
  // List tags (services/listTags.js) are set from the Blocks list, not by a
339
340
  // content save: a caller that does not send `adminTags` keeps the stored