@blokkli/editor 2.0.0-alpha.22 → 2.0.0-alpha.24

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 (229) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +150 -226
  3. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +1 -1
  4. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +20 -14
  5. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue.d.ts +8 -4
  6. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +55 -25
  7. package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +5 -4
  8. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +9 -2
  9. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +2 -0
  10. package/dist/runtime/blokkliPlugins/TourItem/index.vue +22 -13
  11. package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +1 -0
  12. package/dist/runtime/blokkliPlugins/ViewOption/index.vue +3 -1
  13. package/dist/runtime/blokkliPlugins/index.d.ts +1 -5
  14. package/dist/runtime/blokkliPlugins/index.js +0 -8
  15. package/dist/runtime/components/Blocks/FromLibrary/index.vue +0 -5
  16. package/dist/runtime/components/BlokkliEditable.vue +6 -1
  17. package/dist/runtime/components/BlokkliField.vue +1 -1
  18. package/dist/runtime/components/BlokkliProvider.vue +4 -4
  19. package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -1
  20. package/dist/runtime/components/Edit/Actions/ItemDropdown.vue +66 -0
  21. package/dist/runtime/components/Edit/Actions/ItemDropdown.vue.d.ts +6 -0
  22. package/dist/runtime/components/Edit/Actions/index.vue +80 -117
  23. package/dist/runtime/components/Edit/AddListItem/index.vue +8 -29
  24. package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +2 -3
  25. package/dist/runtime/components/Edit/AnimationCanvas/index.vue +23 -68
  26. package/dist/runtime/components/Edit/AppMenu/MenuButton.vue +39 -0
  27. package/dist/runtime/{blokkliPlugins/MenuButton/index.vue.d.ts → components/Edit/AppMenu/MenuButton.vue.d.ts} +0 -4
  28. package/dist/runtime/components/Edit/AppMenu/index.vue +62 -40
  29. package/dist/runtime/components/Edit/BlockProxy/index.vue +2 -8
  30. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +33 -49
  31. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue.d.ts +14 -1
  32. package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +93 -0
  33. package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue.d.ts +12 -0
  34. package/dist/runtime/components/Edit/Dialog/index.vue +26 -5
  35. package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +2 -0
  36. package/dist/runtime/components/Edit/DraggableList.vue +5 -25
  37. package/dist/runtime/components/Edit/EditProvider.vue +71 -41
  38. package/dist/runtime/components/Edit/EditProvider.vue.d.ts +1 -1
  39. package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +52 -0
  40. package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue.d.ts +7 -0
  41. package/dist/runtime/components/Edit/Features/AddList/Actions/index.vue +41 -0
  42. package/dist/runtime/components/Edit/Features/{Selection/OverlayFallback → AddList/Actions}/index.vue.d.ts +1 -1
  43. package/dist/runtime/components/Edit/Features/{BlockAddList → AddList/Blocks}/index.vue +36 -108
  44. package/dist/runtime/components/Edit/Features/{Hover/Overlay → AddList/Blocks}/index.vue.d.ts +7 -2
  45. package/dist/runtime/components/Edit/Features/AddList/index.vue +76 -110
  46. package/dist/runtime/components/Edit/Features/Analyze/{Renderer.vue → Main.vue} +4 -8
  47. package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/fragment.glsl +10 -6
  48. package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/index.vue +43 -15
  49. package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/index.vue.d.ts +0 -2
  50. package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/vertex.glsl +11 -9
  51. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -3
  52. package/dist/runtime/components/Edit/Features/Analyze/index.vue +7 -3
  53. package/dist/runtime/components/Edit/Features/Anchors/index.vue +2 -2
  54. package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +41 -20
  55. package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +3 -2
  56. package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +2 -28
  57. package/dist/runtime/components/Edit/Features/Assistant/index.vue +18 -14
  58. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +1 -0
  59. package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +2 -2
  60. package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +22 -11
  61. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +70 -29
  62. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +0 -2
  63. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue.d.ts +6 -4
  64. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +77 -27
  65. package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +7 -4
  66. package/dist/runtime/components/Edit/Features/Comments/index.vue +2 -2
  67. package/dist/runtime/components/Edit/Features/Conversions/index.vue +16 -9
  68. package/dist/runtime/components/Edit/Features/Debug/DebugSection.vue +24 -0
  69. package/dist/runtime/components/Edit/Features/Debug/DebugSection.vue.d.ts +16 -0
  70. package/dist/runtime/components/Edit/Features/Debug/Main.vue +80 -0
  71. package/dist/runtime/components/Edit/Features/Debug/Section/Features.vue +34 -0
  72. package/dist/runtime/components/Edit/Features/Debug/Section/Icons.vue +15 -0
  73. package/dist/runtime/components/Edit/Features/Debug/Section/Icons.vue.d.ts +2 -0
  74. package/dist/runtime/components/Edit/Features/Debug/Section/Keyboard.vue +17 -0
  75. package/dist/runtime/components/Edit/Features/Debug/Section/Keyboard.vue.d.ts +2 -0
  76. package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue +66 -0
  77. package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue.d.ts +6 -0
  78. package/dist/runtime/components/Edit/Features/Debug/Section/Rendering.vue +96 -0
  79. package/dist/runtime/components/Edit/Features/Debug/Section/Rendering.vue.d.ts +2 -0
  80. package/dist/runtime/components/Edit/Features/Debug/Section/Selection.vue +25 -0
  81. package/dist/runtime/components/Edit/Features/Debug/Section/Selection.vue.d.ts +2 -0
  82. package/dist/runtime/components/Edit/Features/Debug/index.vue +2 -2
  83. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue +113 -0
  84. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue.d.ts +25 -0
  85. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +23 -119
  86. package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/fragment.glsl +77 -0
  87. package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/index.vue +138 -92
  88. package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/vertex.glsl +60 -8
  89. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +4 -5
  90. package/dist/runtime/components/Edit/Features/EditForm/index.vue +2 -2
  91. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +0 -6
  92. package/dist/runtime/components/Edit/Features/EditableField/index.vue +8 -4
  93. package/dist/runtime/components/Edit/Features/Exit/index.vue +12 -9
  94. package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +1 -5
  95. package/dist/runtime/components/Edit/Features/Fragments/index.vue +27 -31
  96. package/dist/runtime/components/Edit/Features/Hover/Renderer/fragment.glsl +141 -0
  97. package/dist/runtime/components/Edit/Features/Hover/{Overlay → Renderer}/index.vue +225 -38
  98. package/dist/runtime/components/Edit/Features/Hover/Renderer/index.vue.d.ts +2 -0
  99. package/dist/runtime/components/Edit/Features/Hover/{Overlay → Renderer}/vertex.glsl +49 -11
  100. package/dist/runtime/components/Edit/Features/Hover/index.vue +9 -6
  101. package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +1 -0
  102. package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +25 -24
  103. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +2 -2
  104. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +1 -5
  105. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +1 -0
  106. package/dist/runtime/components/Edit/Features/Library/index.vue +50 -36
  107. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +1 -1
  108. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +26 -13
  109. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue.d.ts +0 -1
  110. package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +3 -47
  111. package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/fragment.glsl +13 -26
  112. package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue +131 -75
  113. package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue.d.ts +0 -1
  114. package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/vertex.glsl +27 -2
  115. package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +25 -12
  116. package/dist/runtime/components/Edit/Features/Ownership/index.vue +2 -2
  117. package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +2 -1
  118. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +1 -0
  119. package/dist/runtime/components/Edit/Features/Publish/index.vue +17 -15
  120. package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +1 -1
  121. package/dist/runtime/components/Edit/Features/Revert/index.vue +24 -18
  122. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +23 -6
  123. package/dist/runtime/components/Edit/Features/Search/index.vue +1 -1
  124. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +21 -17
  125. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +6 -6
  126. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +19 -17
  127. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +242 -131
  128. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +29 -12
  129. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +15 -10
  130. package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/fragment.glsl +23 -14
  131. package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/index.vue +121 -28
  132. package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/index.vue.d.ts +0 -2
  133. package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/vertex.glsl +23 -14
  134. package/dist/runtime/components/Edit/Features/Selection/index.vue +46 -59
  135. package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +1 -0
  136. package/dist/runtime/components/Edit/Features/Settings/index.vue +25 -17
  137. package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +2 -2
  138. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +1 -1
  139. package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +2 -2
  140. package/dist/runtime/components/Edit/Features/Tour/index.vue +12 -10
  141. package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +5 -5
  142. package/dist/runtime/components/Edit/Features/Transform/index.vue +30 -23
  143. package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -17
  144. package/dist/runtime/components/Edit/Form/Checkboxes/index.vue +43 -0
  145. package/dist/runtime/components/Edit/Form/Checkboxes/index.vue.d.ts +20 -0
  146. package/dist/runtime/components/Edit/FormOverlay/index.vue +13 -4
  147. package/dist/runtime/components/Edit/ItemIconBox/index.vue +41 -0
  148. package/dist/runtime/components/Edit/{AddListItemIcon → ItemIconBox}/index.vue.d.ts +5 -5
  149. package/dist/runtime/components/Edit/Konami/Game/index.vue +0 -1
  150. package/dist/runtime/components/Edit/Konami/index.vue +3 -5
  151. package/dist/runtime/components/Edit/Messages/Item/index.vue +11 -2
  152. package/dist/runtime/components/Edit/Messages/Item/index.vue.d.ts +1 -1
  153. package/dist/runtime/components/Edit/Messages/index.vue +6 -1
  154. package/dist/runtime/components/Edit/Overlay/index.vue +66 -0
  155. package/dist/runtime/components/Edit/Overlay/index.vue.d.ts +2 -0
  156. package/dist/runtime/components/Edit/PreviewProvider.vue +1 -1
  157. package/dist/runtime/components/Edit/Sortli/index.vue +5 -8
  158. package/dist/runtime/components/Edit/Sortli/index.vue.d.ts +2 -0
  159. package/dist/runtime/components/Edit/SystemRequirements/index.vue +36 -36
  160. package/dist/runtime/components/Edit/Toolbar/index.vue +47 -51
  161. package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue +9 -2
  162. package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue.d.ts +4 -1
  163. package/dist/runtime/components/Edit/index.d.ts +7 -5
  164. package/dist/runtime/components/Edit/index.js +13 -9
  165. package/dist/runtime/css/output.css +1 -1
  166. package/dist/runtime/helpers/animationProvider.d.ts +58 -9
  167. package/dist/runtime/helpers/animationProvider.js +318 -75
  168. package/dist/runtime/helpers/composables/defineAddAction.d.ts +2 -0
  169. package/dist/runtime/helpers/composables/defineAddAction.js +10 -0
  170. package/dist/runtime/helpers/composables/defineItemDropdownAction.d.ts +2 -0
  171. package/dist/runtime/helpers/composables/defineItemDropdownAction.js +10 -0
  172. package/dist/runtime/helpers/composables/defineMenuButton.d.ts +2 -0
  173. package/dist/runtime/helpers/composables/defineMenuButton.js +10 -0
  174. package/dist/runtime/helpers/composables/defineRenderer.d.ts +5 -2
  175. package/dist/runtime/helpers/composables/defineRenderer.js +3 -2
  176. package/dist/runtime/helpers/composables/useDialog.d.ts +3 -0
  177. package/dist/runtime/helpers/composables/useDialog.js +16 -0
  178. package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +16 -0
  179. package/dist/runtime/helpers/composables/useGlobalBlokkliObject.js +36 -0
  180. package/dist/runtime/helpers/debugProvider.d.ts +13 -3
  181. package/dist/runtime/helpers/debugProvider.js +80 -12
  182. package/dist/runtime/helpers/defineElementStyle.d.ts +2 -0
  183. package/dist/runtime/helpers/defineElementStyle.js +33 -0
  184. package/dist/runtime/helpers/domProvider.d.ts +1 -0
  185. package/dist/runtime/helpers/domProvider.js +51 -32
  186. package/dist/runtime/helpers/dropTargets/index.d.ts +1 -1
  187. package/dist/runtime/helpers/dropTargets/index.js +18 -4
  188. package/dist/runtime/helpers/eventBus.d.ts +1 -1
  189. package/dist/runtime/helpers/index.d.ts +1 -6
  190. package/dist/runtime/helpers/index.js +0 -81
  191. package/dist/runtime/helpers/pluginProvider.d.ts +38 -3
  192. package/dist/runtime/helpers/pluginProvider.js +49 -18
  193. package/dist/runtime/helpers/providers/blocks.js +10 -0
  194. package/dist/runtime/helpers/providers/directive.d.ts +4 -1
  195. package/dist/runtime/helpers/providers/directive.js +9 -2
  196. package/dist/runtime/helpers/providers/fields.d.ts +9 -1
  197. package/dist/runtime/helpers/stateProvider.js +1 -0
  198. package/dist/runtime/helpers/uiProvider.d.ts +13 -12
  199. package/dist/runtime/helpers/uiProvider.js +117 -81
  200. package/dist/runtime/helpers/webgl/index.d.ts +2 -3
  201. package/dist/runtime/helpers/webgl/index.js +9 -14
  202. package/dist/runtime/icons/click.svg +1 -0
  203. package/dist/runtime/icons/dock-left.svg +1 -0
  204. package/dist/runtime/icons/dock-right.svg +1 -0
  205. package/dist/runtime/icons/dock-window.svg +1 -0
  206. package/dist/runtime/plugins/blokkliDirectives.js +1 -1
  207. package/dist/runtime/types/index.d.ts +16 -26
  208. package/package.json +1 -1
  209. package/dist/runtime/blokkliPlugins/AddAction/index.vue +0 -96
  210. package/dist/runtime/blokkliPlugins/AddAction/index.vue.d.ts +0 -26
  211. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +0 -56
  212. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue.d.ts +0 -24
  213. package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +0 -76
  214. package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +0 -31
  215. package/dist/runtime/blokkliPlugins/MenuButton/index.vue +0 -66
  216. package/dist/runtime/components/Edit/AddListItemIcon/index.vue +0 -19
  217. package/dist/runtime/components/Edit/Features/BlockAddList/docs.md +0 -15
  218. package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +0 -240
  219. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +0 -96
  220. package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +0 -139
  221. package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +0 -42
  222. /package/dist/runtime/components/Edit/Features/Analyze/{Renderer.vue.d.ts → Main.vue.d.ts} +0 -0
  223. /package/dist/runtime/components/Edit/Features/Anchors/{Renderer.vue → Overlay/index.vue} +0 -0
  224. /package/dist/runtime/components/Edit/Features/{BlockAddList → Anchors/Overlay}/index.vue.d.ts +0 -0
  225. /package/dist/runtime/components/Edit/Features/Debug/{Renderer.vue.d.ts → Main.vue.d.ts} +0 -0
  226. /package/dist/runtime/components/Edit/Features/{Anchors/Renderer.vue.d.ts → Debug/Section/Features.vue.d.ts} +0 -0
  227. /package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/index.vue.d.ts +0 -0
  228. /package/dist/runtime/components/Edit/Features/Ownership/{Renderer.vue → Banner/index.vue} +0 -0
  229. /package/dist/runtime/components/Edit/Features/Ownership/{Renderer.vue.d.ts → Banner/index.vue.d.ts} +0 -0
