@blokkli/editor 2.0.0-alpha.42 → 2.0.0-alpha.43

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 (27) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +2 -1
  3. package/dist/modules/agent/index.mjs +6 -2
  4. package/dist/runtime/editor/components/Actions/Interactions/index.d.vue.ts +3 -0
  5. package/dist/runtime/editor/components/Actions/Interactions/index.vue +110 -0
  6. package/dist/runtime/editor/components/Actions/Interactions/index.vue.d.ts +3 -0
  7. package/dist/runtime/editor/components/Actions/index.vue +34 -3
  8. package/dist/runtime/editor/components/AnimationCanvas/index.vue +2 -10
  9. package/dist/runtime/editor/components/BundleSelector/index.vue +39 -11
  10. package/dist/runtime/editor/components/PreviewProvider.vue +1 -1
  11. package/dist/runtime/editor/css/output.css +1 -1
  12. package/dist/runtime/editor/features/analyze/Renderer/index.vue +1 -1
  13. package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue +8 -3
  14. package/dist/runtime/editor/features/hover/Renderer/index.vue +1 -1
  15. package/dist/runtime/editor/features/options/Form/index.vue +7 -17
  16. package/dist/runtime/editor/helpers/draggable/index.d.ts +3 -0
  17. package/dist/runtime/editor/helpers/draggable/index.js +9 -0
  18. package/dist/runtime/editor/providers/animation.js +1 -1
  19. package/dist/runtime/editor/providers/selection.d.ts +0 -4
  20. package/dist/runtime/editor/providers/selection.js +0 -2
  21. package/dist/runtime/editor/providers/ui.d.ts +16 -0
  22. package/dist/runtime/editor/providers/ui.js +5 -1
  23. package/dist/runtime/editor/translations/de.json +18 -2
  24. package/dist/runtime/editor/translations/fr.json +17 -1
  25. package/dist/runtime/editor/translations/gsw_CH.json +17 -1
  26. package/dist/runtime/editor/translations/it.json +17 -1
  27. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blokkli/editor",
3
3
  "configKey": "blokkli",
4
- "version": "2.0.0-alpha.42",
4
+ "version": "2.0.0-alpha.43",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.15.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -18,7 +18,7 @@ import 'typescript';
18
18
  import 'oxc-walker';
19
19
 
20
20
  const name = "@blokkli/editor";
21
- const version = "2.0.0-alpha.42";
21
+ const version = "2.0.0-alpha.43";
22
22
 
