@blokkli/editor 2.0.0-alpha.1 → 2.0.0-alpha.10

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 (92) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +25 -9
  3. package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +8 -0
  4. package/dist/modules/drupal/graphql/base/fragment.paragraphsFieldItem.graphql +6 -0
  5. package/dist/modules/drupal/index.mjs +33 -7
  6. package/dist/modules/drupal/runtime/adapter/index.d.ts +3 -0
  7. package/dist/modules/drupal/{adapter/index.mjs → runtime/adapter/index.js} +13 -10
  8. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +2 -19
  9. package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +2 -7
  10. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +1 -1
  11. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue.d.ts +2 -19
  12. package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +4 -3
  13. package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +1 -1
  14. package/dist/runtime/blokkliPlugins/MenuButton/index.vue.d.ts +1 -1
  15. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue.d.ts +2 -51
  16. package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +11 -5
  17. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +1 -1
  18. package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +2 -4
  19. package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +4 -3
  20. package/dist/runtime/components/BlokkliEditable.vue +1 -0
  21. package/dist/runtime/components/BlokkliEditable.vue.d.ts +4 -18
  22. package/dist/runtime/components/BlokkliField.vue +4 -2
  23. package/dist/runtime/components/BlokkliField.vue.d.ts +8 -92
  24. package/dist/runtime/components/BlokkliItem.vue +1 -1
  25. package/dist/runtime/components/BlokkliProvider.vue +2 -1
  26. package/dist/runtime/components/BlokkliProvider.vue.d.ts +5 -22
  27. package/dist/runtime/components/Edit/Actions/index.vue +4 -1
  28. package/dist/runtime/components/Edit/BlockProxy/index.vue +3 -1
  29. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +4 -4
  30. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue.d.ts +2 -13
  31. package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +1 -1
  32. package/dist/runtime/components/Edit/DragInteractions/index.vue +1 -1
  33. package/dist/runtime/components/Edit/EditProvider.vue +7 -4
  34. package/dist/runtime/components/Edit/EditProvider.vue.d.ts +3 -3
  35. package/dist/runtime/components/Edit/Features/Artboard/index.vue +29 -1
  36. package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +4 -4
  37. package/dist/runtime/components/Edit/Features/Assistant/index.vue +2 -1
  38. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +1 -1
  39. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +2 -2
  40. package/dist/runtime/components/Edit/Features/Comments/Comment/index.vue +1 -1
  41. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +2 -2
  42. package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +7 -7
  43. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue.d.ts +3 -132
  44. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +2 -2
  45. package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +4 -4
  46. package/dist/runtime/components/Edit/Features/Fragments/index.vue +2 -1
  47. package/dist/runtime/components/Edit/Features/Help/index.vue +2 -2
  48. package/dist/runtime/components/Edit/Features/History/List/index.vue +4 -4
  49. package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +5 -5
  50. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +2 -2
  51. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +5 -5
  52. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +2 -2
  53. package/dist/runtime/components/Edit/Features/Library/index.vue +2 -1
  54. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +1 -1
  55. package/dist/runtime/components/Edit/Features/Options/Form/Group.vue.d.ts +2 -11
  56. package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +1 -1
  57. package/dist/runtime/components/Edit/Features/Ownership/index.vue +1 -1
  58. package/dist/runtime/components/Edit/Features/PreviewGrant/QrCode/index.vue +1 -1
  59. package/dist/runtime/components/Edit/Features/Publish/index.vue +20 -2
  60. package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue.d.ts +2 -13
  61. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +1 -1
  62. package/dist/runtime/components/Edit/Features/Search/index.vue +1 -1
  63. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +2 -2
  64. package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +4 -4
  65. package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +1 -1
  66. package/dist/runtime/components/Edit/Features/Validations/index.vue +1 -1
  67. package/dist/runtime/components/Edit/Form/Group/index.vue.d.ts +2 -4
  68. package/dist/runtime/components/Edit/Form/Item/index.vue.d.ts +2 -4
  69. package/dist/runtime/components/Edit/FormOverlay/index.vue.d.ts +3 -2
  70. package/dist/runtime/components/Edit/PreviewProvider.vue +1 -0
  71. package/dist/runtime/components/Edit/PreviewProvider.vue.d.ts +3 -3
  72. package/dist/runtime/components/Edit/RelativeTime/index.vue.d.ts +2 -2
  73. package/dist/runtime/components/Edit/Resizable/index.vue.d.ts +1 -1
  74. package/dist/runtime/components/Edit/ScaleToFit/index.vue.d.ts +1 -1
  75. package/dist/runtime/components/Edit/ScrollBoundary/index.vue.d.ts +2 -7
  76. package/dist/runtime/components/Edit/Sortli/index.vue.d.ts +1 -1
  77. package/dist/runtime/components/Edit/SystemRequirements/index.vue +2 -2
  78. package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue.d.ts +2 -7
  79. package/dist/runtime/composables/defineBlokkli.js +8 -1
  80. package/dist/runtime/composables/defineBlokkliFragment.js +8 -1
  81. package/dist/runtime/composables/useBlokkliHelper.d.ts +19 -0
  82. package/dist/runtime/composables/useBlokkliHelper.js +82 -0
  83. package/dist/runtime/css/output.css +1 -1
  84. package/dist/runtime/helpers/animationProvider.js +1 -1
  85. package/dist/runtime/helpers/composables/useBlockRegistration.d.ts +5 -0
  86. package/dist/runtime/helpers/composables/useBlockRegistration.js +23 -0
  87. package/dist/runtime/helpers/domProvider.d.ts +2 -0
  88. package/dist/runtime/helpers/domProvider.js +50 -65
  89. package/dist/runtime/helpers/runtimeHelpers/index.js +1 -1
  90. package/dist/runtime/types/index.d.ts +38 -1
  91. package/package.json +8 -11
  92. package/dist/modules/drupal/adapter/index.d.mts +0 -6
