poe-svelte-ui-lib 1.2.21 → 1.2.23

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.
@@ -52,9 +52,9 @@
52
52
  const initialWidth = $derived(() => {
53
53
  let width = component.properties.items.find((item: ISelectOption) => item.class?.split(' ').find((cls: string) => cls.startsWith('w-')))
54
54
  if (!width) {
55
- return 1
56
- } else if (width.class.includes('w-auto')) return 1
57
- else return 2
55
+ return 0
56
+ } else if (width.class.includes('w-auto')) return 0
57
+ else return 1
58
58
  })
59
59
  </script>
60
60
 
@@ -107,10 +107,11 @@
107
107
  captionRight: $t('constructor.props.equal'),
108
108
  }}
109
109
  value={initialWidth()}
110
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
110
111
  onChange={(value) => {
111
112
  component.properties.items.forEach((_item: any, index: number) => {
112
113
  const items = [...(component.properties?.items || [])]
113
- items[index]['class'] = twMerge(items[index].class, value === 2 ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
114
+ items[index]['class'] = twMerge(items[index].class, value ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
114
115
  updateProperty('items', items, component, onPropertyChange)
115
116
  })
116
117
  }}
@@ -132,7 +133,7 @@
132
133
  }
133
134
  const items = [...(component.properties?.items || []), newItem]
134
135
  items.forEach((_item: any, index: number) => {
135
- items[index]['class'] = twMerge(items[index].class, initialWidth() === 2 ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
136
+ items[index]['class'] = twMerge(items[index].class, initialWidth() ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
136
137
  updateProperty('items', items, component, onPropertyChange)
137
138
  })
138
139
  }}
@@ -176,7 +177,7 @@
176
177
  const items = [...(component.properties?.items || [])]
177
178
  items.splice(index, 1)
178
179
  items.forEach((_item: any, index: number) => {
179
- items[index]['class'] = twMerge(items[index].class, initialWidth() === 2 ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
180
+ items[index]['class'] = twMerge(items[index].class, initialWidth() ? `w-[${(1 / items.length) * 100}%]` : 'w-auto')
180
181
  updateProperty('items', items, component, onPropertyChange)
181
182
  })
182
183
  updateProperty('items', items, component, onPropertyChange)
@@ -289,6 +290,7 @@
289
290
  captionRight: $t('constructor.props.equal'),
290
291
  }}
291
292
  value={initialWidth()}
