poe-svelte-ui-lib 1.2.29 → 1.2.31

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/dist/Accordion/AccordionProps.svelte +4 -4
  2. package/dist/Accordion/AccordionProps.svelte.d.ts +7 -2
  3. package/dist/Button/Button.svelte +0 -1
  4. package/dist/Button/ButtonProps.svelte +18 -19
  5. package/dist/Button/ButtonProps.svelte.d.ts +7 -2
  6. package/dist/ColorPicker/ColorPickerProps.svelte +7 -8
  7. package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +7 -2
  8. package/dist/FileAttach/FileAttach.svelte +2 -13
  9. package/dist/FileAttach/FileAttach.svelte.d.ts +2 -20
  10. package/dist/FileAttach/FileAttachProps.svelte +72 -5
  11. package/dist/FileAttach/FileAttachProps.svelte.d.ts +8 -4
  12. package/dist/Graph/GraphProps.svelte +27 -48
  13. package/dist/Graph/GraphProps.svelte.d.ts +7 -2
  14. package/dist/Input/Input.svelte +21 -21
  15. package/dist/Input/InputProps.svelte +10 -16
  16. package/dist/Input/InputProps.svelte.d.ts +7 -2
  17. package/dist/Joystick/Joystick.svelte +100 -105
  18. package/dist/Joystick/JoystickProps.svelte +347 -0
  19. package/dist/Joystick/JoystickProps.svelte.d.ts +15 -25
  20. package/dist/Map/Map.svelte +1 -1
  21. package/dist/Map/MapProps.svelte +17 -8
  22. package/dist/Map/MapProps.svelte.d.ts +7 -2
  23. package/dist/ProgressBar/ProgressBar.svelte +31 -6
  24. package/dist/ProgressBar/ProgressBarProps.svelte +4 -4
  25. package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +7 -2
  26. package/dist/Select/Select.svelte +0 -1
  27. package/dist/Select/SelectProps.svelte +51 -12
  28. package/dist/Select/SelectProps.svelte.d.ts +7 -2
  29. package/dist/Slider/Slider.svelte +7 -8
  30. package/dist/Slider/SliderProps.svelte +8 -7
  31. package/dist/Slider/SliderProps.svelte.d.ts +7 -2
  32. package/dist/Switch/Switch.svelte +1 -1
  33. package/dist/Switch/SwitchProps.svelte +49 -40
  34. package/dist/Switch/SwitchProps.svelte.d.ts +7 -2
  35. package/dist/Table/Table.svelte +7 -2
  36. package/dist/Table/TableProps.svelte +32 -12
  37. package/dist/Table/TableProps.svelte.d.ts +7 -2
  38. package/dist/Tabs/TabsProps.svelte +10 -11
  39. package/dist/Tabs/TabsProps.svelte.d.ts +7 -2
  40. package/dist/TextField/TextFieldProps.svelte +3 -5
  41. package/dist/TextField/TextFieldProps.svelte.d.ts +7 -2
  42. package/dist/index.d.ts +1 -0
  43. package/dist/index.js +1 -0
  44. package/dist/locales/translations.js +3 -0
  45. package/dist/types.d.ts +46 -11
  46. package/dist/types.js +10 -1
  47. package/package.json +2 -2
@@ -1,9 +1,14 @@
1
- import { type UIComponent, type ITableProps } from '../types';
1
+ import { type UIComponent, type ITableProps, type IUIComponentHandler } from '../types';
2
2
  type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ITableProps<object>>;
5
5
  };
6
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
6
+ onPropertyChange: (updates: Partial<{
7
+ properties?: string | object;
8
+ name?: string;
9
+ access?: string;
10
+ eventHandler?: IUIComponentHandler;
11
+ }>) => void;
7
12
  forConstructor?: boolean;
8
13
  };
9
14
  declare const TableProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { t } from '../locales/i18n'
3
- import { updateProperty, type ISelectOption, type ITabsProps, type UIComponent } from '../types'
3
+ import { updateProperty, type ISelectOption, type ITabsProps, type IUIComponentHandler, type UIComponent } from '../types'
4
4
  import * as UI from '..'
