@lukso/core 1.2.0 → 1.2.2-dev.205b184

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 (60) hide show
  1. package/README.md +13 -0
  2. package/dist/{chunk-CUDG6NPH.cjs → chunk-GBVTZLYF.cjs} +4 -2
  3. package/dist/chunk-GBVTZLYF.cjs.map +1 -0
  4. package/dist/{chunk-SV4TVR2K.js → chunk-GD6H7BSG.js} +4 -6
  5. package/dist/chunk-GD6H7BSG.js.map +1 -0
  6. package/dist/{chunk-4TNWG4ME.js → chunk-HTK4HH4J.js} +11 -4
  7. package/dist/chunk-HTK4HH4J.js.map +1 -0
  8. package/dist/{chunk-RM42NG7E.cjs → chunk-IDQ6WJY5.cjs} +11 -4
  9. package/dist/chunk-IDQ6WJY5.cjs.map +1 -0
  10. package/dist/{chunk-FR74YPGJ.cjs → chunk-KPIUNN26.cjs} +9 -11
  11. package/dist/chunk-KPIUNN26.cjs.map +1 -0
  12. package/dist/{chunk-LQIOVPBE.js → chunk-O2MNO3WV.js} +4 -2
  13. package/dist/chunk-O2MNO3WV.js.map +1 -0
  14. package/dist/{chunk-3WGYJTN4.js → chunk-UF5VAIDL.js} +1 -1
  15. package/dist/chunk-UF5VAIDL.js.map +1 -0
  16. package/dist/{chunk-CC3LFUYY.cjs → chunk-UQSIH233.cjs} +1 -1
  17. package/dist/chunk-UQSIH233.cjs.map +1 -0
  18. package/dist/index.cjs +5 -5
  19. package/dist/index.d.cts +3 -3
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +4 -4
  22. package/dist/mixins/device.cjs +2 -2
  23. package/dist/mixins/device.d.cts +14 -2
  24. package/dist/mixins/device.d.ts +14 -2
  25. package/dist/mixins/device.js +1 -1
  26. package/dist/mixins/index.cjs +5 -5
  27. package/dist/mixins/index.d.cts +7 -3
  28. package/dist/mixins/index.d.ts +7 -3
  29. package/dist/mixins/index.js +4 -4
  30. package/dist/mixins/intl.cjs +3 -3
  31. package/dist/mixins/intl.d.cts +15 -2
  32. package/dist/mixins/intl.d.ts +15 -2
  33. package/dist/mixins/intl.js +2 -2
  34. package/dist/mixins/theme.cjs +2 -2
  35. package/dist/mixins/theme.d.cts +14 -2
  36. package/dist/mixins/theme.d.ts +14 -2
  37. package/dist/mixins/theme.js +1 -1
  38. package/dist/services/index.cjs +2 -2
  39. package/dist/services/index.js +1 -1
  40. package/dist/services/intl.cjs +2 -2
  41. package/dist/services/intl.d.cts +9 -0
  42. package/dist/services/intl.d.ts +9 -0
  43. package/dist/services/intl.js +1 -1
  44. package/package.json +9 -7
  45. package/src/index.ts +1 -1
  46. package/src/mixins/device.ts +19 -4
  47. package/src/mixins/index.ts +16 -3
  48. package/src/mixins/intl.ts +21 -5
  49. package/src/mixins/theme.ts +24 -5
  50. package/src/services/intl.ts +18 -1
  51. package/translations/de_DE.json +14 -0
  52. package/translations/en_US.json +16 -0
  53. package/dist/chunk-3WGYJTN4.js.map +0 -1
  54. package/dist/chunk-4TNWG4ME.js.map +0 -1
  55. package/dist/chunk-CC3LFUYY.cjs.map +0 -1
  56. package/dist/chunk-CUDG6NPH.cjs.map +0 -1
  57. package/dist/chunk-FR74YPGJ.cjs.map +0 -1
  58. package/dist/chunk-LQIOVPBE.js.map +0 -1
  59. package/dist/chunk-RM42NG7E.cjs.map +0 -1
  60. package/dist/chunk-SV4TVR2K.js.map +0 -1
@@ -1,4 +1,8 @@
1
- export { withDeviceService } from './device.js';
2
- export { withIntlService } from './intl.js';
3
- export { Theme, withTheme } from './theme.js';
1
+ export { DeviceServiceMixin, DeviceServiceMixinConstructor, withDeviceService } from './device.js';
2
+ export { IntlServiceMixin, IntlServiceMixinConstructor, withIntlService } from './intl.js';
3
+ export { Theme, ThemeMixin, ThemeMixinConstructor, withTheme } from './theme.js';
4
4
  import 'lit';
5
+ import '../services/device.js';
6
+ import 'ua-parser-js';
7
+ import '../services/intl.js';
8
+ import '@formatjs/intl';
@@ -1,14 +1,14 @@
1
1
  import "../chunk-JEE6C34P.js";
2
2
  import {
3
3
  withDeviceService
4
- } from "../chunk-3WGYJTN4.js";
4
+ } from "../chunk-UF5VAIDL.js";
5
5
  import {
6
6
  withIntlService
7
- } from "../chunk-SV4TVR2K.js";
8
- import "../chunk-4TNWG4ME.js";
7
+ } from "../chunk-GD6H7BSG.js";
8
+ import "../chunk-HTK4HH4J.js";
9
9
  import {
10
10
  withTheme
11
- } from "../chunk-LQIOVPBE.js";
11
+ } from "../chunk-O2MNO3WV.js";
12
12
  import "../chunk-X2QNFZU7.js";
13
13
  import "../chunk-EUXUH3YW.js";
