domma-cms 1.30.1 → 1.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/CLAUDE.md +36 -1
  3. package/admin/js/api.js +1 -1
  4. package/admin/js/lib/block-packs.js +26 -0
  5. package/admin/js/lib/block-tags.js +6 -1
  6. package/admin/js/lib/blocks-arrange.js +1 -1
  7. package/admin/js/lib/collection-editor-arrange.js +1 -1
  8. package/admin/js/lib/collection-entries-arrange.js +1 -1
  9. package/admin/js/lib/collections-arrange.js +1 -1
  10. package/admin/js/lib/list-tags-arrange.js +1 -1
  11. package/admin/js/lib/list-tags.js +9 -7
  12. package/admin/js/lib/pages-arrange.js +1 -1
  13. package/admin/js/lib/shortcode-context-menu.js +1 -1
  14. package/admin/js/lib/shortcode-form.js +7 -4
  15. package/admin/js/templates/blocks.html +5 -3
  16. package/admin/js/templates/collections.html +12 -2
  17. package/admin/js/templates/docs/usage-blocks.html +28 -1
  18. package/admin/js/templates/pages.html +5 -3
  19. package/admin/js/views/blocks.js +5 -4
  20. package/admin/js/views/collection-editor.js +10 -4
  21. package/admin/js/views/collection-entries.js +2 -2
  22. package/admin/js/views/collections.js +6 -5
  23. package/admin/js/views/page-editor.js +1 -1
  24. package/admin/js/views/pages.js +4 -4
  25. package/docs/DommaFeatures.md +156 -5
  26. package/docs/api-reference.md +8 -6
  27. package/docs/markdown-shortcodes.md +22 -1
  28. package/docs/starter-blocks.md +70 -1
  29. package/package.json +1 -1
  30. package/public/css/site.css +1 -1
  31. package/public/js/collection-browser.js +1 -1
  32. package/server/blocks/catalog.json +6 -0
  33. package/server/blocks/domma-block-cushion-card.css +30 -0
  34. package/server/blocks/domma-block-cushion-card.html +11 -0
  35. package/server/blocks/domma-block-cushion-card.meta.json +7 -0
  36. package/server/routes/api/block-packs.js +55 -0
  37. package/server/routes/api/blocks.js +16 -2
  38. package/server/routes/api/collections.js +9 -1
  39. package/server/routes/api/list-tags.js +35 -10
  40. package/server/routes/api/pages.js +16 -2
  41. package/server/services/block-pack-assets.js +6 -0
  42. package/server/services/block-packs.js +291 -0
  43. package/server/services/block-slots.js +43 -0
  44. package/server/services/block-write-lock.js +44 -0
  45. package/server/services/blocks.js +18 -3
  46. package/server/services/collections.js +6 -0
  47. package/server/services/listTags.js +243 -47
  48. package/server/services/markdown.js +105 -8
  49. package/server/services/starter-block-packs.js +22 -0
  50. package/server/templates/page.html +2 -2
@@ -444,15 +444,17 @@ Delete a page.
444
444
 
445
445
  ## List tags (`/api/list-tags/:kind`)
446
446
 
447
- Admin-only tags that link pages or blocks together, so the admin lists can be narrowed to one tag. `:kind` is `pages` or `blocks`. A page stores its tags as `adminTags` in its frontmatter, and a block in `meta.adminTags`. The names are kept in `config/list-tags.json`. Nothing on the public site reads them. Every change applies only to the items the caller's projects allow.
447
+ Admin-only tags that link pages, blocks or collections together, so the admin lists can be narrowed to one tag. `:kind` is `pages`, `blocks` or `collections`. A page stores its tags as `adminTags` in its frontmatter and a block in `meta.adminTags`; a collection's are kept in `config/list-tags.json` as `collectionTags: {slug: [tags]}` (never in its `schema.json`, which presets rewrite on boot), and come back as `adminTags` on each row of `GET /api/collections`. The names are kept in `config/list-tags.json` too. Nothing on the public site reads them. Every change applies only to the items the caller's projects allow. Pages and blocks need the `pages` permission; collections need `collections` (read to list, update to change).
448
+
449
+ **Tool tags.** Everything a Tool owns wears that Tool's name as a tag, worked out on each request and never stored: a collection's `plugin` (and the built-in Notes, Todo and Contacts collections), a block's `meta.plugin`, a page's frontmatter `plugin`. The name is the plugin manifest's `displayName` (or the built-in Tool's name), else the slug in title case. They come back with `tool: true`; they cannot be added, renamed or deleted, and no manual tag may take a Tool tag's name (400).
448
450
 
