domma-cms 1.17.0 → 1.18.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 +7 -0
- package/admin/js/lib/admin-theme.js +1 -1
- package/admin/js/lib/editor-type.js +1 -1
- package/admin/js/lib/effects-builder.js +1 -1
- package/admin/js/lib/scribe-composer.js +1 -1
- package/admin/js/lib/scribe-model.js +1 -1
- package/admin/js/lib/shortcode-preview.js +1 -1
- package/admin/js/lib/shortcode-registry.js +3 -3
- package/admin/js/lib/theme-settings-arrange.js +1 -1
- package/admin/js/templates/docs/usage-navigation.html +2 -2
- package/admin/js/templates/theme.html +62 -1
- package/admin/js/views/menu-editor.js +10 -10
- package/admin/js/views/page-editor.js +9 -9
- package/docs/DommaFeatures.md +1 -1
- package/docs/screenshots/editor-font-families-mobile.png +0 -0
- package/docs/screenshots/theme-font-families.png +0 -0
- package/docs/typography.md +44 -0
- package/package.json +1 -1
- package/plugins/_lib/admin/mail/fonts.js +5 -0
- package/public/css/menu-cards.css +1 -1
- package/public/js/effects.js +1 -1
- package/public/js/font-families.mjs +1 -0
- package/public/js/scribe-style.mjs +1 -1
- package/public/js/text-style.mjs +1 -1
- package/server/routes/api/theme.js +2 -1
- package/server/services/renderer.js +41 -54
- package/server/services/themeSettings.js +7 -0
- package/server/templates/page.html +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.18.0] - 2026-10-29
|
|
4
|
+
|
|
5
|
+
- Typography: add Urbanist alongside Poppins and Montserrat, independent public-site and admin font choices, and these families in the page editor, text shortcodes, Scribe/effects and mail font catalogue. Text content loads its chosen webfont even when the body uses a different typeface.
|
|
6
|
+
- Licensed fonts: support Cera Pro and the Euclid families through a site-owned stylesheet under /public/fonts/. Font assets remain site-owned and survive updates; these families are never requested from Google Fonts. No commercial font files are bundled.
|
|
7
|
+
- Menus: a crowded bar now drops its dropdown arrows before it hides the site name beside the logo, so laptops (1366-1536px) keep the name.
|
|
8
|
+
- Menus: saving a menu in the editor no longer drops its Binding and Project. Their lists were filled through a sanitiser that removes options, so they came out empty and the save wrote "not bound" and "no project".
|
|
9
|
+
|
|
3
10
|
## [1.17.0] - 2026-10-29
|
|
4
11
|
|
|
5
12
|
- Menus: a bar with more links than room now fits itself. It keeps clear of a floating Search or Reduce motion button over either end, then tightens a step at a time (less padding, a smaller size, the site name hidden beside a logo, no carets, and last of all no icons) until the links fit, and widens again on a bigger screen.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{fontFamilyValue as i,fontStylesheetHref as r,isFontStylesheet as f}from"../../../public/js/font-families.mjs?v=20261029-cms-fonts";const a="dm-custom-themes";function y(e={}){const s=(c,d)=>{let m=document.getElementById(c);if(!d){m?.remove();return}m||(m=document.createElement("link"),m.id=c,m.rel="stylesheet",document.head.appendChild(m)),m.href=d},t=f(e.stylesheet)?e.stylesheet:"";s("dm-licensed-fonts",t);const o=r(e.family,{stylesheet:t});s("dm-admin-font-link",o===t?"":o);let n=document.getElementById("dm-admin-font");if(!e.family){n?.remove();return}n||(n=document.createElement("style"),n.id="dm-admin-font",document.head.appendChild(n));const l=i(e.family);n.textContent=`body[class] { --dm-font-sans: ${l}; font-family: var(--dm-font-sans); }`}export function applyAdminTheme(e){const s=e?.dommaTheme||"charcoal-dark";Domma.theme.init({theme:s,persist:!1,target:document.body});let t=document.getElementById(a);e?.css?(t||(t=document.createElement("style"),t.id=a,document.head.appendChild(t)),t.textContent=e.css):t&&t.remove();const o=document.body;for(const n of[...o.classList])n.startsWith("dm-custom-")&&o.classList.remove(n);e?.customClass&&o.classList.add(e.customClass),y(e?.font)}export async function refreshAdminTheme(e,s={}){try{applyAdminTheme(await e.theme.admin(),s)}catch{applyAdminTheme({dommaTheme:"charcoal-dark"},s)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const EDITOR_FONTS=Object.freeze([{id:"default",label:"Fira Code (default)",kind:"mono",google:"Fira Code",stack:"'Fira Code', 'Courier New', monospace"},{id:"system-mono",label:"System monospace",kind:"mono",stack:"ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace"},{id:"jetbrains",label:"JetBrains Mono",kind:"mono",google:"JetBrains Mono",stack:"'JetBrains Mono', ui-monospace, monospace"},{id:"source-code",label:"Source Code Pro",kind:"mono",google:"Source Code Pro",stack:"'Source Code Pro', ui-monospace, monospace"},{id:"ibm-plex",label:"IBM Plex Mono",kind:"mono",google:"IBM Plex Mono",stack:"'IBM Plex Mono', ui-monospace, monospace"},{id:"roboto-mono",label:"Roboto Mono",kind:"mono",google:"Roboto Mono",stack:"'Roboto Mono', ui-monospace, monospace"},{id:"ubuntu-mono",label:"Ubuntu Mono",kind:"mono",google:"Ubuntu Mono",stack:"'Ubuntu Mono', ui-monospace, monospace"},{id:"space-mono",label:"Space Mono",kind:"mono",google:"Space Mono",stack:"'Space Mono', ui-monospace, monospace"},{id:"courier-prime",label:"Courier Prime",kind:"mono",google:"Courier Prime",stack:"'Courier Prime', 'Courier New', monospace"},{id:"system-sans",label:"System sans-serif",kind:"sans",stack:"system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif"},{id:"inter",label:"Inter",kind:"sans",google:"Inter",stack:"'Inter', system-ui, sans-serif"},{id:"serif",label:"Georgia (serif)",kind:"serif",stack:"Georgia, 'Times New Roman', serif"}]),SIZES=Object.freeze([12,13,14,15,16,17,18,20,22]),LINE_HEIGHTS=Object.freeze([1.3,1.45,1.6,1.8,2]),DEFAULT_TYPE=Object.freeze({font:"default",size:14,line:1.6,wrap:!0});export function cleanType(o={}){const e=EDITOR_FONTS.some(i=>i.id===o?.font)?o.font:DEFAULT_TYPE.font,n=Number(o?.size),s=Number(o?.line);return{font:e,size:Number.isFinite(n)&&n>=10&&n<=28?Math.round(n):DEFAULT_TYPE.size,line:Number.isFinite(s)&&s>=1.1&&s<=2.4?Math.round(s*100)/100:DEFAULT_TYPE.line,wrap:o?.wrap===void 0?DEFAULT_TYPE.wrap:o.wrap!==!1}}export const fontById=o=>EDITOR_FONTS.find(e=>e.id===o)||EDITOR_FONTS[0];export function typeVars(o){const e=cleanType(o);return{"--pe-font":fontById(e.font).stack,"--pe-size":`${e.size}px`,"--pe-line":String(e.line)}}export function fontHref(o){const e=fontById(o);return e.google?`https://fonts.googleapis.com/css2?family=${encodeURIComponent(e.google).replace(/%20/g,"+")}:wght@400;700&display=swap`:""}export const isDefaultType=o=>JSON.stringify(cleanType(o))===JSON.stringify(DEFAULT_TYPE);
|
|
1
|
+
export const EDITOR_FONTS=Object.freeze([{id:"default",label:"Fira Code (default)",kind:"mono",google:"Fira Code",stack:"'Fira Code', 'Courier New', monospace"},{id:"system-mono",label:"System monospace",kind:"mono",stack:"ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace"},{id:"jetbrains",label:"JetBrains Mono",kind:"mono",google:"JetBrains Mono",stack:"'JetBrains Mono', ui-monospace, monospace"},{id:"source-code",label:"Source Code Pro",kind:"mono",google:"Source Code Pro",stack:"'Source Code Pro', ui-monospace, monospace"},{id:"ibm-plex",label:"IBM Plex Mono",kind:"mono",google:"IBM Plex Mono",stack:"'IBM Plex Mono', ui-monospace, monospace"},{id:"roboto-mono",label:"Roboto Mono",kind:"mono",google:"Roboto Mono",stack:"'Roboto Mono', ui-monospace, monospace"},{id:"ubuntu-mono",label:"Ubuntu Mono",kind:"mono",google:"Ubuntu Mono",stack:"'Ubuntu Mono', ui-monospace, monospace"},{id:"space-mono",label:"Space Mono",kind:"mono",google:"Space Mono",stack:"'Space Mono', ui-monospace, monospace"},{id:"courier-prime",label:"Courier Prime",kind:"mono",google:"Courier Prime",stack:"'Courier Prime', 'Courier New', monospace"},{id:"system-sans",label:"System sans-serif",kind:"sans",stack:"system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif"},{id:"inter",label:"Inter",kind:"sans",google:"Inter",stack:"'Inter', system-ui, sans-serif"},{id:"poppins",label:"Poppins",kind:"sans",google:"Poppins",stack:"'Poppins', system-ui, sans-serif"},{id:"montserrat",label:"Montserrat",kind:"sans",google:"Montserrat",stack:"'Montserrat', system-ui, sans-serif"},{id:"urbanist",label:"Urbanist",kind:"sans",google:"Urbanist",stack:"'Urbanist', system-ui, sans-serif"},{id:"cera-pro",label:"Cera Pro (licensed)",kind:"sans",licensed:!0,stack:"'Cera Pro', system-ui, sans-serif"},{id:"euclid-circular-a",label:"Euclid Circular A (licensed)",kind:"sans",licensed:!0,stack:"'Euclid Circular A', system-ui, sans-serif"},{id:"serif",label:"Georgia (serif)",kind:"serif",stack:"Georgia, 'Times New Roman', serif"}]),SIZES=Object.freeze([12,13,14,15,16,17,18,20,22]),LINE_HEIGHTS=Object.freeze([1.3,1.45,1.6,1.8,2]),DEFAULT_TYPE=Object.freeze({font:"default",size:14,line:1.6,wrap:!0});export function cleanType(o={}){const e=EDITOR_FONTS.some(i=>i.id===o?.font)?o.font:DEFAULT_TYPE.font,n=Number(o?.size),s=Number(o?.line);return{font:e,size:Number.isFinite(n)&&n>=10&&n<=28?Math.round(n):DEFAULT_TYPE.size,line:Number.isFinite(s)&&s>=1.1&&s<=2.4?Math.round(s*100)/100:DEFAULT_TYPE.line,wrap:o?.wrap===void 0?DEFAULT_TYPE.wrap:o.wrap!==!1}}export const fontById=o=>EDITOR_FONTS.find(e=>e.id===o)||EDITOR_FONTS[0];export function typeVars(o){const e=cleanType(o);return{"--pe-font":fontById(e.font).stack,"--pe-size":`${e.size}px`,"--pe-line":String(e.line)}}export function fontHref(o){const e=fontById(o);return e.google?`https://fonts.googleapis.com/css2?family=${encodeURIComponent(e.google).replace(/%20/g,"+")}:wght@400;700&display=swap`:""}export const isDefaultType=o=>JSON.stringify(cleanType(o))===JSON.stringify(DEFAULT_TYPE);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{findEnclosingShortcode as j}from"./shortcode-tags.js";import{encodeMessageAttribute as x,decodeMessageAttribute as O}from"../../../public/js/celebrations/message-attrs.mjs";import{EFFECTS as k,effectsByCategory as N,effectsInjectableInto as B,getEffect as u,getEffectAttrs as g}from"./effect-defs.js";import{scribeLoop as q}from"./scribe-model.js";import{buildScribeStyle as P}from"../../../public/js/scribe-style.mjs?v=20261029-
|
|
1
|
+
import{findEnclosingShortcode as j}from"./shortcode-tags.js";import{encodeMessageAttribute as x,decodeMessageAttribute as O}from"../../../public/js/celebrations/message-attrs.mjs";import{EFFECTS as k,effectsByCategory as N,effectsInjectableInto as B,getEffect as u,getEffectAttrs as g}from"./effect-defs.js";import{scribeLoop as q}from"./scribe-model.js";import{buildScribeStyle as P}from"../../../public/js/scribe-style.mjs?v=20261029-all-cms-fonts";import{insertAtCursor as M,replaceRange as T}from"./markdown-toolbar.js";let h=null,b=null;function F(e,t,o=14){e.textContent="";const n=document.createElement("span");return n.setAttribute("data-icon",t),n.setAttribute("data-icon-size",String(o)),n.style.cssText="display:inline-flex;align-items:center;vertical-align:middle;",e.appendChild(n),I.scan(e),e}function D(e,t,o,n=14){return F(e,t,n),e.appendChild(document.createTextNode(" "+o)),e}export const EffectsBuilder={open(e){if(h)return;const t={textarea:e,activeEffect:S.get("effects-builder-last")||"reveal",scope:"standalone",host:null,editing:null,fieldValues:{}};if(t.host=G(e),t.host&&B(t.host.name).map(r=>r.name).includes(t.activeEffect)&&!(t.activeEffect in t.host.attrs)&&(t.scope="inject"),t.editing=W(e),t.editing){t.activeEffect=t.editing.name,t.scope="standalone";const c=u(t.editing.name);for(const r of g(c,t.fieldValues))if(r.name in t.editing.attrs){const l=t.editing.attrs[r.name];r.type==="number"?t.fieldValues[r.name]=Number(l):r.type==="checkbox"?t.fieldValues[r.name]=l==="true":t.fieldValues[r.name]=l}}const o=E.slideover({title:"Effects",size:"lg",position:"right",onClose:()=>{b?.destroy(),b=null,h=null}}),n=H(t,o);o.element.appendChild(n),o.open(),I.scan(n),h={state:t,slideover:o}},close(){h&&(h.slideover.close(),h=null)}};function H(e,t){const o=document.createElement("div");o.style.cssText="display:grid;grid-template-columns:170px 1fr;height:100%;min-height:520px;";const n=document.createElement("div");n.className="effects-rail",n.style.cssText="background:var(--dm-background-alt,#15152a);border-right:1px solid var(--dm-border,#2a2a40);padding:.5rem .35rem;font-size:.8rem;overflow-y:auto;";const c=document.createElement("div");c.className="effects-pane",c.style.cssText="padding:1rem;display:flex;flex-direction:column;gap:.75rem;overflow-y:auto;";function r(){Q(c,e,t)}return $(n,e,r),r(),o.appendChild(n),o.appendChild(c),o}function $(e,t,o){e.replaceChildren();for(const n of N()){const c=document.createElement("div");c.style.cssText="color:var(--dm-text-muted,#888);text-transform:uppercase;font-size:.65rem;letter-spacing:.05em;margin:.4rem .35rem .25rem;",c.textContent=n.category,e.appendChild(c);for(const r of n.effects){const l=document.createElement("button");l.type="button",l.dataset.effect=r.name,l.style.cssText="display:block;width:100%;text-align:left;padding:.3rem .5rem;border:none;background:transparent;color:var(--dm-text,#ddd);border-radius:3px;font-size:.8rem;cursor:pointer;margin-bottom:.1rem;",l.textContent=r.label,r.name===t.activeEffect&&(l.style.background="var(--dm-primary,#4338ca)",l.style.color="var(--dm-primary-text,#fff)"),l.addEventListener("click",()=>{t.activeEffect=r.name,S.set("effects-builder-last",r.name),t.fieldValues={},$(e,t,o),o()}),e.appendChild(l)}}}function K(e,t){if(e.type==="select"){const n=document.createElement("select");n.style.cssText="width:100%;padding:.35rem .5rem;background:var(--dm-input-bg,#1a1a1a);border:1px solid var(--dm-border,#333);border-radius:3px;color:var(--dm-text,#eee);font-size:.85rem;";for(const[c,r]of e.options){const l=document.createElement("option");l.value=c,l.textContent=r,n.appendChild(l)}return n.value=t??e.default??"",n}if(e.type==="checkbox"){const n=document.createElement("input");return n.type="checkbox",n.checked=t??e.default??!1,n}const o=document.createElement("input");return o.type=e.type==="number"?"number":e.type==="colour"?"color":"text",o.value=t??e.default??"",e.placeholder&&(o.placeholder=e.placeholder),e.type==="number"&&(e.min!=null&&(o.min=e.min),e.max!=null&&(o.max=e.max),e.step!=null&&(o.step=e.step)),o.style.cssText="width:100%;padding:.35rem .5rem;background:var(--dm-input-bg,#1a1a1a);border:1px solid var(--dm-border,#333);border-radius:3px;color:var(--dm-text,#eee);font-size:.85rem;",o}function w(e,t){return t.type==="checkbox"?e.checked:t.type==="number"?e.value===""?"":Number(e.value):e.value}function y(e,t,o){const n=u(t.activeEffect);if(e.replaceChildren(),n.attrs.length===0){const r=document.createElement("div");r.style.cssText="color:var(--dm-text-muted,#888);font-size:.8rem;font-style:italic;",r.textContent="This effect takes no parameters.",e.appendChild(r);return}const c=document.createElement("div");c.style.cssText="display:grid;grid-template-columns:1fr 1fr;gap:.6rem .7rem;";for(const r of g(n,t.fieldValues)){const l=document.createElement("div"),d=document.createElement("label");d.style.cssText="display:block;color:var(--dm-text-muted,#888);font-size:.7rem;text-transform:uppercase;letter-spacing:.05em;margin-bottom:.2rem;",d.textContent=r.label,l.appendChild(d);const i=K(r,t.fieldValues[r.name]);if(i.addEventListener("input",()=>{t.fieldValues[r.name]=w(i,r),o(),r.name==="theme"&&y(e,t,o)}),i.addEventListener("change",()=>{t.fieldValues[r.name]=w(i,r),o(),r.name==="theme"&&y(e,t,o)}),l.appendChild(i),r.hint){const s=document.createElement("div");s.style.cssText="color:var(--dm-text-muted,#666);font-size:.7rem;margin-top:.15rem;",s.textContent=r.hint,l.appendChild(s)}c.appendChild(l)}e.appendChild(c)}function _(e){const t={},o=/(\w[\w-]*)(?:\s*=\s*"([^"]*)"|\s*=\s*'([^']*)'|\s*=\s*(\S+))?/g;for(const n of e.matchAll(o)){const c=n[1],r=n[2]??n[3]??n[4]??"";t[c]=c==="message"?O(r):r}return t}const U=k.filter(e=>!e.selfClosing).map(e=>e.name);function W(e){const t=j(e,k.filter(c=>c.selfClosing));if(t?.selfClosing)return{name:t.name,blockStart:t.openTagStart,blockEnd:t.openTagEnd,openTagEnd:t.openTagEnd,attrs:t.attrs};const o=e.value,n=e.selectionStart;for(const c of U){const r=new RegExp(`\\[${c}([^\\]]*)\\]`,"g"),l=new RegExp(`\\[/${c}\\]`,"g"),d=[];for(const a of o.matchAll(r)){if(a.index>=n)break;d.push({type:"open",start:a.index,end:a.index+a[0].length,attrStr:a[1]})}for(const a of o.matchAll(l)){if(a.index>=n)break;d.push({type:"close",start:a.index,end:a.index+a[0].length})}d.sort((a,m)=>a.start-m.start);let i=0,s=null;for(const a of d)a.type==="open"?(i++,s=a):(i--,i<0&&(i=0,s=null));if(i>0&&s){const a=new RegExp(`\\[/${c}\\]`,"g"),m=o.slice(n),f=m.match(a);if(f){const p=n+m.indexOf(f[0]);return{name:c,blockStart:s.start,blockEnd:p+f[0].length,openTagEnd:s.end,attrs:_(s.attrStr)}}}}return null}const X=["card","box","hero","banner","col","button"];function G(e){const t=e.value,o=e.selectionStart;for(const n of X){const c=new RegExp(`\\[${n}([^\\]]*)\\]`,"g"),r=new RegExp(`\\[/${n}\\]`,"g"),l=[];for(const s of t.matchAll(c)){if(s.index>=o)break;l.push({type:"open",start:s.index,end:s.index+s[0].length,attrStr:s[1]})}for(const s of t.matchAll(r)){if(s.index>=o)break;l.push({type:"close",start:s.index,end:s.index+s[0].length})}l.sort((s,a)=>s.start-a.start);let d=0,i=null;for(const s of l)s.type==="open"?(d++,i=s):(d--,d<0&&(d=0,i=null));if(d>0&&i){const s=new RegExp(`\\[/${n}\\]`,"g"),a=t.slice(o),m=a.match(s);if(m){const f=o+a.indexOf(m[0]);return{name:n,openTagStart:i.start,openTagEnd:i.end,closeTagStart:f,closeTagEnd:f+m[0].length,attrs:_(i.attrStr)}}}}return null}function z(e,t){const o=[];for(const n of g(t,e.fieldValues)){const c=e.fieldValues[n.name];c===void 0||c===""||c===null||c===n.default&&!n.always||(n.type==="checkbox"?o.push(`${n.name}="${c?"true":"false"}"`):o.push(`${n.name}="${n.name==="message"?x(c):String(c).replace(/"/g,""")}"`))}return o.join(" ")}function A(e){const t=u(e.activeEffect),o=z(e,t),n=o?" ":"";if(e.scope==="inject"&&e.host){const c=e.host.attrs,r=t.name,l=[];for(const d of Object.keys(c)){if(d===r||d.startsWith(r+"-"))continue;const i=c[d];l.push(i===""?d:`${d}="${attr.name==="message"?x(i):String(i).replace(/"/g,""")}"`)}l.push(r);for(const d of g(t,e.fieldValues)){const i=e.fieldValues[d.name];if(i===void 0||i===""||i===null||i===d.default)continue;const s=d.type==="checkbox"?i?"true":"false":d.name==="message"?x(i):String(i).replace(/"/g,""");l.push(`${r}-${d.name}="${s}"`)}return`[${e.host.name} ${l.join(" ")}]\u2026[/${e.host.name}]`}return t.selfClosing?`[${t.name}${n}${o} /]`:`[${t.name}${n}${o}]
|
|
2
2
|
Content
|
|
3
3
|
[/${t.name}]`}function V(e,t){e.replaceChildren();const o=document.createElement("div");o.style.cssText="color:var(--dm-text-muted,#888);font-size:.7rem;text-transform:uppercase;letter-spacing:.05em;margin-bottom:.25rem;",o.textContent="Shortcode (live)",e.appendChild(o);const n=document.createElement("pre");n.style.cssText="background:var(--dm-code-bg,#000);border:1px solid var(--dm-border,#333);padding:.5rem .65rem;border-radius:3px;font-family:var(--dm-font-mono,monospace);font-size:.75rem;color:var(--dm-code-text,#7c6af7);line-height:1.5;white-space:pre-wrap;word-break:break-all;margin:0;",n.textContent=A(t),e.appendChild(n)}function J(e,t,o){if(e.replaceChildren(),t.editing)return;const n=u(t.activeEffect),c=t.host&&n.hosts.includes(t.host.name),r=document.createElement("div");r.style.cssText="background:var(--dm-background-alt,#15152a);border:1px solid var(--dm-border,#2a2a40);border-radius:4px;padding:.5rem .6rem;";const l=document.createElement("div");if(l.style.cssText="color:var(--dm-text-muted,#888);text-transform:uppercase;font-size:.65rem;letter-spacing:.05em;margin-bottom:.3rem;",l.textContent="Apply as",r.appendChild(l),!c){const s=document.createElement("div");s.style.cssText="color:var(--dm-text-muted,#888);font-size:.75rem;font-style:italic;",t.host?s.textContent=`Inserted as a standalone block (${n.label} cannot be injected into [${t.host.name}]).`:s.textContent="Inserted as a standalone block.",r.appendChild(s),e.appendChild(r),t.scope="standalone";return}const d=document.createElement("div");d.style.cssText="display:flex;gap:.3rem;";function i(s,a){const m=document.createElement("button");return m.type="button",m.style.cssText="flex:1;padding:.35rem;border:1px solid var(--dm-border,#333);border-radius:3px;font-size:.75rem;font-weight:600;cursor:pointer;",t.scope===s?(m.style.background="var(--dm-primary,#4338ca)",m.style.color="var(--dm-primary-text,#fff)",m.style.borderColor="var(--dm-primary,#4338ca)"):(m.style.background="transparent",m.style.color="var(--dm-text-muted,#bbb)"),m.textContent=a,m.addEventListener("click",()=>{t.scope=s,o()}),m}d.appendChild(i("standalone","Standalone block")),d.appendChild(i("inject",`Inject into [${t.host.name}]`)),r.appendChild(d),e.appendChild(r)}let C=0;function R(e){return e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase())}function L(e,t){e.replaceChildren();const o=u(t.activeEffect),n=document.createElement("div");n.style.cssText="display:flex;justify-content:space-between;align-items:center;margin-bottom:.25rem;";const c=document.createElement("div");if(c.style.cssText="color:var(--dm-text-muted,#888);text-transform:uppercase;font-size:.65rem;letter-spacing:.05em;",c.textContent="Live preview",n.appendChild(c),!o.previewable){const i=document.createElement("div");i.style.cssText="background:var(--dm-background-alt,#15152a);border:1px solid var(--dm-border,#2a2a40);border-radius:4px;padding:.6rem;color:var(--dm-text-muted,#888);font-size:.8rem;font-style:italic;text-align:center;",i.textContent="Runs full-page on the published site - no inline preview.",e.appendChild(i);return}const r=document.createElement("button");r.type="button",r.style.cssText="background:transparent;border:1px solid var(--dm-border,#333);color:var(--dm-text-muted,#888);font-size:.65rem;padding:.15rem .4rem;border-radius:2px;cursor:pointer;",D(r,"refresh-cw","Replay",12),n.appendChild(r),e.appendChild(n);const l=document.createElement("div");l.style.cssText="background:var(--dm-background-alt,#1a1a2e);border:1px solid var(--dm-border,#2a2a40);border-radius:4px;padding:1rem;text-align:center;min-height:80px;position:relative;overflow:hidden;",e.appendChild(l);function d(i=!1){b?.destroy(),b=null,C++;const s=C;l.replaceChildren();const a=document.createElement("div");a.style.cssText="background:linear-gradient(135deg,#6366f1,#a855f7);color:#fff;padding:.6rem;border-radius:4px;font-size:.8rem;font-weight:600;",a.textContent="Sample content",l.appendChild(a);const m=window.Domma&&window.Domma.effects;if(!m)return;const f={};for(const p of g(o,t.fieldValues)){const v=t.fieldValues[p.name];v===void 0||v===""||v===null||(f[R(p.name)]=v)}o.name==="scribe"&&(a.style.cssText+=";"+P(t.fieldValues),f.loop=q(f.loop??!1),f.actions=[{render:a.textContent,effect:f.effect||"none"}],a.textContent="");try{const p=m[R(o.name)];if(typeof p=="function"){if(s!==C)return;b=p(a,f),i&&b?.resume()}}catch(p){console.warn("Effects preview failed:",p)}}r.addEventListener("click",()=>d(!0)),d()}function Q(e,t,o){const n=u(t.activeEffect);e.replaceChildren();const c=document.createElement("h3");c.style.cssText="margin:0;font-size:1rem;color:var(--dm-text,#eee);",c.textContent=n.label,e.appendChild(c);const r=document.createElement("p");r.style.cssText="margin:0;color:var(--dm-text-muted,#999);font-size:.8rem;line-height:1.4;",r.textContent=n.description,e.appendChild(r);const l=document.createElement("div");e.appendChild(l);const d=document.createElement("div");e.appendChild(d);const i=document.createElement("div");e.appendChild(i);const s=document.createElement("div");e.appendChild(s);function a(){J(l,t,a),y(d,t,()=>{V(i,t),L(s,t)}),V(i,t),L(s,t)}a();const m=document.createElement("div");m.style.cssText="display:flex;gap:.5rem;margin-top:auto;padding-top:.75rem;border-top:1px solid var(--dm-border,#2a2a40);";const f=document.createElement("button");f.type="button",f.className="btn btn-ghost",f.textContent="Cancel",f.addEventListener("click",()=>o.close()),m.appendChild(f);const p=document.createElement("button");p.type="button",p.className="btn btn-primary",p.style.flex="2",p.textContent=t.editing?"Update":"Insert effect",p.addEventListener("click",()=>Y(t,o)),m.appendChild(p),e.appendChild(m)}function Y(e,t){const o=e.textarea,n=A(e);if(e.editing){const c=u(e.editing.name),r=o.value,l=`[/${c.name}]`.length,d=e.editing.openTagEnd,i=e.editing.blockEnd-l,s=r.substring(d,i),a=z(e,c),m=a?" ":"",f=c.selfClosing?`[${c.name}${m}${a} /]`:`[${c.name}${m}${a}]${s}[/${c.name}]`;T(o,e.editing.blockStart,e.editing.blockEnd,f);const p=c.selfClosing?e.editing.blockStart+f.length:e.editing.blockStart+f.indexOf("]")+1;o.setSelectionRange(p,p),t.close();return}if(e.scope==="inject"&&e.host){const c=u(e.activeEffect),r=e.host.attrs,l=c.name,d=[];for(const s of Object.keys(r)){if(s===l||s.startsWith(l+"-"))continue;const a=r[s];d.push(a===""?s:`${s}="${attr.name==="message"?x(a):String(a).replace(/"/g,""")}"`)}d.push(l);for(const s of g(c,e.fieldValues)){const a=e.fieldValues[s.name];if(a===void 0||a===""||a===null||a===s.default)continue;const m=s.type==="checkbox"?a?"true":"false":s.name==="message"?x(a):String(a).replace(/"/g,""");d.push(`${l}-${s.name}="${m}"`)}const i=`[${e.host.name} ${d.join(" ")}]`;T(o,e.host.openTagStart,e.host.openTagEnd,i),t.close();return}M(o,n),t.close()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{insertAtCursor as re}from"./markdown-toolbar.js";import{buildScribeStyle as ae,loadScribeFont as se}from"../../../public/js/scribe-style.mjs?v=20261013-cms-fonts";import{SCRIBE_FIELDS as ce,scribeDefaults as ie,scribeLoop as le,stateToScribeActions as de,buildScribeShortcode as pe}from"./scribe-model.js";const me=20,Q={render:{label:"Render",icon:"edit-3",color:"var(--dm-info,#3b82f6)"},wait:{label:"Wait",icon:"clock",color:"var(--dm-warning,#f59e0b)"},undo:{label:"Undo",icon:"corner-up-left",color:"var(--dm-secondary,#a855f7)"},redraw:{label:"Redraw",icon:"refresh-cw",color:"var(--dm-success,#22c55e)"}},T="padding:.4rem .6rem;background:var(--dm-input-bg,#1a1a1a);border:1px solid var(--dm-border,#333);border-radius:4px;color:var(--dm-text,#eee);font-size:.9em;box-sizing:border-box;width:100%;",ue="display:block;font-size:.7rem;font-weight:600;color:var(--dm-text-muted,#aaa);text-transform:uppercase;letter-spacing:.05em;margin-bottom:.25rem;",he="display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.85em;";export function openScribeComposer(s){const r=fe(),n=[];let t=null,p=null;function i(){clearTimeout(t),p?.destroy(),p=null}const h=E.slideover({title:"Scribe Composer",size:"lg",position:"right",onClose:i});ke();const b=document.createElement("div");b.className="scribe-composer",b.style.cssText="display:flex;flex-direction:column;height:100%;";const y=document.createElement("div");y.style.cssText="padding:1rem 1.25rem;border-bottom:1px solid var(--dm-border,#333);background:var(--dm-background-alt,#0f0f17);";const k=document.createElement("div");k.style.cssText="min-height:3.5rem;padding:.85rem 1rem;background:var(--dm-surface,#1a1a1a);border:1px dashed var(--dm-border,#333);border-radius:6px;font-size:1.25rem;line-height:1.5;overflow-wrap:normal;word-break:normal;",y.appendChild(k);const B=document.createElement("div");B.style.cssText="display:flex;gap:.5rem;margin-top:.75rem;align-items:center;";const K=V("rotate-cw","Replay"),Y=V("code","Show code"),N=document.createElement("span");N.style.cssText="font-size:.8em;color:var(--dm-text-muted,#aaa);flex:1;text-align:right;margin-right:.5rem;",B.appendChild(K),B.appendChild(N),B.appendChild(Y),y.appendChild(B);const M=document.createElement("pre");M.style.cssText="display:none;margin:.75rem 0 0;padding:.6rem .75rem;background:var(--dm-surface,#0a0a0a);border:1px solid var(--dm-border,#333);border-radius:4px;font-family:monospace;font-size:.78em;white-space:pre-wrap;word-break:break-all;color:var(--dm-text-muted,#bbb);max-height:200px;overflow:auto;",y.appendChild(M),Y.addEventListener("click",()=>{const e=M.style.display!=="none";M.style.display=e?"none":"block"}),K.addEventListener("click",()=>{J(),p?.resume(),p&&(N.textContent="Playing preview")}),b.appendChild(y);const R=document.createElement("div");R.style.cssText="display:flex;flex:1;min-height:0;overflow:hidden;";const q=xe(r,()=>{C(),x()});R.appendChild(q.el);const z=document.createElement("main");z.style.cssText="flex:1;overflow-y:auto;padding:1rem 1.25rem;display:flex;flex-direction:column;";const D=document.createElement("h4");D.textContent="Actions",D.style.cssText="margin:0 0 .75rem;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--dm-text-muted,#aaa);",z.appendChild(D);const A=document.createElement("div");A.style.cssText="display:flex;flex-direction:column;gap:.6rem;",z.appendChild(A);const P=document.createElement("div");P.style.cssText="display:flex;gap:.4rem;margin-top:.9rem;flex-wrap:wrap;",Object.entries(Q).forEach(([e,a])=>{const c=document.createElement("button");c.type="button",c.style.cssText=`padding:.4rem .8rem;background:transparent;border:1px dashed color-mix(in srgb, ${a.color} 40%, transparent);border-radius:4px;color:${a.color};cursor:pointer;font-size:.85em;display:inline-flex;align-items:center;gap:.35rem;`;const l=document.createElement("span");l.setAttribute("data-icon",a.icon),c.appendChild(l),c.appendChild(document.createTextNode(` + ${a.label}`)),c.addEventListener("click",()=>{C(),r.actions.push(be(e)),$(),x()}),P.appendChild(c)}),z.appendChild(P),R.appendChild(z),b.appendChild(R);const L=document.createElement("div");L.style.cssText="display:flex;padding:.75rem 1rem;border-top:1px solid var(--dm-border,#333);background:var(--dm-background-alt,#0f0f17);gap:.5rem;align-items:center;";const S=document.createElement("button");S.type="button",S.className="btn btn-ghost btn-sm",S.textContent="Undo (Ctrl+Z)",S.addEventListener("click",()=>H()),L.appendChild(S);const U=document.createElement("span");U.style.cssText="font-size:.75em;color:var(--dm-text-muted,#aaa);",L.appendChild(U);const G=document.createElement("div");G.style.flex="1",L.appendChild(G);const W=document.createElement("button");W.type="button",W.className="btn btn-ghost",W.textContent="Cancel",W.addEventListener("click",()=>h.close()),L.appendChild(W);const j=document.createElement("button");j.type="button",j.className="btn btn-primary",j.textContent="Insert Scribe",j.addEventListener("click",()=>{re(s,Z()),h.close()}),L.appendChild(j),b.appendChild(L),h.setContent(b),b.addEventListener("keydown",e=>{const a=(e.key||"").toLowerCase();(e.ctrlKey||e.metaKey)&&a==="z"&&!e.shiftKey&&n.length>0&&(e.preventDefault(),e.stopPropagation(),H())}),$(),x(),O(),requestAnimationFrame(()=>{Domma.icons.scan()}),h.open();function C(){n.push(JSON.stringify(r)),n.length>me&&n.shift(),O()}function H(){if(n.length===0){E.toast("Nothing to undo",{type:"info",duration:700});return}const e=JSON.parse(n.pop());Object.assign(r.globals,e.globals),r.actions.length=0,e.actions.forEach(a=>r.actions.push(a)),q.sync(),$(),x(),O(),E.toast("Undone",{type:"info",duration:500})}function O(){U.textContent=n.length===0?"":`${n.length} step${n.length===1?"":"s"} stored`,S.disabled=n.length===0,S.style.opacity=n.length===0?".4":"1"}function x(e=150){clearTimeout(t),t=setTimeout(J,e)}function J(){i(),ee(k),k.style.color="",k.style.fontStyle="",M.textContent=Z();const e=r.actions.filter(o=>o.type==="render"||o.type==="redraw"?(o.text||"").length>0:!0);if(e.length===0){k.textContent="(add an action to preview)",k.style.color="var(--dm-text-muted,#666)",k.style.fontStyle="italic",N.textContent="";return}const a=document.createElement("span");a.className="dm-fx-scribe",k.appendChild(a);const c=r.globals;se(c.font),a.style.cssText=ae(c);const{effect:l,controls:g,...w}=c;w.actions=de(e,l);try{p=Domma.effects.scribe(a,w),N.textContent=c.autoStart?`${e.length} action${e.length===1?"":"s"}`:"Press Replay to start"}catch{N.textContent="Preview error"}}function $(){if(ee(A),r.actions.length===0){const e=document.createElement("p");e.textContent="No actions yet - add one from the buttons below.",e.style.cssText="font-size:.85em;color:var(--dm-text-muted,#888);font-style:italic;margin:.5rem 0;",A.appendChild(e);return}r.actions.forEach((e,a)=>{A.appendChild(ne(e,a))}),requestAnimationFrame(()=>Domma.icons.scan())}function ne(e,a){const c=Q[e.type],l=document.createElement("div");l.style.cssText=`border:1px solid var(--dm-border,#333);border-left:3px solid ${c.color};border-radius:4px;padding:.6rem .75rem;background:var(--dm-surface,#15151a);`;const g=document.createElement("div");g.style.cssText="display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem;";const w=document.createElement("span");w.style.cssText=`display:inline-flex;align-items:center;gap:.3rem;font-size:.72rem;font-weight:700;color:${c.color};text-transform:uppercase;letter-spacing:.06em;`;const o=document.createElement("span");o.setAttribute("data-icon",c.icon),w.appendChild(o),w.appendChild(document.createTextNode(c.label)),g.appendChild(w);const u=document.createElement("span");u.textContent=`#${a+1}`,u.style.cssText="font-size:.7rem;color:var(--dm-text-muted,#888);",g.appendChild(u);const m=document.createElement("div");m.style.flex="1",g.appendChild(m);const d=F("chevron-up","Move up");a===0&&(d.disabled=!0,d.style.opacity=".3"),d.addEventListener("click",()=>X(a,-1)),g.appendChild(d);const f=F("chevron-down","Move down");a===r.actions.length-1&&(f.disabled=!0,f.style.opacity=".3"),f.addEventListener("click",()=>X(a,1)),g.appendChild(f);const v=F("x","Remove");return v.addEventListener("click",()=>{C(),r.actions.splice(a,1),$(),x()}),g.appendChild(v),l.appendChild(g),l.appendChild(oe(e)),l}function X(e,a){const c=e+a;if(c<0||c>=r.actions.length)return;C();const[l]=r.actions.splice(e,1);r.actions.splice(c,0,l),$(),x()}function oe(e){const a=document.createElement("div");if(a.style.cssText="display:flex;flex-direction:column;gap:.5rem;",e.type==="render"||e.type==="redraw"){const o=document.createElement("textarea");o.value=e.text||"",o.placeholder=e.type==="redraw"?"New text - clears everything first, then types this":"Text to type out",o.rows=2,o.style.cssText=T+"resize:vertical;font-family:inherit;min-height:2.2rem;";let u=o.value;o.addEventListener("input",()=>{e.text=o.value,x()}),o.addEventListener("blur",()=>{o.value!==u&&(C(),u=o.value)}),a.appendChild(o);const m=document.createElement("div");m.style.cssText="display:flex;align-items:center;gap:.5rem;font-size:.8em;";const d=document.createElement("label");d.textContent="Effect:",d.style.color="var(--dm-text-muted,#aaa)";const f=document.createElement("select");return f.style.cssText=T+"width:auto;padding:.25rem .4rem;",["inherit","none","fade","bounce","glow"].forEach(v=>{const _=document.createElement("option");_.value=v,_.textContent=v==="inherit"?"Default effect":v.charAt(0).toUpperCase()+v.slice(1),f.appendChild(_)}),f.value=e.effect||"none",f.addEventListener("change",()=>{C(),e.effect=f.value,x()}),m.appendChild(d),m.appendChild(f),a.appendChild(m),a}if(e.type==="wait"){const o=document.createElement("div");o.style.cssText="display:flex;gap:.4rem;align-items:center;";const u=document.createElement("input");u.type="number",u.min="0",u.step="any",u.value=String(e.duration??1e3),u.style.cssText=T+"flex:1;",u.addEventListener("input",()=>{const d=Number(u.value);!Number.isNaN(d)&&d>=0&&(e.duration=d,x())}),u.addEventListener("blur",()=>C()),o.appendChild(u);const m=document.createElement("select");return m.style.cssText=T+"width:auto;",[["ms","ms"],["s","seconds"]].forEach(([d,f])=>{const v=document.createElement("option");v.value=d,v.textContent=f,m.appendChild(v)}),m.value=e.unit||"ms",m.addEventListener("change",()=>{C(),e.unit=m.value,x()}),o.appendChild(m),a.appendChild(o),a}const c=document.createElement("div");c.style.cssText="display:flex;gap:.75rem;align-items:center;flex-wrap:wrap;font-size:.85em;";const l=document.createElement("input");l.type="number",l.min="1",l.value=String(e.count||5),l.style.cssText=T+"width:5rem;",l.addEventListener("input",()=>{const o=parseInt(l.value,10);!Number.isNaN(o)&&o>0&&(e.count=o,x())}),l.addEventListener("blur",()=>C());const g=`undo-mode-${Math.random().toString(36).slice(2)}`;return[["last","Last render"],["all","All text"],["count","Exactly N units"]].forEach(([o,u])=>{const m=document.createElement("label");m.style.cssText="display:inline-flex;align-items:center;gap:.3rem;cursor:pointer;";const d=document.createElement("input");d.type="radio",d.name=g,d.value=o,d.checked=(e.mode||"last")===o,d.addEventListener("change",()=>{d.checked&&(C(),e.mode=o,l.style.display=o==="count"?"":"none",x())}),m.appendChild(d),m.appendChild(document.createTextNode(u)),c.appendChild(m),o==="count"&&(c.appendChild(l),l.style.display=(e.mode||"last")==="count"?"":"none")}),a.appendChild(c),a}function Z(){return pe(r.globals,r.actions)}}function fe(){return{globals:ie(),actions:[{type:"render",text:"We build things that matter.",effect:"inherit"},{type:"wait",duration:1500,unit:"ms"},{type:"redraw",text:"We create solutions that last.",effect:"inherit"},{type:"wait",duration:1500,unit:"ms"}]}}function be(s){switch(s){case"render":return{type:"render",text:"",effect:"inherit"};case"wait":return{type:"wait",duration:1e3,unit:"ms"};case"undo":return{type:"undo",mode:"last",count:5};case"redraw":return{type:"redraw",text:"",effect:"inherit"}}return{type:"render",text:"",effect:"inherit"}}function xe(s,r){const n=document.createElement("aside");n.style.cssText="width:240px;flex-shrink:0;padding:1rem 1.25rem;border-right:1px solid var(--dm-border,#333);overflow-y:auto;display:flex;flex-direction:column;gap:.75rem;background:var(--dm-background-alt,#0c0c12);";const t=document.createElement("h4");t.textContent="Global settings",t.style.cssText="margin:0 0 .25rem;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--dm-text-muted,#aaa);",n.appendChild(t);const p=ce.map(i=>{const h=y=>{r(),s.globals[i.key]=i.key==="loop"?le(y):y};let b;if(i.type==="checkbox"){const y=Ee(s.globals[i.key],h,i.label);n.appendChild(y.wrap),b=y.input}else b=i.type==="select"?Ce(i.options,s.globals[i.key],h):i.type==="number"?ge(s.globals[i.key],h,i.min):ve(s.globals[i.key],"",h),n.appendChild(ye(i.label,b));return{field:i,input:b}});return{el:n,sync(){p.forEach(({field:i,input:h})=>{i.type==="checkbox"?h.checked=s.globals[i.key]:h.value=String(s.globals[i.key])})}}}function ye(s,r){const n=document.createElement("div"),t=document.createElement("label");return t.style.cssText=ue,t.textContent=s,n.appendChild(t),n.appendChild(r),n}function ge(s,r,n=1){const t=document.createElement("input");return t.type="number",t.min=String(n),t.value=String(s),t.style.cssText=T,t.addEventListener("input",()=>{const p=Number(t.value);!Number.isNaN(p)&&p>=n&&r(p)}),t}function ve(s,r,n){const t=document.createElement("input");return t.type="text",t.value=s,t.placeholder=r,t.style.cssText=T,t.addEventListener("input",()=>n(t.value)),t}function Ce(s,r,n){const t=document.createElement("select");return t.style.cssText=T,s.forEach(([p,i])=>{const h=document.createElement("option");h.value=p,h.textContent=i,t.appendChild(h)}),t.value=r,t.addEventListener("change",()=>n(t.value)),t}function Ee(s,r,n){const t=document.createElement("label");t.style.cssText=he;const p=document.createElement("input");return p.type="checkbox",p.checked=s,p.addEventListener("change",()=>r(p.checked)),t.appendChild(p),t.appendChild(document.createTextNode(n)),{wrap:t,input:p}}function V(s,r){const n=document.createElement("button");n.type="button",n.className="btn btn-ghost btn-sm",n.style.cssText="display:inline-flex;align-items:center;gap:.35rem;";const t=document.createElement("span");return t.setAttribute("data-icon",s),n.appendChild(t),n.appendChild(document.createTextNode(r)),n}function F(s,r){const n=document.createElement("button");n.type="button",n.title=r,n.style.cssText="padding:.25rem .4rem;background:transparent;border:1px solid var(--dm-border,#333);border-radius:3px;color:var(--dm-text-muted,#aaa);cursor:pointer;display:inline-flex;align-items:center;";const t=document.createElement("span");return t.setAttribute("data-icon",s),n.appendChild(t),n}function ee(s){for(;s.firstChild;)s.removeChild(s.firstChild)}function Se(s){return String(s).replace(/&/g,"&").replace(/"/g,""")}let te=!1;function ke(){te||(te=!0,I.register("edit-3",{viewBox:"0 0 24 24",paths:["M12 20h9","M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("clock",{viewBox:"0 0 24 24",paths:["M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z","M12 6v6l4 2"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("corner-up-left",{viewBox:"0 0 24 24",paths:["M9 14 4 9l5-5","M20 20v-7a4 4 0 0 0-4-4H4"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("refresh-cw",{viewBox:"0 0 24 24",paths:["M23 4v6h-6","M1 20v-6h6","M3.51 9a9 9 0 0 1 14.85-3.36L23 10","M20.49 15a9 9 0 0 1-14.85 3.36L1 14"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("rotate-cw",{viewBox:"0 0 24 24",paths:["M23 4v6h-6","M20.49 15a9 9 0 1 1-2.12-9.36L23 10"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("code",{viewBox:"0 0 24 24",paths:["M16 18l6-6-6-6","M8 6l-6 6 6 6"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("chevron-up",{viewBox:"0 0 24 24",path:"M18 15l-6-6-6 6",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("chevron-down",{viewBox:"0 0 24 24",path:"M6 9l6 6 6-6",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("x",{viewBox:"0 0 24 24",paths:["M18 6L6 18","M6 6l12 12"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}))}
|
|
1
|
+
import{insertAtCursor as re}from"./markdown-toolbar.js";import{buildScribeStyle as ae,loadScribeFont as se}from"../../../public/js/scribe-style.mjs?v=20261029-all-cms-fonts";import{SCRIBE_FIELDS as ce,scribeDefaults as ie,scribeLoop as le,stateToScribeActions as de,buildScribeShortcode as pe}from"./scribe-model.js";const me=20,Q={render:{label:"Render",icon:"edit-3",color:"var(--dm-info,#3b82f6)"},wait:{label:"Wait",icon:"clock",color:"var(--dm-warning,#f59e0b)"},undo:{label:"Undo",icon:"corner-up-left",color:"var(--dm-secondary,#a855f7)"},redraw:{label:"Redraw",icon:"refresh-cw",color:"var(--dm-success,#22c55e)"}},T="padding:.4rem .6rem;background:var(--dm-input-bg,#1a1a1a);border:1px solid var(--dm-border,#333);border-radius:4px;color:var(--dm-text,#eee);font-size:.9em;box-sizing:border-box;width:100%;",ue="display:block;font-size:.7rem;font-weight:600;color:var(--dm-text-muted,#aaa);text-transform:uppercase;letter-spacing:.05em;margin-bottom:.25rem;",he="display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.85em;";export function openScribeComposer(s){const r=fe(),n=[];let t=null,p=null;function i(){clearTimeout(t),p?.destroy(),p=null}const h=E.slideover({title:"Scribe Composer",size:"lg",position:"right",onClose:i});ke();const b=document.createElement("div");b.className="scribe-composer",b.style.cssText="display:flex;flex-direction:column;height:100%;";const y=document.createElement("div");y.style.cssText="padding:1rem 1.25rem;border-bottom:1px solid var(--dm-border,#333);background:var(--dm-background-alt,#0f0f17);";const k=document.createElement("div");k.style.cssText="min-height:3.5rem;padding:.85rem 1rem;background:var(--dm-surface,#1a1a1a);border:1px dashed var(--dm-border,#333);border-radius:6px;font-size:1.25rem;line-height:1.5;overflow-wrap:normal;word-break:normal;",y.appendChild(k);const B=document.createElement("div");B.style.cssText="display:flex;gap:.5rem;margin-top:.75rem;align-items:center;";const K=V("rotate-cw","Replay"),Y=V("code","Show code"),N=document.createElement("span");N.style.cssText="font-size:.8em;color:var(--dm-text-muted,#aaa);flex:1;text-align:right;margin-right:.5rem;",B.appendChild(K),B.appendChild(N),B.appendChild(Y),y.appendChild(B);const M=document.createElement("pre");M.style.cssText="display:none;margin:.75rem 0 0;padding:.6rem .75rem;background:var(--dm-surface,#0a0a0a);border:1px solid var(--dm-border,#333);border-radius:4px;font-family:monospace;font-size:.78em;white-space:pre-wrap;word-break:break-all;color:var(--dm-text-muted,#bbb);max-height:200px;overflow:auto;",y.appendChild(M),Y.addEventListener("click",()=>{const e=M.style.display!=="none";M.style.display=e?"none":"block"}),K.addEventListener("click",()=>{J(),p?.resume(),p&&(N.textContent="Playing preview")}),b.appendChild(y);const R=document.createElement("div");R.style.cssText="display:flex;flex:1;min-height:0;overflow:hidden;";const q=xe(r,()=>{C(),x()});R.appendChild(q.el);const z=document.createElement("main");z.style.cssText="flex:1;overflow-y:auto;padding:1rem 1.25rem;display:flex;flex-direction:column;";const D=document.createElement("h4");D.textContent="Actions",D.style.cssText="margin:0 0 .75rem;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--dm-text-muted,#aaa);",z.appendChild(D);const A=document.createElement("div");A.style.cssText="display:flex;flex-direction:column;gap:.6rem;",z.appendChild(A);const P=document.createElement("div");P.style.cssText="display:flex;gap:.4rem;margin-top:.9rem;flex-wrap:wrap;",Object.entries(Q).forEach(([e,a])=>{const c=document.createElement("button");c.type="button",c.style.cssText=`padding:.4rem .8rem;background:transparent;border:1px dashed color-mix(in srgb, ${a.color} 40%, transparent);border-radius:4px;color:${a.color};cursor:pointer;font-size:.85em;display:inline-flex;align-items:center;gap:.35rem;`;const l=document.createElement("span");l.setAttribute("data-icon",a.icon),c.appendChild(l),c.appendChild(document.createTextNode(` + ${a.label}`)),c.addEventListener("click",()=>{C(),r.actions.push(be(e)),$(),x()}),P.appendChild(c)}),z.appendChild(P),R.appendChild(z),b.appendChild(R);const L=document.createElement("div");L.style.cssText="display:flex;padding:.75rem 1rem;border-top:1px solid var(--dm-border,#333);background:var(--dm-background-alt,#0f0f17);gap:.5rem;align-items:center;";const S=document.createElement("button");S.type="button",S.className="btn btn-ghost btn-sm",S.textContent="Undo (Ctrl+Z)",S.addEventListener("click",()=>H()),L.appendChild(S);const U=document.createElement("span");U.style.cssText="font-size:.75em;color:var(--dm-text-muted,#aaa);",L.appendChild(U);const G=document.createElement("div");G.style.flex="1",L.appendChild(G);const W=document.createElement("button");W.type="button",W.className="btn btn-ghost",W.textContent="Cancel",W.addEventListener("click",()=>h.close()),L.appendChild(W);const j=document.createElement("button");j.type="button",j.className="btn btn-primary",j.textContent="Insert Scribe",j.addEventListener("click",()=>{re(s,Z()),h.close()}),L.appendChild(j),b.appendChild(L),h.setContent(b),b.addEventListener("keydown",e=>{const a=(e.key||"").toLowerCase();(e.ctrlKey||e.metaKey)&&a==="z"&&!e.shiftKey&&n.length>0&&(e.preventDefault(),e.stopPropagation(),H())}),$(),x(),O(),requestAnimationFrame(()=>{Domma.icons.scan()}),h.open();function C(){n.push(JSON.stringify(r)),n.length>me&&n.shift(),O()}function H(){if(n.length===0){E.toast("Nothing to undo",{type:"info",duration:700});return}const e=JSON.parse(n.pop());Object.assign(r.globals,e.globals),r.actions.length=0,e.actions.forEach(a=>r.actions.push(a)),q.sync(),$(),x(),O(),E.toast("Undone",{type:"info",duration:500})}function O(){U.textContent=n.length===0?"":`${n.length} step${n.length===1?"":"s"} stored`,S.disabled=n.length===0,S.style.opacity=n.length===0?".4":"1"}function x(e=150){clearTimeout(t),t=setTimeout(J,e)}function J(){i(),ee(k),k.style.color="",k.style.fontStyle="",M.textContent=Z();const e=r.actions.filter(o=>o.type==="render"||o.type==="redraw"?(o.text||"").length>0:!0);if(e.length===0){k.textContent="(add an action to preview)",k.style.color="var(--dm-text-muted,#666)",k.style.fontStyle="italic",N.textContent="";return}const a=document.createElement("span");a.className="dm-fx-scribe",k.appendChild(a);const c=r.globals;se(c.font),a.style.cssText=ae(c);const{effect:l,controls:g,...w}=c;w.actions=de(e,l);try{p=Domma.effects.scribe(a,w),N.textContent=c.autoStart?`${e.length} action${e.length===1?"":"s"}`:"Press Replay to start"}catch{N.textContent="Preview error"}}function $(){if(ee(A),r.actions.length===0){const e=document.createElement("p");e.textContent="No actions yet - add one from the buttons below.",e.style.cssText="font-size:.85em;color:var(--dm-text-muted,#888);font-style:italic;margin:.5rem 0;",A.appendChild(e);return}r.actions.forEach((e,a)=>{A.appendChild(ne(e,a))}),requestAnimationFrame(()=>Domma.icons.scan())}function ne(e,a){const c=Q[e.type],l=document.createElement("div");l.style.cssText=`border:1px solid var(--dm-border,#333);border-left:3px solid ${c.color};border-radius:4px;padding:.6rem .75rem;background:var(--dm-surface,#15151a);`;const g=document.createElement("div");g.style.cssText="display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem;";const w=document.createElement("span");w.style.cssText=`display:inline-flex;align-items:center;gap:.3rem;font-size:.72rem;font-weight:700;color:${c.color};text-transform:uppercase;letter-spacing:.06em;`;const o=document.createElement("span");o.setAttribute("data-icon",c.icon),w.appendChild(o),w.appendChild(document.createTextNode(c.label)),g.appendChild(w);const u=document.createElement("span");u.textContent=`#${a+1}`,u.style.cssText="font-size:.7rem;color:var(--dm-text-muted,#888);",g.appendChild(u);const m=document.createElement("div");m.style.flex="1",g.appendChild(m);const d=F("chevron-up","Move up");a===0&&(d.disabled=!0,d.style.opacity=".3"),d.addEventListener("click",()=>X(a,-1)),g.appendChild(d);const f=F("chevron-down","Move down");a===r.actions.length-1&&(f.disabled=!0,f.style.opacity=".3"),f.addEventListener("click",()=>X(a,1)),g.appendChild(f);const v=F("x","Remove");return v.addEventListener("click",()=>{C(),r.actions.splice(a,1),$(),x()}),g.appendChild(v),l.appendChild(g),l.appendChild(oe(e)),l}function X(e,a){const c=e+a;if(c<0||c>=r.actions.length)return;C();const[l]=r.actions.splice(e,1);r.actions.splice(c,0,l),$(),x()}function oe(e){const a=document.createElement("div");if(a.style.cssText="display:flex;flex-direction:column;gap:.5rem;",e.type==="render"||e.type==="redraw"){const o=document.createElement("textarea");o.value=e.text||"",o.placeholder=e.type==="redraw"?"New text - clears everything first, then types this":"Text to type out",o.rows=2,o.style.cssText=T+"resize:vertical;font-family:inherit;min-height:2.2rem;";let u=o.value;o.addEventListener("input",()=>{e.text=o.value,x()}),o.addEventListener("blur",()=>{o.value!==u&&(C(),u=o.value)}),a.appendChild(o);const m=document.createElement("div");m.style.cssText="display:flex;align-items:center;gap:.5rem;font-size:.8em;";const d=document.createElement("label");d.textContent="Effect:",d.style.color="var(--dm-text-muted,#aaa)";const f=document.createElement("select");return f.style.cssText=T+"width:auto;padding:.25rem .4rem;",["inherit","none","fade","bounce","glow"].forEach(v=>{const _=document.createElement("option");_.value=v,_.textContent=v==="inherit"?"Default effect":v.charAt(0).toUpperCase()+v.slice(1),f.appendChild(_)}),f.value=e.effect||"none",f.addEventListener("change",()=>{C(),e.effect=f.value,x()}),m.appendChild(d),m.appendChild(f),a.appendChild(m),a}if(e.type==="wait"){const o=document.createElement("div");o.style.cssText="display:flex;gap:.4rem;align-items:center;";const u=document.createElement("input");u.type="number",u.min="0",u.step="any",u.value=String(e.duration??1e3),u.style.cssText=T+"flex:1;",u.addEventListener("input",()=>{const d=Number(u.value);!Number.isNaN(d)&&d>=0&&(e.duration=d,x())}),u.addEventListener("blur",()=>C()),o.appendChild(u);const m=document.createElement("select");return m.style.cssText=T+"width:auto;",[["ms","ms"],["s","seconds"]].forEach(([d,f])=>{const v=document.createElement("option");v.value=d,v.textContent=f,m.appendChild(v)}),m.value=e.unit||"ms",m.addEventListener("change",()=>{C(),e.unit=m.value,x()}),o.appendChild(m),a.appendChild(o),a}const c=document.createElement("div");c.style.cssText="display:flex;gap:.75rem;align-items:center;flex-wrap:wrap;font-size:.85em;";const l=document.createElement("input");l.type="number",l.min="1",l.value=String(e.count||5),l.style.cssText=T+"width:5rem;",l.addEventListener("input",()=>{const o=parseInt(l.value,10);!Number.isNaN(o)&&o>0&&(e.count=o,x())}),l.addEventListener("blur",()=>C());const g=`undo-mode-${Math.random().toString(36).slice(2)}`;return[["last","Last render"],["all","All text"],["count","Exactly N units"]].forEach(([o,u])=>{const m=document.createElement("label");m.style.cssText="display:inline-flex;align-items:center;gap:.3rem;cursor:pointer;";const d=document.createElement("input");d.type="radio",d.name=g,d.value=o,d.checked=(e.mode||"last")===o,d.addEventListener("change",()=>{d.checked&&(C(),e.mode=o,l.style.display=o==="count"?"":"none",x())}),m.appendChild(d),m.appendChild(document.createTextNode(u)),c.appendChild(m),o==="count"&&(c.appendChild(l),l.style.display=(e.mode||"last")==="count"?"":"none")}),a.appendChild(c),a}function Z(){return pe(r.globals,r.actions)}}function fe(){return{globals:ie(),actions:[{type:"render",text:"We build things that matter.",effect:"inherit"},{type:"wait",duration:1500,unit:"ms"},{type:"redraw",text:"We create solutions that last.",effect:"inherit"},{type:"wait",duration:1500,unit:"ms"}]}}function be(s){switch(s){case"render":return{type:"render",text:"",effect:"inherit"};case"wait":return{type:"wait",duration:1e3,unit:"ms"};case"undo":return{type:"undo",mode:"last",count:5};case"redraw":return{type:"redraw",text:"",effect:"inherit"}}return{type:"render",text:"",effect:"inherit"}}function xe(s,r){const n=document.createElement("aside");n.style.cssText="width:240px;flex-shrink:0;padding:1rem 1.25rem;border-right:1px solid var(--dm-border,#333);overflow-y:auto;display:flex;flex-direction:column;gap:.75rem;background:var(--dm-background-alt,#0c0c12);";const t=document.createElement("h4");t.textContent="Global settings",t.style.cssText="margin:0 0 .25rem;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--dm-text-muted,#aaa);",n.appendChild(t);const p=ce.map(i=>{const h=y=>{r(),s.globals[i.key]=i.key==="loop"?le(y):y};let b;if(i.type==="checkbox"){const y=Ee(s.globals[i.key],h,i.label);n.appendChild(y.wrap),b=y.input}else b=i.type==="select"?Ce(i.options,s.globals[i.key],h):i.type==="number"?ge(s.globals[i.key],h,i.min):ve(s.globals[i.key],"",h),n.appendChild(ye(i.label,b));return{field:i,input:b}});return{el:n,sync(){p.forEach(({field:i,input:h})=>{i.type==="checkbox"?h.checked=s.globals[i.key]:h.value=String(s.globals[i.key])})}}}function ye(s,r){const n=document.createElement("div"),t=document.createElement("label");return t.style.cssText=ue,t.textContent=s,n.appendChild(t),n.appendChild(r),n}function ge(s,r,n=1){const t=document.createElement("input");return t.type="number",t.min=String(n),t.value=String(s),t.style.cssText=T,t.addEventListener("input",()=>{const p=Number(t.value);!Number.isNaN(p)&&p>=n&&r(p)}),t}function ve(s,r,n){const t=document.createElement("input");return t.type="text",t.value=s,t.placeholder=r,t.style.cssText=T,t.addEventListener("input",()=>n(t.value)),t}function Ce(s,r,n){const t=document.createElement("select");return t.style.cssText=T,s.forEach(([p,i])=>{const h=document.createElement("option");h.value=p,h.textContent=i,t.appendChild(h)}),t.value=r,t.addEventListener("change",()=>n(t.value)),t}function Ee(s,r,n){const t=document.createElement("label");t.style.cssText=he;const p=document.createElement("input");return p.type="checkbox",p.checked=s,p.addEventListener("change",()=>r(p.checked)),t.appendChild(p),t.appendChild(document.createTextNode(n)),{wrap:t,input:p}}function V(s,r){const n=document.createElement("button");n.type="button",n.className="btn btn-ghost btn-sm",n.style.cssText="display:inline-flex;align-items:center;gap:.35rem;";const t=document.createElement("span");return t.setAttribute("data-icon",s),n.appendChild(t),n.appendChild(document.createTextNode(r)),n}function F(s,r){const n=document.createElement("button");n.type="button",n.title=r,n.style.cssText="padding:.25rem .4rem;background:transparent;border:1px solid var(--dm-border,#333);border-radius:3px;color:var(--dm-text-muted,#aaa);cursor:pointer;display:inline-flex;align-items:center;";const t=document.createElement("span");return t.setAttribute("data-icon",s),n.appendChild(t),n}function ee(s){for(;s.firstChild;)s.removeChild(s.firstChild)}function Se(s){return String(s).replace(/&/g,"&").replace(/"/g,""")}let te=!1;function ke(){te||(te=!0,I.register("edit-3",{viewBox:"0 0 24 24",paths:["M12 20h9","M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("clock",{viewBox:"0 0 24 24",paths:["M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z","M12 6v6l4 2"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("corner-up-left",{viewBox:"0 0 24 24",paths:["M9 14 4 9l5-5","M20 20v-7a4 4 0 0 0-4-4H4"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("refresh-cw",{viewBox:"0 0 24 24",paths:["M23 4v6h-6","M1 20v-6h6","M3.51 9a9 9 0 0 1 14.85-3.36L23 10","M20.49 15a9 9 0 0 1-14.85 3.36L1 14"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("rotate-cw",{viewBox:"0 0 24 24",paths:["M23 4v6h-6","M20.49 15a9 9 0 1 1-2.12-9.36L23 10"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("code",{viewBox:"0 0 24 24",paths:["M16 18l6-6-6-6","M8 6l-6 6 6 6"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("chevron-up",{viewBox:"0 0 24 24",path:"M18 15l-6-6-6 6",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("chevron-down",{viewBox:"0 0 24 24",path:"M6 9l6 6 6-6",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("x",{viewBox:"0 0 24 24",paths:["M18 6L6 18","M6 6l12 12"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}))}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{SCRIBE_STYLE_FIELDS as u}from"../../../public/js/scribe-style.mjs?v=20261029-
|
|
1
|
+
import{SCRIBE_STYLE_FIELDS as u}from"../../../public/js/scribe-style.mjs?v=20261029-all-cms-fonts";import{SHORTCODE_EXPIRY_FIELDS as a}from"../../../public/js/shortcode-expiry.mjs";export const SCRIBE_FIELDS=[...u,{name:"mode",key:"mode",label:"Render mode",type:"select",default:"typewriter",options:[["typewriter","Characters"],["word","Words"],["sentence","Sentences"]]},{name:"effect",key:"effect",label:"Default entrance effect",type:"select",default:"none",options:["none","fade","bounce","glow"].map(e=>[e,e])},{name:"speed",key:"speed",label:"Typing speed (ms/unit)",type:"number",default:50,min:0},{name:"delete-speed",key:"deleteSpeed",label:"Delete speed (ms/unit)",type:"number",default:30,min:0},{name:"cursor",key:"cursor",label:"Show cursor",type:"checkbox",default:!0},{name:"cursor-char",key:"cursorChar",label:"Cursor character",type:"text",default:"|"},{name:"cursor-type",key:"cursorType",label:"Cursor style",type:"select",default:"caret",options:[["caret","Caret"],["block","Block"],["underline","Underline"]]},{name:"cursor-blink",key:"cursorBlink",label:"Blink cursor while idle",type:"checkbox",default:!0},{name:"loop",key:"loop",label:"Loop (false, true, or total plays)",type:"text",default:!1},{name:"loop-delay",key:"loopDelay",label:"Loop delay (ms)",type:"number",default:1e3,min:0},{name:"pause-on-hover",key:"pauseOnHover",label:"Pause on hover",type:"checkbox",default:!1},{name:"auto-start",key:"autoStart",label:"Start automatically",type:"checkbox",default:!0},{name:"respect-motion-preference",key:"respectMotionPreference",label:"Respect reduced motion",type:"checkbox",default:!0,always:!0},{name:"controls",key:"controls",label:"Show playback controls",type:"checkbox",default:!1},...a.map(e=>({...e,key:e.name,default:e.type==="checkbox"?!1:""}))];export function scribeDefaults(){return Object.fromEntries(SCRIBE_FIELDS.map(e=>[e.key,e.default]))}export function scribeLoop(e){if(e===!0||e==="true")return!0;if(e===!1||e==="false"||e==="")return!1;const n=Number(e);return Number.isInteger(n)&&n>=1?n:!1}export function stateToScribeActions(e,n="none"){const o=[];return e.forEach(r=>{r.type==="render"||r.type==="redraw"?(r.type==="redraw"&&o.push({undoRender:"all"}),o.push({render:r.text||"",effect:!r.effect||r.effect==="inherit"?n:r.effect})):r.type==="wait"?o.push({wait:r.unit==="s"?(r.duration||0)*1e3:r.duration||0}):r.type==="undo"&&o.push({undoRender:r.mode==="all"?"all":r.mode==="count"?r.count:!0})}),o}export function buildScribeShortcode(e,n){e={...scribeDefaults(),...e};const o=t=>String(t).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"),r=SCRIBE_FIELDS.filter(t=>t.always||e[t.key]!==t.default).map(t=>`${t.name}="${o(e[t.key])}"`),l=n.map(t=>{if(t.type==="render"||t.type==="redraw"){const c=t.effect&&t.effect!=="inherit"?` effect="${o(t.effect)}"`:"";return`[${t.type}${c}]${t.text||""}[/${t.type}]`}return t.type==="wait"?`[wait]${t.duration}${t.unit==="s"?"s":""}[/wait]`:t.mode==="all"?'[undo all="true" /]':t.mode==="count"?`[undo count="${t.count}" /]`:"[undo /]"});return`[scribe${r.length?" "+r.join(" "):""}]
|
|
2
2
|
${l.join(`
|
|
3
3
|
`)}
|
|
4
4
|
[/scribe]`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildTextStyle as
|
|
1
|
+
import{buildTextStyle as n,buildTextMotion as c}from"../../../public/js/text-style.mjs?v=20261029-all-cms-fonts";import{buildScribeStyle as l,loadScribeFont as o}from"../../../public/js/scribe-style.mjs?v=20261029-all-cms-fonts";export const PREVIEW_RENDERERS={scribe:(t,e)=>(o(t.font),{css:l(t),text:e||"Scribe preview text"}),text:(t,e)=>{o(t.font);const r=c(t),i=r.classes.includes("dm-tg")?`${r.style};background-image:linear-gradient(110deg,var(--dm-tg-a),var(--dm-tg-b));-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent`:"";return{css:[n(t),i].filter(Boolean).join(";"),text:e||"Preview text"}}};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{FONT_MAP as l}from"../../../public/js/text-style.mjs?v=20261029-all-cms-fonts";import{isLicensedFont as n}from"../../../public/js/font-families.mjs?v=20261029-cms-fonts";import{SHORTCODE_EXPIRY_FIELDS as o}from"../../../public/js/shortcode-expiry.mjs";export const SHORTCODES=[{name:"card",label:"Card",icon:"card",category:"Layout",selfClosing:!1,container:!0,wrappable:!0,template:`[card title="Title"]
|
|
2
2
|
Content
|
|
3
3
|
[/card]`,custom:"card",attrs:[{name:"title",type:"text",label:"Title"},{name:"subtitle",type:"text",label:"Subtitle"},{name:"icon",type:"icon",label:"Icon"},{name:"span",type:"select",label:"Span (in a grid)",options:[["","1 column"],["2","2 columns"],["3","3 columns"],["4","4 columns"],["5","5 columns"],["6","6 columns"],["full","Full row"]]},{name:"icon-layout",type:"select",label:"Icon layout",options:[["inline","Inline"],["stacked","Stacked"]]},{name:"icon-size",type:"text",label:"Icon size (xs, sm, md, lg, xl, 2xl or 48px / 3rem)"},{name:"icon-align",type:"select",label:"Icon alignment",options:[["","Default"],["left","Left"],["center","Centre"],["right","Right"]]},{name:"footer",type:"text",label:"Footer"},{name:"variant",type:"select",label:"Variant",options:[["","Default"],["primary","Primary"]]},{name:"collapsible",type:"checkbox",label:"Collapsible"},{name:"hover",type:"checkbox",label:"Hover highlight"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"box",label:"Box",icon:"square",category:"Layout",selfClosing:!1,container:!0,wrappable:!0,template:`[box]
|
|
4
4
|
Content
|
|
@@ -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:[
|
|
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]
|
|
45
45
|
[item]First item[/item]
|
|
46
46
|
[item]Second item[/item]
|
|
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"]]},{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 l)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}];
|
|
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"]]},{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}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{THEMES as
|
|
1
|
+
import{THEMES as m}from"./themes.js";export const FILL_TOKENS=["--dm-card-bg","--dm-surface"],VISIBLE_TOKENS=[...FILL_TOKENS,"--dm-text","--dm-primary","--dm-background"],SWITCHER_POSITIONS=["right-center","left-center","bottom-right","bottom-left","top-right","top-left"],newOverrideId=()=>`ov-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;export function cloneOverride(e={},t=newOverrideId){return{id:e.id||t(),label:String(e.label??""),enabled:e.enabled!==!1,scope:String(e.scope??""),theme:String(e.theme??""),tokens:{...e.tokens||{}},css:String(e.css??"")}}export function formFromConfig(e={}){const t=e.autoTheme||{},i=e.switcher||{};return{theme:e.theme||"charcoal-dark",adminTheme:e.adminTheme||"charcoal-dark",autoEnabled:!!t.enabled,dayTheme:t.dayTheme||"charcoal-light",nightTheme:t.nightTheme||"charcoal-dark",dayStart:t.dayStart||"07:00",nightStart:t.nightStart||"19:00",fontFamily:e.font?.family||"Roboto",fontSize:String(e.font?.size??16),adminFontFamily:e.font?.adminFamily||"",fontStylesheet:e.font?.stylesheet||"",swEnabled:i.enabled===!0,swPosition:SWITCHER_POSITIONS.includes(i.position)?i.position:"right-center",swOffsetX:String(i.offsetX??32),swOffsetY:String(i.offsetY??32),overrides:(Array.isArray(e.overrides)?e.overrides:[]).map(n=>cloneOverride(n))}}const l=(e,t)=>{const i=Number.parseInt(e,10);return Number.isFinite(i)?i:t};export function payloadFromForm(e,t={}){const i={enabled:!!e.autoEnabled,dayTheme:e.dayTheme||"charcoal-light",nightTheme:e.nightTheme||"charcoal-dark",dayStart:e.dayStart||"07:00",nightStart:e.nightStart||"19:00"};return{theme:i.enabled?i.dayTheme:e.theme,adminTheme:e.adminTheme,autoTheme:i,font:{family:e.fontFamily||"Roboto",size:l(e.fontSize,16)||16,...e.adminFontFamily&&{adminFamily:e.adminFontFamily},..."adminFamily"in(t.font||{})&&!e.adminFontFamily&&{adminFamily:""},...(e.fontStylesheet||"stylesheet"in(t.font||{}))&&{stylesheet:String(e.fontStylesheet||"").trim()}},switcher:{enabled:!!e.swEnabled,position:e.swPosition||"right-center",offsetX:l(e.swOffsetX,0),offsetY:l(e.swOffsetY,0),themes:Array.isArray(t.switcher?.themes)?t.switcher.themes:[]},overrides:(e.overrides||[]).map(n=>({id:n.id,label:String(n.label??"").trim(),enabled:n.enabled!==!1,scope:String(n.scope??"").trim(),theme:n.theme||"",tokens:Object.fromEntries(Object.entries(n.tokens||{}).map(([r,s])=>[String(r).trim(),String(s??"").trim()]).filter(([r,s])=>r&&s)),css:String(n.css??"")}))}}export function snapshot(e,t={}){const i=payloadFromForm(e,t);return JSON.stringify(i)}function h(e){const t=/^(\d{1,2}):(\d{2})$/.exec(String(e||""));return t?Number(t[1])*60+Number(t[2]):null}export function dayOrNight(e={},t=new Date){const i=h(e.dayStart)??420,n=h(e.nightStart)??1140,r=t.getHours()*60+t.getMinutes();return i===n?"day":i<n?r>=i&&r<n?"day":"night":r>=n&&r<i?"night":"day"}export function themeLabel(e,t=[]){if(!e)return"";const i=t.find(r=>r.id===e);if(i)return i.label;const n=m.find(r=>r.id===e);return n?n.admin?`${n.label} ${n.name}`:`${n.label} (${n.dark?"dark":"light"})`:e}export function themeDiff(e,t,i=6){const n=e||{},r=t||{},s=Object.keys(r).filter(a=>String(n[a]??"").toLowerCase()!==String(r[a]).toLowerCase()),o=[...VISIBLE_TOKENS.filter(a=>s.includes(a)),...s.filter(a=>!VISIBLE_TOKENS.includes(a))];return{changed:s.length,total:Object.keys(r).length,keepsFill:!FILL_TOKENS.some(a=>s.includes(a)),shown:o.slice(0,i).map(a=>({name:a,from:n[a]||"",to:r[a]})),more:Math.max(0,o.length-i)}}export const swatchColour=e=>/^#[0-9a-f]{3,8}$/i.test(String(e||""))?String(e):"";export function knownThemeIds(e={}){return new Set([...e.themes||[],...(e.custom||[]).map(t=>t.id)])}export function themeProblems(e,t){if(!t||!t.size)return[];t=new Set([...t,"core-light","core-dark"]);const i=[],n=(r,s)=>{s&&!t.has(s)&&i.push({where:r,id:s})};return e.autoEnabled?(n("Day theme",e.dayTheme),n("Night theme",e.nightTheme)):n("Site theme",e.theme),n("Admin theme",e.adminTheme),(e.overrides||[]).forEach((r,s)=>n(`Override "${r.label||r.scope||s+1}"`,r.theme)),i}export function overrideRow(e,t,{custom:i=[],known:n=null}={}){const r=Object.keys(e.tokens||{}).filter(o=>o&&String(e.tokens[o]??"").trim()).length,s=[e.scope||"no selector yet",e.theme?`adopts ${themeLabel(e.theme,i)}`:"",r?`${r} token${r===1?"":"s"}`:"",String(e.css||"").trim()?"custom CSS":""].filter(Boolean);return{id:e.id,name:e.label||e.scope||`Override ${t+1}`,meta:s.join(" \xB7 "),off:e.enabled===!1,missing:!!(e.theme&&n&&n.size&&!n.has(e.theme)),empty:!e.theme&&!r&&!String(e.css||"").trim()}}export function moveItem(e,t,i){const n=t+i;if(t<0||t>=e.length||n<0||n>=e.length)return e;const r=[...e],[s]=r.splice(t,1);return r.splice(n,0,s),r}
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
colour. Links drawn as a button, and links with their own colour, keep theirs.</li>
|
|
93
93
|
<li><strong>Fitting the bar</strong> - with any bar shape, a bar with more links than room fits
|
|
94
94
|
itself: it keeps clear of a floating Search or Reduce motion button over either end, then
|
|
95
|
-
tightens a step at a time - less space between links, a smaller size, the site
|
|
96
|
-
beside a logo,
|
|
95
|
+
tightens a step at a time - less space between links, a smaller size, no arrows, the site
|
|
96
|
+
name hidden beside a logo, and last of all no icons. Wider screens get the full bar back.</li>
|
|
97
97
|
<li><strong>Dropdown style: Cards</strong> - each dropdown opens as a large rounded card under its
|
|
98
98
|
item, with a little pointer. Every sub-item gets a coloured tile round its icon and a line of
|
|
99
99
|
description, laid out in columns. A sub-item with sub-items of its own becomes a column with a
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
<div class="thx-grid">
|
|
110
110
|
<div>
|
|
111
111
|
<label class="form-label" for="thx-font">Font family
|
|
112
|
-
<span data-help="
|
|
112
|
+
<span data-help="Choose the public site typeface. Poppins, Montserrat and Urbanist load from Google Fonts when selected. Cera Pro and Euclid require the licensed stylesheet configured below. This does not change the admin or your editor preference. The dyslexia-friendly group uses wider letterforms and spacing."></span></label>
|
|
113
113
|
<select id="thx-font" class="form-select" data-model="fontFamily.value">
|
|
114
114
|
<optgroup label="Sans-serif">
|
|
115
115
|
<option value="Roboto">Roboto (default)</option>
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
<option value="Nunito Sans">Nunito Sans</option>
|
|
121
121
|
<option value="Mulish">Mulish</option>
|
|
122
122
|
<option value="Poppins">Poppins</option>
|
|
123
|
+
<option value="Urbanist">Urbanist</option>
|
|
123
124
|
<option value="Source Sans 3">Source Sans 3</option>
|
|
124
125
|
<option value="Montserrat">Montserrat</option>
|
|
125
126
|
<option value="Raleway">Raleway</option>
|
|
@@ -137,11 +138,70 @@
|
|
|
137
138
|
<option value="Atkinson Hyperlegible">Atkinson Hyperlegible</option>
|
|
138
139
|
<option value="Andika">Andika</option>
|
|
139
140
|
</optgroup>
|
|
141
|
+
<optgroup label="Licensed webfonts (stylesheet required)">
|
|
142
|
+
<option value="Cera Pro">Cera Pro</option>
|
|
143
|
+
<option value="Euclid Circular A">Euclid Circular A</option>
|
|
144
|
+
<option value="Euclid Circular B">Euclid Circular B</option>
|
|
145
|
+
<option value="Euclid Flex">Euclid Flex</option>
|
|
146
|
+
<option value="Euclid Square">Euclid Square</option>
|
|
147
|
+
<option value="Euclid Triangle">Euclid Triangle</option>
|
|
148
|
+
</optgroup>
|
|
149
|
+
<optgroup label="System">
|
|
150
|
+
<option value="system-ui">System UI (no web font)</option>
|
|
151
|
+
</optgroup>
|
|
152
|
+
</select>
|
|
153
|
+
</div>
|
|
154
|
+
<div>
|
|
155
|
+
<label class="form-label" for="thx-admin-font">Admin font family
|
|
156
|
+
<span data-help-title="Admin font family" data-help="The typeface used throughout the admin interface, including navigation, controls and Tools. This is separate from the public site font and the page editor lettering preference. Poppins, Montserrat and Urbanist load from Google Fonts when selected. Cera Pro and Euclid need the licensed stylesheet below. Leave Theme default selected to keep the existing admin typography."></span></label>
|
|
157
|
+
<select id="thx-admin-font" class="form-select" data-model="adminFontFamily.value">
|
|
158
|
+
<option value="">Theme default</option>
|
|
159
|
+
<optgroup label="Sans-serif">
|
|
160
|
+
<option value="Roboto">Roboto</option>
|
|
161
|
+
<option value="Inter">Inter</option>
|
|
162
|
+
<option value="Open Sans">Open Sans</option>
|
|
163
|
+
<option value="Lato">Lato</option>
|
|
164
|
+
<option value="Nunito">Nunito</option>
|
|
165
|
+
<option value="Nunito Sans">Nunito Sans</option>
|
|
166
|
+
<option value="Mulish">Mulish</option>
|
|
167
|
+
<option value="Poppins">Poppins</option>
|
|
168
|
+
<option value="Urbanist">Urbanist</option>
|
|
169
|
+
<option value="Source Sans 3">Source Sans 3</option>
|
|
170
|
+
<option value="Montserrat">Montserrat</option>
|
|
171
|
+
<option value="Raleway">Raleway</option>
|
|
172
|
+
<option value="DM Sans">DM Sans</option>
|
|
173
|
+
<option value="Work Sans">Work Sans</option>
|
|
174
|
+
</optgroup>
|
|
175
|
+
<optgroup label="Serif">
|
|
176
|
+
<option value="Merriweather">Merriweather</option>
|
|
177
|
+
<option value="Playfair Display">Playfair Display</option>
|
|
178
|
+
<option value="Lora">Lora</option>
|
|
179
|
+
<option value="Roboto Slab">Roboto Slab</option>
|
|
180
|
+
</optgroup>
|
|
181
|
+
<optgroup label="Dyslexia-friendly">
|
|
182
|
+
<option value="Lexend">Lexend</option>
|
|
183
|
+
<option value="Atkinson Hyperlegible">Atkinson Hyperlegible</option>
|
|
184
|
+
<option value="Andika">Andika</option>
|
|
185
|
+
</optgroup>
|
|
186
|
+
<optgroup label="Licensed webfonts (stylesheet required)">
|
|
187
|
+
<option value="Cera Pro">Cera Pro</option>
|
|
188
|
+
<option value="Euclid Circular A">Euclid Circular A</option>
|
|
189
|
+
<option value="Euclid Circular B">Euclid Circular B</option>
|
|
190
|
+
<option value="Euclid Flex">Euclid Flex</option>
|
|
191
|
+
<option value="Euclid Square">Euclid Square</option>
|
|
192
|
+
<option value="Euclid Triangle">Euclid Triangle</option>
|
|
193
|
+
</optgroup>
|
|
140
194
|
<optgroup label="System">
|
|
141
195
|
<option value="system-ui">System UI (no web font)</option>
|
|
142
196
|
</optgroup>
|
|
143
197
|
</select>
|
|
144
198
|
</div>
|
|
199
|
+
<div class="thx-wide">
|
|
200
|
+
<label class="form-label" for="thx-font-stylesheet">Licensed font stylesheet
|
|
201
|
+
<span data-help-title="Licensed font stylesheet" data-help="The local CSS file declaring your licensed Cera Pro or Euclid webfonts with @font-face, for example /public/fonts/brand.css. Store its WOFF2 files under /public/fonts/ too, using relative URLs in the stylesheet. These site-owned files survive CMS updates and are never bundled into the public npm package. The stylesheet is shared by the public site, admin and editor. Without the actual font files, the browser uses the normal readable fallback. Google Fonts choices do not need this field."></span></label>
|
|
202
|
+
<input id="thx-font-stylesheet" type="text" class="form-input" placeholder="/public/fonts/brand.css" data-model="fontStylesheet.value" autocomplete="off" spellcheck="false">
|
|
203
|
+
<small class="thx-note">Cera Pro and Euclid require your own webfont files. Poppins, Montserrat and Urbanist are ready to use.</small>
|
|
204
|
+
</div>
|
|
145
205
|
<div>
|
|
146
206
|
<label class="form-label" for="thx-size">Font size
|
|
147
207
|
<span data-help="The root font size. Every rem value on the site scales with it."></span></label>
|
|
@@ -199,6 +259,7 @@
|
|
|
199
259
|
.thx-card-title { display: flex; align-items: center; gap: .35rem; font-weight: 600; }
|
|
200
260
|
.thx-card-title .btn { display: inline-flex; align-items: center; gap: .3rem; }
|
|
201
261
|
.thx-spacer { flex: 1; }
|
|
262
|
+
.thx-wide { grid-column: 1 / -1; }
|
|
202
263
|
.thx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
|
|
203
264
|
.thx-grid-3 { grid-template-columns: 2fr 1fr 1fr; }
|
|
204
265
|
.thx .form-label, .thx-form .form-label { display: flex; align-items: center; gap: .3rem; }
|