23
23
  function validateOption(optionKey, option, icons) {
24
24
  const errors = [];
@@ -1417,6 +1417,7 @@ const USED_MATERIAL_ICONS = [
1417
1417
  "bk_mdi_arrow_right",
1418
1418
  "bk_mdi_arrow_right_alt",
1419
1419
  "bk_mdi_arrow_selector_tool",
1420
+ "bk_mdi_arrow_top_left",
1420
1421
  "bk_mdi_arrow_upward",
1421
1422
  "bk_mdi_attach_file",
1422
1423
  "bk_mdi_bakery_dining",
@@ -156,8 +156,12 @@ function createClientTemplate(toolCollector, promptCollector, skillsCollector, o
156
156
  );
157
157
  exports$1.push(`export const routeAgent = ${JSON.stringify(routes.agent)}`);
158
158
  exports$1.push(`export const routeFetch = ${JSON.stringify(routes.fetch)}`);
159
- exports$1.push(`export const routeStream = ${JSON.stringify(routes.stream)}`);
160
- exports$1.push(`export const routeRoute = ${JSON.stringify(routes.routing)}`);
159
+ exports$1.push(
160
+ `export const routeStream = ${JSON.stringify(routes.stream)}`
161
+ );
162
+ exports$1.push(
163
+ `export const routeRoute = ${JSON.stringify(routes.routing)}`
164
+ );
161
165
  exports$1.push(
162
166
  `export const toolNames = ${JSON.stringify(toolCollector.getNames())}`
163
167
  );
@@ -0,0 +1,3 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,110 @@
1
+ <template>
2
+ <div class="bk-blokkli-item-actions-interactions">
3
+ <button
4
+ type="button"
5
+ :disabled="!canSelectParent"
6
+ @click.prevent="onClickSelectParent"
7
+ >
8
+ <Icon name="bk_mdi_arrow_top_left" />
9
+ <div class="bk-tooltip">
10
+ {{
11
+ parentLabel ? $t("actionsSelectParent", "Select parent (@label)").replace(
12
+ "@label",
13
+ parentLabel
14
+ ) : $t("actionsSelectPage", "Select page")
15
+ }}
16
+ </div>
17
+ </button>
18
+ <button
19
+ type="button"
20
+ :disabled="!canMove"
21
+ @pointerdown.stop.prevent="onMovePointerDown"
22
+ >
23
+ <Icon name="bk_mdi_drag_pan" />
24
+ <div class="bk-tooltip">
25
+ {{
26
+ selection.uuids.value.length === 1 ? $t("actionsMoveBlock", "Move block") : $t("actionsMoveBlocks", "Move @count blocks").replace(
27
+ "@count",
28
+ String(selection.uuids.value.length)
29
+ )
30
+ }}
31
+ </div>
32
+ </button>
33
+ </div>
34
+ </template>
35
+
36
+ <script setup>
37
+ import { computed, useBlokkli } from "#imports";
38
+ import { Icon } from "#blokkli/editor/components";
39
+ import { toDraggableExisting } from "#blokkli/editor/helpers/draggable";
40
+ const { selection, $t, state, eventBus, ui, types } = useBlokkli();
41
+ const canMove = computed(() => {
42
+ return !!selection.items.value.length;
43
+ });
44
+ const canSelectParent = computed(() => {
45
+ if (selection.hasHostSelected.value) {
46
+ return false;
47
+ }
48
+ const items = selection.items.value;
49
+ if (!items.length) {
50
+ return false;
51
+ }
52
+ const firstKey = state.getFieldKeyForUuid(items[0].uuid);
53
+ if (!firstKey) {
54
+ return false;
55
+ }
56
+ return items.every((item) => state.getFieldKeyForUuid(item.uuid) === firstKey);
57
+ });
58
+ const parentLabel = computed(() => {
59
+ const item = selection.items.value[0];
60
+ if (!item) {
61
+ return "";
62
+ }
63
+ const parentUuid = state.getParentEntityUuid(item.uuid);
64
+ if (!parentUuid) {
65
+ return "";
66
+ }
67
+ const parentItem = state.getFieldListItem(parentUuid);
68
+ if (!parentItem) {
69
+ return "";
70
+ }
71
+ return types.getBlockBundleDefinition(parentItem.bundle)?.label ?? "";
72
+ });
73
+ function onClickSelectParent() {
74
+ if (!canSelectParent.value) {
75
+ return;
76
+ }
77
+ const item = selection.items.value[0];
78
+ if (!item) {
79
+ return;
80
+ }
81
+ const parentUuid = state.getParentEntityUuid(item.uuid);
82
+ if (!parentUuid) {
83
+ return;
84
+ }
85
+ ui.actionsToolbarLocked.value = true;
86
+ if (state.getFieldListItem(parentUuid)) {
87
+ eventBus.emit("select", parentUuid);
88
+ eventBus.emit("scrollIntoView", { uuid: parentUuid });
89
+ } else {
90
+ eventBus.emit("select:unselect");
91
+ eventBus.emit("select:host");
92
+ }
93
+ }
94
+ function onMovePointerDown(e) {
95
+ eventBus.emit("dragging:start", {
96
+ items: toDraggableExisting(selection.items.value),
97
+ coords: {
98
+ x: e.clientX,
99
+ y: e.clientY
100
+ },
101
+ mode: "mouse"
102
+ });
103
+ }
104
+ </script>
105
+
106
+ <script>
107
+ export default {
108
+ name: "Interactions"
109
+ };
110
+ </script>
@@ -0,0 +1,3 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -5,7 +5,8 @@
5
5
  visibility: isVisible ? 'visible' : 'hidden'
6
6
  }"
7
7
  class="bk bk-blokkli-item-actions-inner"
8
- @click.stop
8
+ @mouseleave="onMouseLeave"
9
+ @mouseenter="onMouseEnter"
9
10
  >
10
11
  <div
11
12
  id="bk-blokkli-item-actions-controls"
@@ -15,6 +16,7 @@
15
16
  'bk-is-locked': ui.isTransforming.value
16
17
  }"
17
18
  >
19
+ <Interactions />
18
20
  <div id="bk-blokkli-item-actions-title">
