@blokkli/editor 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/dist/module.cjs +5 -0
  4. package/dist/module.d.mts +129 -0
  5. package/dist/module.d.ts +129 -0
  6. package/dist/module.json +12 -0
  7. package/dist/module.mjs +5430 -0
  8. package/dist/runtime/adapter/drupal/graphql/base.graphql +906 -0
  9. package/dist/runtime/adapter/drupal/graphql/comments.graphql +56 -0
  10. package/dist/runtime/adapter/drupal/graphql/fragments.graphql +25 -0
  11. package/dist/runtime/adapter/drupal/graphql/library.graphql +66 -0
  12. package/dist/runtime/adapter/drupal/graphql/search.graphql +19 -0
  13. package/dist/runtime/adapter/drupal/graphql/transform.graphql +27 -0
  14. package/dist/runtime/adapter/drupal/graphqlMiddleware.d.ts +2 -0
  15. package/dist/runtime/adapter/drupal/graphqlMiddleware.js +643 -0
  16. package/dist/runtime/adapter/index.d.ts +352 -0
  17. package/dist/runtime/adapter/index.js +3 -0
  18. package/dist/runtime/blokkliPlugins/AddAction/index.vue +87 -0
  19. package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +95 -0
  20. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +49 -0
  21. package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue +34 -0
  22. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +73 -0
  23. package/dist/runtime/blokkliPlugins/ItemAction/index.vue +132 -0
  24. package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +42 -0
  25. package/dist/runtime/blokkliPlugins/MenuButton/index.vue +74 -0
  26. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +334 -0
  27. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +286 -0
  28. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +104 -0
  29. package/dist/runtime/blokkliPlugins/TourItem/index.vue +45 -0
  30. package/dist/runtime/blokkliPlugins/ViewOption/index.vue +106 -0
  31. package/dist/runtime/blokkliPlugins/index.d.ts +12 -0
  32. package/dist/runtime/blokkliPlugins/index.js +24 -0
  33. package/dist/runtime/components/Blocks/Fragment/icon.svg +1 -0
  34. package/dist/runtime/components/Blocks/Fragment/index.vue +24 -0
  35. package/dist/runtime/components/Blocks/FromLibrary/index.vue +58 -0
  36. package/dist/runtime/components/BlokkliEditable.vue +73 -0
  37. package/dist/runtime/components/BlokkliField.vue +157 -0
  38. package/dist/runtime/components/BlokkliItem.vue +79 -0
  39. package/dist/runtime/components/BlokkliProvider.vue +160 -0
  40. package/dist/runtime/components/Edit/Actions/index.vue +263 -0
  41. package/dist/runtime/components/Edit/AddListItem/index.vue +116 -0
  42. package/dist/runtime/components/Edit/AnimationCanvas/index.vue +122 -0
  43. package/dist/runtime/components/Edit/AppMenu/index.vue +60 -0
  44. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +64 -0
  45. package/dist/runtime/components/Edit/Dialog/index.vue +163 -0
  46. package/dist/runtime/components/Edit/DragInteractions/index.vue +439 -0
  47. package/dist/runtime/components/Edit/DraggableList.vue +110 -0
  48. package/dist/runtime/components/Edit/EditIndicator.vue +82 -0
  49. package/dist/runtime/components/Edit/EditProvider.vue +213 -0
  50. package/dist/runtime/components/Edit/Features/AddList/docs.md +4 -0
  51. package/dist/runtime/components/Edit/Features/AddList/index.vue +205 -0
  52. package/dist/runtime/components/Edit/Features/Artboard/Manager/Artboard.d.ts +204 -0
  53. package/dist/runtime/components/Edit/Features/Artboard/Manager/Artboard.js +748 -0
  54. package/dist/runtime/components/Edit/Features/Artboard/Manager/Scrollbar/index.vue +176 -0
  55. package/dist/runtime/components/Edit/Features/Artboard/Manager/index.vue +317 -0
  56. package/dist/runtime/components/Edit/Features/Artboard/index.vue +45 -0
  57. package/dist/runtime/components/Edit/Features/Assistant/Overlay/ResultMarkup/index.vue +17 -0
  58. package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +147 -0
  59. package/dist/runtime/components/Edit/Features/Assistant/docs.md +7 -0
  60. package/dist/runtime/components/Edit/Features/Assistant/index.vue +68 -0
  61. package/dist/runtime/components/Edit/Features/BlockAddList/docs.md +15 -0
  62. package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +440 -0
  63. package/dist/runtime/components/Edit/Features/Clipboard/List/Item/File.vue +68 -0
  64. package/dist/runtime/components/Edit/Features/Clipboard/List/Item/Video.vue +56 -0
  65. package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +69 -0
  66. package/dist/runtime/components/Edit/Features/Clipboard/docs.md +16 -0
  67. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +485 -0
  68. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +61 -0
  69. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +280 -0
  70. package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +51 -0
  71. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +32 -0
  72. package/dist/runtime/components/Edit/Features/Comments/Comment/index.vue +53 -0
  73. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +100 -0
  74. package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +133 -0
  75. package/dist/runtime/components/Edit/Features/Comments/docs.md +13 -0
  76. package/dist/runtime/components/Edit/Features/Comments/index.vue +110 -0
  77. package/dist/runtime/components/Edit/Features/Conversions/index.vue +98 -0
  78. package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +55 -0
  79. package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue +93 -0
  80. package/dist/runtime/components/Edit/Features/Debug/docs.md +3 -0
  81. package/dist/runtime/components/Edit/Features/Debug/index.vue +178 -0
  82. package/dist/runtime/components/Edit/Features/Delete/index.vue +43 -0
  83. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +420 -0
  84. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +58 -0
  85. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +808 -0
  86. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/vertex.glsl +57 -0
  87. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +410 -0
  88. package/dist/runtime/components/Edit/Features/Duplicate/index.vue +109 -0
  89. package/dist/runtime/components/Edit/Features/Edit/index.vue +63 -0
  90. package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +73 -0
  91. package/dist/runtime/components/Edit/Features/EditForm/index.vue +217 -0
  92. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Contenteditable/index.vue +42 -0
  93. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +68 -0
  94. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +81 -0
  95. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +357 -0
  96. package/dist/runtime/components/Edit/Features/EditableField/index.vue +192 -0
  97. package/dist/runtime/components/Edit/Features/EditableMask/index.vue +64 -0
  98. package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +108 -0
  99. package/dist/runtime/components/Edit/Features/Exit/index.vue +38 -0
  100. package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue +33 -0
  101. package/dist/runtime/components/Edit/Features/FieldAreas/index.vue +43 -0
  102. package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +68 -0
  103. package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +137 -0
  104. package/dist/runtime/components/Edit/Features/Fragments/docs.md +101 -0
  105. package/dist/runtime/components/Edit/Features/Fragments/index.vue +86 -0
  106. package/dist/runtime/components/Edit/Features/Grid/index.vue +40 -0
  107. package/dist/runtime/components/Edit/Features/Help/Shortcuts/index.vue +71 -0
  108. package/dist/runtime/components/Edit/Features/Help/index.vue +53 -0
  109. package/dist/runtime/components/Edit/Features/History/index.vue +263 -0
  110. package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +140 -0
  111. package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +92 -0
  112. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +0 -0
  113. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +73 -0
  114. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +184 -0
  115. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +88 -0
  116. package/dist/runtime/components/Edit/Features/Library/docs.md +127 -0
  117. package/dist/runtime/components/Edit/Features/Library/index.vue +184 -0
  118. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +184 -0
  119. package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +182 -0
  120. package/dist/runtime/components/Edit/Features/MediaLibrary/types.d.ts +57 -0
  121. package/dist/runtime/components/Edit/Features/MediaLibrary/types.js +0 -0
  122. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/fragment.glsl +90 -0
  123. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +289 -0
  124. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/vertex.glsl +182 -0
  125. package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +76 -0
  126. package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue +52 -0
  127. package/dist/runtime/components/Edit/Features/Options/Form/Checkboxes/index.vue +129 -0
  128. package/dist/runtime/components/Edit/Features/Options/Form/Color/index.vue +38 -0
  129. package/dist/runtime/components/Edit/Features/Options/Form/Group.vue +25 -0
  130. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +155 -0
  131. package/dist/runtime/components/Edit/Features/Options/Form/Number/index.vue +74 -0
  132. package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +135 -0
  133. package/dist/runtime/components/Edit/Features/Options/Form/Range/index.vue +47 -0
  134. package/dist/runtime/components/Edit/Features/Options/Form/Text/index.vue +38 -0
  135. package/dist/runtime/components/Edit/Features/Options/Form/index.vue +342 -0
  136. package/dist/runtime/components/Edit/Features/Options/index.vue +88 -0
  137. package/dist/runtime/components/Edit/Features/Ownership/index.vue +57 -0
  138. package/dist/runtime/components/Edit/Features/Preview/index.vue +45 -0
  139. package/dist/runtime/components/Edit/Features/PreviewGrant/QrCode/index.vue +30 -0
  140. package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +73 -0
  141. package/dist/runtime/components/Edit/Features/Publish/index.vue +50 -0
  142. package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +81 -0
  143. package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +217 -0
  144. package/dist/runtime/components/Edit/Features/Revert/index.vue +68 -0
  145. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +165 -0
  146. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +211 -0
  147. package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +214 -0
  148. package/dist/runtime/components/Edit/Features/Search/index.vue +79 -0
  149. package/dist/runtime/components/Edit/Features/Selection/Overlay/fragment.glsl +99 -0
  150. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +144 -0
  151. package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +85 -0
  152. package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +50 -0
  153. package/dist/runtime/components/Edit/Features/Selection/index.vue +295 -0
  154. package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +141 -0
  155. package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +138 -0
  156. package/dist/runtime/components/Edit/Features/Settings/index.vue +92 -0
  157. package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +181 -0
  158. package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +149 -0
  159. package/dist/runtime/components/Edit/Features/Structure/List/index.vue +55 -0
  160. package/dist/runtime/components/Edit/Features/Structure/index.vue +83 -0
  161. package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +81 -0
  162. package/dist/runtime/components/Edit/Features/Theme/GeneratedCode/index.vue +24 -0
  163. package/dist/runtime/components/Edit/Features/Theme/index.vue +122 -0
  164. package/dist/runtime/components/Edit/Features/TouchActionBar/Bar/index.vue +26 -0
  165. package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +42 -0
  166. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +270 -0
  167. package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +36 -0
  168. package/dist/runtime/components/Edit/Features/Tour/docs.md +0 -0
  169. package/dist/runtime/components/Edit/Features/Tour/index.vue +46 -0
  170. package/dist/runtime/components/Edit/Features/Transform/docs.md +67 -0
  171. package/dist/runtime/components/Edit/Features/Transform/index.vue +177 -0
  172. package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +50 -0
  173. package/dist/runtime/components/Edit/Features/Translations/index.vue +193 -0
  174. package/dist/runtime/components/Edit/Features/Validations/Overlay/Item.vue +50 -0
  175. package/dist/runtime/components/Edit/Features/Validations/Overlay/index.vue +51 -0
  176. package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +50 -0
  177. package/dist/runtime/components/Edit/Features/Validations/index.vue +70 -0
  178. package/dist/runtime/components/Edit/Features/index.vue +67 -0
  179. package/dist/runtime/components/Edit/FormOverlay/Header/index.vue +39 -0
  180. package/dist/runtime/components/Edit/FormOverlay/index.vue +52 -0
  181. package/dist/runtime/components/Edit/Highlight/index.vue +94 -0
  182. package/dist/runtime/components/Edit/Icon/index.vue +21 -0
  183. package/dist/runtime/components/Edit/ItemIcon/index.vue +27 -0
  184. package/dist/runtime/components/Edit/Loading/index.vue +19 -0
  185. package/dist/runtime/components/Edit/Messages/Item/index.vue +107 -0
  186. package/dist/runtime/components/Edit/Messages/index.vue +37 -0
  187. package/dist/runtime/components/Edit/PreviewProvider.vue +223 -0
  188. package/dist/runtime/components/Edit/RelativeTime/index.vue +37 -0
  189. package/dist/runtime/components/Edit/Resizable/index.vue +90 -0
  190. package/dist/runtime/components/Edit/ScaleToFit/index.vue +57 -0
  191. package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +90 -0
  192. package/dist/runtime/components/Edit/Sortli/index.vue +92 -0
  193. package/dist/runtime/components/Edit/SystemRequirements/index.vue +91 -0
  194. package/dist/runtime/components/Edit/Toolbar/index.vue +106 -0
  195. package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue +75 -0
  196. package/dist/runtime/components/Edit/index.d.ts +14 -0
  197. package/dist/runtime/components/Edit/index.js +28 -0
  198. package/dist/runtime/composables/defineBlokkli.d.ts +6 -0
  199. package/dist/runtime/composables/defineBlokkli.js +108 -0
  200. package/dist/runtime/composables/defineBlokkliFeature.d.ts +28 -0
  201. package/dist/runtime/composables/defineBlokkliFeature.js +62 -0
  202. package/dist/runtime/composables/defineBlokkliFragment.d.ts +3 -0
  203. package/dist/runtime/composables/defineBlokkliFragment.js +54 -0
  204. package/dist/runtime/composables/useBlokkli.d.ts +8 -0
  205. package/dist/runtime/composables/useBlokkli.js +5 -0
  206. package/dist/runtime/constants/index.d.ts +4 -0
  207. package/dist/runtime/constants/index.js +2 -0
  208. package/dist/runtime/css/output.css +1 -0
  209. package/dist/runtime/helpers/Artboard/index.d.ts +16 -0
  210. package/dist/runtime/helpers/Artboard/index.js +20 -0
  211. package/dist/runtime/helpers/DragStyle/index.d.ts +12 -0
  212. package/dist/runtime/helpers/DragStyle/index.js +86 -0
  213. package/dist/runtime/helpers/animationProvider.d.ts +25 -0
  214. package/dist/runtime/helpers/animationProvider.js +116 -0
  215. package/dist/runtime/helpers/broadcastProvider.d.ts +7 -0
  216. package/dist/runtime/helpers/broadcastProvider.js +26 -0
  217. package/dist/runtime/helpers/commandsProvider.d.ts +9 -0
  218. package/dist/runtime/helpers/commandsProvider.js +16 -0
  219. package/dist/runtime/helpers/composables/defineCommands.d.ts +2 -0
  220. package/dist/runtime/helpers/composables/defineCommands.js +10 -0
  221. package/dist/runtime/helpers/composables/defineDropAreas.d.ts +2 -0
  222. package/dist/runtime/helpers/composables/defineDropAreas.js +10 -0
  223. package/dist/runtime/helpers/composables/defineShortcut.d.ts +2 -0
  224. package/dist/runtime/helpers/composables/defineShortcut.js +19 -0
  225. package/dist/runtime/helpers/composables/defineTourItem.d.ts +2 -0
  226. package/dist/runtime/helpers/composables/defineTourItem.js +10 -0
  227. package/dist/runtime/helpers/composables/onBlokkliEvent.d.ts +2 -0
  228. package/dist/runtime/helpers/composables/onBlokkliEvent.js +10 -0
  229. package/dist/runtime/helpers/composables/useAnimationFrame.d.ts +1 -0
  230. package/dist/runtime/helpers/composables/useAnimationFrame.js +14 -0
  231. package/dist/runtime/helpers/composables/useDebugLogger.d.ts +2 -0
  232. package/dist/runtime/helpers/composables/useDebugLogger.js +5 -0
  233. package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.d.ts +5 -0
  234. package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.js +26 -0
  235. package/dist/runtime/helpers/debugProvider.d.ts +23 -0
  236. package/dist/runtime/helpers/debugProvider.js +65 -0
  237. package/dist/runtime/helpers/dom/index.d.ts +5 -0
  238. package/dist/runtime/helpers/dom/index.js +37 -0
  239. package/dist/runtime/helpers/domProvider.d.ts +46 -0
  240. package/dist/runtime/helpers/domProvider.js +446 -0
  241. package/dist/runtime/helpers/dropAreaProvider.d.ts +9 -0
  242. package/dist/runtime/helpers/dropAreaProvider.js +22 -0
  243. package/dist/runtime/helpers/easing.d.ts +3 -0
  244. package/dist/runtime/helpers/easing.js +16 -0
  245. package/dist/runtime/helpers/eventBus.d.ts +3 -0
  246. package/dist/runtime/helpers/eventBus.js +5 -0
  247. package/dist/runtime/helpers/featuresProvider.d.ts +23 -0
  248. package/dist/runtime/helpers/featuresProvider.js +16 -0
  249. package/dist/runtime/helpers/frameEventBus.d.ts +9 -0
  250. package/dist/runtime/helpers/frameEventBus.js +2 -0
  251. package/dist/runtime/helpers/index.d.ts +87 -0
  252. package/dist/runtime/helpers/index.js +467 -0
  253. package/dist/runtime/helpers/keyboardProvider.d.ts +17 -0
  254. package/dist/runtime/helpers/keyboardProvider.js +79 -0
  255. package/dist/runtime/helpers/options.d.ts +2 -0
  256. package/dist/runtime/helpers/options.js +21 -0
  257. package/dist/runtime/helpers/runtimeHelpers/index.d.ts +10 -0
  258. package/dist/runtime/helpers/runtimeHelpers/index.js +35 -0
  259. package/dist/runtime/helpers/selectionProvider.d.ts +62 -0
  260. package/dist/runtime/helpers/selectionProvider.js +149 -0
  261. package/dist/runtime/helpers/stateProvider.d.ts +35 -0
  262. package/dist/runtime/helpers/stateProvider.js +226 -0
  263. package/dist/runtime/helpers/storageProvider.d.ts +15 -0
  264. package/dist/runtime/helpers/storageProvider.js +61 -0
  265. package/dist/runtime/helpers/symbols.d.ts +16 -0
  266. package/dist/runtime/helpers/symbols.js +18 -0
  267. package/dist/runtime/helpers/textProvider.d.ts +4 -0
  268. package/dist/runtime/helpers/textProvider.js +20 -0
  269. package/dist/runtime/helpers/themeProvider.d.ts +27 -0
  270. package/dist/runtime/helpers/themeProvider.js +124 -0
  271. package/dist/runtime/helpers/tourProvider.d.ts +11 -0
  272. package/dist/runtime/helpers/tourProvider.js +19 -0
  273. package/dist/runtime/helpers/transform.d.ts +2 -0
  274. package/dist/runtime/helpers/transform.js +17 -0
  275. package/dist/runtime/helpers/typesProvider.d.ts +36 -0
  276. package/dist/runtime/helpers/typesProvider.js +138 -0
  277. package/dist/runtime/helpers/uiProvider.d.ts +36 -0
  278. package/dist/runtime/helpers/uiProvider.js +278 -0
  279. package/dist/runtime/helpers/webgl/index.d.ts +32 -0
  280. package/dist/runtime/helpers/webgl/index.js +132 -0
  281. package/dist/runtime/icons/alert.svg +6 -0
  282. package/dist/runtime/icons/area.svg +5 -0
  283. package/dist/runtime/icons/arrow-down.svg +1 -0
  284. package/dist/runtime/icons/arrow-left.svg +1 -0
  285. package/dist/runtime/icons/arrow-right.svg +1 -0
  286. package/dist/runtime/icons/arrow-up.svg +1 -0
  287. package/dist/runtime/icons/artboard-disabled.svg +9 -0
  288. package/dist/runtime/icons/artboard-enabled.svg +29 -0
  289. package/dist/runtime/icons/artboard.svg +1 -0
  290. package/dist/runtime/icons/bug.svg +1 -0
  291. package/dist/runtime/icons/button-pointer.svg +1 -0
  292. package/dist/runtime/icons/caret.svg +12 -0
  293. package/dist/runtime/icons/cellphone.svg +1 -0
  294. package/dist/runtime/icons/chat-question.svg +1 -0
  295. package/dist/runtime/icons/check.svg +1 -0
  296. package/dist/runtime/icons/checkbox.svg +5 -0
  297. package/dist/runtime/icons/checks.svg +1 -0
  298. package/dist/runtime/icons/chevron-left.svg +1 -0
  299. package/dist/runtime/icons/chevron-right.svg +1 -0
  300. package/dist/runtime/icons/clipboard.svg +5 -0
  301. package/dist/runtime/icons/close.svg +5 -0
  302. package/dist/runtime/icons/cog.svg +5 -0
  303. package/dist/runtime/icons/command.svg +1 -0
  304. package/dist/runtime/icons/comment.svg +5 -0
  305. package/dist/runtime/icons/comment_add.svg +5 -0
  306. package/dist/runtime/icons/convert.svg +1 -0
  307. package/dist/runtime/icons/cursor-move.svg +1 -0
  308. package/dist/runtime/icons/dead.svg +1 -0
  309. package/dist/runtime/icons/delete.svg +8 -0
  310. package/dist/runtime/icons/detach.svg +7 -0
  311. package/dist/runtime/icons/drag.svg +1 -0
  312. package/dist/runtime/icons/duplicate.svg +12 -0
  313. package/dist/runtime/icons/edit.svg +8 -0
  314. package/dist/runtime/icons/exit.svg +6 -0
  315. package/dist/runtime/icons/expand.svg +1 -0
  316. package/dist/runtime/icons/file.svg +1 -0
  317. package/dist/runtime/icons/form.svg +1 -0
  318. package/dist/runtime/icons/fragment.svg +1 -0
  319. package/dist/runtime/icons/grid.svg +13 -0
  320. package/dist/runtime/icons/group.svg +5 -0
  321. package/dist/runtime/icons/help.svg +1 -0
  322. package/dist/runtime/icons/history.svg +1 -0
  323. package/dist/runtime/icons/image.svg +1 -0
  324. package/dist/runtime/icons/import.svg +5 -0
  325. package/dist/runtime/icons/laptop.svg +1 -0
  326. package/dist/runtime/icons/list-view-grid.svg +1 -0
  327. package/dist/runtime/icons/list-view-horizontal.svg +1 -0
  328. package/dist/runtime/icons/loader.svg +1 -0
  329. package/dist/runtime/icons/logo.svg +5 -0
  330. package/dist/runtime/icons/magnifier.svg +5 -0
  331. package/dist/runtime/icons/menu.svg +1 -0
  332. package/dist/runtime/icons/minus.svg +1 -0
  333. package/dist/runtime/icons/monitor.svg +1 -0
  334. package/dist/runtime/icons/multi-select.svg +1 -0
  335. package/dist/runtime/icons/multimedia.svg +1 -0
  336. package/dist/runtime/icons/opacity.svg +5 -0
  337. package/dist/runtime/icons/open_in_new.svg +3 -0
  338. package/dist/runtime/icons/palette.svg +1 -0
  339. package/dist/runtime/icons/plus-box.svg +1 -0
  340. package/dist/runtime/icons/plus.svg +1 -0
  341. package/dist/runtime/icons/preview.svg +5 -0
  342. package/dist/runtime/icons/publish.svg +12 -0
  343. package/dist/runtime/icons/puzzle.svg +1 -0
  344. package/dist/runtime/icons/qrcode.svg +5 -0
  345. package/dist/runtime/icons/question.svg +5 -0
  346. package/dist/runtime/icons/redo.svg +12 -0
  347. package/dist/runtime/icons/resize.svg +1 -0
  348. package/dist/runtime/icons/reusable.svg +5 -0
  349. package/dist/runtime/icons/revert.svg +5 -0
  350. package/dist/runtime/icons/robot.svg +1 -0
  351. package/dist/runtime/icons/rotate-phone.svg +1 -0
  352. package/dist/runtime/icons/sad.svg +1 -0
  353. package/dist/runtime/icons/save.svg +1 -0
  354. package/dist/runtime/icons/script.svg +1 -0
  355. package/dist/runtime/icons/scrolltotop.svg +6 -0
  356. package/dist/runtime/icons/search.svg +1 -0
  357. package/dist/runtime/icons/selection.svg +5 -0
  358. package/dist/runtime/icons/spinner.svg +15 -0
  359. package/dist/runtime/icons/star.svg +1 -0
  360. package/dist/runtime/icons/swap-horizontal.svg +1 -0
  361. package/dist/runtime/icons/tablet.svg +1 -0
  362. package/dist/runtime/icons/textbox.svg +1 -0
  363. package/dist/runtime/icons/texturebox.svg +5 -0
  364. package/dist/runtime/icons/tiktok.svg +1 -0
  365. package/dist/runtime/icons/title.svg +1 -0
  366. package/dist/runtime/icons/tools.svg +1 -0
  367. package/dist/runtime/icons/translate.svg +5 -0
  368. package/dist/runtime/icons/tree.svg +5 -0
  369. package/dist/runtime/icons/tutor.svg +1 -0
  370. package/dist/runtime/icons/ui-list-horizontal.svg +19 -0
  371. package/dist/runtime/icons/ui-list-sidebar.svg +21 -0
  372. package/dist/runtime/icons/ui-list-vertical.svg +9 -0
  373. package/dist/runtime/icons/undo.svg +12 -0
  374. package/dist/runtime/icons/unstar.svg +1 -0
  375. package/dist/runtime/icons/upload.svg +1 -0
  376. package/dist/runtime/icons/user.svg +1 -0
  377. package/dist/runtime/icons/video-outline.svg +1 -0
  378. package/dist/runtime/icons/vimeo.svg +3 -0
  379. package/dist/runtime/icons/window-maximize.svg +1 -0
  380. package/dist/runtime/icons/window-minimize.svg +1 -0
  381. package/dist/runtime/icons/youtube.svg +3 -0
  382. package/dist/runtime/plugins/blokkliEditable.d.ts +2 -0
  383. package/dist/runtime/plugins/blokkliEditable.js +31 -0
  384. package/dist/runtime/public/Inter.var.woff2 +0 -0
  385. package/dist/runtime/types/blokkOptions.d.ts +83 -0
  386. package/dist/runtime/types/blokkOptions.js +0 -0
  387. package/dist/runtime/types/generatedModuleTypes.d.ts +41 -0
  388. package/dist/runtime/types/generatedModuleTypes.js +0 -0
  389. package/dist/runtime/types/index.d.ts +1052 -0
  390. package/dist/runtime/types/index.js +1 -0
  391. package/dist/runtime/types/theme.d.ts +33 -0
  392. package/dist/runtime/types/theme.js +0 -0
  393. package/dist/types.d.mts +1 -0
  394. package/dist/types.d.ts +1 -0
  395. package/package.json +103 -0
