@lukso/core 0.1.0-dev.0f1bea5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +159 -0
- package/dist/chunk-3WGYJTN4.js +19 -0
- package/dist/chunk-3WGYJTN4.js.map +1 -0
- package/dist/chunk-4TNWG4ME.js +106 -0
- package/dist/chunk-4TNWG4ME.js.map +1 -0
- package/dist/chunk-AMRGSLR5.cjs +1 -0
- package/dist/chunk-AMRGSLR5.cjs.map +1 -0
- package/dist/chunk-CC3LFUYY.cjs +19 -0
- package/dist/chunk-CC3LFUYY.cjs.map +1 -0
- package/dist/chunk-DFMMMF62.cjs +1 -0
- package/dist/chunk-DFMMMF62.cjs.map +1 -0
- package/dist/chunk-DKEXQFNE.js +1 -0
- package/dist/chunk-DKEXQFNE.js.map +1 -0
- package/dist/chunk-DKXHVRHM.js +84 -0
- package/dist/chunk-DKXHVRHM.js.map +1 -0
- package/dist/chunk-FR74YPGJ.cjs +87 -0
- package/dist/chunk-FR74YPGJ.cjs.map +1 -0
- package/dist/chunk-LEL6VWU4.js +1 -0
- package/dist/chunk-LEL6VWU4.js.map +1 -0
- package/dist/chunk-MBIRTPNM.cjs +84 -0
- package/dist/chunk-MBIRTPNM.cjs.map +1 -0
- package/dist/chunk-NJQVWIZL.cjs +49 -0
- package/dist/chunk-NJQVWIZL.cjs.map +1 -0
- package/dist/chunk-RM42NG7E.cjs +106 -0
- package/dist/chunk-RM42NG7E.cjs.map +1 -0
- package/dist/chunk-SV4TVR2K.js +87 -0
- package/dist/chunk-SV4TVR2K.js.map +1 -0
- package/dist/chunk-X2QNFZU7.js +49 -0
- package/dist/chunk-X2QNFZU7.js.map +1 -0
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/mixins/device.cjs +8 -0
- package/dist/mixins/device.cjs.map +1 -0
- package/dist/mixins/device.d.cts +34 -0
- package/dist/mixins/device.d.ts +34 -0
- package/dist/mixins/device.js +8 -0
- package/dist/mixins/device.js.map +1 -0
- package/dist/mixins/index.cjs +14 -0
- package/dist/mixins/index.cjs.map +1 -0
- package/dist/mixins/index.d.cts +3 -0
- package/dist/mixins/index.d.ts +3 -0
- package/dist/mixins/index.js +14 -0
- package/dist/mixins/index.js.map +1 -0
- package/dist/mixins/intl.cjs +8 -0
- package/dist/mixins/intl.cjs.map +1 -0
- package/dist/mixins/intl.d.cts +37 -0
- package/dist/mixins/intl.d.ts +37 -0
- package/dist/mixins/intl.js +8 -0
- package/dist/mixins/intl.js.map +1 -0
- package/dist/services/device.cjs +7 -0
- package/dist/services/device.cjs.map +1 -0
- package/dist/services/device.d.cts +71 -0
- package/dist/services/device.d.ts +71 -0
- package/dist/services/device.js +7 -0
- package/dist/services/device.js.map +1 -0
- package/dist/services/index.cjs +20 -0
- package/dist/services/index.cjs.map +1 -0
- package/dist/services/index.d.cts +4 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +20 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/intl.cjs +15 -0
- package/dist/services/intl.cjs.map +1 -0
- package/dist/services/intl.d.cts +170 -0
- package/dist/services/intl.d.ts +170 -0
- package/dist/services/intl.js +15 -0
- package/dist/services/intl.js.map +1 -0
- package/dist/utils/index.cjs +11 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +32 -0
- package/dist/utils/index.d.ts +32 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +114 -0
- package/src/index.ts +10 -0
- package/src/mixins/__tests__/device.spec.ts +119 -0
- package/src/mixins/__tests__/intl.spec.ts +198 -0
- package/src/mixins/device.ts +48 -0
- package/src/mixins/index.ts +8 -0
- package/src/mixins/intl.ts +112 -0
- package/src/services/__tests__/device.spec.ts +36 -0
- package/src/services/__tests__/intl.spec.ts +536 -0
- package/src/services/device.ts +121 -0
- package/src/services/index.ts +17 -0
- package/src/services/intl.ts +326 -0
- package/src/utils/__tests__/browserInfo.spec.ts +310 -0
- package/src/utils/__tests__/slug.spec.ts +26 -0
- package/src/utils/browserInfo.ts +102 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/slug.ts +13 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { FormatNumberOptions, IntlConfig } from '@formatjs/intl';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Internationalization Service
|
|
5
|
+
*
|
|
6
|
+
* Provides locale-aware formatting for messages, numbers, dates, and times.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Translation messages object type
|
|
11
|
+
* Maps translation keys to their corresponding string values
|
|
12
|
+
*/
|
|
13
|
+
type IntlMessages = Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Intl service interface
|
|
16
|
+
*/
|
|
17
|
+
interface IntlService {
|
|
18
|
+
/**
|
|
19
|
+
* Translate a string based on the key
|
|
20
|
+
*
|
|
21
|
+
* @param key - translation key
|
|
22
|
+
* @param options - optional options for formatMessage (for variable interpolation)
|
|
23
|
+
* @returns - translated string
|
|
24
|
+
*/
|
|
25
|
+
formatMessage: (key: string, options?: Record<string, string>) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Number formatting based on the locale
|
|
28
|
+
*
|
|
29
|
+
* @param value - number to format
|
|
30
|
+
* @param options - options for formatNumber
|
|
31
|
+
* @returns - formatted number
|
|
32
|
+
*/
|
|
33
|
+
formatNumber: (value: number | string | bigint, options?: FormatNumberOptions) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Date formatting based on the locale
|
|
36
|
+
*
|
|
37
|
+
* @param date - date to format
|
|
38
|
+
* @returns - formatted date
|
|
39
|
+
*/
|
|
40
|
+
formatDate: (date?: string | number | Date) => string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Time formatting based on the locale
|
|
43
|
+
*
|
|
44
|
+
* @param date - date to format
|
|
45
|
+
* @returns - formatted time
|
|
46
|
+
*/
|
|
47
|
+
formatTime: (date?: string | number | Date) => string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Timestamp formatting based on the locale
|
|
50
|
+
*
|
|
51
|
+
* @param timestamp - UNIX timestamp in seconds or milliseconds
|
|
52
|
+
* @param options - formatting options (predefined format name or custom Intl.DateTimeFormat options)
|
|
53
|
+
* @returns - formatted date & time string
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const intl = getIntlService();
|
|
58
|
+
*
|
|
59
|
+
* // Use predefined shortDateTime format
|
|
60
|
+
* intl.formatTimestamp(1733251200, 'shortDateTime'); // "Wed, Dec 3, 2025, 16:07"
|
|
61
|
+
*
|
|
62
|
+
* // Use custom format options
|
|
63
|
+
* intl.formatTimestamp(1733251200, { year: '2-digit', month: '2-digit', day: '2-digit' });
|
|
64
|
+
* // "12/03/25"
|
|
65
|
+
*
|
|
66
|
+
* // No options (basic format)
|
|
67
|
+
* intl.formatTimestamp(1733251200);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
formatTimestamp: (timestamp?: number | string, options?: Intl.DateTimeFormatOptions | string) => string;
|
|
71
|
+
/**
|
|
72
|
+
* Change the locale and optionally update messages
|
|
73
|
+
*
|
|
74
|
+
* @param locale - new locale code (e.g., 'en-US', 'de-DE')
|
|
75
|
+
* @param messages - optional new messages object for the locale
|
|
76
|
+
*/
|
|
77
|
+
setLocale: (locale: string, messages?: IntlMessages) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Get the current locale
|
|
80
|
+
*
|
|
81
|
+
* @returns - current locale code (e.g., 'en-US', 'de-DE')
|
|
82
|
+
*/
|
|
83
|
+
getLocale: () => string;
|
|
84
|
+
/**
|
|
85
|
+
* Set fallback translations to use when a translation key is missing
|
|
86
|
+
* Useful when the host app's intl service doesn't have all translations
|
|
87
|
+
*
|
|
88
|
+
* @param fallbackMessages - translations to use as fallback
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* // After intl service is initialized by host app
|
|
93
|
+
* intl.setFallbackTranslations(defaultMessages);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
setFallbackTranslations: (fallbackMessages: IntlMessages) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Signal that tracks locale changes
|
|
99
|
+
* Use this signal to reactively update UI when locale changes
|
|
100
|
+
*/
|
|
101
|
+
localeChanged: {
|
|
102
|
+
value: number;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Default configuration for intl
|
|
107
|
+
*/
|
|
108
|
+
declare const defaultConfig: IntlConfig;
|
|
109
|
+
/**
|
|
110
|
+
* Create a new intl service instance
|
|
111
|
+
*
|
|
112
|
+
* @param config - intl configuration with locale and messages
|
|
113
|
+
* @returns IntlService instance with formatting methods
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* import { createIntlService } from '@lukso/core/services/intl';
|
|
118
|
+
*
|
|
119
|
+
* const intl = createIntlService({
|
|
120
|
+
* locale: 'en-US',
|
|
121
|
+
* messages: customMessages,
|
|
122
|
+
* });
|
|
123
|
+
*
|
|
124
|
+
* const translated = intl.formatMessage('app.title');
|
|
125
|
+
* const formatted = intl.formatNumber(1234.56);
|
|
126
|
+
* const currentLocale = intl.getLocale(); // 'en-US'
|
|
127
|
+
*
|
|
128
|
+
* // Change locale
|
|
129
|
+
* intl.setLocale('de-DE', germanMessages);
|
|
130
|
+
* console.log(intl.getLocale()); // 'de-DE'
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
declare function createIntlService(config?: IntlConfig): IntlService;
|
|
134
|
+
/**
|
|
135
|
+
* Set the global intl service
|
|
136
|
+
* Call this once from your app initialization
|
|
137
|
+
*
|
|
138
|
+
* @param service - IntlService instance
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* import { setIntlService, createIntlService } from '@lukso/core/services/intl';
|
|
143
|
+
*
|
|
144
|
+
* const intl = createIntlService(config);
|
|
145
|
+
* setIntlService(intl);
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
declare function setIntlService(service: IntlService): void;
|
|
149
|
+
/**
|
|
150
|
+
* Get the current global intl service
|
|
151
|
+
* Returns null if no service has been set
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* import { getIntlService } from '@lukso/core/services/intl';
|
|
156
|
+
*
|
|
157
|
+
* const intl = getIntlService();
|
|
158
|
+
* if (intl) {
|
|
159
|
+
* console.log(intl.getLocale());
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
declare function getIntlService(): IntlService | null;
|
|
164
|
+
/**
|
|
165
|
+
* Clear the global intl service
|
|
166
|
+
* Useful for testing or cleanup
|
|
167
|
+
*/
|
|
168
|
+
declare function clearIntlService(): void;
|
|
169
|
+
|
|
170
|
+
export { type IntlMessages, type IntlService, clearIntlService, createIntlService, defaultConfig, getIntlService, setIntlService };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { FormatNumberOptions, IntlConfig } from '@formatjs/intl';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Internationalization Service
|
|
5
|
+
*
|
|
6
|
+
* Provides locale-aware formatting for messages, numbers, dates, and times.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Translation messages object type
|
|
11
|
+
* Maps translation keys to their corresponding string values
|
|
12
|
+
*/
|
|
13
|
+
type IntlMessages = Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Intl service interface
|
|
16
|
+
*/
|
|
17
|
+
interface IntlService {
|
|
18
|
+
/**
|
|
19
|
+
* Translate a string based on the key
|
|
20
|
+
*
|
|
21
|
+
* @param key - translation key
|
|
22
|
+
* @param options - optional options for formatMessage (for variable interpolation)
|
|
23
|
+
* @returns - translated string
|
|
24
|
+
*/
|
|
25
|
+
formatMessage: (key: string, options?: Record<string, string>) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Number formatting based on the locale
|
|
28
|
+
*
|
|
29
|
+
* @param value - number to format
|
|
30
|
+
* @param options - options for formatNumber
|
|
31
|
+
* @returns - formatted number
|
|
32
|
+
*/
|
|
33
|
+
formatNumber: (value: number | string | bigint, options?: FormatNumberOptions) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Date formatting based on the locale
|
|
36
|
+
*
|
|
37
|
+
* @param date - date to format
|
|
38
|
+
* @returns - formatted date
|
|
39
|
+
*/
|
|
40
|
+
formatDate: (date?: string | number | Date) => string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Time formatting based on the locale
|
|
43
|
+
*
|
|
44
|
+
* @param date - date to format
|
|
45
|
+
* @returns - formatted time
|
|
46
|
+
*/
|
|
47
|
+
formatTime: (date?: string | number | Date) => string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Timestamp formatting based on the locale
|
|
50
|
+
*
|
|
51
|
+
* @param timestamp - UNIX timestamp in seconds or milliseconds
|
|
52
|
+
* @param options - formatting options (predefined format name or custom Intl.DateTimeFormat options)
|
|
53
|
+
* @returns - formatted date & time string
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const intl = getIntlService();
|
|
58
|
+
*
|
|
59
|
+
* // Use predefined shortDateTime format
|
|
60
|
+
* intl.formatTimestamp(1733251200, 'shortDateTime'); // "Wed, Dec 3, 2025, 16:07"
|
|
61
|
+
*
|
|
62
|
+
* // Use custom format options
|
|
63
|
+
* intl.formatTimestamp(1733251200, { year: '2-digit', month: '2-digit', day: '2-digit' });
|
|
64
|
+
* // "12/03/25"
|
|
65
|
+
*
|
|
66
|
+
* // No options (basic format)
|
|
67
|
+
* intl.formatTimestamp(1733251200);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
formatTimestamp: (timestamp?: number | string, options?: Intl.DateTimeFormatOptions | string) => string;
|
|
71
|
+
/**
|
|
72
|
+
* Change the locale and optionally update messages
|
|
73
|
+
*
|
|
74
|
+
* @param locale - new locale code (e.g., 'en-US', 'de-DE')
|
|
75
|
+
* @param messages - optional new messages object for the locale
|
|
76
|
+
*/
|
|
77
|
+
setLocale: (locale: string, messages?: IntlMessages) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Get the current locale
|
|
80
|
+
*
|
|
81
|
+
* @returns - current locale code (e.g., 'en-US', 'de-DE')
|
|
82
|
+
*/
|
|
83
|
+
getLocale: () => string;
|
|
84
|
+
/**
|
|
85
|
+
* Set fallback translations to use when a translation key is missing
|
|
86
|
+
* Useful when the host app's intl service doesn't have all translations
|
|
87
|
+
*
|
|
88
|
+
* @param fallbackMessages - translations to use as fallback
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* // After intl service is initialized by host app
|
|
93
|
+
* intl.setFallbackTranslations(defaultMessages);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
setFallbackTranslations: (fallbackMessages: IntlMessages) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Signal that tracks locale changes
|
|
99
|
+
* Use this signal to reactively update UI when locale changes
|
|
100
|
+
*/
|
|
101
|
+
localeChanged: {
|
|
102
|
+
value: number;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Default configuration for intl
|
|
107
|
+
*/
|
|
108
|
+
declare const defaultConfig: IntlConfig;
|
|
109
|
+
/**
|
|
110
|
+
* Create a new intl service instance
|
|
111
|
+
*
|
|
112
|
+
* @param config - intl configuration with locale and messages
|
|
113
|
+
* @returns IntlService instance with formatting methods
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* import { createIntlService } from '@lukso/core/services/intl';
|
|
118
|
+
*
|
|
119
|
+
* const intl = createIntlService({
|
|
120
|
+
* locale: 'en-US',
|
|
121
|
+
* messages: customMessages,
|
|
122
|
+
* });
|
|
123
|
+
*
|
|
124
|
+
* const translated = intl.formatMessage('app.title');
|
|
125
|
+
* const formatted = intl.formatNumber(1234.56);
|
|
126
|
+
* const currentLocale = intl.getLocale(); // 'en-US'
|
|
127
|
+
*
|
|
128
|
+
* // Change locale
|
|
129
|
+
* intl.setLocale('de-DE', germanMessages);
|
|
130
|
+
* console.log(intl.getLocale()); // 'de-DE'
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
declare function createIntlService(config?: IntlConfig): IntlService;
|
|
134
|
+
/**
|
|
135
|
+
* Set the global intl service
|
|
136
|
+
* Call this once from your app initialization
|
|
137
|
+
*
|
|
138
|
+
* @param service - IntlService instance
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* import { setIntlService, createIntlService } from '@lukso/core/services/intl';
|
|
143
|
+
*
|
|
144
|
+
* const intl = createIntlService(config);
|
|
145
|
+
* setIntlService(intl);
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
declare function setIntlService(service: IntlService): void;
|
|
149
|
+
/**
|
|
150
|
+
* Get the current global intl service
|
|
151
|
+
* Returns null if no service has been set
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* import { getIntlService } from '@lukso/core/services/intl';
|
|
156
|
+
*
|
|
157
|
+
* const intl = getIntlService();
|
|
158
|
+
* if (intl) {
|
|
159
|
+
* console.log(intl.getLocale());
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
declare function getIntlService(): IntlService | null;
|
|
164
|
+
/**
|
|
165
|
+
* Clear the global intl service
|
|
166
|
+
* Useful for testing or cleanup
|
|
167
|
+
*/
|
|
168
|
+
declare function clearIntlService(): void;
|
|
169
|
+
|
|
170
|
+
export { type IntlMessages, type IntlService, clearIntlService, createIntlService, defaultConfig, getIntlService, setIntlService };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearIntlService,
|
|
3
|
+
createIntlService,
|
|
4
|
+
defaultConfig,
|
|
5
|
+
getIntlService,
|
|
6
|
+
setIntlService
|
|
7
|
+
} from "../chunk-4TNWG4ME.js";
|
|
8
|
+
export {
|
|
9
|
+
clearIntlService,
|
|
10
|
+
createIntlService,
|
|
11
|
+
defaultConfig,
|
|
12
|
+
getIntlService,
|
|
13
|
+
setIntlService
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=intl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkMBIRTPNMcjs = require('../chunk-MBIRTPNM.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.EXTENSION_STORE_LINKS = _chunkMBIRTPNMcjs.EXTENSION_STORE_LINKS; exports.browserInfo = _chunkMBIRTPNMcjs.browserInfo; exports.slug = _chunkMBIRTPNMcjs.slug;
|
|
11
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/utils/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACF,oKAAC","file":"/home/runner/work/service-auth-simple/service-auth-simple/packages/core/dist/utils/index.cjs"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DeviceService } from '../services/device.cjs';
|
|
2
|
+
import 'ua-parser-js';
|
|
3
|
+
|
|
4
|
+
type BrowserName = 'chrome' | 'safari' | 'firefox' | 'edge' | 'opera' | 'brave';
|
|
5
|
+
type BrowserInfo = {
|
|
6
|
+
id: BrowserName;
|
|
7
|
+
name: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
storeLink: string;
|
|
10
|
+
};
|
|
11
|
+
declare const EXTENSION_STORE_LINKS: {
|
|
12
|
+
chrome: string;
|
|
13
|
+
brave: string;
|
|
14
|
+
edge: string;
|
|
15
|
+
opera: string;
|
|
16
|
+
safari: string;
|
|
17
|
+
firefox: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Expose browser info to the app
|
|
21
|
+
*/
|
|
22
|
+
declare const browserInfo: (deviceService: DeviceService) => BrowserInfo;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Make slug from text
|
|
26
|
+
*
|
|
27
|
+
* @param value
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
declare const slug: (value?: string) => string;
|
|
31
|
+
|
|
32
|
+
export { type BrowserInfo, type BrowserName, EXTENSION_STORE_LINKS, browserInfo, slug };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DeviceService } from '../services/device.js';
|
|
2
|
+
import 'ua-parser-js';
|
|
3
|
+
|
|
4
|
+
type BrowserName = 'chrome' | 'safari' | 'firefox' | 'edge' | 'opera' | 'brave';
|
|
5
|
+
type BrowserInfo = {
|
|
6
|
+
id: BrowserName;
|
|
7
|
+
name: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
storeLink: string;
|
|
10
|
+
};
|
|
11
|
+
declare const EXTENSION_STORE_LINKS: {
|
|
12
|
+
chrome: string;
|
|
13
|
+
brave: string;
|
|
14
|
+
edge: string;
|
|
15
|
+
opera: string;
|
|
16
|
+
safari: string;
|
|
17
|
+
firefox: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Expose browser info to the app
|
|
21
|
+
*/
|
|
22
|
+
declare const browserInfo: (deviceService: DeviceService) => BrowserInfo;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Make slug from text
|
|
26
|
+
*
|
|
27
|
+
* @param value
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
declare const slug: (value?: string) => string;
|
|
31
|
+
|
|
32
|
+
export { type BrowserInfo, type BrowserName, EXTENSION_STORE_LINKS, browserInfo, slug };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lukso/core",
|
|
3
|
+
"version": "0.1.0-dev.0f1bea5",
|
|
4
|
+
"description": "Core utilities, services, and mixins for LUKSO web components and applications",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./services": {
|
|
16
|
+
"types": "./dist/services/index.d.ts",
|
|
17
|
+
"import": "./dist/services/index.js",
|
|
18
|
+
"require": "./dist/services/index.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./services/device": {
|
|
21
|
+
"types": "./dist/services/device.d.ts",
|
|
22
|
+
"import": "./dist/services/device.js",
|
|
23
|
+
"require": "./dist/services/device.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./services/intl": {
|
|
26
|
+
"types": "./dist/services/intl.d.ts",
|
|
27
|
+
"import": "./dist/services/intl.js",
|
|
28
|
+
"require": "./dist/services/intl.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./mixins": {
|
|
31
|
+
"types": "./dist/mixins/index.d.ts",
|
|
32
|
+
"import": "./dist/mixins/index.js",
|
|
33
|
+
"require": "./dist/mixins/index.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./mixins/device": {
|
|
36
|
+
"types": "./dist/mixins/device.d.ts",
|
|
37
|
+
"import": "./dist/mixins/device.js",
|
|
38
|
+
"require": "./dist/mixins/device.cjs"
|
|
39
|
+
},
|
|
40
|
+
"./mixins/intl": {
|
|
41
|
+
"types": "./dist/mixins/intl.d.ts",
|
|
42
|
+
"import": "./dist/mixins/intl.js",
|
|
43
|
+
"require": "./dist/mixins/intl.cjs"
|
|
44
|
+
},
|
|
45
|
+
"./utils": {
|
|
46
|
+
"types": "./dist/utils/index.d.ts",
|
|
47
|
+
"import": "./dist/utils/index.js",
|
|
48
|
+
"require": "./dist/utils/index.cjs"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"dist",
|
|
53
|
+
"src",
|
|
54
|
+
"README.md"
|
|
55
|
+
],
|
|
56
|
+
"keywords": [
|
|
57
|
+
"lukso",
|
|
58
|
+
"lit",
|
|
59
|
+
"web-components",
|
|
60
|
+
"mixins",
|
|
61
|
+
"services",
|
|
62
|
+
"device-detection",
|
|
63
|
+
"internationalization",
|
|
64
|
+
"i18n",
|
|
65
|
+
"utilities"
|
|
66
|
+
],
|
|
67
|
+
"author": "LUKSO",
|
|
68
|
+
"license": "MIT",
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "https://github.com/lukso-network/up-connector.git"
|
|
72
|
+
},
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"@formatjs/intl": "^3.1.8",
|
|
75
|
+
"@preact/signals-core": "^1.12.1",
|
|
76
|
+
"lit": "^3.3.1",
|
|
77
|
+
"ua-parser-js": "^2.0.6"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"tsup": "^8.5.1",
|
|
81
|
+
"typescript": "^5.9.3",
|
|
82
|
+
"vitest": "^4.0.15"
|
|
83
|
+
},
|
|
84
|
+
"tsup": {
|
|
85
|
+
"entry": [
|
|
86
|
+
"src/index.ts",
|
|
87
|
+
"src/services/index.ts",
|
|
88
|
+
"src/services/device.ts",
|
|
89
|
+
"src/services/intl.ts",
|
|
90
|
+
"src/mixins/index.ts",
|
|
91
|
+
"src/mixins/device.ts",
|
|
92
|
+
"src/mixins/intl.ts",
|
|
93
|
+
"src/utils/index.ts"
|
|
94
|
+
],
|
|
95
|
+
"format": [
|
|
96
|
+
"cjs",
|
|
97
|
+
"esm"
|
|
98
|
+
],
|
|
99
|
+
"dts": true,
|
|
100
|
+
"splitting": true,
|
|
101
|
+
"sourcemap": true,
|
|
102
|
+
"clean": false,
|
|
103
|
+
"minify": false
|
|
104
|
+
},
|
|
105
|
+
"scripts": {
|
|
106
|
+
"build": "tsup",
|
|
107
|
+
"dev": "tsup --watch",
|
|
108
|
+
"dev-alt": "tsup --watch",
|
|
109
|
+
"clean": "rm -rf dist",
|
|
110
|
+
"test": "vitest",
|
|
111
|
+
"test:run": "vitest run",
|
|
112
|
+
"check": "tsc --noEmit"
|
|
113
|
+
}
|
|
114
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lukso/core
|
|
3
|
+
*
|
|
4
|
+
* Core utilities, services, and mixins for LUKSO web components and applications
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Re-export all services and mixins
|
|
8
|
+
export * from './mixins/index.js'
|
|
9
|
+
export * from './services/index.js'
|
|
10
|
+
export * from './utils/index.js'
|