@brightsideoy/kama 1.0.0-alpha.25 → 1.0.0-alpha.27
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 +10 -7
- package/bin/cli.js +33 -2
- package/content/definitions/field-sets/access.yaml +4 -0
- package/content/definitions/field-sets/page-base.yaml +3 -0
- package/content/definitions/nodes/article.yaml +2 -0
- package/dist/assets/AssetEditor-BcCwT_Xa.js +1 -0
- package/dist/assets/CmsAccordion-91I5Rx5D.css +1 -0
- package/dist/assets/CmsAccordion-BgdaB8QZ.js +1 -0
- package/dist/assets/CmsBadge-BT2jTJUu.js +1 -0
- package/dist/assets/CmsButton-DnhPsHXA.js +1 -0
- package/dist/assets/CmsFieldTaxonomy-yRFmcLeZ.js +1 -0
- package/dist/assets/CmsHelp-Jl9rMIdD.js +1 -0
- package/dist/assets/CmsImagePreview-BhM7S_v8.js +1 -0
- package/dist/assets/CmsPublisher-ChxCekGE.js +3 -0
- package/dist/assets/CmsUserCenter-CAaiCweN.js +1 -0
- package/dist/assets/EditorSplitPreview-CMoTjLW5.css +1 -0
- package/dist/assets/EditorSplitPreview-DkWiaQ4A.js +1 -0
- package/dist/assets/FormsWorkspace-Bb6wv80Y.js +2 -0
- package/dist/assets/FormsWorkspace-CGs6eUjz.css +1 -0
- package/dist/assets/NodeContextMenu-C5RTK0sr.js +1 -0
- package/dist/assets/{NodeContextMenu-BYeWzmQ5.css → NodeContextMenu-Cj-2TvQC.css} +1 -1
- package/dist/assets/NodeEditor-BQA2pqq3.js +161 -0
- package/dist/assets/{NodeEditor-rrOvlGF8.css → NodeEditor-C82xLR0T.css} +1 -1
- package/dist/assets/SettingsDashboard-C7fPnHPF.js +1 -0
- package/dist/assets/SettingsDashboard-XBOgYUn3.css +1 -0
- package/dist/assets/StatusPill-HY1gCP9c.js +1 -0
- package/dist/assets/TrashWorkspace-BeKewvQM.js +1 -0
- package/dist/assets/{_plugin-vue_export-helper-BdT0OEbg.js → _plugin-vue_export-helper-BK_c4R_m.js} +1 -1
- package/dist/assets/circle-check-CksZGUB7.js +1 -0
- package/dist/assets/database--QlkzG9u.js +1 -0
- package/dist/assets/file-U7h4eOhG.js +1 -0
- package/dist/assets/globe-TuZP0v6A.js +1 -0
- package/dist/assets/history-CIbqkRx3.js +1 -0
- package/dist/assets/index-BUwzX0UJ.css +1 -0
- package/dist/assets/index-FU4E3ki6.js +14 -0
- package/dist/assets/layers-BwACvD_U.js +1 -0
- package/dist/assets/loader-circle-DYEFqbD4.js +1 -0
- package/dist/assets/panel-left-close-Cpq52HZy.js +1 -0
- package/dist/assets/plus-DITJjCl0.js +1 -0
- package/dist/assets/preload-helper-BT_08VsP.js +1 -0
- package/dist/assets/preload-helper-BxFQpwa9.css +1 -0
- package/dist/assets/rotate-ccw-DvjWccJd.js +1 -0
- package/dist/assets/save-Dwhm8QNL.js +1 -0
- package/dist/assets/send-Bs4eROle.js +1 -0
- package/dist/assets/smartphone-i429gh5p.js +1 -0
- package/dist/assets/trash-2-BbKTm8cC.js +1 -0
- package/dist/assets/{useCmsState-BblziYb-.js → useCmsState-rZqeAwK1.js} +1 -1
- package/dist/assets/useNodes-7CYqV0V0.js +1 -0
- package/dist/assets/user-DKryA1QU.js +1 -0
- package/dist/assets/x-DOWbsdzd.js +1 -0
- package/dist/{dist-ZQFhgFUY.js → dist-UqQ3yFqW.js} +5634 -4601
- package/dist/index.html +28 -28
- package/dist/index.js +3815 -2782
- package/dist/{nodemailer-Ccic7tRm-Chwouykd.js → nodemailer-Ccic7tRm-CQs81Z4t.js} +1 -1
- package/dist/schema-compiler.js +1 -1
- package/documentation/FORMS.md +181 -99
- package/documentation/SCHEMAS.md +445 -119
- package/package.json +1 -1
- package/schema.sql +7 -0
- package/templates/astro-starter/astro-preview-dev-integration.mjs +83 -0
- package/templates/astro-starter/astro.config.mjs +11 -0
- package/templates/astro-starter/src/lib/cms-fetch.ts +4 -1
- package/templates/astro-starter/src/middleware.ts +68 -41
- package/templates/astro-starter/src/pages/[...slug].astro +17 -14
- package/templates/astro-starter/src/pages/api/partials/node-cards.astro +1 -4
- package/wrangler.json +19 -0
- package/dist/assets/AssetEditor-CVfLHR57.js +0 -1
- package/dist/assets/CmsBadge-DB0WNyWx.js +0 -1
- package/dist/assets/CmsButton-BbvewMhp.js +0 -1
- package/dist/assets/CmsFieldTaxonomy-DWlLLL92.js +0 -1
- package/dist/assets/CmsHelp-D4z0YSWX.js +0 -1
- package/dist/assets/CmsImagePreview-cWi-cfCr.js +0 -1
- package/dist/assets/CmsPublisher-Dz_XTFmW.js +0 -3
- package/dist/assets/CmsUserCenter-DE_op9OZ.js +0 -1
- package/dist/assets/EditorSplitPreview-C9Gb4usO.js +0 -1
- package/dist/assets/EditorSplitPreview-eYsB2IC8.css +0 -1
- package/dist/assets/FormsWorkspace-DPTcxMpw.css +0 -1
- package/dist/assets/FormsWorkspace-DdYcrdg3.js +0 -1
- package/dist/assets/NodeContextMenu-qV4OaL33.js +0 -1
- package/dist/assets/NodeEditor-BNKrtv8t.js +0 -161
- package/dist/assets/StatusPill-BAnTGDR_.js +0 -1
- package/dist/assets/TrashWorkspace-DtbKBkM2.js +0 -1
- package/dist/assets/circle-check-CB39w7cZ.js +0 -1
- package/dist/assets/createLucideIcon-BIiMnJpN.js +0 -1
- package/dist/assets/database-mgNVRFlp.js +0 -1
- package/dist/assets/globe-Clq_OlnU.js +0 -1
- package/dist/assets/history-ZSqpsbjQ.js +0 -1
- package/dist/assets/index-DaXMl545.css +0 -1
- package/dist/assets/index-N7ViZ7U5.js +0 -16
- package/dist/assets/layers-CH2VvrZT.js +0 -1
- package/dist/assets/loader-circle-CwP4GuFX.js +0 -1
- package/dist/assets/panel-left-close-g4nIMIjy.js +0 -1
- package/dist/assets/plus-DCPXsir3.js +0 -1
- package/dist/assets/preload-helper-CstCHdlQ.js +0 -1
- package/dist/assets/preload-helper-Dkidd4pI.css +0 -1
- package/dist/assets/rotate-ccw-tUaGL4DO.js +0 -1
- package/dist/assets/save-BUYaWIjt.js +0 -1
- package/dist/assets/send-UE48lWD8.js +0 -1
- package/dist/assets/smartphone-B7c4WqQk.js +0 -1
- package/dist/assets/trash-2-D8h6WxFK.js +0 -1
- package/dist/assets/useNodes-GLoFdA2T.js +0 -1
- package/dist/assets/user-Bo_HcyTz.js +0 -1
- package/dist/assets/x-3cfZis8N.js +0 -1
package/documentation/SCHEMAS.md
CHANGED
|
@@ -1,182 +1,508 @@
|
|
|
1
|
-
# Kama
|
|
1
|
+
# Kama Schema Reference
|
|
2
|
+
|
|
3
|
+
Kama schemas are YAML files compiled into the CMS definitions bundle. The bundle
|
|
4
|
+
drives the editor, page canvas, database synchronization, and public field
|
|
5
|
+
filtering. This document describes the options the current compiler and UI
|
|
6
|
+
recognize, including fields, crop presets, layouts, and reusable field sets.
|
|
7
|
+
|
|
8
|
+
The compiler is intentionally permissive: it does not reject every unknown
|
|
9
|
+
property. Custom properties can survive compilation, but they have no built-in
|
|
10
|
+
effect unless Kama code or an extension reads them. The options below are the
|
|
11
|
+
ones with current built-in behavior.
|
|
12
|
+
|
|
13
|
+
## 1. Schema locations and build
|
|
14
|
+
|
|
15
|
+
Use `content/definitions/` in a workspace. The compiler also supports
|
|
16
|
+
`definitions/` as a fallback. A scaffolded project includes copies of Kama's
|
|
17
|
+
starter definitions; edit those project files to customize them.
|
|
18
|
+
|
|
19
|
+
| Directory | Definition |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `nodes/` | Content types such as pages, articles, and products |
|
|
22
|
+
| `blocks/` | Canvas blocks such as text, image, and hero components |
|
|
23
|
+
| `node-layouts/` | Page canvas grid templates and their regions |
|
|
24
|
+
| `block-layouts/` | Nested layouts used as blocks inside regions |
|
|
25
|
+
| `trees/` | Navigation tree types and their fields |
|
|
26
|
+
| `channels/` | Channel types and their fields |
|
|
27
|
+
| `taxonomies/` | Taxonomy types and term fields |
|
|
28
|
+
| `field-sets/` | Reusable field definitions |
|
|
29
|
+
| `forms/` | Public form definitions; see [FORMS.md](./FORMS.md) |
|
|
30
|
+
|
|
31
|
+
The filename (without `.yaml` or `.yml`) is the default schema ID. An explicit
|
|
32
|
+
`id` overrides it. Use stable IDs because other schemas refer to IDs for layouts,
|
|
33
|
+
blocks, trees, channels, and taxonomies.
|
|
34
|
+
|
|
35
|
+
After changing definitions, compile them before running or deploying the worker:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
# In a Kama workspace
|
|
39
|
+
npx kama bundle
|
|
40
|
+
|
|
41
|
+
# When building the Kama package itself
|
|
42
|
+
npm run bundle:definitions
|
|
43
|
+
npm run build:schema
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
In a workspace, `npx kama bundle` writes
|
|
47
|
+
`kama-worker/bundled-definitions.js`; it is generated and should not be edited
|
|
48
|
+
by hand. `npm run build` in the Kama package runs the package bundling and
|
|
49
|
+
build steps.
|
|
50
|
+
|
|
51
|
+
### YAML reuse and merge behavior
|
|
2
52
|
|
|
3
|
-
|
|
53
|
+
- `!include relative/path.yaml` includes a YAML file relative to the including
|
|
54
|
+
file. It is commonly used to create tabs from field sets.
|
|
55
|
+
- `fieldSet: name` imports a field set's fields. A field set can be listed in
|
|
56
|
+
a schema's `fieldSets` array or used in a `fields` / tab `fields` list.
|
|
57
|
+
- Inline field definitions are merged over imported field definitions; inline
|
|
58
|
+
values override matching values from a field set.
|
|
59
|
+
- The compiler resolves YAML merge keys (`<<`) as well.
|
|
4
60
|
|
|
5
|
-
|
|
61
|
+
## 2. Definition types and root options
|
|
6
62
|
|
|
7
|
-
|
|
63
|
+
All definitions accept `id` and `label`. `description` is used as explanatory
|
|
64
|
+
text in relevant block pickers and editor views. The compiler also preserves
|
|
65
|
+
other root properties, but they only do something if a consumer supports them.
|
|
8
66
|
|
|
9
|
-
|
|
67
|
+
### Nodes
|
|
10
68
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
69
|
+
```yaml
|
|
70
|
+
id: article
|
|
71
|
+
label: Article
|
|
72
|
+
inTree: false
|
|
73
|
+
inVault: true
|
|
74
|
+
hasCanvas: true
|
|
75
|
+
directLinking: true
|
|
76
|
+
titleTemplate: "{title}"
|
|
77
|
+
defaultLayout: content
|
|
78
|
+
allowedBlocks: "*"
|
|
79
|
+
tabs: {}
|
|
80
|
+
```
|
|
20
81
|
|
|
21
|
-
|
|
82
|
+
| Option | Meaning |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| `inTree` | Allows this node type to be placed in a tree. Defaults to `false` in the compiled schema. |
|
|
85
|
+
| `inVault` | Shows this node type in the content vault. Defaults to `true`. |
|
|
86
|
+
| `hasCanvas` | Enables the visual canvas. Defaults to `false`. |
|
|
87
|
+
| `directLinking` | Makes nodes of this type available as direct node links. |
|
|
88
|
+
| `titleTemplate` | Fallback display-title template; `{fieldName}` placeholders refer to node fields. An explicit non-empty `title` field takes precedence. |
|
|
89
|
+
| `defaultLayout` | Layout ID used when a node has no selected layout. |
|
|
90
|
+
| `allowedBlocks` | Block and nested-layout IDs allowed on the canvas. Use `"*"` or an array of IDs. Defaults to `"*"`. |
|
|
91
|
+
| `disallowedBlocks` | IDs excluded from the canvas. Accepts `"*"` or an array. |
|
|
92
|
+
| `fields`, `tabs`, `fieldSets` | Define the editor fields; see [Fields and tabs](#4-fields-and-tabs). |
|
|
22
93
|
|
|
23
|
-
|
|
94
|
+
### Blocks
|
|
24
95
|
|
|
25
|
-
|
|
96
|
+
Blocks use `id`, `label`, `description`, `fields`, and optionally `fieldSets`.
|
|
97
|
+
`group` labels the block group in the insert palette. Blocks can be used as
|
|
98
|
+
canvas components; a block's `fields` define its editor controls.
|
|
26
99
|
|
|
27
|
-
|
|
28
|
-
`your-project/content/definitions/nodes/page.yaml`
|
|
100
|
+
### Node layouts and block layouts
|
|
29
101
|
|
|
30
|
-
|
|
102
|
+
Layouts use `layout` and `regions`; see [Canvas layouts and regions](#8-canvas-layouts-and-regions).
|
|
103
|
+
They may also have `id`, `label`, `description`, `group`, `fields`, and `tabs`.
|
|
104
|
+
Block layouts are nested, reusable canvas components.
|
|
31
105
|
|
|
32
|
-
###
|
|
106
|
+
### Trees, channels, and taxonomies
|
|
33
107
|
|
|
34
|
-
|
|
35
|
-
`your-project/content/definitions/nodes/job-posting.yaml`
|
|
108
|
+
These entity types accept `id`, `label`, `fields`, `tabs`, and `fieldSets`.
|
|
36
109
|
|
|
37
|
-
|
|
110
|
+
- A channel schema may specify `tableName`; the default is `channels`.
|
|
111
|
+
- A taxonomy schema may include `hierarchical`; the compiler preserves this
|
|
112
|
+
property. The current taxonomy editor does not use it to change term editing
|
|
113
|
+
behavior.
|
|
114
|
+
- A tree schema's fields configure tree-level settings. Node fields shown in
|
|
115
|
+
tree output are controlled separately by field-level `inTree` and `public`.
|
|
38
116
|
|
|
39
|
-
|
|
117
|
+
### Forms
|
|
40
118
|
|
|
41
|
-
|
|
119
|
+
Forms are definitions in `forms/`, not node schemas. Their fields, settings,
|
|
120
|
+
and finishers are documented in [FORMS.md](./FORMS.md).
|
|
42
121
|
|
|
43
|
-
|
|
122
|
+
## 3. Fields and tabs
|
|
44
123
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- `description` _(string)_: Optional subtext shown in block pickers or menus.
|
|
124
|
+
Fields can be declared as a map or as a list of field entries. Tabs are a map
|
|
125
|
+
whose keys are stable tab IDs and whose `label` is the editor label.
|
|
48
126
|
|
|
49
|
-
|
|
127
|
+
```yaml
|
|
128
|
+
tabs:
|
|
129
|
+
settings:
|
|
130
|
+
label: Settings
|
|
131
|
+
fields:
|
|
132
|
+
title:
|
|
133
|
+
label: Page title
|
|
134
|
+
type: text
|
|
135
|
+
required: true
|
|
136
|
+
fieldSet: page-seo
|
|
137
|
+
access: !include ../field-sets/access.yaml
|
|
138
|
+
```
|
|
50
139
|
|
|
51
|
-
|
|
52
|
-
- `inVault` _(boolean)_: If `true`, this node appears in the "Vault" (usually for structured data like Products, Addresses, Persons).
|
|
53
|
-
- `hasCanvas` _(boolean)_: If `true`, enables the visual drag-and-drop page builder for this node.
|
|
54
|
-
- `directLinking` _(boolean)_: If `true`, the node is resolvable to a frontend URL/slug (e.g., an Article or Page).
|
|
140
|
+
The list form is also supported:
|
|
55
141
|
|
|
56
|
-
|
|
142
|
+
```yaml
|
|
143
|
+
tabs:
|
|
144
|
+
settings:
|
|
145
|
+
label: Page
|
|
146
|
+
fields:
|
|
147
|
+
- fieldSet: page-base
|
|
148
|
+
- subtitle:
|
|
149
|
+
label: Subtitle
|
|
150
|
+
type: textarea
|
|
151
|
+
public: true
|
|
152
|
+
```
|
|
57
153
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
154
|
+
A field set can be a plain map of fields or an object with `label`, `fields`,
|
|
155
|
+
and optional `tab` metadata. A field set can also carry node defaults such as
|
|
156
|
+
`inTree`, `inVault`, or `hasCanvas`.
|
|
157
|
+
|
|
158
|
+
## 4. Field types
|
|
159
|
+
|
|
160
|
+
`type` selects the editor control. If omitted, the field is treated as text.
|
|
161
|
+
The aliases below are the current controls in the dynamic editor.
|
|
162
|
+
|
|
163
|
+
| `type` | Editor behavior and related options |
|
|
164
|
+
| --- | --- |
|
|
165
|
+
| `text`, `string` | Single-line text. |
|
|
166
|
+
| `textarea` | Multiline text. |
|
|
167
|
+
| `richtext`, `editor`, `wysiwyg`, `html` | TipTap rich-text editor. Set `editor` or `rteType` to a registered editor profile. |
|
|
168
|
+
| `password` | Password input. |
|
|
169
|
+
| `email` | Email input. |
|
|
170
|
+
| `phone`, `tel` | Telephone input. |
|
|
171
|
+
| `url` | URL input. |
|
|
172
|
+
| `number`, `integer`, `float` | Numeric input. `integer` defaults to step `1`; `step`, `min`, and `max` can customize the control. |
|
|
173
|
+
| `boolean` | Toggle. `variant` or `switchType` selects the visual style (`primary`, `success`, or `danger`). |
|
|
174
|
+
| `date`, `datetime` | Date or local date-time input. Defaults also accept `now`, `today`, and relative values such as `+2 days` or `-1 month`. |
|
|
175
|
+
| `slug` | Slug input with auto-generation from `linkedTo` fields until an editor unlinks it. |
|
|
176
|
+
| `select`, `pills` | Single or multiple choice; see [Choices](#5-field-options-and-validation). |
|
|
177
|
+
| `layout-select` | Selects a node layout; supports `allowedLayouts`, `options`, and `inheritsFromParent`. |
|
|
178
|
+
| `language-select` | Searchable locale selector; supports `multiple`. |
|
|
179
|
+
| `link` | Link picker; filter kinds with `allowedLinkTypes` or `linkTypes`. |
|
|
180
|
+
| `node`, `relation` | Node relation picker; filter types with `allowedNodeTypes` or `nodeTypes`; supports `multiple`. |
|
|
181
|
+
| `taxonomy` | Term picker; set `taxonomy` (or `taxonomyKey`) and optionally `multiple`. |
|
|
182
|
+
| `node-sort` | Sort field and direction control. Values are strings such as `updatedAt_desc`. |
|
|
183
|
+
| `icon` | Iconify icon picker; `packages` can limit installed icon collections. |
|
|
184
|
+
| `asset`, `media`, `image` | Media picker; supports upload limits and crop presets. See [Images, cropping, and media](#7-images-cropping-and-media). |
|
|
185
|
+
| `hidden` | Excluded from the standard dynamic form. Use for system data, not an editor-visible field. |
|
|
186
|
+
|
|
187
|
+
Unsupported `type` values are preserved as schema data but do not automatically
|
|
188
|
+
create a new control. Use a custom component or extend the editor for new field
|
|
189
|
+
types.
|
|
190
|
+
|
|
191
|
+
## 5. Field options and validation
|
|
192
|
+
|
|
193
|
+
### Common field properties
|
|
194
|
+
|
|
195
|
+
| Property | Behavior |
|
|
196
|
+
| --- | --- |
|
|
197
|
+
| `label` | Editor label; defaults to the field key. |
|
|
198
|
+
| `type` | Editor control; see the table above. |
|
|
199
|
+
| `default` | Initial value for the field. Date fields also accept relative defaults. |
|
|
200
|
+
| `placeholder` | Input placeholder where the control supports one. |
|
|
201
|
+
| `required` | Required flag. It can also be set at `rules.required`. |
|
|
202
|
+
| `rules` | Validation rules; see below. |
|
|
203
|
+
| `public` | Mark `true` to expose the value through public APIs. Keep private values false or omit them. |
|
|
204
|
+
| `inTree` | Expose the field in tree node data; public tree output also requires `public: true`. |
|
|
205
|
+
| `dbType` | Storage type for schema/database synchronization: `text`, `integer`, `real`, or `json`. This is separate from the editor `type`. |
|
|
206
|
+
| `index` | Requests a generated index for eligible node JSON fields. Core columns such as `slug` are indexed separately. |
|
|
207
|
+
| `primaryKey` | Marks a database field as a primary key where dynamic table generation applies. |
|
|
208
|
+
| `unique` | Top-level shortcut for the uniqueness rule. |
|
|
209
|
+
| `position: sidebar` | Places block fields in the block settings sidebar instead of the main field list. |
|
|
210
|
+
| `liveSync` | For supported node fields, saves the change immediately instead of waiting for the normal publish/save flow. |
|
|
211
|
+
| `linkedTo` | Comma-separated source field keys for slug generation, e.g. `"menuTitle,title"`. |
|
|
212
|
+
| `inherits` | Copies a sibling/related field value while the editor's inheritance link is enabled. |
|
|
213
|
+
| `inheritsFromParent` | Enables parent-node inheritance behavior, used by layout fields. |
|
|
214
|
+
| `cacheInvalidation` | Cache scope on publish: `page`, `tree`, `channel`, or `global`. Omitted means `page`; details below. |
|
|
215
|
+
| `multiple` | Enables multiple selections or assets for controls that support it. |
|
|
216
|
+
| `description` | Preserved as schema metadata. The generic dynamic field form does not currently render a field helper-text line. |
|
|
217
|
+
|
|
218
|
+
### Choice fields
|
|
219
|
+
|
|
220
|
+
`select` and `pills` accept `options` as scalar values or `{label, value}`
|
|
221
|
+
objects. Grouped select options use `{label, choices: [...]}`:
|
|
61
222
|
|
|
62
|
-
|
|
223
|
+
```yaml
|
|
224
|
+
status:
|
|
225
|
+
type: select
|
|
226
|
+
default: draft
|
|
227
|
+
options:
|
|
228
|
+
- label: Draft
|
|
229
|
+
value: draft
|
|
230
|
+
- label: Published
|
|
231
|
+
value: published
|
|
232
|
+
```
|
|
63
233
|
|
|
64
|
-
|
|
234
|
+
To load options from a JSON endpoint, use `optionsEndpoint`, with optional
|
|
235
|
+
`optionsValueKey` and `optionsLabelKey` (defaults: `value` and `label`). For
|
|
236
|
+
multiple choices, set `multiple: true`; the stored value is an array.
|
|
65
237
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- `regions`: Configuration for the specific drop zones defined in the `areas`.
|
|
70
|
-
- `label` _(string)_: UI label for the drop zone.
|
|
71
|
-
- `showLabel` _(boolean)_: Shows/hides the header in the editor.
|
|
72
|
-
- `inherit` _(string)_: Can inherit content from `"parent"`.
|
|
238
|
+
For `link`, supported kinds are `tree`, `node`, `url`, `file`, `email`, and
|
|
239
|
+
`telephone`. For `node` / `relation`, use `nodeTypes` or `allowedNodeTypes` to
|
|
240
|
+
restrict the picker.
|
|
73
241
|
|
|
74
|
-
|
|
242
|
+
### Validation rules
|
|
75
243
|
|
|
76
|
-
|
|
244
|
+
Place rules under `rules`; `required` may also be top-level:
|
|
77
245
|
|
|
78
246
|
```yaml
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
required: true
|
|
247
|
+
slug:
|
|
248
|
+
type: slug
|
|
249
|
+
linkedTo: title
|
|
250
|
+
required: true
|
|
251
|
+
rules:
|
|
252
|
+
pattern: "^[a-z0-9_-]+$"
|
|
253
|
+
uniqueSibling: true
|
|
254
|
+
customMessage: "Use lowercase letters, numbers, hyphens, or underscores."
|
|
88
255
|
```
|
|
89
256
|
|
|
90
|
-
|
|
257
|
+
Built-in rules are:
|
|
258
|
+
|
|
259
|
+
- `required`: rejects empty values.
|
|
260
|
+
- `min` / `max`: numeric bounds for numbers and length bounds for strings.
|
|
261
|
+
- `pattern`: JavaScript regular expression.
|
|
262
|
+
- `email`: enables email-format validation for a value.
|
|
263
|
+
- `unique` / `uniqueSibling`: uniqueness checks handled by the save/conflict
|
|
264
|
+
flow. `uniqueMessage` can customize the conflict message.
|
|
265
|
+
- `customMessage`: shared message used for rule failures.
|
|
91
266
|
|
|
92
|
-
|
|
267
|
+
For numeric controls, top-level `min`, `max`, and `step` also set HTML input
|
|
268
|
+
attributes. Use `rules.min` and `rules.max` when validation is required.
|
|
93
269
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
- `date` / `datetime`: Date/Time picker.
|
|
100
|
-
- `slug`: URL-friendly string generator. Often paired with `linkedTo: "title"`.
|
|
101
|
-
- `select`: Dropdown menu. (Requires an `options` array).
|
|
102
|
-
- `layout-select`: Specialized dropdown that queries available layout schemas.
|
|
103
|
-
- `language-select`: Specialized dropdown for locales.
|
|
104
|
-
- `link`: A unified link picker (internal nodes, trees, URLs, files, emails, tel).
|
|
105
|
-
- `icon`: Icon picker. (Configure with `packages: ["heroicons", "lucide"]`).
|
|
106
|
-
- `asset` / `image`: Cloudflare R2 media uploader.
|
|
107
|
-
- `hidden`: Hidden from the UI, used for programmatic data.
|
|
270
|
+
Custom validators can be registered in `definitions/validators/*.ts`. Export a
|
|
271
|
+
validator function named after the rule, or use a default export named after
|
|
272
|
+
the file. It receives the value, rule value, field definition, and validation
|
|
273
|
+
context; return an error string or an empty string, synchronously or
|
|
274
|
+
asynchronously.
|
|
108
275
|
|
|
109
|
-
|
|
276
|
+
### Cache invalidation
|
|
110
277
|
|
|
111
|
-
|
|
278
|
+
`cacheInvalidation` controls how far a publish purges cache entries for a
|
|
279
|
+
changed field. The broadest configured scope among changed fields wins.
|
|
112
280
|
|
|
113
|
-
|
|
281
|
+
| Value | Effect |
|
|
282
|
+
| --- | --- |
|
|
283
|
+
| `page` (default) | Purges the changed node's page/API output and relevant dependent output. |
|
|
284
|
+
| `tree` | Also invalidates the affected tree output and its routed pages. |
|
|
285
|
+
| `channel` | Invalidates the channel's route and API caches. Structural route changes such as slug changes use this broad path. |
|
|
286
|
+
| `global` | Clears the package cache and globally invalidates the configured frontend/CDN caches. |
|
|
114
287
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
- `showAsEditorTitle` _(boolean)_: Uses this field's value as the display title in Vault/Tree lists.
|
|
120
|
-
- `public` _(boolean)_: **CRITICAL.** If `true`, this field is exposed in the public frontend API. If omitted or `false`, the data remains private to the admin backend.
|
|
288
|
+
For large channel purges (more than 25 routes or 300 targeted URLs), Kama
|
|
289
|
+
purges the affected hostnames instead of enumerating every route. This
|
|
290
|
+
invalidates other cached paths on those same hosts, but does not purge
|
|
291
|
+
unrelated hostnames in the zone.
|
|
121
292
|
|
|
122
|
-
|
|
293
|
+
Example:
|
|
123
294
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
295
|
+
```yaml
|
|
296
|
+
fields:
|
|
297
|
+
title:
|
|
298
|
+
type: text
|
|
299
|
+
cacheInvalidation: tree
|
|
300
|
+
slug:
|
|
301
|
+
type: slug
|
|
302
|
+
linkedTo: title
|
|
303
|
+
cacheInvalidation: channel
|
|
304
|
+
metaDescription:
|
|
305
|
+
type: textarea
|
|
306
|
+
cacheInvalidation: page
|
|
307
|
+
```
|
|
127
308
|
|
|
128
|
-
|
|
309
|
+
## 6. Rich-text profiles and icons
|
|
129
310
|
|
|
130
|
-
- `
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
311
|
+
Rich-text fields use `editor` or `rteType` to select a profile. Profiles are
|
|
312
|
+
loaded from `definitions/editor/*.ts`; the package currently includes
|
|
313
|
+
`default`, `minimal`, `button`, and `header`. If the name is not registered,
|
|
314
|
+
the editor falls back to `default`.
|
|
134
315
|
|
|
135
|
-
|
|
316
|
+
A profile exports a `profile` containing TipTap `extensions` and toolbar
|
|
317
|
+
controls. Current controls include bold, italic, strike, heading levels 1-4,
|
|
318
|
+
subscript, superscript, bullet/ordered lists, blockquote, link, horizontal
|
|
319
|
+
rule, table, and split.
|
|
136
320
|
|
|
137
|
-
|
|
138
|
-
|
|
321
|
+
For `type: icon`, `packages` filters the installed Iconify collections, for
|
|
322
|
+
example:
|
|
139
323
|
|
|
140
|
-
|
|
324
|
+
```yaml
|
|
325
|
+
iconName:
|
|
326
|
+
type: icon
|
|
327
|
+
packages: ["heroicons", "lucide", "mdi"]
|
|
328
|
+
```
|
|
141
329
|
|
|
142
|
-
|
|
330
|
+
The collections must be installed as `@iconify-json/*` dependencies for local
|
|
331
|
+
icons to be bundled.
|
|
332
|
+
|
|
333
|
+
## 7. Images, cropping, and media
|
|
334
|
+
|
|
335
|
+
Use `asset`, `media`, or `image` for asset fields. `image`/`asset` are treated
|
|
336
|
+
as image-oriented controls; `allowedTypes` can further limit upload MIME types.
|
|
337
|
+
The legacy singular `crop` key is also read, but prefer `crops`.
|
|
143
338
|
|
|
144
339
|
```yaml
|
|
145
340
|
featuredImage:
|
|
146
|
-
label:
|
|
147
|
-
type:
|
|
341
|
+
label: Featured image
|
|
342
|
+
type: image
|
|
148
343
|
multiple: false
|
|
344
|
+
maxItems: 1
|
|
149
345
|
maxSizeMB: 15
|
|
150
|
-
maxPreviewWidth:
|
|
346
|
+
maxPreviewWidth: 800
|
|
151
347
|
allowedTypes: ["image/jpeg", "image/png", "image/webp"]
|
|
152
348
|
crops:
|
|
153
|
-
|
|
154
|
-
label:
|
|
155
|
-
aspectRatio: 1.
|
|
156
|
-
|
|
157
|
-
label:
|
|
158
|
-
aspectRatio:
|
|
349
|
+
card:
|
|
350
|
+
label: Card (16:9)
|
|
351
|
+
aspectRatio: 1.7778
|
|
352
|
+
avatar:
|
|
353
|
+
label: Avatar
|
|
354
|
+
aspectRatio: 1
|
|
355
|
+
shape: circle
|
|
356
|
+
public: true
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
| Property | Behavior |
|
|
360
|
+
| --- | --- |
|
|
361
|
+
| `multiple` | Allows multiple assets. |
|
|
362
|
+
| `maxItems` | Maximum selected assets; defaults to `1` for single fields and `99` for multiple fields. |
|
|
363
|
+
| `maxSizeMB` | Client upload size limit in megabytes; defaults to `10`. |
|
|
364
|
+
| `allowedTypes` | MIME types, including wildcards such as `image/*`. `accept` is a compatibility alias. |
|
|
365
|
+
| `maxPreviewWidth` / `maxWidth` | Preview width; also used as a client-side resize limit for image uploads. |
|
|
366
|
+
| `showLabel: false` | Hides the asset field label. |
|
|
367
|
+
| `crops` | Map of stable variant key to crop settings. |
|
|
368
|
+
| `crops.<key>.label` | Name shown for the crop preset. |
|
|
369
|
+
| `crops.<key>.aspectRatio` | Fixed crop ratio as a positive number (e.g. `16 / 9` = `1.7778`). |
|
|
370
|
+
| `crops.<key>.shape` | `circle` or `round` uses a circular crop stencil; other values use a rectangle. |
|
|
371
|
+
| `previewPresetKey: null` | Disables automatic selection of the first crop preset for the field preview. |
|
|
372
|
+
|
|
373
|
+
`ratio` is also read by some upload and preview paths, but `aspectRatio` is the
|
|
374
|
+
recommended property and is used by the manual cropper.
|
|
375
|
+
|
|
376
|
+
On upload, Kama creates crop variants for configured presets; editors can open
|
|
377
|
+
the crop tool to adjust each variant. Keep preset keys stable because stored
|
|
378
|
+
assets and variants are keyed by them. Crop configuration is independent of
|
|
379
|
+
delivery-time resizing and format conversion.
|
|
380
|
+
|
|
381
|
+
The public media route also accepts optimization query parameters:
|
|
382
|
+
|
|
383
|
+
| Parameter | Meaning |
|
|
384
|
+
| --- | --- |
|
|
385
|
+
| `w` | Requested width in pixels, up to 3840; snapped to a standard CDN breakpoint. |
|
|
386
|
+
| `h` | Requested height in pixels, up to 3840. |
|
|
387
|
+
| `q` | Quality from 1 to 100. |
|
|
388
|
+
| `f` | Format: `auto`, `avif`, `webp`, `jpeg`, `jpg`, `png`, `gif`, or `svg`. |
|
|
389
|
+
|
|
390
|
+
For example, `/media/<asset-key>?w=640&q=80&f=webp`. These URL options are
|
|
391
|
+
media API behavior, not field-schema properties.
|
|
392
|
+
|
|
393
|
+
## 8. Canvas layouts and regions
|
|
394
|
+
|
|
395
|
+
Both node layouts and block layouts use CSS Grid. Each string in `areas` names a
|
|
396
|
+
region; every name must have a matching entry in `regions`.
|
|
397
|
+
|
|
398
|
+
```yaml
|
|
399
|
+
id: two-column
|
|
400
|
+
label: Two columns
|
|
401
|
+
layout:
|
|
402
|
+
columns: "2fr 1fr"
|
|
403
|
+
areas:
|
|
404
|
+
- ["header", "header"]
|
|
405
|
+
- ["content", "sidebar"]
|
|
406
|
+
- ["footer", "footer"]
|
|
407
|
+
regions:
|
|
408
|
+
header:
|
|
409
|
+
label: Header
|
|
410
|
+
inherit: parent
|
|
411
|
+
showLabel: true
|
|
412
|
+
content:
|
|
413
|
+
label: Main content
|
|
414
|
+
allowedBlocks: "*"
|
|
415
|
+
sidebar:
|
|
416
|
+
label: Sidebar
|
|
417
|
+
disallowedBlocks: [hero, image_card]
|
|
418
|
+
footer:
|
|
419
|
+
label: Footer
|
|
420
|
+
purgeTargets: ["/partials/footer"]
|
|
159
421
|
```
|
|
160
422
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
- `
|
|
423
|
+
### Layout options
|
|
424
|
+
|
|
425
|
+
- `layout.columns`: CSS `grid-template-columns` value.
|
|
426
|
+
- `layout.areas`: rows of CSS grid-area names.
|
|
427
|
+
- `regions`: map keyed by those names.
|
|
428
|
+
- `regions.<name>.label`: editor label.
|
|
429
|
+
- `showLabel`: hides the layout or region label when `false`.
|
|
430
|
+
- `inherit: parent`: marks region content as inherited from the parent node.
|
|
431
|
+
- `allowedBlocks` / `disallowedBlocks`: block/layout ID allow or deny lists;
|
|
432
|
+
`"*"` means all blocks.
|
|
433
|
+
- `dropType: image`: makes the region accept image drops through the image
|
|
434
|
+
editor. Asset options such as `multiple`, `maxItems`, `maxSizeMB`,
|
|
435
|
+
`maxPreviewWidth`, `allowedTypes`, and `crops` can also be set on the region.
|
|
436
|
+
- `purgeTargets`: frontend paths to purge when the associated region changes.
|
|
437
|
+
|
|
438
|
+
Node definitions can restrict their whole canvas with root-level
|
|
439
|
+
`allowedBlocks` / `disallowedBlocks`. If the node has no selected layout, its
|
|
440
|
+
`defaultLayout` is used. A `layout-select` field can restrict choices with
|
|
441
|
+
`allowedLayouts`; `inheritsFromParent: true` enables parent/subpage layout
|
|
442
|
+
inheritance.
|
|
164
443
|
|
|
165
|
-
##
|
|
444
|
+
## 9. Database and public API behavior
|
|
166
445
|
|
|
167
|
-
|
|
446
|
+
`type` chooses the editor control; `dbType` controls database storage. Supported
|
|
447
|
+
`dbType` values are `text`, `integer`, `real`, and `json`. Do not use a UI type
|
|
448
|
+
as a database type. Unknown `dbType` values fall back to `TEXT`; for example,
|
|
449
|
+
`boolean` is not a distinct SQL type. `required`, `default`, and `primaryKey`
|
|
450
|
+
affect generated table definitions where dynamic table generation applies.
|
|
168
451
|
|
|
169
|
-
For
|
|
452
|
+
For node fields, `index: true` can request a JSON-field index. Some core fields
|
|
453
|
+
already have dedicated columns/indexes and are handled separately.
|
|
170
454
|
|
|
171
|
-
|
|
172
|
-
|
|
455
|
+
Set `public: true` to intentionally expose a field through public APIs. Set
|
|
456
|
+
`inTree: true` for a node field that should be available in tree node output;
|
|
457
|
+
tree output only includes schema-approved public fields. Treat `public` as an
|
|
458
|
+
API/data-exposure decision, not just an editor display setting.
|
|
459
|
+
|
|
460
|
+
## 10. Examples
|
|
461
|
+
|
|
462
|
+
### A page type with shared fields and scoped cache invalidation
|
|
173
463
|
|
|
174
464
|
```yaml
|
|
465
|
+
id: page
|
|
466
|
+
label: Page
|
|
467
|
+
inTree: true
|
|
468
|
+
inVault: true
|
|
469
|
+
hasCanvas: true
|
|
470
|
+
directLinking: true
|
|
471
|
+
defaultLayout: single-column
|
|
472
|
+
allowedBlocks: "*"
|
|
175
473
|
tabs:
|
|
176
474
|
settings:
|
|
475
|
+
label: Page
|
|
177
476
|
fields:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
477
|
+
- fieldSet: page-base
|
|
478
|
+
menuTitle:
|
|
479
|
+
label: Menu title
|
|
480
|
+
type: text
|
|
481
|
+
public: true
|
|
482
|
+
inTree: true
|
|
483
|
+
cacheInvalidation: tree
|
|
484
|
+
meta: !include ../field-sets/page-seo.yaml
|
|
182
485
|
```
|
|
486
|
+
|
|
487
|
+
### A reusable field set
|
|
488
|
+
|
|
489
|
+
```yaml
|
|
490
|
+
label: Page base
|
|
491
|
+
fields:
|
|
492
|
+
title:
|
|
493
|
+
label: Page title
|
|
494
|
+
type: text
|
|
495
|
+
required: true
|
|
496
|
+
public: true
|
|
497
|
+
inTree: true
|
|
498
|
+
cacheInvalidation: tree
|
|
499
|
+
slug:
|
|
500
|
+
label: URL slug
|
|
501
|
+
type: slug
|
|
502
|
+
linkedTo: title
|
|
503
|
+
required: true
|
|
504
|
+
public: true
|
|
505
|
+
inTree: true
|
|
506
|
+
cacheInvalidation: channel
|
|
507
|
+
```
|
|
508
|
+
|