underpost 3.2.4 → 3.2.8

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 (141) hide show
  1. package/.github/workflows/release.cd.yml +1 -2
  2. package/CHANGELOG.md +268 -1
  3. package/CLI-HELP.md +26 -13
  4. package/Dockerfile +0 -4
  5. package/README.md +3 -3
  6. package/bin/build.js +13 -3
  7. package/bin/deploy.js +570 -1
  8. package/bin/file.js +5 -0
  9. package/conf.js +11 -2
  10. package/jsconfig.json +1 -1
  11. package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +2 -3
  12. package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +2 -3
  13. package/manifests/deployment/dd-default-development/deployment.yaml +2 -6
  14. package/manifests/deployment/dd-test-development/deployment.yaml +136 -66
  15. package/manifests/deployment/dd-test-development/proxy.yaml +41 -5
  16. package/package.json +20 -11
  17. package/src/api/core/core.controller.js +10 -10
  18. package/src/api/core/core.service.js +10 -10
  19. package/src/api/default/default.controller.js +10 -10
  20. package/src/api/default/default.service.js +10 -10
  21. package/src/api/document/document.controller.js +12 -12
  22. package/src/api/document/document.model.js +10 -16
  23. package/src/api/file/file.controller.js +8 -8
  24. package/src/api/file/file.model.js +10 -10
  25. package/src/api/file/file.service.js +36 -36
  26. package/src/api/test/test.controller.js +8 -8
  27. package/src/api/test/test.service.js +8 -8
  28. package/src/api/user/guest.service.js +99 -0
  29. package/src/api/user/user.controller.js +6 -6
  30. package/src/api/user/user.model.js +8 -13
  31. package/src/api/user/user.service.js +3 -20
  32. package/src/cli/deploy.js +33 -30
  33. package/src/cli/fs.js +62 -5
  34. package/src/cli/image.js +43 -1
  35. package/src/cli/index.js +5 -1
  36. package/src/cli/release.js +58 -2
  37. package/src/cli/repository.js +35 -3
  38. package/src/cli/run.js +304 -38
  39. package/src/cli/ssh.js +1 -1
  40. package/src/cli/static.js +43 -115
  41. package/src/client/Default.index.js +21 -33
  42. package/src/client/components/core/404.js +4 -4
  43. package/src/client/components/core/500.js +4 -4
  44. package/src/client/components/core/Account.js +73 -60
  45. package/src/client/components/core/AgGrid.js +23 -33
  46. package/src/client/components/core/Alert.js +12 -13
  47. package/src/client/components/core/AppStore.js +1 -1
  48. package/src/client/components/core/Auth.js +20 -32
  49. package/src/client/components/core/Badge.js +7 -13
  50. package/src/client/components/core/BtnIcon.js +15 -17
  51. package/src/client/components/core/CalendarCore.js +42 -63
  52. package/src/client/components/core/Chat.js +13 -15
  53. package/src/client/components/core/ClientEvents.js +87 -0
  54. package/src/client/components/core/ColorPaletteElement.js +309 -0
  55. package/src/client/components/core/Content.js +17 -14
  56. package/src/client/components/core/Css.js +15 -71
  57. package/src/client/components/core/CssCore.js +12 -16
  58. package/src/client/components/core/D3Chart.js +4 -4
  59. package/src/client/components/core/Docs.js +60 -59
  60. package/src/client/components/core/DropDown.js +69 -91
  61. package/src/client/components/core/EventBus.js +92 -0
  62. package/src/client/components/core/EventsUI.js +14 -17
  63. package/src/client/components/core/FileExplorer.js +102 -234
  64. package/src/client/components/core/FullScreen.js +47 -75
  65. package/src/client/components/core/Input.js +24 -69
  66. package/src/client/components/core/Keyboard.js +25 -18
  67. package/src/client/components/core/KeyboardAvoidance.js +145 -0
  68. package/src/client/components/core/LoadingAnimation.js +25 -31
  69. package/src/client/components/core/LogIn.js +41 -41
  70. package/src/client/components/core/LogOut.js +23 -14
  71. package/src/client/components/core/Modal.js +397 -176
  72. package/src/client/components/core/NotificationManager.js +14 -18
  73. package/src/client/components/core/Panel.js +54 -50
  74. package/src/client/components/core/PanelForm.js +25 -125
  75. package/src/client/components/core/Polyhedron.js +110 -214
  76. package/src/client/components/core/PublicProfile.js +39 -32
  77. package/src/client/components/core/Recover.js +52 -48
  78. package/src/client/components/core/Responsive.js +88 -32
  79. package/src/client/components/core/RichText.js +9 -18
  80. package/src/client/components/core/Router.js +24 -3
  81. package/src/client/components/core/SearchBox.js +37 -37
  82. package/src/client/components/core/SignUp.js +39 -30
  83. package/src/client/components/core/SocketIo.js +31 -2
  84. package/src/client/components/core/SocketIoHandler.js +6 -6
  85. package/src/client/components/core/ToggleSwitch.js +8 -20
  86. package/src/client/components/core/ToolTip.js +5 -17
  87. package/src/client/components/core/Translate.js +56 -59
  88. package/src/client/components/core/Validator.js +26 -16
  89. package/src/client/components/core/Wallet.js +15 -26
  90. package/src/client/components/core/Worker.js +140 -25
  91. package/src/client/components/core/windowGetDimensions.js +7 -7
  92. package/src/client/components/default/{MenuDefault.js → AppShellDefault.js} +87 -87
  93. package/src/client/components/default/CssDefault.js +12 -12
  94. package/src/client/components/default/LogInDefault.js +6 -4
  95. package/src/client/components/default/LogOutDefault.js +6 -4
  96. package/src/client/components/default/RouterDefault.js +47 -0
  97. package/src/client/components/default/SettingsDefault.js +4 -4
  98. package/src/client/components/default/SignUpDefault.js +6 -4
  99. package/src/client/components/default/TranslateDefault.js +3 -3
  100. package/src/client/services/core/core.service.js +17 -49
  101. package/src/client/services/default/default.management.js +139 -242
  102. package/src/client/services/default/default.service.js +10 -16
  103. package/src/client/services/document/document.service.js +14 -19
  104. package/src/client/services/file/file.service.js +8 -13
  105. package/src/client/services/test/test.service.js +8 -13
  106. package/src/client/services/user/guest.service.js +79 -0
  107. package/src/client/services/user/user.management.js +5 -5
  108. package/src/client/services/user/user.service.js +14 -20
  109. package/src/client/ssr/body/404.js +3 -3
  110. package/src/client/ssr/body/500.js +3 -3
  111. package/src/client/ssr/body/CacheControl.js +5 -2
  112. package/src/client/ssr/body/DefaultSplashScreen.js +19 -12
  113. package/src/client/ssr/mailer/DefaultRecoverEmail.js +19 -20
  114. package/src/client/ssr/mailer/DefaultVerifyEmail.js +15 -16
  115. package/src/client/ssr/offline/Maintenance.js +12 -11
  116. package/src/client/ssr/offline/NoNetworkConnection.js +3 -3
  117. package/src/client/ssr/pages/Test.js +2 -2
  118. package/src/client/sw/core.sw.js +212 -0
  119. package/src/index.js +1 -1
  120. package/src/runtime/express/Dockerfile +4 -4
  121. package/src/runtime/lampp/Dockerfile +8 -7
  122. package/src/runtime/wp/Dockerfile +11 -17
  123. package/src/server/backup.js +1 -2
  124. package/src/server/client-build-docs.js +45 -46
  125. package/src/server/client-build.js +334 -60
  126. package/src/server/client-formatted.js +47 -16
  127. package/src/server/conf.js +29 -13
  128. package/src/server/cron.js +6 -8
  129. package/src/server/dns.js +2 -1
  130. package/src/server/ipfs-client.js +232 -91
  131. package/src/server/process.js +13 -27
  132. package/src/server/start.js +6 -3
  133. package/src/server/valkey.js +134 -235
  134. package/tsconfig.docs.json +15 -0
  135. package/typedoc.json +20 -0
  136. package/jsdoc.json +0 -52
  137. package/src/client/components/core/ColorPalette.js +0 -5267
  138. package/src/client/components/core/JoyStick.js +0 -80
  139. package/src/client/components/default/RoutesDefault.js +0 -49
  140. package/src/client/sw/default.sw.js +0 -127
  141. package/src/client/sw/template.sw.js +0 -84
