@blokkli/editor 2.0.0-alpha.21 → 2.0.0-alpha.23

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.
Files changed (154) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +97 -169
  3. package/dist/runtime/blokkliPlugins/MenuButton/index.vue +3 -1
  4. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +20 -14
  5. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue.d.ts +8 -4
  6. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +55 -25
  7. package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +4 -3
  8. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +4 -1
  9. package/dist/runtime/blokkliPlugins/ViewOption/index.vue +3 -1
  10. package/dist/runtime/blokkliPlugins/index.d.ts +1 -3
  11. package/dist/runtime/blokkliPlugins/index.js +0 -4
  12. package/dist/runtime/components/Blocks/FromLibrary/index.vue +0 -5
  13. package/dist/runtime/components/BlokkliEditable.vue +6 -1
  14. package/dist/runtime/components/BlokkliField.vue +1 -1
  15. package/dist/runtime/components/BlokkliProvider.vue +4 -4
  16. package/dist/runtime/components/Edit/Actions/ItemDropdown.vue +66 -0
  17. package/dist/runtime/components/Edit/Actions/ItemDropdown.vue.d.ts +6 -0
  18. package/dist/runtime/components/Edit/Actions/index.vue +7 -49
  19. package/dist/runtime/components/Edit/AnimationCanvas/index.vue +23 -68
  20. package/dist/runtime/components/Edit/BlockProxy/index.vue +2 -8
  21. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +33 -49
  22. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue.d.ts +14 -1
  23. package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +93 -0
  24. package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue.d.ts +12 -0
  25. package/dist/runtime/components/Edit/DraggableList.vue +5 -25
  26. package/dist/runtime/components/Edit/EditProvider.vue +24 -11
  27. package/dist/runtime/components/Edit/Features/{BlockAddList → AddList/Blocks}/index.vue +26 -62
  28. package/dist/runtime/components/Edit/Features/{Hover/Overlay → AddList/Blocks}/index.vue.d.ts +2 -2
  29. package/dist/runtime/components/Edit/Features/AddList/index.vue +29 -8
  30. package/dist/runtime/components/Edit/Features/Analyze/{Renderer.vue → Main.vue} +4 -8
  31. package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/fragment.glsl +10 -6
  32. package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/index.vue +43 -15
  33. package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/index.vue.d.ts +0 -2
  34. package/dist/runtime/components/Edit/Features/Analyze/{Overlay → Renderer}/vertex.glsl +11 -9
  35. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -3
  36. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/collectTextElements.js +3 -0
  37. package/dist/runtime/components/Edit/Features/Analyze/index.vue +7 -3
  38. package/dist/runtime/components/Edit/Features/Anchors/index.vue +2 -2
  39. package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +21 -10
  40. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +18 -11
  41. package/dist/runtime/components/Edit/Features/Conversions/index.vue +16 -9
  42. package/dist/runtime/components/Edit/Features/Debug/DebugSection.vue +24 -0
  43. package/dist/runtime/components/Edit/Features/Debug/DebugSection.vue.d.ts +16 -0
  44. package/dist/runtime/components/Edit/Features/Debug/Main.vue +80 -0
  45. package/dist/runtime/components/Edit/Features/Debug/Section/Features.vue +34 -0
  46. package/dist/runtime/components/Edit/Features/Debug/Section/Icons.vue +15 -0
  47. package/dist/runtime/components/Edit/Features/Debug/Section/Icons.vue.d.ts +2 -0
  48. package/dist/runtime/components/Edit/Features/Debug/Section/Keyboard.vue +17 -0
  49. package/dist/runtime/components/Edit/Features/Debug/Section/Keyboard.vue.d.ts +2 -0
  50. package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue +66 -0
  51. package/dist/runtime/components/Edit/Features/{Selection/OverlayFallback/index.vue.d.ts → Debug/Section/Logging.vue.d.ts} +2 -1
  52. package/dist/runtime/components/Edit/Features/Debug/Section/Rendering.vue +96 -0
  53. package/dist/runtime/components/Edit/Features/Debug/Section/Rendering.vue.d.ts +2 -0
  54. package/dist/runtime/components/Edit/Features/Debug/Section/Selection.vue +25 -0
  55. package/dist/runtime/components/Edit/Features/Debug/Section/Selection.vue.d.ts +2 -0
  56. package/dist/runtime/components/Edit/Features/Debug/index.vue +2 -2
  57. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +20 -27
  58. package/dist/runtime/components/Edit/Features/DraggingOverlay/Renderer/fragment.glsl +80 -0
  59. package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/index.vue +100 -87
  60. package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/vertex.glsl +51 -8
  61. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +3 -3
  62. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +0 -6
  63. package/dist/runtime/components/Edit/Features/EditableField/index.vue +6 -2
  64. package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +1 -5
  65. package/dist/runtime/components/Edit/Features/Hover/Renderer/fragment.glsl +141 -0
  66. package/dist/runtime/components/Edit/Features/Hover/{Overlay → Renderer}/index.vue +225 -38
  67. package/dist/runtime/components/Edit/Features/Hover/Renderer/index.vue.d.ts +2 -0
  68. package/dist/runtime/components/Edit/Features/Hover/{Overlay → Renderer}/vertex.glsl +49 -11
  69. package/dist/runtime/components/Edit/Features/Hover/index.vue +9 -6
  70. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +1 -5
  71. package/dist/runtime/components/Edit/Features/Library/index.vue +24 -12
  72. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +1 -1
  73. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +26 -13
  74. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue.d.ts +0 -1
  75. package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +3 -47
  76. package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/fragment.glsl +13 -26
  77. package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue +130 -72
  78. package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/index.vue.d.ts +0 -1
  79. package/dist/runtime/components/Edit/Features/MultiSelect/{Overlay → Renderer}/vertex.glsl +27 -2
  80. package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +25 -12
  81. package/dist/runtime/components/Edit/Features/Ownership/index.vue +2 -2
  82. package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +1 -1
  83. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +23 -6
  84. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +2 -2
  85. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +19 -17
  86. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +242 -131
  87. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +29 -12
  88. package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +12 -4
  89. package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/fragment.glsl +23 -14
  90. package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/index.vue +121 -28
  91. package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/index.vue.d.ts +0 -2
  92. package/dist/runtime/components/Edit/Features/Selection/{Overlay → Renderer}/vertex.glsl +23 -14
  93. package/dist/runtime/components/Edit/Features/Selection/index.vue +46 -59
  94. package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +5 -5
  95. package/dist/runtime/components/Edit/Features/Transform/index.vue +29 -22
  96. package/dist/runtime/components/Edit/Form/Checkboxes/index.vue +43 -0
  97. package/dist/runtime/components/Edit/Form/Checkboxes/index.vue.d.ts +20 -0
  98. package/dist/runtime/components/Edit/Messages/Item/index.vue.d.ts +1 -1
  99. package/dist/runtime/components/Edit/PreviewProvider.vue +1 -1
  100. package/dist/runtime/components/Edit/Sortli/index.vue +5 -8
  101. package/dist/runtime/components/Edit/Sortli/index.vue.d.ts +2 -0
  102. package/dist/runtime/components/Edit/Toolbar/index.vue +1 -4
  103. package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue +9 -2
  104. package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue.d.ts +4 -1
  105. package/dist/runtime/components/Edit/index.d.ts +6 -4
  106. package/dist/runtime/components/Edit/index.js +11 -7
  107. package/dist/runtime/css/output.css +1 -1
  108. package/dist/runtime/helpers/animationProvider.d.ts +58 -9
  109. package/dist/runtime/helpers/animationProvider.js +318 -75
  110. package/dist/runtime/helpers/composables/defineItemDropdownAction.d.ts +2 -0
  111. package/dist/runtime/helpers/composables/defineItemDropdownAction.js +10 -0
  112. package/dist/runtime/helpers/composables/defineRenderer.d.ts +5 -2
  113. package/dist/runtime/helpers/composables/defineRenderer.js +3 -2
  114. package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +16 -0
  115. package/dist/runtime/helpers/composables/useGlobalBlokkliObject.js +36 -0
  116. package/dist/runtime/helpers/debugProvider.d.ts +13 -3
  117. package/dist/runtime/helpers/debugProvider.js +80 -12
  118. package/dist/runtime/helpers/domProvider.js +46 -32
  119. package/dist/runtime/helpers/dropTargets/index.js +1 -1
  120. package/dist/runtime/helpers/eventBus.d.ts +1 -1
  121. package/dist/runtime/helpers/index.d.ts +1 -6
  122. package/dist/runtime/helpers/index.js +0 -81
  123. package/dist/runtime/helpers/pluginProvider.d.ts +16 -0
  124. package/dist/runtime/helpers/pluginProvider.js +30 -1
  125. package/dist/runtime/helpers/providers/directive.d.ts +4 -1
  126. package/dist/runtime/helpers/providers/directive.js +9 -2
  127. package/dist/runtime/helpers/stateProvider.js +1 -0
  128. package/dist/runtime/helpers/uiProvider.d.ts +5 -1
  129. package/dist/runtime/helpers/uiProvider.js +41 -7
  130. package/dist/runtime/helpers/webgl/index.d.ts +2 -3
  131. package/dist/runtime/helpers/webgl/index.js +9 -14
  132. package/dist/runtime/icons/dock-left.svg +1 -0
  133. package/dist/runtime/icons/dock-right.svg +1 -0
  134. package/dist/runtime/icons/dock-window.svg +1 -0
  135. package/dist/runtime/plugins/blokkliDirectives.js +1 -1
  136. package/dist/runtime/types/index.d.ts +4 -21
  137. package/package.json +1 -1
  138. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +0 -56
  139. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue.d.ts +0 -24
  140. package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +0 -76
  141. package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +0 -31
  142. package/dist/runtime/components/Edit/Features/BlockAddList/docs.md +0 -15
  143. package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +0 -240
  144. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +0 -96
  145. package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +0 -139
  146. package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +0 -42
  147. /package/dist/runtime/components/Edit/Features/Analyze/{Renderer.vue.d.ts → Main.vue.d.ts} +0 -0
  148. /package/dist/runtime/components/Edit/Features/Anchors/{Renderer.vue → Overlay/index.vue} +0 -0
  149. /package/dist/runtime/components/Edit/Features/{BlockAddList → Anchors/Overlay}/index.vue.d.ts +0 -0
  150. /package/dist/runtime/components/Edit/Features/Debug/{Renderer.vue.d.ts → Main.vue.d.ts} +0 -0
  151. /package/dist/runtime/components/Edit/Features/{Anchors/Renderer.vue.d.ts → Debug/Section/Features.vue.d.ts} +0 -0
  152. /package/dist/runtime/components/Edit/Features/DraggingOverlay/{DropTargets → Renderer}/index.vue.d.ts +0 -0
  153. /package/dist/runtime/components/Edit/Features/Ownership/{Renderer.vue → Banner/index.vue} +0 -0
  154. /package/dist/runtime/components/Edit/Features/Ownership/{Renderer.vue.d.ts → Banner/index.vue.d.ts} +0 -0
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <section class="bk-debug-section">
3
+ <h2 class="bk-debug-section-header" @click="toggle">
4
+ <span class="bk-debug-section-indicator">{{ isOpen ? "\u25BC" : "\u25B6" }}</span>
5
+ {{ title }}
6
+ </h2>
7
+ <div v-if="isOpen" class="bk-debug-section-content">
8
+ <slot />
9
+ </div>
10
+ </section>
11
+ </template>
12
+
13
+ <script setup>
14
+ import { useBlokkli } from "#imports";
15
+ const props = defineProps({
16
+ title: { type: String, required: true },
17
+ defaultOpen: { type: Boolean, required: false }
18
+ });
19
+ const { storage } = useBlokkli();
20
+ const isOpen = storage.use("debugSection" + props.title, false);
21
+ function toggle() {
22
+ isOpen.value = !isOpen.value;
23
+ }
24
+ </script>
@@ -0,0 +1,16 @@
1
+ type __VLS_Props = {
2
+ title: string;
3
+ defaultOpen?: boolean;
4
+ };
5
+ declare var __VLS_1: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_1) => any;
8
+ };
9
+ declare const __VLS_component: 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>;
10
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
11
+ export default _default;
12
+ type __VLS_WithSlots<T, S> = T & {
13
+ new (): {
14
+ $slots: S;
15
+ };
16
+ };
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <PluginSidebar id="debug" title="Debug" icon="bug" weight="200">
3
+ <div class="bk bk-debug">
4
+ <DebugSection title="Keyboard">
5
+ <SectionKeyboard />
6
+ </DebugSection>
7
+
8
+ <DebugSection title="Selection">
9
+ <SectionSelection />
10
+ </DebugSection>
11
+
12
+ <DebugSection title="Rendering">
13
+ <SectionRendering />
14
+ </DebugSection>
15
+
16
+ <DebugSection title="Logging">
17
+ <SectionLogging :logger />
18
+ </DebugSection>
19
+
20
+ <DebugSection title="Icons">
21
+ <SectionIcons />
22
+ </DebugSection>
23
+
24
+ <DebugSection title="Features">
25
+ <SectionFeatures />
26
+ </DebugSection>
27
+ </div>
28
+ </PluginSidebar>
29
+
30
+ <PluginDebugOverlay id="viewport" title="Show viewport overlay">
31
+ <DebugViewport />
32
+ </PluginDebugOverlay>
33
+
34
+ <PluginDebugOverlay id="rects" title="Show field and block rects">
35
+ <DebugRects />
36
+ </PluginDebugOverlay>
37
+ </template>
38
+
39
+ <script setup>
40
+ import { useBlokkli } from "#imports";
41
+ import { PluginSidebar, PluginDebugOverlay } from "#blokkli/plugins";
42
+ import DebugSection from "./DebugSection.vue";
43
+ import SectionKeyboard from "./Section/Keyboard.vue";
44
+ import SectionSelection from "./Section/Selection.vue";
45
+ import SectionRendering from "./Section/Rendering.vue";
46
+ import SectionLogging from "./Section/Logging.vue";
47
+ import SectionIcons from "./Section/Icons.vue";
48
+ import SectionFeatures from "./Section/Features.vue";
49
+ import DebugViewport from "./Viewport/index.vue";
50
+ import DebugRects from "./Rects/index.vue";
51
+ import defineItemDropdownAction from "#blokkli/helpers/composables/defineItemDropdownAction";
52
+ defineProps({
53
+ logger: { type: Object, required: true }
54
+ });
55
+ const { selection } = useBlokkli();
56
+ async function copyUuid() {
57
+ const uuid = selection.uuids.value.at(0);
58
+ if (!uuid) {
59
+ return;
60
+ }
61
+ const type = "text/plain";
62
+ const clipboardItemData = {
63
+ [type]: uuid
64
+ };
65
+ const clipboardItem = new ClipboardItem(clipboardItemData);
66
+ await navigator.clipboard.write([clipboardItem]);
67
+ }
68
+ defineItemDropdownAction(() => {
69
+ if (selection.uuids.value.length === 1) {
70
+ return {
71
+ id: "debug-copy-uuid",
72
+ label: "Copy UUID",
73
+ icon: "bug",
74
+ group: "debug",
75
+ weight: 200,
76
+ callback: copyUuid
77
+ };
78
+ }
79
+ });
80
+ </script>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <div class="bk-debug-features">
3
+ <div v-for="feature in featuresList" :key="feature.id">
4
+ <div>
5
+ <span
6
+ class="bk-status-indicator"
7
+ :class="feature.mounted ? 'bk-is-success' : 'bk-is-danger'"
8
+ />
9
+ </div>
10
+ <div>
11
+ <h3>{{ feature.label }}</h3>
12
+ <div>{{ feature.id }}</div>
13
+ <p>{{ feature.description }}</p>
14
+ </div>
15
+ </div>
16
+ </div>
17
+ </template>
18
+
19
+ <script setup>
20
+ import { useBlokkli, computed } from "#imports";
21
+ const { features } = useBlokkli();
22
+ const featuresList = computed(() => {
23
+ return features.features.value.map((v) => {
24
+ const feature = features.mountedFeatures.value.find((f) => f.id === v.id);
25
+ return {
26
+ id: v.id,
27
+ label: v.label,
28
+ description: v.description,
29
+ dependencies: v.dependencies?.join(", "),
30
+ mounted: !!feature
31
+ };
32
+ });
33
+ });
34
+ </script>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div class="bk-debug-icons">
3
+ <div v-for="icon in iconItems" :key="icon">
4
+ <Icon :name="icon" />
5
+ <p>{{ icon }}</p>
6
+ </div>
7
+ </div>
8
+ </template>
9
+
10
+ <script setup>
11
+ import { computed } from "#imports";
12
+ import { Icon } from "#blokkli/components";
13
+ import { icons } from "#blokkli-build/icons";
14
+ const iconItems = computed(() => Object.keys(icons));
15
+ </script>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div class="bk-debug-list">
3
+ <div>
4
+ <div>Space</div>
5
+ <div>{{ keyboard.isPressingSpace.value }}</div>
6
+ </div>
7
+ <div>
8
+ <div>Control</div>
9
+ <div>{{ keyboard.isPressingControl.value }}</div>
10
+ </div>
11
+ </div>
12
+ </template>
13
+
14
+ <script setup>
15
+ import { useBlokkli } from "#imports";
16
+ const { keyboard } = useBlokkli();
17
+ </script>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <div>
3
+ <div>
4
+ <FormToggle v-model="logEvents" label="Log Events" />
5
+ </div>
6
+ <div>
7
+ <FormCheckboxes
8
+ id="debug-loggers"
9
+ v-model="debug.enabledLoggers.value"
10
+ label="Enabled Loggers"
11
+ description="If none selected, all will log. Select one or more to filter."
12
+ :options="loggerOptions"
13
+ />
14
+ </div>
15
+ <div>
16
+ <button
17
+ class="bk-button bk-is-small"
18
+ @click.prevent="() => console.log(dom.getDebugData())"
19
+ >
20
+ Log DOM state
21
+ </button>
22
+ </div>
23
+
24
+ <div>
25
+ <button class="bk-button bk-is-small" @click.prevent="getAllMessages">
26
+ Log all messages
27
+ </button>
28
+ </div>
29
+ </div>
30
+ </template>
31
+
32
+ <script setup>
33
+ import { useBlokkli, computed, onMounted, onBeforeUnmount } from "#imports";
34
+ import { FormToggle, FormCheckboxes } from "#blokkli/components";
35
+ const props = defineProps({
36
+ logger: { type: Object, required: true }
37
+ });
38
+ const { debug, dom, storage, eventBus } = useBlokkli();
39
+ const logEvents = storage.use("debug:log-events", true);
40
+ const loggerOptions = computed(() => {
41
+ return debug.registeredLoggers.value.map((name) => ({
42
+ value: name,
43
+ label: name
44
+ })).sort((a, b) => {
45
+ return a.label.localeCompare(b.label);
46
+ });
47
+ });
48
+ const onEvent = (name, data) => {
49
+ if (!logEvents.value) {
50
+ return;
51
+ }
52
+ if (name === "animationFrame" || name === "animationFrame:before" || name === "animationFrame:after" || name === "canvas:draw") {
53
+ return;
54
+ }
55
+ props.logger.log("Event: " + String(name), data);
56
+ };
57
+ onMounted(() => {
58
+ eventBus.on("*", onEvent);
59
+ });
60
+ onBeforeUnmount(() => {
61
+ eventBus.off("*", onEvent);
62
+ });
63
+ function getAllMessages() {
64
+ console.log(debug.getMessages());
65
+ }
66
+ </script>
@@ -1,5 +1,6 @@
1
+ import type { DebugLogger } from '#blokkli/helpers/debugProvider';
1
2
  type __VLS_Props = {
2
- uuids: string[];
3
+ logger: DebugLogger;
3
4
  };