14
14
  export {
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkFR74YPGJcjs = require('../chunk-FR74YPGJ.cjs');
4
- require('../chunk-RM42NG7E.cjs');
3
+ var _chunkKPIUNN26cjs = require('../chunk-KPIUNN26.cjs');
4
+ require('../chunk-IDQ6WJY5.cjs');
5
5
  require('../chunk-ZBDE64SD.cjs');
6
6
 
7
7
 
8
- exports.withIntlService = _chunkFR74YPGJcjs.withIntlService;
8
+ exports.withIntlService = _chunkKPIUNN26cjs.withIntlService;
9
9
  //# sourceMappingURL=intl.cjs.map
@@ -1,4 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
+ import { IntlService } from '../services/intl.cjs';
3
+ import '@formatjs/intl';
2
4
 
3
5
  /**
4
6
  * Internationalization Mixin
@@ -6,6 +8,17 @@ import { LitElement } from 'lit';
6
8
  * Mixin to add internationalization service to a Lit component
7
9
  */
8
10
 
11
+ /**
12
+ * Interface for components that have intl service capabilities
13
+ */
14
+ interface IntlServiceMixin {
15
+ formatMessage(key?: string, options?: Record<string, string>): string;
16
+ setupLocalIntl(): IntlService | undefined;
17
+ }
18
+ /**
19
+ * Type helper for the constructor returned by withIntlService
20
+ */
21
+ type IntlServiceMixinConstructor<T extends typeof LitElement> = (new (...args: any[]) => InstanceType<T> & IntlServiceMixin) & T;
9
22
  /**
10
23
  * Mixin to add internationalization service to a Lit component
11
24
  *
@@ -32,6 +45,6 @@ import { LitElement } from 'lit';
32
45
  * }
33
46
  * ```
34
47
  */
35
- declare function withIntlService<T extends typeof LitElement>(Base: T): any;
48
+ declare function withIntlService<T extends typeof LitElement>(Base: T): IntlServiceMixinConstructor<T>;
36
49
 
37
- export { withIntlService };
50
+ export { type IntlServiceMixin, type IntlServiceMixinConstructor, withIntlService };
@@ -1,4 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
+ import { IntlService } from '../services/intl.js';
3
+ import '@formatjs/intl';
2
4
 
3
5
  /**
4
6
  * Internationalization Mixin
@@ -6,6 +8,17 @@ import { LitElement } from 'lit';
6
8
  * Mixin to add internationalization service to a Lit component
7
9
  */
8
10
 
11
+ /**
12
+ * Interface for components that have intl service capabilities
13
+ */
14
+ interface IntlServiceMixin {
15
+ formatMessage(key?: string, options?: Record<string, string>): string;
16
+ setupLocalIntl(): IntlService | undefined;
17
+ }
18
+ /**
19
+ * Type helper for the constructor returned by withIntlService
20
+ */
21
+ type IntlServiceMixinConstructor<T extends typeof LitElement> = (new (...args: any[]) => InstanceType<T> & IntlServiceMixin) & T;
9
22
  /**
10
23
  * Mixin to add internationalization service to a Lit component
11
24
  *
@@ -32,6 +45,6 @@ import { LitElement } from 'lit';
32
45
  * }
33
46
  * ```
34
47
  */
35
- declare function withIntlService<T extends typeof LitElement>(Base: T): any;
48
+ declare function withIntlService<T extends typeof LitElement>(Base: T): IntlServiceMixinConstructor<T>;
36
49
 
37
- export { withIntlService };
50
+ export { type IntlServiceMixin, type IntlServiceMixinConstructor, withIntlService };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  withIntlService
3
- } from "../chunk-SV4TVR2K.js";
4
- import "../chunk-4TNWG4ME.js";
3
+ } from "../chunk-GD6H7BSG.js";
4
+ import "../chunk-HTK4HH4J.js";
5
5
  import "../chunk-EUXUH3YW.js";
6
6
  export {
7
7
  withIntlService
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkCUDG6NPHcjs = require('../chunk-CUDG6NPH.cjs');
3
+ var _chunkGBVTZLYFcjs = require('../chunk-GBVTZLYF.cjs');
4
4
  require('../chunk-ZBDE64SD.cjs');
5
5
 
6
6
 
7
- exports.withTheme = _chunkCUDG6NPHcjs.withTheme;
7
+ exports.withTheme = _chunkGBVTZLYFcjs.withTheme;
8
8
  //# sourceMappingURL=theme.cjs.map
@@ -7,6 +7,18 @@ import { LitElement } from 'lit';
7
7
  */
8
8
 
9
9
  type Theme = 'light' | 'dark' | 'auto';
10
+ /**
11
+ * Interface for components that have theme management capabilities
12
+ */
13
+ interface ThemeMixin {
14
+ theme: Theme;
15
+ isDark: boolean;
16
+ updateTheme(): void;
17
+ }
18
+ /**
19
+ * Type helper for the constructor returned by withTheme
20
+ */
21
+ type ThemeMixinConstructor<T extends typeof LitElement> = (new (...args: any[]) => InstanceType<T> & ThemeMixin) & T;
10
22
  /**
11
23
  * Mixin to add theme management to a Lit component
12
24
  *
@@ -40,6 +52,6 @@ type Theme = 'light' | 'dark' | 'auto';
40
52
  * }
41
53
  * ```
42
54
  */
43
- declare function withTheme<T extends typeof LitElement>(Base: T): any;
55
+ declare function withTheme<T extends typeof LitElement>(Base: T): ThemeMixinConstructor<T>;
44
56
 
45
- export { type Theme, withTheme };
57
+ export { type Theme, type ThemeMixin, type ThemeMixinConstructor, withTheme };
@@ -7,6 +7,18 @@ import { LitElement } from 'lit';
7
7
  */
8
8
 
9
9
  type Theme = 'light' | 'dark' | 'auto';
10
+ /**
11
+ * Interface for components that have theme management capabilities
12
+ */
13
+ interface ThemeMixin {
14
+ theme: Theme;
15
+ isDark: boolean;
16
+ updateTheme(): void;
17
+ }
18
+ /**
19
+ * Type helper for the constructor returned by withTheme
20
+ */
21
+ type ThemeMixinConstructor<T extends typeof LitElement> = (new (...args: any[]) => InstanceType<T> & ThemeMixin) & T;
10
22
  /**
11
23
  * Mixin to add theme management to a Lit component
12
24
  *
@@ -40,6 +52,6 @@ type Theme = 'light' | 'dark' | 'auto';
40
52
  * }
41
53
  * ```
42
54
  */
43
- declare function withTheme<T extends typeof LitElement>(Base: T): any;
55
+ declare function withTheme<T extends typeof LitElement>(Base: T): ThemeMixinConstructor<T>;
44
56
 
45
- export { type Theme, withTheme };
57
+ export { type Theme, type ThemeMixin, type ThemeMixinConstructor, withTheme };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTheme
3
- } from "../chunk-LQIOVPBE.js";
3
+ } from "../chunk-O2MNO3WV.js";
4
4
  import "../chunk-EUXUH3YW.js";
