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

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,21 @@
1
+ mutation pbUpdateDroppableField(
2
+ $langcode: String
3
+ $entityType: EntityType!
4
+ $entityUuid: String!
5
+ $paragraphUuid: String
6
+ $fieldName: String!
7
+ $itemIds: [String]!
8
+ ) {
9
+ state: paragraphsEditMutationState(
10
+ entityType: $entityType
11
+ entityUuid: $entityUuid
12
+ ) {
13
+ action: update_droppable_field(
14
+ paragraphUuid: $paragraphUuid
15
+ fieldName: $fieldName
16
+ itemIds: $itemIds
17
+ ) {
18
+ ...paragraphsBlokkliMutationResult
19
+ }
20
+ }
21
+ }
@@ -148,6 +148,7 @@ export declare const templateEditRouteName: string|null
148
148
  addMutation("update_host_options");
149
149
  addMutation("add_multiple");
150
150
  addMutation("replace_entity_reference");
151
+ addMutation("update_droppable_field");
151
152
  addMutation("bulk_update_field_values");
152
153
  addMutation("clear_outdated_translation");
153
154
  addMutation("bulk_translate_field_values");
@@ -197,7 +198,7 @@ export declare const templateEditRouteName: string|null
197
198
  } else {
198
199
  context.features.disableFeature("conversions");
199
200
  }
200
- if (queryFields.has("pbGetImportSourceEntities")) {
201
+ if (editMutationStateFields.has("copy_from_existing")) {
201
202
  addGraphqlDocument("features/import-existing.graphql");
202
203
  } else {
203
204
  context.features.disableFeature("import-existing");
@@ -207,12 +208,15 @@ export declare const templateEditRouteName: string|null
207
208
  } else {
208
209
  context.features.disableFeature("media-library");
209
210
  }
210
- if (queryFields.has("paragraphsBlokkliEntitiesSearch")) {
211
+ if (queryFields.has("paragraphsBlokkliEntitiesSearch") && queryFields.has("paragraphsBlokkliEditStatesSummary")) {
211
212
  addGraphqlDocument("features/workspace.graphql");
212
213
  }
213
214
  if (editStateFields.has("referencedEntities")) {
214
215
  addGraphqlDocument("features/referenced-entities.graphql");
215
216
  }
217
+ if (editStateFields.has("droppableFieldItems")) {
218
+ addGraphqlDocument("features/droppable-field-items.graphql");
219
+ }
216
220
  if (editStateFields.has("previewUrl")) {
217
221
  addGraphqlDocument("features/preview-grant.graphql");
218
222
  } else {
@@ -261,6 +261,13 @@ export default defineBlokkliEditAdapter(
261
261
  entityType: v.entityType,
262
262
  entityBundle: v.entityBundle
263
263
  })),
264
+ droppableFieldValues: (state.droppableFieldValues || []).map((v) => ({
265
+ uuid: v.uuid,
266
+ fieldName: v.fieldName,
267
+ ids: v.ids,
268
+ entityType: v.entityType,
269
+ entityBundle: v.entityBundle
270
+ })),
264
271
  ignoredAnalyzeIdentifiers: state.stateSettings?.ignoredAnalyzeIdentifiers || []
265
272
  };
266
273
  };
@@ -443,31 +450,6 @@ export default defineBlokkliEditAdapter(
443
450
  return mapPublishOptions(options);
444
451
  });
445
452
  }
