@blokkli/editor 2.0.0-alpha.33 → 2.0.0-alpha.35

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.d.mts CHANGED
@@ -1,11 +1,12 @@
1
- export { a as ModuleHooks, M as ModuleOptions } from './shared/editor.Iax3GCvt.mjs';
2
- import 'nuxt/schema';
1
+ import { NuxtModule } from 'nuxt/schema';
2
+ import { M as ModuleOptions } from './shared/editor.Iax3GCvt.mjs';
3
+ export { a as ModuleHooks } from './shared/editor.Iax3GCvt.mjs';
3
4
  import 'consola';
4
5
  import '../dist/global/types/definitions.js';
5
6
  import '../dist/global/types/theme.js';
6
7
  import '@nuxt/kit';
7
8
  import '../dist/global/types/features.js';
8
9
 
9
- declare const _default: any;
10
+ declare const _default: NuxtModule<ModuleOptions>;
10
11
 
11
- export { _default as default };
12
+ export { ModuleOptions, _default as default };
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.33",
4
+ "version": "2.0.0-alpha.35",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.15.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -17,7 +17,7 @@ import { createRequire } from 'node:module';
17
17
  import { defu, createDefu } from 'defu';
18
18
 
19
19
  const name = "@blokkli/editor";
20
- const version = "2.0.0-alpha.33";
20
+ const version = "2.0.0-alpha.35";
21
21
 