5
5
  export {
6
6
  withTheme
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkRM42NG7Ecjs = require('../chunk-RM42NG7E.cjs');
8
+ var _chunkIDQ6WJY5cjs = require('../chunk-IDQ6WJY5.cjs');
9
9
 
10
10
 
11
11
  var _chunkNJQVWIZLcjs = require('../chunk-NJQVWIZL.cjs');
@@ -17,5 +17,5 @@ require('../chunk-ZBDE64SD.cjs');
17
17
 
18
18
 
19
19
 
20
- exports.clearIntlService = _chunkRM42NG7Ecjs.clearIntlService; exports.createIntlService = _chunkRM42NG7Ecjs.createIntlService; exports.defaultConfig = _chunkRM42NG7Ecjs.defaultConfig; exports.deviceService = _chunkNJQVWIZLcjs.deviceService; exports.getIntlService = _chunkRM42NG7Ecjs.getIntlService; exports.setIntlService = _chunkRM42NG7Ecjs.setIntlService;
20
+ exports.clearIntlService = _chunkIDQ6WJY5cjs.clearIntlService; exports.createIntlService = _chunkIDQ6WJY5cjs.createIntlService; exports.defaultConfig = _chunkIDQ6WJY5cjs.defaultConfig; exports.deviceService = _chunkNJQVWIZLcjs.deviceService; exports.getIntlService = _chunkIDQ6WJY5cjs.getIntlService; exports.setIntlService = _chunkIDQ6WJY5cjs.setIntlService;
21
21
  //# sourceMappingURL=index.cjs.map
@@ -5,7 +5,7 @@ import {
5
5
  defaultConfig,
6
6
  getIntlService,
7
7
  setIntlService
8
- } from "../chunk-4TNWG4ME.js";
8
+ } from "../chunk-HTK4HH4J.js";
9
9
  import {
10
10
  deviceService
11
11
  } from "../chunk-X2QNFZU7.js";
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkRM42NG7Ecjs = require('../chunk-RM42NG7E.cjs');
7
+ var _chunkIDQ6WJY5cjs = require('../chunk-IDQ6WJY5.cjs');
8
8
  require('../chunk-ZBDE64SD.cjs');
9
9
 
10
10
 
@@ -12,5 +12,5 @@ require('../chunk-ZBDE64SD.cjs');
12
12
 
13
13
 
14
14
 
15
- exports.clearIntlService = _chunkRM42NG7Ecjs.clearIntlService; exports.createIntlService = _chunkRM42NG7Ecjs.createIntlService; exports.defaultConfig = _chunkRM42NG7Ecjs.defaultConfig; exports.getIntlService = _chunkRM42NG7Ecjs.getIntlService; exports.setIntlService = _chunkRM42NG7Ecjs.setIntlService;
15
+ exports.clearIntlService = _chunkIDQ6WJY5cjs.clearIntlService; exports.createIntlService = _chunkIDQ6WJY5cjs.createIntlService; exports.defaultConfig = _chunkIDQ6WJY5cjs.defaultConfig; exports.getIntlService = _chunkIDQ6WJY5cjs.getIntlService; exports.setIntlService = _chunkIDQ6WJY5cjs.setIntlService;
16
16
  //# sourceMappingURL=intl.cjs.map
@@ -121,6 +121,15 @@ declare const defaultConfig: IntlConfig;
121
121
  * messages: customMessages,
122
122
  * });
123
123
  *
124
+ * // Enable warnings for missing translations (useful for debugging)
125
+ * const intlWithWarnings = createIntlService({
126
+ * locale: 'en-US',
127
+ * messages: customMessages,
128
+ * onError: (err) => {
129
+ * console.error('Translation error:', err);
130
+ * },
131
+ * });
132
+ *
124
133
  * const translated = intl.formatMessage('app.title');
125
134
  * const formatted = intl.formatNumber(1234.56);
126
135
  * const currentLocale = intl.getLocale(); // 'en-US'
@@ -121,6 +121,15 @@ declare const defaultConfig: IntlConfig;
121
121
  * messages: customMessages,
122
122
  * });
123
123
  *
124
+ * // Enable warnings for missing translations (useful for debugging)
125
+ * const intlWithWarnings = createIntlService({
126
+ * locale: 'en-US',
127
+ * messages: customMessages,
128
+ * onError: (err) => {
129
+ * console.error('Translation error:', err);
130
+ * },
131
+ * });
132
+ *
124
133
  * const translated = intl.formatMessage('app.title');
125
134
  * const formatted = intl.formatNumber(1234.56);
126
135
  * const currentLocale = intl.getLocale(); // 'en-US'
@@ -4,7 +4,7 @@ import {
4
4
  defaultConfig,
5
5
  getIntlService,
6
6
  setIntlService
7
- } from "../chunk-4TNWG4ME.js";
7
+ } from "../chunk-HTK4HH4J.js";
8
8
  import "../chunk-EUXUH3YW.js";
