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.
Files changed (61) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +1 -0
  3. package/dist/Accordion/Accordion.svelte +53 -53
  4. package/dist/Button/Button.svelte +111 -144
  5. package/dist/Button/Button.svelte.d.ts +1 -34
  6. package/dist/ColorPicker/ColorPicker.svelte +205 -207
  7. package/dist/FileAttach/FileAttach.svelte +103 -103
  8. package/dist/Graph/Graph.svelte +270 -270
  9. package/dist/Input/Input.svelte +240 -239
  10. package/dist/Loader.svelte +12 -12
  11. package/dist/MessageModal.svelte +54 -54
  12. package/dist/ProgressBar/ProgressBar.svelte +48 -48
  13. package/dist/Select/Select.svelte +189 -191
  14. package/dist/Slider/Slider.svelte +260 -260
  15. package/dist/Switch/Switch.svelte +84 -83
  16. package/dist/Table/Table.svelte +275 -276
  17. package/dist/TextField/TextField.svelte +22 -22
  18. package/dist/index.d.ts +0 -11
  19. package/dist/index.js +0 -11
  20. package/dist/{appIcons → libIcons}/ButtonAdd.svelte +10 -10
  21. package/dist/{appIcons → libIcons}/ButtonDelete.svelte +13 -13
  22. package/dist/{appIcons → libIcons}/LoaderRotate.svelte +9 -9
  23. package/dist/options.d.ts +11 -11
  24. package/dist/options.js +27 -27
  25. package/dist/types.d.ts +1 -1
  26. package/package.json +48 -47
  27. package/dist/Accordion/AccordionProps.svelte +0 -70
  28. package/dist/Accordion/AccordionProps.svelte.d.ts +0 -10
  29. package/dist/Button/ButtonProps.svelte +0 -200
  30. package/dist/Button/ButtonProps.svelte.d.ts +0 -10
  31. package/dist/ColorPicker/ColorPickerProps.svelte +0 -100
  32. package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +0 -10
  33. package/dist/Graph/GraphProps.svelte +0 -56
  34. package/dist/Graph/GraphProps.svelte.d.ts +0 -10
  35. package/dist/Input/InputProps.svelte +0 -221
  36. package/dist/Input/InputProps.svelte.d.ts +0 -10
  37. package/dist/ProgressBar/ProgressBarProps.svelte +0 -145
  38. package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +0 -10
  39. package/dist/Select/SelectProps.svelte +0 -260
  40. package/dist/Select/SelectProps.svelte.d.ts +0 -10
  41. package/dist/Slider/SliderProps.svelte +0 -161
  42. package/dist/Slider/SliderProps.svelte.d.ts +0 -10
  43. package/dist/Switch/SwitchProps.svelte +0 -144
  44. package/dist/Switch/SwitchProps.svelte.d.ts +0 -10
  45. package/dist/Table/TableProps.svelte +0 -286
  46. package/dist/Table/TableProps.svelte.d.ts +0 -10
  47. package/dist/TextField/TextFieldProps.svelte +0 -92
  48. package/dist/TextField/TextFieldProps.svelte.d.ts +0 -10
  49. package/dist/locales/CircleFlagsEn.svelte +0 -14
  50. package/dist/locales/CircleFlagsEn.svelte.d.ts +0 -26
  51. package/dist/locales/CircleFlagsRu.svelte +0 -8
  52. package/dist/locales/CircleFlagsRu.svelte.d.ts +0 -26
  53. package/dist/locales/CircleFlagsZh.svelte +0 -8
  54. package/dist/locales/CircleFlagsZh.svelte.d.ts +0 -26
  55. package/dist/locales/i18n.d.ts +0 -10
  56. package/dist/locales/i18n.js +0 -36
  57. package/dist/locales/translations.d.ts +0 -7
  58. package/dist/locales/translations.js +0 -450
  59. /package/dist/{appIcons → libIcons}/ButtonAdd.svelte.d.ts +0 -0
  60. /package/dist/{appIcons → libIcons}/ButtonDelete.svelte.d.ts +0 -0
  61. /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? Do you want to replace it? ┬╗ (y/N)тИЪ Do you want to replace it? ... no
