poe-svelte-ui-lib 1.1.7 → 1.1.10

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 (34) hide show
  1. package/dist/Accordion/Accordion.svelte +10 -9
  2. package/dist/Accordion/AccordionProps.svelte +141 -20
  3. package/dist/Accordion/AccordionProps.svelte.d.ts +1 -0
  4. package/dist/Button/Button.svelte +3 -1
  5. package/dist/Button/ButtonProps.svelte +73 -2
  6. package/dist/Button/ButtonProps.svelte.d.ts +1 -0
  7. package/dist/ColorPicker/ColorPickerProps.svelte +49 -4
  8. package/dist/ColorPicker/ColorPickerProps.svelte.d.ts +2 -1
  9. package/dist/ComponentExample.svelte +32 -0
  10. package/dist/ComponentExample.svelte.d.ts +9 -0
  11. package/dist/Graph/GraphProps.svelte +10 -13
  12. package/dist/Graph/GraphProps.svelte.d.ts +1 -0
  13. package/dist/Input/Input.svelte +1 -2
  14. package/dist/Input/InputProps.svelte +13 -19
  15. package/dist/Input/InputProps.svelte.d.ts +1 -0
  16. package/dist/ProgressBar/ProgressBarProps.svelte +10 -13
  17. package/dist/ProgressBar/ProgressBarProps.svelte.d.ts +1 -0
  18. package/dist/Select/Select.svelte +2 -3
  19. package/dist/Select/SelectProps.svelte +15 -21
  20. package/dist/Select/SelectProps.svelte.d.ts +2 -1
  21. package/dist/Slider/SliderProps.svelte +9 -13
  22. package/dist/Slider/SliderProps.svelte.d.ts +1 -0
  23. package/dist/Switch/SwitchProps.svelte +9 -13
  24. package/dist/Switch/SwitchProps.svelte.d.ts +1 -0
  25. package/dist/Table/Table.svelte +2 -2
  26. package/dist/Table/TableProps.svelte +17 -23
  27. package/dist/Table/TableProps.svelte.d.ts +1 -0
  28. package/dist/TextField/TextFieldProps.svelte +9 -13
  29. package/dist/TextField/TextFieldProps.svelte.d.ts +1 -0
  30. package/dist/libIcons/CopyButton.svelte +10 -0
  31. package/dist/libIcons/CopyButton.svelte.d.ts +18 -0
  32. package/dist/locales/translations.js +18 -0
  33. package/dist/types.d.ts +1 -1
  34. package/package.json +4 -4
@@ -11,7 +11,7 @@
11
11
  size = { width: 1, height: 1 },
12
12
  label = { name: '', class: 'text-left', icon: null },
13
13
  children,
14
- image,
14
+ image = '',
15
15
  }: IAccordionProps = $props()
16
16
 
17
17
  const toggle = () => (isOpen = !isOpen)
@@ -20,8 +20,8 @@
20
20
  <div
21
21
  {id}
22
22
  class={twMerge(
23
- `${outline ? 'border-none' : 'rounded-xl hover:shadow-md'} w-full
24
- border border-[var(--border-color)] bg-[var(--container-color)] p-0 transition-shadow duration-250`,
23
+ `w-full border border-[var(--border-color)] bg-[var(--container-color)] p-0 transition-shadow duration-250
24
+ ${outline ? 'border-[var(--bg-color)]' : 'rounded-xl hover:shadow-md'}`,
25
25
  wrapperClass,
26
26
  )}
27
27
  transition:slide={{ duration: 250 }}
@@ -32,13 +32,14 @@
32
32
  onclick={toggle}
33
33
  >
34
34
  <div class="flex w-full items-center">