9
9
  export {
10
10
  clearIntlService,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukso/core",
3
- "version": "1.2.0",
3
+ "version": "1.2.2-dev.205b184",
4
4
  "description": "Core utilities, services, and mixins for LUKSO web components and applications",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -61,12 +61,14 @@
61
61
  "types": "./dist/utils/index.d.ts",
62
62
  "import": "./dist/utils/index.js",
63
63
  "require": "./dist/utils/index.cjs"
64
- }
64
+ },
65
+ "./translations/*.json": "./translations/*.json"
65
66
  },
66
67
  "files": [
67
68
  "dist",
68
69
  "src",
69
- "README.md"
70
+ "README.md",
71
+ "translations"
70
72
  ],
71
73
  "keywords": [
72
74
  "lukso",
@@ -86,10 +88,10 @@
86
88
  "url": "https://github.com/lukso-network/up-connector.git"
87
89
  },
88
90
  "dependencies": {
89
- "@formatjs/intl": "^3.1.8",
91
+ "@formatjs/intl": "^4.0.2",
90
92
  "@preact/signals-core": "^1.12.1",
91
93
  "lit": "^3.3.1",
92
- "ua-parser-js": "^2.0.6"
94
+ "ua-parser-js": "^2.0.7"
93
95
  },
94
96
  "peerDependencies": {
95
97
  "viem": "^2.0.0"
@@ -102,8 +104,8 @@
102
104
  "devDependencies": {
103
105
  "tsup": "^8.5.1",
104
106
  "typescript": "^5.9.3",
105
- "viem": "^2.41.2",
106
- "vitest": "^4.0.15"
107
+ "viem": "^2.43.1",
108
+ "vitest": "^4.0.16"
107
109
  },
108
110
  "tsup": {
109
111
  "entry": [
package/src/index.ts CHANGED
@@ -11,4 +11,4 @@ export * from './mixins/index.js'
11
11
  export * from './services/index.js'
12
12
  export * from './utils/index.js'
13
13
  // Release update
14
- // build 1
14
+ // build 2
@@ -8,6 +8,21 @@ import type { LitElement } from 'lit'
8
8
  import type { DeviceService } from '../services/device.js'
9
9
  import { deviceService, type NavigatorExtended } from '../services/device.js'
10
10
 
11
+ /**
12
+ * Interface for components that have device detection capabilities
13
+ */
14
+ export interface DeviceServiceMixin {
15
+ device: DeviceService | undefined
16
+ }
17
+
18
+ /**
19
+ * Type helper for the constructor returned by withDeviceService
20
+ */
21
+ export type DeviceServiceMixinConstructor<T extends typeof LitElement> = (new (
22
+ ...args: any[]
23
+ ) => InstanceType<T> & DeviceServiceMixin) &
24
+ T
25
+
11
26
  /**
12
27
  * Mixin to add device detection service to a Lit component
13
28
  *
@@ -31,8 +46,9 @@ import { deviceService, type NavigatorExtended } from '../services/device.js'
31
46
  * }
32
47
  * ```
33
48
  */
34
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
- export function withDeviceService<T extends typeof LitElement>(Base: T): any {
49
+ export function withDeviceService<T extends typeof LitElement>(
50
+ Base: T
51
+ ): DeviceServiceMixinConstructor<T> {
36
52
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
53
  class Mixin extends (Base as any) {
38
54
  device: DeviceService | undefined
@@ -43,6 +59,5 @@ export function withDeviceService<T extends typeof LitElement>(Base: T): any {
43
59
  }
44
60
  }
45
61
 
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
- return Mixin as any
62
+ return Mixin as unknown as DeviceServiceMixinConstructor<T>
48
63
  }
@@ -4,6 +4,19 @@
4
4
  * Reusable Lit component mixins for device detection, internationalization, and more
5
5
  */
6
6
 
7
- export { withDeviceService } from './device.js'
8
- export { withIntlService } from './intl.js'
9
- export { type Theme, withTheme } from './theme.js'
7
+ export {
8
+ type DeviceServiceMixin,
9
+ type DeviceServiceMixinConstructor,
10
+ withDeviceService,
11
+ } from './device.js'
12
+ export {
13
+ type IntlServiceMixin,
14
+ type IntlServiceMixinConstructor,
15
+ withIntlService,
16
+ } from './intl.js'
17
+ export {
18
+ type Theme,
19
+ type ThemeMixin,
20
+ type ThemeMixinConstructor,
21
+ withTheme,
22
+ } from './theme.js'
@@ -4,9 +4,9 @@
4
4
  * Mixin to add internationalization service to a Lit component
5
5
  */
6
6
 
7
+ import englishTranslations from '@lukso/core/translations/en_US.json'
7
8
  import { effect } from '@preact/signals-core'
8
9
  import type { LitElement } from 'lit'
9
- import englishTranslations from '../../../translations/en_US.json'
10
10
  import {
11
11
  createIntlService,
12
12
  defaultConfig,
@@ -15,6 +15,22 @@ import {
15
15
  setIntlService,
16
16
  } from '../services/intl.js'
17
17
 
18
+ /**
19
+ * Interface for components that have intl service capabilities
20
+ */
21
+ export interface IntlServiceMixin {
22
+ formatMessage(key?: string, options?: Record<string, string>): string
23
+ setupLocalIntl(): IntlService | undefined
24
+ }
25
+
26
+ /**
27
+ * Type helper for the constructor returned by withIntlService
28
+ */
29
+ export type IntlServiceMixinConstructor<T extends typeof LitElement> = (new (
30
+ ...args: any[]
31
+ ) => InstanceType<T> & IntlServiceMixin) &
32
+ T
33
+
18
34
  /**
19
35
  * Mixin to add internationalization service to a Lit component
20
36
  *
@@ -41,8 +57,9 @@ import {
41
57
  * }
42
58
  * ```
43
59
  */
44
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
- export function withIntlService<T extends typeof LitElement>(Base: T): any {
60
+ export function withIntlService<T extends typeof LitElement>(
61
+ Base: T
62
+ ): IntlServiceMixinConstructor<T> {
46
63
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
64
  class Mixin extends (Base as any) {
48
65
  protected unsubscribeIntl: (() => void) | undefined = undefined
@@ -107,6 +124,5 @@ export function withIntlService<T extends typeof LitElement>(Base: T): any {
107
124
  }
108
125
  }
109
126
 
110
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
111
- return Mixin as any
127
+ return Mixin as unknown as IntlServiceMixinConstructor<T>
112
128
  }
@@ -9,6 +9,23 @@ import { property, state } from 'lit/decorators.js'
9
9
 
10
10
  export type Theme = 'light' | 'dark' | 'auto'
11
11
 
12
+ /**
13
+ * Interface for components that have theme management capabilities
14
+ */
15
+ export interface ThemeMixin {
16
+ theme: Theme
17
+ isDark: boolean
18
+ updateTheme(): void
19
+ }
20
+
21
+ /**
22
+ * Type helper for the constructor returned by withTheme
23
+ */
24
+ export type ThemeMixinConstructor<T extends typeof LitElement> = (new (
25
+ ...args: any[]
26
+ ) => InstanceType<T> & ThemeMixin) &
27
+ T
28
+
12
29
  /**
13
30
  * Mixin to add theme management to a Lit component
14
31
  *
@@ -42,8 +59,9 @@ export type Theme = 'light' | 'dark' | 'auto'
42
59
  * }
43
60
  * ```
44
61
  */
45
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
- export function withTheme<T extends typeof LitElement>(Base: T): any {
62
+ export function withTheme<T extends typeof LitElement>(
63
+ Base: T
64
+ ): ThemeMixinConstructor<T> {
47
65
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
66
  class Mixin extends (Base as any) {
49
67
  /**
@@ -156,17 +174,18 @@ export function withTheme<T extends typeof LitElement>(Base: T): any {
156
174
  }
157
175
 
158
176
  /**
159
- * Update the host element's class based on isDark state
177
+ * Update the host element's and theme root's class based on isDark state
160
178
  */
161
179
  private updateHostClass(): void {
162
180
  if (this.isDark) {
181
+ this.classList.add('dark')
163
182
  this.themeRoot.classList.add('dark')
164
183
  } else {
184
+ this.classList.remove('dark')
165
185
  this.themeRoot.classList.remove('dark')
166
186
  }
167
187
  }
168
188
  }
169
189
 
170
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
171
- return Mixin as any
190
+ return Mixin as unknown as ThemeMixinConstructor<T>
172
191
  }
@@ -136,6 +136,9 @@ export const defaultConfig: IntlConfig = {
136
136
  locale: 'en-US',
137
137
  messages: {},
138
138
  formats: {},
139
+ onError: () => {
140
+ // Silent by default since translations are optional
141
+ },
139
142
  }
140
143
 
141
144
  /**
@@ -158,6 +161,15 @@ let intlService: IntlService | null = null
158
161
  * messages: customMessages,
159
162
  * });
160
163
  *
164
+ * // Enable warnings for missing translations (useful for debugging)
165
+ * const intlWithWarnings = createIntlService({
166
+ * locale: 'en-US',
167
+ * messages: customMessages,
168
+ * onError: (err) => {
169
+ * console.error('Translation error:', err);
170
+ * },
171
+ * });
172
+ *
161
173
  * const translated = intl.formatMessage('app.title');
162
174
  * const formatted = intl.formatNumber(1234.56);
163
175
  * const currentLocale = intl.getLocale(); // 'en-US'
@@ -171,7 +183,11 @@ export function createIntlService(
171
183
  config: IntlConfig = defaultConfig
172
184
  ): IntlService {
173
185
  let currentConfig = { ...defaultConfig, ...config }
174
- let intl = createIntl({ ...currentConfig, defaultLocale: 'en-US' })
186
+ let intl = createIntl({
187
+ ...currentConfig,
188
+ defaultLocale: 'en-US',
189
+ onError: currentConfig.onError || defaultConfig.onError,
190
+ })
175
191
  const localeChanged = signal(0)
176
192
  let fallbackMessages: IntlMessages = {}
177
193
 
@@ -265,6 +281,7 @@ export function createIntlService(
265
281
  intl = createIntl({
266
282
  ...currentConfig,
267
283
  defaultLocale: 'en-US',
284
+ onError: currentConfig.onError || defaultConfig.onError,
268
285
  })
269
286
  localeChanged.value += 1
270
287
  },
@@ -0,0 +1,14 @@
1
+ {
2
+ "connect_modal_try_again": "Versuchen Sie es erneut",
3
+ "connect_modal_title": "Wir melden Sie an",
4
+ "connect_modal_qr_code_title": "Scannen Sie den Scanner, um sich anzumelden.",
5
+ "connect_modal_other_connectors": "Connect Wallet",
6
+ "connect_modal_or_info": "Melden Sie sich mit einer anderen Wallet an",
7
+ "connect_modal_or": "Oder",
8
+ "connect_modal_installed": "INSTALLIERT",
9
+ "connect_modal_failed_to_load": "Fehler beim Laden...",
10
+ "connect_modal_eoa_title": "Verbinden Sie Ihre Wallet",
11
+ "connect_modal_description": "Melden Sie sich mit Ihrem Universalprofil an.",
12
+ "connect_modal_connectors_up_mobile": "Mobile Anwendung",
13
+ "connect_modal_connectors_passkey_wallet": "Erstellen Sie eine Passkey-Wallet"
14
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "connect_modal_try_again": "Try again",
3
+ "connect_modal_title": "Let’s log you in",
4
+ "connect_modal_qr_code_title": "Scan to log in",
5
+ "connect_modal_qr_code_description": "Scan the below QR code with the Universal Profile mobile app to log in",
6
+ "connect_modal_other_connectors": "Connect Wallet",
7
+ "connect_modal_or_info": "Log in with a different wallet",
8
+ "connect_modal_or": "Or",
9
+ "connect_modal_installed": "INSTALLED",
10
+ "connect_modal_failed_to_load": "Failed to load...",
11
+ "connect_modal_eoa_title": "Connect your Wallet",
12
+ "connect_modal_description": "Log in with your Universal Profile",
13
+ "connect_modal_connectors_up_mobile": "Mobile Application",
14
+ "connect_modal_connectors_up_browser_extension": "Browser Extension",
15
+ "connect_modal_connectors_passkey_wallet": "Passkey Wallet"
16
+ }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/mixins/device.ts"],"sourcesContent":["/**\n * Device Detection Mixin\n *\n * Mixin to add device detection service to a Lit component\n */\n\nimport type { LitElement } from 'lit'\nimport type { DeviceService } from '../services/device.js'\nimport { deviceService, type NavigatorExtended } from '../services/device.js'\n\n/**\n * Mixin to add device detection service to a Lit component\n *\n * Provides a `device` property with device/OS/browser detection capabilities.\n * The device service is initialized in connectedCallback and follows component lifecycle.\n *\n * @typeParam T - The Lit component class being extended\n * @returns Extended class with device detection capabilities\n *\n * @example\n * ```typescript\n * import { LitElement } from 'lit';\n * import { customElement } from 'lit/decorators.js';\n * import { withDeviceService } from '@lukso/core/mixins';\n *\n * @customElement('my-component')\n * export class MyComponent extends withDeviceService(LitElement) {\n * render() {\n * return html\\`Device is mobile: \\${this.device?.isMobile}\\`;\n * }\n * }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withDeviceService<T extends typeof LitElement>(Base: T): any {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n class Mixin extends (Base as any) {\n device: DeviceService | undefined\n\n connectedCallback(): void {\n super.connectedCallback()\n this.device = deviceService(navigator as NavigatorExtended)\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return Mixin as any\n}\n"],"mappings":";;;;;AAkCO,SAAS,kBAA+C,MAAc;AAAA,EAE3E,MAAM,cAAe,KAAa;AAAA,IAGhC,oBAA0B;AACxB,YAAM,kBAAkB;AACxB,WAAK,SAAS,cAAc,SAA8B;AAAA,IAC5D;AAAA,EACF;AAGA,SAAO;AACT;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/intl.ts"],"sourcesContent":["/**\n * Internationalization Service\n *\n * Provides locale-aware formatting for messages, numbers, dates, and times.\n */\n\nimport {\n createIntl,\n type FormatNumberOptions,\n type IntlConfig,\n} from '@formatjs/intl'\nimport { signal } from '@preact/signals-core'\n\n/**\n * Translation messages object type\n * Maps translation keys to their corresponding string values\n */\nexport type IntlMessages = Record<string, string>\n\n/**\n * Default format number options\n * @see https://github.com/formatjs/formatjs/blob/main/packages/ecma402-abstract/types/number.ts\n */\nconst formatNumberDefaultOptions = {\n maximumFractionDigits: 18,\n}\n\n/**\n * Intl service interface\n */\nexport interface IntlService {\n /**\n * Translate a string based on the key\n *\n * @param key - translation key\n * @param options - optional options for formatMessage (for variable interpolation)\n * @returns - translated string\n */\n formatMessage: (key: string, options?: Record<string, string>) => string\n\n /**\n * Number formatting based on the locale\n *\n * @param value - number to format\n * @param options - options for formatNumber\n * @returns - formatted number\n */\n formatNumber: (\n value: number | string | bigint,\n options?: FormatNumberOptions\n ) => string\n\n /**\n * Date formatting based on the locale\n *\n * @param date - date to format\n * @returns - formatted date\n */\n formatDate: (date?: string | number | Date) => string | undefined\n\n /**\n * Time formatting based on the locale\n *\n * @param date - date to format\n * @returns - formatted time\n */\n formatTime: (date?: string | number | Date) => string | undefined\n\n /**\n * Timestamp formatting based on the locale\n *\n * @param timestamp - UNIX timestamp in seconds or milliseconds\n * @param options - formatting options (predefined format name or custom Intl.DateTimeFormat options)\n * @returns - formatted date & time string\n *\n * @example\n * ```typescript\n * const intl = getIntlService();\n *\n * // Use predefined shortDateTime format\n * intl.formatTimestamp(1733251200, 'shortDateTime'); // \"Wed, Dec 3, 2025, 16:07\"\n *\n * // Use custom format options\n * intl.formatTimestamp(1733251200, { year: '2-digit', month: '2-digit', day: '2-digit' });\n * // \"12/03/25\"\n *\n * // No options (basic format)\n * intl.formatTimestamp(1733251200);\n * ```\n */\n formatTimestamp: (\n timestamp?: number | string,\n options?: Intl.DateTimeFormatOptions | string\n ) => string\n\n /**\n * Change the locale and optionally update messages\n *\n * @param locale - new locale code (e.g., 'en-US', 'de-DE')\n * @param messages - optional new messages object for the locale\n */\n setLocale: (locale: string, messages?: IntlMessages) => void\n\n /**\n * Get the current locale\n *\n * @returns - current locale code (e.g., 'en-US', 'de-DE')\n */\n getLocale: () => string\n\n /**\n * Set fallback translations to use when a translation key is missing\n * Useful when the host app's intl service doesn't have all translations\n *\n * @param fallbackMessages - translations to use as fallback\n *\n * @example\n * ```typescript\n * // After intl service is initialized by host app\n * intl.setFallbackTranslations(defaultMessages);\n * ```\n */\n setFallbackTranslations: (fallbackMessages: IntlMessages) => void\n\n /**\n * Signal that tracks locale changes\n * Use this signal to reactively update UI when locale changes\n */\n localeChanged: { value: number }\n}\n\n/**\n * Default configuration for intl\n */\nexport const defaultConfig: IntlConfig = {\n locale: 'en-US',\n messages: {},\n formats: {},\n}\n\n/**\n * Global intl service instance\n */\nlet intlService: IntlService | null = null\n\n/**\n * Create a new intl service instance\n *\n * @param config - intl configuration with locale and messages\n * @returns IntlService instance with formatting methods\n *\n * @example\n * ```typescript\n * import { createIntlService } from '@lukso/core/services/intl';\n *\n * const intl = createIntlService({\n * locale: 'en-US',\n * messages: customMessages,\n * });\n *\n * const translated = intl.formatMessage('app.title');\n * const formatted = intl.formatNumber(1234.56);\n * const currentLocale = intl.getLocale(); // 'en-US'\n *\n * // Change locale\n * intl.setLocale('de-DE', germanMessages);\n * console.log(intl.getLocale()); // 'de-DE'\n * ```\n */\nexport function createIntlService(\n config: IntlConfig = defaultConfig\n): IntlService {\n let currentConfig = { ...defaultConfig, ...config }\n let intl = createIntl({ ...currentConfig, defaultLocale: 'en-US' })\n const localeChanged = signal(0)\n let fallbackMessages: IntlMessages = {}\n\n return {\n formatMessage: (key: string, options?: Record<string, string>): string => {\n try {\n const result = intl.formatMessage({ id: key }, options)\n\n if (result && result !== key) {\n return result\n }\n\n // If no translation found, check fallback\n if (fallbackMessages[key]) {\n return fallbackMessages[key]\n }\n\n return key\n } catch {\n // On error, try fallback\n return fallbackMessages[key] || key\n }\n },\n\n formatNumber: (\n value: number | string | bigint,\n options: FormatNumberOptions = {}\n ): string => {\n if (value === null || value === undefined) {\n return '0'\n }\n\n const _value =\n typeof value === 'string' ? Number.parseFloat(value) : value\n\n const mergedOptions = {\n ...formatNumberDefaultOptions,\n ...options,\n }\n\n return intl.formatNumber(_value as number, mergedOptions) || ''\n },\n\n formatDate: (date?: string | number | Date): string => {\n return intl.formatDate(date)\n },\n\n formatTime: (date?: string | number | Date): string => {\n return intl.formatTime(date)\n },\n\n formatTimestamp: (\n timestamp?: number | string,\n options?: Intl.DateTimeFormatOptions | string\n ): string => {\n if (!timestamp) return ''\n\n const time = typeof timestamp === 'string' ? Number(timestamp) : timestamp\n const date =\n time < 10_000_000_000\n ? new Date(time * 1000) // seconds\n : new Date(time) // milliseconds\n\n // Handle predefined format\n if (typeof options === 'string') {\n const dateTimeOptions = currentConfig.formats?.date?.[\n options\n ] as Intl.DateTimeFormatOptions\n\n if (dateTimeOptions) {\n return new Intl.DateTimeFormat(\n currentConfig.locale,\n dateTimeOptions\n ).format(date)\n }\n\n // Fallback to default format if predefined format not found\n return intl.formatDate(date) || ''\n }\n\n // For normal @formatjs/intl options\n return intl.formatDate(date, options) || ''\n },\n\n setLocale: (locale: string, messages?: IntlMessages): void => {\n currentConfig = {\n ...currentConfig,\n locale,\n messages: messages || currentConfig.messages,\n }\n intl = createIntl({\n ...currentConfig,\n defaultLocale: 'en-US',\n })\n localeChanged.value += 1\n },\n\n getLocale: (): string => {\n return currentConfig.locale\n },\n\n setFallbackTranslations: (fallbackMessagesInput: IntlMessages): void => {\n fallbackMessages = fallbackMessagesInput\n },\n\n localeChanged,\n }\n}\n\n/**\n * Set the global intl service\n * Call this once from your app initialization\n *\n * @param service - IntlService instance\n *\n * @example\n * ```typescript\n * import { setIntlService, createIntlService } from '@lukso/core/services/intl';\n *\n * const intl = createIntlService(config);\n * setIntlService(intl);\n * ```\n */\nexport function setIntlService(service: IntlService): void {\n intlService = service\n}\n\n/**\n * Get the current global intl service\n * Returns null if no service has been set\n *\n * @example\n * ```typescript\n * import { getIntlService } from '@lukso/core/services/intl';\n *\n * const intl = getIntlService();\n * if (intl) {\n * console.log(intl.getLocale());\n * }\n * ```\n */\nexport function getIntlService(): IntlService | null {\n return intlService\n}\n\n/**\n * Clear the global intl service\n * Useful for testing or cleanup\n */\nexport function clearIntlService(): void {\n intlService = null\n}\n"],"mappings":";AAMA;AAAA,EACE;AAAA,OAGK;AACP,SAAS,cAAc;AAYvB,IAAM,6BAA6B;AAAA,EACjC,uBAAuB;AACzB;AA6GO,IAAM,gBAA4B;AAAA,EACvC,QAAQ;AAAA,EACR,UAAU,CAAC;AAAA,EACX,SAAS,CAAC;AACZ;AAKA,IAAI,cAAkC;AA0B/B,SAAS,kBACd,SAAqB,eACR;AACb,MAAI,gBAAgB,EAAE,GAAG,eAAe,GAAG,OAAO;AAClD,MAAI,OAAO,WAAW,EAAE,GAAG,eAAe,eAAe,QAAQ,CAAC;AAClE,QAAM,gBAAgB,OAAO,CAAC;AAC9B,MAAI,mBAAiC,CAAC;AAEtC,SAAO;AAAA,IACL,eAAe,CAAC,KAAa,YAA6C;AACxE,UAAI;AACF,cAAM,SAAS,KAAK,cAAc,EAAE,IAAI,IAAI,GAAG,OAAO;AAEtD,YAAI,UAAU,WAAW,KAAK;AAC5B,iBAAO;AAAA,QACT;AAGA,YAAI,iBAAiB,GAAG,GAAG;AACzB,iBAAO,iBAAiB,GAAG;AAAA,QAC7B;AAEA,eAAO;AAAA,MACT,QAAQ;AAEN,eAAO,iBAAiB,GAAG,KAAK;AAAA,MAClC;AAAA,IACF;AAAA,IAEA,cAAc,CACZ,OACA,UAA+B,CAAC,MACrB;AACX,UAAI,UAAU,QAAQ,UAAU,QAAW;AACzC,eAAO;AAAA,MACT;AAEA,YAAM,SACJ,OAAO,UAAU,WAAW,OAAO,WAAW,KAAK,IAAI;AAEzD,YAAM,gBAAgB;AAAA,QACpB,GAAG;AAAA,QACH,GAAG;AAAA,MACL;AAEA,aAAO,KAAK,aAAa,QAAkB,aAAa,KAAK;AAAA,IAC/D;AAAA,IAEA,YAAY,CAAC,SAA0C;AACrD,aAAO,KAAK,WAAW,IAAI;AAAA,IAC7B;AAAA,IAEA,YAAY,CAAC,SAA0C;AACrD,aAAO,KAAK,WAAW,IAAI;AAAA,IAC7B;AAAA,IAEA,iBAAiB,CACf,WACA,YACW;AACX,UAAI,CAAC,UAAW,QAAO;AAEvB,YAAM,OAAO,OAAO,cAAc,WAAW,OAAO,SAAS,IAAI;AACjE,YAAM,OACJ,OAAO,OACH,IAAI,KAAK,OAAO,GAAI,IACpB,IAAI,KAAK,IAAI;AAGnB,UAAI,OAAO,YAAY,UAAU;AAC/B,cAAM,kBAAkB,cAAc,SAAS,OAC7C,OACF;AAEA,YAAI,iBAAiB;AACnB,iBAAO,IAAI,KAAK;AAAA,YACd,cAAc;AAAA,YACd;AAAA,UACF,EAAE,OAAO,IAAI;AAAA,QACf;AAGA,eAAO,KAAK,WAAW,IAAI,KAAK;AAAA,MAClC;AAGA,aAAO,KAAK,WAAW,MAAM,OAAO,KAAK;AAAA,IAC3C;AAAA,IAEA,WAAW,CAAC,QAAgB,aAAkC;AAC5D,sBAAgB;AAAA,QACd,GAAG;AAAA,QACH;AAAA,QACA,UAAU,YAAY,cAAc;AAAA,MACtC;AACA,aAAO,WAAW;AAAA,QAChB,GAAG;AAAA,QACH,eAAe;AAAA,MACjB,CAAC;AACD,oBAAc,SAAS;AAAA,IACzB;AAAA,IAEA,WAAW,MAAc;AACvB,aAAO,cAAc;AAAA,IACvB;AAAA,IAEA,yBAAyB,CAAC,0BAA8C;AACtE,yBAAmB;AAAA,IACrB;AAAA,IAEA;AAAA,EACF;AACF;AAgBO,SAAS,eAAe,SAA4B;AACzD,gBAAc;AAChB;AAgBO,SAAS,iBAAqC;AACnD,SAAO;AACT;AAMO,SAAS,mBAAyB;AACvC,gBAAc;AAChB;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/chunk-CC3LFUYY.cjs","../src/mixins/device.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;AC8BO,SAAS,iBAAA,CAA+C,IAAA,EAAc;AAAA,EAE3E,MAAM,MAAA,QAAe,KAAa;AAAA,IAGhC,iBAAA,CAAA,EAA0B;AACxB,MAAA,KAAA,CAAM,iBAAA,CAAkB,CAAA;AACxB,MAAA,IAAA,CAAK,OAAA,EAAS,6CAAA,SAA4C,CAAA;AAAA,IAC5D;AAAA,EACF;AAGA,EAAA,OAAO,KAAA;AACT;ADjCA;AACA;AACE;AACF,8CAAC","file":"/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/chunk-CC3LFUYY.cjs","sourcesContent":[null,"/**\n * Device Detection Mixin\n *\n * Mixin to add device detection service to a Lit component\n */\n\nimport type { LitElement } from 'lit'\nimport type { DeviceService } from '../services/device.js'\nimport { deviceService, type NavigatorExtended } from '../services/device.js'\n\n/**\n * Mixin to add device detection service to a Lit component\n *\n * Provides a `device` property with device/OS/browser detection capabilities.\n * The device service is initialized in connectedCallback and follows component lifecycle.\n *\n * @typeParam T - The Lit component class being extended\n * @returns Extended class with device detection capabilities\n *\n * @example\n * ```typescript\n * import { LitElement } from 'lit';\n * import { customElement } from 'lit/decorators.js';\n * import { withDeviceService } from '@lukso/core/mixins';\n *\n * @customElement('my-component')\n * export class MyComponent extends withDeviceService(LitElement) {\n * render() {\n * return html\\`Device is mobile: \\${this.device?.isMobile}\\`;\n * }\n * }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withDeviceService<T extends typeof LitElement>(Base: T): any {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n class Mixin extends (Base as any) {\n device: DeviceService | undefined\n\n connectedCallback(): void {\n super.connectedCallback()\n this.device = deviceService(navigator as NavigatorExtended)\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return Mixin as any\n}\n"]}