@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
|
@@ -2,11 +2,14 @@ import {
|
|
|
2
2
|
onMounted,
|
|
3
3
|
onBeforeUnmount,
|
|
4
4
|
ref,
|
|
5
|
-
computed
|
|
6
|
-
|
|
5
|
+
computed,
|
|
6
|
+
watch,
|
|
7
|
+
readonly
|
|
8
|
+
} from "#imports";
|
|
7
9
|
import { eventBus } from "./eventBus.js";
|
|
8
10
|
import { falsy } from "./index.js";
|
|
9
11
|
import { addElementClasses } from "./addElementClasses.js";
|
|
12
|
+
import { defineElementStyle } from "./defineElementStyle.js";
|
|
10
13
|
import { defaultLanguage, forceDefaultLanguage } from "#blokkli-build/config";
|
|
11
14
|
const CLASS_PROXY_MODE = "bk-is-proxy-mode";
|
|
12
15
|
const localeMap = {
|
|
@@ -15,7 +18,7 @@ const localeMap = {
|
|
|
15
18
|
it: "it-CH",
|
|
16
19
|
en: "en-GB"
|
|
17
20
|
};
|
|
18
|
-
export default function(providerElement, storage,
|
|
21
|
+
export default function(providerElement, storage, context, element, mainLayoutElement, visibleViewportElement) {
|
|
19
22
|
let cachedRootElement = null;
|
|
20
23
|
let cachedArtboardElement = null;
|
|
21
24
|
const interfaceLanguage = computed(() => {
|
|
@@ -25,9 +28,14 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
25
28
|
const lang = interfaceLanguage.value;
|
|
26
29
|
return localeMap[lang] || lang;
|
|
27
30
|
});
|
|
31
|
+
const viewportWidth = ref(window.innerWidth);
|
|
32
|
+
const viewportHeight = ref(window.innerHeight);
|
|
33
|
+
const visibleViewportWidth = ref(0);
|
|
34
|
+
const visibleViewportHeight = ref(0);
|
|
35
|
+
const visibleViewportX = ref(0);
|
|
36
|
+
const visibleViewportY = ref(0);
|
|
28
37
|
const isProxyMode = ref(false);
|
|
29
|
-
const
|
|
30
|
-
const hasDialogOpen = ref(false);
|
|
38
|
+
const currentDialog = ref(null);
|
|
31
39
|
const openTooltip = ref("");
|
|
32
40
|
const hasTransformOverlayOpen = ref(false);
|
|
33
41
|
const isAnimating = ref(false);
|
|
@@ -35,6 +43,15 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
35
43
|
const transformLabel = ref("");
|
|
36
44
|
const openContextMenu = ref("");
|
|
37
45
|
const banners = ref({});
|
|
46
|
+
function openDialog(dialog) {
|
|
47
|
+
currentDialog.value = dialog;
|
|
48
|
+
}
|
|
49
|
+
function closeDialog(id) {
|
|
50
|
+
if (!id || currentDialog.value?.id === id) {
|
|
51
|
+
currentDialog.value = null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const hasDialogOpen = computed(() => currentDialog.value !== null);
|
|
38
55
|
function setBannerHeight(id, height) {
|
|
39
56
|
banners.value[id] = height;
|
|
40
57
|
}
|
|
@@ -62,17 +79,42 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
62
79
|
y: 0
|
|
63
80
|
});
|
|
64
81
|
const artboardScale = ref(1);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
82
|
+
const resizeElementMap = /* @__PURE__ */ new WeakMap();
|
|
83
|
+
let visibleViewportResizeTimeout = null;
|
|
84
|
+
function updateVisibleViewport() {
|
|
85
|
+
if (!visibleViewportElement.value) {
|
|
68
86
|
return;
|
|
69
87
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
const rect = visibleViewportElement.value.getBoundingClientRect();
|
|
89
|
+
visibleViewportWidth.value = rect.width;
|
|
90
|
+
visibleViewportHeight.value = rect.height;
|
|
91
|
+
visibleViewportX.value = rect.x;
|
|
92
|
+
visibleViewportY.value = rect.y;
|
|
93
|
+
}
|
|
94
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
95
|
+
for (const entry of entries) {
|
|
96
|
+
const size = entry.contentBoxSize[0];
|
|
97
|
+
if (!size) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const key = resizeElementMap.get(entry.target);
|
|
101
|
+
if (!key) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (key === "artboard") {
|
|
105
|
+
artboardSize.value.width = size.inlineSize;
|
|
106
|
+
artboardSize.value.height = size.blockSize;
|
|
107
|
+
} else if (key === "visible-viewport") {
|
|
108
|
+
visibleViewportWidth.value = size.inlineSize;
|
|
109
|
+
visibleViewportHeight.value = size.blockSize;
|
|
110
|
+
if (visibleViewportResizeTimeout) {
|
|
111
|
+
window.clearTimeout(visibleViewportResizeTimeout);
|
|
112
|
+
}
|
|
113
|
+
visibleViewportResizeTimeout = window.setTimeout(() => {
|
|
114
|
+
updateVisibleViewport();
|
|
115
|
+
}, 50);
|
|
116
|
+
}
|
|
73
117
|
}
|
|
74
|
-
artboardSize.value.width = size.inlineSize;
|
|
75
|
-
artboardSize.value.height = size.blockSize;
|
|
76
118
|
});
|
|
77
119
|
const setViewportBlockingRectangle = (key, rect) => {
|
|
78
120
|
if (!rect) {
|
|
@@ -117,8 +159,6 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
117
159
|
}
|
|
118
160
|
return "desktop";
|
|
119
161
|
});
|
|
120
|
-
const viewportWidth = ref(window.innerWidth);
|
|
121
|
-
const viewportHeight = ref(window.innerHeight);
|
|
122
162
|
const isMobile = computed(() => appViewport.value === "mobile");
|
|
123
163
|
const isDesktop = computed(() => appViewport.value === "desktop");
|
|
124
164
|
let resizeTimeout = null;
|
|
@@ -130,12 +170,6 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
130
170
|
eventBus.emit("ui:resized");
|
|
131
171
|
}, 400);
|
|
132
172
|
};
|
|
133
|
-
const toolbarHeight = computed(() => {
|
|
134
|
-
if (isMobile.value) {
|
|
135
|
-
return 80;
|
|
136
|
-
}
|
|
137
|
-
return 50;
|
|
138
|
-
});
|
|
139
173
|
const activeSidebarsLeft = ref([]);
|
|
140
174
|
const activeSidebarsRight = ref([]);
|
|
141
175
|
function setActiveSidebar(region, id) {
|
|
@@ -168,55 +202,10 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
168
202
|
const hasSidebarRight = computed(() => {
|
|
169
203
|
return !!activeSidebarsRight.value.length;
|
|
170
204
|
});
|
|
171
|
-
const settingsStorage = storage.use("feature:add-list:settings", {
|
|
172
|
-
orientation: "vertical"
|
|
173
|
-
});
|
|
174
|
-
const addListOrientation = computed(
|
|
175
|
-
() => isMobile.value ? "horizontal" : settingsStorage.value.orientation
|
|
176
|
-
);
|
|
177
|
-
const visibleViewportX = computed(() => {
|
|
178
|
-
let x = 0;
|
|
179
|
-
if (!isMobile.value) {
|
|
180
|
-
if (addListOrientation.value === "vertical" && state.editMode.value === "editing") {
|
|
181
|
-
x += 70;
|
|
182
|
-
}
|
|
183
|
-
if (hasSidebarLeft.value) {
|
|
184
|
-
x += 400;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return x;
|
|
188
|
-
});
|
|
189
|
-
const visibleViewportY = computed(() => {
|
|
190
|
-
return toolbarHeight.value;
|
|
191
|
-
});
|
|
192
|
-
const visibleViewportWidth = computed(() => {
|
|
193
|
-
if (isMobile.value) {
|
|
194
|
-
return viewportWidth.value;
|
|
195
|
-
}
|
|
196
|
-
let width = viewportWidth.value - visibleViewportX.value - 50;
|
|
197
|
-
if (hasSidebarRight.value) {
|
|
198
|
-
width -= 351;
|
|
199
|
-
}
|
|
200
|
-
return width;
|
|
201
|
-
});
|
|
202
|
-
const visibleViewportHeight = computed(() => {
|
|
203
|
-
let height = viewportHeight.value - visibleViewportY.value;
|
|
204
|
-
if (addListOrientation.value === "horizontal") {
|
|
205
|
-
if (isMobile.value) {
|
|
206
|
-
height -= 50;
|
|
207
|
-
} else {
|
|
208
|
-
height -= 70;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
const bannerHeights = Object.values(banners.value).filter(Boolean);
|
|
212
|
-
bannerHeights.forEach((bannerHeight) => {
|
|
213
|
-
height -= bannerHeight;
|
|
214
|
-
});
|
|
215
|
-
height -= bannerHeights.length * 10;
|
|
216
|
-
return height;
|
|
217
|
-
});
|
|
218
205
|
const blockingPaddingX = computed(() => 15);
|
|
219
206
|
const blockingPaddingY = computed(() => 50);
|
|
207
|
+
const viewportPadding = computed(() => 10);
|
|
208
|
+
const scrollbarWidth = computed(() => 16);
|
|
220
209
|
const viewportBlockingRects = computed(() => {
|
|
221
210
|
return Object.values(viewportBlockingRectsMap.value).map((rect) => {
|
|
222
211
|
if (!rect) {
|
|
@@ -239,11 +228,12 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
239
228
|
};
|
|
240
229
|
});
|
|
241
230
|
const visibleViewportPadded = computed(() => {
|
|
231
|
+
const p = viewportPadding.value;
|
|
242
232
|
return {
|
|
243
|
-
x: visibleViewportX.value +
|
|
244
|
-
y: visibleViewportY.value +
|
|
245
|
-
width: visibleViewportWidth.value -
|
|
246
|
-
height: visibleViewportHeight.value -
|
|
233
|
+
x: visibleViewportX.value + p,
|
|
234
|
+
y: visibleViewportY.value + p,
|
|
235
|
+
width: visibleViewportWidth.value - 2 * p,
|
|
236
|
+
height: visibleViewportHeight.value - 2 * p
|
|
247
237
|
};
|
|
248
238
|
});
|
|
249
239
|
const viewport = computed(() => {
|
|
@@ -303,18 +293,31 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
303
293
|
addElementClasses(document.body, "bk-body");
|
|
304
294
|
addElementClasses(document.documentElement, CLASS_PROXY_MODE, isProxyMode);
|
|
305
295
|
addElementClasses(document.documentElement, "bk-is-analyzing", isAnalyzing);
|
|
296
|
+
function observeElement(element2, key) {
|
|
297
|
+
resizeElementMap.set(element2, key);
|
|
298
|
+
resizeObserver.observe(element2);
|
|
299
|
+
}
|
|
300
|
+
watch(
|
|
301
|
+
visibleViewportElement,
|
|
302
|
+
(el) => {
|
|
303
|
+
if (el) {
|
|
304
|
+
observeElement(el, "visible-viewport");
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
immediate: true
|
|
309
|
+
}
|
|
310
|
+
);
|
|
306
311
|
onMounted(() => {
|
|
307
312
|
viewportWidth.value = window.innerWidth;
|
|
308
313
|
viewportHeight.value = window.innerHeight;
|
|
309
314
|
window.addEventListener("resize", onResize);
|
|
310
315
|
const artboard = artboardElement();
|
|
311
|
-
|
|
316
|
+
observeElement(artboard, "artboard");
|
|
312
317
|
});
|
|
313
318
|
onBeforeUnmount(() => {
|
|
314
319
|
window.removeEventListener("resize", onResize);
|
|
315
320
|
clearTimeout(resizeTimeout);
|
|
316
|
-
const artboard = artboardElement();
|
|
317
|
-
resizeObserver.unobserve(artboard);
|
|
318
321
|
resizeObserver.disconnect();
|
|
319
322
|
});
|
|
320
323
|
const hasTooltipOpen = computed(() => !!openTooltip.value);
|
|
@@ -331,12 +334,9 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
331
334
|
const selectionColor = computed(() => {
|
|
332
335
|
return selectionColors.value[selectionColors.value.length - 1]?.color ?? null;
|
|
333
336
|
});
|
|
337
|
+
defineElementStyle("--bk-viewport-padding", viewportPadding);
|
|
338
|
+
defineElementStyle("--bk-scrollbar-width", scrollbarWidth);
|
|
334
339
|
return {
|
|
335
|
-
menu: {
|
|
336
|
-
isOpen: menuIsOpen,
|
|
337
|
-
close: () => menuIsOpen.value = false,
|
|
338
|
-
open: () => menuIsOpen.value = true
|
|
339
|
-
},
|
|
340
340
|
artboardElement,
|
|
341
341
|
rootElement,
|
|
342
342
|
providerElement,
|
|
@@ -350,8 +350,6 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
350
350
|
useAnimations,
|
|
351
351
|
visibleViewport,
|
|
352
352
|
visibleViewportPadded,
|
|
353
|
-
toolbarHeight,
|
|
354
|
-
addListOrientation,
|
|
355
353
|
setViewportBlockingRectangle,
|
|
356
354
|
viewportBlockingRects,
|
|
357
355
|
appViewport,
|
|
@@ -380,6 +378,10 @@ export default function(providerElement, storage, state, context, element) {
|
|
|
380
378
|
setActiveSidebar,
|
|
381
379
|
removeActiveSidebar,
|
|
382
380
|
hasSidebarLeft,
|
|
383
|
-
hasSidebarRight
|
|
381
|
+
hasSidebarRight,
|
|
382
|
+
mainLayoutElement,
|
|
383
|
+
openDialog,
|
|
384
|
+
closeDialog,
|
|
385
|
+
currentDialog: readonly(currentDialog)
|
|
384
386
|
};
|
|
385
387
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.76,8.69A0.76,0.76 0 0,0 10,9.45V20.9C10,21.32 10.34,21.66 10.76,21.66C10.95,21.66 11.11,21.6 11.24,21.5L13.15,19.95L14.81,23.57C14.94,23.84 15.21,24 15.5,24C15.61,24 15.72,24 15.83,23.92L18.59,22.64C18.97,22.46 19.15,22 18.95,21.63L17.28,18L19.69,17.55C19.85,17.5 20,17.43 20.12,17.29C20.39,16.97 20.35,16.5 20,16.21L11.26,8.86L11.25,8.87C11.12,8.76 10.95,8.69 10.76,8.69M15,10V8H20V10H15M13.83,4.76L16.66,1.93L18.07,3.34L15.24,6.17L13.83,4.76M10,0H12V5H10V0M3.93,14.66L6.76,11.83L8.17,13.24L5.34,16.07L3.93,14.66M3.93,3.34L5.34,1.93L8.17,4.76L6.76,6.17L3.93,3.34M7,10H2V8H7V10" /></svg>
|
|
@@ -707,6 +707,7 @@ export interface DraggableNewItem {
|
|
|
707
707
|
export interface DraggableActionItem {
|
|
708
708
|
itemType: 'action';
|
|
709
709
|
actionType: string;
|
|
710
|
+
action: AddAction;
|
|
710
711
|
itemBundle?: string;
|
|
711
712
|
element: () => HTMLElement;
|
|
712
713
|
}
|
|
@@ -909,8 +910,7 @@ export type BlokkliFieldElement = {
|
|
|
909
910
|
dropAlignment: FieldDropAlignment | null;
|
|
910
911
|
};
|
|
911
912
|
export type FieldDropAlignment = 'vertical' | 'horizontal';
|
|
912
|
-
export type
|
|
913
|
-
id: string;
|
|
913
|
+
export type ActionPlacedData = {
|
|
914
914
|
preceedingUuid?: string;
|
|
915
915
|
host: DraggableHostData;
|
|
916
916
|
field: BlokkliFieldElement;
|
|
@@ -1006,6 +1006,7 @@ export type EventbusEvents = {
|
|
|
1006
1006
|
'select:toggle': string;
|
|
1007
1007
|
'select:shiftToggle': string;
|
|
1008
1008
|
'select:end': string[] | undefined;
|
|
1009
|
+
'overlay:close': undefined;
|
|
1009
1010
|
'item:dropped': undefined;
|
|
1010
1011
|
'block:append': BlockAppendEvent;
|
|
1011
1012
|
'item:doubleClick': RenderedFieldListItem;
|
|
@@ -1029,7 +1030,6 @@ export type EventbusEvents = {
|
|
|
1029
1030
|
'drop:clipboardItem': DropClipboardItemEvent;
|
|
1030
1031
|
'sidebar:close': undefined;
|
|
1031
1032
|
'sidebar:open': string;
|
|
1032
|
-
'action:placed': ActionPlacedEvent;
|
|
1033
1033
|
'action:selected': undefined;
|
|
1034
1034
|
'animator:add': AnimatorAddEvent;
|
|
1035
1035
|
'ui:resized': undefined;
|
|
@@ -1126,7 +1126,6 @@ export type AssistantResultMarkup = {
|
|
|
1126
1126
|
content: string;
|
|
1127
1127
|
};
|
|
1128
1128
|
export type AssistantResult = AssistantResultMarkup;
|
|
1129
|
-
export type AddListOrientation = 'horizontal' | 'vertical' | 'sidebar';
|
|
1130
1129
|
export type AdapterMethods = keyof BlokkliAdapter<any>;
|
|
1131
1130
|
export type FeatureDefinitionSettingRadiosOption = {
|
|
1132
1131
|
label: string;
|
|
@@ -1359,7 +1358,8 @@ export type AddAction = {
|
|
|
1359
1358
|
itemBundle?: string;
|
|
1360
1359
|
title: string;
|
|
1361
1360
|
description?: string;
|
|
1362
|
-
|
|
1361
|
+
callback: (action: ActionPlacedData) => void;
|
|
1362
|
+
enabled?: (item: RenderedFieldListItem) => boolean;
|
|
1363
1363
|
};
|
|
1364
1364
|
export type BlockEditContext = {
|
|
1365
1365
|
isPublished: boolean;
|
|
@@ -1382,6 +1382,9 @@ export type RenderedFieldListItem = {
|
|
|
1382
1382
|
libraryItemUuid: string;
|
|
1383
1383
|
reusableBundle: string;
|
|
1384
1384
|
} | null;
|
|
1385
|
+
fragment: {
|
|
1386
|
+
name: BlokkliFragmentName;
|
|
1387
|
+
} | null;
|
|
1385
1388
|
isNested: boolean;
|
|
1386
1389
|
publishOn?: string | null;
|
|
1387
1390
|
unpublishOn?: string | null;
|
|
@@ -1400,5 +1403,9 @@ export type RegisteredField = {
|
|
|
1400
1403
|
export type RegisterFieldData = Pick<RegisteredField, 'fieldListType' | 'allowedFragments' | 'isNested' | 'nestingLevel' | 'dropAlignment'>;
|
|
1401
1404
|
export type VueClassProp = string | Record<string, boolean> | VueClassProp[];
|
|
1402
1405
|
export type SidebarRegion = 'left' | 'right';
|
|
1406
|
+
export type GlobalUiDialog = {
|
|
1407
|
+
id: string;
|
|
1408
|
+
alignment: 'left' | 'right' | 'center';
|
|
1409
|
+
};
|
|
1403
1410
|
declare const _default: {};
|
|
1404
1411
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Teleport v-if="shouldRender" :key="renderKey" to="#blokkli-add-list-actions">
|
|
3
|
-
<AddListItem
|
|
4
|
-
:id="type"
|
|
5
|
-
ref="item"
|
|
6
|
-
:label="title"
|
|
7
|
-
:icon="icon"
|
|
8
|
-
:orientation="ui.addListOrientation.value"
|
|
9
|
-
:color="color"
|
|
10
|
-
:disabled="disabled"
|
|
11
|
-
data-element-type="action"
|
|
12
|
-
:data-action-type="type"
|
|
13
|
-
:data-item-bundle="itemBundle"
|
|
14
|
-
no-context-menu
|
|
15
|
-
/>
|
|
16
|
-
</Teleport>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script setup>
|
|
20
|
-
import {
|
|
21
|
-
computed,
|
|
22
|
-
useBlokkli,
|
|
23
|
-
nextTick,
|
|
24
|
-
ref,
|
|
25
|
-
onMounted,
|
|
26
|
-
onBeforeUnmount
|
|
27
|
-
} from "#imports";
|
|
28
|
-
import { AddListItem } from "#blokkli/components";
|
|
29
|
-
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
30
|
-
import defineTourItem from "#blokkli/helpers/composables/defineTourItem";
|
|
31
|
-
const props = defineProps({
|
|
32
|
-
type: { type: String, required: true },
|
|
33
|
-
title: { type: String, required: true },
|
|
34
|
-
icon: { type: null, required: true },
|
|
35
|
-
itemBundle: { type: String, required: false },
|
|
36
|
-
color: { type: String, required: true },
|
|
37
|
-
description: { type: String, required: false },
|
|
38
|
-
disabled: { type: Boolean, required: false },
|
|
39
|
-
weight: { type: Number, required: false }
|
|
40
|
-
});
|
|
41
|
-
const item = ref(null);
|
|
42
|
-
const emit = defineEmits(["placed"]);
|
|
43
|
-
const { ui, state, features, plugins } = useBlokkli();
|
|
44
|
-
const addListAvailable = computed(
|
|
45
|
-
() => !!features.mountedFeatures.value.find((v) => v.id === "add-list")
|
|
46
|
-
);
|
|
47
|
-
const shouldRender = computed(
|
|
48
|
-
() => addListAvailable.value && state.editMode.value === "editing"
|
|
49
|
-
);
|
|
50
|
-
const renderKey = ref("");
|
|
51
|
-
onBlokkliEvent("add-list:change", () => {
|
|
52
|
-
nextTick(() => {
|
|
53
|
-
renderKey.value = Math.round(Math.random() * 1e9).toString();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
onBlokkliEvent("action:placed", (e) => {
|
|
57
|
-
if (e.id !== props.type) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
emit("placed", e);
|
|
61
|
-
});
|
|
62
|
-
defineTourItem(() => {
|
|
63
|
-
if (!props.description) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
id: "plugin:add_action:" + props.type,
|
|
68
|
-
title: props.title,
|
|
69
|
-
text: props.description,
|
|
70
|
-
element: () => item.value?.getElement()
|
|
71
|
-
};
|
|
72
|
-
});
|
|
73
|
-
function addActionFunction() {
|
|
74
|
-
return {
|
|
75
|
-
id: props.type,
|
|
76
|
-
icon: props.icon,
|
|
77
|
-
color: props.color,
|
|
78
|
-
itemBundle: props.itemBundle,
|
|
79
|
-
title: props.title,
|
|
80
|
-
description: props.description,
|
|
81
|
-
enabled: !props.disabled
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
onMounted(() => {
|
|
85
|
-
plugins.addAddAction(addActionFunction);
|
|
86
|
-
});
|
|
87
|
-
onBeforeUnmount(() => {
|
|
88
|
-
plugins.removeAddAction(addActionFunction);
|
|
89
|
-
});
|
|
90
|
-
</script>
|
|
91
|
-
|
|
92
|
-
<script>
|
|
93
|
-
export default {
|
|
94
|
-
name: "PluginAddAction"
|
|
95
|
-
};
|
|
96
|
-
</script>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { BlokkliIcon } from '#blokkli-build/icons';
|
|
2
|
-
import type { ActionPlacedEvent } from '#blokkli/types';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<{
|
|
4
|
-
type: string;
|
|
5
|
-
title: string;
|
|
6
|
-
icon: BlokkliIcon;
|
|
7
|
-
itemBundle?: string;
|
|
8
|
-
color: "rose" | "lime" | "accent";
|
|
9
|
-
description?: string;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
weight?: number;
|
|
12
|
-
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
13
|
-
placed: (data: ActionPlacedEvent) => any;
|
|
14
|
-
}, string, import("vue").PublicProps, Readonly<{
|
|
15
|
-
type: string;
|
|
16
|
-
title: string;
|
|
17
|
-
icon: BlokkliIcon;
|
|
18
|
-
itemBundle?: string;
|
|
19
|
-
color: "rose" | "lime" | "accent";
|
|
20
|
-
description?: string;
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
weight?: number;
|
|
23
|
-
}> & Readonly<{
|
|
24
|
-
onPlaced?: ((data: ActionPlacedEvent) => any) | undefined;
|
|
25
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
|
-
export default _default;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Teleport :to="to">
|
|
3
|
-
<button
|
|
4
|
-
:id="'bk-menu-list-button-' + id"
|
|
5
|
-
class="bk-menu-list-button"
|
|
6
|
-
:disabled="disabled"
|
|
7
|
-
:class="type ? 'bk-is-' + type : ''"
|
|
8
|
-
:style="{ order: weight || 0 }"
|
|
9
|
-
@click.prevent.stop="onClick"
|
|
10
|
-
>
|
|
11
|
-
<div class="bk-menu-list-icon">
|
|
12
|
-
<slot>
|
|
13
|
-
<Icon v-if="icon" :name="icon" />
|
|
14
|
-
</slot>
|
|
15
|
-
</div>
|
|
16
|
-
<strong>{{ title }}</strong>
|
|
17
|
-
<span>{{ description }}</span>
|
|
18
|
-
</button>
|
|
19
|
-
</Teleport>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script setup>
|
|
23
|
-
import { computed, useBlokkli } from "#imports";
|
|
24
|
-
import { Icon } from "#blokkli/components";
|
|
25
|
-
import defineCommands from "#blokkli/helpers/composables/defineCommands";
|
|
26
|
-
const props = defineProps({
|
|
27
|
-
id: { type: String, required: true },
|
|
28
|
-
title: { type: String, required: true },
|
|
29
|
-
description: { type: String, required: true },
|
|
30
|
-
disabled: { type: Boolean, required: false },
|
|
31
|
-
icon: { type: null, required: false },
|
|
32
|
-
type: { type: String, required: false },
|
|
33
|
-
weight: { type: Number, required: false },
|
|
34
|
-
secondary: { type: Boolean, required: false }
|
|
35
|
-
});
|
|
36
|
-
const emit = defineEmits(["click"]);
|
|
37
|
-
const { ui, debug } = useBlokkli();
|
|
38
|
-
const logger = debug.createLogger("PluginMenuButton");
|
|
39
|
-
const to = computed(
|
|
40
|
-
() => `#bk-menu-${props.secondary ? "secondary" : "primary"}`
|
|
41
|
-
);
|
|
42
|
-
function onClick() {
|
|
43
|
-
ui.menu.close();
|
|
44
|
-
logger.log("Click " + props.id);
|
|
45
|
-
emit("click");
|
|
46
|
-
}
|
|
47
|
-
const commandCallback = () => {
|
|
48
|
-
if (!props.disabled) {
|
|
49
|
-
emit("click");
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
defineCommands(() => {
|
|
53
|
-
return {
|
|
54
|
-
id: "plugin:menu_button:" + props.id,
|
|
55
|
-
group: "action",
|
|
56
|
-
label: props.title,
|
|
57
|
-
icon: props.icon,
|
|
58
|
-
disabled: props.disabled,
|
|
59
|
-
callback: commandCallback
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<script>
|
|
65
|
-
export default {
|
|
66
|
-
name: "PluginMenuButton"
|
|
67
|
-
};
|
|
68
|
-
</script>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="bk-list-item-icon"
|
|
4
|
-
:class="['bk-is-' + color, 'bk-is-' + orientation]"
|
|
5
|
-
>
|
|
6
|
-
<Icon v-if="icon" :name="icon" />
|
|
7
|
-
<ItemIcon v-else-if="bundle" :bundle="bundle" />
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script setup>
|
|
12
|
-
import { ItemIcon, Icon } from "#blokkli/components";
|
|
13
|
-
defineProps({
|
|
14
|
-
icon: { type: null, required: false, default: void 0 },
|
|
15
|
-
bundle: { type: String, required: false, default: void 0 },
|
|
16
|
-
color: { type: String, required: false, default: "default" },
|
|
17
|
-
orientation: { type: String, required: false, default: "horizontal" }
|
|
18
|
-
});
|
|
19
|
-
</script>
|