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,184 +1,184 @@
1
- class TelegramBot {
2
- #main_api = undefined;
3
- constructor(token = String()) {
4
- this.#main_api = `https://api.telegram.org/bot${token}`
5
- }
6
- setToken(token = String()) {
7
- this.#main_api = `https://api.telegram.org/bot${token}`
8
- }
9
- // GET
10
- async getMe() {
11
- return await this.#sendRequestParams("GET", "getMe", undefined);
12
- }
13
- async getUpdates() {
14
- return await this.#sendRequestParams("GET", "getUpdates", undefined);
15
- }
16
- async getChat(chat_id = String()) {
17
- return await this.#sendRequestParams("GET", `getChat`, {
18
- "chat_id": chat_id
19
- });
20
- }
21
- async getChatAdministrators(chat_id = String()) {
22
- return await this.#sendRequestParams("GET", `getChatAdministrators`, {
23
- "chat_id": chat_id
24
- });
25
- }
26
- async getChatMemberCount(chat_id = String()) {
27
- return await this.#sendRequestParams("GET", `getChatMemberCount`, {
28
- "chat_id": chat_id
29
- });
30
- }
31
- async getChatMember(chat_id = String(), user_id = Number()) {
32
- return await this.#sendRequestParams("GET", `getChatMember`, {
33
- "chat_id": chat_id,
34
- "user_id": user_id
35
- });
36
- }
37
- async getUserProfilePhotos(user_id = Number()) {
38
- return await this.#sendRequestParams("GET", `getUserProfilePhotos`, {
39
- "user_id": user_id
40
- });
41
- }
42
- async getFile(file_id = String()) {
43
- return await this.#sendRequestParams("GET", `getFile`, {
44
- "file_id": file_id
45
- });
46
- }
47
- // SET
48
- async setChatTitle(chat_id = String(), title = String()) {
49
- return await this.#sendRequestFormData("POST", "setChatTitle", {
50
- "chat_id": chat_id,
51
- "title": title
52
- })
53
- }
54
- async setChatDescription(chat_id = String(), description = String()) {
55
- return await this.#sendRequestFormData("POST", "setChatDescription", {
56
- "chat_id": chat_id,
57
- "description": description
58
- })
59
- }
60
- async setChatPhoto(chat_id = String(), path = String()) {
61
- return await this.#sendRequestFormData("POST", "setChatPhoto", {
62
- "chat_id": chat_id,
63
- "photo": path
64
- })
65
- }
66
- async deleteChatPhoto(chat_id = String()) {
67
- return await this.#sendRequestFormData("POST", "deleteChatPhoto", {
68
- "chat_id": chat_id
69
- })
70
- }
71
- // FUNC
72
- async forwardMessage(chat_id = String(), from_chat_id = String(), message_id = Number()) {
73
- return await this.#sendRequestFormData("POST", "forwardMessage", {
74
- "chat_id": chat_id,
75
- "from_chat_id": from_chat_id,
76
- "message_id": message_id
77
- });
78
- }
79
- async copyMessage(chat_id = String(), from_chat_id = String(), message_id = Number()) {
80
- return await this.#sendRequestFormData("POST", "copyMessage", {
81
- "chat_id": chat_id,
82
- "from_chat_id": from_chat_id,
83
- "message_id": message_id
84
- });
85
- }
86
- async pinChatMessage(chat_id = String(), message_id = Number()) {
87
- return await this.#sendRequestFormData("POST", "pinChatMessage", {
88
- "chat_id": chat_id,
89
- "message_id": message_id
90
- });
91
- }
92
- async unpinChatMessage(chat_id = String(), message_id = Number()) {
93
- return await this.#sendRequestFormData("POST", "unpinChatMessage", {
94
- "chat_id": chat_id,
95
- "message_id": message_id
96
- });
97
- }
98
- async unpinAllChatMessages(chat_id = String()) {
99
- return await this.#sendRequestFormData("POST", "unpinAllChatMessages", {
100
- "chat_id": chat_id
101
- });
102
- }
103
- // SEND FUNC
104
- async sendMessage(chat_id = String(), message = String()) {
105
- return await this.#sendRequestFormData("POST", "sendMessage", {
106
- "chat_id": chat_id,
107
- "text": message,
108
- "parse_mode": "markdown"
109
- });
110
- }
111
- async sendDocument(chat_id = String(), path = String()) {
112
- return await this.#sendRequestFormData("POST", "sendDocument", {
113
- "chat_id": chat_id,
114
- "document": path
115
- })
116
- }
117
- async sendPhoto(chat_id = String(), path = String()) {
118
- return await this.#sendRequestFormData("POST", "sendPhoto", {
119
- "chat_id": chat_id,
120
- "photo": path
121
- })
122
- }
123
- async sendAudio(chat_id = String(), path = String()) {
124
- return await this.#sendRequestFormData("POST", "sendAudio", {
125
- "chat_id": chat_id,
126
- "audio": path
127
- })
128
- }
129
- async sendVideo(chat_id = String(), path = String()) {
130
- return await this.#sendRequestFormData("POST", "sendVideo", {
131
- "chat_id": chat_id,
132
- "video": path
133
- })
134
- }
135
- async sendContact(chat_id = String(), phone_number = String(), first_name = String()) {
136
- return await this.#sendRequestFormData("POST", "sendContact", {
137
- "chat_id": chat_id,
138
- "phone_number": phone_number,
139
- "first_name": first_name
140
- })
141
- }
142
- async sendPoll(chat_id = String(), question = String(), options = [], is_anonymous = Boolean()) {
143
- return await this.#sendRequestFormData("POST", "sendPoll", {
144
- "chat_id": chat_id,
145
- "question": question,
146
- "options": JSON.stringify(options),
147
- "is_anonymous": is_anonymous
148
- })
149
- }
150
- async sendDice(chat_id = String()) {
151
- return await this.#sendRequestFormData("POST", "sendDice", {
152
- "chat_id": chat_id
153
- })
154
- }
155
- // PRIVATE FUNC
156
- #sendRequestFormData(method, func, data = {}) {
157
- return new Promise((resolve, reject) => {
158
- let request = new XMLHttpRequest();
159
- request.open(method, `${this.#main_api}/${func}`);
160
- if (data !== undefined) {
161
- let formData = new FormData();
162
- for (let key of Object.keys(data)) formData.append(key, data[key])
163
- request.send(formData)
164
- } else request.send();
165
- request.addEventListener("load", () => resolve(JSON.parse(request.responseText)));
166
- request.addEventListener("error", () => reject(JSON.parse(request.responseText)));
167
- })
168
- }
169
- #sendRequestParams(method, func, params = {}) {
170
- return new Promise((resolve, reject) => {
171
- let request = new XMLHttpRequest();
172
- if (params !== undefined) request.open(method, `${this.#main_api}/${func}${this.#formatParams(params)}`);
173
- else request.open(method, `${this.#main_api}/${func}`);
174
- request.send();
175
- request.addEventListener("load", () => resolve(JSON.parse(request.responseText)));
176
- request.addEventListener("error", () => reject(JSON.parse(request.responseText)));
177
- })
178
- }
179
- #formatParams(params){
180
- return "?" + Object.keys(params).map((key) => { return key + "=" + encodeURIComponent(params[key]) }).join("&")
181
- }
182
- }
183
-
1
+ class TelegramBot {
2
+ #main_api = undefined;
3
+ constructor(token = String()) {
4
+ this.#main_api = `https://api.telegram.org/bot${token}`
5
+ }
6
+ setToken(token = String()) {
7
+ this.#main_api = `https://api.telegram.org/bot${token}`
8
+ }
9
+ // GET
10
+ async getMe() {
11
+ return await this.#sendRequestParams("GET", "getMe", undefined);
12
+ }
13
+ async getUpdates() {
14
+ return await this.#sendRequestParams("GET", "getUpdates", undefined);
15
+ }
16
+ async getChat(chat_id = String()) {
17
+ return await this.#sendRequestParams("GET", `getChat`, {
18
+ "chat_id": chat_id
19
+ });
20
+ }
21
+ async getChatAdministrators(chat_id = String()) {
22
+ return await this.#sendRequestParams("GET", `getChatAdministrators`, {
23
+ "chat_id": chat_id
24
+ });
25
+ }
26
+ async getChatMemberCount(chat_id = String()) {
27
+ return await this.#sendRequestParams("GET", `getChatMemberCount`, {
28
+ "chat_id": chat_id
29
+ });
30
+ }
31
+ async getChatMember(chat_id = String(), user_id = Number()) {
32
+ return await this.#sendRequestParams("GET", `getChatMember`, {
33
+ "chat_id": chat_id,
34
+ "user_id": user_id
35
+ });
36
+ }
37
+ async getUserProfilePhotos(user_id = Number()) {
38
+ return await this.#sendRequestParams("GET", `getUserProfilePhotos`, {
39
+ "user_id": user_id
40
+ });
41
+ }
42
+ async getFile(file_id = String()) {
43
+ return await this.#sendRequestParams("GET", `getFile`, {
44
+ "file_id": file_id
45
+ });
46
+ }
47
+ // SET
48
+ async setChatTitle(chat_id = String(), title = String()) {
49
+ return await this.#sendRequestFormData("POST", "setChatTitle", {
50
+ "chat_id": chat_id,
51
+ "title": title
52
+ })
53
+ }
54
+ async setChatDescription(chat_id = String(), description = String()) {
55
+ return await this.#sendRequestFormData("POST", "setChatDescription", {
56
+ "chat_id": chat_id,
57
+ "description": description
58
+ })
59
+ }
60
+ async setChatPhoto(chat_id = String(), path = String()) {
61
+ return await this.#sendRequestFormData("POST", "setChatPhoto", {
62
+ "chat_id": chat_id,
63
+ "photo": path
64
+ })
65
+ }
66
+ async deleteChatPhoto(chat_id = String()) {
67
+ return await this.#sendRequestFormData("POST", "deleteChatPhoto", {
68
+ "chat_id": chat_id
69
+ })
70
+ }
71
+ // FUNC
72
+ async forwardMessage(chat_id = String(), from_chat_id = String(), message_id = Number()) {
73
+ return await this.#sendRequestFormData("POST", "forwardMessage", {
74
+ "chat_id": chat_id,
75
+ "from_chat_id": from_chat_id,
76
+ "message_id": message_id
77
+ });
78
+ }
79
+ async copyMessage(chat_id = String(), from_chat_id = String(), message_id = Number()) {
80
+ return await this.#sendRequestFormData("POST", "copyMessage", {
81
+ "chat_id": chat_id,
82
+ "from_chat_id": from_chat_id,
83
+ "message_id": message_id
84
+ });
85
+ }
86
+ async pinChatMessage(chat_id = String(), message_id = Number()) {
87
+ return await this.#sendRequestFormData("POST", "pinChatMessage", {
88
+ "chat_id": chat_id,
89
+ "message_id": message_id
90
+ });
91
+ }
92
+ async unpinChatMessage(chat_id = String(), message_id = Number()) {
93
+ return await this.#sendRequestFormData("POST", "unpinChatMessage", {
94
+ "chat_id": chat_id,
95
+ "message_id": message_id
96
+ });
97
+ }
98
+ async unpinAllChatMessages(chat_id = String()) {
99
+ return await this.#sendRequestFormData("POST", "unpinAllChatMessages", {
100
+ "chat_id": chat_id
101
+ });
102
+ }
103
+ // SEND FUNC
104
+ async sendMessage(chat_id = String(), message = String()) {
105
+ return await this.#sendRequestFormData("POST", "sendMessage", {
106
+ "chat_id": chat_id,
107
+ "text": message,
108
+ "parse_mode": "markdown"
109
+ });
110
+ }
111
+ async sendDocument(chat_id = String(), path = String()) {
112
+ return await this.#sendRequestFormData("POST", "sendDocument", {
113
+ "chat_id": chat_id,
114
+ "document": path
115
+ })
116
+ }
117
+ async sendPhoto(chat_id = String(), path = String()) {
118
+ return await this.#sendRequestFormData("POST", "sendPhoto", {
119
+ "chat_id": chat_id,
120
+ "photo": path
121
+ })
122
+ }
123
+ async sendAudio(chat_id = String(), path = String()) {
124
+ return await this.#sendRequestFormData("POST", "sendAudio", {
125
+ "chat_id": chat_id,
126
+ "audio": path
127
+ })
128
+ }
129
+ async sendVideo(chat_id = String(), path = String()) {
130
+ return await this.#sendRequestFormData("POST", "sendVideo", {
131
+ "chat_id": chat_id,
132
+ "video": path
133
+ })
134
+ }
135
+ async sendContact(chat_id = String(), phone_number = String(), first_name = String()) {
136
+ return await this.#sendRequestFormData("POST", "sendContact", {
137
+ "chat_id": chat_id,
138
+ "phone_number": phone_number,
139
+ "first_name": first_name
140
+ })
141
+ }
142
+ async sendPoll(chat_id = String(), question = String(), options = [], is_anonymous = Boolean()) {
143
+ return await this.#sendRequestFormData("POST", "sendPoll", {
144
+ "chat_id": chat_id,
145
+ "question": question,
146
+ "options": JSON.stringify(options),
147
+ "is_anonymous": is_anonymous
148
+ })
149
+ }
150
+ async sendDice(chat_id = String()) {
151
+ return await this.#sendRequestFormData("POST", "sendDice", {
152
+ "chat_id": chat_id
153
+ })
154
+ }
155
+ // PRIVATE FUNC
156
+ #sendRequestFormData(method, func, data = {}) {
157
+ return new Promise((resolve, reject) => {
158
+ let request = new XMLHttpRequest();
159
+ request.open(method, `${this.#main_api}/${func}`);
160
+ if (data !== undefined) {
161
+ let formData = new FormData();
162
+ for (let key of Object.keys(data)) formData.append(key, data[key])
163
+ request.send(formData)
164
+ } else request.send();
165
+ request.addEventListener("load", () => resolve(JSON.parse(request.responseText)));
166
+ request.addEventListener("error", () => reject(JSON.parse(request.responseText)));
167
+ })
168
+ }
169
+ #sendRequestParams(method, func, params = {}) {
170
+ return new Promise((resolve, reject) => {
171
+ let request = new XMLHttpRequest();
172
+ if (params !== undefined) request.open(method, `${this.#main_api}/${func}${this.#formatParams(params)}`);
173
+ else request.open(method, `${this.#main_api}/${func}`);
174
+ request.send();
175
+ request.addEventListener("load", () => resolve(JSON.parse(request.responseText)));
176
+ request.addEventListener("error", () => reject(JSON.parse(request.responseText)));
177
+ })
178
+ }
179
+ #formatParams(params){
180
+ return "?" + Object.keys(params).map((key) => { return key + "=" + encodeURIComponent(params[key]) }).join("&")
181
+ }
182
+ }
183
+
184
184
  exports.TelegramBot = TelegramBot
