@blokkli/editor 2.0.0-alpha.34 → 2.0.0-alpha.36

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 (204) hide show
  1. package/dist/global/types/blockOptions.d.ts +9 -2
  2. package/dist/global/types/definitions.d.ts +12 -5
  3. package/dist/module.d.mts +2 -2
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +56 -4
  6. package/dist/modules/agent/index.d.mts +1 -1
  7. package/dist/modules/agent/index.mjs +38 -20
  8. package/dist/modules/agent/runtime/app/composables/agentProvider.d.ts +2 -2
  9. package/dist/modules/agent/runtime/app/composables/agentProvider.js +3 -3
  10. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue +34 -60
  11. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.d.vue.ts +8 -0
  12. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue +138 -0
  13. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue.d.ts +8 -0
  14. package/dist/modules/agent/runtime/app/features/agent/index.vue +5 -1
  15. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +175 -0
  16. package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +5 -0
  17. package/dist/modules/agent/runtime/app/tools/schemas.d.ts +9 -0
  18. package/dist/modules/agent/runtime/app/tools/schemas.js +36 -23
  19. package/dist/modules/agent/runtime/server/Session.d.ts +4 -2
  20. package/dist/modules/agent/runtime/server/Session.js +61 -57
  21. package/dist/modules/agent/runtime/server/agentPrompt.d.ts +9 -1
  22. package/dist/modules/agent/runtime/server/agentPrompt.js +26 -0
  23. package/dist/modules/agent/runtime/shared/types.d.ts +35 -1
  24. package/dist/modules/charts/index.d.mts +35 -0
  25. package/dist/modules/charts/index.mjs +43 -0
  26. package/dist/modules/charts/runtime/blokkli/skills/charts.d.ts +2 -0
  27. package/dist/modules/charts/runtime/blokkli/skills/charts.js +42 -0
  28. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.d.ts +63 -0
  29. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.js +98 -0
  30. package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.d.ts +2 -0
  31. package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.js +86 -0
  32. package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.d.ts +2 -0
  33. package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.js +74 -0
  34. package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.d.ts +2 -0
  35. package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.js +42 -0
  36. package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.d.ts +2 -0
  37. package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.js +101 -0
  38. package/dist/modules/charts/runtime/chartTypes/area.d.ts +2 -0
  39. package/dist/modules/charts/runtime/chartTypes/area.js +68 -0
  40. package/dist/modules/charts/runtime/chartTypes/bar.d.ts +2 -0
  41. package/dist/modules/charts/runtime/chartTypes/bar.js +76 -0
  42. package/dist/modules/charts/runtime/chartTypes/define.d.ts +2 -0
  43. package/dist/modules/charts/runtime/chartTypes/define.js +3 -0
  44. package/dist/modules/charts/runtime/chartTypes/donut.d.ts +2 -0
  45. package/dist/modules/charts/runtime/chartTypes/donut.js +45 -0
  46. package/dist/modules/charts/runtime/chartTypes/heatmap.d.ts +2 -0
  47. package/dist/modules/charts/runtime/chartTypes/heatmap.js +54 -0
  48. package/dist/modules/charts/runtime/chartTypes/index.d.ts +21 -0
  49. package/dist/modules/charts/runtime/chartTypes/index.js +47 -0
  50. package/dist/modules/charts/runtime/chartTypes/line.d.ts +2 -0
  51. package/dist/modules/charts/runtime/chartTypes/line.js +68 -0
  52. package/dist/modules/charts/runtime/chartTypes/pie.d.ts +2 -0
  53. package/dist/modules/charts/runtime/chartTypes/pie.js +28 -0
  54. package/dist/modules/charts/runtime/chartTypes/radar.d.ts +2 -0
  55. package/dist/modules/charts/runtime/chartTypes/radar.js +52 -0
  56. package/dist/modules/charts/runtime/chartTypes/radialBar.d.ts +2 -0
  57. package/dist/modules/charts/runtime/chartTypes/radialBar.js +44 -0
  58. package/dist/modules/charts/runtime/chartTypes/shared.d.ts +52 -0
  59. package/dist/modules/charts/runtime/chartTypes/shared.js +103 -0
  60. package/dist/modules/charts/runtime/chartTypes/types.d.ts +29 -0
  61. package/dist/modules/charts/runtime/chartTypes/types.js +0 -0
  62. package/dist/modules/charts/runtime/components/ChartRenderer/index.d.vue.ts +4 -0
  63. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +120 -0
  64. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue.d.ts +4 -0
  65. package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.d.vue.ts +3 -0
  66. package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.vue +29 -0
  67. package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.vue.d.ts +3 -0
  68. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.d.vue.ts +15 -0
  69. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue +97 -0
  70. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue.d.ts +15 -0
  71. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.d.vue.ts +11 -0
  72. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue +34 -0
  73. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue.d.ts +11 -0
  74. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.d.vue.ts +12 -0
  75. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +49 -0
  76. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue.d.ts +12 -0
  77. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.d.vue.ts +19 -0
  78. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue +90 -0
  79. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue.d.ts +19 -0
  80. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.d.vue.ts +23 -0
  81. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue +224 -0
  82. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue.d.ts +23 -0
  83. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.d.vue.ts +10 -0
  84. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue +61 -0
  85. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue.d.ts +10 -0
  86. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.d.vue.ts +8 -0
  87. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue +23 -0
  88. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue.d.ts +8 -0
  89. package/dist/modules/charts/runtime/features/charts/Editor/index.d.vue.ts +10 -0
  90. package/dist/modules/charts/runtime/features/charts/Editor/index.vue +243 -0
  91. package/dist/modules/charts/runtime/features/charts/Editor/index.vue.d.ts +10 -0
  92. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.d.ts +17 -0
  93. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.js +90 -0
  94. package/dist/modules/charts/runtime/features/charts/index.d.vue.ts +3 -0
  95. package/dist/modules/charts/runtime/features/charts/index.vue +72 -0
  96. package/dist/modules/charts/runtime/features/charts/index.vue.d.ts +3 -0
  97. package/dist/modules/charts/runtime/helpers/index.d.ts +1 -0
  98. package/dist/modules/charts/runtime/helpers/index.js +17 -0
  99. package/dist/modules/charts/runtime/types.d.ts +51 -0
  100. package/dist/modules/charts/runtime/types.js +64 -0
  101. package/dist/modules/drupal/graphql/features/fragments.graphql +2 -0
  102. package/dist/modules/drupal/index.d.mts +1 -1
  103. package/dist/modules/drupal/runtime/adapter/index.js +12 -8
  104. package/dist/modules/table-of-contents/index.d.mts +11 -0
  105. package/dist/modules/table-of-contents/index.mjs +24 -0
  106. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.d.vue.ts +44 -0
  107. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue +43 -0
  108. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue.d.ts +44 -0
  109. package/dist/modules/table-of-contents/runtime/types/index.d.ts +4 -0
  110. package/dist/modules/table-of-contents/runtime/types/index.js +0 -0
  111. package/dist/runtime/components/Blocks/Fragment/index.vue +6 -2
  112. package/dist/runtime/components/BlokkliField.d.vue.ts +6 -0
  113. package/dist/runtime/components/BlokkliField.vue +4 -0
  114. package/dist/runtime/components/BlokkliField.vue.d.ts +6 -0
  115. package/dist/runtime/components/BlokkliItem.vue +8 -3
  116. package/dist/runtime/components/BlokkliProvider.d.vue.ts +7 -0
  117. package/dist/runtime/components/BlokkliProvider.vue +7 -1
  118. package/dist/runtime/components/BlokkliProvider.vue.d.ts +7 -0
  119. package/dist/runtime/composables/useBlokkliHelper.js +4 -2
  120. package/dist/runtime/editor/components/AnimationCanvas/index.vue +31 -22
  121. package/dist/runtime/editor/components/Banner/index.d.vue.ts +12 -2
  122. package/dist/runtime/editor/components/Banner/index.vue +4 -2
  123. package/dist/runtime/editor/components/Banner/index.vue.d.ts +12 -2
  124. package/dist/runtime/editor/components/DraggableList.d.vue.ts +2 -0
  125. package/dist/runtime/editor/components/DraggableList.vue +4 -1
  126. package/dist/runtime/editor/components/DraggableList.vue.d.ts +2 -0
  127. package/dist/runtime/editor/components/Dropdown/index.d.vue.ts +27 -0
  128. package/dist/runtime/editor/components/Dropdown/index.vue +107 -0
  129. package/dist/runtime/editor/components/Dropdown/index.vue.d.ts +27 -0
  130. package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue +1 -1
  131. package/dist/runtime/editor/components/EditProvider.d.vue.ts +2 -0
  132. package/dist/runtime/editor/components/EditProvider.vue +4 -3
  133. package/dist/runtime/editor/components/EditProvider.vue.d.ts +2 -0
  134. package/dist/runtime/editor/components/Form/Radio/index.d.vue.ts +1 -0
  135. package/dist/runtime/editor/components/Form/Radio/index.vue +3 -2
  136. package/dist/runtime/editor/components/Form/Radio/index.vue.d.ts +1 -0
  137. package/dist/runtime/editor/components/ItemIcon/index.vue +10 -2
  138. package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +13 -3
  139. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +15 -7
  140. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +13 -3
  141. package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +2 -0
  142. package/dist/runtime/editor/components/PreviewProvider.vue +3 -2
  143. package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +2 -0
  144. package/dist/runtime/editor/components/ShortcutIndicator/index.vue +1 -1
  145. package/dist/runtime/editor/components/index.d.ts +3 -1
  146. package/dist/runtime/editor/components/index.js +4 -0
  147. package/dist/runtime/editor/composables/onElementResize.js +0 -1
  148. package/dist/runtime/editor/composables/useEditableFieldOverride.js +4 -5
  149. package/dist/runtime/editor/css/output.css +1 -1
  150. package/dist/runtime/editor/events/index.d.ts +7 -0
  151. package/dist/runtime/editor/features/add-list/Help/Item.vue +5 -2
  152. package/dist/runtime/editor/features/artboard/Renderer.vue +1 -1
  153. package/dist/runtime/editor/features/clipboard/index.vue +1 -1
  154. package/dist/runtime/editor/features/debug/index.vue +1 -1
  155. package/dist/runtime/editor/features/dev-mode/index.vue +86 -2
  156. package/dist/runtime/editor/features/edit/index.vue +20 -0
  157. package/dist/runtime/editor/features/fragments/types.d.ts +1 -0
  158. package/dist/runtime/editor/features/hover/Renderer/index.vue +30 -3
  159. package/dist/runtime/editor/features/hover/index.vue +1 -1
  160. package/dist/runtime/editor/features/options/Form/Checkbox/index.d.vue.ts +2 -2
  161. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue +3 -3
  162. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue.d.ts +2 -2
  163. package/dist/runtime/editor/features/options/Form/Checkboxes/index.d.vue.ts +2 -2
  164. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue +5 -5
  165. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue.d.ts +2 -2
  166. package/dist/runtime/editor/features/options/Form/Item.d.vue.ts +2 -2
  167. package/dist/runtime/editor/features/options/Form/Item.vue +14 -48
  168. package/dist/runtime/editor/features/options/Form/Item.vue.d.ts +2 -2
  169. package/dist/runtime/editor/features/options/Form/Number/index.d.vue.ts +3 -3
  170. package/dist/runtime/editor/features/options/Form/Number/index.vue +7 -17
  171. package/dist/runtime/editor/features/options/Form/Number/index.vue.d.ts +3 -3
  172. package/dist/runtime/editor/features/options/Form/Range/index.d.vue.ts +2 -2
  173. package/dist/runtime/editor/features/options/Form/Range/index.vue +4 -4
  174. package/dist/runtime/editor/features/options/Form/Range/index.vue.d.ts +2 -2
  175. package/dist/runtime/editor/features/options/Form/index.vue +10 -5
  176. package/dist/runtime/editor/features/selection/index.vue +2 -2
  177. package/dist/runtime/editor/features/transform/index.vue +1 -3
  178. package/dist/runtime/editor/providers/definition.d.ts +2 -2
  179. package/dist/runtime/editor/providers/definition.js +7 -1
  180. package/dist/runtime/editor/providers/dom.d.ts +5 -0
  181. package/dist/runtime/editor/providers/dom.js +11 -2
  182. package/dist/runtime/editor/providers/fields.d.ts +19 -1
  183. package/dist/runtime/editor/providers/fields.js +54 -2
  184. package/dist/runtime/editor/translations/de.json +269 -1
  185. package/dist/runtime/editor/translations/fr.json +269 -1
  186. package/dist/runtime/editor/translations/gsw_CH.json +269 -1
  187. package/dist/runtime/editor/translations/it.json +269 -1
  188. package/dist/runtime/editor/types/field.d.ts +2 -1
  189. package/dist/runtime/helpers/imports/index.d.ts +8 -1
  190. package/dist/runtime/helpers/imports/index.js +15 -6
  191. package/dist/runtime/helpers/injections.d.ts +10 -1
  192. package/dist/runtime/helpers/injections.js +6 -0
  193. package/dist/runtime/helpers/runtimeHelpers/index.js +14 -0
  194. package/dist/runtime/types/definitions.d.ts +8 -5
  195. package/dist/runtime/types/provider.d.ts +2 -0
  196. package/dist/shared/editor.6D5vApr0.mjs +30 -0
  197. package/dist/shared/{editor.DMFfaLVE.mjs → editor.BFIzNSQM.mjs} +1 -30
  198. package/dist/shared/{editor.Iax3GCvt.d.mts → editor.CWQIFIEQ.d.mts} +22 -0
  199. package/dist/types.d.mts +1 -1
  200. package/package.json +17 -1
  201. package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.js +0 -104
  202. /package/dist/modules/agent/runtime/app/tools/{get_available_bundles → get_bundle_info}/index.d.ts +0 -0
  203. /package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.d.vue.ts +0 -0
  204. /package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue.d.ts +0 -0
