@cocoar/vue-ui 3.4.0-beta.8 → 4.0.0-beta.44

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 (250) hide show
  1. package/dist/compact-fonts.d.ts +1 -0
  2. package/dist/compact-fonts.d.ts.map +1 -0
  3. package/dist/compact-fonts.js +4 -0
  4. package/dist/components/_internal/keyboardInset.d.ts +9 -0
  5. package/dist/components/_internal/keyboardInset.d.ts.map +1 -0
  6. package/dist/components/_internal/pageScrollLock.d.ts +17 -0
  7. package/dist/components/_internal/pageScrollLock.d.ts.map +1 -0
  8. package/dist/components/_internal/useFocusTrap.d.ts +9 -0
  9. package/dist/components/_internal/useFocusTrap.d.ts.map +1 -0
  10. package/dist/components/_internal/useVisualViewport.d.ts +26 -0
  11. package/dist/components/_internal/useVisualViewport.d.ts.map +1 -0
  12. package/dist/components/badge/CoarBadge.vue.d.ts.map +1 -1
  13. package/dist/components/card/CoarCard.vue.d.ts.map +1 -1
  14. package/dist/components/checkbox/CoarCheckbox.vue.d.ts +2 -2
  15. package/dist/components/checkbox/CoarCheckbox.vue.d.ts.map +1 -1
  16. package/dist/components/code-block/CoarCodeBlock.vue.d.ts +1 -1
  17. package/dist/components/code-block/CoarCodeBlock.vue.d.ts.map +1 -1
  18. package/dist/components/data-list/CoarDataList.vue.d.ts.map +1 -1
  19. package/dist/components/date-time/_shared/use-plain-date-picker.d.ts +95 -0
  20. package/dist/components/date-time/_shared/use-plain-date-picker.d.ts.map +1 -0
  21. package/dist/components/date-time/_shared/use-plain-date-time-picker.d.ts +113 -0
  22. package/dist/components/date-time/_shared/use-plain-date-time-picker.d.ts.map +1 -0
  23. package/dist/components/date-time/_shared/use-zoned-date-time-picker.d.ts +132 -0
  24. package/dist/components/date-time/_shared/use-zoned-date-time-picker.d.ts.map +1 -0
  25. package/dist/components/date-time/plain-date-picker/CoarPlainDatePicker.vue.d.ts +23 -6
  26. package/dist/components/date-time/plain-date-picker/CoarPlainDatePicker.vue.d.ts.map +1 -1
  27. package/dist/components/date-time/plain-date-time-or-date-picker/CoarPlainDateTimeOrDatePicker.vue.d.ts +4 -0
  28. package/dist/components/date-time/plain-date-time-or-date-picker/CoarPlainDateTimeOrDatePicker.vue.d.ts.map +1 -1
  29. package/dist/components/date-time/plain-date-time-picker/CoarPlainDateTimePicker.vue.d.ts +23 -6
  30. package/dist/components/date-time/plain-date-time-picker/CoarPlainDateTimePicker.vue.d.ts.map +1 -1
  31. package/dist/components/date-time/scrollable-calendar/CoarScrollableCalendar.vue.d.ts.map +1 -1
  32. package/dist/components/date-time/time-picker/CoarTimePicker.vue.d.ts.map +1 -1
  33. package/dist/components/date-time/zoned-date-time-or-date-picker/CoarZonedDateTimeOrDatePicker.vue.d.ts +4 -0
  34. package/dist/components/date-time/zoned-date-time-or-date-picker/CoarZonedDateTimeOrDatePicker.vue.d.ts.map +1 -1
  35. package/dist/components/date-time/zoned-date-time-picker/CoarZonedDateTimePicker.vue.d.ts +23 -6
  36. package/dist/components/date-time/zoned-date-time-picker/CoarZonedDateTimePicker.vue.d.ts.map +1 -1
  37. package/dist/components/date-time/zoned-date-time-picker/CoarZonedDateTimePickerPanel.vue.d.ts.map +1 -1
  38. package/dist/components/dialog/CoarDialogFooter.vue.d.ts +20 -0
  39. package/dist/components/dialog/CoarDialogFooter.vue.d.ts.map +1 -0
  40. package/dist/components/dialog/CoarDialogShell.vue.d.ts +2 -0
  41. package/dist/components/dialog/CoarDialogShell.vue.d.ts.map +1 -1
  42. package/dist/components/dialog/CoarSheetShell.vue.d.ts +50 -0
  43. package/dist/components/dialog/CoarSheetShell.vue.d.ts.map +1 -0
  44. package/dist/components/dialog/dialog-types.d.ts +27 -0
  45. package/dist/components/dialog/dialog-types.d.ts.map +1 -1
  46. package/dist/components/dialog/dialogFooter.d.ts +21 -0
  47. package/dist/components/dialog/dialogFooter.d.ts.map +1 -0
  48. package/dist/components/dialog/index.d.ts +2 -1
  49. package/dist/components/dialog/index.d.ts.map +1 -1
  50. package/dist/components/dialog/useDialog.d.ts +6 -15
  51. package/dist/components/dialog/useDialog.d.ts.map +1 -1
  52. package/dist/components/dialog/useSheetDrag.d.ts +46 -0
  53. package/dist/components/dialog/useSheetDrag.d.ts.map +1 -0
  54. package/dist/components/form-field/CoarFormField.vue.d.ts +2 -2
  55. package/dist/components/form-field/CoarFormField.vue.d.ts.map +1 -1
  56. package/dist/components/form-field/constants.d.ts +6 -0
  57. package/dist/components/form-field/constants.d.ts.map +1 -1
  58. package/dist/components/icon/CoarIcon.vue.d.ts +3 -3
  59. package/dist/components/icon/CoarIcon.vue.d.ts.map +1 -1
  60. package/dist/components/icon/core-icons.d.ts +2 -0
  61. package/dist/components/icon/core-icons.d.ts.map +1 -1
  62. package/dist/components/input-frame/CoarInputFrame.vue.d.ts +17 -6
  63. package/dist/components/input-frame/CoarInputFrame.vue.d.ts.map +1 -1
  64. package/dist/components/input-frame/CoarInputFrameButton.vue.d.ts.map +1 -1
  65. package/dist/components/input-frame/types.d.ts +9 -0
  66. package/dist/components/input-frame/types.d.ts.map +1 -0
  67. package/dist/components/listbox/CoarListbox.vue.d.ts.map +1 -1
  68. package/dist/components/menu/CoarContextMenu.vue.d.ts.map +1 -1
  69. package/dist/components/menu/CoarMenuItem.vue.d.ts.map +1 -1
  70. package/dist/components/menu/CoarSubExpand.vue.d.ts.map +1 -1
  71. package/dist/components/menu/CoarSubFlyout.vue.d.ts.map +1 -1
  72. package/dist/components/menu/useContextMenu.d.ts +7 -20
  73. package/dist/components/menu/useContextMenu.d.ts.map +1 -1
  74. package/dist/components/number-input/CoarNumberInput.vue.d.ts +16 -1
  75. package/dist/components/number-input/CoarNumberInput.vue.d.ts.map +1 -1
  76. package/dist/components/otp-input/CoarOtpInput.vue.d.ts +2 -2
  77. package/dist/components/otp-input/CoarOtpInput.vue.d.ts.map +1 -1
  78. package/dist/components/overlay/CoarOverlayOutlet.vue.d.ts.map +1 -1
  79. package/dist/components/overlay/compact-context.d.ts +10 -0
  80. package/dist/components/overlay/compact-context.d.ts.map +1 -0
  81. package/dist/components/overlay/index.d.ts +3 -1
  82. package/dist/components/overlay/index.d.ts.map +1 -1
  83. package/dist/components/overlay/overlay-presets.d.ts +9 -0
  84. package/dist/components/overlay/overlay-presets.d.ts.map +1 -1
  85. package/dist/components/overlay/overlay-service.d.ts +12 -0
  86. package/dist/components/overlay/overlay-service.d.ts.map +1 -1
  87. package/dist/components/overlay/overlay-types.d.ts +6 -0
  88. package/dist/components/overlay/overlay-types.d.ts.map +1 -1
  89. package/dist/components/overlay/useCompactPresentationContext.d.ts +33 -0
  90. package/dist/components/overlay/useCompactPresentationContext.d.ts.map +1 -0
  91. package/dist/components/pagination/CoarPagination.vue.d.ts.map +1 -1
  92. package/dist/components/panel-layout/internal/CoarPaneDivider.vue.d.ts.map +1 -1
  93. package/dist/components/password-input/CoarPasswordInput.vue.d.ts +5 -1
  94. package/dist/components/password-input/CoarPasswordInput.vue.d.ts.map +1 -1
  95. package/dist/components/scrollbar/index.d.ts +1 -1
  96. package/dist/components/scrollbar/index.d.ts.map +1 -1
  97. package/dist/components/scrollbar/vScrollbar.d.ts +9 -0
  98. package/dist/components/scrollbar/vScrollbar.d.ts.map +1 -1
  99. package/dist/components/segmented-control/CoarSegmentedControl.vue.d.ts.map +1 -1
  100. package/dist/components/select/CoarMultiSelect.vue.d.ts.map +1 -1
  101. package/dist/components/select/CoarMultiSelectDropdownPanel.vue.d.ts.map +1 -1
  102. package/dist/components/select/CoarSelect.vue.d.ts +17 -3
  103. package/dist/components/select/CoarSelect.vue.d.ts.map +1 -1
  104. package/dist/components/select/CoarSelectDropdownPanel.vue.d.ts +7 -4
  105. package/dist/components/select/CoarSelectDropdownPanel.vue.d.ts.map +1 -1
  106. package/dist/components/select/CoarTagSelect.vue.d.ts.map +1 -1
  107. package/dist/components/select/CoarTagSelectDropdownPanel.vue.d.ts.map +1 -1
  108. package/dist/components/select/index.d.ts +1 -1
  109. package/dist/components/select/index.d.ts.map +1 -1
  110. package/dist/components/select/types.d.ts +13 -0
  111. package/dist/components/select/types.d.ts.map +1 -1
  112. package/dist/components/select/useSelectBase.d.ts +2 -1
  113. package/dist/components/select/useSelectBase.d.ts.map +1 -1
  114. package/dist/components/sidebar/CoarSidebarGroup.vue.d.ts.map +1 -1
  115. package/dist/components/switch/CoarSwitch.vue.d.ts +2 -2
  116. package/dist/components/switch/CoarSwitch.vue.d.ts.map +1 -1
  117. package/dist/components/tabs/CoarTabGroup.vue.d.ts.map +1 -1
  118. package/dist/components/tag/CoarTag.vue.d.ts.map +1 -1
  119. package/dist/components/text-input/CoarTextInput.vue.d.ts +16 -2
  120. package/dist/components/text-input/CoarTextInput.vue.d.ts.map +1 -1
  121. package/dist/components/theme-editor/CoarPaletteEditor.vue.d.ts +8 -2
  122. package/dist/components/theme-editor/CoarPaletteEditor.vue.d.ts.map +1 -1
  123. package/dist/components/theme-editor/color-preview.d.ts +22 -0
  124. package/dist/components/theme-editor/color-preview.d.ts.map +1 -0
  125. package/dist/components/theme-editor/font-preview.d.ts +46 -0
  126. package/dist/components/theme-editor/font-preview.d.ts.map +1 -0
  127. package/dist/components/theme-editor/scheme-values.d.ts +12 -0
  128. package/dist/components/theme-editor/scheme-values.d.ts.map +1 -0
  129. package/dist/components/theme-editor/theme-editor-state.d.ts +199 -183
  130. package/dist/components/theme-editor/theme-editor-state.d.ts.map +1 -1
  131. package/dist/components/theme-scope/CoarThemeScope.vue.d.ts.map +1 -1
  132. package/dist/components/tree/CoarTreeNode.vue.d.ts.map +1 -1
  133. package/dist/composables/useDragDrop.d.ts.map +1 -1
  134. package/dist/composables/useDragImage.d.ts +2 -14
  135. package/dist/composables/useDragImage.d.ts.map +1 -1
  136. package/dist/index.css +1 -1
  137. package/dist/index.d.ts +8 -4
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/index.js +6768 -4523
  140. package/dist/onest-fonts.d.ts +1 -0
  141. package/dist/onest-fonts.d.ts.map +1 -0
  142. package/dist/onest-fonts.js +4 -0
  143. package/dist/theme/color-contrast.d.ts +10 -0
  144. package/dist/theme/color-contrast.d.ts.map +1 -0
  145. package/dist/theme/compact-packages/calendar.d.ts +8 -0
  146. package/dist/theme/compact-packages/calendar.d.ts.map +1 -0
  147. package/dist/theme/compact-packages/data-grid.d.ts +8 -0
  148. package/dist/theme/compact-packages/data-grid.d.ts.map +1 -0
  149. package/dist/theme/compact-packages/document-viewer.d.ts +8 -0
  150. package/dist/theme/compact-packages/document-viewer.d.ts.map +1 -0
  151. package/dist/theme/compact-packages/map.d.ts +11 -0
  152. package/dist/theme/compact-packages/map.d.ts.map +1 -0
  153. package/dist/theme/compact-packages/markdown-editor.d.ts +8 -0
  154. package/dist/theme/compact-packages/markdown-editor.d.ts.map +1 -0
  155. package/dist/theme/compact-packages/markdown.d.ts +14 -0
  156. package/dist/theme/compact-packages/markdown.d.ts.map +1 -0
  157. package/dist/theme/compact-packages/mermaid.d.ts +8 -0
  158. package/dist/theme/compact-packages/mermaid.d.ts.map +1 -0
  159. package/dist/theme/compact-packages/page-builder.d.ts +8 -0
  160. package/dist/theme/compact-packages/page-builder.d.ts.map +1 -0
  161. package/dist/theme/compact-packages/script-editor.d.ts +8 -0
  162. package/dist/theme/compact-packages/script-editor.d.ts.map +1 -0
  163. package/dist/theme/compact-theme.d.ts +11 -0
  164. package/dist/theme/compact-theme.d.ts.map +1 -0
  165. package/dist/theme/enterprise-packages/calendar.d.ts +3 -0
  166. package/dist/theme/enterprise-packages/calendar.d.ts.map +1 -0
  167. package/dist/theme/enterprise-packages/document-viewer.d.ts +3 -0
  168. package/dist/theme/enterprise-packages/document-viewer.d.ts.map +1 -0
  169. package/dist/theme/enterprise-packages/map.d.ts +3 -0
  170. package/dist/theme/enterprise-packages/map.d.ts.map +1 -0
  171. package/dist/theme/enterprise-packages/markdown.d.ts +7 -0
  172. package/dist/theme/enterprise-packages/markdown.d.ts.map +1 -0
  173. package/dist/theme/enterprise-packages/mermaid.d.ts +3 -0
  174. package/dist/theme/enterprise-packages/mermaid.d.ts.map +1 -0
  175. package/dist/theme/enterprise-packages/page-builder.d.ts +3 -0
  176. package/dist/theme/enterprise-packages/page-builder.d.ts.map +1 -0
  177. package/dist/theme/enterprise-packages/script-editor.d.ts +7 -0
  178. package/dist/theme/enterprise-packages/script-editor.d.ts.map +1 -0
  179. package/dist/theme/enterprise-theme.d.ts +8 -0
  180. package/dist/theme/enterprise-theme.d.ts.map +1 -0
  181. package/dist/theme/palette-inputs.d.ts +34 -0
  182. package/dist/theme/palette-inputs.d.ts.map +1 -0
  183. package/dist/theme/role-derived-tokens.d.ts +3 -0
  184. package/dist/theme/role-derived-tokens.d.ts.map +1 -0
  185. package/dist/theme/role-input-defaults.d.ts +5 -0
  186. package/dist/theme/role-input-defaults.d.ts.map +1 -0
  187. package/dist/theme/role-theme-contract.d.ts +8 -0
  188. package/dist/theme/role-theme-contract.d.ts.map +1 -0
  189. package/dist/theme/role-theme.d.ts +40 -0
  190. package/dist/theme/role-theme.d.ts.map +1 -0
  191. package/package.json +15 -4
  192. package/skills/cocoar-vue-ui/SKILL.md +8 -1
  193. package/skills/cocoar-vue-ui/references/components/calendar/board.md +212 -0
  194. package/skills/cocoar-vue-ui/references/components/calendar/coar-calendar.md +32 -1
  195. package/skills/cocoar-vue-ui/references/components/calendar/day-view.md +21 -0
  196. package/skills/cocoar-vue-ui/references/components/calendar/index.md +26 -1
  197. package/skills/cocoar-vue-ui/references/components/calendar/mini-month.md +59 -0
  198. package/skills/cocoar-vue-ui/references/components/calendar/month-view.md +48 -1
  199. package/skills/cocoar-vue-ui/references/components/context-menu.md +1 -0
  200. package/skills/cocoar-vue-ui/references/components/data-grid.md +4 -0
  201. package/skills/cocoar-vue-ui/references/components/date-or-time-picker.md +30 -1
  202. package/skills/cocoar-vue-ui/references/components/date-picker.md +32 -1
  203. package/skills/cocoar-vue-ui/references/components/date-time-picker.md +28 -1
  204. package/skills/cocoar-vue-ui/references/components/dialog.md +188 -2
  205. package/skills/cocoar-vue-ui/references/components/document-viewer/coar-document-viewer.md +4 -0
  206. package/skills/cocoar-vue-ui/references/components/form-field.md +10 -6
  207. package/skills/cocoar-vue-ui/references/components/listbox.md +3 -1
  208. package/skills/cocoar-vue-ui/references/components/map/index.md +5 -1
  209. package/skills/cocoar-vue-ui/references/components/markdown-editor.md +10 -0
  210. package/skills/cocoar-vue-ui/references/components/markdown-form.md +9 -0
  211. package/skills/cocoar-vue-ui/references/components/markdown.md +10 -0
  212. package/skills/cocoar-vue-ui/references/components/menu.md +1 -1
  213. package/skills/cocoar-vue-ui/references/components/mermaid.md +11 -0
  214. package/skills/cocoar-vue-ui/references/components/number-input.md +81 -0
  215. package/skills/cocoar-vue-ui/references/components/object-editor.md +737 -0
  216. package/skills/cocoar-vue-ui/references/components/otp-input.md +1 -1
  217. package/skills/cocoar-vue-ui/references/components/pagination.md +1 -1
  218. package/skills/cocoar-vue-ui/references/components/password-input.md +32 -0
  219. package/skills/cocoar-vue-ui/references/components/script-editor.md +10 -0
  220. package/skills/cocoar-vue-ui/references/components/segmented-control.md +1 -1
  221. package/skills/cocoar-vue-ui/references/components/select.md +136 -2
  222. package/skills/cocoar-vue-ui/references/components/tabs.md +1 -1
  223. package/skills/cocoar-vue-ui/references/components/tag.md +1 -1
  224. package/skills/cocoar-vue-ui/references/components/text-input.md +189 -0
  225. package/skills/cocoar-vue-ui/references/components/zoned-date-time-picker.md +42 -1
  226. package/skills/cocoar-vue-ui/references/foundations/colors.md +32 -3
  227. package/skills/cocoar-vue-ui/references/foundations/compact-presentation.md +248 -0
  228. package/skills/cocoar-vue-ui/references/foundations/theming.md +98 -11
  229. package/skills/cocoar-vue-ui/references/foundations/typography.md +3 -0
  230. package/skills/cocoar-vue-ui/references/guide/getting-started.md +2 -2
  231. package/skills/cocoar-vue-ui/references/guide/migration-color-roles.md +28 -0
  232. package/skills/cocoar-vue-ui/references/guide/migration-object-editor-values.md +40 -0
  233. package/skills/cocoar-vue-ui/references/guide/mobile.md +126 -27
  234. package/skills/cocoar-vue-ui/references/guide/theming.md +25 -0
  235. package/styles/tokens/all.css +6 -0
  236. package/styles/tokens/code-block.css +2 -2
  237. package/styles/tokens/colors-primitives-dark.css +50 -50
  238. package/styles/tokens/colors-primitives-light.css +50 -50
  239. package/styles/tokens/colors-usage.css +132 -111
  240. package/styles/tokens/compact.css +4442 -0
  241. package/styles/tokens/components-shared.css +4 -4
  242. package/styles/tokens/derived.css +525 -0
  243. package/styles/tokens/menu.css +21 -21
  244. package/styles/tokens/mobile.css +2 -0
  245. package/styles/tokens/new-components.css +42 -33
  246. package/styles/tokens/select-overlay.css +12 -12
  247. package/styles/tokens/sidebar.css +12 -12
  248. package/styles/tokens/theme-none.css +99 -93
  249. package/styles/tokens/tooltip.css +4 -4
  250. package/styles/tokens/typography.css +19 -19