446
- if (hasQuery("pbGetImportSourceEntities")) {
447
- adapter.getImportItems = (args) => useGraphqlQuery("pbGetImportSourceEntities", {
448
- entityType: ctx.value.entityType.toLowerCase(),
449
- entityUuid: ctx.value.entityUuid,
450
- page: args.page,
451
- filters: configObjectToUserConfigInput(args.filters)
452
- }).then((data) => {
453
- return {
454
- perPage: data.data.pbGetImportSourceEntities?.perPage ?? 16,
455
- total: data?.data.pbGetImportSourceEntities?.total || 0,
456
- filters: mapPluginConfigInputs(
457
- data.data.pbGetImportSourceEntities?.filters ?? []
458
- ),
459
- items: (data?.data.pbGetImportSourceEntities?.items || []).map((item) => {
460
- if (item?.uuid) {
461
- return {
462
- uuid: item.uuid,
463
- label: item.label,
464
- description: item.description
465
- };
466
- }
467
- }).filter(falsy)
468
- };
469
- });
470
- }
471
453
  if (hasQuery("pbConversions")) {
472
454
  adapter.getConversions = () => useGraphqlQuery("pbConversions").then(
473
455
  (v) => v?.data.paragraphsBlokkliConversions || []
@@ -850,6 +832,30 @@ export default defineBlokkliEditAdapter(
850
832
  mediaId: e.mediaId
851
833
  }).then(mapMutation);
852
834
  }
835
+ if (hasMutation("pbUpdateDroppableField")) {
836
+ adapter.updateDroppableField = (e) => useGraphqlMutation("pbUpdateDroppableField", {
837
+ ...ctx.value,
838
+ paragraphUuid: e.host.uuid === ctx.value.entityUuid ? null : e.host.uuid,
839
+ fieldName: e.host.fieldName,
840
+ itemIds: e.itemIds
841
+ }).then(mapMutation);
842
+ }
843
+ if (hasQuery("pbDroppableFieldItems")) {
844
+ adapter.getDroppableFieldItems = (e) => useGraphqlQuery("pbDroppableFieldItems", {
845
+ ...ctx.value,
846
+ paragraphUuid: e.host.uuid === ctx.value.entityUuid ? null : e.host.uuid,
847
+ fieldName: e.host.fieldName
848
+ }).then(
849
+ (v) => (v.data.state?.droppableFieldItems || []).map((item) => ({
850
+ id: item.id,
851
+ entityType: item.entityType,
852
+ bundle: item.bundle,
853
+ label: item.label,
854
+ thumbnailSrc: item.thumbnailSrc ?? void 0,
855
+ targetBundles: item.targetBundles
856
+ }))
857
+ );
858
+ }
853
859
  if (hasMutation("pbUpdateHostEntityFieldValue")) {
854
860
  adapter.updateEntityFieldValue = (e) => useGraphqlMutation("pbUpdateHostEntityFieldValue", {
855
861
  ...ctx.value,
@@ -890,6 +896,19 @@ export default defineBlokkliEditAdapter(
890
896
  afterUuid: e.preceedingUuid
891
897
  }).then(mapMutation);
892
898
  };
899
+ adapter.addEntityReferenceBlock = (e) => {
900
+ return useGraphqlMutation("pbAddEntityReference", {
901
+ ...ctx.value,
902
+ targetId: e.entityId,
903
+ targetType: e.entityType,
904
+ targetBundle: e.entityBundle,
905
+ paragraphBundle: e.bundle,
906
+ hostType: e.host.type,
907
+ hostUuid: e.host.uuid,
908
+ hostFieldName: e.host.fieldName,
909
+ afterUuid: e.afterUuid
910
+ }).then(mapMutation);
911
+ };
893
912
  }
894
913
  if (hasMutation("pbAddEntityReferenceMultiple")) {
895
914
  adapter.mediaLibraryAddBlocks = (e) => {
@@ -1063,26 +1082,43 @@ export default defineBlokkliEditAdapter(
1063
1082
  });
1064
1083
  };
1065
1084
  }
