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
|
@@ -2,6 +2,7 @@ const { setStyles, optionOr } = require("../../modules/chui_functions");
|
|
|
2
2
|
const { Icon, Icons } = require("../chui_icons/icons");
|
|
3
3
|
const { Desktop } = require("../../modules/chui_services/desktop");
|
|
4
4
|
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
5
|
+
const { reportError } = require("../../modules/chui_logger/chui_logger");
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Панель истории буфера обмена: последние тексты, которые приложение кладло в буфер.
|
|
@@ -25,16 +26,17 @@ class ClipboardHistory {
|
|
|
25
26
|
|
|
26
27
|
#root = document.createElement("chui_clipboard_history");
|
|
27
28
|
#title = document.createElement("clipboard_history_title");
|
|
28
|
-
#
|
|
29
|
+
#clearButton = document.createElement("button");
|
|
29
30
|
#list = document.createElement("clipboard_history_list");
|
|
30
31
|
#empty = document.createElement("clipboard_history_empty");
|
|
31
32
|
#status = document.createElement("clipboard_history_status");
|
|
32
33
|
#id = undefined;
|
|
33
34
|
#items = [];
|
|
34
35
|
#truncate = 80;
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
36
|
+
#emptyText = I18n.t("graphics.clipboardEmpty");
|
|
37
|
+
#showClear = true;
|
|
38
|
+
#onChange = undefined;
|
|
39
|
+
#onError = undefined;
|
|
38
40
|
#unsubscribe = undefined;
|
|
39
41
|
#bound = false;
|
|
40
42
|
|
|
@@ -47,6 +49,7 @@ class ClipboardHistory {
|
|
|
47
49
|
label: String(),
|
|
48
50
|
showClear: Boolean(),
|
|
49
51
|
onChange: undefined,
|
|
52
|
+
onError: undefined,
|
|
50
53
|
}
|
|
51
54
|
) {
|
|
52
55
|
setStyles(__dirname + "/styles.css", "chUiJS_ClipboardHistory");
|
|
@@ -56,23 +59,24 @@ class ClipboardHistory {
|
|
|
56
59
|
// Панель — именованный регион: к ней можно перейти с клавиатуры и из списка регионов
|
|
57
60
|
this.#root.setAttribute("role", "region");
|
|
58
61
|
this.#truncate = options.truncate === undefined ? this.#truncate : options.truncate;
|
|
59
|
-
this.#
|
|
60
|
-
this.#
|
|
61
|
-
this.#
|
|
62
|
+
this.#emptyText = options.emptyText === undefined ? this.#emptyText : options.emptyText;
|
|
63
|
+
this.#showClear = options.showClear !== false;
|
|
64
|
+
this.#onChange = options.onChange;
|
|
65
|
+
this.#onError = options.onError;
|
|
62
66
|
this.setTitle(optionOr(options.title, I18n.t("graphics.clipboardHistory")));
|
|
63
67
|
this.setLabel(optionOr(options.label, this.#title.innerText));
|
|
64
68
|
this.#list.setAttribute("role", "list");
|
|
65
|
-
this.#
|
|
66
|
-
this.#
|
|
67
|
-
this.#
|
|
68
|
-
this.#
|
|
69
|
-
this.#empty.innerText = this.#
|
|
69
|
+
this.#clearButton.type = "button";
|
|
70
|
+
this.#clearButton.className = "clipboard_history_clear";
|
|
71
|
+
this.#clearButton.innerText = I18n.t("common.clear");
|
|
72
|
+
this.#clearButton.addEventListener("click", this.#onClear);
|
|
73
|
+
this.#empty.innerText = this.#emptyText;
|
|
70
74
|
this.#status.classList.add("chui_visually_hidden");
|
|
71
75
|
this.#status.setAttribute("role", "status");
|
|
72
76
|
this.#status.setAttribute("aria-live", "polite");
|
|
73
77
|
const head = document.createElement("clipboard_history_head");
|
|
74
78
|
head.appendChild(this.#title);
|
|
75
|
-
if (this.#
|
|
79
|
+
if (this.#showClear) head.appendChild(this.#clearButton);
|
|
76
80
|
this.#root.appendChild(head);
|
|
77
81
|
this.#root.appendChild(this.#list);
|
|
78
82
|
this.#root.appendChild(this.#empty);
|
|
@@ -88,7 +92,8 @@ class ClipboardHistory {
|
|
|
88
92
|
.then((items) => {
|
|
89
93
|
if (this.#bound) this.#render(items);
|
|
90
94
|
})
|
|
91
|
-
|
|
95
|
+
// Первичную загрузку тоже не глушим: при сбое панель осталась бы пустой без причины
|
|
96
|
+
.catch((error) => reportError(error, this.#onError));
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
// GET
|
|
@@ -128,7 +133,7 @@ class ClipboardHistory {
|
|
|
128
133
|
}
|
|
129
134
|
|
|
130
135
|
setEmptyText(text = String()) {
|
|
131
|
-
this.#
|
|
136
|
+
this.#emptyText = text;
|
|
132
137
|
this.#empty.innerText = text;
|
|
133
138
|
return this;
|
|
134
139
|
}
|
|
@@ -192,8 +197,8 @@ class ClipboardHistory {
|
|
|
192
197
|
this.#items.forEach((text, index) => this.#list.appendChild(this.#createItem(text, index)));
|
|
193
198
|
this.#list.hidden = this.#items.length === 0;
|
|
194
199
|
this.#empty.hidden = this.#items.length > 0;
|
|
195
|
-
this.#
|
|
196
|
-
if (this.#
|
|
200
|
+
this.#clearButton.disabled = this.#items.length === 0;
|
|
201
|
+
if (this.#onChange !== undefined) this.#onChange(this.getItems());
|
|
197
202
|
}
|
|
198
203
|
|
|
199
204
|
#createItem(text = String(), index = Number()) {
|
|
@@ -230,14 +235,14 @@ class ClipboardHistory {
|
|
|
230
235
|
if (button === null || !this.#list.contains(button)) return;
|
|
231
236
|
const item = button.closest("clipboard_history_item");
|
|
232
237
|
const index = Number(item.dataset.index);
|
|
233
|
-
if (button.dataset.action === "copy") this.copy(index).catch(() =>
|
|
234
|
-
else this.remove(index).catch(() =>
|
|
238
|
+
if (button.dataset.action === "copy") this.copy(index).catch((error) => reportError(error, this.#onError));
|
|
239
|
+
else this.remove(index).catch((error) => reportError(error, this.#onError));
|
|
235
240
|
};
|
|
236
241
|
|
|
237
242
|
#onClear = () => {
|
|
238
243
|
this.clear()
|
|
239
244
|
.then(() => this.#announce(I18n.t("graphics.clipboardCleared")))
|
|
240
|
-
.catch(() =>
|
|
245
|
+
.catch((error) => reportError(error, this.#onError));
|
|
241
246
|
};
|
|
242
247
|
}
|
|
243
248
|
|
|
@@ -3,12 +3,12 @@ chui_clipboard_history {
|
|
|
3
3
|
display: block;
|
|
4
4
|
width: -webkit-fill-available;
|
|
5
5
|
box-sizing: border-box;
|
|
6
|
-
margin: var(--
|
|
6
|
+
margin: var(--block_margin);
|
|
7
7
|
color: var(--text_color);
|
|
8
8
|
font-size: var(--font_default_size);
|
|
9
9
|
background: var(--element_background_2);
|
|
10
10
|
border: 1px solid var(--border_color);
|
|
11
|
-
border-radius: var(--
|
|
11
|
+
border-radius: var(--radius_sm);
|
|
12
12
|
overflow: hidden;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ clipboard_history_head {
|
|
|
17
17
|
align-items: center;
|
|
18
18
|
justify-content: space-between;
|
|
19
19
|
gap: 12px;
|
|
20
|
-
padding: var(--
|
|
20
|
+
padding: var(--block_padding);
|
|
21
21
|
border-bottom: 1px solid var(--border_color);
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -28,7 +28,7 @@ clipboard_history_title {
|
|
|
28
28
|
button.clipboard_history_clear {
|
|
29
29
|
padding: 2px 10px;
|
|
30
30
|
border: none;
|
|
31
|
-
border-radius: var(--
|
|
31
|
+
border-radius: var(--radius_sm);
|
|
32
32
|
background: var(--element_background);
|
|
33
33
|
color: var(--text_color);
|
|
34
34
|
font-family: inherit;
|
|
@@ -66,7 +66,9 @@ clipboard_history_item {
|
|
|
66
66
|
align-items: center;
|
|
67
67
|
gap: 6px;
|
|
68
68
|
padding-block: 2px 2px;
|
|
69
|
-
padding-inline: 4px var(--
|
|
69
|
+
padding-inline: 4px var(--block_padding);
|
|
70
|
+
/* Новый элемент буфера встаёт на место: кадр общий — см. `chui_appear_up` в global_style.css */
|
|
71
|
+
animation: chui_appear_up var(--motion_base) var(--motion_ease);
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
clipboard_history_item + clipboard_history_item {
|
|
@@ -81,7 +83,7 @@ button.clipboard_history_text {
|
|
|
81
83
|
min-width: 0;
|
|
82
84
|
padding: 6px 8px;
|
|
83
85
|
border: none;
|
|
84
|
-
border-radius: var(--
|
|
86
|
+
border-radius: var(--radius_sm);
|
|
85
87
|
background: transparent;
|
|
86
88
|
color: var(--text_color);
|
|
87
89
|
font-family: inherit;
|
|
@@ -121,7 +123,7 @@ button.clipboard_history_remove {
|
|
|
121
123
|
height: 26px;
|
|
122
124
|
padding: 0;
|
|
123
125
|
border: none;
|
|
124
|
-
border-radius: var(--
|
|
126
|
+
border-radius: var(--radius_sm);
|
|
125
127
|
background: transparent;
|
|
126
128
|
color: var(--text_color_disabled);
|
|
127
129
|
cursor: pointer;
|
|
@@ -134,7 +136,7 @@ button.clipboard_history_remove:hover {
|
|
|
134
136
|
|
|
135
137
|
clipboard_history_empty {
|
|
136
138
|
display: block;
|
|
137
|
-
padding: var(--
|
|
139
|
+
padding: var(--block_padding);
|
|
138
140
|
text-align: center;
|
|
139
141
|
color: var(--text_color_disabled);
|
|
140
142
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
class CodeBlock {
|
|
2
|
-
#
|
|
2
|
+
#chuiCode = document.createElement(`code`);
|
|
3
3
|
constructor(text = String(), options = { textAlign: String(), wordBreak: String(), width: String() }) {
|
|
4
4
|
require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_code");
|
|
5
|
-
this.#
|
|
6
|
-
this.#
|
|
7
|
-
if (options.textAlign !== undefined) this.#
|
|
8
|
-
if (options.wordBreak !== undefined) this.#
|
|
9
|
-
if (options.width !== undefined) this.#
|
|
5
|
+
this.#chuiCode.innerText = text;
|
|
6
|
+
this.#chuiCode.classList.add("chui_code");
|
|
7
|
+
if (options.textAlign !== undefined) this.#chuiCode.style.textAlign = options.textAlign;
|
|
8
|
+
if (options.wordBreak !== undefined) this.#chuiCode.style.wordBreak = options.wordBreak;
|
|
9
|
+
if (options.width !== undefined) this.#chuiCode.style.width = options.width;
|
|
10
10
|
}
|
|
11
11
|
setText(text = String()) {
|
|
12
|
-
this.#
|
|
12
|
+
this.#chuiCode.innerText = text;
|
|
13
13
|
}
|
|
14
14
|
set() {
|
|
15
|
-
return this.#
|
|
15
|
+
return this.#chuiCode;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
height: max-content;
|
|
8
8
|
width: max-content;
|
|
9
|
-
margin: var(--
|
|
9
|
+
margin: var(--block_margin);
|
|
10
10
|
padding: 10px 12px;
|
|
11
11
|
background: var(--element_background_2);
|
|
12
12
|
border: 1px solid var(--border_color);
|
|
13
|
-
border-radius: var(--
|
|
13
|
+
border-radius: var(--radius_sm);
|
|
14
14
|
font-family: "chui_mono", monospace;
|
|
15
15
|
font-size: var(--font_default_size);
|
|
16
16
|
font-weight: 400;
|
|
@@ -51,13 +51,13 @@ class CodeEditor {
|
|
|
51
51
|
#input = document.createElement("textarea");
|
|
52
52
|
#id = undefined;
|
|
53
53
|
#language = CodeEditor.LANGUAGE.JAVASCRIPT;
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
#
|
|
54
|
+
#lineNumbers = true;
|
|
55
|
+
#readOnly = false;
|
|
56
|
+
#tabSize = 4;
|
|
57
57
|
#label = undefined;
|
|
58
58
|
#placeholder = undefined;
|
|
59
|
-
#
|
|
60
|
-
#
|
|
59
|
+
#onChange = undefined;
|
|
60
|
+
#onSave = undefined;
|
|
61
61
|
|
|
62
62
|
constructor(
|
|
63
63
|
options = {
|
|
@@ -82,12 +82,12 @@ class CodeEditor {
|
|
|
82
82
|
this.#id = options.id === undefined ? `chui_code_editor_${CodeEditor.#counter}` : options.id;
|
|
83
83
|
this.#root.id = this.#id;
|
|
84
84
|
this.#language = options.language === undefined ? this.#language : options.language;
|
|
85
|
-
this.#
|
|
86
|
-
this.#
|
|
85
|
+
this.#lineNumbers = options.lineNumbers !== false;
|
|
86
|
+
this.#tabSize = options.tabSize === undefined ? this.#tabSize : options.tabSize;
|
|
87
87
|
this.#label = options.label;
|
|
88
88
|
this.#placeholder = options.placeholder;
|
|
89
|
-
this.#
|
|
90
|
-
this.#
|
|
89
|
+
this.#onChange = options.onChange;
|
|
90
|
+
this.#onSave = options.onSave;
|
|
91
91
|
this.#title.innerText = options.title === undefined ? "" : options.title;
|
|
92
92
|
this.#title.hidden = options.title === undefined;
|
|
93
93
|
// Текст и подсветка — нативные <textarea> и <pre>, поэтому у них классы, а не теги
|
|
@@ -107,11 +107,11 @@ class CodeEditor {
|
|
|
107
107
|
this.#body.appendChild(this.#input);
|
|
108
108
|
if (options.title !== undefined) this.#root.appendChild(this.#title);
|
|
109
109
|
this.#root.appendChild(this.#body);
|
|
110
|
-
this.#root.style.setProperty("--code_editor_tab_size", String(this.#
|
|
110
|
+
this.#root.style.setProperty("--code_editor_tab_size", String(this.#tabSize));
|
|
111
111
|
if (options.height !== undefined) this.setHeight(options.height);
|
|
112
112
|
if (options.wide === true) this.#root.classList.add("code_editor_wide");
|
|
113
113
|
// Скрытые номера строк — это класс с нулевой шириной колонки, а не только флаг
|
|
114
|
-
this.#root.classList.toggle("code_editor_no_lines", !this.#
|
|
114
|
+
this.#root.classList.toggle("code_editor_no_lines", !this.#lineNumbers);
|
|
115
115
|
this.setReadOnly(options.readOnly === true);
|
|
116
116
|
this.#input.addEventListener("input", this.#onInput);
|
|
117
117
|
this.#input.addEventListener("scroll", this.#syncScroll);
|
|
@@ -138,15 +138,15 @@ class CodeEditor {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
isReadOnly() {
|
|
141
|
-
return this.#
|
|
141
|
+
return this.#readOnly;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
isLineNumbersVisible() {
|
|
145
|
-
return this.#
|
|
145
|
+
return this.#lineNumbers;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
getTabSize() {
|
|
149
|
-
return this.#
|
|
149
|
+
return this.#tabSize;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// SET
|
|
@@ -189,22 +189,22 @@ class CodeEditor {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
setReadOnly(readOnly = Boolean()) {
|
|
192
|
-
this.#
|
|
193
|
-
this.#input.readOnly = this.#
|
|
194
|
-
this.#root.classList.toggle("code_editor_readonly", this.#
|
|
192
|
+
this.#readOnly = readOnly === true;
|
|
193
|
+
this.#input.readOnly = this.#readOnly;
|
|
194
|
+
this.#root.classList.toggle("code_editor_readonly", this.#readOnly);
|
|
195
195
|
return this;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
setLineNumbers(visible = Boolean()) {
|
|
199
|
-
this.#
|
|
200
|
-
this.#root.classList.toggle("code_editor_no_lines", !this.#
|
|
199
|
+
this.#lineNumbers = visible === true;
|
|
200
|
+
this.#root.classList.toggle("code_editor_no_lines", !this.#lineNumbers);
|
|
201
201
|
this.#refresh();
|
|
202
202
|
return this;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
setTabSize(size = Number()) {
|
|
206
|
-
this.#
|
|
207
|
-
this.#root.style.setProperty("--code_editor_tab_size", String(this.#
|
|
206
|
+
this.#tabSize = size;
|
|
207
|
+
this.#root.style.setProperty("--code_editor_tab_size", String(this.#tabSize));
|
|
208
208
|
return this;
|
|
209
209
|
}
|
|
210
210
|
|
|
@@ -248,7 +248,7 @@ class CodeEditor {
|
|
|
248
248
|
this.#input.selectionStart = caret;
|
|
249
249
|
this.#input.selectionEnd = caret;
|
|
250
250
|
}
|
|
251
|
-
if (this.#
|
|
251
|
+
if (this.#onChange !== undefined) this.#onChange(value);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
#refresh() {
|
|
@@ -260,7 +260,7 @@ class CodeEditor {
|
|
|
260
260
|
this.#code.innerHTML = highlight(value, this.#language);
|
|
261
261
|
}
|
|
262
262
|
const lines = value.split("\n").length;
|
|
263
|
-
this.#lines.innerText = this.#
|
|
263
|
+
this.#lines.innerText = this.#lineNumbers
|
|
264
264
|
? Array.from({ length: lines }, (_, index) => index + 1).join("\n")
|
|
265
265
|
: "";
|
|
266
266
|
this.#syncScroll();
|
|
@@ -275,7 +275,7 @@ class CodeEditor {
|
|
|
275
275
|
|
|
276
276
|
#onInput = () => {
|
|
277
277
|
this.#refresh();
|
|
278
|
-
if (this.#
|
|
278
|
+
if (this.#onChange !== undefined) this.#onChange(this.getValue());
|
|
279
279
|
};
|
|
280
280
|
|
|
281
281
|
#onKeyDown = (event) => {
|
|
@@ -284,12 +284,12 @@ class CodeEditor {
|
|
|
284
284
|
const end = this.#input.selectionEnd === undefined ? value.length : this.#input.selectionEnd;
|
|
285
285
|
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "s") {
|
|
286
286
|
event.preventDefault();
|
|
287
|
-
if (this.#
|
|
287
|
+
if (this.#onSave !== undefined) this.#onSave(value);
|
|
288
288
|
return;
|
|
289
289
|
}
|
|
290
290
|
if (event.key === "Tab") {
|
|
291
291
|
event.preventDefault();
|
|
292
|
-
if (this.#
|
|
292
|
+
if (this.#readOnly) return;
|
|
293
293
|
if (event.shiftKey) this.#outdent();
|
|
294
294
|
else this.#indent();
|
|
295
295
|
return;
|
|
@@ -6,11 +6,11 @@ chui_code_editor {
|
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
width: -webkit-fill-available;
|
|
8
8
|
box-sizing: border-box;
|
|
9
|
-
margin: var(--
|
|
9
|
+
margin: var(--block_margin);
|
|
10
10
|
color: var(--text_color);
|
|
11
11
|
background: var(--element_background_2);
|
|
12
12
|
border: 1px solid var(--border_color);
|
|
13
|
-
border-radius: var(--
|
|
13
|
+
border-radius: var(--radius_sm);
|
|
14
14
|
font-family: "chui_mono", monospace;
|
|
15
15
|
font-size: var(--font_default_size);
|
|
16
16
|
overflow: hidden;
|
|
@@ -111,7 +111,7 @@ textarea.code_editor_input {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
textarea.code_editor_input::selection {
|
|
114
|
-
background: var(--
|
|
114
|
+
background: var(--blue_prime_background_tint_strong);
|
|
115
115
|
color: transparent;
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -53,7 +53,7 @@ class CommandPalette {
|
|
|
53
53
|
// Занавес на всё окно: он же элемент слоя для OverlayA11y
|
|
54
54
|
#palette = document.createElement("chui_command_palette");
|
|
55
55
|
#panel = document.createElement("command_palette_panel");
|
|
56
|
-
#
|
|
56
|
+
#inputBox = document.createElement("command_palette_input");
|
|
57
57
|
#input = document.createElement("input");
|
|
58
58
|
// Область результатов: список и надпись «ничего не найдено» в одной рамке
|
|
59
59
|
// (надпись центрируется в ней по вертикали, а высота панели не прыгает)
|
|
@@ -70,13 +70,13 @@ class CommandPalette {
|
|
|
70
70
|
#query = "";
|
|
71
71
|
#label = CommandPalette.DEFAULT_LABEL;
|
|
72
72
|
#placeholder = CommandPalette.DEFAULT_PLACEHOLDER;
|
|
73
|
-
#
|
|
73
|
+
#emptyText = CommandPalette.DEFAULT_EMPTY_TEXT;
|
|
74
74
|
#limit = CommandPalette.DEFAULT_LIMIT;
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
75
|
+
#recentEnabled = true;
|
|
76
|
+
#closeOnRun = true;
|
|
77
|
+
#onRun = undefined;
|
|
78
78
|
#hotkey = undefined;
|
|
79
|
-
#
|
|
79
|
+
#hotkeyHandler = undefined;
|
|
80
80
|
isOpen = false;
|
|
81
81
|
|
|
82
82
|
constructor(
|
|
@@ -102,25 +102,25 @@ class CommandPalette {
|
|
|
102
102
|
this.#label = optionOr(options.label, CommandPalette.DEFAULT_LABEL);
|
|
103
103
|
this.#placeholder =
|
|
104
104
|
options.placeholder === undefined ? CommandPalette.DEFAULT_PLACEHOLDER : options.placeholder;
|
|
105
|
-
this.#
|
|
105
|
+
this.#emptyText = options.emptyText === undefined ? CommandPalette.DEFAULT_EMPTY_TEXT : options.emptyText;
|
|
106
106
|
this.#limit = options.limit === undefined ? CommandPalette.DEFAULT_LIMIT : options.limit;
|
|
107
|
-
this.#
|
|
108
|
-
this.#
|
|
109
|
-
this.#
|
|
107
|
+
this.#recentEnabled = options.recent === undefined ? true : options.recent;
|
|
108
|
+
this.#closeOnRun = options.closeOnRun === undefined ? true : options.closeOnRun;
|
|
109
|
+
this.#onRun = options.onRun;
|
|
110
110
|
// Поле поиска
|
|
111
111
|
this.#list.id = `${this.#id}_list`;
|
|
112
112
|
this.#input.type = "text";
|
|
113
113
|
this.#input.setAttribute("autocomplete", "off");
|
|
114
114
|
this.#input.placeholder = this.#placeholder;
|
|
115
115
|
this.#input.id = `${this.#id}_input`;
|
|
116
|
-
this.#
|
|
117
|
-
this.#
|
|
118
|
-
this.#empty.innerText = this.#
|
|
116
|
+
this.#inputBox.appendChild(new Icon(Icons.ACTIONS.SEARCH, "18px", "var(--text_color_disabled)").set());
|
|
117
|
+
this.#inputBox.appendChild(this.#input);
|
|
118
|
+
this.#empty.innerText = this.#emptyText;
|
|
119
119
|
this.#empty.hidden = true;
|
|
120
120
|
this.#status.classList.add("chui_visually_hidden");
|
|
121
121
|
this.#status.setAttribute("role", "status");
|
|
122
122
|
this.#status.setAttribute("aria-live", "polite");
|
|
123
|
-
this.#panel.appendChild(this.#
|
|
123
|
+
this.#panel.appendChild(this.#inputBox);
|
|
124
124
|
this.#results.appendChild(this.#list);
|
|
125
125
|
this.#results.appendChild(this.#empty);
|
|
126
126
|
this.#results.appendChild(this.#status);
|
|
@@ -159,7 +159,7 @@ class CommandPalette {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
getEmptyText() {
|
|
162
|
-
return this.#
|
|
162
|
+
return this.#emptyText;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
getQuery() {
|
|
@@ -213,7 +213,7 @@ class CommandPalette {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
setEmptyText(text = String()) {
|
|
216
|
-
this.#
|
|
216
|
+
this.#emptyText = text;
|
|
217
217
|
this.#empty.innerText = text;
|
|
218
218
|
return this;
|
|
219
219
|
}
|
|
@@ -274,7 +274,7 @@ class CommandPalette {
|
|
|
274
274
|
this.#query = "";
|
|
275
275
|
this.#input.value = "";
|
|
276
276
|
this.#apply("");
|
|
277
|
-
new Animation(this.#palette).
|
|
277
|
+
new Animation(this.#palette).panelIn();
|
|
278
278
|
this.#a11y.open();
|
|
279
279
|
this.#keyboard.setExpanded(true);
|
|
280
280
|
this.#input.focus();
|
|
@@ -301,19 +301,19 @@ class CommandPalette {
|
|
|
301
301
|
installHotkey(hotkey = String()) {
|
|
302
302
|
this.uninstallHotkey();
|
|
303
303
|
this.#hotkey = hotkey;
|
|
304
|
-
this.#
|
|
304
|
+
this.#hotkeyHandler = (event) => {
|
|
305
305
|
if (!CommandPalette.#isHotkey(event, this.#hotkey)) return;
|
|
306
306
|
event.preventDefault();
|
|
307
307
|
this.openAndClose();
|
|
308
308
|
};
|
|
309
|
-
document.addEventListener("keydown", this.#
|
|
309
|
+
document.addEventListener("keydown", this.#hotkeyHandler, true);
|
|
310
310
|
return this;
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
uninstallHotkey() {
|
|
314
|
-
if (this.#
|
|
315
|
-
document.removeEventListener("keydown", this.#
|
|
316
|
-
this.#
|
|
314
|
+
if (this.#hotkeyHandler !== undefined) {
|
|
315
|
+
document.removeEventListener("keydown", this.#hotkeyHandler, true);
|
|
316
|
+
this.#hotkeyHandler = undefined;
|
|
317
317
|
}
|
|
318
318
|
this.#hotkey = undefined;
|
|
319
319
|
return this;
|
|
@@ -391,13 +391,13 @@ class CommandPalette {
|
|
|
391
391
|
for (const char of needle) {
|
|
392
392
|
const found = haystack.indexOf(char, position);
|
|
393
393
|
if (found === -1) return -1;
|
|
394
|
-
const
|
|
394
|
+
const atWordStart =
|
|
395
395
|
found === 0 ||
|
|
396
396
|
haystack[found - 1] === " " ||
|
|
397
397
|
haystack[found - 1] === "-" ||
|
|
398
398
|
haystack[found - 1] === "/";
|
|
399
399
|
score += found === previous + 1 ? 6 : 1;
|
|
400
|
-
if (
|
|
400
|
+
if (atWordStart) score += 4;
|
|
401
401
|
previous = found;
|
|
402
402
|
position = found + 1;
|
|
403
403
|
}
|
|
@@ -439,7 +439,7 @@ class CommandPalette {
|
|
|
439
439
|
commands: commands.slice().sort((left, right) => scores.get(right) - scores.get(left)),
|
|
440
440
|
}));
|
|
441
441
|
// «Недавние» показываем только на пустом запросе: иначе они мешают релевантности
|
|
442
|
-
if (this.#
|
|
442
|
+
if (this.#recentEnabled && query.trim() === "" && this.#recent.length > 0) {
|
|
443
443
|
const recent = this.#recent.map((id) => this.getCommand(id)).filter((command) => command !== undefined);
|
|
444
444
|
if (recent.length > 0) result = [{ name: CommandPalette.RECENT_GROUP, commands: recent }, ...result];
|
|
445
445
|
}
|
|
@@ -477,7 +477,7 @@ class CommandPalette {
|
|
|
477
477
|
// Скрытый live-регион: скринридер слышит, сколько команд нашлось
|
|
478
478
|
this.#status.innerText =
|
|
479
479
|
found === 0
|
|
480
|
-
? this.#
|
|
480
|
+
? this.#emptyText
|
|
481
481
|
: query.trim() === ""
|
|
482
482
|
? I18n.t("navigation.commandsFound", { count: found })
|
|
483
483
|
: I18n.t("navigation.commandsFoundFor", { count: found, query: query.trim() });
|
|
@@ -514,7 +514,7 @@ class CommandPalette {
|
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
#run(command = Object()) {
|
|
517
|
-
if (this.#
|
|
517
|
+
if (this.#recentEnabled) {
|
|
518
518
|
this.#recent = [command.id, ...this.#recent.filter((id) => id !== command.id)].slice(
|
|
519
519
|
0,
|
|
520
520
|
CommandPalette.MAX_RECENT
|
|
@@ -522,9 +522,9 @@ class CommandPalette {
|
|
|
522
522
|
}
|
|
523
523
|
// Слой закрывается до запуска: команда может открыть свой диалог, и фокус
|
|
524
524
|
// вернётся на элемент, который открывал палитру, а не в закрывающуюся панель
|
|
525
|
-
if (this.#
|
|
525
|
+
if (this.#closeOnRun) this.close();
|
|
526
526
|
if (typeof command.run === "function") command.run(command);
|
|
527
|
-
if (this.#
|
|
527
|
+
if (this.#onRun !== undefined) this.#onRun(command, this);
|
|
528
528
|
}
|
|
529
529
|
|
|
530
530
|
#commandFromEvent(event = Object()) {
|
|
@@ -28,8 +28,8 @@ command_palette_input {
|
|
|
28
28
|
display: flex;
|
|
29
29
|
align-items: center;
|
|
30
30
|
gap: 8px;
|
|
31
|
-
/* Строка поиска — хром панели, а не контрол: шаг `--
|
|
32
|
-
padding: var(--
|
|
31
|
+
/* Строка поиска — хром панели, а не контрол: шаг `--block_padding`, а не `--block_padding_sm` */
|
|
32
|
+
padding: var(--block_padding);
|
|
33
33
|
border-bottom: 1px solid var(--border_color);
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -89,7 +89,7 @@ command_palette_option {
|
|
|
89
89
|
align-items: center;
|
|
90
90
|
gap: 10px;
|
|
91
91
|
padding: 8px 10px;
|
|
92
|
-
border-radius: var(--
|
|
92
|
+
border-radius: var(--radius_sm);
|
|
93
93
|
color: var(--text_color);
|
|
94
94
|
cursor: default;
|
|
95
95
|
}
|
|
@@ -135,7 +135,7 @@ command_palette_option_subtitle {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
command_palette_option.chui_a11y_active command_palette_option_subtitle {
|
|
138
|
-
color: var(--
|
|
138
|
+
color: var(--text_color_hover_disabled);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
command_palette_shortcut {
|
|
@@ -150,7 +150,7 @@ command_palette_empty {
|
|
|
150
150
|
display: flex;
|
|
151
151
|
align-items: center;
|
|
152
152
|
justify-content: center;
|
|
153
|
-
padding: var(--
|
|
153
|
+
padding: var(--block_padding);
|
|
154
154
|
text-align: center;
|
|
155
155
|
color: var(--text_color_disabled);
|
|
156
156
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
class Console {
|
|
2
|
-
#
|
|
2
|
+
#chuiConsole = document.createElement(`chui_console`);
|
|
3
3
|
constructor(options = { width: String(), height: String(), label: String() }) {
|
|
4
4
|
const { setStyles, optionOr } = require("../../modules/chui_functions");
|
|
5
5
|
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
6
6
|
setStyles(__dirname + "/styles.css", "chUiJS_console");
|
|
7
7
|
// Журнал — не только картинка: строки добавляются одна за другой, поэтому у области
|
|
8
8
|
// есть роль и имя, а скринридер объявляет дописанное (было безымянное полотно)
|
|
9
|
-
this.#
|
|
10
|
-
this.#
|
|
9
|
+
this.#chuiConsole.setAttribute("role", "log");
|
|
10
|
+
this.#chuiConsole.setAttribute("aria-label", optionOr(options.label, I18n.t("feedback.console")));
|
|
11
11
|
// Пустая заготовка опции равносильна отсутствующей: `String()` в описании опций
|
|
12
12
|
// доезжала до стилей, и размер молча оставался пустым
|
|
13
13
|
const width = optionOr(options.width, undefined);
|
|
14
14
|
const height = optionOr(options.height, undefined);
|
|
15
|
-
this.#
|
|
16
|
-
this.#
|
|
15
|
+
this.#chuiConsole.style.width = width === undefined ? "max-content" : width;
|
|
16
|
+
this.#chuiConsole.style.height = height === undefined ? "max-content" : height;
|
|
17
17
|
}
|
|
18
18
|
addText(text = String()) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
this.#
|
|
19
|
+
const chuiConsoleText = document.createElement(`chui_console_text`);
|
|
20
|
+
chuiConsoleText.innerText = text;
|
|
21
|
+
this.#chuiConsole.appendChild(chuiConsoleText);
|
|
22
22
|
}
|
|
23
23
|
set() {
|
|
24
|
-
return this.#
|
|
24
|
+
return this.#chuiConsole;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
chui_console {
|
|
2
2
|
height: max-content;
|
|
3
3
|
width: max-content;
|
|
4
|
-
margin: var(--
|
|
4
|
+
margin: var(--block_margin);
|
|
5
5
|
font-size: var(--font_default_size);
|
|
6
6
|
font-weight: 500;
|
|
7
7
|
color: var(--text_color);
|
|
@@ -11,7 +11,7 @@ chui_console {
|
|
|
11
11
|
user-select: text;
|
|
12
12
|
border: 1px solid var(--border_color);
|
|
13
13
|
padding: var(--control_padding);
|
|
14
|
-
border-radius: var(--
|
|
14
|
+
border-radius: var(--radius_sm);
|
|
15
15
|
|
|
16
16
|
display: flex;
|
|
17
17
|
flex-direction: column;
|
|
@@ -26,6 +26,9 @@ chui_console_text {
|
|
|
26
26
|
width: -webkit-fill-available;
|
|
27
27
|
white-space: break-spaces;
|
|
28
28
|
word-wrap: break-word;
|
|
29
|
+
/* Новая строка журнала встаёт на место: кадр общий — см. `chui_appear_up`
|
|
30
|
+
в global_style.css */
|
|
31
|
+
animation: chui_appear_up var(--motion_base) var(--motion_ease);
|
|
29
32
|
padding: var(--control_padding);
|
|
30
33
|
text-align: start;
|
|
31
34
|
user-select: text;
|