chuijs 4.0.2 → 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 (221) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +43 -644
  3. package/framework/appLayout/default/chui_app_layout.js +308 -260
  4. package/framework/appLayout/default/global_style.css +85 -48
  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 +36 -25
  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_qr/chui_qr.js +158 -67
  211. package/framework/modules/chui_scrollbar/chui_scrollbar.js +35 -24
  212. package/framework/modules/chui_scrollbar/styles.css +3 -1
  213. package/framework/modules/chui_services/chui_channels.js +27 -13
  214. package/framework/modules/chui_services/chui_services.js +39 -31
  215. package/framework/modules/chui_services/desktop.js +32 -31
  216. package/framework/modules/chui_sortable/chui_sortable.js +17 -12
  217. package/framework/modules/chui_validate/chui_validate.js +7 -4
  218. package/framework/tray_bar/chui_menu_items.js +136 -46
  219. package/index.d.ts +4814 -0
  220. package/index.js +385 -292
  221. package/package.json +79 -68
@@ -1,5 +1,5 @@
1
- const {setStyles, optionOr} = require('../../modules/chui_functions');
2
- const {I18n} = require('../../modules/chui_i18n/chui_i18n');
1
+ const { setStyles, optionOr } = require("../../modules/chui_functions");
2
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
3
3
 
4
4
  /**
5
5
  * Плейсхолдер загрузки (skeleton): серые фигуры на месте будущего содержимого.
@@ -20,12 +20,12 @@ class Skeleton {
20
20
  TEXT: "text",
21
21
  TITLE: "title",
22
22
  CIRCLE: "circle",
23
- RECT: "rect"
23
+ RECT: "rect",
24
24
  };
25
25
  static ANIMATION = {
26
26
  SHIMMER: "shimmer",
27
27
  PULSE: "pulse",
28
- NONE: "none"
28
+ NONE: "none",
29
29
  };
30
30
  /** Ширина последней строки многострочного текста — строки не должны быть равными */
31
31
  static LAST_LINE_WIDTH = "60%";
