@blokkli/editor 2.0.0-alpha.39 → 2.0.0-alpha.40

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 (160) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +15 -105
  3. package/dist/modules/agent/index.d.mts +1 -0
  4. package/dist/modules/agent/index.mjs +81 -8
  5. package/dist/modules/agent/runtime/app/composables/agentProvider.d.ts +8 -3
  6. package/dist/modules/agent/runtime/app/composables/agentProvider.js +108 -13
  7. package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.vue +7 -6
  8. package/dist/modules/agent/runtime/app/features/agent/Panel/index.d.vue.ts +2 -2
  9. package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue +12 -10
  10. package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue.d.ts +2 -2
  11. package/dist/modules/agent/runtime/app/features/agent/index.vue +29 -5
  12. package/dist/modules/agent/runtime/app/helpers/pageStructure.js +7 -17
  13. package/dist/modules/agent/runtime/app/prompts/fixReadability.d.ts +2 -0
  14. package/dist/modules/agent/runtime/app/prompts/fixReadability.js +49 -0
  15. package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +1 -0
  16. package/dist/modules/agent/runtime/app/tools/check_readability/index.js +24 -15
  17. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.d.vue.ts +46 -0
  18. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.vue +739 -0
  19. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.vue.d.ts +46 -0
  20. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Details/index.d.vue.ts +6 -0
  21. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Details/index.vue +38 -0
  22. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Details/index.vue.d.ts +6 -0
  23. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.d.ts +38 -0
  24. package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.js +115 -0
  25. package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.js +1 -0
  26. package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.js +3 -5
  27. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +1 -0
  28. package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.js +1 -0
  29. package/dist/modules/agent/runtime/app/tools/get_content_fields/index.js +4 -7
  30. package/dist/modules/agent/runtime/app/tools/get_page_structure/index.js +1 -0
  31. package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +10 -17
  32. package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.js +1 -0
  33. package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.js +1 -0
  34. package/dist/modules/agent/runtime/app/tools/get_readability_issues/index.js +17 -70
  35. package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.js +1 -0
  36. package/dist/modules/agent/runtime/app/tools/helpers.d.ts +38 -10
  37. package/dist/modules/agent/runtime/app/tools/helpers.js +90 -27
  38. package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.js +1 -0
  39. package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.js +1 -0
  40. package/dist/modules/agent/runtime/app/tools/schemas.d.ts +1 -1
  41. package/dist/modules/agent/runtime/app/tools/update_text_fields/Component.vue +66 -84
  42. package/dist/modules/agent/runtime/app/tools/update_text_fields/index.d.ts +8 -1
  43. package/dist/modules/agent/runtime/app/tools/update_text_fields/index.js +21 -14
  44. package/dist/modules/agent/runtime/app/types/index.d.ts +41 -0
  45. package/dist/modules/agent/runtime/server/Session.d.ts +8 -1
  46. package/dist/modules/agent/runtime/server/Session.js +154 -6
  47. package/dist/modules/agent/runtime/server/agent.js +5 -1
  48. package/dist/modules/agent/runtime/server/default-skills/fixReadability.js +31 -51
  49. package/dist/modules/agent/runtime/server/default-skills/rewriteAndTranslate.js +45 -4
  50. package/dist/modules/agent/runtime/server/providers/anthropic.js +2 -1
  51. package/dist/modules/agent/runtime/server/providers/openai.js +2 -1
  52. package/dist/modules/agent/runtime/server/providers/types.d.ts +2 -0
  53. package/dist/modules/agent/runtime/server/route.d.ts +2 -0
  54. package/dist/modules/agent/runtime/server/route.js +40 -0
  55. package/dist/modules/agent/runtime/server/routing.d.ts +18 -0
  56. package/dist/modules/agent/runtime/server/routing.js +111 -0
  57. package/dist/modules/agent/runtime/server/skills/types.d.ts +10 -0
  58. package/dist/modules/agent/runtime/server/stream.d.ts +2 -0
  59. package/dist/modules/agent/runtime/server/stream.js +190 -0
  60. package/dist/modules/agent/runtime/server/streamParser.d.ts +85 -0
  61. package/dist/modules/agent/runtime/server/streamParser.js +227 -0
  62. package/dist/modules/agent/runtime/server/templates/defineStreamTemplate.d.ts +21 -0
  63. package/dist/modules/agent/runtime/server/templates/defineStreamTemplate.js +3 -0
  64. package/dist/modules/agent/runtime/server/templates/definitions/fixReadability.d.ts +26 -0
  65. package/dist/modules/agent/runtime/server/templates/definitions/fixReadability.js +84 -0
  66. package/dist/modules/agent/runtime/server/templates/definitions/generateContent.d.ts +6 -0
  67. package/dist/modules/agent/runtime/server/templates/definitions/generateContent.js +29 -0
  68. package/dist/modules/agent/runtime/server/templates/definitions/rewrite.d.ts +5 -0
  69. package/dist/modules/agent/runtime/server/templates/definitions/rewrite.js +14 -0
  70. package/dist/modules/agent/runtime/server/templates/definitions/translate.d.ts +5 -0
  71. package/dist/modules/agent/runtime/server/templates/definitions/translate.js +23 -0
  72. package/dist/modules/agent/runtime/server/templates/index.d.ts +37 -0
  73. package/dist/modules/agent/runtime/server/templates/index.js +25 -0
  74. package/dist/modules/agent/runtime/server/templates/types.d.ts +17 -0
  75. package/dist/modules/agent/runtime/server/templates/types.js +0 -0
  76. package/dist/modules/agent/runtime/server/templates/utils.d.ts +5 -0
  77. package/dist/modules/agent/runtime/server/templates/utils.js +69 -0
  78. package/dist/modules/agent/runtime/shared/types.d.ts +18 -0
  79. package/dist/modules/agent/runtime/shared/types.js +16 -1
  80. package/dist/runtime/components/BlokkliItem.d.vue.ts +1 -1
  81. package/dist/runtime/components/BlokkliItem.vue +34 -3
  82. package/dist/runtime/components/BlokkliItem.vue.d.ts +1 -1
  83. package/dist/runtime/editor/components/Actions/index.vue +2 -2
  84. package/dist/runtime/editor/components/AnimationCanvas/index.vue +23 -2
  85. package/dist/runtime/editor/components/DiffApproval/Highlight/Item.d.vue.ts +19 -0
  86. package/dist/runtime/editor/components/DiffApproval/Highlight/Item.vue +106 -0
  87. package/dist/runtime/editor/components/DiffApproval/Highlight/Item.vue.d.ts +19 -0
  88. package/dist/runtime/editor/components/DiffApproval/Highlight/index.d.vue.ts +22 -0
  89. package/dist/runtime/editor/components/DiffApproval/Highlight/index.vue +50 -0
  90. package/dist/runtime/editor/components/DiffApproval/Highlight/index.vue.d.ts +22 -0
  91. package/dist/runtime/editor/components/DiffApproval/Toolbar/index.d.vue.ts +24 -0
  92. package/dist/runtime/editor/components/DiffApproval/Toolbar/index.vue +113 -0
  93. package/dist/runtime/editor/components/DiffApproval/Toolbar/index.vue.d.ts +24 -0
  94. package/dist/runtime/editor/components/DiffApproval/index.d.vue.ts +19 -0
  95. package/dist/runtime/editor/components/DiffApproval/index.vue +158 -0
  96. package/dist/runtime/editor/components/DiffApproval/index.vue.d.ts +19 -0
  97. package/dist/runtime/editor/components/DiffApproval/types.d.ts +7 -0
  98. package/dist/runtime/editor/components/DiffApproval/types.js +0 -0
  99. package/dist/runtime/editor/components/DiffViewer/DiffValue.vue +2 -11
  100. package/dist/runtime/editor/components/DraggableList.vue +1 -1
  101. package/dist/runtime/editor/components/EditProvider.vue +18 -1
  102. package/dist/runtime/editor/components/ShortcutIndicator/index.d.vue.ts +2 -2
  103. package/dist/runtime/editor/components/ShortcutIndicator/index.vue +27 -33
  104. package/dist/runtime/editor/components/ShortcutIndicator/index.vue.d.ts +2 -2
  105. package/dist/runtime/editor/components/index.d.ts +2 -1
  106. package/dist/runtime/editor/components/index.js +2 -0
  107. package/dist/runtime/editor/composables/useEditableFieldOverride.d.ts +2 -0
  108. package/dist/runtime/editor/composables/useEditableFieldOverride.js +21 -15
  109. package/dist/runtime/editor/css/output.css +1 -1
  110. package/dist/runtime/editor/events/index.d.ts +3 -0
  111. package/dist/runtime/editor/features/add-list/index.vue +1 -0
  112. package/dist/runtime/editor/features/analyze/Main.vue +1 -1
  113. package/dist/runtime/editor/features/analyze/analyzers/helpers/Context.d.ts +7 -2
  114. package/dist/runtime/editor/features/analyze/analyzers/helpers/Context.js +6 -1
  115. package/dist/runtime/editor/features/analyze/analyzers/readability.js +52 -222
  116. package/dist/runtime/editor/features/analyze/analyzers/types.d.ts +2 -2
  117. package/dist/runtime/editor/features/analyze/readability/adapterTypes.d.ts +9 -0
  118. package/dist/runtime/editor/features/analyze/readability/adapterTypes.js +0 -0
  119. package/dist/runtime/editor/features/analyze/readability/builtinAnalyzer.d.ts +6 -0
  120. package/dist/runtime/editor/features/analyze/readability/builtinAnalyzer.js +200 -0
  121. package/dist/runtime/editor/features/analyze/readability/chunkHtml.d.ts +15 -0
  122. package/dist/runtime/editor/features/analyze/readability/chunkHtml.js +97 -0
  123. package/dist/runtime/editor/features/analyze/readability/types.d.ts +72 -0
  124. package/dist/runtime/editor/features/analyze/readability/types.js +0 -0
  125. package/dist/runtime/editor/features/artboard/Renderer.vue +9 -5
  126. package/dist/runtime/editor/features/breadcrumbs/index.vue +1 -1
  127. package/dist/runtime/editor/features/dragging-overlay/index.vue +1 -1
  128. package/dist/runtime/editor/features/editable-field/index.vue +1 -1
  129. package/dist/runtime/editor/features/hover/index.vue +1 -1
  130. package/dist/runtime/editor/features/options/index.vue +1 -1
  131. package/dist/runtime/editor/features/selection/AddButtons/Renderer/index.vue +1 -1
  132. package/dist/runtime/editor/features/selection/index.vue +2 -2
  133. package/dist/runtime/editor/features/structure/List/Item/index.vue +1 -3
  134. package/dist/runtime/editor/helpers/diff/index.d.ts +11 -0
  135. package/dist/runtime/editor/helpers/diff/index.js +227 -0
  136. package/dist/runtime/editor/plugins/Sidebar/index.vue +1 -1
  137. package/dist/runtime/editor/providers/analyze.d.ts +2 -1
  138. package/dist/runtime/editor/providers/analyze.js +6 -3
  139. package/dist/runtime/editor/providers/directive.js +1 -0
  140. package/dist/runtime/editor/providers/fieldValue.d.ts +54 -0
  141. package/dist/runtime/editor/providers/fieldValue.js +126 -0
  142. package/dist/runtime/editor/providers/fieldValueAdapterTypes.d.ts +13 -0
  143. package/dist/runtime/editor/providers/fieldValueAdapterTypes.js +0 -0
  144. package/dist/runtime/editor/providers/readability.d.ts +23 -0
  145. package/dist/runtime/editor/providers/readability.js +130 -0
  146. package/dist/runtime/editor/providers/state.d.ts +16 -0
  147. package/dist/runtime/editor/providers/state.js +19 -1
  148. package/dist/runtime/editor/providers/ui.d.ts +7 -0
  149. package/dist/runtime/editor/providers/ui.js +7 -1
  150. package/dist/runtime/editor/translations/de.json +80 -8
  151. package/dist/runtime/editor/translations/fr.json +80 -8
  152. package/dist/runtime/editor/translations/gsw_CH.json +80 -8
  153. package/dist/runtime/editor/translations/it.json +80 -8
  154. package/dist/runtime/editor/types/app.d.ts +4 -0
  155. package/dist/shared/editor.9vf8ZnOp.mjs +288 -0
  156. package/package.json +2 -2
  157. package/dist/modules/agent/runtime/app/tools/update_text_fields/Item.d.vue.ts +0 -22
  158. package/dist/modules/agent/runtime/app/tools/update_text_fields/Item.vue +0 -95
  159. package/dist/modules/agent/runtime/app/tools/update_text_fields/Item.vue.d.ts +0 -22
  160. package/dist/shared/editor.BFIzNSQM.mjs +0 -146
