@blokkli/editor 2.0.0-alpha.35 → 2.0.0-alpha.36

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 (199) hide show
  1. package/dist/global/types/blockOptions.d.ts +9 -2
  2. package/dist/global/types/definitions.d.ts +12 -5
  3. package/dist/module.d.mts +2 -2
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +56 -4
  6. package/dist/modules/agent/index.d.mts +1 -1
  7. package/dist/modules/agent/index.mjs +38 -20
  8. package/dist/modules/agent/runtime/app/composables/agentProvider.d.ts +2 -2
  9. package/dist/modules/agent/runtime/app/composables/agentProvider.js +3 -3
  10. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue +34 -60
  11. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.d.vue.ts +8 -0
  12. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue +138 -0
  13. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue.d.ts +8 -0
  14. package/dist/modules/agent/runtime/app/features/agent/index.vue +5 -1
  15. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +175 -0
  16. package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +5 -0
  17. package/dist/modules/agent/runtime/app/tools/schemas.d.ts +10 -1
  18. package/dist/modules/agent/runtime/app/tools/schemas.js +36 -23
  19. package/dist/modules/agent/runtime/server/Session.d.ts +4 -2
  20. package/dist/modules/agent/runtime/server/Session.js +61 -57
  21. package/dist/modules/agent/runtime/server/agentPrompt.d.ts +9 -1
  22. package/dist/modules/agent/runtime/server/agentPrompt.js +26 -0
  23. package/dist/modules/agent/runtime/shared/types.d.ts +35 -1
  24. package/dist/modules/charts/index.d.mts +35 -0
  25. package/dist/modules/charts/index.mjs +43 -0
  26. package/dist/modules/charts/runtime/blokkli/skills/charts.d.ts +2 -0
  27. package/dist/modules/charts/runtime/blokkli/skills/charts.js +42 -0
  28. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.d.ts +63 -0
  29. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.js +98 -0
  30. package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.d.ts +2 -0
  31. package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.js +86 -0
  32. package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.d.ts +2 -0
  33. package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.js +74 -0
  34. package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.d.ts +2 -0
  35. package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.js +42 -0
  36. package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.d.ts +2 -0
  37. package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.js +101 -0
  38. package/dist/modules/charts/runtime/chartTypes/area.d.ts +2 -0
  39. package/dist/modules/charts/runtime/chartTypes/area.js +68 -0
  40. package/dist/modules/charts/runtime/chartTypes/bar.d.ts +2 -0
  41. package/dist/modules/charts/runtime/chartTypes/bar.js +76 -0
  42. package/dist/modules/charts/runtime/chartTypes/define.d.ts +2 -0
  43. package/dist/modules/charts/runtime/chartTypes/define.js +3 -0
  44. package/dist/modules/charts/runtime/chartTypes/donut.d.ts +2 -0
  45. package/dist/modules/charts/runtime/chartTypes/donut.js +45 -0
  46. package/dist/modules/charts/runtime/chartTypes/heatmap.d.ts +2 -0
  47. package/dist/modules/charts/runtime/chartTypes/heatmap.js +54 -0
  48. package/dist/modules/charts/runtime/chartTypes/index.d.ts +21 -0
  49. package/dist/modules/charts/runtime/chartTypes/index.js +47 -0
  50. package/dist/modules/charts/runtime/chartTypes/line.d.ts +2 -0
  51. package/dist/modules/charts/runtime/chartTypes/line.js +68 -0
  52. package/dist/modules/charts/runtime/chartTypes/pie.d.ts +2 -0
  53. package/dist/modules/charts/runtime/chartTypes/pie.js +28 -0
  54. package/dist/modules/charts/runtime/chartTypes/radar.d.ts +2 -0
  55. package/dist/modules/charts/runtime/chartTypes/radar.js +52 -0
  56. package/dist/modules/charts/runtime/chartTypes/radialBar.d.ts +2 -0
  57. package/dist/modules/charts/runtime/chartTypes/radialBar.js +44 -0
  58. package/dist/modules/charts/runtime/chartTypes/shared.d.ts +52 -0
  59. package/dist/modules/charts/runtime/chartTypes/shared.js +103 -0
  60. package/dist/modules/charts/runtime/chartTypes/types.d.ts +29 -0
  61. package/dist/modules/charts/runtime/chartTypes/types.js +0 -0
  62. package/dist/modules/charts/runtime/components/ChartRenderer/index.d.vue.ts +4 -0
  63. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +120 -0
  64. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue.d.ts +4 -0
  65. package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.d.vue.ts +3 -0
  66. package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.vue +29 -0
  67. package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.vue.d.ts +3 -0
  68. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.d.vue.ts +15 -0
  69. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue +97 -0
  70. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue.d.ts +15 -0
  71. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.d.vue.ts +11 -0
  72. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue +34 -0
  73. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue.d.ts +11 -0
  74. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.d.vue.ts +12 -0
  75. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +49 -0
  76. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue.d.ts +12 -0
  77. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.d.vue.ts +19 -0
  78. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue +90 -0
  79. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue.d.ts +19 -0
  80. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.d.vue.ts +23 -0
  81. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue +224 -0
  82. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue.d.ts +23 -0
  83. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.d.vue.ts +10 -0
  84. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue +61 -0
  85. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue.d.ts +10 -0
  86. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.d.vue.ts +8 -0
  87. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue +23 -0
  88. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue.d.ts +8 -0
  89. package/dist/modules/charts/runtime/features/charts/Editor/index.d.vue.ts +10 -0
  90. package/dist/modules/charts/runtime/features/charts/Editor/index.vue +243 -0
  91. package/dist/modules/charts/runtime/features/charts/Editor/index.vue.d.ts +10 -0
  92. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.d.ts +17 -0
  93. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.js +90 -0
  94. package/dist/modules/charts/runtime/features/charts/index.d.vue.ts +3 -0
  95. package/dist/modules/charts/runtime/features/charts/index.vue +72 -0
  96. package/dist/modules/charts/runtime/features/charts/index.vue.d.ts +3 -0
  97. package/dist/modules/charts/runtime/helpers/index.d.ts +1 -0
  98. package/dist/modules/charts/runtime/helpers/index.js +17 -0
  99. package/dist/modules/charts/runtime/types.d.ts +51 -0
  100. package/dist/modules/charts/runtime/types.js +64 -0
  101. package/dist/modules/drupal/graphql/features/fragments.graphql +2 -0
  102. package/dist/modules/drupal/index.d.mts +1 -1
  103. package/dist/modules/drupal/runtime/adapter/index.js +12 -8
  104. package/dist/modules/table-of-contents/index.d.mts +11 -0
  105. package/dist/modules/table-of-contents/index.mjs +24 -0
  106. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.d.vue.ts +44 -0
  107. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue +43 -0
  108. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue.d.ts +44 -0
  109. package/dist/modules/table-of-contents/runtime/types/index.d.ts +4 -0
  110. package/dist/modules/table-of-contents/runtime/types/index.js +0 -0
  111. package/dist/runtime/components/Blocks/Fragment/index.vue +6 -2
  112. package/dist/runtime/components/BlokkliItem.vue +8 -3
  113. package/dist/runtime/components/BlokkliProvider.d.vue.ts +7 -0
  114. package/dist/runtime/components/BlokkliProvider.vue +7 -1
  115. package/dist/runtime/components/BlokkliProvider.vue.d.ts +7 -0
  116. package/dist/runtime/composables/useBlokkliHelper.js +4 -2
  117. package/dist/runtime/editor/components/AnimationCanvas/index.vue +4 -20
  118. package/dist/runtime/editor/components/Banner/index.d.vue.ts +12 -2
  119. package/dist/runtime/editor/components/Banner/index.vue +4 -2
  120. package/dist/runtime/editor/components/Banner/index.vue.d.ts +12 -2
  121. package/dist/runtime/editor/components/Dropdown/index.d.vue.ts +27 -0
  122. package/dist/runtime/editor/components/Dropdown/index.vue +107 -0
  123. package/dist/runtime/editor/components/Dropdown/index.vue.d.ts +27 -0
  124. package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue +1 -1
  125. package/dist/runtime/editor/components/EditProvider.d.vue.ts +2 -0
  126. package/dist/runtime/editor/components/EditProvider.vue +4 -3
  127. package/dist/runtime/editor/components/EditProvider.vue.d.ts +2 -0
  128. package/dist/runtime/editor/components/Form/Radio/index.d.vue.ts +1 -0
  129. package/dist/runtime/editor/components/Form/Radio/index.vue +3 -2
  130. package/dist/runtime/editor/components/Form/Radio/index.vue.d.ts +1 -0
  131. package/dist/runtime/editor/components/ItemIcon/index.vue +10 -2
  132. package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +13 -3
  133. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +15 -7
  134. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +13 -3
  135. package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +2 -0
  136. package/dist/runtime/editor/components/PreviewProvider.vue +3 -2
  137. package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +2 -0
  138. package/dist/runtime/editor/components/ShortcutIndicator/index.vue +1 -1
  139. package/dist/runtime/editor/components/index.d.ts +3 -1
  140. package/dist/runtime/editor/components/index.js +4 -0
  141. package/dist/runtime/editor/composables/onElementResize.js +0 -1
  142. package/dist/runtime/editor/composables/useEditableFieldOverride.js +4 -5
  143. package/dist/runtime/editor/css/output.css +1 -1
  144. package/dist/runtime/editor/events/index.d.ts +7 -0
  145. package/dist/runtime/editor/features/add-list/Help/Item.vue +5 -2
  146. package/dist/runtime/editor/features/artboard/Renderer.vue +1 -1
  147. package/dist/runtime/editor/features/clipboard/index.vue +1 -1
  148. package/dist/runtime/editor/features/debug/index.vue +1 -1
  149. package/dist/runtime/editor/features/dev-mode/index.vue +86 -2
  150. package/dist/runtime/editor/features/edit/index.vue +20 -0
  151. package/dist/runtime/editor/features/fragments/types.d.ts +1 -0
  152. package/dist/runtime/editor/features/hover/Renderer/index.vue +30 -3
  153. package/dist/runtime/editor/features/hover/index.vue +1 -1
  154. package/dist/runtime/editor/features/options/Form/Checkbox/index.d.vue.ts +2 -2
  155. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue +3 -3
  156. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue.d.ts +2 -2
  157. package/dist/runtime/editor/features/options/Form/Checkboxes/index.d.vue.ts +2 -2
  158. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue +5 -5
  159. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue.d.ts +2 -2
  160. package/dist/runtime/editor/features/options/Form/Item.d.vue.ts +2 -2
  161. package/dist/runtime/editor/features/options/Form/Item.vue +14 -48
  162. package/dist/runtime/editor/features/options/Form/Item.vue.d.ts +2 -2
  163. package/dist/runtime/editor/features/options/Form/Number/index.d.vue.ts +3 -3
  164. package/dist/runtime/editor/features/options/Form/Number/index.vue +7 -17
  165. package/dist/runtime/editor/features/options/Form/Number/index.vue.d.ts +3 -3
  166. package/dist/runtime/editor/features/options/Form/Range/index.d.vue.ts +2 -2
  167. package/dist/runtime/editor/features/options/Form/Range/index.vue +4 -4
  168. package/dist/runtime/editor/features/options/Form/Range/index.vue.d.ts +2 -2
  169. package/dist/runtime/editor/features/options/Form/index.vue +10 -5
  170. package/dist/runtime/editor/features/selection/index.vue +2 -2
  171. package/dist/runtime/editor/features/transform/index.vue +1 -3
  172. package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +1 -1
  173. package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +1 -1
  174. package/dist/runtime/editor/providers/definition.d.ts +2 -2
  175. package/dist/runtime/editor/providers/definition.js +7 -1
  176. package/dist/runtime/editor/providers/dom.d.ts +5 -0
  177. package/dist/runtime/editor/providers/dom.js +11 -2
  178. package/dist/runtime/editor/providers/fields.d.ts +19 -1
  179. package/dist/runtime/editor/providers/fields.js +54 -2
  180. package/dist/runtime/editor/translations/de.json +269 -1
  181. package/dist/runtime/editor/translations/fr.json +269 -1
  182. package/dist/runtime/editor/translations/gsw_CH.json +269 -1
  183. package/dist/runtime/editor/translations/it.json +269 -1
  184. package/dist/runtime/helpers/imports/index.d.ts +8 -1
  185. package/dist/runtime/helpers/imports/index.js +15 -6
  186. package/dist/runtime/helpers/injections.d.ts +5 -1
  187. package/dist/runtime/helpers/injections.js +3 -0
  188. package/dist/runtime/helpers/runtimeHelpers/index.js +14 -0
  189. package/dist/runtime/types/definitions.d.ts +8 -5
  190. package/dist/runtime/types/provider.d.ts +2 -0
  191. package/dist/shared/editor.6D5vApr0.mjs +30 -0
  192. package/dist/shared/{editor.DMFfaLVE.mjs → editor.BFIzNSQM.mjs} +1 -30
  193. package/dist/shared/{editor.Iax3GCvt.d.mts → editor.CWQIFIEQ.d.mts} +22 -0
  194. package/dist/types.d.mts +1 -1
  195. package/package.json +17 -1
  196. package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.js +0 -104
  197. /package/dist/modules/agent/runtime/app/tools/{get_available_bundles → get_bundle_info}/index.d.ts +0 -0
  198. /package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.d.vue.ts +0 -0
  199. /package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue.d.ts +0 -0