35
- {#if label?.icon}
36
- <span
37
- class={`flex h-7 w-7 shrink-0 items-center justify-center overflow-visible [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full`}
38
- >
35
+ <span
36
+ class={`flex h-7 w-7 shrink-0 items-center justify-center overflow-visible [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full`}
37
+ >
38
+ {#if label?.icon}
39
39
  {@html label.icon}
40
- </span>
41
- {/if}
40
+ {/if}
41
+ </span>
42
+
42
43
  <span class="{twMerge('m-0 w-full cursor-pointer px-3 text-left font-semibold', label.class)} text-lg">
43
44
  {label?.name}
44
45
  </span>
@@ -9,9 +9,14 @@
9
9
  import Button from '../Button/Button.svelte'
10
10
  import CrossIcon from '../libIcons/CrossIcon.svelte'
11
11
 
12
- const { component, onPropertyChange } = $props<{
12
+ const {
13
+ component,
14
+ onPropertyChange,
15
+ forConstructor = true,
16
+ } = $props<{
13
17
  component: UIComponent & { properties: Partial<IAccordionProps> }
14
18
  onPropertyChange: (value: string | object) => void
19
+ forConstructor?: boolean
15
20
  }>()
16
21
 
17
22
  let showIconLib = $state(false)
@@ -37,17 +42,16 @@
37
42
  reader.readAsDataURL(file)
38
43
  }
39
44
 
40
- let currentImage = $derived(component.properties.image)
45
+ let currentImage = $derived(component.properties.image ?? '')
41
46
  </script>
42
47
 
43
- {#if component && component.properties}
48
+ {#if forConstructor}
44
49
  <div class="flex items-center justify-center gap-8">
45
50
  <div class="flex w-1/3 flex-col items-center px-2">
46
51
  <UI.Input
47
52
  label={{ name: $t('constructor.props.label') }}
48
53
  value={component.properties.label.name}
49
54
  onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
50
- type="text"
51
55
  />
52
56
  <UI.Select
53
57
  label={{ name: $t('constructor.props.align') }}
@@ -57,7 +61,80 @@
57
61
  onUpdate={(option) => updateProperty('label.class', option.value as string, component, onPropertyChange)}
58
62
  />
59
63
  </div>
60
- <div class="flex w-1/3 flex-col items-center gap-6 px-2">
64
+ <div class="flex w-1/3 flex-col items-center px-2">
65
+ <div class="relative mt-6 flex w-full gap-2">
66
+ <UI.Button content={{ name: 'Иконка заголовка' }} onClick={() => (showIconLib = true)} />
67
+ {#if showIconLib}
68
+ <Modal bind:isOpen={showIconLib} wrapperClass="w-130">
69
+ {#snippet main()}
70
+ <div class="grid grid-cols-3">
71
+ {#each ICONS as category}
72
+ <div class="relative m-1.5 rounded-xl border-2 border-[var(--border-color)] p-3">
73
+ <div class="absolute -top-3.5 bg-[var(--back-color)] px-1">{$t(`constructor.props.icon.${category[0]}`)}</div>
74
+ <div class="grid grid-cols-3 place-items-center gap-2">
75
+ {#each category[1] as icon}
76
+ <button
77
+ class="h-8 w-8 cursor-pointer [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full"
78
+ onclick={() => {
79
+ updateProperty('label.icon', icon as string, component, onPropertyChange)
80
+ }}
81
+ >
82
+ {@html icon}
83
+ </button>{/each}
84
+ </div>
85
+ </div>
86
+ {/each}
87
+ </div>
88
+ {/snippet}
89
+ </Modal>
90
+ {/if}
91
+ {#if component.properties.label.icon}
92
+ <Button
93
+ wrapperClass="w-8.5 "
94
+ componentClass="p-0.5 bg-red"
95
+ content={{ icon: CrossIcon }}
96
+ onClick={() => {
97
+ updateProperty('label.icon', '', component, onPropertyChange)
98
+ }}
99
+ />
100
+ {/if}
101
+ </div>
102
+ <UI.Select
103
+ label={{ name: $t('constructor.props.type') }}
104
+ type="buttons"
105
+ value={initialType}
106
+ options={$optionsStore.ACCORDION_TYPE_OPTIONS}
107
+ onUpdate={(item) => updateProperty('outline', item.value as boolean, component, onPropertyChange)}
108
+ />
109
+ </div>
110
+ <div class="flex w-1/3 flex-col items-center gap-2 px-2">
111
+ <div class="flex">
112
+ <UI.FileAttach
113
+ type="image"
114
+ label={{ name: $t('constructor.props.image') }}
115
+ accept="image/png, image/jpeg, image/webp"
116
+ bind:currentImage
117
+ onChange={handleImageUpload}
118
+ />
119
+ <Button
120
+ wrapperClass="w-8.5 mt-6"
121
+ componentClass="p-0.5 bg-red"
122
+ content={{ icon: CrossIcon }}
123
+ onClick={() => {
124
+ updateProperty('image', '', component, onPropertyChange)
125
+ }}
126
+ />
127
+ </div>
128
+ </div>
129
+ </div>
130
+ {:else}
131
+ <div class="flex items-center justify-center gap-8">
132
+ <div class="flex w-1/3 flex-col items-center px-2">
133
+ <UI.Input
134
+ label={{ name: $t('constructor.props.id') }}
135
+ value={component.properties.id}
136
+ onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
137
+ />
61
138
  <UI.Select
62
139
  label={{ name: $t('constructor.props.type') }}
63
140
  type="buttons"
@@ -65,15 +142,39 @@
65
142
  options={$optionsStore.ACCORDION_TYPE_OPTIONS}
66
143
  onUpdate={(item) => updateProperty('outline', item.value as boolean, component, onPropertyChange)}
67
144
  />
68
- <div class="relative flex w-full gap-2">
145
+ <div class="flex w-full gap-4">
146
+ <UI.Input
147
+ label={{ name: $t('constructor.props.size.height') }}
148
+ value={component.properties.size.height}
149
+ onUpdate={(value) => updateProperty('size.height', value as number, component, onPropertyChange)}
150
+ number={{ minNum: 1, maxNum: 1000, step: 1 }}
151
+ type="number"
152
+ />
153
+ <UI.Input
154
+ label={{ name: $t('constructor.props.size.width') }}
155
+ value={component.properties.size.width}
156
+ onUpdate={(value) => updateProperty('size.width', value as number, component, onPropertyChange)}
157
+ number={{ minNum: 1, maxNum: 1000, step: 1 }}
158
+ type="number"
159
+ />
160
+ </div>
161
+
162
+ <UI.Switch
163
+ label={{ name: $t('constructor.props.open') }}
164
+ value={component.properties.isOpen ? 2 : 1}
165
+ onChange={(value) => updateProperty('isOpen', value === 2, component, onPropertyChange)}
166
+ />
167
+ </div>
168
+ <div class="flex w-1/3 flex-col items-center px-2">
169
+ <div class="relative mt-5 flex w-full gap-2">
69
170
  <UI.Button content={{ name: 'Иконка заголовка' }} onClick={() => (showIconLib = true)} />
70
171
  {#if showIconLib}
71
- <Modal bind:isOpen={showIconLib} wrapperClass="w-150">
172
+ <Modal bind:isOpen={showIconLib} wrapperClass="w-130">
72
173
  {#snippet main()}
73
174
  <div class="grid grid-cols-3">
74
175
  {#each ICONS as category}
75
176
  <div class="relative m-1.5 rounded-xl border-2 border-[var(--border-color)] p-3">
76
- <div class="absolute -top-3.5 bg-[var(--back-color)] px-1">{category[0]}</div>
177
+ <div class="absolute -top-3.5 bg-[var(--back-color)] px-1">{$t(`constructor.props.icon.${category[0]}`)}</div>
77
178
  <div class="grid grid-cols-3 place-items-center gap-2">
78
179
  {#each category[1] as icon}
79
180
  <button
@@ -102,20 +203,40 @@
102
203
  />
103
204
  {/if}
104
205
  </div>
105
- </div>
106
- <div class="flex w-1/3 flex-col items-center gap-2 px-2">
107
- <UI.FileAttach
108
- type="image"
109
- label={{ name: $t('constructor.props.image') }}
110
- accept="image/png, image/jpeg, image/webp"
111
- bind:currentImage
112
- onChange={handleImageUpload}
206
+ <UI.Input
207
+ label={{ name: $t('constructor.props.wrapperclass') }}
208
+ value={component.properties.wrapperClass}
209
+ onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
113
210
  />
114
- <UI.Button
115
- content={{ name: $t('constructor.props.removeimage') }}
116
- wrapperClass="!w-auto"
117
- onClick={() => updateProperty('image', '', component, onPropertyChange)}
211
+ <UI.Input
212
+ label={{ name: $t('constructor.props.label') }}
213
+ value={component.properties.label.name}
214
+ onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
215
+ />
216
+ <UI.Input
217
+ label={{ name: $t('constructor.props.label.class') }}
218
+ value={component.properties.label.class}
219
+ onUpdate={(value) => updateProperty('label.class', value as string, component, onPropertyChange)}
118
220
  />
119
221
  </div>
222
+ <div class="flex w-1/3 flex-col items-center gap-2 px-2">
223
+ <div class="flex">
224
+ <UI.FileAttach
225
+ type="image"
226
+ label={{ name: $t('constructor.props.image') }}
227
+ accept="image/png, image/jpeg, image/webp"
228
+ bind:currentImage
229
+ onChange={handleImageUpload}
230
+ />
231
+ <Button
232
+ wrapperClass="w-8.5 mt-6"
233
+ componentClass="p-0.5 bg-red"
234
+ content={{ icon: CrossIcon }}
235
+ onClick={() => {
236
+ updateProperty('image', '', component, onPropertyChange)
237
+ }}
238
+ />
239
+ </div>
240
+ </div>
120
241
  </div>
121
242
  {/if}
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  properties: Partial<IAccordionProps>;
5
5
  };
6
6
  onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const AccordionProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type AccordionProps = ReturnType<typeof AccordionProps>;
@@ -91,7 +91,9 @@
91
91
  class={`flex items-center justify-center overflow-visible
92
92
  ${content.name ? 'h-8 w-8' : `${svgSize()}`} [&_svg]:h-full [&_svg]:max-h-full [&_svg]:w-full [&_svg]:max-w-full`}
93
93
  >
94
- {#if content?.icon}
94
+ {#if typeof content?.icon === 'string'}
95
+ {@html content.icon}
96
+ {:else}
95
97
  {@const IconComponent = content?.icon}
96
98
  <IconComponent />
97
99
  {/if}
@@ -6,9 +6,14 @@
6
6
  import { optionsStore } from '../options'
7
7
  import { twMerge } from 'tailwind-merge'
8
8
 
9
- const { component, onPropertyChange } = $props<{
9
+ const {
10
+ component,
11
+ onPropertyChange,
12
+ forConstructor = true,
13
+ } = $props<{
10
14
  component: UIComponent & { properties: Partial<IButtonProps> }
11
15
  onPropertyChange: (value: string | object) => void
16
+ forConstructor?: boolean
12
17
  }>()
13
18
 
14
19
  let hasValue: boolean = $derived(component.properties.eventHandler.Value)
@@ -35,7 +40,7 @@
35
40
  )
36
41
  </script>
37
42
 
38
- {#if component && component.properties}
43
+ {#if forConstructor}
39
44
  <div class="relative flex flex-row items-start justify-center">
40
45
  <!-- Сообщение для отправки в ws по нажатию кнопки -->
41
46
  <div class="flex w-1/3 flex-col items-center px-2">
@@ -116,4 +121,70 @@
116
121
  />
117
122
  </div>
118
123
  </div>
124
+ {:else}
125
+ <div class="relative flex flex-row items-start justify-center">
126
+ <!-- Сообщение для отправки в ws по нажатию кнопки -->
127
+ <div class="flex w-1/3 flex-col items-center px-2">
128
+ <UI.Input
129
+ label={{ name: $t('constructor.props.id') }}
130
+ value={component.properties.id}
131
+ onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
132
+ />
133
+ <UI.Input
134
+ label={{ name: $t('constructor.props.wrapperclass') }}
135
+ value={component.properties.wrapperClass}
136
+ onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
137
+ />
138
+
139
+ <UI.Switch
140
+ wrapperClass="bg-blue"
141
+ label={{ name: $t('constructor.props.disabled') }}
142
+ value={component.properties.disabled ? 2 : 1}
143
+ onChange={(value) => updateProperty('disabled', value === 2, component, onPropertyChange)}
144
+ />
145
+ </div>
146
+ <div class="flex w-1/3 flex-col px-2">
147
+ <UI.Input
148
+ label={{ name: $t('constructor.props.name') }}
149
+ value={component.properties.content.name}
150
+ onUpdate={(value) => updateProperty('content.name', value as string, component, onPropertyChange)}
151
+ />
152
+ <UI.Input
153
+ label={{ name: $t('constructor.props.info') }}
154
+ value={component.properties.content.info}
155
+ onUpdate={(value) => updateProperty('content.info', value as string, component, onPropertyChange)}
156
+ />
157
+ <UI.Input
158
+ label={{ name: $t('constructor.props.svgicon') }}
159
+ type="text-area"
160
+ maxlength={100000}
161
+ value={component.properties.content.icon}
162
+ onUpdate={(value) => updateProperty('content.icon', value as string, component, onPropertyChange)}
163
+ />
164
+ </div>
165
+ <div class="flex w-1/3 flex-col px-2">
166
+ <UI.Input
167
+ label={{ name: $t('constructor.props.componentclass') }}
168
+ value={component.properties.componentClass}
169
+ onUpdate={(value) => updateProperty('componentClass', value as string, component, onPropertyChange)}
170
+ />
171
+ <UI.Select
172
+ label={{ name: $t('constructor.props.height') }}
173
+ type="buttons"
174
+ options={$optionsStore.HEIGHT_OPTIONS}
175
+ value={initialHeight}
176
+ onUpdate={(option) =>
177
+ updateProperty('componentClass', twMerge(component.properties.componentClass, option.value), component, onPropertyChange)}
178
+ />
179
+ <UI.Select
180
+ wrapperClass="h-14"
181
+ label={{ name: $t('constructor.props.colors') }}
182
+ type="buttons"
183
+ options={$optionsStore.COLOR_OPTIONS}
184
+ value={initialColor}
185
+ onUpdate={(option) =>
186
+ updateProperty('componentClass', twMerge(component.properties.componentClass, option.value), component, onPropertyChange)}
187
+ />
188
+ </div>
189
+ </div>
119
190
  {/if}
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  properties: Partial<IButtonProps>;
5
5
  };
6
6
  onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const ButtonProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type ButtonProps = ReturnType<typeof ButtonProps>;
@@ -6,9 +6,14 @@
6
6
  import { getContext } from 'svelte'
7
7
  import { optionsStore } from '../options'
8
8
 
9
- const { component, onPropertyChange } = $props<{
9
+ const {
10
+ component,
11
+ onPropertyChange,
12
+ forConstructor = true,
13
+ } = $props<{
10
14
  component: UIComponent & { properties: Partial<IColorPickerProps> }
11
- onPropertyChange: (value: string | object, name?: string) => void
15
+ onPropertyChange: (value: string | object) => void
16
+ forConstructor?: boolean
12
17
  }>()
13
18
 
14
19
  const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
@@ -21,7 +26,7 @@
21
26
  )
22
27
  </script>
23
28
 
24
- {#if component && component.properties}
29
+ {#if forConstructor}
25
30
  <div class="relative flex flex-row items-start justify-center">
26
31
  <!-- Сообщение для отправки в ws по нажатию кнопки -->
27
32
  <div class="flex w-1/3 flex-col items-center px-2">
@@ -48,7 +53,6 @@
48
53
  <UI.Input
49
54
  label={{ name: $t('constructor.props.label') }}
50
55
  value={component.properties.label.name}
51
- type="text"
52
56
  onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
53
57
  />
54
58
  <UI.Select
@@ -60,4 +64,45 @@
60
64
  />
61
65
  </div>
62
66
  </div>
67
+ {:else}
68
+ <div class="relative flex flex-row items-start justify-center">
69
+ <!-- Сообщение для отправки в ws по нажатию кнопки -->
70
+ <div class="flex w-1/3 flex-col items-center px-2">
71
+ <UI.Input
72
+ label={{ name: $t('constructor.props.id') }}
73
+ value={component.properties.id}
74
+ onUpdate={(value) => updateProperty('id', value as string, component, onPropertyChange)}
75
+ />
76
+ <UI.Input
77
+ label={{ name: $t('constructor.props.wrapperclass') }}
78
+ value={component.properties.wrapperClass}
79
+ onUpdate={(value) => updateProperty('wrapperClass', value as string, component, onPropertyChange)}
80
+ />
81
+ </div>
82
+ <div class="flex w-1/3 flex-col px-2">
83
+ <UI.Input
84
+ label={{ name: $t('constructor.props.label') }}
85
+ value={component.properties.label.name}
86
+ onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
87
+ />
88
+ <UI.Input
89
+ label={{ name: $t('constructor.props.label.class') }}
90
+ value={component.properties.label.class}
91
+ onUpdate={(value) => updateProperty('label.class', value as string, component, onPropertyChange)}
92
+ />
93
+ </div>
94
+ <div class="flex w-1/3 flex-col px-2">
95
+ <UI.TextField content={{ name: $t('constructor.props.defaultcolor'), class: 'font-bold' }} />
96
+ <UI.Input
97
+ label={{ name: $t('constructor.props.label') }}
98
+ value={component.properties.label.name}
99
+ onUpdate={(value) => updateProperty('label.name', value as string, component, onPropertyChange)}
100
+ />
101
+ <UI.Input
102
+ label={{ name: $t('constructor.props.label.class') }}
103
+ value={component.properties.label.class}
104
+ onUpdate={(value) => updateProperty('label.class', value as string, component, onPropertyChange)}
105
+ />
106
+ </div>
107
+ </div>
63
108
  {/if}
@@ -3,7 +3,8 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<IColorPickerProps>;
5
5
  };
6
- onPropertyChange: (value: string | object, name?: string) => void;
6
+ onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const ColorPickerProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type ColorPickerProps = ReturnType<typeof ColorPickerProps>;
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ import * as UI from './'
3
+ import type { Snippet } from 'svelte'
4
+ import CopyButton from './libIcons/CopyButton.svelte'
5
+
6
+ let { component, componentProps, codeText }: { component: Snippet; componentProps: Snippet; codeText: string } = $props()
7
+
8
+ let isCopied = $state(false)
9
+ </script>
10
+
11
+ <div class="flex h-[calc(100vh-9rem)] flex-col">
12
+ <div class="flex-1 overflow-y-auto">
13
+ {@render component()}
14
+ </div>
15
+ <div class=" border-t border-gray-500"></div>
16
+ <div class="h-fit">
17
+ {@render componentProps()}
18
+ <div class="relative mt-3">
19
+ <UI.Button
20
+ wrapperClass="absolute top-3 right-5 w-6"
21
+ content={{ icon: isCopied ? '<div class="rounded-md bg-[var(--green-color)] shadow-lg px-1">✓</div>' : CopyButton }}
22
+ onClick={() => {
23
+ isCopied = true
24
+ setTimeout(() => (isCopied = false), 1000)
25
+ navigator.clipboard.writeText(codeText)
26
+ }}
27
+ />
28
+ <pre class="overflow-x-auto">{codeText}
29
+ </pre>
30
+ </div>
31
+ </div>
32
+ </div>
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from 'svelte';
2
+ type $$ComponentProps = {
3
+ component: Snippet;
4
+ componentProps: Snippet;
5
+ codeText: string;
6
+ };
7
+ declare const ComponentExample: import("svelte").Component<$$ComponentProps, {}, "">;
8
+ type ComponentExample = ReturnType<typeof ComponentExample>;
9
+ export default ComponentExample;
@@ -1,25 +1,21 @@
1
- <!-- $lib/ElementsUI/SwitchProps.svelte -->
2
1
  <script lang="ts">
3
2
  import { getContext } from 'svelte'
4
3
  import { t } from '../locales/i18n'
5
4
  import { type UIComponent, type IGraphProps, updateProperty } from '../types'
6
5
  import * as UI from '..'
7
6
 
8
- const { component, onPropertyChange } = $props<{
7
+ const {
8
+ component,
9
+ onPropertyChange,
10
+ forConstructor = true,
11
+ } = $props<{
9
12
  component: UIComponent & { properties: Partial<IGraphProps> }
10
13
  onPropertyChange: (value: string | object) => void
14
+ forConstructor?: boolean
11
15
  }>()
12
16
 
13
- const DeviceVariables = getContext<string[]>('DeviceVariables')
14
- let VARIABLE_OPTIONS = $derived(
15
- DeviceVariables && Array.isArray(DeviceVariables)
16
- ? DeviceVariables.map((variable) => ({
17
- id: variable,
18
- value: variable,
19
- name: variable,
20
- }))
21
- : [],
22
- )
17
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
18
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
23
19
  </script>
24
20
 
25
21
  {#if component && component.properties}
@@ -31,7 +27,8 @@
31
27
  options={VARIABLE_OPTIONS}
32
28
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
33
29
  onUpdate={(value) => {
34
- updateProperty('id', value.value as string, component, onPropertyChange)
30
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
31
+ updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
35
32
  }}
36
33
  />
37
34
  </div>
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  properties: Partial<IGraphProps>;
5
5
  };
6
6
  onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const GraphProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type GraphProps = ReturnType<typeof GraphProps>;
@@ -1,6 +1,5 @@
1
1
  <!-- $lib/ElementsUI/Input.svelte -->
2
2
  <script lang="ts">
3
- import { onMount } from 'svelte'
4
3
  import { fly } from 'svelte/transition'
5
4
  import type { IInputProps } from '../types'
6
5
  import { twMerge } from 'tailwind-merge'
@@ -17,7 +16,7 @@
17
16
  componentClass = '',
18
17
  maxlength = 100,
19
18
  textareaRows = 3,
20
- number = { minNum: -1000000, maxNum: Infinity, step: 1 },
19
+ number = { minNum: -1000000, maxNum: 1000000, step: 1 },
21
20
  help = { info: '', autocomplete: 'off', copyButton: false, regExp: '^[\\s\\S]*$' },
22
21
  onUpdate = () => {},
23
22
  }: IInputProps = $props()
@@ -1,4 +1,3 @@
1
- <!-- $lib/ElementsUI/InputProps.svelte -->
2
1
  <script lang="ts">
3
2
  import { getContext } from 'svelte'
4
3
  import { t } from '../locales/i18n'
@@ -7,22 +6,19 @@
7
6
  import { optionsStore } from '../options'
8
7
  import { twMerge } from 'tailwind-merge'
9
8
 
10
- const { component, onPropertyChange } = $props<{
9
+ const {
10
+ component,
11
+ onPropertyChange,
12
+ forConstructor = true,
13
+ } = $props<{
11
14
  component: UIComponent & { properties: Partial<IInputProps> }
12
15
  onPropertyChange: (value: string | object) => void
16
+ forConstructor?: boolean
13
17
  }>()
14
18
 
15
19
  let isValidRegExp = $state(true)
16
- const DeviceVariables = getContext<string[]>('DeviceVariables')
17
- let VARIABLE_OPTIONS = $derived(
18
- DeviceVariables && Array.isArray(DeviceVariables)
19
- ? DeviceVariables.map((variable) => ({
20
- id: variable,
21
- value: variable,
22
- name: variable,
23
- }))
24
- : [],
25
- )
20
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
21
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
26
22
 
27
23
  const initialColor = $derived(
28
24
  $optionsStore.COLOR_OPTIONS.find((c) =>
@@ -37,7 +33,7 @@
37
33
  )
38
34
 
39
35
  /* Обновление свойства */
40
- const updateProperty = (path: string, value: string | object | boolean | number | RegExp) => {
36
+ const updateProperty = (path: string, value: string | object | boolean | number | RegExp, name?: string) => {
41
37
  const newProperties = JSON.parse(JSON.stringify(component.properties))
42
38
  if (path === 'regExp') {
43
39
  try {
@@ -72,7 +68,7 @@
72
68
  }
73
69
 
74
70
  obj[parts[parts.length - 1]] = value
75
- onPropertyChange(newProperties)
71
+ onPropertyChange(newProperties, name)
76
72
  }
77
73
 
78
74
  const handleOptionColorChange = (color: string) => {
@@ -99,11 +95,9 @@
99
95
  label={{ name: $t('constructor.props.variable') }}
100
96
  options={VARIABLE_OPTIONS}
101
97
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
102
- onUpdate={(selectedOption) => {
103
- if (selectedOption && selectedOption.name) {
104
- updateProperty('id', selectedOption.value as string)
105
- updateProperty('eventHandler.Variables', selectedOption.value as string)
106
- }
98
+ onUpdate={(value) => {
99
+ updateProperty('id', value.value as string, value.name?.split('|')[1].trim())
100
+ updateProperty('eventHandler.Variables', value.value as string)
107
101
  }}
108
102
  />
109
103
  <UI.Select
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  properties: Partial<IInputProps>;
5
5
  };
6
6
  onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const InputProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type InputProps = ReturnType<typeof InputProps>;
@@ -1,4 +1,3 @@
1
- <!-- $lib/ElementsUI/SwitchProps.svelte -->
2
1
  <script lang="ts">
3
2
  import { getContext } from 'svelte'
4
3
  import { t } from '../locales/i18n'
@@ -7,21 +6,18 @@
7
6
  import { optionsStore } from '../options'
8
7
  import { twMerge } from 'tailwind-merge'
9
8
 
10
- const { component, onPropertyChange } = $props<{
9
+ const {
10
+ component,
11
+ onPropertyChange,
12
+ forConstructor = true,
13
+ } = $props<{
11
14
  component: UIComponent & { properties: Partial<IProgressBarProps> }
12
15
  onPropertyChange: (value: string | object) => void
16
+ forConstructor?: boolean
13
17
  }>()
14
18
 
15
- const DeviceVariables = getContext<string[]>('DeviceVariables')
16
- let VARIABLE_OPTIONS = $derived(
17
- DeviceVariables && Array.isArray(DeviceVariables)
18
- ? DeviceVariables.map((variable) => ({
19
- id: variable,
20
- value: variable,
21
- name: variable,
22
- }))
23
- : [],
24
- )
19
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
20
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
25
21
 
26
22
  const initialAlign = $derived(
27
23
  $optionsStore.ALIGN_OPTIONS.find((a) =>
@@ -44,7 +40,8 @@
44
40
  options={VARIABLE_OPTIONS}
45
41
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
46
42
  onUpdate={(value) => {
47
- updateProperty('id', value.value as string, component, onPropertyChange)
43
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
44
+ updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
48
45
  }}
49
46
  />
50
47
  </div>
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  properties: Partial<IProgressBarProps>;
5
5
  };
6
6
  onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const ProgressBarProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type ProgressBarProps = ReturnType<typeof ProgressBarProps>;
@@ -71,7 +71,6 @@
71
71
  isDropdownOpen = filteredOptions.length > 0
72
72
 
73
73
  const selectedFromList = options.some((option) => option.name?.toString() === searchValue)
74
- console.log(selectedFromList)
75
74
 
76
75
  if (!selectedFromList) {
77
76
  const newOption: ISelectOption<T> = {
@@ -134,14 +133,14 @@
134
133
  </div>
135
134
  {/if}
136
135
  {:else if type === 'buttons'}
137
- <div {id} class="flex h-full w-full flex-row justify-center">
136
+ <div {id} class="flex h-full w-full flex-row justify-center rounded-full border border-[var(--bg-color)]">
138
137
  {#each options as option, index (option.id)}
139
138
  <button
140
139
  id={option.id}
141
140
  class="{twMerge(
142
141
  `m-0 inline-block min-w-0 flex-1 items-center px-2 py-1 font-semibold shadow-sm transition-all duration-300 select-none
143
142
  ${option.disabled || disabled ? 'opacity-50' : 'cursor-pointer hover:shadow-md'}
144
- ${option.value === value?.value && value !== null ? 'z-10 py-0 shadow-[0_0_10px_var(--shadow-color)] hover:shadow-[0_0_15px_var(--shadow-color)]' : ''}
143
+ ${option.value === value?.value && value !== null ? 'z-10 py-1 shadow-[0_0_10px_var(--shadow-color)] hover:shadow-[0_0_15px_var(--shadow-color)]' : ''}
145
144
  ${options.length > 0 && index === 0 ? 'rounded-l-2xl' : ''} ${index === options.length - 1 ? 'rounded-r-2xl' : ''}`,
146
145
  option.class,
147
146
  )} bg-[var(--bg-color)]"
@@ -1,4 +1,3 @@
1
- <!-- $lib/ElementsUI/SelectProps.svelte -->
2
1
  <script lang="ts">
3
2
  import { getContext } from 'svelte'
4
3
  import { t } from '../locales/i18n'
@@ -9,21 +8,18 @@
9
8
  import { optionsStore } from '../options.js'
10
9
  import { twMerge } from 'tailwind-merge'
11
10
 
12
- const { component, onPropertyChange } = $props<{
11
+ const {
12
+ component,
13
+ onPropertyChange,
14
+ forConstructor = true,
15
+ } = $props<{
13
16
  component: UIComponent & { properties: Partial<ISelectProps> }
14
- onPropertyChange: (path: string, value: string | object) => void
17
+ onPropertyChange: (value: string | object) => void
18
+ forConstructor?: boolean
15
19
  }>()
16
20
 
17
- const DeviceVariables = getContext<string[]>('DeviceVariables')
18
- let VARIABLE_OPTIONS = $derived(
19
- DeviceVariables && Array.isArray(DeviceVariables)
20
- ? DeviceVariables.map((variable) => ({
21
- id: variable,
22
- value: variable,
23
- name: variable,
24
- }))
25
- : [],
26
- )
21
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
22
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
27
23
 
28
24
  type ValueTypeOption = {
29
25
  id: string
@@ -67,13 +63,12 @@
67
63
  <div class="relative mb-4 flex flex-row items-start justify-center">
68
64
  <div class="flex w-1/3 flex-col items-center px-2">
69
65
  <UI.Select
70
- label={{ name: $t('constructor.props.argument') }}
71
- type="buttons"
72
- value={$optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === component.properties.eventHandler.Argument) ??
73
- $optionsStore.FULL_ARGUMENT_OPTION.find((h) => h.value === '')}
74
- options={$optionsStore.FULL_ARGUMENT_OPTION}
75
- onUpdate={(option) => {
76
- updateProperty('eventHandler.Argument', option.value as string, component, onPropertyChange)
66
+ label={{ name: $t('constructor.props.variable') }}
67
+ options={VARIABLE_OPTIONS}
68
+ value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
69
+ onUpdate={(value) => {
70
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
71
+ updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
77
72
  }}
78
73
  />
79
74
 
@@ -133,7 +128,6 @@
133
128
  o['class'] = option.value
134
129
  })
135
130
  updateProperty('options', options, component, onPropertyChange)
136
- console.log(component.properties.wrapperClass, component.properties.options)
137
131
  }}
138
132
  />
139
133
  </div>
@@ -3,7 +3,8 @@ type $$ComponentProps = {
3
3
  component: UIComponent & {
4
4
  properties: Partial<ISelectProps>;
5
5
  };
6
- onPropertyChange: (path: string, value: string | object) => void;
6
+ onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const SelectProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type SelectProps = ReturnType<typeof SelectProps>;
@@ -1,4 +1,3 @@
1
- <!-- $lib/ElementsUI/SwitchProps.svelte -->
2
1
  <script lang="ts">
3
2
  import { getContext } from 'svelte'
4
3
  import { t } from '../locales/i18n'
@@ -7,21 +6,18 @@
7
6
  import { optionsStore } from '../options'
8
7
  import { twMerge } from 'tailwind-merge'
9
8
 
10
- const { component, onPropertyChange } = $props<{
9
+ const {
10
+ component,
11
+ onPropertyChange,
12
+ forConstructor = true,
13
+ } = $props<{
11
14
  component: UIComponent & { properties: Partial<ISliderProps> }
12
15
  onPropertyChange: (value: string | object) => void
16
+ forConstructor?: boolean
13
17
  }>()
14
18
 
15
- const DeviceVariables = getContext<string[]>('DeviceVariables')
16
- let VARIABLE_OPTIONS = $derived(
17
- DeviceVariables && Array.isArray(DeviceVariables)
18
- ? DeviceVariables.map((variable) => ({
19
- id: variable,
20
- value: variable,
21
- name: variable,
22
- }))
23
- : [],
24
- )
19
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
20
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
25
21
 
26
22
  const initialAlign = $derived(
27
23
  $optionsStore.ALIGN_OPTIONS.find((a) =>
@@ -44,7 +40,7 @@
44
40
  options={VARIABLE_OPTIONS}
45
41
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
46
42
  onUpdate={(value) => {
47
- updateProperty('id', value.value as string, component, onPropertyChange)
43
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
48
44
  updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
49
45
  }}
50
46
  />
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  properties: Partial<ISliderProps>;
5
5
  };
6
6
  onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const SliderProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type SliderProps = ReturnType<typeof SliderProps>;
@@ -1,4 +1,3 @@
1
- <!-- $lib/ElementsUI/SwitchProps.svelte -->
2
1
  <script lang="ts">
3
2
  import { getContext } from 'svelte'
4
3
  import { t } from '../locales/i18n'
@@ -7,21 +6,18 @@
7
6
  import { optionsStore } from '../options'
8
7
  import { twMerge } from 'tailwind-merge'
9
8
 
10
- const { component, onPropertyChange } = $props<{
9
+ const {
10
+ component,
11
+ onPropertyChange,
12
+ forConstructor = true,
13
+ } = $props<{
11
14
  component: UIComponent & { properties: Partial<ISwitchProps> }
12
15
  onPropertyChange: (value: string | object) => void
16
+ forConstructor?: boolean
13
17
  }>()
18
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
19
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
14
20
 
15
- const DeviceVariables = getContext<string[]>('DeviceVariables')
16
- let VARIABLE_OPTIONS = $derived(
17
- DeviceVariables && Array.isArray(DeviceVariables)
18
- ? DeviceVariables.map((variable) => ({
19
- id: variable,
20
- value: variable,
21
- name: variable,
22
- }))
23
- : [],
24
- )
25
21
  const initialColor = $derived(
26
22
  $optionsStore.COLOR_OPTIONS.find((c) =>
27
23
  (c.value as string).includes(component.properties.wrapperClass?.split(' ').find((cls: string) => cls.startsWith('bg-'))),
@@ -38,7 +34,7 @@
38
34
  options={VARIABLE_OPTIONS}
39
35
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
40
36
  onUpdate={(value) => {
41
- updateProperty('id', value.value as string, component, onPropertyChange)
37
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
42
38
  updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
43
39
  }}
44
40
  />
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  properties: Partial<ISwitchProps>;
5
5
  };
6
6
  onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const SwitchProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type SwitchProps = ReturnType<typeof SwitchProps>;
@@ -2,9 +2,9 @@
2
2
  <script lang="ts">
3
3
  import { get } from 'svelte/store'
4
4
  import type { ITableHeader, ITableProps } from '../types'
5
- import { fade, fly, slide } from 'svelte/transition'
5
+ import { fly } from 'svelte/transition'
6
6
  import { twMerge } from 'tailwind-merge'
7
- import { Button, Modal, Slider } from '..'
7
+ import { Button, Modal } from '..'
8
8
  import { t } from '../locales/i18n'
9
9
 
10
10
  let {
@@ -1,4 +1,3 @@
1
- <!-- $lib/ElementsUI/TableProps.svelte -->
2
1
  <script lang="ts">
3
2
  import { getContext } from 'svelte'
4
3
  import { t } from '../locales/i18n'
@@ -9,21 +8,18 @@
9
8
  import { optionsStore } from '../options'
10
9
  import { twMerge } from 'tailwind-merge'
11
10
 
12
- const { component, onPropertyChange } = $props<{
11
+ const {
12
+ component,
13
+ onPropertyChange,
14
+ forConstructor = true,
15
+ } = $props<{
13
16
  component: UIComponent & { properties: Partial<ITableProps<object>> }
14
17
  onPropertyChange: (value: string | object) => void
18
+ forConstructor?: boolean
15
19
  }>()
16
20
 
17
- const DeviceVariables = getContext<string[]>('DeviceVariables')
18
- let VARIABLE_OPTIONS = $derived(
19
- DeviceVariables && Array.isArray(DeviceVariables)
20
- ? DeviceVariables.map((variable) => ({
21
- id: variable,
22
- value: variable,
23
- name: variable,
24
- }))
25
- : [],
26
- )
21
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
22
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
27
23
 
28
24
  const initialColor = $derived(
29
25
  $optionsStore.COLOR_OPTIONS.find((c) =>
@@ -74,17 +70,15 @@
74
70
 
75
71
  {#if component && component.properties}
76
72
  <div class="relative flex flex-row items-start justify-center">
77
- <div class="flex w-1/3 flex-col items-center px-2">
78
- <UI.Select
79
- label={{ name: $t('constructor.props.variable') }}
80
- options={VARIABLE_OPTIONS}
81
- value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
82
- onUpdate={(value) => {
83
- updateProperty('id', value.value as string, component, onPropertyChange)
84
- updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
85
- }}
86
- />
87
- </div>
73
+ <UI.Select
74
+ label={{ name: $t('constructor.props.variable') }}
75
+ options={VARIABLE_OPTIONS}
76
+ value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
77
+ onUpdate={(value) => {
78
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
79
+ updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
80
+ }}
81
+ />
88
82
  <div class="flex w-1/3 flex-col px-2">
89
83
  <UI.Select
90
84
  wrapperClass="!h-14"
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  properties: Partial<ITableProps<object>>;
5
5
  };
6
6
  onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const TableProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type TableProps = ReturnType<typeof TableProps>;
@@ -1,4 +1,3 @@
1
- <!-- $lib/ElementsUI/GridAccordionProps.svelte -->
2
1
  <script lang="ts">
3
2
  import { t } from '../locales/i18n'
4
3
  import { updateProperty, type ITextFieldProps, type UIComponent } from '../types'
@@ -7,21 +6,18 @@
7
6
  import { getContext } from 'svelte'
8
7
  import { twMerge } from 'tailwind-merge'
9
8
 
10
- const { component, onPropertyChange } = $props<{
9
+ const {
10
+ component,
11
+ onPropertyChange,
12
+ forConstructor = true,
13
+ } = $props<{
11
14
  component: UIComponent & { properties: Partial<ITextFieldProps> }
12
15
  onPropertyChange: (value: string | object) => void
16
+ forConstructor?: boolean
13
17
  }>()
18
+ const DeviceVariables = getContext<{ id: string; value: string; name: string }[]>('DeviceVariables')
19
+ let VARIABLE_OPTIONS = $derived(DeviceVariables && Array.isArray(DeviceVariables) ? DeviceVariables : [])
14
20
 
15
- const DeviceVariables = getContext<string[]>('DeviceVariables')
16
- let VARIABLE_OPTIONS = $derived(
17
- DeviceVariables && Array.isArray(DeviceVariables)
18
- ? DeviceVariables.map((variable) => ({
19
- id: variable,
20
- value: variable,
21
- name: variable,
22
- }))
23
- : [],
24
- )
25
21
  let currentType = $derived($optionsStore.TEXTFIELD_SIZE_OPTIONS.find((t) => t.value === component.properties.content.size))
26
22
 
27
23
  const initialAlign = $derived(
@@ -46,7 +42,7 @@
46
42
  options={VARIABLE_OPTIONS}
47
43
  value={VARIABLE_OPTIONS.find((opt) => opt.value === component.properties.id)}
48
44
  onUpdate={(value) => {
49
- updateProperty('id', value.value as string, component, onPropertyChange)
45
+ updateProperty('id', value.value as string, component, onPropertyChange, value.name?.split('|')[1].trim())
50
46
  updateProperty('eventHandler.Variables', value.value as string, component, onPropertyChange)
51
47
  }}
52
48
  />
@@ -4,6 +4,7 @@ type $$ComponentProps = {
4
4
  properties: Partial<ITextFieldProps>;
5
5
  };
6
6
  onPropertyChange: (value: string | object) => void;
7
+ forConstructor?: boolean;
7
8
  };
8
9
  declare const TextFieldProps: import("svelte").Component<$$ComponentProps, {}, "">;
9
10
  type TextFieldProps = ReturnType<typeof TextFieldProps>;
@@ -0,0 +1,10 @@
1
+ <script lang="ts"></script>
2
+
3
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
4
+ <g fill="none" stroke="currentColor" stroke-width="1.5">
5
+ <path
6
+ d="M6 11c0-2.828 0-4.243.879-5.121C7.757 5 9.172 5 12 5h3c2.828 0 4.243 0 5.121.879C21 6.757 21 8.172 21 11v5c0 2.828 0 4.243-.879 5.121C19.243 22 17.828 22 15 22h-3c-2.828 0-4.243 0-5.121-.879C6 20.243 6 18.828 6 16z"
7
+ />
8
+ <path d="M6 19a3 3 0 0 1-3-3v-6c0-3.771 0-5.657 1.172-6.828S7.229 2 11 2h4a3 3 0 0 1 3 3" />
9
+ </g>
10
+ </svg>
@@ -0,0 +1,18 @@
1
+ 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> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const CopyButton: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type CopyButton = InstanceType<typeof CopyButton>;
18
+ export default CopyButton;
@@ -32,7 +32,14 @@ const translations = {
32
32
  'constructor.props.valuetype.text': 'Строка',
33
33
  'constructor.props.valuetype.number': 'Число',
34
34
  /* Общие для редактора свойств */
35
+ 'constructor.props.id': 'Идентификатор',
35
36
  'constructor.props.label': 'Текст надписи',
37
+ 'constructor.props.label.class': 'Стили надписи',
38
+ 'constructor.props.wrapperclass': 'Стили обёртки',
39
+ 'constructor.props.componentclass': 'Стили компонента',
40
+ 'constructor.props.svgicon': 'SVG-иконка (строка)',
41
+ 'constructor.props.open': 'Разворачивание',
42
+ 'constructor.props.defaultcolor': 'Первоначальный цвет',
36
43
  'constructor.props.type': 'Тип',
37
44
  'constructor.props.size': 'Размер',
38
45
  'constructor.props.header': 'Заголовок пакета',
@@ -78,6 +85,8 @@ const translations = {
78
85
  'constructor.props.optionvalue': 'Значение',
79
86
  'constructor.props.optionname': 'Текст',
80
87
  'constructor.props.copy': 'Копирование',
88
+ 'constructor.props.size.height': 'Высота сетки',
89
+ 'constructor.props.size.width': 'Ширина сетки',
81
90
  'constructor.props.table.columns': 'Колонки таблицы',
82
91
  'constructor.props.table.columns.key': 'Имя ключа',
83
92
  'constructor.props.table.columns.label': 'Название',
@@ -88,6 +97,15 @@ const translations = {
88
97
  'constructor.props.table.addaction': 'Добавить кнопку',
89
98
  'constructor.props.table.keys': 'Перечень ключей',
90
99
  'constructor.props.table.keys.info': 'Ключи таблицы, значения которых будут возвращаться',
100
+ 'constructor.props.icon.access': 'Доступ',
101
+ 'constructor.props.icon.common': 'Общее',
102
+ 'constructor.props.icon.control': 'Управление',
103
+ 'constructor.props.icon.electronic': 'Электроника',
104
+ 'constructor.props.icon.image': 'Изображение',
105
+ 'constructor.props.icon.info': 'Информация',
106
+ 'constructor.props.icon.network': 'Сеть',
107
+ 'constructor.props.icon.power': 'Питание',
108
+ 'constructor.props.icon.settings': 'Настройки',
91
109
  },
92
110
  en: {},
93
111
  zh: {},
package/dist/types.d.ts CHANGED
@@ -32,7 +32,7 @@ export interface IButtonProps {
32
32
  content?: {
33
33
  name?: string;
34
34
  info?: string;
35
- icon?: ConstructorOfATypedSvelteComponent | null;
35
+ icon?: ConstructorOfATypedSvelteComponent | string | null;
36
36
  };
37
37
  keyBind?: {
38
38
  key?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.1.7",
3
+ "version": "1.1.10",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -43,12 +43,12 @@
43
43
  "typescript": "^5.9.3"
44
44
  },
45
45
  "devDependencies": {
46
- "@sveltejs/kit": "^2.46.5",
46
+ "@sveltejs/kit": "^2.47.0",
47
47
  "@sveltejs/package": "^2.5.4",
48
48
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
49
- "@types/node": "^24.7.2",
49
+ "@types/node": "^24.8.1",
50
50
  "publint": "^0.3.14",
51
- "svelte": "^5.40.0",
51
+ "svelte": "^5.40.2",
52
52
  "svelte-preprocess": "^6.0.3",
53
53
  "vite": "^7.1.10",
54
54
  "vite-plugin-compression": "^0.5.1"