@blokkli/editor 2.0.0-alpha.53 → 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 (218) 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/Toolbar/index.vue +1 -1
  82. package/dist/runtime/editor/components/index.d.ts +11 -10
  83. package/dist/runtime/editor/components/index.js +32 -10
  84. package/dist/runtime/editor/composables/defineRenderer.d.ts +2 -2
  85. package/dist/runtime/editor/composables/defineRenderer.js +8 -3
  86. package/dist/runtime/editor/css/output.css +1 -1
  87. package/dist/runtime/editor/events/index.d.ts +6 -0
  88. package/dist/runtime/editor/features/analyze/Main.d.vue.ts +1 -0
  89. package/dist/runtime/editor/features/analyze/Main.vue +9 -8
  90. package/dist/runtime/editor/features/analyze/Main.vue.d.ts +1 -0
  91. package/dist/runtime/editor/features/analyze/Results/ResultsItem.vue +7 -15
  92. package/dist/runtime/editor/features/analyze/Results/ResultsItemNodesTarget.vue +4 -2
  93. package/dist/runtime/editor/features/analyze/analyzers/axe.js +9 -9
  94. package/dist/runtime/editor/features/analyze/analyzers/readability.js +7 -7
  95. package/dist/runtime/editor/features/analyze/index.vue +26 -26
  96. package/dist/runtime/editor/features/analyze/readability/types.d.ts +18 -14
  97. package/dist/runtime/editor/features/anchors/index.vue +6 -2
  98. package/dist/runtime/editor/features/artboard/Renderer.vue +3 -2
  99. package/dist/runtime/editor/features/block-scheduler/Dialog/index.vue +78 -0
  100. package/dist/runtime/editor/features/block-scheduler/index.vue +34 -89
  101. package/dist/runtime/editor/features/breadcrumbs/index.vue +2 -2
  102. package/dist/runtime/editor/features/changelog/changelog.json +8 -0
  103. package/dist/runtime/editor/features/changelog/index.vue +10 -8
  104. package/dist/runtime/editor/features/clipboard/DropElement/index.vue +152 -0
  105. package/dist/runtime/editor/features/clipboard/index.vue +13 -159
  106. package/dist/runtime/editor/features/command-palette/Palette/Item/index.vue +0 -28
  107. package/dist/runtime/editor/features/command-palette/Palette/index.vue +17 -6
  108. package/dist/runtime/editor/features/command-palette/index.vue +7 -2
  109. package/dist/runtime/editor/features/comments/index.vue +6 -3
  110. package/dist/runtime/editor/features/debug/Main.vue +168 -0
  111. package/dist/runtime/editor/features/debug/Section/Features.vue +1 -2
  112. package/dist/runtime/editor/features/debug/index.vue +6 -170
  113. package/dist/runtime/editor/features/dev-mode/index.vue +2 -1
  114. package/dist/runtime/editor/features/diff/index.vue +6 -2
  115. package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue +15 -16
  116. package/dist/runtime/editor/features/dragging-overlay/index.vue +4 -3
  117. package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.d.vue.ts +15 -0
  118. package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.vue +547 -0
  119. package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.vue.d.ts +15 -0
  120. package/dist/runtime/editor/features/droppable-field-edit/index.d.vue.ts +3 -0
  121. package/dist/runtime/editor/features/droppable-field-edit/index.vue +231 -0
  122. package/dist/runtime/editor/features/droppable-field-edit/index.vue.d.ts +3 -0
  123. package/dist/runtime/editor/features/droppable-field-edit/types.d.ts +70 -0
  124. package/dist/runtime/editor/features/editable-field/Overlay/Frame/index.d.vue.ts +1 -0
  125. package/dist/runtime/editor/features/editable-field/Overlay/Frame/index.vue +34 -21
  126. package/dist/runtime/editor/features/editable-field/Overlay/Frame/index.vue.d.ts +1 -0
  127. package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.d.vue.ts +2 -2
  128. package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue.d.ts +2 -2
  129. package/dist/runtime/editor/features/editable-field/Overlay/ReadabilityIndicator/ChunkOverlay.vue +1 -1
  130. package/dist/runtime/editor/features/editable-field/Overlay/ReadabilityIndicator/index.vue +6 -13
  131. package/dist/runtime/editor/features/editable-field/Overlay/index.vue +4 -4
  132. package/dist/runtime/editor/features/fragments/index.vue +9 -4
  133. package/dist/runtime/editor/features/help/index.vue +7 -2
  134. package/dist/runtime/editor/features/highlights/Renderer/index.vue +11 -17
  135. package/dist/runtime/editor/features/history/index.vue +3 -2
  136. package/dist/runtime/editor/features/hover/Renderer/index.vue +87 -36
  137. package/dist/runtime/editor/features/hover/Renderer/vertex.glsl +5 -5
  138. package/dist/runtime/editor/features/hover/index.vue +1 -1
  139. package/dist/runtime/editor/features/import-existing/Dialog/Item.d.vue.ts +5 -0
  140. package/dist/runtime/editor/features/import-existing/Dialog/Item.vue +55 -0
  141. package/dist/runtime/editor/features/import-existing/Dialog/Item.vue.d.ts +5 -0
  142. package/dist/runtime/editor/features/import-existing/Dialog/index.d.vue.ts +7 -3
  143. package/dist/runtime/editor/features/import-existing/Dialog/index.vue +107 -65
  144. package/dist/runtime/editor/features/import-existing/Dialog/index.vue.d.ts +7 -3
  145. package/dist/runtime/editor/features/import-existing/index.vue +19 -6
  146. package/dist/runtime/editor/features/import-existing/types.d.ts +0 -11
  147. package/dist/runtime/editor/features/library/ReusableDialog/index.vue +7 -33
  148. package/dist/runtime/editor/features/library/index.vue +14 -5
  149. package/dist/runtime/editor/features/media-library/Library/index.vue +3 -1
  150. package/dist/runtime/editor/features/media-library/index.vue +9 -2
  151. package/dist/runtime/editor/features/media-library/types.d.ts +2 -0
  152. package/dist/runtime/editor/features/multi-select/Renderer/index.vue +16 -15
  153. package/dist/runtime/editor/features/multi-select/index.vue +9 -3
  154. package/dist/runtime/editor/features/options/Form/Radios/index.vue +4 -8
  155. package/dist/runtime/editor/features/options/index.vue +7 -2
  156. package/dist/runtime/editor/features/preview-grant/index.vue +8 -2
  157. package/dist/runtime/editor/features/publish/index.vue +3 -2
  158. package/dist/runtime/editor/features/referenced-entities/index.vue +7 -2
  159. package/dist/runtime/editor/features/responsive-preview/index.vue +13 -11
  160. package/dist/runtime/editor/features/search/index.vue +6 -2
  161. package/dist/runtime/editor/features/selection/AddButtons/Renderer/index.vue +6 -11
  162. package/dist/runtime/editor/features/selection/Renderer/index.vue +9 -14
  163. package/dist/runtime/editor/features/selection/index.vue +7 -4
  164. package/dist/runtime/editor/features/settings/index.vue +8 -3
  165. package/dist/runtime/editor/features/structure/index.vue +3 -2
  166. package/dist/runtime/editor/features/templates/CreateDialog/index.vue +1 -0
  167. package/dist/runtime/editor/features/templates/index.vue +14 -6
  168. package/dist/runtime/editor/features/theme/index.vue +2 -1
  169. package/dist/runtime/editor/features/tour/index.vue +6 -2
  170. package/dist/runtime/editor/features/translations/index.vue +7 -4
  171. package/dist/runtime/editor/features/workspace/Overlay/Item.d.vue.ts +3 -0
  172. package/dist/runtime/editor/features/workspace/Overlay/Item.vue +49 -0
  173. package/dist/runtime/editor/features/workspace/Overlay/Item.vue.d.ts +3 -0
  174. package/dist/runtime/editor/features/workspace/Overlay/index.vue +16 -104
  175. package/dist/runtime/editor/features/workspace/index.vue +6 -2
  176. package/dist/runtime/editor/helpers/webgl/index.d.ts +3 -2
  177. package/dist/runtime/editor/helpers/webgl/index.js +2 -3
  178. package/dist/runtime/editor/libraries/fzf.d.ts +3 -0
  179. package/dist/runtime/editor/libraries/fzf.js +7 -0
  180. package/dist/runtime/editor/libraries/twgl.d.ts +10 -0
  181. package/dist/runtime/editor/libraries/twgl.js +14 -0
  182. package/dist/runtime/editor/plugins/DebugOverlay/index.vue +3 -1
  183. package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue +39 -18
  184. package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +2 -0
  185. package/dist/runtime/editor/plugins/Sidebar/index.vue +12 -4
  186. package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +2 -0
  187. package/dist/runtime/editor/providers/animation.d.ts +5 -10
  188. package/dist/runtime/editor/providers/animation.js +10 -8
  189. package/dist/runtime/editor/providers/directive.d.ts +11 -0
  190. package/dist/runtime/editor/providers/directive.js +16 -0
  191. package/dist/runtime/editor/providers/features.d.ts +3 -3
  192. package/dist/runtime/editor/providers/features.js +1 -1
  193. package/dist/runtime/editor/providers/fieldValue.d.ts +27 -0
  194. package/dist/runtime/editor/providers/fieldValue.js +21 -1
  195. package/dist/runtime/editor/providers/keyboard.js +6 -3
  196. package/dist/runtime/editor/providers/readability.d.ts +28 -4
  197. package/dist/runtime/editor/providers/readability.js +30 -46
  198. package/dist/runtime/editor/providers/selection.d.ts +8 -0
  199. package/dist/runtime/editor/providers/selection.js +6 -0
  200. package/dist/runtime/editor/providers/texts.d.ts +1 -3
  201. package/dist/runtime/editor/providers/texts.js +34 -37
  202. package/dist/runtime/editor/providers/workspaces.d.ts +93 -0
  203. package/dist/runtime/editor/providers/workspaces.js +76 -0
  204. package/dist/runtime/editor/translations/de.json +918 -3616
  205. package/dist/runtime/editor/translations/fr.json +250 -3616
  206. package/dist/runtime/editor/translations/gsw_CH.json +918 -3616
  207. package/dist/runtime/editor/translations/it.json +250 -3616
  208. package/dist/runtime/editor/types/app.d.ts +2 -0
  209. package/dist/runtime/editor/types/features.d.ts +1 -1
  210. package/dist/runtime/editor/types/state.d.ts +7 -0
  211. package/dist/runtime/helpers/injections.d.ts +6 -0
  212. package/dist/runtime/helpers/injections.js +3 -0
  213. package/dist/runtime/types/definitions.d.ts +4 -0
  214. package/package.json +14 -4
  215. package/dist/runtime/editor/features/analyze/readability/builtinAnalyzer.d.ts +0 -6
  216. package/dist/runtime/editor/features/analyze/readability/builtinAnalyzer.js +0 -216
  217. package/dist/runtime/editor/features/workspace/types.d.ts +0 -59
  218. /package/dist/runtime/editor/features/{workspace → droppable-field-edit}/types.js +0 -0
