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,12 +1,12 @@
1
- const {setStyles, optionOr} = require('../../modules/chui_functions');
2
- const {Icon, Icons} = require('../chui_icons/icons');
3
- 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 { I18n } = require("../../modules/chui_i18n/chui_i18n");
4
4
 
5
5
  /** Значок направления изменения — один на строку тренда */
6
6
  const TREND_ICONS = {
7
7
  up: Icons.ACTIONS.TRENDING_UP,
8
8
  down: Icons.ACTIONS.TRENDING_DOWN,
9
- flat: Icons.ACTIONS.TRENDING_FLAT
9
+ flat: Icons.ACTIONS.TRENDING_FLAT,
10
10
  };
11
11
 
12
12
  /**
@@ -40,19 +40,19 @@ class Statistic {
40
40
  static SIZE = {
41
41
  SMALL: "small",
42
42
  DEFAULT: "default",
43
- LARGE: "large"
43
+ LARGE: "large",
44
44
  };
45
45
  static STYLE = {
46
46
  DEFAULT: "statistic_default",
47
47
  ACCENT: "statistic_accent",
48
48
  SUCCESS: "statistic_success",
49
49
  WARNING: "statistic_warning",
50
- ERROR: "statistic_error"
50
+ ERROR: "statistic_error",
51
51
  };
52
52
  static TREND = {
53
53
  UP: "up",
54
54
  DOWN: "down",
55
- FLAT: "flat"
55
+ FLAT: "flat",
56
56
  };
57
57
  static #counter = 0;
58
58
  static #DEFAULT_DURATION = 600;
@@ -85,12 +85,24 @@ class Statistic {
85
85
  #style = Statistic.STYLE.DEFAULT;
86
86
  #animation_id = undefined;
87
87
 
88
- constructor(options = {
89
- id: String(), title: String(), value: Number(),
90
- prefix: String(), suffix: String(), precision: Number(), format: undefined,
91
- trend: undefined, icon: undefined, size: String(), style: String(),
92
- animated: Boolean(), duration: Number(), label: String()
93
- }) {
88
+ constructor(
89
+ options = {
90
+ id: String(),
91
+ title: String(),
92
+ value: Number(),
93
+ prefix: String(),
94
+ suffix: String(),
95
+ precision: Number(),
96
+ format: undefined,
97
+ trend: undefined,
98
+ icon: undefined,
99
+ size: String(),
100
+ style: String(),
101
+ animated: Boolean(),
102
+ duration: Number(),
103
+ label: String(),
104
+ }
105
+ ) {
94
106
  setStyles(__dirname + "/styles.css", "chUiJS_Statistic");
95
107
  Statistic.#counter += 1;
96
108
  this.#id = optionOr(options.id, `chui_statistic_${Statistic.#counter}`);
@@ -173,7 +185,7 @@ class Statistic {
173
185
  }
174
186
 
175
187
  getTrend() {
176
- return this.#trend === undefined ? undefined : {...this.#trend};
188
+ return this.#trend === undefined ? undefined : { ...this.#trend };
177
189
  }
178
190
 
179
191
  getStyle() {
@@ -294,7 +306,7 @@ class Statistic {
294
306
  precision: trend.precision === undefined ? 0 : trend.precision,
295
307
  label: optionOr(trend.label, ""),
296
308
  text: trend.text === undefined ? undefined : String(trend.text),
297
- style: trend.style
309
+ style: trend.style,
298
310
  };
299
311
  this.#syncTrend();
300
312
  return this;
@@ -312,9 +324,12 @@ class Statistic {
312
324
  this.#icon.hidden = true;
313
325
  return this;
314
326
  }
315
- this.#icon_node = typeof icon === "string"
316
- ? new Icon(icon, "16px").set()
317
- : (typeof icon.set === "function" ? icon.set() : icon);
327
+ this.#icon_node =
328
+ typeof icon === "string"
329
+ ? new Icon(icon, "16px").set()
330
+ : typeof icon.set === "function"
331
+ ? icon.set()
332
+ : icon;
318
333
  this.#icon.innerHTML = "";
319
334
  this.#icon.appendChild(this.#icon_node);
320
335
  this.#icon.hidden = false;
@@ -363,18 +378,24 @@ class Statistic {
363
378
  }
364
379
 
365
380
  static #reducedMotion() {
366
- return typeof window !== "undefined" && typeof window.matchMedia === "function" &&
367
- window.matchMedia("(prefers-reduced-motion: reduce)").matches;
381
+ return (
382
+ typeof window !== "undefined" &&
383
+ typeof window.matchMedia === "function" &&
384
+ window.matchMedia("(prefers-reduced-motion: reduce)").matches
385
+ );
368
386
  }
369
387
 
370
388
  /** Форматтер по языку интерфейса: разряды и запятая разбираются по локали */
