@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
@@ -136,8 +136,38 @@ export default function(providerElement, storage, state, context, element) {
136
136
  }
137
137
  return 50;
138
138
  });
139
- const activeSidebarLeft = storage.use("sidebar:active:left", "");
140
- const activeSidebarRight = storage.use("sidebar:active:right", "");
139
+ const activeSidebarsLeft = ref([]);
140
+ const activeSidebarsRight = ref([]);
141
+ function setActiveSidebar(region, id) {
142
+ if (region === "left") {
143
+ if (activeSidebarsLeft.value.includes(id)) {
144
+ return;
145
+ }
146
+ activeSidebarsLeft.value.push(id);
147
+ } else {
148
+ if (activeSidebarsRight.value.includes(id)) {
149
+ return;
150
+ }
151
+ activeSidebarsRight.value.push(id);
152
+ }
153
+ }
154
+ function removeActiveSidebar(region, id) {
155
+ if (region === "left") {
156
+ activeSidebarsLeft.value = activeSidebarsLeft.value.filter(
157
+ (v) => v !== id
158
+ );
159
+ } else {
160
+ activeSidebarsRight.value = activeSidebarsRight.value.filter(
161
+ (v) => v !== id
162
+ );
163
+ }
164
+ }
165
+ const hasSidebarLeft = computed(() => {
166
+ return !!activeSidebarsLeft.value.length;
167
+ });
168
+ const hasSidebarRight = computed(() => {
169
+ return !!activeSidebarsRight.value.length;
170
+ });
141
171
  const settingsStorage = storage.use("feature:add-list:settings", {
142
172
  orientation: "vertical"
143
173
  });
