domma-cms 1.11.0 → 1.13.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 +10 -0
- package/admin/js/lib/dashboard-arrange.js +1 -1
- package/admin/js/lib/menu-editor-arrange.js +2 -2
- package/admin/js/lib/shortcode-registry.js +1 -1
- package/admin/js/templates/docs/usage-navigation.html +13 -1
- package/admin/js/templates/menu-editor.html +23 -1
- package/admin/js/views/collection-entries.js +6 -6
- package/admin/js/views/menu-editor.js +5 -5
- package/docs/DommaFeatures.md +1 -1
- package/docs/markdown-shortcodes.md +1 -1
- package/package.json +1 -1
- package/public/css/menu-cards.css +1 -1
- package/public/css/site.css +1 -1
- package/public/js/menu-cards.mjs +3 -3
- package/public/js/menu-look.mjs +1 -1
- package/public/js/site.js +1 -1
- package/server/routes/api/collections.js +4 -1
- package/server/services/forms.js +14 -4
- package/server/services/menus.js +1 -0
- package/server/templates/page.html +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.13.0] - 2026-10-29
|
|
4
|
+
|
|
5
|
+
- Menus: four more bar shapes beside Pill - Segmented (a tray with a thumb that slides to the link you point at), Underline glide, Dock (links swell as the pointer passes) and Neon (a glowing tray). And Shrink when the page scrolls. `[navbar]` takes them as `bar=` and `shrink=`.
|
|
6
|
+
- Navbar: a dropdown's caret no longer leaves a gap before the next item.
|
|
7
|
+
- Collections: the entry form saves checkbox groups again (they render as `name[]`, which the form never read, so adding an entry dropped them and saving one wiped them), and saving an entry keeps values the collection has no field for (a form's answers, a removed field) instead of wiping them. A collection's form that is still empty picks up the collection's fields when they are saved (New collection asks only for a title, so its form was made empty and stayed that way). Dashboard: Needs attention no longer lists Layouts while every page's layout exists.
|
|
8
|
+
|
|
9
|
+
## [1.12.0] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
- Menus: the branding can be a pill too (Behaviour > Branding shape), and a pill bar now drops the band and the line above the page (Bar background: Strip keeps it, None floats any bar): the pills float over the top of the page on frosted glass, with a hero running up under them. Desktop only. `[navbar]` takes `brand` and `strip`.
|
|
12
|
+
|
|
3
13
|
## [1.11.0] - 2026-10-29
|
|
4
14
|
|
|
5
15
|
- Menus: a pill bar and card dropdowns for the public navbar (Behaviour > Bar shape, Dropdown style). Cards give every sub-item a coloured icon tile and a line of description, in columns; a top-level item can add a heading with a "See all" link, a side box and a strip of chips, and moving along the bar can slide one card into the next. The mobile drawer keeps the tiles and descriptions. `[navbar]` takes `bar`, `dropdown`, `tiles` and `morph`. Off until chosen.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fmtDate as c}from"./dates.js";export const BADGE_SOURCES=[{key:"pages",title:"Pages",url:"#/pages",countUrl:"/pages/_count",permission:"pages"},{key:"forms",title:"Forms",url:"#/forms",countUrl:"/forms/_count",permission:"collections"},{key:"notifications",title:"Notifications",url:"#/system/notifications",countUrl:"/system/notifications/_count",permission:"notifications"},{key:"settings",title:"Site Settings",url:"#/settings",countUrl:"/settings/_count",permission:"settings"},{key:"plugins",title:"Marketplace",url:"#/plugins",countUrl:"/plugins/_count",permission:"plugins"},{key:"views",title:"Views",url:"#/views",countUrl:"/views/_count",permission:"views"},{key:"layouts",title:"Layouts",url:"#/layouts",countUrl:"/layouts/_count",permission:"layouts"},{key:"apiTokens",title:"API Tokens",url:"#/api-tokens",countUrl:"/api-tokens/_count",permission:"api-tokens"},{key:"theme",title:"Theme",url:"#/theme",countUrl:"/theme/count",permission:"theme"}];const f=new Set(["notifications","settings","layouts","apiTokens"]);export function canAny(e=[],o){return o?e.some(t=>t===o||String(t).startsWith(`${o}.`)):!0}export function deltaText(e){if(e==null||!Number.isFinite(Number(e)))return"";const o=Number(e);return`${o>=0?"\u25B2":"\u25BC"} ${Math.abs(o).toFixed(0)}% vs yesterday`}export function rowValue(e,o){const t=(e?.details?.rows||[]).find(i=>i.label===o);return t?t.value:null}const a=e=>Number(e||0).toLocaleString("en-GB");export function kpisFrom(e,o={}){const t=o.pages,i=o.forms,n=rowValue(t,"Drafts"),s=rowValue(i,"Last 7 days"),r=e?.health?.status||null;return{hits:e?a(e.traffic?.today):"\u2014",hitsDelta:e?deltaText(e.traffic?.deltaPct):"",hitsUp:Number(e?.traffic?.deltaPct)>=0,active:e?a(e.realtime?.activeSessions):"\u2014",pages:t?a(t.count):"\u2014",pagesSub:t?Number(n)?`${a(n)} draft${Number(n)===1?"":"s"}`:"no drafts":"",submissions:i?a(s):"\u2014",submissionsSub:i?`${a(rowValue(i,"Last 24 hours"))} in the last 24 hours`:"",health:r?{ok:"Healthy",warn:"Needs a look",fail:"Failing"}[r]||r:"\u2014",healthTone:{ok:"ok",warn:"warn",fail:"danger"}[r]||""}}export function attentionFrom(e={},o=[]){const t={danger:0,attention:1,info:2},i=[];for(const n of BADGE_SOURCES){const s=e[n.key];if(!s||!(Number(s.count)>0&&(s.tone==="danger"||s.tone==="attention"||f.has(n.key))))continue;const l=(s.details?.items||[]).slice(0,2).map(u=>u.text).filter(Boolean);i.push({id:`badge:${n.key}`,title:n.title,text:String(s.label||""),meta:l.join(" \xB7 "),tone:s.tone==="danger"?"danger":"warn",rank:t[s.tone]??2,href:n.url})}for(const n of o||[])!n||n.level==="ok"||i.push({id:`health:${n.id||n.label}`,title:"Site health",text:`${n.label||n.id}: ${n.value??""}`.trim(),meta:Array.isArray(n.detail)?n.detail.slice(0,3).join(", "):"",tone:n.level==="fail"?"danger":"warn",rank:n.level==="fail"?0:1,href:""});return i.sort((n,s)=>n.rank-s.rank||n.title.localeCompare(s.title))}export function ago(e,o=Date.now()){const t=new Date(e).getTime();if(!Number.isFinite(t))return"";const i=Math.max(0,Math.round((o-t)/1e3));return i<60?"just now":i<3600?`${Math.round(i/60)} min ago`:i<86400?`${Math.round(i/3600)} hour${Math.round(i/3600)===1?"":"s"} ago`:i<86400*14?`${Math.round(i/86400)} day${Math.round(i/86400)===1?"":"s"} ago`:c(t)}export function activityRows(e=[],o=Date.now()){return(e||[]).map((t,i)=>{const n=ago(t.at,o);if(t.type==="entry"||t.type==="form"){const r=t.collection||t.form||"";return{id:`a${i}`,kind:"entry",icon:"database",text:`New entry in ${t.title||r}`,meta:n,href:r?`#/collections/${encodeURIComponent(r)}/entries`:"",url:"",slug:r}}const s=t.type==="publish"?"published":"edited";return{id:`a${i}`,kind:"page",icon:t.type==="publish"?"upload":"edit",text:`${t.actor||"Someone"} ${s} ${t.target||"/"}`,meta:n,href:`#/pages/edit${t.target||"/"}`,url:t.target||"/",slug:""}})}export function chartSeries(e=[]){const o=Array.isArray(e)?e:[];return{labels:o.map(t=>String(t.day||"").slice(5)),values:o.map(t=>Number(t.hits)||0),empty:!o.some(t=>Number(t.hits)>0)}}export function isSitePath(e){return typeof e=="string"&&/^\/(?!\/)/.test(e)&&!/^\/(admin|api|media|public)(\/|$)/.test(e)}
|
|
1
|
+
import{fmtDate as c}from"./dates.js";export const BADGE_SOURCES=[{key:"pages",title:"Pages",url:"#/pages",countUrl:"/pages/_count",permission:"pages"},{key:"forms",title:"Forms",url:"#/forms",countUrl:"/forms/_count",permission:"collections"},{key:"notifications",title:"Notifications",url:"#/system/notifications",countUrl:"/system/notifications/_count",permission:"notifications"},{key:"settings",title:"Site Settings",url:"#/settings",countUrl:"/settings/_count",permission:"settings"},{key:"plugins",title:"Marketplace",url:"#/plugins",countUrl:"/plugins/_count",permission:"plugins"},{key:"views",title:"Views",url:"#/views",countUrl:"/views/_count",permission:"views"},{key:"layouts",title:"Layouts",url:"#/layouts",countUrl:"/layouts/_count",permission:"layouts"},{key:"apiTokens",title:"API Tokens",url:"#/api-tokens",countUrl:"/api-tokens/_count",permission:"api-tokens"},{key:"theme",title:"Theme",url:"#/theme",countUrl:"/theme/count",permission:"theme"}];const f=new Set(["notifications","settings","layouts","apiTokens"]);export function canAny(e=[],o){return o?e.some(t=>t===o||String(t).startsWith(`${o}.`)):!0}export function deltaText(e){if(e==null||!Number.isFinite(Number(e)))return"";const o=Number(e);return`${o>=0?"\u25B2":"\u25BC"} ${Math.abs(o).toFixed(0)}% vs yesterday`}export function rowValue(e,o){const t=(e?.details?.rows||[]).find(i=>i.label===o);return t?t.value:null}const a=e=>Number(e||0).toLocaleString("en-GB");export function kpisFrom(e,o={}){const t=o.pages,i=o.forms,n=rowValue(t,"Drafts"),s=rowValue(i,"Last 7 days"),r=e?.health?.status||null;return{hits:e?a(e.traffic?.today):"\u2014",hitsDelta:e?deltaText(e.traffic?.deltaPct):"",hitsUp:Number(e?.traffic?.deltaPct)>=0,active:e?a(e.realtime?.activeSessions):"\u2014",pages:t?a(t.count):"\u2014",pagesSub:t?Number(n)?`${a(n)} draft${Number(n)===1?"":"s"}`:"no drafts":"",submissions:i?a(s):"\u2014",submissionsSub:i?`${a(rowValue(i,"Last 24 hours"))} in the last 24 hours`:"",health:r?{ok:"Healthy",warn:"Needs a look",fail:"Failing"}[r]||r:"\u2014",healthTone:{ok:"ok",warn:"warn",fail:"danger"}[r]||""}}export function attentionFrom(e={},o=[]){const t={danger:0,attention:1,info:2},i=[];for(const n of BADGE_SOURCES){const s=e[n.key];if(!s||s.inventory||!(Number(s.count)>0&&(s.tone==="danger"||s.tone==="attention"||f.has(n.key))))continue;const l=(s.details?.items||[]).slice(0,2).map(u=>u.text).filter(Boolean);i.push({id:`badge:${n.key}`,title:n.title,text:String(s.label||""),meta:l.join(" \xB7 "),tone:s.tone==="danger"?"danger":"warn",rank:t[s.tone]??2,href:n.url})}for(const n of o||[])!n||n.level==="ok"||i.push({id:`health:${n.id||n.label}`,title:"Site health",text:`${n.label||n.id}: ${n.value??""}`.trim(),meta:Array.isArray(n.detail)?n.detail.slice(0,3).join(", "):"",tone:n.level==="fail"?"danger":"warn",rank:n.level==="fail"?0:1,href:""});return i.sort((n,s)=>n.rank-s.rank||n.title.localeCompare(s.title))}export function ago(e,o=Date.now()){const t=new Date(e).getTime();if(!Number.isFinite(t))return"";const i=Math.max(0,Math.round((o-t)/1e3));return i<60?"just now":i<3600?`${Math.round(i/60)} min ago`:i<86400?`${Math.round(i/3600)} hour${Math.round(i/3600)===1?"":"s"} ago`:i<86400*14?`${Math.round(i/86400)} day${Math.round(i/86400)===1?"":"s"} ago`:c(t)}export function activityRows(e=[],o=Date.now()){return(e||[]).map((t,i)=>{const n=ago(t.at,o);if(t.type==="entry"||t.type==="form"){const r=t.collection||t.form||"";return{id:`a${i}`,kind:"entry",icon:"database",text:`New entry in ${t.title||r}`,meta:n,href:r?`#/collections/${encodeURIComponent(r)}/entries`:"",url:"",slug:r}}const s=t.type==="publish"?"published":"edited";return{id:`a${i}`,kind:"page",icon:t.type==="publish"?"upload":"edit",text:`${t.actor||"Someone"} ${s} ${t.target||"/"}`,meta:n,href:`#/pages/edit${t.target||"/"}`,url:t.target||"/",slug:""}})}export function chartSeries(e=[]){const o=Array.isArray(e)?e:[];return{labels:o.map(t=>String(t.day||"").slice(5)),values:o.map(t=>Number(t.hits)||0),empty:!o.some(t=>Number(t.hits)>0)}}export function isSitePath(e){return typeof e=="string"&&/^\/(?!\/)/.test(e)&&!/^\/(admin|api|media|public)(\/|$)/.test(e)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const p=["separator","spacer","theme-switcher"];export const isStructural=t=>p.includes(t?.type);export function siblingsOf(t,n){const
|
|
2
|
-
`).map(
|
|
1
|
+
const p=["separator","spacer","theme-switcher"];export const isStructural=t=>p.includes(t?.type);export function siblingsOf(t,n){const i=t.find(o=>o.id===n);return i?t.filter(o=>o.parentId===i.parentId):[]}export function moveRow(t,n,i){const o=siblingsOf(t,n),r=o.findIndex(s=>s.id===n),l=r+(i<0?-1:1);if(r<0||l<0||l>=o.length)return!1;o[r].touched=!0;const e=t.indexOf(o[r]),a=t.indexOf(o[l]);return[t[e],t[a]]=[t[a],t[e]],!0}export function indentRow(t,n){const i=siblingsOf(t,n),o=i.findIndex(r=>r.id===n);return o<=0||isStructural(i[o-1])?!1:(i[o].parentId=i[o-1].id,i[o].touched=!0,!0)}export function outdentRow(t,n){const i=t.find(r=>r.id===n);if(!i||i.parentId==null)return!1;const o=t.find(r=>r.id===i.parentId);return i.parentId=o?o.parentId:null,i.touched=!0,!0}export function newRow(t,n,i=null){return t==="separator"?{id:n,parentId:i,type:"separator"}:t==="theme-switcher"?{id:n,parentId:i,type:"theme-switcher"}:t==="spacer"?{id:n,parentId:i,type:"spacer",size:"md"}:{id:n,parentId:i,text:"",url:"/",icon:"",visibility:"",permission:"",hidden:!1,bundled:!1}}export function insertBelow(t,n,i,o){const r=t.findIndex(e=>e.id===n);if(r===-1)return null;const l=newRow(i,o,t[r].parentId);return t.splice(r+1,0,l),l}export function addChild(t,n,i){const o=t.find(l=>l.id===n);if(!o||isStructural(o))return null;const r=newRow("item",i,o.id);return t.push(r),o.touched=!0,r}export function duplicateRow(t,n,i){const o=t.find(s=>s.id===n);if(!o||o.tool)return null;const r=new Map,l=[],e=(s,c)=>{if(s.tool)return;const d={...m(s),id:i(),parentId:c};delete d.tool,delete d.locked,d.touched=!0,r.set(s.id,d.id),l.push(d);for(const f of t.filter(u=>u.parentId===s.id))e(f,d.id)};if(e(o,o.parentId),!l.length)return null;l[0].text&&(l[0].text=`${l[0].text} (copy)`);const a=t.indexOf(o);return t.splice(a+1,0,l[0]),t.push(...l.slice(1)),l[0]}function m(t){return JSON.parse(JSON.stringify(t))}export function bindingFrom({slot:t="",projects:n=[],pagesText:i=""}={}){return t?{slot:t,projects:[...n],pages:String(i).split(`
|
|
2
|
+
`).map(o=>o.trim()).filter(Boolean)}:null}export function badPagePatterns(t=[]){return t.filter(n=>!/^\/[^\s?#*]*(\/\*)?$|^\/\*$/.test(n))}const g=["fontFamily","fontSize","fontWeight","letterSpacing","iconSize"];export function menuFromForm(t={},n={},i=null,o=[],r={}){const l=Object.fromEntries(g.filter(f=>t[f]).map(f=>[f,t[f]])),e={};if(t.position==="floating"){t.floatAnchor&&(e.anchor=t.floatAnchor);for(const[f,u]of[["offsetX",t.floatOffsetX],["offsetY",t.floatOffsetY],["width",t.floatWidth],["radius",t.floatRadius],["opacity",t.floatOpacity]])u!==""&&u!=null&&Number.isFinite(Number(u))&&(e[f]=Number(u));t.floatShadow&&(e.shadow=t.floatShadow),t.floatAccent&&(e.accent=t.floatAccent),t.floatTitle&&(e.title=String(t.floatTitle).trim()),t.floatCollapsible&&(e.collapsible=!0),t.floatCollapsible&&t.floatCollapsed&&(e.collapsed=!0),t.floatMovable&&(e.movable=!0),t.floatResizable&&(e.resizable=!0)}const a={};t.position!=="floating"&&(t.orientation==="vertical"?(t.dockWidth!==""&&t.dockWidth!=null&&Number.isFinite(Number(t.dockWidth))&&(a.width=Number(t.dockWidth)),t.dockAutohide?a.autohide=!0:t.dockCollapsible&&(a.collapsible=!0,t.dockCollapsed&&(a.collapsed=!0))):t.dockHideOnScroll&&(a.hideOnScroll=!0));const s={};t.highlightHover&&(s.hover=t.highlightHover),t.highlightActive&&(s.active=t.highlightActive),t.highlightAccent&&(s.accent=t.highlightAccent);const c={};t.entranceAnimation&&(c.animation=t.entranceAnimation);for(const[f,u]of[["stagger",t.entranceStagger],["duration",t.entranceDuration]])u!==""&&u!=null&&Number.isFinite(Number(u))&&(c[f]=Number(u));const d=!!t.entranceEnabled||"stagger"in c||"duration"in c||c.animation&&c.animation!=="fade";return{slug:String(n.slug||"").trim(),name:String(n.name||"").trim(),description:String(n.description||"").trim(),...t.variant&&{variant:t.variant},...t.position&&{position:t.position},...t.orientation&&{orientation:t.orientation},...t.orientation==="vertical"&&t.side&&{side:t.side},...t.orientation!=="vertical"&&t.align&&{align:t.align},...Object.keys(e).length&&{float:e},...Object.keys(s).length&&{highlight:s},...d&&{entrance:{enabled:!!t.entranceEnabled,...c}},...Object.keys(a).length&&{dock:a},...t.appearOnHover&&{appearOnHover:!0},...(t.mobileHamburgerOnly||t.mobileHideBrand)&&{mobile:{...t.mobileHamburgerOnly&&{hamburgerOnly:!0},...t.mobileHideBrand&&{hideBrand:!0}}},...(t.lookBar||t.lookDropdown||t.lookBrand||t.lookStrip||t.lookShrink)&&{look:{...t.lookBar&&{bar:t.lookBar},...t.lookBrand&&{brand:t.lookBrand},...t.lookStrip&&{strip:t.lookStrip},...t.lookShrink&&{shrink:!0},...t.lookDropdown&&{dropdown:t.lookDropdown},...t.lookDropdown&&t.lookTiles&&{tiles:t.lookTiles},...t.lookDropdown&&t.lookMorph&&{morph:!0}}},...t.class&&String(t.class).trim()&&{class:String(t.class).trim()},...Object.keys(l).length&&{style:l},binding:i,items:o,meta:{...r||{},project:n.project||null}}}export function menuProblems(t){const n=[];/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(t.slug||"")||n.push("The slug must be lowercase letters, numbers and hyphens, no hyphen at either end (Meta tab)."),t.name||n.push("The menu needs a name (Meta tab).");const i=countUnlabelled(t.items);i&&n.push(`${i} item${i===1?" has":"s have"} no label - every item needs one (Items tab).`),t.dock?.width!=null&&!(t.dock.width>=160&&t.dock.width<=480)&&n.push("The rail width must be from 160 to 480 px (Behaviour tab).");const o=t.entrance||{};if(o.stagger!=null&&!(o.stagger>=0&&o.stagger<=1e3)&&n.push("The entrance delay between items must be from 0 to 1000 ms (Behaviour tab - switch Staggered entrance on to edit it)."),o.duration!=null&&!(o.duration>=50&&o.duration<=3e3)&&n.push("Each item's entrance animation must be from 50 to 3000 ms (Behaviour tab - switch Staggered entrance on to edit it)."),t.binding){const r=badPagePatterns(t.binding.pages);r.length&&n.push(`Not valid page patterns: ${r.join(", ")} (Binding tab).`)}return n}export function countUnlabelled(t=[]){let n=0;for(const i of t||[])!isStructural(i)&&!(i.ref===!0&&i.url)&&!String(i.text||"").trim()&&n++,n+=countUnlabelled(i.items);return n}export const snapshot=t=>JSON.stringify(t);export function depthOfItems(t){if(!Array.isArray(t)||!t.length)return 0;let n=0;for(const i of t){const o=Array.isArray(i.items)&&i.items.length?depthOfItems(i.items):0;o>n&&(n=o)}return n+1}export function locationRows(t=[],n={},i={},o=[],r={}){const l=Object.fromEntries(o.map(e=>[e.slug,e.name||e.slug]));return t.map(e=>{const a=n[e.slot]||"",s=a&&r[a]||0,c=!!a&&e.maxDepth!=null&&s>e.maxDepth,d=e.slot==="overlay";return{slot:e.slot,label:e.label||e.slot,source:e.source||"",description:e.description||"",menu:a,menuName:a?l[a]||`${a} (missing)`:"",missing:!!a&&!l[a],tooDeep:c,depthText:c?`Nested ${s} deep - this slot shows ${e.maxDepth}`:"",empty:!a,emptyText:a?"":d?"Optional":"Nothing mapped",changed:(n[e.slot]||"")!==(i[e.slot]||"")}})}export function locationsPayload(t={},n=[]){const i=new Set(n.map(o=>o.slot));return Object.fromEntries(Object.entries(t).filter(([o,r])=>r&&(!n.length||i.has(o))))}export function locationsSnapshot(t={}){return JSON.stringify(Object.keys(t).filter(n=>t[n]).sort().map(n=>[n,t[n]]))}
|
|
@@ -44,4 +44,4 @@ Optional body content.
|
|
|
44
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,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:[["Georgia","Georgia"],["Arial","Arial"],["Verdana","Verdana"],["Courier New","Courier New"],["Times New Roman","Times New Roman"],["Trebuchet MS","Trebuchet MS"]]},{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"]]},{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"}];
|
|
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:"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"}];
|
|
@@ -71,6 +71,18 @@
|
|
|
71
71
|
<li><strong>Bar shape: Pill</strong> - the items sit together in one rounded capsule, and the
|
|
72
72
|
item under the pointer, and the page you are on, get a soft pill of their own. It suits the
|
|
73
73
|
Transparent variant best. A hover or current-page effect chosen under Highlighting still wins.</li>
|
|
74
|
+
<li><strong>Other bar shapes</strong> - <strong>Segmented</strong> puts the links in a tray with one
|
|
75
|
+
raised thumb that slides to the link you point at, and rests on the current page.
|
|
76
|
+
<strong>Underline glide</strong> has no tray: a short bar glides under the link. <strong>Dock</strong>
|
|
77
|
+
makes the links swell as the pointer passes, like a dock. <strong>Neon</strong> gives the tray a
|
|
78
|
+
glowing edge and the links a glow - best on a dark theme. Tick <strong>Shrink when the page
|
|
79
|
+
scrolls</strong> to tighten the bar once the visitor starts reading.</li>
|
|
80
|
+
<li><strong>Branding shape: Pill</strong> - your logo and site name get a rounded capsule of
|
|
81
|
+
their own, to match.</li>
|
|
82
|
+
<li><strong>Bar background</strong> - with a pill bar, the band across the top and its line
|
|
83
|
+
above the page go by themselves: the pills float over the top of the page on frosted glass, a
|
|
84
|
+
hero at the top runs up under them, and the page scrolls behind them. Choose <strong>Strip</strong>
|
|
85
|
+
to keep the band, or <strong>None</strong> to float any bar's links. Phones keep the usual bar.</li>
|
|
74
86
|
<li><strong>Dropdown style: Cards</strong> - each dropdown opens as a large rounded card under its
|
|
75
87
|
item, with a little pointer. Every sub-item gets a coloured tile round its icon and a line of
|
|
76
88
|
description, laid out in columns. A sub-item with sub-items of its own becomes a column with a
|
|
@@ -95,7 +107,7 @@
|
|
|
95
107
|
</ul>
|
|
96
108
|
<p>On phones the cards open in the menu drawer as a list, with the tiles and descriptions kept.
|
|
97
109
|
A page can switch these for itself with the <code>[navbar]</code> tag:
|
|
98
|
-
<code>[navbar bar="pill" dropdown="cards" tiles="accent" morph="true" /]</code>, or
|
|
110
|
+
<code>[navbar bar="segmented" brand="pill" strip="none" shrink="true" dropdown="cards" tiles="accent" morph="true" /]</code>, or
|
|
99
111
|
<code>dropdown=""</code> to turn cards off on that page.</p>
|
|
100
112
|
|
|
101
113
|
<h3>Links</h3>
|
|
@@ -90,10 +90,32 @@
|
|
|
90
90
|
</div>
|
|
91
91
|
<div class="form-group dm-look-field">
|
|
92
92
|
<label for="me-look-bar">Bar shape
|
|
93
|
-
<span data-help-title="Bar shape" data-help="Pill gathers the items into one rounded capsule, and the item under the pointer gets its own soft pill.
|
|
93
|
+
<span data-help-title="Bar shape" data-help="Pill gathers the items into one rounded capsule, and the item under the pointer gets its own soft pill. Segmented puts them in a tray with one raised thumb that slides to the item you point at. Underline has no tray - a short bar glides under the item. Dock makes the items swell as the pointer passes, like a dock. Neon gives the tray a glowing edge and the items a glow - best on dark themes. Every shape but Underline floats over the page without a strip unless Bar background says Strip. Navbar only, horizontal only, desktop only."></span></label>
|
|
94
94
|
<select id="me-look-bar" name="lookBar" class="form-input">
|
|
95
95
|
<option value="">Standard</option>
|
|
96
96
|
<option value="pill">Pill</option>
|
|
97
|
+
<option value="segmented">Segmented</option>
|
|
98
|
+
<option value="underline">Underline glide</option>
|
|
99
|
+
<option value="dock">Dock</option>
|
|
100
|
+
<option value="neon">Neon</option>
|
|
101
|
+
</select>
|
|
102
|
+
<label class="flex items-center gap-2" style="margin-top:.4rem"><input type="checkbox" id="me-look-shrink" name="lookShrink" style="width:auto;margin:0"> Shrink when the page scrolls</label>
|
|
103
|
+
</div>
|
|
104
|
+
<div class="form-group dm-look-field">
|
|
105
|
+
<label for="me-look-brand">Branding shape
|
|
106
|
+
<span data-help-title="Branding shape" data-help="Pill puts your logo and site name in a rounded capsule of their own, matching a pill bar. Navbar only, horizontal only, desktop only."></span></label>
|
|
107
|
+
<select id="me-look-brand" name="lookBrand" class="form-input">
|
|
108
|
+
<option value="">Standard</option>
|
|
109
|
+
<option value="pill">Pill</option>
|
|
110
|
+
</select>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="form-group dm-look-field">
|
|
113
|
+
<label for="me-look-strip">Bar background
|
|
114
|
+
<span data-help-title="Bar background" data-help="The band across the top, and its line above the page. With a pill bar it goes by itself: the pills float over the top of the page on frosted glass, and a hero at the top runs up under them. None does that for any bar (and gives the links their pill); Strip keeps the band behind a pill bar. Desktop only - phones keep the usual bar."></span></label>
|
|
115
|
+
<select id="me-look-strip" name="lookStrip" class="form-input">
|
|
116
|
+
<option value="">Automatic - none with a pill bar</option>
|
|
117
|
+
<option value="none">None - floating pills</option>
|
|
118
|
+
<option value="band">Strip - keep the band</option>
|
|
97
119
|
</select>
|
|
98
120
|
</div>
|
|
99
121
|
<div class="form-group dm-look-field">
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{api as k,apiRequest as
|
|
1
|
+
import{api as k,apiRequest as ft}from"../api.js";import{addBannerAction as j}from"../lib/plugin-chrome.js";import{SHAPES as mt,showLoading as ht}from"../lib/loading.js";import{helpPopovers as ze}from"../lib/help-popover.js";import{onceClosed as yt,openMenuAt as je,sidebarCount as P,viewLifetime as vt}from"../lib/tool-kit.js";import{MAX_COLUMNS as bt,PAGE_SIZE as ce,SHOW_STEP as X,arrangeEntries as gt,canClear as Et,cellText as Pe,countText as kt,draftable as xt,fileRefsOf as wt,filterChoices as St,filterText as Ct,hasForm as $t,isFileValue as ve,safeFileHref as At,shownValue as be,snapshot as _e,typedValue as Mt,valueText as ge}from"../lib/collection-entries-arrange.js";import{fmtDate as Lt,fmtDateTime as _}from"../lib/dates.js";const Be=/^#\/collections\/[^/?#]+\/entries\/?(\?.*)?$/,B=p=>`collection-entries.draft.${p}`,U=p=>String(p??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function le(p){const m=document.createElement("template");return m.innerHTML=p.trim(),m.content.firstElementChild}const qt='<span class="cex-chip">{{text}}<button type="button" data-idx="{{idx}}" title="Remove this filter" aria-label="Remove filter {{text}}">\xD7</button></span>';function Tt(p){return`
|
|
2
2
|
<tr class="cex-row" data-id="{{id}}" tabindex="0" data-bind-class="rowCls">
|
|
3
3
|
<td class="cex-check"><input type="checkbox" class="cex-sel" aria-label="Select this entry" data-bind-checked="sel"></td>
|
|
4
4
|
${Array.from({length:p},(b,a)=>`<td data-col="${a}" title="{{t${a}}}">{{c${a}}}</td>`).join("")}
|
|
5
5
|
<td class="cex-when" title="{{whenFull}}">{{when}}</td>
|
|
6
6
|
<td class="cex-tools"><button type="button" class="cex-run" data-bind-hidden="!runs" title="Run one of this collection's actions">\u26A1 {{runs}}</button><button type="button" class="cex-kebab" aria-label="Actions for this entry" title="Actions">\u22EE</button></td>
|
|
7
|
-
</tr>`}const
|
|
7
|
+
</tr>`}const Nt=(p,m)=>p?.type==="file"||ve(m?.[p?.name]);function He(p){const m=document.createElement("ul");m.className="cex-files";for(const b of wt(p)){const a=document.createElement("li"),l=At(b.url),c=document.createElement(l?"a":"span");l&&(c.href=l,c.target="_blank",c.rel="noopener"),c.textContent=ge(b),a.appendChild(c),m.appendChild(a)}return m}function It(p,m){const b={};return p.forEach(a=>{const l={};a.fullWidth?l.span=m:a.span>1&&(l.span=a.span),a.placeholder&&(l.placeholder=a.placeholder),a.helper&&(l.hint=a.helper),a.prefix&&(l.prefix=a.prefix),a.suffix&&(l.suffix=a.suffix);for(const u of["clear","stepper","counter"])a[u]===!0&&(l[u]=!0);const c=a.type==="checkbox"?"boolean":a.type==="date"?"string":a.type;b[a.name]={type:c,label:a.label,required:a.required,options:a.options,...Object.keys(l).length?{formConfig:l}:{}}}),b}function Ve(p,m){const b=CSS.escape(m);return[...p.querySelectorAll(`[name="${b}"], [name="${b}[]"]`)]}function ie(p,m){const b={};for(const a of m){const l=Ve(p,a.name);if(!l.length)continue;const c=l[0];c.type==="radio"?b[a.name]=l.find(u=>u.checked)?.value??"":c.type==="checkbox"&&(l.length>1||c.name.endsWith("[]"))?b[a.name]=l.filter(u=>u.checked).map(u=>u.value):c.type==="checkbox"?b[a.name]=c.checked:c.tagName==="SELECT"&&c.multiple?b[a.name]=[...c.selectedOptions].map(u=>u.value):b[a.name]=Mt(a,c.value)}return b}function Je(p,m,b){for(const a of m){if(!(a.name in b))continue;const l=b[a.name],c=Ve(p,a.name);if(!c.length)continue;const u=c[0];u.type==="radio"?c.forEach(r=>{r.checked=r.value===String(l)}):u.type==="checkbox"&&(c.length>1||u.name.endsWith("[]"))?c.forEach(r=>{r.checked=Array.isArray(l)&&l.includes(r.value)}):u.type==="checkbox"?u.checked=l===!0:u.tagName==="SELECT"&&u.multiple?[...u.options].forEach(r=>{r.selected=Array.isArray(l)&&l.includes(r.value)}):u.value=l??"",c.forEach(r=>r.dispatchEvent(new Event("input",{bubbles:!0})))}}const Ke=vt(Be);export const collectionEntriesView={templateUrl:"/admin/js/templates/collection-entries.html",async onMount(p){Ke.reset();const m=p.get(0).querySelector(".cex")||p.get(0),b=location.hash.match(/^#\/collections\/([^/?#]+)\/entries/),a=b?decodeURIComponent(b[1]):null,l=()=>Be.test(location.hash)&&m.isConnected&&location.hash.includes(`/collections/${encodeURIComponent(a)}/entries`),c=e=>(Ke.add(e),e);if(!a){E.toast("No collection selected.",{type:"error"});return}const u=M.observable(null),r=M.observable([]),x=M.observable(0),Y=M.observable(!0),H=M.observable(""),We=M.computed(()=>u.value!==null),re=M.observable(""),w=M.observable([]),Z=M.observable({key:"created",dir:"desc"}),g=M.observable([]),N=M.observable(X),V=M.observable([]),Q=M.observable({}),L=M.observable(!1);let ee=1;const te=()=>u.peek()?.fields||[],de=M.computed(()=>(u.value?.fields||[]).slice(0,bt)),J=e=>r.peek().find(t=>t.id===e),Ee=e=>V.peek().filter(t=>{const n=Q.peek()[t.slug];return n==null||n.has(e)}),D=M.observable([]),ke=M.observable([]);c(M.effect(()=>{const e=gt(r.value,{filters:w.value,query:re.value,sort:Z.value});D.value=e})),c(M.effect(()=>{const e=de.value,t=new Set(g.value);Q.value,V.value,ke.value=D.value.slice(0,N.value).map(n=>{const o={id:n.id,sel:t.has(n.id),rowCls:t.has(n.id)?"is-selected":""};e.forEach((i,h)=>{const d=be(i,n.data?.[i.name]);o[`c${h}`]=Pe(d),o[`t${h}`]=ge(d)});const s=n.meta?.createdAt;o.when=s?Lt(s):"",o.whenFull=s?`Created ${_(s)}${n.meta?.updatedAt?` \xB7 changed ${_(n.meta.updatedAt)}`:""}`:"";const f=Ee(n.id).length;return o.runs=f?String(f):"",o})}));const Ge=M.computed(()=>w.value.map((e,t)=>({key:`${t}:${e.field}:${e.op}:${e.value}`,idx:t,text:Ct(e)}))),Xe=M.computed(()=>g.value.length),Ye={schema:u,loaded:r,loading:Y,loadError:H,ready:We,query:re,rows:ke,chips:Ge,busy:L,selectedCount:Xe,countLine:M.computed(()=>kt(D.value.length,r.value.length,x.value)),selectedText:M.computed(()=>`${g.value.length} selected`),canClear:M.computed(()=>Et(a)),introText:M.computed(()=>{const e=u.value;return e?`${e.description?`${e.description} - `:""}${(e.fields||[]).length} field${(e.fields||[]).length===1?"":"s"}${e.storage?.adapter==="mongodb"?", on MongoDB":""}.`:""}),emptyText:M.computed(()=>r.value.length?"No entries match the search or filters.":"No entries yet - Add entry in the banner makes one, or Import brings many."),moreText:M.computed(()=>{const e=D.value.length-N.value;if(e>0)return`Show ${Math.min(X,e)} more (${e} not shown)`;const t=x.value-r.value.length;return t>0?`Load the next ${Math.min(ce,t)} from the server`:""})};async function K({reset:e=!0,pending:t=null}={}){Y.value=!0;try{const n=e?Math.max(ce,r.peek().length):ce;e&&(ee=1);const o=await k.collections.listEntries(a,{limit:n,page:ee});if(t&&await t.done(),!l())return;const s=o?.entries||(Array.isArray(o)?o:[]);r.value=e?s:[...r.peek(),...s.filter(i=>!J(i.id))],x.value=Number(o?.total)||r.peek().length,e&&(ee=Math.max(1,Math.ceil(r.peek().length/ce)));const f=new Set(r.peek().map(i=>i.id));g.value=g.peek().filter(i=>f.has(i)),H.value="",await et()}catch(n){H.value=`Could not load the entries: ${n.message||n}`}finally{t&&await t.done(),Y.value=!1}}async function Ze(){ee+=1,await K({reset:!1})}async function Qe(){try{if((await ft("/actions/_count",{method:"GET"}).catch(()=>null))?.available===!1)return;const t=await k.actions.forCollection(a);V.value=Array.isArray(t)?t.filter(n=>n.canRun!==!1):[]}catch{V.value=[]}}async function et(){const e=V.peek().filter(o=>o.access?.rowLevel);if(!e.length||!r.peek().length)return;const t=r.peek().map(o=>o.id),n={...Q.peek()};await Promise.all(e.map(async o=>{try{n[o.slug]=new Set((await k.actions.checkAccess(o.slug,t)).allowed)}catch{n[o.slug]=null}})),Q.value=n}const W=e=>{const t=te()[0];return(t?Pe(be(t,e?.data?.[t.name]),40):"")||`Entry ${String(e?.id||"").slice(0,8)}`};async function xe(e){if(await E.confirm(`Delete \u201C${U(W(e))}\u201D? This cannot be undone.`))try{await k.collections.deleteEntry(a,e.id),r.value=r.peek().filter(t=>t.id!==e.id),x.value=Math.max(0,x.peek()-1),g.value=g.peek().filter(t=>t!==e.id),P("#/collections"),E.toast("Entry deleted.",{type:"success"})}catch(t){E.toast(`Not deleted: ${t.message||t}`,{type:"error"})}}async function tt(){const e=[...g.peek()];if(!e.length||!await E.confirm(`Delete ${e.length} entr${e.length===1?"y":"ies"}? This cannot be undone.`))return;L.value=!0;let t=0;const n=[];for(const o of e)try{await k.collections.deleteEntry(a,o),t++}catch(s){n.push(s.message||String(s))}L.value=!1,g.value=[],P("#/collections"),E.toast(n.length?`Deleted ${t}; ${n.length} refused (${n[0]}).`:`Deleted ${t} entr${t===1?"y":"ies"}.`,{type:n.length?"warning":"success",duration:n.length?7e3:4e3}),l()&&await K()}async function nt(){const e=u.peek();if(await E.confirm(`Delete ALL ${x.peek()} entries in \u201C${U(e?.title||a)}\u201D? This cannot be undone.`)){L.value=!0;try{await k.collections.clearEntries(a),r.value=[],x.value=0,g.value=[],P("#/collections"),E.toast("All entries deleted.",{type:"success"})}catch(t){E.toast(`Not cleared: ${t.message||t}`,{type:"error"})}finally{L.value=!1}}}async function at(e){try{const t=await k.collections.createEntry(a,{...e.data||{}});r.value=[t,...r.peek()],x.value=x.peek()+1,P("#/collections"),E.toast("Duplicated - the copy is at the top.",{type:"success"})}catch(t){E.toast(`Not duplicated: ${t.message||t}`,{type:"error"})}}async function st(e,t){const n=e.trigger?.confirmMessage;if(!(n&&!await E.confirm(U(n)))){L.value=!0;try{const o=await k.actions.execute(e.slug,t.id);if(o?.success){const s=o.stepsCompleted??0;E.toast(`${e.trigger?.label||e.title||"Action"} done (${s} step${s===1?"":"s"}).`,{type:"success"}),l()&&await K()}else E.toast(o?.results?.find(s=>!s.success)?.error||"The action failed.",{type:"error"})}catch(o){E.toast(o.message||"The action failed.",{type:"error"})}finally{L.value=!1}}}async function we(e){try{await navigator.clipboard.writeText(e),E.toast("Copied.",{type:"success",duration:1500})}catch{E.toast("Copy failed - your browser refused the clipboard.",{type:"error"})}}function ue(e){const t=g.peek();g.value=t.includes(e)?t.filter(n=>n!==e):[...t,e]}function Se(e,t,n){w.value=[...w.peek(),{field:e.name,label:e.label||e.name,op:t,value:n}],N.value=X}const pe=new Set;let O=null,Ce=!1;function $e(e,t,n){const o=e.close.bind(e);let s=!1,f=!1;e.close=async i=>{if(!s&&i!==!0&&!Ce&&t()){if(f)return;f=!0;const h=await E.confirm(n);if(f=!1,!h)return}return s=!0,o()}}function ne(e,t=()=>{}){pe.add(e),yt(e,()=>{pe.delete(e),t()})}function z(e,t=null){const n=u.peek(),o=te().filter(y=>Nt(y,e?.data)),s=te().filter(y=>!o.includes(y)),f=Object.fromEntries(o.filter(y=>e?.data&&y.name in e.data).map(y=>[y.name,e.data[y.name]])),i=!!e,h=E.slideover({title:i?`Edit ${U(W(e))}`:"New entry",size:"md",position:"right"}),d=le(`
|
|
8
8
|
<div class="cex-form">
|
|
9
9
|
<div class="cex-fields"></div>
|
|
10
10
|
<small class="cex-hint cex-when-line"></small>
|
|
@@ -15,7 +15,7 @@ import{api as k,apiRequest as pt}from"../api.js";import{addBannerAction as j}fro
|
|
|
15
15
|
<button type="button" class="btn btn-sm btn-ghost" data-act="cancel">Cancel</button>
|
|
16
16
|
<button type="button" class="btn btn-sm btn-primary" data-act="save"><span data-icon="check" data-icon-size="13"></span> <span class="cex-save-text"></span></button>
|
|
17
17
|
</div>
|
|
18
|
-
</div>`);d.querySelector(".cex-save-text").textContent=i?"Save":"Add entry";const v=d.querySelector(".cex-fields");for(const
|
|
18
|
+
</div>`);d.querySelector(".cex-save-text").textContent=i?"Save":"Add entry";const v=d.querySelector(".cex-fields");for(const y of o){if(!ve(f[y.name]))continue;const $=document.createElement("div");$.className="cex-files-field";const T=document.createElement("span");T.textContent=y.label||y.name,$.append(T,He(f[y.name])),v.before($)}F.create(It(s,n?.columns||2),e?.data||{},{layout:n?.layout||"stacked",columns:n?.columns||2,showSubmitButton:!1}).renderTo(v),s.forEach(y=>{if(y.type!=="date"||!y.name)return;const $=v.querySelector(`[name="${CSS.escape(y.name)}"]`);$&&$.type!=="date"&&($.type="date")}),e?.data&&Je(v,s,e.data),i&&e.meta?.createdAt&&(d.querySelector(".cex-when-line").textContent=`Created ${_(e.meta.createdAt)}${e.meta.updatedAt?`, last changed ${_(e.meta.updatedAt)}`:""}${e.meta.source?` \xB7 via ${e.meta.source}`:""}.`),h.element.appendChild(d);const ut=_e(ie(v,s));t&&Je(v,s,t);const me=()=>_e(ie(v,s))!==ut,pt=d.querySelector(".cex-dirty"),he=()=>{pt.hidden=!me()};v.addEventListener("input",he),v.addEventListener("change",he),he();let ye=!1;async function Re(){if(ye)return;document.activeElement?.dispatchEvent?.(new Event("change",{bubbles:!0}));const y={...i?e.data:{},...ie(v,s),...f};ye=!0;const $=d.querySelector('[data-act="save"]');$.disabled=!0;try{if(i){const T=await k.collections.updateEntry(a,e.id,y);r.value=r.peek().map(Ue=>Ue.id===e.id?T:Ue),E.toast("Entry saved.",{type:"success"})}else{const T=await k.collections.createEntry(a,y);r.value=[T,...r.peek()],x.value=x.peek()+1,P("#/collections"),E.toast("Entry added.",{type:"success"})}try{S.remove?S.remove(B(a)):S.set(B(a),null)}catch{}h.close(!0)}catch(T){E.toast(T.message||"Not saved.",{type:"error"})}finally{ye=!1,$.disabled=!1}}d.querySelector('[data-act="save"]').addEventListener("click",Re),d.querySelector('[data-act="cancel"]').addEventListener("click",()=>h.close()),d.addEventListener("keydown",y=>{(y.ctrlKey||y.metaKey)&&(y.key==="Enter"||y.key==="s")&&(y.preventDefault(),Re())});const Fe={id:e?.id??null,dirty:me,values:()=>xt(ie(v,s),s)};O=Fe,ne(h,()=>{O===Fe&&(O=null)}),$e(h,me,"Discard the changes you have not saved?"),I.scan(d),h.open(),v.querySelector("input, select, textarea")?.focus()}function ot(e){const t=E.slideover({title:U(W(e)),size:"md",position:"right"}),n=le(`
|
|
19
19
|
<div class="cex-form">
|
|
20
20
|
<dl class="cex-detail"></dl>
|
|
21
21
|
<div class="cex-meta"></div>
|
|
@@ -24,7 +24,7 @@ import{api as k,apiRequest as pt}from"../api.js";import{addBannerAction as j}fro
|
|
|
24
24
|
<span class="cex-spacer"></span>
|
|
25
25
|
<button type="button" class="btn btn-sm btn-primary" data-act="edit"><span data-icon="edit" data-icon-size="13"></span> Edit</button>
|
|
26
26
|
</div>
|
|
27
|
-
</div>`),o=n.querySelector(".cex-detail");for(const i of te()){const
|
|
27
|
+
</div>`),o=n.querySelector(".cex-detail");for(const i of te()){const h=ge(be(i,e.data?.[i.name])),d=document.createElement("dt");d.textContent=i.label||i.name;const v=document.createElement("dd");ve(e.data?.[i.name])?v.appendChild(He(e.data[i.name])):v.textContent=h===""?"-":h,o.append(d,v)}const s=n.querySelector(".cex-meta"),f=i=>{const h=document.createElement("span");h.textContent=i,s.appendChild(h)};f(`Id: ${e.id}`),e.meta?.createdAt&&f(`Created: ${_(e.meta.createdAt)}`),e.meta?.updatedAt&&f(`Changed: ${_(e.meta.updatedAt)}`),e.meta?.source&&f(`Source: ${e.meta.source}`),n.querySelector('[data-act="copy"]').addEventListener("click",()=>we(JSON.stringify(e,null,2))),n.querySelector('[data-act="edit"]').addEventListener("click",()=>{t.close(!0),z(e)}),t.element.appendChild(n),ne(t),I.scan(n),t.open()}function ct(){const e=E.slideover({title:"Import entries",size:"md",position:"right"}),t=le(`
|
|
28
28
|
<div class="cex-form">
|
|
29
29
|
<p class="cex-hint">A JSON array of entries, each with a "data" object of field values - what Export gives you.
|
|
30
30
|
<span data-help="Each entry is added as new, with a new id and today's date (the Data Transfer plugin from the Marketplace keeps ids and dates). Entries are checked like any other save - one that fails, or points a reference at an entry that does not exist, is skipped and reported. Values are stored as given, including fields the collection does not have."></span></p>
|
|
@@ -40,11 +40,11 @@ import{api as k,apiRequest as pt}from"../api.js";import{addBannerAction as j}fro
|
|
|
40
40
|
<button type="button" class="btn btn-sm btn-ghost" data-act="cancel">Cancel</button>
|
|
41
41
|
<button type="button" class="btn btn-sm btn-primary" data-act="import"><span data-icon="upload" data-icon-size="13"></span> Import</button>
|
|
42
42
|
</div>
|
|
43
|
-
</div>`),n=t.querySelector("textarea"),o=t.querySelector(".cex-err"),s=t.querySelector(".cex-ok"),f=t.querySelector('input[type="file"]');t.querySelector('[data-act="file"]').addEventListener("click",()=>f.click()),f.addEventListener("change",async()=>{const
|
|
43
|
+
</div>`),n=t.querySelector("textarea"),o=t.querySelector(".cex-err"),s=t.querySelector(".cex-ok"),f=t.querySelector('input[type="file"]');t.querySelector('[data-act="file"]').addEventListener("click",()=>f.click()),f.addEventListener("change",async()=>{const h=f.files?.[0];f.value="",h&&(n.value=await h.text())}),t.querySelector('[data-act="cancel"]').addEventListener("click",()=>e.close());let i=!1;t.querySelector('[data-act="import"]').addEventListener("click",async()=>{o.hidden=!0,s.hidden=!0;let h;try{if(h=JSON.parse(n.value),!Array.isArray(h))throw new Error("it must be a JSON array")}catch(v){o.textContent=`Not valid: ${v.message}`,o.hidden=!1;return}const d=t.querySelector('[data-act="import"]');d.disabled=!0;try{const v=await k.collections.import(a,h);s.textContent=`Imported ${v.imported}; skipped ${v.skipped}.`,s.hidden=!1,i=!0,P("#/collections"),l()&&await K(),setTimeout(()=>e.close(!0),1200)}catch(v){o.textContent=v.message||"Import failed.",o.hidden=!1}finally{d.disabled=!1}}),e.element.appendChild(t),ne(e),$e(e,()=>!i&&n.value.trim()!=="","Discard the entries you pasted?"),ze(t),I.scan(t),e.open(),n.focus()}function lt(){const e=E.slideover({title:"Export entries",size:"sm",position:"right"}),t=le(`
|
|
44
44
|
<div class="cex-form">
|
|
45
45
|
<p class="cex-hint">Every entry in the collection - not only the ones shown.</p>
|
|
46
46
|
<div class="cex-export">
|
|
47
47
|
<button type="button" class="btn btn-ghost" data-fmt="json"><span data-icon="download" data-icon-size="14"></span> Export as JSON</button>
|
|
48
48
|
<button type="button" class="btn btn-ghost" data-fmt="csv"><span data-icon="download" data-icon-size="14"></span> Export as CSV</button>
|
|
49
49
|
</div>
|
|
50
|
-
</div>`);t.querySelectorAll("[data-fmt]").forEach(n=>n.addEventListener("click",async()=>{const o=n.dataset.fmt;try{const s=await fetch(`/api/collections/${encodeURIComponent(a)}/export?format=${o}`,{headers:{Authorization:`Bearer ${S.get("auth_token")||""}`}});if(!s.ok)throw new Error(`${s.status}`);const f=await s.blob(),i=document.createElement("a");i.href=URL.createObjectURL(f),i.download=`${a}-entries.${o}`,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(i.href),1e3),e.close(!0)}catch(s){E.toast(`Export failed (${s.message}).`,{type:"error"})}})),e.element.appendChild(t),ne(e),I.scan(t),e.open()}function
|
|
50
|
+
</div>`);t.querySelectorAll("[data-fmt]").forEach(n=>n.addEventListener("click",async()=>{const o=n.dataset.fmt;try{const s=await fetch(`/api/collections/${encodeURIComponent(a)}/export?format=${o}`,{headers:{Authorization:`Bearer ${S.get("auth_token")||""}`}});if(!s.ok)throw new Error(`${s.status}`);const f=await s.blob(),i=document.createElement("a");i.href=URL.createObjectURL(f),i.download=`${a}-entries.${o}`,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(i.href),1e3),e.close(!0)}catch(s){E.toast(`Export failed (${s.message}).`,{type:"error"})}})),e.element.appendChild(t),ne(e),I.scan(t),e.open()}function it(e,t){const n=J(e.dataset.id);if(!n)return[];const o=t?.event?.target?.closest?.("td[data-col]"),s=o?de.peek()[Number(o.dataset.col)]:null,f=Ee(n.id),i=g.peek().includes(n.id),h=s?St(s,n.data?.[s.name]):[];return[{header:W(n)},{label:"Edit\u2026",icon:"edit",action:()=>z(n)},{label:"See all of it\u2026",icon:"eye",action:()=>ot(n)},{label:"Duplicate",icon:"copy",action:()=>at(n)},{label:"Copy id",icon:"hash",action:()=>we(n.id)},{label:i?"Deselect":"Select",icon:"check",action:()=>ue(n.id)},...f.length?[{type:"divider"},...f.map(d=>({label:`${d.trigger?.label||d.title||d.slug}\u2026`,icon:d.trigger?.icon||"zap",disabled:L.peek(),action:()=>st(d,n)}))]:[],...s?[{type:"divider"},{label:`Filter by ${s.label||s.name}`,icon:"filter",submenu:[...h.map(d=>({label:d.label,action:()=>Se(s,d.op,d.value)})),{label:`${s.label||s.name} contains\u2026`,action:async()=>{const d=await E.prompt(`Show entries whose ${U(s.label||s.name)} contains`,{inputPlaceholder:"text"});d&&String(d).trim()&&Se(s,"contains",String(d).trim())}}]}]:[],...w.peek().length?[{label:`Clear filters (${w.peek().length})`,icon:"x",action:()=>{w.value=[]}}]:[],{type:"divider"},{label:"Delete\u2026",icon:"trash",danger:!0,action:()=>xe(n)}]}const q=m.querySelector(".cex-rows"),G=m.querySelector(".cex-head"),fe=m.querySelector(".cex-chips-list");fe.innerHTML=qt;const ae=ht(m.querySelector(".dm-loading-slot"),mt.table);try{u.value=await k.collections.get(a)}catch(e){H.value=`Could not load the collection: ${e.message||e}`}if(!l()){ae.done();return}if(!u.peek()&&(await ae.done(),!H.peek())){E.toast("Collection not found.",{type:"error"}),R.navigate("/collections");return}const Ae=de.peek();q.innerHTML=Tt(Ae.length),G.replaceChildren();const se=(e,t)=>{const n=document.createElement("th");return e&&(n.className=e),t&&n.append(t),G.appendChild(n),n},A=document.createElement("input");A.type="checkbox",A.title="Select every entry shown",A.setAttribute("aria-label","Select every entry shown"),se("cex-check",A);const Me=(e,t)=>{const n=document.createElement("button");return n.type="button",n.dataset.sort=e,n.append(document.createTextNode(t),Object.assign(document.createElement("span"),{className:"cex-sort"})),n};Ae.forEach(e=>se("",Me(e.name,e.label||e.name))),se("cex-when",Me("created","Created")),se("cex-tools"),c(M.effect(()=>{const e=Z.value;G.querySelectorAll("[data-sort]").forEach(t=>{t.querySelector(".cex-sort").textContent=t.dataset.sort===e.key?e.dir==="asc"?"\u25B2":"\u25BC":"",t.parentElement.setAttribute("aria-sort",t.dataset.sort===e.key?e.dir==="asc"?"ascending":"descending":"none")})})),c(M.effect(()=>{const e=D.value.map(n=>n.id),t=new Set(g.value);A.checked=e.length>0&&e.every(n=>t.has(n)),A.indeterminate=!A.checked&&e.some(n=>t.has(n))}));const Le=e=>{const t=e.target.closest("[data-sort]");if(!t)return;const n=Z.peek();Z.value={key:t.dataset.sort,dir:n.key===t.dataset.sort&&n.dir==="asc"?"desc":"asc"}};G.addEventListener("click",Le),A.addEventListener("change",()=>{const e=D.peek().map(t=>t.id);g.value=A.checked?[...new Set([...g.peek(),...e])]:g.peek().filter(t=>!e.includes(t))}),c(()=>G.removeEventListener("click",Le));const rt=M.applyBindings(Ye,m,{methods:{clearSelection:()=>{g.value=[]},deleteSelected:()=>tt(),clearAll:()=>nt(),clearFilters:()=>{w.value=[]},showMore:()=>{D.peek().length>N.peek()?N.value=N.peek()+X:Ze()}}});c(()=>rt.dispose()),c(ze(m,{position:"bottom"})),c(M.effect(()=>{re.value,w.value,N.value=X}));const qe=e=>{const t=e.target.closest("button[data-idx]");if(!t)return;const n=Number(t.dataset.idx);w.value=w.peek().filter((o,s)=>s!==n)};fe.addEventListener("click",qe),c(()=>fe.removeEventListener("click",qe));const dt=E.contextMenu(q,{cursor:"glyph",match:".cex-row",inherit:!1,density:"compact",items:(e,t)=>it(e,t)});c(()=>dt?.destroy?.());const Te=e=>{const t=e.target.closest(".cex-row");if(!t)return;if(e.target.closest(".cex-kebab, .cex-run")){je(e.target.closest(".cex-kebab, .cex-run"));return}if(e.target.closest(".cex-check"))return;const n=J(t.dataset.id);n&&z(n)},Ne=e=>{if(!e.target.matches(".cex-sel"))return;const t=e.target.closest(".cex-row");t&&ue(t.dataset.id)},Ie=e=>{const t=e.target.closest(".cex-row");if(!t||e.target!==t)return;const n=J(t.dataset.id);n&&(e.key==="F10"&&e.shiftKey?(e.preventDefault(),je(t)):e.key==="Enter"?(e.preventDefault(),z(n)):e.key===" "?(e.preventDefault(),ue(n.id)):e.key==="Delete"&&(e.preventDefault(),xe(n)))};q.addEventListener("click",Te),q.addEventListener("change",Ne),q.addEventListener("keydown",Ie),c(()=>{q.removeEventListener("click",Te),q.removeEventListener("change",Ne),q.removeEventListener("keydown",Ie)});const De=u.peek(),oe=p.get(0).querySelector(".dm-plugin-banner-name")?.querySelector(".dm-plugin-banner-sep");if(oe&&De?.title){for(;oe.nextSibling;)oe.nextSibling.remove();oe.after(document.createTextNode(De.title))}j(p,{id:"entries-back",icon:"arrow-left",title:"All collections",onClick:()=>{location.hash="#/collections"}}),j(p,{id:"entries-fields",icon:"edit-3",title:"Edit its fields and settings",onClick:()=>{location.hash=`#/collections/edit/${encodeURIComponent(a)}`}}),$t(a)&&j(p,{id:"entries-form",icon:"layout",title:"Open its form",onClick:()=>{location.hash=`#/forms/edit/${encodeURIComponent(a)}`}}),j(p,{id:"entries-export",icon:"download",title:"Export",onClick:()=>lt()}),j(p,{id:"entries-import",icon:"upload",title:"Import",onClick:()=>ct()}),j(p,{id:"entries-add",icon:"plus",title:"Add entry",onClick:()=>z(null)});const Oe=e=>{O?.dirty()&&(e.preventDefault(),e.returnValue="")};if(window.addEventListener("beforeunload",Oe),c(()=>window.removeEventListener("beforeunload",Oe)),c(()=>{if(O?.dirty())try{S.set(B(a),{id:O.id,values:O.values(),at:new Date().toISOString()})}catch{}Ce=!0,[...pe].forEach(e=>{try{e.close(!0)}catch{}})}),I.scan(m),!u.peek()){Y.value=!1;return}if(await Qe(),!l()){ae.done();return}if(await K({pending:ae}),!l())return;let C=null;try{C=S.get(B(a))}catch{}if(C?.values){try{S.remove?S.remove(B(a)):S.set(B(a),null)}catch{}let e=C.id?J(C.id):null;if(C.id&&!e&&(e=await k.collections.getEntry(a,C.id).catch(()=>null)),!l()||C.id&&!e)return;const t=e?`your changes to \u201C${U(W(e))}\u201D`:"a new entry",n=e?.meta?.updatedAt&&C.at&&e.meta.updatedAt>C.at?" It has been changed since - check before saving.":"";await E.confirm(`You left ${t} unsaved.${n} Pick up where you left off?`)&&l()&&z(e,C.values)}}};
|