@blokkli/editor 2.0.0-alpha.23 → 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 (115) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +62 -66
  3. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +1 -1
  4. package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +1 -1
  5. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +5 -1
  6. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +2 -0
  7. package/dist/runtime/blokkliPlugins/TourItem/index.vue +22 -13
  8. package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +1 -0
  9. package/dist/runtime/blokkliPlugins/index.d.ts +1 -3
  10. package/dist/runtime/blokkliPlugins/index.js +0 -4
  11. package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -1
  12. package/dist/runtime/components/Edit/Actions/ItemDropdown.vue +1 -1
  13. package/dist/runtime/components/Edit/Actions/index.vue +77 -72
  14. package/dist/runtime/components/Edit/AddListItem/index.vue +8 -29
  15. package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +2 -3
  16. package/dist/runtime/components/Edit/AppMenu/MenuButton.vue +39 -0
  17. package/dist/runtime/{blokkliPlugins/MenuButton/index.vue.d.ts → components/Edit/AppMenu/MenuButton.vue.d.ts} +0 -4
  18. package/dist/runtime/components/Edit/AppMenu/index.vue +62 -40
  19. package/dist/runtime/components/Edit/Dialog/index.vue +26 -5
  20. package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +2 -0
  21. package/dist/runtime/components/Edit/EditProvider.vue +48 -31
  22. package/dist/runtime/components/Edit/EditProvider.vue.d.ts +1 -1
  23. package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +52 -0
  24. package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue.d.ts +7 -0
  25. package/dist/runtime/components/Edit/Features/AddList/Actions/index.vue +41 -0
  26. package/dist/runtime/components/Edit/Features/AddList/Actions/index.vue.d.ts +5 -0
  27. package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue +11 -47
  28. package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue.d.ts +5 -0
  29. package/dist/runtime/components/Edit/Features/AddList/index.vue +68 -123
  30. package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +41 -20
  31. package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +3 -2
  32. package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +2 -28
  33. package/dist/runtime/components/Edit/Features/Assistant/index.vue +18 -14
  34. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +1 -0
  35. package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +2 -2
  36. package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +1 -1
  37. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +52 -18
  38. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +0 -2
  39. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue.d.ts +6 -4
  40. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +77 -27
  41. package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +7 -4
  42. package/dist/runtime/components/Edit/Features/Comments/index.vue +2 -2
  43. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue +113 -0
  44. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue.d.ts +25 -0
  45. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +8 -97
  46. package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/fragment.glsl +2 -5
  47. package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/index.vue +38 -5
  48. package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/vertex.glsl +10 -1
  49. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +1 -2
  50. package/dist/runtime/components/Edit/Features/EditForm/index.vue +2 -2
  51. package/dist/runtime/components/Edit/Features/EditableField/index.vue +2 -2
  52. package/dist/runtime/components/Edit/Features/Exit/index.vue +12 -9
  53. package/dist/runtime/components/Edit/Features/Fragments/index.vue +27 -31
  54. package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +1 -0
  55. package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +25 -24
  56. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +2 -2
  57. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +1 -0
  58. package/dist/runtime/components/Edit/Features/Library/index.vue +26 -24
  59. package/dist/runtime/components/Edit/Features/MultiSelect/Renderer/index.vue +1 -3
  60. package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +2 -1
  61. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +1 -0
  62. package/dist/runtime/components/Edit/Features/Publish/index.vue +17 -15
  63. package/dist/runtime/components/Edit/Features/Revert/index.vue +24 -18
  64. package/dist/runtime/components/Edit/Features/Search/index.vue +1 -1
  65. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +21 -17
  66. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +6 -6
  67. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +3 -6
  68. package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +1 -0
  69. package/dist/runtime/components/Edit/Features/Settings/index.vue +25 -17
  70. package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +2 -2
  71. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +1 -1
  72. package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +2 -2
  73. package/dist/runtime/components/Edit/Features/Tour/index.vue +12 -10
  74. package/dist/runtime/components/Edit/Features/Transform/index.vue +1 -1
  75. package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -17
  76. package/dist/runtime/components/Edit/FormOverlay/index.vue +13 -4
  77. package/dist/runtime/components/Edit/ItemIconBox/index.vue +41 -0
  78. package/dist/runtime/components/Edit/{AddListItemIcon → ItemIconBox}/index.vue.d.ts +5 -5
  79. package/dist/runtime/components/Edit/Konami/Game/index.vue +0 -1
  80. package/dist/runtime/components/Edit/Konami/index.vue +3 -5
  81. package/dist/runtime/components/Edit/Messages/Item/index.vue +11 -2
  82. package/dist/runtime/components/Edit/Messages/index.vue +6 -1
  83. package/dist/runtime/components/Edit/Overlay/index.vue +66 -0
  84. package/dist/runtime/components/Edit/Overlay/index.vue.d.ts +2 -0
  85. package/dist/runtime/components/Edit/SystemRequirements/index.vue +36 -36
  86. package/dist/runtime/components/Edit/Toolbar/index.vue +47 -48
  87. package/dist/runtime/components/Edit/index.d.ts +2 -2
  88. package/dist/runtime/components/Edit/index.js +2 -2
  89. package/dist/runtime/css/output.css +1 -1
  90. package/dist/runtime/helpers/composables/defineAddAction.d.ts +2 -0
  91. package/dist/runtime/helpers/composables/defineAddAction.js +10 -0
  92. package/dist/runtime/helpers/composables/defineItemDropdownAction.js +2 -2
  93. package/dist/runtime/helpers/composables/defineMenuButton.d.ts +2 -0
  94. package/dist/runtime/helpers/composables/defineMenuButton.js +10 -0
  95. package/dist/runtime/helpers/composables/useDialog.d.ts +3 -0
  96. package/dist/runtime/helpers/composables/useDialog.js +16 -0
  97. package/dist/runtime/helpers/defineElementStyle.d.ts +2 -0
  98. package/dist/runtime/helpers/defineElementStyle.js +33 -0
  99. package/dist/runtime/helpers/domProvider.d.ts +1 -0
  100. package/dist/runtime/helpers/domProvider.js +7 -2
  101. package/dist/runtime/helpers/dropTargets/index.d.ts +1 -1
  102. package/dist/runtime/helpers/dropTargets/index.js +17 -3
  103. package/dist/runtime/helpers/pluginProvider.d.ts +25 -6
  104. package/dist/runtime/helpers/pluginProvider.js +48 -46
  105. package/dist/runtime/helpers/providers/blocks.js +10 -0
  106. package/dist/runtime/helpers/providers/fields.d.ts +9 -1
  107. package/dist/runtime/helpers/uiProvider.d.ts +9 -12
  108. package/dist/runtime/helpers/uiProvider.js +85 -83
  109. package/dist/runtime/icons/click.svg +1 -0
  110. package/dist/runtime/types/index.d.ts +12 -5
  111. package/package.json +1 -1
  112. package/dist/runtime/blokkliPlugins/AddAction/index.vue +0 -96
  113. package/dist/runtime/blokkliPlugins/AddAction/index.vue.d.ts +0 -26
  114. package/dist/runtime/blokkliPlugins/MenuButton/index.vue +0 -68
  115. package/dist/runtime/components/Edit/AddListItemIcon/index.vue +0 -19
