@gravity-ui/markdown-editor 13.17.0 → 13.18.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 (227) hide show
  1. package/README.md +2 -0
  2. package/build/cjs/bundle/config/action-names.d.ts +1 -1
  3. package/build/cjs/bundle/config/action-names.js +1 -0
  4. package/build/cjs/bundle/config/icons.d.ts +1 -1
  5. package/build/cjs/bundle/config/icons.js +3 -0
  6. package/build/cjs/bundle/config/wysiwyg.d.ts +1 -0
  7. package/build/cjs/bundle/config/wysiwyg.js +13 -1
  8. package/build/cjs/extensions/behavior/Resizable/Resizable.css +38 -0
  9. package/build/cjs/extensions/behavior/Resizable/Resizable.d.ts +9 -0
  10. package/build/cjs/extensions/behavior/Resizable/Resizable.js +14 -0
  11. package/build/cjs/extensions/markdown/Table/actions/innerActions.d.ts +1 -1
  12. package/build/cjs/extensions/markdown/Table/plugins/TableCellContextPlugin/index.js +19 -9
  13. package/build/cjs/extensions/yfm/GPT/ErrorScreen/ErrorScreen.css +18 -0
  14. package/build/cjs/extensions/yfm/GPT/ErrorScreen/ErrorScreen.d.ts +8 -0
  15. package/build/cjs/extensions/yfm/GPT/ErrorScreen/ErrorScreen.js +21 -0
  16. package/build/cjs/extensions/yfm/GPT/ErrorScreen/types.d.ts +14 -0
  17. package/build/cjs/extensions/yfm/GPT/ErrorScreen/types.js +2 -0
  18. package/build/cjs/extensions/yfm/GPT/GptDialog/GptDialog.css +75 -0
  19. package/build/cjs/extensions/yfm/GPT/GptDialog/GptDialog.d.ts +28 -0
  20. package/build/cjs/extensions/yfm/GPT/GptDialog/GptDialog.js +102 -0
  21. package/build/cjs/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.css +22 -0
  22. package/build/cjs/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.d.ts +3 -0
  23. package/build/cjs/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.js +21 -0
  24. package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.d.ts +1 -0
  25. package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.js +5 -0
  26. package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.css +8 -0
  27. package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.d.ts +14 -0
  28. package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.js +28 -0
  29. package/build/cjs/extensions/yfm/GPT/IconRefuge/index.d.ts +2 -0
  30. package/build/cjs/extensions/yfm/GPT/IconRefuge/index.js +5 -0
  31. package/build/cjs/extensions/yfm/GPT/PresetList/PresetList.d.ts +9 -0
  32. package/build/cjs/extensions/yfm/GPT/PresetList/PresetList.js +29 -0
  33. package/build/cjs/extensions/yfm/GPT/PresetList/Presetlist.css +6 -0
  34. package/build/cjs/extensions/yfm/GPT/actions.d.ts +2 -0
  35. package/build/cjs/extensions/yfm/GPT/actions.js +14 -0
  36. package/build/cjs/extensions/yfm/GPT/commands.d.ts +2 -0
  37. package/build/cjs/extensions/yfm/GPT/commands.js +13 -0
  38. package/build/cjs/extensions/yfm/GPT/constants.d.ts +13 -0
  39. package/build/cjs/extensions/yfm/GPT/constants.js +15 -0
  40. package/build/cjs/extensions/yfm/GPT/gptExtension/gptExtension.d.ts +13 -0
  41. package/build/cjs/extensions/yfm/GPT/gptExtension/gptExtension.js +18 -0
  42. package/build/cjs/extensions/yfm/GPT/gptExtension/view.css +17 -0
  43. package/build/cjs/extensions/yfm/GPT/gptExtension/view.d.ts +36 -0
  44. package/build/cjs/extensions/yfm/GPT/gptExtension/view.js +171 -0
  45. package/build/cjs/extensions/yfm/GPT/hooks/useGpt.d.ts +27 -0
  46. package/build/cjs/extensions/yfm/GPT/hooks/useGpt.js +148 -0
  47. package/build/cjs/extensions/yfm/GPT/hooks/useGptHotKeys.d.ts +2 -0
  48. package/build/cjs/extensions/yfm/GPT/hooks/useGptHotKeys.js +8 -0
  49. package/build/cjs/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.d.ts +13 -0
  50. package/build/cjs/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.js +70 -0
  51. package/build/cjs/extensions/yfm/GPT/hooks/usePresetList.d.ts +14 -0
  52. package/build/cjs/extensions/yfm/GPT/hooks/usePresetList.js +36 -0
  53. package/build/cjs/extensions/yfm/GPT/index.d.ts +2 -0
  54. package/build/cjs/extensions/yfm/GPT/index.js +5 -0
  55. package/build/cjs/extensions/yfm/GPT/plugin.d.ts +13 -0
  56. package/build/cjs/extensions/yfm/GPT/plugin.js +47 -0
  57. package/build/cjs/extensions/yfm/GPT/toolbar.d.ts +3 -0
  58. package/build/cjs/extensions/yfm/GPT/toolbar.js +22 -0
  59. package/build/cjs/extensions/yfm/GPT/utils.d.ts +13 -0
  60. package/build/cjs/extensions/yfm/GPT/utils.js +31 -0
  61. package/build/cjs/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImgSettingsButton.css +6 -0
  62. package/build/cjs/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImgSettingsButton.d.ts +6 -1
  63. package/build/cjs/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImgSettingsButton.js +21 -37
  64. package/build/cjs/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/NodeView.d.ts +1 -1
  65. package/build/cjs/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/NodeView.js +62 -4
  66. package/build/cjs/extensions/yfm/Mermaid/MermaidNodeView/MermaidView.js +8 -7
  67. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.d.ts +1 -1
  68. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.js +0 -8
  69. package/build/cjs/extensions/yfm/index.d.ts +1 -0
  70. package/build/cjs/extensions/yfm/index.js +1 -0
  71. package/build/cjs/i18n/gpt/dialog/en.json +16 -0
  72. package/build/cjs/i18n/gpt/dialog/index.d.ts +19 -0
  73. package/build/cjs/i18n/gpt/dialog/index.js +8 -0
  74. package/build/cjs/i18n/gpt/dialog/ru.json +16 -0
  75. package/build/cjs/i18n/gpt/errors/en.json +5 -0
  76. package/build/cjs/i18n/gpt/errors/index.d.ts +8 -0
  77. package/build/cjs/i18n/gpt/errors/index.js +8 -0
  78. package/build/cjs/i18n/gpt/errors/ru.json +5 -0
  79. package/build/cjs/i18n/gpt/extension/en.json +6 -0
  80. package/build/cjs/i18n/gpt/extension/index.d.ts +9 -0
  81. package/build/cjs/i18n/gpt/extension/index.js +8 -0
  82. package/build/cjs/i18n/gpt/extension/ru.json +6 -0
  83. package/build/cjs/i18n/gpt/loading/en.json +3 -0
  84. package/build/cjs/i18n/gpt/loading/index.d.ts +6 -0
  85. package/build/cjs/i18n/gpt/loading/index.js +8 -0
  86. package/build/cjs/i18n/gpt/loading/ru.json +3 -0
  87. package/build/cjs/i18n/menubar/en.json +1 -0
  88. package/build/cjs/i18n/menubar/index.d.ts +2 -1
  89. package/build/cjs/i18n/menubar/ru.json +1 -0
  90. package/build/cjs/i18n/yfm-table/en.json +10 -1
  91. package/build/cjs/i18n/yfm-table/index.d.ts +10 -1
  92. package/build/cjs/i18n/yfm-table/ru.json +10 -1
  93. package/build/cjs/icons/GPT.d.ts +2 -0
  94. package/build/cjs/icons/GPT.js +22 -0
  95. package/build/cjs/icons/GPTLoading.d.ts +2 -0
  96. package/build/cjs/icons/GPTLoading.js +12 -0
  97. package/build/cjs/icons/index.d.ts +3 -1
  98. package/build/cjs/icons/index.js +5 -1
  99. package/build/cjs/react-utils/useAutoFocus.d.ts +1 -1
  100. package/build/cjs/react-utils/useAutoFocus.js +2 -2
  101. package/build/cjs/react-utils/useNodeEditing.d.ts +3 -2
  102. package/build/cjs/react-utils/useNodeEditing.js +1 -1
  103. package/build/cjs/react-utils/useNodeResizing.d.ts +22 -0
  104. package/build/cjs/react-utils/useNodeResizing.js +82 -0
  105. package/build/cjs/table-utils/commands/appendColumn.js +42 -33
  106. package/build/cjs/table-utils/commands/appendRow.js +40 -22
  107. package/build/cjs/table-utils/commands/removeColumn.js +18 -20
  108. package/build/cjs/table-utils/commands/removeRow.js +12 -9
  109. package/build/cjs/table-utils/table-desc.d.ts +53 -0
  110. package/build/cjs/table-utils/table-desc.js +149 -0
  111. package/build/cjs/table-utils/utils.d.ts +1 -1
  112. package/build/cjs/table-utils/utils.js +19 -12
  113. package/build/cjs/version.js +1 -1
  114. package/build/esm/bundle/config/action-names.d.ts +1 -1
  115. package/build/esm/bundle/config/action-names.js +1 -0
  116. package/build/esm/bundle/config/icons.d.ts +1 -1
  117. package/build/esm/bundle/config/icons.js +2 -0
  118. package/build/esm/bundle/config/wysiwyg.d.ts +1 -0
  119. package/build/esm/bundle/config/wysiwyg.js +12 -0
  120. package/build/esm/extensions/behavior/Resizable/Resizable.css +38 -0
  121. package/build/esm/extensions/behavior/Resizable/Resizable.d.ts +10 -0
  122. package/build/esm/extensions/behavior/Resizable/Resizable.js +10 -0
  123. package/build/esm/extensions/markdown/Table/actions/innerActions.d.ts +1 -1
  124. package/build/esm/extensions/markdown/Table/plugins/TableCellContextPlugin/index.js +19 -9
  125. package/build/esm/extensions/yfm/GPT/ErrorScreen/ErrorScreen.css +18 -0
  126. package/build/esm/extensions/yfm/GPT/ErrorScreen/ErrorScreen.d.ts +9 -0
  127. package/build/esm/extensions/yfm/GPT/ErrorScreen/ErrorScreen.js +17 -0
  128. package/build/esm/extensions/yfm/GPT/ErrorScreen/types.d.ts +14 -0
  129. package/build/esm/extensions/yfm/GPT/ErrorScreen/types.js +1 -0
  130. package/build/esm/extensions/yfm/GPT/GptDialog/GptDialog.css +75 -0
  131. package/build/esm/extensions/yfm/GPT/GptDialog/GptDialog.d.ts +29 -0
  132. package/build/esm/extensions/yfm/GPT/GptDialog/GptDialog.js +98 -0
  133. package/build/esm/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.css +22 -0
  134. package/build/esm/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.d.ts +4 -0
  135. package/build/esm/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.js +17 -0
  136. package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.d.ts +1 -0
  137. package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.js +2 -0
  138. package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.css +8 -0
  139. package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.d.ts +15 -0
  140. package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.js +25 -0
  141. package/build/esm/extensions/yfm/GPT/IconRefuge/index.d.ts +2 -0
  142. package/build/esm/extensions/yfm/GPT/IconRefuge/index.js +1 -0
  143. package/build/esm/extensions/yfm/GPT/PresetList/PresetList.d.ts +10 -0
  144. package/build/esm/extensions/yfm/GPT/PresetList/PresetList.js +25 -0
  145. package/build/esm/extensions/yfm/GPT/PresetList/Presetlist.css +6 -0
  146. package/build/esm/extensions/yfm/GPT/actions.d.ts +2 -0
  147. package/build/esm/extensions/yfm/GPT/actions.js +10 -0
  148. package/build/esm/extensions/yfm/GPT/commands.d.ts +2 -0
  149. package/build/esm/extensions/yfm/GPT/commands.js +9 -0
  150. package/build/esm/extensions/yfm/GPT/constants.d.ts +13 -0
  151. package/build/esm/extensions/yfm/GPT/constants.js +12 -0
  152. package/build/esm/extensions/yfm/GPT/gptExtension/gptExtension.d.ts +13 -0
  153. package/build/esm/extensions/yfm/GPT/gptExtension/gptExtension.js +14 -0
  154. package/build/esm/extensions/yfm/GPT/gptExtension/view.css +17 -0
  155. package/build/esm/extensions/yfm/GPT/gptExtension/view.d.ts +37 -0
  156. package/build/esm/extensions/yfm/GPT/gptExtension/view.js +167 -0
  157. package/build/esm/extensions/yfm/GPT/hooks/useGpt.d.ts +27 -0
  158. package/build/esm/extensions/yfm/GPT/hooks/useGpt.js +144 -0
  159. package/build/esm/extensions/yfm/GPT/hooks/useGptHotKeys.d.ts +2 -0
  160. package/build/esm/extensions/yfm/GPT/hooks/useGptHotKeys.js +4 -0
  161. package/build/esm/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.d.ts +13 -0
  162. package/build/esm/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.js +65 -0
  163. package/build/esm/extensions/yfm/GPT/hooks/usePresetList.d.ts +14 -0
  164. package/build/esm/extensions/yfm/GPT/hooks/usePresetList.js +32 -0
  165. package/build/esm/extensions/yfm/GPT/index.d.ts +2 -0
  166. package/build/esm/extensions/yfm/GPT/index.js +2 -0
  167. package/build/esm/extensions/yfm/GPT/plugin.d.ts +13 -0
  168. package/build/esm/extensions/yfm/GPT/plugin.js +43 -0
  169. package/build/esm/extensions/yfm/GPT/toolbar.d.ts +3 -0
  170. package/build/esm/extensions/yfm/GPT/toolbar.js +18 -0
  171. package/build/esm/extensions/yfm/GPT/utils.d.ts +13 -0
  172. package/build/esm/extensions/yfm/GPT/utils.js +23 -0
  173. package/build/esm/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImgSettingsButton.css +6 -0
  174. package/build/esm/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImgSettingsButton.d.ts +7 -1
  175. package/build/esm/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/ImgSettingsButton.js +23 -38
  176. package/build/esm/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/NodeView.d.ts +1 -1
  177. package/build/esm/extensions/yfm/ImgSize/plugins/ImgSizeNodeView/NodeView.js +63 -5
  178. package/build/esm/extensions/yfm/Mermaid/MermaidNodeView/MermaidView.js +5 -4
  179. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.d.ts +1 -1
  180. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.js +1 -9
  181. package/build/esm/extensions/yfm/index.d.ts +1 -0
  182. package/build/esm/extensions/yfm/index.js +1 -0
  183. package/build/esm/i18n/gpt/dialog/en.json +16 -0
  184. package/build/esm/i18n/gpt/dialog/index.d.ts +19 -0
  185. package/build/esm/i18n/gpt/dialog/index.js +4 -0
  186. package/build/esm/i18n/gpt/dialog/ru.json +16 -0
  187. package/build/esm/i18n/gpt/errors/en.json +5 -0
  188. package/build/esm/i18n/gpt/errors/index.d.ts +8 -0
  189. package/build/esm/i18n/gpt/errors/index.js +4 -0
  190. package/build/esm/i18n/gpt/errors/ru.json +5 -0
  191. package/build/esm/i18n/gpt/extension/en.json +6 -0
  192. package/build/esm/i18n/gpt/extension/index.d.ts +9 -0
  193. package/build/esm/i18n/gpt/extension/index.js +4 -0
  194. package/build/esm/i18n/gpt/extension/ru.json +6 -0
  195. package/build/esm/i18n/gpt/loading/en.json +3 -0
  196. package/build/esm/i18n/gpt/loading/index.d.ts +6 -0
  197. package/build/esm/i18n/gpt/loading/index.js +4 -0
  198. package/build/esm/i18n/gpt/loading/ru.json +3 -0
  199. package/build/esm/i18n/menubar/en.json +1 -0
  200. package/build/esm/i18n/menubar/index.d.ts +2 -1
  201. package/build/esm/i18n/menubar/ru.json +1 -0
  202. package/build/esm/i18n/yfm-table/en.json +10 -1
  203. package/build/esm/i18n/yfm-table/index.d.ts +10 -1
  204. package/build/esm/i18n/yfm-table/ru.json +10 -1
  205. package/build/esm/icons/GPT.d.ts +2 -0
  206. package/build/esm/icons/GPT.js +19 -0
  207. package/build/esm/icons/GPTLoading.d.ts +2 -0
  208. package/build/esm/icons/GPTLoading.js +9 -0
  209. package/build/esm/icons/index.d.ts +3 -1
  210. package/build/esm/icons/index.js +3 -1
  211. package/build/esm/react-utils/useAutoFocus.d.ts +1 -1
  212. package/build/esm/react-utils/useAutoFocus.js +2 -2
  213. package/build/esm/react-utils/useNodeEditing.d.ts +3 -2
  214. package/build/esm/react-utils/useNodeEditing.js +1 -1
  215. package/build/esm/react-utils/useNodeResizing.d.ts +22 -0
  216. package/build/esm/react-utils/useNodeResizing.js +77 -0
  217. package/build/esm/table-utils/commands/appendColumn.js +44 -35
  218. package/build/esm/table-utils/commands/appendRow.js +42 -24
  219. package/build/esm/table-utils/commands/removeColumn.js +18 -20
  220. package/build/esm/table-utils/commands/removeRow.js +14 -11
  221. package/build/esm/table-utils/table-desc.d.ts +53 -0
  222. package/build/esm/table-utils/table-desc.js +144 -0
  223. package/build/esm/table-utils/utils.d.ts +1 -1
  224. package/build/esm/table-utils/utils.js +18 -12
  225. package/build/esm/version.js +1 -1
  226. package/build/styles.css +190 -0
  227. package/package.json +3 -2
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableDesc = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const is_number_1 = tslib_1.__importDefault(require("is-number"));
6
+ const utils_1 = require("./utils");
7
+ class TableDesc {
8
+ constructor(
9
+ /* eslint-disable @typescript-eslint/parameter-properties */
10
+ rows, cols, rowsDesc, baseOffset) {
11
+ this.rows = rows;
12
+ this.cols = cols;
13
+ this.rowsDesc = rowsDesc;
14
+ this.baseOffset = baseOffset;
15
+ }
16
+ static create(table) {
17
+ if (this.__cache.has(table))
18
+ return this.__cache.get(table);
19
+ if (!(0, utils_1.isTableNode)(table))
20
+ return null;
21
+ const tbody = table.lastChild;
22
+ if (!tbody || !(0, utils_1.isTableBodyNode)(tbody))
23
+ return null;
24
+ // table –> tbody -> ...
25
+ const baseOffset = 2;
26
+ const rows = [];
27
+ tbody.forEach((trow, offset) => {
28
+ rows.push({ node: trow, offset, cells: [] });
29
+ });
30
+ tbody.forEach((trow, _1, trowIndex) => {
31
+ trow.forEach((tcell, offset, tcellRealIndex) => {
32
+ var _a;
33
+ const rowDesc = rows[trowIndex];
34
+ let tcellIndex = tcellRealIndex;
35
+ while (rowDesc.cells[tcellIndex]) {
36
+ tcellIndex++;
37
+ }
38
+ const cellDesc = (rowDesc.cells[tcellIndex] = {
39
+ type: 'real',
40
+ node: tcell,
41
+ offset,
42
+ });
43
+ const map = [trowIndex, tcellIndex];
44
+ if ((0, is_number_1.default)(tcell.attrs['colspan'])) {
45
+ rowDesc.colspan = true;
46
+ const colspan = (cellDesc.colspan = parseInt(tcell.attrs['colspan'], 10));
47
+ for (let i = 1; i < colspan; i++) {
48
+ rowDesc.cells[tcellIndex + i] = {
49
+ type: 'virtual',
50
+ colspan: map,
51
+ };
52
+ }
53
+ }
54
+ if ((0, is_number_1.default)(tcell.attrs['rowspan'])) {
55
+ rowDesc.rowspan = true;
56
+ const rowspan = (cellDesc.rowspan = parseInt(tcell.attrs['rowspan'], 10));
57
+ for (let i = 1; i < rowspan; i++) {
58
+ const colspan = (_a = cellDesc.colspan) !== null && _a !== void 0 ? _a : 1;
59
+ for (let j = 0; j < colspan; j++)
60
+ rows[trowIndex + i].cells[tcellIndex + j] = {
61
+ type: 'virtual',
62
+ rowspan: map,
63
+ };
64
+ }
65
+ }
66
+ });
67
+ });
68
+ const desc = new this(rows.length, rows[0].cells.length, rows, baseOffset);
69
+ this.__cache.set(table, desc);
70
+ return desc;
71
+ }
72
+ rowHasVirtualCells(rowIndex) {
73
+ var _a;
74
+ return (_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells.some((cell) => cell.type === 'virtual');
75
+ }
76
+ columnHasVirtualCells(columnIndex) {
77
+ return this.rowsDesc.some((row) => { var _a; return ((_a = row.cells[columnIndex]) === null || _a === void 0 ? void 0 : _a.type) === 'virtual'; });
78
+ }
79
+ isSafeColumn(columnIndex) {
80
+ return this.rowsDesc.every((row) => {
81
+ var _a;
82
+ const cell = row.cells[columnIndex];
83
+ if (cell.type === 'real' && (!cell.colspan || cell.colspan === 1))
84
+ return true;
85
+ if (cell.type === 'virtual' && ((_a = cell.rowspan) === null || _a === void 0 ? void 0 : _a[1]) === columnIndex)
86
+ return true;
87
+ return false;
88
+ });
89
+ }
90
+ isSafeRow(rowIndex) {
91
+ var _a;
92
+ return (_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells.every((cell) => {
93
+ var _a;
94
+ if (cell.type === 'real' && (!cell.rowspan || cell.rowspan === 1))
95
+ return true;
96
+ if (cell.type === 'virtual' && ((_a = cell.colspan) === null || _a === void 0 ? void 0 : _a[0]) === rowIndex)
97
+ return true;
98
+ return false;
99
+ });
100
+ }
101
+ getOffsetForRow(rowIndex) {
102
+ var _a;
103
+ return this.baseOffset + ((_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.offset);
104
+ }
105
+ getRelativePosForRow(rowIndex) {
106
+ const from = this.getOffsetForRow(rowIndex);
107
+ const to = from + this.rowsDesc[rowIndex].node.nodeSize;
108
+ return { from, to };
109
+ }
110
+ getRelativePosForCell(rowIndex, columnIndex) {
111
+ var _a;
112
+ const cell = (_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells[columnIndex];
113
+ const rowOffset = this.getOffsetForRow(rowIndex);
114
+ if ((cell === null || cell === void 0 ? void 0 : cell.type) === 'real') {
115
+ // 1 – open boundary for row node
116
+ const from = rowOffset + 1 + cell.offset;
117
+ const to = from + cell.node.nodeSize;
118
+ return { type: 'real', from, to };
119
+ }
120
+ if ((cell === null || cell === void 0 ? void 0 : cell.type) === 'virtual') {
121
+ let index = columnIndex;
122
+ while (--index >= 0) {
123
+ const cell = this.rowsDesc[rowIndex].cells[index];
124
+ if (cell.type === 'real') {
125
+ const closest = rowOffset + 1 + cell.offset + cell.node.nodeSize;
126
+ return { type: 'virtual', closestPos: closest };
127
+ }
128
+ }
129
+ return { type: 'virtual', closestPos: rowOffset + 1 };
130
+ }
131
+ throw new Error(`Impossible to calculate offset for cell with position [${rowIndex},${columnIndex}]`);
132
+ }
133
+ getRelativePosForColumn(columnIndex) {
134
+ const ranges = [];
135
+ for (let i = 0; i < this.rows; i++) {
136
+ ranges.push(this.getRelativePosForCell(i, columnIndex));
137
+ }
138
+ return ranges;
139
+ }
140
+ getCellNodeType() {
141
+ const isRealCell = (cell) => cell.type === 'real';
142
+ return this.rowsDesc[0].cells.find(isRealCell).node.type;
143
+ }
144
+ getRowNodeType() {
145
+ return this.rowsDesc[0].node.type;
146
+ }
147
+ }
148
+ exports.TableDesc = TableDesc;
149
+ TableDesc.__cache = new WeakMap();
@@ -25,7 +25,7 @@ export declare const findChildTableBody: (node: PmNode) => {
25
25
  node: PmNode;
26
26
  pos: number;
27
27
  }[];
28
- export declare const getTableDimensions: (node: PmNode | Node) => {
28
+ export declare const getTableDimensions: (node: PmNode) => {
29
29
  rows: number;
30
30
  cols: number;
31
31
  };
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.atEndOfCell = exports.getTableDimensions = exports.findChildTableBody = exports.findChildTableCells = exports.findChildTableRows = exports.findParentTableCellFromPos = exports.findParentTableRowFromPos = exports.findParentTableBodyFromPos = exports.findParentTableFromPos = exports.findParentTableCell = exports.findParentTableRow = exports.findParentTableBody = exports.findParentTable = exports.isTableCellNode = exports.isTableRowNode = exports.isTableBodyNode = exports.isTableNode = void 0;
4
- const prosemirror_model_1 = require("prosemirror-model");
4
+ const tslib_1 = require("tslib");
5
+ const is_number_1 = tslib_1.__importDefault(require("is-number"));
5
6
  const prosemirror_utils_1 = require("prosemirror-utils");
6
7
  const selection_1 = require("../utils/selection");
7
8
  const const_1 = require("./const");
@@ -32,17 +33,23 @@ exports.findChildTableCells = findChildTableCells;
32
33
  const findChildTableBody = (node) => (0, prosemirror_utils_1.findChildren)(node, exports.isTableBodyNode);
33
34
  exports.findChildTableBody = findChildTableBody;
34
35
  const getTableDimensions = (node) => {
35
- var _a, _b, _c, _d, _e, _f;
36
- let rows, cols;
37
- if (node instanceof prosemirror_model_1.Node) {
38
- rows = (_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.childCount;
39
- cols = (_c = (_b = node.firstChild) === null || _b === void 0 ? void 0 : _b.firstChild) === null || _c === void 0 ? void 0 : _c.childCount;
40
- }
41
- else {
42
- rows = (_d = node.firstChild) === null || _d === void 0 ? void 0 : _d.childNodes.length;
43
- cols = (_f = (_e = node.firstChild) === null || _e === void 0 ? void 0 : _e.firstChild) === null || _f === void 0 ? void 0 : _f.childNodes.length;
44
- }
45
- return { rows: rows || 1, cols: cols || 1 };
36
+ let rows = 0, cols = 0;
37
+ const tbody = node.firstChild;
38
+ tbody === null || tbody === void 0 ? void 0 : tbody.forEach((trow, _1, trowIndex) => {
39
+ rows++;
40
+ if (trowIndex === 0) {
41
+ trow.forEach((tcell, _2) => {
42
+ const cellAttrs = tcell.attrs;
43
+ if ((0, is_number_1.default)(cellAttrs['colspan'])) {
44
+ cols += parseInt(cellAttrs['colspan'], 10);
45
+ }
46
+ else {
47
+ cols++;
48
+ }
49
+ });
50
+ }
51
+ });
52
+ return { rows, cols };
46
53
  };
47
54
  exports.getTableDimensions = getTableDimensions;
48
55
  function atEndOfCell(view, dir) {
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  /** During build process, the current version will be injected here */
5
- exports.VERSION = typeof '13.17.0' !== 'undefined' ? '13.17.0' : 'unknown';
5
+ exports.VERSION = typeof '13.18.0' !== 'undefined' ? '13.18.0' : 'unknown';
@@ -1,3 +1,3 @@
1
- declare const namesObj: Record<"bold" | "link" | "italic" | "strike" | "underline" | "mark" | "quote" | "mono" | "paragraph" | "anchor" | "table" | "image" | "code_inline" | "code_block" | "file" | "checkbox" | "bulletList" | "orderedList" | "emoji" | "tabs" | "yfm_cut" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "yfm_note" | "undo" | "redo" | "math_inline" | "math_block" | "mermaid" | "liftListItem" | "sinkListItem" | "yfm_block" | "yfm_html_block" | "yfm_layout" | "horizontalrule", string>;
1
+ declare const namesObj: Record<"bold" | "link" | "italic" | "strike" | "underline" | "mark" | "quote" | "mono" | "paragraph" | "anchor" | "table" | "image" | "code_inline" | "code_block" | "file" | "checkbox" | "bulletList" | "orderedList" | "emoji" | "tabs" | "yfm_cut" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "yfm_note" | "gpt" | "undo" | "redo" | "math_inline" | "math_block" | "mermaid" | "liftListItem" | "sinkListItem" | "yfm_block" | "yfm_html_block" | "yfm_layout" | "horizontalrule", string>;
2
2
  export declare const ActionName: Readonly<typeof namesObj>;
3
3
  export {};
@@ -38,6 +38,7 @@ const names = [
38
38
  'math_block',
39
39
  'tabs',
40
40
  'mermaid',
41
+ 'gpt',
41
42
  ];
42
43
  const namesObj = names.reduce((obj, val) => {
43
44
  obj[val] = val;
@@ -1,5 +1,5 @@
1
1
  import { ToolbarIconData } from '../../toolbar/types';
2
- declare type Icon = 'undo' | 'redo' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'mono' | 'mark' | 'textColor' | 'text' | 'headline' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'bulletList' | 'orderedList' | 'sink' | 'lift' | 'cut' | 'note' | 'code' | 'codeBlock' | 'link' | 'image' | 'table' | 'quote' | 'checklist' | 'horizontalRule' | 'file' | 'functionInline' | 'functionBlock' | 'emoji' | 'tabs' | 'mermaid' | 'html' | 'foldingHeading';
2
+ declare type Icon = 'undo' | 'redo' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'mono' | 'mark' | 'textColor' | 'text' | 'headline' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'bulletList' | 'orderedList' | 'sink' | 'lift' | 'cut' | 'note' | 'code' | 'codeBlock' | 'link' | 'image' | 'table' | 'quote' | 'checklist' | 'horizontalRule' | 'file' | 'functionInline' | 'functionBlock' | 'emoji' | 'tabs' | 'mermaid' | 'html' | 'foldingHeading' | 'gpt';
3
3
  declare type Icons = Record<Icon, ToolbarIconData>;
4
4
  export declare const icons: Icons;
5
5
  export {};
@@ -1,4 +1,5 @@
1
1
  import { BoldIcon, CheckListIcon, CodeBlockIcon, CodeInlineIcon, CutIcon, EmojiIcon, FileIcon, FoldingHeadingIcon, FunctionBlockIcon, FunctionInlineIcon, HRuleIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, Heading5Icon, Heading6Icon, HeadingIcon, HtmlBlockIcon, ImageIcon, ItalicIcon, LiftIcon, LinkIcon, ListBlIcon, ListOlIcon, MarkIcon, MermaidIcon, MonoIcon, NoteIcon, QuoteIcon, RedoIcon, SinkIcon, StrikethroughIcon, TableIcon, TabsIcon, TextColorIcon, TextIcon, UnderlineIcon, UndoIcon, } from '../../icons';
2
+ import GPTIcon from '../../icons/GPT';
2
3
  export const icons = {
3
4
  undo: { data: UndoIcon },
4
5
  redo: { data: RedoIcon },
@@ -39,4 +40,5 @@ export const icons = {
39
40
  tabs: { data: TabsIcon },
40
41
  mermaid: { data: MermaidIcon },
41
42
  foldingHeading: { data: FoldingHeadingIcon },
43
+ gpt: { data: GPTIcon },
42
44
  };
@@ -45,6 +45,7 @@ export declare const wMathBlockItemData: WToolbarSingleItemData;
45
45
  export declare const wMathListConfig: WToolbarListButtonData;
46
46
  export declare const wMathListItem: WToolbarListItemData;
47
47
  export declare const wYfmHtmlBlockItemData: WToolbarSingleItemData;
48
+ export declare const wGptItemData: WToolbarSingleItemData;
48
49
  export declare const wCommandMenuConfig: WToolbarItemData[];
49
50
  export declare const wHiddenData: WToolbarItemData[];
50
51
  /** prepared wysiwyg toolbar config */
@@ -1,4 +1,6 @@
1
1
  import { headingType, pType } from '../../extensions';
2
+ // for typings from Math
3
+ import { gptHotKeys } from '../../extensions/yfm/GPT/constants';
2
4
  import { i18n as i18nHint } from '../../i18n/hints';
3
5
  import { i18n } from '../../i18n/menubar';
4
6
  import { Action as A, formatter as f } from '../../shortcuts';
@@ -400,6 +402,16 @@ export const wYfmHtmlBlockItemData = {
400
402
  isActive: (e) => e.actions.createYfmHtmlBlock.isActive(),
401
403
  isEnable: (e) => e.actions.createYfmHtmlBlock.isEnable(),
402
404
  };
405
+ export const wGptItemData = {
406
+ id: ActionName.gpt,
407
+ type: ToolbarDataType.SingleButton,
408
+ title: i18n.bind(null, 'gpt'),
409
+ hotkey: gptHotKeys.openGptKeyTooltip,
410
+ icon: icons.gpt,
411
+ exec: (e) => e.actions.addGptWidget.run({}),
412
+ isActive: (e) => e.actions.addGptWidget.isActive(),
413
+ isEnable: (e) => e.actions.addGptWidget.isEnable(),
414
+ };
403
415
  export const wCommandMenuConfig = [
404
416
  ...wHeadingListConfig.data,
405
417
  ...wListsListConfig.data,
@@ -0,0 +1,38 @@
1
+ body :has(.g-md-resizable_resizing) {
2
+ cursor: col-resize;
3
+ }
4
+
5
+ .g-md-resizable {
6
+ position: relative;
7
+ }
8
+ .g-md-resizable_resizing .g-md-resizable__resizer-wrapper, .g-md-resizable_hover .g-md-resizable__resizer-wrapper {
9
+ position: absolute;
10
+ z-index: 1;
11
+ top: 0;
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ width: 20px;
16
+ height: 100%;
17
+ cursor: col-resize;
18
+ pointer-events: auto;
19
+ }
20
+ .g-md-resizable_resizing .g-md-resizable__resizer-wrapper_left, .g-md-resizable_hover .g-md-resizable__resizer-wrapper_left {
21
+ left: 0;
22
+ }
23
+ .g-md-resizable_resizing .g-md-resizable__resizer-wrapper_right, .g-md-resizable_hover .g-md-resizable__resizer-wrapper_right {
24
+ right: 0;
25
+ }
26
+ .g-md-resizable__resizer {
27
+ opacity: 0;
28
+ }
29
+ .g-md-resizable_resizing .g-md-resizable__resizer, .g-md-resizable_hover .g-md-resizable__resizer {
30
+ box-sizing: content-box;
31
+ width: 4px;
32
+ height: 50px;
33
+ max-height: 50%;
34
+ opacity: 1;
35
+ border-radius: 6px;
36
+ background: rgba(127, 127, 127, 0.8);
37
+ transition: opacity 300ms ease-in 0s;
38
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './Resizable.css';
3
+ export interface ResizableProps {
4
+ children: React.ReactNode;
5
+ onResizeLeft: (event: React.MouseEvent<HTMLElement>) => void;
6
+ onResizeRight: (event: React.MouseEvent<HTMLElement>) => void;
7
+ hover?: boolean;
8
+ resizing?: boolean;
9
+ }
10
+ export declare const Resizable: React.FC<ResizableProps>;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { cn } from '../../../classname';
3
+ import './Resizable.css';
4
+ const b = cn('resizable');
5
+ const Resizer = ({ onMouseDown, direction }) => (React.createElement("div", { className: b('resizer-wrapper', { [direction]: true }), role: "button", tabIndex: 0, onMouseDown: onMouseDown },
6
+ React.createElement("div", { className: b('resizer') })));
7
+ export const Resizable = ({ hover, resizing, children, onResizeLeft, onResizeRight, }) => (React.createElement("div", { className: b({ hover, resizing }) },
8
+ children,
9
+ React.createElement(Resizer, { onMouseDown: onResizeLeft, direction: "left" }),
10
+ React.createElement(Resizer, { onMouseDown: onResizeRight, direction: "right" })));
@@ -1,2 +1,2 @@
1
1
  import { ActionSpec } from '../../../../core';
2
- export declare const innerActions: Record<"addRow" | "deleteRow" | "addColumn" | "deleteColumn" | "setCellLeftAlign" | "setCellCenterAlign" | "setCellRightAlign", ActionSpec>;
2
+ export declare const innerActions: Record<"deleteRow" | "deleteColumn" | "setCellLeftAlign" | "setCellCenterAlign" | "setCellRightAlign" | "addRow" | "addColumn", ActionSpec>;
@@ -1,5 +1,6 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
2
  import { bindActions } from '../../../../../core';
3
+ import { i18n } from '../../../../../i18n/yfm-table';
3
4
  import { convertToYfmTable } from '../../../../yfm';
4
5
  import { TableNode } from '../../TableSpecs';
5
6
  import { innerActions } from '../../actions/innerActions';
@@ -14,18 +15,27 @@ export const tableCellContextPlugin = () => new Plugin({
14
15
  } }))(view);
15
16
  return new TableCellContextView(view, [
16
17
  [
17
- { action: actions.setCellLeftAlign, text: 'left' },
18
- { action: actions.setCellCenterAlign, text: 'center' },
19
- { action: actions.setCellRightAlign, text: 'right' },
18
+ {
19
+ action: actions.setCellLeftAlign,
20
+ text: i18n('table.menu.cell.align.left'),
21
+ },
22
+ {
23
+ action: actions.setCellCenterAlign,
24
+ text: i18n('table.menu.cell.align.center'),
25
+ },
26
+ {
27
+ action: actions.setCellRightAlign,
28
+ text: i18n('table.menu.cell.align.right'),
29
+ },
20
30
  ],
21
31
  [
22
- { action: actions.addRow, text: 'add row' },
23
- { action: actions.deleteRow, text: 'del row' },
24
- { action: actions.addColumn, text: 'add column' },
25
- { action: actions.deleteColumn, text: 'del column' },
32
+ { action: actions.addRow, text: i18n('table.menu.row.add') },
33
+ { action: actions.deleteRow, text: i18n('table.menu.row.remove') },
34
+ { action: actions.addColumn, text: i18n('table.menu.column.add') },
35
+ { action: actions.deleteColumn, text: i18n('table.menu.column.remove') },
26
36
  ],
27
- { action: actions.convert, text: 'convert to yfm table' },
28
- { action: actions.deleteTable, text: 'del table' },
37
+ { action: actions.convert, text: i18n('table.menu.convert.yfm') },
38
+ { action: actions.deleteTable, text: i18n('table.menu.table.remove') },
29
39
  ], [schema.nodes[TableNode.HeaderCell], schema.nodes[TableNode.DataCell]]);
30
40
  },
31
41
  });
@@ -0,0 +1,18 @@
1
+ .g-md-gpt-dialog-error-screen__content {
2
+ display: flex;
3
+ align-items: center;
4
+ margin-bottom: var(--g-spacing-2);
5
+ }
6
+ .g-md-gpt-dialog-error-screen__icon {
7
+ color: var(--g-color-base-danger-heavy);
8
+ }
9
+ .g-md-gpt-dialog-error-screen__text {
10
+ flex: auto;
11
+ font-size: var(--g-text-body-2-font-size);
12
+ font-weight: 500;
13
+ }
14
+ .g-md-gpt-dialog-error-screen__buttons {
15
+ display: flex;
16
+ align-items: center;
17
+ gap: var(--g-spacing-2);
18
+ }
@@ -0,0 +1,9 @@
1
+ import type { FC } from 'react';
2
+ import './ErrorScreen.css';
3
+ declare type ErrorScreenProps = {
4
+ onRetry: () => void;
5
+ onStartAgain: () => void;
6
+ };
7
+ export declare const cnGptDialogErrorScreen: import("@bem-react/classname").ClassNameFormatter;
8
+ export declare const ErrorScreen: FC<ErrorScreenProps>;
9
+ export {};
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { CircleXmarkFill } from '@gravity-ui/icons';
3
+ import { Button } from '@gravity-ui/uikit';
4
+ import { cn } from '../../../../classname';
5
+ import { i18n } from '../../../../i18n/gpt/errors';
6
+ import { IconRefuge } from '../IconRefuge/IconRefuge';
7
+ import './ErrorScreen.css';
8
+ export const cnGptDialogErrorScreen = cn('gpt-dialog-error-screen');
9
+ export const ErrorScreen = ({ onRetry, onStartAgain }) => {
10
+ return (React.createElement("div", { className: cnGptDialogErrorScreen() },
11
+ React.createElement("div", { className: cnGptDialogErrorScreen('content') },
12
+ React.createElement(IconRefuge, { containerClassName: cnGptDialogErrorScreen('icon'), data: CircleXmarkFill, refugeSize: 28, size: 16 }),
13
+ React.createElement("span", { className: cnGptDialogErrorScreen('text') }, i18n('error-text'))),
14
+ React.createElement("div", { className: cnGptDialogErrorScreen('buttons') },
15
+ React.createElement(Button, { view: "normal", onClick: onStartAgain }, i18n('start-again-button')),
16
+ React.createElement(Button, { view: "normal", onClick: onRetry }, i18n('retry-button')))));
17
+ };
@@ -0,0 +1,14 @@
1
+ export declare type PromptPreset<PromptData extends unknown = unknown> = {
2
+ display: string;
3
+ key: string;
4
+ data?: PromptData;
5
+ hotKey?: string;
6
+ };
7
+ export declare type CommonAnswer = {
8
+ rawText: string;
9
+ };
10
+ export declare type GptRequestData<PromptData extends unknown = unknown> = {
11
+ markup: string;
12
+ customPrompt?: string;
13
+ promptData?: PromptData;
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,75 @@
1
+ .g-md-gpt-dialog__header-top {
2
+ display: flex;
3
+ align-items: center;
4
+ }
5
+ .g-md-gpt-dialog__custom-prompt-input {
6
+ margin-right: var(--g-spacing-2);
7
+ }
8
+ .g-md-gpt-dialog__custom-prompt-input .g-text-input__control {
9
+ font-size: var(--g-text-body-2-font-size);
10
+ }
11
+ .g-md-gpt-dialog__header-bottom {
12
+ margin-top: var(--g-spacing-2);
13
+ }
14
+ .g-md-gpt-dialog__custom-prompt {
15
+ display: flex;
16
+ flex: auto;
17
+ align-items: center;
18
+ }
19
+ .g-md-gpt-dialog__alone-presets-text {
20
+ margin-right: var(--g-spacing-8);
21
+ }
22
+ .g-md-gpt-dialog__alone-presets {
23
+ display: flex;
24
+ flex: auto;
25
+ align-items: center;
26
+ width: 100%;
27
+ font-size: var(--g-text-body-2-font-size);
28
+ font-weight: 500;
29
+ }
30
+ .g-md-gpt-dialog__alone-presets .g-md-gpt-dialog-preset-list {
31
+ flex: auto;
32
+ }
33
+ .g-md-gpt-dialog__answer-title {
34
+ font-size: var(--g-text-body-2-font-size);
35
+ font-weight: 500;
36
+ }
37
+ .g-md-gpt-dialog__gpt-icon {
38
+ margin-right: var(--g-spacing-1);
39
+ }
40
+ .g-md-gpt-dialog__try-again-button {
41
+ margin-right: var(--g-spacing-2);
42
+ }
43
+ .g-md-gpt-dialog__body {
44
+ margin: var(--g-spacing-2) calc(-1 * var(--g-spacing-3));
45
+ padding: var(--g-spacing-4) var(--g-spacing-3);
46
+ border-top: 1px solid var(--g-color-line-generic);
47
+ }
48
+ .g-md-gpt-dialog__answer {
49
+ overflow: auto;
50
+ max-height: 300px;
51
+ }
52
+ .g-md-gpt-dialog__answer-actions {
53
+ display: flex;
54
+ align-items: center;
55
+ }
56
+ .g-md-gpt-dialog__feedback-message {
57
+ margin-left: var(--g-spacing-2);
58
+ }
59
+ .g-md-gpt-dialog__like-button {
60
+ margin-right: var(--g-spacing-2);
61
+ }
62
+ .g-md-gpt-dialog__close-button {
63
+ margin-right: var(--g-spacing-2);
64
+ margin-left: auto;
65
+ }
66
+ .g-md-gpt-dialog__footer {
67
+ display: flex;
68
+ align-items: center;
69
+ margin-top: var(--g-spacing-2);
70
+ }
71
+ .g-md-gpt-dialog__description-alert {
72
+ min-height: 34px;
73
+ margin-top: var(--g-spacing-3);
74
+ padding: var(--g-spacing-1) var(--g-spacing-2);
75
+ }
@@ -0,0 +1,29 @@
1
+ import type { FC } from 'react';
2
+ import { AlertProps } from '@gravity-ui/uikit';
3
+ import type { CommonAnswer, GptRequestData, PromptPreset } from '../ErrorScreen/types';
4
+ import './GptDialog.css';
5
+ export declare type GptDialogProps<AnswerData extends CommonAnswer = CommonAnswer, PromptData extends unknown = unknown> = {
6
+ markup: string;
7
+ answerRender: (data: AnswerData) => JSX.Element;
8
+ onApplyResult: (markup: string) => void;
9
+ promptPresets?: PromptPreset<PromptData>[];
10
+ disablePromptPresets?: boolean;
11
+ customPromptPlaceholder?: string;
12
+ disabledPromptPlaceholder?: string;
13
+ onCustomPromptApply?: (data: GptRequestData<PromptData>) => Promise<AnswerData | undefined>;
14
+ onPromptPresetClick?: (data: GptRequestData<PromptData>) => Promise<AnswerData | undefined>;
15
+ onTryAgain?: (data: GptRequestData<PromptData>) => Promise<AnswerData | undefined>;
16
+ onLike?: (data: GptRequestData<PromptData>) => Promise<void>;
17
+ onDislike?: (data: GptRequestData<PromptData>) => Promise<void>;
18
+ onClose?: () => void;
19
+ onUpdate?: (value: AnswerData | undefined) => void;
20
+ gptAlertProps?: {
21
+ showedGptAlert: boolean;
22
+ onCloseGptAlert?: () => void;
23
+ message?: string;
24
+ theme?: AlertProps['theme'];
25
+ className?: string;
26
+ };
27
+ };
28
+ export declare const cnGptDialog: import("@bem-react/classname").ClassNameFormatter;
29
+ export declare const GptDialog: FC<GptDialogProps>;