@blokkli/editor 2.0.0-alpha.23 → 2.0.0-alpha.24
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 +62 -66
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +1 -1
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +5 -1
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +2 -0
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +22 -13
- package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +1 -0
- package/dist/runtime/blokkliPlugins/index.d.ts +1 -3
- package/dist/runtime/blokkliPlugins/index.js +0 -4
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Actions/ItemDropdown.vue +1 -1
- package/dist/runtime/components/Edit/Actions/index.vue +77 -72
- package/dist/runtime/components/Edit/AddListItem/index.vue +8 -29
- package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +2 -3
- package/dist/runtime/components/Edit/AppMenu/MenuButton.vue +39 -0
- package/dist/runtime/{blokkliPlugins/MenuButton/index.vue.d.ts → components/Edit/AppMenu/MenuButton.vue.d.ts} +0 -4
- package/dist/runtime/components/Edit/AppMenu/index.vue +62 -40
- package/dist/runtime/components/Edit/Dialog/index.vue +26 -5
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/EditProvider.vue +48 -31
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +52 -0
- package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/AddList/Actions/index.vue +41 -0
- package/dist/runtime/components/Edit/Features/AddList/Actions/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue +11 -47
- package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +68 -123
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +41 -20
- package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +2 -28
- package/dist/runtime/components/Edit/Features/Assistant/index.vue +18 -14
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +52 -18
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +0 -2
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue.d.ts +6 -4
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +77 -27
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +7 -4
- package/dist/runtime/components/Edit/Features/Comments/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue +113 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/DragItem.vue.d.ts +25 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +8 -97
- package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/fragment.glsl +2 -5
- package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/index.vue +38 -5
- package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/vertex.glsl +10 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +1 -2
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Exit/index.vue +12 -9
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +27 -31
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +25 -24
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Library/index.vue +26 -24
- package/dist/runtime/components/Edit/Features/MultiSelect/Renderer/index.vue +1 -3
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Publish/index.vue +17 -15
- package/dist/runtime/components/Edit/Features/Revert/index.vue +24 -18
- package/dist/runtime/components/Edit/Features/Search/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +21 -17
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +6 -6
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +3 -6
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Settings/index.vue +25 -17
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Tour/index.vue +12 -10
- package/dist/runtime/components/Edit/Features/Transform/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -17
- package/dist/runtime/components/Edit/FormOverlay/index.vue +13 -4
- package/dist/runtime/components/Edit/ItemIconBox/index.vue +41 -0
- package/dist/runtime/components/Edit/{AddListItemIcon → ItemIconBox}/index.vue.d.ts +5 -5
- package/dist/runtime/components/Edit/Konami/Game/index.vue +0 -1
- package/dist/runtime/components/Edit/Konami/index.vue +3 -5
- package/dist/runtime/components/Edit/Messages/Item/index.vue +11 -2
- package/dist/runtime/components/Edit/Messages/index.vue +6 -1
- package/dist/runtime/components/Edit/Overlay/index.vue +66 -0
- package/dist/runtime/components/Edit/Overlay/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +36 -36
- package/dist/runtime/components/Edit/Toolbar/index.vue +47 -48
- package/dist/runtime/components/Edit/index.d.ts +2 -2
- package/dist/runtime/components/Edit/index.js +2 -2
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/composables/defineAddAction.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineAddAction.js +10 -0
- package/dist/runtime/helpers/composables/defineItemDropdownAction.js +2 -2
- package/dist/runtime/helpers/composables/defineMenuButton.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineMenuButton.js +10 -0
- package/dist/runtime/helpers/composables/useDialog.d.ts +3 -0
- package/dist/runtime/helpers/composables/useDialog.js +16 -0
- package/dist/runtime/helpers/defineElementStyle.d.ts +2 -0
- package/dist/runtime/helpers/defineElementStyle.js +33 -0
- package/dist/runtime/helpers/domProvider.d.ts +1 -0
- package/dist/runtime/helpers/domProvider.js +7 -2
- package/dist/runtime/helpers/dropTargets/index.d.ts +1 -1
- package/dist/runtime/helpers/dropTargets/index.js +17 -3
- package/dist/runtime/helpers/pluginProvider.d.ts +25 -6
- package/dist/runtime/helpers/pluginProvider.js +48 -46
- package/dist/runtime/helpers/providers/blocks.js +10 -0
- package/dist/runtime/helpers/providers/fields.d.ts +9 -1
- package/dist/runtime/helpers/uiProvider.d.ts +9 -12
- package/dist/runtime/helpers/uiProvider.js +85 -83
- package/dist/runtime/icons/click.svg +1 -0
- package/dist/runtime/types/index.d.ts +12 -5
- package/package.json +1 -1
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +0 -96
- package/dist/runtime/blokkliPlugins/AddAction/index.vue.d.ts +0 -26
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +0 -68
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue +0 -19
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
v-show="type.isVisible"
|
|
6
6
|
:id="type.id"
|
|
7
7
|
:key="i + (type.id || 'undefined') + renderKey"
|
|
8
|
+
context="add-list-blocks"
|
|
8
9
|
:label="type.label"
|
|
9
10
|
:bundle="type.id"
|
|
10
|
-
:orientation="ui.addListOrientation.value"
|
|
11
11
|
:disabled="type.isDisabled"
|
|
12
12
|
:color="type.isFavorite ? 'yellow' : 'default'"
|
|
13
13
|
data-element-type="new"
|
|
14
14
|
:data-item-bundle="type.id"
|
|
15
15
|
/>
|
|
16
16
|
</Sortli>
|
|
17
|
+
|
|
17
18
|
<PluginTourItem
|
|
18
19
|
v-if="shouldRender"
|
|
19
20
|
id="block-add-list"
|
|
@@ -34,21 +35,22 @@ import { AddListItem, Sortli } from "#blokkli/components";
|
|
|
34
35
|
import defineCommands from "#blokkli/helpers/composables/defineCommands";
|
|
35
36
|
import { isInternalBundle } from "#blokkli/helpers/bundles";
|
|
36
37
|
import { PluginTourItem } from "#blokkli/plugins";
|
|
37
|
-
import { getFieldKey
|
|
38
|
+
import { getFieldKey } from "#blokkli/helpers";
|
|
39
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
38
40
|
const props = defineProps({
|
|
39
|
-
hideDisabledBlocks: { type: Boolean, required: false }
|
|
41
|
+
hideDisabledBlocks: { type: Boolean, required: false },
|
|
42
|
+
selectableBundles: { type: Array, required: true },
|
|
43
|
+
generallyAvailableBundles: { type: Array, required: true }
|
|
40
44
|
});
|
|
41
45
|
const {
|
|
42
46
|
selection,
|
|
43
47
|
storage,
|
|
44
48
|
types,
|
|
45
49
|
context,
|
|
46
|
-
runtimeConfig,
|
|
47
50
|
ui,
|
|
48
51
|
eventBus,
|
|
49
52
|
$t,
|
|
50
53
|
state,
|
|
51
|
-
dom,
|
|
52
54
|
definitions,
|
|
53
55
|
blocks
|
|
54
56
|
} = useBlokkli();
|
|
@@ -65,47 +67,9 @@ function buildItem(element) {
|
|
|
65
67
|
}
|
|
66
68
|
const shouldRender = computed(() => state.editMode.value === "editing");
|
|
67
69
|
const searchText = ref("");
|
|
68
|
-
const itemEntityType = runtimeConfig.itemEntityType;
|
|
69
70
|
const favorites = storage.use("blockFavorites", []);
|
|
70
|
-
const getAllowedTypesForSelected = (p) => {
|
|
71
|
-
if (types.itemBundlesWithNested.includes(p.bundle)) {
|
|
72
|
-
return types.fieldConfig.forEntityTypeAndBundle(itemEntityType, p.bundle).flatMap((v) => v.allowedBundles).filter(Boolean);
|
|
73
|
-
}
|
|
74
|
-
if (p.host.type === itemEntityType) {
|
|
75
|
-
return types.fieldConfig.forEntityTypeAndBundle(itemEntityType, p.host.bundle).flatMap((v) => v.allowedBundles).filter(Boolean);
|
|
76
|
-
} else {
|
|
77
|
-
return types.getFieldConfig(
|
|
78
|
-
context.value.entityType,
|
|
79
|
-
context.value.entityBundle,
|
|
80
|
-
p.host.fieldName
|
|
81
|
-
)?.allowedBundles || [];
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
const bundlesForRenderedFields = computed(() => {
|
|
85
|
-
return dom.registeredFieldTypes.value.flatMap((field) => {
|
|
86
|
-
return types.getFieldConfig(
|
|
87
|
-
field.entityType,
|
|
88
|
-
field.entityBundle,
|
|
89
|
-
field.fieldName
|
|
90
|
-
)?.allowedBundles || [];
|
|
91
|
-
}).filter(onlyUnique);
|
|
92
|
-
});
|
|
93
|
-
const generallyAvailableBundles = computed(
|
|
94
|
-
() => types.generallyAvailableBundles.filter(
|
|
95
|
-
(v) => (
|
|
96
|
-
// Exclude bundles for which no field is currently being rendered.
|
|
97
|
-
bundlesForRenderedFields.value.includes(v.id)
|
|
98
|
-
)
|
|
99
|
-
)
|
|
100
|
-
);
|
|
101
|
-
const selectableBundles = computed(() => {
|
|
102
|
-
if (selection.items.value.length) {
|
|
103
|
-
return selection.items.value.flatMap((v) => getAllowedTypesForSelected(v));
|
|
104
|
-
}
|
|
105
|
-
return generallyAvailableBundles.value.map((v) => v.id || "");
|
|
106
|
-
});
|
|
107
71
|
function determineVisibility(bundle, label) {
|
|
108
|
-
if (ui.isMobile.value && !selectableBundles.
|
|
72
|
+
if (ui.isMobile.value && !props.selectableBundles.includes(bundle)) {
|
|
109
73
|
return false;
|
|
110
74
|
}
|
|
111
75
|
if (searchText.value && !label.toLowerCase().includes(searchText.value.toLowerCase())) {
|
|
@@ -119,9 +83,9 @@ function determineVisibility(bundle, label) {
|
|
|
119
83
|
return true;
|
|
120
84
|
}
|
|
121
85
|
const sortedList = computed(() => {
|
|
122
|
-
return [...generallyAvailableBundles
|
|
86
|
+
return [...props.generallyAvailableBundles].filter((v) => !isInternalBundle(v.id)).map((v) => {
|
|
123
87
|
const isVisible = determineVisibility(v.id, v.label);
|
|
124
|
-
const isDisabled = !v.id || !selectableBundles.
|
|
88
|
+
const isDisabled = !v.id || !props.selectableBundles.includes(v.id);
|
|
125
89
|
return {
|
|
126
90
|
...v,
|
|
127
91
|
isDisabled,
|
|
@@ -252,7 +216,7 @@ const getInsertCommands = (block) => {
|
|
|
252
216
|
});
|
|
253
217
|
}
|
|
254
218
|
);
|
|
255
|
-
if (block.host.type ===
|
|
219
|
+
if (block.host.type === itemEntityType) {
|
|
256
220
|
const parentBlock = blocks.getBlock(block.host.uuid);
|
|
257
221
|
if (parentBlock) {
|
|
258
222
|
getInsertCommands(parentBlock).forEach((parentCommand) => {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import type { BlockBundleDefinition } from '#blokkli/types';
|
|
1
2
|
declare const _default: import("vue").DefineComponent<{
|
|
2
3
|
hideDisabledBlocks?: boolean;
|
|
4
|
+
selectableBundles: string[];
|
|
5
|
+
generallyAvailableBundles: BlockBundleDefinition[];
|
|
3
6
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
4
7
|
hideDisabledBlocks?: boolean;
|
|
8
|
+
selectableBundles: string[];
|
|
9
|
+
generallyAvailableBundles: BlockBundleDefinition[];
|
|
5
10
|
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
11
|
export default _default;
|
|
@@ -1,43 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-if="isSidebar && shouldRender"
|
|
4
|
-
id="add_list"
|
|
5
|
-
:title="sidebarTitle"
|
|
6
|
-
:tour-text="tourText"
|
|
7
|
-
render-always
|
|
8
|
-
icon="plus"
|
|
9
|
-
weight="-10"
|
|
10
|
-
@updated="eventBus.emit('add-list:change')"
|
|
11
|
-
>
|
|
12
|
-
<div>
|
|
13
|
-
<div id="blokkli-add-list-sidebar-before" />
|
|
14
|
-
<div class="bk bk-list-sidebar">
|
|
15
|
-
<AddListBlocks />
|
|
16
|
-
<Sortli id="blokkli-add-list-actions" :build-item="buildItemAction" />
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</PluginSidebar>
|
|
20
|
-
<Teleport v-else-if="shouldRender" to="body">
|
|
2
|
+
<Teleport v-if="shouldRender" :to="ui.mainLayoutElement.value">
|
|
21
3
|
<div
|
|
22
4
|
ref="wrapper"
|
|
23
5
|
class="bk bk-add-list bk-control"
|
|
24
|
-
:class="[
|
|
25
|
-
{ 'bk-is-active': isActive || hasContextMenuOpen },
|
|
26
|
-
'bk-is-' + ui.addListOrientation.value
|
|
27
|
-
]"
|
|
28
|
-
:style="style"
|
|
29
6
|
@wheel.capture.passive="onWheel"
|
|
30
7
|
@mouseenter="onMouseEnter"
|
|
31
8
|
@mouseleave="onMouseLeave"
|
|
32
9
|
>
|
|
33
|
-
<div
|
|
34
|
-
|
|
35
|
-
|
|
10
|
+
<div
|
|
11
|
+
class="bk-add-list-inner"
|
|
12
|
+
:class="{
|
|
13
|
+
'bk-is-active': isActive
|
|
14
|
+
}"
|
|
15
|
+
>
|
|
16
|
+
<AddListBlocks :selectable-bundles :generally-available-bundles />
|
|
17
|
+
<AddListActions :selectable-bundles />
|
|
36
18
|
</div>
|
|
37
19
|
</div>
|
|
38
20
|
<PluginTourItem
|
|
39
21
|
id="add-blocks"
|
|
40
|
-
|
|
22
|
+
:element="wrapper"
|
|
41
23
|
:title="sidebarTitle"
|
|
42
24
|
:text="tourText"
|
|
43
25
|
/>
|
|
@@ -45,45 +27,18 @@
|
|
|
45
27
|
</template>
|
|
46
28
|
|
|
47
29
|
<script setup>
|
|
48
|
-
import {
|
|
49
|
-
|
|
50
|
-
ref,
|
|
51
|
-
computed,
|
|
52
|
-
useBlokkli,
|
|
53
|
-
nextTick,
|
|
54
|
-
defineBlokkliFeature
|
|
55
|
-
} from "#imports";
|
|
56
|
-
import { Sortli } from "#blokkli/components";
|
|
57
|
-
import { PluginSidebar, PluginTourItem } from "#blokkli/plugins";
|
|
58
|
-
import { addElementClasses } from "#blokkli/helpers/addElementClasses";
|
|
30
|
+
import { ref, computed, useBlokkli, defineBlokkliFeature } from "#imports";
|
|
31
|
+
import { PluginTourItem } from "#blokkli/plugins";
|
|
59
32
|
import AddListBlocks from "./Blocks/index.vue";
|
|
60
|
-
|
|
33
|
+
import AddListActions from "./Actions/index.vue";
|
|
34
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
35
|
+
import { onlyUnique } from "#blokkli/helpers";
|
|
36
|
+
defineBlokkliFeature({
|
|
61
37
|
id: "add-list",
|
|
62
38
|
icon: "plus",
|
|
63
39
|
label: "Add List",
|
|
64
40
|
description: "Provides the container to render a list of blocks to add or add actions.",
|
|
65
41
|
settings: {
|
|
66
|
-
orientation: {
|
|
67
|
-
type: "radios",
|
|
68
|
-
label: "Add List",
|
|
69
|
-
default: "vertical",
|
|
70
|
-
group: "appearance",
|
|
71
|
-
viewports: ["desktop"],
|
|
72
|
-
options: {
|
|
73
|
-
vertical: {
|
|
74
|
-
label: "Vertical",
|
|
75
|
-
icon: "ui-list-vertical"
|
|
76
|
-
},
|
|
77
|
-
horizontal: {
|
|
78
|
-
label: "Horizontal",
|
|
79
|
-
icon: "ui-list-horizontal"
|
|
80
|
-
},
|
|
81
|
-
sidebar: {
|
|
82
|
-
label: "Sidebar",
|
|
83
|
-
icon: "ui-list-sidebar"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
42
|
hideDisabledBlocks: {
|
|
88
43
|
type: "checkbox",
|
|
89
44
|
label: "Hide blocks that can't be added",
|
|
@@ -94,71 +49,75 @@ const { settings } = defineBlokkliFeature({
|
|
|
94
49
|
},
|
|
95
50
|
screenshot: "feature-add-list.jpg"
|
|
96
51
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (
|
|
100
|
-
return;
|
|
52
|
+
const { $t, ui, selection, state, tour, types, context, dom } = useBlokkli();
|
|
53
|
+
const getAllowedTypesForSelected = (p) => {
|
|
54
|
+
if (types.itemBundlesWithNested.includes(p.bundle)) {
|
|
55
|
+
return types.fieldConfig.forEntityTypeAndBundle(itemEntityType, p.bundle).flatMap((v) => v.allowedBundles).filter(Boolean);
|
|
101
56
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
57
|
+
if (p.host.type === itemEntityType) {
|
|
58
|
+
return types.fieldConfig.forEntityTypeAndBundle(itemEntityType, p.host.bundle).flatMap((v) => v.allowedBundles).filter(Boolean);
|
|
59
|
+
} else {
|
|
60
|
+
return types.getFieldConfig(
|
|
61
|
+
context.value.entityType,
|
|
62
|
+
context.value.entityBundle,
|
|
63
|
+
p.host.fieldName
|
|
64
|
+
)?.allowedBundles || [];
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const bundlesForRenderedFields = computed(() => {
|
|
68
|
+
return dom.registeredFieldTypes.value.flatMap((field) => {
|
|
69
|
+
return types.getFieldConfig(
|
|
70
|
+
field.entityType,
|
|
71
|
+
field.entityBundle,
|
|
72
|
+
field.fieldName
|
|
73
|
+
)?.allowedBundles || [];
|
|
74
|
+
}).filter(onlyUnique);
|
|
75
|
+
});
|
|
76
|
+
const generallyAvailableBundles = computed(
|
|
77
|
+
() => types.generallyAvailableBundles.filter(
|
|
78
|
+
(v) => (
|
|
79
|
+
// Exclude bundles for which no field is currently being rendered.
|
|
80
|
+
bundlesForRenderedFields.value.includes(v.id)
|
|
81
|
+
)
|
|
82
|
+
)
|
|
113
83
|
);
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
84
|
+
const selectableBundles = computed(() => {
|
|
85
|
+
if (selection.items.value.length) {
|
|
86
|
+
return selection.items.value.flatMap((v) => getAllowedTypesForSelected(v));
|
|
87
|
+
}
|
|
88
|
+
return generallyAvailableBundles.value.map((v) => v.id || "");
|
|
120
89
|
});
|
|
121
|
-
const
|
|
122
|
-
|
|
90
|
+
const shouldRender = computed(
|
|
91
|
+
() => state.canEdit.value && state.editMode.value === "editing"
|
|
92
|
+
);
|
|
93
|
+
const hasContextMenuOpen = computed(
|
|
94
|
+
() => ui.openContextMenu.value.startsWith("add_list_item_add-list-blocks")
|
|
95
|
+
);
|
|
123
96
|
const wrapper = ref(null);
|
|
124
|
-
const
|
|
97
|
+
const isHovered = ref(false);
|
|
125
98
|
let mouseTimeout = null;
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
const widths = element.queryAll(
|
|
129
|
-
wrapper.value,
|
|
130
|
-
".bk-list-item-label span",
|
|
131
|
-
"AddList vertical sidebar style",
|
|
132
|
-
(el) => el.offsetWidth
|
|
133
|
-
);
|
|
134
|
-
const largestWidth = Math.max(...widths);
|
|
135
|
-
return {
|
|
136
|
-
"--bk-add-list-width": largestWidth + 90
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
return void 0;
|
|
99
|
+
const isActive = computed(() => {
|
|
100
|
+
return (isHovered.value || hasContextMenuOpen.value || tour.isTouring.value) && !selection.isDragging.value;
|
|
140
101
|
});
|
|
141
102
|
function onMouseEnter() {
|
|
142
|
-
|
|
103
|
+
if (mouseTimeout) {
|
|
104
|
+
clearTimeout(mouseTimeout);
|
|
105
|
+
isHovered.value = true;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
143
108
|
mouseTimeout = setTimeout(() => {
|
|
144
|
-
|
|
109
|
+
isHovered.value = true;
|
|
145
110
|
}, 200);
|
|
146
111
|
}
|
|
147
112
|
function onMouseLeave() {
|
|
148
113
|
clearTimeout(mouseTimeout);
|
|
149
|
-
|
|
114
|
+
isHovered.value = false;
|
|
150
115
|
}
|
|
151
116
|
const onWheel = (e) => {
|
|
152
117
|
if (e.ctrlKey || e.metaKey) {
|
|
153
118
|
return;
|
|
154
119
|
}
|
|
155
|
-
|
|
156
|
-
e.stopPropagation();
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (ui.addListOrientation.value === "vertical" && e.deltaY) {
|
|
160
|
-
e.stopPropagation();
|
|
161
|
-
}
|
|
120
|
+
e.stopPropagation();
|
|
162
121
|
};
|
|
163
122
|
const sidebarTitle = computed(() => $t("addListSidebarTitle", "Add blocks"));
|
|
164
123
|
const tourText = computed(
|
|
@@ -167,20 +126,6 @@ const tourText = computed(
|
|
|
167
126
|
"<p>This shows the list of available blocks that can be placed. Add a block by dragging the icon into the page.</p><p>When an existing block is selected, some blocks may be greyed out. This indicates which blocks can be placed inside or after the selected block.</p>"
|
|
168
127
|
)
|
|
169
128
|
);
|
|
170
|
-
addElementClasses(
|
|
171
|
-
document.documentElement,
|
|
172
|
-
CLASS_BOTTOM,
|
|
173
|
-
computed(
|
|
174
|
-
() => ui.addListOrientation.value === "horizontal" && shouldRender.value
|
|
175
|
-
)
|
|
176
|
-
);
|
|
177
|
-
addElementClasses(
|
|
178
|
-
document.documentElement,
|
|
179
|
-
CLASS_LEFT,
|
|
180
|
-
computed(
|
|
181
|
-
() => ui.addListOrientation.value === "vertical" && shouldRender.value
|
|
182
|
-
)
|
|
183
|
-
);
|
|
184
129
|
</script>
|
|
185
130
|
|
|
186
131
|
<script>
|
|
@@ -38,7 +38,10 @@
|
|
|
38
38
|
key-code="O"
|
|
39
39
|
weight="90"
|
|
40
40
|
>
|
|
41
|
-
<Teleport
|
|
41
|
+
<Teleport
|
|
42
|
+
v-if="isActive && dom.isReady.value"
|
|
43
|
+
:to="ui.mainLayoutElement.value"
|
|
44
|
+
>
|
|
42
45
|
<Overview :artboard="artboard" />
|
|
43
46
|
</Teleport>
|
|
44
47
|
</PluginViewOption>
|
|
@@ -166,45 +169,63 @@ watch(options, function(newOptions) {
|
|
|
166
169
|
const AUTOSCROLL_EDGE_ZONE = 130;
|
|
167
170
|
const AUTOSCROLL_SPEED = 12;
|
|
168
171
|
let autoScrollSpeed = 1;
|
|
172
|
+
let lastScrollDirection = 0;
|
|
169
173
|
function edgeStep(distance) {
|
|
170
174
|
const ratio = distance / AUTOSCROLL_EDGE_ZONE;
|
|
171
175
|
return Math.pow(ratio, 3) * AUTOSCROLL_SPEED;
|
|
172
176
|
}
|
|
173
177
|
let hasLeftAddList = false;
|
|
178
|
+
let hasLeftEdgeZone = false;
|
|
174
179
|
onBlokkliEvent("dragging:end", () => {
|
|
175
180
|
hasLeftAddList = false;
|
|
181
|
+
hasLeftEdgeZone = false;
|
|
182
|
+
autoScrollSpeed = 1;
|
|
183
|
+
lastScrollDirection = 0;
|
|
176
184
|
});
|
|
177
|
-
|
|
185
|
+
function handleAutoScroll(mouseX, mouseY) {
|
|
178
186
|
if (selection.isDragging.value) {
|
|
179
|
-
if (
|
|
180
|
-
if (
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
187
|
+
if (!hasLeftAddList) {
|
|
188
|
+
if (isInsideRect(mouseX, mouseY, ui.visibleViewportPadded.value)) {
|
|
189
|
+
hasLeftAddList = true;
|
|
190
|
+
} else {
|
|
191
|
+
return;
|
|
186
192
|
}
|
|
187
193
|
}
|
|
188
|
-
const viewportHeight = ui.
|
|
194
|
+
const viewportHeight = ui.visibleViewport.value.height;
|
|
189
195
|
const currentOffset = artboard.getOffset();
|
|
190
|
-
const y = Math.min(
|
|
196
|
+
const y = Math.min(
|
|
197
|
+
Math.max(mouseY - ui.visibleViewport.value.y, 0),
|
|
198
|
+
viewportHeight
|
|
199
|
+
);
|
|
200
|
+
const isInEdgeZone = y < AUTOSCROLL_EDGE_ZONE || y > viewportHeight - AUTOSCROLL_EDGE_ZONE;
|
|
201
|
+
if (!isInEdgeZone && !hasLeftEdgeZone) {
|
|
202
|
+
hasLeftEdgeZone = true;
|
|
203
|
+
}
|
|
191
204
|
let dy = 0;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
205
|
+
let currentDirection = 0;
|
|
206
|
+
if (hasLeftEdgeZone && isInEdgeZone) {
|
|
207
|
+
if (y < AUTOSCROLL_EDGE_ZONE) {
|
|
208
|
+
const dist = AUTOSCROLL_EDGE_ZONE - y;
|
|
209
|
+
dy = edgeStep(dist);
|
|
210
|
+
currentDirection = 1;
|
|
211
|
+
} else if (y > viewportHeight - AUTOSCROLL_EDGE_ZONE) {
|
|
212
|
+
const dist = y - (viewportHeight - AUTOSCROLL_EDGE_ZONE);
|
|
213
|
+
dy = -edgeStep(dist);
|
|
214
|
+
currentDirection = -1;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (currentDirection !== 0 && currentDirection !== lastScrollDirection) {
|
|
199
218
|
autoScrollSpeed = 1;
|
|
219
|
+
lastScrollDirection = currentDirection;
|
|
200
220
|
}
|
|
201
221
|
if (dy !== 0) {
|
|
202
222
|
artboard.setOffset(null, currentOffset.y + dy * autoScrollSpeed);
|
|
203
223
|
autoScrollSpeed = Math.min(autoScrollSpeed * 1.01, 2.25);
|
|
204
224
|
}
|
|
205
|
-
} else {
|
|
206
|
-
autoScrollSpeed = 1;
|
|
207
225
|
}
|
|
226
|
+
}
|
|
227
|
+
onBlokkliEvent("animationFrame:before", ({ time, mouseY, mouseX }) => {
|
|
228
|
+
handleAutoScroll(mouseX, mouseY);
|
|
208
229
|
artboard.loop(time);
|
|
209
230
|
const artboardSize = artboard.getArtboardSize();
|
|
210
231
|
if (artboardSize) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Teleport to="
|
|
2
|
+
<Teleport :to="ui.mainLayoutElement.value" defer>
|
|
3
3
|
<div
|
|
4
4
|
class="bk bk-artboard-scrollbar"
|
|
5
5
|
:class="'bk-orientation-' + orientation"
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
<script setup>
|
|
15
15
|
import { scrollbar } from "artboard-deluxe";
|
|
16
|
-
import { onBeforeUnmount, onMounted, ref } from "#imports";
|
|
16
|
+
import { onBeforeUnmount, onMounted, ref, useBlokkli } from "#imports";
|
|
17
17
|
const props = defineProps({
|
|
18
18
|
artboard: { type: Object, required: true },
|
|
19
19
|
orientation: { type: String, required: true }
|
|
20
20
|
});
|
|
21
|
+
const { ui } = useBlokkli();
|
|
21
22
|
const el = ref();
|
|
22
23
|
const thumb = ref();
|
|
23
24
|
let scrollbarPlugin = null;
|
|
@@ -68,37 +68,11 @@ import { useBlokkli, ref } from "#imports";
|
|
|
68
68
|
import ResultMarkup from "./ResultMarkup/index.vue";
|
|
69
69
|
const { $t, adapter } = useBlokkli();
|
|
70
70
|
const emit = defineEmits(["close", "submit"]);
|
|
71
|
-
const prompt = ref(
|
|
72
|
-
`Write content for a page talking about VueJS. Please come up with good titles and content for each section.
|
|
73
|
-
|
|
74
|
-
# Origins
|
|
75
|
-
Write about when Vue was created and by whom.
|
|
76
|
-
|
|
77
|
-
# Release of Vue 2
|
|
78
|
-
When was it released, what were the changes.
|
|
79
|
-
|
|
80
|
-
# Release of Vue 3
|
|
81
|
-
Write about the big changes introduced in Vue 3.
|
|
82
|
-
|
|
83
|
-
# Comparison to React
|
|
84
|
-
`
|
|
85
|
-
);
|
|
71
|
+
const prompt = ref("");
|
|
86
72
|
const isGenerating = ref(false);
|
|
87
73
|
const result = ref({
|
|
88
74
|
type: "markup",
|
|
89
|
-
content:
|
|
90
|
-
<h2>Origins</h2>
|
|
91
|
-
<p>Vue was created in 2014 by Evan You, a former Google engineer. It was initially released to the public in February 2014.</p>
|
|
92
|
-
|
|
93
|
-
<h2>Release of Vue 2</h2>
|
|
94
|
-
<p>Vue 2 was released in September 2016. This release introduced significant improvements in performance and the virtual DOM implementation, making Vue even more efficient and capable.</p>
|
|
95
|
-
|
|
96
|
-
<h2>Release of Vue 3</h2>
|
|
97
|
-
<p>Vue 3, released in September 2020, brought several major changes, including the composition API, better TypeScript integration, and significant improvements in terms of performance, tree-shaking, and the overall developer experience.</p>
|
|
98
|
-
|
|
99
|
-
<h2>Comparison to React</h2>
|
|
100
|
-
<p>Vue is often compared to React due to their shared focus on building user interfaces. While React is developed and maintained by Facebook, Vue is an open-source project led by Evan You. Both frameworks have their strengths and weaknesses, and the choice between them often depends on the specific requirements of a project and the preferences of the development team.</p>
|
|
101
|
-
`
|
|
75
|
+
content: ""
|
|
102
76
|
});
|
|
103
77
|
const onSubmit = () => {
|
|
104
78
|
if (!result.value) {
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Teleport to="
|
|
2
|
+
<Teleport :to="ui.mainLayoutElement.value">
|
|
3
3
|
<BlokkliTransition name="slide-in">
|
|
4
4
|
<Overlay v-if="placedAction" @close="onClose" @submit="onSubmit" />
|
|
5
5
|
</BlokkliTransition>
|
|
6
6
|
</Teleport>
|
|
7
|
-
|
|
8
|
-
<PluginAddAction
|
|
9
|
-
type="assistant"
|
|
10
|
-
:title="$t('assistantAddAction', 'Add with AI Assistant')"
|
|
11
|
-
:description="
|
|
12
|
-
$t('assistantAddActionDescription', 'Add content using an AI assistant.')
|
|
13
|
-
"
|
|
14
|
-
icon="robot"
|
|
15
|
-
color="rose"
|
|
16
|
-
@placed="placedAction = $event"
|
|
17
|
-
/>
|
|
18
7
|
</template>
|
|
19
8
|
|
|
20
9
|
<script setup>
|
|
21
10
|
import { useBlokkli, defineBlokkliFeature, ref } from "#imports";
|
|
22
|
-
import
|
|
11
|
+
import defineAddAction from "#blokkli/helpers/composables/defineAddAction";
|
|
23
12
|
import { BlokkliTransition } from "#blokkli/components";
|
|
24
13
|
import Overlay from "./Overlay/index.vue";
|
|
25
14
|
const { adapter } = defineBlokkliFeature({
|
|
@@ -34,7 +23,7 @@ const { adapter } = defineBlokkliFeature({
|
|
|
34
23
|
screenshot: "feature-assistant.jpg",
|
|
35
24
|
dependencies: ["add-list"]
|
|
36
25
|
});
|
|
37
|
-
const { state, $t } = useBlokkli();
|
|
26
|
+
const { state, $t, ui } = useBlokkli();
|
|
38
27
|
const placedAction = ref(null);
|
|
39
28
|
const onClose = () => {
|
|
40
29
|
placedAction.value = null;
|
|
@@ -52,6 +41,21 @@ const onSubmit = async (result) => {
|
|
|
52
41
|
}
|
|
53
42
|
onClose();
|
|
54
43
|
};
|
|
44
|
+
defineAddAction(() => {
|
|
45
|
+
return {
|
|
46
|
+
id: "assistant",
|
|
47
|
+
title: $t("assistantAddAction", "Add with AI Assistant"),
|
|
48
|
+
description: $t(
|
|
49
|
+
"assistantAddActionDescription",
|
|
50
|
+
"Add content using an AI assistant."
|
|
51
|
+
),
|
|
52
|
+
icon: "robot",
|
|
53
|
+
color: "rose",
|
|
54
|
+
callback: (data) => {
|
|
55
|
+
placedAction.value = data;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
});
|
|
55
59
|
</script>
|
|
56
60
|
|
|
57
61
|
<script>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</div>
|
|
24
24
|
</template>
|
|
25
25
|
</PluginItemAction>
|
|
26
|
-
<Teleport to="
|
|
26
|
+
<Teleport :to="ui.mainLayoutElement.value">
|
|
27
27
|
<BlokkliTransition name="slide-up">
|
|
28
28
|
<SchedulerDialog
|
|
29
29
|
v-if="isVisible"
|
|
@@ -48,7 +48,7 @@ defineBlokkliFeature({
|
|
|
48
48
|
description: "Adds support for scheduling blocks.",
|
|
49
49
|
requiredAdapterMethods: ["setBlockScheduleDate"]
|
|
50
50
|
});
|
|
51
|
-
const { $t, state, selection, types } = useBlokkli();
|
|
51
|
+
const { $t, state, selection, types, ui } = useBlokkli();
|
|
52
52
|
const bundlesWithPublish = computed(
|
|
53
53
|
() => types.generallyAvailableBundles.filter((v) => v.hasPublishOn).map((v) => v.id)
|
|
54
54
|
);
|