poe-svelte-ui-lib 1.0.2 → 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 (47) hide show
  1. package/README.md +1 -0
  2. package/dist/Button/Button.svelte +5 -38
  3. package/dist/Button/Button.svelte.d.ts +1 -34
  4. package/dist/ColorPicker/ColorPicker.svelte +1 -3
  5. package/dist/FileAttach/FileAttach.svelte +3 -3
  6. package/dist/Input/Input.svelte +21 -20
  7. package/dist/Select/Select.svelte +4 -6
  8. package/dist/Switch/Switch.svelte +3 -2
  9. package/dist/Table/Table.svelte +5 -6
  10. package/dist/index.d.ts +0 -11
  11. package/dist/index.js +0 -11
  12. package/dist/options.d.ts +11 -11
  13. package/dist/options.js +27 -27
  14. package/dist/types.d.ts +1 -1
  15. package/package.json +8 -9
  16. package/dist/Accordion/AccordionProps.svelte +0 -70
  17. package/dist/Accordion/AccordionProps.svelte.d.ts +0 -10
  18. package/dist/Button/ButtonProps.svelte +0 -200
  19. package/dist/Button/ButtonProps.svelte.d.ts +0 -10
  20. package/dist/ColorPicker/ColorPickerProps.svelte +0 -100
  21. package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +0 -10
  22. package/dist/Graph/GraphProps.svelte +0 -56
  23. package/dist/Graph/GraphProps.svelte.d.ts +0 -10
  24. package/dist/Input/InputProps.svelte +0 -221
  25. package/dist/Input/InputProps.svelte.d.ts +0 -10
  26. package/dist/ProgressBar/ProgressBarProps.svelte +0 -145
  27. package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +0 -10
  28. package/dist/Select/SelectProps.svelte +0 -260
  29. package/dist/Select/SelectProps.svelte.d.ts +0 -10
  30. package/dist/Slider/SliderProps.svelte +0 -161
  31. package/dist/Slider/SliderProps.svelte.d.ts +0 -10
  32. package/dist/Switch/SwitchProps.svelte +0 -144
  33. package/dist/Switch/SwitchProps.svelte.d.ts +0 -10
  34. package/dist/Table/TableProps.svelte +0 -286
  35. package/dist/Table/TableProps.svelte.d.ts +0 -10
  36. package/dist/TextField/TextFieldProps.svelte +0 -92
  37. package/dist/TextField/TextFieldProps.svelte.d.ts +0 -10
  38. package/dist/locales/CircleFlagsEn.svelte +0 -14
  39. package/dist/locales/CircleFlagsEn.svelte.d.ts +0 -26
  40. package/dist/locales/CircleFlagsRu.svelte +0 -8
  41. package/dist/locales/CircleFlagsRu.svelte.d.ts +0 -26
  42. package/dist/locales/CircleFlagsZh.svelte +0 -8
  43. package/dist/locales/CircleFlagsZh.svelte.d.ts +0 -26
  44. package/dist/locales/i18n.d.ts +0 -10
  45. package/dist/locales/i18n.js +0 -36
  46. package/dist/locales/translations.d.ts +0 -7
  47. package/dist/locales/translations.js +0 -450