@@ -1,118 +1,110 @@
1
1
  <template>
2
- <Teleport to="body">
3
- <div class="bk bk-blokkli-item-actions bk-control" @click.stop>
4
- <div
5
- v-show="
6
- !selection.isDragging.value && !selection.editableActive.value && !ui.isAnimating.value && !ui.hasTransformOverlayOpen.value && hasAnythingSelected && shouldRender && !ui.hasTooltipOpen.value
7
- "
8
- ref="el"
9
- class="bk-blokkli-item-actions-inner"
10
- >
11
- <div
12
- id="bk-blokkli-item-actions-controls"
13
- ref="controlsEl"
14
- class="bk-blokkli-item-actions-controls"
15
- :class="{
2
+ <div
3
+ ref="el"
4
+ :style="{
5
+ visibility: isVisible ? 'visible' : 'hidden'
6
+ }"
7
+ class="bk bk-blokkli-item-actions-inner"
8
+ @click.stop
9
+ >
10
+ <div
11
+ id="bk-blokkli-item-actions-controls"
12
+ ref="controlsEl"
13
+ class="bk-blokkli-item-actions-controls"
14
+ :class="{
16
15
  'bk-is-locked': ui.isTransforming.value
17
16
  }"
18
- >
19
- <div id="bk-blokkli-item-actions-title">
20
- <button
21
- class="bk-blokkli-item-actions-type-button"
22
- :disabled="!shouldRenderButton"
23
- :class="{
17
+ >
18
+ <div id="bk-blokkli-item-actions-title">
19
+ <button
20
+ class="bk-blokkli-item-actions-type-button bk-item-icon-hover-parent"
21
+ tabindex="-1"
22
+ :disabled="!shouldRenderButton"
23
+ :class="{
24
24
  'is-open': showDropdown,
