poe-svelte-ui-lib 1.20.3 → 1.20.5
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 +1 -6
- package/dist/FileAttach/FileAttach.svelte +0 -5
- package/dist/Input/Input.svelte +7 -5
- package/dist/Select/Select.svelte +0 -4
- package/dist/Select/SelectProps.svelte +24 -0
- package/dist/Switch/Switch.svelte +6 -3
- package/dist/Switch/SwitchProps.svelte +7 -0
- package/package.json +1 -1
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
})
|
|
98
98
|
</script>
|
|
99
99
|
|
|
100
|
-
<div class={twMerge(`relative flex w-full flex-col items-center
|
|
100
|
+
<div class={twMerge(`relative flex w-full flex-col items-center`, wrapperClass)}>
|
|
101
101
|
<button
|
|
102
102
|
{id}
|
|
103
103
|
class={`${twMerge(
|
|
@@ -145,9 +145,4 @@
|
|
|
145
145
|
</button>
|
|
146
146
|
|
|
147
147
|
<Tooltip show={showInfo} text={content.info?.text ?? ""} side={content.info?.side ?? "top"} />
|
|
148
|
-
|
|
149
|
-
<!-- Такая же зарезервированная строка, как у Input/Select (h-4, всегда пустая — у кнопки
|
|
150
|
-
нет валидации), чтобы высота совпадала при совместном размещении в одной строке
|
|
151
|
-
(items-end) с полем ввода или селектом. -->
|
|
152
|
-
<span class="block h-4" aria-hidden="true"></span>
|
|
153
148
|
</div>
|
|
@@ -100,9 +100,4 @@
|
|
|
100
100
|
</div>
|
|
101
101
|
</label>
|
|
102
102
|
{/if}
|
|
103
|
-
|
|
104
|
-
<!-- Такая же зарезервированная строка, как у Input/Select/Button (h-4, всегда пустая —
|
|
105
|
-
у FileAttach нет валидации), чтобы высота совпадала при совместном размещении в одной
|
|
106
|
-
строке (items-end) с полем ввода, селектом или кнопкой. -->
|
|
107
|
-
<span class="block h-4" aria-hidden="true"></span>
|
|
108
103
|
</div>
|
package/dist/Input/Input.svelte
CHANGED
|
@@ -239,9 +239,11 @@
|
|
|
239
239
|
{/if}
|
|
240
240
|
</div>
|
|
241
241
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
242
|
+
{#if help.regExp && !isValid}
|
|
243
|
+
<!-- Абсолютное позиционирование — сообщение об ошибке не должно занимать место в потоке
|
|
244
|
+
и сдвигать соседние поля/кнопки в общей строке; было: зарезервированная строка h-4
|
|
245
|
+
всегда в потоке — давала лишний зазор везде, где ошибке взяться неоткуда (например
|
|
246
|
+
вертикальный список кнопок быстрых команд в Отладке). -->
|
|
247
|
+
<span class="absolute top-full left-0 mt-1 text-[12px] text-(--red-color)">Неверный формат</span>
|
|
248
|
+
{/if}
|
|
247
249
|
</div>
|
|
@@ -288,8 +288,4 @@
|
|
|
288
288
|
{/if}
|
|
289
289
|
{/if}
|
|
290
290
|
</div>
|
|
291
|
-
|
|
292
|
-
<!-- Такая же зарезервированная строка, как у Input (h-4, всегда пустая — у Select нет
|
|
293
|
-
валидации), чтобы высота совпадала при совместном размещении в одной строке (items-end). -->
|
|
294
|
-
<span class="block h-4 text-[12px]"></span>
|
|
295
291
|
</div>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import ButtonAdd from "../libIcons/ButtonAdd.svelte"
|
|
8
8
|
import { optionsStore } from "../options.js"
|
|
9
9
|
import CommonSnippets from "../CommonSnippets.svelte"
|
|
10
|
+
import { twMerge } from "tailwind-merge"
|
|
10
11
|
|
|
11
12
|
const {
|
|
12
13
|
component,
|
|
@@ -53,6 +54,11 @@
|
|
|
53
54
|
(a.value as string).includes(component.properties.label?.class?.split(" ").find((cls: string) => cls.startsWith("text-"))),
|
|
54
55
|
),
|
|
55
56
|
)
|
|
57
|
+
const initialContentAlign = $derived(
|
|
58
|
+
$optionsStore.TEXT_ALIGN_OPTIONS.slice(0, -1).find((a) =>
|
|
59
|
+
(a.value as string).includes(component.properties.componentClass?.split(" ").find((cls: string) => cls.startsWith("text-")) ?? "text-left"),
|
|
60
|
+
),
|
|
61
|
+
)
|
|
56
62
|
|
|
57
63
|
/* Argument пуст — поле ниже лишь визуально показывает "ModCfg", реальное значение нужно проставить в состояние */
|
|
58
64
|
$effect(() => {
|
|
@@ -70,6 +76,22 @@
|
|
|
70
76
|
/>
|
|
71
77
|
{/snippet}
|
|
72
78
|
|
|
79
|
+
{#snippet SelectContentAlign()}
|
|
80
|
+
<UI.Select
|
|
81
|
+
label={{ name: $T("constructor.props.align.content") }}
|
|
82
|
+
type="buttons"
|
|
83
|
+
value={initialContentAlign}
|
|
84
|
+
options={$optionsStore.TEXT_ALIGN_OPTIONS.slice(0, -1)}
|
|
85
|
+
onUpdate={(option) =>
|
|
86
|
+
updateProperty(
|
|
87
|
+
"componentClass",
|
|
88
|
+
twMerge(component.properties.componentClass, (option as UI.IOption<string>).value),
|
|
89
|
+
component,
|
|
90
|
+
onPropertyChange,
|
|
91
|
+
)}
|
|
92
|
+
/>
|
|
93
|
+
{/snippet}
|
|
94
|
+
|
|
73
95
|
{#snippet SelectType()}
|
|
74
96
|
<UI.Select
|
|
75
97
|
label={{ name: $T("constructor.props.type") }}
|
|
@@ -262,6 +284,7 @@
|
|
|
262
284
|
<div class="flex w-1/3 flex-col px-2">
|
|
263
285
|
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
264
286
|
<CommonSnippets snippet="LabelAlign" initialValue={initialAlign} {component} {onPropertyChange} />
|
|
287
|
+
{@render SelectContentAlign()}
|
|
265
288
|
{@render SelectSettings()}
|
|
266
289
|
</div>
|
|
267
290
|
</div>
|
|
@@ -276,6 +299,7 @@
|
|
|
276
299
|
<div class="flex w-1/3 flex-col px-2">
|
|
277
300
|
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
278
301
|
<CommonSnippets snippet="LabelClass" {component} {onPropertyChange} />
|
|
302
|
+
{@render SelectContentAlign()}
|
|
279
303
|
<CommonSnippets snippet="Disabled" {component} {onPropertyChange} />
|
|
280
304
|
<CommonSnippets snippet="BitModeInfo" {component} {onPropertyChange} />
|
|
281
305
|
</div>
|
|
@@ -91,10 +91,13 @@
|
|
|
91
91
|
disabled={option.disabled}
|
|
92
92
|
onchange={() => handleToggle(index)}
|
|
93
93
|
/>
|
|
94
|
-
<!-- Дорожка: акцент во включённом состоянии, нейтральная серая в
|
|
94
|
+
<!-- Дорожка: акцент во включённом состоянии, нейтральная серая в выключенном.
|
|
95
|
+
Фолбэк var(--accent-color) — большинство вызовов Switch не передают
|
|
96
|
+
wrapperClass с ролью цвета (bg-blue и т.п.), без фолбэка --bg-color
|
|
97
|
+
остаётся не задан и дорожка становится невидимой при включении. -->
|
|
95
98
|
<span
|
|
96
99
|
class="relative flex items-center rounded-full transition-colors duration-200
|
|
97
|
-
{checkedOptions[index] ? 'bg-(--bg-color)' : 'bg-(--border-color)'}
|
|
100
|
+
{checkedOptions[index] ? 'bg-(--bg-color,var(--accent-color))' : 'bg-(--border-color)'}
|
|
98
101
|
{option.disabled ? 'cursor-not-allowed opacity-45' : 'cursor-pointer'}"
|
|
99
102
|
style="{type === 'horizontal' ? 'width' : 'height'}: {`calc(${height} * 1.7)`}; {type === 'horizontal'
|
|
100
103
|
? 'height'
|
|
@@ -144,7 +147,7 @@
|
|
|
144
147
|
class="
|
|
145
148
|
relative size-5 shrink-0 cursor-pointer appearance-none rounded-[6px] border border-(--border-color)
|
|
146
149
|
bg-(--field-color) transition-colors duration-150 after:origin-center after:opacity-0
|
|
147
|
-
checked:border-(--bg-color) checked:bg-(--bg-color)
|
|
150
|
+
checked:border-(--bg-color,var(--accent-color)) checked:bg-(--bg-color,var(--accent-color))
|
|
148
151
|
checked:after:absolute checked:after:top-[1px] checked:after:left-[6px]
|
|
149
152
|
checked:after:h-[10px] checked:after:w-[5px] checked:after:rotate-45
|
|
150
153
|
checked:after:border-2 checked:after:border-t-0 checked:after:border-l-0
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
let initialColor = $optionsStore.COLOR_OPTIONS.find((c) =>
|
|
23
23
|
(c.value as string).includes(component.properties.options[0].class.split(" ").find((cls: string) => cls.startsWith("bg-"))),
|
|
24
24
|
)
|
|
25
|
+
const initialAlign = $derived(
|
|
26
|
+
$optionsStore.TEXT_ALIGN_OPTIONS.find((a) =>
|
|
27
|
+
(a.value as string).includes(component.properties.label?.class?.split(" ").find((cls: string) => cls.startsWith("text-"))),
|
|
28
|
+
),
|
|
29
|
+
)
|
|
25
30
|
</script>
|
|
26
31
|
|
|
27
32
|
{#snippet SwitchType()}
|
|
@@ -201,6 +206,7 @@
|
|
|
201
206
|
|
|
202
207
|
<div class="flex w-1/3 flex-col px-2">
|
|
203
208
|
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
209
|
+
<CommonSnippets snippet="LabelAlign" initialValue={initialAlign} {component} {onPropertyChange} />
|
|
204
210
|
{#if !component.properties.bitMode}
|
|
205
211
|
<CommonSnippets
|
|
206
212
|
snippet="Colors"
|
|
@@ -251,6 +257,7 @@
|
|
|
251
257
|
</div>
|
|
252
258
|
<div class="flex w-1/3 flex-col px-2">
|
|
253
259
|
<CommonSnippets snippet="Label" {component} {onPropertyChange} />
|
|
260
|
+
<CommonSnippets snippet="LabelAlign" initialValue={initialAlign} {component} {onPropertyChange} />
|
|
254
261
|
{@render SwitchType()}
|
|
255
262
|
{#if !component.properties.bitMode}
|
|
256
263
|
{@render SwitchCaptions()}
|