371
389
  static #formatter(locale = "ru", precision = 0) {
372
390
  const key = `${locale}|${precision}`;
373
391
  if (!Statistic.#formatters.has(key)) {
374
- Statistic.#formatters.set(key, new Intl.NumberFormat(locale, {
375
- minimumFractionDigits: precision,
376
- maximumFractionDigits: precision
377
- }));
392
+ Statistic.#formatters.set(
393
+ key,
394
+ new Intl.NumberFormat(locale, {
395
+ minimumFractionDigits: precision,
396
+ maximumFractionDigits: precision,
397
+ })
398
+ );
378
399
  }
379
400
  return Statistic.#formatters.get(key);
380
401
  }
@@ -431,31 +452,37 @@ class Statistic {
431
452
  return;
432
453
  }
433
454
  const direction = trend.direction;
434
- const sign = direction === Statistic.TREND.UP ? "+" : (direction === Statistic.TREND.DOWN ? "−" : "");
435
- const number = trend.text === undefined
436
- ? `${sign}${this.#formatNumber(trend.value === undefined ? 0 : trend.value, trend.precision)}${trend.suffix}`
437
- : trend.text;
455
+ const sign = direction === Statistic.TREND.UP ? "+" : direction === Statistic.TREND.DOWN ? "−" : "";
456
+ const number =
457
+ trend.text === undefined
458
+ ? `${sign}${this.#formatNumber(trend.value === undefined ? 0 : trend.value, trend.precision)}${trend.suffix}`
459
+ : trend.text;
438
460
  this.#trend_value.innerText = number;
439
461
  this.#trend_label.innerText = trend.label;
440
462
  this.#trend_label.hidden = trend.label === "";
441
- this.#trend_icon.innerHTML = new Icon(TREND_ICONS[direction] === undefined ? TREND_ICONS.flat : TREND_ICONS[direction], "14px").getHTML();
463
+ this.#trend_icon.innerHTML = new Icon(
464
+ TREND_ICONS[direction] === undefined ? TREND_ICONS.flat : TREND_ICONS[direction],
465
+ "14px"
466
+ ).getHTML();
442
467
  this.#trend_node.dataset.direction = direction;
443
468
  if (trend.style === undefined) this.#trend_node.removeAttribute("data-style");
444
469
  else this.#trend_node.dataset.style = trend.style;
445
470
  // Направление читается словами: стрелка-глиф скрыта от скринридера
446
- const phrase = direction === Statistic.TREND.UP
447
- ? I18n.t("data.statisticTrendUp", {value: number})
448
- : (direction === Statistic.TREND.DOWN
449
- ? I18n.t("data.statisticTrendDown", {value: number})
450
- : I18n.t("data.statisticTrendFlat"));
471
+ const phrase =
472
+ direction === Statistic.TREND.UP
473
+ ? I18n.t("data.statisticTrendUp", { value: number })
474
+ : direction === Statistic.TREND.DOWN
475
+ ? I18n.t("data.statisticTrendDown", { value: number })
476
+ : I18n.t("data.statisticTrendFlat");
451
477
  this.#trend_node.setAttribute("aria-label", trend.label === "" ? phrase : `${phrase} ${trend.label}`);
452
478
  }
453
479
 
454
480
  #announce() {
455
481
  const title = this.#title_value === undefined ? "" : this.#title_value;
456
- this.#status.innerText = title === ""
457
- ? this.getDisplayValue()
458
- : I18n.t("data.statisticAnnounce", {title: title, value: this.getDisplayValue()});
482
+ this.#status.innerText =
483
+ title === ""
484
+ ? this.getDisplayValue()
485
+ : I18n.t("data.statisticAnnounce", { title: title, value: this.getDisplayValue() });
459
486
  }
460
487
 
461
488
  #syncAria() {
@@ -464,4 +491,4 @@ class Statistic {
464
491
  }
465
492
  }
466
493
 
467
- exports.Statistic = Statistic
494
+ exports.Statistic = Statistic;
@@ -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
  * Строка состояния: области слева, по центру и справа.
