@blokkli/editor 2.0.0-alpha.2 → 2.0.0-alpha.21

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 (428) hide show
  1. package/dist/module.d.mts +1 -1
  2. package/dist/module.json +5 -5
  3. package/dist/module.mjs +5549 -1269
  4. package/dist/modules/drupal/graphql/base/fragment.ParagraphsBlokkliConfigInput.graphql +31 -0
  5. package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +9 -0
  6. package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +5 -0
  7. package/dist/modules/drupal/graphql/base/fragment.paragraphsFieldItem.graphql +9 -0
  8. package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +1 -10
  9. package/dist/modules/drupal/graphql/base/query.pbEntityConfig.graphql +5 -0
  10. package/dist/modules/drupal/graphql/features/comments.graphql +11 -8
  11. package/dist/modules/drupal/graphql/features/publishNew.graphql +1 -4
  12. package/dist/modules/drupal/graphql/features/scheduler.graphql +31 -0
  13. package/dist/modules/drupal/graphql/features/transform.graphql +9 -1
  14. package/dist/modules/drupal/graphql/features/transform_host.graphql +38 -0
  15. package/dist/modules/drupal/graphql/mutations/set_paragraph_schedule.graphql +15 -0
  16. package/dist/modules/drupal/graphql/mutations/update_host_options.graphql +15 -0
  17. package/dist/modules/drupal/index.d.mts +1 -1
  18. package/dist/modules/drupal/index.mjs +79 -9
  19. package/dist/modules/drupal/runtime/adapter/index.d.ts +3 -0
  20. package/dist/modules/drupal/{adapter/index.mjs → runtime/adapter/index.js} +166 -20
  21. package/dist/runtime/adapter/index.d.ts +111 -1
  22. package/dist/runtime/blokkliPlugins/AddAction/index.vue +27 -3
  23. package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue +65 -0
  24. package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue.d.ts +26 -0
  25. package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +6 -0
  26. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +3 -2
  27. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +2 -19
  28. package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +2 -7
  29. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +3 -3
  30. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue.d.ts +2 -19
  31. package/dist/runtime/blokkliPlugins/ItemAction/index.vue +23 -15
  32. package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +21 -44
  33. package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +49 -11
  34. package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +29 -15
  35. package/dist/runtime/blokkliPlugins/MenuButton/index.vue.d.ts +3 -3
  36. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +6 -7
  37. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue.d.ts +2 -51
  38. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +2 -9
  39. package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +15 -9
  40. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +1 -1
  41. package/dist/runtime/blokkliPlugins/TourItem/index.vue +10 -5
  42. package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +2 -4
  43. package/dist/runtime/blokkliPlugins/ViewOption/index.vue +6 -3
  44. package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +4 -3
  45. package/dist/runtime/blokkliPlugins/index.d.ts +8 -7
  46. package/dist/runtime/blokkliPlugins/index.js +15 -13
  47. package/dist/runtime/components/Blocks/Fragment/icon.svg +1 -1
  48. package/dist/runtime/components/Blocks/FromLibrary/index.vue +4 -2
  49. package/dist/runtime/components/BlokkliEditable.vue +34 -16
  50. package/dist/runtime/components/BlokkliEditable.vue.d.ts +2 -1
  51. package/dist/runtime/components/BlokkliField.vue +31 -27
  52. package/dist/runtime/components/BlokkliField.vue.d.ts +61 -17
  53. package/dist/runtime/components/BlokkliItem.vue +2 -2
  54. package/dist/runtime/components/BlokkliItem.vue.d.ts +4 -2
  55. package/dist/runtime/components/BlokkliProvider.vue +60 -45
  56. package/dist/runtime/components/BlokkliProvider.vue.d.ts +45 -7
  57. package/dist/runtime/components/Edit/Actions/index.vue +69 -78
  58. package/dist/runtime/components/Edit/AddListItem/index.vue +2 -5
  59. package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +1 -1
  60. package/dist/runtime/components/Edit/AddListItemIcon/index.vue +19 -0
  61. package/dist/runtime/components/Edit/AddListItemIcon/index.vue.d.ts +15 -0
  62. package/dist/runtime/components/Edit/AnimationCanvas/index.vue +436 -25
  63. package/dist/runtime/components/Edit/AppMenu/index.vue +5 -5
  64. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +83 -0
  65. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue.d.ts +32 -0
  66. package/dist/runtime/components/Edit/Banner/index.vue +51 -0
  67. package/dist/runtime/components/Edit/Banner/index.vue.d.ts +18 -0
  68. package/dist/runtime/components/Edit/BlockProxy/index.vue +3 -1
  69. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue.d.ts +2 -13
  70. package/dist/runtime/components/Edit/Dialog/index.vue +14 -5
  71. package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +4 -2
  72. package/dist/runtime/components/Edit/DiffViewer/State.vue +276 -0
  73. package/dist/runtime/components/Edit/DiffViewer/State.vue.d.ts +16 -0
  74. package/dist/runtime/components/Edit/DraggableList.vue +20 -50
  75. package/dist/runtime/components/Edit/DraggableList.vue.d.ts +7 -7
  76. package/dist/runtime/components/Edit/EditIndicator.vue +118 -44
  77. package/dist/runtime/components/Edit/EditIndicator.vue.d.ts +3 -0
  78. package/dist/runtime/components/Edit/EditProvider.vue +192 -80
  79. package/dist/runtime/components/Edit/EditProvider.vue.d.ts +3 -0
  80. package/dist/runtime/components/Edit/Features/AddList/index.vue +24 -36
  81. package/dist/runtime/components/Edit/Features/Analyze/Overlay/fragment.glsl +58 -0
  82. package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +170 -0
  83. package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue.d.ts +9 -0
  84. package/dist/runtime/components/Edit/Features/Analyze/Overlay/vertex.glsl +72 -0
  85. package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue +159 -0
  86. package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue.d.ts +7 -0
  87. package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue +100 -0
  88. package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue.d.ts +6 -0
  89. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue +56 -0
  90. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue.d.ts +3 -0
  91. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue +87 -0
  92. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue.d.ts +7 -0
  93. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +105 -0
  94. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue.d.ts +8 -0
  95. package/dist/runtime/components/Edit/Features/Analyze/Results/Status.vue +18 -0
  96. package/dist/runtime/components/Edit/Features/Analyze/Results/Status.vue.d.ts +8 -0
  97. package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue +92 -0
  98. package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue.d.ts +17 -0
  99. package/dist/runtime/components/Edit/Features/Analyze/Summary/index.vue +77 -0
  100. package/dist/runtime/components/Edit/Features/Analyze/Summary/index.vue.d.ts +6 -0
  101. package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.d.ts +12 -0
  102. package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.js +75 -0
  103. package/dist/runtime/components/Edit/Features/Analyze/analyzers/defineAnalyzer.d.ts +4 -0
  104. package/dist/runtime/components/Edit/Features/Analyze/analyzers/defineAnalyzer.js +5 -0
  105. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.d.ts +32 -0
  106. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.js +45 -0
  107. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/collectTextElements.d.ts +5 -0
  108. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/collectTextElements.js +95 -0
  109. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/normalizeArray.d.ts +3 -0
  110. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/normalizeArray.js +13 -0
  111. package/dist/runtime/components/Edit/Features/Analyze/analyzers/index.d.ts +2 -0
  112. package/dist/runtime/components/Edit/Features/Analyze/analyzers/index.js +2 -0
  113. package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.d.ts +2 -0
  114. package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.js +165 -0
  115. package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.d.ts +44 -0
  116. package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.js +0 -0
  117. package/dist/runtime/components/Edit/Features/Analyze/helper.d.ts +5 -0
  118. package/dist/runtime/components/Edit/Features/Analyze/helper.js +28 -0
  119. package/dist/runtime/components/Edit/Features/Analyze/index.vue +44 -0
  120. package/dist/runtime/components/Edit/Features/Anchors/Renderer.vue +53 -0
  121. package/dist/runtime/components/Edit/Features/Anchors/index.vue +32 -0
  122. package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +25 -13
  123. package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +299 -0
  124. package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue.d.ts +7 -0
  125. package/dist/runtime/components/Edit/Features/Artboard/index.vue +10 -217
  126. package/dist/runtime/components/Edit/Features/Assistant/index.vue +5 -3
  127. package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +33 -57
  128. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue +154 -0
  129. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue.d.ts +27 -0
  130. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +222 -0
  131. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue.d.ts +11 -0
  132. package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +96 -0
  133. package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue.d.ts +2 -0
  134. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +177 -46
  135. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +51 -0
  136. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue.d.ts +17 -0
  137. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +48 -117
  138. package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +5 -2
  139. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +35 -20
  140. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue.d.ts +5 -3
  141. package/dist/runtime/components/Edit/Features/Comments/CommentInput/index.vue +29 -0
  142. package/dist/runtime/components/Edit/Features/Comments/CommentInput/index.vue.d.ts +13 -0
  143. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +22 -16
  144. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue.d.ts +1 -0
  145. package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +15 -6
  146. package/dist/runtime/components/Edit/Features/Comments/index.vue +21 -9
  147. package/dist/runtime/components/Edit/Features/Conversions/index.vue +16 -21
  148. package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +26 -35
  149. package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +240 -0
  150. package/dist/runtime/components/Edit/Features/Debug/Renderer.vue.d.ts +6 -0
  151. package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue +14 -0
  152. package/dist/runtime/components/Edit/Features/Debug/index.vue +7 -162
  153. package/dist/runtime/components/Edit/Features/Delete/index.vue +1 -1
  154. package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +13 -190
  155. package/dist/runtime/components/Edit/Features/Diff/index.vue +2 -2
  156. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +18 -10
  157. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +8 -2
  158. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +111 -121
  159. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue.d.ts +3 -132
  160. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/vertex.glsl +2 -1
  161. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +87 -61
  162. package/dist/runtime/components/Edit/Features/Duplicate/index.vue +6 -8
  163. package/dist/runtime/components/Edit/Features/Edit/index.vue +16 -22
  164. package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +3 -3
  165. package/dist/runtime/components/Edit/Features/EditForm/index.vue +10 -9
  166. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +69 -4
  167. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +2 -2
  168. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +13 -9
  169. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +45 -87
  170. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +2 -2
  171. package/dist/runtime/components/Edit/Features/EditableField/index.vue +45 -43
  172. package/dist/runtime/components/Edit/Features/EditableMask/index.vue +3 -20
  173. package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +33 -1
  174. package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +11 -9
  175. package/dist/runtime/components/Edit/Features/Fragments/index.vue +8 -6
  176. package/dist/runtime/components/Edit/Features/History/index.vue +39 -13
  177. package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +139 -0
  178. package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue +261 -0
  179. package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue.d.ts +6 -0
  180. package/dist/runtime/components/Edit/Features/Hover/Overlay/vertex.glsl +117 -0
  181. package/dist/runtime/components/Edit/Features/Hover/index.vue +25 -0
  182. package/dist/runtime/components/Edit/Features/Hover/index.vue.d.ts +2 -0
  183. package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +6 -2
  184. package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +3 -2
  185. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +5 -7
  186. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +19 -27
  187. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +32 -28
  188. package/dist/runtime/components/Edit/Features/Library/index.vue +40 -32
  189. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +11 -11
  190. package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +15 -12
  191. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/fragment.glsl +1 -1
  192. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +44 -32
  193. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/vertex.glsl +1 -1
  194. package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +10 -18
  195. package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue +3 -2
  196. package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue.d.ts +2 -0
  197. package/dist/runtime/components/Edit/Features/Options/Form/Group.vue.d.ts +2 -11
  198. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +14 -3
  199. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +0 -1
  200. package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +37 -19
  201. package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue.d.ts +8 -2
  202. package/dist/runtime/components/Edit/Features/Options/Form/index.vue +88 -42
  203. package/dist/runtime/components/Edit/Features/Options/Form/index.vue.d.ts +5 -5
  204. package/dist/runtime/components/Edit/Features/Options/index.vue +35 -11
  205. package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue +35 -0
  206. package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue.d.ts +6 -0
  207. package/dist/runtime/components/Edit/Features/Ownership/index.vue +7 -25
  208. package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +3 -3
  209. package/dist/runtime/components/Edit/Features/ProxyView/index.vue +5 -1
  210. package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue +41 -14
  211. package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue.d.ts +2 -0
  212. package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue +47 -0
  213. package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue.d.ts +19 -0
  214. package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue +83 -0
  215. package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue.d.ts +9 -0
  216. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +439 -123
  217. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue.d.ts +3 -14
  218. package/dist/runtime/components/Edit/Features/Publish/index.vue +57 -24
  219. package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue.d.ts +2 -13
  220. package/dist/runtime/components/Edit/Features/Revert/index.vue +3 -3
  221. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +15 -15
  222. package/dist/runtime/components/Edit/Features/Search/index.vue +7 -3
  223. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +85 -0
  224. package/dist/runtime/components/Edit/Features/{CommandPalette/Palette/Group → Selection/AddButtons/Overlay}/index.vue.d.ts +8 -13
  225. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +106 -0
  226. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +440 -0
  227. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue.d.ts +32 -0
  228. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +102 -0
  229. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +387 -0
  230. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +6 -0
  231. package/dist/runtime/components/Edit/Features/Selection/Overlay/fragment.glsl +15 -10
  232. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +105 -25
  233. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +5 -3
  234. package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +12 -3
  235. package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +2 -2
  236. package/dist/runtime/components/Edit/Features/Selection/index.vue +135 -25
  237. package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +12 -17
  238. package/dist/runtime/components/Edit/Features/Settings/index.vue +11 -25
  239. package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +2 -2
  240. package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +13 -6
  241. package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +5 -1
  242. package/dist/runtime/components/Edit/Features/Theme/index.vue +2 -1
  243. package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +3 -2
  244. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +3 -0
  245. package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +198 -0
  246. package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue.d.ts +13 -0
  247. package/dist/runtime/components/Edit/Features/Transform/index.vue +156 -70
  248. package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +17 -11
  249. package/dist/runtime/components/Edit/Features/Translations/index.vue +20 -23
  250. package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +5 -5
  251. package/dist/runtime/components/Edit/Features/index.vue +17 -7
  252. package/dist/runtime/components/Edit/Form/Datepicker/index.vue +198 -0
  253. package/dist/runtime/components/Edit/Form/Datepicker/index.vue.d.ts +15 -0
  254. package/dist/runtime/components/Edit/Form/Group/index.vue.d.ts +2 -4
  255. package/dist/runtime/components/Edit/Form/Item/index.vue.d.ts +2 -4
  256. package/dist/runtime/components/Edit/Form/Radio/index.vue +33 -0
  257. package/dist/runtime/components/Edit/Form/Radio/index.vue.d.ts +20 -0
  258. package/dist/runtime/components/Edit/Form/RadioTabs/index.vue +37 -0
  259. package/dist/runtime/components/Edit/Form/RadioTabs/index.vue.d.ts +22 -0
  260. package/dist/runtime/components/Edit/Form/Select/index.vue +29 -0
  261. package/dist/runtime/components/Edit/Form/Select/index.vue.d.ts +20 -0
  262. package/dist/runtime/components/Edit/Form/Text/index.vue +34 -0
  263. package/dist/runtime/components/Edit/Form/Text/index.vue.d.ts +20 -0
  264. package/dist/runtime/components/Edit/Form/Textarea/index.vue +13 -6
  265. package/dist/runtime/components/Edit/Form/Textarea/index.vue.d.ts +4 -0
  266. package/dist/runtime/components/Edit/Form/Toggle/index.vue +4 -3
  267. package/dist/runtime/components/Edit/Form/Toggle/index.vue.d.ts +12 -2
  268. package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
  269. package/dist/runtime/components/Edit/FormOverlay/index.vue.d.ts +3 -2
  270. package/dist/runtime/components/Edit/Indicators/index.vue +123 -0
  271. package/dist/runtime/components/Edit/Indicators/index.vue.d.ts +2 -0
  272. package/dist/runtime/components/Edit/InfoBox/index.vue +6 -2
  273. package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +12 -2
  274. package/dist/runtime/components/Edit/ItemIcon/index.vue +2 -1
  275. package/dist/runtime/components/Edit/Konami/Game/PixelGrid.vue +66 -0
  276. package/dist/runtime/components/Edit/Konami/Game/PixelGrid.vue.d.ts +7 -0
  277. package/dist/runtime/components/Edit/Konami/Game/blokkli.png +0 -0
  278. package/dist/runtime/components/Edit/Konami/Game/charmap.d.ts +2 -0
  279. package/dist/runtime/components/Edit/Konami/Game/charmap.js +168 -0
  280. package/dist/runtime/components/Edit/Konami/Game/index.vue +752 -0
  281. package/dist/runtime/components/Edit/Konami/Game/index.vue.d.ts +6 -0
  282. package/dist/runtime/components/Edit/Konami/Game/textRendering.d.ts +8 -0
  283. package/dist/runtime/components/Edit/Konami/Game/textRendering.js +138 -0
  284. package/dist/runtime/components/Edit/Konami/Game/useIconRendering.d.ts +9 -0
  285. package/dist/runtime/components/Edit/Konami/Game/useIconRendering.js +130 -0
  286. package/dist/runtime/components/Edit/Konami/index.vue +44 -0
  287. package/dist/runtime/components/Edit/Konami/index.vue.d.ts +2 -0
  288. package/dist/runtime/components/Edit/Loading/index.vue +6 -2
  289. package/dist/runtime/components/Edit/Loading/index.vue.d.ts +2 -0
  290. package/dist/runtime/components/Edit/Messages/index.vue +8 -3
  291. package/dist/runtime/components/Edit/PluginConfigForm/Checkbox/index.vue +17 -0
  292. package/dist/runtime/components/Edit/PluginConfigForm/Checkbox/index.vue.d.ts +11 -0
  293. package/dist/runtime/components/Edit/PluginConfigForm/Options/index.vue +37 -0
  294. package/dist/runtime/components/Edit/PluginConfigForm/Options/index.vue.d.ts +11 -0
  295. package/dist/runtime/components/Edit/PluginConfigForm/Text/index.vue +43 -0
  296. package/dist/runtime/components/Edit/PluginConfigForm/Text/index.vue.d.ts +11 -0
  297. package/dist/runtime/components/Edit/PluginConfigForm/index.vue +57 -0
  298. package/dist/runtime/components/Edit/PluginConfigForm/index.vue.d.ts +16 -0
  299. package/dist/runtime/components/Edit/PreviewProvider.vue +3 -4
  300. package/dist/runtime/components/Edit/RelativeTime/index.vue +3 -2
  301. package/dist/runtime/components/Edit/RelativeTime/index.vue.d.ts +2 -2
  302. package/dist/runtime/components/Edit/Resizable/index.vue.d.ts +1 -1
  303. package/dist/runtime/components/Edit/ScaleToFit/index.vue.d.ts +1 -1
  304. package/dist/runtime/components/Edit/ScheduleDate/index.vue +131 -0
  305. package/dist/runtime/components/Edit/ScheduleDate/index.vue.d.ts +23 -0
  306. package/dist/runtime/components/Edit/ScrollBoundary/index.vue.d.ts +2 -7
  307. package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +11 -3
  308. package/dist/runtime/components/Edit/Sortli/index.vue.d.ts +1 -1
  309. package/dist/runtime/components/Edit/SystemRequirements/index.vue +3 -3
  310. package/dist/runtime/components/Edit/Toolbar/index.vue +3 -2
  311. package/dist/runtime/components/Edit/Transition/Height.vue +95 -0
  312. package/dist/runtime/components/Edit/Transition/Height.vue.d.ts +36 -0
  313. package/dist/runtime/components/Edit/Transition/index.vue +41 -0
  314. package/dist/runtime/components/Edit/Transition/index.vue.d.ts +19 -0
  315. package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue.d.ts +2 -7
  316. package/dist/runtime/components/Edit/index.d.ts +28 -15
  317. package/dist/runtime/components/Edit/index.js +54 -28
  318. package/dist/runtime/composables/defineBlokkli.js +16 -3
  319. package/dist/runtime/composables/defineBlokkliFeature.d.ts +4 -7
  320. package/dist/runtime/composables/defineBlokkliFragment.js +8 -1
  321. package/dist/runtime/composables/defineBlokkliProvider.d.ts +11 -0
  322. package/dist/runtime/composables/defineBlokkliProvider.js +46 -0
  323. package/dist/runtime/composables/useBlokkliHelper.d.ts +19 -0
  324. package/dist/runtime/composables/useBlokkliHelper.js +95 -0
  325. package/dist/runtime/constants/index.d.ts +3 -0
  326. package/dist/runtime/constants/index.js +3 -0
  327. package/dist/runtime/css/output.css +1 -1
  328. package/dist/runtime/helpers/addElementClasses.d.ts +2 -0
  329. package/dist/runtime/helpers/addElementClasses.js +24 -0
  330. package/dist/runtime/helpers/animationProvider.d.ts +38 -2
  331. package/dist/runtime/helpers/animationProvider.js +188 -47
  332. package/dist/runtime/helpers/bundles/index.d.ts +1 -0
  333. package/dist/runtime/helpers/bundles/index.js +4 -0
  334. package/dist/runtime/helpers/composables/defineRenderer.d.ts +8 -0
  335. package/dist/runtime/helpers/composables/defineRenderer.js +8 -0
  336. package/dist/runtime/helpers/composables/useBlockRegistration.d.ts +5 -0
  337. package/dist/runtime/helpers/composables/useBlockRegistration.js +23 -0
  338. package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.d.ts +1 -1
  339. package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.js +3 -2
  340. package/dist/runtime/helpers/composables/useStateBasedCache.d.ts +4 -0
  341. package/dist/runtime/helpers/composables/useStateBasedCache.js +13 -0
  342. package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +23 -0
  343. package/dist/runtime/helpers/composables/useStickyToolbar.js +233 -0
  344. package/dist/runtime/helpers/definitionProvider.d.ts +3 -2
  345. package/dist/runtime/helpers/definitionProvider.js +17 -0
  346. package/dist/runtime/helpers/dom/index.d.ts +60 -0
  347. package/dist/runtime/helpers/dom/index.js +48 -0
  348. package/dist/runtime/helpers/domProvider.d.ts +58 -17
  349. package/dist/runtime/helpers/domProvider.js +320 -245
  350. package/dist/runtime/helpers/dropTargets/index.d.ts +6 -0
  351. package/dist/runtime/helpers/dropTargets/index.js +49 -0
  352. package/dist/runtime/helpers/eventBus.d.ts +1 -1
  353. package/dist/runtime/helpers/eventBus.js +2 -2
  354. package/dist/runtime/helpers/index.d.ts +10 -14
  355. package/dist/runtime/helpers/index.js +58 -121
  356. package/dist/runtime/helpers/indicatorsProvider.d.ts +10 -0
  357. package/dist/runtime/helpers/indicatorsProvider.js +23 -0
  358. package/dist/runtime/helpers/keyboardProvider.d.ts +2 -0
  359. package/dist/runtime/helpers/keyboardProvider.js +17 -1
  360. package/dist/runtime/helpers/pluginProvider.d.ts +10 -0
  361. package/dist/runtime/helpers/pluginProvider.js +33 -0
  362. package/dist/runtime/helpers/providers/blocks.d.ts +10 -0
  363. package/dist/runtime/helpers/providers/blocks.js +91 -0
  364. package/dist/runtime/helpers/providers/directive.d.ts +25 -0
  365. package/dist/runtime/helpers/providers/directive.js +208 -0
  366. package/dist/runtime/helpers/providers/element.d.ts +6 -0
  367. package/dist/runtime/helpers/providers/element.js +35 -0
  368. package/dist/runtime/helpers/providers/fields.d.ts +8 -0
  369. package/dist/runtime/helpers/providers/fields.js +47 -0
  370. package/dist/runtime/helpers/renderCycle.d.ts +1 -0
  371. package/dist/runtime/helpers/renderCycle.js +10 -0
  372. package/dist/runtime/helpers/runtimeHelpers/index.js +15 -12
  373. package/dist/runtime/helpers/selectionProvider.d.ts +27 -11
  374. package/dist/runtime/helpers/selectionProvider.js +79 -74
  375. package/dist/runtime/helpers/stateProvider.d.ts +12 -2
  376. package/dist/runtime/helpers/stateProvider.js +164 -20
  377. package/dist/runtime/helpers/storageProvider.d.ts +5 -3
  378. package/dist/runtime/helpers/storageProvider.js +61 -4
  379. package/dist/runtime/helpers/symbols.d.ts +2 -0
  380. package/dist/runtime/helpers/symbols.js +2 -0
  381. package/dist/runtime/helpers/textProvider.js +6 -0
  382. package/dist/runtime/helpers/themeProvider.d.ts +4 -1
  383. package/dist/runtime/helpers/themeProvider.js +28 -15
  384. package/dist/runtime/helpers/transform.js +1 -3
  385. package/dist/runtime/helpers/typesProvider.js +10 -26
  386. package/dist/runtime/helpers/uiProvider.d.ts +18 -3
  387. package/dist/runtime/helpers/uiProvider.js +114 -61
  388. package/dist/runtime/helpers/useTransitionedValue.d.ts +18 -0
  389. package/dist/runtime/helpers/useTransitionedValue.js +57 -0
  390. package/dist/runtime/helpers/webgl/index.d.ts +11 -2
  391. package/dist/runtime/helpers/webgl/index.js +162 -7
  392. package/dist/runtime/icons/anchor.svg +1 -0
  393. package/dist/runtime/icons/arrow-left.svg +1 -1
  394. package/dist/runtime/icons/arrow-right.svg +1 -1
  395. package/dist/runtime/icons/arrow-top-right.svg +1 -0
  396. package/dist/runtime/icons/calendar-clock.svg +1 -0
  397. package/dist/runtime/icons/calendar.svg +1 -0
  398. package/dist/runtime/icons/chart.svg +1 -0
  399. package/dist/runtime/icons/clock.svg +1 -0
  400. package/dist/runtime/icons/comment_add.svg +1 -5
  401. package/dist/runtime/icons/copy.svg +1 -0
  402. package/dist/runtime/icons/cursor-move.svg +1 -1
  403. package/dist/runtime/icons/delete.svg +1 -8
  404. package/dist/runtime/icons/diff.svg +1 -1
  405. package/dist/runtime/icons/duplicate.svg +1 -12
  406. package/dist/runtime/icons/edit.svg +1 -8
  407. package/dist/runtime/icons/eye-off.svg +1 -0
  408. package/dist/runtime/icons/eye.svg +1 -1
  409. package/dist/runtime/icons/info.svg +1 -1
  410. package/dist/runtime/icons/link.svg +1 -0
  411. package/dist/runtime/icons/reusable.svg +1 -5
  412. package/dist/runtime/icons/speedometer.svg +1 -0
  413. package/dist/runtime/plugins/blokkliDirectives.js +109 -0
  414. package/dist/runtime/types/blokkOptions.d.ts +8 -0
  415. package/dist/runtime/types/index.d.ts +278 -42
  416. package/dist/runtime/types/theme.d.ts +2 -1
  417. package/dist/shared/{editor.gz_ac6uT.d.mts → editor.CKsrTpc1.d.mts} +1 -1
  418. package/package.json +55 -38
  419. package/dist/modules/drupal/adapter/index.d.mts +0 -6
  420. package/dist/runtime/components/Edit/DragInteractions/index.vue +0 -364
  421. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +0 -51
  422. package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue +0 -22
  423. package/dist/runtime/components/Edit/Features/FieldAreas/index.vue +0 -41
  424. package/dist/runtime/plugins/blokkliEditable.js +0 -31
  425. /package/dist/runtime/components/Edit/{DragInteractions → Features/Analyze}/index.vue.d.ts +0 -0
  426. /package/dist/runtime/components/Edit/Features/{FieldAreas/Overlay/index.vue.d.ts → Anchors/Renderer.vue.d.ts} +0 -0
  427. /package/dist/runtime/components/Edit/Features/{FieldAreas → Anchors}/index.vue.d.ts +0 -0
  428. /package/dist/runtime/plugins/{blokkliEditable.d.ts → blokkliDirectives.d.ts} +0 -0