22
22
  function sortObjectKeys(obj) {
23
23
  if (Array.isArray(obj)) {
@@ -3807,8 +3807,6 @@ const module$1 = defineNuxtModule({
3807
3807
  featureCollector,
3808
3808
  blockCollector
3809
3809
  ];
3810
- await Promise.all(collectors.map((v) => v.init()));
3811
- await Promise.all(collectors.map((v) => v.runHooks()));
3812
3810
  const hasErrors = [...collectors, helper].flatMap((v) => v.validate(iconCollector)).some((v) => v);
3813
3811
  if (!helper.isDev && !helper.isPrepare && hasErrors) {
3814
3812
  throw new Error("Failed to build bl\xF6kkli due to validation errors.");
@@ -3830,6 +3828,8 @@ const module$1 = defineNuxtModule({
3830
3828
  app.context.collectors.forEach((collector) => {
3831
3829
  collectors.push(collector);
3832
3830
  });
3831
+ await Promise.all(collectors.map((v) => v.init()));
3832
+ await Promise.all(collectors.map((v) => v.runHooks()));
3833
3833
  TEMPLATES.forEach((v) => {
3834
3834
  if (typeof v === "function") {
3835
3835
  const result = v(helper);
@@ -50,9 +50,9 @@ export declare const mutationResultSchema: z.ZodUnion<readonly [z.ZodObject<{
50
50
  type: z.ZodEnum<{
51
51
  add: "add";
52
52
  delete: "delete";
53
+ options: "options";
53
54
  move: "move";
54
55
  rewrite: "rewrite";
55
- options: "options";
56
56
  }>;
57
57
  label: z.ZodString;
58
58
  }, z.core.$strip>, z.ZodObject<{
@@ -52,6 +52,11 @@ type __VLS_Props = {
52
52
  * Force an alignment during drag and drop interactions.
53
53
  */
54
54
  dropAlignment?: FieldDropAlignment;
55
+ /**
56
+ * The z-index of this field, used to resolve overlapping blocks at the same
57
+ * nesting level. Higher values take priority. Default is 0.
58
+ */
59
+ zIndex?: number | string;
55
60
  /**
56
61
  * Renders proxy blocks during editing.
57
62
  *
@@ -80,6 +85,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
80
85
  fieldListType: ValidFieldListTypes;
81
86
  allowedFragments: BlokkliFragmentName[] | BlokkliFragmentName;
82
87
  dropAlignment: FieldDropAlignment;
88
+ zIndex: number | string;
83
89
  list: Array<FieldListItem | null | undefined> | FieldListItem | null;
84
90
  shouldRenderItem: (item: FieldListItem | FieldListItemTyped) => boolean;
85
91
  listClass: VueClassProp;
@@ -18,6 +18,7 @@
18
18
  { [nonEmptyClass]: filteredList.length }
19
19
  ]"
20
20
  :is-nested
21
+ :z-index
21
22
  :language="providerEntity?.language"
22
23
  :proxy-mode
23
24
  :tag
@@ -56,6 +57,7 @@ import BlokkliItem from "./BlokkliItem.vue";
56
57
  import {
57
58
  INJECT_ENTITY_CONTEXT,
58
59
  INJECT_FIELD_LIST_TYPE,
60
+ INJECT_FIELD_Z_INDEX,
59
61
  INJECT_IS_EDITING,
60
62
  INJECT_IS_IN_REUSABLE,
61
63
  INJECT_IS_NESTED,
@@ -86,6 +88,7 @@ const props = defineProps({
86
88
  nonEmptyClass: { type: String, required: false, default: "" },
87
89
  allowedFragments: { type: null, required: false, default: () => [] },
88
90
  dropAlignment: { type: String, required: false, default: void 0 },
91
+ zIndex: { type: [Number, String], required: false, default: 0 },
89
92
  proxyMode: { type: Boolean, required: false },
90
93
  shouldRenderItem: { type: Function, required: false, default: void 0 }
91
94
  });
@@ -153,6 +156,7 @@ const filteredList = computed(() => {
153
156
  });
154
157
  provide(INJECT_IS_NESTED, true);
155
158
  provide(INJECT_NESTING_LEVEL, nestingLevel + 1);
159
+ provide(INJECT_FIELD_Z_INDEX, Number(props.zIndex));
156
160
  provide(INJECT_FIELD_LIST_TYPE, fieldListType);
157
161
  provide(INJECT_FIELD_LIST_BLOCKS, filteredList);
158
162
  if (props.proxyMode) {
@@ -52,6 +52,11 @@ type __VLS_Props = {
52
52
  * Force an alignment during drag and drop interactions.
53
53
  */
54
54
  dropAlignment?: FieldDropAlignment;
55
+ /**
56
+ * The z-index of this field, used to resolve overlapping blocks at the same
57
+ * nesting level. Higher values take priority. Default is 0.
58
+ */
59
+ zIndex?: number | string;
55
60
  /**
56
61
  * Renders proxy blocks during editing.
57
62
  *
@@ -80,6 +85,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
80
85
  fieldListType: ValidFieldListTypes;
81
86
  allowedFragments: BlokkliFragmentName[] | BlokkliFragmentName;
82
87
  dropAlignment: FieldDropAlignment;
88
+ zIndex: number | string;
83
89
  list: Array<FieldListItem | null | undefined> | FieldListItem | null;
84
90
  shouldRenderItem: (item: FieldListItem | FieldListItemTyped) => boolean;
85
91
  listClass: VueClassProp;
@@ -78,40 +78,64 @@ let pointerDownElement = null;
78
78
  let mouseStartCoordinates = null;
79
79
  let pointerDownTimestamp = 0;
80
80
  let pointerUpTimestamp = 0;
81
+ function getFieldZIndex(uuid) {
82
+ const fieldKey = state.getFieldKeyForUuid(uuid);
83
+ if (!fieldKey) {
84
+ return 0;
85
+ }
86
+ const separatorIndex = fieldKey.indexOf(":");
87
+ const entityUuid = fieldKey.substring(0, separatorIndex);
88
+ const fieldName = fieldKey.substring(separatorIndex + 1);
89
+ return dom.getRegisteredField(entityUuid, fieldName)?.zIndex ?? 0;
90
+ }
81
91
  function getInteractedElement(e) {
82
92
  const { x, y } = getInteractionCoordinates(e);
83
- const editableField = directive.getEditableAtPoint(x, y);
84
- if (editableField) {
85
- const uuid = editableField.type === itemEntityType ? editableField.uuid : void 0;
86
- return {
87
- editableFieldName: editableField.fieldName,
88
- uuid,
89
- timestamp: Date.now(),
90
- x,
91
- y
92
- };
93
- }
94
93
  const visibleUuids = dom.getVisibleBlocks();
95
94
  let deepestUuid = "";
96
95
  let deepestLevel = -1;
96
+ let deepestZIndex = 0;
97
97
  for (let i = 0; i < visibleUuids.length; i++) {
98
98
  const uuid = visibleUuids[i];
99
99
  if (!uuid) {
100
100
  continue;
101
101
  }
102
102
  const rect = dom.getBlockRect(uuid);
103
- if (rect) {
104
- const level = state.getNestingLevel(uuid);
105
- if (level <= deepestLevel) {
106
- continue;
107
- }
108
- const relativeRect = ui.getViewportRelativeRect(rect);
109
- if (isInsideRect(x, y, relativeRect)) {
103
+ if (!rect) {
104
+ continue;
105
+ }
106
+ const level = state.getNestingLevel(uuid);
107
+ if (level < deepestLevel) {
108
+ continue;
109
+ }
110
+ const relativeRect = ui.getViewportRelativeRect(rect);
111
+ if (!isInsideRect(x, y, relativeRect)) {
112
+ continue;
113
+ }
114
+ if (level > deepestLevel) {
115
+ deepestUuid = uuid;
116
+ deepestLevel = level;
117
+ deepestZIndex = getFieldZIndex(uuid);
118
+ } else {
119
+ const zIndex = getFieldZIndex(uuid);
120
+ if (zIndex > deepestZIndex) {
110
121
  deepestUuid = uuid;
111
- deepestLevel = level;
122
+ deepestZIndex = zIndex;
112
123
  }
113
124
  }
114
125
  }
126
+ const editableField = directive.getEditableAtPoint(x, y);
127
+ if (editableField) {
128
+ const editableUuid = editableField.type === itemEntityType ? editableField.uuid : void 0;
129
+ if (!editableUuid || editableUuid === deepestUuid) {
130
+ return {
131
+ editableFieldName: editableField.fieldName,
132
+ uuid: editableUuid,
133
+ timestamp: Date.now(),
134
+ x,
135
+ y
136
+ };
137
+ }
138
+ }
115
139
  if (deepestUuid) {
116
140
  return {
117
141
  uuid: deepestUuid,
@@ -318,6 +342,7 @@ function onPointerUp(e) {
318
342
  } else if (keyboard.isPressingShift.value) {
319
343
  eventBus.emit("select:shiftToggle", clicked.uuid);
320
344
  } else {
345
+ console.log("asdfasdf");
321
346
  eventBus.emit("select", clicked.uuid);
322
347
  }
323
348
  return;
@@ -13,6 +13,7 @@ type __VLS_Props = {
13
13
  fieldListType: ValidFieldListTypes;
14
14
  allowedFragments?: BlokkliFragmentName[] | BlokkliFragmentName;
15
15
  dropAlignment?: FieldDropAlignment;
16
+ zIndex?: number | string;
16
17
  proxyMode?: boolean;
17
18
  globalProxyMode?: boolean;
18
19
  nestingLevel: number;
@@ -22,6 +23,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
22
23
  tag: string;
23
24
  allowedFragments: BlokkliFragmentName[] | BlokkliFragmentName;
24
25
  dropAlignment: FieldDropAlignment;
26
+ zIndex: number | string;
25
27
  language: string;
26
28
  shouldRenderItem: (item: FieldListItem | FieldListItemTyped) => boolean;
27
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -87,6 +87,7 @@ const props = defineProps({
87
87
  return [];
88
88
  } },
89
89
  dropAlignment: { type: String, required: false, default: void 0 },
90
+ zIndex: { type: [Number, String], required: false, default: 0 },
90
91
  proxyMode: { type: Boolean, required: false },
91
92
  globalProxyMode: { type: Boolean, required: false },
92
93
  nestingLevel: { type: Number, required: true },
@@ -111,12 +112,14 @@ function isMuted(item) {
111
112
  }
112
113
  const data = computed(() => {
113
114
  const allowedFragments = Array.isArray(props.allowedFragments) ? props.allowedFragments : [props.allowedFragments];
115
+ const zIndex = Number(props.zIndex);
114
116
  return {
115
117
  fieldListType: props.fieldListType,
116
118
  allowedFragments,
117
119
  isNested: props.isNested,
118
120
  nestingLevel: props.nestingLevel,
119
- dropAlignment: props.dropAlignment ?? null
121
+ dropAlignment: props.dropAlignment ?? null,
122
+ zIndex: Number.isNaN(zIndex) ? 0 : zIndex
120
123
  };
121
124
  });
122
125
  watch(
@@ -13,6 +13,7 @@ type __VLS_Props = {
13
13
  fieldListType: ValidFieldListTypes;
14
14
  allowedFragments?: BlokkliFragmentName[] | BlokkliFragmentName;
15
15
  dropAlignment?: FieldDropAlignment;
16
+ zIndex?: number | string;
16
17
  proxyMode?: boolean;
17
18
  globalProxyMode?: boolean;
18
19
  nestingLevel: number;
@@ -22,6 +23,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
22
23
  tag: string;
23
24
  allowedFragments: BlokkliFragmentName[] | BlokkliFragmentName;
24
25
  dropAlignment: FieldDropAlignment;
26
+ zIndex: number | string;
25
27
  language: string;
26
28
  shouldRenderItem: (item: FieldListItem | FieldListItemTyped) => boolean;
27
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -191,9 +191,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
191
191
  height: number;
192
192
  };
193
193
  minHeight: number;
194
- tourText: string;
195
194
  minWidth: number;
196
195
  region: SidebarRegion;
196
+ tourText: string;
197
197
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
198
198
  icon?: (props: {}) => any;
199
199
  } & {
@@ -191,9 +191,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
191
191
  height: number;
192
192
  };
193
193
  minHeight: number;
194
- tourText: string;
195
194
  minWidth: number;
196
195
  region: SidebarRegion;
196
+ tourText: string;
197
197
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
198
198
  icon?: (props: {}) => any;
199
199
  } & {
@@ -32,8 +32,9 @@ export type RegisteredField = {
32
32
  isNested: boolean;
33
33
  nestingLevel: number;
34
34
  dropAlignment: FieldDropAlignment | null;
35
+ zIndex: number;
35
36
  };
36
- export type RegisterFieldData = Pick<RegisteredField, 'fieldListType' | 'allowedFragments' | 'isNested' | 'nestingLevel' | 'dropAlignment'>;
37
+ export type RegisterFieldData = Pick<RegisteredField, 'fieldListType' | 'allowedFragments' | 'isNested' | 'nestingLevel' | 'dropAlignment' | 'zIndex'>;
37
38
  export type RenderedFieldListItem = {
38
39
  uuid: string;
39
40
  bundle: string;
@@ -35,6 +35,11 @@ export declare const INJECT_IS_NESTED: InjectionKey<boolean>;
35
35
  * The current nesting level, starting at 0.
36
36
  */
37
37
  export declare const INJECT_NESTING_LEVEL: InjectionKey<number>;
38
+ /**
39
+ * The z-index of the parent field, used to resolve overlapping blocks at the
40
+ * same nesting level. Higher values take priority.
41
+ */
42
+ export declare const INJECT_FIELD_Z_INDEX: InjectionKey<number>;
38
43
  /**
39
44
  * Whether we're currently in preview mode.
40
45
  */
@@ -11,6 +11,9 @@ export const INJECT_IS_NESTED = Symbol(
11
11
  export const INJECT_NESTING_LEVEL = Symbol(
12
12
  "blokkli_nesting_level"
13
13
  );
14
+ export const INJECT_FIELD_Z_INDEX = Symbol(
15
+ "blokkli_field_z_index"
16
+ );
14
17
  export const INJECT_IS_PREVIEW = Symbol("blokkli_is_preview");
15
18
  export const INJECT_IS_IN_REUSABLE = Symbol(
16
19
  "blokkli_is_in_reusable"
package/dist/types.d.mts CHANGED
@@ -4,6 +4,6 @@ declare module '@nuxt/schema' {
4
4
  interface NuxtHooks extends ModuleHooks {}
5
5
  }
6
6
 
7
- export { type ModuleHooks, type ModuleOptions } from './shared/editor.Iax3GCvt.mjs'
7
+ export { type ModuleHooks } from './shared/editor.Iax3GCvt.mjs'
8
8
 
9
- export { default } from './module.mjs'
9
+ export { type ModuleOptions, default } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blokkli/editor",
3
- "version": "2.0.0-alpha.33",
3
+ "version": "2.0.0-alpha.35",
4
4
  "description": "Interactive page building experience for Nuxt",
5
5
  "keywords": [
6
6
  "cms",