@@ -23,7 +23,7 @@ class StatusBar {
23
23
  static ALIGN = {
24
24
  LEFT: "left",
25
25
  CENTER: "center",
26
- RIGHT: "right"
26
+ RIGHT: "right",
27
27
  };
28
28
  static #counter = 0;
29
29
 
@@ -34,11 +34,13 @@ class StatusBar {
34
34
  #live = true;
35
35
  #label = I18n.t("navigation.statusBar");
36
36
 
37
- constructor(options = {
38
- id: String(),
39
- label: String(),
40
- live: Boolean()
41
- }) {
37
+ constructor(
38
+ options = {
39
+ id: String(),
40
+ label: String(),
41
+ live: Boolean(),
42
+ }
43
+ ) {
42
44
  setStyles(__dirname + "/styles.css", "chUiJS_StatusBar");
43
45
  StatusBar.#counter += 1;
44
46
  this.#id = options.id === undefined ? `chui_status_bar_${StatusBar.#counter}` : options.id;
@@ -146,4 +148,4 @@ class StatusBar {
146
148
  }
147
149
  }
148
150
 
149
- exports.StatusBar = StatusBar
151
+ exports.StatusBar = StatusBar;
@@ -1,6 +1,6 @@
1
- const {setStyles, optionOr} = require("../../modules/chui_functions");
2
- const {Icon, Icons} = require("../chui_icons/icons");
3
- 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 { I18n } = require("../../modules/chui_i18n/chui_i18n");
4
4
 
5
5
  /**
6
6
  * Шаги процесса: пройденные, текущий и предстоящие.
@@ -26,11 +26,11 @@ const {I18n} = require("../../modules/chui_i18n/chui_i18n");
26
26
  class Stepper {
27
27
  static ORIENTATION = {
28
28
  HORIZONTAL: "horizontal",
29
- VERTICAL: "vertical"
29
+ VERTICAL: "vertical",
30
30
  };
31
31
  static SIZE = {
32
32
  SMALL: "small",
33
- DEFAULT: "default"
33
+ DEFAULT: "default",
34
34
  };
35
35
  static #counter = 0;
36
36
 
@@ -45,17 +45,19 @@ class Stepper {
45
45
  #listeners = [];
46
46
  #on_change = undefined;
47
47
 
48
- constructor(options = {
49
- id: String(),
50
- steps: [],
51
- active: Number(),
52
- orientation: String(),
53
- size: String(),
54
- clickable: Boolean(),
55
- label: String(),
56
- onChange: undefined,
57
- changeEvent: undefined
58
- }) {
48
+ constructor(
49
+ options = {
50
+ id: String(),
51
+ steps: [],
52
+ active: Number(),
53
+ orientation: String(),
54
+ size: String(),
55
+ clickable: Boolean(),
56
+ label: String(),
57
+ onChange: undefined,
58
+ changeEvent: undefined,
59
+ }
60
+ ) {
59
61
  setStyles(__dirname + "/styles.css", "chUiJS_Stepper");
60
62
  Stepper.#counter += 1;
61
63
  this.#id = options.id === undefined ? `chui_stepper_${Stepper.#counter}` : options.id;
@@ -149,9 +151,10 @@ class Stepper {
149
151
 
150
152
  /** Направление шагов: `Stepper.ORIENTATION.{HORIZONTAL, VERTICAL}` */
151
153
  setOrientation(orientation = String()) {
152
- this.#root.dataset.orientation = orientation === Stepper.ORIENTATION.VERTICAL
153
- ? Stepper.ORIENTATION.VERTICAL
154
- : Stepper.ORIENTATION.HORIZONTAL;
154
+ this.#root.dataset.orientation =
155
+ orientation === Stepper.ORIENTATION.VERTICAL
156
+ ? Stepper.ORIENTATION.VERTICAL
157
+ : Stepper.ORIENTATION.HORIZONTAL;
155
158
  return this;
156
159
  }
157
160
 
@@ -203,7 +206,9 @@ class Stepper {
203
206
  // Имя маркера: номер шага, название и состояние — иначе глиф читался бы как мусор
204
207
  #markerLabel(index = Number()) {
205
208
  const title = this.#items[index].title;
206
- const head = I18n.t("navigation.stepOf", {index: index + 1, total: this.#items.length}) + (title === undefined ? "" : `: ${title}`);
209
+ const head =
210
+ I18n.t("navigation.stepOf", { index: index + 1, total: this.#items.length }) +
211
+ (title === undefined ? "" : `: ${title}`);
207
212
  return `${head} — ${this.#stateWord(index)}`;
208
213
  }
209
214
 
@@ -292,7 +297,7 @@ class Stepper {
292
297
 
293
298
  #announce() {
294
299
  const title = this.#items[this.#active] === undefined ? undefined : this.#items[this.#active].title;
295
- const head = I18n.t("navigation.stepOf", {index: this.#active + 1, total: this.#items.length});
300
+ const head = I18n.t("navigation.stepOf", { index: this.#active + 1, total: this.#items.length });
296
301
  this.#status.innerText = title === undefined ? head : `${head}: ${title}`;
297
302
  }
298
303
 
@@ -311,4 +316,4 @@ class Stepper {
311
316
  static SMALL_ICON_SIZE = "14px";
312
317
  }
313
318
 
314
- exports.Stepper = Stepper
319
+ exports.Stepper = Stepper;
@@ -1,4 +1,4 @@
1
- const {setStyles, optionOr, scrollParent} = require('../../modules/chui_functions');
1
+ const { setStyles, optionOr, scrollParent } = require("../../modules/chui_functions");
2
2
 
3
3
  /**
4
4
  * Прилипающая полоса: остаётся у верха области прокрутки, пока её содержимое не кончилось.
@@ -50,9 +50,14 @@ class StickyBar {
50
50
  #frame = 0;
51
51
  #pending = 0;
52
52
 
53
- constructor(options = {
54
- id: String(), offset: Number(), target: undefined, onChange: undefined
55
- }) {
53
+ constructor(
54
+ options = {
55
+ id: String(),
56
+ offset: Number(),
57
+ target: undefined,
58
+ onChange: undefined,
59
+ }
60
+ ) {
56
61
  setStyles(__dirname + "/styles.css", "chUiJS_StickyBar");
57
62
  StickyBar.#counter += 1;
58
63
  this.#id = optionOr(options.id, `chui_sticky_bar_${StickyBar.#counter}`);
@@ -24,7 +24,9 @@ sticky_bar_content {
24
24
  padding: 8px 10px;
25
25
  border: 1px solid transparent;
26
26
  border-radius: var(--radius_md);
27
- transition: background-color var(--transition_time) ease, box-shadow var(--transition_time) ease;
27
+ transition:
28
+ background-color var(--transition_time) ease,
29
+ box-shadow var(--transition_time) ease;
28
30
  }
29
31
 
30
32
  /* Закреплённая полоса читается отдельным слоем: материал как у шапки, волосяной край и тень.
@@ -1,13 +1,13 @@
1
- let {Animation} = require('../../modules/chui_animations/animations');
2
- const {Icon, Icons} = require('../chui_icons/icons');
3
- const {makeKeyboardButton} = require('../../modules/chui_a11y/chui_a11y');
4
- const {I18n} = require('../../modules/chui_i18n/chui_i18n');
1
+ let { Animation } = require("../../modules/chui_animations/animations");
2
+ const { Icon, Icons } = require("../chui_icons/icons");
3
+ const { makeKeyboardButton } = require("../../modules/chui_a11y/chui_a11y");
4
+ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
5
5
 
6
6
  /** Идентификаторы вкладок для aria-controls/aria-labelledby */
7
7
  let a11y_tab_counter = 0;
8
8
 
9
9
  class Tab {
10
- #tab = document.createElement('tab');
10
+ #tab = document.createElement("tab");
11
11
  #tab_content = [];
12
12
  #title = String();
13
13
  #closable = false;
@@ -42,7 +42,7 @@ class Tab {
42
42
  this.#close = document.createElement("button");
43
43
  this.#close.type = "button";
44
44
  this.#close.className = "tab_close";
45
- this.#close.setAttribute("aria-label", I18n.t("navigation.closeTab", {title: this.#title}));
45
+ this.#close.setAttribute("aria-label", I18n.t("navigation.closeTab", { title: this.#title }));
46
46
  this.#close.setAttribute("title", I18n.t("common.close"));
47
47
  this.#close.appendChild(new Icon(Icons.NAVIGATION.CLOSE, "14px").set());
48
48
  this.#tab.appendChild(this.#close);
@@ -73,11 +73,11 @@ class Tabs {
73
73
  // Вкладка, содержимое которой сейчас в панели: индекс меняется при закрытии соседей
74
74
  #rendered = undefined;
75
75
  #id_contents = require("randomstring").generate();
76
- #tabs = document.createElement('tabs');
76
+ #tabs = document.createElement("tabs");
77
77
  #id_list = require("randomstring").generate();
78
- #list = document.createElement('list');
79
- #content = document.createElement('content');
80
- #status = document.createElement('tabs_status');
78
+ #list = document.createElement("list");
79
+ #content = document.createElement("content");
80
+ #status = document.createElement("tabs_status");
81
81
  #on_tab_close = undefined;
82
82
  #animationend_event = () => {
83
83
  // Следы анимации снимаются точечно: `removeAttribute("style")` снёс бы и чужие
@@ -86,8 +86,10 @@ class Tabs {
86
86
  this.#content.style.removeProperty("transition");
87
87
  this.#content.style.removeProperty("display");
88
88
  };
89
- constructor(options = { width: String(), default: Number(), tabs: [], closable: Boolean(), onTabClose: undefined }) {
90
- require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_Tabs');
89
+ constructor(
90
+ options = { width: String(), default: Number(), tabs: [], closable: Boolean(), onTabClose: undefined }
91
+ ) {
92
+ require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_Tabs");
91
93
  this.#on_tab_close = options.onTabClose;
92
94
  this.#list.id = this.#id_list;
93
95
  this.#content.id = this.#id_contents;
@@ -143,10 +145,9 @@ class Tabs {
143
145
  * сразу становится активной.
144
146
  */
145
147
  addTab(tab = undefined, index = undefined) {
146
- if (tab === undefined || typeof tab.getTab !== "function") throw new Error("Tabs.addTab(): нужен экземпляр Tab");
147
- const at = index === undefined
148
- ? this.#items.length
149
- : Math.max(0, Math.min(Number(index), this.#items.length));
148
+ if (tab === undefined || typeof tab.getTab !== "function")
149
+ throw new Error("Tabs.addTab(): нужен экземпляр Tab");
150
+ const at = index === undefined ? this.#items.length : Math.max(0, Math.min(Number(index), this.#items.length));
150
151
  this.#items.splice(at, 0, tab);
151
152
  this.#bindTab(tab, at);
152
153
  // Новая вкладка встала не позже активной — активная сдвинулась на место вправо
@@ -175,14 +176,19 @@ class Tabs {
175
176
  this.#rendered = undefined;
176
177
  this.#content.innerHTML = "";
177
178
  this.#content.removeAttribute("aria-labelledby");
178
- this.#announce(I18n.t("navigation.tabClosedNothing", {title: tab.getTitle()}));
179
+ this.#announce(I18n.t("navigation.tabClosedNothing", { title: tab.getTitle() }));
179
180
  return this;
180
181
  }
181
182
  if (closing_rendered) this.#active = Math.min(at, this.#items.length - 1);
182
183
  this.#activate(this.#active, closing_rendered);
183
- this.#announce(closing_rendered
184
- ? I18n.t("navigation.tabClosedOpened", {title: tab.getTitle(), active: this.#items[this.#active].getTitle()})
185
- : I18n.t("navigation.tabClosed", {title: tab.getTitle()}));
184
+ this.#announce(
185
+ closing_rendered
186
+ ? I18n.t("navigation.tabClosedOpened", {
187
+ title: tab.getTitle(),
188
+ active: this.#items[this.#active].getTitle(),
189
+ })
190
+ : I18n.t("navigation.tabClosed", { title: tab.getTitle() })
191
+ );
186
192
  return this;
187
193
  }
188
194
 
@@ -295,5 +301,5 @@ class Tabs {
295
301
  }
296
302
  }
297
303
 
298
- exports.Tab = Tab
299
- exports.Tabs = Tabs
304
+ exports.Tab = Tab;
305
+ exports.Tabs = Tabs;
@@ -47,12 +47,12 @@ tabs {
47
47
  display: flex;
48
48
  flex-direction: column;
49
49
  justify-content: flex-start;
50
- align-items: flex-start
50
+ align-items: flex-start;
51
51
  }
52
52
 
53
53
  content {
54
54
  display: flex;
55
- flex-direction:column;
55
+ flex-direction: column;
56
56
  width: -webkit-fill-available;
57
57
  padding: var(--control_padding);
58
58
  border-radius: var(--border_radius);
@@ -96,7 +96,7 @@ tab:has(.tab_close) {
96
96
  /* Цвет наследуется от вкладки: крестик не отваливается от подписи, а наглухо
97
97
  серый читался в ней случайной точкой */
98
98
  color: inherit;
99
- opacity: .6;
99
+ opacity: 0.6;
100
100
  cursor: pointer;
101
101
  }
102
102
 
@@ -6,7 +6,7 @@ chui_text_editor_test {
6
6
  flex-direction: column;
7
7
  width: -webkit-fill-available;
8
8
  height: max-content;
9
- margin: var(--margin)
9
+ margin: var(--margin);
10
10
  }
11
11
 
12
12
  chui_text_editor {
@@ -54,7 +54,7 @@ chui_editor_text_input:focus {
54
54
  }
55
55
 
56
56
  chui_editor_text_input div {
57
- margin-bottom: 10px
57
+ margin-bottom: 10px;
58
58
  }
59
59
 
60
60
  .text_editor_label {
@@ -62,12 +62,12 @@ chui_editor_text_input div {
62
62
  width: max-content;
63
63
  margin: var(--margin);
64
64
  font-size: var(--font_labels_size);
65
- font-weight:500;
66
- color: var(--text_color)
65
+ font-weight: 500;
66
+ color: var(--text_color);
67
67
  }
68
68
 
69
69
  chui_editor_text_input p {
70
- margin: 5px 0
70
+ margin: 5px 0;
71
71
  }
72
72
 
73
73
  p img {
@@ -75,8 +75,8 @@ p img {
75
75
  padding: 0;
76
76
  width: auto;
77
77
  height: auto;
78
- border: 2px solid transparent;
79
- border-radius: var(--border_radius)
78
+ border: 2px solid transparent;
79
+ border-radius: var(--border_radius);
80
80
  }
81
81
 
82
82
  /* Кнопки панели — как действия панели разметки у MarkdownEditor: сторона из токена
@@ -118,7 +118,7 @@ chui_text_editor_select_box {
118
118
  flex-direction: column;
119
119
  align-items: baseline;
120
120
  height: max-content;
121
- width: auto
121
+ width: auto;
122
122
  }
123
123
 
124
124
  text_editor_select_box {
@@ -141,11 +141,12 @@ text_editor_select_box:hover {
141
141
  }
142
142
 
143
143
  .text_editor_selectbox_input {
144
- width:100%;
144
+ width: 100%;
145
145
  display: block;
146
146
  outline: none;
147
147
  margin: 0;
148
- padding-block: 6px 6px; padding-inline: 6px 0;
148
+ padding-block: 6px 6px;
149
+ padding-inline: 6px 0;
149
150
  background: transparent;
150
151
  color: var(--text_color);
151
152
  text-align: start;
@@ -179,8 +180,8 @@ text_editor_selectbox_dropdown {
179
180
  -webkit-backdrop-filter: var(--global_blur);
180
181
  color: var(--text_color);
181
182
  outline: none;
182
- position:absolute;
183
- display:none;
183
+ position: absolute;
184
+ display: none;
184
185
  height: max-content;
185
186
  width: max-content;
186
187
  border-radius: var(--border_radius);
@@ -208,7 +209,7 @@ text_editor_select_button_open {
208
209
  text_editor_selectbox_option {
209
210
  text-align: start;
210
211
  padding: 6px 12px;
211
- border-radius: var(--border_radius)
212
+ border-radius: var(--border_radius);
212
213
  }
213
214
 
214
215
  /* Заголовок пункта — абзац или заголовок (тег задаёт вызывающий): отступы снимает CSS.
@@ -219,7 +220,7 @@ text_editor_selectbox_option {
219
220
  }
220
221
 
221
222
  text_editor_selectbox_option:hover {
222
- background: var(--element_background_hover)
223
+ background: var(--element_background_hover);
223
224
  }
224
225
 
225
226
  text_editor_selectbox_option:hover font {
@@ -254,24 +255,24 @@ text_editor_block {
254
255
 
255
256
  .text_editor_table_body {
256
257
  border: 1px solid var(--blue_prime_background);
257
- width: auto
258
+ width: auto;
258
259
  }
259
260
 
260
261
  .text_editor_table_row {
261
262
  width: auto;
262
- display: table-row
263
+ display: table-row;
263
264
  }
264
265
 
265
266
  .text_editor_table_cell {
266
267
  height: max-content;
267
268
  width: auto;
268
269
  display: table-cell;
269
- border: 1px solid var(--blue_prime_background)
270
+ border: 1px solid var(--blue_prime_background);
270
271
  }
271
272
 
272
273
  pre {
273
- font-family: 'chui_mono';
274
- font-weight: 400
274
+ font-family: "chui_mono";
275
+ font-weight: 400;
275
276
  }
276
277
 
277
278
  /* Нажатие — акцент, как у Button: контрол отвечает на клик ещё до действия */