@blokkli/editor 2.0.0-alpha.16 → 2.0.0-alpha.18

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 (194) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +640 -137
  3. package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +1 -1
  4. package/dist/modules/drupal/graphql/base/fragment.paragraphsFieldItem.graphql +3 -1
  5. package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +1 -10
  6. package/dist/modules/drupal/graphql/features/comments.graphql +11 -8
  7. package/dist/modules/drupal/graphql/mutations/set_paragraph_schedule.graphql +15 -0
  8. package/dist/modules/drupal/index.mjs +33 -0
  9. package/dist/modules/drupal/runtime/adapter/index.js +12 -4
  10. package/dist/runtime/adapter/index.d.ts +21 -0
  11. package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +3 -0
  12. package/dist/runtime/blokkliPlugins/ItemAction/index.vue +23 -15
  13. package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +20 -44
  14. package/dist/runtime/blokkliPlugins/TourItem/index.vue +10 -5
  15. package/dist/runtime/components/Blocks/FromLibrary/index.vue +4 -2
  16. package/dist/runtime/components/BlokkliEditable.vue +32 -14
  17. package/dist/runtime/components/BlokkliField.vue +3 -0
  18. package/dist/runtime/components/BlokkliField.vue.d.ts +3 -3
  19. package/dist/runtime/components/BlokkliItem.vue +1 -1
  20. package/dist/runtime/components/BlokkliItem.vue.d.ts +4 -2
  21. package/dist/runtime/components/BlokkliProvider.vue +41 -28
  22. package/dist/runtime/components/BlokkliProvider.vue.d.ts +2 -1
  23. package/dist/runtime/components/Edit/Actions/index.vue +36 -20
  24. package/dist/runtime/components/Edit/AnimationCanvas/index.vue +436 -25
  25. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +83 -0
  26. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue.d.ts +32 -0
  27. package/dist/runtime/components/Edit/Banner/index.vue +51 -0
  28. package/dist/runtime/components/Edit/Banner/index.vue.d.ts +18 -0
  29. package/dist/runtime/components/Edit/Dialog/index.vue +6 -4
  30. package/dist/runtime/components/Edit/DraggableList.vue +15 -7
  31. package/dist/runtime/components/Edit/DraggableList.vue.d.ts +5 -5
  32. package/dist/runtime/components/Edit/EditIndicator.vue +118 -44
  33. package/dist/runtime/components/Edit/EditIndicator.vue.d.ts +3 -0
  34. package/dist/runtime/components/Edit/EditProvider.vue +101 -31
  35. package/dist/runtime/components/Edit/EditProvider.vue.d.ts +3 -0
  36. package/dist/runtime/components/Edit/Features/AddList/index.vue +9 -11
  37. package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +28 -26
  38. package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue +1 -1
  39. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -11
  40. package/dist/runtime/components/Edit/Features/Anchors/Renderer.vue +19 -102
  41. package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +3 -0
  42. package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +29 -53
  43. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue +154 -0
  44. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue.d.ts +27 -0
  45. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +222 -0
  46. package/dist/runtime/components/Edit/Features/{Selection/AddButtons/AddButtonsField.vue.d.ts → BlockScheduler/Dialog/index.vue.d.ts} +6 -9
  47. package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +96 -0
  48. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +15 -16
  49. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +51 -0
  50. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/{Group → Item}/index.vue.d.ts +9 -13
  51. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +46 -66
  52. package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +2 -0
  53. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +35 -20
  54. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue.d.ts +5 -3
  55. package/dist/runtime/components/Edit/Features/Comments/CommentInput/index.vue +29 -0
  56. package/dist/runtime/components/Edit/Features/{Publish/Dialog/ScheduleDate.vue.d.ts → Comments/CommentInput/index.vue.d.ts} +2 -2
  57. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +22 -16
  58. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue.d.ts +1 -0
  59. package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +15 -6
  60. package/dist/runtime/components/Edit/Features/Comments/index.vue +21 -9
  61. package/dist/runtime/components/Edit/Features/Conversions/index.vue +4 -7
  62. package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +26 -35
  63. package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +240 -0
  64. package/dist/runtime/components/Edit/Features/Debug/Renderer.vue.d.ts +6 -0
  65. package/dist/runtime/components/Edit/Features/Debug/index.vue +7 -165
  66. package/dist/runtime/components/Edit/Features/Delete/index.vue +1 -1
  67. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +14 -6
  68. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +55 -48
  69. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +30 -18
  70. package/dist/runtime/components/Edit/Features/Duplicate/index.vue +6 -8
  71. package/dist/runtime/components/Edit/Features/Edit/index.vue +16 -22
  72. package/dist/runtime/components/Edit/Features/EditForm/index.vue +7 -6
  73. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +69 -4
  74. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +2 -2
  75. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +13 -9
  76. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +45 -87
  77. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +2 -2
  78. package/dist/runtime/components/Edit/Features/EditableField/index.vue +41 -43
  79. package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +11 -9
  80. package/dist/runtime/components/Edit/Features/Fragments/index.vue +3 -3
  81. package/dist/runtime/components/Edit/Features/History/index.vue +5 -2
  82. package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +139 -0
  83. package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue +261 -0
  84. package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue.d.ts +6 -0
  85. package/dist/runtime/components/Edit/Features/Hover/Overlay/vertex.glsl +117 -0
  86. package/dist/runtime/components/Edit/Features/Hover/index.vue +25 -0
  87. package/dist/runtime/components/Edit/Features/Hover/index.vue.d.ts +2 -0
  88. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +5 -7
  89. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +19 -27
  90. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +32 -28
  91. package/dist/runtime/components/Edit/Features/Library/index.vue +28 -23
  92. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +6 -3
  93. package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +15 -12
  94. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +36 -29
  95. package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +2 -4
  96. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +6 -1
  97. package/dist/runtime/components/Edit/Features/Options/Form/index.vue +8 -6
  98. package/dist/runtime/components/Edit/Features/Options/index.vue +6 -6
  99. package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue +35 -0
  100. package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue.d.ts +6 -0
  101. package/dist/runtime/components/Edit/Features/Ownership/index.vue +7 -25
  102. package/dist/runtime/components/Edit/Features/ProxyView/index.vue +5 -1
  103. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +68 -15
  104. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +15 -15
  105. package/dist/runtime/components/Edit/Features/Search/index.vue +4 -1
  106. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +39 -74
  107. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +7 -5
  108. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +106 -0
  109. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +440 -0
  110. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue.d.ts +32 -0
  111. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +102 -0
  112. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +53 -125
  113. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +2 -2
  114. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +88 -29
  115. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +5 -3
  116. package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +11 -2
  117. package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +2 -2
  118. package/dist/runtime/components/Edit/Features/Selection/index.vue +66 -39
  119. package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +2 -2
  120. package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +13 -6
  121. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +3 -0
  122. package/dist/runtime/components/Edit/Features/Transform/index.vue +2 -27
  123. package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +17 -11
  124. package/dist/runtime/components/Edit/Features/Translations/index.vue +20 -23
  125. package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +5 -5
  126. package/dist/runtime/components/Edit/Features/index.vue +17 -7
  127. package/dist/runtime/components/Edit/Form/Text/index.vue +2 -1
  128. package/dist/runtime/components/Edit/Form/Text/index.vue.d.ts +1 -0
  129. package/dist/runtime/components/Edit/Form/Toggle/index.vue +4 -3
  130. package/dist/runtime/components/Edit/Form/Toggle/index.vue.d.ts +12 -2
  131. package/dist/runtime/components/Edit/Indicators/index.vue +1 -1
  132. package/dist/runtime/components/Edit/InfoBox/index.vue +6 -2
  133. package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +12 -2
  134. package/dist/runtime/components/Edit/Konami/Game/index.vue +5 -5
  135. package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue → ScheduleDate/index.vue} +6 -58
  136. package/dist/runtime/components/Edit/ScheduleDate/index.vue.d.ts +23 -0
  137. package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +3 -0
  138. package/dist/runtime/components/Edit/Transition/Height.vue +95 -0
  139. package/dist/runtime/components/Edit/Transition/Height.vue.d.ts +36 -0
  140. package/dist/runtime/components/Edit/index.d.ts +7 -3
  141. package/dist/runtime/components/Edit/index.js +12 -4
  142. package/dist/runtime/composables/defineBlokkli.js +4 -2
  143. package/dist/runtime/css/output.css +1 -1
  144. package/dist/runtime/helpers/animationProvider.d.ts +35 -1
  145. package/dist/runtime/helpers/animationProvider.js +179 -48
  146. package/dist/runtime/helpers/composables/defineRenderer.d.ts +8 -0
  147. package/dist/runtime/helpers/composables/defineRenderer.js +8 -0
  148. package/dist/runtime/helpers/composables/useStateBasedCache.d.ts +4 -0
  149. package/dist/runtime/helpers/composables/useStateBasedCache.js +13 -0
  150. package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +4 -1
  151. package/dist/runtime/helpers/composables/useStickyToolbar.js +53 -35
  152. package/dist/runtime/helpers/definitionProvider.d.ts +1 -1
  153. package/dist/runtime/helpers/dom/index.d.ts +1 -0
  154. package/dist/runtime/helpers/domProvider.d.ts +54 -14
  155. package/dist/runtime/helpers/domProvider.js +168 -134
  156. package/dist/runtime/helpers/index.d.ts +1 -8
  157. package/dist/runtime/helpers/index.js +1 -84
  158. package/dist/runtime/helpers/providers/blocks.d.ts +10 -0
  159. package/dist/runtime/helpers/providers/blocks.js +91 -0
  160. package/dist/runtime/helpers/providers/directive.d.ts +24 -0
  161. package/dist/runtime/helpers/providers/directive.js +205 -0
  162. package/dist/runtime/helpers/providers/element.d.ts +6 -0
  163. package/dist/runtime/helpers/providers/element.js +35 -0
  164. package/dist/runtime/helpers/providers/fields.d.ts +8 -0
  165. package/dist/runtime/helpers/providers/fields.js +47 -0
  166. package/dist/runtime/helpers/selectionProvider.d.ts +11 -11
  167. package/dist/runtime/helpers/selectionProvider.js +38 -45
  168. package/dist/runtime/helpers/stateProvider.d.ts +7 -2
  169. package/dist/runtime/helpers/stateProvider.js +83 -14
  170. package/dist/runtime/helpers/storageProvider.d.ts +3 -2
  171. package/dist/runtime/helpers/storageProvider.js +6 -2
  172. package/dist/runtime/helpers/symbols.d.ts +1 -0
  173. package/dist/runtime/helpers/symbols.js +1 -0
  174. package/dist/runtime/helpers/themeProvider.d.ts +2 -1
  175. package/dist/runtime/helpers/themeProvider.js +24 -14
  176. package/dist/runtime/helpers/typesProvider.js +10 -26
  177. package/dist/runtime/helpers/uiProvider.d.ts +11 -3
  178. package/dist/runtime/helpers/uiProvider.js +45 -17
  179. package/dist/runtime/icons/calendar.svg +1 -0
  180. package/dist/runtime/icons/clock.svg +1 -0
  181. package/dist/runtime/icons/comment_add.svg +1 -5
  182. package/dist/runtime/icons/delete.svg +1 -8
  183. package/dist/runtime/icons/duplicate.svg +1 -12
  184. package/dist/runtime/icons/edit.svg +1 -8
  185. package/dist/runtime/icons/reusable.svg +1 -5
  186. package/dist/runtime/plugins/blokkliDirectives.js +96 -0
  187. package/dist/runtime/types/index.d.ts +66 -35
  188. package/package.json +1 -1
  189. package/dist/runtime/components/Edit/DragInteractions/index.vue +0 -401
  190. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +0 -63
  191. package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue +0 -54
  192. package/dist/runtime/plugins/blokkliEditable.js +0 -31
  193. /package/dist/runtime/components/Edit/{DragInteractions → Features/BlockScheduler}/index.vue.d.ts +0 -0
  194. /package/dist/runtime/plugins/{blokkliEditable.d.ts → blokkliDirectives.d.ts} +0 -0
