asab_webui_shell 27.2.3 → 27.2.5

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.
@@ -23,6 +23,7 @@
23
23
 
24
24
  /* Needed for background color of status indicator widget */
25
25
  html {
26
+ print-color-adjust: exact;
26
27
  -webkit-print-color-adjust: exact;
27
28
  }
28
29
 
@@ -166,7 +167,10 @@
166
167
 
167
168
 
168
169
  .reports-container {
169
- padding-top: 0 !important;
170
+ margin-top: 0 !important; /* Remove margin-top to prevent blank first page */
171
+ padding-top: 0 !important; /* Remove padding to prevent blank first page */
172
+ padding-bottom: 0 !important; /* Remove bottom padding to prevent blank spaces at the endof the sheet */
173
+ margin-bottom: 0 !important; /* Remove bottom margin to prevent blank spaces at the endof the sheet */
170
174
  .react-grid-layout {
171
175
  height: unset !important;
172
176
  display: table;
@@ -19,7 +19,14 @@ var ThemeButton = () => {
19
19
  } = (0, _asab_webui_components.useAppStore)();
20
20
  var theme = (0, _asab_webui_components.useAppSelector)(state => state.theme);
21
21
  var changeTheme = () => {
22
- var newTheme = theme == "light" ? "dark" : "light";
22
+ var newTheme = theme == 'light' ? 'dark' : 'light';
23
+
24
+ // Saving the theme in localStorage only with manual modification
25
+ try {
26
+ localStorage.setItem('asabTheme', newTheme);
27
+ } catch (error) {
28
+ console.warn('Failed to save theme to localStorage:', error);
29
+ }
23
30
  dispatch({
24
31
  type: _actions.CHANGE_THEME,
25
32
  theme: newTheme
@@ -27,7 +34,7 @@ var ThemeButton = () => {
27
34
  };
28
35
  return /*#__PURE__*/_react.default.createElement(_reactstrap.NavLink, {
29
36
  onClick: changeTheme,
30
- title: t("General|Change theme"),
37
+ title: t('General|Change theme'),
31
38
  href: "#"
32
39
  }, /*#__PURE__*/_react.default.createElement("i", {
33
40
  className: "bi bi-circle-half"
@@ -11,27 +11,44 @@ var _ThemeButton = _interopRequireDefault(require("./ThemeButton"));
11
11
  var _actions = require("./actions");
12
12
  class ThemeService extends _asab_webui_components.Service {
13
13
  constructor(app) {
14
- var serviceName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "ThemeService";
14
+ var serviceName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ThemeService';
15
15
  super(app, serviceName);
16
- app.ReduxService.addReducer("theme", _ThemeReducer.default);
16
+ app.ReduxService.addReducer('theme', _ThemeReducer.default);
17
17
  }
18
18
  initialize() {
19
19
  var _this$App, _this$App$dispatch;
20
- var headerService = this.App.locateService("HeaderService");
20
+ var headerService = this.App.locateService('HeaderService');
21
21
  headerService.addComponent({
22
22
  component: _ThemeButton.default,
23
23
  order: 400,
24
24
  fullscreenVisible: true
25
25
  });
26
- // Detect initial theme (based on color-scheme aka user prefered theme)
27
- // Doesn't work in Chromiuim in Ubuntu
28
- // more info https://bugs.chromium.org/p/chromium/issues/detail?id=998903
29
- var prefersColorScheme = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark" : "light";
26
+ var initialTheme;
27
+
28
+ // Check localStorage (read-only, no saving)
29
+ try {
30
+ var savedTheme = localStorage.getItem('asabTheme');
31
+ if (savedTheme) {
32
+ initialTheme = savedTheme;
33
+ }
34
+ } catch (error) {
35
+ console.warn('Failed to read theme from localStorage:', error);
36
+ }
37
+
38
+ // If there is nothing in localStorage, use the browser preferences.
39
+ if (!initialTheme) {
40
+ /*
41
+ Detect initial theme (based on color-scheme aka user prefered theme)
42
+ Doesn't work in Chromiuim in Ubuntu
43
+ more info https://bugs.chromium.org/p/chromium/issues/detail?id=998903
44
+ */
45
+ initialTheme = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
46
+ }
30
47
 
31
48
  // Dispatch theme
32
49
  (_this$App = this.App) === null || _this$App === void 0 || (_this$App = _this$App.AppStore) === null || _this$App === void 0 || (_this$App$dispatch = _this$App.dispatch) === null || _this$App$dispatch === void 0 || _this$App$dispatch.call(_this$App, {
33
50
  type: _actions.CHANGE_THEME,
34
- theme: prefersColorScheme
51
+ theme: initialTheme
35
52
  });
36
53
 
37
54
  // TODO: Add listener to the system theme and change light/dark based on that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asab_webui_shell",
3
- "version": "27.2.3",
3
+ "version": "27.2.5",
4
4
  "license": "BSD-3-Clause",
5
5
  "description": "TeskaLabs ASAB WebUI Shell Application",
6
6
  "contributors": [