@r2digisolutions/ui 0.6.0 → 0.7.0
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/README.md +10 -0
- package/dist/stores/I18n.svelte.js +3 -2
- package/package.json +27 -27
package/README.md
CHANGED
|
@@ -56,3 +56,13 @@ To publish your library to [npm](https://www.npmjs.com):
|
|
|
56
56
|
```bash
|
|
57
57
|
npm publish
|
|
58
58
|
```
|
|
59
|
+
|
|
60
|
+
## Publishing
|
|
61
|
+
|
|
62
|
+
Go into the `package.json` and give your package the desired name through the `"name"` option.
|
|
63
|
+
|
|
64
|
+
To publish your library to [npm](https://www.npmjs.com):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm publish
|
|
68
|
+
```
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export class StoreI18n {
|
|
2
2
|
#language = $state("en");
|
|
3
|
+
#defaultLanguage = "en";
|
|
3
4
|
#translations = $state({});
|
|
4
5
|
constructor(currentLanguage, translations = {}) {
|
|
5
6
|
this.#language = currentLanguage;
|
|
@@ -9,7 +10,7 @@ export class StoreI18n {
|
|
|
9
10
|
this.#language;
|
|
10
11
|
this.#translations;
|
|
11
12
|
return (key, params = {}) => {
|
|
12
|
-
const translations = this.#translations[this.#language];
|
|
13
|
+
const translations = this.#translations?.[this.#language || this.#defaultLanguage];
|
|
13
14
|
const translation = this.#getTranslationValue(translations, key);
|
|
14
15
|
if (!translation || typeof translation !== "string") {
|
|
15
16
|
return `--${key}--`;
|
|
@@ -25,7 +26,7 @@ export class StoreI18n {
|
|
|
25
26
|
}
|
|
26
27
|
#getTranslationValue(translations, key) {
|
|
27
28
|
// Intentar primero como clave plana
|
|
28
|
-
if (translations[key])
|
|
29
|
+
if (translations?.[key])
|
|
29
30
|
return translations[key];
|
|
30
31
|
// Si no existe como clave plana, intentar lookup recursivo
|
|
31
32
|
return key.split('.').reduce((acc, part) => acc?.[part], translations);
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r2digisolutions/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"private": false,
|
|
5
|
-
"packageManager": "bun@1.2.
|
|
5
|
+
"packageManager": "bun@1.2.18",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -47,42 +47,42 @@
|
|
|
47
47
|
"svelte": "^5.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@changesets/cli": "^2.29.
|
|
51
|
-
"@chromatic-com/storybook": "^
|
|
52
|
-
"@eslint/compat": "^1.
|
|
53
|
-
"@playwright/test": "^1.
|
|
50
|
+
"@changesets/cli": "^2.29.5",
|
|
51
|
+
"@chromatic-com/storybook": "^4.0.1",
|
|
52
|
+
"@eslint/compat": "^1.3.1",
|
|
53
|
+
"@playwright/test": "^1.54.1",
|
|
54
54
|
"@storybook/addon-essentials": "^8.6.14",
|
|
55
55
|
"@storybook/addon-interactions": "^8.6.14",
|
|
56
|
-
"@storybook/addon-svelte-csf": "5.0.
|
|
56
|
+
"@storybook/addon-svelte-csf": "5.0.6",
|
|
57
57
|
"@storybook/blocks": "^8.6.14",
|
|
58
|
-
"@storybook/svelte": "^
|
|
59
|
-
"@storybook/sveltekit": "^
|
|
58
|
+
"@storybook/svelte": "^9.0.16",
|
|
59
|
+
"@storybook/sveltekit": "^9.0.16",
|
|
60
60
|
"@storybook/test": "^8.6.14",
|
|
61
61
|
"@sveltejs/adapter-static": "^3.0.8",
|
|
62
|
-
"@sveltejs/kit": "^2.
|
|
63
|
-
"@sveltejs/package": "^2.3.
|
|
64
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
65
|
-
"@tailwindcss/postcss": "^4.1.
|
|
66
|
-
"@vitest/browser": "^3.
|
|
62
|
+
"@sveltejs/kit": "^2.22.5",
|
|
63
|
+
"@sveltejs/package": "^2.3.12",
|
|
64
|
+
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
|
65
|
+
"@tailwindcss/postcss": "^4.1.11",
|
|
66
|
+
"@vitest/browser": "^3.2.4",
|
|
67
67
|
"changeset": "^0.2.6",
|
|
68
|
-
"eslint": "^9.
|
|
68
|
+
"eslint": "^9.31.0",
|
|
69
69
|
"eslint-config-prettier": "^10.1.5",
|
|
70
|
-
"eslint-plugin-svelte": "^3.
|
|
71
|
-
"globals": "^16.
|
|
70
|
+
"eslint-plugin-svelte": "^3.10.1",
|
|
71
|
+
"globals": "^16.3.0",
|
|
72
72
|
"jsdom": "^26.1.0",
|
|
73
|
-
"lucide-svelte": "^0.
|
|
74
|
-
"prettier": "^3.
|
|
73
|
+
"lucide-svelte": "^0.525.0",
|
|
74
|
+
"prettier": "^3.6.2",
|
|
75
75
|
"prettier-plugin-svelte": "^3.4.0",
|
|
76
|
-
"prettier-plugin-tailwindcss": "^0.6.
|
|
76
|
+
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
77
77
|
"publint": "^0.3.12",
|
|
78
|
-
"storybook": "^
|
|
79
|
-
"svelte": "^5.
|
|
80
|
-
"svelte-check": "^4.2.
|
|
81
|
-
"tailwindcss": "^4.1.
|
|
78
|
+
"storybook": "^9.0.16",
|
|
79
|
+
"svelte": "^5.35.6",
|
|
80
|
+
"svelte-check": "^4.2.2",
|
|
81
|
+
"tailwindcss": "^4.1.11",
|
|
82
82
|
"typescript": "^5.8.3",
|
|
83
|
-
"typescript-eslint": "^8.
|
|
84
|
-
"vite": "^
|
|
85
|
-
"vitest": "^3.
|
|
83
|
+
"typescript-eslint": "^8.36.0",
|
|
84
|
+
"vite": "^7.0.4",
|
|
85
|
+
"vitest": "^3.2.4"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@tailwindcss/container-queries": "^0.1.1",
|