@@ -0,0 +1,240 @@
1
+ <template>
2
+ <PluginSidebar id="debug" title="Debug" icon="bug" weight="200">
3
+ <div class="bk bk-debug">
4
+ <section>
5
+ <h2>Keyboard</h2>
6
+ <div class="bk-debug-list">
7
+ <div>
8
+ <div>Space</div>
9
+ <div>{{ keyboard.isPressingSpace.value }}</div>
10
+ </div>
11
+ <div>
12
+ <div>Control</div>
13
+ <div>{{ keyboard.isPressingControl.value }}</div>
14
+ </div>
15
+ </div>
16
+ </section>
17
+
18
+ <section>
19
+ <h2>Selection</h2>
20
+ <div class="bk-debug-list">
21
+ <div>
22
+ <div>Count</div>
23
+ <div>{{ selection.uuids.value.length }}</div>
24
+ </div>
25
+ <div>
26
+ <div>isDragging</div>
27
+ <div>{{ selection.isDragging.value }}</div>
28
+ </div>
29
+ <div>
30
+ <div>isDraggingExisting</div>
31
+ <div>{{ selection.isDraggingExisting.value }}</div>
32
+ </div>
33
+ <div>
34
+ <div>Is multiselecting</div>
35
+ <div>{{ selection.isMultiSelecting.value }}</div>
36
+ </div>
37
+ </div>
38
+ </section>
39
+
40
+ <section>
41
+ <h2>Rendering</h2>
42
+ <div class="bk-debug-list">
43
+ <div>
44
+ <div>DPI</div>
45
+ <div>{{ animation.dpi.value }}</div>
46
+ </div>
47
+ <div v-for="overlay in debug.overlays.value" :key="overlay.id">
48
+ <FormToggle
49
+ :label="overlay.label"
50
+ :model-value="overlay.active"
51
+ @update:model-value="debug.toggleOverlay(overlay.id)"
52
+ />
53
+ </div>
54
+ <div>
55
+ <FormToggle
56
+ label="Set transforming"
57
+ :model-value="ui.isTransforming.value"
58
+ @update:model-value="toggleTransforming"
59
+ />
60
+ </div>
61
+
62
+ <div>
63
+ <FormToggle
64
+ label="Enable WebGL"
65
+ :model-value="animation.webglEnabled.value"
66
+ @update:model-value="toggleWebgl"
67
+ />
68
+ </div>
69
+ <div>
70
+ <button
71
+ class="bk-button bk-is-small"
72
+ @click.prevent="() => dom.updateVisibleRects()"
73
+ >
74
+ Refresh Rects
75
+ </button>
76
+ </div>
77
+ </div>
78
+ </section>
79
+
80
+ <section>
81
+ <h2>Logging</h2>
82
+ <div class="bk-debug-list">
83
+ <div>
84
+ <div>
85
+ <FormToggle v-model="logEvents" label="Log Events" />
86
+ </div>
87
+ <div>
88
+ <button
89
+ class="bk-button bk-is-small"
90
+ @click.prevent="() => console.log(dom.getDebugData())"
91
+ >
92
+ Log DOM state
93
+ </button>
94
+ </div>
95
+ </div>
96
+ </div>
97
+ </section>
98
+
99
+ <section>
100
+ <h2>Icons</h2>
101
+ <div class="bk-debug-icons">
102
+ <div v-for="icon in iconItems" :key="icon">
103
+ <Icon :name="icon" />
104
+ <p>{{ icon }}</p>
105
+ </div>
106
+ </div>
107
+ </section>
108
+
109
+ <section>
110
+ <h2>Features</h2>
111
+ <div class="bk-debug-features">
112
+ <div v-for="feature in featuresList" :key="feature.id">
113
+ <div>
114
+ <span
115
+ class="bk-status-indicator"
116
+ :class="feature.mounted ? 'bk-is-success' : 'bk-is-danger'"
117
+ />
118
+ </div>
119
+ <div>
120
+ <h3>{{ feature.label }}</h3>
121
+ <div>{{ feature.id }}</div>
122
+ <p>{{ feature.description }}</p>
123
+ </div>
124
+ </div>
125
+ </div>
126
+ </section>
127
+ </div>
128
+ </PluginSidebar>
129
+
130
+ <PluginDebugOverlay id="viewport" title="Show viewport overlay">
131
+ <DebugViewport />
132
+ </PluginDebugOverlay>
133
+
134
+ <PluginDebugOverlay id="rects" title="Show field and block rects">
135
+ <DebugRects />
136
+ </PluginDebugOverlay>
137
+
138
+ <PluginItemDropdown
139
+ v-if="itemDropdownItems.length"
140
+ id="selection"
141
+ :title="$t('selectionActionGroupTitle', 'Selection')"
142
+ enabled
143
+ :items="itemDropdownItems"
144
+ icon="bug"
145
+ weight="200"
146
+ @select="onSelectDropdownItem"
147
+ />
148
+ </template>
149
+
150
+ <script setup>
151
+ import { useBlokkli, onMounted, onBeforeUnmount, computed } from "#imports";
152
+ import {
153
+ PluginSidebar,
154
+ PluginDebugOverlay,
155
+ PluginItemDropdown
156
+ } from "#blokkli/plugins";
157
+ import { Icon, FormToggle } from "#blokkli/components";
158
+ import { icons } from "#blokkli-build/icons";
159
+ import DebugViewport from "./Viewport/index.vue";
160
+ import DebugRects from "./Rects/index.vue";
161
+ const { logger } = defineProps({
162
+ logger: { type: Object, required: true }
163
+ });
164
+ const {
165
+ keyboard,
166
+ selection,
167
+ eventBus,
168
+ features,
169
+ debug,
170
+ ui,
171
+ animation,
172
+ dom,
173
+ storage,
174
+ $t
175
+ } = useBlokkli();
176
+ const logEvents = storage.use("debug:log-events", true);
177
+ const iconItems = computed(() => Object.keys(icons));
178
+ const featuresList = computed(() => {
179
+ return features.features.value.map((v) => {
180
+ const feature = features.mountedFeatures.value.find((f) => f.id === v.id);
181
+ return {
182
+ id: v.id,
183
+ label: v.label,
184
+ description: v.description,
185
+ dependencies: v.dependencies?.join(", "),
186
+ mounted: !!feature
187
+ };
188
+ });
189
+ });
190
+ const onEvent = (name, data) => {
191
+ if (!logEvents.value) {
192
+ return;
193
+ }
194
+ if (name === "animationFrame" || name === "animationFrame:before" || name === "animationFrame:after" || name === "canvas:draw") {
195
+ return;
196
+ }
197
+ logger.log("Event: " + String(name), data);
198
+ };
199
+ function toggleTransforming() {
200
+ if (ui.isTransforming.value) {
201
+ ui.setTransform();
202
+ } else {
203
+ ui.setTransform("Transform plugin label");
204
+ }
205
+ }
206
+ function toggleWebgl() {
207
+ if (animation.webglEnabled.value) {
208
+ animation.webglEnabled.value = false;
209
+ } else {
210
+ animation.webglEnabled.value = true;
211
+ }
212
+ }
213
+ onMounted(() => {
214
+ eventBus.on("*", onEvent);
215
+ });
216
+ onBeforeUnmount(() => {
217
+ eventBus.off("*", onEvent);
218
+ });
219
+ const itemDropdownItems = computed(() => {
220
+ if (selection.uuids.value.length === 1) {
221
+ return [
222
+ {
223
+ id: "copy-uuid",
224
+ label: "Copy UUID"
225
+ }
226
+ ];
227
+ }
228
+ return [];
229
+ });
230
+ async function onSelectDropdownItem(item) {
231
+ if (item.id === "copy-uuid") {
232
+ const type = "text/plain";
233
+ const clipboardItemData = {
234
+ [type]: selection.uuids.value.at(0) ?? ""
235
+ };
236
+ const clipboardItem = new ClipboardItem(clipboardItemData);
237
+ await navigator.clipboard.write([clipboardItem]);
238
+ }
239
+ }
240
+ </script>
@@ -0,0 +1,6 @@
1
+ import type { DebugLogger } from '#blokkli/helpers/debugProvider';
2
+ type __VLS_Props = {
3
+ logger: DebugLogger;
4
+ };
5
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ export default _default;
@@ -1,185 +1,27 @@
1
1
  <template>
