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

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 (182) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +191 -27
  3. package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue.d.ts +38 -0
  4. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +15 -0
  5. package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +6 -0
  6. package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +28 -3
  7. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +6 -4
  8. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +11 -3
  9. package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +138 -3
  10. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +114 -0
  11. package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +21 -0
  12. package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +98 -0
  13. package/dist/runtime/components/Blocks/NotImplemented/index.vue +24 -0
  14. package/dist/runtime/components/Blocks/NotImplemented/index.vue.d.ts +6 -0
  15. package/dist/runtime/components/BlokkliEditable.vue.d.ts +11 -0
  16. package/dist/runtime/components/BlokkliItem.vue +16 -3
  17. package/dist/runtime/components/BlokkliItem.vue.d.ts +2 -0
  18. package/dist/runtime/components/Edit/Actions/index.vue +1 -1
  19. package/dist/runtime/components/Edit/AddListItem/index.vue +1 -6
  20. package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +5 -13
  21. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +6 -0
  22. package/dist/runtime/components/Edit/BlockProxy/index.vue +2 -2
  23. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +3 -0
  24. package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +4 -1
  25. package/dist/runtime/components/Edit/Dialog/index.vue +15 -50
  26. package/dist/runtime/components/Edit/DraggableList.vue +12 -9
  27. package/dist/runtime/components/Edit/EditIndicator.vue +11 -4
  28. package/dist/runtime/components/Edit/EditProvider.vue +27 -24
  29. package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +1 -0
  30. package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue +2 -3
  31. package/dist/runtime/components/Edit/Features/AddList/index.vue +17 -5
  32. package/dist/runtime/components/Edit/Features/Analyze/Icon.vue +85 -0
  33. package/dist/runtime/components/Edit/Features/Analyze/Icon.vue.d.ts +5 -0
  34. package/dist/runtime/components/Edit/Features/Analyze/Main.vue +288 -59
  35. package/dist/runtime/components/Edit/Features/Analyze/Main.vue.d.ts +8 -1
  36. package/dist/runtime/components/Edit/Features/Analyze/Renderer/fragment.glsl +25 -13
  37. package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue +114 -52
  38. package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue.d.ts +16 -2
  39. package/dist/runtime/components/Edit/Features/Analyze/Renderer/vertex.glsl +31 -11
  40. package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue +2 -0
  41. package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue.d.ts +8 -1
  42. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue +4 -4
  43. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue.d.ts +20 -2
  44. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue +11 -18
  45. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue.d.ts +10 -3
  46. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +46 -40
  47. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue.d.ts +10 -4
  48. package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue +8 -4
  49. package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.js +1 -0
  50. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.d.ts +4 -3
  51. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.js +2 -1
  52. package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.js +61 -20
  53. package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.d.ts +15 -1
  54. package/dist/runtime/components/Edit/Features/Analyze/index.vue +23 -2
  55. package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +22 -8
  56. package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +1 -1
  57. package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +8 -3
  58. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +10 -1
  59. package/dist/runtime/components/Edit/Features/Debug/Main.vue.d.ts +1 -1
  60. package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +2 -2
  61. package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue.d.ts +1 -1
  62. package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +8 -2
  63. package/dist/runtime/components/Edit/Features/EditForm/index.vue +1 -7
  64. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +1 -1
  65. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +4 -3
  66. package/dist/runtime/components/Edit/Features/EditableMask/index.vue +1 -1
  67. package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +7 -2
  68. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +2 -2
  69. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +9 -2
  70. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +12 -3
  71. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +3 -2
  72. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +1 -1
  73. package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +1 -0
  74. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +9 -0
  75. package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +3 -2
  76. package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +3 -2
  77. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +8 -2
  78. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +12 -2
  79. package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +11 -3
  80. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +126 -33
  81. package/dist/runtime/components/Edit/Features/Selection/Renderer/index.vue +1 -1
  82. package/dist/runtime/components/Edit/Features/Settings/index.vue +1 -1
  83. package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +3 -3
  84. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +2 -2
  85. package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +7 -1
  86. package/dist/runtime/components/Edit/Form/Textarea/index.vue +1 -1
  87. package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
  88. package/dist/runtime/components/Edit/Indicators/index.vue +1 -1
  89. package/dist/runtime/components/Edit/InfoBox/index.vue +3 -2
  90. package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +6 -1
  91. package/dist/runtime/components/Edit/Overlay/index.vue +4 -0
  92. package/dist/runtime/components/Edit/PreviewProvider.vue +3 -3
  93. package/dist/runtime/components/Edit/ScaleToFit/index.vue +4 -4
  94. package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
  95. package/dist/runtime/composables/useBlokkli.d.ts +6 -1
  96. package/dist/runtime/composables/useBlokkli.js +4 -1
  97. package/dist/runtime/css/output.css +1 -1
  98. package/dist/runtime/helpers/composables/defineItemDropdownAction.d.ts +1 -1
  99. package/dist/runtime/helpers/composables/defineMenuButton.d.ts +1 -1
  100. package/dist/runtime/helpers/composables/defineRenderer.d.ts +1 -1
  101. package/dist/runtime/helpers/composables/onBroadcastEvent.d.ts +1 -1
  102. package/dist/runtime/helpers/composables/useBlockRegistration.d.ts +1 -1
  103. package/dist/runtime/helpers/composables/useBlockRegistration.js +12 -1
  104. package/dist/runtime/helpers/composables/useDebugLogger.d.ts +1 -1
  105. package/dist/runtime/helpers/composables/useFocusTrap.d.ts +52 -0
  106. package/dist/runtime/helpers/composables/useFocusTrap.js +59 -0
  107. package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +1 -1
  108. package/dist/runtime/helpers/{useTransitionedValue.js → composables/useTransitionedValue.js} +1 -1
  109. package/dist/runtime/helpers/imports/index.d.ts +2 -1
  110. package/dist/runtime/helpers/imports/index.js +10 -1
  111. package/dist/runtime/helpers/{animationProvider.d.ts → providers/animation.d.ts} +100 -7
  112. package/dist/runtime/helpers/{animationProvider.js → providers/animation.js} +21 -11
  113. package/dist/runtime/helpers/providers/blocks.d.ts +25 -3
  114. package/dist/runtime/helpers/providers/blocks.js +9 -0
  115. package/dist/runtime/helpers/providers/commands.d.ts +41 -0
  116. package/dist/runtime/helpers/{commandsProvider.js → providers/commands.js} +1 -1
  117. package/dist/runtime/helpers/providers/debug.d.ts +125 -0
  118. package/dist/runtime/helpers/{debugProvider.js → providers/debug.js} +2 -2
  119. package/dist/runtime/helpers/providers/definition.d.ts +87 -0
  120. package/dist/runtime/helpers/providers/directive.d.ts +88 -2
  121. package/dist/runtime/helpers/providers/directive.js +18 -2
  122. package/dist/runtime/helpers/providers/dom.d.ts +225 -0
  123. package/dist/runtime/helpers/{domProvider.js → providers/dom.js} +27 -74
  124. package/dist/runtime/helpers/providers/dropArea.d.ts +47 -0
  125. package/dist/runtime/helpers/{dropAreaProvider.js → providers/dropArea.js} +1 -1
  126. package/dist/runtime/helpers/providers/element.d.ts +58 -1
  127. package/dist/runtime/helpers/providers/features.d.ts +56 -0
  128. package/dist/runtime/helpers/{featuresProvider.js → providers/features.js} +1 -1
  129. package/dist/runtime/helpers/providers/fields.d.ts +18 -11
  130. package/dist/runtime/helpers/providers/fields.js +1 -1
  131. package/dist/runtime/helpers/providers/indicators.d.ts +44 -0
  132. package/dist/runtime/helpers/providers/keyboard.d.ts +76 -0
  133. package/dist/runtime/helpers/{keyboardProvider.js → providers/keyboard.js} +1 -8
  134. package/dist/runtime/helpers/{pluginProvider.d.ts → providers/plugin.d.ts} +36 -0
  135. package/dist/runtime/helpers/{selectionProvider.d.ts → providers/selection.d.ts} +4 -1
  136. package/dist/runtime/helpers/{selectionProvider.js → providers/selection.js} +1 -1
  137. package/dist/runtime/helpers/providers/state.d.ts +227 -0
  138. package/dist/runtime/helpers/{stateProvider.js → providers/state.js} +3 -3
  139. package/dist/runtime/helpers/providers/storage.d.ts +64 -0
  140. package/dist/runtime/helpers/{textProvider.d.ts → providers/texts.d.ts} +1 -1
  141. package/dist/runtime/helpers/providers/theme.d.ts +119 -0
  142. package/dist/runtime/helpers/{themeProvider.js → providers/theme.js} +3 -3
  143. package/dist/runtime/helpers/providers/tour.d.ts +49 -0
  144. package/dist/runtime/helpers/{tourProvider.js → providers/tour.js} +1 -1
  145. package/dist/runtime/helpers/providers/types.d.ts +170 -0
  146. package/dist/runtime/helpers/{typesProvider.js → providers/types.js} +45 -1
  147. package/dist/runtime/helpers/providers/ui.d.ts +339 -0
  148. package/dist/runtime/helpers/{uiProvider.js → providers/ui.js} +11 -5
  149. package/dist/runtime/helpers/runtimeHelpers/index.d.ts +1 -1
  150. package/dist/runtime/helpers/symbols.d.ts +1 -0
  151. package/dist/runtime/helpers/symbols.js +3 -0
  152. package/dist/runtime/types/blockOptions.d.ts +349 -0
  153. package/dist/runtime/types/index.d.ts +22 -26
  154. package/package.json +2 -2
  155. package/dist/runtime/helpers/commandsProvider.d.ts +0 -9
  156. package/dist/runtime/helpers/debugProvider.d.ts +0 -33
  157. package/dist/runtime/helpers/definitionProvider.d.ts +0 -19
  158. package/dist/runtime/helpers/domProvider.d.ts +0 -91
  159. package/dist/runtime/helpers/dropAreaProvider.d.ts +0 -9
  160. package/dist/runtime/helpers/featuresProvider.d.ts +0 -17
  161. package/dist/runtime/helpers/indicatorsProvider.d.ts +0 -10
  162. package/dist/runtime/helpers/keyboardProvider.d.ts +0 -20
  163. package/dist/runtime/helpers/stateProvider.d.ts +0 -47
  164. package/dist/runtime/helpers/storageProvider.d.ts +0 -17
  165. package/dist/runtime/helpers/themeProvider.d.ts +0 -30
  166. package/dist/runtime/helpers/tourProvider.d.ts +0 -11
  167. package/dist/runtime/helpers/typesProvider.d.ts +0 -36
  168. package/dist/runtime/helpers/uiProvider.d.ts +0 -57
  169. package/dist/runtime/types/blokkOptions.d.ts +0 -100
  170. /package/dist/runtime/helpers/{addElementClasses.d.ts → composables/addElementClasses.d.ts} +0 -0
  171. /package/dist/runtime/helpers/{addElementClasses.js → composables/addElementClasses.js} +0 -0
  172. /package/dist/runtime/helpers/{defineElementStyle.d.ts → composables/defineElementStyle.d.ts} +0 -0
  173. /package/dist/runtime/helpers/{defineElementStyle.js → composables/defineElementStyle.js} +0 -0
  174. /package/dist/runtime/helpers/{useTransitionedValue.d.ts → composables/useTransitionedValue.d.ts} +0 -0
  175. /package/dist/runtime/helpers/{broadcastProvider.d.ts → providers/broadcast.d.ts} +0 -0
  176. /package/dist/runtime/helpers/{broadcastProvider.js → providers/broadcast.js} +0 -0
  177. /package/dist/runtime/helpers/{definitionProvider.js → providers/definition.js} +0 -0
  178. /package/dist/runtime/helpers/{indicatorsProvider.js → providers/indicators.js} +0 -0
  179. /package/dist/runtime/helpers/{pluginProvider.js → providers/plugin.js} +0 -0
  180. /package/dist/runtime/helpers/{storageProvider.js → providers/storage.js} +0 -0
  181. /package/dist/runtime/helpers/{textProvider.js → providers/texts.js} +0 -0
  182. /package/dist/runtime/types/{blokkOptions.js → blockOptions.js} +0 -0
