poe-svelte-ui-lib 1.0.1 → 1.0.4
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/LICENSE +3 -3
- package/README.md +1 -0
- package/dist/Accordion/Accordion.svelte +53 -53
- package/dist/Button/Button.svelte +111 -144
- package/dist/Button/Button.svelte.d.ts +1 -34
- package/dist/ColorPicker/ColorPicker.svelte +205 -207
- package/dist/FileAttach/FileAttach.svelte +103 -103
- package/dist/Graph/Graph.svelte +270 -270
- package/dist/Input/Input.svelte +240 -239
- package/dist/Loader.svelte +12 -12
- package/dist/MessageModal.svelte +54 -54
- package/dist/ProgressBar/ProgressBar.svelte +48 -48
- package/dist/Select/Select.svelte +189 -191
- package/dist/Slider/Slider.svelte +260 -260
- package/dist/Switch/Switch.svelte +84 -83
- package/dist/Table/Table.svelte +275 -276
- package/dist/TextField/TextField.svelte +22 -22
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -11
- package/dist/{appIcons → libIcons}/ButtonAdd.svelte +10 -10
- package/dist/{appIcons → libIcons}/ButtonDelete.svelte +13 -13
- package/dist/{appIcons → libIcons}/LoaderRotate.svelte +9 -9
- package/dist/options.d.ts +11 -11
- package/dist/options.js +27 -27
- package/dist/types.d.ts +1 -1
- package/package.json +48 -47
- package/dist/Accordion/AccordionProps.svelte +0 -70
- package/dist/Accordion/AccordionProps.svelte.d.ts +0 -10
- package/dist/Button/ButtonProps.svelte +0 -200
- package/dist/Button/ButtonProps.svelte.d.ts +0 -10
- package/dist/ColorPicker/ColorPickerProps.svelte +0 -100
- package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +0 -10
- package/dist/Graph/GraphProps.svelte +0 -56
- package/dist/Graph/GraphProps.svelte.d.ts +0 -10
- package/dist/Input/InputProps.svelte +0 -221
- package/dist/Input/InputProps.svelte.d.ts +0 -10
- package/dist/ProgressBar/ProgressBarProps.svelte +0 -145
- package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +0 -10
- package/dist/Select/SelectProps.svelte +0 -260
- package/dist/Select/SelectProps.svelte.d.ts +0 -10
- package/dist/Slider/SliderProps.svelte +0 -161
- package/dist/Slider/SliderProps.svelte.d.ts +0 -10
- package/dist/Switch/SwitchProps.svelte +0 -144
- package/dist/Switch/SwitchProps.svelte.d.ts +0 -10
- package/dist/Table/TableProps.svelte +0 -286
- package/dist/Table/TableProps.svelte.d.ts +0 -10
- package/dist/TextField/TextFieldProps.svelte +0 -92
- package/dist/TextField/TextFieldProps.svelte.d.ts +0 -10
- package/dist/locales/CircleFlagsEn.svelte +0 -14
- package/dist/locales/CircleFlagsEn.svelte.d.ts +0 -26
- package/dist/locales/CircleFlagsRu.svelte +0 -8
- package/dist/locales/CircleFlagsRu.svelte.d.ts +0 -26
- package/dist/locales/CircleFlagsZh.svelte +0 -8
- package/dist/locales/CircleFlagsZh.svelte.d.ts +0 -26
- package/dist/locales/i18n.d.ts +0 -10
- package/dist/locales/i18n.js +0 -36
- package/dist/locales/translations.d.ts +0 -7
- package/dist/locales/translations.js +0 -450
- /package/dist/{appIcons → libIcons}/ButtonAdd.svelte.d.ts +0 -0
- /package/dist/{appIcons → libIcons}/ButtonDelete.svelte.d.ts +0 -0
- /package/dist/{appIcons → libIcons}/LoaderRotate.svelte.d.ts +0 -0
package/LICENSE
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Looks like there's already a license file for this project.
|
|
2
|
-
[?25l[2K[1G[36m?[39m [1mDo you want to replace it?[22m [90m┬╗[39m [90m(y/N)[39m[2K[1G[2K[1G[32mтИЪ[39m [1mDo you want to replace it?[22m [90m...[39m no
|
|
3
|
-
[?25hExiting...
|
|
1
|
+
Looks like there's already a license file for this project.
|
|
2
|
+
[?25l[2K[1G[36m?[39m [1mDo you want to replace it?[22m [90m┬╗[39m [90m(y/N)[39m[2K[1G[2K[1G[32mтИЪ[39m [1mDo you want to replace it?[22m [90m...[39m no
|
|
3
|
+
[?25hExiting...
|
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Набор компонентов на Svelte в режиме рун
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { slide } from 'svelte/transition'
|
|
3
|
-
import type { IAccordionProps } from '../types'
|
|
4
|
-
|
|
5
|
-
const props: IAccordionProps = $props()
|
|
6
|
-
let isOpen = $state(props.isOpen)
|
|
7
|
-
|
|
8
|
-
const toggle = () => (isOpen = !isOpen)
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<div
|
|
12
|
-
id={props.id?.value}
|
|
13
|
-
class="border-[var(--border-color)] p-0 transition-shadow duration-250 {props.type === 'sub'
|
|
14
|
-
? 'border-none'
|
|
15
|
-
: 'rounded-xl border bg-[var(--conteiner-color)] hover:shadow-md'}
|
|
16
|
-
{props.componentClass}"
|
|
17
|
-
transition:slide={{ duration: 250 }}
|
|
18
|
-
>
|
|
19
|
-
<button
|
|
20
|
-
class="flex w-full cursor-pointer items-center justify-between transition-shadow duration-250 sm:p-4 sm:px-6
|
|
21
|
-
{props.type === 'sub' ? 'border-b border-[var(--border-color)]' : ''}"
|
|
22
|
-
onclick={toggle}
|
|
23
|
-
>
|
|
24
|
-
<span class="toggle m-0 cursor-pointer text-lg font-semibold {props.label?.class}">
|
|
25
|
-
{props.label?.name}
|
|
26
|
-
</span>
|
|
27
|
-
<svg
|
|
28
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
-
class="arrow h-[1.1rem] w-[1.1rem] transition-transform duration-250"
|
|
30
|
-
style="transform: rotate({isOpen ? 180 : 0}deg)"
|
|
31
|
-
viewBox="0 0 24 24"
|
|
32
|
-
>
|
|
33
|
-
<path
|
|
34
|
-
fill="none"
|
|
35
|
-
stroke="currentColor"
|
|
36
|
-
stroke-linecap="round"
|
|
37
|
-
stroke-linejoin="round"
|
|
38
|
-
stroke-width="1.5"
|
|
39
|
-
d="M18 12.5s-4.419 6-6 6s-6-6-6-6m12-7s-4.419 6-6 6s-6-6-6-6"
|
|
40
|
-
color="currentColor"
|
|
41
|
-
/>
|
|
42
|
-
</svg>
|
|
43
|
-
</button>
|
|
44
|
-
|
|
45
|
-
{#if isOpen}
|
|
46
|
-
<div
|
|
47
|
-
class="flex w-full flex-wrap items-start justify-around p-4 sm:p-3 {props.type === 'sub' ? '' : 'border-t border-[var(--border-color)]'}"
|
|
48
|
-
transition:slide={{ duration: 250 }}
|
|
49
|
-
>
|
|
50
|
-
{@render props.children?.()}
|
|
51
|
-
</div>
|
|
52
|
-
{/if}
|
|
53
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { slide } from 'svelte/transition'
|
|
3
|
+
import type { IAccordionProps } from '../types'
|
|
4
|
+
|
|
5
|
+
const props: IAccordionProps = $props()
|
|
6
|
+
let isOpen = $state(props.isOpen)
|
|
7
|
+
|
|
8
|
+
const toggle = () => (isOpen = !isOpen)
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div
|
|
12
|
+
id={props.id?.value}
|
|
13
|
+
class="border-[var(--border-color)] p-0 transition-shadow duration-250 {props.type === 'sub'
|
|
14
|
+
? 'border-none'
|
|
15
|
+
: 'rounded-xl border bg-[var(--conteiner-color)] hover:shadow-md'}
|
|
16
|
+
{props.componentClass}"
|
|
17
|
+
transition:slide={{ duration: 250 }}
|
|
18
|
+
>
|
|
19
|
+
<button
|
|
20
|
+
class="flex w-full cursor-pointer items-center justify-between transition-shadow duration-250 sm:p-4 sm:px-6
|
|
21
|
+
{props.type === 'sub' ? 'border-b border-[var(--border-color)]' : ''}"
|
|
22
|
+
onclick={toggle}
|
|
23
|
+
>
|
|
24
|
+
<span class="toggle m-0 cursor-pointer text-lg font-semibold {props.label?.class}">
|
|
25
|
+
{props.label?.name}
|
|
26
|
+
</span>
|
|
27
|
+
<svg
|
|
28
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
+
class="arrow h-[1.1rem] w-[1.1rem] transition-transform duration-250"
|
|
30
|
+
style="transform: rotate({isOpen ? 180 : 0}deg)"
|
|
31
|
+
viewBox="0 0 24 24"
|
|
32
|
+
>
|
|
33
|
+
<path
|
|
34
|
+
fill="none"
|
|
35
|
+
stroke="currentColor"
|
|
36
|
+
stroke-linecap="round"
|
|
37
|
+
stroke-linejoin="round"
|
|
38
|
+
stroke-width="1.5"
|
|
39
|
+
d="M18 12.5s-4.419 6-6 6s-6-6-6-6m12-7s-4.419 6-6 6s-6-6-6-6"
|
|
40
|
+
color="currentColor"
|
|
41
|
+
/>
|
|
42
|
+
</svg>
|
|
43
|
+
</button>
|
|
44
|
+
|
|
45
|
+
{#if isOpen}
|
|
46
|
+
<div
|
|
47
|
+
class="flex w-full flex-wrap items-start justify-around p-4 sm:p-3 {props.type === 'sub' ? '' : 'border-t border-[var(--border-color)]'}"
|
|
48
|
+
transition:slide={{ duration: 250 }}
|
|
49
|
+
>
|
|
50
|
+
{@render props.children?.()}
|
|
51
|
+
</div>
|
|
52
|
+
{/if}
|
|
53
|
+
</div>
|
|
@@ -1,144 +1,111 @@
|
|
|
1
|
-
<!-- $lib/ElementsUI/Button.svelte -->
|
|
2
|
-
<script lang="ts">
|
|
3
|
-
import { onMount } from 'svelte'
|
|
4
|
-
|
|
5
|
-
import { fly } from 'svelte/transition'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
keyBind
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<div class=
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
{#if icon?.component}
|
|
113
|
-
{@const IconComponent = icon?.component}
|
|
114
|
-
<IconComponent {...icon?.properties} />
|
|
115
|
-
{/if}
|
|
116
|
-
{#if name}
|
|
117
|
-
<div class="flex-1">
|
|
118
|
-
{name}
|
|
119
|
-
{#if keyBind}
|
|
120
|
-
<div class="text-xs opacity-70">
|
|
121
|
-
({keyBind.ctrlKey ? 'Ctrl+' : ''}{keyBind.shiftKey ? 'Shift+' : ''}{keyBind.altKey ? 'Alt+' : ''}{keyBind.key})
|
|
122
|
-
</div>
|
|
123
|
-
{/if}
|
|
124
|
-
</div>
|
|
125
|
-
{/if}
|
|
126
|
-
</span>
|
|
127
|
-
</button>
|
|
128
|
-
|
|
129
|
-
{#if showInfo}
|
|
130
|
-
<div
|
|
131
|
-
transition:fly={{ y: -15, duration: 300 }}
|
|
132
|
-
class="absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-xs rounded-md px-3 py-1 text-sm shadow-lg"
|
|
133
|
-
style="background: color-mix(in srgb, var(--yellow-color) 30%, var(--back-color)); transform: translateX(-50%);"
|
|
134
|
-
>
|
|
135
|
-
{info}
|
|
136
|
-
<!-- Треугольная стрелка -->
|
|
137
|
-
<div
|
|
138
|
-
class="absolute top-full left-1/2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rotate-45 transform"
|
|
139
|
-
style="background: color-mix(in srgb, var(--yellow-color) 30%, var(--back-color));"
|
|
140
|
-
></div>
|
|
141
|
-
</div>
|
|
142
|
-
{/if}
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
1
|
+
<!-- $lib/ElementsUI/Button.svelte -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { onMount } from 'svelte'
|
|
4
|
+
import type { IButtonProps } from '../types'
|
|
5
|
+
import { fly } from 'svelte/transition'
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
id = { value: crypto.randomUUID(), name: '' },
|
|
9
|
+
wrapperClass = 'bg-blue',
|
|
10
|
+
label = { name: '', class: '' },
|
|
11
|
+
name = '',
|
|
12
|
+
componentClass = '',
|
|
13
|
+
icon = { component: null, properties: {} },
|
|
14
|
+
info = '',
|
|
15
|
+
disabled = false,
|
|
16
|
+
keyBind,
|
|
17
|
+
onClick,
|
|
18
|
+
}: IButtonProps = $props()
|
|
19
|
+
|
|
20
|
+
let showInfo = $state(false)
|
|
21
|
+
|
|
22
|
+
/* Обработчик клика */
|
|
23
|
+
const handleClick = () => {
|
|
24
|
+
if (disabled || !onClick) return
|
|
25
|
+
onClick()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Обработчик горячих клавиш */
|
|
29
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
30
|
+
if (disabled || !keyBind || !onClick) return
|
|
31
|
+
|
|
32
|
+
const isKeyMatch = event.key === keyBind.key
|
|
33
|
+
const isCtrlMatch = keyBind.ctrlKey === undefined || event.ctrlKey === keyBind.ctrlKey
|
|
34
|
+
const isShiftMatch = keyBind.shiftKey === undefined || event.shiftKey === keyBind.shiftKey
|
|
35
|
+
const isAltMatch = keyBind.altKey === undefined || event.altKey === keyBind.altKey
|
|
36
|
+
const isMetaMatch = keyBind.metaKey === undefined || event.metaKey === keyBind.metaKey
|
|
37
|
+
|
|
38
|
+
if (isKeyMatch && isCtrlMatch && isShiftMatch && isAltMatch && isMetaMatch) {
|
|
39
|
+
event.preventDefault()
|
|
40
|
+
onClick()
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Подписка на события клавиатуры */
|
|
45
|
+
onMount(() => {
|
|
46
|
+
if (keyBind) {
|
|
47
|
+
window.addEventListener('keydown', handleKeyDown)
|
|
48
|
+
}
|
|
49
|
+
return () => {
|
|
50
|
+
if (keyBind) {
|
|
51
|
+
window.removeEventListener('keydown', handleKeyDown)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<div class={`relative flex w-full flex-col items-center ${wrapperClass}`}>
|
|
58
|
+
{#if label.name}
|
|
59
|
+
<h5 class={`w-full px-4 text-center ${label.class}`}>{label.name}</h5>
|
|
60
|
+
{/if}
|
|
61
|
+
|
|
62
|
+
<div class="relative flex w-full grow items-center">
|
|
63
|
+
<button
|
|
64
|
+
id={id.value}
|
|
65
|
+
class={`
|
|
66
|
+
relative m-0 inline-block w-full items-center rounded-2xl border border-[var(--bg-color)] bg-[var(--bg-color)]
|
|
67
|
+
px-2 py-1 font-semibold shadow-sm transition duration-200 select-none
|
|
68
|
+
${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer hover:shadow-md active:scale-97'}
|
|
69
|
+
${componentClass}
|
|
70
|
+
`}
|
|
71
|
+
onclick={handleClick}
|
|
72
|
+
{disabled}
|
|
73
|
+
aria-label={name || label.name}
|
|
74
|
+
onmouseenter={() => {
|
|
75
|
+
if (info) showInfo = true
|
|
76
|
+
}}
|
|
77
|
+
onmouseleave={() => {
|
|
78
|
+
if (info) showInfo = false
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<span class="flex flex-row items-center justify-center gap-2">
|
|
82
|
+
{#if icon?.component}
|
|
83
|
+
{@const IconComponent = icon?.component}
|
|
84
|
+
<IconComponent {...icon?.properties} />
|
|
85
|
+
{/if}
|
|
86
|
+
{#if name}
|
|
87
|
+
<div class="flex-1">
|
|
88
|
+
{name}
|
|
89
|
+
{#if keyBind}
|
|
90
|
+
<div class="text-xs opacity-70">
|
|
91
|
+
({keyBind.ctrlKey ? 'Ctrl+' : ''}{keyBind.shiftKey ? 'Shift+' : ''}{keyBind.altKey ? 'Alt+' : ''}{keyBind.key})
|
|
92
|
+
</div>
|
|
93
|
+
{/if}
|
|
94
|
+
</div>
|
|
95
|
+
{/if}
|
|
96
|
+
</span>
|
|
97
|
+
</button>
|
|
98
|
+
|
|
99
|
+
{#if showInfo}
|
|
100
|
+
<div
|
|
101
|
+
transition:fly={{ y: -15, duration: 300 }}
|
|
102
|
+
class="absolute bottom-full left-1/2 z-50 mb-2 w-max max-w-xs rounded-md bg-[var(--conteiner-color)] px-3 py-1 text-sm shadow-lg"
|
|
103
|
+
style="transform: translateX(-50%);"
|
|
104
|
+
>
|
|
105
|
+
{info}
|
|
106
|
+
<!-- Треугольная стрелка -->
|
|
107
|
+
<div class="absolute top-full left-1/2 h-2 w-2 -translate-x-1/2 -translate-y-1/2 rotate-45 transform bg-[var(--conteiner-color)]"></div>
|
|
108
|
+
</div>
|
|
109
|
+
{/if}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
@@ -1,37 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Header?: string;
|
|
3
|
-
Argument?: string;
|
|
4
|
-
Value?: string;
|
|
5
|
-
Variables?: string[];
|
|
6
|
-
}
|
|
7
|
-
interface IButtonProps {
|
|
8
|
-
id?: {
|
|
9
|
-
value?: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
};
|
|
12
|
-
wrapperClass?: string;
|
|
13
|
-
label?: {
|
|
14
|
-
name?: string;
|
|
15
|
-
class?: string;
|
|
16
|
-
};
|
|
17
|
-
componentClass?: string;
|
|
18
|
-
name?: string;
|
|
19
|
-
icon?: {
|
|
20
|
-
component?: ConstructorOfATypedSvelteComponent | null;
|
|
21
|
-
properties?: Record<string, unknown>;
|
|
22
|
-
};
|
|
23
|
-
info?: string;
|
|
24
|
-
keyBind?: {
|
|
25
|
-
key?: string;
|
|
26
|
-
ctrlKey?: boolean;
|
|
27
|
-
shiftKey?: boolean;
|
|
28
|
-
altKey?: boolean;
|
|
29
|
-
metaKey?: boolean;
|
|
30
|
-
};
|
|
31
|
-
disabled?: boolean;
|
|
32
|
-
eventHandler?: IUIComponentHandler;
|
|
33
|
-
onClick?: () => void;
|
|
34
|
-
}
|
|
1
|
+
import type { IButtonProps } from '../types';
|
|
35
2
|
declare const Button: import("svelte").Component<IButtonProps, {}, "">;
|
|
36
3
|
type Button = ReturnType<typeof Button>;
|
|
37
4
|
export default Button;
|