25
- 'is-interactive': shouldRenderButton,
26
- 'bk-is-reusable': itemBundle?.id === 'from_library',
27
- 'bk-is-fragment': itemBundle?.id === 'blokkli_fragment'
25
+ 'is-interactive': shouldRenderButton
28
26
  }"
29
- @click.prevent="showDropdown = !showDropdown"
30
- >
31
- <div v-if="shouldRenderButton" class="bk-tooltip">
32
- {{ $t("actionsDropdownToolip", "Further actions") }}
33
- </div>
34
- <div
35
- v-show="!hasSelectedHost"
36
- class="bk-blokkli-item-actions-title-icon"
37
- >
38
- <Icon v-if="ui.isTransforming.value" name="loader" />
39
- <ItemIcon v-else-if="bundleIcon" :bundle="bundleIcon" />
40
- <Icon v-else name="selection" />
41
- <div
42
- v-if="itemBundle?.id === 'from_library'"
43
- class="bk-blokkli-item-actions-title-icon-reusable"
44
- >
45
- <Icon name="reusable" />
46
- </div>
47
- </div>
48
- <span class="bk-blokkli-item-actions-title-label">{{
49
- title
50
- }}</span>
51
- <span
52
- v-if="selection.items.value.length > 1"
53
- class="bk-blokkli-item-actions-title-count"
54
- >{{ selection.items.value.length }}</span
55
- >
56
- <span
57
- v-show="selectedIsNew"
58
- class="bk-blokkli-item-actions-title-pill"
59
- >{{ $t("selectedIsNew", "New") }}</span
60
- >
61
- <Icon v-if="shouldRenderButton" name="caret" class="bk-caret" />
62
- </button>
63
- <div
64
- v-show="showDropdown && editingEnabled"
65
- id="bk-blokkli-item-actions-dropdown"
66
- class="bk-blokkli-item-actions-type-dropdown"
67
- />
27
+ @click.prevent="showDropdown = !showDropdown"
28
+ >
29
+ <div v-if="shouldRenderButton" class="bk-tooltip">
30
+ {{ $t("actionsDropdownToolip", "Further actions") }}
68
31
  </div>