5
5
  import { optionsStore } from '../options'
6
6
  import { ICONS } from '../icons'
@@ -17,7 +17,7 @@
17
17
  forConstructor = true,
18
18
  } = $props<{
19
19
  component: UIComponent & { properties: Partial<ITabsProps> }
20
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void
20
+ onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
21
21
  forConstructor?: boolean
22
22
  }>()
23
23
 
@@ -62,13 +62,12 @@
62
62
  <div class="flex items-center justify-center gap-8">
63
63
  <div class="flex w-1/3 flex-col items-center px-2">
64
64
  <UI.Select
65
- label={{ name: $t('constructor.props.align') }}
65
+ label={{ name: $t('constructor.props.access') }}
66
66
  type="buttons"
67
- value={initialAlign}
68
- options={$optionsStore.JUSTIFY_ALIGN_OPTIONS}
69
- onUpdate={(option) => updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)}
67
+ options={$optionsStore.ACCESS_OPTION}
68
+ value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
69
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
70
70
  />
71
-
72
71
  <UI.Select
73
72
  wrapperClass="h-14"
74
73
  label={{ name: $t('constructor.props.colors') }}
@@ -245,11 +244,11 @@
245
244
  </div>
246
245
  <div class="flex w-1/3 flex-col items-center px-2">
247
246
  <UI.Select
248
- label={{ name: $t('constructor.props.align') }}
247
+ label={{ name: $t('constructor.props.access') }}
249
248
  type="buttons"
250
- value={initialAlign}
251
- options={$optionsStore.JUSTIFY_ALIGN_OPTIONS}
252
- onUpdate={(option) => updateProperty('wrapperClass', twMerge(component.properties.wrapperClass, option.value), component, onPropertyChange)}
249
+ options={$optionsStore.ACCESS_OPTION}
250
+ value={$optionsStore.ACCESS_OPTION.find((o) => o.value === component.access)}
251
+ onUpdate={(option) => onPropertyChange({ access: option.value })}
253
252
  />
254
253
 
255
254
  <UI.Select
@@ -1,9 +1,14 @@
1
- import { type ITabsProps, type UIComponent } from '../types';
1
+ import { type ITabsProps, type IUIComponentHandler, type UIComponent } from '../types';
2
2
  type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ITabsProps>;
5
5
  };
6
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
6
+ onPropertyChange: (updates: Partial<{
7
+ properties?: string | object;
8
+ name?: string;
9
+ access?: string;
10
+ eventHandler?: IUIComponentHandler;
11
+ }>) => void;
7
12
  forConstructor?: boolean;
8
13
  };
9
14
  declare const TabsProps: import("svelte").Component<$$ComponentProps, {}, "">;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { t } from '../locales/i18n'
3
- import { updateProperty, type ITextFieldProps, type UIComponent } from '../types'
3
+ import { updateProperty, type ITextFieldProps, type IUIComponentHandler, type UIComponent } from '../types'
4
4
  import * as UI from '../index'
5
5
  import { optionsStore } from '../options'
6
6
  import { getContext } from 'svelte'
@@ -12,7 +12,7 @@
12
12
  forConstructor = true,
13
13
  } = $props<{
14
14
  component: UIComponent & { properties: Partial<ITextFieldProps> }
15
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void
15
+ onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
16
16
  forConstructor?: boolean
17
17
  }>()
18
18
  const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
@@ -43,8 +43,7 @@
43
43
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
44
44
  onUpdate={(value) => {
45
45
  updateProperty('id', value.value as string, component, onPropertyChange)
46
- updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
47
- onPropertyChange(null, value.name?.split('—')[1].trim(), null)
46
+ onPropertyChange({ name: value.name?.split('—')[1].trim(), eventHandler: { Variables: value.value as string } })
48
47
  }}
49
48
  />
50
49
  <UI.Input
@@ -78,7 +77,6 @@
78
77
  />
79
78
  </div>
80
79
  <div class="flex w-1/3 flex-col px-2">