2
- <PluginSidebar
3
- v-if="debug.isEnabled.value"
4
- id="debug"
5
- title="Debug"
6
- icon="bug"
7
- weight="200"
8
- >
9
- <div class="bk bk-debug">
10
- <section>
11
- <h2>Keyboard</h2>
12
- <div class="bk-debug-list">
13
- <div>
14
- <div>Space</div>
15
- <div>{{ keyboard.isPressingSpace.value }}</div>
16
- </div>
17
- <div>
18
- <div>Control</div>
19
- <div>{{ keyboard.isPressingControl.value }}</div>
20
- </div>
21
- </div>
22
- </section>
23
-
24
- <section>
25
- <h2>Selection</h2>
26
- <div class="bk-debug-list">
27
- <div>
28
- <div>Count</div>
29
- <div>{{ selection.uuids.value.length }}</div>
30
- </div>
31
- <div>
32
- <div>isDragging</div>
33
- <div>{{ selection.isDragging.value }}</div>
34
- </div>
35
- <div>
36
- <div>isDraggingExisting</div>
37
- <div>{{ selection.isDraggingExisting.value }}</div>
38
- </div>
39
- <div>
40
- <div>Is multiselecting</div>
41
- <div>{{ selection.isMultiSelecting.value }}</div>
42
- </div>
43
- </div>
44
- </section>
45
-
46
- <section>
47
- <h2>Rendering</h2>
48
- <div class="bk-debug-list">
49
- <div v-for="overlay in debug.overlays.value" :key="overlay.id">
50
- <FormToggle
51
- :label="overlay.label"
52
- :model-value="overlay.active"
53
- @update:model-value="debug.toggleOverlay(overlay.id)"
54
- />
55
- </div>
56
- <div>
57
- <FormToggle
58
- label="Set transforming"
59
- :model-value="ui.isTransforming.value"
60
- @update:model-value="toggleTransforming"
61
- />
62
- </div>
63
-
64
- <div>
65
- <FormToggle
66
- label="Enable WebGL"
67
- :model-value="animation.webglEnabled.value"
68
- @update:model-value="toggleWebgl"
69
- />
70
- </div>
71
- </div>
72
- </section>
73
-
74
- <section>
75
- <h2>Icons</h2>
76
- <div class="bk-debug-icons">
77
- <div v-for="icon in iconItems" :key="icon">
78
- <Icon :name="icon" />
79
- <p>{{ icon }}</p>
80
- </div>
81
- </div>
82
- </section>
83
-
84
- <section>
85
- <h2>Features</h2>
86
- <div class="bk-debug-features">
87
- <div v-for="feature in featuresList" :key="feature.id">
88
- <div>
89
- <span
90
- class="bk-status-indicator"
91
- :class="feature.mounted ? 'bk-is-success' : 'bk-is-danger'"
92
- />
93
- </div>
94
- <div>
95
- <h3>{{ feature.label }}</h3>
96
- <div>{{ feature.id }}</div>
97
- <p>{{ feature.description }}</p>
98
- </div>
99
- </div>
100
- </div>
101
- </section>
102
- </div>
103
- </PluginSidebar>
104
-
105
- <PluginDebugOverlay id="viewport" title="Show viewport overlay">
106
- <DebugViewport />
107
- </PluginDebugOverlay>
108
-
109
- <PluginDebugOverlay id="rects" title="Show field and block rects">
110
- <DebugRects />
111
- </PluginDebugOverlay>
2
+ <Renderer v-if="debug.isEnabled.value" :logger />
112
3
  </template>