@@ -0,0 +1,352 @@
1
+ import type { ComputedRef } from 'vue';
2
+ import type { CommentItem, ConversionItem, MappedState, ImportItem, LibraryItem, BlockBundleDefinition, EntityTranslation, SearchContentItem, AddClipboardItemEvent, AddNewBlockEvent, AddReusableItemEvent, ImportFromExistingEvent, MakeReusableEvent, MoveMultipleBlocksEvent, MoveBlockEvent, UpdateBlockOptionEvent, AddContentSearchItemEvent, TransformPlugin, EditBlockEvent, PasteExistingBlocksEvent, UpdateFieldValueEvent, AssistantResult, DraggableHostData, DetachReusableBlockEvent, FieldConfig, EditableFieldConfig, DraggableMediaLibraryItem, DroppableFieldConfig } from './../types.js';
3
+ import type getVideoId from 'get-video-id';
4
+ import type { GetMediaLibraryFunction } from './../components/Edit/Features/MediaLibrary/types.js';
5
+ export type { GetMediaLibraryFunction };
6
+ export interface MutationResponseLike<T> {
7
+ success: boolean;
8
+ state: T;
9
+ errors?: string[];
10
+ }
11
+ type AdapterApplyTransformPlugin = {
12
+ pluginId: string;
13
+ uuids: string[];
14
+ };
15
+ export type UpdateEntityFieldValueEvent = {
16
+ fieldName: string;
17
+ fieldValue: string;
18
+ };
19
+ export type AdapterFragmentsAddBlock = {
20
+ name: string;
21
+ host: DraggableHostData;
22
+ preceedingUuid?: string;
23
+ };
24
+ export type MediaLibraryAddBlockEvent = {
25
+ host: DraggableHostData;
26
+ preceedingUuid?: string;
27
+ item: DraggableMediaLibraryItem;
28
+ };
29
+ export type MediaLibraryReplaceMediaEvent = {
30
+ /**
31
+ * The UUID of the block on which the media was dropped.
32
+ */
33
+ host: DraggableHostData;
34
+ /**
35
+ * The ID of the media that was dropped.
36
+ */
37
+ mediaId: string;
38
+ };
39
+ type AdapterAssistantAddBlockFromResult = {
40
+ result: AssistantResult;
41
+ host: DraggableHostData;
42
+ preceedingUuid?: string;
43
+ };
44
+ type AdapterAssistantGetResultsCreate = {
45
+ type: 'create';
46
+ prompt: string;
47
+ };
48
+ type AdapterAssistantGetResultsEdit = {
49
+ type: 'edit';
50
+ /**
51
+ * The text that should be edited.
52
+ */
53
+ text: string;
54
+ prompt: string;
55
+ };
56
+ type AdapterAssistantGetResults = AdapterAssistantGetResultsCreate | AdapterAssistantGetResultsEdit;
57
+ type AdapterBuildEditableFrameUrl = {
58
+ fieldName: string;
59
+ uuid?: string;
60
+ };
61
+ type AdapterFormFrameBuilderResult = {
62
+ url: string;
63
+ };
64
+ type AdapterFormFrameBuilderBlockAdd = {
65
+ id: 'block:add';
66
+ data: AddNewBlockEvent;
67
+ };
68
+ type AdapterFormFrameBuilderBlockTranslate = {
69
+ id: 'block:translate';
70
+ data: EditBlockEvent;
71
+ langcode: string;
72
+ };
73
+ type AdapterFormFrameBuilderBlockEdit = {
74
+ id: 'block:edit';
75
+ data: EditBlockEvent;
76
+ };
77
+ type AdapterFormFrameBuilderEntityEdit = {
78
+ id: 'entity:edit';
79
+ };
80
+ type AdapterFormFrameBuilderEntityTranslate = {
81
+ id: 'entity:translate';
82
+ translation: EntityTranslation;
83
+ };
84
+ type AdapterFormFrameBuilderBatchTranslate = {
85
+ id: 'batchTranslate';
86
+ };
87
+ export type AdapterFormFrameBuilder = AdapterFormFrameBuilderBlockAdd | AdapterFormFrameBuilderBlockEdit | AdapterFormFrameBuilderBlockTranslate | AdapterFormFrameBuilderEntityEdit | AdapterFormFrameBuilderEntityTranslate | AdapterFormFrameBuilderBatchTranslate;
88
+ export interface AdapterContext {
89
+ entityType: string;
90
+ entityUuid: string;
91
+ entityBundle: string;
92
+ language: string;
93
+ }
94
+ export type ClipboardMapBundleEventPlaintext = {
95
+ type: 'plaintext';
96
+ text: string;
97
+ };
98
+ export type ClipboardMapBundleEventImage = {
99
+ type: 'image';
100
+ fileType: string;
101
+ fileSize: number;
102
+ };
103
+ export type ClipboardMapBundleEventFile = {
104
+ type: 'file';
105
+ fileType: string;
106
+ fileSize: number;
107
+ };
108
+ export type ClipboardMapBundleEventVideo = {
109
+ type: 'video';
110
+ videoService: ReturnType<typeof getVideoId>['service'];
111
+ videoId: string;
112
+ };
113
+ export type ClipboardMapBundleEvent = ClipboardMapBundleEventVideo | ClipboardMapBundleEventImage | ClipboardMapBundleEventFile | ClipboardMapBundleEventPlaintext;
114
+ export type BlokkliAdapterGetLibraryItemsData = {
115
+ bundles: string[];
116
+ page: number;
117
+ text: string;
118
+ };
119
+ export type BlokkliAdapterGetLibraryItemsResult = {
120
+ items: LibraryItem[];
121
+ total: number;
122
+ perPage: number;
123
+ };
124
+ export interface BlokkliAdapter<T> {
125
+ /**
126
+ * Load the state for the given langcode.
127
+ */
128
+ loadState(langcode?: string | undefined | null): Promise<T | undefined>;
129
+ mapState(state: T): MappedState;
130
+ /**
131
+ * Get disabled features at runtime.
132
+ *
133
+ * For example, the "Translation" feature can be disabled if the current
134
+ * entity does not support translations.
135
+ *
136
+ * For features that are always disabled, use the `alterFeatures` option of
137
+ * the module to remove them entirely.
138
+ */
139
+ getDisabledFeatures?: () => Promise<string[]>;
140
+ /**
141
+ * Return a list of all types.
142
+ */
143
+ getAllBundles(): Promise<BlockBundleDefinition[]>;
144
+ /**
145
+ * Get the field configurations.
146
+ */
147
+ getFieldConfig(): Promise<FieldConfig[]>;
148
+ /**
149
+ * Get the editable field configurations.
150
+ */
151
+ getEditableFieldConfig?: () => Promise<EditableFieldConfig[]>;
152
+ /**
153
+ * Get the droppable field configurations.
154
+ */
155
+ getDroppableFieldConfig?: () => Promise<DroppableFieldConfig[]>;
156
+ /**
157
+ * Get all possible conversions.
158
+ */
159
+ getConversions?: () => Promise<ConversionItem[]>;
160
+ /**
161
+ * Convert multiple items.
162
+ */
163
+ convertBlocks?: (uuids: string[], targetBundle: string) => Promise<MutationResponseLike<T>>;
164
+ /**
165
+ * Get all possible transform plugins.
166
+ */
167
+ getTransformPlugins?: () => Promise<TransformPlugin[]>;
168
+ /**
169
+ * Apply a transform plugin.
170
+ */
171
+ applyTransformPlugin?: (e: AdapterApplyTransformPlugin) => Promise<MutationResponseLike<T>>;
172
+ /**
173
+ * Add a new block.
174
+ */
175
+ addNewBlock(e: AddNewBlockEvent): Promise<MutationResponseLike<T>>;
176
+ /**
177
+ * Update multiple options.
178
+ */
179
+ updateOptions?: (options: UpdateBlockOptionEvent[]) => Promise<MutationResponseLike<T>>;
180
+ /**
181
+ * Determine the block bundle for the given clipboard item.
182
+ */
183
+ clipboardMapBundle?: (e: ClipboardMapBundleEvent) => string | undefined;
184
+ /**
185
+ * Add a clipboard item.
186
+ */
187
+ addBlockFromClipboardItem?: (e: AddClipboardItemEvent) => Promise<MutationResponseLike<T>> | undefined;
188
+ /**
189
+ * Move an item.
190
+ */
191
+ moveBlock(e: MoveBlockEvent): Promise<MutationResponseLike<T>>;
192
+ /**
193
+ * Move multiple items.
194
+ */
195
+ moveMultipleBlocks(e: MoveMultipleBlocksEvent): Promise<MutationResponseLike<T>>;
196
+ /**
197
+ * Add a reusable item.
198
+ */
199
+ addLibraryItem?: (e: AddReusableItemEvent) => Promise<MutationResponseLike<T>>;
200
+ /**
201
+ * Delete multiple items.
202
+ */
203
+ deleteBlocks?: (uuids: string[]) => Promise<MutationResponseLike<T>>;
204
+ /**
205
+ * Duplicate blocks.
206
+ */
207
+ duplicateBlocks?: (uuids: string[]) => Promise<MutationResponseLike<T>>;
208
+ /**
209
+ * Paste existing blocks.
210
+ */
211
+ pasteExistingBlocks?: (e: PasteExistingBlocksEvent) => Promise<MutationResponseLike<T>>;
212
+ /**
213
+ * Get all existing entities for importing.
214
+ */
215
+ getImportItems?: (searchText?: string) => Promise<{
216
+ items: ImportItem[];
217
+ total: number;
218
+ }>;
219
+ /**
220
+ * Import items from an existing entity.
221
+ */
222
+ importFromExisting?: (e: ImportFromExistingEvent) => Promise<MutationResponseLike<T>>;
223
+ /**
224
+ * Revert all changes to the last published state.
225
+ */
226
+ revertAllChanges?: () => Promise<MutationResponseLike<T>>;
227
+ /**
228
+ * Publish all changes.
229
+ */
230
+ publish?: () => Promise<MutationResponseLike<T>>;
231
+ /**
232
+ * Set a specific history index.
233
+ */
234
+ setHistoryIndex?: (index: number) => Promise<MutationResponseLike<T>>;
235
+ /**
236
+ * Set the status of a mutation item.
237
+ */
238
+ setMutationItemStatus?: (index: number, status: boolean) => Promise<MutationResponseLike<T>>;
239
+ /**
240
+ * Take ownership of the edit state.
241
+ */
242
+ takeOwnership?: () => Promise<MutationResponseLike<T>>;
243
+ /**
244
+ * Load all comments.
245
+ */
246
+ loadComments?: () => Promise<CommentItem[]>;
247
+ /**
248
+ * Add a comment to one or more items.
249
+ */
250
+ addComment?: (blockUuids: string[], body: string) => Promise<CommentItem[]>;
251
+ /**
252
+ * Resolve a comment.
253
+ */
254
+ resolveComment?: (uuid: string) => Promise<CommentItem[]>;
255
+ /**
256
+ * Make an item reusable.
257
+ */
258
+ makeBlockReusable?: (e: MakeReusableEvent) => Promise<MutationResponseLike<T>>;
259
+ /**
260
+ * Detach a reusable block and add a copy of it in place.
261
+ */
262
+ detachReusableBlock?: (e: DetachReusableBlockEvent) => Promise<MutationResponseLike<T>>;
263
+ /**
264
+ * Get all library items.
265
+ */
266
+ getLibraryItems?: (data: BlokkliAdapterGetLibraryItemsData) => Promise<BlokkliAdapterGetLibraryItemsResult>;
267
+ /**
268
+ * Get the last changed timestamp for the edit state.
269
+ */
270
+ getLastChanged?: () => Promise<number>;
271
+ /**
272
+ * Get the shareable preview URL.
273
+ *
274
+ * This should return a URL that can be used to bypass logins, using a token or similar, that can be shared with non-editing people.
275
+ */
276
+ getPreviewGrantUrl?: () => Promise<string | undefined | null> | string | undefined | null;
277
+ /**
278
+ * Return the possible content search tabs.
279
+ */
280
+ getContentSearchTabs?: () => Record<string, string> | Promise<Record<string, string>>;
281
+ /**
282
+ * Return items for the "content" search.
283
+ *
284
+ * Should only return a limited amount of results, sorted by relevance.
285
+ */
286
+ getContentSearchResults?: (tab: string, text: string) => Promise<SearchContentItem[]>;
287
+ /**
288
+ * Add the dropped item from a search content item.
289
+ */
290
+ addContentSearchItem?: (e: AddContentSearchItemEvent) => Promise<MutationResponseLike<T>> | undefined;
291
+ /**
292
+ * Change the language.
293
+ */
294
+ changeLanguage?: (translation: EntityTranslation) => Promise<any>;
295
+ /**
296
+ * Build the URL for forms.
297
+ */
298
+ formFrameBuilder?: (e: AdapterFormFrameBuilder) => AdapterFormFrameBuilderResult | undefined;
299
+ /**
300
+ * Update the value of a single block field.
301
+ */
302
+ updateFieldValue?: (e: UpdateFieldValueEvent) => Promise<MutationResponseLike<T>> | undefined;
303
+ /**
304
+ * Update the value of a single entity field.
305
+ */
306
+ updateEntityFieldValue?: (e: UpdateEntityFieldValueEvent) => Promise<MutationResponseLike<T>> | undefined;
307
+ /**
308
+ * Build the iframe URL for an editable of type "frame".
309
+ */
310
+ buildEditableFrameUrl?: (e: AdapterBuildEditableFrameUrl) => string | undefined;
311
+ /**
312
+ * Get the result for an assistant query.
313
+ */
314
+ assistantGetResults?: (e: AdapterAssistantGetResults) => Promise<AssistantResult | undefined>;
315
+ /**
316
+ * Add one or more blocks from the given assistant result.
317
+ */
318
+ assistantAddBlockFromResult?: (e: AdapterAssistantAddBlockFromResult) => Promise<MutationResponseLike<T>> | undefined;
319
+ /**
320
+ * Return the HTML markup for displaying the grid.
321
+ */
322
+ getGridMarkup?: () => Promise<string> | string;
323
+ /**
324
+ * Return the media library results and filters using the given selected filter.
325
+ */
326
+ mediaLibraryGetResults?: GetMediaLibraryFunction<any>;
327
+ /**
328
+ * Create a new block from the given media library item.
329
+ */
330
+ mediaLibraryAddBlock?: (e: MediaLibraryAddBlockEvent) => Promise<MutationResponseLike<T>> | undefined;
331
+ /**
332
+ * Replace an existing media from a block with a new one.
333
+ *
334
+ * This method is called when the user drag and drops an item from the media
335
+ * library onto an v-blokkli-droppable element.
336
+ */
337
+ mediaLibraryReplaceMedia?: (e: MediaLibraryReplaceMediaEvent) => Promise<MutationResponseLike<T>> | undefined;
338
+ /**
339
+ * Replace an existing media on a field of the page entity.
340
+ *
341
+ * This method is called when the user drag and drops an item from the media
342
+ * library onto an v-blokkli-droppable element where the host is the page entity..
343
+ */
344
+ mediaLibraryReplaceEntityMedia?: (e: MediaLibraryReplaceMediaEvent) => Promise<MutationResponseLike<T>> | undefined;
345
+ /**
346
+ * Add a fragment block.
347
+ */
348
+ fragmentsAddBlock?: (e: AdapterFragmentsAddBlock) => Promise<MutationResponseLike<T>> | undefined;
349
+ }
350
+ export type BlokkliAdapterFactory<T> = (ctx: ComputedRef<AdapterContext>) => Promise<BlokkliAdapter<T>> | BlokkliAdapter<T>;
351
+ export type AdapterMethods = keyof BlokkliAdapter<any>;
352
+ export declare function defineBlokkliEditAdapter<T>(cb: BlokkliAdapterFactory<T>): BlokkliAdapterFactory<T>;
@@ -0,0 +1,3 @@
1
+ export function defineBlokkliEditAdapter(cb) {
2
+ return cb;
3
+ }
@@ -0,0 +1,87 @@
1
+ <template>
2
+ <Teleport v-if="shouldRender" :key="renderKey" to="#blokkli-add-list-actions">
3
+ <AddListItem
4
+ :id="type"
5
+ ref="item"
6
+ :label="title"
7
+ :icon="icon"
8
+ :orientation="ui.addListOrientation.value"
9
+ :color="color"
10
+ :disabled="disabled"
11
+ data-element-type="action"
12
+ :data-action-type="type"
13
+ :data-item-bundle="itemBundle"
14
+ no-context-menu
15
+ />
16
+ </Teleport>
17
+ </template>
18
+
19
+ <script lang="ts" setup>
20
+ import { computed, useBlokkli, nextTick, ref } from '#imports'
21
+ import type { BlokkliIcon } from '#blokkli/icons'
22
+ import type { ActionPlacedEvent } from '#blokkli/types'
23
+ import { AddListItem } from '#blokkli/components'
24
+ import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
25
+ import defineTourItem from '#blokkli/helpers/composables/defineTourItem'
26
+
27
+ const props = defineProps<{
28
+ type: string
29
+ title: string
30
+ icon: BlokkliIcon
31
+ itemBundle?: string
32
+ color: 'rose' | 'lime' | 'accent'
33
+ description?: string
34
+ disabled?: boolean
35
+ weight?: number
36
+ }>()
37
+
38
+ const item = ref<InstanceType<typeof AddListItem> | null>(null)
39
+
40
+ const emit = defineEmits<{
41
+ (e: 'placed', data: ActionPlacedEvent): void
42
+ }>()
43
+
44
+ const { ui, state, features } = useBlokkli()
45
+
46
+ const addListAvailable = computed(
47
+ () => !!features.features.value.find((v) => v.id === 'add-list'),
48
+ )
49
+
50
+ const shouldRender = computed(
51
+ () => addListAvailable.value && state.editMode.value === 'editing',
52
+ )
53
+
54
+ const renderKey = ref('')
55
+
56
+ onBlokkliEvent('add-list:change', () => {
57
+ nextTick(() => {
58
+ renderKey.value = Math.round(Math.random() * 1000000000).toString()
59
+ })
60
+ })
61
+
62
+ onBlokkliEvent('action:placed', (e) => {
63
+ if (e.action.actionType !== props.type) {
64
+ return
65
+ }
66
+
67
+ emit('placed', e)
68
+ })
69
+
70
+ defineTourItem(() => {
71
+ if (!props.description) {
72
+ return
73
+ }
74
+ return {
75
+ id: 'plugin:add_action:' + props.type,
76
+ title: props.title,
77
+ text: props.description,
78
+ element: () => item.value?.getElement(),
79
+ }
80
+ })
81
+ </script>
82
+
83
+ <script lang="ts">
84
+ export default {
85
+ name: 'PluginAddAction',
86
+ }
87
+ </script>
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <div class="bk bk-context-menu" :style="{ left: x + 'px', top: y + 'px' }">
3
+ <div ref="rootEl" class="bk-context-menu-inner" :style="innerStyle">
4
+ <div v-for="(item, i) in menu" :key="i">
5
+ <hr v-if="item.type === 'rule'" />
6
+ <button v-else-if="item.type === 'button'" @click="onClick(i)">
7
+ <Icon :name="item.icon" />
8
+ <span>{{ item.label }}</span>
9
+ </button>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import type { ContextMenu } from '#blokkli/types'
17
+ import { Icon } from '#blokkli/components'
18
+ import {
19
+ watch,
20
+ ref,
21
+ computed,
22
+ onMounted,
23
+ useBlokkli,
24
+ onBeforeUnmount,
25
+ } from '#imports'
26
+ import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
27
+
28
+ const props = defineProps<{
29
+ menu: ContextMenu[]
30
+ x: number
31
+ y: number
32
+ }>()
33
+
34
+ const emit = defineEmits(['close'])
35
+
36
+ const { ui, selection } = useBlokkli()
37
+
38
+ const rootEl = ref<HTMLDivElement | null>(null)
39
+
40
+ const innerStyle = computed(() => {
41
+ const horizontal =
42
+ props.x - 300 >
43
+ ui.visibleViewportPadded.value.x + ui.visibleViewportPadded.value.width
44
+ ? { right: 0 }
45
+ : { left: 0 }
46
+
47
+ const vertical =
48
+ props.y + 300 >
49
+ ui.visibleViewportPadded.value.y + ui.visibleViewportPadded.value.height
50
+ ? { bottom: 0 }
51
+ : { top: 0 }
52
+
53
+ return {
54
+ ...horizontal,
55
+ ...vertical,
56
+ }
57
+ })
58
+
59
+ onBlokkliEvent('keyPressed', (e) => {
60
+ if (e.code === 'Escape') {
61
+ emit('close')
62
+ }
63
+ })
64
+
65
+ watch(selection.uuids, () => emit('close'))
66
+
67
+ const onClick = (index: number) => {
68
+ const item = props.menu[index]
69
+ if (item && item.type === 'button') {
70
+ item.callback()
71
+ }
72
+ emit('close')
73
+ }
74
+
75
+ const onMouseDown = (e: MouseEvent) => {
76
+ if (!rootEl.value) {
77
+ return
78
+ }
79
+
80
+ if (
81
+ (e.target instanceof HTMLElement || e.target instanceof SVGElement) &&
82
+ !e.target.contains(rootEl.value)
83
+ ) {
84
+ emit('close')
85
+ }
86
+ }
87
+
88
+ onMounted(() => {
89
+ window.addEventListener('click', onMouseDown)
90
+ })
91
+
92
+ onBeforeUnmount(() => {
93
+ window.removeEventListener('click', onMouseDown)
94
+ })
95
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <Component :is="tag" @contextmenu.stop.prevent="onContextMenu">
3
+ <slot />
4
+ <Teleport to="body">
5
+ <Transition name="bk-context-menu">
6
+ <ContextMenuMenu
7
+ v-if="isVisible"
8
+ :menu="menu"
9
+ :x="x"
10
+ :y="y"
11
+ @close="ui.openContextMenu.value = ''"
12
+ />
13
+ </Transition>
14
+ </Teleport>
15
+ </Component>
16
+ </template>
17
+
18
+ <script lang="ts" setup>
19
+ import type { ContextMenu } from '#blokkli/types'
20
+ import { ref, computed, useBlokkli } from '#imports'
21
+ import ContextMenuMenu from './Menu/index.vue'
22
+
23
+ const props = withDefaults(
24
+ defineProps<{
25
+ id: string
26
+ menu: ContextMenu[]
27
+ tag?: string
28
+ }>(),
29
+ {
30
+ tag: 'div',
31
+ },
32
+ )
33
+
34
+ const { ui } = useBlokkli()
35
+
36
+ const isVisible = computed(() => ui.openContextMenu.value === props.id)
37
+
38
+ const x = ref(0)
39
+ const y = ref(0)
40
+
41
+ const onContextMenu = (e: MouseEvent) => {
42
+ if (!props.id || typeof props.id !== 'string' || !props.menu.length) {
43
+ return
44
+ }
45
+ x.value = e.clientX
46
+ y.value = e.clientY
47
+ ui.openContextMenu.value = props.id
48
+ }
49
+ </script>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <Teleport v-if="isVisible" to="body">
3
+ <slot />
4
+ </Teleport>
5
+ </template>
6
+
7
+ <script lang="ts" setup>
8
+ import { computed, onBeforeUnmount, onMounted, useBlokkli } from '#imports'
9
+
10
+ const props = defineProps<{
11
+ id: string
12
+ title: string
13
+ }>()
14
+
15
+ const { debug } = useBlokkli()
16
+
17
+ const isVisible = computed(
18
+ () =>
19
+ debug.isEnabled.value &&
20
+ debug.overlays.value.find((v) => v.id === props.id)?.active,
21
+ )
22
+
23
+ onMounted(() => {
24
+ debug.registerOverlay(props.id, props.title)
25
+ })
26
+
27
+ onBeforeUnmount(() => {
28
+ debug.unregisterOverlay(props.id)
29
+ })
30
+
31
+ defineOptions({
32
+ name: 'DebugOverlay',
33
+ })
34
+ </script>
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <Teleport to="body">
3
+ <transition name="bk-slide-in" :duration="200">
4
+ <FormOverlay
5
+ v-if="isVisible"
6
+ :id="id"
7
+ :title="title"
8
+ :icon="icon"
9
+ @close="onClose"
10
+ >
11
+ <slot />
12
+ <template #footer>
13
+ <button class="bk-button bk-is-primary" @click="onSubmit">
14
+ {{ $t('droppableEditFormSave', 'Save') }}
15
+ </button>
16
+ </template>
17
+ </FormOverlay>
18
+ </transition>
19
+ </Teleport>
20
+ </template>
21
+
22
+ <script setup lang="ts">
23
+ import { FormOverlay } from '#blokkli/components'
24
+ import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
25
+ import type { BlokkliIcon } from '#blokkli/icons'
26
+ import type { DroppableEntityField, DroppableFieldConfig } from '#blokkli/types'
27
+ import { ref, useBlokkli } from '#imports'
28
+
29
+ const props = defineProps<{
30
+ id: string
31
+ title: string
32
+ icon: BlokkliIcon
33
+ entityType: string
34
+ }>()
35
+
36
+ const emit = defineEmits<{
37
+ (e: 'save', data: DroppableEntityField): void
38
+ }>()
39
+
40
+ const { $t, types, state } = useBlokkli()
41
+
42
+ type DroppableField = {
43
+ field: DroppableEntityField
44
+ config: DroppableFieldConfig
45
+ }
46
+
47
+ const droppable = ref<DroppableField | null>(null)
48
+
49
+ const isVisible = ref(false)
50
+
51
+ const onClose = () => {
52
+ isVisible.value = false
53
+ }
54
+
55
+ const onSubmit = () => {
56
+ if (droppable.value) {
57
+ emit('save', droppable.value.field)
58
+ }
59
+ isVisible.value = false
60
+ droppable.value = null
61
+ }
62
+
63
+ onBlokkliEvent('droppable:focus', (field) => {
64
+ if (state.editMode.value !== 'editing') {
65
+ return
66
+ }
67
+ const config = types.getDroppableFieldConfig(field.fieldName, field.host)
68
+ if (config.allowedEntityType === props.entityType) {
69
+ isVisible.value = true
70
+ droppable.value = { field, config }
71
+ }
72
+ })
73
+ </script>