@bettercms-ai/kit 2.0.11 → 3.0.1

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 (108) hide show
  1. package/README.md +1 -2
  2. package/dist/adapters/schema.js +45 -5
  3. package/dist/adapters/schema.js.map +1 -1
  4. package/dist/brand/logo.js.map +1 -1
  5. package/dist/context.d.ts +7 -0
  6. package/dist/context.js +6 -1
  7. package/dist/context.js.map +1 -1
  8. package/dist/controls/button.js +1 -1
  9. package/dist/controls/code.d.ts +24 -1
  10. package/dist/controls/code.js +36 -20
  11. package/dist/controls/code.js.map +1 -1
  12. package/dist/controls/icon.d.ts +28 -0
  13. package/dist/controls/icon.js +205 -61
  14. package/dist/controls/icon.js.map +1 -1
  15. package/dist/controls/index.d.ts +20 -2
  16. package/dist/controls/index.js +21 -20
  17. package/dist/controls/index.js.map +1 -1
  18. package/dist/controls/link.js +4 -4
  19. package/dist/controls/link.js.map +1 -1
  20. package/dist/controls/location.js +1 -1
  21. package/dist/controls/media.js +2 -2
  22. package/dist/controls/reference.js +3 -2
  23. package/dist/controls/reference.js.map +1 -1
  24. package/dist/controls/rich-text/blocks.js +2 -2
  25. package/dist/controls/rich-text/control.js +1 -1
  26. package/dist/controls/rich-text/editor.js +5 -5
  27. package/dist/controls/rich-text/embed.js +1 -1
  28. package/dist/controls/rich-text/toc.js +1 -1
  29. package/dist/controls/slot-register.js +1 -1
  30. package/dist/controls/table/table.js +1 -1
  31. package/dist/controls/text.js +5 -4
  32. package/dist/controls/text.js.map +1 -1
  33. package/dist/core/core.js +1 -1
  34. package/dist/engine/array.js +58 -13
  35. package/dist/engine/array.js.map +1 -1
  36. package/dist/engine/bits.js +1 -1
  37. package/dist/engine/breadcrumb.js +1 -1
  38. package/dist/engine/expand.js +1 -1
  39. package/dist/engine/field-shell.js +8 -7
  40. package/dist/engine/field-shell.js.map +1 -1
  41. package/dist/engine/frame.d.ts +1 -12
  42. package/dist/engine/frame.js +7 -149
  43. package/dist/engine/frame.js.map +1 -1
  44. package/dist/engine/group-summary.js +7 -4
  45. package/dist/engine/group-summary.js.map +1 -1
  46. package/dist/engine/grouping.js +2 -2
  47. package/dist/engine/item-list.js +2 -2
  48. package/dist/engine/kit-field.js +3 -7
  49. package/dist/engine/kit-field.js.map +1 -1
  50. package/dist/engine/schema-form.d.ts +10 -5
  51. package/dist/engine/schema-form.js +18 -10
  52. package/dist/engine/schema-form.js.map +1 -1
  53. package/dist/engine/slot.js +2 -2
  54. package/dist/index.d.ts +9 -9
  55. package/dist/index.js +32 -6
  56. package/dist/index.js.map +1 -1
  57. package/dist/kit.css +3 -11
  58. package/dist/lib/cn.js.map +1 -1
  59. package/dist/lib/frames.js +1 -1
  60. package/dist/lib/schema.d.ts +8 -1
  61. package/dist/lib/schema.js +18 -2
  62. package/dist/lib/schema.js.map +1 -1
  63. package/dist/lib/utils.d.ts +1 -4
  64. package/dist/lib/utils.js +4 -14
  65. package/dist/lib/utils.js.map +1 -1
  66. package/dist/lib/validate.d.ts +14 -1
  67. package/dist/lib/validate.js +26 -10
  68. package/dist/lib/validate.js.map +1 -1
  69. package/dist/library/coreNotes.d.ts +1 -1
  70. package/dist/library/coreNotes.js.map +1 -1
  71. package/dist/library/entries/conversion.entries.js +8 -0
  72. package/dist/library/entries/conversion.entries.js.map +1 -1
  73. package/dist/library/entries/features.entries.js +5 -0
  74. package/dist/library/entries/features.entries.js.map +1 -1
  75. package/dist/library/examples/faq.js +1 -0
  76. package/dist/library/examples/faq.js.map +1 -1
  77. package/dist/library/examples/journalStory.js +1 -2
  78. package/dist/library/examples/journalStory.js.map +1 -1
  79. package/dist/library/kit-catalog.json +4 -4
  80. package/dist/schema/adapters.js +17 -3
  81. package/dist/schema/adapters.js.map +1 -1
  82. package/dist/schema/sources.d.ts +9 -1
  83. package/dist/schema/sources.js +1 -1
  84. package/dist/schema/sources.js.map +1 -1
  85. package/dist/schema/types.d.ts +31 -3
  86. package/dist/schema/types.js.map +1 -1
  87. package/dist/styles.css +1 -1
  88. package/dist/table/table.css +1 -1
  89. package/dist/theme.css +18 -9
  90. package/dist/tokens.css +32 -60
  91. package/dist/ui/action-tray.d.ts +1 -3
  92. package/dist/ui/action-tray.js +3 -20
  93. package/dist/ui/action-tray.js.map +1 -1
  94. package/dist/ui/display.d.ts +1 -4
  95. package/dist/ui/display.js +4 -6
  96. package/dist/ui/display.js.map +1 -1
  97. package/dist/ui/index.js +3 -3
  98. package/dist/ui/overlay.d.ts +2 -5
  99. package/dist/ui/overlay.js +3 -4
  100. package/dist/ui/overlay.js.map +1 -1
  101. package/dist/ui/path-crumbs.d.ts +0 -2
  102. package/dist/ui/path-crumbs.js.map +1 -1
  103. package/dist/ui/surfaces.d.ts +2 -18
  104. package/dist/ui/surfaces.js +3 -19
  105. package/dist/ui/surfaces.js.map +1 -1
  106. package/dist/ui/toast.js +1 -1
  107. package/dist/ui/toast.js.map +1 -1
  108. package/package.json +2 -2
@@ -259,7 +259,8 @@ function propDefToFieldBase(p, sample) {
259
259
  };
260
260
  case "number": return {
261
261
  ...base,
262
- type: "number"
262
+ type: "number",
263
+ ...p.numeric ? { numeric: p.numeric } : {}
263
264
  };
264
265
  case "table": return {
265
266
  ...base,
@@ -336,6 +337,16 @@ function blockDefToSchema(def) {
336
337
  })) : fields.map(({ group: _g, ...f }) => f)
337
338
  };
338
339
  }
