@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,9 +1,5 @@
1
1
  <template>
2
- <Teleport
3
- v-if="selectableBundles.length && shouldRender"
4
- :key="renderKey"
5
- to="#blokkli-add-list-blocks"
6
- >
2
+ <Sortli v-if="shouldRender" id="blokkli-add-list-blocks" :build-item>
7
3
  <AddListItem
8
4
  v-for="(type, i) in sortedList"
9
5
  v-show="type.isVisible"
@@ -17,68 +13,30 @@
17
13
  data-element-type="new"
18
14
  :data-item-bundle="type.id"
19
15
  />
20
- <PluginTourItem
21
- id="block-add-list"
22
- :title="$t('blockAddListTourTitle', 'Favorite blocks')"
23
- :text="
16
+ </Sortli>
17
+ <PluginTourItem
18
+ v-if="shouldRender"
19
+ id="block-add-list"
20
+ :title="$t('blockAddListTourTitle', 'Favorite blocks')"
21
+ :text="
24
22
  $t(
25
23
  'blockAddListTourText',
26
24
  'Right-click on a block to add or remove them from your favorites. Favorites are highlighted and always displayed at the top of the list.'
27
25
  )
28
26
  "
29
- selector="#blokkli-add-list-blocks"
30
- />
31
- </Teleport>
32
- <Teleport
33
- v-if="
34
- ui.addListOrientation.value === 'sidebar' && types.generallyAvailableBundles.length > 10 && shouldRender
35
- "
36
- :key="renderKey"
37
- to="#blokkli-add-list-sidebar-before"
38
- >
39
- <div class="bk bk-list-sidebar-form">
40
- <input
41
- id="add_block_search"
42
- v-model="searchText"
43
- type="search"
44
- class="bk-form-input"
45
- :placeholder="$t('addListInputPlaceholder', 'Search available blocks')"
46
- required
47
- />
48
- </div>
49
- </Teleport>
27
+ selector="#blokkli-add-list-blocks"
28
+ />
50
29
  </template>
51
30
 
52
31
  <script setup>
53
- import {
54
- ref,
55
- computed,
56
- useBlokkli,
57
- defineBlokkliFeature,
58
- nextTick
59
- } from "#imports";
60
- import { AddListItem } from "#blokkli/components";
32
+ import { ref, computed, useBlokkli } from "#imports";
33
+ import { AddListItem, Sortli } from "#blokkli/components";
61
34
  import defineCommands from "#blokkli/helpers/composables/defineCommands";
62
- import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
63
35
  import { isInternalBundle } from "#blokkli/helpers/bundles";
64
36
  import { PluginTourItem } from "#blokkli/plugins";
65
37
  import { getFieldKey, onlyUnique } from "#blokkli/helpers";
