@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
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <ViewportBlockingRect
3
3
  :id="storageKey"
4
- ref="el"
5
- class="bk-sidebar-detached"
4
+ ref="root"
5
+ class="bk-sidebar-detached bk-sidebar-inner"
6
6
  :class="{ 'bk-is-focused': focusedSidebar === id }"
7
7
  :style="style"
8
8
  tabindex="10"
@@ -26,10 +26,10 @@
26
26
  <Icon :name="isMinimized ? 'window-maximize' : 'window-minimize'" />
27
27
  </button>
28
28
  <button
29
- @click.prevent.stop.capture="$emit('close')"
29
+ @click.prevent.stop.capture="$emit('attach')"
30
30
  @mousedown.capture.stop
31
31
  >
32
- <Icon name="close" />
32
+ <Icon :name="region === 'left' ? 'dock-left' : 'dock-right'" />
33
33
  </button>
34
34
  </div>
35
35
  </div>
@@ -65,7 +65,8 @@ import {
65
65
  onBeforeUnmount,
66
66
  computed,
67
67
  watch,
68
- useState
68
+ useState,
69
+ useTemplateRef
69
70
  } from "#imports";
70
71
  import { Icon, ViewportBlockingRect, ScrollBoundary } from "#blokkli/components";
71
72
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
@@ -76,10 +77,15 @@ const props = defineProps({
76
77
  icon: { type: null, required: true },
77
78
  minWidth: { type: Number, required: false, default: 300 },
78
79
  minHeight: { type: Number, required: false, default: 300 },
79
- size: { type: Object, required: false, default: void 0 },
80
- isLeft: { type: Boolean, required: false }
80
+ region: { type: String, required: true },
81
+ size: { type: Object, required: false, default: void 0 }
81
82
  });
82
- defineEmits(["close"]);
83
+ defineEmits(["attach"]);
84
+ const root = useTemplateRef("root");
85
+ function getRootElement() {
86
+ return root.value?.getRootElement() ?? null;
87
+ }
88
+ const isLeft = computed(() => props.region === "left");
83
89
  const { storage, ui, keyboard, selection } = useBlokkli();
