poe-svelte-ui-lib 1.20.4 → 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.
|
@@ -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()}
|