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

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 (320) hide show
  1. package/dist/global/types/blockOptions.d.ts +10 -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 +126 -7
  6. package/dist/modules/agent/index.d.mts +1 -1
  7. package/dist/modules/agent/index.mjs +273 -25
  8. package/dist/modules/agent/runtime/app/composables/agentProvider.d.ts +2 -2
  9. package/dist/modules/agent/runtime/app/composables/agentProvider.js +34 -17
  10. package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.d.ts +2 -20
  11. package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.js +0 -3
  12. package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Assistant/index.vue +2 -2
  13. package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/User/index.vue +1 -2
  14. package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.vue +1 -2
  15. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.d.vue.ts +1 -0
  16. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue +67 -86
  17. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue.d.ts +1 -0
  18. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/index.vue +10 -12
  19. package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/de.md +2 -2
  20. package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/en.md +2 -2
  21. package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue +1 -5
  22. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.d.vue.ts +8 -0
  23. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue +138 -0
  24. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue.d.ts +8 -0
  25. package/dist/modules/agent/runtime/app/features/agent/index.vue +94 -38
  26. package/dist/modules/agent/runtime/app/helpers/index.d.ts +16 -19
  27. package/dist/modules/agent/runtime/app/helpers/index.js +22 -46
  28. package/dist/modules/agent/runtime/app/helpers/pageStructure.js +1 -1
  29. package/dist/modules/agent/runtime/app/tools/add_content_search_paragraph/index.js +5 -9
  30. package/dist/modules/agent/runtime/app/tools/add_fragment/index.js +2 -6
  31. package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +2 -6
  32. package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +2 -3
  33. package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.js +2 -6
  34. package/dist/modules/agent/runtime/app/tools/add_template/index.js +2 -6
  35. package/dist/modules/agent/runtime/app/tools/analyze_content/index.js +120 -0
  36. package/dist/modules/agent/runtime/app/tools/check_readability/index.d.ts +2 -0
  37. package/dist/modules/agent/runtime/app/tools/check_readability/index.js +57 -0
  38. package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.js +2 -6
  39. package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.js +1 -1
  40. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.d.ts +2 -0
  41. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +176 -0
  42. package/dist/modules/agent/runtime/app/tools/get_content_fields/index.js +1 -1
  43. package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +7 -5
  44. package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.js +2 -1
  45. package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.js +2 -3
  46. package/dist/modules/agent/runtime/app/tools/helpers.d.ts +53 -0
  47. package/dist/modules/agent/runtime/app/tools/helpers.js +187 -0
  48. package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.js +2 -6
  49. package/dist/modules/agent/runtime/app/tools/schemas.d.ts +1 -44
  50. package/dist/modules/agent/runtime/app/tools/schemas.js +0 -174
  51. package/dist/modules/agent/runtime/app/tools/search_content/index.js +40 -47
  52. package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.js +2 -5
  53. package/dist/modules/agent/runtime/app/types/index.d.ts +0 -61
  54. package/dist/modules/agent/runtime/server/Session.d.ts +29 -8
  55. package/dist/modules/agent/runtime/server/Session.js +168 -85
  56. package/dist/modules/agent/runtime/server/SessionManager.d.ts +3 -0
  57. package/dist/modules/agent/runtime/server/SessionManager.js +4 -1
  58. package/dist/modules/agent/runtime/server/agent.js +3 -2
  59. package/dist/modules/agent/runtime/server/agentPrompt.d.ts +9 -1
  60. package/dist/modules/agent/runtime/server/agentPrompt.js +26 -0
  61. package/dist/modules/agent/runtime/server/default-skills/fixReadability.d.ts +2 -0
  62. package/dist/modules/agent/runtime/server/default-skills/fixReadability.js +69 -0
  63. package/dist/modules/agent/runtime/server/default-system-prompts/page-context.js +28 -0
  64. package/dist/modules/agent/runtime/server/server-tools/index.d.ts +10 -2
  65. package/dist/modules/agent/runtime/server/server-tools/index.js +1 -1
  66. package/dist/modules/agent/runtime/server/server-tools/load_tools/index.js +1 -1
  67. package/dist/modules/agent/runtime/shared/types.d.ts +81 -12
  68. package/dist/modules/agent/runtime/shared/types.js +22 -10
  69. package/dist/modules/charts/index.d.mts +35 -0
  70. package/dist/modules/charts/index.mjs +57 -0
  71. package/dist/modules/charts/runtime/blokkli/skills/charts.d.ts +2 -0
  72. package/dist/modules/charts/runtime/blokkli/skills/charts.js +42 -0
  73. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.d.ts +86 -0
  74. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.js +136 -0
  75. package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.d.ts +2 -0
  76. package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.js +93 -0
  77. package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.d.ts +2 -0
  78. package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.js +66 -0
  79. package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.d.ts +2 -0
  80. package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.js +40 -0
  81. package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.d.ts +2 -0
  82. package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.js +89 -0
  83. package/dist/modules/charts/runtime/chartTypes/area.d.ts +7 -0
  84. package/dist/modules/charts/runtime/chartTypes/area.js +68 -0
  85. package/dist/modules/charts/runtime/chartTypes/bar.d.ts +8 -0
  86. package/dist/modules/charts/runtime/chartTypes/bar.js +76 -0
  87. package/dist/modules/charts/runtime/chartTypes/define.d.ts +2 -0
  88. package/dist/modules/charts/runtime/chartTypes/define.js +3 -0
  89. package/dist/modules/charts/runtime/chartTypes/donut.d.ts +6 -0
  90. package/dist/modules/charts/runtime/chartTypes/donut.js +45 -0
  91. package/dist/modules/charts/runtime/chartTypes/heatmap.d.ts +4 -0
  92. package/dist/modules/charts/runtime/chartTypes/heatmap.js +54 -0
  93. package/dist/modules/charts/runtime/chartTypes/index.d.ts +39 -0
  94. package/dist/modules/charts/runtime/chartTypes/index.js +47 -0
  95. package/dist/modules/charts/runtime/chartTypes/line.d.ts +7 -0
  96. package/dist/modules/charts/runtime/chartTypes/line.js +68 -0
  97. package/dist/modules/charts/runtime/chartTypes/pie.d.ts +5 -0
  98. package/dist/modules/charts/runtime/chartTypes/pie.js +28 -0
  99. package/dist/modules/charts/runtime/chartTypes/radar.d.ts +7 -0
  100. package/dist/modules/charts/runtime/chartTypes/radar.js +52 -0
  101. package/dist/modules/charts/runtime/chartTypes/radialBar.d.ts +6 -0
  102. package/dist/modules/charts/runtime/chartTypes/radialBar.js +44 -0
  103. package/dist/modules/charts/runtime/chartTypes/shared.d.ts +67 -0
  104. package/dist/modules/charts/runtime/chartTypes/shared.js +103 -0
  105. package/dist/modules/charts/runtime/chartTypes/types.d.ts +29 -0
  106. package/dist/modules/charts/runtime/chartTypes/types.js +0 -0
  107. package/dist/modules/charts/runtime/components/ChartRenderer/index.d.vue.ts +147 -0
  108. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +120 -0
  109. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue.d.ts +147 -0
  110. package/dist/modules/charts/runtime/components/index.d.ts +1 -0
  111. package/dist/modules/charts/runtime/components/index.js +1 -0
  112. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.d.vue.ts +16 -0
  113. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue +97 -0
  114. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue.d.ts +16 -0
  115. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.d.vue.ts +11 -0
  116. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue +34 -0
  117. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue.d.ts +11 -0
  118. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.d.vue.ts +12 -0
  119. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +49 -0
  120. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue.d.ts +12 -0
  121. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.d.vue.ts +19 -0
  122. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue +89 -0
  123. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue.d.ts +19 -0
  124. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.d.vue.ts +23 -0
  125. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue +224 -0
  126. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue.d.ts +23 -0
  127. package/dist/{runtime/editor/features/clipboard/List → modules/charts/runtime/features/charts/Editor/FootnoteEditor}/index.d.vue.ts +4 -5
  128. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue +61 -0
  129. package/dist/{runtime/editor/features/clipboard/List → modules/charts/runtime/features/charts/Editor/FootnoteEditor}/index.vue.d.ts +4 -5
  130. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.d.vue.ts +10 -0
  131. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue +45 -0
  132. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue.d.ts +10 -0
  133. package/dist/modules/charts/runtime/features/charts/Editor/index.d.vue.ts +11 -0
  134. package/dist/modules/charts/runtime/features/charts/Editor/index.vue +249 -0
  135. package/dist/modules/charts/runtime/features/charts/Editor/index.vue.d.ts +11 -0
  136. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.d.ts +17 -0
  137. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.js +90 -0
  138. package/dist/modules/charts/runtime/features/charts/index.d.vue.ts +3 -0
  139. package/dist/modules/charts/runtime/features/charts/index.vue +72 -0
  140. package/dist/modules/charts/runtime/features/charts/index.vue.d.ts +3 -0
  141. package/dist/modules/charts/runtime/helpers/index.d.ts +26 -0
  142. package/dist/modules/charts/runtime/helpers/index.js +80 -0
  143. package/dist/modules/charts/runtime/types.d.ts +33 -0
  144. package/dist/modules/charts/runtime/types.js +0 -0
  145. package/dist/modules/drupal/graphql/features/fragments.graphql +2 -0
  146. package/dist/modules/drupal/index.d.mts +1 -1
  147. package/dist/modules/drupal/runtime/adapter/index.d.ts +3 -1
  148. package/dist/modules/drupal/runtime/adapter/index.js +16 -12
  149. package/dist/modules/table-of-contents/index.d.mts +11 -0
  150. package/dist/modules/table-of-contents/index.mjs +24 -0
  151. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.d.vue.ts +44 -0
  152. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue +43 -0
  153. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue.d.ts +44 -0
  154. package/dist/modules/table-of-contents/runtime/types/index.d.ts +4 -0
  155. package/dist/modules/table-of-contents/runtime/types/index.js +0 -0
  156. package/dist/runtime/components/Blocks/Fragment/index.vue +6 -2
  157. package/dist/runtime/components/BlokkliItem.vue +9 -4
  158. package/dist/runtime/components/BlokkliProvider.d.vue.ts +7 -0
  159. package/dist/runtime/components/BlokkliProvider.vue +7 -1
  160. package/dist/runtime/components/BlokkliProvider.vue.d.ts +7 -0
  161. package/dist/runtime/composables/defineBlokkli.js +1 -1
  162. package/dist/runtime/composables/useBlokkliHelper.js +4 -2
  163. package/dist/runtime/editor/components/AnimationCanvas/index.vue +17 -27
  164. package/dist/runtime/editor/components/Banner/index.d.vue.ts +13 -2
  165. package/dist/runtime/editor/components/Banner/index.vue +4 -2
  166. package/dist/runtime/editor/components/Banner/index.vue.d.ts +13 -2
  167. package/dist/runtime/editor/components/Dropdown/index.d.vue.ts +27 -0
  168. package/dist/runtime/editor/components/Dropdown/index.vue +107 -0
  169. package/dist/runtime/editor/components/Dropdown/index.vue.d.ts +27 -0
  170. package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.d.vue.ts +1 -0
  171. package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue +3 -2
  172. package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue.d.ts +1 -0
  173. package/dist/runtime/editor/components/EditProvider.d.vue.ts +2 -0
  174. package/dist/runtime/editor/components/EditProvider.vue +11 -7
  175. package/dist/runtime/editor/components/EditProvider.vue.d.ts +2 -0
  176. package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +5 -1
  177. package/dist/runtime/editor/components/FlexTextarea/index.vue +24 -101
  178. package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +5 -1
  179. package/dist/runtime/editor/components/Form/Radio/index.d.vue.ts +1 -0
  180. package/dist/runtime/editor/components/Form/Radio/index.vue +3 -2
  181. package/dist/runtime/editor/components/Form/Radio/index.vue.d.ts +1 -0
  182. package/dist/runtime/editor/components/ItemIcon/index.vue +10 -2
  183. package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +13 -3
  184. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +43 -16
  185. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +13 -3
  186. package/dist/runtime/editor/components/Popup/index.d.vue.ts +30 -0
  187. package/dist/runtime/editor/components/Popup/index.vue +82 -0
  188. package/dist/runtime/editor/components/Popup/index.vue.d.ts +30 -0
  189. package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +2 -0
  190. package/dist/runtime/editor/components/PreviewProvider.vue +3 -2
  191. package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +2 -0
  192. package/dist/runtime/editor/components/Resizable/index.vue +4 -1
  193. package/dist/runtime/editor/components/ShortcutIndicator/index.vue +1 -1
  194. package/dist/runtime/editor/components/Toolbar/index.vue +107 -6
  195. package/dist/runtime/editor/components/index.d.ts +4 -1
  196. package/dist/runtime/editor/components/index.js +6 -0
  197. package/dist/runtime/editor/composables/defineDropAreas.js +3 -3
  198. package/dist/runtime/editor/composables/defineDropHandler.d.ts +3 -0
  199. package/dist/runtime/editor/composables/defineDropHandler.js +10 -0
  200. package/dist/runtime/editor/composables/index.d.ts +1 -0
  201. package/dist/runtime/editor/composables/index.js +1 -0
  202. package/dist/runtime/editor/composables/onElementResize.js +0 -1
  203. package/dist/runtime/editor/composables/useEditableFieldOverride.js +4 -5
  204. package/dist/runtime/editor/css/output.css +1 -1
  205. package/dist/runtime/editor/events/index.d.ts +16 -0
  206. package/dist/runtime/editor/features/add-list/Help/Item.vue +5 -2
  207. package/dist/runtime/editor/features/add-list/index.vue +58 -1
  208. package/dist/runtime/editor/features/analyze/Main.d.vue.ts +3 -2
  209. package/dist/runtime/editor/features/analyze/Main.vue +28 -44
  210. package/dist/runtime/editor/features/analyze/Main.vue.d.ts +3 -2
  211. package/dist/runtime/editor/features/analyze/analyzers/readability.js +65 -0
  212. package/dist/runtime/editor/features/analyze/analyzers/types.d.ts +19 -0
  213. package/dist/runtime/editor/features/analyze/index.vue +18 -15
  214. package/dist/runtime/editor/features/artboard/Renderer.vue +1 -1
  215. package/dist/runtime/editor/features/clipboard/DropElement/Video.d.vue.ts +8 -0
  216. package/dist/runtime/editor/features/clipboard/{List/Item → DropElement}/Video.vue +1 -5
  217. package/dist/runtime/editor/features/clipboard/DropElement/Video.vue.d.ts +8 -0
  218. package/dist/runtime/editor/features/clipboard/DropElement/helpers.d.ts +1 -0
  219. package/dist/runtime/editor/features/clipboard/DropElement/helpers.js +14 -0
  220. package/dist/runtime/editor/features/clipboard/DropElement/index.d.vue.ts +16 -0
  221. package/dist/runtime/editor/features/clipboard/DropElement/index.vue +97 -0
  222. package/dist/runtime/editor/features/clipboard/DropElement/index.vue.d.ts +16 -0
  223. package/dist/runtime/editor/features/clipboard/helpers.d.ts +15 -0
  224. package/dist/runtime/editor/features/clipboard/helpers.js +62 -0
  225. package/dist/runtime/editor/features/clipboard/index.vue +586 -338
  226. package/dist/runtime/editor/features/clipboard/types.d.ts +14 -2
  227. package/dist/runtime/editor/features/debug/index.vue +1 -1
  228. package/dist/runtime/editor/features/dev-mode/index.vue +86 -2
  229. package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue +17 -5
  230. package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue +2 -2
  231. package/dist/runtime/editor/features/dragging-overlay/index.vue +125 -219
  232. package/dist/runtime/editor/features/edit/index.vue +20 -0
  233. package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue +4 -4
  234. package/dist/runtime/editor/features/editable-field/Overlay/index.vue +6 -0
  235. package/dist/runtime/editor/features/fragments/types.d.ts +1 -0
  236. package/dist/runtime/editor/features/hover/Renderer/index.vue +30 -3
  237. package/dist/runtime/editor/features/hover/index.vue +1 -1
  238. package/dist/runtime/editor/features/library/index.vue +14 -0
  239. package/dist/runtime/editor/features/media-library/index.vue +32 -1
  240. package/dist/runtime/editor/features/options/Form/Checkbox/index.d.vue.ts +2 -2
  241. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue +3 -3
  242. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue.d.ts +2 -2
  243. package/dist/runtime/editor/features/options/Form/Checkboxes/index.d.vue.ts +2 -2
  244. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue +5 -5
  245. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue.d.ts +2 -2
  246. package/dist/runtime/editor/features/options/Form/ComplexType/index.d.vue.ts +11 -0
  247. package/dist/runtime/editor/features/options/Form/ComplexType/index.vue +36 -0
  248. package/dist/runtime/editor/features/options/Form/ComplexType/index.vue.d.ts +11 -0
  249. package/dist/runtime/editor/features/options/Form/Item.d.vue.ts +5 -4
  250. package/dist/runtime/editor/features/options/Form/Item.vue +24 -50
  251. package/dist/runtime/editor/features/options/Form/Item.vue.d.ts +5 -4
  252. package/dist/runtime/editor/features/options/Form/Number/index.d.vue.ts +3 -3
  253. package/dist/runtime/editor/features/options/Form/Number/index.vue +7 -17
  254. package/dist/runtime/editor/features/options/Form/Number/index.vue.d.ts +3 -3
  255. package/dist/runtime/editor/features/options/Form/Range/index.d.vue.ts +2 -2
  256. package/dist/runtime/editor/features/options/Form/Range/index.vue +4 -4
  257. package/dist/runtime/editor/features/options/Form/Range/index.vue.d.ts +2 -2
  258. package/dist/runtime/editor/features/options/Form/index.vue +15 -5
  259. package/dist/runtime/editor/features/search/index.vue +25 -1
  260. package/dist/runtime/editor/features/selection/index.vue +2 -2
  261. package/dist/runtime/editor/features/structure/index.vue +25 -1
  262. package/dist/runtime/editor/features/tour/index.vue +22 -12
  263. package/dist/runtime/editor/features/transform/index.vue +1 -3
  264. package/dist/runtime/editor/helpers/clipboardData/index.d.ts +11 -0
  265. package/dist/runtime/editor/helpers/clipboardData/index.js +157 -0
  266. package/dist/runtime/editor/helpers/options/index.js +5 -0
  267. package/dist/runtime/editor/icons/svg/stars.svg +5 -1
  268. package/dist/runtime/editor/plugins/Sidebar/Detached/index.d.vue.ts +1 -1
  269. package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue.d.ts +1 -1
  270. package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +15 -4
  271. package/dist/runtime/editor/plugins/Sidebar/index.vue +4 -2
  272. package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +15 -4
  273. package/dist/runtime/editor/providers/analyze.d.ts +43 -0
  274. package/dist/runtime/editor/providers/analyze.js +78 -0
  275. package/dist/runtime/editor/providers/animation.d.ts +4 -0
  276. package/dist/runtime/editor/providers/animation.js +6 -0
  277. package/dist/runtime/editor/providers/definition.d.ts +2 -2
  278. package/dist/runtime/editor/providers/definition.js +7 -1
  279. package/dist/runtime/editor/providers/dom.d.ts +5 -0
  280. package/dist/runtime/editor/providers/dom.js +11 -2
  281. package/dist/runtime/editor/providers/dragdrop.d.ts +55 -0
  282. package/dist/runtime/editor/providers/dragdrop.js +37 -0
  283. package/dist/runtime/editor/providers/fields.d.ts +19 -1
  284. package/dist/runtime/editor/providers/fields.js +54 -2
  285. package/dist/runtime/editor/providers/storage.js +15 -0
  286. package/dist/runtime/editor/providers/ui.d.ts +6 -0
  287. package/dist/runtime/editor/providers/ui.js +19 -0
  288. package/dist/runtime/editor/translations/de.json +338 -58
  289. package/dist/runtime/editor/translations/fr.json +331 -51
  290. package/dist/runtime/editor/translations/gsw_CH.json +336 -56
  291. package/dist/runtime/editor/translations/it.json +331 -51
  292. package/dist/runtime/editor/types/app.d.ts +4 -2
  293. package/dist/runtime/editor/types/draggable.d.ts +1 -0
  294. package/dist/runtime/editor/types/ui.d.ts +1 -1
  295. package/dist/runtime/helpers/imports/index.d.ts +8 -1
  296. package/dist/runtime/helpers/imports/index.js +15 -6
  297. package/dist/runtime/helpers/injections.d.ts +6 -2
  298. package/dist/runtime/helpers/injections.js +3 -0
  299. package/dist/runtime/helpers/runtimeHelpers/index.js +14 -0
  300. package/dist/runtime/types/blockOptions.d.ts +2 -1
  301. package/dist/runtime/types/definitions.d.ts +12 -5
  302. package/dist/runtime/types/provider.d.ts +2 -0
  303. package/dist/shared/editor.6D5vApr0.mjs +30 -0
  304. package/dist/shared/{editor.DMFfaLVE.mjs → editor.BFIzNSQM.mjs} +1 -30
  305. package/dist/shared/{editor.Iax3GCvt.d.mts → editor.BdBm1Z7C.d.mts} +34 -0
  306. package/dist/types.d.mts +1 -1
  307. package/package.json +21 -3
  308. package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.js +0 -104
  309. package/dist/runtime/editor/features/clipboard/List/Item/File.d.vue.ts +0 -4
  310. package/dist/runtime/editor/features/clipboard/List/Item/File.vue +0 -60
  311. package/dist/runtime/editor/features/clipboard/List/Item/File.vue.d.ts +0 -4
  312. package/dist/runtime/editor/features/clipboard/List/Item/Video.d.vue.ts +0 -4
  313. package/dist/runtime/editor/features/clipboard/List/Item/Video.vue.d.ts +0 -4
  314. package/dist/runtime/editor/features/clipboard/List/index.vue +0 -72
  315. package/dist/runtime/editor/features/tour/Popup/index.d.vue.ts +0 -9
  316. package/dist/runtime/editor/features/tour/Popup/index.vue +0 -34
  317. package/dist/runtime/editor/features/tour/Popup/index.vue.d.ts +0 -9
  318. package/dist/runtime/editor/providers/dropArea.d.ts +0 -48
  319. package/dist/runtime/editor/providers/dropArea.js +0 -22
  320. /package/dist/modules/agent/runtime/app/tools/{get_available_bundles → analyze_content}/index.d.ts +0 -0
