@ckeditor/ckeditor5-ai 0.0.1 → 40.1.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 (160) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +7 -7
  3. package/README.md +32 -3
  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/tk.js +1 -0
  49. package/build/translations/tr.js +1 -0
  50. package/build/translations/ug.js +1 -0
  51. package/build/translations/uk.js +1 -0
  52. package/build/translations/ur.js +1 -0
  53. package/build/translations/uz.js +1 -0
  54. package/build/translations/vi.js +1 -0
  55. package/build/translations/zh-cn.js +1 -0
  56. package/build/translations/zh.js +1 -0
  57. package/ckeditor5-metadata.json +23 -0
  58. package/lang/contexts.json +54 -0
  59. package/lang/translations/af.po +226 -0
  60. package/lang/translations/ar.po +226 -0
  61. package/lang/translations/bg.po +226 -0
  62. package/lang/translations/bn.po +226 -0
  63. package/lang/translations/bs.po +226 -0
  64. package/lang/translations/ca.po +226 -0
  65. package/lang/translations/cs.po +226 -0
  66. package/lang/translations/da.po +226 -0
  67. package/lang/translations/de-ch.po +226 -0
  68. package/lang/translations/de.po +226 -0
  69. package/lang/translations/el.po +226 -0
  70. package/lang/translations/en-au.po +226 -0
  71. package/lang/translations/en.po +226 -0
  72. package/lang/translations/es-co.po +226 -0
  73. package/lang/translations/es.po +226 -0
  74. package/lang/translations/et.po +226 -0
  75. package/lang/translations/fa.po +226 -0
  76. package/lang/translations/fi.po +226 -0
  77. package/lang/translations/fr.po +226 -0
  78. package/lang/translations/gl.po +226 -0
  79. package/lang/translations/he.po +226 -0
  80. package/lang/translations/hi.po +226 -0
  81. package/lang/translations/hr.po +226 -0
  82. package/lang/translations/hu.po +226 -0
  83. package/lang/translations/id.po +226 -0
  84. package/lang/translations/it.po +226 -0
  85. package/lang/translations/ja.po +226 -0
  86. package/lang/translations/jv.po +226 -0
  87. package/lang/translations/ko.po +226 -0
  88. package/lang/translations/lt.po +226 -0
  89. package/lang/translations/lv.po +226 -0
  90. package/lang/translations/ms.po +226 -0
  91. package/lang/translations/nl.po +226 -0
  92. package/lang/translations/no.po +226 -0
  93. package/lang/translations/pl.po +226 -0
  94. package/lang/translations/pt-br.po +226 -0
  95. package/lang/translations/pt.po +226 -0
  96. package/lang/translations/ro.po +226 -0
  97. package/lang/translations/ru.po +226 -0
  98. package/lang/translations/sk.po +226 -0
  99. package/lang/translations/sr-latn.po +226 -0
  100. package/lang/translations/sr.po +226 -0
  101. package/lang/translations/sv.po +226 -0
  102. package/lang/translations/th.po +226 -0
  103. package/lang/translations/tk.po +226 -0
  104. package/lang/translations/tr.po +226 -0
  105. package/lang/translations/ug.po +226 -0
  106. package/lang/translations/uk.po +226 -0
  107. package/lang/translations/ur.po +226 -0
  108. package/lang/translations/uz.po +226 -0
  109. package/lang/translations/vi.po +226 -0
  110. package/lang/translations/zh-cn.po +226 -0
  111. package/lang/translations/zh.po +226 -0
  112. package/package.json +38 -7
  113. package/src/aiassistant.d.ts +458 -0
  114. package/src/aiassistant.js +23 -0
  115. package/src/aiassistantediting.d.ts +45 -0
  116. package/src/aiassistantediting.js +23 -0
  117. package/src/aiassistantui.d.ts +44 -0
  118. package/src/aiassistantui.js +23 -0
  119. package/src/aiconnector.d.ts +45 -0
  120. package/src/aiconnector.js +23 -0
  121. package/src/augmentation.d.ts +26 -0
  122. package/src/augmentation.js +23 -0
  123. package/src/index.d.ts +9 -0
  124. package/src/index.js +23 -0
  125. package/src/ui/aiassistantcontroller.d.ts +96 -0
  126. package/src/ui/aiassistantcontroller.js +23 -0
  127. package/src/ui/dropdown/aicommandslistview.d.ts +22 -0
  128. package/src/ui/dropdown/aicommandslistview.js +23 -0
  129. package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +29 -0
  130. package/src/ui/dropdown/buttonlabelwithhighlightview.js +23 -0
  131. package/src/ui/dropdown/labelwithhighlightview.d.ts +25 -0
  132. package/src/ui/dropdown/labelwithhighlightview.js +23 -0
  133. package/src/ui/form/aiformcontentarea.d.ts +48 -0
  134. package/src/ui/form/aiformcontentarea.js +23 -0
  135. package/src/ui/form/aiformerrorview.d.ts +26 -0
  136. package/src/ui/form/aiformerrorview.js +23 -0
  137. package/src/ui/form/aiformpromptview.d.ts +46 -0
  138. package/src/ui/form/aiformpromptview.js +23 -0
  139. package/src/ui/form/aiformtoolbarview.d.ts +54 -0
  140. package/src/ui/form/aiformtoolbarview.js +23 -0
  141. package/src/ui/form/aiformview.d.ts +142 -0
  142. package/src/ui/form/aiformview.js +23 -0
  143. package/src/ui/form/aihistorylistitemview.d.ts +18 -0
  144. package/src/ui/form/aihistorylistitemview.js +23 -0
  145. package/src/ui/form/aihistorylistview.d.ts +35 -0
  146. package/src/ui/form/aihistorylistview.js +23 -0
  147. package/src/ui/form/prompthistory.d.ts +20 -0
  148. package/src/ui/form/prompthistory.js +23 -0
  149. package/src/ui/showaiassistantcommand.d.ts +26 -0
  150. package/src/ui/showaiassistantcommand.js +23 -0
  151. package/src/utils/common-translations.d.ts +9 -0
  152. package/src/utils/common-translations.js +23 -0
  153. package/theme/ai-dropdown.css +37 -0
  154. package/theme/ai-form.css +250 -0
  155. package/theme/ai.css +103 -0
  156. package/theme/icons/copy.svg +1 -0
  157. package/theme/icons/error.svg +1 -0
  158. package/theme/icons/magic-wand.svg +1 -0
  159. package/theme/icons/robot-pencil.svg +1 -0
  160. package/theme/icons/submit.svg +1 -0
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x433a=['Prompt\x20history','historyGroupView','delegate','clearHistoryButton','_createClearHistoryButton','length','filter','add','clearHistory','set','fire','locale','label','children','execute','items'];(function(_0x309933,_0x433a77){const _0x1114b9=function(_0x4687b4){while(--_0x4687b4){_0x309933['push'](_0x309933['shift']());}};_0x1114b9(++_0x433a77);}(_0x433a,0x130));const _0x1114=function(_0x309933,_0x433a77){_0x309933=_0x309933-0x0;let _0x1114b9=_0x433a[_0x309933];return _0x1114b9;};import{ListView as _0x39c127,ListItemGroupView as _0x355b6d,ButtonView as _0x3b2b3a}from'ckeditor5/src/ui';import{getTranslation as _0x2e3f47}from'../../utils/common-translations';export default class ot extends _0x39c127{constructor(_0x58fe50){super(_0x58fe50),this[_0x1114('0x3')]=this[_0x1114('0x4')](),this['historyGroupView']=new _0x355b6d(),this[_0x1114('0x1')][_0x1114('0xd')][_0x1114('0x7')](this[_0x1114('0x3')],0x1),this[_0x1114('0x1')][_0x1114('0xc')]=_0x2e3f47(_0x58fe50,_0x1114('0x0')),this['historyGroupView']['items'][_0x1114('0x2')](_0x1114('0xe'))['to'](this),this[_0x1114('0xf')][_0x1114('0x7')](this[_0x1114('0x1')]);}[_0x1114('0x6')](){let _0x222365=0x0;for(const _0x2102c2 of this[_0x1114('0xf')])_0x222365+=_0x2102c2[_0x1114('0xf')][_0x1114('0x5')];return{'resultsCount':_0x222365,'totalItemsCount':_0x222365};}[_0x1114('0x4')](){const _0x501d4a=this['locale'],_0x4c28d4=new _0x3b2b3a(this[_0x1114('0xb')]);return _0x4c28d4[_0x1114('0x9')]({'label':'('+_0x2e3f47(_0x501d4a,'Clear')+')','withText':!0x0}),_0x4c28d4['on']('execute',()=>this[_0x1114('0xa')](_0x1114('0x8'))),_0x4c28d4;}}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ import { Collection } from 'ckeditor5/src/utils';
6
+ /**
7
+ * A collection that stores the prompt history in the session storage as a side effect.
8
+ */
9
+ export default class PromptHistory extends Collection<PromptHistoryEntry> {
10
+ /**
11
+ * @inheritDoc
12
+ */
13
+ constructor();
14
+ }
15
+ /**
16
+ * An object that represents a historical prompt.
17
+ */
18
+ export type PromptHistoryEntry = {
19
+ prompt: string;
20
+ };
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x1087=['length','map','addMany','last','stringify','setItem','getItem','CKEditor/AIFormView/PromptHistory','add','_saveToSessionStorage','parse','_loadFromSessionStorage','trim','remove','toLowerCase','prompt'];(function(_0x4a0ac9,_0x108718){const _0x359b4f=function(_0x12d1a4){while(--_0x12d1a4){_0x4a0ac9['push'](_0x4a0ac9['shift']());}};_0x359b4f(++_0x108718);}(_0x1087,0x19b));const _0x359b=function(_0x4a0ac9,_0x108718){_0x4a0ac9=_0x4a0ac9-0x0;let _0x359b4f=_0x1087[_0x4a0ac9];return _0x359b4f;};import{Collection as _0x1aa872}from'ckeditor5/src/utils';const ts=_0x359b('0xc');export default class at extends _0x1aa872{constructor(){super(),this[_0x359b('0x0')](),this['on'](_0x359b('0xd'),(_0x5d4b5e,_0x4de006)=>{const _0x223fa9=os(_0x4de006['prompt']);for(const _0xf48b6d of this)if(_0xf48b6d!=_0x4de006&&os(_0xf48b6d[_0x359b('0x4')])===_0x223fa9){this[_0x359b('0x2')](_0xf48b6d);break;}this[_0x359b('0x5')]>0x14&&this[_0x359b('0x2')](this[_0x359b('0x8')]),this[_0x359b('0xe')]();}),this['on'](_0x359b('0x2'),()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x2b47b4=sessionStorage[_0x359b('0xb')](ts)||'[]';this[_0x359b('0x7')](JSON[_0x359b('0xf')](_0x2b47b4));}[_0x359b('0xe')](){sessionStorage[_0x359b('0xa')](ts,JSON[_0x359b('0x9')](this[_0x359b('0x6')](_0x4d35f6=>_0x4d35f6)));}}function os(_0x10acf3){return _0x10acf3[_0x359b('0x3')]()[_0x359b('0x1')]();}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module ai/ui/showaiassistantcommand
7
+ * @publicApi
8
+ */
9
+ import { Command } from 'ckeditor5/src/core';
10
+ /**
11
+ * Command that shows the AI Assistant user interface.
12
+ */
13
+ export default class ShowAIAssistantCommand extends Command {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ refresh(): void;
18
+ /**
19
+ * Opens AI Assistant user interface for the current document selection.
20
+ *
21
+ * @param prompt The initial prompt. If set, the AI assistant will automatically submit given prompt to the AI service.
22
+ * @param label Label to be displayed in the AI assistant query input field while the AI assistant processes the initial prompt.
23
+ * @fires execute
24
+ */
25
+ execute(prompt?: string, label?: string): void;
26
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ const _0x2af0=['aiAssistant.disabledElements','config','document','includes','selection','showUI','element','model','refresh','isEnabled','editor','plugins','get','name'];(function(_0x3c511d,_0x2af0a6){const _0x317296=function(_0x397cac){while(--_0x397cac){_0x3c511d['push'](_0x3c511d['shift']());}};_0x317296(++_0x2af0a6);}(_0x2af0,0x161));const _0x3172=function(_0x3c511d,_0x2af0a6){_0x3c511d=_0x3c511d-0x0;let _0x317296=_0x2af0[_0x3c511d];return _0x317296;};import{Command as _0x20ea57}from'ckeditor5/src/core';import _0x2a1a3d from'../aiassistantui';export default class I extends _0x20ea57{[_0x3172('0x5')](){const _0x3e53d4=this['editor'][_0x3172('0x4')][_0x3172('0xd')][_0x3172('0x1')],_0x544306=this[_0x3172('0x7')][_0x3172('0xc')][_0x3172('0x9')](_0x3172('0xb'));for(const _0x1db871 of _0x3e53d4['getRanges']())for(const _0x37c4be of _0x1db871['getItems']())if(_0x37c4be['is'](_0x3172('0x3'))&&_0x544306[_0x3172('0x0')](_0x37c4be[_0x3172('0xa')]))return void(this['isEnabled']=!0x1);this[_0x3172('0x6')]=!0x0;}['execute'](_0xfb3456='',_0x3c0a25=''){this[_0x3172('0x7')][_0x3172('0x8')][_0x3172('0x9')](_0x2a1a3d)[_0x3172('0x2')](_0xfb3456,_0x3c0a25);}}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module ai/utils/common-translations
7
+ */
8
+ import type { Locale } from 'ckeditor5/src/utils';
9
+ export declare function getTranslation(locale: Locale, id: string, values?: string | Array<string> | number): string;
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ export function getTranslation(_0x2e53a6,_0x3aee86,_0x52ed40){const t=_0x2e53a6['t'];switch(_0x3aee86){case'Edit\x20or\x20review':return t('Edit\x20or\x20review');case'Improve\x20writing':return t('Improve\x20writing');case'Make\x20shorter':return t('Make\x20shorter');case'Make\x20longer':return t('Make\x20longer');case'Simplify\x20language':return t('Simplify\x20language');case'Generate\x20from\x20selection':return t('Generate\x20from\x20selection');case'Summarize':return t('Summarize');case'Continue':return t('Continue');case'Change\x20tone':return t('Change\x20tone');case'Professional':return t('Professional');case'Casual':return t('Casual');case'Direct':return t('Direct');case'Confident':return t('Confident');case'Friendly':return t('Friendly');case'Change\x20style':return t('Change\x20style');case'Business':return t('Business');case'Legal':return t('Legal');case'Journalism':return t('Journalism');case'Poetic':return t('Poetic');case'Translate':return t('Translate');case'Translate\x20to\x20%0':return t('Translate\x20to\x20%0',_0x52ed40);case'English':return t('English');case'Spanish':return t('Spanish');case'German':return t('German');case'Portuguese':return t('Portuguese');case'French':return t('French');case'Simplified\x20Chinese':return t('Simplified\x20Chinese');case'Hindi':return t('Hindi');case'Arabic':return t('Arabic');case'AI\x20Assistant':return t('AI\x20Assistant');case'AI\x20Commands':return t('AI\x20Commands');case'Ask\x20AI\x20to\x20edit\x20or\x20generate':return t('Ask\x20AI\x20to\x20edit\x20or\x20generate');case'Ask\x20AI\x20to\x20improve\x20generated\x20text':return t('Ask\x20AI\x20to\x20improve\x20generated\x20text');case'Copy':return t('Copy');case'Submit':return t('Submit');case'Insert\x20below':return t('Insert\x20below');case'Try\x20again':return t('Try\x20again');case'Stop':return t('Stop');case'AI\x20is\x20writing...':return t('AI\x20is\x20writing...');case'History':return t('History');case'Empty\x20history':return t('Empty\x20history');case'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.':return t('Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.');case'Prompt\x20history':return t('Prompt\x20history');case'Search\x20AI\x20command':return t('Search\x20AI\x20command');case'No\x20commands\x20found':return t('No\x20commands\x20found');case'No\x20commands\x20available':return t('No\x20commands\x20available');case'Clear':return t('Clear');case'AI_REPLACE_CONTENT':return t({'id':'AI_REPLACE_CONTENT','string':'Replace'});case'AI_INSERT_CONTENT':return t({'id':'AI_INSERT_CONTENT','string':'Insert'});case'AI_ERROR_AUTH_REQUEST':return t({'id':'AI_ERROR_AUTH_REQUEST','string':'Authorization\x20request\x20failed'});case'AI_ERROR_CONTEXT_LENGTH':return t({'id':'AI_ERROR_CONTEXT_LENGTH','string':'Selected\x20content\x20is\x20too\x20long'});case'AI_ERROR_MODERATION':return t({'id':'AI_ERROR_MODERATION','string':'Requested\x20query\x20does\x20not\x20pass\x20moderation\x20rules'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0x3aee86;}}
@@ -0,0 +1,37 @@
1
+ /*
2
+ * What you're currently looking at is the source code of a legally protected, proprietary software.
3
+ * CKEditor 5 Collaboration is licensed under a commercial license and protected by copyright law. Where not otherwise indicated,
4
+ * all CKEditor 5 Collaboration content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
5
+ *
6
+ * Copyright (c) 2003-2023, 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
+ @import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";
11
+ @import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
12
+
13
+ :root {
14
+ --ck-ai-dropdown-view-width: 250px;
15
+ --ck-ai-dropdown-view-list-max-height: 250px;
16
+ }
17
+
18
+ .ck.ck-ai-commands-search {
19
+ width: var(--ck-ai-dropdown-view-width);
20
+
21
+ & > .ck-labeled-field-view {
22
+ padding: var(--ck-spacing-large);
23
+
24
+ & .ck-input {
25
+ min-width: unset;
26
+ }
27
+ }
28
+
29
+ & > .ck-search__results {
30
+ border-top: 1px solid var(--ck-color-base-border);
31
+
32
+ & > .ck-list {
33
+ max-height: var(--ck-ai-dropdown-view-list-max-height);
34
+ overflow: auto;
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,250 @@
1
+ /*
2
+ * What you're currently looking at is the source code of a legally protected, proprietary software.
3
+ * CKEditor 5 Collaboration is licensed under a commercial license and protected by copyright law. Where not otherwise indicated,
4
+ * all CKEditor 5 Collaboration content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
5
+ *
6
+ * Copyright (c) 2003-2023, 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
+ @import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";
11
+ @import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
12
+
13
+ :root {
14
+ --ck-ai-form-view-width: 470px;
15
+ --ck-ai-form-content-height: 126px;
16
+ --ck-ai-form-content-background: hsl(0, 0%, 98%);
17
+ --ck-ai-form-history-font-size: .9em;
18
+
19
+ --ck-ai-form-error-background: var(--ck-color-light-red);
20
+ }
21
+
22
+ /* Note: This class name is mentioned in the guide and acts like a public API. */
23
+ .ck .ck-ai-form {
24
+ width: var(--ck-ai-form-view-width);
25
+
26
+ @mixin ck-media-phone {
27
+ --ck-ai-form-view-width: 350px;
28
+ }
29
+
30
+ & .ck-ai-form-content {
31
+ padding: var(--ck-spacing-large);
32
+ width: 100%;
33
+
34
+ & .ck-input {
35
+ width: 100%;
36
+ }
37
+
38
+ & .ck-ai-form__content-area-wrapper {
39
+ width: 100%;
40
+ max-height: var(--ck-ai-form-content-height);
41
+ overflow-y: auto;
42
+ border: 1px solid var(--ck-color-base-border);
43
+ border-radius: 2px;
44
+
45
+ &:focus {
46
+ outline: none;
47
+ border: var(--ck-focus-ring);
48
+ box-shadow: var(--ck-focus-outer-shadow), 0 0;
49
+ }
50
+ }
51
+
52
+ & .ck-ai-form__content-area {
53
+ display: flex;
54
+ background-color: var(--ck-ai-form-content-background);
55
+
56
+ &.ck-ai-form__content-area--processing {
57
+ --ck-color-text: var(--ck-color-input-disabled-text);
58
+ background-color: var(--ck-color-input-disabled-background);
59
+ }
60
+
61
+ /* Note: This class name is mentioned in the guide and acts like a public API */
62
+ & .ck-ai-form__content-field {
63
+ width: 100%;
64
+ white-space: normal;
65
+ padding: var(--ck-spacing-tiny) var(--ck-spacing-medium);
66
+ min-height: calc( var(--ck-line-height-base) * var(--ck-font-size-base) );
67
+ box-sizing: content-box;
68
+
69
+ @mixin ck-dir ltr {
70
+ padding-right: 0;
71
+ }
72
+
73
+ @mixin ck-dir rtl {
74
+ padding-left: 0;
75
+ }
76
+
77
+ & > * {
78
+ white-space: normal;
79
+ color: inherit;
80
+ }
81
+ }
82
+
83
+ & .ck-spinner-container {
84
+ @mixin ck-dir ltr {
85
+ margin-right: var(--ck-spacing-medium);
86
+ }
87
+
88
+ @mixin ck-dir rtl {
89
+ margin-left: var(--ck-spacing-medium);
90
+ }
91
+
92
+ }
93
+
94
+ & .ck-ai-form__copy-button-wrapper {
95
+ display: flex;
96
+ flex-direction: column-reverse;
97
+ padding-left: 2px;
98
+ }
99
+
100
+ & .ck-ai-form__copy-button {
101
+ position: sticky;
102
+ right: 1px;
103
+ bottom: 1px;
104
+ padding: 4px;
105
+ min-height: unset;
106
+ min-width: unset;
107
+
108
+ & svg {
109
+ --ck-icon-size: 16px;
110
+ }
111
+
112
+ &.ck-ai-form__copy-button--copied {
113
+ color: inherit;
114
+ }
115
+ }
116
+ }
117
+
118
+ & .ck-ai-form__toolbar {
119
+ border: none;
120
+ padding: 0;
121
+ margin-top: var(--ck-spacing-medium);
122
+ margin-bottom: calc( 2 * var(--ck-spacing-medium) );
123
+ }
124
+
125
+ & .ck-ai-form__loader {
126
+ display: flex;
127
+ align-items: center;
128
+
129
+ & .ck-spinner {
130
+ box-sizing: border-box;
131
+ }
132
+ }
133
+
134
+ & .ck-autocomplete {
135
+ display: flex;
136
+ justify-content: space-between;
137
+
138
+ & > .ck-labeled-field-view {
139
+ flex-grow: 1;
140
+ }
141
+
142
+ & > .ck.ck-ai-form__submit {
143
+ @mixin ck-dir ltr {
144
+ margin-left: var(--ck-spacing-medium);
145
+ }
146
+
147
+ @mixin ck-dir rtl {
148
+ margin-right: var(--ck-spacing-medium);
149
+ }
150
+
151
+ border-color: var(--ck-ai-form-submit-button-border-color);
152
+ color: var(--ck-ai-form-submit-button-text-color);
153
+
154
+ &.ck-disabled {
155
+ border-color: var(--ck-ai-form-submit-button-disabled-border-color);
156
+ }
157
+ }
158
+
159
+ /* Toggle history button */
160
+ & > .ck-labeled-field-view .ck-ai-form__toggle-history {
161
+ position: absolute;
162
+ font-size: var(--ck-font-size-tiny);
163
+
164
+ @mixin ck-dir ltr {
165
+ right: var(--ck-spacing-medium);
166
+ }
167
+
168
+ @mixin ck-dir rtl {
169
+ left: var(--ck-spacing-medium);
170
+ }
171
+
172
+ bottom: var(--ck-spacing-small);
173
+ top: var(--ck-spacing-small);
174
+ padding: 4px;
175
+ min-height: unset;
176
+ min-width: unset;
177
+ }
178
+
179
+ & .ck-textarea {
180
+ /* Give the toggle history button some space */
181
+ @mixin ck-dir ltr {
182
+ padding-right: 30px;
183
+ }
184
+
185
+ @mixin ck-dir rtl {
186
+ padding-left: 30px;
187
+ }
188
+ }
189
+
190
+ /* Prompt history group */
191
+ & .ck-search__results .ck-list .ck-list__group {
192
+ display: grid;
193
+ grid-template-columns: auto 1fr;
194
+ grid-template-rows: auto;
195
+ grid-column-gap: 0px;
196
+ grid-row-gap: 0px;
197
+
198
+ /* History group label */
199
+ & > span {
200
+ grid-area: 1 / 1 / 2 / 2;
201
+ }
202
+
203
+ /* Clear button in the history */
204
+ & > .ck-button {
205
+ padding: 0;
206
+ min-height: auto;
207
+ grid-area: 1 / 2 / 2 / 3;
208
+ font-size: var(--ck-ai-form-history-font-size);
209
+ justify-self: start;
210
+ background: none;
211
+ margin: var(--ck-spacing-medium) 0 0;
212
+
213
+ & .ck-button__label {
214
+ line-height: inherit;
215
+
216
+ &:hover {
217
+ text-decoration: underline;
218
+ }
219
+ }
220
+ }
221
+
222
+ & > .ck-list {
223
+ grid-area: 2 / 1 / 3 / 3;
224
+
225
+ /* Prompts can be very long. We need to display them whole. */
226
+ & .ck-list__item .ck-button .ck-button__label {
227
+ white-space: nowrap;
228
+ overflow: hidden;
229
+ max-width: 100%;
230
+ text-overflow: ellipsis;
231
+ font-size: var(--ck-ai-form-history-font-size);
232
+ line-height: var(--ck-line-height-base);
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+
239
+ & .ck-ai-form__error {
240
+ display: flex;
241
+ justify-content: center;
242
+ align-items: center;
243
+ padding: var(--ck-spacing-medium);
244
+ background-color: var(--ck-ai-form-error-background);
245
+ color: var(--ck-color-base-text);
246
+ border-radius: 2px;
247
+ margin-bottom: var(--ck-spacing-medium);
248
+ }
249
+ }
250
+
package/theme/ai.css ADDED
@@ -0,0 +1,103 @@
1
+ /*
2
+ * What you're currently looking at is the source code of a legally protected, proprietary software.
3
+ * CKEditor 5 Collaboration is licensed under a commercial license and protected by copyright law. Where not otherwise indicated,
4
+ * all CKEditor 5 Collaboration content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
5
+ *
6
+ * Copyright (c) 2003-2023, 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
+ /*
11
+ * These definitions bring violet accents (tint) across the AI UI.
12
+ */
13
+ :root {
14
+ --ck-ai-form-submit-button-text-color: var(--ck-color-text);
15
+ --ck-ai-form-submit-button-border-color: transparent;
16
+ --ck-ai-form-submit-button-disabled-border-color: transparent;
17
+ --ck-ai-toolbar-button-hover-color: var(--ck-color-text);
18
+ }
19
+
20
+ /* Note: This class name is mentioned in the guide and acts like a public API. */
21
+ .ck-ai-assistant-ui_theme {
22
+ --ck-color-button-default-hover-background: hsl(262.1,100%,96.3%);
23
+ --ck-color-button-default-active-background: hsl(262.1,100%,96.3%);
24
+
25
+ --ck-color-button-on-background: hsl(262.1,100%,96.3%);
26
+ --ck-color-button-on-hover-background: hsl(262.5,60%,92.2%);
27
+ --ck-color-button-on-active-background: hsl(262.1,100%,96.3%);
28
+ --ck-color-button-on-disabled-background: hsl(262.1,100%,96.3%);
29
+ --ck-color-button-on-color: hsl(263.2,59.2%,52%);
30
+
31
+ --ck-color-button-action-background: hsl(263.2,59.2%,52%);
32
+ --ck-color-button-action-hover-background: hsl(262.6,58.9%,49.6%);
33
+ --ck-color-button-action-active-background: hsl(262.6,58.9%,49.6%);
34
+ --ck-color-button-action-disabled-background: hsl(263.8,59.3%,75.9%);
35
+
36
+ --ck-color-list-button-hover-background: hsl(262.1,100%,96.3%);
37
+
38
+ --ck-ai-form-content-background: hsl(0,0%,97.6%);
39
+ --ck-ai-form-submit-button-text-color: var(--ck-color-button-on-color);
40
+ --ck-ai-form-submit-button-border-color: var(--ck-color-button-action-background);
41
+ --ck-ai-form-submit-button-disabled-border-color: var(--ck-color-button-action-disabled-background);
42
+ --ck-ai-toolbar-button-hover-color: var(--ck-color-button-on-color);
43
+ }
44
+
45
+ /*
46
+ * Apply the theme colors for specific elements.
47
+ */
48
+ .ck-ai-commands-dropdown > .ck-button:hover,
49
+ .ck-ai-assistant-button:hover {
50
+ color: var(--ck-ai-toolbar-button-hover-color);
51
+ }
52
+
53
+ /*
54
+ * Classes used by the "fake visual selection" displayed in the content when an input
55
+ * in the AI UI has focus (the browser does not render the native selection in this state).
56
+ *
57
+ * Narrow down to <span> to prevent changing background for widgets and nested editables.
58
+ */
59
+ .ck span.ck-fake-ai-selection {
60
+ background: var(--ck-color-link-fake-selection);
61
+ }
62
+
63
+ /* A collapsed fake visual selection. */
64
+ .ck .ck-fake-ai-selection_collapsed {
65
+ height: 100%;
66
+ border-right: 1px solid var(--ck-color-base-text);
67
+ margin-right: -1px;
68
+ outline: solid 1px hsla(0, 0%, 100%, .5);
69
+ }
70
+
71
+ /*
72
+ * Styles of the AI response field. The margins, font sizes and line-heights have been reduced
73
+ * to save space.
74
+ *
75
+ * Note: This class name is mentioned in the guide and acts like a public API.
76
+ */
77
+ .ck.ck-content.ck-ai-form__content-field {
78
+ & h2 {
79
+ font-size: 1.3em;
80
+ }
81
+
82
+ & h3 {
83
+ font-size: 1.2em;
84
+ }
85
+
86
+ & h4, & h5, & h6 {
87
+ font-size: 1.1em;
88
+ }
89
+
90
+ & h2, & h3, & h4, & h5, & h6, & p, & ul, & ol {
91
+ margin-block-start: .5em;
92
+ margin-block-end: .5em;
93
+ line-height: 1.7em;
94
+ }
95
+
96
+ & > :first-child {
97
+ margin-top: 0;
98
+ }
99
+
100
+ & > :last-child {
101
+ margin-bottom: 0;
102
+ }
103
+ }
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 2.801a.7.7 0 0 0-.7.7v11.5a.8.8 0 0 1-1.6 0v-11.5a2.3 2.3 0 0 1 2.3-2.3h6.5a.8.8 0 0 1 0 1.6H5Zm.7 3.7a2.3 2.3 0 0 1 2.3-2.3h7a2.3 2.3 0 0 1 2.3 2.3v10a2.3 2.3 0 0 1-2.3 2.3H8a2.3 2.3 0 0 1-2.3-2.3v-10Zm2.3-.7a.7.7 0 0 0-.7.7v10a.7.7 0 0 0 .7.7h7a.7.7 0 0 0 .7-.7v-10a.7.7 0 0 0-.7-.7H8Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M9.9 4.385a1.2 1.2 0 0 0-.44.44h.002l-5.284 9.15a1.2 1.2 0 0 0 1.04 1.8h10.564a1.2 1.2 0 0 0 1.04-1.8l-5.282-9.15a1.2 1.2 0 0 0-1.64-.44Zm.05 8.363a.301.301 0 0 1 .115-.023h.9a.301.301 0 0 1 .3.3v.9a.3.3 0 0 1-.3.3h-.9a.3.3 0 0 1-.3-.3v-.9a.3.3 0 0 1 .185-.277Zm-.185-4.723a.3.3 0 0 1 .3-.3h.9a.3.3 0 0 1 .3.3v3.4a.3.3 0 0 1-.3.3h-.9a.301.301 0 0 1-.3-.3v-3.4Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.346 9.422a.151.151 0 0 1 .284 0l.548 1.484a.152.152 0 0 0 .09.089l1.483.549a.151.151 0 0 1 0 .284l-1.483.548a.151.151 0 0 0-.09.09l-.548 1.483a.152.152 0 0 1-.142.1.151.151 0 0 1-.142-.1l-.549-1.483a.15.15 0 0 0-.09-.09l-1.483-.548a.15.15 0 0 1 0-.284l1.484-.549a.152.152 0 0 0 .089-.09l.549-1.483Z"/><path d="M16.306 1.742a.151.151 0 0 1 .284 0l.549 1.483a.15.15 0 0 0 .089.09l1.483.548a.151.151 0 0 1 .072.229.151.151 0 0 1-.072.055l-1.483.549a.15.15 0 0 0-.09.09l-.548 1.482a.151.151 0 0 1-.284 0l-.549-1.483a.15.15 0 0 0-.09-.09l-1.483-.548a.151.151 0 0 1 0-.284l1.484-.549a.152.152 0 0 0 .09-.089l.548-1.483Z"/><path d="M7.665 1.742a.151.151 0 0 1 .284 0l.549 1.483a.151.151 0 0 0 .09.09l1.482.548a.151.151 0 0 1 .072.229.151.151 0 0 1-.072.055l-1.483.549a.151.151 0 0 0-.09.09L7.95 6.267a.151.151 0 0 1-.284 0l-.549-1.483a.151.151 0 0 0-.089-.09l-1.483-.548a.151.151 0 0 1 0-.284l1.483-.549a.151.151 0 0 0 .09-.089l.548-1.483-.001.001Z"/><path d="M14.72 7.946a.848.848 0 0 0 .25-.591.824.824 0 0 0-.241-.588l-1.943-1.938a.812.812 0 0 0-.588-.241.838.838 0 0 0-.591.25l-1.545 1.539 3.115 3.115 1.542-1.546h.001Z"/><path clip-rule="evenodd" d="M1.19 15.636a.96.96 0 0 1 .281-.679l7.835-7.834 3.121 3.12-7.834 7.835a.959.959 0 0 1-1.358 0l-1.764-1.764a.96.96 0 0 1-.28-.678Zm9.22-5.391-1.121-1.12-6.479 6.478 1.121 1.121 6.479-6.479Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.61 2.66a1.406 1.406 0 1 0-1.407 0v.891H3.28a2.11 2.11 0 0 0-2.11 2.11v10.312a2.11 2.11 0 0 0 2.11 2.109h5.684l-.054-1.157.18-.25H3.28a.703.703 0 0 1-.703-.702V5.66c0-.389.315-.704.703-.704h11.25c.388 0 .703.315.703.704v2.484l.358-.497a2.492 2.492 0 0 1 1.048-.84V5.66a2.11 2.11 0 0 0-2.11-2.11H9.61v-.89Z"/><path d="M5.625 10.817c.518 0 .937-.63.937-1.407 0-.776-.42-1.406-.937-1.406-.518 0-.938.63-.938 1.406 0 .777.42 1.407.938 1.407Z"/><path d="M13.125 9.41c0 .777-.42 1.407-.938 1.407s-.937-.63-.937-1.407c0-.776.42-1.406.937-1.406.518 0 .938.63.938 1.406Z"/><path d="M.937 8.004A.937.937 0 0 0 0 8.942v1.875c0 .517.42.937.937.937v-3.75Z"/><path d="M6.128 12.51a.782.782 0 0 1 1.085.216c.272.408.907.707 1.693.707s1.421-.3 1.693-.707a.782.782 0 0 1 1.302.868c-.666 1-1.906 1.403-2.995 1.403-1.089 0-2.329-.404-2.995-1.403a.782.782 0 0 1 .217-1.085Z"/><path d="m16.987 8.91-.622.864 2.879 2.074.622-.864a.71.71 0 0 0-.161-.99l-1.728-1.245a.71.71 0 0 0-.99.161Z"/><path d="M11.635 19.951a.355.355 0 0 1-.449-.31l-.214-2.38 4.978-6.911 2.88 2.074-4.978 6.91-2.217.617Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.875 4.419a.75.75 0 0 0-1.5 0v7.25H6.818l2.33-1.955a.75.75 0 0 0-.963-1.15l-3.792 3.182a.75.75 0 0 0-.17.945c.046.11.118.208.21.284l3.788 3.18a.75.75 0 1 0 .965-1.149l-2.19-1.837h7.629c.69 0 1.25-.56 1.25-1.25v-7.5Z"/></svg>