113
4
 
114
5
  <script setup>
115
- import {
116
- useBlokkli,
117
- onMounted,
118
- onBeforeUnmount,
119
- defineBlokkliFeature,
120
- computed
121
- } from "#imports";
122
- import { PluginSidebar, PluginDebugOverlay } from "#blokkli/plugins";
123
- import { Icon, FormToggle } from "#blokkli/components";
124
- import { icons } from "#blokkli-build/icons";
125
6
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
126
- import DebugViewport from "./Viewport/index.vue";
127
- import DebugRects from "./Rects/index.vue";
7
+ import { defineBlokkliFeature, useBlokkli } from "#imports";
8
+ import Renderer from "./Renderer.vue";
128
9
  const { logger } = defineBlokkliFeature({
129
10
  id: "debug",
130
11
  label: "Debug",
131
12
  icon: "bug",
132
13
  description: "Provides debugging functionality."
133
14
  });
134
- const { keyboard, selection, eventBus, features, debug, ui, animation } = useBlokkli();
135
- const iconItems = computed(() => Object.keys(icons));
136
- const featuresList = computed(() => {
137
- return features.features.value.map((v) => {
138
- const feature = features.mountedFeatures.value.find((f) => f.id === v.id);
139
- return {
140
- id: v.id,
141
- label: v.label,
142
- description: v.description,
143
- dependencies: v.dependencies?.join(", "),
144
- mounted: !!feature
145
- };
146
- });
147
- });
15
+ const { debug, ui } = useBlokkli();
148
16
  onBlokkliEvent("keyPressed", (e) => {
17
+ if (ui.hasDialogOpen.value) {
18
+ return;
19
+ }
149
20
  if (e.code === "=" && e.meta) {
150
21
  e.originalEvent.preventDefault();
151
22
  debug.toggle();
152
23
  }
153
24
  });
