poe-svelte-ui-lib 1.15.4 → 1.16.1
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.
- package/dist/Divider/Divider.svelte +17 -0
- package/dist/Divider/Divider.svelte.d.ts +4 -0
- package/dist/Divider/DividerProps.svelte +81 -0
- package/dist/Divider/DividerProps.svelte.d.ts +16 -0
- package/dist/Graph/Graph.svelte +2 -6
- package/dist/Table/Table.svelte +1 -2
- package/dist/VideoViewer/VideoViewer.svelte +1 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/locales/translations.d.ts +0 -6
- package/dist/locales/translations.js +7 -0
- package/dist/options.d.ts +10 -0
- package/dist/options.js +9 -0
- package/dist/types.d.ts +11 -4
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- $lib/ElementsUI/Divider.svelte -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { twMerge } from "tailwind-merge"
|
|
4
|
+
import type { IDividerProps } from "../types"
|
|
5
|
+
|
|
6
|
+
let { id = crypto.randomUUID(), wrapperClass = "", type = "line", size = 16, anchor = "center" }: IDividerProps = $props()
|
|
7
|
+
|
|
8
|
+
const anchorClass = { top: "justify-start", center: "justify-center", bottom: "justify-end" } as const
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div id={`${id}-${crypto.randomUUID().slice(0, 6)}`} class={twMerge(`flex h-full w-full flex-col ${anchorClass[anchor]}`, wrapperClass)}>
|
|
12
|
+
<div class="flex w-full items-center" style="height: {size}px;">
|
|
13
|
+
{#if type === "line"}
|
|
14
|
+
<div class="w-full border-t border-(--bg-color)"></div>
|
|
15
|
+
{/if}
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<!-- $lib/ElementsUI/DividerProps.svelte -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { T } from "../locales/i18n"
|
|
4
|
+
import { updateProperty, type IDividerProps, type IUIComponentHandler, type UIComponent } from "../types"
|
|
5
|
+
import * as UI from ".."
|
|
6
|
+
import { optionsStore } from "../options"
|
|
7
|
+
import CommonSnippets from "../CommonSnippets.svelte"
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
component,
|
|
11
|
+
onPropertyChange,
|
|
12
|
+
forConstructor = true,
|
|
13
|
+
} = $props<{
|
|
14
|
+
component: UIComponent & { properties: Partial<IDividerProps> }
|
|
15
|
+
onPropertyChange: (updates: Partial<{ properties?: string | object; name?: string; access?: string; eventHandler?: IUIComponentHandler }>) => void
|
|
16
|
+
forConstructor?: boolean
|
|
17
|
+
}>()
|
|
18
|
+
|
|
19
|
+
let currentType = $derived($optionsStore.DIVIDER_TYPE_OPTIONS.find((t) => t.value === component.properties.type))
|
|
20
|
+
let currentAnchor = $derived($optionsStore.DIVIDER_ANCHOR_OPTIONS.find((a) => a.value === component.properties.anchor))
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
{#snippet DividerType()}
|
|
24
|
+
<UI.Select
|
|
25
|
+
label={{ name: $T("constructor.props.divider.type") }}
|
|
26
|
+
type="buttons"
|
|
27
|
+
value={currentType}
|
|
28
|
+
options={$optionsStore.DIVIDER_TYPE_OPTIONS}
|
|
29
|
+
onUpdate={(item) => updateProperty("type", (item as UI.IOption).value as string, component, onPropertyChange)}
|
|
30
|
+
/>
|
|
31
|
+
{/snippet}
|
|
32
|
+
|
|
33
|
+
{#snippet DividerAnchor()}
|
|
34
|
+
<UI.Select
|
|
35
|
+
label={{ name: $T("constructor.props.divider.anchor") }}
|
|
36
|
+
type="buttons"
|
|
37
|
+
value={currentAnchor}
|
|
38
|
+
options={$optionsStore.DIVIDER_ANCHOR_OPTIONS}
|
|
39
|
+
onUpdate={(item) => updateProperty("anchor", (item as UI.IOption).value as string, component, onPropertyChange)}
|
|
40
|
+
/>
|
|
41
|
+
{/snippet}
|
|
42
|
+
|
|
43
|
+
{#snippet DividerSize()}
|
|
44
|
+
<UI.Input
|
|
45
|
+
label={{ name: $T("constructor.props.size") }}
|
|
46
|
+
value={component.properties.size}
|
|
47
|
+
onUpdate={(value) => updateProperty("size", value as number, component, onPropertyChange)}
|
|
48
|
+
number={{ minNum: 0, maxNum: 200, step: 1 }}
|
|
49
|
+
type="number"
|
|
50
|
+
/>
|
|
51
|
+
{/snippet}
|
|
52
|
+
|
|
53
|
+
{#if forConstructor}
|
|
54
|
+
<div class="flex items-start justify-center gap-8">
|
|
55
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
56
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
57
|
+
</div>
|
|
58
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
59
|
+
{@render DividerType()}
|
|
60
|
+
{@render DividerAnchor()}
|
|
61
|
+
</div>
|
|
62
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
63
|
+
{@render DividerSize()}
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
{:else}
|
|
67
|
+
<div class="flex items-start justify-center gap-8">
|
|
68
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
69
|
+
<CommonSnippets snippet="Identificator" {component} {onPropertyChange} />
|
|
70
|
+
<CommonSnippets snippet="Access" {component} {onPropertyChange} />
|
|
71
|
+
<CommonSnippets snippet="WrapperClass" {component} {onPropertyChange} />
|
|
72
|
+
</div>
|
|
73
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
74
|
+
{@render DividerType()}
|
|
75
|
+
{@render DividerAnchor()}
|
|
76
|
+
</div>
|
|
77
|
+
<div class="flex w-1/3 flex-col px-2">
|
|
78
|
+
{@render DividerSize()}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
{/if}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type IDividerProps, type IUIComponentHandler, type UIComponent } from "../types";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
component: UIComponent & {
|
|
4
|
+
properties: Partial<IDividerProps>;
|
|
5
|
+
};
|
|
6
|
+
onPropertyChange: (updates: Partial<{
|
|
7
|
+
properties?: string | object;
|
|
8
|
+
name?: string;
|
|
9
|
+
access?: string;
|
|
10
|
+
eventHandler?: IUIComponentHandler;
|
|
11
|
+
}>) => void;
|
|
12
|
+
forConstructor?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const DividerProps: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
15
|
+
type DividerProps = ReturnType<typeof DividerProps>;
|
|
16
|
+
export default DividerProps;
|
package/dist/Graph/Graph.svelte
CHANGED
|
@@ -154,9 +154,7 @@
|
|
|
154
154
|
drawAllGraphs()
|
|
155
155
|
}, selectedRefreshRate)
|
|
156
156
|
} else if (selectedRefreshRate == 0 && !isTest) {
|
|
157
|
-
/* AUTO: streamingData не несёт признак "
|
|
158
|
-
DeviceStore хранит только последнее значение), поэтому опрашиваем каждые 10мс и рисуем
|
|
159
|
-
точку только когда сами значения реально изменились, а не на каждый тик поллинга. */
|
|
157
|
+
/* AUTO: streamingData не несёт признак "новый пакет" — опрашиваем каждые 10мс, рисуем точку только при реальном изменении значений */
|
|
160
158
|
intervalId = setInterval(() => {
|
|
161
159
|
if (!streamingData.data || streamingData.data.length === 0) return
|
|
162
160
|
const newValues = (streamingData.data as IGraphDataObject[]).map((dataset) => dataset.value)
|
|
@@ -210,9 +208,7 @@
|
|
|
210
208
|
const maxX = allPoints.length ? Math.max(...allPoints.map((p) => p.x)) : 1
|
|
211
209
|
const timeSpan = maxX - minX || 1
|
|
212
210
|
|
|
213
|
-
/*
|
|
214
|
-
в статическом считается разово по всему массиву, в живом — используется сглаженный liveYRange
|
|
215
|
-
(обновляется отдельно, в updateLiveYRange, чтобы не дёргаться на каждый кадр/mousemove) */
|
|
211
|
+
/* Авто-масштаб по данным (±10%): статический — разово по массиву, живой — через сглаженный liveYRange (updateLiveYRange) */
|
|
216
212
|
let yMin: number
|
|
217
213
|
let yMax: number
|
|
218
214
|
if (isHistoryMode) {
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -151,8 +151,7 @@
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
/*
|
|
155
|
-
src: (row) => (row.icon ? `data:image/png;base64,${row.icon}` : '') */
|
|
154
|
+
/* Требует явного src: (row) => row.icon ? `data:image/png;base64,${row.icon}` : '' в описании столбца */
|
|
156
155
|
const hasImage = (column: ITableHeader<any>, row: any, index: number): boolean => {
|
|
157
156
|
let content = (column.content as ITableContent<any>[])?.[index]
|
|
158
157
|
const src = content?.type === "image" && typeof content.data.src === "function" ? content.data.src(row) : (content?.data as ITableImage<object>).src
|
|
@@ -121,8 +121,7 @@
|
|
|
121
121
|
}
|
|
122
122
|
})
|
|
123
123
|
|
|
124
|
-
/* Remote-режим: кадр приходит
|
|
125
|
-
object URL создаётся заново на каждый кадр и отзывается перед следующим (и при размонтировании) */
|
|
124
|
+
/* Remote-режим: кадр приходит через проп frame, object URL создаётся заново на каждый кадр и отзывается перед следующим */
|
|
126
125
|
let remoteImgSrc = $state<string | null>(null)
|
|
127
126
|
$effect(() => {
|
|
128
127
|
if (!isRemote || !frame) {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export { default as ButtonProps } from "./Button/ButtonProps.svelte";
|
|
|
5
5
|
export { default as Carousel } from "./Carousel/Carousel.svelte";
|
|
6
6
|
export { default as ColorPicker } from "./ColorPicker/ColorPicker.svelte";
|
|
7
7
|
export { default as ColorPickerProps } from "./ColorPicker/ColorPickerProps.svelte";
|
|
8
|
+
export { default as Divider } from "./Divider/Divider.svelte";
|
|
9
|
+
export { default as DividerProps } from "./Divider/DividerProps.svelte";
|
|
8
10
|
export { default as Dragging } from "./Dragging.svelte";
|
|
9
11
|
export { default as FileAttach } from "./FileAttach/FileAttach.svelte";
|
|
10
12
|
export { default as FileAttachProps } from "./FileAttach/FileAttachProps.svelte";
|
|
@@ -38,4 +40,4 @@ export { default as WidgetProps } from "./Widget/WidgetProps.svelte";
|
|
|
38
40
|
export * from "./locales/i18n";
|
|
39
41
|
export * from "./locales/translations";
|
|
40
42
|
export * from "./ModalStackStore";
|
|
41
|
-
export { type UIComponent, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type IOption, type ISwitchProps, type IColorPickerProps, type ISliderProps, type ITextFieldProps, type IMapProps, type IProgressBarProps, type IWidgetProps, type IGraphProps, type IGraphDataObject, type ITableHeader, type ITableProps, type ITabsProps, type IJoystickProps, type IFileAttachProps, type IDeviceGNSS, type ICarouselProps, type IReceivingDataObject, type IVideoViewerProps, } from "./types";
|
|
43
|
+
export { type UIComponent, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type IOption, type ISwitchProps, type IColorPickerProps, type IDividerProps, type ISliderProps, type ITextFieldProps, type IMapProps, type IProgressBarProps, type IWidgetProps, type IGraphProps, type IGraphDataObject, type ITableHeader, type ITableProps, type ITabsProps, type IJoystickProps, type IFileAttachProps, type IDeviceGNSS, type ICarouselProps, type IReceivingDataObject, type IVideoViewerProps, } from "./types";
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,8 @@ export { default as ButtonProps } from "./Button/ButtonProps.svelte";
|
|
|
6
6
|
export { default as Carousel } from "./Carousel/Carousel.svelte";
|
|
7
7
|
export { default as ColorPicker } from "./ColorPicker/ColorPicker.svelte";
|
|
8
8
|
export { default as ColorPickerProps } from "./ColorPicker/ColorPickerProps.svelte";
|
|
9
|
+
export { default as Divider } from "./Divider/Divider.svelte";
|
|
10
|
+
export { default as DividerProps } from "./Divider/DividerProps.svelte";
|
|
9
11
|
export { default as Dragging } from "./Dragging.svelte";
|
|
10
12
|
export { default as FileAttach } from "./FileAttach/FileAttach.svelte";
|
|
11
13
|
export { default as FileAttachProps } from "./FileAttach/FileAttachProps.svelte";
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Значения для каждого ключа хранятся одним кортежем [ru, en, zh] — это гарантирует,
|
|
3
|
-
* что ключ не может существовать в одном языке и отсутствовать в другом:
|
|
4
|
-
* TypeScript требует заполнить все три элемента кортежа при добавлении новой строки.
|
|
5
|
-
* Порядок элементов кортежа жёстко привязан к порядку языков в LOCALES (see i18n.ts).
|
|
6
|
-
*/
|
|
7
1
|
export type LanguageCode = "ru" | "en" | "zh";
|
|
8
2
|
declare const translations: Record<string, [string, string, string]>;
|
|
9
3
|
export default translations;
|
|
@@ -164,6 +164,13 @@ const translations = {
|
|
|
164
164
|
"constructor.props.info.bottom": ["Внизу", "Bottom", "下方"],
|
|
165
165
|
"constructor.props.info.left": ["Слева", "Left", "左侧"],
|
|
166
166
|
"constructor.props.info.right": ["Справа", "Right", "右侧"],
|
|
167
|
+
"constructor.props.divider.type": ["Тип разделителя", "Divider type", "分隔线类型"],
|
|
168
|
+
"constructor.props.divider.type.line": ["Полоса", "Line", "线条"],
|
|
169
|
+
"constructor.props.divider.type.empty": ["Пустота", "Empty", "空白"],
|
|
170
|
+
"constructor.props.divider.anchor": ["Привязка", "Anchor", "对齐位置"],
|
|
171
|
+
"constructor.props.divider.anchor.top": ["К верху", "To top", "顶部"],
|
|
172
|
+
"constructor.props.divider.anchor.center": ["По центру", "Center", "居中"],
|
|
173
|
+
"constructor.props.divider.anchor.bottom": ["К низу", "To bottom", "底部"],
|
|
167
174
|
"constructor.props.disabled": ["Отключить", "Disable", "禁用"],
|
|
168
175
|
"constructor.props.readonly": ["Только чтение", "Read only", "只读"],
|
|
169
176
|
"constructor.props.istest": ["Тестовые данные", "Test data", "测试数据"],
|
package/dist/options.d.ts
CHANGED
|
@@ -100,6 +100,16 @@ export declare const optionsStore: import("svelte/store").Readable<{
|
|
|
100
100
|
value: string;
|
|
101
101
|
name: string;
|
|
102
102
|
}[];
|
|
103
|
+
DIVIDER_TYPE_OPTIONS: {
|
|
104
|
+
id: string;
|
|
105
|
+
value: string;
|
|
106
|
+
name: string;
|
|
107
|
+
}[];
|
|
108
|
+
DIVIDER_ANCHOR_OPTIONS: {
|
|
109
|
+
id: string;
|
|
110
|
+
value: string;
|
|
111
|
+
name: string;
|
|
112
|
+
}[];
|
|
103
113
|
FITMODE_OPTIONS: {
|
|
104
114
|
id: string;
|
|
105
115
|
value: string;
|
package/dist/options.js
CHANGED
|
@@ -144,6 +144,15 @@ export const optionsStore = derived(T, ($T) => {
|
|
|
144
144
|
{ id: id(), value: "file", name: $T("constructor.props.type.file") },
|
|
145
145
|
{ id: id(), value: "image", name: $T("constructor.props.type.image") },
|
|
146
146
|
],
|
|
147
|
+
DIVIDER_TYPE_OPTIONS: [
|
|
148
|
+
{ id: id(), value: "line", name: $T("constructor.props.divider.type.line") },
|
|
149
|
+
{ id: id(), value: "empty", name: $T("constructor.props.divider.type.empty") },
|
|
150
|
+
],
|
|
151
|
+
DIVIDER_ANCHOR_OPTIONS: [
|
|
152
|
+
{ id: id(), value: "top", name: $T("constructor.props.divider.anchor.top") },
|
|
153
|
+
{ id: id(), value: "center", name: $T("constructor.props.divider.anchor.center") },
|
|
154
|
+
{ id: id(), value: "bottom", name: $T("constructor.props.divider.anchor.bottom") },
|
|
155
|
+
],
|
|
147
156
|
FITMODE_OPTIONS: [
|
|
148
157
|
{ id: id(), value: "cover", name: $T("constructor.props.type.cover") },
|
|
149
158
|
{ id: id(), value: "contain", name: $T("constructor.props.type.contain") },
|
package/dist/types.d.ts
CHANGED
|
@@ -16,10 +16,10 @@ export declare const updateComponent: (component: UIComponent, updates: Partial<
|
|
|
16
16
|
}>) => {
|
|
17
17
|
access: "full" | "viewOnly" | "hidden" | undefined;
|
|
18
18
|
name: string | undefined;
|
|
19
|
-
properties: IAccordionProps | IButtonProps | IColorPickerProps | IFileAttachProps | IGraphProps | IInputProps | IJoystickProps | IMapProps | IProgressBarProps | ISelectProps<unknown> | ISliderProps | ISwitchProps | ITableProps<object> | ITabsProps | ITextFieldProps | IWidgetProps;
|
|
19
|
+
properties: IAccordionProps | IButtonProps | IColorPickerProps | IDividerProps | IFileAttachProps | IGraphProps | IInputProps | IJoystickProps | IMapProps | IProgressBarProps | ISelectProps<unknown> | ISliderProps | ISwitchProps | ITableProps<object> | ITabsProps | ITextFieldProps | IWidgetProps;
|
|
20
20
|
eventHandler: IUIComponentHandler | undefined;
|
|
21
21
|
id: string;
|
|
22
|
-
type: "Accordion" | "Button" | "ColorPicker" | "FileAttach" | "Graph" | "Input" | "Joystick" | "Map" | "ProgressBar" | "Select" | "Slider" | "Switch" | "Table" | "Tabs" | "TextField" | "VideoViewer" | "Widget";
|
|
22
|
+
type: "Accordion" | "Button" | "ColorPicker" | "Divider" | "FileAttach" | "Graph" | "Input" | "Joystick" | "Map" | "ProgressBar" | "Select" | "Slider" | "Switch" | "Table" | "Tabs" | "TextField" | "VideoViewer" | "Widget";
|
|
23
23
|
position: Required<Position>;
|
|
24
24
|
parentId: string;
|
|
25
25
|
};
|
|
@@ -27,8 +27,8 @@ export interface UIComponent {
|
|
|
27
27
|
id: string;
|
|
28
28
|
name?: string;
|
|
29
29
|
access?: "full" | "viewOnly" | "hidden";
|
|
30
|
-
type: "Accordion" | "Button" | "ColorPicker" | "FileAttach" | "Graph" | "Input" | "Joystick" | "Map" | "ProgressBar" | "Select" | "Slider" | "Switch" | "Table" | "Tabs" | "TextField" | "VideoViewer" | "Widget";
|
|
31
|
-
properties: IAccordionProps | IButtonProps | IColorPickerProps | IFileAttachProps | IGraphProps | IInputProps | IJoystickProps | IMapProps | IProgressBarProps | ISelectProps | ISliderProps | ISwitchProps | ITableProps<object> | ITabsProps | ITextFieldProps | IWidgetProps;
|
|
30
|
+
type: "Accordion" | "Button" | "ColorPicker" | "Divider" | "FileAttach" | "Graph" | "Input" | "Joystick" | "Map" | "ProgressBar" | "Select" | "Slider" | "Switch" | "Table" | "Tabs" | "TextField" | "VideoViewer" | "Widget";
|
|
31
|
+
properties: IAccordionProps | IButtonProps | IColorPickerProps | IDividerProps | IFileAttachProps | IGraphProps | IInputProps | IJoystickProps | IMapProps | IProgressBarProps | ISelectProps | ISliderProps | ISwitchProps | ITableProps<object> | ITabsProps | ITextFieldProps | IWidgetProps;
|
|
32
32
|
position: Required<Position>;
|
|
33
33
|
parentId: string;
|
|
34
34
|
eventHandler?: IUIComponentHandler;
|
|
@@ -111,6 +111,13 @@ export interface IColorPickerProps {
|
|
|
111
111
|
readonly?: boolean;
|
|
112
112
|
onChange?: (value: number[]) => void;
|
|
113
113
|
}
|
|
114
|
+
export interface IDividerProps {
|
|
115
|
+
id?: string;
|
|
116
|
+
wrapperClass?: string;
|
|
117
|
+
type?: "line" | "empty";
|
|
118
|
+
size?: number;
|
|
119
|
+
anchor?: "top" | "center" | "bottom";
|
|
120
|
+
}
|
|
114
121
|
export interface IFileAttachProps {
|
|
115
122
|
id?: string;
|
|
116
123
|
wrapperClass?: string;
|