449
451
  | Method | Path | Body | Auth |
450
452
  |--------|------|------|------|
451
- | GET | `/api/list-tags/:kind` | - | `pages:read` - `{tags: [{name, count}]}` |
452
- | POST | `/api/list-tags/:kind` | `{name}` | `pages:update` - creates a tag |
453
- | PUT | `/api/list-tags/:kind/item` | `{id, tags}` | `pages:update` - `id` is the page's urlPath or the block's name; adds no page revision |
454
- | POST | `/api/list-tags/:kind/rename` | `{from, to}` | `pages:update` - `{name, changed}`; renaming onto an existing tag merges the two |
455
- | POST | `/api/list-tags/:kind/delete` | `{name}` | `pages:update` - `{changed}`; the items stay |
453
+ | GET | `/api/list-tags/:kind` | - | read - `{tags: [{name, count, tool?}], tools: {slug: displayName}}` |
454
+ | POST | `/api/list-tags/:kind` | `{name}` | update - creates a tag |
455
+ | PUT | `/api/list-tags/:kind/item` | `{id, tags}` or `{id, add, remove}` | update - `id` is the page's urlPath, the block's name or the collection's slug; adds no page revision |
456
+ | POST | `/api/list-tags/:kind/rename` | `{from, to}` | update - `{name, changed}`; renaming onto an existing tag merges the two |
457
+ | POST | `/api/list-tags/:kind/delete` | `{name}` | update - `{changed}`; the items stay |
456
458
 
457
459
  ---
458
460
 
@@ -4,7 +4,7 @@ Domma CMS extends standard Markdown with shortcodes - special tags you write in
4
4
 
5
5
  All shortcode attributes accept single or double quotes, and bare flags (e.g. `hover`, `dismissible`) are allowed.
6
6
  Most shortcodes are skipped inside fenced code blocks and inline code, so you can show shortcode syntax on a page
7
- (`[block]` / block short tags and `[banner]` are the exceptions - they are expanded even inside code).
7
+ (`[banner]` is the exception - it is expanded even inside code).
8
8
 
9
9
  ## Expiring any shortcode
10
10
 
@@ -1328,6 +1328,27 @@ action directly is the action's own `access` (its roles and `rowLevel`), so give
1328
1328
 
1329
1329
  ---
1330
1330
 
1331
+ ### Custom Block slots
1332
+
1333
+ Custom Blocks can declare `<slot>Fallback Markdown</slot>` for their default
1334
+ content, and `<slot name="footer"></slot>` for named content. Parameters such
1335
+ as `{{heading}}` remain separate and unchanged. Call the block with paired tags:
1336
+
1337
+ ```text
1338
+ [domma-block-cushion-card heading="Your heading"]
1339
+ **Body content**, built-in shortcodes, plugin shortcodes and other blocks.
1340
+ [slot name="footer"]
1341
+ [button url="/contact"]Contact us[/button]
1342
+ [/slot]
1343
+ [/domma-block-cushion-card]
1344
+ ```
1345
+
1346
+ The generic `[block template="name"]...[/block]` form also works. Existing
1347
+ self-closing calls remain valid and use a slotted template's fallbacks.
1348
+ Slots render through the full CMS pipeline, carry collection/view cache tags,
1349
+ viewer-specific flags and component dependencies, and keep code examples and
1350
+ collection values inert. Maximum nesting is 24 levels and 500 expansions.
1351
+
1331
1352
  ### `[block]`
1332
1353
 
1333
1354
  Renders a single block template with static inline data. Use this for one-off content where creating a full Collection
@@ -1,6 +1,6 @@
1
1
  # Domma block library
2
2
 
3
- Sixteen free, editable Custom Blocks come with every Domma CMS site. There is
3
+ Seventeen free, editable Custom Blocks come with every Domma CMS site. There is
4
4
  no extra licence or plugin to install. Search for `domma-block-` in **Blocks**
5
5
  or in the editor's **Add block** menu. Each block includes its own scoped CSS,
6
6
  a copyable example and documented parameters.
