@blokkli/editor 2.0.0-alpha.1 → 2.0.0-alpha.11
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 +1 -1
- package/dist/module.mjs +25 -9
- package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +8 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsFieldItem.graphql +6 -0
- package/dist/modules/drupal/index.mjs +33 -7
- package/dist/modules/drupal/runtime/adapter/index.d.ts +3 -0
- package/dist/modules/drupal/{adapter/index.mjs → runtime/adapter/index.js} +13 -10
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +2 -19
- package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +2 -7
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue.d.ts +2 -19
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +4 -3
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +1 -1
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue.d.ts +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue.d.ts +2 -51
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +11 -5
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +1 -1
- package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +2 -4
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +4 -3
- package/dist/runtime/components/BlokkliEditable.vue +1 -0
- package/dist/runtime/components/BlokkliEditable.vue.d.ts +4 -18
- package/dist/runtime/components/BlokkliField.vue +4 -2
- package/dist/runtime/components/BlokkliField.vue.d.ts +8 -92
- package/dist/runtime/components/BlokkliItem.vue +1 -1
- package/dist/runtime/components/BlokkliProvider.vue +2 -1
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +5 -22
- package/dist/runtime/components/Edit/Actions/index.vue +4 -1
- package/dist/runtime/components/Edit/BlockProxy/index.vue +3 -1
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +4 -4
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue.d.ts +2 -13
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/DragInteractions/index.vue +1 -1
- package/dist/runtime/components/Edit/EditProvider.vue +7 -4
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +3 -3
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +29 -1
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/Assistant/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Comments/Comment/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +7 -7
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue.d.ts +3 -132
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/Help/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/History/List/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Library/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Options/Form/Group.vue.d.ts +2 -11
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Ownership/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/PreviewGrant/QrCode/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Publish/index.vue +20 -2
- package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue.d.ts +2 -13
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Search/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Validations/index.vue +1 -1
- package/dist/runtime/components/Edit/Form/Group/index.vue.d.ts +2 -4
- package/dist/runtime/components/Edit/Form/Item/index.vue.d.ts +2 -4
- package/dist/runtime/components/Edit/FormOverlay/index.vue.d.ts +3 -2
- package/dist/runtime/components/Edit/PreviewProvider.vue +1 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue.d.ts +3 -3
- package/dist/runtime/components/Edit/RelativeTime/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Resizable/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/ScaleToFit/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/ScrollBoundary/index.vue.d.ts +2 -7
- package/dist/runtime/components/Edit/Sortli/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +2 -2
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue.d.ts +2 -7
- package/dist/runtime/composables/defineBlokkli.js +8 -1
- package/dist/runtime/composables/defineBlokkliFragment.js +8 -1
- package/dist/runtime/composables/useBlokkliHelper.d.ts +19 -0
- package/dist/runtime/composables/useBlokkliHelper.js +95 -0
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.js +1 -1
- package/dist/runtime/helpers/composables/useBlockRegistration.d.ts +5 -0
- package/dist/runtime/helpers/composables/useBlockRegistration.js +23 -0
- package/dist/runtime/helpers/domProvider.d.ts +2 -0
- package/dist/runtime/helpers/domProvider.js +50 -65
- package/dist/runtime/helpers/runtimeHelpers/index.js +1 -1
- package/dist/runtime/types/index.d.ts +38 -1
- package/package.json +8 -11
- 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?: (
|
|
6
|
+
default?: (props: {
|
|
7
7
|
formatted: string;
|
|
8
|
-
}) => any
|
|
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?: (
|
|
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?: (
|
|
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 =
|
|
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?: (
|
|
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
|
-
|
|
44
|
-
|
|
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 =
|
|
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 {
|
|
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,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INJECT_EDIT_CONTEXT,
|
|
3
|
+
INJECT_MUTATED_FIELDS_MAP,
|
|
4
|
+
INJECT_PROVIDER_BLOCKS
|
|
5
|
+
} from "#blokkli/helpers/symbols";
|
|
6
|
+
import { inject, computed, watch, ref } from "#imports";
|
|
7
|
+
import { FIELD_MAPPING } from "#blokkli-build/runtime-options";
|
|
8
|
+
import { getActualBlock } from "#blokkli/helpers/runtimeHelpers";
|
|
9
|
+
function walkBlocks(matches, callback, mutatedOptions, mutatedFieldsMap, list) {
|
|
10
|
+
if (!list) return;
|
|
11
|
+
for (let i = 0; i < list.length; i++) {
|
|
12
|
+
const item = list[i];
|
|
13
|
+
if (!item) continue;
|
|
14
|
+
if (!("bundle" in item) || !("uuid" in item)) continue;
|
|
15
|
+
const mutatedOptionsForBlock = mutatedOptions[item.uuid] ?? {};
|
|
16
|
+
const mappedItem = getActualBlock({
|
|
17
|
+
...item,
|
|
18
|
+
options: { ...item.options, ...mutatedOptionsForBlock }
|
|
19
|
+
});
|
|
20
|
+
if (!mappedItem) continue;
|
|
21
|
+
const callbackResult = callback(mappedItem);
|
|
22
|
+
if (callbackResult === null || callbackResult === void 0) {
|
|
23
|
+
continue;
|
|
24
|
+
} else if (callbackResult.include) {
|
|
25
|
+
matches.push(mappedItem);
|
|
26
|
+
}
|
|
27
|
+
if (callbackResult.continueChildren === false) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const nestedFieldMapping = FIELD_MAPPING[mappedItem.bundle];
|
|
31
|
+
if (!nestedFieldMapping) continue;
|
|
32
|
+
if (!mappedItem.props) continue;
|
|
33
|
+
const propNames = Object.keys(nestedFieldMapping);
|
|
34
|
+
for (const propName of propNames) {
|
|
35
|
+
const fieldName = nestedFieldMapping[propName];
|
|
36
|
+
const key = mappedItem.uuid + ":" + fieldName;
|
|
37
|
+
const value = mutatedFieldsMap ? mutatedFieldsMap[key]?.list : mappedItem.props?.[propName];
|
|
38
|
+
if (!value) continue;
|
|
39
|
+
const valueAsArray = Array.isArray(value) ? value : [value];
|
|
40
|
+
walkBlocks(
|
|
41
|
+
matches,
|
|
42
|
+
callback,
|
|
43
|
+
mutatedOptions,
|
|
44
|
+
mutatedFieldsMap,
|
|
45
|
+
valueAsArray
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function useBlokkliHelper() {
|
|
51
|
+
const rootBlocks = inject(
|
|
52
|
+
INJECT_PROVIDER_BLOCKS,
|
|
53
|
+
null
|
|
54
|
+
);
|
|
55
|
+
const editContext = inject(INJECT_EDIT_CONTEXT, null);
|
|
56
|
+
const mutatedOptions = ref({});
|
|
57
|
+
const mutatedFields = inject(
|
|
58
|
+
INJECT_MUTATED_FIELDS_MAP,
|
|
59
|
+
null
|
|
60
|
+
);
|
|
61
|
+
if (editContext?.mutatedOptions) {
|
|
62
|
+
watch(editContext.mutatedOptions, (options) => {
|
|
63
|
+
mutatedOptions.value = options;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function queryBlocks(bundlesOrCallback, providedList) {
|
|
67
|
+
const callback = typeof bundlesOrCallback === "function" ? bundlesOrCallback : (item) => {
|
|
68
|
+
if (bundlesOrCallback.includes(item.bundle)) {
|
|
69
|
+
return {
|
|
70
|
+
include: true,
|
|
71
|
+
continueChildren: true
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
include: false,
|
|
76
|
+
continueChildren: true
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
return computed(() => {
|
|
80
|
+
const matches = [];
|
|
81
|
+
const list = providedList ? providedList : rootBlocks?.value;
|
|
82
|
+
if (!list) {
|
|
83
|
+
console.error(
|
|
84
|
+
"[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."
|
|
85
|
+
);
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
walkBlocks(matches, callback, mutatedOptions.value, mutatedFields, list);
|
|
89
|
+
return matches;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
queryBlocks
|
|
94
|
+
};
|
|
95
|
+
}
|