66
- const { settings } = defineBlokkliFeature({
67
- id: "block-add-list",
68
- label: "Block Add List",
69
- icon: "plus",
70
- description: "Renders a list of block bundles that can be added to the current page.",
71
- dependencies: ["add-list"],
72
- screnshot: "feature-block-add-list.jpg",
73
- settings: {
74
- hideDisabledBlocks: {
75
- type: "checkbox",
76
- label: "Hide blocks that can't be added",
77
- description: `Hides blocks from the "Add List" if they can't be added to anywhere.`,
78
- group: "appearance",
79
- default: false
80
- }
81
- }
38
+ const props = defineProps({
39
+ hideDisabledBlocks: { type: Boolean, required: false }
82
40
  });
83
41
  const {
84
42
  selection,
@@ -94,6 +52,17 @@ const {
94
52
  definitions,
95
53
  blocks
96
54
  } = useBlokkli();
55
+ function buildItem(element) {
56
+ const itemBundle = element.dataset.sortliId;
57
+ if (!itemBundle) {
58
+ return;
59
+ }
60
+ return {
61
+ itemType: "new",
62
+ itemBundle,
63
+ element: () => element
64
+ };
65
+ }
97
66
  const shouldRender = computed(() => state.editMode.value === "editing");
98
67
  const searchText = ref("");
99
68
  const itemEntityType = runtimeConfig.itemEntityType;
@@ -156,7 +125,7 @@ const sortedList = computed(() => {
156
125
  return {
157
126
  ...v,
158
127
  isDisabled,
159
- isVisible: isVisible && (!settings.value.hideDisabledBlocks || !isDisabled),
128
+ isVisible: isVisible && (!props.hideDisabledBlocks || !isDisabled),
160
129
  isFavorite: favorites.value.includes(v.id)
161
130
  };
162
131
  }).sort((a, b) => {
@@ -333,15 +302,10 @@ defineCommands(() => {
333
302
  ...getAppendEndCommands()
334
303
  ];
335
304
  });
336
- onBlokkliEvent("add-list:change", () => {
337
- nextTick(() => {
338
- renderKey.value = Math.round(Math.random() * 1e9).toString();
339
- });
340
- });
341
305
  </script>
342
306
 
343
307
  <script>
344
308
  export default {
345
- name: "BlockAddList"
309
+ name: "AddListBlocks"
346
310
  };
347
311
  </script>
@@ -1,6 +1,6 @@
1
1
  declare const _default: import("vue").DefineComponent<{
2
- gl: WebGLRenderingContext;
2
+ hideDisabledBlocks?: boolean;
3
3
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
4
- gl: WebGLRenderingContext;
4
+ hideDisabledBlocks?: boolean;
5
5
  }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
6
  export default _default;
@@ -11,10 +11,10 @@
11
11
  >
12
12
  <div>
13
13
  <div id="blokkli-add-list-sidebar-before" />
14
- <Sortli class="bk bk-list-sidebar">
15
- <div id="blokkli-add-list-blocks" />
16
- <div id="blokkli-add-list-actions" />
17
- </Sortli>
14
+ <div class="bk bk-list-sidebar">
15
+ <AddListBlocks />
16
+ <Sortli id="blokkli-add-list-actions" :build-item="buildItemAction" />
17
+ </div>
18
18
  </div>
19
19
  </PluginSidebar>
20
20
  <Teleport v-else-if="shouldRender" to="body">
@@ -30,10 +30,10 @@
30
30
  @mouseenter="onMouseEnter"
31
31
  @mouseleave="onMouseLeave"
32
32
  >
33
- <Sortli class="bk-list">
34
- <div id="blokkli-add-list-blocks" />
35
- <div id="blokkli-add-list-actions" />
36
- </Sortli>
33
+ <div class="bk-list">
34
+ <AddListBlocks />
35
+ <Sortli id="blokkli-add-list-actions" :build-item="buildItemAction" />
36
+ </div>
37
37
  </div>
38
38
  <PluginTourItem
39
39
  id="add-blocks"
@@ -56,6 +56,7 @@ import {
56
56
  import { Sortli } from "#blokkli/components";
57
57
  import { PluginSidebar, PluginTourItem } from "#blokkli/plugins";
58
58
  import { addElementClasses } from "#blokkli/helpers/addElementClasses";
59
+ import AddListBlocks from "./Blocks/index.vue";
59
60
  const { settings } = defineBlokkliFeature({
60
61
  id: "add-list",
61
62
  icon: "plus",
@@ -82,10 +83,30 @@ const { settings } = defineBlokkliFeature({
82
83
  icon: "ui-list-sidebar"
83
84
  }
84
85
  }
86
+ },
87
+ hideDisabledBlocks: {
88
+ type: "checkbox",
89
+ label: "Hide blocks that can't be added",
90
+ description: `Hides blocks from the "Add List" if they can't be added to anywhere.`,
91
+ group: "appearance",
92
+ default: false
85
93
  }
86
94
  },
87
95
  screenshot: "feature-add-list.jpg"
88
96
  });
97
+ function buildItemAction(element2) {
98
+ const actionType = element2.dataset.sortliId;
99
+ if (!actionType) {
100
+ return;
101
+ }
102
+ const itemBundle = element2.dataset.itemBundle;
103
+ return {
104
+ itemType: "action",
105
+ actionType,
106
+ itemBundle,
107
+ element: () => element2
108
+ };
109
+ }
89
110
  const { state, $t, eventBus, ui, element } = useBlokkli();
90
111
  const hasContextMenuOpen = computed(
91
112
  () => ui.openContextMenu.value.startsWith("add_list_item_")
@@ -39,12 +39,9 @@
39
39
  <Results :results="resultsFiltered" />
40
40
  </div>
41
41
  </div>
42
- <Overlay
43
- v-if="
44
- resultsFiltered.length && gl && animation.webglEnabled.value && !isStale
45
- "
42
+ <Renderer
43
+ v-if="resultsFiltered.length && !isStale"
46
44
  :results="resultsFiltered"
47
- :gl="gl"
48
45
  />
49
46
  </template>
50
47
 
@@ -52,7 +49,7 @@
52
49
  import { computed, useBlokkli, useState, ref } from "#imports";
53
50
  import Results from "./Results/Results.vue";
54
51
  import AnalyzeSummary from "./Summary/index.vue";
55
- import Overlay from "./Overlay/index.vue";
52
+ import Renderer from "./Renderer/index.vue";
56
53
  import { useAnalyzeHelper } from "./helper";
57
54
  import { FormSelect, RelativeTime } from "#blokkli/components";
58
55
  import { AnalyzerContext } from "./analyzers/helpers/Context";
@@ -64,9 +61,8 @@ const props = defineProps({
64
61
  analyzers: { type: Array, required: true }
65
62
  });
66
63
  const ALL = "ALL";
67
- const { $t, ui, state, animation } = useBlokkli();
64
+ const { $t, ui, state } = useBlokkli();
68
65
  const { getCategoryLabel } = useAnalyzeHelper();
69
- const gl = animation.gl();
70
66
  const currentPlugin = ref("readability");
71
67
  const hasRunOnce = useState(() => false);
72
68
  const results = useState("blokkli:analyze", () => []);
@@ -1,10 +1,14 @@
1
+ #version 300 es
2
+
1
3
  precision highp float;
2
4
 
3
- varying vec4 v_quad;
4
- varying float v_rect_type;
5
- varying vec3 v_color;
6
- varying vec2 v_rect_size;
7
- varying vec2 v_rect_center;
5
+ in vec4 v_quad;
6
+ in float v_rect_type;
7
+ in vec3 v_color;
8
+ in vec2 v_rect_size;
9
+ in vec2 v_rect_center;
10
+
11
+ out vec4 fragColor;
8
12
 
9
13
  uniform float u_dpi;
10
14
 
@@ -54,5 +58,5 @@ void main() {
54
58
  // Mix with border
55
59
  vec4 finalColor = mix(res_with_fill, border, borderAlpha * border.a);
56
60
 
57
- gl_FragColor = finalColor;
61
+ fragColor = finalColor;
58
62
  }
@@ -16,11 +16,9 @@ import fs from "./fragment.glsl?raw";
16
16
  import { RectangleBufferCollector } from "#blokkli/helpers/webgl";
17
17
  import { toShaderColor } from "#blokkli/helpers";
18
18
  const props = defineProps({
19
- results: { type: Array, required: true },
20
- gl: { type: null, required: true }
19
+ results: { type: Array, required: true }
21
20
  });
22
21
  const { animation, ui, theme, selection, eventBus, element } = useBlokkli();
23
- const programInfo = animation.registerProgram("analyze", props.gl, [vs, fs]);
24
22
  const statusPriority = {
25
23
  violation: 3,
26
24
  incomplete: 2,
@@ -66,7 +64,7 @@ class AnalyzeRectangleBufferCollector extends RectangleBufferCollector {
66
64
  clearCache() {
67
65
  this.rectCache.clear();
68
66
  }
69
- getBufferInfo(force) {
67
+ getBufferInfo(gl, force) {
70
68
  const key = nodes.value.map((node, index) => {
71
69
  if (!this.rectCache.has(node.element)) {
72
70
  this.rectCache.set(
@@ -109,30 +107,60 @@ class AnalyzeRectangleBufferCollector extends RectangleBufferCollector {
109
107
  }
110
108
  this.prevKey = key;
111
109
  }
112
- if (hasChanged) {
113
- this.bufferInfo = this.createBufferInfo();
110
+ if (hasChanged && gl) {
111
+ this.bufferInfo = this.createBufferInfo(gl);
114
112
  }
115
113
  return { info: this.bufferInfo, hasChanged };
116
114
  }
117
115
  }
118
- const collector = new AnalyzeRectangleBufferCollector(props.gl);
119
- defineRenderer("analyze-overlay", {
116
+ const { collector } = defineRenderer("analyze-overlay", {
120
117
  zIndex: 500,
118
+ collector: () => new AnalyzeRectangleBufferCollector(),
119
+ program: () => ({ shaders: [vs, fs] }),
121
120
  enabled: () => !selection.isMultiSelecting.value && !selection.isDragging.value,
122
- render: (ctx) => {
123
- ctx.gl.useProgram(programInfo.program);
124
- const { info } = collector.getBufferInfo();
121
+ render: (_ctx, gl, program) => {
122
+ gl.useProgram(program.program);
123
+ const { info } = collector.getBufferInfo(gl);
125
124
  if (!info) {
126
125
  return;
127
126
  }
128
- setUniforms(programInfo, {
127
+ setUniforms(program, {
129
128
  u_color_violation: toShaderColor(theme.red.value.normal),
130
129
  u_color_incomplete: toShaderColor(theme.yellow.value.normal),
131
130
  u_color_pass: toShaderColor(theme.lime.value.normal)
132
131
  });
133
- animation.setSharedUniforms(ctx.gl, programInfo);
134
- setBuffersAndAttributes(ctx.gl, programInfo, info);
135
- drawBufferInfo(ctx.gl, info, ctx.gl.TRIANGLES);
132
+ animation.setSharedUniforms(gl, program);
133
+ setBuffersAndAttributes(gl, program, info);
134
+ drawBufferInfo(gl, info, gl.TRIANGLES);
135
+ },
136
+ renderFallback: (ctx, ctx2d) => {
137
+ collector.getBufferInfo();
138
+ const rects = Object.values(collector.rects);
139
+ if (rects.length === 0) {
140
+ return;
141
+ }
142
+ const rgbaToCss = (rgb, alpha) => {
143
+ return `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${alpha})`;
144
+ };
145
+ const colorViolation = rgbaToCss(theme.red.value.normal, 0.3);
146
+ const colorIncomplete = rgbaToCss(theme.yellow.value.normal, 0.3);
147
+ const colorPass = rgbaToCss(theme.lime.value.normal, 0.3);
148
+ for (let i = 0; i < rects.length; i++) {
149
+ const rect = rects[i];
150
+ let fillColor = colorPass;
151
+ if (rect.status === "violation") {
152
+ fillColor = colorViolation;
153
+ } else if (rect.status === "incomplete") {
154
+ fillColor = colorIncomplete;
155
+ }
156
+ ctx2d.fillStyle = fillColor;
157
+ ctx2d.fillRect(
158
+ (rect.x * ctx.artboardScale + ctx.artboardOffset.x) * ctx.dpi,
159
+ (rect.y * ctx.artboardScale + ctx.artboardOffset.y) * ctx.dpi,
160
+ rect.width * ctx.artboardScale * ctx.dpi,
161
+ rect.height * ctx.artboardScale * ctx.dpi
162
+ );
163
+ }
136
164
  }
137
165
  });
138
166
  onBlokkliEvent("ui:resized", function() {
@@ -1,9 +1,7 @@
1
1
  import type { AnalyzeResultMapped } from '#blokkli/analyzer/types';
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  results: AnalyzeResultMapped[];
4
- gl: WebGLRenderingContext;
5
4
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
6
5
  results: AnalyzeResultMapped[];
7
- gl: WebGLRenderingContext;
8
6
  }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
7
  export default _default;
@@ -1,11 +1,13 @@
1
+ #version 300 es
2
+
1
3
  precision highp float;
2
4
 
3
5
  // [x, y] position.
4
- attribute vec2 a_position;
6
+ in vec2 a_position;
5
7
  // The [x,y,width, height] of the quad the vertex belongs to.
6
- attribute vec4 a_quad;
7
- attribute float a_rect_id;
8
- attribute float a_rect_type;
8
+ in vec4 a_quad;
9
+ in float a_rect_id;
10
+ in float a_rect_type;
9
11
 
10
12
  // The global scaling applied to all quads.
11
13
  uniform float u_scale;
@@ -19,11 +21,11 @@ uniform vec3 u_color_violation;
19
21
  uniform vec3 u_color_incomplete;
20
22
  uniform vec3 u_color_pass;
21
23
 
22
- varying vec4 v_quad;
23
- varying float v_rect_type;
24
- varying vec3 v_color;
25
- varying vec2 v_rect_size;
26
- varying vec2 v_rect_center;
24
+ out vec4 v_quad;
25
+ out float v_rect_type;
26
+ out vec3 v_color;
27
+ out vec2 v_rect_size;
28
+ out vec2 v_rect_center;
27
29
 
28
30
  void main() {
29
31
  // Apply global scale and offsets
@@ -46,21 +46,33 @@ function getElement() {
46
46
  }
47
47
  return null;
48
48
  }
49
+ function getElementLabel(tagName) {
50
+ return `<${tagName.toLowerCase()}>`;
51
+ }
49
52
  function getLabel() {
50
53
  if (props.target) {
51
54
  if (typeof props.target === "string") {
52
55
  return props.target;
53
56
  } else if (props.target instanceof HTMLElement) {
54
- return (props.target.textContent ?? "").slice(0, 50);
57
+ if (props.target instanceof HTMLImageElement) {
58
+ if (props.target.alt) {
59
+ return props.target.alt.slice(0, 50);
60
+ }
61
+ }
62
+ const textContent = (props.target.textContent ?? "").slice(0, 50);
63
+ if (textContent) {
64
+ return textContent;
65
+ }
66
+ return getElementLabel(props.target.tagName);
55
67
  } else if (typeof props.target === "object" && "uuid" in props.target) {
56
68
  return props.target.uuid;
57
69
  }
58
70
  }
59
71
  }
60
72
  function findClosestUuid(element2) {
61
- const closestBlock = element2.closest("[data-uuid]");
73
+ const closestBlock = element2.closest("[data-bk-uuid]");
62
74
  if (closestBlock instanceof HTMLElement) {
63
- const uuid = closestBlock.dataset.uuid;
75
+ const uuid = closestBlock.dataset.bkUuid;
64
76
  if (uuid) {
65
77
  return uuid;
66
78
  }
@@ -64,6 +64,9 @@ const traverse = (element, results) => {
64
64
  if (element.tagName === "SCRIPT" || element.tagName === "STYLE") {
65
65
  return;
66
66
  }
67
+ if (element.classList.contains("bk-skip-analyze")) {
68
+ return;
69
+ }
67
70
  if (isBlockElement(element)) {
68
71
  if (!containsBlockElements(element)) {
69
72
  const text = getCleanText(element);
@@ -5,14 +5,18 @@
5
5
  :tour-text="$t('analyzeTourText', 'Analyze the content of your page')"
6
6
  icon="speedometer"
7
7
  >
8
- <Renderer :langcode="context.language" :analyzers />
8
+ <AnalyzerMain
9
+ :key="animation.renderKey.value"
10
+ :langcode="context.language"
11
+ :analyzers
12
+ />
9
13
  </PluginSidebar>
10
14
  </template>
11
15
 
12
16
  <script setup>
13
17
  import { useBlokkli, defineBlokkliFeature } from "#imports";
14
18
  import { PluginSidebar } from "#blokkli/plugins";
15
- import Renderer from "./Renderer.vue";
19
+ import AnalyzerMain from "./Main.vue";
16
20
  const { adapter } = defineBlokkliFeature({
17
21
  id: "analyze",
18
22
  label: "Analyze",
@@ -34,7 +38,7 @@ function getAdapterAnalyzers() {
34
38
  });
35
39
  }
36
40
  const analyzers = await getAdapterAnalyzers();
37
- const { $t, context } = useBlokkli();
41
+ const { $t, context, animation } = useBlokkli();
38
42
  </script>
39
43
 
40
44
  <script>
@@ -7,14 +7,14 @@
7
7
  :title-off="$t('anchorHide', 'Hide anchor links')"
8
8
  icon="anchor"
9
9
  >
10
- <AnchorRenderer v-if="isActive" />
10
+ <AnchorOverlay v-if="isActive" />
11
11
  </PluginViewOption>
12
12
  </template>
13
13
 
14
14
  <script setup>
15
15
  import { useBlokkli, defineBlokkliFeature } from "#imports";
16
16
  import { PluginViewOption } from "#blokkli/plugins";
17
- import AnchorRenderer from "./Renderer.vue";
17
+ import AnchorOverlay from "./Overlay/index.vue";
18
18
  defineBlokkliFeature({
19
19
  id: "anchors",
20
20
  label: "Anchors",
@@ -1,16 +1,10 @@
1
1
  <template>
2
- <Sortli class="bk-clipboard-list">
2
+ <Sortli class="bk-clipboard-list" :build-item>
3
3
  <div
4
4
  v-for="(item, index) in items"
5
5
  :key="index + item.data + renderKey"
6
6
  class="bk-parent bk-sidebar-padding"
7
- data-element-type="clipboard"
8
- :data-sortli-id="'clipboard_' + index"
9
- :data-item-bundle="item.itemBundle"
10
- :data-clipboard-type="item.type"
11
- :data-clipboard-id="item.id"
12
- :data-clipboard-data="item.data"
13
- :data-clipboard-additional="item.additional"
7
+ :data-sortli-id="index"
14
8
  >
15
9
  <div class="bk-clipboard-item">
16
10
  <div class="bk bk-clipboard-item-header">
@@ -24,7 +18,7 @@
24
18
  <Icon name="delete" />
25
19
  </button>
26
20
  </div>
27
- <div class="bk-drop-element">
21
+ <div>
28
22
  <div
29
23
  v-if="item.type === 'text'"
30
24
  class="bk-clipboard-item-inner"
@@ -50,7 +44,7 @@ import { ItemIcon, Icon, Sortli } from "#blokkli/components";
50
44
  import ClipboardItemVideo from "./Item/Video.vue";
51
45
  import ClipboardItemFile from "./Item/File.vue";
52
46
  const renderKey = ref(0);
53
- defineProps({
47
+ const props = defineProps({
54
48
  items: { type: Array, required: true }
55
49
  });
56
50
  defineEmits(["remove"]);
@@ -58,4 +52,21 @@ const { types } = useBlokkli();
58
52
  function getLabel(bundle) {
59
53
  return types.getBlockBundleDefinition(bundle)?.label || bundle;
60
54
  }
55
+ function buildItem(element) {
56
+ if (!element.dataset.sortliId) {
57
+ return;
58
+ }
59
+ const index = Number.parseInt(element.dataset.sortliId);
60
+ const item = props.items[index];
61
+ if (!item) {
62
+ return;
63
+ }
64
+ return {
65
+ itemType: "clipboard",
66
+ element: () => element,
67
+ itemBundle: item.itemBundle,
68
+ additional: item.additional,
69
+ clipboardId: item.id
70
+ };
71
+ }
61
72
  </script>
@@ -63,16 +63,6 @@
63
63
  </div>
64
64
  </div>
65
65
  </PluginSidebar>
66
- <PluginItemDropdown
67
- id="clipboard"
68
- :title="$t('clipboard', 'Clipboard')"
69
- :enabled="
70
- !!selection.items.value.length && state.editMode.value === 'editing'
71
- "
72
- :items="itemDropdownItems"
73
- icon="clipboard"
74
- @select="onSelectDropdownItem"
75
- />
76
66
  </template>
77
67
 
78
68
  <script setup>
@@ -84,7 +74,8 @@ import {
84
74
  onUnmounted,
85
75
  computed
86
76
  } from "#imports";
87
- import { PluginSidebar, PluginItemDropdown } from "#blokkli/plugins";
77
+ import { PluginSidebar } from "#blokkli/plugins";
78
+ import defineItemDropdownAction from "#blokkli/helpers/composables/defineItemDropdownAction";
88
79
  import ClipboardList from "./List/index.vue";
89
80
  import { generateUUID, getFieldKey } from "#blokkli/helpers";
90
81
  import { Icon } from "#blokkli/components";
@@ -529,6 +520,22 @@ defineShortcut([
529
520
  meta: true
530
521
  }
531
522
  ]);
523
+ defineItemDropdownAction(() => {
524
+ if (selection.items.value.length && state.editMode.value === "editing") {
525
+ return itemDropdownItems.value.map((item) => ({
526
+ id: "clipboard-" + item.id,
527
+ label: item.label,
528
+ icon: item.icon,
529
+ description: item.description,
530
+ enabled: item.enabled,
531
+ group: "clipboard",
532
+ weight: 100,
533
+ callback: () => {
534
+ onSelectDropdownItem(item);
535
+ }
536
+ }));
537
+ }
538
+ });
532
539
  onBlokkliEvent("drop:clipboardItem", async (data) => {
533
540
  const item = pastedItems.value.find((v) => v.id === data.id);
534
541
  if (!item) {
@@ -1,12 +1,5 @@
1
1
  <template>
2
- <PluginItemDropdown
3
- id="conversions"
4
- :title="$t('convertTo', 'Convert to...')"
5
- :enabled="!!possibleConversions.length"
6
- :items="possibleConversions"
7
- weight="900"
8
- @select="onConvert($event.id)"
9
- />
2
+ <div />
10
3
  </template>
11
4
 
12
5
  <script setup>
@@ -17,8 +10,8 @@ import {
17
10
  useLazyAsyncData,
18
11
  watch
19
12
  } from "#imports";
20
- import { PluginItemDropdown } from "#blokkli/plugins";
21
13
  import { falsy } from "#blokkli/helpers";
14
+ import defineItemDropdownAction from "#blokkli/helpers/composables/defineItemDropdownAction";
22
15
  const { adapter } = defineBlokkliFeature({
23
16
  id: "conversions",
24
17
  label: "Conversions",
@@ -68,6 +61,20 @@ const possibleConversions = computed(() => {
68
61
  };
69
62
  });
70
63
  });
64
+ defineItemDropdownAction(() => {
65
+ if (possibleConversions.value.length) {
66
+ return possibleConversions.value.map((conversion) => ({
67
+ id: "conversion-" + conversion.id,
68
+ label: conversion.label,
69
+ bundle: conversion.bundle,
70
+ group: "conversions",
71
+ weight: 900,
72
+ callback: () => {
73
+ onConvert(conversion.id);
74
+ }
75
+ }));
76
+ }
77
+ });
71
78
  </script>
72
79
 
73
80
  <script>