domma-cms 0.9.5 → 0.9.6

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.
@@ -1,44 +1,38 @@
1
- import{api as c}from"../api.js";export const pluginsView={templateUrl:"/admin/js/templates/plugins.html",async onMount(d){const m=E.loader(d.get(0),{type:"dots"});let i=[];try{i=await c.plugins.list()}catch(e){E.toast(`Failed to load plugins: ${e.message}`,{type:"error"})}if(m.destroy(),!i.length){d.find("#plugins-empty").show();return}p(d,i),Domma.icons.scan()}};function p(d,m){const i=d.find("#plugins-grid").empty();m.forEach(e=>{const n=e.enabled?"badge-success":"badge-secondary",l=e.enabled?"Enabled":"Disabled",s=e.enabled?"Disable":"Enable",g=e.enabled?"btn-ghost":"btn-primary",u=e.bundled?'<span class="badge badge-outline" style="font-size:0.65rem;padding:1px 6px;color:var(--dm-info,#2563eb);border-color:var(--dm-info,#2563eb);" title="Included on fresh installs">Bundled</span>':"",r=e.author?`by ${a(e.author)}`:"",t=e.date?a(e.date):"",o=`
1
+ import{api as r}from"../api.js";export const pluginsView={templateUrl:"/admin/js/templates/plugins.html",async onMount(o){const m=E.loader(o.get(0),{type:"dots"});let i=[];try{i=await r.plugins.list()}catch(e){E.toast(`Failed to load plugins: ${e.message}`,{type:"error"})}if(m.destroy(),!i.length){o.find("#plugins-empty").show();return}g(o,i),Domma.icons.scan()}};function g(o,m){const i=o.find("#plugins-grid").empty();m.forEach(e=>{const n=e.enabled?"badge-success":"badge-secondary",l=e.enabled?"Enabled":"Disabled",s=e.enabled?"Disable":"Enable",v=e.enabled?"btn-ghost":"btn-primary",c=e.bundled?"var(--dm-info,#2563eb)":"var(--dm-secondary,#6b7280)",u=e.bundled?"Bundled \u2014 click to unbundle":"Not bundled \u2014 click to bundle",t=`<button class="badge badge-outline btn-bundle-plugin" data-name="${e.name}" data-bundled="${e.bundled?"1":"0"}" title="${u}" style="font-size:0.65rem;padding:1px 6px;cursor:pointer;background:none;border:1px solid;color:${c};border-color:${c};">${e.bundled?"Bundled":"Unbundled"}</button>`,d=e.author?`by ${a(e.author)}`:"",p=e.date?a(e.date):"",b=`
2
2
  <div class="card plugin-card" data-plugin="${e.name}">
3
3
  <div class="card-body">
4
4
  <div class="plugin-header">
5
5
  <div class="plugin-icon"><span data-icon="${e.icon||"package"}"></span></div>
6
6
  <div class="plugin-meta">
7
7
  <div class="plugin-name">${a(e.displayName)}</div>
8
- <div class="plugin-version">v${a(e.version)}${r?` &middot; ${r}`:""}</div>
8
+ <div class="plugin-version">v${a(e.version)}${d?` &middot; ${d}`:""}</div>
9
9
  </div>
10
10
  <div style="display:flex;gap:.35rem;align-items:center;">
11
- ${u}
11
+ ${t}
12
12
  <span class="badge ${n}">${l}</span>
13
13
  </div>
14
14
  </div>
15
15
  <p class="plugin-desc">${a(e.description)}</p>
16
- ${t?`<p class="plugin-date text-muted" style="font-size:.8rem;margin:0">Released ${t}</p>`:""}
16
+ ${p?`<p class="plugin-date text-muted" style="font-size:.8rem;margin:0">Released ${p}</p>`:""}
17
17
  </div>
18
18
  <div class="plugin-footer">
19
19
  <span class="text-muted" style="font-size:.8rem">Restart server after changes</span>
20
20
  <div class="plugin-footer-actions">
21
21
  ${e.settingsSchema?`<button class="btn btn-sm btn-ghost btn-plugin-settings" data-name="${e.name}">Settings</button>`:""}
22
- <button class="btn btn-sm btn-ghost btn-bundle-plugin"
23
- data-name="${e.name}"
24
- data-bundled="${e.bundled?"1":"0"}"
25
- title="${e.bundled?"Remove from fresh install bundle":"Include in fresh install bundle"}">
26
- ${e.bundled?"Unbundle":"Bundle"}
27
- </button>
28
- <button class="btn btn-sm ${g} btn-toggle-plugin"
22
+ <button class="btn btn-sm ${v} btn-toggle-plugin"
29
23
  data-name="${e.name}"
30
24
  data-enabled="${e.enabled?"1":"0"}">
31
25
  ${s}
32
26
  </button>
33
27
  </div>
34
28
  </div>
35
- </div>`;i.append(o)}),Domma.icons.scan(),Domma.effects.reveal(".plugin-card",{animation:"fade",stagger:60,duration:400}),Domma.effects.ripple(".btn-toggle-plugin"),i.on("click",".btn-plugin-settings",async function(){const e=$(this).data("name"),n=m.find(t=>t.name===e);if(!n?.settingsSchema)return;const s=`<form id="plugin-settings-form">${n.settingsSchema.map(t=>{const o=n.settings?.[t.key]??t.default??"";if(t.type==="select"){const v=t.options.map(b=>`<option value="${a(b.value)}"${String(o)===String(b.value)?" selected":""}>${a(b.label)}</option>`).join("");return`<div class="form-group">
29
+ </div>`;i.append(b)}),Domma.icons.scan(),Domma.effects.reveal(".plugin-card",{animation:"fade",stagger:60,duration:400}),Domma.effects.ripple(".btn-toggle-plugin"),i.on("click",".btn-plugin-settings",async function(){const e=$(this).data("name"),n=m.find(t=>t.name===e);if(!n?.settingsSchema)return;const s=`<form id="plugin-settings-form">${n.settingsSchema.map(t=>{const d=n.settings?.[t.key]??t.default??"";if(t.type==="select"){const p=t.options.map(b=>`<option value="${a(b.value)}"${String(d)===String(b.value)?" selected":""}>${a(b.label)}</option>`).join("");return`<div class="form-group">
36
30
  <label class="form-label">${a(t.label)}</label>
37
- <select class="form-control" name="${a(t.key)}">${v}</select>
31
+ <select class="form-control" name="${a(t.key)}">${p}</select>
38
32
  </div>`}return t.type==="number"?`<div class="form-group">
39
33
  <label class="form-label">${a(t.label)}</label>
40
- <input class="form-control" type="number" name="${a(t.key)}" value="${a(String(o))}"${t.min!=null?` min="${t.min}"`:""}${t.max!=null?` max="${t.max}"`:""}>
34
+ <input class="form-control" type="number" name="${a(t.key)}" value="${a(String(d))}"${t.min!=null?` min="${t.min}"`:""}${t.max!=null?` max="${t.max}"`:""}>
41
35
  </div>`:`<div class="form-group">
42
36
  <label class="form-label">${a(t.label)}</label>
43
- <input class="form-control" type="text" name="${a(t.key)}" value="${a(String(o))}">
44
- </div>`}).join("")}</form>`;if(!await E.confirm(s,{title:`${a(n.displayName)} Settings`,confirmText:"Save",cancelText:"Cancel",html:!0}))return;const u=document.getElementById("plugin-settings-form");if(!u)return;const r={};n.settingsSchema.forEach(t=>{const o=u.elements[t.key];o&&(r[t.key]=t.type==="number"?Number(o.value):o.value)});try{await c.plugins.update(e,{settings:r}),n.settings={...n.settings,...r},E.toast("Settings saved.",{type:"success"})}catch(t){E.toast(`Failed to save: ${t.message}`,{type:"error"})}}),i.on("click",".btn-bundle-plugin",async function(){const e=$(this),n=e.data("name"),l=e.data("bundled")!==1&&e.data("bundled")!=="1";e.prop("disabled",!0).text(l?"Bundling\u2026":"Unbundling\u2026");try{await c.plugins.update(n,{bundled:l}),E.toast(`Plugin ${l?"marked as bundled":"unbundled"}.`,{type:"success"});const s=await c.plugins.list();p(d,s)}catch(s){E.toast(`Failed: ${s.message}`,{type:"error"}),e.prop("disabled",!1)}}),i.on("click",".btn-toggle-plugin",async function(){const e=$(this),n=e.data("name"),l=e.data("enabled")!==1&&e.data("enabled")!=="1";e.prop("disabled",!0).text(l?"Enabling\u2026":"Disabling\u2026");try{await c.plugins.update(n,{enabled:l}),E.toast(`Plugin ${l?"enabled":"disabled"}. Restart the server to apply changes.`,{type:"success"});const s=await c.plugins.list();p(d,s)}catch(s){E.toast(`Failed: ${s.message}`,{type:"error"}),e.prop("disabled",!1)}})}function a(d){return String(d).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}
37
+ <input class="form-control" type="text" name="${a(t.key)}" value="${a(String(d))}">
38
+ </div>`}).join("")}</form>`;if(!await E.confirm(s,{title:`${a(n.displayName)} Settings`,confirmText:"Save",cancelText:"Cancel",html:!0}))return;const c=document.getElementById("plugin-settings-form");if(!c)return;const u={};n.settingsSchema.forEach(t=>{const d=c.elements[t.key];d&&(u[t.key]=t.type==="number"?Number(d.value):d.value)});try{await r.plugins.update(e,{settings:u}),n.settings={...n.settings,...u},E.toast("Settings saved.",{type:"success"})}catch(t){E.toast(`Failed to save: ${t.message}`,{type:"error"})}}),i.on("click",".btn-bundle-plugin",async function(){const e=$(this),n=e.data("name"),l=e.data("bundled")!==1&&e.data("bundled")!=="1";e.prop("disabled",!0).text(l?"Bundling\u2026":"Unbundling\u2026");try{await r.plugins.update(n,{bundled:l}),E.toast(`Plugin ${l?"marked as bundled":"unbundled"}.`,{type:"success"});const s=await r.plugins.list();g(o,s)}catch(s){E.toast(`Failed: ${s.message}`,{type:"error"}),e.prop("disabled",!1)}}),i.on("click",".btn-toggle-plugin",async function(){const e=$(this),n=e.data("name"),l=e.data("enabled")!==1&&e.data("enabled")!=="1";e.prop("disabled",!0).text(l?"Enabling\u2026":"Disabling\u2026");try{await r.plugins.update(n,{enabled:l}),E.toast(`Plugin ${l?"enabled":"disabled"}. Restart the server to apply changes.`,{type:"success"});const s=await r.plugins.list();g(o,s)}catch(s){E.toast(`Failed: ${s.message}`,{type:"error"}),e.prop("disabled",!1)}})}function a(o){return String(o).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "theme-switcher": {
3
3
  "enabled": false,
4
- "settings": {}
4
+ "settings": {},
5
+ "bundled": true
5
6
  },
6
7
  "contacts": {
7
8
  "enabled": true,
@@ -12,19 +13,8 @@
12
13
  "settings": {}
13
14
  },
14
15
  "site-search": {
15
- "enabled": true,
16
- "settings": {
17
- "placeholder": "Search pages...",
18
- "keyboardShortcut": true,
19
- "maxResults": 10,
20
- "minQueryLength": 2,
21
- "debounceMs": 300,
22
- "displayMode": "floating",
23
- "position": "top-right",
24
- "offsetX": 16,
25
- "offsetY": 64,
26
- "iconOnly": true
27
- }
16
+ "enabled": false,
17
+ "settings": {}
28
18
  },
29
19
  "notes": {
30
20
  "enabled": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-cms",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "File-based CMS powered by Domma and Fastify. Run npx domma-cms my-site to create a new project.",
5
5
  "type": "module",
6
6
  "main": "server/server.js",
@@ -88,6 +88,7 @@ export const notesView = {
88
88
 
89
89
  notesTable = T.create('#notes-table', {
90
90
  data: notes,
91
+ onRender: (el) => Domma.icons.scan(el),
91
92
  columns: [
92
93
  {
93
94
  key: 'title',
@@ -81,6 +81,7 @@ export const todoView = {
81
81
 
82
82
  todoTable = T.create('#todo-table', {
83
83
  data: filtered,
84
+ onRender: (el) => Domma.icons.scan(el),
84
85
  columns: [
85
86
  {
86
87
  key: 'status',