293
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
292
294
  onChange={(value) => {
293
295
  if (value === 2) {
294
296
  component.properties.items.forEach((_item: any, index: number) => {
@@ -319,7 +321,7 @@
319
321
  let tabWidth = Math.max(...Array.from(document.body.querySelectorAll('.tab')).map((item) => (item as HTMLElement).offsetWidth))
320
322
  const newItem: { name: string; icon: string; class: string } = {
321
323
  name: `Tab ${component.properties?.items.length + 1}`,
322
- class: `w-${initialWidth() === 2 ? `[${tabWidth}px]` : 'auto'} text-${initialColor?.value.slice(3)}-500 ${initialPosition?.value}`,
324
+ class: `w-${initialWidth() ? `[${tabWidth}px]` : 'auto'} text-${initialColor?.value.slice(3)}-500 ${initialPosition?.value}`,
323
325
  icon: '',
324
326
  }
325
327
  const items = [...(component.properties?.items || []), newItem]
@@ -13,7 +13,10 @@
13
13
  } as const
14
14
  </script>
15
15
 
16
- <div {id} class={twMerge(`relative flex w-full flex-col items-center ${background ? 'rounded-2xl bg-(--back-color) px-6 py-2' : ''}`, wrapperClass)}>
16
+ <div
17
+ id={`${id}-${crypto.randomUUID().slice(0, 6)}`}
18
+ class={twMerge(`relative flex w-full flex-col items-center ${background ? 'rounded-2xl bg-(--back-color) px-6 py-2' : ''}`, wrapperClass)}
19
+ >
17
20
  <p class={twMerge(`w-full text-center ${textSize[content.size ?? 'base']}`, content.class)}>
18
21
  {content.name}
19
22
  </p>
@@ -79,30 +79,28 @@
79
79
  <div class="flex w-1/3 flex-col px-2">
80
80
  <UI.Switch
81
81
  label={{ name: $t('constructor.props.bold') }}
82
- value={initialBold ? 2 : 1}
82
+ value={initialBold}
83
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
83
84
  onChange={(value) =>
84
85
  updateProperty(
85
86
  'content.class',
86
- `${component.properties.content.class} ${value === 2 ? 'font-bold' : 'font-normal'}`,
87
+ `${component.properties.content.class} ${value ? 'font-bold' : 'font-normal'}`,
87
88
  component,
88
89
  onPropertyChange,
89
90
  )}
90
91
  />
91
92
  <UI.Switch
92
93
  label={{ name: $t('constructor.props.italic') }}
93
- value={initialItalic ? 2 : 1}
94
+ value={initialItalic}
95
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
94
96
  onChange={(value) =>
95
- updateProperty(
96
- 'content.class',
97
- `${component.properties.content.class} ${value === 2 ? 'italic' : 'not-italic'}`,
98
- component,
99
- onPropertyChange,
100
- )}
97
+ updateProperty('content.class', `${component.properties.content.class} ${value ? 'italic' : 'not-italic'}`, component, onPropertyChange)}
101
98
  />
102
99
  <UI.Switch
103
100
  label={{ name: $t('constructor.props.background') }}
104
- value={component.properties.background ? 2 : 1}
105
- onChange={(value) => updateProperty('background', value === 2, component, onPropertyChange)}
101
+ value={component.properties.background}
102
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
103
+ onChange={(value) => updateProperty('background', value, component, onPropertyChange)}
106
104
  />
107
105
  </div>
108
106
  </div>
@@ -152,30 +150,33 @@
152
150
  <div class="flex w-1/3 flex-col px-2">
153
151
  <UI.Switch
154
152
  label={{ name: $t('constructor.props.bold') }}
155
- value={initialBold ? 2 : 1}
153
+ value={initialBold}
154
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
156
155
  onChange={(value) =>
157
156
  updateProperty(
158
157
  'content.class',
159
- twMerge(`${component.properties.content.class} ${value === 2 ? 'font-bold' : 'font-normal'}`),
158
+ twMerge(`${component.properties.content.class} ${value ? 'font-bold' : 'font-normal'}`),
160
159
  component,
161
160
  onPropertyChange,
162
161
  )}
163
162
  />
164
163
  <UI.Switch
165
164
  label={{ name: $t('constructor.props.italic') }}
166
- value={initialItalic ? 2 : 1}
165
+ value={initialItalic}
166
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
167
167
  onChange={(value) =>
168
168
  updateProperty(
169
169
  'content.class',
170
- twMerge(`${component.properties.content.class} ${value === 2 ? 'italic' : 'not-italic'}`),
170
+ twMerge(`${component.properties.content.class} ${value ? 'italic' : 'not-italic'}`),
171
171
  component,
172
172
  onPropertyChange,
173
173
  )}
174
174
  />
175
175
  <UI.Switch
176
176
  label={{ name: $t('constructor.props.background') }}
177
- value={component.properties.background ? 2 : 1}
178
- onChange={(value) => updateProperty('background', value === 2, component, onPropertyChange)}
177
+ value={component.properties.background}
178
+ options={[{ id: crypto.randomUUID(), value: 0, class: '' }]}
179
+ onChange={(value) => updateProperty('background', value, component, onPropertyChange)}
179
180
  />
180
181
  </div>
181
182
  </div>
@@ -37,6 +37,12 @@ const translations = {
37
37
  'constructor.props.type.contain': 'Полный',
38
38
  'constructor.props.type.square': 'Квадрат',
39
39
  'constructor.props.type.circle': 'Круг',
40
+ 'constructor.props.type.horizontal': 'Горизонтально',
41
+ 'constructor.props.type.vertical': 'Вертикально',
42
+ 'constructor.props.type.checkbox': 'Галочка',
43
+ 'constructor.props.type.full': 'Полный',
44
+ 'constructor.props.type.viewOnly': 'Только просмотр',
45
+ 'constructor.props.type.hidden': 'Скрыто',
40
46
  /* Общие для редактора свойств */
41
47
  'constructor.props.id': 'Идентификатор',
42
48
  'constructor.props.label': 'Текст надписи',
@@ -95,6 +101,7 @@ const translations = {
95
101
  'constructor.props.widthMode': 'Ширина кнопок',
96
102
  'constructor.props.graphdata.title': 'Начальные данные ',
97
103
  'constructor.props.options.title': 'Опции компонента',
104
+ 'constructor.props.bits.title': 'Биты',
98
105
  'constructor.props.tabs.title': 'Вкладки меню',
99
106
  'constructor.props.valuetype': 'Тип значения',
100
107
  'constructor.props.action': 'Действие при переключении',
@@ -108,12 +115,18 @@ const translations = {
108
115
  'constructor.props.units': 'Единица измерения',
109
116
  'constructor.props.optionclass': 'Стили кнопки',
110
117
  'constructor.props.optionvalue': 'Значение',
118
+ 'constructor.props.optionposition': 'Позиция',
111
119
  'constructor.props.optionname': 'Текст',
112
120
  'constructor.props.copy': 'Копирование',
113
121
  'constructor.props.size.height': 'Высота сетки',
114
122
  'constructor.props.size.width': 'Ширина сетки',
123
+ 'constructor.props.range.start': 'Начальный бит ',
124
+ 'constructor.props.range.end': 'Последний бит',
125
+ 'constructor.props.range.start.help': 'Позиция начального бита диапазона ',
126
+ 'constructor.props.range.end.help': 'Позиция последнего бита диапазона',
115
127
  'constructor.props.icon.text.position': 'Положение иконки',
116
128
  'constructor.props.equal': 'Равные',
129
+ 'constructor.props.bitmode': 'Битовый режим',
117
130
  'constructor.props.table.columns': 'Колонки таблицы',
118
131
  'constructor.props.table.columns.key': 'Ключ',
119
132
  'constructor.props.table.columns.label': 'Название колонки',
package/dist/options.d.ts CHANGED
@@ -14,6 +14,11 @@ export declare const optionsStore: import("svelte/store").Readable<{
14
14
  value: string;
15
15
  name: string;
16
16
  }[];
17
+ ACCESS_OPTION: {
18
+ id: string;
19
+ value: string;
20
+ name: string;
21
+ }[];
17
22
  INPUT_TYPE_OPTIONS: {
18
23
  id: string;
19
24
  value: string;
@@ -95,6 +100,11 @@ export declare const optionsStore: import("svelte/store").Readable<{
95
100
  value: string;
96
101
  name: string;
97
102
  }[];
103
+ SWITCH_OPTIONS: {
104
+ id: string;
105
+ value: string;
106
+ name: string;
107
+ }[];
98
108
  INFO_SIDE_OPTIONS: {
99
109
  id: string;
100
110
  value: string;
package/dist/options.js CHANGED
@@ -22,6 +22,11 @@ export const optionsStore = derived(t, ($t) => {
22
22
  { id: id(), value: 'Save', name: $t('constructor.props.action.save') },
23
23
  { id: id(), value: '', name: $t('constructor.props.action.custom') },
24
24
  ],
25
+ ACCESS_OPTION: [
26
+ { id: id(), value: 'full', name: $t('constructor.props.type.full') },
27
+ { id: id(), value: 'viewOnly', name: $t('constructor.props.type.viewOnly') },
28
+ { id: id(), value: 'hidden', name: $t('constructor.props.type.hidden') },
29
+ ],
25
30
  INPUT_TYPE_OPTIONS: [
26
31
  { id: id(), value: 'text', name: $t('constructor.props.type.text') },
27
32
  { id: id(), value: 'password', name: $t('constructor.props.type.password') },
@@ -104,6 +109,11 @@ export const optionsStore = derived(t, ($t) => {
104
109
  { id: id(), value: 'cover', name: $t('constructor.props.type.cover') },
105
110
  { id: id(), value: 'contain', name: $t('constructor.props.type.contain') },
106
111
  ],
112
+ SWITCH_OPTIONS: [
113
+ { id: id(), value: 'horizontal', name: $t('constructor.props.type.horizontal') },
114
+ { id: id(), value: 'vertical', name: $t('constructor.props.type.vertical') },
115
+ { id: id(), value: 'checkbox', name: $t('constructor.props.type.checkbox') },
116
+ ],
107
117
  INFO_SIDE_OPTIONS: [
108
118
  { id: id(), value: 'top', name: $t('constructor.props.info.top') },
109
119
  { id: id(), value: 'bottom', name: $t('constructor.props.info.bottom') },
package/dist/types.d.ts CHANGED
@@ -106,6 +106,7 @@ export interface ISelectProps<T = unknown> {
106
106
  type?: 'select' | 'buttons' | 'input';
107
107
  value?: ISelectOption<T> | null;
108
108
  options?: ISelectOption<T>[];
109
+ bitMode?: boolean;
109
110
  eventHandler?: IUIComponentHandler;
110
111
  onUpdate?: (value: ISelectOption<T>) => void;
111
112
  }
@@ -127,6 +128,8 @@ export interface ISwitchProps {
127
128
  captionLeft?: string;
128
129
  captionRight?: string;
129
130
  };
131
+ options?: ISelectOption<number>[];
132
+ bitMode?: boolean;
130
133
  type?: 'horizontal' | 'vertical' | 'checkbox';
131
134
  value?: number;
132
135
  eventHandler?: IUIComponentHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -48,7 +48,7 @@
48
48
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
49
49
  "@types/node": "^24.10.1",
50
50
  "publint": "^0.3.15",
51
- "svelte": "^5.43.6",
51
+ "svelte": "^5.43.10",
52
52
  "svelte-preprocess": "^6.0.3",
53
53
  "vite": "^7.2.2",
54
54
  "vite-plugin-compression": "^0.5.1"