@@ -201,3 +201,72 @@ contact strip or branded header around the existing navigation. They are a
201
201
  proposed extension, not part of this library change. Replacing the full navigation
202
202
  would also need to retain mobile controls, keyboard access and the visitor's
203
203
  current-page indication.
204
+
205
+
206
+ ## Cushion card and rich content slots
207
+
208
+ `domma-block-cushion-card` has a soft outer rim and an inset panel. `heading`
209
+ and `icon` remain ordinary parameters. The default slot holds its content;
210
+ `footer` is a named slot. Both accept Markdown, built-in shortcodes, plugin
211
+ shortcodes and nested Custom Blocks.
212
+
213
+ ```text
214
+ [domma-block-cushion-card heading="Made for you" icon="sparkles"]
215
+ Write **formatted content**, add images, or insert other blocks here.
216
+ [slot name="footer"]
217
+ [button url="/contact"]Get in touch[/button]
218
+ [/slot]
219
+ [/domma-block-cushion-card]
220
+ ```
221
+
222
+ A template declares slots with `<slot>Fallback content</slot>` and
223
+ `<slot name="footer">Optional fallback</slot>`. Slot names and parameter
224
+ names are separate. Slot content is rendered once through the normal CMS
225
+ pipeline and sanitised. Code examples remain literal, and collection values
226
+ remain data. Nesting is limited to 24 levels and 500 block expansions per
227
+ render. Existing self-closing blocks and escaped/raw parameters keep working.
228
+ Self-closing calls to slotted blocks use their fallback content.
229
+
230
+ In the page editor, Add block inserts slot scaffolding. The shortcode insert
231
+ form offers a separate content field for each slot.
232
+
233
+ ## Block packs
234
+
235
+ Open the package action in **Blocks** to create a versioned pack from selected
236
+ blocks, export a `.dmblockpack.json` file, import one into the local catalogue,
237
+ and preview an installation. Importing a file only adds it to the catalogue.
238
+ Installation is a separate, reviewed action. Site settings permissions govern
239
+ catalogue access and changes.
240
+
241
+ The bundled **Domma cards** pack includes the cushion, service, pricing,
242
+ profile and testimonial designs. Packs carry HTML, CSS, a stable ID, title,
243
+ version and compatibility requirements. Select local media when assembling a
244
+ pack to include its raster images or webfonts. The pack rewrites those HTML/CSS
245
+ references to versioned media URLs at installation, retaining older files for
246
+ rollback. Each asset can be up to 1 MB, within the pack's 2 MB total limit.
247
+ Remote media and formats such as SVG remain URL references. Asset packs use
248
+ schema 2 and are refused by sites without bundled media support. A pack
249
+ can declare `requires.cms` (a minimum CMS version), `requires.slots: 1`, and
250
+ `requires.plugins` (installed plugin slugs).
251
+
252
+ Published versions are immutable: use a new version for changes. Preview lists
253
+ creates, updates, removals, local conflicts and compatibility problems. Apply
254
+ requires the preview's token; a site changed since preview must be reviewed
255
+ again. Matching existing blocks can be adopted without changing their content.
256
+ Different existing blocks and blocks owned by another pack are never replaced.
257
+ Local edits or deletions prevent pack updates and rollback. Duplicate a block
258
+ before customising it to keep the managed original updatable.
259
+
260
+ Installations record history and snapshots for rollback. Rollback also checks
261
+ for local edits before restoring blocks. Pack files exclude site project tags
262
+ and runtime configuration. Pack catalogue, installation records and snapshots
263
+ live under `content/block-packs/` and should be included in site backups.
264
+
265
+ DCM's **Site Manager > Block packs** uses the same catalogue and adds sharing
266
+ with selected managed sites. Preview checks every selected site before apply.
267
+ Results report each site's success or failure; running sites restart briefly
268
+ to refresh cached pages. No fleet deployment happens merely by publishing a
269
+ pack. DCM can also roll back a pack on one selected site.
270
+
271
+ The existing Card builder and its shortcodes remain available. Designs can be
272
+ moved into packs incrementally without rewriting existing pages.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-cms",
3
- "version": "1.30.1",
3
+ "version": "1.32.0",
4
4
  "description": "File-based CMS powered by Domma and Fastify. Run npx domma-cms my-site to create a new project.",
5
5
  "type": "module",
6
6
  "main": "server/server.js",