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
package/index.js
CHANGED
|
@@ -1,153 +1,194 @@
|
|
|
1
1
|
// === ИНСТРУМЕНТЫ ===
|
|
2
|
-
const {
|
|
2
|
+
const {
|
|
3
|
+
app,
|
|
4
|
+
BrowserWindow,
|
|
5
|
+
Menu,
|
|
6
|
+
Tray,
|
|
7
|
+
ipcMain,
|
|
8
|
+
ipcRenderer,
|
|
9
|
+
shell,
|
|
10
|
+
nativeTheme,
|
|
11
|
+
session,
|
|
12
|
+
webContents,
|
|
13
|
+
systemPreferences,
|
|
14
|
+
dialog,
|
|
15
|
+
} = require("electron");
|
|
3
16
|
// Одно хранилище настроек на модуль: его получает приложение через `require('chuijs').store`,
|
|
4
17
|
// из него читают тему, язык и история буфера, а `Settings` берёт его для своих значений по умолчанию
|
|
5
|
-
const {store} = require("./framework/modules/chui_store/chui_store");
|
|
18
|
+
const { store } = require("./framework/modules/chui_store/chui_store");
|
|
6
19
|
const path = require("path");
|
|
7
20
|
const fs = require("fs");
|
|
8
21
|
const os = require("os");
|
|
9
22
|
|
|
10
|
-
const request = require(
|
|
11
|
-
const {transliterate} = require("transliteration");
|
|
23
|
+
const request = require("@cypress/request");
|
|
24
|
+
const { transliterate } = require("transliteration");
|
|
12
25
|
let downloadSession = undefined;
|
|
13
26
|
// === === ===
|
|
14
27
|
// process.env
|
|
15
|
-
process.env[
|
|
28
|
+
process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";
|
|
16
29
|
// === === ===
|
|
17
30
|
|
|
18
31
|
//ПОЛЯ ВВОДА
|
|
19
|
-
const {TextInput} = require(
|
|
20
|
-
const {DateInput} = require(
|
|
21
|
-
const {NumberInput} = require(
|
|
22
|
-
const {EmailInput} = require(
|
|
23
|
-
const {PasswordInput} = require(
|
|
24
|
-
const {Select} = require(
|
|
25
|
-
const {ComboBox} = require(
|
|
26
|
-
const {TextArea} = require(
|
|
27
|
-
const {RadioButton} = require(
|
|
28
|
-
const {CheckBox} = require(
|
|
29
|
-
const {RadioGroup} = require(
|
|
30
|
-
const {Slider} = require(
|
|
31
|
-
const {Chips} = require(
|
|
32
|
+
const { TextInput } = require("./framework/components/chui_inputs/chui_text/text");
|
|
33
|
+
const { DateInput } = require("./framework/components/chui_inputs/chui_date/date");
|
|
34
|
+
const { NumberInput } = require("./framework/components/chui_inputs/chui_number/number");
|
|
35
|
+
const { EmailInput } = require("./framework/components/chui_inputs/chui_email/email");
|
|
36
|
+
const { PasswordInput } = require("./framework/components/chui_inputs/chui_password/password");
|
|
37
|
+
const { Select } = require("./framework/components/chui_inputs/chui_select_box/select_box");
|
|
38
|
+
const { ComboBox } = require("./framework/components/chui_inputs/chui_combo_box/combo_box");
|
|
39
|
+
const { TextArea } = require("./framework/components/chui_inputs/chui_text_area/text_area");
|
|
40
|
+
const { RadioButton } = require("./framework/components/chui_inputs/chui_radio_button/radio_button");
|
|
41
|
+
const { CheckBox } = require("./framework/components/chui_inputs/chui_check_box/check_box");
|
|
42
|
+
const { RadioGroup } = require("./framework/components/chui_radio_group/radio_group");
|
|
43
|
+
const { Slider } = require("./framework/components/chui_inputs/chui_slider/slider");
|
|
44
|
+
const { Chips } = require("./framework/components/chui_inputs/chui_chips/chips");
|
|
32
45
|
//==========
|
|
33
|
-
const {MenuItem} = require(
|
|
34
|
-
const {AppLayout, Route} = require(
|
|
35
|
-
const {Page} = require(
|
|
36
|
-
const {WebView} = require(
|
|
37
|
-
const {Button} = require(
|
|
38
|
-
const {Spinner} = require(
|
|
39
|
-
const {Icon, Icons} = require(
|
|
40
|
-
const {TextEditor} = require(
|
|
41
|
-
const {Badge} = require(
|
|
42
|
-
const {Divider} = require(
|
|
43
|
-
const {Link} = require(
|
|
44
|
-
const {Avatar} = require(
|
|
45
|
-
const {AvatarGroup} = require(
|
|
46
|
-
const {EmptyState} = require(
|
|
47
|
-
const {Result} = require(
|
|
48
|
-
const {Descriptions} = require(
|
|
49
|
-
const {Statistic} = require(
|
|
50
|
-
const {Backtop} = require(
|
|
51
|
-
const {Affix} = require(
|
|
52
|
-
const {StickyBar} = require(
|
|
53
|
-
const {Watermark} = require(
|
|
54
|
-
const {ShortcutHelp} = require(
|
|
55
|
-
const {Tooltip} = require(
|
|
56
|
-
const {Calendar} = require(
|
|
57
|
-
const {Notification} = require(
|
|
58
|
-
const {UpdateNotification} = require("./framework/components/chui_notification/notification_update");
|
|
59
|
-
const {DownloadNotification} = require("./framework/components/chui_notification/notification_download");
|
|
60
|
-
const {Tabs, Tab} = require(
|
|
61
|
-
const {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const {
|
|
73
|
-
const {
|
|
74
|
-
const {
|
|
75
|
-
const {
|
|
76
|
-
const {
|
|
77
|
-
const {
|
|
78
|
-
const {
|
|
79
|
-
const {
|
|
80
|
-
const {
|
|
81
|
-
const {
|
|
82
|
-
const {
|
|
83
|
-
const {
|
|
84
|
-
const {
|
|
85
|
-
const {
|
|
86
|
-
const {
|
|
87
|
-
const {
|
|
88
|
-
const {
|
|
89
|
-
const {
|
|
90
|
-
const {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const {
|
|
103
|
-
const {
|
|
104
|
-
const {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const {
|
|
112
|
-
const {
|
|
113
|
-
const {
|
|
114
|
-
const {
|
|
115
|
-
const {
|
|
116
|
-
const {
|
|
117
|
-
const {
|
|
118
|
-
const {
|
|
119
|
-
const {
|
|
120
|
-
const {
|
|
121
|
-
const {
|
|
122
|
-
const {
|
|
123
|
-
const {
|
|
124
|
-
const {
|
|
125
|
-
const {
|
|
126
|
-
const {
|
|
127
|
-
const {
|
|
128
|
-
const {
|
|
129
|
-
const {
|
|
130
|
-
const {
|
|
131
|
-
const {
|
|
132
|
-
const {
|
|
133
|
-
const {
|
|
134
|
-
const {
|
|
135
|
-
const {
|
|
46
|
+
const { MenuItem } = require("./framework/tray_bar/chui_menu_items");
|
|
47
|
+
const { AppLayout, Route } = require("./framework/appLayout/default/chui_app_layout");
|
|
48
|
+
const { Page } = require("./framework/modules/chui_page/page");
|
|
49
|
+
const { WebView } = require("./framework/components/chui_webview/webview");
|
|
50
|
+
const { Button } = require("./framework/components/chui_button/button");
|
|
51
|
+
const { Spinner } = require("./framework/components/chui_spinner/spinner");
|
|
52
|
+
const { Icon, Icons } = require("./framework/components/chui_icons/icons");
|
|
53
|
+
const { TextEditor } = require("./framework/components/chui_text_editor/text_editor");
|
|
54
|
+
const { Badge } = require("./framework/components/chui_badge/badge");
|
|
55
|
+
const { Divider } = require("./framework/components/chui_divider/divider");
|
|
56
|
+
const { Link } = require("./framework/components/chui_link/link");
|
|
57
|
+
const { Avatar } = require("./framework/components/chui_avatar/avatar");
|
|
58
|
+
const { AvatarGroup } = require("./framework/components/chui_avatar_group/avatar_group");
|
|
59
|
+
const { EmptyState } = require("./framework/components/chui_empty_state/empty_state");
|
|
60
|
+
const { Result } = require("./framework/components/chui_result/result");
|
|
61
|
+
const { Descriptions } = require("./framework/components/chui_descriptions/descriptions");
|
|
62
|
+
const { Statistic } = require("./framework/components/chui_statistic/statistic");
|
|
63
|
+
const { Backtop } = require("./framework/components/chui_backtop/backtop");
|
|
64
|
+
const { Affix } = require("./framework/components/chui_affix/affix");
|
|
65
|
+
const { StickyBar } = require("./framework/components/chui_sticky_bar/sticky_bar");
|
|
66
|
+
const { Watermark } = require("./framework/components/chui_watermark/watermark");
|
|
67
|
+
const { ShortcutHelp } = require("./framework/components/chui_shortcut_help/shortcut_help");
|
|
68
|
+
const { Tooltip } = require("./framework/components/chui_tooltip/tooltip");
|
|
69
|
+
const { Calendar } = require("./framework/components/chui_calendar/calendar");
|
|
70
|
+
const { Notification } = require("./framework/components/chui_notification/notification");
|
|
71
|
+
const { UpdateNotification } = require("./framework/components/chui_notification/notification_update");
|
|
72
|
+
const { DownloadNotification } = require("./framework/components/chui_notification/notification_download");
|
|
73
|
+
const { Tabs, Tab } = require("./framework/components/chui_tabs/chui_tabs");
|
|
74
|
+
const {
|
|
75
|
+
BarGraph,
|
|
76
|
+
PieGraph,
|
|
77
|
+
LineGraph,
|
|
78
|
+
AreaGraph,
|
|
79
|
+
ScatterGraph,
|
|
80
|
+
Gauge,
|
|
81
|
+
Sparkline,
|
|
82
|
+
RadarGraph,
|
|
83
|
+
HeatmapGraph,
|
|
84
|
+
} = require("./framework/components/chui_graphs/graphs");
|
|
85
|
+
const { Toggle } = require("./framework/components/chui_inputs/chui_toggle/toggle");
|
|
86
|
+
const { ContentBlock } = require("./framework/components/chui_content_block/content_block");
|
|
87
|
+
const { Card } = require("./framework/components/chui_card/card");
|
|
88
|
+
const { Hero } = require("./framework/components/chui_hero/hero");
|
|
89
|
+
const { Skeleton } = require("./framework/components/chui_skeleton/skeleton");
|
|
90
|
+
const { Drawer } = require("./framework/components/chui_drawer/drawer");
|
|
91
|
+
const { ToastQueue, Toast } = require("./framework/components/chui_toast_queue/toast_queue");
|
|
92
|
+
const { ProgressBar } = require("./framework/components/chui_progress_bar/progress_bar");
|
|
93
|
+
const { Label } = require("./framework/components/chui_label/label");
|
|
94
|
+
const { Dialog } = require("./framework/components/chui_modal/modal");
|
|
95
|
+
const { Paragraph } = require("./framework/components/chui_paragraph/paragraph");
|
|
96
|
+
const { H } = require("./framework/components/chui_hx/hx");
|
|
97
|
+
const { DataGrid } = require("./framework/components/chui_data_grid/data_grid");
|
|
98
|
+
const { Details } = require("./framework/components/chui_details/details");
|
|
99
|
+
const { Accordion } = require("./framework/components/chui_accordion/accordion");
|
|
100
|
+
const { CodeBlock } = require("./framework/components/chui_code/code");
|
|
101
|
+
const { HtmlBlock } = require("./framework/components/chui_html_block/html_block");
|
|
102
|
+
const { sleep, render, getDefaultIcon, formatBytes } = require("./framework/modules/chui_functions");
|
|
103
|
+
const {
|
|
104
|
+
Shortcuts,
|
|
105
|
+
Clipboard,
|
|
106
|
+
RecentDocuments,
|
|
107
|
+
TaskbarProgress,
|
|
108
|
+
} = require("./framework/modules/chui_services/chui_services");
|
|
109
|
+
const {
|
|
110
|
+
SERVICES_CHANNELS,
|
|
111
|
+
BRIDGE_CHANNELS,
|
|
112
|
+
BRIDGE_ARGS,
|
|
113
|
+
APP_PATH_NAMES,
|
|
114
|
+
} = require("./framework/modules/chui_services/chui_channels");
|
|
115
|
+
const { Desktop } = require("./framework/modules/chui_services/desktop");
|
|
116
|
+
const { I18n } = require("./framework/modules/chui_i18n/chui_i18n");
|
|
117
|
+
const {
|
|
118
|
+
Shell,
|
|
119
|
+
Theme,
|
|
120
|
+
Locale,
|
|
121
|
+
ClipboardHistory: ClipboardHistoryService,
|
|
122
|
+
Print,
|
|
123
|
+
} = require("./framework/modules/chui_services/chui_services");
|
|
124
|
+
const { FileInput, AcceptTypes } = require("./framework/components/chui_inputs/chui_file/file");
|
|
125
|
+
const { TreeView } = require("./framework/components/chui_tree_view/tree_view");
|
|
126
|
+
const { ThemeToggle } = require("./framework/components/chui_theme_toggle/theme_toggle");
|
|
127
|
+
const { SegmentedControl } = require("./framework/components/chui_segmented_control/segmented_control");
|
|
128
|
+
const { Alert } = require("./framework/components/chui_alert/alert");
|
|
129
|
+
const { Kbd } = require("./framework/components/chui_kbd/kbd");
|
|
130
|
+
const { List, ListItem } = require("./framework/components/chui_list/list");
|
|
131
|
+
const { Popover } = require("./framework/components/chui_popover/popover");
|
|
132
|
+
const { Tour } = require("./framework/components/chui_tour/tour");
|
|
133
|
+
const { SplitButton } = require("./framework/components/chui_split_button/split_button");
|
|
134
|
+
const { Pagination } = require("./framework/components/chui_pagination/pagination");
|
|
135
|
+
const { Breadcrumb } = require("./framework/components/chui_breadcrumb/breadcrumb");
|
|
136
|
+
const { Stepper } = require("./framework/components/chui_stepper/stepper");
|
|
137
|
+
const { Timeline } = require("./framework/components/chui_timeline/timeline");
|
|
138
|
+
const { Rating } = require("./framework/components/chui_inputs/chui_rating/rating");
|
|
139
|
+
const { ColorPicker } = require("./framework/components/chui_inputs/chui_color_picker/color_picker");
|
|
140
|
+
const { TimeInput } = require("./framework/components/chui_inputs/chui_time/time");
|
|
141
|
+
const { DateTimeInput } = require("./framework/components/chui_inputs/chui_datetime/datetime");
|
|
142
|
+
const { DateRangeInput } = require("./framework/components/chui_inputs/chui_date_range/date_range");
|
|
143
|
+
const { HotkeyInput } = require("./framework/components/chui_inputs/chui_hotkey/hotkey");
|
|
144
|
+
const { MaskedInput } = require("./framework/components/chui_inputs/chui_masked/masked");
|
|
145
|
+
const { OtpInput } = require("./framework/components/chui_inputs/chui_otp/otp");
|
|
146
|
+
const { Transfer } = require("./framework/components/chui_transfer/transfer");
|
|
147
|
+
const { TreeTable } = require("./framework/components/chui_tree_table/tree_table");
|
|
148
|
+
const { SidebarNav } = require("./framework/components/chui_sidebar_nav/sidebar_nav");
|
|
149
|
+
const { MarkdownEditor } = require("./framework/components/chui_markdown_editor/markdown_editor");
|
|
150
|
+
const { DiffViewer } = require("./framework/components/chui_diff_viewer/diff_viewer");
|
|
151
|
+
const { JsonViewer } = require("./framework/components/chui_json_viewer/json_viewer");
|
|
152
|
+
const { JsonEditor } = require("./framework/components/chui_json_editor/json_editor");
|
|
153
|
+
const { QueryBuilder } = require("./framework/components/chui_query_builder/query_builder");
|
|
154
|
+
const { FileExplorer } = require("./framework/components/chui_file_explorer/file_explorer");
|
|
155
|
+
const { Settings } = require("./framework/components/chui_settings/settings");
|
|
156
|
+
const { DropZone } = require("./framework/components/chui_drop_zone/drop_zone");
|
|
157
|
+
const { ClipboardHistory } = require("./framework/components/chui_clipboard_history/clipboard_history");
|
|
158
|
+
const { PrintButton } = require("./framework/components/chui_print_button/print_button");
|
|
159
|
+
const { Splitter } = require("./framework/components/chui_splitter/splitter");
|
|
160
|
+
const { Scheduler } = require("./framework/components/chui_scheduler/scheduler");
|
|
161
|
+
const { Gantt } = require("./framework/components/chui_gantt/gantt");
|
|
162
|
+
const { Kanban } = require("./framework/components/chui_kanban/kanban");
|
|
163
|
+
const { CodeEditor } = require("./framework/components/chui_code_editor/code_editor");
|
|
164
|
+
const { ProgressRing } = require("./framework/components/chui_progress_ring/progress_ring");
|
|
165
|
+
const { Toolbar } = require("./framework/components/chui_toolbar/toolbar");
|
|
166
|
+
const { StatusBar } = require("./framework/components/chui_status_bar/status_bar");
|
|
167
|
+
const { Sortable } = require("./framework/modules/chui_sortable/chui_sortable");
|
|
168
|
+
const { Form } = require("./framework/components/chui_form/form");
|
|
169
|
+
const { SlideShow } = require("./framework/components/chui_slideshow/slideshow");
|
|
170
|
+
const { FieldSet } = require("./framework/components/chui_fieldset/fieldset");
|
|
171
|
+
const { Popup } = require("./framework/components/chui_popups/popups");
|
|
172
|
+
const { TelegramBot } = require("./framework/components/telegram_bot/chui_telegram_bot");
|
|
173
|
+
const { MenuBar } = require("./framework/components/chui_menu_bar/menu_bar");
|
|
174
|
+
const { CommandPalette } = require("./framework/components/chui_command_palette/command_palette");
|
|
136
175
|
const { ContextMenu } = require("./framework/components/chui_context_menu/context_menu");
|
|
137
|
-
const {Image} = require(
|
|
138
|
-
const {Audio} = require("./framework/components/chui_media/audio");
|
|
139
|
-
const {Video} = require("./framework/components/chui_media/video");
|
|
140
|
-
const {CustomElement} = require("./framework/components/chui_custom_element/custom_element");
|
|
141
|
-
const {Console} = require("./framework/components/chui_console/console");
|
|
142
|
-
const {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const {
|
|
146
|
-
const {
|
|
147
|
-
const {
|
|
148
|
-
const {
|
|
149
|
-
const {
|
|
150
|
-
const {
|
|
176
|
+
const { Image } = require("./framework/components/chui_media/image");
|
|
177
|
+
const { Audio } = require("./framework/components/chui_media/audio");
|
|
178
|
+
const { Video } = require("./framework/components/chui_media/video");
|
|
179
|
+
const { CustomElement } = require("./framework/components/chui_custom_element/custom_element");
|
|
180
|
+
const { Console } = require("./framework/components/chui_console/console");
|
|
181
|
+
const {
|
|
182
|
+
DownloadProgressNotification,
|
|
183
|
+
} = require("./framework/components/chui_notification/notification_download_progress");
|
|
184
|
+
const { MultiComboBox } = require("./framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box");
|
|
185
|
+
const { Mention } = require("./framework/components/chui_inputs/chui_mention/mention");
|
|
186
|
+
const { Chat } = require("./framework/components/chui_chat/chat");
|
|
187
|
+
const { ActionSheet } = require("./framework/components/chui_action_sheet/action_sheet");
|
|
188
|
+
const { ImageCompare } = require("./framework/components/chui_media/image_compare");
|
|
189
|
+
const { OrgChart } = require("./framework/components/chui_org_chart/org_chart");
|
|
190
|
+
const { QRCode } = require("./framework/components/chui_qrcode/qrcode");
|
|
191
|
+
const { Log } = require("./framework/modules/chui_logger/chui_logger");
|
|
151
192
|
const url = require("node:url");
|
|
152
193
|
|
|
153
194
|
/** Код исполняется на странице (renderer), а не в main: от этого зависит доступ к модулям Electron */
|
|
@@ -179,7 +220,8 @@ class Main {
|
|
|
179
220
|
* Строгая политика для безопасных окон: скрипты и стили только свои (и файлы приложения),
|
|
180
221
|
* никаких внешних источников, `connect-src 'none'` — окну не нужна сеть.
|
|
181
222
|
*/
|
|
182
|
-
static SECURE_CSP =
|
|
223
|
+
static SECURE_CSP =
|
|
224
|
+
"default-src 'none'; script-src 'self' file:; style-src 'self' file: 'unsafe-inline'; img-src 'self' file: data: blob:; font-src 'self' file: data:; media-src 'self' file: data: blob:; connect-src 'none'";
|
|
183
225
|
/**
|
|
184
226
|
* Разметка страницы окна: пустая оболочка без собственного кода — всё приходит из
|
|
185
227
|
* preload'а приложения (обычный режим) или из моста (`security: {contextIsolation: true}`,
|
|
@@ -215,31 +257,32 @@ class Main {
|
|
|
215
257
|
#updaterListening = false;
|
|
216
258
|
#lastUpdateInfo = undefined;
|
|
217
259
|
#onShowSystemNotification = (e, title, body) => {
|
|
218
|
-
let {Notification} = require(
|
|
219
|
-
new Notification({title, body}).show();
|
|
220
|
-
}
|
|
260
|
+
let { Notification } = require("electron");
|
|
261
|
+
new Notification({ title, body }).show();
|
|
262
|
+
};
|
|
221
263
|
#onSendLogText = (e, text, type) => {
|
|
222
264
|
if (type === "info") {
|
|
223
|
-
console.info(text)
|
|
265
|
+
console.info(text);
|
|
224
266
|
} else if (type === "error") {
|
|
225
|
-
console.error(text)
|
|
267
|
+
console.error(text);
|
|
226
268
|
}
|
|
227
|
-
this.#writeLog(text)
|
|
228
|
-
}
|
|
269
|
+
this.#writeLog(text);
|
|
270
|
+
};
|
|
229
271
|
#onUpdateInstallConfirm = (e, check) => {
|
|
230
272
|
if (check) {
|
|
231
273
|
Log.info("Установка обновления...");
|
|
232
274
|
require("electron-updater").autoUpdater.quitAndInstall();
|
|
233
275
|
}
|
|
234
|
-
}
|
|
276
|
+
};
|
|
235
277
|
#onUpdateDownloaded = async () => {
|
|
236
278
|
await this.#sendNotificationUpdateLoadClose();
|
|
237
279
|
await this.#sendNotificationUpdate(this.#appName, I18n.t("appLayout.update.downloaded"));
|
|
238
280
|
setTimeout(async () => await this.#sendNotificationUpdateClose(), 3000);
|
|
239
281
|
Log.info("Обновление скачано!");
|
|
240
|
-
const version =
|
|
282
|
+
const version =
|
|
283
|
+
this.#lastUpdateInfo === undefined ? app.getVersion() : this.#lastUpdateInfo.versionInfo.version;
|
|
241
284
|
this.#window.webContents.send("checkUpdatesTrue", true, version);
|
|
242
|
-
}
|
|
285
|
+
};
|
|
243
286
|
// Глобальные обработчики ошибок процесса: регистрируются один раз, снимаются в stop()/restart()
|
|
244
287
|
#processHandlersRegistered = false;
|
|
245
288
|
// Десктоп-сервисы (буфер, недавние, прогресс, глобальные клавиши) и их подписки по окнам
|
|
@@ -253,7 +296,7 @@ class Main {
|
|
|
253
296
|
#progress_windows = new Map();
|
|
254
297
|
#on_theme_updated = undefined;
|
|
255
298
|
// Безопасный режим: preload-мост, contextIsolation и CSP вместо Node в рендерере
|
|
256
|
-
#security = {contextIsolation: false, csp: false, channels: []};
|
|
299
|
+
#security = { contextIsolation: false, csp: false, channels: [] };
|
|
257
300
|
#secure_contents = new Set();
|
|
258
301
|
#bridge_enabled = false;
|
|
259
302
|
#window_actions_bound = false;
|
|
@@ -261,17 +304,17 @@ class Main {
|
|
|
261
304
|
#page_message_handlers = new Map();
|
|
262
305
|
#onUncaughtException = (error) => {
|
|
263
306
|
Main.#logProcessError("Необработанное исключение", error);
|
|
264
|
-
}
|
|
307
|
+
};
|
|
265
308
|
#onUnhandledRejection = (reason) => {
|
|
266
309
|
Main.#logProcessError("Необработанный reject промиса", reason);
|
|
267
|
-
}
|
|
310
|
+
};
|
|
268
311
|
static #logProcessError(prefix, value) {
|
|
269
312
|
const text = `${prefix}: ${Main.#formatError(value)}`;
|
|
270
313
|
try {
|
|
271
|
-
Log.error(text)
|
|
314
|
+
Log.error(text);
|
|
272
315
|
} catch (e) {
|
|
273
316
|
// Сам обработчик ошибок падать не должен (например, недоступен userData для лога)
|
|
274
|
-
console.error(text, e)
|
|
317
|
+
console.error(text, e);
|
|
275
318
|
}
|
|
276
319
|
}
|
|
277
320
|
static #formatError(value) {
|
|
@@ -289,51 +332,53 @@ class Main {
|
|
|
289
332
|
const target = path.join(this.#downloadPath, item.getFilename());
|
|
290
333
|
if (fs.existsSync(target)) return;
|
|
291
334
|
try {
|
|
292
|
-
if (!fs.existsSync(this.#downloadPath)) fs.mkdirSync(this.#downloadPath, {recursive: true});
|
|
335
|
+
if (!fs.existsSync(this.#downloadPath)) fs.mkdirSync(this.#downloadPath, { recursive: true });
|
|
293
336
|
item.setSavePath(target);
|
|
294
337
|
} catch (error) {
|
|
295
338
|
Log.error(`Не удалось сохранить загрузку в ${this.#downloadPath}: ${Main.#formatError(error)}`);
|
|
296
339
|
}
|
|
297
|
-
}
|
|
340
|
+
};
|
|
298
341
|
|
|
299
|
-
constructor(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
342
|
+
constructor(
|
|
343
|
+
options = {
|
|
344
|
+
name: String(),
|
|
345
|
+
sizes: { height: Number(), width: Number(), minHeight: Number(), minWidth: Number() },
|
|
346
|
+
render: String(),
|
|
347
|
+
devTools: Boolean(),
|
|
348
|
+
webSecurity: Boolean(),
|
|
349
|
+
resizable: Boolean(),
|
|
350
|
+
security: { contextIsolation: Boolean(), csp: Boolean(), channels: [] },
|
|
351
|
+
paths: {
|
|
352
|
+
downloadPath: String(),
|
|
353
|
+
},
|
|
309
354
|
}
|
|
310
|
-
|
|
355
|
+
) {
|
|
311
356
|
this.#app_icon = options.icon;
|
|
312
357
|
if (this.#app_icon === undefined) {
|
|
313
358
|
if (process.platform === "darwin") {
|
|
314
|
-
this.#app_icon = Main.#resizeIconTray(getDefaultIcon())
|
|
359
|
+
this.#app_icon = Main.#resizeIconTray(getDefaultIcon());
|
|
315
360
|
} else {
|
|
316
361
|
this.#app_icon = getDefaultIcon();
|
|
317
362
|
}
|
|
318
363
|
} else {
|
|
319
364
|
if (process.platform === "darwin") {
|
|
320
|
-
this.#app_icon = Main.#resizeIconTray(options.icon)
|
|
365
|
+
this.#app_icon = Main.#resizeIconTray(options.icon);
|
|
321
366
|
} else {
|
|
322
367
|
this.#app_icon = options.icon;
|
|
323
368
|
}
|
|
324
369
|
}
|
|
325
370
|
// app.commandLine.appendSwitch('--enable-features', 'OverlayScrollbar')
|
|
326
|
-
app.commandLine.appendSwitch(
|
|
327
|
-
app.commandLine.appendSwitch(
|
|
371
|
+
app.commandLine.appendSwitch("disable-hid-blocklist");
|
|
372
|
+
app.commandLine.appendSwitch("enable-features=OverlayScrollbar");
|
|
328
373
|
// app.commandLine.appendSwitch("disable-http-cache");
|
|
329
|
-
app.commandLine.appendSwitch(
|
|
330
|
-
app.commandLine.appendSwitch(
|
|
331
|
-
app.commandLine.appendSwitch(
|
|
332
|
-
app.commandLine.appendSwitch(
|
|
333
|
-
app.commandLine.appendSwitch(
|
|
334
|
-
app.commandLine.appendSwitch(
|
|
335
|
-
app.commandLine.appendSwitch(
|
|
336
|
-
app.commandLine.appendSwitch(
|
|
374
|
+
app.commandLine.appendSwitch("enable-transparent-visuals");
|
|
375
|
+
app.commandLine.appendSwitch("enable-gpu-rasterization", "true");
|
|
376
|
+
app.commandLine.appendSwitch("enable-native-gpu-memory-buffers", "true");
|
|
377
|
+
app.commandLine.appendSwitch("high-dpi-support", "true");
|
|
378
|
+
app.commandLine.appendSwitch("device-scale-factor", "true");
|
|
379
|
+
app.commandLine.appendSwitch("disable-touch-adjustment", "true");
|
|
380
|
+
app.commandLine.appendSwitch("main-frame-resizes-are-orientation-changes", "true");
|
|
381
|
+
app.commandLine.appendSwitch("disable-pinch", "true");
|
|
337
382
|
|
|
338
383
|
// Без опции загрузки идут обычным путём Electron: раньше значение вычислялось и не использовалось
|
|
339
384
|
this.#downloadPath = options.paths === undefined ? undefined : options.paths.downloadPath;
|
|
@@ -354,7 +399,7 @@ class Main {
|
|
|
354
399
|
}
|
|
355
400
|
|
|
356
401
|
static #resizeIconTray(image) {
|
|
357
|
-
return require(
|
|
402
|
+
return require("electron").nativeImage.createFromPath(image).resize({ width: 16, height: 16 });
|
|
358
403
|
}
|
|
359
404
|
|
|
360
405
|
/** Опции безопасности окна: по умолчанию включён привычный режим (Node в рендерере) */
|
|
@@ -362,7 +407,7 @@ class Main {
|
|
|
362
407
|
return {
|
|
363
408
|
contextIsolation: security.contextIsolation === true,
|
|
364
409
|
csp: security.csp === undefined ? true : security.csp,
|
|
365
|
-
channels: security.channels === undefined ? [] : security.channels
|
|
410
|
+
channels: security.channels === undefined ? [] : security.channels,
|
|
366
411
|
};
|
|
367
412
|
}
|
|
368
413
|
|
|
@@ -424,10 +469,19 @@ class Main {
|
|
|
424
469
|
* (`createWindow()`) собираются одним кодом: у всех окон одинаковые webPreferences,
|
|
425
470
|
* иконка, поведение закрытия и подписка на `chui_resizable_false`.
|
|
426
471
|
*/
|
|
427
|
-
#buildWindow(
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
472
|
+
#buildWindow(
|
|
473
|
+
options = {
|
|
474
|
+
name: String(),
|
|
475
|
+
title: String(),
|
|
476
|
+
sizes: Object(),
|
|
477
|
+
render: String(),
|
|
478
|
+
parent: undefined,
|
|
479
|
+
security: Object(),
|
|
480
|
+
hideOnClose: Boolean(),
|
|
481
|
+
resizable: Boolean(),
|
|
482
|
+
devTools: Boolean(),
|
|
483
|
+
}
|
|
484
|
+
) {
|
|
431
485
|
const sizes = options.sizes === undefined ? {} : options.sizes;
|
|
432
486
|
const name = options.name === undefined ? Main.MAIN_WINDOW : options.name;
|
|
433
487
|
const resizable = options.resizable === undefined ? this.#resizable : options.resizable;
|
|
@@ -449,35 +503,35 @@ class Main {
|
|
|
449
503
|
// выполняется как обычный <script> документа (см. chui_bridge/preload.js)
|
|
450
504
|
webPreferences: secure
|
|
451
505
|
? {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
506
|
+
plugins: false,
|
|
507
|
+
nodeIntegration: false,
|
|
508
|
+
contextIsolation: true,
|
|
509
|
+
sandbox: false,
|
|
510
|
+
preload: Main.SECURE_PRELOAD,
|
|
511
|
+
additionalArguments: Main.#bridgeArguments(options.render, security),
|
|
512
|
+
spellcheck: false,
|
|
513
|
+
webviewTag: false,
|
|
514
|
+
webSecurity: this.#webSecurity,
|
|
515
|
+
nodeIntegrationInSubFrames: false,
|
|
516
|
+
}
|
|
463
517
|
: {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
518
|
+
plugins: false,
|
|
519
|
+
nodeIntegration: true,
|
|
520
|
+
contextIsolation: false,
|
|
521
|
+
// Рендерер окна: у дополнительных окон может быть свой скрипт
|
|
522
|
+
preload: options.render === undefined ? this.#renderer : options.render,
|
|
523
|
+
spellcheck: false,
|
|
524
|
+
webviewTag: true,
|
|
525
|
+
webSecurity: this.#webSecurity,
|
|
526
|
+
nodeIntegrationInSubFrames: true,
|
|
527
|
+
},
|
|
474
528
|
frame: false,
|
|
475
529
|
resizable: resizable,
|
|
476
530
|
minimizable: true,
|
|
477
531
|
maximizable: true,
|
|
478
532
|
center: true,
|
|
479
533
|
hasShadow: true,
|
|
480
|
-
parent: options.parent
|
|
534
|
+
parent: options.parent,
|
|
481
535
|
});
|
|
482
536
|
const window = this.#window;
|
|
483
537
|
const webContentsId = window.webContents.id;
|
|
@@ -512,7 +566,7 @@ class Main {
|
|
|
512
566
|
setTimeout(() => {
|
|
513
567
|
if (!window.isDestroyed()) window.show();
|
|
514
568
|
}, 650)
|
|
515
|
-
)
|
|
569
|
+
);
|
|
516
570
|
// Подписки глобальных клавиш привязаны к отправителю: окно закрылось — снимаем их
|
|
517
571
|
window.on("closed", () => {
|
|
518
572
|
if (this.#windows.get(name) === window) this.#windows.delete(name);
|
|
@@ -522,7 +576,7 @@ class Main {
|
|
|
522
576
|
});
|
|
523
577
|
|
|
524
578
|
if (options.hideOnClose === true) {
|
|
525
|
-
window.on(
|
|
579
|
+
window.on("close", (evt) => {
|
|
526
580
|
if (!isQuiting) evt.preventDefault();
|
|
527
581
|
window.hide();
|
|
528
582
|
});
|
|
@@ -537,7 +591,7 @@ class Main {
|
|
|
537
591
|
#bindBeforeQuit() {
|
|
538
592
|
if (this.#before_quit_bound) return;
|
|
539
593
|
this.#before_quit_bound = true;
|
|
540
|
-
app.on(
|
|
594
|
+
app.on("before-quit", () => {
|
|
541
595
|
isQuiting = true;
|
|
542
596
|
});
|
|
543
597
|
}
|
|
@@ -547,18 +601,19 @@ class Main {
|
|
|
547
601
|
if (this.#webSecurity || this.#web_request_bound) return;
|
|
548
602
|
this.#web_request_bound = true;
|
|
549
603
|
window.webContents.session.webRequest.onBeforeSendHeaders((details, callback) => {
|
|
550
|
-
const {requestHeaders} = details;
|
|
551
|
-
Main.#keyToChangeLower(requestHeaders,
|
|
552
|
-
Main.#keyToChangeLower(requestHeaders,
|
|
553
|
-
callback({requestHeaders});
|
|
554
|
-
}
|
|
604
|
+
const { requestHeaders } = details;
|
|
605
|
+
Main.#keyToChangeLower(requestHeaders, "Access-Control-Allow-Origin", ["*"]);
|
|
606
|
+
Main.#keyToChangeLower(requestHeaders, "X-Frame-Options", ["*"]);
|
|
607
|
+
callback({ requestHeaders });
|
|
608
|
+
});
|
|
555
609
|
window.webContents.session.webRequest.onHeadersReceived((details, callback) => {
|
|
556
|
-
const {responseHeaders} = details;
|
|
557
|
-
Main.#keyToChangeLower(responseHeaders,
|
|
558
|
-
Main.#keyToChangeLower(responseHeaders,
|
|
559
|
-
Main.#keyToChangeLower(responseHeaders,
|
|
610
|
+
const { responseHeaders } = details;
|
|
611
|
+
Main.#keyToChangeLower(responseHeaders, "Access-Control-Allow-Origin", ["*"]);
|
|
612
|
+
Main.#keyToChangeLower(responseHeaders, "Access-Control-Allow-Headers", ["*"]);
|
|
613
|
+
Main.#keyToChangeLower(responseHeaders, "X-Frame-Options", ["*"]);
|
|
560
614
|
callback({
|
|
561
|
-
responseHeaders,
|
|
615
|
+
responseHeaders,
|
|
616
|
+
cancel: false,
|
|
562
617
|
});
|
|
563
618
|
});
|
|
564
619
|
}
|
|
@@ -575,10 +630,19 @@ class Main {
|
|
|
575
630
|
* main.sendTo('preview', 'preview_update', payload);
|
|
576
631
|
* ```
|
|
577
632
|
*/
|
|
578
|
-
async createWindow(
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
633
|
+
async createWindow(
|
|
634
|
+
options = {
|
|
635
|
+
name: String(),
|
|
636
|
+
title: String(),
|
|
637
|
+
sizes: Object(),
|
|
638
|
+
render: String(),
|
|
639
|
+
parent: undefined,
|
|
640
|
+
security: Object(),
|
|
641
|
+
hideOnClose: Boolean(),
|
|
642
|
+
resizable: Boolean(),
|
|
643
|
+
devTools: Boolean(),
|
|
644
|
+
}
|
|
645
|
+
) {
|
|
582
646
|
await app.whenReady();
|
|
583
647
|
this.enableServices();
|
|
584
648
|
return this.#buildWindow(options);
|
|
@@ -599,7 +663,7 @@ class Main {
|
|
|
599
663
|
return [...this.#windows].map(([name, window]) => ({
|
|
600
664
|
name: name,
|
|
601
665
|
window: window,
|
|
602
|
-
secure: this.#secure_contents.has(window.webContents.id)
|
|
666
|
+
secure: this.#secure_contents.has(window.webContents.id),
|
|
603
667
|
}));
|
|
604
668
|
}
|
|
605
669
|
|
|
@@ -657,8 +721,8 @@ class Main {
|
|
|
657
721
|
progress: new TaskbarProgress(),
|
|
658
722
|
theme: new Theme(store),
|
|
659
723
|
locale: new Locale(store),
|
|
660
|
-
clipboard_history: new ClipboardHistoryService({store: store}),
|
|
661
|
-
print: new Print()
|
|
724
|
+
clipboard_history: new ClipboardHistoryService({ store: store }),
|
|
725
|
+
print: new Print(),
|
|
662
726
|
};
|
|
663
727
|
// Сохранённая тема применяется до создания окна: иначе при запуске была бы видна
|
|
664
728
|
// вспышка системной палитры
|
|
@@ -720,7 +784,7 @@ class Main {
|
|
|
720
784
|
version: app.getVersion(),
|
|
721
785
|
locale: app.getLocale(),
|
|
722
786
|
systemLocale: app.getSystemLocale(),
|
|
723
|
-
isPackaged: app.isPackaged
|
|
787
|
+
isPackaged: app.isPackaged,
|
|
724
788
|
}));
|
|
725
789
|
// Закрытие и перезапуск со страницы: страница — код самого приложения, поэтому кнопке
|
|
726
790
|
// «Выход» не нужен свой канал в каждом проекте. Идут через `Main.stop()`/`restart()` —
|
|
@@ -747,12 +811,20 @@ class Main {
|
|
|
747
811
|
setImmediate(() => this.restart());
|
|
748
812
|
return true;
|
|
749
813
|
});
|
|
750
|
-
this.#handle(SERVICES_CHANNELS.DIALOG_OPEN, (event, options) =>
|
|
751
|
-
|
|
752
|
-
|
|
814
|
+
this.#handle(SERVICES_CHANNELS.DIALOG_OPEN, (event, options) =>
|
|
815
|
+
Main.#showDialog(event, "showOpenDialog", options)
|
|
816
|
+
);
|
|
817
|
+
this.#handle(SERVICES_CHANNELS.DIALOG_SAVE, (event, options) =>
|
|
818
|
+
Main.#showDialog(event, "showSaveDialog", options)
|
|
819
|
+
);
|
|
820
|
+
this.#handle(SERVICES_CHANNELS.DIALOG_MESSAGE, (event, options) =>
|
|
821
|
+
Main.#showDialog(event, "showMessageBox", options)
|
|
822
|
+
);
|
|
753
823
|
this.#handle(SERVICES_CHANNELS.SESSION_CACHE_SIZE, (event) => event.sender.session.getCacheSize());
|
|
754
824
|
this.#handle(SERVICES_CHANNELS.SESSION_CLEAR_CACHE, (event) => event.sender.session.clearCache());
|
|
755
|
-
this.#handle(SERVICES_CHANNELS.SESSION_CLEAR_STORAGE, (event, options) =>
|
|
825
|
+
this.#handle(SERVICES_CHANNELS.SESSION_CLEAR_STORAGE, (event, options) =>
|
|
826
|
+
event.sender.session.clearStorageData(options)
|
|
827
|
+
);
|
|
756
828
|
this.#handle(SERVICES_CHANNELS.RECENT_ADD, (event, path, name) => {
|
|
757
829
|
this.services.recent.add(path, name);
|
|
758
830
|
return true;
|
|
@@ -771,17 +843,26 @@ class Main {
|
|
|
771
843
|
return true;
|
|
772
844
|
});
|
|
773
845
|
this.#handle(SERVICES_CHANNELS.SHELL_OPEN_EXTERNAL, (event, url) => this.services.shell.openExternal(url));
|
|
774
|
-
this.#handle(SERVICES_CHANNELS.PRINT_PAGE, (event, options) =>
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
this.#handle(SERVICES_CHANNELS.
|
|
846
|
+
this.#handle(SERVICES_CHANNELS.PRINT_PAGE, (event, options) =>
|
|
847
|
+
this.services.print.page(BrowserWindow.fromWebContents(event.sender), this.#printOptions(event, options))
|
|
848
|
+
);
|
|
849
|
+
this.#handle(SERVICES_CHANNELS.PRINT_HTML, (event, html, options) =>
|
|
850
|
+
this.services.print.html(html, this.#printOptions(event, options))
|
|
851
|
+
);
|
|
852
|
+
this.#handle(SERVICES_CHANNELS.PRINT_PDF, (event, html, options) =>
|
|
853
|
+
this.services.print.pdf(html, this.#printOptions(event, options))
|
|
854
|
+
);
|
|
855
|
+
this.#handle(SERVICES_CHANNELS.THEME_GET, () => ({
|
|
856
|
+
theme: this.services.theme.get(),
|
|
857
|
+
source: this.services.theme.getSource(),
|
|
858
|
+
}));
|
|
778
859
|
this.#handle(SERVICES_CHANNELS.THEME_SET, (event, source) => {
|
|
779
860
|
this.services.theme.set(source);
|
|
780
|
-
return {theme: this.services.theme.get(), source: this.services.theme.getSource()};
|
|
861
|
+
return { theme: this.services.theme.get(), source: this.services.theme.getSource() };
|
|
781
862
|
});
|
|
782
863
|
this.#handle(SERVICES_CHANNELS.THEME_TOGGLE, () => {
|
|
783
864
|
this.services.theme.toggle();
|
|
784
|
-
return {theme: this.services.theme.get(), source: this.services.theme.getSource()};
|
|
865
|
+
return { theme: this.services.theme.get(), source: this.services.theme.getSource() };
|
|
785
866
|
});
|
|
786
867
|
this.#handle(SERVICES_CHANNELS.LOCALE_GET, () => this.services.locale.get());
|
|
787
868
|
this.#handle(SERVICES_CHANNELS.LOCALE_SET, (event, locale) => {
|
|
@@ -793,7 +874,9 @@ class Main {
|
|
|
793
874
|
this.#emitLocale(applied);
|
|
794
875
|
return applied;
|
|
795
876
|
});
|
|
796
|
-
this.#handle(SERVICES_CHANNELS.SHORTCUT_SUBSCRIBE, (event, accelerator) =>
|
|
877
|
+
this.#handle(SERVICES_CHANNELS.SHORTCUT_SUBSCRIBE, (event, accelerator) =>
|
|
878
|
+
this.#subscribeShortcut(event, accelerator)
|
|
879
|
+
);
|
|
797
880
|
this.#handle(SERVICES_CHANNELS.SHORTCUT_UNSUBSCRIBE, (event, accelerator) => {
|
|
798
881
|
this.#unsubscribeShortcut(event, accelerator);
|
|
799
882
|
return true;
|
|
@@ -817,9 +900,9 @@ class Main {
|
|
|
817
900
|
#handleSync(channel = String(), handler = () => {}) {
|
|
818
901
|
const listener = (event, ...args) => {
|
|
819
902
|
try {
|
|
820
|
-
event.returnValue = {value: handler(event, ...args)};
|
|
903
|
+
event.returnValue = { value: handler(event, ...args) };
|
|
821
904
|
} catch (error) {
|
|
822
|
-
event.returnValue = {error: error instanceof Error ? error.message : String(error)};
|
|
905
|
+
event.returnValue = { error: error instanceof Error ? error.message : String(error) };
|
|
823
906
|
}
|
|
824
907
|
};
|
|
825
908
|
ipcMain.on(channel, listener);
|
|
@@ -852,7 +935,7 @@ class Main {
|
|
|
852
935
|
isMaximized: window.isMaximized(),
|
|
853
936
|
isMinimized: window.isMinimized(),
|
|
854
937
|
isFullScreen: window.isFullScreen(),
|
|
855
|
-
isFocused: window.isFocused()
|
|
938
|
+
isFocused: window.isFocused(),
|
|
856
939
|
};
|
|
857
940
|
});
|
|
858
941
|
return this;
|
|
@@ -866,7 +949,7 @@ class Main {
|
|
|
866
949
|
this.#handle(BRIDGE_CHANNELS.LOCALE_GET, () => this.services.locale.get());
|
|
867
950
|
this.#handle(BRIDGE_CHANNELS.MESSAGE, (event, channel, ...args) => {
|
|
868
951
|
const handler = this.#page_message_handlers.get(channel);
|
|
869
|
-
if (handler === undefined) return {handled: false};
|
|
952
|
+
if (handler === undefined) return { handled: false };
|
|
870
953
|
return handler(...args, event);
|
|
871
954
|
});
|
|
872
955
|
this.#bindThemeEvents();
|
|
@@ -1016,7 +1099,7 @@ class Main {
|
|
|
1016
1099
|
* поэтому `parent` берём из события, а не из запроса страницы.
|
|
1017
1100
|
*/
|
|
1018
1101
|
#printOptions(event, options = Object()) {
|
|
1019
|
-
return {...options, parent: BrowserWindow.fromWebContents(event.sender)};
|
|
1102
|
+
return { ...options, parent: BrowserWindow.fromWebContents(event.sender) };
|
|
1020
1103
|
}
|
|
1021
1104
|
|
|
1022
1105
|
#emitShortcut(accelerator = String()) {
|
|
@@ -1060,15 +1143,15 @@ class Main {
|
|
|
1060
1143
|
#hideAndShow() {
|
|
1061
1144
|
const window = this.#targetWindow();
|
|
1062
1145
|
if (window === undefined) return;
|
|
1063
|
-
let visible = window.isVisible()
|
|
1064
|
-
let focus = window.isFocused()
|
|
1146
|
+
let visible = window.isVisible();
|
|
1147
|
+
let focus = window.isFocused();
|
|
1065
1148
|
|
|
1066
1149
|
if (visible && focus) {
|
|
1067
|
-
window.hide()
|
|
1150
|
+
window.hide();
|
|
1068
1151
|
} else if (!visible && !focus) {
|
|
1069
|
-
window.show()
|
|
1152
|
+
window.show();
|
|
1070
1153
|
} else {
|
|
1071
|
-
window.focus()
|
|
1154
|
+
window.focus();
|
|
1072
1155
|
}
|
|
1073
1156
|
}
|
|
1074
1157
|
|
|
@@ -1086,17 +1169,17 @@ class Main {
|
|
|
1086
1169
|
|
|
1087
1170
|
stop() {
|
|
1088
1171
|
this.#removeGlobalHandlers();
|
|
1089
|
-
if (process.platform !==
|
|
1172
|
+
if (process.platform !== "darwin") {
|
|
1090
1173
|
app.quit();
|
|
1091
1174
|
} else {
|
|
1092
|
-
app.exit(0)
|
|
1175
|
+
app.exit(0);
|
|
1093
1176
|
}
|
|
1094
1177
|
}
|
|
1095
1178
|
|
|
1096
1179
|
restart() {
|
|
1097
1180
|
this.#removeGlobalHandlers();
|
|
1098
1181
|
app.relaunch();
|
|
1099
|
-
app.exit(0)
|
|
1182
|
+
app.exit(0);
|
|
1100
1183
|
}
|
|
1101
1184
|
|
|
1102
1185
|
#removeGlobalHandlers() {
|
|
@@ -1129,7 +1212,7 @@ class Main {
|
|
|
1129
1212
|
this.#window_actions_bound = false;
|
|
1130
1213
|
if (this.#updaterListening) {
|
|
1131
1214
|
this.#updaterListening = false;
|
|
1132
|
-
require("electron-updater").autoUpdater.removeListener(
|
|
1215
|
+
require("electron-updater").autoUpdater.removeListener("update-downloaded", this.#onUpdateDownloaded);
|
|
1133
1216
|
}
|
|
1134
1217
|
if (this.#processHandlersRegistered) {
|
|
1135
1218
|
this.#processHandlersRegistered = false;
|
|
@@ -1139,7 +1222,7 @@ class Main {
|
|
|
1139
1222
|
this.#ipcRegistered = false;
|
|
1140
1223
|
}
|
|
1141
1224
|
|
|
1142
|
-
start(options = {hideOnClose: Boolean(), globalMenu: [], tray: [], extensions: []}) {
|
|
1225
|
+
start(options = { hideOnClose: Boolean(), globalMenu: [], tray: [], extensions: [] }) {
|
|
1143
1226
|
nativeTheme.themeSource = "system";
|
|
1144
1227
|
// Обработчики процесса — один раз на экземпляр Main (иначе копились при повторном start())
|
|
1145
1228
|
if (this.#ipcRegistered === false) {
|
|
@@ -1156,7 +1239,7 @@ class Main {
|
|
|
1156
1239
|
|
|
1157
1240
|
app.whenReady().then(() => {
|
|
1158
1241
|
session.defaultSession.setPermissionRequestHandler((webContents, permission, callback) => {
|
|
1159
|
-
if (permission ===
|
|
1242
|
+
if (permission === "media") {
|
|
1160
1243
|
callback(true); // Approve microphone/camera access
|
|
1161
1244
|
} else {
|
|
1162
1245
|
callback(false);
|
|
@@ -1164,49 +1247,53 @@ class Main {
|
|
|
1164
1247
|
});
|
|
1165
1248
|
|
|
1166
1249
|
if (options.extensions) {
|
|
1167
|
-
for (let extension of options.extensions)
|
|
1250
|
+
for (let extension of options.extensions)
|
|
1251
|
+
session.defaultSession
|
|
1252
|
+
.loadExtension(extension)
|
|
1253
|
+
.then((r) => Log.info(r))
|
|
1254
|
+
.catch((e) => Log.error(e));
|
|
1168
1255
|
}
|
|
1169
1256
|
if (options.tray) {
|
|
1170
1257
|
this.#tray = new Tray(this.#app_icon);
|
|
1171
1258
|
const context = Menu.buildFromTemplate(options.tray);
|
|
1172
1259
|
this.#tray.setContextMenu(context);
|
|
1173
1260
|
|
|
1174
|
-
this.#tray.on("click", () => this.#hideAndShow())
|
|
1261
|
+
this.#tray.on("click", () => this.#hideAndShow());
|
|
1175
1262
|
}
|
|
1176
1263
|
if (options.globalMenu) {
|
|
1177
|
-
const menu = Menu.buildFromTemplate(options.globalMenu)
|
|
1178
|
-
Menu.setApplicationMenu(menu)
|
|
1264
|
+
const menu = Menu.buildFromTemplate(options.globalMenu);
|
|
1265
|
+
Menu.setApplicationMenu(menu);
|
|
1179
1266
|
} else {
|
|
1180
|
-
Menu.setApplicationMenu(null)
|
|
1267
|
+
Menu.setApplicationMenu(null);
|
|
1181
1268
|
}
|
|
1182
1269
|
this.enableServices();
|
|
1183
|
-
this.#buildWindow({name: Main.MAIN_WINDOW, hideOnClose: options.hideOnClose});
|
|
1184
|
-
})
|
|
1270
|
+
this.#buildWindow({ name: Main.MAIN_WINDOW, hideOnClose: options.hideOnClose });
|
|
1271
|
+
});
|
|
1185
1272
|
}
|
|
1186
1273
|
|
|
1187
1274
|
#writeLog(text) {
|
|
1188
|
-
let today = new Date().toLocaleDateString().replace("/", ".")
|
|
1189
|
-
let log_dir_path = path.join(app.getPath("userData"), "logs")
|
|
1190
|
-
let log_file_path = path.join(log_dir_path, `app_${today}.log`)
|
|
1275
|
+
let today = new Date().toLocaleDateString().replace("/", ".");
|
|
1276
|
+
let log_dir_path = path.join(app.getPath("userData"), "logs");
|
|
1277
|
+
let log_file_path = path.join(log_dir_path, `app_${today}.log`);
|
|
1191
1278
|
|
|
1192
1279
|
if (!fs.existsSync(log_dir_path)) {
|
|
1193
1280
|
fs.mkdirSync(log_dir_path, { recursive: true });
|
|
1194
1281
|
fs.writeFileSync(log_file_path, "", "utf-8");
|
|
1195
1282
|
}
|
|
1196
1283
|
|
|
1197
|
-
fs.writeFile(log_file_path, `${text}\n`, { flag:
|
|
1284
|
+
fs.writeFile(log_file_path, `${text}\n`, { flag: "a+" }, (err) => {
|
|
1198
1285
|
if (err) console.error(err);
|
|
1199
1286
|
});
|
|
1200
1287
|
}
|
|
1201
1288
|
|
|
1202
1289
|
enableAutoUpdateApp(start = Number()) {
|
|
1203
|
-
const {autoUpdater} = require("electron-updater");
|
|
1290
|
+
const { autoUpdater } = require("electron-updater");
|
|
1204
1291
|
// Подписки на апдейтер и подтверждение установки — один раз на экземпляр Main:
|
|
1205
1292
|
// раньше ipcMain.on("updateInstallConfirm") и autoUpdater.on добавлялись
|
|
1206
1293
|
// внутри update-downloaded, то есть на каждое событие.
|
|
1207
1294
|
if (this.#updaterListening === false) {
|
|
1208
1295
|
this.#updaterListening = true;
|
|
1209
|
-
autoUpdater.on(
|
|
1296
|
+
autoUpdater.on("update-downloaded", this.#onUpdateDownloaded);
|
|
1210
1297
|
ipcMain.on("updateInstallConfirm", this.#onUpdateInstallConfirm);
|
|
1211
1298
|
}
|
|
1212
1299
|
setTimeout(async () => {
|
|
@@ -1215,7 +1302,10 @@ class Main {
|
|
|
1215
1302
|
if (updates !== null) {
|
|
1216
1303
|
this.#lastUpdateInfo = updates;
|
|
1217
1304
|
if (updates.versionInfo.version > app.getVersion()) {
|
|
1218
|
-
await this.#sendNotificationUpdateLoad(
|
|
1305
|
+
await this.#sendNotificationUpdateLoad(
|
|
1306
|
+
this.#appName,
|
|
1307
|
+
I18n.t("appLayout.update.downloading", { version: updates.versionInfo.version })
|
|
1308
|
+
);
|
|
1219
1309
|
}
|
|
1220
1310
|
}
|
|
1221
1311
|
}, start);
|
|
@@ -1235,40 +1325,40 @@ class Main {
|
|
|
1235
1325
|
|
|
1236
1326
|
/** Уведомление о загрузке; последним аргументом можно указать окно реестра */
|
|
1237
1327
|
sendDownload(text, body, windowName = undefined) {
|
|
1238
|
-
setTimeout(() => this.#send("sendNotificationDownload", [text, body], windowName), 1)
|
|
1328
|
+
setTimeout(() => this.#send("sendNotificationDownload", [text, body], windowName), 1);
|
|
1239
1329
|
}
|
|
1240
1330
|
sendDownloadUpdate(text, body, windowName = undefined) {
|
|
1241
|
-
setTimeout(() => this.#send("sendNotificationDownloadUpdate", [text, body], windowName), 1)
|
|
1331
|
+
setTimeout(() => this.#send("sendNotificationDownloadUpdate", [text, body], windowName), 1);
|
|
1242
1332
|
}
|
|
1243
1333
|
sendDownloadComplete(text, body, windowName = undefined) {
|
|
1244
|
-
setTimeout(() => this.#send("sendNotificationDownloadComplete", [text, body], windowName), 250)
|
|
1334
|
+
setTimeout(() => this.#send("sendNotificationDownloadComplete", [text, body], windowName), 250);
|
|
1245
1335
|
}
|
|
1246
1336
|
sendDownloadError(text, body, windowName = undefined) {
|
|
1247
|
-
setTimeout(() => this.#send("sendNotificationDownloadError", [text, body], windowName), 250)
|
|
1337
|
+
setTimeout(() => this.#send("sendNotificationDownloadError", [text, body], windowName), 250);
|
|
1248
1338
|
}
|
|
1249
1339
|
}
|
|
1250
1340
|
|
|
1251
1341
|
class Styles {
|
|
1252
|
-
static WORD_BREAK = {NORMAL: "normal", BREAK_ALL: "break-all", KEEP_ALL: "keep-all", BREAK_WORD: "break-word"}
|
|
1253
|
-
static TEXT_ALIGN = {CENTER:
|
|
1254
|
-
static ALIGN = {CENTER:
|
|
1342
|
+
static WORD_BREAK = { NORMAL: "normal", BREAK_ALL: "break-all", KEEP_ALL: "keep-all", BREAK_WORD: "break-word" };
|
|
1343
|
+
static TEXT_ALIGN = { CENTER: "center", END: "end", START: "start" };
|
|
1344
|
+
static ALIGN = { CENTER: "center", END: "flex-end", START: "flex-start", BASELINE: "baseline", STRETCH: "stretch" };
|
|
1255
1345
|
static JUSTIFY = {
|
|
1256
|
-
CENTER:
|
|
1257
|
-
END:
|
|
1258
|
-
START:
|
|
1259
|
-
SPACE_AROUND:
|
|
1260
|
-
SPACE_BEETWEEN:
|
|
1261
|
-
SPACE_EVENLY:
|
|
1346
|
+
CENTER: "center",
|
|
1347
|
+
END: "flex-end",
|
|
1348
|
+
START: "flex-start",
|
|
1349
|
+
SPACE_AROUND: "space-around",
|
|
1350
|
+
SPACE_BEETWEEN: "space-between",
|
|
1351
|
+
SPACE_EVENLY: "space-evenly",
|
|
1262
1352
|
};
|
|
1263
|
-
static DIRECTION = {ROW:
|
|
1264
|
-
static WRAP = {NOWRAP:
|
|
1353
|
+
static DIRECTION = { ROW: "row", COLUMN: "column" };
|
|
1354
|
+
static WRAP = { NOWRAP: "nowrap", WRAP: "wrap" };
|
|
1265
1355
|
static SIZE = {
|
|
1266
|
-
AUTO:
|
|
1267
|
-
FIT_CONTENT:
|
|
1268
|
-
MAX_CONTENT:
|
|
1269
|
-
MIN_CONTENT:
|
|
1270
|
-
WEBKIT_FILL:
|
|
1271
|
-
INHERIT:
|
|
1356
|
+
AUTO: "auto",
|
|
1357
|
+
FIT_CONTENT: "fit-content",
|
|
1358
|
+
MAX_CONTENT: "max-content",
|
|
1359
|
+
MIN_CONTENT: "min-content",
|
|
1360
|
+
WEBKIT_FILL: "-webkit-fill-available",
|
|
1361
|
+
INHERIT: "inherit",
|
|
1272
1362
|
};
|
|
1273
1363
|
}
|
|
1274
1364
|
|
|
@@ -1446,10 +1536,13 @@ module.exports = {
|
|
|
1446
1536
|
Log: Log,
|
|
1447
1537
|
chooseFile: {
|
|
1448
1538
|
// Диалоги: странице — по IPC (окно берётся у отправителя), в main — обычный dialog Electron
|
|
1449
|
-
showOpenDialog: (options = {}) =>
|
|
1450
|
-
|
|
1451
|
-
|
|
1539
|
+
showOpenDialog: (options = {}) =>
|
|
1540
|
+
inRenderer() ? Desktop.dialog.open(options) : dialog.showOpenDialog(options),
|
|
1541
|
+
showSaveDialog: (options = {}) =>
|
|
1542
|
+
inRenderer() ? Desktop.dialog.save(options) : dialog.showSaveDialog(options),
|
|
1543
|
+
showMessageBox: (options = {}) =>
|
|
1544
|
+
inRenderer() ? Desktop.dialog.message(options) : dialog.showMessageBox(options),
|
|
1452
1545
|
},
|
|
1453
1546
|
//
|
|
1454
|
-
systemPreferences: systemPreferences
|
|
1455
|
-
}
|
|
1547
|
+
systemPreferences: systemPreferences,
|
|
1548
|
+
};
|