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
|
@@ -9,11 +9,11 @@ chui_ap_main {
|
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
border-radius: var(--radius_md);
|
|
12
|
-
background: var(--
|
|
12
|
+
background: var(--player_background);
|
|
13
13
|
border: 1px solid var(--border_color);
|
|
14
14
|
overflow: hidden;
|
|
15
|
-
--
|
|
16
|
-
--
|
|
15
|
+
--seek_before_width: 0%;
|
|
16
|
+
--volume_before_width: 0%;
|
|
17
17
|
min-width: 460px;
|
|
18
18
|
height: max-content;
|
|
19
19
|
}
|
|
@@ -40,21 +40,21 @@ chui_ap_main[data_pin] {
|
|
|
40
40
|
chui_ap_main[data_pin="bottom"] {
|
|
41
41
|
inset-inline: 0;
|
|
42
42
|
bottom: 0;
|
|
43
|
-
margin: var(--
|
|
43
|
+
margin: var(--block_margin);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
chui_ap_main[data_pin="top"] {
|
|
47
47
|
inset-inline: 0;
|
|
48
48
|
top: 0;
|
|
49
|
-
margin: var(--
|
|
49
|
+
margin: var(--block_margin);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/* Боковые закрепления — компактная полоса у края, по центру высоты окна */
|
|
53
53
|
chui_ap_main[data_pin="left"],
|
|
54
54
|
chui_ap_main[data_pin="right"] {
|
|
55
55
|
inset-block: 0;
|
|
56
|
-
width: min(460px, calc(100% - 2 * var(--
|
|
57
|
-
margin: auto var(--
|
|
56
|
+
width: min(460px, calc(100% - 2 * var(--block_margin)));
|
|
57
|
+
margin: auto var(--block_margin);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
chui_ap_main[data_pin="left"] {
|
|
@@ -112,7 +112,7 @@ chui_ap_seek_buf {
|
|
|
112
112
|
width: 0;
|
|
113
113
|
height: var(--player_track_height);
|
|
114
114
|
border-radius: var(--radius_pill);
|
|
115
|
-
background: var(--
|
|
115
|
+
background: var(--player_slider_buffer_background);
|
|
116
116
|
position: absolute;
|
|
117
117
|
inset-inline-start: 6px;
|
|
118
118
|
max-width: calc(100% - 12px);
|
|
@@ -148,8 +148,8 @@ chui_ap_info chui_label {
|
|
|
148
148
|
#chui_ap_seek {
|
|
149
149
|
background-image: linear-gradient(
|
|
150
150
|
to right,
|
|
151
|
-
var(--blue_prime_background) 0 var(--
|
|
152
|
-
var(--
|
|
151
|
+
var(--blue_prime_background) 0 var(--seek_before_width, 0%),
|
|
152
|
+
var(--player_slider_background) var(--seek_before_width, 0%) 100%
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -158,16 +158,16 @@ chui_ap_info chui_label {
|
|
|
158
158
|
#chui_ap_volume {
|
|
159
159
|
background-image: linear-gradient(
|
|
160
160
|
to right,
|
|
161
|
-
var(--text_color) 0 var(--
|
|
162
|
-
var(--
|
|
161
|
+
var(--text_color) 0 var(--volume_before_width, 0%),
|
|
162
|
+
var(--player_slider_background) var(--volume_before_width, 0%) 100%
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
#chui_ap_volume:disabled {
|
|
167
167
|
background-image: linear-gradient(
|
|
168
168
|
to right,
|
|
169
|
-
var(--
|
|
170
|
-
var(--
|
|
169
|
+
var(--player_slider_buffer_background) 0 var(--volume_before_width, 0%),
|
|
170
|
+
var(--player_slider_background) var(--volume_before_width, 0%) 100%
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -191,9 +191,17 @@ chui_ap_info chui_label {
|
|
|
191
191
|
width: 9px;
|
|
192
192
|
border-radius: 50%;
|
|
193
193
|
background-color: var(--player_thumb_background);
|
|
194
|
-
box-shadow: 0 0 0 2px var(--
|
|
194
|
+
box-shadow: 0 0 0 2px var(--player_background);
|
|
195
195
|
cursor: pointer;
|
|
196
196
|
margin-top: calc((var(--player_track_height) - 9px) / 2);
|
|
197
|
+
/* Рост под курсором — тот же переход: своё время у ручки есть только здесь,
|
|
198
|
+
общее правило до псевдоэлементов бегунка не достаёт */
|
|
199
|
+
transition:
|
|
200
|
+
height var(--motion_fast) var(--motion_ease),
|
|
201
|
+
width var(--motion_fast) var(--motion_ease),
|
|
202
|
+
margin-top var(--motion_fast) var(--motion_ease),
|
|
203
|
+
background-color var(--motion_fast) var(--motion_ease),
|
|
204
|
+
box-shadow var(--motion_fast) var(--motion_ease);
|
|
197
205
|
}
|
|
198
206
|
|
|
199
207
|
/* У выключенной полосы ползунка нет: она и так приглушена заливкой */
|
|
@@ -215,7 +223,7 @@ chui_ap_main:hover #chui_ap_volume:not(:disabled)::-webkit-slider-thumb,
|
|
|
215
223
|
margin-top: calc((var(--player_track_height) - 12px) / 2);
|
|
216
224
|
background-color: var(--player_thumb_background);
|
|
217
225
|
box-shadow:
|
|
218
|
-
0 0 0 2px var(--
|
|
226
|
+
0 0 0 2px var(--player_background),
|
|
219
227
|
var(--box_shadow_main);
|
|
220
228
|
}
|
|
221
229
|
|
|
@@ -269,6 +277,14 @@ chui_ap_volume_icon {
|
|
|
269
277
|
cursor: pointer;
|
|
270
278
|
}
|
|
271
279
|
|
|
280
|
+
/* Кегль глифа — ключом плеера: у `chui_icon` есть своё правило (размер шапки),
|
|
281
|
+
поэтому размер задаётся значку, а не кнопке. Прежде число стояло в коде (пять мест) */
|
|
282
|
+
chui_ap_play_pause chui_icon,
|
|
283
|
+
chui_ap_fx_icon chui_icon,
|
|
284
|
+
chui_ap_volume_icon chui_icon {
|
|
285
|
+
font-size: var(--player_icon_size);
|
|
286
|
+
}
|
|
287
|
+
|
|
272
288
|
/* Главная кнопка — светлый круг с глифом цвета подложки, как у Spotify: роль акцента
|
|
273
289
|
в плеере занята полосами прогресса, а круг читается кнопкой воспроизведения */
|
|
274
290
|
chui_ap_play_pause {
|
|
@@ -313,6 +329,8 @@ chui_ap_fx_dropdown {
|
|
|
313
329
|
|
|
314
330
|
chui_ap_fx_dropdown.fx_open {
|
|
315
331
|
display: block;
|
|
332
|
+
/* Раскрытие панели — общим кадром: прежде секция вставала на место рывком */
|
|
333
|
+
animation: chui_panel_in var(--motion_base) var(--motion_spring);
|
|
316
334
|
}
|
|
317
335
|
|
|
318
336
|
/* Открытая кнопка — как у прочих выпадающих: состояние держит тонировка акцента */
|
|
@@ -333,7 +351,7 @@ chui_ap_equalizer_main {
|
|
|
333
351
|
/* === ПРЕСЕТЫ И ВЫКЛЮЧАТЕЛЬ ЭКВАЛАЙЗЕРА === */
|
|
334
352
|
/* Поле пресетов и выключатель — общекитовые `Select` и `Toggle`, вложенные в полосу панели:
|
|
335
353
|
клавиатура, роли и состояния у них свои, а здесь только размеры. У `Select` ширина взята
|
|
336
|
-
токеном страницы (`--control_width`), у `Toggle` — свои поля `--
|
|
354
|
+
токеном страницы (`--control_width`), у `Toggle` — свои поля `--block_margin`, из-за которых
|
|
337
355
|
выключатель не вставал к краю */
|
|
338
356
|
chui_ap_equalizer_controls chui_selectbox {
|
|
339
357
|
flex: 0 1 260px;
|
|
@@ -419,7 +437,7 @@ chui_eq_slider_main slider_label:first-child {
|
|
|
419
437
|
color: var(--text_color);
|
|
420
438
|
text-align: center;
|
|
421
439
|
opacity: 0;
|
|
422
|
-
transition: opacity
|
|
440
|
+
transition: opacity var(--motion_fast) var(--motion_ease);
|
|
423
441
|
pointer-events: none;
|
|
424
442
|
}
|
|
425
443
|
|
|
@@ -470,13 +488,13 @@ chui_eq_slider_main:focus-within slider_label:first-child {
|
|
|
470
488
|
background-repeat: no-repeat;
|
|
471
489
|
/* Заливка идёт от низа до ручки: полоса заливки короче рельса ровно на размер ручки
|
|
472
490
|
и стоит по центру, поэтому её края совпадают с крайними положениями ручки при любом
|
|
473
|
-
значении (`--
|
|
491
|
+
значении (`--fx_before_width` считает скрипт, как у полос прогресса и громкости) */
|
|
474
492
|
background-size: 100% calc(100% - var(--fx_knob));
|
|
475
493
|
background-position: center;
|
|
476
494
|
background-image: linear-gradient(
|
|
477
495
|
to top,
|
|
478
|
-
var(--blue_prime_background) 0 var(--
|
|
479
|
-
transparent var(--
|
|
496
|
+
var(--blue_prime_background) 0 var(--fx_before_width),
|
|
497
|
+
transparent var(--fx_before_width)
|
|
480
498
|
);
|
|
481
499
|
}
|
|
482
500
|
|
|
@@ -505,8 +523,8 @@ chui_eq_slider_main:focus-within slider_label:first-child {
|
|
|
505
523
|
accent-color: var(--text_color_disabled);
|
|
506
524
|
background-image: linear-gradient(
|
|
507
525
|
to top,
|
|
508
|
-
var(--text_color_disabled) 0 var(--
|
|
509
|
-
transparent var(--
|
|
526
|
+
var(--text_color_disabled) 0 var(--fx_before_width),
|
|
527
|
+
transparent var(--fx_before_width)
|
|
510
528
|
);
|
|
511
529
|
}
|
|
512
530
|
|
|
@@ -4,12 +4,12 @@ const { I18n } = require("../../modules/chui_i18n/chui_i18n");
|
|
|
4
4
|
const { makeKeyboardButton } = require("../../modules/chui_a11y/chui_a11y");
|
|
5
5
|
// image-size 2.x отдаёт объект с функцией внутри (сборка ESM + CJS-обёртка), а 1.x — саму
|
|
6
6
|
// функцию: разворачиваем оба варианта, чтобы модуль не зависел от установленной версии
|
|
7
|
-
const
|
|
8
|
-
const sizeOf = typeof
|
|
7
|
+
const imageSizeModule = require("image-size");
|
|
8
|
+
const sizeOf = typeof imageSizeModule === "function" ? imageSizeModule : imageSizeModule.imageSize;
|
|
9
9
|
const { Icon, Icons } = require("../chui_icons/icons");
|
|
10
10
|
|
|
11
11
|
class Image {
|
|
12
|
-
#
|
|
12
|
+
#chuiImage = document.createElement("chui_image");
|
|
13
13
|
#image = document.createElement("img");
|
|
14
14
|
#alt = "";
|
|
15
15
|
#decorative = false;
|
|
@@ -28,31 +28,31 @@ class Image {
|
|
|
28
28
|
) {
|
|
29
29
|
require("../../modules/chui_functions").setStyles(__dirname + "/image_styles.css", "chUiJS_Image");
|
|
30
30
|
// Внешний отступ снимает класс: его читает CSS
|
|
31
|
-
if (options.disableMargin) this.#
|
|
31
|
+
if (options.disableMargin) this.#chuiImage.classList.add("image_no_margin");
|
|
32
32
|
// Источник — необязательная опция: пустая заготовка пути раньше читалась как файл (ENOENT)
|
|
33
33
|
const path = optionOr(options.path, undefined);
|
|
34
34
|
const base64 = optionOr(options.base64, undefined);
|
|
35
|
-
const
|
|
35
|
+
const httpPath = optionOr(options.httpPath, undefined);
|
|
36
36
|
if (path !== undefined)
|
|
37
37
|
this.#image.setAttribute(
|
|
38
38
|
"src",
|
|
39
39
|
`data:image/png;base64,${require("fs").readFileSync(path).toString("base64")}`
|
|
40
40
|
);
|
|
41
41
|
if (base64 !== undefined) this.#image.setAttribute("src", `data:image/png;base64,${base64}`);
|
|
42
|
-
if (
|
|
43
|
-
if (options.width !== undefined) this.#
|
|
44
|
-
if (options.height !== undefined) this.#
|
|
42
|
+
if (httpPath !== undefined) this.#image.setAttribute("src", httpPath);
|
|
43
|
+
if (options.width !== undefined) this.#chuiImage.style.width = options.width;
|
|
44
|
+
if (options.height !== undefined) this.#chuiImage.style.height = options.height;
|
|
45
45
|
if (options.width !== undefined) this.#image.style.width = options.width;
|
|
46
46
|
if (options.height !== undefined) this.#image.style.height = options.height;
|
|
47
|
-
this.#
|
|
47
|
+
this.#chuiImage.appendChild(this.#image);
|
|
48
48
|
// Alt по умолчанию пустой: без атрибута скринридер читал бы вместо подписи data-URL картинки
|
|
49
49
|
this.setAlt(options.alt === undefined ? "" : options.alt);
|
|
50
50
|
if (options.decorative !== undefined) this.setDecorative(options.decorative === true);
|
|
51
51
|
|
|
52
52
|
if (options.openPopup) {
|
|
53
|
-
this.#
|
|
53
|
+
this.#chuiImage.addEventListener("click", () => {
|
|
54
54
|
let popup;
|
|
55
|
-
|
|
55
|
+
const windowSize = document.body.getBoundingClientRect();
|
|
56
56
|
if (options.path !== undefined) {
|
|
57
57
|
//
|
|
58
58
|
let imageSet;
|
|
@@ -80,24 +80,27 @@ class Image {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
if (options.base64 !== undefined) {
|
|
83
|
-
let
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
let imageSize;
|
|
84
|
+
const img = Buffer.from(options.base64, "base64");
|
|
85
|
+
const dimensions = sizeOf(img);
|
|
86
|
+
// Картинка вписывается в окно по той стороне, которой не хватает: высокая
|
|
87
|
+
// ограничивается высотой окна, широкая — шириной. Прежде в широкой ветке
|
|
88
|
+
// стояла высота окна (опечатка): картинка 1600×400 в окне 1000×800
|
|
89
|
+
// получала ширину 800 px вместо 1000
|
|
90
|
+
if (dimensions.height > windowSize.height) {
|
|
91
|
+
imageSize = ["auto", `${windowSize.height}px`];
|
|
92
|
+
} else if (dimensions.width > windowSize.width) {
|
|
93
|
+
imageSize = [`${windowSize.width}px`, "auto"];
|
|
91
94
|
} else {
|
|
92
|
-
|
|
95
|
+
imageSize = ["auto", "auto"];
|
|
93
96
|
}
|
|
94
97
|
//
|
|
95
|
-
imageSet = new Image({
|
|
98
|
+
const imageSet = new Image({
|
|
96
99
|
disableMargin: true,
|
|
97
100
|
openPopup: false,
|
|
98
101
|
base64: options.base64,
|
|
99
|
-
width:
|
|
100
|
-
height:
|
|
102
|
+
width: imageSize[0],
|
|
103
|
+
height: imageSize[1],
|
|
101
104
|
});
|
|
102
105
|
popup = new ImagePopup(imageSet.set(), "max-content", "max-content");
|
|
103
106
|
}
|
|
@@ -107,11 +110,11 @@ class Image {
|
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
setWidth(value) {
|
|
110
|
-
this.#
|
|
113
|
+
this.#chuiImage.style.width = value;
|
|
111
114
|
this.#image.style.width = value;
|
|
112
115
|
}
|
|
113
116
|
setHeight(value) {
|
|
114
|
-
this.#
|
|
117
|
+
this.#chuiImage.style.height = value;
|
|
115
118
|
this.#image.style.height = value;
|
|
116
119
|
}
|
|
117
120
|
/** Подпись изображения (пустая строка — декоративное) */
|
|
@@ -129,52 +132,52 @@ class Image {
|
|
|
129
132
|
/** Декоративное изображение прячется от скринридера целиком (`aria-hidden`) */
|
|
130
133
|
setDecorative(boolean = Boolean()) {
|
|
131
134
|
this.#decorative = boolean;
|
|
132
|
-
if (this.#decorative) this.#
|
|
133
|
-
else this.#
|
|
135
|
+
if (this.#decorative) this.#chuiImage.setAttribute("aria-hidden", "true");
|
|
136
|
+
else this.#chuiImage.removeAttribute("aria-hidden");
|
|
134
137
|
this.#image.setAttribute("alt", this.#decorative ? "" : this.#alt);
|
|
135
138
|
return this;
|
|
136
139
|
}
|
|
137
140
|
set() {
|
|
138
|
-
return this.#
|
|
141
|
+
return this.#chuiImage;
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
class ImagePopup {
|
|
143
146
|
#id = require("randomstring").generate();
|
|
144
|
-
#
|
|
145
|
-
#
|
|
146
|
-
#
|
|
147
|
-
#
|
|
147
|
+
#chuiImagePopup = document.createElement(`chui_image_popup`);
|
|
148
|
+
#popupContent = document.createElement("popup_content_test");
|
|
149
|
+
#imagePopupContent = document.createElement("image_popup_content");
|
|
150
|
+
#closePopup = document.createElement("image_popup_close");
|
|
148
151
|
constructor(image, width, height) {
|
|
149
|
-
this.#
|
|
152
|
+
this.#chuiImagePopup.id = this.#id;
|
|
150
153
|
//ADDS
|
|
151
|
-
this.#
|
|
152
|
-
this.#
|
|
153
|
-
this.#
|
|
154
|
+
this.#imagePopupContent.style.width = width;
|
|
155
|
+
this.#imagePopupContent.style.height = height;
|
|
156
|
+
this.#imagePopupContent.appendChild(image);
|
|
154
157
|
|
|
155
|
-
this.#
|
|
158
|
+
this.#closePopup.innerHTML = new Icon(Icons.NAVIGATION.CLOSE, "30px", "").getHTML();
|
|
156
159
|
// Крестик без подписи читался бы как «кнопка» без имени: значок помечен aria-hidden,
|
|
157
160
|
// а роль и Enter/Space даёт общий хелпер — клавиатурой слой тоже закрывается
|
|
158
|
-
makeKeyboardButton(this.#
|
|
159
|
-
this.#
|
|
160
|
-
this.#
|
|
161
|
+
makeKeyboardButton(this.#closePopup);
|
|
162
|
+
this.#closePopup.setAttribute("aria-label", I18n.t("common.close"));
|
|
163
|
+
this.#closePopup.addEventListener("click", () => this.close());
|
|
161
164
|
|
|
162
|
-
this.#
|
|
163
|
-
this.#
|
|
164
|
-
this.#
|
|
165
|
+
this.#popupContent.appendChild(this.#imagePopupContent);
|
|
166
|
+
this.#popupContent.appendChild(this.#closePopup);
|
|
167
|
+
this.#chuiImagePopup.appendChild(this.#popupContent);
|
|
165
168
|
}
|
|
166
169
|
open() {
|
|
167
|
-
|
|
170
|
+
const dialog = this.#chuiImagePopup;
|
|
168
171
|
new Animation(dialog).fadeIn();
|
|
169
172
|
new Animation(dialog.firstChild).scaleIn();
|
|
170
173
|
}
|
|
171
174
|
close() {
|
|
172
|
-
|
|
175
|
+
const dialog = this.#chuiImagePopup;
|
|
173
176
|
new Animation(dialog.firstChild).scaleOut();
|
|
174
177
|
new Animation(dialog).fadeOutAndRemove();
|
|
175
178
|
}
|
|
176
179
|
set() {
|
|
177
|
-
return this.#
|
|
180
|
+
return this.#chuiImagePopup;
|
|
178
181
|
}
|
|
179
182
|
}
|
|
180
183
|
|
|
@@ -54,19 +54,19 @@ class ImageCompare {
|
|
|
54
54
|
#after = document.createElement("img");
|
|
55
55
|
#handle = document.createElement("image_compare_handle");
|
|
56
56
|
#grip = document.createElement("image_compare_grip");
|
|
57
|
-
#
|
|
58
|
-
#
|
|
57
|
+
#badgeBefore = document.createElement("image_compare_badge");
|
|
58
|
+
#badgeAfter = document.createElement("image_compare_badge");
|
|
59
59
|
#value = 50;
|
|
60
60
|
#step = 1;
|
|
61
61
|
#orientation = ImageCompare.ORIENTATION.HORIZONTAL;
|
|
62
62
|
#labels = true;
|
|
63
63
|
#disabled = false;
|
|
64
64
|
#dragging = false;
|
|
65
|
-
#
|
|
66
|
-
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
65
|
+
#labelText = undefined;
|
|
66
|
+
#beforeAlt = undefined;
|
|
67
|
+
#afterAlt = undefined;
|
|
68
|
+
#onChange = undefined;
|
|
69
|
+
#changeListeners = [];
|
|
70
70
|
|
|
71
71
|
constructor(
|
|
72
72
|
options = {
|
|
@@ -91,11 +91,11 @@ class ImageCompare {
|
|
|
91
91
|
ImageCompare.#counter += 1;
|
|
92
92
|
this.#id = options.id === undefined ? `chui_image_compare_${ImageCompare.#counter}` : options.id;
|
|
93
93
|
this.#root.id = this.#id;
|
|
94
|
-
this.#
|
|
95
|
-
this.#
|
|
96
|
-
this.#
|
|
94
|
+
this.#labelText = options.label === undefined ? undefined : options.label;
|
|
95
|
+
this.#beforeAlt = options.beforeAlt;
|
|
96
|
+
this.#afterAlt = options.afterAlt;
|
|
97
97
|
this.#labels = options.labels !== false;
|
|
98
|
-
this.#
|
|
98
|
+
this.#onChange = options.onChange;
|
|
99
99
|
if (options.width !== undefined) this.#root.style.width = options.width;
|
|
100
100
|
if (options.height !== undefined) this.#root.style.setProperty("--image_compare_height", options.height);
|
|
101
101
|
if (options.value !== undefined) this.#value = this.#clamp(options.value);
|
|
@@ -114,8 +114,8 @@ class ImageCompare {
|
|
|
114
114
|
this.#after.className = "image_compare_image";
|
|
115
115
|
this.#before.setAttribute("draggable", "false");
|
|
116
116
|
this.#after.setAttribute("draggable", "false");
|
|
117
|
-
this.#before.setAttribute("alt", this.#altText(this.#
|
|
118
|
-
this.#after.setAttribute("alt", this.#altText(this.#
|
|
117
|
+
this.#before.setAttribute("alt", this.#altText(this.#beforeAlt, "media.imageCompareBefore"));
|
|
118
|
+
this.#after.setAttribute("alt", this.#altText(this.#afterAlt, "media.imageCompareAfter"));
|
|
119
119
|
// Ручка ведёт себя как ползунок: имя берётся из заголовка или из опции label
|
|
120
120
|
this.#handle.setAttribute("role", "slider");
|
|
121
121
|
this.#handle.setAttribute("tabindex", "0");
|
|
@@ -125,22 +125,22 @@ class ImageCompare {
|
|
|
125
125
|
else
|
|
126
126
|
this.#handle.setAttribute(
|
|
127
127
|
"aria-label",
|
|
128
|
-
this.#
|
|
128
|
+
this.#labelText === undefined ? I18n.t("media.imageCompareLabel") : this.#labelText
|
|
129
129
|
);
|
|
130
130
|
this.#grip.setAttribute("aria-hidden", "true");
|
|
131
131
|
this.#grip.innerText = "‹ ›";
|
|
132
|
-
this.#
|
|
133
|
-
this.#
|
|
134
|
-
this.#
|
|
135
|
-
this.#
|
|
132
|
+
this.#badgeBefore.className = "image_compare_badge image_compare_badge_before";
|
|
133
|
+
this.#badgeAfter.className = "image_compare_badge image_compare_badge_after";
|
|
134
|
+
this.#badgeBefore.innerText = I18n.t("media.imageCompareBefore");
|
|
135
|
+
this.#badgeAfter.innerText = I18n.t("media.imageCompareAfter");
|
|
136
136
|
|
|
137
137
|
this.#handle.appendChild(this.#grip);
|
|
138
138
|
this.#clip.appendChild(this.#after);
|
|
139
139
|
this.#frame.appendChild(this.#before);
|
|
140
140
|
this.#frame.appendChild(this.#clip);
|
|
141
141
|
this.#frame.appendChild(this.#handle);
|
|
142
|
-
this.#frame.appendChild(this.#
|
|
143
|
-
this.#frame.appendChild(this.#
|
|
142
|
+
this.#frame.appendChild(this.#badgeBefore);
|
|
143
|
+
this.#frame.appendChild(this.#badgeAfter);
|
|
144
144
|
this.#root.appendChild(this.#frame);
|
|
145
145
|
|
|
146
146
|
// Перетаскивание идёт с захватом указателя на кадре: слушателей окна не нужно
|
|
@@ -209,7 +209,7 @@ class ImageCompare {
|
|
|
209
209
|
return this;
|
|
210
210
|
}
|
|
211
211
|
addChangeListener(listener = () => {}) {
|
|
212
|
-
this.#
|
|
212
|
+
this.#changeListeners.push(listener);
|
|
213
213
|
return this;
|
|
214
214
|
}
|
|
215
215
|
set() {
|
|
@@ -218,8 +218,8 @@ class ImageCompare {
|
|
|
218
218
|
|
|
219
219
|
// === ВНУТРЕННЕЕ ===
|
|
220
220
|
#emit() {
|
|
221
|
-
for (const listener of this.#
|
|
222
|
-
if (this.#
|
|
221
|
+
for (const listener of this.#changeListeners) listener(this.#value);
|
|
222
|
+
if (this.#onChange !== undefined) this.#onChange(this.#value);
|
|
223
223
|
}
|
|
224
224
|
#clamp(value) {
|
|
225
225
|
return Math.max(0, Math.min(100, Number(value) || 0));
|
|
@@ -254,22 +254,22 @@ class ImageCompare {
|
|
|
254
254
|
this.#syncBadges(this.#value, 100 - this.#value);
|
|
255
255
|
return;
|
|
256
256
|
}
|
|
257
|
-
const
|
|
257
|
+
const fromEnd = this.#isRTL();
|
|
258
258
|
this.#handle.style.top = "";
|
|
259
|
-
this.#handle.style.left =
|
|
260
|
-
this.#handle.style.right =
|
|
261
|
-
this.#clip.style.clipPath =
|
|
262
|
-
this.#syncBadges(
|
|
259
|
+
this.#handle.style.left = fromEnd ? "" : percent;
|
|
260
|
+
this.#handle.style.right = fromEnd ? percent : "";
|
|
261
|
+
this.#clip.style.clipPath = fromEnd ? `inset(0 ${percent} 0 0)` : `inset(0 0 0 ${percent})`;
|
|
262
|
+
this.#syncBadges(fromEnd ? 100 - this.#value : this.#value, fromEnd ? this.#value : 100 - this.#value);
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
265
265
|
* Подпись стороны видна, только если её половина кадра достаточно широка:
|
|
266
266
|
* иначе «До» оказалось бы поверх картинки «после» и путало бы.
|
|
267
267
|
*/
|
|
268
|
-
#syncBadges(
|
|
269
|
-
const enough = this.#labels !== false &&
|
|
270
|
-
const
|
|
271
|
-
this.#
|
|
272
|
-
this.#
|
|
268
|
+
#syncBadges(beforePart, afterPart) {
|
|
269
|
+
const enough = this.#labels !== false && beforePart >= BADGE_MIN_PART;
|
|
270
|
+
const enoughAfter = this.#labels !== false && afterPart >= BADGE_MIN_PART;
|
|
271
|
+
this.#badgeBefore.style.display = enough ? "" : "none";
|
|
272
|
+
this.#badgeAfter.style.display = enoughAfter ? "" : "none";
|
|
273
273
|
}
|
|
274
274
|
/** Доля кадра под указателем: в RTL отсчёт идёт с другого края */
|
|
275
275
|
#percentAt(clientX, clientY) {
|
|
@@ -278,8 +278,8 @@ class ImageCompare {
|
|
|
278
278
|
if (this.#orientation === ImageCompare.ORIENTATION.VERTICAL) {
|
|
279
279
|
return ((clientY - rect.top) / rect.height) * 100;
|
|
280
280
|
}
|
|
281
|
-
const
|
|
282
|
-
return this.#isRTL() ? 100 -
|
|
281
|
+
const fromStart = ((clientX - rect.left) / rect.width) * 100;
|
|
282
|
+
return this.#isRTL() ? 100 - fromStart : fromStart;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
// === ОБРАБОТЧИКИ ===
|
|
@@ -4,14 +4,14 @@ chui_image_compare {
|
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
height: max-content;
|
|
6
6
|
width: max-content;
|
|
7
|
-
margin: var(--
|
|
7
|
+
margin: var(--block_margin);
|
|
8
8
|
font-size: var(--font_default_size);
|
|
9
9
|
color: var(--text_color);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
image_compare_title {
|
|
13
13
|
display: block;
|
|
14
|
-
margin: var(--
|
|
14
|
+
margin: var(--block_margin);
|
|
15
15
|
font-size: var(--font_labels_size);
|
|
16
16
|
font-weight: 500;
|
|
17
17
|
color: var(--text_color);
|
|
@@ -73,8 +73,8 @@ image_compare_handle {
|
|
|
73
73
|
justify-content: center;
|
|
74
74
|
width: 2px;
|
|
75
75
|
margin-inline: -1px;
|
|
76
|
-
background: var(--
|
|
77
|
-
box-shadow:
|
|
76
|
+
background: var(--element_background_2);
|
|
77
|
+
box-shadow: var(--box_shadow_halo);
|
|
78
78
|
cursor: ew-resize;
|
|
79
79
|
outline: none;
|
|
80
80
|
}
|
|
@@ -102,7 +102,7 @@ image_compare_grip {
|
|
|
102
102
|
width: 34px;
|
|
103
103
|
height: 34px;
|
|
104
104
|
border-radius: 50%;
|
|
105
|
-
background: var(--
|
|
105
|
+
background: var(--element_background_2);
|
|
106
106
|
border: 1px solid var(--border_color);
|
|
107
107
|
box-shadow: var(--box_shadow_drop);
|
|
108
108
|
color: var(--text_color);
|