@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
@@ -2,11 +2,13 @@
2
2
  <Teleport to="#bk-canvas-overlay">
3
3
  <canvas
4
4
  id="bk-animation-canvas-webgl"
5
+ :key="animation.canvasKey.value"
5
6
  ref="canvasEl"
6
7
  :style
7
8
  @click.capture="onClick"
8
9
  @pointerdown.capture="onPointerDown"
9
10
  @pointerup.capture="onPointerUp"
11
+ @pointermove="onPointerMove"
10
12
  />
11
13
  </Teleport>
12
14
  </template>
@@ -27,7 +29,6 @@ import {
27
29
  ref,
28
30
  computed,
29
31
  useBlokkli,
30
- onMounted,
31
32
  watch,
32
33
  useTemplateRef,
33
34
  onBeforeUnmount
@@ -44,6 +45,7 @@ const {
44
45
  runtimeConfig,
45
46
  blocks
46
47
  } = useBlokkli();
48
+ let handlePointerMove = false;
47
49
  const cursor = computed(
48
50
  () => state.isLoading.value ? "wait" : animation.cursor.value
49
51
  );
@@ -124,6 +126,9 @@ function toDraggableExisting(v) {
124
126
  });
125
127
  }
126
128
  function onPointerMove(e) {
129
+ if (!handlePointerMove) {
130
+ return;
131
+ }
127
132
  if (keyboard.isPressingSpace.value || e.buttons === MOUSE_BUTTONS.AUXILIARY) {
128
133
  return;
129
134
  }
@@ -197,7 +202,7 @@ function onPointerDown(e) {
197
202
  if (state.isLoading.value) {
198
203
  return;
199
204
  }
200
- canvasEl.value?.addEventListener("pointermove", onPointerMove);
205
+ handlePointerMove = true;
201
206
  if (e.pointerType === "touch") {
202
207
  return onTouchStart(e);
203
208
  }
@@ -228,7 +233,7 @@ function isClickInArtboard(coords) {
228
233
  return isInsideRect(coords.x, coords.y, rect);
229
234
  }
230
235
  function onPointerUp(e) {
231
- canvasEl.value?.removeEventListener("pointermove", onPointerMove);
236
+ handlePointerMove = false;
232
237
  if (e.button === MOUSE_BUTTON.AUXILIARY) {
233
238
  e.preventDefault();
234
239
  return;
@@ -427,72 +432,22 @@ function onClick(e) {
427
432
  e.stopPropagation();
428
433
  }
429
434
  const canvasEl = useTemplateRef("canvasEl");
430
- const canvasAttributes = computed(() => {
431
- return {
432
- width: ui.viewport.value.width * animation.dpi.value,
433
- height: ui.viewport.value.height * animation.dpi.value
434
- };
435
- });
436
- let gl = null;
437
- function initGl() {
438
- if (!canvasEl.value) {
439
- return;
440
- }
441
- gl = animation.gl();
442
- canvasEl.value.width = canvasAttributes.value.width;
443
- canvasEl.value.height = canvasAttributes.value.height;
444
- if (!gl) {
445
- return;
446
- }
447
- gl.enable(gl.BLEND);
448
- gl.enable(gl.SCISSOR_TEST);
449
- gl.disable(gl.DEPTH_TEST);
450
- gl.clearColor(0, 0, 0, 0);
451
- gl.viewport(0, 0, canvasAttributes.value.width, canvasAttributes.value.height);
452
- gl.blendFunc(gl.SRC_ALPHA_SATURATE, gl.ONE);
453
- gl.blendEquation(gl.FUNC_ADD);
454
- setScissor(scissor.value);
455
- }
456
- const scissor = computed(() => {
457
- const dpi = animation.dpi.value;
458
- return {
459
- x: ui.visibleViewport.value.x * dpi,
460
- y: canvasAttributes.value.height - ui.visibleViewport.value.y * dpi - ui.visibleViewport.value.height * dpi,
461
- width: Math.max(ui.visibleViewport.value.width * dpi, 1),
462
- height: Math.max(ui.visibleViewport.value.height * dpi, 1)
463
- };
464
- });
465
- function setScissor(v) {
466
- if (!gl) {
467
- return;
468
- }
469
- gl.scissor(v.x, v.y, v.width, v.height);
470
- }
471
- watch(scissor, setScissor);
472
- let lastCanvasWidth = 0;
473
- let lastCanvasHeight = 0;
474
- onBlokkliEvent("animationFrame", () => {
475
- if (!canvasEl.value) {
476
- return;
477
- }
478
- const canvasWidth = canvasAttributes.value.width;
479
- const canvasHeight = canvasAttributes.value.height;
480
- if (canvasWidth !== lastCanvasWidth || canvasHeight !== lastCanvasHeight) {
481
- canvasEl.value.width = canvasWidth;
482
- canvasEl.value.height = canvasHeight;
483
- if (gl) {
484
- gl.viewport(0, 0, canvasWidth, canvasHeight);
435
+ watch(
436
+ canvasEl,
437
+ (newCanvas, oldCanvas) => {
438
+ if (oldCanvas) {
439
+ handlePointerMove = false;
440
+ animation.removeCanvasElement();
485
441
  }
486
- lastCanvasWidth = canvasWidth;
487
- lastCanvasHeight = canvasHeight;
488
- }
489
- });
490
- onMounted(() => {
491
- initGl();
492
- });
442
+ if (newCanvas) {
443
+ animation.setCanvasElement(newCanvas);
444
+ animation.requestDraw();
445
+ }
446
+ },
447
+ { immediate: true }
448
+ );
493
449
  onBeforeUnmount(() => {
494
- if (canvasEl.value) {
495
- canvasEl.value.removeEventListener("pointermove", onPointerMove);
496
- }
450
+ animation.removeCanvasElement();
451
+ handlePointerMove = false;
497
452
  });
498
453
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div ref="root" class="bk-block-proxy" v-bind="rootProps">
2
+ <div ref="root" class="bk-block-proxy">
3
3
  <div class="bk-block-proxy-header">
4
4
  <ItemIcon :bundle="bundle" />
5
5
  {{ type?.label }}
@@ -33,7 +33,7 @@
33
33
  import { computed, useBlokkli, ref } from "#imports";
34
34
  import { getBlokkliItemProxyComponent } from "#blokkli/helpers/editComponents";
35
35
  import { ItemIcon } from "#blokkli/components";
36
- import { buildAttributesForLibraryItem, falsy } from "#blokkli/helpers";
36
+ import { falsy } from "#blokkli/helpers";
37
37
  import { useBlockRegistration } from "#blokkli/helpers/composables/useBlockRegistration";
38
38
  const props = defineProps({
39
39
  uuid: { type: String, required: true },
@@ -55,12 +55,6 @@ const proxyComponentProps = computed(() => {
55
55
  }
56
56
  return props.itemProps;
57
57
  });
58
- const rootProps = computed(() => {
59
- if (libraryItemProps.value) {
60
- return buildAttributesForLibraryItem(libraryItemProps.value);
61
- }
62
- return {};
63
- });
64
58
  const proxyBundle = computed(
65
59
  () => libraryItemProps.value?.block?.bundle || props.bundle
66
60
  );
@@ -1,60 +1,44 @@
1
1
  <template>
2
2
  <slot />
3
-
4
- <Teleport to="body">
5
- <Transition name="bk-fade">
6
- <div
7
- v-if="errors.length"
8
- class="bk bk-fatal-error-overlay"
9
- @wheel.capture.passive.stop
10
- @click.stop
11
- @mousedown.stop
12
- @touchstart.passive.stop
13
- @mousemove.stop
14
- >
15
- <div class="bk-fatal-error-overlay-info">
16
- <Icon name="sad" />
17
- <div>
18
- <h2>{{ $t("fatalErrorTitle", "bl\xF6kkli has stopped working") }}</h2>
19
- <p>
20
- {{
21
- $t(
22
- "fatalErrorText",
23
- "Unfortunately bl\xF6kkli has encountered a fatal error which prevents it from working normally. You may be able to continue using it, but things may not work as expected."
24
- )
25
- }}
26
- </p>
27
- <button class="bk-button bk-is-danger" @click="errors = []">
28
- {{ $t("fatalErrorButton", "Continue anyway...") }}
29
- </button>
30
- </div>
31
- </div>
32
- <div class="bk-fatal-error-overlay-list">
33
- <div v-for="(e, i) in unique" :key="i">
34
- <h3>{{ e.name }}: {{ e.message }}</h3>
35
- <code>
36
- <pre>{{ e.stack }}</pre>
37
- </code>
38
- </div>
39
- </div>
40
- </div>
41
- </Transition>
42
- </Teleport>
43
3
  </template>
44
4
 
45
5
  <script setup>
46
- import { computed, ref, onErrorCaptured } from "#imports";
47
- import { Icon } from "#blokkli/components";
48
- import textProvider from "#blokkli/helpers/textProvider";
6
+ import { emitMessage } from "#blokkli/helpers/eventBus";
7
+ import { ref, onErrorCaptured, useBlokkli } from "#imports";
8
+ import { useGlobalBlokkliObject } from "#blokkli/helpers/composables/useGlobalBlokkliObject";
9
+ const props = defineProps({
10
+ label: { type: String, required: true }
11
+ });
12
+ const { $t } = useBlokkli();
13
+ const globalBlokkli = useGlobalBlokkliObject();
49
14
  const errors = ref([]);
50
- const $t = textProvider();
15
+ const isLocked = defineModel({ type: Boolean, ...{ default: false } });
16
+ const emit = defineEmits(["error"]);
51
17
  onErrorCaptured((err) => {
52
18
  errors.value.push(err);
53
- return false;
54
- });
55
- const unique = computed(() => {
56
- return errors.value.filter((value, index, self) => {
57
- return self.findIndex((v) => v.name === value.name) === index;
19
+ emit("error", err);
20
+ globalBlokkli.pushMessage({
21
+ type: "error",
22
+ name: "ErrorBoundary",
23
+ date: (/* @__PURE__ */ new Date()).toISOString(),
24
+ message: `[${props.label}] ${err.message}`,
25
+ context: err.stack || ""
58
26
  });
27
+ const willBeLocked = errors.value.length >= 3;
28
+ if (willBeLocked) {
29
+ const message = $t(
30
+ "errorCapturedMessageDisabled",
31
+ '"@label" has errored more than 3 times. The feature will be disabled.'
32
+ ).replace("@label", props.label).replace("@errorMessage", err.message);
33
+ emitMessage(message, "error", true);
34
+ } else {
35
+ const message = $t(
36
+ "errorCapturedMessage",
37
+ 'Error in "@label": @errorMessage'
38
+ ).replace("@label", props.label).replace("@errorMessage", err.message);
39
+ emitMessage(message, "warning");
40
+ }
41
+ isLocked.value = willBeLocked;
42
+ return false;
59
43
  });
60
44
  </script>
@@ -1,8 +1,21 @@
1
+ type __VLS_Props = {
2
+ label: string;
3
+ };
4
+ type __VLS_PublicProps = __VLS_Props & {
5
+ modelValue?: boolean;
6
+ };
1
7
  declare var __VLS_1: {};
2
8
  type __VLS_Slots = {} & {
3
9
  default?: (props: typeof __VLS_1) => any;
4
10
  };
5
- declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ "update:modelValue": (value: boolean) => any;
13
+ } & {
14
+ error: (error: Error) => any;
15
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
16
+ onError?: ((error: Error) => any) | undefined;
17
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
19
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
7
20
  export default _default;
8
21
  type __VLS_WithSlots<T, S> = T & {
@@ -0,0 +1,93 @@
1
+ <template>
2
+ <slot />
3
+
4
+ <Teleport to="body">
5
+ <Transition name="bk-fade">
6
+ <div
7
+ v-if="errors.length"
8
+ class="bk bk-fatal-error-overlay"
9
+ @wheel.capture.passive.stop
10
+ @click.stop
11
+ @mousedown.stop
12
+ @touchstart.passive.stop
13
+ @mousemove.stop
14
+ >
15
+ <div class="bk-fatal-error-overlay-info">
16
+ <Icon name="sad" />
17
+ <div>
18
+ <h2>{{ $t("fatalErrorTitle", "bl\xF6kkli has stopped working") }}</h2>
19
+ <p>
20
+ {{
21
+ $t(
22
+ "fatalErrorText",
23
+ "Unfortunately bl\xF6kkli has encountered a fatal error which prevents it from working normally. You may be able to continue using it, but things may not work as expected."
24
+ )
25
+ }}
26
+ </p>
27
+ <div class="bk-fatal-error-buttons">
28
+ <button class="bk-button bk-is-danger" @click="errors = []">
29
+ {{ $t("fatalErrorButton", "Continue anyway...") }}
30
+ </button>
31
+ </div>
32
+ </div>
33
+ </div>
34
+ <div class="bk-fatal-error-overlay-list">
35
+ <h3>{{ title }}</h3>
36
+ <button class="bk-button" @click="downloadLogs">
37
+ {{ $t("downloadLogsButton", "Download Logs") }}
38
+ </button>
39
+ </div>
40
+ </div>
41
+ </Transition>
42
+ </Teleport>
43
+ </template>
44
+
45
+ <script setup>
46
+ import { computed, ref, onErrorCaptured } from "#imports";
47
+ import { Icon } from "#blokkli/components";
48
+ import textProvider from "#blokkli/helpers/textProvider";
49
+ import { useGlobalBlokkliObject } from "#blokkli/helpers/composables/useGlobalBlokkliObject";
50
+ const errors = ref([]);
51
+ const $t = textProvider();
52
+ const globalBlokkli = useGlobalBlokkliObject();
53
+ onErrorCaptured((err) => {
54
+ errors.value.push(err);
55
+ globalBlokkli.pushMessage({
56
+ type: "error",
57
+ name: "RootErrorBoundary",
58
+ date: (/* @__PURE__ */ new Date()).toISOString(),
59
+ message: err.message,
60
+ context: err.stack || ""
61
+ });
62
+ return false;
63
+ });
64
+ const title = computed(() => {
65
+ return errors.value.filter((value, index, self) => {
66
+ return self.findIndex((v) => v.name === value.name) === index;
67
+ }).map((v) => {
68
+ return v.name + " " + v.message;
69
+ }).join("");
70
+ });
71
+ function downloadLogs() {
72
+ const messages = globalBlokkli.getMessages();
73
+ const header = "Type,Logger,Timestamp,Message,Context\n";
74
+ const rows = messages.map((msg) => {
75
+ const escapeCsv = (str) => `"${str.replace(/"/g, '""')}"`;
76
+ return [
77
+ escapeCsv(msg.type),
78
+ escapeCsv(msg.name),
79
+ escapeCsv(msg.date),
80
+ escapeCsv(msg.message),
81
+ escapeCsv(msg.context ?? "")
82
+ ].join(",");
83
+ }).join("\n");
84
+ const csv = header + rows;
85
+ const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });
86
+ const url = URL.createObjectURL(blob);
87
+ const link = document.createElement("a");
88
+ link.href = url;
89
+ link.download = `blokkli-logs-${(/* @__PURE__ */ new Date()).toISOString()}.csv`;
90
+ link.click();
91
+ URL.revokeObjectURL(url);
92
+ }
93
+ </script>
@@ -0,0 +1,12 @@
1
+ declare var __VLS_1: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_1) => any;
4
+ };
5
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
7
+ export default _default;
8
+ type __VLS_WithSlots<T, S> = T & {
9
+ new (): {
10
+ $slots: S;
11
+ };
12
+ };
@@ -16,25 +16,15 @@
16
16
  <BlokkliItem
17
17
  v-for="(item, i) in list"
18
18
  :key="item.uuid + fieldListType + definitions.renderKey.value"
19
+ class="bk-field-list-item"
19
20
  :uuid="item.uuid"
20
21
  :bundle="item.bundle"
21
22
  :options="item.options"
22
23
  :props="item.props"
23
24
  is-editing
24
25
  :index="i"
26
+ :data-bk-uuid="item.uuid"
25
27
  :parent-type="isNested ? entity.bundle : ''"
26
- data-editing="true"
27
- data-element-type="existing"
28
- :data-sortli-id="item.uuid"
29
- :data-uuid="item.uuid"
30
- :data-host-type="entity.type"
31
- :data-host-bundle="entity.bundle"
32
- :data-host-uuid="entity.uuid"
33
- :data-item-bundle="item.bundle"
34
- :data-host-field-name="name"
35
- :data-host-field-list-type="fieldListType"
36
- :data-is-nested="isNested"
37
- :data-entity-type="runtimeConfig.itemEntityType"
38
28
  :data-bk-is-muted="isMuted(item)"
39
29
  />
40
30
  </div>
@@ -48,6 +38,7 @@
48
38
  <BlokkliItem
49
39
  v-for="(item, i) in list"
50
40
  :key="item.uuid + fieldListType"
41
+ class="bk-field-list-item"
51
42
  :uuid="item.uuid"
52
43
  :bundle="item.bundle"
53
44
  :options="item.options"
@@ -55,18 +46,7 @@
55
46
  is-editing
56
47
  :index="i"
57
48
  :parent-type="isNested ? entity.bundle : ''"
58
- data-editing="true"
59
- data-element-type="existing"
60
- :data-sortli-id="item.uuid"
61
- :data-uuid="item.uuid"
62
- :data-host-type="entity.type"
63
- :data-host-bundle="entity.bundle"
64
- :data-host-uuid="entity.uuid"
65
- :data-item-bundle="item.bundle"
66
- :data-host-field-name="name"
67
- :data-host-field-list-type="fieldListType"
68
- :data-is-nested="isNested"
69
- :data-entity-type="runtimeConfig.itemEntityType"
49
+ :data-bk-uuid="item.uuid"
70
50
  :data-bk-is-muted="isMuted(item)"
71
51
  />
72
52
  </Component>
@@ -89,7 +69,7 @@ import {
89
69
  INJECT_FIELD_PROXY_MODE,
90
70
  INJECT_IS_EDITING
91
71
  } from "#blokkli/helpers/symbols";
92
- const { dom, runtimeConfig, selection, definitions } = useBlokkli();
72
+ const { dom, selection, definitions } = useBlokkli();
93
73
  const root = ref(null);
94
74
  const props = defineProps({
95
75
  name: { type: String, required: true },
@@ -57,7 +57,8 @@ import {
57
57
  useRuntimeConfig,
58
58
  nextTick,
59
59
  inject,
60
- onUnmounted
60
+ onUnmounted,
61
+ watch
61
62
  } from "#imports";
62
63
  import Toolbar from "./Toolbar/index.vue";
63
64
  import Actions from "./Actions/index.vue";
@@ -152,7 +153,10 @@ const state = await editStateProvider(
152
153
  props.permissions
153
154
  );
154
155
  const storage = await storageProvider(adapter, context);
156
+ const plugins = pluginProvider();
155
157
  const debug = debugProvider(storage);
158
+ const baseLogger = debug.createLogger("EditProvider");
159
+ baseLogger.log("Entity: ", context.value);
156
160
  const element = elementProvider(debug);
157
161
  const features = featuresProvider(storage);
158
162
  const commands = commandsProvider();
@@ -164,11 +168,10 @@ const dom = domProvider(ui, debug, definitions, state, element);
164
168
  const theme = themeProvider(element);
165
169
  const blocks = blocksProvider(state, dom, context);
166
170
  const selection = selectionProvider(blocks);
167
- const animation = animationProvider(ui, storage, selection, element);
171
+ const animation = animationProvider(ui, storage, selection, debug);
168
172
  const keyboard = keyboardProvider(animation);
169
173
  const types = await typesProvider(adapter, selection, context);
170
174
  const indicators = indicatorsProvider();
171
- const plugins = pluginProvider();
172
175
  const directive = directiveProvider(debug, ui);
173
176
  const fields = fieldsProvider(state, dom, types);
174
177
  const mutatedEntity = computed(() => {
@@ -180,6 +183,11 @@ const mutatedEntity = computed(() => {
180
183
  const isReady = computed(
181
184
  () => !isInitializing.value && dom.isReady.value && directive.isReady.value && toolbarLoaded.value
182
185
  );
186
+ watch(isReady, (v) => {
187
+ if (v) {
188
+ baseLogger.log("is ready");
189
+ }
190
+ });
183
191
  const showLoading = computed(() => {
184
192
  return !isReady.value || !featuresLoaded.value;
185
193
  });
@@ -206,7 +214,6 @@ addElementClasses(
206
214
  "bk-isolate-provider",
207
215
  shouldIsolate
208
216
  );
209
- const baseLogger = debug.createLogger("EditProvider");
210
217
  function setElementSymbolProperty(el, symbol, value) {
211
218
  el[symbol] = value;
212
219
  }
@@ -296,7 +303,17 @@ const viewOnlyBanner = computed(
296
303
  const isProxyMode = computed(() => ui.isProxyMode.value);
297
304
  provide(INJECT_GLOBAL_PROXY_MODE, isProxyMode);
298
305
  if (import.meta.hot) {
299
- let onAfterUpdate = function() {
306
+ import.meta.hot.accept("#blokkli/runtime-helpers", () => {
307
+ });
308
+ import.meta.hot.accept("#blokkli/helpers/runtimeHelpers", () => {
309
+ });
310
+ import.meta.hot.on("vite:afterUpdate", (payload) => {
311
+ const hasUpdatedRenderer = payload.updates.find(
312
+ (v) => v.path.includes("/Renderer/")
313
+ );
314
+ if (hasUpdatedRenderer) {
315
+ animation.reset();
316
+ }
300
317
  try {
301
318
  eventBus.emit("state:reloaded");
302
319
  dom.updateVisibleRects();
@@ -311,14 +328,10 @@ if (import.meta.hot) {
311
328
  });
312
329
  } catch {
313
330
  }
314
- };
315
- import.meta.hot.accept("#blokkli/runtime-helpers", () => {
316
- });
317
- import.meta.hot.accept("#blokkli/helpers/runtimeHelpers", () => {
318
331
  });
319
- import.meta.hot.on("vite:afterUpdate", onAfterUpdate);
320
332
  }
321
333
  onMounted(async () => {
334
+ baseLogger.log("onMounted - START");
322
335
  setElementSymbolProperty(props.providerEl, INJECT_APP, app);
323
336
  setElementSymbolProperty(
324
337
  props.providerEl,
@@ -328,12 +341,12 @@ onMounted(async () => {
328
341
  window.addEventListener("contextmenu", onContextMenu);
329
342
  document.documentElement.addEventListener("touchmove", onTouchMove);
330
343
  document.documentElement.addEventListener("touchstart", onTouchStart);
331
- baseLogger.log("EditProvider mounted");
332
344
  dom.init();
333
345
  directive.init();
334
346
  await nextTick();
335
347
  isInitializing.value = false;
336
348
  broadcast.emit("editorLoaded", { uuid: props.entityUuid });
349
+ baseLogger.log("onMounted - END");
337
350
  });
338
351
  onBeforeUnmount(() => {
339
352
  window.removeEventListener("contextmenu", onContextMenu);