@@ -344,7 +344,14 @@ type DefinitionOptionRadiosBase<Icon extends string = string> = {
344
344
  */
345
345
  group?: string;
346
346
  } & (DefinitionOptionRadiosColors | DefinitionOptionRadiosGrid | DefinitionOptionRadiosRadios | DefinitionOptionRadiosIconsBase<Icon>);
347
- export type BlockOptionDefinitionBase<Icon extends string = string> = DefinitionOptionColor | DefinitionOptionCheckbox | DefinitionOptionCheckboxes | DefinitionOptionRadiosBase<Icon> | DefinitionOptionText | DefinitionOptionRange | DefinitionOptionNumber | DefinitionOptionDateTimeLocal;
347
+ type DefinitionOptionJson = {
348
+ type: 'json';
349
+ label: string;
350
+ default: string;
351
+ description?: string;
352
+ group?: string;
353
+ };
354
+ export type BlockOptionDefinitionBase<Icon extends string = string> = DefinitionOptionJson | DefinitionOptionColor | DefinitionOptionCheckbox | DefinitionOptionCheckboxes | DefinitionOptionRadiosBase<Icon> | DefinitionOptionText | DefinitionOptionRange | DefinitionOptionNumber | DefinitionOptionDateTimeLocal;
348
355
  /**
349
356
  * Runtime block option array with validation data.
350
357
  * The third element varies by option type:
@@ -353,7 +360,7 @@ export type BlockOptionDefinitionBase<Icon extends string = string> = Definition
353
360
  * - datetime-local: optional [min?, max?] tuple
354
361
  * - other types: no third element
355
362
  */
