underpost 2.8.846 → 2.8.848

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 (34) hide show
  1. package/README.md +15 -2
  2. package/bin/build.js +7 -1
  3. package/bin/deploy.js +7 -1
  4. package/cli.md +17 -2
  5. package/conf.js +1 -1
  6. package/docker-compose.yml +1 -1
  7. package/manifests/deployment/dd-template-development/deployment.yaml +2 -2
  8. package/package.json +1 -1
  9. package/src/api/user/user.service.js +1 -4
  10. package/src/cli/cluster.js +6 -0
  11. package/src/cli/deploy.js +2 -1
  12. package/src/cli/index.js +7 -0
  13. package/src/cli/run.js +9 -1
  14. package/src/cli/ssh.js +32 -0
  15. package/src/client/Default.index.js +6 -2
  16. package/src/client/components/core/Account.js +1 -1
  17. package/src/client/components/core/Css.js +190 -14
  18. package/src/client/components/core/CssCore.js +3 -4
  19. package/src/client/components/core/Docs.js +4 -4
  20. package/src/client/components/core/LoadingAnimation.js +8 -15
  21. package/src/client/components/core/Modal.js +100 -7
  22. package/src/client/components/core/PanelForm.js +2 -3
  23. package/src/client/components/core/Router.js +22 -23
  24. package/src/client/components/core/SocketIo.js +3 -3
  25. package/src/client/components/core/VanillaJs.js +0 -3
  26. package/src/client/components/core/Worker.js +3 -1
  27. package/src/client/components/default/CssDefault.js +17 -3
  28. package/src/client/components/default/MenuDefault.js +241 -48
  29. package/src/client/components/default/RoutesDefault.js +6 -11
  30. package/src/client/public/default/assets/background/dark.jpg +0 -0
  31. package/src/client/public/default/assets/background/dark.svg +557 -0
  32. package/src/client/public/default/assets/logo/underpost.gif +0 -0
  33. package/src/index.js +9 -1
  34. package/src/server/client-build.js +1 -8
@@ -1,7 +1,7 @@
1
1
  import { CoreService } from '../../services/core/core.service.js';
2
2
  import { BtnIcon } from './BtnIcon.js';
3
3
  import { s4 } from './CommonJs.js';
4
- import { darkTheme, renderCssAttr } from './Css.js';
4
+ import { darkTheme, renderCssAttr, subThemeManager } from './Css.js';
5
5
  import { loggerFactory } from './Logger.js';
6
6
  import { append, getAllChildNodes, getProxyPath, htmls, s, sa } from './VanillaJs.js';
7
7
 
@@ -23,12 +23,12 @@ const LoadingAnimation = {
23
23
  <div
24
24
  class="fix progress-bar box-shadow ${id}"
25
25
  style="left: -100%; background: ${darkTheme
26
- ? LoadingAnimation.darkColor
27
- ? LoadingAnimation.darkColor
28
- : `#c9c9c9`
29
- : LoadingAnimation.lightColor
30
- ? LoadingAnimation.lightColor
31
- : `#515151`};"
26
+ ? subThemeManager.darkColor
27
+ ? subThemeManager.darkColor
28
+ : `#66e400`
29
+ : subThemeManager.lightColor
30
+ ? subThemeManager.lightColor
31
+ : `#157e00`};"
32
32
  ></div>
