@underpostnet/underpost 2.7.82

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 (290) hide show
  1. package/.dockerignore +14 -0
  2. package/.env.development +6 -0
  3. package/.env.production +6 -0
  4. package/.env.test +6 -0
  5. package/.github/workflows/ghpkg.yml +75 -0
  6. package/.github/workflows/publish.yml +84 -0
  7. package/.github/workflows/pwa-microservices-template.test.yml +30 -0
  8. package/.nycrc +9 -0
  9. package/.prettierignore +13 -0
  10. package/.prettierrc +9 -0
  11. package/.vscode/extensions.json +72 -0
  12. package/.vscode/settings.json +100 -0
  13. package/AUTHORS.md +10 -0
  14. package/CHANGELOG.md +37 -0
  15. package/Dockerfile +90 -0
  16. package/LICENSE +21 -0
  17. package/README.md +96 -0
  18. package/bin/db.js +172 -0
  19. package/bin/deploy.js +674 -0
  20. package/bin/file.js +93 -0
  21. package/bin/index.js +82 -0
  22. package/bin/ssl.js +55 -0
  23. package/bin/util.js +182 -0
  24. package/bin/vs.js +35 -0
  25. package/conf.js +251 -0
  26. package/docker-compose.yml +67 -0
  27. package/jsconfig.json +7 -0
  28. package/jsdoc.json +32 -0
  29. package/nodemon.json +6 -0
  30. package/package.json +134 -0
  31. package/prometheus.yml +36 -0
  32. package/src/api/core/core.controller.js +69 -0
  33. package/src/api/core/core.model.js +11 -0
  34. package/src/api/core/core.router.js +23 -0
  35. package/src/api/core/core.service.js +29 -0
  36. package/src/api/crypto/crypto.controller.js +51 -0
  37. package/src/api/crypto/crypto.model.js +23 -0
  38. package/src/api/crypto/crypto.router.js +20 -0
  39. package/src/api/crypto/crypto.service.js +64 -0
  40. package/src/api/default/default.controller.js +69 -0
  41. package/src/api/default/default.model.js +20 -0
  42. package/src/api/default/default.router.js +23 -0
  43. package/src/api/default/default.service.js +31 -0
  44. package/src/api/file/file.controller.js +53 -0
  45. package/src/api/file/file.model.js +19 -0
  46. package/src/api/file/file.router.js +21 -0
  47. package/src/api/file/file.service.js +80 -0
  48. package/src/api/instance/instance.controller.js +69 -0
  49. package/src/api/instance/instance.model.js +36 -0
  50. package/src/api/instance/instance.router.js +33 -0
  51. package/src/api/instance/instance.service.js +48 -0
  52. package/src/api/test/test.controller.js +59 -0
  53. package/src/api/test/test.model.js +14 -0
  54. package/src/api/test/test.router.js +21 -0
  55. package/src/api/test/test.service.js +35 -0
  56. package/src/api/user/user.build.js +16 -0
  57. package/src/api/user/user.controller.js +70 -0
  58. package/src/api/user/user.model.js +65 -0
  59. package/src/api/user/user.router.js +345 -0
  60. package/src/api/user/user.service.js +479 -0
  61. package/src/api.js +23 -0
  62. package/src/client/Default.index.js +40 -0
  63. package/src/client/components/core/Account.js +290 -0
  64. package/src/client/components/core/AgGrid.js +160 -0
  65. package/src/client/components/core/Auth.js +19 -0
  66. package/src/client/components/core/Badge.js +32 -0
  67. package/src/client/components/core/Blockchain.js +41 -0
  68. package/src/client/components/core/Blog.js +9 -0
  69. package/src/client/components/core/BtnIcon.js +101 -0
  70. package/src/client/components/core/CalendarCore.js +458 -0
  71. package/src/client/components/core/Chat.js +64 -0
  72. package/src/client/components/core/ColorPalette.js +5267 -0
  73. package/src/client/components/core/CommonJs.js +742 -0
  74. package/src/client/components/core/Content.js +193 -0
  75. package/src/client/components/core/Css.js +846 -0
  76. package/src/client/components/core/CssCore.js +817 -0
  77. package/src/client/components/core/D3Chart.js +44 -0
  78. package/src/client/components/core/Docs.js +231 -0
  79. package/src/client/components/core/DropDown.js +164 -0
  80. package/src/client/components/core/EventsUI.js +46 -0
  81. package/src/client/components/core/FileExplorer.js +699 -0
  82. package/src/client/components/core/FullScreen.js +45 -0
  83. package/src/client/components/core/Input.js +346 -0
  84. package/src/client/components/core/JoyStick.js +77 -0
  85. package/src/client/components/core/Keyboard.js +73 -0
  86. package/src/client/components/core/LoadingAnimation.js +178 -0
  87. package/src/client/components/core/LogIn.js +187 -0
  88. package/src/client/components/core/LogOut.js +58 -0
  89. package/src/client/components/core/Logger.js +26 -0
  90. package/src/client/components/core/Modal.js +1612 -0
  91. package/src/client/components/core/NotificationManager.js +84 -0
  92. package/src/client/components/core/Panel.js +613 -0
  93. package/src/client/components/core/PanelForm.js +468 -0
  94. package/src/client/components/core/Polyhedron.js +162 -0
  95. package/src/client/components/core/Recover.js +204 -0
  96. package/src/client/components/core/Responsive.js +53 -0
  97. package/src/client/components/core/RichText.js +51 -0
  98. package/src/client/components/core/Router.js +76 -0
  99. package/src/client/components/core/Scroll.js +34 -0
  100. package/src/client/components/core/SignUp.js +125 -0
  101. package/src/client/components/core/SocketIo.js +72 -0
  102. package/src/client/components/core/Stream.js +113 -0
  103. package/src/client/components/core/ToggleSwitch.js +87 -0
  104. package/src/client/components/core/ToolTip.js +26 -0
  105. package/src/client/components/core/Translate.js +446 -0
  106. package/src/client/components/core/Validator.js +100 -0
  107. package/src/client/components/core/VanillaJs.js +463 -0
  108. package/src/client/components/core/Wallet.js +106 -0
  109. package/src/client/components/core/Webhook.js +25 -0
  110. package/src/client/components/core/Worker.js +282 -0
  111. package/src/client/components/default/CommonDefault.js +29 -0
  112. package/src/client/components/default/CssDefault.js +13 -0
  113. package/src/client/components/default/ElementsDefault.js +38 -0
  114. package/src/client/components/default/LogInDefault.js +41 -0
  115. package/src/client/components/default/LogOutDefault.js +28 -0
  116. package/src/client/components/default/MenuDefault.js +389 -0
  117. package/src/client/components/default/RoutesDefault.js +48 -0
  118. package/src/client/components/default/SettingsDefault.js +16 -0
  119. package/src/client/components/default/SignUpDefault.js +9 -0
  120. package/src/client/components/default/SocketIoDefault.js +54 -0
  121. package/src/client/components/default/TranslateDefault.js +7 -0
  122. package/src/client/public/default/android-chrome-144x144.png +0 -0
  123. package/src/client/public/default/android-chrome-192x192.png +0 -0
  124. package/src/client/public/default/android-chrome-256x256.png +0 -0
  125. package/src/client/public/default/android-chrome-36x36.png +0 -0
  126. package/src/client/public/default/android-chrome-384x384.png +0 -0
  127. package/src/client/public/default/android-chrome-48x48.png +0 -0
  128. package/src/client/public/default/android-chrome-512x512.png +0 -0
  129. package/src/client/public/default/android-chrome-72x72.png +0 -0
  130. package/src/client/public/default/android-chrome-96x96.png +0 -0
  131. package/src/client/public/default/apple-touch-icon-1024x1024.png +0 -0
  132. package/src/client/public/default/apple-touch-icon-114x114.png +0 -0
  133. package/src/client/public/default/apple-touch-icon-120x120.png +0 -0
  134. package/src/client/public/default/apple-touch-icon-144x144.png +0 -0
  135. package/src/client/public/default/apple-touch-icon-152x152.png +0 -0
  136. package/src/client/public/default/apple-touch-icon-167x167.png +0 -0
  137. package/src/client/public/default/apple-touch-icon-180x180.png +0 -0
  138. package/src/client/public/default/apple-touch-icon-57x57.png +0 -0
  139. package/src/client/public/default/apple-touch-icon-60x60.png +0 -0
  140. package/src/client/public/default/apple-touch-icon-72x72.png +0 -0
  141. package/src/client/public/default/apple-touch-icon-76x76.png +0 -0
  142. package/src/client/public/default/apple-touch-icon-precomposed.png +0 -0
  143. package/src/client/public/default/apple-touch-icon.png +0 -0
  144. package/src/client/public/default/apple-touch-startup-image-1125x2436.png +0 -0
  145. package/src/client/public/default/apple-touch-startup-image-1136x640.png +0 -0
  146. package/src/client/public/default/apple-touch-startup-image-1170x2532.png +0 -0
  147. package/src/client/public/default/apple-touch-startup-image-1179x2556.png +0 -0
  148. package/src/client/public/default/apple-touch-startup-image-1242x2208.png +0 -0
  149. package/src/client/public/default/apple-touch-startup-image-1242x2688.png +0 -0
  150. package/src/client/public/default/apple-touch-startup-image-1284x2778.png +0 -0
  151. package/src/client/public/default/apple-touch-startup-image-1290x2796.png +0 -0
  152. package/src/client/public/default/apple-touch-startup-image-1334x750.png +0 -0
  153. package/src/client/public/default/apple-touch-startup-image-1488x2266.png +0 -0
  154. package/src/client/public/default/apple-touch-startup-image-1536x2048.png +0 -0
  155. package/src/client/public/default/apple-touch-startup-image-1620x2160.png +0 -0
  156. package/src/client/public/default/apple-touch-startup-image-1640x2160.png +0 -0
  157. package/src/client/public/default/apple-touch-startup-image-1668x2224.png +0 -0
  158. package/src/client/public/default/apple-touch-startup-image-1668x2388.png +0 -0
  159. package/src/client/public/default/apple-touch-startup-image-1792x828.png +0 -0
  160. package/src/client/public/default/apple-touch-startup-image-2048x1536.png +0 -0
  161. package/src/client/public/default/apple-touch-startup-image-2048x2732.png +0 -0
  162. package/src/client/public/default/apple-touch-startup-image-2160x1620.png +0 -0
  163. package/src/client/public/default/apple-touch-startup-image-2160x1640.png +0 -0
  164. package/src/client/public/default/apple-touch-startup-image-2208x1242.png +0 -0
  165. package/src/client/public/default/apple-touch-startup-image-2224x1668.png +0 -0
  166. package/src/client/public/default/apple-touch-startup-image-2266x1488.png +0 -0
  167. package/src/client/public/default/apple-touch-startup-image-2388x1668.png +0 -0
  168. package/src/client/public/default/apple-touch-startup-image-2436x1125.png +0 -0
  169. package/src/client/public/default/apple-touch-startup-image-2532x1170.png +0 -0
  170. package/src/client/public/default/apple-touch-startup-image-2556x1179.png +0 -0
  171. package/src/client/public/default/apple-touch-startup-image-2688x1242.png +0 -0
  172. package/src/client/public/default/apple-touch-startup-image-2732x2048.png +0 -0
  173. package/src/client/public/default/apple-touch-startup-image-2778x1284.png +0 -0
  174. package/src/client/public/default/apple-touch-startup-image-2796x1290.png +0 -0
  175. package/src/client/public/default/apple-touch-startup-image-640x1136.png +0 -0
  176. package/src/client/public/default/apple-touch-startup-image-750x1334.png +0 -0
  177. package/src/client/public/default/apple-touch-startup-image-828x1792.png +0 -0
  178. package/src/client/public/default/assets/background/white.jpg +0 -0
  179. package/src/client/public/default/assets/background/white0-min.jpg +0 -0
  180. package/src/client/public/default/assets/background/white0.jpg +0 -0
  181. package/src/client/public/default/assets/logo/base-icon.png +0 -0
  182. package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
  183. package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
  184. package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
  185. package/src/client/public/default/browserconfig.xml +12 -0
  186. package/src/client/public/default/favicon-16x16.png +0 -0
  187. package/src/client/public/default/favicon-32x32.png +0 -0
  188. package/src/client/public/default/favicon-48x48.png +0 -0
  189. package/src/client/public/default/favicon.ico +0 -0
  190. package/src/client/public/default/manifest.webmanifest +69 -0
  191. package/src/client/public/default/mstile-144x144.png +0 -0
  192. package/src/client/public/default/mstile-150x150.png +0 -0
  193. package/src/client/public/default/mstile-310x150.png +0 -0
  194. package/src/client/public/default/mstile-310x310.png +0 -0
  195. package/src/client/public/default/mstile-70x70.png +0 -0
  196. package/src/client/public/default/plantuml/client-conf.svg +1 -0
  197. package/src/client/public/default/plantuml/client-schema.svg +1 -0
  198. package/src/client/public/default/plantuml/cron-conf.svg +1 -0
  199. package/src/client/public/default/plantuml/cron-schema.svg +1 -0
  200. package/src/client/public/default/plantuml/server-conf.svg +1 -0
  201. package/src/client/public/default/plantuml/server-schema.svg +1 -0
  202. package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
  203. package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
  204. package/src/client/public/default/sitemap +148 -0
  205. package/src/client/public/default/yandex-browser-50x50.png +0 -0
  206. package/src/client/public/default/yandex-browser-manifest.json +9 -0
  207. package/src/client/public/doc/favicon.ico +0 -0
  208. package/src/client/public/doc/sitemap +148 -0
  209. package/src/client/public/test/favicon.ico +0 -0
  210. package/src/client/public/test/sitemap +148 -0
  211. package/src/client/services/core/core.service.js +170 -0
  212. package/src/client/services/crypto/crypto.service.js +70 -0
  213. package/src/client/services/default/default.management.js +343 -0
  214. package/src/client/services/default/default.service.js +89 -0
  215. package/src/client/services/file/file.service.js +70 -0
  216. package/src/client/services/instance/instance.management.js +74 -0
  217. package/src/client/services/instance/instance.service.js +89 -0
  218. package/src/client/services/test/test.service.js +70 -0
  219. package/src/client/services/user/user.management.js +50 -0
  220. package/src/client/services/user/user.service.js +89 -0
  221. package/src/client/ssr/Render.js +237 -0
  222. package/src/client/ssr/common/Alert.js +75 -0
  223. package/src/client/ssr/common/SsrCore.js +91 -0
  224. package/src/client/ssr/common/Translate.js +26 -0
  225. package/src/client/ssr/common/Worker.js +28 -0
  226. package/src/client/ssr/components/body/CacheControl.js +114 -0
  227. package/src/client/ssr/components/body/DefaultSplashScreen.js +90 -0
  228. package/src/client/ssr/components/email/DefaultRecoverEmail.js +21 -0
  229. package/src/client/ssr/components/email/DefaultVerifyEmail.js +17 -0
  230. package/src/client/ssr/components/head/Css.js +241 -0
  231. package/src/client/ssr/components/head/DefaultScripts.js +3 -0
  232. package/src/client/ssr/components/head/PwaDefault.js +60 -0
  233. package/src/client/ssr/offline/default.index.js +31 -0
  234. package/src/client/ssr/pages/404.js +12 -0
  235. package/src/client/ssr/pages/500.js +12 -0
  236. package/src/client/sw/default.sw.js +203 -0
  237. package/src/client/sw/template.sw.js +84 -0
  238. package/src/client.build.js +22 -0
  239. package/src/client.dev.js +21 -0
  240. package/src/cron.js +30 -0
  241. package/src/db/DataBaseProvider.js +34 -0
  242. package/src/db/mariadb/MariaDB.js +33 -0
  243. package/src/db/mongo/MongooseDB.js +125 -0
  244. package/src/dns.js +22 -0
  245. package/src/index.js +43 -0
  246. package/src/mailer/EmailRender.js +69 -0
  247. package/src/mailer/MailerProvider.js +96 -0
  248. package/src/proxy.js +22 -0
  249. package/src/runtime/lampp/Lampp.js +115 -0
  250. package/src/runtime/nginx/Nginx.js +3 -0
  251. package/src/runtime/xampp/Xampp.js +49 -0
  252. package/src/server/auth.js +235 -0
  253. package/src/server/backup.js +108 -0
  254. package/src/server/client-build-live.js +98 -0
  255. package/src/server/client-build.js +821 -0
  256. package/src/server/client-dev-server.js +60 -0
  257. package/src/server/client-formatted.js +58 -0
  258. package/src/server/client-icons.js +151 -0
  259. package/src/server/conf.js +883 -0
  260. package/src/server/cron.js +35 -0
  261. package/src/server/dns.js +89 -0
  262. package/src/server/downloader.js +42 -0
  263. package/src/server/logger.js +190 -0
  264. package/src/server/network.js +122 -0
  265. package/src/server/peer.js +33 -0
  266. package/src/server/process.js +66 -0
  267. package/src/server/prompt-optimizer.js +28 -0
  268. package/src/server/proxy.js +118 -0
  269. package/src/server/runtime.js +461 -0
  270. package/src/server/ssl.js +120 -0
  271. package/src/server.js +25 -0
  272. package/src/ws/IoInterface.js +45 -0
  273. package/src/ws/IoServer.js +39 -0
  274. package/src/ws/core/channels/core.ws.chat.js +23 -0
  275. package/src/ws/core/channels/core.ws.mailer.js +35 -0
  276. package/src/ws/core/channels/core.ws.stream.js +31 -0
  277. package/src/ws/core/core.ws.connection.js +28 -0
  278. package/src/ws/core/core.ws.emit.js +14 -0
  279. package/src/ws/core/core.ws.server.js +24 -0
  280. package/src/ws/core/management/core.ws.chat.js +8 -0
  281. package/src/ws/core/management/core.ws.mailer.js +16 -0
  282. package/src/ws/core/management/core.ws.stream.js +8 -0
  283. package/src/ws/default/channels/default.ws.main.js +16 -0
  284. package/src/ws/default/default.ws.connection.js +22 -0
  285. package/src/ws/default/default.ws.emit.js +14 -0
  286. package/src/ws/default/default.ws.server.js +20 -0
  287. package/src/ws/default/management/default.ws.main.js +8 -0
  288. package/startup.js +11 -0
  289. package/supervisord-openssh-server.conf +5 -0
  290. package/test/api.test.js +60 -0
