chuijs 3.6.3 → 3.6.5

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.
Files changed (119) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1203 -162
  3. package/framework/appLayout/default/chui_app_layout.js +747 -747
  4. package/framework/appLayout/default/global_style.css +615 -570
  5. package/framework/appLayout/default/main_theme_style.css +124 -101
  6. package/framework/components/chui_accordion/accordion.js +63 -63
  7. package/framework/components/chui_accordion/styles.css +79 -75
  8. package/framework/components/chui_badge/badge.js +55 -55
  9. package/framework/components/chui_badge/styles.css +29 -29
  10. package/framework/components/chui_button/button.js +48 -48
  11. package/framework/components/chui_button/styles.css +75 -70
  12. package/framework/components/chui_calendar/calendar.js +97 -97
  13. package/framework/components/chui_card/card.js +87 -0
  14. package/framework/components/chui_card/styles.css +72 -0
  15. package/framework/components/chui_code/code.js +18 -18
  16. package/framework/components/chui_code/styles.css +9 -9
  17. package/framework/components/chui_console/console.js +27 -27
  18. package/framework/components/chui_console/styles.css +31 -31
  19. package/framework/components/chui_content_block/content_block.js +51 -51
  20. package/framework/components/chui_content_block/styles.css +2 -2
  21. package/framework/components/chui_context_menu/context_menu.js +230 -0
  22. package/framework/components/chui_context_menu/styles.css +136 -0
  23. package/framework/components/chui_custom_element/custom_element.js +24 -24
  24. package/framework/components/chui_details/details.js +85 -85
  25. package/framework/components/chui_details/styles.css +70 -66
  26. package/framework/components/chui_fieldset/fieldset.js +40 -40
  27. package/framework/components/chui_fieldset/styles.css +24 -24
  28. package/framework/components/chui_form/form.js +40 -40
  29. package/framework/components/chui_form/styles.css +21 -21
  30. package/framework/components/chui_graphs/graphs.js +234 -190
  31. package/framework/components/chui_graphs/styles.css +37 -32
  32. package/framework/components/chui_hero/hero.js +98 -0
  33. package/framework/components/chui_hero/styles.css +91 -0
  34. package/framework/components/chui_html_block/html_block.js +16 -16
  35. package/framework/components/chui_html_block/styles.css +5 -5
  36. package/framework/components/chui_hx/hx.js +15 -15
  37. package/framework/components/chui_hx/styles.css +38 -38
  38. package/framework/components/chui_icons/icons.js +2144 -2144
  39. package/framework/components/chui_icons/styles.css +13 -13
  40. package/framework/components/chui_inputs/chui_check_box/check_box.js +32 -32
  41. package/framework/components/chui_inputs/chui_check_box/styles.css +91 -86
  42. package/framework/components/chui_inputs/chui_combo_box/combo_box.js +166 -150
  43. package/framework/components/chui_inputs/chui_combo_box/styles.css +113 -107
  44. package/framework/components/chui_inputs/chui_date/date.js +177 -174
  45. package/framework/components/chui_inputs/chui_date/styles.css +163 -128
  46. package/framework/components/chui_inputs/chui_email/email.js +61 -61
  47. package/framework/components/chui_inputs/chui_email/styles.css +69 -71
  48. package/framework/components/chui_inputs/chui_file/file.js +76 -76
  49. package/framework/components/chui_inputs/chui_file/styles.css +99 -99
  50. package/framework/components/chui_inputs/chui_multi_combo_box/multi_combo_box.js +300 -295
  51. package/framework/components/chui_inputs/chui_multi_combo_box/styles.css +227 -235
  52. package/framework/components/chui_inputs/chui_number/number.js +108 -108
  53. package/framework/components/chui_inputs/chui_number/styles.css +84 -84
  54. package/framework/components/chui_inputs/chui_password/password.js +99 -99
  55. package/framework/components/chui_inputs/chui_password/styles.css +97 -97
  56. package/framework/components/chui_inputs/chui_radio_button/radio_button.js +45 -45
  57. package/framework/components/chui_inputs/chui_radio_button/styles.css +76 -73
  58. package/framework/components/chui_inputs/chui_select_box/select_box.js +187 -170
  59. package/framework/components/chui_inputs/chui_select_box/styles.css +123 -117
  60. package/framework/components/chui_inputs/chui_text/styles.css +83 -84
  61. package/framework/components/chui_inputs/chui_text/text.js +91 -91
  62. package/framework/components/chui_inputs/chui_text_area/styles.css +57 -57
  63. package/framework/components/chui_inputs/chui_text_area/text_area.js +61 -61
  64. package/framework/components/chui_inputs/chui_toggle/styles.css +66 -61
  65. package/framework/components/chui_inputs/chui_toggle/toggle.js +36 -36
  66. package/framework/components/chui_label/label.js +54 -54
  67. package/framework/components/chui_label/styles.css +11 -11
  68. package/framework/components/chui_media/audio.js +908 -908
  69. package/framework/components/chui_media/audio_styles.css +458 -458
  70. package/framework/components/chui_media/image.js +105 -105
  71. package/framework/components/chui_media/image_styles.css +61 -61
  72. package/framework/components/chui_media/video.js +248 -248
  73. package/framework/components/chui_media/video_styles.css +160 -160
  74. package/framework/components/chui_menu_bar/menu_bar.js +66 -74
  75. package/framework/components/chui_menu_bar/styles.css +114 -76
  76. package/framework/components/chui_modal/modal.js +142 -135
  77. package/framework/components/chui_modal/styles.css +36 -36
  78. package/framework/components/chui_notification/notification.js +72 -72
  79. package/framework/components/chui_notification/notification_download.js +78 -78
  80. package/framework/components/chui_notification/notification_download_progress.css +119 -123
  81. package/framework/components/chui_notification/notification_download_progress.js +105 -105
  82. package/framework/components/chui_notification/notification_update.js +54 -54
  83. package/framework/components/chui_notification/styles.css +91 -91
  84. package/framework/components/chui_notification/styles_download.css +85 -85
  85. package/framework/components/chui_notification/styles_update.css +73 -73
  86. package/framework/components/chui_paragraph/paragraph.js +14 -14
  87. package/framework/components/chui_paragraph/styles.css +6 -6
  88. package/framework/components/chui_popups/popups.js +250 -250
  89. package/framework/components/chui_popups/styles.css +100 -115
  90. package/framework/components/chui_progress_bar/progress_bar.js +28 -28
  91. package/framework/components/chui_progress_bar/styles.css +28 -28
  92. package/framework/components/chui_radio_group/radio_group.js +57 -57
  93. package/framework/components/chui_radio_group/styles.css +3 -3
  94. package/framework/components/chui_slideshow/slideshow.js +75 -75
  95. package/framework/components/chui_slideshow/styles.css +94 -85
  96. package/framework/components/chui_spinner/spinner.js +45 -45
  97. package/framework/components/chui_spinner/styles.css +23 -23
  98. package/framework/components/chui_table/styles.css +42 -42
  99. package/framework/components/chui_table/table.js +234 -234
  100. package/framework/components/chui_tabs/chui_tabs.js +77 -77
  101. package/framework/components/chui_tabs/styles.css +54 -48
  102. package/framework/components/chui_text_editor/styles.css +217 -217
  103. package/framework/components/chui_text_editor/text_editor.js +144 -144
  104. package/framework/components/chui_text_editor/text_editor_panel.js +568 -568
  105. package/framework/components/chui_tree_view/styles.css +81 -75
  106. package/framework/components/chui_tree_view/tree_view.js +90 -90
  107. package/framework/components/chui_webview/styles.css +27 -27
  108. package/framework/components/chui_webview/webview.js +103 -103
  109. package/framework/components/telegram_bot/chui_telegram_bot.js +183 -183
  110. package/framework/modules/chui_animations/animations.js +121 -121
  111. package/framework/modules/chui_animations/styles.css +79 -79
  112. package/framework/modules/chui_fonts.js +7128 -7128
  113. package/framework/modules/chui_functions.js +106 -78
  114. package/framework/modules/chui_logger/chui_logger.js +53 -53
  115. package/framework/modules/chui_page/page.js +86 -86
  116. package/framework/modules/chui_page/styles.css +9 -9
  117. package/framework/tray_bar/chui_menu_items.js +48 -48
  118. package/index.js +570 -555
  119. package/package.json +51 -46
