@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,58 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Teleport to="#bk-
|
|
3
|
-
<div
|
|
4
|
-
v-if="shouldRender"
|
|
5
|
-
v-show="showOverlay"
|
|
6
|
-
class="bk-selection-add"
|
|
7
|
-
:class="orientationClass"
|
|
8
|
-
:style="containerStyle"
|
|
9
|
-
>
|
|
10
|
-
<button
|
|
11
|
-
ref="before"
|
|
12
|
-
:key="'before' + orientationClass"
|
|
13
|
-
class="bk-selection-add-button bk-before"
|
|
14
|
-
:style="beforeAfterStyle"
|
|
15
|
-
:data-title="beforeTooltip"
|
|
16
|
-
tabindex="-1"
|
|
17
|
-
@click="onClickBefore"
|
|
18
|
-
>
|
|
19
|
-
<div>
|
|
20
|
-
<Icon name="plus" />
|
|
21
|
-
</div>
|
|
22
|
-
</button>
|
|
23
|
-
|
|
24
|
-
<button
|
|
25
|
-
ref="after"
|
|
26
|
-
:key="'after' + orientationClass"
|
|
27
|
-
class="bk-selection-add-button bk-after"
|
|
28
|
-
:style="beforeAfterStyle"
|
|
29
|
-
:data-title="afterTooltip"
|
|
30
|
-
tabindex="-1"
|
|
31
|
-
@click="onClickAfter"
|
|
32
|
-
>
|
|
33
|
-
<div>
|
|
34
|
-
<Icon name="plus" />
|
|
35
|
-
</div>
|
|
36
|
-
</button>
|
|
37
|
-
</div>
|
|
38
|
-
<AddButtonsField
|
|
39
|
-
v-for="(slot, index) in fieldButtonSlots"
|
|
40
|
-
v-show="showOverlay"
|
|
41
|
-
:key="index"
|
|
42
|
-
:field-key="slot.fieldKey"
|
|
43
|
-
:container-rect="containerRect"
|
|
44
|
-
:title="fieldTooltips[index] || ''"
|
|
45
|
-
@click="(el) => onClickEmptyField(index, el)"
|
|
46
|
-
/>
|
|
47
|
-
</Teleport>
|
|
48
|
-
|
|
49
|
-
<Teleport to="body">
|
|
2
|
+
<Teleport to="#bk-canvas-overlay">
|
|
50
3
|
<BlokkliTransition name="caret-tooltip">
|
|
51
4
|
<Overlay
|
|
52
5
|
v-if="addData"
|
|
53
6
|
:key="addData.key"
|
|
54
7
|
:bundles="addData.allowedBundles"
|
|
55
8
|
:anchor-el="addData.anchorEl"
|
|
9
|
+
:anchor-coordinates="addData.anchorCoordinates"
|
|
56
10
|
:label="addData.label"
|
|
57
11
|
@select="onSelectBundle"
|
|
58
12
|
@close="closeOverlay"
|
|
@@ -60,12 +14,14 @@
|
|
|
60
14
|
/>
|
|
61
15
|
</BlokkliTransition>
|
|
62
16
|
</Teleport>
|
|
17
|
+
|
|
18
|
+
<Renderer @toggle="onRendererToggle" @toggle-field="onRendererToggleField" />
|
|
63
19
|
</template>
|
|
64
20
|
|
|
65
21
|
<script setup>
|
|
66
22
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
67
|
-
import { computed, useBlokkli, ref, watch
|
|
68
|
-
import {
|
|
23
|
+
import { computed, useBlokkli, ref, watch } from "#imports";
|
|
24
|
+
import { BlokkliTransition } from "#blokkli/components";
|
|
69
25
|
import {
|
|
70
26
|
getChildrenOrientation,
|
|
71
27
|
getGapSize,
|
|
@@ -73,25 +29,21 @@ import {
|
|
|
73
29
|
determineCanAddChildren
|
|
74
30
|
} from "#blokkli/helpers/dropTargets";
|
|
75
31
|
import Overlay from "./Overlay/index.vue";
|
|
76
|
-
import AddButtonsField from "./AddButtonsField.vue";
|
|
77
32
|
import { renderCycle } from "#blokkli/helpers/renderCycle";
|
|
78
33
|
import { getFieldKey } from "#blokkli/helpers";
|
|
79
34
|
import { isInternalBundle } from "#blokkli/helpers/bundles";
|
|
35
|
+
import Renderer from "./Renderer/index.vue";
|
|
36
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
80
37
|
const props = defineProps({
|
|
81
|
-
|
|
38
|
+
items: { type: Array, required: true }
|
|
82
39
|
});
|
|
83
|
-
const { dom, state, eventBus, types,
|
|
84
|
-
const showOverlay = computed(
|
|
85
|
-
() => !ui.isTransforming.value && !ui.isAnalyzing.value && !selection.isMultiSelecting.value && !selection.isDragging.value && !ui.hasTransformOverlayOpen.value && !selection.isChangingOptions.value
|
|
86
|
-
);
|
|
87
|
-
const afterEl = useTemplateRef("after");
|
|
88
|
-
const beforeEL = useTemplateRef("before");
|
|
40
|
+
const { dom, state, eventBus, types, $t, blocks, fields } = useBlokkli();
|
|
89
41
|
const shouldRender = computed(() => {
|
|
90
|
-
return props.
|
|
42
|
+
return props.items.length === 1;
|
|
91
43
|
});
|
|
92
44
|
const block = computed(() => {
|
|
93
|
-
if (props.
|
|
94
|
-
return props.
|
|
45
|
+
if (props.items.length === 1) {
|
|
46
|
+
return props.items[0] ?? null;
|
|
95
47
|
}
|
|
96
48
|
return null;
|
|
97
49
|
});
|
|
@@ -103,7 +55,7 @@ const emptyBlockFields = computed(() => {
|
|
|
103
55
|
return [];
|
|
104
56
|
}
|
|
105
57
|
const uuid2 = block.value.uuid;
|
|
106
|
-
return types.fieldConfig.forEntityTypeAndBundle(
|
|
58
|
+
return types.fieldConfig.forEntityTypeAndBundle(itemEntityType, block.value.bundle).map((field) => {
|
|
107
59
|
const key = getFieldKey(uuid2, field.name);
|
|
108
60
|
const count = state.getFieldBlockCount(key);
|
|
109
61
|
return {
|
|
@@ -123,17 +75,17 @@ const bundleLabel = computed(() => {
|
|
|
123
75
|
if (!block.value) {
|
|
124
76
|
return "";
|
|
125
77
|
}
|
|
126
|
-
return types.getBlockBundleDefinition(block.value.
|
|
78
|
+
return types.getBlockBundleDefinition(block.value.bundle)?.label || block.value.bundle;
|
|
127
79
|
});
|
|
128
80
|
const allowedBundlesForField = computed(() => {
|
|
129
81
|
if (!block.value) {
|
|
130
82
|
return [];
|
|
131
83
|
}
|
|
132
|
-
const blockData =
|
|
84
|
+
const blockData = blocks.getBlock(block.value.uuid);
|
|
133
85
|
if (!blockData) {
|
|
134
86
|
return [];
|
|
135
87
|
}
|
|
136
|
-
const field =
|
|
88
|
+
const field = fields.find(blockData.host.uuid, blockData.host.fieldName);
|
|
137
89
|
if (!field) {
|
|
138
90
|
return [];
|
|
139
91
|
}
|
|
@@ -171,9 +123,9 @@ const fieldTooltips = computed(() => {
|
|
|
171
123
|
return [];
|
|
172
124
|
}
|
|
173
125
|
return emptyBlockFields.value.map((field) => {
|
|
174
|
-
const fieldConfig = types.fieldConfig.forEntityTypeAndBundle(
|
|
126
|
+
const fieldConfig = types.fieldConfig.forEntityTypeAndBundle(itemEntityType, block.value.bundle).find((f) => f.name === field.name);
|
|
175
127
|
const fieldLabel = fieldConfig?.label || field.name;
|
|
176
|
-
const fieldElement =
|
|
128
|
+
const fieldElement = fields.find(block.value.uuid, field.name);
|
|
177
129
|
if (fieldElement) {
|
|
178
130
|
const allowedBundles = fieldElement.allowedBundles.filter(
|
|
179
131
|
(bundle) => !isInternalBundle(bundle)
|
|
@@ -195,8 +147,8 @@ const fieldTooltips = computed(() => {
|
|
|
195
147
|
).replace("@parentBundle", bundleLabel.value).replace("@fieldLabel", fieldLabel);
|
|
196
148
|
});
|
|
197
149
|
});
|
|
198
|
-
watch(emptyBlockFields, (
|
|
199
|
-
const neededCount =
|
|
150
|
+
watch(emptyBlockFields, (fields2) => {
|
|
151
|
+
const neededCount = fields2.length;
|
|
200
152
|
while (fieldButtonSlots.value.length < neededCount) {
|
|
201
153
|
fieldButtonSlots.value.push({ fieldKey: void 0 });
|
|
202
154
|
}
|
|
@@ -205,8 +157,8 @@ watch(emptyBlockFields, (fields) => {
|
|
|
205
157
|
if (!slot) {
|
|
206
158
|
continue;
|
|
207
159
|
}
|
|
208
|
-
if (i <
|
|
209
|
-
const field =
|
|
160
|
+
if (i < fields2.length) {
|
|
161
|
+
const field = fields2[i];
|
|
210
162
|
slot.fieldKey = field?.key;
|
|
211
163
|
} else {
|
|
212
164
|
slot.fieldKey = void 0;
|
|
@@ -241,24 +193,19 @@ function onSelectAction(id) {
|
|
|
241
193
|
closeOverlay();
|
|
242
194
|
}
|
|
243
195
|
const cache = /* @__PURE__ */ new Map();
|
|
244
|
-
const canShowBeforeAfter = ref(false);
|
|
245
|
-
const beforeAfterStyle = computed(() => ({
|
|
246
|
-
visibility: canShowBeforeAfter.value ? "visible" : "hidden"
|
|
247
|
-
}));
|
|
248
196
|
function clearAllCache() {
|
|
249
197
|
cache.clear();
|
|
250
|
-
canShowBeforeAfter.value = false;
|
|
251
198
|
containerStyle.value = { visibility: "hidden" };
|
|
252
199
|
orientationClass.value = "";
|
|
253
200
|
}
|
|
254
201
|
function updateCache(uuid2) {
|
|
255
202
|
let cachedState = cache.get(uuid2);
|
|
256
203
|
if (!cachedState) {
|
|
257
|
-
const block2 =
|
|
204
|
+
const block2 = blocks.getBlock(uuid2);
|
|
258
205
|
if (!block2) {
|
|
259
206
|
return;
|
|
260
207
|
}
|
|
261
|
-
const field =
|
|
208
|
+
const field = fields.find(block2.host.uuid, block2.host.fieldName);
|
|
262
209
|
if (!field) {
|
|
263
210
|
return;
|
|
264
211
|
}
|
|
@@ -284,7 +231,6 @@ function updateCache(uuid2) {
|
|
|
284
231
|
};
|
|
285
232
|
cache.set(uuid2, cachedState);
|
|
286
233
|
}
|
|
287
|
-
canShowBeforeAfter.value = cachedState.canShowBeforeAfter;
|
|
288
234
|
orientationClass.value = cachedState.orientation === "vertical" ? "bk-is-vertical" : "bk-is-horizontal";
|
|
289
235
|
}
|
|
290
236
|
watch(
|
|
@@ -292,7 +238,6 @@ watch(
|
|
|
292
238
|
async (newUuid) => {
|
|
293
239
|
closeOverlay();
|
|
294
240
|
if (!shouldRender.value) {
|
|
295
|
-
canShowBeforeAfter.value = false;
|
|
296
241
|
containerStyle.value = { visibility: "hidden" };
|
|
297
242
|
return;
|
|
298
243
|
}
|
|
@@ -303,7 +248,7 @@ watch(
|
|
|
303
248
|
},
|
|
304
249
|
{ immediate: true }
|
|
305
250
|
);
|
|
306
|
-
onBlokkliEvent("
|
|
251
|
+
onBlokkliEvent("animationFrame:after", () => {
|
|
307
252
|
if (!shouldRender.value || !uuid.value) {
|
|
308
253
|
containerStyle.value = { visibility: "hidden" };
|
|
309
254
|
containerRect.value = null;
|
|
@@ -337,8 +282,10 @@ onBlokkliEvent("state:reloaded", () => {
|
|
|
337
282
|
updateCache(uuid.value);
|
|
338
283
|
}
|
|
339
284
|
});
|
|
340
|
-
function setAddData(key, field,
|
|
341
|
-
const allowedBundles = field.allowedBundles
|
|
285
|
+
function setAddData(key, field, label, preceedingUuid, anchorEl, anchorCoordinates) {
|
|
286
|
+
const allowedBundles = field.allowedBundles.filter(
|
|
287
|
+
(bundle) => !isInternalBundle(bundle)
|
|
288
|
+
);
|
|
342
289
|
if (allowedBundles.length === 0) {
|
|
343
290
|
return;
|
|
344
291
|
}
|
|
@@ -362,6 +309,7 @@ function setAddData(key, field, anchorEl, label, preceedingUuid) {
|
|
|
362
309
|
preceedingUuid,
|
|
363
310
|
host,
|
|
364
311
|
anchorEl,
|
|
312
|
+
anchorCoordinates,
|
|
365
313
|
label,
|
|
366
314
|
field
|
|
367
315
|
};
|
|
@@ -382,34 +330,9 @@ function getPreceedingUuidBefore(uuid2, field) {
|
|
|
382
330
|
}
|
|
383
331
|
return void 0;
|
|
384
332
|
}
|
|
385
|
-
function
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
if (!uuid.value) {
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
const cachedState = cache.get(uuid.value);
|
|
393
|
-
if (!cachedState) {
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
const block2 = dom.findBlock(uuid.value);
|
|
397
|
-
if (!block2) {
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
const field = dom.findField(block2.hostUuid, block2.hostFieldName);
|
|
401
|
-
if (!field) {
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
const preceedingUuid = getPreceedingUuidBefore(uuid.value, field);
|
|
405
|
-
if (!beforeEL.value) {
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
const label = beforeTooltip.value.replace("...", "");
|
|
409
|
-
setAddData("before", field, beforeEL.value, label, preceedingUuid);
|
|
410
|
-
}
|
|
411
|
-
function onClickAfter() {
|
|
412
|
-
if (addData.value?.key === "after") {
|
|
333
|
+
function onRendererToggle(data) {
|
|
334
|
+
const key = data.position;
|
|
335
|
+
if (addData.value?.key === key) {
|
|
413
336
|
return closeOverlay();
|
|
414
337
|
}
|
|
415
338
|
if (!uuid.value) {
|
|
@@ -419,41 +342,46 @@ function onClickAfter() {
|
|
|
419
342
|
if (!cachedState) {
|
|
420
343
|
return;
|
|
421
344
|
}
|
|
422
|
-
const block2 =
|
|
345
|
+
const block2 = blocks.getBlock(uuid.value);
|
|
423
346
|
if (!block2) {
|
|
424
347
|
return;
|
|
425
348
|
}
|
|
426
|
-
const field =
|
|
349
|
+
const field = fields.find(block2.host.uuid, block2.host.fieldName);
|
|
427
350
|
if (!field) {
|
|
428
351
|
return;
|
|
429
352
|
}
|
|
430
|
-
if (!afterEl.value) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
353
|
if (!field.allowedBundles.length) {
|
|
434
354
|
return;
|
|
435
355
|
}
|
|
436
|
-
|
|
437
|
-
|
|
356
|
+
let preceedingUuid;
|
|
357
|
+
let label;
|
|
358
|
+
if (data.position === "before") {
|
|
359
|
+
preceedingUuid = getPreceedingUuidBefore(uuid.value, field);
|
|
360
|
+
label = beforeTooltip.value.replace("...", "");
|
|
361
|
+
} else {
|
|
362
|
+
preceedingUuid = uuid.value;
|
|
363
|
+
label = afterTooltip.value.replace("...", "");
|
|
364
|
+
}
|
|
365
|
+
setAddData(key, field, label, preceedingUuid, void 0, data.coordinates);
|
|
438
366
|
}
|
|
439
|
-
function
|
|
440
|
-
const key = "field:" + index;
|
|
367
|
+
function onRendererToggleField(data) {
|
|
368
|
+
const key = "field:" + data.index;
|
|
441
369
|
if (addData.value?.key === key) {
|
|
442
370
|
return closeOverlay();
|
|
443
371
|
}
|
|
444
372
|
if (!uuid.value) {
|
|
445
373
|
return;
|
|
446
374
|
}
|
|
447
|
-
const emptyField = emptyBlockFields.value[index];
|
|
375
|
+
const emptyField = emptyBlockFields.value[data.index];
|
|
448
376
|
if (!emptyField) {
|
|
449
377
|
return;
|
|
450
378
|
}
|
|
451
|
-
const field =
|
|
379
|
+
const field = fields.find(uuid.value, emptyField.name);
|
|
452
380
|
if (!field) {
|
|
453
381
|
return;
|
|
454
382
|
}
|
|
455
|
-
const label = (fieldTooltips.value[index] || "").replace("...", "");
|
|
456
|
-
setAddData(key, field,
|
|
383
|
+
const label = (fieldTooltips.value[data.index] || "").replace("...", "");
|
|
384
|
+
setAddData(key, field, label, void 0, void 0, data.coordinates);
|
|
457
385
|
}
|
|
458
|
-
onBlokkliEvent("
|
|
386
|
+
onBlokkliEvent("dragging:start", closeOverlay);
|
|
459
387
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RenderedFieldListItem } from '#blokkli/types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
3
|
+
items: RenderedFieldListItem[];
|
|
4
4
|
};
|
|
5
5
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
6
|
export default _default;
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
7
|
-
import
|
|
7
|
+
import defineRenderer from "#blokkli/helpers/composables/defineRenderer";
|
|
8
|
+
import { useBlokkli, computed } from "#imports";
|
|
8
9
|
import {
|
|
9
10
|
setBuffersAndAttributes,
|
|
10
11
|
drawBufferInfo,
|
|
@@ -17,9 +18,10 @@ import { useTransitionedValue } from "#blokkli/helpers/useTransitionedValue";
|
|
|
17
18
|
import { toShaderColor } from "#blokkli/helpers";
|
|
18
19
|
const props = defineProps({
|
|
19
20
|
blocks: { type: Array, required: true },
|
|
20
|
-
gl: { type: null, required: true }
|
|
21
|
+
gl: { type: null, required: true },
|
|
22
|
+
hasHostSelected: { type: Boolean, required: true }
|
|
21
23
|
});
|
|
22
|
-
const { animation, theme, dom, ui } = useBlokkli();
|
|
24
|
+
const { animation, theme, dom, ui, state } = useBlokkli();
|
|
23
25
|
const programInfo = animation.registerProgram("selection", props.gl, [vs, fs]);
|
|
24
26
|
class SelectionRectangleBufferCollector extends RectangleBufferCollector {
|
|
25
27
|
uuids = [];
|
|
@@ -33,11 +35,28 @@ class SelectionRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
33
35
|
return uuid + "no_rect";
|
|
34
36
|
}
|
|
35
37
|
return uuid + rect.time;
|
|
36
|
-
}).join("_");
|
|
38
|
+
}).join("_") + "_host_" + props.hasHostSelected;
|
|
37
39
|
const hasChanged = force || this.prevKey !== key;
|
|
38
40
|
if (hasChanged) {
|
|
39
41
|
this.reset();
|
|
40
42
|
this.lastCount = 0;
|
|
43
|
+
if (props.hasHostSelected) {
|
|
44
|
+
this.addRectangle(
|
|
45
|
+
{
|
|
46
|
+
id: "host",
|
|
47
|
+
height: ui.artboardSize.value.height,
|
|
48
|
+
width: ui.artboardSize.value.width,
|
|
49
|
+
x: 0,
|
|
50
|
+
y: 0,
|
|
51
|
+
radius: [0, 0, 0, 0],
|
|
52
|
+
isInverted: false,
|
|
53
|
+
isFromLibrary: false
|
|
54
|
+
},
|
|
55
|
+
3
|
|
56
|
+
// Type 3 = host selection
|
|
57
|
+
);
|
|
58
|
+
this.lastCount++;
|
|
59
|
+
}
|
|
41
60
|
for (let i = 0; i < props.blocks.length; i++) {
|
|
42
61
|
const block = props.blocks[i];
|
|
43
62
|
if (this.added.has(block.uuid)) {
|
|
@@ -49,7 +68,14 @@ class SelectionRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
49
68
|
if (!rect || !el) {
|
|
50
69
|
continue;
|
|
51
70
|
}
|
|
52
|
-
const style = theme.getDraggableStyle(el);
|
|
71
|
+
const style = ui.lowPerformanceMode.value ? null : theme.getDraggableStyle(el);
|
|
72
|
+
const isFromLibrary = state.fromLibraryUuids.value.includes(block.uuid);
|
|
73
|
+
let type = 0;
|
|
74
|
+
if (isFromLibrary) {
|
|
75
|
+
type = 2;
|
|
76
|
+
} else if (style?.isInverted) {
|
|
77
|
+
type = 1;
|
|
78
|
+
}
|
|
53
79
|
this.addRectangle(
|
|
54
80
|
{
|
|
55
81
|
id: block.uuid,
|
|
@@ -57,10 +83,11 @@ class SelectionRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
57
83
|
width: rect.width,
|
|
58
84
|
x: rect.x,
|
|
59
85
|
y: rect.y,
|
|
60
|
-
radius: style
|
|
61
|
-
isInverted: style
|
|
86
|
+
radius: style?.radius ?? [0, 0, 0, 0],
|
|
87
|
+
isInverted: !!style?.isInverted,
|
|
88
|
+
isFromLibrary
|
|
62
89
|
},
|
|
63
|
-
|
|
90
|
+
type
|
|
64
91
|
);
|
|
65
92
|
this.lastCount++;
|
|
66
93
|
}
|
|
@@ -76,40 +103,75 @@ const collector = new SelectionRectangleBufferCollector(props.gl);
|
|
|
76
103
|
const hasTransformingStyle = computed(
|
|
77
104
|
() => ui.hasTransformOverlayOpen.value || ui.isTransforming.value
|
|
78
105
|
);
|
|
106
|
+
const selectionColorOverride = computed(() => {
|
|
107
|
+
const color = ui.selectionColor.value;
|
|
108
|
+
if (!color) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
if (color === "mono") {
|
|
112
|
+
return toShaderColor(theme.getColor(color, "500"));
|
|
113
|
+
} else if (color === "accent") {
|
|
114
|
+
return toShaderColor(theme.getColor(color, "700"));
|
|
115
|
+
}
|
|
116
|
+
return toShaderColor(theme.getColor(color, "normal"));
|
|
117
|
+
});
|
|
79
118
|
const getColorDefault = useTransitionedValue(() => {
|
|
119
|
+
if (selectionColorOverride.value) {
|
|
120
|
+
return selectionColorOverride.value;
|
|
121
|
+
}
|
|
80
122
|
if (hasTransformingStyle.value) {
|
|
81
123
|
return toShaderColor(theme.orange.value.normal);
|
|
82
124
|
}
|
|
83
125
|
return toShaderColor(theme.accent.value[600]);
|
|
84
126
|
});
|
|
85
127
|
const getColorInverted = useTransitionedValue(() => {
|
|
128
|
+
if (selectionColorOverride.value) {
|
|
129
|
+
return selectionColorOverride.value;
|
|
130
|
+
}
|
|
86
131
|
if (hasTransformingStyle.value) {
|
|
87
132
|
return toShaderColor(theme.orange.value.normal);
|
|
88
133
|
}
|
|
89
134
|
return toShaderColor([255, 255, 255]);
|
|
90
135
|
});
|
|
136
|
+
const getColorLibrary = useTransitionedValue(() => {
|
|
137
|
+
if (selectionColorOverride.value) {
|
|
138
|
+
return selectionColorOverride.value;
|
|
139
|
+
}
|
|
140
|
+
if (hasTransformingStyle.value) {
|
|
141
|
+
return toShaderColor(theme.orange.value.normal);
|
|
142
|
+
}
|
|
143
|
+
return toShaderColor(theme.lime.value.normal);
|
|
144
|
+
});
|
|
145
|
+
const getColorHost = useTransitionedValue(() => {
|
|
146
|
+
return toShaderColor(theme.mono.value[700]);
|
|
147
|
+
});
|
|
91
148
|
const getTransforming = useTransitionedValue(() => {
|
|
92
149
|
return ui.isTransforming.value ? 1 : 0;
|
|
93
150
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
151
|
+
defineRenderer("selection-overlay", {
|
|
152
|
+
zIndex: 100,
|
|
153
|
+
render: (ctx) => {
|
|
154
|
+
props.gl.useProgram(programInfo.program);
|
|
155
|
+
const { info } = collector.getBufferInfo();
|
|
156
|
+
if (!info) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
setUniforms(programInfo, {
|
|
160
|
+
u_color_default: getColorDefault(),
|
|
161
|
+
u_color_inverted: getColorInverted(),
|
|
162
|
+
u_color_library: getColorLibrary(),
|
|
163
|
+
u_color_host: getColorHost(),
|
|
164
|
+
u_artboard_size: [
|
|
165
|
+
ui.artboardSize.value.width,
|
|
166
|
+
ui.artboardSize.value.height
|
|
167
|
+
],
|
|
168
|
+
u_is_transforming: getTransforming(),
|
|
169
|
+
u_time: ctx.time
|
|
170
|
+
});
|
|
171
|
+
animation.setSharedUniforms(props.gl, programInfo);
|
|
172
|
+
setBuffersAndAttributes(props.gl, programInfo, info);
|
|
173
|
+
drawBufferInfo(props.gl, info, props.gl.TRIANGLES);
|
|
99
174
|
}
|
|
100
|
-
setUniforms(programInfo, {
|
|
101
|
-
u_color_default: getColorDefault(),
|
|
102
|
-
u_color_inverted: getColorInverted(),
|
|
103
|
-
u_artboard_size: [
|
|
104
|
-
ui.artboardSize.value.width,
|
|
105
|
-
ui.artboardSize.value.height
|
|
106
|
-
],
|
|
107
|
-
u_is_transforming: getTransforming(),
|
|
108
|
-
u_time: e.time
|
|
109
|
-
});
|
|
110
|
-
animation.setSharedUniforms(props.gl, programInfo);
|
|
111
|
-
setBuffersAndAttributes(props.gl, programInfo, info);
|
|
112
|
-
drawBufferInfo(props.gl, info, props.gl.TRIANGLES);
|
|
113
175
|
});
|
|
114
176
|
onBlokkliEvent("ui:resized", function() {
|
|
115
177
|
collector.reset();
|
|
@@ -117,9 +179,6 @@ onBlokkliEvent("ui:resized", function() {
|
|
|
117
179
|
onBlokkliEvent("state:reloaded", function() {
|
|
118
180
|
collector.reset();
|
|
119
181
|
});
|
|
120
|
-
onBeforeUnmount(() => {
|
|
121
|
-
props.gl.clear(props.gl.COLOR_BUFFER_BIT);
|
|
122
|
-
});
|
|
123
182
|
</script>
|
|
124
183
|
|
|
125
184
|
<script>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RenderedFieldListItem } from '#blokkli/types';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<{
|
|
3
|
-
blocks:
|
|
3
|
+
blocks: RenderedFieldListItem[];
|
|
4
4
|
gl: WebGLRenderingContext;
|
|
5
|
+
hasHostSelected: boolean;
|
|
5
6
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
6
|
-
blocks:
|
|
7
|
+
blocks: RenderedFieldListItem[];
|
|
7
8
|
gl: WebGLRenderingContext;
|
|
9
|
+
hasHostSelected: boolean;
|
|
8
10
|
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
11
|
export default _default;
|
|
@@ -18,6 +18,8 @@ uniform float u_offset_y;
|
|
|
18
18
|
uniform vec2 u_resolution;
|
|
19
19
|
uniform vec3 u_color_default;
|
|
20
20
|
uniform vec3 u_color_inverted;
|
|
21
|
+
uniform vec3 u_color_library;
|
|
22
|
+
uniform vec3 u_color_host;
|
|
21
23
|
|
|
22
24
|
// The transformed quad for the fragment shader.
|
|
23
25
|
varying vec4 v_quad;
|
|
@@ -79,8 +81,15 @@ void main() {
|
|
|
79
81
|
|
|
80
82
|
v_rect_width = adjusted_quad.x;
|
|
81
83
|
|
|
82
|
-
// Set color
|
|
83
|
-
v_color =
|
|
84
|
+
// Set color based on type: 0=default, 1=inverted, 2=library, 3=host
|
|
85
|
+
v_color = u_color_default;
|
|
86
|
+
if (a_rect_type > 2.5) {
|
|
87
|
+
v_color = u_color_host;
|
|
88
|
+
} else if (a_rect_type > 1.5) {
|
|
89
|
+
v_color = u_color_library;
|
|
90
|
+
} else if (a_rect_type > 0.5) {
|
|
91
|
+
v_color = u_color_inverted;
|
|
92
|
+
}
|
|
84
93
|
v_rect_radius = a_rect_radius * u_dpi;
|
|
85
94
|
v_thickness = thickness;
|
|
86
95
|
v_rect_id = a_rect_id;
|
|
@@ -22,11 +22,11 @@ import { useBlokkli, computed } from "#imports";
|
|
|
22
22
|
const props = defineProps({
|
|
23
23
|
uuids: { type: Array, required: true }
|
|
24
24
|
});
|
|
25
|
-
const { ui, dom } = useBlokkli();
|
|
25
|
+
const { ui, dom, blocks } = useBlokkli();
|
|
26
26
|
const artboard = ui.artboardElement();
|
|
27
27
|
const items = computed(() => {
|
|
28
28
|
return props.uuids.map((uuid) => {
|
|
29
|
-
const block =
|
|
29
|
+
const block = blocks.getBlock(uuid);
|
|
30
30
|
if (!block) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|