poe-svelte-ui-lib 1.2.32 → 1.3.1

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.
@@ -85,10 +85,10 @@
85
85
  if (content.info?.text) showInfo = false
86
86
  }}
87
87
  >
88
- <span class=" flex flex-row items-center justify-center gap-2">
88
+ <div class=" flex flex-row items-center justify-center gap-2">
89
89
  {#if content?.icon}
90
90
  <span
91
- class={`flex items-center justify-center overflow-visible
91
+ class={` ${content.name ? 'absolute left-3' : ''} flex items-center justify-center overflow-visible
92
92
  ${content.name ? 'h-8 w-8' : `${svgSize()}`} [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full`}
93
93
  >
94
94
  {#if typeof content?.icon === 'string'}
@@ -110,7 +110,7 @@
110
110
  {/if}
111
111
  </div>
112
112
  {/if}
113
- </span>
113
+ </div>
114
114
  </button>
115
115
 
116
116
  {#if showInfo && content.info?.side === 'top'}
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { t } from '../locales/i18n'
2
3
  import type { IFileAttachProps } from '../types'
3
4
  import { twMerge } from 'tailwind-merge'
4
5
 
@@ -17,6 +18,7 @@
17
18
  let ID = `${id}-${crypto.randomUUID().slice(0, 6)}`
18
19
  let selectedFile = $state<File | null>(null)
19
20
  let previewUrl = $derived(currentImage ? (currentImage.startsWith('data:') ? currentImage : `data:image/png;base64,${currentImage}`) : null)
21
+ let fileName = $state('')
20
22
 
21
23
  const handleFileChange = (event: Event) => {
22
24
  const input = event.target as HTMLInputElement
@@ -27,6 +29,7 @@
27
29
 
28
30
  const file = input.files[0]
29
31
  selectedFile = file
32
+ fileName = file.name
30
33
 
31
34
  if (file.type.startsWith('image/')) previewUrl = URL.createObjectURL(file)
32
35
 
@@ -74,13 +77,22 @@
74
77
  <input
75
78
  id={ID}
76
79
  type="file"
77
- class={`h-8.5 w-full rounded-2xl bg-(--back-color) font-semibold shadow-sm transition duration-250 hover:shadow-md
78
- ${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'} invalid:shadow-[0_0_6px(--red-color) file:h-full file:w-1/3
79
- file:cursor-pointer file:border-none file:bg-(--blue-color) invalid:border-red-400`}
80
+ class="absolute left-0 z-1 h-8.5 w-full opacity-0 {disabled ? 'cursor-not-allowed' : 'cursor-pointer'}"
80
81
  {accept}
81
82
  {disabled}
82
83
  onchange={handleFileChange}
83
84
  />
85
+ <div
86
+ class="flex h-8.5 w-full overflow-hidden rounded-2xl font-semibold shadow-sm transition duration-250 hover:shadow-md
87
+ "
88
+ >
89
+ <div class="flex w-1/3 items-center justify-center bg-(--blue-color) {disabled ? 'opacity-50' : ''}">
90
+ {$t('constructor.props.file.select')}
91
+ </div>
92
+ <div class="flex w-2/3 items-center justify-start bg-(--back-color) px-2 {disabled ? 'opacity-50' : ''}">
93
+ {fileName || $t('constructor.props.file.notselected')}
94
+ </div>
95
+ </div>
84
96
  </label>
85
97
  {/if}
86
98
  </div>
@@ -92,7 +92,7 @@
92
92
  class={twMerge(
93
93
  `h-full w-full resize-y rounded-2xl border border-(--border-color) px-2 py-1 text-center font-mono outline-none focus:border-blue-400
94
94
  ${isValid ? 'border-(--border-color)' : 'border-red-400 shadow-[0_0_6px_var(--red-color)]'}
95
- ${disabled ? 'opacity-50' : 'hover:shadow-md'}
95
+ ${disabled ? 'cursor-not-allowed opacity-50' : 'hover:shadow-md'}
96
96
  ${readonly ? '' : 'hover:shadow-md'}
97
97
  ${help?.info ? 'pl-8' : ''}
98
98
  ${help.copyButton ? 'pr-8' : ''}`,
@@ -137,9 +137,9 @@
137
137
  </button>
138
138
  {/if}
139
139
 
140
- {#if help.copyButton && (type === 'text' || type === 'text-area')}
140
+ {#if help.copyButton && (type === 'text' || type === 'text-area') && !disabled}
141
141
  <button
142
- class="absolute right-3 flex cursor-pointer border-none bg-transparent {type === 'text-area' ? 'top-2' : ''}"
142
+ class="absolute right-3 flex border-none bg-transparent {type === 'text-area' ? 'top-2' : ''} cursor-pointer"
143
143
  onclick={(e) => {
144
144
  e.preventDefault()
145
145
  navigator.clipboard.writeText(value as string)
@@ -8,9 +8,9 @@
8
8
  label = { name: '', class: '' },
9
9
  value = $bindable([0, 0, 0, 0]),
10
10
  axes = [
11
- { name: 'Roll', minNum: -100, maxNum: 100 },
12
- { name: 'Pitch', minNum: -100, maxNum: 100 },
13
- { name: 'Yaw', minNum: -100, maxNum: 100 },
11
+ { name: 'Roll', minNum: -360, maxNum: 360 },
12
+ { name: 'Pitch', minNum: -360, maxNum: 360 },
13
+ { name: 'Yaw', minNum: -360, maxNum: 360 },
14
14
  ],
15
15
  buttonIcon,
16
16
  onUpdate = () => {},
@@ -22,13 +22,7 @@
22
22
  angle: 30.5,
23
23
  content: true,
24
24
  onClick: () => {
25
- if (value[2] + sensitivity >= axes[2].maxNum) {
26
- value[2] = axes[2].maxNum
27
- onUpdate(value)
28
- return
29
- }
30
-
31
- value[2] = roundToClean(value[2] + sensitivity)
25
+ updateValue(2, +sensitivity)
32
26
  onUpdate(value)
33
27
  },
34
28
  },
@@ -37,20 +31,9 @@
37
31
  angle: 58,
38
32
  content: false,
39
33
  onClick: () => {
40
- if (value[2] + sensitivity >= axes[2].maxNum) {
41
- value[2] = axes[2].maxNum
42
- onUpdate(value)
43
- } else {
44
- value[2] = roundToClean(value[2] + sensitivity)
45
- onUpdate(value)
46
- }
47
- if (value[1] - sensitivity <= axes[1].minNum) {
48
- value[1] = axes[1].minNum
49
- onUpdate(value)
50
- } else {
51
- value[1] = roundToClean(value[1] - sensitivity)
52
- onUpdate(value)
53
- }
34
+ updateValue(2, +sensitivity)
35
+ updateValue(1, -sensitivity)
36
+ onUpdate(value)
54
37
  },
55
38
  },
56
39
  {
@@ -58,12 +41,7 @@
58
41
  angle: 122,
59
42
  content: true,
60
43
  onClick: () => {
61
- if (value[1] - sensitivity <= axes[1].minNum) {
62
- value[1] = axes[1].minNum
63
- onUpdate(value)
64
- return
65
- }
66
- value[1] = roundToClean(value[1] - sensitivity)
44
+ updateValue(1, -sensitivity)
67
45
  onUpdate(value)
68
46
  },
69
47
  },
@@ -72,20 +50,9 @@
72
50
  angle: 149.5,
73
51
  content: false,
74
52
  onClick: () => {
75
- if (value[2] - sensitivity <= axes[2].minNum) {
76
- value[2] = axes[2].minNum
77
- onUpdate(value)
78
- } else {
79
- value[2] = roundToClean(value[2] - sensitivity)
80
- onUpdate(value)
81
- }
82
- if (value[1] - sensitivity <= axes[1].minNum) {
83
- value[1] = axes[1].minNum
84
- onUpdate(value)
85
- } else {
86
- value[1] = roundToClean(value[1] - sensitivity)
87
- onUpdate(value)
88
- }
53
+ updateValue(2, -sensitivity)
54
+ updateValue(1, -sensitivity)
55
+ onUpdate(value)
89
56
  },
90
57
  },
91
58
  {
@@ -93,12 +60,7 @@
93
60
  angle: 212,
94
61
  content: true,
95
62
  onClick: () => {
96
- if (value[2] - sensitivity <= axes[2].minNum) {
97
- value[2] = axes[2].minNum
98
- onUpdate(value)
99
- return
100
- }
101
- value[2] = roundToClean(value[2] - sensitivity)
63
+ updateValue(2, -sensitivity)
102
64
  onUpdate(value)
103
65
  },
104
66
  },
@@ -107,20 +69,9 @@
107
69
  angle: 239,
108
70
  content: false,
109
71
  onClick: () => {
110
- if (value[1] + sensitivity >= axes[1].maxNum) {
111
- value[1] = axes[1].maxNum
112
- onUpdate(value)
113
- } else {
114
- value[1] = roundToClean(value[1] + sensitivity)
115
- onUpdate(value)
116
- }
117
- if (value[2] - sensitivity <= axes[2].minNum) {
118
- value[2] = axes[2].minNum
119
- onUpdate(value)
120
- } else {
121
- value[2] = roundToClean(value[2] - sensitivity)
122
- onUpdate(value)
123
- }
72
+ updateValue(1, +sensitivity)
73
+ updateValue(2, -sensitivity)
74
+ onUpdate(value)
124
75
  },
125
76
  },
126
77
  {
@@ -128,12 +79,7 @@
128
79
  angle: 301,
129
80
  content: true,
130
81
  onClick: () => {
131
- if (value[1] + sensitivity >= axes[1].maxNum) {
132
- value[1] = axes[1].maxNum
133
- onUpdate(value)
134
- return
135
- }
136
- value[1] = roundToClean(value[1] + sensitivity)
82
+ updateValue(1, +sensitivity)
137
83
  onUpdate(value)
138
84
  },
139
85
  },
@@ -142,24 +88,21 @@
142
88
  angle: 328,
143
89
  content: false,
144
90
  onClick: () => {
145
- if (value[1] + sensitivity >= axes[1].maxNum) {
146
- value[1] = axes[1].maxNum
147
- onUpdate(value)
148
- } else {
149
- value[1] = roundToClean(value[1] + sensitivity)
150
- onUpdate(value)
151
- }
152
- if (value[2] + sensitivity >= axes[2].maxNum) {
153
- value[2] = axes[2].maxNum
154
- onUpdate(value)
155
- } else {
156
- value[2] = roundToClean(value[2] + sensitivity)
157
- onUpdate(value)
158
- }
91
+ updateValue(1, +sensitivity)
92
+ updateValue(2, +sensitivity)
93
+ onUpdate(value)
159
94
  },
160
95
  },
161
96
  ]
162
97
 
98
+ const updateValue = (index: number, delta: number) => {
99
+ const axis = axes[axes.length == 2 ? index - 1 : index]
100
+ const min = axis.minNum ?? -360
101
+ const max = axis.maxNum ?? 360
102
+
103
+ value[index] = Math.min(max, Math.max(min, roundToClean(value[index] + delta)))
104
+ }
105
+
163
106
  const sensitivityOptions = [0.01, 0.1, 1.0, 10, 100]
164
107
  let sensitivity = $state(1.0)
165
108
 
@@ -179,13 +122,15 @@
179
122
  }
180
123
  </script>
181
124
 
182
- <div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class={twMerge(`bg-red relative flex w-full flex-col items-center`, wrapperClass)}>
125
+ <div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class={twMerge(`bg-blue relative container flex w-full flex-col items-center`, wrapperClass)}>
183
126
  {#if label.name}
184
127
  <h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}</h5>
185
128
  {/if}
186
129
 
187
- <div class=" flex w-1/2 items-center justify-center">
188
- <div class="relative z-10 flex size-40 items-center justify-center rounded-full bg-(--bg-color) shadow-[0_0_20px_rgb(0_0_0_/0.25)]">
130
+ <div class="flex w-1/2 items-center justify-center">
131
+ <div
132
+ class="relative z-10 flex size-40 min-h-40 min-w-40 items-center justify-center rounded-full bg-(--bg-color) shadow-[0_0_20px_rgb(0_0_0_/0.25)]"
133
+ >
189
134
  <!-- Основные кнопки (оси pitch и yaw) -->
190
135
  <div class="absolute h-full w-full overflow-hidden rounded-full">
191
136
  {#each directions as direction, index}
@@ -251,11 +196,11 @@
251
196
  style="background: color-mix(in srgb, var(--bg-color), var(--shadow-color) 10%)"
252
197
  >
253
198
  <button
254
- class="h-full cursor-pointer rounded-l-full px-3.5"
199
+ class="h-full rotate-270 cursor-pointer rounded-l-full px-3.5"
255
200
  title=""
256
201
  onclick={() => {
257
- if (value[0] - sensitivity <= axes[0].minNum) {
258
- value[0] = axes[0].minNum
202
+ if (value[0] - sensitivity <= (axes[0].minNum ?? -360)) {
203
+ value[0] = axes[0].minNum ?? -360
259
204
  onUpdate(value)
260
205
  return
261
206
  }
@@ -274,11 +219,11 @@
274
219
  ></button
275
220
  >
276
221
  <button
277
- class="h-full cursor-pointer rounded-r-full px-3.5"
222
+ class="h-full rotate-90 cursor-pointer rounded-r-full px-3.5"
278
223
  title=""
279
224
  onclick={() => {
280
- if (value[0] + sensitivity >= axes[0].maxNum) {
281
- value[0] = axes[0].maxNum
225
+ if (value[0] + sensitivity >= (axes[0].maxNum ?? 360)) {
226
+ value[0] = axes[0].maxNum ?? 360
282
227
  onUpdate(value)
283
228
  return
284
229
  }
@@ -300,8 +245,9 @@
300
245
  {/if}
301
246
  </div>
302
247
 
303
- <div class="flex items-center md:absolute md:left-[calc(50%+120px)]">
304
- <div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class="flex h-full flex-col justify-center rounded-full p-10">
248
+ <!-- Нижняя панель -->
249
+ <div class="mt-3 flex w-80 flex-col gap-1">
250
+ <div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class="flex w-full justify-center rounded-full">
305
251
  {#each sensitivityOptions as option, index}
306
252
  <button
307
253
  id={crypto.randomUUID()}
@@ -312,8 +258,8 @@
312
258
  ? 'z-10 py-1 shadow-[0_0_10px_var(--shadow-color)] hover:shadow-[0_0_15px_var(--shadow-color)]'
313
259
  : ''
314
260
  }
315
- ${sensitivityOptions.length > 0 && index === 0 ? 'rounded-t-2xl' : ''} ${
316
- index === sensitivityOptions.length - 1 ? 'rounded-b-2xl' : ''
261
+ ${sensitivityOptions.length > 0 && index === 0 ? 'rounded-l-2xl' : ''} ${
262
+ index === sensitivityOptions.length - 1 ? 'rounded-r-2xl' : ''
317
263
  } bg-(--back-color)`)}
318
264
  onclick={() => {
319
265
  sensitivity = option
@@ -330,19 +276,21 @@
330
276
  {/each}
331
277
  </div>
332
278
 
333
- <div>
279
+ <div class="flex justify-around">
334
280
  {#each axes as axe, index}
335
- <h5 class="w-full px-4 text-center">{axe.name}</h5>
336
- <input
337
- class={`w-20 rounded-2xl border border-(--border-color) px-4 py-1 text-center transition-all duration-300 outline-none
281
+ <div>
282
+ <h5 class=" px-4 text-center">{axe.name}</h5>
283
+ <input
284
+ class={`w-20 rounded-2xl border border-(--border-color) px-4 py-1 text-center transition-all duration-300 outline-none
338
285
  hover:shadow-md
339
286
  [&::-webkit-inner-spin-button]:hidden
340
287
  [&::-webkit-outer-spin-button]:hidden`}
341
- style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);"
342
- value={value[axes.length == 3 ? index : index + 1]}
343
- id={`${id}-${crypto.randomUUID().slice(0, 6)}`}
344
- readonly
345
- />
288
+ style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);"
289
+ value={value[axes.length == 3 ? index : index + 1]}
290
+ id={`${id}-${crypto.randomUUID().slice(0, 6)}`}
291
+ readonly
292
+ />
293
+ </div>
346
294
  {/each}
347
295
  </div>
348
296
  </div>
@@ -202,7 +202,6 @@
202
202
  component,
203
203
  onPropertyChange,
204
204
  )
205
- console.log(component.properties.axes)
206
205
  }
207
206
  }}
208
207
  />
@@ -336,7 +335,6 @@
336
335
  component,
337
336
  onPropertyChange,
338
337
  )
339
- console.log(component.properties.axes)
340
338
  }
341
339
  }}
342
340
  />
@@ -8,7 +8,7 @@
8
8
  wrapperClass = '',
9
9
  label = { name: '', class: '' },
10
10
  value = $bindable(0),
11
- type = 'vertical',
11
+ type = 'horizontal',
12
12
  number = {
13
13
  minNum: 0,
14
14
  maxNum: 100,
@@ -62,7 +62,7 @@
62
62
  {/if}
63
63
 
64
64
  {#if type == 'vertical'}
65
- <div class="flex h-full w-fit min-w-16 flex-col items-center gap-2 rounded-full bg-(--bg-color) px-2">
65
+ <div class="flex h-full w-fit min-w-16 flex-col items-center gap-2 rounded-full bg-(--bg-color) p-2">
66
66
  <div class="relative my-auto h-[80%] w-[70%] rounded-full bg-(--back-color)/40">
67
67
  <div class="absolute bottom-0 left-0 flex w-full rounded-full bg-(--field-color)" style="height: {progressPercent()}%;"></div>
68
68
  </div>
@@ -44,6 +44,15 @@
44
44
  onPropertyChange({ name: value.name?.split('—')[1].trim(), eventHandler: { Variables: value.value as string } })
45
45
  }}
46
46
  />
47
+ <UI.Select
48
+ wrapperClass="!h-14"
49
+ label={{ name: $t('constructor.props.type') }}
50
+ disabled={component.properties.bitMode}
51
+ type="buttons"
52
+ options={$optionsStore.SWITCH_OPTIONS.filter((o) => o.value !== 'checkbox')}
53
+ value={$optionsStore.SWITCH_OPTIONS.find((option) => option.value == component.properties.type)}
54
+ onUpdate={(option) => updateProperty('type', option.value as string, component, onPropertyChange)}
55
+ />
47
56
  </div>
48
57
  <div class="flex w-1/3 flex-col px-2">
49
58
  <UI.Input
@@ -117,6 +126,15 @@
117
126
  value={component.properties.id}
118
127
  onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
119
128
  />
129
+ <UI.Select
130
+ wrapperClass="!h-14"
131
+ label={{ name: $t('constructor.props.type') }}
132
+ disabled={component.properties.bitMode}
133
+ type="buttons"
134
+ options={$optionsStore.SWITCH_OPTIONS.filter((o) => o.value !== 'checkbox')}
135
+ value={$optionsStore.SWITCH_OPTIONS.find((option) => option.value == component.properties.type)}
136
+ onUpdate={(option) => updateProperty('type', option.value as string, component, onPropertyChange)}
137
+ />
120
138
  <UI.Input
121
139
  label={{ name: $t('constructor.props.wrapperclass') }}
122
140
  value={component.properties.wrapperClass}
@@ -19,8 +19,6 @@
19
19
  label = { name: '', class: '' },
20
20
  type = 'select',
21
21
  value = $bindable(),
22
- bitMode = false,
23
- range = { start: 0, end: 31 },
24
22
  options = [],
25
23
  onUpdate,
26
24
  }: ISelectProps<T> = $props()
package/dist/index.d.ts CHANGED
@@ -31,4 +31,4 @@ export { default as TextField } from './TextField/TextField.svelte';
31
31
  export { default as TextFieldProps } from './TextField/TextFieldProps.svelte';
32
32
  export * from './locales/i18n';
33
33
  export * from './locales/translations';
34
- export { type UIComponent, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type ISelectOption, type ISwitchProps, type IColorPickerProps, type ISliderProps, type ITextFieldProps, type IMapProps, type IProgressBarProps, type IGraphProps, type IGraphDataObject, type ITableHeader, type ITableProps, type ITabsProps, type IJoystickProps, type IFileAttachProps, } from './types';
34
+ export { type UIComponent, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type ISelectOption, type ISwitchProps, type IColorPickerProps, type ISliderProps, type ITextFieldProps, type IMapProps, type IProgressBarProps, type IGraphProps, type IGraphDataObject, type ITableHeader, type ITableProps, type ITabsProps, type IJoystickProps, type IFileAttachProps, type IDeviceGNSS, } from './types';
@@ -0,0 +1,14 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512"
2
+ ><clipPath id="svgIDa"><circle cx="256" cy="256" r="256" /></clipPath><g clip-path="url(#svgIDa)"
3
+ ><path
4
+ fill="#eee"
5
+ d="m0 0l8 16l-8 15v16l32 65l-32 64v32l32 48l-32 48v32l32 64l-32 65v47l16-8l15 8h16l65-32l64 32h32l48-32l48 32h32l64-32l65 32h47l-8-15l8-16v-16l-32-65l32-64v-32l-32-48l32-48v-32l-32-64l32-65V0l-15 8l-16-8h-16l-65 32l-64-32h-32l-48 32l-48-32h-32l-64 32L47 0H0z"
6
+ /><path
7
+ fill="#0052b4"
8
+ d="m47 0l129 129V0Zm289 0v129L465 0ZM0 47v129h129Zm512 0L383 176h129ZM0 336v129l129-129Zm383 0l129 129V336Zm-47 47v129h129zm-160 0L47 512h129Z"
9
+ /><path fill="#d80027" d="M208 0v208H0v96h208v208h96V304h208v-96H304V0h-96z" /><path
10
+ fill="#d80027"
11
+ d="m336 336l176 176v-31L367 336Zm0-160L512 0h-31L336 145Zm-160 0L0 0v31l145 145zm0 160L0 512h31l145-145Z"
12
+ /></g
13
+ ></svg
14
+ >
@@ -0,0 +1,26 @@
1
+ export default FlagEn;
2
+ type FlagEn = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const FlagEn: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512"
2
+ ><mask id="circleFlagsRu0"><circle cx="256" cy="256" r="256" fill="#fff" /></mask><g mask="url(#circleFlagsRu0)"
3
+ ><path fill="#0052b4" d="M512 170v172l-256 32L0 342V170l256-32z" /><path fill="#eee" d="M512 0v170H0V0Z" /><path
4
+ fill="#d80027"
5
+ d="M512 342v170H0V342Z"
6
+ /></g
7
+ ></svg
8
+ >
@@ -0,0 +1,26 @@
1
+ export default FlagRu;
2
+ type FlagRu = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const FlagRu: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 512 512"
2
+ ><mask id="circleFlagsCn0"><circle cx="256" cy="256" r="256" fill="#fff" /></mask><g mask="url(#circleFlagsCn0)"
3
+ ><path fill="#d80027" d="M0 0h512v512H0z" /><path
4
+ fill="#ffda44"
5
+ d="m140.1 155.8l22.1 68h71.5l-57.8 42.1l22.1 68l-57.9-42l-57.9 42l22.2-68l-57.9-42.1H118zm163.4 240.7l-16.9-20.8l-25 9.7l14.5-22.5l-16.9-20.9l25.9 6.9l14.6-22.5l1.4 26.8l26 6.9l-25.1 9.6zm33.6-61l8-25.6l-21.9-15.5l26.8-.4l7.9-25.6l8.7 25.4l26.8-.3l-21.5 16l8.6 25.4l-21.9-15.5zm45.3-147.6L370.6 212l19.2 18.7l-26.5-3.8l-11.8 24l-4.6-26.4l-26.6-3.8l23.8-12.5l-4.6-26.5l19.2 18.7zm-78.2-73l-2 26.7l24.9 10.1l-26.1 6.4l-1.9 26.8l-14.1-22.8l-26.1 6.4l17.3-20.5l-14.2-22.7l24.9 10.1z"
6
+ /></g
7
+ ></svg
8
+ >
@@ -0,0 +1,26 @@
1
+ export default FlagZh;
2
+ type FlagZh = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const FlagZh: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -1,10 +1,10 @@
1
1
  import { type Readable } from 'svelte/store';
2
- export declare const getInitLanguage: () => string;
3
2
  export declare const Language: import("svelte/store").Writable<string>;
4
3
  export declare function setLanguage(newLang: string): void;
5
4
  export declare const LOCALES: {
6
5
  id: string;
7
6
  name: string;
8
7
  value: string;
8
+ component: import("svelte/legacy").LegacyComponentType;
9
9
  }[];
10
10
  export declare const t: Readable<(key: string) => string>;
@@ -1,19 +1,19 @@
1
1
  import { derived } from 'svelte/store';
2
2
  import { writable } from 'svelte/store';
3
3
  import translations from './translations';
4
+ import FlagZh from './FlagZh.svelte';
5
+ import FlagRu from './FlagRu.svelte';
6
+ import FlagEn from './FlagEn.svelte';
4
7
  /* Язык по умолчанию */
5
8
  let 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
- }
9
+ /* Проверяем, доступен ли localStorage */
10
+ if (typeof window !== 'undefined') {
11
+ initialLanguage = localStorage.getItem('AppLanguage') || navigator.language?.split('-')[0]?.toLowerCase() || 'ru';
12
+ const supported = ['ru', 'en', 'zh'];
13
+ if (!supported.includes(initialLanguage)) {
14
+ initialLanguage = 'ru';
14
15
  }
15
- return initialLanguage;
16
- };
16
+ }
17
17
  /* Создаем хранилище с начальным значением языка */
18
18
  export const Language = writable(initialLanguage);
19
19
  /* Функция для изменения языка */
@@ -25,9 +25,9 @@ export function setLanguage(newLang) {
25
25
  }
26
26
  /* Поддерживаемые языки (код, название языка, флаг) */
27
27
  export const LOCALES = [
28
- { id: 'app-language-ru', name: 'РУС', value: 'ru' },
29
- { id: 'app-language-en', name: 'ENG', value: 'en' },
30
- { id: 'app-language-zh', name: '中文', value: 'zh' },
28
+ { id: 'app-language-ru', name: 'Русский', value: 'ru', component: FlagRu },
29
+ { id: 'app-language-en', name: 'English', value: 'en', component: FlagEn },
30
+ { id: 'app-language-zh', name: '中国人', value: 'zh', component: FlagZh },
31
31
  ];
32
32
  /* Функция для перевода для текущего языка */
33
33
  function translate(locale, key) {
@@ -130,6 +130,8 @@ const translations = {
130
130
  'constructor.props.map.timeout': 'Таймаут маркеров:',
131
131
  'constructor.props.joystick.axes': 'Названия осей',
132
132
  'constructor.props.joystick.axes.info': 'Поле для ввода названий осей, разделенных пробелами (2 или 3 названия)',
133
+ 'constructor.props.file.select': 'Выберите файл',
134
+ 'constructor.props.file.notselected': 'Файл не выбран',
133
135
  'constructor.props.table.columns': 'Колонки таблицы',
134
136
  'constructor.props.table.columns.key': 'Ключ',
135
137
  'constructor.props.table.columns.label': 'Название колонки',
package/dist/types.d.ts CHANGED
@@ -247,6 +247,7 @@ export interface ITableHeader<T extends object> {
247
247
  buttons?: {
248
248
  name: string | ((row: T) => string);
249
249
  class?: string | ((row: T) => string);
250
+ eventHandler?: IUIComponentHandler;
250
251
  onClick?: (row: T) => void;
251
252
  }[];
252
253
  image?: {
@@ -308,8 +309,8 @@ export interface IJoystickProps {
308
309
  value?: number[];
309
310
  axes?: {
310
311
  name: string;
311
- minNum: number;
312
- maxNum: number;
312
+ minNum?: number;
313
+ maxNum?: number;
313
314
  }[];
314
315
  buttonIcon?: string;
315
316
  onUpdate?: (value: number[]) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.2.32",
3
+ "version": "1.3.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -49,7 +49,7 @@
49
49
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
50
50
  "@types/node": "^24.10.1",
51
51
  "publint": "^0.3.15",
52
- "svelte": "^5.44.0",
52
+ "svelte": "^5.44.1",
53
53
  "svelte-preprocess": "^6.0.3",
54
54
  "vite": "^7.2.4",
55
55
  "vite-plugin-compression": "^0.5.1"