@@ -65,7 +65,8 @@
65
65
  :key="isRenderedDetached ? 'detached' : 'attached'"
66
66
  :scrolled-to-end
67
67
  :is-detached="isRenderedDetached"
68
- :is-shown="isShown"
68
+ :is-shown
69
+ :should-render
69
70
  :width
70
71
  :height
71
72
  :toggle-sidebar
@@ -99,12 +100,13 @@
99
100
  <div ref="sidebarContent" class="bk-sidebar-content">
100
101
  <slot
101
102
  :key="isRenderedDetached ? 'detached' : 'attached'"
102
- :scrolled-to-end="scrolledToEnd"
103
+ :scrolled-to-end
103
104
  :is-detached="isRenderedDetached"
104
- :is-shown="isShown"
105
+ :is-shown
106
+ :should-render
105
107
  :width="undefined"
106
108
  :height="undefined"
107
- :toggle-sidebar="toggleSidebar"
109
+ :toggle-sidebar
108
110
  :is-resizing="false"
109
111
  />
110
112
  </div>
@@ -190,6 +192,12 @@ const isRenderedDetached = computed(
190
192
  const isShown = computed(
191
193
  () => (activeSidebar.value === props.id || isRenderedDetached.value) && !isDisabled.value
192
194
  );
195
+ const shouldRender = ref(isShown.value);
196
+ watch(isShown, (v) => {
197
+ if (v) {
198
+ shouldRender.value = true;
199
+ }
200
+ });
193
201
  watch(isDisabled, (v) => {
194
202
  if (v && activeSidebar.value === props.id) {
195
203
  activeSidebar.value = "";
@@ -217,6 +217,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
217
217
  scrolledToEnd: any;
218
218
  isDetached: any;
219
219
  isShown: any;
220
+ shouldRender: any;
220
221
  width: any;
221
222
  height: any;
222
223
  toggleSidebar: () => void;
@@ -228,6 +229,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
228
229
  scrolledToEnd: any;
229
230
  isDetached: any;
230
231
  isShown: any;
232
+ shouldRender: any;
231
233
  width: undefined;
232
234
  height: undefined;
233
235
  toggleSidebar: () => void;
@@ -1,6 +1,7 @@
1
1
  import { type ComputedRef, type WritableComputedRef } from '#imports';
2
2
  import type { UiProvider } from './ui.js';
3
- import { type ProgramInfo } from 'twgl.js';
3
+ import type { ProgramInfo } from 'twgl.js';
4
+ import type { TwglHelpers } from '../libraries/twgl.js';
4
5
  import type { StorageProvider } from './storage.js';
5
6
  import type { CursorKeyword } from '#blokkli/editor/types';
6
7
  import type { SelectionProvider } from './selection.js';
@@ -76,7 +77,7 @@ export type Renderer<T = RectangleBufferCollector<any>> = {
76
77
  * @param gl - WebGL rendering context
77
78
  * @param program - Compiled shader program
78
79
  */
79
- render: (ctx: RenderContext, gl: WebGLRenderingContext, program: ProgramInfo) => void;
80
+ render: (ctx: RenderContext, gl: WebGLRenderingContext, program: ProgramInfo, twgl: TwglHelpers) => void;
80
81
  /**
81
82
  * Fallback rendering using 2D canvas context.
82
83
  *
@@ -169,12 +170,6 @@ export type AnimationProvider = {
169
170
  * Remove the canvas element and clean up contexts.
170
171
  */
171
172
  removeCanvasElement: () => void;
172
- /**
173
- * Register a WebGL program.
174
- *
175
- * The programs are cached by the given ID.
176
- */
177
- registerProgram: (id: string, gl: WebGLRenderingContext, shaders: string[]) => ProgramInfo;
178
173
  /**
179
174
  * Current cursor style determined by active renderers.
180
175
  *
@@ -195,10 +190,10 @@ export type AnimationProvider = {
195
190
  * Register a WebGL renderer with a specific zIndex.
196
191
  * Returns an object with the collector instance and an unregister function.
197
192
  */
198
- registerRenderer: <T = RectangleBufferCollector<any>>(id: string, config: Omit<Renderer<T>, 'id'>) => {
193
+ registerRenderer: <T = RectangleBufferCollector<any>>(id: string, config: Omit<Renderer<T>, 'id'>) => Promise<{
199
194
  collector: T;
200
195
  unregister: () => void;
201
- };
196
+ }>;
202
197
  /**
203
198
  * Unregister a WebGL renderer.
204
199
  */
@@ -10,7 +10,6 @@ import {
10
10
  onMounted,
11
11
  onBeforeUnmount
12
12
  } from "#imports";
13
- import { createProgramInfo } from "twgl.js";
14
13
  function configureWebGLContext(gl) {
15
14
  gl.enable(gl.BLEND);
16
15
  gl.disable(gl.DEPTH_TEST);
@@ -49,6 +48,7 @@ export default function(eventBus, ui, storage, selection, debug, keyboard) {
49
48
  const renderers = /* @__PURE__ */ new Map();
50
49
  const rendererPrograms = /* @__PURE__ */ new Map();
51
50
  const rendererCollectors = /* @__PURE__ */ new Map();
51
+ let twglModule = null;
52
52
  const rendererFailures = /* @__PURE__ */ new Map();
53
53
  const rendererCooldowns = /* @__PURE__ */ new Map();
54
54
  const renderersPermanentlyDisabled = /* @__PURE__ */ new Set();
@@ -95,9 +95,9 @@ export default function(eventBus, ui, storage, selection, debug, keyboard) {
95
95
  const glContext2 = gl();
96
96
  if (glContext2 && webglEnabled.value && !shouldSkipRenderer(renderer.id)) {
97
97
  const program = rendererPrograms.get(renderer.id);
98
- if (program) {
98
+ if (program && twglModule) {
99
99
  try {
100
- renderer.render(ctx, glContext2, program);
100
+ renderer.render(ctx, glContext2, program, twglModule);
101
101
  handleRendererSuccess(renderer.id);
102
102
  } catch (error) {
103
103
  handleRendererFailure(renderer.id);
@@ -115,7 +115,7 @@ export default function(eventBus, ui, storage, selection, debug, keyboard) {
115
115
  }
116
116
  }
117
117
  }
118
- function registerRenderer(id, config) {
118
+ async function registerRenderer(id, config) {
119
119
  logger.log("Registered Renderer: " + id);
120
120
  const renderer = { id, ...config };
121
121
  renderers.set(id, renderer);
@@ -125,7 +125,7 @@ export default function(eventBus, ui, storage, selection, debug, keyboard) {
125
125
  const glContext2 = gl();
126
126
  if (glContext2) {
127
127
  const { shaders } = renderer.program();
128
- const programInfo = registerProgram(id, glContext2, shaders);
128
+ const programInfo = await registerProgram(id, glContext2, shaders);
129
129
  rendererPrograms.set(id, programInfo);
130
130
  }
131
131
  }
@@ -489,9 +489,12 @@ export default function(eventBus, ui, storage, selection, debug, keyboard) {
489
489
  gl2.uniform1f(gl2.getUniformLocation(programInfo.program, "u_dpi"), dpi.value);
490
490
  }
491
491
  const registeredPrograms = /* @__PURE__ */ new Map();
492
- function registerProgram(id, gl2, shaders) {
492
+ async function registerProgram(id, gl2, shaders) {
493
+ if (!twglModule) {
494
+ twglModule = (await import("./../libraries/twgl.js")).twgl;
495
+ }
493
496
  if (!registeredPrograms.has(id)) {
494
- registeredPrograms.set(id, createProgramInfo(gl2, shaders));
497
+ registeredPrograms.set(id, twglModule.createProgramInfo(gl2, shaders));
495
498
  }
496
499
  return registeredPrograms.get(id);
497
500
  }
@@ -507,7 +510,6 @@ export default function(eventBus, ui, storage, selection, debug, keyboard) {
507
510
  getRawGL,
508
511
  setSharedUniforms,
509
512
  dpi,
510
- registerProgram,
511
513
  webglSupported: computed(() => webglSupported.value && webglEnabled.value),
512
514
  webglEnabled,
513
515
  preferredRenderingMode,
@@ -72,6 +72,17 @@ export type DirectiveProvider = {
72
72
  * @returns The editable field data at that point, or undefined
73
73
  */
74
74
  getEditableAtPoint: (x: number, y: number) => EditableFieldData | undefined;
75
+ /**
76
+ * Find the droppable field at a specific screen coordinate.
77
+ *
78
+ * Converts screen coordinates to artboard space and checks if any visible
79
+ * droppable field contains the point.
80
+ *
81
+ * @param x - Screen X coordinate
82
+ * @param y - Screen Y coordinate
83
+ * @returns The droppable field data at that point, or undefined
84
+ */
85
+ getDroppableAtPoint: (x: number, y: number) => EditableFieldData | undefined;
75
86
  /**
76
87
  * Get all editable fields for a specific block.
77
88
  *
@@ -160,6 +160,21 @@ export default function(debug, ui) {
160
160
  }
161
161
  return void 0;
162
162
  }
163
+ function getDroppableAtPoint(x, y) {
164
+ const scale = ui.artboardScale.value;
165
+ const offset = ui.artboardOffset.value;
166
+ const artboardX = x / scale - offset.x / scale;
167
+ const artboardY = y / scale - offset.y / scale;
168
+ for (const key of visible) {
169
+ if (!key.startsWith("droppable:")) continue;
170
+ const rect = rects[key];
171
+ if (!rect) continue;
172
+ if (artboardX >= rect.x && artboardX <= rect.x + rect.width && artboardY >= rect.y && artboardY <= rect.y + rect.height) {
173
+ return fieldData.get(key);
174
+ }
175
+ }
176
+ return void 0;
177
+ }
163
178
  function updateRects() {
164
179
  const scale = ui.artboardScale.value;
165
180
  const offset = ui.artboardOffset.value;
@@ -248,6 +263,7 @@ export default function(debug, ui) {
248
263
  init,
249
264
  getVisible,
250
265
  getEditableAtPoint,
266
+ getDroppableAtPoint,
251
267
  findEditable,
252
268
  getEditablesForBlock,
253
269
  findEditableElement,
@@ -9,14 +9,14 @@ export type FeaturesProvider = {
9
9
  *
10
10
  * Updates automatically via HMR during development.
11
11
  */
12
- features: ComputedRef<FeatureDefinition[]>;
12
+ definitions: ComputedRef<FeatureDefinition[]>;
13
13
  /**
14
14
  * List of currently mounted features.
15
15
  *
16
16
  * Features are mounted when their components are rendered in the editor.
17
17
  * This list is used to track which features are active in the current session.
18
18
  */
19
- mountedFeatures: ComputedRef<FeatureDefinition<AdapterMethods[], ValidFeatureKey>[]>;
19
+ mountedFeatures: ComputedRef<FeatureDefinition<AdapterMethods[]>[]>;
20
20
  /**
21
21
  * List of available beta features.
22
22
  *
@@ -43,7 +43,7 @@ export type FeaturesProvider = {
43
43
  *
44
44
  * @param feature - The feature definition to mount
45
45
  */
46
- mount: (feature: FeatureDefinition<AdapterMethods[], ValidFeatureKey>) => void;
46
+ mount: (feature: FeatureDefinition<AdapterMethods[]>) => void;
47
47
  /**
48
48
  * Unmount a feature.
49
49
  *
@@ -43,7 +43,7 @@ export default function(storage) {
43
43
  mountedFeatures.value.push(feature);
44
44
  };
45
45
  return {
46
- features: computed(() => definitions.value),
46
+ definitions: computed(() => definitions.value),
47
47
  mountedFeatures: computed(() => mountedFeatures.value),
48
48
  betaFeatures,
49
49
  enabledBetaFeatures,
@@ -19,6 +19,17 @@ export type TextFieldValue = {
19
19
  entityType: string;
20
20
  entityBundle: string;
21
21
  };
22
+ /**
23
+ * A droppable field value (ordered list of referenced entity IDs currently in
24
+ * the field) as provided by the adapter's mapped state.
25
+ */
26
+ export type DroppableFieldValue = {
27
+ uuid: string;
28
+ fieldName: string;
29
+ ids: string[];
30
+ entityType: string;
31
+ entityBundle: string;
32
+ };
22
33
  /**
23
34
  * The result of reading a field value.
24
35
  */
@@ -51,5 +62,21 @@ export type FieldValueProvider = {
51
62
  * Reads from mapped state if available, falls back to reading from directive system.
52
63
  */
53
64
  getTextFieldValues: () => TextFieldValue[];
65
+ /**
66
+ * Get all droppable field values (item counts) from the mapped state.
67
+ * Returns an empty array when the adapter hasn't populated this.
68
+ */
69
+ getDroppableFieldValues: () => DroppableFieldValue[];
70
+ /**
71
+ * Get the current number of items in a droppable field.
72
+ * Reads from mapped state; returns 0 when the adapter hasn't populated it.
73
+ */
74
+ getDroppableFieldCount: (fieldName: string, host: EntityContext) => number;
75
+ /**
76
+ * Get the ordered list of referenced entity IDs currently in a droppable
77
+ * field. Reads from mapped state; returns an empty array when the adapter
78
+ * hasn't populated it.
79
+ */
80
+ getDroppableFieldIds: (fieldName: string, host: EntityContext) => string[];
54
81
  };
55
82
  export default function fieldValueProvider(directive: DirectiveProvider, state: StateProvider, types: BlockDefinitionProvider, definitions: DefinitionProvider, blocks: BlocksProvider): FieldValueProvider;
@@ -123,10 +123,30 @@ export default function fieldValueProvider(directive, state, types, definitions,
123
123
  }
124
124
  return values;
125
125
  }
126
+ function getDroppableFieldValues() {
127
+ const mappedState = state.getMappedState();
128
+ return mappedState.droppableFieldValues ?? [];
129
+ }
130
+ function getDroppableFieldIds(fieldName, host) {
131
+ const values = getDroppableFieldValues();
132
+ for (let i = 0; i < values.length; i++) {
133
+ const v = values[i];
134
+ if (v.uuid === host.uuid && v.fieldName === fieldName && v.entityType === host.type) {
135
+ return v.ids;
136
+ }
137
+ }
138
+ return [];
139
+ }
140
+ function getDroppableFieldCount(fieldName, host) {
141
+ return getDroppableFieldIds(fieldName, host).length;
142
+ }
126
143
  return {
127
144
  resolveFieldType,
128
145
  readValue,
129
146
  readFieldValue,
130
- getTextFieldValues
147
+ getTextFieldValues,
148
+ getDroppableFieldValues,
149
+ getDroppableFieldCount,
150
+ getDroppableFieldIds
131
151
  };
132
152
  }
@@ -49,19 +49,22 @@ export default function(eventBus) {
49
49
  isPressingSpace.value = true;
50
50
  }
51
51
  };
52
- const onVisibilityChange = () => {
52
+ const resetModifierStates = () => {
53
53
  isPressingControl.value = false;
54
54
  isPressingSpace.value = false;
55
+ isPressingShift.value = false;
55
56
  };
56
57
  onMounted(() => {
57
58
  document.addEventListener("keydown", onKeyDown);
58
59
  document.addEventListener("keyup", onKeyUp);
59
- document.addEventListener("visibilitychange", onVisibilityChange);
60
+ document.addEventListener("visibilitychange", resetModifierStates);
61
+ window.addEventListener("blur", resetModifierStates);
60
62
  });
61
63
  onBeforeUnmount(() => {
62
64
  document.removeEventListener("keydown", onKeyDown);
63
65
  document.removeEventListener("keyup", onKeyUp);
64
- document.removeEventListener("visibilitychange", onVisibilityChange);
66
+ document.removeEventListener("visibilitychange", resetModifierStates);
67
+ window.removeEventListener("blur", resetModifierStates);
65
68
  });
66
69
  const getShortcutKey = (shortcut) => [!!shortcut.meta, !!shortcut.shift, shortcut.code].join("-");
67
70
  const registerShortcut = (shortcut) => {
@@ -5,19 +5,43 @@ import type { DirectiveProvider } from './directive.js';
5
5
  import type { FieldValueProvider, TextFieldValue } from './fieldValue.js';
6
6
  import type { ReadabilityAnalysisResult, ReadabilityAnalyzer, ReadabilityChunkResult } from '../features/analyze/readability/types.js';
7
7
  import '../features/analyze/readability/adapterTypes.js';
8
+ type ReadabilityScaleInfo = NonNullable<ReturnType<NonNullable<ReadabilityAnalyzer['getScaleInfo']>>>;
8
9
  export type ReadabilityProvider = {
9
- analyzer: Readonly<Ref<ReadabilityAnalyzer>>;
10
- isInitialized: Readonly<Ref<boolean>>;
11
- ensureInitialized: () => Promise<void>;
10
+ /**
11
+ * Whether a readability analyzer is registered and usable.
12
+ *
13
+ * Resolved at provider construction time. `true` when an adapter extension
14
+ * supplied `getReadabilityAnalyzer` (typically via the `@blokkli/readability`
15
+ * sub-module), `false` otherwise. Features that render readability UI
16
+ * should gate on this flag; method calls are safe no-ops when false.
17
+ */
18
+ isAvailable: Readonly<Ref<boolean>>;
19
+ /**
20
+ * Label of the primary score metric for the current language
21
+ * (e.g. "LIX", "Gulpease", "CEFR"). Empty string when no analyzer is
22
+ * available.
23
+ */
24
+ scoreLabel: ComputedRef<string>;
25
+ /**
26
+ * Minimum word count required for a confident score in the current
27
+ * language. `0` when no analyzer is available.
28
+ */
29
+ minWordsForConfidence: ComputedRef<number>;
12
30
  analyzeAllFields: () => Promise<ReadabilityAnalysisResult>;
13
31
  analyzeText: (text: string, langcode: string, fieldType?: 'plain' | 'markup') => Promise<ReadabilityChunkResult[]>;
14
32
  analyzeFieldValues: (fields: TextFieldValue[]) => Promise<ReadabilityAnalysisResult>;
15
33
  getAgentContext: () => string;
16
34
  formatScore: (value: number) => string;
35
+ /**
36
+ * Return scale information for visualizing score bands, or `null` if no
37
+ * analyzer is available (or it does not provide one).
38
+ */
39
+ getScaleInfo: (langcode: string) => ReadabilityScaleInfo | null;
17
40
  /**
18
41
  * Find the DOM element for a specific editable field.
19
42
  * Used by the analyzer to scope DOM highlighting to the correct block.
20
43
  */
21
44
  getFieldElement: (uuid: string, fieldName: string) => HTMLElement | undefined;
22
45
  };
23
- export default function readabilityProvider(adapters: AdaptersProvider, context: ComputedRef<AdapterContext>, directive: DirectiveProvider, fieldValue: FieldValueProvider): ReadabilityProvider;
46
+ export default function readabilityProvider(adapters: AdaptersProvider, context: ComputedRef<AdapterContext>, directive: DirectiveProvider, fieldValue: FieldValueProvider): Promise<ReadabilityProvider>;
47
+ export {};
@@ -1,37 +1,18 @@
1
- import { ref } from "#imports";
1
+ import { ref, readonly, computed } from "#imports";
2
2
  import { chunkHtml } from "../features/analyze/readability/chunkHtml.js";
3
- import { createBuiltinReadabilityAnalyzer } from "../features/analyze/readability/builtinAnalyzer.js";
4
3
  import "../features/analyze/readability/adapterTypes";
5
- export default function readabilityProvider(adapters, context, directive, fieldValue) {
6
- const builtin = createBuiltinReadabilityAnalyzer();
7
- const analyzer = ref(builtin);
8
- const isInitialized = ref(false);
9
- let initPromise = null;
10
- async function doInit() {
11
- const customAnalyzers = await adapters.getAggregated(
12
- "getReadabilityAnalyzer"
13
- );
14
- if (customAnalyzers.length > 0) {
15
- analyzer.value = customAnalyzers[0];
16
- }
17
- const a = analyzer.value;
18
- if (a.init) {
19
- await a.init(context.value.language);
20
- }
21
- isInitialized.value = true;
22
- }
23
- function ensureInitialized() {
24
- if (isInitialized.value) {
25
- return Promise.resolve();
26
- }
27
- if (!initPromise) {
28
- initPromise = doInit();
29
- }
30
- return initPromise;
31
- }
4
+ export default async function readabilityProvider(adapters, context, directive, fieldValue) {
5
+ const list = await adapters.getAggregated("getReadabilityAnalyzer");
6
+ const analyzer = list[0] ?? null;
7
+ const isAvailable = ref(analyzer !== null);
8
+ const scoreLabel = computed(
9
+ () => analyzer?.scoreLabel(context.value.language) ?? ""
10
+ );
11
+ const minWordsForConfidence = computed(
12
+ () => analyzer?.minWordsForConfidence?.(context.value.language) ?? 0
13
+ );
32
14
  async function analyzeFieldValues(fields) {
33
- await ensureInitialized();
34
- const a = analyzer.value;
15
+ if (!analyzer) return {};
35
16
  const langcode = context.value.language;
36
17
  const fieldEntries = [];
37
18
  const allTexts = [];
@@ -47,7 +28,7 @@ export default function readabilityProvider(adapters, context, directive, fieldV
47
28
  textToIndex.push(entryIndex);
48
29
  }
49
30
  }
50
- const scores = await a.analyze(allTexts, langcode);
31
+ const scores = await analyzer.analyze(allTexts, langcode);
51
32
  const result = {};
52
33
  let textIndex = 0;
53
34
  for (const entry of fieldEntries) {
@@ -59,8 +40,8 @@ export default function readabilityProvider(adapters, context, directive, fieldV
59
40
  text: chunk.text,
60
41
  html: chunk.html,
61
42
  score,
62
- band: score != null ? a.classifyBand(score, langcode) : null,
63
- impact: score != null ? a.impactForScore(score) : null
43
+ band: score != null ? analyzer.classifyBand(score, langcode) : null,
44
+ impact: score != null ? analyzer.impactForScore(score, langcode) : null
64
45
  });
65
46
  }
66
47
  result[entry.key] = {
@@ -72,16 +53,16 @@ export default function readabilityProvider(adapters, context, directive, fieldV
72
53
  return result;
73
54
  }
74
55
  async function analyzeAllFields() {
56
+ if (!analyzer) return {};
75
57
  const fields = fieldValue.getTextFieldValues();
76
58
  return analyzeFieldValues(fields);
77
59
  }
78
60
  async function analyzeText(text, langcode, fieldType = "plain") {
79
- await ensureInitialized();
80
- const a = analyzer.value;
61
+ if (!analyzer) return [];
81
62
  const chunks = chunkHtml(text, fieldType);
82
63
  if (chunks.length === 0) return [];
83
64
  const texts = chunks.map((c) => c.text);
84
- const scores = await a.analyze(texts, langcode);
65
+ const scores = await analyzer.analyze(texts, langcode);
85
66
  const results = [];
86
67
  for (let i = 0; i < chunks.length; i++) {
87
68
  const score = scores[i] ?? null;
@@ -89,14 +70,14 @@ export default function readabilityProvider(adapters, context, directive, fieldV
89
70
  text: chunks[i].text,
90
71
  html: chunks[i].html,
91
72
  score,
92
- band: score != null ? a.classifyBand(score, langcode) : null,
93
- impact: score != null ? a.impactForScore(score) : null
73
+ band: score != null ? analyzer.classifyBand(score, langcode) : null,
74
+ impact: score != null ? analyzer.impactForScore(score, langcode) : null
94
75
  });
95
76
  }
96
77
  return results;
97
78
  }
98
79
  function getAgentContext() {
99
- return analyzer.value.getAgentContext();
80
+ return analyzer?.getAgentContext(context.value.language) ?? "";
100
81
  }
101
82
  function getFieldElement(uuid, fieldName) {
102
83
  const editables = directive.getEditablesForBlock(uuid);
@@ -106,21 +87,24 @@ export default function readabilityProvider(adapters, context, directive, fieldV
106
87
  }
107
88
  }
108
89
  function formatScore(value) {
109
- const a = analyzer.value;
110
- if (a.formatScore) {
111
- return a.formatScore(value);
90
+ if (analyzer?.formatScore) {
91
+ return analyzer.formatScore(value, context.value.language);
112
92
  }
113
93
  return typeof value === "number" && Number.isFinite(value) ? value.toFixed(1) : String(value);
114
94
  }
95
+ function getScaleInfo(langcode) {
96
+ return analyzer?.getScaleInfo?.(langcode) ?? null;
97
+ }
115
98
  return {
116
- analyzer,
117
- isInitialized,
118
- ensureInitialized,
99
+ isAvailable: readonly(isAvailable),
100
+ scoreLabel,
101
+ minWordsForConfidence,
119
102
  analyzeAllFields,
120
103
  analyzeText,
121
104
  analyzeFieldValues,
122
105
  getAgentContext,
123
106
  formatScore,
107
+ getScaleInfo,
124
108
  getFieldElement
125
109
  };
126
110
  }
@@ -57,6 +57,14 @@ export type SelectionProvider = {
57
57
  * The label of the active editable field.
58
58
  */
59
59
  activeEditableLabel: Ref<string | null>;
60
+ /**
61
+ * The label of the active droppable field being edited.
62
+ */
63
+ activeDroppableFieldLabel: Ref<string | null>;
64
+ /**
65
+ * The label of any active field-level editing mode (editable or droppable).
66
+ */
67
+ activeFieldLabel: ComputedRef<string | null>;
60
68
  /**
61
69
  * The items that are currently being dragged.
62
70
  */
@@ -6,6 +6,10 @@ export default function(blocks, permissions) {
6
6
  const hasHostSelected = ref(false);
7
7
  const draggingMode = ref(null);
8
8
  const activeEditableLabel = ref(null);
9
+ const activeDroppableFieldLabel = ref(null);
10
+ const activeFieldLabel = computed(
11
+ () => activeEditableLabel.value || activeDroppableFieldLabel.value
12
+ );
9
13
  const isMultiSelecting = ref(false);
10
14
  const interactionMode = ref("mouse");
11
15
  const selectionLocks = ref([]);
@@ -145,6 +149,8 @@ export default function(blocks, permissions) {
145
149
  isDragging,
146
150
  isDraggingExisting,
147
151
  activeEditableLabel,
152
+ activeDroppableFieldLabel,
153
+ activeFieldLabel,
148
154
  isMultiSelecting,
149
155
  draggingMode,
150
156
  interactionMode,
@@ -1,4 +1,2 @@
1
- import { type ComputedRef } from 'vue';
2
- import type { AdapterContext } from '../adapter/index.js';
3
1
  export type TextProvider = (key: string, defaultValue?: string) => string;
4
- export default function (context?: ComputedRef<AdapterContext>): TextProvider;
2
+ export default function (requestedLanguage: string): Promise<TextProvider>;