81
- <!-- <p>{component.properties.content?.class?.split(' ').includes((cls: string) => cls.startsWith('font-bold'))}</p> -->
82
80
  <UI.Switch
83
81
  label={{ name: $t('constructor.props.bold') }}
84
82
  value={initialBold}
@@ -1,9 +1,14 @@
1
- import { type ITextFieldProps, type UIComponent } from '../types';
1
+ import { type ITextFieldProps, type IUIComponentHandler, type UIComponent } from '../types';
2
2
  type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ITextFieldProps>;
5
5
  };
6
- onPropertyChange: (value?: string | object, name?: string, access?: string) => void;
6
+ onPropertyChange: (updates: Partial<{
7
+ properties?: string | object;
8
+ name?: string;
9
+ access?: string;
10
+ eventHandler?: IUIComponentHandler;
11
+ }>) => void;
7
12
  forConstructor?: boolean;
8
13
  };
9
14
  declare const TextFieldProps: import("svelte").Component<$$ComponentProps, {}, "">;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { default as ButtonProps } from './Button/ButtonProps.svelte';
5
5
  export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
6
6
  export { default as ColorPickerProps } from './ColorPicker/ColorPickerProps.svelte';
7
7
  export { default as FileAttach } from './FileAttach/FileAttach.svelte';
8
+ export { default as FileAttachProps } from './FileAttach/FileAttachProps.svelte';
8
9
  export { default as Graph } from './Graph/Graph.svelte';
9
10
  export { default as GraphProps } from './Graph/GraphProps.svelte';
10
11
  export { default as Input } from './Input/Input.svelte';
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export { default as ButtonProps } from './Button/ButtonProps.svelte';
6
6
  export { default as ColorPicker } from './ColorPicker/ColorPicker.svelte';
7
7
  export { default as ColorPickerProps } from './ColorPicker/ColorPickerProps.svelte';
8
8
  export { default as FileAttach } from './FileAttach/FileAttach.svelte';
9
+ export { default as FileAttachProps } from './FileAttach/FileAttachProps.svelte';
9
10
  export { default as Graph } from './Graph/Graph.svelte';
10
11
  export { default as GraphProps } from './Graph/GraphProps.svelte';
11
12
  export { default as Input } from './Input/Input.svelte';