154
- const onEvent = (name, data) => {
155
- if (!debug.isEnabled.value) {
156
- return;
157
- }
158
- if (name === "animationFrame" || name === "animationFrame:before" || name === "canvas:draw") {
159
- return;
160
- }
161
- logger.log("Event: " + String(name), data);
162
- };
163
- function toggleTransforming() {
164
- if (ui.isTransforming.value) {
165
- ui.setTransform();
166
- } else {
167
- ui.setTransform("Transform plugin label");
168
- }
169
- }
170
- function toggleWebgl() {
171
- if (animation.webglEnabled.value) {
172
- animation.webglEnabled.value = false;
173
- } else {
174
- animation.webglEnabled.value = true;
175
- }
176
- }
177
- onMounted(() => {
178
- eventBus.on("*", onEvent);
179
- });
180
- onBeforeUnmount(() => {
181
- eventBus.off("*", onEvent);
182
- });
183
25
  </script>
184
26
 
185
27
  <script>
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <PluginItemAction
3
3
  id="delete"
4
+ edit-only
4
5
  :title="$t('deleteButton', 'Delete')"
5
- :disabled="state.editMode.value !== 'editing'"
6
6
  multiple
7
7
  key-code="Delete"
8
8
  icon="delete"
@@ -7,7 +7,7 @@
7
7
  <BlokkliTransition name="drag-item">
