@blokkli/editor 2.0.0-alpha.53 → 2.0.0-alpha.55
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/global/constants/index.d.ts +1 -1
- package/dist/global/constants/index.js +1 -1
- package/dist/global/types/features.d.ts +5 -9
- package/dist/module.json +1 -1
- package/dist/module.mjs +28 -35
- package/dist/modules/agent/index.mjs +46 -29
- package/dist/modules/agent/runtime/app/composables/agentProvider.js +2 -1
- package/dist/modules/agent/runtime/app/features/agent/Container.d.vue.ts +19 -0
- package/dist/modules/agent/runtime/app/features/agent/Container.vue +195 -0
- package/dist/modules/agent/runtime/app/features/agent/Container.vue.d.ts +19 -0
- package/dist/modules/agent/runtime/app/features/agent/index.vue +18 -164
- package/dist/modules/agent/runtime/app/features/agent/types.d.ts +9 -0
- package/dist/modules/agent/runtime/app/helpers/index.d.ts +7 -3
- package/dist/modules/agent/runtime/app/helpers/index.js +9 -3
- package/dist/modules/agent/runtime/app/prompts/fixReadability.js +51 -44
- package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +2 -1
- package/dist/modules/agent/runtime/app/tools/check_readability/index.js +1 -0
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.vue +1 -1
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.js +6 -1
- package/dist/modules/agent/runtime/app/tools/get_readability_issues/index.js +1 -0
- package/dist/modules/agent/runtime/app/types/index.d.ts +12 -0
- package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +34 -18
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +7 -0
- package/dist/modules/drupal/graphql/features/droppable-field-items.graphql +22 -0
- package/dist/modules/drupal/graphql/features/import-existing.graphql +0 -25
- package/dist/modules/drupal/graphql/features/workspace.graphql +9 -2
- package/dist/modules/drupal/graphql/mutations/update_droppable_field.graphql +21 -0
- package/dist/modules/drupal/index.mjs +6 -2
- package/dist/modules/drupal/runtime/adapter/index.js +75 -39
- package/dist/modules/readability/index.d.mts +11 -0
- package/dist/modules/readability/index.mjs +17 -0
- package/dist/modules/readability/runtime/adapter-extension.d.ts +2 -0
- package/dist/modules/readability/runtime/adapter-extension.js +5 -0
- package/dist/modules/readability/runtime/analyzers/builtin.d.ts +10 -0
- package/dist/modules/readability/runtime/analyzers/builtin.js +340 -0
- package/dist/runtime/components/BlokkliEditable.vue +10 -90
- package/dist/runtime/components/BlokkliItem.vue +2 -2
- package/dist/runtime/components/BlokkliProvider.vue +11 -5
- package/dist/runtime/composables/defineBlokkli.js +3 -1
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +2 -3
- package/dist/runtime/editor/components/Actions/index.vue +1 -1
- package/dist/runtime/editor/components/AnimationCanvas/index.vue +41 -6
- package/dist/runtime/editor/components/AppMenu/Inner.d.vue.ts +7 -0
- package/dist/runtime/editor/components/AppMenu/Inner.vue +83 -0
- package/dist/runtime/editor/components/AppMenu/Inner.vue.d.ts +7 -0
- package/dist/runtime/editor/components/AppMenu/index.vue +5 -79
- package/dist/runtime/editor/components/ArtboardTooltip/index.d.vue.ts +1 -0
- package/dist/runtime/editor/components/ArtboardTooltip/index.vue +9 -1
- package/dist/runtime/editor/components/ArtboardTooltip/index.vue.d.ts +1 -0
- package/dist/runtime/editor/components/BlockPreviewItem/index.vue +12 -6
- package/dist/runtime/editor/components/BlokkliEditableEdit.d.vue.ts +23 -0
- package/dist/runtime/editor/components/BlokkliEditableEdit.vue +95 -0
- package/dist/runtime/editor/components/BlokkliEditableEdit.vue.d.ts +23 -0
- package/dist/runtime/editor/components/BlokkliRootErrorBoundary.d.vue.ts +4 -1
- package/dist/runtime/editor/components/BlokkliRootErrorBoundary.vue +4 -1
- package/dist/runtime/editor/components/BlokkliRootErrorBoundary.vue.d.ts +4 -1
- package/dist/runtime/editor/components/BundleSelector/index.vue +10 -5
- package/dist/runtime/editor/components/Dialog/index.vue +0 -77
- package/dist/runtime/editor/components/EditIndicator.d.vue.ts +1 -0
- package/dist/runtime/editor/components/EditIndicator.vue +3 -2
- package/dist/runtime/editor/components/EditIndicator.vue.d.ts +1 -0
- package/dist/runtime/editor/components/EditProvider.d.vue.ts +3 -1
- package/dist/runtime/editor/components/EditProvider.vue +13 -4
- package/dist/runtime/editor/components/EditProvider.vue.d.ts +3 -1
- package/dist/runtime/editor/components/FeaturesRenderer/index.vue +1 -4
- package/dist/runtime/editor/components/Form/Text/index.d.vue.ts +5 -0
- package/dist/runtime/editor/components/Form/Text/index.vue +10 -4
- package/dist/runtime/editor/components/Form/Text/index.vue.d.ts +5 -0
- package/dist/runtime/editor/components/FormOverlay/index.vue +0 -24
- package/dist/runtime/editor/components/GrowOnly/index.d.vue.ts +10 -0
- package/dist/runtime/editor/components/GrowOnly/index.vue +34 -0
- package/dist/runtime/editor/components/GrowOnly/index.vue.d.ts +10 -0
- package/dist/runtime/editor/components/Konami/Game/index.vue +120 -0
- package/dist/runtime/editor/components/Konami/index.vue +7 -124
- package/dist/runtime/editor/components/Loading/index.vue +1 -1
- package/dist/runtime/editor/components/PluginConfigForm/Text/index.vue +1 -0
- package/dist/runtime/editor/components/PluginConfigForm/index.vue +1 -0
- package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +3 -1
- package/dist/runtime/editor/components/PreviewProvider.vue +6 -1
- package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +3 -1
- package/dist/runtime/editor/components/Toolbar/index.vue +1 -1
- package/dist/runtime/editor/components/index.d.ts +11 -10
- package/dist/runtime/editor/components/index.js +32 -10
- package/dist/runtime/editor/composables/defineRenderer.d.ts +2 -2
- package/dist/runtime/editor/composables/defineRenderer.js +8 -3
- package/dist/runtime/editor/css/output.css +1 -1
- package/dist/runtime/editor/events/index.d.ts +6 -0
- package/dist/runtime/editor/features/analyze/Main.d.vue.ts +1 -0
- package/dist/runtime/editor/features/analyze/Main.vue +9 -8
- package/dist/runtime/editor/features/analyze/Main.vue.d.ts +1 -0
- package/dist/runtime/editor/features/analyze/Results/ResultsItem.vue +7 -15
- package/dist/runtime/editor/features/analyze/Results/ResultsItemNodesTarget.vue +4 -2
- package/dist/runtime/editor/features/analyze/analyzers/axe.js +9 -9
- package/dist/runtime/editor/features/analyze/analyzers/readability.js +7 -7
- package/dist/runtime/editor/features/analyze/index.vue +26 -26
- package/dist/runtime/editor/features/analyze/readability/types.d.ts +18 -14
- package/dist/runtime/editor/features/anchors/index.vue +6 -2
- package/dist/runtime/editor/features/artboard/Renderer.vue +3 -2
- package/dist/runtime/editor/features/block-scheduler/Dialog/index.vue +78 -0
- package/dist/runtime/editor/features/block-scheduler/index.vue +34 -89
- package/dist/runtime/editor/features/breadcrumbs/index.vue +2 -2
- package/dist/runtime/editor/features/changelog/changelog.json +8 -0
- package/dist/runtime/editor/features/changelog/index.vue +10 -8
- package/dist/runtime/editor/features/clipboard/DropElement/index.vue +152 -0
- package/dist/runtime/editor/features/clipboard/index.vue +13 -159
- package/dist/runtime/editor/features/command-palette/Palette/Item/index.vue +0 -28
- package/dist/runtime/editor/features/command-palette/Palette/index.vue +17 -6
- package/dist/runtime/editor/features/command-palette/index.vue +7 -2
- package/dist/runtime/editor/features/comments/index.vue +6 -3
- package/dist/runtime/editor/features/debug/Main.vue +168 -0
- package/dist/runtime/editor/features/debug/Section/Features.vue +1 -2
- package/dist/runtime/editor/features/debug/index.vue +6 -170
- package/dist/runtime/editor/features/dev-mode/index.vue +2 -1
- package/dist/runtime/editor/features/diff/index.vue +6 -2
- package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue +15 -16
- package/dist/runtime/editor/features/dragging-overlay/index.vue +4 -3
- package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.d.vue.ts +15 -0
- package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.vue +547 -0
- package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.vue.d.ts +15 -0
- package/dist/runtime/editor/features/droppable-field-edit/index.d.vue.ts +3 -0
- package/dist/runtime/editor/features/droppable-field-edit/index.vue +231 -0
- package/dist/runtime/editor/features/droppable-field-edit/index.vue.d.ts +3 -0
- package/dist/runtime/editor/features/droppable-field-edit/types.d.ts +70 -0
- package/dist/runtime/editor/features/editable-field/Overlay/Frame/index.d.vue.ts +1 -0
- package/dist/runtime/editor/features/editable-field/Overlay/Frame/index.vue +34 -21
- package/dist/runtime/editor/features/editable-field/Overlay/Frame/index.vue.d.ts +1 -0
- package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.d.vue.ts +2 -2
- package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue.d.ts +2 -2
- package/dist/runtime/editor/features/editable-field/Overlay/ReadabilityIndicator/ChunkOverlay.vue +1 -1
- package/dist/runtime/editor/features/editable-field/Overlay/ReadabilityIndicator/index.vue +6 -13
- package/dist/runtime/editor/features/editable-field/Overlay/index.vue +4 -4
- package/dist/runtime/editor/features/fragments/index.vue +9 -4
- package/dist/runtime/editor/features/help/index.vue +7 -2
- package/dist/runtime/editor/features/highlights/Renderer/index.vue +11 -17
- package/dist/runtime/editor/features/history/index.vue +3 -2
- package/dist/runtime/editor/features/hover/Renderer/index.vue +87 -36
- package/dist/runtime/editor/features/hover/Renderer/vertex.glsl +5 -5
- package/dist/runtime/editor/features/hover/index.vue +1 -1
- package/dist/runtime/editor/features/import-existing/Dialog/Item.d.vue.ts +5 -0
- package/dist/runtime/editor/features/import-existing/Dialog/Item.vue +55 -0
- package/dist/runtime/editor/features/import-existing/Dialog/Item.vue.d.ts +5 -0
- package/dist/runtime/editor/features/import-existing/Dialog/index.d.vue.ts +7 -3
- package/dist/runtime/editor/features/import-existing/Dialog/index.vue +107 -65
- package/dist/runtime/editor/features/import-existing/Dialog/index.vue.d.ts +7 -3
- package/dist/runtime/editor/features/import-existing/index.vue +19 -6
- package/dist/runtime/editor/features/import-existing/types.d.ts +0 -11
- package/dist/runtime/editor/features/library/ReusableDialog/index.vue +7 -33
- package/dist/runtime/editor/features/library/index.vue +14 -5
- package/dist/runtime/editor/features/media-library/Library/index.vue +3 -1
- package/dist/runtime/editor/features/media-library/index.vue +9 -2
- package/dist/runtime/editor/features/media-library/types.d.ts +2 -0
- package/dist/runtime/editor/features/multi-select/Renderer/index.vue +16 -15
- package/dist/runtime/editor/features/multi-select/index.vue +9 -3
- package/dist/runtime/editor/features/options/Form/Radios/index.vue +4 -8
- package/dist/runtime/editor/features/options/index.vue +7 -2
- package/dist/runtime/editor/features/preview-grant/index.vue +8 -2
- package/dist/runtime/editor/features/publish/index.vue +3 -2
- package/dist/runtime/editor/features/referenced-entities/index.vue +7 -2
- package/dist/runtime/editor/features/responsive-preview/index.vue +13 -11
- package/dist/runtime/editor/features/search/index.vue +6 -2
- package/dist/runtime/editor/features/selection/AddButtons/Renderer/index.vue +6 -11
- package/dist/runtime/editor/features/selection/Renderer/index.vue +9 -14
- package/dist/runtime/editor/features/selection/index.vue +7 -4
- package/dist/runtime/editor/features/settings/index.vue +8 -3
- package/dist/runtime/editor/features/structure/index.vue +3 -2
- package/dist/runtime/editor/features/templates/CreateDialog/index.vue +1 -0
- package/dist/runtime/editor/features/templates/index.vue +14 -6
- package/dist/runtime/editor/features/theme/index.vue +2 -1
- package/dist/runtime/editor/features/tour/index.vue +6 -2
- package/dist/runtime/editor/features/translations/index.vue +7 -4
- package/dist/runtime/editor/features/workspace/Overlay/Item.d.vue.ts +3 -0
- package/dist/runtime/editor/features/workspace/Overlay/Item.vue +49 -0
- package/dist/runtime/editor/features/workspace/Overlay/Item.vue.d.ts +3 -0
- package/dist/runtime/editor/features/workspace/Overlay/index.vue +16 -104
- package/dist/runtime/editor/features/workspace/index.vue +6 -2
- package/dist/runtime/editor/helpers/webgl/index.d.ts +3 -2
- package/dist/runtime/editor/helpers/webgl/index.js +2 -3
- package/dist/runtime/editor/libraries/fzf.d.ts +3 -0
- package/dist/runtime/editor/libraries/fzf.js +7 -0
- package/dist/runtime/editor/libraries/twgl.d.ts +10 -0
- package/dist/runtime/editor/libraries/twgl.js +14 -0
- package/dist/runtime/editor/plugins/DebugOverlay/index.vue +3 -1
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue +39 -18
- package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +2 -0
- package/dist/runtime/editor/plugins/Sidebar/index.vue +12 -4
- package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +2 -0
- package/dist/runtime/editor/providers/animation.d.ts +5 -10
- package/dist/runtime/editor/providers/animation.js +10 -8
- package/dist/runtime/editor/providers/directive.d.ts +11 -0
- package/dist/runtime/editor/providers/directive.js +16 -0
- package/dist/runtime/editor/providers/features.d.ts +3 -3
- package/dist/runtime/editor/providers/features.js +1 -1
- package/dist/runtime/editor/providers/fieldValue.d.ts +27 -0
- package/dist/runtime/editor/providers/fieldValue.js +21 -1
- package/dist/runtime/editor/providers/keyboard.js +6 -3
- package/dist/runtime/editor/providers/readability.d.ts +28 -4
- package/dist/runtime/editor/providers/readability.js +30 -46
- package/dist/runtime/editor/providers/selection.d.ts +8 -0
- package/dist/runtime/editor/providers/selection.js +6 -0
- package/dist/runtime/editor/providers/texts.d.ts +1 -3
- package/dist/runtime/editor/providers/texts.js +34 -37
- package/dist/runtime/editor/providers/workspaces.d.ts +93 -0
- package/dist/runtime/editor/providers/workspaces.js +76 -0
- package/dist/runtime/editor/translations/de.json +918 -3616
- package/dist/runtime/editor/translations/fr.json +250 -3616
- package/dist/runtime/editor/translations/gsw_CH.json +918 -3616
- package/dist/runtime/editor/translations/it.json +250 -3616
- package/dist/runtime/editor/types/app.d.ts +2 -0
- package/dist/runtime/editor/types/features.d.ts +1 -1
- package/dist/runtime/editor/types/state.d.ts +7 -0
- package/dist/runtime/helpers/injections.d.ts +6 -0
- package/dist/runtime/helpers/injections.js +3 -0
- package/dist/runtime/types/definitions.d.ts +4 -0
- package/package.json +14 -4
- package/dist/runtime/editor/features/analyze/readability/builtinAnalyzer.d.ts +0 -6
- package/dist/runtime/editor/features/analyze/readability/builtinAnalyzer.js +0 -216
- package/dist/runtime/editor/features/workspace/types.d.ts +0 -59
- /package/dist/runtime/editor/features/{workspace → droppable-field-edit}/types.js +0 -0
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import type { BlokkliAdapterSearchResults } from '#blokkli/editor/adapter';
|
|
2
|
-
export type BlokkliAdapterGetImportItemsResult = BlokkliAdapterSearchResults<ImportItem>;
|
|
3
1
|
export type ImportFromExistingEvent = {
|
|
4
2
|
sourceUuid: string;
|
|
5
3
|
sourceFields: string[];
|
|
6
4
|
};
|
|
7
|
-
export interface ImportItem {
|
|
8
|
-
uuid: string;
|
|
9
|
-
label: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
}
|
|
12
5
|
declare module '#blokkli/editor/adapter' {
|
|
13
6
|
interface BlokkliAdapter<T> {
|
|
14
|
-
/**
|
|
15
|
-
* Get all existing entities for importing.
|
|
16
|
-
*/
|
|
17
|
-
getImportItems?: (e: AdapterSearchArguments) => Promise<BlokkliAdapterGetImportItemsResult>;
|
|
18
7
|
/**
|
|
19
8
|
* Import items from an existing entity.
|
|
20
9
|
*/
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
<FormText
|
|
29
29
|
id="reusable_label"
|
|
30
30
|
v-model="label"
|
|
31
|
+
lazy
|
|
31
32
|
:label="$t('libraryDialogDescriptionLabel', 'Description')"
|
|
32
33
|
type="text"
|
|
33
34
|
:placeholder="
|
|
@@ -43,37 +44,28 @@
|
|
|
43
44
|
<div class="bk-form-label">
|
|
44
45
|
{{ $t("libraryPreviewLabel", "Preview") }}
|
|
45
46
|
</div>
|
|
46
|
-
<
|
|
47
|
-
class="bk-dialog-content-element"
|
|
48
|
-
:class="[backgroundClass, { 'bk-default-bg': !backgroundClass }]"
|
|
49
|
-
:style="backgroundClass ? {} : { backgroundColor }"
|
|
50
|
-
>
|
|
51
|
-
<div ref="previewEl" />
|
|
52
|
-
</div>
|
|
47
|
+
<BlockPreviewRenderer :uuids="[uuid]" />
|
|
53
48
|
</FormItem>
|
|
54
49
|
</div>
|
|
55
50
|
</DialogModal>
|
|
56
51
|
</template>
|
|
57
52
|
|
|
58
53
|
<script setup>
|
|
59
|
-
import { ref, useBlokkli,
|
|
54
|
+
import { ref, useBlokkli, watch } from "#imports";
|
|
60
55
|
import {
|
|
61
56
|
DialogModal,
|
|
62
57
|
InfoBox,
|
|
63
58
|
FormText,
|
|
64
|
-
FormItem
|
|
59
|
+
FormItem,
|
|
60
|
+
BlockPreviewRenderer
|
|
65
61
|
} from "#blokkli/editor/components";
|
|
66
|
-
import { realBackgroundColor } from "#blokkli/editor/helpers/dom";
|
|
67
62
|
defineEmits(["confirm", "cancel"]);
|
|
68
|
-
const {
|
|
69
|
-
|
|
63
|
+
const { $t, ui } = useBlokkli();
|
|
64
|
+
defineProps({
|
|
70
65
|
uuid: { type: String, required: true },
|
|
71
66
|
backgroundClass: { type: String, required: false }
|
|
72
67
|
});
|
|
73
68
|
const label = ref("");
|
|
74
|
-
const width = ref(450);
|
|
75
|
-
const previewEl = useTemplateRef("previewEl");
|
|
76
|
-
const backgroundColor = ref("");
|
|
77
69
|
watch(
|
|
78
70
|
label,
|
|
79
71
|
() => {
|
|
@@ -83,22 +75,4 @@ watch(
|
|
|
83
75
|
once: true
|
|
84
76
|
}
|
|
85
77
|
);
|
|
86
|
-
onMounted(() => {
|
|
87
|
-
if (previewEl.value) {
|
|
88
|
-
const item = blocks.getBlock(props.uuid);
|
|
89
|
-
if (!item) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const element = dom.getDragElement(item);
|
|
93
|
-
if (!element) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const markup = dom.getDropElementMarkup(item);
|
|
97
|
-
width.value = element.getBoundingClientRect().width + 40;
|
|
98
|
-
const clone = document.createElement("div");
|
|
99
|
-
clone.innerHTML = markup;
|
|
100
|
-
previewEl.value.appendChild(clone);
|
|
101
|
-
backgroundColor.value = realBackgroundColor(element);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
78
|
</script>
|
|
@@ -55,10 +55,14 @@
|
|
|
55
55
|
</template>
|
|
56
56
|
|
|
57
57
|
<script setup>
|
|
58
|
-
import {
|
|
58
|
+
import {
|
|
59
|
+
ref,
|
|
60
|
+
computed,
|
|
61
|
+
useBlokkli,
|
|
62
|
+
defineBlokkliFeature,
|
|
63
|
+
defineAsyncComponent
|
|
64
|
+
} from "#imports";
|
|
59
65
|
import { PluginItemAction } from "#blokkli/editor/plugins";
|
|
60
|
-
import ReusableDialog from "./ReusableDialog/index.vue";
|
|
61
|
-
import LibraryDialog from "./LibraryDialog/index.vue";
|
|
62
66
|
import {
|
|
63
67
|
BlokkliTransition,
|
|
64
68
|
NestedEditorOverlay
|
|
@@ -70,13 +74,18 @@ import {
|
|
|
70
74
|
useDialog
|
|
71
75
|
} from "#blokkli/editor/composables";
|
|
72
76
|
import { fromLibraryBlockBundle } from "#blokkli-build/config";
|
|
77
|
+
const ReusableDialog = defineAsyncComponent(
|
|
78
|
+
() => import("./ReusableDialog/index.vue")
|
|
79
|
+
);
|
|
80
|
+
const LibraryDialog = defineAsyncComponent(
|
|
81
|
+
() => import("./LibraryDialog/index.vue")
|
|
82
|
+
);
|
|
73
83
|
const { adapter } = defineBlokkliFeature({
|
|
74
84
|
id: "library",
|
|
75
85
|
icon: "reusable",
|
|
76
86
|
label: "Library",
|
|
77
87
|
description: "Implements support for a block library to manage reusable blocks.",
|
|
78
|
-
requiredAdapterMethods: ["makeBlockReusable", "detachReusableBlock"]
|
|
79
|
-
dependencies: ["add-list"]
|
|
88
|
+
requiredAdapterMethods: ["makeBlockReusable", "detachReusableBlock"]
|
|
80
89
|
});
|
|
81
90
|
const { selection, state, types, $t, eventBus, definitions, ui, permissions } = useBlokkli();
|
|
82
91
|
const showReusableDialog = useDialog("library-reusable", "center");
|
|
@@ -176,7 +176,9 @@ function buildItem(element2) {
|
|
|
176
176
|
mediaId: item.mediaId,
|
|
177
177
|
mediaBundle: item.mediaBundle ?? "",
|
|
178
178
|
itemBundles: item.targetBundles,
|
|
179
|
-
element: () => element2
|
|
179
|
+
element: () => element2,
|
|
180
|
+
label: item.label,
|
|
181
|
+
thumbnailSrc: item.thumbnail
|
|
180
182
|
};
|
|
181
183
|
}
|
|
182
184
|
onBlokkliEvent("item:dropped", function() {
|
|
@@ -17,12 +17,16 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup>
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
useBlokkli,
|
|
22
|
+
defineBlokkliFeature,
|
|
23
|
+
defineAsyncComponent
|
|
24
|
+
} from "#imports";
|
|
21
25
|
import { PluginSidebar } from "#blokkli/editor/plugins";
|
|
22
|
-
import Library from "./Library/index.vue";
|
|
23
26
|
import { falsy } from "#blokkli/helpers";
|
|
24
27
|
import { itemEntityType } from "#blokkli-build/config";
|
|
25
28
|
import { defineDropAreas, defineDropHandler } from "#blokkli/editor/composables";
|
|
29
|
+
const Library = defineAsyncComponent(() => import("./Library/index.vue"));
|
|
26
30
|
defineBlokkliFeature({
|
|
27
31
|
id: "media-library",
|
|
28
32
|
icon: "bk_mdi_image",
|
|
@@ -48,6 +52,9 @@ defineDropAreas((dragItems) => {
|
|
|
48
52
|
}
|
|
49
53
|
return directive.getDroppableElements().map((field) => {
|
|
50
54
|
const config = types.getDroppableFieldConfig(field.fieldName, field);
|
|
55
|
+
if (config.cardinality !== 1) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
51
58
|
const allowedBundles = config.allowed.find(
|
|
52
59
|
(v) => v.type === "media"
|
|
53
60
|
)?.bundles;
|
|
@@ -8,11 +8,6 @@ import { intersects } from "#blokkli/editor/helpers/geometry";
|
|
|
8
8
|
import { toShaderColor } from "#blokkli/editor/helpers/color";
|
|
9
9
|
import vs from "./vertex.glsl?raw";
|
|
10
10
|
import fs from "./fragment.glsl?raw";
|
|
11
|
-
import {
|
|
12
|
-
setBuffersAndAttributes,
|
|
13
|
-
drawBufferInfo,
|
|
14
|
-
setUniforms
|
|
15
|
-
} from "twgl.js";
|
|
16
11
|
import { RectangleBufferCollector } from "#blokkli/editor/helpers/webgl";
|
|
17
12
|
import { defineRenderer, useDebugLogger } from "#blokkli/editor/composables";
|
|
18
13
|
const { eventBus, dom, theme, animation, ui, blocks, permissions } = useBlokkli();
|
|
@@ -25,7 +20,7 @@ const props = defineProps({
|
|
|
25
20
|
const startTimestamp = Date.now();
|
|
26
21
|
defineEmits(["select"]);
|
|
27
22
|
class MultiSelectRectangleBufferCollector extends RectangleBufferCollector {
|
|
28
|
-
getBufferInfo(gl, offset, scale) {
|
|
23
|
+
getBufferInfo(gl, twgl, offset, scale) {
|
|
29
24
|
if (!offset || !scale) {
|
|
30
25
|
return { info: this.bufferInfo, hasChanged: false };
|
|
31
26
|
}
|
|
@@ -66,8 +61,8 @@ class MultiSelectRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
66
61
|
);
|
|
67
62
|
}
|
|
68
63
|
const hasChanged = lengthBefore !== this.positions.length;
|
|
69
|
-
if (hasChanged && gl) {
|
|
70
|
-
this.bufferInfo = this.createBufferInfo(gl);
|
|
64
|
+
if (hasChanged && gl && twgl) {
|
|
65
|
+
this.bufferInfo = this.createBufferInfo(gl, twgl);
|
|
71
66
|
}
|
|
72
67
|
return { info: this.bufferInfo, hasChanged };
|
|
73
68
|
}
|
|
@@ -127,7 +122,7 @@ function getSelectRect(offset, scale) {
|
|
|
127
122
|
};
|
|
128
123
|
return { shader, check };
|
|
129
124
|
}
|
|
130
|
-
const { collector } = defineRenderer("multiselect-overlay", {
|
|
125
|
+
const { collector } = await defineRenderer("multiselect-overlay", {
|
|
131
126
|
zIndex: 450,
|
|
132
127
|
only: true,
|
|
133
128
|
collector: () => {
|
|
@@ -185,7 +180,7 @@ const { collector } = defineRenderer("multiselect-overlay", {
|
|
|
185
180
|
},
|
|
186
181
|
program: () => ({ shaders: [vs, fs] }),
|
|
187
182
|
cursor: () => "crosshair",
|
|
188
|
-
render: (ctx, gl, program) => {
|
|
183
|
+
render: (ctx, gl, program, twgl) => {
|
|
189
184
|
mouseX = ctx.mouseX;
|
|
190
185
|
mouseY = ctx.mouseY;
|
|
191
186
|
const { shader, check } = getSelectRect(
|
|
@@ -196,11 +191,11 @@ const { collector } = defineRenderer("multiselect-overlay", {
|
|
|
196
191
|
const shouldSelectAll = props.isPressingControl || !nested.length;
|
|
197
192
|
gl.useProgram(program.program);
|
|
198
193
|
const time = (Date.now() - startTimestamp) / 1e3;
|
|
199
|
-
setUniforms(program, {
|
|
194
|
+
twgl.setUniforms(program, {
|
|
200
195
|
u_color_field_active: toShaderColor(uniforms.u_color_field_active),
|
|
201
196
|
u_color_field_default: toShaderColor(uniforms.u_color_field_default)
|
|
202
197
|
});
|
|
203
|
-
setUniforms(program, {
|
|
198
|
+
twgl.setUniforms(program, {
|
|
204
199
|
u_select_all: shouldSelectAll ? 1 : 0,
|
|
205
200
|
u_select_rect: [shader.x, shader.y, shader.width, shader.height],
|
|
206
201
|
u_time: time
|
|
@@ -208,6 +203,7 @@ const { collector } = defineRenderer("multiselect-overlay", {
|
|
|
208
203
|
animation.setSharedUniforms(gl, program);
|
|
209
204
|
const { info, hasChanged } = collector.getBufferInfo(
|
|
210
205
|
gl,
|
|
206
|
+
twgl,
|
|
211
207
|
ctx.artboardOffset,
|
|
212
208
|
ctx.artboardScale
|
|
213
209
|
);
|
|
@@ -215,9 +211,9 @@ const { collector } = defineRenderer("multiselect-overlay", {
|
|
|
215
211
|
return;
|
|
216
212
|
}
|
|
217
213
|
if (hasChanged) {
|
|
218
|
-
setBuffersAndAttributes(gl, program, info);
|
|
214
|
+
twgl.setBuffersAndAttributes(gl, program, info);
|
|
219
215
|
}
|
|
220
|
-
drawBufferInfo(gl, info, gl.TRIANGLES);
|
|
216
|
+
twgl.drawBufferInfo(gl, info, gl.TRIANGLES);
|
|
221
217
|
},
|
|
222
218
|
renderFallback: (ctx, ctx2d) => {
|
|
223
219
|
mouseX = ctx.mouseX;
|
|
@@ -228,7 +224,12 @@ const { collector } = defineRenderer("multiselect-overlay", {
|
|
|
228
224
|
);
|
|
229
225
|
const { nested } = collector.getSelectedUuids(check);
|
|
230
226
|
const shouldSelectAll = props.isPressingControl || !nested.length;
|
|
231
|
-
collector.getBufferInfo(
|
|
227
|
+
collector.getBufferInfo(
|
|
228
|
+
void 0,
|
|
229
|
+
void 0,
|
|
230
|
+
ctx.artboardOffset,
|
|
231
|
+
ctx.artboardScale
|
|
232
|
+
);
|
|
232
233
|
const rects = Object.values(collector.rects);
|
|
233
234
|
const colorFieldActive = `rgba(${uniforms.u_color_field_active[0]}, ${uniforms.u_color_field_active[1]}, ${uniforms.u_color_field_active[2]}, 0.3)`;
|
|
234
235
|
for (let i = 0; i < rects.length; i++) {
|
|
@@ -16,10 +16,16 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
18
|
<script setup>
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
ref,
|
|
21
|
+
useBlokkli,
|
|
22
|
+
defineBlokkliFeature,
|
|
23
|
+
computed,
|
|
24
|
+
defineAsyncComponent
|
|
25
|
+
} from "#imports";
|
|
20
26
|
import { ErrorBoundary } from "#blokkli/editor/components";
|
|
21
|
-
import Renderer from "./Renderer/index.vue";
|
|
22
27
|
import { onBlokkliEvent } from "#blokkli/editor/composables";
|
|
28
|
+
const Renderer = defineAsyncComponent(() => import("./Renderer/index.vue"));
|
|
23
29
|
defineBlokkliFeature({
|
|
24
30
|
id: "multi-select",
|
|
25
31
|
label: "Multiselect",
|
|
@@ -30,7 +36,7 @@ defineBlokkliFeature({
|
|
|
30
36
|
const { keyboard, eventBus, selection, animation, $t } = useBlokkli();
|
|
31
37
|
const isLocked = ref(false);
|
|
32
38
|
const enabled = computed(
|
|
33
|
-
() => !selection.
|
|
39
|
+
() => !selection.activeFieldLabel.value && !isLocked.value
|
|
34
40
|
);
|
|
35
41
|
const shouldRender = ref(false);
|
|
36
42
|
const downX = ref(0);
|
|
@@ -41,11 +41,7 @@
|
|
|
41
41
|
:style="{ flex: v }"
|
|
42
42
|
/>
|
|
43
43
|
</div>
|
|
44
|
-
<span
|
|
45
|
-
v-else-if="
|
|
46
|
-
typeof option.value === 'string' || typeof option.value === 'object' && displayAs === 'colors'
|
|
47
|
-
"
|
|
48
|
-
>
|
|
44
|
+
<span v-else>
|
|
49
45
|
{{
|
|
50
46
|
typeof option.value === "string" ? option.value : option.value.label
|
|
51
47
|
}}
|
|
@@ -103,13 +99,13 @@ const isDefaultRadios = computed(
|
|
|
103
99
|
() => props.displayAs === "radios" || !props.displayAs
|
|
104
100
|
);
|
|
105
101
|
function onOptionMouseEnter(option) {
|
|
106
|
-
if (!isDefaultRadios.value) {
|
|
102
|
+
if (!isDefaultRadios.value || option.description) {
|
|
107
103
|
active.value = option.label;
|
|
108
104
|
}
|
|
109
105
|
activeDescription.value = option.description;
|
|
110
106
|
}
|
|
111
107
|
function onMouseLeave() {
|
|
112
|
-
if (!isDefaultRadios.value) {
|
|
108
|
+
if (!isDefaultRadios.value || selectedOption.value?.description) {
|
|
113
109
|
active.value = selectedOption.value?.label ?? "";
|
|
114
110
|
}
|
|
115
111
|
activeDescription.value = selectedOption.value?.description ?? "";
|
|
@@ -134,7 +130,7 @@ defineCommands(() => {
|
|
|
134
130
|
});
|
|
135
131
|
});
|
|
136
132
|
onMounted(() => {
|
|
137
|
-
if (!isDefaultRadios.value) {
|
|
133
|
+
if (!isDefaultRadios.value || selectedOption.value?.description) {
|
|
138
134
|
active.value = selectedOption.value?.label ?? "";
|
|
139
135
|
}
|
|
140
136
|
activeDescription.value = selectedOption.value?.description ?? "";
|
|
@@ -12,10 +12,15 @@
|
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script setup>
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
computed,
|
|
17
|
+
useBlokkli,
|
|
18
|
+
defineBlokkliFeature,
|
|
19
|
+
defineAsyncComponent
|
|
20
|
+
} from "#imports";
|
|
16
21
|
import { falsy, onlyUnique } from "#blokkli/helpers";
|
|
17
|
-
import OptionsForm from "./Form/index.vue";
|
|
18
22
|
import { fragmentBlockBundle } from "#blokkli-build/config";
|
|
23
|
+
const OptionsForm = defineAsyncComponent(() => import("./Form/index.vue"));
|
|
19
24
|
defineBlokkliFeature({
|
|
20
25
|
id: "options",
|
|
21
26
|
label: "Options",
|
|
@@ -42,10 +42,16 @@
|
|
|
42
42
|
</template>
|
|
43
43
|
|
|
44
44
|
<script setup>
|
|
45
|
-
import {
|
|
45
|
+
import {
|
|
46
|
+
ref,
|
|
47
|
+
watch,
|
|
48
|
+
useBlokkli,
|
|
49
|
+
defineBlokkliFeature,
|
|
50
|
+
defineAsyncComponent
|
|
51
|
+
} from "#imports";
|
|
46
52
|
import { PluginToolbarButton } from "#blokkli/editor/plugins";
|
|
47
|
-
import QrCode from "./QrCode/index.vue";
|
|
48
53
|
import { DialogModal, BlokkliTransition } from "#blokkli/editor/components";
|
|
54
|
+
const QrCode = defineAsyncComponent(() => import("./QrCode/index.vue"));
|
|
49
55
|
const { adapter } = defineBlokkliFeature({
|
|
50
56
|
id: "preview-grant",
|
|
51
57
|
label: "Preview Grant",
|
|
@@ -12,15 +12,16 @@ import {
|
|
|
12
12
|
defineBlokkliFeature,
|
|
13
13
|
computed,
|
|
14
14
|
useRoute,
|
|
15
|
-
nextTick
|
|
15
|
+
nextTick,
|
|
16
|
+
defineAsyncComponent
|
|
16
17
|
} from "#imports";
|
|
17
18
|
import { BlokkliTransition } from "#blokkli/editor/components";
|
|
18
|
-
import PublishDialog from "./Dialog/index.vue";
|
|
19
19
|
import {
|
|
20
20
|
defineMenuButton,
|
|
21
21
|
onBlokkliEvent,
|
|
22
22
|
useDialog
|
|
23
23
|
} from "#blokkli/editor/composables";
|
|
24
|
+
const PublishDialog = defineAsyncComponent(() => import("./Dialog/index.vue"));
|
|
24
25
|
const { adapter, settings } = defineBlokkliFeature({
|
|
25
26
|
id: "publish",
|
|
26
27
|
icon: "bk_mdi_publish",
|
|
@@ -9,9 +9,14 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script setup>
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
useBlokkli,
|
|
14
|
+
defineBlokkliFeature,
|
|
15
|
+
computed,
|
|
16
|
+
defineAsyncComponent
|
|
17
|
+
} from "#imports";
|
|
13
18
|
import { useStateBasedCache } from "#blokkli/editor/composables";
|
|
14
|
-
|
|
19
|
+
const List = defineAsyncComponent(() => import("./List/index.vue"));
|
|
15
20
|
defineBlokkliFeature({
|
|
16
21
|
id: "referenced-entities",
|
|
17
22
|
label: "Referenced Entities",
|
|
@@ -68,11 +68,12 @@ import {
|
|
|
68
68
|
computed,
|
|
69
69
|
useBlokkli,
|
|
70
70
|
defineBlokkliFeature,
|
|
71
|
-
watch
|
|
71
|
+
watch,
|
|
72
|
+
defineAsyncComponent
|
|
72
73
|
} from "#imports";
|
|
73
74
|
import { PluginSidebar } from "#blokkli/editor/plugins";
|
|
74
|
-
import PreviewFrame from "./Frame/index.vue";
|
|
75
75
|
import { Icon } from "#blokkli/editor/components";
|
|
76
|
+
const PreviewFrame = defineAsyncComponent(() => import("./Frame/index.vue"));
|
|
76
77
|
defineBlokkliFeature({
|
|
77
78
|
id: "responsive-preview",
|
|
78
79
|
icon: "bk_mdi_mobile",
|
|
@@ -115,18 +116,18 @@ const buildViewportSubtitle = (w, h, canRotate) => {
|
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
118
|
const viewportOptions = computed(() => {
|
|
118
|
-
|
|
119
|
+
const base = [
|
|
119
120
|
{
|
|
120
121
|
label: $t("responsivePreviewCustomViewport", "Custom"),
|
|
121
122
|
id: "custom",
|
|
122
|
-
icon: "
|
|
123
|
+
icon: "bk_mdi_resize"
|
|
123
124
|
},
|
|
124
125
|
{
|
|
125
126
|
label: "iPhone SE",
|
|
126
127
|
id: "iphone-se",
|
|
127
128
|
width: 375,
|
|
128
129
|
height: 667,
|
|
129
|
-
icon: "
|
|
130
|
+
icon: "bk_mdi_mobile",
|
|
130
131
|
canRotate: true
|
|
131
132
|
},
|
|
132
133
|
{
|
|
@@ -134,7 +135,7 @@ const viewportOptions = computed(() => {
|
|
|
134
135
|
id: "iphone-15",
|
|
135
136
|
width: 393,
|
|
136
137
|
height: 852,
|
|
137
|
-
icon: "
|
|
138
|
+
icon: "bk_mdi_mobile",
|
|
138
139
|
canRotate: true
|
|
139
140
|
},
|
|
140
141
|
{
|
|
@@ -142,7 +143,7 @@ const viewportOptions = computed(() => {
|
|
|
142
143
|
id: "iphone-15-pro-max",
|
|
143
144
|
width: 430,
|
|
144
145
|
height: 932,
|
|
145
|
-
icon: "
|
|
146
|
+
icon: "bk_mdi_mobile",
|
|
146
147
|
canRotate: true
|
|
147
148
|
},
|
|
148
149
|
{
|
|
@@ -150,7 +151,7 @@ const viewportOptions = computed(() => {
|
|
|
150
151
|
id: "ipad-mini",
|
|
151
152
|
width: 768,
|
|
152
153
|
height: 1024,
|
|
153
|
-
icon: "
|
|
154
|
+
icon: "bk_mdi_tablet",
|
|
154
155
|
canRotate: true
|
|
155
156
|
},
|
|
156
157
|
{
|
|
@@ -158,16 +159,17 @@ const viewportOptions = computed(() => {
|
|
|
158
159
|
id: "13-laptop",
|
|
159
160
|
width: 1280,
|
|
160
161
|
height: 800,
|
|
161
|
-
icon: "
|
|
162
|
+
icon: "bk_mdi_laptop_mac"
|
|
162
163
|
},
|
|
163
164
|
{
|
|
164
165
|
label: '24" Monitor',
|
|
165
166
|
id: "24-monitor",
|
|
166
167
|
width: 1920,
|
|
167
168
|
height: 1200,
|
|
168
|
-
icon: "
|
|
169
|
+
icon: "bk_mdi_monitor"
|
|
169
170
|
}
|
|
170
|
-
]
|
|
171
|
+
];
|
|
172
|
+
return base.map((option) => {
|
|
171
173
|
return {
|
|
172
174
|
...option,
|
|
173
175
|
subtitle: buildViewportSubtitle(
|
|
@@ -40,9 +40,9 @@ import {
|
|
|
40
40
|
ref,
|
|
41
41
|
useBlokkli,
|
|
42
42
|
defineBlokkliFeature,
|
|
43
|
-
useTemplateRef
|
|
43
|
+
useTemplateRef,
|
|
44
|
+
defineAsyncComponent
|
|
44
45
|
} from "#imports";
|
|
45
|
-
import Overlay from "./Overlay/index.vue";
|
|
46
46
|
import { BlokkliTransition } from "#blokkli/editor/components";
|
|
47
47
|
import { PluginToolbarButton } from "#blokkli/editor/plugins";
|
|
48
48
|
import {
|
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
} from "#blokkli/editor/composables";
|
|
53
53
|
import { falsy } from "#blokkli/helpers";
|
|
54
54
|
import { itemEntityType } from "#blokkli-build/config";
|
|
55
|
+
const Overlay = defineAsyncComponent(() => import("./Overlay/index.vue"));
|
|
55
56
|
defineBlokkliFeature({
|
|
56
57
|
id: "search",
|
|
57
58
|
icon: "bk_mdi_search",
|
|
@@ -83,6 +84,9 @@ defineDropAreas((dragItems) => {
|
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
86
|
const config = types.getDroppableFieldConfig(field.fieldName, field);
|
|
87
|
+
if (config.cardinality !== 1) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
86
90
|
const allowedBundles = config.allowed.find(
|
|
87
91
|
(v) => v.type === searchItem.entityType
|
|
88
92
|
)?.bundles;
|
|
@@ -18,11 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
<script setup>
|
|
20
20
|
import { useBlokkli, computed, ref } from "#imports";
|
|
21
|
-
import {
|
|
22
|
-
setBuffersAndAttributes,
|
|
23
|
-
drawBufferInfo,
|
|
24
|
-
setUniforms
|
|
25
|
-
} from "twgl.js";
|
|
26
21
|
import vs from "./vertex.glsl?raw";
|
|
27
22
|
import fs from "./fragment.glsl?raw";
|
|
28
23
|
import { RectangleBufferCollector } from "#blokkli/editor/helpers/webgl";
|
|
@@ -322,7 +317,7 @@ function getCircleAtPoint(x, y) {
|
|
|
322
317
|
}
|
|
323
318
|
return -1;
|
|
324
319
|
}
|
|
325
|
-
const { collector } = defineRenderer("add-buttons", {
|
|
320
|
+
const { collector } = await defineRenderer("add-buttons", {
|
|
326
321
|
zIndex: 1e3,
|
|
327
322
|
collector: () => {
|
|
328
323
|
const c = new CircleBufferCollector();
|
|
@@ -381,9 +376,9 @@ const { collector } = defineRenderer("add-buttons", {
|
|
|
381
376
|
}
|
|
382
377
|
return false;
|
|
383
378
|
},
|
|
384
|
-
render: (ctx, gl, program) => {
|
|
379
|
+
render: (ctx, gl, program, twgl) => {
|
|
385
380
|
if (!bufferInfoCache) {
|
|
386
|
-
bufferInfoCache = collector.createBufferInfo(gl);
|
|
381
|
+
bufferInfoCache = collector.createBufferInfo(gl, twgl);
|
|
387
382
|
}
|
|
388
383
|
if (!bufferInfoCache) {
|
|
389
384
|
return;
|
|
@@ -470,7 +465,7 @@ const { collector } = defineRenderer("add-buttons", {
|
|
|
470
465
|
ctx.mouseArtboard.y
|
|
471
466
|
);
|
|
472
467
|
gl.useProgram(program.program);
|
|
473
|
-
setUniforms(program, {
|
|
468
|
+
twgl.setUniforms(program, {
|
|
474
469
|
u_circle_positions: circlePositions,
|
|
475
470
|
u_circle_visible: circleVisible,
|
|
476
471
|
u_color: toShaderColor(color.value),
|
|
@@ -482,8 +477,8 @@ const { collector } = defineRenderer("add-buttons", {
|
|
|
482
477
|
u_scale_transition: ctx.changeOptionsTransition
|
|
483
478
|
});
|
|
484
479
|
animation.setSharedUniforms(gl, program);
|
|
485
|
-
setBuffersAndAttributes(gl, program, bufferInfoCache);
|
|
486
|
-
drawBufferInfo(gl, bufferInfoCache, gl.TRIANGLES);
|
|
480
|
+
twgl.setBuffersAndAttributes(gl, program, bufferInfoCache);
|
|
481
|
+
twgl.drawBufferInfo(gl, bufferInfoCache, gl.TRIANGLES);
|
|
487
482
|
},
|
|
488
483
|
renderFallback: (ctx, ctx2d) => {
|
|
489
484
|
circleVisible.fill(0);
|
|
@@ -4,11 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { useBlokkli, computed } from "#imports";
|
|
7
|
-
import {
|
|
8
|
-
setBuffersAndAttributes,
|
|
9
|
-
drawBufferInfo,
|
|
10
|
-
setUniforms
|
|
11
|
-
} from "twgl.js";
|
|
12
7
|
import vs from "./vertex.glsl?raw";
|
|
13
8
|
import fs from "./fragment.glsl?raw";
|
|
14
9
|
import { RectangleBufferCollector } from "#blokkli/editor/helpers/webgl";
|
|
@@ -27,7 +22,7 @@ class SelectionRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
27
22
|
uuids = [];
|
|
28
23
|
lastCount = 0;
|
|
29
24
|
prevKey = "";
|
|
30
|
-
getBufferInfo(gl, force) {
|
|
25
|
+
getBufferInfo(gl, twgl, force) {
|
|
31
26
|
const key = props.blocks.map((block) => {
|
|
32
27
|
const uuid = block.uuid;
|
|
33
28
|
const rect = dom.getBlockRect(uuid);
|
|
@@ -98,8 +93,8 @@ class SelectionRectangleBufferCollector extends RectangleBufferCollector {
|
|
|
98
93
|
}
|
|
99
94
|
this.prevKey = key;
|
|
100
95
|
}
|
|
101
|
-
if (hasChanged && gl) {
|
|
102
|
-
this.bufferInfo = this.createBufferInfo(gl);
|
|
96
|
+
if (hasChanged && gl && twgl) {
|
|
97
|
+
this.bufferInfo = this.createBufferInfo(gl, twgl);
|
|
103
98
|
}
|
|
104
99
|
return { info: this.bufferInfo, hasChanged };
|
|
105
100
|
}
|
|
@@ -161,17 +156,17 @@ const getColorHost = useTransitionedValue(() => {
|
|
|
161
156
|
const getTransforming = useTransitionedValue(() => {
|
|
162
157
|
return ui.isTransforming.value ? 1 : 0;
|
|
163
158
|
});
|
|
164
|
-
const { collector } = defineRenderer("selection-overlay", {
|
|
159
|
+
const { collector } = await defineRenderer("selection-overlay", {
|
|
165
160
|
zIndex: 100,
|
|
166
161
|
collector: () => new SelectionRectangleBufferCollector(),
|
|
167
162
|
program: () => ({ shaders: [vs, fs] }),
|
|
168
|
-
render: (ctx, gl, program) => {
|
|
163
|
+
render: (ctx, gl, program, twgl) => {
|
|
169
164
|
gl.useProgram(program.program);
|
|
170
|
-
const { info } = collector.getBufferInfo(gl);
|
|
165
|
+
const { info } = collector.getBufferInfo(gl, twgl);
|
|
171
166
|
if (!info) {
|
|
172
167
|
return;
|
|
173
168
|
}
|
|
174
|
-
setUniforms(program, {
|
|
169
|
+
twgl.setUniforms(program, {
|
|
175
170
|
u_color_default: toShaderColor(getColorDefault()),
|
|
176
171
|
u_color_inverted: toShaderColor(getColorInverted()),
|
|
177
172
|
u_color_library: toShaderColor(getColorLibrary()),
|
|
@@ -186,8 +181,8 @@ const { collector } = defineRenderer("selection-overlay", {
|
|
|
186
181
|
u_time: ctx.time
|
|
187
182
|
});
|
|
188
183
|
animation.setSharedUniforms(gl, program);
|
|
189
|
-
setBuffersAndAttributes(gl, program, info);
|
|
190
|
-
drawBufferInfo(gl, info, gl.TRIANGLES);
|
|
184
|
+
twgl.setBuffersAndAttributes(gl, program, info);
|
|
185
|
+
twgl.drawBufferInfo(gl, info, gl.TRIANGLES);
|
|
191
186
|
},
|
|
192
187
|
renderFallback: (ctx, ctx2d) => {
|
|
193
188
|
collector.getBufferInfo();
|