84
90
  function onPointerMove(e) {
85
91
  if (keyboard.isPressingSpace.value || selection.isDragging.value) {
@@ -109,7 +115,7 @@ const offsetX = computed(() => {
109
115
  return 0;
110
116
  });
111
117
  const storedData = storage.use(storageKey, {
112
- x: props.isLeft ? 0 : window.innerWidth - 360,
118
+ x: isLeft.value ? 0 : window.innerWidth - 360,
113
119
  y: 50,
114
120
  width: 360,
115
121
  height: 520,
@@ -205,10 +211,8 @@ const setCoordinates = (newX, newY) => {
205
211
  };
206
212
  const setSizes = (newWidth, newHeight) => {
207
213
  if (newWidth !== void 0) {
208
- userWidth.value = Math.min(
209
- Math.max(newWidth, props.minWidth),
210
- window.innerWidth - 300
211
- );
214
+ const maxWidth = ui.visibleViewport.value.x + ui.visibleViewport.value.width - x.value;
215
+ userWidth.value = Math.min(Math.max(newWidth, props.minWidth), maxWidth);
212
216
  }
213
217
  if (newHeight !== void 0) {
214
218
  userHeight.value = Math.min(
@@ -241,7 +245,6 @@ const onMouseUp = () => {
241
245
  window.removeEventListener("pointerup", onMouseUp, { capture: true });
242
246
  updateStored();
243
247
  };
244
- const el = ref(null);
245
248
  const recalculatePositions = () => {
246
249
  const storedViewportWidth = storedData.value.viewportWidth || window.innerWidth;
247
250
  const storedViewportHeight = storedData.value.viewportHeight || window.innerHeight;
@@ -267,4 +270,7 @@ onBeforeUnmount(() => {
267
270
  window.removeEventListener("pointermove", onMouseMove, { capture: true });
268
271
  window.removeEventListener("pointerup", onMouseUp, { capture: true });
269
272
  });
273
+ defineExpose({
274
+ getRootElement
275
+ });
270
276
  </script>
@@ -1,16 +1,18 @@
1
1
  import type { BlokkliIcon } from '#blokkli-build/icons';
2
+ import type { SidebarRegion } from '#blokkli/types';
2
3
  type __VLS_Props = {
3
4
  id: string;
4
5
  title: string;
5
6
  icon: BlokkliIcon;
6
7
  minWidth?: number;
7
8
  minHeight?: number;
9
+ region: SidebarRegion;
8
10
  size?: {
9
11
  width: number;
10
12
  height: number;
11
13
  };
12
- isLeft?: boolean;
13
14
  };
15
+ declare function getRootElement(): HTMLElement | null;
14
16
  declare var __VLS_16: {}, __VLS_30: {
15
17
  width: number;
16
18
  height: number;
@@ -21,10 +23,12 @@ type __VLS_Slots = {} & {
21
23
  } & {
22
24
  default?: (props: typeof __VLS_30) => any;
23
25
  };
24
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
- close: (...args: any[]) => void;
26
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
27
+ getRootElement: typeof getRootElement;
28
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
29
+ attach: () => any;
26
30
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
27
- onClose?: ((...args: any[]) => any) | undefined;
31
+ onAttach?: (() => any) | undefined;
28
32
  }>, {
29
33
  size: {
30
34
  width: number;
@@ -4,7 +4,10 @@
4
4
  :id="'bk-sidebar-button-' + id"
5
5
  ref="tourElement"
6
6
  class="bk-toolbar-button"
7
- :class="[{ 'is-active': activeSidebar === id }, 'bk-is-' + region]"
7
+ :class="[
8
+ { 'bk-is-active': activeSidebar === id && !isDisabled },
9
+ 'bk-is-' + region
10
+ ]"
8
11
  :disabled="isDisabled"
9
12
  :style="{ order: weight }"
10
13
  @click.prevent.stop="toggleSidebar"
@@ -17,9 +20,9 @@
17
20
  <span>{{ title }}</span>
18
21
  <ShortcutIndicator
19
22
  v-if="keyCode"
20
- :meta="meta"
21
- :shift="shift"
22
- :key-code="keyCode"
23
+ :meta
24
+ :shift
25
+ :key-code
23
26
  :label="title"
24
27
  @pressed="toggleSidebar"
25
28
  />
@@ -35,16 +38,15 @@
35
38
  >
36
39
  <SidebarDetached
37
40
  v-if="isRenderedDetached"
38
- :id="id"
39
- ref="tourElement"
40
- :title="title"
41
- :icon="icon"
42
- :min-width="minWidth"
43
- :min-height="minHeight"
44
- :size="size"
45
- :is-left="region === 'left'"
46
- class="bk-sidebar-inner"
47
- @close="onAttach"
41
+ :id
42
+ ref="sidebarDetached"
43
+ :title
44
+ :icon
45
+ :min-width
46
+ :min-height
47
+ :size
48
+ :region
49
+ @attach="onAttachDetached"
48
50
  >
49
51
  <template #icon>
50
52
  <slot name="icon" />
@@ -54,12 +56,12 @@
54
56
  <div ref="sidebarContent" class="bk-sidebar-content">
55
57
  <slot
56
58
  :key="isRenderedDetached ? 'detached' : 'attached'"
57
- :scrolled-to-end="scrolledToEnd"
59
+ :scrolled-to-end
58
60
  :is-detached="isRenderedDetached"
59
- :width="width"
60
- :height="height"
61
- :toggle-sidebar="toggleSidebar"
62
- :is-resizing="isResizing"
61
+ :width
62
+ :height
63
+ :toggle-sidebar
64
+ :is-resizing
63
65
  />
64
66
  </div>
65
67
  </div>
@@ -75,7 +77,7 @@
75
77
  <span>{{ title }}</span>
76
78
  <div v-if="beta" class="bk-beta-indicator">BETA</div>
77
79
  <button v-if="!ui.isMobile.value" @click.prevent.stop="onDetach">
78
- <Icon name="expand" />
80
+ <Icon name="dock-window" />
79
81
  </button>
80
82
  <button @click.prevent.stop="toggleSidebar">
81
83
  <Icon name="close" />
@@ -100,7 +102,14 @@
100
102
  </template>
101
103
 
102
104
  <script setup>
103
- import { computed, watch, ref, useBlokkli } from "#imports";
105
+ import {
106
+ computed,
107
+ watch,
108
+ ref,
109
+ useBlokkli,
110
+ onBeforeUnmount,
111
+ useTemplateRef
112
+ } from "#imports";
104
113
  import { Icon, ShortcutIndicator, ScrollBoundary } from "#blokkli/components";
105
114
  import SidebarDetached from "./Detached/index.vue";
106
115
  import defineCommands from "#blokkli/helpers/composables/defineCommands";
@@ -127,14 +136,31 @@ const props = defineProps({
127
136
  });
128
137
  const emit = defineEmits(["updated"]);
129
138
  const { storage, state, ui, $t } = useBlokkli();
130
- const tourElement = ref(null);
139
+ const tourElement = useTemplateRef("tourElement");
140
+ const sidebarDetached = useTemplateRef("sidebarDetached");
131
141
  const detachedKey = computed(() => "sidebar:detached:" + props.id);
132
142
  const storageKey = computed(() => "sidebar:active:" + props.region);
133
143
  const isDetached = storage.use(detachedKey, false, true);
134
144
  const isDisabled = computed(
135
- () => props.editOnly && state.editMode.value !== "editing" && !props.disabled
145
+ () => props.editOnly && state.editMode.value !== "editing" || props.disabled
136
146
  );
137
147
  const activeSidebar = storage.use(storageKey, "", true);
148
+ const isRendered = computed(
149
+ () => activeSidebar.value === props.id && !isDisabled.value
150
+ );
151
+ watch(
152
+ isRendered,
153
+ (isRendered2) => {
154
+ if (isRendered2) {
155
+ ui.setActiveSidebar(props.region, props.id);
156
+ } else {
157
+ ui.removeActiveSidebar(props.region, props.id);
158
+ }
159
+ },
160
+ {
161
+ immediate: true
162
+ }
163
+ );
138
164
  const isRenderedDetached = computed(
139
165
  () => isDetached.value && !ui.isMobile.value
140
166
  );
@@ -148,8 +174,9 @@ const onDetach = () => {
148
174
  activeSidebar.value = "";
149
175
  emit("updated");
150
176
  };
151
- const onAttach = () => {
177
+ const onAttachDetached = () => {
152
178
  isDetached.value = false;
179
+ activeSidebar.value = props.id;
153
180
  emit("updated");
154
181
  };
155
182
  const toggleSidebar = () => {
@@ -220,9 +247,12 @@ defineTourItem(() => {
220
247
  id: "plugin:sidebar:" + props.id,
221
248
  title: props.title,
222
249
  text: props.tourText,
223
- element: () => tourElement.value
250
+ element: () => tourElement.value ?? sidebarDetached.value?.getRootElement()
224
251
  };
225
252
  });
253
+ onBeforeUnmount(() => {
254
+ ui.removeActiveSidebar(props.region, props.id);
255
+ });
226
256
  </script>
227
257
 
228
258
  <script>
@@ -1,4 +1,5 @@
1
1
  import type { BlokkliIcon } from '#blokkli-build/icons';
2
+ import type { SidebarRegion } from '#blokkli/types';
2
3
  declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
3
4
  id: string;
4
5
  title: string;
@@ -8,7 +9,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
8
9
  weight?: string | number;
9
10
  renderAlways?: boolean;
10
11
  disabled?: boolean;
11
- region?: "left" | "right";
12
+ region?: SidebarRegion;
12
13
  minWidth?: number;
13
14
  minHeight?: number;
14
15
  size?: {
@@ -32,7 +33,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
32
33
  weight?: string | number;
33
34
  renderAlways?: boolean;
34
35
  disabled?: boolean;
35
- region?: "left" | "right";
36
+ region?: SidebarRegion;
36
37
  minWidth?: number;
37
38
  minHeight?: number;
38
39
  size?: {
@@ -55,7 +56,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
55
56
  tourText: string;
56
57
  minWidth: number;
57
58
  minHeight: number;
58
- region: "left" | "right";
59
+ region: SidebarRegion;
59
60
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
60
61
  icon?: (props: {}) => any;
61
62
  } & {
@@ -29,7 +29,7 @@
29
29
 
30
30
  <script setup>
31
31
  import { ShortcutIndicator, Icon } from "#blokkli/components";
32
- import { ref } from "#imports";
32
+ import { ref, useBlokkli } from "#imports";
33
33
  import defineCommands from "#blokkli/helpers/composables/defineCommands";
34
34
  import defineTourItem from "#blokkli/helpers/composables/defineTourItem";
35
35
  const props = defineProps({
@@ -47,12 +47,15 @@ const props = defineProps({
47
47
  tourText: { type: String, required: false },
48
48
  weight: { type: [Number, String], required: false }
49
49
  });
50
+ const { debug } = useBlokkli();
51
+ const logger = debug.createLogger("PluginToolbar");
50
52
  const emit = defineEmits(["click"]);
51
53
  const el = ref(null);
52
54
  function onClick() {
53
55
  if (props.disabled) {
54
56
  return;
55
57
  }
58
+ logger.log(`Click ${props.id}`);
56
59
  emit("click");
57
60
  }
58
61
  defineCommands(() => {
@@ -34,7 +34,7 @@ import { useBlokkli, computed, ref, watch } from "#imports";
34
34
  import { ShortcutIndicator, Icon } from "#blokkli/components";
35
35
  import defineCommands from "#blokkli/helpers/composables/defineCommands";
36
36
  import defineTourItem from "#blokkli/helpers/composables/defineTourItem";
37
- const { storage, ui, eventBus } = useBlokkli();
37
+ const { storage, ui, eventBus, debug } = useBlokkli();
38
38
  const props = defineProps({
39
39
  id: { type: String, required: true },
40
40
  label: { type: String, required: true },
@@ -48,6 +48,7 @@ const props = defineProps({
48
48
  weight: { type: [Number, String], required: false }
49
49
  });
50
50
  const emit = defineEmits(["update:modelValue"]);
51
+ const logger = debug.createLogger("PluginViewOption");
51
52
  const storageKey = "view_option_" + props.id;
52
53
  const button = ref(null);
53
54
  const isActiveStorage = storage.use(storageKey, false, true);
@@ -67,6 +68,7 @@ emit("update:modelValue", isActiveStorage.value);
67
68
  const title = computed(() => isActive.value ? props.titleOff : props.titleOn);
68
69
  const onClick = () => {
69
70
  isActive.value = !isActive.value;
71
+ logger.log("Toggle " + props.id, isActive.value);
70
72
  };
71
73
  defineCommands(() => {
72
74
  return {
@@ -2,12 +2,10 @@ import PluginAddAction from './AddAction/index.vue.js';
2
2
  import PluginBlockIndicator from './BlockIndicator/index.vue.js';
3
3
  import PluginContextMenu from './ContextMenu/index.vue.js';
4
4
  import PluginDebugOverlay from './DebugOverlay/index.vue.js';
5
- import PluginDroppableEdit from './DroppableEdit/index.vue.js';
6
5
  import PluginItemAction from './ItemAction/index.vue.js';
7
- import PluginItemDropdown from './ItemDropdown/index.vue.js';
8
6
  import PluginMenuButton from './MenuButton/index.vue.js';
9
7
  import PluginSidebar from './Sidebar/index.vue.js';
10
8
  import PluginToolbarButton from './ToolbarButton/index.vue.js';
11
9
  import PluginTourItem from './TourItem/index.vue.js';
12
10
  import PluginViewOption from './ViewOption/index.vue.js';
13
- export { PluginAddAction, PluginBlockIndicator, PluginContextMenu, PluginDebugOverlay, PluginDroppableEdit, PluginItemAction, PluginItemDropdown, PluginMenuButton, PluginSidebar, PluginToolbarButton, PluginTourItem, PluginViewOption, };
11
+ export { PluginAddAction, PluginBlockIndicator, PluginContextMenu, PluginDebugOverlay, PluginItemAction, PluginMenuButton, PluginSidebar, PluginToolbarButton, PluginTourItem, PluginViewOption, };
@@ -2,9 +2,7 @@ import PluginAddAction from "./AddAction/index.vue";
2
2
  import PluginBlockIndicator from "./BlockIndicator/index.vue";
3
3
  import PluginContextMenu from "./ContextMenu/index.vue";
4
4
  import PluginDebugOverlay from "./DebugOverlay/index.vue";
5
- import PluginDroppableEdit from "./DroppableEdit/index.vue";
6
5
  import PluginItemAction from "./ItemAction/index.vue";
7
- import PluginItemDropdown from "./ItemDropdown/index.vue";
8
6
  import PluginMenuButton from "./MenuButton/index.vue";
9
7
  import PluginSidebar from "./Sidebar/index.vue";
10
8
  import PluginToolbarButton from "./ToolbarButton/index.vue";
@@ -15,9 +13,7 @@ export {
15
13
  PluginBlockIndicator,
16
14
  PluginContextMenu,
17
15
  PluginDebugOverlay,
18
- PluginDroppableEdit,
19
16
  PluginItemAction,
20
- PluginItemDropdown,
21
17
  PluginMenuButton,
22
18
  PluginSidebar,
23
19
  PluginToolbarButton,
@@ -4,11 +4,6 @@
4
4
  :key="item.uuid"
5
5
  v-bind="item"
6
6
  :index
7
- :data-reusable-bundle="item.bundle"
8
- :data-reusable-uuid="item.uuid"
9
- :data-bk-library-label="libraryItem?.label"
10
- :data-bk-library-item-uuid="libraryItem?.uuid"
11
- data-blokkli-is-reusable="true"
12
7
  :parent-type
13
8
  :is-editing
14
9
  />
@@ -36,6 +36,9 @@ const isInReusable = inject(INJECT_IS_IN_REUSABLE, false);
36
36
  if (!entity) {
37
37
  throw new Error("Missing entity context.");
38
38
  }
39
+ function getValueCallback() {
40
+ return props.value;
41
+ }
39
42
  const renderedValue = computed(() => valueOverride.value || props.value || "");
40
43
  const onEditableUpdateValue = (e) => {
41
44
  if (e.name === props.name && e.entityUuid === entity.uuid) {
@@ -52,7 +55,9 @@ onMounted(() => {
52
55
  root.value,
53
56
  props.name,
54
57
  entity,
55
- "editable"
58
+ "editable",
59
+ true,
60
+ getValueCallback
56
61
  );
57
62
  }
58
63
  });
@@ -42,7 +42,7 @@
42
42
  :key="item.uuid + fieldListType"
43
43
  v-bind="item"
44
44
  :parent-type="isNested ? entity?.bundle : ''"
45
- :data-uuid="isPreview ? item.uuid : void 0"
45
+ :data-bk-uuid="isPreview ? item.uuid : void 0"
46
46
  :index="i"
47
47
  />
48
48
  </component>
@@ -6,7 +6,7 @@
6
6
  :data-provider-entity-bundle="entityBundle"
7
7
  :data-blokkli-provider-active="isInEditor ? 'true' : 'false'"
8
8
  >
9
- <BlokkliErrorBoundary v-if="isInEditor">
9
+ <BlokkliRootErrorBoundary v-if="isInEditor">
10
10
  <PreviewProvider
11
11
  v-if="isPreviewing"
12
12
  v-slot="{ mutatedEntity }"
@@ -42,7 +42,7 @@
42
42
  :entity="mutatedEntity"
43
43
  />
44
44
  </EditProvider>
45
- </BlokkliErrorBoundary>
45
+ </BlokkliRootErrorBoundary>
46
46
 
47
47
  <slot
48
48
  v-else
@@ -101,8 +101,8 @@ const PreviewProvider = defineAsyncComponent(
101
101
  const EditProvider = defineAsyncComponent(
102
102
  () => import("./Edit/EditProvider.vue")
103
103
  );
104
- const BlokkliErrorBoundary = defineAsyncComponent(
105
- () => import("./Edit/BlokkliErrorBoundary.vue")
104
+ const BlokkliRootErrorBoundary = defineAsyncComponent(
105
+ () => import("./Edit/BlokkliRootErrorBoundary.vue")
106
106
  );
107
107
  const EditIndicator = defineAsyncComponent(
108
108
  () => import("./Edit/EditIndicator.vue")
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <div
3
+ id="bk-blokkli-item-actions-dropdown"
4
+ class="bk-blokkli-item-actions-type-dropdown"
5
+ >
6
+ <div v-for="group in groups" :key="group.name">
7
+ <ol>
8
+ <li v-for="action in group.actions" :key="action.id">
9
+ <button
10
+ class="bk-blokkli-item-actions-type-dropdown-button"
11
+ :disabled="action.enabled === false"
12
+ @click.prevent="onActionClick(action)"
13
+ >
14
+ <div class="bk-blokkli-item-actions-type-dropdown-icon">
15
+ <Icon v-if="action.icon" :name="action.icon" />
16
+ <ItemIcon v-else-if="action.bundle" :bundle="action.bundle" />
17
+ </div>
18
+ <div>
19
+ <div>{{ action.label }}</div>
20
+ </div>
21
+ <div v-if="action.description" class="bk-tooltip">
22
+ {{ action.description }}
23
+ </div>
24
+ </button>
25
+ </li>
26
+ </ol>
27
+ </div>
28
+ </div>
29
+ </template>
30
+
31
+ <script setup>
32
+ import { useBlokkli } from "#imports";
33
+ import { ItemIcon, Icon } from "#blokkli/components";
34
+ const emit = defineEmits(["close"]);
35
+ const { plugins } = useBlokkli();
36
+ function getGroupedActions() {
37
+ const actions = plugins.getItemDropdownActions();
38
+ const groups2 = /* @__PURE__ */ new Map();
39
+ for (const action of actions) {
40
+ const groupName = action.group;
41
+ if (!groups2.has(groupName)) {
42
+ groups2.set(groupName, {
43
+ name: groupName,
44
+ weight: action.weight ?? 100,
45
+ actions: []
46
+ });
47
+ }
48
+ groups2.get(groupName).actions.push(action);
49
+ }
50
+ return Array.from(groups2.values()).sort((a, b) => a.weight - b.weight);
51
+ }
52
+ const groups = getGroupedActions();
53
+ function onActionClick(action) {
54
+ if (action.enabled === false) {
55
+ return;
56
+ }
57
+ action.callback();
58
+ emit("close");
59
+ }
60
+ </script>
61
+
62
+ <script>
63
+ export default {
64
+ name: "EditActionsItemDropdown"
65
+ };
66
+ </script>
@@ -0,0 +1,6 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
+ close: () => any;
3
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
4
+ onClose?: (() => any) | undefined;
5
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ export default _default;
@@ -19,6 +19,7 @@
19
19
  <div id="bk-blokkli-item-actions-title">
20
20
  <button
21
21
  class="bk-blokkli-item-actions-type-button"
22
+ tabindex="-1"
22
23
  :disabled="!shouldRenderButton"
23
24
  :class="{
24
25
  'is-open': showDropdown,
@@ -60,10 +61,9 @@
60
61
  >
61
62
  <Icon v-if="shouldRenderButton" name="caret" class="bk-caret" />
62
63
  </button>
63
- <div
64
- v-show="showDropdown && editingEnabled"
65
- id="bk-blokkli-item-actions-dropdown"
66
- class="bk-blokkli-item-actions-type-dropdown"
64
+ <EditActionsItemDropdown
65
+ v-if="showDropdown && editingEnabled"
66
+ @close="showDropdown = false"
67
67
  />
68
68
  </div>
69
69
 
@@ -79,36 +79,26 @@
79
79
  </template>
80
80
 
81
81
  <script setup>
82
- import {
83
- watch,
84
- ref,
85
- computed,
86
- useBlokkli,
87
- onMounted,
88
- onBeforeUnmount,
89
- useTemplateRef
90
- } from "#imports";
82
+ import { watch, ref, computed, useBlokkli, useTemplateRef } from "#imports";
91
83
  import { falsy } from "#blokkli/helpers";
92
84
  import { ItemIcon, Icon } from "#blokkli/components";
93
85
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
94
86
  import useStickyToolbar from "#blokkli/helpers/composables/useStickyToolbar";
87
+ import EditActionsItemDropdown from "./ItemDropdown.vue";
95
88
  const { selection, $t, types, state, ui, definitions, debug } = useBlokkli();
96
89
  const editingEnabled = computed(
97
90
  () => state.editMode.value === "editing" || state.editMode.value === "translating"
98
91
  );
99
92
  const ACTIONS_HEIGHT = 52;
100
- let scrollWidth = 0;
101
93
  const el = useTemplateRef("el");
102
94
  const { shouldRender } = useStickyToolbar(el, {
103
95
  getPlacementY: () => "top",
104
96
  shouldUpdate: () => !selection.isChangingOptions.value,
105
97
  getHeight: () => ACTIONS_HEIGHT,
106
- getWidth: () => scrollWidth,
107
98
  getMargin: () => 20,
108
99
  allowHorizontalOverflow: true
109
100
  });
110
101
  const controlsEl = ref(null);
111
- const mountedPlugins = ref([]);
112
102
  const showDropdown = ref(false);
113
103
  const hasAnythingSelected = computed(
114
104
  () => selection.hasHostSelected.value || !!selection.items.value.length
@@ -182,39 +172,7 @@ const itemBundle = computed(() => {
182
172
  const bundle = selection.bundles.value[0];
183
173
  return types.getBlockBundleDefinition(bundle);
184
174
  });
185
- const observer = new ResizeObserver((entries) => {
186
- const size = entries[0]?.contentBoxSize?.[0];
187
- if (!size) {
188
- return;
189
- }
190
- scrollWidth = size.inlineSize;
191
- });
192
- onMounted(() => {
193
- if (controlsEl.value) {
194
- observer.observe(controlsEl.value);
195
- }
196
- });
197
- onBeforeUnmount(() => {
198
- if (controlsEl.value) {
199
- observer.unobserve(controlsEl.value);
200
- observer.disconnect();
201
- }
202
- });
203
- const shouldRenderButton = computed(
204
- () => mountedPlugins.value.some((v) => v.isRendering)
205
- );
206
- onBlokkliEvent("plugin:mount", (e) => {
207
- if (e.type !== "ItemDropdown") {
208
- return;
209
- }
210
- mountedPlugins.value.push(e);
211
- });
212
- onBlokkliEvent("plugin:unmount", (e) => {
213
- if (e.type !== "ItemDropdown") {
214
- return;
215
- }
216
- mountedPlugins.value = mountedPlugins.value.filter((v) => v.type !== e.id);
217
- });
175
+ const shouldRenderButton = computed(() => true);
218
176
  onBlokkliEvent("action:selected", () => {
219
177
  showDropdown.value = false;
220
178
  });