@@ -20,26 +20,7 @@
20
20
  @click="showReusableDialog = true"
21
21
  />
22
22
 
23
- <PluginAddAction
24
- v-if="
25
- adapter.addLibraryItem && adapter.getLibraryItems && isSupportedOnEntity
26
- "
27
- type="library"
28
- :title="$t('libraryAddFromLibrary', 'Add from library')"
29
- :description="
30
- $t(
31
- 'libraryAddDescription',
32
- 'Add a reusable block from the block library.'
33
- )
34
- "
35
- icon="reusable"
36
- color="lime"
37
- :item-bundle="BUNDLE_FROM_LIBRARY"
38
- :disabled="!fromLibraryAllowedInList"
39
- @placed="placedAction = $event"
40
- />
41
-
42
- <Teleport to="body">
23
+ <Teleport :to="ui.mainLayoutElement.value">
43
24
  <BlokkliTransition name="slide-up">
44
25
  <ReusableDialog
45
26
  v-if="showReusableDialog && selection.item.value"
@@ -51,7 +32,7 @@
51
32
  </BlokkliTransition>
52
33
  </Teleport>
53
34
 
54
- <Teleport to="body">
35
+ <Teleport :to="ui.mainLayoutElement.value">
55
36
  <BlokkliTransition name="slide-in">
