@blokkli/editor 2.0.0-alpha.16 → 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 +640 -137
- package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +1 -1
- 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/features/comments.graphql +11 -8
- 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 +12 -4
- 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 -15
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +20 -44
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +10 -5
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +4 -2
- package/dist/runtime/components/BlokkliEditable.vue +32 -14
- 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 +41 -28
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +2 -1
- package/dist/runtime/components/Edit/Actions/index.vue +36 -20
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +436 -25
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +83 -0
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue.d.ts +32 -0
- package/dist/runtime/components/Edit/Banner/index.vue +51 -0
- package/dist/runtime/components/Edit/Banner/index.vue.d.ts +18 -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/EditIndicator.vue +118 -44
- package/dist/runtime/components/Edit/EditIndicator.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/EditProvider.vue +101 -31
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +9 -11
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +28 -26
- 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 +29 -53
- 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/{Selection/AddButtons/AddButtonsField.vue.d.ts → BlockScheduler/Dialog/index.vue.d.ts} +6 -9
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +96 -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/CommandPalette/index.vue +2 -0
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +35 -20
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue.d.ts +5 -3
- package/dist/runtime/components/Edit/Features/Comments/CommentInput/index.vue +29 -0
- package/dist/runtime/components/Edit/Features/{Publish/Dialog/ScheduleDate.vue.d.ts → Comments/CommentInput/index.vue.d.ts} +2 -2
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +22 -16
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue.d.ts +1 -0
- package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +15 -6
- package/dist/runtime/components/Edit/Features/Comments/index.vue +21 -9
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +4 -7
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +26 -35
- package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +240 -0
- package/dist/runtime/components/Edit/Features/Debug/Renderer.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +7 -165
- package/dist/runtime/components/Edit/Features/Delete/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +14 -6
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +55 -48
- 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 +16 -22
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +7 -6
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +69 -4
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +13 -9
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +45 -87
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +41 -43
- 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/History/index.vue +5 -2
- package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +139 -0
- package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue +261 -0
- package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Hover/Overlay/vertex.glsl +117 -0
- package/dist/runtime/components/Edit/Features/Hover/index.vue +25 -0
- package/dist/runtime/components/Edit/Features/Hover/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +5 -7
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +19 -27
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +32 -28
- package/dist/runtime/components/Edit/Features/Library/index.vue +28 -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 +36 -29
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +2 -4
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +6 -1
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +8 -6
- package/dist/runtime/components/Edit/Features/Options/index.vue +6 -6
- package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue +35 -0
- package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Ownership/index.vue +7 -25
- package/dist/runtime/components/Edit/Features/ProxyView/index.vue +5 -1
- 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 +39 -74
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +7 -5
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +106 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +440 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue.d.ts +32 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +102 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +53 -125
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +88 -29
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +5 -3
- package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +11 -2
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Selection/index.vue +66 -39
- 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/Banner/index.vue +17 -11
- package/dist/runtime/components/Edit/Features/Translations/index.vue +20 -23
- 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/Text/index.vue +2 -1
- package/dist/runtime/components/Edit/Form/Text/index.vue.d.ts +1 -0
- 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/Indicators/index.vue +1 -1
- 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/Konami/Game/index.vue +5 -5
- package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue → ScheduleDate/index.vue} +6 -58
- package/dist/runtime/components/Edit/ScheduleDate/index.vue.d.ts +23 -0
- 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 +7 -3
- package/dist/runtime/components/Edit/index.js +12 -4
- package/dist/runtime/composables/defineBlokkli.js +4 -2
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.d.ts +35 -1
- package/dist/runtime/helpers/animationProvider.js +179 -48
- package/dist/runtime/helpers/composables/defineRenderer.d.ts +8 -0
- package/dist/runtime/helpers/composables/defineRenderer.js +8 -0
- package/dist/runtime/helpers/composables/useStateBasedCache.d.ts +4 -0
- package/dist/runtime/helpers/composables/useStateBasedCache.js +13 -0
- package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +4 -1
- package/dist/runtime/helpers/composables/useStickyToolbar.js +53 -35
- package/dist/runtime/helpers/definitionProvider.d.ts +1 -1
- package/dist/runtime/helpers/dom/index.d.ts +1 -0
- package/dist/runtime/helpers/domProvider.d.ts +54 -14
- package/dist/runtime/helpers/domProvider.js +168 -134
- 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/providers/directive.js +205 -0
- 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 +7 -2
- package/dist/runtime/helpers/stateProvider.js +83 -14
- package/dist/runtime/helpers/storageProvider.d.ts +3 -2
- package/dist/runtime/helpers/storageProvider.js +6 -2
- package/dist/runtime/helpers/symbols.d.ts +1 -0
- package/dist/runtime/helpers/symbols.js +1 -0
- 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 +11 -3
- package/dist/runtime/helpers/uiProvider.js +45 -17
- 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/blokkliDirectives.js +96 -0
- package/dist/runtime/types/index.d.ts +66 -35
- package/package.json +1 -1
- package/dist/runtime/components/Edit/DragInteractions/index.vue +0 -401
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +0 -63
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue +0 -54
- package/dist/runtime/plugins/blokkliEditable.js +0 -31
- /package/dist/runtime/components/Edit/{DragInteractions → Features/BlockScheduler}/index.vue.d.ts +0 -0
- /package/dist/runtime/plugins/{blokkliEditable.d.ts → blokkliDirectives.d.ts} +0 -0
|
@@ -1,54 +1,20 @@
|
|
|
1
1
|
import { reactive, ref, computed } from "#imports";
|
|
2
2
|
import {
|
|
3
3
|
findClosestBlock,
|
|
4
|
-
buildDraggableItem,
|
|
5
4
|
falsy,
|
|
6
|
-
mapDroppableField,
|
|
7
5
|
findClosestEntityContext
|
|
8
6
|
} from "#blokkli/helpers";
|
|
9
7
|
import { cloneElementWithStyles } from "./dom/index.js";
|
|
10
8
|
import onBlokkliEvent from "./composables/onBlokkliEvent.js";
|
|
11
9
|
import useDelayedIntersectionObserver from "./composables/useDelayedIntersectionObserver.js";
|
|
12
|
-
|
|
13
|
-
const key = element.dataset.fieldKey;
|
|
14
|
-
const name = element.dataset.fieldName;
|
|
15
|
-
const label = element.dataset.fieldLabel;
|
|
16
|
-
const isNested = element.dataset.fieldIsNested === "true";
|
|
17
|
-
const nestingLevel = Number.parseInt(element.dataset.bkNestingLevel || "0");
|
|
18
|
-
const fieldListType = element.dataset.fieldListType;
|
|
19
|
-
const hostEntityType = element.dataset.hostEntityType;
|
|
20
|
-
const hostEntityBundle = element.dataset.hostEntityBundle;
|
|
21
|
-
const hostEntityUuid = element.dataset.hostEntityUuid;
|
|
22
|
-
const dropAlignment = element.dataset.fieldDropAlignment;
|
|
23
|
-
const cardinality = Number.parseInt(element.dataset.fieldCardinality || "-1");
|
|
24
|
-
const allowedBundles = (element.dataset.fieldAllowedBundles || "").split(",").filter(Boolean);
|
|
25
|
-
const allowedFragments = (element.dataset.allowedFragments || "").split(",").filter(Boolean);
|
|
26
|
-
if (key && name && label && hostEntityType && hostEntityUuid && hostEntityBundle && fieldListType) {
|
|
27
|
-
return {
|
|
28
|
-
key,
|
|
29
|
-
name,
|
|
30
|
-
label,
|
|
31
|
-
isNested,
|
|
32
|
-
nestingLevel,
|
|
33
|
-
hostEntityType,
|
|
34
|
-
hostEntityUuid,
|
|
35
|
-
hostEntityBundle,
|
|
36
|
-
cardinality: Number.isNaN(cardinality) ? -1 : cardinality,
|
|
37
|
-
allowedBundles,
|
|
38
|
-
allowedFragments,
|
|
39
|
-
fieldListType,
|
|
40
|
-
element,
|
|
41
|
-
dropAlignment: dropAlignment === "vertical" || dropAlignment === "horizontal" ? dropAlignment : void 0
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
};
|
|
10
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
45
11
|
function rectWithTime(rect, time) {
|
|
46
12
|
return {
|
|
47
13
|
...rect,
|
|
48
14
|
time: time || performance.now()
|
|
49
15
|
};
|
|
50
16
|
}
|
|
51
|
-
export default function(ui, debug, definitions) {
|
|
17
|
+
export default function(ui, debug, definitions, state, element) {
|
|
52
18
|
const logger = debug.createLogger("DomProvider");
|
|
53
19
|
const mutationsReady = ref(true);
|
|
54
20
|
const intersectionReady = ref(false);
|
|
@@ -59,13 +25,13 @@ export default function(ui, debug, definitions) {
|
|
|
59
25
|
const blockRects = {};
|
|
60
26
|
const fieldRects = {};
|
|
61
27
|
const blockUuidCurrentKey = {};
|
|
62
|
-
|
|
28
|
+
const observedElements = {};
|
|
63
29
|
let initTimeout = null;
|
|
64
30
|
const isInitalizing = ref(true);
|
|
65
31
|
const observedElementCache = /* @__PURE__ */ new Map();
|
|
66
32
|
const registeredBlockUuids = computed(() => {
|
|
67
|
-
return Object.entries(registeredBlocks).map(([uuid,
|
|
68
|
-
if (
|
|
33
|
+
return Object.entries(registeredBlocks).map(([uuid, element2]) => {
|
|
34
|
+
if (element2) {
|
|
69
35
|
return uuid;
|
|
70
36
|
}
|
|
71
37
|
return null;
|
|
@@ -80,6 +46,9 @@ export default function(ui, debug, definitions) {
|
|
|
80
46
|
if (!uuid) {
|
|
81
47
|
return;
|
|
82
48
|
}
|
|
49
|
+
if (!registeredBlocks[uuid]) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
83
52
|
const currentRect = blockRects[uuid];
|
|
84
53
|
const now = performance.now();
|
|
85
54
|
if (!currentRect) {
|
|
@@ -118,6 +87,9 @@ export default function(ui, debug, definitions) {
|
|
|
118
87
|
}
|
|
119
88
|
fieldRects[fieldKey] = ui.getAbsoluteElementRect(rect, scale, offset);
|
|
120
89
|
} else if (uuid) {
|
|
90
|
+
if (!registeredBlocks[uuid]) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
121
93
|
const newRect = ui.getAbsoluteElementRect(rect, scale, offset);
|
|
122
94
|
const currentRect = blockRects[uuid];
|
|
123
95
|
if (currentRect) {
|
|
@@ -165,19 +137,30 @@ export default function(ui, debug, definitions) {
|
|
|
165
137
|
}
|
|
166
138
|
return uniqueFieldTypes;
|
|
167
139
|
});
|
|
168
|
-
const registerField = (entity, fieldName,
|
|
140
|
+
const registerField = (entity, fieldName, element2, data) => {
|
|
169
141
|
const key = `${entity.uuid}:${fieldName}`;
|
|
170
|
-
registeredFields[key] = {
|
|
171
|
-
|
|
142
|
+
registeredFields[key] = {
|
|
143
|
+
element: element2,
|
|
144
|
+
entity,
|
|
145
|
+
fieldName,
|
|
146
|
+
...data
|
|
147
|
+
};
|
|
148
|
+
intersectionObserver.observe(element2);
|
|
149
|
+
doInitTimeout();
|
|
172
150
|
};
|
|
173
|
-
const updateFieldElement = (entity, fieldName,
|
|
151
|
+
const updateFieldElement = (entity, fieldName, element2, data) => {
|
|
174
152
|
const key = `${entity.uuid}:${fieldName}`;
|
|
175
153
|
const existingElement = registeredFields[key]?.element;
|
|
176
154
|
if (existingElement) {
|
|
177
155
|
intersectionObserver.unobserve(existingElement);
|
|
178
156
|
}
|
|
179
|
-
registeredFields[key] = {
|
|
180
|
-
|
|
157
|
+
registeredFields[key] = {
|
|
158
|
+
entity,
|
|
159
|
+
fieldName,
|
|
160
|
+
element: element2,
|
|
161
|
+
...data
|
|
162
|
+
};
|
|
163
|
+
intersectionObserver.observe(element2);
|
|
181
164
|
};
|
|
182
165
|
const unregisterField = (entity, fieldName) => {
|
|
183
166
|
const key = `${entity.uuid}:${fieldName}`;
|
|
@@ -188,6 +171,10 @@ export default function(ui, debug, definitions) {
|
|
|
188
171
|
visibleFields.delete(key);
|
|
189
172
|
registeredFields[key] = void 0;
|
|
190
173
|
};
|
|
174
|
+
const getRegisteredField = (uuid, fieldName) => {
|
|
175
|
+
const key = `${uuid}:${fieldName}`;
|
|
176
|
+
return registeredFields[key];
|
|
177
|
+
};
|
|
191
178
|
function getElementToObserve(uuid, el, bundle, fieldListType, parentBlockBundle) {
|
|
192
179
|
if (el.classList.contains("bk-block-proxy")) {
|
|
193
180
|
return el;
|
|
@@ -213,40 +200,26 @@ export default function(ui, debug, definitions) {
|
|
|
213
200
|
observedElementCache.set(key, el);
|
|
214
201
|
return el;
|
|
215
202
|
}
|
|
216
|
-
const findBlock = (uuid) => {
|
|
217
|
-
const cached = draggableBlockCache[uuid];
|
|
218
|
-
if (cached) {
|
|
219
|
-
return cached;
|
|
220
|
-
}
|
|
221
|
-
const el = registeredBlocks[uuid];
|
|
222
|
-
if (!el) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
const item = buildDraggableItem(el);
|
|
226
|
-
if (item?.itemType === "existing") {
|
|
227
|
-
draggableBlockCache[uuid] = item;
|
|
228
|
-
return item;
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
const getAllBlocks = () => {
|
|
232
|
-
return [
|
|
233
|
-
...document.querySelectorAll(
|
|
234
|
-
'[data-blokkli-provider-active="true"] [data-uuid]'
|
|
235
|
-
)
|
|
236
|
-
].map((v) => {
|
|
237
|
-
const item = buildDraggableItem(v);
|
|
238
|
-
if (item?.itemType === "existing") {
|
|
239
|
-
return item;
|
|
240
|
-
}
|
|
241
|
-
}).filter(falsy);
|
|
242
|
-
};
|
|
243
203
|
const getDropElementMarkup = (item, checkSize) => {
|
|
244
|
-
const
|
|
204
|
+
const getElement = () => {
|
|
205
|
+
if ("itemType" in item) {
|
|
206
|
+
if (item.itemType === "existing") {
|
|
207
|
+
return getDragElement(item);
|
|
208
|
+
}
|
|
209
|
+
return item.element();
|
|
210
|
+
}
|
|
211
|
+
return getDragElement(item);
|
|
212
|
+
};
|
|
213
|
+
const el = getElement();
|
|
245
214
|
if (!el) {
|
|
246
215
|
return "";
|
|
247
216
|
}
|
|
248
|
-
const dropElement =
|
|
249
|
-
const childCount =
|
|
217
|
+
const dropElement = element.query(el, ".bk-drop-element", "Find drop element for markup.") || el;
|
|
218
|
+
const childCount = element.queryAll(
|
|
219
|
+
dropElement,
|
|
220
|
+
"*",
|
|
221
|
+
"Get child count for drop element markup."
|
|
222
|
+
).length;
|
|
250
223
|
if (checkSize && childCount > 80) {
|
|
251
224
|
return "";
|
|
252
225
|
}
|
|
@@ -255,32 +228,8 @@ export default function(ui, debug, definitions) {
|
|
|
255
228
|
""
|
|
256
229
|
);
|
|
257
230
|
};
|
|
258
|
-
const findField = (uuid, fieldName) => {
|
|
259
|
-
const el = document.querySelector(
|
|
260
|
-
`[data-field-name="${fieldName}"][data-host-entity-uuid="${uuid}"]`
|
|
261
|
-
);
|
|
262
|
-
if (!(el instanceof HTMLElement)) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
return buildFieldElement(el);
|
|
266
|
-
};
|
|
267
|
-
const getAllDroppableFields = () => [...document.querySelectorAll("[data-blokkli-droppable-field]")].filter((el) => {
|
|
268
|
-
return !el.closest('[data-bk-in-proxy="true"]');
|
|
269
|
-
}).map(mapDroppableField);
|
|
270
231
|
const getVisibleBlocks = () => Array.from(visibleBlocks);
|
|
271
232
|
const getVisibleFields = () => Array.from(visibleFields);
|
|
272
|
-
const getActiveProviderElement = () => {
|
|
273
|
-
const el = document.querySelector('[data-blokkli-provider-active="true"]');
|
|
274
|
-
if (!el) {
|
|
275
|
-
throw new Error("Failed to find active <BlokkliProvider> element.");
|
|
276
|
-
}
|
|
277
|
-
if (!(el instanceof HTMLElement)) {
|
|
278
|
-
throw new TypeError(
|
|
279
|
-
"The root element of the active <BlokkliProvider> is not an HTMLElement."
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
return el;
|
|
283
|
-
};
|
|
284
233
|
function getBlockRects() {
|
|
285
234
|
return blockRects;
|
|
286
235
|
}
|
|
@@ -322,9 +271,7 @@ export default function(ui, debug, definitions) {
|
|
|
322
271
|
);
|
|
323
272
|
}
|
|
324
273
|
function refreshFieldRect(key) {
|
|
325
|
-
const el =
|
|
326
|
-
`.bk-draggable-list-container[data-field-key="${key}"]`
|
|
327
|
-
);
|
|
274
|
+
const el = registeredFields[key]?.element;
|
|
328
275
|
if (!(el instanceof HTMLElement)) {
|
|
329
276
|
return;
|
|
330
277
|
}
|
|
@@ -365,7 +312,6 @@ export default function(ui, debug, definitions) {
|
|
|
365
312
|
}
|
|
366
313
|
onBlokkliEvent("state:reloaded", () => {
|
|
367
314
|
observedElementCache.clear();
|
|
368
|
-
draggableBlockCache = {};
|
|
369
315
|
if (stateReloadTimeout) {
|
|
370
316
|
window.clearTimeout(stateReloadTimeout);
|
|
371
317
|
}
|
|
@@ -375,11 +321,13 @@ export default function(ui, debug, definitions) {
|
|
|
375
321
|
}
|
|
376
322
|
stateReloadTimeout = window.setTimeout(updateVisibleRects, 300);
|
|
377
323
|
});
|
|
378
|
-
|
|
324
|
+
function forceRefresh() {
|
|
379
325
|
updateVisibleRects();
|
|
380
326
|
getVisibleFields().forEach(refreshFieldRect);
|
|
381
327
|
logger.log("Refreshed all visible rects");
|
|
382
|
-
}
|
|
328
|
+
}
|
|
329
|
+
onBlokkliEvent("option:finish-change", forceRefresh);
|
|
330
|
+
onBlokkliEvent("ui:resized", forceRefresh);
|
|
383
331
|
function init() {
|
|
384
332
|
intersectionObserver.init();
|
|
385
333
|
intersectionReady.value = true;
|
|
@@ -388,16 +336,20 @@ export default function(ui, debug, definitions) {
|
|
|
388
336
|
const dragElementUuidMap = /* @__PURE__ */ new WeakMap();
|
|
389
337
|
const dragElementCache = /* @__PURE__ */ new Map();
|
|
390
338
|
function getDragElement(block) {
|
|
391
|
-
const
|
|
339
|
+
const item = "itemType" in block ? block.block : block;
|
|
340
|
+
if (!item) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const el = registeredBlocks[item.uuid];
|
|
392
344
|
if (!el) {
|
|
393
|
-
return
|
|
345
|
+
return;
|
|
394
346
|
}
|
|
395
347
|
return getElementToObserve(
|
|
396
|
-
|
|
348
|
+
item.uuid,
|
|
397
349
|
el,
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
350
|
+
item.bundle,
|
|
351
|
+
item.fieldListType,
|
|
352
|
+
item.parentBlockBundle
|
|
401
353
|
);
|
|
402
354
|
}
|
|
403
355
|
function isBlockVisible(uuid) {
|
|
@@ -415,9 +367,7 @@ export default function(ui, debug, definitions) {
|
|
|
415
367
|
}
|
|
416
368
|
}
|
|
417
369
|
}
|
|
418
|
-
function
|
|
419
|
-
logger.log("registerBlock: " + uuid);
|
|
420
|
-
blockUuidCurrentKey[uuid] = key;
|
|
370
|
+
function doInitTimeout() {
|
|
421
371
|
if (initTimeout) {
|
|
422
372
|
window.clearTimeout(initTimeout);
|
|
423
373
|
}
|
|
@@ -427,6 +377,11 @@ export default function(ui, debug, definitions) {
|
|
|
427
377
|
refreshAllBlockRects();
|
|
428
378
|
}, 500);
|
|
429
379
|
}
|
|
380
|
+
}
|
|
381
|
+
function registerBlock(key, uuid, el) {
|
|
382
|
+
logger.log("registerBlock: " + uuid);
|
|
383
|
+
blockUuidCurrentKey[uuid] = key;
|
|
384
|
+
doInitTimeout();
|
|
430
385
|
if (!el) {
|
|
431
386
|
logger.log("registerBlock call unregisterBlock because no element", uuid);
|
|
432
387
|
unregisterBlock(key, uuid);
|
|
@@ -439,18 +394,24 @@ export default function(ui, debug, definitions) {
|
|
|
439
394
|
);
|
|
440
395
|
unregisterBlock(key, uuid);
|
|
441
396
|
}
|
|
442
|
-
const item =
|
|
443
|
-
if (item
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
397
|
+
const item = state.getFieldListItem(uuid);
|
|
398
|
+
if (item) {
|
|
399
|
+
const fieldList = state.getFieldListForBlock(item.uuid);
|
|
400
|
+
if (fieldList) {
|
|
401
|
+
const fieldListType = getRegisteredField(fieldList.entityUuid, fieldList.name)?.fieldListType ?? "default";
|
|
402
|
+
const parentBundle = fieldList.entityType === itemEntityType ? state.getFieldListItem(fieldList.entityUuid)?.bundle ?? null : null;
|
|
403
|
+
const observableElement = getElementToObserve(
|
|
404
|
+
item.uuid,
|
|
405
|
+
el,
|
|
406
|
+
item.bundle,
|
|
407
|
+
fieldListType,
|
|
408
|
+
parentBundle
|
|
409
|
+
);
|
|
410
|
+
registeredBlocks[uuid] = el;
|
|
411
|
+
observedElements[uuid] = observableElement;
|
|
412
|
+
intersectionObserver.observe(observableElement);
|
|
413
|
+
resizeObserver.observe(observableElement);
|
|
414
|
+
}
|
|
454
415
|
}
|
|
455
416
|
}
|
|
456
417
|
function unregisterBlock(key, uuid) {
|
|
@@ -460,30 +421,100 @@ export default function(ui, debug, definitions) {
|
|
|
460
421
|
}
|
|
461
422
|
logger.log("unregisterBlock: " + uuid);
|
|
462
423
|
const el = registeredBlocks[uuid];
|
|
424
|
+
const observedElement = observedElements[uuid];
|
|
425
|
+
if (observedElement) {
|
|
426
|
+
intersectionObserver.unobserve(observedElement);
|
|
427
|
+
resizeObserver.unobserve(observedElement);
|
|
428
|
+
delete observedElements[uuid];
|
|
429
|
+
}
|
|
463
430
|
if (el) {
|
|
464
|
-
intersectionObserver.unobserve(el);
|
|
465
|
-
resizeObserver.unobserve(el);
|
|
466
431
|
dragElementUuidMap.delete(el);
|
|
467
432
|
}
|
|
468
433
|
dragElementCache.delete(uuid);
|
|
469
434
|
registeredBlocks[uuid] = void 0;
|
|
470
435
|
delete blockRects[uuid];
|
|
436
|
+
delete blockUuidCurrentKey[uuid];
|
|
471
437
|
visibleBlocks.delete(uuid);
|
|
472
438
|
}
|
|
439
|
+
function getDebugData() {
|
|
440
|
+
const allUuids = /* @__PURE__ */ new Set([
|
|
441
|
+
...Object.keys(registeredBlocks),
|
|
442
|
+
...Object.keys(blockRects),
|
|
443
|
+
...Object.keys(observedElements),
|
|
444
|
+
...Object.keys(blockUuidCurrentKey)
|
|
445
|
+
]);
|
|
446
|
+
const blocksInfo = Array.from(allUuids).map((uuid) => {
|
|
447
|
+
const el = registeredBlocks[uuid];
|
|
448
|
+
return {
|
|
449
|
+
uuid,
|
|
450
|
+
hasElement: !!el,
|
|
451
|
+
hasObservedElement: !!observedElements[uuid],
|
|
452
|
+
hasRect: !!blockRects[uuid],
|
|
453
|
+
hasCurrentKey: !!blockUuidCurrentKey[uuid],
|
|
454
|
+
isVisible: visibleBlocks.has(uuid),
|
|
455
|
+
elementInfo: el ? {
|
|
456
|
+
tagName: el.tagName,
|
|
457
|
+
bundle: el.dataset.itemBundle,
|
|
458
|
+
hostBundle: el.dataset.hostBundle,
|
|
459
|
+
fieldListType: el.dataset.hostFieldListType
|
|
460
|
+
} : void 0
|
|
461
|
+
};
|
|
462
|
+
});
|
|
463
|
+
const fieldsInfo = Object.entries(registeredFields).filter(([, field]) => !!field).map(([key, field]) => ({
|
|
464
|
+
key,
|
|
465
|
+
isVisible: visibleFields.has(key),
|
|
466
|
+
hasRect: !!fieldRects[key],
|
|
467
|
+
entityType: field.entity.type,
|
|
468
|
+
entityBundle: field.entity.bundle,
|
|
469
|
+
fieldName: field.fieldName
|
|
470
|
+
}));
|
|
471
|
+
const registeredUuids = new Set(
|
|
472
|
+
Object.entries(registeredBlocks).filter(([, el]) => !!el).map(([uuid]) => uuid)
|
|
473
|
+
);
|
|
474
|
+
const rectsWithoutRegistration = Object.keys(blockRects).filter(
|
|
475
|
+
(uuid) => !registeredUuids.has(uuid)
|
|
476
|
+
);
|
|
477
|
+
const observedElementsWithoutRegistration = Object.keys(
|
|
478
|
+
observedElements
|
|
479
|
+
).filter((uuid) => !registeredUuids.has(uuid));
|
|
480
|
+
const keysWithoutRegistration = Object.keys(blockUuidCurrentKey).filter(
|
|
481
|
+
(uuid) => !registeredUuids.has(uuid)
|
|
482
|
+
);
|
|
483
|
+
return {
|
|
484
|
+
registeredBlocks: blocksInfo,
|
|
485
|
+
fields: fieldsInfo,
|
|
486
|
+
summary: {
|
|
487
|
+
totalRegisteredBlocks: Object.keys(registeredBlocks).length,
|
|
488
|
+
totalBlocksWithElements: Object.values(registeredBlocks).filter(
|
|
489
|
+
(el) => !!el
|
|
490
|
+
).length,
|
|
491
|
+
totalObservedElements: Object.keys(observedElements).length,
|
|
492
|
+
totalBlockRects: Object.keys(blockRects).length,
|
|
493
|
+
totalVisibleBlocks: visibleBlocks.size,
|
|
494
|
+
totalRegisteredFields: Object.values(registeredFields).filter(
|
|
495
|
+
(f) => !!f
|
|
496
|
+
).length,
|
|
497
|
+
totalVisibleFields: visibleFields.size,
|
|
498
|
+
totalFieldRects: Object.keys(fieldRects).length,
|
|
499
|
+
isInitializing: isInitalizing.value,
|
|
500
|
+
isReady: mutationsReady.value && intersectionReady.value && !isInitalizing.value
|
|
501
|
+
},
|
|
502
|
+
orphanedData: {
|
|
503
|
+
rectsWithoutRegistration,
|
|
504
|
+
observedElementsWithoutRegistration,
|
|
505
|
+
keysWithoutRegistration
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
}
|
|
473
509
|
return {
|
|
474
|
-
findBlock,
|
|
475
|
-
getAllBlocks,
|
|
476
510
|
findClosestBlock,
|
|
477
511
|
getDropElementMarkup,
|
|
478
|
-
findField,
|
|
479
|
-
getAllDroppableFields,
|
|
480
512
|
findClosestEntityContext,
|
|
481
513
|
getVisibleBlocks,
|
|
482
514
|
getVisibleFields,
|
|
483
515
|
registerField,
|
|
484
516
|
unregisterField,
|
|
485
517
|
updateFieldElement,
|
|
486
|
-
getActiveProviderElement,
|
|
487
518
|
getBlockRects,
|
|
488
519
|
getBlockRect,
|
|
489
520
|
getFieldRect,
|
|
@@ -498,6 +529,9 @@ export default function(ui, debug, definitions) {
|
|
|
498
529
|
registeredFieldTypes,
|
|
499
530
|
registerBlock,
|
|
500
531
|
unregisterBlock,
|
|
501
|
-
registeredBlockUuids
|
|
532
|
+
registeredBlockUuids,
|
|
533
|
+
getDebugData,
|
|
534
|
+
getRegisteredField,
|
|
535
|
+
registeredBlocks: computed(() => registeredBlocks)
|
|
502
536
|
};
|
|
503
537
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DraggableItem, Rectangle,
|
|
1
|
+
import type { DraggableItem, Rectangle, DraggableExistingBlock, EntityContext, Coord, LibraryItemProps, Size } from '#blokkli/types';
|
|
2
2
|
import type { RGB } from '#blokkli/types/theme';
|
|
3
3
|
/**
|
|
4
4
|
* Type check for falsy values.
|
|
@@ -11,7 +11,6 @@ export declare function falsy<T>(value: T): value is NonNullable<T>;
|
|
|
11
11
|
* Maps a HTML element that is draggable to a draggable item data object.
|
|
12
12
|
*/
|
|
13
13
|
export declare function buildDraggableItem(element: Element | EventTarget): DraggableItem | undefined;
|
|
14
|
-
export declare function findElement(uuid: string): HTMLElement | undefined;
|
|
15
14
|
export declare function onlyUnique(value: string, index: number, self: Array<string>): boolean;
|
|
16
15
|
/**
|
|
17
16
|
* Convert a date to a relative time string, such as
|
|
@@ -83,12 +82,6 @@ export declare const findClosestBlock: (el: Element | EventTarget) => DraggableE
|
|
|
83
82
|
*/
|
|
84
83
|
export declare const findClosestEntityContext: (el: HTMLElement) => EntityContext | undefined;
|
|
85
84
|
export declare const findParentContext: (el: HTMLElement) => EntityContext | DraggableExistingBlock | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* Maps a HTMLElement to a DroppableEntityField.
|
|
88
|
-
*/
|
|
89
|
-
export declare const mapDroppableField: (el: Element) => DroppableEntityField;
|
|
90
|
-
export declare const originatesFromEditable: (e: MouseEvent | TouchEvent) => HTMLElement | undefined;
|
|
91
|
-
export declare const getOriginatingDroppableElement: (e: MouseEvent | TouchEvent) => HTMLElement | undefined;
|
|
92
85
|
export declare const originatesFromTextInput: (e: Event) => boolean;
|
|
93
86
|
export declare function getFieldKey(uuid: string, fieldName: string): string;
|
|
94
87
|
export declare function getInteractionCoordinates(e: MouseEvent | TouchEvent): Coord;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { easeOutSine } from "./easing.js";
|
|
2
|
-
import { useRuntimeConfig } from "#imports";
|
|
3
2
|
export function falsy(value) {
|
|
4
3
|
return value !== null && value !== void 0;
|
|
5
4
|
}
|
|
@@ -7,44 +6,8 @@ export function buildDraggableItem(element) {
|
|
|
7
6
|
if (!(element instanceof HTMLElement)) {
|
|
8
7
|
return;
|
|
9
8
|
}
|
|
10
|
-
const itemEntityType = useRuntimeConfig().public.blokkli.itemEntityType;
|
|
11
9
|
const dataset = element.dataset;
|
|
12
|
-
if (dataset.elementType === "
|
|
13
|
-
const uuid = dataset.uuid;
|
|
14
|
-
const itemBundle = dataset.itemBundle;
|
|
15
|
-
const entityType = dataset.entityType;
|
|
16
|
-
const hostType = dataset.hostType;
|
|
17
|
-
const hostUuid = dataset.hostUuid;
|
|
18
|
-
const hostBundle = dataset.hostBundle;
|
|
19
|
-
const hostFieldName = dataset.hostFieldName;
|
|
20
|
-
const reusableBundle = dataset.reusableBundle;
|
|
21
|
-
const hostFieldListType = dataset.hostFieldListType;
|
|
22
|
-
const libraryItemUuid = dataset.bkLibraryItemUuid;
|
|
23
|
-
const isNew = dataset.isNew === "true";
|
|
24
|
-
const parentBlockBundle = hostType === itemEntityType ? hostBundle : void 0;
|
|
25
|
-
if (uuid && hostType && hostUuid && hostFieldName && itemBundle && hostBundle && entityType && hostFieldListType) {
|
|
26
|
-
const libraryLabel = dataset.bkLibraryLabel;
|
|
27
|
-
const editTitle = libraryLabel || "";
|
|
28
|
-
return {
|
|
29
|
-
itemType: "existing",
|
|
30
|
-
element: () => document.querySelector(`[data-uuid="${uuid}"]`),
|
|
31
|
-
itemBundle,
|
|
32
|
-
entityType,
|
|
33
|
-
isNested: hostType === itemEntityType,
|
|
34
|
-
uuid,
|
|
35
|
-
hostType,
|
|
36
|
-
hostBundle,
|
|
37
|
-
hostUuid,
|
|
38
|
-
hostFieldName,
|
|
39
|
-
hostFieldListType,
|
|
40
|
-
reusableBundle,
|
|
41
|
-
libraryItemUuid,
|
|
42
|
-
editTitle: editTitle || void 0,
|
|
43
|
-
isNew,
|
|
44
|
-
parentBlockBundle
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
} else if (dataset.elementType === "new") {
|
|
10
|
+
if (dataset.elementType === "new") {
|
|
48
11
|
const itemBundle = dataset.itemBundle;
|
|
49
12
|
if (itemBundle) {
|
|
50
13
|
return {
|
|
@@ -111,14 +74,6 @@ export function buildDraggableItem(element) {
|
|
|
111
74
|
}
|
|
112
75
|
}
|
|
113
76
|
}
|
|
114
|
-
export function findElement(uuid) {
|
|
115
|
-
const el = document.querySelector(
|
|
116
|
-
`[data-uuid="${uuid}"]:not(.bk-sortli-leave-from)`
|
|
117
|
-
);
|
|
118
|
-
if (el instanceof HTMLElement) {
|
|
119
|
-
return el;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
77
|
export function onlyUnique(value, index, self) {
|
|
123
78
|
return self.indexOf(value) === index;
|
|
124
79
|
}
|
|
@@ -443,44 +398,6 @@ export const findParentContext = (el) => {
|
|
|
443
398
|
}
|
|
444
399
|
return findClosestEntityContext(el);
|
|
445
400
|
};
|
|
446
|
-
export const mapDroppableField = (el) => {
|
|
447
|
-
if (!(el instanceof HTMLElement)) {
|
|
448
|
-
throw new TypeError(
|
|
449
|
-
`v-blokkli-droppable directive is only allowed on elements of type HTMLElement.`
|
|
450
|
-
);
|
|
451
|
-
}
|
|
452
|
-
const fieldName = el.dataset.blokkliDroppableField;
|
|
453
|
-
if (!fieldName) {
|
|
454
|
-
throw new Error(`Missing field name in v-blokkli-droppable directive.`);
|
|
455
|
-
}
|
|
456
|
-
const host = findParentContext(el);
|
|
457
|
-
if (!host) {
|
|
458
|
-
throw new Error(
|
|
459
|
-
`Failed to locate parent context for v-blokkli-droppable field with name "${fieldName}". Make sure the element is always rendered inside a block component or inside a <BlokkliProvider>.`
|
|
460
|
-
);
|
|
461
|
-
}
|
|
462
|
-
return {
|
|
463
|
-
element: el,
|
|
464
|
-
host,
|
|
465
|
-
fieldName
|
|
466
|
-
};
|
|
467
|
-
};
|
|
468
|
-
export const originatesFromEditable = (e) => {
|
|
469
|
-
if (e.target instanceof HTMLElement) {
|
|
470
|
-
const el = e.target.closest("[data-blokkli-editable-field]");
|
|
471
|
-
if (el instanceof HTMLElement) {
|
|
472
|
-
return el;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
};
|
|
476
|
-
export const getOriginatingDroppableElement = (e) => {
|
|
477
|
-
if (e.target instanceof HTMLElement) {
|
|
478
|
-
const el = e.target.closest("[data-blokkli-droppable-field]");
|
|
479
|
-
if (el instanceof HTMLElement) {
|
|
480
|
-
return el;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
401
|
export const originatesFromTextInput = (e) => e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement;
|
|
485
402
|
export function getFieldKey(uuid, fieldName) {
|
|
486
403
|
return uuid + ":" + fieldName;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RenderedFieldListItem } from '#blokkli/types';
|
|
2
|
+
import type { DomProvider } from '../domProvider.js';
|
|
3
|
+
import type { StateProvider } from '../stateProvider.js';
|
|
4
|
+
import type { AdapterContext } from '#blokkli/adapter';
|
|
5
|
+
import type { ComputedRef } from 'vue';
|
|
6
|
+
export type BlocksProvider = {
|
|
7
|
+
getBlock: (uuid: string) => RenderedFieldListItem | undefined;
|
|
8
|
+
getAllBlocks: () => RenderedFieldListItem[];
|
|
9
|
+
};
|
|
10
|
+
export default function (state: StateProvider, dom: DomProvider, context: ComputedRef<AdapterContext>): BlocksProvider;
|