@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,27 +1,8 @@
1
1
  <template>
2
- <PluginAddAction
3
- v-if="
4
- adapter.addLibraryItem && adapter.getLibraryItems && isSupportedOnEntity
5
- "
6
- type="fragment"
7
- :title="$t('fragmentsAddFragmentAction', 'Add fragment')"
8
- :description="
9
- $t(
10
- 'fragmentsAddFragmentDescription',
11
- '<p>Drag the icon into the page to add a fragment block.</p><p>Fragments are reusable blocks that always render the same content.</p>'
12
- )
13
- "
14
- :disabled="!isEnabled"
15
- item-bundle="blokkli_fragment"
16
- icon="fragment"
17
- color="accent"
18
- @placed="placedAction = $event"
19
- />
20
-
21
- <Teleport to="body">
2
+ <Teleport :to="ui.mainLayoutElement.value">
22
3
  <BlokkliTransition name="slide-in">
23
4
  <FragmentsDialog
24
- v-if="placedAction && adapter.getLibraryItems"
5
+ v-if="placedAction"
25
6
  :field="placedAction.field"
26
7
  @close="placedAction = null"
27
8
  @submit="onAddFragment"
@@ -32,9 +13,9 @@
32
13
 
33
14
  <script setup>
34
15
  import { ref, useBlokkli, defineBlokkliFeature, computed } from "#imports";
35
- import { PluginAddAction } from "#blokkli/plugins";
36
16
  import FragmentsDialog from "./Dialog/index.vue";
37
17
  import { BlokkliTransition } from "#blokkli/components";