33
33
  `,
34
34
  );
@@ -140,14 +140,7 @@ const LoadingAnimation = {
140
140
  }, 300);
141
141
  });
142
142
  },
143
- lightColor: null,
144
- setLightColor: function (color) {
145
- this.lightColor = color;
146
- },
147
- darkColor: null,
148
- setDarkColor: function (color) {
149
- this.darkColor = color;
150
- },
143
+
151
144
  RenderCurrentSrcLoad: function (event) {
152
145
  if (s(`.ssr-loading-info`)) {
153
146
  let nameSrcLoad = event.data.path;
@@ -139,6 +139,71 @@ const Modal = {
139
139
  case 'slide-menu-right':
140
140
  case 'slide-menu-left':
141
141
  (async () => {
142
+ if (!options.slideMenuTopBarBannerFix) {
143
+ options.slideMenuTopBarBannerFix = async () => {
144
+ let style = html``;
145
+ if (options.barMode === 'top-bottom-bar') {
146
+ style = html`<style>
147
+ .default-slide-menu-top-bar-fix-logo-container {
148
+ width: 50px;
149
+ height: 50px;
150
+ }
151
+ .default-slide-menu-top-bar-fix-logo {
152
+ width: 40px;
153
+ height: 40px;
154
+ padding: 5px;
155
+ }
156
+ .default-slide-menu-top-bar-fix-title-container-text {
157
+ font-size: 26px;
158
+ top: 8px;
159
+ color: ${darkTheme ? '#ffffff' : '#000000'};
160
+ }
161
+ </style>`;
162
+ } else {
163
+ style = html`<style>
164
+ .default-slide-menu-top-bar-fix-logo-container {
165
+ width: 100px;
166
+ height: 100px;
167
+ }
168
+ .default-slide-menu-top-bar-fix-logo {
169
+ width: 50px;
170
+ height: 50px;
171
+ padding: 24px;
172
+ }
173
+ .default-slide-menu-top-bar-fix-title-container-text {
174
+ font-size: 30px;
175
+ top: 30px;
176
+ color: ${darkTheme ? '#ffffff' : '#000000'};
177
+ }
178
+ </style>`;
179
+ }
180
+ setTimeout(() => {
181
+ if (s(`.top-bar-app-icon`) && s(`.top-bar-app-icon`).src) {
182
+ s(`.default-slide-menu-top-bar-fix-logo`).src = s(`.top-bar-app-icon`).src;
183
+ if (s(`.top-bar-app-icon`).classList.contains('negative-color'))
184
+ s(`.default-slide-menu-top-bar-fix-logo`).classList.add('negative-color');
185
+ htmls(
186
+ `.default-slide-menu-top-bar-fix-title-container`,
187
+ html`
188
+ <div class="inl default-slide-menu-top-bar-fix-title-container-text">
189
+ ${options.RouterInstance.NameApp}
190
+ </div>
191
+ `,
192
+ );
193
+ } else
194
+ htmls(
195
+ `.default-slide-menu-top-bar-fix-logo-container`,
196
+ html`<div class="abs center">${s(`.action-btn-app-icon-render`).innerHTML}</div>`,
197
+ );
198
+ });
199
+
200
+ return html`${style}
201
+ <div class="in fll default-slide-menu-top-bar-fix-logo-container">
202
+ <img class="default-slide-menu-top-bar-fix-logo in fll" />
203
+ </div>
204
+ <div class="in fll default-slide-menu-top-bar-fix-title-container"></div>`;
205
+ };
206
+ }
142
207
  const { barConfig } = options;
143
208
  options.style = {
144
209
  position: 'absolute',
@@ -266,7 +331,9 @@ const Modal = {
266
331
  </div>
267
332
  </div>
268
333
  <div
269
- class="abs main-body-btn main-body-btn-bar-custom ${options?.slideMenuTopBarFix ? '' : 'hide'}"
334
+ class="abs main-body-btn main-body-btn-bar-custom ${options?.slideMenuTopBarBannerFix
335
+ ? ''
336
+ : 'hide'}"
270
337
  style="top: 100px; ${true || (options.mode && options.mode.match('right'))
271
338
  ? 'right'
272
339
  : 'left'}: 0px"
@@ -345,6 +412,7 @@ const Modal = {
345
412
  );
346
413
  }
347
414
  };
415
+ Modal.setTopBannerLink();
348
416
  });
349
417
 
350
418
  const inputSearchBoxId = `top-bar-search-box`;
@@ -429,12 +497,14 @@ const Modal = {
429
497
  })}
430
498
  </div>
431
499
  </div>
432
- ${options?.slideMenuTopBarFix
500
+ ${options?.slideMenuTopBarBannerFix
433
501
  ? html`<div
434
502
  class="abs modal slide-menu-top-bar-fix"
435
503
  style="height: ${options.heightTopBar}px; top: 0px"
436
504
  >
437
- ${await options.slideMenuTopBarFix()}
505
+ <a class="a-link-top-banner">
506
+ <div class="inl">${await options.slideMenuTopBarBannerFix()}</div></a
507
+ >
438
508
  </div>`
439
509
  : ''}
440
510
  </div>`,