@@ -0,0 +1,737 @@
1
+ <!-- Generated from apps/docs/components/object-editor.md by apps/docs/scripts/sync-skill.mjs. Do not edit; edit the docs page. -->
2
+
3
+ # Object Editor (Preview)
4
+
5
+ **Devices:** desktop ready · tablet partial · phone planned — Built for pointer and keyboard. On tablets the rows work but are dense; a phone layout is planned.
6
+
7
+ `@cocoar/vue-object-editor` edits JSON objects through a **JSON Schema** (Draft 2020-12). The schema says what a
8
+ value means — a string can be a date, an email address or a colour — and the editor shows each value with a fitting
9
+ inline control. Users never see JSON; the app gets plain JSON back.
10
+
11
+ ```sh
12
+ pnpm add @cocoar/vue-object-editor
13
+ ```
14
+
15
+ ```ts
16
+ import { CoarObjectEditor } from '@cocoar/vue-object-editor';
17
+ import '@cocoar/vue-object-editor/styles';
18
+ ```
19
+
20
+ ## Basic usage
21
+
22
+ Bind the object with `v-model` and pass its schema. `mode="view"` shows the formatted values; `mode="edit"` shows
23
+ the controls. Both use the same rows, so switching moves nothing. `striped` puts every second row on a light
24
+ background; a theme can do that for every editor (see [Theming](#theming)).
25
+
26
+ **Demo — `object-editor/demos/ObjectEditorProduct.vue`**
27
+
28
+ ```vue
29
+ <template>
30
+ <div class="demo">
31
+ <div class="toolbar">
32
+ <CoarSegmentedControl v-model="mode" :options="modes" aria-label="Mode" />
33
+ <CoarSwitch v-model="striped" size="s" label="Striped" />
34
+ <CoarTextInput v-model="search" size="s" placeholder="Search properties…" aria-label="Search properties" clearable />
35
+ </div>
36
+ <CoarObjectEditor
37
+ v-model="product"
38
+ v-model:search="search"
39
+ :schema="productSchema"
40
+ :mode="mode"
41
+ :striped="striped"
42
+ locale="en-US"
43
+ />
44
+ <details>
45
+ <summary>JSON</summary>
46
+ <pre>{{ JSON.stringify(product, null, 2) }}</pre>
47
+ </details>
48
+ </div>
49
+ </template>
50
+
51
+ <script setup lang="ts">
52
+ import { ref } from 'vue';
53
+ import { CoarSegmentedControl, CoarSwitch, CoarTextInput } from '@cocoar/vue-ui';
54
+ import { CoarObjectEditor } from '@cocoar/vue-object-editor';
55
+ import '@cocoar/vue-object-editor/styles';
56
+ import { createProduct, productSchema } from './product-schema';
57
+
58
+ const product = ref(createProduct());
59
+ const mode = ref<'view' | 'edit'>('edit');
60
+ const striped = ref(false);
61
+ const search = ref('');
62
+ const modes = [
63
+ { value: 'view', label: 'View' },
64
+ { value: 'edit', label: 'Edit' },
65
+ ];
66
+ </script>
67
+
68
+ <style scoped>
69
+ .demo {
70
+ display: flex;
71
+ flex-direction: column;
72
+ gap: 12px;
73
+ width: 100%;
74
+ }
75
+ .toolbar {
76
+ display: flex;
77
+ align-items: center;
78
+ gap: 16px;
79
+ }
80
+ pre {
81
+ font-size: 12px;
82
+ }
83
+ </style>
84
+ ```
85
+
86
+ What the editor does with the data:
87
+
88
+ - **A value is there when its key is.** `null`, `""`, `[]` and `{}` are values; only **Remove** in the
89
+ row's menu deletes a key (see [Values and absence](#values-and-absence)).
90
+ - **Problems appear in their row**, found by the schema (`minimum`, `format`, `required` …) and by the checks
91
+ of the value types. A problem of a part without its own row names that part (`mode: Required.`); one that
92
+ belongs to no row is listed above the rows.
93
+ - **A definition that contains itself** (`$ref` to an enclosing definition) starts closed and opens one level
94
+ per click.
95
+ - **Values the schema does not know stay in the data**, shown read-only as "not in the schema".
96
+ - **Lists and maps** of single values get a row per entry, see [Lists and maps](#lists-and-maps). **Lists of
97
+ groups** (arrays of objects) are shown read-only with their number of entries and kept unchanged.
98
+ - **Search** (`v-model:search`) finds rows by title, key or path, see [Search](#search).
99
+
100
+ ## Values and absence (Changed) {#values-and-absence}
101
+
102
+ The editor stores exactly what is set, the way JSON Schema reads it:
103
+
104
+ | State | Shown as | In the JSON |
105
+ |-------|----------|-------------|
106
+ | not set | `–` | no key |
107
+ | `null` | `null` | `"x": null` |
108
+ | empty | `""`, `[]`, `{}` | `"x": ""` … |
109
+
110
+ - An emptied text is `""`, an emptied tag list `[]`. The row's menu (⋯) has **Remove value**, which deletes the
111
+ key, and **Set to null** where the schema allows `null` (`type: ["boolean", "null"]`, an `anyOf` with
112
+ `{ "type": "null" }`, or `null` in `enum`). `false` and `0` are always values.
113
+ - A field that cannot show "no value" — an emptied number, date or choice — writes `null` when the schema allows
114
+ it. Otherwise nothing is written: the row asks for a value, and leaving the field restores the old one.
115
+ - `required` is met by the key, also with `null`.
116
+ - Rows below a group that is `null` are locked: editing them would replace that `null` with an object. The
117
+ group's menu has **Fill in this group**, which writes `{}`.
118
+
119
+ Forms that want "empty means missing" pass `presence="filled"`: emptying a value then removes its key, and an
120
+ empty value fails `required`. This was the behaviour before; see
121
+ [Migrating the Object Editor values](../guide/migration-object-editor-values.md).
122
+
123
+ ## Lists and maps {#lists-and-maps}
124
+
125
+ An **ordered list** (`type: "array"` with single-value `items`) and a **map** (`type: "object"` with a schema in
126
+ `additionalProperties`) show one row per entry, with the control of the entry's type. The product above has both:
127
+ `highlights` and `prices`.
128
+
129
+ - A list keeps its order and duplicates; `false` and `0` are values. The list's menu adds an item; an item's menu
130
+ moves, inserts below and removes it. **Alt+↑** / **Alt+↓** move the focused item.
131
+ - A map's keys are edited in place. A key that exists already is refused and marked at the key; the map's menu
132
+ adds an entry.
133
+ - A problem of an entry appears in its row (`/prices/AT`).
134
+ - An inherited list or map is copied into the document when one of its entries changes: the copy replaces it.
135
+
136
+ Strings that must be unique are `tags` (`uniqueItems: true`); strings in order are a `list`.
137
+
138
+ ## Search {#search}
139
+
140
+ `v-model:search` filters the rows by title, key or path (`dimensions.width`), also below closed groups, and keeps
141
+ the groups that lead to a match. Clearing it brings back the groups as they were. Values are never searched, so a
142
+ secret cannot match. It works together with `view="local"`.
143
+
144
+ `focus(pointer)` (on the component's ref) opens the groups of a row, scrolls to it and focuses its control — for
145
+ links from search results or from the app's own messages.
146
+
147
+ ## Inherited values {#inherited-values}
148
+
149
+ A layered configuration edits one layer and shows what the layers below give. `base` holds those values,
150
+ read-only: a row without a local key shows the base value, softer and marked with where it comes from. Editing
151
+ writes the local document; **Reset to inherited** in the menu removes the local key again, and a group the reset
152
+ leaves empty goes with it. `view="local"` shows only
153
+ the keys the document sets — also `false`, `0`, `null` and empty values — with the groups that lead to them.
154
+ Switching views never changes the document.
155
+
156
+ **Demo — `object-editor/demos/ObjectEditorInherited.vue`**
157
+
158
+ ```vue
159
+ <template>
160
+ <div class="demo">
161
+ <div class="toolbar">
162
+ <CoarSegmentedControl v-model="view" :options="views" aria-label="Rows" />
163
+ </div>
164
+ <CoarObjectEditor
165
+ v-model="layer"
166
+ :schema="schema"
167
+ :base="product"
168
+ :origin="origin"
169
+ :view="view"
170
+ :validate="false"
171
+ locale="en-US"
172
+ />
173
+ <div class="json">
174
+ <div>
175
+ <strong>Inherited (product)</strong>
176
+ <pre>{{ JSON.stringify(product, null, 2) }}</pre>
177
+ </div>
178
+ <div>
179
+ <strong>This layer (customer)</strong>
180
+ <pre>{{ JSON.stringify(layer, null, 2) }}</pre>
181
+ </div>
182
+ </div>
183
+ </div>
184
+ </template>
185
+
186
+ <script setup lang="ts">
187
+ import { ref } from 'vue';
188
+ import { CoarSegmentedControl } from '@cocoar/vue-ui';
189
+ import { CoarObjectEditor, type JsonObject, type JsonSchema } from '@cocoar/vue-object-editor';
190
+ import '@cocoar/vue-object-editor/styles';
191
+
192
+ const schema: JsonSchema = {
193
+ type: 'object',
194
+ 'x-coar-order': ['enabled', 'retries', 'region', 'proxy'],
195
+ properties: {
196
+ enabled: { type: ['boolean', 'null'], title: 'Enabled' },
197
+ retries: { type: 'integer', title: 'Retries', minimum: 0 },
198
+ region: { title: 'Region', enum: ['eu', 'us', 'asia'] },
199
+ proxy: {
200
+ type: ['object', 'null'],
201
+ title: 'Proxy',
202
+ properties: { host: { type: 'string', title: 'Host' }, port: { type: 'integer', title: 'Port' } },
203
+ },
204
+ },
205
+ };
206
+
207
+ // What the product layer gives. The app owns how layers combine; the editor only shows it.
208
+ const product: JsonObject = { enabled: true, retries: 3, region: 'eu', proxy: { host: 'proxy.example', port: 8080 } };
209
+ const layer = ref<JsonObject | undefined>({ retries: 0, proxy: { port: 3128 } });
210
+
211
+ const origin = () => ({ label: 'product', title: 'Inherited from the product defaults' });
212
+ const view = ref<'all' | 'local'>('all');
213
+ const views = [
214
+ { value: 'all', label: 'All properties' },
215
+ { value: 'local', label: 'Only this layer' },
216
+ ];
217
+ </script>
218
+
219
+ <style scoped>
220
+ .demo {
221
+ display: flex;
222
+ flex-direction: column;
223
+ gap: 12px;
224
+ width: 100%;
225
+ }
226
+ .json {
227
+ display: grid;
228
+ grid-template-columns: 1fr 1fr;
229
+ gap: 12px;
230
+ }
231
+ pre {
232
+ font-size: 12px;
233
+ }
234
+ </style>
235
+ ```
236
+
237
+ ```vue
238
+ <CoarObjectEditor
239
+ v-model="layer"
240
+ :schema="schema"
241
+ :base="inherited"
242
+ :origin="(pointer) => ({ label: sourceOf(pointer) })"
243
+ :view="onlyLocal ? 'local' : 'all'"
244
+ />
245
+ ```
246
+
247
+ The editor looks up a value per path: the local one, else the base one. It does not merge — how layers combine is
248
+ the app's rule. `origin` names the source of an inherited value; `conflict: true` shows "differs by context"
249
+ instead of a value that would look authoritative. To check the effective document, turn `validate` off and pass
250
+ the app's own `issues`: missing local keys are then no error, and the problems still appear in their rows.
251
+
252
+ ## Sensitive values {#sensitive-values}
253
+
254
+ Secrets stay with the app: its control writes them, its type decides how they look. Three hooks keep them out of
255
+ everything else:
256
+
257
+ - **`resolveType`** chooses a type from a marker the schema already has, without changing the stored schema:
258
+ `({ schema }) => schema['x-cocoar-secret'] ? 'secret' : undefined`.
259
+ - **`sensitive: true`** on the type: its value appears only through the type's own `format` or `view`, never
260
+ as generic text. **`validateSchema: false`**: the stored form (an encrypted envelope) differs from the logical
261
+ schema (`type: "string"`), so the schema's checks are skipped at this value.
262
+ - **`redact(pointer, value)`** masks any other value as dots, read-only and without a control, also unknown keys
263
+ the schema does not describe.
264
+
265
+ A missing required key is still reported where `validateSchema` is `false`: it is a check of the parent object.
266
+
267
+ **Demo — `object-editor/demos/ObjectEditorSecret.vue`**
268
+
269
+ ```vue
270
+ <template>
271
+ <div class="demo">
272
+ <CoarObjectEditor
273
+ v-model="settings"
274
+ :schema="schema"
275
+ :types="types"
276
+ :resolve-type="resolveType"
277
+ :redact="isEnvelope"
278
+ locale="en-US"
279
+ />
280
+ <pre>{{ JSON.stringify(settings, null, 2) }}</pre>
281
+ </div>
282
+ </template>
283
+
284
+ <script setup lang="ts">
285
+ import { markRaw, ref } from 'vue';
286
+ import {
287
+ CoarObjectEditor,
288
+ defineObjectEditorTypes,
289
+ type CoarValueType,
290
+ type JsonObject,
291
+ type JsonSchema,
292
+ type JsonValue,
293
+ } from '@cocoar/vue-object-editor';
294
+ import '@cocoar/vue-object-editor/styles';
295
+ import SecretControl from './SecretControl.vue';
296
+
297
+ // The app's secret type: its own control, shown as dots, stored as an envelope.
298
+ const secret: CoarValueType = {
299
+ id: 'secret',
300
+ label: 'Secret',
301
+ icon: 'lock',
302
+ hue: 0,
303
+ schema: { type: 'string' },
304
+ sensitive: true,
305
+ validateSchema: false,
306
+ control: markRaw(SecretControl),
307
+ format: () => '••••••',
308
+ };
309
+ const types = defineObjectEditorTypes([secret]);
310
+
311
+ // The schema keeps its own marker; the editor picks the type from it.
312
+ const schema: JsonSchema = {
313
+ type: 'object',
314
+ properties: {
315
+ user: { type: 'string', title: 'User' },
316
+ password: { type: 'string', title: 'Password', 'x-cocoar-secret': true },
317
+ },
318
+ };
319
+ const resolveType = ({ schema: property }: { schema: JsonSchema }) => (property['x-cocoar-secret'] ? 'secret' : undefined);
320
+ const isEnvelope = (_pointer: string, value: JsonValue) => typeof value === 'object' && value !== null && '$enc' in value;
321
+
322
+ const settings = ref<JsonObject | undefined>({
323
+ user: 'service',
324
+ password: { $enc: 'demo', data: 'c2VjcmV0' },
325
+ legacyToken: { $enc: 'demo', data: 'b2xk' },
326
+ });
327
+ </script>
328
+
329
+ <style scoped>
330
+ .demo {
331
+ display: flex;
332
+ flex-direction: column;
333
+ gap: 12px;
334
+ width: 100%;
335
+ }
336
+ pre {
337
+ font-size: 12px;
338
+ }
339
+ </style>
340
+ ```
341
+
342
+ ## The schema
343
+
344
+ The schema is standard JSON Schema; anything that validates JSON Schema can check the data too. A few
345
+ `x-coar-*` keywords add what JSON Schema has no word for:
346
+
347
+ | Keyword | Where | Meaning |
348
+ |---------|-------|---------|
349
+ | `x-coar-type` | property | Id of the value type. Without it the type is recognized from the schema (`format: "date"` → date) |
350
+ | `x-coar-order` | object | Order of its properties. Key order alone does not survive every database |
351
+ | `x-coar-unit` | number | Unit after the value, such as `cm` |
352
+ | `x-coar-decimals` | number | Decimal places; 0 for `integer`, 2 for `number` without it |
353
+ | `x-coar-options` | choice | Name of an option source the app passes in `optionSources` |
354
+ | `x-coar-suggestions` | tags | Suggested tags |
355
+
356
+ A **choice** is `oneOf` of `{ const, title }`; several choices are an `array` with `uniqueItems` and
357
+ `items.anyOf` of `{ const, title }`. A plain `enum` is read too.
358
+
359
+ ```json
360
+ {
361
+ "category": {
362
+ "title": "Category",
363
+ "oneOf": [
364
+ { "const": "lighting", "title": "Lighting" },
365
+ { "const": "furniture", "title": "Furniture" }
366
+ ]
367
+ }
368
+ }
369
+ ```
370
+
371
+ ## Built-in value types
372
+
373
+ | Id | Data | Control |
374
+ |----|------|---------|
375
+ | `text` | `string` | Inline text input |
376
+ | `multiline` | `string` | One-line preview, a text area once clicked |
377
+ | `number` | `number` / `integer` | Inline number input with unit |
378
+ | `boolean` | `boolean` | Switch |
379
+ | `date` | `string`, `format: "date"` | Inline date picker |
380
+ | `date-time` | `string`, `format: "date-time"` | Inline date-time picker; stored as ISO 8601 with offset |
381
+ | `email` | `string`, `format: "email"` | Inline text input |
382
+ | `color` | `string`, `pattern` `#RRGGBB` | Inline text input with a swatch |
383
+ | `choice` | `oneOf` of constants | Inline select |
384
+ | `choices` | `array` of constants | Tag select |
385
+ | `tags` | `array` of unique `string` | Tag select that creates tags |
386
+ | `list` | `array` of single values, in order | A row per item |
387
+ | `map` | `object` with `additionalProperties` | A row per key |
388
+ | `group-list` | `array` of objects | Read-only, number of entries |
389
+ | `object` | `object` | The rows of its properties, collapsible |
390
+
391
+ ## Types of the app and option sources
392
+
393
+ An app adds its own value types with `defineObjectEditorTypes()`. A type names the schema of its data and,
394
+ optionally, a control and a check. In the schema it is a `$ref` into `$defs`, so the schema stays valid on its
395
+ own. Without a control, a type whose data is an object is edited as nested rows.
396
+
397
+ Options that come from the app, such as people from an API, are named in the schema with `x-coar-options`; the
398
+ app passes the list, or a function that returns one, in `optionSources`.
399
+
400
+ **Demo — `object-editor/demos/ObjectEditorCustomType.vue`**
401
+
402
+ ```vue
403
+ <template>
404
+ <div class="demo">
405
+ <CoarObjectEditor
406
+ v-model="offer"
407
+ :schema="schema"
408
+ :types="types"
409
+ :option-sources="{ people }"
410
+ locale="en-US"
411
+ />
412
+ <pre>{{ JSON.stringify(offer, null, 2) }}</pre>
413
+ </div>
414
+ </template>
415
+
416
+ <script setup lang="ts">
417
+ import { markRaw, ref } from 'vue';
418
+ import {
419
+ CoarObjectEditor,
420
+ defineObjectEditorTypes,
421
+ type CoarValueType,
422
+ type JsonObject,
423
+ type JsonSchema,
424
+ } from '@cocoar/vue-object-editor';
425
+ import '@cocoar/vue-object-editor/styles';
426
+ import MoneyControl from './MoneyControl.vue';
427
+ import type { Money } from './money';
428
+
429
+ // A type of the app: its data is an object, its control one field with the currency in the suffix.
430
+ const money: CoarValueType<Money> = {
431
+ id: 'money',
432
+ label: 'Amount of money',
433
+ icon: 'hash',
434
+ hue: 165,
435
+ schema: {
436
+ type: 'object',
437
+ required: ['amount', 'currency'],
438
+ properties: { amount: { type: 'number' }, currency: { enum: ['EUR', 'USD', 'CHF'] } },
439
+ },
440
+ control: markRaw(MoneyControl),
441
+ format: (value, { locale }) =>
442
+ value.amount === undefined
443
+ ? '–'
444
+ : new Intl.NumberFormat(locale, { style: 'currency', currency: value.currency ?? 'EUR' }).format(value.amount),
445
+ validate: (value) => (value.amount !== undefined && !value.currency ? 'Choose a currency.' : null),
446
+ };
447
+ const types = defineObjectEditorTypes([money]);
448
+
449
+ // The schema names the source; the app gives its options, here after a short delay.
450
+ const people = () =>
451
+ new Promise<{ value: string; label: string; description: string }[]>((resolve) =>
452
+ setTimeout(
453
+ () =>
454
+ resolve([
455
+ { value: 'u1', label: 'Anna Berger', description: 'Product management' },
456
+ { value: 'u2', label: 'Lukas Huber', description: 'Design' },
457
+ { value: 'u3', label: 'Sophie Wagner', description: 'Purchasing' },
458
+ ]),
459
+ 300,
460
+ ),
461
+ );
462
+
463
+ const schema: JsonSchema = {
464
+ type: 'object',
465
+ required: ['price'],
466
+ properties: {
467
+ price: { $ref: '#/$defs/money', title: 'Price', 'x-coar-type': 'money' },
468
+ owner: { type: 'string', title: 'Owner', 'x-coar-type': 'choice', 'x-coar-options': 'people' },
469
+ },
470
+ $defs: { money: money.schema },
471
+ };
472
+
473
+ const offer = ref<JsonObject | undefined>({ price: { amount: 129.9, currency: 'EUR' }, owner: 'u2' });
474
+ </script>
475
+
476
+ <style scoped>
477
+ .demo {
478
+ display: flex;
479
+ flex-direction: column;
480
+ gap: 12px;
481
+ width: 100%;
482
+ }
483
+ pre {
484
+ font-size: 12px;
485
+ }
486
+ </style>
487
+ ```
488
+
489
+ ```ts
490
+ const money: CoarValueType<Money> = {
491
+ id: 'money', // x-coar-type and key in $defs
492
+ label: 'Amount of money', // name in the type list of the schema editor
493
+ icon: 'hash',
494
+ schema: { type: 'object', properties: { amount: { type: 'number' }, currency: { enum: ['EUR', 'USD'] } } },
495
+ control: markRaw(MoneyControl), // receives CoarValueControlProps, emits update:modelValue
496
+ format: (value, { locale }) => new Intl.NumberFormat(locale, { style: 'currency', currency: value.currency }).format(value.amount),
497
+ validate: (value) => (value.currency ? null : 'Choose a currency.'),
498
+ };
499
+ const types = defineObjectEditorTypes([money]);
500
+ ```
501
+
502
+ A control receives `modelValue`, the resolved `schema`, `id`, `label`, `readonly`, `error`, `options` and
503
+ `locale`, and emits `update:modelValue`; `undefined` clears the value.
504
+
505
+ ## Schema editor
506
+
507
+ `CoarSchemaEditor` describes the object: add properties, choose their type, mark them required, set limits, units
508
+ and the allowed values of a choice. Groups hold properties of their own. It writes the same JSON Schema the object
509
+ editor reads, so both can work on one schema side by side. Types of the app appear in its type list; their schema
510
+ goes to `$defs` once a property uses them, and leaves again with the last one.
511
+
512
+ **Demo — `object-editor/demos/SchemaAndObjectEditor.vue`**
513
+
514
+ ```vue
515
+ <template>
516
+ <div class="demo">
517
+ <CoarTabGroup v-model="tab">
518
+ <CoarTab id="schema">
519
+ Schema
520
+ <template #content>
521
+ <CoarSchemaEditor v-model="schema" :types="types" class="pane" />
522
+ </template>
523
+ </CoarTab>
524
+ <CoarTab id="data">
525
+ Data
526
+ <template #content>
527
+ <CoarObjectEditor v-model="data" :schema="schema" :types="types" locale="en-US" class="pane" />
528
+ </template>
529
+ </CoarTab>
530
+ <CoarTab id="json">
531
+ JSON
532
+ <template #content>
533
+ <div class="json">
534
+ <pre>{{ JSON.stringify(schema, null, 2) }}</pre>
535
+ <pre>{{ JSON.stringify(data, null, 2) }}</pre>
536
+ </div>
537
+ </template>
538
+ </CoarTab>
539
+ </CoarTabGroup>
540
+ </div>
541
+ </template>
542
+
543
+ <script setup lang="ts">
544
+ import { markRaw, ref, shallowRef } from 'vue';
545
+ import { CoarTab, CoarTabGroup } from '@cocoar/vue-ui';
546
+ import {
547
+ CoarObjectEditor,
548
+ CoarSchemaEditor,
549
+ createObjectSchema,
550
+ defineObjectEditorTypes,
551
+ type CoarValueType,
552
+ type JsonObject,
553
+ type JsonSchema,
554
+ } from '@cocoar/vue-object-editor';
555
+ import '@cocoar/vue-object-editor/styles';
556
+ import MoneyControl from './MoneyControl.vue';
557
+ import type { Money } from './money';
558
+
559
+ // The type of the app appears in the type list of the schema editor next to the built-in ones.
560
+ const money: CoarValueType<Money> = {
561
+ id: 'money',
562
+ label: 'Amount of money',
563
+ icon: 'hash',
564
+ hue: 165,
565
+ schema: {
566
+ type: 'object',
567
+ required: ['amount', 'currency'],
568
+ properties: { amount: { type: 'number' }, currency: { enum: ['EUR', 'USD', 'CHF'] } },
569
+ },
570
+ control: markRaw(MoneyControl),
571
+ };
572
+ const types = defineObjectEditorTypes([money]);
573
+
574
+ const tab = ref('schema');
575
+ const schema = shallowRef<JsonSchema>({
576
+ ...createObjectSchema(),
577
+ required: ['title'],
578
+ 'x-coar-order': ['title', 'budget', 'start'],
579
+ properties: {
580
+ title: { type: 'string', title: 'Title', 'x-coar-type': 'text' },
581
+ budget: { $ref: '#/$defs/money', title: 'Budget', 'x-coar-type': 'money' },
582
+ start: { type: 'string', format: 'date', title: 'Start', 'x-coar-type': 'date' },
583
+ },
584
+ $defs: { money: money.schema },
585
+ });
586
+ const data = shallowRef<JsonObject | undefined>({ title: 'Spring campaign' });
587
+ </script>
588
+
589
+ <style scoped>
590
+ .demo {
591
+ width: 100%;
592
+ }
593
+ .pane {
594
+ padding-top: 12px;
595
+ }
596
+ .json {
597
+ display: grid;
598
+ grid-template-columns: 1fr 1fr;
599
+ gap: 12px;
600
+ }
601
+ pre {
602
+ font-size: 12px;
603
+ overflow: auto;
604
+ max-height: 420px;
605
+ }
606
+ </style>
607
+ ```
608
+
609
+ ```vue
610
+ <CoarSchemaEditor v-model="schema" :types="types" />
611
+ <CoarObjectEditor v-model="data" :schema="schema" :types="types" />
612
+ ```
613
+
614
+ Every change emits a new schema object; the one passed in is never changed. Keys are letters, digits, `_` and
615
+ `-`, starting with a letter; renaming a property keeps its place and whether it is required. Problems the JSON
616
+ Schema itself cannot express — a minimum above the maximum, a choice without values, a value twice — are marked in
617
+ the list and explained in the inspector; `checkSchema(schema)` returns them for code.
618
+
619
+ The same operations exist as functions: `addProperty`, `removeProperty`, `renameProperty`, `moveProperty`,
620
+ `changePropertyType`, `updateProperty`, `setRequired` and `setOptions` take a schema and a path of keys
621
+ (`['dimensions', 'width']`) and return the new schema.
622
+
623
+ ### Profiles of the app
624
+
625
+ An app whose backend accepts only part of JSON Schema passes a `profile`:
626
+
627
+ ```vue
628
+ <CoarSchemaEditor
629
+ v-model="schema"
630
+ :profile="{
631
+ types: ['text', 'number', 'boolean', 'choice', 'list', 'map'], // offered types
632
+ choiceEncoding: 'enum', // choices as a plain enum, without texts
633
+ diagnostics: (schema) => backendProblems(schema), // [{ path: ['retries'], message: '…' }]
634
+ }"
635
+ />
636
+ ```
637
+
638
+ The schema editor changes only what is edited: `$defs`, annotations (`$comment`, `x-…` of other tools) and
639
+ references stay as imported. A property with keywords it cannot edit (`allOf`, `if`, `patternProperties` …) shows
640
+ them and offers only key, title and description. A type change that would drop keywords names them and waits for
641
+ a confirmation. **Allows null** writes `type: [t, "null"]`, and keeps an existing `anyOf` with `{ "type": "null" }`.
642
+
643
+ ## API
644
+
645
+ ### CoarObjectEditor props
646
+
647
+ | Prop | Type | Default | Description |
648
+ |------|------|---------|-------------|
649
+ | `v-model` | `JsonObject \| undefined` | — | The object |
650
+ | `schema` | `JsonSchema` | — | Its JSON Schema |
651
+ | `types` | `CoarObjectEditorTypes` | built-in types | From `defineObjectEditorTypes()` |
652
+ | `optionSources` | `Record<string, Option[] \| () => Option[] \| Promise<Option[]>>` | `{}` | Options named by `x-coar-options` |
653
+ | `mode` | `'view' \| 'edit'` | `'edit'` | Formatted values or controls |
654
+ | `locale` | `string` | browser | Locale of numbers and dates |
655
+ | `striped` | `boolean` | `false` | Every second row on a light background, for this editor (see [Theming](#theming)) |
656
+ | `presence` | `'key' \| 'filled'` | `'key'` | When a value counts as there, see [Values and absence](#values-and-absence) |
657
+ | `base` | `JsonObject` | — | Read-only values where the document has no key, see [Inherited values](#inherited-values) |
658
+ | `origin` | `(pointer) => { label, title?, conflict? }` | — | Where an inherited value comes from |
659
+ | `view` | `'all' \| 'local'` | `'all'` | `local`: only keys the document sets, with their groups |
660
+ | `validate` | `boolean` | `true` | `false`: no built-in validation |
661
+ | `issues` | `ObjectEditorIssue[]` | `[]` | Problems the app found, shown in their rows |
662
+ | `resolveType` | `({ schema, pointer, typeId }) => string \| undefined` | — | Chooses the type of a property, see [Sensitive values](#sensitive-values) |
663
+ | `redact` | `(pointer, value) => boolean` | — | Masks a value as dots |
664
+ | `v-model:search` | `string` | `''` | Filters rows by title, key or path, see [Search](#search) |
665
+
666
+ The component exposes `issues` (every problem of the value, as `{ pointer, keyword, message? }`) and
667
+ `focus(pointer)`.
668
+
669
+ ### CoarSchemaEditor props
670
+
671
+ | Prop | Type | Default | Description |
672
+ |------|------|---------|-------------|
673
+ | `v-model` | `JsonSchema` | — | The schema; each change emits a new object |
674
+ | `types` | `CoarObjectEditorTypes` | built-in types | The types to choose from |
675
+ | `profile` | `{ types?, choiceEncoding?, diagnostics? }` | — | What can be authored, see [Profiles of the app](#profiles-of-the-app) |
676
+
677
+ ### Functions
678
+
679
+ | Function | Description |
680
+ |----------|-------------|
681
+ | `defineObjectEditorTypes(types?)` | The built-in types plus the given ones |
682
+ | `validateValue(schema, value, { presence? })` | The problems of a value, each at its JSON Pointer |
683
+ | `allowsNull(schema)`, `nonNullSchema(root, schema)` | Whether a schema allows `null`; the schema without its `null` alternative |
684
+ | `createObjectSchema()` | An empty object schema |
685
+ | `checkSchema(schema)` | Bad keys, ranges and option lists, each at its path |
686
+ | `getAt`, `setAt`, `parsePointer`, `formatPointer` | Read and write values by JSON Pointer, without changing the original |
687
+
688
+ Validation uses [`@cfworker/json-schema`](https://github.com/cfworker/cfworker/tree/main/packages/json-schema): it
689
+ interprets the schema and never generates code, so a Content Security Policy without `'unsafe-eval'` works.
690
+
691
+ ## Theming
692
+
693
+ The rows sit on the background of the page. To give every second row a background in every object editor of an
694
+ app, set its token in the theme or style preset; the `striped` prop sets the same token for one editor.
695
+
696
+ | Token | Default | Description |
697
+ |-------|---------|-------------|
698
+ | `--coar-object-editor-row-stripe` | `transparent` | Background of every second row |
699
+
700
+ ```css
701
+ :root {
702
+ --coar-object-editor-row-stripe: var(--coar-background-neutral-secondary);
703
+ }
704
+ ```
705
+
706
+ ## i18n Keys
707
+
708
+ | Key | Default |
709
+ |-----|---------|
710
+ | `coar.objectEditor.required` | `Required.` |
711
+ | `coar.objectEditor.minimum` / `maximum` | `At least {min}.` / `At most {max}.` |
712
+ | `coar.objectEditor.minLength` / `maxLength` | `At least {min} characters.` / `At most {max} characters.` |
713
+ | `coar.objectEditor.formatDate` / `formatEmail` / `format` | `Not a valid date.` / `Not a valid email address.` / `Wrong format.` |
714
+ | `coar.objectEditor.type` | `Wrong kind of value.` |
715
+ | `coar.objectEditor.notAllowed` | `Not one of the allowed values.` |
716
+ | `coar.objectEditor.unique` | `Each value may appear only once.` |
717
+ | `coar.objectEditor.additional` | `Contains values the schema does not allow.` |
718
+ | `coar.objectEditor.invalid` | `Invalid value.` |
719
+ | `coar.objectEditor.notInSchema` | `not in the schema` |
720
+ | `coar.objectEditor.noProperties` | `The schema has no properties yet.` |
721
+ | `coar.objectEditor.yes` / `no` | `Yes` / `No` |
722
+ | `coar.objectEditor.filled` | `{count} filled` |
723
+ | `coar.objectEditor.entry` / `entries` | `1 entry` / `{count} entries` |
724
+ | `coar.objectEditor.type.<id>` | The `label` of the type |
725
+ | `coar.objectEditor.remove` / `reset` / `setNull` | `Remove value` / `Reset to inherited` / `Set to null` |
726
+ | `coar.objectEditor.actions` | `Actions for {title}` |
727
+ | `coar.objectEditor.needsValue` | `Enter a value, or remove it from the menu.` |
728
+ | `coar.objectEditor.lockedByNull` | `{group} is null: fill it in from its menu to edit this value` |
729
+ | `coar.objectEditor.fillGroup` | `Fill in this group` |
730
+ | `coar.objectEditor.inherited` / `conflict` | `inherited` / `differs by context` |
731
+ | `coar.objectEditor.literalHint` | `This value is set; Remove deletes it.` |
732
+ | `coar.objectEditor.noLocalValues` | `No values are set here.` |
733
+ | `coar.objectEditor.noMatches` | `No property matches the search.` |
734
+ | `coar.objectEditor.item` / `items` | `1 item` / `{count} items` |
735
+ | `coar.objectEditor.addItem` / `addEntry` / `insertBelow` / `moveUp` / `moveDown` / `removeEntry` | `Add item` / `Add entry` / `Insert below` / `Move up` / `Move down` / `Remove` |
736
+ | `coar.objectEditor.mapKey` / `keyEmpty` / `keyTaken` | `Key` / `A key cannot be empty.` / `This key exists already.` |
737
+ | `coar.schemaEditor.*` | Labels of the schema editor (`key`, `title`, `type`, `required`, `addProperty` …) and its problems (`invalidKey`, `keyTaken`, `rangeOrder`, `noOptions`, `emptyOption`, `duplicateOption`), and `allowsNull`, `itemType`, `valueType`, `unsupported`, `typeDrops`, `changeType` |