underpost 2.7.1 → 2.7.2

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 (213) hide show
  1. package/.dockerignore +13 -13
  2. package/.env.development +7 -7
  3. package/.env.production +7 -7
  4. package/.env.test +7 -7
  5. package/.github/workflows/publish.yml +26 -0
  6. package/.nycrc +9 -9
  7. package/.prettierignore +12 -12
  8. package/.prettierrc +9 -9
  9. package/.vscode/extensions.json +72 -72
  10. package/.vscode/settings.json +100 -99
  11. package/Dockerfile +89 -89
  12. package/LICENSE +21 -21
  13. package/README.md +96 -96
  14. package/bin/db.js +172 -119
  15. package/bin/deploy.js +582 -661
  16. package/bin/dns.js +1 -1
  17. package/bin/file.js +92 -92
  18. package/bin/index.js +53 -53
  19. package/bin/install.js +398 -357
  20. package/bin/shortcut.js +44 -44
  21. package/bin/ssl.js +65 -64
  22. package/bin/util.js +182 -182
  23. package/bin/vs.js +35 -35
  24. package/conf.js +251 -249
  25. package/docker-compose.yml +67 -67
  26. package/jsconfig.json +7 -7
  27. package/jsdoc.json +32 -32
  28. package/nodemon.json +6 -6
  29. package/package.json +137 -132
  30. package/prometheus.yml +36 -36
  31. package/setup.sh +24 -24
  32. package/src/api/core/core.controller.js +69 -69
  33. package/src/api/core/core.model.js +11 -11
  34. package/src/api/core/core.router.js +23 -23
  35. package/src/api/core/core.service.js +29 -29
  36. package/src/api/crypto/crypto.controller.js +51 -51
  37. package/src/api/crypto/crypto.model.js +23 -23
  38. package/src/api/crypto/crypto.router.js +20 -20
  39. package/src/api/crypto/crypto.service.js +64 -64
  40. package/src/api/default/default.controller.js +69 -69
  41. package/src/api/default/default.model.js +20 -20
  42. package/src/api/default/default.router.js +23 -23
  43. package/src/api/default/default.service.js +31 -31
  44. package/src/api/file/file.controller.js +53 -51
  45. package/src/api/file/file.model.js +19 -19
  46. package/src/api/file/file.router.js +21 -20
  47. package/src/api/file/file.service.js +76 -70
  48. package/src/api/instance/instance.controller.js +69 -69
  49. package/src/api/instance/instance.model.js +36 -36
  50. package/src/api/instance/instance.router.js +33 -33
  51. package/src/api/instance/instance.service.js +48 -48
  52. package/src/api/test/test.controller.js +59 -59
  53. package/src/api/test/test.model.js +14 -14
  54. package/src/api/test/test.router.js +21 -21
  55. package/src/api/test/test.service.js +35 -35
  56. package/src/api/user/user.build.js +16 -0
  57. package/src/api/user/user.controller.js +70 -70
  58. package/src/api/user/user.model.js +65 -65
  59. package/src/api/user/user.router.js +345 -345
  60. package/src/api/user/user.service.js +479 -479
  61. package/src/api.js +23 -23
  62. package/src/client/Default.index.js +40 -40
  63. package/src/client/components/core/Account.js +290 -290
  64. package/src/client/components/core/AgGrid.js +160 -160
  65. package/src/client/components/core/Auth.js +19 -19
  66. package/src/client/components/core/Badge.js +32 -32
  67. package/src/client/components/core/BlockChain.js +41 -41
  68. package/src/client/components/core/Blog.js +9 -9
  69. package/src/client/components/core/BtnIcon.js +101 -94
  70. package/src/client/components/core/CalendarCore.js +458 -319
  71. package/src/client/components/core/Chat.js +64 -64
  72. package/src/client/components/core/ColorPalette.js +5267 -5267
  73. package/src/client/components/core/CommonJs.js +735 -732
  74. package/src/client/components/core/Content.js +193 -49
  75. package/src/client/components/core/Css.js +1064 -1027
  76. package/src/client/components/core/CssCore.js +817 -796
  77. package/src/client/components/core/D3Chart.js +44 -44
  78. package/src/client/components/core/Docs.js +229 -229
  79. package/src/client/components/core/DropDown.js +164 -164
  80. package/src/client/components/core/EventsUI.js +46 -54
  81. package/src/client/components/core/FileExplorer.js +699 -624
  82. package/src/client/components/core/FullScreen.js +45 -45
  83. package/src/client/components/core/Input.js +346 -259
  84. package/src/client/components/core/JoyStick.js +77 -77
  85. package/src/client/components/core/Keyboard.js +73 -73
  86. package/src/client/components/core/LoadingAnimation.js +179 -157
  87. package/src/client/components/core/LogIn.js +187 -181
  88. package/src/client/components/core/LogOut.js +58 -52
  89. package/src/client/components/core/Logger.js +26 -26
  90. package/src/client/components/core/Modal.js +1612 -1596
  91. package/src/client/components/core/NotificationManager.js +84 -84
  92. package/src/client/components/core/Panel.js +613 -413
  93. package/src/client/components/core/PanelForm.js +468 -0
  94. package/src/client/components/core/Polyhedron.js +162 -162
  95. package/src/client/components/core/Recover.js +204 -204
  96. package/src/client/components/core/Responsive.js +53 -53
  97. package/src/client/components/core/RichText.js +51 -27
  98. package/src/client/components/core/Router.js +76 -77
  99. package/src/client/components/core/Scroll.js +34 -0
  100. package/src/client/components/core/SignUp.js +125 -125
  101. package/src/client/components/core/SocketIo.js +72 -72
  102. package/src/client/components/core/Stream.js +113 -113
  103. package/src/client/components/core/ToggleSwitch.js +87 -87
  104. package/src/client/components/core/ToolTip.js +26 -26
  105. package/src/client/components/core/Translate.js +437 -408
  106. package/src/client/components/core/Validator.js +100 -100
  107. package/src/client/components/core/VanillaJs.js +460 -457
  108. package/src/client/components/core/Wallet.js +106 -106
  109. package/src/client/components/core/Webhook.js +25 -25
  110. package/src/client/components/core/Worker.js +272 -272
  111. package/src/client/components/default/CommonDefault.js +29 -29
  112. package/src/client/components/default/CssDefault.js +13 -13
  113. package/src/client/components/default/ElementsDefault.js +38 -38
  114. package/src/client/components/default/LogInDefault.js +41 -41
  115. package/src/client/components/default/LogOutDefault.js +28 -28
  116. package/src/client/components/default/MenuDefault.js +389 -389
  117. package/src/client/components/default/RoutesDefault.js +48 -48
  118. package/src/client/components/default/SettingsDefault.js +16 -16
  119. package/src/client/components/default/SignUpDefault.js +9 -9
  120. package/src/client/components/default/SocketIoDefault.js +54 -54
  121. package/src/client/components/default/TranslateDefault.js +7 -7
  122. package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
  123. package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
  124. package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
  125. package/src/client/public/default/browserconfig.xml +11 -11
  126. package/src/client/public/default/manifest.webmanifest +68 -68
  127. package/src/client/public/default/plantuml/client-conf.svg +1 -0
  128. package/src/client/public/default/plantuml/client-schema.svg +1 -0
  129. package/src/client/public/default/plantuml/cron-conf.svg +1 -0
  130. package/src/client/public/default/plantuml/cron-schema.svg +1 -0
  131. package/src/client/public/default/plantuml/server-conf.svg +1 -0
  132. package/src/client/public/default/plantuml/server-schema.svg +1 -0
  133. package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
  134. package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
  135. package/src/client/public/default/sitemap +147 -147
  136. package/src/client/public/default/yandex-browser-manifest.json +8 -8
  137. package/src/client/public/doc/sitemap +147 -147
  138. package/src/client/public/test/sitemap +147 -147
  139. package/src/client/services/core/core.service.js +170 -152
  140. package/src/client/services/crypto/crypto.service.js +70 -70
  141. package/src/client/services/default/default.management.js +345 -345
  142. package/src/client/services/default/default.service.js +89 -89
  143. package/src/client/services/file/file.service.js +70 -70
  144. package/src/client/services/instance/instance.management.js +74 -74
  145. package/src/client/services/instance/instance.service.js +89 -89
  146. package/src/client/services/test/test.service.js +70 -70
  147. package/src/client/services/user/user.management.js +50 -50
  148. package/src/client/services/user/user.service.js +89 -89
  149. package/src/client/ssr/Render.js +16 -16
  150. package/src/client/ssr/body-components/CacheControl.js +114 -113
  151. package/src/client/ssr/body-components/DefaultSplashScreen.js +79 -79
  152. package/src/client/ssr/email-components/DefaultRecoverEmail.js +21 -21
  153. package/src/client/ssr/email-components/DefaultVerifyEmail.js +17 -17
  154. package/src/client/ssr/head-components/Css.js +241 -241
  155. package/src/client/ssr/head-components/DefaultScripts.js +3 -3
  156. package/src/client/ssr/head-components/Microdata.js +11 -11
  157. package/src/client/ssr/head-components/Production.js +1 -1
  158. package/src/client/ssr/head-components/PwaDefault.js +59 -59
  159. package/src/client/ssr/head-components/Seo.js +14 -14
  160. package/src/client/sw/default.sw.js +201 -201
  161. package/src/client/sw/template.sw.js +84 -84
  162. package/src/client.build.js +22 -22
  163. package/src/client.dev.js +21 -21
  164. package/src/cron.js +25 -25
  165. package/src/db/DataBaseProvider.js +34 -34
  166. package/src/db/mariadb/MariaDB.js +33 -33
  167. package/src/db/mongo/MongooseDB.js +46 -46
  168. package/src/dns.js +22 -22
  169. package/src/index.js +42 -29
  170. package/src/mailer/EmailRender.js +69 -69
  171. package/src/mailer/MailerProvider.js +96 -96
  172. package/src/proxy.js +22 -22
  173. package/src/runtime/lampp/Lampp.js +69 -44
  174. package/src/runtime/nginx/Nginx.js +3 -3
  175. package/src/runtime/xampp/Xampp.js +49 -49
  176. package/src/server/auth.js +235 -204
  177. package/src/server/backup.js +101 -94
  178. package/src/server/client-build-live.js +72 -72
  179. package/src/server/client-build.js +705 -699
  180. package/src/server/client-dev-server.js +60 -58
  181. package/src/server/client-formatted.js +48 -48
  182. package/src/server/client-icons.js +149 -150
  183. package/src/server/conf.js +860 -611
  184. package/src/server/dns.js +98 -98
  185. package/src/server/downloader.js +42 -42
  186. package/src/server/logger.js +180 -180
  187. package/src/server/network.js +122 -122
  188. package/src/server/peer.js +33 -33
  189. package/src/server/process.js +66 -66
  190. package/src/server/prompt-optimizer.js +28 -28
  191. package/src/server/proxy.js +118 -118
  192. package/src/server/runtime.js +444 -393
  193. package/src/server/ssl.js +109 -107
  194. package/src/server.js +25 -25
  195. package/src/ws/IoInterface.js +45 -45
  196. package/src/ws/IoServer.js +39 -39
  197. package/src/ws/core/channels/core.ws.chat.js +23 -23
  198. package/src/ws/core/channels/core.ws.mailer.js +35 -35
  199. package/src/ws/core/channels/core.ws.stream.js +31 -31
  200. package/src/ws/core/core.ws.connection.js +28 -28
  201. package/src/ws/core/core.ws.emit.js +14 -14
  202. package/src/ws/core/core.ws.server.js +24 -24
  203. package/src/ws/core/management/core.ws.chat.js +8 -8
  204. package/src/ws/core/management/core.ws.mailer.js +16 -16
  205. package/src/ws/core/management/core.ws.stream.js +8 -8
  206. package/src/ws/default/channels/default.ws.main.js +16 -16
  207. package/src/ws/default/default.ws.connection.js +22 -22
  208. package/src/ws/default/default.ws.emit.js +14 -14
  209. package/src/ws/default/default.ws.server.js +20 -20
  210. package/src/ws/default/management/default.ws.main.js +8 -8
  211. package/startup.js +11 -11
  212. package/supervisord-openssh-server.conf +4 -4
  213. package/test/api.test.js +60 -60
