@underpostnet/underpost 2.7.9

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 (297) 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 +115 -0
  6. package/.github/workflows/publish.yml +84 -0
  7. package/.github/workflows/pwa-microservices-template.page.yml +54 -0
  8. package/.github/workflows/pwa-microservices-template.test.yml +30 -0
  9. package/.nycrc +9 -0
  10. package/.prettierignore +13 -0
  11. package/.prettierrc +9 -0
  12. package/.vscode/extensions.json +72 -0
  13. package/.vscode/settings.json +106 -0
  14. package/AUTHORS.md +10 -0
  15. package/CHANGELOG.md +85 -0
  16. package/Dockerfile +90 -0
  17. package/LICENSE +21 -0
  18. package/README.md +96 -0
  19. package/bin/cron.js +47 -0
  20. package/bin/db.js +180 -0
  21. package/bin/deploy.js +859 -0
  22. package/bin/file.js +109 -0
  23. package/bin/index.js +82 -0
  24. package/bin/ssl.js +55 -0
  25. package/bin/util.js +204 -0
  26. package/bin/vs.js +35 -0
  27. package/conf.js +265 -0
  28. package/docker-compose.yml +67 -0
  29. package/jsconfig.json +7 -0
  30. package/jsdoc.json +32 -0
  31. package/nodemon.json +6 -0
  32. package/package.json +134 -0
  33. package/prometheus.yml +36 -0
  34. package/src/api/core/core.controller.js +69 -0
  35. package/src/api/core/core.model.js +11 -0
  36. package/src/api/core/core.router.js +23 -0
  37. package/src/api/core/core.service.js +31 -0
  38. package/src/api/crypto/crypto.controller.js +51 -0
  39. package/src/api/crypto/crypto.model.js +23 -0
  40. package/src/api/crypto/crypto.router.js +20 -0
  41. package/src/api/crypto/crypto.service.js +64 -0
  42. package/src/api/default/default.controller.js +69 -0
  43. package/src/api/default/default.model.js +20 -0
  44. package/src/api/default/default.router.js +23 -0
  45. package/src/api/default/default.service.js +31 -0
  46. package/src/api/file/file.controller.js +53 -0
  47. package/src/api/file/file.model.js +19 -0
  48. package/src/api/file/file.router.js +21 -0
  49. package/src/api/file/file.service.js +80 -0
  50. package/src/api/instance/instance.controller.js +69 -0
  51. package/src/api/instance/instance.model.js +36 -0
  52. package/src/api/instance/instance.router.js +33 -0
  53. package/src/api/instance/instance.service.js +48 -0
  54. package/src/api/test/test.controller.js +59 -0
  55. package/src/api/test/test.model.js +14 -0
  56. package/src/api/test/test.router.js +21 -0
  57. package/src/api/test/test.service.js +35 -0
  58. package/src/api/user/user.build.js +16 -0
  59. package/src/api/user/user.controller.js +70 -0
  60. package/src/api/user/user.model.js +65 -0
  61. package/src/api/user/user.router.js +345 -0
  62. package/src/api/user/user.service.js +479 -0
  63. package/src/api.js +23 -0
  64. package/src/client/Default.index.js +40 -0
  65. package/src/client/components/core/Account.js +290 -0
  66. package/src/client/components/core/AgGrid.js +160 -0
  67. package/src/client/components/core/Auth.js +19 -0
  68. package/src/client/components/core/Badge.js +32 -0
  69. package/src/client/components/core/Blockchain.js +41 -0
  70. package/src/client/components/core/Blog.js +9 -0
  71. package/src/client/components/core/BtnIcon.js +101 -0
  72. package/src/client/components/core/CalendarCore.js +458 -0
  73. package/src/client/components/core/Chat.js +64 -0
  74. package/src/client/components/core/ColorPalette.js +5267 -0
  75. package/src/client/components/core/CommonJs.js +742 -0
  76. package/src/client/components/core/Content.js +193 -0
  77. package/src/client/components/core/Css.js +846 -0
  78. package/src/client/components/core/CssCore.js +844 -0
  79. package/src/client/components/core/D3Chart.js +44 -0
  80. package/src/client/components/core/Docs.js +331 -0
  81. package/src/client/components/core/DropDown.js +164 -0
  82. package/src/client/components/core/EventsUI.js +46 -0
  83. package/src/client/components/core/FileExplorer.js +699 -0
  84. package/src/client/components/core/FullScreen.js +45 -0
  85. package/src/client/components/core/Input.js +346 -0
  86. package/src/client/components/core/JoyStick.js +77 -0
  87. package/src/client/components/core/Keyboard.js +73 -0
  88. package/src/client/components/core/LoadingAnimation.js +178 -0
  89. package/src/client/components/core/LogIn.js +187 -0
  90. package/src/client/components/core/LogOut.js +58 -0
  91. package/src/client/components/core/Logger.js +26 -0
  92. package/src/client/components/core/Modal.js +1814 -0
  93. package/src/client/components/core/NotificationManager.js +84 -0
  94. package/src/client/components/core/Panel.js +613 -0
  95. package/src/client/components/core/PanelForm.js +469 -0
  96. package/src/client/components/core/Polyhedron.js +162 -0
  97. package/src/client/components/core/Recover.js +204 -0
  98. package/src/client/components/core/Responsive.js +68 -0
  99. package/src/client/components/core/RichText.js +53 -0
  100. package/src/client/components/core/Router.js +76 -0
  101. package/src/client/components/core/Scroll.js +34 -0
  102. package/src/client/components/core/SignUp.js +125 -0
  103. package/src/client/components/core/SocketIo.js +72 -0
  104. package/src/client/components/core/Stream.js +113 -0
  105. package/src/client/components/core/ToggleSwitch.js +87 -0
  106. package/src/client/components/core/ToolTip.js +26 -0
  107. package/src/client/components/core/Translate.js +446 -0
  108. package/src/client/components/core/Validator.js +100 -0
  109. package/src/client/components/core/VanillaJs.js +463 -0
  110. package/src/client/components/core/Wallet.js +106 -0
  111. package/src/client/components/core/WebComponent.js +44 -0
  112. package/src/client/components/core/Webhook.js +25 -0
  113. package/src/client/components/core/Worker.js +280 -0
  114. package/src/client/components/default/CommonDefault.js +29 -0
  115. package/src/client/components/default/CssDefault.js +13 -0
  116. package/src/client/components/default/ElementsDefault.js +38 -0
  117. package/src/client/components/default/LogInDefault.js +41 -0
  118. package/src/client/components/default/LogOutDefault.js +28 -0
  119. package/src/client/components/default/MenuDefault.js +389 -0
  120. package/src/client/components/default/RoutesDefault.js +48 -0
  121. package/src/client/components/default/SettingsDefault.js +16 -0
  122. package/src/client/components/default/SignUpDefault.js +9 -0
  123. package/src/client/components/default/SocketIoDefault.js +54 -0
  124. package/src/client/components/default/TranslateDefault.js +7 -0
  125. package/src/client/public/default/android-chrome-144x144.png +0 -0
  126. package/src/client/public/default/android-chrome-192x192.png +0 -0
  127. package/src/client/public/default/android-chrome-256x256.png +0 -0
  128. package/src/client/public/default/android-chrome-36x36.png +0 -0
  129. package/src/client/public/default/android-chrome-384x384.png +0 -0
  130. package/src/client/public/default/android-chrome-48x48.png +0 -0
  131. package/src/client/public/default/android-chrome-512x512.png +0 -0
  132. package/src/client/public/default/android-chrome-72x72.png +0 -0
  133. package/src/client/public/default/android-chrome-96x96.png +0 -0
  134. package/src/client/public/default/apple-touch-icon-1024x1024.png +0 -0
  135. package/src/client/public/default/apple-touch-icon-114x114.png +0 -0
  136. package/src/client/public/default/apple-touch-icon-120x120.png +0 -0
  137. package/src/client/public/default/apple-touch-icon-144x144.png +0 -0
  138. package/src/client/public/default/apple-touch-icon-152x152.png +0 -0
  139. package/src/client/public/default/apple-touch-icon-167x167.png +0 -0
  140. package/src/client/public/default/apple-touch-icon-180x180.png +0 -0
  141. package/src/client/public/default/apple-touch-icon-57x57.png +0 -0
  142. package/src/client/public/default/apple-touch-icon-60x60.png +0 -0
  143. package/src/client/public/default/apple-touch-icon-72x72.png +0 -0
  144. package/src/client/public/default/apple-touch-icon-76x76.png +0 -0
  145. package/src/client/public/default/apple-touch-icon-precomposed.png +0 -0
  146. package/src/client/public/default/apple-touch-icon.png +0 -0
  147. package/src/client/public/default/apple-touch-startup-image-1125x2436.png +0 -0
  148. package/src/client/public/default/apple-touch-startup-image-1136x640.png +0 -0
  149. package/src/client/public/default/apple-touch-startup-image-1170x2532.png +0 -0
  150. package/src/client/public/default/apple-touch-startup-image-1179x2556.png +0 -0
  151. package/src/client/public/default/apple-touch-startup-image-1242x2208.png +0 -0
  152. package/src/client/public/default/apple-touch-startup-image-1242x2688.png +0 -0
  153. package/src/client/public/default/apple-touch-startup-image-1284x2778.png +0 -0
  154. package/src/client/public/default/apple-touch-startup-image-1290x2796.png +0 -0
  155. package/src/client/public/default/apple-touch-startup-image-1334x750.png +0 -0
  156. package/src/client/public/default/apple-touch-startup-image-1488x2266.png +0 -0
  157. package/src/client/public/default/apple-touch-startup-image-1536x2048.png +0 -0
  158. package/src/client/public/default/apple-touch-startup-image-1620x2160.png +0 -0
  159. package/src/client/public/default/apple-touch-startup-image-1640x2160.png +0 -0
  160. package/src/client/public/default/apple-touch-startup-image-1668x2224.png +0 -0
  161. package/src/client/public/default/apple-touch-startup-image-1668x2388.png +0 -0
  162. package/src/client/public/default/apple-touch-startup-image-1792x828.png +0 -0
  163. package/src/client/public/default/apple-touch-startup-image-2048x1536.png +0 -0
  164. package/src/client/public/default/apple-touch-startup-image-2048x2732.png +0 -0
  165. package/src/client/public/default/apple-touch-startup-image-2160x1620.png +0 -0
  166. package/src/client/public/default/apple-touch-startup-image-2160x1640.png +0 -0
  167. package/src/client/public/default/apple-touch-startup-image-2208x1242.png +0 -0
  168. package/src/client/public/default/apple-touch-startup-image-2224x1668.png +0 -0
  169. package/src/client/public/default/apple-touch-startup-image-2266x1488.png +0 -0
  170. package/src/client/public/default/apple-touch-startup-image-2388x1668.png +0 -0
  171. package/src/client/public/default/apple-touch-startup-image-2436x1125.png +0 -0
  172. package/src/client/public/default/apple-touch-startup-image-2532x1170.png +0 -0
  173. package/src/client/public/default/apple-touch-startup-image-2556x1179.png +0 -0
  174. package/src/client/public/default/apple-touch-startup-image-2688x1242.png +0 -0
  175. package/src/client/public/default/apple-touch-startup-image-2732x2048.png +0 -0
  176. package/src/client/public/default/apple-touch-startup-image-2778x1284.png +0 -0
  177. package/src/client/public/default/apple-touch-startup-image-2796x1290.png +0 -0
  178. package/src/client/public/default/apple-touch-startup-image-640x1136.png +0 -0
  179. package/src/client/public/default/apple-touch-startup-image-750x1334.png +0 -0
  180. package/src/client/public/default/apple-touch-startup-image-828x1792.png +0 -0
  181. package/src/client/public/default/assets/background/white.jpg +0 -0
  182. package/src/client/public/default/assets/background/white0-min.jpg +0 -0
  183. package/src/client/public/default/assets/background/white0.jpg +0 -0
  184. package/src/client/public/default/assets/logo/base-icon.png +0 -0
  185. package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
  186. package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
  187. package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
  188. package/src/client/public/default/browserconfig.xml +12 -0
  189. package/src/client/public/default/favicon-16x16.png +0 -0
  190. package/src/client/public/default/favicon-32x32.png +0 -0
  191. package/src/client/public/default/favicon-48x48.png +0 -0
  192. package/src/client/public/default/favicon.ico +0 -0
  193. package/src/client/public/default/manifest.webmanifest +69 -0
  194. package/src/client/public/default/mstile-144x144.png +0 -0
  195. package/src/client/public/default/mstile-150x150.png +0 -0
  196. package/src/client/public/default/mstile-310x150.png +0 -0
  197. package/src/client/public/default/mstile-310x310.png +0 -0
  198. package/src/client/public/default/mstile-70x70.png +0 -0
  199. package/src/client/public/default/plantuml/client-conf.svg +1 -0
  200. package/src/client/public/default/plantuml/client-schema.svg +1 -0
  201. package/src/client/public/default/plantuml/cron-conf.svg +1 -0
  202. package/src/client/public/default/plantuml/cron-schema.svg +1 -0
  203. package/src/client/public/default/plantuml/server-conf.svg +1 -0
  204. package/src/client/public/default/plantuml/server-schema.svg +1 -0
  205. package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
  206. package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
  207. package/src/client/public/default/site.webmanifest +69 -0
  208. package/src/client/public/default/sitemap +148 -0
  209. package/src/client/public/default/yandex-browser-50x50.png +0 -0
  210. package/src/client/public/default/yandex-browser-manifest.json +9 -0
  211. package/src/client/public/doc/favicon.ico +0 -0
  212. package/src/client/public/doc/sitemap +148 -0
  213. package/src/client/public/test/favicon.ico +0 -0
  214. package/src/client/public/test/sitemap +148 -0
  215. package/src/client/services/core/core.service.js +170 -0
  216. package/src/client/services/crypto/crypto.service.js +70 -0
  217. package/src/client/services/default/default.management.js +343 -0
  218. package/src/client/services/default/default.service.js +89 -0
  219. package/src/client/services/file/file.service.js +70 -0
  220. package/src/client/services/instance/instance.management.js +74 -0
  221. package/src/client/services/instance/instance.service.js +89 -0
  222. package/src/client/services/test/test.service.js +70 -0
  223. package/src/client/services/user/user.management.js +50 -0
  224. package/src/client/services/user/user.service.js +89 -0
  225. package/src/client/ssr/Render.js +237 -0
  226. package/src/client/ssr/common/Alert.js +75 -0
  227. package/src/client/ssr/common/SsrCore.js +91 -0
  228. package/src/client/ssr/common/Translate.js +26 -0
  229. package/src/client/ssr/common/Worker.js +28 -0
  230. package/src/client/ssr/components/body/CacheControl.js +114 -0
  231. package/src/client/ssr/components/body/DefaultSplashScreen.js +90 -0
  232. package/src/client/ssr/components/email/DefaultRecoverEmail.js +21 -0
  233. package/src/client/ssr/components/email/DefaultVerifyEmail.js +17 -0
  234. package/src/client/ssr/components/head/Css.js +241 -0
  235. package/src/client/ssr/components/head/DefaultScripts.js +3 -0
  236. package/src/client/ssr/components/head/Production.js +1 -0
  237. package/src/client/ssr/components/head/Pwa.js +146 -0
  238. package/src/client/ssr/components/head/PwaDefault.js +60 -0
  239. package/src/client/ssr/components/head/Seo.js +14 -0
  240. package/src/client/ssr/pages/404.js +12 -0
  241. package/src/client/ssr/pages/500.js +12 -0
  242. package/src/client/ssr/pages/maintenance.js +14 -0
  243. package/src/client/ssr/pages/offline.js +21 -0
  244. package/src/client/sw/default.sw.js +205 -0
  245. package/src/client/sw/template.sw.js +84 -0
  246. package/src/client.build.js +22 -0
  247. package/src/client.dev.js +21 -0
  248. package/src/db/DataBaseProvider.js +45 -0
  249. package/src/db/mariadb/MariaDB.js +33 -0
  250. package/src/db/mongo/MongooseDB.js +124 -0
  251. package/src/dns.js +22 -0
  252. package/src/index.js +43 -0
  253. package/src/mailer/EmailRender.js +69 -0
  254. package/src/mailer/MailerProvider.js +96 -0
  255. package/src/proxy.js +22 -0
  256. package/src/runtime/lampp/Lampp.js +115 -0
  257. package/src/runtime/nginx/Nginx.js +3 -0
  258. package/src/runtime/xampp/Xampp.js +49 -0
  259. package/src/server/auth.js +235 -0
  260. package/src/server/backup.js +120 -0
  261. package/src/server/client-build-live.js +98 -0
  262. package/src/server/client-build.js +754 -0
  263. package/src/server/client-dev-server.js +60 -0
  264. package/src/server/client-formatted.js +58 -0
  265. package/src/server/client-icons.js +151 -0
  266. package/src/server/conf.js +929 -0
  267. package/src/server/crypto.js +91 -0
  268. package/src/server/dns.js +118 -0
  269. package/src/server/downloader.js +42 -0
  270. package/src/server/logger.js +190 -0
  271. package/src/server/network.js +209 -0
  272. package/src/server/peer.js +33 -0
  273. package/src/server/process.js +66 -0
  274. package/src/server/prompt-optimizer.js +28 -0
  275. package/src/server/proxy.js +118 -0
  276. package/src/server/runtime.js +463 -0
  277. package/src/server/ssl.js +120 -0
  278. package/src/server.js +25 -0
  279. package/src/ws/IoInterface.js +45 -0
  280. package/src/ws/IoServer.js +39 -0
  281. package/src/ws/core/channels/core.ws.chat.js +23 -0
  282. package/src/ws/core/channels/core.ws.mailer.js +35 -0
  283. package/src/ws/core/channels/core.ws.stream.js +31 -0
  284. package/src/ws/core/core.ws.connection.js +28 -0
  285. package/src/ws/core/core.ws.emit.js +14 -0
  286. package/src/ws/core/core.ws.server.js +24 -0
  287. package/src/ws/core/management/core.ws.chat.js +8 -0
  288. package/src/ws/core/management/core.ws.mailer.js +16 -0
  289. package/src/ws/core/management/core.ws.stream.js +8 -0
  290. package/src/ws/default/channels/default.ws.main.js +16 -0
  291. package/src/ws/default/default.ws.connection.js +22 -0
  292. package/src/ws/default/default.ws.emit.js +14 -0
  293. package/src/ws/default/default.ws.server.js +20 -0
  294. package/src/ws/default/management/default.ws.main.js +8 -0
  295. package/startup.js +11 -0
  296. package/supervisord-openssh-server.conf +5 -0
  297. 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,331 @@
