@blokkli/editor 2.0.0-alpha.54 → 2.0.0-alpha.55

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 (214) hide show
  1. package/dist/global/constants/index.d.ts +1 -1
  2. package/dist/global/constants/index.js +1 -1
  3. package/dist/global/types/features.d.ts +5 -9
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +28 -35
  6. package/dist/modules/agent/index.mjs +46 -29
  7. package/dist/modules/agent/runtime/app/composables/agentProvider.js +2 -1
  8. package/dist/modules/agent/runtime/app/features/agent/Container.d.vue.ts +19 -0
  9. package/dist/modules/agent/runtime/app/features/agent/Container.vue +195 -0
  10. package/dist/modules/agent/runtime/app/features/agent/Container.vue.d.ts +19 -0
  11. package/dist/modules/agent/runtime/app/features/agent/index.vue +18 -164
  12. package/dist/modules/agent/runtime/app/features/agent/types.d.ts +9 -0
  13. package/dist/modules/agent/runtime/app/helpers/index.d.ts +7 -3
  14. package/dist/modules/agent/runtime/app/helpers/index.js +9 -3
  15. package/dist/modules/agent/runtime/app/prompts/fixReadability.js +51 -44
  16. package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +2 -1
  17. package/dist/modules/agent/runtime/app/tools/check_readability/index.js +1 -0
  18. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.vue +1 -1
  19. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.js +6 -1
  20. package/dist/modules/agent/runtime/app/tools/get_readability_issues/index.js +1 -0
  21. package/dist/modules/agent/runtime/app/types/index.d.ts +12 -0
  22. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +34 -18
  23. package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +7 -0
  24. package/dist/modules/drupal/graphql/features/droppable-field-items.graphql +22 -0
  25. package/dist/modules/drupal/graphql/features/import-existing.graphql +0 -25
  26. package/dist/modules/drupal/graphql/features/workspace.graphql +9 -2
  27. package/dist/modules/drupal/graphql/mutations/update_droppable_field.graphql +21 -0
  28. package/dist/modules/drupal/index.mjs +6 -2
  29. package/dist/modules/drupal/runtime/adapter/index.js +75 -39
  30. package/dist/modules/readability/index.d.mts +11 -0
  31. package/dist/modules/readability/index.mjs +17 -0
  32. package/dist/modules/readability/runtime/adapter-extension.d.ts +2 -0
  33. package/dist/modules/readability/runtime/adapter-extension.js +5 -0
  34. package/dist/modules/readability/runtime/analyzers/builtin.d.ts +10 -0
  35. package/dist/modules/readability/runtime/analyzers/builtin.js +340 -0
  36. package/dist/runtime/components/BlokkliEditable.vue +10 -90
  37. package/dist/runtime/components/BlokkliItem.vue +2 -2
  38. package/dist/runtime/components/BlokkliProvider.vue +11 -5
  39. package/dist/runtime/composables/defineBlokkli.js +3 -1
  40. package/dist/runtime/composables/defineBlokkliFeature.d.ts +2 -3
  41. package/dist/runtime/editor/components/Actions/index.vue +1 -1
  42. package/dist/runtime/editor/components/AnimationCanvas/index.vue +41 -6
  43. package/dist/runtime/editor/components/AppMenu/Inner.d.vue.ts +7 -0
  44. package/dist/runtime/editor/components/AppMenu/Inner.vue +83 -0
  45. package/dist/runtime/editor/components/AppMenu/Inner.vue.d.ts +7 -0
  46. package/dist/runtime/editor/components/AppMenu/index.vue +5 -79
  47. package/dist/runtime/editor/components/ArtboardTooltip/index.d.vue.ts +1 -0
  48. package/dist/runtime/editor/components/ArtboardTooltip/index.vue +9 -1
  49. package/dist/runtime/editor/components/ArtboardTooltip/index.vue.d.ts +1 -0
  50. package/dist/runtime/editor/components/BlockPreviewItem/index.vue +12 -6
  51. package/dist/runtime/editor/components/BlokkliEditableEdit.d.vue.ts +23 -0
  52. package/dist/runtime/editor/components/BlokkliEditableEdit.vue +95 -0
  53. package/dist/runtime/editor/components/BlokkliEditableEdit.vue.d.ts +23 -0
  54. package/dist/runtime/editor/components/BlokkliRootErrorBoundary.d.vue.ts +4 -1
  55. package/dist/runtime/editor/components/BlokkliRootErrorBoundary.vue +4 -1
  56. package/dist/runtime/editor/components/BlokkliRootErrorBoundary.vue.d.ts +4 -1
  57. package/dist/runtime/editor/components/BundleSelector/index.vue +10 -5
  58. package/dist/runtime/editor/components/Dialog/index.vue +0 -77
  59. package/dist/runtime/editor/components/EditIndicator.d.vue.ts +1 -0
  60. package/dist/runtime/editor/components/EditIndicator.vue +3 -2
  61. package/dist/runtime/editor/components/EditIndicator.vue.d.ts +1 -0
  62. package/dist/runtime/editor/components/EditProvider.d.vue.ts +3 -1
  63. package/dist/runtime/editor/components/EditProvider.vue +13 -4
  64. package/dist/runtime/editor/components/EditProvider.vue.d.ts +3 -1
  65. package/dist/runtime/editor/components/FeaturesRenderer/index.vue +1 -4
  66. package/dist/runtime/editor/components/Form/Text/index.d.vue.ts +5 -0
  67. package/dist/runtime/editor/components/Form/Text/index.vue +10 -4
  68. package/dist/runtime/editor/components/Form/Text/index.vue.d.ts +5 -0
  69. package/dist/runtime/editor/components/FormOverlay/index.vue +0 -24
  70. package/dist/runtime/editor/components/GrowOnly/index.d.vue.ts +10 -0
  71. package/dist/runtime/editor/components/GrowOnly/index.vue +34 -0
  72. package/dist/runtime/editor/components/GrowOnly/index.vue.d.ts +10 -0
  73. package/dist/runtime/editor/components/Konami/Game/index.vue +120 -0
  74. package/dist/runtime/editor/components/Konami/index.vue +7 -124
  75. package/dist/runtime/editor/components/Loading/index.vue +1 -1
  76. package/dist/runtime/editor/components/PluginConfigForm/Text/index.vue +1 -0
  77. package/dist/runtime/editor/components/PluginConfigForm/index.vue +1 -0
  78. package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +3 -1
  79. package/dist/runtime/editor/components/PreviewProvider.vue +6 -1
  80. package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +3 -1
  81. package/dist/runtime/editor/components/index.d.ts +11 -10
  82. package/dist/runtime/editor/components/index.js +32 -10
  83. package/dist/runtime/editor/composables/defineRenderer.d.ts +2 -2
  84. package/dist/runtime/editor/composables/defineRenderer.js +8 -3
  85. package/dist/runtime/editor/css/output.css +1 -1
  86. package/dist/runtime/editor/events/index.d.ts +6 -0
  87. package/dist/runtime/editor/features/analyze/Main.d.vue.ts +1 -0
  88. package/dist/runtime/editor/features/analyze/Main.vue +9 -8
  89. package/dist/runtime/editor/features/analyze/Main.vue.d.ts +1 -0
  90. package/dist/runtime/editor/features/analyze/Results/ResultsItem.vue +7 -15
  91. package/dist/runtime/editor/features/analyze/Results/ResultsItemNodesTarget.vue +4 -2
  92. package/dist/runtime/editor/features/analyze/analyzers/axe.js +9 -9
  93. package/dist/runtime/editor/features/analyze/analyzers/readability.js +7 -7
  94. package/dist/runtime/editor/features/analyze/index.vue +26 -26
  95. package/dist/runtime/editor/features/analyze/readability/types.d.ts +18 -14
  96. package/dist/runtime/editor/features/anchors/index.vue +6 -2
  97. package/dist/runtime/editor/features/artboard/Renderer.vue +3 -2
  98. package/dist/runtime/editor/features/block-scheduler/Dialog/index.vue +78 -0
  99. package/dist/runtime/editor/features/block-scheduler/index.vue +34 -89
  100. package/dist/runtime/editor/features/breadcrumbs/index.vue +2 -2
  101. package/dist/runtime/editor/features/changelog/changelog.json +8 -0
  102. package/dist/runtime/editor/features/changelog/index.vue +10 -8
  103. package/dist/runtime/editor/features/clipboard/DropElement/index.vue +152 -0
  104. package/dist/runtime/editor/features/clipboard/index.vue +13 -159
  105. package/dist/runtime/editor/features/command-palette/Palette/Item/index.vue +0 -28
  106. package/dist/runtime/editor/features/command-palette/Palette/index.vue +17 -6
  107. package/dist/runtime/editor/features/command-palette/index.vue +7 -2
  108. package/dist/runtime/editor/features/comments/index.vue +6 -3
  109. package/dist/runtime/editor/features/debug/Main.vue +168 -0
  110. package/dist/runtime/editor/features/debug/Section/Features.vue +1 -2
  111. package/dist/runtime/editor/features/debug/index.vue +6 -170
  112. package/dist/runtime/editor/features/dev-mode/index.vue +2 -1
  113. package/dist/runtime/editor/features/diff/index.vue +6 -2
  114. package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue +15 -16
  115. package/dist/runtime/editor/features/dragging-overlay/index.vue +4 -3
  116. package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.d.vue.ts +15 -0
  117. package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.vue +547 -0
  118. package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.vue.d.ts +15 -0
  119. package/dist/runtime/editor/features/droppable-field-edit/index.d.vue.ts +3 -0
  120. package/dist/runtime/editor/features/droppable-field-edit/index.vue +231 -0
  121. package/dist/runtime/editor/features/droppable-field-edit/index.vue.d.ts +3 -0
  122. package/dist/runtime/editor/features/droppable-field-edit/types.d.ts +70 -0
  123. package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.d.vue.ts +2 -2
  124. package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue.d.ts +2 -2
  125. package/dist/runtime/editor/features/editable-field/Overlay/ReadabilityIndicator/ChunkOverlay.vue +1 -1
  126. package/dist/runtime/editor/features/editable-field/Overlay/ReadabilityIndicator/index.vue +6 -13
  127. package/dist/runtime/editor/features/editable-field/Overlay/index.vue +3 -4
  128. package/dist/runtime/editor/features/fragments/index.vue +9 -4
  129. package/dist/runtime/editor/features/help/index.vue +7 -2
  130. package/dist/runtime/editor/features/highlights/Renderer/index.vue +11 -17
  131. package/dist/runtime/editor/features/history/index.vue +3 -2
  132. package/dist/runtime/editor/features/hover/Renderer/index.vue +87 -36
  133. package/dist/runtime/editor/features/hover/Renderer/vertex.glsl +5 -5
  134. package/dist/runtime/editor/features/hover/index.vue +1 -1
  135. package/dist/runtime/editor/features/import-existing/Dialog/Item.d.vue.ts +5 -0
  136. package/dist/runtime/editor/features/import-existing/Dialog/Item.vue +55 -0
  137. package/dist/runtime/editor/features/import-existing/Dialog/Item.vue.d.ts +5 -0
  138. package/dist/runtime/editor/features/import-existing/Dialog/index.d.vue.ts +7 -3
  139. package/dist/runtime/editor/features/import-existing/Dialog/index.vue +107 -65
  140. package/dist/runtime/editor/features/import-existing/Dialog/index.vue.d.ts +7 -3
  141. package/dist/runtime/editor/features/import-existing/index.vue +19 -6
  142. package/dist/runtime/editor/features/import-existing/types.d.ts +0 -11
  143. package/dist/runtime/editor/features/library/ReusableDialog/index.vue +7 -33
  144. package/dist/runtime/editor/features/library/index.vue +14 -5
  145. package/dist/runtime/editor/features/media-library/Library/index.vue +3 -1
  146. package/dist/runtime/editor/features/media-library/index.vue +9 -2
  147. package/dist/runtime/editor/features/media-library/types.d.ts +2 -0
  148. package/dist/runtime/editor/features/multi-select/Renderer/index.vue +16 -15
  149. package/dist/runtime/editor/features/multi-select/index.vue +9 -3
  150. package/dist/runtime/editor/features/options/Form/Radios/index.vue +4 -8
  151. package/dist/runtime/editor/features/options/index.vue +7 -2
  152. package/dist/runtime/editor/features/preview-grant/index.vue +8 -2
  153. package/dist/runtime/editor/features/publish/index.vue +3 -2
  154. package/dist/runtime/editor/features/referenced-entities/index.vue +7 -2
  155. package/dist/runtime/editor/features/responsive-preview/index.vue +13 -11
  156. package/dist/runtime/editor/features/search/index.vue +6 -2
  157. package/dist/runtime/editor/features/selection/AddButtons/Renderer/index.vue +6 -11
  158. package/dist/runtime/editor/features/selection/Renderer/index.vue +9 -14
  159. package/dist/runtime/editor/features/selection/index.vue +7 -4
  160. package/dist/runtime/editor/features/settings/index.vue +8 -3
  161. package/dist/runtime/editor/features/structure/index.vue +3 -2
  162. package/dist/runtime/editor/features/templates/CreateDialog/index.vue +1 -0
  163. package/dist/runtime/editor/features/templates/index.vue +14 -6
  164. package/dist/runtime/editor/features/theme/index.vue +2 -1
  165. package/dist/runtime/editor/features/tour/index.vue +6 -2
  166. package/dist/runtime/editor/features/translations/index.vue +7 -4
  167. package/dist/runtime/editor/features/workspace/Overlay/Item.d.vue.ts +3 -0
  168. package/dist/runtime/editor/features/workspace/Overlay/Item.vue +49 -0
  169. package/dist/runtime/editor/features/workspace/Overlay/Item.vue.d.ts +3 -0
  170. package/dist/runtime/editor/features/workspace/Overlay/index.vue +16 -104
  171. package/dist/runtime/editor/features/workspace/index.vue +6 -2
  172. package/dist/runtime/editor/helpers/webgl/index.d.ts +3 -2
  173. package/dist/runtime/editor/helpers/webgl/index.js +2 -3
  174. package/dist/runtime/editor/libraries/fzf.d.ts +3 -0
  175. package/dist/runtime/editor/libraries/fzf.js +7 -0
  176. package/dist/runtime/editor/libraries/twgl.d.ts +10 -0
  177. package/dist/runtime/editor/libraries/twgl.js +14 -0
  178. package/dist/runtime/editor/plugins/DebugOverlay/index.vue +3 -1
  179. package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue +39 -18
  180. package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +2 -0
  181. package/dist/runtime/editor/plugins/Sidebar/index.vue +12 -4
  182. package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +2 -0
  183. package/dist/runtime/editor/providers/animation.d.ts +5 -10
  184. package/dist/runtime/editor/providers/animation.js +10 -8
  185. package/dist/runtime/editor/providers/directive.d.ts +11 -0
  186. package/dist/runtime/editor/providers/directive.js +16 -0
  187. package/dist/runtime/editor/providers/features.d.ts +3 -3
  188. package/dist/runtime/editor/providers/features.js +1 -1
  189. package/dist/runtime/editor/providers/fieldValue.d.ts +27 -0
  190. package/dist/runtime/editor/providers/fieldValue.js +21 -1
  191. package/dist/runtime/editor/providers/keyboard.js +6 -3
  192. package/dist/runtime/editor/providers/readability.d.ts +28 -4
  193. package/dist/runtime/editor/providers/readability.js +30 -46
  194. package/dist/runtime/editor/providers/selection.d.ts +8 -0
  195. package/dist/runtime/editor/providers/selection.js +6 -0
  196. package/dist/runtime/editor/providers/texts.d.ts +1 -3
  197. package/dist/runtime/editor/providers/texts.js +34 -37
  198. package/dist/runtime/editor/providers/workspaces.d.ts +93 -0
  199. package/dist/runtime/editor/providers/workspaces.js +76 -0
  200. package/dist/runtime/editor/translations/de.json +918 -3616
  201. package/dist/runtime/editor/translations/fr.json +250 -3616
  202. package/dist/runtime/editor/translations/gsw_CH.json +918 -3616
  203. package/dist/runtime/editor/translations/it.json +250 -3616
  204. package/dist/runtime/editor/types/app.d.ts +2 -0
  205. package/dist/runtime/editor/types/features.d.ts +1 -1
  206. package/dist/runtime/editor/types/state.d.ts +7 -0
  207. package/dist/runtime/helpers/injections.d.ts +6 -0
  208. package/dist/runtime/helpers/injections.js +3 -0
  209. package/dist/runtime/types/definitions.d.ts +4 -0
  210. package/package.json +14 -4
  211. package/dist/runtime/editor/features/analyze/readability/builtinAnalyzer.d.ts +0 -6
  212. package/dist/runtime/editor/features/analyze/readability/builtinAnalyzer.js +0 -216
  213. package/dist/runtime/editor/features/workspace/types.d.ts +0 -59
  214. /package/dist/runtime/editor/features/{workspace → droppable-field-edit}/types.js +0 -0