4
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>;
5
6
  export default _default;
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <div class="bk-debug-list">
3
+ <div>
4
+ <div>DPI</div>
5
+ <div>{{ animation.dpi.value }}</div>
6
+ </div>
7
+ </div>
8
+ <div v-for="overlay in debug.overlays.value" :key="overlay.id">
9
+ <FormToggle
10
+ :label="overlay.label"
11
+ :model-value="overlay.active"
12
+ @update:model-value="debug.toggleOverlay(overlay.id)"
13
+ />
14
+ </div>
15
+ <div>
16
+ <FormToggle
17
+ label="Set transforming"
18
+ :model-value="ui.isTransforming.value"
19
+ @update:model-value="toggleTransforming"
20
+ />
21
+ </div>
22
+
23
+ <div>
24
+ <FormRadio
25
+ id="rendering-mode"
26
+ label="Rendering Mode"
27
+ :model-value="animation.preferredRenderingMode.value"
28
+ :options="renderingModeOptions"
29
+ @update:model-value="updateRenderingMode"
30
+ />
31
+ </div>
32
+ <div>
33
+ <button
34
+ class="bk-button bk-is-small"
35
+ @click.prevent="() => dom.updateVisibleRects()"
36
+ >
37
+ Refresh Rects
38
+ </button>
39
+ </div>
40
+ <div v-if="animation.hasWebGLContext.value">
41
+ <button
42
+ class="bk-button bk-is-small"
43
+ :disabled="!animation.isRenderingWebGL.value"
44
+ @click.prevent="loseContext"
45
+ >
46
+ Lose WebGL Context
47
+ </button>
48
+ </div>
49
+ <div v-if="animation.hasWebGLContext.value">
50
+ <button
51
+ class="bk-button bk-is-small"
52
+ :disabled="animation.isRenderingWebGL.value"
53
+ @click.prevent="restoreContext"
54
+ >
55
+ Restore WebGL Context
56
+ </button>
57
+ </div>
58
+ </template>
59
+
60
+ <script setup>
61
+ import { useBlokkli } from "#imports";
62
+ import { FormToggle, FormRadio } from "#blokkli/components";
63
+ const { animation, debug, ui, dom } = useBlokkli();
64
+ const renderingModeOptions = [
65
+ { value: "auto", label: "Auto" },
66
+ { value: "webgl", label: "WebGL" },
67
+ { value: "2d", label: "2D Canvas" }
68
+ ];
69
+ let webglLoseContextExt = null;
70
+ function toggleTransforming() {
71
+ if (ui.isTransforming.value) {
72
+ ui.setTransform();
73
+ } else {
74
+ ui.setTransform("Transform plugin label");
75
+ }
76
+ }
77
+ function updateRenderingMode(value) {
78
+ if (value === "auto" || value === "webgl" || value === "2d") {
79
+ animation.preferredRenderingMode.value = value;
80
+ }
81
+ }
82
+ function loseContext() {
83
+ const gl = animation.getRawGL();
84
+ if (gl) {
85
+ webglLoseContextExt = gl.getExtension("WEBGL_lose_context");
86
+ if (webglLoseContextExt) {
87
+ webglLoseContextExt.loseContext();
88
+ }
89
+ }
90
+ }
91
+ function restoreContext() {
92
+ if (webglLoseContextExt) {
93
+ webglLoseContextExt.restoreContext();
94
+ }
95
+ }
96
+ </script>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <div class="bk-debug-list">
3
+ <div>
4
+ <div>Count</div>
5
+ <div>{{ selection.uuids.value.length }}</div>
6
+ </div>
7
+ <div>
8
+ <div>isDragging</div>
9
+ <div>{{ selection.isDragging.value }}</div>
10
+ </div>
11
+ <div>
12
+ <div>isDraggingExisting</div>
13
+ <div>{{ selection.isDraggingExisting.value }}</div>
14
+ </div>
15
+ <div>
16
+ <div>Is multiselecting</div>
17
+ <div>{{ selection.isMultiSelecting.value }}</div>
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script setup>
23
+ import { useBlokkli } from "#imports";
24
+ const { selection } = useBlokkli();
25
+ </script>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -1,11 +1,11 @@
1
1
  <template>