1
+ import { Badge } from './Badge.js';
2
+ import { BtnIcon } from './BtnIcon.js';
3
+ import { rgbToHex } from './CommonJs.js';
4
+ import { Css, darkTheme, dynamicCol, renderCssAttr, ThemeEvents, Themes } from './Css.js';
5
+ import { DropDown } from './DropDown.js';
6
+ import { buildBadgeToolTipMenuOption, Modal, renderMenuLabel, renderViewTitle } from './Modal.js';
7
+ import { listenQueryPathInstance, setQueryPath } from './Router.js';
8
+ import { Translate } from './Translate.js';
9
+ import { getProxyPath, getQueryParams, htmls, s } from './VanillaJs.js';
10
+ import Sortable from 'sortablejs';
11
+
12
+ // https://mintlify.com/docs/quickstart
13
+
14
+ const umlTypes = ['server', 'cron', 'client', 'ssr'];
15
+
16
+ const Docs = {
17
+ RenderModal: async function (type, modalOptions) {
18
+ const docData = this.Data.find((d) => d.type === type);
19
+ const ModalId = `modal-docs-${docData.type}`;
20
+ const { barConfig } = await Themes[Css.currentTheme]();
21
+ barConfig.buttons.close.onClick = () => {
22
+ setQueryPath({ path: 'docs' });
23
+ Modal.removeModal(ModalId);
24
+ };
25
+ await Modal.Render({
26
+ barConfig,
27
+ title: renderViewTitle(docData),
28
+ id: ModalId,
29
+ html: async () => {
30
+ if (docData.renderHtml) return await docData.renderHtml();
31
+ return html`
32
+ <iframe
33
+ class="in iframe-${ModalId}"
34
+ style="width: 100%; border: none; background: white"
35
+ src="${docData.url()}"
36
+ >
37
+ </iframe>
38
+ `;
39
+ },
40
+ maximize: true,
41
+ mode: 'view',
42
+ slideMenu: 'modal-menu',
43
+ observer: true,
44
+ barMode: 'top-bottom-bar',
45
+ query: true,
46
+ ...modalOptions,
47
+ });
48
+ Modal.Data[ModalId].onObserverListener[ModalId] = () => {
49
+ if (s(`.iframe-${ModalId}`))
50
+ s(`.iframe-${ModalId}`).style.height = `${s(`.${ModalId}`).offsetHeight - Modal.headerTitleHeight}px`;
51
+ };
52
+ Modal.Data[ModalId].onObserverListener[ModalId]();
53
+ },
54
+ Data: [
55
+ {
56
+ type: 'repo',
57
+ icon: html`<i class="fab fa-github"></i>`,
58
+ text: `Last Release`,
59
+ url: function () {
60
+ return `https://github.com/underpostnet/pwa-microservices-template-ghpkg/`;
61
+ },
62
+ },
63
+ {
64
+ type: 'demo',
65
+ icon: html`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 32 32">
66
+ <path fill="currentColor" d="M20 2v12l10-6z" />
67
+ <path
68
+ fill="currentColor"
69
+ d="M28 14v8H4V6h10V4H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8v4H8v2h16v-2h-4v-4h8a2 2 0 0 0 2-2v-8zM18 28h-4v-4h4z"
70
+ />
71
+ </svg>`,
72
+ text: html`Demo`,
73
+ url: function () {
74
+ return `https://underpostnet.github.io/pwa-microservices-template-ghpkg/`;
75
+ },
76
+ },
77
+ {
78
+ type: 'src',
79
+ icon: html`<i class="fa-brands fa-osi"></i>`,
80
+ text: 'Source Docs',
81
+ url: function () {
82
+ return `${getProxyPath()}docs/engine/2.7.9`;
83
+ },
84
+ },
85
+ {
86
+ type: 'api',
87
+ icon: html`<i class="fa-solid fa-arrows-turn-to-dots"></i>`,
88
+ text: `Api Docs`,
89
+ url: function () {
90
+ return `${getProxyPath()}api-docs`;
91
+ },
92
+ },
93
+ {
94
+ type: 'coverage',
95
+ icon: html`<img height="20" width="20" class="doc-icon-coverage" />`,
96
+ text: `Coverage report`,
97
+ url: function () {
98
+ return `${getProxyPath()}docs/coverage`;
99
+ },
100
+ themeEvent: () => {
101
+ if (s(`.doc-icon-coverage`))
102
+ s(`.doc-icon-coverage`).src = `https://cdn.simpleicons.org/coveralls/${rgbToHex(
103
+ window.getComputedStyle(s('html')).color,
104
+ )}`;
105
+ },
106
+ },
107
+ {
108
+ type: 'coverage-link',
109
+ icon: html`<img height="20" width="20" class="doc-icon-coverage-link" />`,
110
+ text: `Coverage`,
111
+ url: function () {
112
+ return `https://coveralls.io/github/underpostnet/engine`;
113
+ },
114
+ themeEvent: () => {
115
+ if (s(`.doc-icon-coverage-link`))
116
+ s(`.doc-icon-coverage-link`).src = `https://cdn.simpleicons.org/coveralls/${rgbToHex(
117
+ window.getComputedStyle(s('html')).color,
118
+ )}`;
119
+ },
120
+ },
121
+ ].concat(
122
+ umlTypes.map((umlType) => {
123
+ const umlId = `uml-${umlType}`;
124
+ return {
125
+ type: umlId,
126
+ icon: html`<i class="fas fa-sitemap"></i>`,
127
+ text: Translate.Render(`${umlType} config uml`),
128
+ url: function () {
129
+ return `/docs/?cid=${umlId}`;
130
+ },
131
+ renderHtml: function () {
132
+ return html` <div class="in section-mp">
133
+ <div class="in sub-title-modal"><i class="fas fa-project-diagram"></i> Schema</div>
134
+ </div>
135
+ <div class="in section-mp">
136
+ <a href="${getProxyPath()}docs/plantuml/${umlType}-schema.svg" target="_blank"
137
+ ><img class="in plantuml-svg" src="${getProxyPath()}docs/plantuml/${umlType}-schema.svg"
138
+ /></a>
139
+ </div>
140
+ <div class="in section-mp">
141
+ <div class="in sub-title-modal"><i class="fas fa-project-diagram"></i> Instance example</div>
142
+ </div>
143
+ <div class="in section-mp">
144
+ <a href="${getProxyPath()}docs/plantuml/${umlType}-conf.svg" target="_blank"
145
+ ><img class="in plantuml-svg" src="${getProxyPath()}docs/plantuml/${umlType}-conf.svg"
146
+ /></a>
147
+ </div>`;
148
+ },
149
+ };
150
+ }),
151
+ ),
152
+ Tokens: {},
153
+ Init: async function (options) {
154
+ const { idModal } = options;
155
+ this.Tokens[idModal] = options;
156
+ setTimeout(() => {
157
+ const cleanActive = () => {
158
+ s(`.btn-docs-src`).classList.remove('main-btn-menu-active');
159
+ s(`.btn-docs-api`).classList.remove('main-btn-menu-active');
160
+ s(`.btn-docs-coverage`).classList.remove('main-btn-menu-active');
161
+ for (const umlType of umlTypes) {
162
+ const umlId = `uml-${umlType}`;
163
+ s(`.btn-docs-${umlId}`).classList.remove('main-btn-menu-active');
164
+ }
165
+ };
166
+ s(`.btn-docs-src`).onclick = async () => {
167
+ setQueryPath({ path: 'docs', queryPath: 'src' });
168
+ cleanActive();
169
+ s(`.btn-docs-src`).classList.add('main-btn-menu-active');
170
+ await this.RenderModal('src', options.modalOptions);
171
+ };
172
+ s(`.btn-docs-api`).onclick = async () => {
173
+ setQueryPath({ path: 'docs', queryPath: 'api' });
174
+ cleanActive();
175
+ s(`.btn-docs-api`).classList.add('main-btn-menu-active');
176
+ await this.RenderModal('api', options.modalOptions);
177
+ };
178
+ s(`.btn-docs-coverage`).onclick = async () => {
179
+ setQueryPath({ path: 'docs', queryPath: 'coverage' });
180
+ cleanActive();
181
+ s(`.btn-docs-coverage`).classList.add('main-btn-menu-active');
182
+ await this.RenderModal('coverage', options.modalOptions);
183
+ };
184
+
185
+ s(`.btn-docs-coverage-link`).onclick = () => {
186
+ const docData = this.Data.find((d) => d.type === 'coverage-link');
187
+ location.href = docData.url();
188
+ };
189
+ s(`.btn-docs-repo`).onclick = () => {
190
+ const docData = this.Data.find((d) => d.type === 'repo');
191
+ location.href = docData.url();
192
+ };
193
+ s(`.btn-docs-demo`).onclick = () => {
194
+ const docData = this.Data.find((d) => d.type === 'demo');
195
+ location.href = docData.url();
196
+ };
197
+
198
+ for (const umlType of umlTypes) {
199
+ const umlId = `uml-${umlType}`;
200
+ s(`.btn-docs-${umlId}`).onclick = async () => {
201
+ cleanActive();
202
+ s(`.btn-docs-${umlId}`).classList.add('main-btn-menu-active');
203
+ setQueryPath({ path: 'docs', queryPath: umlId });
204
+ await this.RenderModal(umlId, { ...options.modalOptions, handleType: 'bar' });
205
+ };
206
+ }
207
+
208
+ listenQueryPathInstance({
209
+ id: options.idModal,
210
+ routeId: 'docs',
211
+ event: (path) => {
212
+ if (s(`.btn-docs-${path}`)) s(`.btn-docs-${path}`).click();
213
+ },
214
+ });
215
+ });
216
+ let docMenuRender = '';
217
+ for (const docData of this.Data) {
218
+ if (docData.themeEvent) {
219
+ ThemeEvents[`doc-icon-${docData.type}`] = docData.themeEvent;
220
+ setTimeout(ThemeEvents[`doc-icon-${docData.type}`]);
221
+ }
222
+ let tabHref, style, labelStyle;
223
+ switch (docData.type) {
224
+ case 'repo':
225
+ case 'coverage-link':
226
+ style = renderCssAttr({ style: { height: '45px' } });
227
+ labelStyle = renderCssAttr({ style: { top: '8px', left: '9px' } });
228
+ break;
229
+
230
+ default:
231
+ break;
232
+ }
233
+ tabHref = docData.url();
234
+ docMenuRender += html`
235
+ ${await BtnIcon.Render({
236
+ class: `in wfa main-btn-menu btn-docs-${docData.type}`,
237
+ label: html`<span class="menu-btn-icon">${docData.icon}</span
238
+ ><span class="menu-label-text"> ${docData.text} </span>`,
239
+ tabHref,
240
+ handleContainerClass: 'handle-btn-container',
241
+ tooltipHtml: await Badge.Render(buildBadgeToolTipMenuOption(docData.text, 'right')),
242
+ attrs: `data-id="${docData.type}"`,
243
+ handleContainerClass: 'handle-btn-container',
244
+ })}
245
+ `;
246
+ }
247
+
248
+ htmls('.menu-btn-container-children', html` <div class="fl menu-btn-container-docs">${docMenuRender}</div>`);
249
+ if (s(`.menu-btn-container-main`)) s(`.menu-btn-container-main`).classList.add('hide');
250
+ htmls(`.nav-path-display-${'modal-menu'}`, location.pathname);
251
+
252
+ this.Tokens[idModal] = new Sortable(s(`.menu-btn-container-docs`), {
253
+ animation: 150,
254
+ group: `docs-sortable`,
255
+ forceFallback: true,
256
+ fallbackOnBody: true,
257
+ handle: '.handle-btn-container',
258
+ store: {
259
+ /**
260
+ * Get the order of elements. Called once during initialization.
261
+ * @param {Sortable} sortable
262
+ * @returns {Array}
263
+ */
264
+ get: function (sortable) {
265
+ const order = localStorage.getItem(sortable.options.group.name);
266
+ return order ? order.split('|') : [];
267
+ },
268
+
269
+ /**
270
+ * Save the order of elements. Called onEnd (when the item is dropped).
271
+ * @param {Sortable} sortable
272
+ */
273
+ set: function (sortable) {
274
+ const order = sortable.toArray();
275
+ localStorage.setItem(sortable.options.group.name, order.join('|'));
276
+ },
277
+ },
278
+ // chosenClass: 'css-class',
279
+ // ghostClass: 'css-class',
280
+ // Element dragging ended
281
+ onEnd: function (/**Event*/ evt) {
282
+ // console.log('Sortable onEnd', evt);
283
+ // console.log('evt.oldIndex', evt.oldIndex);
284
+ // console.log('evt.newIndex', evt.newIndex);
285
+ const slotId = Array.from(evt.item.classList).pop();
286
+ // console.log('slotId', slotId);
287
+ if (evt.oldIndex === evt.newIndex) s(`.${slotId}`).click();
288
+
289
+ // var itemEl = evt.item; // dragged HTMLElement
290
+ // evt.to; // target list
291
+ // evt.from; // previous list
292
+ // evt.oldIndex; // element's old index within old parent
293
+ // evt.newIndex; // element's new index within new parent
294
+ // evt.oldDraggableIndex; // element's old index within old parent, only counting draggable elements
295
+ // evt.newDraggableIndex; // element's new index within new parent, only counting draggable elements
296
+ // evt.clone; // the clone element
297
+ // evt.pullMode; // when item is in another sortable: `"clone"` if cloning, `true` if moving
298
+ },
299
+ });
300
+
301
+ return '';
302
+ return html` <div class="in section-mp">${docMenuRender}</div>`;
303
+ return html` <div class="in section-mp">
304
+ ${await DropDown.Render({
305
+ id: 'dropdown-docs',
306
+ disableClose: true,
307
+ disableSelectLabel: true,
308
+ disableSelectOptionsLabel: true,
309
+ disableSearchBox: true,
310
+ open: true,
311
+ lastSelectClass: 'hover-active',
312
+ label: renderMenuLabel({
313
+ icon: html`<i class="fas fa-book"></i>`,
314
+ text: html`${Translate.Render('docs')}`,
315
+ }),
316
+ containerClass: '',
317
+ data: this.Data.map((docTypeData) => {
318
+ return {
319
+ display: docTypeData.label,
320
+ value: docTypeData.type,
321
+ onClick: async () => {
322
+ console.warn(this.viewUrl[docTypeData.type]());
323
+ },
324
+ };
325
+ }),
326
+ })}
327
+ </div>`;
328
+ },
329
+ };
330
+
331
+ 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 };