chuijs 4.0.2 → 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 +597 -0
- package/README.md +43 -644
- package/framework/appLayout/default/chui_app_layout.js +602 -496
- package/framework/appLayout/default/global_style.css +288 -97
- package/framework/appLayout/default/main_theme_style.css +188 -101
- package/framework/components/chui_accordion/accordion.js +38 -35
- package/framework/components/chui_accordion/styles.css +13 -12
- package/framework/components/chui_action_sheet/action_sheet.js +93 -64
- package/framework/components/chui_action_sheet/styles.css +12 -5
- 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 +16 -11
- package/framework/components/chui_affix/styles.css +5 -0
- package/framework/components/chui_alert/alert.js +34 -19
- package/framework/components/chui_alert/styles.css +7 -0
- package/framework/components/chui_avatar/avatar.js +36 -35
- package/framework/components/chui_avatar/styles.css +1 -1
- package/framework/components/chui_avatar_group/avatar_group.js +25 -23
- package/framework/components/chui_avatar_group/styles.css +1 -1
- package/framework/components/chui_backtop/backtop.js +60 -21
- package/framework/components/chui_backtop/styles.css +21 -0
- package/framework/components/chui_badge/badge.js +30 -28
- 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/breadcrumb.js +15 -13
- package/framework/components/chui_breadcrumb/styles.css +1 -1
- package/framework/components/chui_button/button.js +52 -36
- package/framework/components/chui_button/styles.css +7 -7
- package/framework/components/chui_calendar/calendar.js +18 -16
- package/framework/components/chui_card/card.js +52 -32
- 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 +140 -79
- package/framework/components/chui_chat/styles.css +18 -7
- package/framework/components/chui_clipboard_history/clipboard_history.js +53 -39
- package/framework/components/chui_clipboard_history/styles.css +13 -9
- package/framework/components/chui_code/code.js +10 -10
- package/framework/components/chui_code/styles.css +4 -4
- package/framework/components/chui_code_editor/code_editor.js +73 -57
- package/framework/components/chui_code_editor/styles.css +6 -5
- package/framework/components/chui_command_palette/command_palette.js +87 -64
- package/framework/components/chui_command_palette/styles.css +5 -5
- package/framework/components/chui_console/console.js +13 -13
- package/framework/components/chui_console/styles.css +6 -3
- package/framework/components/chui_content_block/content_block.js +35 -21
- package/framework/components/chui_content_block/styles.css +2 -2
- package/framework/components/chui_context_menu/context_menu.js +171 -58
- package/framework/components/chui_context_menu/styles.css +82 -8
- package/framework/components/chui_custom_element/custom_element.js +25 -18
- package/framework/components/chui_data_grid/data_grid.js +633 -471
- package/framework/components/chui_data_grid/styles.css +24 -22
- package/framework/components/chui_descriptions/descriptions.js +34 -17
- package/framework/components/chui_descriptions/styles.css +1 -1
- package/framework/components/chui_details/details.js +42 -36
- package/framework/components/chui_details/styles.css +12 -11
- package/framework/components/chui_diff_viewer/diff_viewer.js +172 -147
- package/framework/components/chui_diff_viewer/styles.css +10 -10
- package/framework/components/chui_divider/divider.js +19 -17
- package/framework/components/chui_divider/styles.css +2 -2
- package/framework/components/chui_drawer/drawer.js +63 -38
- package/framework/components/chui_drawer/styles.css +18 -4
- package/framework/components/chui_drop_zone/drop_zone.js +37 -27
- package/framework/components/chui_drop_zone/styles.css +10 -6
- package/framework/components/chui_empty_state/empty_state.js +20 -15
- package/framework/components/chui_fieldset/fieldset.js +40 -23
- package/framework/components/chui_fieldset/styles.css +6 -6
- package/framework/components/chui_file_explorer/file_explorer.js +260 -189
- package/framework/components/chui_file_explorer/styles.css +8 -7
- package/framework/components/chui_form/form.js +40 -28
- package/framework/components/chui_form/styles.css +1 -1
- package/framework/components/chui_gantt/gantt.js +102 -78
- package/framework/components/chui_gantt/styles.css +5 -5
- package/framework/components/chui_graphs/graphs.js +376 -239
- package/framework/components/chui_graphs/styles.css +27 -6
- package/framework/components/chui_hero/hero.js +98 -37
- package/framework/components/chui_hero/styles.css +176 -7
- package/framework/components/chui_html_block/html_block.js +8 -8
- package/framework/components/chui_html_block/styles.css +3 -3
- package/framework/components/chui_hx/hx.js +3 -3
- package/framework/components/chui_hx/styles.css +13 -6
- package/framework/components/chui_icons/icons.js +2115 -2115
- package/framework/components/chui_icons/styles.css +4 -3
- package/framework/components/chui_inputs/chui_check_box/check_box.js +31 -19
- package/framework/components/chui_inputs/chui_check_box/styles.css +30 -21
- package/framework/components/chui_inputs/chui_chips/chips.js +141 -70
- package/framework/components/chui_inputs/chui_chips/styles.css +32 -7
- package/framework/components/chui_inputs/chui_color_picker/color_picker.js +55 -38
- package/framework/components/chui_inputs/chui_color_picker/styles.css +7 -7
- package/framework/components/chui_inputs/chui_combo_box/combo_box.js +127 -109
- package/framework/components/chui_inputs/chui_combo_box/styles.css +23 -21
- package/framework/components/chui_inputs/chui_date/date.js +161 -127
- package/framework/components/chui_inputs/chui_date/styles.css +20 -19
- package/framework/components/chui_inputs/chui_date_range/date_range.js +61 -50
- package/framework/components/chui_inputs/chui_date_range/styles.css +3 -3
- package/framework/components/chui_inputs/chui_datetime/datetime.js +47 -39
- package/framework/components/chui_inputs/chui_datetime/styles.css +3 -3
- package/framework/components/chui_inputs/chui_email/email.js +48 -36
- package/framework/components/chui_inputs/chui_email/styles.css +11 -11
- package/framework/components/chui_inputs/chui_file/file.js +71 -44
- package/framework/components/chui_inputs/chui_file/styles.css +23 -19
- package/framework/components/chui_inputs/chui_hotkey/hotkey.js +101 -76
- package/framework/components/chui_inputs/chui_hotkey/styles.css +6 -6
- package/framework/components/chui_inputs/chui_masked/masked.js +83 -72
- package/framework/components/chui_inputs/chui_masked/styles.css +5 -5
- package/framework/components/chui_inputs/chui_mention/mention.js +87 -40
- package/framework/components/chui_inputs/chui_mention/styles.css +14 -8
- package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +242 -212
- package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +23 -15
- package/framework/components/chui_inputs/chui_number/number.js +84 -70
- package/framework/components/chui_inputs/chui_number/styles.css +13 -13
- package/framework/components/chui_inputs/chui_otp/otp.js +71 -62
- package/framework/components/chui_inputs/chui_otp/styles.css +5 -5
- package/framework/components/chui_inputs/chui_password/password.js +72 -56
- package/framework/components/chui_inputs/chui_password/styles.css +15 -15
- package/framework/components/chui_inputs/chui_radio_button/radio_button.js +37 -25
- package/framework/components/chui_inputs/chui_radio_button/styles.css +22 -22
- package/framework/components/chui_inputs/chui_rating/rating.js +54 -50
- package/framework/components/chui_inputs/chui_rating/styles.css +3 -3
- package/framework/components/chui_inputs/chui_select_box/select_box.js +132 -108
- package/framework/components/chui_inputs/chui_select_box/styles.css +21 -21
- package/framework/components/chui_inputs/chui_slider/slider.js +41 -38
- package/framework/components/chui_inputs/chui_slider/styles.css +7 -5
- package/framework/components/chui_inputs/chui_text/styles.css +14 -14
- package/framework/components/chui_inputs/chui_text/text.js +69 -52
- package/framework/components/chui_inputs/chui_text_area/styles.css +14 -14
- package/framework/components/chui_inputs/chui_text_area/text_area.js +59 -36
- package/framework/components/chui_inputs/chui_time/styles.css +18 -20
- package/framework/components/chui_inputs/chui_time/time.js +71 -49
- package/framework/components/chui_inputs/chui_toggle/styles.css +13 -6
- package/framework/components/chui_inputs/chui_toggle/toggle.js +27 -27
- package/framework/components/chui_json_editor/json_editor.js +137 -127
- package/framework/components/chui_json_editor/styles.css +5 -5
- package/framework/components/chui_json_viewer/json_viewer.js +133 -114
- package/framework/components/chui_json_viewer/styles.css +9 -8
- package/framework/components/chui_kanban/kanban.js +78 -60
- package/framework/components/chui_kanban/styles.css +8 -4
- package/framework/components/chui_kbd/kbd.js +12 -10
- package/framework/components/chui_kbd/styles.css +1 -1
- package/framework/components/chui_label/label.js +31 -29
- package/framework/components/chui_label/styles.css +3 -3
- package/framework/components/chui_link/link.js +36 -29
- package/framework/components/chui_link/styles.css +11 -4
- package/framework/components/chui_list/list.js +42 -38
- package/framework/components/chui_list/styles.css +4 -3
- package/framework/components/chui_markdown_editor/markdown_editor.js +125 -109
- package/framework/components/chui_markdown_editor/styles.css +5 -5
- package/framework/components/chui_media/audio.js +457 -364
- package/framework/components/chui_media/audio_styles.css +74 -37
- package/framework/components/chui_media/image.js +99 -64
- package/framework/components/chui_media/image_compare.js +86 -55
- package/framework/components/chui_media/image_compare_styles.css +5 -5
- package/framework/components/chui_media/image_styles.css +4 -4
- package/framework/components/chui_media/video.js +264 -171
- package/framework/components/chui_media/video_styles.css +57 -24
- package/framework/components/chui_menu_bar/menu_bar.js +67 -65
- package/framework/components/chui_menu_bar/styles.css +14 -12
- 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 +81 -56
- package/framework/components/chui_modal/styles.css +3 -2
- package/framework/components/chui_notification/notification.js +107 -69
- package/framework/components/chui_notification/notification_download.js +28 -77
- package/framework/components/chui_notification/notification_download_card.js +115 -0
- package/framework/components/chui_notification/notification_download_progress.css +5 -4
- package/framework/components/chui_notification/notification_download_progress.js +73 -105
- package/framework/components/chui_notification/notification_update.js +44 -37
- package/framework/components/chui_notification/status_plate.css +3 -3
- package/framework/components/chui_notification/status_plate.js +2 -2
- package/framework/components/chui_notification/styles.css +6 -1
- package/framework/components/chui_notification/styles_download.css +2 -2
- package/framework/components/chui_notification/styles_update.css +3 -3
- package/framework/components/chui_org_chart/org_chart.js +101 -62
- package/framework/components/chui_org_chart/styles.css +2 -2
- package/framework/components/chui_pagination/pagination.js +65 -30
- package/framework/components/chui_pagination/styles.css +1 -1
- package/framework/components/chui_paragraph/paragraph.js +2 -2
- package/framework/components/chui_paragraph/styles.css +3 -3
- package/framework/components/chui_popover/popover.js +77 -50
- package/framework/components/chui_popover/styles.css +1 -1
- package/framework/components/chui_popups/popups.js +210 -181
- package/framework/components/chui_popups/styles.css +7 -7
- package/framework/components/chui_print_button/print_button.js +48 -33
- package/framework/components/chui_progress_bar/progress_bar.js +49 -19
- package/framework/components/chui_progress_bar/styles.css +6 -6
- package/framework/components/chui_progress_ring/progress_ring.js +32 -30
- package/framework/components/chui_progress_ring/styles.css +1 -1
- package/framework/components/chui_qrcode/qrcode.js +85 -41
- package/framework/components/chui_query_builder/query_builder.js +263 -170
- package/framework/components/chui_query_builder/styles.css +4 -4
- package/framework/components/chui_radio_group/radio_group.js +36 -26
- package/framework/components/chui_radio_group/styles.css +2 -2
- package/framework/components/chui_result/result.js +41 -31
- package/framework/components/chui_result/styles.css +3 -3
- package/framework/components/chui_scheduler/scheduler.js +126 -104
- package/framework/components/chui_scheduler/styles.css +11 -7
- 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 +90 -27
- package/framework/components/chui_segmented_control/styles.css +32 -6
- package/framework/components/chui_settings/settings.js +160 -87
- package/framework/components/chui_settings/styles.css +4 -4
- package/framework/components/chui_shortcut_help/shortcut_help.js +82 -61
- package/framework/components/chui_sidebar_nav/sidebar_nav.js +132 -53
- package/framework/components/chui_sidebar_nav/styles.css +9 -3
- package/framework/components/chui_skeleton/skeleton.js +29 -24
- package/framework/components/chui_slideshow/slideshow.js +122 -103
- package/framework/components/chui_slideshow/styles.css +22 -16
- package/framework/components/chui_spinner/spinner.js +17 -17
- package/framework/components/chui_spinner/styles.css +0 -1
- package/framework/components/chui_split_button/split_button.js +53 -30
- package/framework/components/chui_split_button/styles.css +22 -6
- package/framework/components/chui_splitter/splitter.js +46 -39
- package/framework/components/chui_splitter/styles.css +2 -2
- package/framework/components/chui_statistic/statistic.js +111 -84
- package/framework/components/chui_status_bar/status_bar.js +11 -9
- package/framework/components/chui_status_bar/styles.css +2 -2
- package/framework/components/chui_stepper/stepper.js +230 -54
- package/framework/components/chui_stepper/styles.css +79 -14
- package/framework/components/chui_sticky_bar/sticky_bar.js +53 -17
- package/framework/components/chui_sticky_bar/styles.css +11 -7
- package/framework/components/chui_tabs/chui_tabs.js +100 -46
- package/framework/components/chui_tabs/styles.css +43 -15
- package/framework/components/chui_text_editor/styles.css +24 -23
- package/framework/components/chui_text_editor/text_editor.js +103 -79
- package/framework/components/chui_text_editor/text_editor_panel.js +428 -367
- package/framework/components/chui_theme_toggle/theme_toggle.js +46 -25
- package/framework/components/chui_timeline/styles.css +3 -1
- package/framework/components/chui_timeline/timeline.js +14 -12
- package/framework/components/chui_toast_queue/styles.css +11 -11
- package/framework/components/chui_toast_queue/toast_queue.js +82 -73
- package/framework/components/chui_toolbar/styles.css +2 -2
- package/framework/components/chui_toolbar/toolbar.js +20 -13
- package/framework/components/chui_tooltip/styles.css +2 -2
- package/framework/components/chui_tooltip/tooltip.js +40 -27
- package/framework/components/chui_tour/styles.css +12 -7
- package/framework/components/chui_tour/tour.js +132 -98
- package/framework/components/chui_transfer/styles.css +8 -7
- package/framework/components/chui_transfer/transfer.js +143 -123
- package/framework/components/chui_tree_table/styles.css +4 -4
- package/framework/components/chui_tree_table/tree_table.js +88 -74
- package/framework/components/chui_tree_view/styles.css +14 -10
- package/framework/components/chui_tree_view/tree_view.js +298 -253
- 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 +41 -33
- package/framework/components/chui_webview/styles.css +2 -2
- package/framework/components/chui_webview/webview.js +64 -52
- 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 +153 -123
- package/framework/modules/chui_animations/animations.js +105 -43
- package/framework/modules/chui_animations/motion.js +120 -0
- package/framework/modules/chui_animations/styles.css +37 -4
- package/framework/modules/chui_bridge/preload.js +36 -25
- package/framework/modules/chui_functions.js +69 -63
- package/framework/modules/chui_highlight/chui_highlight.js +25 -22
- package/framework/modules/chui_highlight/styles.css +13 -10
- package/framework/modules/chui_i18n/chui_i18n.js +12 -10
- package/framework/modules/chui_i18n/locales/a11y.js +5 -5
- package/framework/modules/chui_i18n/locales/app_layout.js +5 -5
- package/framework/modules/chui_i18n/locales/calendar.js +3 -3
- package/framework/modules/chui_i18n/locales/common.js +3 -3
- package/framework/modules/chui_i18n/locales/data.js +36 -26
- package/framework/modules/chui_i18n/locales/editors.js +40 -13
- package/framework/modules/chui_i18n/locales/feedback.js +65 -3
- package/framework/modules/chui_i18n/locales/forms.js +8 -8
- package/framework/modules/chui_i18n/locales/graphics.js +8 -8
- package/framework/modules/chui_i18n/locales/media.js +4 -4
- package/framework/modules/chui_i18n/locales/navigation.js +12 -8
- package/framework/modules/chui_i18n/locales/validate.js +3 -3
- package/framework/modules/chui_json/chui_json.js +11 -11
- package/framework/modules/chui_layout/chui_layout.js +12 -10
- package/framework/modules/chui_logger/chui_logger.js +47 -28
- package/framework/modules/chui_page/page.js +39 -33
- package/framework/modules/chui_palette/palette.js +61 -0
- package/framework/modules/chui_qr/chui_qr.js +179 -88
- package/framework/modules/chui_scrollbar/chui_scrollbar.js +79 -68
- package/framework/modules/chui_scrollbar/styles.css +4 -2
- package/framework/modules/chui_services/chui_channels.js +27 -13
- package/framework/modules/chui_services/chui_services.js +47 -39
- package/framework/modules/chui_services/desktop.js +108 -101
- package/framework/modules/chui_sortable/chui_sortable.js +33 -28
- package/framework/modules/chui_validate/chui_validate.js +10 -7
- package/framework/tray_bar/chui_menu_items.js +136 -46
- package/index.d.ts +5046 -0
- package/index.js +199 -1254
- package/package.json +81 -68
- package/framework/components/telegram_bot/chui_telegram_bot.js +0 -184
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const {Animation} = require(
|
|
2
|
-
const {OverlayA11y, ComboboxKeyboard} = require(
|
|
3
|
-
const {Icon, Icons} = require(
|
|
4
|
-
const {setStyles, optionOr} = require(
|
|
5
|
-
const {I18n} = require(
|
|
1
|
+
const { Animation } = require("../../modules/chui_animations/animations");
|
|
2
|
+
const { OverlayA11y, ComboboxKeyboard } = require("../../modules/chui_a11y/chui_a11y");
|
|
3
|
+
const { Icon, Icons } = require("../chui_icons/icons");
|
|
4
|
+
const { setStyles, optionOr } = require("../../modules/chui_functions");
|
|
5
|
+
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Командная строка (command palette): нечёткий поиск по списку команд и запуск
|
|
@@ -32,20 +32,28 @@ const {I18n} = require('../../modules/chui_i18n/chui_i18n');
|
|
|
32
32
|
class CommandPalette {
|
|
33
33
|
static #counter = 0;
|
|
34
34
|
// Значения берутся лениво: язык может быть задан до сборки интерфейса, но уже после загрузки модуля
|
|
35
|
-
static get DEFAULT_LABEL() {
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
static get DEFAULT_LABEL() {
|
|
36
|
+
return I18n.t("navigation.commandPalette");
|
|
37
|
+
}
|
|
38
|
+
static get DEFAULT_PLACEHOLDER() {
|
|
39
|
+
return I18n.t("navigation.commandPlaceholder");
|
|
40
|
+
}
|
|
41
|
+
static get DEFAULT_EMPTY_TEXT() {
|
|
42
|
+
return I18n.t("common.nothingFound");
|
|
43
|
+
}
|
|
38
44
|
/** Сколько последних запущенных команд показывать отдельной группой */
|
|
39
45
|
static MAX_RECENT = 4;
|
|
40
46
|
/** По умолчанию показываем не больше столько совпадений */
|
|
41
47
|
static DEFAULT_LIMIT = 50;
|
|
42
|
-
static get RECENT_GROUP() {
|
|
48
|
+
static get RECENT_GROUP() {
|
|
49
|
+
return I18n.t("navigation.recentGroup");
|
|
50
|
+
}
|
|
43
51
|
|
|
44
52
|
#id = undefined;
|
|
45
53
|
// Занавес на всё окно: он же элемент слоя для OverlayA11y
|
|
46
54
|
#palette = document.createElement("chui_command_palette");
|
|
47
55
|
#panel = document.createElement("command_palette_panel");
|
|
48
|
-
#
|
|
56
|
+
#inputBox = document.createElement("command_palette_input");
|
|
49
57
|
#input = document.createElement("input");
|
|
50
58
|
// Область результатов: список и надпись «ничего не найдено» в одной рамке
|
|
51
59
|
// (надпись центрируется в ней по вертикали, а высота панели не прыгает)
|
|
@@ -62,27 +70,29 @@ class CommandPalette {
|
|
|
62
70
|
#query = "";
|
|
63
71
|
#label = CommandPalette.DEFAULT_LABEL;
|
|
64
72
|
#placeholder = CommandPalette.DEFAULT_PLACEHOLDER;
|
|
65
|
-
#
|
|
73
|
+
#emptyText = CommandPalette.DEFAULT_EMPTY_TEXT;
|
|
66
74
|
#limit = CommandPalette.DEFAULT_LIMIT;
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
75
|
+
#recentEnabled = true;
|
|
76
|
+
#closeOnRun = true;
|
|
77
|
+
#onRun = undefined;
|
|
70
78
|
#hotkey = undefined;
|
|
71
|
-
#
|
|
79
|
+
#hotkeyHandler = undefined;
|
|
72
80
|
isOpen = false;
|
|
73
81
|
|
|
74
|
-
constructor(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
constructor(
|
|
83
|
+
options = {
|
|
84
|
+
id: String(),
|
|
85
|
+
label: String(),
|
|
86
|
+
placeholder: String(),
|
|
87
|
+
emptyText: String(),
|
|
88
|
+
commands: [],
|
|
89
|
+
limit: Number(),
|
|
90
|
+
recent: Boolean(),
|
|
91
|
+
closeOnRun: Boolean(),
|
|
92
|
+
hotkey: String(),
|
|
93
|
+
onRun: undefined,
|
|
94
|
+
}
|
|
95
|
+
) {
|
|
86
96
|
setStyles(__dirname + "/styles.css", "chUiJS_CommandPalette");
|
|
87
97
|
CommandPalette.#counter += 1;
|
|
88
98
|
// Пустая строка означает «не задана» — как у остальных опций-имён: иначе id слоя
|
|
@@ -90,26 +100,27 @@ class CommandPalette {
|
|
|
90
100
|
this.#id = optionOr(options.id, `chui_command_palette_${CommandPalette.#counter}`);
|
|
91
101
|
this.#palette.id = this.#id;
|
|
92
102
|
this.#label = optionOr(options.label, CommandPalette.DEFAULT_LABEL);
|
|
93
|
-
this.#placeholder =
|
|
94
|
-
|
|
103
|
+
this.#placeholder =
|
|
104
|
+
options.placeholder === undefined ? CommandPalette.DEFAULT_PLACEHOLDER : options.placeholder;
|
|
105
|
+
this.#emptyText = options.emptyText === undefined ? CommandPalette.DEFAULT_EMPTY_TEXT : options.emptyText;
|
|
95
106
|
this.#limit = options.limit === undefined ? CommandPalette.DEFAULT_LIMIT : options.limit;
|
|
96
|
-
this.#
|
|
97
|
-
this.#
|
|
98
|
-
this.#
|
|
107
|
+
this.#recentEnabled = options.recent === undefined ? true : options.recent;
|
|
108
|
+
this.#closeOnRun = options.closeOnRun === undefined ? true : options.closeOnRun;
|
|
109
|
+
this.#onRun = options.onRun;
|
|
99
110
|
// Поле поиска
|
|
100
111
|
this.#list.id = `${this.#id}_list`;
|
|
101
112
|
this.#input.type = "text";
|
|
102
113
|
this.#input.setAttribute("autocomplete", "off");
|
|
103
114
|
this.#input.placeholder = this.#placeholder;
|
|
104
115
|
this.#input.id = `${this.#id}_input`;
|
|
105
|
-
this.#
|
|
106
|
-
this.#
|
|
107
|
-
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;
|
|
108
119
|
this.#empty.hidden = true;
|
|
109
120
|
this.#status.classList.add("chui_visually_hidden");
|
|
110
121
|
this.#status.setAttribute("role", "status");
|
|
111
122
|
this.#status.setAttribute("aria-live", "polite");
|
|
112
|
-
this.#panel.appendChild(this.#
|
|
123
|
+
this.#panel.appendChild(this.#inputBox);
|
|
113
124
|
this.#results.appendChild(this.#list);
|
|
114
125
|
this.#results.appendChild(this.#empty);
|
|
115
126
|
this.#results.appendChild(this.#status);
|
|
@@ -118,13 +129,13 @@ class CommandPalette {
|
|
|
118
129
|
this.#a11y = new OverlayA11y(this.#palette, {
|
|
119
130
|
role: "dialog",
|
|
120
131
|
label: this.#label,
|
|
121
|
-
onEscape: () => this.close()
|
|
132
|
+
onEscape: () => this.close(),
|
|
122
133
|
});
|
|
123
134
|
// Клавиатурный слой списка: стрелки, Home/End, Enter по активной команде
|
|
124
135
|
this.#keyboard = new ComboboxKeyboard(this.#input, {
|
|
125
136
|
dropdown: this.#list,
|
|
126
137
|
optionSelector: "command_palette_option",
|
|
127
|
-
onEscape: () => this.close()
|
|
138
|
+
onEscape: () => this.close(),
|
|
128
139
|
});
|
|
129
140
|
// Enter до выбора стрелками запускает первую найденную команду
|
|
130
141
|
this.#input.addEventListener("keydown", this.#onInputKeyDown);
|
|
@@ -148,7 +159,7 @@ class CommandPalette {
|
|
|
148
159
|
}
|
|
149
160
|
|
|
150
161
|
getEmptyText() {
|
|
151
|
-
return this.#
|
|
162
|
+
return this.#emptyText;
|
|
152
163
|
}
|
|
153
164
|
|
|
154
165
|
getQuery() {
|
|
@@ -202,7 +213,7 @@ class CommandPalette {
|
|
|
202
213
|
}
|
|
203
214
|
|
|
204
215
|
setEmptyText(text = String()) {
|
|
205
|
-
this.#
|
|
216
|
+
this.#emptyText = text;
|
|
206
217
|
this.#empty.innerText = text;
|
|
207
218
|
return this;
|
|
208
219
|
}
|
|
@@ -263,7 +274,7 @@ class CommandPalette {
|
|
|
263
274
|
this.#query = "";
|
|
264
275
|
this.#input.value = "";
|
|
265
276
|
this.#apply("");
|
|
266
|
-
new Animation(this.#palette).
|
|
277
|
+
new Animation(this.#palette).panelIn();
|
|
267
278
|
this.#a11y.open();
|
|
268
279
|
this.#keyboard.setExpanded(true);
|
|
269
280
|
this.#input.focus();
|
|
@@ -290,19 +301,19 @@ class CommandPalette {
|
|
|
290
301
|
installHotkey(hotkey = String()) {
|
|
291
302
|
this.uninstallHotkey();
|
|
292
303
|
this.#hotkey = hotkey;
|
|
293
|
-
this.#
|
|
304
|
+
this.#hotkeyHandler = (event) => {
|
|
294
305
|
if (!CommandPalette.#isHotkey(event, this.#hotkey)) return;
|
|
295
306
|
event.preventDefault();
|
|
296
307
|
this.openAndClose();
|
|
297
308
|
};
|
|
298
|
-
document.addEventListener("keydown", this.#
|
|
309
|
+
document.addEventListener("keydown", this.#hotkeyHandler, true);
|
|
299
310
|
return this;
|
|
300
311
|
}
|
|
301
312
|
|
|
302
313
|
uninstallHotkey() {
|
|
303
|
-
if (this.#
|
|
304
|
-
document.removeEventListener("keydown", this.#
|
|
305
|
-
this.#
|
|
314
|
+
if (this.#hotkeyHandler !== undefined) {
|
|
315
|
+
document.removeEventListener("keydown", this.#hotkeyHandler, true);
|
|
316
|
+
this.#hotkeyHandler = undefined;
|
|
306
317
|
}
|
|
307
318
|
this.#hotkey = undefined;
|
|
308
319
|
return this;
|
|
@@ -340,7 +351,7 @@ class CommandPalette {
|
|
|
340
351
|
icon: command.icon,
|
|
341
352
|
keywords: command.keywords,
|
|
342
353
|
shortcut: command.shortcut,
|
|
343
|
-
run: command.run
|
|
354
|
+
run: command.run,
|
|
344
355
|
};
|
|
345
356
|
}
|
|
346
357
|
|
|
@@ -358,7 +369,7 @@ class CommandPalette {
|
|
|
358
369
|
// `id` часто латинский — по нему удобно искать в русском интерфейсе («graphs»)
|
|
359
370
|
[command.id, 2],
|
|
360
371
|
[command.subtitle, 1],
|
|
361
|
-
[command.group, 1]
|
|
372
|
+
[command.group, 1],
|
|
362
373
|
];
|
|
363
374
|
let best = -1;
|
|
364
375
|
for (const [value, weight] of fields) {
|
|
@@ -380,9 +391,13 @@ class CommandPalette {
|
|
|
380
391
|
for (const char of needle) {
|
|
381
392
|
const found = haystack.indexOf(char, position);
|
|
382
393
|
if (found === -1) return -1;
|
|
383
|
-
const
|
|
394
|
+
const atWordStart =
|
|
395
|
+
found === 0 ||
|
|
396
|
+
haystack[found - 1] === " " ||
|
|
397
|
+
haystack[found - 1] === "-" ||
|
|
398
|
+
haystack[found - 1] === "/";
|
|
384
399
|
score += found === previous + 1 ? 6 : 1;
|
|
385
|
-
if (
|
|
400
|
+
if (atWordStart) score += 4;
|
|
386
401
|
previous = found;
|
|
387
402
|
position = found + 1;
|
|
388
403
|
}
|
|
@@ -390,7 +405,11 @@ class CommandPalette {
|
|
|
390
405
|
}
|
|
391
406
|
|
|
392
407
|
static #isHotkey(event = Object(), hotkey = String()) {
|
|
393
|
-
const parts = hotkey
|
|
408
|
+
const parts = hotkey
|
|
409
|
+
.toLowerCase()
|
|
410
|
+
.split("+")
|
|
411
|
+
.map((part) => part.trim())
|
|
412
|
+
.filter(Boolean);
|
|
394
413
|
if (parts.length === 0) return false;
|
|
395
414
|
const key = parts[parts.length - 1];
|
|
396
415
|
const mod = parts.includes("mod") || parts.includes("ctrl") || parts.includes("cmd") || parts.includes("meta");
|
|
@@ -417,12 +436,12 @@ class CommandPalette {
|
|
|
417
436
|
}
|
|
418
437
|
let result = [...groups].map(([name, commands]) => ({
|
|
419
438
|
name: name,
|
|
420
|
-
commands: commands.slice().sort((left, right) => scores.get(right) - scores.get(left))
|
|
439
|
+
commands: commands.slice().sort((left, right) => scores.get(right) - scores.get(left)),
|
|
421
440
|
}));
|
|
422
441
|
// «Недавние» показываем только на пустом запросе: иначе они мешают релевантности
|
|
423
|
-
if (this.#
|
|
442
|
+
if (this.#recentEnabled && query.trim() === "" && this.#recent.length > 0) {
|
|
424
443
|
const recent = this.#recent.map((id) => this.getCommand(id)).filter((command) => command !== undefined);
|
|
425
|
-
if (recent.length > 0) result = [{name: CommandPalette.RECENT_GROUP, commands: recent}, ...result];
|
|
444
|
+
if (recent.length > 0) result = [{ name: CommandPalette.RECENT_GROUP, commands: recent }, ...result];
|
|
426
445
|
}
|
|
427
446
|
return result;
|
|
428
447
|
}
|
|
@@ -456,11 +475,12 @@ class CommandPalette {
|
|
|
456
475
|
// Пустой список убираем совсем: иначе он делит высоту с надписью и та съезжает вниз
|
|
457
476
|
this.#list.hidden = found === 0;
|
|
458
477
|
// Скрытый live-регион: скринридер слышит, сколько команд нашлось
|
|
459
|
-
this.#status.innerText =
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
478
|
+
this.#status.innerText =
|
|
479
|
+
found === 0
|
|
480
|
+
? this.#emptyText
|
|
481
|
+
: query.trim() === ""
|
|
482
|
+
? I18n.t("navigation.commandsFound", { count: found })
|
|
483
|
+
: I18n.t("navigation.commandsFoundFor", { count: found, query: query.trim() });
|
|
464
484
|
this.#keyboard.refresh();
|
|
465
485
|
return this;
|
|
466
486
|
}
|
|
@@ -494,14 +514,17 @@ class CommandPalette {
|
|
|
494
514
|
}
|
|
495
515
|
|
|
496
516
|
#run(command = Object()) {
|
|
497
|
-
if (this.#
|
|
498
|
-
this.#recent = [command.id, ...this.#recent.filter((id) => id !== command.id)].slice(
|
|
517
|
+
if (this.#recentEnabled) {
|
|
518
|
+
this.#recent = [command.id, ...this.#recent.filter((id) => id !== command.id)].slice(
|
|
519
|
+
0,
|
|
520
|
+
CommandPalette.MAX_RECENT
|
|
521
|
+
);
|
|
499
522
|
}
|
|
500
523
|
// Слой закрывается до запуска: команда может открыть свой диалог, и фокус
|
|
501
524
|
// вернётся на элемент, который открывал палитру, а не в закрывающуюся панель
|
|
502
|
-
if (this.#
|
|
525
|
+
if (this.#closeOnRun) this.close();
|
|
503
526
|
if (typeof command.run === "function") command.run(command);
|
|
504
|
-
if (this.#
|
|
527
|
+
if (this.#onRun !== undefined) this.#onRun(command, this);
|
|
505
528
|
}
|
|
506
529
|
|
|
507
530
|
#commandFromEvent(event = Object()) {
|
|
@@ -532,4 +555,4 @@ class CommandPalette {
|
|
|
532
555
|
};
|
|
533
556
|
}
|
|
534
557
|
|
|
535
|
-
exports.CommandPalette = CommandPalette
|
|
558
|
+
exports.CommandPalette = CommandPalette;
|
|
@@ -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,28 +1,28 @@
|
|
|
1
1
|
class Console {
|
|
2
|
-
#
|
|
2
|
+
#chuiConsole = document.createElement(`chui_console`);
|
|
3
3
|
constructor(options = { width: String(), height: String(), label: String() }) {
|
|
4
|
-
const {setStyles, optionOr} = require(
|
|
5
|
-
const {I18n} = require(
|
|
6
|
-
setStyles(__dirname + "/styles.css",
|
|
4
|
+
const { setStyles, optionOr } = require("../../modules/chui_functions");
|
|
5
|
+
const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
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
|
|
|
28
|
-
exports.Console = Console
|
|
28
|
+
exports.Console = Console;
|
|
@@ -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,7 +26,10 @@ 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;
|
|
32
|
-
}
|
|
35
|
+
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
const {Animation} = require("../../modules/chui_animations/animations");
|
|
1
|
+
const { Animation } = require("../../modules/chui_animations/animations");
|
|
2
2
|
|
|
3
3
|
class ContentBlock {
|
|
4
4
|
#body = document.createElement(`contentblock`);
|
|
5
5
|
#disableMarginChild = false;
|
|
6
|
-
constructor(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
constructor(
|
|
7
|
+
options = {
|
|
8
|
+
display: String(),
|
|
9
|
+
direction: String(),
|
|
10
|
+
wrap: String(),
|
|
11
|
+
align: String(),
|
|
12
|
+
justify: String(),
|
|
13
|
+
disableMarginChild: Boolean(),
|
|
14
|
+
}
|
|
15
|
+
) {
|
|
16
|
+
require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_ContentBlock");
|
|
15
17
|
if (options.display !== undefined) this.#body.style.display = options.display;
|
|
16
18
|
if (options.direction !== undefined) this.#body.style.flexDirection = options.direction;
|
|
17
19
|
if (options.wrap !== undefined) this.#body.style.flexWrap = options.wrap;
|
|
@@ -21,7 +23,7 @@ class ContentBlock {
|
|
|
21
23
|
if (this.#disableMarginChild) this.disableMarginChild();
|
|
22
24
|
}
|
|
23
25
|
remove(...components) {
|
|
24
|
-
for (
|
|
26
|
+
for (const component of components) new Animation(component.set()).fadeOutAndRemove();
|
|
25
27
|
}
|
|
26
28
|
// FUNCTIONS
|
|
27
29
|
disableMarginChild() {
|
|
@@ -30,21 +32,33 @@ class ContentBlock {
|
|
|
30
32
|
this.#body.classList.add("contentblock_no_margin");
|
|
31
33
|
}
|
|
32
34
|
add(...components) {
|
|
33
|
-
for (
|
|
34
|
-
new Animation(component.set()).fadeIn()
|
|
35
|
-
this.#body.appendChild(component.set())
|
|
35
|
+
for (const component of components) {
|
|
36
|
+
new Animation(component.set()).fadeIn();
|
|
37
|
+
this.#body.appendChild(component.set());
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
clear() {
|
|
40
|
+
clear() {
|
|
41
|
+
this.#body.innerHTML = "";
|
|
42
|
+
}
|
|
39
43
|
// SETS
|
|
40
44
|
setAutoOverflow(boolean = Boolean(false)) {
|
|
41
45
|
this.#body.classList.toggle("contentblock_auto_overflow", boolean === true);
|
|
42
46
|
}
|
|
43
|
-
setContentEditable(boolean= Boolean(false)) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
setContentEditable(boolean = Boolean(false)) {
|
|
48
|
+
this.#body.setAttribute("contenteditable", boolean);
|
|
49
|
+
}
|
|
50
|
+
setWidth(width = String()) {
|
|
51
|
+
this.#body.style.width = width;
|
|
52
|
+
}
|
|
53
|
+
setHeight(height = String()) {
|
|
54
|
+
this.#body.style.height = height;
|
|
55
|
+
}
|
|
56
|
+
setPadding(value = String()) {
|
|
57
|
+
this.#body.style.padding = value;
|
|
58
|
+
}
|
|
59
|
+
set() {
|
|
60
|
+
return this.#body;
|
|
61
|
+
}
|
|
48
62
|
}
|
|
49
63
|
|
|
50
|
-
exports.ContentBlock = ContentBlock
|
|
64
|
+
exports.ContentBlock = ContentBlock;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
contentblock {
|
|
2
|
-
display: flex
|
|
2
|
+
display: flex;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
/* Опция `disableMarginChild`: внешние отступы детей снимает CSS, а не обход детей в JS
|
|
@@ -11,4 +11,4 @@ contentblock.contentblock_no_margin > * {
|
|
|
11
11
|
/* `setAutoOverflow(true)` */
|
|
12
12
|
contentblock.contentblock_auto_overflow {
|
|
13
13
|
overflow: auto;
|
|
14
|
-
}
|
|
14
|
+
}
|