@blokkli/editor 2.0.0-alpha.15 → 2.0.0-alpha.17
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 +330 -93
- package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +1 -1
- package/dist/modules/drupal/graphql/features/comments.graphql +11 -8
- package/dist/modules/drupal/runtime/adapter/index.js +2 -2
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +1 -3
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +4 -2
- package/dist/runtime/components/BlokkliEditable.vue +22 -4
- package/dist/runtime/components/BlokkliProvider.vue +29 -20
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +2 -1
- package/dist/runtime/components/Edit/Actions/index.vue +9 -4
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +420 -25
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +80 -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 +3 -0
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +2 -0
- 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 +79 -22
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +19 -20
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +1 -1
- 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/Comments/CommentInput/index.vue.d.ts +13 -0
- 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 +20 -8
- 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 +4 -165
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +7 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +62 -39
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/vertex.glsl +1 -0
- package/dist/runtime/components/Edit/Features/Edit/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +63 -3
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +13 -9
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +17 -76
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +1 -1
- 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 +270 -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/Library/LibraryDialog/index.vue +19 -27
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +27 -23
- package/dist/runtime/components/Edit/Features/Library/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +34 -27
- 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 +1 -0
- 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/Summary.vue +2 -2
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +17 -7
- 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 +4 -2
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +106 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +417 -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 +33 -106
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +88 -29
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +11 -2
- package/dist/runtime/components/Edit/Features/Selection/index.vue +26 -19
- package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +17 -11
- package/dist/runtime/components/Edit/Features/Translations/index.vue +13 -16
- 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/Indicators/index.vue +1 -1
- package/dist/runtime/components/Edit/Konami/Game/index.vue +5 -5
- package/dist/runtime/components/Edit/index.d.ts +5 -3
- package/dist/runtime/components/Edit/index.js +8 -4
- package/dist/runtime/composables/defineBlokkli.js +5 -3
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.d.ts +34 -1
- package/dist/runtime/helpers/animationProvider.js +175 -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/useDelayedIntersectionObserver.d.ts +1 -1
- package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.js +3 -2
- package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +4 -1
- package/dist/runtime/helpers/composables/useStickyToolbar.js +53 -35
- package/dist/runtime/helpers/dom/index.d.ts +1 -0
- package/dist/runtime/helpers/domProvider.d.ts +46 -0
- package/dist/runtime/helpers/domProvider.js +101 -7
- package/dist/runtime/helpers/editableProvider.d.ts +14 -0
- package/dist/runtime/helpers/editableProvider.js +144 -0
- package/dist/runtime/helpers/stateProvider.d.ts +6 -2
- package/dist/runtime/helpers/stateProvider.js +66 -3
- 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/uiProvider.d.ts +8 -1
- package/dist/runtime/helpers/uiProvider.js +34 -2
- package/dist/runtime/helpers/webgl/index.d.ts +11 -2
- package/dist/runtime/helpers/webgl/index.js +162 -7
- package/dist/runtime/plugins/blokkliEditable.js +74 -3
- package/dist/runtime/types/index.d.ts +13 -1
- package/package.json +1 -1
- package/dist/runtime/components/Edit/DragInteractions/index.vue +0 -401
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue +0 -54
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue.d.ts +0 -14
- /package/dist/runtime/components/Edit/{DragInteractions → Features/Hover}/index.vue.d.ts +0 -0
|
@@ -1,185 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-if="debug.isEnabled.value"
|
|
4
|
-
id="debug"
|
|
5
|
-
title="Debug"
|
|
6
|
-
icon="bug"
|
|
7
|
-
weight="200"
|
|
8
|
-
>
|
|
9
|
-
<div class="bk bk-debug">
|
|
10
|
-
<section>
|
|
11
|
-
<h2>Keyboard</h2>
|
|
12
|
-
<div class="bk-debug-list">
|
|
13
|
-
<div>
|
|
14
|
-
<div>Space</div>
|
|
15
|
-
<div>{{ keyboard.isPressingSpace.value }}</div>
|
|
16
|
-
</div>
|
|
17
|
-
<div>
|
|
18
|
-
<div>Control</div>
|
|
19
|
-
<div>{{ keyboard.isPressingControl.value }}</div>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</section>
|
|
23
|
-
|
|
24
|
-
<section>
|
|
25
|
-
<h2>Selection</h2>
|
|
26
|
-
<div class="bk-debug-list">
|
|
27
|
-
<div>
|
|
28
|
-
<div>Count</div>
|
|
29
|
-
<div>{{ selection.uuids.value.length }}</div>
|
|
30
|
-
</div>
|
|
31
|
-
<div>
|
|
32
|
-
<div>isDragging</div>
|
|
33
|
-
<div>{{ selection.isDragging.value }}</div>
|
|
34
|
-
</div>
|
|
35
|
-
<div>
|
|
36
|
-
<div>isDraggingExisting</div>
|
|
37
|
-
<div>{{ selection.isDraggingExisting.value }}</div>
|
|
38
|
-
</div>
|
|
39
|
-
<div>
|
|
40
|
-
<div>Is multiselecting</div>
|
|
41
|
-
<div>{{ selection.isMultiSelecting.value }}</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</section>
|
|
45
|
-
|
|
46
|
-
<section>
|
|
47
|
-
<h2>Rendering</h2>
|
|
48
|
-
<div class="bk-debug-list">
|
|
49
|
-
<div v-for="overlay in debug.overlays.value" :key="overlay.id">
|
|
50
|
-
<FormToggle
|
|
51
|
-
:label="overlay.label"
|
|
52
|
-
:model-value="overlay.active"
|
|
53
|
-
@update:model-value="debug.toggleOverlay(overlay.id)"
|
|
54
|
-
/>
|
|
55
|
-
</div>
|
|
56
|
-
<div>
|
|
57
|
-
<FormToggle
|
|
58
|
-
label="Set transforming"
|
|
59
|
-
:model-value="ui.isTransforming.value"
|
|
60
|
-
@update:model-value="toggleTransforming"
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div>
|
|
65
|
-
<FormToggle
|
|
66
|
-
label="Enable WebGL"
|
|
67
|
-
:model-value="animation.webglEnabled.value"
|
|
68
|
-
@update:model-value="toggleWebgl"
|
|
69
|
-
/>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
</section>
|
|
73
|
-
|
|
74
|
-
<section>
|
|
75
|
-
<h2>Icons</h2>
|
|
76
|
-
<div class="bk-debug-icons">
|
|
77
|
-
<div v-for="icon in iconItems" :key="icon">
|
|
78
|
-
<Icon :name="icon" />
|
|
79
|
-
<p>{{ icon }}</p>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
</section>
|
|
83
|
-
|
|
84
|
-
<section>
|
|
85
|
-
<h2>Features</h2>
|
|
86
|
-
<div class="bk-debug-features">
|
|
87
|
-
<div v-for="feature in featuresList" :key="feature.id">
|
|
88
|
-
<div>
|
|
89
|
-
<span
|
|
90
|
-
class="bk-status-indicator"
|
|
91
|
-
:class="feature.mounted ? 'bk-is-success' : 'bk-is-danger'"
|
|
92
|
-
/>
|
|
93
|
-
</div>
|
|
94
|
-
<div>
|
|
95
|
-
<h3>{{ feature.label }}</h3>
|
|
96
|
-
<div>{{ feature.id }}</div>
|
|
97
|
-
<p>{{ feature.description }}</p>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
</section>
|
|
102
|
-
</div>
|
|
103
|
-
</PluginSidebar>
|
|
104
|
-
|
|
105
|
-
<PluginDebugOverlay id="viewport" title="Show viewport overlay">
|
|
106
|
-
<DebugViewport />
|
|
107
|
-
</PluginDebugOverlay>
|
|
108
|
-
|
|
109
|
-
<PluginDebugOverlay id="rects" title="Show field and block rects">
|
|
110
|
-
<DebugRects />
|
|
111
|
-
</PluginDebugOverlay>
|
|
2
|
+
<Renderer v-if="debug.isEnabled.value" :logger />
|
|
112
3
|
</template>
|
|
113
4
|
|
|
114
5
|
<script setup>
|
|
115
|
-
import {
|
|
116
|
-
useBlokkli,
|
|
117
|
-
onMounted,
|
|
118
|
-
onBeforeUnmount,
|
|
119
|
-
defineBlokkliFeature,
|
|
120
|
-
computed
|
|
121
|
-
} from "#imports";
|
|
122
|
-
import { PluginSidebar, PluginDebugOverlay } from "#blokkli/plugins";
|
|
123
|
-
import { Icon, FormToggle } from "#blokkli/components";
|
|
124
|
-
import { icons } from "#blokkli-build/icons";
|
|
125
6
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
126
|
-
import
|
|
127
|
-
import
|
|
7
|
+
import { defineBlokkliFeature, useBlokkli } from "#imports";
|
|
8
|
+
import Renderer from "./Renderer.vue";
|
|
128
9
|
const { logger } = defineBlokkliFeature({
|
|
129
10
|
id: "debug",
|
|
130
11
|
label: "Debug",
|
|
131
12
|
icon: "bug",
|
|
132
13
|
description: "Provides debugging functionality."
|
|
133
14
|
});
|
|
134
|
-
const {
|
|
135
|
-
const iconItems = computed(() => Object.keys(icons));
|
|
136
|
-
const featuresList = computed(() => {
|
|
137
|
-
return features.features.value.map((v) => {
|
|
138
|
-
const feature = features.mountedFeatures.value.find((f) => f.id === v.id);
|
|
139
|
-
return {
|
|
140
|
-
id: v.id,
|
|
141
|
-
label: v.label,
|
|
142
|
-
description: v.description,
|
|
143
|
-
dependencies: v.dependencies?.join(", "),
|
|
144
|
-
mounted: !!feature
|
|
145
|
-
};
|
|
146
|
-
});
|
|
147
|
-
});
|
|
15
|
+
const { debug } = useBlokkli();
|
|
148
16
|
onBlokkliEvent("keyPressed", (e) => {
|
|
149
17
|
if (e.code === "=" && e.meta) {
|
|
150
18
|
e.originalEvent.preventDefault();
|
|
151
19
|
debug.toggle();
|
|
152
20
|
}
|
|
153
21
|
});
|
|
154
|
-
const onEvent = (name, data) => {
|
|
155
|
-
if (!debug.isEnabled.value) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
if (name === "animationFrame" || name === "animationFrame:before" || name === "canvas:draw") {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
logger.log("Event: " + String(name), data);
|
|
162
|
-
};
|
|
163
|
-
function toggleTransforming() {
|
|
164
|
-
if (ui.isTransforming.value) {
|
|
165
|
-
ui.setTransform();
|
|
166
|
-
} else {
|
|
167
|
-
ui.setTransform("Transform plugin label");
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function toggleWebgl() {
|
|
171
|
-
if (animation.webglEnabled.value) {
|
|
172
|
-
animation.webglEnabled.value = false;
|
|
173
|
-
} else {
|
|
174
|
-
animation.webglEnabled.value = true;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
onMounted(() => {
|
|
178
|
-
eventBus.on("*", onEvent);
|
|
179
|
-
});
|
|
180
|
-
onBeforeUnmount(() => {
|
|
181
|
-
eventBus.off("*", onEvent);
|
|
182
|
-
});
|
|
183
22
|
</script>
|
|
184
23
|
|
|
185
24
|
<script>
|
|
@@ -8,6 +8,7 @@ varying vec3 v_color;
|
|
|
8
8
|
uniform float u_scale;
|
|
9
9
|
uniform float u_dpi;
|
|
10
10
|
uniform vec2 u_resolution;
|
|
11
|
+
uniform float u_active_hover_nesting_level;
|
|
11
12
|
|
|
12
13
|
float roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) {
|
|
13
14
|
return length(max(abs(CenterPosition) - Size + Radius, 0.0)) - Radius;
|
|
@@ -74,7 +75,12 @@ void main() {
|
|
|
74
75
|
: alphaInner * 0.2;
|
|
75
76
|
|
|
76
77
|
if (v_is_hover_area >= 1.0) {
|
|
77
|
-
|
|
78
|
+
// If nesting level is 0, don't render the fill (border only)
|
|
79
|
+
if (u_active_hover_nesting_level < 0.5) {
|
|
80
|
+
adjustedAlphaFill = 0.0;
|
|
81
|
+
} else {
|
|
82
|
+
adjustedAlphaFill *= 0.5;
|
|
83
|
+
}
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
if (alphaBorder > 0.0) {
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
toShaderColor
|
|
15
15
|
} from "#blokkli/helpers";
|
|
16
16
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
17
|
+
import defineRenderer from "#blokkli/helpers/composables/defineRenderer";
|
|
17
18
|
import { ref, computed, useBlokkli, onBeforeUnmount } from "#imports";
|
|
18
19
|
import {
|
|
19
20
|
setBuffersAndAttributes,
|
|
@@ -444,6 +445,7 @@ class DropTargetRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
444
445
|
false
|
|
445
446
|
);
|
|
446
447
|
}
|
|
448
|
+
this.processPendingRects();
|
|
447
449
|
const hasChanged = lengthBefore !== this.positions.length;
|
|
448
450
|
if (hasChanged) {
|
|
449
451
|
this.bufferInfo = this.createBufferInfo();
|
|
@@ -483,7 +485,9 @@ class DropTargetRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
483
485
|
return null;
|
|
484
486
|
}
|
|
485
487
|
}
|
|
486
|
-
const collector = new DropTargetRectangleBufferCollector(gl
|
|
488
|
+
const collector = new DropTargetRectangleBufferCollector(gl, {
|
|
489
|
+
deferredMode: true
|
|
490
|
+
});
|
|
487
491
|
if (gl) {
|
|
488
492
|
collector.addRectangle(
|
|
489
493
|
{
|
|
@@ -541,6 +545,18 @@ const activeHoverRect = computed(() => {
|
|
|
541
545
|
return [0, 0, 0, 0];
|
|
542
546
|
}
|
|
543
547
|
const outset = activeHoverField.value.field.nestingLevel === 0 ? 0 : 20;
|
|
548
|
+
if (activeHoverField.value.emptyChild) {
|
|
549
|
+
const emptyChildId = activeHoverField.value.emptyChild.id;
|
|
550
|
+
const adjustedRect = collector.rects[emptyChildId];
|
|
551
|
+
if (adjustedRect) {
|
|
552
|
+
return [
|
|
553
|
+
adjustedRect.x - outset,
|
|
554
|
+
adjustedRect.y - outset,
|
|
555
|
+
adjustedRect.width + 2 * outset,
|
|
556
|
+
adjustedRect.height + 2 * outset
|
|
557
|
+
];
|
|
558
|
+
}
|
|
559
|
+
}
|
|
544
560
|
return [
|
|
545
561
|
activeHoverField.value.x - outset,
|
|
546
562
|
activeHoverField.value.y - outset,
|
|
@@ -551,6 +567,9 @@ const activeHoverRect = computed(() => {
|
|
|
551
567
|
const activeHoverColor = computed(() => {
|
|
552
568
|
return getColorForField(activeHoverField.value);
|
|
553
569
|
});
|
|
570
|
+
const activeHoverFieldNestingLevel = computed(() => {
|
|
571
|
+
return activeHoverField.value?.field.nestingLevel ?? 0;
|
|
572
|
+
});
|
|
554
573
|
const uniforms = computed(() => {
|
|
555
574
|
const index = active.value?.index;
|
|
556
575
|
return {
|
|
@@ -561,7 +580,8 @@ const uniforms = computed(() => {
|
|
|
561
580
|
u_color_hover_area: toShaderColor(activeHoverColor.value),
|
|
562
581
|
u_color_area: toShaderColor(theme.teal.value.normal),
|
|
563
582
|
u_active_rect_id: index === void 0 ? -1 : index,
|
|
564
|
-
u_active_hover_rect: activeHoverRect.value
|
|
583
|
+
u_active_hover_rect: activeHoverRect.value,
|
|
584
|
+
u_active_hover_nesting_level: activeHoverFieldNestingLevel.value
|
|
565
585
|
};
|
|
566
586
|
});
|
|
567
587
|
const dragBox = ref({
|
|
@@ -607,6 +627,8 @@ function setHoveredFieldArea(box, mouse) {
|
|
|
607
627
|
activeHoverField.value = candidate;
|
|
608
628
|
}
|
|
609
629
|
}
|
|
630
|
+
let bufferInfo = null;
|
|
631
|
+
let bufferChanged = false;
|
|
610
632
|
onBlokkliEvent("canvas:draw", () => {
|
|
611
633
|
const scale = ui.artboardScale.value;
|
|
612
634
|
const offset = { ...ui.artboardOffset.value };
|
|
@@ -617,10 +639,9 @@ onBlokkliEvent("canvas:draw", () => {
|
|
|
617
639
|
height: props.box.height / scale
|
|
618
640
|
};
|
|
619
641
|
const mouseAbsolute = toCanvasSpaceCoordinates(props.mouseX, props.mouseY);
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
642
|
+
const result = collector.getBufferInfo();
|
|
643
|
+
bufferInfo = result.info;
|
|
644
|
+
bufferChanged = result.hasChanged;
|
|
624
645
|
if (!props.isTouch) {
|
|
625
646
|
if (cursorIsInsideClipped()) {
|
|
626
647
|
const closest = collector.getClosestIntersectingRect(
|
|
@@ -632,44 +653,46 @@ onBlokkliEvent("canvas:draw", () => {
|
|
|
632
653
|
active.value = null;
|
|
633
654
|
}
|
|
634
655
|
}
|
|
635
|
-
|
|
636
|
-
if (
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
656
|
+
setHoveredFieldArea(dragBox.value, mouseAbsolute);
|
|
657
|
+
if (!gl && ctx) {
|
|
658
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
659
|
+
const rects = Object.values(collector.rects);
|
|
660
|
+
for (let i = 0; i < rects.length; i++) {
|
|
661
|
+
const rect = rects[i];
|
|
662
|
+
if (active.value?.id === rect.id) {
|
|
663
|
+
ctx.fillStyle = rect.color;
|
|
664
|
+
} else {
|
|
665
|
+
ctx.fillStyle = rect.colorAlpha;
|
|
645
666
|
}
|
|
667
|
+
ctx.fillRect(
|
|
668
|
+
(rect.x * scale + offset.x) * animation.dpi.value,
|
|
669
|
+
(rect.y * scale + offset.y) * animation.dpi.value,
|
|
670
|
+
rect.width * animation.dpi.value * scale,
|
|
671
|
+
rect.height * animation.dpi.value * scale
|
|
672
|
+
);
|
|
646
673
|
}
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
if (!ctx) {
|
|
650
|
-
return;
|
|
651
|
-
}
|
|
652
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
653
|
-
const rects = Object.values(collector.rects);
|
|
654
|
-
for (let i = 0; i < rects.length; i++) {
|
|
655
|
-
const rect = rects[i];
|
|
656
|
-
if (active.value?.id === rect.id) {
|
|
657
|
-
ctx.fillStyle = rect.color;
|
|
658
|
-
} else {
|
|
659
|
-
ctx.fillStyle = rect.colorAlpha;
|
|
660
|
-
}
|
|
661
|
-
ctx.fillRect(
|
|
662
|
-
(rect.x * scale + offset.x) * animation.dpi.value,
|
|
663
|
-
(rect.y * scale + offset.y) * animation.dpi.value,
|
|
664
|
-
rect.width * animation.dpi.value * scale,
|
|
665
|
-
rect.height * animation.dpi.value * scale
|
|
666
|
-
);
|
|
667
674
|
}
|
|
668
675
|
});
|
|
676
|
+
if (gl && programInfo) {
|
|
677
|
+
defineRenderer("drop-targets", {
|
|
678
|
+
zIndex: 400,
|
|
679
|
+
only: true,
|
|
680
|
+
cursor: () => "grabbing",
|
|
681
|
+
render: () => {
|
|
682
|
+
gl.useProgram(programInfo.program);
|
|
683
|
+
animation.setSharedUniforms(gl, programInfo);
|
|
684
|
+
setUniforms(programInfo, uniforms.value);
|
|
685
|
+
if (!bufferInfo) {
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
if (bufferChanged) {
|
|
689
|
+
setBuffersAndAttributes(gl, programInfo, bufferInfo);
|
|
690
|
+
}
|
|
691
|
+
drawBufferInfo(gl, bufferInfo, gl.TRIANGLES);
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
}
|
|
669
695
|
onBeforeUnmount(() => {
|
|
670
|
-
if (gl) {
|
|
671
|
-
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
672
|
-
}
|
|
673
696
|
if (ctx) {
|
|
674
697
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
675
698
|
}
|
|
@@ -4,13 +4,23 @@
|
|
|
4
4
|
ref="iframe"
|
|
5
5
|
:style="{ height: Math.max(height, 150) + 'px' }"
|
|
6
6
|
:src="url"
|
|
7
|
+
@load="onIframeLoad"
|
|
7
8
|
/>
|
|
8
9
|
</div>
|
|
9
10
|
</template>
|
|
10
11
|
|
|
11
12
|
<script setup>
|
|
12
|
-
import {
|
|
13
|
-
|
|
13
|
+
import {
|
|
14
|
+
useBlokkli,
|
|
15
|
+
ref,
|
|
16
|
+
computed,
|
|
17
|
+
onMounted,
|
|
18
|
+
onBeforeUnmount,
|
|
19
|
+
useTemplateRef
|
|
20
|
+
} from "#imports";
|
|
21
|
+
const { adapter, ui } = useBlokkli();
|
|
22
|
+
const PROPAGATE_WHEEL = false;
|
|
23
|
+
const rootElement = ui.rootElement();
|
|
14
24
|
const props = defineProps({
|
|
15
25
|
modelValue: { type: String, required: true },
|
|
16
26
|
type: { type: String, required: true },
|
|
@@ -18,6 +28,56 @@ const props = defineProps({
|
|
|
18
28
|
host: { type: Object, required: true },
|
|
19
29
|
initialHeight: { type: Number, required: true }
|
|
20
30
|
});
|
|
31
|
+
const iframe = useTemplateRef("iframe");
|
|
32
|
+
function onIframeLoad() {
|
|
33
|
+
if (!iframe.value || !PROPAGATE_WHEEL) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const iframeDoc = iframe.value.contentDocument;
|
|
37
|
+
if (!iframeDoc) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let ckEditor = null;
|
|
41
|
+
iframe.value.contentDocument.addEventListener("wheel", (e) => {
|
|
42
|
+
if (!ckEditor) {
|
|
43
|
+
const el = iframeDoc.querySelector(".ck-editor__editable");
|
|
44
|
+
if (el) {
|
|
45
|
+
ckEditor = el;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (!ckEditor) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const scrollTop = ckEditor.scrollTop;
|
|
52
|
+
const scrollHeight = ckEditor.scrollHeight;
|
|
53
|
+
const clientHeight = ckEditor.clientHeight;
|
|
54
|
+
const isScrolledToTop = scrollTop === 0;
|
|
55
|
+
const isScrolledToBottom = scrollTop + clientHeight >= scrollHeight - 1;
|
|
56
|
+
const isScrollingDown = e.deltaY > 0;
|
|
57
|
+
const isScrollingUp = e.deltaY < 0;
|
|
58
|
+
const shouldPropagate = isScrollingUp && isScrolledToTop || isScrollingDown && isScrolledToBottom;
|
|
59
|
+
if (!shouldPropagate) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const wheelEvent = new WheelEvent("wheel", {
|
|
63
|
+
deltaX: e.deltaX,
|
|
64
|
+
deltaY: e.deltaY,
|
|
65
|
+
deltaZ: e.deltaZ,
|
|
66
|
+
deltaMode: e.deltaMode,
|
|
67
|
+
clientX: e.clientX,
|
|
68
|
+
clientY: e.clientY,
|
|
69
|
+
screenX: e.screenX,
|
|
70
|
+
screenY: e.screenY,
|
|
71
|
+
bubbles: true,
|
|
72
|
+
cancelable: true,
|
|
73
|
+
ctrlKey: e.ctrlKey,
|
|
74
|
+
shiftKey: e.shiftKey,
|
|
75
|
+
altKey: e.altKey,
|
|
76
|
+
metaKey: e.metaKey
|
|
77
|
+
});
|
|
78
|
+
rootElement?.dispatchEvent(wheelEvent);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
21
81
|
const height = ref(props.initialHeight);
|
|
22
82
|
const url = computed(() => {
|
|
23
83
|
if ("itemBundle" in props.host) {
|
|
@@ -43,7 +103,7 @@ const onMessage = (e) => {
|
|
|
43
103
|
};
|
|
44
104
|
onMounted(() => {
|
|
45
105
|
original.value = props.modelValue;
|
|
46
|
-
height.value = props.initialHeight
|
|
106
|
+
height.value = props.initialHeight;
|
|
47
107
|
window.addEventListener("message", onMessage);
|
|
48
108
|
});
|
|
49
109
|
onBeforeUnmount(() => {
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="bk bk-editable-field-textarea"
|
|
4
|
+
:style="{
|
|
5
|
+
height: height + 'px'
|
|
6
|
+
}"
|
|
7
|
+
>
|
|
3
8
|
<textarea
|
|
9
|
+
id="bk-editable-field-textarea"
|
|
4
10
|
ref="input"
|
|
5
11
|
:value="modelValue"
|
|
6
12
|
enterkeyhint="done"
|
|
7
13
|
rows="2"
|
|
8
|
-
:style="inputStyle"
|
|
9
14
|
v-bind="inputAttributes"
|
|
10
15
|
@keydown.stop.capture="onKeyDown"
|
|
11
16
|
@blur="onBlur"
|
|
@@ -13,12 +18,12 @@
|
|
|
13
18
|
$emit('update:modelValue', $event.target.value)
|
|
14
19
|
"
|
|
15
20
|
/>
|
|
16
|
-
<div :style="inputStyle" class="bk-textarea" v-html="modelValue" />
|
|
17
21
|
</div>
|
|
18
22
|
</template>
|
|
19
23
|
|
|
20
24
|
<script setup>
|
|
21
|
-
import
|
|
25
|
+
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
26
|
+
import { useBlokkli, computed, useTemplateRef, ref } from "#imports";
|
|
22
27
|
const { ui, selection } = useBlokkli();
|
|
23
28
|
const props = defineProps({
|
|
24
29
|
element: { type: null, required: true },
|
|
@@ -27,6 +32,8 @@ const props = defineProps({
|
|
|
27
32
|
modelValue: { type: String, required: true }
|
|
28
33
|
});
|
|
29
34
|
const emit = defineEmits(["close", "save", "update:modelValue"]);
|
|
35
|
+
const input = useTemplateRef("input");
|
|
36
|
+
const height = ref(20);
|
|
30
37
|
const onKeyDown = (e) => {
|
|
31
38
|
if (e.code === "Escape") {
|
|
32
39
|
e.preventDefault();
|
|
@@ -61,10 +68,7 @@ const onBlur = (e) => {
|
|
|
61
68
|
emit("save");
|
|
62
69
|
}, 100);
|
|
63
70
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
textAlign: computedStyle.textAlign
|
|
68
|
-
};
|
|
71
|
+
onBlokkliEvent("animationFrame", () => {
|
|
72
|
+
height.value = Math.max(input.value?.scrollHeight ?? 20, 20);
|
|
69
73
|
});
|
|
70
74
|
</script>
|