356
- export type RuntimeBlockOptionArray = ['text', string] | ['checkbox', boolean] | ['color', `#${string}`] | ['radios', string, string[]] | ['checkboxes', string[], string[]] | ['number', number, [number, number]] | ['range', number, [number, number]] | ['datetime-local', string | undefined] | [
363
+ export type RuntimeBlockOptionArray = ['text', string] | ['json', string] | ['checkbox', boolean] | ['color', `#${string}`] | ['radios', string, string[]] | ['checkboxes', string[], string[]] | ['number', number, [number, number]] | ['range', number, [number, number]] | ['datetime-local', string | undefined] | [
357
364
  'datetime-local',
358
365
  string | undefined,
359
366
  [
@@ -15,7 +15,14 @@ export type BlockDefinitionRenderForFieldListBase<FieldListTypes extends string
15
15
  export type BlockDefinitionRenderForFieldListTypeBase<FieldListTypes extends string = string> = {
16
16
  fieldListType: FieldListTypes;
17
17
  };
18
- export type BlockDefinitionRenderForBase<BundleWithNested extends string = string, FieldListTypes extends string = string> = BlockDefinitionRenderForParentBase<BundleWithNested> | BlockDefinitionRenderForFieldListBase<FieldListTypes> | BlockDefinitionRenderForFieldListTypeBase<FieldListTypes>;
18
+ export type BlockDefinitionRenderForProviderTypeBase<ProviderType extends string = string> = {
19
+ providerType: ProviderType;
20
+ };
21
+ export type PropsFieldMapping = {
22
+ type: 'editable' | 'droppable' | 'field';
23
+ name: string;
24
+ };
25
+ export type BlockDefinitionRenderForBase<BundleWithNested extends string = string, FieldListTypes extends string = string, ProviderType extends string = string> = BlockDefinitionRenderForParentBase<BundleWithNested> | BlockDefinitionRenderForFieldListBase<FieldListTypes> | BlockDefinitionRenderForFieldListTypeBase<FieldListTypes> | BlockDefinitionRenderForProviderTypeBase<ProviderType>;
19
26
  export type BlokkliDefinitionInputEditorBase<Options extends BlockDefinitionOptionsInputBase = BlockDefinitionOptionsInputBase, Icon extends string = string, PropsType = Record<string, any>> = {
20
27
  /**
21
28
  * The icon rendered in the editor.
@@ -152,7 +159,7 @@ export type BlokkliDefinitionInputEditorBase<Options extends BlockDefinitionOpti
152
159
  */
153
160
  mapDiffProps?: (props?: PropsType) => Record<string, string>;
154
161
  };
155
- export type BlockDefinitionInputBase<Options extends BlockDefinitionOptionsInputBase = BlockDefinitionOptionsInputBase, GlobalOptions extends string[] | undefined = string[], Bundle extends string = string, ChunkNames extends string = string, BundleWithNested extends string = string, FieldListTypes extends string = string, Icon extends string = string, BundlePropsMap extends Record<string, Record<string, any>> = Record<string, Record<string, any>>> = {
162
+ export type BlockDefinitionInputBase<Options extends BlockDefinitionOptionsInputBase = BlockDefinitionOptionsInputBase, GlobalOptions extends string[] | undefined = string[], Bundle extends string = string, ChunkNames extends string = string, BundleWithNested extends string = string, FieldListTypes extends string = string, Icon extends string = string, BundlePropsMap extends Record<string, Record<string, any>> = Record<string, Record<string, any>>, ProviderTypes extends string = string> = {
156
163
  /**
157
164
  * The bundle ID of the block, e.g. "text" or "section_title".
158
165
  */
@@ -162,7 +169,7 @@ export type BlockDefinitionInputBase<Options extends BlockDefinitionOptionsInput
162
169
  * If a bundle is defined, then this component will be rendered if the
163
170
  * parent matches the given bundle.
164
171
  */
165
- renderFor?: BlockDefinitionRenderForBase<BundleWithNested, FieldListTypes> | BlockDefinitionRenderForBase<BundleWithNested, FieldListTypes>[];
172
+ renderFor?: BlockDefinitionRenderForBase<BundleWithNested, FieldListTypes, ProviderTypes> | BlockDefinitionRenderForBase<BundleWithNested, FieldListTypes, ProviderTypes>[];
166
173
  /**
167
174
  * The name of the chunk group.
168
175
  *
@@ -216,7 +223,7 @@ export type BlockDefinitionInputBase<Options extends BlockDefinitionOptionsInput
216
223
  * </script>
217
224
  * ```
218
225
  */
219
- propsFieldMapping?: Bundle extends keyof BundlePropsMap ? Partial<Record<keyof BundlePropsMap[Bundle], string>> : never;
226
+ propsFieldMapping?: Bundle extends keyof BundlePropsMap ? Record<keyof BundlePropsMap[Bundle], PropsFieldMapping | null> : Record<string, PropsFieldMapping | null>;
220
227
  };
221
228
  export type FragmentDefinitionInputBase<Options extends BlockDefinitionOptionsInputBase = BlockDefinitionOptionsInputBase, GlobalOptions extends string[] | undefined = string[], ChunkNames extends string = string, Icon extends string = string> = {
222
229
  /**
@@ -274,5 +281,5 @@ export type ProviderDefinitionInputBase<Options extends BlockDefinitionOptionsIn
274
281
  * These options will be merged with the component-specific options.
275
282
  */
276
283
  globalOptions?: GlobalOptions;
277
- propsFieldMapping?: Record<string, string>;
284
+ propsFieldMapping?: Record<string, PropsFieldMapping | null>;
278
285
  };
package/dist/module.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NuxtModule } from 'nuxt/schema';
2
- import { M as ModuleOptions } from './shared/editor.Iax3GCvt.mjs';
3
- export { a as ModuleHooks } from './shared/editor.Iax3GCvt.mjs';
2
+ import { M as ModuleOptions } from './shared/editor.CWQIFIEQ.mjs';
3
+ export { a as ModuleHooks } from './shared/editor.CWQIFIEQ.mjs';
4
4
  import 'consola';
5
5
  import '../dist/global/types/definitions.js';
6
6
  import '../dist/global/types/theme.js';
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blokkli/editor",
3
3
  "configKey": "blokkli",
4
- "version": "2.0.0-alpha.34",
4
+ "version": "2.0.0-alpha.36",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.15.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -8,16 +8,17 @@ import * as ts from 'typescript';
8
8
  import { parseAndWalk } from 'oxc-walker';
9
9
  import path__default, { basename, dirname as dirname$1 } from 'node:path';
10
10
  import { dirname, resolve, relative } from 'pathe';
11
- import { C as Collector, a as CollectedFile, d as defineCodeTemplate, b as defineFileTemplate, w as withHelper } from './shared/editor.DMFfaLVE.mjs';
11
+ import { C as Collector, a as CollectedFile } from './shared/editor.BFIzNSQM.mjs';
12
12
  import micromatch from 'micromatch';
13
13
  import { hash } from 'ohash';
14
14
  import fs__default, { readFileSync, existsSync, readdirSync } from 'node:fs';
15
15
  import { LANGUAGES, BK_VISIBLE_LANGUAGES, BK_HIDDEN_GLOBALLY } from './global/constants';
16
16
  import { createRequire } from 'node:module';
17
+ import { d as defineCodeTemplate, a as defineFileTemplate, w as withHelper } from './shared/editor.6D5vApr0.mjs';
17
18
  import { defu, createDefu } from 'defu';
18
19
 
19
20
  const name = "@blokkli/editor";
20
- const version = "2.0.0-alpha.34";
21
+ const version = "2.0.0-alpha.36";
21
22
 
22
23
  function sortObjectKeys(obj) {
23
24
  if (Array.isArray(obj)) {
@@ -277,6 +278,8 @@ function getVariations(definition) {
277
278
  return `block:${bundle}__p:${v.parentBundle}`;
278
279
  } else if ("fieldList" in v) {
279
280
  return `block:${bundle}__f:${v.fieldList}`;
281
+ } else if ("providerType" in v) {
282
+ return `block:${bundle}__t:${v.providerType}`;
280
283
  } else {
281
284
  return `block:${bundle}__f:${v.fieldListType}`;
282
285
  }
@@ -1140,6 +1143,10 @@ class ModuleHelper {
1140
1143
  if (!fieldListTypes.includes("default")) {
1141
1144
  fieldListTypes.push("default");
1142
1145
  }
1146
+ const providerTypes = providedOptions.providerTypes || [];
1147
+ if (!providerTypes.includes("default")) {
1148
+ providerTypes.push("default");
1149
+ }
1143
1150
  const chunkNames = providedOptions.chunkNames || [];
1144
1151
  if (!chunkNames.includes("global")) {
1145
1152
  chunkNames.push("global");
@@ -1148,6 +1155,7 @@ class ModuleHelper {
1148
1155
  ...providedOptions,
1149
1156
  pattern,
1150
1157
  fieldListTypes: fieldListTypes.filter(onlyUnique),
1158
+ providerTypes: providerTypes.filter(onlyUnique),
1151
1159
  chunkNames: chunkNames.filter(onlyUnique)
1152
1160
  };
1153
1161
  this.paths.editAdapter = this.findEditAdapterPath();
@@ -1261,7 +1269,17 @@ class ModuleContext {
1261
1269
  templates = [];
1262
1270
  templateContents = /* @__PURE__ */ new Map();
1263
1271
  adapterExtensions = [];
1272
+ featureFragments = /* @__PURE__ */ new Set();
1264
1273
  collectors = [];
1274
+ addFeatureFragment(name) {
1275
+ if (this.featureFragments.has(name)) {
1276
+ throw new Error(`A feature fragment with name "${name}" already exists.`);
1277
+ }
1278
+ this.featureFragments.add(name);
1279
+ }
1280
+ getFeatureFragmentNames() {
1281
+ return [...this.featureFragments.values()];
1282
+ }
1265
1283
  registerAdapterExtension(namespace, path) {
1266
1284
  if (this.adapterExtensions.some((e) => e.namespace === namespace)) {
1267
1285
  throw new Error(`Duplicate adapter extension namespace: ${namespace}`);
@@ -1469,9 +1487,12 @@ function toTypeLiteral(value) {
1469
1487
  const USED_MATERIAL_ICONS = [
1470
1488
  "bk_mdi_account_tree",
1471
1489
  "bk_mdi_add",
1490
+ "bk_mdi_add_column_right",
1472
1491
  "bk_mdi_add_comment",
1492
+ "bk_mdi_add_row_below",
1473
1493
  "bk_mdi_anchor",
1474
1494
  "bk_mdi_architecture",
1495
+ "bk_mdi_area_chart",
1475
1496
  "bk_mdi_arrow_downward",
1476
1497
  "bk_mdi_arrow_drop_down",
1477
1498
  "bk_mdi_arrow_left",
@@ -1504,6 +1525,7 @@ const USED_MATERIAL_ICONS = [
1504
1525
  "bk_mdi_dock_to_left",
1505
1526
  "bk_mdi_dock_to_right",
1506
1527
  "bk_mdi_done_all",
1528
+ "bk_mdi_donut_large",
1507
1529
  "bk_mdi_drag_pan",
1508
1530
  "bk_mdi_edit",
1509
1531
  "bk_mdi_exit_to_app",
@@ -1530,10 +1552,12 @@ const USED_MATERIAL_ICONS = [
1530
1552
  "bk_mdi_palette",
1531
1553
  "bk_mdi_person",
1532
1554
  "bk_mdi_person-fill",
1555
+ "bk_mdi_pie_chart",
1533
1556
  "bk_mdi_priority_high",
1534
1557
  "bk_mdi_publish",
1535
1558
  "bk_mdi_qr_code",
1536
1559
  "bk_mdi_question_mark",
1560
+ "bk_mdi_radar",
1537
1561
  "bk_mdi_radio_button_checked",
1538
1562
  "bk_mdi_redo",
1539
1563
  "bk_mdi_remove",
@@ -1548,6 +1572,7 @@ const USED_MATERIAL_ICONS = [
1548
1572
  "bk_mdi_sentiment_dissatisfied",
1549
1573
  "bk_mdi_sentiment_worried",
1550
1574
  "bk_mdi_settings",
1575
+ "bk_mdi_show_chart",
1551
1576
  "bk_mdi_speed",
1552
1577
  "bk_mdi_stack_group",
1553
1578
  "bk_mdi_stop",
@@ -1557,6 +1582,7 @@ const USED_MATERIAL_ICONS = [
1557
1582
  "bk_mdi_text_select_end",
1558
1583
  "bk_mdi_texture",
1559
1584
  "bk_mdi_title",
1585
+ "bk_mdi_track_changes",
1560
1586
  "bk_mdi_trackpad_input",
1561
1587
  "bk_mdi_translate",
1562
1588
  "bk_mdi_tune",
@@ -2686,6 +2712,7 @@ const editorConfig = defineCodeTemplate(
2686
2712
  "editor-config",
2687
2713
  (ctx) => {
2688
2714
  const settingsOverride = ctx.helper.options.settingsOverride || {};
2715
+ const featureFragmentNames = ctx.getFeatureFragmentNames();
2689
2716
  return `
2690
2717
  export const hasCustomTheme = ${JSON.stringify(ctx.theme.hasCustomTheme)}
2691
2718
 
@@ -2708,6 +2735,8 @@ export const defaultLanguage = ${JSON.stringify(
2708
2735
  export const forceDefaultLanguage = ${JSON.stringify(
2709
2736
  !!ctx.helper.options.forceDefaultLanguage
2710
2737
  )}
2738
+
2739
+ export const featureFragmentNames = ${JSON.stringify(featureFragmentNames)}
2711
2740
  `;
2712
2741
  },
2713
2742
  (ctx) => {
@@ -2760,6 +2789,11 @@ export declare const templateEntityType: string | null
2760
2789
  * Whether to always force the default language, even on translation pages.
2761
2790
  */
2762
2791
  export declare const forceDefaultLanguage: boolean
2792
+
2793
+ /**
2794
+ * The fragment names provided by features.
2795
+ */
2796
+ export declare const featureFragmentNames: string[]
2763
2797
  `;
2764
2798
  }
2765
2799
  );
@@ -2978,6 +3012,8 @@ function toRuntimeOptionArray(option) {
2978
3012
  return [option.type, option.default];
2979
3013
  } else if (option.type === "color") {
2980
3014
  return [option.type, option.default];
3015
+ } else if (option.type === "json") {
3016
+ return [option.type, option.default];
2981
3017
  }
2982
3018
  return [option.type, option.default];
2983
3019
  }
@@ -3026,9 +3062,20 @@ const runtimeOptions = defineCodeTemplate(
3026
3062
  });
3027
3063
  if (isBlock(item.definition)) {
3028
3064
  if (item.definition.propsFieldMapping) {
3065
+ const mapping = Object.entries(
3066
+ item.definition.propsFieldMapping
3067
+ ).reduce(
3068
+ (acc, [propName, mapping2]) => {
3069
+ if (mapping2) {
3070
+ acc[propName] = [mapping2.type, mapping2.name];
3071
+ }
3072
+ return acc;
3073
+ },
3074
+ {}
3075
+ );
3029
3076
  FIELD_MAPPING.set(
3030
3077
  item.definition.bundle,
3031
- JSON.stringify(item.definition.propsFieldMapping, null, 2)
3078
+ JSON.stringify(mapping, null, 2)
3032
3079
  );
3033
3080
  }
3034
3081
  }
@@ -3094,8 +3141,10 @@ export type RuntimeBlockOptions = {
3094
3141
  ${runtimeMappedOptionTypes}
3095
3142
  }
3096
3143
 
3144
+ export type PropsFieldMappingType = 'editable' | 'droppable' | 'field'
3145
+
3097
3146
  export declare const OPTIONS: Record<string, Record<string, RuntimeBlockOptionArray>>
3098
- export declare const FIELD_MAPPING: Record<string, Record<string, string>>
3147
+ export declare const FIELD_MAPPING: Record<string, Record<string, [PropsFieldMappingType, string]>>
3099
3148
  `;
3100
3149
  },
3101
3150
  {
@@ -3191,6 +3240,7 @@ const generatedTypes = defineCodeTemplate(
3191
3240
  };
3192
3241
  const chunkNames = ctx.helper.options.chunkNames || ["global"];
3193
3242
  const fieldListTypes = ctx.helper.options.fieldListTypes || ["default"];
3243
+ const providerTypes = ctx.helper.options.providerTypes || ["default"];
3194
3244
  const globalOptions = ctx.helper.options.globalOptions || {};
3195
3245
  const validGlobalOptions = Object.keys(globalOptions);
3196
3246
  const blockBundlesWithNested = [];
@@ -3250,6 +3300,8 @@ import type { FieldListItem } from "${ctx.helper.relativePaths.TYPES}"
3250
3300
 
3251
3301
  export type ValidFieldListTypes = ${toStringUnion(fieldListTypes)}
3252
3302
 
3303
+ export type ValidProviderTypes = ${toStringUnion(providerTypes)}
3304
+
3253
3305
  export type BlockBundle = ${toStringUnion(validBlockBundles)}
3254
3306
 
3255
3307
  export type BlockBundleWithNested = ${toStringUnion(blockBundlesWithNested)}
@@ -1,4 +1,4 @@
1
- import { B as BlokkliModule } from '../../shared/editor.Iax3GCvt.mjs';
1
+ import { B as BlokkliModule } from '../../shared/editor.CWQIFIEQ.mjs';
2
2
  import 'nuxt/schema';
3
3
  import 'consola';
4
4
  import '../../../dist/global/types/definitions.js';
@@ -3,7 +3,8 @@ import { fileURLToPath } from 'node:url';
3
3
  import * as path from 'node:path';
4
4
  import { d as defineBlokkliModule } from '../../shared/editor.CGf7C_0M.mjs';
5
5
  import * as fs from 'node:fs';
6
- import { C as Collector, a as CollectedFile, d as defineCodeTemplate } from '../../shared/editor.DMFfaLVE.mjs';
6
+ import { C as Collector, a as CollectedFile } from '../../shared/editor.BFIzNSQM.mjs';
7
+ import { d as defineCodeTemplate } from '../../shared/editor.6D5vApr0.mjs';
7
8
 
8
9
  function toImportName(prefix, fileName) {
9
10
  const name = fileName.split(/[-_]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
@@ -90,7 +91,7 @@ class AgentCollector extends Collector {
90
91
  }
91
92
  }
92
93
 
93
- function createClientTemplate(toolCollector, promptCollector, defaultPrompts, models, agentName) {
94
+ function createClientTemplate(toolCollector, promptCollector, options) {
94
95
  return defineCodeTemplate(
95
96
  "agent-client",
96
97
  (ctx) => {
@@ -126,10 +127,15 @@ function createClientTemplate(toolCollector, promptCollector, defaultPrompts, mo
126
127
  );
127
128
  }
128
129
  exports$1.push(
129
- `export const defaultPrompts = ${JSON.stringify(defaultPrompts)}`
130
+ `export const defaultPrompts = ${JSON.stringify(options.defaultPrompts ?? [])}`
131
+ );
132
+ exports$1.push(`export const models = ${JSON.stringify(options.models)}`);
133
+ exports$1.push(
134
+ `export const agentName = ${JSON.stringify(options.agentName ?? "Blocki")}`
135
+ );
136
+ exports$1.push(
137
+ `export const hasWebFetch = ${JSON.stringify(!!options.allowedFetchOrigins)}`
130
138
  );
131
- exports$1.push(`export const models = ${JSON.stringify(models)}`);
132
- exports$1.push(`export const agentName = ${JSON.stringify(agentName)}`);
133
139
  const parts = [];
134
140
  if (imports.length > 0) {
135
141
  parts.push(imports.join("\n"));
@@ -146,6 +152,7 @@ export const agentPrompts: AgentPromptItem[]
146
152
  export const defaultPrompts: string[]
147
153
  export const agentName: string
148
154
  export const models: AgentModelDefinition[]
155
+ export const hasWebFetch: boolean
149
156
  `;
150
157
  }
151
158
  );
@@ -283,15 +290,19 @@ export default defineNuxtConfig({
283
290
  "#blokkli/agent/server",
284
291
  moduleResolver.resolve("./runtime/server")
285
292
  );
293
+ const moduleBlokkliDirs = ctx.helper.options.blokkliDirs || [];
286
294
  const moduleToolsDir = moduleResolver.resolve("./runtime/app/tools");
287
295
  const projectToolsDir = path.resolve(nuxt.options.rootDir, "blokkli/tools");
288
296
  const mcpTools = new AgentCollector(ctx.helper, {
289
297
  composable: "defineBlokkliAgentTool",
290
298
  importPrefix: "tool",
291
299
  dependency: "agent-mcp-tools",
292
- dirs: [moduleToolsDir, projectToolsDir]
300
+ dirs: [
301
+ moduleToolsDir,
302
+ projectToolsDir,
303
+ ...moduleBlokkliDirs.map((d) => path.join(d, "tools"))
304
+ ]
293
305
  });
294
- await mcpTools.init();
295
306
  ctx.context.addCollector(mcpTools);
296
307
  const projectPromptsDir = path.resolve(
297
308
  nuxt.options.rootDir,
@@ -301,18 +312,14 @@ export default defineNuxtConfig({
301
312
  composable: "defineBlokkliAgentPrompt",
302
313
  importPrefix: "prompt",
303
314
  dependency: "agent-prompts",
304
- dirs: [projectPromptsDir]
315
+ dirs: [
316
+ projectPromptsDir,
317
+ ...moduleBlokkliDirs.map((d) => path.join(d, "prompts"))
318
+ ]
305
319
  });
306
- await promptsCollector.init();
307
320
  ctx.context.addCollector(promptsCollector);
308
321
  ctx.context.addTemplate(
309
- createClientTemplate(
310
- mcpTools,
311
- promptsCollector,
312
- options.defaultPrompts || [],
313
- options.models,
314
- options.agentName ?? "Blocki"
315
- )
322
+ createClientTemplate(mcpTools, promptsCollector, options)
316
323
  );
317
324
  const relativeToolsDir = path.relative(
318
325
  nuxt.options.buildDir,
@@ -326,6 +333,11 @@ export default defineNuxtConfig({
326
333
  projectPromptsDir
327
334
  );
328
335
  nuxt.options.typescript.tsConfig.include.push(relativePromptsDir);
336
+ for (const dir of moduleBlokkliDirs) {
337
+ const toolsDir = path.join(dir, "tools");
338
+ const relDir = path.relative(nuxt.options.buildDir, toolsDir);
339
+ nuxt.options.typescript.tsConfig.include.push(relDir);
340
+ }
329
341
  const moduleSkillsDir = moduleResolver.resolve(
330
342
  "./runtime/server/default-skills"
331
343
  );
@@ -337,9 +349,12 @@ export default defineNuxtConfig({
337
349
  composable: "defineBlokkliAgentSkill",
338
350
  importPrefix: "skill",
339
351
  dependency: "agent-server",
340
- dirs: [moduleSkillsDir, projectSkillsDir]
352
+ dirs: [
353
+ moduleSkillsDir,
354
+ projectSkillsDir,
355
+ ...moduleBlokkliDirs.map((d) => path.join(d, "skills"))
356
+ ]
341
357
  });
342
- await skillsCollector.init();
343
358
  ctx.context.addCollector(skillsCollector);
344
359
  const moduleSystemPromptsDir = moduleResolver.resolve(
345
360
  "./runtime/server/default-system-prompts"
@@ -352,9 +367,12 @@ export default defineNuxtConfig({
352
367
  composable: "defineBlokkliAgentSystemPrompt",
353
368
  importPrefix: "systemPrompt",
354
369
  dependency: "agent-server",
355
- dirs: [moduleSystemPromptsDir, projectSystemPromptsDir]
370
+ dirs: [
371
+ moduleSystemPromptsDir,
372
+ projectSystemPromptsDir,
373
+ ...moduleBlokkliDirs.map((d) => path.join(d, "system-prompts"))
374
+ ]
356
375
  });
357
- await systemPromptCollector.init();
358
376
  ctx.context.addCollector(systemPromptCollector);
359
377
  ctx.context.addTemplate(
360
378
  createServerTemplate({
@@ -1,6 +1,6 @@
1
1
  import { type Ref } from '#imports';
2
2
  import { type Attachment, type ConversationItem, type ActiveItem, type MutationAction } from '#blokkli/agent/app/types';
3
- import type { ClientPlanState, UsageTurn } from '#blokkli/agent/shared/types';
3
+ import type { ClientPlanState, UsageTurn, Transcript } from '#blokkli/agent/shared/types';
4
4
  import type { AgentConversationSummary } from '#blokkli/agent/app/features/agent/types';
5
5
  import type { BlokkliApp } from '#blokkli/editor/types/app';
6
6
  import type { FullBlokkliAdapter } from '#blokkli/editor/adapter';
@@ -43,7 +43,7 @@ export type AgentProvider = {
43
43
  newConversation: () => void;
44
44
  getTranscript: () => void;
45
45
  onToolComponentDone: (result: unknown) => void;
46
- transcriptContent: Ref<string>;
46
+ transcriptContent: Ref<Transcript | null>;
47
47
  showTranscript: Ref<boolean>;
48
48
  conversationList: Ref<AgentConversationSummary[]>;
49
49
  showConversationList: Ref<boolean>;
@@ -38,7 +38,7 @@ export default function(app, adapter, agentName) {
38
38
  const pendingToolCall = ref(null);
39
39
  let pendingToolCallResolve = null;
40
40
  const plan = ref(null);
41
- const transcriptContent = ref("");
41
+ const transcriptContent = ref(null);
42
42
  const showTranscript = ref(false);
43
43
  const activeConversationId = ref(null);
44
44
  const conversationList = ref([]);
@@ -283,7 +283,7 @@ export default function(app, adapter, agentName) {
283
283
  send({ type: "init", tools, pageContext });
284
284
  isReady.value = true;
285
285
  hasBeenReady.value = true;
286
- if (adapter.agentConversations) {
286
+ if (adapter.agentConversations && !pendingPrompt) {
287
287
  try {
288
288
  const latest = await adapter.agentConversations.loadLatest();
289
289
  if (latest) {
@@ -492,7 +492,7 @@ export default function(app, adapter, agentName) {
492
492
  }
493
493
  break;
494
494
  case "transcript":
495
- transcriptContent.value = data.content;
495
+ transcriptContent.value = data.transcript;
496
496
  showTranscript.value = true;
497
497
  break;
498
498
  case "conversation_state":
@@ -1,38 +1,34 @@
1
1
  <template>
2
2
  <div class="bk-agent-input-actions">
3
3
  <div class="bk-agent-input-actions-left">
4
- <div ref="menuContainer">
5
- <button
6
- class="bk-button bk-is-white bk-is-small bk-is-icon-only"
7
- :title="$t('aiAgentMoreOptions', 'More options')"
8
- :disabled="!isConnected"
9
- @click="showMenu = !showMenu"
10
- >
11
- <Icon name="bk_mdi_more_horiz" />
12
- </button>
13
- <BlokkliTransition name="drop-up">
14
- <div v-if="showMenu" class="bk-agent-more-dropdown">
15
- <TokenUsage :usage-turns />
16
- <hr />
17
- <DropdownItem
18
- icon="bk_mdi_add"
19
- :text="$t('aiAgentNewConversation', 'Start new conversation')"
20
- @click="onNewConversation"
21
- />
22
- <DropdownItem
23
- icon="bk_mdi_history"
24
- :text="$t('aiAgentPastConversations', 'Past conversations')"
25
- @click="onShowConversations"
26
- />
27
- <hr />
28
- <DropdownItem
29
- icon="bk_mdi_bug_report"
30
- :text="$t('aiAgentShowTranscript', 'Show transcript...')"
31
- @click="onShowTranscript"
32
- />
4
+ <Dropdown ref="dropdown" :disabled="!isConnected">
5
+ <template #button>
6
+ <div
7
+ class="bk-button bk-is-white bk-is-small bk-is-icon-only"
8
+ :title="$t('aiAgentMoreOptions', 'More options')"
9
+ >
10
+ <Icon name="bk_mdi_more_horiz" />
33
11
  </div>
34
- </BlokkliTransition>
35
- </div>
12
+ </template>
13
+ <TokenUsage :usage-turns />
14
+ <hr />
15
+ <DropdownItem
16
+ icon="bk_mdi_add"
17
+ :text="$t('aiAgentNewConversation', 'Start new conversation')"
18
+ @click="onNewConversation"
19
+ />
20
+ <DropdownItem
21
+ icon="bk_mdi_history"
22
+ :text="$t('aiAgentPastConversations', 'Past conversations')"
23
+ @click="onShowConversations"
24
+ />
25
+ <hr />
26
+ <DropdownItem
27
+ icon="bk_mdi_bug_report"
28
+ :text="$t('aiAgentShowTranscript', 'Show transcript...')"
29
+ @click="onShowTranscript"
30
+ />
31
+ </Dropdown>
36
32
  </div>
37
33
  <div class="bk-agent-input-actions-right">
38
34
  <div v-show="hasText" class="bk-agent-input-actions-keyboard">
@@ -59,15 +55,8 @@
59
55
  </template>
60
56
 
61
57
  <script setup>
62
- import {
63
- ref,
64
- onMounted,
65
- onBeforeUnmount,
66
- useTemplateRef,
67
- useBlokkli
68
- } from "#imports";
69
- import { Icon, BlokkliTransition } from "#blokkli/editor/components";
70
- import DropdownItem from "./DropdownItem/index.vue";
58
+ import { useTemplateRef, useBlokkli } from "#imports";
59
+ import { Icon, Dropdown, DropdownItem } from "#blokkli/editor/components";
71
60
  import TokenUsage from "./TokenUsage/index.vue";
72
61
  defineProps({
73
62
  isProcessing: { type: Boolean, required: true },
@@ -77,33 +66,18 @@ defineProps({
77
66
  usageTurns: { type: Array, required: true }
78
67
  });
79
68
  const emit = defineEmits(["submit", "cancel", "new-conversation", "show-transcript", "show-conversations"]);
80
- const { $t, eventBus } = useBlokkli();
81
- const menuContainer = useTemplateRef("menuContainer");
82
- const showMenu = ref(false);
83
- function closeMenu() {
84
- showMenu.value = false;
85
- }
86
- function onDocumentClick(e) {
87
- if (!menuContainer.value?.contains(e.target)) {
88
- closeMenu();
89
- }
90
- }
91
- eventBus.on("mouse:up", closeMenu);
92
- onMounted(() => document.addEventListener("click", onDocumentClick));
93
- onBeforeUnmount(() => {
94
- document.removeEventListener("click", onDocumentClick);
95
- eventBus.off("mouse:up", closeMenu);
96
- });
69
+ const { $t } = useBlokkli();
70
+ const dropdown = useTemplateRef("dropdown");
97
71
  function onNewConversation() {
98
- showMenu.value = false;
72
+ dropdown.value?.close();
99
73
  emit("new-conversation");
100
74
  }
101
75
  function onShowConversations() {
102
- showMenu.value = false;
76
+ dropdown.value?.close();
103
77
  emit("show-conversations");
104
78
  }
105
79
  function onShowTranscript() {
106
- showMenu.value = false;
80
+ dropdown.value?.close();
107
81
  emit("show-transcript");
108
82
  }
109
83
  </script>
@@ -0,0 +1,8 @@
1
+ import type { Transcript } from '#blokkli/agent/shared/types';
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
4
+ declare const __VLS_export: import("vue").DefineComponent<{
5
+ transcript: Transcript;
6
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
7
+ transcript: Transcript;
8
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;