@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
@@ -63,16 +63,6 @@
63
63
  </div>
64
64
  </div>
65
65
  </PluginSidebar>
66
- <PluginItemDropdown
67
- id="clipboard"
68
- :title="$t('clipboard', 'Clipboard')"
69
- :enabled="
70
- !!selection.items.value.length && state.editMode.value === 'editing'
71
- "
72
- :items="itemDropdownItems"
73
- icon="clipboard"
74
- @select="onSelectDropdownItem"
75
- />
76
66
  </template>
77
67
 
78
68
  <script setup>
@@ -84,9 +74,10 @@ import {
84
74
  onUnmounted,
85
75
  computed
86
76
  } from "#imports";
87
- import { PluginSidebar, PluginItemDropdown } from "#blokkli/plugins";
77
+ import { PluginSidebar } from "#blokkli/plugins";
78
+ import defineItemDropdownAction from "#blokkli/helpers/composables/defineItemDropdownAction";
88
79
  import ClipboardList from "./List/index.vue";
89
- import { generateUUID, getFieldKey } from "#blokkli/helpers";
80
+ import { falsy, generateUUID, getFieldKey } from "#blokkli/helpers";
90
81
  import { Icon } from "#blokkli/components";
91
82
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
92
83
  import defineShortcut from "#blokkli/helpers/composables/defineShortcut";
@@ -109,7 +100,7 @@ const { settings, logger } = defineBlokkliFeature({
109
100
  },
110
101
  screenshot: "feature-clipboard.jpg"
111
102
  });
112
- const { selection, $t, adapter, state, ui, types, keyboard, blocks } = useBlokkli();
103
+ const { selection, $t, adapter, state, ui, types, keyboard, blocks, fields } = useBlokkli();
113
104
  const plugin = ref(null);
114
105
  const selectionClipboard = ref([]);