@@ -150,7 +180,7 @@ export default function(providerElement, storage, state, context, element) {
150
180
  if (addListOrientation.value === "vertical" && state.editMode.value === "editing") {
151
181
  x += 70;
152
182
  }
153
- if (activeSidebarLeft.value) {
183
+ if (hasSidebarLeft.value) {
154
184
  x += 400;
155
185
  }
156
186
  }
@@ -164,7 +194,7 @@ export default function(providerElement, storage, state, context, element) {
164
194
  return viewportWidth.value;
165
195
  }
166
196
  let width = viewportWidth.value - visibleViewportX.value - 50;
167
- if (activeSidebarRight.value) {
197
+ if (hasSidebarRight.value) {
168
198
  width -= 351;
169
199
  }
170
200
  return width;
@@ -262,12 +292,12 @@ export default function(providerElement, storage, state, context, element) {
262
292
  addElementClasses(
263
293
  document.documentElement,
264
294
  "bk-has-sidebar-left",
265
- activeSidebarLeft
295
+ hasSidebarLeft
266
296
  );
267
297
  addElementClasses(
268
298
  document.documentElement,
269
299
  "bk-has-sidebar-right",
270
- activeSidebarRight
300
+ hasSidebarRight
271
301
  );
272
302
  addElementClasses(document.documentElement, ["bk-html-root"]);
273
303
  addElementClasses(document.body, "bk-body");
@@ -346,6 +376,10 @@ export default function(providerElement, storage, state, context, element) {
346
376
  setSelectionColor,
347
377
  removeSelectionColor,
348
378
  setBannerHeight,
349
- removeBanner
379
+ removeBanner,
380
+ setActiveSidebar,
381
+ removeActiveSidebar,
382
+ hasSidebarLeft,
383
+ hasSidebarRight
350
384
  };
351
385
  }
@@ -19,7 +19,6 @@ type PendingRect<T> = {
19
19
  checkOverlap: boolean;
20
20
  };
21
21
  export declare class RectangleBufferCollector<T extends RectangleBufferRect> {
22
- gl?: WebGLRenderingContext;
23
22
  added: Set<string>;
24
23
  rects: Record<string, T>;
25
24
  positions: number[];
@@ -34,13 +33,13 @@ export declare class RectangleBufferCollector<T extends RectangleBufferRect> {
34
33
  placedRects: PlacedRectangle[];
35
34
  deferredMode: boolean;
36
35
  pendingRects: PendingRect<T>[];
37
- constructor(gl?: WebGLRenderingContext, options?: RectangleBufferCollectorOptions);
36
+ constructor(options?: RectangleBufferCollectorOptions);
38
37
  reset(): void;
39
38
  getIdealPosition(x: number, y: number, width: number, height: number, isEmptyField?: boolean): Rectangle;
40
39
  addRectangle(rect: Omit<T, 'index'>, type: number, checkOverlap?: boolean): void;
41
40
  processPendingRects(): void;
42
41
  getIndex(id: string): number | undefined;
43
42
  updateRectangle(): void;
44
- createBufferInfo(): BufferInfo | null;
43
+ createBufferInfo(gl: WebGLRenderingContext): BufferInfo;
45
44
  }
46
45
  export {};
@@ -1,7 +1,6 @@
1
1
  import { createBufferInfoFromArrays } from "twgl.js";
2
2
  import { intersects } from "../index.js";
3
3
  export class RectangleBufferCollector {
4
- gl;
5
4
  added = /* @__PURE__ */ new Set();
6
5
  rects = {};
7
6
  positions = [];
@@ -16,8 +15,7 @@ export class RectangleBufferCollector {
16
15
  placedRects = [];
17
16
  deferredMode = false;
18
17
  pendingRects = [];
19
- constructor(gl, options) {
20
- this.gl = gl;
18
+ constructor(options) {
21
19
  this.deferredMode = options?.deferredMode || false;
22
20
  }
23
21
  reset() {
@@ -279,40 +277,37 @@ export class RectangleBufferCollector {
279
277
  }
280
278
  updateRectangle() {
281
279
  }
282
- createBufferInfo() {
283
- if (!this.gl) {
284
- return null;
285
- }
286
- return createBufferInfoFromArrays(this.gl, {
280
+ createBufferInfo(gl) {
281
+ return createBufferInfoFromArrays(gl, {
287
282
  a_position: {
288
283
  numComponents: 3,
289
284
  data: this.positions,
290
- type: this.gl.FLOAT
285
+ type: gl.FLOAT
291
286
  },
292
287
  a_rect_id: {
293
288
  numComponents: 1,
294
289
  data: this.rectId,
295
- type: this.gl.FLOAT
290
+ type: gl.FLOAT
296
291
  },
297
292
  a_state: {
298
293
  numComponents: 1,
299
294
  data: this.state,
300
- type: this.gl.FLOAT
295
+ type: gl.FLOAT
301
296
  },
302
297
  a_rect_type: {
303
298
  numComponents: 1,
304
299
  data: this.types,
305
- type: this.gl.FLOAT
300
+ type: gl.FLOAT
306
301
  },
307
302
  a_rect_radius: {
308
303
  numComponents: 4,
309
304
  data: this.radius,
310
- type: this.gl.FLOAT
305
+ type: gl.FLOAT
311
306
  },
312
307
  a_quad: {
313
308
  numComponents: 4,
314
309
  data: this.quad,
315
- type: this.gl.FLOAT
310
+ type: gl.FLOAT
316
311
  },
317
312
  indices: this.indices
318
313
  });
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 4H4A2 2 0 0 0 2 6V18A2 2 0 0 0 4 20H20A2 2 0 0 0 22 18V6A2 2 0 0 0 20 4M20 18H9V6H20Z" /></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 4H4A2 2 0 0 0 2 6V18A2 2 0 0 0 4 20H20A2 2 0 0 0 22 18V6A2 2 0 0 0 20 4M15 18H4V6H15Z" /></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18 18V20H4A2 2 0 0 1 2 18V8H4V18M22 6V14A2 2 0 0 1 20 16H8A2 2 0 0 1 6 14V6A2 2 0 0 1 8 4H20A2 2 0 0 1 22 6M20 6H8V14H20Z" /></svg>
@@ -78,7 +78,7 @@ function createDirective(type) {
78
78
  if (!fieldName) {
79
79
  return;
80
80
  }
81
- app.directive.registerDirectiveElement(el, fieldName, entity, type);
81
+ app.directive.registerDirectiveElement(el, fieldName, entity, type, false);
82
82
  },
83
83
  beforeUnmount(el, binding, vnode) {
84
84
  if (!isEditing()) {
@@ -737,23 +737,6 @@ export interface DraggableMediaLibraryItem {
737
737
  mediaBundle: string;
738
738
  }
739
739
  export type DraggableItem = DraggableClipboardItem | DraggableNewItem | DraggableActionItem | DraggableExistingBlock | DraggableExistingStructureBlock | DraggableReusableItem | DraggableSearchContentItem | DraggableMediaLibraryItem;
740
- /**
741
- * Defines a droppable entity field.
742
- */
743
- export type DroppableEntityField = {
744
- /**
745
- * The droppable field element.
746
- */
747
- element: HTMLElement;
748
- /**
749
- * The host.
750
- */
751
- host: DraggableExistingBlock | EntityContext;
752
- /**
753
- * The name of the field on which entities can be dropped.
754
- */
755
- fieldName: string;
756
- };
757
740
  export type MoveBlockEvent = {
758
741
  afterUuid?: string;
759
742
  item: DraggableExistingBlock;
@@ -817,7 +800,7 @@ export type AnimationFrameEvent = {
817
800
  time: number;
818
801
  };
819
802
  export type Message = {
820
- type: 'success' | 'error';
803
+ type: 'success' | 'error' | 'warning';
821
804
  message: string;
822
805
  additional?: string | Error | unknown;
823
806
  replace?: boolean;
@@ -832,7 +815,6 @@ export type Coord = {
832
815
  };
833
816
  export type Rectangle = Size & Coord;
834
817
  export type CanvasDrawEvent = {
835
- gl: WebGLRenderingContext;
836
818
  mouseX: number;
837
819
  mouseY: number;
838
820
  mouseArtboard: Coord;
@@ -841,6 +823,7 @@ export type CanvasDrawEvent = {
841
823
  artboardSize: Size;
842
824
  time: number;
843
825
  selectedUuids: string[];
826
+ dpi: number;
844
827
  };
845
828
  export type MakeReusableEvent = {
846
829
  label: string;
@@ -880,7 +863,6 @@ export type ScrollIntoViewEvent = {
880
863
  export type PluginMountEvent = {
881
864
  type: 'ItemDropdown';
882
865
  id: string;
883
- isRendering: ComputedRef<boolean>;
884
866
  };
885
867
  export type PluginUnmountEvent = {
886
868
  type: 'ItemDropdown';
@@ -1031,6 +1013,7 @@ export type EventbusEvents = {
1031
1013
  'animationFrame:before': AnimationFrameBeforeEvent;
1032
1014
  'animationFrame:after': undefined;
1033
1015
  'canvas:draw': CanvasDrawEvent;
1016
+ 'state:reload:before': undefined;
1034
1017
  'state:reloaded': undefined;
1035
1018
  addContentSearchItem: AddContentSearchItemEvent;
1036
1019
  'option:update': UpdateBlockOptionEvent;
@@ -1043,7 +1026,6 @@ export type EventbusEvents = {
1043
1026
  'editable:focus': EditableFieldFocusEvent;
1044
1027
  'editable:update': EditableFieldUpdateEvent;
1045
1028
  'editable:save': undefined;
1046
- 'droppable:focus': DroppableEntityField;
1047
1029
  'drop:clipboardItem': DropClipboardItemEvent;
1048
1030
  'sidebar:close': undefined;
1049
1031
  'sidebar:open': string;
@@ -1417,5 +1399,6 @@ export type RegisteredField = {
1417
1399
  };
1418
1400
  export type RegisterFieldData = Pick<RegisteredField, 'fieldListType' | 'allowedFragments' | 'isNested' | 'nestingLevel' | 'dropAlignment'>;
1419
1401
  export type VueClassProp = string | Record<string, boolean> | VueClassProp[];
1402
+ export type SidebarRegion = 'left' | 'right';
1420
1403
  declare const _default: {};
1421
1404
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blokkli/editor",
3
- "version": "2.0.0-alpha.21",
3
+ "version": "2.0.0-alpha.23",
4
4
  "description": "Interactive page building experience for Nuxt",
5
5
  "repository": "blokkli/editor",
6
6
  "type": "module",
@@ -1,56 +0,0 @@
1
- <template>
2
- <Teleport to="body">
3
- <BlokkliTransition name="slide-in">
4
- <FormOverlay
5
- v-if="isVisible"
6
- :id="id"
7
- :title="title"
8
- :icon="icon"
9
- @close="onClose"
10
- >
11
- <slot />
12
- <template #footer>
13
- <button class="bk-button bk-is-primary" @click="onSubmit">
14
- {{ $t("droppableEditFormSave", "Save") }}
15
- </button>
16
- </template>
17
- </FormOverlay>
18
- </BlokkliTransition>
19
- </Teleport>
20
- </template>
21
-
22
- <script setup>
23
- import { FormOverlay, BlokkliTransition } from "#blokkli/components";
24
- import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
25
- import { ref, useBlokkli } from "#imports";
26
- const props = defineProps({
27
- id: { type: String, required: true },
28
- title: { type: String, required: true },
29
- icon: { type: null, required: true },
30
- entityType: { type: String, required: true }
31
- });
32
- const emit = defineEmits(["save"]);
33
- const { $t, types, state } = useBlokkli();
34
- const droppable = ref(null);
35
- const isVisible = ref(false);
36
- const onClose = () => {
37
- isVisible.value = false;
38
- };
39
- const onSubmit = () => {
40
- if (droppable.value) {
41
- emit("save", droppable.value.field);
42
- }
43
- isVisible.value = false;
44
- droppable.value = null;
45
- };
46
- onBlokkliEvent("droppable:focus", (field) => {
47
- if (state.editMode.value !== "editing") {
48
- return;
49
- }
50
- const config = types.getDroppableFieldConfig(field.fieldName, field.host);
51
- if (config.allowedEntityType === props.entityType) {
52
- isVisible.value = true;
53
- droppable.value = { field, config };
54
- }
55
- });
56
- </script>
@@ -1,24 +0,0 @@
1
- import type { BlokkliIcon } from '#blokkli-build/icons';
2
- import type { DroppableEntityField } from '#blokkli/types';
3
- type __VLS_Props = {
4
- id: string;
5
- title: string;
6
- icon: BlokkliIcon;
7
- entityType: string;
8
- };
9
- declare var __VLS_18: {};
10
- type __VLS_Slots = {} & {
11
- default?: (props: typeof __VLS_18) => any;
12
- };
13
- declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
14
- save: (data: DroppableEntityField) => any;
15
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
16
- onSave?: ((data: DroppableEntityField) => any) | undefined;
17
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
- declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
19
- export default _default;
20
- type __VLS_WithSlots<T, S> = T & {
21
- new (): {
22
- $slots: S;
23
- };
24
- };
@@ -1,76 +0,0 @@
1
- <template>
2
- <Teleport v-if="enabled" to="#bk-blokkli-item-actions-dropdown">
3
- <div
4
- v-show="items.length"
5
- :style="{
6
- order: weight
7
- }"
8
- >
9
- <ol>
10
- <li v-for="item in itemsMapped" :key="item.id">
11
- <button
12
- class="bk-blokkli-item-actions-type-dropdown-button"
13
- :disabled="!item.enabled"
14
- @click.prevent="onClick(item)"
15
- >
16
- <div class="bk-blokkli-item-actions-type-dropdown-icon">
17
- <Icon v-if="item.icon" :name="item.icon" />
18
- <ItemIcon v-else-if="item.bundle" :bundle="item.bundle" />
19
- </div>
20
- <div>
21
- <div>{{ item.label }}</div>
22
- </div>
23
- <div v-if="item.description" class="bk-tooltip">
24
- {{ item.description }}
25
- </div>
26
- </button>
27
- </li>
28
- </ol>
29
- </div>
30
- </Teleport>
31
- </template>
32
-
33
- <script>
34
- import { Icon, ItemIcon } from "#blokkli/components";
35
- import { computed, useBlokkli, onMounted, onBeforeUnmount } from "#imports";
36
- </script>
37
-
38
- <script setup>
39
- const props = defineProps({
40
- id: { type: String, required: true },
41
- title: { type: String, required: true },
42
- enabled: { type: Boolean, required: true },
43
- items: { type: Array, required: true },
44
- icon: { type: null, required: false },
45
- weight: { type: [String, Number], required: false }
46
- });
47
- const emit = defineEmits(["select"]);
48
- const itemsMapped = computed(() => {
49
- return props.items.map((item) => {
50
- return {
51
- ...item,
52
- icon: item.icon ?? props.icon,
53
- enabled: item.enabled !== false
54
- };
55
- });
56
- });
57
- const { eventBus } = useBlokkli();
58
- const isRendering = computed(() => props.enabled);
59
- function onClick(item) {
60
- emit("select", item);
61
- eventBus.emit("action:selected");
62
- }
63
- onMounted(() => {
64
- eventBus.emit("plugin:mount", {
65
- type: "ItemDropdown",
66
- id: props.id,
67
- isRendering
68
- });
69
- });
70
- onBeforeUnmount(() => {
71
- eventBus.emit("plugin:unmount", {
72
- type: "ItemDropdown",
73
- id: props.id
74
- });
75
- });
76
- </script>
@@ -1,31 +0,0 @@
1
- import type { BlokkliIcon } from '#blokkli-build/icons';
2
- type Item = {
3
- id: string;
4
- label: string;
5
- description?: string;
6
- enabled?: boolean;
7
- icon?: BlokkliIcon;
8
- bundle?: string;
9
- };
10
- declare const _default: <T extends Item>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
11
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
12
- readonly onSelect?: ((item: T) => any) | undefined;
13
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onSelect"> & {
14
- id: string;
15
- title: string;
16
- enabled: boolean;
17
- items: T[];
18
- icon?: BlokkliIcon;
19
- weight?: string | number;
20
- } & Partial<{}>> & import("vue").PublicProps;
21
- expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
22
- attrs: any;
23
- slots: {};
24
- emit: (e: "select", item: T) => void;
25
- }>) => import("vue").VNode & {
26
- __ctx?: Awaited<typeof __VLS_setup>;
27
- };
28
- export default _default;
29
- type __VLS_PrettifyLocal<T> = {
30
- [K in keyof T]: T[K];
31
- } & {};
@@ -1,15 +0,0 @@
1
- ## Selectable blocks
2
-
3
- Renders a list of block bundles that can be added to the current page.
4
-
5
- ## Rendered bundles
6
-
7
- The component uses the data returned by [adapter.getAllBundles] to get a list of
8
- all block bundles. It then uses the value from [adapter.getFieldConfig] to only
9
- render block bundles that can actually be added in the current edit session.
10
-
11
- _can be added_ is defined as such:
12
-
13
- - It can be added to any of the fields directly inside `<BlokkliProvider>`
14
- - It can be added to any of the nested fields of blocks that are allowed on the
15
- page