@@ -3,9 +3,9 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
3
3
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
4
4
  timestamp: number;
5
5
  }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
6
- default?: ((props: {
6
+ default?: (props: {
7
7
  formatted: string;
8
- }) => any) | undefined;
8
+ }) => any;
9
9
  }>;
10
10
  export default _default;
11
11
  type __VLS_WithSlots<T, S> = T & {
@@ -3,7 +3,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
3
3
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
4
4
  id: string;
5
5
  }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
6
- default?: ((props: {}) => any) | undefined;
6
+ default?: (props: {}) => any;
7
7
  }>;
8
8
  export default _default;
9
9
  type __VLS_WithSlots<T, S> = T & {
@@ -5,7 +5,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
5
5
  width?: number;
6
6
  maxHeight?: number;
7
7
  }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
8
- default?: ((props: {}) => any) | undefined;
8
+ default?: (props: {}) => any;
9
9
  }>;
10
10
  export default _default;
11
11
  type __VLS_WithSlots<T, S> = T & {
@@ -4,15 +4,10 @@ type __VLS_Props = {
4
4
  */
5
5
  dragging?: boolean;
6
6
  };
7
- declare function onWheel(e: WheelEvent): void;
8
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
9
7
  declare var __VLS_1: {};
10
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
8
+ type __VLS_Slots = {} & {
11
9
  default?: (props: typeof __VLS_1) => any;
12
- }>;
13
- declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
14
- onWheel: typeof onWheel;
15
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ };
16
11
  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>;
17
12
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
18
13
  export default _default;
@@ -4,7 +4,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
4
4
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
5
5
  getDragItems?: (activeItem?: DraggableItem) => DraggableItem[] | null;
6
6
  }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
7
- default?: ((props: {}) => any) | undefined;
7
+ default?: (props: {}) => any;
8
8
  }>;
9
9
  export default _default;
10
10
  type __VLS_WithSlots<T, S> = T & {
@@ -40,8 +40,8 @@
40
40
  <p>
41
41
  {{
42
42
  $t(
43
- 'systemRequirementsDialogText',
44
- 'bl\xF6kkli has been tested and optimized for the latest versions of Chrome, Firefox, Edge, and Safari. Features like WebGL are well supported, but they may sometimes be disabled for performance or security reasons.'
43
+ "systemRequirementsDialogText",
44
+ "bl\xF6kkli has been tested and optimized for the latest versions of Chrome, Firefox, Edge, and Safari. Features like WebGL are well supported, but they may sometimes be disabled for performance or security reasons."
45
45
  )
46
46
  }}
47
47
  </p>
@@ -1,15 +1,10 @@
1
1
  type __VLS_Props = {
2
2
  id: string;
3
3
  };
4
- declare const el: import("vue").Ref<HTMLDivElement | null, HTMLDivElement | null>;
5
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
6
4
  declare var __VLS_1: {};
7
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
5
+ type __VLS_Slots = {} & {
8
6
  default?: (props: typeof __VLS_1) => any;
9
- }>;
10
- declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
11
- el: typeof el;
12
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ };
13
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>;
14
9
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
15
10
  export default _default;
@@ -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";
@@ -87,6 +88,12 @@ export function defineBlokkli(arg) {
87
88
  import.meta.hot.accept("#blokkli/helpers/runtimeHelpers", () => {
88
89
  });
89
90
  }