19
21
  <button
20
22
  class="bk-blokkli-item-actions-type-button bk-item-icon-hover-parent"
@@ -82,10 +84,18 @@
82
84
  </template>
83
85
 
84
86
  <script setup>
85
- import { watch, ref, computed, useBlokkli, useTemplateRef } from "#imports";
87
+ import {
88
+ watch,
89
+ ref,
90
+ computed,
91
+ useBlokkli,
92
+ useTemplateRef,
93
+ onBeforeUnmount
94
+ } from "#imports";
86
95
  import { falsy } from "#blokkli/helpers";
87
96
  import { Icon, ItemIconBox } from "#blokkli/editor/components";
88
97
  import EditActionsItemDropdown from "./ItemDropdown.vue";
98
+ import Interactions from "./Interactions/index.vue";
89
99
  import { onBlokkliEvent, useStickyToolbar } from "#blokkli/editor/composables";
90
100
  import {
91
101
  fragmentBlockBundle,
@@ -99,11 +109,32 @@ const ACTIONS_HEIGHT = 52;
99
109
  const el = useTemplateRef("el");
100
110
  useStickyToolbar(el, {
101
111
  getPlacementY: () => "top",
102
- shouldUpdate: () => !selection.isChangingOptions.value && isVisible.value,
112
+ shouldUpdate: () => !ui.actionsToolbarLocked.value && isVisible.value,
103
113
  getHeight: () => ACTIONS_HEIGHT,
104
114
  getMargin: () => 20,
105
115
  allowHorizontalOverflow: true
106
116
  });
117
+ let mouseLeaveTimeout = null;
118
+ function onMouseLeave() {
119
+ onMouseEnter();
120
+ if (ui.actionsToolbarLocked.value || ui.isChangingOptions.value) {
121
+ mouseLeaveTimeout = window.setTimeout(() => {
122
+ ui.actionsToolbarLocked.value = false;
123
+ ui.isChangingOptions.value = false;
124
+ }, 500);
125
+ }
126
+ }
127
+ function onMouseEnter() {
128
+ if (mouseLeaveTimeout) {
129
+ window.clearTimeout(mouseLeaveTimeout);
130
+ mouseLeaveTimeout = null;
131
+ }
132
+ }
133
+ onBeforeUnmount(() => {
134
+ if (mouseLeaveTimeout) {
135
+ window.clearTimeout(mouseLeaveTimeout);
136
+ }
137
+ });
107
138
  const showDropdown = ref(false);
108
139
  const hasAnythingSelected = computed(
109
140
  () => selection.hasHostSelected.value || !!selection.items.value.length
@@ -34,6 +34,7 @@ import {
34
34
  } from "#imports";
35
35
  import { itemEntityType } from "#blokkli-build/config";
36
36
  import { onBlokkliEvent } from "#blokkli/editor/composables";
37
+ import { toDraggableExisting } from "#blokkli/editor/helpers/draggable";
37
38
  const {
38
39
  dom,
39
40
  eventBus,
@@ -133,15 +134,6 @@ function getInteractedElement(e) {
133
134
  }
134
135
  return null;
135
136
  }
136
- function toDraggableExisting(v) {
137
- const blocks2 = Array.isArray(v) ? v : [v];
138
- return blocks2.map((block) => {
139
- return {
140
- itemType: "existing",
141
- block
142
- };
143
- });
144
- }
145
137
  function onPointerMove(e) {
146
138
  if (!handlePointerMove) {
147
139
  return;
@@ -475,7 +467,7 @@ function onClick(e) {
475
467
  }
476
468
  return;
477
469
  }
478
- if (canvasEl.value && !selection.activeEditableLabel.value) {
470
+ if (canvasEl.value && !selection.activeEditableLabel.value && !ui.hasTooltipOpen.value) {
479
471
  canvasEl.value.focus();
480
472
  }
481
473
  }
@@ -6,6 +6,7 @@
6
6
  :anchor-coordinates
7
7
  class="bk-selection-add-overlay"
8
8
  @close="$emit('close')"
9
+ @wheel.stop
9
10
  >
10
11
  <div
11
12
  ref="scrollEl"
@@ -48,8 +49,7 @@
48
49
  >
49
50
  <div class="bk-selection-add-overlay-list" @wheel.passive="onWheel">
50
51
  <AddListItem
51
- v-for="item in items"
52
- v-show="isVisible(item)"
52
+ v-for="item in filteredItems"
53
53
  :key="item.props.id"
54
54
  v-bind="item.props"
55
55
  @click.prevent="onClick(item)"
@@ -61,9 +61,17 @@
61
61
  </template>
62
62
 
63
63
  <script setup>
64
- import { useTemplateRef, useBlokkli, computed, ref, watch } from "#imports";
64
+ import {
65
+ useTemplateRef,
66
+ useBlokkli,
67
+ computed,
68
+ ref,
69
+ watch,
70
+ onMounted
71
+ } from "#imports";
65
72
  import { ArtboardTooltip, AddListItem, Icon } from "#blokkli/editor/components";
66
73
  import { isInternalBundle } from "#blokkli/editor/helpers/bundles";
74
+ import { Fzf } from "fzf";
67
75
  const props = defineProps({
68
76
  bundles: { type: Array, required: true },
69
77
  anchorEl: { type: null, required: false },
@@ -107,6 +115,7 @@ const blocks = computed(() => {
107
115
  bundle,
108
116
  label: definition?.label ?? bundle,
109
117
  isAutoAdd: definitions.bundlesWithAutoAdd.value.includes(bundle),
118
+ description: definition?.description ?? "",
110
119
  isFavorite: favorites.value.includes(bundle)
111
120
  };
112
121
  }).sort((a, b) => {
@@ -117,7 +126,8 @@ const blocks = computed(() => {
117
126
  return {
118
127
  type: "block",
119
128
  bundle: block.bundle,
120
- searchText: block.label.toLowerCase(),
129
+ label: block.label.toLowerCase(),
130
+ description: block.description,
121
131
  props: {
122
132
  id: block.bundle,
123
133
  label: block.label,
@@ -142,7 +152,8 @@ const actions = computed(() => {
142
152
  return {
143
153
  type: "action",
144
154
  action,
145
- searchText: action.title + " " + (action.description ?? ""),
155
+ label: action.title,
156
+ description: action.description ?? "",
146
157
  props: {
147
158
  id: action.id,
148
159
  label: action.title,
@@ -157,12 +168,24 @@ const actions = computed(() => {
157
168
  const items = computed(() => {
158
169
  return [...blocks.value, ...actions.value];
159
170
  });
160
- function isVisible(item) {
161
- if (!searchText.value) {
162
- return true;
171
+ const fzf = new Fzf(items.value, {
172
+ selector: (item) => item.label + " " + item.description
173
+ });
174
+ const filteredItems = computed(() => {
175
+ const text = searchText.value.trim();
176
+ if (!text) {
177
+ return items.value;
163
178
  }
164
- return item.searchText.includes(searchText.value);
165
- }
179
+ const results = fzf.find(text);
180
+ const textLower = text.toLowerCase();
181
+ return results.map((r) => r.item).sort((a, b) => {
182
+ const aInLabel = a.label.toLowerCase().includes(textLower);
183
+ const bInLabel = b.label.toLowerCase().includes(textLower);
184
+ if (aInLabel && !bInLabel) return -1;
185
+ if (!aInLabel && bInLabel) return 1;
186
+ return 0;
187
+ });
188
+ });
166
189
  const onWheel = (e) => {
167
190
  if (hasScrollbar === null) {
168
191
  const element = scrollEl.value;
@@ -182,9 +205,14 @@ function onClick(item) {
182
205
  }
183
206
  }
184
207
  function onSubmitForm() {
185
- const firstResult = items.value.find((item) => isVisible(item));
208
+ const firstResult = filteredItems.value[0];
186
209
  if (firstResult) {
187
210
  onClick(firstResult);
188
211
  }
189
212
  }
213
+ onMounted(() => {
214
+ if (inputEl.value) {
215
+ inputEl.value.focus();
216
+ }
217
+ });
190
218
  </script>
@@ -70,7 +70,7 @@ function updateMutatedFields(fields) {
70
70
  for (let i = 0; i < existingKeys.length; i++) {
71
71
  const key = existingKeys[i];
72
72
  if (!newKeys.has(key)) {
73
- delete mutatedFieldsMap[key];
73
+ mutatedFieldsMap[key] = void 0;
74
74
  }
75
75
  }
76
76
  }