@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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { onBeforeUnmount, onMounted, useBlokkli } from "#imports";
|
|
2
|
+
export default function(cb) {
|
|
3
|
+
const { plugins } = useBlokkli();
|
|
4
|
+
onMounted(() => {
|
|
5
|
+
plugins.add("addAction", cb);
|
|
6
|
+
});
|
|
7
|
+
onBeforeUnmount(() => {
|
|
8
|
+
plugins.remove("addAction", cb);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -2,9 +2,9 @@ import { onBeforeUnmount, onMounted, useBlokkli } from "#imports";
|
|
|
2
2
|
export default function(cb) {
|
|
3
3
|
const { plugins } = useBlokkli();
|
|
4
4
|
onMounted(() => {
|
|
5
|
-
plugins.
|
|
5
|
+
plugins.add("itemDropdownAction", cb);
|
|
6
6
|
});
|
|
7
7
|
onBeforeUnmount(() => {
|
|
8
|
-
plugins.
|
|
8
|
+
plugins.remove("itemDropdownAction", cb);
|
|
9
9
|
});
|
|
10
10
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { onBeforeUnmount, onMounted, useBlokkli } from "#imports";
|
|
2
|
+
export default function(cb) {
|
|
3
|
+
const { plugins } = useBlokkli();
|
|
4
|
+
onMounted(() => {
|
|
5
|
+
plugins.add("menuButton", cb);
|
|
6
|
+
});
|
|
7
|
+
onBeforeUnmount(() => {
|
|
8
|
+
plugins.remove("menuButton", cb);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { computed, useBlokkli } from "#imports";
|
|
2
|
+
export function useDialog(id, alignment) {
|
|
3
|
+
const { ui } = useBlokkli();
|
|
4
|
+
return computed({
|
|
5
|
+
get() {
|
|
6
|
+
return ui.currentDialog.value?.id === id;
|
|
7
|
+
},
|
|
8
|
+
set(isOpen) {
|
|
9
|
+
if (isOpen) {
|
|
10
|
+
ui.openDialog({ id, alignment });
|
|
11
|
+
} else {
|
|
12
|
+
ui.closeDialog(id);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
onBeforeUnmount,
|
|
3
|
+
watch,
|
|
4
|
+
computed,
|
|
5
|
+
unref
|
|
6
|
+
} from "#imports";
|
|
7
|
+
export function defineElementStyle(property, providedValue, providedElement) {
|
|
8
|
+
const element = providedElement ?? document.documentElement;
|
|
9
|
+
const value = computed(() => {
|
|
10
|
+
if (typeof providedValue === "function") {
|
|
11
|
+
return providedValue();
|
|
12
|
+
}
|
|
13
|
+
return unref(providedValue);
|
|
14
|
+
});
|
|
15
|
+
const originalValue = element.style.getPropertyValue(property);
|
|
16
|
+
watch(
|
|
17
|
+
value,
|
|
18
|
+
function(newValue) {
|
|
19
|
+
const styleValue = typeof newValue === "number" ? newValue + "px" : newValue;
|
|
20
|
+
element.style.setProperty(property, styleValue);
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
immediate: true
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
onBeforeUnmount(() => {
|
|
27
|
+
if (originalValue) {
|
|
28
|
+
element.style.setProperty(property, originalValue);
|
|
29
|
+
} else {
|
|
30
|
+
element.style.removeProperty(property);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -27,6 +27,10 @@ export default function(ui, debug, definitions, state, element) {
|
|
|
27
27
|
let initTimeout = null;
|
|
28
28
|
const isInitalizing = ref(true);
|
|
29
29
|
const observedElementCache = /* @__PURE__ */ new Map();
|
|
30
|
+
function getBoundingClientRect(element2) {
|
|
31
|
+
logger.log("getBoundingClientRect", element2);
|
|
32
|
+
return element2.getBoundingClientRect();
|
|
33
|
+
}
|
|
30
34
|
const registeredBlockUuids = computed(() => {
|
|
31
35
|
return Object.entries(registeredBlocks).map(([uuid, element2]) => {
|
|
32
36
|
if (element2) {
|
|
@@ -219,7 +223,7 @@ export default function(ui, debug, definitions, state, element) {
|
|
|
219
223
|
if (!el) {
|
|
220
224
|
return "";
|
|
221
225
|
}
|
|
222
|
-
if ("itemType" in item && item.itemType !== "
|
|
226
|
+
if ("itemType" in item && item.itemType !== "existing_structure") {
|
|
223
227
|
return el.outerHTML;
|
|
224
228
|
}
|
|
225
229
|
const childCount = element.queryAll(
|
|
@@ -551,6 +555,7 @@ export default function(ui, debug, definitions, state, element) {
|
|
|
551
555
|
registeredBlockUuids,
|
|
552
556
|
getDebugData,
|
|
553
557
|
getRegisteredField,
|
|
554
|
-
registeredBlocks: computed(() => registeredBlocks)
|
|
558
|
+
registeredBlocks: computed(() => registeredBlocks),
|
|
559
|
+
getBoundingClientRect
|
|
555
560
|
};
|
|
556
561
|
}
|
|
@@ -3,4 +3,4 @@ export type Orientation = 'horizontal' | 'vertical';
|
|
|
3
3
|
export declare const MIN_GAP = 20;
|
|
4
4
|
export declare function getGapSize(orientation: Orientation, element: HTMLElement): number;
|
|
5
5
|
export declare function getChildrenOrientation(element: HTMLElement): Orientation;
|
|
6
|
-
export declare function determineCanAddChildren(field: BlokkliFieldElement, children: HTMLElement[], uuids: string[], currentCount: number, itemsToAdd: number, draggingBundles?: string[]): boolean;
|
|
6
|
+
export declare function determineCanAddChildren(field: BlokkliFieldElement, children: HTMLElement[], uuids: string[], currentCount: number, itemsToAdd: number, draggingBundles?: string[], draggingFragments?: string[]): boolean;
|
|
@@ -2,7 +2,7 @@ export const MIN_GAP = 20;
|
|
|
2
2
|
export function getGapSize(orientation, element) {
|
|
3
3
|
const computedStyle = window.getComputedStyle(element);
|
|
4
4
|
if (computedStyle.display.includes("grid") || computedStyle.display.includes("flex")) {
|
|
5
|
-
const gap = orientation === "vertical" ? computedStyle.
|
|
5
|
+
const gap = orientation === "vertical" ? computedStyle.rowGap || computedStyle.gridRowGap : computedStyle.columnGap || computedStyle.gridColumnGap;
|
|
6
6
|
if (gap) {
|
|
7
7
|
const gapParts = gap.split(" ");
|
|
8
8
|
const gapValue = gapParts[0];
|
|
@@ -31,7 +31,7 @@ export function getChildrenOrientation(element) {
|
|
|
31
31
|
}
|
|
32
32
|
return "vertical";
|
|
33
33
|
}
|
|
34
|
-
export function determineCanAddChildren(field, children, uuids, currentCount, itemsToAdd, draggingBundles) {
|
|
34
|
+
export function determineCanAddChildren(field, children, uuids, currentCount, itemsToAdd, draggingBundles, draggingFragments) {
|
|
35
35
|
if (field.cardinality !== -1) {
|
|
36
36
|
const childrenThatAreSelection = children.filter((child) => {
|
|
37
37
|
const uuid = child.dataset.bkUuid;
|
|
@@ -45,5 +45,19 @@ export function determineCanAddChildren(field, children, uuids, currentCount, it
|
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
if (!draggingBundles?.length) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
const bundlesAllowed = draggingBundles.every(
|
|
52
|
+
(bundle) => field.allowedBundles.includes(bundle)
|
|
53
|
+
);
|
|
54
|
+
if (!bundlesAllowed) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (draggingFragments?.length && field.allowedFragments.length > 0) {
|
|
58
|
+
return draggingFragments.every(
|
|
59
|
+
(fragment) => field.allowedFragments.includes(fragment)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
49
63
|
}
|
|
@@ -14,13 +14,32 @@ export type ItemDropdownAction = {
|
|
|
14
14
|
callback: () => void;
|
|
15
15
|
};
|
|
16
16
|
type ItemDropdownActionFunction = PluginAddFunction<ItemDropdownAction>;
|
|
17
|
+
export type MenuButtonPlugin = {
|
|
18
|
+
id: string;
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
icon?: BlokkliIcon;
|
|
22
|
+
type?: 'success' | 'danger' | 'yellow';
|
|
23
|
+
weight?: number;
|
|
24
|
+
secondary?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
callback: () => void;
|
|
27
|
+
};
|
|
28
|
+
type MenuButtonFunction = PluginAddFunction<MenuButtonPlugin>;
|
|
29
|
+
type PluginFunctionMap = {
|
|
30
|
+
addAction: AddActionFunction;
|
|
31
|
+
itemDropdownAction: ItemDropdownActionFunction;
|
|
32
|
+
menuButton: MenuButtonFunction;
|
|
33
|
+
};
|
|
34
|
+
type PluginDataMap = {
|
|
35
|
+
addAction: AddAction;
|
|
36
|
+
itemDropdownAction: ItemDropdownAction;
|
|
37
|
+
menuButton: MenuButtonPlugin;
|
|
38
|
+
};
|
|
17
39
|
export type PluginProvider = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
addItemDropdownAction: (fn: ItemDropdownActionFunction) => void;
|
|
22
|
-
removeItemDropdownAction: (fn: ItemDropdownActionFunction) => void;
|
|
23
|
-
getItemDropdownActions: () => ItemDropdownAction[];
|
|
40
|
+
add<T extends keyof PluginFunctionMap>(type: T, fn: PluginFunctionMap[T]): void;
|
|
41
|
+
remove<T extends keyof PluginFunctionMap>(type: T, fn: PluginFunctionMap[T]): void;
|
|
42
|
+
get<T extends keyof PluginDataMap>(type: T): PluginDataMap[T][];
|
|
24
43
|
};
|
|
25
44
|
export default function (): PluginProvider;
|
|
26
45
|
export {};
|
|
@@ -1,62 +1,64 @@
|
|
|
1
|
+
import { ref } from "#imports";
|
|
1
2
|
export default function() {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (let i = 0; i < addActions.length; i++) {
|
|
13
|
-
const callback = addActions[i];
|
|
14
|
-
if (!callback) {
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
const result = callback();
|
|
18
|
-
if (!result) {
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
if (Array.isArray(result)) {
|
|
22
|
-
actions.push(...result);
|
|
23
|
-
} else {
|
|
24
|
-
actions.push(result);
|
|
25
|
-
}
|
|
3
|
+
const addActionPlugins = ref([]);
|
|
4
|
+
const itemDropdownActionPlugins = ref([]);
|
|
5
|
+
const menuButtonPlugins = ref([]);
|
|
6
|
+
function add(type, fn) {
|
|
7
|
+
if (type === "addAction") {
|
|
8
|
+
addActionPlugins.value.push(fn);
|
|
9
|
+
} else if (type === "itemDropdownAction") {
|
|
10
|
+
itemDropdownActionPlugins.value.push(fn);
|
|
11
|
+
} else if (type === "menuButton") {
|
|
12
|
+
menuButtonPlugins.value.push(fn);
|
|
26
13
|
}
|
|
27
|
-
return actions;
|
|
28
14
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
15
|
+
function remove(type, fn) {
|
|
16
|
+
if (type === "addAction") {
|
|
17
|
+
addActionPlugins.value = addActionPlugins.value.filter(
|
|
18
|
+
(v) => v !== fn
|
|
19
|
+
);
|
|
20
|
+
} else if (type === "itemDropdownAction") {
|
|
21
|
+
itemDropdownActionPlugins.value = itemDropdownActionPlugins.value.filter(
|
|
22
|
+
(v) => v !== fn
|
|
23
|
+
);
|
|
24
|
+
} else if (type === "menuButton") {
|
|
25
|
+
menuButtonPlugins.value = menuButtonPlugins.value.filter(
|
|
26
|
+
(v) => v !== fn
|
|
27
|
+
);
|
|
28
|
+
}
|
|
34
29
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
function get(type) {
|
|
31
|
+
let storage;
|
|
32
|
+
if (type === "addAction") {
|
|
33
|
+
storage = addActionPlugins.value;
|
|
34
|
+
} else if (type === "itemDropdownAction") {
|
|
35
|
+
storage = itemDropdownActionPlugins.value;
|
|
36
|
+
} else if (type === "menuButton") {
|
|
37
|
+
storage = menuButtonPlugins.value;
|
|
38
|
+
} else {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
const result = [];
|
|
42
|
+
for (let i = 0; i < storage.length; i++) {
|
|
43
|
+
const callback = storage[i];
|
|
39
44
|
if (!callback) {
|
|
40
45
|
continue;
|
|
41
46
|
}
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
47
|
+
const callbackResult = callback();
|
|
48
|
+
if (!callbackResult) {
|
|
44
49
|
continue;
|
|
45
50
|
}
|
|
46
|
-
if (Array.isArray(
|
|
47
|
-
|
|
51
|
+
if (Array.isArray(callbackResult)) {
|
|
52
|
+
result.push(...callbackResult);
|
|
48
53
|
} else {
|
|
49
|
-
|
|
54
|
+
result.push(callbackResult);
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
|
-
return
|
|
57
|
+
return result;
|
|
53
58
|
}
|
|
54
59
|
return {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
addItemDropdownAction,
|
|
59
|
-
removeItemDropdownAction,
|
|
60
|
-
getItemDropdownActions
|
|
60
|
+
add,
|
|
61
|
+
remove,
|
|
62
|
+
get
|
|
61
63
|
};
|
|
62
64
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { itemEntityType } from "#blokkli-build/config";
|
|
2
2
|
import onBlokkliEvent from "../composables/onBlokkliEvent.js";
|
|
3
|
+
import { BUNDLE_BLOKKLI_FRAGMENT } from "#blokkli/constants";
|
|
3
4
|
export default function(state, dom, context) {
|
|
4
5
|
const renderedFieldListItemCache = /* @__PURE__ */ new Map();
|
|
5
6
|
function getParentBlockBundle(field) {
|
|
@@ -26,6 +27,14 @@ export default function(state, dom, context) {
|
|
|
26
27
|
}
|
|
27
28
|
return null;
|
|
28
29
|
}
|
|
30
|
+
function getFragmentData(item) {
|
|
31
|
+
if (item.bundle === BUNDLE_BLOKKLI_FRAGMENT && item.props.name) {
|
|
32
|
+
return {
|
|
33
|
+
name: item.props.name
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
29
38
|
function getBlock(uuid) {
|
|
30
39
|
const cached = renderedFieldListItemCache.get(uuid);
|
|
31
40
|
if (cached) {
|
|
@@ -54,6 +63,7 @@ export default function(state, dom, context) {
|
|
|
54
63
|
isNested: fieldList.entityType === itemEntityType,
|
|
55
64
|
fieldListType: field?.fieldListType ?? "default",
|
|
56
65
|
library: getLibraryData(item),
|
|
66
|
+
fragment: getFragmentData(item),
|
|
57
67
|
parentBlockBundle,
|
|
58
68
|
host: {
|
|
59
69
|
type: fieldList.entityType,
|
|
@@ -3,6 +3,14 @@ import type { DomProvider } from '../domProvider.js';
|
|
|
3
3
|
import type { StateProvider } from '../stateProvider.js';
|
|
4
4
|
import type { BlockDefinitionProvider } from '../typesProvider.js';
|
|
5
5
|
export type FieldsProvider = {
|
|
6
|
-
find: (
|
|
6
|
+
find: (
|
|
7
|
+
/**
|
|
8
|
+
* The host entity UUID.
|
|
9
|
+
*/
|
|
10
|
+
uuid: string,
|
|
11
|
+
/**
|
|
12
|
+
* The name of the field.
|
|
13
|
+
*/
|
|
14
|
+
fieldName: string) => BlokkliFieldElement | undefined;
|
|
7
15
|
};
|
|
8
16
|
export default function (state: StateProvider, dom: DomProvider, types: BlockDefinitionProvider): FieldsProvider;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type Ref, type ComputedRef } from '
|
|
1
|
+
import { type Ref, type ComputedRef } from '#imports';
|
|
2
|
+
import type { ShallowRef } from 'vue';
|
|
2
3
|
import type { StorageProvider } from './storageProvider.js';
|
|
3
|
-
import type {
|
|
4
|
+
import type { Coord, GlobalUiDialog, Rectangle, SidebarRegion, Size } from '#blokkli/types';
|
|
4
5
|
import type { Viewport } from '#blokkli/constants';
|
|
5
|
-
import type { StateProvider } from './stateProvider.js';
|
|
6
6
|
import type { AdapterContext } from '#blokkli/adapter';
|
|
7
7
|
import type { ThemeColorName } from '#blokkli/types/theme';
|
|
8
8
|
import type { ElementProvider } from './providers/element.js';
|
|
@@ -10,17 +10,15 @@ export type UiProvider = {
|
|
|
10
10
|
rootElement: () => HTMLElement;
|
|
11
11
|
artboardElement: () => HTMLElement;
|
|
12
12
|
providerElement: HTMLElement;
|
|
13
|
-
menu: {
|
|
14
|
-
isOpen: Readonly<Ref<boolean>>;
|
|
15
|
-
close: () => void;
|
|
16
|
-
open: () => void;
|
|
17
|
-
};
|
|
18
13
|
isMobile: ComputedRef<boolean>;
|
|
19
14
|
isDesktop: ComputedRef<boolean>;
|
|
20
15
|
isAnimating: Ref<boolean>;
|
|
21
16
|
isAnalyzing: Ref<boolean>;
|
|
22
17
|
isProxyMode: Ref<boolean>;
|
|
23
|
-
hasDialogOpen:
|
|
18
|
+
hasDialogOpen: ComputedRef<boolean>;
|
|
19
|
+
currentDialog: Readonly<Ref<GlobalUiDialog | null>>;
|
|
20
|
+
openDialog: (dialog: GlobalUiDialog) => void;
|
|
21
|
+
closeDialog: (id?: string) => void;
|
|
24
22
|
hasTooltipOpen: ComputedRef<boolean>;
|
|
25
23
|
openTooltip: Ref<string>;
|
|
26
24
|
selectionColor: ComputedRef<ThemeColorName | null>;
|
|
@@ -32,10 +30,8 @@ export type UiProvider = {
|
|
|
32
30
|
transformLabel: ComputedRef<string>;
|
|
33
31
|
useAnimations: ComputedRef<boolean>;
|
|
34
32
|
lowPerformanceMode: ComputedRef<boolean>;
|
|
35
|
-
toolbarHeight: ComputedRef<number>;
|
|
36
33
|
visibleViewport: ComputedRef<Rectangle>;
|
|
37
34
|
visibleViewportPadded: ComputedRef<Rectangle>;
|
|
38
|
-
addListOrientation: ComputedRef<AddListOrientation>;
|
|
39
35
|
setViewportBlockingRectangle: (key: string, rect?: Rectangle) => void;
|
|
40
36
|
viewportBlockingRects: ComputedRef<Rectangle[]>;
|
|
41
37
|
appViewport: ComputedRef<Viewport>;
|
|
@@ -56,5 +52,6 @@ export type UiProvider = {
|
|
|
56
52
|
removeActiveSidebar: (region: SidebarRegion, id: string) => void;
|
|
57
53
|
hasSidebarLeft: ComputedRef<boolean>;
|
|
58
54
|
hasSidebarRight: ComputedRef<boolean>;
|
|
55
|
+
mainLayoutElement: Readonly<ShallowRef<HTMLDivElement | null>>;
|
|
59
56
|
};
|
|
60
|
-
export default function (providerElement: HTMLElement, storage: StorageProvider,
|
|
57
|
+
export default function (providerElement: HTMLElement, storage: StorageProvider, context: ComputedRef<AdapterContext>, element: ElementProvider, mainLayoutElement: Readonly<ShallowRef<HTMLDivElement | null>>, visibleViewportElement: Readonly<ShallowRef<HTMLDivElement | null>>): UiProvider;
|