poe-svelte-ui-lib 2.20.2 → 2.22.0
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/README.md +3 -2
- package/dist/Table/README.md +2 -0
- package/dist/Table/Table.svelte +1 -1
- package/dist/Table/simpleSerialColumns.d.ts +6 -0
- package/dist/Table/simpleSerialColumns.js +24 -0
- package/dist/gui.d.ts +6 -0
- package/dist/gui.js +22 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +11 -1
- package/dist/libIcons/CommandListIcon.svelte +10 -0
- package/dist/libIcons/CommandListIcon.svelte.d.ts +18 -0
- package/dist/libIcons/EyeIcon.svelte +7 -0
- package/dist/libIcons/EyeIcon.svelte.d.ts +18 -0
- package/dist/libIcons/EyeSlashIcon.svelte +10 -0
- package/dist/libIcons/EyeSlashIcon.svelte.d.ts +18 -0
- package/dist/libIcons/GraphIcon.svelte +8 -0
- package/dist/libIcons/GraphIcon.svelte.d.ts +18 -0
- package/dist/libIcons/PlugIcon.svelte +13 -0
- package/dist/libIcons/PlugIcon.svelte.d.ts +18 -0
- package/dist/libIcons/RestartIcon.svelte +8 -0
- package/dist/libIcons/RestartIcon.svelte.d.ts +18 -0
- package/dist/libIcons/SendIcon.svelte +12 -0
- package/dist/libIcons/SendIcon.svelte.d.ts +18 -0
- package/dist/libIcons/ThemeIcon.svelte +9 -0
- package/dist/libIcons/ThemeIcon.svelte.d.ts +18 -0
- package/dist/libIcons/UnplugIcon.svelte +16 -0
- package/dist/libIcons/UnplugIcon.svelte.d.ts +18 -0
- package/dist/protocols/PROTOCOL.md +3 -1
- package/dist/protocols/commandSet.d.ts +34 -0
- package/dist/protocols/commandSet.js +14 -0
- package/dist/protocols/index.d.ts +2 -0
- package/dist/protocols/index.js +4 -0
- package/dist/protocols/simpleSerial.d.ts +5 -0
- package/dist/protocols/simpleSerial.js +45 -0
- package/dist/types.d.ts +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
**🗂️ Раскладка.** `Accordion`, `Tabs`, `Divider`, `Carousel`, `Modal`, `Dropdown`. У `Accordion` есть необязательный слот `actions` - кнопки справа в заголовке, нажатие на них блок не сворачивает. `Dropdown` - выпадающее меню или всплывающая панель у кнопки.
|
|
41
41
|
|
|
42
|
-
**🔣 Значки и мелочи.** Крутилка `Loader`, значок раскрытия `ExpandIcon` (вниз или вбок), подпись поля `FieldLabel` с пояснением `InfoHint` и значки библиотеки: `IconArrow`, `IconCross`, `IconClear`, `IconDelete`, `IconAdd`, `IconDownload`, `IconCopy`, `IconInfo`, `IconError`, `IconLibrary`, `IconMoveVertical`, `IconGripVerticalDual`, `IconGripVerticalLeft`, `IconGripVerticalRight
|
|
42
|
+
**🔣 Значки и мелочи.** Крутилка `Loader`, значок раскрытия `ExpandIcon` (вниз или вбок), подпись поля `FieldLabel` с пояснением `InfoHint` и значки библиотеки: `IconArrow`, `IconCross`, `IconClear`, `IconDelete`, `IconAdd`, `IconDownload`, `IconCopy`, `IconInfo`, `IconError`, `IconLibrary`, `IconMoveVertical`, `IconGripVerticalDual`, `IconGripVerticalLeft`, `IconGripVerticalRight`, а для отладочных экранов - `IconCommandList` (список команд), `IconRestart` (перезагрузка), `IconTheme` (тема), `IconEye` и `IconEyeSlash` (показать и скрыть), `IconPlug` и `IconUnplug` (подключить и отключить), `IconSend` (отправить), `IconGraph` (графики). Значки рисуются цветом текста (`currentColor`), своя ширина значка - `1em` или `1.5em` от размера текста, точный размер задаёт родитель, например `[&_svg]:size-5`. Держать их копии в приложении не нужно.
|
|
43
43
|
|
|
44
44
|
**📡 Ядро протоколов** (`poe-svelte-ui-lib/protocols`). Кодирование и разбор пакетов для всех каналов связи с устройством. Работает без Svelte, в том числе под Node.
|
|
45
45
|
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
|
|
121
121
|
## 🖥️ GUI устройства
|
|
122
122
|
|
|
123
|
-
Интерфейс, собранный в конструкторе, рисует компонент `GUIRenderer`. Он сам раскладывает блоки по сетке, берёт значения переменных, отправляет команды и ведёт смарт-виджеты и файлы. Приложению остаётся транспорт, выбор модуля, загрузка GUI и хранилище значений.
|
|
123
|
+
Интерфейс, собранный в конструкторе, рисует компонент `GUIRenderer`. Файл GUI приложение читает своим YAML, а проверяет функциями библиотеки: `toGuiFile` - есть ли список компонентов, `guiMetadataError` - какое поле метаданных неверное. Он сам раскладывает блоки по сетке, берёт значения переменных, отправляет команды и ведёт смарт-виджеты и файлы. Приложению остаётся транспорт, выбор модуля, загрузка GUI и хранилище значений.
|
|
124
124
|
|
|
125
125
|
```svelte
|
|
126
126
|
<UI.GUIRenderer
|
|
@@ -334,6 +334,7 @@ const bridge = UI.createBusBridge(channel, {
|
|
|
334
334
|
- 🐞 показывать отладочные логи `DebugLog` и графики `DebugPlot` из прошивки;
|
|
335
335
|
- 🔄 переводить значения между JSON и CBOR;
|
|
336
336
|
- 🌐 собирать и разбирать WebSocket-конверт `{HAR, VAL}` (`encodeWsEnvelope`, `decodeWsEnvelope`): команда в нём то же число `HAR`, что на шине;
|
|
337
|
+
- 📝 резать текст порта Simple Serial на строки (кириллица и строка без конца строки не теряются) и читать наборы команд отладки;
|
|
337
338
|
- 💬 показывать сообщения устройств на языке пользователя: устройство шлёт код `Message` и параметры `Args`, `formatDeviceMessage` даёт текст, уровень и группу сообщения.
|
|
338
339
|
|
|
339
340
|
Формат пакета, адресация, транспорты и список функций описаны в [PROTOCOL.md](src/lib/protocols/PROTOCOL.md).
|
package/dist/Table/README.md
CHANGED
|
@@ -192,6 +192,8 @@ const canModal = createRawSnippet((row: () => CanRow) => ({ render: () => `<div
|
|
|
192
192
|
|
|
193
193
|
Готовые колонки отладочной таблицы xPOE и её справка лежат в `xPoeDebugColumns.ts` (`xPoeDebugTableColumns`, `xPoeDebugTableHelp` - передайте в `help` таблицы), их используют облако и терминал: `TRG | SRC | Команда | Значение | FHS` (TRG, SRC и FHS - сокращения, «Команда» и «Значение» переводятся). Строки - `xPoeDebugRow` ядра протоколов.
|
|
194
194
|
|
|
195
|
+
Для Simple Serial - одна колонка `simpleSerialTableColumns` из `simpleSerialColumns.ts`: строка порта как есть, управляющие символы кодом `[0xNN]` красным, отправленная строка (`sent: true`) - зелёным. Строки - `{ data, sent? }` из `createSimpleSerialParser`.
|
|
196
|
+
|
|
195
197
|
- «Команда» - одна ячейка (`render` с `html: true`): заголовок цветной меткой (`GET` синий, `SET` оранжевый, `OK!` зелёный, `ER!` красный, `⚠️` - неверная CRC - жёлтый, `RAW` и прочие серые), рядом аргумент. Ниже мелко - `message`, сообщение устройства цветом `level` (`error` красный, `warn` жёлтый, `info` приглушённый), не больше двух строк. Подсказка при наведении - `HAR 0x....`, флаг ответа (`reply`), неверная CRC и сообщение целиком. Ширина постоянная, `tableMonoWidth(21, 7)`.
|
|
196
198
|
- «Значение» - `value`, Payload кратко как пришёл, в стиле YAML (`CFG.WiFiMode: 1, List: [1, 2]`, байты `h'0C73'`), без пояснений: копируется чистым и вставляется в поле Value тем же CBOR. Окно строки показывает Payload блочным YAML с отступом 2. `payload` - декодированный один раз при разборе, `valueBytes` - исходные байты.
|
|
197
199
|
- Окно строки (`XPoeDebugModal.svelte`) показывает Payload развёрнуто в цветах темы, сообщение (`Message`, если есть) и HEX, у каждого раздела своя кнопка копирования.
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
<div
|
|
330
330
|
data-fit={isFit(column) ? index : undefined}
|
|
331
331
|
class={twMerge(
|
|
332
|
-
`flex items-center gap-1
|
|
332
|
+
`flex items-center gap-1 px-3 py-2 ${index !== 0 ? "border-l" : ""} ${outline ? "border-(--hairline-color)" : "border-transparent"}
|
|
333
333
|
${column.align === "center" ? "justify-center text-center" : column.align === "right" ? "justify-end text-right" : "justify-start text-left"}`,
|
|
334
334
|
column.label?.class,
|
|
335
335
|
)}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* Колонка таблицы Simple Serial - общая для облака и терминала: строка порта как есть, отправленная - зелёным */
|
|
2
|
+
import { simpleSerialHtml } from "../protocols/simpleSerial.js";
|
|
3
|
+
/* Длинная строка видна целиком по клику - окно таблицы переносит её */
|
|
4
|
+
export const simpleSerialTableColumns = [
|
|
5
|
+
{
|
|
6
|
+
label: { name: "Data" },
|
|
7
|
+
content: [
|
|
8
|
+
{
|
|
9
|
+
type: "text",
|
|
10
|
+
data: {
|
|
11
|
+
key: "data",
|
|
12
|
+
render: ({ data }) => simpleSerialHtml(data),
|
|
13
|
+
html: true,
|
|
14
|
+
accent: (row) => (row.sent ? "green" : undefined),
|
|
15
|
+
truncated: true,
|
|
16
|
+
copy: true,
|
|
17
|
+
modal: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
width: "1fr",
|
|
22
|
+
align: "left",
|
|
23
|
+
},
|
|
24
|
+
];
|
package/dist/gui.d.ts
CHANGED
|
@@ -167,3 +167,9 @@ export declare const layoutColumns: (list: UIComponent[], total: number) => stri
|
|
|
167
167
|
export declare const guiTypes: (components: readonly {
|
|
168
168
|
type: UIType;
|
|
169
169
|
}[]) => UIType[];
|
|
170
|
+
export interface GuiFile {
|
|
171
|
+
metadata: Record<string, unknown>;
|
|
172
|
+
components: UIComponent[];
|
|
173
|
+
}
|
|
174
|
+
export declare const toGuiFile: (data: unknown) => GuiFile | null;
|
|
175
|
+
export declare const guiMetadataError: (metadata: unknown) => "metadata" | "DevID" | "VerFW" | "Author" | "Date" | null;
|
package/dist/gui.js
CHANGED
|
@@ -337,3 +337,25 @@ export const layoutColumns = (list, total) => {
|
|
|
337
337
|
};
|
|
338
338
|
/* Типы компонентов, которые встречаются в GUI (по порядку первого появления): по ним приложение собирает views для GUIRenderer, чтобы в сборку попали только они */
|
|
339
339
|
export const guiTypes = (components) => [...new Set(components.map((component) => component.type))];
|
|
340
|
+
/* Разобранный YAML в файл GUI; нет списка components - null */
|
|
341
|
+
export const toGuiFile = (data) => {
|
|
342
|
+
if (!data || typeof data !== "object" || !Array.isArray(data.components))
|
|
343
|
+
return null;
|
|
344
|
+
const { metadata } = data;
|
|
345
|
+
return { metadata: metadata && typeof metadata === "object" ? metadata : {}, components: data.components };
|
|
346
|
+
};
|
|
347
|
+
/* Метаданные файла GUI или набора команд: имя неверного поля (metadata, DevID, VerFW, Author, Date) или null */
|
|
348
|
+
export const guiMetadataError = (metadata) => {
|
|
349
|
+
if (!metadata || typeof metadata !== "object")
|
|
350
|
+
return "metadata";
|
|
351
|
+
const { DevID, VerFW, Author, Date } = metadata;
|
|
352
|
+
if (typeof DevID !== "string" || !DevID.trim())
|
|
353
|
+
return "DevID";
|
|
354
|
+
if (typeof VerFW !== "number" || VerFW <= 0)
|
|
355
|
+
return "VerFW";
|
|
356
|
+
if (typeof Author !== "string" || !Author.trim())
|
|
357
|
+
return "Author";
|
|
358
|
+
if (typeof Date !== "string" || !/^\d{4}-\d{2}-\d{2}$/.test(Date))
|
|
359
|
+
return "Date";
|
|
360
|
+
return null;
|
|
361
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export { default as Table } from "./Table/Table.svelte";
|
|
|
23
23
|
export { tableMonoWidth } from "./Table/columnWidth";
|
|
24
24
|
export { default as TableColumns } from "./Table/TableColumns.svelte";
|
|
25
25
|
export { columnId, defaultHiddenColumns } from "./Table/columns";
|
|
26
|
+
export { simpleSerialTableColumns, type SimpleSerialRow } from "./Table/simpleSerialColumns";
|
|
26
27
|
export { xPoeDebugTableColumns, xPoeDebugTableHelp } from "./Table/xPoeDebugColumns";
|
|
27
28
|
export { bitFieldGet, bitFieldSet } from "./bitField";
|
|
28
29
|
export { default as Tabs } from "./Tabs/Tabs.svelte";
|
|
@@ -53,7 +54,7 @@ export { createBusBridge, busIdFromSN, type BusBridge, type BusBridgeOptions, ty
|
|
|
53
54
|
export { GUI_VIEWS, type GuiViews } from "./guiViews";
|
|
54
55
|
export { COMPONENTS, type ComponentEntry } from "./registry";
|
|
55
56
|
export { COMPONENT_META, componentVariables, type ComponentMeta, type ComponentIO } from "./componentMeta";
|
|
56
|
-
export { GUI_GRID, isWidgetType, spanRows, WIDGET_FIELDS, WIDGET_SAVE_FIELDS, widgetKey, widgetPrefixes, readWidgetFields, widgetPacket, bitRange, readBits, writeBits, commandPacket, tablePacket, mergeDevicePayload, type WidgetFieldsType, type DeviceLink, type DevicePacket, } from "./gui";
|
|
57
|
+
export { GUI_GRID, isWidgetType, spanRows, WIDGET_FIELDS, WIDGET_SAVE_FIELDS, widgetKey, widgetPrefixes, readWidgetFields, widgetPacket, bitRange, readBits, writeBits, commandPacket, tablePacket, mergeDevicePayload, toGuiFile, guiMetadataError, type GuiFile, type WidgetFieldsType, type DeviceLink, type DevicePacket, } from "./gui";
|
|
57
58
|
export { createFsTransfer, sendCommand, argumentCode, FsTransferError, FsNameError, type FsErrorCode, type DeviceReply, type DeviceTransport, type FsTransfer, type FsTransferOptions, type FsProgress, } from "./fsTransfer";
|
|
58
59
|
export { copyText } from "./clipboard";
|
|
59
60
|
export { default as Icon } from "./Icon.svelte";
|
|
@@ -69,6 +70,15 @@ export { default as IconInfo } from "./libIcons/InfoIcon.svelte";
|
|
|
69
70
|
export { default as IconError } from "./libIcons/Error.svelte";
|
|
70
71
|
export { default as IconLibrary } from "./libIcons/Library.svelte";
|
|
71
72
|
export { default as IconMoveVertical } from "./libIcons/MoveVerticalIcon.svelte";
|
|
73
|
+
export { default as IconCommandList } from "./libIcons/CommandListIcon.svelte";
|
|
74
|
+
export { default as IconRestart } from "./libIcons/RestartIcon.svelte";
|
|
75
|
+
export { default as IconTheme } from "./libIcons/ThemeIcon.svelte";
|
|
76
|
+
export { default as IconEye } from "./libIcons/EyeIcon.svelte";
|
|
77
|
+
export { default as IconEyeSlash } from "./libIcons/EyeSlashIcon.svelte";
|
|
78
|
+
export { default as IconPlug } from "./libIcons/PlugIcon.svelte";
|
|
79
|
+
export { default as IconUnplug } from "./libIcons/UnplugIcon.svelte";
|
|
80
|
+
export { default as IconSend } from "./libIcons/SendIcon.svelte";
|
|
81
|
+
export { default as IconGraph } from "./libIcons/GraphIcon.svelte";
|
|
72
82
|
export { default as IconGripVerticalDual } from "./libIcons/IconGripVerticalDual.svelte";
|
|
73
83
|
export { default as IconGripVerticalLeft } from "./libIcons/IconGripVerticalLeft.svelte";
|
|
74
84
|
export { default as IconGripVerticalRight } from "./libIcons/IconGripVerticalRight.svelte";
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export { default as Table } from "./Table/Table.svelte";
|
|
|
24
24
|
export { tableMonoWidth } from "./Table/columnWidth";
|
|
25
25
|
export { default as TableColumns } from "./Table/TableColumns.svelte";
|
|
26
26
|
export { columnId, defaultHiddenColumns } from "./Table/columns";
|
|
27
|
+
export { simpleSerialTableColumns } from "./Table/simpleSerialColumns";
|
|
27
28
|
export { xPoeDebugTableColumns, xPoeDebugTableHelp } from "./Table/xPoeDebugColumns";
|
|
28
29
|
export { bitFieldGet, bitFieldSet } from "./bitField";
|
|
29
30
|
export { default as Tabs } from "./Tabs/Tabs.svelte";
|
|
@@ -54,7 +55,7 @@ export { createBusBridge, busIdFromSN } from "./busBridge";
|
|
|
54
55
|
export { GUI_VIEWS } from "./guiViews";
|
|
55
56
|
export { COMPONENTS } from "./registry";
|
|
56
57
|
export { COMPONENT_META, componentVariables } from "./componentMeta";
|
|
57
|
-
export { GUI_GRID, isWidgetType, spanRows, WIDGET_FIELDS, WIDGET_SAVE_FIELDS, widgetKey, widgetPrefixes, readWidgetFields, widgetPacket, bitRange, readBits, writeBits, commandPacket, tablePacket, mergeDevicePayload, } from "./gui";
|
|
58
|
+
export { GUI_GRID, isWidgetType, spanRows, WIDGET_FIELDS, WIDGET_SAVE_FIELDS, widgetKey, widgetPrefixes, readWidgetFields, widgetPacket, bitRange, readBits, writeBits, commandPacket, tablePacket, mergeDevicePayload, toGuiFile, guiMetadataError, } from "./gui";
|
|
58
59
|
export { createFsTransfer, sendCommand, argumentCode, FsTransferError, FsNameError, } from "./fsTransfer";
|
|
59
60
|
export { copyText } from "./clipboard";
|
|
60
61
|
export { default as Icon } from "./Icon.svelte";
|
|
@@ -71,6 +72,15 @@ export { default as IconInfo } from "./libIcons/InfoIcon.svelte";
|
|
|
71
72
|
export { default as IconError } from "./libIcons/Error.svelte";
|
|
72
73
|
export { default as IconLibrary } from "./libIcons/Library.svelte";
|
|
73
74
|
export { default as IconMoveVertical } from "./libIcons/MoveVerticalIcon.svelte";
|
|
75
|
+
export { default as IconCommandList } from "./libIcons/CommandListIcon.svelte";
|
|
76
|
+
export { default as IconRestart } from "./libIcons/RestartIcon.svelte";
|
|
77
|
+
export { default as IconTheme } from "./libIcons/ThemeIcon.svelte";
|
|
78
|
+
export { default as IconEye } from "./libIcons/EyeIcon.svelte";
|
|
79
|
+
export { default as IconEyeSlash } from "./libIcons/EyeSlashIcon.svelte";
|
|
80
|
+
export { default as IconPlug } from "./libIcons/PlugIcon.svelte";
|
|
81
|
+
export { default as IconUnplug } from "./libIcons/UnplugIcon.svelte";
|
|
82
|
+
export { default as IconSend } from "./libIcons/SendIcon.svelte";
|
|
83
|
+
export { default as IconGraph } from "./libIcons/GraphIcon.svelte";
|
|
74
84
|
export { default as IconGripVerticalDual } from "./libIcons/IconGripVerticalDual.svelte";
|
|
75
85
|
export { default as IconGripVerticalLeft } from "./libIcons/IconGripVerticalLeft.svelte";
|
|
76
86
|
export { default as IconGripVerticalRight } from "./libIcons/IconGripVerticalRight.svelte";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"
|
|
4
|
+
><path
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
fill-rule="evenodd"
|
|
7
|
+
d="M11.943 1.25h.114c2.309 0 4.118 0 5.53.19c1.444.194 2.584.6 3.479 1.494c.895.895 1.3 2.035 1.494 3.48c.19 1.411.19 3.22.19 5.529v.114c0 2.309 0 4.118-.19 5.53c-.194 1.444-.6 2.584-1.494 3.479c-.895.895-2.035 1.3-3.48 1.494c-1.411.19-3.22.19-5.529.19h-.114c-2.309 0-4.118 0-5.53-.19c-1.444-.194-2.584-.6-3.479-1.494c-.895-.895-1.3-2.035-1.494-3.48c-.19-1.411-.19-3.22-.19-5.529v-.114c0-2.309 0-4.118.19-5.53c.194-1.444.6-2.584 1.494-3.479c.895-.895 2.035-1.3 3.48-1.494c1.411-.19 3.22-.19 5.529-.19m-5.33 1.676c-1.278.172-2.049.5-2.618 1.069c-.57.57-.897 1.34-1.069 2.619c-.174 1.3-.176 3.008-.176 5.386s.002 4.086.176 5.386c.172 1.279.5 2.05 1.069 2.62c.57.569 1.34.896 2.619 1.068c1.3.174 3.008.176 5.386.176s4.086-.002 5.386-.176c1.279-.172 2.05-.5 2.62-1.069c.569-.57.896-1.34 1.068-2.619c.174-1.3.176-3.008.176-5.386s-.002-4.086-.176-5.386c-.172-1.279-.5-2.05-1.069-2.62c-.57-.569-1.34-.896-2.619-1.068c-1.3-.174-3.008-.176-5.386-.176s-4.086.002-5.386.176m3.904 3.53a.75.75 0 0 1 .026 1.061l-2.857 3a.75.75 0 0 1-1.086 0l-1.143-1.2a.75.75 0 1 1 1.086-1.034l.6.63l2.314-2.43a.75.75 0 0 1 1.06-.026M12.25 9a.75.75 0 0 1 .75-.75h5a.75.75 0 0 1 0 1.5h-5a.75.75 0 0 1-.75-.75m-1.733 4.457c.3.286.312.76.026 1.06l-2.857 3a.75.75 0 0 1-1.086 0l-1.143-1.2a.75.75 0 1 1 1.086-1.034l.6.63l2.314-2.43a.75.75 0 0 1 1.06-.026M12.25 16a.75.75 0 0 1 .75-.75h5a.75.75 0 0 1 0 1.5h-5a.75.75 0 0 1-.75-.75"
|
|
8
|
+
clip-rule="evenodd"
|
|
9
|
+
/></svg
|
|
10
|
+
>
|
|
@@ -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 CommandListIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type CommandListIcon = InstanceType<typeof CommandListIcon>;
|
|
18
|
+
export default CommandListIcon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"
|
|
4
|
+
><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
|
|
5
|
+
><path d="M15 12a3 3 0 1 1-6 0a3 3 0 0 1 6 0" /><path d="M2 12c1.6-4.097 5.336-7 10-7s8.4 2.903 10 7c-1.6 4.097-5.336 7-10 7s-8.4-2.903-10-7" /></g
|
|
6
|
+
></svg
|
|
7
|
+
>
|
|
@@ -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 EyeIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type EyeIcon = InstanceType<typeof EyeIcon>;
|
|
18
|
+
export default EyeIcon;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"
|
|
4
|
+
><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
|
|
5
|
+
><path
|
|
6
|
+
stroke-linejoin="round"
|
|
7
|
+
d="M10.73 5.073A11 11 0 0 1 12 5c4.664 0 8.4 2.903 10 7a11.6 11.6 0 0 1-1.555 2.788M6.52 6.519C4.48 7.764 2.9 9.693 2 12c1.6 4.097 5.336 7 10 7a10.44 10.44 0 0 0 5.48-1.52m-7.6-7.6a3 3 0 1 0 4.243 4.243"
|
|
8
|
+
/><path d="m4 4l16 16" /></g
|
|
9
|
+
></svg
|
|
10
|
+
>
|
|
@@ -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 EyeSlashIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type EyeSlashIcon = InstanceType<typeof EyeSlashIcon>;
|
|
18
|
+
export default EyeSlashIcon;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"
|
|
4
|
+
><path
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
d="M2 3a1 1 0 0 1 2 0v10.365l2.217-1.846l.334-.266c.786-.59 1.61-.966 2.512-.91c1.021.066 1.864.67 2.62 1.426l.007.006l.25.239c.556.499.909.61 1.143.614c.28.004.7-.142 1.413-.766l5.846-5.115a1 1 0 0 1 1.316 1.506l-5.846 5.114c-.818.716-1.716 1.274-2.754 1.26c-.92-.011-1.723-.465-2.467-1.137l-.316-.3l-.006-.007c-.655-.655-1.055-.826-1.332-.843c-.234-.015-.59.067-1.175.505l-.265.21l-3.491 2.908c.006.463.018.849.045 1.182c.05.606.142.954.276 1.217l.115.206c.289.47.702.853 1.196 1.105l.103.049c.251.108.584.184 1.113.227C7.471 20 8.264 20 9.4 20H21l.102.005a1 1 0 0 1 0 1.99L21 22H9.4c-1.103 0-1.991.001-2.709-.058c-.637-.052-1.208-.154-1.737-.381l-.224-.106a5 5 0 0 1-2.092-2.01l-.093-.175c-.302-.593-.428-1.233-.487-1.961a24 24 0 0 1-.053-1.714a1 1 0 0 1-.001-.185Q2 15.026 2 14.6z"
|
|
7
|
+
/></svg
|
|
8
|
+
>
|
|
@@ -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 GraphIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type GraphIcon = InstanceType<typeof GraphIcon>;
|
|
18
|
+
export default GraphIcon;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width="1.5em"
|
|
6
|
+
height="1.5em"
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
fill="none"
|
|
9
|
+
stroke="currentColor"
|
|
10
|
+
stroke-width="2"
|
|
11
|
+
stroke-linecap="round"
|
|
12
|
+
stroke-linejoin="round"><path d="M12 22v-5" /><path d="M9 8V2" /><path d="M15 8V2" /><path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z" /></svg
|
|
13
|
+
>
|
|
@@ -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 PlugIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type PlugIcon = InstanceType<typeof PlugIcon>;
|
|
18
|
+
export default PlugIcon;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"
|
|
4
|
+
><path
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
d="M9.825 20.7q-2.575-.725-4.2-2.837T4 13q0-1.425.475-2.713t1.35-2.362q.275-.3.675-.313t.725.313q.275.275.288.675t-.263.75q-.6.775-.925 1.7T6 13q0 2.025 1.188 3.613t3.062 2.162q.325.1.538.375t.212.6q0 .5-.35.788t-.825.162m4.35 0q-.475.125-.825-.175t-.35-.8q0-.3.213-.575t.537-.375q1.875-.6 3.063-2.175T18 13q0-2.5-1.75-4.25T12 7h-.075l.4.4q.275.275.275.7t-.275.7t-.7.275t-.7-.275l-2.1-2.1q-.15-.15-.212-.325T8.55 6t.063-.375t.212-.325l2.1-2.1q.275-.275.7-.275t.7.275t.275.7t-.275.7l-.4.4H12q3.35 0 5.675 2.325T20 13q0 2.725-1.625 4.85t-4.2 2.85"
|
|
7
|
+
/></svg
|
|
8
|
+
>
|
|
@@ -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 RestartIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type RestartIcon = InstanceType<typeof RestartIcon>;
|
|
18
|
+
export default RestartIcon;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"
|
|
4
|
+
><path
|
|
5
|
+
fill="none"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
stroke-linecap="round"
|
|
8
|
+
stroke-linejoin="round"
|
|
9
|
+
stroke-width="1.5"
|
|
10
|
+
d="M14.76 12H6.832m0 0c0-.275-.057-.55-.17-.808L4.285 5.814c-.76-1.72 1.058-3.442 2.734-2.591L20.8 10.217c1.46.74 1.46 2.826 0 3.566L7.02 20.777c-1.677.851-3.495-.872-2.735-2.591l2.375-5.378A2 2 0 0 0 6.83 12"
|
|
11
|
+
/></svg
|
|
12
|
+
>
|
|
@@ -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 SendIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type SendIcon = InstanceType<typeof SendIcon>;
|
|
18
|
+
export default SendIcon;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"
|
|
4
|
+
><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"
|
|
5
|
+
><path d="M9.173 14.83a4 4 0 1 1 5.657-5.657" /><path
|
|
6
|
+
d="m11.294 12.707l.174.247a7.5 7.5 0 0 0 8.845 2.492A9 9 0 0 1 5.642 18.36M3 12h1m8-9v1M5.6 5.6l.7.7M3 21L21 3"
|
|
7
|
+
/></g
|
|
8
|
+
></svg
|
|
9
|
+
>
|
|
@@ -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 ThemeIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type ThemeIcon = InstanceType<typeof ThemeIcon>;
|
|
18
|
+
export default ThemeIcon;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width="1.5em"
|
|
6
|
+
height="1.5em"
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
fill="none"
|
|
9
|
+
stroke="currentColor"
|
|
10
|
+
stroke-width="2"
|
|
11
|
+
stroke-linecap="round"
|
|
12
|
+
stroke-linejoin="round"
|
|
13
|
+
><path d="m19 5 3-3" /><path d="m2 22 3-3" /><path d="M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z" /><path
|
|
14
|
+
d="M7.5 13.5 10 11"
|
|
15
|
+
/><path d="M10.5 16.5 13 14" /><path d="m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z" /></svg
|
|
16
|
+
>
|
|
@@ -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 UnplugIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type UnplugIcon = InstanceType<typeof UnplugIcon>;
|
|
18
|
+
export default UnplugIcon;
|
|
@@ -518,9 +518,11 @@ const message = decodeWsEnvelope(cborToValue(new Uint8Array(event.data)))
|
|
|
518
518
|
| Ответ | `API_Service_BeginResponse`, `Writer_*`, `API_Service_FinishResponse` | |
|
|
519
519
|
| Консоль | `LOG_*`, `LOG_HEX`, `LOG_PLOT` | `encodeXPoeDebugFrame`, `xPoeDebugRow`, `xPoeDebugTableColumns`, `debugPlotValues`, `parseDebugLogMessage`, `xPoeDebugMessage` |
|
|
520
520
|
| CAN | `can_service` | `encodeCanPacket`, `createCanParser`, `slcanOpenCommands` |
|
|
521
|
+
| Текст | `UART_Send` в `uart_service`, консоль загрузчика | `createSimpleSerialParser`, `simpleSerialHtml`, `simpleSerialTableColumns` |
|
|
522
|
+
| Команды | `SC-Preset.yaml` устройства, наборы команд DevCloud и DevTerminal | `normalizeSavedCommands`, типы `ISavedCommands`, `ISimpleSerial`, `IXPoeDebug`, `IPOECanable` |
|
|
521
523
|
| Тесты | `tests/` прошивок | `npm run Test` сверяет байты с эталонами из прошивки |
|
|
522
524
|
|
|
523
|
-
`xPoeDebugTableColumns` - колонки таблицы `Table`, поэтому
|
|
525
|
+
`xPoeDebugTableColumns` и `simpleSerialTableColumns` - колонки таблицы `Table`, поэтому они экспортируются из основной точки входа `poe-svelte-ui-lib`, а не из `poe-svelte-ui-lib/protocols`.
|
|
524
526
|
|
|
525
527
|
</details>
|
|
526
528
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AccentColor } from "../accent.js";
|
|
2
|
+
interface ICommandBase {
|
|
3
|
+
name: string;
|
|
4
|
+
isShown: boolean;
|
|
5
|
+
color: AccentColor;
|
|
6
|
+
}
|
|
7
|
+
export interface ISimpleSerial extends ICommandBase {
|
|
8
|
+
data: string;
|
|
9
|
+
endPackage: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IXPoeDebug extends ICommandBase {
|
|
12
|
+
header: string;
|
|
13
|
+
argument: string;
|
|
14
|
+
TrgBusID: string;
|
|
15
|
+
SrcBusID: string;
|
|
16
|
+
Reply: boolean;
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
19
|
+
export interface IPOECanable extends ICommandBase {
|
|
20
|
+
header: string;
|
|
21
|
+
argument: string;
|
|
22
|
+
TrgBusID: string;
|
|
23
|
+
SrcBusID: string;
|
|
24
|
+
Reply: boolean;
|
|
25
|
+
data: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ISavedCommands {
|
|
28
|
+
SimpleSerial: ISimpleSerial[];
|
|
29
|
+
"xPOE-Debug": IXPoeDebug[];
|
|
30
|
+
POECanable: IPOECanable[];
|
|
31
|
+
}
|
|
32
|
+
export declare const COMMAND_SET_PROTOCOLS: readonly ["SimpleSerial", "xPOE-Debug", "POECanable"];
|
|
33
|
+
export declare const normalizeSavedCommands: (data: unknown) => ISavedCommands | null;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const COMMAND_SET_PROTOCOLS = ["SimpleSerial", "xPOE-Debug", "POECanable"];
|
|
2
|
+
/* Адреса по умолчанию: консоль - модуль консоли (0000), шины - всем (FFFF); отправитель 0000 - внешний клиент */
|
|
3
|
+
const DEFAULT_TRG = { "xPOE-Debug": "0000", POECanable: "FFFF" };
|
|
4
|
+
const isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
5
|
+
const isCommand = (value) => isRecord(value) && typeof value.name === "string";
|
|
6
|
+
/* Команды набора с заполненными адресами и флагом ответа; не набор (нет любого из трёх списков или команда без имени) - null */
|
|
7
|
+
export const normalizeSavedCommands = (data) => {
|
|
8
|
+
if (!isRecord(data) || !COMMAND_SET_PROTOCOLS.every((protocol) => Array.isArray(data[protocol]) && data[protocol].every(isCommand)))
|
|
9
|
+
return null;
|
|
10
|
+
const fill = (protocol) => data[protocol].map((command) => protocol in DEFAULT_TRG
|
|
11
|
+
? { ...command, TrgBusID: command.TrgBusID ?? DEFAULT_TRG[protocol], SrcBusID: command.SrcBusID ?? "0000", Reply: command.Reply ?? true }
|
|
12
|
+
: command);
|
|
13
|
+
return { SimpleSerial: fill("SimpleSerial"), "xPOE-Debug": fill("xPOE-Debug"), POECanable: fill("POECanable") };
|
|
14
|
+
};
|
|
@@ -11,3 +11,5 @@ export { CAN_FINAL_BIT, CAN_PACKET_ID_MASK, canFragments, encodeSlcanFrame, enco
|
|
|
11
11
|
export { HEADER_CODES, DEFAULT_ARGUMENT_CODES, DEFAULT_DICTIONARY, createDictionary, encodeHar, decodeHar, type Dictionary, type HarParts, } from "./dictionary.js";
|
|
12
12
|
export { encodeWsEnvelope, decodeWsEnvelope, type WsEnvelope, type WsMessage } from "./wsEnvelope.js";
|
|
13
13
|
export { formatDeviceMessage, parseDebugLogMessage, DEVICE_MESSAGES, MESSAGE_CODES, MESSAGE_GROUPS, type DeviceMessage, type DeviceMessageEntry, type DeviceMessageGroup, type DeviceMessageLevel, type FormattedDeviceMessage, } from "./messages.js";
|
|
14
|
+
export { createSimpleSerialParser, simpleSerialHtml } from "./simpleSerial.js";
|
|
15
|
+
export { COMMAND_SET_PROTOCOLS, normalizeSavedCommands, type ISavedCommands, type ISimpleSerial, type IXPoeDebug, type IPOECanable } from "./commandSet.js";
|
package/dist/protocols/index.js
CHANGED
|
@@ -22,3 +22,7 @@ export { HEADER_CODES, DEFAULT_ARGUMENT_CODES, DEFAULT_DICTIONARY, createDiction
|
|
|
22
22
|
export { encodeWsEnvelope, decodeWsEnvelope } from "./wsEnvelope.js";
|
|
23
23
|
/* Сообщения устройств: Message - код из мастер-словаря dictionaries/messages.yaml (коды по группам MESSAGE_GROUPS), Args - параметры; текст на языке, уровень и группа */
|
|
24
24
|
export { formatDeviceMessage, parseDebugLogMessage, DEVICE_MESSAGES, MESSAGE_CODES, MESSAGE_GROUPS, } from "./messages.js";
|
|
25
|
+
/* Simple Serial: текст порта построчно и строка журнала с кодами управляющих символов */
|
|
26
|
+
export { createSimpleSerialParser, simpleSerialHtml } from "./simpleSerial.js";
|
|
27
|
+
/* Набор команд отладки (SC-Preset.yaml, файлы команд DevCloud и DevTerminal): типы и заполнение адресов по умолчанию */
|
|
28
|
+
export { COMMAND_SET_PROTOCOLS, normalizeSavedCommands } from "./commandSet.js";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* Simple Serial - текст порта построчно: разбор потока байтов на строки и строка для таблицы журнала; без Svelte, общий для DevTerminal и отладки DevCloud */
|
|
2
|
+
import { escapeHtml } from "../html.js";
|
|
3
|
+
/* Строки из сырых байтов порта: конец строки \r или \n, пустые пропускаются, хвост без конца строки уходит после паузы idleMs; UTF-8 по кускам не рвётся */
|
|
4
|
+
export const createSimpleSerialParser = (onLines, idleMs = 300) => {
|
|
5
|
+
const decoder = new TextDecoder();
|
|
6
|
+
let tail = "";
|
|
7
|
+
let timer;
|
|
8
|
+
const flushTail = () => {
|
|
9
|
+
timer = undefined;
|
|
10
|
+
tail += decoder.decode();
|
|
11
|
+
if (tail)
|
|
12
|
+
onLines([tail]);
|
|
13
|
+
tail = "";
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
push(bytes) {
|
|
17
|
+
clearTimeout(timer);
|
|
18
|
+
const parts = (tail + decoder.decode(bytes, { stream: true })).split(/\r|\n/);
|
|
19
|
+
tail = parts.pop() ?? "";
|
|
20
|
+
const lines = parts.filter((line) => line !== "");
|
|
21
|
+
if (lines.length)
|
|
22
|
+
onLines(lines);
|
|
23
|
+
if (tail)
|
|
24
|
+
timer = setTimeout(flushTail, idleMs);
|
|
25
|
+
},
|
|
26
|
+
reset() {
|
|
27
|
+
clearTimeout(timer);
|
|
28
|
+
timer = undefined;
|
|
29
|
+
tail = "";
|
|
30
|
+
decoder.decode();
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/* Строка журнала в HTML: управляющие символы (C0, DEL, C1) - кодом [0xNN] красным, остальное, включая кириллицу, - экранированным текстом */
|
|
35
|
+
export const simpleSerialHtml = (text) => {
|
|
36
|
+
let html = "";
|
|
37
|
+
for (const char of text) {
|
|
38
|
+
const code = char.charCodeAt(0);
|
|
39
|
+
html +=
|
|
40
|
+
code < 32 || (code >= 127 && code <= 159)
|
|
41
|
+
? `<span class="text-(--red-text)">[0x${code.toString(16).padStart(2, "0").toUpperCase()}]</span>`
|
|
42
|
+
: escapeHtml(char);
|
|
43
|
+
}
|
|
44
|
+
return html;
|
|
45
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Snippet } from "svelte";
|
|
1
|
+
import type { Component, Snippet } from "svelte";
|
|
2
2
|
import type { AccentColor } from "./accent";
|
|
3
3
|
import type { IMissionPlan } from "./WidgetMap/mission/plan";
|
|
4
4
|
import type { IRoutePlan } from "./WidgetMap/mission/route";
|
|
@@ -8,7 +8,7 @@ export type { AccentColor } from "./accent";
|
|
|
8
8
|
export type { PropertyChange } from "./propsEditor";
|
|
9
9
|
export type { IWidgetWiFiConfig, IWidgetDeviceInfoConfig, IWidgetRGBStripConfig, IWidgetPFDData, IWidgetMapData } from "./gui";
|
|
10
10
|
export type { LoRaParams, LoRaParam, LoRaValues, ILoRaParamConfig, ILoRaOption } from "./WidgetLoRa/lora";
|
|
11
|
-
export type IconSource =
|
|
11
|
+
export type IconSource = Component<any> | string;
|
|
12
12
|
export interface UIComponentPropsMap {
|
|
13
13
|
Accordion: IAccordionProps;
|
|
14
14
|
Button: IButtonProps;
|
|
@@ -437,7 +437,7 @@ export interface ITableSelect<T extends object> {
|
|
|
437
437
|
}
|
|
438
438
|
export interface ITableButton<T extends object> {
|
|
439
439
|
name?: string | ((row: T) => string);
|
|
440
|
-
icon?:
|
|
440
|
+
icon?: IconSource;
|
|
441
441
|
title?: string | ((row: T) => string);
|
|
442
442
|
class?: string | ((row: T) => string);
|
|
443
443
|
eventHandler?: IUIComponentHandler;
|
|
@@ -459,7 +459,7 @@ export interface ITableImage<T extends object> {
|
|
|
459
459
|
class?: string;
|
|
460
460
|
width?: string;
|
|
461
461
|
height?: string;
|
|
462
|
-
defaultIcon?:
|
|
462
|
+
defaultIcon?: IconSource;
|
|
463
463
|
}
|
|
464
464
|
export interface ITableMenu<T extends object> {
|
|
465
465
|
icon?: IconSource;
|