domma-cms 0.42.0 → 0.44.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 (36) hide show
  1. package/CLAUDE.md +36 -2
  2. package/admin/js/templates/collection-editor.html +1 -1
  3. package/admin/js/templates/effects.html +752 -752
  4. package/admin/js/templates/forms.html +17 -17
  5. package/admin/js/templates/my-profile.html +17 -17
  6. package/admin/js/templates/role-editor.html +70 -70
  7. package/admin/js/templates/roles.html +10 -10
  8. package/admin/js/views/action-editor.js +1 -1
  9. package/admin/js/views/block-editor.js +2 -2
  10. package/admin/js/views/collection-editor.js +4 -4
  11. package/admin/js/views/form-editor.js +6 -6
  12. package/admin/js/views/navigation.js +16 -16
  13. package/admin/js/views/page-editor.js +41 -41
  14. package/admin/js/views/view-editor.js +1 -1
  15. package/bin/lib/config-merge.js +44 -44
  16. package/config/plugins.json +1 -1
  17. package/config/site.json +86 -86
  18. package/package.json +1 -1
  19. package/public/css/site.css +1 -1
  20. package/public/js/collection-context.js +2 -2
  21. package/public/js/collection-export.mjs +3 -0
  22. package/public/js/collection-query.mjs +1 -0
  23. package/public/js/collection-sort.mjs +1 -0
  24. package/public/js/site.js +1 -1
  25. package/scripts/build.js +94 -0
  26. package/scripts/setup.js +23 -2
  27. package/server/middleware/auth.js +253 -253
  28. package/server/routes/api/auth.js +309 -309
  29. package/server/routes/api/navigation.js +42 -42
  30. package/server/services/collections.js +12 -11
  31. package/server/services/email.js +167 -167
  32. package/server/services/markdown.js +106 -33
  33. package/server/services/userProfiles.js +199 -199
  34. package/server/services/users.js +302 -302
  35. package/server/templates/page.html +1 -1
  36. package/config/navigation.json.bak +0 -31
package/CLAUDE.md CHANGED
@@ -112,8 +112,9 @@ Collection entry I/O is delegated to a storage adapter. Schema management is alw
112
112
  Roles are **dynamic** — stored as entries in `content/collections/user-types/` (a preset collection).
113
113
  Seeded on first run with: `admin`, `manager`, `editor`, `subscriber`.
114
114
 
115
- - `server/services/userTypes.js` — `seed()`, `load()`, `invalidate()`, `getRoleLevel(role)`, `getPermissionsFor(resource)`, `getRoleHierarchy()`
116
- - `server/services/roles.js` — role helper utilities
115
+ - `server/services/roles.js` — `seed()`, `load()`, `invalidate()`, `getRoleLevel(role)`,
116
+ `getPermissionsFor(resource)`, `getRoleHierarchy()` (returns role names sorted most-privileged
117
+ first, level 0 = admin, so the least-privileged role is `.at(-1)`)
117
118
  - `server/services/permissionRegistry.js` — central permission map; route guards read the cache at request time
118
119
  - `server/services/rowAccess.js` — row-level access control for collections
119
120
  - Route guards use `requirePermission('resource')`, **not** hardcoded role names
@@ -159,6 +160,39 @@ Menus live in `config/menus/<slug>.json`. The slot → menu map lives in `config
159
160
 
160
161
  The admin sidebar is now menu-data-driven — no more hardcoded `sidebar-config.js`. The menu lives at `config/menus/admin-sidebar.json` and is auto-seeded on first boot (idempotent, file-existence guarded) with the standard tree: Overview, Projects, Content, Data, System, Documentation. Renderer is at `admin/js/lib/sidebar-renderer.js`; it reads the menu, merges in plugin-registered items (via `hooks.registerSidebarItem({parent, item})`), filters by each item's optional `permission` field, then mounts. The **Menus** admin can edit the sidebar visually like any other menu — the item editor exposes the new `permission` field on each row (resource key from `permissionRegistry`). Plugin-injected items are render-time only and not shown in the Menus editor; admins hide them by adding a same-`text` item with `hidden: true` to the persisted menu.
161
162
 
163
+ ## Collection displays & public filtering
164
+
165
+ `[collection]` and `[view]` render in any of table, cards, list, block, accordion, timeline,
166
+ carousel or listgroup (`display="…"`). Rendering is server-side in `markdown.js`; the browser
167
+ modules below add behaviour on top.
168
+
169
+ **Right-click menu** (`public/js/collection-context.js`, loaded as `type="module"` from
170
+ `server/templates/page.html`) works on the public site, not just the admin. Every
171
+ collection-rendered display carries a `data-ctx` payload (tables instead hydrate via `site.js`);
172
+ right-clicking inside one opens a menu of filters derived from the clicked entry's fields, plus
173
+ free-text search, sort, group-by, export, copy (CSV/JSON/Markdown to clipboard), print and
174
+ "copy link to this view". Active filters appear as removable chips above the display. Sort,
175
+ filters and grouping all persist in the URL hash (`dmf=`), so a filtered/sorted/grouped view can
176
+ be bookmarked or shared. Each display type filters differently — timeline via the Progression
177
+ instance's `.setItems()`, carousel by rebuilding the track from pristine slide copies and
178
+ re-initialising, table by re-creating the Domma table with the row subset, everything else by
179
+ toggling a hidden class on `[data-entry-id]`. Grouping needs entries rendered as direct DOM
180
+ siblings, so it's only offered on the five toggle-based displays (cards, list, listgroup,
181
+ accordion, block) — table/timeline/carousel manage their own rendering and hide the "Group by…"
182
+ row. See `docs/markdown-shortcodes.md` for the full capability table per display type.
183
+
184
+ **Export permission** lives in the collection schema's `export` block (`enabled`, `access`,
185
+ `formats`) — see `docs/configuration.md`. It is a convenience gate, not an access boundary: entry
186
+ data is already in the page's `data-ctx` attribute, so it never stops a determined reader of page
187
+ source, only the download button shown to everyone else.
188
+
189
+ **Shared modules**: `public/js/collection-export.mjs` (CSV/JSON/Markdown serialisation dialect —
190
+ CSV formula-injection sanitising, BOM handling) is imported by BOTH the browser
191
+ (`collection-context.js`) and the server (`server/services/collections.js`), so admin exports and
192
+ public right-click exports are byte-identical for the same values. `public/js/collection-sort.mjs`
193
+ holds `compareValues`/`sortEntries` — the same comparison ladder backs both the sort menu and the
194
+ `gt`/`lt` right-click filters.
195
+
162
196
  ## Key Gotchas
163
197
 
164
198
  1. **Menu item sub-items**: use `items` key, NOT `children` — Domma navbar and the `[menu]` shortcode both read `items`.
@@ -14,7 +14,7 @@
14
14
  <div class="tab-list">
15
15
  <button class="tab-item active">Settings</button>
16
16
  <button class="tab-item">Fields</button>
17
- <button class="tab-item">API Access</button>
17
+ <button class="tab-item">API &amp; Export</button>
18
18
  <button class="tab-item" id="storage-tab-btn" style="display:none;">Storage</button>
19
19
  </div>
20
20
  <div class="tab-content">