69
-
70
32
  <div
71
- v-show="!selection.hasHostSelected.value"
72
- id="bk-blokkli-item-actions"
73
- class="bk-blokkli-item-actions-buttons"
74
- />
75
- </div>
33
+ v-show="!hasSelectedHost"
34
+ class="bk-blokkli-item-actions-title-icon"
35
+ >
36
+ <Icon v-if="ui.isTransforming.value" name="loader" />
37
+ <ItemIconBox
38
+ v-else-if="bundleIcon"
39
+ :bundle="bundleIcon"
40
+ :color="isReusable ? 'lime' : void 0"
41
+ is-small
42
+ />
43
+ <Icon v-else name="selection" />
44
+ <div
45
+ v-if="itemBundle?.id === 'from_library'"
46
+ class="bk-blokkli-item-actions-title-icon-reusable"
47
+ >
48
+ <Icon name="reusable" />
49
+ </div>
50
+ </div>
51
+ <span class="bk-blokkli-item-actions-title-label">{{ title }}</span>
52
+ <span
53
+ v-if="selection.items.value.length > 1"
54
+ class="bk-blokkli-item-actions-title-count"
55
+ >{{ selection.items.value.length }}</span
56
+ >
57
+ <span
58
+ v-show="selectedIsNew"
59
+ class="bk-blokkli-item-actions-title-pill"
60
+ >{{ $t("selectedIsNew", "New") }}</span
61
+ >
62
+ <Icon v-if="shouldRenderButton" name="caret" class="bk-caret" />
63
+ </button>
64
+ <EditActionsItemDropdown
65
+ v-if="showDropdown && editingEnabled"
66
+ @close="showDropdown = false"
67
+ />
76
68
  </div>