@@ -39,21 +39,120 @@ import { SearchBox } from './SearchBox.js';
39
39
 
40
40
  const logger = loggerFactory(import.meta, { trace: true });
41
41
 
42
- const Modal = {
43
- Data: {},
42
+ /**
43
+ * @typedef {object} ModalBarButton
44
+ * @property {string} [label] - Button label HTML
45
+ * @property {boolean} [disabled] - Whether the button is hidden/disabled
46
+ * @property {Function} [onClick] - Optional click handler override
47
+ */
48
+
49
+ /**
50
+ * @typedef {object} ModalBarConfig
51
+ * @property {{ minimize: ModalBarButton, restore: ModalBarButton, maximize: ModalBarButton, close: ModalBarButton, menu: ModalBarButton }} buttons
52
+ */
53
+
54
+ /**
55
+ * @typedef {object} ModalRenderOptions
56
+ * @property {string} [id=''] - Modal element id/class name. Auto-generated if omitted.
57
+ * @property {ModalBarConfig} [barConfig={}] - Bar button configuration.
58
+ * @property {string} [title=''] - Modal title HTML.
59
+ * @property {string|Function} [html=''] - Modal body HTML or async factory.
60
+ * @property {string} [handleType='bar'] - Drag handle type ('bar' or default full).
61
+ * @property {string} [mode=''] - Layout mode: 'view', 'slide-menu', 'slide-menu-right', 'slide-menu-left', 'dropNotification'.
62
+ * @property {object} [RouterInstance={}] - Router instance for route-aware modals.
63
+ * @property {string[]} [disableTools=[]] - Tool ids to hide ('app-icon', 'text-box', 'profile', 'center', 'lang', 'theme', 'navigator').
64
+ * @property {boolean} [observer=false] - Attach a ResizeObserver to the modal element.
65
+ * @property {boolean} [disableBoxShadow=false] - Remove box shadow from the modal.
66
+ * @property {boolean} [dragDisabled=false] - Disable dragging.
67
+ * @property {boolean} [maximize=false] - Immediately maximize the modal after render.
68
+ * @property {boolean} [disableCenter=false] - Skip auto-centering.
69
+ * @property {object} [style={}] - Inline style overrides applied via renderStyleTag.
70
+ * @property {string} [class=''] - Extra CSS class(es) on the modal wrapper.
71
+ * @property {string} [titleClass=''] - Class for the title element.
72
+ * @property {string} [btnBarModalClass=''] - Class override for the button bar container.
73
+ * @property {string} [btnContainerClass=''] - Class for each bar button.
74
+ * @property {string} [btnIconContainerClass=''] - Class for each bar button inner icon div.
75
+ * @property {string} [barClass=''] - Class for the top/bottom bar flex row.
76
+ * @property {string} [barMode=''] - Bar layout variant ('top-bottom-bar').
77
+ * @property {string} [renderType=''] - Insertion strategy ('prepend' or default append).
78
+ * @property {string} [selector='body'] - Parent selector for insertion.
79
+ * @property {string} [slideMenu=''] - Id of the slide-menu modal this view should attach to.
80
+ * @property {string} [route=''] - URL path segment for view-mode route tracking.
81
+ * @property {string} [status=''] - Status icon descriptor rendered in the bar.
82
+ * @property {boolean} [zIndexSync=false] - Enable z-index management for stacked view modals.
83
+ * @property {boolean} [query=false] - Snapshot the current query string into modal data.
84
+ * @property {string[]} [homeModals=[]] - Modal ids that belong to the home screen (not closed on home nav).
85
+ * @property {Function} [titleRender] - Function returning title HTML (takes priority over title string).
86
+ * @property {Function} [htmlMainBody] - Factory for main-body modal html (slide-menu mode).
87
+ * @property {Function} [slideMenuTopBarBannerFix] - Async factory for top-bar banner content.
88
+ * @property {number} [minSearchQueryLength=1] - Minimum search query length.
89
+ * @property {Function} [onCollapseMenu] - Callback when slide menu collapses.
90
+ * @property {Function} [onExtendMenu] - Callback when slide menu extends.
91
+ */
92
+
93
+ /**
94
+ * @typedef {object} ModalDataEntry
95
+ * @property {ModalRenderOptions} options - Original render options.
96
+ * @property {Object.<string, Function>} onCloseListener - Close event listeners keyed by id.
97
+ * @property {Object.<string, Function>} onMenuListener - Menu button event listeners.
98
+ * @property {Object.<string, Function>} onCollapseMenuListener - Collapse menu listeners.
99
+ * @property {Object.<string, Function>} onExtendMenuListener - Extend menu listeners.
100
+ * @property {Object.<string, Function>} onDragEndListener - Drag-end listeners.
101
+ * @property {Object.<string, Function>} onObserverListener - ResizeObserver listeners.
102
+ * @property {Object.<string, Function>} onClickListener - Click listeners.
103
+ * @property {Object.<string, Function>} onExpandUiListener - UI expand/collapse listeners.
104
+ * @property {Object.<string, Function>} onBarUiOpen - Bar UI open listeners.
105
+ * @property {Object.<string, Function>} onBarUiClose - Bar UI close listeners.
106
+ * @property {Object.<string, Function>} onReloadModalListener - Reload listeners.
107
+ * @property {Object.<string, Function>} onHome - Home navigation listeners.
108
+ * @property {string[]} homeModals - Home modal ids.
109
+ * @property {string} [query] - Snapshotted query string.
110
+ * @property {Function} getTop - Returns computed top offset.
111
+ * @property {Function} getHeight - Returns computed modal height.
112
+ * @property {Function} getMenuLeftStyle - Returns slide menu left CSS value.
113
+ * @property {Function} center - Centers the modal in the viewport.
114
+ * @property {object} [slideMenu] - Active slide-menu link data.
115
+ * @property {ResizeObserver} [observer] - Attached ResizeObserver.
116
+ * @property {Function} [observerCallBack] - ResizeObserver callback.
117
+ * @property {Function} [setDragInstance] - Updates drag options and re-creates the Draggable.
118
+ * @property {object} [dragInstance] - Active Draggable instance.
119
+ * @property {object} [dragOptions] - Current drag configuration.
120
+ */
121
+
122
+ class Modal {
123
+ /** @type {Object.<string, ModalDataEntry>} */
124
+ static Data = {};
44
125
 
45
- Render: async function (
126
+ /**
127
+ * Create or reload a modal. When the modal already exists in the DOM the
128
+ * existing instance is reloaded via its onReloadModalListener callbacks.
129
+ * @param {ModalRenderOptions} options
130
+ * @returns {Promise<ModalDataEntry & { id: string }>}
131
+ */
132
+ static async instance(
46
133
  options = {
47
134
  id: '',
48
135
  barConfig: {},
49
136
  title: '',
50
137
  html: '',
51
138
  handleType: 'bar',
52
- mode: '' /* slide-menu */,
139
+ mode: '',
53
140
  RouterInstance: {},
54
141
  disableTools: [],
55
142
  observer: false,
56
143
  disableBoxShadow: false,
144
+ dragDisabled: false,
145
+ maximize: false,
146
+ disableCenter: false,
147
+ style: {},
148
+ class: '',
149
+ titleClass: '',
150
+ barMode: '',
151
+ route: '',
152
+ slideMenu: '',
153
+ zIndexSync: false,
154
+ query: false,
155
+ homeModals: [],
57
156
  },
58
157
  ) {
59
158
  const originHeightBottomBar = 50;
@@ -145,11 +244,14 @@ const Modal = {
145
244
  });
146
245
  }
147
246
 
148
- Responsive.Event[`view-${idModal}`] = () => {
149
- if (!this.Data[idModal]) return delete Responsive.Event[`view-${idModal}`];
150
- if (this.Data[idModal].slideMenu) s(`.${idModal}`).style.height = `${this.Data[idModal].getHeight()}px`;
151
- };
152
- Responsive.Event[`view-${idModal}`]();
247
+ Responsive.onChanged(
248
+ () => {
249
+ if (!this.Data[idModal]) return Responsive.offChanged(`view-${idModal}`);
250
+ if (this.Data[idModal].slideMenu) s(`.${idModal}`).style.height = `${this.Data[idModal].getHeight()}px`;
251
+ },
252
+ { key: `view-${idModal}` },
253
+ );
254
+ Responsive.triggerChanged(`view-${idModal}`);
153
255
 
154
256
  // Handle view mode modal route
155
257
  if (options.route) {
@@ -251,23 +353,30 @@ const Modal = {
251
353
  // barConfig.buttons.menu.disabled = true;
252
354
  // barConfig.buttons.close.disabled = true;
253
355
  options.btnBarModalClass = 'hide';
254
- Responsive.Event[`slide-menu-${idModal}`] = () => {
255
- for (const _idModal of Object.keys(this.Data)) {
256
- if (this.Data[_idModal].slideMenu && this.Data[_idModal].slideMenu.id === idModal)
257
- this.Data[_idModal].slideMenu.callBack();
258
- }
259
- s(`.${idModal}`).style.height = `${Modal.Data[idModal].getHeight()}px`;
260
- s(`.${idModal}`).style.left = Modal.Data[idModal].getMenuLeftStyle({
261
- open: s(`.btn-bar-center-icon-menu`).classList.contains('hide') ? true : false,
262
- });
263
- if (s(`.main-body-top`)) {
264
- if (Modal.mobileModal()) {
265
- if (s(`.btn-menu-${idModal}`).classList.contains('hide') && collapseSlideMenuWidth !== slideMenuWidth)
266
- s(`.main-body-top`).classList.remove('hide');
267
- if (s(`.btn-close-${idModal}`).classList.contains('hide')) s(`.main-body-top`).classList.add('hide');
268
- } else if (!s(`.main-body-top`).classList.contains('hide')) s(`.main-body-top`).classList.add('hide');
269
- }
270
- };
356
+ Responsive.onChanged(
357
+ () => {
358
+ for (const _idModal of Object.keys(this.Data)) {
359
+ if (this.Data[_idModal].slideMenu && this.Data[_idModal].slideMenu.id === idModal)
360
+ this.Data[_idModal].slideMenu.callBack();
361
+ }
362
+ s(`.${idModal}`).style.height = `${Modal.Data[idModal].getHeight()}px`;
363
+ s(`.${idModal}`).style.left = Modal.Data[idModal].getMenuLeftStyle({
364
+ open: s(`.btn-bar-center-icon-menu`).classList.contains('hide') ? true : false,
365
+ });
366
+ if (s(`.main-body-top`)) {
367
+ if (Modal.mobileModal()) {
368
+ if (
369
+ s(`.btn-menu-${idModal}`).classList.contains('hide') &&
370
+ collapseSlideMenuWidth !== slideMenuWidth
371
+ )
372
+ s(`.main-body-top`).classList.remove('hide');
373
+ if (s(`.btn-close-${idModal}`).classList.contains('hide'))
374
+ s(`.main-body-top`).classList.add('hide');
375
+ } else if (!s(`.main-body-top`).classList.contains('hide')) s(`.main-body-top`).classList.add('hide');
376
+ }
377
+ },
378
+ { key: `slide-menu-${idModal}` },
379
+ );
271
380
  barConfig.buttons.menu.onClick = () => {
272
381
  Modal.Data[idModal][options.mode].width = slideMenuWidth;
273
382
  s(`.btn-menu-${idModal}`).classList.add('hide');
@@ -290,7 +399,7 @@ const Modal = {
290
399
  } else {
291
400
  s(`.${idModal}`).style.left = `0px`;
292
401
  }
293
- Responsive.Event[`slide-menu-${idModal}`]();
402
+ Responsive.triggerChanged(`slide-menu-${idModal}`);
294
403
  };
295
404
  barConfig.buttons.close.onClick = () => {
296
405
  Modal.Data[idModal][options.mode].width = 0;
@@ -313,7 +422,7 @@ const Modal = {
313
422
  } else {
314
423
  s(`.${idModal}`).style.left = `-${originSlideMenuWidth}px`;
315
424
  }
316
- Responsive.Event[`slide-menu-${idModal}`]();
425
+ Responsive.triggerChanged(`slide-menu-${idModal}`);
317
426
  };
318
427
  transition += `, width 0.3s`;
319
428
 
@@ -421,15 +530,17 @@ const Modal = {
421
530
  for (const event of Object.keys(Modal.Data[idModal].onBarUiOpen))
422
531
  Modal.Data[idModal].onBarUiOpen[event]();
423
532
  }
424
- Responsive.Event[`slide-menu-modal-menu`]();
533
+ Responsive.triggerChanged(`slide-menu-modal-menu`);
425
534
  Object.keys(this.Data).map((_idModal) => {
426
535
  if (this.Data[_idModal].slideMenu) {
427
536
  if (s(`.btn-maximize-${_idModal}`)) s(`.btn-maximize-${_idModal}`).click();
428
537
  }
429
538
  });
430
- Responsive.Event[`view-${'main-body'}`]();
431
- if (Responsive.Event[`view-${'bottom-bar'}`]) Responsive.Event[`view-${'bottom-bar'}`]();
432
- if (Responsive.Event[`view-${'main-body-top'}`]) Responsive.Event[`view-${'main-body-top'}`]();
539
+ Responsive.triggerChanged(`view-${'main-body'}`);
540
+ if (Responsive.hasChangedListener(`view-${'bottom-bar'}`))
541
+ Responsive.triggerChanged(`view-${'bottom-bar'}`);
542
+ if (Responsive.hasChangedListener(`view-${'main-body-top'}`))
543
+ Responsive.triggerChanged(`view-${'main-body-top'}`);
433
544
  for (const keyEvent of Object.keys(this.Data[idModal].onExpandUiListener)) {
434
545
  this.Data[idModal].onExpandUiListener[keyEvent](
435
546
  !s(`.main-body-btn-ui-open`).classList.contains('hide'),
@@ -447,14 +558,14 @@ const Modal = {
447
558
  class="fl top-bar ${options.barClass ? options.barClass : ''}"
448
559
  style="height: ${originHeightTopBar}px;"
449
560
  >
450
- ${await BtnIcon.Render({
561
+ ${await BtnIcon.instance({
451
562
  style: `height: 100%`,
452
563
  class: 'in fll main-btn-menu action-bar-box action-btn-close hide',
453
564
  label: html` <div class="${contentIconClass} action-btn-close-render">
454
565
  <i class="fa-solid fa-xmark"></i>
455
566
  </div>`,
456
567
  })}
457
- ${await BtnIcon.Render({
568
+ ${await BtnIcon.instance({
458
569
  style: `height: 100%`,
459
570
  class: `in fll main-btn-menu action-bar-box action-btn-app-icon ${
460
571
  options?.disableTools?.includes('app-icon') ? 'hide' : ''
@@ -466,10 +577,12 @@ const Modal = {
466
577
  ? 'hide'
467
578
  : ''}"
468
579
  >
469
- ${await Input.Render({
580
+ ${await Input.instance({
470
581
  id: inputSearchBoxId,
471
582
  autocomplete: 'off',
472
- placeholder: Modal.mobileModal() ? Translate.Render('search', '.top-bar-search-box') : undefined, // html`<i class="fa-solid fa-magnifying-glass"></i> ${Translate.Render('search')}`,
583
+ placeholder: Modal.mobileModal()
584
+ ? Translate.instance('search', '.top-bar-search-box')
585
+ : undefined, // html`<i class="fa-solid fa-magnifying-glass"></i> ${Translate.instance('search')}`,
473
586
  placeholderIcon: html`<div
474
587
  class="in fll"
475
588
  style="width: ${originHeightTopBar}px; height: ${originHeightTopBar}px;"
@@ -480,19 +593,19 @@ const Modal = {
480
593
  class="inl wfm key-shortcut-container-info"
481
594
  style="${renderCssAttr({ style: { top: '10px', left: '60px' } })}"
482
595
  >
483
- ${await Badge.Render({
596
+ ${await Badge.instance({
484
597
  id: 'shortcut-key-info-search',
485
598
  text: 'Shift',
486
599
  classList: 'inl',
487
600
  style: { 'z-index': 1 },
488
601
  })}
489
- ${await Badge.Render({
602
+ ${await Badge.instance({
490
603
  id: 'shortcut-key-info-search',
491
604
  text: '+',
492
605
  classList: 'inl',
493
606
  style: { 'z-index': 1, background: 'none', color: '#5f5f5f' },
494
607
  })}
495
- ${await Badge.Render({
608
+ ${await Badge.instance({
496
609
  id: 'shortcut-key-info-search',
497
610
  text: 'k',
498
611
  classList: 'inl',
@@ -508,12 +621,12 @@ const Modal = {
508
621
  <div
509
622
  class="abs top-box-profile-container ${options?.disableTools?.includes('profile') ? 'hide' : ''}"
510
623
  >
511
- ${await BtnIcon.Render({
624
+ ${await BtnIcon.instance({
512
625
  style: `height: 100%`,
513
626
  class: 'in fll session-in-log-in main-btn-menu action-bar-box action-btn-profile-log-in',
514
627
  label: html` <div class="${contentIconClass} action-btn-profile-log-in-render"></div>`,
515
628
  })}
516
- ${await BtnIcon.Render({
629
+ ${await BtnIcon.instance({
517
630
  style: `height: 100%`,
518
631
  class: 'in fll session-in-log-out main-btn-menu action-bar-box action-btn-profile-log-out',
519
632
  label: html` <div class="${contentIconClass} action-btn-profile-log-out-render">
@@ -618,8 +731,8 @@ const Modal = {
618
731
  if (results.length === 0) {
619
732
  append(
620
733
  `.html-${searchBoxHistoryId}`,
621
- await BtnIcon.Render({
622
- label: html`<i class="fas fa-exclamation-circle"></i> ${Translate.Render('no-result-found')}`,
734
+ await BtnIcon.instance({
735
+ label: html`<i class="fas fa-exclamation-circle"></i> ${Translate.instance('no-result-found')}`,
623
736
  class: `wfa`,
624
737
  style: renderCssAttr({
625
738
  style: {
@@ -784,7 +897,7 @@ const Modal = {
784
897
  barConfig.buttons.menu.disabled = true;
785
898
  barConfig.buttons.close.disabled = false;
786
899
 
787
- await Modal.Render({
900
+ await Modal.instance({
788
901
  id: searchBoxHistoryId,
789
902
  barConfig,
790
903
  title: html`<div
@@ -794,13 +907,13 @@ const Modal = {
794
907
  <div class="search-box-recent-title">
795
908
  ${renderViewTitle({
796
909
  icon: html`<i class="fas fa-history mini-title"></i>`,
797
- text: Translate.Render('recent'),
910
+ text: Translate.instance('recent'),
798
911
  })}
799
912
  </div>
800
913
  <div class="search-box-result-title hide">
801
914
  ${renderViewTitle({
802
915
  icon: html`<i class="far fa-list-alt mini-title"></i>`,
803
- text: Translate.Render('results'),
916
+ text: Translate.instance('results'),
804
917
  })}
805
918
  </div>
806
919
  </div>
@@ -865,7 +978,7 @@ const Modal = {
865
978
  }
866
979
 
867
980
  // Add clear all button to the bar area, before the close button
868
- const clearAllBtnHtml = await BtnIcon.Render({
981
+ const clearAllBtnHtml = await BtnIcon.instance({
869
982
  class: `btn-search-history-clear-all btn-modal-default btn-modal-default-${searchBoxHistoryId}`,
870
983
  label: html`<i class="fas fa-trash-alt"></i>`,
871
984
  attrs: `title="Clear all recent items"`,
@@ -1032,7 +1145,7 @@ const Modal = {
1032
1145
  barConfig.buttons.menu.disabled = true;
1033
1146
  barConfig.buttons.close.disabled = true;
1034
1147
  const id = 'main-body';
1035
- await Modal.Render({
1148
+ await Modal.instance({
1036
1149
  id,
1037
1150
  barConfig,
1038
1151
  html: options.htmlMainBody ? options.htmlMainBody : () => html``,
@@ -1055,26 +1168,29 @@ const Modal = {
1055
1168
  const maxWidthInputSearchBox = 450;
1056
1169
  const paddingInputSearchBox = 5;
1057
1170
  const paddingRightSearchBox = 50;
1058
- Responsive.Event[`view-${id}`] = () => {
1059
- if (!this.Data[id] || !s(`.${id}`)) return delete Responsive.Event[`view-${id}`];
1060
- const widthInputSearchBox =
1061
- windowGetW() > maxWidthInputSearchBox ? maxWidthInputSearchBox : windowGetW();
1062
- s(`.top-bar-search-box-container`).style.width = `${
1063
- widthInputSearchBox - originHeightTopBar - paddingRightSearchBox - 1
1064
- }px`;
1065
- s(`.top-bar-search-box`).style.width = `${
1066
- widthInputSearchBox -
1067
- originHeightTopBar * 2 -
1068
- paddingRightSearchBox -
1069
- paddingInputSearchBox * 2 /*padding input*/ -
1070
- 10 /* right-margin */
1071
- }px`;
1072
- s(`.top-bar-search-box`).style.top = `${
1073
- (originHeightTopBar - s(`.top-bar-search-box`).clientHeight) / 2
1074
- }px`;
1075
- if (this.Data[id].slideMenu) s(`.${id}`).style.height = `${Modal.Data[id].getHeight()}px`;
1076
- };
1077
- Responsive.Event[`view-${id}`]();
1171
+ Responsive.onChanged(
1172
+ () => {
1173
+ if (!this.Data[id] || !s(`.${id}`)) return Responsive.offChanged(`view-${id}`);
1174
+ const widthInputSearchBox =
1175
+ windowGetW() > maxWidthInputSearchBox ? maxWidthInputSearchBox : windowGetW();
1176
+ s(`.top-bar-search-box-container`).style.width = `${
1177
+ widthInputSearchBox - originHeightTopBar - paddingRightSearchBox - 1
1178
+ }px`;
1179
+ s(`.top-bar-search-box`).style.width = `${
1180
+ widthInputSearchBox -
1181
+ originHeightTopBar * 2 -
1182
+ paddingRightSearchBox -
1183
+ paddingInputSearchBox * 2 /*padding input*/ -
1184
+ 10 /* right-margin */
1185
+ }px`;
1186
+ s(`.top-bar-search-box`).style.top = `${
1187
+ (originHeightTopBar - s(`.top-bar-search-box`).clientHeight) / 2
1188
+ }px`;
1189
+ if (this.Data[id].slideMenu) s(`.${id}`).style.height = `${Modal.Data[id].getHeight()}px`;
1190
+ },
1191
+ { key: `view-${id}` },
1192
+ );
1193
+ Responsive.triggerChanged(`view-${id}`);
1078
1194
  Keyboard.instanceMultiPressKey({
1079
1195
  id: 'input-search-shortcut-k',
1080
1196
  keys: [
@@ -1127,7 +1243,7 @@ const Modal = {
1127
1243
  class="fl ${options.barClass ? options.barClass : ''}"
1128
1244
  style="height: ${originHeightBottomBar}px;"
1129
1245
  >
1130
- ${await BtnIcon.Render({
1246
+ ${await BtnIcon.instance({
1131
1247
  style: `height: 100%`,
1132
1248
  class: `in fl${
1133
1249
  options.mode === 'slide-menu-right' ? 'r' : 'l'
@@ -1142,35 +1258,35 @@ const Modal = {
1142
1258
  </div>
1143
1259
  `,
1144
1260
  })}
1145
- ${await BtnIcon.Render({
1261
+ ${await BtnIcon.instance({
1146
1262
  style: `height: 100%`,
1147
1263
  class: `in flr main-btn-menu action-bar-box action-btn-lang ${
1148
1264
  options?.disableTools?.includes('lang') ? 'hide' : ''
1149
1265
  }`,
1150
1266
  label: html` <div class="${contentIconClass} action-btn-lang-render"></div>`,
1151
1267
  })}
1152
- ${await BtnIcon.Render({
1268
+ ${await BtnIcon.instance({
1153
1269
  style: `height: 100%`,
1154
1270
  class: `in flr main-btn-menu action-bar-box action-btn-theme ${
1155
1271
  options?.disableTools?.includes('theme') ? 'hide' : ''
1156
1272
  }`,
1157
1273
  label: html` <div class="${contentIconClass} action-btn-theme-render"></div>`,
1158
1274
  })}
1159
- ${await BtnIcon.Render({
1275
+ ${await BtnIcon.instance({
1160
1276
  style: `height: 100%`,
1161
1277
  class: `in flr main-btn-menu action-bar-box action-btn-home ${
1162
1278
  options?.disableTools?.includes('navigator') ? 'hide' : ''
1163
1279
  }`,
1164
1280
  label: html` <div class="${contentIconClass}"><i class="fas fa-home"></i></div>`,
1165
1281
  })}
1166
- ${await BtnIcon.Render({
1282
+ ${await BtnIcon.instance({
1167
1283
  style: `height: 100%`,
1168
1284
  class: `in flr main-btn-menu action-bar-box action-btn-right ${
1169
1285
  options?.disableTools?.includes('navigator') ? 'hide' : ''
1170
1286
  }`,
1171
1287
  label: html` <div class="${contentIconClass}"><i class="fas fa-chevron-right"></i></div>`,
1172
1288
  })}
1173
- ${await BtnIcon.Render({
1289
+ ${await BtnIcon.instance({
1174
1290
  style: `height: 100%`,
1175
1291
  class: `in flr main-btn-menu action-bar-box action-btn-left ${
1176
1292
  options?.disableTools?.includes('navigator') ? 'hide' : ''
@@ -1182,7 +1298,7 @@ const Modal = {
1182
1298
  if (options.heightBottomBar === 0 && options.heightTopBar > 0) {
1183
1299
  append(`.slide-menu-top-bar`, html` <div class="in ${id}">${await html()}</div>`);
1184
1300
  } else {
1185
- await Modal.Render({
1301
+ await Modal.instance({
1186
1302
  id,
1187
1303
  barConfig,
1188
1304
  html,
@@ -1201,13 +1317,16 @@ const Modal = {
1201
1317
  // maximize: true,
1202
1318
  barMode: options.barMode,
1203
1319
  });
1204
- Responsive.Event[`view-${id}`] = () => {
1205
- if (!this.Data[id] || !s(`.${id}`)) return delete Responsive.Event[`view-${id}`];
1206
- // <div class="in fll right-offset-menu-bottom-bar" style="height: 100%"></div>
1207
- // s(`.right-offset-menu-bottom-bar`).style.width = `${windowGetW() - slideMenuWidth}px`;
1208
- s(`.${id}`).style.top = `${Modal.Data['modal-menu'].getTop()}px`;
1209
- s(`.${id}`).style.width = `${windowGetW()}px`;
1210
- };
1320
+ Responsive.onChanged(
1321
+ () => {
1322
+ if (!this.Data[id] || !s(`.${id}`)) return Responsive.offChanged(`view-${id}`);
1323
+ // <div class="in fll right-offset-menu-bottom-bar" style="height: 100%"></div>
1324
+ // s(`.right-offset-menu-bottom-bar`).style.width = `${windowGetW() - slideMenuWidth}px`;
1325
+ s(`.${id}`).style.top = `${Modal.Data['modal-menu'].getTop()}px`;
1326
+ s(`.${id}`).style.width = `${windowGetW()}px`;
1327
+ },
1328
+ { key: `view-${id}` },
1329
+ );
1211
1330
  // Responsive.Event[`view-${id}`]();
1212
1331
  }
1213
1332
  EventsUI.onClick(`.action-btn-left`, (e) => {
@@ -1290,12 +1409,12 @@ const Modal = {
1290
1409
  barConfig.buttons.restore.disabled = true;
1291
1410
  barConfig.buttons.menu.disabled = true;
1292
1411
  barConfig.buttons.close.disabled = false;
1293
- await Modal.Render({
1412
+ await Modal.instance({
1294
1413
  id,
1295
1414
  barConfig,
1296
1415
  title: html`${renderViewTitle({
1297
1416
  icon: html`<i class="fas fa-language mini-title"></i>`,
1298
- text: Translate.Render('select lang'),
1417
+ text: Translate.instance('select lang'),
1299
1418
  })}`,
1300
1419
  html: async () => html`${await Translate.RenderSetting('action-drop-modal' + id)}`,
1301
1420
  titleClass: 'mini-title',
@@ -1349,7 +1468,7 @@ const Modal = {
1349
1468
  barConfig.buttons.menu.disabled = true;
1350
1469
  barConfig.buttons.close.disabled = true;
1351
1470
  const id = 'main-body-top';
1352
- await Modal.Render({
1471
+ await Modal.instance({
1353
1472
  id,
1354
1473
  barConfig,
1355
1474
  html: () => html``,
@@ -1368,24 +1487,27 @@ const Modal = {
1368
1487
  barMode: options.barMode,
1369
1488
  });
1370
1489
 
1371
- Responsive.Event[`view-${id}`] = () => {
1372
- if (!this.Data[id] || !s(`.${id}`)) return delete Responsive.Event[`view-${id}`];
1373
- s(`.${id}`).style.height =
1374
- s(`.main-body-btn-ui-close`).classList.contains('hide') &&
1375
- s(`.btn-restore-${id}`).style.display !== 'none'
1376
- ? `${windowGetH()}px`
1377
- : `${Modal.Data[id].getHeight()}px`;
1378
-
1379
- if (
1380
- s(`.main-body-btn-ui-close`).classList.contains('hide') &&
1381
- s(`.btn-restore-${id}`).style.display !== 'none'
1382
- ) {
1383
- s(`.${id}`).style.top = '0px';
1384
- } else {
1385
- s(`.${id}`).style.top = `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
1386
- }
1387
- };
1388
- Responsive.Event[`view-${id}`]();
1490
+ Responsive.onChanged(
1491
+ () => {
1492
+ if (!this.Data[id] || !s(`.${id}`)) return Responsive.offChanged(`view-${id}`);
1493
+ s(`.${id}`).style.height =
1494
+ s(`.main-body-btn-ui-close`).classList.contains('hide') &&
1495
+ s(`.btn-restore-${id}`).style.display !== 'none'
1496
+ ? `${windowGetH()}px`
1497
+ : `${Modal.Data[id].getHeight()}px`;
1498
+
1499
+ if (
1500
+ s(`.main-body-btn-ui-close`).classList.contains('hide') &&
1501
+ s(`.btn-restore-${id}`).style.display !== 'none'
1502
+ ) {
1503
+ s(`.${id}`).style.top = '0px';
1504
+ } else {
1505
+ s(`.${id}`).style.top = `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
1506
+ }
1507
+ },
1508
+ { key: `view-${id}` },
1509
+ );
1510
+ Responsive.triggerChanged(`view-${id}`);
1389
1511
 
1390
1512
  s(`.main-body-top`).onclick = () => s(`.btn-close-modal-menu`).click();
1391
1513
  }
@@ -1511,7 +1633,7 @@ const Modal = {
1511
1633
  >
1512
1634
  <div class="btn-bar-modal-container-render-${idModal}"></div>
1513
1635
  <div class="in flr bar-default-modal" style="z-index: 1">
1514
- ${await BtnIcon.Render({
1636
+ ${await BtnIcon.instance({
1515
1637
  class: `btn-minimize-${idModal} btn-modal-default btn-modal-default-${idModal} ${
1516
1638
  options?.btnContainerClass ? options.btnContainerClass : ''
1517
1639
  } ${options?.barConfig?.buttons?.minimize?.disabled ? 'hide' : ''}`,
@@ -1519,7 +1641,7 @@ const Modal = {
1519
1641
  ${options?.barConfig?.buttons?.minimize?.label ? options.barConfig.buttons.minimize.label : html`_`}
1520
1642
  </div>`,
1521
1643
  })}
1522
- ${await BtnIcon.Render({
1644
+ ${await BtnIcon.instance({
1523
1645
  class: `btn-restore-${idModal} btn-modal-default btn-modal-default-${idModal} ${
1524
1646
  options?.btnContainerClass ? options.btnContainerClass : ''
1525
1647
  } ${options?.barConfig?.buttons?.restore?.disabled ? 'hide' : ''}`,
@@ -1528,7 +1650,7 @@ const Modal = {
1528
1650
  </div>`,
1529
1651
  style: 'display: none',
1530
1652
  })}
1531
- ${await BtnIcon.Render({
1653
+ ${await BtnIcon.instance({
1532
1654
  class: `btn-maximize-${idModal} btn-modal-default btn-modal-default-${idModal} ${
1533
1655
  options?.btnContainerClass ? options.btnContainerClass : ''
1534
1656
  } ${options?.barConfig?.buttons?.maximize?.disabled ? 'hide' : ''}`,
@@ -1536,7 +1658,7 @@ const Modal = {
1536
1658
  ${options?.barConfig?.buttons?.maximize?.label ? options.barConfig.buttons.maximize.label : html`▢`}
1537
1659
  </div>`,
1538
1660
  })}
1539
- ${await BtnIcon.Render({
1661
+ ${await BtnIcon.instance({
1540
1662
  class: `btn-close-${idModal} btn-modal-default btn-modal-default-${idModal} ${
1541
1663
  options?.btnContainerClass ? options.btnContainerClass : ''
1542
1664
  } ${options?.barConfig?.buttons?.close?.disabled ? 'hide' : ''}`,
@@ -1544,7 +1666,7 @@ const Modal = {
1544
1666
  ${options?.barConfig?.buttons?.close?.label ? options.barConfig.buttons.close.label : html`X`}
1545
1667
  </div>`,
1546
1668
  })}
1547
- ${await BtnIcon.Render({
1669
+ ${await BtnIcon.instance({
1548
1670
  class: `btn-menu-${idModal} btn-modal-default btn-modal-default-${idModal} ${
1549
1671
  options?.btnContainerClass ? options.btnContainerClass : ''
1550
1672
  } ${options?.barConfig?.buttons?.menu?.disabled ? 'hide' : ''}`,
@@ -1572,7 +1694,7 @@ const Modal = {
1572
1694
  class="stq modal"
1573
1695
  style="${renderCssAttr({ style: { height: '50px', 'z-index': 1, top: '0px' } })}"
1574
1696
  >
1575
- ${await BtnIcon.Render({
1697
+ ${await BtnIcon.instance({
1576
1698
  style: renderCssAttr({ style: { height: '100%', color: '#5f5f5f' } }),
1577
1699
  class: `in flr main-btn-menu action-bar-box btn-icon-menu-mode`,
1578
1700
  label: html` <div class="abs center">
@@ -1588,14 +1710,14 @@ const Modal = {
1588
1710
  ></i>
1589
1711
  </div>`,
1590
1712
  })}
1591
- ${await BtnIcon.Render({
1713
+ ${await BtnIcon.instance({
1592
1714
  style: renderCssAttr({ style: { height: '100%', color: '#5f5f5f' } }),
1593
1715
  class: `in flr main-btn-menu action-bar-box btn-icon-menu-back hide`,
1594
1716
  label: html`<div class="abs center"><i class="fas fa-undo-alt"></i></div>`,
1595
1717
  })}
1596
1718
  <div class="abs sub-menu-title-container-${idModal} ac">
1597
1719
  <div class="abs nav-title-display-${idModal}">
1598
- <!-- <i class="fas fa-home"></i> ${Translate.Render('home')} -->
1720
+ <!-- <i class="fas fa-home"></i> ${Translate.instance('home')} -->
1599
1721
  </div>
1600
1722
  </div>
1601
1723
  <div class="abs nav-path-container-${idModal} ahc bold">
@@ -1635,7 +1757,7 @@ const Modal = {
1635
1757
  case 'slide-menu-right':
1636
1758
  case 'slide-menu-left':
1637
1759
  const backMenuButtonEvent = async () => {
1638
- // htmls(`.nav-title-display-${'modal-menu'}`, html`<i class="fas fa-home"></i> ${Translate.Render('home')}`);
1760
+ // htmls(`.nav-title-display-${'modal-menu'}`, html`<i class="fas fa-home"></i> ${Translate.instance('home')}`);
1639
1761
  htmls(`.nav-title-display-${'modal-menu'}`, html``);
1640
1762
  htmls(`.nav-path-display-${idModal}`, '');
1641
1763
  s(`.btn-icon-menu-back`).classList.add('hide');
@@ -1689,7 +1811,7 @@ const Modal = {
1689
1811
  );
1690
1812
  }
1691
1813
  Modal.Data[idModal][options.mode].width = slideMenuWidth;
1692
- Responsive.Event[`slide-menu-${idModal}`]();
1814
+ Responsive.triggerChanged(`slide-menu-${idModal}`);
1693
1815
  });
1694
1816
 
1695
1817
  break;
@@ -1964,22 +2086,25 @@ const Modal = {
1964
2086
  callBack,
1965
2087
  id: options.slideMenu,
1966
2088
  };
1967
- Responsive.Event['h-ui-hide-' + idModal] = () => {
1968
- setTimeout(() => {
1969
- if (!s(`.${idModal}`) || !s(`.main-body-btn-ui-close`)) return;
1970
- if (s(`.btn-restore-${idModal}`) && s(`.btn-restore-${idModal}`).style.display !== 'none') {
1971
- s(`.${idModal}`).style.height = s(`.main-body-btn-ui-close`).classList.contains('hide')
1972
- ? `${windowGetH()}px`
1973
- : `${Modal.Data[idModal].getHeight()}px`;
1974
- }
1975
- s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide')
1976
- ? `0px`
1977
- : `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
1978
- });
1979
- };
1980
- Responsive.Event['h-ui-hide-' + idModal]();
2089
+ Responsive.onChanged(
2090
+ () => {
2091
+ setTimeout(() => {
2092
+ if (!s(`.${idModal}`) || !s(`.main-body-btn-ui-close`)) return;
2093
+ if (s(`.btn-restore-${idModal}`) && s(`.btn-restore-${idModal}`).style.display !== 'none') {
2094
+ s(`.${idModal}`).style.height = s(`.main-body-btn-ui-close`).classList.contains('hide')
2095
+ ? `${windowGetH()}px`
2096
+ : `${Modal.Data[idModal].getHeight()}px`;
2097
+ }
2098
+ s(`.${idModal}`).style.top = s(`.main-body-btn-ui-close`).classList.contains('hide')
2099
+ ? `0px`
2100
+ : `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
2101
+ });
2102
+ },
2103
+ { key: 'h-ui-hide-' + idModal },
2104
+ );
2105
+ Responsive.triggerChanged('h-ui-hide-' + idModal);
1981
2106
  } else {
1982
- delete Responsive.Event['h-ui-hide-' + idModal];
2107
+ Responsive.offChanged('h-ui-hide-' + idModal);
1983
2108
  s(`.${idModal}`).style.width = '100%';
1984
2109
  s(`.${idModal}`).style.height = '100%';
1985
2110
  s(`.${idModal}`).style.top = `${options.heightTopBar ? options.heightTopBar : heightDefaultTopBar}px`;
@@ -2029,10 +2154,13 @@ const Modal = {
2029
2154
  id: idModal,
2030
2155
  ...this.Data[idModal],
2031
2156
  };
2032
- },
2033
- subMenuBtnClass: {},
2157
+ }
2034
2158
 
2035
- onHomeRouterEvent: async () => {
2159
+ /** @type {Object.<string, object>} */
2160
+ static subMenuBtnClass = {};
2161
+
2162
+ /** Navigate to the home route and close all non-home modals. */
2163
+ static onHomeRouterEvent = async () => {
2036
2164
  // 1. Get list of modals to close.
2037
2165
  const modalsToClose = Object.keys(Modal.Data).filter((idModal) => {
2038
2166
  const modal = Modal.Data[idModal];
@@ -2072,9 +2200,16 @@ const Modal = {
2072
2200
  if (s(`.btn-close-modal-menu`) && !s(`.btn-close-modal-menu`).classList.contains('hide')) {
2073
2201
  s(`.btn-close-modal-menu`).click();
2074
2202
  }
2075
- },
2076
- currentTopModalId: '',
2077
- zIndexSync: function ({ idModal }) {
2203
+ };
2204
+
2205
+ /** @type {string} */
2206
+ static currentTopModalId = '';
2207
+
2208
+ /**
2209
+ * Synchronise z-index for view modals, promoting the given modal to top.
2210
+ * @param {{ idModal: string }} param0
2211
+ */
2212
+ static zIndexSync({ idModal }) {
2078
2213
  setTimeout(() => {
2079
2214
  if (!this.Data[idModal]) return;
2080
2215
  const cleanTopModal = () => {
@@ -2100,14 +2235,30 @@ const Modal = {
2100
2235
  }
2101
2236
  };
2102
2237
  });
2103
- },
2104
- setTopModalCallback: function (idModal) {
2238
+ }
2239
+
2240
+ /**
2241
+ * @param {string} idModal
2242
+ */
2243
+ static setTopModalCallback(idModal) {
2105
2244
  s(`.${idModal}`).style.zIndex = '4';
2106
2245
  this.currentTopModalId = `${idModal}`;
2107
- },
2108
- mobileModal: () => windowGetW() < 600 || windowGetH() < 600,
2109
- writeHTML: ({ idModal, html }) => htmls(`.html-${idModal}`, html),
2110
- updateModal: async function ({ idModal, html, title }) {
2246
+ }
2247
+
2248
+ /** @returns {boolean} True when the viewport is considered mobile-sized. */
2249
+ static mobileModal = () => windowGetW() < 600 || windowGetH() < 600;
2250
+
2251
+ /**
2252
+ * @param {{ idModal: string, html: string }} param0
2253
+ */
2254
+ static writeHTML = ({ idModal, html }) => htmls(`.html-${idModal}`, html);
2255
+
2256
+ /**
2257
+ * Update an existing modal's content and/or title.
2258
+ * @param {{ idModal: string, html?: string, title?: string }} param0
2259
+ * @returns {Promise<boolean>}
2260
+ */
2261
+ static async updateModal({ idModal, html, title }) {
2111
2262
  if (!this.Data[idModal] || !s(`.${idModal}`)) {
2112
2263
  console.warn(`Modal ${idModal} not found for update`);
2113
2264
  return false;
@@ -2134,19 +2285,32 @@ const Modal = {
2134
2285
  }
2135
2286
 
2136
2287
  return true;
2137
- },
2138
- viewModalOpen: function () {
2288
+ }
2289
+
2290
+ /** @returns {string|undefined} Id of the first open view-mode modal, or undefined. */
2291
+ static viewModalOpen() {
2139
2292
  return Object.keys(this.Data).find((idModal) => s(`.${idModal}`) && this.Data[idModal].options.mode === 'view');
2140
- },
2141
- removeModal: function (idModal) {
2293
+ }
2294
+
2295
+ /**
2296
+ * Remove a modal element and its style tags, and delete its data entry.
2297
+ * @param {string} idModal
2298
+ */
2299
+ static removeModal(idModal) {
2142
2300
  if (!s(`.${idModal}`)) return;
2143
2301
  s(`.${idModal}`).remove();
2144
2302
  sa(`.style-${idModal}`).forEach((element) => {
2145
2303
  element.remove();
2146
2304
  });
2147
2305
  delete this.Data[idModal];
2148
- },
2149
- RenderConfirm: async function (options) {
2306
+ }
2307
+
2308
+ /**
2309
+ * Render a confirmation dialog and return a promise resolving to the user's choice.
2310
+ * @param {{ id: string, html: Function, icon?: string, disableBtnCancel?: boolean }} options
2311
+ * @returns {Promise<{ status: 'confirm'|'cancelled' }>}
2312
+ */
2313
+ static async RenderConfirm(options) {
2150
2314
  const { id } = options;
2151
2315
  append(
2152
2316
  'body',
@@ -2189,23 +2353,23 @@ const Modal = {
2189
2353
  </div>
2190
2354
  ${await options.html()}
2191
2355
  <div class="in section-mp">
2192
- ${await BtnIcon.Render({
2356
+ ${await BtnIcon.instance({
2193
2357
  class: `in section-mp form-button btn-confirm-${id}`,
2194
- label: Translate.Render('confirm'),
2358
+ label: Translate.instance('confirm'),
2195
2359
  type: 'submit',
2196
2360
  style: `margin: auto`,
2197
2361
  })}
2198
2362
  </div>
2199
2363
  <div class="in section-mp ${options.disableBtnCancel ? 'hide' : ''}">
2200
- ${await BtnIcon.Render({
2364
+ ${await BtnIcon.instance({
2201
2365
  class: `in section-mp form-button btn-cancel-${id}`,
2202
- label: Translate.Render('cancel'),
2366
+ label: Translate.instance('cancel'),
2203
2367
  type: 'submit',
2204
2368
  style: `margin: auto`,
2205
2369
  })}
2206
2370
  </div>
2207
2371
  `;
2208
- await Modal.Render({
2372
+ await Modal.instance({
2209
2373
  id,
2210
2374
  barConfig,
2211
2375
  titleClass: 'hide',
@@ -2242,10 +2406,20 @@ const Modal = {
2242
2406
  resolve({ status: 'confirm' });
2243
2407
  };
2244
2408
  });
2245
- },
2246
- labelSelectorTopOffsetStartAnimation: `-40px`,
2247
- labelSelectorTopOffsetEndAnimation: `-3px`,
2248
- menuTextLabelAnimation: (idModal, subMenuId) => {
2409
+ }
2410
+
2411
+ /** @type {string} */
2412
+ static labelSelectorTopOffsetStartAnimation = `-40px`;
2413
+
2414
+ /** @type {string} */
2415
+ static labelSelectorTopOffsetEndAnimation = `-3px`;
2416
+
2417
+ /**
2418
+ * Animate slide-menu labels into view.
2419
+ * @param {string} idModal - The slide-menu modal id.
2420
+ * @param {string} [subMenuId] - If provided, animate only this sub-menu.
2421
+ */
2422
+ static menuTextLabelAnimation = (idModal, subMenuId) => {
2249
2423
  if (
2250
2424
  !s(
2251
2425
  `.btn-icon-menu-mode-${Modal.Data[idModal].options.mode === 'slide-menu-right' ? 'left' : 'right'}`,
@@ -2288,19 +2462,20 @@ const Modal = {
2288
2462
  });
2289
2463
  }, 400);
2290
2464
  }
2291
- },
2465
+ };
2466
+
2292
2467
  // Move modal title element into the bar's render container so it aligns with control buttons
2293
2468
  /**
2294
- * Position a modal relative to an anchor element
2295
- * @param {Object} options - Positioning options
2469
+ * Position a modal relative to an anchor element.
2470
+ * @param {object} options - Positioning options
2296
2471
  * @param {string} options.modalSelector - CSS selector for the modal element
2297
2472
  * @param {string} options.anchorSelector - CSS selector for the anchor element
2298
- * @param {Object} [options.offset={x: 0, y: 6}] - Offset from anchor
2473
+ * @param {object} [options.offset={x: 0, y: 6}] - Offset from anchor
2299
2474
  * @param {string} [options.align='right'] - Horizontal alignment ('left' or 'right')
2300
2475
  * @param {boolean} [options.autoVertical=true] - Whether to automatically determine vertical position
2301
2476
  * @param {boolean} [options.placeAbove] - Force position above/below anchor (overrides autoVertical)
2302
2477
  */
2303
- positionRelativeToAnchor({
2478
+ static positionRelativeToAnchor({
2304
2479
  modalSelector,
2305
2480
  anchorSelector,
2306
2481
  offset = { x: 0, y: 6 },
@@ -2372,9 +2547,13 @@ const Modal = {
2372
2547
  } catch (e) {
2373
2548
  console.error('Error positioning modal:', e);
2374
2549
  }
2375
- },
2550
+ }
2376
2551
 
2377
- MoveTitleToBar(idModal) {
2552
+ /**
2553
+ * Move the title element inside the bar button container for inline alignment.
2554
+ * @param {string} idModal
2555
+ */
2556
+ static MoveTitleToBar(idModal) {
2378
2557
  try {
2379
2558
  const titleEl = s(`.title-modal-${idModal}`);
2380
2559
  const container = s(`.btn-bar-modal-container-render-${idModal}`);
@@ -2387,8 +2566,10 @@ const Modal = {
2387
2566
  } catch (e) {
2388
2567
  // non-fatal: keep default placement if structure not present
2389
2568
  }
2390
- },
2391
- setTopBannerLink: function () {
2569
+ }
2570
+
2571
+ /** Update the top-banner anchor href and bind the home-click handler. */
2572
+ static setTopBannerLink() {
2392
2573
  if (s(`.a-link-top-banner`)) {
2393
2574
  s(`.a-link-top-banner`).setAttribute('href', `${location.origin}${getProxyPath()}`);
2394
2575
  EventsUI.onClick(`.a-link-top-banner`, (e) => {
@@ -2396,32 +2577,72 @@ const Modal = {
2396
2577
  s(`.action-btn-home`).click();
2397
2578
  });
2398
2579
  }
2399
- },
2400
- headerTitleHeight: 40,
2401
- actionBtnCenter: function () {
2580
+ }
2581
+
2582
+ /** @type {number} */
2583
+ static headerTitleHeight = 40;
2584
+
2585
+ /** Toggle the slide-menu open/close via the center action button. */
2586
+ static actionBtnCenter() {
2402
2587
  if (!s(`.btn-close-modal-menu`).classList.contains('hide')) {
2403
2588
  return s(`.btn-close-modal-menu`).click();
2404
2589
  }
2405
2590
  if (!s(`.btn-menu-modal-menu`).classList.contains('hide')) {
2406
2591
  return s(`.btn-menu-modal-menu`).click();
2407
2592
  }
2408
- },
2409
- cleanUI: function () {
2593
+ }
2594
+
2595
+ /** Hide the top-bar, bottom-bar and slide-menu (full-screen mode). */
2596
+ static cleanUI() {
2410
2597
  s(`.top-bar`).classList.add('hide');
2411
2598
  s(`.bottom-bar`).classList.add('hide');
2412
2599
  s(`.modal-menu`).classList.add('hide');
2413
- },
2414
- restoreUI: function () {
2600
+ }
2601
+
2602
+ /** Restore the top-bar, bottom-bar and slide-menu after cleanUI. */
2603
+ static restoreUI() {
2415
2604
  s(`.top-bar`).classList.remove('hide');
2416
2605
  s(`.bottom-bar`).classList.remove('hide');
2417
2606
  s(`.modal-menu`).classList.remove('hide');
2418
- },
2419
- RenderSeoSanitizer: async () => {
2607
+ }
2608
+
2609
+ /**
2610
+ * Re-applies canonical top/height layout for maximized slide-menu-backed view modals.
2611
+ * This avoids iframe navigation leaving view containers offset at the top.
2612
+ */
2613
+ static syncViewLayout() {
2614
+ const modalMenuOptions = this.Data['modal-menu']?.options || {};
2615
+ const uiCollapsed = !!s(`.main-body-btn-ui-close`) && s(`.main-body-btn-ui-close`).classList.contains('hide');
2616
+ const topOffset = uiCollapsed ? 0 : modalMenuOptions.heightTopBar ? modalMenuOptions.heightTopBar : 50;
2617
+ const bottomOffset = uiCollapsed ? 0 : modalMenuOptions.heightBottomBar ? modalMenuOptions.heightBottomBar : 0;
2618
+ const height = `${windowGetH() - topOffset - bottomOffset}px`;
2619
+
2620
+ Object.keys(this.Data).forEach((idModal) => {
2621
+ const modalData = this.Data[idModal];
2622
+ const modalEl = s(`.${idModal}`);
2623
+ if (!modalData || !modalEl || !modalData.slideMenu) return;
2624
+ if (s(`.btn-restore-${idModal}`) && s(`.btn-restore-${idModal}`).style.display === 'none') return;
2625
+
2626
+ modalEl.style.position = 'fixed';
2627
+ modalEl.style.translate = '0px 0px';
2628
+ modalEl.style.transform = '';
2629
+ modalEl.style.top = `${topOffset}px`;
2630
+ modalEl.style.height = height;
2631
+ });
2632
+
2633
+ for (const id of coreUI) {
2634
+ const key = `view-${id}`;
2635
+ if (Responsive.hasChangedListener(key)) Responsive.triggerChanged(key);
2636
+ }
2637
+ }
2638
+
2639
+ /** Add missing `alt` attributes to all images for SEO/accessibility. */
2640
+ static RenderSeoSanitizer = async () => {
2420
2641
  sa('img').forEach((img) => {
2421
2642
  if (!img.getAttribute('alt')) img.setAttribute('alt', 'image ' + Worker.title + ' ' + s4());
2422
2643
  });
2423
- },
2424
- };
2644
+ };
2645
+ }
2425
2646
 
2426
2647
  const renderMenuLabel = ({ img, src, text, icon }) => {
2427
2648
  if (!img && !src) return html`<span class="inl menu-btn-icon">${icon}</span> ${text}`;
@@ -2478,7 +2699,7 @@ const renderViewTitle = (
2478
2699
  const buildBadgeToolTipMenuOption = (id, sideKey = 'left') => {
2479
2700
  const option = {
2480
2701
  id: `tooltip-content-main-btn-${id}`,
2481
- text: `${Translate.Render(`${id}`)}`,
2702
+ text: `${Translate.instance(`${id}`)}`,
2482
2703
  classList: 'tooltip-menu',
2483
2704
  style: { top: `-40px` },
2484
2705
  };