poe-svelte-ui-lib 1.1.18 → 1.1.19

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.
@@ -58,6 +58,7 @@
58
58
  /* Подписка на события клавиатуры */
59
59
  onMount(() => {
60
60
  if (keyBind) window.addEventListener('keydown', handleKeyDown)
61
+
61
62
  return () => {
62
63
  if (keyBind) window.removeEventListener('keydown', handleKeyDown)
63
64
  }
@@ -1,6 +1,6 @@
1
1
  <!-- $lib/ElementsUI/ButtonProps.svelte -->
2
2
  <script lang="ts">
3
- import { t } from '../locales/i18n'
3
+ import { Language, t } from '../locales/i18n'
4
4
  import { type UIComponent, type IButtonProps, type ISelectOption, updateProperty } from '../types'
5
5
  import * as UI from '..'
6
6
  import { optionsStore } from '../options'
@@ -38,6 +38,10 @@
38
38
  (h.value as string).includes(component.properties.componentClass?.split(' ').find((cls: string) => cls.startsWith('py-'))),
39
39
  ),
40
40
  )
41
+
42
+ $effect(() => {
43
+ console.log(Language)
44
+ })
41
45
  </script>
42
46
 
43
47
  {#if forConstructor}
@@ -1,4 +1,5 @@
1
1
  import { type Readable } from 'svelte/store';
2
+ export declare const getInitLanguage: () => string;
2
3
  export declare const Language: import("svelte/store").Writable<string>;
3
4
  export declare function setLanguage(newLang: string): void;
4
5
  export declare const LOCALES: {
@@ -3,14 +3,17 @@ import { writable } from 'svelte/store';
3
3
  import translations from './translations';
4
4
  /* Язык по умолчанию */
5
5
  let initialLanguage = 'ru';
6
- /* Проверяем, доступен ли localStorage */
7
- if (typeof window !== 'undefined') {
8
- initialLanguage = localStorage.getItem('AppLanguage') || navigator.language?.split('-')[0]?.toLowerCase() || 'ru';
9
- const supported = ['ru', 'en', 'zh'];
10
- if (!supported.includes(initialLanguage)) {
11
- initialLanguage = 'ru';
6
+ export const getInitLanguage = () => {
7
+ /* Проверяем, доступен ли localStorage */
8
+ if (typeof window !== 'undefined') {
9
+ initialLanguage = localStorage.getItem('AppLanguage') || navigator.language?.split('-')[0]?.toLowerCase() || 'ru';
10
+ const supported = ['ru', 'en', 'zh'];
11
+ if (!supported.includes(initialLanguage)) {
12
+ initialLanguage = 'ru';
13
+ }
12
14
  }
13
- }
15
+ return initialLanguage;
16
+ };
14
17
  /* Создаем хранилище с начальным значением языка */
15
18
  export const Language = writable(initialLanguage);
16
19
  /* Функция для изменения языка */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -33,12 +33,12 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@sveltejs/adapter-static": "^3.0.10",
36
- "@tailwindcss/vite": "^4.1.15",
36
+ "@tailwindcss/vite": "^4.1.16",
37
37
  "prettier": "^3.6.2",
38
38
  "prettier-plugin-svelte": "^3.4.0",
39
39
  "prettier-plugin-tailwindcss": "^0.7.1",
40
40
  "tailwind-merge": "^3.3.1",
41
- "tailwindcss": "^4.1.15",
41
+ "tailwindcss": "^4.1.16",
42
42
  "tsx": "^4.20.6",
43
43
  "typescript": "^5.9.3"
44
44
  },
@@ -48,9 +48,9 @@
48
48
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
49
49
  "@types/node": "^24.9.1",
50
50
  "publint": "^0.3.15",
51
- "svelte": "^5.41.2",
51
+ "svelte": "^5.41.3",
52
52
  "svelte-preprocess": "^6.0.3",
53
- "vite": "^7.1.11",
53
+ "vite": "^7.1.12",
54
54
  "vite-plugin-compression": "^0.5.1"
55
55
  }
56
56
  }