@@ -73,6 +73,7 @@ const translations = {
73
73
  'constructor.props.image': 'Фоновое изображение',
74
74
  'constructor.props.labelicon': 'Иконка заголовка',
75
75
  'constructor.props.markerIcon': 'Иконка маркера',
76
+ 'constructor.props.buttonIcon': 'Иконка кнопки',
76
77
  'constructor.props.removeimage': 'Удалить изображение',
77
78
  'constructor.props.name': 'Текст',
78
79
  'constructor.props.height': 'Высота',
@@ -127,6 +128,8 @@ const translations = {
127
128
  'constructor.props.bitmode': 'Битовый режим',
128
129
  'constructor.props.access': 'Доступ (не для владельца)',
129
130
  'constructor.props.map.timeout': 'Таймаут маркеров:',
131
+ 'constructor.props.joystick.axes': 'Названия осей',
132
+ 'constructor.props.joystick.axes.info': 'Поле для ввода названий осей, разделенных пробелами (2 или 3 названия)',
130
133
  'constructor.props.table.columns': 'Колонки таблицы',
131
134
  'constructor.props.table.columns.key': 'Ключ',
132
135
  'constructor.props.table.columns.label': 'Название колонки',
package/dist/types.d.ts CHANGED
@@ -1,17 +1,37 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { Writable } from 'svelte/store';
3
- import type { IFileInputProps } from './FileAttach/FileAttach.svelte';
4
3
  export declare const updateProperty: (path: string, value: string | number | boolean | object | string[], component: UIComponent & {
5
4
  properties: Partial<UIComponent["properties"]>;
6
- }, onPropertyChange: (value?: string | object, name?: string, access?: string) => void) => void;
5
+ }, onPropertyChange: (updates: Partial<{
6
+ properties?: string | object;
7
+ name?: string;
8
+ access?: string;
9
+ eventHandler?: IUIComponentHandler;
10
+ }>) => void) => void;
11
+ export declare const updateComponent: (component: UIComponent, updates: Partial<{
12
+ name: string;
13
+ access: "full" | "viewOnly" | "hidden";
14
+ properties: Partial<UIComponent["properties"]>;
15
+ eventHandler: IUIComponentHandler;
16
+ }>) => {
17
+ access: "full" | "viewOnly" | "hidden" | undefined;
18
+ name: string | undefined;
19
+ properties: IAccordionProps | IButtonProps | IInputProps | ISelectProps<unknown> | ISwitchProps | IColorPickerProps | ISliderProps | ITextFieldProps | IProgressBarProps | IGraphProps | ITableProps<object> | ITabsProps | IFileAttachProps | IJoystickProps | IMapProps;
20
+ eventHandler: IUIComponentHandler | undefined;
21
+ id: string;
22
+ type: "Button" | "Accordion" | "Input" | "Select" | "Switch" | "ColorPicker" | "Slider" | "TextField" | "Joystick" | "ProgressBar" | "Graph" | "Table" | "Tabs" | "FileAttach" | "Map";
23
+ position: Position;
24
+ parentId: string;
25
+ };
7
26
  export interface UIComponent {
8
27
  id: string;
9
28
  name?: string;
10
29
  access?: 'full' | 'viewOnly' | 'hidden';
11
30
  type: 'Button' | 'Accordion' | 'Input' | 'Select' | 'Switch' | 'ColorPicker' | 'Slider' | 'TextField' | 'Joystick' | 'ProgressBar' | 'Graph' | 'Table' | 'Tabs' | 'FileAttach' | 'Map';
12
- properties: IAccordionProps | IButtonProps | IInputProps | ISelectProps | ISwitchProps | IColorPickerProps | ISliderProps | ITextFieldProps | IProgressBarProps | IGraphProps | ITableProps<object> | ITabsProps | IFileInputProps | IJoystickProps | IMapProps;
31
+ properties: IAccordionProps | IButtonProps | IInputProps | ISelectProps | ISwitchProps | IColorPickerProps | ISliderProps | ITextFieldProps | IProgressBarProps | IGraphProps | ITableProps<object> | ITabsProps | IFileAttachProps | IJoystickProps | IMapProps;
13
32
  position: Position;
14
33
  parentId: string;
34
+ eventHandler?: IUIComponentHandler;
15
35
  }
16
36
  export interface Position {
17
37
  row: number;
@@ -45,7 +65,6 @@ export interface IButtonProps {
45
65
  altKey?: boolean;
46
66
  metaKey?: boolean;
47
67
  };
48
- eventHandler?: IUIComponentHandler;
49
68
  onClick?: () => void;
50
69
  }
51
70
  export interface IAccordionProps {
@@ -92,7 +111,6 @@ export interface IInputProps {
92
111
  regExp?: string | RegExp;
93
112
  autocomplete?: 'on' | 'off' | 'given-name' | 'family-name' | 'nickname' | 'username' | 'new-password' | 'current-password' | 'organization-title' | 'country-name' | 'address-level1' | 'address-level2' | 'street-address' | 'postal-code' | 'email' | 'tel' | null;
94
113
  };
95
- eventHandler?: IUIComponentHandler;
96
114
  onUpdate?: (value: string | number) => void;
97
115
  }
98
116
  export interface ISelectProps<T = unknown> {
@@ -112,7 +130,6 @@ export interface ISelectProps<T = unknown> {
112
130
  start: number;
113
131
  end: number;
114
132
  };
115
- eventHandler?: IUIComponentHandler;
116
133
  onUpdate?: (value: ISelectOption<T>) => void;
117
134
  }