69
+
70
+ <div
71
+ v-show="!selection.hasHostSelected.value"
72
+ id="bk-blokkli-item-actions"
73
+ class="bk-blokkli-item-actions-buttons"
74
+ />
77
75
  </div>
78
- </Teleport>
76
+ </div>
79
77
  </template>
80
78
 
81
79
  <script setup>
82
- import {
83
- watch,
84
- ref,
85
- computed,
86
- useBlokkli,
87
- onMounted,
88
- onBeforeUnmount,
89
- useTemplateRef
90
- } from "#imports";
80
+ import { watch, ref, computed, useBlokkli, useTemplateRef } from "#imports";
91
81
  import { falsy } from "#blokkli/helpers";
92
- import { ItemIcon, Icon } from "#blokkli/components";
82
+ import { Icon, ItemIconBox } from "#blokkli/components";
93
83
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
94
84
  import useStickyToolbar from "#blokkli/helpers/composables/useStickyToolbar";
85
+ import EditActionsItemDropdown from "./ItemDropdown.vue";
86
+ import { BUNDLE_FROM_LIBRARY } from "#blokkli/constants";
95
87
  const { selection, $t, types, state, ui, definitions, debug } = useBlokkli();
96
88
  const editingEnabled = computed(
97
89
  () => state.editMode.value === "editing" || state.editMode.value === "translating"
98
90
  );
99
91
  const ACTIONS_HEIGHT = 52;
100
- let scrollWidth = 0;
101
92
  const el = useTemplateRef("el");
102
- const { shouldRender } = useStickyToolbar(el, {
93
+ useStickyToolbar(el, {
103
94
  getPlacementY: () => "top",
104
- shouldUpdate: () => !selection.isChangingOptions.value,
95
+ shouldUpdate: () => !selection.isChangingOptions.value && isVisible.value,
105
96
  getHeight: () => ACTIONS_HEIGHT,
106
- getWidth: () => scrollWidth,
107
97
  getMargin: () => 20,
108
98
  allowHorizontalOverflow: true
109
99
  });
110
100
  const controlsEl = ref(null);
111
- const mountedPlugins = ref([]);
112
101
  const showDropdown = ref(false);
113
102
  const hasAnythingSelected = computed(
114
103
  () => selection.hasHostSelected.value || !!selection.items.value.length
115
104
  );
105
+ const isVisible = computed(() => {
106
+ return !selection.isDragging.value && !selection.editableActive.value && !ui.isAnimating.value && !ui.hasTransformOverlayOpen.value && hasAnythingSelected.value && !ui.hasTooltipOpen.value;
107
+ });
116
108
  watch(selection.items, () => {
117
109
  showDropdown.value = false;
118
110
  });
@@ -128,6 +120,9 @@ const bundleIcon = computed(() => {
128
120
  }
129
121
  return itemBundle.value?.id;
130
122
  });
123
+ const isReusable = computed(() => {
124
+ return itemBundle.value?.id === BUNDLE_FROM_LIBRARY;
125
+ });
131
126
  const hasSelectedHost = computed(() => {
132
127
  return selection.items.value.length === 0;
133
128
  });
@@ -182,39 +177,7 @@ const itemBundle = computed(() => {
182
177
  const bundle = selection.bundles.value[0];
183
178
  return types.getBlockBundleDefinition(bundle);
184
179
  });
185
- const observer = new ResizeObserver((entries) => {
186
- const size = entries[0]?.contentBoxSize?.[0];
187
- if (!size) {
188
- return;
189
- }
190
- scrollWidth = size.inlineSize;
191
- });
192
- onMounted(() => {
193
- if (controlsEl.value) {
194
- observer.observe(controlsEl.value);
195
- }
196
- });
197
- onBeforeUnmount(() => {
198
- if (controlsEl.value) {
199
- observer.unobserve(controlsEl.value);
200
- observer.disconnect();
201
- }
202
- });
203
- const shouldRenderButton = computed(
204
- () => mountedPlugins.value.some((v) => v.isRendering)
205
- );
206
- onBlokkliEvent("plugin:mount", (e) => {
207
- if (e.type !== "ItemDropdown") {
208
- return;
209
- }
210
- mountedPlugins.value.push(e);
211
- });
212
- onBlokkliEvent("plugin:unmount", (e) => {
213
- if (e.type !== "ItemDropdown") {
214
- return;
215
- }
216
- mountedPlugins.value = mountedPlugins.value.filter((v) => v.type !== e.id);
217
- });
180
+ const shouldRenderButton = computed(() => true);
218
181
  onBlokkliEvent("action:selected", () => {
219
182
  showDropdown.value = false;
220
183
  });
@@ -1,40 +1,22 @@
1
1
  <template>
2
2
  <PluginContextMenu
3
- :id="'add_list_item_' + id"
3
+ :id="'add_list_item_' + context + id"
4
4
  ref="el"
5
5
  tag="button"
6
- class="bk-list-item"
7
- data-element-type="action"
6
+ class="bk-add-item"
8
7
  :menu="menu"
9
8
  :data-sortli-id="id"
10
9
  :class="[
11
10
  {
12
11
  'bk-is-disabled': disabled
13
12
  },
14
- 'bk-is-' + orientation,
15
13
  'bk-is-' + color
16
14
  ]"