1066
- if (hasQuery("pbEntitiesSearch")) {
1085
+ if (hasQuery("pbEntitiesSearch") && hasQuery("pbEditStatesSummary")) {
1067
1086
  adapter.getHostEntities = () => {
1068
- return useGraphqlQuery("pbEntitiesSearch").then((data) => {
1069
- const result = data.data.paragraphsBlokkliEntitiesSearch;
1087
+ return Promise.all([
1088
+ useGraphqlQuery("pbEntitiesSearch"),
1089
+ useGraphqlQuery("pbEditStatesSummary")
1090
+ ]).then(([entitiesData, statesData]) => {
1091
+ const result = entitiesData.data.paragraphsBlokkliEntitiesSearch;
1092
+ const summaries = statesData.data.paragraphsBlokkliEditStatesSummary ?? [];
1093
+ const stateMap = /* @__PURE__ */ new Map();
1094
+ for (const summary of summaries) {
1095
+ stateMap.set(
1096
+ `${summary.hostEntityType}:${summary.hostEntityUuid}`,
1097
+ {
1098
+ lastChanged: summary.lastChanged,
1099
+ uid: summary.uid ?? null
1100
+ }
1101
+ );
1102
+ }
1070
1103
  const bundles = {};
1071
1104
  for (const bundle of result?.bundleLabels ?? []) {
1072
1105
  bundles[bundle.id] = bundle.label;
1073
1106
  }
1074
1107
  return {
1075
- items: (result?.items ?? []).map((v) => ({
1076
- id: v.id,
1077
- uuid: v.uuid,
1078
- entityType: v.entityType,
1079
- bundle: v.bundle,
1080
- label: v.label ?? "",
1081
- url: v.url,
1082
- lastChanged: v.lastChanged ?? null,
1083
- uid: v.uid ?? null,
1084
- context: v.context ?? void 0
1085
- })),
1108
+ items: (result?.items ?? []).map((v) => {
1109
+ const state = stateMap.get(`${v.entityType}:${v.uuid}`);
1110
+ return {
1111
+ id: v.id,
1112
+ uuid: v.uuid,
1113
+ entityType: v.entityType,
1114
+ bundle: v.bundle,
1115
+ label: v.label ?? "",
1116
+ url: v.url,
1117
+ lastChanged: state?.lastChanged ?? null,
1118
+ uid: state?.uid ?? null,
1119
+ context: v.context ?? void 0
1120
+ };
1121
+ }),
1086
1122
  labelMap: {
1087
1123
  label: result?.entityTypeLabels?.[0]?.label ?? "",
1088
1124
  bundles
@@ -0,0 +1,11 @@
1
+ import { B as BlokkliModule } from '../../shared/editor.BTOBvmaz.mjs';
2
+ import 'nuxt/schema';
3
+ import 'consola';
4
+ import '../../../dist/global/types/definitions.js';
5
+ import '../../../dist/global/types/theme.js';
6
+ import '@nuxt/kit';
7
+ import '../../../dist/global/types/features.js';
8
+
9
+ declare const _default: (options?: object) => BlokkliModule<object>;
10
+
11
+ export { _default as default };
@@ -0,0 +1,17 @@
1
+ import { createResolver } from '@nuxt/kit';
2
+ import { defineBlokkliModule } from '../index.mjs';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const resolve = createResolver(
6
+ fileURLToPath(new URL("./", import.meta.url))
7
+ ).resolve;
8
+ const index = defineBlokkliModule({
9
+ setup({ context }) {
10
+ context.registerAdapterExtension(
11
+ "@blokkli/readability",
12
+ resolve("./runtime/adapter-extension")
13
+ );
14
+ }
15
+ });
16
+
17
+ export { index as default };
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { defineBlokkliAdapterExtension } from "#blokkli/editor/adapter";
2
+ import { createBuiltinReadabilityAnalyzer } from "./analyzers/builtin.js";
3
+ export default defineBlokkliAdapterExtension(() => ({
4
+ getReadabilityAnalyzer: () => createBuiltinReadabilityAnalyzer()
5
+ }));
@@ -0,0 +1,10 @@
1
+ import type { ReadabilityAnalyzer } from '#blokkli/editor/features/analyze/readability/types';
2
+ /**
3
+ * Create the built-in readability analyzer using language-specific algorithms:
4
+ * Flesch Reading Ease → CEFR (en), Wiener Sachtextformel (de), LIX (fr),
5
+ * Gulpease (it). English syllable counting uses the `syllable` npm package,
6
+ * loaded lazily on the first `analyze()` call. German syllable counting uses
7
+ * a local vowel-group heuristic. French and Italian formulas don't need
8
+ * syllables at all.
9
+ */
10
+ export declare function createBuiltinReadabilityAnalyzer(): ReadabilityAnalyzer;
@@ -0,0 +1,340 @@
1
+ function fleschReadingEase(sentences, syllablesPerWord, coefficients) {
2
+ return coefficients.base - coefficients.sentences * sentences - coefficients.syllablesPerWord * syllablesPerWord;
3
+ }
4
+ function gulpeaseIndex(sentences, chars, words) {
5
+ const BASE = 89;
6
+ const SENTENCES_COEF = 300;
7
+ const CHARS_COEF = 10;
8
+ return (SENTENCES_COEF * sentences - CHARS_COEF * chars) / words + BASE;
9
+ }
10
+ function lix(words, longWords, wordsPerSentence) {
11
+ if (words === 0) return 0;
12
+ return wordsPerSentence + longWords * 100 / words;
13
+ }
14
+ const WSTF_VARIANT_1 = {
15
+ ms: 0.1935,
16
+ sl: 0.1672,
17
+ iw: 0.1297,
18
+ es: -0.0327,
19
+ base: -0.875
20
+ };
21
+ function wienerSachtextformel(words, sentences, longWords, polysyllables, monosyllables) {
22
+ const { ms, sl, iw, es, base } = WSTF_VARIANT_1;
23
+ const msVal = 100 * polysyllables / words;
24
+ const slVal = words / sentences;
25
+ const iwVal = 100 * longWords / words;
26
+ const esVal = 100 * monosyllables / words;
27
+ return base + ms * msVal + sl * slVal + iw * iwVal + es * esVal;
28
+ }
29
+ const FRE_COEFFICIENTS = {
30
+ en: { base: 206.835, sentences: 1.015, syllablesPerWord: 84.6 },
31
+ de: { base: 180, sentences: 1, syllablesPerWord: 58.5 },
32
+ fr: { base: 207, sentences: 1.015, syllablesPerWord: 73.6 },
33
+ it: { base: 217, sentences: 1.3, syllablesPerWord: 0.6 }
34
+ };
35
+ function getWords(text) {
36
+ return text.replace(/[^\p{L}\p{N}\s']/gu, "").toLowerCase().split(/\s+/g).filter(Boolean);
37
+ }
38
+ function getSentences(text) {
39
+ return text.match(/[^.!?。!?\n\r]+[.!?。!?]*[\n\r]*/gu) || [];
40
+ }
41
+ function sentenceCount(text) {
42
+ const sentences = getSentences(text);
43
+ let ignored = 0;
44
+ for (const s of sentences) {
45
+ if (getWords(s).length <= 2) ignored += 1;
46
+ }
47
+ return Math.max(1, sentences.length - ignored);
48
+ }
49
+ function wordCount(text) {
50
+ return getWords(text).length;
51
+ }
52
+ function longWordCount(text, threshold = 6) {
53
+ return getWords(text).filter((w) => w.length > threshold).length;
54
+ }
55
+ function charCount(text) {
56
+ return text.replace(/\s+/g, "").length;
57
+ }
58
+ function avgSentenceLength(text) {
59
+ const sentences = sentenceCount(text);
60
+ return sentences ? wordCount(text) / sentences : 0;
61
+ }
62
+ function avgWordsPerSentence(text) {
63
+ return avgSentenceLength(text);
64
+ }
65
+ function avgSyllablesPerWord(text, ctx, interval) {
66
+ const words = getWords(text);
67
+ if (!words.length) return 0;
68
+ let syllables = 0;
69
+ for (const w of words) syllables += ctx.syllableCount(w);
70
+ return interval ? syllables * interval / words.length : syllables / words.length;
71
+ }
72
+ function polysyllableCount(text, ctx) {
73
+ let count = 0;
74
+ for (const w of getWords(text)) {
75
+ if (ctx.syllableCount(w) > 2) count += 1;
76
+ }
77
+ return count;
78
+ }
79
+ function monosyllableCount(text, ctx) {
80
+ let count = 0;
81
+ for (const w of getWords(text)) {
82
+ if (ctx.syllableCount(w) === 1) count += 1;
83
+ }
84
+ return count;
85
+ }
86
+ const DE_VOWELS = /[aeiouäöüy]/i;
87
+ const DE_DIPHTHONGS = /^(?:au|ei|eu|äu|ai|ie)/i;
88
+ function countSyllablesDe(word) {
89
+ const w = word.toLowerCase();
90
+ if (!w) return 0;
91
+ let count = 0;
92
+ let i = 0;
93
+ let inVowelGroup = false;
94
+ while (i < w.length) {
95
+ const two = w.substring(i, i + 2);
96
+ if (DE_DIPHTHONGS.test(two)) {
97
+ if (!inVowelGroup) count += 1;
98
+ inVowelGroup = true;
99
+ i += 2;
100
+ continue;
101
+ }
102
+ if (DE_VOWELS.test(w[i])) {
103
+ if (!inVowelGroup) count += 1;
104
+ inVowelGroup = true;
105
+ } else {
106
+ inVowelGroup = false;
107
+ }
108
+ i += 1;
109
+ }
110
+ return Math.max(1, count);
111
+ }
112
+ let englishSyllable = null;
113
+ async function loadEnglishSyllable() {
114
+ if (!englishSyllable) {
115
+ const mod = await import("syllable");
116
+ englishSyllable = mod.syllable;
117
+ }
118
+ return englishSyllable;
119
+ }
120
+ function fleschToCefr(score) {
121
+ if (score >= 90) return "A1";
122
+ if (score >= 80) return "A2";
123
+ if (score >= 70) return "B1";
124
+ if (score >= 60) return "B2";
125
+ if (score >= 50) return "C1";
126
+ return "C2";
127
+ }
128
+ const SCORE_CONFIGS = {
129
+ en: {
130
+ label: "CEFR",
131
+ compute: (text, ctx) => fleschReadingEase(
132
+ avgSentenceLength(text),
133
+ avgSyllablesPerWord(text, ctx),
134
+ FRE_COEFFICIENTS.en
135
+ ),
136
+ direction: "higher_easier",
137
+ // Aligned to CEFR buckets: easy = A1–B2 (FRE ≥ 60), ok = C1 (50–60),
138
+ // hard = C2 (< 50). Keeps each CEFR level in exactly one analyze section.
139
+ bands: { easy: 60, ok: 50 },
140
+ impactThresholds: [40, 25, 10],
141
+ minWords: 15,
142
+ formatScore: fleschToCefr,
143
+ referenceTable: [
144
+ { range: "FRE 90\u2013100", label: "A1 \u2014 beginners" },
145
+ { range: "FRE 80\u201390", label: "A2 \u2014 elementary" },
146
+ { range: "FRE 70\u201380", label: "B1 \u2014 intermediate" },
147
+ { range: "FRE 60\u201370", label: "B2 \u2014 upper intermediate (target)" },
148
+ { range: "FRE 50\u201360", label: "C1 \u2014 advanced (could be simpler)" },
149
+ {
150
+ range: "FRE 0\u201350",
151
+ label: "C2 \u2014 mastery \u2014 this is what gets flagged"
152
+ }
153
+ ]
154
+ },
155
+ de: {
156
+ label: "WSTF",
157
+ compute: (text, ctx) => wienerSachtextformel(
158
+ wordCount(text),
159
+ sentenceCount(text),
160
+ longWordCount(text),
161
+ polysyllableCount(text, ctx),
162
+ monosyllableCount(text, ctx)
163
+ ),
164
+ direction: "higher_harder",
165
+ bands: { easy: 15, ok: 18 },
166
+ impactThresholds: [16, 20, 24],
167
+ minWords: 5,
168
+ referenceTable: [
169
+ { range: "Below 8", label: "Very easy (children's books)" },
170
+ { range: "8\u201315", label: "Easy (standard website content)" },
171
+ { range: "15\u201318", label: "Moderately difficult (could be simpler)" },
172
+ {
173
+ range: "Above 18",
174
+ label: "Difficult \u2014 this is what gets flagged"
175
+ },
176
+ { range: "Above 24", label: "Critical \u2014 must be simplified" }
177
+ ]
178
+ },
179
+ fr: {
180
+ label: "LIX",
181
+ compute: (text) => lix(wordCount(text), longWordCount(text), avgWordsPerSentence(text)),
182
+ direction: "higher_harder",
183
+ bands: { easy: 40, ok: 59 },
184
+ impactThresholds: [50, 60, 70],
185
+ minWords: 5,
186
+ referenceTable: [
187
+ { range: "Below 25", label: "Very easy (children's books)" },
188
+ { range: "25\u201340", label: "Easy (simple articles)" },
189
+ { range: "40\u201350", label: "Medium (newspapers)" },
190
+ { range: "50\u201360", label: "Difficult (official documents)" },
191
+ {
192
+ range: "Above 60",
193
+ label: "Very difficult \u2014 this is what gets flagged"
194
+ },
195
+ { range: "Above 70", label: "Critical \u2014 must be simplified" }
196
+ ]
197
+ },
198
+ it: {
199
+ label: "Gulpease",
200
+ compute: (text) => gulpeaseIndex(sentenceCount(text), charCount(text), wordCount(text)),
201
+ direction: "higher_easier",
202
+ bands: { easy: 80, ok: 60 },
203
+ impactThresholds: [60, 50, 40],
204
+ minWords: 5,
205
+ referenceTable: [
206
+ { range: "Above 80", label: "Very easy (children's books)" },
207
+ { range: "60\u201380", label: "Easy (simple articles)" },
208
+ { range: "50\u201360", label: "Medium (newspapers)" },
209
+ { range: "40\u201350", label: "Difficult (official documents)" },
210
+ {
211
+ range: "Below 40",
212
+ label: "Very difficult \u2014 this is what gets flagged"
213
+ },
214
+ { range: "Below 30", label: "Critical \u2014 must be simplified" }
215
+ ]
216
+ }
217
+ };
218
+ const SUPPORTED_LANGUAGES = ["en", "de", "fr", "it"];
219
+ function getConfig(langcode) {
220
+ if (isSupportedLangcode(langcode)) {
221
+ return SCORE_CONFIGS[langcode];
222
+ }
223
+ return SCORE_CONFIGS.en;
224
+ }
225
+ function isSupportedLangcode(v) {
226
+ return v === "en" || v === "de" || v === "fr" || v === "it";
227
+ }
228
+ function segmentWords(text) {
229
+ if ("Segmenter" in Intl) {
230
+ const seg = new Intl.Segmenter(void 0, { granularity: "word" });
231
+ const out = [];
232
+ for (const s of seg.segment(text)) {
233
+ if (s.isWordLike)
234
+ out.push(text.slice(s.index, s.index + s.segment.length));
235
+ }
236
+ return out;
237
+ }
238
+ return text.match(/\p{Letter}+(?:'\p{Letter}+)?/gu) ?? [];
239
+ }
240
+ function safe(fn) {
241
+ try {
242
+ const n = fn();
243
+ return Number.isFinite(n) ? n : void 0;
244
+ } catch {
245
+ return void 0;
246
+ }
247
+ }
248
+ function round(n) {
249
+ return Math.round(n * 10) / 10;
250
+ }
251
+ function classifyBandGeneric(score, config) {
252
+ if (config.direction === "higher_easier") {
253
+ if (score >= config.bands.easy) return "easy";
254
+ if (score >= config.bands.ok) return "ok";
255
+ return "hard";
256
+ }
257
+ if (score <= config.bands.easy) return "easy";
258
+ if (score <= config.bands.ok) return "ok";
259
+ return "hard";
260
+ }
261
+ function impactForScoreGeneric(score, config) {
262
+ const [moderate, serious, critical] = config.impactThresholds;
263
+ if (config.direction === "higher_easier") {
264
+ if (score < critical) return "critical";
265
+ if (score < serious) return "serious";
266
+ if (score < moderate) return "moderate";
267
+ return "minor";
268
+ }
269
+ if (score >= critical) return "critical";
270
+ if (score >= serious) return "serious";
271
+ if (score >= moderate) return "moderate";
272
+ return "minor";
273
+ }
274
+ function buildAgentContext(config) {
275
+ const rows = config.referenceTable.map((row) => `- ${row.range}: ${row.label}`).join("\n");
276
+ return `## ${config.label} Score Reference
277
+
278
+ ${rows}`;
279
+ }
280
+ export function createBuiltinReadabilityAnalyzer() {
281
+ return {
282
+ id: "builtin",
283
+ label: (langcode) => {
284
+ if (langcode === "de") return "Lesbarkeit";
285
+ return "Readability";
286
+ },
287
+ description: "Analyzes text readability using language-specific algorithms (LIX, Wiener Sachtextformel, Gulpease).",
288
+ supportedLanguages: SUPPORTED_LANGUAGES,
289
+ minWordsForConfidence(langcode) {
290
+ return getConfig(langcode).minWords;
291
+ },
292
+ scoreLabel(langcode) {
293
+ return getConfig(langcode).label;
294
+ },
295
+ async analyze(texts, langcode) {
296
+ if (!isSupportedLangcode(langcode)) {
297
+ return texts.map(() => null);
298
+ }
299
+ const syllableCount = langcode === "en" ? await loadEnglishSyllable() : countSyllablesDe;
300
+ const ctx = { syllableCount };
301
+ const config = getConfig(langcode);
302
+ return texts.map((text) => {
303
+ const trimmed = text.trim();
304
+ if (!trimmed) return null;
305
+ const words = segmentWords(trimmed);
306
+ if (words.length < config.minWords) return null;
307
+ const score = safe(() => config.compute(trimmed, ctx));
308
+ return score != null ? round(score) : null;
309
+ });
310
+ },
311
+ classifyBand(score, langcode) {
312
+ return classifyBandGeneric(score, getConfig(langcode));
313
+ },
314
+ impactForScore(score, langcode) {
315
+ return impactForScoreGeneric(score, getConfig(langcode));
316
+ },
317
+ getAgentContext(langcode) {
318
+ return buildAgentContext(getConfig(langcode));
319
+ },
320
+ formatScore(value, langcode) {
321
+ const config = getConfig(langcode);
322
+ if (config.formatScore) {
323
+ return config.formatScore(value);
324
+ }
325
+ return Number.isFinite(value) ? value.toFixed(1) : String(value);
326
+ },
327
+ getScaleInfo(langcode) {
328
+ const config = getConfig(langcode);
329
+ const t1 = Math.min(config.bands.easy, config.bands.ok);
330
+ const t2 = Math.max(config.bands.easy, config.bands.ok);
331
+ const padding = Math.round((t2 - t1) * 0.5);
332
+ return {
333
+ thresholds: [t1, t2],
334
+ direction: config.direction,
335
+ scaleMin: Math.max(0, t1 - padding),
336
+ scaleMax: t2 + padding
337
+ };
338
+ }
339
+ };
340
+ }