chuijs 3.6.3 → 3.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +1203 -162
- package/framework/appLayout/default/chui_app_layout.js +747 -747
- package/framework/appLayout/default/global_style.css +592 -570
- package/framework/appLayout/default/main_theme_style.css +118 -101
- package/framework/components/chui_accordion/accordion.js +63 -63
- package/framework/components/chui_accordion/styles.css +79 -75
- package/framework/components/chui_badge/badge.js +55 -55
- package/framework/components/chui_badge/styles.css +29 -29
- package/framework/components/chui_button/button.js +48 -48
- package/framework/components/chui_button/styles.css +75 -70
- package/framework/components/chui_calendar/calendar.js +97 -97
- package/framework/components/chui_card/card.js +87 -0
- package/framework/components/chui_card/styles.css +72 -0
- package/framework/components/chui_code/code.js +18 -18
- package/framework/components/chui_code/styles.css +9 -9
- package/framework/components/chui_console/console.js +27 -27
- package/framework/components/chui_console/styles.css +31 -31
- package/framework/components/chui_content_block/content_block.js +51 -51
- package/framework/components/chui_content_block/styles.css +2 -2
- package/framework/components/chui_context_menu/context_menu.js +230 -0
- package/framework/components/chui_context_menu/styles.css +136 -0
- package/framework/components/chui_custom_element/custom_element.js +24 -24
- package/framework/components/chui_details/details.js +85 -85
- package/framework/components/chui_details/styles.css +70 -66
- package/framework/components/chui_fieldset/fieldset.js +40 -40
- package/framework/components/chui_fieldset/styles.css +24 -24
- package/framework/components/chui_form/form.js +40 -40
- package/framework/components/chui_form/styles.css +21 -21
- package/framework/components/chui_graphs/graphs.js +234 -190
- package/framework/components/chui_graphs/styles.css +37 -32
- package/framework/components/chui_hero/hero.js +98 -0
- package/framework/components/chui_hero/styles.css +91 -0
- package/framework/components/chui_html_block/html_block.js +16 -16
- package/framework/components/chui_html_block/styles.css +5 -5
- package/framework/components/chui_hx/hx.js +15 -15
- package/framework/components/chui_hx/styles.css +38 -38
- package/framework/components/chui_icons/icons.js +2144 -2144
- package/framework/components/chui_icons/styles.css +13 -13
- package/framework/components/chui_inputs/chui_check_box/check_box.js +32 -32
- package/framework/components/chui_inputs/chui_check_box/styles.css +91 -86
- package/framework/components/chui_inputs/chui_combo_box/combo_box.js +166 -150
- package/framework/components/chui_inputs/chui_combo_box/styles.css +113 -107
- package/framework/components/chui_inputs/chui_date/date.js +177 -174
- package/framework/components/chui_inputs/chui_date/styles.css +163 -128
- package/framework/components/chui_inputs/chui_email/email.js +61 -61
- package/framework/components/chui_inputs/chui_email/styles.css +69 -71
- package/framework/components/chui_inputs/chui_file/file.js +76 -76
- package/framework/components/chui_inputs/chui_file/styles.css +99 -99
- package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +295 -295
- package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +212 -235
- package/framework/components/chui_inputs/chui_number/number.js +108 -108
- package/framework/components/chui_inputs/chui_number/styles.css +84 -84
- package/framework/components/chui_inputs/chui_password/password.js +99 -99
- package/framework/components/chui_inputs/chui_password/styles.css +97 -97
- package/framework/components/chui_inputs/chui_radio_button/radio_button.js +45 -45
- package/framework/components/chui_inputs/chui_radio_button/styles.css +76 -73
- package/framework/components/chui_inputs/chui_select_box/select_box.js +187 -170
- package/framework/components/chui_inputs/chui_select_box/styles.css +123 -117
- package/framework/components/chui_inputs/chui_text/styles.css +83 -84
- package/framework/components/chui_inputs/chui_text/text.js +91 -91
- package/framework/components/chui_inputs/chui_text_area/styles.css +57 -57
- package/framework/components/chui_inputs/chui_text_area/text_area.js +61 -61
- package/framework/components/chui_inputs/chui_toggle/styles.css +66 -61
- package/framework/components/chui_inputs/chui_toggle/toggle.js +36 -36
- package/framework/components/chui_label/label.js +54 -54
- package/framework/components/chui_label/styles.css +11 -11
- package/framework/components/chui_media/audio.js +908 -908
- package/framework/components/chui_media/audio_styles.css +458 -458
- package/framework/components/chui_media/image.js +105 -105
- package/framework/components/chui_media/image_styles.css +61 -61
- package/framework/components/chui_media/video.js +248 -248
- package/framework/components/chui_media/video_styles.css +160 -160
- package/framework/components/chui_menu_bar/menu_bar.js +66 -74
- package/framework/components/chui_menu_bar/styles.css +114 -76
- package/framework/components/chui_modal/modal.js +142 -135
- package/framework/components/chui_modal/styles.css +36 -36
- package/framework/components/chui_notification/notification.js +72 -72
- package/framework/components/chui_notification/notification_download.js +78 -78
- package/framework/components/chui_notification/notification_download_progress.css +119 -123
- package/framework/components/chui_notification/notification_download_progress.js +105 -105
- package/framework/components/chui_notification/notification_update.js +54 -54
- package/framework/components/chui_notification/styles.css +91 -91
- package/framework/components/chui_notification/styles_download.css +85 -85
- package/framework/components/chui_notification/styles_update.css +73 -73
- package/framework/components/chui_paragraph/paragraph.js +14 -14
- package/framework/components/chui_paragraph/styles.css +6 -6
- package/framework/components/chui_popups/popups.js +250 -250
- package/framework/components/chui_popups/styles.css +129 -115
- package/framework/components/chui_progress_bar/progress_bar.js +28 -28
- package/framework/components/chui_progress_bar/styles.css +28 -28
- package/framework/components/chui_radio_group/radio_group.js +57 -57
- package/framework/components/chui_radio_group/styles.css +3 -3
- package/framework/components/chui_slideshow/slideshow.js +75 -75
- package/framework/components/chui_slideshow/styles.css +94 -85
- package/framework/components/chui_spinner/spinner.js +45 -45
- package/framework/components/chui_spinner/styles.css +23 -23
- package/framework/components/chui_table/styles.css +42 -42
- package/framework/components/chui_table/table.js +234 -234
- package/framework/components/chui_tabs/chui_tabs.js +77 -77
- package/framework/components/chui_tabs/styles.css +54 -48
- package/framework/components/chui_text_editor/styles.css +217 -217
- package/framework/components/chui_text_editor/text_editor.js +144 -144
- package/framework/components/chui_text_editor/text_editor_panel.js +568 -568
- package/framework/components/chui_tree_view/styles.css +81 -75
- package/framework/components/chui_tree_view/tree_view.js +90 -90
- package/framework/components/chui_webview/styles.css +27 -27
- package/framework/components/chui_webview/webview.js +103 -103
- package/framework/components/telegram_bot/chui_telegram_bot.js +183 -183
- package/framework/modules/chui_animations/animations.js +121 -121
- package/framework/modules/chui_animations/styles.css +79 -79
- package/framework/modules/chui_fonts.js +7128 -7128
- package/framework/modules/chui_functions.js +106 -78
- package/framework/modules/chui_logger/chui_logger.js +53 -53
- package/framework/modules/chui_page/page.js +86 -86
- package/framework/modules/chui_page/styles.css +9 -9
- package/framework/tray_bar/chui_menu_items.js +48 -48
- package/index.js +570 -555
- package/package.json +51 -46
|
@@ -1,76 +1,82 @@
|
|
|
1
|
-
chui_tree_view {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
height: max-content;
|
|
5
|
-
font-size: var(--font_default_size);
|
|
6
|
-
font-weight:500;
|
|
7
|
-
border: none;
|
|
8
|
-
margin: var(--margin);
|
|
9
|
-
border-radius: var(--border_radius);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
chui_tree_view_main_test {
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
height: max-content;
|
|
16
|
-
width: -webkit-fill-available;
|
|
17
|
-
font-size: var(--font_default_size);
|
|
18
|
-
font-weight:500;
|
|
19
|
-
border-radius: var(--border_radius);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
border-bottom-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
background: var(--blue_prime_background);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
1
|
+
chui_tree_view {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
height: max-content;
|
|
5
|
+
font-size: var(--font_default_size);
|
|
6
|
+
font-weight:500;
|
|
7
|
+
border: none;
|
|
8
|
+
margin: var(--margin);
|
|
9
|
+
border-radius: var(--border_radius);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
chui_tree_view_main_test {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
height: max-content;
|
|
16
|
+
width: -webkit-fill-available;
|
|
17
|
+
font-size: var(--font_default_size);
|
|
18
|
+
font-weight:500;
|
|
19
|
+
border-radius: var(--border_radius);
|
|
20
|
+
background: var(--element_background);
|
|
21
|
+
border: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
tree_view_button {
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
padding: var(--main_padding);
|
|
27
|
+
width: -webkit-fill-available;
|
|
28
|
+
text-align: left;
|
|
29
|
+
outline: none;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
border-radius: var(--border_radius);
|
|
34
|
+
color: var(--text_color);
|
|
35
|
+
border: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
tree_view_panel {
|
|
39
|
+
padding: 0 0 0 10px;
|
|
40
|
+
display: block;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
width: -webkit-fill-available;
|
|
43
|
+
max-height: 0;
|
|
44
|
+
border-bottom-right-radius: var(--border_radius);
|
|
45
|
+
border-bottom-left-radius: var(--border_radius);
|
|
46
|
+
color: var(--text_color);
|
|
47
|
+
border: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
tree_view_html {
|
|
51
|
+
padding: 0;
|
|
52
|
+
width: -webkit-fill-available;
|
|
53
|
+
display: flex;
|
|
54
|
+
border: none;
|
|
55
|
+
flex-direction: column
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
tree_view_button:hover {
|
|
59
|
+
background: var(--blue_prime_background);
|
|
60
|
+
color: var(--text_color_hover);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
tree_view_button:active {
|
|
64
|
+
background: var(--element_background_prime);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
tree_view_button:hover tree_view_button_text {
|
|
68
|
+
color: var(--text_color_hover);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
tree_view_button:hover chui_icon {
|
|
72
|
+
color: var(--text_color_hover);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.tree_view_button_active {
|
|
76
|
+
background: var(--blue_prime_background);
|
|
77
|
+
color: var(--text_color_hover);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.tree_view_button_active chui_icon {
|
|
81
|
+
color: var(--text_color_hover);
|
|
76
82
|
}
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
const {Icon, Icons} = require("../chui_icons/icons");
|
|
2
|
-
|
|
3
|
-
class TreeView {
|
|
4
|
-
#chui_tree_view = document.createElement(`chui_tree_view`);
|
|
5
|
-
constructor(options = { width: String(), components: [] }) {
|
|
6
|
-
require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_TreeView');
|
|
7
|
-
let main_test = document.createElement(`chui_tree_view_main_test`);
|
|
8
|
-
if (options.width !== undefined) {
|
|
9
|
-
this.#chui_tree_view.style.width = options.width;
|
|
10
|
-
} else {
|
|
11
|
-
this.#chui_tree_view.style.width = 'max-content'
|
|
12
|
-
}
|
|
13
|
-
options.components.forEach(buttons => {
|
|
14
|
-
main_test.appendChild(buttons.button)
|
|
15
|
-
if (buttons.panel !== undefined) {
|
|
16
|
-
main_test.appendChild(buttons.panel)
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
this.#chui_tree_view.appendChild(main_test)
|
|
20
|
-
}
|
|
21
|
-
set() {
|
|
22
|
-
return this.#chui_tree_view;
|
|
23
|
-
}
|
|
24
|
-
static Button(options = { title: String(), listener: () => {} }) {
|
|
25
|
-
let button = document.createElement('tree_view_button');
|
|
26
|
-
button.addEventListener("click", options.listener);
|
|
27
|
-
let button_text = document.createElement('tree_view_button_text');
|
|
28
|
-
button_text.innerHTML = options.title;
|
|
29
|
-
button.appendChild(button_text)
|
|
30
|
-
return {
|
|
31
|
-
title: options.title,
|
|
32
|
-
button: button
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
static ExpandButton(options = { title: String(), subButtons: [], components: [] }) {
|
|
36
|
-
let button = document.createElement('tree_view_button');
|
|
37
|
-
let panel = document.createElement('tree_view_panel')
|
|
38
|
-
button.addEventListener('click', (e) => {
|
|
39
|
-
button.classList.toggle('tree_view_button_active')
|
|
40
|
-
let panel = button.nextElementSibling;
|
|
41
|
-
if (panel.style.maxHeight) {
|
|
42
|
-
panel.style.maxHeight = panel.scrollHeight + "px";
|
|
43
|
-
setTimeout(() => {
|
|
44
|
-
button.children[1].children[0].style.transform = 'rotate(0deg)';
|
|
45
|
-
panel.style.maxHeight = null;
|
|
46
|
-
button.style.borderBottomLeftRadius = 'var(--border_radius)';
|
|
47
|
-
button.style.borderBottomRightRadius = 'var(--border_radius)';
|
|
48
|
-
}, 1);
|
|
49
|
-
} else {
|
|
50
|
-
setTimeout(() => {
|
|
51
|
-
button.children[1].children[0].style.transform = 'rotate(180deg)';
|
|
52
|
-
button.style.borderBottomLeftRadius = '0px';
|
|
53
|
-
button.style.borderBottomRightRadius = '0px';
|
|
54
|
-
panel.style.maxHeight = panel.scrollHeight + "px";
|
|
55
|
-
panel.addEventListener('transitionend', () => {
|
|
56
|
-
if (panel.style.maxHeight) panel.style.maxHeight = "max-content";
|
|
57
|
-
});
|
|
58
|
-
}, 1);
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
let button_text = document.createElement('tree_view_button_text');
|
|
62
|
-
button_text.innerHTML = options.title;
|
|
63
|
-
button.appendChild(button_text)
|
|
64
|
-
let barrow = document.createElement('tree_view_button_arrow')
|
|
65
|
-
barrow.style.marginLeft = 'auto'
|
|
66
|
-
barrow.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN).getHTML();
|
|
67
|
-
button.appendChild(barrow)
|
|
68
|
-
let html = document.createElement('tree_view_html')
|
|
69
|
-
if (options.subButtons !== undefined) {
|
|
70
|
-
options.subButtons.forEach(sub => {
|
|
71
|
-
html.appendChild(sub.button)
|
|
72
|
-
if (sub.panel !== undefined) {
|
|
73
|
-
html.appendChild(sub.panel)
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
if (options.components !== undefined) {
|
|
78
|
-
options.components.forEach(sub => {
|
|
79
|
-
html.appendChild(sub.set())
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
panel.appendChild(html)
|
|
83
|
-
return {
|
|
84
|
-
title: options.title,
|
|
85
|
-
button: button,
|
|
86
|
-
panel: panel
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
1
|
+
const {Icon, Icons} = require("../chui_icons/icons");
|
|
2
|
+
|
|
3
|
+
class TreeView {
|
|
4
|
+
#chui_tree_view = document.createElement(`chui_tree_view`);
|
|
5
|
+
constructor(options = { width: String(), components: [] }) {
|
|
6
|
+
require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_TreeView');
|
|
7
|
+
let main_test = document.createElement(`chui_tree_view_main_test`);
|
|
8
|
+
if (options.width !== undefined) {
|
|
9
|
+
this.#chui_tree_view.style.width = options.width;
|
|
10
|
+
} else {
|
|
11
|
+
this.#chui_tree_view.style.width = 'max-content'
|
|
12
|
+
}
|
|
13
|
+
options.components.forEach(buttons => {
|
|
14
|
+
main_test.appendChild(buttons.button)
|
|
15
|
+
if (buttons.panel !== undefined) {
|
|
16
|
+
main_test.appendChild(buttons.panel)
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
this.#chui_tree_view.appendChild(main_test)
|
|
20
|
+
}
|
|
21
|
+
set() {
|
|
22
|
+
return this.#chui_tree_view;
|
|
23
|
+
}
|
|
24
|
+
static Button(options = { title: String(), listener: () => {} }) {
|
|
25
|
+
let button = document.createElement('tree_view_button');
|
|
26
|
+
button.addEventListener("click", options.listener);
|
|
27
|
+
let button_text = document.createElement('tree_view_button_text');
|
|
28
|
+
button_text.innerHTML = options.title;
|
|
29
|
+
button.appendChild(button_text)
|
|
30
|
+
return {
|
|
31
|
+
title: options.title,
|
|
32
|
+
button: button
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
static ExpandButton(options = { title: String(), subButtons: [], components: [] }) {
|
|
36
|
+
let button = document.createElement('tree_view_button');
|
|
37
|
+
let panel = document.createElement('tree_view_panel')
|
|
38
|
+
button.addEventListener('click', (e) => {
|
|
39
|
+
button.classList.toggle('tree_view_button_active')
|
|
40
|
+
let panel = button.nextElementSibling;
|
|
41
|
+
if (panel.style.maxHeight) {
|
|
42
|
+
panel.style.maxHeight = panel.scrollHeight + "px";
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
button.children[1].children[0].style.transform = 'rotate(0deg)';
|
|
45
|
+
panel.style.maxHeight = null;
|
|
46
|
+
button.style.borderBottomLeftRadius = 'var(--border_radius)';
|
|
47
|
+
button.style.borderBottomRightRadius = 'var(--border_radius)';
|
|
48
|
+
}, 1);
|
|
49
|
+
} else {
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
button.children[1].children[0].style.transform = 'rotate(180deg)';
|
|
52
|
+
button.style.borderBottomLeftRadius = '0px';
|
|
53
|
+
button.style.borderBottomRightRadius = '0px';
|
|
54
|
+
panel.style.maxHeight = panel.scrollHeight + "px";
|
|
55
|
+
panel.addEventListener('transitionend', () => {
|
|
56
|
+
if (panel.style.maxHeight) panel.style.maxHeight = "max-content";
|
|
57
|
+
});
|
|
58
|
+
}, 1);
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
let button_text = document.createElement('tree_view_button_text');
|
|
62
|
+
button_text.innerHTML = options.title;
|
|
63
|
+
button.appendChild(button_text)
|
|
64
|
+
let barrow = document.createElement('tree_view_button_arrow')
|
|
65
|
+
barrow.style.marginLeft = 'auto'
|
|
66
|
+
barrow.innerHTML = new Icon(Icons.HARDWARE.KEYBOARD_ARROW_DOWN).getHTML();
|
|
67
|
+
button.appendChild(barrow)
|
|
68
|
+
let html = document.createElement('tree_view_html')
|
|
69
|
+
if (options.subButtons !== undefined) {
|
|
70
|
+
options.subButtons.forEach(sub => {
|
|
71
|
+
html.appendChild(sub.button)
|
|
72
|
+
if (sub.panel !== undefined) {
|
|
73
|
+
html.appendChild(sub.panel)
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
if (options.components !== undefined) {
|
|
78
|
+
options.components.forEach(sub => {
|
|
79
|
+
html.appendChild(sub.set())
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
panel.appendChild(html)
|
|
83
|
+
return {
|
|
84
|
+
title: options.title,
|
|
85
|
+
button: button,
|
|
86
|
+
panel: panel
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
91
|
exports.TreeView = TreeView
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
chui_webview {
|
|
2
|
-
position: relative;
|
|
3
|
-
width: -webkit-fill-available;
|
|
4
|
-
height: 100%
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
chui_load {
|
|
8
|
-
display: flex;
|
|
9
|
-
width: -webkit-fill-available;
|
|
10
|
-
height: 100%;
|
|
11
|
-
position: absolute;
|
|
12
|
-
top: 0;
|
|
13
|
-
left: 0;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
align-items: center;
|
|
16
|
-
z-index: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
webview {
|
|
20
|
-
height: 100%;
|
|
21
|
-
width: -webkit-fill-available;
|
|
22
|
-
display: none;
|
|
23
|
-
z-index: 1;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
webview.hide {
|
|
27
|
-
visibility: hidden;
|
|
1
|
+
chui_webview {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: -webkit-fill-available;
|
|
4
|
+
height: 100%
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
chui_load {
|
|
8
|
+
display: flex;
|
|
9
|
+
width: -webkit-fill-available;
|
|
10
|
+
height: 100%;
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: 0;
|
|
13
|
+
left: 0;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
align-items: center;
|
|
16
|
+
z-index: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
webview {
|
|
20
|
+
height: 100%;
|
|
21
|
+
width: -webkit-fill-available;
|
|
22
|
+
display: none;
|
|
23
|
+
z-index: 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
webview.hide {
|
|
27
|
+
visibility: hidden;
|
|
28
28
|
}
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
const { Animation } = require('../../modules/chui_animations/animations')
|
|
2
|
-
const { Spinner } = require('../chui_spinner/spinner')
|
|
3
|
-
const {Log} = require("../../../framework/modules/chui_logger/chui_logger");
|
|
4
|
-
|
|
5
|
-
class WebView {
|
|
6
|
-
#id = require("randomstring").generate()
|
|
7
|
-
#main_block = document.createElement('chui_webview')
|
|
8
|
-
#WebView = document.createElement('webview')
|
|
9
|
-
#chui_load = document.createElement('chui_load')
|
|
10
|
-
constructor(url = String(), dev = false) {
|
|
11
|
-
require('../../modules/chui_functions').setStyles(__dirname + '/styles.css', 'chUiJS_WebView');
|
|
12
|
-
this.#WebView.setAttribute('id', this.#id)
|
|
13
|
-
this.#WebView.setAttribute('src', url)
|
|
14
|
-
this.#WebView.setAttribute('nodeintegration', 'true');
|
|
15
|
-
this.#WebView.setAttribute('plugins', 'true')
|
|
16
|
-
this.#WebView.setAttribute('useragent', getFirefoxUserAgent())
|
|
17
|
-
this.#WebView.setAttribute('disablewebsecurity', 'true')
|
|
18
|
-
this.#WebView.setAttribute('allowpopups', 'true')
|
|
19
|
-
this.#WebView.setAttribute("webpreferences", "allowRunningInsecureContent, javascript=yes")
|
|
20
|
-
let spinner = new Spinner(Spinner.SIZE.BIG);
|
|
21
|
-
this.#chui_load.appendChild(spinner.set());
|
|
22
|
-
this.#main_block.appendChild(this.#WebView)
|
|
23
|
-
const loadStart = () => {
|
|
24
|
-
this.#main_block.appendChild(this.#chui_load)
|
|
25
|
-
}
|
|
26
|
-
const loadStop = () => {
|
|
27
|
-
new Animation(this.#WebView).fadeIn();
|
|
28
|
-
this.#main_block.removeChild(this.#chui_load)
|
|
29
|
-
if (dev) this.#WebView.openDevTools();
|
|
30
|
-
}
|
|
31
|
-
this.#WebView.addEventListener('did-start-loading', loadStart)
|
|
32
|
-
this.#WebView.addEventListener('did-stop-loading', loadStop)
|
|
33
|
-
}
|
|
34
|
-
setPartition(partition = String()) {
|
|
35
|
-
this.#WebView.partition = partition;
|
|
36
|
-
}
|
|
37
|
-
setPreload(path = String()) {
|
|
38
|
-
this.#WebView.preload = "file://" + path;
|
|
39
|
-
}
|
|
40
|
-
addStartLoadEvent(listener = () => {}) {
|
|
41
|
-
this.#WebView.addEventListener('did-start-loading', listener)
|
|
42
|
-
}
|
|
43
|
-
addStopLoadEvent(listener = () => {}) {
|
|
44
|
-
this.#WebView.addEventListener('did-stop-loading', listener)
|
|
45
|
-
}
|
|
46
|
-
addFinishLoadEvent(listener = () => {}) {
|
|
47
|
-
this.#WebView.addEventListener('did-finish-load', listener)
|
|
48
|
-
}
|
|
49
|
-
async executeJavaScript(code = String()) {
|
|
50
|
-
try {
|
|
51
|
-
await this.#WebView.executeJavaScript(code);
|
|
52
|
-
} catch (err) {
|
|
53
|
-
Log.error(err)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
insertCustomRes(options = { cssPath: String(), jsPath: String() }) {
|
|
57
|
-
this.#WebView.addEventListener('did-frame-finish-load', async () => {
|
|
58
|
-
const fs = require('fs');
|
|
59
|
-
if (options.cssPath !== undefined) {
|
|
60
|
-
let data = fs.readFileSync(options.cssPath, 'utf8');
|
|
61
|
-
this.#WebView.insertCSS(String(data)).catch(r => Log.error(r));
|
|
62
|
-
}
|
|
63
|
-
if (options.jsPath !== undefined) {
|
|
64
|
-
try {
|
|
65
|
-
const data = fs.readFileSync(options.jsPath, 'utf8');
|
|
66
|
-
await this.#WebView.executeJavaScript(data);
|
|
67
|
-
} catch (err) {
|
|
68
|
-
Log.error(err);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
async send(channel = String(), ...args) {
|
|
74
|
-
await this.#WebView.send(channel, args)
|
|
75
|
-
}
|
|
76
|
-
setUrl(url = String()) {
|
|
77
|
-
this.#WebView.setAttribute('src', url)
|
|
78
|
-
}
|
|
79
|
-
getWebContentsId() {
|
|
80
|
-
return this.#WebView.getWebContentsId()
|
|
81
|
-
}
|
|
82
|
-
set() {
|
|
83
|
-
return this.#main_block
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const getFirefoxUserAgent = () => {
|
|
88
|
-
const rootUAs = {
|
|
89
|
-
mac: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:FXVERSION.0) Gecko/20100101 Firefox/FXVERSION.0',
|
|
90
|
-
windows: 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:FXVERSION.0) Gecko/20100101 Firefox/FXVERSION.0',
|
|
91
|
-
linux: 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:FXVERSION.0) Gecko/20100101 Firefox/FXVERSION.0',
|
|
92
|
-
};
|
|
93
|
-
let rootUA;
|
|
94
|
-
if (process.platform === 'win32') {
|
|
95
|
-
rootUA = rootUAs.windows;
|
|
96
|
-
} else if (process.platform === 'darwin') {
|
|
97
|
-
rootUA = rootUAs.mac;
|
|
98
|
-
} else {
|
|
99
|
-
rootUA = rootUAs.linux;
|
|
100
|
-
}
|
|
101
|
-
return rootUA.replace(/FXVERSION/g, 91 + Math.floor((Date.now() - 1628553600000) / (4.1 * 7 * 24 * 60 * 60 * 1000)));
|
|
102
|
-
};
|
|
103
|
-
|
|
1
|
+
const { Animation } = require('../../modules/chui_animations/animations')
|
|
2
|
+
const { Spinner } = require('../chui_spinner/spinner')
|
|
3
|
+
const {Log} = require("../../../framework/modules/chui_logger/chui_logger");
|
|
4
|
+
|
|
5
|
+
class WebView {
|
|
6
|
+
#id = require("randomstring").generate()
|
|
7
|
+
#main_block = document.createElement('chui_webview')
|
|
8
|
+
#WebView = document.createElement('webview')
|
|
9
|
+
#chui_load = document.createElement('chui_load')
|
|
10
|
+
constructor(url = String(), dev = false) {
|
|
11
|
+
require('../../modules/chui_functions').setStyles(__dirname + '/styles.css', 'chUiJS_WebView');
|
|
12
|
+
this.#WebView.setAttribute('id', this.#id)
|
|
13
|
+
this.#WebView.setAttribute('src', url)
|
|
14
|
+
this.#WebView.setAttribute('nodeintegration', 'true');
|
|
15
|
+
this.#WebView.setAttribute('plugins', 'true')
|
|
16
|
+
this.#WebView.setAttribute('useragent', getFirefoxUserAgent())
|
|
17
|
+
this.#WebView.setAttribute('disablewebsecurity', 'true')
|
|
18
|
+
this.#WebView.setAttribute('allowpopups', 'true')
|
|
19
|
+
this.#WebView.setAttribute("webpreferences", "allowRunningInsecureContent, javascript=yes")
|
|
20
|
+
let spinner = new Spinner(Spinner.SIZE.BIG);
|
|
21
|
+
this.#chui_load.appendChild(spinner.set());
|
|
22
|
+
this.#main_block.appendChild(this.#WebView)
|
|
23
|
+
const loadStart = () => {
|
|
24
|
+
this.#main_block.appendChild(this.#chui_load)
|
|
25
|
+
}
|
|
26
|
+
const loadStop = () => {
|
|
27
|
+
new Animation(this.#WebView).fadeIn();
|
|
28
|
+
this.#main_block.removeChild(this.#chui_load)
|
|
29
|
+
if (dev) this.#WebView.openDevTools();
|
|
30
|
+
}
|
|
31
|
+
this.#WebView.addEventListener('did-start-loading', loadStart)
|
|
32
|
+
this.#WebView.addEventListener('did-stop-loading', loadStop)
|
|
33
|
+
}
|
|
34
|
+
setPartition(partition = String()) {
|
|
35
|
+
this.#WebView.partition = partition;
|
|
36
|
+
}
|
|
37
|
+
setPreload(path = String()) {
|
|
38
|
+
this.#WebView.preload = "file://" + path;
|
|
39
|
+
}
|
|
40
|
+
addStartLoadEvent(listener = () => {}) {
|
|
41
|
+
this.#WebView.addEventListener('did-start-loading', listener)
|
|
42
|
+
}
|
|
43
|
+
addStopLoadEvent(listener = () => {}) {
|
|
44
|
+
this.#WebView.addEventListener('did-stop-loading', listener)
|
|
45
|
+
}
|
|
46
|
+
addFinishLoadEvent(listener = () => {}) {
|
|
47
|
+
this.#WebView.addEventListener('did-finish-load', listener)
|
|
48
|
+
}
|
|
49
|
+
async executeJavaScript(code = String()) {
|
|
50
|
+
try {
|
|
51
|
+
await this.#WebView.executeJavaScript(code);
|
|
52
|
+
} catch (err) {
|
|
53
|
+
Log.error(err)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
insertCustomRes(options = { cssPath: String(), jsPath: String() }) {
|
|
57
|
+
this.#WebView.addEventListener('did-frame-finish-load', async () => {
|
|
58
|
+
const fs = require('fs');
|
|
59
|
+
if (options.cssPath !== undefined) {
|
|
60
|
+
let data = fs.readFileSync(options.cssPath, 'utf8');
|
|
61
|
+
this.#WebView.insertCSS(String(data)).catch(r => Log.error(r));
|
|
62
|
+
}
|
|
63
|
+
if (options.jsPath !== undefined) {
|
|
64
|
+
try {
|
|
65
|
+
const data = fs.readFileSync(options.jsPath, 'utf8');
|
|
66
|
+
await this.#WebView.executeJavaScript(data);
|
|
67
|
+
} catch (err) {
|
|
68
|
+
Log.error(err);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
async send(channel = String(), ...args) {
|
|
74
|
+
await this.#WebView.send(channel, args)
|
|
75
|
+
}
|
|
76
|
+
setUrl(url = String()) {
|
|
77
|
+
this.#WebView.setAttribute('src', url)
|
|
78
|
+
}
|
|
79
|
+
getWebContentsId() {
|
|
80
|
+
return this.#WebView.getWebContentsId()
|
|
81
|
+
}
|
|
82
|
+
set() {
|
|
83
|
+
return this.#main_block
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const getFirefoxUserAgent = () => {
|
|
88
|
+
const rootUAs = {
|
|
89
|
+
mac: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:FXVERSION.0) Gecko/20100101 Firefox/FXVERSION.0',
|
|
90
|
+
windows: 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:FXVERSION.0) Gecko/20100101 Firefox/FXVERSION.0',
|
|
91
|
+
linux: 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:FXVERSION.0) Gecko/20100101 Firefox/FXVERSION.0',
|
|
92
|
+
};
|
|
93
|
+
let rootUA;
|
|
94
|
+
if (process.platform === 'win32') {
|
|
95
|
+
rootUA = rootUAs.windows;
|
|
96
|
+
} else if (process.platform === 'darwin') {
|
|
97
|
+
rootUA = rootUAs.mac;
|
|
98
|
+
} else {
|
|
99
|
+
rootUA = rootUAs.linux;
|
|
100
|
+
}
|
|
101
|
+
return rootUA.replace(/FXVERSION/g, 91 + Math.floor((Date.now() - 1628553600000) / (4.1 * 7 * 24 * 60 * 60 * 1000)));
|
|
102
|
+
};
|
|
103
|
+
|
|
104
104
|
exports.WebView = WebView
|