@blokkli/editor 2.0.0-alpha.17 → 2.0.0-alpha.18
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 +380 -59
- package/dist/modules/drupal/graphql/base/fragment.paragraphsFieldItem.graphql +3 -1
- package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +1 -10
- package/dist/modules/drupal/graphql/mutations/set_paragraph_schedule.graphql +15 -0
- package/dist/modules/drupal/index.mjs +33 -0
- package/dist/modules/drupal/runtime/adapter/index.js +10 -2
- package/dist/runtime/adapter/index.d.ts +21 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +3 -0
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +23 -13
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +20 -44
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +10 -5
- package/dist/runtime/components/BlokkliEditable.vue +13 -13
- package/dist/runtime/components/BlokkliField.vue +3 -0
- package/dist/runtime/components/BlokkliField.vue.d.ts +3 -3
- package/dist/runtime/components/BlokkliItem.vue +1 -1
- package/dist/runtime/components/BlokkliItem.vue.d.ts +4 -2
- package/dist/runtime/components/BlokkliProvider.vue +12 -8
- package/dist/runtime/components/Edit/Actions/index.vue +27 -16
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +26 -10
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +3 -0
- package/dist/runtime/components/Edit/Dialog/index.vue +6 -4
- package/dist/runtime/components/Edit/DraggableList.vue +15 -7
- package/dist/runtime/components/Edit/DraggableList.vue.d.ts +5 -5
- package/dist/runtime/components/Edit/EditProvider.vue +29 -16
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +1 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +9 -11
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +9 -6
- package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue +1 -1
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -11
- package/dist/runtime/components/Edit/Features/Anchors/Renderer.vue +19 -102
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +3 -0
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +28 -52
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue +154 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue.d.ts +27 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +222 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +96 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +15 -16
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +51 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/{Group → Item}/index.vue.d.ts +9 -13
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +46 -66
- package/dist/runtime/components/Edit/Features/Comments/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +4 -7
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Debug/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Delete/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +13 -5
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +14 -11
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +30 -18
- package/dist/runtime/components/Edit/Features/Duplicate/index.vue +6 -8
- package/dist/runtime/components/Edit/Features/Edit/index.vue +15 -21
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +7 -6
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +8 -3
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +29 -12
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +40 -42
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +11 -9
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue +16 -25
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +5 -7
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/Library/index.vue +27 -23
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +6 -3
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +15 -12
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +7 -6
- package/dist/runtime/components/Edit/Features/Options/index.vue +6 -6
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +68 -15
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +15 -15
- package/dist/runtime/components/Edit/Features/Search/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +3 -3
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +34 -11
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +21 -20
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +3 -3
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Selection/index.vue +61 -27
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +13 -6
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +3 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +2 -27
- package/dist/runtime/components/Edit/Features/Translations/index.vue +7 -7
- package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/index.vue +17 -7
- package/dist/runtime/components/Edit/Form/Toggle/index.vue +4 -3
- package/dist/runtime/components/Edit/Form/Toggle/index.vue.d.ts +12 -2
- package/dist/runtime/components/Edit/InfoBox/index.vue +6 -2
- package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +12 -2
- package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue → ScheduleDate/index.vue} +6 -58
- package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue.d.ts → ScheduleDate/index.vue.d.ts} +11 -1
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +3 -0
- package/dist/runtime/components/Edit/Transition/Height.vue +95 -0
- package/dist/runtime/components/Edit/Transition/Height.vue.d.ts +36 -0
- package/dist/runtime/components/Edit/index.d.ts +3 -1
- package/dist/runtime/components/Edit/index.js +5 -1
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.d.ts +2 -1
- package/dist/runtime/helpers/animationProvider.js +6 -2
- package/dist/runtime/helpers/composables/useStateBasedCache.d.ts +4 -0
- package/dist/runtime/helpers/composables/useStateBasedCache.js +13 -0
- package/dist/runtime/helpers/definitionProvider.d.ts +1 -1
- package/dist/runtime/helpers/dom/index.d.ts +1 -1
- package/dist/runtime/helpers/domProvider.d.ts +10 -16
- package/dist/runtime/helpers/domProvider.js +80 -135
- package/dist/runtime/helpers/index.d.ts +1 -8
- package/dist/runtime/helpers/index.js +1 -84
- package/dist/runtime/helpers/providers/blocks.d.ts +10 -0
- package/dist/runtime/helpers/providers/blocks.js +91 -0
- package/dist/runtime/helpers/providers/directive.d.ts +24 -0
- package/dist/runtime/helpers/{editableProvider.js → providers/directive.js} +90 -29
- package/dist/runtime/helpers/providers/element.d.ts +6 -0
- package/dist/runtime/helpers/providers/element.js +35 -0
- package/dist/runtime/helpers/providers/fields.d.ts +8 -0
- package/dist/runtime/helpers/providers/fields.js +47 -0
- package/dist/runtime/helpers/selectionProvider.d.ts +11 -11
- package/dist/runtime/helpers/selectionProvider.js +38 -45
- package/dist/runtime/helpers/stateProvider.d.ts +1 -0
- package/dist/runtime/helpers/stateProvider.js +21 -15
- package/dist/runtime/helpers/themeProvider.d.ts +2 -1
- package/dist/runtime/helpers/themeProvider.js +24 -14
- package/dist/runtime/helpers/typesProvider.js +10 -26
- package/dist/runtime/helpers/uiProvider.d.ts +3 -2
- package/dist/runtime/helpers/uiProvider.js +11 -15
- package/dist/runtime/icons/calendar.svg +1 -0
- package/dist/runtime/icons/clock.svg +1 -0
- package/dist/runtime/icons/comment_add.svg +1 -5
- package/dist/runtime/icons/delete.svg +1 -8
- package/dist/runtime/icons/duplicate.svg +1 -12
- package/dist/runtime/icons/edit.svg +1 -8
- package/dist/runtime/icons/reusable.svg +1 -5
- package/dist/runtime/plugins/{blokkliEditable.js → blokkliDirectives.js} +14 -20
- package/dist/runtime/types/index.d.ts +55 -36
- package/package.json +1 -1
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +0 -63
- package/dist/runtime/helpers/editableProvider.d.ts +0 -14
- /package/dist/runtime/plugins/{blokkliEditable.d.ts → blokkliDirectives.d.ts} +0 -0
|
@@ -18,7 +18,10 @@ import {
|
|
|
18
18
|
getInteractionCoordinates,
|
|
19
19
|
isInsideRect
|
|
20
20
|
} from "#blokkli/helpers";
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
MOUSE_BUTTON,
|
|
23
|
+
MOUSE_BUTTONS
|
|
24
|
+
} from "#blokkli/helpers/dom";
|
|
22
25
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
23
26
|
import {
|
|
24
27
|
ref,
|
|
@@ -37,13 +40,17 @@ const {
|
|
|
37
40
|
ui,
|
|
38
41
|
animation,
|
|
39
42
|
state,
|
|
40
|
-
|
|
41
|
-
runtimeConfig
|
|
43
|
+
directive,
|
|
44
|
+
runtimeConfig,
|
|
45
|
+
blocks
|
|
42
46
|
} = useBlokkli();
|
|
47
|
+
const cursor = computed(
|
|
48
|
+
() => state.isLoading.value ? "wait" : animation.cursor.value
|
|
49
|
+
);
|
|
43
50
|
const style = computed(() => {
|
|
44
51
|
return {
|
|
45
52
|
imageRendering: "pixelated",
|
|
46
|
-
cursor:
|
|
53
|
+
cursor: cursor.value
|
|
47
54
|
};
|
|
48
55
|
});
|
|
49
56
|
const rects = ref([]);
|
|
@@ -65,7 +72,7 @@ let pointerDownTimestamp = 0;
|
|
|
65
72
|
let pointerUpTimestamp = 0;
|
|
66
73
|
function getInteractedElement(e) {
|
|
67
74
|
const { x, y } = getInteractionCoordinates(e);
|
|
68
|
-
const editableField =
|
|
75
|
+
const editableField = directive.getEditableAtPoint(x, y);
|
|
69
76
|
if (editableField) {
|
|
70
77
|
const uuid = editableField.type === runtimeConfig.itemEntityType ? editableField.uuid : void 0;
|
|
71
78
|
return {
|
|
@@ -107,6 +114,15 @@ function getInteractedElement(e) {
|
|
|
107
114
|
}
|
|
108
115
|
return null;
|
|
109
116
|
}
|
|
117
|
+
function toDraggableExisting(v) {
|
|
118
|
+
const blocks2 = Array.isArray(v) ? v : [v];
|
|
119
|
+
return blocks2.map((block) => {
|
|
120
|
+
return {
|
|
121
|
+
itemType: "existing",
|
|
122
|
+
block
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}
|
|
110
126
|
function onPointerMove(e) {
|
|
111
127
|
if (keyboard.isPressingSpace.value || e.buttons === MOUSE_BUTTONS.AUXILIARY) {
|
|
112
128
|
return;
|
|
@@ -147,15 +163,15 @@ function onPointerMove(e) {
|
|
|
147
163
|
if (interacted && interacted.uuid) {
|
|
148
164
|
if (selection.uuids.value.includes(interacted.uuid)) {
|
|
149
165
|
eventBus.emit("dragging:start", {
|
|
150
|
-
items:
|
|
166
|
+
items: toDraggableExisting(selection.items.value),
|
|
151
167
|
coords: { x: e.clientX, y: e.clientY },
|
|
152
168
|
mode: "mouse"
|
|
153
169
|
});
|
|
154
170
|
} else {
|
|
155
|
-
const block =
|
|
171
|
+
const block = blocks.getBlock(interacted.uuid);
|
|
156
172
|
if (block) {
|
|
157
173
|
eventBus.emit("dragging:start", {
|
|
158
|
-
items:
|
|
174
|
+
items: toDraggableExisting(block),
|
|
159
175
|
coords: { x: e.clientX, y: e.clientY },
|
|
160
176
|
mode: "mouse"
|
|
161
177
|
});
|
|
@@ -271,7 +287,7 @@ function onPointerUp(e) {
|
|
|
271
287
|
return;
|
|
272
288
|
}
|
|
273
289
|
if (lastInteractedElement.uuid) {
|
|
274
|
-
const block =
|
|
290
|
+
const block = blocks.getBlock(lastInteractedElement.uuid);
|
|
275
291
|
if (!block) {
|
|
276
292
|
return;
|
|
277
293
|
}
|
|
@@ -329,7 +345,7 @@ function onTouchStart(e) {
|
|
|
329
345
|
longPressInteraction = touchStartInteraction;
|
|
330
346
|
if (selection.uuids.value.includes(touchStartInteraction.uuid) && state.editMode.value === "editing") {
|
|
331
347
|
eventBus.emit("dragging:start", {
|
|
332
|
-
items:
|
|
348
|
+
items: toDraggableExisting(selection.items.value),
|
|
333
349
|
coords: {
|
|
334
350
|
x: touchStartInteraction.x,
|
|
335
351
|
y: touchStartInteraction.y
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
import { useBlokkli, onMounted, computed, ref, onBeforeUnmount } from "#imports";
|
|
57
57
|
import { Icon } from "#blokkli/components";
|
|
58
58
|
import { modulo } from "#blokkli/helpers";
|
|
59
|
-
const { ui } = useBlokkli();
|
|
59
|
+
const { ui, element } = useBlokkli();
|
|
60
60
|
const emit = defineEmits(["submit", "cancel"]);
|
|
61
61
|
const rootEl = ref(null);
|
|
62
62
|
const props = defineProps({
|
|
@@ -94,9 +94,11 @@ const getFocusableElements = () => {
|
|
|
94
94
|
if (!rootEl.value) {
|
|
95
95
|
return [];
|
|
96
96
|
}
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
return element.queryAll(
|
|
98
|
+
rootEl.value,
|
|
99
|
+
"input,select,button,textarea",
|
|
100
|
+
`Dialog "${props.title}" getFocusableElements`
|
|
101
|
+
);
|
|
100
102
|
};
|
|
101
103
|
const onKeyDown = (e) => {
|
|
102
104
|
if (e.code === "Escape") {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
:key="item.uuid + fieldListType + definitions.renderKey.value"
|
|
20
20
|
:uuid="item.uuid"
|
|
21
21
|
:bundle="item.bundle"
|
|
22
|
-
:is-new="item.isNew"
|
|
23
22
|
:options="item.options"
|
|
24
23
|
:props="item.props"
|
|
25
24
|
is-editing
|
|
@@ -36,7 +35,6 @@
|
|
|
36
35
|
:data-host-field-name="name"
|
|
37
36
|
:data-host-field-list-type="fieldListType"
|
|
38
37
|
:data-is-nested="isNested"
|
|
39
|
-
:data-is-new="item.isNew"
|
|
40
38
|
:data-entity-type="runtimeConfig.itemEntityType"
|
|
41
39
|
:data-bk-is-muted="isMuted(item)"
|
|
42
40
|
/>
|
|
@@ -54,7 +52,6 @@
|
|
|
54
52
|
:key="item.uuid + fieldListType"
|
|
55
53
|
:uuid="item.uuid"
|
|
56
54
|
:bundle="item.bundle"
|
|
57
|
-
:is-new="item.isNew"
|
|
58
55
|
:options="item.options"
|
|
59
56
|
:props="item.props"
|
|
60
57
|
is-editing
|
|
@@ -71,7 +68,6 @@
|
|
|
71
68
|
:data-host-field-name="name"
|
|
72
69
|
:data-host-field-list-type="fieldListType"
|
|
73
70
|
:data-is-nested="isNested"
|
|
74
|
-
:data-is-new="item.isNew"
|
|
75
71
|
:data-entity-type="runtimeConfig.itemEntityType"
|
|
76
72
|
:data-bk-is-muted="isMuted(item)"
|
|
77
73
|
/>
|
|
@@ -105,7 +101,7 @@ const props = defineProps({
|
|
|
105
101
|
language: { type: String, required: false, default: void 0 },
|
|
106
102
|
tag: { type: String, required: false, default: "div" },
|
|
107
103
|
isNested: { type: Boolean, required: true },
|
|
108
|
-
fieldListType: { type:
|
|
104
|
+
fieldListType: { type: null, required: true },
|
|
109
105
|
allowedFragments: { type: Array, required: false, default: void 0 },
|
|
110
106
|
dropAlignment: { type: String, required: false, default: void 0 },
|
|
111
107
|
proxyMode: { type: Boolean, required: false },
|
|
@@ -162,18 +158,30 @@ function isMuted(item) {
|
|
|
162
158
|
if (!item) {
|
|
163
159
|
return true;
|
|
164
160
|
}
|
|
161
|
+
if (!item.editContext?.isPublished) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
165
164
|
const isVisible = isVisibleByOptions(item, props.language);
|
|
166
165
|
const isVisibleCustom = props.shouldRenderItem ? props.shouldRenderItem(item) : true;
|
|
167
166
|
return !(isVisible && isVisibleCustom);
|
|
168
167
|
}
|
|
168
|
+
const data = computed(() => {
|
|
169
|
+
return {
|
|
170
|
+
fieldListType: props.fieldListType,
|
|
171
|
+
allowedFragments: props.allowedFragments ?? [],
|
|
172
|
+
isNested: props.isNested,
|
|
173
|
+
nestingLevel: props.nestingLevel,
|
|
174
|
+
dropAlignment: props.dropAlignment ?? null
|
|
175
|
+
};
|
|
176
|
+
});
|
|
169
177
|
watch(root, function(newRoot) {
|
|
170
178
|
if (newRoot) {
|
|
171
|
-
dom.updateFieldElement(props.entity, props.name, newRoot);
|
|
179
|
+
dom.updateFieldElement(props.entity, props.name, newRoot, data.value);
|
|
172
180
|
}
|
|
173
181
|
});
|
|
174
182
|
onMounted(() => {
|
|
175
183
|
if (root.value) {
|
|
176
|
-
dom.registerField(props.entity, props.name, root.value);
|
|
184
|
+
dom.registerField(props.entity, props.name, root.value, data.value);
|
|
177
185
|
}
|
|
178
186
|
});
|
|
179
187
|
onBeforeUnmount(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { FieldListItem, EntityContext } from '#blokkli/types';
|
|
1
|
+
import type { FieldListItem, EntityContext, FieldDropAlignment } from '#blokkli/types';
|
|
2
2
|
import type { BlokkliFragmentName } from '#blokkli-build/definitions';
|
|
3
|
-
import type { FieldListItemTyped } from '#blokkli-build/generated-types';
|
|
3
|
+
import type { FieldListItemTyped, ValidFieldListTypes } from '#blokkli-build/generated-types';
|
|
4
4
|
type __VLS_Props = {
|
|
5
5
|
name: string;
|
|
6
6
|
fieldKey: string;
|
|
@@ -9,9 +9,9 @@ type __VLS_Props = {
|
|
|
9
9
|
language?: string;
|
|
10
10
|
tag?: string;
|
|
11
11
|
isNested: boolean;
|
|
12
|
-
fieldListType:
|
|
12
|
+
fieldListType: ValidFieldListTypes;
|
|
13
13
|
allowedFragments?: BlokkliFragmentName[];
|
|
14
|
-
dropAlignment?:
|
|
14
|
+
dropAlignment?: FieldDropAlignment;
|
|
15
15
|
proxyMode?: boolean;
|
|
16
16
|
globalProxyMode?: boolean;
|
|
17
17
|
nestingLevel: number;
|
|
@@ -19,9 +19,9 @@ type __VLS_Props = {
|
|
|
19
19
|
};
|
|
20
20
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
21
21
|
allowedFragments: BlokkliFragmentName[];
|
|
22
|
+
dropAlignment: FieldDropAlignment;
|
|
22
23
|
tag: string;
|
|
23
24
|
language: string;
|
|
24
|
-
dropAlignment: "vertical" | "horizontal";
|
|
25
25
|
shouldRenderItem: (item: FieldListItem | FieldListItemTyped) => boolean;
|
|
26
26
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
27
|
export default _default;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Teleport to="body">
|
|
3
3
|
<Transition :name="ui.useAnimations.value ? 'bk-loading' : void 0">
|
|
4
|
-
<Loading
|
|
5
|
-
v-if="isInitializing || !toolbarLoaded || !featuresLoaded"
|
|
6
|
-
screen
|
|
7
|
-
/>
|
|
4
|
+
<Loading v-if="showLoading" screen />
|
|
8
5
|
</Transition>
|
|
9
6
|
|
|
10
7
|
<div id="bk-banner-container">
|
|
@@ -35,7 +32,7 @@
|
|
|
35
32
|
<AppMenu v-if="toolbarLoaded" />
|
|
36
33
|
<Indicators />
|
|
37
34
|
<Features
|
|
38
|
-
v-if="
|
|
35
|
+
v-if="isReady"
|
|
39
36
|
:key="route.fullPath"
|
|
40
37
|
@loaded="featuresLoaded = true"
|
|
41
38
|
/>
|
|
@@ -78,6 +75,7 @@ import keyboardProvider from "./../../helpers/keyboardProvider";
|
|
|
78
75
|
import selectionProvider from "./../../helpers/selectionProvider";
|
|
79
76
|
import editStateProvider from "./../../helpers/stateProvider";
|
|
80
77
|
import typesProvider from "./../../helpers/typesProvider";
|
|
78
|
+
import elementProvider from "./../../helpers/providers/element";
|
|
81
79
|
import domProvider from "./../../helpers/domProvider";
|
|
82
80
|
import textProvider from "./../../helpers/textProvider";
|
|
83
81
|
import storageProvider from "./../../helpers/storageProvider";
|
|
@@ -90,9 +88,11 @@ import tourProvider from "./../../helpers/tourProvider";
|
|
|
90
88
|
import debugProvider from "./../../helpers/debugProvider";
|
|
91
89
|
import definitionProvider from "./../../helpers/definitionProvider";
|
|
92
90
|
import dropAreasProvider from "./../../helpers/dropAreaProvider";
|
|
91
|
+
import blocksProvider from "./../../helpers/providers/blocks";
|
|
93
92
|
import indicatorsProvider from "./../../helpers/indicatorsProvider";
|
|
94
93
|
import pluginProvider from "./../../helpers/pluginProvider";
|
|
95
|
-
import
|
|
94
|
+
import directiveProvider from "./../../helpers/providers/directive";
|
|
95
|
+
import fieldsProvider from "./../../helpers/providers/fields";
|
|
96
96
|
import { eventBus } from "#blokkli/helpers/eventBus";
|
|
97
97
|
import "#blokkli-build/styles.css";
|
|
98
98
|
import getAdapter from "#blokkli-build/edit-adapter";
|
|
@@ -114,7 +114,8 @@ const props = defineProps({
|
|
|
114
114
|
entityBundle: { type: String, required: true },
|
|
115
115
|
language: { type: String, required: false, default: "en" },
|
|
116
116
|
isolate: { type: Boolean, required: false },
|
|
117
|
-
permissions: { type: Array, required: true }
|
|
117
|
+
permissions: { type: Array, required: true },
|
|
118
|
+
providerEl: { type: null, required: true }
|
|
118
119
|
});
|
|
119
120
|
defineSlots();
|
|
120
121
|
const context = computed(() => {
|
|
@@ -143,22 +144,31 @@ const state = await editStateProvider(
|
|
|
143
144
|
);
|
|
144
145
|
const storage = await storageProvider(adapter, context);
|
|
145
146
|
const debug = debugProvider(storage);
|
|
147
|
+
const element = elementProvider(debug);
|
|
146
148
|
const features = featuresProvider(storage);
|
|
147
|
-
const theme = themeProvider();
|
|
148
149
|
const commands = commandsProvider();
|
|
149
150
|
const tour = tourProvider();
|
|
150
151
|
const dropAreas = dropAreasProvider();
|
|
151
152
|
const broadcast = broadcastProvider();
|
|
152
|
-
const ui = uiProvider(storage, state, context);
|
|
153
|
-
const dom = domProvider(ui, debug, definitions);
|
|
154
|
-
const
|
|
155
|
-
const
|
|
153
|
+
const ui = uiProvider(props.providerEl, storage, state, context, element);
|
|
154
|
+
const dom = domProvider(ui, debug, definitions, state, element);
|
|
155
|
+
const theme = themeProvider(element);
|
|
156
|
+
const blocks = blocksProvider(state, dom, context);
|
|
157
|
+
const selection = selectionProvider(blocks);
|
|
158
|
+
const animation = animationProvider(ui, storage, selection, element);
|
|
156
159
|
const keyboard = keyboardProvider(animation);
|
|
157
160
|
const types = await typesProvider(adapter, selection, context);
|
|
158
161
|
const indicators = indicatorsProvider();
|
|
159
162
|
const plugins = pluginProvider();
|
|
160
|
-
const
|
|
163
|
+
const directive = directiveProvider(ui);
|
|
164
|
+
const fields = fieldsProvider(state, dom, types);
|
|
161
165
|
const mutatedEntity = computed(() => state.mutatedEntity.value || props.entity);
|
|
166
|
+
const isReady = computed(
|
|
167
|
+
() => !isInitializing.value && dom.isReady.value && directive.isReady.value && toolbarLoaded.value
|
|
168
|
+
);
|
|
169
|
+
const showLoading = computed(() => {
|
|
170
|
+
return !isReady.value || !featuresLoaded.value;
|
|
171
|
+
});
|
|
162
172
|
const onContextMenu = (e) => {
|
|
163
173
|
e.preventDefault();
|
|
164
174
|
e.stopPropagation();
|
|
@@ -189,7 +199,7 @@ onMounted(() => {
|
|
|
189
199
|
document.documentElement.addEventListener("touchstart", onTouchStart);
|
|
190
200
|
baseLogger.log("EditProvider mounted");
|
|
191
201
|
dom.init();
|
|
192
|
-
|
|
202
|
+
directive.init();
|
|
193
203
|
isInitializing.value = false;
|
|
194
204
|
broadcast.emit("editorLoaded", { uuid: props.entityUuid });
|
|
195
205
|
});
|
|
@@ -221,20 +231,23 @@ provide(INJECT_APP, {
|
|
|
221
231
|
definitions,
|
|
222
232
|
dom,
|
|
223
233
|
dropAreas,
|
|
234
|
+
element,
|
|
224
235
|
eventBus,
|
|
225
|
-
|
|
236
|
+
directive,
|
|
226
237
|
features,
|
|
227
238
|
indicators,
|
|
228
239
|
keyboard,
|
|
229
240
|
plugins,
|
|
230
241
|
runtimeConfig,
|
|
231
242
|
selection,
|
|
243
|
+
blocks,
|
|
232
244
|
state,
|
|
233
245
|
storage,
|
|
234
246
|
theme,
|
|
235
247
|
tour,
|
|
236
248
|
types,
|
|
237
|
-
ui
|
|
249
|
+
ui,
|
|
250
|
+
fields
|
|
238
251
|
});
|
|
239
252
|
function textWithHighlight(title, text) {
|
|
240
253
|
return `<strong>${title}</strong> ${text}`;
|
|
@@ -9,6 +9,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
|
|
|
9
9
|
language?: string;
|
|
10
10
|
isolate?: boolean;
|
|
11
11
|
permissions: EditPermission[];
|
|
12
|
+
providerEl: HTMLElement;
|
|
12
13
|
} & Partial<{}>> & import("vue").PublicProps;
|
|
13
14
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
14
15
|
attrs: any;
|
|
@@ -86,7 +86,7 @@ const { settings } = defineBlokkliFeature({
|
|
|
86
86
|
},
|
|
87
87
|
screenshot: "feature-add-list.jpg"
|
|
88
88
|
});
|
|
89
|
-
const { state, $t, eventBus, ui } = useBlokkli();
|
|
89
|
+
const { state, $t, eventBus, ui, element } = useBlokkli();
|
|
90
90
|
const hasContextMenuOpen = computed(
|
|
91
91
|
() => ui.openContextMenu.value.startsWith("add_list_item_")
|
|
92
92
|
);
|
|
@@ -104,17 +104,15 @@ const isActive = ref(false);
|
|
|
104
104
|
let mouseTimeout = null;
|
|
105
105
|
const style = computed(() => {
|
|
106
106
|
if (settings.value.orientation === "vertical" && (isActive.value || hasContextMenuOpen.value) && wrapper.value) {
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return acc;
|
|
115
|
-
}, 0);
|
|
107
|
+
const widths = element.queryAll(
|
|
108
|
+
wrapper.value,
|
|
109
|
+
".bk-list-item-label span",
|
|
110
|
+
"AddList vertical sidebar style",
|
|
111
|
+
(el) => el.offsetWidth
|
|
112
|
+
);
|
|
113
|
+
const largestWidth = Math.max(...widths);
|
|
116
114
|
return {
|
|
117
|
-
"--bk-add-list-width":
|
|
115
|
+
"--bk-add-list-width": largestWidth + 90
|
|
118
116
|
};
|
|
119
117
|
}
|
|
120
118
|
return void 0;
|
|
@@ -19,7 +19,7 @@ const props = defineProps({
|
|
|
19
19
|
results: { type: Array, required: true },
|
|
20
20
|
gl: { type: null, required: true }
|
|
21
21
|
});
|
|
22
|
-
const { animation, ui, theme, selection, eventBus } = useBlokkli();
|
|
22
|
+
const { animation, ui, theme, selection, eventBus, element } = useBlokkli();
|
|
23
23
|
const programInfo = animation.registerProgram("analyze", props.gl, [vs, fs]);
|
|
24
24
|
const statusPriority = {
|
|
25
25
|
violation: 3,
|
|
@@ -27,7 +27,6 @@ const statusPriority = {
|
|
|
27
27
|
pass: 1,
|
|
28
28
|
inapplicable: 0
|
|
29
29
|
};
|
|
30
|
-
const providerElement = ui.providerElement();
|
|
31
30
|
const nodes = computed(() => {
|
|
32
31
|
const allNodes = props.results.filter((v) => v.status === "incomplete" || v.status === "violation").flatMap((result) => {
|
|
33
32
|
const nodes2 = Array.isArray(result.nodes) ? result.nodes : [result.nodes];
|
|
@@ -35,14 +34,18 @@ const nodes = computed(() => {
|
|
|
35
34
|
const targets = Array.isArray(node.targets) ? node.targets : [node.targets];
|
|
36
35
|
return targets.map((v) => {
|
|
37
36
|
if (typeof v === "string") {
|
|
38
|
-
return
|
|
37
|
+
return element.query(
|
|
38
|
+
ui.providerElement,
|
|
39
|
+
v,
|
|
40
|
+
"Find analyze node target element."
|
|
41
|
+
);
|
|
39
42
|
}
|
|
40
43
|
return v;
|
|
41
|
-
}).filter((v) => v instanceof HTMLElement).filter((v) => providerElement.contains(v));
|
|
42
|
-
}).map((
|
|
44
|
+
}).filter((v) => v instanceof HTMLElement).filter((v) => ui.providerElement.contains(v));
|
|
45
|
+
}).map((element2) => {
|
|
43
46
|
return {
|
|
44
47
|
id: result.id,
|
|
45
|
-
element,
|
|
48
|
+
element: element2,
|
|
46
49
|
title: result.title,
|
|
47
50
|
status: result.status
|
|
48
51
|
};
|
|
@@ -75,7 +75,7 @@ const lastRun = useState(() => 0);
|
|
|
75
75
|
const lastRunKey = useState(() => "");
|
|
76
76
|
const selectedCategory = useState(() => ALL);
|
|
77
77
|
const hasInitialized = useState(() => false);
|
|
78
|
-
const providerRootElement = ui.providerElement
|
|
78
|
+
const providerRootElement = ui.providerElement;
|
|
79
79
|
const resultsFiltered = computed(() => {
|
|
80
80
|
if (selectedCategory.value === ALL) {
|
|
81
81
|
return results.value;
|
|
@@ -23,20 +23,24 @@ const props = defineProps({
|
|
|
23
23
|
resultId: { type: String, required: true },
|
|
24
24
|
target: { type: null, required: true }
|
|
25
25
|
});
|
|
26
|
-
const { eventBus, dom } = useBlokkli();
|
|
26
|
+
const { eventBus, dom, blocks, element } = useBlokkli();
|
|
27
27
|
const elButton = useTemplateRef("elButton");
|
|
28
28
|
const isFocused = ref(false);
|
|
29
29
|
let focusTimeout = null;
|
|
30
30
|
function getElement() {
|
|
31
31
|
if (props.target) {
|
|
32
32
|
if (typeof props.target === "string") {
|
|
33
|
-
return
|
|
33
|
+
return element.query(
|
|
34
|
+
document.documentElement,
|
|
35
|
+
props.target,
|
|
36
|
+
"Find analyze result item node target."
|
|
37
|
+
);
|
|
34
38
|
} else if (props.target instanceof HTMLElement) {
|
|
35
39
|
return props.target;
|
|
36
40
|
} else if (typeof props.target === "object" && "uuid" in props.target) {
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
41
|
+
const item = blocks.getBlock(props.target.uuid);
|
|
42
|
+
if (item) {
|
|
43
|
+
return dom.getDragElement(item) ?? null;
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
}
|
|
@@ -53,8 +57,8 @@ function getLabel() {
|
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
|
-
function findClosestUuid(
|
|
57
|
-
const closestBlock =
|
|
60
|
+
function findClosestUuid(element2) {
|
|
61
|
+
const closestBlock = element2.closest("[data-uuid]");
|
|
58
62
|
if (closestBlock instanceof HTMLElement) {
|
|
59
63
|
const uuid = closestBlock.dataset.uuid;
|
|
60
64
|
if (uuid) {
|
|
@@ -63,11 +67,11 @@ function findClosestUuid(element) {
|
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
async function onClick() {
|
|
66
|
-
const
|
|
67
|
-
if (!
|
|
70
|
+
const element2 = getElement();
|
|
71
|
+
if (!element2) {
|
|
68
72
|
return;
|
|
69
73
|
}
|
|
70
|
-
const closestUuid = findClosestUuid(
|
|
74
|
+
const closestUuid = findClosestUuid(element2);
|
|
71
75
|
if (closestUuid) {
|
|
72
76
|
eventBus.emit("select", closestUuid);
|
|
73
77
|
} else {
|
|
@@ -75,7 +79,7 @@ async function onClick() {
|
|
|
75
79
|
}
|
|
76
80
|
await renderCycle();
|
|
77
81
|
eventBus.emit("scrollIntoView", {
|
|
78
|
-
element
|
|
82
|
+
element: element2
|
|
79
83
|
});
|
|
80
84
|
}
|
|
81
85
|
onBlokkliEvent("analyze:click-node", (e) => {
|
|
@@ -11,12 +11,28 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script setup>
|
|
14
|
-
import { useBlokkli,
|
|
14
|
+
import { useBlokkli, useRoute, computed } from "#imports";
|
|
15
15
|
import { PluginBlockIndicator } from "#blokkli/plugins";
|
|
16
16
|
import { emitMessage } from "#blokkli/helpers/eventBus";
|
|
17
17
|
const route = useRoute();
|
|
18
|
-
const {
|
|
19
|
-
const
|
|
18
|
+
const { $t, adapter, dom } = useBlokkli();
|
|
19
|
+
const items = computed(() => {
|
|
20
|
+
const anchorItems = [];
|
|
21
|
+
for (const entry of Object.entries(dom.registeredBlocks.value)) {
|
|
22
|
+
const uuid = entry[0];
|
|
23
|
+
const element = entry[1];
|
|
24
|
+
if (!element || !uuid) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (element.id) {
|
|
28
|
+
anchorItems.push({
|
|
29
|
+
id: element.id,
|
|
30
|
+
uuid
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return anchorItems;
|
|
35
|
+
});
|
|
20
36
|
function getLinkForClipboard(item) {
|
|
21
37
|
if (adapter.buildAnchorLink) {
|
|
22
38
|
return adapter.buildAnchorLink(item.id, item.uuid);
|
|
@@ -34,103 +50,4 @@ function onClick(item) {
|
|
|
34
50
|
emitMessage(message, "success", void 0, true);
|
|
35
51
|
}
|
|
36
52
|
}
|
|
37
|
-
const items = ref([]);
|
|
38
|
-
const trackedElements = /* @__PURE__ */ new Map();
|
|
39
|
-
let observer = null;
|
|
40
|
-
const getAnchorData = (el) => {
|
|
41
|
-
const uuid = el.getAttribute("data-uuid");
|
|
42
|
-
const id = el.getAttribute("id");
|
|
43
|
-
return uuid && id ? { uuid, id } : null;
|
|
44
|
-
};
|
|
45
|
-
const syncItems = () => {
|
|
46
|
-
const newItems = Array.from(trackedElements.values());
|
|
47
|
-
items.value = newItems;
|
|
48
|
-
};
|
|
49
|
-
const checkElement = (el) => {
|
|
50
|
-
const data = getAnchorData(el);
|
|
51
|
-
const isTracked = trackedElements.has(el);
|
|
52
|
-
if (data && !isTracked) {
|
|
53
|
-
trackedElements.set(el, data);
|
|
54
|
-
return true;
|
|
55
|
-
} else if (!data && isTracked) {
|
|
56
|
-
trackedElements.delete(el);
|
|
57
|
-
return true;
|
|
58
|
-
} else if (data && isTracked) {
|
|
59
|
-
const existing = trackedElements.get(el);
|
|
60
|
-
if (existing.uuid !== data.uuid || existing.id !== data.id) {
|
|
61
|
-
trackedElements.set(el, data);
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
};
|
|
67
|
-
const processAddedNode = (node) => {
|
|
68
|
-
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
69
|
-
let changed = false;
|
|
70
|
-
const el = node;
|
|
71
|
-
if (el.hasAttribute("data-uuid") && el.hasAttribute("id")) {
|
|
72
|
-
changed = checkElement(el) || changed;
|
|
73
|
-
}
|
|
74
|
-
return changed;
|
|
75
|
-
};
|
|
76
|
-
const processRemovedNode = (node) => {
|
|
77
|
-
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
78
|
-
let changed = false;
|
|
79
|
-
const el = node;
|
|
80
|
-
if (!el.id) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
if (trackedElements.delete(el)) {
|
|
84
|
-
changed = true;
|
|
85
|
-
}
|
|
86
|
-
const toRemove = [];
|
|
87
|
-
for (const [trackedEl] of trackedElements) {
|
|
88
|
-
if (node.contains(trackedEl)) {
|
|
89
|
-
toRemove.push(trackedEl);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
for (const el2 of toRemove) {
|
|
93
|
-
trackedElements.delete(el2);
|
|
94
|
-
changed = true;
|
|
95
|
-
}
|
|
96
|
-
return changed;
|
|
97
|
-
};
|
|
98
|
-
onMounted(() => {
|
|
99
|
-
const elements = rootElement.querySelectorAll("[data-uuid][id]");
|
|
100
|
-
for (const el of elements) {
|
|
101
|
-
const data = getAnchorData(el);
|
|
102
|
-
if (data) {
|
|
103
|
-
trackedElements.set(el, data);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
syncItems();
|
|
107
|
-
observer = new MutationObserver((mutations) => {
|
|
108
|
-
let changed = false;
|
|
109
|
-
for (const mutation of mutations) {
|
|
110
|
-
if (mutation.type === "childList") {
|
|
111
|
-
for (const node of mutation.addedNodes) {
|
|
112
|
-
changed = processAddedNode(node) || changed;
|
|
113
|
-
}
|
|
114
|
-
for (const node of mutation.removedNodes) {
|
|
115
|
-
changed = processRemovedNode(node) || changed;
|
|
116
|
-
}
|
|
117
|
-
} else if (mutation.type === "attributes") {
|
|
118
|
-
const target = mutation.target;
|
|
119
|
-
changed = checkElement(target) || changed;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (changed) {
|
|
123
|
-
syncItems();
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
observer.observe(rootElement, {
|
|
127
|
-
childList: true,
|
|
128
|
-
subtree: true,
|
|
129
|
-
attributes: true,
|
|
130
|
-
attributeFilter: ["data-uuid", "id"]
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
onBeforeUnmount(() => {
|
|
134
|
-
observer?.disconnect();
|
|
135
|
-
});
|
|
136
53
|
</script>
|
|
@@ -232,6 +232,9 @@ const resetZoom = () => {
|
|
|
232
232
|
animation.requestDraw();
|
|
233
233
|
};
|
|
234
234
|
onBlokkliEvent("keyPressed", (e) => {
|
|
235
|
+
if (ui.hasDialogOpen.value) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
235
238
|
if (e.code === "Home") {
|
|
236
239
|
e.originalEvent.preventDefault();
|
|
237
240
|
artboard.scrollToTop();
|