@@ -0,0 +1,231 @@
1
+ <template>
2
+ <Teleport v-if="ui.mainLayoutElement.value" :to="ui.mainLayoutElement.value">
3
+ <BlokkliTransition name="caret-tooltip" :enabled="hasTransition">
4
+ <Overlay
5
+ v-if="activeField"
6
+ v-bind="activeField"
7
+ :key="activeFieldKey"
8
+ @close="close"
9
+ />
10
+ </BlokkliTransition>
11
+ </Teleport>
12
+ </template>
13
+
14
+ <script setup>
15
+ import {
16
+ computed,
17
+ ref,
18
+ useBlokkli,
19
+ defineBlokkliFeature,
20
+ watch,
21
+ defineAsyncComponent
22
+ } from "#imports";
23
+ import {
24
+ onBlokkliEvent,
25
+ defineDropAreas,
26
+ defineCommands,
27
+ defineDropHandler
28
+ } from "#blokkli/editor/composables";
29
+ import { itemEntityType } from "#blokkli-build/config";
30
+ import { falsy } from "#blokkli/helpers";
31
+ import { BlokkliTransition } from "#blokkli/editor/components";
32
+ const Overlay = defineAsyncComponent(() => import("./Overlay/index.vue"));
33
+ defineBlokkliFeature({
34
+ id: "droppable-field-edit",
35
+ icon: "bk_mdi_edit",
36
+ label: "Droppable Field Edit",
37
+ description: "Editing mode for multi-value droppable fields (add, remove, reorder items).",
38
+ requiredAdapterMethods: ["getDroppableFieldItems", "updateDroppableField"]
39
+ });
40
+ const {
41
+ selection,
42
+ ui,
43
+ directive,
44
+ types,
45
+ state,
46
+ adapter,
47
+ fieldValue,
48
+ permissions,
49
+ $t
50
+ } = useBlokkli();
51
+ const activeField = ref(null);
52
+ const hasTransition = ref(false);
53
+ const activeFieldKey = computed(() => {
54
+ if (!activeField.value) {
55
+ return "";
56
+ }
57
+ return activeField.value.entity.uuid + activeField.value.fieldName;
58
+ });
59
+ function openField(field) {
60
+ hasTransition.value = !activeField.value;
61
+ selection.activeDroppableFieldLabel.value = field.config.label;
62
+ activeField.value = field;
63
+ }
64
+ function close() {
65
+ activeField.value = null;
66
+ selection.activeDroppableFieldLabel.value = null;
67
+ }
68
+ defineCommands(() => {
69
+ if (selection.items.value.length !== 1) {
70
+ return [];
71
+ }
72
+ const block = selection.items.value[0];
73
+ return directive.getDroppableElements().filter(
74
+ (field) => field.uuid === block.uuid && field.type === itemEntityType
75
+ ).map((field) => {
76
+ const config = types.getDroppableFieldConfig(field.fieldName, field);
77
+ if (config.type !== "reference") {
78
+ return;
79
+ }
80
+ return {
81
+ id: `feature:droppable-field:edit:${field.uuid}:${field.fieldName}`,
82
+ group: "selection",
83
+ label: $t("droppableFieldCommandEdit", 'Edit field "@name"').replace(
84
+ "@name",
85
+ config.label
86
+ ),
87
+ icon: "bk_mdi_edit",
88
+ disabled: false,
89
+ callback: () => openField({
90
+ fieldName: field.fieldName,
91
+ entity: {
92
+ type: field.type,
93
+ bundle: field.bundle,
94
+ uuid: field.uuid
95
+ },
96
+ element: field.element,
97
+ config
98
+ })
99
+ };
100
+ }).filter(falsy);
101
+ });
102
+ onBlokkliEvent("droppable:open", (e) => {
103
+ if (!state.canEdit.value) {
104
+ return;
105
+ }
106
+ const droppableElements = directive.getDroppableElements();
107
+ const field = droppableElements.find(
108
+ (f) => f.uuid === e.uuid && f.fieldName === e.fieldName
109
+ );
110
+ if (!field) {
111
+ return;
112
+ }
113
+ const config = types.getDroppableFieldConfig(e.fieldName, field);
114
+ if (config.type !== "reference") {
115
+ return;
116
+ }
117
+ openField({
118
+ fieldName: e.fieldName,
119
+ entity: {
120
+ type: field.type,
121
+ bundle: field.bundle,
122
+ uuid: field.uuid
123
+ },
124
+ element: field.element,
125
+ config
126
+ });
127
+ });
128
+ watch(selection.activeDroppableFieldLabel, (v) => {
129
+ if (!v && activeField.value) {
130
+ hasTransition.value = true;
131
+ activeField.value = null;
132
+ }
133
+ });
134
+ watch(activeField, (v) => {
135
+ if (!v && selection.activeDroppableFieldLabel.value) {
136
+ selection.activeDroppableFieldLabel.value = null;
137
+ }
138
+ });
139
+ defineDropAreas((dragItems) => {
140
+ if (activeField.value) {
141
+ return;
142
+ }
143
+ if (!adapter.updateDroppableField || !adapter.getDroppableFieldItems) {
144
+ return;
145
+ }
146
+ if (dragItems.length !== 1) {
147
+ return;
148
+ }
149
+ const item = dragItems[0];
150
+ if (item.itemType !== "media_library") {
151
+ return;
152
+ }
153
+ return directive.getDroppableElements().map((field) => {
154
+ if (field.type !== itemEntityType) {
155
+ return;
156
+ }
157
+ const config = types.getDroppableFieldConfig(field.fieldName, field);
158
+ if (config.cardinality === 1) {
159
+ return;
160
+ }
161
+ const allowedBundles = config.allowed.find(
162
+ (v) => v.type === "media"
163
+ )?.bundles;
164
+ if (!allowedBundles || !allowedBundles.includes(item.mediaBundle)) {
165
+ return;
166
+ }
167
+ const currentCount = fieldValue.getDroppableFieldCount(
168
+ field.fieldName,
169
+ field
170
+ );
171
+ if (config.cardinality > 0 && currentCount >= config.cardinality) {
172
+ return;
173
+ }
174
+ const host = {
175
+ uuid: field.uuid,
176
+ type: field.type,
177
+ fieldName: field.fieldName
178
+ };
179
+ return {
180
+ id: `droppable-field-add:${field.uuid}:${field.fieldName}`,
181
+ label: $t("droppableFieldAdd", "Add to @field").replace(
182
+ "@field",
183
+ config.label
184
+ ),
185
+ element: field.element,
186
+ icon: "bk_mdi_add",
187
+ onDrop: () => {
188
+ const currentIds = fieldValue.getDroppableFieldIds(
189
+ field.fieldName,
190
+ field
191
+ );
192
+ const itemIds = [...currentIds, item.mediaId];
193
+ return state.mutateWithLoadingState(
194
+ () => adapter.updateDroppableField({ host, itemIds }),
195
+ $t("droppableFieldAddFailed", "Failed to add item.")
196
+ );
197
+ }
198
+ };
199
+ }).filter(falsy);
200
+ });
201
+ defineDropHandler("droppable_field_item", {
202
+ resolveBundles({ items, field }) {
203
+ const item = items[0];
204
+ return field.allowedBundles.filter(
205
+ (b) => item.itemBundles.includes(b) && permissions.checkBlockBundlePermission(b, "add")
206
+ );
207
+ },
208
+ async execute({ items, host, afterUuid, bundle }) {
209
+ if (!adapter.addEntityReferenceBlock) {
210
+ throw new Error('Adapter does not implement "addEntityReferenceBlock".');
211
+ }
212
+ const item = items[0];
213
+ await state.mutateWithLoadingState(
214
+ () => adapter.addEntityReferenceBlock({
215
+ entityId: item.entityId,
216
+ entityType: item.entityType,
217
+ entityBundle: item.entityBundle,
218
+ host,
219
+ bundle,
220
+ afterUuid
221
+ })
222
+ );
223
+ }
224
+ });
225
+ </script>
226
+
227
+ <script>
228
+ export default {
229
+ name: "DroppableFieldEdit"
230
+ };
231
+ </script>
@@ -0,0 +1,3 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,70 @@
1
+ import type { BlokkliItemHost } from '#blokkli/editor/types/field';
2
+ export type DroppableFieldItem = {
3
+ id: string;
4
+ entityType: string;
5
+ bundle: string;
6
+ label: string;
7
+ thumbnailSrc?: string;
8
+ /**
9
+ * The block bundles that can be produced from this referenced entity when
10
+ * dropped onto the page. Mirrors `MediaLibraryItem.targetBundles`.
11
+ */
12
+ targetBundles: string[];
13
+ };
14
+ export type DroppableFieldGetItemsEvent = {
15
+ host: BlokkliItemHost;
16
+ };
17
+ export type DroppableFieldUpdateEvent = {
18
+ host: BlokkliItemHost;
19
+ /**
20
+ * The new ordered list of entity IDs the field should hold. Missing IDs are
21
+ * removed; unknown IDs are attached.
22
+ */
23
+ itemIds: string[];
24
+ };
25
+ export interface DraggableDroppableFieldItem {
26
+ itemType: 'droppable_field_item';
27
+ element: () => HTMLElement;
28
+ itemBundles: string[];
29
+ entityId: string;
30
+ entityType: string;
31
+ entityBundle: string;
32
+ label: string;
33
+ thumbnailSrc?: string;
34
+ }
35
+ export type AddEntityReferenceBlockEvent = {
36
+ entityId: string;
37
+ entityType: string;
38
+ entityBundle: string;
39
+ host: BlokkliItemHost;
40
+ bundle: string;
41
+ afterUuid: string | null;
42
+ };
43
+ declare module '#blokkli/editor/adapter' {
44
+ interface BlokkliAdapter<T> {
45
+ /**
46
+ * Get all items of a multi-value droppable field.
47
+ */
48
+ getDroppableFieldItems?: (e: DroppableFieldGetItemsEvent) => Promise<DroppableFieldItem[]>;
49
+ /**
50
+ * Atomically update the items of a multi-value droppable field.
51
+ *
52
+ * `itemIds` is the complete desired state as an ordered list of entity
53
+ * IDs. IDs already in the field are kept (and reordered); missing IDs are
54
+ * removed; new IDs are attached.
55
+ */
56
+ updateDroppableField?: (e: DroppableFieldUpdateEvent) => Promise<MutationResponseLike<T>>;
57
+ /**
58
+ * Create a new block by referencing an existing entity.
59
+ *
60
+ * Generic counterpart to `mediaLibraryAddBlock` / `addContentSearchItem` —
61
+ * all three route to the same Drupal `pbAddEntityReference` mutation.
62
+ */
63
+ addEntityReferenceBlock?: (e: AddEntityReferenceBlockEvent) => Promise<MutationResponseLike<T>> | undefined;
64
+ }
65
+ }
66
+ declare module '#blokkli/editor/types/draggable' {
67
+ interface DraggableItemTypes {
68
+ droppable_field_item: DraggableDroppableFieldItem;
69
+ }
70
+ }
@@ -8,13 +8,13 @@ type __VLS_ModelProps = {
8
8
  };
