underpost 2.7.92 → 2.7.93

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.
package/bin/index.js CHANGED
@@ -19,7 +19,7 @@ const globalBinFolder = `${shellExec(`npm root -g`, {
19
19
 
20
20
  const program = new Command();
21
21
 
22
- const version = '2.7.92';
22
+ const version = '2.7.93';
23
23
 
24
24
  program.name('underpost').description(`underpost.net ci/cd cli ${version}`).version(version);
25
25
 
package/conf.js CHANGED
@@ -180,7 +180,7 @@ const DefaultConf = {
180
180
  ssr: {
181
181
  Default: {
182
182
  head: ['Seo', 'Pwa', 'Css', 'DefaultScripts', 'Production'],
183
- body: ['CacheControl', 'DefaultSplashScreen'],
183
+ body: ['CacheControl', 'DefaultSplashScreen', '404', '500'],
184
184
  mailer: {
185
185
  userVerifyEmail: 'DefaultVerifyEmail',
186
186
  userRecoverEmail: 'DefaultRecoverEmail',
@@ -58,7 +58,7 @@ services:
58
58
  cpus: '0.25'
59
59
  memory: 20M
60
60
  labels: # labels in Compose file instead of Dockerfile
61
- engine.version: '2.7.92'
61
+ engine.version: '2.7.93'
62
62
  networks:
63
63
  - load-balancer
64
64
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.7.92",
5
+ "version": "2.7.93",
6
6
  "description": "pwa api rest template",
7
7
  "scripts": {
8
8
  "start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
@@ -9,13 +9,13 @@ import { SignUpDefault } from './components/default/SignUpDefault.js';
9
9
  import { MenuDefault } from './components/default/MenuDefault.js';
10
10
  import { RouterDefault } from './components/default/RoutesDefault.js';
11
11
  import { TranslateDefault } from './components/default/TranslateDefault.js';
12
- import { getProxyPath } from './components/core/VanillaJs.js';
13
12
  import { Worker } from './components/core/Worker.js';
14
13
  import { Keyboard } from './components/core/Keyboard.js';
15
14
  import { DefaultParams } from './components/default/CommonDefault.js';
16
15
  import { SocketIo } from './components/core/SocketIo.js';
17
16
  import { SocketIoDefault } from './components/default/SocketIoDefault.js';
18
17
  import { ElementsDefault } from './components/default/ElementsDefault.js';
18
+ import { Scroll } from './components/core/Scroll.js';
19
19
 
20
20
  const htmlMainBody = async () => {
21
21
  return html`<span style="color: black; padding: 5px">Hello World!!</span>`;
@@ -35,6 +35,7 @@ window.onload = () =>
35
35
  await LogInDefault();
36
36
  await LogOutDefault();
37
37
  await SignUpDefault();
38
+ await Scroll.pullTopRefresh();
38
39
  await Keyboard.Init({ callBackTime: DefaultParams.EVENT_CALLBACK_TIME });
39
40
  },
40
41
  });
@@ -79,7 +79,7 @@ const Docs = {
79
79
  icon: html`<i class="fa-brands fa-osi"></i>`,
80
80
  text: 'Source Docs',
81
81
  url: function () {
82
- return `${getProxyPath()}docs/engine/2.7.92`;
82
+ return `${getProxyPath()}docs/engine/2.7.93`;
83
83
  },
84
84
  },
85
85
  {
@@ -1340,6 +1340,9 @@ const Modal = {
1340
1340
  backMenuButtonEvent();
1341
1341
  }
1342
1342
  s(`.btn-close-modal-menu`).click();
1343
+ if (window.location.pathname !== (getProxyPath() === '/' ? getProxyPath() : `${getProxyPath()}/`))
1344
+ setPath(getProxyPath());
1345
+ setDocTitle({ ...options.RouterInstance, route: '' });
1343
1346
  };
1344
1347
  EventsUI.onClick(`.btn-icon-menu-back`, backMenuButtonEvent);
1345
1348
  EventsUI.onClick(`.btn-icon-menu-mode`, () => {
@@ -1,4 +1,5 @@
1
- import { s } from './VanillaJs.js';
1
+ import { borderChar } from './Css.js';
2
+ import { append, s } from './VanillaJs.js';
2
3
 
3
4
  const Scroll = {
4
5
  data: {},
@@ -29,6 +30,69 @@ const Scroll = {
29
30
  behavior: options.behavior || 'smooth',
30
31
  });
31
32
  },
33
+ pullTopRefresh: function () {
34
+ append(
35
+ 'body',
36
+ html` <style>
37
+ .pull-refresh-icon-container {
38
+ height: 60px;
39
+ width: 100%;
40
+ z-index: 10;
41
+ transition: 0.3s;
42
+ left: 0px;
43
+ }
44
+ .pull-refresh-icon {
45
+ width: 60px;
46
+ height: 60px;
47
+ margin: auto;
48
+ color: white;
49
+ font-size: 30px;
50
+ }
51
+ </style>
52
+ ${borderChar(2, 'black', [' .pull-refresh-icon-container'])}
53
+ <div style="top: -60px" class="abs pull-refresh-icon-container">
54
+ <div class="in pull-refresh-icon">
55
+ <div class="abs center"><i class="fa-solid fa-arrows-rotate"></i></div>
56
+ </div>
57
+ </div>`,
58
+ );
59
+
60
+ let touchstartY = 0;
61
+ let reload = false;
62
+ const minHeightDragReload = 3;
63
+ const maxHeightDragReload = 20;
64
+
65
+ document.addEventListener('touchstart', (e) => {
66
+ touchstartY = e.touches[0].clientY;
67
+ // console.warn('touchstart', touchstartY);
68
+ });
69
+
70
+ document.addEventListener('touchmove', (e) => {
71
+ const touchY = e.touches[0].clientY;
72
+ const touchDiff = touchY - touchstartY;
73
+
74
+ // console.warn('touchDiff', touchDiff, maxHeightDragReload);
75
+
76
+ if (touchDiff > maxHeightDragReload)
77
+ s(`.pull-refresh-icon-container`).style.top = 60 + maxHeightDragReload + 'px';
78
+ else s(`.pull-refresh-icon-container`).style.top = 60 + touchDiff + 'px';
79
+
80
+ if (touchDiff > minHeightDragReload && window.scrollY === 0) {
81
+ reload = true;
82
+ } else {
83
+ reload = false;
84
+ }
85
+ });
86
+ document.addEventListener('touchend', (e) => {
87
+ // console.warn('touchend');
88
+ s(`.pull-refresh-icon-container`).style.top = '-60px';
89
+ if (reload) {
90
+ location.reload();
91
+ // console.warn('reload');
92
+ }
93
+ reload = false;
94
+ });
95
+ },
32
96
  };
33
97
 
34
98
  export { Scroll };
@@ -429,7 +429,9 @@ const isDevInstance = () => location.origin.match('localhost') && location.port;
429
429
  const getDataFromInputFile = async (file) => Array.from(new Uint8Array(await file.arrayBuffer()));
430
430
 
431
431
  const getLang = () =>
432
- (localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang).slice(0, 2);
432
+ (localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang)
433
+ .slice(0, 2)
434
+ .toLowerCase();
433
435
 
434
436
  export {
435
437
  s,
@@ -172,6 +172,7 @@ const MenuDefault = {
172
172
  return '';
173
173
  },
174
174
  mode: 'slide-menu',
175
+ RouterInstance,
175
176
  heightTopBar,
176
177
  heightBottomBar,
177
178
  htmlMainBody: options?.htmlMainBody ? options.htmlMainBody : undefined,
@@ -0,0 +1,73 @@
1
+ const s = (el) => document.querySelector(el);
2
+
3
+ const append = (el, html) => s(el).insertAdjacentHTML('beforeend', html);
4
+
5
+ const getLang = () =>
6
+ (localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang)
7
+ .slice(0, 2)
8
+ .toLowerCase();
9
+
10
+ const main = () => {
11
+ const Translate = {
12
+ Data: {
13
+ ['page-not-found']: {
14
+ en: 'Page not found',
15
+ es: 'Página no encontrada',
16
+ },
17
+ ['page-broken']: {
18
+ es: 'Algo salio mal',
19
+ en: 'Something went wrong',
20
+ },
21
+ ['back']: {
22
+ en: 'Back to <br> homepage',
23
+ es: 'Volver a <br> la pagina principal',
24
+ },
25
+ },
26
+ Render: function (id) {
27
+ return this.Data[id][getLang()] ? this.Data[id][getLang()] : this.Data[id]['en'];
28
+ },
29
+ };
30
+ const icon = html`
31
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 24 24">
32
+ <path
33
+ fill="currentColor"
34
+ d="M15.097 5.904A6.5 6.5 0 0 0 4 10.504l.001 1h-2v-1a8.5 8.5 0 1 1 15.176 5.258l5.344 5.345l-1.414 1.414l-5.344-5.345A8.48 8.48 0 0 1 10.5 19h-1v-2h1a6.5 6.5 0 0 0 4.596-11.096M1.672 13.257L4.5 16.086l2.829-2.829l1.414 1.415L5.915 17.5l2.828 2.828l-1.414 1.415L4.5 18.914l-2.828 2.829l-1.414-1.415L3.086 17.5L.258 14.672z"
35
+ />
36
+ </svg>
37
+ `;
38
+ append(
39
+ 'body',
40
+ html` <style>
41
+ body {
42
+ font-family: arial;
43
+ font-size: 20px;
44
+ background-color: #d8d8d8;
45
+ color: #333;
46
+ }
47
+ a {
48
+ color: black;
49
+ }
50
+ </style>
51
+
52
+ <div class="abs center" style="top: 45%">
53
+ ${icon}
54
+ <br />
55
+ <br />
56
+ <span class="bold">404</span>
57
+ <br />
58
+ <br />${Translate.Render('page-not-found')} <br />
59
+ <br />
60
+ <a href="${location.origin}">${Translate.Render('back')}</a>
61
+ </div>`,
62
+ );
63
+ };
64
+
65
+ SrrComponent = () => html`<script>
66
+ {
67
+ const s = ${s};
68
+ const append = ${append};
69
+ const getLang = ${getLang};
70
+ const main = ${main};
71
+ window.onload = main;
72
+ }
73
+ </script>`;
@@ -0,0 +1,72 @@
1
+ const s = (el) => document.querySelector(el);
2
+
3
+ const append = (el, html) => s(el).insertAdjacentHTML('beforeend', html);
4
+
5
+ const getLang = () =>
6
+ (localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang)
7
+ .slice(0, 2)
8
+ .toLowerCase();
9
+
10
+ const main = () => {
11
+ const Translate = {
12
+ Data: {
13
+ ['page-not-found']: {
14
+ en: 'Page not found',
15
+ es: 'Página no encontrada',
16
+ },
17
+ ['page-broken']: {
18
+ es: 'Algo salio mal',
19
+ en: 'Something went wrong',
20
+ },
21
+ ['back']: {
22
+ en: 'Back to <br> homepage',
23
+ es: 'Volver a <br> la pagina principal',
24
+ },
25
+ },
26
+ Render: function (id) {
27
+ return this.Data[id][getLang()] ? this.Data[id][getLang()] : this.Data[id]['en'];
28
+ },
29
+ };
30
+ const icon = html`<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 20 20">
31
+ <path
32
+ fill="currentColor"
33
+ d="M6 2a2 2 0 0 0-2 2v5.207a5.5 5.5 0 0 1 1-.185V4a1 1 0 0 1 1-1h4v3.5A1.5 1.5 0 0 0 11.5 8H15v8a1 1 0 0 1-1 1h-3.6a5.5 5.5 0 0 1-.657 1H14a2 2 0 0 0 2-2V7.414a1.5 1.5 0 0 0-.44-1.06l-3.914-3.915A1.5 1.5 0 0 0 10.586 2zm8.793 5H11.5a.5.5 0 0 1-.5-.5V3.207zM10 14.5a4.5 4.5 0 1 1-9 0a4.5 4.5 0 0 1 9 0M5.5 12a.5.5 0 0 0-.5.5v2a.5.5 0 0 0 1 0v-2a.5.5 0 0 0-.5-.5m0 5.125a.625.625 0 1 0 0-1.25a.625.625 0 0 0 0 1.25"
34
+ />
35
+ </svg>`;
36
+
37
+ append(
38
+ 'body',
39
+ html` <style>
40
+ body {
41
+ font-family: arial;
42
+ font-size: 20px;
43
+ background-color: #d8d8d8;
44
+ color: #333;
45
+ }
46
+ a {
47
+ color: black;
48
+ }
49
+ </style>
50
+
51
+ <div class="abs center" style="top: 45%">
52
+ ${icon}
53
+ <br />
54
+ <br />
55
+ <span class="bold">500</span>
56
+ <br />
57
+ <br />${Translate.Render('page-broken')} <br />
58
+ <br />
59
+ <a href="${location.origin}">${Translate.Render('back')}</a>
60
+ </div>`,
61
+ );
62
+ };
63
+
64
+ SrrComponent = () => html`<script>
65
+ {
66
+ const s = ${s};
67
+ const append = ${append};
68
+ const getLang = ${getLang};
69
+ const main = ${main};
70
+ window.onload = main;
71
+ }
72
+ </script>`;
@@ -109,6 +109,6 @@ SrrComponent = ({ ttiLoadTimeLimit }) => {
109
109
  const CacheControl = ${CacheControl};
110
110
  CacheControl({ ttiLoadTimeLimit: ${ttiLoadTimeLimit ? ttiLoadTimeLimit : 1000 * 70 * 1} });
111
111
  </script>
112
- <div class="clean-cache-container">v2.7.92</div>
112
+ <div class="clean-cache-container">v2.7.93</div>
113
113
  `;
114
114
  };
@@ -3,7 +3,9 @@ const s = (el) => document.querySelector(el);
3
3
  const append = (el, html) => s(el).insertAdjacentHTML('beforeend', html);
4
4
 
5
5
  const getLang = () =>
6
- (localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang).slice(0, 2);
6
+ (localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang)
7
+ .slice(0, 2)
8
+ .toLowerCase();
7
9
 
8
10
  const main = () => {
9
11
  const Translate = {
@@ -3,7 +3,9 @@ const s = (el) => document.querySelector(el);
3
3
  const append = (el, html) => s(el).insertAdjacentHTML('beforeend', html);
4
4
 
5
5
  const getLang = () =>
6
- (localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang).slice(0, 2);
6
+ (localStorage.getItem('lang') || navigator.language || navigator.userLanguage || s('html').lang)
7
+ .slice(0, 2)
8
+ .toLowerCase();
7
9
 
8
10
  const main = () => {
9
11
  const Translate = {