@@ -56,19 +56,28 @@
56
56
  </template>
57
57
 
58
58
  <script setup>
59
- import { ref, useBlokkli, onMounted } from "#imports";
59
+ import { ref, useBlokkli, onMounted, useTemplateRef, watch } from "#imports";
60
60
  import { DialogModal, InfoBox, FormText, FormItem } from "#blokkli/components";
61
61
  import { realBackgroundColor } from "#blokkli/helpers";
62
62
  defineEmits(["confirm", "cancel"]);
63
- const { dom, $t, blocks } = useBlokkli();
63
+ const { dom, $t, blocks, ui } = useBlokkli();
64
64
  const props = defineProps({
65
65
  uuid: { type: String, required: true },
66
66
  backgroundClass: { type: String, required: false }
67
67
  });
68
68
  const label = ref("");
69
69
  const width = ref(450);
70
- const previewEl = ref(null);
70
+ const previewEl = useTemplateRef("previewEl");
71
71
  const backgroundColor = ref("");
72
+ watch(
73
+ label,
74
+ () => {
75
+ ui.requireDialogCloseConfirm();
76
+ },
77
+ {
78
+ once: true
79
+ }
80
+ );
72
81
  onMounted(() => {
73
82
  if (previewEl.value) {
74
83
  const item = blocks.getBlock(props.uuid);
@@ -75,7 +75,8 @@ import {
75
75
  useLazyAsyncData,
76
76
  useBlokkli,
77
77
  watch,
78
- nextTick
78
+ nextTick,
79
+ useTemplateRef
79
80
  } from "#imports";
80
81
  import { Sortli, Icon, Pagination, FormToggle } from "#blokkli/components";
81
82
  import Item from "./Item.vue";
@@ -86,7 +87,7 @@ defineProps({
86
87
  });
87
88
  const { adapter, storage, $t, element } = useBlokkli();
88
89
  const selected = ref([]);
89
- const listEl = ref(null);
90
+ const listEl = useTemplateRef("listEl");
90
91
  const page = ref(0);
91
92
  const key = computed(() => Object.values(filterValues.value).join(","));
92
93
  function getDragItems(activeItem) {
@@ -1,4 +1,4 @@
1
- import type { BlockOptionDefinition } from '#blokkli/types/blokkOptions';
1
+ import type { BlockOptionDefinition } from '#blokkli/types/blockOptions';
2
2
  type __VLS_Props = {
3
3
  option: BlockOptionDefinition;
4
4
  property: string;
@@ -4,6 +4,7 @@
4
4
  id="preview_with_smartphone"
5
5
  :title="$t('previewWithSmartphone', 'Preview (with smartphone)')"
6
6
  :disabled="!state.canEdit.value"
7
+ weight="20"
7
8
  :tour-text="
8
9
  $t(
9
10
  'previewWithSmartphoneTourText',
@@ -565,4 +565,13 @@ async function onSubmit() {
565
565
  emit("submit");
566
566
  }
567
567
  }
568
+ watch(
569
+ () => [revisionMessage.value, publishMode.value, isMutating.value],
570
+ () => {
571
+ ui.requireDialogCloseConfirm();
572
+ },
573
+ {
574
+ once: true
575
+ }
576
+ );
568
577
  </script>
@@ -25,7 +25,8 @@ import {
25
25
  onMounted,
26
26
  onBeforeUnmount,
27
27
  useRoute,
28
- watch
28
+ watch,
29
+ useTemplateRef
29
30
  } from "#imports";
30
31
  import { Icon } from "#blokkli/components";
31
32
  import { frameEventBus } from "./../../../../../helpers/frameEventBus";
@@ -40,7 +41,7 @@ watch(selection.uuids, (selectedUuids) => {
40
41
  frameEventBus.emit("selectItems", selectedUuids);
41
42
  });
42
43
  const isLoading = ref(true);
43
- const iframe = ref(null);
44
+ const iframe = useTemplateRef("iframe");
44
45
  const src = computed(
45
46
  () => route.fullPath.replace("blokkliEditing", "blokkliPreview")
46
47
  );
@@ -3,11 +3,12 @@
3
3
  id="mobile-preview"
4
4
  v-slot="{ width, height, isDetached, isResizing }"
5
5
  :title="$t('responsivePreviewTitle', 'Responsive Preview')"
6
- :tour-text="tourText"
6
+ :tour-text
7
+ weight="10"
7
8
  :disabled="!state.canEdit.value"
8
9
  :min-width="375"
9
10
  :min-height="375"
10
- :size="size"
11
+ :size
11
12
  icon="preview"
12
13
  region="left"
13
14
  >
@@ -52,10 +52,10 @@
52
52
  </template>
53
53
 
54
54
  <script setup>
55
- import { watch, ref, useBlokkli, onMounted } from "#imports";
55
+ import { ref, watch, useBlokkli, onMounted, useTemplateRef } from "#imports";
56
56
  import { ItemIcon, Icon, Sortli } from "#blokkli/components";
57
57
  import { modulo } from "#blokkli/helpers";
58
- const listItems = ref([]);
58
+ const listItems = useTemplateRef("listItems");
59
59
  const props = defineProps({
60
60
  visible: { type: Boolean, required: true },
61
61
  search: { type: String, required: true },
@@ -123,6 +123,9 @@ const setIndex = (newIndex) => {
123
123
  scrollItemIntoView();
124
124
  };
125
125
  const clickItem = () => {
126
+ if (!listItems.value) {
127
+ return;
128
+ }
126
129
  const element = listItems.value[index.value];
127
130
  if (!element) {
128
131
  return;
@@ -143,6 +146,9 @@ const clickItem = () => {
143
146
  emit("close");
144
147
  };
145
148
  const scrollItemIntoView = () => {
149
+ if (!listItems.value) {
150
+ return;
151
+ }
146
152
  const item = listItems.value[index.value];
147
153
  if (item) {
148
154
  item.scrollIntoView({ block: "nearest", inline: "nearest" });
@@ -38,10 +38,17 @@
38
38
  </template>
39
39
 
40
40
  <script setup>
41
- import { ref, computed, useBlokkli, onMounted, watch } from "#imports";
41
+ import {
42
+ ref,
43
+ computed,
44
+ useBlokkli,
45
+ onMounted,
46
+ watch,
47
+ useTemplateRef
48
+ } from "#imports";
42
49
  import { ItemIcon, Highlight } from "#blokkli/components";
43
50
  import { falsy, modulo } from "#blokkli/helpers";
44
- const listItems = ref([]);
51
+ const listItems = useTemplateRef("listItems");
45
52
  const emit = defineEmits(["close"]);
46
53
  const props = defineProps({
47
54
  visible: { type: Boolean, required: true },
@@ -86,6 +93,9 @@ const clickItem = () => {
86
93
  emit("close");
87
94
  };
88
95
  const scrollItemIntoView = () => {
96
+ if (!listItems.value) {
97
+ return;
98
+ }
89
99
  const item = listItems.value[index.value];
90
100
  if (item) {
91
101
  item.scrollIntoView({ block: "nearest", inline: "nearest" });
@@ -66,7 +66,15 @@
66
66
  </template>
67
67
 
68
68
  <script setup>
69
- import { watch, ref, computed, useBlokkli, onMounted, nextTick } from "#imports";
69
+ import {
70
+ watch,
71
+ ref,
72
+ computed,
73
+ useBlokkli,
74
+ onMounted,
75
+ nextTick,
76
+ useTemplateRef
77
+ } from "#imports";
70
78
  import { Icon, ScrollBoundary } from "#blokkli/components";
71
79
  import { modulo } from "#blokkli/helpers";
72
80
  import ResultsPage from "./Results/Page/index.vue";
@@ -105,8 +113,8 @@ const tabs = computed(() => Object.keys(tabsMap.value));
105
113
  const tabIndex = ref(0);
106
114
  const tab = computed(() => tabs.value[tabIndex.value]);
107
115
  const search = ref("");
108
- const input = ref(null);
109
- const resultsEl = ref(null);
116
+ const input = useTemplateRef("input");
117
+ const resultsEl = useTemplateRef("resultsEl");
110
118
  watch(search, () => {
111
119
  const component = getResultsComponent();
112
120
  if (component) {
@@ -8,40 +8,60 @@
8
8
  @close="$emit('close')"
9
9
  >
10
10
  <div
11
- ref="listEl"
12
- class="bk-selection-add-overlay-list bk-scrollbar-dark"
13
- @wheel="onWheel"
11
+ ref="scrollEl"
12
+ class="bk-selection-add-overlay-wrapper bk-scrollbar-dark"
14
13
  >
15
- <AddListItem
16
- v-for="item in items"
17
- :id="item.bundle"
18
- :key="item.bundle"
19
- context="selection-add-buttons"
20
- :label="item.label"
21
- :bundle="item.bundle"
22
- :color="item.isFavorite ? 'yellow' : void 0"
23
- tabindex="-1"
24
- @click.prevent="$emit('select', item.bundle)"
25
- />
26
- <AddListItem
27
- v-for="action in actions"
28
- :id="action.id"
29
- :key="'action:' + action.id"
30
- tabindex="-1"
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
- />
14
+ <div
15
+ class="bk-selection-add-overlay-form"
16
+ @pointerdown.stop
17
+ @keydown.capture.stop
18
+ @keyup.capture.stop
19
+ >
20
+ <form
21
+ class="bk-selection-add-overlay-form-input"
22
+ @submit.prevent.stop="onSubmitForm"
23
+ >
24
+ <Icon name="search" />
25
+ <input
26
+ ref="inputEl"
27
+ v-model="searchText"
28
+ type="text"
29
+ :placeholder="$t('searchBoxPlaceholder', 'Enter search term')"
30
+ />
31
+ <button
32
+ v-if="searchText"
33
+ type="button"
34
+ tabindex="-1"
35
+ @click.prevent="onClearSearchText"
36
+ >
37
+ <Icon name="close" />
38
+ </button>
39
+ </form>
40
+ </div>
41
+ <div
42
+ ref="wrapperEl"
43
+ :style="{
44
+ width,
45
+ height
46
+ }"
47
+ >
48
+ <div class="bk-selection-add-overlay-list" @wheel="onWheel">
49
+ <AddListItem
50
+ v-for="item in items"
51
+ v-show="isVisible(item)"
52
+ :key="item.props.id"
53
+ v-bind="item.props"
54
+ @click.prevent="onClick(item)"
55
+ />
56
+ </div>
57
+ </div>
38
58
  </div>
39
59
  </ArtboardTooltip>
40
60
  </template>
41
61
 
42
62
  <script setup>
43
- import { useTemplateRef, useBlokkli, computed } from "#imports";
44
- import { ArtboardTooltip, AddListItem } from "#blokkli/components";
63
+ import { useTemplateRef, useBlokkli, computed, ref, watch } from "#imports";
64
+ import { ArtboardTooltip, AddListItem, Icon } from "#blokkli/components";
45
65
  import { isInternalBundle } from "#blokkli/helpers/bundles";
46
66
  const props = defineProps({
47
67
  bundles: { type: Array, required: true },
@@ -49,12 +69,36 @@ const props = defineProps({
49
69
  anchorCoordinates: { type: Object, required: false },
50
70
  label: { type: String, required: true }
51
71
  });
52
- defineEmits(["select", "action", "close"]);
53
- const listEl = useTemplateRef("listEl");
72
+ const emit = defineEmits(["select", "action", "close"]);
73
+ const searchText = ref("");
74
+ const width = ref("auto");
75
+ const height = ref("auto");
76
+ const wrapperEl = useTemplateRef("wrapperEl");
77
+ const scrollEl = useTemplateRef("scrollEl");
78
+ const inputEl = useTemplateRef("inputEl");
54
79
  let hasScrollbar = null;
55
- const { types, plugins, storage } = useBlokkli();
80
+ watch(
81
+ searchText,
82
+ () => {
83
+ if (wrapperEl.value) {
84
+ const rect = wrapperEl.value.getBoundingClientRect();
85
+ width.value = rect.width + "px";
86
+ height.value = rect.height + "px";
87
+ }
88
+ },
89
+ {
90
+ once: true
91
+ }
92
+ );
93
+ function onClearSearchText() {
94
+ if (inputEl.value) {
95
+ inputEl.value.focus();
96
+ }
97
+ searchText.value = "";
98
+ }
99
+ const { types, plugins, storage, $t } = useBlokkli();
56
100
  const favorites = storage.use("blockFavorites", []);
57
- const items = computed(() => {
101
+ const blocks = computed(() => {
58
102
  return props.bundles.filter((bundle) => !isInternalBundle(bundle)).map((bundle) => {
59
103
  return {
60
104
  bundle,
@@ -65,6 +109,19 @@ const items = computed(() => {
65
109
  if (a.isFavorite && !b.isFavorite) return -1;
66
110
  if (!a.isFavorite && b.isFavorite) return 1;
67
111
  return a.label.localeCompare(b.label);
112
+ }).map((block) => {
113
+ return {
114
+ type: "block",
115
+ bundle: block.bundle,
116
+ searchText: block.label.toLowerCase(),
117
+ props: {
118
+ id: block.bundle,
119
+ label: block.label,
120
+ bundle: block.bundle,
121
+ color: block.isFavorite ? "yellow" : void 0,
122
+ context: "selection-add-buttons"
123
+ }
124
+ };
68
125
  });
69
126
  });
70
127
  const actions = computed(() => {
@@ -73,11 +130,34 @@ const actions = computed(() => {
73
130
  return true;
74
131
  }
75
132
  return props.bundles.includes(action.itemBundle);
133
+ }).map((action) => {
134
+ return {
135
+ type: "action",
136
+ action,
137
+ searchText: action.title + " " + (action.description ?? ""),
138
+ props: {
139
+ id: action.id,
140
+ label: action.title,
141
+ color: action.color,
142
+ context: "selection-add-buttons",
143
+ icon: action.icon,
144
+ noContextMenu: true
145
+ }
146
+ };
76
147
  });
77
148
  });
149
+ const items = computed(() => {
150
+ return [...blocks.value, ...actions.value];
151
+ });
152
+ function isVisible(item) {
153
+ if (!searchText.value) {
154
+ return true;
155
+ }
156
+ return item.searchText.includes(searchText.value);
157
+ }
78
158
  const onWheel = (e) => {
79
159
  if (hasScrollbar === null) {
80
- const element = listEl.value;
160
+ const element = scrollEl.value;
81
161
  hasScrollbar = element && element.scrollHeight > element.clientHeight;
82
162
  }
83
163
  if (hasScrollbar) {
@@ -86,4 +166,17 @@ const onWheel = (e) => {
86
166
  }
87
167
  }
88
168
  };
169
+ function onClick(item) {
170
+ if (item.type === "block") {
171
+ emit("select", item.bundle);
172
+ } else if (item.type === "action") {
173
+ emit("action", item.action);
174
+ }
175
+ }
176
+ function onSubmitForm() {
177
+ const firstResult = items.value.find((item) => isVisible(item));
178
+ if (firstResult) {
179
+ onClick(firstResult);
180
+ }
181
+ }
89
182
  </script>
@@ -14,7 +14,7 @@ import {
14
14
  import vs from "./vertex.glsl?raw";
15
15
  import fs from "./fragment.glsl?raw";
16
16
  import { RectangleBufferCollector } from "#blokkli/helpers/webgl";
17
- import { useTransitionedValue } from "#blokkli/helpers/useTransitionedValue";
17
+ import { useTransitionedValue } from "#blokkli/helpers/composables/useTransitionedValue";
18
18
  import { toShaderColor } from "#blokkli/helpers";
19
19
  const props = defineProps({
20
20
  blocks: { type: Array, required: true },
@@ -9,7 +9,7 @@
9
9
  <script setup>
10
10
  import { useBlokkli, defineBlokkliFeature, computed } from "#imports";
11
11
  import SettingsDialog from "./Dialog/index.vue";
12
- import { addElementClasses } from "#blokkli/helpers/addElementClasses";
12
+ import { addElementClasses } from "#blokkli/helpers/composables/addElementClasses";
13
13
  import { BlokkliTransition } from "#blokkli/components";
14
14
  import defineMenuButton from "#blokkli/helpers/composables/defineMenuButton";
15
15
  const { ui, $t } = useBlokkli();
@@ -50,13 +50,13 @@
50
50
 
51
51
  <script setup>
52
52
  import {
53
- ref,
54
53
  useBlokkli,
55
54
  computed,
56
55
  inject,
57
56
  onMounted,
58
57
  onBeforeUnmount,
59
- nextTick
58
+ nextTick,
59
+ useTemplateRef
60
60
  } from "#imports";
61
61
  import Item from "./../Item/index.vue";
62
62
  const props = defineProps({
@@ -109,7 +109,7 @@ function onClickFieldLabel() {
109
109
  list.value.map((v) => v.uuid)
110
110
  );
111
111
  }
112
- const el = ref(null);
112
+ const el = useTemplateRef("el");
113
113
  const observer = inject("bk_structure_observer");
114
114
  const isVisible = computed(() => !!props.visibleFieldKeys[key.value]);
115
115
  const bundlesAllowed = computed(
@@ -51,7 +51,7 @@
51
51
  </template>
52
52
 
53
53
  <script setup>
54
- import { useBlokkli, computed, ref } from "#imports";
54
+ import { useBlokkli, computed, ref, useTemplateRef } from "#imports";
55
55
  import { falsy, modulo } from "#blokkli/helpers";
56
56
  import { Icon, ShortcutIndicator } from "#blokkli/components";
57
57
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
@@ -86,7 +86,7 @@ const tooltipStyle = computed(() => {
86
86
  });
87
87
  const { tour, ui, $t } = useBlokkli();
88
88
  const activeIndex = ref(0);
89
- const contentEl = ref(null);
89
+ const contentEl = useTemplateRef("contentEl");
90
90
  const tooltipHeight = ref(100);
91
91
  const tooltipWidth = computed(() => {
92
92
  return ui.isMobile.value ? Math.min(window.innerWidth - 20, 400) : 400;
@@ -38,7 +38,7 @@
38
38
  }"
39
39
  @click.prevent="onClickPreview"
40
40
  >
41
- {{ $t("transformDialogButtonPreview", "New suggestion") }}
41
+ {{ previewButtonLabel }}
42
42
  </button>
43
43
  <button
44
44
  class="bk-button bk-is-orange"
@@ -94,6 +94,12 @@ function mapValues(values) {
94
94
  const hasSeedInput = computed(
95
95
  () => !!props.plugin.configInputs?.find((v) => v.type === "seed")
96
96
  );
97
+ const previewButtonLabel = computed(() => {
98
+ if (hasSeedInput.value) {
99
+ return $t("transformDialogButtonNewSuggestion", "New suggestion");
100
+ }
101
+ return $t("transformDialogButtonPreview", "Preview");
102
+ });
97
103
  const isLocked = ref(false);
98
104
  const hasChanged = ref(false);
99
105
  const isPreviewing = ref(false);
@@ -5,7 +5,7 @@
5
5
  </label>
6
6
  <textarea
7
7
  :id
8
- v-model.lazy="value"
8
+ v-model="value"
9
9
  class="bk-form-input"
10
10
  :placeholder
11
11
  :required
@@ -41,7 +41,7 @@ function onClose() {
41
41
  }
42
42
  onBlokkliEvent("overlay:close", onClose);
43
43
  onMounted(() => {
44
- ui.openDialog({ id: props.id, alignment: "right" });
44
+ ui.openDialog({ id: props.id, alignment: "right", confirmClose: true });
45
45
  });
46
46
  onBeforeUnmount(() => {
47
47
  ui.closeDialog(props.id);
@@ -98,7 +98,7 @@ onBlokkliEvent("state:reloaded", () => {
98
98
  prevRects.clear();
99
99
  });
100
100
  onBlokkliEvent("scrollIntoView", (e) => {
101
- if ("element" in e) {
101
+ if ("element" in e && e.highlight) {
102
102
  if (artboardElement.contains(e.element)) {
103
103
  highlighted.value = ui.getAbsoluteElementRect(e.element);
104
104
  } else {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="bk-info-box">
3
- <Icon name="info" />
3
+ <Icon :name="icon" />
4
4
  <div>
5
5
  <slot>
6
6
  <p v-html="text" />
@@ -12,6 +12,7 @@
12
12
  <script setup>
13
13
  import { Icon } from "#blokkli/components";
14
14
  defineProps({
15
- text: { type: String, required: false }
15
+ text: { type: String, required: false, default: void 0 },
16
+ icon: { type: null, required: false, default: "info" }
16
17
  });
17
18
  </script>
@@ -1,11 +1,16 @@
1
+ import type { BlokkliIcon } from '#blokkli-build/icons';
1
2
  type __VLS_Props = {
2
3
  text?: string;
4
+ icon?: BlokkliIcon;
3
5
  };
4
6
  declare var __VLS_5: {};
5
7
  type __VLS_Slots = {} & {
6
8
  default?: (props: typeof __VLS_5) => any;
7
9
  };
8
- 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 __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
11
+ text: string;
12
+ icon: BlokkliIcon;
13
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
14
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
10
15
  export default _default;
11
16
  type __VLS_WithSlots<T, S> = T & {
@@ -43,6 +43,10 @@ function onClick() {
43
43
  if (clickTimeout) {
44
44
  return;
45
45
  }
46
+ if (!ui.currentDialog.value?.confirmClose) {
47
+ onDoubleClick();
48
+ return;
49
+ }
46
50
  clickTimeout = window.setTimeout(() => {
47
51
  showDoubleClickInfo.value = true;
48
52
  }, 500);
@@ -21,11 +21,11 @@ import {
21
21
  INJECT_MUTATED_FIELDS_MAP
22
22
  } from "#blokkli/helpers/symbols";
23
23
  import { frameEventBus } from "#blokkli/helpers/frameEventBus";
24
- import broadcastProvider from "#blokkli/helpers/broadcastProvider";
24
+ import broadcastProvider from "#blokkli/helpers/providers/broadcast";
25
25
  import { getFieldKey, intersects } from "#blokkli/helpers";
26
26
  import { eventBus } from "#blokkli/helpers/eventBus";
27
- import definitionProvider from "../../helpers/definitionProvider";
28
- import { addElementClasses } from "#blokkli/helpers/addElementClasses";
27
+ import definitionProvider from "../../helpers/providers/definition";
28
+ import { addElementClasses } from "#blokkli/helpers/composables/addElementClasses";
29
29
  const props = defineProps({
30
30
  entity: { type: null, required: false },
31
31
  entityType: { type: String, required: true },
@@ -10,14 +10,14 @@
10
10
 
11
11
  <script setup>
12
12
  import useAnimationFrame from "#blokkli/helpers/composables/useAnimationFrame";
13
- import { ref, computed } from "#imports";
13
+ import { ref, computed, useTemplateRef } from "#imports";
14
14
  const props = defineProps({
15
15
  width: { type: Number, required: false },
16
16
  maxHeight: { type: Number, required: false }
17
17
  });
18
- const rootEl = ref(null);
19
- const inner = ref(null);
20
- const wrapper = ref(null);
18
+ const rootEl = useTemplateRef("rootEl");
19
+ const inner = useTemplateRef("inner");
20
+ const wrapper = useTemplateRef("wrapper");
21
21
  const rootWidth = ref(260);
22
22
  const nativeWidth = ref(0);
23
23
  const nativeHeight = ref(0);
@@ -2,7 +2,7 @@ import { type ComputedRef } from '#imports';
2
2
  import type { BlokkliAdapter, AdapterMethods } from '#blokkli/adapter';
3
3
  import type { FeatureDefinition } from '#blokkli/types';
4
4
  import type { ValidFeatureKey } from '#blokkli-build/features';
5
- import type { DebugLogger } from '#blokkli/helpers/debugProvider';
5
+ import type { DebugLogger } from '#blokkli/helpers/providers/debug';
6
6
  type SettingType<S> = S extends {
7
7
  type: 'checkbox';
8
8
  } ? boolean : S extends {
@@ -4,5 +4,10 @@ import type { BlokkliApp } from '#blokkli/types';
4
4
  *
5
5
  * The app is only available when the editor is mounted. Calling this
6
6
  * composable in normal rendering does not work.
7
+ *
8
+ * @param optional - If true, returns undefined instead of throwing when not in edit mode
9
+ * @returns The blokkli app, or undefined if optional is true and not in edit mode
10
+ * @throws Error if not in edit mode and optional is false/undefined
7
11
  */
8
- export declare function useBlokkli(): BlokkliApp;
12
+ export declare function useBlokkli(optional: true): BlokkliApp | undefined;
13
+ export declare function useBlokkli(optional?: false): BlokkliApp;
@@ -1,8 +1,11 @@
1
1
  import { INJECT_APP } from "../helpers/symbols.js";
2
2
  import { inject } from "#imports";
3
- export function useBlokkli() {
3
+ export function useBlokkli(optional) {
4
4
  const app = inject(INJECT_APP);
5
5
  if (!app) {
6
+ if (optional) {
7
+ return void 0;
8
+ }
6
9
  throw new Error(
7
10
  "The useBlokkli composable was called while not in edit mode."
8
11
  );