@ckeditor/ckeditor5-ai 0.0.0-internal-20241017.0

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 (361) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +26 -0
  3. package/README.md +38 -0
  4. package/build/ai.js +5 -0
  5. package/build/translations/af.js +1 -0
  6. package/build/translations/ar.js +1 -0
  7. package/build/translations/bg.js +1 -0
  8. package/build/translations/bn.js +1 -0
  9. package/build/translations/bs.js +1 -0
  10. package/build/translations/ca.js +1 -0
  11. package/build/translations/cs.js +1 -0
  12. package/build/translations/da.js +1 -0
  13. package/build/translations/de-ch.js +1 -0
  14. package/build/translations/de.js +1 -0
  15. package/build/translations/el.js +1 -0
  16. package/build/translations/en-au.js +1 -0
  17. package/build/translations/es-co.js +1 -0
  18. package/build/translations/es.js +1 -0
  19. package/build/translations/et.js +1 -0
  20. package/build/translations/fa.js +1 -0
  21. package/build/translations/fi.js +1 -0
  22. package/build/translations/fr.js +1 -0
  23. package/build/translations/gl.js +1 -0
  24. package/build/translations/he.js +1 -0
  25. package/build/translations/hi.js +1 -0
  26. package/build/translations/hr.js +1 -0
  27. package/build/translations/hu.js +1 -0
  28. package/build/translations/id.js +1 -0
  29. package/build/translations/it.js +1 -0
  30. package/build/translations/ja.js +1 -0
  31. package/build/translations/jv.js +1 -0
  32. package/build/translations/ko.js +1 -0
  33. package/build/translations/lt.js +1 -0
  34. package/build/translations/lv.js +1 -0
  35. package/build/translations/ms.js +1 -0
  36. package/build/translations/nl.js +1 -0
  37. package/build/translations/no.js +1 -0
  38. package/build/translations/pl.js +1 -0
  39. package/build/translations/pt-br.js +1 -0
  40. package/build/translations/pt.js +1 -0
  41. package/build/translations/ro.js +1 -0
  42. package/build/translations/ru.js +1 -0
  43. package/build/translations/sk.js +1 -0
  44. package/build/translations/sr-latn.js +1 -0
  45. package/build/translations/sr.js +1 -0
  46. package/build/translations/sv.js +1 -0
  47. package/build/translations/th.js +1 -0
  48. package/build/translations/ti.js +1 -0
  49. package/build/translations/tk.js +1 -0
  50. package/build/translations/tr.js +1 -0
  51. package/build/translations/tt.js +1 -0
  52. package/build/translations/ug.js +1 -0
  53. package/build/translations/uk.js +1 -0
  54. package/build/translations/ur.js +1 -0
  55. package/build/translations/uz.js +1 -0
  56. package/build/translations/vi.js +1 -0
  57. package/build/translations/zh-cn.js +1 -0
  58. package/build/translations/zh.js +1 -0
  59. package/ckeditor5-metadata.json +23 -0
  60. package/dist/adapters/aiadapter.d.ts +60 -0
  61. package/dist/adapters/aitextadapter.d.ts +150 -0
  62. package/dist/adapters/awstextadapter.d.ts +183 -0
  63. package/dist/adapters/openaitextadapter.d.ts +187 -0
  64. package/dist/aiassistant.d.ts +393 -0
  65. package/dist/aiassistantediting.d.ts +59 -0
  66. package/dist/aiassistantui.d.ts +62 -0
  67. package/dist/aiconfig.d.ts +73 -0
  68. package/dist/augmentation.d.ts +31 -0
  69. package/dist/index-content.css +6 -0
  70. package/dist/index-editor.css +297 -0
  71. package/dist/index.css +392 -0
  72. package/dist/index.d.ts +17 -0
  73. package/dist/index.js +24 -0
  74. package/dist/legacyerrors.d.ts +24 -0
  75. package/dist/translations/af.d.ts +8 -0
  76. package/dist/translations/af.js +23 -0
  77. package/dist/translations/af.umd.js +23 -0
  78. package/dist/translations/ar.d.ts +8 -0
  79. package/dist/translations/ar.js +23 -0
  80. package/dist/translations/ar.umd.js +23 -0
  81. package/dist/translations/bg.d.ts +8 -0
  82. package/dist/translations/bg.js +23 -0
  83. package/dist/translations/bg.umd.js +23 -0
  84. package/dist/translations/bn.d.ts +8 -0
  85. package/dist/translations/bn.js +23 -0
  86. package/dist/translations/bn.umd.js +23 -0
  87. package/dist/translations/bs.d.ts +8 -0
  88. package/dist/translations/bs.js +23 -0
  89. package/dist/translations/bs.umd.js +23 -0
  90. package/dist/translations/ca.d.ts +8 -0
  91. package/dist/translations/ca.js +23 -0
  92. package/dist/translations/ca.umd.js +23 -0
  93. package/dist/translations/cs.d.ts +8 -0
  94. package/dist/translations/cs.js +23 -0
  95. package/dist/translations/cs.umd.js +23 -0
  96. package/dist/translations/da.d.ts +8 -0
  97. package/dist/translations/da.js +23 -0
  98. package/dist/translations/da.umd.js +23 -0
  99. package/dist/translations/de-ch.d.ts +8 -0
  100. package/dist/translations/de-ch.js +23 -0
  101. package/dist/translations/de-ch.umd.js +23 -0
  102. package/dist/translations/de.d.ts +8 -0
  103. package/dist/translations/de.js +23 -0
  104. package/dist/translations/de.umd.js +23 -0
  105. package/dist/translations/el.d.ts +8 -0
  106. package/dist/translations/el.js +23 -0
  107. package/dist/translations/el.umd.js +23 -0
  108. package/dist/translations/en-au.d.ts +8 -0
  109. package/dist/translations/en-au.js +23 -0
  110. package/dist/translations/en-au.umd.js +23 -0
  111. package/dist/translations/en.d.ts +8 -0
  112. package/dist/translations/en.js +23 -0
  113. package/dist/translations/en.umd.js +23 -0
  114. package/dist/translations/es-co.d.ts +8 -0
  115. package/dist/translations/es-co.js +23 -0
  116. package/dist/translations/es-co.umd.js +23 -0
  117. package/dist/translations/es.d.ts +8 -0
  118. package/dist/translations/es.js +23 -0
  119. package/dist/translations/es.umd.js +23 -0
  120. package/dist/translations/et.d.ts +8 -0
  121. package/dist/translations/et.js +23 -0
  122. package/dist/translations/et.umd.js +23 -0
  123. package/dist/translations/fa.d.ts +8 -0
  124. package/dist/translations/fa.js +23 -0
  125. package/dist/translations/fa.umd.js +23 -0
  126. package/dist/translations/fi.d.ts +8 -0
  127. package/dist/translations/fi.js +23 -0
  128. package/dist/translations/fi.umd.js +23 -0
  129. package/dist/translations/fr.d.ts +8 -0
  130. package/dist/translations/fr.js +23 -0
  131. package/dist/translations/fr.umd.js +23 -0
  132. package/dist/translations/gl.d.ts +8 -0
  133. package/dist/translations/gl.js +23 -0
  134. package/dist/translations/gl.umd.js +23 -0
  135. package/dist/translations/he.d.ts +8 -0
  136. package/dist/translations/he.js +23 -0
  137. package/dist/translations/he.umd.js +23 -0
  138. package/dist/translations/hi.d.ts +8 -0
  139. package/dist/translations/hi.js +23 -0
  140. package/dist/translations/hi.umd.js +23 -0
  141. package/dist/translations/hr.d.ts +8 -0
  142. package/dist/translations/hr.js +23 -0
  143. package/dist/translations/hr.umd.js +23 -0
  144. package/dist/translations/hu.d.ts +8 -0
  145. package/dist/translations/hu.js +23 -0
  146. package/dist/translations/hu.umd.js +23 -0
  147. package/dist/translations/id.d.ts +8 -0
  148. package/dist/translations/id.js +23 -0
  149. package/dist/translations/id.umd.js +23 -0
  150. package/dist/translations/it.d.ts +8 -0
  151. package/dist/translations/it.js +23 -0
  152. package/dist/translations/it.umd.js +23 -0
  153. package/dist/translations/ja.d.ts +8 -0
  154. package/dist/translations/ja.js +23 -0
  155. package/dist/translations/ja.umd.js +23 -0
  156. package/dist/translations/jv.d.ts +8 -0
  157. package/dist/translations/jv.js +23 -0
  158. package/dist/translations/jv.umd.js +23 -0
  159. package/dist/translations/ko.d.ts +8 -0
  160. package/dist/translations/ko.js +23 -0
  161. package/dist/translations/ko.umd.js +23 -0
  162. package/dist/translations/lt.d.ts +8 -0
  163. package/dist/translations/lt.js +23 -0
  164. package/dist/translations/lt.umd.js +23 -0
  165. package/dist/translations/lv.d.ts +8 -0
  166. package/dist/translations/lv.js +23 -0
  167. package/dist/translations/lv.umd.js +23 -0
  168. package/dist/translations/ms.d.ts +8 -0
  169. package/dist/translations/ms.js +23 -0
  170. package/dist/translations/ms.umd.js +23 -0
  171. package/dist/translations/nl.d.ts +8 -0
  172. package/dist/translations/nl.js +23 -0
  173. package/dist/translations/nl.umd.js +23 -0
  174. package/dist/translations/no.d.ts +8 -0
  175. package/dist/translations/no.js +23 -0
  176. package/dist/translations/no.umd.js +23 -0
  177. package/dist/translations/pl.d.ts +8 -0
  178. package/dist/translations/pl.js +23 -0
  179. package/dist/translations/pl.umd.js +23 -0
  180. package/dist/translations/pt-br.d.ts +8 -0
  181. package/dist/translations/pt-br.js +23 -0
  182. package/dist/translations/pt-br.umd.js +23 -0
  183. package/dist/translations/pt.d.ts +8 -0
  184. package/dist/translations/pt.js +23 -0
  185. package/dist/translations/pt.umd.js +23 -0
  186. package/dist/translations/ro.d.ts +8 -0
  187. package/dist/translations/ro.js +23 -0
  188. package/dist/translations/ro.umd.js +23 -0
  189. package/dist/translations/ru.d.ts +8 -0
  190. package/dist/translations/ru.js +23 -0
  191. package/dist/translations/ru.umd.js +23 -0
  192. package/dist/translations/sk.d.ts +8 -0
  193. package/dist/translations/sk.js +23 -0
  194. package/dist/translations/sk.umd.js +23 -0
  195. package/dist/translations/sr-latn.d.ts +8 -0
  196. package/dist/translations/sr-latn.js +23 -0
  197. package/dist/translations/sr-latn.umd.js +23 -0
  198. package/dist/translations/sr.d.ts +8 -0
  199. package/dist/translations/sr.js +23 -0
  200. package/dist/translations/sr.umd.js +23 -0
  201. package/dist/translations/sv.d.ts +8 -0
  202. package/dist/translations/sv.js +23 -0
  203. package/dist/translations/sv.umd.js +23 -0
  204. package/dist/translations/th.d.ts +8 -0
  205. package/dist/translations/th.js +23 -0
  206. package/dist/translations/th.umd.js +23 -0
  207. package/dist/translations/ti.d.ts +8 -0
  208. package/dist/translations/ti.js +23 -0
  209. package/dist/translations/ti.umd.js +23 -0
  210. package/dist/translations/tk.d.ts +8 -0
  211. package/dist/translations/tk.js +23 -0
  212. package/dist/translations/tk.umd.js +23 -0
  213. package/dist/translations/tr.d.ts +8 -0
  214. package/dist/translations/tr.js +23 -0
  215. package/dist/translations/tr.umd.js +23 -0
  216. package/dist/translations/tt.d.ts +8 -0
  217. package/dist/translations/tt.js +23 -0
  218. package/dist/translations/tt.umd.js +23 -0
  219. package/dist/translations/ug.d.ts +8 -0
  220. package/dist/translations/ug.js +23 -0
  221. package/dist/translations/ug.umd.js +23 -0
  222. package/dist/translations/uk.d.ts +8 -0
  223. package/dist/translations/uk.js +23 -0
  224. package/dist/translations/uk.umd.js +23 -0
  225. package/dist/translations/ur.d.ts +8 -0
  226. package/dist/translations/ur.js +23 -0
  227. package/dist/translations/ur.umd.js +23 -0
  228. package/dist/translations/uz.d.ts +8 -0
  229. package/dist/translations/uz.js +23 -0
  230. package/dist/translations/uz.umd.js +23 -0
  231. package/dist/translations/vi.d.ts +8 -0
  232. package/dist/translations/vi.js +23 -0
  233. package/dist/translations/vi.umd.js +23 -0
  234. package/dist/translations/zh-cn.d.ts +8 -0
  235. package/dist/translations/zh-cn.js +23 -0
  236. package/dist/translations/zh-cn.umd.js +23 -0
  237. package/dist/translations/zh.d.ts +8 -0
  238. package/dist/translations/zh.js +23 -0
  239. package/dist/translations/zh.umd.js +23 -0
  240. package/dist/ui/aiassistantcontroller.d.ts +113 -0
  241. package/dist/ui/form/aiformcontentarea.d.ts +52 -0
  242. package/dist/ui/form/aiformerrorview.d.ts +30 -0
  243. package/dist/ui/form/aiformpromptview.d.ts +50 -0
  244. package/dist/ui/form/aiformtoolbarview.d.ts +62 -0
  245. package/dist/ui/form/aiformview.d.ts +145 -0
  246. package/dist/ui/form/aihistorylistitemview.d.ts +22 -0
  247. package/dist/ui/form/aihistorylistview.d.ts +39 -0
  248. package/dist/ui/form/prompthistory.d.ts +24 -0
  249. package/dist/ui/showaiassistantcommand.d.ts +44 -0
  250. package/dist/utils/common-translations.d.ts +13 -0
  251. package/dist/utils/normalizecommandsconfig.d.ts +18 -0
  252. package/lang/contexts.json +56 -0
  253. package/lang/translations/af.po +230 -0
  254. package/lang/translations/ar.po +230 -0
  255. package/lang/translations/bg.po +230 -0
  256. package/lang/translations/bn.po +230 -0
  257. package/lang/translations/bs.po +230 -0
  258. package/lang/translations/ca.po +230 -0
  259. package/lang/translations/cs.po +230 -0
  260. package/lang/translations/da.po +230 -0
  261. package/lang/translations/de-ch.po +230 -0
  262. package/lang/translations/de.po +230 -0
  263. package/lang/translations/el.po +230 -0
  264. package/lang/translations/en-au.po +230 -0
  265. package/lang/translations/en.po +230 -0
  266. package/lang/translations/es-co.po +230 -0
  267. package/lang/translations/es.po +230 -0
  268. package/lang/translations/et.po +230 -0
  269. package/lang/translations/fa.po +230 -0
  270. package/lang/translations/fi.po +230 -0
  271. package/lang/translations/fr.po +230 -0
  272. package/lang/translations/gl.po +230 -0
  273. package/lang/translations/he.po +230 -0
  274. package/lang/translations/hi.po +230 -0
  275. package/lang/translations/hr.po +230 -0
  276. package/lang/translations/hu.po +230 -0
  277. package/lang/translations/id.po +230 -0
  278. package/lang/translations/it.po +230 -0
  279. package/lang/translations/ja.po +230 -0
  280. package/lang/translations/jv.po +230 -0
  281. package/lang/translations/ko.po +230 -0
  282. package/lang/translations/lt.po +230 -0
  283. package/lang/translations/lv.po +230 -0
  284. package/lang/translations/ms.po +230 -0
  285. package/lang/translations/nl.po +230 -0
  286. package/lang/translations/no.po +230 -0
  287. package/lang/translations/pl.po +230 -0
  288. package/lang/translations/pt-br.po +230 -0
  289. package/lang/translations/pt.po +230 -0
  290. package/lang/translations/ro.po +230 -0
  291. package/lang/translations/ru.po +230 -0
  292. package/lang/translations/sk.po +230 -0
  293. package/lang/translations/sr-latn.po +230 -0
  294. package/lang/translations/sr.po +230 -0
  295. package/lang/translations/sv.po +230 -0
  296. package/lang/translations/th.po +230 -0
  297. package/lang/translations/ti.po +230 -0
  298. package/lang/translations/tk.po +230 -0
  299. package/lang/translations/tr.po +230 -0
  300. package/lang/translations/tt.po +230 -0
  301. package/lang/translations/ug.po +230 -0
  302. package/lang/translations/uk.po +230 -0
  303. package/lang/translations/ur.po +230 -0
  304. package/lang/translations/uz.po +230 -0
  305. package/lang/translations/vi.po +230 -0
  306. package/lang/translations/zh-cn.po +230 -0
  307. package/lang/translations/zh.po +230 -0
  308. package/package.json +53 -0
  309. package/src/adapters/aiadapter.d.ts +56 -0
  310. package/src/adapters/aiadapter.js +23 -0
  311. package/src/adapters/aitextadapter.d.ts +146 -0
  312. package/src/adapters/aitextadapter.js +23 -0
  313. package/src/adapters/awstextadapter.d.ts +179 -0
  314. package/src/adapters/awstextadapter.js +23 -0
  315. package/src/adapters/openaitextadapter.d.ts +183 -0
  316. package/src/adapters/openaitextadapter.js +23 -0
  317. package/src/aiassistant.d.ts +389 -0
  318. package/src/aiassistant.js +23 -0
  319. package/src/aiassistantediting.d.ts +55 -0
  320. package/src/aiassistantediting.js +23 -0
  321. package/src/aiassistantui.d.ts +58 -0
  322. package/src/aiassistantui.js +23 -0
  323. package/src/aiconfig.d.ts +69 -0
  324. package/src/aiconfig.js +23 -0
  325. package/src/augmentation.d.ts +27 -0
  326. package/src/augmentation.js +23 -0
  327. package/src/index.d.ts +13 -0
  328. package/src/index.js +23 -0
  329. package/src/legacyerrors.d.ts +20 -0
  330. package/src/legacyerrors.js +23 -0
  331. package/src/ui/aiassistantcontroller.d.ts +109 -0
  332. package/src/ui/aiassistantcontroller.js +24 -0
  333. package/src/ui/form/aiformcontentarea.d.ts +48 -0
  334. package/src/ui/form/aiformcontentarea.js +23 -0
  335. package/src/ui/form/aiformerrorview.d.ts +26 -0
  336. package/src/ui/form/aiformerrorview.js +23 -0
  337. package/src/ui/form/aiformpromptview.d.ts +46 -0
  338. package/src/ui/form/aiformpromptview.js +23 -0
  339. package/src/ui/form/aiformtoolbarview.d.ts +58 -0
  340. package/src/ui/form/aiformtoolbarview.js +23 -0
  341. package/src/ui/form/aiformview.d.ts +141 -0
  342. package/src/ui/form/aiformview.js +23 -0
  343. package/src/ui/form/aihistorylistitemview.d.ts +18 -0
  344. package/src/ui/form/aihistorylistitemview.js +23 -0
  345. package/src/ui/form/aihistorylistview.d.ts +35 -0
  346. package/src/ui/form/aihistorylistview.js +23 -0
  347. package/src/ui/form/prompthistory.d.ts +20 -0
  348. package/src/ui/form/prompthistory.js +23 -0
  349. package/src/ui/showaiassistantcommand.d.ts +40 -0
  350. package/src/ui/showaiassistantcommand.js +23 -0
  351. package/src/utils/common-translations.d.ts +9 -0
  352. package/src/utils/common-translations.js +23 -0
  353. package/src/utils/normalizecommandsconfig.d.ts +14 -0
  354. package/src/utils/normalizecommandsconfig.js +23 -0
  355. package/theme/ai-dropdown.css +37 -0
  356. package/theme/ai-form.css +262 -0
  357. package/theme/ai.css +120 -0
  358. package/theme/icons/copy.svg +1 -0
  359. package/theme/icons/error.svg +1 -0
  360. package/theme/icons/magic-wand.svg +1 -0
  361. package/theme/icons/submit.svg +1 -0