@@ -643,6 +713,9 @@ const Modal = {
643
713
 
644
714
  const updateSearchBoxValue = (selector) => {
645
715
  if (!selector) selector = getDefaultSearchBoxSelector();
716
+ // check exist childNodes
717
+ if (!s(selector) || !s(selector).hasChildNodes()) return;
718
+
646
719
  if (s(selector).childNodes) {
647
720
  if (
648
721
  s(selector).childNodes[s(selector).childNodes.length - 1] &&
@@ -666,6 +739,10 @@ const Modal = {
666
739
 
667
740
  const setSearchValue = (selector) => {
668
741
  if (!selector) selector = getDefaultSearchBoxSelector();
742
+
743
+ // check exist childNodes
744
+ if (!s(selector) || !s(selector).hasChildNodes()) return;
745
+
669
746
  historySearchBox = historySearchBox.filter(
670
747
  (h) => h.routerId !== results[currentKeyBoardSearchBoxIndex].routerId,
671
748
  );
@@ -1072,11 +1149,18 @@ const Modal = {
1072
1149
  }
1073
1150
 
1074
1151
  {
1075
- ThemeEvents['action-btn-theme'] = () => {
1152
+ ThemeEvents['action-btn-theme'] = async () => {
1076
1153
  htmls(
1077
1154
  `.action-btn-theme-render`,
1078
1155
  html` ${darkTheme ? html` <i class="fas fa-moon"></i>` : html`<i class="far fa-sun"></i>`}`,
1079
1156
  );
1157
+ if (s(`.slide-menu-top-bar-fix`)) {
1158
+ htmls(
1159
+ `.slide-menu-top-bar-fix`,
1160
+ html`<a class="a-link-top-banner">${await options.slideMenuTopBarBannerFix()}</a>`,
1161
+ );
1162
+ Modal.setTopBannerLink();
1163
+ }
1080
1164
  };
1081
1165
  ThemeEvents['action-btn-theme']();
1082
1166
 
@@ -1463,12 +1547,12 @@ const Modal = {
1463
1547
  if (
1464
1548
  ![idModal, 'main-body-top', 'main-body'].concat(this.Data[idModal]?.homeModals || []).includes(keyModal)
1465
1549
  )
1466
- s(`.btn-close-${keyModal}`).click();
1550
+ if (s(`.btn-close-${keyModal}`)) s(`.btn-close-${keyModal}`).click();
1467
1551
  backMenuButtonEvent();
1468
1552
  }
1469
- s(`.btn-close-modal-menu`).click();
1553
+ if (s(`.btn-close-modal-menu`)) s(`.btn-close-modal-menu`).click();
1470
1554
  setPath(getProxyPath());
1471
- setDocTitle({ ...options.RouterInstance, route: '' });
1555
+ setDocTitle();
1472
1556
  };
1473
1557
  s(`.main-btn-home`).onclick = async () => {
1474
1558
  // await this.onHomeRouterEvent();
@@ -2138,6 +2222,15 @@ const Modal = {
2138
2222
  // non-fatal: keep default placement if structure not present
2139
2223
  }
2140
2224
  },
2225
+ setTopBannerLink: function () {
2226
+ if (s(`.a-link-top-banner`)) {
2227
+ s(`.a-link-top-banner`).setAttribute('href', `${location.origin}${getProxyPath()}`);
2228
+ EventsUI.onClick(`.a-link-top-banner`, (e) => {
2229
+ e.preventDefault();
2230
+ s(`.action-btn-home`).click();
2231
+ });
2232
+ }
2233
+ },
2141
2234
  headerTitleHeight: 40,
2142
2235
  actionBtnCenter: function () {
2143
2236
  if (!s(`.btn-close-modal-menu`).classList.contains('hide')) {
@@ -15,7 +15,7 @@ import { getSrcFromFileData } from './Input.js';
15
15
  import { imageShimmer, renderCssAttr } from './Css.js';
16
16
  import { Translate } from './Translate.js';
17
17
  import { Modal } from './Modal.js';
18
- import { closeModalRouteChangeEvents, listenQueryPathInstance, renderTitle, setQueryPath } from './Router.js';
18
+ import { closeModalRouteChangeEvents, listenQueryPathInstance, setQueryPath } from './Router.js';
19
19
 
20
20
  const PanelForm = {
21
21
  Data: {},
@@ -92,7 +92,7 @@ const PanelForm = {
92
92
  },
93
93
  ];
94
94
 
95
- const titleIcon = html`<i class="fa-solid fa-quote-left"></i>`;
95
+ const titleIcon = html`<i class="fa-solid fa-quote-left title-icon-${idPanel}"></i>`;
96
96
  const panelRender = async ({ data }) =>
97
97
  await Panel.Render({
98
98
  idPanel,
@@ -440,7 +440,6 @@ const PanelForm = {
440
440
  if (options.route === 'home') Modal.homeCid = newInstance(cid);
441
441
  htmls(`.${options.parentIdModal ? 'html-' + options.parentIdModal : 'main-body'}`, await renderSrrPanelData());
442
442
  await getPanelData();
443
- if (this.Data[idPanel].data.length === 1) renderTitle(this.Data[idPanel].data[0].title);
444
443
  htmls(
445
444
  `.${options.parentIdModal ? 'html-' + options.parentIdModal : 'main-body'}`,
446
445
  await panelRender({ data: this.Data[idPanel].data }),
@@ -6,28 +6,29 @@ import { Worker } from './Worker.js';
6
6
 
7
7
  // Router
8
8
 
9
+ const RouterEvents = {};
10
+ const closeModalRouteChangeEvents = {};
11
+
9
12
  const logger = loggerFactory(import.meta);
10
13
 
11
- const renderTitle = (title, nameApp) => htmls('title', html`${title} | ${nameApp ?? Worker.RouterInstance.NameApp}`);
12
-
13
- const setDocTitle = (options = { Routes: () => {}, route: '', NameApp: '' }) => {
14
- const { Routes, route, NameApp } = options;
15
- let title = titleFormatted(Routes()[`/${route}`].title);
16
- if (Routes()[`/${route}`].upperCase) title = title.toUpperCase();
17
- renderTitle(title, NameApp);
18
- {
19
- const routeId = route === '' ? 'home' : route;
20
- if (s(`.main-btn-${routeId}`)) {
21
- if (s(`.main-btn-menu-active`)) s(`.main-btn-menu-active`).classList.remove(`main-btn-menu-active`);
22
- if (s(`.main-btn-${routeId}`)) s(`.main-btn-${routeId}`).classList.add(`main-btn-menu-active`);
23
- }
14
+ const sanitizeRoute = (route) =>
15
+ !route || route === '/' || route === `\\`
16
+ ? 'home'
17
+ : route.toLowerCase().replaceAll('/', '').replaceAll(`\\`, '').replaceAll(' ', '-');
18
+
19
+ const setDocTitle = (route) => {
20
+ const _route = sanitizeRoute(route);
21
+ // logger.warn('setDocTitle', _route);
22
+ const title = titleFormatted(_route);
23
+ htmls('title', html`${title}${title.match(Worker.title.toLowerCase()) ? '' : ` | ${Worker.title}`}`);
24
+ if (s(`.main-btn-${_route}`)) {
25
+ if (s(`.main-btn-menu-active`)) s(`.main-btn-menu-active`).classList.remove(`main-btn-menu-active`);
26
+ if (s(`.main-btn-${_route}`)) s(`.main-btn-${_route}`).classList.add(`main-btn-menu-active`);
24
27
  }
25
28
  };
26
29
 
27
- const RouterEvents = {};
28
-
29
- const Router = function (options = { Routes: () => {}, e: new PopStateEvent(), NameApp: '' }) {
30
- const { e, Routes, NameApp } = options;
30
+ const Router = function (options = { Routes: () => {}, e: new PopStateEvent() }) {
31
+ const { e, Routes } = options;
31
32
  const proxyPath = getProxyPath();
32
33
  let path = window.location.pathname;
33
34
  logger.info(options);
@@ -43,7 +44,7 @@ const Router = function (options = { Routes: () => {}, e: new PopStateEvent(), N
43
44
 
44
45
  if (path === pushPath) {
45
46
  for (const event of Object.keys(RouterEvents)) RouterEvents[event](routerEvent);
46
- setDocTitle({ Routes, route, NameApp });
47
+ setDocTitle(route);
47
48
  return Routes()[`/${route}`].render();
48
49
  }
49
50
  }
@@ -79,7 +80,6 @@ const listenQueryPathInstance = ({ id, routeId, event }, queryKey = 'cid') => {
79
80
  });
80
81
  };
81
82
 
82
- const closeModalRouteChangeEvents = {};
83
83
  const triggerCloseModalRouteChangeEvents = (newPath) => {
84
84
  console.warn('[closeModalRouteChangeEvent]', newPath);
85
85
  for (const event of Object.keys(closeModalRouteChangeEvents)) closeModalRouteChangeEvents[event](newPath);
@@ -99,14 +99,14 @@ const closeModalRouteChangeEvent = (options = {}) => {
99
99
  newPath = `${newPath}${Modal.Data[subIdModal].options.route}`;
100
100
  triggerCloseModalRouteChangeEvents(newPath);
101
101
  setPath(newPath);
102
+ setDocTitle(newPath);
102
103
  Modal.setTopModalCallback(subIdModal);
103
- return setDocTitle({ ...RouterInstance, route: Modal.Data[subIdModal].options.route });
104
104
  }
105
105
  }
106
106
  newPath = `${newPath}${homeCid ? `?cid=${homeCid}` : ''}`;
107
107
  triggerCloseModalRouteChangeEvents(newPath);
108
108
  setPath(newPath);
109
- return setDocTitle({ ...RouterInstance, route: '' });
109
+ setDocTitle(newPath);
110
110
  }
111
111
  };
112
112
 
@@ -121,7 +121,7 @@ const handleModalViewRoute = (options = {}) => {
121
121
 
122
122
  if (path !== newPath) {
123
123
  setPath(newPath);
124
- setDocTitle({ ...RouterInstance, route });
124
+ setDocTitle(newPath);
125
125
  }
126
126
  };
127
127
 
@@ -135,5 +135,4 @@ export {
135
135
  closeModalRouteChangeEvent,
136
136
  handleModalViewRoute,
137
137
  closeModalRouteChangeEvents,
138
- renderTitle,
139
138
  };
@@ -21,11 +21,11 @@ const SocketIo = {
21
21
  },
22
22
  Init: async function (options) {
23
23
  if (this.socket) this.socket.disconnect();
24
- this.host = getWsBaseUrl({ wsBasePath: '' });
24
+ this.host = options.host ?? getWsBaseUrl({ wsBasePath: '' });
25
25
  logger.info(`ws host:`, this.host);
26
- const path = getWsBasePath();
26
+ const path = typeof options.path === 'string' ? options.path : getWsBasePath();
27
27
  const connectOptions = {
28
- path,
28
+ path: path === '/' ? undefined : path,
29
29
  // auth: {
30
30
  // token: '',
31
31
  // },
@@ -31,8 +31,6 @@ VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=bierner
31
31
 
32
32
  */
33
33
 
34
- // Docs by https://mintlify.com
35
-
36
34
  /**
37
35
  * Query selector.
38
36
  *
@@ -355,7 +353,6 @@ const getBlobFromUint8ArrayFile = (data = [[]], mimetype = 'application/octet-st
355
353
  * @memberof VanillaJS
356
354
  */
357
355
  const getProxyPath = () => {
358
- // warning: evaluates headers html source
359
356
  let path = location.pathname.split('/')[1] ? `/${location.pathname.split('/')[1]}/` : '/';
360
357
  if (window.Routes && path !== '/' && path.slice(0, -1) in window.Routes()) path = '/';
361
358
  return path;
@@ -12,7 +12,8 @@ const logger = loggerFactory(import.meta);
12
12
  const Worker = {
13
13
  devMode: () => location.origin.match('localhost') || location.origin.match('127.0.0.1'),
14
14
  instance: async function ({ router, render }) {
15
- logger.warn('Init');
15
+ Worker.title = `${s('title').textContent}`;
16
+ // logger.warn('Init worker', Worker.title);
16
17
  window.ononline = async () => {
17
18
  logger.warn('ononline');
18
19
  };
@@ -81,6 +82,7 @@ const Worker = {
81
82
  }
82
83
  window.serviceWorkerReady = true;
83
84
  },
85
+
84
86
  // Get the current service worker registration.
85
87
  getRegistration: async function () {
86
88
  return await navigator.serviceWorker.getRegistration();
@@ -1,13 +1,27 @@
1
+ import { subThemeManager } from '../core/Css.js';
2
+
3
+ const CssCommonDefault = async () => {
4
+ // use #4f46e5, #7c3aed);
5
+ subThemeManager.setDarkTheme('#7c3aed');
6
+ subThemeManager.setLightTheme('#7c3aed');
7
+
8
+ return html``;
9
+ };
10
+
1
11
  const CssDefaultDark = {
2
12
  theme: 'default-dark',
3
13
  dark: true,
4
- render: async () => html` <style></style> `,
14
+ render: async () => {
15
+ return (await CssCommonDefault()) + html``;
16
+ },
5
17
  };
6
18
 
7
19
  const CssDefaultLight = {
8
20
  theme: 'default-light',
9
21
  dark: false,
10
- render: async () => html` <style></style> `,
22
+ render: async () => {
23
+ return (await CssCommonDefault()) + html``;
24
+ },
11
25
  };
12
26
 
13
- export { CssDefaultDark, CssDefaultLight };
27
+ export { CssDefaultDark, CssCommonDefault, CssDefaultLight };