2
- <Renderer v-if="debug.isEnabled.value" :logger />
2
+ <DebugMain v-if="debug.isEnabled.value" :logger />
3
3
  </template>
4
4
 
5
5
  <script setup>
6
6
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
7
7
  import { defineBlokkliFeature, useBlokkli } from "#imports";
8
- import Renderer from "./Renderer.vue";
8
+ import DebugMain from "./Main.vue";
9
9
  const { logger } = defineBlokkliFeature({
10
10
  id: "debug",
11
11
  label: "Debug",
@@ -2,18 +2,20 @@
2
2
  <div
3
3
  class="bk-vars bk-dragging-overlay"
4
4
  :style="style"
5
- :class="[{ 'bk-is-touch': isTouch }, { 'bk-is-active': !!activeLabel }]"
5
+ :class="[
6
+ { 'bk-is-touch': isTouch },
7
+ { 'bk-is-active': !!activeLabel },
8
+ { bk: !isExisting }
9
+ ]"
6
10
  >
7
- <BlokkliTransition name="drag-item">
8
- <div
9
- v-show="activeLabel"
10
- class="bk bk-dragging-overlay-label"
11
- :style="{ backgroundColor: currentActiveColor }"
12
- >
13
- <Icon name="cursor-move" />
14
- <p v-html="currentActiveLabel" />
15
- </div>
16
- </BlokkliTransition>
11
+ <div
12
+ v-show="activeLabel"
13
+ class="bk bk-dragging-overlay-label"
14
+ :style="{ backgroundColor: currentActiveColor }"
15
+ >
16
+ <Icon name="cursor-move" />
17
+ <p v-html="currentActiveLabel" />
18
+ </div>
17
19
  <div
18
20
  v-for="(rect, i) in rects"
19
21
  :key="i"
@@ -66,17 +68,10 @@ import {
66
68
  lerp,
67
69
  falsy
68
70
  } from "#blokkli/helpers";
69
- import { Icon, ItemIcon, BlokkliTransition } from "#blokkli/components";
71
+ import { Icon, ItemIcon } from "#blokkli/components";
70
72
  import { easeOutElastic } from "#blokkli/helpers/easing";
71
73
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
72
- const {
73
- dom,
74
- ui,
75
- animation,
76
- theme,
77
- types,
78
- element: elementProvider
79
- } = useBlokkli();
74
+ const { dom, ui, animation, theme, types } = useBlokkli();
80
75
  const props = defineProps({
81
76
  items: { type: Array, required: true },
82
77
  x: { type: Number, required: true },
@@ -86,6 +81,9 @@ const props = defineProps({
86
81
  activeColor: { type: String, required: false },
87
82
  activeLabel: { type: String, required: false }
88
83
  });
84
+ const isExisting = computed(
85
+ () => !!props.items.find((v) => v.itemType === "existing")
86
+ );
89
87
  const currentActiveLabel = ref("");
90
88
  const currentActiveColor = ref("");
91
89
  watch(
@@ -204,15 +202,10 @@ function getDraggingBounds(mouse, rect, maxWidth) {
204
202
  }
205
203
  onMounted(() => {
206
204
  const elRects = props.items.map((item, index) => {
207
- const itemElement = item.itemType === "existing" ? dom.getDragElement(item) : item.element();
208
- if (!itemElement) {
205
+ const element = item.itemType === "existing" ? dom.getDragElement(item) : item.element();
206
+ if (!element) {
209
207
  return;
210
208
  }
211
- const element = elementProvider.query(
212
- itemElement,
213
- ".bk-drop-element",
214
- "Find drop element for drag item."
215
- ) || itemElement;
216
209
  return {
217
210
  rect: element.getBoundingClientRect(),
218
211
  element,
@@ -0,0 +1,80 @@
1
+ #version 300 es
2
+
3
+ precision highp float;
4
+
5
+ in float v_intersecting;
6
+ in float v_is_hover_area;
7
+ in vec4 v_quad;
8
+ in vec3 v_color;
9
+
10
+ // Optimized varyings - values computed once per vertex instead of per pixel
11
+ in vec2 v_size;
12
+ in vec2 v_location;
13
+ in vec2 v_size_inner;
14
+ in float v_thickness;
15
+ in float v_edge_softness;
16
+ in float v_radius_outer;
17
+ in float v_radius_inner;
18
+
19
+ out vec4 fragColor;
20
+
21
+ uniform float u_scale;
22
+ uniform float u_dpi;
23
+ uniform vec2 u_resolution;
24
+ uniform float u_active_hover_nesting_level;
25
+
26
+ float roundedBoxSDF(vec2 CenterPosition, vec2 Size, float Radius) {
27
+ return length(max(abs(CenterPosition) - Size + Radius, 0.0)) - Radius;
28
+ }
29
+
30
+ void main() {
31
+ bool isHoverArea = v_is_hover_area >= 1.0;
32
+
33
+ // Compute different distance for inside and outside using pre-computed values
34
+ float distanceOuter = roundedBoxSDF(
35
+ v_location - gl_FragCoord.xy,
36
+ v_size / 2.0,
37
+ v_radius_outer
38
+ );
39
+ float distanceInner = roundedBoxSDF(
40
+ v_location - gl_FragCoord.xy,
41
+ v_size_inner / 2.0,
42
+ v_radius_inner
43
+ );
44
+
45
+ float alphaOuter =
46
+ 1.0 -
47
+ smoothstep(-v_edge_softness, v_edge_softness, distanceOuter - v_thickness);
48
+ float alphaInner =
49
+ 1.0 -
50
+ smoothstep(-v_edge_softness, v_edge_softness, distanceInner - v_thickness);
51
+
52
+ // Alpha value for the border.
53
+ float alphaBorder = clamp(alphaOuter - alphaInner, 0.0, 1.0);
54
+
55
+ // Adjust alphas based on intersection.
56
+ float adjustedAlphaFill =
57
+ v_intersecting >= 0.5
58
+ ? alphaInner * 0.95
59
+ : alphaInner * 0.2;
60
+
61
+ if (v_is_hover_area >= 1.0) {
62
+ // If nesting level is 0, don't render the fill (border only)
63
+ if (u_active_hover_nesting_level < 0.5) {
64
+ adjustedAlphaFill = 0.0;
65
+ } else {
66
+ adjustedAlphaFill *= 0.5;
67
+ }
68
+ }
69
+
70
+ if (alphaBorder > 0.0) {
71
+ float a = isHoverArea ? 0.6 : 1.0;
72
+ fragColor = vec4(v_color, a);
73
+ return;
74
+ } else if (adjustedAlphaFill > 0.0) {
75
+ fragColor = vec4(v_color, adjustedAlphaFill);
76
+ return;
77
+ }
78
+
79
+ discard;
80
+ }