@@ -37,19 +37,21 @@ class Skeleton {
37
37
  #id = undefined;
38
38
  #animation = Skeleton.ANIMATION.SHIMMER;
39
39
 
40
- constructor(options = {
41
- id: String(),
42
- shape: String(),
43
- lines: Number(),
44
- width: String(),
45
- height: String(),
46
- radius: String(),
47
- gap: String(),
48
- animation: String(),
49
- label: String(),
50
- style: String(),
51
- shapes: []
52
- }) {
40
+ constructor(
41
+ options = {
42
+ id: String(),
43
+ shape: String(),
44
+ lines: Number(),
45
+ width: String(),
46
+ height: String(),
47
+ radius: String(),
48
+ gap: String(),
49
+ animation: String(),
50
+ label: String(),
51
+ style: String(),
52
+ shapes: [],
53
+ }
54
+ ) {
53
55
  setStyles(__dirname + "/styles.css", "chUiJS_Skeleton");
54
56
  Skeleton.#counter += 1;
55
57
  this.#id = options.id === undefined ? `chui_skeleton_${Skeleton.#counter}` : options.id;
@@ -71,17 +73,20 @@ class Skeleton {
71
73
  }
72
74
  const shape = options.shape === undefined ? Skeleton.SHAPE.TEXT : options.shape;
73
75
  if (shape !== Skeleton.SHAPE.TEXT && shape !== Skeleton.SHAPE.TITLE) {
74
- this.addShape({shape, width: options.width, height: options.height, radius: options.radius});
76
+ this.addShape({ shape, width: options.width, height: options.height, radius: options.radius });
75
77
  return;
76
78
  }
77
79
  const lines = options.lines === undefined ? 1 : options.lines;
78
80
  for (let line = 1; line <= lines; line++) {
79
81
  // Последняя строка многострочного текста короче — так скелет читается как текст
80
82
  const isLast = line === lines;
81
- const width = options.width !== undefined
82
- ? options.width
83
- : (isLast && lines > 1 ? Skeleton.LAST_LINE_WIDTH : undefined);
84
- this.addShape({shape, width, height: options.height, radius: options.radius});
83
+ const width =
84
+ options.width !== undefined
85
+ ? options.width
86
+ : isLast && lines > 1
87
+ ? Skeleton.LAST_LINE_WIDTH
88
+ : undefined;
89
+ this.addShape({ shape, width, height: options.height, radius: options.radius });
85
90
  }
86
91
  }
87
92
 
@@ -140,7 +145,7 @@ class Skeleton {
140
145
 
141
146
  // ФИГУРЫ
142
147
  /** Добавляет фигуру: shape, width, height, radius, style */
143
- addShape(options = {shape: String(), width: String(), height: String(), radius: String(), style: String()}) {
148
+ addShape(options = { shape: String(), width: String(), height: String(), radius: String(), style: String() }) {
144
149
  const shape = options.shape === undefined ? Skeleton.SHAPE.TEXT : options.shape;
145
150
  const element = document.createElement("skeleton_shape");
146
151
  element.classList.add(`skeleton_${shape}`);
@@ -174,4 +179,4 @@ class Skeleton {
174
179
  }
175
180
  }
176
181
 
177
- exports.Skeleton = Skeleton
182
+ exports.Skeleton = Skeleton;
@@ -1,26 +1,26 @@
1
- const {Icon, Icons} = require("../chui_icons/icons");
2
- const {optionOr} = require("../../modules/chui_functions");
3
- const {Animation} = require("../../modules/chui_animations/animations");
4
- const {makeKeyboardButton} = require("../../modules/chui_a11y/chui_a11y");
5
- const {I18n} = require("../../modules/chui_i18n/chui_i18n");
1
+ const { Icon, Icons } = require("../chui_icons/icons");
2
+ const { optionOr } = require("../../modules/chui_functions");
3
+ const { Animation } = require("../../modules/chui_animations/animations");
4
+ const { makeKeyboardButton } = require("../../modules/chui_a11y/chui_a11y");
5
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
6
6
 
7
7
  class SlideShow {
8
8
  #default_slide = 0;
9
- #chui_slides_main = document.createElement('chui_slides_main');
9
+ #chui_slides_main = document.createElement("chui_slides_main");
10
10
  //
11
- #chui_slides_list = document.createElement("chui_slides_list")
12
- #chui_next_slide = document.createElement('chui_next_slide');
13
- #chui_prev_slide = document.createElement('chui_prev_slide');
14
- #chui_slideshow_controls = document.createElement('chui_slideshow_controls');
15
- #chui_slideshow_dots = document.createElement('chui_slideshow_dots');
16
- #chui_slideshow_pause = document.createElement('chui_slideshow_pause');
11
+ #chui_slides_list = document.createElement("chui_slides_list");
12
+ #chui_next_slide = document.createElement("chui_next_slide");
13
+ #chui_prev_slide = document.createElement("chui_prev_slide");
14
+ #chui_slideshow_controls = document.createElement("chui_slideshow_controls");
15
+ #chui_slideshow_dots = document.createElement("chui_slideshow_dots");
16
+ #chui_slideshow_pause = document.createElement("chui_slideshow_pause");
17
17
  //
18
18
  #slides_list = undefined;
19
19
  #autoplay = undefined;
20
20
  #autoplay_timer = undefined;
21
21
  #user_paused = false;
22
22
  constructor(options = {}) {
23
- require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_SlideShow');
23
+ require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_SlideShow");
24
24
  // Частичный объект опций: у каждого поля своё значение по умолчанию
25
25
  const width = optionOr(options.width, undefined);
26
26
  const height = optionOr(options.height, undefined);
@@ -35,7 +35,10 @@ class SlideShow {
35
35
  // Частичный объект опций: у каждого поля своё значение по умолчанию. Без этого
36
36
  // `autoplay: {status: true}` без interval давал setInterval с NaN — слайды мелькали,
37
37
  // а `autoplay: true` вообще не включал прокрутку
38
- const autoplay = options.autoplay === undefined || options.autoplay === null || typeof options.autoplay !== "object" ? {} : options.autoplay;
38
+ const autoplay =
39
+ options.autoplay === undefined || options.autoplay === null || typeof options.autoplay !== "object"
40
+ ? {}
41
+ : options.autoplay;
39
42
  const interval = Number(autoplay.interval);
40
43
  this.#autoplay = {
41
44
  status: options.autoplay === true || autoplay.status === true,
@@ -50,8 +53,8 @@ class SlideShow {
50
53
  this.#chui_prev_slide.setAttribute("aria-label", I18n.t("feedback.previousSlide"));
51
54
  makeKeyboardButton(this.#chui_next_slide);
52
55
  makeKeyboardButton(this.#chui_prev_slide);
53
- this.#chui_next_slide.addEventListener("click", () => this.#changeSlide(1))
54
- this.#chui_prev_slide.addEventListener("click", () => this.#changeSlide(-1))
56
+ this.#chui_next_slide.addEventListener("click", () => this.#changeSlide(1));
57
+ this.#chui_prev_slide.addEventListener("click", () => this.#changeSlide(-1));
55
58
  this.#chui_slides_main.appendChild(this.#chui_slides_list);
56
59
  // Шевроны, а не изогнутые redo/undo: в круглой кнопке они читаются как «назад/вперёд».
57
60
  // Цвет не задаём — его берёт глиф из кнопки (`color: inherit` в styles.css), поэтому
@@ -85,14 +88,17 @@ class SlideShow {
85
88
  this.#changeSlide(event.key === "ArrowRight" ? 1 : -1);
86
89
  });
87
90
  //
88
- this.#renderSlide(true)
91
+ this.#renderSlide(true);
89
92
  //
90
93
  }
91
94
  #buildDots() {
92
95
  this.#slides_list.forEach((_, index) => {
93
96
  const dot = document.createElement("chui_slideshow_dot");
94
97
  dot.setAttribute("role", "button");
95
- dot.setAttribute("aria-label", I18n.t("feedback.slideOf", {index: index + 1, total: this.#slides_list.length}));
98
+ dot.setAttribute(
99
+ "aria-label",
100
+ I18n.t("feedback.slideOf", { index: index + 1, total: this.#slides_list.length })
101
+ );
96
102
  makeKeyboardButton(dot);
97
103
  dot.addEventListener("click", () => this.#goToSlide(index));
98
104
  this.#chui_slideshow_dots.appendChild(dot);
@@ -111,22 +117,27 @@ class SlideShow {
111
117
  #changeSlide(n = Number()) {
112
118
  let sum_slides = this.#slides_list.length;
113
119
  this.#default_slide = this.#default_slide + n;
114
- if (this.#default_slide > (sum_slides - 1)) this.#default_slide = 0;
120
+ if (this.#default_slide > sum_slides - 1) this.#default_slide = 0;
115
121
  if (this.#default_slide < 0) this.#default_slide = sum_slides - 1;
116
122
  this.#renderSlide();
117
123
  }
118
124
  #renderSlide(is_initial = false) {
119
- for (let child of this.#chui_slides_list.childNodes) { this.#chui_slides_list.removeChild(child); }
125
+ for (let child of this.#chui_slides_list.childNodes) {
126
+ this.#chui_slides_list.removeChild(child);
127
+ }
120
128
  let slide = this.#slides_list[this.#default_slide].set();
121
129
  slide.setAttribute("role", "group");
122
130
  slide.setAttribute("aria-roledescription", I18n.t("feedback.slide"));
123
- slide.setAttribute("aria-label", I18n.t("feedback.slideOf", {index: this.#default_slide + 1, total: this.#slides_list.length}));
124
- this.#chui_slides_list.appendChild(slide)
131
+ slide.setAttribute(
132
+ "aria-label",
133
+ I18n.t("feedback.slideOf", { index: this.#default_slide + 1, total: this.#slides_list.length })
134
+ );
135
+ this.#chui_slides_list.appendChild(slide);
125
136
  // Первый слайд показываем так же, как раньше (display: flex до анимации)
126
- if (is_initial) slide.style.display = 'flex';
127
- else slide.style.display = 'none';
128
- new Animation(slide).fadeIn()
129
- this.#syncIndicators()
137
+ if (is_initial) slide.style.display = "flex";
138
+ else slide.style.display = "none";
139
+ new Animation(slide).fadeIn();
140
+ this.#syncIndicators();
130
141
  }
131
142
  // === АВТОПРОКРУТКА ===
132
143
  #startAutoplay() {
@@ -145,13 +156,17 @@ class SlideShow {
145
156
  }
146
157
  #toggleAutoplay() {
147
158
  this.#user_paused = !this.#user_paused;
148
- if (this.#user_paused) this.#stopAutoplay(); else this.#startAutoplay();
159
+ if (this.#user_paused) this.#stopAutoplay();
160
+ else this.#startAutoplay();
149
161
  this.#updatePauseButton();
150
162
  }
151
163
  #updatePauseButton() {
152
164
  const icon = this.#user_paused ? Icons.AUDIO_VIDEO.PLAY_ARROW : Icons.AUDIO_VIDEO.PAUSE;
153
165
  this.#chui_slideshow_pause.innerHTML = new Icon(icon, "14pt", "var(--button_text_color)").getHTML();
154
- this.#chui_slideshow_pause.setAttribute("aria-label", this.#user_paused ? I18n.t("feedback.autoplayStart") : I18n.t("feedback.autoplayPause"));
166
+ this.#chui_slideshow_pause.setAttribute(
167
+ "aria-label",
168
+ this.#user_paused ? I18n.t("feedback.autoplayStart") : I18n.t("feedback.autoplayPause")
169
+ );
155
170
  this.#chui_slideshow_pause.setAttribute("aria-pressed", this.#user_paused ? "true" : "false");
156
171
  }
157
172
  /** Полное удаление: остановить автопрокрутку (остальные слушатели — на элементах компонента) */
@@ -163,19 +178,21 @@ class SlideShow {
163
178
  return this.#chui_slides_main;
164
179
  }
165
180
  static SLIDE(options = { width: String(), height: String(), components: [] }) {
166
- return new Slide(options)
181
+ return new Slide(options);
167
182
  }
168
183
  }
169
- exports.SlideShow = SlideShow
184
+ exports.SlideShow = SlideShow;
170
185
 
171
186
  class Slide {
172
- #chui_slide = document.createElement('chui_slide');
173
- #chui_slide_content = document.createElement('chui_slide_content');
174
- constructor(options = {
175
- size: { width: String(), height: String() },
176
- style: { direction: String(), wrap: String(), align: String(), justify: String() },
177
- components: []
178
- }) {
187
+ #chui_slide = document.createElement("chui_slide");
188
+ #chui_slide_content = document.createElement("chui_slide_content");
189
+ constructor(
190
+ options = {
191
+ size: { width: String(), height: String() },
192
+ style: { direction: String(), wrap: String(), align: String(), justify: String() },
193
+ components: [],
194
+ }
195
+ ) {
179
196
  // Частичный объект опций: `SLIDE({components})` падал на отсутствующем `size`
180
197
  const size = options.size === undefined ? {} : options.size;
181
198
  const style = options.style === undefined ? {} : options.style;
@@ -186,8 +203,10 @@ class Slide {
186
203
  if (style.wrap !== undefined) this.#chui_slide_content.style.flexWrap = style.wrap;
187
204
  if (style.align !== undefined) this.#chui_slide_content.style.alignItems = style.align;
188
205
  if (style.justify !== undefined) this.#chui_slide_content.style.justifyContent = style.justify;
189
- for (let child of components) this.#chui_slide_content.appendChild(child.set())
190
- this.#chui_slide.appendChild(this.#chui_slide_content)
206
+ for (let child of components) this.#chui_slide_content.appendChild(child.set());
207
+ this.#chui_slide.appendChild(this.#chui_slide_content);
191
208
  }
192
- set() { return this.#chui_slide }
193
- }
209
+ set() {
210
+ return this.#chui_slide;
211
+ }
212
+ }
@@ -12,7 +12,8 @@ chui_slides_main {
12
12
 
13
13
  /* Стрелки — круглые кнопки-стёкла на середине высоты: полоса во всю высоту читалась
14
14
  тяжёлой границей, а кнопка не спорит с содержимым слайда. Хит-зона 40px */
15
- chui_next_slide, chui_prev_slide {
15
+ chui_next_slide,
16
+ chui_prev_slide {
16
17
  cursor: pointer;
17
18
  position: absolute;
18
19
  top: 50%;
@@ -32,30 +33,33 @@ chui_next_slide, chui_prev_slide {
32
33
  box-shadow: var(--box_shadow_main);
33
34
  display: flex;
34
35
  align-items: center;
35
- justify-content: center
36
+ justify-content: center;
36
37
  }
37
38
 
38
39
  chui_next_slide {
39
- inset-inline-end: 10px
40
+ inset-inline-end: 10px;
40
41
  }
41
42
 
42
43
  chui_prev_slide {
43
- inset-inline-start: 10px
44
+ inset-inline-start: 10px;
44
45
  }
45
46
 
46
- chui_next_slide:hover, chui_prev_slide:hover {
47
+ chui_next_slide:hover,
48
+ chui_prev_slide:hover {
47
49
  background-color: var(--element_background_hover);
48
- color: var(--text_color)
50
+ color: var(--text_color);
49
51
  }
50
52
 
51
- chui_next_slide:active, chui_prev_slide:active {
53
+ chui_next_slide:active,
54
+ chui_prev_slide:active {
52
55
  background-color: var(--blue_prime_background);
53
- color: var(--text_color_hover)
56
+ color: var(--text_color_hover);
54
57
  }
55
58
 
56
59
  /* chui_icon задаёт собственный color, поэтому цвет берём от кнопки: тогда значок
57
60
  меняется вместе с ней в наведении и нажатии */
58
- chui_next_slide chui_icon, chui_prev_slide chui_icon {
61
+ chui_next_slide chui_icon,
62
+ chui_prev_slide chui_icon {
59
63
  color: inherit;
60
64
  }
61
65
 
@@ -88,7 +92,9 @@ chui_slideshow_dot {
88
92
  height: 8px;
89
93
  border-radius: var(--radius_pill);
90
94
  background: var(--element_background);
91
- transition: width var(--transition_time) ease, background-color var(--transition_time) ease;
95
+ transition:
96
+ width var(--transition_time) ease,
97
+ background-color var(--transition_time) ease;
92
98
  }
93
99
 
94
100
  /* Наведение — нейтральная ступень, кружок текущего слайда — акцент */
@@ -138,7 +144,7 @@ chui_slide {
138
144
  color: var(--text_color);
139
145
  border-radius: var(--border_radius);
140
146
  width: 100%;
141
- height: -webkit-fill-available
147
+ height: -webkit-fill-available;
142
148
  }
143
149
 
144
150
  chui_slide_content {
@@ -147,7 +153,7 @@ chui_slide_content {
147
153
  border-radius: var(--border_radius);
148
154
  width: -webkit-fill-available;
149
155
  height: -webkit-fill-available;
150
- overflow: auto
156
+ overflow: auto;
151
157
  }
152
158
 
153
159
  /* Нажатие — акцент, как у Button: контрол отвечает на клик ещё до действия */
@@ -1,5 +1,5 @@
1
- const {Animation} = require('../../modules/chui_animations/animations');
2
- const {I18n} = require('../../modules/chui_i18n/chui_i18n');
1
+ const { Animation } = require("../../modules/chui_animations/animations");
2
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
3
3
 
4
4
  const SVG_NS = "http://www.w3.org/2000/svg";
5
5
  /** Доля кольца, которую занимает дуга: четверть — самый читаемый «бегунок» */
@@ -15,12 +15,12 @@ const ARC_SHARE = 0.25;
15
15
  * Слушателей и таймеров нет: `remove()` убирает узел и повторный вызов уже ничего не делает.
16
16
  */
17
17
  class Spinner {
18
- #spinner_main = document.createElement('chui_spiner')
19
- #spinner = document.createElement('spinner')
18
+ #spinner_main = document.createElement("chui_spiner");
19
+ #spinner = document.createElement("spinner");
20
20
  #label = I18n.t("feedback.loading");
21
21
  #removed = false;
22
22
  constructor(size = Spinner.SIZE.DEFAULT, margin = String(), label = I18n.t("feedback.loading")) {
23
- require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_Spinner');
23
+ require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_Spinner");
24
24
  this.#spinner_main.style.margin = margin;
25
25
  this.#spinner_main.setAttribute("role", "status");
26
26
  this.#spinner_main.setAttribute("aria-live", "polite");
@@ -91,8 +91,8 @@ class Spinner {
91
91
  SMALL: { SIZE: 45, BORDER: 3 },
92
92
  DEFAULT: { SIZE: 60, BORDER: 4 },
93
93
  BIG: { SIZE: 75, BORDER: 5 },
94
- V_BIG: { SIZE: 90, BORDER: 5 }
95
- }
94
+ V_BIG: { SIZE: 90, BORDER: 5 },
95
+ };
96
96
  }
97
97
 
98
- exports.Spinner = Spinner
98
+ exports.Spinner = Spinner;
@@ -58,4 +58,3 @@ spinner .spinner_arc {
58
58
  animation-duration: 2.5s;
59
59
  }
60
60
  }
61
-
@@ -1,7 +1,7 @@
1
- const {setStyles} = require("../../modules/chui_functions");
2
- const {Icon, Icons} = require("../chui_icons/icons");
3
- const {MenuKeyboard} = require("../../modules/chui_a11y/chui_a11y");
4
- const {I18n} = require("../../modules/chui_i18n/chui_i18n");
1
+ const { setStyles } = require("../../modules/chui_functions");
2
+ const { Icon, Icons } = require("../chui_icons/icons");
3
+ const { MenuKeyboard } = require("../../modules/chui_a11y/chui_a11y");
4
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
5
5
 
6
6
  const SPLIT_MENU_GAP = 4;
7
7
  const SPLIT_MENU_EDGE = 8;
@@ -53,16 +53,18 @@ class SplitButton {
53
53
  #is_open = false;
54
54
  #destroyed = false;
55
55
 
56
- constructor(options = {
57
- id: String(),
58
- title: String(),
59
- icon: String(),
60
- reverse: Boolean(),
61
- disabled: Boolean(),
62
- label: String(),
63
- clickEvent: undefined,
64
- items: []
65
- }) {
56
+ constructor(
57
+ options = {
58
+ id: String(),
59
+ title: String(),
60
+ icon: String(),
61
+ reverse: Boolean(),
62
+ disabled: Boolean(),
63
+ label: String(),
64
+ clickEvent: undefined,
65
+ items: [],
66
+ }
67
+ ) {
66
68
  setStyles(__dirname + "/styles.css", "chUiJS_SplitButton");
67
69
  SplitButton.#counter += 1;
68
70
  this.#id = options.id === undefined ? `chui_split_button_${SplitButton.#counter}` : options.id;
@@ -91,7 +93,7 @@ class SplitButton {
91
93
  this.#keyboard = new MenuKeyboard(this.#menu, {
92
94
  itemSelector: "button",
93
95
  onEscape: () => this.close(),
94
- trigger: this.#caret
96
+ trigger: this.#caret,
95
97
  });
96
98
  this.#keyboard.setExpanded(false);
97
99
  this.#caret.addEventListener("click", this.#onCaretClick);
@@ -183,7 +185,9 @@ class SplitButton {
183
185
  }
184
186
 
185
187
  /** Пункт меню: заголовок, значок, горячая клавиша и обработчик */
186
- static Item(options = { title: String(), icon: String(), shortcut: String(), disabled: Boolean(), clickEvent: undefined }) {
188
+ static Item(
189
+ options = { title: String(), icon: String(), shortcut: String(), disabled: Boolean(), clickEvent: undefined }
190
+ ) {
187
191
  return Object.assign({ type: "item" }, options);
188
192
  }
189
193
 
@@ -301,7 +305,8 @@ class SplitButton {
301
305
  #positionMenu() {
302
306
  const button = this.#caret.getBoundingClientRect();
303
307
  let left = button.right - this.#menu.offsetWidth;
304
- if (left + this.#menu.offsetWidth > window.innerWidth - SPLIT_MENU_EDGE) left = window.innerWidth - SPLIT_MENU_EDGE - this.#menu.offsetWidth;
308
+ if (left + this.#menu.offsetWidth > window.innerWidth - SPLIT_MENU_EDGE)
309
+ left = window.innerWidth - SPLIT_MENU_EDGE - this.#menu.offsetWidth;
305
310
  if (left < SPLIT_MENU_EDGE) left = SPLIT_MENU_EDGE;
306
311
  this.#menu.style.left = `${Math.round(left)}px`;
307
312
  this.#menu.style.top = `${Math.round(button.bottom + SPLIT_MENU_GAP)}px`;
@@ -325,4 +330,4 @@ class SplitButton {
325
330
  static ICON_SIZE = "16px";
326
331
  }
327
332
 
328
- exports.SplitButton = SplitButton
333
+ exports.SplitButton = SplitButton;
@@ -91,7 +91,7 @@ chui_split_button:not(.split_button_disabled):hover {
91
91
  правилом, а половинка кнопки, сжимающаяся отдельно, читалась бы поломкой */
92
92
  chui_split_button:not(.split_button_disabled):has(.split_button_main:active, .split_button_caret:active) {
93
93
  border-color: var(--button_border_color_hover);
94
- transform: scale(.97);
94
+ transform: scale(0.97);
95
95
  }
96
96
 
97
97
  /* Нажатие — акцент, как у Button: обе половины отвечают одинаково */
@@ -1,5 +1,5 @@
1
- const {setStyles, optionOr} = require('../../modules/chui_functions');
2
- const {I18n} = require('../../modules/chui_i18n/chui_i18n');
1
+ const { setStyles, optionOr } = require("../../modules/chui_functions");
2
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
3
3
 
4
4
  /**
5
5
  * Разделитель панелей: несколько областей и перетаскиваемые границы между ними.
@@ -31,7 +31,7 @@ const {I18n} = require('../../modules/chui_i18n/chui_i18n');
31
31
  class Splitter {
32
32
  static DIRECTION = {
33
33
  HORIZONTAL: "horizontal",
34
- VERTICAL: "vertical"
34
+ VERTICAL: "vertical",
35
35
  };
36
36
  static DEFAULT_SIZE = 6;
37
37
  static DEFAULT_STEP = 2;
@@ -53,21 +53,23 @@ class Splitter {
53
53
  #on_reset = undefined;
54
54
  #dragging = undefined;
55
55
 
56
- constructor(options = {
57
- id: String(),
58
- direction: String(),
59
- sizes: [],
60
- min: undefined,
61
- panes: [],
62
- width: String(),
63
- height: String(),
64
- disabled: Boolean(),
65
- label: String(),
66
- step: Number(),
67
- onResize: undefined,
68
- onResizeEnd: undefined,
69
- onReset: undefined
70
- }) {
56
+ constructor(
57
+ options = {
58
+ id: String(),
59
+ direction: String(),
60
+ sizes: [],
61
+ min: undefined,
62
+ panes: [],
63
+ width: String(),
64
+ height: String(),
65
+ disabled: Boolean(),
66
+ label: String(),
67
+ step: Number(),
68
+ onResize: undefined,
69
+ onResizeEnd: undefined,
70
+ onReset: undefined,
71
+ }
72
+ ) {
71
73
  setStyles(__dirname + "/styles.css", "chUiJS_Splitter");
72
74
  Splitter.#counter += 1;
73
75
  // Заготовка опции (`String()`) равносильна отсутствующей: иначе вызов без аргументов
@@ -75,7 +77,7 @@ class Splitter {
75
77
  this.#id = optionOr(options.id, `chui_splitter_${Splitter.#counter}`);
76
78
  this.#root.id = this.#id;
77
79
  this.#direction = options.direction === undefined ? Splitter.DIRECTION.HORIZONTAL : options.direction;
78
- this.#min = options.min === undefined ? [] : (Array.isArray(options.min) ? options.min : [options.min]);
80
+ this.#min = options.min === undefined ? [] : Array.isArray(options.min) ? options.min : [options.min];
79
81
  this.#step = options.step === undefined ? Splitter.DEFAULT_STEP : options.step;
80
82
  this.#on_resize = options.onResize;
81
83
  this.#on_resize_end = options.onResizeEnd;
@@ -287,13 +289,16 @@ class Splitter {
287
289
  const side = this.#isHorizontal()
288
290
  ? [I18n.t("a11y.sideLeft"), I18n.t("a11y.sideRight")]
289
291
  : [I18n.t("a11y.sideTop"), I18n.t("a11y.sideBottom")];
290
- handle.setAttribute("aria-valuetext", I18n.t("a11y.splitterValue", {
291
- first: side[0],
292
- firstPercent: Math.round(first),
293
- second: side[1].toLowerCase(),
294
- secondPercent: Math.round(second),
295
- total: Math.round(total)
296
- }));
292
+ handle.setAttribute(
293
+ "aria-valuetext",
294
+ I18n.t("a11y.splitterValue", {
295
+ first: side[0],
296
+ firstPercent: Math.round(first),
297
+ second: side[1].toLowerCase(),
298
+ secondPercent: Math.round(second),
299
+ total: Math.round(total),
300
+ })
301
+ );
297
302
  });
298
303
  }
299
304
 
@@ -307,7 +312,9 @@ class Splitter {
307
312
  const position = clientPosition - start;
308
313
  const before = this.#panes[index];
309
314
  const after = this.#panes[index + 1];
310
- const beforeStart = this.#isHorizontal() ? before.getBoundingClientRect().left - start : before.getBoundingClientRect().top - start;
315
+ const beforeStart = this.#isHorizontal()
316
+ ? before.getBoundingClientRect().left - start
317
+ : before.getBoundingClientRect().top - start;
311
318
  const pairSize = this.#paneSize(before) + this.#paneSize(after);
312
319
  if (pairSize === 0) return undefined;
313
320
  const pairShare = this.#sizes[index] + this.#sizes[index + 1];
@@ -428,4 +435,4 @@ class Splitter {
428
435
  };
429
436
  }
430
437
 
431
- exports.Splitter = Splitter
438
+ exports.Splitter = Splitter;