118
135
  export interface ISelectOption<T = unknown> {
@@ -137,7 +154,6 @@ export interface ISwitchProps {
137
154
  bitMode?: boolean;
138
155
  type?: 'horizontal' | 'vertical' | 'checkbox';
139
156
  value?: number;
140
- eventHandler?: IUIComponentHandler;
141
157
  onChange?: (value: number) => void;
142
158
  }
143
159
  export interface IColorPickerProps {
@@ -148,7 +164,6 @@ export interface IColorPickerProps {
148
164
  class?: string;
149
165
  };
150
166
  value?: number[];
151
- eventHandler?: IUIComponentHandler;
152
167
  onChange?: (value: number[]) => void;
153
168
  }
154
169
  export interface ISliderProps {
@@ -166,7 +181,6 @@ export interface ISliderProps {
166
181
  step: number;
167
182
  };
168
183
  disabled?: boolean;
169
- eventHandler?: IUIComponentHandler;
170
184
  onUpdate?: (value: number | [number, number]) => void;
171
185
  }
172
186
  export interface ITextFieldProps {
@@ -191,6 +205,7 @@ export interface IProgressBarProps {
191
205
  maxNum?: number;
192
206
  units?: string;
193
207
  };
208
+ type?: 'horizontal' | 'vertical';
194
209
  wrapperClass?: string;
195
210
  }
196
211
  export interface IGraphDataObject {
@@ -232,7 +247,6 @@ export interface ITableHeader<T extends object> {
232
247
  buttons?: {
233
248
  name: string | ((row: T) => string);
234
249
  class?: string | ((row: T) => string);
235
- eventHandler?: IUIComponentHandler;
236
250
  onClick?: (row: T) => void;
237
251
  }[];
238
252
  image?: {
@@ -292,10 +306,12 @@ export interface IJoystickProps {
292
306
  class?: string;
293
307
  };
294
308
  value?: number[];
295
- limits?: {
309
+ axes?: {
310
+ name: string;
296
311
  minNum: number;
297
312
  maxNum: number;
298
313
  }[];
314
+ buttonIcon?: string;
299
315
  onUpdate?: (value: number[]) => void;
300
316
  }
301
317
  export interface IDeviceGNSS {
@@ -316,3 +332,22 @@ export interface IMapProps {
316
332
  data: IDeviceGNSS | null;
317
333
  markerIcon?: string;
318
334
  }
335
+ export interface IFileAttachProps {
336
+ id?: string;
337
+ wrapperClass?: string;
338
+ label?: {
339
+ name?: string;
340
+ class?: string;
341
+ };
342
+ type?: 'file' | 'image';
343
+ accept?: string;
344
+ imageSize?: {
345
+ height?: string;
346
+ width?: string;
347
+ fitMode?: 'cover' | 'contain';
348
+ form?: 'square' | 'circle';
349
+ };
350
+ disabled?: boolean;
351
+ currentImage?: string | null;
352
+ onChange?: (event: Event, file: File | null) => void;
353
+ }
package/dist/types.js CHANGED
@@ -9,5 +9,14 @@ export const updateProperty = (path, value, component, onPropertyChange) => {
9
9
  obj = obj[part];
10
10
  }
11
11
  obj[parts[parts.length - 1]] = value;
12
- onPropertyChange(newProperties);
12
+ onPropertyChange({ properties: newProperties });
13
+ };
14
+ export const updateComponent = (component, updates) => {
15
+ return {
16
+ ...component,
17
+ access: updates.access ?? component.access,
18
+ name: updates.name ?? component.name,
19
+ properties: updates.properties ? { ...component.properties, ...updates.properties } : component.properties,
20
+ eventHandler: updates.eventHandler ? { ...component.eventHandler, ...updates.eventHandler } : component.eventHandler,
21
+ };
13
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.2.29",
3
+ "version": "1.2.31",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -49,7 +49,7 @@
49
49
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
50
50
  "@types/node": "^24.10.1",
51
51
  "publint": "^0.3.15",
52
- "svelte": "^5.43.14",
52
+ "svelte": "^5.44.0",
53
53
  "svelte-preprocess": "^6.0.3",
54
54
  "vite": "^7.2.4",
55
55
  "vite-plugin-compression": "^0.5.1"