@@ -67,7 +67,11 @@ export type ClipboardMapBundleEventVideo = {
67
67
  videoService: ReturnType<typeof getVideoId>['service'];
68
68
  videoId: string;
69
69
  };
70
- export type ClipboardMapBundleEvent = ClipboardMapBundleEventVideo | ClipboardMapBundleEventImage | ClipboardMapBundleEventFile | ClipboardMapBundleEventPlaintext;
70
+ export type ClipboardMapBundleEventLink = {
71
+ type: 'link';
72
+ url: string;
73
+ };
74
+ export type ClipboardMapBundleEvent = ClipboardMapBundleEventVideo | ClipboardMapBundleEventImage | ClipboardMapBundleEventFile | ClipboardMapBundleEventPlaintext | ClipboardMapBundleEventLink;
71
75
  export interface DraggableClipboardItem {
72
76
  itemType: 'clipboard';
73
77
  element: () => HTMLElement;
@@ -75,12 +79,19 @@ export interface DraggableClipboardItem {
75
79
  additional?: string;
76
80
  clipboardId: string;
77
81
  }
82
+ export interface DraggableNativeDropItem {
83
+ itemType: 'native_drop';
84
+ element: () => HTMLElement;
85
+ itemBundles: string[];
86
+ dataTransfer: DataTransfer | null;
87
+ clipboardItems?: BlokkliClipboardItem[];
88
+ }
78
89
  declare module '#blokkli/editor/adapter' {
79
90
  interface BlokkliAdapter<T> {
80
91
  /**
81
92
  * Determine the block bundle for the given clipboard item.
82
93
  */
83
- clipboardMapBundle?(e: ClipboardMapBundleEvent): string | undefined | null;
94
+ clipboardMapBundle?(e: ClipboardMapBundleEvent): string | string[] | undefined | null;
84
95
  /**
85
96
  * Add a clipboard item.
86
97
  */
@@ -94,6 +105,7 @@ declare module '#blokkli/editor/adapter' {
94
105
  declare module '#blokkli/editor/types/draggable' {
95
106
  interface DraggableItemTypes {
96
107
  clipboard: DraggableClipboardItem;
108
+ native_drop: DraggableNativeDropItem;
97
109
  }
98
110
  }
99
111
  export {};
@@ -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>
@@ -48,7 +48,7 @@ const props = defineProps({
48
48
  activeLabel: { type: String, required: false }
49
49
  });
50
50
  const MAX_WIDTH = 350;
51
- const MAX_HEIGHT = 150;
51
+ const MAX_HEIGHT = 200;
52
52
  const labelEl = useTemplateRef("labelEl");
53
53
  const labelWidth = ref(0);
54
54
  const labelHeight = ref(0);
@@ -186,14 +186,23 @@ onMounted(() => {
186
186
  if (!boundRect) {
187
187
  return;
188
188
  }
189
+ const mouseInsideBound = isInsideRect(
190
+ props.startCoords.x,
191
+ props.startCoords.y,
192
+ boundRect.rect
193
+ );
189
194
  const bounds = getDraggingBounds(
190
195
  props.startCoords,
191
196
  boundRect.rect,
192
197
  MAX_WIDTH,
193
198
  MAX_HEIGHT
194
199
  );
195
- const boundsX = props.isTouch ? 0 : bounds.x;
196
- const boundsY = props.isTouch ? translateY.value : bounds.y;
200
+ let boundsX = props.isTouch ? 0 : bounds.x;
201
+ let boundsY = props.isTouch ? translateY.value : bounds.y;
202
+ if (!mouseInsideBound && !props.isTouch) {
203
+ boundsX = props.startCoords.x - bounds.width / 2;
204
+ boundsY = props.startCoords.y - bounds.height / 2;
205
+ }
197
206
  offsetX.value = props.startCoords.x - boundsX;
198
207
  offsetY.value = props.startCoords.y - boundsY;
199
208
  width.value = bounds.width;
@@ -245,14 +254,14 @@ onMounted(() => {
245
254
  const borderRadius = isTop ? theme.getDraggableStyle(item.element).radiusMin : 4;
246
255
  return {
247
256
  isTop,
248
- from: ui.lowPerformanceMode.value ? to : from,
257
+ from: ui.lowPerformanceMode.value || !mouseInsideBound ? to : from,
249
258
  to,
250
259
  width: item.element.offsetWidth,
251
260
  height: item.element.offsetHeight,
252
261
  transformOrigin: `${originX}px ${originY}px`,
253
262
  markup,
254
263
  background: item.item.itemType === "existing" ? realBackgroundColor(item.element) : "",
255
- prevVisibility: item.item.itemType === "existing" || item.item.itemType === "existing_structure" ? item.element.style.visibility : void 0,
264
+ prevVisibility: item.item.itemType === "existing" && !item.item.isCopy || item.item.itemType === "existing_structure" ? item.element.style.visibility : void 0,
256
265
  element: item.element,
257
266
  bundle,
258
267
  label,
@@ -261,6 +270,9 @@ onMounted(() => {
261
270
  }).filter(falsy);
262
271
  elRects.forEach((item) => {
263
272
  if (item.item.itemType === "existing" || item.item.itemType === "existing_structure") {
273
+ if (item.item.itemType === "existing" && item.item.isCopy) {
274
+ return;
275
+ }
264
276
  item.element.style.visibility = "hidden";
265
277
  }
266
278
  });
@@ -48,7 +48,7 @@ const {
48
48
  dom,
49
49
  ui,
50
50
  theme,
51
- dropAreas,
51
+ dragdrop,
52
52
  eventBus,
53
53
  animation,
54
54
  state,
@@ -78,7 +78,7 @@ const cursorIsInsideClipped = () => isInsideRect(props.mouseX, props.mouseY, ui.
78
78
  );
79
79
  const active = ref(null);
80
80
  defineEmits(["drop"]);
81
- const areas = dropAreas.getDropAreas(props.items).reduce((acc, v) => {
81
+ const areas = dragdrop.getDropAreas(props.items).reduce((acc, v) => {
82
82
  acc[v.id] = v;
83
83
  return acc;
84
84
  }, {});
@@ -50,7 +50,8 @@ import {
50
50
  } from "#imports";
51
51
  import { renderCycle } from "#blokkli/editor/helpers/vue";
52
52
  import { BundleSelector, BlokkliTransition } from "#blokkli/editor/components";
53
- import { onBlokkliEvent } from "#blokkli/editor/composables";
53
+ import { onBlokkliEvent, defineDropHandler } from "#blokkli/editor/composables";
54
+ import { MOUSE_BUTTON } from "#blokkli/editor/helpers/dom";
54
55
  const { adapter } = defineBlokkliFeature({
55
56
  icon: "bk_mdi_drag_pan",
56
57
  id: "dragging-overlay",
@@ -69,37 +70,33 @@ const {
69
70
  blocks,
70
71
  directive,
71
72
  fields,
72
- $t
73
+ $t,
74
+ dragdrop
73
75
  } = useBlokkli();
74
76
  const bundleSelectorData = ref(null);
77
+ let bundleSelectorResolve = null;
78
+ function showBundleSelector(bundles) {
79
+ return new Promise((resolve) => {
80
+ bundleSelectorResolve = resolve;
81
+ bundleSelectorData.value = {
82
+ bundles,
83
+ anchorCoordinates: getAnchorCoordinates()
84
+ };
85
+ });
86
+ }
75
87
  function onCloseBundleSelector() {
76
88
  bundleSelectorData.value = null;
77
- }
78
- async function onSelectBundle(bundle) {
79
- const data = bundleSelectorData.value;
80
- if (!data) {
81
- return;
89
+ if (bundleSelectorResolve) {
90
+ bundleSelectorResolve(null);
91
+ bundleSelectorResolve = null;
82
92
  }
83
- const item = data.item;
84
- if (Array.isArray(item)) {
85
- await onDropMediaLibraryItem(
86
- data.field,
87
- item,
88
- data.host,
89
- data.afterUuid,
90
- bundle
91
- );
92
- } else {
93
- await state.mutateWithLoadingState(
94
- () => adapter.addContentSearchItem({
95
- item: item.searchItem,
96
- host: data.host,
97
- bundle,
98
- afterUuid: data.afterUuid
99
- })
100
- );
93
+ }
94
+ function onSelectBundle(bundle) {
95
+ bundleSelectorData.value = null;
96
+ if (bundleSelectorResolve) {
97
+ bundleSelectorResolve(bundle);
98
+ bundleSelectorResolve = null;
101
99
  }
102
- onCloseBundleSelector();
103
100
  }
104
101
  const dragItemsComponent = useTemplateRef("dragItemsComponent");
105
102
  const isVisible = ref(false);
@@ -117,209 +114,90 @@ const box = ref({
117
114
  height: 10
118
115
  });
119
116
  const dragItems = ref([]);
120
- function isSameItemType(items) {
121
- return items.every((item) => item.itemType === items[0].itemType);
122
- }
123
- function filterItemType(items) {
124
- if (!items.length) {
125
- throw new Error("Items array is empty");
126
- }
127
- if (!isSameItemType(items)) {
128
- throw new Error("Items of different types");
129
- }
130
- const itemType = items[0].itemType;
131
- if (itemType === "existing" || itemType === "existing_structure" || itemType === "media_library") {
132
- return { itemType, items };
133
- }
134
- if (items.length > 1) {
135
- throw new Error(`Only a single item of type '${itemType}' is allowed.`);
136
- }
137
- return { itemType, item: items[0] };
138
- }
139
- const onDropNew = async (bundle, host, afterUuid) => {
140
- const field = fields.find(host.uuid, host.fieldName);
141
- if (!field) {
142
- throw new Error(
143
- `Failed to locate field with name "${host.fieldName}" on UUID "${host.uuid}"`
144
- );
145
- }
146
- const definition = definitions.getBlockDefinition(
147
- bundle,
148
- field.fieldListType,
149
- field.hostEntityBundle
150
- );
151
- const addBehaviour = definition?.editor?.addBehaviour || "form";
152
- if (definition?.editor?.disableEdit || addBehaviour === "no-form" || addBehaviour.startsWith("editable:") || !adapter.formFrameBuilder) {
153
- await state.mutateWithLoadingState(
154
- () => adapter.addNewBlock({
155
- bundle,
156
- host,
157
- afterUuid
158
- })
159
- );
160
- } else {
161
- eventBus.emit("add:block:new", {
162
- bundle,
163
- host,
164
- afterUuid
165
- });
166
- }
167
- };
168
- const onDropExisting = async (items, host, afterUuid) => {
169
- const uuids = items.map((v) => v.block.uuid);
170
- await state.mutateWithLoadingState(
171
- () => adapter.moveMultipleBlocks({
172
- uuids,
173
- afterUuid,
174
- host
175
- })
176
- );
177
- if (uuids.length >= 1 && uuids.length <= 10) {
178
- for (let i = 0; i < uuids.length; i++) {
179
- dom.refreshBlockRect(uuids[i]);
180
- }
181
- }
182
- if (ui.isMobile.value && uuids.length) {
183
- eventBus.emit("scrollIntoView", {
184
- uuid: uuids[0],
185
- center: true
186
- });
187
- }
188
- };
189
- const onDropReusable = async (item, host, afterUuid) => {
190
- if (adapter.addLibraryItem) {
191
- await state.mutateWithLoadingState(
192
- () => adapter.addLibraryItem({
193
- libraryItemUuid: item.libraryItemUuid,
194
- host,
195
- afterUuid
196
- })
197
- );
198
- }
199
- };
200
- const onDropClipboardItem = async (item, host, afterUuid) => {
201
- eventBus.emit("drop:clipboardItem", {
202
- id: item.clipboardId,
203
- host,
204
- blockBundle: item.itemBundle,
205
- afterUuid
206
- });
207
- };
208
- const onDropMediaLibraryItem = async (field, items, host, afterUuid, bundle) => {
209
- const allSameBundles = [...new Set(items.map((v) => v.mediaBundle)).values()].length === 1;
210
- if (!allSameBundles) {
211
- throw new Error(
212
- "Multi select of media library items of different bundles is not supported."
213
- );
214
- }
215
- let targetBundle = bundle;
216
- if (targetBundle === null) {
217
- const item = items[0];
218
- const allowedBundles = field.allowedBundles;
219
- const possibleBundles = allowedBundles.filter(
220
- (bundle2) => item.itemBundles.includes(bundle2)
221
- );
222
- if (possibleBundles.length === 0) {
223
- throw new Error("This search item can not be placed here.");
224
- } else if (possibleBundles.length === 1) {
225
- targetBundle = possibleBundles[0];
226
- } else {
227
- bundleSelectorData.value = {
228
- bundles: possibleBundles,
229
- anchorCoordinates: getAnchorCoordinates(),
230
- item: items,
231
- host,
232
- afterUuid,
233
- field
234
- };
235
- return;
236
- }
237
- }
238
- if (adapter.mediaLibraryAddBlock && items.length === 1) {
239
- await state.mutateWithLoadingState(
240
- () => adapter.mediaLibraryAddBlock({
241
- preceedingUuid: afterUuid,
242
- host,
243
- item: items[0],
244
- targetBundle
245
- })
246
- );
247
- } else if (adapter.mediaLibraryAddBlocks && items.length > 1) {
248
- await state.mutateWithLoadingState(
249
- () => adapter.mediaLibraryAddBlocks({
250
- preceedingUuid: afterUuid,
251
- host,
252
- items,
253
- targetBundle
254
- })
255
- );
256
- }
257
- };
258
117
  function getAnchorCoordinates() {
259
118
  return ui.toArtboardCoords({
260
119
  x: mouseX.value,
261
120
  y: mouseY.value
262
121
  });
263
122
  }
264
- const onDropSearchContentItem = async (field, item, host, afterUuid) => {
265
- if (!adapter.addContentSearchItem) {
266
- throw new Error('Adapter does not implement "addContentSearchItem".');
267
- }
268
- const allowedBundles = field.allowedBundles;
269
- const possibleBundles = allowedBundles.filter(
270
- (bundle) => item.itemBundles.includes(bundle)
271
- );
272
- if (possibleBundles.length === 0) {
273
- throw new Error("This search item can not be placed here.");
274
- } else if (possibleBundles.length === 1) {
275
- await state.mutateWithLoadingState(
276
- () => adapter.addContentSearchItem({
277
- item: item.searchItem,
278
- host,
279
- bundle: possibleBundles[0],
280
- afterUuid
281
- })
282
- );
283
- } else {
284
- bundleSelectorData.value = {
285
- bundles: possibleBundles,
286
- anchorCoordinates: getAnchorCoordinates(),
287
- field,
288
- item,
289
- host,
290
- afterUuid
291
- };
123
+ defineDropHandler("existing", {
124
+ async execute({ items, host, afterUuid }) {
125
+ const uuids = items.map((v) => v.block.uuid);
126
+ const isCopy = items.some((v) => v.isCopy);
127
+ if (isCopy && adapter.pasteExistingBlocks) {
128
+ await state.mutateWithLoadingState(
129
+ () => adapter.pasteExistingBlocks({
130
+ uuids,
131
+ host: {
132
+ type: host.type,
133
+ uuid: host.uuid,
134
+ fieldName: host.fieldName
135
+ },
136
+ preceedingUuid: afterUuid
137
+ })
138
+ );
139
+ } else {
140
+ await state.mutateWithLoadingState(
141
+ () => adapter.moveMultipleBlocks({
142
+ uuids,
143
+ afterUuid,
144
+ host
145
+ })
146
+ );
147
+ }
148
+ if (uuids.length >= 1 && uuids.length <= 10) {
149
+ for (let i = 0; i < uuids.length; i++) {
150
+ dom.refreshBlockRect(uuids[i]);
151
+ }
152
+ }
153
+ if (ui.isMobile.value && uuids.length) {
154
+ eventBus.emit("scrollIntoView", {
155
+ uuid: uuids[0],
156
+ center: true
157
+ });
158
+ }
292
159
  }
293
- };
294
- const onDropAction = (action, host, field, afterUuid) => {
295
- action.action.callback({
296
- preceedingUuid: afterUuid,
297
- host,
298
- field
299
- });
300
- };
160
+ });
301
161
  let allUuidsBefore = [];
162
+ let lastDropResult = null;
302
163
  const onDrop = async (e) => {
303
164
  allUuidsBefore = state.getAllUuids();
304
165
  await nextTick(async () => {
305
- const afterUuid = e.preceedingUuid ?? null;
306
- const host = e.host;
307
- const typed = filterItemType(e.items);
308
- if (typed.itemType === "existing" || typed.itemType === "existing_structure") {
309
- await onDropExisting(typed.items, host, afterUuid);
310
- } else if (typed.itemType === "new") {
311
- await onDropNew(typed.item.itemBundle, host, afterUuid);
312
- } else if (typed.itemType === "reusable") {
313
- await onDropReusable(typed.item, host, afterUuid);
314
- } else if (typed.itemType === "clipboard") {
315
- await onDropClipboardItem(typed.item, host, afterUuid);
316
- } else if (typed.itemType === "search_content") {
317
- await onDropSearchContentItem(e.field, typed.item, host, afterUuid);
318
- } else if (typed.itemType === "action") {
319
- onDropAction(typed.item, host, e.field, afterUuid);
320
- } else if (typed.itemType === "media_library") {
321
- await onDropMediaLibraryItem(e.field, typed.items, host, afterUuid, null);
166
+ const itemType = e.items[0]?.itemType;
167
+ if (!itemType) {
168
+ return;
169
+ }
170
+ const handler = dragdrop.getDropHandler(itemType);
171
+ if (!handler) {
172
+ return;
173
+ }
174
+ const baseCtx = {
175
+ items: e.items,
176
+ field: e.field,
177
+ host: e.host,
178
+ afterUuid: e.preceedingUuid ?? null
179
+ };
180
+ let result;
181
+ if (handler.resolveBundles) {
182
+ const bundles = await handler.resolveBundles(baseCtx);
183
+ if (bundles.length === 0) {
184
+ return;
185
+ }
186
+ let bundle;
187
+ if (bundles.length === 1) {
188
+ bundle = bundles[0];
189
+ } else {
190
+ const selected = await showBundleSelector(bundles);
191
+ if (!selected) {
192
+ return;
193
+ }
194
+ bundle = selected;
195
+ }
196
+ result = await handler.execute({ ...baseCtx, bundle }) || void 0;
197
+ } else {
198
+ result = await handler.execute({ ...baseCtx, bundle: "" }) || void 0;
322
199
  }
200
+ lastDropResult = result ?? null;
323
201
  eventBus.emit("dragging:end");
324
202
  eventBus.emit("item:dropped");
325
203
  });
@@ -332,7 +210,9 @@ onBlokkliEvent("state:reloaded", async function() {
332
210
  }
333
211
  const allUuidsAfter = state.getAllUuids();
334
212
  const newUuid = allUuidsAfter.find((uuid) => !allUuidsBefore.includes(uuid));
213
+ const dropResult = lastDropResult;
335
214
  allUuidsBefore = [];
215
+ lastDropResult = null;
336
216
  if (!newUuid) {
337
217
  return;
338
218
  }
@@ -344,6 +224,9 @@ onBlokkliEvent("state:reloaded", async function() {
344
224
  }
345
225
  const allSelected = [...selection.uuids.value, newBlock.uuid];
346
226
  eventBus.emit("select", allSelected);
227
+ if (!dropResult?.focusEditable) {
228
+ return;
229
+ }
347
230
  const definition = definitions.getBlockDefinition(
348
231
  newBlock.bundle,
349
232
  newBlock.fieldListType
@@ -364,6 +247,10 @@ onBlokkliEvent("state:reloaded", async function() {
364
247
  uuid: newUuid
365
248
  });
366
249
  });
250
+ onBlokkliEvent("dragging:move", (e) => {
251
+ mouseX.value = e.x;
252
+ mouseY.value = e.y;
253
+ });
367
254
  onBlokkliEvent("dragging:drop", onDrop);
368
255
  function loop() {
369
256
  if (!isVisible.value) {
@@ -375,6 +262,9 @@ function loop() {
375
262
  box.value = dragItemsComponent.value.getRect();
376
263
  }
377
264
  const onMouseUp = (e) => {
265
+ if (e.button === MOUSE_BUTTON.AUXILIARY) {
266
+ return;
267
+ }
378
268
  e.preventDefault();
379
269
  e.stopPropagation();
380
270
  if (!ui.isMobile.value) {
@@ -422,9 +312,25 @@ onBlokkliEvent("keyPressed", (e) => {
422
312
  eventBus.emit("dragging:end");
423
313
  }
424
314
  });
425
- onBlokkliEvent("block:append", (e) => {
315
+ onBlokkliEvent("block:append", async (e) => {
426
316
  allUuidsBefore = state.getAllUuids();
427
- onDropNew(e.bundle, e.host, e.afterUuid);
317
+ const handler = dragdrop.getDropHandler("new");
318
+ if (handler) {
319
+ const result = await handler.execute({
320
+ items: [
321
+ {
322
+ itemType: "new",
323
+ itemBundle: e.bundle,
324
+ element: () => document.createElement("div")
325
+ }
326
+ ],
327
+ field: fields.find(e.host.uuid, e.host.fieldName),
328
+ host: e.host,
329
+ afterUuid: e.afterUuid,
330
+ bundle: e.bundle
331
+ });
332
+ lastDropResult = result ?? null;
333
+ }
428
334
  });
429
335
  onUnmounted(() => {
430
336
  document.removeEventListener("pointerup", onMouseUp);