@kidecms/core 0.23.1 → 0.25.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.
@@ -0,0 +1,312 @@
1
+ /* Admin chrome — owned by @kidecms/core and updated with it. The project's
2
+ src/styles/admin.css defines only the color tokens this file consumes;
3
+ everything mechanical (layers, focus, editor styles, variants) lives here. */
4
+ @import "tailwindcss";
5
+ @custom-variant dark (&:is(.dark *));
6
+
7
+ /* Token → utility wiring. Which tokens exist is core's contract; their values
8
+ come from the project's :root/.dark blocks. */
9
+ @theme inline {
10
+ --breakpoint-2xl: 100rem; /* 1600px */
11
+
12
+ --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
13
+ --font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", monospace;
14
+
15
+ --color-background: var(--background);
16
+ --color-foreground: var(--foreground);
17
+ --color-card: var(--card);
18
+ --color-card-foreground: var(--card-foreground);
19
+ --color-popover: var(--popover);
20
+ --color-popover-foreground: var(--popover-foreground);
21
+ --color-primary: var(--primary);
22
+ --color-primary-foreground: var(--primary-foreground);
23
+ --color-secondary: var(--secondary);
24
+ --color-secondary-foreground: var(--secondary-foreground);
25
+ --color-muted: var(--muted);
26
+ --color-muted-strong: var(--muted-strong);
27
+ --color-field: var(--field);
28
+ --color-field-subtle: var(--field-subtle);
29
+ --color-muted-foreground: var(--muted-foreground);
30
+ --color-accent: var(--accent);
31
+ --color-accent-foreground: var(--accent-foreground);
32
+ --color-destructive: var(--destructive);
33
+ --color-border: var(--border);
34
+ --color-input: var(--input);
35
+ --color-ring: var(--ring);
36
+ --color-chart-1: var(--chart-1);
37
+ --color-chart-2: var(--chart-2);
38
+ --color-chart-3: var(--chart-3);
39
+ --color-chart-4: var(--chart-4);
40
+ --color-chart-5: var(--chart-5);
41
+ --color-sidebar: var(--sidebar);
42
+ --color-sidebar-foreground: var(--sidebar-foreground);
43
+ --color-sidebar-primary: var(--sidebar-primary);
44
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
45
+ --color-sidebar-accent: var(--sidebar-accent);
46
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
47
+ --color-sidebar-border: var(--sidebar-border);
48
+ --color-sidebar-ring: var(--sidebar-ring);
49
+
50
+ --radius-sm: calc(var(--radius) - 2px);
51
+ --radius-md: var(--radius);
52
+ --radius-lg: calc(var(--radius) + 2px);
53
+ --radius-xl: calc(var(--radius) + 6px);
54
+
55
+ /* shadcn component styles (accordion, state variants) */
56
+ @keyframes accordion-down {
57
+ from {
58
+ height: 0;
59
+ }
60
+ to {
61
+ height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto));
62
+ }
63
+ }
64
+ @keyframes accordion-up {
65
+ from {
66
+ height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto));
67
+ }
68
+ to {
69
+ height: 0;
70
+ }
71
+ }
72
+ }
73
+
74
+ @custom-variant data-open {
75
+ &:where([data-state="open"]),
76
+ &:where([data-open]:not([data-open="false"])) {
77
+ @slot;
78
+ }
79
+ }
80
+ @custom-variant data-closed {
81
+ &:where([data-state="closed"]),
82
+ &:where([data-closed]:not([data-closed="false"])) {
83
+ @slot;
84
+ }
85
+ }
86
+ @custom-variant data-checked {
87
+ &:where([data-state="checked"]),
88
+ &:where([data-checked]:not([data-checked="false"])) {
89
+ @slot;
90
+ }
91
+ }
92
+ @custom-variant data-unchecked {
93
+ &:where([data-state="unchecked"]),
94
+ &:where([data-unchecked]:not([data-unchecked="false"])) {
95
+ @slot;
96
+ }
97
+ }
98
+ @custom-variant data-selected {
99
+ &:where([data-selected="true"]) {
100
+ @slot;
101
+ }
102
+ }
103
+ @custom-variant data-disabled {
104
+ &:where([data-disabled="true"]),
105
+ &:where([data-disabled]:not([data-disabled="false"])) {
106
+ @slot;
107
+ }
108
+ }
109
+ @custom-variant data-active {
110
+ &:where([data-state="active"]),
111
+ &:where([data-active]:not([data-active="false"])) {
112
+ @slot;
113
+ }
114
+ }
115
+ @custom-variant data-horizontal {
116
+ &:where([data-orientation="horizontal"]) {
117
+ @slot;
118
+ }
119
+ }
120
+ @custom-variant data-vertical {
121
+ &:where([data-orientation="vertical"]) {
122
+ @slot;
123
+ }
124
+ }
125
+ @utility no-scrollbar {
126
+ -ms-overflow-style: none;
127
+ scrollbar-width: none;
128
+ &::-webkit-scrollbar {
129
+ display: none;
130
+ }
131
+ }
132
+
133
+ @layer base {
134
+ * {
135
+ @apply border-border outline-ring/50;
136
+ }
137
+ body {
138
+ @apply bg-background text-foreground;
139
+ }
140
+ html {
141
+ @apply font-sans;
142
+ }
143
+ }
144
+
145
+ /* ════════════════════════════════════════════════════════════════════════
146
+ FOCUS — one universal rule for the whole admin.
147
+ Every focusable element (input, button, link, checkbox, radio, [tabindex],
148
+ contenteditable, …) gets the same ring automatically. There is nothing to
149
+ add per component. To restyle focus everywhere, change the three
150
+ --focus-ring-* vars in the project's admin.css. Nothing else sets focus styles.
151
+ ════════════════════════════════════════════════════════════════════════ */
152
+ *:focus-visible {
153
+ outline: var(--focus-ring-width) solid var(--focus-ring-color);
154
+ outline-offset: var(--focus-ring-offset);
155
+ }
156
+
157
+ /* Rich-text editor: the focusable element is the inner contenteditable, but we
158
+ want the ring around the whole bordered box. Ring the container instead, and
159
+ suppress it while a toolbar button has focus (the button shows its own ring). */
160
+ .tiptap:focus-visible {
161
+ outline: none;
162
+ }
163
+ [data-slot="editor"]:focus-within:not(:has([data-slot="button"]:focus-visible)) {
164
+ outline: var(--focus-ring-width) solid var(--focus-ring-color);
165
+ outline-offset: var(--focus-ring-offset);
166
+ }
167
+
168
+ /* Menus / selects / command palette: items show focus as a background highlight,
169
+ not the ring; and a popup trigger must not keep the ring while its popup is
170
+ open (base-ui re-focuses the trigger on pointer interaction, which would
171
+ otherwise trip :focus-visible). Keyboard focus on the trigger itself, when
172
+ closed, still gets the normal ring. */
173
+ [data-slot="dropdown-menu-item"]:focus-visible,
174
+ [data-slot="dropdown-menu-sub-trigger"]:focus-visible,
175
+ [data-slot="select-item"]:focus-visible,
176
+ [data-slot="command-item"]:focus-visible,
177
+ [data-popup-open]:focus-visible {
178
+ outline: none;
179
+ }
180
+
181
+ /* ── Dark mode: native input controls, select arrow, focus ring ──── */
182
+ .dark input::-webkit-calendar-picker-indicator {
183
+ filter: invert(1);
184
+ }
185
+
186
+ .dark select {
187
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
188
+ }
189
+
190
+ .dark *:focus-visible {
191
+ --tw-ring-offset-color: var(--surface);
192
+ }
193
+
194
+ /* ── Strip focus styles from command input ────────────────────────── */
195
+ [data-slot="command-input"] {
196
+ border: none;
197
+ background: transparent;
198
+ padding: 0;
199
+ box-shadow: none;
200
+ outline: none;
201
+ }
202
+
203
+ [data-slot="command-input"]:focus,
204
+ [data-slot="command-input"]:focus-visible {
205
+ border: none;
206
+ box-shadow: none;
207
+ outline: none;
208
+ --tw-ring-shadow: none;
209
+ --tw-ring-offset-shadow: none;
210
+ }
211
+
212
+ /* ── Tiptap editor styles ────────────────────────────────────────── */
213
+ /* Content typography only — block-card form UI ([data-node-view-wrapper]) is excluded,
214
+ since these unlayered rules would beat its layered Tailwind utilities. The second
215
+ selector re-includes rich-text sub-fields (a nested .tiptap inside a block card). */
216
+ .tiptap {
217
+ outline: none;
218
+ }
219
+
220
+ .tiptap p:not([data-node-view-wrapper] *),
221
+ [data-node-view-wrapper] .tiptap p {
222
+ margin: 0.5em 0;
223
+ color: inherit;
224
+ font-size: inherit;
225
+ line-height: 1.6;
226
+ }
227
+
228
+ /* Command hint on the empty field / the cursor's empty paragraph ("Type / for commands…"). */
229
+ .tiptap p.is-empty::before {
230
+ content: attr(data-placeholder);
231
+ color: var(--placeholder);
232
+ pointer-events: none;
233
+ float: left;
234
+ height: 0;
235
+ }
236
+
237
+ .tiptap h2:not([data-node-view-wrapper] *),
238
+ [data-node-view-wrapper] .tiptap h2 {
239
+ font-size: 1.25rem;
240
+ font-weight: 600;
241
+ margin: 1em 0 0.5em;
242
+ }
243
+
244
+ .tiptap h3:not([data-node-view-wrapper] *),
245
+ [data-node-view-wrapper] .tiptap h3 {
246
+ font-size: 1.1rem;
247
+ font-weight: 600;
248
+ margin: 0.75em 0 0.4em;
249
+ }
250
+
251
+ .tiptap ul:not([data-node-view-wrapper] *),
252
+ [data-node-view-wrapper] .tiptap ul {
253
+ padding-left: 1.5em;
254
+ margin: 0.5em 0;
255
+ list-style-type: disc;
256
+ }
257
+
258
+ .tiptap ol:not([data-node-view-wrapper] *),
259
+ [data-node-view-wrapper] .tiptap ol {
260
+ padding-left: 1.5em;
261
+ margin: 0.5em 0;
262
+ list-style-type: decimal;
263
+ }
264
+
265
+ .tiptap li:not([data-node-view-wrapper] *),
266
+ [data-node-view-wrapper] .tiptap li {
267
+ margin: 0.2em 0;
268
+ }
269
+
270
+ .tiptap blockquote:not([data-node-view-wrapper] *),
271
+ [data-node-view-wrapper] .tiptap blockquote {
272
+ border-left: 3px solid var(--border);
273
+ padding-left: 1em;
274
+ margin: 0.5em 0;
275
+ color: var(--muted-foreground);
276
+ }
277
+
278
+ /* ── Toast animations ────────────────────────────────────────────── */
279
+ @keyframes toast-in {
280
+ from {
281
+ opacity: 0;
282
+ transform: translateY(-12px) scale(0.96);
283
+ }
284
+ to {
285
+ opacity: 1;
286
+ transform: translateY(0) scale(1);
287
+ }
288
+ }
289
+ @keyframes toast-out {
290
+ from {
291
+ opacity: 1;
292
+ transform: translateY(0) scale(1);
293
+ }
294
+ to {
295
+ opacity: 0;
296
+ transform: translateY(-8px) scale(0.96);
297
+ }
298
+ }
299
+
300
+ /* ── Dark mode: Tiptap placeholder ───────────────────────────────── */
301
+ .dark .tiptap p.is-empty::before {
302
+ color: var(--placeholder) !important;
303
+ }
304
+
305
+ /* Fallback marker for a rejected field with no native invalid styling — composite
306
+ controls (pickers, block and rich-text editors) whose focusable element is not
307
+ an input. Anything with [aria-invalid] styles itself and never gets this. */
308
+ [data-cms-invalid]:not([aria-invalid]) {
309
+ outline: 1px solid var(--destructive);
310
+ outline-offset: 3px;
311
+ border-radius: var(--radius-lg);
312
+ }
@@ -41,13 +41,17 @@ export default function ColorField({ name, value: initial, placeholder, colors =
41
41
  onChange?.(v);
42
42
  };
43
43
 
44
- const selected = colors.find((c) => c.value.toLowerCase() === value.trim().toLowerCase());
44
+ // A stored value outside the palette (imported content, a palette edit) must stay
45
+ // visible and re-selectable rather than collapsing into the empty placeholder.
46
+ const known = colors.find((c) => c.value.toLowerCase() === value.trim().toLowerCase());
47
+ const options = value && !known ? [{ label: "Custom", value }, ...colors] : colors;
48
+ const selected = known ?? options.find((c) => c.value === value);
45
49
 
46
50
  return (
47
51
  <div className="relative">
48
52
  {name && <input type="hidden" name={name} value={value} ref={hiddenRef} />}
49
53
 
50
- <Select items={colors} value={value} onValueChange={(v) => set((v as string) ?? "")}>
54
+ <Select items={options} value={value} onValueChange={(v) => set((v as string) ?? "")}>
51
55
  <SelectTrigger className={cn("w-full", value && "pr-14")}>
52
56
  {selected ? (
53
57
  <span className="flex flex-1 items-center gap-2">
@@ -61,7 +65,7 @@ export default function ColorField({ name, value: initial, placeholder, colors =
61
65
  </SelectTrigger>
62
66
  <SelectContent>
63
67
  <SelectGroup>
64
- {colors.map((c) => (
68
+ {options.map((c) => (
65
69
  <SelectItem key={c.value} value={c.value}>
66
70
  <Swatch color={c.value} />
67
71
  <span className="flex-1">{c.label}</span>
@@ -357,7 +357,7 @@ const ToolbarButton = ({
357
357
  title={title}
358
358
  className={cn(
359
359
  "disabled:hover:text-muted-foreground inline-flex size-8 items-center justify-center rounded-md transition-colors outline-none disabled:opacity-50 disabled:hover:bg-transparent",
360
- active ? "bg-accent text-accent-foreground" : "text-muted-foreground hover:bg-muted-strong hover:text-foreground",
360
+ active ? "bg-foreground/10 text-foreground" : "text-muted-foreground hover:bg-muted-strong hover:text-foreground",
361
361
  )}
362
362
  >
363
363
  {children}
@@ -183,7 +183,7 @@ const ToolbarButton = ({
183
183
  className={cn(
184
184
  "disabled:hover:text-muted-foreground inline-flex size-8 items-center justify-center rounded-md transition-colors outline-none disabled:opacity-50 disabled:hover:bg-transparent",
185
185
  active
186
- ? "bg-muted-strong text-accent-foreground"
186
+ ? "bg-foreground/10 text-foreground"
187
187
  : "text-muted-foreground hover:bg-muted-strong hover:text-foreground",
188
188
  )}
189
189
  >
@@ -35,7 +35,8 @@ export const FIELD_MODEL: Record<string, FieldModelEntry> = {
35
35
  select: { storage: "text", control: "dropdown", valueShape: "string (one of `options`)" },
36
36
  color: {
37
37
  storage: "text",
38
- control: "colour swatch picker (brand palette + custom + hex)",
38
+ control:
39
+ "colour swatch picker — palette from admin.colors (or per-field colors); no free hex entry, off-palette values show as 'Custom'",
39
40
  valueShape: "hex string e.g. '#00BB5F' (empty string = inherit default)",
40
41
  },
41
42
  richText: {
package/core/migrate.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  * (internals/describe.ts) and `createCmsContext` (internals/context.ts).
7
7
  */
8
8
  import type { CMSConfig, CollectionConfig, FieldConfig } from "./define";
9
+ import { getTranslatableFieldNames } from "./define";
9
10
  import { describeModel, FIELD_MODEL, CONTENT_AST_SCHEMA } from "./field-model";
10
11
 
11
12
  export type ValidationIssue = { field: string; message: string };
@@ -58,12 +59,70 @@ const validateField = (
58
59
  case "content":
59
60
  validateContent(name, field, value, errors, warnings);
60
61
  break;
62
+ case "json":
63
+ if (field.itemFields && Array.isArray(value)) validateRows(name, field.itemFields, value, warnings);
64
+ break;
65
+ case "blocks":
66
+ if (!Array.isArray(value)) errors.push({ field: name, message: "blocks expects an array" });
67
+ else validateBlockList(name, field.types, value, warnings);
68
+ break;
61
69
  case "date":
62
70
  if (Number.isNaN(Date.parse(String(value)))) warnings.push({ field: name, message: "date is not parseable" });
63
71
  break;
64
72
  }
65
73
  };
66
74
 
75
+ /**
76
+ * Nested shapes (inline/standalone block fields, repeater rows) are stored as
77
+ * the importer wrote them — the API does not re-validate them on save. Check
78
+ * them anyway so a wrong key surfaces in the report instead of as raw JSON in
79
+ * the editor, but as warnings: the top-level document still counts as valid.
80
+ */
81
+ const validateShape = (
82
+ prefix: string,
83
+ declared: Record<string, FieldConfig>,
84
+ value: Record<string, unknown>,
85
+ warnings: ValidationIssue[],
86
+ ) => {
87
+ const nested: ValidationIssue[] = [];
88
+ for (const [key, sub] of Object.entries(declared)) validateField(`${prefix}.${key}`, sub, value[key], nested, nested);
89
+ for (const key of Object.keys(value)) {
90
+ if (!(key in declared)) nested.push({ field: `${prefix}.${key}`, message: "not a declared field" });
91
+ }
92
+ warnings.push(...nested);
93
+ };
94
+
95
+ const validateRows = (
96
+ name: string,
97
+ itemFields: Record<string, FieldConfig>,
98
+ rows: unknown[],
99
+ warnings: ValidationIssue[],
100
+ ) => {
101
+ rows.forEach((row, i) => {
102
+ if (!row || typeof row !== "object" || Array.isArray(row)) {
103
+ warnings.push({ field: `${name}[${i}]`, message: "repeater row expects an object" });
104
+ return;
105
+ }
106
+ validateShape(`${name}[${i}]`, itemFields, row as Record<string, unknown>, warnings);
107
+ });
108
+ };
109
+
110
+ const validateBlockList = (
111
+ name: string,
112
+ types: Record<string, Record<string, FieldConfig>>,
113
+ blocks: unknown[],
114
+ warnings: ValidationIssue[],
115
+ ) => {
116
+ blocks.forEach((block, i) => {
117
+ const { type, ...fields } = (block ?? {}) as { type?: string } & Record<string, unknown>;
118
+ if (!type || !(type in types)) {
119
+ warnings.push({ field: `${name}[${i}]`, message: `block type '${type}' is not declared in this field's types` });
120
+ return;
121
+ }
122
+ validateShape(`${name}[${i}]<${type}>`, types[type], fields, warnings);
123
+ });
124
+ };
125
+
67
126
  const validateContent = (
68
127
  name: string,
69
128
  field: Extract<FieldConfig, { type: "content" }>,
@@ -75,15 +134,20 @@ const validateContent = (
75
134
  errors.push({ field: name, message: "content expects { type:'root', children:[…] }" });
76
135
  return;
77
136
  }
78
- const declared = new Set(Object.keys(field.blocks ?? {}));
79
- for (const node of (value as { children?: Array<{ type?: string; blockType?: string }> }).children ?? []) {
80
- if (node?.type === "block" && node.blockType && !declared.has(node.blockType)) {
137
+ const declared = field.blocks ?? {};
138
+ const children = (value as { children?: Array<{ type?: string; blockType?: string; fields?: unknown }> }).children;
139
+ (children ?? []).forEach((node, i) => {
140
+ if (node?.type !== "block" || !node.blockType) return;
141
+ if (!(node.blockType in declared)) {
81
142
  warnings.push({
82
143
  field: name,
83
144
  message: `inline block '${node.blockType}' is not declared in this field's blocks`,
84
145
  });
146
+ return;
85
147
  }
86
- }
148
+ const fields = node.fields && typeof node.fields === "object" ? (node.fields as Record<string, unknown>) : {};
149
+ validateShape(`${name}[${i}]<${node.blockType}>`, declared[node.blockType], fields, warnings);
150
+ });
87
151
  };
88
152
 
89
153
  /** Validate a document's fields against its collection schema. */
@@ -100,6 +164,61 @@ export const validateDocument = (collection: CollectionConfig, data: Record<stri
100
164
  return { ok: errors.length === 0, errors, warnings };
101
165
  };
102
166
 
167
+ /**
168
+ * Validate an import item's per-locale overlays. Translation tables only exist
169
+ * for fields marked `translatable: true`, and `upsertTranslation` silently drops
170
+ * everything else — so catch both here, before the base document is written.
171
+ */
172
+ export const validateTranslations = (
173
+ config: CMSConfig,
174
+ collection: CollectionConfig,
175
+ translations: Record<string, Record<string, unknown>> | undefined,
176
+ ): ValidationResult => {
177
+ const errors: ValidationIssue[] = [];
178
+ const warnings: ValidationIssue[] = [];
179
+ const locales = Object.keys(translations ?? {});
180
+ if (locales.length === 0) return { ok: true, errors, warnings };
181
+
182
+ const translatable = new Set(getTranslatableFieldNames(collection));
183
+ if (!config.locales || translatable.size === 0) {
184
+ errors.push({
185
+ field: "translations",
186
+ message: !config.locales
187
+ ? "no locales configured (set `locales` in cms.config.ts)"
188
+ : `collection has no translatable fields (mark them \`translatable: true\`, then cms:generate + cms:push)`,
189
+ });
190
+ return { ok: false, errors, warnings };
191
+ }
192
+
193
+ for (const locale of locales) {
194
+ const prefix = `translations.${locale}`;
195
+ if (locale === config.locales.default) {
196
+ errors.push({ field: prefix, message: `'${locale}' is the default locale — put it in \`data\`` });
197
+ continue;
198
+ }
199
+ if (!config.locales.supported.includes(locale)) {
200
+ errors.push({ field: prefix, message: `'${locale}' is not in locales.supported` });
201
+ continue;
202
+ }
203
+ const overlay = translations![locale] ?? {};
204
+ const keys = Object.keys(overlay).filter((k) => !k.startsWith("_"));
205
+ const kept = keys.filter((k) => translatable.has(k));
206
+ for (const key of keys) {
207
+ if (!translatable.has(key))
208
+ warnings.push({ field: `${prefix}.${key}`, message: "not a translatable field (will be dropped)" });
209
+ }
210
+ if (keys.length && kept.length === 0) {
211
+ errors.push({
212
+ field: prefix,
213
+ message: "none of these fields are translatable — the whole translation would be dropped",
214
+ });
215
+ continue;
216
+ }
217
+ for (const key of kept) validateField(`${prefix}.${key}`, collection.fields[key], overlay[key], errors, warnings);
218
+ }
219
+ return { ok: errors.length === 0, errors, warnings };
220
+ };
221
+
103
222
  // ---------------------------------------------------------------------------
104
223
  // Batch loader (import IR → CMS) with dry-run + validation report.
105
224
  // ---------------------------------------------------------------------------
@@ -173,10 +292,13 @@ export const importDocuments = async (
173
292
  report.failed++;
174
293
  continue;
175
294
  }
176
- const result = validateDocument(collection, item.data);
177
- if (result.warnings.length) report.warnings.push({ collection: item.collection, id, warnings: result.warnings });
178
- if (!result.ok) {
179
- report.invalid.push({ collection: item.collection, id, errors: result.errors });
295
+ const doc = validateDocument(collection, item.data);
296
+ const i18n = validateTranslations(config, collection, item.translations);
297
+ const warnings = [...doc.warnings, ...i18n.warnings];
298
+ const errors = [...doc.errors, ...i18n.errors];
299
+ if (warnings.length) report.warnings.push({ collection: item.collection, id, warnings });
300
+ if (errors.length) {
301
+ report.invalid.push({ collection: item.collection, id, errors });
180
302
  report.failed++;
181
303
  continue;
182
304
  }
@@ -235,6 +357,10 @@ export const renderModelMarkdown = (config: CMSConfig): string => {
235
357
  out.push("");
236
358
  out.push(`**Locales:** default \`${model.locales.default}\`, supported \`${model.locales.supported.join(", ")}\``);
237
359
  out.push("");
360
+ out.push("> The **i18n** column is `yes` only for fields declared `translatable: true`. Only those");
361
+ out.push("> fields accept per-locale values (`translations` in an import item, `upsertTranslation`);");
362
+ out.push("> everything else is base-locale only. A collection with no `yes` has no translation table.");
363
+ out.push("");
238
364
 
239
365
  out.push("## Field types");
240
366
  out.push("");
@@ -252,8 +378,9 @@ export const renderModelMarkdown = (config: CMSConfig): string => {
252
378
  out.push(`root: ${CONTENT_AST_SCHEMA.root}`);
253
379
  for (const [k, v] of Object.entries(CONTENT_AST_SCHEMA.nodes)) out.push(` ${k}: ${v}`);
254
380
  out.push("```");
255
- out.push("> A `content` field stores any `{type:'root'}` doc as-is — inline block `fields` are not");
256
- out.push("> validated. Build prose with `htmlToRichText(html)`; declare `blocks` for the editor.");
381
+ out.push("> A `content` field stores any `{type:'root'}` doc as-is — the API does not check inline");
382
+ out.push("> block `fields` on save, but `load({ dryRun: true })` reports mismatches as warnings.");
383
+ out.push("> Build prose with `htmlToRichText(html)`; declare `blocks` for the editor.");
257
384
  out.push("");
258
385
 
259
386
  for (const collection of model.collections) {
@@ -116,9 +116,13 @@ export default function cmsIntegration(options?: CmsIntegrationOptions): AstroIn
116
116
  "astro:config:setup": ({ command, updateConfig, injectRoute, injectScript, addMiddleware }) => {
117
117
  const root = process.cwd();
118
118
 
119
- // Generate a wrapper CSS that adds @source directives and imports user's admin CSS
119
+ // Generate a wrapper CSS: Tailwind sources + the core admin chrome +
120
+ // the project's theme file. Chrome (layers, focus, editor styles,
121
+ // variants) is core-owned and updates with the package; the project
122
+ // file defines only color tokens.
120
123
  const adminDir = packagePath("admin");
121
124
  const routesDir = packagePath("routes");
125
+ const adminBaseCss = path.join(adminDir, "admin-base.css");
122
126
  // tw-animate-css is a CSS-only package (exports only a "style" condition),
123
127
  // so Node resolution can't reach into it — walk the module paths instead.
124
128
  const twAnimateCssPath = resolvePackageFile("tw-animate-css", "dist/tw-animate.css");
@@ -131,25 +135,10 @@ export default function cmsIntegration(options?: CmsIntegrationOptions): AstroIn
131
135
  [
132
136
  `@source "${adminDir}";`,
133
137
  `@source "${routesDir}";`,
138
+ `@import "${adminBaseCss}";`,
134
139
  `@import "${twAnimateCssPath}";`,
135
140
  `@import "${userAdminCss}";`,
136
141
  "",
137
- "/* shadcn component styles (accordion, state variants) */",
138
- "@theme inline {",
139
- " @keyframes accordion-down { from { height: 0 } to { height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto)) } }",
140
- " @keyframes accordion-up { from { height: var(--radix-accordion-content-height, var(--accordion-panel-height, auto)) } to { height: 0 } }",
141
- "}",
142
- '@custom-variant data-open { &:where([data-state="open"]), &:where([data-open]:not([data-open="false"])) { @slot; } }',
143
- '@custom-variant data-closed { &:where([data-state="closed"]), &:where([data-closed]:not([data-closed="false"])) { @slot; } }',
144
- '@custom-variant data-checked { &:where([data-state="checked"]), &:where([data-checked]:not([data-checked="false"])) { @slot; } }',
145
- '@custom-variant data-unchecked { &:where([data-state="unchecked"]), &:where([data-unchecked]:not([data-unchecked="false"])) { @slot; } }',
146
- '@custom-variant data-selected { &:where([data-selected="true"]) { @slot; } }',
147
- '@custom-variant data-disabled { &:where([data-disabled="true"]), &:where([data-disabled]:not([data-disabled="false"])) { @slot; } }',
148
- '@custom-variant data-active { &:where([data-state="active"]), &:where([data-active]:not([data-active="false"])) { @slot; } }',
149
- '@custom-variant data-horizontal { &:where([data-orientation="horizontal"]) { @slot; } }',
150
- '@custom-variant data-vertical { &:where([data-orientation="vertical"]) { @slot; } }',
151
- "@utility no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; &::-webkit-scrollbar { display: none; } }",
152
- "",
153
142
  ].join("\n"),
154
143
  );
155
144
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kidecms/core",
3
- "version": "0.23.1",
3
+ "version": "0.25.0",
4
4
  "description": "Kide CMS runtime — core library, admin UI, routes, and middleware for Astro. Shipped as TypeScript source.",
5
5
  "keywords": [
6
6
  "cms",