poe-svelte-ui-lib 1.2.31 → 1.3.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/dist/Button/Button.svelte +3 -3
- package/dist/FileAttach/FileAttach.svelte +13 -10
- package/dist/Input/Input.svelte +3 -3
- package/dist/Joystick/Joystick.svelte +54 -104
- package/dist/ProgressBar/ProgressBar.svelte +1 -1
- package/dist/ProgressBar/ProgressBarProps.svelte +18 -0
- package/dist/Select/Select.svelte +0 -2
- package/dist/index.d.ts +1 -1
- package/dist/locales/FlagEn.svelte +14 -0
- package/dist/locales/FlagEn.svelte.d.ts +26 -0
- package/dist/locales/FlagRu.svelte +8 -0
- package/dist/locales/FlagRu.svelte.d.ts +26 -0
- package/dist/locales/FlagZh.svelte +8 -0
- package/dist/locales/FlagZh.svelte.d.ts +26 -0
- package/dist/locales/i18n.d.ts +1 -1
- package/dist/locales/i18n.js +13 -13
- package/dist/locales/translations.js +2 -0
- package/dist/types.d.ts +3 -2
- package/package.json +2 -2
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
if (content.info?.text) showInfo = false
|
|
86
86
|
}}
|
|
87
87
|
>
|
|
88
|
-
<
|
|
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
|
-
</
|
|
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
|
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
|
|
28
29
|
const file = input.files[0]
|
|
29
30
|
selectedFile = file
|
|
31
|
+
fileName = file.name
|
|
30
32
|
|
|
31
33
|
if (file.type.startsWith('image/')) previewUrl = URL.createObjectURL(file)
|
|
32
34
|
|
|
@@ -37,6 +39,9 @@
|
|
|
37
39
|
const input = document.getElementById(ID)
|
|
38
40
|
input?.click()
|
|
39
41
|
}
|
|
42
|
+
|
|
43
|
+
let fileName = $state('')
|
|
44
|
+
$effect(() => console.log(fileName))
|
|
40
45
|
</script>
|
|
41
46
|
|
|
42
47
|
<div class={twMerge(`flex flex-col items-center`, wrapperClass)}>
|
|
@@ -71,16 +76,14 @@
|
|
|
71
76
|
</div>
|
|
72
77
|
{:else}
|
|
73
78
|
<label class="relative inline-block w-full">
|
|
74
|
-
<input
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
onchange={handleFileChange}
|
|
83
|
-
/>
|
|
79
|
+
<input id={ID} type="file" class="absolute left-0 z-1 h-8.5 w-full opacity-0" {accept} {disabled} onchange={handleFileChange} />
|
|
80
|
+
<div
|
|
81
|
+
class="flex h-8.5 w-full overflow-hidden rounded-2xl font-semibold shadow-sm transition duration-250 hover:shadow-md
|
|
82
|
+
${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'}"
|
|
83
|
+
>
|
|
84
|
+
<div class="flex w-1/3 items-center justify-center bg-(--blue-color)">{$t('constructor.props.file.select')}</div>
|
|
85
|
+
<div class="flex w-2/3 items-center justify-start bg-(--back-color) px-2">{fileName || $t('constructor.props.file.notselected')}</div>
|
|
86
|
+
</div>
|
|
84
87
|
</label>
|
|
85
88
|
{/if}
|
|
86
89
|
</div>
|
package/dist/Input/Input.svelte
CHANGED
|
@@ -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
|
|
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: -
|
|
12
|
-
{ name: 'Pitch', minNum: -
|
|
13
|
-
{ name: 'Yaw', minNum: -
|
|
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
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
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,23 @@
|
|
|
142
88
|
angle: 328,
|
|
143
89
|
content: false,
|
|
144
90
|
onClick: () => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
+
console.log(axis)
|
|
101
|
+
|
|
102
|
+
const min = axis.minNum ?? -360
|
|
103
|
+
const max = axis.maxNum ?? 360
|
|
104
|
+
|
|
105
|
+
value[index] = Math.min(max, Math.max(min, roundToClean(value[index] + delta)))
|
|
106
|
+
}
|
|
107
|
+
|
|
163
108
|
const sensitivityOptions = [0.01, 0.1, 1.0, 10, 100]
|
|
164
109
|
let sensitivity = $state(1.0)
|
|
165
110
|
|
|
@@ -179,13 +124,15 @@
|
|
|
179
124
|
}
|
|
180
125
|
</script>
|
|
181
126
|
|
|
182
|
-
<div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class={twMerge(`bg-
|
|
127
|
+
<div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class={twMerge(`bg-blue relative container flex w-full flex-col items-center`, wrapperClass)}>
|
|
183
128
|
{#if label.name}
|
|
184
129
|
<h5 class={twMerge(`w-full px-4 text-center`, label.class)}>{label.name}</h5>
|
|
185
130
|
{/if}
|
|
186
131
|
|
|
187
|
-
<div class="
|
|
188
|
-
<div
|
|
132
|
+
<div class="flex w-1/2 items-center justify-center">
|
|
133
|
+
<div
|
|
134
|
+
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)]"
|
|
135
|
+
>
|
|
189
136
|
<!-- Основные кнопки (оси pitch и yaw) -->
|
|
190
137
|
<div class="absolute h-full w-full overflow-hidden rounded-full">
|
|
191
138
|
{#each directions as direction, index}
|
|
@@ -254,8 +201,8 @@
|
|
|
254
201
|
class="h-full cursor-pointer rounded-l-full px-3.5"
|
|
255
202
|
title=""
|
|
256
203
|
onclick={() => {
|
|
257
|
-
if (value[0] - sensitivity <= axes[0].minNum) {
|
|
258
|
-
value[0] = axes[0].minNum
|
|
204
|
+
if (value[0] - sensitivity <= (axes[0].minNum ?? -360)) {
|
|
205
|
+
value[0] = axes[0].minNum ?? -360
|
|
259
206
|
onUpdate(value)
|
|
260
207
|
return
|
|
261
208
|
}
|
|
@@ -277,8 +224,8 @@
|
|
|
277
224
|
class="h-full cursor-pointer rounded-r-full px-3.5"
|
|
278
225
|
title=""
|
|
279
226
|
onclick={() => {
|
|
280
|
-
if (value[0] + sensitivity >= axes[0].maxNum) {
|
|
281
|
-
value[0] = axes[0].maxNum
|
|
227
|
+
if (value[0] + sensitivity >= (axes[0].maxNum ?? 360)) {
|
|
228
|
+
value[0] = axes[0].maxNum ?? 360
|
|
282
229
|
onUpdate(value)
|
|
283
230
|
return
|
|
284
231
|
}
|
|
@@ -300,8 +247,9 @@
|
|
|
300
247
|
{/if}
|
|
301
248
|
</div>
|
|
302
249
|
|
|
303
|
-
|
|
304
|
-
|
|
250
|
+
<!-- Нижняя панель -->
|
|
251
|
+
<div class="mt-4 flex w-80 flex-col gap-2">
|
|
252
|
+
<div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class="flex w-full justify-center rounded-full">
|
|
305
253
|
{#each sensitivityOptions as option, index}
|
|
306
254
|
<button
|
|
307
255
|
id={crypto.randomUUID()}
|
|
@@ -312,8 +260,8 @@
|
|
|
312
260
|
? 'z-10 py-1 shadow-[0_0_10px_var(--shadow-color)] hover:shadow-[0_0_15px_var(--shadow-color)]'
|
|
313
261
|
: ''
|
|
314
262
|
}
|
|
315
|
-
${sensitivityOptions.length > 0 && index === 0 ? 'rounded-
|
|
316
|
-
index === sensitivityOptions.length - 1 ? 'rounded-
|
|
263
|
+
${sensitivityOptions.length > 0 && index === 0 ? 'rounded-l-2xl' : ''} ${
|
|
264
|
+
index === sensitivityOptions.length - 1 ? 'rounded-r-2xl' : ''
|
|
317
265
|
} bg-(--back-color)`)}
|
|
318
266
|
onclick={() => {
|
|
319
267
|
sensitivity = option
|
|
@@ -330,19 +278,21 @@
|
|
|
330
278
|
{/each}
|
|
331
279
|
</div>
|
|
332
280
|
|
|
333
|
-
<div>
|
|
281
|
+
<div class="flex justify-around">
|
|
334
282
|
{#each axes as axe, index}
|
|
335
|
-
<
|
|
336
|
-
|
|
337
|
-
|
|
283
|
+
<div>
|
|
284
|
+
<h5 class=" px-4 text-center">{axe.name}</h5>
|
|
285
|
+
<input
|
|
286
|
+
class={`w-20 rounded-2xl border border-(--border-color) px-4 py-1 text-center transition-all duration-300 outline-none
|
|
338
287
|
hover:shadow-md
|
|
339
288
|
[&::-webkit-inner-spin-button]:hidden
|
|
340
289
|
[&::-webkit-outer-spin-button]:hidden`}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
290
|
+
style="background: color-mix(in srgb, var(--bg-color), var(--back-color) 70%);"
|
|
291
|
+
value={value[axes.length == 3 ? index : index + 1]}
|
|
292
|
+
id={`${id}-${crypto.randomUUID().slice(0, 6)}`}
|
|
293
|
+
readonly
|
|
294
|
+
/>
|
|
295
|
+
</div>
|
|
346
296
|
{/each}
|
|
347
297
|
</div>
|
|
348
298
|
</div>
|
|
@@ -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)
|
|
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}
|
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, } 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
|
+
}
|
package/dist/locales/i18n.d.ts
CHANGED
|
@@ -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>;
|
package/dist/locales/i18n.js
CHANGED
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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: '
|
|
29
|
-
{ id: 'app-language-en', name: '
|
|
30
|
-
{ id: 'app-language-zh', name: '
|
|
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
|
|
312
|
-
maxNum
|
|
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.
|
|
3
|
+
"version": "1.3.0",
|
|
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.
|
|
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"
|