chuijs 4.0.1 → 4.0.3

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 (222) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/README.md +43 -632
  3. package/framework/appLayout/default/chui_app_layout.js +314 -273
  4. package/framework/appLayout/default/global_style.css +93 -53
  5. package/framework/components/chui_accordion/accordion.js +29 -26
  6. package/framework/components/chui_accordion/styles.css +6 -5
  7. package/framework/components/chui_action_sheet/action_sheet.js +59 -33
  8. package/framework/components/chui_action_sheet/styles.css +2 -1
  9. package/framework/components/chui_affix/affix.js +11 -6
  10. package/framework/components/chui_alert/alert.js +23 -14
  11. package/framework/components/chui_avatar/avatar.js +23 -22
  12. package/framework/components/chui_avatar_group/avatar_group.js +21 -19
  13. package/framework/components/chui_backtop/backtop.js +35 -19
  14. package/framework/components/chui_badge/badge.js +15 -13
  15. package/framework/components/chui_breadcrumb/breadcrumb.js +15 -13
  16. package/framework/components/chui_button/button.js +42 -22
  17. package/framework/components/chui_button/styles.css +2 -2
  18. package/framework/components/chui_calendar/calendar.js +12 -10
  19. package/framework/components/chui_card/card.js +43 -23
  20. package/framework/components/chui_chat/chat.js +72 -33
  21. package/framework/components/chui_clipboard_history/clipboard_history.js +30 -21
  22. package/framework/components/chui_clipboard_history/styles.css +4 -2
  23. package/framework/components/chui_code/code.js +2 -2
  24. package/framework/components/chui_code/styles.css +2 -2
  25. package/framework/components/chui_code_editor/code_editor.js +47 -31
  26. package/framework/components/chui_code_editor/styles.css +3 -2
  27. package/framework/components/chui_command_palette/command_palette.js +60 -37
  28. package/framework/components/chui_console/console.js +5 -5
  29. package/framework/components/chui_console/styles.css +1 -1
  30. package/framework/components/chui_content_block/content_block.js +33 -19
  31. package/framework/components/chui_content_block/styles.css +2 -2
  32. package/framework/components/chui_context_menu/context_menu.js +9 -4
  33. package/framework/components/chui_custom_element/custom_element.js +22 -15
  34. package/framework/components/chui_data_grid/data_grid.js +396 -234
  35. package/framework/components/chui_data_grid/styles.css +10 -8
  36. package/framework/components/chui_descriptions/descriptions.js +34 -17
  37. package/framework/components/chui_details/details.js +32 -26
  38. package/framework/components/chui_details/styles.css +5 -4
  39. package/framework/components/chui_diff_viewer/diff_viewer.js +91 -66
  40. package/framework/components/chui_diff_viewer/styles.css +1 -1
  41. package/framework/components/chui_divider/divider.js +13 -11
  42. package/framework/components/chui_drawer/drawer.js +27 -25
  43. package/framework/components/chui_drop_zone/drop_zone.js +31 -21
  44. package/framework/components/chui_empty_state/empty_state.js +20 -15
  45. package/framework/components/chui_fieldset/fieldset.js +37 -20
  46. package/framework/components/chui_fieldset/styles.css +1 -1
  47. package/framework/components/chui_file_explorer/file_explorer.js +157 -86
  48. package/framework/components/chui_file_explorer/styles.css +2 -1
  49. package/framework/components/chui_form/form.js +31 -19
  50. package/framework/components/chui_form/styles.css +1 -1
  51. package/framework/components/chui_gantt/gantt.js +64 -40
  52. package/framework/components/chui_graphs/graphs.js +301 -200
  53. package/framework/components/chui_graphs/styles.css +1 -1
  54. package/framework/components/chui_hero/hero.js +40 -22
  55. package/framework/components/chui_html_block/html_block.js +6 -6
  56. package/framework/components/chui_html_block/styles.css +2 -2
  57. package/framework/components/chui_hx/hx.js +3 -3
  58. package/framework/components/chui_hx/styles.css +11 -4
  59. package/framework/components/chui_icons/icons.js +2109 -2109
  60. package/framework/components/chui_icons/styles.css +2 -2
  61. package/framework/components/chui_inputs/chui_check_box/check_box.js +31 -19
  62. package/framework/components/chui_inputs/chui_check_box/styles.css +18 -18
  63. package/framework/components/chui_inputs/chui_chips/chips.js +50 -40
  64. package/framework/components/chui_inputs/chui_chips/styles.css +4 -2
  65. package/framework/components/chui_inputs/chui_color_picker/color_picker.js +36 -24
  66. package/framework/components/chui_inputs/chui_combo_box/combo_box.js +100 -82
  67. package/framework/components/chui_inputs/chui_combo_box/styles.css +14 -12
  68. package/framework/components/chui_inputs/chui_date/date.js +102 -66
  69. package/framework/components/chui_inputs/chui_date/styles.css +12 -11
  70. package/framework/components/chui_inputs/chui_date_range/date_range.js +40 -29
  71. package/framework/components/chui_inputs/chui_datetime/datetime.js +35 -27
  72. package/framework/components/chui_inputs/chui_email/email.js +43 -31
  73. package/framework/components/chui_inputs/chui_email/styles.css +5 -5
  74. package/framework/components/chui_inputs/chui_file/file.js +68 -41
  75. package/framework/components/chui_inputs/chui_file/styles.css +13 -12
  76. package/framework/components/chui_inputs/chui_hotkey/hotkey.js +61 -36
  77. package/framework/components/chui_inputs/chui_masked/masked.js +39 -28
  78. package/framework/components/chui_inputs/chui_mention/mention.js +77 -30
  79. package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +173 -153
  80. package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +9 -7
  81. package/framework/components/chui_inputs/chui_number/number.js +58 -41
  82. package/framework/components/chui_inputs/chui_number/styles.css +7 -7
  83. package/framework/components/chui_inputs/chui_otp/otp.js +38 -29
  84. package/framework/components/chui_inputs/chui_password/password.js +58 -36
  85. package/framework/components/chui_inputs/chui_password/styles.css +8 -8
  86. package/framework/components/chui_inputs/chui_radio_button/radio_button.js +37 -25
  87. package/framework/components/chui_inputs/chui_radio_button/styles.css +20 -20
  88. package/framework/components/chui_inputs/chui_rating/rating.js +26 -22
  89. package/framework/components/chui_inputs/chui_select_box/select_box.js +102 -78
  90. package/framework/components/chui_inputs/chui_select_box/styles.css +11 -11
  91. package/framework/components/chui_inputs/chui_slider/slider.js +29 -26
  92. package/framework/components/chui_inputs/chui_slider/styles.css +2 -1
  93. package/framework/components/chui_inputs/chui_text/styles.css +8 -8
  94. package/framework/components/chui_inputs/chui_text/text.js +65 -44
  95. package/framework/components/chui_inputs/chui_text_area/styles.css +6 -6
  96. package/framework/components/chui_inputs/chui_text_area/text_area.js +51 -28
  97. package/framework/components/chui_inputs/chui_time/styles.css +5 -3
  98. package/framework/components/chui_inputs/chui_time/time.js +38 -27
  99. package/framework/components/chui_inputs/chui_toggle/styles.css +3 -3
  100. package/framework/components/chui_inputs/chui_toggle/toggle.js +16 -16
  101. package/framework/components/chui_json_editor/json_editor.js +53 -43
  102. package/framework/components/chui_json_viewer/json_viewer.js +52 -33
  103. package/framework/components/chui_json_viewer/styles.css +3 -2
  104. package/framework/components/chui_kanban/kanban.js +52 -34
  105. package/framework/components/chui_kbd/kbd.js +12 -10
  106. package/framework/components/chui_label/label.js +14 -12
  107. package/framework/components/chui_label/styles.css +2 -2
  108. package/framework/components/chui_link/link.js +27 -20
  109. package/framework/components/chui_list/list.js +31 -27
  110. package/framework/components/chui_list/styles.css +2 -1
  111. package/framework/components/chui_markdown_editor/markdown_editor.js +60 -44
  112. package/framework/components/chui_media/audio.js +326 -227
  113. package/framework/components/chui_media/audio_styles.css +40 -21
  114. package/framework/components/chui_media/image.js +70 -38
  115. package/framework/components/chui_media/image_compare.js +52 -21
  116. package/framework/components/chui_media/image_styles.css +3 -3
  117. package/framework/components/chui_media/video.js +155 -62
  118. package/framework/components/chui_media/video_styles.css +33 -16
  119. package/framework/components/chui_menu_bar/menu_bar.js +26 -24
  120. package/framework/components/chui_menu_bar/styles.css +4 -2
  121. package/framework/components/chui_modal/modal.js +44 -43
  122. package/framework/components/chui_modal/styles.css +3 -2
  123. package/framework/components/chui_notification/notification.js +50 -34
  124. package/framework/components/chui_notification/notification_download.js +31 -25
  125. package/framework/components/chui_notification/notification_download_progress.css +3 -2
  126. package/framework/components/chui_notification/notification_download_progress.js +47 -41
  127. package/framework/components/chui_notification/notification_update.js +23 -16
  128. package/framework/components/chui_notification/status_plate.js +2 -2
  129. package/framework/components/chui_notification/styles_download.css +1 -1
  130. package/framework/components/chui_notification/styles_update.css +1 -1
  131. package/framework/components/chui_org_chart/org_chart.js +74 -35
  132. package/framework/components/chui_pagination/pagination.js +62 -27
  133. package/framework/components/chui_paragraph/paragraph.js +2 -2
  134. package/framework/components/chui_paragraph/styles.css +1 -1
  135. package/framework/components/chui_popover/popover.js +49 -28
  136. package/framework/components/chui_popups/popups.js +137 -108
  137. package/framework/components/chui_popups/styles.css +2 -2
  138. package/framework/components/chui_print_button/print_button.js +33 -23
  139. package/framework/components/chui_progress_bar/progress_bar.js +23 -15
  140. package/framework/components/chui_progress_bar/styles.css +2 -2
  141. package/framework/components/chui_progress_ring/progress_ring.js +17 -15
  142. package/framework/components/chui_qrcode/qrcode.js +75 -31
  143. package/framework/components/chui_query_builder/query_builder.js +216 -123
  144. package/framework/components/chui_radio_group/radio_group.js +36 -26
  145. package/framework/components/chui_radio_group/styles.css +1 -1
  146. package/framework/components/chui_result/result.js +26 -16
  147. package/framework/components/chui_scheduler/scheduler.js +57 -35
  148. package/framework/components/chui_scheduler/styles.css +6 -2
  149. package/framework/components/chui_segmented_control/segmented_control.js +27 -21
  150. package/framework/components/chui_settings/settings.js +122 -48
  151. package/framework/components/chui_shortcut_help/shortcut_help.js +55 -32
  152. package/framework/components/chui_sidebar_nav/sidebar_nav.js +33 -23
  153. package/framework/components/chui_skeleton/skeleton.js +29 -24
  154. package/framework/components/chui_slideshow/slideshow.js +60 -41
  155. package/framework/components/chui_slideshow/styles.css +18 -12
  156. package/framework/components/chui_spinner/spinner.js +8 -8
  157. package/framework/components/chui_spinner/styles.css +0 -1
  158. package/framework/components/chui_split_button/split_button.js +23 -18
  159. package/framework/components/chui_split_button/styles.css +1 -1
  160. package/framework/components/chui_splitter/splitter.js +35 -28
  161. package/framework/components/chui_statistic/statistic.js +65 -38
  162. package/framework/components/chui_status_bar/status_bar.js +11 -9
  163. package/framework/components/chui_stepper/stepper.js +27 -22
  164. package/framework/components/chui_sticky_bar/sticky_bar.js +9 -4
  165. package/framework/components/chui_sticky_bar/styles.css +3 -1
  166. package/framework/components/chui_tabs/chui_tabs.js +28 -22
  167. package/framework/components/chui_tabs/styles.css +3 -3
  168. package/framework/components/chui_text_editor/styles.css +20 -19
  169. package/framework/components/chui_text_editor/text_editor.js +85 -61
  170. package/framework/components/chui_text_editor/text_editor_panel.js +346 -284
  171. package/framework/components/chui_theme_toggle/theme_toggle.js +27 -22
  172. package/framework/components/chui_timeline/timeline.js +14 -12
  173. package/framework/components/chui_toast_queue/toast_queue.js +52 -46
  174. package/framework/components/chui_toolbar/toolbar.js +20 -13
  175. package/framework/components/chui_tooltip/tooltip.js +37 -24
  176. package/framework/components/chui_tour/styles.css +8 -3
  177. package/framework/components/chui_tour/tour.js +61 -27
  178. package/framework/components/chui_transfer/styles.css +2 -1
  179. package/framework/components/chui_transfer/transfer.js +75 -42
  180. package/framework/components/chui_tree_table/tree_table.js +43 -29
  181. package/framework/components/chui_tree_view/styles.css +4 -2
  182. package/framework/components/chui_tree_view/tree_view.js +142 -99
  183. package/framework/components/chui_watermark/watermark.js +24 -16
  184. package/framework/components/chui_webview/styles.css +2 -2
  185. package/framework/components/chui_webview/webview.js +62 -50
  186. package/framework/components/telegram_bot/chui_telegram_bot.js +71 -64
  187. package/framework/modules/chui_a11y/chui_a11y.js +77 -46
  188. package/framework/modules/chui_animations/animations.js +42 -42
  189. package/framework/modules/chui_animations/styles.css +1 -1
  190. package/framework/modules/chui_bridge/preload.js +56 -26
  191. package/framework/modules/chui_functions.js +52 -50
  192. package/framework/modules/chui_highlight/chui_highlight.js +25 -22
  193. package/framework/modules/chui_i18n/chui_i18n.js +9 -7
  194. package/framework/modules/chui_i18n/locales/a11y.js +5 -5
  195. package/framework/modules/chui_i18n/locales/app_layout.js +5 -5
  196. package/framework/modules/chui_i18n/locales/calendar.js +3 -3
  197. package/framework/modules/chui_i18n/locales/common.js +3 -3
  198. package/framework/modules/chui_i18n/locales/data.js +36 -26
  199. package/framework/modules/chui_i18n/locales/editors.js +40 -13
  200. package/framework/modules/chui_i18n/locales/feedback.js +3 -3
  201. package/framework/modules/chui_i18n/locales/forms.js +8 -8
  202. package/framework/modules/chui_i18n/locales/graphics.js +8 -8
  203. package/framework/modules/chui_i18n/locales/media.js +4 -4
  204. package/framework/modules/chui_i18n/locales/navigation.js +8 -8
  205. package/framework/modules/chui_i18n/locales/validate.js +3 -3
  206. package/framework/modules/chui_json/chui_json.js +9 -9
  207. package/framework/modules/chui_layout/chui_layout.js +12 -10
  208. package/framework/modules/chui_logger/chui_logger.js +29 -25
  209. package/framework/modules/chui_page/page.js +33 -27
  210. package/framework/modules/chui_page/styles.css +3 -26
  211. package/framework/modules/chui_qr/chui_qr.js +158 -67
  212. package/framework/modules/chui_scrollbar/chui_scrollbar.js +35 -24
  213. package/framework/modules/chui_scrollbar/styles.css +3 -1
  214. package/framework/modules/chui_services/chui_channels.js +76 -11
  215. package/framework/modules/chui_services/chui_services.js +39 -31
  216. package/framework/modules/chui_services/desktop.js +149 -30
  217. package/framework/modules/chui_sortable/chui_sortable.js +17 -12
  218. package/framework/modules/chui_validate/chui_validate.js +7 -4
  219. package/framework/tray_bar/chui_menu_items.js +136 -46
  220. package/index.d.ts +4814 -0
  221. package/index.js +449 -334
  222. package/package.json +79 -68