@@ -1,116 +1,101 @@
1
- chui_popup {
2
- display: none;
3
- position: fixed;
4
- z-index: 1000;
5
- left: 0;
6
- top: 0;
7
- width: 100%;
8
- height: 100%;
9
- overflow: auto;
10
- background-color: var(--header_background);
11
- padding: 0;
12
- border: none;
13
- backdrop-filter: var(--global_blur);
14
- }
15
-
16
- popup_content {
17
- margin: 60px auto;
18
- width: 325px;
19
- height: max-content;
20
- display: flex;
21
- flex-direction: column;
22
- border-radius: var(--border_radius);
23
- color: var(--text_color);
24
- background: var(--main_background);
25
- box-shadow: 0 2px 10px 2px rgb(0 0 0 / 25%);
26
- border: none;
27
- }
28
-
29
- popup_body {
30
- padding: 10px;
31
- display: flex;
32
- height: -webkit-fill-available;
33
- width: -webkit-fill-available;
34
- overflow: auto;
35
- flex-direction: column;
36
- justify-content: center;
37
- align-items: center;
38
- }
39
-
40
- popup_buttons {
41
- display: flex;
42
- flex-direction: row;
43
- justify-content: center;
44
- align-items: center;
45
- padding: 8px;
46
- }
47
-
48
- popup_title {
49
- display: block;
50
- text-align: center;
51
- font-size: var(--font_default_size);
52
- font-weight: 500;
53
- padding: 6px;
54
- }
55
-
56
- popup_message {
57
- display: block;
58
- text-align: center;
59
- font-size: var(--font_labels_size);
60
- font-weight: 500;
61
- padding: 6px;
62
- }
63
- /* ALERT */
64
- popup_button_ok {
65
- display: flex;
66
- flex-direction: row;
67
- justify-content: center;
68
- align-items: center;
69
- width: -webkit-fill-available;
70
- padding: 10px;
71
- border-radius: var(--border_radius);
72
- color: var(--text_color);
73
- font-weight: 500;
74
- font-size: var(--font_default_size);
75
- }
76
-
77
- popup_button_ok:hover {
78
- color: var(--text_color_hover);
79
- background: var(--blue_prime_background);
80
- }
81
- /* CONFIRM */
82
- popup_button_accept {
83
- display: flex;
84
- flex-direction: row;
85
- justify-content: center;
86
- align-items: center;
87
- width: -webkit-fill-available;
88
- padding: 10px;
89
- border-radius: var(--border_radius);
90
- color: var(--text_color);
91
- font-weight: 500;
92
- font-size: var(--font_default_size);
93
- }
94
-
95
- popup_button_accept:hover {
96
- color: var(--text_color_hover);
97
- background: var(--blue_prime_background);
98
- }
99
-
100
- popup_button_cancel {
101
- display: flex;
102
- flex-direction: row;
103
- justify-content: center;
104
- align-items: center;
105
- width: -webkit-fill-available;
106
- padding: 10px;
107
- border-radius: var(--border_radius);
108
- color: var(--text_color);
109
- font-weight: 500;
110
- font-size: var(--font_default_size);
111
- }
112
-
113
- popup_button_cancel:hover {
114
- color: var(--text_color_hover);
115
- background: var(--red_prime_background);
1
+ chui_popup {
2
+ display: none;
3
+ position: fixed;
4
+ z-index: 1000;
5
+ left: 0;
6
+ top: 0;
7
+ width: 100%;
8
+ height: 100%;
9
+ overflow: auto;
10
+ background-color: var(--modal_scrim);
11
+ padding: 0;
12
+ border: none;
13
+ backdrop-filter: var(--global_blur);
14
+ }
15
+
16
+ popup_content {
17
+ margin: 60px auto;
18
+ width: 325px;
19
+ max-width: calc(100% - (var(--margin) * 2));
20
+ height: max-content;
21
+ display: flex;
22
+ flex-direction: column;
23
+ border-radius: var(--radius_md);
24
+ color: var(--text_color);
25
+ background: var(--modal_background);
26
+ box-shadow: var(--box_shadow_modal);
27
+ border: 1px solid var(--border_color);
28
+ backdrop-filter: var(--global_blur);
29
+ }
30
+
31
+ popup_body {
32
+ padding: var(--test_padding);
33
+ display: flex;
34
+ height: -webkit-fill-available;
35
+ width: -webkit-fill-available;
36
+ overflow: auto;
37
+ flex-direction: column;
38
+ justify-content: center;
39
+ /* stretch, а не center: поле ввода в prompt заполняет карточку,
40
+ а центрирование текста задаётся через text-align у title/message */
41
+ align-items: stretch;
42
+ }
43
+
44
+ popup_buttons {
45
+ display: flex;
46
+ flex-direction: row;
47
+ justify-content: center;
48
+ align-items: center;
49
+ padding: var(--test_padding);
50
+ }
51
+
52
+ popup_title {
53
+ display: block;
54
+ text-align: center;
55
+ font-size: var(--font_default_size);
56
+ font-weight: 500;
57
+ padding: var(--margin);
58
+ }
59
+
60
+ popup_message {
61
+ display: block;
62
+ text-align: center;
63
+ font-size: var(--font_labels_size);
64
+ font-weight: 400;
65
+ padding: var(--margin);
66
+ }
67
+ /* Кнопки — как .chui_button: заполненный контрол с хайрлайном, но равной ширины */
68
+ popup_button_ok,
69
+ popup_button_accept,
70
+ popup_button_cancel {
71
+ cursor: pointer;
72
+ display: flex;
73
+ flex-direction: row;
74
+ justify-content: center;
75
+ align-items: center;
76
+ width: -webkit-fill-available;
77
+ padding: var(--main_padding);
78
+ margin: var(--margin);
79
+ border-radius: var(--border_radius);
80
+ background: var(--button_background);
81
+ border: 1px solid var(--button_border_color);
82
+ color: var(--text_color);
83
+ font-weight: 400;
84
+ font-size: var(--font_default_size);
85
+ }
86
+
87
+ popup_button_ok:hover,
88
+ popup_button_accept:hover,
89
+ popup_button_cancel:hover {
90
+ background: var(--button_background_hover);
91
+ border: 1px solid var(--button_border_color_hover);
92
+ color: var(--text_color_hover);
93
+ }
94
+
95
+ popup_button_ok:active,
96
+ popup_button_accept:active,
97
+ popup_button_cancel:active {
98
+ background: var(--element_background_prime);
99
+ border: 1px solid var(--button_border_color_hover);
100
+ color: var(--text_color_hover);
116
101
  }
@@ -1,29 +1,29 @@
1
- class ProgressBar {
2
- #id = require("randomstring").generate();
3
- #ProgressBar = document.createElement(`progress`);
4
- #main = document.createElement("progress_block");
5
- #progress_count = document.createElement('progress_count');
6
- #progress_text = document.createElement('progress_text');
7
- constructor(options = { max: Number() }) {
8
- require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_ProgressBar');
9
- if (options.max !== undefined) this.#ProgressBar.max = options.max;
10
- this.#ProgressBar.id = this.#id;
11
- this.#progress_count.setAttribute('for', this.#id);
12
- this.#progress_text.setAttribute('for', this.#id);
13
- this.#progress_text.style.width = '-webkit-fill-available';
14
- this.#progress_text.style.display = 'block';
15
- this.#progress_text.style.margin = '0px 10px';
16
- this.#progress_text.style.textAlign = 'initial';
17
- this.#main.appendChild(this.#progress_count)
18
- this.#main.appendChild(this.#ProgressBar)
19
- this.#main.appendChild(this.#progress_text)
20
- }
21
- setMax(max = Number()) { this.#ProgressBar.max = max; }
22
- setWidth(width = String()) { this.#main.style.width = width; }
23
- setProgressCountText(text = String()) { this.#progress_count.innerText = text; }
24
- setValue(value = Number()) { this.#ProgressBar.value = value; }
25
- setProgressText(text = String()) { this.#progress_text.innerText = text; }
26
- set() { return this.#main; }
27
- }
28
-
1
+ class ProgressBar {
2
+ #id = require("randomstring").generate();
3
+ #ProgressBar = document.createElement(`progress`);
4
+ #main = document.createElement("progress_block");
5
+ #progress_count = document.createElement('progress_count');
6
+ #progress_text = document.createElement('progress_text');
7
+ constructor(options = { max: Number() }) {
8
+ require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_ProgressBar');
9
+ if (options.max !== undefined) this.#ProgressBar.max = options.max;
10
+ this.#ProgressBar.id = this.#id;
11
+ this.#progress_count.setAttribute('for', this.#id);
12
+ this.#progress_text.setAttribute('for', this.#id);
13
+ this.#progress_text.style.width = '-webkit-fill-available';
14
+ this.#progress_text.style.display = 'block';
15
+ this.#progress_text.style.margin = '0px 10px';
16
+ this.#progress_text.style.textAlign = 'initial';
17
+ this.#main.appendChild(this.#progress_count)
18
+ this.#main.appendChild(this.#ProgressBar)
19
+ this.#main.appendChild(this.#progress_text)
20
+ }
21
+ setMax(max = Number()) { this.#ProgressBar.max = max; }
22
+ setWidth(width = String()) { this.#main.style.width = width; }
23
+ setProgressCountText(text = String()) { this.#progress_count.innerText = text; }
24
+ setValue(value = Number()) { this.#ProgressBar.value = value; }
25
+ setProgressText(text = String()) { this.#progress_text.innerText = text; }
26
+ set() { return this.#main; }
27
+ }
28
+
29
29
  exports.ProgressBar = ProgressBar
@@ -1,29 +1,29 @@
1
- progress_block {
2
- width: max-content;
3
- height: max-content;
4
- margin: var(--margin);
5
- font-size: var(--font_labels_size);
6
- color: var(--text_color);
7
- text-align: center;
8
- font-weight: 500
9
- }
10
-
11
- progress {
12
- border-radius: 50px;
13
- text-align: start;
14
- margin: var(--margin);
15
- width: -webkit-fill-available;
16
- height: 15px;
17
- border: none;
18
- }
19
-
20
- progress::-webkit-progress-bar {
21
- background: var(--element_background);
22
- border-radius: 50px;
23
- border: none;
24
- }
25
-
26
- progress::-webkit-progress-value {
27
- background: var(--blue_prime_background);
28
- border-radius: 50px;
1
+ progress_block {
2
+ width: max-content;
3
+ height: max-content;
4
+ margin: var(--margin);
5
+ font-size: var(--font_labels_size);
6
+ color: var(--text_color);
7
+ text-align: center;
8
+ font-weight: 500
9
+ }
10
+
11
+ progress {
12
+ border-radius: var(--radius_pill);
13
+ text-align: start;
14
+ margin: var(--margin);
15
+ width: -webkit-fill-available;
16
+ height: 15px;
17
+ border: none;
18
+ }
19
+
20
+ progress::-webkit-progress-bar {
21
+ background: var(--element_background);
22
+ border-radius: var(--radius_pill);
23
+ border: none;
24
+ }
25
+
26
+ progress::-webkit-progress-value {
27
+ background: var(--blue_prime_background);
28
+ border-radius: var(--radius_pill);
29
29
  }
@@ -1,58 +1,58 @@
1
- const {RadioButton} = require("../chui_inputs/chui_radio_button/radio_button");
2
-
3
- class RadioGroup {
4
- #id = require("randomstring").generate();
5
- #name = require("randomstring").generate();
6
- #RadioGroup = document.createElement('chui_radio_group');
7
- #groupForm = document.createElement('form');
8
- //Стили
9
- #direction = undefined;
10
- #wrap = undefined;
11
- #align = undefined;
12
- #justify = undefined;
13
- #width = undefined;
14
- constructor(options = {
15
- styles: {
16
- direction: undefined,
17
- wrap: undefined,
18
- align: undefined,
19
- justify: undefined,
20
- width: undefined
21
- }
22
- }) {
23
- require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", "chUiJS_RadioGroup")
24
- this.#groupForm.classList.add('radioGroupForm')
25
- this.#direction = options.styles.direction;
26
- this.#wrap = options.styles.wrap;
27
- this.#align = options.styles.align;
28
- this.#justify = options.styles.justify;
29
- this.#width = options.styles.width;
30
- if (this.#width !== undefined) this.#RadioGroup.style.width = this.#width;
31
- if (this.#direction !== undefined) this.#groupForm.style.flexDirection = this.#direction;
32
- if (this.#wrap !== undefined) this.#groupForm.style.flexWrap = this.#wrap;
33
- if (this.#align !== undefined) this.#groupForm.style.alignItems = this.#align;
34
- if (this.#justify !== undefined) this.#groupForm.style.justifyContent = this.#justify;
35
- this.#RadioGroup.id = this.#id;
36
- this.#RadioGroup.appendChild(this.#groupForm)
37
- }
38
- addOptions(options = [{ name: String(), value: String() }]) {
39
- options.forEach(option => {
40
- const radio = new RadioButton({ title: option.name, stringValue: option.value, name: this.#name })
41
- this.#groupForm.appendChild(radio.set())
42
- })
43
- }
44
- addChangeListener(listener = () => {}) {
45
- this.#groupForm.addEventListener("change", listener)
46
- }
47
- clear() {
48
- for (let test of this.#groupForm.children) test.children.item(0).checked = false
49
- }
50
- getValue() {
51
- return new FormData(this.#groupForm).entries().next().value[1]
52
- }
53
- set() {
54
- return this.#RadioGroup;
55
- }
56
- }
57
-
1
+ const {RadioButton} = require("../chui_inputs/chui_radio_button/radio_button");
2
+
3
+ class RadioGroup {
4
+ #id = require("randomstring").generate();
5
+ #name = require("randomstring").generate();
6
+ #RadioGroup = document.createElement('chui_radio_group');
7
+ #groupForm = document.createElement('form');
8
+ //Стили
9
+ #direction = undefined;
10
+ #wrap = undefined;
11
+ #align = undefined;
12
+ #justify = undefined;
13
+ #width = undefined;
14
+ constructor(options = {
15
+ styles: {
16
+ direction: undefined,
17
+ wrap: undefined,
18
+ align: undefined,
19
+ justify: undefined,
20
+ width: undefined
21
+ }
22
+ }) {
23
+ require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", "chUiJS_RadioGroup")
24
+ this.#groupForm.classList.add('radioGroupForm')
25
+ this.#direction = options.styles.direction;
26
+ this.#wrap = options.styles.wrap;
27
+ this.#align = options.styles.align;
28
+ this.#justify = options.styles.justify;
29
+ this.#width = options.styles.width;
30
+ if (this.#width !== undefined) this.#RadioGroup.style.width = this.#width;
31
+ if (this.#direction !== undefined) this.#groupForm.style.flexDirection = this.#direction;
32
+ if (this.#wrap !== undefined) this.#groupForm.style.flexWrap = this.#wrap;
33
+ if (this.#align !== undefined) this.#groupForm.style.alignItems = this.#align;
34
+ if (this.#justify !== undefined) this.#groupForm.style.justifyContent = this.#justify;
35
+ this.#RadioGroup.id = this.#id;
36
+ this.#RadioGroup.appendChild(this.#groupForm)
37
+ }
38
+ addOptions(options = [{ name: String(), value: String() }]) {
39
+ options.forEach(option => {
40
+ const radio = new RadioButton({ title: option.name, stringValue: option.value, name: this.#name })
41
+ this.#groupForm.appendChild(radio.set())
42
+ })
43
+ }
44
+ addChangeListener(listener = () => {}) {
45
+ this.#groupForm.addEventListener("change", listener)
46
+ }
47
+ clear() {
48
+ for (let test of this.#groupForm.children) test.children.item(0).checked = false
49
+ }
50
+ getValue() {
51
+ return new FormData(this.#groupForm).entries().next().value[1]
52
+ }
53
+ set() {
54
+ return this.#RadioGroup;
55
+ }
56
+ }
57
+
58
58
  exports.RadioGroup = RadioGroup
@@ -1,4 +1,4 @@
1
- .radioGroupForm {
2
- display: flex;
3
- width: inherit;
1
+ .radioGroupForm {
2
+ display: flex;
3
+ width: inherit;
4
4
  }
@@ -1,76 +1,76 @@
1
- const {Icon, Icons} = require("../chui_icons/icons");
2
- const {Animation} = require("../../modules/chui_animations/animations");
3
-
4
- class SlideShow {
5
- #default_slide = 0;
6
- #chui_slides_main = document.createElement('chui_slides_main');
7
- //
8
- #chui_slides_list = document.createElement("chui_slides_list")
9
- #chui_next_slide = document.createElement('chui_next_slide');
10
- #chui_prev_slide = document.createElement('chui_prev_slide');
11
- //
12
- #slides_list = undefined;
13
- constructor(options = {
14
- width: String(), height: String(),
15
- autoplay: { status: Boolean(), interval: Number(10) },
16
- slides: []
17
- }) {
18
- require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_SlideShow');
19
- this.#chui_slides_main.style.width = options.width;
20
- this.#chui_slides_main.style.height = options.height;
21
-
22
- this.#slides_list = options.slides;
23
- this.#chui_next_slide.addEventListener("click", () => this.#changeSlide(1))
24
- this.#chui_prev_slide.addEventListener("click", () => this.#changeSlide(-1))
25
- this.#chui_slides_main.appendChild(this.#chui_slides_list);
26
- this.#chui_next_slide.appendChild(new Icon(Icons.CONTENT.REDO, "14pt", "var(--button_text_color)").set());
27
- this.#chui_prev_slide.appendChild(new Icon(Icons.CONTENT.UNDO, "14pt", "var(--button_text_color)").set());
28
- this.#chui_slides_main.appendChild(this.#chui_next_slide);
29
- this.#chui_slides_main.appendChild(this.#chui_prev_slide);
30
- if (options.autoplay.status) setInterval(() => this.#changeSlide(1), options.autoplay.interval * 1000);
31
- //
32
- let slide = this.#slides_list[0].set();
33
- slide.style.display = 'flex';
34
- this.#chui_slides_list.appendChild(slide)
35
- new Animation(slide).fadeIn()
36
- //
37
- }
38
- #changeSlide(n = Number()) {
39
- let sum_slides = this.#slides_list.length;
40
- this.#default_slide = this.#default_slide + n;
41
- if (this.#default_slide > (sum_slides - 1)) this.#default_slide = 0;
42
- if (this.#default_slide < 0) this.#default_slide = sum_slides - 1;
43
- for (let child of this.#chui_slides_list.childNodes) { this.#chui_slides_list.removeChild(child); }
44
- let slide = this.#slides_list[this.#default_slide].set();
45
- this.#chui_slides_list.appendChild(slide)
46
- slide.style.display = 'none';
47
- new Animation(slide).fadeIn()
48
- }
49
- set() {
50
- return this.#chui_slides_main;
51
- }
52
- static SLIDE(options = { width: String(), height: String(), components: [] }) {
53
- return new Slide(options)
54
- }
55
- }
56
- exports.SlideShow = SlideShow
57
-
58
- class Slide {
59
- #chui_slide = document.createElement('chui_slide');
60
- #chui_slide_content = document.createElement('chui_slide_content');
61
- constructor(options = {
62
- size: { width: String(), height: String() },
63
- style: { direction: String(), wrap: String(), align: String(), justify: String() },
64
- components: []
65
- }) {
66
- if (options.size.width !== undefined) this.#chui_slide_content.style.width = options.size.width;
67
- if (options.size.height !== undefined) this.#chui_slide_content.style.height = options.size.height;
68
- if (options.style.direction !== undefined) this.#chui_slide_content.style.flexDirection = options.style.direction;
69
- if (options.style.wrap !== undefined) this.#chui_slide_content.style.flexWrap = options.style.wrap;
70
- if (options.style.align !== undefined) this.#chui_slide_content.style.alignItems = options.style.align;
71
- if (options.style.justify !== undefined) this.#chui_slide_content.style.justifyContent = options.style.justify;
72
- for (let child of options.components) this.#chui_slide_content.appendChild(child.set())
73
- this.#chui_slide.appendChild(this.#chui_slide_content)
74
- }
75
- set() { return this.#chui_slide }
1
+ const {Icon, Icons} = require("../chui_icons/icons");
2
+ const {Animation} = require("../../modules/chui_animations/animations");
3
+
4
+ class SlideShow {
5
+ #default_slide = 0;
6
+ #chui_slides_main = document.createElement('chui_slides_main');
7
+ //
8
+ #chui_slides_list = document.createElement("chui_slides_list")
9
+ #chui_next_slide = document.createElement('chui_next_slide');
10
+ #chui_prev_slide = document.createElement('chui_prev_slide');
11
+ //
12
+ #slides_list = undefined;
13
+ constructor(options = {
14
+ width: String(), height: String(),
15
+ autoplay: { status: Boolean(), interval: Number(10) },
16
+ slides: []
17
+ }) {
18
+ require('../../modules/chui_functions').setStyles(__dirname + "/styles.css", 'chUiJS_SlideShow');
19
+ this.#chui_slides_main.style.width = options.width;
20
+ this.#chui_slides_main.style.height = options.height;
21
+
22
+ this.#slides_list = options.slides;
23
+ this.#chui_next_slide.addEventListener("click", () => this.#changeSlide(1))
24
+ this.#chui_prev_slide.addEventListener("click", () => this.#changeSlide(-1))
25
+ this.#chui_slides_main.appendChild(this.#chui_slides_list);
26
+ this.#chui_next_slide.appendChild(new Icon(Icons.CONTENT.REDO, "14pt", "var(--button_text_color)").set());
27
+ this.#chui_prev_slide.appendChild(new Icon(Icons.CONTENT.UNDO, "14pt", "var(--button_text_color)").set());
28
+ this.#chui_slides_main.appendChild(this.#chui_next_slide);
29
+ this.#chui_slides_main.appendChild(this.#chui_prev_slide);
30
+ if (options.autoplay.status) setInterval(() => this.#changeSlide(1), options.autoplay.interval * 1000);
31
+ //
32
+ let slide = this.#slides_list[0].set();
33
+ slide.style.display = 'flex';
34
+ this.#chui_slides_list.appendChild(slide)
35
+ new Animation(slide).fadeIn()
36
+ //
37
+ }
38
+ #changeSlide(n = Number()) {
39
+ let sum_slides = this.#slides_list.length;
40
+ this.#default_slide = this.#default_slide + n;
41
+ if (this.#default_slide > (sum_slides - 1)) this.#default_slide = 0;
42
+ if (this.#default_slide < 0) this.#default_slide = sum_slides - 1;
43
+ for (let child of this.#chui_slides_list.childNodes) { this.#chui_slides_list.removeChild(child); }
44
+ let slide = this.#slides_list[this.#default_slide].set();
45
+ this.#chui_slides_list.appendChild(slide)
46
+ slide.style.display = 'none';
47
+ new Animation(slide).fadeIn()
48
+ }
49
+ set() {
50
+ return this.#chui_slides_main;
51
+ }
52
+ static SLIDE(options = { width: String(), height: String(), components: [] }) {
53
+ return new Slide(options)
54
+ }
55
+ }
56
+ exports.SlideShow = SlideShow
57
+
58
+ class Slide {
59
+ #chui_slide = document.createElement('chui_slide');
60
+ #chui_slide_content = document.createElement('chui_slide_content');
61
+ constructor(options = {
62
+ size: { width: String(), height: String() },
63
+ style: { direction: String(), wrap: String(), align: String(), justify: String() },
64
+ components: []
65
+ }) {
66
+ if (options.size.width !== undefined) this.#chui_slide_content.style.width = options.size.width;
67
+ if (options.size.height !== undefined) this.#chui_slide_content.style.height = options.size.height;
68
+ if (options.style.direction !== undefined) this.#chui_slide_content.style.flexDirection = options.style.direction;
69
+ if (options.style.wrap !== undefined) this.#chui_slide_content.style.flexWrap = options.style.wrap;
70
+ if (options.style.align !== undefined) this.#chui_slide_content.style.alignItems = options.style.align;
71
+ if (options.style.justify !== undefined) this.#chui_slide_content.style.justifyContent = options.style.justify;
72
+ for (let child of options.components) this.#chui_slide_content.appendChild(child.set())
73
+ this.#chui_slide.appendChild(this.#chui_slide_content)
74
+ }
75
+ set() { return this.#chui_slide }
76
76
  }