91
+ if (editContext?.useBlockRegistration && editContext.dom && bundle !== "from_library" && bundle !== "blokkli_fragment") {
92
+ const isProxyMode = inject(INJECT_FIELD_USES_PROXY, false);
93
+ if (!isProxyMode) {
94
+ editContext.useBlockRegistration(editContext.dom, uuid);
95
+ }
96
+ }
90
97
  return {
91
98
  uuid,
92
99
  index,
@@ -1,4 +1,7 @@
1
- import { INJECT_FRAGMENT_CONTEXT } from "../helpers/symbols.js";
1
+ import {
2
+ INJECT_EDIT_CONTEXT,
3
+ INJECT_FRAGMENT_CONTEXT
4
+ } from "../helpers/symbols.js";
2
5
  import { inject, computed } from "#imports";
3
6
  export function defineBlokkliFragment(_config) {
4
7
  const ctx = inject(
@@ -18,5 +21,9 @@ export function defineBlokkliFragment(_config) {
18
21
  provider: computed(() => null)
19
22
  };
20
23
  }
24
+ const editContext = inject(INJECT_EDIT_CONTEXT, null);
25
+ if (editContext?.dom && editContext.useBlockRegistration) {
26
+ editContext.useBlockRegistration(editContext.dom, ctx.uuid);
27
+ }
21
28
  return ctx;
22
29
  }
@@ -0,0 +1,19 @@
1
+ import { type ComputedRef } from '#imports';
2
+ import type { FieldListItemTyped } from '#blokkli-build/generated-types';
3
+ type BundleWithoutLibrary = Exclude<FieldListItemTyped['bundle'], 'from_library'>;
4
+ type CallbackResult = {
5
+ include: boolean;
6
+ continueChildren?: boolean;
7
+ } | undefined | null;
8
+ type UseBlokkliHelper = {
9
+ /**
10
+ * Iterates over the all blocks of the current field and returns a flat array
11
+ * of matching block bundles.
12
+ */
13
+ queryBlocks<K extends BundleWithoutLibrary>(bundles: K[], providedList?: FieldListItemTyped[]): ComputedRef<Extract<FieldListItemTyped, {
14
+ bundle: K;
15
+ }>[]>;
16
+ queryBlocks(bundles: (item: FieldListItemTyped) => CallbackResult, providedList?: FieldListItemTyped[]): ComputedRef<FieldListItemTyped[]>;
17
+ };
18
+ export declare function useBlokkliHelper(): UseBlokkliHelper;
19
+ export {};
@@ -0,0 +1,82 @@
1
+ import {
2
+ INJECT_EDIT_CONTEXT,
3
+ INJECT_PROVIDER_BLOCKS
4
+ } from "#blokkli/helpers/symbols";
5
+ import { inject, computed, watch, ref } from "#imports";
6
+ import { FIELD_MAPPING } from "#blokkli-build/runtime-options";
7
+ import { getActualBlock } from "#blokkli/helpers/runtimeHelpers";
8
+ function walkBlocks(matches, callback, mutatedOptions, list) {
9
+ if (!list) return;
10
+ for (let i = 0; i < list.length; i++) {
11
+ const item = list[i];
12
+ if (!item) continue;
13
+ if (!("bundle" in item) || !("uuid" in item)) continue;
14
+ const mutatedOptionsForBlock = mutatedOptions[item.uuid] ?? {};
15
+ const mappedItem = getActualBlock({
16
+ ...item,
17
+ options: { ...item.options, ...mutatedOptionsForBlock }
18
+ });
19
+ if (!mappedItem) continue;
20
+ const callbackResult = callback(mappedItem);
21
+ if (callbackResult === null || callbackResult === void 0) {
22
+ continue;
23
+ } else if (callbackResult.include) {
24
+ matches.push(mappedItem);
25
+ }
26
+ if (callbackResult.continueChildren === false) {
27
+ continue;
28
+ }
29
+ const nestedFieldMapping = FIELD_MAPPING[mappedItem.bundle];
30
+ if (!nestedFieldMapping) continue;
31
+ if (!mappedItem.props) continue;
32
+ const propNames = Object.keys(nestedFieldMapping);
33
+ for (const propName of propNames) {
34
+ const value = mappedItem.props[propName];
35
+ if (!value) continue;
36
+ const valueAsArray = Array.isArray(value) ? value : [value];
37
+ walkBlocks(matches, callback, mutatedOptions, valueAsArray);
38
+ }
39
+ }
40
+ }
41
+ export function useBlokkliHelper() {
42
+ const rootBlocks = inject(
43
+ INJECT_PROVIDER_BLOCKS,
44
+ null
45
+ );
46
+ const editContext = inject(INJECT_EDIT_CONTEXT, null);
47
+ const mutatedOptions = ref({});
48
+ if (editContext?.mutatedOptions) {
49
+ watch(editContext.mutatedOptions, (options) => {
50
+ mutatedOptions.value = options;
51
+ });
52
+ }
53
+ function queryBlocks(bundlesOrCallback, providedList) {
54
+ const callback = typeof bundlesOrCallback === "function" ? bundlesOrCallback : (item) => {
55
+ if (bundlesOrCallback.includes(item.bundle)) {
56
+ return {
57
+ include: true,
58
+ continueChildren: true
59
+ };
60
+ }
61
+ return {
62
+ include: false,
63
+ continueChildren: true
64
+ };
65
+ };
66
+ return computed(() => {
67
+ const matches = [];
68
+ const list = providedList ? providedList : rootBlocks?.value;
69
+ if (!list) {
70
+ console.error(
71
+ "[bl\xF6kkli] - Failed to inject rootBlocks in queryBlocks. Automatic injection is only available when the useBlokkliHelper composable is called in a component inside <BlokkliField>. If this is not the case, pass the FieldListItemTyped array as the second argument to queryBlocks."
72
+ );
73
+ return [];
74
+ }
75
+ walkBlocks(matches, callback, mutatedOptions.value, list);
76
+ return matches;
77
+ });
78
+ }
79
+ return {
80
+ queryBlocks
81
+ };
82
+ }