@@ -1,4 +1,4 @@
1
- const {I18n} = require("../../modules/chui_i18n/chui_i18n");
1
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
2
2
 
3
3
  class Calendar {
4
4
  constructor(year, month) {
@@ -11,14 +11,16 @@ class Calendar {
11
11
  new Array(7),
12
12
  new Array(7),
13
13
  new Array(7),
14
- new Array(7)
14
+ new Array(7),
15
15
  ];
16
16
 
17
17
  // Названия дней недели берёт локаль текущего языка (воскресенье — 0):
18
18
  // семь подряд идущих дней месяца покрывают все дни недели
19
19
  for (let day = 0; day < 7; day++) {
20
20
  const sample = new Date(this.year, this.month, day + 1);
21
- this.calendar[0][sample.getDay()] = sample.toLocaleString(I18n.getLocale(), { weekday: 'short' }).toUpperCase();
21
+ this.calendar[0][sample.getDay()] = sample
22
+ .toLocaleString(I18n.getLocale(), { weekday: "short" })
23
+ .toUpperCase();
22
24
  }
23
25
 
24
26
  this.list = [];
@@ -37,11 +39,11 @@ class Calendar {
37
39
  while (this.date.getMonth() === this.month) {
38
40
  let dayToPush = this.date;
39
41
  let days = [];
40
- days.push(dayToPush.toLocaleString(I18n.getLocale(), {day: 'numeric'}));
41
- days.push(dayToPush.toLocaleString(I18n.getLocale(), {weekday: 'short'}).toUpperCase());
42
- days.push(dayToPush.toLocaleString(I18n.getLocale(), {month: 'long'}).toUpperCase());
42
+ days.push(dayToPush.toLocaleString(I18n.getLocale(), { day: "numeric" }));
43
+ days.push(dayToPush.toLocaleString(I18n.getLocale(), { weekday: "short" }).toUpperCase());
44
+ days.push(dayToPush.toLocaleString(I18n.getLocale(), { month: "long" }).toUpperCase());
43
45
  this.date.setDate(this.date.getDate() + 1);
44
- this.list.push(days)
46
+ this.list.push(days);
45
47
  }
46
48
  let index = 1;
47
49
  for (let day of this.list) {
@@ -60,10 +62,10 @@ class Calendar {
60
62
  return new Date();
61
63
  }
62
64
  getMonthName() {
63
- return new Date(this.year, this.month).toLocaleString(I18n.getLocale(), {month: 'long'}).toUpperCase();
65
+ return new Date(this.year, this.month).toLocaleString(I18n.getLocale(), { month: "long" }).toUpperCase();
64
66
  }
65
67
  getDayName() {
66
- return new Date(this.year, this.month).toLocaleString(I18n.getLocale(), { weekday: 'long' }).toUpperCase();
68
+ return new Date(this.year, this.month).toLocaleString(I18n.getLocale(), { weekday: "long" }).toUpperCase();
67
69
  }
68
70
  getDate() {
69
71
  return new Date(this.year, this.month).getDate();
@@ -79,4 +81,4 @@ class Calendar {
79
81
  }
80
82
  }
81
83
 
82
- exports.Calendar = Calendar
84
+ exports.Calendar = Calendar;
@@ -1,5 +1,5 @@
1
- const {Icon} = require("../chui_icons/icons");
2
- const {optionOr} = require("../../modules/chui_functions");
1
+ const { Icon } = require("../chui_icons/icons");
2
+ const { optionOr } = require("../../modules/chui_functions");
3
3
 
4
4
  class Card {
5
5
  #chui_card = document.createElement("chui_card");
@@ -9,17 +9,19 @@ class Card {
9
9
  #title;
10
10
  #description;
11
11
  #body = document.createElement("card_body");
12
- constructor(options = {
13
- id: String(),
14
- title: String(),
15
- description: String(),
16
- icon: String(),
17
- width: String(),
18
- height: String(),
19
- style: String(),
20
- components: []
21
- }) {
22
- require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", 'chUiJS_Card');
12
+ constructor(
13
+ options = {
14
+ id: String(),
15
+ title: String(),
16
+ description: String(),
17
+ icon: String(),
18
+ width: String(),
19
+ height: String(),
20
+ style: String(),
21
+ components: [],
22
+ }
23
+ ) {
24
+ require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_Card");
23
25
  if (options.id !== undefined) this.#chui_card.id = options.id;
24
26
  const style = optionOr(options.style, undefined);
25
27
  if (style !== undefined) this.#chui_card.classList.add(style);
@@ -32,19 +34,33 @@ class Card {
32
34
  if (options.components !== undefined) this.add(...options.components);
33
35
  }
34
36
  // GET
35
- getId() { return this.#chui_card.id; }
36
- getTitle() { return this.#title === undefined ? "" : this.#title.innerText; }
37
- getDescription() { return this.#description === undefined ? "" : this.#description.innerText; }
38
- getBody() { return this.#body; }
37
+ getId() {
38
+ return this.#chui_card.id;
39
+ }
40
+ getTitle() {
41
+ return this.#title === undefined ? "" : this.#title.innerText;
42
+ }
43
+ getDescription() {
44
+ return this.#description === undefined ? "" : this.#description.innerText;
45
+ }
46
+ getBody() {
47
+ return this.#body;
48
+ }
39
49
  // SET
40
- setId(id = String()) { this.#chui_card.id = id; }
50
+ setId(id = String()) {
51
+ this.#chui_card.id = id;
52
+ }
41
53
  // Пустая строка — «не задана»: `classList.add("")` бросает исключение
42
54
  setStyle(style = String()) {
43
55
  const known = optionOr(style, undefined);
44
56
  if (known !== undefined) this.#chui_card.classList.add(known);
45
57
  }
46
- setWidth(width = String()) { this.#chui_card.style.width = width; }
47
- setHeight(height = String()) { this.#chui_card.style.height = height; }
58
+ setWidth(width = String()) {
59
+ this.#chui_card.style.width = width;
60
+ }
61
+ setHeight(height = String()) {
62
+ this.#chui_card.style.height = height;
63
+ }
48
64
  setIcon(icon = String()) {
49
65
  if (this.#icon === undefined) {
50
66
  this.#icon = document.createElement("card_icon");
@@ -70,7 +86,9 @@ class Card {
70
86
  add(...components) {
71
87
  for (let component of components) this.#body.appendChild(component.set());
72
88
  }
73
- clear() { this.#body.innerHTML = ""; }
89
+ clear() {
90
+ this.#body.innerHTML = "";
91
+ }
74
92
  // Шапка создаётся при первом обращении и всегда стоит выше тела
75
93
  #headNode() {
76
94
  if (this.#head === undefined) {
@@ -87,7 +105,9 @@ class Card {
87
105
  return this.#titles;
88
106
  }
89
107
  // RENDER
90
- set() { return this.#chui_card; }
108
+ set() {
109
+ return this.#chui_card;
110
+ }
91
111
  }
92
112
 
93
- exports.Card = Card
113
+ exports.Card = Card;
@@ -1,14 +1,14 @@
1
- const { setStyles, markdownToHtml, optionOr } = require('../../modules/chui_functions');
2
- const { Avatar } = require('../chui_avatar/avatar');
3
- const { Icon, Icons } = require('../chui_icons/icons');
4
- const { I18n } = require('../../modules/chui_i18n/chui_i18n');
1
+ const { setStyles, markdownToHtml, optionOr } = require("../../modules/chui_functions");
2
+ const { Avatar } = require("../chui_avatar/avatar");
3
+ const { Icon, Icons } = require("../chui_icons/icons");
4
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
5
5
 
6
6
  /** Значки состояния отправленного сообщения: в пути, доставлено, прочитано, ошибка */
7
7
  const STATUS_ICONS = {
8
8
  sending: Icons.ACTIONS.SCHEDULE,
9
9
  sent: Icons.NAVIGATION.CHECK,
10
10
  read: Icons.ACTIONS.DONE_ALL,
11
- failed: Icons.ALERT.ERROR_OUTLINE
11
+ failed: Icons.ALERT.ERROR_OUTLINE,
12
12
  };
13
13
  /** Прокрутка считается «у нижнего края», если до него осталось меньше этого, px */
14
14
  const NEAR_BOTTOM = 80;
@@ -63,7 +63,7 @@ class Chat {
63
63
  SENDING: "sending",
64
64
  SENT: "sent",
65
65
  READ: "read",
66
- FAILED: "failed"
66
+ FAILED: "failed",
67
67
  };
68
68
  static #counter = 0;
69
69
 
@@ -94,12 +94,24 @@ class Chat {
94
94
  #last_date = undefined;
95
95
  #last_group = undefined;
96
96
 
97
- constructor(options = {
98
- id: String(), title: String(), subtitle: String(), messages: [], own: String(),
99
- placeholder: String(), sendText: String(), sendLabel: String(), composer: Boolean(),
100
- height: String(), width: String(), dateSeparators: Boolean(),
101
- onSend: undefined, onMessageClick: undefined
102
- }) {
97
+ constructor(
98
+ options = {
99
+ id: String(),
100
+ title: String(),
101
+ subtitle: String(),
102
+ messages: [],
103
+ own: String(),
104
+ placeholder: String(),
105
+ sendText: String(),
106
+ sendLabel: String(),
107
+ composer: Boolean(),
108
+ height: String(),
109
+ width: String(),
110
+ dateSeparators: Boolean(),
111
+ onSend: undefined,
112
+ onMessageClick: undefined,
113
+ }
114
+ ) {
103
115
  setStyles(__dirname + "/styles.css", "chUiJS_Chat");
104
116
  Chat.#counter += 1;
105
117
  this.#id = options.id === undefined ? `chui_chat_${Chat.#counter}` : options.id;
@@ -130,7 +142,8 @@ class Chat {
130
142
  this.#composer.setAttribute("aria-label", I18n.t("feedback.chatComposer"));
131
143
  this.#input.className = "chat_input";
132
144
  this.#input.rows = 1;
133
- this.#input.placeholder = this.#placeholder === undefined ? I18n.t("feedback.chatPlaceholder") : this.#placeholder;
145
+ this.#input.placeholder =
146
+ this.#placeholder === undefined ? I18n.t("feedback.chatPlaceholder") : this.#placeholder;
134
147
  this.#input.setAttribute("aria-label", I18n.t("feedback.chatComposer"));
135
148
  this.#send_button.type = "button";
136
149
  this.#send_button.className = "chat_send";
@@ -162,16 +175,32 @@ class Chat {
162
175
  }
163
176
 
164
177
  // GET
165
- getId() { return this.#id; }
166
- getTitle() { return this.#title.innerText; }
167
- getSubtitle() { return this.#subtitle.innerText; }
178
+ getId() {
179
+ return this.#id;
180
+ }
181
+ getTitle() {
182
+ return this.#title.innerText;
183
+ }
184
+ getSubtitle() {
185
+ return this.#subtitle.innerText;
186
+ }
168
187
  /** Текст в поле ввода — то, что ещё не отправлено */
169
- getValue() { return this.#input.value; }
188
+ getValue() {
189
+ return this.#input.value;
190
+ }
170
191
  /** Копии сообщений: правка копии не меняет журнал */
171
- getMessages() { return this.#messages.map((message) => Object.assign({}, message)); }
172
- isTyping() { return this.#typing_name !== undefined; }
173
- isDisabled() { return this.#disabled; }
174
- getLog() { return this.#log; }
192
+ getMessages() {
193
+ return this.#messages.map((message) => Object.assign({}, message));
194
+ }
195
+ isTyping() {
196
+ return this.#typing_name !== undefined;
197
+ }
198
+ isDisabled() {
199
+ return this.#disabled;
200
+ }
201
+ getLog() {
202
+ return this.#log;
203
+ }
175
204
 
176
205
  // SET
177
206
  setTitle(text = String()) {
@@ -212,7 +241,9 @@ class Chat {
212
241
  this.#send_listeners.push(listener);
213
242
  return this;
214
243
  }
215
- set() { return this.#root; }
244
+ set() {
245
+ return this.#root;
246
+ }
216
247
 
217
248
  // СООБЩЕНИЯ
218
249
  /** Полная замена списка: журнал собирается заново, группы схлопываются по автору и дню */
@@ -253,13 +284,14 @@ class Chat {
253
284
  setTyping(name = undefined) {
254
285
  this.#typing_name = name;
255
286
  this.#typing.hidden = name === undefined;
256
- this.#typing.innerText = name === undefined ? "" : I18n.t("feedback.chatTyping", {name: name});
287
+ this.#typing.innerText = name === undefined ? "" : I18n.t("feedback.chatTyping", { name: name });
257
288
  return this;
258
289
  }
259
290
  scrollToBottom(smooth = true) {
260
291
  // Плавная прокрутка — движение; при `prefers-reduced-motion` она идёт сразу
261
292
  const behavior = smooth && this.#reducedMotion() === false ? "smooth" : "auto";
262
- if (typeof this.#log.scrollTo === "function") this.#log.scrollTo({top: this.#log.scrollHeight, behavior: behavior});
293
+ if (typeof this.#log.scrollTo === "function")
294
+ this.#log.scrollTo({ top: this.#log.scrollHeight, behavior: behavior });
263
295
  else this.#log.scrollTop = this.#log.scrollHeight;
264
296
  return this;
265
297
  }
@@ -276,7 +308,7 @@ class Chat {
276
308
  author: this.#own,
277
309
  own: true,
278
310
  time: Date.now(),
279
- status: Chat.STATUS.SENDING
311
+ status: Chat.STATUS.SENDING,
280
312
  });
281
313
  this.#input.value = "";
282
314
  this.#syncSendState();
@@ -344,7 +376,11 @@ class Chat {
344
376
  /** Группа для сообщения: та же, если автор и день совпадают, иначе новая */
345
377
  #groupFor(message) {
346
378
  const author = this.#authorOf(message);
347
- if (this.#last_group !== undefined && this.#last_group.author === author && this.#last_group.day === this.#last_date) {
379
+ if (
380
+ this.#last_group !== undefined &&
381
+ this.#last_group.author === author &&
382
+ this.#last_group.day === this.#last_date
383
+ ) {
348
384
  return this.#last_group;
349
385
  }
350
386
  const node = document.createElement("chat_group");
@@ -356,14 +392,14 @@ class Chat {
356
392
  if (message.own !== true) {
357
393
  avatar = new Avatar({
358
394
  name: author,
359
- image: message.avatar === undefined ? undefined : {path: message.avatar},
395
+ image: message.avatar === undefined ? undefined : { path: message.avatar },
360
396
  size: Avatar.SIZE.SMALL,
361
- decorative: true
397
+ decorative: true,
362
398
  });
363
399
  node.prepend(avatar.set());
364
400
  }
365
401
  this.#log.appendChild(node);
366
- this.#last_group = {node: node, bubbles: bubbles, avatar: avatar, author: author, day: this.#last_date};
402
+ this.#last_group = { node: node, bubbles: bubbles, avatar: avatar, author: author, day: this.#last_date };
367
403
  return this.#last_group;
368
404
  }
369
405
  #bubble(message, first) {
@@ -418,7 +454,10 @@ class Chat {
418
454
  status.dataset.status = message.status;
419
455
  status.setAttribute("aria-label", this.#statusLabel(message.status));
420
456
  status.setAttribute("role", "img");
421
- status.innerHTML = new Icon(STATUS_ICONS[message.status] === undefined ? STATUS_ICONS.sent : STATUS_ICONS[message.status], "13px").getHTML();
457
+ status.innerHTML = new Icon(
458
+ STATUS_ICONS[message.status] === undefined ? STATUS_ICONS.sent : STATUS_ICONS[message.status],
459
+ "13px"
460
+ ).getHTML();
422
461
  meta.appendChild(status);
423
462
  }
424
463
  return meta;
@@ -442,10 +481,10 @@ class Chat {
442
481
  if (this.#dayKey(date) === this.#dayKey(now)) return I18n.t("common.today");
443
482
  const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1);
444
483
  if (this.#dayKey(date) === this.#dayKey(yesterday)) return I18n.t("common.yesterday");
445
- return new Intl.DateTimeFormat(I18n.getLocale(), {day: "numeric", month: "long"}).format(date);
484
+ return new Intl.DateTimeFormat(I18n.getLocale(), { day: "numeric", month: "long" }).format(date);
446
485
  }
447
486
  #timeLabel(date) {
448
- return new Intl.DateTimeFormat(I18n.getLocale(), {hour: "2-digit", minute: "2-digit"}).format(date);
487
+ return new Intl.DateTimeFormat(I18n.getLocale(), { hour: "2-digit", minute: "2-digit" }).format(date);
449
488
  }
450
489
 
451
490
  // === ОБРАБОТЧИКИ ===
@@ -464,7 +503,7 @@ class Chat {
464
503
  };
465
504
  }
466
505
 
467
- exports.Chat = Chat
506
+ exports.Chat = Chat;
468
507
 
469
508
  // Описание сообщения собирает фабрика — как у ContextMenu и SplitButton
470
509
  Chat.Message = (options = {}) => Object.assign({}, options);
@@ -1,7 +1,7 @@
1
- const {setStyles, optionOr} = require('../../modules/chui_functions');
2
- const {Icon, Icons} = require('../chui_icons/icons');
3
- const {Desktop} = require('../../modules/chui_services/desktop');
4
- const {I18n} = require('../../modules/chui_i18n/chui_i18n');
1
+ const { setStyles, optionOr } = require("../../modules/chui_functions");
2
+ const { Icon, Icons } = require("../chui_icons/icons");
3
+ const { Desktop } = require("../../modules/chui_services/desktop");
4
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
5
5
 
6
6
  /**
7
7
  * Панель истории буфера обмена: последние тексты, которые приложение кладло в буфер.
@@ -38,15 +38,17 @@ class ClipboardHistory {
38
38
  #unsubscribe = undefined;
39
39
  #bound = false;
40
40
 
41
- constructor(options = {
42
- id: String(),
43
- title: String(),
44
- emptyText: String(),
45
- truncate: Number(),
46
- label: String(),
47
- showClear: Boolean(),
48
- onChange: undefined
49
- }) {
41
+ constructor(
42
+ options = {
43
+ id: String(),
44
+ title: String(),
45
+ emptyText: String(),
46
+ truncate: Number(),
47
+ label: String(),
48
+ showClear: Boolean(),
49
+ onChange: undefined,
50
+ }
51
+ ) {
50
52
  setStyles(__dirname + "/styles.css", "chUiJS_ClipboardHistory");
51
53
  ClipboardHistory.#counter += 1;
52
54
  this.#id = options.id === undefined ? `chui_clipboard_history_${ClipboardHistory.#counter}` : options.id;
@@ -81,9 +83,12 @@ class ClipboardHistory {
81
83
  this.#render(items);
82
84
  });
83
85
  this.#bound = true;
84
- Desktop.clipboard.history.list().then((items) => {
85
- if (this.#bound) this.#render(items);
86
- }).catch(() => {});
86
+ Desktop.clipboard.history
87
+ .list()
88
+ .then((items) => {
89
+ if (this.#bound) this.#render(items);
90
+ })
91
+ .catch(() => {});
87
92
  }
88
93
 
89
94
  // GET
@@ -141,7 +146,9 @@ class ClipboardHistory {
141
146
  const text = this.#items[index];
142
147
  if (text === undefined) return Promise.resolve(this.getItems());
143
148
  return Desktop.clipboard.history.copy(text).then((items) => {
144
- this.#announce(I18n.t("graphics.clipboardCopied", {value: ClipboardHistory.#short(text, this.#truncate)}));
149
+ this.#announce(
150
+ I18n.t("graphics.clipboardCopied", { value: ClipboardHistory.#short(text, this.#truncate) })
151
+ );
145
152
  return items;
146
153
  });
147
154
  }
@@ -198,7 +205,7 @@ class ClipboardHistory {
198
205
  copy.type = "button";
199
206
  copy.className = "clipboard_history_text";
200
207
  copy.dataset.action = "copy";
201
- copy.setAttribute("aria-label", I18n.t("graphics.clipboardCopy", {value: label}));
208
+ copy.setAttribute("aria-label", I18n.t("graphics.clipboardCopy", { value: label }));
202
209
  copy.title = text;
203
210
  const icon = document.createElement("clipboard_history_icon");
204
211
  icon.innerHTML = new Icon(Icons.CONTENT.CONTENT_COPY, "16px").getHTML();
@@ -211,7 +218,7 @@ class ClipboardHistory {
211
218
  remove.type = "button";
212
219
  remove.className = "clipboard_history_remove";
213
220
  remove.dataset.action = "remove";
214
- remove.setAttribute("aria-label", I18n.t("graphics.clipboardRemove", {value: label}));
221
+ remove.setAttribute("aria-label", I18n.t("graphics.clipboardRemove", { value: label }));
215
222
  remove.innerHTML = new Icon(Icons.ACTIONS.DELETE, "16px").getHTML();
216
223
  item.appendChild(copy);
217
224
  item.appendChild(remove);
@@ -228,8 +235,10 @@ class ClipboardHistory {
228
235
  };
229
236
 
230
237
  #onClear = () => {
231
- this.clear().then(() => this.#announce(I18n.t("graphics.clipboardCleared"))).catch(() => {});
238
+ this.clear()
239
+ .then(() => this.#announce(I18n.t("graphics.clipboardCleared")))
240
+ .catch(() => {});
232
241
  };
233
242
  }
234
243
 
235
- exports.ClipboardHistory = ClipboardHistory
244
+ exports.ClipboardHistory = ClipboardHistory;
@@ -65,7 +65,8 @@ clipboard_history_item {
65
65
  display: flex;
66
66
  align-items: center;
67
67
  gap: 6px;
68
- padding-block: 2px 2px; padding-inline: 4px var(--main_padding);
68
+ padding-block: 2px 2px;
69
+ padding-inline: 4px var(--main_padding);
69
70
  }
70
71
 
71
72
  clipboard_history_item + clipboard_history_item {
@@ -93,7 +94,8 @@ button.clipboard_history_text:hover {
93
94
  background: var(--element_background_hover);
94
95
  }
95
96
 
96
- button.clipboard_history_text:focus-visible, button.clipboard_history_remove:focus-visible {
97
+ button.clipboard_history_text:focus-visible,
98
+ button.clipboard_history_remove:focus-visible {
97
99
  outline: var(--focus_outline);
98
100
  outline-offset: var(--focus_outline_offset);
99
101
  }
@@ -1,7 +1,7 @@
1
1
  class CodeBlock {
2
2
  #chui_code = document.createElement(`code`);
3
3
  constructor(text = String(), options = { textAlign: String(), wordBreak: String(), width: String() }) {
4
- require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_code');
4
+ require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_code");
5
5
  this.#chui_code.innerText = text;
6
6
  this.#chui_code.classList.add("chui_code");
7
7
  if (options.textAlign !== undefined) this.#chui_code.style.textAlign = options.textAlign;
@@ -16,4 +16,4 @@ class CodeBlock {
16
16
  }
17
17
  }
18
18
 
19
- exports.CodeBlock = CodeBlock
19
+ exports.CodeBlock = CodeBlock;
@@ -11,7 +11,7 @@
11
11
  background: var(--element_background_2);
12
12
  border: 1px solid var(--border_color);
13
13
  border-radius: var(--border_radius);
14
- font-family: 'chui_mono', monospace;
14
+ font-family: "chui_mono", monospace;
15
15
  font-size: var(--font_default_size);
16
16
  font-weight: 400;
17
17
  line-height: 1.5;
@@ -19,4 +19,4 @@
19
19
  white-space: pre-wrap;
20
20
  /* Длинная строка прокручивается внутри блока, а не раздвигает карточку */
21
21
  overflow-x: auto;
22
- }
22
+ }
@@ -1,6 +1,6 @@
1
- const {setStyles} = require('../../modules/chui_functions');
2
- const {highlight, escapeHtml} = require('../../modules/chui_highlight/chui_highlight');
3
- const {I18n} = require('../../modules/chui_i18n/chui_i18n');
1
+ const { setStyles } = require("../../modules/chui_functions");
2
+ const { highlight, escapeHtml } = require("../../modules/chui_highlight/chui_highlight");
3
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
4
4
 
5
5
  /**
6
6
  * Редактор кода: поле ввода с подсветкой синтаксиса и нумерацией строк.
@@ -38,7 +38,7 @@ class CodeEditor {
38
38
  JAVASCRIPT: "javascript",
39
39
  JSON: "json",
40
40
  CSS: "css",
41
- PLAIN: "plain"
41
+ PLAIN: "plain",
42
42
  };
43
43
  static #counter = 0;
44
44
 
@@ -59,22 +59,24 @@ class CodeEditor {
59
59
  #on_change = undefined;
60
60
  #on_save = undefined;
61
61
 
62
- constructor(options = {
63
- id: String(),
64
- value: String(),
65
- language: String(),
66
- title: String(),
67
- label: String(),
68
- placeholder: String(),
69
- height: String(),
70
- wide: Boolean(),
71
- lineNumbers: Boolean(),
72
- readOnly: Boolean(),
73
- tabSize: Number(),
74
- onChange: undefined,
75
- onSave: undefined
76
- }) {
77
- require('../../modules/chui_fonts').installMono();
62
+ constructor(
63
+ options = {
64
+ id: String(),
65
+ value: String(),
66
+ language: String(),
67
+ title: String(),
68
+ label: String(),
69
+ placeholder: String(),
70
+ height: String(),
71
+ wide: Boolean(),
72
+ lineNumbers: Boolean(),
73
+ readOnly: Boolean(),
74
+ tabSize: Number(),
75
+ onChange: undefined,
76
+ onSave: undefined,
77
+ }
78
+ ) {
79
+ require("../../modules/chui_fonts").installMono();
78
80
  setStyles(__dirname + "/styles.css", "chUiJS_CodeEditor");
79
81
  CodeEditor.#counter += 1;
80
82
  this.#id = options.id === undefined ? `chui_code_editor_${CodeEditor.#counter}` : options.id;
@@ -232,7 +234,10 @@ class CodeEditor {
232
234
  // === ВНУТРЕННЕЕ ===
233
235
  #applyLabel() {
234
236
  const language = this.#language === CodeEditor.LANGUAGE.PLAIN ? I18n.t("editor.noHighlight") : this.#language;
235
- this.#input.setAttribute("aria-label", this.#label === undefined ? I18n.t("editor.codeEditor", {language: language}) : this.#label);
237
+ this.#input.setAttribute(
238
+ "aria-label",
239
+ this.#label === undefined ? I18n.t("editor.codeEditor", { language: language }) : this.#label
240
+ );
236
241
  }
237
242
 
238
243
  /** Значение + перерисовка подсветки и нумерации; `caret` — куда вернуть каретку */
@@ -255,7 +260,9 @@ class CodeEditor {
255
260
  this.#code.innerHTML = highlight(value, this.#language);
256
261
  }
257
262
  const lines = value.split("\n").length;
258
- this.#lines.innerText = this.#line_numbers ? Array.from({length: lines}, (_, index) => index + 1).join("\n") : "";
263
+ this.#lines.innerText = this.#line_numbers
264
+ ? Array.from({ length: lines }, (_, index) => index + 1).join("\n")
265
+ : "";
259
266
  this.#syncScroll();
260
267
  }
261
268
 
@@ -311,8 +318,14 @@ class CodeEditor {
311
318
  }
312
319
  const from = value.lastIndexOf("\n", start - 1) + 1;
313
320
  const block = value.slice(from, end);
314
- const shifted = block.split("\n").map((line) => `\t${line}`).join("\n");
315
- this.#applyValue(`${value.slice(0, from)}${shifted}${value.slice(end)}`, start + 1 + (shifted.length - block.length));
321
+ const shifted = block
322
+ .split("\n")
323
+ .map((line) => `\t${line}`)
324
+ .join("\n");
325
+ this.#applyValue(
326
+ `${value.slice(0, from)}${shifted}${value.slice(end)}`,
327
+ start + 1 + (shifted.length - block.length)
328
+ );
316
329
  }
317
330
 
318
331
  /** Shift+Tab: убрать один отступ у выделенных строк */
@@ -323,14 +336,17 @@ class CodeEditor {
323
336
  const from = value.lastIndexOf("\n", start - 1) + 1;
324
337
  const block = value.slice(from, end);
325
338
  let removed = 0;
326
- const shifted = block.split("\n").map((line) => {
327
- const match = line.match(/^[ \t]/);
328
- if (match === null) return line;
329
- removed += 1;
330
- return line.slice(1);
331
- }).join("\n");
339
+ const shifted = block
340
+ .split("\n")
341
+ .map((line) => {
342
+ const match = line.match(/^[ \t]/);
343
+ if (match === null) return line;
344
+ removed += 1;
345
+ return line.slice(1);
346
+ })
347
+ .join("\n");
332
348
  this.#applyValue(`${value.slice(0, from)}${shifted}${value.slice(end)}`, Math.max(from, start - removed));
333
349
  }
334
350
  }
335
351
 
336
- exports.CodeEditor = CodeEditor
352
+ exports.CodeEditor = CodeEditor;
@@ -11,7 +11,7 @@ chui_code_editor {
11
11
  background: var(--element_background_2);
12
12
  border: 1px solid var(--border_color);
13
13
  border-radius: var(--border_radius);
14
- font-family: 'chui_mono', monospace;
14
+ font-family: "chui_mono", monospace;
15
15
  font-size: var(--font_default_size);
16
16
  overflow: hidden;
17
17
  }
@@ -51,7 +51,8 @@ code_editor_lines {
51
51
  bottom: 0;
52
52
  width: var(--code_editor_gutter);
53
53
  box-sizing: border-box;
54
- padding-block: 8px 8px; padding-inline: 8px 6px;
54
+ padding-block: 8px 8px;
55
+ padding-inline: 8px 6px;
55
56
  overflow: hidden;
56
57
  text-align: end;
57
58
  white-space: pre;