poe-svelte-ui-lib 1.1.17 → 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
  }
@@ -116,7 +117,7 @@
116
117
  {#if showInfo && content.info?.side === 'top'}
117
118
  <div
118
119
  transition:fly={{ y: -15, duration: 300 }}
119
- class="absolute bottom-full left-1/2 z-50 mb-2 max-w-min min-w-fit rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
120
+ class="absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-xs rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
120
121
  style="transform: translateX(-50%);"
121
122
  >
122
123
  {content.info?.text}
@@ -125,7 +126,7 @@
125
126
  {:else if showInfo && content.info?.side === 'bottom'}
126
127
  <div
127
128
  transition:fly={{ y: 15, duration: 300 }}
128
- class="absolute top-full left-1/2 z-50 mt-2 max-w-min min-w-fit rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
129
+ class="absolute top-full left-1/2 z-50 mt-2 w-max max-w-xs rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
129
130
  style="transform: translateX(-50%);"
130
131
  >
131
132
  {content.info?.text}
@@ -134,7 +135,7 @@
134
135
  {:else if showInfo && content.info?.side === 'left'}
135
136
  <div
136
137
  transition:fly={{ x: 15, duration: 300 }}
137
- class="absolute top-1/2 right-full z-50 mr-2 max-w-min min-w-fit rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
138
+ class="absolute top-1/2 right-full z-50 mr-2 w-max max-w-xs rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
138
139
  style="transform: translateY(-50%);"
139
140
  >
140
141
  {content.info?.text}
@@ -143,7 +144,7 @@
143
144
  {:else if showInfo && content.info?.side === 'right'}
144
145
  <div
145
146
  transition:fly={{ x: -15, duration: 300 }}
146
- class="absolute top-1/2 left-full z-50 ml-2 max-w-min min-w-fit rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
147
+ class="absolute top-1/2 left-full z-50 ml-2 w-max max-w-xs rounded-md bg-(--container-color) px-3 py-1 text-sm shadow-lg"
147
148
  style="transform: translateY(-50%);"
148
149
  >
149
150
  {content.info?.text}
@@ -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}
@@ -156,6 +160,13 @@
156
160
  value={component.properties.content.info.text}
157
161
  onUpdate={(value) => updateProperty('content.info.text', value as string, component, onPropertyChange)}
158
162
  />
163
+ <UI.Select
164
+ label={{ name: $t('constructor.props.info.side') }}
165
+ type="buttons"
166
+ options={$optionsStore.INFO_SIDE_OPTIONS}
167
+ value={$optionsStore.INFO_SIDE_OPTIONS.find((h) => h.value === component.properties.content.info.side)}
168
+ onUpdate={(option) => updateProperty('content.info.side', option.value as string, component, onPropertyChange)}
169
+ />
159
170
  <UI.Input
160
171
  label={{ name: $t('constructor.props.svgicon') }}
161
172
  type="text-area"
@@ -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
  /* Функция для изменения языка */
@@ -80,6 +80,11 @@ const translations = {
80
80
  'constructor.props.rows': 'Количество строк',
81
81
  'constructor.props.placeholder': 'Заполнитель',
82
82
  'constructor.props.info': 'Подсказка',
83
+ 'constructor.props.info.side': 'Положение подсказки',
84
+ 'constructor.props.info.top': 'Вверху',
85
+ 'constructor.props.info.bottom': 'Внизу',
86
+ 'constructor.props.info.left': 'Слева',
87
+ 'constructor.props.info.right': 'Справа',
83
88
  'constructor.props.disabled': 'Отключить',
84
89
  'constructor.props.readonly': 'Только для чтения',
85
90
  'constructor.props.istest': 'Тестовые данные',
package/dist/options.d.ts CHANGED
@@ -85,6 +85,11 @@ export declare const optionsStore: import("svelte/store").Readable<{
85
85
  value: string;
86
86
  name: string;
87
87
  }[];
88
+ INFO_SIDE_OPTIONS: {
89
+ id: string;
90
+ value: string;
91
+ name: string;
92
+ }[];
88
93
  FORM_OPTIONS: {
89
94
  id: string;
90
95
  value: string;
package/dist/options.js CHANGED
@@ -93,6 +93,12 @@ export const optionsStore = derived(t, ($t) => {
93
93
  { id: id(), value: 'cover', name: $t('constructor.props.type.cover') },
94
94
  { id: id(), value: 'contain', name: $t('constructor.props.type.contain') },
95
95
  ],
96
+ INFO_SIDE_OPTIONS: [
97
+ { id: id(), value: 'top', name: $t('constructor.props.info.top') },
98
+ { id: id(), value: 'bottom', name: $t('constructor.props.info.bottom') },
99
+ { id: id(), value: 'left', name: $t('constructor.props.info.left') },
100
+ { id: id(), value: 'right', name: $t('constructor.props.info.right') },
101
+ ],
96
102
  FORM_OPTIONS: [
97
103
  { id: id(), value: 'square', name: $t('constructor.props.type.square') },
98
104
  { id: id(), value: 'circle', name: $t('constructor.props.type.circle') },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.1.17",
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
  }