chuijs 4.0.3 → 4.0.4
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.
- package/CHANGELOG.md +536 -0
- package/framework/appLayout/default/chui_app_layout.js +361 -303
- package/framework/appLayout/default/global_style.css +243 -89
- package/framework/appLayout/default/main_theme_style.css +188 -101
- package/framework/components/chui_accordion/accordion.js +17 -17
- package/framework/components/chui_accordion/styles.css +7 -7
- package/framework/components/chui_action_sheet/action_sheet.js +35 -32
- package/framework/components/chui_action_sheet/styles.css +10 -4
- package/framework/components/chui_actions_bar/actions_bar.js +338 -0
- package/framework/components/chui_actions_bar/styles.css +139 -0
- package/framework/components/chui_affix/affix.js +4 -4
- package/framework/components/chui_affix/styles.css +5 -0
- package/framework/components/chui_alert/alert.js +11 -5
- package/framework/components/chui_alert/styles.css +7 -0
- package/framework/components/chui_avatar/avatar.js +13 -13
- package/framework/components/chui_avatar/styles.css +1 -1
- package/framework/components/chui_avatar_group/avatar_group.js +4 -4
- package/framework/components/chui_avatar_group/styles.css +1 -1
- package/framework/components/chui_backtop/backtop.js +25 -2
- package/framework/components/chui_backtop/styles.css +21 -0
- package/framework/components/chui_badge/badge.js +15 -15
- package/framework/components/chui_badge/styles.css +6 -6
- package/framework/components/chui_banner/banner.js +222 -0
- package/framework/components/chui_banner/styles.css +170 -0
- package/framework/components/chui_breadcrumb/styles.css +1 -1
- package/framework/components/chui_button/button.js +24 -28
- package/framework/components/chui_button/styles.css +5 -5
- package/framework/components/chui_calendar/calendar.js +6 -6
- package/framework/components/chui_card/card.js +14 -14
- package/framework/components/chui_card_scroll/card_scroll.js +169 -0
- package/framework/components/chui_card_scroll/styles.css +86 -0
- package/framework/components/chui_chat/chat.js +73 -51
- package/framework/components/chui_chat/styles.css +18 -7
- package/framework/components/chui_clipboard_history/clipboard_history.js +25 -20
- package/framework/components/chui_clipboard_history/styles.css +10 -8
- package/framework/components/chui_code/code.js +8 -8
- package/framework/components/chui_code/styles.css +2 -2
- package/framework/components/chui_code_editor/code_editor.js +26 -26
- package/framework/components/chui_code_editor/styles.css +3 -3
- package/framework/components/chui_command_palette/command_palette.js +29 -29
- package/framework/components/chui_command_palette/styles.css +5 -5
- package/framework/components/chui_console/console.js +9 -9
- package/framework/components/chui_console/styles.css +5 -2
- package/framework/components/chui_content_block/content_block.js +2 -2
- package/framework/components/chui_context_menu/context_menu.js +162 -54
- package/framework/components/chui_context_menu/styles.css +82 -8
- package/framework/components/chui_custom_element/custom_element.js +11 -11
- package/framework/components/chui_data_grid/data_grid.js +268 -268
- package/framework/components/chui_data_grid/styles.css +14 -14
- package/framework/components/chui_descriptions/styles.css +1 -1
- package/framework/components/chui_details/details.js +12 -12
- package/framework/components/chui_details/styles.css +7 -7
- package/framework/components/chui_diff_viewer/diff_viewer.js +88 -88
- package/framework/components/chui_diff_viewer/styles.css +9 -9
- package/framework/components/chui_divider/divider.js +6 -6
- package/framework/components/chui_divider/styles.css +2 -2
- package/framework/components/chui_drawer/drawer.js +37 -14
- package/framework/components/chui_drawer/styles.css +18 -4
- package/framework/components/chui_drop_zone/drop_zone.js +6 -6
- package/framework/components/chui_drop_zone/styles.css +10 -6
- package/framework/components/chui_fieldset/fieldset.js +6 -6
- package/framework/components/chui_fieldset/styles.css +5 -5
- package/framework/components/chui_file_explorer/file_explorer.js +115 -115
- package/framework/components/chui_file_explorer/styles.css +6 -6
- package/framework/components/chui_form/form.js +11 -11
- package/framework/components/chui_gantt/gantt.js +41 -41
- package/framework/components/chui_gantt/styles.css +5 -5
- package/framework/components/chui_graphs/graphs.js +82 -46
- package/framework/components/chui_graphs/styles.css +26 -5
- package/framework/components/chui_hero/hero.js +63 -20
- package/framework/components/chui_hero/styles.css +176 -7
- package/framework/components/chui_html_block/html_block.js +5 -5
- package/framework/components/chui_html_block/styles.css +1 -1
- package/framework/components/chui_hx/styles.css +2 -2
- package/framework/components/chui_icons/icons.js +7 -7
- package/framework/components/chui_icons/styles.css +2 -1
- package/framework/components/chui_inputs/chui_check_box/styles.css +12 -3
- package/framework/components/chui_inputs/chui_chips/chips.js +92 -31
- package/framework/components/chui_inputs/chui_chips/styles.css +28 -5
- package/framework/components/chui_inputs/chui_color_picker/color_picker.js +20 -15
- package/framework/components/chui_inputs/chui_color_picker/styles.css +7 -7
- package/framework/components/chui_inputs/chui_combo_box/combo_box.js +58 -58
- package/framework/components/chui_inputs/chui_combo_box/styles.css +9 -9
- package/framework/components/chui_inputs/chui_date/date.js +93 -95
- package/framework/components/chui_inputs/chui_date/styles.css +8 -8
- package/framework/components/chui_inputs/chui_date_range/date_range.js +22 -22
- package/framework/components/chui_inputs/chui_date_range/styles.css +3 -3
- package/framework/components/chui_inputs/chui_datetime/datetime.js +12 -12
- package/framework/components/chui_inputs/chui_datetime/styles.css +3 -3
- package/framework/components/chui_inputs/chui_email/email.js +10 -10
- package/framework/components/chui_inputs/chui_email/styles.css +6 -6
- package/framework/components/chui_inputs/chui_file/file.js +8 -8
- package/framework/components/chui_inputs/chui_file/styles.css +12 -9
- package/framework/components/chui_inputs/chui_hotkey/hotkey.js +39 -39
- package/framework/components/chui_inputs/chui_hotkey/styles.css +6 -6
- package/framework/components/chui_inputs/chui_masked/masked.js +44 -44
- package/framework/components/chui_inputs/chui_masked/styles.css +5 -5
- package/framework/components/chui_inputs/chui_mention/mention.js +13 -13
- package/framework/components/chui_inputs/chui_mention/styles.css +14 -8
- package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +147 -137
- package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +14 -8
- package/framework/components/chui_inputs/chui_number/number.js +42 -45
- package/framework/components/chui_inputs/chui_number/styles.css +6 -6
- package/framework/components/chui_inputs/chui_otp/otp.js +32 -32
- package/framework/components/chui_inputs/chui_otp/styles.css +5 -5
- package/framework/components/chui_inputs/chui_password/password.js +30 -36
- package/framework/components/chui_inputs/chui_password/styles.css +7 -7
- package/framework/components/chui_inputs/chui_radio_button/styles.css +2 -2
- package/framework/components/chui_inputs/chui_rating/rating.js +28 -28
- package/framework/components/chui_inputs/chui_rating/styles.css +3 -3
- package/framework/components/chui_inputs/chui_select_box/select_box.js +54 -54
- package/framework/components/chui_inputs/chui_select_box/styles.css +10 -10
- package/framework/components/chui_inputs/chui_slider/slider.js +14 -14
- package/framework/components/chui_inputs/chui_slider/styles.css +5 -4
- package/framework/components/chui_inputs/chui_text/styles.css +7 -7
- package/framework/components/chui_inputs/chui_text/text.js +13 -17
- package/framework/components/chui_inputs/chui_text_area/styles.css +8 -8
- package/framework/components/chui_inputs/chui_text_area/text_area.js +23 -23
- package/framework/components/chui_inputs/chui_time/styles.css +13 -17
- package/framework/components/chui_inputs/chui_time/time.js +35 -24
- package/framework/components/chui_inputs/chui_toggle/styles.css +10 -3
- package/framework/components/chui_inputs/chui_toggle/toggle.js +16 -16
- package/framework/components/chui_json_editor/json_editor.js +87 -87
- package/framework/components/chui_json_editor/styles.css +5 -5
- package/framework/components/chui_json_viewer/json_viewer.js +80 -80
- package/framework/components/chui_json_viewer/styles.css +6 -6
- package/framework/components/chui_kanban/kanban.js +27 -27
- package/framework/components/chui_kanban/styles.css +8 -4
- package/framework/components/chui_kbd/styles.css +1 -1
- package/framework/components/chui_label/label.js +17 -17
- package/framework/components/chui_label/styles.css +1 -1
- package/framework/components/chui_link/link.js +9 -9
- package/framework/components/chui_link/styles.css +11 -4
- package/framework/components/chui_list/list.js +11 -11
- package/framework/components/chui_list/styles.css +2 -2
- package/framework/components/chui_markdown_editor/markdown_editor.js +66 -66
- package/framework/components/chui_markdown_editor/styles.css +5 -5
- package/framework/components/chui_media/audio.js +240 -246
- package/framework/components/chui_media/audio_styles.css +41 -23
- package/framework/components/chui_media/image.js +49 -46
- package/framework/components/chui_media/image_compare.js +35 -35
- package/framework/components/chui_media/image_compare_styles.css +5 -5
- package/framework/components/chui_media/image_styles.css +1 -1
- package/framework/components/chui_media/video.js +148 -148
- package/framework/components/chui_media/video_styles.css +27 -11
- package/framework/components/chui_menu_bar/menu_bar.js +54 -54
- package/framework/components/chui_menu_bar/styles.css +10 -10
- package/framework/components/chui_message_bar/message_bar.js +551 -0
- package/framework/components/chui_message_bar/styles.css +248 -0
- package/framework/components/chui_modal/modal.js +37 -13
- package/framework/components/chui_notification/notification.js +76 -54
- package/framework/components/chui_notification/notification_download.js +26 -81
- package/framework/components/chui_notification/notification_download_card.js +115 -0
- package/framework/components/chui_notification/notification_download_progress.css +2 -2
- package/framework/components/chui_notification/notification_download_progress.js +70 -108
- package/framework/components/chui_notification/notification_update.js +31 -31
- package/framework/components/chui_notification/status_plate.css +3 -3
- package/framework/components/chui_notification/styles.css +6 -1
- package/framework/components/chui_notification/styles_download.css +1 -1
- package/framework/components/chui_notification/styles_update.css +2 -2
- package/framework/components/chui_org_chart/org_chart.js +29 -29
- package/framework/components/chui_org_chart/styles.css +2 -2
- package/framework/components/chui_pagination/pagination.js +3 -3
- package/framework/components/chui_pagination/styles.css +1 -1
- package/framework/components/chui_paragraph/styles.css +2 -2
- package/framework/components/chui_popover/popover.js +29 -23
- package/framework/components/chui_popover/styles.css +1 -1
- package/framework/components/chui_popups/popups.js +124 -124
- package/framework/components/chui_popups/styles.css +5 -5
- package/framework/components/chui_print_button/print_button.js +15 -10
- package/framework/components/chui_progress_bar/progress_bar.js +34 -12
- package/framework/components/chui_progress_bar/styles.css +4 -4
- package/framework/components/chui_progress_ring/progress_ring.js +15 -15
- package/framework/components/chui_progress_ring/styles.css +1 -1
- package/framework/components/chui_qrcode/qrcode.js +12 -12
- package/framework/components/chui_query_builder/query_builder.js +46 -46
- package/framework/components/chui_query_builder/styles.css +4 -4
- package/framework/components/chui_radio_group/styles.css +1 -1
- package/framework/components/chui_result/result.js +15 -15
- package/framework/components/chui_result/styles.css +3 -3
- package/framework/components/chui_scheduler/scheduler.js +74 -74
- package/framework/components/chui_scheduler/styles.css +5 -5
- package/framework/components/chui_screen_spinner/screen_spinner.js +167 -0
- package/framework/components/chui_screen_spinner/styles.css +49 -0
- package/framework/components/chui_segmented_control/segmented_control.js +63 -6
- package/framework/components/chui_segmented_control/styles.css +32 -6
- package/framework/components/chui_settings/settings.js +45 -46
- package/framework/components/chui_settings/styles.css +4 -4
- package/framework/components/chui_shortcut_help/shortcut_help.js +32 -34
- package/framework/components/chui_sidebar_nav/sidebar_nav.js +98 -29
- package/framework/components/chui_sidebar_nav/styles.css +9 -3
- package/framework/components/chui_slideshow/slideshow.js +85 -85
- package/framework/components/chui_slideshow/styles.css +6 -6
- package/framework/components/chui_spinner/spinner.js +10 -10
- package/framework/components/chui_split_button/split_button.js +30 -12
- package/framework/components/chui_split_button/styles.css +21 -5
- package/framework/components/chui_splitter/splitter.js +11 -11
- package/framework/components/chui_splitter/styles.css +2 -2
- package/framework/components/chui_statistic/statistic.js +47 -47
- package/framework/components/chui_status_bar/styles.css +2 -2
- package/framework/components/chui_stepper/stepper.js +202 -31
- package/framework/components/chui_stepper/styles.css +79 -14
- package/framework/components/chui_sticky_bar/sticky_bar.js +44 -13
- package/framework/components/chui_sticky_bar/styles.css +10 -8
- package/framework/components/chui_tabs/chui_tabs.js +74 -26
- package/framework/components/chui_tabs/styles.css +40 -12
- package/framework/components/chui_text_editor/styles.css +7 -7
- package/framework/components/chui_text_editor/text_editor.js +56 -56
- package/framework/components/chui_text_editor/text_editor_panel.js +173 -174
- package/framework/components/chui_theme_toggle/theme_toggle.js +21 -5
- package/framework/components/chui_timeline/styles.css +3 -1
- package/framework/components/chui_toast_queue/styles.css +11 -11
- package/framework/components/chui_toast_queue/toast_queue.js +30 -27
- package/framework/components/chui_toolbar/styles.css +2 -2
- package/framework/components/chui_tooltip/styles.css +2 -2
- package/framework/components/chui_tooltip/tooltip.js +3 -3
- package/framework/components/chui_tour/styles.css +8 -8
- package/framework/components/chui_tour/tour.js +72 -72
- package/framework/components/chui_transfer/styles.css +6 -6
- package/framework/components/chui_transfer/transfer.js +93 -106
- package/framework/components/chui_tree_table/styles.css +4 -4
- package/framework/components/chui_tree_table/tree_table.js +45 -45
- package/framework/components/chui_tree_view/styles.css +10 -8
- package/framework/components/chui_tree_view/tree_view.js +185 -183
- package/framework/components/chui_user_bar/styles.css +145 -0
- package/framework/components/chui_user_bar/user_bar.js +402 -0
- package/framework/components/chui_user_list_bar/styles.css +173 -0
- package/framework/components/chui_user_list_bar/user_list_bar.js +485 -0
- package/framework/components/chui_watermark/watermark.js +17 -17
- package/framework/components/chui_webview/webview.js +9 -9
- package/framework/components/chui_write_bar/styles.css +172 -0
- package/framework/components/chui_write_bar/write_bar.js +320 -0
- package/framework/main_window.js +1234 -0
- package/framework/modules/chui_a11y/chui_a11y.js +78 -79
- package/framework/modules/chui_animations/animations.js +77 -15
- package/framework/modules/chui_animations/motion.js +120 -0
- package/framework/modules/chui_animations/styles.css +36 -3
- package/framework/modules/chui_functions.js +31 -27
- package/framework/modules/chui_highlight/styles.css +13 -10
- package/framework/modules/chui_i18n/chui_i18n.js +3 -3
- package/framework/modules/chui_i18n/locales/feedback.js +62 -0
- package/framework/modules/chui_i18n/locales/navigation.js +4 -0
- package/framework/modules/chui_json/chui_json.js +2 -2
- package/framework/modules/chui_logger/chui_logger.js +23 -8
- package/framework/modules/chui_page/page.js +10 -10
- package/framework/modules/chui_palette/palette.js +61 -0
- package/framework/modules/chui_qr/chui_qr.js +23 -23
- package/framework/modules/chui_scrollbar/chui_scrollbar.js +45 -45
- package/framework/modules/chui_scrollbar/styles.css +3 -3
- package/framework/modules/chui_services/chui_services.js +8 -8
- package/framework/modules/chui_services/desktop.js +77 -71
- package/framework/modules/chui_sortable/chui_sortable.js +17 -17
- package/framework/modules/chui_validate/chui_validate.js +3 -3
- package/framework/tray_bar/chui_menu_items.js +2 -2
- package/index.d.ts +266 -34
- package/index.js +20 -1168
- package/package.json +6 -4
- package/framework/components/telegram_bot/chui_telegram_bot.js +0 -191
|
@@ -3,6 +3,7 @@ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
|
3
3
|
const { optionOr } = require("../../modules/chui_functions");
|
|
4
4
|
const { SegmentedControl } = require("../chui_segmented_control/segmented_control");
|
|
5
5
|
const { Desktop } = require("../../modules/chui_services/desktop");
|
|
6
|
+
const { reportError } = require("../../modules/chui_logger/chui_logger");
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Переключатель темы: светлая, тёмная и системная (набор задаётся опцией `modes`).
|
|
@@ -38,7 +39,8 @@ class ThemeToggle {
|
|
|
38
39
|
#control = undefined;
|
|
39
40
|
#modes = [ThemeToggle.MODE.LIGHT, ThemeToggle.MODE.DARK, ThemeToggle.MODE.SYSTEM];
|
|
40
41
|
#labels = {};
|
|
41
|
-
#
|
|
42
|
+
#onChange = undefined;
|
|
43
|
+
#onError = undefined;
|
|
42
44
|
#source = undefined;
|
|
43
45
|
#unsubscribe = undefined;
|
|
44
46
|
#bound = false;
|
|
@@ -49,17 +51,19 @@ class ThemeToggle {
|
|
|
49
51
|
labels: {},
|
|
50
52
|
label: String(),
|
|
51
53
|
onChange: undefined,
|
|
54
|
+
onError: undefined,
|
|
52
55
|
}
|
|
53
56
|
) {
|
|
54
57
|
if (Array.isArray(options.modes) && options.modes.length > 0) this.#modes = options.modes;
|
|
55
58
|
this.#labels = options.labels === undefined ? {} : options.labels;
|
|
56
|
-
this.#
|
|
59
|
+
this.#onChange = options.onChange;
|
|
60
|
+
this.#onError = options.onError;
|
|
57
61
|
this.#control = new SegmentedControl({
|
|
58
62
|
id: options.id,
|
|
59
63
|
label: optionOr(options.label, I18n.t("graphics.settingsAppearance")),
|
|
60
64
|
options: this.#modes.map((mode) => ({ value: mode, title: this.#title(mode), icon: this.#icon(mode) })),
|
|
61
65
|
// Нажатие в переключателе — это выбор темы, а не просто новая подсветка
|
|
62
|
-
onChange: (mode) => this
|
|
66
|
+
onChange: (mode) => this.#applyTheme(mode),
|
|
63
67
|
});
|
|
64
68
|
this.#bound = true;
|
|
65
69
|
// Смена темы системой не проходит через переключатель — вид обновляем подпиской
|
|
@@ -71,7 +75,7 @@ class ThemeToggle {
|
|
|
71
75
|
this.#source = state.source;
|
|
72
76
|
this.#syncView(state.theme);
|
|
73
77
|
})
|
|
74
|
-
.catch(() =>
|
|
78
|
+
.catch((error) => reportError(error, this.#onError));
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
// GET
|
|
@@ -115,7 +119,7 @@ class ThemeToggle {
|
|
|
115
119
|
if (!this.#bound) return state;
|
|
116
120
|
this.#source = state.source;
|
|
117
121
|
this.#syncView(state.theme);
|
|
118
|
-
if (this.#
|
|
122
|
+
if (this.#onChange !== undefined) this.#onChange(state.source, state);
|
|
119
123
|
return state;
|
|
120
124
|
});
|
|
121
125
|
}
|
|
@@ -136,6 +140,18 @@ class ThemeToggle {
|
|
|
136
140
|
}
|
|
137
141
|
|
|
138
142
|
// === ВНУТРЕННЕЕ ===
|
|
143
|
+
/**
|
|
144
|
+
* Выбор темы из переключателя. Тема не применилась — сообщаем об ошибке и возвращаем отметку
|
|
145
|
+
* к прежнему источнику: переключатель уже успел показать новый режим, и без отката вид врал бы
|
|
146
|
+
* (отмена идёт тихо, `setValue(..., true)`, поэтому `onChange` не вызывается заново).
|
|
147
|
+
*/
|
|
148
|
+
#applyTheme(mode = String()) {
|
|
149
|
+
this.setTheme(mode).catch((error) => {
|
|
150
|
+
this.#syncView(undefined);
|
|
151
|
+
reportError(error, this.#onError);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
139
155
|
#title(mode = String()) {
|
|
140
156
|
if (this.#labels[mode] !== undefined) return this.#labels[mode];
|
|
141
157
|
const key = ThemeToggle.#DEFAULT_LABEL_KEYS[mode];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
chui_timeline {
|
|
3
3
|
display: block;
|
|
4
4
|
width: -webkit-fill-available;
|
|
5
|
-
margin: var(--
|
|
5
|
+
margin: var(--block_margin);
|
|
6
6
|
color: var(--text_color);
|
|
7
7
|
font-size: var(--font_default_size);
|
|
8
8
|
}
|
|
@@ -24,6 +24,8 @@ chui_timeline[data-size="small"] {
|
|
|
24
24
|
grid-template-rows: 1fr auto 1fr;
|
|
25
25
|
align-items: stretch;
|
|
26
26
|
column-gap: 12px;
|
|
27
|
+
/* Событие ленты встаёт на место: кадр общий — см. `chui_appear_up` в global_style.css */
|
|
28
|
+
animation: chui_appear_up var(--motion_base) var(--motion_ease);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
.timeline_marker {
|
|
@@ -4,31 +4,31 @@ chui_toast_queue {
|
|
|
4
4
|
z-index: 1002;
|
|
5
5
|
display: flex;
|
|
6
6
|
flex-direction: column;
|
|
7
|
-
gap: var(--
|
|
8
|
-
max-width: calc(100% - (var(--
|
|
7
|
+
gap: var(--block_margin);
|
|
8
|
+
max-width: calc(100% - (var(--block_margin) * 2));
|
|
9
9
|
pointer-events: none;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
chui_toast_queue[data-position="bottom_right"] {
|
|
13
|
-
inset-inline-end: var(--
|
|
14
|
-
bottom: var(--
|
|
13
|
+
inset-inline-end: var(--block_margin);
|
|
14
|
+
bottom: var(--block_margin);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
chui_toast_queue[data-position="bottom_left"] {
|
|
18
|
-
inset-inline-start: var(--
|
|
19
|
-
bottom: var(--
|
|
18
|
+
inset-inline-start: var(--block_margin);
|
|
19
|
+
bottom: var(--block_margin);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/* Сверху новые тосты растут к углу — порядок обратный (column-reverse) */
|
|
23
23
|
chui_toast_queue[data-position="top_right"] {
|
|
24
|
-
inset-inline-end: var(--
|
|
25
|
-
top: var(--
|
|
24
|
+
inset-inline-end: var(--block_margin);
|
|
25
|
+
top: var(--block_margin);
|
|
26
26
|
flex-direction: column-reverse;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
chui_toast_queue[data-position="top_left"] {
|
|
30
|
-
inset-inline-start: var(--
|
|
31
|
-
top: var(--
|
|
30
|
+
inset-inline-start: var(--block_margin);
|
|
31
|
+
top: var(--block_margin);
|
|
32
32
|
flex-direction: column-reverse;
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -88,7 +88,7 @@ toast_actions {
|
|
|
88
88
|
display: flex;
|
|
89
89
|
flex-direction: row;
|
|
90
90
|
align-items: center;
|
|
91
|
-
gap: var(--
|
|
91
|
+
gap: var(--block_margin);
|
|
92
92
|
flex-shrink: 0;
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -46,8 +46,8 @@ class Toast {
|
|
|
46
46
|
|
|
47
47
|
#id = undefined;
|
|
48
48
|
#toast = document.createElement("chui_toast");
|
|
49
|
-
#
|
|
50
|
-
#
|
|
49
|
+
#iconBox = undefined;
|
|
50
|
+
#iconCustom = undefined;
|
|
51
51
|
#body = document.createElement("toast_body");
|
|
52
52
|
#title = document.createElement("toast_title");
|
|
53
53
|
#text = document.createElement("toast_text");
|
|
@@ -57,14 +57,14 @@ class Toast {
|
|
|
57
57
|
#style = STYLE.INFO;
|
|
58
58
|
#duration = 0;
|
|
59
59
|
#closable = true;
|
|
60
|
-
#
|
|
61
|
-
#
|
|
60
|
+
#titleUsed = false;
|
|
61
|
+
#textUsed = false;
|
|
62
62
|
//
|
|
63
63
|
#timer = undefined;
|
|
64
64
|
#deadline = 0;
|
|
65
65
|
#remaining = 0;
|
|
66
66
|
#dismissed = false;
|
|
67
|
-
#
|
|
67
|
+
#onDismiss = undefined;
|
|
68
68
|
#listeners = [];
|
|
69
69
|
|
|
70
70
|
constructor(
|
|
@@ -91,32 +91,32 @@ class Toast {
|
|
|
91
91
|
// Пустая заготовка опции равносильна отсутствующей — пустого узла не появляется
|
|
92
92
|
const title = optionOr(options.title, undefined);
|
|
93
93
|
const text = optionOr(options.text, undefined);
|
|
94
|
-
const
|
|
94
|
+
const markdownText = optionOr(options.markdownText, undefined);
|
|
95
95
|
if (title !== undefined) {
|
|
96
|
-
this.#
|
|
96
|
+
this.#titleUsed = true;
|
|
97
97
|
this.#title.innerText = title;
|
|
98
98
|
this.#body.appendChild(this.#title);
|
|
99
99
|
}
|
|
100
|
-
if (text !== undefined &&
|
|
100
|
+
if (text !== undefined && markdownText !== undefined) {
|
|
101
101
|
throw new Error("Должна быть установлена одна опция text или markdownText");
|
|
102
102
|
}
|
|
103
103
|
if (text !== undefined) {
|
|
104
|
-
this.#
|
|
104
|
+
this.#textUsed = true;
|
|
105
105
|
this.#text.innerText = text;
|
|
106
106
|
this.#body.appendChild(this.#text);
|
|
107
107
|
}
|
|
108
|
-
if (
|
|
109
|
-
this.#
|
|
110
|
-
this.#text.innerHTML = markdownToHtml(
|
|
108
|
+
if (markdownText !== undefined) {
|
|
109
|
+
this.#textUsed = true;
|
|
110
|
+
this.#text.innerHTML = markdownToHtml(markdownText);
|
|
111
111
|
this.#body.appendChild(this.#text);
|
|
112
112
|
}
|
|
113
113
|
const icon = options.icon;
|
|
114
114
|
// Пустая опция icon отключает иконку (в том числе иконку стиля) — пустой бокс не ставим.
|
|
115
115
|
// Плашка общая с карточками уведомлений: цвет статуса и фигура — одни на всех
|
|
116
116
|
if (icon !== "") {
|
|
117
|
-
this.#
|
|
118
|
-
this.#
|
|
119
|
-
this.#toast.appendChild(this.#
|
|
117
|
+
this.#iconCustom = icon;
|
|
118
|
+
this.#iconBox = createStatusPlate(PLATE_STATUS[this.#style], icon);
|
|
119
|
+
this.#toast.appendChild(this.#iconBox);
|
|
120
120
|
}
|
|
121
121
|
this.#toast.appendChild(this.#body);
|
|
122
122
|
if (options.action !== undefined) this.#addAction(options.action);
|
|
@@ -131,11 +131,11 @@ class Toast {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
getTitle() {
|
|
134
|
-
return this.#
|
|
134
|
+
return this.#titleUsed ? this.#title.innerText : "";
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
getText() {
|
|
138
|
-
return this.#
|
|
138
|
+
return this.#textUsed ? this.#text.innerText : "";
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
getStyle() {
|
|
@@ -158,8 +158,8 @@ class Toast {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
setTitle(title = String()) {
|
|
161
|
-
if (!this.#
|
|
162
|
-
this.#
|
|
161
|
+
if (!this.#titleUsed) {
|
|
162
|
+
this.#titleUsed = true;
|
|
163
163
|
this.#body.prepend(this.#title);
|
|
164
164
|
}
|
|
165
165
|
this.#title.innerText = title;
|
|
@@ -167,8 +167,8 @@ class Toast {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
setText(text = String()) {
|
|
170
|
-
if (!this.#
|
|
171
|
-
this.#
|
|
170
|
+
if (!this.#textUsed) {
|
|
171
|
+
this.#textUsed = true;
|
|
172
172
|
this.#body.appendChild(this.#text);
|
|
173
173
|
}
|
|
174
174
|
this.#text.innerText = text;
|
|
@@ -179,7 +179,7 @@ class Toast {
|
|
|
179
179
|
this.#style = style;
|
|
180
180
|
for (const value of Object.values(STYLE)) this.#toast.classList.toggle(value, value === style);
|
|
181
181
|
// Плашка перекрашивается вместе со стилем, а свой значок остаётся собой
|
|
182
|
-
if (this.#
|
|
182
|
+
if (this.#iconBox !== undefined) setStatusPlate(this.#iconBox, PLATE_STATUS[style], this.#iconCustom);
|
|
183
183
|
// Ошибку объявляем сразу, остальное — вежливо
|
|
184
184
|
this.#toast.setAttribute("role", style === STYLE.ERROR ? "alert" : "status");
|
|
185
185
|
return this;
|
|
@@ -193,7 +193,7 @@ class Toast {
|
|
|
193
193
|
|
|
194
194
|
/** Колбэк «тост убран» — очередь снимает его со своего учёта */
|
|
195
195
|
onDismiss(listener = () => {}) {
|
|
196
|
-
this.#
|
|
196
|
+
this.#onDismiss = listener;
|
|
197
197
|
return this;
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -236,7 +236,10 @@ class Toast {
|
|
|
236
236
|
this.#clearTimer();
|
|
237
237
|
this.#notifyDismiss();
|
|
238
238
|
// Анимация уходa сработает только при заданном animationName — ставим его, если тост не показывали
|
|
239
|
-
if (this.#toast.style.animationName === "")
|
|
239
|
+
if (this.#toast.style.animationName === "") {
|
|
240
|
+
this.#toast.style.animationName = "fade-in";
|
|
241
|
+
this.#toast.dataset.motion = "enter";
|
|
242
|
+
}
|
|
240
243
|
new Animation(this.#toast).fadeOutAndRemove();
|
|
241
244
|
return this;
|
|
242
245
|
}
|
|
@@ -274,9 +277,9 @@ class Toast {
|
|
|
274
277
|
}
|
|
275
278
|
|
|
276
279
|
#notifyDismiss() {
|
|
277
|
-
if (this.#
|
|
278
|
-
const listener = this.#
|
|
279
|
-
this.#
|
|
280
|
+
if (this.#onDismiss === undefined) return;
|
|
281
|
+
const listener = this.#onDismiss;
|
|
282
|
+
this.#onDismiss = undefined;
|
|
280
283
|
listener(this);
|
|
281
284
|
}
|
|
282
285
|
|
|
@@ -6,10 +6,10 @@ chui_toolbar {
|
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
width: max-content;
|
|
8
8
|
max-width: -webkit-fill-available;
|
|
9
|
-
margin: var(--
|
|
9
|
+
margin: var(--block_margin);
|
|
10
10
|
padding: 3px;
|
|
11
11
|
border: 1px solid var(--border_color);
|
|
12
|
-
border-radius: var(--
|
|
12
|
+
border-radius: var(--radius_sm);
|
|
13
13
|
background: var(--element_background_2);
|
|
14
14
|
overflow-x: auto;
|
|
15
15
|
}
|
|
@@ -11,7 +11,7 @@ chui_tooltip {
|
|
|
11
11
|
width: max-content;
|
|
12
12
|
padding: var(--control_padding);
|
|
13
13
|
border: 1px solid var(--border_color);
|
|
14
|
-
border-radius: var(--
|
|
14
|
+
border-radius: var(--radius_sm);
|
|
15
15
|
background: var(--header_background);
|
|
16
16
|
backdrop-filter: var(--global_blur);
|
|
17
17
|
-webkit-backdrop-filter: var(--global_blur);
|
|
@@ -22,7 +22,7 @@ chui_tooltip {
|
|
|
22
22
|
line-height: 1.35;
|
|
23
23
|
text-align: start;
|
|
24
24
|
pointer-events: none;
|
|
25
|
-
animation: chui_tooltip_fade_in
|
|
25
|
+
animation: chui_tooltip_fade_in var(--motion_fast) var(--motion_ease);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
chui_tooltip p {
|
|
@@ -57,8 +57,8 @@ class Tooltip {
|
|
|
57
57
|
setStyles(__dirname + "/styles.css", "chUiJS_Tooltip");
|
|
58
58
|
// Пустая заготовка опции равносильна отсутствующей
|
|
59
59
|
const text = optionOr(options.text, undefined);
|
|
60
|
-
const
|
|
61
|
-
if (text !== undefined &&
|
|
60
|
+
const markdownText = optionOr(options.markdownText, undefined);
|
|
61
|
+
if (text !== undefined && markdownText !== undefined) {
|
|
62
62
|
throw new Error("Должна быть установлена одна опция text или markdownText");
|
|
63
63
|
}
|
|
64
64
|
Tooltip.#counter += 1;
|
|
@@ -70,7 +70,7 @@ class Tooltip {
|
|
|
70
70
|
this.#tooltip.id = this.#id;
|
|
71
71
|
this.#tooltip.setAttribute("role", "tooltip");
|
|
72
72
|
if (text !== undefined) this.#tooltip.innerText = text;
|
|
73
|
-
if (
|
|
73
|
+
if (markdownText !== undefined) this.#tooltip.innerHTML = markdownToHtml(markdownText);
|
|
74
74
|
// Элемент живёт в body: координаты считаются в системе окна (position: fixed),
|
|
75
75
|
// а внутри карточек с backdrop-filter/filter предок стал бы системой отсчёта.
|
|
76
76
|
document.body.appendChild(this.#tooltip);
|
|
@@ -16,16 +16,16 @@ chui_tour {
|
|
|
16
16
|
Тень обрезается слоем, поэтому не вылезает за окно. */
|
|
17
17
|
tour_highlight {
|
|
18
18
|
position: absolute;
|
|
19
|
-
border-radius: var(--
|
|
19
|
+
border-radius: var(--radius_sm);
|
|
20
20
|
box-shadow:
|
|
21
21
|
0 0 0 1px var(--blue_prime_background),
|
|
22
22
|
0 0 0 9999px var(--modal_scrim);
|
|
23
23
|
pointer-events: none;
|
|
24
24
|
transition:
|
|
25
|
-
left var(--
|
|
26
|
-
top var(--
|
|
27
|
-
width var(--
|
|
28
|
-
height var(--
|
|
25
|
+
left var(--motion_base) var(--motion_ease),
|
|
26
|
+
top var(--motion_base) var(--motion_ease),
|
|
27
|
+
width var(--motion_base) var(--motion_ease),
|
|
28
|
+
height var(--motion_base) var(--motion_ease);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/* Без затемнения остаётся только рамка подсветки */
|
|
@@ -87,7 +87,7 @@ chui_tour tour_counter {
|
|
|
87
87
|
height: var(--toolbar_control_size);
|
|
88
88
|
margin: 0;
|
|
89
89
|
padding: 0;
|
|
90
|
-
border-radius: var(--
|
|
90
|
+
border-radius: var(--radius_sm);
|
|
91
91
|
background: var(--button_background);
|
|
92
92
|
border: 1px solid var(--button_border_color);
|
|
93
93
|
color: var(--text_color);
|
|
@@ -120,8 +120,8 @@ chui_tour tour_counter {
|
|
|
120
120
|
.tour_next:hover {
|
|
121
121
|
/* Главное действие остаётся акцентным и под курсором: фон лишь чуть
|
|
122
122
|
разжижается, текст остаётся белым — иначе тёмное по синему */
|
|
123
|
-
background: var(--
|
|
124
|
-
border-color: var(--
|
|
123
|
+
background: var(--blue_prime_background_tint_strong);
|
|
124
|
+
border-color: var(--blue_prime_background_tint_strong);
|
|
125
125
|
color: var(--text_color_hover);
|
|
126
126
|
}
|
|
127
127
|
|