@sleekcms/sync 1.2.3 → 1.3.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/README.md +2 -0
- package/dist/AGENT.md +58 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -272,12 +272,14 @@ Models describe the shape of your content. They're JSON-like files with unquoted
|
|
|
272
272
|
| `markdown` | Markdown string |
|
|
273
273
|
| `number` | Number |
|
|
274
274
|
| `boolean` | `true` / `false` |
|
|
275
|
+
| `emoji` | Single Unicode emoji character, e.g. `"😀"` |
|
|
275
276
|
| `date` | `YYYY-MM-DD` |
|
|
276
277
|
| `image` | `{ url, alt }` |
|
|
277
278
|
| `video` | `{ url, embed }` |
|
|
278
279
|
| `link` | URL string |
|
|
279
280
|
| `json` | Object or array |
|
|
280
281
|
| `block(key)` | Embedded block object |
|
|
282
|
+
| `stack` | Array of heterogeneous block objects; each item carries `_block: "<block_key>"` to name its block |
|
|
281
283
|
| `entry(key)` | Entry object or slug reference |
|
|
282
284
|
|
|
283
285
|
---
|
package/dist/AGENT.md
CHANGED
|
@@ -188,6 +188,62 @@ Block models cannot contain other blocks. Use groups (`{ ... }`) or collections
|
|
|
188
188
|
|
|
189
189
|
Repeatable blocks use the same collection syntax as groups and entries: `[block(cta)]`. Use this sparingly, only when each repeated item should use the same reusable block template. For simple one-page repeated content, prefer a repeating group (`[{ ... }]`). For reusable content selected across pages, prefer a collection entry plus `[entry(key)]`.
|
|
190
190
|
|
|
191
|
+
### Stacks
|
|
192
|
+
|
|
193
|
+
A **stack** is a heterogeneous list of blocks: each item picks its own block schema. Use a stack when a page section can contain a mix of different reusable components in an editor-chosen order. If every item would use the same block, prefer `[block(key)]` instead — stacks are for "section A could be a hero, a CTA, a quote, or a gallery."
|
|
194
|
+
|
|
195
|
+
**Model syntax** — bare `stack`, no parentheses and no `[]`. Stacks are always multiple by definition:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
{
|
|
199
|
+
title: text,
|
|
200
|
+
sections: stack
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Any block defined in `models/blocks/` may appear in any stack — the allowed set is the full block library, not a per-field allow-list.
|
|
205
|
+
|
|
206
|
+
**Content shape** — an array of objects. Each item is shaped like the block model it uses, plus a `_block` marker naming that block by key (as a plain string):
|
|
207
|
+
|
|
208
|
+
**`content/pages/about.json`**
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"title": "About us",
|
|
212
|
+
"sections": [
|
|
213
|
+
{
|
|
214
|
+
"_block": "hero",
|
|
215
|
+
"heading": "Care that feels personal",
|
|
216
|
+
"subheading": "A small team focused on long-term relationships.",
|
|
217
|
+
"background": "pexels:doctor"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"_block": "cta",
|
|
221
|
+
"label": "Book a visit",
|
|
222
|
+
"link": "/contact"
|
|
223
|
+
}
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
The `_block` value is the block's key (e.g., `"hero"`, `"cta"`) — never a numeric id. The CMS resolves it server-side on save.
|
|
229
|
+
|
|
230
|
+
**Rendering** — each item flows through its own `blocks/<key>.ejs` template. Pass the whole array to `render()` and it dispatches per `_block`:
|
|
231
|
+
|
|
232
|
+
**`pages/about.ejs`**
|
|
233
|
+
```ejs
|
|
234
|
+
<h1><%= item.title %></h1>
|
|
235
|
+
<%- render(item.sections) %>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Stack vs block vs collection** — same decision tree as blocks, with one extra rung:
|
|
239
|
+
|
|
240
|
+
- One-off shape used on one page → group `{ ... }` or `[{ ... }]`.
|
|
241
|
+
- Reusable shape, always the same per item → `block(key)` or `[block(key)]`.
|
|
242
|
+
- Reusable shape, but items can be different blocks chosen by the editor → `stack`.
|
|
243
|
+
- Shared content referenced from many pages → `entry(key)` / `[entry(key)]`.
|
|
244
|
+
|
|
245
|
+
Like blocks, stacks cannot be nested inside block models. Stack items themselves may contain groups, collections, and entry references, but not other stacks or blocks.
|
|
246
|
+
|
|
191
247
|
**Entry reference** — Use `entry(key)` for one, `[entry(key)]` for many:
|
|
192
248
|
```
|
|
193
249
|
{
|
|
@@ -206,6 +262,7 @@ Model fields declare both the editor type and the shape expected in content JSON
|
|
|
206
262
|
| `text`, `paragraph`, `richtext`, `markdown`, `code`, `color`, `link` | String |
|
|
207
263
|
| `number` | Number |
|
|
208
264
|
| `boolean` | `true` / `false` |
|
|
265
|
+
| `emoji` | Single Unicode emoji character string, e.g. `"😀"` or `"👋🏽"` (one emoji per record; not free text) |
|
|
209
266
|
| `date` | `"YYYY-MM-DD"` string |
|
|
210
267
|
| `datetime` | ISO 8601 string |
|
|
211
268
|
| `time` | `"HH:mm"` string |
|
|
@@ -216,6 +273,7 @@ Model fields declare both the editor type and the shape expected in content JSON
|
|
|
216
273
|
| `location` | `{ "markers": [{ "lat": n, "lng": n }], "img": "..." }`; `img` is a Google Maps Static Image URL that already includes the markers and can include formatting parameters such as `size`, `zoom`, `scale`, `maptype`, and styling |
|
|
217
274
|
| `block(key)` | Object matching that block's model; stored inline in the parent page/entry content and rendered with `blocks/<key>.ejs` |
|
|
218
275
|
| `[block(key)]` | Array of block objects; each item matches the block model and renders with `blocks/<key>.ejs` |
|
|
276
|
+
| `stack` | Array of heterogeneous block-shaped objects. Each item is `{ "_block": "<block_key>", ...fields_of_that_block }`. `_block` is the target block's key as a plain string; the remaining keys must match that block's model. Different items in the same stack may use different blocks. Stored inline; each item renders through its own `blocks/<key>.ejs`. The CMS resolves block keys to ids server-side — never write numeric ids. |
|
|
219
277
|
| `entry(key)` / `[entry(key)]` | Slug string / array of slug strings in content JSON; entry object / array of entry objects in templates |
|
|
220
278
|
| Group `{ ... }` | Nested object |
|
|
221
279
|
| Collection `[{ ... }]` | Array of nested objects |
|