@@ -1,1027 +1,1064 @@
1
- import { getId, newInstance, range, s4, splitEveryXChar } from './CommonJs.js';
2
- import { CssCoreDark, CssCoreLight } from './CssCore.js';
3
- import { DropDown } from './DropDown.js';
4
- import { Modal } from './Modal.js';
5
- import { Translate } from './Translate.js';
6
- import { append, getProxyPath, htmls, s } from './VanillaJs.js';
7
-
8
- let ThemesScope = [];
9
-
10
- // https://css.github.io/csso/csso.html
11
- // https://www.fontspace.com/
12
- // https://www.1001fonts.com/
13
-
14
- const Css = {
15
- loadThemes: async function (themes = []) {
16
- ThemesScope = [];
17
- for (const themeOptions of themes) addTheme(themeOptions);
18
- // if (!ThemesScope.find((t) => t.dark)) addTheme(CssCoreDark);
19
- // if (!ThemesScope.find((t) => !t.dark)) addTheme(CssCoreLight);
20
- if (ThemesScope.length === 0) {
21
- addTheme(CssCoreDark);
22
- addTheme(CssCoreLight);
23
- }
24
- const localStorageTheme = localStorage.getItem('_theme');
25
- if (localStorageTheme && Themes[localStorageTheme]) {
26
- const themeOption = ThemesScope.find((t) => t.theme === localStorageTheme);
27
- if (themeOption) return await this.Init(themeOption);
28
- }
29
- await this.Init();
30
- },
31
- Init: async function (options) {
32
- if (!options) options = ThemesScope[0];
33
- const { theme } = options;
34
- append(
35
- 'body',
36
- html`
37
- <style>
38
- html {
39
- scroll-behavior: smooth;
40
- }
41
-
42
- body {
43
- /* overscroll-behavior: contain; */
44
- /* box-sizing: border-box; */
45
- padding: 0px;
46
- margin: 0px;
47
- }
48
-
49
- .fl {
50
- position: relative;
51
- display: flow-root;
52
- }
53
-
54
- .abs,
55
- .in {
56
- display: block;
57
- }
58
-
59
- .fll {
60
- float: left;
61
- }
62
-
63
- .flr {
64
- float: right;
65
- }
66
-
67
- .abs {
68
- position: absolute;
69
- }
70
-
71
- .in,
72
- .inl {
73
- position: relative;
74
- }
75
-
76
- .inl {
77
- display: inline-table;
78
- display: -webkit-inline-table;
79
- display: -moz-inline-table;
80
- display: -ms-inline-table;
81
- display: -o-inline-table;
82
- }
83
-
84
- .fix {
85
- position: fixed;
86
- display: block;
87
- }
88
-
89
- .stq {
90
- position: sticky;
91
- /* require defined at least top, bottom, left o right */
92
- }
93
-
94
- .wfa {
95
- width: fill-available;
96
- width: -webkit-fill-available;
97
- width: -moz-fill-available;
98
- width: -ms-fill-available;
99
- width: -o-fill-available;
100
- }
101
-
102
- .wft {
103
- width: fit-content;
104
- width: -webkit-fit-content;
105
- width: -moz-fit-content;
106
- width: -ms-fit-content;
107
- width: -o-fit-content;
108
- }
109
-
110
- .wfm {
111
- width: max-content;
112
- width: -webkit-max-content;
113
- width: -moz-max-content;
114
- width: -ms-max-content;
115
- width: -o-max-content;
116
- }
117
-
118
- .negative-color {
119
- filter: invert(1);
120
- -webkit-filter: invert(1);
121
- -moz-filter: invert(1);
122
- -ms-filter: invert(1);
123
- -o-filter: invert(1);
124
- }
125
-
126
- .no-drag {
127
- user-drag: none;
128
- -webkit-user-drag: none;
129
- -moz-user-drag: none;
130
- -ms-user-drag: none;
131
- -o-user-drag: none;
132
- user-select: none;
133
- -webkit-user-select: none;
134
- -moz-user-select: none;
135
- -ms-user-select: none;
136
- -o-user-select: none;
137
- }
138
-
139
- .center {
140
- transform: translate(-50%, -50%);
141
- top: 50%;
142
- left: 50%;
143
- width: 100%;
144
- text-align: center;
145
- }
146
-
147
- input {
148
- outline: none !important;
149
- border: none;
150
- padding-block: 0;
151
- padding-inline: 0;
152
- }
153
- input::file-selector-button {
154
- outline: none !important;
155
- border: none;
156
- }
157
-
158
- .hide {
159
- display: none !important;
160
- }
161
- /*
162
-
163
- placeholder
164
-
165
- */
166
-
167
- ::placeholder {
168
- color: black;
169
- opacity: 1;
170
- /* Firefox */
171
- background: none;
172
- }
173
-
174
- :-ms-input-placeholder {
175
- /* Internet Explorer 10-11 */
176
- color: black;
177
- background: none;
178
- }
179
-
180
- ::-ms-input-placeholder {
181
- /* Microsoft Edge */
182
- color: black;
183
- background: none;
184
- }
185
-
186
- /*
187
-
188
- selection
189
-
190
- */
191
-
192
- ::-moz-selection {
193
- /* Code for Firefox */
194
- color: black;
195
- background: rgb(208, 208, 208);
196
- }
197
-
198
- ::selection {
199
- color: black;
200
- background: rgb(208, 208, 208);
201
- }
202
-
203
- .lowercase {
204
- text-transform: lowercase;
205
- }
206
- .uppercase {
207
- text-transform: uppercase;
208
- }
209
- .capitalize {
210
- text-transform: capitalize;
211
- }
212
-
213
- .bold {
214
- font-weight: bold;
215
- }
216
-
217
- .m {
218
- font-family: monospace;
219
- }
220
-
221
- .gray {
222
- filter: grayscale(1);
223
- }
224
- </style>
225
- <div class="session">
226
- <style>
227
- .session-in-log-out {
228
- display: block;
229
- }
230
- .session-inl-log-out {
231
- display: inline-table;
232
- }
233
- .session-in-log-in {
234
- display: none;
235
- }
236
- .session-inl-log-in {
237
- display: none;
238
- }
239
- </style>
240
- </div>
241
- <div class="theme"></div>
242
- `,
243
- );
244
- return await Themes[theme](options);
245
- },
246
- RenderSetting: async function () {
247
- return html` <div class="in section-mp">
248
- ${await DropDown.Render({
249
- id: 'settings-theme',
250
- value: Css.currentTheme,
251
- label: html`${Translate.Render('theme')}`,
252
- data: ThemesScope.map((themeOption) => {
253
- return {
254
- display: html`<i class="fa-solid fa-brush"></i> ${themeOption.theme}`,
255
- value: themeOption.theme,
256
- onClick: async () => await Themes[themeOption.theme](),
257
- };
258
- }),
259
- })}
260
- </div>`;
261
- },
262
- };
263
-
264
- const barLabels = (options) => {
265
- return {
266
- img: {
267
- close: html`<img
268
- class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
269
- src="${getProxyPath()}assets/icons/close.png"
270
- />`,
271
- maximize: html`<img
272
- class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
273
- src="${getProxyPath()}assets/icons/maximize.png"
274
- />`,
275
- minimize: html`<img
276
- class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
277
- src="${getProxyPath()}assets/icons/minimize.png"
278
- />`,
279
- restore: html`<img
280
- class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
281
- src="${getProxyPath()}assets/icons/restore.png"
282
- />`,
283
- menu: html`<img
284
- class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
285
- src="${getProxyPath()}assets/icons/menu.png"
286
- />`,
287
- },
288
- fontawesome: {
289
- close: html`<i class="fa-solid fa-xmark ${options.iconClass ? options.iconClass : ''}"></i>`,
290
- maximize: html`<i class="fa-regular fa-square ${options.iconClass ? options.iconClass : ''}"></i>`,
291
- minimize: html`<i class="fa-solid fa-window-minimize ${options.iconClass ? options.iconClass : ''}"></i>`,
292
- restore: html`<i class="fa-regular fa-window-restore ${options.iconClass ? options.iconClass : ''}"></i>`,
293
- menu: html`<i class="fa-solid fa-bars ${options.iconClass ? options.iconClass : ''}"></i>`,
294
- },
295
- default: {
296
- close: html`X`,
297
- maximize: html`▢`,
298
- minimize: html`_`,
299
- restore: html`□`,
300
- menu: html`≡`,
301
- },
302
- };
303
- };
304
-
305
- const barConfig = (options) => {
306
- const { barButtonsIconTheme } = options;
307
- return {
308
- buttons: {
309
- close: {
310
- disabled: false,
311
- label: barLabels(options)[barButtonsIconTheme].close,
312
- },
313
- maximize: {
314
- disabled: false,
315
- label: barLabels(options)[barButtonsIconTheme].maximize,
316
- },
317
- minimize: {
318
- disabled: false,
319
- label: barLabels(options)[barButtonsIconTheme].minimize,
320
- },
321
- restore: {
322
- disabled: false,
323
- label: barLabels(options)[barButtonsIconTheme].restore,
324
- },
325
- menu: {
326
- disabled: true,
327
- label: barLabels(options)[barButtonsIconTheme].menu,
328
- },
329
- },
330
- };
331
- };
332
-
333
- const renderDefaultWindowsModalButtonContent = (options) => {
334
- const { barButtonsIconTheme, htmlRender } = options;
335
- const barConfigInstance = barConfig(options);
336
- if (htmlRender)
337
- Object.keys(Modal.Data).map((idModal) => {
338
- if (s(`.btn-minimize-${idModal}`)) htmls(`.btn-minimize-${idModal}`, barConfigInstance.buttons.minimize.label);
339
- if (s(`.btn-restore-${idModal}`)) htmls(`.btn-restore-${idModal}`, barConfigInstance.buttons.restore.label);
340
- if (s(`.btn-maximize-${idModal}`)) htmls(`.btn-maximize-${idModal}`, barConfigInstance.buttons.maximize.label);
341
- if (s(`.btn-close-${idModal}`)) htmls(`.btn-close-${idModal}`, barConfigInstance.buttons.close.label);
342
- if (s(`.btn-menu-${idModal}`)) htmls(`.btn-menu-${idModal}`, barConfigInstance.buttons.menu.label);
343
- });
344
- return { barConfig: barConfigInstance };
345
- };
346
-
347
- let darkTheme = true;
348
- const ThemeEvents = {};
349
- const TriggerThemeEvents = () => {
350
- localStorage.setItem('_theme', Css.currentTheme);
351
- Object.keys(ThemeEvents).map((keyEvent) => ThemeEvents[keyEvent]());
352
- };
353
-
354
- const Themes = {};
355
-
356
- const addTheme = (options) => {
357
- ThemesScope.push(options);
358
- Themes[options.theme] = async (barOptions) => {
359
- if (!options.dark) options.dark = false;
360
- if (!options.barButtonsIconTheme) options.barButtonsIconTheme = 'fontawesome';
361
- const htmlRender = Css.currentTheme !== options.theme;
362
- if (htmlRender) {
363
- Css.currentTheme = options.theme;
364
- darkTheme = options.dark;
365
- let render = '';
366
- if (!['core', 'css-core'].includes(options.theme))
367
- render += darkTheme ? await CssCoreDark.render() : await CssCoreLight.render();
368
- render += await options.render();
369
- htmls('.theme', render);
370
- TriggerThemeEvents();
371
- }
372
- return {
373
- ...renderDefaultWindowsModalButtonContent({
374
- barButtonsIconTheme: options.barButtonsIconTheme,
375
- htmlRender,
376
- ...barOptions,
377
- }),
378
- };
379
- };
380
- };
381
-
382
- const borderChar = (px, color, selectors) => {
383
- if (selectors) {
384
- return selectors
385
- .map(
386
- (selector) => html`
387
- <style>
388
- ${selector} {
389
- text-shadow: ${px}px -${px}px ${px}px ${color}, -${px}px ${px}px ${px}px ${color},
390
- -${px}px -${px}px ${px}px ${color}, ${px}px ${px}px ${px}px ${color};
391
- }
392
- </style>
393
- `,
394
- )
395
- .join('');
396
- }
397
- return html`
398
- text-shadow: ${px}px -${px}px ${px}px ${color}, -${px}px ${px}px ${px}px ${color}, -${px}px -${px}px ${px}px
399
- ${color}, ${px}px ${px}px ${px}px ${color};
400
- `;
401
- };
402
-
403
- const boxShadow = ({ selector }) => html`
404
- <style>
405
- ${selector} {
406
- box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
407
- }
408
- ${selector}:hover {
409
- box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 10px 30px 0 rgba(0, 0, 0, 0.3);
410
- }
411
- </style>
412
- `;
413
-
414
- const renderMediaQuery = (mediaData) => {
415
- // first limit should be '0'
416
- return html`
417
- ${mediaData
418
- .map(
419
- (mediaState) => html`
420
- <style>
421
- @media only screen and (min-width: ${mediaState.limit}px) {
422
- ${mediaState.css}
423
- }
424
- </style>
425
- `,
426
- )
427
- .join('')}
428
- `;
429
- };
430
-
431
- const renderStatus = (status, options) => {
432
- switch (status) {
433
- case 'success':
434
- return html`<div class="${options?.class ? options.class : 'abs center'}">
435
- <i style="color: green" class="fa-solid fa-check"></i>
436
- </div>`;
437
- case 'error':
438
- return html`<div class="${options?.class ? options.class : 'abs center'}">
439
- <i style="color: red" class="fa-solid fa-xmark"></i>
440
- </div>`;
441
- case 'warning':
442
- return html`<div class="${options?.class ? options.class : 'abs center'}">
443
- <i style="color: yellow" class="fa-solid fa-triangle-exclamation"></i>
444
- </div>`;
445
- default:
446
- return html``;
447
- }
448
- };
449
-
450
- const dynamicColTokens = {};
451
-
452
- const dynamicCol = (options = { containerSelector: '', id: '', type: '', limit: 900 }) => {
453
- const { containerSelector, id } = options;
454
- const limitCol = options?.limit ? options.limit : 900;
455
- if (!(id in dynamicColTokens)) dynamicColTokens[id] = {};
456
- dynamicColTokens[id].options = options;
457
- if (dynamicColTokens[id].observer) dynamicColTokens[id].observer.disconnect();
458
- setTimeout(() => {
459
- dynamicColTokens[id].observer = new ResizeObserver(() => {
460
- if (s(`.${containerSelector}`)) {
461
- switch (options.type) {
462
- case 'a-50-b-50':
463
- if (s(`.${containerSelector}`).offsetWidth < limitCol)
464
- htmls(
465
- `.style-${id}-col`,
466
- css`
467
- .${id}-col-a, .${id}-col-b {
468
- width: 100%;
469
- }
470
- `,
471
- );
472
- else
473
- htmls(
474
- `.style-${id}-col`,
475
- css`
476
- .${id}-col-a {
477
- width: 50%;
478
- }
479
- .${id}-col-b {
480
- width: 50%;
481
- }
482
- `,
483
- );
484
- break;
485
-
486
- default:
487
- if (s(`.${containerSelector}`).offsetWidth < 900)
488
- htmls(
489
- `.style-${id}-col`,
490
- css`
491
- .${id}-col-a, .${id}-col-b {
492
- width: 100%;
493
- }
494
- `,
495
- );
496
- else
497
- htmls(
498
- `.style-${id}-col`,
499
- css`
500
- .${id}-col-a {
501
- width: 30%;
502
- }
503
- .${id}-col-b {
504
- width: 70%;
505
- }
506
- `,
507
- );
508
- break;
509
- }
510
- } else {
511
- dynamicColTokens[id].observer.disconnect();
512
- delete dynamicColTokens[id];
513
- if (s(`.style-${id}-col`)) s(`.style-${id}-col`).remove();
514
- }
515
- });
516
- dynamicColTokens[id].observer.observe(s(`.${containerSelector}`));
517
- });
518
- return html` <style class="style-${id}-col"></style>`;
519
- };
520
-
521
- const renderBubbleDialog = async function (
522
- options = {
523
- id: '',
524
- html: async () => '',
525
- classSelectors,
526
- triangleType: 'down',
527
- trianglePositionCss: '',
528
- triangleCss: '',
529
- triangleDim: 0,
530
- bubbleCss: '',
531
- },
532
- ) {
533
- const { id, html } = options;
534
- let cssTrianglePosition = `
535
- bottom: -45px;
536
- left: 5px;
537
- `;
538
- let whiteTriangleStyle = `top: 43%`;
539
- let blackTriangleStyle = ``;
540
- switch (options.triangleType) {
541
- case 'right':
542
- cssTrianglePosition = `
543
- right: -40px;
544
- top: 5px;
545
- `;
546
- blackTriangleStyle = `
547
- top: 43%;
548
- left: 57%;
549
- `;
550
- break;
551
-
552
- default:
553
- break;
554
- }
555
- if (options.trianglePositionCss) cssTrianglePosition = options.trianglePositionCss;
556
- return html` <div
557
- class="${options?.classSelectors ? options.classSelectors : 'inl'} bubble-dialog bubble-dialog-${id}"
558
- ${options.bubbleCss ? `style='${options.bubbleCss}'` : ''}
559
- >
560
- <style class="style-bubble-dialog-triangle-${id}">
561
- .bubble-dialog-triangle-${id} {
562
- width: ${options.triangleDim ? options.triangleDim : 60}px;
563
- height: ${options.triangleDim ? options.triangleDim : 60}px;
564
- /* border: 2px solid red; */
565
- box-sizing: border-box;
566
- ${cssTrianglePosition}
567
- }
568
- </style>
569
- <div class="abs bubble-dialog-triangle bubble-dialog-triangle-${id}">
570
- <div class="abs center" style="${blackTriangleStyle}">
571
- ${triangle[options?.triangleType ? options.triangleType : 'down']({
572
- dim: 25,
573
- id: id + '-triangle-black',
574
- color: 'black',
575
- classList: 'inl',
576
- customStyle: options.triangleCss,
577
- })}
578
- </div>
579
- <div class="abs center" style="${whiteTriangleStyle}">
580
- ${triangle[options?.triangleType ? options.triangleType : 'down']({
581
- dim: 24,
582
- id: id + '-triangle-white',
583
- color: 'white',
584
- classList: 'inl',
585
- customStyle: options.triangleCss,
586
- })}
587
- </div>
588
- </div>
589
- ${await html()}
590
- </div>`;
591
- };
592
-
593
- const typeWriter = async function ({ id, html, seconds, endHideBlink, container }) {
594
- if (!seconds) seconds = 2;
595
- return new Promise((resolve) => {
596
- // https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function
597
- // https://www.w3schools.com/cssref/css3_pr_animation-fill-mode.php
598
- const typingAnimationTransitionStyle = [`1s linear`, `${seconds}s steps(30, end)`, `1s forwards`];
599
- const render = html`
600
- <style class="style-${id}">
601
- .tw-${id}-typed-out {
602
- overflow: hidden;
603
- border-right: 0.15em solid orange;
604
- white-space: nowrap;
605
- animation: typing-${id} ${typingAnimationTransitionStyle[1]}, blink-caret-${id} 0.5s step-end infinite;
606
- animation-fill-mode: forwards;
607
- width: 0;
608
- }
609
- </style>
610
- <style>
611
- .tw-${id}-container {
612
- }
613
- @keyframes typing-${id} {
614
- from {
615
- width: 0;
616
- }
617
- to {
618
- width: 100%;
619
- }
620
- }
621
-
622
- @keyframes blink-caret-${id} {
623
- from,
624
- to {
625
- border-color: transparent;
626
- }
627
- 50% {
628
- border-color: orange;
629
- }
630
- }
631
- </style>
632
- <div class="inl tw-${id}-container">
633
- <div class="tw-${id}-typed-out">${html}</div>
634
- </div>
635
- `;
636
- htmls(`.${container}`, render);
637
- setTimeout(() => {
638
- if (endHideBlink && s(`.style-${id}`)) s(`.style-${id}`).remove();
639
- resolve(render);
640
- }, seconds * 1000);
641
- });
642
- };
643
-
644
- const renderCssAttr = (options) =>
645
- `${
646
- options && options.style
647
- ? Object.keys(options.style)
648
- .map((keyStyle) => `${keyStyle}: ${options.style[keyStyle]};`)
649
- .join(`\n`)
650
- : ''
651
- }`;
652
-
653
- const renderStyleTag = (styleSelector = 'style-abc', selector, options) =>
654
- html`<style class="${styleSelector}">
655
- ${selector} { ${renderCssAttr(options)} }
656
- </style>`;
657
-
658
- function getTranslate3d(el) {
659
- const values = el.style.transform.split(/\w+\(|\);?/);
660
- if (!values[1] || !values[1].length) {
661
- return [];
662
- }
663
- return values[1].split(/,\s?/g);
664
- }
665
-
666
- const dashRange = ({ selector, color }) => {
667
- return html`
668
- <style>
669
- .${selector} {
670
- background: linear-gradient(90deg, ${color} 50%, transparent 50%),
671
- linear-gradient(90deg, ${color} 50%, transparent 50%), linear-gradient(0deg, ${color} 50%, transparent 50%),
672
- linear-gradient(0deg, ${color} 50%, transparent 50%);
673
- background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
674
- background-size: 16px 4px, 16px 4px, 4px 16px, 4px 16px;
675
- background-position: 0% 0%, 100% 100%, 0% 100%, 100% 0px;
676
- border-radius: 5px;
677
- padding: 10px;
678
- animation: ${selector}_dash_range 5s linear infinite;
679
- }
680
-
681
- @keyframes ${selector}_dash_range {
682
- to {
683
- background-position: 100% 0%, 0% 100%, 0% 0%, 100% 100%;
684
- }
685
- }
686
- </style>
687
- `;
688
- };
689
- const triangle = {
690
- up: ({ id, dim, color, classList, customStyle }) => {
691
- return html`<style class="style-${id}">
692
- .arrow-up-${id} {
693
- width: 0;
694
- height: 0;
695
- border-left: ${dim}px solid transparent;
696
- border-right: ${dim}px solid transparent;
697
- border-bottom: ${dim}px solid ${color};
698
- }
699
- </style>
700
- <div
701
- class="arrow-up-${id} ${classList}"
702
- ${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
703
- ></div>`;
704
- },
705
- down: ({ id, dim, color, classList, customStyle }) => {
706
- return html`<style class="style-${id}">
707
- .arrow-down-${id} {
708
- width: 0;
709
- height: 0;
710
- border-left: ${dim}px solid transparent;
711
- border-right: ${dim}px solid transparent;
712
- border-top: ${dim}px solid ${color};
713
- }
714
- </style>
715
- <div
716
- class="arrow-down-${id} ${classList}"
717
- ${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
718
- ></div>`;
719
- },
720
- right: ({ id, dim, color, classList, customStyle }) => {
721
- return html` <style class="style-${id}">
722
- .arrow-right-${id} {
723
- width: 0;
724
- height: 0;
725
- border-top: ${dim}px solid transparent;
726
- border-bottom: ${dim}px solid transparent;
727
- border-left: ${dim}px solid ${color};
728
- }
729
- </style>
730
- <div
731
- class="arrow-right-${id} ${classList}"
732
- ${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
733
- ></div>`;
734
- },
735
- left: ({ id, dim, color, classList, customStyle }) => {
736
- return html`<style class="style-${id}">
737
- .arrow-left-${id} {
738
- width: 0;
739
- height: 0;
740
- border-top: ${dim}px solid transparent;
741
- border-bottom: ${dim}px solid transparent;
742
- border-right: ${dim}px solid ${color};
743
- }
744
- </style>
745
- <div
746
- class="arrow-left-${id} ${classList}"
747
- ${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
748
- ></div>`;
749
- },
750
- };
751
-
752
- const getSectionsStringData = (offsetWidth, text) => {
753
- const sectionsIndex = [];
754
- const everyXChar = parseInt(offsetWidth / 4);
755
- const phraseArray = text
756
- .split('.')
757
- .map((t) => splitEveryXChar(t + '.', everyXChar, ['.', ' ']))
758
- .flat()
759
- .filter((p) => p !== '.' && p.trim());
760
-
761
- let currentIndex = [0];
762
- let pi = -1;
763
- for (const p of phraseArray) {
764
- pi++;
765
- if (p.indexOf('.') !== -1) {
766
- currentIndex.push(newInstance(pi));
767
- sectionsIndex.push(newInstance(currentIndex));
768
- if (phraseArray[pi + 1]) currentIndex = [newInstance(pi + 1)];
769
- else currentIndex = [];
770
- }
771
- }
772
- if (currentIndex[0] && !currentIndex[1]) {
773
- currentIndex[1] = phraseArray.length - 1;
774
- sectionsIndex.push(newInstance(currentIndex));
775
- }
776
- return { phraseArray, sectionsIndex };
777
- };
778
-
779
- const typeWriteSectionsString = ({ container, phraseArray, rangeArraySectionIndex }) =>
780
- new Promise((resolve) => {
781
- let cumulativeSeconds = 0;
782
- for (const index of range(...rangeArraySectionIndex)) {
783
- const subIdSalt = s4() + s4() + s4();
784
- const seconds = phraseArray[index].trim().length * 0.05;
785
- append(`.${container}`, html` <div class="${container}-${subIdSalt}"></div> `);
786
- setTimeout(async () => {
787
- if (s(`.${container}-${subIdSalt}`)) {
788
- append(`.${container}-${subIdSalt}`, html` <div class="render-typeWriter-${container}-${subIdSalt}"></div> `);
789
- await typeWriter({
790
- id: `typeWriter-${index}-${container}`,
791
- html: phraseArray[index].trim(),
792
- endHideBlink: index < rangeArraySectionIndex[1],
793
- seconds,
794
- container: `render-typeWriter-${container}-${subIdSalt}`,
795
- });
796
- }
797
- if (index === rangeArraySectionIndex[1]) resolve();
798
- }, cumulativeSeconds * 1000);
799
- cumulativeSeconds += seconds;
800
- }
801
- });
802
-
803
- const cssBrowserCodes = ['webkit', 'moz', 'ms', 'o'];
804
-
805
- const scrollBarLightRender = () => {
806
- return cssBrowserCodes
807
- .map(
808
- (b) =>
809
- html`<style>
810
- ::-` +
811
- b +
812
- `-scrollbar {
813
- width: 5px;
814
- height: 5px;
815
- }
816
-
817
- /* Track */
818
- ::-` +
819
- b +
820
- `-scrollbar-track {
821
- background: none !important;
822
- }
823
-
824
- /* Handle */
825
- ::-` +
826
- b +
827
- `-scrollbar-thumb {
828
- background: #15151557;
829
- border-radius: 3px;
830
- }
831
-
832
- /* Handle on hover */
833
- ::-` +
834
- b +
835
- `-scrollbar-thumb:hover {
836
- background: #4d4d4dbb;
837
- }
838
- </style>`,
839
- )
840
- .join('');
841
- };
842
-
843
- const scrollBarDarkRender = () => {
844
- return cssBrowserCodes
845
- .map(
846
- (b) =>
847
- html`<style>
848
- ::-` +
849
- b +
850
- `-scrollbar {
851
- width: 5px;
852
- height: 5px;
853
- /* line-height: 1em; */
854
- }
855
-
856
- /* Track */
857
- ::-` +
858
- b +
859
- `-scrollbar-track {
860
- background: none !important;
861
- }
862
-
863
- /* Handle */
864
- ::-` +
865
- b +
866
- `-scrollbar-thumb {
867
- background: #74747457;
868
- border-radius: 3px;
869
- }
870
-
871
- /* Handle on hover */
872
- ::-` +
873
- b +
874
- `-scrollbar-thumb:hover {
875
- background: #98989857;
876
- }
877
- </style>`,
878
- )
879
- .join('');
880
- };
881
-
882
- const renderWave = ({ id }) => {
883
- return html`
884
- <style>
885
- .wave-animation-container-${id} {
886
- height: 200px;
887
- }
888
- .wave-animation-container-${id} {
889
- background: linear-gradient(
890
- 315deg,
891
- rgba(101, 0, 94, 1) 3%,
892
- rgba(60, 132, 206, 1) 38%,
893
- rgba(48, 238, 226, 1) 68%,
894
- rgba(255, 25, 25, 1) 98%
895
- );
896
- animation: gradient-${id} 15s ease infinite;
897
- background-size: 400% 400%;
898
- overflow: hidden;
899
- }
900
-
901
- @keyframes gradient-${id} {
902
- 0% {
903
- background-position: 0% 0%;
904
- }
905
- 50% {
906
- background-position: 100% 100%;
907
- }
908
- 100% {
909
- background-position: 0% 0%;
910
- }
911
- }
912
-
913
- .wave-${id} {
914
- background: rgb(255 255 255 / 25%);
915
- border-radius: 1000% 1000% 0 0;
916
- width: 200%;
917
- height: 12em;
918
- animation: wave-${id} 10s -3s linear infinite;
919
- opacity: 0.8;
920
- bottom: 0;
921
- left: 0;
922
- top: 30%;
923
- }
924
-
925
- .wave-${id}:nth-of-type(2) {
926
- animation: wave-${id} 18s linear reverse infinite;
927
- opacity: 0.8;
928
- top: 50%;
929
- }
930
-
931
- .wave-${id}:nth-of-type(3) {
932
- animation: wave-${id} 20s -1s reverse infinite;
933
- opacity: 0.9;
934
- top: 70%;
935
- }
936
-
937
- @keyframes wave-${id} {
938
- 2% {
939
- transform: translateX(1);
940
- }
941
-
942
- 25% {
943
- transform: translateX(-25%);
944
- }
945
-
946
- 50% {
947
- transform: translateX(-50%);
948
- }
949
-
950
- 75% {
951
- transform: translateX(-25%);
952
- }
953
-
954
- 100% {
955
- transform: translateX(1);
956
- }
957
- }
958
- </style>
959
- <div class="in wave-animation-container-${id} ${id}">
960
- <div class="in wave-${id}"></div>
961
- <div class="abs wave-${id}"></div>
962
- <div class="abs wave-${id}"></div>
963
- </div>
964
- `;
965
- };
966
-
967
- const cssTokensEffect = {};
968
- const cssTokensContainer = {};
969
- const cssEffect = async (containerSelector, event) => {
970
- // Array.from(event.target.classList)
971
- let offsetX, offsetY;
972
- if (Array.from(event.srcElement.classList).includes('ripple') && cssTokensContainer[containerSelector]) {
973
- offsetX = cssTokensContainer[containerSelector].lastOffsetX;
974
- offsetY = cssTokensContainer[containerSelector].lastOffsetY;
975
- } else {
976
- cssTokensContainer[containerSelector] = { lastOffsetX: event.offsetX, lastOffsetY: event.offsetY };
977
- offsetX = event.offsetX;
978
- offsetY = event.offsetY;
979
- }
980
- const element = s(containerSelector);
981
- element.style.overflow = 'hidden';
982
- const id = getId(cssTokensEffect, 'btn-effect-');
983
- cssTokensEffect[id] = { containerSelector, event };
984
- append(containerSelector, html`<span class="abs ${id} ripple" style="display: none"></span>`);
985
- const circle = s(`.${id}`);
986
- circle.style.width = circle.style.height = `40px`;
987
- circle.style.left = `${offsetX}px`;
988
- circle.style.top = `${offsetY}px`;
989
- circle.style.display = null;
990
- setTimeout(() => {
991
- circle.remove();
992
- delete cssTokensEffect[id];
993
- }, 600);
994
- };
995
-
996
- export {
997
- Css,
998
- Themes,
999
- barLabels,
1000
- barConfig,
1001
- borderChar,
1002
- renderMediaQuery,
1003
- renderDefaultWindowsModalButtonContent,
1004
- renderStatus,
1005
- dynamicCol,
1006
- dynamicColTokens,
1007
- boxShadow,
1008
- addTheme,
1009
- darkTheme,
1010
- ThemeEvents,
1011
- TriggerThemeEvents,
1012
- ThemesScope,
1013
- renderBubbleDialog,
1014
- typeWriter,
1015
- renderStyleTag,
1016
- renderCssAttr,
1017
- getTranslate3d,
1018
- dashRange,
1019
- triangle,
1020
- getSectionsStringData,
1021
- typeWriteSectionsString,
1022
- cssBrowserCodes,
1023
- scrollBarDarkRender,
1024
- scrollBarLightRender,
1025
- renderWave,
1026
- cssEffect,
1027
- };
1
+ import { getId, newInstance, range, s4, splitEveryXChar } from './CommonJs.js';
2
+ import { CssCoreDark, CssCoreLight } from './CssCore.js';
3
+ import { DropDown } from './DropDown.js';
4
+ import { Modal } from './Modal.js';
5
+ import { Translate } from './Translate.js';
6
+ import { append, getProxyPath, htmls, s } from './VanillaJs.js';
7
+
8
+ let ThemesScope = [];
9
+
10
+ // https://css.github.io/csso/csso.html
11
+ // https://www.fontspace.com/
12
+ // https://www.1001fonts.com/
13
+
14
+ const Css = {
15
+ loadThemes: async function (themes = []) {
16
+ ThemesScope = [];
17
+ for (const themeOptions of themes) addTheme(themeOptions);
18
+ // if (!ThemesScope.find((t) => t.dark)) addTheme(CssCoreDark);
19
+ // if (!ThemesScope.find((t) => !t.dark)) addTheme(CssCoreLight);
20
+ if (ThemesScope.length === 0) {
21
+ addTheme(CssCoreDark);
22
+ addTheme(CssCoreLight);
23
+ }
24
+ const localStorageTheme = localStorage.getItem('_theme');
25
+ if (localStorageTheme && Themes[localStorageTheme]) {
26
+ const themeOption = ThemesScope.find((t) => t.theme === localStorageTheme);
27
+ if (themeOption) return await this.Init(themeOption);
28
+ }
29
+ await this.Init();
30
+ },
31
+ Init: async function (options) {
32
+ if (!options) options = ThemesScope[0];
33
+ const { theme } = options;
34
+ append(
35
+ 'body',
36
+ html`
37
+ <style>
38
+ html {
39
+ scroll-behavior: smooth;
40
+ }
41
+
42
+ body {
43
+ /* overscroll-behavior: contain; */
44
+ /* box-sizing: border-box; */
45
+ padding: 0px;
46
+ margin: 0px;
47
+ }
48
+
49
+ .fl {
50
+ position: relative;
51
+ display: flow-root;
52
+ }
53
+
54
+ .abs,
55
+ .in {
56
+ display: block;
57
+ }
58
+
59
+ .fll {
60
+ float: left;
61
+ }
62
+
63
+ .flr {
64
+ float: right;
65
+ }
66
+
67
+ .abs {
68
+ position: absolute;
69
+ }
70
+
71
+ .in,
72
+ .inl {
73
+ position: relative;
74
+ }
75
+
76
+ .inl {
77
+ display: inline-table;
78
+ display: -webkit-inline-table;
79
+ display: -moz-inline-table;
80
+ display: -ms-inline-table;
81
+ display: -o-inline-table;
82
+ }
83
+
84
+ .fix {
85
+ position: fixed;
86
+ display: block;
87
+ }
88
+
89
+ .stq {
90
+ position: sticky;
91
+ /* require defined at least top, bottom, left o right */
92
+ }
93
+
94
+ .wfa {
95
+ width: available;
96
+ width: -webkit-available;
97
+ width: -moz-available;
98
+ width: -ms-available;
99
+ width: -o-available;
100
+
101
+ width: fill-available;
102
+ width: -webkit-fill-available;
103
+ width: -moz-fill-available;
104
+ width: -ms-fill-available;
105
+ width: -o-fill-available;
106
+ }
107
+
108
+ .wft {
109
+ width: fit-content;
110
+ width: -webkit-fit-content;
111
+ width: -moz-fit-content;
112
+ width: -ms-fit-content;
113
+ width: -o-fit-content;
114
+ }
115
+
116
+ .wfm {
117
+ width: max-content;
118
+ width: -webkit-max-content;
119
+ width: -moz-max-content;
120
+ width: -ms-max-content;
121
+ width: -o-max-content;
122
+ }
123
+
124
+ .negative-color {
125
+ filter: invert(1);
126
+ -webkit-filter: invert(1);
127
+ -moz-filter: invert(1);
128
+ -ms-filter: invert(1);
129
+ -o-filter: invert(1);
130
+ }
131
+
132
+ .no-drag {
133
+ user-drag: none;
134
+ -webkit-user-drag: none;
135
+ -moz-user-drag: none;
136
+ -ms-user-drag: none;
137
+ -o-user-drag: none;
138
+ user-select: none;
139
+ -webkit-user-select: none;
140
+ -moz-user-select: none;
141
+ -ms-user-select: none;
142
+ -o-user-select: none;
143
+ }
144
+
145
+ .center {
146
+ transform: translate(-50%, -50%);
147
+ top: 50%;
148
+ left: 50%;
149
+ width: 100%;
150
+ text-align: center;
151
+ }
152
+
153
+ input {
154
+ outline: none !important;
155
+ border: none;
156
+ padding-block: 0;
157
+ padding-inline: 0;
158
+ }
159
+ input::file-selector-button {
160
+ outline: none !important;
161
+ border: none;
162
+ }
163
+
164
+ .hide {
165
+ display: none !important;
166
+ }
167
+ /*
168
+
169
+ placeholder
170
+
171
+ */
172
+
173
+ ::placeholder {
174
+ color: black;
175
+ opacity: 1;
176
+ /* Firefox */
177
+ background: none;
178
+ }
179
+
180
+ :-ms-input-placeholder {
181
+ /* Internet Explorer 10-11 */
182
+ color: black;
183
+ background: none;
184
+ }
185
+
186
+ ::-ms-input-placeholder {
187
+ /* Microsoft Edge */
188
+ color: black;
189
+ background: none;
190
+ }
191
+
192
+ /*
193
+
194
+ selection
195
+
196
+ */
197
+
198
+ ::-moz-selection {
199
+ /* Code for Firefox */
200
+ color: black;
201
+ background: rgb(208, 208, 208);
202
+ }
203
+
204
+ ::selection {
205
+ color: black;
206
+ background: rgb(208, 208, 208);
207
+ }
208
+
209
+ .lowercase {
210
+ text-transform: lowercase;
211
+ }
212
+ .uppercase {
213
+ text-transform: uppercase;
214
+ }
215
+ .capitalize {
216
+ text-transform: capitalize;
217
+ }
218
+
219
+ .bold {
220
+ font-weight: bold;
221
+ }
222
+
223
+ .m {
224
+ font-family: monospace;
225
+ }
226
+
227
+ .gray {
228
+ filter: grayscale(1);
229
+ }
230
+ </style>
231
+ <div class="session">
232
+ <style>
233
+ .session-in-log-out {
234
+ display: block;
235
+ }
236
+ .session-inl-log-out {
237
+ display: inline-table;
238
+ }
239
+ .session-fl-log-out {
240
+ display: flow-root;
241
+ }
242
+ .session-in-log-in {
243
+ display: none;
244
+ }
245
+ .session-inl-log-in {
246
+ display: none;
247
+ }
248
+ .session-fl-log-in {
249
+ display: none;
250
+ }
251
+ </style>
252
+ </div>
253
+ <div class="theme"></div>
254
+ `,
255
+ );
256
+ return await Themes[theme](options);
257
+ },
258
+ RenderSetting: async function () {
259
+ return html` <div class="in section-mp">
260
+ ${await DropDown.Render({
261
+ id: 'settings-theme',
262
+ value: Css.currentTheme,
263
+ label: html`${Translate.Render('theme')}`,
264
+ data: ThemesScope.map((themeOption) => {
265
+ return {
266
+ display: html`<i class="fa-solid fa-brush"></i> ${themeOption.theme}`,
267
+ value: themeOption.theme,
268
+ onClick: async () => await Themes[themeOption.theme](),
269
+ };
270
+ }),
271
+ })}
272
+ </div>`;
273
+ },
274
+ };
275
+
276
+ const barLabels = (options) => {
277
+ return {
278
+ img: {
279
+ close: html`<img
280
+ class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
281
+ src="${getProxyPath()}assets/icons/close.png"
282
+ />`,
283
+ maximize: html`<img
284
+ class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
285
+ src="${getProxyPath()}assets/icons/maximize.png"
286
+ />`,
287
+ minimize: html`<img
288
+ class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
289
+ src="${getProxyPath()}assets/icons/minimize.png"
290
+ />`,
291
+ restore: html`<img
292
+ class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
293
+ src="${getProxyPath()}assets/icons/restore.png"
294
+ />`,
295
+ menu: html`<img
296
+ class="inl bar-default-modal-icon ${options.iconClass ? options.iconClass : ''}"
297
+ src="${getProxyPath()}assets/icons/menu.png"
298
+ />`,
299
+ },
300
+ fontawesome: {
301
+ close: html`<i class="fa-solid fa-xmark ${options.iconClass ? options.iconClass : ''}"></i>`,
302
+ maximize: html`<i class="fa-regular fa-square ${options.iconClass ? options.iconClass : ''}"></i>`,
303
+ minimize: html`<i class="fa-solid fa-window-minimize ${options.iconClass ? options.iconClass : ''}"></i>`,
304
+ restore: html`<i class="fa-regular fa-window-restore ${options.iconClass ? options.iconClass : ''}"></i>`,
305
+ menu: html`<i class="fa-solid fa-bars ${options.iconClass ? options.iconClass : ''}"></i>`,
306
+ },
307
+ default: {
308
+ close: html`X`,
309
+ maximize: html`▢`,
310
+ minimize: html`_`,
311
+ restore: html`□`,
312
+ menu: html`≡`,
313
+ },
314
+ };
315
+ };
316
+
317
+ const barConfig = (options) => {
318
+ const { barButtonsIconTheme } = options;
319
+ return {
320
+ buttons: {
321
+ close: {
322
+ disabled: false,
323
+ label: barLabels(options)[barButtonsIconTheme].close,
324
+ },
325
+ maximize: {
326
+ disabled: false,
327
+ label: barLabels(options)[barButtonsIconTheme].maximize,
328
+ },
329
+ minimize: {
330
+ disabled: false,
331
+ label: barLabels(options)[barButtonsIconTheme].minimize,
332
+ },
333
+ restore: {
334
+ disabled: false,
335
+ label: barLabels(options)[barButtonsIconTheme].restore,
336
+ },
337
+ menu: {
338
+ disabled: true,
339
+ label: barLabels(options)[barButtonsIconTheme].menu,
340
+ },
341
+ },
342
+ };
343
+ };
344
+
345
+ const renderDefaultWindowsModalButtonContent = (options) => {
346
+ const { barButtonsIconTheme, htmlRender } = options;
347
+ const barConfigInstance = barConfig(options);
348
+ if (htmlRender)
349
+ Object.keys(Modal.Data).map((idModal) => {
350
+ if (s(`.btn-minimize-${idModal}`)) htmls(`.btn-minimize-${idModal}`, barConfigInstance.buttons.minimize.label);
351
+ if (s(`.btn-restore-${idModal}`)) htmls(`.btn-restore-${idModal}`, barConfigInstance.buttons.restore.label);
352
+ if (s(`.btn-maximize-${idModal}`)) htmls(`.btn-maximize-${idModal}`, barConfigInstance.buttons.maximize.label);
353
+ if (s(`.btn-close-${idModal}`)) htmls(`.btn-close-${idModal}`, barConfigInstance.buttons.close.label);
354
+ if (s(`.btn-menu-${idModal}`)) htmls(`.btn-menu-${idModal}`, barConfigInstance.buttons.menu.label);
355
+ });
356
+ return { barConfig: barConfigInstance };
357
+ };
358
+
359
+ let darkTheme = true;
360
+ const ThemeEvents = {};
361
+ const TriggerThemeEvents = () => {
362
+ localStorage.setItem('_theme', Css.currentTheme);
363
+ Object.keys(ThemeEvents).map((keyEvent) => ThemeEvents[keyEvent]());
364
+ };
365
+
366
+ const Themes = {};
367
+
368
+ const addTheme = (options) => {
369
+ ThemesScope.push(options);
370
+ Themes[options.theme] = async (barOptions) => {
371
+ if (!options.dark) options.dark = false;
372
+ if (!options.barButtonsIconTheme) options.barButtonsIconTheme = 'fontawesome';
373
+ const htmlRender = Css.currentTheme !== options.theme;
374
+ if (htmlRender) {
375
+ Css.currentTheme = options.theme;
376
+ darkTheme = options.dark;
377
+ let render = '';
378
+ if (!['core', 'css-core'].includes(options.theme))
379
+ render += darkTheme ? await CssCoreDark.render() : await CssCoreLight.render();
380
+ render += await options.render();
381
+ htmls('.theme', render);
382
+ TriggerThemeEvents();
383
+ }
384
+ return {
385
+ ...renderDefaultWindowsModalButtonContent({
386
+ barButtonsIconTheme: options.barButtonsIconTheme,
387
+ htmlRender,
388
+ ...barOptions,
389
+ }),
390
+ };
391
+ };
392
+ };
393
+
394
+ const borderChar = (px, color, selectors) => {
395
+ if (selectors) {
396
+ return selectors
397
+ .map(
398
+ (selector) => html`
399
+ <style>
400
+ ${selector} {
401
+ text-shadow: ${px}px -${px}px ${px}px ${color}, -${px}px ${px}px ${px}px ${color},
402
+ -${px}px -${px}px ${px}px ${color}, ${px}px ${px}px ${px}px ${color};
403
+ }
404
+ </style>
405
+ `,
406
+ )
407
+ .join('');
408
+ }
409
+ return html`
410
+ text-shadow: ${px}px -${px}px ${px}px ${color}, -${px}px ${px}px ${px}px ${color}, -${px}px -${px}px ${px}px
411
+ ${color}, ${px}px ${px}px ${px}px ${color};
412
+ `;
413
+ };
414
+
415
+ const boxShadow = ({ selector }) => html`
416
+ <style>
417
+ ${selector} {
418
+ box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
419
+ }
420
+ ${selector}:hover {
421
+ box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 10px 30px 0 rgba(0, 0, 0, 0.3);
422
+ }
423
+ </style>
424
+ `;
425
+
426
+ const renderMediaQuery = (mediaData) => {
427
+ // first limit should be '0'
428
+ return html`
429
+ ${mediaData
430
+ .map(
431
+ (mediaState) => html`
432
+ <style>
433
+ @media only screen and (min-width: ${mediaState.limit}px) {
434
+ ${mediaState.css}
435
+ }
436
+ </style>
437
+ `,
438
+ )
439
+ .join('')}
440
+ `;
441
+ };
442
+
443
+ const renderStatus = (status, options) => {
444
+ switch (status) {
445
+ case 'success':
446
+ return html`<div class="${options?.class ? options.class : 'abs center'}">
447
+ <i style="color: green" class="fa-solid fa-check"></i>
448
+ </div>`;
449
+ case 'error':
450
+ return html`<div class="${options?.class ? options.class : 'abs center'}">
451
+ <i style="color: red" class="fa-solid fa-xmark"></i>
452
+ </div>`;
453
+ case 'warning':
454
+ return html`<div class="${options?.class ? options.class : 'abs center'}">
455
+ <i style="color: yellow" class="fa-solid fa-triangle-exclamation"></i>
456
+ </div>`;
457
+ default:
458
+ return html``;
459
+ }
460
+ };
461
+
462
+ const dynamicColTokens = {};
463
+
464
+ const dynamicCol = (options = { containerSelector: '', id: '', type: '', limit: 900 }) => {
465
+ const { containerSelector, id } = options;
466
+ const limitCol = options?.limit ? options.limit : 900;
467
+ if (!(id in dynamicColTokens)) dynamicColTokens[id] = {};
468
+ dynamicColTokens[id].options = options;
469
+ if (dynamicColTokens[id].observer) dynamicColTokens[id].observer.disconnect();
470
+ setTimeout(() => {
471
+ dynamicColTokens[id].observer = new ResizeObserver(() => {
472
+ if (s(`.${containerSelector}`)) {
473
+ switch (options.type) {
474
+ case 'a-50-b-50':
475
+ if (s(`.${containerSelector}`).offsetWidth < limitCol)
476
+ htmls(
477
+ `.style-${id}-col`,
478
+ css`
479
+ .${id}-col-a, .${id}-col-b {
480
+ width: 100%;
481
+ }
482
+ `,
483
+ );
484
+ else
485
+ htmls(
486
+ `.style-${id}-col`,
487
+ css`
488
+ .${id}-col-a {
489
+ width: 50%;
490
+ }
491
+ .${id}-col-b {
492
+ width: 50%;
493
+ }
494
+ `,
495
+ );
496
+ break;
497
+
498
+ default:
499
+ if (s(`.${containerSelector}`).offsetWidth < 900)
500
+ htmls(
501
+ `.style-${id}-col`,
502
+ css`
503
+ .${id}-col-a, .${id}-col-b {
504
+ width: 100%;
505
+ }
506
+ `,
507
+ );
508
+ else
509
+ htmls(
510
+ `.style-${id}-col`,
511
+ css`
512
+ .${id}-col-a {
513
+ width: 30%;
514
+ }
515
+ .${id}-col-b {
516
+ width: 70%;
517
+ }
518
+ `,
519
+ );
520
+ break;
521
+ }
522
+ } else {
523
+ dynamicColTokens[id].observer.disconnect();
524
+ delete dynamicColTokens[id];
525
+ if (s(`.style-${id}-col`)) s(`.style-${id}-col`).remove();
526
+ }
527
+ });
528
+ dynamicColTokens[id].observer.observe(s(`.${containerSelector}`));
529
+ });
530
+ return html` <style class="style-${id}-col"></style>`;
531
+ };
532
+
533
+ const renderBubbleDialog = async function (
534
+ options = {
535
+ id: '',
536
+ html: async () => '',
537
+ classSelectors,
538
+ triangleType: 'down',
539
+ trianglePositionCss: '',
540
+ triangleCss: '',
541
+ triangleDim: 0,
542
+ bubbleCss: '',
543
+ },
544
+ ) {
545
+ const { id, html } = options;
546
+ let cssTrianglePosition = `
547
+ bottom: -45px;
548
+ left: 5px;
549
+ `;
550
+ let whiteTriangleStyle = `top: 43%`;
551
+ let blackTriangleStyle = ``;
552
+ switch (options.triangleType) {
553
+ case 'right':
554
+ cssTrianglePosition = `
555
+ right: -40px;
556
+ top: 5px;
557
+ `;
558
+ blackTriangleStyle = `
559
+ top: 43%;
560
+ left: 57%;
561
+ `;
562
+ break;
563
+
564
+ default:
565
+ break;
566
+ }
567
+ if (options.trianglePositionCss) cssTrianglePosition = options.trianglePositionCss;
568
+ return html` <div
569
+ class="${options?.classSelectors ? options.classSelectors : 'inl'} bubble-dialog bubble-dialog-${id}"
570
+ ${options.bubbleCss ? `style='${options.bubbleCss}'` : ''}
571
+ >
572
+ <style class="style-bubble-dialog-triangle-${id}">
573
+ .bubble-dialog-triangle-${id} {
574
+ width: ${options.triangleDim ? options.triangleDim : 60}px;
575
+ height: ${options.triangleDim ? options.triangleDim : 60}px;
576
+ /* border: 2px solid red; */
577
+ box-sizing: border-box;
578
+ ${cssTrianglePosition}
579
+ }
580
+ </style>
581
+ <div class="abs bubble-dialog-triangle bubble-dialog-triangle-${id}">
582
+ <div class="abs center" style="${blackTriangleStyle}">
583
+ ${triangle[options?.triangleType ? options.triangleType : 'down']({
584
+ dim: 25,
585
+ id: id + '-triangle-black',
586
+ color: 'black',
587
+ classList: 'inl',
588
+ customStyle: options.triangleCss,
589
+ })}
590
+ </div>
591
+ <div class="abs center" style="${whiteTriangleStyle}">
592
+ ${triangle[options?.triangleType ? options.triangleType : 'down']({
593
+ dim: 24,
594
+ id: id + '-triangle-white',
595
+ color: 'white',
596
+ classList: 'inl',
597
+ customStyle: options.triangleCss,
598
+ })}
599
+ </div>
600
+ </div>
601
+ ${await html()}
602
+ </div>`;
603
+ };
604
+
605
+ const typeWriter = async function ({ id, html, seconds, endHideBlink, container }) {
606
+ if (!seconds) seconds = 2;
607
+ return new Promise((resolve) => {
608
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function
609
+ // https://www.w3schools.com/cssref/css3_pr_animation-fill-mode.php
610
+ const typingAnimationTransitionStyle = [`1s linear`, `${seconds}s steps(30, end)`, `1s forwards`];
611
+ const render = html`
612
+ <style class="style-${id}">
613
+ .tw-${id}-typed-out {
614
+ overflow: hidden;
615
+ border-right: 0.15em solid orange;
616
+ white-space: nowrap;
617
+ animation: typing-${id} ${typingAnimationTransitionStyle[1]}, blink-caret-${id} 0.5s step-end infinite;
618
+ animation-fill-mode: forwards;
619
+ width: 0;
620
+ }
621
+ </style>
622
+ <style>
623
+ .tw-${id}-container {
624
+ }
625
+ @keyframes typing-${id} {
626
+ from {
627
+ width: 0;
628
+ }
629
+ to {
630
+ width: 100%;
631
+ }
632
+ }
633
+
634
+ @keyframes blink-caret-${id} {
635
+ from,
636
+ to {
637
+ border-color: transparent;
638
+ }
639
+ 50% {
640
+ border-color: orange;
641
+ }
642
+ }
643
+ </style>
644
+ <div class="inl tw-${id}-container">
645
+ <div class="tw-${id}-typed-out">${html}</div>
646
+ </div>
647
+ `;
648
+ htmls(`.${container}`, render);
649
+ setTimeout(() => {
650
+ if (endHideBlink && s(`.style-${id}`)) s(`.style-${id}`).remove();
651
+ resolve(render);
652
+ }, seconds * 1000);
653
+ });
654
+ };
655
+
656
+ const renderCssAttr = (options) =>
657
+ `${
658
+ options && options.style
659
+ ? Object.keys(options.style)
660
+ .map((keyStyle) => `${keyStyle}: ${options.style[keyStyle]};`)
661
+ .join(`\n`)
662
+ : ''
663
+ }`;
664
+
665
+ const renderStyleTag = (styleSelector = 'style-abc', selector, options) =>
666
+ html`<style class="${styleSelector}">
667
+ ${selector} { ${renderCssAttr(options)} }
668
+ </style>`;
669
+
670
+ function getTranslate3d(el) {
671
+ const values = el.style.transform.split(/\w+\(|\);?/);
672
+ if (!values[1] || !values[1].length) {
673
+ return [];
674
+ }
675
+ return values[1].split(/,\s?/g);
676
+ }
677
+
678
+ const dashRange = ({ selector, color }) => {
679
+ return html`
680
+ <style>
681
+ .${selector} {
682
+ background: linear-gradient(90deg, ${color} 50%, transparent 50%),
683
+ linear-gradient(90deg, ${color} 50%, transparent 50%), linear-gradient(0deg, ${color} 50%, transparent 50%),
684
+ linear-gradient(0deg, ${color} 50%, transparent 50%);
685
+ background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
686
+ background-size: 16px 4px, 16px 4px, 4px 16px, 4px 16px;
687
+ background-position: 0% 0%, 100% 100%, 0% 100%, 100% 0px;
688
+ border-radius: 5px;
689
+ padding: 10px;
690
+ animation: ${selector}_dash_range 5s linear infinite;
691
+ }
692
+
693
+ @keyframes ${selector}_dash_range {
694
+ to {
695
+ background-position: 100% 0%, 0% 100%, 0% 0%, 100% 100%;
696
+ }
697
+ }
698
+ </style>
699
+ `;
700
+ };
701
+ const triangle = {
702
+ up: ({ id, dim, color, classList, customStyle }) => {
703
+ return html`<style class="style-${id}">
704
+ .arrow-up-${id} {
705
+ width: 0;
706
+ height: 0;
707
+ border-left: ${dim}px solid transparent;
708
+ border-right: ${dim}px solid transparent;
709
+ border-bottom: ${dim}px solid ${color};
710
+ }
711
+ </style>
712
+ <div
713
+ class="arrow-up-${id} ${classList}"
714
+ ${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
715
+ ></div>`;
716
+ },
717
+ down: ({ id, dim, color, classList, customStyle }) => {
718
+ return html`<style class="style-${id}">
719
+ .arrow-down-${id} {
720
+ width: 0;
721
+ height: 0;
722
+ border-left: ${dim}px solid transparent;
723
+ border-right: ${dim}px solid transparent;
724
+ border-top: ${dim}px solid ${color};
725
+ }
726
+ </style>
727
+ <div
728
+ class="arrow-down-${id} ${classList}"
729
+ ${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
730
+ ></div>`;
731
+ },
732
+ right: ({ id, dim, color, classList, customStyle }) => {
733
+ return html` <style class="style-${id}">
734
+ .arrow-right-${id} {
735
+ width: 0;
736
+ height: 0;
737
+ border-top: ${dim}px solid transparent;
738
+ border-bottom: ${dim}px solid transparent;
739
+ border-left: ${dim}px solid ${color};
740
+ }
741
+ </style>
742
+ <div
743
+ class="arrow-right-${id} ${classList}"
744
+ ${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
745
+ ></div>`;
746
+ },
747
+ left: ({ id, dim, color, classList, customStyle }) => {
748
+ return html`<style class="style-${id}">
749
+ .arrow-left-${id} {
750
+ width: 0;
751
+ height: 0;
752
+ border-top: ${dim}px solid transparent;
753
+ border-bottom: ${dim}px solid transparent;
754
+ border-right: ${dim}px solid ${color};
755
+ }
756
+ </style>
757
+ <div
758
+ class="arrow-left-${id} ${classList}"
759
+ ${customStyle ? `style="${customStyle ? customStyle : ''}"` : ''}
760
+ ></div>`;
761
+ },
762
+ };
763
+
764
+ const getSectionsStringData = (offsetWidth, text) => {
765
+ const sectionsIndex = [];
766
+ const everyXChar = parseInt(offsetWidth / 4);
767
+ const phraseArray = text
768
+ .split('.')
769
+ .map((t) => splitEveryXChar(t + '.', everyXChar, ['.', ' ']))
770
+ .flat()
771
+ .filter((p) => p !== '.' && p.trim());
772
+
773
+ let currentIndex = [0];
774
+ let pi = -1;
775
+ for (const p of phraseArray) {
776
+ pi++;
777
+ if (p.indexOf('.') !== -1) {
778
+ currentIndex.push(newInstance(pi));
779
+ sectionsIndex.push(newInstance(currentIndex));
780
+ if (phraseArray[pi + 1]) currentIndex = [newInstance(pi + 1)];
781
+ else currentIndex = [];
782
+ }
783
+ }
784
+ if (currentIndex[0] && !currentIndex[1]) {
785
+ currentIndex[1] = phraseArray.length - 1;
786
+ sectionsIndex.push(newInstance(currentIndex));
787
+ }
788
+ return { phraseArray, sectionsIndex };
789
+ };
790
+
791
+ const typeWriteSectionsString = ({ container, phraseArray, rangeArraySectionIndex }) =>
792
+ new Promise((resolve) => {
793
+ let cumulativeSeconds = 0;
794
+ for (const index of range(...rangeArraySectionIndex)) {
795
+ const subIdSalt = s4() + s4() + s4();
796
+ const seconds = phraseArray[index].trim().length * 0.05;
797
+ append(`.${container}`, html` <div class="${container}-${subIdSalt}"></div> `);
798
+ setTimeout(async () => {
799
+ if (s(`.${container}-${subIdSalt}`)) {
800
+ append(`.${container}-${subIdSalt}`, html` <div class="render-typeWriter-${container}-${subIdSalt}"></div> `);
801
+ await typeWriter({
802
+ id: `typeWriter-${index}-${container}`,
803
+ html: phraseArray[index].trim(),
804
+ endHideBlink: index < rangeArraySectionIndex[1],
805
+ seconds,
806
+ container: `render-typeWriter-${container}-${subIdSalt}`,
807
+ });
808
+ }
809
+ if (index === rangeArraySectionIndex[1]) resolve();
810
+ }, cumulativeSeconds * 1000);
811
+ cumulativeSeconds += seconds;
812
+ }
813
+ });
814
+
815
+ const cssBrowserCodes = ['webkit', 'moz', 'ms', 'o'];
816
+
817
+ const scrollBarLightRender = () => {
818
+ return cssBrowserCodes
819
+ .map(
820
+ (b) =>
821
+ html`<style>
822
+ ::-` +
823
+ b +
824
+ `-scrollbar {
825
+ width: 5px;
826
+ height: 5px;
827
+ }
828
+
829
+ /* Track */
830
+ ::-` +
831
+ b +
832
+ `-scrollbar-track {
833
+ background: none !important;
834
+ }
835
+
836
+ /* Handle */
837
+ ::-` +
838
+ b +
839
+ `-scrollbar-thumb {
840
+ background: #15151557;
841
+ border-radius: 3px;
842
+ }
843
+
844
+ /* Handle on hover */
845
+ ::-` +
846
+ b +
847
+ `-scrollbar-thumb:hover {
848
+ background: #4d4d4dbb;
849
+ }
850
+ </style>`,
851
+ )
852
+ .join('');
853
+ };
854
+
855
+ const scrollBarDarkRender = () => {
856
+ return cssBrowserCodes
857
+ .map(
858
+ (b) =>
859
+ html`<style>
860
+ ::-` +
861
+ b +
862
+ `-scrollbar {
863
+ width: 5px;
864
+ height: 5px;
865
+ /* line-height: 1em; */
866
+ }
867
+
868
+ /* Track */
869
+ ::-` +
870
+ b +
871
+ `-scrollbar-track {
872
+ background: none !important;
873
+ }
874
+
875
+ /* Handle */
876
+ ::-` +
877
+ b +
878
+ `-scrollbar-thumb {
879
+ background: #74747457;
880
+ border-radius: 3px;
881
+ }
882
+
883
+ /* Handle on hover */
884
+ ::-` +
885
+ b +
886
+ `-scrollbar-thumb:hover {
887
+ background: #98989857;
888
+ }
889
+ </style>`,
890
+ )
891
+ .join('');
892
+ };
893
+
894
+ const renderWave = ({ id }) => {
895
+ return html`
896
+ <style>
897
+ .wave-animation-container-${id} {
898
+ height: 200px;
899
+ }
900
+ .wave-animation-container-${id} {
901
+ background: linear-gradient(
902
+ 315deg,
903
+ rgba(101, 0, 94, 1) 3%,
904
+ rgba(60, 132, 206, 1) 38%,
905
+ rgba(48, 238, 226, 1) 68%,
906
+ rgba(255, 25, 25, 1) 98%
907
+ );
908
+ animation: gradient-${id} 15s ease infinite;
909
+ background-size: 400% 400%;
910
+ overflow: hidden;
911
+ }
912
+
913
+ @keyframes gradient-${id} {
914
+ 0% {
915
+ background-position: 0% 0%;
916
+ }
917
+ 50% {
918
+ background-position: 100% 100%;
919
+ }
920
+ 100% {
921
+ background-position: 0% 0%;
922
+ }
923
+ }
924
+
925
+ .wave-${id} {
926
+ background: rgb(255 255 255 / 25%);
927
+ border-radius: 1000% 1000% 0 0;
928
+ width: 200%;
929
+ height: 12em;
930
+ animation: wave-${id} 10s -3s linear infinite;
931
+ opacity: 0.8;
932
+ bottom: 0;
933
+ left: 0;
934
+ top: 30%;
935
+ }
936
+
937
+ .wave-${id}:nth-of-type(2) {
938
+ animation: wave-${id} 18s linear reverse infinite;
939
+ opacity: 0.8;
940
+ top: 50%;
941
+ }
942
+
943
+ .wave-${id}:nth-of-type(3) {
944
+ animation: wave-${id} 20s -1s reverse infinite;
945
+ opacity: 0.9;
946
+ top: 70%;
947
+ }
948
+
949
+ @keyframes wave-${id} {
950
+ 2% {
951
+ transform: translateX(1);
952
+ }
953
+
954
+ 25% {
955
+ transform: translateX(-25%);
956
+ }
957
+
958
+ 50% {
959
+ transform: translateX(-50%);
960
+ }
961
+
962
+ 75% {
963
+ transform: translateX(-25%);
964
+ }
965
+
966
+ 100% {
967
+ transform: translateX(1);
968
+ }
969
+ }
970
+ </style>
971
+ <div class="in wave-animation-container-${id} ${id}">
972
+ <div class="in wave-${id}"></div>
973
+ <div class="abs wave-${id}"></div>
974
+ <div class="abs wave-${id}"></div>
975
+ </div>
976
+ `;
977
+ };
978
+
979
+ const cssTokensEffect = {};
980
+ const cssTokensContainer = {};
981
+ const cssEffect = async (containerSelector, event) => {
982
+ // Array.from(event.target.classList)
983
+ let offsetX, offsetY;
984
+ if (Array.from(event.srcElement.classList).includes('ripple') && cssTokensContainer[containerSelector]) {
985
+ offsetX = cssTokensContainer[containerSelector].lastOffsetX;
986
+ offsetY = cssTokensContainer[containerSelector].lastOffsetY;
987
+ } else {
988
+ cssTokensContainer[containerSelector] = { lastOffsetX: event.offsetX, lastOffsetY: event.offsetY };
989
+ offsetX = event.offsetX;
990
+ offsetY = event.offsetY;
991
+ }
992
+ const element = s(containerSelector);
993
+ // element.style.overflow = 'hidden';
994
+ const id = getId(cssTokensEffect, 'btn-effect-');
995
+ cssTokensEffect[id] = { containerSelector, event };
996
+ append(containerSelector, html`<span class="abs ${id} ripple" style="display: none"></span>`);
997
+ const circle = s(`.${id}`);
998
+ circle.style.width = circle.style.height = `40px`;
999
+ circle.style.left = `${offsetX}px`;
1000
+ circle.style.top = `${offsetY}px`;
1001
+ circle.style.display = null;
1002
+ setTimeout(() => {
1003
+ circle.remove();
1004
+ delete cssTokensEffect[id];
1005
+ }, 600);
1006
+ };
1007
+
1008
+ const imageShimmer = () => html`<div
1009
+ class="abs center ssr-shimmer-search-box"
1010
+ style="${renderCssAttr({
1011
+ style: {
1012
+ width: '95%',
1013
+ height: '95%',
1014
+ 'border-radius': '10px',
1015
+ overflow: 'hidden',
1016
+ },
1017
+ })}"
1018
+ >
1019
+ <div
1020
+ class="abs center"
1021
+ style="${renderCssAttr({
1022
+ style: {
1023
+ 'font-size': '70px',
1024
+ color: `#bababa`,
1025
+ },
1026
+ })}"
1027
+ >
1028
+ <i class="fa-solid fa-photo-film"></i>
1029
+ </div>
1030
+ </div>`;
1031
+
1032
+ export {
1033
+ Css,
1034
+ Themes,
1035
+ barLabels,
1036
+ barConfig,
1037
+ borderChar,
1038
+ renderMediaQuery,
1039
+ renderDefaultWindowsModalButtonContent,
1040
+ renderStatus,
1041
+ dynamicCol,
1042
+ dynamicColTokens,
1043
+ boxShadow,
1044
+ addTheme,
1045
+ darkTheme,
1046
+ ThemeEvents,
1047
+ TriggerThemeEvents,
1048
+ ThemesScope,
1049
+ renderBubbleDialog,
1050
+ typeWriter,
1051
+ renderStyleTag,
1052
+ renderCssAttr,
1053
+ getTranslate3d,
1054
+ dashRange,
1055
+ triangle,
1056
+ getSectionsStringData,
1057
+ typeWriteSectionsString,
1058
+ cssBrowserCodes,
1059
+ scrollBarDarkRender,
1060
+ scrollBarLightRender,
1061
+ renderWave,
1062
+ cssEffect,
1063
+ imageShimmer,
1064
+ };