@@ -0,0 +1,44 @@
1
+ import { connectedScatterplotChart } from '../chart/connectedScatterplotChart.js';
2
+
3
+ // https://takanori-fujiwara.github.io/d3-gallery-javascript/
4
+
5
+ const D3Chart = {
6
+ Render: async function () {
7
+ setTimeout(async () => {
8
+ const driving = await d3.csv('/data/driving.csv', d3.autoType);
9
+
10
+ const button = d3.select('.chart-panel').append('div').append('button').attr('type', 'button').text('Replay');
11
+
12
+ const play = () => {
13
+ const chart = connectedScatterplotChart(driving, {
14
+ svgId: 'connected-scatterplot',
15
+ x: (d) => d.miles,
16
+ y: (d) => d.gas,
17
+ title: (d) => d.year,
18
+ orient: (d) => d.side,
19
+ yFormat: '.2f',
20
+ xLabel: 'Miles driven (per capita per year) →',
21
+ yLabel: '↑ Price of gas (per gallon, adjusted average $)',
22
+ width: 1000,
23
+ height: 720,
24
+ duration: 5000, // for the intro animation; 0 to disable
25
+ });
26
+ d3.select('#connected-scatterplot').remove();
27
+ d3.select('.chart-container').append(() => chart);
28
+ };
29
+
30
+ play();
31
+
32
+ // replay
33
+ button.on('click', () => {
34
+ play();
35
+ });
36
+ });
37
+ return html`
38
+ <div class="in chart-container"></div>
39
+ <div class="in chart-panel"></div>
40
+ `;
41
+ },
42
+ };
43
+
44
+ export { D3Chart };
@@ -0,0 +1,231 @@
1
+ import { BtnIcon } from './BtnIcon.js';
2
+ import { rgbToHex } from './CommonJs.js';
3
+ import { Css, darkTheme, dynamicCol, renderCssAttr, ThemeEvents, Themes } from './Css.js';
4
+ import { DropDown } from './DropDown.js';
5
+ import { Modal, renderMenuLabel, renderViewTitle } from './Modal.js';
6
+ import { listenQueryPathInstance, setQueryPath } from './Router.js';
7
+ import { Translate } from './Translate.js';
8
+ import { getProxyPath, getQueryParams, htmls, s } from './VanillaJs.js';
9
+
10
+ // https://mintlify.com/docs/quickstart
11
+
12
+ const umlTypes = ['server', 'cron', 'client', 'ssr'];
13
+
14
+ const Docs = {
15
+ RenderModal: async function (type, modalOptions) {
16
+ const docData = this.Data.find((d) => d.type === type);
17
+ const ModalId = `modal-docs-${docData.type}`;
18
+ const { barConfig } = await Themes[Css.currentTheme]();
19
+ barConfig.buttons.close.onClick = () => {
20
+ setQueryPath({ path: 'docs' });
21
+ Modal.removeModal(ModalId);
22
+ };
23
+ await Modal.Render({
24
+ barConfig,
25
+ title: renderViewTitle(docData),
26
+ id: ModalId,
27
+ html: async () => {
28
+ if (docData.renderHtml) return await docData.renderHtml();
29
+ return html`
30
+ <iframe
31
+ class="in iframe-${ModalId}"
32
+ style="width: 100%; border: none; background: white"
33
+ src="${docData.url()}"
34
+ >
35
+ </iframe>
36
+ `;
37
+ },
38
+ maximize: true,
39
+ mode: 'view',
40
+ slideMenu: 'modal-menu',
41
+ observer: true,
42
+ barMode: 'top-bottom-bar',
43
+ query: true,
44
+ ...modalOptions,
45
+ });
46
+ Modal.Data[ModalId].onObserverListener[ModalId] = () => {
47
+ if (s(`.iframe-${ModalId}`))
48
+ s(`.iframe-${ModalId}`).style.height = `${s(`.${ModalId}`).offsetHeight - Modal.headerTitleHeight}px`;
49
+ };
50
+ Modal.Data[ModalId].onObserverListener[ModalId]();
51
+ },
52
+ Data: [
53
+ {
54
+ type: 'repo',
55
+ icon: html`<i class="fab fa-github"></i>`,
56
+ text: `Last Release`,
57
+ url: function () {
58
+ return `https://github.com/underpostnet/engine/`;
59
+ },
60
+ },
61
+ {
62
+ type: 'src',
63
+ icon: html`<i class="fa-brands fa-osi"></i>`,
64
+ text: 'Source Docs',
65
+ url: function () {
66
+ return `${getProxyPath()}docs/engine/2.7.82`;
67
+ },
68
+ },
69
+ {
70
+ type: 'api',
71
+ icon: html`<i class="fa-solid fa-arrows-turn-to-dots"></i>`,
72
+ text: `Api Docs`,
73
+ url: function () {
74
+ return `${getProxyPath()}api-docs`;
75
+ },
76
+ },
77
+ {
78
+ type: 'coverage',
79
+ icon: html`<img height="20" width="20" class="doc-icon-coverage" />`,
80
+ text: `Coverage report`,
81
+ url: function () {
82
+ return `${getProxyPath()}docs/coverage`;
83
+ },
84
+ themeEvent: () => {
85
+ if (s(`.doc-icon-coverage`))
86
+ s(`.doc-icon-coverage`).src = `https://cdn.simpleicons.org/coveralls/${rgbToHex(
87
+ window.getComputedStyle(s('html')).color,
88
+ )}`;
89
+ },
90
+ },
91
+ {
92
+ type: 'coverage-link',
93
+ icon: html`<img height="20" width="20" class="doc-icon-coverage-link" />`,
94
+ text: `Coverage`,
95
+ url: function () {
96
+ return `https://coveralls.io/github/underpostnet/engine`;
97
+ },
98
+ themeEvent: () => {
99
+ if (s(`.doc-icon-coverage-link`))
100
+ s(`.doc-icon-coverage-link`).src = `https://cdn.simpleicons.org/coveralls/${rgbToHex(
101
+ window.getComputedStyle(s('html')).color,
102
+ )}`;
103
+ },
104
+ },
105
+ ].concat(
106
+ umlTypes.map((umlType) => {
107
+ const umlId = `uml-${umlType}`;
108
+ return {
109
+ type: umlId,
110
+ icon: html`<i class="fas fa-sitemap"></i>`,
111
+ text: Translate.Render(`${umlType} config uml`),
112
+ renderHtml: function () {
113
+ return html` <div class="in section-mp">
114
+ <div class="in sub-title-modal"><i class="fas fa-project-diagram"></i> Schema</div>
115
+ </div>
116
+ <div class="in section-mp">
117
+ <a href="${getProxyPath()}docs/plantuml/${umlType}-schema.svg" target="_blank"
118
+ ><img class="in plantuml-svg" src="${getProxyPath()}docs/plantuml/${umlType}-schema.svg"
119
+ /></a>
120
+ </div>
121
+ <div class="in section-mp">
122
+ <div class="in sub-title-modal"><i class="fas fa-project-diagram"></i> Instance example</div>
123
+ </div>
124
+ <div class="in section-mp">
125
+ <a href="${getProxyPath()}docs/plantuml/${umlType}-conf.svg" target="_blank"
126
+ ><img class="in plantuml-svg" src="${getProxyPath()}docs/plantuml/${umlType}-conf.svg"
127
+ /></a>
128
+ </div>`;
129
+ },
130
+ };
131
+ }),
132
+ ),
133
+ Init: async function (options) {
134
+ const { idModal } = options;
135
+ setTimeout(() => {
136
+ s(`.btn-docs-src`).onclick = async () => {
137
+ setQueryPath({ path: 'docs', queryPath: 'src' });
138
+ await this.RenderModal('src', options.modalOptions);
139
+ };
140
+ s(`.btn-docs-api`).onclick = async () => {
141
+ setQueryPath({ path: 'docs', queryPath: 'api' });
142
+ await this.RenderModal('api', options.modalOptions);
143
+ };
144
+ s(`.btn-docs-coverage`).onclick = async () => {
145
+ setQueryPath({ path: 'docs', queryPath: 'coverage' });
146
+ await this.RenderModal('coverage', options.modalOptions);
147
+ };
148
+
149
+ s(`.btn-docs-coverage-link`).onclick = () => {
150
+ const docData = this.Data.find((d) => d.type === 'coverage-link');
151
+ location.href = docData.url();
152
+ };
153
+ s(`.btn-docs-repo`).onclick = () => {
154
+ const docData = this.Data.find((d) => d.type === 'repo');
155
+ location.href = docData.url();
156
+ };
157
+
158
+ for (const umlType of umlTypes) {
159
+ const umlId = `uml-${umlType}`;
160
+ s(`.btn-docs-${umlId}`).onclick = async () => {
161
+ setQueryPath({ path: 'docs', queryPath: umlId });
162
+ await this.RenderModal(umlId, { ...options.modalOptions, handleType: 'bar' });
163
+ };
164
+ }
165
+
166
+ listenQueryPathInstance({
167
+ id: options.idModal,
168
+ routeId: 'docs',
169
+ event: (path) => {
170
+ if (s(`.btn-docs-${path}`)) s(`.btn-docs-${path}`).click();
171
+ },
172
+ });
173
+ });
174
+ let docMenuRender = '';
175
+ for (const docData of this.Data) {
176
+ if (docData.themeEvent) {
177
+ ThemeEvents[`doc-icon-${docData.type}`] = docData.themeEvent;
178
+ setTimeout(ThemeEvents[`doc-icon-${docData.type}`]);
179
+ }
180
+ let tabHref, style, labelStyle;
181
+ switch (docData.type) {
182
+ case 'repo':
183
+ case 'coverage-link':
184
+ tabHref = docData.url();
185
+ style = renderCssAttr({ style: { height: '45px' } });
186
+ labelStyle = renderCssAttr({ style: { top: '8px', left: '9px' } });
187
+ break;
188
+
189
+ default:
190
+ break;
191
+ }
192
+ docMenuRender += html` <div class="in">
193
+ ${await BtnIcon.Render({
194
+ class: `inl section-mp btn-custom btn-docs-${docData.type}`,
195
+ label: html`${docData.icon} ${docData.text}`,
196
+ tabHref,
197
+ style,
198
+ labelStyle,
199
+ })}
200
+ </div>`;
201
+ }
202
+ return html` <div class="in section-mp">${docMenuRender}</div>`;
203
+ return html` <div class="in section-mp">
204
+ ${await DropDown.Render({
205
+ id: 'dropdown-docs',
206
+ disableClose: true,
207
+ disableSelectLabel: true,
208
+ disableSelectOptionsLabel: true,
209
+ disableSearchBox: true,
210
+ open: true,
211
+ lastSelectClass: 'hover-active',
212
+ label: renderMenuLabel({
213
+ icon: html`<i class="fas fa-book"></i>`,
214
+ text: html`${Translate.Render('docs')}`,
215
+ }),
216
+ containerClass: '',
217
+ data: this.Data.map((docTypeData) => {
218
+ return {
219
+ display: docTypeData.label,
220
+ value: docTypeData.type,
221
+ onClick: async () => {
222
+ console.warn(this.viewUrl[docTypeData.type]());
223
+ },
224
+ };
225
+ }),
226
+ })}
227
+ </div>`;
228
+ },
229
+ };
230
+
231
+ export { Docs };
@@ -0,0 +1,164 @@
1
+ import { getId, newInstance } from './CommonJs.js';
2
+ import { Input } from './Input.js';
3
+ import { ToggleSwitch } from './ToggleSwitch.js';
4
+ import { Translate } from './Translate.js';
5
+ import { s, htmls } from './VanillaJs.js';
6
+
7
+ const DropDown = {
8
+ Tokens: {},
9
+ Render: async function (options) {
10
+ const id = options.id ? options.id : getId(this.Tokens, 'dropdown-');
11
+ this.Tokens[id] = { onClickEvents: {}, lastSelectValue: undefined };
12
+
13
+ options.data.push({
14
+ value: 'reset',
15
+ display: html`<i class="fa-solid fa-broom"></i> ${Translate.Render('clear')}`,
16
+ onClick: () => {
17
+ console.log('DropDown onClick', this.value);
18
+ if (options && options.resetOnClick) options.resetOnClick();
19
+ this.Tokens[id].value = undefined;
20
+ },
21
+ });
22
+
23
+ if (!(options && options.disableClose))
24
+ options.data.push({
25
+ value: 'close',
26
+ display: html`<i class="fa-solid fa-xmark"></i> ${Translate.Render('close')}`,
27
+ onClick: function () {
28
+ console.log('DropDown onClick', this.value);
29
+ },
30
+ });
31
+
32
+ const switchOptionsPanel = () => {
33
+ if (Array.from(s(`.dropdown-option-${id}`).classList).includes('hide'))
34
+ s(`.dropdown-option-${id}`).classList.remove('hide');
35
+ else s(`.dropdown-option-${id}`).classList.add('hide');
36
+ };
37
+
38
+ setTimeout(() => {
39
+ if (options.type === 'checkbox')
40
+ options.data.map((optionData) => {
41
+ const indexValue = options.data.findIndex((t) => optionData.checked && t.value === optionData.value);
42
+ if (indexValue > -1) setTimeout(() => s(`.dropdown-option-${id}-${indexValue}`).click());
43
+ });
44
+ else {
45
+ const indexValue = options.data.findIndex((t) => t.value === options.value);
46
+ if (indexValue > -1) setTimeout(() => s(`.dropdown-option-${id}-${indexValue}`).click());
47
+ }
48
+
49
+ s(`.dropdown-label-${id}`).onclick = switchOptionsPanel;
50
+ s(`.dropdown-current-${id}`).onclick = switchOptionsPanel;
51
+ if (options && options.open) switchOptionsPanel();
52
+ });
53
+
54
+ let render = '';
55
+ let index = -1;
56
+ for (const optionData of options.data) {
57
+ index++;
58
+ const i = index;
59
+ const valueDisplay = optionData.value.trim().replaceAll(' ', '-');
60
+ setTimeout(() => {
61
+ const onclick = (e) => {
62
+ if (options && options.lastSelectClass && s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`)) {
63
+ s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`).classList.remove(options.lastSelectClass);
64
+ }
65
+ this.Tokens[id].lastSelectValue = valueDisplay;
66
+ if (options && options.lastSelectClass && s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`)) {
67
+ s(`.dropdown-option-${this.Tokens[id].lastSelectValue}`).classList.add(options.lastSelectClass);
68
+ }
69
+
70
+ if (
71
+ !(options && options.disableClose) &&
72
+ (options.type !== 'checkbox' || optionData.value === 'close' || optionData.value === 'reset')
73
+ )
74
+ s(`.dropdown-option-${id}`).classList.add('hide');
75
+
76
+ if (options.type === 'checkbox' && ToggleSwitch.Tokens[`checkbox-role-${valueDisplay}`])
77
+ ToggleSwitch.Tokens[`checkbox-role-${valueDisplay}`].click();
78
+ if (optionData.value !== 'close') {
79
+ if (optionData.value !== 'reset')
80
+ htmls(
81
+ `.dropdown-current-${id}`,
82
+ options.type === 'checkbox'
83
+ ? options.data
84
+ .filter((d) => d.checked)
85
+ .map((v, i, a) => `${v.display}${i < a.length - 1 ? ',' : ''}`)
86
+ .join('')
87
+ : optionData.display,
88
+ );
89
+ else htmls(`.dropdown-current-${id}`, '');
90
+
91
+ this.Tokens[id].value =
92
+ options.type === 'checkbox' ? options.data.filter((d) => d.checked).map((d) => d.data) : optionData.data;
93
+
94
+ console.warn('current value dropdown id:' + id, this.Tokens[id].value);
95
+
96
+ s(`.${id}`).value = this.Tokens[id].value;
97
+
98
+ optionData.onClick(e);
99
+ }
100
+ };
101
+
102
+ this.Tokens[id].onClickEvents[`dropdown-option-${id}-${i}`] = onclick;
103
+ this.Tokens[id].onClickEvents[`dropdown-option-${id}-${valueDisplay}`] = onclick;
104
+ this.Tokens[id].onClickEvents[`dropdown-option-${valueDisplay}`] = onclick;
105
+
106
+ s(`.dropdown-option-${id}-${i}`).onclick = onclick;
107
+ });
108
+ render += html`
109
+ <div
110
+ class="in dropdown-option dropdown-option-${id}-${i} dropdown-option-${id}-${valueDisplay} dropdown-option-${valueDisplay} ${valueDisplay ===
111
+ 'reset' &&
112
+ options &&
113
+ !(options.resetOption === true)
114
+ ? 'hide'
115
+ : ''}"
116
+ >
117
+ ${options.type === 'checkbox' && optionData.value !== 'close' && optionData.value !== 'reset'
118
+ ? html`
119
+ ${await ToggleSwitch.Render({
120
+ id: `checkbox-role-${valueDisplay}`,
121
+ type: 'checkbox',
122
+ disabledOnClick: true,
123
+ checked: optionData.checked,
124
+ on: {
125
+ unchecked: () => {
126
+ optionData.checked = false;
127
+ },
128
+ checked: () => {
129
+ optionData.checked = true;
130
+ },
131
+ },
132
+ })}
133
+ `
134
+ : ''}${optionData.display}
135
+ </div>
136
+ `;
137
+ }
138
+ return html`
139
+ <div class="inl dropdown-container ${id} ${options?.containerClass ? options.containerClass : ''}">
140
+ <div class="in dropdown-option dropdown-label-${id} ${options && options.disableSelectLabel ? 'hide' : ''}">
141
+ <i class="fa-solid fa-caret-down"> </i> ${options.label}
142
+ </div>
143
+ <div
144
+ class="in dropdown-option dropdown-current-${id} ${options && options.disableSelectOptionsLabel
145
+ ? 'hide'
146
+ : ''}"
147
+ ></div>
148
+ <div class="in dropdown-option-${id} hide">
149
+ <div class="in dropdown-option ${options && options.disableSearchBox ? 'hide' : ''}">
150
+ ${await Input.Render({
151
+ id: `search-box-${id}`,
152
+ label: html`<i class="fa-solid fa-magnifying-glass"></i> ${Translate.Render('search')}`,
153
+ containerClass: 'in',
154
+ placeholder: true,
155
+ })}
156
+ </div>
157
+ ${render}
158
+ </div>
159
+ </div>
160
+ `;
161
+ },
162
+ };
163
+
164
+ export { DropDown };
@@ -0,0 +1,46 @@
1
+ import { LoadingAnimation } from '../core/LoadingAnimation.js';
2
+ import { loggerFactory } from '../core/Logger.js';
3
+ import { cssEffect } from './Css.js';
4
+ import { NotificationManager } from './NotificationManager.js';
5
+ import { s } from './VanillaJs.js';
6
+
7
+ const logger = loggerFactory(import.meta);
8
+
9
+ const EventsUI = {
10
+ on: (id = '', logic = function (e) {}, type = 'onclick', options = {}) => {
11
+ const { loadingContainer } = options;
12
+ if (!s(id)) return;
13
+ let complete = true;
14
+ s(id)[type] = async function (e) {
15
+ cssEffect(id, e);
16
+ if (complete) {
17
+ complete = false;
18
+ await LoadingAnimation.spinner.play(loadingContainer ? loadingContainer : id);
19
+ await LoadingAnimation.bar.play(id);
20
+ try {
21
+ await logic(e);
22
+ } catch (error) {
23
+ logger.error(error);
24
+ NotificationManager.Push({
25
+ status: 'error',
26
+ html: error?.message ? error.message : error ? error : 'Event error',
27
+ });
28
+ }
29
+ LoadingAnimation.bar.stop(id);
30
+ await LoadingAnimation.spinner.stop(loadingContainer ? loadingContainer : id);
31
+ complete = true;
32
+ return;
33
+ }
34
+ if (e && e.preventDefault) e.preventDefault();
35
+ logger.warn('in process', id);
36
+ };
37
+ },
38
+ onClick: async function (id = '', logic = async function (e) {}, options = { loadingContainer: '' }) {
39
+ return await this.on(id, logic, 'onclick', options);
40
+ },
41
+ onChange: async function (id = '', logic = async function (e) {}, options = { loadingContainer: '' }) {
42
+ return await this.on(id, logic, 'onchange', options);
43
+ },
44
+ };
45
+
46
+ export { EventsUI };