115
106
  const itemDropdownItems = computed(() => {
@@ -296,30 +287,47 @@ const handleSelectionPaste = (pastedUuids) => {
296
287
  return;
297
288
  }
298
289
  let targetField = null;
299
- let targetFieldConfig = null;
290
+ let targetFieldElement = null;
300
291
  let targetFieldKey = null;
301
292
  let preceedingUuid = void 0;
302
293
  if (!keyboard.isPressingShift.value) {
303
294
  const pastedBundles = pastedUuids.map((uuid) => blocks.getBlock(uuid)?.bundle).filter((bundle) => !!bundle);
295
+ const pastedFragments = pastedUuids.map((uuid) => {
296
+ const block2 = blocks.getBlock(uuid);
297
+ if (block2?.bundle === "blokkli_fragment" && block2.fragment?.name) {
298
+ return block2.fragment.name;
299
+ }
300
+ return null;
301
+ }).filter(falsy);
304
302
  if (pastedBundles.length) {
305
303
  const nestedFields = types.fieldConfig.forEntityTypeAndBundle(
306
304
  itemEntityType,
307
305
  block.bundle
308
306
  );
309
307
  for (const fieldConfig of nestedFields) {
308
+ const fieldElement = fields.find(block.uuid, fieldConfig.name);
309
+ if (!fieldElement) {
310
+ continue;
311
+ }
310
312
  const allowedPastedBundles = pastedBundles.filter(
311
- (bundle) => fieldConfig.allowedBundles.includes(bundle)
313
+ (bundle) => fieldElement.allowedBundles.includes(bundle)
312
314
  );
313
- if (allowedPastedBundles.length > 0) {
315
+ let fragmentsAllowed = true;
316
+ if (pastedFragments.length > 0 && fieldElement.allowedFragments.length > 0) {
317
+ fragmentsAllowed = pastedFragments.every(
318
+ (fragment) => fieldElement.allowedFragments.includes(fragment)
319
+ );
320
+ }
321
+ if (allowedPastedBundles.length > 0 && fragmentsAllowed) {
314
322
  const nestedFieldKey = getFieldKey(block.uuid, fieldConfig.name);
315
323
  const currentCount = state.getFieldBlockCount(nestedFieldKey);
316
- if (fieldConfig.cardinality === -1 || currentCount + allowedPastedBundles.length <= fieldConfig.cardinality) {
324
+ if (fieldElement.cardinality === -1 || currentCount + allowedPastedBundles.length <= fieldElement.cardinality) {
317
325
  targetField = {
318
326
  entityType: itemEntityType,
319
327
  entityUuid: block.uuid,
320
328
  name: fieldConfig.name
321
329
  };
322
- targetFieldConfig = fieldConfig;
330
+ targetFieldElement = fieldElement;
323
331
  targetFieldKey = nestedFieldKey;
324
332
  preceedingUuid = void 0;
325
333
  break;
@@ -328,17 +336,13 @@ const handleSelectionPaste = (pastedUuids) => {
328
336
  }
329
337
  }
330
338
  }
331
- if (!targetField || !targetFieldConfig || !targetFieldKey) {
339
+ if (!targetField || !targetFieldElement || !targetFieldKey) {
332
340
  const field = state.getMutatedField(block.host.uuid, block.host.fieldName);
333
341
  if (!field) {
334
342
  return;
335
343
  }
336
- const fieldConfig = types.getFieldConfig(
337
- field.entityType,
338
- block.host.bundle,
339
- field.name
340
- );
341
- if (!fieldConfig) {
344
+ const fieldElement = fields.find(field.entityUuid, field.name);
345
+ if (!fieldElement) {
342
346
  return;
343
347
  }
344
348
  targetField = {
@@ -346,12 +350,13 @@ const handleSelectionPaste = (pastedUuids) => {
346
350
  entityUuid: field.entityUuid,
347
351
  name: field.name
348
352
  };
349
- targetFieldConfig = fieldConfig;
353
+ targetFieldElement = fieldElement;
350
354
  targetFieldKey = getFieldKey(field.entityUuid, field.name);
351
355
  preceedingUuid = selection.uuids.value[0];
352
356
  }
353
357
  const pastedBlocks = [];
354
358
  const notAllowedBundles = [];
359
+ const notAllowedFragments = [];
355
360
  for (let i = 0; i < pastedUuids.length; i++) {
356
361
  const uuid = pastedUuids[i];
357
362
  if (!uuid) {
@@ -361,14 +366,34 @@ const handleSelectionPaste = (pastedUuids) => {
361
366
  if (!block2) {
362
367
  continue;
363
368
  }
364
- const isAllowed = targetFieldConfig.allowedBundles.includes(block2.bundle);
369
+ const isAllowed = targetFieldElement.allowedBundles.includes(block2.bundle);
365
370
  if (!isAllowed) {
366
371
  notAllowedBundles.push(block2.bundle);
367
372
  continue;
368
373
  }
374
+ if (block2.bundle === "blokkli_fragment" && block2.fragment?.name && targetFieldElement.allowedFragments.length > 0) {
375
+ const fragmentAllowed = targetFieldElement.allowedFragments.includes(
376
+ block2.fragment.name
377
+ );
378
+ if (!fragmentAllowed) {
379
+ notAllowedFragments.push(block2.fragment.name);
380
+ continue;
381
+ }
382
+ }
369
383
  pastedBlocks.push(block2);
370
384
  }
371
385
  if (!pastedBlocks.length) {
386
+ if (notAllowedFragments.length) {
387
+ const message2 = notAllowedFragments.length === 1 ? $t(
388
+ "clipboardPasteErrorAllowedFragmentsSingle",
389
+ 'Fragment "@types" is not allowed here.'
390
+ ) : $t(
391
+ "clipboardPasteErrorAllowedFragmentsMultiple",
392
+ "Fragments (@types) are not allowed here."
393
+ );
394
+ emitPasteError(message2.replace("@types", notAllowedFragments.join(", ")));
395
+ return;
396
+ }
372
397
  const blockTypes = notAllowedBundles.map((bundle) => {
373
398
  return types.getBlockBundleDefinition(bundle)?.label ?? bundle;
374
399
  });
@@ -383,12 +408,12 @@ const handleSelectionPaste = (pastedUuids) => {
383
408
  return;
384
409
  }
385
410
  const count = state.getFieldBlockCount(targetFieldKey);
386
- if (targetFieldConfig.cardinality !== -1 && count + pastedBlocks.length > targetFieldConfig.cardinality) {
411
+ if (targetFieldElement.cardinality !== -1 && count + pastedBlocks.length > targetFieldElement.cardinality) {
387
412
  emitPasteError(
388
413
  $t(
389
414
  "clipboardPasteErrorCardinality",
390
415
  "This field only allows up to @count blocks."
391
- ).replace("@count", targetFieldConfig.cardinality.toString())
416
+ ).replace("@count", targetFieldElement.cardinality.toString())
392
417
  );
393
418
  return;
394
419
  }
@@ -529,6 +554,22 @@ defineShortcut([
529
554
  meta: true
530
555
  }
531
556
  ]);
557
+ defineItemDropdownAction(() => {
558
+ if (selection.items.value.length && state.editMode.value === "editing") {
559
+ return itemDropdownItems.value.map((item) => ({
560
+ id: "clipboard-" + item.id,
561
+ label: item.label,
562
+ icon: item.icon,
563
+ description: item.description,
564
+ enabled: item.enabled,
565
+ group: "clipboard",
566
+ weight: 100,
567
+ callback: () => {
568
+ onSelectDropdownItem(item);
569
+ }
570
+ }));
571
+ }
572
+ });
532
573
  onBlokkliEvent("drop:clipboardItem", async (data) => {
533
574
  const item = pastedItems.value.find((v) => v.id === data.id);
534
575
  if (!item) {
@@ -1,8 +1,6 @@
1
1
  <template>
2
2
  <button
3
3
  ref="buttonEl"
4
- :data-command-id="item.id"
5
- :data-command-visible="true"
6
4
  class="bk-command"
7
5
  :class="{ 'bk-is-focused': isFocused }"
8
6
  @mouseenter="$emit('focus', index)"
@@ -1,9 +1,11 @@
1
1
  import type { Command } from '#blokkli/types';
2
+ export type MappedCommandItem = Command & {
3
+ positions?: number[];
4
+ score?: number;
5
+ visible?: boolean;
6
+ };
2
7
  type __VLS_Props = {
3
- item: Command & {
4
- _id: number;
5
- positions?: number[];
6
- };
8
+ item: MappedCommandItem;
7
9
  index: number;
8
10
  isFocused: boolean;
9
11
  };
@@ -21,11 +21,12 @@
21
21
  <div class="bk-command-palette-results-list">
22
22
  <div>
23
23
  <Item
24
- v-for="(item, index) in visibleCommands"
24
+ v-for="item in allCommands"
25
+ v-show="item.visible"
25
26
  :key="item.id"
26
27
  :item="item"
27
- :index="index"
28
- :is-focused="focusedIndex === index"
28
+ :index="getVisibleIndex(item.id)"
29
+ :is-focused="focusedIndex === getVisibleIndex(item.id)"
29
30
  @focus="onFocus"
30
31
  @select="onSelect"
31
32
  />
@@ -49,9 +50,21 @@ import {
49
50
  import { Icon, ScrollBoundary } from "#blokkli/components";
50
51
  import { Fzf } from "fzf";
51
52
  import { modulo } from "#blokkli/helpers";
52
- import Item from "./Item/index.vue";
53
- const { commands, $t, selection } = useBlokkli();
53
+ import Item, {} from "./Item/index.vue";
54
+ import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
54
55
  const emit = defineEmits(["close"]);
56
+ const { commands, $t, selection, plugins, storage } = useBlokkli();
57
+ const frequency = storage.use(
58
+ "commandPaletteFrequency",
59
+ {}
60
+ );
61
+ function incrementFrequency(id) {
62
+ const currentCount = frequency.value[id] ?? 0;
63
+ frequency.value = {
64
+ ...frequency.value,
65
+ [id]: currentCount + 1
66
+ };
67
+ }
55
68
  const inputEl = useTemplateRef("inputEl");
56
69
  const text = ref("");
57
70
  const focusedIndex = ref(0);
@@ -62,42 +75,75 @@ function onFocus(index) {
62
75
  }
63
76
  focusedIndex.value = index;
64
77
  }
65
- const items = computed(
66
- () => commands.getCommands().filter((v) => !v.disabled).map((doc, index) => {
78
+ const items = computed(() => {
79
+ return [
80
+ ...commands.getCommands(),
81
+ ...plugins.get("menuButton").map((plugin) => {
82
+ return {
83
+ id: "menu-button:" + plugin.id,
84
+ label: plugin.title,
85
+ group: "action",
86
+ icon: plugin.icon,
87
+ disabled: plugin.disabled,
88
+ callback: plugin.callback
89
+ };
90
+ })
91
+ ].filter((v) => !v.disabled).map((doc, index) => {
67
92
  return {
68
93
  ...doc,
69
- _id: index
94
+ _id: index,
95
+ visible: true
70
96
  };
71
- })
72
- );
97
+ }).sort((a, b) => {
98
+ const freqA = frequency.value[a.id] ?? 0;
99
+ const freqB = frequency.value[b.id] ?? 0;
100
+ return freqB - freqA;
101
+ });
102
+ });
73
103
  const fzf = new Fzf(items.value, {
74
104
  selector: (item) => item.label
75
105
  });
76
- const visibleIds = computed(
77
- () => {
78
- if (!text.value) {
79
- return void 0;
80
- }
81
- const results = fzf.find(text.value);
82
- return results.map((v) => {
83
- return {
84
- id: v.item._id,
85
- positions: [...v.positions],
86
- score: v.score
87
- };
88
- }).sort((a, b) => b.score - a.score);
106
+ const visibleIds = computed(() => {
107
+ if (!text.value) {
108
+ return void 0;
109
+ }
110
+ const results = fzf.find(text.value);
111
+ return results.map((v) => {
112
+ return {
113
+ id: v.item._id,
114
+ positions: [...v.positions],
115
+ score: v.score
116
+ };
117
+ });
118
+ });
119
+ const allCommands = computed(() => {
120
+ if (!text.value) {
121
+ return items.value;
89
122
  }
90
- );
91
- const visibleCommands = computed(() => {
92
123
  return items.value.map((v) => {
93
124
  const found = visibleIds.value?.find((w) => w.id === v._id);
94
125
  return {
95
126
  ...v,
96
127
  visible: visibleIds.value === void 0 || !!found,
97
- positions: found?.positions
128
+ positions: found?.positions,
129
+ score: found?.score ?? 0
98
130
  };
99
- }).filter((v) => v.visible);
131
+ }).sort((a, b) => {
132
+ const scoreDiff = b.score - a.score;
133
+ if (scoreDiff !== 0) {
134
+ return scoreDiff;
135
+ }
136
+ const freqA = frequency.value[a.id] ?? 0;
137
+ const freqB = frequency.value[b.id] ?? 0;
138
+ return freqB - freqA;
139
+ });
140
+ });
141
+ const visibleCommands = computed(() => {
142
+ return allCommands.value.filter((v) => v.visible !== false);
100
143
  });
144
+ const getVisibleIndex = (id) => {
145
+ return visibleCommands.value.findIndex((v) => v.id === id);
146
+ };
101
147
  watch(text, () => {
102
148
  nextTick(() => {
103
149
  focusFirst();
@@ -128,6 +174,7 @@ const focusNext = () => {
128
174
  const onSelect = (id) => {
129
175
  const command = items.value.find((v) => v.id === id);
130
176
  if (command) {
177
+ incrementFrequency(id);
131
178
  command.callback();
132
179
  emit("close");
133
180
  }
@@ -166,6 +213,9 @@ const onKeyDown = (e) => {
166
213
  const onWindowClick = () => {
167
214
  emit("close");
168
215
  };
216
+ onBlokkliEvent("overlay:close", () => {
217
+ emit("close");
218
+ });
169
219
  onMounted(() => {
170
220
  if (inputEl.value) {
171
221
  inputEl.value.focus();
@@ -1,16 +1,18 @@
1
1
  <template>
2
- <Teleport to="body">
2
+ <Teleport :to="ui.mainLayoutElement.value">
3
3
  <div class="bk">
4
4
  <BlokkliTransition name="command-palette">
5
5
  <Palette v-if="isVisible" @close="isVisible = false" />
6
6
  </BlokkliTransition>
7
7
  </div>
8
8
  </Teleport>
9
+
9
10
  <PluginToolbarButton
10
11
  id="command_palette"
11
12
  :title="label"
12
13
  meta
13
14
  key-code="K"
15
+ no-command
14
16
  region="before-sidebar"
15
17
  :tour-text="
16
18
  $t(
@@ -24,11 +26,12 @@
24
26
  </template>
25
27
 
26
28
  <script setup>
27
- import { useBlokkli, defineBlokkliFeature, ref, computed } from "#imports";
29
+ import { useBlokkli, defineBlokkliFeature, computed } from "#imports";
28
30
  import { PluginToolbarButton } from "#blokkli/plugins";
29
31
  import { BlokkliTransition } from "#blokkli/components";
30
32
  import Palette from "./Palette/index.vue";
31
33
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
34
+ import { useDialog } from "#blokkli/helpers/composables/useDialog";
32
35
  defineBlokkliFeature({
33
36
  id: "command-palette",
34
37
  icon: "command",
@@ -36,8 +39,8 @@ defineBlokkliFeature({
36
39
  description: "Provides a command palette with search to access most UI features with a keyboard.",
37
40
  viewports: ["desktop"]
38
41
  });
39
- const { $t } = useBlokkli();
40
- const isVisible = ref(false);
42
+ const { $t, ui } = useBlokkli();
43
+ const isVisible = useDialog("command-palette", "center");
41
44
  const label = computed(() => $t("commandPaletteOpen", "Open Command Palette"));
42
45
  onBlokkliEvent("window:clickAway", () => isVisible.value = false);
43
46
  </script>
@@ -35,7 +35,7 @@
35
35
  @click="showAddComment = !showAddComment"
36
36
  />
37
37
 
38
- <Teleport to="body">
38
+ <Teleport :to="ui.mainLayoutElement.value">
39
39
  <BlokkliTransition name="caret-tooltip">
40
40
  <CommentAddForm
41
41
  v-if="showAddComment"
@@ -75,7 +75,7 @@ const { adapter } = defineBlokkliFeature({
75
75
  description: "Provides comment functionality for blocks.",
76
76
  screenshot: "feature-comments.jpg"
77
77
  });
78
- const { eventBus, $t, selection } = useBlokkli();
78
+ const { eventBus, $t, selection, ui } = useBlokkli();
79
79
  const commentForm = ref(null);
80
80
  const showAddComment = ref(false);
81
81
  watch(selection.uuids, () => {
@@ -1,12 +1,5 @@
1
1
  <template>
2
- <PluginItemDropdown
3
- id="conversions"
4
- :title="$t('convertTo', 'Convert to...')"
5
- :enabled="!!possibleConversions.length"
6
- :items="possibleConversions"
7
- weight="900"
8
- @select="onConvert($event.id)"
9
- />
2
+ <div />
10
3
  </template>
11
4
 
12
5
  <script setup>
@@ -17,8 +10,8 @@ import {
17
10
  useLazyAsyncData,
18
11
  watch
19
12
  } from "#imports";
20
- import { PluginItemDropdown } from "#blokkli/plugins";
21
13
  import { falsy } from "#blokkli/helpers";
14
+ import defineItemDropdownAction from "#blokkli/helpers/composables/defineItemDropdownAction";
22
15
  const { adapter } = defineBlokkliFeature({
23
16
  id: "conversions",
24
17
  label: "Conversions",
@@ -68,6 +61,20 @@ const possibleConversions = computed(() => {
68
61
  };
69
62
  });
70
63
  });
64
+ defineItemDropdownAction(() => {
65
+ if (possibleConversions.value.length) {
66
+ return possibleConversions.value.map((conversion) => ({
67
+ id: "conversion-" + conversion.id,
68
+ label: conversion.label,
69
+ bundle: conversion.bundle,
70
+ group: "conversions",
71
+ weight: 900,
72
+ callback: () => {
73
+ onConvert(conversion.id);
74
+ }
75
+ }));
76
+ }
77
+ });
71
78
  </script>
72
79
 
73
80
  <script>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <section class="bk-debug-section">
3
+ <h2 class="bk-debug-section-header" @click="toggle">
4
+ <span class="bk-debug-section-indicator">{{ isOpen ? "\u25BC" : "\u25B6" }}</span>
5
+ {{ title }}
6
+ </h2>
7
+ <div v-if="isOpen" class="bk-debug-section-content">
8
+ <slot />
9
+ </div>
10
+ </section>
11
+ </template>
12
+
13
+ <script setup>
14
+ import { useBlokkli } from "#imports";
15
+ const props = defineProps({
16
+ title: { type: String, required: true },
17
+ defaultOpen: { type: Boolean, required: false }
18
+ });
19
+ const { storage } = useBlokkli();
20
+ const isOpen = storage.use("debugSection" + props.title, false);
21
+ function toggle() {
22
+ isOpen.value = !isOpen.value;
23
+ }
24
+ </script>
@@ -0,0 +1,16 @@
1
+ type __VLS_Props = {
2
+ title: string;
3
+ defaultOpen?: boolean;
4
+ };
5
+ declare var __VLS_1: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_1) => any;
8
+ };
9
+ declare const __VLS_component: 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>;
10
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
11
+ export default _default;
12
+ type __VLS_WithSlots<T, S> = T & {
13
+ new (): {
14
+ $slots: S;
15
+ };
16
+ };
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <PluginSidebar id="debug" title="Debug" icon="bug" weight="200">
3
+ <div class="bk bk-debug">
4
+ <DebugSection title="Keyboard">
5
+ <SectionKeyboard />
6
+ </DebugSection>
7
+
8
+ <DebugSection title="Selection">
9
+ <SectionSelection />
10
+ </DebugSection>
11
+
12
+ <DebugSection title="Rendering">
13
+ <SectionRendering />
14
+ </DebugSection>
15
+
16
+ <DebugSection title="Logging">
17
+ <SectionLogging :logger />
18
+ </DebugSection>
19
+
20
+ <DebugSection title="Icons">
21
+ <SectionIcons />
22
+ </DebugSection>
23
+
24
+ <DebugSection title="Features">
25
+ <SectionFeatures />
26
+ </DebugSection>
27
+ </div>
28
+ </PluginSidebar>
29
+
30
+ <PluginDebugOverlay id="viewport" title="Show viewport overlay">
31
+ <DebugViewport />
32
+ </PluginDebugOverlay>
33
+
34
+ <PluginDebugOverlay id="rects" title="Show field and block rects">
35
+ <DebugRects />
36
+ </PluginDebugOverlay>
37
+ </template>
38
+
39
+ <script setup>
40
+ import { useBlokkli } from "#imports";
41
+ import { PluginSidebar, PluginDebugOverlay } from "#blokkli/plugins";
42
+ import DebugSection from "./DebugSection.vue";
43
+ import SectionKeyboard from "./Section/Keyboard.vue";
44
+ import SectionSelection from "./Section/Selection.vue";
45
+ import SectionRendering from "./Section/Rendering.vue";
46
+ import SectionLogging from "./Section/Logging.vue";
47
+ import SectionIcons from "./Section/Icons.vue";
48
+ import SectionFeatures from "./Section/Features.vue";
49
+ import DebugViewport from "./Viewport/index.vue";
50
+ import DebugRects from "./Rects/index.vue";
51
+ import defineItemDropdownAction from "#blokkli/helpers/composables/defineItemDropdownAction";
52
+ defineProps({
53
+ logger: { type: Object, required: true }
54
+ });
55
+ const { selection } = useBlokkli();
56
+ async function copyUuid() {
57
+ const uuid = selection.uuids.value.at(0);
58
+ if (!uuid) {
59
+ return;
60
+ }
61
+ const type = "text/plain";
62
+ const clipboardItemData = {
63
+ [type]: uuid
64
+ };
65
+ const clipboardItem = new ClipboardItem(clipboardItemData);
66
+ await navigator.clipboard.write([clipboardItem]);
67
+ }
68
+ defineItemDropdownAction(() => {
69
+ if (selection.uuids.value.length === 1) {
70
+ return {
71
+ id: "debug-copy-uuid",
72
+ label: "Copy UUID",
73
+ icon: "bug",
74
+ group: "debug",
75
+ weight: 200,
76
+ callback: copyUuid
77
+ };
78
+ }
79
+ });
80
+ </script>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <div class="bk-debug-features">
3
+ <div v-for="feature in featuresList" :key="feature.id">
4
+ <div>
5
+ <span
6
+ class="bk-status-indicator"
7
+ :class="feature.mounted ? 'bk-is-success' : 'bk-is-danger'"
8
+ />
9
+ </div>
10
+ <div>
11
+ <h3>{{ feature.label }}</h3>
12
+ <div>{{ feature.id }}</div>
13
+ <p>{{ feature.description }}</p>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </template>
18
+
19
+ <script setup>
20
+ import { useBlokkli, computed } from "#imports";
21
+ const { features } = useBlokkli();
22
+ const featuresList = computed(() => {
23
+ return features.features.value.map((v) => {
24
+ const feature = features.mountedFeatures.value.find((f) => f.id === v.id);
25
+ return {
26
+ id: v.id,
27
+ label: v.label,
28
+ description: v.description,
29
+ dependencies: v.dependencies?.join(", "),
30
+ mounted: !!feature
31
+ };
32
+ });
33
+ });
34
+ </script>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div class="bk-debug-icons">
3
+ <div v-for="icon in iconItems" :key="icon">
4
+ <Icon :name="icon" />
5
+ <p>{{ icon }}</p>
6
+ </div>
7
+ </div>
8
+ </template>
9
+
10
+ <script setup>
11
+ import { computed } from "#imports";
12
+ import { Icon } from "#blokkli/components";
13
+ import { icons } from "#blokkli-build/icons";
14
+ const iconItems = computed(() => Object.keys(icons));
15
+ </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;