8
8
  <div
9
9
  v-show="activeLabel"
10
- class="bk-dragging-overlay-label"
10
+ class="bk bk-dragging-overlay-label"
11
11
  :style="{ backgroundColor: currentActiveColor }"
12
12
  >
13
13
  <Icon name="cursor-move" />
@@ -69,7 +69,14 @@ import {
69
69
  import { Icon, ItemIcon, BlokkliTransition } from "#blokkli/components";
70
70
  import { easeOutElastic } from "#blokkli/helpers/easing";
71
71
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
72
- const { dom, ui, animation, theme, types } = useBlokkli();
72
+ const {
73
+ dom,
74
+ ui,
75
+ animation,
76
+ theme,
77
+ types,
78
+ element: elementProvider
79
+ } = useBlokkli();
73
80
  const props = defineProps({
74
81
  items: { type: Array, required: true },
75
82
  x: { type: Number, required: true },
@@ -201,7 +208,11 @@ onMounted(() => {
201
208
  if (!itemElement) {
202
209
  return;
203
210
  }
204
- const element = itemElement.querySelector(".bk-drop-element") || itemElement;
211
+ const element = elementProvider.query(
212
+ itemElement,
213
+ ".bk-drop-element",
214
+ "Find drop element for drag item."
215
+ ) || itemElement;
205
216
  return {
206
217
  rect: element.getBoundingClientRect(),
207
218
  element,
@@ -259,9 +270,6 @@ onMounted(() => {
259
270
  let bundle;
260
271
  let label = "";
261
272
  if (!markup) {
262
- if (item.item.itemType === "existing" && item.item.editTitle) {
263
- label = item.item.editTitle;
264
- }
265
273
  if ("itemBundle" in item.item) {
266
274
  bundle = item.item.itemBundle;
267
275
  if (bundle) {
@@ -14,6 +14,7 @@ import {
14
14
  toShaderColor
15
15
  } from "#blokkli/helpers";
16
16
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
17
+ import defineRenderer from "#blokkli/helpers/composables/defineRenderer";
17
18
  import { ref, computed, useBlokkli, onBeforeUnmount } from "#imports";
18
19
  import {
19
20
  setBuffersAndAttributes,
@@ -60,7 +61,8 @@ const {
60
61
  animation,
61
62
  state,
62
63
  runtimeConfig,
63
- types
64
+ types,
65
+ fields
64
66
  } = useBlokkli();
65
67
  const gl = animation.gl();
66
68
  const canvas = animation.getCanvasElement();
@@ -120,7 +122,7 @@ const emitDrop = async () => {
120
122
  if (!hostUuid || !fieldName) {
121
123
  return;
122
124
  }
123
- const field = dom.findField(hostUuid, fieldName);
125
+ const field = fields.find(hostUuid, fieldName);
124
126
  if (!field) {
125
127
  return;
126
128
  }
@@ -148,19 +150,21 @@ const emitDrop = async () => {
148
150
  const draggingBundles = computed(
149
151
  () => props.items.flatMap((item) => {
150
152
  const bundles = [];
151
- if ("itemBundle" in item && item.itemBundle) {
153
+ if (item.itemType === "existing" || item.itemType === "existing_structure") {
154
+ bundles.push(item.block.bundle);
155
+ if (item.block.library?.reusableBundle) {
156
+ bundles.push(item.block.library.reusableBundle);
157
+ }
158
+ } else if (item.itemBundle) {
152
159
  bundles.push(item.itemBundle);
153
160
  }
154
- if ("reusableBundle" in item && item.reusableBundle) {
155
- bundles.push(item.reusableBundle);
156
- }
157
161
  return bundles;
158
162
  }).filter(falsy)
159
163
  );
160
164
  const selectionUuids = computed(
161
165
  () => props.items.map((item) => {
162
166
  if (item.itemType === "existing") {
163
- return item.uuid;
167
+ return item.block.uuid;
164
168
  }
165
169
  }).filter(falsy)
166
170
  );
@@ -304,7 +308,7 @@ const buildFieldRect = (key) => {
304
308
  if (!uuid || !name) {
305
309
  return;
306
310
  }
307
- const field = dom.findField(uuid, name);
311
+ const field = fields.find(uuid, name);
308
312
  if (!field) {
309
313
  return;
310
314
  }
@@ -604,11 +608,11 @@ function setHoveredFieldArea(box, mouse) {
604
608
  }
605
609
  return;
606
610
  }
607
- const fields = Object.values(fieldCache);
611
+ const fields2 = Object.values(fieldCache);
608
612
  let highestNestingLevel = 0;
609
613
  let candidate = null;
610
- for (let i = 0; i < fields.length; i++) {
611
- const field = fields[i];
614
+ for (let i = 0; i < fields2.length; i++) {
615
+ const field = fields2[i];
612
616
  if (!field.canAddChildren) {
613
617
  continue;
614
618
  }
@@ -626,6 +630,8 @@ function setHoveredFieldArea(box, mouse) {
626
630
  activeHoverField.value = candidate;
627
631
  }
628
632
  }
633
+ let bufferInfo = null;
634
+ let bufferChanged = false;
629
635
  onBlokkliEvent("canvas:draw", () => {
630
636
  const scale = ui.artboardScale.value;
631
637
  const offset = { ...ui.artboardOffset.value };
@@ -636,11 +642,9 @@ onBlokkliEvent("canvas:draw", () => {
636
642
  height: props.box.height / scale
637
643
  };
638
644
  const mouseAbsolute = toCanvasSpaceCoordinates(props.mouseX, props.mouseY);
639
- if (gl && programInfo) {
640
- gl.useProgram(programInfo.program);
641
- animation.setSharedUniforms(gl, programInfo);
642
- }
643
- const { info, hasChanged } = collector.getBufferInfo();
645
+ const result = collector.getBufferInfo();
646
+ bufferInfo = result.info;
647
+ bufferChanged = result.hasChanged;
644
648
  if (!props.isTouch) {
645
649
  if (cursorIsInsideClipped()) {
646
650
  const closest = collector.getClosestIntersectingRect(
@@ -652,43 +656,46 @@ onBlokkliEvent("canvas:draw", () => {
652
656
  active.value = null;
653
657
  }
654
658
  }
655
- if (programInfo && gl) {
656
- setHoveredFieldArea(dragBox.value, mouseAbsolute);
657
- setUniforms(programInfo, uniforms.value);
658
- if (info) {
659
- if (hasChanged && gl && programInfo) {
660
- setBuffersAndAttributes(gl, programInfo, info);
661
- }
662
- if (gl) {
663
- drawBufferInfo(gl, info, gl.TRIANGLES);
659
+ setHoveredFieldArea(dragBox.value, mouseAbsolute);
660
+ if (!gl && ctx) {
661
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
662
+ const rects = Object.values(collector.rects);
663
+ for (let i = 0; i < rects.length; i++) {
664
+ const rect = rects[i];
665
+ if (active.value?.id === rect.id) {
666
+ ctx.fillStyle = rect.color;
667
+ } else {
668
+ ctx.fillStyle = rect.colorAlpha;
664
669
  }
670
+ ctx.fillRect(
671
+ (rect.x * scale + offset.x) * animation.dpi.value,
672
+ (rect.y * scale + offset.y) * animation.dpi.value,
673
+ rect.width * animation.dpi.value * scale,
674
+ rect.height * animation.dpi.value * scale
675
+ );
665
676
  }
666
- return;
667
- }
668
- if (!ctx) {
669
- return;
670
- }
671
- ctx.clearRect(0, 0, canvas.width, canvas.height);
672
- const rects = Object.values(collector.rects);
673
- for (let i = 0; i < rects.length; i++) {
674
- const rect = rects[i];
675
- if (active.value?.id === rect.id) {
676
- ctx.fillStyle = rect.color;
677
- } else {
678
- ctx.fillStyle = rect.colorAlpha;
679
- }
680
- ctx.fillRect(
681
- (rect.x * scale + offset.x) * animation.dpi.value,
682
- (rect.y * scale + offset.y) * animation.dpi.value,
683
- rect.width * animation.dpi.value * scale,
684
- rect.height * animation.dpi.value * scale
685
- );
686
677
  }
687
678
  });
679
+ if (gl && programInfo) {
680
+ defineRenderer("drop-targets", {
681
+ zIndex: 400,
682
+ only: true,
683
+ cursor: () => "grabbing",
684
+ render: () => {
685
+ gl.useProgram(programInfo.program);
686
+ animation.setSharedUniforms(gl, programInfo);
687
+ setUniforms(programInfo, uniforms.value);
688
+ if (!bufferInfo) {
689
+ return;
690
+ }
691
+ if (bufferChanged) {
692
+ setBuffersAndAttributes(gl, programInfo, bufferInfo);
693
+ }
694
+ drawBufferInfo(gl, bufferInfo, gl.TRIANGLES);
695
+ }
696
+ });
697
+ }
688
698
  onBeforeUnmount(() => {
689
- if (gl) {
690
- gl.clear(gl.COLOR_BUFFER_BIT);
691
- }
692
699
  if (ctx) {
693
700
  ctx.clearRect(0, 0, canvas.width, canvas.height);
694
701
  }