@@ -1,72 +1,52 @@
1
1
  import { reactive, ref, computed } from "#imports";
2
- import {
3
- findClosestBlock,
4
- buildDraggableItem,
5
- falsy,
6
- mapDroppableField,
7
- findClosestEntityContext
8
- } from "#blokkli/helpers";
2
+ import { falsy } from "#blokkli/helpers";
9
3
  import { cloneElementWithStyles } from "./dom/index.js";
10
4
  import onBlokkliEvent from "./composables/onBlokkliEvent.js";
11
5
  import useDelayedIntersectionObserver from "./composables/useDelayedIntersectionObserver.js";
12
- const buildFieldElement = (element) => {
13
- const key = element.dataset.fieldKey;
14
- const name = element.dataset.fieldName;
15
- const label = element.dataset.fieldLabel;
16
- const isNested = element.dataset.fieldIsNested === "true";
17
- const nestingLevel = Number.parseInt(element.dataset.bkNestingLevel || "0");
18
- const fieldListType = element.dataset.fieldListType;
19
- const hostEntityType = element.dataset.hostEntityType;
20
- const hostEntityBundle = element.dataset.hostEntityBundle;
21
- const hostEntityUuid = element.dataset.hostEntityUuid;
22
- const dropAlignment = element.dataset.fieldDropAlignment;
23
- const cardinality = Number.parseInt(element.dataset.fieldCardinality || "-1");
24
- const allowedBundles = (element.dataset.fieldAllowedBundles || "").split(",").filter(Boolean);
25
- const allowedFragments = (element.dataset.allowedFragments || "").split(",").filter(Boolean);
26
- if (key && name && label && hostEntityType && hostEntityUuid && hostEntityBundle && fieldListType) {
27
- return {
28
- key,
29
- name,
30
- label,
31
- isNested,
32
- nestingLevel,
33
- hostEntityType,
34
- hostEntityUuid,
35
- hostEntityBundle,
36
- cardinality: Number.isNaN(cardinality) ? -1 : cardinality,
37
- allowedBundles,
38
- allowedFragments,
39
- fieldListType,
40
- element,
41
- dropAlignment: dropAlignment === "vertical" || dropAlignment === "horizontal" ? dropAlignment : void 0
42
- };
43
- }
44
- };
6
+ import { itemEntityType } from "#blokkli-build/config";
45
7
  function rectWithTime(rect, time) {
46
8
  return {
47
9
  ...rect,
48
10
  time: time || performance.now()
49
11
  };
50
12
  }