9
9
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
10
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
- discard: (...args: any[]) => void;
12
11
  save: (...args: any[]) => void;
12
+ discard: (...args: any[]) => void;
13
13
  "update:modelValue": (value: string) => void;
14
14
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
15
15
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
16
- onDiscard?: ((...args: any[]) => any) | undefined;
17
16
  onSave?: ((...args: any[]) => any) | undefined;
17
+ onDiscard?: ((...args: any[]) => any) | undefined;
18
18
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
19
  declare const _default: typeof __VLS_export;
20
20
  export default _default;
@@ -8,13 +8,13 @@ type __VLS_ModelProps = {
8
8
  };
9
9
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
10
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
- discard: (...args: any[]) => void;
12
11
  save: (...args: any[]) => void;
12
+ discard: (...args: any[]) => void;
13
13
  "update:modelValue": (value: string) => void;
14
14
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
15
15
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
16
- onDiscard?: ((...args: any[]) => any) | undefined;
17
16
  onSave?: ((...args: any[]) => any) | undefined;
17
+ onDiscard?: ((...args: any[]) => any) | undefined;
18
18
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
19
  declare const _default: typeof __VLS_export;
20
20
  export default _default;
@@ -41,7 +41,7 @@ const chunks = ref([]);
41
41
  const stale = ref(false);
