chuijs 4.0.2 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/README.md +43 -644
- package/framework/appLayout/default/chui_app_layout.js +308 -260
- package/framework/appLayout/default/global_style.css +85 -48
- package/framework/components/chui_accordion/accordion.js +29 -26
- package/framework/components/chui_accordion/styles.css +6 -5
- package/framework/components/chui_action_sheet/action_sheet.js +59 -33
- package/framework/components/chui_action_sheet/styles.css +2 -1
- package/framework/components/chui_affix/affix.js +11 -6
- package/framework/components/chui_alert/alert.js +23 -14
- package/framework/components/chui_avatar/avatar.js +23 -22
- package/framework/components/chui_avatar_group/avatar_group.js +21 -19
- package/framework/components/chui_backtop/backtop.js +35 -19
- package/framework/components/chui_badge/badge.js +15 -13
- package/framework/components/chui_breadcrumb/breadcrumb.js +15 -13
- package/framework/components/chui_button/button.js +42 -22
- package/framework/components/chui_button/styles.css +2 -2
- package/framework/components/chui_calendar/calendar.js +12 -10
- package/framework/components/chui_card/card.js +43 -23
- package/framework/components/chui_chat/chat.js +72 -33
- package/framework/components/chui_clipboard_history/clipboard_history.js +30 -21
- package/framework/components/chui_clipboard_history/styles.css +4 -2
- package/framework/components/chui_code/code.js +2 -2
- package/framework/components/chui_code/styles.css +2 -2
- package/framework/components/chui_code_editor/code_editor.js +47 -31
- package/framework/components/chui_code_editor/styles.css +3 -2
- package/framework/components/chui_command_palette/command_palette.js +60 -37
- package/framework/components/chui_console/console.js +5 -5
- package/framework/components/chui_console/styles.css +1 -1
- package/framework/components/chui_content_block/content_block.js +33 -19
- package/framework/components/chui_content_block/styles.css +2 -2
- package/framework/components/chui_context_menu/context_menu.js +9 -4
- package/framework/components/chui_custom_element/custom_element.js +22 -15
- package/framework/components/chui_data_grid/data_grid.js +396 -234
- package/framework/components/chui_data_grid/styles.css +10 -8
- package/framework/components/chui_descriptions/descriptions.js +34 -17
- package/framework/components/chui_details/details.js +32 -26
- package/framework/components/chui_details/styles.css +5 -4
- package/framework/components/chui_diff_viewer/diff_viewer.js +91 -66
- package/framework/components/chui_diff_viewer/styles.css +1 -1
- package/framework/components/chui_divider/divider.js +13 -11
- package/framework/components/chui_drawer/drawer.js +27 -25
- package/framework/components/chui_drop_zone/drop_zone.js +31 -21
- package/framework/components/chui_empty_state/empty_state.js +20 -15
- package/framework/components/chui_fieldset/fieldset.js +37 -20
- package/framework/components/chui_fieldset/styles.css +1 -1
- package/framework/components/chui_file_explorer/file_explorer.js +157 -86
- package/framework/components/chui_file_explorer/styles.css +2 -1
- package/framework/components/chui_form/form.js +31 -19
- package/framework/components/chui_form/styles.css +1 -1
- package/framework/components/chui_gantt/gantt.js +64 -40
- package/framework/components/chui_graphs/graphs.js +301 -200
- package/framework/components/chui_graphs/styles.css +1 -1
- package/framework/components/chui_hero/hero.js +40 -22
- package/framework/components/chui_html_block/html_block.js +6 -6
- package/framework/components/chui_html_block/styles.css +2 -2
- package/framework/components/chui_hx/hx.js +3 -3
- package/framework/components/chui_hx/styles.css +11 -4
- package/framework/components/chui_icons/icons.js +2109 -2109
- package/framework/components/chui_icons/styles.css +2 -2
- package/framework/components/chui_inputs/chui_check_box/check_box.js +31 -19
- package/framework/components/chui_inputs/chui_check_box/styles.css +18 -18
- package/framework/components/chui_inputs/chui_chips/chips.js +50 -40
- package/framework/components/chui_inputs/chui_chips/styles.css +4 -2
- package/framework/components/chui_inputs/chui_color_picker/color_picker.js +36 -24
- package/framework/components/chui_inputs/chui_combo_box/combo_box.js +100 -82
- package/framework/components/chui_inputs/chui_combo_box/styles.css +14 -12
- package/framework/components/chui_inputs/chui_date/date.js +102 -66
- package/framework/components/chui_inputs/chui_date/styles.css +12 -11
- package/framework/components/chui_inputs/chui_date_range/date_range.js +40 -29
- package/framework/components/chui_inputs/chui_datetime/datetime.js +35 -27
- package/framework/components/chui_inputs/chui_email/email.js +43 -31
- package/framework/components/chui_inputs/chui_email/styles.css +5 -5
- package/framework/components/chui_inputs/chui_file/file.js +68 -41
- package/framework/components/chui_inputs/chui_file/styles.css +13 -12
- package/framework/components/chui_inputs/chui_hotkey/hotkey.js +61 -36
- package/framework/components/chui_inputs/chui_masked/masked.js +39 -28
- package/framework/components/chui_inputs/chui_mention/mention.js +77 -30
- package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +173 -153
- package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +9 -7
- package/framework/components/chui_inputs/chui_number/number.js +58 -41
- package/framework/components/chui_inputs/chui_number/styles.css +7 -7
- package/framework/components/chui_inputs/chui_otp/otp.js +38 -29
- package/framework/components/chui_inputs/chui_password/password.js +58 -36
- package/framework/components/chui_inputs/chui_password/styles.css +8 -8
- package/framework/components/chui_inputs/chui_radio_button/radio_button.js +37 -25
- package/framework/components/chui_inputs/chui_radio_button/styles.css +20 -20
- package/framework/components/chui_inputs/chui_rating/rating.js +26 -22
- package/framework/components/chui_inputs/chui_select_box/select_box.js +102 -78
- package/framework/components/chui_inputs/chui_select_box/styles.css +11 -11
- package/framework/components/chui_inputs/chui_slider/slider.js +29 -26
- package/framework/components/chui_inputs/chui_slider/styles.css +2 -1
- package/framework/components/chui_inputs/chui_text/styles.css +8 -8
- package/framework/components/chui_inputs/chui_text/text.js +65 -44
- package/framework/components/chui_inputs/chui_text_area/styles.css +6 -6
- package/framework/components/chui_inputs/chui_text_area/text_area.js +51 -28
- package/framework/components/chui_inputs/chui_time/styles.css +5 -3
- package/framework/components/chui_inputs/chui_time/time.js +38 -27
- package/framework/components/chui_inputs/chui_toggle/styles.css +3 -3
- package/framework/components/chui_inputs/chui_toggle/toggle.js +16 -16
- package/framework/components/chui_json_editor/json_editor.js +53 -43
- package/framework/components/chui_json_viewer/json_viewer.js +52 -33
- package/framework/components/chui_json_viewer/styles.css +3 -2
- package/framework/components/chui_kanban/kanban.js +52 -34
- package/framework/components/chui_kbd/kbd.js +12 -10
- package/framework/components/chui_label/label.js +14 -12
- package/framework/components/chui_label/styles.css +2 -2
- package/framework/components/chui_link/link.js +27 -20
- package/framework/components/chui_list/list.js +31 -27
- package/framework/components/chui_list/styles.css +2 -1
- package/framework/components/chui_markdown_editor/markdown_editor.js +60 -44
- package/framework/components/chui_media/audio.js +326 -227
- package/framework/components/chui_media/audio_styles.css +40 -21
- package/framework/components/chui_media/image.js +70 -38
- package/framework/components/chui_media/image_compare.js +52 -21
- package/framework/components/chui_media/image_styles.css +3 -3
- package/framework/components/chui_media/video.js +155 -62
- package/framework/components/chui_media/video_styles.css +33 -16
- package/framework/components/chui_menu_bar/menu_bar.js +26 -24
- package/framework/components/chui_menu_bar/styles.css +4 -2
- package/framework/components/chui_modal/modal.js +44 -43
- package/framework/components/chui_modal/styles.css +3 -2
- package/framework/components/chui_notification/notification.js +50 -34
- package/framework/components/chui_notification/notification_download.js +31 -25
- package/framework/components/chui_notification/notification_download_progress.css +3 -2
- package/framework/components/chui_notification/notification_download_progress.js +47 -41
- package/framework/components/chui_notification/notification_update.js +23 -16
- package/framework/components/chui_notification/status_plate.js +2 -2
- package/framework/components/chui_notification/styles_download.css +1 -1
- package/framework/components/chui_notification/styles_update.css +1 -1
- package/framework/components/chui_org_chart/org_chart.js +74 -35
- package/framework/components/chui_pagination/pagination.js +62 -27
- package/framework/components/chui_paragraph/paragraph.js +2 -2
- package/framework/components/chui_paragraph/styles.css +1 -1
- package/framework/components/chui_popover/popover.js +49 -28
- package/framework/components/chui_popups/popups.js +137 -108
- package/framework/components/chui_popups/styles.css +2 -2
- package/framework/components/chui_print_button/print_button.js +33 -23
- package/framework/components/chui_progress_bar/progress_bar.js +23 -15
- package/framework/components/chui_progress_bar/styles.css +2 -2
- package/framework/components/chui_progress_ring/progress_ring.js +17 -15
- package/framework/components/chui_qrcode/qrcode.js +75 -31
- package/framework/components/chui_query_builder/query_builder.js +216 -123
- package/framework/components/chui_radio_group/radio_group.js +36 -26
- package/framework/components/chui_radio_group/styles.css +1 -1
- package/framework/components/chui_result/result.js +26 -16
- package/framework/components/chui_scheduler/scheduler.js +57 -35
- package/framework/components/chui_scheduler/styles.css +6 -2
- package/framework/components/chui_segmented_control/segmented_control.js +27 -21
- package/framework/components/chui_settings/settings.js +122 -48
- package/framework/components/chui_shortcut_help/shortcut_help.js +55 -32
- package/framework/components/chui_sidebar_nav/sidebar_nav.js +33 -23
- package/framework/components/chui_skeleton/skeleton.js +29 -24
- package/framework/components/chui_slideshow/slideshow.js +60 -41
- package/framework/components/chui_slideshow/styles.css +18 -12
- package/framework/components/chui_spinner/spinner.js +8 -8
- package/framework/components/chui_spinner/styles.css +0 -1
- package/framework/components/chui_split_button/split_button.js +23 -18
- package/framework/components/chui_split_button/styles.css +1 -1
- package/framework/components/chui_splitter/splitter.js +35 -28
- package/framework/components/chui_statistic/statistic.js +65 -38
- package/framework/components/chui_status_bar/status_bar.js +11 -9
- package/framework/components/chui_stepper/stepper.js +27 -22
- package/framework/components/chui_sticky_bar/sticky_bar.js +9 -4
- package/framework/components/chui_sticky_bar/styles.css +3 -1
- package/framework/components/chui_tabs/chui_tabs.js +28 -22
- package/framework/components/chui_tabs/styles.css +3 -3
- package/framework/components/chui_text_editor/styles.css +20 -19
- package/framework/components/chui_text_editor/text_editor.js +85 -61
- package/framework/components/chui_text_editor/text_editor_panel.js +346 -284
- package/framework/components/chui_theme_toggle/theme_toggle.js +27 -22
- package/framework/components/chui_timeline/timeline.js +14 -12
- package/framework/components/chui_toast_queue/toast_queue.js +52 -46
- package/framework/components/chui_toolbar/toolbar.js +20 -13
- package/framework/components/chui_tooltip/tooltip.js +37 -24
- package/framework/components/chui_tour/styles.css +8 -3
- package/framework/components/chui_tour/tour.js +61 -27
- package/framework/components/chui_transfer/styles.css +2 -1
- package/framework/components/chui_transfer/transfer.js +75 -42
- package/framework/components/chui_tree_table/tree_table.js +43 -29
- package/framework/components/chui_tree_view/styles.css +4 -2
- package/framework/components/chui_tree_view/tree_view.js +142 -99
- package/framework/components/chui_watermark/watermark.js +24 -16
- package/framework/components/chui_webview/styles.css +2 -2
- package/framework/components/chui_webview/webview.js +62 -50
- package/framework/components/telegram_bot/chui_telegram_bot.js +71 -64
- package/framework/modules/chui_a11y/chui_a11y.js +77 -46
- package/framework/modules/chui_animations/animations.js +42 -42
- package/framework/modules/chui_animations/styles.css +1 -1
- package/framework/modules/chui_bridge/preload.js +36 -25
- package/framework/modules/chui_functions.js +52 -50
- package/framework/modules/chui_highlight/chui_highlight.js +25 -22
- package/framework/modules/chui_i18n/chui_i18n.js +9 -7
- 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 +3 -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 +8 -8
- package/framework/modules/chui_i18n/locales/validate.js +3 -3
- package/framework/modules/chui_json/chui_json.js +9 -9
- package/framework/modules/chui_layout/chui_layout.js +12 -10
- package/framework/modules/chui_logger/chui_logger.js +29 -25
- package/framework/modules/chui_page/page.js +33 -27
- package/framework/modules/chui_qr/chui_qr.js +158 -67
- package/framework/modules/chui_scrollbar/chui_scrollbar.js +35 -24
- package/framework/modules/chui_scrollbar/styles.css +3 -1
- package/framework/modules/chui_services/chui_channels.js +27 -13
- package/framework/modules/chui_services/chui_services.js +39 -31
- package/framework/modules/chui_services/desktop.js +32 -31
- package/framework/modules/chui_sortable/chui_sortable.js +17 -12
- package/framework/modules/chui_validate/chui_validate.js +7 -4
- package/framework/tray_bar/chui_menu_items.js +136 -46
- package/index.d.ts +4814 -0
- package/index.js +385 -292
- package/package.json +79 -68
|
@@ -126,10 +126,10 @@
|
|
|
126
126
|
--focus_outline_offset_inset: -2px;
|
|
127
127
|
|
|
128
128
|
/* Тайминг анимаций */
|
|
129
|
-
--transition_time: .165s;
|
|
129
|
+
--transition_time: 0.165s;
|
|
130
130
|
/* Кривая движения: быстрый старт, мягкое торможение — «выезд» панели читается
|
|
131
131
|
как отклик, а не как линейный сдвиг. Отскока нет намеренно. */
|
|
132
|
-
--ease_out: cubic-bezier(.2, .8, .2, 1);
|
|
132
|
+
--ease_out: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
133
133
|
|
|
134
134
|
/* Схема нативных частей: палитры приложения разложены по prefers-color-scheme,
|
|
135
135
|
поэтому браузер должен рисовать и родные части (каретка, выделение, системные
|
|
@@ -279,16 +279,17 @@ chui_error_message {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
* {
|
|
282
|
-
font-family:
|
|
282
|
+
font-family: "chui_I";
|
|
283
283
|
font-style: normal;
|
|
284
284
|
user-select: none;
|
|
285
285
|
outline: none;
|
|
286
|
-
transition:
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
286
|
+
transition:
|
|
287
|
+
background-color var(--transition_time) ease,
|
|
288
|
+
color var(--transition_time) ease,
|
|
289
|
+
border-color var(--transition_time) ease,
|
|
290
|
+
box-shadow var(--transition_time) ease,
|
|
291
|
+
opacity var(--transition_time) ease,
|
|
292
|
+
transform var(--transition_time) ease;
|
|
292
293
|
animation-duration: var(--transition_time);
|
|
293
294
|
position: relative;
|
|
294
295
|
font-size: var(--font_default_size);
|
|
@@ -296,16 +297,17 @@ chui_error_message {
|
|
|
296
297
|
}
|
|
297
298
|
|
|
298
299
|
*:before {
|
|
299
|
-
font-family:
|
|
300
|
+
font-family: "chui_I";
|
|
300
301
|
font-style: normal;
|
|
301
302
|
user-select: none;
|
|
302
303
|
outline: none;
|
|
303
|
-
transition:
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
304
|
+
transition:
|
|
305
|
+
background-color var(--transition_time) ease,
|
|
306
|
+
color var(--transition_time) ease,
|
|
307
|
+
border-color var(--transition_time) ease,
|
|
308
|
+
box-shadow var(--transition_time) ease,
|
|
309
|
+
opacity var(--transition_time) ease,
|
|
310
|
+
transform var(--transition_time) ease;
|
|
309
311
|
animation-duration: var(--transition_time);
|
|
310
312
|
position: relative;
|
|
311
313
|
font-size: var(--font_default_size);
|
|
@@ -323,7 +325,15 @@ chui_error_message {
|
|
|
323
325
|
Селектор повторяет вес общего правила: `:where` специфичности не добавляет,
|
|
324
326
|
а без повтора исключение проиграло бы — общее правило весит больше любого
|
|
325
327
|
компонентного (0,6,0 против 0,2,0). */
|
|
326
|
-
:root
|
|
328
|
+
:root
|
|
329
|
+
*:focus-visible:not(input):not(textarea):not(select):not([contenteditable="true"]):where(
|
|
330
|
+
data_grid_cell,
|
|
331
|
+
chat_log,
|
|
332
|
+
chat_input,
|
|
333
|
+
time_option,
|
|
334
|
+
action_sheet_action,
|
|
335
|
+
action_sheet_cancel
|
|
336
|
+
) {
|
|
327
337
|
outline-offset: var(--focus_outline_offset_inset);
|
|
328
338
|
}
|
|
329
339
|
|
|
@@ -544,7 +554,8 @@ app_menu {
|
|
|
544
554
|
justify-content: flex-start;
|
|
545
555
|
align-items: flex-start;
|
|
546
556
|
z-index: 1000;
|
|
547
|
-
margin: calc(var(--header_height) + (var(--margin) * 2)) calc(var(--margin) * 2) calc(var(--margin) * 2)
|
|
557
|
+
margin: calc(var(--header_height) + (var(--margin) * 2)) calc(var(--margin) * 2) calc(var(--margin) * 2)
|
|
558
|
+
calc(var(--margin) * 2);
|
|
548
559
|
border-radius: var(--radius_md);
|
|
549
560
|
box-shadow: var(--box_shadow_drop);
|
|
550
561
|
background: var(--header_background);
|
|
@@ -562,7 +573,8 @@ notification_box {
|
|
|
562
573
|
align-items: flex-start;
|
|
563
574
|
height: -webkit-fill-available;
|
|
564
575
|
z-index: 1000;
|
|
565
|
-
margin: calc(var(--header_height) + (var(--margin) * 2)) calc(var(--margin) * 2) calc(var(--margin) * 2)
|
|
576
|
+
margin: calc(var(--header_height) + (var(--margin) * 2)) calc(var(--margin) * 2) calc(var(--margin) * 2)
|
|
577
|
+
calc(var(--margin) * 2);
|
|
566
578
|
border-radius: var(--radius_md);
|
|
567
579
|
box-shadow: var(--box_shadow_drop);
|
|
568
580
|
background: var(--header_background);
|
|
@@ -576,12 +588,13 @@ notification_box {
|
|
|
576
588
|
переходят как у всех элементов. */
|
|
577
589
|
app_menu,
|
|
578
590
|
notification_box {
|
|
579
|
-
transition:
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
591
|
+
transition:
|
|
592
|
+
transform var(--transition_time) var(--ease_out),
|
|
593
|
+
background-color var(--transition_time) ease,
|
|
594
|
+
color var(--transition_time) ease,
|
|
595
|
+
border-color var(--transition_time) ease,
|
|
596
|
+
box-shadow var(--transition_time) ease,
|
|
597
|
+
opacity var(--transition_time) ease;
|
|
585
598
|
}
|
|
586
599
|
|
|
587
600
|
/* Шапка ящика уведомлений: заголовок со счётчиком истории и действие «Очистить». */
|
|
@@ -592,7 +605,8 @@ notification_box_header {
|
|
|
592
605
|
justify-content: space-between;
|
|
593
606
|
gap: var(--margin);
|
|
594
607
|
width: -webkit-fill-available;
|
|
595
|
-
padding-block: 10px 10px;
|
|
608
|
+
padding-block: 10px 10px;
|
|
609
|
+
padding-inline: 14px 10px;
|
|
596
610
|
box-shadow: inset 0 -1px 0 var(--border_color);
|
|
597
611
|
}
|
|
598
612
|
|
|
@@ -764,7 +778,9 @@ notification_button {
|
|
|
764
778
|
background: transparent;
|
|
765
779
|
color: var(--text_color);
|
|
766
780
|
-webkit-app-region: no-drag;
|
|
767
|
-
transition:
|
|
781
|
+
transition:
|
|
782
|
+
background-color var(--transition_time) ease,
|
|
783
|
+
color var(--transition_time) ease;
|
|
768
784
|
}
|
|
769
785
|
|
|
770
786
|
notification_button:hover {
|
|
@@ -772,7 +788,8 @@ notification_button:hover {
|
|
|
772
788
|
}
|
|
773
789
|
|
|
774
790
|
notification_button:active {
|
|
775
|
-
background: var(--element_background_prime);
|
|
791
|
+
background: var(--element_background_prime);
|
|
792
|
+
color: var(--text_color_hover);
|
|
776
793
|
}
|
|
777
794
|
|
|
778
795
|
/* Открытый ящик уведомлений: тонировка акцента, а не ховер и не заливка во весь цвет */
|
|
@@ -821,7 +838,9 @@ app_menu_button {
|
|
|
821
838
|
background: transparent;
|
|
822
839
|
color: var(--text_color);
|
|
823
840
|
-webkit-app-region: no-drag;
|
|
824
|
-
transition:
|
|
841
|
+
transition:
|
|
842
|
+
background-color var(--transition_time) ease,
|
|
843
|
+
color var(--transition_time) ease;
|
|
825
844
|
}
|
|
826
845
|
|
|
827
846
|
app_menu_button:hover {
|
|
@@ -829,7 +848,8 @@ app_menu_button:hover {
|
|
|
829
848
|
}
|
|
830
849
|
|
|
831
850
|
app_menu_button:active {
|
|
832
|
-
background: var(--element_background_prime);
|
|
851
|
+
background: var(--element_background_prime);
|
|
852
|
+
color: var(--text_color_hover);
|
|
833
853
|
}
|
|
834
854
|
|
|
835
855
|
/* Открытое меню маршрутов: та же тонировка акцента, что и у пунктов внутри */
|
|
@@ -904,11 +924,12 @@ page_name {
|
|
|
904
924
|
border: none;
|
|
905
925
|
border-radius: var(--radius_pill);
|
|
906
926
|
padding: 0 12px;
|
|
907
|
-
margin-block: var(--header_margin) var(--header_margin);
|
|
927
|
+
margin-block: var(--header_margin) var(--header_margin);
|
|
928
|
+
margin-inline: 0 var(--margin);
|
|
908
929
|
font-size: var(--font_default_size);
|
|
909
930
|
font-weight: 500;
|
|
910
931
|
background: var(--element_background_disabled);
|
|
911
|
-
color: var(--text_color)
|
|
932
|
+
color: var(--text_color);
|
|
912
933
|
}
|
|
913
934
|
|
|
914
935
|
/* Пустое название не занимает места: до выбора страницы шапка не должна держать пустую капсулу */
|
|
@@ -952,7 +973,8 @@ route:hover {
|
|
|
952
973
|
}
|
|
953
974
|
|
|
954
975
|
route:active {
|
|
955
|
-
background: var(--element_background_prime);
|
|
976
|
+
background: var(--element_background_prime);
|
|
977
|
+
color: var(--text_color_hover);
|
|
956
978
|
}
|
|
957
979
|
|
|
958
980
|
route_title {
|
|
@@ -1043,7 +1065,7 @@ header_left_box {
|
|
|
1043
1065
|
min-width: 0;
|
|
1044
1066
|
overflow: hidden;
|
|
1045
1067
|
width: -webkit-fill-available;
|
|
1046
|
-
align-items: center
|
|
1068
|
+
align-items: center;
|
|
1047
1069
|
}
|
|
1048
1070
|
|
|
1049
1071
|
header_right_box {
|
|
@@ -1072,7 +1094,8 @@ user_button {
|
|
|
1072
1094
|
color: var(--text_color);
|
|
1073
1095
|
border-radius: var(--border_radius);
|
|
1074
1096
|
padding: 5px 13px;
|
|
1075
|
-
margin-block: var(--header_margin) var(--header_margin);
|
|
1097
|
+
margin-block: var(--header_margin) var(--header_margin);
|
|
1098
|
+
margin-inline: var(--margin) 0;
|
|
1076
1099
|
font-size: var(--font_default_size);
|
|
1077
1100
|
background: transparent;
|
|
1078
1101
|
font-weight: 500;
|
|
@@ -1087,7 +1110,8 @@ user_button:hover {
|
|
|
1087
1110
|
}
|
|
1088
1111
|
|
|
1089
1112
|
user_button:active {
|
|
1090
|
-
background: var(--element_background_prime);
|
|
1113
|
+
background: var(--element_background_prime);
|
|
1114
|
+
color: var(--text_color_hover);
|
|
1091
1115
|
}
|
|
1092
1116
|
|
|
1093
1117
|
/* Открытое меню: тонировка акцента — та же, что у открытых кнопок шапки.
|
|
@@ -1136,7 +1160,7 @@ user_dropdown user_item {
|
|
|
1136
1160
|
text-align: start;
|
|
1137
1161
|
width: -webkit-fill-available;
|
|
1138
1162
|
padding: var(--main_padding);
|
|
1139
|
-
border-radius: var(--border_radius)
|
|
1163
|
+
border-radius: var(--border_radius);
|
|
1140
1164
|
}
|
|
1141
1165
|
|
|
1142
1166
|
user_dropdown user_item:hover {
|
|
@@ -1170,7 +1194,7 @@ user_dd_image_main {
|
|
|
1170
1194
|
align-items: center;
|
|
1171
1195
|
justify-content: center;
|
|
1172
1196
|
flex-wrap: nowrap;
|
|
1173
|
-
margin-bottom: 6px
|
|
1197
|
+
margin-bottom: 6px;
|
|
1174
1198
|
}
|
|
1175
1199
|
|
|
1176
1200
|
/* chUiJS_HeaderButton */
|
|
@@ -1183,7 +1207,8 @@ header_button {
|
|
|
1183
1207
|
border: none;
|
|
1184
1208
|
border-radius: var(--border_radius);
|
|
1185
1209
|
padding: 5px 13px;
|
|
1186
|
-
margin-block: var(--header_margin) var(--header_margin);
|
|
1210
|
+
margin-block: var(--header_margin) var(--header_margin);
|
|
1211
|
+
margin-inline: var(--margin) 0;
|
|
1187
1212
|
font-size: var(--font_default_size);
|
|
1188
1213
|
background: transparent;
|
|
1189
1214
|
color: var(--text_color);
|
|
@@ -1192,7 +1217,9 @@ header_button {
|
|
|
1192
1217
|
flex-direction: row;
|
|
1193
1218
|
align-items: center;
|
|
1194
1219
|
-webkit-app-region: no-drag;
|
|
1195
|
-
transition:
|
|
1220
|
+
transition:
|
|
1221
|
+
background-color var(--transition_time) ease,
|
|
1222
|
+
color var(--transition_time) ease;
|
|
1196
1223
|
}
|
|
1197
1224
|
|
|
1198
1225
|
header_button header_button_title {
|
|
@@ -1210,7 +1237,8 @@ header_button:hover {
|
|
|
1210
1237
|
}
|
|
1211
1238
|
|
|
1212
1239
|
header_button:active {
|
|
1213
|
-
background: var(--element_background_prime);
|
|
1240
|
+
background: var(--element_background_prime);
|
|
1241
|
+
color: var(--text_color_hover);
|
|
1214
1242
|
}
|
|
1215
1243
|
|
|
1216
1244
|
/*Управление окном — те же кнопки-иконки, что и остальные в шапке, но приглушённые:
|
|
@@ -1243,7 +1271,9 @@ wc_box:not(:first-child) {
|
|
|
1243
1271
|
box-shadow: inset 1px 0 0 var(--border_color);
|
|
1244
1272
|
}
|
|
1245
1273
|
|
|
1246
|
-
wc_close,
|
|
1274
|
+
wc_close,
|
|
1275
|
+
wc_maximize,
|
|
1276
|
+
wc_minimize {
|
|
1247
1277
|
cursor: pointer;
|
|
1248
1278
|
display: flex;
|
|
1249
1279
|
align-items: center;
|
|
@@ -1255,7 +1285,9 @@ wc_close, wc_maximize, wc_minimize {
|
|
|
1255
1285
|
border-radius: var(--radius_sm);
|
|
1256
1286
|
background: transparent;
|
|
1257
1287
|
color: var(--text_color_disabled);
|
|
1258
|
-
transition:
|
|
1288
|
+
transition:
|
|
1289
|
+
background-color var(--transition_time) ease,
|
|
1290
|
+
color var(--transition_time) ease;
|
|
1259
1291
|
}
|
|
1260
1292
|
|
|
1261
1293
|
/* Значки кнопок окна нарисованы линиями (SVG), а не взяты из шрифта иконок: три системные
|
|
@@ -1273,12 +1305,15 @@ wc_minimize svg {
|
|
|
1273
1305
|
color: var(--text_color_disabled);
|
|
1274
1306
|
}
|
|
1275
1307
|
|
|
1276
|
-
wc_maximize:hover,
|
|
1308
|
+
wc_maximize:hover,
|
|
1309
|
+
wc_minimize:hover {
|
|
1277
1310
|
background: var(--element_background_hover);
|
|
1278
1311
|
}
|
|
1279
1312
|
|
|
1280
|
-
wc_maximize:active,
|
|
1281
|
-
|
|
1313
|
+
wc_maximize:active,
|
|
1314
|
+
wc_minimize:active {
|
|
1315
|
+
background: var(--element_background_prime);
|
|
1316
|
+
color: var(--text_color_hover);
|
|
1282
1317
|
}
|
|
1283
1318
|
|
|
1284
1319
|
wc_maximize:hover svg,
|
|
@@ -1303,7 +1338,9 @@ wc_close:active svg {
|
|
|
1303
1338
|
color: var(--text_color);
|
|
1304
1339
|
}
|
|
1305
1340
|
|
|
1306
|
-
wc_close:focus-visible,
|
|
1341
|
+
wc_close:focus-visible,
|
|
1342
|
+
wc_maximize:focus-visible,
|
|
1343
|
+
wc_minimize:focus-visible {
|
|
1307
1344
|
outline: var(--focus_outline);
|
|
1308
1345
|
outline-offset: var(--focus_outline_offset);
|
|
1309
1346
|
}
|
|
@@ -1333,4 +1370,4 @@ header_tabs {
|
|
|
1333
1370
|
|
|
1334
1371
|
.header_tab_active header_button_icon chui_icon {
|
|
1335
1372
|
color: var(--link_color);
|
|
1336
|
-
}
|
|
1373
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const {Icon, Icons} = require("../chui_icons/icons");
|
|
1
|
+
const { Icon, Icons } = require("../chui_icons/icons");
|
|
2
2
|
|
|
3
|
-
const {makeKeyboardButton} = require("../../modules/chui_a11y/chui_a11y");
|
|
3
|
+
const { makeKeyboardButton } = require("../../modules/chui_a11y/chui_a11y");
|
|
4
4
|
|
|
5
5
|
/** Идентификаторы для aria-controls у панелей аккордеона */
|
|
6
6
|
let disclosure_panel_counter = 0;
|
|
@@ -8,38 +8,38 @@ let disclosure_panel_counter = 0;
|
|
|
8
8
|
class Accordion {
|
|
9
9
|
#name = require("randomstring").generate();
|
|
10
10
|
#chui_accordion = document.createElement(`chui_accordion`);
|
|
11
|
-
constructor(options = [
|
|
12
|
-
require(
|
|
11
|
+
constructor(options = [{ b_text: undefined, p_text: undefined }]) {
|
|
12
|
+
require("../../modules/chui_functions").setStyles(__dirname + "/styles.css", "chUiJS_Accordion");
|
|
13
13
|
// На вход идёт массив секций: объект — ошибка вызова, и объяснить её лучше словами
|
|
14
14
|
if (Array.isArray(options) === false) {
|
|
15
15
|
throw new Error("Accordion: нужен массив секций [{b_text, p_text}]");
|
|
16
16
|
}
|
|
17
|
-
options.forEach(element => {
|
|
17
|
+
options.forEach((element) => {
|
|
18
18
|
let main_test = document.createElement(`chui_accordion_section`);
|
|
19
|
-
let ab = document.createElement(
|
|
20
|
-
ab.setAttribute(
|
|
21
|
-
let bt = document.createElement(
|
|
19
|
+
let ab = document.createElement("accordion_button");
|
|
20
|
+
ab.setAttribute("name", this.#name);
|
|
21
|
+
let bt = document.createElement("accordion_button_text");
|
|
22
22
|
// Пустая заготовка — это «текста нет», а не слово «undefined» в разметке;
|
|
23
23
|
// разметку секции принимает innerHTML, как и раньше
|
|
24
|
-
bt.innerHTML = element.b_text === undefined || element.b_text === null ? "" : String(element.b_text)
|
|
25
|
-
let barrow = document.createElement(
|
|
24
|
+
bt.innerHTML = element.b_text === undefined || element.b_text === null ? "" : String(element.b_text);
|
|
25
|
+
let barrow = document.createElement("accordion_button_arrow");
|
|
26
26
|
barrow.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN).getHTML();
|
|
27
|
-
ab.appendChild(bt)
|
|
28
|
-
ab.appendChild(barrow)
|
|
29
|
-
let ap = document.createElement(
|
|
30
|
-
let html = document.createElement(
|
|
31
|
-
html.innerHTML = element.p_text === undefined || element.p_text === null ? "" : String(element.p_text)
|
|
32
|
-
ap.appendChild(html)
|
|
33
|
-
main_test.appendChild(ab)
|
|
34
|
-
main_test.appendChild(ap)
|
|
35
|
-
this.#chui_accordion.appendChild(main_test)
|
|
27
|
+
ab.appendChild(bt);
|
|
28
|
+
ab.appendChild(barrow);
|
|
29
|
+
let ap = document.createElement("accordion_panel");
|
|
30
|
+
let html = document.createElement("accordion_panel_html");
|
|
31
|
+
html.innerHTML = element.p_text === undefined || element.p_text === null ? "" : String(element.p_text);
|
|
32
|
+
ap.appendChild(html);
|
|
33
|
+
main_test.appendChild(ab);
|
|
34
|
+
main_test.appendChild(ap);
|
|
35
|
+
this.#chui_accordion.appendChild(main_test);
|
|
36
36
|
|
|
37
37
|
//ФУНКЦИИ
|
|
38
38
|
let test = main_test.children;
|
|
39
39
|
let i;
|
|
40
40
|
for (i = 0; i < test.length; i++) {
|
|
41
41
|
let elem = test[i];
|
|
42
|
-
if (elem.tagName ===
|
|
42
|
+
if (elem.tagName === "ACCORDION_BUTTON") {
|
|
43
43
|
let panel = elem.nextElementSibling;
|
|
44
44
|
// Доступность: кнопка раскрытия — role=button с состоянием, панель — регион
|
|
45
45
|
panel.id = "chui_accordion_panel_" + (disclosure_panel_counter += 1);
|
|
@@ -50,8 +50,8 @@ class Accordion {
|
|
|
50
50
|
// в обходе Tab и в дереве доступности — поэтому свёрнутая панель помечается инерт
|
|
51
51
|
panel.inert = true;
|
|
52
52
|
makeKeyboardButton(elem);
|
|
53
|
-
elem.addEventListener(
|
|
54
|
-
elem.classList.toggle(
|
|
53
|
+
elem.addEventListener("click", () => {
|
|
54
|
+
elem.classList.toggle("accordion_active");
|
|
55
55
|
let panel = elem.nextElementSibling;
|
|
56
56
|
// Стрелка и углы кнопки зависят от `aria-expanded` — их ведёт CSS,
|
|
57
57
|
// а инлайном остаётся только измеренная высота панели
|
|
@@ -62,15 +62,18 @@ class Accordion {
|
|
|
62
62
|
panel.inert = false;
|
|
63
63
|
panel.style.maxHeight = panel.scrollHeight + "px";
|
|
64
64
|
}
|
|
65
|
-
elem.setAttribute(
|
|
66
|
-
|
|
65
|
+
elem.setAttribute(
|
|
66
|
+
"aria-expanded",
|
|
67
|
+
elem.classList.contains("accordion_active") ? "true" : "false"
|
|
68
|
+
);
|
|
69
|
+
});
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
|
-
})
|
|
72
|
+
});
|
|
70
73
|
}
|
|
71
74
|
set() {
|
|
72
75
|
return this.#chui_accordion;
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
78
|
|
|
76
|
-
exports.Accordion = Accordion
|
|
79
|
+
exports.Accordion = Accordion;
|
|
@@ -8,7 +8,7 @@ chui_accordion {
|
|
|
8
8
|
/* Зазор между секциями (прежде отдельной секции писал JS инлайном) */
|
|
9
9
|
gap: 8px;
|
|
10
10
|
font-size: var(--font_default_size);
|
|
11
|
-
font-weight:400;
|
|
11
|
+
font-weight: 400;
|
|
12
12
|
border: none;
|
|
13
13
|
margin: var(--margin);
|
|
14
14
|
}
|
|
@@ -19,7 +19,7 @@ chui_accordion_section {
|
|
|
19
19
|
height: max-content;
|
|
20
20
|
width: -webkit-fill-available;
|
|
21
21
|
font-size: var(--font_default_size);
|
|
22
|
-
font-weight:400;
|
|
22
|
+
font-weight: 400;
|
|
23
23
|
border-radius: var(--border_radius);
|
|
24
24
|
border: none;
|
|
25
25
|
}
|
|
@@ -63,7 +63,7 @@ accordion_panel_html {
|
|
|
63
63
|
padding: 8px 0;
|
|
64
64
|
width: -webkit-fill-available;
|
|
65
65
|
display: flex;
|
|
66
|
-
border: none
|
|
66
|
+
border: none;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
accordion_button:hover {
|
|
@@ -71,7 +71,8 @@ accordion_button:hover {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
accordion_button:active {
|
|
74
|
-
background: var(--element_background_prime);
|
|
74
|
+
background: var(--element_background_prime);
|
|
75
|
+
color: var(--text_color_hover);
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
accordion_button:hover accordion_button_text {
|
|
@@ -109,4 +110,4 @@ accordion_button[aria-expanded="true"] accordion_button_arrow chui_icon {
|
|
|
109
110
|
|
|
110
111
|
accordion_button[aria-expanded="false"] accordion_button_arrow chui_icon {
|
|
111
112
|
transform: rotate(0deg);
|
|
112
|
-
}
|
|
113
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const {Animation} = require(
|
|
2
|
-
const {OverlayA11y} = require(
|
|
3
|
-
const {Icon} = require(
|
|
4
|
-
const {setStyles, optionOr} = require(
|
|
5
|
-
const {I18n} = require(
|
|
1
|
+
const { Animation } = require("../../modules/chui_animations/animations");
|
|
2
|
+
const { OverlayA11y } = require("../../modules/chui_a11y/chui_a11y");
|
|
3
|
+
const { Icon } = 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
|
* Список действий из нижней части экрана (action sheet): заголовок, пояснение,
|
|
@@ -43,7 +43,7 @@ const {I18n} = require('../../modules/chui_i18n/chui_i18n');
|
|
|
43
43
|
class ActionSheet {
|
|
44
44
|
static STYLE = {
|
|
45
45
|
DEFAULT: "default",
|
|
46
|
-
DESTRUCTIVE: "destructive"
|
|
46
|
+
DESTRUCTIVE: "destructive",
|
|
47
47
|
};
|
|
48
48
|
static #counter = 0;
|
|
49
49
|
|
|
@@ -69,11 +69,20 @@ class ActionSheet {
|
|
|
69
69
|
#on_close = undefined;
|
|
70
70
|
isOpen = false;
|
|
71
71
|
|
|
72
|
-
constructor(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
constructor(
|
|
73
|
+
options = {
|
|
74
|
+
id: String(),
|
|
75
|
+
title: String(),
|
|
76
|
+
message: String(),
|
|
77
|
+
label: String(),
|
|
78
|
+
actions: [],
|
|
79
|
+
cancelText: String(),
|
|
80
|
+
closable: Boolean(),
|
|
81
|
+
closeOnOutsideClick: Boolean(),
|
|
82
|
+
onSelect: undefined,
|
|
83
|
+
onClose: undefined,
|
|
84
|
+
}
|
|
85
|
+
) {
|
|
77
86
|
setStyles(__dirname + "/styles.css", "chUiJS_ActionSheet");
|
|
78
87
|
ActionSheet.#counter += 1;
|
|
79
88
|
this.#id = options.id === undefined ? `chui_action_sheet_${ActionSheet.#counter}` : options.id;
|
|
@@ -105,7 +114,7 @@ class ActionSheet {
|
|
|
105
114
|
role: "dialog",
|
|
106
115
|
labelNode: this.#labelled_by_title ? this.#title : undefined,
|
|
107
116
|
label: this.#labelled_by_title ? undefined : optionOr(options.label, I18n.t("feedback.actionSheet")),
|
|
108
|
-
onEscape: () => this.close()
|
|
117
|
+
onEscape: () => this.close(),
|
|
109
118
|
});
|
|
110
119
|
this.#syncCancelText();
|
|
111
120
|
this.setActions(options.actions === undefined ? [] : options.actions);
|
|
@@ -116,12 +125,22 @@ class ActionSheet {
|
|
|
116
125
|
}
|
|
117
126
|
|
|
118
127
|
// GET
|
|
119
|
-
getId() {
|
|
120
|
-
|
|
121
|
-
|
|
128
|
+
getId() {
|
|
129
|
+
return this.#id;
|
|
130
|
+
}
|
|
131
|
+
getTitle() {
|
|
132
|
+
return this.#title.innerText;
|
|
133
|
+
}
|
|
134
|
+
getMessage() {
|
|
135
|
+
return this.#message.innerText;
|
|
136
|
+
}
|
|
122
137
|
/** Описания действий — те же объекты, что вернула фабрика `ActionSheet.Item` */
|
|
123
|
-
getActions() {
|
|
124
|
-
|
|
138
|
+
getActions() {
|
|
139
|
+
return [...this.#actions];
|
|
140
|
+
}
|
|
141
|
+
getCancelText() {
|
|
142
|
+
return this.#cancel.innerText;
|
|
143
|
+
}
|
|
125
144
|
|
|
126
145
|
// SET
|
|
127
146
|
setTitle(text = String()) {
|
|
@@ -184,24 +203,31 @@ class ActionSheet {
|
|
|
184
203
|
this.#sheet.remove();
|
|
185
204
|
return this;
|
|
186
205
|
}
|
|
187
|
-
set() {
|
|
206
|
+
set() {
|
|
207
|
+
return this.#sheet;
|
|
208
|
+
}
|
|
188
209
|
|
|
189
210
|
/** Готовое обещание: выбор даёт описание действия (`value` — ваше поле), отмена — `undefined`.
|
|
190
211
|
* Временный слой после ответа убирается: иначе каждый вызов оставлял бы узел в документе */
|
|
191
212
|
static show(options = {}) {
|
|
192
213
|
return new Promise((resolve) => {
|
|
193
214
|
let sheet;
|
|
194
|
-
const answer = (value) => {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
215
|
+
const answer = (value) => {
|
|
216
|
+
resolve(value);
|
|
217
|
+
sheet.destroy();
|
|
218
|
+
};
|
|
219
|
+
sheet = new ActionSheet(
|
|
220
|
+
Object.assign({}, options, {
|
|
221
|
+
onSelect: (action, index) => {
|
|
222
|
+
if (options.onSelect !== undefined) options.onSelect(action, index);
|
|
223
|
+
answer(action);
|
|
224
|
+
},
|
|
225
|
+
onClose: () => {
|
|
226
|
+
if (options.onClose !== undefined) options.onClose();
|
|
227
|
+
answer(undefined);
|
|
228
|
+
},
|
|
229
|
+
})
|
|
230
|
+
);
|
|
205
231
|
sheet.open();
|
|
206
232
|
});
|
|
207
233
|
}
|
|
@@ -244,12 +270,12 @@ class ActionSheet {
|
|
|
244
270
|
#onSheetClick = (event) => {
|
|
245
271
|
if (!this.#close_outside || event.target !== this.#sheet) return;
|
|
246
272
|
this.close();
|
|
247
|
-
}
|
|
273
|
+
};
|
|
248
274
|
// После анимации имя снимается: иначе следующий показ не проиграется заново
|
|
249
275
|
#onPanelAnimationEnd = (event) => {
|
|
250
276
|
if (event.target !== this.#panel) return;
|
|
251
277
|
this.#panel.style.animationName = "";
|
|
252
|
-
}
|
|
278
|
+
};
|
|
253
279
|
/** Заголовок и пояснение показываются, только когда заданы; пояснение — описание слоя */
|
|
254
280
|
#syncHead() {
|
|
255
281
|
const has_title = this.#title.innerText.trim() !== "";
|
|
@@ -268,7 +294,7 @@ class ActionSheet {
|
|
|
268
294
|
}
|
|
269
295
|
}
|
|
270
296
|
|
|
271
|
-
exports.ActionSheet = ActionSheet
|
|
297
|
+
exports.ActionSheet = ActionSheet;
|
|
272
298
|
|
|
273
299
|
// Описание действия собирает фабрика — как у ContextMenu и SplitButton
|
|
274
|
-
ActionSheet.Item = (options = {}) => Object.assign({style: ActionSheet.STYLE.DEFAULT}, options);
|
|
300
|
+
ActionSheet.Item = (options = {}) => Object.assign({ style: ActionSheet.STYLE.DEFAULT }, options);
|
|
@@ -121,7 +121,8 @@ action_sheet_actions .action_sheet_action:first-child {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
.action_sheet_action:active {
|
|
124
|
-
background: var(--element_background_prime);
|
|
124
|
+
background: var(--element_background_prime);
|
|
125
|
+
color: var(--text_color_hover);
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
.action_sheet_action:disabled {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {setStyles, optionOr, scrollParent} = require(
|
|
1
|
+
const { setStyles, optionOr, scrollParent } = require("../../modules/chui_functions");
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Раздел с закреплённой панелью: панель остаётся на виду, пока её раздел на экране.
|
|
@@ -44,9 +44,14 @@ class Affix {
|
|
|
44
44
|
#destroyed = false;
|
|
45
45
|
#on_change = undefined;
|
|
46
46
|
|
|
47
|
-
constructor(
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
constructor(
|
|
48
|
+
options = {
|
|
49
|
+
id: String(),
|
|
50
|
+
offset: Number(),
|
|
51
|
+
target: undefined,
|
|
52
|
+
onChange: undefined,
|
|
53
|
+
}
|
|
54
|
+
) {
|
|
50
55
|
setStyles(__dirname + "/styles.css", "chUiJS_Affix");
|
|
51
56
|
Affix.#counter += 1;
|
|
52
57
|
this.#id = optionOr(options.id, `chui_affix_${Affix.#counter}`);
|
|
@@ -204,7 +209,7 @@ class Affix {
|
|
|
204
209
|
root: root,
|
|
205
210
|
// Сторож уходит из области прокрутки ровно тогда, когда панель дошла до отступа
|
|
206
211
|
rootMargin: `-${this.#offset}px 0px 0px 0px`,
|
|
207
|
-
threshold: 0
|
|
212
|
+
threshold: 0,
|
|
208
213
|
});
|
|
209
214
|
this.#observer.observe(this.#sentinel);
|
|
210
215
|
// Наблюдатель отвечает асинхронно: до первого ответа закрепления нет,
|
|
@@ -227,4 +232,4 @@ class Affix {
|
|
|
227
232
|
}
|
|
228
233
|
}
|
|
229
234
|
|
|
230
|
-
exports.Affix = Affix
|
|
235
|
+
exports.Affix = Affix;
|