17
15
  >
18
- <div class="bk-list-item-inner">
19
- <AddListItemIcon :orientation :color :bundle :icon />
20
- <div
21
- class="bk-list-item-label"
22
- :class="{
23
- 'bk-tooltip': orientation === 'horizontal' && !ui.isMobile.value
24
- }"
25
- >
26
- <span>{{ label }}</span>
27
- </div>
16
+ <div class="bk-add-item-icon">
17
+ <ItemIconBox :color :bundle :icon />
28
18
  </div>
29
-
30
- <div
31
- class="bk-add-list-drop bk-drop-element"
32
- :class="['bk-is-' + color, { 'bk-is-dark': isDark }]"
33
- >
34
- <div class="bk-add-list-drop-icon">
35
- <ItemIcon v-if="bundle" :bundle="bundle" />
36
- <Icon v-else-if="icon" :name="icon" />
37
- </div>
19
+ <div class="bk-add-item-label">
38
20
  <span>{{ label }}</span>
39
21
  </div>
40
22
  </PluginContextMenu>
@@ -42,13 +24,13 @@
42
24
 
43
25
  <script setup>
44
26
  import { useBlokkli, computed, ref } from "#imports";
45
- import { ItemIcon, Icon, AddListItemIcon } from "#blokkli/components";
27
+ import { ItemIconBox } from "#blokkli/components";
46
28
  import { PluginContextMenu } from "#blokkli/plugins";