3
- [?25hExiting...
1
+ Looks like there's already a license file for this project.
2
+ [?25l? Do you want to replace it? ┬╗ (y/N)тИЪ Do you want to replace it? ... 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
- // import { type IButtonProps } from '../types'
5
- import { fly } from 'svelte/transition'
6
-
7
- interface IUIComponentHandler {
8
- Header?: string
9
- Argument?: string
10
- Value?: string
11
- Variables?: string[]
12
- }
13
-
14
- interface IButtonProps {
15
- id?: { value?: string; name?: string }
16
- wrapperClass?: string
17
- label?: { name?: string; class?: string }
18
- componentClass?: string
19
- name?: string
20
- icon?: {
21
- component?: ConstructorOfATypedSvelteComponent | null
22
- properties?: Record<string, unknown>
23
- }
24
- info?: string
25
- keyBind?: {
26
- key?: string
27
- ctrlKey?: boolean
28
- shiftKey?: boolean
29
- altKey?: boolean
30
- metaKey?: boolean /* Поддержка Meta (Cmd на Mac) */
31
- }
32
- disabled?: boolean
33
- eventHandler?: IUIComponentHandler
34
- onClick?: () => void
35
- }
36
-
37
- let {
38
- id = { value: crypto.randomUUID(), name: '' },
39
- wrapperClass = 'bg-blue',
40
- label = { name: '', class: '' },
41
- name = '',
42
- componentClass = '',
43
- icon = { component: null, properties: {} },
44
- info = '',
45
- disabled = false,
46
- keyBind,
47
- onClick,
48
- }: IButtonProps = $props()
49
-
50
- let showInfo = $state(false)
51
-
52
- /* Обработчик клика */
53
- const handleClick = () => {
54
- if (disabled || !onClick) return
55
- onClick()
56
- }
57
-
58
- /* Обработчик горячих клавиш */
59
- const handleKeyDown = (event: KeyboardEvent) => {
60
- if (disabled || !keyBind || !onClick) return
61
-
62
- const isKeyMatch = event.key === keyBind.key
63
- const isCtrlMatch = keyBind.ctrlKey === undefined || event.ctrlKey === keyBind.ctrlKey
64
- const isShiftMatch = keyBind.shiftKey === undefined || event.shiftKey === keyBind.shiftKey
65
- const isAltMatch = keyBind.altKey === undefined || event.altKey === keyBind.altKey
66
- const isMetaMatch = keyBind.metaKey === undefined || event.metaKey === keyBind.metaKey
67
-
68
- if (isKeyMatch && isCtrlMatch && isShiftMatch && isAltMatch && isMetaMatch) {
69
- event.preventDefault()
70
- onClick()
71
- }
72
- }
73
-
74
- /* Подписка на события клавиатуры */
75
- onMount(() => {
76
- if (keyBind) {
77
- window.addEventListener('keydown', handleKeyDown)
78
- }
79
- return () => {
80
- if (keyBind) {
81
- window.removeEventListener('keydown', handleKeyDown)
82
- }
83
- }
84
- })
85
- </script>
86
-
87
- <div class={`relative flex w-full flex-col items-center ${wrapperClass}`}>
88
- {#if label.name}
89
- <h5 class={`w-full px-4 text-center ${label.class}`}>{label.name}</h5>
90
- {/if}
91
-
92
- <div class="relative flex w-full grow items-center">
93
- <button
94
- id={id.value}
95
- class={`
96
- relative m-0 inline-block w-full items-center rounded-2xl border border-[var(--bg-color)] bg-[var(--bg-color)]
97
- px-2 py-1 font-semibold transition duration-200 select-none
98
- ${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer hover:shadow-md active:scale-97'}
99
- ${componentClass}
100
- `}
101
- onclick={handleClick}
102
- {disabled}
103
- aria-label={name || label.name}
104
- onmouseenter={() => {
105
- if (info) showInfo = true
106
- }}
107
- onmouseleave={() => {
108
- if (info) showInfo = false
109
- }}
110
- >
111
- <span class="flex flex-row items-center justify-center gap-2">
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
- interface IUIComponentHandler {
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;