51
- export default function(ui, debug, definitions) {
52
- const artboardElement = ui.artboardElement();
13
+ export default function(ui, debug, definitions, state, element) {
53
14
  const logger = debug.createLogger("DomProvider");
54
15
  const mutationsReady = ref(true);
55
16
  const intersectionReady = ref(false);
17
+ const registeredBlocks = reactive({});
18
+ const registeredFields = reactive({});
56
19
  const visibleBlocks = /* @__PURE__ */ new Set();
57
20
  const visibleFields = /* @__PURE__ */ new Set();
21
+ const fieldElementToFieldKey = /* @__PURE__ */ new WeakMap();
22
+ const blockElementToUuid = /* @__PURE__ */ new WeakMap();
58
23
  const blockRects = {};
59
24
  const fieldRects = {};
60
- let draggableBlockCache = {};
25
+ const blockUuidCurrentKey = {};
26
+ const observedElements = {};
27
+ let initTimeout = null;
28
+ const isInitalizing = ref(true);
29
+ const observedElementCache = /* @__PURE__ */ new Map();
30
+ const registeredBlockUuids = computed(() => {
31
+ return Object.entries(registeredBlocks).map(([uuid, element2]) => {
32
+ if (element2) {
33
+ return uuid;
34
+ }
35
+ return null;
36
+ }).filter(falsy);
37
+ });
61
38
  const resizeObserver = new ResizeObserver(function(entries) {
62
39
  for (const entry of entries) {
63
40
  if (!(entry.target instanceof HTMLElement)) {
64
41
  return;
65
42
  }
66
- const uuid = entry.target.dataset.uuid || entry.target.closest("[data-uuid]")?.dataset.uuid;
43
+ const uuid = blockElementToUuid.get(entry.target);
67
44
  if (!uuid) {
68
45
  return;
69
46
  }
47
+ if (!registeredBlocks[uuid]) {
48
+ continue;
49
+ }
70
50
  const currentRect = blockRects[uuid];
71
51
  const now = performance.now();
72
52
  if (!currentRect) {
@@ -93,42 +73,52 @@ export default function(ui, debug, definitions) {
93
73
  const scale = ui.artboardScale.value;
94
74
  const offset = ui.artboardOffset.value;
95
75
  for (const entry of entries) {
96
- if (entry.target instanceof HTMLElement) {
97
- const uuid = entry.target.dataset.uuid || entry.target.closest("[data-uuid]")?.dataset.uuid;
98
- const fieldKey = entry.target.dataset.fieldKey;
99
- const rect = entry.target.getBoundingClientRect();
100
- if (fieldKey) {
101
- if (entry.isIntersecting) {
102
- visibleFields.add(fieldKey);
103
- } else {
104
- visibleFields.delete(fieldKey);
105
- }
106
- fieldRects[fieldKey] = ui.getAbsoluteElementRect(rect, scale, offset);
107
- } else if (uuid) {
108
- const newRect = ui.getAbsoluteElementRect(rect, scale, offset);
109
- const currentRect = blockRects[uuid];
110
- if (currentRect) {
111
- if (currentRect.time > entry.time) {
112
- blockRects[uuid].x = newRect.x;
113
- blockRects[uuid].y = newRect.y;
114
- } else {
115
- blockRects[uuid] = rectWithTime(newRect, entry.time);
116
- }
117
- } else {
118
- blockRects[uuid] = rectWithTime(newRect, entry.time);
119
- }
120
- if (entry.isIntersecting) {
121
- visibleBlocks.add(uuid);
122
- } else {
123
- visibleBlocks.delete(uuid);
124
- }
76
+ if (!(entry.target instanceof HTMLElement)) {
77
+ continue;
78
+ }
79
+ const fieldKey = fieldElementToFieldKey.get(entry.target);
80
+ const rect = entry.target.getBoundingClientRect();
81
+ if (fieldKey) {
82
+ if (entry.isIntersecting) {
83
+ visibleFields.add(fieldKey);
84
+ } else {
85
+ visibleFields.delete(fieldKey);
86
+ }
87
+ fieldRects[fieldKey] = ui.getAbsoluteElementRect(rect, scale, offset);
88
+ continue;
89
+ }
90
+ const uuid = blockElementToUuid.get(entry.target);
91
+ if (!uuid) {
92
+ continue;
93
+ }
94
+ if (!registeredBlocks[uuid]) {
95
+ continue;
96
+ }
97
+ const newRect = ui.getAbsoluteElementRect(rect, scale, offset);
98
+ const currentRect = blockRects[uuid];
99
+ if (currentRect) {
100
+ if (currentRect.time > entry.time) {
101
+ blockRects[uuid].x = newRect.x;
102
+ blockRects[uuid].y = newRect.y;
103
+ } else {
104
+ blockRects[uuid] = rectWithTime(newRect, entry.time);
125
105
  }
106
+ } else {
107
+ blockRects[uuid] = rectWithTime(newRect, entry.time);
108
+ }
109
+ if (entry.isIntersecting) {
110
+ visibleBlocks.add(uuid);
111
+ } else {
112
+ visibleBlocks.delete(uuid);
126
113
  }
127
114
  }
128
115
  }
129
- const intersectionObserver = useDelayedIntersectionObserver(intersectionCallback);
130
- const registeredBlocks = reactive({});
131
- const registeredFields = reactive({});
116
+ const intersectionObserver = useDelayedIntersectionObserver(
117
+ intersectionCallback,
118
+ {
119
+ rootMargin: "400px 0px 400px 0px"
120
+ }
121
+ );
132
122
  const registeredFieldTypes = computed(() => {
133
123
  const fields = Object.values(registeredFields);
134
124
  const found = /* @__PURE__ */ new Set();
@@ -149,33 +139,56 @@ export default function(ui, debug, definitions) {
149
139
  }
150
140
  return uniqueFieldTypes;
151
141
  });
152
- const registerField = (entity, fieldName, element) => {
142
+ const registerField = (entity, fieldName, element2, data) => {
153
143
  const key = `${entity.uuid}:${fieldName}`;
154
- registeredFields[key] = { element, entity, fieldName };
155
- intersectionObserver.observe(element);
144
+ registeredFields[key] = {
145
+ element: element2,
146
+ entity,
147
+ fieldName,
148
+ ...data
149
+ };
150
+ intersectionObserver.observe(element2);
151
+ fieldElementToFieldKey.set(element2, key);
152
+ doInitTimeout();
156
153
  };
157
- const updateFieldElement = (entity, fieldName, element) => {
154
+ const updateFieldElement = (entity, fieldName, element2, data) => {
158
155
  const key = `${entity.uuid}:${fieldName}`;
159
156
  const existingElement = registeredFields[key]?.element;
160
157
  if (existingElement) {
161
158
  intersectionObserver.unobserve(existingElement);
162
159
  }
163
- registeredFields[key] = { entity, fieldName, element };
164
- intersectionObserver.observe(element);
160
+ registeredFields[key] = {
161
+ entity,
162
+ fieldName,
163
+ element: element2,
164
+ ...data
165
+ };
166
+ fieldElementToFieldKey.set(element2, key);
167
+ intersectionObserver.observe(element2);
165
168
  };
166
169
  const unregisterField = (entity, fieldName) => {
167
170
  const key = `${entity.uuid}:${fieldName}`;
168
171
  const el = registeredFields[key]?.element;
169
172
  if (el) {
170
173
  intersectionObserver.unobserve(el);
174
+ fieldElementToFieldKey.delete(el);
171
175
  }
172
176
  visibleFields.delete(key);
173
177
  registeredFields[key] = void 0;
174
178
  };
175
- function getElementToObserve(el, bundle, fieldListType, parentBlockBundle) {
179
+ const getRegisteredField = (uuid, fieldName) => {
180
+ const key = `${uuid}:${fieldName}`;
181
+ return registeredFields[key];
182
+ };
183
+ function getElementToObserve(uuid, el, bundle, fieldListType, parentBlockBundle) {
176
184
  if (el.classList.contains("bk-block-proxy")) {
177
185
  return el;
178
186
  }
187
+ const key = `${uuid}${bundle}${fieldListType}${parentBlockBundle ?? "none"}`;
188
+ const cached = observedElementCache.get(key);
189
+ if (cached) {
190
+ return cached;
191
+ }
179
192
  const definition = definitions.getBlockDefinition(
180
193
  bundle,
181
194
  fieldListType,
@@ -186,44 +199,32 @@ export default function(ui, debug, definitions) {
186
199
  }
187
200
  const observableElement = (definition.editor?.getDraggableElement ? definition.editor.getDraggableElement(el) : el) || el;
188
201
  if (observableElement instanceof HTMLElement) {
202
+ observedElementCache.set(key, observableElement);
189
203
  return observableElement;
190
204
  }
205
+ observedElementCache.set(key, el);
191
206
  return el;
192
207
  }
193
- const findBlock = (uuid) => {
194
- const cached = draggableBlockCache[uuid];
195
- if (cached) {
196
- return cached;
197
- }
198
- const el = registeredBlocks[uuid];
199
- if (!el) {
200
- return;
201
- }
202
- const item = buildDraggableItem(el);
203
- if (item?.itemType === "existing") {
204
- draggableBlockCache[uuid] = item;
205
- return item;
206
- }
207
- };
208
- const getAllBlocks = () => {
209
- return [
210
- ...document.querySelectorAll(
211
- '[data-blokkli-provider-active="true"] [data-uuid]'
212
- )
213
- ].map((v) => {
214
- const item = buildDraggableItem(v);
215
- if (item?.itemType === "existing") {
216
- return item;
217
- }
218
- }).filter(falsy);
219
- };
220
208
  const getDropElementMarkup = (item, checkSize) => {
221
- const el = item.itemType === "existing" ? getDragElement(item) : item.element();
209
+ const getElement = () => {
210
+ if ("itemType" in item) {
211
+ if (item.itemType === "existing") {
212
+ return getDragElement(item);
213
+ }
214
+ return item.element();
215
+ }
216
+ return getDragElement(item);
217
+ };
218
+ const el = getElement();
222
219
  if (!el) {
223
220
  return "";
224
221
  }
225
- const dropElement = el.querySelector(".bk-drop-element") || el;
226
- const childCount = dropElement.querySelectorAll("*").length;
222
+ const dropElement = element.query(el, ".bk-drop-element", "Find drop element for markup.") || el;
223
+ const childCount = element.queryAll(
224
+ dropElement,
225
+ "*",
226
+ "Get child count for drop element markup."
227
+ ).length;
227
228
  if (checkSize && childCount > 80) {
228
229
  return "";
229
230
  }
@@ -232,58 +233,50 @@ export default function(ui, debug, definitions) {
232
233
  ""
233
234
  );
234
235
  };
235
- const findField = (uuid, fieldName) => {
236
- const el = document.querySelector(
237
- `[data-field-name="${fieldName}"][data-host-entity-uuid="${uuid}"]`
238
- );
239
- if (!(el instanceof HTMLElement)) {
240
- return;
241
- }
242
- return buildFieldElement(el);
243
- };
244
- const getAllDroppableFields = () => [...document.querySelectorAll("[data-blokkli-droppable-field]")].filter((el) => {
245
- return !el.closest('[data-bk-in-proxy="true"]');
246
- }).map(mapDroppableField);
247
236
  const getVisibleBlocks = () => Array.from(visibleBlocks);
248
237
  const getVisibleFields = () => Array.from(visibleFields);
249
- const getActiveProviderElement = () => {
250
- const el = document.querySelector('[data-blokkli-provider-active="true"]');
251
- if (!el) {
252
- throw new Error("Failed to find active <BlokkliProvider> element.");
253
- }
254
- if (!(el instanceof HTMLElement)) {
255
- throw new TypeError(
256
- "The root element of the active <BlokkliProvider> is not an HTMLElement."
257
- );
258
- }
259
- return el;
260
- };
261
238
  function getBlockRects() {
262
239
  return blockRects;
263
240
  }
264
- function getBlockRect(uuid) {
241
+ function getBlockRect(uuid, refresh) {
242
+ if (refresh) {
243
+ refreshBlockRect(uuid);
244
+ }
265
245
  return blockRects[uuid];
266
246
  }
267
247
  function getFieldRect(key) {
268
248
  return fieldRects[key];
269
249
  }
270
- function refreshBlockRect(uuid) {
271
- const block = findBlock(uuid);
272
- if (!block) {
250
+ function refreshBlockRect(uuid, providedOffset, providedScale) {
251
+ const offset = providedOffset ?? ui.artboardOffset.value;
252
+ const scale = providedScale ?? ui.artboardScale.value;
253
+ const el = registeredBlocks[uuid];
254
+ if (!el) {
273
255
  return;
274
256
  }
275
- const el = getDragElement(block);
276
- if (!el) {
257
+ const bundle = el.dataset.itemBundle;
258
+ const hostBundle = el.dataset.hostBundle;
259
+ const hostFieldListType = el.dataset.hostFieldListType;
260
+ if (!bundle || !hostFieldListType) {
277
261
  return;
278
262
  }
263
+ const observableElement = getElementToObserve(
264
+ uuid,
265
+ el,
266
+ bundle,
267
+ hostFieldListType,
268
+ hostBundle
269
+ );
279
270
  blockRects[uuid] = rectWithTime(
280
- ui.getAbsoluteElementRect(el.getBoundingClientRect())
271
+ ui.getAbsoluteElementRect(
272
+ observableElement.getBoundingClientRect(),
273
+ scale,
274
+ offset
275
+ )
281
276
  );
282
277
  }
283
278
  function refreshFieldRect(key) {
284
- const el = document.querySelector(
285
- `.bk-draggable-list-container[data-field-key="${key}"]`
286
- );
279
+ const el = registeredFields[key]?.element;
287
280
  if (!(el instanceof HTMLElement)) {
288
281
  return;
289
282
  }
@@ -298,34 +291,15 @@ export default function(ui, debug, definitions) {
298
291
  return getVisibleBlocks();
299
292
  }
300
293
  function updateVisibleRects() {
294
+ logger.log("Update visible rects");
301
295
  const toUpdate = getUuidsToUpdateRectsFor();
302
296
  const offset = ui.artboardOffset.value;
303
297
  const scale = ui.artboardScale.value;
304
298
  for (let i = 0; i < toUpdate.length; i++) {
305
299
  const uuid = toUpdate[i];
306
- const el = registeredBlocks[uuid];
307
- if (!el) {
308
- continue;
300
+ if (uuid) {
301
+ refreshBlockRect(uuid, offset, scale);
309
302
  }
310
- const bundle = el.dataset.itemBundle;
311
- const hostBundle = el.dataset.hostBundle;
312
- const hostFieldListType = el.dataset.hostFieldListType;
313
- if (!bundle || !hostFieldListType) {
314
- continue;
315
- }
316
- const observableElement = getElementToObserve(
317
- el,
318
- bundle,
319
- hostFieldListType,
320
- hostBundle
321
- );
322
- blockRects[uuid] = rectWithTime(
323
- ui.getAbsoluteElementRect(
324
- observableElement.getBoundingClientRect(),
325
- scale,
326
- offset
327
- )
328
- );
329
303
  }
330
304
  const visibleFieldKeys = getVisibleFields();
331
305
  for (let i = 0; i < visibleFieldKeys.length; i++) {
@@ -342,17 +316,23 @@ export default function(ui, debug, definitions) {
342
316
  }
343
317
  }
344
318
  onBlokkliEvent("state:reloaded", () => {
345
- draggableBlockCache = {};
319
+ observedElementCache.clear();
346
320
  if (stateReloadTimeout) {
347
321
  window.clearTimeout(stateReloadTimeout);
348
322
  }
323
+ const allUuids = Object.keys(registeredBlocks);
324
+ if (allUuids.length < 150) {
325
+ updateVisibleRects();
326
+ }
349
327
  stateReloadTimeout = window.setTimeout(updateVisibleRects, 300);
350
328
  });
351
- onBlokkliEvent("ui:resized", function() {
329
+ function forceRefresh() {
352
330
  updateVisibleRects();
353
331
  getVisibleFields().forEach(refreshFieldRect);
354
332
  logger.log("Refreshed all visible rects");
355
- });
333
+ }
334
+ onBlokkliEvent("option:finish-change", forceRefresh);
335
+ onBlokkliEvent("ui:resized", forceRefresh);
356
336
  function init() {
357
337
  intersectionObserver.init();
358
338
  intersectionReady.value = true;
@@ -360,108 +340,203 @@ export default function(ui, debug, definitions) {
360
340
  }
361
341
  const dragElementUuidMap = /* @__PURE__ */ new WeakMap();
362
342
  const dragElementCache = /* @__PURE__ */ new Map();
363
- function handleNodeAdded(node) {
364
- if (!(node instanceof HTMLElement)) {
343
+ function getDragElement(block) {
344
+ const item = "itemType" in block ? block.block : block;
345
+ if (!item) {
365
346
  return;
366
347
  }
367
- if (node.dataset.uuid) {
368
- const item = buildDraggableItem(node);
369
- if (item && item.itemType === "existing") {
370
- const observableElement = getElementToObserve(
371
- node,
372
- item.itemBundle,
373
- item.hostFieldListType,
374
- item.hostBundle
375
- );
376
- intersectionObserver.observe(observableElement);
377
- resizeObserver.observe(observableElement);
378
- registeredBlocks[item.uuid] = node;
379
- }
380
- } else if (node.dataset.fieldName && node.dataset.fieldKey && node.dataset.fieldCardinality) {
381
- const blocks = node.querySelectorAll('[data-element-type="existing"]');
382
- for (const block of blocks) {
383
- handleNodeAdded(block);
384
- }
348
+ const el = registeredBlocks[item.uuid];
349
+ if (!el) {
350
+ return;
385
351
  }
352
+ return getElementToObserve(
353
+ item.uuid,
354
+ el,
355
+ item.bundle,
356
+ item.fieldListType,
357
+ item.parentBlockBundle
358
+ );
386
359
  }
387
- function handleNodeRemoved(node) {
388
- if (node instanceof HTMLElement && node.dataset.uuid) {
389
- const uuid = node.dataset.uuid;
390
- const el = registeredBlocks[uuid];
391
- if (el !== node) {
392
- return;
393
- }
394
- if (el) {
395
- intersectionObserver.unobserve(el);
396
- resizeObserver.unobserve(el);
397
- dragElementUuidMap.delete(el);
398
- }
399
- dragElementUuidMap.delete(node);
400
- dragElementCache.delete(uuid);
401
- registeredBlocks[uuid] = void 0;
402
- delete blockRects[uuid];
403
- visibleBlocks.delete(uuid);
404
- }
360
+ function isBlockVisible(uuid) {
361
+ return visibleBlocks.has(uuid);
405
362
  }
406
- const mutationObserverCallback = function(mutationsList) {
407
- for (const mutation of mutationsList) {
408
- if (mutation.type === "childList") {
409
- for (const node of mutation.removedNodes) {
410
- handleNodeRemoved(node);
411
- }
412
- for (const node of mutation.addedNodes) {
413
- handleNodeAdded(node);
363
+ function refreshAllBlockRects() {
364
+ const uuids = Object.keys(blockRects);
365
+ if (uuids.length < 200) {
366
+ for (let i = 0; i < uuids.length; i++) {
367
+ const uuid = uuids[i];
368
+ if (!uuid) {
369
+ continue;
414
370
  }
371
+ refreshBlockRect(uuid);
415
372
  }
416
373
  }
417
- };
418
- const mutationObserver = new MutationObserver(mutationObserverCallback);
419
- mutationObserver.observe(artboardElement, {
420
- subtree: true,
421
- childList: true
422
- });
423
- function getDragElement(block) {
424
- const cached = dragElementCache.get(block.uuid);
425
- if (cached && document.body.contains(cached)) {
426
- return cached;
374
+ }
375
+ function doInitTimeout() {
376
+ if (initTimeout) {
377
+ window.clearTimeout(initTimeout);
378
+ }
379
+ if (isInitalizing.value) {
380
+ initTimeout = window.setTimeout(() => {
381
+ isInitalizing.value = false;
382
+ refreshAllBlockRects();
383
+ }, 500);
427
384
  }
428
- const el = block.element();
385
+ }
386
+ function registerBlock(key, uuid, el) {
387
+ logger.log("registerBlock: " + uuid);
388
+ blockUuidCurrentKey[uuid] = key;
389
+ doInitTimeout();
429
390
  if (!el) {
391
+ logger.log("registerBlock call unregisterBlock because no element", uuid);
392
+ unregisterBlock(key, uuid);
430
393
  return;
431
394
  }
432
- if (el.parentNode) {
433
- mutationObserver.observe(el.parentNode, { childList: true });
395
+ if (registeredBlocks[uuid]) {
396
+ logger.log(
397
+ "registerBlock call unregisterBlock because already registered",
398
+ uuid
399
+ );
400
+ unregisterBlock(key, uuid);
401
+ }
402
+ const item = state.getFieldListItem(uuid);
403
+ if (item) {
404
+ const fieldList = state.getFieldListForBlock(item.uuid);
405
+ if (fieldList) {
406
+ const fieldListType = getRegisteredField(fieldList.entityUuid, fieldList.name)?.fieldListType ?? "default";
407
+ const parentBundle = fieldList.entityType === itemEntityType ? state.getFieldListItem(fieldList.entityUuid)?.bundle ?? null : null;
408
+ const observableElement = getElementToObserve(
409
+ item.uuid,
410
+ el,
411
+ item.bundle,
412
+ fieldListType,
413
+ parentBundle
414
+ );
415
+ blockElementToUuid.set(observableElement, uuid);
416
+ registeredBlocks[uuid] = el;
417
+ observedElements[uuid] = observableElement;
418
+ intersectionObserver.observe(observableElement);
419
+ resizeObserver.observe(observableElement);
420
+ }
434
421
  }
435
- dragElementUuidMap.set(el, block.uuid);
436
- dragElementCache.set(block.uuid, el);
437
- return el;
438
422
  }
439
- function isBlockVisible(uuid) {
440
- return visibleBlocks.has(uuid);
423
+ function unregisterBlock(key, uuid) {
424
+ const currentKey = blockUuidCurrentKey[uuid];
425
+ if (currentKey && currentKey !== key) {
426
+ return;
427
+ }
428
+ logger.log("unregisterBlock: " + uuid);
429
+ const el = registeredBlocks[uuid];
430
+ const observedElement = observedElements[uuid];
431
+ if (observedElement) {
432
+ intersectionObserver.unobserve(observedElement);
433
+ resizeObserver.unobserve(observedElement);
434
+ delete observedElements[uuid];
435
+ blockElementToUuid.delete(observedElement);
436
+ }
437
+ if (el) {
438
+ dragElementUuidMap.delete(el);
439
+ }
440
+ dragElementCache.delete(uuid);
441
+ registeredBlocks[uuid] = void 0;
442
+ delete blockRects[uuid];
443
+ delete blockUuidCurrentKey[uuid];
444
+ visibleBlocks.delete(uuid);
445
+ }
446
+ function getDebugData() {
447
+ const allUuids = /* @__PURE__ */ new Set([
448
+ ...Object.keys(registeredBlocks),
449
+ ...Object.keys(blockRects),
450
+ ...Object.keys(observedElements),
451
+ ...Object.keys(blockUuidCurrentKey)
452
+ ]);
453
+ const blocksInfo = Array.from(allUuids).map((uuid) => {
454
+ const el = registeredBlocks[uuid];
455
+ return {
456
+ uuid,
457
+ hasElement: !!el,
458
+ hasObservedElement: !!observedElements[uuid],
459
+ hasRect: !!blockRects[uuid],
460
+ hasCurrentKey: !!blockUuidCurrentKey[uuid],
461
+ isVisible: visibleBlocks.has(uuid),
462
+ elementInfo: el ? {
463
+ tagName: el.tagName,
464
+ bundle: el.dataset.itemBundle,
465
+ hostBundle: el.dataset.hostBundle,
466
+ fieldListType: el.dataset.hostFieldListType
467
+ } : void 0
468
+ };
469
+ });
470
+ const fieldsInfo = Object.entries(registeredFields).filter(([, field]) => !!field).map(([key, field]) => ({
471
+ key,
472
+ isVisible: visibleFields.has(key),
473
+ hasRect: !!fieldRects[key],
474
+ entityType: field.entity.type,
475
+ entityBundle: field.entity.bundle,
476
+ fieldName: field.fieldName
477
+ }));
478
+ const registeredUuids = new Set(
479
+ Object.entries(registeredBlocks).filter(([, el]) => !!el).map(([uuid]) => uuid)
480
+ );
481
+ const rectsWithoutRegistration = Object.keys(blockRects).filter(
482
+ (uuid) => !registeredUuids.has(uuid)
483
+ );
484
+ const observedElementsWithoutRegistration = Object.keys(
485
+ observedElements
486
+ ).filter((uuid) => !registeredUuids.has(uuid));
487
+ const keysWithoutRegistration = Object.keys(blockUuidCurrentKey).filter(
488
+ (uuid) => !registeredUuids.has(uuid)
489
+ );
490
+ return {
491
+ registeredBlocks: blocksInfo,
492
+ fields: fieldsInfo,
493
+ summary: {
494
+ totalRegisteredBlocks: Object.keys(registeredBlocks).length,
495
+ totalBlocksWithElements: Object.values(registeredBlocks).filter(
496
+ (el) => !!el
497
+ ).length,
498
+ totalObservedElements: Object.keys(observedElements).length,
499
+ totalBlockRects: Object.keys(blockRects).length,
500
+ totalVisibleBlocks: visibleBlocks.size,
501
+ totalRegisteredFields: Object.values(registeredFields).filter(
502
+ (f) => !!f
503
+ ).length,
504
+ totalVisibleFields: visibleFields.size,
505
+ totalFieldRects: Object.keys(fieldRects).length,
506
+ isInitializing: isInitalizing.value,
507
+ isReady: mutationsReady.value && intersectionReady.value && !isInitalizing.value
508
+ },
509
+ orphanedData: {
510
+ rectsWithoutRegistration,
511
+ observedElementsWithoutRegistration,
512
+ keysWithoutRegistration
513
+ }
514
+ };
441
515
  }
442
516
  return {
443
- findBlock,
444
- getAllBlocks,
445
- findClosestBlock,
446
517
  getDropElementMarkup,
447
- findField,
448
- getAllDroppableFields,
449
- findClosestEntityContext,
450
518
  getVisibleBlocks,
451
519
  getVisibleFields,
452
520
  registerField,
453
521
  unregisterField,
454
522
  updateFieldElement,
455
- getActiveProviderElement,
456
523
  getBlockRects,
457
524
  getBlockRect,
458
525
  getFieldRect,
459
526
  refreshBlockRect,
460
527
  isBlockVisible,
461
- isReady: computed(() => mutationsReady.value && intersectionReady.value),
528
+ isReady: computed(
529
+ () => mutationsReady.value && intersectionReady.value && !isInitalizing.value
530
+ ),
462
531
  init,
463
532
  getDragElement,
464
533
  updateVisibleRects,
465
- registeredFieldTypes
534
+ registeredFieldTypes,
535
+ registerBlock,
536
+ unregisterBlock,
537
+ registeredBlockUuids,
538
+ getDebugData,
539
+ getRegisteredField,
540
+ registeredBlocks: computed(() => registeredBlocks)
466
541
  };
467
542
  }