@@ -241,6 +241,13 @@ export interface EventbusEvents {
241
241
  'view-option:toggle': {
242
242
  id: string;
243
243
  };
244
+ /**
245
+ * Emitted when editing a fragment provided by a feature.
246
+ */
247
+ 'fragment:edit': {
248
+ name: string;
249
+ uuid: string;
250
+ };
244
251
  }
245
252
  type EventbusEventsType = {
246
253
  [K in keyof EventbusEvents]: EventbusEvents[K];
@@ -73,12 +73,15 @@ onElementResize(el, (size) => {
73
73
  defineExpose({
74
74
  height
75
75
  });
76
- const { types, $t, definitions } = useBlokkli();
76
+ const { types, $t, definitions, dom } = useBlokkli();
77
77
  const reusableBlockTypes = computed(
78
78
  () => types.generallyAvailableBundles.filter((v) => v.allowReusable)
79
79
  );
80
80
  const fragments = computed(() => {
81
- return definitions.fragmentDefinitions.value.map((v) => {
81
+ const available = dom.generallyAvailableFragments.value;
82
+ return definitions.fragmentDefinitions.value.filter((definition) => {
83
+ return available.includes(definition.name);
84
+ }).map((v) => {
82
85
  return {
83
86
  bundle: fragmentBlockBundle,
84
87
  label: v.label,
@@ -253,7 +253,7 @@ const resetZoom = () => {
253
253
  animation.requestDraw();
254
254
  };
255
255
  onBlokkliEvent("keyPressed", (e) => {
256
- if (ui.hasDialogOpen.value) {
256
+ if (ui.hasDialogOpen.value || ui.hasNestedEditorOpen.value) {
257
257
  return;
258
258
  }
259
259
  if (e.code === "Home") {
@@ -538,7 +538,7 @@ function copyCurrentSelectionToClipboard() {
538
538
  selectionClipboard.value = selection.uuids.value;
539
539
  }
540
540
  onBlokkliEvent("keyPressed", (e) => {
541
- if (e.code !== "c" || !e.meta || ui.hasDialogOpen.value || !ui.canvasFocused.value) {
541
+ if (e.code !== "c" || !e.meta || ui.hasDialogOpen.value || ui.hasNestedEditorOpen.value || !ui.canvasFocused.value) {
542
542
  return;
543
543
  }
544
544
  copyCurrentSelectionToClipboard();
@@ -14,7 +14,7 @@ const { logger } = defineBlokkliFeature({
14
14
  });
15
15
  const { debug, ui } = useBlokkli();
16
16
  onBlokkliEvent("keyPressed", (e) => {
17
- if (ui.hasDialogOpen.value) {
17
+ if (ui.hasDialogOpen.value || ui.hasNestedEditorOpen.value) {
18
18
  return;
19
19
  }
20
20
  if (e.code === "=" && e.meta) {
@@ -9,12 +9,55 @@
9
9
  key-code="I"
10
10
  weight="-99999"
11
11
  />
12
+ <Teleport :to="ui.mainLayoutElement.value">
13
+ <div v-if="fieldMappingValidations.length" class="bk bk-dev-mode">
14
+ <div class="bk-dev-mode-inner">
15
+ <Banner
16
+ id="dev-mode"
17
+ icon="bk_mdi_logo_dev"
18
+ text="Invalid definitions found!"
19
+ scheme="red"
20
+ >
21
+ <div class="bk-dev-mode-banner">
22
+ <h3>Some block components are invalid:</h3>
23
+ <table>
24
+ <thead>
25
+ <tr>
26
+ <th>Bundle</th>
27
+ <th>Error</th>
28
+ </tr>
29
+ </thead>
30
+
31
+ <tbody>
32
+ <tr
33
+ v-for="(item, index) in fieldMappingValidations"
34
+ :key="index"
35
+ >
36
+ <td>{{ item.bundle }}</td>
37
+ <td v-html="item.validation" />
38
+ </tr>
39
+ </tbody>
40
+ </table>
41
+ </div>
42
+ </Banner>
43
+ </div>
44
+ </div>
45
+ </Teleport>
12
46
  </template>
13
47
 
14
48
  <script setup>
15
- import { useBlokkli, defineBlokkliFeature, ref } from "#imports";
49
+ import {
50
+ useBlokkli,
51
+ defineBlokkliFeature,
52
+ ref,
53
+ computed,
54
+ onMounted
55
+ } from "#imports";
16
56
  import { PluginViewOption } from "#blokkli/editor/plugins";
57
+ import { Banner } from "#blokkli/editor/components";
17
58
  import { addElementClasses } from "#blokkli/editor/composables";
59
+ import { falsy } from "#blokkli/helpers";
60
+ import { itemEntityType } from "#blokkli-build/config";
18
61
  defineBlokkliFeature({
19
62
  id: "dev-mode",
20
63
  label: "Dev Mode",
@@ -22,13 +65,54 @@ defineBlokkliFeature({
22
65
  description: "Feature enabled in development mode.",
23
66
  viewports: ["desktop"]
24
67
  });
25
- const { $t } = useBlokkli();
68
+ const { $t, types, definitions, ui } = useBlokkli();
26
69
  const isEnabled = ref(false);
70
+ const fieldMappingValidations = computed(() => {
71
+ return definitions.blockDefinitions.value.flatMap((definition) => {
72
+ if (definition.renderFor) {
73
+ return null;
74
+ }
75
+ const propsFieldMapping = definition.propsFieldMapping ?? {};
76
+ const bundle = definition.bundle;
77
+ const fields = new Set(
78
+ types.fieldConfig.forEntityTypeAndBundle(itemEntityType, bundle).map((field) => field.name)
79
+ );
80
+ const mappings = Object.entries(propsFieldMapping).map(([propName, mapping]) => {
81
+ if (mapping && mapping.type === "field") {
82
+ return {
83
+ propName,
84
+ fieldName: mapping.name
85
+ };
86
+ }
87
+ return null;
88
+ }).filter(falsy);
89
+ const invalidMappings = mappings.filter((mapping) => {
90
+ return !fields.has(mapping.fieldName);
91
+ }).map((mapping) => {
92
+ return {
93
+ bundle,
94
+ validation: `The props field mapping <code>'${mapping.propName}': '${mapping.fieldName}'</code> is invalid, because <strong>${bundle}</strong> has no field <strong>${mapping.fieldName}</strong>`
95
+ };
96
+ });
97
+ const missingMappings = [...fields.values()].filter((fieldName) => {
98
+ return !mappings.find((mapping) => mapping.fieldName === fieldName);
99
+ }).map((fieldName) => {
100
+ return {
101
+ bundle,
102
+ validation: `Missing props field mapping for field <strong>${fieldName}</strong>`
103
+ };
104
+ });
105
+ return [...invalidMappings, ...missingMappings];
106
+ }).filter(falsy);
107
+ });
27
108
  addElementClasses(
28
109
  document.documentElement,
29
110
  "bk-hide-interaction-layers",
30
111
  isEnabled
31
112
  );
113
+ onMounted(() => {
114
+ console.log(fieldMappingValidations.value);
115
+ });
32
116
  </script>
33
117
 
34
118
  <script>
@@ -16,6 +16,8 @@
16
16
  import { computed, useBlokkli, defineBlokkliFeature } from "#imports";
17
17
  import { PluginItemAction } from "#blokkli/editor/plugins";
18
18
  import { onBlokkliEvent } from "#blokkli/editor/composables";
19
+ import { featureFragmentNames } from "#blokkli-build/editor-config";
20
+ import { fragmentBlockBundle } from "#blokkli-build/config";
19
21
  defineBlokkliFeature({
20
22
  id: "edit",
21
23
  icon: "bk_mdi_edit",
@@ -27,11 +29,20 @@ const { eventBus, selection, state, $t, adapter, definitions, permissions } = us
27
29
  const userCanEditLibraryItems = computed(
28
30
  () => permissions.hasPermission("edit_library_item")
29
31
  );
32
+ function isFragment(item) {
33
+ return item.bundle === fragmentBlockBundle;
34
+ }
35
+ function isFeatureFragment(item) {
36
+ return !!item.fragment?.name && featureFragmentNames.includes(item.fragment.name);
37
+ }
30
38
  const canEdit = computed(() => {
31
39
  const item = selection.item.value;
32
40
  if (!item) {
33
41
  return false;
34
42
  }
43
+ if (isFragment(item)) {
44
+ return isFeatureFragment(item);
45
+ }
35
46
  const definition = definitions.getBlockDefinition(
36
47
  item.bundle,
37
48
  item.fieldListType,
@@ -66,6 +77,15 @@ function onClick(items) {
66
77
  });
67
78
  return;
68
79
  }
80
+ if (isFragment(item)) {
81
+ if (isFeatureFragment(item)) {
82
+ eventBus.emit("fragment:edit", {
83
+ uuid: item.uuid,
84
+ name: item.fragment.name
85
+ });
86
+ }
87
+ return;
88
+ }
69
89
  eventBus.emit("item:edit", {
70
90
  uuid: item.uuid,
71
91
  bundle: item.bundle
@@ -3,6 +3,7 @@ export type AdapterFragmentsAddBlock = {
3
3
  name: string;
4
4
  host: BlokkliItemHost;
5
5
  preceedingUuid: string | null;
6
+ options?: Record<string, string>;
6
7
  };
7
8
  declare module '#blokkli/editor/adapter' {
8
9
  interface BlokkliAdapter<T> {
@@ -15,7 +15,17 @@ import { RectangleBufferCollector } from "#blokkli/editor/helpers/webgl";
15
15
  import { isInsideRect } from "#blokkli/editor/helpers/geometry";
16
16
  import { toShaderColor } from "#blokkli/editor/helpers/color";
17
17
  import { defineRenderer, onBlokkliEvent } from "#blokkli/editor/composables";
18
- const { animation, theme, dom, selection, state, ui, directive, blocks } = useBlokkli();
18
+ const {
19
+ animation,
20
+ theme,
21
+ dom,
22
+ selection,
23
+ state,
24
+ ui,
25
+ directive,
26
+ blocks,
27
+ fields
28
+ } = useBlokkli();
19
29
  const MAX_RECTS = 11;
20
30
  function getDeepestUuid(uuids) {
21
31
  if (uuids.length === 0) {
@@ -29,6 +39,10 @@ function getDeepestUuid(uuids) {
29
39
  if (level > maxLevel) {
30
40
  maxLevel = level;
31
41
  deepestUuid = uuid;
42
+ } else if (level === maxLevel) {
43
+ if (fields.compareFieldPriority(uuid, deepestUuid) > 0) {
44
+ deepestUuid = uuid;
45
+ }
32
46
  }
33
47
  }
34
48
  return deepestUuid;
@@ -119,12 +133,22 @@ function updateHoverState(mouseX, mouseY, offset, scale, artboardSize) {
119
133
  ) || deepestUuid !== previousDeepestUuid;
120
134
  let hoveredEditableFieldRect = null;
121
135
  const editableRects = directive.getVisible("editable");
136
+ let fallbackEditableRect = null;
122
137
  for (let i = 0; i < editableRects.length; i++) {
123
138
  const editableRect = editableRects[i];
124
- if (isInsideRect(artboardMouseX, artboardMouseY, editableRect)) {
139
+ if (!isInsideRect(artboardMouseX, artboardMouseY, editableRect)) continue;
140
+ const key = editableRect.key;
141
+ const entityUuid = key.split(":")[2];
142
+ if (deepestUuid && entityUuid === deepestUuid) {
125
143
  hoveredEditableFieldRect = editableRect;
126
144
  break;
127
145
  }
146
+ if (!fallbackEditableRect && !hoveredUuids.includes(entityUuid)) {
147
+ fallbackEditableRect = editableRect;
148
+ }
149
+ }
150
+ if (!hoveredEditableFieldRect) {
151
+ hoveredEditableFieldRect = fallbackEditableRect;
128
152
  }
129
153
  if (!hoveredChanged) {
130
154
  const editableFieldChanged = hoveredEditableFieldRect === null !== (previousEditableFieldRect === null) || hoveredEditableFieldRect && previousEditableFieldRect && (hoveredEditableFieldRect.x !== previousEditableFieldRect.x || hoveredEditableFieldRect.y !== previousEditableFieldRect.y || hoveredEditableFieldRect.width !== previousEditableFieldRect.width || hoveredEditableFieldRect.height !== previousEditableFieldRect.height);
@@ -138,7 +162,10 @@ function updateHoverState(mouseX, mouseY, offset, scale, artboardSize) {
138
162
  for (let i = 0; i < unselectedHoveredUuids.length; i++) {
139
163
  const uuid = unselectedHoveredUuids[i];
140
164
  const level = Math.min(state.getNestingLevel(uuid), 9);
141
- if (!nestingMap.has(level)) {
165
+ const existing = nestingMap.get(level);
166
+ if (!existing) {
167
+ nestingMap.set(level, uuid);
168
+ } else if (fields.compareFieldPriority(uuid, existing) > 0) {
142
169
  nestingMap.set(level, uuid);
143
170
  }
144
171
  }
@@ -17,7 +17,7 @@ defineBlokkliFeature({
17
17
  const { selection, ui, dom, animation, $t } = useBlokkli();
18
18
  const isLocked = ref(false);
19
19
  const isVisible = computed(
20
- () => !isLocked.value && dom.isReady.value && !selection.isMultiSelecting.value && !selection.activeEditableLabel.value && !selection.isDragging.value && !ui.hasTransformOverlayOpen.value && !ui.hasDialogOpen.value && !ui.isAnimating.value
20
+ () => !isLocked.value && dom.isReady.value && !selection.isMultiSelecting.value && !selection.activeEditableLabel.value && !selection.isDragging.value && !ui.hasTransformOverlayOpen.value && !ui.hasDialogOpen.value && !ui.hasNestedEditorOpen.value && !ui.isAnimating.value
21
21
  );
22
22
  </script>
23
23
 
@@ -3,14 +3,14 @@ export default _default;
3
3
  declare const __VLS_export: import("vue").DefineComponent<{
4
4
  label: string;
5
5
  property: string;
6
- modelValue?: string;
6
+ modelValue?: boolean;
7
7
  required?: boolean;
8
8
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
9
  "update:modelValue": (...args: any[]) => void;
10
10
  }, string, import("vue").PublicProps, Readonly<{
11
11
  label: string;
12
12
  property: string;
13
- modelValue?: string;
13
+ modelValue?: boolean;
14
14
  required?: boolean;
15
15
  }> & Readonly<{
16
16
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -13,16 +13,16 @@ const { $t, state } = useBlokkli();
13
13
  const props = defineProps({
14
14
  label: { type: String, required: true },
15
15
  property: { type: String, required: true },
16
- modelValue: { type: String, required: false },
16
+ modelValue: { type: Boolean, required: false },
17
17
  required: { type: Boolean, required: false }
18
18
  });
19
19
  const emit = defineEmits(["update:modelValue"]);
20
20
  const checked = computed({
21
21
  get() {
22
- return props.modelValue === "1";
22
+ return props.modelValue ?? false;
23
23
  },
24
24
  set(v) {
25
- emit("update:modelValue", v ? "1" : "0");
25
+ emit("update:modelValue", v);
26
26
  }
27
27
  });
28
28
  defineCommands(() => {
@@ -3,14 +3,14 @@ export default _default;
3
3
  declare const __VLS_export: import("vue").DefineComponent<{
4
4
  label: string;
5
5
  property: string;
6
- modelValue?: string;
6
+ modelValue?: boolean;
7
7
  required?: boolean;
8
8
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
9
  "update:modelValue": (...args: any[]) => void;
10
10
  }, string, import("vue").PublicProps, Readonly<{
11
11
  label: string;
12
12
  property: string;
13
- modelValue?: string;
13
+ modelValue?: boolean;
14
14
  required?: boolean;
15
15
  }> & Readonly<{
16
16
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -3,7 +3,7 @@ export default _default;
3
3
  declare const __VLS_export: import("vue").DefineComponent<{
4
4
  label: string;
5
5
  property: string;
6
- modelValue?: string;
6
+ modelValue?: string[];
7
7
  options: {
8
8
  value: string;
9
9
  label: string;
@@ -14,7 +14,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
14
14
  }, string, import("vue").PublicProps, Readonly<{
15
15
  label: string;
16
16
  property: string;
17
- modelValue?: string;
17
+ modelValue?: string[];
18
18
  options: {
19
19
  value: string;
20
20
  label: string;
@@ -43,7 +43,7 @@ const { $t, state } = useBlokkli();
43
43
  const props = defineProps({
44
44
  label: { type: String, required: true },
45
45
  property: { type: String, required: true },
46
- modelValue: { type: String, required: false },
46
+ modelValue: { type: Array, required: false },
47
47
  options: { type: Array, required: true },
48
48
  isGrouped: { type: Boolean, required: false }
49
49
  });
@@ -52,13 +52,13 @@ const isOpen = ref(false);
52
52
  const optionOrder = computed(() => props.options.map((v) => v.value));
53
53
  const checked = computed({
54
54
  get() {
55
- return (props.modelValue || "").split(",").filter(Boolean);
55
+ return props.modelValue || [];
56
56
  },
57
57
  set(newValue) {
58
- const storedValue = newValue.filter(Boolean).sort((a, b) => {
58
+ const sorted = newValue.filter(Boolean).sort((a, b) => {
59
59
  return optionOrder.value.indexOf(a) - optionOrder.value.indexOf(b);
60
- }).join(",");
61
- emit("update:modelValue", storedValue);
60
+ });
61
+ emit("update:modelValue", sorted);
62
62
  }
63
63
  });
64
64
  const visibleLabel = computed(() => {
@@ -3,7 +3,7 @@ export default _default;
3
3
  declare const __VLS_export: import("vue").DefineComponent<{
4
4
  label: string;
5
5
  property: string;
6
- modelValue?: string;
6
+ modelValue?: string[];
7
7
  options: {
8
8
  value: string;
9
9
  label: string;
@@ -14,7 +14,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
14
14
  }, string, import("vue").PublicProps, Readonly<{
15
15
  label: string;
16
16
  property: string;
17
- modelValue?: string;
17
+ modelValue?: string[];
18
18
  options: {
19
19
  value: string;
20
20
  label: string;
@@ -6,9 +6,9 @@ type __VLS_Props = {
6
6
  isGrouped?: boolean;
7
7
  };
8
8
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
- update: (data: string) => any;
9
+ update: (data: unknown) => any;
10
10
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
- onUpdate?: ((data: string) => any) | undefined;
11
+ onUpdate?: ((data: unknown) => any) | undefined;
12
12
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
13
  declare const _default: typeof __VLS_export;
14
14
  export default _default;
@@ -88,10 +88,6 @@ import OptionColor from "./Color/index.vue";
88
88
  import OptionRange from "./Range/index.vue";
89
89
  import OptionNumber from "./Number/index.vue";
90
90
  import OptionDateTimeLocal from "./DateTimeLocal/index.vue";
91
- import {
92
- isValidDatetimeLocalValue,
93
- mapCheckboxTrue
94
- } from "#blokkli/helpers/runtimeHelpers";
95
91
  import { BK_VISIBLE_LANGUAGES } from "./../../../../../global/constants";
96
92
  const { state, $t: $blokkliText } = useBlokkli();
97
93
  const emit = defineEmits(["update"]);
@@ -113,12 +109,17 @@ const showLabel = computed(() => {
113
109
  const label = computed(
114
110
  () => $blokkliText(`blockOption_${props.property}_label`, props.option.label)
115
111
  );
116
- const description = computed(
117
- () => $blokkliText(
118
- `blockOption_${props.property}_description`,
119
- props.option.description
120
- )
121
- );
112
+ const description = computed(() => {
113
+ if (!props.option.description) {
114
+ return null;
115
+ }
116
+ const key = `blockOption_${props.property}_description`;
117
+ const translation = $blokkliText(key, props.option.description);
118
+ if (key === translation) {
119
+ return null;
120
+ }
121
+ return translation;
122
+ });
122
123
  const checkboxOptions = computed(() => {
123
124
  if (props.option.type !== "checkboxes") {
124
125
  return [];
@@ -140,47 +141,12 @@ const checkboxOptions = computed(() => {
140
141
  };
141
142
  });
142
143
  });
143
- const validCheckboxValues = computed(
144
- () => checkboxOptions.value.map((v) => v.value)
145
- );
146
- const validateValue = (v) => {
147
- if (props.option.type === "text") {
148
- if (typeof v === "string") {
149
- return v;
150
- }
151
- } else if (props.option.type === "datetime-local") {
152
- if (typeof v === "string" && isValidDatetimeLocalValue(v)) {
153
- return v;
154
- }
155
- } else if (props.option.type === "color") {
156
- if (typeof v === "string" && v.startsWith("#") && v.length === 7) {
157
- return v;
158
- }
159
- } else if (props.option.type === "radios" && typeof v === "string") {
160
- if (props.option.options[v]) {
161
- return v;
162
- }
163
- } else if (props.option.type === "checkbox") {
164
- return mapCheckboxTrue(v);
165
- } else if (props.option.type === "checkboxes") {
166
- const items = Array.isArray(v) ? v : (typeof v === "string" ? v : "").split(",");
167
- return items.filter((key) => {
168
- return validCheckboxValues.value.includes(key);
169
- }).join(",");
170
- } else if (props.option.type === "range" || props.option.type === "number") {
171
- if (typeof v === "number") {
172
- return v.toString();
173
- } else if (typeof v === "string") {
174
- return v;
175
- }
176
- }
177
- };
178
144
  const value = computed({
179
145
  get() {
180
- return validateValue(props.mutatedValue);
146
+ return props.mutatedValue;
181
147
  },
182
- set(value2) {
183
- emit("update", value2 === void 0 ? "" : value2);
148
+ set(v) {
149
+ emit("update", v);
184
150
  }
185
151
  });
186
152
  </script>
@@ -6,9 +6,9 @@ type __VLS_Props = {
6
6
  isGrouped?: boolean;
7
7
  };
8
8
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
- update: (data: string) => any;
9
+ update: (data: unknown) => any;
10
10
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
- onUpdate?: ((data: string) => any) | undefined;
11
+ onUpdate?: ((data: unknown) => any) | undefined;
12
12
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
13
  declare const _default: typeof __VLS_export;
14
14
  export default _default;
@@ -2,7 +2,7 @@ declare const _default: typeof __VLS_export;
2
2
  export default _default;
3
3
  declare const __VLS_export: import("vue").DefineComponent<{
4
4
  label: string;
5
- modelValue?: string;
5
+ modelValue?: number;
6
6
  min: number;
7
7
  max: number;
8
8
  type?: string;
@@ -10,7 +10,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
10
10
  "update:modelValue": (...args: any[]) => void;
11
11
  }, string, import("vue").PublicProps, Readonly<{
12
12
  label: string;
13
- modelValue?: string;
13
+ modelValue?: number;
14
14
  min: number;
15
15
  max: number;
16
16
  type?: string;
@@ -18,5 +18,5 @@ declare const __VLS_export: import("vue").DefineComponent<{
18
18
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
19
19
  }>, {
20
20
  type: string;
21
- modelValue: string;
21
+ modelValue: number;
22
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="bk-blokkli-item-options-number">
3
- <button :disabled="numeric <= min" @click.stop.prevent="decrement">
3
+ <button :disabled="modelValue <= min" @click.stop.prevent="decrement">
4
4
  <Icon name="bk_mdi_remove" />
5
5
  </button>
6
6
  <input
@@ -13,7 +13,7 @@
13
13
  }"
14
14
  />
15
15
 
16
- <button :disabled="numeric >= max" @click.stop.prevent="increment">
16
+ <button :disabled="modelValue >= max" @click.stop.prevent="increment">
17
17
  <Icon name="bk_mdi_add" />
18
18
  </button>
19
19
  </div>
@@ -24,7 +24,7 @@ import { computed } from "#imports";
24
24
  import { Icon } from "#blokkli/editor/components";
25
25
  const props = defineProps({
26
26
  label: { type: String, required: true },
27
- modelValue: { type: String, required: false, default: "0" },
27
+ modelValue: { type: Number, required: false, default: 0 },
28
28
  min: { type: Number, required: true },
29
29
  max: { type: Number, required: true },
30
30
  type: { type: String, required: false, default: "text" }
@@ -33,27 +33,17 @@ const width = computed(() => props.max.toString().length * 30);
33
33
  const emit = defineEmits(["update:modelValue"]);
34
34
  const text = computed({
35
35
  get() {
36
- return props.modelValue;
36
+ return String(props.modelValue);
37
37
  },
38
38
  set(v) {
39
- emit("update:modelValue", (v === void 0 ? "" : v).toString());
39
+ emit("update:modelValue", Number(v) || 0);
40
40
  }
41
41
  });
42
- const numeric = computed(() => {
43
- if (props.modelValue === void 0) {
44
- return 0;
45
- }
46
- const v = Number.parseInt(props.modelValue);
47
- if (Number.isNaN(v)) {
48
- return 0;
49
- }
50
- return v;
51
- });
52
42
  function increment() {
53
- text.value = (numeric.value + 1).toString();
43
+ emit("update:modelValue", props.modelValue + 1);
54
44
  }
55
45
  function decrement() {
56
- text.value = (numeric.value - 1).toString();
46
+ emit("update:modelValue", props.modelValue - 1);
57
47
  }
58
48
  </script>
59
49
 
@@ -2,7 +2,7 @@ declare const _default: typeof __VLS_export;
2
2
  export default _default;
3
3
  declare const __VLS_export: import("vue").DefineComponent<{
4
4
  label: string;
5
- modelValue?: string;
5
+ modelValue?: number;
6
6
  min: number;
7
7
  max: number;
8
8
  type?: string;
@@ -10,7 +10,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
10
10
  "update:modelValue": (...args: any[]) => void;
11
11
  }, string, import("vue").PublicProps, Readonly<{
12
12
  label: string;
13
- modelValue?: string;
13
+ modelValue?: number;
14
14
  min: number;
15
15
  max: number;
16
16
  type?: string;
@@ -18,5 +18,5 @@ declare const __VLS_export: import("vue").DefineComponent<{
18
18
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
19
19
  }>, {
20
20
  type: string;
21
- modelValue: string;
21
+ modelValue: number;
22
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -2,7 +2,7 @@ declare const _default: typeof __VLS_export;
2
2
  export default _default;
3
3
  declare const __VLS_export: import("vue").DefineComponent<{
4
4
  label: string;
5
- modelValue?: string;
5
+ modelValue?: number;
6
6
  min: number;
7
7
  max: number;
8
8
  step: number;
@@ -10,7 +10,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
10
10
  "update:modelValue": (...args: any[]) => void;
11
11
  }, string, import("vue").PublicProps, Readonly<{
12
12
  label: string;
13
- modelValue?: string;
13
+ modelValue?: number;
14
14
  min: number;
15
15
  max: number;
16
16
  step: number;