18
+ import defineAddAction from "#blokkli/helpers/composables/defineAddAction";
38
19
  const { adapter } = defineBlokkliFeature({
39
20
  id: "fragments",
40
21
  icon: "fragment",
@@ -43,15 +24,7 @@ const { adapter } = defineBlokkliFeature({
43
24
  requiredAdapterMethods: ["fragmentsAddBlock"],
44
25
  dependencies: ["add-list"]
45
26
  });
46
- const { state, $t, types, selection, dom } = useBlokkli();
47
- const isEnabled = computed(() => {
48
- const item = selection.item.value;
49
- if (item) {
50
- const field = dom.getRegisteredField(item.host.uuid, item.host.fieldName);
51
- return !!field?.allowedFragments.length;
52
- }
53
- return true;
54
- });
27
+ const { state, $t, types, dom, ui } = useBlokkli();
55
28
  const placedAction = ref(null);
56
29
  const onAddFragment = async (name) => {
57
30
  if (!placedAction.value || !adapter.fragmentsAddBlock) {
@@ -69,6 +42,29 @@ const onAddFragment = async (name) => {
69
42
  const isSupportedOnEntity = computed(
70
43
  () => types.generallyAvailableBundles.find((v) => v.id === "blokkli_fragment")
71
44
  );
45
+ defineAddAction(() => {
46
+ if (!isSupportedOnEntity.value) {
47
+ return;
48
+ }
49
+ return {
50
+ id: "fragment",
51
+ icon: "fragment",
52
+ color: "accent",
53
+ itemBundle: "blokkli_fragment",
54
+ title: $t("fragmentsAddFragmentAction", "Add fragment"),
55
+ description: $t(
56
+ "fragmentsAddFragmentDescription",
57
+ "<p>Drag the icon into the page to add a fragment block.</p><p>Fragments are reusable blocks that always render the same content.</p>"
58
+ ),
59
+ callback: (action) => {
60
+ placedAction.value = action;
61
+ },
62
+ enabled: (item) => {
63
+ const field = dom.getRegisteredField(item.host.uuid, item.host.fieldName);
64
+ return !!field?.allowedFragments.length;
65
+ }
66
+ };
67
+ });
72
68
  </script>
73
69
 
74
70
  <script>
@@ -0,0 +1,141 @@
1
+ #version 300 es
2
+
3
+ precision highp float;
4
+
5
+ in vec4 v_quad;
6
+ in vec4 v_rect_radius;
7
+ in vec2 v_rect_size;
8
+ in vec2 v_rect_center;
9
+ in float v_rect_type;
10
+ in vec2 v_quad_artboard_pos;
11
+ // Optimized varyings calculated in vertex shader
12
+ in vec4 v_corner_radii;
13
+ in float v_border_thickness;
14
+ in vec2 v_half_size;
15
+ in vec3 v_color;
16
+ in float v_dash_cycle;
17
+ in vec2 v_rect_size_artboard;
18
+
19
+ out vec4 fragColor;
20
+
21
+ uniform float u_opacity;
22
+
23
+ int pseudoQuadrant(vec2 p) {
24
+ return int(floor(step(0.0, p.x) + 2.0 * step(0.0, -p.y)));
25
+ }
26
+
27
+ float sdRoundBox(vec2 p, vec2 b, vec4 radii) {
28
+ int idx = pseudoQuadrant(p);
29
+ float cr;
30
+ if (idx == 0) cr = radii[0];
31
+ else if (idx == 1) cr = radii[1];
32
+ else if (idx == 2) cr = radii[3];
33
+ else cr = radii[2];
34
+ vec2 q = abs(p) - b + cr;
35
+ return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - cr;
36
+ }
37
+
38
+ void main() {
39
+ vec2 posRelativeToQuad = gl_FragCoord.xy - v_rect_center;
40
+
41
+ float mainDist = sdRoundBox(posRelativeToQuad, v_half_size, v_corner_radii);
42
+
43
+ // For editable fields (type 2), render both fill and solid border
44
+ if (v_rect_type > 1.5 && v_rect_type < 2.5) {
45
+ float u_edgeSoftness = 1.0;
46
+ float u_borderSoftness = 1.0;
47
+
48
+ // Render fill
49
+ float fillAlpha = 1.0 - smoothstep(-u_edgeSoftness, 0.0, mainDist);
50
+ vec4 fillColor = vec4(v_color, 0.2);
51
+
52
+ // Render solid border (non-dashed)
53
+ float borderAlpha =
54
+ 1.0 -
55
+ smoothstep(-u_borderSoftness, 0.0, abs(mainDist) - v_border_thickness);
56
+ vec4 borderColor = vec4(v_color, 1.0);
57
+
58
+ // Combine fill and border
59
+ vec4 combined = mix(
60
+ vec4(fillColor.rgb, fillAlpha * fillColor.a),
61
+ borderColor,
62
+ borderAlpha * borderColor.a
63
+ );
64
+
65
+ combined.a *= u_opacity;
66
+ fragColor = combined;
67
+ return;
68
+ }
69
+
70
+ // For blocks (type 0, 1, and 3), render border
71
+ float u_borderSoftness = 1.0;
72
+
73
+ float borderAlpha =
74
+ 1.0 -
75
+ smoothstep(-u_borderSoftness, 0.0, abs(mainDist) - v_border_thickness);
76
+
77
+ // Apply dashed pattern for all blocks
78
+ // Calculate perimeter distance in artboard space for scale-independent dashing
79
+
80
+ // Convert pixel position from viewport to artboard space
81
+ vec2 viewportToArtboardRatio = v_rect_size_artboard / v_rect_size;
82
+ vec2 posRelativeToQuad_artboard = posRelativeToQuad * viewportToArtboardRatio;
83
+
84
+ // Get artboard-space half dimensions
85
+ vec2 halfSize_artboard = v_rect_size_artboard / 2.0;
86
+
87
+ // Convert from center-relative to top-left-relative coordinates
88
+ vec2 posFromTopLeft = posRelativeToQuad_artboard + halfSize_artboard;
89
+
90
+ // Clamp to rect bounds to avoid edge issues
91
+ vec2 p = clamp(posFromTopLeft, vec2(0.0), v_rect_size_artboard);
92
+
93
+ // Two continuous dash paths anchored to visual top-left:
94
+ // Path 1: TOP (left→right) → RIGHT (top→bottom)
95
+ // Path 2: LEFT (top→bottom) → BOTTOM (left→right)
96
+ float perimeterDistance = 0.0;
97
+ float width = v_rect_size_artboard.x;
98
+ float height = v_rect_size_artboard.y;
99
+
100
+ // Determine which edge we're on based on distance to edges
101
+ vec2 absP = abs(posRelativeToQuad_artboard);
102
+ float dx = absP.x - halfSize_artboard.x;
103
+ float dy = absP.y - halfSize_artboard.y;
104
+
105
+ if (dy > dx) {
106
+ // Closer to top or bottom edge
107
+ if (posRelativeToQuad_artboard.y > 0.0) {
108
+ // Visual TOP edge: starts at top-left, goes left to right
109
+ perimeterDistance = p.x;
110
+ } else {
111
+ // Visual BOTTOM edge: continues from LEFT edge, then goes left to right
112
+ perimeterDistance = height + p.x;
113
+ }
114
+ } else {
115
+ // Closer to left or right edge
116
+ if (posRelativeToQuad_artboard.x < 0.0) {
117
+ // Visual LEFT edge: starts at visual top-left (0 at top, height at bottom)
118
+ perimeterDistance = height - p.y;
119
+ } else {
120
+ // Visual RIGHT edge: continues from TOP edge (width at visual top, width+height at visual bottom)
121
+ perimeterDistance = width + (height - p.y);
122
+ }
123
+ }
124
+
125
+ float dashPosition = mod(perimeterDistance, v_dash_cycle);
126
+ // dashWidth = v_dash_cycle / 2.0 (since dashWidth = dashGap = 7.0, dashCycle = 14.0)
127
+ float dashFactor = step(dashPosition, v_dash_cycle / 2.0);
128
+
129
+ // Only show dashes...
130
+ borderAlpha *= dashFactor;
131
+
132
+ vec4 borderColor = vec4(v_color, 1.0);
133
+ vec4 finalColor = mix(
134
+ vec4(0.0, 0.0, 0.0, 0.0),
135
+ borderColor,
136
+ borderAlpha * borderColor.a
137
+ );
138
+
139
+ finalColor.a *= u_opacity;
140
+ fragColor = finalColor;
141
+ }
@@ -6,16 +6,16 @@
6
6
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
7
7
  import defineRenderer from "#blokkli/helpers/composables/defineRenderer";
8
8
  import { useBlokkli, computed, ref, watch } from "#imports";
9
- import { setBuffersAndAttributes, drawBufferInfo, setUniforms } from "twgl.js";
9
+ import {
10
+ setBuffersAndAttributes,
11
+ drawBufferInfo,
12
+ setUniforms
13
+ } from "twgl.js";
10
14
  import vs from "./vertex.glsl?raw";
11
15
  import fs from "./fragment.glsl?raw";
12
16
  import { RectangleBufferCollector } from "#blokkli/helpers/webgl";
13
17
  import { toShaderColor, isInsideRect } from "#blokkli/helpers";
14
- const props = defineProps({
15
- gl: { type: null, required: true }
16
- });
17
18
  const { animation, theme, dom, selection, state, ui, directive, blocks } = useBlokkli();
18
- const programInfo = animation.registerProgram("hover", props.gl, [vs, fs]);
19
19
  const MAX_RECTS = 11;
20
20
  function getDeepestUuid(uuids) {
21
21
  if (uuids.length === 0) {
@@ -48,22 +48,13 @@ let previousEditableFieldRect = null;
48
48
  const isHoveringEditableField = ref(false);
49
49
  const isHoveringSelectedBlock = ref(false);
50
50
  class HoverRectangleBufferCollector extends RectangleBufferCollector {
51
+ getBufferInfo(gl) {
52
+ if (!this.bufferInfo) {
53
+ this.bufferInfo = this.createBufferInfo(gl);
54
+ }
55
+ return this.bufferInfo;
56
+ }
51
57
  }
52
- const collector = new HoverRectangleBufferCollector(props.gl);
53
- for (let i = 0; i < MAX_RECTS; i++) {
54
- collector.addRectangle(
55
- {
56
- id: `hover-rect-${i}`,
57
- x: 0,
58
- y: 0,
59
- width: 100,
60
- height: 100,
61
- radius: [0, 0, 0, 0]
62
- },
63
- 0
64
- );
65
- }
66
- const bufferInfo = collector.createBufferInfo();
67
58
  function resetHoverState() {
68
59
  previousHoveredUuids = [];
69
60
  previousDeepestUuid = null;
@@ -201,11 +192,11 @@ function updateHoverState(mouseX, mouseY, offset, scale, artboardSize) {
201
192
  }
202
193
  const uniforms = computed(() => {
203
194
  return {
204
- u_color_mono: toShaderColor(theme.mono.value[300]),
205
- u_color_accent: toShaderColor(theme.accent.value[600]),
206
- u_color_teal: toShaderColor(theme.teal.value.normal),
207
- u_color_white: toShaderColor([255, 255, 255]),
208
- u_color_lime: toShaderColor(theme.lime.value.normal)
195
+ u_color_mono: theme.mono.value[300],
196
+ u_color_accent: theme.accent.value[600],
197
+ u_color_teal: theme.teal.value.normal,
198
+ u_color_white: [255, 255, 255],
199
+ u_color_lime: theme.lime.value.normal
209
200
  };
210
201
  });
211
202
  onBlokkliEvent("state:reloaded", () => {
@@ -214,9 +205,26 @@ onBlokkliEvent("state:reloaded", () => {
214
205
  onBlokkliEvent("ui:resized", () => {
215
206
  resetHoverState();
216
207
  });
217
- defineRenderer("hover-overlay", {
208
+ const { collector } = defineRenderer("hover-overlay", {
218
209
  zIndex: 200,
219
- enabled: () => !selection.isChangingOptions.value,
210
+ collector: () => {
211
+ const c = new HoverRectangleBufferCollector();
212
+ for (let i = 0; i < MAX_RECTS; i++) {
213
+ c.addRectangle(
214
+ {
215
+ id: `hover-rect-${i}`,
216
+ x: 0,
217
+ y: 0,
218
+ width: 100,
219
+ height: 100,
220
+ radius: [0, 0, 0, 0]
221
+ },
222
+ 0
223
+ );
224
+ }
225
+ return c;
226
+ },
227
+ program: () => ({ shaders: [vs, fs] }),
220
228
  cursor: () => {
221
229
  if (isHoveringEditableField.value && state.editMode.value !== "readonly") {
222
230
  return "text";
@@ -226,10 +234,8 @@ defineRenderer("hover-overlay", {
226
234
  }
227
235
  return null;
228
236
  },
229
- render: (ctx) => {
230
- if (!bufferInfo) {
231
- return;
232
- }
237
+ render: (ctx, gl, program) => {
238
+ const bufferInfo = collector.getBufferInfo(gl);
233
239
  if (!ui.openTooltip.value) {
234
240
  updateHoverState(
235
241
  ctx.mouseX,
@@ -239,17 +245,198 @@ defineRenderer("hover-overlay", {
239
245
  ctx.artboardSize
240
246
  );
241
247
  }
242
- props.gl.useProgram(programInfo.program);
243
- setUniforms(programInfo, uniforms.value);
244
- setUniforms(programInfo, {
248
+ gl.useProgram(program.program);
249
+ setUniforms(program, {
250
+ u_color_mono: toShaderColor(uniforms.value.u_color_mono),
251
+ u_color_accent: toShaderColor(uniforms.value.u_color_accent),
252
+ u_color_teal: toShaderColor(uniforms.value.u_color_teal),
253
+ u_color_white: toShaderColor(uniforms.value.u_color_white),
254
+ u_color_lime: toShaderColor(uniforms.value.u_color_lime),
245
255
  u_hover_positions: hoverState.positions,
246
256
  u_hover_radii: hoverState.radii,
247
257
  u_hover_types: hoverState.types,
248
- u_hover_visible: hoverState.visible
258
+ u_hover_visible: hoverState.visible,
259
+ u_opacity: ctx.changeOptionsTransition
249
260
  });
250
- animation.setSharedUniforms(props.gl, programInfo);
251
- setBuffersAndAttributes(props.gl, programInfo, bufferInfo);
252
- drawBufferInfo(props.gl, bufferInfo, props.gl.TRIANGLES);
261
+ animation.setSharedUniforms(gl, program);
262
+ setBuffersAndAttributes(gl, program, bufferInfo);
263
+ drawBufferInfo(gl, bufferInfo, gl.TRIANGLES);
264
+ },
265
+ renderFallback: (ctx, ctx2d) => {
266
+ if (!ui.openTooltip.value) {
267
+ updateHoverState(
268
+ ctx.mouseX,
269
+ ctx.mouseY,
270
+ ctx.artboardOffset,
271
+ ctx.artboardScale,
272
+ ctx.artboardSize
273
+ );
274
+ }
275
+ const rgbToCss = (rgb) => {
276
+ return `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`;
277
+ };
278
+ const rgbaToCss = (rgb, alpha) => {
279
+ return `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${alpha})`;
280
+ };
281
+ const colors = uniforms.value;
282
+ const borderThickness = 1.5 * ctx.dpi;
283
+ const dashLength = 7 * ctx.dpi;
284
+ ctx2d.globalAlpha = ctx.changeOptionsTransition;
285
+ for (let i = 0; i < MAX_RECTS; i++) {
286
+ if (hoverState.visible[i] !== 1) {
287
+ continue;
288
+ }
289
+ const x = hoverState.positions[i * 4 + 0];
290
+ const y = hoverState.positions[i * 4 + 1];
291
+ const width = hoverState.positions[i * 4 + 2];
292
+ const height = hoverState.positions[i * 4 + 3];
293
+ const radiusTopLeft = hoverState.radii[i * 4 + 0];
294
+ const radiusTopRight = hoverState.radii[i * 4 + 1];
295
+ const radiusBottomRight = hoverState.radii[i * 4 + 2];
296
+ const radiusBottomLeft = hoverState.radii[i * 4 + 3];
297
+ const viewportX = (x * ctx.artboardScale + ctx.artboardOffset.x) * ctx.dpi;
298
+ const viewportY = (y * ctx.artboardScale + ctx.artboardOffset.y) * ctx.dpi;
299
+ const viewportWidth = width * ctx.artboardScale * ctx.dpi;
300
+ const viewportHeight = height * ctx.artboardScale * ctx.dpi;
301
+ const type = hoverState.types[i];
302
+ if (type === 2) {
303
+ ctx2d.fillStyle = rgbaToCss(colors.u_color_teal, 0.2);
304
+ const maxRadius = Math.min(viewportWidth, viewportHeight) / 2;
305
+ const rtl = Math.min(
306
+ radiusTopLeft * ctx.artboardScale * ctx.dpi,
307
+ maxRadius
308
+ );
309
+ const rtr = Math.min(
310
+ radiusTopRight * ctx.artboardScale * ctx.dpi,
311
+ maxRadius
312
+ );
313
+ const rbr = Math.min(
314
+ radiusBottomRight * ctx.artboardScale * ctx.dpi,
315
+ maxRadius
316
+ );
317
+ const rbl = Math.min(
318
+ radiusBottomLeft * ctx.artboardScale * ctx.dpi,
319
+ maxRadius
320
+ );
321
+ ctx2d.beginPath();
322
+ ctx2d.moveTo(viewportX + rtl, viewportY);
323
+ ctx2d.lineTo(viewportX + viewportWidth - rtr, viewportY);
324
+ if (rtr > 0) {
325
+ ctx2d.arcTo(
326
+ viewportX + viewportWidth,
327
+ viewportY,
328
+ viewportX + viewportWidth,
329
+ viewportY + rtr,
330
+ rtr
331
+ );
332
+ }
333
+ ctx2d.lineTo(
334
+ viewportX + viewportWidth,
335
+ viewportY + viewportHeight - rbr
336
+ );
337
+ if (rbr > 0) {
338
+ ctx2d.arcTo(
339
+ viewportX + viewportWidth,
340
+ viewportY + viewportHeight,
341
+ viewportX + viewportWidth - rbr,
342
+ viewportY + viewportHeight,
343
+ rbr
344
+ );
345
+ }
346
+ ctx2d.lineTo(viewportX + rbl, viewportY + viewportHeight);
347
+ if (rbl > 0) {
348
+ ctx2d.arcTo(
349
+ viewportX,
350
+ viewportY + viewportHeight,
351
+ viewportX,
352
+ viewportY + viewportHeight - rbl,
353
+ rbl
354
+ );
355
+ }
356
+ ctx2d.lineTo(viewportX, viewportY + rtl);
357
+ if (rtl > 0) {
358
+ ctx2d.arcTo(viewportX, viewportY, viewportX + rtl, viewportY, rtl);
359
+ }
360
+ ctx2d.closePath();
361
+ ctx2d.fill();
362
+ ctx2d.strokeStyle = rgbToCss(colors.u_color_teal);
363
+ ctx2d.lineWidth = borderThickness;
364
+ ctx2d.setLineDash([]);
365
+ ctx2d.stroke();
366
+ } else {
367
+ let strokeColor = colors.u_color_mono;
368
+ if (type === 4) {
369
+ strokeColor = colors.u_color_lime;
370
+ } else if (type === 3) {
371
+ strokeColor = colors.u_color_white;
372
+ } else if (type === 1) {
373
+ strokeColor = colors.u_color_accent;
374
+ }
375
+ ctx2d.strokeStyle = rgbToCss(strokeColor);
376
+ ctx2d.lineWidth = borderThickness;
377
+ ctx2d.setLineDash([dashLength, dashLength]);
378
+ const maxRadius = Math.min(viewportWidth, viewportHeight) / 2;
379
+ const rtl = Math.min(
380
+ radiusTopLeft * ctx.artboardScale * ctx.dpi,
381
+ maxRadius
382
+ );
383
+ const rtr = Math.min(
384
+ radiusTopRight * ctx.artboardScale * ctx.dpi,
385
+ maxRadius
386
+ );
387
+ const rbr = Math.min(
388
+ radiusBottomRight * ctx.artboardScale * ctx.dpi,
389
+ maxRadius
390
+ );
391
+ const rbl = Math.min(
392
+ radiusBottomLeft * ctx.artboardScale * ctx.dpi,
393
+ maxRadius
394
+ );
395
+ ctx2d.beginPath();
396
+ ctx2d.moveTo(viewportX + rtl, viewportY);
397
+ ctx2d.lineTo(viewportX + viewportWidth - rtr, viewportY);
398
+ if (rtr > 0) {
399
+ ctx2d.arcTo(
400
+ viewportX + viewportWidth,
401
+ viewportY,
402
+ viewportX + viewportWidth,
403
+ viewportY + rtr,
404
+ rtr
405
+ );
406
+ }
407
+ ctx2d.lineTo(
408
+ viewportX + viewportWidth,
409
+ viewportY + viewportHeight - rbr
410
+ );
411
+ if (rbr > 0) {
412
+ ctx2d.arcTo(
413
+ viewportX + viewportWidth,
414
+ viewportY + viewportHeight,
415
+ viewportX + viewportWidth - rbr,
416
+ viewportY + viewportHeight,
417
+ rbr
418
+ );
419
+ }
420
+ ctx2d.lineTo(viewportX + rbl, viewportY + viewportHeight);
421
+ if (rbl > 0) {
422
+ ctx2d.arcTo(
423
+ viewportX,
424
+ viewportY + viewportHeight,
425
+ viewportX,
426
+ viewportY + viewportHeight - rbl,
427
+ rbl
428
+ );
429
+ }
430
+ ctx2d.lineTo(viewportX, viewportY + rtl);
431
+ if (rtl > 0) {
432
+ ctx2d.arcTo(viewportX, viewportY, viewportX + rtl, viewportY, rtl);
433
+ }
434
+ ctx2d.closePath();
435
+ ctx2d.stroke();
436
+ }
437
+ ctx2d.setLineDash([]);
438
+ }
439
+ ctx2d.globalAlpha = 1;
253
440
  }
254
441
  });
255
442
  </script>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -1,12 +1,14 @@
1
+ #version 300 es
2
+
1
3
  precision highp float;
2
4
 
3
5
  // [x, y] position.
4
- attribute vec2 a_position;
6
+ in vec2 a_position;
5
7
  // The [x,y,width, height] of the quad the vertex belongs to.
6
- attribute vec4 a_quad;
7
- attribute float a_rect_id;
8
- attribute float a_rect_type;
9
- attribute vec4 a_rect_radius;
8
+ in vec4 a_quad;
9
+ in float a_rect_id;
10
+ in float a_rect_type;
11
+ in vec4 a_rect_radius;
10
12
 
11
13
  // The global scaling applied to all quads.
12
14
  uniform float u_scale;
@@ -23,13 +25,27 @@ uniform vec4 u_hover_radii[11]; // topLeft, topRight, bottomRight, bottomLeft
23
25
  uniform float u_hover_types[11]; // 0=mono, 1=accent, 2=teal fill
24
26
  uniform float u_hover_visible[11]; // 0=hidden, 1=visible
25
27
 
28
+ // Color uniforms
29
+ uniform vec3 u_color_mono;
30
+ uniform vec3 u_color_accent;
31
+ uniform vec3 u_color_teal;
32
+ uniform vec3 u_color_white;
33
+ uniform vec3 u_color_lime;
34
+
26
35
  // The transformed quad for the fragment shader.
27
- varying vec4 v_quad;
28
- varying vec4 v_rect_radius;
29
- varying vec2 v_rect_size;
30
- varying vec2 v_rect_center;
31
- varying float v_rect_type;
32
- varying vec2 v_quad_artboard_pos;
36
+ out vec4 v_quad;
37
+ out vec4 v_rect_radius;
38
+ out vec2 v_rect_size;
39
+ out vec2 v_rect_center;
40
+ out float v_rect_type;
41
+ out vec2 v_quad_artboard_pos;
42
+ // Optimized varyings to reduce fragment shader calculations
43
+ out vec4 v_corner_radii;
44
+ out float v_border_thickness;
45
+ out vec2 v_half_size;
46
+ out vec3 v_color;
47
+ out float v_dash_cycle;
48
+ out vec2 v_rect_size_artboard;
33
49
 
34
50
  void main() {
35
51
  int rectIndex = int(a_rect_id);
@@ -114,4 +130,26 @@ void main() {
114
130
  v_rect_type = hoverType;
115
131
  // Pass the original artboard-space quad position for stable dash pattern
116
132
  v_quad_artboard_pos = vec2(hoverPos.x, hoverPos.y);
133
+
134
+ // Calculate optimized values once per vertex instead of per fragment
135
+ // Corner radii clamped to max radius
136
+ v_corner_radii = min(v_rect_radius, min(v_rect_size.x, v_rect_size.y) / 2.0);
137
+
138
+ v_border_thickness = 1.5 * u_dpi;
139
+ v_half_size = v_rect_size / 2.0;
140
+ v_dash_cycle = 14.0 - u_scale * 1.0;
141
+ v_rect_size_artboard = vec2(hoverPos.z, hoverPos.w);
142
+
143
+ // Select color based on type: 0 = mono, 1 = accent, 2 = teal, 3 = white (inverted), 4 = lime (library)
144
+ if (hoverType > 3.5) {
145
+ v_color = u_color_lime;
146
+ } else if (hoverType > 2.5) {
147
+ v_color = u_color_white;
148
+ } else if (hoverType > 1.5) {
149
+ v_color = u_color_teal;
150
+ } else if (hoverType > 0.5) {
151
+ v_color = u_color_accent;
152
+ } else {
153
+ v_color = u_color_mono;
154
+ }
117
155
  }
@@ -1,20 +1,23 @@
1
1
  <template>
2
- <Overlay v-if="isVisible && gl && animation.webglEnabled.value" :gl="gl" />
2
+ <ErrorBoundary v-model="isLocked" :label="$t('feature_hover_label', 'Hover')">
3
+ <Renderer v-if="isVisible" :key="animation.renderKey.value" />
4
+ </ErrorBoundary>
3
5
  </template>
4
6
 
5
7
  <script setup>
6
- import Overlay from "./Overlay/index.vue";
7
- import { computed, useBlokkli, defineBlokkliFeature } from "#imports";
8
+ import Renderer from "./Renderer/index.vue";
9
+ import { computed, useBlokkli, defineBlokkliFeature, ref } from "#imports";
10
+ import { ErrorBoundary } from "#blokkli/components";
8
11
  defineBlokkliFeature({
9
12
  id: "hover",
10
13
  icon: "selection",
11
14
  label: "Hover",
12
15
  description: "Renders a border around blocks that are currently being hovered."
13
16
  });
14
- const { selection, ui, animation, dom } = useBlokkli();
15
- const gl = animation.gl();
17
+ const { selection, ui, dom, animation, $t } = useBlokkli();
18
+ const isLocked = ref(false);
16
19
  const isVisible = computed(
17
- () => dom.isReady.value && !selection.isMultiSelecting.value && !selection.editableActive.value && !selection.isDragging.value && !ui.hasTransformOverlayOpen.value && !ui.hasDialogOpen.value && !ui.isAnimating.value
20
+ () => !isLocked.value && dom.isReady.value && !selection.isMultiSelecting.value && !selection.editableActive.value && !selection.isDragging.value && !ui.hasTransformOverlayOpen.value && !ui.hasDialogOpen.value && !ui.isAnimating.value
18
21
  );
19
22
  </script>
20
23
 
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <DialogModal
3
+ id="import-existing"
3
4
  :title="$t('importExistingDialogTitle', 'Import from existing page')"
4
5
  :lead="
5
6
  $t(