@@ -0,0 +1,145 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module ai/ui/aiformview
11
+ */
12
+ import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
13
+ import { View, type ViewWithFocusCycler } from 'ckeditor5/src/ui.js';
14
+ import AIFormToolbarView, { AIFormToolbarViewMainActionLabel } from './aiformtoolbarview.js';
15
+ import AIFormContentArea from './aiformcontentarea.js';
16
+ import AIFormErrorView from './aiformerrorview.js';
17
+ import AIFormPromptView from './aiformpromptview.js';
18
+ /**
19
+ * A class representing the form view of the AI assistant.
20
+ */
21
+ export default class AIFormView extends View implements ViewWithFocusCycler {
22
+ /**
23
+ * Tracks information about the DOM focus in the form.
24
+ *
25
+ * @readonly
26
+ */
27
+ focusTracker: FocusTracker;
28
+ /**
29
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
30
+ *
31
+ * @readonly
32
+ */
33
+ keystrokes: KeystrokeHandler;
34
+ /**
35
+ * The text area view that is used to display AI response.
36
+ */
37
+ contentArea: AIFormContentArea;
38
+ /**
39
+ * Toolbar view containing button views that manage the AI response and this form itself.
40
+ */
41
+ toolbar: AIFormToolbarView;
42
+ /**
43
+ * The component used for handling the user's query, including history and submit buttons.
44
+ */
45
+ promptView: AIFormPromptView;
46
+ /**
47
+ * View that is used to display the error message.
48
+ */
49
+ errorView: AIFormErrorView;
50
+ /**
51
+ * The prompt text can be configured either during construction when the AI command has been selected,
52
+ * or later by submitting the {@link #labeledInput}, if it hasn't been previously initialized.
53
+ * After setting this value the AI request is triggered.
54
+ */
55
+ prompt: string;
56
+ /**
57
+ * The value that is generated after user submitting the user prompt.
58
+ */
59
+ value: string;
60
+ /**
61
+ * Flag that indicates if the AI assistant form view is enabled or disabled.
62
+ *
63
+ * If it is disabled, all interactive elements of this view are disabled as well.
64
+ */
65
+ isEnabled: boolean;
66
+ /**
67
+ * Indicates if the AI request is processing.
68
+ */
69
+ isProcessing: boolean;
70
+ /**
71
+ * Indicates if the AI request failed.
72
+ */
73
+ isError: boolean;
74
+ /**
75
+ * The action name for the main insertion button in the {@link #toolbar}.
76
+ *
77
+ * See {@link module:ai/ui/aiformtoolbarview~AIFormToolbarView#replaceButton}.
78
+ *
79
+ * @default 'replace'
80
+ */
81
+ mainAction: typeof AIFormToolbarViewMainActionLabel[keyof typeof AIFormToolbarViewMainActionLabel];
82
+ /**
83
+ * Creates an instance of the {@link module:ai/ui/aiformview~AIFormView} class.
84
+ *
85
+ * @param locale The localization services instance.
86
+ */
87
+ constructor(locale: Locale, uiClasses: string, contentAreaCssClass?: string);
88
+ /**
89
+ * @inheritDoc
90
+ */
91
+ render(): void;
92
+ /**
93
+ * @inheritDoc
94
+ */
95
+ focus(direction?: 1 | -1): void;
96
+ /**
97
+ * Resets the form to the initial values.
98
+ */
99
+ reset(): void;
100
+ }
101
+ /**
102
+ * Fired when a user performed an action that should lead to replace the current selection by generated content.
103
+ *
104
+ * @eventName ~AIFormView#replaceContent
105
+ */
106
+ export type ReplaceContentEvent = {
107
+ name: 'replaceContent';
108
+ args: [];
109
+ };
110
+ /**
111
+ * Fired when a user performed an action that should lead to insert generated content below the current selection.
112
+ *
113
+ * @eventName ~AIFormView#insertContentBelow
114
+ */
115
+ export type InsertContentBelowEvent = {
116
+ name: 'insertContentBelow';
117
+ args: [];
118
+ };
119
+ /**
120
+ * Fired when a user performed an action that should lead to retry the previous request to AI.
121
+ *
122
+ * @eventName ~AIFormView#tryAgainEvent
123
+ */
124
+ export type TryAgainEvent = {
125
+ name: 'tryAgainEvent';
126
+ args: [];
127
+ };
128
+ /**
129
+ * Fired when a user performed an action that should lead to stop the processing of AI.
130
+ *
131
+ * @eventName ~AIFormView#stopProcessing
132
+ */
133
+ export type StopProcessingEvent = {
134
+ name: 'stopProcessing';
135
+ args: [];
136
+ };
137
+ /**
138
+ * Fired when a user performed an action that should lead to ask AI.
139
+ *
140
+ * @eventName ~AIFormView#submitPrompt
141
+ */
142
+ export type SubmitPromptEvent = {
143
+ name: 'submitPrompt';
144
+ args: [prompt: string];
145
+ };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module ai/ui/aihistorylistitemview
11
+ */
12
+ import { ListItemView } from 'ckeditor5/src/ui.js';
13
+ import type { PromptHistoryEntry } from './prompthistory.js';
14
+ /**
15
+ * A list item view that displays a historical prompt
16
+ */
17
+ export default class AIHistoryListItemView extends ListItemView {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ constructor(promptHistoryEntry: PromptHistoryEntry);
22
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module ai/ui/aihistorylistview
11
+ */
12
+ import { ListView, ListItemGroupView, ButtonView, type FilteredView } from 'ckeditor5/src/ui.js';
13
+ import type { Locale } from 'ckeditor5/src/utils.js';
14
+ /**
15
+ * A list view that displays a list of AI prompts with filter pass-through.
16
+ *
17
+ * @private
18
+ */
19
+ export default class AIHistoryListView extends ListView implements FilteredView {
20
+ historyGroupView: ListItemGroupView;
21
+ clearHistoryButton: ButtonView;
22
+ constructor(locale: Locale);
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ filter(): {
27
+ resultsCount: number;
28
+ totalItemsCount: number;
29
+ };
30
+ }
31
+ /**
32
+ * Fired when the clear history button was executed by the user.
33
+ *
34
+ * @eventName ~AIHistoryListView#clearHistory
35
+ */
36
+ export type AIHistoryListViewClearHistoryEvent = {
37
+ name: 'clearHistory';
38
+ args: [];
39
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ import { Collection } from 'ckeditor5/src/utils.js';
10
+ /**
11
+ * A collection that stores the prompt history in the session storage as a side effect.
12
+ */
13
+ export default class PromptHistory extends Collection<PromptHistoryEntry> {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ constructor();
18
+ }
19
+ /**
20
+ * An object that represents a historical prompt.
21
+ */
22
+ export type PromptHistoryEntry = {
23
+ prompt: string;
24
+ };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module ai/ui/showaiassistantcommand
11
+ * @publicApi
12
+ */
13
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
14
+ import type { CommandDefinition } from '../aiassistant.js';
15
+ /**
16
+ * Command that shows the AI Assistant user interface.
17
+ */
18
+ export default class ShowAIAssistantCommand extends Command {
19
+ /**
20
+ * An array with ids of the AI commands enabled for the current selection.
21
+ *
22
+ * @observable
23
+ */
24
+ enabledCommandsIds: Array<string>;
25
+ /**
26
+ * Creates an instance of the command.
27
+ */
28
+ constructor(editor: Editor, commandDefinitions: Array<CommandDefinition>);
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ refresh(): void;
33
+ /**
34
+ * Opens AI Assistant user interface for the current document selection.
35
+ *
36
+ * @param query The initial query. If set, the AI assistant will automatically submit given query to the AI service.
37
+ * @param label Label to be displayed in the AI assistant query input field while the AI assistant processes the initial query.
38
+ * @param actionId The id of the executed action. It can be used in extended and custom adapters to customize the request. It
39
+ * will be prefixed with `aiAssistant:`. See also
40
+ * {@link module:ai/adapters/aitextadapter~AITextAdapterRequestData#actionId `AITextAdapterRequestData#actionId`}.
41
+ * @fires execute
42
+ */
43
+ execute(query?: string, label?: string, actionId?: string): void;
44
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module ai/utils/common-translations
11
+ */
12
+ import type { Locale } from 'ckeditor5/src/utils.js';
13
+ export declare function getTranslation(locale: Locale, id: string, values?: string | Array<string> | number): string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module ai/utils/normalizecommandsconfig
11
+ */
12
+ import type { Locale } from 'ckeditor5/src/utils.js';
13
+ import type { GroupDefinition, CommandDefinition } from '../aiassistant.js';
14
+ export declare const UNGROUPED_COMMANDS_GROUP_ID = "_ungrouppedCommands";
15
+ /**
16
+ * Normalizes the `config.ai.aiAssistant.commands` configuration taking into account different possible config formats (or lack thereof).
17
+ */
18
+ export declare function normalizeCommandsConfig(config: Array<GroupDefinition | CommandDefinition>, locale: Locale): Array<GroupDefinition>;
@@ -0,0 +1,56 @@
1
+ {
2
+ "Edit or review": "AI command group label for editing and reviewing.",
3
+ "Improve writing": "Label for the AI command to improve the writing of content.",
4
+ "Make shorter": "Label for the AI command to make the content shorter.",
5
+ "Make longer": "Label for the AI command to make the content longer.",
6
+ "Simplify language": "Label for the AI command to simplify the language of content.",
7
+ "Generate from selection": "AI command group label for generating content from selection.",
8
+ "Summarize": "Label for the AI command to provide a summary of content.",
9
+ "Continue": "Label for the AI command to continue the content.",
10
+ "Change tone": "AI command group label for changing the tone of content.",
11
+ "Professional": "Label for the AI command to rewrite content in a professional tone.",
12
+ "Casual": "Label for the AI command to rewrite content in a casual tone.",
13
+ "Direct": "Label for the AI command to rewrite content in a direct manner.",
14
+ "Confident": "Label for the AI command to rewrite content in a confident tone.",
15
+ "Friendly": "Label for the AI command to rewrite content in a friendly tone.",
16
+ "Change style": "AI command group label for changing the style of content.",
17
+ "Business": "Label for the AI command to rewrite content in a business style.",
18
+ "Legal": "Label for the AI command to rewrite content in a legal style.",
19
+ "Journalism": "Label for the AI command to rewrite content in a journalistic style.",
20
+ "Poetic": "Label for the AI command to rewrite content poetically.",
21
+ "Translate": "AI command group label for translating the content.",
22
+ "English": "Translate to (English)",
23
+ "Spanish": "Translate to (Spanish)",
24
+ "German": "Translate to (German)",
25
+ "Portuguese": "Translate to (Portuguese)",
26
+ "French": "Translate to (French)",
27
+ "Simplified Chinese": "Translate to (Simplified Chinese)",
28
+ "Hindi": "Translate to (Hindi)",
29
+ "Arabic": "Translate to (Arabic)",
30
+ "AI Assistant": "The heading element name displayed in the AI dialog and the button tooltip that opens the dialog.",
31
+ "AI Commands": "The toolbar button tooltip for the dropdown with predefined AI commands.",
32
+ "Ask AI to edit or generate": "The placeholder for the prompt input to obtain new content.",
33
+ "Ask AI to improve generated text": "The placeholder for the prompt input to improve the generated content.",
34
+ "Copy": "The label for the button that copies the text from the textarea.",
35
+ "Submit": "The label for the button that submits the entered AI prompt.",
36
+ "Insert below": "The label for the button that inserts the generated AI response below the current selection.",
37
+ "Try again": "The label for the button that repeats the request to AI.",
38
+ "Stop": "The label for the button that stops the generating of the content by AI.",
39
+ "AI is writing...": "The label that indicates the AI is generating content.",
40
+ "AI is writing": "Aria status message indicating that the AI is generating content. Example: 'AI busy writing'.",
41
+ "Generated content: %0": "Aria status message indicating the AI generated content. Example: 'Generated content: [text generated by the AI model]'.",
42
+ "Error during AI content generation: %0": "Aria status message indicating that an error has occurred during the generation of AI content. Example: 'Error during AI content generation: [text of an error]'.",
43
+ "History": "The label of the button that toggles the prompt history pane in the AI dialog.",
44
+ "Empty history": "The primary information text displayed when the prompt history is empty.",
45
+ "Ask AI and your prompts will be listed here for you to use later.": "The secondary information text displayed when the prompt history is empty.",
46
+ "Prompt history": "The label of the list group that hosts historical user prompts in the AI dialog.",
47
+ "Other": "The default label of the \"ungrouped\" commands group in the AI Commands list.",
48
+ "AI_REPLACE_CONTENT": "The label for the button that replaces the selected content by the generated AI response.",
49
+ "AI_INSERT_CONTENT": "The label for the button that inserts the generated AI response.",
50
+ "AI_ERROR_GET_HEADERS": "Error message displayed when preparing request headers fails.",
51
+ "AI_ERROR_GET_PARAMETERS": "Error message displayed when preparing request parameters fails.",
52
+ "AI_ERROR_UNSUPPORTED_MODEL": "Error message displayed when the requested AI model is not supported.",
53
+ "AI_ERROR_CONTEXT_LENGTH": "Error message displayed when the content selected for AI processing is too long",
54
+ "AI_ERROR_MODERATION": "Error message displayed when a request is abusive, harmful or hateful and was rejected due to moderation rules.",
55
+ "AI_ERROR_FAILED": "Generic error message displayed when the request failed for unspecified reason."
56
+ }
@@ -0,0 +1,230 @@
1
+ # Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ #
3
+ # !!! IMPORTANT !!!
4
+ #
5
+ # Before you edit this file, please keep in mind that contributing to the project
6
+ # translations is possible ONLY via the Transifex online service.
7
+ #
8
+ # To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
9
+ #
10
+ # To learn more, check out the official contributor's guide:
11
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
12
+ #
13
+ msgid ""
14
+ msgstr ""
15
+ "Language-Team: Afrikaans (https://app.transifex.com/ckeditor/teams/11143/af/)\n"
16
+ "Language: af\n"
17
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
+ "Content-Type: text/plain; charset=UTF-8\n"
19
+
20
+ msgctxt "AI command group label for editing and reviewing."
21
+ msgid "Edit or review"
22
+ msgstr ""
23
+
24
+ msgctxt "Label for the AI command to improve the writing of content."
25
+ msgid "Improve writing"
26
+ msgstr ""
27
+
28
+ msgctxt "Label for the AI command to make the content shorter."
29
+ msgid "Make shorter"
30
+ msgstr ""
31
+
32
+ msgctxt "Label for the AI command to make the content longer."
33
+ msgid "Make longer"
34
+ msgstr ""
35
+
36
+ msgctxt "Label for the AI command to simplify the language of content."
37
+ msgid "Simplify language"
38
+ msgstr ""
39
+
40
+ msgctxt "AI command group label for generating content from selection."
41
+ msgid "Generate from selection"
42
+ msgstr ""
43
+
44
+ msgctxt "Label for the AI command to provide a summary of content."
45
+ msgid "Summarize"
46
+ msgstr ""
47
+
48
+ msgctxt "Label for the AI command to continue the content."
49
+ msgid "Continue"
50
+ msgstr ""
51
+
52
+ msgctxt "AI command group label for changing the tone of content."
53
+ msgid "Change tone"
54
+ msgstr ""
55
+
56
+ msgctxt "Label for the AI command to rewrite content in a professional tone."
57
+ msgid "Professional"
58
+ msgstr ""
59
+
60
+ msgctxt "Label for the AI command to rewrite content in a casual tone."
61
+ msgid "Casual"
62
+ msgstr ""
63
+
64
+ msgctxt "Label for the AI command to rewrite content in a direct manner."
65
+ msgid "Direct"
66
+ msgstr ""
67
+
68
+ msgctxt "Label for the AI command to rewrite content in a confident tone."
69
+ msgid "Confident"
70
+ msgstr ""
71
+
72
+ msgctxt "Label for the AI command to rewrite content in a friendly tone."
73
+ msgid "Friendly"
74
+ msgstr ""
75
+
76
+ msgctxt "AI command group label for changing the style of content."
77
+ msgid "Change style"
78
+ msgstr ""
79
+
80
+ msgctxt "Label for the AI command to rewrite content in a business style."
81
+ msgid "Business"
82
+ msgstr ""
83
+
84
+ msgctxt "Label for the AI command to rewrite content in a legal style."
85
+ msgid "Legal"
86
+ msgstr ""
87
+
88
+ msgctxt "Label for the AI command to rewrite content in a journalistic style."
89
+ msgid "Journalism"
90
+ msgstr ""
91
+
92
+ msgctxt "Label for the AI command to rewrite content poetically."
93
+ msgid "Poetic"
94
+ msgstr ""
95
+
96
+ msgctxt "AI command group label for translating the content."
97
+ msgid "Translate"
98
+ msgstr ""
99
+
100
+ msgctxt "Translate to (English)"
101
+ msgid "English"
102
+ msgstr ""
103
+
104
+ msgctxt "Translate to (Spanish)"
105
+ msgid "Spanish"
106
+ msgstr ""
107
+
108
+ msgctxt "Translate to (German)"
109
+ msgid "German"
110
+ msgstr ""
111
+
112
+ msgctxt "Translate to (Portuguese)"
113
+ msgid "Portuguese"
114
+ msgstr ""
115
+
116
+ msgctxt "Translate to (French)"
117
+ msgid "French"
118
+ msgstr ""
119
+
120
+ msgctxt "Translate to (Simplified Chinese)"
121
+ msgid "Simplified Chinese"
122
+ msgstr ""
123
+
124
+ msgctxt "Translate to (Hindi)"
125
+ msgid "Hindi"
126
+ msgstr ""
127
+
128
+ msgctxt "Translate to (Arabic)"
129
+ msgid "Arabic"
130
+ msgstr ""
131
+
132
+ msgctxt "The heading element name displayed in the AI dialog and the button tooltip that opens the dialog."
133
+ msgid "AI Assistant"
134
+ msgstr ""
135
+
136
+ msgctxt "The toolbar button tooltip for the dropdown with predefined AI commands."
137
+ msgid "AI Commands"
138
+ msgstr ""
139
+
140
+ msgctxt "The placeholder for the prompt input to obtain new content."
141
+ msgid "Ask AI to edit or generate"
142
+ msgstr ""
143
+
144
+ msgctxt "The placeholder for the prompt input to improve the generated content."
145
+ msgid "Ask AI to improve generated text"
146
+ msgstr ""
147
+
148
+ msgctxt "The label for the button that copies the text from the textarea."
149
+ msgid "Copy"
150
+ msgstr ""
151
+
152
+ msgctxt "The label for the button that submits the entered AI prompt."
153
+ msgid "Submit"
154
+ msgstr "Indien"
155
+
156
+ msgctxt "The label for the button that inserts the generated AI response below the current selection."
157
+ msgid "Insert below"
158
+ msgstr ""
159
+
160
+ msgctxt "The label for the button that repeats the request to AI."
161
+ msgid "Try again"
162
+ msgstr ""
163
+
164
+ msgctxt "The label for the button that stops the generating of the content by AI."
165
+ msgid "Stop"
166
+ msgstr ""
167
+
168
+ msgctxt "The label that indicates the AI is generating content."
169
+ msgid "AI is writing..."
170
+ msgstr ""
171
+
172
+ msgctxt "Aria status message indicating that the AI is generating content. Example: 'AI busy writing'."
173
+ msgid "AI is writing"
174
+ msgstr ""
175
+
176
+ msgctxt "Aria status message indicating the AI generated content. Example: 'Generated content: [text generated by the AI model]'."
177
+ msgid "Generated content: %0"
178
+ msgstr ""
179
+
180
+ msgctxt "Aria status message indicating that an error has occurred during the generation of AI content. Example: 'Error during AI content generation: [text of an error]'."
181
+ msgid "Error during AI content generation: %0"
182
+ msgstr ""
183
+
184
+ msgctxt "The label of the button that toggles the prompt history pane in the AI dialog."
185
+ msgid "History"
186
+ msgstr ""
187
+
188
+ msgctxt "The primary information text displayed when the prompt history is empty."
189
+ msgid "Empty history"
190
+ msgstr ""
191
+
192
+ msgctxt "The secondary information text displayed when the prompt history is empty."
193
+ msgid "Ask AI and your prompts will be listed here for you to use later."
194
+ msgstr ""
195
+
196
+ msgctxt "The label of the list group that hosts historical user prompts in the AI dialog."
197
+ msgid "Prompt history"
198
+ msgstr ""
199
+
200
+ msgctxt "The label for the button that replaces the selected content by the generated AI response."
201
+ msgid "AI_REPLACE_CONTENT"
202
+ msgstr "Vervang"
203
+
204
+ msgctxt "The label for the button that inserts the generated AI response."
205
+ msgid "AI_INSERT_CONTENT"
206
+ msgstr ""
207
+
208
+ msgctxt "Error message displayed when preparing request headers fails."
209
+ msgid "AI_ERROR_GET_HEADERS"
210
+ msgstr ""
211
+
212
+ msgctxt "Error message displayed when preparing request parameters fails."
213
+ msgid "AI_ERROR_GET_PARAMETERS"
214
+ msgstr ""
215
+
216
+ msgctxt "Error message displayed when the requested AI model is not supported."
217
+ msgid "AI_ERROR_UNSUPPORTED_MODEL"
218
+ msgstr ""
219
+
220
+ msgctxt "Error message displayed when the content selected for AI processing is too long"
221
+ msgid "AI_ERROR_CONTEXT_LENGTH"
222
+ msgstr ""
223
+
224
+ msgctxt "Error message displayed when a request is abusive, harmful or hateful and was rejected due to moderation rules."
225
+ msgid "AI_ERROR_MODERATION"
226
+ msgstr ""
227
+
228
+ msgctxt "Generic error message displayed when the request failed for unspecified reason."
229
+ msgid "AI_ERROR_FAILED"
230
+ msgstr ""