@@ -1,92 +0,0 @@
1
- <!-- $lib/ElementsUI/GridAccordionProps.svelte -->
2
- <script lang="ts">
3
- import { t } from '../locales/i18n'
4
- import type { ITextFieldProps, UIComponent } from '../types'
5
- import * as UI from '../index'
6
- import { optionsStore } from '../options'
7
-
8
- const { component, onPropertyChange } = $props<{
9
- component: UIComponent & { properties: Partial<ITextFieldProps> }
10
- onPropertyChange: (value: string | object) => void
11
- }>()
12
-
13
- let currentType = $derived($optionsStore.TEXTFIELD_SIZE_OPTIONS.find((t) => t.value === component.properties.type))
14
-
15
- const initialAlign = $derived(
16
- $optionsStore.ALIGN_OPTIONS.find((a) =>
17
- (a.value as string).includes(component.properties.label?.class?.split(' ').find((cls: string) => cls.startsWith('text-'))),
18
- ),
19
- )
20
-
21
- const handleLabelAlign = (align: string) => {
22
- let labelClass = component.properties.label.class || ''
23
- labelClass = labelClass
24
- .split(' ')
25
- .filter((cls: string) => !cls.startsWith('text-'))
26
- .join(' ')
27
- if (align) {
28
- labelClass += ` ${align}`
29
- }
30
- updateProperty('label.class', labelClass)
31
- }
32
-
33
- /* Обновление свойства */
34
- const updateProperty = (path: string, value: string | object | boolean) => {
35
- const newProperties = JSON.parse(JSON.stringify(component.properties))
36
- const parts = path.split('.')
37
- let obj = newProperties
38
-
39
- for (let i = 0; i < parts.length - 1; i++) {
40
- const part = parts[i]
41
- if (!obj[part]) obj[part] = {}
42
- obj = obj[part]
43
- }
44
-
45
- obj[parts[parts.length - 1]] = value
46
- onPropertyChange(newProperties)
47
- }
48
- </script>
49
-
50
- {#if component && component.properties}
51
- <div class="relative flex flex-row items-start justify-center">
52
- <div class="flex w-1/3 flex-col px-2">
53
- <UI.Input
54
- label={{ name: $t('service.constructor.props.label') }}
55
- value={component.properties.label.name}
56
- onUpdate={(value) => updateProperty('label.name', value as string)}
57
- type="text"
58
- />
59
- <UI.Select
60
- label={{ name: $t('service.constructor.props.type') }}
61
- type="buttons"
62
- value={currentType}
63
- options={$optionsStore.TEXTFIELD_SIZE_OPTIONS}
64
- onUpdate={(item) => updateProperty('type', item.value as string)}
65
- />
66
- </div>
67
- <div class="flex w-1/3 flex-col px-2">
68
- <UI.Select
69
- wrapperClass="w-full"
70
- label={{ name: $t('service.constructor.props.align') }}
71
- type="buttons"
72
- value={initialAlign}
73
- options={$optionsStore.ALIGN_OPTIONS}
74
- onUpdate={(option) => handleLabelAlign(option.value as string)}
75
- />
76
- </div>
77
- <div class="flex w-1/3 flex-col px-2">
78
- <UI.Switch
79
- wrapperClass="w-full"
80
- label={{ name: $t('service.constructor.props.bold') }}
81
- value={component.properties.bold ? 2 : 1}
82
- onChange={(value) => updateProperty('bold', value === 2)}
83
- />
84
- <UI.Switch
85
- wrapperClass="w-full"
86
- label={{ name: $t('service.constructor.props.italic') }}
87
- value={component.properties.italic ? 2 : 1}
88
- onChange={(value) => updateProperty('italic', value === 2)}
89
- />
90
- </div>
91
- </div>
92
- {/if}
@@ -1,10 +0,0 @@
1
- import type { ITextFieldProps, UIComponent } from '../types';
2
- type $$ComponentProps = {
3
- component: UIComponent & {
4
- properties: Partial<ITextFieldProps>;
5
- };
6
- onPropertyChange: (value: string | object) => void;
7
- };
8
- declare const TextFieldProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
- type TextFieldProps = ReturnType<typeof TextFieldProps>;
10
- export default TextFieldProps;
@@ -1,14 +0,0 @@
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
- >
@@ -1,26 +0,0 @@
1
- export default CircleFlagsEn;
2
- type CircleFlagsEn = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string | undefined;
8
- };
9
- declare const CircleFlagsEn: $$__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
- }
@@ -1,8 +0,0 @@
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
- >
@@ -1,26 +0,0 @@
1
- export default CircleFlagsRu;
2
- type CircleFlagsRu = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string | undefined;
8
- };
9
- declare const CircleFlagsRu: $$__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
- }
@@ -1,8 +0,0 @@
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
- >
@@ -1,26 +0,0 @@
1
- export default CircleFlagsZh;
2
- type CircleFlagsZh = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string | undefined;
8
- };
9
- declare const CircleFlagsZh: $$__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
- }
@@ -1,10 +0,0 @@
1
- import { type Readable } from 'svelte/store';
2
- export declare const Language: import("svelte/store").Writable<string>;
3
- export declare function setLanguage(newLang: string): void;
4
- export declare const LOCALES: {
5
- id: string;
6
- name: string;
7
- value: string;
8
- component: import("svelte/legacy").LegacyComponentType;
9
- }[];
10
- export declare const t: Readable<(key: string) => string>;
@@ -1,36 +0,0 @@
1
- import { derived } from 'svelte/store';
2
- import { writable } from 'svelte/store';
3
- import translations from './translations';
4
- import CircleFlagsRu from './CircleFlagsRu.svelte';
5
- import CircleFlagsEn from './CircleFlagsEn.svelte';
6
- import CircleFlagsZh from './CircleFlagsZh.svelte';
7
- /* Язык по умолчанию */
8
- let initialLanguage = 'ru';
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';
15
- }
16
- }
17
- /* Создаем хранилище с начальным значением языка */
18
- export const Language = writable(initialLanguage);
19
- /* Функция для изменения языка */
20
- export function setLanguage(newLang) {
21
- if (typeof window !== 'undefined') {
22
- localStorage.setItem('AppLanguage', newLang);
23
- }
24
- Language.set(newLang);
25
- }
26
- /* Поддерживаемые языки (код, название языка, флаг) */
27
- export const LOCALES = [
28
- { id: 'app-language-ru', name: 'Русский', value: 'ru', component: CircleFlagsRu },
29
- { id: 'app-language-en', name: 'English', value: 'en', component: CircleFlagsEn },
30
- { id: 'app-language-zh', name: '中国人', value: 'zh', component: CircleFlagsZh },
31
- ];
32
- /* Функция для перевода для текущего языка */
33
- function translate(locale, key) {
34
- return translations[locale]?.[key] || key;
35
- }
36
- export const t = derived(Language, ($lang) => (key) => translate($lang, key));
@@ -1,7 +0,0 @@
1
- interface Translations {
2
- [language: string]: {
3
- [key: string]: string;
4
- };
5
- }
6
- declare const translations: Translations;
7
- export default translations;