@blokkli/editor 2.0.0-alpha.7 → 2.0.0-alpha.9

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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "blokkli",
3
3
  "configKey": "blokkli",
4
- "version": "2.0.0-alpha.7",
4
+ "version": "2.0.0-alpha.9",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.15.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -13,7 +13,7 @@ import { BK_VISIBLE_LANGUAGES, BK_HIDDEN_GLOBALLY } from '../dist/runtime/helper
13
13
  import fs from 'node:fs';
14
14
  import { defu, createDefu } from 'defu';
15
15
 
16
- const version = "2.0.0-alpha.7";
16
+ const version = "2.0.0-alpha.9";
17
17
 
18
18
  function sortObjectKeys(obj) {
19
19
  if (Array.isArray(obj)) {
@@ -152,11 +152,12 @@ function filterVisible(item) {
152
152
  const filteredList = computed(() => {
153
153
  if (mutatedFields && !isInReusable && editContext && fieldKey.value && (isPreview?.value || isEditing)) {
154
154
  return ((mutatedFields[fieldKey.value] || {}).list || []).map((v) => {
155
+ const mutatedOptions = editContext.mutatedOptions[v.uuid] || {};
155
156
  return {
156
157
  ...v,
157
158
  options: {
158
- ...v.options
159
- // ...mutatedOptions,
159
+ ...v.options,
160
+ ...mutatedOptions
160
161
  }
161
162
  };
162
163
  });
@@ -12,7 +12,7 @@
12
12
  :is="component"
13
13
  v-else-if="component"
14
14
  v-bind="props"
15
- :data-bk-in-proxy="fieldUsesProxy || void 0"
15
+ :data-bk-in-proxy="fieldUsesProxy || (isEditing ? 'false' : void 0)"
16
16
  />
17
17
  <div v-else-if="isEditing">Block not implemented</div>
18
18
  </template>
@@ -23,9 +23,7 @@ import {
23
23
  provide,
24
24
  useRuntimeConfig,
25
25
  inject,
26
- defineAsyncComponent,
27
- getCurrentInstance,
28
- onMounted
26
+ defineAsyncComponent
29
27
  } from "#imports";
30
28
  import { getComponent } from "#blokkli/helpers/imports";
31
29
  import {
@@ -47,7 +45,6 @@ const componentProps = defineProps({
47
45
  parentType: { type: String, required: false, default: "" },
48
46
  isEditing: { type: Boolean, required: false, default: false }
49
47
  });
50
- const instance = componentProps.isEditing ? getCurrentInstance() : null;
51
48
  const isProxyMode = inject(INJECT_FIELD_PROXY_MODE, false);
52
49
  const fieldUsesProxy = inject(INJECT_FIELD_USES_PROXY, false);
53
50
  const isGlobalProxyMode = inject(
@@ -38,7 +38,7 @@ function getInteractedElement(e) {
38
38
  if (!(el instanceof HTMLElement)) {
39
39
  continue;
40
40
  }
41
- if (el.dataset.blokkliEditableField) {
41
+ if (el.dataset.blokkliEditableField && !el.closest('[data-bk-in-proxy="true"]')) {
42
42
  editableFieldName = el.dataset.blokkliEditableField;
43
43
  }
44
44
  if (el instanceof HTMLTableCellElement) {
@@ -180,7 +180,35 @@ const artboard = getArtboard();
180
180
  watch(options, function(newOptions) {
181
181
  artboard.setOptions(newOptions);
182
182
  });
183
- onBlokkliEvent("animationFrame:before", (time) => {
183
+ const AUTOSCROLL_EDGE_ZONE = 130;
184
+ const AUTOSCROLL_SPEED = 12;
185
+ let autoScrollSpeed = 1;
186
+ function edgeStep(distance) {
187
+ const ratio = distance / AUTOSCROLL_EDGE_ZONE;
188
+ return Math.pow(ratio, 3) * AUTOSCROLL_SPEED;
189
+ }
190
+ onBlokkliEvent("animationFrame:before", ({ time, mouseY }) => {
191
+ if (selection.isDragging.value) {
192
+ const viewportHeight = ui.viewport.value.height;
193
+ const currentOffset = artboard.getOffset();
194
+ const y = Math.min(Math.max(mouseY, 0), viewportHeight);
195
+ let dy = 0;
196
+ if (y < AUTOSCROLL_EDGE_ZONE) {
197
+ const dist = AUTOSCROLL_EDGE_ZONE - y;
198
+ dy = edgeStep(dist);
199
+ } else if (y > viewportHeight - AUTOSCROLL_EDGE_ZONE) {
200
+ const dist = y - (viewportHeight - AUTOSCROLL_EDGE_ZONE);
201
+ dy = -edgeStep(dist);
202
+ } else {
203
+ autoScrollSpeed = 1;
204
+ }
205
+ if (dy !== 0) {
206
+ artboard.setOffset(null, currentOffset.y + dy * autoScrollSpeed);
207
+ autoScrollSpeed = Math.min(autoScrollSpeed * 1.01, 2.25);
208
+ }
209
+ } else {
210
+ autoScrollSpeed = 1;
211
+ }
184
212
  artboard.loop(time);
185
213
  const artboardSize = artboard.getArtboardSize();
186
214
  if (artboardSize) {
@@ -30,7 +30,8 @@ const { adapter } = defineBlokkliFeature({
30
30
  "assistantGetResults",
31
31
  "assistantAddBlockFromResult"
32
32
  ],
33
- screenshot: "feature-assistant.jpg"
33
+ screenshot: "feature-assistant.jpg",
34
+ dependencies: ["add-list"]
34
35
  });
35
36
  const { state, $t } = useBlokkli();
36
37
  const placedAction = ref(null);
@@ -39,7 +39,8 @@ const { adapter } = defineBlokkliFeature({
39
39
  icon: "fragment",
40
40
  label: "Fragments",
41
41
  description: "Provides way to add content fragments defined by the frontend.",
42
- requiredAdapterMethods: ["fragmentsAddBlock"]
42
+ requiredAdapterMethods: ["fragmentsAddBlock"],
43
+ dependencies: ["add-list"]
43
44
  });
44
45
  const { state, $t, types, selection, dom } = useBlokkli();
45
46
  const isEnabled = computed(() => {
@@ -79,7 +79,8 @@ const { adapter } = defineBlokkliFeature({
79
79
  icon: "reusable",
80
80
  label: "Library",
81
81
  description: "Implements support for a block library to manage reusable blocks.",
82
- requiredAdapterMethods: ["makeBlockReusable", "detachReusableBlock"]
82
+ requiredAdapterMethods: ["makeBlockReusable", "detachReusableBlock"],
83
+ dependencies: ["add-list"]
83
84
  });
84
85
  const { selection, state, types, $t, eventBus, definitions } = useBlokkli();
85
86
  const showReusableDialog = ref(false);
@@ -5,7 +5,8 @@ import {
5
5
  INJECT_FIELD_LIST_TYPE,
6
6
  INJECT_REUSABLE_OPTIONS,
7
7
  INJECT_PROVIDER_BLOCKS,
8
- INJECT_PROVIDER_CONTEXT
8
+ INJECT_PROVIDER_CONTEXT,
9
+ INJECT_FIELD_USES_PROXY
9
10
  } from "../helpers/symbols.js";
10
11
  import { computed, inject } from "#imports";
11
12
  import { getRuntimeOptionValue } from "#blokkli/helpers/runtimeHelpers";
@@ -88,7 +89,10 @@ export function defineBlokkli(arg) {
88
89
  });
89
90
  }
90
91
  if (editContext?.useBlockRegistration && editContext.dom && bundle !== "from_library" && bundle !== "blokkli_fragment") {
91
- editContext.useBlockRegistration(editContext.dom, uuid);
92
+ const isProxyMode = inject(INJECT_FIELD_USES_PROXY, false);
93
+ if (!isProxyMode) {
94
+ editContext.useBlockRegistration(editContext.dom, uuid);
95
+ }
92
96
  }
93
97
  return {
94
98
  uuid,