@@ -1,122 +1,122 @@
1
- // transition: all var(--transition_time);
2
-
3
- class Animation {
4
- #element = undefined;
5
-
6
- constructor(element) {
7
- require('../chui_functions').setStyles(__dirname + "/styles.css", "chUiJS_Animations");
8
- if (element !== undefined) this.#element = element;
9
- }
10
-
11
- fadeIn() {
12
- if (window.getComputedStyle(this.#element, null).display === 'none') {
13
- if (this.#element.tagName !== "TABLE") this.#element.style.display = 'flex';
14
- }
15
- this.#element.style.transition = "transform .0s"
16
- this.#element.style.animationName = 'fade-in';
17
- }
18
-
19
- fadeOut() {
20
- this.#element.style.transition = "transform .0s"
21
- if (this.#element.style.animationName) {
22
- this.#element.style.animationName = 'fade-out';
23
- this.#element.addEventListener('animationend', removeEvents);
24
- }
25
- }
26
-
27
- // SCALE
28
- scaleIn() {
29
- if (window.getComputedStyle(this.#element, null).display === 'none') {
30
- if (this.#element.tagName !== "TABLE") this.#element.style.display = 'flex';
31
- }
32
- this.#element.style.animationName = 'scale-in';
33
- }
34
-
35
- scaleOut() {
36
- if (this.#element.style.animationName) {
37
- this.#element.style.animationName = 'scale-out';
38
- this.#element.addEventListener('animationend', removeEvents);
39
- }
40
- }
41
-
42
- // SLIDE RIGHT
43
- slideRightIn() {
44
- if (window.getComputedStyle(this.#element, null).display === 'none') {
45
- if (this.#element.tagName !== "TABLE") this.#element.style.display = 'flex';
46
- }
47
- this.#element.style.animationName = 'slide-right-in';
48
- }
49
-
50
- slideRightOut() {
51
- if (this.#element.style.animationName) {
52
- this.#element.style.animationName = 'slide-right-out';
53
- this.#element.addEventListener('animationend', removeEvents);
54
- }
55
- }
56
-
57
- // SLIDE BOTTOM
58
- slideBottomIn() {
59
- if (window.getComputedStyle(this.#element, null).display === 'none') {
60
- if (this.#element.tagName !== "TABLE") this.#element.style.display = 'flex';
61
- }
62
- this.#element.style.animationName = 'slide-bottom-in';
63
- }
64
-
65
- slideBottomOut() {
66
- if (this.#element.style.animationName) {
67
- this.#element.style.animationName = 'slide-bottom-out';
68
- this.#element.addEventListener('animationend', removeEvents);
69
- }
70
- }
71
-
72
- // REMOVE
73
- slideBottomOutAndRemove() {
74
- if (this.#element.style.animationName) {
75
- this.#element.style.animationName = 'slide-bottom-out';
76
- this.#element.addEventListener('animationend', removeEvents);
77
- }
78
- }
79
-
80
- slideRightOutAndRemove() {
81
- if (this.#element.style.animationName) {
82
- this.#element.style.animationName = 'slide-right-out';
83
- this.#element.addEventListener('animationend', removeEvents);
84
- }
85
- }
86
-
87
- scaleOutAndRemove() {
88
- if (this.#element.style.animationName) {
89
- this.#element.style.animationName = 'scale-out';
90
- this.#element.addEventListener('animationend', removeEvents2);
91
- }
92
- }
93
-
94
- fadeOutAndRemove() {
95
- if (this.#element.style.animationName) {
96
- this.#element.style.animationName = 'fade-out';
97
- this.#element.addEventListener('animationend', removeEvents2);
98
- }
99
- }
100
-
101
- //
102
- setElement(element) {
103
- this.#element = element;
104
- }
105
-
106
- removeStyles() {
107
- this.#element.removeAttribute("style")
108
- }
109
- }
110
-
111
- const removeEvents2 = (event) => {
112
- event.target.remove()
113
- event.target.removeEventListener('animationend', removeEvents2);
114
- }
115
-
116
- const removeEvents = (event) => {
117
- event.target.style.removeProperty('animation-name');
118
- event.target.style.removeProperty('display');
119
- event.target.removeEventListener('animationend', removeEvents);
120
- }
121
-
1
+ // transition: all var(--transition_time);
2
+
3
+ class Animation {
4
+ #element = undefined;
5
+
6
+ constructor(element) {
7
+ require('../chui_functions').setStyles(__dirname + "/styles.css", "chUiJS_Animations");
8
+ if (element !== undefined) this.#element = element;
9
+ }
10
+
11
+ fadeIn() {
12
+ if (window.getComputedStyle(this.#element, null).display === 'none') {
13
+ if (this.#element.tagName !== "TABLE") this.#element.style.display = 'flex';
14
+ }
15
+ this.#element.style.transition = "transform .0s"
16
+ this.#element.style.animationName = 'fade-in';
17
+ }
18
+
19
+ fadeOut() {
20
+ this.#element.style.transition = "transform .0s"
21
+ if (this.#element.style.animationName) {
22
+ this.#element.style.animationName = 'fade-out';
23
+ this.#element.addEventListener('animationend', removeEvents);
24
+ }
25
+ }
26
+
27
+ // SCALE
28
+ scaleIn() {
29
+ if (window.getComputedStyle(this.#element, null).display === 'none') {
30
+ if (this.#element.tagName !== "TABLE") this.#element.style.display = 'flex';
31
+ }
32
+ this.#element.style.animationName = 'scale-in';
33
+ }
34
+
35
+ scaleOut() {
36
+ if (this.#element.style.animationName) {
37
+ this.#element.style.animationName = 'scale-out';
38
+ this.#element.addEventListener('animationend', removeEvents);
39
+ }
40
+ }
41
+
42
+ // SLIDE RIGHT
43
+ slideRightIn() {
44
+ if (window.getComputedStyle(this.#element, null).display === 'none') {
45
+ if (this.#element.tagName !== "TABLE") this.#element.style.display = 'flex';
46
+ }
47
+ this.#element.style.animationName = 'slide-right-in';
48
+ }
49
+
50
+ slideRightOut() {
51
+ if (this.#element.style.animationName) {
52
+ this.#element.style.animationName = 'slide-right-out';
53
+ this.#element.addEventListener('animationend', removeEvents);
54
+ }
55
+ }
56
+
57
+ // SLIDE BOTTOM
58
+ slideBottomIn() {
59
+ if (window.getComputedStyle(this.#element, null).display === 'none') {
60
+ if (this.#element.tagName !== "TABLE") this.#element.style.display = 'flex';
61
+ }
62
+ this.#element.style.animationName = 'slide-bottom-in';
63
+ }
64
+
65
+ slideBottomOut() {
66
+ if (this.#element.style.animationName) {
67
+ this.#element.style.animationName = 'slide-bottom-out';
68
+ this.#element.addEventListener('animationend', removeEvents);
69
+ }
70
+ }
71
+
72
+ // REMOVE
73
+ slideBottomOutAndRemove() {
74
+ if (this.#element.style.animationName) {
75
+ this.#element.style.animationName = 'slide-bottom-out';
76
+ this.#element.addEventListener('animationend', removeEvents);
77
+ }
78
+ }
79
+
80
+ slideRightOutAndRemove() {
81
+ if (this.#element.style.animationName) {
82
+ this.#element.style.animationName = 'slide-right-out';
83
+ this.#element.addEventListener('animationend', removeEvents);
84
+ }
85
+ }
86
+
87
+ scaleOutAndRemove() {
88
+ if (this.#element.style.animationName) {
89
+ this.#element.style.animationName = 'scale-out';
90
+ this.#element.addEventListener('animationend', removeEvents2);
91
+ }
92
+ }
93
+
94
+ fadeOutAndRemove() {
95
+ if (this.#element.style.animationName) {
96
+ this.#element.style.animationName = 'fade-out';
97
+ this.#element.addEventListener('animationend', removeEvents2);
98
+ }
99
+ }
100
+
101
+ //
102
+ setElement(element) {
103
+ this.#element = element;
104
+ }
105
+
106
+ removeStyles() {
107
+ this.#element.removeAttribute("style")
108
+ }
109
+ }
110
+
111
+ const removeEvents2 = (event) => {
112
+ event.target.remove()
113
+ event.target.removeEventListener('animationend', removeEvents2);
114
+ }
115
+
116
+ const removeEvents = (event) => {
117
+ event.target.style.removeProperty('animation-name');
118
+ event.target.style.removeProperty('display');
119
+ event.target.removeEventListener('animationend', removeEvents);
120
+ }
121
+
122
122
  exports.Animation = Animation