@blokkli/editor 2.0.0-alpha.22 → 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 +150 -226
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +20 -14
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue.d.ts +8 -4
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +55 -25
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +5 -4
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +9 -2
- 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/ViewOption/index.vue +3 -1
- package/dist/runtime/blokkliPlugins/index.d.ts +1 -5
- package/dist/runtime/blokkliPlugins/index.js +0 -8
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +0 -5
- package/dist/runtime/components/BlokkliEditable.vue +6 -1
- package/dist/runtime/components/BlokkliField.vue +1 -1
- package/dist/runtime/components/BlokkliProvider.vue +4 -4
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Actions/ItemDropdown.vue +66 -0
- package/dist/runtime/components/Edit/Actions/ItemDropdown.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Actions/index.vue +80 -117
- 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/AnimationCanvas/index.vue +23 -68
- 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/BlockProxy/index.vue +2 -8
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +33 -49
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue.d.ts +14 -1
- package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +93 -0
- package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue.d.ts +12 -0
- 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/DraggableList.vue +5 -25
- package/dist/runtime/components/Edit/EditProvider.vue +71 -41
- 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/{Selection/OverlayFallback → AddList/Actions}/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/{BlockAddList → AddList/Blocks}/index.vue +36 -108
- package/dist/runtime/components/Edit/Features/{Hover/Overlay → AddList/Blocks}/index.vue.d.ts +7 -2
- package/dist/runtime/components/Edit/Features/AddList/index.vue +76 -110
- package/dist/runtime/components/Edit/Features/Analyze/{Renderer.vue → Main.vue} +4 -8
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/fragment.glsl +10 -6
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/index.vue +43 -15
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/index.vue.d.ts +0 -2
- package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/vertex.glsl +11 -9
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -3
- package/dist/runtime/components/Edit/Features/Analyze/index.vue +7 -3
- package/dist/runtime/components/Edit/Features/Anchors/index.vue +2 -2
- 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 +22 -11
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +70 -29
- 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/Conversions/index.vue +16 -9
- package/dist/runtime/components/Edit/Features/Debug/DebugSection.vue +24 -0
- package/dist/runtime/components/Edit/Features/Debug/DebugSection.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/Features/Debug/Main.vue +80 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Features.vue +34 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Icons.vue +15 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Icons.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Keyboard.vue +17 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Keyboard.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue +66 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Rendering.vue +96 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Rendering.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Selection.vue +25 -0
- package/dist/runtime/components/Edit/Features/Debug/Section/Selection.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/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 +23 -119
- package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/fragment.glsl +77 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/index.vue +138 -92
- package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/vertex.glsl +60 -8
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +4 -5
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +0 -6
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +8 -4
- package/dist/runtime/components/Edit/Features/Exit/index.vue +12 -9
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +1 -5
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +27 -31
- package/dist/runtime/components/Edit/Features/Hover/Renderer/fragment.glsl +141 -0
- package/dist/runtime/components/Edit/Features/Hover/{Overlay → Renderer}/index.vue +225 -38
- package/dist/runtime/components/Edit/Features/Hover/Renderer/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Hover/{Overlay → Renderer}/vertex.glsl +49 -11
- package/dist/runtime/components/Edit/Features/Hover/index.vue +9 -6
- 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/LibraryDialog/Item/index.vue +1 -5
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Library/index.vue +50 -36
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +1 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +26 -13
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +3 -47
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/fragment.glsl +13 -26
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue +131 -75
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/vertex.glsl +27 -2
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +25 -12
- package/dist/runtime/components/Edit/Features/Ownership/index.vue +2 -2
- 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/ResponsivePreview/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Revert/index.vue +24 -18
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +23 -6
- 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/Renderer/fragment.glsl +19 -17
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +242 -131
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +29 -12
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +15 -10
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/fragment.glsl +23 -14
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/index.vue +121 -28
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/index.vue.d.ts +0 -2
- package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/vertex.glsl +23 -14
- package/dist/runtime/components/Edit/Features/Selection/index.vue +46 -59
- 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/Dialog/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/Transform/index.vue +30 -23
- package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -17
- package/dist/runtime/components/Edit/Form/Checkboxes/index.vue +43 -0
- package/dist/runtime/components/Edit/Form/Checkboxes/index.vue.d.ts +20 -0
- 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/Item/index.vue.d.ts +1 -1
- 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/PreviewProvider.vue +1 -1
- package/dist/runtime/components/Edit/Sortli/index.vue +5 -8
- package/dist/runtime/components/Edit/Sortli/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 -51
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue +9 -2
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue.d.ts +4 -1
- package/dist/runtime/components/Edit/index.d.ts +7 -5
- package/dist/runtime/components/Edit/index.js +13 -9
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.d.ts +58 -9
- package/dist/runtime/helpers/animationProvider.js +318 -75
- 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.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineItemDropdownAction.js +10 -0
- package/dist/runtime/helpers/composables/defineMenuButton.d.ts +2 -0
- package/dist/runtime/helpers/composables/defineMenuButton.js +10 -0
- package/dist/runtime/helpers/composables/defineRenderer.d.ts +5 -2
- package/dist/runtime/helpers/composables/defineRenderer.js +3 -2
- package/dist/runtime/helpers/composables/useDialog.d.ts +3 -0
- package/dist/runtime/helpers/composables/useDialog.js +16 -0
- package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +16 -0
- package/dist/runtime/helpers/composables/useGlobalBlokkliObject.js +36 -0
- package/dist/runtime/helpers/debugProvider.d.ts +13 -3
- package/dist/runtime/helpers/debugProvider.js +80 -12
- 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 +51 -32
- package/dist/runtime/helpers/dropTargets/index.d.ts +1 -1
- package/dist/runtime/helpers/dropTargets/index.js +18 -4
- package/dist/runtime/helpers/eventBus.d.ts +1 -1
- package/dist/runtime/helpers/index.d.ts +1 -6
- package/dist/runtime/helpers/index.js +0 -81
- package/dist/runtime/helpers/pluginProvider.d.ts +38 -3
- package/dist/runtime/helpers/pluginProvider.js +49 -18
- package/dist/runtime/helpers/providers/blocks.js +10 -0
- package/dist/runtime/helpers/providers/directive.d.ts +4 -1
- package/dist/runtime/helpers/providers/directive.js +9 -2
- package/dist/runtime/helpers/providers/fields.d.ts +9 -1
- package/dist/runtime/helpers/stateProvider.js +1 -0
- package/dist/runtime/helpers/uiProvider.d.ts +13 -12
- package/dist/runtime/helpers/uiProvider.js +117 -81
- package/dist/runtime/helpers/webgl/index.d.ts +2 -3
- package/dist/runtime/helpers/webgl/index.js +9 -14
- package/dist/runtime/icons/click.svg +1 -0
- package/dist/runtime/icons/dock-left.svg +1 -0
- package/dist/runtime/icons/dock-right.svg +1 -0
- package/dist/runtime/icons/dock-window.svg +1 -0
- package/dist/runtime/plugins/blokkliDirectives.js +1 -1
- package/dist/runtime/types/index.d.ts +16 -26
- 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/DroppableEdit/index.vue +0 -56
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue.d.ts +0 -24
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +0 -76
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +0 -31
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +0 -66
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue +0 -19
- package/dist/runtime/components/Edit/Features/BlockAddList/docs.md +0 -15
- package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +0 -240
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +0 -96
- package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +0 -139
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +0 -42
- /package/dist/runtime/components/Edit/Features/Analyze/{Renderer.vue.d.ts → Main.vue.d.ts} +0 -0
- /package/dist/runtime/components/Edit/Features/Anchors/{Renderer.vue → Overlay/index.vue} +0 -0
- /package/dist/runtime/components/Edit/Features/{BlockAddList → Anchors/Overlay}/index.vue.d.ts +0 -0
- /package/dist/runtime/components/Edit/Features/Debug/{Renderer.vue.d.ts → Main.vue.d.ts} +0 -0
- /package/dist/runtime/components/Edit/Features/{Anchors/Renderer.vue.d.ts → Debug/Section/Features.vue.d.ts} +0 -0
- /package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/index.vue.d.ts +0 -0
- /package/dist/runtime/components/Edit/Features/Ownership/{Renderer.vue → Banner/index.vue} +0 -0
- /package/dist/runtime/components/Edit/Features/Ownership/{Renderer.vue.d.ts → Banner/index.vue.d.ts} +0 -0
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-if="state.mutatedFields.value.length"
|
|
4
|
-
id="import_existing"
|
|
5
|
-
:title="$t('importExistingTitle', 'Import...')"
|
|
6
|
-
:description="
|
|
7
|
-
$t('importExistingDescription', 'Import from an existing page')
|
|
8
|
-
"
|
|
9
|
-
:disabled="state.editMode.value !== 'editing'"
|
|
10
|
-
:weight="50"
|
|
11
|
-
icon="import"
|
|
12
|
-
@click="showModal = true"
|
|
13
|
-
/>
|
|
14
|
-
|
|
15
|
-
<Teleport to="body">
|
|
2
|
+
<Teleport :to="ui.mainLayoutElement.value">
|
|
16
3
|
<BlokkliTransition name="slide-up">
|
|
17
4
|
<ExistingDialog
|
|
18
5
|
v-if="showModal"
|
|
@@ -24,16 +11,11 @@
|
|
|
24
11
|
</template>
|
|
25
12
|
|
|
26
13
|
<script setup>
|
|
27
|
-
import {
|
|
28
|
-
ref,
|
|
29
|
-
computed,
|
|
30
|
-
useBlokkli,
|
|
31
|
-
onMounted,
|
|
32
|
-
defineBlokkliFeature
|
|
33
|
-
} from "#imports";
|
|
34
|
-
import { PluginMenuButton } from "#blokkli/plugins";
|
|
14
|
+
import { computed, useBlokkli, onMounted, defineBlokkliFeature } from "#imports";
|
|
35
15
|
import { BlokkliTransition } from "#blokkli/components";
|
|
36
16
|
import ExistingDialog from "./Dialog/index.vue";
|
|
17
|
+
import defineMenuButton from "#blokkli/helpers/composables/defineMenuButton";
|
|
18
|
+
import { useDialog } from "#blokkli/helpers/composables/useDialog";
|
|
37
19
|
const { adapter, settings } = defineBlokkliFeature({
|
|
38
20
|
id: "import-existing",
|
|
39
21
|
label: "Import existing content",
|
|
@@ -50,11 +32,11 @@ const { adapter, settings } = defineBlokkliFeature({
|
|
|
50
32
|
}
|
|
51
33
|
}
|
|
52
34
|
});
|
|
53
|
-
const { state, $t } = useBlokkli();
|
|
35
|
+
const { ui, state, $t } = useBlokkli();
|
|
54
36
|
const isEmpty = computed(
|
|
55
37
|
() => !state.mutatedFields.value.find((v) => v.list?.length)
|
|
56
38
|
);
|
|
57
|
-
const showModal =
|
|
39
|
+
const showModal = useDialog("import-existing", "center");
|
|
58
40
|
function onSubmit(sourceUuid, sourceFields) {
|
|
59
41
|
showModal.value = false;
|
|
60
42
|
state.mutateWithLoadingState(
|
|
@@ -71,6 +53,25 @@ onMounted(() => {
|
|
|
71
53
|
showModal.value = true;
|
|
72
54
|
}
|
|
73
55
|
});
|
|
56
|
+
defineMenuButton(() => {
|
|
57
|
+
if (!state.mutatedFields.value.length) {
|
|
58
|
+
return void 0;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
id: "import_existing",
|
|
62
|
+
title: $t("importExistingTitle", "Import..."),
|
|
63
|
+
description: $t(
|
|
64
|
+
"importExistingDescription",
|
|
65
|
+
"Import from an existing page"
|
|
66
|
+
),
|
|
67
|
+
icon: "import",
|
|
68
|
+
disabled: state.editMode.value !== "editing",
|
|
69
|
+
weight: 50,
|
|
70
|
+
callback: () => {
|
|
71
|
+
showModal.value = true;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
});
|
|
74
75
|
</script>
|
|
75
76
|
|
|
76
77
|
<script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Teleport to="
|
|
2
|
+
<Teleport :to="ui.mainLayoutElement.value">
|
|
3
3
|
<Loading v-if="isLoading" />
|
|
4
4
|
<Transition name="bk-library-edit-header">
|
|
5
5
|
<header v-show="isLoaded" class="bk bk-library-edit-overlay-header">
|
|
@@ -46,7 +46,7 @@ const props = defineProps({
|
|
|
46
46
|
uuid: { type: String, required: true },
|
|
47
47
|
label: { type: String, required: false }
|
|
48
48
|
});
|
|
49
|
-
const { $t, element } = useBlokkli();
|
|
49
|
+
const { $t, element, ui } = useBlokkli();
|
|
50
50
|
const DURATION = 530;
|
|
51
51
|
const emit = defineEmits(["submit", "close"]);
|
|
52
52
|
function getOriginatingElement() {
|
|
@@ -21,11 +21,7 @@
|
|
|
21
21
|
:class="backgroundClass"
|
|
22
22
|
>
|
|
23
23
|
<ScaleToFit :width="previewWidth" :max-height="400">
|
|
24
|
-
<BlokkliItem
|
|
25
|
-
v-bind="item"
|
|
26
|
-
parent-type="nested"
|
|
27
|
-
class="bk-drop-element"
|
|
28
|
-
/>
|
|
24
|
+
<BlokkliItem v-bind="item" parent-type="nested" />
|
|
29
25
|
</ScaleToFit>
|
|
30
26
|
</div>
|
|
31
27
|
</div>
|
|
@@ -20,26 +20,7 @@
|
|
|
20
20
|
@click="showReusableDialog = true"
|
|
21
21
|
/>
|
|
22
22
|
|
|
23
|
-
<
|
|
24
|
-
v-if="
|
|
25
|
-
adapter.addLibraryItem && adapter.getLibraryItems && isSupportedOnEntity
|
|
26
|
-
"
|
|
27
|
-
type="library"
|
|
28
|
-
:title="$t('libraryAddFromLibrary', 'Add from library')"
|
|
29
|
-
:description="
|
|
30
|
-
$t(
|
|
31
|
-
'libraryAddDescription',
|
|
32
|
-
'Add a reusable block from the block library.'
|
|
33
|
-
)
|
|
34
|
-
"
|
|
35
|
-
icon="reusable"
|
|
36
|
-
color="lime"
|
|
37
|
-
:item-bundle="BUNDLE_FROM_LIBRARY"
|
|
38
|
-
:disabled="!fromLibraryAllowedInList"
|
|
39
|
-
@placed="placedAction = $event"
|
|
40
|
-
/>
|
|
41
|
-
|
|
42
|
-
<Teleport to="body">
|
|
23
|
+
<Teleport :to="ui.mainLayoutElement.value">
|
|
43
24
|
<BlokkliTransition name="slide-up">
|
|
44
25
|
<ReusableDialog
|
|
45
26
|
v-if="showReusableDialog && selection.item.value"
|
|
@@ -51,7 +32,7 @@
|
|
|
51
32
|
</BlokkliTransition>
|
|
52
33
|
</Teleport>
|
|
53
34
|
|
|
54
|
-
<Teleport to="
|
|
35
|
+
<Teleport :to="ui.mainLayoutElement.value">
|
|
55
36
|
<BlokkliTransition name="slide-in">
|
|
56
37
|
<LibraryDialog
|
|
57
38
|
v-if="placedAction && adapter.getLibraryItems"
|
|
@@ -71,12 +52,14 @@
|
|
|
71
52
|
|
|
72
53
|
<script setup>
|
|
73
54
|
import { ref, computed, useBlokkli, defineBlokkliFeature } from "#imports";
|
|
74
|
-
import { PluginItemAction
|
|
55
|
+
import { PluginItemAction } from "#blokkli/plugins";
|
|
75
56
|
import ReusableDialog from "./ReusableDialog/index.vue";
|
|
76
57
|
import LibraryDialog from "./LibraryDialog/index.vue";
|
|
77
58
|
import EditReusable from "./EditReusable/index.vue";
|
|
78
59
|
import { BlokkliTransition } from "#blokkli/components";
|
|
79
60
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
61
|
+
import defineAddAction from "#blokkli/helpers/composables/defineAddAction";
|
|
62
|
+
import { useDialog } from "#blokkli/helpers/composables/useDialog";
|
|
80
63
|
import { BUNDLE_FROM_LIBRARY } from "#blokkli/constants";
|
|
81
64
|
const { adapter } = defineBlokkliFeature({
|
|
82
65
|
id: "library",
|
|
@@ -86,18 +69,29 @@ const { adapter } = defineBlokkliFeature({
|
|
|
86
69
|
requiredAdapterMethods: ["makeBlockReusable", "detachReusableBlock"],
|
|
87
70
|
dependencies: ["add-list"]
|
|
88
71
|
});
|
|
89
|
-
const { selection, state, types, $t, eventBus, definitions } = useBlokkli();
|
|
90
|
-
const showReusableDialog =
|
|
72
|
+
const { selection, state, types, $t, eventBus, definitions, ui } = useBlokkli();
|
|
73
|
+
const showReusableDialog = useDialog("library-reusable", "center");
|
|
74
|
+
async function selectNewlyAdded(cb) {
|
|
75
|
+
const uuidsBefore = state.getAllUuids();
|
|
76
|
+
await cb();
|
|
77
|
+
const uuidsAfter = state.getAllUuids();
|
|
78
|
+
const newUuid = uuidsAfter.find((uuid) => !uuidsBefore.includes(uuid));
|
|
79
|
+
if (!newUuid) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
eventBus.emit("select", newUuid);
|
|
83
|
+
}
|
|
91
84
|
const onDetach = async () => {
|
|
92
85
|
if (!adapter.detachReusableBlock || !selection.uuids.value.length) {
|
|
93
86
|
return;
|
|
94
87
|
}
|
|
95
|
-
await
|
|
96
|
-
() =>
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
await selectNewlyAdded(
|
|
89
|
+
() => state.mutateWithLoadingState(
|
|
90
|
+
() => adapter.detachReusableBlock({
|
|
91
|
+
uuids: selection.uuids.value
|
|
92
|
+
})
|
|
93
|
+
)
|
|
99
94
|
);
|
|
100
|
-
eventBus.emit("select:end");
|
|
101
95
|
};
|
|
102
96
|
const placedAction = ref(null);
|
|
103
97
|
const onAddLibraryItem = async (uuid) => {
|
|
@@ -140,14 +134,15 @@ async function onMakeReusable(label) {
|
|
|
140
134
|
if (!item) {
|
|
141
135
|
return;
|
|
142
136
|
}
|
|
143
|
-
await
|
|
144
|
-
() =>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
await selectNewlyAdded(
|
|
138
|
+
() => state.mutateWithLoadingState(
|
|
139
|
+
() => adapter.makeBlockReusable({
|
|
140
|
+
label,
|
|
141
|
+
uuid: item.uuid
|
|
142
|
+
}),
|
|
143
|
+
$t("libraryError", "Failed to add block to library.")
|
|
144
|
+
)
|
|
149
145
|
);
|
|
150
|
-
eventBus.emit("select:end");
|
|
151
146
|
}
|
|
152
147
|
const isSupportedOnEntity = computed(
|
|
153
148
|
() => types.generallyAvailableBundles.find((v) => v.id === BUNDLE_FROM_LIBRARY)
|
|
@@ -174,6 +169,25 @@ function onSubmitLibraryItem() {
|
|
|
174
169
|
eventBus.emit("reloadState");
|
|
175
170
|
cancelLibraryItemEdit();
|
|
176
171
|
}
|
|
172
|
+
defineAddAction(() => {
|
|
173
|
+
if (!adapter.addLibraryItem || !adapter.getLibraryItems || !isSupportedOnEntity.value) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
id: "library",
|
|
178
|
+
title: $t("libraryAddFromLibrary", "Add from library"),
|
|
179
|
+
description: $t(
|
|
180
|
+
"libraryAddDescription",
|
|
181
|
+
"Add a reusable block from the block library."
|
|
182
|
+
),
|
|
183
|
+
icon: "reusable",
|
|
184
|
+
color: "lime",
|
|
185
|
+
itemBundle: BUNDLE_FROM_LIBRARY,
|
|
186
|
+
callback: (data) => {
|
|
187
|
+
placedAction.value = data;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
});
|
|
177
191
|
</script>
|
|
178
192
|
|
|
179
193
|
<script>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
:key="mediaId"
|
|
4
4
|
class="bk-media-library-items-item"
|
|
5
5
|
:class="{ 'bk-is-selected': isSelected }"
|
|
6
|
-
:data-sortli-id="
|
|
6
|
+
:data-sortli-id="mediaId"
|
|
7
7
|
data-element-type="media_library"
|
|
8
8
|
:data-item-bundle="targetBundles[0]"
|
|
9
9
|
:data-media-id="mediaId"
|
|
@@ -45,20 +45,17 @@
|
|
|
45
45
|
<div
|
|
46
46
|
ref="listEl"
|
|
47
47
|
class="bk-media-library-items bk-scrollbar-light"
|
|
48
|
-
:class="
|
|
48
|
+
:class="'bk-is-' + listView"
|
|
49
49
|
>
|
|
50
|
-
<Sortli
|
|
50
|
+
<Sortli no-transition :get-drag-items="getDragItems" :build-item>
|
|
51
51
|
<Item
|
|
52
52
|
v-for="item in items"
|
|
53
53
|
:key="item.mediaId"
|
|
54
54
|
v-bind="item"
|
|
55
55
|
v-model="selected"
|
|
56
|
+
:class="'bk-is-' + listView"
|
|
56
57
|
/>
|
|
57
58
|
</Sortli>
|
|
58
|
-
|
|
59
|
-
<div v-else>
|
|
60
|
-
<Item v-for="item in items" :key="item.mediaId" v-bind="item" />
|
|
61
|
-
</div>
|
|
62
59
|
</div>
|
|
63
60
|
|
|
64
61
|
<div v-if="selected.length" class="bk-media-library-cancel">
|
|
@@ -82,10 +79,9 @@ import {
|
|
|
82
79
|
} from "#imports";
|
|
83
80
|
import { Sortli, Icon, Pagination, FormToggle } from "#blokkli/components";
|
|
84
81
|
import Item from "./Item.vue";
|
|
85
|
-
import {
|
|
82
|
+
import { falsy } from "#blokkli/helpers";
|
|
86
83
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
87
84
|
defineProps({
|
|
88
|
-
isSortli: { type: Boolean, required: false },
|
|
89
85
|
modelValue: { type: String, required: false }
|
|
90
86
|
});
|
|
91
87
|
const { adapter, storage, $t, element } = useBlokkli();
|
|
@@ -102,17 +98,17 @@ function getDragItems(activeItem) {
|
|
|
102
98
|
const items2 = selected.value.map((id) => {
|
|
103
99
|
const el = element.query(
|
|
104
100
|
listElement,
|
|
105
|
-
`[data-sortli-id="
|
|
101
|
+
`[data-sortli-id="${id}"]`,
|
|
106
102
|
"Find media library drag item."
|
|
107
103
|
);
|
|
108
104
|
if (!(el instanceof HTMLElement)) {
|
|
109
105
|
return null;
|
|
110
106
|
}
|
|
111
|
-
const item =
|
|
112
|
-
if (item
|
|
113
|
-
return
|
|
107
|
+
const item = buildItem(el);
|
|
108
|
+
if (!item) {
|
|
109
|
+
return null;
|
|
114
110
|
}
|
|
115
|
-
return
|
|
111
|
+
return item;
|
|
116
112
|
}).filter(falsy);
|
|
117
113
|
if (!activeId) {
|
|
118
114
|
return items2;
|
|
@@ -167,6 +163,23 @@ const perPage = computed(() => data.value?.perPage || 0);
|
|
|
167
163
|
const totalPages = computed(() => {
|
|
168
164
|
return Math.ceil(total.value / perPage.value);
|
|
169
165
|
});
|
|
166
|
+
function buildItem(element2) {
|
|
167
|
+
const id = element2.dataset.sortliId;
|
|
168
|
+
if (!id) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
const item = items.value.find((v) => v.mediaId === id);
|
|
172
|
+
if (!item) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
itemType: "media_library",
|
|
177
|
+
mediaId: item.mediaId,
|
|
178
|
+
mediaBundle: item.mediaBundle ?? "",
|
|
179
|
+
itemBundle: item.targetBundles[0] ?? "",
|
|
180
|
+
element: () => element2
|
|
181
|
+
};
|
|
182
|
+
}
|
|
170
183
|
onBlokkliEvent("item:dropped", function() {
|
|
171
184
|
selected.value = [];
|
|
172
185
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
-
isSortli?: boolean;
|
|
3
2
|
modelValue?: string;
|
|
4
3
|
};
|
|
5
4
|
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>;
|
|
@@ -14,21 +14,11 @@
|
|
|
14
14
|
>
|
|
15
15
|
<Library is-sortli />
|
|
16
16
|
</PluginSidebar>
|
|
17
|
-
|
|
18
|
-
<PluginDroppableEdit
|
|
19
|
-
id="media-replace"
|
|
20
|
-
title="Replace media"
|
|
21
|
-
icon="image"
|
|
22
|
-
entity-type="media"
|
|
23
|
-
@save="onDroppableEditSave"
|
|
24
|
-
>
|
|
25
|
-
<Library v-model="selected" />
|
|
26
|
-
</PluginDroppableEdit>
|
|
27
17
|
</template>
|
|
28
18
|
|
|
29
19
|
<script setup>
|
|
30
|
-
import { useBlokkli, defineBlokkliFeature
|
|
31
|
-
import { PluginSidebar
|
|
20
|
+
import { useBlokkli, defineBlokkliFeature } from "#imports";
|
|
21
|
+
import { PluginSidebar } from "#blokkli/plugins";
|
|
32
22
|
import Library from "./Library/index.vue";
|
|
33
23
|
import defineDropAreas from "#blokkli/helpers/composables/defineDropAreas";
|
|
34
24
|
import { falsy } from "#blokkli/helpers";
|
|
@@ -40,45 +30,11 @@ defineBlokkliFeature({
|
|
|
40
30
|
description: "Implements a media library to easily drag and drop media like images or videos.",
|
|
41
31
|
requiredAdapterMethods: ["mediaLibraryGetResults", "mediaLibraryAddBlock"]
|
|
42
32
|
});
|
|
43
|
-
const { $t, adapter, state,
|
|
44
|
-
const selected = ref("");
|
|
33
|
+
const { $t, adapter, state, types, directive } = useBlokkli();
|
|
45
34
|
const ERROR_MESSAGE = $t(
|
|
46
35
|
"mediaLibraryReplaceFailed",
|
|
47
36
|
"Failed to replace media."
|
|
48
37
|
);
|
|
49
|
-
const onDroppableEditSave = async (e) => {
|
|
50
|
-
if (!selected.value) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if ("itemType" in e.host && adapter.mediaLibraryReplaceMedia) {
|
|
54
|
-
const host = e.host;
|
|
55
|
-
await state.mutateWithLoadingState(
|
|
56
|
-
() => adapter.mediaLibraryReplaceMedia({
|
|
57
|
-
host: {
|
|
58
|
-
uuid: host.block.uuid,
|
|
59
|
-
type: runtimeConfig.itemEntityType,
|
|
60
|
-
fieldName: e.fieldName
|
|
61
|
-
},
|
|
62
|
-
mediaId: selected.value
|
|
63
|
-
}),
|
|
64
|
-
ERROR_MESSAGE
|
|
65
|
-
);
|
|
66
|
-
} else if ("type" in e.host && adapter.mediaLibraryReplaceEntityMedia) {
|
|
67
|
-
const host = e.host;
|
|
68
|
-
const type = host.type;
|
|
69
|
-
await state.mutateWithLoadingState(
|
|
70
|
-
() => adapter.mediaLibraryReplaceEntityMedia({
|
|
71
|
-
host: {
|
|
72
|
-
uuid: host.uuid,
|
|
73
|
-
type,
|
|
74
|
-
fieldName: e.fieldName
|
|
75
|
-
},
|
|
76
|
-
mediaId: selected.value
|
|
77
|
-
}),
|
|
78
|
-
ERROR_MESSAGE
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
38
|
defineDropAreas((dragItems) => {
|
|
83
39
|
if (!adapter.mediaLibraryReplaceMedia) {
|
|
84
40
|
return;
|
package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/fragment.glsl
RENAMED
|
@@ -9,6 +9,13 @@ in vec3 v_color_default;
|
|
|
9
9
|
in vec3 v_color_active;
|
|
10
10
|
in float v_rect_id;
|
|
11
11
|
|
|
12
|
+
// Optimized inputs - values computed once per vertex instead of per pixel
|
|
13
|
+
in vec2 v_size;
|
|
14
|
+
in vec2 v_location;
|
|
15
|
+
in float v_thickness;
|
|
16
|
+
in float v_edge_softness;
|
|
17
|
+
in float v_radius;
|
|
18
|
+
|
|
12
19
|
out vec4 fragColor;
|
|
13
20
|
|
|
14
21
|
uniform float u_time;
|
|
@@ -45,32 +52,11 @@ void main() {
|
|
|
45
52
|
return;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
|
-
// Selectable blocks
|
|
49
|
-
float radius_base = 2.0 * u_scale;
|
|
50
|
-
float thickness = max(min(1.0 * u_scale, 3.0), 0.5);
|
|
51
|
-
float inset = max(min(2.0 * u_scale, 1.0), 2.0) * thickness;
|
|
52
|
-
|
|
53
|
-
float u_rect_x = v_quad.x + inset;
|
|
54
|
-
float u_rect_y = v_quad.y + inset;
|
|
55
|
-
float u_rectWidth = v_quad.z - 2.0 * inset;
|
|
56
|
-
float u_rectHeight = v_quad.w - 2.0 * inset;
|
|
57
|
-
|
|
58
|
-
vec2 size = vec2(u_rectWidth, u_rectHeight);
|
|
59
|
-
|
|
60
|
-
float x = u_rect_x;
|
|
61
|
-
float y = u_rect_y;
|
|
62
|
-
vec2 offsetPosition = vec2(x + size.x / 2.0, y + size.y / 2.0);
|
|
63
|
-
|
|
64
|
-
vec2 location = vec2(offsetPosition);
|
|
65
|
-
|
|
66
|
-
float edgeSoftness = 1.0 * u_dpi;
|
|
67
|
-
float radius =
|
|
68
|
-
min(radius_base * u_dpi, min(size.x, size.y) / 2.0) + thickness * 2.0;
|
|
69
|
-
|
|
55
|
+
// Selectable blocks - using pre-computed values from vertex shader
|
|
70
56
|
float distance = roundedBoxSDF(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
57
|
+
v_location - gl_FragCoord.xy,
|
|
58
|
+
v_size / 2.0,
|
|
59
|
+
v_radius
|
|
74
60
|
);
|
|
75
61
|
|
|
76
62
|
bool is_intersecting = v_intersecting >= 0.5;
|
|
@@ -79,7 +65,8 @@ void main() {
|
|
|
79
65
|
float mixedDistance = is_intersecting ? distance : abs(distance);
|
|
80
66
|
|
|
81
67
|
float smoothedAlpha =
|
|
82
|
-
1.0 -
|
|
68
|
+
1.0 -
|
|
69
|
+
smoothstep(-v_edge_softness, v_edge_softness, mixedDistance - v_thickness);
|
|
83
70
|
|
|
84
71
|
fragColor = vec4(
|
|
85
72
|
color,
|