42
42
  let timeout = null;
43
43
  let lastFullUpdate = 0;
44
- const scoreLabel = computed(() => readability.analyzer.value.scoreLabel);
44
+ const scoreLabel = readability.scoreLabel;
45
45
  function formatScore(value) {
46
46
  return readability.formatScore(value);
47
47
  }
@@ -9,7 +9,7 @@
9
9
  :class="'bk-is-' + readabilityBand"
10
10
  />
11
11
  <span
12
- >{{ readability.analyzer.value.scoreLabel }}
12
+ >{{ readability.scoreLabel.value }}
13
13
  {{ readability.formatScore(readabilityScore) }}</span
14
14
  >
15
15
  <Tooltip
@@ -18,7 +18,7 @@
18
18
  $t(
19
19
  'readabilityTooltipDescription',
20
20
  '@label measures how easy the text is to read.'
21
- ).replace('@label', readability.analyzer.value.scoreLabel)
21
+ ).replace('@label', readability.scoreLabel.value)
22
22
  "
23
23
  :description="
24
24
  fieldType === 'markup' ? $t(
@@ -100,13 +100,9 @@ const readabilityScore = ref(null);
100
100
  const tooShort = ref(false);
101
101
  const stale = ref(false);
102
102
  let timeout = null;
103
- const scaleInfo = computed(() => {
104
- const analyzer = readability.analyzer.value;
105
- if (analyzer.getScaleInfo) {
106
- return analyzer.getScaleInfo(context.value.language);
107
- }
108
- return null;
109
- });
103
+ const scaleInfo = computed(
104
+ () => readability.getScaleInfo(context.value.language)
105
+ );
110
106
  const thresholdPositions = computed(() => {
111
107
  const info = scaleInfo.value;
112
108
  if (!info) return { first: 33, second: 66 };
@@ -128,10 +124,7 @@ const minWordsText = computed(
128
124
  () => $t(
129
125
  "readabilityTooShortTooltip",
130
126
  "Text needs at least @count words for readability analysis."
131
- ).replace(
132
- "@count",
133
- String(readability.analyzer.value.minWordsForConfidence || 100)
134
- )
127
+ ).replace("@count", String(readability.minWordsForConfidence.value || 100))
135
128
  );
136
129
  async function analyze(text) {
137
130
  if (!text.trim()) {
@@ -153,7 +153,8 @@ const {
153
153
  context,
154
154
  fieldValue,
155
155
  element: elementProvider,
156
- storage
156
+ storage,
157
+ readability
157
158
  } = useBlokkli();
158
159
  const props = defineProps({
159
160
  fieldName: { type: String, required: true },
@@ -210,7 +211,7 @@ const errorText = computed(() => {
210
211
  return void 0;
211
212
  });
212
213
  const isReadabilityField = computed(
213
- () => props.config.type === "plain" || props.config.type === "markup" || props.config.type === "frame"
214
+ () => readability.isAvailable.value && (props.config.type === "plain" || props.config.type === "markup" || props.config.type === "frame")
214
215
  );
215
216
  const readabilityFieldType = computed(
216
217
  () => props.config.type === "frame" || props.config.type === "markup" ? "markup" : "plain"
@@ -283,8 +284,6 @@ async function save() {
283
284
  }
284
285
  isClosing.value = true;
285
286
  if (hasChanged.value) {
286
- console.log("modelValue", modelValue.value);
287
- console.log("originalText", originalText.value);
288
287
  if (errorText.value) {
289
288
  restoreOriginalState();
290
289
  } else {
@@ -12,18 +12,23 @@
12
12
  </template>
13
13
 
14
14
  <script setup>
15
- import { ref, useBlokkli, defineBlokkliFeature, computed } from "#imports";
16
- import FragmentsDialog from "./Dialog/index.vue";
15
+ import {
16
+ ref,
17
+ useBlokkli,
18
+ defineBlokkliFeature,
19
+ computed,
20
+ defineAsyncComponent
21
+ } from "#imports";
17
22
  import { BlokkliTransition } from "#blokkli/editor/components";
18
23
  import { defineAddAction } from "#blokkli/editor/composables";
19
24
  import { fragmentBlockBundle } from "#blokkli-build/config";
25
+ const FragmentsDialog = defineAsyncComponent(() => import("./Dialog/index.vue"));
20
26
  const { adapter } = defineBlokkliFeature({
21
27
  id: "fragments",
22
28
  icon: "bk_mdi_newspaper",
23
29
  label: "Fragments",
24
30
  description: "Provides way to add content fragments defined by the frontend.",
25
- requiredAdapterMethods: ["fragmentsAddBlock"],
26
- dependencies: ["add-list"]
31
+ requiredAdapterMethods: ["fragmentsAddBlock"]
27
32
  });
28
33
  const { state, $t, types, dom, ui, permissions } = useBlokkli();
29
34
  const canAddFragment = computed(
@@ -26,9 +26,14 @@
26
26
  </template>
27
27
 
28
28
  <script setup>
29
- import { useBlokkli, defineBlokkliFeature, computed } from "#imports";
29
+ import {
30
+ useBlokkli,
31
+ defineBlokkliFeature,
32
+ computed,
33
+ defineAsyncComponent
34
+ } from "#imports";
30
35
  import { PluginSidebar } from "#blokkli/editor/plugins";
31
- import Shortcuts from "./Shortcuts/index.vue";
36
+ const Shortcuts = defineAsyncComponent(() => import("./Shortcuts/index.vue"));
32
37
  defineBlokkliFeature({
33
38
  id: "help",
34
39
  icon: "bk_mdi_help",
@@ -31,12 +31,6 @@
31
31
 
32
32
  <script setup>
33
33
  import { useBlokkli, computed, ref } from "#imports";
34
- import {
35
- setBuffersAndAttributes,
36
- drawBufferInfo,
37
- setUniforms,
38
- createBufferInfoFromArrays
39
- } from "twgl.js";
40
34
  import vs from "./vertex.glsl?raw";
41
35
  import fs from "./fragment.glsl?raw";
42
36
  import { RectangleBufferCollector } from "#blokkli/editor/helpers/webgl";
@@ -129,8 +123,8 @@ class HighlightsRectangleBufferCollector extends RectangleBufferCollector {
129
123
  this.activeData.push(a);
130
124
  }
131
125
  }
132
- createBufferInfo(gl) {
133
- return createBufferInfoFromArrays(gl, {
126
+ createBufferInfo(gl, twgl) {
127
+ return twgl.createBufferInfoFromArrays(gl, {
134
128
  a_position: {
135
129
  numComponents: 3,
136
130
  data: this.positions,
@@ -179,7 +173,7 @@ class HighlightsRectangleBufferCollector extends RectangleBufferCollector {
179
173
  indices: this.indices
180
174
  });
181
175
  }
182
- getBufferInfo(gl, force) {
176
+ getBufferInfo(gl, twgl, force) {
183
177
  const activeId = ui.activeHighlightId.value;
184
178
  const key = activeId + "_" + groups.value.map((group, index) => {
185
179
  const colors = group.highlights.map((h) => h.color).join(",");
@@ -234,29 +228,29 @@ class HighlightsRectangleBufferCollector extends RectangleBufferCollector {
234
228
  }
235
229
  this.prevKey = key;
236
230
  }
237
- if (hasChanged && gl) {
238
- this.bufferInfo = this.createBufferInfo(gl);
231
+ if (hasChanged && gl && twgl) {
232
+ this.bufferInfo = this.createBufferInfo(gl, twgl);
239
233
  }
240
234
  return { info: this.bufferInfo, hasChanged };
241
235
  }
242
236
  }
243
- const { collector } = defineRenderer("highlights-overlay", {
237
+ const { collector } = await defineRenderer("highlights-overlay", {
244
238
  zIndex: 500,
245
239
  collector: () => new HighlightsRectangleBufferCollector(),
246
240
  program: () => ({ shaders: [vs, fs] }),
247
241
  enabled: () => !selection.isMultiSelecting.value && !selection.isDragging.value && !ui.isChangingOptions.value && !selection.activeEditableLabel.value && !ui.isApproving.value,
248
- render: (_ctx, gl, program) => {
242
+ render: (_ctx, gl, program, twgl) => {
249
243
  gl.useProgram(program.program);
250
- const { info } = collector.getBufferInfo(gl);
244
+ const { info } = collector.getBufferInfo(gl, twgl);
251
245
  if (!info) {
252
246
  return;
253
247
  }
254
- setUniforms(program, {
248
+ twgl.setUniforms(program, {
255
249
  u_opacity: 1
256
250
  });
257
251
  animation.setSharedUniforms(gl, program);
258
- setBuffersAndAttributes(gl, program, info);
259
- drawBufferInfo(gl, info, gl.TRIANGLES);
252
+ twgl.setBuffersAndAttributes(gl, program, info);
253
+ twgl.drawBufferInfo(gl, info, gl.TRIANGLES);
260
254
  },
261
255
  renderFallback: (ctx, ctx2d) => {
262
256
  collector.getBufferInfo();
@@ -48,11 +48,12 @@ import {
48
48
  watch,
49
49
  defineBlokkliFeature,
50
50
  onMounted,
51
- onBeforeUnmount
51
+ onBeforeUnmount,
52
+ defineAsyncComponent
52
53
  } from "#imports";
53
54
  import { PluginSidebar, PluginToolbarButton } from "#blokkli/editor/plugins";
54
- import HistoryList from "./List/index.vue";
55
55
  import { MOUSE_BUTTON } from "#blokkli/editor/helpers/dom";
56
+ const HistoryList = defineAsyncComponent(() => import("./List/index.vue"));
56
57
  const { adapter, settings } = defineBlokkliFeature({
57
58
  id: "history",
58
59
  icon: "bk_mdi_history",