domma-cms 0.6.4 → 0.6.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-cms",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
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",
@@ -6,7 +6,7 @@
6
6
  "/resources/typography": 4,
7
7
  "/resources": 13,
8
8
  "/resources/shortcodes": 14,
9
- "/resources/cards": 14,
9
+ "/resources/cards": 15,
10
10
  "/resources/interactive": 13,
11
11
  "/resources/grid": 6,
12
12
  "/forms": 14,
@@ -64,7 +64,7 @@ async function loadBlockTemplate(blockName) {
64
64
  * @param {object|null} ctaOpts - Optional CTA button options
65
65
  * @returns {string}
66
66
  */
67
- function renderCollectionBlocks(entries, blockTemplate, emptyMsg, ctaOpts) {
67
+ function renderCollectionBlocks(entries, blockTemplate, emptyMsg, ctaOpts, cols) {
68
68
  if (!entries.length) {
69
69
  return `<div class="dm-collection-display dm-collection-empty"><p>${escapeHtmlText(emptyMsg)}</p></div>`;
70
70
  }
@@ -88,7 +88,12 @@ function renderCollectionBlocks(entries, blockTemplate, emptyMsg, ctaOpts) {
88
88
  return html;
89
89
  });
90
90
 
91
- return `<div class="dm-collection-display dm-collection-blocks">\n${items.join('\n')}\n</div>`;
91
+ const validCols = ['2', '3', '4', '5', '6'].includes(String(cols)) ? cols : '';
92
+ const wrapperClass = validCols
93
+ ? `dm-collection-display dm-collection-blocks grid grid-cols-${validCols} gap-4`
94
+ : 'dm-collection-display dm-collection-blocks';
95
+
96
+ return `<div class="${wrapperClass}">\n${items.join('\n')}\n</div>`;
92
97
  }
93
98
 
94
99
  function renderCollectionTable(slug, entries, visibleFields, attrs, ctaOpts) {
@@ -333,7 +338,8 @@ async function processCollectionBlocks(markdown) {
333
338
  if (blockName) {
334
339
  try {
335
340
  const tpl = await loadBlockTemplate(blockName);
336
- replacement = renderCollectionBlocks(entries, tpl, emptyMsg, ctaOpts);
341
+ const cols = attrs.cols || '';
342
+ replacement = renderCollectionBlocks(entries, tpl, emptyMsg, ctaOpts, cols);
337
343
  } catch {
338
344
  replacement = `<div class="dm-collection-display dm-collection-empty"><p>Block template &ldquo;${escapeHtmlText(blockName)}&rdquo; not found.</p></div>`;
339
345
  }