56
37
  <LibraryDialog
57
38
  v-if="placedAction && adapter.getLibraryItems"
@@ -71,12 +52,14 @@
71
52
 
72
53
  <script setup>
73
54
  import { ref, computed, useBlokkli, defineBlokkliFeature } from "#imports";
74
- import { PluginItemAction, PluginAddAction } from "#blokkli/plugins";
55
+ import { PluginItemAction } from "#blokkli/plugins";
75
56
  import ReusableDialog from "./ReusableDialog/index.vue";
76
57
  import LibraryDialog from "./LibraryDialog/index.vue";
77
58
  import EditReusable from "./EditReusable/index.vue";
78
59
  import { BlokkliTransition } from "#blokkli/components";
79
60
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
61
+ import defineAddAction from "#blokkli/helpers/composables/defineAddAction";
62
+ import { useDialog } from "#blokkli/helpers/composables/useDialog";
80
63
  import { BUNDLE_FROM_LIBRARY } from "#blokkli/constants";
81
64
  const { adapter } = defineBlokkliFeature({
82
65
  id: "library",
@@ -86,8 +69,8 @@ const { adapter } = defineBlokkliFeature({
86
69
  requiredAdapterMethods: ["makeBlockReusable", "detachReusableBlock"],
87
70
  dependencies: ["add-list"]
88
71
  });
89
- const { selection, state, types, $t, eventBus, definitions } = useBlokkli();
90
- const showReusableDialog = ref(false);
72
+ const { selection, state, types, $t, eventBus, definitions, ui } = useBlokkli();
73
+ const showReusableDialog = useDialog("library-reusable", "center");
91
74
  async function selectNewlyAdded(cb) {
92
75
  const uuidsBefore = state.getAllUuids();
93
76
  await cb();
@@ -186,6 +169,25 @@ function onSubmitLibraryItem() {
186
169
  eventBus.emit("reloadState");
187
170
  cancelLibraryItemEdit();
188
171
  }
172
+ defineAddAction(() => {
173
+ if (!adapter.addLibraryItem || !adapter.getLibraryItems || !isSupportedOnEntity.value) {
174
+ return;
175
+ }
176
+ return {
177
+ id: "library",
178
+ title: $t("libraryAddFromLibrary", "Add from library"),
179
+ description: $t(
180
+ "libraryAddDescription",
181
+ "Add a reusable block from the block library."
182
+ ),
183
+ icon: "reusable",
184
+ color: "lime",
185
+ itemBundle: BUNDLE_FROM_LIBRARY,
186
+ callback: (data) => {
187
+ placedAction.value = data;
188
+ }
189
+ };
190
+ });
189
191
  </script>
190
192
 
191
193
  <script>
@@ -1,7 +1,5 @@
1
1
  <template>
2
- <Teleport to="body">
3
- <div />
4
- </Teleport>
2
+ <div />
5
3
  </template>
6
4
 
7
5
  <script setup>
@@ -15,10 +15,11 @@
15
15
  @click="qrCodeVisible = true"
16
16
  />
17
17
 
18
- <Teleport to="body">
18
+ <Teleport :to="ui.mainLayoutElement.value">
19
19
  <BlokkliTransition name="slide-up">
20
20
  <DialogModal
21
21
  v-if="qrCodeVisible"
22
+ id="preview-grant"
22
23
  :title="$t('previewDialogTitle', 'Preview with smartphone')"
23
24
  :lead="
24
25
  $t(
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <DialogModal
3
+ id="publish"
3
4
  :title="$t('publishDialogTitle', 'Publish changes')"
4
5
  :width="900"
5
6
  :submit-label
@@ -1,15 +1,5 @@
1
1
  <template>
2
- <PluginMenuButton
3
- id="publish"
4
- :title="publishLabel"
5
- :description="publishDescription"
6
- :disabled="!mutations.length || !canEdit"
7
- :type="isScheduled ? 'yellow' : 'success'"
8
- :weight="0"
9
- :icon="icon"
10
- @click="onMenuClick"
11
- />
12
- <Teleport to="body">
2
+ <Teleport :to="ui.mainLayoutElement.value">
13
3
  <BlokkliTransition name="slide-up">
14
4
  <PublishDialog v-if="showDialog" @close="onClose" @submit="onSubmit" />
15
5
  </BlokkliTransition>
@@ -22,13 +12,13 @@ import {
22
12
  defineBlokkliFeature,
23
13
  computed,
24
14
  useRoute,
25
- ref,
26
15
  nextTick
27
16
  } from "#imports";
28
- import { PluginMenuButton } from "#blokkli/plugins";
29
17
  import { BlokkliTransition } from "#blokkli/components";
30
18
  import PublishDialog from "./Dialog/index.vue";
31
19
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
20
+ import defineMenuButton from "#blokkli/helpers/composables/defineMenuButton";
21
+ import { useDialog } from "#blokkli/helpers/composables/useDialog";
32
22
  const { adapter, settings } = defineBlokkliFeature({
33
23
  id: "publish",
34
24
  icon: "publish",
@@ -46,14 +36,14 @@ const { adapter, settings } = defineBlokkliFeature({
46
36
  }
47
37
  });
48
38
  const route = useRoute();
49
- const { state, $t, broadcast, context, eventBus } = useBlokkli();
39
+ const { state, $t, broadcast, context, eventBus, ui } = useBlokkli();
50
40
  const { mutations, canEdit, mutateWithLoadingState } = state;
51
41
  const hasPublishOptions = !!adapter.getPublishOptions;
52
42
  const isPublished = computed(() => !!state.entity.value.status);
53
43
  const isScheduled = computed(
54
44
  () => !!state.publishOptions.value.publishOn
55
45
  );
56
- const showDialog = ref(false);
46
+ const showDialog = useDialog("publish", "center");
57
47
  const publishLabel = computed(() => {
58
48
  const suffix = hasPublishOptions ? "..." : "";
59
49
  if (isScheduled.value) {
@@ -122,6 +112,18 @@ async function onClose() {
122
112
  onBlokkliEvent("publish:show-dialog", () => {
123
113
  showDialog.value = true;
124
114
  });
115
+ defineMenuButton(() => {
116
+ return {
117
+ id: "publish",
118
+ title: publishLabel.value,
119
+ description: publishDescription.value,
120
+ icon: icon.value,
121
+ type: isScheduled.value ? "yellow" : "success",
122
+ disabled: !mutations.value.length || !canEdit.value,
123
+ weight: 0,
124
+ callback: onMenuClick
125
+ };
126
+ });
125
127
  </script>
126
128
 
127
129
  <script>
@@ -1,21 +1,9 @@
1
1
  <template>
2
- <PluginMenuButton
3
- id="revert"
4
- :title="$t('revertMenuTitle', 'Discard...')"
5
- :description="
6
- $t('revertMenuDescription', 'Restore currently published state')
7
- "
8
- icon="revert"
9
- type="danger"
10
- :disabled="!mutations.length || !canEdit"
11
- :weight="10"
12
- @click="showConfirm = true"
13
- />
14
-
15
- <Teleport to="body">
2
+ <Teleport :to="ui.mainLayoutElement.value">
16
3
  <BlokkliTransition name="slide-up">
17
4
  <DialogModal
18
5
  v-if="showConfirm"
6
+ id="revert"
19
7
  :title="$t('revertDialogTitle', 'Irrevocably discard changes')"
20
8
  :lead="
21
9
  $t(
@@ -33,9 +21,10 @@
33
21
  </template>
34
22
 
35
23
  <script setup>
36
- import { useBlokkli, ref, defineBlokkliFeature } from "#imports";
37
- import { PluginMenuButton } from "#blokkli/plugins";
24
+ import { useBlokkli, defineBlokkliFeature } from "#imports";
38
25
  import { DialogModal, BlokkliTransition } from "#blokkli/components";
26
+ import defineMenuButton from "#blokkli/helpers/composables/defineMenuButton";
27
+ import { useDialog } from "#blokkli/helpers/composables/useDialog";
39
28
  const { adapter } = defineBlokkliFeature({
40
29
  id: "revert",
41
30
  icon: "revert",
@@ -43,9 +32,9 @@ const { adapter } = defineBlokkliFeature({
43
32
  requiredAdapterMethods: ["revertAllChanges"],
44
33
  description: "Provides a menu button to revert all changes done on the current entity."
45
34
  });
46
- const { state, $t } = useBlokkli();
35
+ const { state, $t, ui } = useBlokkli();
47
36
  const { mutations, canEdit, mutateWithLoadingState } = state;
48
- const showConfirm = ref(false);
37
+ const showConfirm = useDialog("revert", "center");
49
38
  async function onSubmit() {
50
39
  await mutateWithLoadingState(
51
40
  () => adapter.revertAllChanges(),
@@ -54,6 +43,23 @@ async function onSubmit() {
54
43
  );
55
44
  showConfirm.value = false;
56
45
  }
46
+ defineMenuButton(() => {
47
+ return {
48
+ id: "revert",
49
+ title: $t("revertMenuTitle", "Discard..."),
50
+ description: $t(
51
+ "revertMenuDescription",
52
+ "Restore currently published state"
53
+ ),
54
+ icon: "revert",
55
+ type: "danger",
56
+ disabled: !mutations.value.length || !canEdit.value,
57
+ weight: 10,
58
+ callback: () => {
59
+ showConfirm.value = true;
60
+ }
61
+ };
62
+ });
57
63
  </script>
58
64
 
59
65
  <script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Teleport to="body">
2
+ <Teleport :to="ui.mainLayoutElement.value" defer>
3
3
  <BlokkliTransition name="search">
4
4
  <div
5
5
  v-if="isRendered"
@@ -12,34 +12,36 @@
12
12
  class="bk-selection-add-overlay-list bk-scrollbar-dark"
13
13
  @wheel="onWheel"
14
14
  >
15
- <button
15
+ <AddListItem
16
16
  v-for="item in items"
17
+ :id="item.bundle"
17
18
  :key="item.bundle"
19
+ context="selection-add-buttons"
20
+ :label="item.label"
21
+ :bundle="item.bundle"
22
+ :color="item.isFavorite ? 'yellow' : void 0"
18
23
  tabindex="-1"
19
24
  @click.prevent="$emit('select', item.bundle)"
20
- >
21
- <AddListItemIcon
22
- :bundle="item.bundle"
23
- :color="item.isFavorite ? 'yellow' : 'default'"
24
- />
25
- <span>{{ item.label }}</span>
26
- </button>
27
- <button
25
+ />
26
+ <AddListItem
28
27
  v-for="action in actions"
28
+ :id="action.id"
29
29
  :key="'action:' + action.id"
30
30
  tabindex="-1"
31
- @click.prevent="$emit('action', action.id)"
32
- >
33
- <AddListItemIcon :icon="action.icon" :color="action.color" />
34
- <span>{{ action.title }}</span>
35
- </button>
31
+ context="selection-add-buttons"
32
+ :icon="action.icon"
33
+ :label="action.title"
34
+ :color="action.color"
35
+ no-context-menu
36
+ @click.prevent="$emit('action', action)"
37
+ />
36
38
  </div>
37
39
  </ArtboardTooltip>
38
40
  </template>
39
41
 
40
42
  <script setup>
41
43
  import { useTemplateRef, useBlokkli, computed } from "#imports";
42
- import { AddListItemIcon, ArtboardTooltip } from "#blokkli/components";
44
+ import { ArtboardTooltip, AddListItem } from "#blokkli/components";
43
45
  import { isInternalBundle } from "#blokkli/helpers/bundles";
44
46
  const props = defineProps({
45
47
  bundles: { type: Array, required: true },
@@ -66,7 +68,7 @@ const items = computed(() => {
66
68
  });
67
69
  });
68
70
  const actions = computed(() => {
69
- return plugins.getAddActions().filter((action) => {
71
+ return plugins.get("addAction").filter((action) => {
70
72
  if (!action.itemBundle) {
71
73
  return true;
72
74
  }
@@ -79,7 +81,9 @@ const onWheel = (e) => {
79
81
  hasScrollbar = element && element.scrollHeight > element.clientHeight;
80
82
  }
81
83
  if (hasScrollbar) {
82
- e.stopPropagation();
84
+ if (!e.ctrlKey && !e.metaKey) {
85
+ e.stopPropagation();
86
+ }
83
87
  }
84
88
  };
85
89
  </script>
@@ -1,17 +1,17 @@
1
- import type { Coord } from '#blokkli/types';
1
+ import type { AddAction, Coord } from '#blokkli/types';
2
2
  type __VLS_Props = {
3
3
  bundles: string[];
4
4
  anchorEl?: HTMLElement;
5
5
  anchorCoordinates?: Coord;
6
6
  label: string;
7
7
  };
8
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
- select: (id: string) => void;
10
- action: (id: string) => void;
11
- close: () => void;
8
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
+ select: (id: string) => any;
10
+ close: () => any;
11
+ action: (action: AddAction) => any;
12
12
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
13
13
  onSelect?: ((id: string) => any) | undefined;
14
14
  onClose?: (() => any) | undefined;
15
- onAction?: ((id: string) => any) | undefined;
15
+ onAction?: ((action: AddAction) => any) | undefined;
16
16
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
17
  export default _default;
@@ -188,12 +188,11 @@ function onSelectBundle(bundle) {
188
188
  });
189
189
  closeOverlay();
190
190
  }
191
- function onSelectAction(id) {
191
+ function onSelectAction(action) {
192
192
  if (!addData.value) {
193
193
  return;
194
194
  }
195
- eventBus.emit("action:placed", {
196
- id,
195
+ action.callback({
197
196
  field: addData.value.field,
198
197
  preceedingUuid: addData.value.preceedingUuid,
199
198
  host: { ...addData.value.host }
@@ -291,9 +290,7 @@ onBlokkliEvent("state:reloaded", () => {
291
290
  }
292
291
  });
293
292
  function setAddData(key, field, label, preceedingUuid, anchorEl, anchorCoordinates) {
294
- const allowedBundles = field.allowedBundles.filter(
295
- (bundle) => !isInternalBundle(bundle)
296
- );
293
+ const allowedBundles = field.allowedBundles;
297
294
  if (allowedBundles.length === 0) {
298
295
  return;
299
296
  }
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <DialogModal
3
+ id="settings"
3
4
  :title="$t('settingsDialogTitle', 'Change settings')"
4
5
  :width="900"
5
6
  hide-buttons
@@ -1,28 +1,18 @@
1
1
  <template>
2
- <PluginMenuButton
3
- id="settings"
4
- :title="$t('settingsMenuTitle', 'Settings')"
5
- :description="
6
- $t('settingsMenuDescription', 'Personal settings for the editor')
7
- "
8
- secondary
9
- icon="cog"
10
- @click="onClick"
11
- />
12
- <Teleport to="body">
2
+ <Teleport :to="ui.mainLayoutElement.value">
13
3
  <BlokkliTransition name="slide-up">
14
- <SettingsDialog v-if="showSettings" @cancel="showSettings = false" />
4
+ <SettingsDialog v-if="showSettings" @cancel="onClose" />
15
5
  </BlokkliTransition>
16
6
  </Teleport>
17
7
  </template>
18
8
 
19
9
  <script setup>
20
- import { ref, useBlokkli, defineBlokkliFeature, computed } from "#imports";
21
- import { PluginMenuButton } from "#blokkli/plugins";
10
+ import { useBlokkli, defineBlokkliFeature, computed } from "#imports";
22
11
  import SettingsDialog from "./Dialog/index.vue";
23
12
  import { addElementClasses } from "#blokkli/helpers/addElementClasses";
24
13
  import { BlokkliTransition } from "#blokkli/components";
25
- const { $t } = useBlokkli();
14
+ import defineMenuButton from "#blokkli/helpers/composables/defineMenuButton";
15
+ const { ui, $t } = useBlokkli();
26
16
  const { settings } = defineBlokkliFeature({
27
17
  id: "settings",
28
18
  label: "Settings",
@@ -53,14 +43,32 @@ const { settings } = defineBlokkliFeature({
53
43
  }
54
44
  }
55
45
  });
56
- const showSettings = ref(false);
57
- const onClick = () => showSettings.value = true;
46
+ const showSettings = computed(() => ui.currentDialog.value?.id === "settings");
47
+ function onClick() {
48
+ ui.openDialog({ id: "settings", alignment: "center" });
49
+ }
50
+ function onClose() {
51
+ ui.closeDialog("settings");
52
+ }
58
53
  const lowPerformanceMode = computed(() => settings.value.lowPerformanceMode);
59
54
  addElementClasses(
60
55
  document.documentElement,
61
56
  "bk-low-performance-mode",
62
57
  lowPerformanceMode
63
58
  );
59
+ defineMenuButton(() => {
60
+ return {
61
+ id: "settings",
62
+ title: $t("settingsMenuTitle", "Settings"),
63
+ description: $t(
64
+ "settingsMenuDescription",
65
+ "Personal settings for the editor"
66
+ ),
67
+ icon: "cog",
68
+ secondary: true,
69
+ callback: onClick
70
+ };
71
+ });
64
72
  </script>
65
73
 
66
74
  <script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Teleport to="body">
2
+ <Teleport :to="ui.mainLayoutElement.value">
3
3
  <BlokkliTransition name="touch-bar">
4
4
  <Bar
5
5
  v-if="
@@ -24,7 +24,7 @@
24
24
  import { useBlokkli, defineBlokkliFeature } from "#imports";
25
25
  import { BlokkliTransition } from "#blokkli/components";
26
26
  import Bar from "./Bar/index.vue";
27
- const { eventBus, selection, $t } = useBlokkli();
27
+ const { eventBus, selection, $t, ui } = useBlokkli();
28
28
  defineBlokkliFeature({
29
29
  id: "touch-action-bar",
30
30
  label: "Touch Action Bar",
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Teleport v-if="activeItem" to="body">
2
+ <Teleport v-if="activeItem" :to="ui.mainLayoutElement.value">
3
3
  <div class="bk bk-tour" :style="tooltipStyle">
4
4
  <div class="bk-tour-inner">
5
5
  <div class="bk-tour-title">
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Teleport to="body">
2
+ <Teleport :to="ui.mainLayoutElement.value">
3
3
  <ViewportBlockingRect id="tour-popup" class="bk bk-tour-popup">
4
4
  <div class="bk-tour-popup-title">
5
5
  <h2>{{ $t("tourLabel", "Take a tour") }}</h2>
@@ -29,6 +29,6 @@
29
29
  <script setup>
30
30
  import { Icon, ViewportBlockingRect } from "#blokkli/components";
31
31
  import { useBlokkli } from "#imports";
32
- const { $t } = useBlokkli();
32
+ const { $t, ui } = useBlokkli();
33
33
  defineEmits(["start", "close"]);
34
34
  </script>
@@ -1,22 +1,13 @@
1
1
  <template>
2
2
  <Overlay v-if="tour.isTouring.value" @close="close" />
3
- <PluginMenuButton
4
- id="tour"
5
- :title="$t('tourLabel', 'Take a tour')"
6
- :description="$t('tourDescription', 'Explore the features of the editor')"
7
- icon="tutor"
8
- secondary
9
- :weight="-10"
10
- @click="start"
11
- />
12
3
  <Popup v-if="showTourPopup" @close="close" @start="start" />
13
4
  </template>
14
5
 
15
6
  <script setup>
16
7
  import { defineBlokkliFeature, useBlokkli } from "#imports";
17
8
  import Overlay from "./Overlay/index.vue";
18
- import { PluginMenuButton } from "#blokkli/plugins";
19
9
  import Popup from "./Popup/index.vue";
10
+ import defineMenuButton from "#blokkli/helpers/composables/defineMenuButton";
20
11
  defineBlokkliFeature({
21
12
  id: "tour",
22
13
  label: "Tour",
@@ -33,6 +24,17 @@ const close = () => {
33
24
  showTourPopup.value = false;
34
25
  tour.isTouring.value = false;
35
26
  };
27
+ defineMenuButton(() => {
28
+ return {
29
+ id: "tour",
30
+ title: $t("tourLabel", "Take a tour"),
31
+ description: $t("tourDescription", "Explore the features of the editor"),
32
+ icon: "tutor",
33
+ secondary: true,
34
+ weight: -10,
35
+ callback: start
36
+ };
37
+ });
36
38
  </script>
37
39
 
38
40
  <script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <Teleport to="body">
2
+ <Teleport :to="ui.mainLayoutElement.value">
3
3
  <BlokkliTransition name="transform-overlay">
4
4
  <TransformDialog
5
5
  v-if="openPluginDefinition"
@@ -52,18 +52,6 @@
52
52
  <Banner v-if="isTranslating" :active-language />
53
53
  </Teleport>
54
54
 
55
- <PluginMenuButton
56
- id="translations"
57
- :title="$t('translationsBatchTranslateMenuTitle', 'Translate...')"
58
- :description="
59
- $t('translationsBatchTranslateMenuDescription', 'Translate all blocks')
60
- "
61
- :disabled="!isTranslating"
62
- :weight="60"
63
- icon="translate"
64
- @click="eventBus.emit('batchTranslate')"
65
- />
66
-
67
55
  <PluginItemAction
68
56
  v-if="isTranslating"
69
57
  id="translate"
@@ -84,13 +72,10 @@ import {
84
72
  onMounted
85
73
  } from "#imports";
86
74
  import { falsy } from "#blokkli/helpers";
87
- import {
88
- PluginMenuButton,
89
- PluginItemAction,
90
- PluginTourItem
91
- } from "#blokkli/plugins";
75
+ import { PluginItemAction, PluginTourItem } from "#blokkli/plugins";
92
76
  import Banner from "./Banner/index.vue";
93
77
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
78
+ import defineMenuButton from "#blokkli/helpers/composables/defineMenuButton";
94
79
  const { adapter } = defineBlokkliFeature({
95
80
  id: "translations",
96
81
  label: "Translations",
@@ -202,6 +187,22 @@ onMounted(() => {
202
187
  }
203
188
  }
204
189
  });
190
+ defineMenuButton(() => {
191
+ return {
192
+ id: "translations",
193
+ title: $t("translationsBatchTranslateMenuTitle", "Translate..."),
194
+ description: $t(
195
+ "translationsBatchTranslateMenuDescription",
196
+ "Translate all blocks"
197
+ ),
198
+ icon: "translate",
199
+ disabled: !isTranslating.value,
200
+ weight: 60,
201
+ callback: () => {
202
+ eventBus.emit("batchTranslate");
203
+ }
204
+ };
205
+ });
205
206
  </script>
206
207
 
207
208
  <script>
@@ -6,7 +6,6 @@
6
6
  @keyup.stop
7
7
  @keydown.stop
8
8
  >
9
- <div class="bk bk-form-overlay-background bk-overlay" />
10
9
  <Resizable :id="id" class="bk-form-overlay-resizable">
11
10
  <FormHeader
12
11
  :bundle="bundle"
@@ -27,16 +26,26 @@
27
26
  <script setup>
28
27
  import FormHeader from "./Header/index.vue";
29
28
  import { Resizable } from "#blokkli/components";
30
- defineProps({
29
+ import { onBeforeUnmount, onMounted, useBlokkli } from "#imports";
30
+ import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
31
+ const props = defineProps({
31
32
  id: { type: String, required: true },
32
33
  bundle: { type: String, required: false },
33
34
  icon: { type: null, required: false },
34
35
  title: { type: String, required: true }
35
36
  });
37
+ const { ui } = useBlokkli();
36
38
  const emit = defineEmits(["close"]);
37
- const onClose = () => {
39
+ function onClose() {
38
40
  emit("close");
39
- };
41
+ }
42
+ onBlokkliEvent("overlay:close", onClose);
43
+ onMounted(() => {
44
+ ui.openDialog({ id: props.id, alignment: "right" });
45
+ });
46
+ onBeforeUnmount(() => {
47
+ ui.closeDialog(props.id);
48
+ });
40
49
  </script>
41
50
 
42
51
  <script>