@@ -6,11 +6,13 @@ const NOOP_OVERRIDE = {
6
6
  fieldType: "plain",
7
7
  setValue() {
8
8
  },
9
+ setDiffHtml() {
10
+ },
9
11
  restore() {
10
12
  }
11
13
  };
12
14
  export function useEditableFieldOverride(fieldName, host) {
13
- const { eventBus, state, types, definitions, directive } = useBlokkli();
15
+ const { eventBus, state, types, definitions, directive, fieldValue } = useBlokkli();
14
16
  const el = directive.findEditableElement(fieldName, host);
15
17
  if (!el) {
16
18
  return NOOP_OVERRIDE;
@@ -53,22 +55,11 @@ export function useEditableFieldOverride(fieldName, host) {
53
55
  const mutatedItemPropsKey = providerDefinition ? "HOST" : host.uuid;
54
56
  const usesMutatedProps = !!matchingProp;
55
57
  const usesDirectDom = !isComponent && !matchingProp;
56
- let originalValue;
57
- if (isComponent) {
58
- originalValue = editableData?.getValue ? editableData.getValue() : "";
59
- } else if (usesMutatedProps && matchingProp) {
60
- if (providerDefinition) {
61
- originalValue = state.mutatedEntity.value[matchingProp] || "";
62
- } else {
63
- originalValue = state.getFieldListItem(host.uuid)?.props?.[matchingProp] ?? "";
64
- }
65
- } else if (isMarkup) {
66
- originalValue = element.innerHTML;
67
- } else {
68
- originalValue = element.textContent || "";
69
- }
58
+ const readResult = fieldValue.readFieldValue(fieldName, host);
59
+ const originalValue = readResult?.value ?? "";
70
60
  const originalMutatedProp = usesMutatedProps && matchingProp ? state.mutatedItemProps[mutatedItemPropsKey]?.[matchingProp] : void 0;
71
61
  function setValue(value) {
62
+ element.removeAttribute("data-bk-diff-active");
72
63
  if (usesMutatedProps && matchingProp) {
73
64
  if (!state.mutatedItemProps[mutatedItemPropsKey]) {
74
65
  state.mutatedItemProps[mutatedItemPropsKey] = {};
@@ -90,7 +81,14 @@ export function useEditableFieldOverride(fieldName, host) {
90
81
  });
91
82
  }
92
83
  }
84
+ function setDiffHtml(html) {
85
+ element.setAttribute("data-bk-diff-active", "");
86
+ element.innerHTML = html;
87
+ state.markDirty(host.uuid);
88
+ }
93
89
  function restore() {
90
+ const wasDiffActive = element.hasAttribute("data-bk-diff-active");
91
+ element.removeAttribute("data-bk-diff-active");
94
92
  if (usesMutatedProps && matchingProp) {
95
93
  const propsObj = state.mutatedItemProps[mutatedItemPropsKey];
96
94
  if (propsObj) {
@@ -103,6 +101,13 @@ export function useEditableFieldOverride(fieldName, host) {
103
101
  propsObj[matchingProp] = originalMutatedProp;
104
102
  }
105
103
  }
104
+ if (wasDiffActive) {
105
+ if (isMarkup) {
106
+ element.innerHTML = originalValue;
107
+ } else {
108
+ element.textContent = originalValue;
109
+ }
110
+ }
106
111
  }
107
112
  if (usesDirectDom) {
108
113
  if (isMarkup) {
@@ -124,6 +129,7 @@ export function useEditableFieldOverride(fieldName, host) {
124
129
  originalValue,
125
130
  fieldType,
126
131
  setValue,
132
+ setDiffHtml,
127
133
  restore
128
134
  };
129
135
  }