@blokkli/editor 1.3.4 → 1.4.0-alpha.1
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 +71 -2
- package/dist/module.d.ts +71 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +315 -123
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +1 -1
- package/dist/runtime/components/Blocks/Fragment/index.vue +7 -4
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +8 -5
- package/dist/runtime/components/BlokkliField.vue +2 -2
- package/dist/runtime/components/BlokkliItem.vue +2 -2
- package/dist/runtime/components/Edit/Actions/index.vue +1 -1
- package/dist/runtime/components/Edit/AddListItem/index.vue +1 -1
- package/dist/runtime/components/Edit/AppMenu/index.vue +1 -1
- package/dist/runtime/components/Edit/BlockProxy/index.vue +5 -21
- package/dist/runtime/components/Edit/Dialog/index.vue +1 -1
- package/dist/runtime/components/Edit/DraggableList.vue +2 -2
- package/dist/runtime/components/Edit/EditIndicator.vue +2 -2
- package/dist/runtime/components/Edit/EditProvider.vue +5 -8
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +9 -8
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Debug/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Edit/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +38 -32
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +13 -6
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +65 -67
- package/dist/runtime/components/Edit/Features/Library/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +1 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +3 -11
- package/dist/runtime/components/Edit/Features/MediaLibrary/types.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +28 -3
- package/dist/runtime/components/Edit/Features/Options/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Publish/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Theme/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Translations/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/index.vue +1 -1
- package/dist/runtime/components/Edit/FormOverlay/Header/index.vue +1 -1
- package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Icon/index.vue +2 -2
- package/dist/runtime/components/Edit/ItemIcon/index.vue +1 -1
- package/dist/runtime/components/Edit/Pagination/index.vue +21 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +2 -2
- package/dist/runtime/components/Edit/ScaleToFit/index.vue +37 -6
- package/dist/runtime/components/Edit/index.d.ts +2 -1
- package/dist/runtime/components/Edit/index.js +3 -1
- package/dist/runtime/composables/defineBlokkli.d.ts +2 -2
- package/dist/runtime/composables/defineBlokkli.js +19 -55
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
- package/dist/runtime/composables/defineBlokkliFeature.js +1 -1
- package/dist/runtime/composables/defineBlokkliFragment.d.ts +1 -1
- package/dist/runtime/composables/defineBlokkliFragment.js +3 -30
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/domProvider.d.ts +0 -4
- package/dist/runtime/helpers/domProvider.js +63 -67
- package/dist/runtime/helpers/featuresProvider.d.ts +1 -1
- package/dist/runtime/helpers/featuresProvider.js +1 -1
- package/dist/runtime/helpers/index.d.ts +1 -0
- package/dist/runtime/helpers/index.js +7 -1
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +23 -2
- package/dist/runtime/helpers/runtimeHelpers/index.js +83 -10
- package/dist/runtime/helpers/storageProvider.js +1 -1
- package/dist/runtime/helpers/textProvider.js +2 -2
- package/dist/runtime/helpers/themeProvider.js +1 -1
- package/dist/runtime/types/index.d.ts +7 -4
- package/package.json +2 -2
- package/dist/runtime/helpers/options.d.ts +0 -2
- package/dist/runtime/helpers/options.js +0 -21
|
@@ -4,23 +4,14 @@ import {
|
|
|
4
4
|
INJECT_FIELD_LIST_BLOCKS,
|
|
5
5
|
INJECT_FIELD_LIST_TYPE,
|
|
6
6
|
INJECT_REUSABLE_OPTIONS,
|
|
7
|
-
INJECT_PROVIDER_BLOCKS
|
|
8
|
-
INJECT_FIELD_USES_PROXY
|
|
7
|
+
INJECT_PROVIDER_BLOCKS
|
|
9
8
|
} from "../helpers/symbols.js";
|
|
10
|
-
import {
|
|
11
|
-
computed,
|
|
12
|
-
inject,
|
|
13
|
-
getCurrentInstance,
|
|
14
|
-
onMounted,
|
|
15
|
-
onBeforeUnmount
|
|
16
|
-
} from "#imports";
|
|
17
|
-
import { globalOptionsDefaults } from "#blokkli/default-global-options";
|
|
9
|
+
import { computed, inject } from "#imports";
|
|
18
10
|
import { getRuntimeOptionValue } from "#blokkli/helpers/runtimeHelpers";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
];
|
|
11
|
+
import { BLOCK_OPTIONS } from "#blokkli-build/runtime-options";
|
|
12
|
+
export function defineBlokkli(arg) {
|
|
13
|
+
const config = arg;
|
|
14
|
+
const bundle = config.bundle;
|
|
24
15
|
const fieldListType = inject(
|
|
25
16
|
INJECT_FIELD_LIST_TYPE,
|
|
26
17
|
computed(() => "default")
|
|
@@ -45,67 +36,40 @@ export function defineBlokkli(config) {
|
|
|
45
36
|
null
|
|
46
37
|
);
|
|
47
38
|
const editContext = inject(INJECT_EDIT_CONTEXT, null);
|
|
39
|
+
const runtimeOptionDefinitions = BLOCK_OPTIONS[bundle] || {};
|
|
48
40
|
const options = computed(() => {
|
|
49
|
-
if (
|
|
41
|
+
if (bundle === "from_library" || bundle === "blokkli_fragment") {
|
|
50
42
|
return {
|
|
51
43
|
...item?.value.options || {},
|
|
52
44
|
...editContext?.mutatedOptions[uuid] || {}
|
|
53
45
|
};
|
|
54
46
|
}
|
|
55
|
-
const result =
|
|
47
|
+
const result = Object.entries(runtimeOptionDefinitions).reduce((acc, [key, definition]) => {
|
|
56
48
|
if (editContext) {
|
|
57
49
|
const overrideOptions = editContext.mutatedOptions[uuid] || {};
|
|
58
|
-
if (overrideOptions[key] !== void 0) {
|
|
59
|
-
acc[key] = overrideOptions[key];
|
|
50
|
+
if (overrideOptions[key] !== void 0 && overrideOptions[key] !== null) {
|
|
51
|
+
acc[key] = getRuntimeOptionValue(definition, overrideOptions[key]);
|
|
60
52
|
return acc;
|
|
61
53
|
}
|
|
62
54
|
}
|
|
63
|
-
if (fromLibraryOptions && fromLibraryOptions.value[key] !== void 0) {
|
|
64
|
-
acc[key] =
|
|
55
|
+
if (fromLibraryOptions && fromLibraryOptions.value[key] !== void 0 && fromLibraryOptions.value[key] !== null) {
|
|
56
|
+
acc[key] = getRuntimeOptionValue(
|
|
57
|
+
definition,
|
|
58
|
+
fromLibraryOptions.value[key]
|
|
59
|
+
);
|
|
65
60
|
return acc;
|
|
66
61
|
}
|
|
67
|
-
if (item?.value.options && item.value.options[key] !== void 0) {
|
|
68
|
-
acc[key] = item.value.options[key];
|
|
62
|
+
if (item?.value.options && item.value.options[key] !== void 0 && item.value.options[key] !== null) {
|
|
63
|
+
acc[key] = getRuntimeOptionValue(definition, item.value.options[key]);
|
|
69
64
|
return acc;
|
|
70
65
|
}
|
|
66
|
+
acc[key] = definition[1];
|
|
71
67
|
return acc;
|
|
72
68
|
}, {});
|
|
73
|
-
optionKeys.forEach((key) => {
|
|
74
|
-
const definition = config.options?.[key] || globalOptionsDefaults[key];
|
|
75
|
-
if (!definition) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const value = result[key] === void 0 || result[key] === null ? definition.default : result[key];
|
|
79
|
-
result[key] = getRuntimeOptionValue(definition, value);
|
|
80
|
-
});
|
|
81
69
|
return result;
|
|
82
70
|
});
|
|
83
71
|
const parentType = computed(() => item?.value.parentType);
|
|
84
72
|
const isEditing = !!item?.value.isEditing;
|
|
85
|
-
const fieldUsesProxy = inject(INJECT_FIELD_USES_PROXY, false);
|
|
86
|
-
onMounted(() => {
|
|
87
|
-
if (
|
|
88
|
-
// If the field uses proxy mode we don't want to register the block here.
|
|
89
|
-
fieldUsesProxy || !item?.value || !isEditing || !editContext || !editContext.dom || // Block is already registered by the from_library block.
|
|
90
|
-
fromLibraryOptions || // The defineBlokkliFragment composable registers the block itself.
|
|
91
|
-
config.bundle === "blokkli_fragment"
|
|
92
|
-
) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const instance = getCurrentInstance();
|
|
96
|
-
editContext.dom.registerBlock(
|
|
97
|
-
uuid,
|
|
98
|
-
instance,
|
|
99
|
-
config.bundle,
|
|
100
|
-
fieldListType.value,
|
|
101
|
-
item.value.parentType
|
|
102
|
-
);
|
|
103
|
-
});
|
|
104
|
-
onBeforeUnmount(() => {
|
|
105
|
-
if (!fieldUsesProxy && isEditing && editContext && editContext.dom && uuid && config.bundle !== "blokkli_fragment") {
|
|
106
|
-
editContext.dom.unregisterBlock(uuid);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
73
|
return {
|
|
110
74
|
uuid,
|
|
111
75
|
index,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComputedRef } from '#imports';
|
|
2
2
|
import type { BlokkliAdapter, AdapterMethods } from '#blokkli/adapter';
|
|
3
3
|
import type { FeatureDefinition } from '#blokkli/types';
|
|
4
|
-
import type { ValidFeatureKey } from '#blokkli-
|
|
4
|
+
import type { ValidFeatureKey } from '#blokkli-build/features';
|
|
5
5
|
import type { DebugLogger } from '#blokkli/helpers/debugProvider';
|
|
6
6
|
type SettingType<S> = S extends {
|
|
7
7
|
type: 'checkbox';
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
onUnmounted,
|
|
6
6
|
provide
|
|
7
7
|
} from "#imports";
|
|
8
|
-
import { settingsOverride } from "#blokkli/config";
|
|
8
|
+
import { settingsOverride } from "#blokkli-build/config";
|
|
9
9
|
import { INJECT_EDIT_LOGGER } from "#blokkli/helpers/symbols";
|
|
10
10
|
export function defineBlokkliFeature(feature) {
|
|
11
11
|
const { adapter, storage, features, debug } = useBlokkli();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BlockDefinitionOptionsInput, DefineBlokkliContext, FragmentDefinitionInput } from '#blokkli/types';
|
|
2
|
-
import type { GlobalOptionsKey } from '#blokkli/generated-types';
|
|
2
|
+
import type { GlobalOptionsKey } from '#blokkli-build/generated-types';
|
|
3
3
|
export declare function defineBlokkliFragment<T extends BlockDefinitionOptionsInput = BlockDefinitionOptionsInput, G extends GlobalOptionsKey[] | undefined = undefined>(config: FragmentDefinitionInput<T, G>): DefineBlokkliContext<T, G>;
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
INJECT_EDIT_CONTEXT,
|
|
3
|
-
INJECT_FRAGMENT_CONTEXT
|
|
4
|
-
} from "../helpers/symbols.js";
|
|
1
|
+
import { INJECT_FRAGMENT_CONTEXT } from "../helpers/symbols.js";
|
|
5
2
|
import { getRuntimeOptionValue } from "../helpers/runtimeHelpers/index.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
getCurrentInstance,
|
|
9
|
-
inject,
|
|
10
|
-
onBeforeUnmount,
|
|
11
|
-
onMounted
|
|
12
|
-
} from "#imports";
|
|
13
|
-
import { globalOptionsDefaults } from "#blokkli/default-global-options";
|
|
3
|
+
import { computed, inject } from "#imports";
|
|
4
|
+
import { globalOptionsDefaults } from "#blokkli-build/default-global-options";
|
|
14
5
|
export function defineBlokkliFragment(config) {
|
|
15
6
|
const ctx = inject(
|
|
16
7
|
INJECT_FRAGMENT_CONTEXT,
|
|
17
8
|
null
|
|
18
9
|
);
|
|
19
|
-
const editContext = inject(INJECT_EDIT_CONTEXT, null);
|
|
20
10
|
const optionKeys = [
|
|
21
11
|
...Object.keys(config.options || {}),
|
|
22
12
|
...config.globalOptions || []
|
|
@@ -36,22 +26,5 @@ export function defineBlokkliFragment(config) {
|
|
|
36
26
|
});
|
|
37
27
|
return result;
|
|
38
28
|
});
|
|
39
|
-
onMounted(() => {
|
|
40
|
-
if (editContext && editContext.dom && ctx) {
|
|
41
|
-
const instance = getCurrentInstance();
|
|
42
|
-
editContext.dom.registerBlock(
|
|
43
|
-
ctx.uuid,
|
|
44
|
-
instance,
|
|
45
|
-
"blokkli_fragment",
|
|
46
|
-
ctx.fieldListType.value,
|
|
47
|
-
ctx.parentType.value
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
onBeforeUnmount(() => {
|
|
52
|
-
if (editContext && ctx && ctx.uuid && editContext.dom) {
|
|
53
|
-
editContext.dom.unregisterBlock(ctx.uuid);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
29
|
return { ...ctx, options };
|
|
57
30
|
}
|