@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,7 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<div />
|
|
4
|
-
</Teleport>
|
|
2
|
+
<div />
|
|
5
3
|
</template>
|
|
6
4
|
|
|
7
5
|
<script setup>
|
|
@@ -22,13 +20,15 @@ const logger = useDebugLogger();
|
|
|
22
20
|
const props = defineProps({
|
|
23
21
|
startX: { type: Number, required: true },
|
|
24
22
|
startY: { type: Number, required: true },
|
|
25
|
-
isPressingControl: { type: Boolean, required: true }
|
|
26
|
-
gl: { type: null, required: true }
|
|
23
|
+
isPressingControl: { type: Boolean, required: true }
|
|
27
24
|
});
|
|
28
25
|
const startTimestamp = Date.now();
|
|
29
26
|
defineEmits(["select"]);
|
|
30
27
|
class MultiSelectRectangleBufferCollector extends RectangleBufferCollector {
|
|
31
|
-
getBufferInfo(offset, scale) {
|
|
28
|
+
getBufferInfo(gl, offset, scale) {
|
|
29
|
+
if (!offset || !scale) {
|
|
30
|
+
return { info: this.bufferInfo, hasChanged: false };
|
|
31
|
+
}
|
|
32
32
|
const visibleBlocks = dom.getVisibleBlocks();
|
|
33
33
|
const lengthBefore = this.positions.length;
|
|
34
34
|
for (let i = 0; i < visibleBlocks.length; i++) {
|
|
@@ -63,8 +63,8 @@ class MultiSelectRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
65
|
const hasChanged = lengthBefore !== this.positions.length;
|
|
66
|
-
if (hasChanged) {
|
|
67
|
-
this.bufferInfo = this.createBufferInfo();
|
|
66
|
+
if (hasChanged && gl) {
|
|
67
|
+
this.bufferInfo = this.createBufferInfo(gl);
|
|
68
68
|
}
|
|
69
69
|
return { info: this.bufferInfo, hasChanged };
|
|
70
70
|
}
|
|
@@ -95,68 +95,11 @@ class MultiSelectRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
95
95
|
return false;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
const collector = new MultiSelectRectangleBufferCollector(props.gl);
|
|
99
|
-
const thick = 300;
|
|
100
|
-
collector.addRectangle(
|
|
101
|
-
{
|
|
102
|
-
width: 1e3,
|
|
103
|
-
height: thick,
|
|
104
|
-
x: 100,
|
|
105
|
-
y: 100,
|
|
106
|
-
id: "select-rect-top",
|
|
107
|
-
isNested: false,
|
|
108
|
-
radius: [0, 0, 0, 0]
|
|
109
|
-
},
|
|
110
|
-
0
|
|
111
|
-
);
|
|
112
|
-
collector.addRectangle(
|
|
113
|
-
{
|
|
114
|
-
width: thick,
|
|
115
|
-
height: 1e3,
|
|
116
|
-
x: 1e3 + thick,
|
|
117
|
-
y: thick,
|
|
118
|
-
id: "select-rect-right",
|
|
119
|
-
isNested: false,
|
|
120
|
-
radius: [0, 0, 0, 0]
|
|
121
|
-
},
|
|
122
|
-
0
|
|
123
|
-
);
|
|
124
|
-
collector.addRectangle(
|
|
125
|
-
{
|
|
126
|
-
width: 1e3,
|
|
127
|
-
height: thick,
|
|
128
|
-
x: 100 + thick,
|
|
129
|
-
y: 1e3 + thick,
|
|
130
|
-
id: "select-rect-bottom",
|
|
131
|
-
isNested: false,
|
|
132
|
-
radius: [0, 0, 0, 0]
|
|
133
|
-
},
|
|
134
|
-
0
|
|
135
|
-
);
|
|
136
|
-
collector.addRectangle(
|
|
137
|
-
{
|
|
138
|
-
width: thick,
|
|
139
|
-
height: 1e3,
|
|
140
|
-
x: 100,
|
|
141
|
-
y: 100 + thick,
|
|
142
|
-
id: "select-rect-left",
|
|
143
|
-
isNested: false,
|
|
144
|
-
radius: [0, 0, 0, 0]
|
|
145
|
-
},
|
|
146
|
-
0
|
|
147
|
-
);
|
|
148
98
|
const artboardOffsetStart = { ...ui.artboardOffset.value };
|
|
149
99
|
const artboardScaleStart = ui.artboardScale.value;
|
|
150
|
-
const programInfo = animation.registerProgram(
|
|
151
|
-
"multi_select_overlay",
|
|
152
|
-
props.gl,
|
|
153
|
-
[vs, fs]
|
|
154
|
-
);
|
|
155
100
|
const uniforms = {
|
|
156
|
-
u_color_field_active:
|
|
157
|
-
u_color_field_default:
|
|
158
|
-
u_color_area_active: toShaderColor(theme.teal.value.normal),
|
|
159
|
-
u_color_area_default: toShaderColor(theme.teal.value.normal)
|
|
101
|
+
u_color_field_active: theme.accent.value[700],
|
|
102
|
+
u_color_field_default: theme.mono.value[400]
|
|
160
103
|
};
|
|
161
104
|
let mouseX = 0;
|
|
162
105
|
let mouseY = 0;
|
|
@@ -181,11 +124,65 @@ function getSelectRect(offset, scale) {
|
|
|
181
124
|
};
|
|
182
125
|
return { shader, check };
|
|
183
126
|
}
|
|
184
|
-
defineRenderer("multiselect-overlay", {
|
|
127
|
+
const { collector } = defineRenderer("multiselect-overlay", {
|
|
185
128
|
zIndex: 450,
|
|
186
129
|
only: true,
|
|
130
|
+
collector: () => {
|
|
131
|
+
const c = new MultiSelectRectangleBufferCollector();
|
|
132
|
+
const thick = 300;
|
|
133
|
+
c.addRectangle(
|
|
134
|
+
{
|
|
135
|
+
width: 1e3,
|
|
136
|
+
height: thick,
|
|
137
|
+
x: 100,
|
|
138
|
+
y: 100,
|
|
139
|
+
id: "select-rect-top",
|
|
140
|
+
isNested: false,
|
|
141
|
+
radius: [0, 0, 0, 0]
|
|
142
|
+
},
|
|
143
|
+
0
|
|
144
|
+
);
|
|
145
|
+
c.addRectangle(
|
|
146
|
+
{
|
|
147
|
+
width: thick,
|
|
148
|
+
height: 1e3,
|
|
149
|
+
x: 1e3 + thick,
|
|
150
|
+
y: thick,
|
|
151
|
+
id: "select-rect-right",
|
|
152
|
+
isNested: false,
|
|
153
|
+
radius: [0, 0, 0, 0]
|
|
154
|
+
},
|
|
155
|
+
0
|
|
156
|
+
);
|
|
157
|
+
c.addRectangle(
|
|
158
|
+
{
|
|
159
|
+
width: 1e3,
|
|
160
|
+
height: thick,
|
|
161
|
+
x: 100 + thick,
|
|
162
|
+
y: 1e3 + thick,
|
|
163
|
+
id: "select-rect-bottom",
|
|
164
|
+
isNested: false,
|
|
165
|
+
radius: [0, 0, 0, 0]
|
|
166
|
+
},
|
|
167
|
+
0
|
|
168
|
+
);
|
|
169
|
+
c.addRectangle(
|
|
170
|
+
{
|
|
171
|
+
width: thick,
|
|
172
|
+
height: 1e3,
|
|
173
|
+
x: 100,
|
|
174
|
+
y: 100 + thick,
|
|
175
|
+
id: "select-rect-left",
|
|
176
|
+
isNested: false,
|
|
177
|
+
radius: [0, 0, 0, 0]
|
|
178
|
+
},
|
|
179
|
+
0
|
|
180
|
+
);
|
|
181
|
+
return c;
|
|
182
|
+
},
|
|
183
|
+
program: () => ({ shaders: [vs, fs] }),
|
|
187
184
|
cursor: () => "crosshair",
|
|
188
|
-
render: (ctx) => {
|
|
185
|
+
render: (ctx, gl, program) => {
|
|
189
186
|
mouseX = ctx.mouseX;
|
|
190
187
|
mouseY = ctx.mouseY;
|
|
191
188
|
const { shader, check } = getSelectRect(
|
|
@@ -194,16 +191,20 @@ defineRenderer("multiselect-overlay", {
|
|
|
194
191
|
);
|
|
195
192
|
const { nested } = collector.getSelectedUuids(check);
|
|
196
193
|
const shouldSelectAll = props.isPressingControl || !nested.length;
|
|
197
|
-
|
|
194
|
+
gl.useProgram(program.program);
|
|
198
195
|
const time = (Date.now() - startTimestamp) / 1e3;
|
|
199
|
-
setUniforms(
|
|
200
|
-
|
|
196
|
+
setUniforms(program, {
|
|
197
|
+
u_color_field_active: toShaderColor(uniforms.u_color_field_active),
|
|
198
|
+
u_color_field_default: toShaderColor(uniforms.u_color_field_default)
|
|
199
|
+
});
|
|
200
|
+
setUniforms(program, {
|
|
201
201
|
u_select_all: shouldSelectAll ? 1 : 0,
|
|
202
202
|
u_select_rect: [shader.x, shader.y, shader.width, shader.height],
|
|
203
203
|
u_time: time
|
|
204
204
|
});
|
|
205
|
-
animation.setSharedUniforms(
|
|
205
|
+
animation.setSharedUniforms(gl, program);
|
|
206
206
|
const { info, hasChanged } = collector.getBufferInfo(
|
|
207
|
+
gl,
|
|
207
208
|
ctx.artboardOffset,
|
|
208
209
|
ctx.artboardScale
|
|
209
210
|
);
|
|
@@ -211,9 +212,64 @@ defineRenderer("multiselect-overlay", {
|
|
|
211
212
|
return;
|
|
212
213
|
}
|
|
213
214
|
if (hasChanged) {
|
|
214
|
-
setBuffersAndAttributes(
|
|
215
|
+
setBuffersAndAttributes(gl, program, info);
|
|
216
|
+
}
|
|
217
|
+
drawBufferInfo(gl, info, gl.TRIANGLES);
|
|
218
|
+
},
|
|
219
|
+
renderFallback: (ctx, ctx2d) => {
|
|
220
|
+
mouseX = ctx.mouseX;
|
|
221
|
+
mouseY = ctx.mouseY;
|
|
222
|
+
const { shader, check } = getSelectRect(
|
|
223
|
+
ctx.artboardOffset,
|
|
224
|
+
ctx.artboardScale
|
|
225
|
+
);
|
|
226
|
+
const { nested } = collector.getSelectedUuids(check);
|
|
227
|
+
const shouldSelectAll = props.isPressingControl || !nested.length;
|
|
228
|
+
collector.getBufferInfo(void 0, ctx.artboardOffset, ctx.artboardScale);
|
|
229
|
+
const rects = Object.values(collector.rects);
|
|
230
|
+
const colorFieldActive = `rgba(${uniforms.u_color_field_active[0]}, ${uniforms.u_color_field_active[1]}, ${uniforms.u_color_field_active[2]}, 0.3)`;
|
|
231
|
+
for (let i = 0; i < rects.length; i++) {
|
|
232
|
+
const rect = rects[i];
|
|
233
|
+
if (rect.id.startsWith("select-rect-")) {
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (!intersects(rect, check)) {
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
if (!rect.isNested && !shouldSelectAll) {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
ctx2d.fillStyle = colorFieldActive;
|
|
243
|
+
ctx2d.fillRect(
|
|
244
|
+
(rect.x * ctx.artboardScale + ctx.artboardOffset.x) * ctx.dpi,
|
|
245
|
+
(rect.y * ctx.artboardScale + ctx.artboardOffset.y) * ctx.dpi,
|
|
246
|
+
rect.width * ctx.artboardScale * ctx.dpi,
|
|
247
|
+
rect.height * ctx.artboardScale * ctx.dpi
|
|
248
|
+
);
|
|
215
249
|
}
|
|
216
|
-
|
|
250
|
+
const time = (Date.now() - startTimestamp) / 1e3;
|
|
251
|
+
const speed = 100 * ctx.dpi;
|
|
252
|
+
const dashLength = 8 * ctx.dpi;
|
|
253
|
+
const phase = time * speed * -1;
|
|
254
|
+
ctx2d.lineWidth = 2 * ctx.dpi;
|
|
255
|
+
ctx2d.setLineDash([dashLength, dashLength]);
|
|
256
|
+
ctx2d.strokeStyle = "rgba(255, 255, 255, 0.8)";
|
|
257
|
+
ctx2d.lineDashOffset = phase % (dashLength * 2);
|
|
258
|
+
ctx2d.strokeRect(
|
|
259
|
+
shader.x * ctx.dpi,
|
|
260
|
+
shader.y * ctx.dpi,
|
|
261
|
+
shader.width * ctx.dpi,
|
|
262
|
+
shader.height * ctx.dpi
|
|
263
|
+
);
|
|
264
|
+
ctx2d.strokeStyle = "rgba(0, 0, 0, 0.8)";
|
|
265
|
+
ctx2d.lineDashOffset = (phase + dashLength) % (dashLength * 2);
|
|
266
|
+
ctx2d.strokeRect(
|
|
267
|
+
shader.x * ctx.dpi,
|
|
268
|
+
shader.y * ctx.dpi,
|
|
269
|
+
shader.width * ctx.dpi,
|
|
270
|
+
shader.height * ctx.dpi
|
|
271
|
+
);
|
|
272
|
+
ctx2d.setLineDash([]);
|
|
217
273
|
}
|
|
218
274
|
});
|
|
219
275
|
function getUuidsToSelect() {
|
package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue.d.ts
RENAMED
|
@@ -2,7 +2,6 @@ type __VLS_Props = {
|
|
|
2
2
|
startX: number;
|
|
3
3
|
startY: number;
|
|
4
4
|
isPressingControl: boolean;
|
|
5
|
-
gl: WebGLRenderingContext;
|
|
6
5
|
};
|
|
7
6
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
7
|
select: (uuids: string[]) => any;
|
|
@@ -17,8 +17,6 @@ uniform float u_select_all;
|
|
|
17
17
|
uniform vec2 u_resolution;
|
|
18
18
|
uniform vec3 u_color_field_default;
|
|
19
19
|
uniform vec3 u_color_field_active;
|
|
20
|
-
uniform vec3 u_color_area_default;
|
|
21
|
-
uniform vec3 u_color_area_active;
|
|
22
20
|
uniform vec4 u_select_rect;
|
|
23
21
|
|
|
24
22
|
out vec4 v_quad;
|
|
@@ -28,6 +26,13 @@ out vec3 v_color_default;
|
|
|
28
26
|
out vec3 v_color_active;
|
|
29
27
|
out float v_rect_id;
|
|
30
28
|
|
|
29
|
+
// Optimized outputs - values computed once per vertex instead of per pixel
|
|
30
|
+
out vec2 v_size;
|
|
31
|
+
out vec2 v_location;
|
|
32
|
+
out float v_thickness;
|
|
33
|
+
out float v_edge_softness;
|
|
34
|
+
out float v_radius;
|
|
35
|
+
|
|
31
36
|
bool isIntersecting(vec4 a, vec4 b) {
|
|
32
37
|
return a.x < b.x + b.z &&
|
|
33
38
|
a.x + a.z > b.x &&
|
|
@@ -179,4 +184,24 @@ void main() {
|
|
|
179
184
|
|
|
180
185
|
v_color_default = u_color_field_default;
|
|
181
186
|
v_color_active = u_color_field_active;
|
|
187
|
+
|
|
188
|
+
// Compute values that are constant per quad (optimization)
|
|
189
|
+
float radius_base = 2.0 * u_scale;
|
|
190
|
+
v_thickness = max(min(1.0 * u_scale, 3.0), 0.5);
|
|
191
|
+
float inset = max(min(2.0 * u_scale, 1.0), 2.0) * v_thickness;
|
|
192
|
+
|
|
193
|
+
float u_rect_x = transformed_quad.x + inset;
|
|
194
|
+
float u_rect_y = transformed_quad.y + inset;
|
|
195
|
+
float u_rectWidth = transformed_quad.z - 2.0 * inset;
|
|
196
|
+
float u_rectHeight = transformed_quad.w - 2.0 * inset;
|
|
197
|
+
|
|
198
|
+
v_size = vec2(u_rectWidth, u_rectHeight);
|
|
199
|
+
|
|
200
|
+
float x = u_rect_x;
|
|
201
|
+
float y = u_rect_y;
|
|
202
|
+
v_location = vec2(x + v_size.x / 2.0, y + v_size.y / 2.0);
|
|
203
|
+
|
|
204
|
+
v_edge_softness = 1.0 * u_dpi;
|
|
205
|
+
v_radius =
|
|
206
|
+
min(radius_base * u_dpi, min(v_size.x, v_size.y) / 2.0) + v_thickness * 2.0;
|
|
182
207
|
}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-
|
|
4
|
-
:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
<ErrorBoundary
|
|
3
|
+
v-model="isLocked"
|
|
4
|
+
:label="$t('feature_multi-select_label', 'Multiselect')"
|
|
5
|
+
@error="onError"
|
|
6
|
+
>
|
|
7
|
+
<Renderer
|
|
8
|
+
v-if="shouldRender"
|
|
9
|
+
:key="animation.renderKey.value"
|
|
10
|
+
:start-x="downX"
|
|
11
|
+
:start-y="downY"
|
|
12
|
+
:is-pressing-control="keyboard.isPressingControl.value"
|
|
13
|
+
@select="onSelect"
|
|
14
|
+
/>
|
|
15
|
+
</ErrorBoundary>
|
|
10
16
|
</template>
|
|
11
17
|
|
|
12
18
|
<script setup>
|
|
13
19
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
14
20
|
import { ref, useBlokkli, defineBlokkliFeature, computed } from "#imports";
|
|
15
|
-
import
|
|
21
|
+
import { ErrorBoundary } from "#blokkli/components";
|
|
22
|
+
import Renderer from "./Renderer/index.vue";
|
|
16
23
|
defineBlokkliFeature({
|
|
17
24
|
id: "multi-select",
|
|
18
25
|
label: "Multiselect",
|
|
@@ -20,12 +27,18 @@ defineBlokkliFeature({
|
|
|
20
27
|
description: "Implements support for selecting multiple blocks using a select rectangle.",
|
|
21
28
|
viewports: ["desktop"]
|
|
22
29
|
});
|
|
23
|
-
const { keyboard, eventBus, selection, animation } = useBlokkli();
|
|
24
|
-
const
|
|
25
|
-
const enabled = computed(
|
|
30
|
+
const { keyboard, eventBus, selection, animation, $t } = useBlokkli();
|
|
31
|
+
const isLocked = ref(false);
|
|
32
|
+
const enabled = computed(
|
|
33
|
+
() => !selection.editableActive.value && !isLocked.value
|
|
34
|
+
);
|
|
26
35
|
const shouldRender = ref(false);
|
|
27
36
|
const downX = ref(0);
|
|
28
37
|
const downY = ref(0);
|
|
38
|
+
function onError() {
|
|
39
|
+
eventBus.emit("select:end");
|
|
40
|
+
shouldRender.value = false;
|
|
41
|
+
}
|
|
29
42
|
const onSelect = (uuids) => {
|
|
30
43
|
shouldRender.value = false;
|
|
31
44
|
eventBus.emit("select:end", uuids);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Teleport to="#bk-banner-list">
|
|
3
|
-
<
|
|
3
|
+
<OwnershipBanner v-if="shouldRender" @submit="takeOwnership" />
|
|
4
4
|
</Teleport>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup>
|
|
8
8
|
import { useBlokkli, defineBlokkliFeature, computed } from "#imports";
|
|
9
|
-
import
|
|
9
|
+
import OwnershipBanner from "./Banner/index.vue";
|
|
10
10
|
const { adapter } = defineBlokkliFeature({
|
|
11
11
|
id: "ownership",
|
|
12
12
|
icon: "user",
|
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
@click="qrCodeVisible = true"
|
|
16
16
|
/>
|
|
17
17
|
|
|
18
|
-
<Teleport to="
|
|
18
|
+
<Teleport :to="ui.mainLayoutElement.value">
|
|
19
19
|
<BlokkliTransition name="slide-up">
|
|
20
20
|
<DialogModal
|
|
21
21
|
v-if="qrCodeVisible"
|
|
22
|
+
id="preview-grant"
|
|
22
23
|
:title="$t('previewDialogTitle', 'Preview with smartphone')"
|
|
23
24
|
:lead="
|
|
24
25
|
$t(
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
id="publish"
|
|
4
|
-
:title="publishLabel"
|
|
5
|
-
:description="publishDescription"
|
|
6
|
-
:disabled="!mutations.length || !canEdit"
|
|
7
|
-
:type="isScheduled ? 'yellow' : 'success'"
|
|
8
|
-
:weight="0"
|
|
9
|
-
:icon="icon"
|
|
10
|
-
@click="onMenuClick"
|
|
11
|
-
/>
|
|
12
|
-
<Teleport to="body">
|
|
2
|
+
<Teleport :to="ui.mainLayoutElement.value">
|
|
13
3
|
<BlokkliTransition name="slide-up">
|
|
14
4
|
<PublishDialog v-if="showDialog" @close="onClose" @submit="onSubmit" />
|
|
15
5
|
</BlokkliTransition>
|
|
@@ -22,13 +12,13 @@ import {
|
|
|
22
12
|
defineBlokkliFeature,
|
|
23
13
|
computed,
|
|
24
14
|
useRoute,
|
|
25
|
-
ref,
|
|
26
15
|
nextTick
|
|
27
16
|
} from "#imports";
|
|
28
|
-
import { PluginMenuButton } from "#blokkli/plugins";
|
|
29
17
|
import { BlokkliTransition } from "#blokkli/components";
|
|
30
18
|
import PublishDialog from "./Dialog/index.vue";
|
|
31
19
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
20
|
+
import defineMenuButton from "#blokkli/helpers/composables/defineMenuButton";
|
|
21
|
+
import { useDialog } from "#blokkli/helpers/composables/useDialog";
|
|
32
22
|
const { adapter, settings } = defineBlokkliFeature({
|
|
33
23
|
id: "publish",
|
|
34
24
|
icon: "publish",
|
|
@@ -46,14 +36,14 @@ const { adapter, settings } = defineBlokkliFeature({
|
|
|
46
36
|
}
|
|
47
37
|
});
|
|
48
38
|
const route = useRoute();
|
|
49
|
-
const { state, $t, broadcast, context, eventBus } = useBlokkli();
|
|
39
|
+
const { state, $t, broadcast, context, eventBus, ui } = useBlokkli();
|
|
50
40
|
const { mutations, canEdit, mutateWithLoadingState } = state;
|
|
51
41
|
const hasPublishOptions = !!adapter.getPublishOptions;
|
|
52
42
|
const isPublished = computed(() => !!state.entity.value.status);
|
|
53
43
|
const isScheduled = computed(
|
|
54
44
|
() => !!state.publishOptions.value.publishOn
|
|
55
45
|
);
|
|
56
|
-
const showDialog =
|
|
46
|
+
const showDialog = useDialog("publish", "center");
|
|
57
47
|
const publishLabel = computed(() => {
|
|
58
48
|
const suffix = hasPublishOptions ? "..." : "";
|
|
59
49
|
if (isScheduled.value) {
|
|
@@ -122,6 +112,18 @@ async function onClose() {
|
|
|
122
112
|
onBlokkliEvent("publish:show-dialog", () => {
|
|
123
113
|
showDialog.value = true;
|
|
124
114
|
});
|
|
115
|
+
defineMenuButton(() => {
|
|
116
|
+
return {
|
|
117
|
+
id: "publish",
|
|
118
|
+
title: publishLabel.value,
|
|
119
|
+
description: publishDescription.value,
|
|
120
|
+
icon: icon.value,
|
|
121
|
+
type: isScheduled.value ? "yellow" : "success",
|
|
122
|
+
disabled: !mutations.value.length || !canEdit.value,
|
|
123
|
+
weight: 0,
|
|
124
|
+
callback: onMenuClick
|
|
125
|
+
};
|
|
126
|
+
});
|
|
125
127
|
</script>
|
|
126
128
|
|
|
127
129
|
<script>
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
</div>
|
|
38
38
|
<Icon name="caret" />
|
|
39
39
|
</button>
|
|
40
|
-
<div v-
|
|
40
|
+
<div v-if="dropdownOpen" class="bk-dropdown-content">
|
|
41
41
|
<label v-for="option in viewportOptions" :key="option.id">
|
|
42
42
|
<input
|
|
43
43
|
v-model="selectedViewportId"
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
id="revert"
|
|
4
|
-
:title="$t('revertMenuTitle', 'Discard...')"
|
|
5
|
-
:description="
|
|
6
|
-
$t('revertMenuDescription', 'Restore currently published state')
|
|
7
|
-
"
|
|
8
|
-
icon="revert"
|
|
9
|
-
type="danger"
|
|
10
|
-
:disabled="!mutations.length || !canEdit"
|
|
11
|
-
:weight="10"
|
|
12
|
-
@click="showConfirm = true"
|
|
13
|
-
/>
|
|
14
|
-
|
|
15
|
-
<Teleport to="body">
|
|
2
|
+
<Teleport :to="ui.mainLayoutElement.value">
|
|
16
3
|
<BlokkliTransition name="slide-up">
|
|
17
4
|
<DialogModal
|
|
18
5
|
v-if="showConfirm"
|
|
6
|
+
id="revert"
|
|
19
7
|
:title="$t('revertDialogTitle', 'Irrevocably discard changes')"
|
|
20
8
|
:lead="
|
|
21
9
|
$t(
|
|
@@ -33,9 +21,10 @@
|
|
|
33
21
|
</template>
|
|
34
22
|
|
|
35
23
|
<script setup>
|
|
36
|
-
import { useBlokkli,
|
|
37
|
-
import { PluginMenuButton } from "#blokkli/plugins";
|
|
24
|
+
import { useBlokkli, defineBlokkliFeature } from "#imports";
|
|
38
25
|
import { DialogModal, BlokkliTransition } from "#blokkli/components";
|
|
26
|
+
import defineMenuButton from "#blokkli/helpers/composables/defineMenuButton";
|
|
27
|
+
import { useDialog } from "#blokkli/helpers/composables/useDialog";
|
|
39
28
|
const { adapter } = defineBlokkliFeature({
|
|
40
29
|
id: "revert",
|
|
41
30
|
icon: "revert",
|
|
@@ -43,9 +32,9 @@ const { adapter } = defineBlokkliFeature({
|
|
|
43
32
|
requiredAdapterMethods: ["revertAllChanges"],
|
|
44
33
|
description: "Provides a menu button to revert all changes done on the current entity."
|
|
45
34
|
});
|
|
46
|
-
const { state, $t } = useBlokkli();
|
|
35
|
+
const { state, $t, ui } = useBlokkli();
|
|
47
36
|
const { mutations, canEdit, mutateWithLoadingState } = state;
|
|
48
|
-
const showConfirm =
|
|
37
|
+
const showConfirm = useDialog("revert", "center");
|
|
49
38
|
async function onSubmit() {
|
|
50
39
|
await mutateWithLoadingState(
|
|
51
40
|
() => adapter.revertAllChanges(),
|
|
@@ -54,6 +43,23 @@ async function onSubmit() {
|
|
|
54
43
|
);
|
|
55
44
|
showConfirm.value = false;
|
|
56
45
|
}
|
|
46
|
+
defineMenuButton(() => {
|
|
47
|
+
return {
|
|
48
|
+
id: "revert",
|
|
49
|
+
title: $t("revertMenuTitle", "Discard..."),
|
|
50
|
+
description: $t(
|
|
51
|
+
"revertMenuDescription",
|
|
52
|
+
"Restore currently published state"
|
|
53
|
+
),
|
|
54
|
+
icon: "revert",
|
|
55
|
+
type: "danger",
|
|
56
|
+
disabled: !mutations.value.length || !canEdit.value,
|
|
57
|
+
weight: 10,
|
|
58
|
+
callback: () => {
|
|
59
|
+
showConfirm.value = true;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
});
|
|
57
63
|
</script>
|
|
58
64
|
|
|
59
65
|
<script>
|
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
<Icon name="spinner" />
|
|
5
5
|
</div>
|
|
6
6
|
<div :class="{ 'bk-search-is-loading': isLoading }">
|
|
7
|
-
<Sortli
|
|
7
|
+
<Sortli :build-item>
|
|
8
8
|
<button
|
|
9
9
|
v-for="(item, i) in items"
|
|
10
10
|
:key="tab + item.id"
|
|
11
11
|
ref="listItems"
|
|
12
|
-
data-element-type="search_content"
|
|
13
12
|
class="bk bk-search-item bk-is-content"
|
|
14
13
|
:class="{ 'bk-is-active': i === index }"
|
|
15
|
-
:data-sortli-id="
|
|
16
|
-
:data-search-item="JSON.stringify(item)"
|
|
14
|
+
:data-sortli-id="i"
|
|
17
15
|
@mouseenter="index = i"
|
|
18
16
|
>
|
|
19
17
|
<div
|
|
@@ -56,7 +54,7 @@
|
|
|
56
54
|
<script setup>
|
|
57
55
|
import { watch, ref, useBlokkli, onMounted } from "#imports";
|
|
58
56
|
import { ItemIcon, Icon, Sortli } from "#blokkli/components";
|
|
59
|
-
import {
|
|
57
|
+
import { modulo } from "#blokkli/helpers";
|
|
60
58
|
const listItems = ref([]);
|
|
61
59
|
const props = defineProps({
|
|
62
60
|
visible: { type: Boolean, required: true },
|
|
@@ -101,6 +99,25 @@ const goToFirst = () => setIndex(0);
|
|
|
101
99
|
const select = () => clickItem();
|
|
102
100
|
const isActive = () => props.visible;
|
|
103
101
|
defineExpose({ prev, next, select, isActive, goToFirst });
|
|
102
|
+
function buildItem(element) {
|
|
103
|
+
if (!element.dataset.sortliId) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const index2 = Number.parseInt(element.dataset.sortliId);
|
|
107
|
+
if (Number.isNaN(index2) || !Number.isFinite(index2)) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const item = items.value[index2];
|
|
111
|
+
if (!item) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
itemType: "search_content",
|
|
116
|
+
element: () => element,
|
|
117
|
+
itemBundle: item.targetBundles[0] ?? "",
|
|
118
|
+
searchItem: item
|
|
119
|
+
};
|
|
120
|
+
}
|
|
104
121
|
const setIndex = (newIndex) => {
|
|
105
122
|
index.value = modulo(newIndex, items.value.length);
|
|
106
123
|
scrollItemIntoView();
|
|
@@ -110,7 +127,7 @@ const clickItem = () => {
|
|
|
110
127
|
if (!element) {
|
|
111
128
|
return;
|
|
112
129
|
}
|
|
113
|
-
const item =
|
|
130
|
+
const item = buildItem(element);
|
|
114
131
|
if (!item) {
|
|
115
132
|
return;
|
|
116
133
|
}
|