@blokkli/editor 2.0.0-alpha.17 → 2.0.0-alpha.18
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 +380 -59
- package/dist/modules/drupal/graphql/base/fragment.paragraphsFieldItem.graphql +3 -1
- package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +1 -10
- package/dist/modules/drupal/graphql/mutations/set_paragraph_schedule.graphql +15 -0
- package/dist/modules/drupal/index.mjs +33 -0
- package/dist/modules/drupal/runtime/adapter/index.js +10 -2
- package/dist/runtime/adapter/index.d.ts +21 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +3 -0
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +23 -13
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +20 -44
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +10 -5
- package/dist/runtime/components/BlokkliEditable.vue +13 -13
- package/dist/runtime/components/BlokkliField.vue +3 -0
- package/dist/runtime/components/BlokkliField.vue.d.ts +3 -3
- package/dist/runtime/components/BlokkliItem.vue +1 -1
- package/dist/runtime/components/BlokkliItem.vue.d.ts +4 -2
- package/dist/runtime/components/BlokkliProvider.vue +12 -8
- package/dist/runtime/components/Edit/Actions/index.vue +27 -16
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +26 -10
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +3 -0
- package/dist/runtime/components/Edit/Dialog/index.vue +6 -4
- package/dist/runtime/components/Edit/DraggableList.vue +15 -7
- package/dist/runtime/components/Edit/DraggableList.vue.d.ts +5 -5
- package/dist/runtime/components/Edit/EditProvider.vue +29 -16
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +1 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +9 -11
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +9 -6
- package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue +1 -1
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -11
- package/dist/runtime/components/Edit/Features/Anchors/Renderer.vue +19 -102
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +3 -0
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +28 -52
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue +154 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue.d.ts +27 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +222 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +96 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +15 -16
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +51 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/{Group → Item}/index.vue.d.ts +9 -13
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +46 -66
- package/dist/runtime/components/Edit/Features/Comments/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +4 -7
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Debug/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Delete/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +13 -5
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +14 -11
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +30 -18
- package/dist/runtime/components/Edit/Features/Duplicate/index.vue +6 -8
- package/dist/runtime/components/Edit/Features/Edit/index.vue +15 -21
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +7 -6
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +8 -3
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +29 -12
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +40 -42
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +11 -9
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue +16 -25
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +5 -7
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/Library/index.vue +27 -23
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +6 -3
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +15 -12
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +7 -6
- package/dist/runtime/components/Edit/Features/Options/index.vue +6 -6
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +68 -15
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +15 -15
- package/dist/runtime/components/Edit/Features/Search/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +3 -3
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +34 -11
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +21 -20
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +3 -3
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Selection/index.vue +61 -27
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +13 -6
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +3 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +2 -27
- package/dist/runtime/components/Edit/Features/Translations/index.vue +7 -7
- package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/index.vue +17 -7
- package/dist/runtime/components/Edit/Form/Toggle/index.vue +4 -3
- package/dist/runtime/components/Edit/Form/Toggle/index.vue.d.ts +12 -2
- package/dist/runtime/components/Edit/InfoBox/index.vue +6 -2
- package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +12 -2
- package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue → ScheduleDate/index.vue} +6 -58
- package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue.d.ts → ScheduleDate/index.vue.d.ts} +11 -1
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +3 -0
- package/dist/runtime/components/Edit/Transition/Height.vue +95 -0
- package/dist/runtime/components/Edit/Transition/Height.vue.d.ts +36 -0
- package/dist/runtime/components/Edit/index.d.ts +3 -1
- package/dist/runtime/components/Edit/index.js +5 -1
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.d.ts +2 -1
- package/dist/runtime/helpers/animationProvider.js +6 -2
- package/dist/runtime/helpers/composables/useStateBasedCache.d.ts +4 -0
- package/dist/runtime/helpers/composables/useStateBasedCache.js +13 -0
- package/dist/runtime/helpers/definitionProvider.d.ts +1 -1
- package/dist/runtime/helpers/dom/index.d.ts +1 -1
- package/dist/runtime/helpers/domProvider.d.ts +10 -16
- package/dist/runtime/helpers/domProvider.js +80 -135
- package/dist/runtime/helpers/index.d.ts +1 -8
- package/dist/runtime/helpers/index.js +1 -84
- package/dist/runtime/helpers/providers/blocks.d.ts +10 -0
- package/dist/runtime/helpers/providers/blocks.js +91 -0
- package/dist/runtime/helpers/providers/directive.d.ts +24 -0
- package/dist/runtime/helpers/{editableProvider.js → providers/directive.js} +90 -29
- package/dist/runtime/helpers/providers/element.d.ts +6 -0
- package/dist/runtime/helpers/providers/element.js +35 -0
- package/dist/runtime/helpers/providers/fields.d.ts +8 -0
- package/dist/runtime/helpers/providers/fields.js +47 -0
- package/dist/runtime/helpers/selectionProvider.d.ts +11 -11
- package/dist/runtime/helpers/selectionProvider.js +38 -45
- package/dist/runtime/helpers/stateProvider.d.ts +1 -0
- package/dist/runtime/helpers/stateProvider.js +21 -15
- package/dist/runtime/helpers/themeProvider.d.ts +2 -1
- package/dist/runtime/helpers/themeProvider.js +24 -14
- package/dist/runtime/helpers/typesProvider.js +10 -26
- package/dist/runtime/helpers/uiProvider.d.ts +3 -2
- package/dist/runtime/helpers/uiProvider.js +11 -15
- package/dist/runtime/icons/calendar.svg +1 -0
- package/dist/runtime/icons/clock.svg +1 -0
- package/dist/runtime/icons/comment_add.svg +1 -5
- package/dist/runtime/icons/delete.svg +1 -8
- package/dist/runtime/icons/duplicate.svg +1 -12
- package/dist/runtime/icons/edit.svg +1 -8
- package/dist/runtime/icons/reusable.svg +1 -5
- package/dist/runtime/plugins/{blokkliEditable.js → blokkliDirectives.js} +14 -20
- package/dist/runtime/types/index.d.ts +55 -36
- package/package.json +1 -1
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +0 -63
- package/dist/runtime/helpers/editableProvider.d.ts +0 -14
- /package/dist/runtime/plugins/{blokkliEditable.d.ts → blokkliDirectives.d.ts} +0 -0
|
@@ -33,16 +33,17 @@ import { renderCycle } from "#blokkli/helpers/renderCycle";
|
|
|
33
33
|
import { getFieldKey } from "#blokkli/helpers";
|
|
34
34
|
import { isInternalBundle } from "#blokkli/helpers/bundles";
|
|
35
35
|
import Renderer from "./Renderer/index.vue";
|
|
36
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
36
37
|
const props = defineProps({
|
|
37
|
-
|
|
38
|
+
items: { type: Array, required: true }
|
|
38
39
|
});
|
|
39
|
-
const { dom, state, eventBus, types, $t } = useBlokkli();
|
|
40
|
+
const { dom, state, eventBus, types, $t, blocks, fields } = useBlokkli();
|
|
40
41
|
const shouldRender = computed(() => {
|
|
41
|
-
return props.
|
|
42
|
+
return props.items.length === 1;
|
|
42
43
|
});
|
|
43
44
|
const block = computed(() => {
|
|
44
|
-
if (props.
|
|
45
|
-
return props.
|
|
45
|
+
if (props.items.length === 1) {
|
|
46
|
+
return props.items[0] ?? null;
|
|
46
47
|
}
|
|
47
48
|
return null;
|
|
48
49
|
});
|
|
@@ -54,7 +55,7 @@ const emptyBlockFields = computed(() => {
|
|
|
54
55
|
return [];
|
|
55
56
|
}
|
|
56
57
|
const uuid2 = block.value.uuid;
|
|
57
|
-
return types.fieldConfig.forEntityTypeAndBundle(
|
|
58
|
+
return types.fieldConfig.forEntityTypeAndBundle(itemEntityType, block.value.bundle).map((field) => {
|
|
58
59
|
const key = getFieldKey(uuid2, field.name);
|
|
59
60
|
const count = state.getFieldBlockCount(key);
|
|
60
61
|
return {
|
|
@@ -74,17 +75,17 @@ const bundleLabel = computed(() => {
|
|
|
74
75
|
if (!block.value) {
|
|
75
76
|
return "";
|
|
76
77
|
}
|
|
77
|
-
return types.getBlockBundleDefinition(block.value.
|
|
78
|
+
return types.getBlockBundleDefinition(block.value.bundle)?.label || block.value.bundle;
|
|
78
79
|
});
|
|
79
80
|
const allowedBundlesForField = computed(() => {
|
|
80
81
|
if (!block.value) {
|
|
81
82
|
return [];
|
|
82
83
|
}
|
|
83
|
-
const blockData =
|
|
84
|
+
const blockData = blocks.getBlock(block.value.uuid);
|
|
84
85
|
if (!blockData) {
|
|
85
86
|
return [];
|
|
86
87
|
}
|
|
87
|
-
const field =
|
|
88
|
+
const field = fields.find(blockData.host.uuid, blockData.host.fieldName);
|
|
88
89
|
if (!field) {
|
|
89
90
|
return [];
|
|
90
91
|
}
|
|
@@ -122,9 +123,9 @@ const fieldTooltips = computed(() => {
|
|
|
122
123
|
return [];
|
|
123
124
|
}
|
|
124
125
|
return emptyBlockFields.value.map((field) => {
|
|
125
|
-
const fieldConfig = types.fieldConfig.forEntityTypeAndBundle(
|
|
126
|
+
const fieldConfig = types.fieldConfig.forEntityTypeAndBundle(itemEntityType, block.value.bundle).find((f) => f.name === field.name);
|
|
126
127
|
const fieldLabel = fieldConfig?.label || field.name;
|
|
127
|
-
const fieldElement =
|
|
128
|
+
const fieldElement = fields.find(block.value.uuid, field.name);
|
|
128
129
|
if (fieldElement) {
|
|
129
130
|
const allowedBundles = fieldElement.allowedBundles.filter(
|
|
130
131
|
(bundle) => !isInternalBundle(bundle)
|
|
@@ -146,8 +147,8 @@ const fieldTooltips = computed(() => {
|
|
|
146
147
|
).replace("@parentBundle", bundleLabel.value).replace("@fieldLabel", fieldLabel);
|
|
147
148
|
});
|
|
148
149
|
});
|
|
149
|
-
watch(emptyBlockFields, (
|
|
150
|
-
const neededCount =
|
|
150
|
+
watch(emptyBlockFields, (fields2) => {
|
|
151
|
+
const neededCount = fields2.length;
|
|
151
152
|
while (fieldButtonSlots.value.length < neededCount) {
|
|
152
153
|
fieldButtonSlots.value.push({ fieldKey: void 0 });
|
|
153
154
|
}
|
|
@@ -156,8 +157,8 @@ watch(emptyBlockFields, (fields) => {
|
|
|
156
157
|
if (!slot) {
|
|
157
158
|
continue;
|
|
158
159
|
}
|
|
159
|
-
if (i <
|
|
160
|
-
const field =
|
|
160
|
+
if (i < fields2.length) {
|
|
161
|
+
const field = fields2[i];
|
|
161
162
|
slot.fieldKey = field?.key;
|
|
162
163
|
} else {
|
|
163
164
|
slot.fieldKey = void 0;
|
|
@@ -200,11 +201,11 @@ function clearAllCache() {
|
|
|
200
201
|
function updateCache(uuid2) {
|
|
201
202
|
let cachedState = cache.get(uuid2);
|
|
202
203
|
if (!cachedState) {
|
|
203
|
-
const block2 =
|
|
204
|
+
const block2 = blocks.getBlock(uuid2);
|
|
204
205
|
if (!block2) {
|
|
205
206
|
return;
|
|
206
207
|
}
|
|
207
|
-
const field =
|
|
208
|
+
const field = fields.find(block2.host.uuid, block2.host.fieldName);
|
|
208
209
|
if (!field) {
|
|
209
210
|
return;
|
|
210
211
|
}
|
|
@@ -341,11 +342,11 @@ function onRendererToggle(data) {
|
|
|
341
342
|
if (!cachedState) {
|
|
342
343
|
return;
|
|
343
344
|
}
|
|
344
|
-
const block2 =
|
|
345
|
+
const block2 = blocks.getBlock(uuid.value);
|
|
345
346
|
if (!block2) {
|
|
346
347
|
return;
|
|
347
348
|
}
|
|
348
|
-
const field =
|
|
349
|
+
const field = fields.find(block2.host.uuid, block2.host.fieldName);
|
|
349
350
|
if (!field) {
|
|
350
351
|
return;
|
|
351
352
|
}
|
|
@@ -375,7 +376,7 @@ function onRendererToggleField(data) {
|
|
|
375
376
|
if (!emptyField) {
|
|
376
377
|
return;
|
|
377
378
|
}
|
|
378
|
-
const field =
|
|
379
|
+
const field = fields.find(uuid.value, emptyField.name);
|
|
379
380
|
if (!field) {
|
|
380
381
|
return;
|
|
381
382
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RenderedFieldListItem } from '#blokkli/types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
3
|
+
items: RenderedFieldListItem[];
|
|
4
4
|
};
|
|
5
5
|
declare const _default: 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>;
|
|
6
6
|
export default _default;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RenderedFieldListItem } from '#blokkli/types';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<{
|
|
3
|
-
blocks:
|
|
3
|
+
blocks: RenderedFieldListItem[];
|
|
4
4
|
gl: WebGLRenderingContext;
|
|
5
5
|
hasHostSelected: boolean;
|
|
6
6
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
7
|
-
blocks:
|
|
7
|
+
blocks: RenderedFieldListItem[];
|
|
8
8
|
gl: WebGLRenderingContext;
|
|
9
9
|
hasHostSelected: boolean;
|
|
10
10
|
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -22,11 +22,11 @@ import { useBlokkli, computed } from "#imports";
|
|
|
22
22
|
const props = defineProps({
|
|
23
23
|
uuids: { type: Array, required: true }
|
|
24
24
|
});
|
|
25
|
-
const { ui, dom } = useBlokkli();
|
|
25
|
+
const { ui, dom, blocks } = useBlokkli();
|
|
26
26
|
const artboard = ui.artboardElement();
|
|
27
27
|
const items = computed(() => {
|
|
28
28
|
return props.uuids.map((uuid) => {
|
|
29
|
-
const block =
|
|
29
|
+
const block = blocks.getBlock(uuid);
|
|
30
30
|
if (!block) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Overlay
|
|
3
3
|
v-if="isVisible && gl && animation.webglEnabled.value"
|
|
4
|
-
:blocks="selection.
|
|
4
|
+
:blocks="selection.items.value"
|
|
5
5
|
:uuids="selection.uuids.value"
|
|
6
6
|
:gl="gl"
|
|
7
7
|
:has-host-selected="selection.hasHostSelected.value"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<SelectionAddButtons
|
|
22
22
|
v-if="state.editMode.value === 'editing'"
|
|
23
|
-
:
|
|
23
|
+
:items="selection.items.value"
|
|
24
24
|
/>
|
|
25
25
|
</template>
|
|
26
26
|
|
|
@@ -32,9 +32,11 @@ import {
|
|
|
32
32
|
calculateIntersection,
|
|
33
33
|
getBounds,
|
|
34
34
|
intersects,
|
|
35
|
+
modulo,
|
|
35
36
|
originatesFromTextInput
|
|
36
37
|
} from "#blokkli/helpers";
|
|
37
38
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
39
|
+
import useStateBasedCache from "#blokkli/helpers/composables/useStateBasedCache";
|
|
38
40
|
import { PluginItemDropdown } from "#blokkli/plugins";
|
|
39
41
|
import {
|
|
40
42
|
computed,
|
|
@@ -43,26 +45,39 @@ import {
|
|
|
43
45
|
ref,
|
|
44
46
|
watch
|
|
45
47
|
} from "#imports";
|
|
48
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
46
49
|
defineBlokkliFeature({
|
|
47
50
|
id: "selection",
|
|
48
51
|
icon: "selection",
|
|
49
52
|
label: "Selection",
|
|
50
53
|
description: "Renders an overlay that highlights the selected blocks."
|
|
51
54
|
});
|
|
52
|
-
const {
|
|
55
|
+
const {
|
|
56
|
+
selection,
|
|
57
|
+
ui,
|
|
58
|
+
eventBus,
|
|
59
|
+
animation,
|
|
60
|
+
dom,
|
|
61
|
+
tour,
|
|
62
|
+
$t,
|
|
63
|
+
types,
|
|
64
|
+
state,
|
|
65
|
+
blocks,
|
|
66
|
+
element
|
|
67
|
+
} = useBlokkli();
|
|
68
|
+
const getSelectionOrder = useStateBasedCache(() => {
|
|
69
|
+
return element.queryAll(
|
|
70
|
+
ui.artboardElement(),
|
|
71
|
+
"[data-uuid]",
|
|
72
|
+
"getSelectionOrder",
|
|
73
|
+
(el) => el.dataset.uuid
|
|
74
|
+
);
|
|
75
|
+
});
|
|
53
76
|
const selectedBundle = computed(() => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const block = selection.blocks.value[i];
|
|
57
|
-
if (!block) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
if (bundle && bundle !== block.itemBundle) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
bundle = block.itemBundle;
|
|
77
|
+
if (selection.bundles.value.length === 1) {
|
|
78
|
+
return selection.bundles.value[0] ?? null;
|
|
64
79
|
}
|
|
65
|
-
return
|
|
80
|
+
return null;
|
|
66
81
|
});
|
|
67
82
|
const itemDropdownEnabled = computed(() => true);
|
|
68
83
|
const itemDropdownItems = computed(() => {
|
|
@@ -135,10 +150,10 @@ const findMostVisibleBlock = () => {
|
|
|
135
150
|
};
|
|
136
151
|
const getSelectAllUuids = (allBlocks, currentlySelected) => {
|
|
137
152
|
if (currentlySelected.length >= 1) {
|
|
138
|
-
const selectedHostUuids = currentlySelected.map((block) => block.
|
|
139
|
-
const selectedHostTypes = currentlySelected.map((block) => block.
|
|
153
|
+
const selectedHostUuids = currentlySelected.map((block) => block.host.uuid);
|
|
154
|
+
const selectedHostTypes = currentlySelected.map((block) => block.host.type);
|
|
140
155
|
const selectedHostFieldNames = currentlySelected.map(
|
|
141
|
-
(block) => block.
|
|
156
|
+
(block) => block.host.fieldName
|
|
142
157
|
);
|
|
143
158
|
const selectedUuids = currentlySelected.map((v) => v.uuid);
|
|
144
159
|
const commonHostUuids = selectedHostUuids.filter(
|
|
@@ -151,14 +166,14 @@ const getSelectAllUuids = (allBlocks, currentlySelected) => {
|
|
|
151
166
|
(fieldName, index, self) => self.indexOf(fieldName) === index
|
|
152
167
|
);
|
|
153
168
|
const newUuids = allBlocks.filter(
|
|
154
|
-
(block) => commonHostUuids.includes(block.
|
|
169
|
+
(block) => commonHostUuids.includes(block.host.uuid) && commonHostTypes.includes(block.host.type) && commonHostFieldNames.includes(block.host.fieldName)
|
|
155
170
|
).map((block) => block.uuid);
|
|
156
171
|
const isSame = newUuids.every((uuid) => selectedUuids.includes(uuid));
|
|
157
172
|
if (!isSame) {
|
|
158
173
|
return newUuids;
|
|
159
174
|
}
|
|
160
175
|
}
|
|
161
|
-
return allBlocks.filter((block) => block.
|
|
176
|
+
return allBlocks.filter((block) => block.host.type !== itemEntityType).map((block) => block.uuid);
|
|
162
177
|
};
|
|
163
178
|
const visuallySelectBlocks = (toggleUuid) => {
|
|
164
179
|
const rects = dom.getBlockRects();
|
|
@@ -167,12 +182,12 @@ const visuallySelectBlocks = (toggleUuid) => {
|
|
|
167
182
|
if (selected.length === 0) {
|
|
168
183
|
return [toggleUuid];
|
|
169
184
|
}
|
|
170
|
-
const singleSelectedBlock = selected.length === 1 ?
|
|
185
|
+
const singleSelectedBlock = selected.length === 1 ? blocks.getBlock(selected[0]) : null;
|
|
171
186
|
const toggleRect = rects[toggleUuid];
|
|
172
187
|
if (!toggleRect) {
|
|
173
188
|
return;
|
|
174
189
|
}
|
|
175
|
-
const toggleBlock =
|
|
190
|
+
const toggleBlock = blocks.getBlock(toggleUuid);
|
|
176
191
|
if (!toggleBlock) {
|
|
177
192
|
return;
|
|
178
193
|
}
|
|
@@ -187,7 +202,7 @@ const visuallySelectBlocks = (toggleUuid) => {
|
|
|
187
202
|
if (!intersects(rect, encompassingRect2)) {
|
|
188
203
|
continue;
|
|
189
204
|
}
|
|
190
|
-
const block =
|
|
205
|
+
const block = blocks.getBlock(uuid);
|
|
191
206
|
if (!block) {
|
|
192
207
|
continue;
|
|
193
208
|
}
|
|
@@ -231,7 +246,7 @@ const visuallySelectBlocks = (toggleUuid) => {
|
|
|
231
246
|
function selectAllBlocks() {
|
|
232
247
|
eventBus.emit(
|
|
233
248
|
"select:end",
|
|
234
|
-
getSelectAllUuids(
|
|
249
|
+
getSelectAllUuids(blocks.getAllBlocks(), selection.items.value)
|
|
235
250
|
);
|
|
236
251
|
}
|
|
237
252
|
onBlokkliEvent("select:shiftToggle", (uuid) => {
|
|
@@ -240,8 +255,27 @@ onBlokkliEvent("select:shiftToggle", (uuid) => {
|
|
|
240
255
|
eventBus.emit("select", uuids);
|
|
241
256
|
}
|
|
242
257
|
});
|
|
258
|
+
function selectBlock(uuid) {
|
|
259
|
+
eventBus.emit("select", uuid);
|
|
260
|
+
dom.refreshBlockRect(uuid);
|
|
261
|
+
eventBus.emit("scrollIntoView", { uuid });
|
|
262
|
+
}
|
|
263
|
+
function selectInList(prev) {
|
|
264
|
+
const currentUuid = selection.uuids.value[selection.uuids.value.length - 1];
|
|
265
|
+
if (!currentUuid) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const selectionOrder = getSelectionOrder();
|
|
269
|
+
const currentIndex = selectionOrder.indexOf(currentUuid);
|
|
270
|
+
const delta = prev ? -1 : 1;
|
|
271
|
+
const newIndex = modulo(currentIndex + delta, selectionOrder.length);
|
|
272
|
+
const newUuid = selectionOrder[newIndex];
|
|
273
|
+
if (newUuid) {
|
|
274
|
+
selectBlock(newUuid);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
243
277
|
onBlokkliEvent("keyPressed", (e) => {
|
|
244
|
-
if (selection.isDragging.value || selection.isMultiSelecting.value) {
|
|
278
|
+
if (selection.isDragging.value || selection.isMultiSelecting.value || ui.hasDialogOpen.value || ui.hasTooltipOpen.value) {
|
|
245
279
|
return;
|
|
246
280
|
}
|
|
247
281
|
if (e.code === "Escape") {
|
|
@@ -254,7 +288,7 @@ onBlokkliEvent("keyPressed", (e) => {
|
|
|
254
288
|
return;
|
|
255
289
|
}
|
|
256
290
|
e.originalEvent.preventDefault();
|
|
257
|
-
if (selection.
|
|
291
|
+
if (!selection.items.value.length) {
|
|
258
292
|
const uuid = findMostVisibleBlock();
|
|
259
293
|
if (uuid) {
|
|
260
294
|
eventBus.emit("select", uuid);
|
|
@@ -263,9 +297,9 @@ onBlokkliEvent("keyPressed", (e) => {
|
|
|
263
297
|
return;
|
|
264
298
|
}
|
|
265
299
|
if (e.shift) {
|
|
266
|
-
|
|
300
|
+
selectInList(true);
|
|
267
301
|
} else {
|
|
268
|
-
|
|
302
|
+
selectInList();
|
|
269
303
|
}
|
|
270
304
|
animation.requestDraw();
|
|
271
305
|
} else if (e.code === "a" && e.meta) {
|
|
@@ -75,14 +75,14 @@ const targetStyle = computed(() => {
|
|
|
75
75
|
zIndex: 50 + props.level
|
|
76
76
|
};
|
|
77
77
|
});
|
|
78
|
-
const { types, state, selection,
|
|
78
|
+
const { types, state, selection, eventBus, fields } = useBlokkli();
|
|
79
79
|
const mutatedField = computed(
|
|
80
80
|
() => state.getMutatedField(props.entityUuid, props.name)
|
|
81
81
|
);
|
|
82
82
|
const list = computed(() => mutatedField.value?.list || []);
|
|
83
83
|
const key = computed(() => props.entityUuid + ":" + props.name);
|
|
84
84
|
function onMouseUp(preceedingUuid) {
|
|
85
|
-
const field =
|
|
85
|
+
const field = fields.find(props.entityUuid, props.name);
|
|
86
86
|
if (!field) {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
@@ -33,14 +33,18 @@ const props = defineProps({
|
|
|
33
33
|
isVisible: { type: Boolean, required: true },
|
|
34
34
|
isSelectedFromParent: { type: Boolean, required: false }
|
|
35
35
|
});
|
|
36
|
+
const { runtimeConfig, types, selection, eventBus, state, element } = useBlokkli();
|
|
36
37
|
function getRootEl() {
|
|
37
|
-
const rootEl =
|
|
38
|
+
const rootEl = element.query(
|
|
39
|
+
document.documentElement,
|
|
40
|
+
"#bk-structure",
|
|
41
|
+
"Get root structure element."
|
|
42
|
+
);
|
|
38
43
|
if (!(rootEl instanceof HTMLElement)) {
|
|
39
44
|
throw new TypeError("Failed to locate root structure element.");
|
|
40
45
|
}
|
|
41
46
|
return rootEl;
|
|
42
47
|
}
|
|
43
|
-
const { runtimeConfig, types, selection, eventBus, state } = useBlokkli();
|
|
44
48
|
const canMove = computed(() => state.editMode.value === "editing");
|
|
45
49
|
const isSelected = computed(() => selection.uuids.value.includes(props.uuid));
|
|
46
50
|
const type = computed(() => types.getBlockBundleDefinition(props.bundle));
|
|
@@ -66,15 +70,18 @@ function onMouseUp(e) {
|
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
function buildDraggableItems() {
|
|
69
|
-
return selection.
|
|
70
|
-
const el =
|
|
73
|
+
return selection.items.value.map((block) => {
|
|
74
|
+
const el = element.query(
|
|
75
|
+
document.documentElement,
|
|
76
|
+
`[bk-structure-uuid="${block.uuid}"]`,
|
|
77
|
+
"Get structure item for draggable item."
|
|
78
|
+
);
|
|
71
79
|
if (!(el instanceof HTMLElement)) {
|
|
72
80
|
return null;
|
|
73
81
|
}
|
|
74
82
|
return {
|
|
75
83
|
itemType: "existing_structure",
|
|
76
|
-
|
|
77
|
-
itemBundle: block.itemBundle,
|
|
84
|
+
block,
|
|
78
85
|
element: function() {
|
|
79
86
|
return el;
|
|
80
87
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<PluginItemDropdown
|
|
3
3
|
id="transform"
|
|
4
4
|
:title="$t('transformTo', 'Actions')"
|
|
5
|
-
:enabled="!!
|
|
5
|
+
:enabled="!!possibleTransforms.length"
|
|
6
6
|
:items="possibleTransforms"
|
|
7
7
|
icon="script"
|
|
8
8
|
weight="100"
|
|
@@ -43,7 +43,6 @@ import {
|
|
|
43
43
|
useLazyAsyncData
|
|
44
44
|
} from "#imports";
|
|
45
45
|
import { PluginItemDropdown } from "#blokkli/plugins";
|
|
46
|
-
import { onlyUnique } from "#blokkli/helpers";
|
|
47
46
|
import { BlokkliTransition } from "#blokkli/components";
|
|
48
47
|
import { filterTransforms } from "#blokkli/helpers/transform";
|
|
49
48
|
import defineCommands from "#blokkli/helpers/composables/defineCommands";
|
|
@@ -200,14 +199,11 @@ async function onTransformHost(plugin, values) {
|
|
|
200
199
|
);
|
|
201
200
|
ui.setTransform();
|
|
202
201
|
}
|
|
203
|
-
const itemBundleIds = computed(
|
|
204
|
-
() => selection.blocks.value.map((v) => v.itemBundle).filter(onlyUnique)
|
|
205
|
-
);
|
|
206
202
|
const possibleTransforms = computed(
|
|
207
203
|
() => filterTransforms(
|
|
208
204
|
plugins.value || [],
|
|
209
205
|
selection.uuids.value,
|
|
210
|
-
|
|
206
|
+
selection.bundles.value,
|
|
211
207
|
types.allowedTypesInList.value
|
|
212
208
|
)
|
|
213
209
|
);
|
|
@@ -222,27 +218,6 @@ defineCommands(
|
|
|
222
218
|
}
|
|
223
219
|
}))
|
|
224
220
|
);
|
|
225
|
-
const getPossibleDropTransforms = (plugins2, allBlocks, dragItems) => {
|
|
226
|
-
const notDraggedBlocks = allBlocks.filter(
|
|
227
|
-
(block) => !dragItems.find((dragItem) => dragItem.uuid === block.uuid)
|
|
228
|
-
);
|
|
229
|
-
const validPlugins = plugins2.filter((plugin) => {
|
|
230
|
-
const draggedBundles = dragItems.map((item) => item.itemBundle);
|
|
231
|
-
return draggedBundles.every((bundle) => plugin.bundles.includes(bundle)) && dragItems.length + 1 >= plugin.min && (plugin.max === -1 || dragItems.length + 1 <= plugin.max);
|
|
232
|
-
});
|
|
233
|
-
const possibleTransforms2 = [];
|
|
234
|
-
validPlugins.forEach((plugin) => {
|
|
235
|
-
notDraggedBlocks.forEach((block) => {
|
|
236
|
-
if (!plugin.targetBundles || plugin.targetBundles.includes(block.itemBundle)) {
|
|
237
|
-
possibleTransforms2.push({
|
|
238
|
-
plugin,
|
|
239
|
-
block
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
return possibleTransforms2;
|
|
245
|
-
};
|
|
246
221
|
</script>
|
|
247
222
|
|
|
248
223
|
<script>
|
|
@@ -134,22 +134,22 @@ const items = computed(() => {
|
|
|
134
134
|
}).filter(falsy);
|
|
135
135
|
});
|
|
136
136
|
const canTranslateBlock = computed(() => {
|
|
137
|
-
|
|
137
|
+
const block = selection.item.value;
|
|
138
|
+
if (!block) {
|
|
138
139
|
return false;
|
|
139
140
|
}
|
|
140
|
-
|
|
141
|
-
if (block.libraryItemUuid) {
|
|
141
|
+
if (block.library?.libraryItemUuid) {
|
|
142
142
|
return false;
|
|
143
143
|
}
|
|
144
144
|
const definition = definitions.getBlockDefinition(
|
|
145
|
-
block.
|
|
146
|
-
block.
|
|
145
|
+
block.bundle,
|
|
146
|
+
block.fieldListType,
|
|
147
147
|
block.parentBlockBundle
|
|
148
148
|
);
|
|
149
149
|
if (definition?.editor?.disableEdit) {
|
|
150
150
|
return false;
|
|
151
151
|
}
|
|
152
|
-
const type = types.getBlockBundleDefinition(block.
|
|
152
|
+
const type = types.getBlockBundleDefinition(block.bundle);
|
|
153
153
|
if (!type) {
|
|
154
154
|
return false;
|
|
155
155
|
}
|
|
@@ -172,7 +172,7 @@ function onTranslate(items2) {
|
|
|
172
172
|
if (item) {
|
|
173
173
|
eventBus.emit("item:edit", {
|
|
174
174
|
uuid: item.uuid,
|
|
175
|
-
bundle: item.
|
|
175
|
+
bundle: item.bundle
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button class="bk-validation-item" @click.prevent="onClick">
|
|
3
3
|
<div v-if="block" class="bk-validation-item-header">
|
|
4
|
-
<ItemIcon :bundle="block.
|
|
4
|
+
<ItemIcon :bundle="block.bundle" />
|
|
5
5
|
<div>{{ itemBundle?.label }}</div>
|
|
6
6
|
</div>
|
|
7
7
|
<div v-html="message" />
|
|
@@ -18,19 +18,19 @@ const props = defineProps({
|
|
|
18
18
|
entityType: { type: String, required: false },
|
|
19
19
|
entityUuid: { type: String, required: false }
|
|
20
20
|
});
|
|
21
|
-
const { runtimeConfig, eventBus,
|
|
21
|
+
const { runtimeConfig, eventBus, types, blocks } = useBlokkli();
|
|
22
22
|
const isBlock = computed(
|
|
23
23
|
() => props.entityType === runtimeConfig.itemEntityType
|
|
24
24
|
);
|
|
25
25
|
const block = computed(() => {
|
|
26
26
|
if (isBlock.value && props.entityUuid) {
|
|
27
|
-
return
|
|
27
|
+
return blocks.getBlock(props.entityUuid);
|
|
28
28
|
}
|
|
29
29
|
return null;
|
|
30
30
|
});
|
|
31
31
|
const itemBundle = computed(() => {
|
|
32
|
-
if (block.value?.
|
|
33
|
-
return types.getBlockBundleDefinition(block.value.
|
|
32
|
+
if (block.value?.bundle) {
|
|
33
|
+
return types.getBlockBundleDefinition(block.value.bundle);
|
|
34
34
|
}
|
|
35
35
|
return null;
|
|
36
36
|
});
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import {
|
|
11
11
|
featureComponents
|
|
12
12
|
} from "#blokkli-build/features";
|
|
13
|
-
import { useBlokkli,
|
|
13
|
+
import { useBlokkli, computed, watch } from "#imports";
|
|
14
14
|
const emit = defineEmits(["loaded"]);
|
|
15
15
|
const { adapter, features, ui, debug } = useBlokkli();
|
|
16
16
|
const logger = debug.createLogger("Features");
|
|
@@ -37,12 +37,22 @@ const availableFeatures = computed(() => {
|
|
|
37
37
|
return v.id;
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const hasLoadedFeatures = computed(
|
|
41
|
+
() => renderedFeatures.value.length === availableFeatures.value.length
|
|
42
|
+
);
|
|
43
|
+
const unwatchInit = watch(
|
|
44
|
+
hasLoadedFeatures,
|
|
45
|
+
(hasLoaded) => {
|
|
46
|
+
if (hasLoaded) {
|
|
47
|
+
emit("loaded");
|
|
48
|
+
logger.log("Features loaded", renderedFeatures.value);
|
|
49
|
+
unwatchInit();
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
immediate: true
|
|
54
|
+
}
|
|
55
|
+
);
|
|
46
56
|
</script>
|
|
47
57
|
|
|
48
58
|
<script>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<label class="bk-checkbox-toggle">
|
|
3
|
+
<slot />
|
|
3
4
|
<input v-model="value" type="checkbox" class="peer" :disabled />
|
|
4
5
|
<div class="bk-checkbox-toggle-toggle" />
|
|
5
|
-
<div class="bk-checkbox-toggle-label">
|
|
6
|
-
<div>{{ label }}</div>
|
|
6
|
+
<div v-if="label || description" class="bk-checkbox-toggle-label">
|
|
7
|
+
<div v-if="label">{{ label }}</div>
|
|
7
8
|
<div v-if="description">
|
|
8
9
|
{{ description }}
|
|
9
10
|
</div>
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
|
|
14
15
|
<script setup>
|
|
15
16
|
defineProps({
|
|
16
|
-
label: { type: String, required:
|
|
17
|
+
label: { type: String, required: false },
|
|
17
18
|
description: { type: String, required: false },
|
|
18
19
|
disabled: { type: Boolean, required: false }
|
|
19
20
|
});
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
-
label
|
|
2
|
+
label?: string;
|
|
3
3
|
description?: string;
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
};
|
|
6
6
|
type __VLS_PublicProps = __VLS_Props & {
|
|
7
7
|
modelValue?: boolean;
|
|
8
8
|
};
|
|
9
|
-
declare
|
|
9
|
+
declare var __VLS_1: {};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
default?: (props: typeof __VLS_1) => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
14
|
"update:modelValue": (value: boolean | undefined) => any;
|
|
11
15
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
16
|
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
13
17
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
14
19
|
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="bk-info-box">
|
|
3
3
|
<Icon name="info" />
|
|
4
|
-
<
|
|
4
|
+
<div>
|
|
5
|
+
<slot>
|
|
6
|
+
<p v-html="text" />
|
|
7
|
+
</slot>
|
|
8
|
+
</div>
|
|
5
9
|
</div>
|
|
6
10
|
</template>
|
|
7
11
|
|
|
8
12
|
<script setup>
|
|
9
13
|
import { Icon } from "#blokkli/components";
|
|
10
14
|
defineProps({
|
|
11
|
-
text: { type: String, required:
|
|
15
|
+
text: { type: String, required: false }
|
|
12
16
|
});
|
|
13
17
|
</script>
|