47
- const { ui, storage, $t } = useBlokkli();
29
+ const { storage, $t } = useBlokkli();
48
30
  const props = defineProps({
49
31
  id: { type: String, required: true },
32
+ context: { type: String, required: true },
50
33
  label: { type: String, required: true },
51
- orientation: { type: String, required: true },
52
34
  color: { type: String, required: false, default: "default" },
53
35
  bundle: { type: String, required: false, default: "" },
54
36
  icon: { type: null, required: false, default: void 0 },
@@ -58,9 +40,6 @@ const props = defineProps({
58
40
  const el = ref(null);
59
41
  const favorites = storage.use("blockFavorites", []);
60
42
  const isFavorite = computed(() => favorites.value.includes(props.id));
61
- const isDark = computed(
62
- () => props.orientation !== "sidebar" && props.color === "default"
63
- );
64
43
  const toggleFavorite = () => {
65
44
  if (favorites.value.includes(props.id)) {
66
45
  favorites.value = favorites.value.filter((v) => v !== props.id);
@@ -1,9 +1,8 @@
1
1
  import type { BlokkliIcon } from '#blokkli-build/icons';
2
- import type { AddListOrientation } from '#blokkli/types';
3
2
  declare const _default: import("vue").DefineComponent<{
4
3
  id: string;
4
+ context: string;
5
5
  label: string;
6
- orientation: AddListOrientation;
7
6
  color?: "rose" | "lime" | "default" | "yellow" | "accent";
8
7
  bundle?: string;
9
8
  icon?: BlokkliIcon;
@@ -13,8 +12,8 @@ declare const _default: import("vue").DefineComponent<{
13
12
  getElement: () => HTMLElement | null;
14
13
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
15
14
  id: string;
15
+ context: string;
16
16
  label: string;
17
- orientation: AddListOrientation;
18
17
  color?: "rose" | "lime" | "default" | "yellow" | "accent";
19
18
  bundle?: string;
20
19
  icon?: BlokkliIcon;
@@ -2,11 +2,13 @@
2
2
  <Teleport to="#bk-canvas-overlay">
3
3
  <canvas
4
4
  id="bk-animation-canvas-webgl"
5
+ :key="animation.canvasKey.value"
5
6
  ref="canvasEl"
6
7
  :style
7
8
  @click.capture="onClick"
8
9
  @pointerdown.capture="onPointerDown"
9
10
  @pointerup.capture="onPointerUp"
11
+ @pointermove="onPointerMove"
10
12
  />
11
13
  </Teleport>
12
14
  </template>
@@ -27,7 +29,6 @@ import {
27
29
  ref,
28
30
  computed,
29
31
  useBlokkli,
30
- onMounted,
31
32
  watch,
32
33
  useTemplateRef,
33
34
  onBeforeUnmount
@@ -44,6 +45,7 @@ const {
44
45
  runtimeConfig,
45
46
  blocks
46
47
  } = useBlokkli();
48
+ let handlePointerMove = false;
47
49
  const cursor = computed(
48
50
  () => state.isLoading.value ? "wait" : animation.cursor.value
49
51
  );
@@ -124,6 +126,9 @@ function toDraggableExisting(v) {
124
126
  });
125
127
  }
126
128
  function onPointerMove(e) {
129
+ if (!handlePointerMove) {
130
+ return;
131
+ }
127
132
  if (keyboard.isPressingSpace.value || e.buttons === MOUSE_BUTTONS.AUXILIARY) {
128
133
  return;
129
134
  }
@@ -197,7 +202,7 @@ function onPointerDown(e) {
197
202
  if (state.isLoading.value) {
198
203
  return;
199
204
  }
200
- canvasEl.value?.addEventListener("pointermove", onPointerMove);
205
+ handlePointerMove = true;
201
206
  if (e.pointerType === "touch") {
202
207
  return onTouchStart(e);
203
208
  }
@@ -228,7 +233,7 @@ function isClickInArtboard(coords) {
228
233
  return isInsideRect(coords.x, coords.y, rect);
229
234
  }
230
235
  function onPointerUp(e) {
231
- canvasEl.value?.removeEventListener("pointermove", onPointerMove);
236
+ handlePointerMove = false;
232
237
  if (e.button === MOUSE_BUTTON.AUXILIARY) {
233
238
  e.preventDefault();
234
239
  return;
@@ -427,72 +432,22 @@ function onClick(e) {
427
432
  e.stopPropagation();
428
433
  }
429
434
  const canvasEl = useTemplateRef("canvasEl");
430
- const canvasAttributes = computed(() => {
431
- return {
432
- width: ui.viewport.value.width * animation.dpi.value,
433
- height: ui.viewport.value.height * animation.dpi.value
434
- };
435
- });
436
- let gl = null;
437
- function initGl() {
438
- if (!canvasEl.value) {
439
- return;
440
- }
441
- gl = animation.gl();
442
- canvasEl.value.width = canvasAttributes.value.width;
443
- canvasEl.value.height = canvasAttributes.value.height;
444
- if (!gl) {
445
- return;
446
- }
447
- gl.enable(gl.BLEND);
448
- gl.enable(gl.SCISSOR_TEST);
449
- gl.disable(gl.DEPTH_TEST);
450
- gl.clearColor(0, 0, 0, 0);
451
- gl.viewport(0, 0, canvasAttributes.value.width, canvasAttributes.value.height);
452
- gl.blendFunc(gl.SRC_ALPHA_SATURATE, gl.ONE);
453
- gl.blendEquation(gl.FUNC_ADD);
454
- setScissor(scissor.value);
455
- }
456
- const scissor = computed(() => {
457
- const dpi = animation.dpi.value;
458
- return {
459
- x: ui.visibleViewport.value.x * dpi,
460
- y: canvasAttributes.value.height - ui.visibleViewport.value.y * dpi - ui.visibleViewport.value.height * dpi,
461
- width: Math.max(ui.visibleViewport.value.width * dpi, 1),
462
- height: Math.max(ui.visibleViewport.value.height * dpi, 1)
463
- };
464
- });
465
- function setScissor(v) {
466
- if (!gl) {
467
- return;
468
- }
469
- gl.scissor(v.x, v.y, v.width, v.height);
470
- }
471
- watch(scissor, setScissor);
472
- let lastCanvasWidth = 0;
473
- let lastCanvasHeight = 0;
474
- onBlokkliEvent("animationFrame", () => {
475
- if (!canvasEl.value) {
476
- return;
477
- }
478
- const canvasWidth = canvasAttributes.value.width;
479
- const canvasHeight = canvasAttributes.value.height;
480
- if (canvasWidth !== lastCanvasWidth || canvasHeight !== lastCanvasHeight) {
481
- canvasEl.value.width = canvasWidth;
482
- canvasEl.value.height = canvasHeight;
483
- if (gl) {
484
- gl.viewport(0, 0, canvasWidth, canvasHeight);
435
+ watch(
436
+ canvasEl,
437
+ (newCanvas, oldCanvas) => {
438
+ if (oldCanvas) {
439
+ handlePointerMove = false;
440
+ animation.removeCanvasElement();
485
441
  }
486
- lastCanvasWidth = canvasWidth;
487
- lastCanvasHeight = canvasHeight;
488
- }
489
- });
490
- onMounted(() => {
491
- initGl();
492
- });
442
+ if (newCanvas) {
443
+ animation.setCanvasElement(newCanvas);
444
+ animation.requestDraw();
445
+ }
446
+ },
447
+ { immediate: true }
448
+ );
493
449
  onBeforeUnmount(() => {
494
- if (canvasEl.value) {
495
- canvasEl.value.removeEventListener("pointermove", onPointerMove);
496
- }
450
+ animation.removeCanvasElement();
451
+ handlePointerMove = false;
497
452
  });
498
453
  </script>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <button
3
+ :id="'bk-menu-list-button-' + id"
4
+ class="bk-menu-list-button"
5
+ :disabled="disabled"
6
+ :class="type ? 'bk-is-' + type : ''"
7
+ @click.prevent.stop="onClick"
8
+ >
9
+ <div class="bk-menu-list-icon">
10
+ <slot>
11
+ <Icon v-if="icon" :name="icon" />
12
+ </slot>
13
+ </div>
14
+ <strong>{{ title }}</strong>
15
+ <span>{{ description }}</span>
16
+ </button>
17
+ </template>
18
+
19
+ <script setup>
20
+ import { Icon } from "#blokkli/components";
21
+ defineProps({
22
+ id: { type: String, required: true },
23
+ title: { type: String, required: true },
24
+ description: { type: String, required: true },
25
+ disabled: { type: Boolean, required: false },
26
+ icon: { type: null, required: false },
27
+ type: { type: String, required: false }
28
+ });
29
+ const emit = defineEmits(["click"]);
30
+ function onClick() {
31
+ emit("click");
32
+ }
33
+ </script>
34
+
35
+ <script>
36
+ export default {
37
+ name: "MenuButton"
38
+ };
39
+ </script>
@@ -6,8 +6,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
6
6
  disabled?: boolean;
7
7
  icon?: BlokkliIcon;
8
8
  type?: "success" | "danger" | "yellow";
9
- weight?: number;
10
- secondary?: boolean;
11
9
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
10
  click: (...args: any[]) => void;
13
11
  }, string, import("vue").PublicProps, Readonly<{
@@ -17,8 +15,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
17
15
  disabled?: boolean;
18
16
  icon?: BlokkliIcon;
19
17
  type?: "success" | "danger" | "yellow";
20
- weight?: number;
21
- secondary?: boolean;
22
18
  }> & Readonly<{
23
19
  onClick?: ((...args: any[]) => any) | undefined;
24
20
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
@@ -1,53 +1,75 @@
1
1
  <template>
2
- <Teleport to="#bk-toolbar-menu">
3
- <div class="bk-toolbar-menu">
4
- <button class="bk-toolbar-menu-button" @click.prevent.stop="onClick">
5
- <Icon name="menu" />
2
+ <BlokkliTransition name="menu">
3
+ <div v-if="menuOpen" class="bk bk-menu-list">
4
+ <button :class="{ 'bk-is-active': menuOpen }" @click="closeMenu">
5
+ <Icon name="close" />
6
6
  </button>
7
- </div>
8
- </Teleport>
9
- <Teleport to="body">
10
- <BlokkliTransition name="fade">
11
- <div
12
- v-if="menuOpen"
13
- class="bk bk-menu-overlay bk-overlay"
14
- @click="ui.menu.close()"
15
- />
16
- </BlokkliTransition>
17
- <BlokkliTransition name="menu">
18
- <div v-show="menuOpen" class="bk bk-menu-list">
19
- <button :class="{ 'bk-is-active': menuOpen }" @click="ui.menu.close">
20
- <Icon name="close" />
21
- </button>
22
- <div class="bk-menu-list-inner">
23
- <div id="bk-menu-primary" />
24
- <div id="bk-menu-secondary" />
25
- <aside class="bk-menu-meta">
26
- <div class="bk-menu-meta-logo">
27
- <Icon name="logo" />
28
- <div><strong>@blokkli/editor</strong> {{ blokkliVersion }}</div>
29
- </div>
30
-
31
- <div>
32
- <a href="https://www.blokk.li" target="_blank">blokk.li</a>
33
- </div>
34
- </aside>
7
+ <div class="bk-menu-list-inner">
8
+ <div id="bk-menu-primary">
9
+ <MenuButton
10
+ v-for="button in primaryButtons"
11
+ :id="button.id"
12
+ :key="button.id"
13
+ :title="button.title"
14
+ :description="button.description"
15
+ :icon="button.icon"
16
+ :type="button.type"
17
+ :disabled="button.disabled"
18
+ @click="onClick(button)"
19
+ />
20
+ </div>
21
+ <div id="bk-menu-secondary">
22
+ <MenuButton
23
+ v-for="button in secondaryButtons"
24
+ :id="button.id"
25
+ :key="button.id"
26
+ :title="button.title"
27
+ :description="button.description"
28
+ :icon="button.icon"
29
+ :type="button.type"
30
+ :disabled="button.disabled"
31
+ @click="onClick(button)"
32
+ />
35
33
  </div>
34
+ <aside class="bk-menu-meta">
35
+ <div class="bk-menu-meta-logo">
36
+ <Icon name="logo" />
37
+ <div><strong>@blokkli/editor</strong> {{ blokkliVersion }}</div>
38
+ </div>
39
+
40
+ <div>
41
+ <a href="https://www.blokk.li" target="_blank">blokk.li</a>
42
+ </div>
43
+ </aside>
36
44
  </div>
37
- </BlokkliTransition>
38
- </Teleport>
45
+ </div>
46
+ </BlokkliTransition>
39
47
  </template>
40
48
 
41
49
  <script setup>
42
50
  import { computed, useBlokkli } from "#imports";
43
51
  import { Icon, BlokkliTransition } from "#blokkli/components";
44
52
  import { blokkliVersion } from "#blokkli-build/config";
45
- const { ui, eventBus } = useBlokkli();
46
- const menuOpen = computed(() => ui.menu.isOpen.value);
47
- const onClick = () => {
48
- eventBus.emit("select", "");
49
- ui.menu.open();
50
- };
53
+ import MenuButton from "./MenuButton.vue";
54
+ import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
55
+ const DIALOG_MENU = "menu";
56
+ const { ui, plugins } = useBlokkli();
57
+ const menuOpen = computed(() => ui.currentDialog.value?.id === DIALOG_MENU);
58
+ function closeMenu() {
59
+ ui.closeDialog(DIALOG_MENU);
60
+ }
61
+ onBlokkliEvent("overlay:close", closeMenu);
62
+ const allButtons = computed(() => plugins.get("menuButton"));
63
+ const primaryButtons = computed(() => {
64
+ return allButtons.value.filter((button) => !button.secondary).sort((a, b) => (a.weight || 0) - (b.weight || 0));
65
+ });
66
+ const secondaryButtons = computed(() => {
67
+ return allButtons.value.filter((button) => button.secondary).sort((a, b) => (a.weight || 0) - (b.weight || 0));
68
+ });
69
+ function onClick(button) {
70
+ button.callback();
71
+ closeMenu();
72
+ }
51
73
  </script>
52
74
 
53
75
  <script>