340
+ var UNIT_WORDS = {
341
+ minutes: "min",
342
+ seconds: "s",
343
+ hours: "h",
344
+ days: "days",
345
+ pixels: "px",
346
+ percent: "%",
347
+ grams: "g",
348
+ kilograms: "kg"
349
+ };
339
350
  var SIMPLE = {
340
351
  text: "string",
341
352
  textarea: "text",
@@ -385,11 +396,14 @@ function fieldDefToSchema(def, sample) {
385
396
  }
386
397
  switch (def.type) {
387
398
  case "number": {
388
- const unit = def.help && def.help.length < 14 ? def.help : def.id === "price" ? "USD" : void 0;
399
+ const said = def.help?.match(/^In (\w+)\.?$/i)?.[1]?.toLowerCase();
400
+ const bare = def.help && def.help.length <= 8 && !/[.\s]/.test(def.help.trim()) ? def.help.trim() : void 0;
401
+ const fromHelp = said ? UNIT_WORDS[said] ?? said : bare;
402
+ const unit = fromHelp ?? (def.id === "price" ? "USD" : void 0);
389
403
  return {
390
404
  ...base,
391
405
  type: "number",
392
- description: unit ? void 0 : def.help,
406
+ description: fromHelp ? "" : def.help,
393
407
  numeric: unit ? { unit } : void 0
394
408
  };
395
409
  }
@@ -1 +1 @@
1
- {"version":3,"file":"adapters.js","names":[],"sources":["../../src/schema/adapters.ts"],"sourcesContent":["/**\n * ADAPTERS — today's field definitions → the Block Kit schema, so each editor switches to <SchemaForm> in one line.\n *\n * Visuals inspector: <SchemaForm schema={blockDefToSchema(def)} value={block.props} onChange={…} />\n * Content editor: <SchemaForm schema={fieldDefsToSchema(collection.fields, { values })} … />\n *\n * Both catalogs are loose (repeaters without item fields, links stored as strings); the adapters infer item\n * fields from sample values and mark legacy string values with `valueShape: \"string\"` so data round-trips\n * unchanged.\n */\nimport type { BlockDef, FieldDef, FieldType, PropDef } from \"./sources\";\nimport type { FieldGroup, FieldSchema, Option, TypeSchema } from \"./types\";\n\ntype Obj = Record<string, unknown>;\nconst isObj = (v: unknown): v is Obj => !!v && typeof v === \"object\" && !Array.isArray(v);\nconst options = (o?: string[]): Option[] | undefined => o?.map((x) => ({ value: x, label: x }));\n\n/** Nice titles for inferred keys (\"q\" → \"Question\"). */\nconst TITLES: Record<string, string> = {\n q: \"Question\", a: \"Answer\", href: \"Link\", url: \"Link\", cta: \"Button\", img: \"Image\", desc: \"Description\", qty: \"Amount\",\n featured: \"Highlighted\", note: \"Note\", links: \"Links\", price: \"Price\", name: \"Name\", title: \"Title\", label: \"Label\",\n};\nexport const titleFromKey = (k: string) => TITLES[k] ?? (k.charAt(0).toUpperCase() + k.slice(1)).replace(/([a-z])([A-Z])/g, \"$1 $2\").replace(/[_-]/g, \" \").replace(/ (\\w)/g, (m) => m.toLowerCase());\nconst looksLikeImage = (k: string, v: unknown) => typeof v === \"string\" && (/\\b(image|img|photo|cover|avatar|logo)\\b/i.test(k) || /picsum|\\.(jpe?g|png|webp|avif|svg)(\\?|$)/.test(v));\n\n/** Infer a field from a sample value (used for repeaters/groups without declared fields). */\nexport function inferField(key: string, sample: unknown): FieldSchema {\n const title = titleFromKey(key);\n if (Array.isArray(sample)) {\n const first = sample[0];\n if (isObj(first)) return { name: key, title, type: \"array\", of: [inferItem(key, first)] };\n if (typeof first === \"string\" && sample.every((x) => looksLikeImage(key, x)) && sample.length)\n return { name: key, title, type: \"array\", of: [{ name: \"image\", title: \"Image\", type: \"image\", valueShape: \"string\" }] };\n return { name: key, title, type: \"array\", layout: \"list\", of: [{ name: \"value\", title: singular(title), type: \"string\" }] };\n }\n if (typeof sample === \"boolean\") return { name: key, title, type: \"boolean\" };\n if (typeof sample === \"number\") return { name: key, title, type: \"number\" };\n if (looksLikeImage(key, sample)) return { name: key, title, type: \"image\", valueShape: \"string\" };\n if (isObj(sample)) {\n if (\"href\" in sample && \"label\" in sample) return { name: key, title, type: \"button\" };\n if (\"href\" in sample) return { name: key, title, type: \"link\" };\n if (\"url\" in sample) return { name: key, title, type: \"image\" };\n return { name: key, title, type: \"object\", fields: Object.entries(sample).filter(([k]) => !k.startsWith(\"_\")).map(([k, v]) => inferField(k, v)) };\n }\n if (key === \"href\" || key === \"link\") return { name: key, title, type: \"link\", valueShape: \"string\" };\n if (typeof sample === \"string\" && /<\\/?(p|h\\d|ul|ol|strong|em)\\b/.test(sample)) return { name: key, title, type: \"richtext\" };\n if (typeof sample === \"string\" && sample.length > 60) return { name: key, title, type: \"text\" };\n return { name: key, title, type: \"string\" };\n}\nfunction inferItem(arrayKey: string, sample: Obj): FieldSchema {\n const fields = Object.entries(sample).filter(([k]) => !k.startsWith(\"_\")).map(([k, v]) => inferField(k, v));\n const first = fields.find((f) => f.type === \"string\" || f.type === \"text\");\n const second = fields.find((f) => f !== first && (f.type === \"string\" || f.type === \"text\" || f.type === \"richtext\"));\n const media = fields.find((f) => f.type === \"image\");\n return {\n name: `${arrayKey}Item`,\n title: singular(titleFromKey(arrayKey)),\n type: \"object\",\n fields,\n preview: { title: first?.name, subtitle: second?.name, media: media?.name },\n };\n}\nconst cap = (t: string) => t.charAt(0).toUpperCase() + t.slice(1);\nconst singular = (t: string) => (t.endsWith(\"ies\") ? `${t.slice(0, -3)}y` : t.endsWith(\"s\") && !t.endsWith(\"ss\") ? t.slice(0, -1) : t);\n\n/* ── Visuals catalog (PropDef) → FieldSchema ─────────────────────────── */\nexport function propDefToField(p: PropDef, sample?: unknown): FieldSchema {\n const f = propDefToFieldBase(p, sample);\n // D45 organisation + conditions + array nouns ride along on every type\n return {\n ...f,\n ...(p.fieldset ? { fieldset: p.fieldset } : {}),\n ...(p.showIf ? { hidden: { field: p.showIf.key, equals: p.showIf.equals } } : {}),\n ...(p.itemNoun ? { itemNoun: p.itemNoun } : {}),\n ...(p.placeholder ? { placeholder: p.placeholder } : {}),\n ...(p.min != null && f.type === \"array\" ? { validation: { ...f.validation, min: p.min } } : {}),\n ...(p.max != null && f.type === \"array\" ? { validation: { ...f.validation, max: p.max } } : {}),\n };\n}\n\nfunction propDefToFieldBase(p: PropDef, sample?: unknown): FieldSchema {\n const base = { name: p.key, title: p.label, description: p.help, helpMore: p.helpMore, group: p.group?.toLowerCase() } satisfies Partial<FieldSchema>;\n const max = p.max ? { max: p.max } : undefined;\n switch (p.type) {\n case \"list\":\n // D47: one-line items are an array of strings, never tags\n return { ...base, type: \"array\", layout: \"list\", of: [{ name: \"value\", title: p.itemNoun ? cap(p.itemNoun) : singular(p.label), type: \"string\" }] };\n case \"icon\":\n return { ...base, type: \"icon\" };\n case \"boolean\":\n return { ...base, type: \"boolean\" };\n case \"references\":\n return { ...base, type: \"array\", validation: { unique: true }, of: [{ name: `${p.key}Ref`, title: singular(p.label), type: \"reference\", reference: { to: [p.reference ?? \"page\"] } }] };\n case \"group\": {\n const first = isObj(sample) ? sample : undefined;\n if (!p.item?.length) break;\n return { ...base, type: \"object\", fields: p.item.map((x) => propDefToField(x, first?.[x.key])) };\n }\n case \"text\":\n return { ...base, type: \"string\", validation: max, ai: true };\n case \"textarea\":\n return { ...base, type: \"text\", validation: max, ai: true };\n case \"richtext\":\n return { ...base, type: \"richtext\", ai: true };\n case \"image\":\n return { ...base, type: \"image\", valueShape: typeof sample === \"string\" ? \"string\" : undefined };\n case \"gallery\":\n return { ...base, type: \"array\", of: [{ name: \"image\", title: \"Image\", type: \"image\", valueShape: \"string\" }] };\n case \"link\":\n return { ...base, type: \"link\", valueShape: typeof sample === \"string\" ? \"string\" : undefined };\n case \"button\":\n return { ...base, type: \"button\" };\n case \"tags\":\n return { ...base, type: \"tags\" };\n case \"select\":\n return { ...base, type: \"select\", options: options(p.options) };\n case \"number\":\n return { ...base, type: \"number\" };\n case \"table\":\n return { ...base, type: \"table\", validation: { required: true } };\n case \"reference\":\n return { ...base, type: \"reference\", reference: { to: [p.reference ?? (p.key === \"form\" ? \"form\" : p.key === \"collection\" ? \"collection\" : \"page\")] } };\n case \"repeater\": {\n const items = Array.isArray(sample) ? sample : [];\n const first = items.find(isObj);\n const fields = p.item?.length ? p.item.map((x) => propDefToField(x, first?.[x.key])) : first ? inferItem(p.key, first).fields! : [{ name: \"label\", title: \"Label\", type: \"string\" as const }];\n const t = fields.find((f) => f.type === \"string\" || f.type === \"text\");\n const s = fields.find((f) => f !== t && (f.type === \"string\" || f.type === \"text\" || f.type === \"richtext\"));\n return {\n ...base,\n type: \"array\",\n of: [{ name: `${p.key}Item`, title: p.itemNoun ? cap(p.itemNoun) : singular(p.label), type: \"object\", fields, icon: undefined, preview: { title: t?.name, subtitle: s?.name, media: fields.find((f) => f.type === \"image\")?.name } }],\n };\n }\n default:\n break;\n }\n return { ...base, ...inferField(p.key, sample), title: p.label };\n}\n\n/** A visual-editor block definition → TypeSchema. Groups appear only when props use more than one group. */\nexport function blockDefToSchema(def: BlockDef): TypeSchema {\n const fields = def.content.map((p) => propDefToField(p, def.defaults[p.key]));\n const used = Array.from(new Set(fields.map((f) => f.group ?? \"content\")));\n const groups: FieldGroup[] | undefined =\n used.length > 1 ? used.map((g, i) => ({ name: g, title: g.charAt(0).toUpperCase() + g.slice(1), default: g === \"content\" || i === 0 })) : undefined;\n return {\n name: def.type,\n title: def.name,\n kind: def.global ? \"global\" : \"block\",\n icon: def.icon,\n category: def.category,\n ...(def.placement ? { placement: def.placement } : {}),\n description: def.description,\n variants: def.variants,\n initialValue: def.defaults,\n groups,\n ...(def.fieldsets?.length ? { fieldsets: def.fieldsets.map((f) => ({ name: f.name, title: f.title, collapsed: f.collapsed, columns: f.columns })) } : {}),\n fields: groups ? fields.map((f) => ({ ...f, group: f.group ?? \"content\" })) : fields.map(({ group: _g, ...f }) => f),\n };\n}\n\n/* ── Content collections (FieldDef) → FieldSchema ────────────────────── */\nconst SIMPLE: Partial<Record<FieldType, FieldSchema[\"type\"]>> = {\n text: \"string\", textarea: \"text\", richtext: \"richtext\", slug: \"slug\", boolean: \"boolean\", date: \"date\", datetime: \"datetime\",\n image: \"image\", file: \"file\", video: \"video\", link: \"link\", button: \"button\", color: \"color\", json: \"json\", code: \"code\",\n email: \"email\", url: \"url\", location: \"geopoint\", rating: \"rating\", tags: \"tags\", table: \"table\",\n};\n\nexport function fieldDefToSchema(def: FieldDef, sample?: unknown): FieldSchema {\n const base: FieldSchema = {\n name: def.id,\n title: def.name,\n type: \"string\",\n description: def.help,\n helpMore: def.helpMore,\n localized: def.localized,\n validation: def.required || def.max ? { required: def.required, max: def.max } : undefined,\n };\n const simple = SIMPLE[def.type];\n if (simple) {\n const f: FieldSchema = { ...base, type: simple };\n if (simple === \"string\" || simple === \"text\" || simple === \"richtext\") f.ai = true;\n if (simple === \"image\" && typeof sample === \"string\") f.valueShape = \"string\";\n if (simple === \"link\" && typeof sample === \"string\") f.valueShape = \"string\";\n return f;\n }\n switch (def.type) {\n case \"number\": {\n const unit = def.help && def.help.length < 14 ? def.help : def.id === \"price\" ? \"USD\" : undefined;\n return { ...base, type: \"number\", description: unit ? undefined : def.help, numeric: unit ? { unit } : undefined };\n }\n case \"select\":\n return { ...base, type: \"select\", options: options(def.options) };\n case \"multiselect\":\n return { ...base, type: \"multiselect\", options: options(def.options) };\n case \"reference\":\n return { ...base, type: \"reference\", reference: { to: [def.id === \"form\" ? \"form\" : def.id === \"collection\" && !def.reference ? \"collection\" : def.reference ?? \"page\"] } };\n case \"references\":\n return { ...base, type: \"array\", of: [{ name: `${def.id}Ref`, title: singular(def.name), type: \"reference\", reference: { to: [def.reference ?? \"page\"] } }] };\n case \"gallery\":\n return { ...base, type: \"array\", arrayLayout: \"grid\", of: [{ name: \"image\", title: \"Image\", type: \"image\" }] };\n case \"group\":\n return { ...base, type: \"object\", fields: (def.fields ?? []).map((f) => fieldDefToSchema(f, isObj(sample) ? sample[f.id] : undefined)) };\n case \"repeater\": {\n const items = Array.isArray(sample) ? sample : [];\n const first = items.find(isObj);\n const fields = def.fields?.length\n ? def.fields.map((f) => fieldDefToSchema(f, first?.[f.id]))\n : first\n ? inferItem(def.id, first).fields!\n : def.id === \"ingredients\"\n ? [{ name: \"item\", title: \"Ingredient\", type: \"string\" as const }, { name: \"qty\", title: \"Amount\", type: \"string\" as const }]\n : [{ name: \"label\", title: \"Label\", type: \"string\" as const }, { name: \"value\", title: \"Value\", type: \"string\" as const }];\n const t = fields.find((f) => f.type === \"string\" || f.type === \"text\");\n const s = fields.find((f) => f !== t && (f.type === \"string\" || f.type === \"text\"));\n return { ...base, type: \"array\", validation: def.required ? { required: true } : undefined, of: [{ name: `${def.id}Item`, title: singular(def.name), type: \"object\", fields, preview: { title: t?.name, subtitle: s?.name } }] };\n }\n default:\n return { ...base, ...inferField(def.id, sample), title: def.name };\n }\n}\n\n/** A collection's (or page's) field list → TypeSchema for the document editor. */\nexport function fieldDefsToSchema(fields: FieldDef[], opts: { name?: string; title?: string; values?: Obj; kind?: TypeSchema[\"kind\"] } = {}): TypeSchema {\n return {\n name: opts.name ?? \"document\",\n title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Content":["/**\n * ADAPTERS — today's field definitions → the Block Kit schema, so each editor switches to <SchemaForm> in one line.\n *\n * Visuals inspector: <SchemaForm schema={blockDefToSchema(def)} value={block.props} onChange={…} />\n * Content editor: <SchemaForm schema={fieldDefsToSchema(collection.fields, { values })} … />\n *\n * Both catalogs are loose (repeaters without item fields, links stored as strings); the adapters infer item\n * fields from sample values and mark legacy string values with `valueShape: \"string\"` so data round-trips\n * unchanged.\n */\nimport type { BlockDef, FieldDef, FieldType, PropDef } from \"./sources\";\nimport type { FieldGroup, FieldSchema, Option, TypeSchema } from \"./types\";\n\ntype Obj = Record<string, unknown>;\nconst isObj = (v: unknown): v is Obj => !!v && typeof v === \"object\" && !Array.isArray(v);\nconst options = (o?: string[]): Option[] | undefined => o?.map((x) => ({ value: x, label: x }));\n\n/** Nice titles for inferred keys (\"q\" → \"Question\"). */\nconst TITLES: Record<string, string> = {\n q: \"Question\", a: \"Answer\", href: \"Link\", url: \"Link\", cta: \"Button\", img: \"Image\", desc: \"Description\", qty: \"Amount\",\n featured: \"Highlighted\", note: \"Note\", links: \"Links\", price: \"Price\", name: \"Name\", title: \"Title\", label: \"Label\",\n};\nexport const titleFromKey = (k: string) => TITLES[k] ?? (k.charAt(0).toUpperCase() + k.slice(1)).replace(/([a-z])([A-Z])/g, \"$1 $2\").replace(/[_-]/g, \" \").replace(/ (\\w)/g, (m) => m.toLowerCase());\nconst looksLikeImage = (k: string, v: unknown) => typeof v === \"string\" && (/\\b(image|img|photo|cover|avatar|logo)\\b/i.test(k) || /picsum|\\.(jpe?g|png|webp|avif|svg)(\\?|$)/.test(v));\n\n/** Infer a field from a sample value (used for repeaters/groups without declared fields). */\nexport function inferField(key: string, sample: unknown): FieldSchema {\n const title = titleFromKey(key);\n if (Array.isArray(sample)) {\n const first = sample[0];\n if (isObj(first)) return { name: key, title, type: \"array\", of: [inferItem(key, first)] };\n if (typeof first === \"string\" && sample.every((x) => looksLikeImage(key, x)) && sample.length)\n return { name: key, title, type: \"array\", of: [{ name: \"image\", title: \"Image\", type: \"image\", valueShape: \"string\" }] };\n return { name: key, title, type: \"array\", layout: \"list\", of: [{ name: \"value\", title: singular(title), type: \"string\" }] };\n }\n if (typeof sample === \"boolean\") return { name: key, title, type: \"boolean\" };\n if (typeof sample === \"number\") return { name: key, title, type: \"number\" };\n if (looksLikeImage(key, sample)) return { name: key, title, type: \"image\", valueShape: \"string\" };\n if (isObj(sample)) {\n if (\"href\" in sample && \"label\" in sample) return { name: key, title, type: \"button\" };\n if (\"href\" in sample) return { name: key, title, type: \"link\" };\n if (\"url\" in sample) return { name: key, title, type: \"image\" };\n return { name: key, title, type: \"object\", fields: Object.entries(sample).filter(([k]) => !k.startsWith(\"_\")).map(([k, v]) => inferField(k, v)) };\n }\n if (key === \"href\" || key === \"link\") return { name: key, title, type: \"link\", valueShape: \"string\" };\n if (typeof sample === \"string\" && /<\\/?(p|h\\d|ul|ol|strong|em)\\b/.test(sample)) return { name: key, title, type: \"richtext\" };\n if (typeof sample === \"string\" && sample.length > 60) return { name: key, title, type: \"text\" };\n return { name: key, title, type: \"string\" };\n}\nfunction inferItem(arrayKey: string, sample: Obj): FieldSchema {\n const fields = Object.entries(sample).filter(([k]) => !k.startsWith(\"_\")).map(([k, v]) => inferField(k, v));\n const first = fields.find((f) => f.type === \"string\" || f.type === \"text\");\n const second = fields.find((f) => f !== first && (f.type === \"string\" || f.type === \"text\" || f.type === \"richtext\"));\n const media = fields.find((f) => f.type === \"image\");\n return {\n name: `${arrayKey}Item`,\n title: singular(titleFromKey(arrayKey)),\n type: \"object\",\n fields,\n preview: { title: first?.name, subtitle: second?.name, media: media?.name },\n };\n}\nconst cap = (t: string) => t.charAt(0).toUpperCase() + t.slice(1);\nconst singular = (t: string) => (t.endsWith(\"ies\") ? `${t.slice(0, -3)}y` : t.endsWith(\"s\") && !t.endsWith(\"ss\") ? t.slice(0, -1) : t);\n\n/* ── Visuals catalog (PropDef) → FieldSchema ─────────────────────────── */\nexport function propDefToField(p: PropDef, sample?: unknown): FieldSchema {\n const f = propDefToFieldBase(p, sample);\n // D45 organisation + conditions + array nouns ride along on every type\n return {\n ...f,\n ...(p.fieldset ? { fieldset: p.fieldset } : {}),\n ...(p.showIf ? { hidden: { field: p.showIf.key, equals: p.showIf.equals } } : {}),\n ...(p.itemNoun ? { itemNoun: p.itemNoun } : {}),\n ...(p.placeholder ? { placeholder: p.placeholder } : {}),\n ...(p.min != null && f.type === \"array\" ? { validation: { ...f.validation, min: p.min } } : {}),\n ...(p.max != null && f.type === \"array\" ? { validation: { ...f.validation, max: p.max } } : {}),\n };\n}\n\nfunction propDefToFieldBase(p: PropDef, sample?: unknown): FieldSchema {\n const base = { name: p.key, title: p.label, description: p.help, helpMore: p.helpMore, group: p.group?.toLowerCase() } satisfies Partial<FieldSchema>;\n const max = p.max ? { max: p.max } : undefined;\n switch (p.type) {\n case \"list\":\n // D47: one-line items are an array of strings, never tags\n return { ...base, type: \"array\", layout: \"list\", of: [{ name: \"value\", title: p.itemNoun ? cap(p.itemNoun) : singular(p.label), type: \"string\" }] };\n case \"icon\":\n return { ...base, type: \"icon\" };\n case \"boolean\":\n return { ...base, type: \"boolean\" };\n case \"references\":\n return { ...base, type: \"array\", validation: { unique: true }, of: [{ name: `${p.key}Ref`, title: singular(p.label), type: \"reference\", reference: { to: [p.reference ?? \"page\"] } }] };\n case \"group\": {\n const first = isObj(sample) ? sample : undefined;\n if (!p.item?.length) break;\n return { ...base, type: \"object\", fields: p.item.map((x) => propDefToField(x, first?.[x.key])) };\n }\n case \"text\":\n return { ...base, type: \"string\", validation: max, ai: true };\n case \"textarea\":\n return { ...base, type: \"text\", validation: max, ai: true };\n case \"richtext\":\n return { ...base, type: \"richtext\", ai: true };\n case \"image\":\n return { ...base, type: \"image\", valueShape: typeof sample === \"string\" ? \"string\" : undefined };\n case \"gallery\":\n return { ...base, type: \"array\", of: [{ name: \"image\", title: \"Image\", type: \"image\", valueShape: \"string\" }] };\n case \"link\":\n return { ...base, type: \"link\", valueShape: typeof sample === \"string\" ? \"string\" : undefined };\n case \"button\":\n return { ...base, type: \"button\" };\n case \"tags\":\n return { ...base, type: \"tags\" };\n case \"select\":\n return { ...base, type: \"select\", options: options(p.options) };\n case \"number\":\n return { ...base, type: \"number\", ...(p.numeric ? { numeric: p.numeric } : {}) };\n case \"table\":\n return { ...base, type: \"table\", validation: { required: true } };\n case \"reference\":\n return { ...base, type: \"reference\", reference: { to: [p.reference ?? (p.key === \"form\" ? \"form\" : p.key === \"collection\" ? \"collection\" : \"page\")] } };\n case \"repeater\": {\n const items = Array.isArray(sample) ? sample : [];\n const first = items.find(isObj);\n const fields = p.item?.length ? p.item.map((x) => propDefToField(x, first?.[x.key])) : first ? inferItem(p.key, first).fields! : [{ name: \"label\", title: \"Label\", type: \"string\" as const }];\n const t = fields.find((f) => f.type === \"string\" || f.type === \"text\");\n const s = fields.find((f) => f !== t && (f.type === \"string\" || f.type === \"text\" || f.type === \"richtext\"));\n return {\n ...base,\n type: \"array\",\n of: [{ name: `${p.key}Item`, title: p.itemNoun ? cap(p.itemNoun) : singular(p.label), type: \"object\", fields, icon: undefined, preview: { title: t?.name, subtitle: s?.name, media: fields.find((f) => f.type === \"image\")?.name } }],\n };\n }\n default:\n break;\n }\n return { ...base, ...inferField(p.key, sample), title: p.label };\n}\n\n/** A visual-editor block definition → TypeSchema. Groups appear only when props use more than one group. */\nexport function blockDefToSchema(def: BlockDef): TypeSchema {\n const fields = def.content.map((p) => propDefToField(p, def.defaults[p.key]));\n const used = Array.from(new Set(fields.map((f) => f.group ?? \"content\")));\n const groups: FieldGroup[] | undefined =\n used.length > 1 ? used.map((g, i) => ({ name: g, title: g.charAt(0).toUpperCase() + g.slice(1), default: g === \"content\" || i === 0 })) : undefined;\n return {\n name: def.type,\n title: def.name,\n kind: def.global ? \"global\" : \"block\",\n icon: def.icon,\n category: def.category,\n ...(def.placement ? { placement: def.placement } : {}),\n description: def.description,\n variants: def.variants,\n initialValue: def.defaults,\n groups,\n ...(def.fieldsets?.length ? { fieldsets: def.fieldsets.map((f) => ({ name: f.name, title: f.title, collapsed: f.collapsed, columns: f.columns })) } : {}),\n fields: groups ? fields.map((f) => ({ ...f, group: f.group ?? \"content\" })) : fields.map(({ group: _g, ...f }) => f),\n };\n}\n\n/* ── Content collections (FieldDef) → FieldSchema ────────────────────── */\nconst UNIT_WORDS: Record<string, string> = { minutes: \"min\", seconds: \"s\", hours: \"h\", days: \"days\", pixels: \"px\", percent: \"%\", grams: \"g\", kilograms: \"kg\" };\nconst SIMPLE: Partial<Record<FieldType, FieldSchema[\"type\"]>> = {\n text: \"string\", textarea: \"text\", richtext: \"richtext\", slug: \"slug\", boolean: \"boolean\", date: \"date\", datetime: \"datetime\",\n image: \"image\", file: \"file\", video: \"video\", link: \"link\", button: \"button\", color: \"color\", json: \"json\", code: \"code\",\n email: \"email\", url: \"url\", location: \"geopoint\", rating: \"rating\", tags: \"tags\", table: \"table\",\n};\n\nexport function fieldDefToSchema(def: FieldDef, sample?: unknown): FieldSchema {\n const base: FieldSchema = {\n name: def.id,\n title: def.name,\n type: \"string\",\n description: def.help,\n helpMore: def.helpMore,\n localized: def.localized,\n validation: def.required || def.max ? { required: def.required, max: def.max } : undefined,\n };\n const simple = SIMPLE[def.type];\n if (simple) {\n const f: FieldSchema = { ...base, type: simple };\n if (simple === \"string\" || simple === \"text\" || simple === \"richtext\") f.ai = true;\n if (simple === \"image\" && typeof sample === \"string\") f.valueShape = \"string\";\n if (simple === \"link\" && typeof sample === \"string\") f.valueShape = \"string\";\n return f;\n }\n switch (def.type) {\n case \"number\": {\n const said = def.help?.match(/^In (\\w+)\\.?$/i)?.[1]?.toLowerCase();\n // a short bare word (\"kg\", \"USD\") is a unit; a sentence (\"Before tax.\") stays the help line (units hold 8 characters)\n const bare = def.help && def.help.length <= 8 && !/[.\\s]/.test(def.help.trim()) ? def.help.trim() : undefined;\n const fromHelp = said ? UNIT_WORDS[said] ?? said : bare;\n const unit = fromHelp ?? (def.id === \"price\" ? \"USD\" : undefined);\n return { ...base, type: \"number\", description: fromHelp ? \"\" : def.help, numeric: unit ? { unit } : undefined };\n }\n case \"select\":\n return { ...base, type: \"select\", options: options(def.options) };\n case \"multiselect\":\n return { ...base, type: \"multiselect\", options: options(def.options) };\n case \"reference\":\n return { ...base, type: \"reference\", reference: { to: [def.id === \"form\" ? \"form\" : def.id === \"collection\" && !def.reference ? \"collection\" : def.reference ?? \"page\"] } };\n case \"references\":\n return { ...base, type: \"array\", of: [{ name: `${def.id}Ref`, title: singular(def.name), type: \"reference\", reference: { to: [def.reference ?? \"page\"] } }] };\n case \"gallery\":\n return { ...base, type: \"array\", arrayLayout: \"grid\", of: [{ name: \"image\", title: \"Image\", type: \"image\" }] };\n case \"group\":\n return { ...base, type: \"object\", fields: (def.fields ?? []).map((f) => fieldDefToSchema(f, isObj(sample) ? sample[f.id] : undefined)) };\n case \"repeater\": {\n const items = Array.isArray(sample) ? sample : [];\n const first = items.find(isObj);\n const fields = def.fields?.length\n ? def.fields.map((f) => fieldDefToSchema(f, first?.[f.id]))\n : first\n ? inferItem(def.id, first).fields!\n : def.id === \"ingredients\"\n ? [{ name: \"item\", title: \"Ingredient\", type: \"string\" as const }, { name: \"qty\", title: \"Amount\", type: \"string\" as const }]\n : [{ name: \"label\", title: \"Label\", type: \"string\" as const }, { name: \"value\", title: \"Value\", type: \"string\" as const }];\n const t = fields.find((f) => f.type === \"string\" || f.type === \"text\");\n const s = fields.find((f) => f !== t && (f.type === \"string\" || f.type === \"text\"));\n return { ...base, type: \"array\", validation: def.required ? { required: true } : undefined, of: [{ name: `${def.id}Item`, title: singular(def.name), type: \"object\", fields, preview: { title: t?.name, subtitle: s?.name } }] };\n }\n default:\n return { ...base, ...inferField(def.id, sample), title: def.name };\n }\n}\n\n/** A collection's (or page's) field list → TypeSchema for the document editor. */\nexport function fieldDefsToSchema(fields: FieldDef[], opts: { name?: string; title?: string; values?: Obj; kind?: TypeSchema[\"kind\"] } = {}): TypeSchema {\n return {\n name: op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IAAE,CAAC;GAAE;EACjO;EACA,SACE,OAAO;GAAE,GAAG;GAAM,GAAG,WAAW,IAAI,IAAI,MAAM;GAAG,OAAO,IAAI;EAAK;CACrE;AACF;;AAGA,SAAgB,kBAAkB,QAAoB,OAAmF,CAAC,GAAe;CACvJ,OAAO;EACL,MAAM,KAAK,QAAQ;EACnB,OAAO,KAAK,SAAS;EACrB,MAAM,KAAK,QAAQ;EACnB,QAAQ,OAAO,KAAK,MAAM,iBAAiB,GAAG,KAAK,SAAS,EAAE,GAAG,CAAC;CACpE;AACF"}
@@ -4,7 +4,7 @@
4
4
  * - Cap: src/lib/access/registry.ts (CAP_IDS, the permission keys a field's `access` names)
5
5
  * - FieldType, FieldDef: src/data/types.ts (content collection fields)
6
6
  * - BlockCategory, PropType, PropDef, BlockFieldset, BlockDef: src/features/visuals/model/catalog.ts
7
- * The production adapters (src/kit/adapters) map production models onto these; nothing here is wired yet.
7
+ * The production adapters (adapters/) map production models onto these; nothing here is wired yet.
8
8
  */
9
9
  export declare const CAP_IDS: readonly ["content.view", "content.create", "content.edit", "content.delete", "content.review", "content.publish", "pages.organize", "collections.manage", "schema.view", "schema.manage", "components.use", "components.manage", "media.upload", "media.manage", "seo.edit", "seo.manage", "forms.view", "forms.manage", "forms.submissions", "analytics.view", "visuals.edit", "design.edit", "design.manage", "publish.deploy", "publish.workflow", "branches.create", "branches.merge", "agents.run", "agents.build", "agents.manage", "ai.use", "ai.manage", "comments.create", "comments.moderate", "settings.project", "settings.workspace", "settings.security", "audit.view", "members.view", "members.invite", "members.manage", "members.viewAs", "billing.view", "billing.manage", "domains.manage", "api.view", "api.manage", "integrations.manage", "projects.create", "projects.delete"];
10
10
  export type Cap = (typeof CAP_IDS)[number];
@@ -56,6 +56,14 @@ export interface PropDef {
56
56
  placeholder?: string;
57
57
  /** Arrays: the most and fewest items. */
58
58
  min?: number;
59
+ /** Numbers (D63): range, step and the unit shown inside the input ("/ 5", "min", "%"). A unit that states the range
60
+ * replaces a help line ("Out of 5."). */
61
+ numeric?: {
62
+ min?: number;
63
+ max?: number;
64
+ step?: number;
65
+ unit?: string;
66
+ };
59
67
  }
60
68
  /** D45 fieldset: siblings with one purpose ("Buttons", "Newsletter"), optionally collapsed. */
61
69
  export interface BlockFieldset {
@@ -5,7 +5,7 @@
5
5
  * - Cap: src/lib/access/registry.ts (CAP_IDS, the permission keys a field's `access` names)
6
6
  * - FieldType, FieldDef: src/data/types.ts (content collection fields)
7
7
  * - BlockCategory, PropType, PropDef, BlockFieldset, BlockDef: src/features/visuals/model/catalog.ts
8
- * The production adapters (src/kit/adapters) map production models onto these; nothing here is wired yet.
8
+ * The production adapters (adapters/) map production models onto these; nothing here is wired yet.
9
9
  */
10
10
  var CAP_IDS = [
11
11
  "content.view",
@@ -1 +1 @@
1
- {"version":3,"file":"sources.js","names":[],"sources":["../../src/schema/sources.ts"],"sourcesContent":["/**\n * The V2 shapes the schema layer reads, copied type for type so @/kit owns them and imports nothing from\n * the app. Sources at V2 HEAD 9829bf1:\n * - Cap: src/lib/access/registry.ts (CAP_IDS, the permission keys a field's `access` names)\n * - FieldType, FieldDef: src/data/types.ts (content collection fields)\n * - BlockCategory, PropType, PropDef, BlockFieldset, BlockDef: src/features/visuals/model/catalog.ts\n * The production adapters (src/kit/adapters) map production models onto these; nothing here is wired yet.\n */\n\nexport const CAP_IDS = [\n // content\n \"content.view\",\n \"content.create\",\n \"content.edit\",\n \"content.delete\",\n \"content.review\",\n \"content.publish\",\n // pages and collections\n \"pages.organize\",\n \"collections.manage\",\n // schema\n \"schema.view\",\n \"schema.manage\",\n // components\n \"components.use\",\n \"components.manage\",\n // media\n \"media.upload\",\n \"media.manage\",\n // seo\n \"seo.edit\",\n \"seo.manage\",\n // forms\n \"forms.view\",\n \"forms.manage\",\n \"forms.submissions\",\n // analytics\n \"analytics.view\",\n // visuals and design\n \"visuals.edit\",\n \"design.edit\",\n \"design.manage\",\n // publish and branches\n \"publish.deploy\",\n \"publish.workflow\",\n \"branches.create\",\n \"branches.merge\",\n // agents and AI\n \"agents.run\",\n \"agents.build\",\n \"agents.manage\",\n \"ai.use\",\n \"ai.manage\",\n // comments\n \"comments.create\",\n \"comments.moderate\",\n // settings and audit\n \"settings.project\",\n \"settings.workspace\",\n \"settings.security\",\n \"audit.view\",\n // members\n \"members.view\",\n \"members.invite\",\n \"members.manage\",\n \"members.viewAs\",\n // billing and domains\n \"billing.view\",\n \"billing.manage\",\n \"domains.manage\",\n // api, integrations, projects\n \"api.view\",\n \"api.manage\",\n \"integrations.manage\",\n \"projects.create\",\n \"projects.delete\",\n] as const;\n\nexport type Cap = (typeof CAP_IDS)[number];\n\nexport type FieldType =\n | \"text\"\n | \"textarea\"\n | \"richtext\"\n | \"slug\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"datetime\"\n | \"select\"\n | \"multiselect\"\n | \"image\"\n | \"gallery\"\n | \"file\"\n | \"video\"\n | \"link\"\n | \"button\"\n | \"reference\"\n | \"references\"\n | \"color\"\n | \"json\"\n | \"code\"\n | \"repeater\"\n | \"group\"\n | \"email\"\n | \"url\"\n | \"location\"\n | \"rating\"\n | \"tags\"\n | \"table\";\n\nexport interface FieldDef {\n id: string;\n name: string;\n type: FieldType;\n required?: boolean;\n /** Help under the label (CPO D39). Unset → house convention by id/type; \"\" = none. */\n help?: string;\n /** Longer explanation behind the ⓘ next to the label. */\n helpMore?: string;\n options?: string[];\n reference?: string;\n max?: number;\n localized?: boolean;\n fields?: FieldDef[];\n}\n\n\nexport type BlockCategory = \"Navigation\" | \"Hero\" | \"Content\" | \"Social proof\" | \"Commerce\" | \"Conversion\" | \"Collection\" | \"Media\" | \"Footer\" | \"Basic\" | \"Blog\";\n\n/**\n * Prop types: every FieldType, plus two shapes only blocks need — \"list\" (an array of one-line strings: bullets,\n * features, \"what's included\"; never tags, D47) and \"icon\" (a Tabler icon name, picked from the icon picker).\n */\nexport type PropType = FieldType | \"list\" | \"icon\";\n\nexport interface PropDef {\n key: string;\n label: string;\n type: PropType;\n /** Help under the label (CPO D39). Unset → house convention by key/type; \"\" = none. */\n help?: string;\n /** Longer explanation behind the ⓘ next to the label. */\n helpMore?: string;\n options?: string[];\n max?: number;\n item?: PropDef[]; // for repeater\n group?: \"Content\" | \"Media\" | \"Links\" | \"Data\";\n /** reference props: the collection id the picker lists (e.g. \"col_journal\"); default = pages */\n reference?: string;\n /** D45: the fieldset (BlockDef.fieldsets) this prop sits in. */\n fieldset?: string;\n /** Show only when a sibling prop equals one of these values (the form hides it otherwise). */\n showIf?: { key: string; equals: unknown };\n /** Arrays: the noun for \"Add {noun}\". */\n itemNoun?: string;\n placeholder?: string;\n /** Arrays: the most and fewest items. */\n min?: number;\n}\n\n/** D45 fieldset: siblings with one purpose (\"Buttons\", \"Newsletter\"), optionally collapsed. */\nexport interface BlockFieldset {\n name: string;\n title: string;\n collapsed?: boolean;\n columns?: 1 | 2;\n}\n\nexport interface BlockDef {\n type: string;\n name: string;\n category: BlockCategory;\n description: string;\n icon: string; // lucide icon name\n variants: { id: string; name: string; description?: string }[];\n content: PropDef[];\n /** D45 fieldsets the content props sit in (PropDef.fieldset). */\n fieldsets?: BlockFieldset[];\n defaults: Record<string, unknown>;\n /** Global blocks (nav, footer, announcement) are synced across every page. */\n global?: boolean;\n /**\n * PLACEMENT (CPO D55): where the block fits. \"inline\" = it fits a text column, so a rich-text body offers it in the\n * Insert menu's Article group. \"section\" (the default) = page-width; a body reaches it only through More components.\n * \"page\" = a whole page or a feed of other content (Blog post, Recipe, Journal grid, Rich text); never inside a body.\n */\n placement?: \"inline\" | \"section\" | \"page\";\n /** Developer-only lock: marketers can edit content but not swap/remove. */\n tags?: string[];\n /**\n * SLOTS (CPO D8, added by the canvas team) — named areas that hold nested blocks (Tabs panels, Bento cells…).\n * Instances keep them in `BlockInstance.children[slot]`. `accepts` limits which block types can be dropped in.\n */\n slots?: { name: string; label: string; accepts?: string[] }[];\n /** Nested blocks created with a fresh instance: slot → [type, variant?, props override?][] */\n childDefaults?: Record<string, [string, string?, Record<string, unknown>?][]>;\n}\n"],"mappings":";;;;;;;;;AASA,IAAa,UAAU;CAErB;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CACA;CAEA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;AACF"}
1
+ {"version":3,"file":"sources.js","names":[],"sources":["../../src/schema/sources.ts"],"sourcesContent":["/**\n * The V2 shapes the schema layer reads, copied type for type so @/kit owns them and imports nothing from\n * the app. Sources at V2 HEAD 9829bf1:\n * - Cap: src/lib/access/registry.ts (CAP_IDS, the permission keys a field's `access` names)\n * - FieldType, FieldDef: src/data/types.ts (content collection fields)\n * - BlockCategory, PropType, PropDef, BlockFieldset, BlockDef: src/features/visuals/model/catalog.ts\n * The production adapters (adapters/) map production models onto these; nothing here is wired yet.\n */\n\nexport const CAP_IDS = [\n // content\n \"content.view\",\n \"content.create\",\n \"content.edit\",\n \"content.delete\",\n \"content.review\",\n \"content.publish\",\n // pages and collections\n \"pages.organize\",\n \"collections.manage\",\n // schema\n \"schema.view\",\n \"schema.manage\",\n // components\n \"components.use\",\n \"components.manage\",\n // media\n \"media.upload\",\n \"media.manage\",\n // seo\n \"seo.edit\",\n \"seo.manage\",\n // forms\n \"forms.view\",\n \"forms.manage\",\n \"forms.submissions\",\n // analytics\n \"analytics.view\",\n // visuals and design\n \"visuals.edit\",\n \"design.edit\",\n \"design.manage\",\n // publish and branches\n \"publish.deploy\",\n \"publish.workflow\",\n \"branches.create\",\n \"branches.merge\",\n // agents and AI\n \"agents.run\",\n \"agents.build\",\n \"agents.manage\",\n \"ai.use\",\n \"ai.manage\",\n // comments\n \"comments.create\",\n \"comments.moderate\",\n // settings and audit\n \"settings.project\",\n \"settings.workspace\",\n \"settings.security\",\n \"audit.view\",\n // members\n \"members.view\",\n \"members.invite\",\n \"members.manage\",\n \"members.viewAs\",\n // billing and domains\n \"billing.view\",\n \"billing.manage\",\n \"domains.manage\",\n // api, integrations, projects\n \"api.view\",\n \"api.manage\",\n \"integrations.manage\",\n \"projects.create\",\n \"projects.delete\",\n] as const;\n\nexport type Cap = (typeof CAP_IDS)[number];\n\nexport type FieldType =\n | \"text\"\n | \"textarea\"\n | \"richtext\"\n | \"slug\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"datetime\"\n | \"select\"\n | \"multiselect\"\n | \"image\"\n | \"gallery\"\n | \"file\"\n | \"video\"\n | \"link\"\n | \"button\"\n | \"reference\"\n | \"references\"\n | \"color\"\n | \"json\"\n | \"code\"\n | \"repeater\"\n | \"group\"\n | \"email\"\n | \"url\"\n | \"location\"\n | \"rating\"\n | \"tags\"\n | \"table\";\n\nexport interface FieldDef {\n id: string;\n name: string;\n type: FieldType;\n required?: boolean;\n /** Help under the label (CPO D39). Unset → house convention by id/type; \"\" = none. */\n help?: string;\n /** Longer explanation behind the ⓘ next to the label. */\n helpMore?: string;\n options?: string[];\n reference?: string;\n max?: number;\n localized?: boolean;\n fields?: FieldDef[];\n}\n\n\nexport type BlockCategory = \"Navigation\" | \"Hero\" | \"Content\" | \"Social proof\" | \"Commerce\" | \"Conversion\" | \"Collection\" | \"Media\" | \"Footer\" | \"Basic\" | \"Blog\";\n\n/**\n * Prop types: every FieldType, plus two shapes only blocks need — \"list\" (an array of one-line strings: bullets,\n * features, \"what's included\"; never tags, D47) and \"icon\" (a Tabler icon name, picked from the icon picker).\n */\nexport type PropType = FieldType | \"list\" | \"icon\";\n\nexport interface PropDef {\n key: string;\n label: string;\n type: PropType;\n /** Help under the label (CPO D39). Unset → house convention by key/type; \"\" = none. */\n help?: string;\n /** Longer explanation behind the ⓘ next to the label. */\n helpMore?: string;\n options?: string[];\n max?: number;\n item?: PropDef[]; // for repeater\n group?: \"Content\" | \"Media\" | \"Links\" | \"Data\";\n /** reference props: the collection id the picker lists (e.g. \"col_journal\"); default = pages */\n reference?: string;\n /** D45: the fieldset (BlockDef.fieldsets) this prop sits in. */\n fieldset?: string;\n /** Show only when a sibling prop equals one of these values (the form hides it otherwise). */\n showIf?: { key: string; equals: unknown };\n /** Arrays: the noun for \"Add {noun}\". */\n itemNoun?: string;\n placeholder?: string;\n /** Arrays: the most and fewest items. */\n min?: number;\n /** Numbers (D63): range, step and the unit shown inside the input (\"/ 5\", \"min\", \"%\"). A unit that states the range\n * replaces a help line (\"Out of 5.\"). */\n numeric?: { min?: number; max?: number; step?: number; unit?: string };\n}\n\n/** D45 fieldset: siblings with one purpose (\"Buttons\", \"Newsletter\"), optionally collapsed. */\nexport interface BlockFieldset {\n name: string;\n title: string;\n collapsed?: boolean;\n columns?: 1 | 2;\n}\n\nexport interface BlockDef {\n type: string;\n name: string;\n category: BlockCategory;\n description: string;\n icon: string; // lucide icon name\n variants: { id: string; name: string; description?: string }[];\n content: PropDef[];\n /** D45 fieldsets the content props sit in (PropDef.fieldset). */\n fieldsets?: BlockFieldset[];\n defaults: Record<string, unknown>;\n /** Global blocks (nav, footer, announcement) are synced across every page. */\n global?: boolean;\n /**\n * PLACEMENT (CPO D55): where the block fits. \"inline\" = it fits a text column, so a rich-text body offers it in the\n * Insert menu's Article group. \"section\" (the default) = page-width; a body reaches it only through More components.\n * \"page\" = a whole page or a feed of other content (Blog post, Recipe, Journal grid, Rich text); never inside a body.\n */\n placement?: \"inline\" | \"section\" | \"page\";\n /** Developer-only lock: marketers can edit content but not swap/remove. */\n tags?: string[];\n /**\n * SLOTS (CPO D8, added by the canvas team) — named areas that hold nested blocks (Tabs panels, Bento cells…).\n * Instances keep them in `BlockInstance.children[slot]`. `accepts` limits which block types can be dropped in.\n */\n slots?: { name: string; label: string; accepts?: string[] }[];\n /** Nested blocks created with a fresh instance: slot → [type, variant?, props override?][] */\n childDefaults?: Record<string, [string, string?, Record<string, unknown>?][]>;\n}\n"],"mappings":";;;;;;;;;AASA,IAAa,UAAU;CAErB;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CAEA;CACA;CACA;CAEA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;AACF"}
@@ -10,7 +10,7 @@
10
10
  * - Every field has the same chrome: label · help · required · validation · counter · ⋯ menu · presence · comments.
11
11
  * - Blocks can contain blocks (slots) → complex layouts (tabs, columns, bento, mega menus, carousels).
12
12
  */
13
- import type { RichTextFeature } from "@bettercms-ai/types";
13
+ import type { IconFieldOptions, RichTextFeature } from "@bettercms-ai/types";
14
14
  import type { Cap } from "./sources";
15
15
  import type { TableFieldOptions } from "./table";
16
16
  export type PrimitiveType = "string" | "text" | "richtext" | "number" | "boolean" | "slug" | "url" | "email" | "date" | "datetime" | "color" | "select" | "multiselect" | "tags" | "image" | "file" | "video" | "icon" | "link" | "button" | "reference" | "code" | "json" | "geopoint" | "rating" | "table";
@@ -30,7 +30,25 @@ export interface Validation {
30
30
  recommendedMax?: number;
31
31
  pattern?: string;
32
32
  patternMessage?: string;
33
+ /**
34
+ * No two values may be the same. A field inside a list item: unique among the list's items. A list of scalars or
35
+ * references: no item twice. A root field: unique among the model's other records when the host passes them
36
+ * (`SchemaForm` `uniquePeers`).
37
+ */
33
38
  unique?: boolean;
39
+ /** array of objects: items are unique by this item key (`uniqueBy: "sku"`), the same check as `unique` on that key. */
40
+ uniqueBy?: string;
41
+ }
42
+ /**
43
+ * A reference picker's filter, typed (V2 gap 27): only published records, and/or one field equal to a value. Production
44
+ * stores a filter as a GROQ-style string ("category == 'billing'"), which `reference.filter` also takes as it is.
45
+ */
46
+ export interface ReferenceFilter {
47
+ /** "published": only records that have a live version (Published, or Published with changes) */
48
+ status?: "published";
49
+ /** a field of the target record ("category"); `title` and `slug` work too */
50
+ field?: string;
51
+ equals?: string | number | boolean;
34
52
  }
35
53
  /** How a compound field is edited when opened. */
36
54
  export type OpenMode = "inline" | "drill" | "popover" | "dialog";
@@ -105,7 +123,7 @@ export interface FieldSchema {
105
123
  ai?: boolean;
106
124
  reference?: {
107
125
  to: string[];
108
- filter?: string;
126
+ filter?: string | ReferenceFilter;
109
127
  noun?: string;
110
128
  excludeId?: string;
111
129
  };
@@ -134,8 +152,16 @@ export interface FieldSchema {
134
152
  itemNoun?: string;
135
153
  /** array: how rows render. "grid" = tiles (good for images / logos). */
136
154
  arrayLayout?: "list" | "grid";
137
- /** Help line shown under a field the lens can see but not change ("Set by the developer in code."). Never a key or a lock. */
155
+ /**
156
+ * The reason a locked field shows editors ("Set by developers."). A field is LOCKED when it has `access.edit` (D58, the one
157
+ * source of truth): people without that cap see the value read-only, with a small lock glyph and this line (D70).
158
+ */
138
159
  lockReason?: string;
160
+ /**
161
+ * D70 "Protect in schema": the site's code depends on this field, so a schema editor refuses to rename its key, change
162
+ * its type, archive or delete it (or a parent holding it) until someone unlocks it. Values and other settings still change.
163
+ */
164
+ protected?: boolean;
139
165
  /**
140
166
  * Host-only, never persisted: the list's ORDER is set by the site's code (identity rule 36). The rows stay editable;
141
167
  * drag and Move up / down are off and the grip slot shows a lock (V2 content/editor/page-sections.tsx:31,155).
@@ -145,6 +171,8 @@ export interface FieldSchema {
145
171
  valueShape?: "string" | "object";
146
172
  /** image: an inline-SVG icon, which takes SVG files only (prod `config.media: "icon"`). */
147
173
  svgOnly?: boolean;
174
+ /** icon (D65): where an icon may come from (set · library · upload) and whether it asks for a label (prod `config.icons`). */
175
+ icons?: IconFieldOptions;
148
176
  /**
149
177
  * A link LABEL's href: the sibling it links with (prod `config.linkHref`), as the owner answered the editable plan's
150
178
  * `link-pair` question where the names do not say (`title` + `to`). Read first by `linkLabelHref`.
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/schema/types.ts"],"sourcesContent":["/**\n * BETTERCMS SCHEMA — the long-term contract for every editable thing (blocks, pages, entries, globals).\n * One schema language → one form engine (`@/components/kit`) → used by BOTH the Visuals inspector and the\n * Content document editor. Modelled on Sanity's schema (types, fieldsets, groups, previews, validation,\n * conditional fields) plus BetterCMS's block slots for nested layouts.\n *\n * Design principles (CPO D8):\n * - Scales to deep nesting without inline-accordion soup: arrays render compact preview rows; opening an item\n * DRILLS IN (panel slides, breadcrumb grows). Small objects may render inline; lightweight settings open in a POPOVER.\n * - Every field has the same chrome: label · help · required · validation · counter · ⋯ menu · presence · comments.\n * - Blocks can contain blocks (slots) → complex layouts (tabs, columns, bento, mega menus, carousels).\n */\n\nimport type { RichTextFeature } from \"@bettercms-ai/types\";\nimport type { Cap } from \"./sources\";\nimport type { TableFieldOptions } from \"./table\";\n\nexport type PrimitiveType =\n | \"string\" // single line\n | \"text\" // multi line, auto-grow\n | \"richtext\" // portable-text style rich text\n | \"number\"\n | \"boolean\"\n | \"slug\"\n | \"url\"\n | \"email\"\n | \"date\"\n | \"datetime\"\n | \"color\"\n | \"select\" // options: single\n | \"multiselect\"\n | \"tags\"\n | \"image\"\n | \"file\"\n | \"video\"\n | \"icon\" // icon picker (Tabler name)\n | \"link\" // url | page ref + target + rel (one unit)\n | \"button\" // label + link + style (one unit — founder rule)\n | \"reference\" // to a collection entry / page / form\n | \"code\"\n | \"json\"\n | \"geopoint\"\n | \"rating\"\n | \"table\"; // typed columns × keyed rows (CPO D42) — value: TableValue (src/schema/table.ts)\n\nexport type CompoundType =\n | \"object\" // nested fields\n | \"array\" // list of `of` (objects, primitives or references)\n | \"slot\"; // list of nested BLOCKS (block-in-block layouts)\n\nexport type SchemaType = PrimitiveType | CompoundType;\n\nexport interface Option {\n value: string;\n label: string;\n icon?: string;\n description?: string;\n}\n\nexport interface Validation {\n required?: boolean;\n min?: number; // chars for strings, items for arrays, value for numbers\n max?: number;\n /** soft limit: warning (amber) instead of error — e.g. SEO title 60 */\n recommendedMax?: number;\n pattern?: string;\n patternMessage?: string;\n unique?: boolean;\n}\n\n/** How a compound field is edited when opened. */\nexport type OpenMode =\n | \"inline\" // render fields in place (small objects, ≤3 primitives)\n | \"drill\" // slide the panel to a child view; breadcrumb grows (default for array items & objects)\n | \"popover\" // anchored popover (link settings, image crop/alt, small option sets)\n | \"dialog\"; // centered modal for heavy editors (rich text full screen, code, table)\n\nexport interface PreviewConfig {\n /** dotted paths into the item value */\n title?: string;\n subtitle?: string;\n media?: string;\n /** Fallback label, e.g. \"Untitled question\" */\n fallback?: string;\n /** Tabler icon name (kebab-case, e.g. \"help-circle\") shown when there is no media. */\n icon?: string;\n}\n\n/** A condition's operator. Absent: `equals` reads as is / is one of, `notEmpty` as has a value. */\nexport type ConditionOp = \"is\" | \"isNot\" | \"in\" | \"notIn\" | \"empty\" | \"notEmpty\" | \"gt\" | \"lt\";\n\n/**\n * \"Show only when\" (V2 types.ts). The field shows only while the rule holds:\n * - `field` names a key beside it (default), in the object that holds those fields (`scope: \"parent\"`) or at the top of\n * the component or CMS item (`scope: \"root\"`). `_variant` is the component's variant (its first variant when unset).\n * - `op` + `value` (is · is not · is one of · is not one of · is empty · has a value · more than · less than). The legacy\n * `equals` / `notEmpty` forms still read the same.\n * - `also`: more rules, combined by `match` (\"all\", the default, or \"any\").\n */\nexport interface Condition {\n field: string;\n equals?: unknown | unknown[];\n notEmpty?: boolean;\n op?: ConditionOp;\n value?: unknown;\n scope?: \"parent\" | \"root\";\n also?: Condition[];\n match?: \"all\" | \"any\";\n}\n\nexport interface FieldSchema {\n name: string; // key in the value object\n title: string; // label (sentence case)\n type: SchemaType;\n /** Help text under the label (CPO D39). Unset → a house convention from `@/schema/help` may apply; \"\" = none. */\n description?: string;\n /** Longer explanation behind the ⓘ next to the label (tooltip). Use when one line can't carry it. */\n helpMore?: string;\n placeholder?: string;\n initialValue?: unknown;\n validation?: Validation;\n options?: Option[]; // select / multiselect / radio-like\n layout?: \"dropdown\" | \"radio\" | \"segmented\" | \"cards\" | \"switch\" | \"checkbox\" | \"slider\" | \"grid\" | \"list\";\n /** compound */\n fields?: FieldSchema[]; // object\n of?: FieldSchema[] | { type: \"block\"; allow?: string[] }; // array items / slot allowed block types\n openMode?: OpenMode;\n preview?: PreviewConfig;\n /** organisation */\n fieldset?: string; // groups fields into a collapsible fieldset\n group?: string; // which tab (Content / Media / Settings / SEO…)\n /** behaviour */\n hidden?: Condition | boolean;\n /** true = never editable in the form (computed or system values). Who may see or change a field is `access`. */\n readOnly?: boolean;\n /** Archived (V2 types.ts): kept in the schema and its values stay stored, but no form renders it. Schema editors show it. */\n archived?: boolean;\n /**\n * D58 field-level access. `view` missing → everyone who can open the form sees it; `edit` missing → the form's own\n * rule (the host's content.edit). A field the lens can't `view` is not rendered; one it can't `edit` renders as plain\n * text. Fields in the `seo` group default to `{ edit: \"seo.edit\" }`.\n */\n access?: FieldAccess;\n localized?: boolean;\n advanced?: boolean; // tucked into the \"Advanced\" fieldset by default (calm UX)\n ai?: boolean; // show the AI assist sparkle\n // reference targets (collection ids, \"page\", \"form\"); `noun`: what the picker calls one (\"author\": \"Select an author\",\n // \"Create new author\"), else the target's (\"CMS item\", \"page\", …)\n // `excludeId`: a record this picker never lists (the entry a rich-text island sits in, which its own form cannot see)\n reference?: { to: string[]; filter?: string; noun?: string; excludeId?: string };\n numeric?: { unit?: string; step?: number; min?: number; max?: number }; // number / slider\n /** number: a developer-controlled SCALE (tokens or a stepped range) with an optional custom escape hatch (CPO D41).\n * Value shape → `ScaleValue`. Takes precedence over `layout: \"slider\"` + `numeric` (which still work, fixed-only). */\n scale?: ScaleSchema;\n /** table: column types allowed, developer-locked columns, row limits, caption rule, JSON-LD offered (CPO D42). */\n table?: TableFieldOptions;\n\n /* ── additive (Block Kit v1) ─────────────────────────────────────────── */\n /** Tabler icon name (kebab-case) used on rows, crumbs and the block picker. */\n icon?: string;\n /** text: minimum visible rows. */\n rows?: number;\n /** Value is synced from a global block (\"Navigation\") — edits apply everywhere it is used. */\n synced?: { from: string };\n /** slot: per-child layout settings stored on each child under `_settings` (e.g. bento span). */\n slotSettings?: FieldSchema[];\n /** array: singular noun for \"Add {noun}\" and empty states (\"question\"). Defaults from the item title. */\n itemNoun?: string;\n /** array: how rows render. \"grid\" = tiles (good for images / logos). */\n arrayLayout?: \"list\" | \"grid\";\n /** Help line shown under a field the lens can see but not change (\"Set by the developer in code.\"). Never a key or a lock. */\n lockReason?: string;\n /**\n * Host-only, never persisted: the list's ORDER is set by the site's code (identity rule 36). The rows stay editable;\n * drag and Move up / down are off and the grip slot shows a lock (V2 content/editor/page-sections.tsx:31,155).\n */\n orderLocked?: boolean;\n /** link / image / button: store a plain string (href or URL) instead of the object — for legacy data. */\n valueShape?: \"string\" | \"object\";\n /** image: an inline-SVG icon, which takes SVG files only (prod `config.media: \"icon\"`). */\n svgOnly?: boolean;\n /**\n * A link LABEL's href: the sibling it links with (prod `config.linkHref`), as the owner answered the editable plan's\n * `link-pair` question where the names do not say (`title` + `to`). Read first by `linkLabelHref`.\n */\n linkHref?: string;\n /**\n * date / datetime: time zone handling (CPO D43). true = the editor picks a zone (defaults to the site's) · \"site\" = always\n * the site's zone · \"fixed:<IANA>\" = always that zone · false = no zone. Default: true for datetime, false for date.\n * Zoned values store ISO with offset + the IANA zone: \"2026-10-14T09:00:00+05:30[Asia/Kolkata]\" (RFC 9557).\n */\n timezone?: boolean | \"site\" | `fixed:${string}`;\n /** code: the field's own language and the only languages its picker offers (prod config.language / languages). */\n language?: string;\n languages?: string[];\n /**\n * richtext / document: the blocks and marks the field offers, from types RICHTEXT_FEATURES (prod config.features).\n * Absent = all of them, as V2's rich text offers (normV2 folds the full set to absent). A schema read from JSON may\n * hold an alias (`headings`) or an unknown name: the adapter expands the one and names the other.\n */\n features?: RichTextFeature[];\n /**\n * richtext / document: the content models its related posts and author bios draw from (prod config.references,\n * plan RT8), by id. posts absent: the entry's own collection; authors absent: no author bio is offered.\n */\n references?: { posts?: string; authors?: string };\n}\n\n/** D58: the caps that let someone see / change one field. */\nexport interface FieldAccess {\n view?: Cap;\n edit?: Cap;\n}\n/** Developer-owned values (anchors, custom CSS, ids): only people who can change the schema edit them. */\nexport const DEV_FIELD: FieldAccess = { edit: \"schema.manage\" };\n/** Developer-only settings: hidden unless you can see the schema. */\nexport const DEV_ONLY_FIELD: FieldAccess = { view: \"schema.view\", edit: \"schema.manage\" };\n\n/* ── Scales (CPO D41) ─────────────────────────────────────────────────── */\nexport type ScaleUnit = \"px\" | \"%\" | \"rem\" | \"em\" | \"vw\" | \"vh\";\n\n/** One allowed value of a token scale. `value` is what is stored; `label` is the short readout (\"XL\"). */\nexport interface ScaleStep {\n value: string;\n label: string;\n /** Long name for screen readers and tooltips (\"Extra large\"). Defaults to `label`. */\n title?: string;\n /** Resolved size in px, shown as \"XL · 48px\" and used to place custom values on the track. */\n px?: number;\n /** Resolved CSS when it isn't px (e.g. \"100vh\", \"var(--space-xl)\"). */\n css?: string;\n}\n\n/** A stepped numeric range (continuous with snapping). The stored value is a bare number in `defaultUnit`. */\nexport interface ScaleRange {\n min: number;\n max: number;\n step?: number;\n}\n\n/** Bounds for the custom escape hatch. min / max may be one number or per unit ({ px: 0, \"%\": 0 }). */\nexport interface ScaleCustom {\n min?: number | Partial<Record<ScaleUnit, number>>;\n max?: number | Partial<Record<ScaleUnit, number>>;\n /** Units the editor may type. Defaults to the scale's `units`. */\n units?: ScaleUnit[];\n /** Arrow-key nudge (Shift ×10, Alt ×0.1). Default 1. */\n step?: number;\n}\n\nexport interface ScaleSchema {\n /** Token steps (S M L XL 2XL) or a numeric range ({ min, max, step }). */\n steps: ScaleStep[] | ScaleRange;\n /** Units of the scale; the first is the default. A range with no units is unitless. */\n units?: ScaleUnit[];\n defaultUnit?: ScaleUnit;\n /** false (default) = fixed only: the editor can pick only the allowed values. true / object = fixed + custom. */\n allowCustom?: boolean | ScaleCustom;\n /** Quick picks in the unit menu when custom is allowed (\"50%\", \"100vh\"). */\n presets?: { label?: string; value: ScaleValue }[];\n}\n\n/**\n * How a scale value is STORED — three shapes, told apart by `typeof`, so tokens and custom values never collide and\n * older data (bare token strings, bare numbers) is already valid:\n * - token → the step's value string (\"xl\")\n * - range → a bare number in the default unit (15 → 15%)\n * - custom → an object ({ value: 200, unit: \"px\" })\n */\nexport type ScaleValue = string | number | ScaleCustomValue;\nexport interface ScaleCustomValue {\n value: number;\n unit: ScaleUnit;\n}\n\nexport interface Fieldset {\n name: string;\n title: string;\n description?: string;\n collapsed?: boolean; // collapsed by default\n columns?: 1 | 2; // short fields side by side\n /** CPO D45: the header toggles the section (default true). false = a static heading for 2–3 fields that are always needed. */\n collapsible?: boolean;\n /**\n * CPO D45: \"breakpoints\" = the members are objects, one per screen size (desktop · tablet · phone), shown as ONE group with a\n * segmented switcher instead of three stacked groups. Sibling objects named desktop / laptop / tablet / mobile / phone get\n * this automatically.\n */\n layout?: \"stack\" | \"breakpoints\";\n}\n\nexport interface FieldGroup {\n name: string;\n title: string;\n icon?: string;\n default?: boolean;\n}\n\n/** A developer-defined layout of a block (swap without losing content). */\nexport interface BlockVariant {\n id: string;\n name: string;\n description?: string;\n}\n\n/** A document/block type. */\nexport interface TypeSchema {\n name: string; // e.g. \"hero\", \"journalStory\"\n title: string;\n kind: \"block\" | \"page\" | \"entry\" | \"global\" | \"object\";\n icon?: string;\n description?: string;\n fields: FieldSchema[];\n fieldsets?: Fieldset[];\n groups?: FieldGroup[];\n preview?: PreviewConfig;\n /* ── additive (Block Kit v1) ── */\n /** Block variants (layouts) — shown as a chip on slot rows and a switcher in the block frame. */\n variants?: BlockVariant[];\n /** Block picker category (\"Layout\", \"Content\", \"Media\"…). */\n category?: string;\n /**\n * kind \"block\" only (CPO D55): where the block fits. \"inline\" = it fits a text column, so a rich-text body lists it in\n * the Insert menu's Article group. \"section\" (default) = page-width, reachable in a body only through More components.\n * \"page\" = a whole page or a feed of other content; never inside a body.\n */\n placement?: \"inline\" | \"section\" | \"page\";\n /** Starting value for a new instance (block added to a slot, new document). */\n initialValue?: Record<string, unknown>;\n}\n\n/** Every array item / slot child carries a stable key. Slot children also carry their block type. */\nexport interface KeyedItem {\n _key?: string;\n /** item type name (arrays with several `of` types) or block type (slots) */\n _type?: string;\n}\n/** A block inside a slot: its own props at the root, plus variant and per-slot layout settings. */\nexport interface SlotChild extends KeyedItem {\n _type: string;\n _variant?: string;\n _settings?: Record<string, unknown>;\n [prop: string]: unknown;\n}\n\n/** Path from the root document/block to the field being edited, e.g. [\"items\", 1, \"answer\"] */\nexport type FieldPath = (string | number)[];\n\n/** One crumb in the inspector/editor breadcrumb (drill-in navigation stack). */\nexport interface Crumb {\n path: FieldPath;\n title: string;\n icon?: string;\n /** tableGroup / tableRow / tableColumn: a table field's rows and columns drill like array items (D50) */\n kind: \"root\" | \"object\" | \"item\" | \"block\" | \"button\" | \"history\" | \"tableGroup\" | \"tableRow\" | \"tableColumn\";\n}\n\n/** Reserved path segment: the field's version history as a stacked panel, e.g. [\"title\", \"@history\"]. */\nexport const HISTORY_SEGMENT = \"@history\";\n"],"mappings":";;AAsNA,IAAa,YAAyB,EAAE,MAAM,gBAAgB;;AAE9D,IAAa,iBAA8B;CAAE,MAAM;CAAe,MAAM;AAAgB;;AA8IxF,IAAa,kBAAkB"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/schema/types.ts"],"sourcesContent":["/**\n * BETTERCMS SCHEMA — the long-term contract for every editable thing (blocks, pages, entries, globals).\n * One schema language → one form engine (`@/components/kit`) → used by BOTH the Visuals inspector and the\n * Content document editor. Modelled on Sanity's schema (types, fieldsets, groups, previews, validation,\n * conditional fields) plus BetterCMS's block slots for nested layouts.\n *\n * Design principles (CPO D8):\n * - Scales to deep nesting without inline-accordion soup: arrays render compact preview rows; opening an item\n * DRILLS IN (panel slides, breadcrumb grows). Small objects may render inline; lightweight settings open in a POPOVER.\n * - Every field has the same chrome: label · help · required · validation · counter · ⋯ menu · presence · comments.\n * - Blocks can contain blocks (slots) → complex layouts (tabs, columns, bento, mega menus, carousels).\n */\n\nimport type { IconFieldOptions, RichTextFeature } from \"@bettercms-ai/types\";\nimport type { Cap } from \"./sources\";\nimport type { TableFieldOptions } from \"./table\";\n\nexport type PrimitiveType =\n | \"string\" // single line\n | \"text\" // multi line, auto-grow\n | \"richtext\" // portable-text style rich text\n | \"number\"\n | \"boolean\"\n | \"slug\"\n | \"url\"\n | \"email\"\n | \"date\"\n | \"datetime\"\n | \"color\"\n | \"select\" // options: single\n | \"multiselect\"\n | \"tags\"\n | \"image\"\n | \"file\"\n | \"video\"\n | \"icon\" // icon picker (Tabler name)\n | \"link\" // url | page ref + target + rel (one unit)\n | \"button\" // label + link + style (one unit — founder rule)\n | \"reference\" // to a collection entry / page / form\n | \"code\"\n | \"json\"\n | \"geopoint\"\n | \"rating\"\n | \"table\"; // typed columns × keyed rows (CPO D42) — value: TableValue (src/schema/table.ts)\n\nexport type CompoundType =\n | \"object\" // nested fields\n | \"array\" // list of `of` (objects, primitives or references)\n | \"slot\"; // list of nested BLOCKS (block-in-block layouts)\n\nexport type SchemaType = PrimitiveType | CompoundType;\n\nexport interface Option {\n value: string;\n label: string;\n icon?: string;\n description?: string;\n}\n\nexport interface Validation {\n required?: boolean;\n min?: number; // chars for strings, items for arrays, value for numbers\n max?: number;\n /** soft limit: warning (amber) instead of error — e.g. SEO title 60 */\n recommendedMax?: number;\n pattern?: string;\n patternMessage?: string;\n /**\n * No two values may be the same. A field inside a list item: unique among the list's items. A list of scalars or\n * references: no item twice. A root field: unique among the model's other records when the host passes them\n * (`SchemaForm` `uniquePeers`).\n */\n unique?: boolean;\n /** array of objects: items are unique by this item key (`uniqueBy: \"sku\"`), the same check as `unique` on that key. */\n uniqueBy?: string;\n}\n\n/**\n * A reference picker's filter, typed (V2 gap 27): only published records, and/or one field equal to a value. Production\n * stores a filter as a GROQ-style string (\"category == 'billing'\"), which `reference.filter` also takes as it is.\n */\nexport interface ReferenceFilter {\n /** \"published\": only records that have a live version (Published, or Published with changes) */\n status?: \"published\";\n /** a field of the target record (\"category\"); `title` and `slug` work too */\n field?: string;\n equals?: string | number | boolean;\n}\n\n/** How a compound field is edited when opened. */\nexport type OpenMode =\n | \"inline\" // render fields in place (small objects, ≤3 primitives)\n | \"drill\" // slide the panel to a child view; breadcrumb grows (default for array items & objects)\n | \"popover\" // anchored popover (link settings, image crop/alt, small option sets)\n | \"dialog\"; // centered modal for heavy editors (rich text full screen, code, table)\n\nexport interface PreviewConfig {\n /** dotted paths into the item value */\n title?: string;\n subtitle?: string;\n media?: string;\n /** Fallback label, e.g. \"Untitled question\" */\n fallback?: string;\n /** Tabler icon name (kebab-case, e.g. \"help-circle\") shown when there is no media. */\n icon?: string;\n}\n\n/** A condition's operator. Absent: `equals` reads as is / is one of, `notEmpty` as has a value. */\nexport type ConditionOp = \"is\" | \"isNot\" | \"in\" | \"notIn\" | \"empty\" | \"notEmpty\" | \"gt\" | \"lt\";\n\n/**\n * \"Show only when\" (V2 types.ts). The field shows only while the rule holds:\n * - `field` names a key beside it (default), in the object that holds those fields (`scope: \"parent\"`) or at the top of\n * the component or CMS item (`scope: \"root\"`). `_variant` is the component's variant (its first variant when unset).\n * - `op` + `value` (is · is not · is one of · is not one of · is empty · has a value · more than · less than). The legacy\n * `equals` / `notEmpty` forms still read the same.\n * - `also`: more rules, combined by `match` (\"all\", the default, or \"any\").\n */\nexport interface Condition {\n field: string;\n equals?: unknown | unknown[];\n notEmpty?: boolean;\n op?: ConditionOp;\n value?: unknown;\n scope?: \"parent\" | \"root\";\n also?: Condition[];\n match?: \"all\" | \"any\";\n}\n\nexport interface FieldSchema {\n name: string; // key in the value object\n title: string; // label (sentence case)\n type: SchemaType;\n /** Help text under the label (CPO D39). Unset → a house convention from `@/schema/help` may apply; \"\" = none. */\n description?: string;\n /** Longer explanation behind the ⓘ next to the label (tooltip). Use when one line can't carry it. */\n helpMore?: string;\n placeholder?: string;\n initialValue?: unknown;\n validation?: Validation;\n options?: Option[]; // select / multiselect / radio-like\n layout?: \"dropdown\" | \"radio\" | \"segmented\" | \"cards\" | \"switch\" | \"checkbox\" | \"slider\" | \"grid\" | \"list\";\n /** compound */\n fields?: FieldSchema[]; // object\n of?: FieldSchema[] | { type: \"block\"; allow?: string[] }; // array items / slot allowed block types\n openMode?: OpenMode;\n preview?: PreviewConfig;\n /** organisation */\n fieldset?: string; // groups fields into a collapsible fieldset\n group?: string; // which tab (Content / Media / Settings / SEO…)\n /** behaviour */\n hidden?: Condition | boolean;\n /** true = never editable in the form (computed or system values). Who may see or change a field is `access`. */\n readOnly?: boolean;\n /** Archived (V2 types.ts): kept in the schema and its values stay stored, but no form renders it. Schema editors show it. */\n archived?: boolean;\n /**\n * D58 field-level access. `view` missing → everyone who can open the form sees it; `edit` missing → the form's own\n * rule (the host's content.edit). A field the lens can't `view` is not rendered; one it can't `edit` renders as plain\n * text. Fields in the `seo` group default to `{ edit: \"seo.edit\" }`.\n */\n access?: FieldAccess;\n localized?: boolean;\n advanced?: boolean; // tucked into the \"Advanced\" fieldset by default (calm UX)\n ai?: boolean; // show the AI assist sparkle\n // reference targets (collection ids, \"page\", \"form\"); `noun`: what the picker calls one (\"author\": \"Select an author\",\n // \"Create new author\"), else the target's (\"CMS item\", \"page\", …)\n // `excludeId`: a record this picker never lists (the entry a rich-text island sits in, which its own form cannot see)\n reference?: { to: string[]; filter?: string | ReferenceFilter; noun?: string; excludeId?: string };\n numeric?: { unit?: string; step?: number; min?: number; max?: number }; // number / slider\n /** number: a developer-controlled SCALE (tokens or a stepped range) with an optional custom escape hatch (CPO D41).\n * Value shape → `ScaleValue`. Takes precedence over `layout: \"slider\"` + `numeric` (which still work, fixed-only). */\n scale?: ScaleSchema;\n /** table: column types allowed, developer-locked columns, row limits, caption rule, JSON-LD offered (CPO D42). */\n table?: TableFieldOptions;\n\n /* ── additive (Block Kit v1) ─────────────────────────────────────────── */\n /** Tabler icon name (kebab-case) used on rows, crumbs and the block picker. */\n icon?: string;\n /** text: minimum visible rows. */\n rows?: number;\n /** Value is synced from a global block (\"Navigation\") — edits apply everywhere it is used. */\n synced?: { from: string };\n /** slot: per-child layout settings stored on each child under `_settings` (e.g. bento span). */\n slotSettings?: FieldSchema[];\n /** array: singular noun for \"Add {noun}\" and empty states (\"question\"). Defaults from the item title. */\n itemNoun?: string;\n /** array: how rows render. \"grid\" = tiles (good for images / logos). */\n arrayLayout?: \"list\" | \"grid\";\n /**\n * The reason a locked field shows editors (\"Set by developers.\"). A field is LOCKED when it has `access.edit` (D58, the one\n * source of truth): people without that cap see the value read-only, with a small lock glyph and this line (D70).\n */\n lockReason?: string;\n /**\n * D70 \"Protect in schema\": the site's code depends on this field, so a schema editor refuses to rename its key, change\n * its type, archive or delete it (or a parent holding it) until someone unlocks it. Values and other settings still change.\n */\n protected?: boolean;\n /**\n * Host-only, never persisted: the list's ORDER is set by the site's code (identity rule 36). The rows stay editable;\n * drag and Move up / down are off and the grip slot shows a lock (V2 content/editor/page-sections.tsx:31,155).\n */\n orderLocked?: boolean;\n /** link / image / button: store a plain string (href or URL) instead of the object — for legacy data. */\n valueShape?: \"string\" | \"object\";\n /** image: an inline-SVG icon, which takes SVG files only (prod `config.media: \"icon\"`). */\n svgOnly?: boolean;\n /** icon (D65): where an icon may come from (set · library · upload) and whether it asks for a label (prod `config.icons`). */\n icons?: IconFieldOptions;\n /**\n * A link LABEL's href: the sibling it links with (prod `config.linkHref`), as the owner answered the editable plan's\n * `link-pair` question where the names do not say (`title` + `to`). Read first by `linkLabelHref`.\n */\n linkHref?: string;\n /**\n * date / datetime: time zone handling (CPO D43). true = the editor picks a zone (defaults to the site's) · \"site\" = always\n * the site's zone · \"fixed:<IANA>\" = always that zone · false = no zone. Default: true for datetime, false for date.\n * Zoned values store ISO with offset + the IANA zone: \"2026-10-14T09:00:00+05:30[Asia/Kolkata]\" (RFC 9557).\n */\n timezone?: boolean | \"site\" | `fixed:${string}`;\n /** code: the field's own language and the only languages its picker offers (prod config.language / languages). */\n language?: string;\n languages?: string[];\n /**\n * richtext / document: the blocks and marks the field offers, from types RICHTEXT_FEATURES (prod config.features).\n * Absent = all of them, as V2's rich text offers (normV2 folds the full set to absent). A schema read from JSON may\n * hold an alias (`headings`) or an unknown name: the adapter expands the one and names the other.\n */\n features?: RichTextFeature[];\n /**\n * richtext / document: the content models its related posts and author bios draw from (prod config.references,\n * plan RT8), by id. posts absent: the entry's own collection; authors absent: no author bio is offered.\n */\n references?: { posts?: string; authors?: string };\n}\n\n/** D58: the caps that let someone see / change one field. */\nexport interface FieldAccess {\n view?: Cap;\n edit?: Cap;\n}\n/** Developer-owned values (anchors, custom CSS, ids): only people who can change the schema edit them. */\nexport const DEV_FIELD: FieldAccess = { edit: \"schema.manage\" };\n/** Developer-only settings: hidden unless you can see the schema. */\nexport const DEV_ONLY_FIELD: FieldAccess = { view: \"schema.view\", edit: \"schema.manage\" };\n\n/* ── Scales (CPO D41) ─────────────────────────────────────────────────── */\nexport type ScaleUnit = \"px\" | \"%\" | \"rem\" | \"em\" | \"vw\" | \"vh\";\n\n/** One allowed value of a token scale. `value` is what is stored; `label` is the short readout (\"XL\"). */\nexport interface ScaleStep {\n value: string;\n label: string;\n /** Long name for screen readers and tooltips (\"Extra large\"). Defaults to `label`. */\n title?: string;\n /** Resolved size in px, shown as \"XL · 48px\" and used to place custom values on the track. */\n px?: number;\n /** Resolved CSS when it isn't px (e.g. \"100vh\", \"var(--space-xl)\"). */\n css?: string;\n}\n\n/** A stepped numeric range (continuous with snapping). The stored value is a bare number in `defaultUnit`. */\nexport interface ScaleRange {\n min: number;\n max: number;\n step?: number;\n}\n\n/** Bounds for the custom escape hatch. min / max may be one number or per unit ({ px: 0, \"%\": 0 }). */\nexport interface ScaleCustom {\n min?: number | Partial<Record<ScaleUnit, number>>;\n max?: number | Partial<Record<ScaleUnit, number>>;\n /** Units the editor may type. Defaults to the scale's `units`. */\n units?: ScaleUnit[];\n /** Arrow-key nudge (Shift ×10, Alt ×0.1). Default 1. */\n step?: number;\n}\n\nexport interface ScaleSchema {\n /** Token steps (S M L XL 2XL) or a numeric range ({ min, max, step }). */\n steps: ScaleStep[] | ScaleRange;\n /** Units of the scale; the first is the default. A range with no units is unitless. */\n units?: ScaleUnit[];\n defaultUnit?: ScaleUnit;\n /** false (default) = fixed only: the editor can pick only the allowed values. true / object = fixed + custom. */\n allowCustom?: boolean | ScaleCustom;\n /** Quick picks in the unit menu when custom is allowed (\"50%\", \"100vh\"). */\n presets?: { label?: string; value: ScaleValue }[];\n}\n\n/**\n * How a scale value is STORED — three shapes, told apart by `typeof`, so tokens and custom values never collide and\n * older data (bare token strings, bare numbers) is already valid:\n * - token → the step's value string (\"xl\")\n * - range → a bare number in the default unit (15 → 15%)\n * - custom → an object ({ value: 200, unit: \"px\" })\n */\nexport type ScaleValue = string | number | ScaleCustomValue;\nexport interface ScaleCustomValue {\n value: number;\n unit: ScaleUnit;\n}\n\nexport interface Fieldset {\n name: string;\n title: string;\n description?: string;\n collapsed?: boolean; // collapsed by default\n columns?: 1 | 2; // short fields side by side\n /** CPO D45: the header toggles the section (default true). false = a static heading for 2–3 fields that are always needed. */\n collapsible?: boolean;\n /**\n * CPO D45: \"breakpoints\" = the members are objects, one per screen size (desktop · tablet · phone), shown as ONE group with a\n * segmented switcher instead of three stacked groups. Sibling objects named desktop / laptop / tablet / mobile / phone get\n * this automatically.\n */\n layout?: \"stack\" | \"breakpoints\";\n}\n\nexport interface FieldGroup {\n name: string;\n title: string;\n icon?: string;\n default?: boolean;\n}\n\n/** A developer-defined layout of a block (swap without losing content). */\nexport interface BlockVariant {\n id: string;\n name: string;\n description?: string;\n}\n\n/** A document/block type. */\nexport interface TypeSchema {\n name: string; // e.g. \"hero\", \"journalStory\"\n title: string;\n kind: \"block\" | \"page\" | \"entry\" | \"global\" | \"object\";\n icon?: string;\n description?: string;\n fields: FieldSchema[];\n fieldsets?: Fieldset[];\n groups?: FieldGroup[];\n preview?: PreviewConfig;\n /* ── additive (Block Kit v1) ── */\n /** Block variants (layouts) — shown as a chip on slot rows and a switcher in the block frame. */\n variants?: BlockVariant[];\n /** Block picker category (\"Layout\", \"Content\", \"Media\"…). */\n category?: string;\n /**\n * kind \"block\" only (CPO D55): where the block fits. \"inline\" = it fits a text column, so a rich-text body lists it in\n * the Insert menu's Article group. \"section\" (default) = page-width, reachable in a body only through More components.\n * \"page\" = a whole page or a feed of other content; never inside a body.\n */\n placement?: \"inline\" | \"section\" | \"page\";\n /** Starting value for a new instance (block added to a slot, new document). */\n initialValue?: Record<string, unknown>;\n}\n\n/** Every array item / slot child carries a stable key. Slot children also carry their block type. */\nexport interface KeyedItem {\n _key?: string;\n /** item type name (arrays with several `of` types) or block type (slots) */\n _type?: string;\n}\n/** A block inside a slot: its own props at the root, plus variant and per-slot layout settings. */\nexport interface SlotChild extends KeyedItem {\n _type: string;\n _variant?: string;\n _settings?: Record<string, unknown>;\n [prop: string]: unknown;\n}\n\n/** Path from the root document/block to the field being edited, e.g. [\"items\", 1, \"answer\"] */\nexport type FieldPath = (string | number)[];\n\n/** One crumb in the inspector/editor breadcrumb (drill-in navigation stack). */\nexport interface Crumb {\n path: FieldPath;\n title: string;\n icon?: string;\n /** tableGroup / tableRow / tableColumn: a table field's rows and columns drill like array items (D50) */\n kind: \"root\" | \"object\" | \"item\" | \"block\" | \"button\" | \"history\" | \"tableGroup\" | \"tableRow\" | \"tableColumn\";\n}\n\n/** Reserved path segment: the field's version history as a stacked panel, e.g. [\"title\", \"@history\"]. */\nexport const HISTORY_SEGMENT = \"@history\";\n"],"mappings":";;AAmPA,IAAa,YAAyB,EAAE,MAAM,gBAAgB;;AAE9D,IAAa,iBAA8B;CAAE,MAAM;CAAe,MAAM;AAAgB;;AA8IxF,IAAa,kBAAkB"}