poe-svelte-ui-lib 2.14.1 → 2.15.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 CHANGED
@@ -28,6 +28,7 @@
28
28
 
29
29
  - 📶 `WidgetWiFi` - режим сети, подключение к точке доступа, своя точка доступа, поиск сетей.
30
30
  - 🪪 `WidgetDeviceInfo` - паспорт устройства, основные настройки, перезагрузка.
31
+ - 📡 `WidgetLoRa` - настройки радио LoRa любой микросхемы: где лежит каждый параметр, задаётся в конструкторе.
31
32
  - 🗂️ `WidgetFileSystem` - занятая память, список файлов, загрузка и удаление.
32
33
  - 🧠 `WidgetStackInfo` - свободная память и запас стека задач, для отладки.
33
34
  - 🌈 `WidgetRGBStrip` - адресная светодиодная лента: цвет, эффекты, параметры.
@@ -27,6 +27,7 @@
27
27
  type DeviceLink,
28
28
  type DevicePacket,
29
29
  } from "../gui"
30
+ import { loraKeys } from "../WidgetLoRa/lora"
30
31
  import { COMPONENT_META } from "../componentMeta"
31
32
  import DeviceTable from "./DeviceTable.svelte"
32
33
  import type { GuiViews } from "../guiViews"
@@ -422,6 +423,17 @@
422
423
  onRestart={locked ? undefined : () => send(props.restartCommand?.header || "SET", props.restartCommand?.argument || "Restart", {})}
423
424
  onFactoryReset={locked ? undefined : () => send(props.resetCommand?.header || "SET", props.resetCommand?.argument || "RstNVS", {})}
424
425
  />
426
+ {:else if component.type === "WidgetLoRa" && views.WidgetLoRa}
427
+ {@const WidgetLoRa = views.WidgetLoRa}
428
+ {@const props = component.properties}
429
+ {@const prefix = props.id || "LORA"}
430
+ {@const keys = loraKeys(props.params ?? {})}
431
+ <WidgetLoRa
432
+ {...props}
433
+ value={stable(`${component.id}|${prefix}`, Object.fromEntries(keys.map((key) => [key, get(widgetKey(prefix, key))])))}
434
+ persistKey={persist(component)}
435
+ onSave={locked ? undefined : (values) => saveFields(prefix, Object.keys(values), values)}
436
+ />
425
437
  {:else if component.type === "WidgetFileSystem" && views.WidgetFileSystem}
426
438
  {@const WidgetFileSystem = views.WidgetFileSystem}
427
439
  {@const props = component.properties}
@@ -5,7 +5,7 @@
5
5
  ## ✨ Что умеет
6
6
 
7
7
  - 📄 Показывает список строк, которые прислало устройство: одна строка на запись.
8
- - 🔘 В ячейке может стоять кнопка: таблица сообщает приложению, какая кнопка нажата и в какой строке, команду отправляет приложение.
8
+ - 🔘 В ячейке может стоять кнопка: таблица сообщает приложению, какая кнопка нажата и в какой строке, команду отправляет приложение. При нажатии кнопка слегка сжимается и темнеет, как обычная `Button`.
9
9
  - ⋯ В ячейке может стоять меню действий строки (кнопка «⋯» и пункты `Dropdown`), например «Изменить» и красное «Удалить».
10
10
  - 🔽 Можно выбрать значение из списка прямо в ячейке.
11
11
  - 📊 Число можно показать полосой прогресса с единицами измерения.
@@ -135,14 +135,14 @@
135
135
 
136
136
  ### Содержимое ячейки `ITableContent`
137
137
 
138
- | `type` | Поля `data` |
139
- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
140
- | `text` | `key`, `render(row)`, `href(row)`, `html`, `sortable`, `truncated`, `tooltip` (`true` или функция от строки), `copy`, `modal` (`true` или сниппет), `accent(row)`, `badge`, `onClick(row)` |
141
- | `button` | `name`, `icon`, `title`, `class` (строки или функции от строки), `eventHandler`, `onClick(row)`. У кнопки-иконки без `name` обязательно `title`. Весь `data` может быть функцией от строки |
142
- | `select` | `key` (массив вариантов в строке), `keyCol`, `onChange` |
143
- | `menu` | `items(row)` - пункты `Dropdown` для строки, `icon` (по умолчанию «⋯», `IconMore`), `title`. Только из кода приложения, в конструкторе нет; удаление - пункт с `accent: "red"` |
144
- | `progressBar` | `key`, `minNum`, `maxNum`, `units` |
145
- | `image` | `src` (строка или функция), `alt`, `class`, `width`, `height`, `defaultIcon` |
138
+ | `type` | Поля `data` |
139
+ | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
140
+ | `text` | `key`, `render(row)`, `href(row)`, `html`, `sortable`, `truncated`, `tooltip` (`true` или функция от строки), `copy`, `modal` (`true` или сниппет), `accent(row)`, `badge`, `onClick(row)` |
141
+ | `button` | `name`, `icon`, `title`, `class` (строки или функции от строки), `eventHandler`, `onClick(row)`, `hideIf: { key, value }` - не показывать в строке, где `row[key]` равно `value` (строками; в панели «Скрыть, если ключ»). У кнопки-иконки без `name` обязательно `title`. Весь `data` может быть функцией от строки |
142
+ | `select` | `key` (массив вариантов в строке), `keyCol`, `onChange` |
143
+ | `menu` | `items(row)` - пункты `Dropdown` для строки, `icon` (по умолчанию «⋯», `IconMore`), `title`. Только из кода приложения, в конструкторе нет; удаление - пункт с `accent: "red"` |
144
+ | `progressBar` | `key`, `minNum`, `maxNum`, `units` |
145
+ | `image` | `src` (строка или функция), `alt`, `class`, `width`, `height`, `defaultIcon` |
146
146
 
147
147
  Выпадающий список ячейки: `key` указывает на массив вариантов `{ id, name, value }` в строке, а выбранное значение - в поле с тем же именем без суффикса `-S` (`Mode-S` - варианты, `Mode` - значение). Выбор хранится в таблице поверх строки до следующего `body` и приходит в `onClick`. `keyCol` - ключ колонки с серийным номером модуля (пусто - серийный номер изделия), его читает облако, а не сама таблица.
148
148
 
@@ -228,7 +228,7 @@
228
228
  const classes = cls.split(" ")
229
229
  const transparent = classes.includes("bg-transparent") || !classes.some((c) => c.startsWith("bg-"))
230
230
  return twMerge(
231
- "flex h-7 w-full cursor-pointer items-center justify-center gap-1.5 rounded-lg px-3 text-[13px] font-semibold transition-colors duration-150 outline-none select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--accent-text)",
231
+ "flex h-7 w-full cursor-pointer items-center justify-center gap-1.5 rounded-lg px-3 text-[13px] font-semibold transition-[color,background-color,filter,scale] duration-150 outline-none select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--accent-text) active:scale-[0.97] active:brightness-85",
232
232
  transparent
233
233
  ? "bg-transparent text-(--accent-text) hover:bg-(--accent-soft)"
234
234
  : "border border-transparent text-(--on-accent) hover:brightness-90 dark:hover:brightness-115",
@@ -377,18 +377,20 @@
377
377
  {#if content.type === "button"}
378
378
  {@const button = resolve(content.data, row)}
379
379
  {@const title = resolve(button.title, row)}
380
- <button class="{buttonClass(button, row, fit)} bg-(--bg-color)" onclick={() => buttonClick(row, button)} {title} aria-label={title}>
381
- {#if button.icon}
382
- <span class="flex size-(--icon-size) shrink-0 items-center justify-center overflow-visible [&_svg]:size-full">
383
- {#if typeof button.icon === "string"}
384
- {@html sanitizeHtml(button.icon)}
385
- {:else}
386
- <button.icon />
387
- {/if}
388
- </span>
389
- {/if}
390
- {$T(resolve(button.name, row) ?? "")}
391
- </button>
380
+ {#if !button.hideIf?.key || String((row as Record<string, unknown>)[button.hideIf.key] ?? "") !== String(button.hideIf.value ?? "")}
381
+ <button class="{buttonClass(button, row, fit)} bg-(--bg-color)" onclick={() => buttonClick(row, button)} {title} aria-label={title}>
382
+ {#if button.icon}
383
+ <span class="flex size-(--icon-size) shrink-0 items-center justify-center overflow-visible [&_svg]:size-full">
384
+ {#if typeof button.icon === "string"}
385
+ {@html sanitizeHtml(button.icon)}
386
+ {:else}
387
+ <button.icon />
388
+ {/if}
389
+ </span>
390
+ {/if}
391
+ {$T(resolve(button.name, row) ?? "")}
392
+ </button>
393
+ {/if}
392
394
  {:else if content.type === "menu"}
393
395
  <Dropdown
394
396
  align="end"
@@ -395,6 +395,31 @@
395
395
  }}
396
396
  />
397
397
  </div>
398
+ <div class="flex flex-wrap items-end gap-2">
399
+ <UI.Input
400
+ wrapperClass="min-w-28 flex-1"
401
+ label={{ name: $T("constructor.props.table.hideIf.key") }}
402
+ value={button.hideIf?.key ?? ""}
403
+ maxlength={32}
404
+ help={{ info: $T("constructor.props.table.hideIf.info"), regExp: /^[a-zA-Z0-9\-._]{0,32}$/ }}
405
+ onUpdate={(value) =>
406
+ updateContentProperty(
407
+ columnIndex,
408
+ index,
409
+ "hideIf",
410
+ value ? { key: value as string, value: button.hideIf?.value ?? "" } : undefined,
411
+ )}
412
+ />
413
+ <UI.Input
414
+ wrapperClass="min-w-28 flex-1"
415
+ label={{ name: $T("constructor.props.table.hideIf.value") }}
416
+ value={button.hideIf?.value ?? ""}
417
+ maxlength={64}
418
+ onUpdate={(value) => {
419
+ if (button.hideIf?.key) updateContentProperty(columnIndex, index, "hideIf", { key: button.hideIf.key, value: value as string })
420
+ }}
421
+ />
422
+ </div>
398
423
  {:else if content.type == "progressBar"}
399
424
  {@const progressBar = content.data}
400
425
  <div class="flex flex-wrap items-end gap-2">
@@ -0,0 +1,43 @@
1
+ # 📡 WidgetLoRa
2
+
3
+ Карточка настроек радио LoRa: частота, мощность, полоса, спред-фактор, скорость кодирования, преамбула, CRC и инверсия IQ. Виджет не привязан к микросхеме или драйверу: где каждый параметр лежит в прошивке, задаётся в конструкторе.
4
+
5
+ ## ✨ Что умеет
6
+
7
+ - 📻 Показывает и меняет параметры радио понятными значениями: частоту в МГц, мощность в дБм, полосу в кГц.
8
+ - 🧩 Показывает только выбранные параметры и отправляет только их.
9
+ - 🧱 Параметр может лежать в своём ключе или в битах общего слова. Чужие биты слова при сохранении не меняются.
10
+ - 📋 Готовые шаблоны драйверов заполняют всё сразу, дальше любое поле правится.
11
+ - 💾 Правки уходят на устройство одной кнопкой «Сохранить». Пока не сохранили, под кнопкой висит напоминание.
12
+ - 🔽 Сворачивается по клику на заголовок, кнопка «?» включает подсказки.
13
+
14
+ ## 🧩 Как настроить в конструкторе
15
+
16
+ 1. Перетащите виджет на макет и задайте префикс группы, обычно `LORA`.
17
+ 2. Выберите шаблон драйвера. Он заполнит, где лежит каждый параметр.
18
+ 3. Если прошивка другая, поправьте параметры: галочка показывает параметр, рядом ключ, биты и коды.
19
+
20
+ ## 💡 Полезно знать
21
+
22
+ - 📡 У базы и всех её модулей радио должно быть настроено одинаково, иначе связь пропадёт. Меняйте настройки сначала у модулей, потом у базы.
23
+ - 🔢 Число в прошивке = значение × масштаб + смещение. Например, частота в Гц при показе в МГц - масштаб 1000000.
24
+ - 📝 Таблица кодов - пары `имя=код` через пробел, например `125=4 250=5 500=6`. С ней параметр выбирается из списка.
25
+
26
+ <details>
27
+ <summary>⚙️ Свойства и шаблоны</summary>
28
+
29
+ | Свойство | Что это |
30
+ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
31
+ | `id` | Префикс группы, ключи на устройстве - `{id}.{key}` |
32
+ | `value` | Значения ключей группы без префикса: `{ Cfg: 1820660393 }` |
33
+ | `params` | Параметры: `{ Freq: { key, bits?: { start, end }, scale?, offset?, min?, max?, step?, options? }, ... }`. Нет параметра - он скрыт |
34
+ | `preset` | Шаблон, которым заполнены `params`, только для конструктора |
35
+ | `onSave(values)` | Значения ключей для `SET ModCfg`: `{ Cfg: слово }`. Без колбэка - только просмотр |
36
+
37
+ Шаблоны (`LORA_PRESETS`):
38
+
39
+ - `HT_CT62` - общее слово драйвера HT_CT62 ProdFactory-ESP и `lora_service` ProdFactory-STM (STM32WL). Всё в слове `Cfg`: биты 2-6 мощность (дБм), 7-10 код полосы SX126x (4 = 125, 5 = 250, 6 = 500 кГц), 11-13 SF минус 5 (SF7-SF12), 14-15 CR минус 1 (0 = 4/5), 16 CRC, 17 инверсия IQ, 18-20 индекс длины преамбулы (6, 8, 10, 12, 16, 20, 24, 32), 21-30 частота в МГц. Биты 0-1 - режим работы драйвера, виджет их не трогает.
40
+
41
+ `loraDecode(params, value)` и `loraEncode(params, value, values)` из `lora.ts` - чтение и сборка слов без Svelte, их проверяет `tests/lora.test.mjs`.
42
+
43
+ </details>
@@ -0,0 +1,12 @@
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
+ ><path
5
+ fill="none"
6
+ stroke="currentColor"
7
+ stroke-linecap="round"
8
+ stroke-linejoin="round"
9
+ stroke-width="2"
10
+ d="M4.9 16.1a10 10 0 0 1 0-14.1M7.8 13.2a6 6 0 0 1 0-8.4M16.2 4.8a6 6 0 0 1 0 8.4M19.1 2a10 10 0 0 1 0 14.1M12 9v13M10 9a2 2 0 1 0 4 0 2 2 0 1 0-4 0"
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 RadioIcon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type RadioIcon = InstanceType<typeof RadioIcon>;
18
+ export default RadioIcon;
@@ -0,0 +1,123 @@
1
+ <!-- $lib/WidgetLoRa/WidgetLoRa.svelte - смарт-виджет настроек радио LoRa: частота, мощность, полоса, SF, CR, преамбула, CRC, InvIQ. Где каждый параметр в прошивке (ключ, биты, масштаб, коды) - в params (lora.ts), поэтому виджет подходит любой микросхеме и драйверу. Сохраняет одним пакетом; ничего не знает про DeviceStore/WebSocket - value/onSave. -->
2
+ <script lang="ts">
3
+ import { T } from "../locales/i18n"
4
+ import { untrack } from "svelte"
5
+ import { slide } from "svelte/transition"
6
+ import { twMerge } from "tailwind-merge"
7
+ import * as UI from ".."
8
+ import type { IWidgetLoRaProps } from "../types"
9
+ import { LORA_PARAMS, LORA_SWITCHES, loraDecode, loraEncode, type LoRaParam, type LoRaValues } from "./lora"
10
+ import RadioIcon from "./RadioIcon.svelte"
11
+ import WidgetHeader from "../WidgetHeader.svelte"
12
+ import { hint, hintsSetting } from "../hints"
13
+ import { accentStyle } from "../accent"
14
+ import { readPersistedCollapsed, writePersistedCollapsed } from "../widgetCollapse"
15
+
16
+ let { wrapperClass = "", accent, label = {}, value, params = {}, collapsed = $bindable(false), persistKey, onSave }: IWidgetLoRaProps = $props()
17
+
18
+ const hints = $derived(hintsSetting("WidgetLoRa", persistKey))
19
+ const rootStyle = $derived(accentStyle(accent))
20
+
21
+ /* Свёрнутость: как у WidgetDeviceInfo - выбор пользователя переживает перезагрузку (persistKey) */
22
+ const guiCollapsed = untrack(() => collapsed)
23
+ collapsed = readPersistedCollapsed(
24
+ untrack(() => persistKey),
25
+ guiCollapsed,
26
+ )
27
+ $effect(() => writePersistedCollapsed(persistKey, collapsed, guiCollapsed))
28
+
29
+ /* Правки локальные до «Сохранить»; новые значения с устройства подхватываются, только пока правок нет */
30
+ const decoded = $derived(loraDecode(params, value ?? {}))
31
+ let values: LoRaValues = $state(untrack(() => ({ ...decoded })))
32
+ let savedSnapshot = $state(untrack(() => JSON.stringify(decoded)))
33
+ const isDirty = $derived(JSON.stringify(values) !== savedSnapshot)
34
+ $effect(() => {
35
+ const incoming = decoded
36
+ if (untrack(() => isDirty)) return
37
+ values = { ...incoming }
38
+ savedSnapshot = JSON.stringify(incoming)
39
+ })
40
+
41
+ const shown = $derived(LORA_PARAMS.filter((name) => params[name]?.key))
42
+ const fields = $derived(shown.filter((name) => !LORA_SWITCHES.includes(name)))
43
+ const switches = $derived(shown.filter((name) => LORA_SWITCHES.includes(name)))
44
+ const readOnly = $derived(!onSave)
45
+
46
+ const set = (name: LoRaParam, input: unknown) => {
47
+ const number = Number(input)
48
+ if (Number.isFinite(number)) values = { ...values, [name]: number }
49
+ }
50
+
51
+ const save = () => {
52
+ if (!onSave) return
53
+ onSave(loraEncode(params, value ?? {}, values))
54
+ savedSnapshot = JSON.stringify(values)
55
+ }
56
+ </script>
57
+
58
+ <div
59
+ class={twMerge("@container relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
60
+ style={rootStyle}
61
+ >
62
+ <WidgetHeader icon={RadioIcon} label={label?.name || $T("widget.lora.title")} bind:collapsed {hints} />
63
+
64
+ {#if !collapsed}
65
+ <div class="flex flex-col gap-4" transition:slide={{ duration: 150 }}>
66
+ {#if !shown.length}
67
+ <span class="text-center text-[13px] text-(--muted-color)">{$T("widget.lora.empty")}</span>
68
+ {:else}
69
+ <div class="flex flex-col gap-3 rounded-[10px] border border-(--hairline-color) bg-(--back-color) p-3">
70
+ <div class="grid grid-cols-1 gap-2 @sm:grid-cols-2 @lg:grid-cols-3">
71
+ {#each fields as name (name)}
72
+ {@const p = params[name]!}
73
+ <div use:hint={{ text: $T(`widget.lora.hint.${name}`), enabled: $hints }}>
74
+ {#if p.options?.length}
75
+ <UI.Select
76
+ label={{ name: $T(`widget.lora.${name}`) }}
77
+ options={p.options.map((option) => ({ id: `${name}-${option.value}`, name: option.name, value: option.value }))}
78
+ value={values[name]}
79
+ disabled={readOnly}
80
+ onUpdate={(code) => set(name, code)}
81
+ />
82
+ {:else}
83
+ <UI.Input
84
+ type="number"
85
+ label={{ name: $T(`widget.lora.${name}`) }}
86
+ value={values[name] ?? ""}
87
+ readonly={readOnly}
88
+ number={{ minNum: p.min, maxNum: p.max, step: p.step ?? 1 }}
89
+ onUpdate={(input) => set(name, input)}
90
+ />
91
+ {/if}
92
+ </div>
93
+ {/each}
94
+ </div>
95
+ {#if switches.length}
96
+ <div class="flex flex-wrap items-center justify-center gap-6">
97
+ {#each switches as name (name)}
98
+ <div use:hint={{ text: $T(`widget.lora.hint.${name}`), enabled: $hints }}>
99
+ <UI.Switch
100
+ type="horizontal"
101
+ label={{ name: $T(`widget.lora.${name}`) }}
102
+ value={values[name] ? 1 : 0}
103
+ disabled={readOnly}
104
+ onUpdate={(state) => set(name, state)}
105
+ />
106
+ </div>
107
+ {/each}
108
+ </div>
109
+ {/if}
110
+ </div>
111
+
112
+ {#if !readOnly}
113
+ <div class="flex flex-col items-center gap-2">
114
+ {#if isDirty}
115
+ <span class="text-[12px] text-(--muted-color)" transition:slide={{ duration: 100 }}>{$T("widget.lora.unsaved")}</span>
116
+ {/if}
117
+ <UI.Button wrapperClass="w-40" variant="primary" content={{ name: $T("widget.common.save") }} disabled={!isDirty} onClick={save} />
118
+ </div>
119
+ {/if}
120
+ {/if}
121
+ </div>
122
+ {/if}
123
+ </div>
@@ -0,0 +1,4 @@
1
+ import * as UI from "..";
2
+ declare const WidgetLoRa: import("svelte").Component<UI.IWidgetLoRaProps, {}, "collapsed">;
3
+ type WidgetLoRa = ReturnType<typeof WidgetLoRa>;
4
+ export default WidgetLoRa;
@@ -0,0 +1,180 @@
1
+ <!-- $lib/WidgetLoRa/WidgetLoRaProps.svelte - панель пропсов конструктора для WidgetLoRa: заголовок, мастер-цвет, префикс группы; шаблон драйвера заполняет params разом; каждый параметр - сворачиваемый блок: в шапке название, сводка и вкл/выкл, внутри ключ группы, биты слова, масштаб и смещение числа или таблица кодов списка -->
2
+ <script lang="ts">
3
+ import TextsEditor from "../TextsEditor.svelte"
4
+ import { T } from "../locales/i18n"
5
+ import * as UI from ".."
6
+ import type { UIComponent, IWidgetLoRaProps } from "../types"
7
+ import { createPropsEditor, type PropertyChange } from "../propsEditor"
8
+ import PropsGroup from "../PropsGroup.svelte"
9
+ import CommonSnippets from "../CommonSnippets.svelte"
10
+ import { LORA_PARAMS, LORA_PRESETS, LORA_SWITCHES, type ILoRaOption, type ILoRaParamConfig, type LoRaParam } from "./lora"
11
+ import SectionHead from "../SectionHead.svelte"
12
+ import { slide } from "svelte/transition"
13
+ import { SvelteSet } from "svelte/reactivity"
14
+
15
+ const {
16
+ component,
17
+ onPropertyChange,
18
+ }: {
19
+ component: UIComponent<"WidgetLoRa">
20
+ onPropertyChange: (change: PropertyChange<IWidgetLoRaProps>) => void
21
+ } = $props()
22
+
23
+ const edit = $derived(createPropsEditor(component, onPropertyChange))
24
+ const params = $derived(component.properties.params ?? {})
25
+
26
+ const PRESET_OPTIONS = Object.entries(LORA_PRESETS).map(([value, preset]) => ({ id: value, name: preset.name, value }))
27
+
28
+ const applyPreset = (preset: string) => {
29
+ const found = LORA_PRESETS[preset]
30
+ if (!found) return
31
+ edit.set("preset", preset)
32
+ edit.set("params", structuredClone(found.params))
33
+ }
34
+
35
+ /* Параметр целиком заменяется копией: params - один объект свойства */
36
+ const setParam = (name: LoRaParam, patch: Partial<ILoRaParamConfig> | null) => {
37
+ const next = { ...params }
38
+ if (patch === null) delete next[name]
39
+ else next[name] = { key: "Cfg", ...next[name], ...patch }
40
+ edit.set("params", next)
41
+ }
42
+
43
+ /* Раскрытые параметры - только в этой панели; по умолчанию все свёрнуты */
44
+ const opened = new SvelteSet<LoRaParam>()
45
+ const toggle = (name: LoRaParam) => (opened.has(name) ? opened.delete(name) : opened.add(name))
46
+
47
+ /* Сводка в шапке: ключ и биты, у списка - число вариантов */
48
+ const summary = (p: ILoRaParamConfig) =>
49
+ [
50
+ p.key,
51
+ p.bits
52
+ ? p.bits.start === p.bits.end
53
+ ? `${$T("widget.lora.props.bit")} ${p.bits.start}`
54
+ : `${$T("widget.lora.props.bit_range")} ${p.bits.start}-${p.bits.end}`
55
+ : "",
56
+ p.options?.length ? `${$T("widget.lora.props.variants")}: ${p.options.length}` : "",
57
+ ]
58
+ .filter(Boolean)
59
+ .join(" · ")
60
+
61
+ const num = (input: unknown): number | undefined => (input === "" || input === undefined || !Number.isFinite(Number(input)) ? undefined : Number(input))
62
+
63
+ /* Таблица кодов строкой: "125=4 250=5 500=6" */
64
+ const optionsText = (options?: ILoRaOption[]) => (options ?? []).map((o) => `${o.name}=${o.value}`).join(" ")
65
+ const parseOptions = (text: string): ILoRaOption[] | undefined => {
66
+ const options = text
67
+ .trim()
68
+ .split(/\s+/)
69
+ .flatMap((pair) => {
70
+ const [name, code] = pair.split("=")
71
+ return name && Number.isFinite(Number(code)) && code !== "" ? [{ name, value: Number(code) }] : []
72
+ })
73
+ return options.length ? options : undefined
74
+ }
75
+ </script>
76
+
77
+ {#snippet ParamRow(name: LoRaParam)}
78
+ {@const p = params[name]}
79
+ {@const open = !!p && opened.has(name)}
80
+ <!-- Шапка: параметр, сводка и вкл/выкл; настройки места в прошивке - внутри, по раскрытию -->
81
+ <div class="flex flex-col gap-2 rounded-lg border border-(--hairline-color) px-2.5 py-2">
82
+ <div class="flex items-center gap-2">
83
+ <div class="min-w-0 flex-1">
84
+ {#if p}
85
+ <SectionHead title={$T(`widget.lora.${name}`)} summary={summary(p)} {open} onToggle={() => toggle(name)} />
86
+ {:else}
87
+ <span class="text-[13px] font-semibold text-(--muted-color)">{$T(`widget.lora.${name}`)}</span>
88
+ {/if}
89
+ </div>
90
+ <UI.Switch
91
+ wrapperClass="w-auto shrink-0"
92
+ value={p ? 1 : 0}
93
+ onUpdate={(on) => {
94
+ setParam(name, on === 1 ? {} : null)
95
+ if (on !== 1) opened.delete(name)
96
+ }}
97
+ />
98
+ </div>
99
+ {#if open && p}
100
+ <div class="flex flex-col gap-2" transition:slide={{ duration: 150 }}>
101
+ <div class="flex flex-wrap items-end gap-2">
102
+ <UI.Input
103
+ wrapperClass="w-24"
104
+ label={{ name: $T("widget.lora.props.key") }}
105
+ value={p.key}
106
+ help={{ regExp: /^[A-Za-z0-9_]{1,12}$/ }}
107
+ onUpdate={(value) => setParam(name, { key: String(value) })}
108
+ />
109
+ <UI.Switch
110
+ type="checkbox"
111
+ wrapperClass="w-auto shrink-0 justify-start self-center"
112
+ label={{ name: $T("widget.lora.props.bits") }}
113
+ help={{ info: $T("widget.lora.props.bits.info") }}
114
+ value={p.bits ? 1 : 0}
115
+ onUpdate={(on) => setParam(name, { bits: on === 1 ? { start: 0, end: LORA_SWITCHES.includes(name) ? 0 : 7 } : undefined })}
116
+ />
117
+ </div>
118
+ {#if p.bits && LORA_SWITCHES.includes(name)}
119
+ <!-- Переключатель - один бит -->
120
+ <UI.Slider
121
+ label={{ name: `${$T("widget.lora.props.bit")}: ${p.bits.start}` }}
122
+ number={{ minNum: 0, maxNum: 31, step: 1 }}
123
+ value={p.bits.start}
124
+ onUpdate={(value) => typeof value === "number" && setParam(name, { bits: { start: value, end: value } })}
125
+ />
126
+ {:else if p.bits}
127
+ <UI.Slider
128
+ label={{ name: `${$T("widget.lora.props.bit_range")}: ${p.bits.start}-${p.bits.end}` }}
129
+ type="range"
130
+ number={{ minNum: 0, maxNum: 31, step: 1 }}
131
+ value={[p.bits.start, p.bits.end]}
132
+ onUpdate={(value) => Array.isArray(value) && setParam(name, { bits: { start: value[0], end: value[1] } })}
133
+ />
134
+ {/if}
135
+ {#if !LORA_SWITCHES.includes(name)}
136
+ <UI.Input
137
+ label={{ name: $T("widget.lora.props.options") }}
138
+ value={optionsText(p.options)}
139
+ help={{ info: $T("widget.lora.props.options.info") }}
140
+ onUpdate={(value) => setParam(name, { options: parseOptions(String(value)) })}
141
+ />
142
+ {#if !p.options?.length}
143
+ <div class="flex flex-wrap items-end gap-2">
144
+ {#each [["scale", 1], ["offset", 0], ["min", ""], ["max", ""], ["step", 1]] as [field, fallback] (field)}
145
+ <UI.Input
146
+ wrapperClass="w-20"
147
+ type="number"
148
+ label={{ name: $T(`widget.lora.props.${field}`) }}
149
+ value={p[field as "scale"] ?? fallback}
150
+ onUpdate={(value) => setParam(name, { [field as string]: num(value) })}
151
+ />
152
+ {/each}
153
+ </div>
154
+ {/if}
155
+ {/if}
156
+ </div>
157
+ {/if}
158
+ </div>
159
+ {/snippet}
160
+
161
+ <div class="flex flex-col gap-2">
162
+ <PropsGroup label={$T("constructor.props.group.general")}>
163
+ <TextsEditor {component} {onPropertyChange} />
164
+ <UI.Input label={{ name: $T("widget.common.group_prefix") }} value={component.properties.id} onUpdate={(value) => edit.set("id", value as string)} />
165
+ <CommonSnippets snippet="Accent" {component} {onPropertyChange} />
166
+ </PropsGroup>
167
+ <PropsGroup label={$T("widget.lora.props.params")}>
168
+ <UI.Select
169
+ label={{ name: $T("widget.lora.props.preset") }}
170
+ type="buttons"
171
+ options={PRESET_OPTIONS}
172
+ value={component.properties.preset}
173
+ onUpdate={(preset) => applyPreset(String(preset))}
174
+ />
175
+ <UI.FieldLabel label={{ name: $T("widget.lora.props.list") }} info={$T("widget.lora.props.list.info")} />
176
+ {#each LORA_PARAMS as name (name)}
177
+ {@render ParamRow(name)}
178
+ {/each}
179
+ </PropsGroup>
180
+ </div>
@@ -0,0 +1,9 @@
1
+ import type { UIComponent, IWidgetLoRaProps } from "../types";
2
+ import { type PropertyChange } from "../propsEditor";
3
+ type $$ComponentProps = {
4
+ component: UIComponent<"WidgetLoRa">;
5
+ onPropertyChange: (change: PropertyChange<IWidgetLoRaProps>) => void;
6
+ };
7
+ declare const WidgetLoRaProps: import("svelte").Component<$$ComponentProps, {}, "">;
8
+ type WidgetLoRaProps = ReturnType<typeof WidgetLoRaProps>;
9
+ export default WidgetLoRaProps;
@@ -0,0 +1,29 @@
1
+ export declare const LORA_PARAMS: readonly ["Freq", "TxP", "BW", "SF", "CR", "Preamble", "CRC", "InvIQ"];
2
+ export type LoRaParam = (typeof LORA_PARAMS)[number];
3
+ export declare const LORA_SWITCHES: readonly LoRaParam[];
4
+ export interface ILoRaOption {
5
+ name: string;
6
+ value: number;
7
+ }
8
+ export interface ILoRaParamConfig {
9
+ key: string;
10
+ bits?: {
11
+ start: number;
12
+ end: number;
13
+ };
14
+ scale?: number;
15
+ offset?: number;
16
+ min?: number;
17
+ max?: number;
18
+ step?: number;
19
+ options?: ILoRaOption[];
20
+ }
21
+ export type LoRaParams = Partial<Record<LoRaParam, ILoRaParamConfig>>;
22
+ export type LoRaValues = Partial<Record<LoRaParam, number>>;
23
+ export declare const LORA_PRESETS: Record<string, {
24
+ name: string;
25
+ params: LoRaParams;
26
+ }>;
27
+ export declare const loraKeys: (params: LoRaParams) => string[];
28
+ export declare const loraDecode: (params: LoRaParams, raw: Record<string, unknown>) => LoRaValues;
29
+ export declare const loraEncode: (params: LoRaParams, raw: Record<string, unknown>, values: LoRaValues) => Record<string, number>;
@@ -0,0 +1,89 @@
1
+ /* $lib/WidgetLoRa/lora.ts - параметры LoRa для WidgetLoRa: где лежит каждый параметр в прошивке (ключ группы, биты слова, масштаб, таблица кодов), шаблоны драйверов, чтение и сборка слов. Без Svelte - проверяется тестами против dist */
2
+ import { bitFieldGet, bitFieldSet } from "../bitField.js";
3
+ /* Параметры радио, общие для микросхем LoRa (SX126x, SX127x, LLCC68, STM32WL) */
4
+ export const LORA_PARAMS = ["Freq", "TxP", "BW", "SF", "CR", "Preamble", "CRC", "InvIQ"];
5
+ /* Переключатели: код 0 или 1 */
6
+ export const LORA_SWITCHES = ["CRC", "InvIQ"];
7
+ const opts = (pairs) => pairs.map(([name, value]) => ({ name, value }));
8
+ const SF_NAMES = (from, codeFrom, count) => opts(Array.from({ length: count }, (_, i) => [String(from + i), codeFrom + i]));
9
+ /* Шаблоны драйверов: заполняют params разом, дальше любое поле правится в конструкторе */
10
+ export const LORA_PRESETS = {
11
+ /* Общее слово LORA.Cfg: драйвер HT_CT62 ProdFactory-ESP и lora_service ProdFactory-STM (STM32WL) */
12
+ HT_CT62: {
13
+ name: "HT-CT62 / STM32WL",
14
+ params: {
15
+ Freq: { key: "Cfg", bits: { start: 21, end: 30 }, min: 150, max: 960, step: 1 },
16
+ TxP: { key: "Cfg", bits: { start: 2, end: 6 }, min: 0, max: 22, step: 1 },
17
+ BW: {
18
+ key: "Cfg",
19
+ bits: { start: 7, end: 10 },
20
+ options: opts([
21
+ ["125", 4],
22
+ ["250", 5],
23
+ ["500", 6],
24
+ ]),
25
+ },
26
+ SF: { key: "Cfg", bits: { start: 11, end: 13 }, options: SF_NAMES(7, 2, 6) },
27
+ CR: {
28
+ key: "Cfg",
29
+ bits: { start: 14, end: 15 },
30
+ options: opts([
31
+ ["4/5", 0],
32
+ ["4/6", 1],
33
+ ["4/7", 2],
34
+ ["4/8", 3],
35
+ ]),
36
+ },
37
+ Preamble: {
38
+ key: "Cfg",
39
+ bits: { start: 18, end: 20 },
40
+ options: opts([
41
+ ["6", 0],
42
+ ["8", 1],
43
+ ["10", 2],
44
+ ["12", 3],
45
+ ["16", 4],
46
+ ["20", 5],
47
+ ["24", 6],
48
+ ["32", 7],
49
+ ]),
50
+ },
51
+ CRC: { key: "Cfg", bits: { start: 16, end: 16 } },
52
+ InvIQ: { key: "Cfg", bits: { start: 17, end: 17 } },
53
+ },
54
+ },
55
+ };
56
+ /* Ключи группы, которые нужны параметрам, без повторов */
57
+ export const loraKeys = (params) => [...new Set(Object.values(params).flatMap((p) => (p?.key ? [p.key] : [])))];
58
+ /* Код параметра из значений ключей устройства; нет значения ключа - undefined */
59
+ const readCode = (raw, p) => {
60
+ const word = Number(raw[p.key]);
61
+ if (raw[p.key] === undefined || raw[p.key] === null || !Number.isFinite(word))
62
+ return undefined;
63
+ return p.bits ? bitFieldGet(word, p.bits.start, p.bits.end) : word;
64
+ };
65
+ /* Значения для показа из значений ключей устройства */
66
+ export const loraDecode = (params, raw) => {
67
+ const values = {};
68
+ for (const name of LORA_PARAMS) {
69
+ const p = params[name];
70
+ const code = p ? readCode(raw, p) : undefined;
71
+ if (p && code !== undefined)
72
+ values[name] = p.options || LORA_SWITCHES.includes(name) ? code : (code - (p.offset ?? 0)) / (p.scale || 1);
73
+ }
74
+ return values;
75
+ };
76
+ /* Значения ключей для SET: параметры пишутся в свои биты поверх текущих слов, остальные биты слова не меняются */
77
+ export const loraEncode = (params, raw, values) => {
78
+ const out = {};
79
+ for (const name of LORA_PARAMS) {
80
+ const p = params[name];
81
+ const value = values[name];
82
+ if (!p?.key || value === undefined || !Number.isFinite(value))
83
+ continue;
84
+ const code = p.options || LORA_SWITCHES.includes(name) ? Math.trunc(value) : Math.round(value * (p.scale || 1)) + (p.offset ?? 0);
85
+ const word = out[p.key] ?? (Number(raw[p.key]) || 0);
86
+ out[p.key] = p.bits ? bitFieldSet(word, p.bits.start, p.bits.end, code) : code;
87
+ }
88
+ return out;
89
+ };
@@ -20,6 +20,7 @@ import VideoViewerProps from "./VideoViewer/VideoViewerProps.svelte";
20
20
  import WidgetProps from "./Widget/WidgetProps.svelte";
21
21
  import WidgetWiFiProps from "./WidgetWiFi/WidgetWiFiProps.svelte";
22
22
  import WidgetDeviceInfoProps from "./WidgetDeviceInfo/WidgetDeviceInfoProps.svelte";
23
+ import WidgetLoRaProps from "./WidgetLoRa/WidgetLoRaProps.svelte";
23
24
  import WidgetFileSystemProps from "./WidgetFileSystem/WidgetFileSystemProps.svelte";
24
25
  import WidgetStackInfoProps from "./WidgetStackInfo/WidgetStackInfoProps.svelte";
25
26
  import WidgetRGBStripProps from "./WidgetRGBStrip/WidgetRGBStripProps.svelte";
@@ -30,6 +31,6 @@ export { optionsStore } from "./options";
30
31
  export { createPropsEditor, applyPropertyChange, type PropertyChange } from "./propsEditor";
31
32
  export { default as CommonSnippets } from "./CommonSnippets.svelte";
32
33
  export { COMPONENT_DEFAULTS, COMPONENT_SIZES, minComponentWidth, createComponent } from "./defaults";
33
- export { AccordionProps, ButtonProps, DividerProps, FileAttachProps, GraphProps, InputProps, JoystickProps, PeriodChartProps, ProgressBarProps, SelectProps, SliderProps, SwitchProps, TableProps, TabsProps, TextFieldProps, VideoViewerProps, WidgetProps, WidgetWiFiProps, WidgetDeviceInfoProps, WidgetFileSystemProps, WidgetStackInfoProps, WidgetRGBStripProps, WidgetPFDProps, WidgetMapProps, };
34
+ export { AccordionProps, ButtonProps, DividerProps, FileAttachProps, GraphProps, InputProps, JoystickProps, PeriodChartProps, ProgressBarProps, SelectProps, SliderProps, SwitchProps, TableProps, TabsProps, TextFieldProps, VideoViewerProps, WidgetProps, WidgetWiFiProps, WidgetDeviceInfoProps, WidgetLoRaProps, WidgetFileSystemProps, WidgetStackInfoProps, WidgetRGBStripProps, WidgetPFDProps, WidgetMapProps, };
34
35
  export declare const PANELS: Record<UIType, Component<any>>;
35
36
  export { default as TextsEditor } from "./TextsEditor.svelte";
@@ -20,6 +20,7 @@ import VideoViewerProps from "./VideoViewer/VideoViewerProps.svelte";
20
20
  import WidgetProps from "./Widget/WidgetProps.svelte";
21
21
  import WidgetWiFiProps from "./WidgetWiFi/WidgetWiFiProps.svelte";
22
22
  import WidgetDeviceInfoProps from "./WidgetDeviceInfo/WidgetDeviceInfoProps.svelte";
23
+ import WidgetLoRaProps from "./WidgetLoRa/WidgetLoRaProps.svelte";
23
24
  import WidgetFileSystemProps from "./WidgetFileSystem/WidgetFileSystemProps.svelte";
24
25
  import WidgetStackInfoProps from "./WidgetStackInfo/WidgetStackInfoProps.svelte";
25
26
  import WidgetRGBStripProps from "./WidgetRGBStrip/WidgetRGBStripProps.svelte";
@@ -31,7 +32,7 @@ export { optionsStore } from "./options";
31
32
  export { createPropsEditor, applyPropertyChange } from "./propsEditor";
32
33
  export { default as CommonSnippets } from "./CommonSnippets.svelte";
33
34
  export { COMPONENT_DEFAULTS, COMPONENT_SIZES, minComponentWidth, createComponent } from "./defaults";
34
- export { AccordionProps, ButtonProps, DividerProps, FileAttachProps, GraphProps, InputProps, JoystickProps, PeriodChartProps, ProgressBarProps, SelectProps, SliderProps, SwitchProps, TableProps, TabsProps, TextFieldProps, VideoViewerProps, WidgetProps, WidgetWiFiProps, WidgetDeviceInfoProps, WidgetFileSystemProps, WidgetStackInfoProps, WidgetRGBStripProps, WidgetPFDProps, WidgetMapProps, };
35
+ export { AccordionProps, ButtonProps, DividerProps, FileAttachProps, GraphProps, InputProps, JoystickProps, PeriodChartProps, ProgressBarProps, SelectProps, SliderProps, SwitchProps, TableProps, TabsProps, TextFieldProps, VideoViewerProps, WidgetProps, WidgetWiFiProps, WidgetDeviceInfoProps, WidgetLoRaProps, WidgetFileSystemProps, WidgetStackInfoProps, WidgetRGBStripProps, WidgetPFDProps, WidgetMapProps, };
35
36
  /* Панель свойств по типу: <Panel component={c} onPropertyChange={...} /> вместо ветвления по типам */
36
37
  export const PANELS = {
37
38
  Accordion: AccordionProps,
@@ -53,6 +54,7 @@ export const PANELS = {
53
54
  Widget: WidgetProps,
54
55
  WidgetWiFi: WidgetWiFiProps,
55
56
  WidgetDeviceInfo: WidgetDeviceInfoProps,
57
+ WidgetLoRa: WidgetLoRaProps,
56
58
  WidgetFileSystem: WidgetFileSystemProps,
57
59
  WidgetStackInfo: WidgetStackInfoProps,
58
60
  WidgetRGBStrip: WidgetRGBStripProps,
package/dist/defaults.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /* $lib/defaults.ts - новые компоненты конструктора: свойства и размер по умолчанию, создание компонента. Тексты пустые - задаются в «Тексты и переводы», заголовок смарт-виджета - его название на всех языках */
2
2
  import { GUI_GRID, isWidgetType } from "./gui";
3
3
  import { widgetTitle } from "./locales/i18n";
4
+ import { LORA_PRESETS } from "./WidgetLoRa/lora";
4
5
  const label = { name: "", class: "text-center" };
5
6
  /* Новый виджет на холсте свёрнут: холст не растягивается, автор раскрывает нужный */
6
7
  const widget = (type) => ({ label: { name: widgetTitle(type) }, collapsed: true });
@@ -8,6 +9,7 @@ const widget = (type) => ({ label: { name: widgetTitle(type) }, collapsed: true
8
9
  export const COMPONENT_DEFAULTS = {
9
10
  WidgetWiFi: { ...widget("WidgetWiFi"), id: "CFG", allowedModes: [1, 2, 3], confirmOnAP: true },
10
11
  WidgetDeviceInfo: { ...widget("WidgetDeviceInfo"), id: "CFG" },
12
+ WidgetLoRa: { ...widget("WidgetLoRa"), id: "LORA", preset: "HT_CT62", params: structuredClone(LORA_PRESETS.HT_CT62.params) },
11
13
  WidgetFileSystem: { ...widget("WidgetFileSystem"), id: "CFG", accept: "*/*", maxNameLength: 31 },
12
14
  WidgetStackInfo: { ...widget("WidgetStackInfo"), warnBytes: 512, period: 0 },
13
15
  WidgetRGBStrip: { ...widget("WidgetRGBStrip"), id: "LST" },
@@ -71,6 +73,7 @@ export const COMPONENT_DEFAULTS = {
71
73
  export const COMPONENT_SIZES = {
72
74
  WidgetWiFi: { width: 7, height: 1 },
73
75
  WidgetDeviceInfo: { width: 7, height: 1 },
76
+ WidgetLoRa: { width: 7, height: 1 },
74
77
  WidgetFileSystem: { width: 7, height: 1 },
75
78
  WidgetStackInfo: { width: 7, height: 1 },
76
79
  WidgetRGBStrip: { width: 7, height: 1 },
@@ -28,6 +28,7 @@ components:
28
28
  # Смарт-виджеты
29
29
  - [WidgetWiFi, widget] # настройки Wi-Fi
30
30
  - [WidgetDeviceInfo, widget] # об устройстве
31
+ - [WidgetLoRa, widget] # настройки радио LoRa
31
32
  - [WidgetFileSystem, widget] # файлы устройства
32
33
  - [WidgetStackInfo, widget] # задачи и память
33
34
  - [WidgetRGBStrip, widget] # светодиодная лента
@@ -1,4 +1,4 @@
1
- export declare const COMPONENT_TYPES: readonly ["Accordion", "Tabs", "TextField", "Divider", "Button", "FileAttach", "Input", "Select", "Switch", "Slider", "Joystick", "Widget", "ProgressBar", "Graph", "PeriodChart", "Table", "VideoViewer", "WidgetWiFi", "WidgetDeviceInfo", "WidgetFileSystem", "WidgetStackInfo", "WidgetRGBStrip", "WidgetPFD", "WidgetMap"];
1
+ export declare const COMPONENT_TYPES: readonly ["Accordion", "Tabs", "TextField", "Divider", "Button", "FileAttach", "Input", "Select", "Switch", "Slider", "Joystick", "Widget", "ProgressBar", "Graph", "PeriodChart", "Table", "VideoViewer", "WidgetWiFi", "WidgetDeviceInfo", "WidgetLoRa", "WidgetFileSystem", "WidgetStackInfo", "WidgetRGBStrip", "WidgetPFD", "WidgetMap"];
2
2
  export declare const COMPONENT_IO: {
3
3
  readonly Accordion: "none";
4
4
  readonly Tabs: "none";
@@ -19,6 +19,7 @@ export declare const COMPONENT_IO: {
19
19
  readonly VideoViewer: "none";
20
20
  readonly WidgetWiFi: "widget";
21
21
  readonly WidgetDeviceInfo: "widget";
22
+ readonly WidgetLoRa: "widget";
22
23
  readonly WidgetFileSystem: "widget";
23
24
  readonly WidgetStackInfo: "widget";
24
25
  readonly WidgetRGBStrip: "widget";
@@ -1,5 +1,5 @@
1
1
  /* $lib/dictionaries/generated/components.ts - СГЕНЕРИРОВАНО из components.yaml (npm run Generate), руками не править */
2
- export const COMPONENT_TYPES = ["Accordion", "Tabs", "TextField", "Divider", "Button", "FileAttach", "Input", "Select", "Switch", "Slider", "Joystick", "Widget", "ProgressBar", "Graph", "PeriodChart", "Table", "VideoViewer", "WidgetWiFi", "WidgetDeviceInfo", "WidgetFileSystem", "WidgetStackInfo", "WidgetRGBStrip", "WidgetPFD", "WidgetMap"];
2
+ export const COMPONENT_TYPES = ["Accordion", "Tabs", "TextField", "Divider", "Button", "FileAttach", "Input", "Select", "Switch", "Slider", "Joystick", "Widget", "ProgressBar", "Graph", "PeriodChart", "Table", "VideoViewer", "WidgetWiFi", "WidgetDeviceInfo", "WidgetLoRa", "WidgetFileSystem", "WidgetStackInfo", "WidgetRGBStrip", "WidgetPFD", "WidgetMap"];
3
3
  export const COMPONENT_IO = {
4
4
  Accordion: "none",
5
5
  Tabs: "none",
@@ -20,6 +20,7 @@ export const COMPONENT_IO = {
20
20
  VideoViewer: "none",
21
21
  WidgetWiFi: "widget",
22
22
  WidgetDeviceInfo: "widget",
23
+ WidgetLoRa: "widget",
23
24
  WidgetFileSystem: "widget",
24
25
  WidgetStackInfo: "widget",
25
26
  WidgetRGBStrip: "widget",
@@ -17,6 +17,7 @@ import VideoViewer from "./VideoViewer/VideoViewer.svelte";
17
17
  import Widget from "./Widget/Widget.svelte";
18
18
  import WidgetWiFi from "./WidgetWiFi/WidgetWiFi.svelte";
19
19
  import WidgetDeviceInfo from "./WidgetDeviceInfo/WidgetDeviceInfo.svelte";
20
+ import WidgetLoRa from "./WidgetLoRa/WidgetLoRa.svelte";
20
21
  import WidgetFileSystem from "./WidgetFileSystem/WidgetFileSystem.svelte";
21
22
  import WidgetStackInfo from "./WidgetStackInfo/WidgetStackInfo.svelte";
22
23
  import WidgetRGBStrip from "./WidgetRGBStrip/WidgetRGBStrip.svelte";
@@ -42,6 +43,7 @@ export interface GuiViewsAll {
42
43
  Widget: typeof Widget;
43
44
  WidgetWiFi: typeof WidgetWiFi;
44
45
  WidgetDeviceInfo: typeof WidgetDeviceInfo;
46
+ WidgetLoRa: typeof WidgetLoRa;
45
47
  WidgetFileSystem: typeof WidgetFileSystem;
46
48
  WidgetStackInfo: typeof WidgetStackInfo;
47
49
  WidgetRGBStrip: typeof WidgetRGBStrip;
package/dist/guiViews.js CHANGED
@@ -17,6 +17,7 @@ import VideoViewer from "./VideoViewer/VideoViewer.svelte";
17
17
  import Widget from "./Widget/Widget.svelte";
18
18
  import WidgetWiFi from "./WidgetWiFi/WidgetWiFi.svelte";
19
19
  import WidgetDeviceInfo from "./WidgetDeviceInfo/WidgetDeviceInfo.svelte";
20
+ import WidgetLoRa from "./WidgetLoRa/WidgetLoRa.svelte";
20
21
  import WidgetFileSystem from "./WidgetFileSystem/WidgetFileSystem.svelte";
21
22
  import WidgetStackInfo from "./WidgetStackInfo/WidgetStackInfo.svelte";
22
23
  import WidgetRGBStrip from "./WidgetRGBStrip/WidgetRGBStrip.svelte";
@@ -43,6 +44,7 @@ export const GUI_VIEWS = {
43
44
  Widget,
44
45
  WidgetWiFi,
45
46
  WidgetDeviceInfo,
47
+ WidgetLoRa,
46
48
  WidgetFileSystem,
47
49
  WidgetStackInfo,
48
50
  WidgetRGBStrip,
package/dist/index.d.ts CHANGED
@@ -29,6 +29,8 @@ export { default as VideoViewer } from "./VideoViewer/VideoViewer.svelte";
29
29
  export { default as Widget } from "./Widget/Widget.svelte";
30
30
  export { default as WidgetWiFi } from "./WidgetWiFi/WidgetWiFi.svelte";
31
31
  export { default as WidgetDeviceInfo } from "./WidgetDeviceInfo/WidgetDeviceInfo.svelte";
32
+ export { default as WidgetLoRa } from "./WidgetLoRa/WidgetLoRa.svelte";
33
+ export { LORA_PARAMS, LORA_PRESETS, loraDecode, loraEncode, loraKeys } from "./WidgetLoRa/lora";
32
34
  export { default as WidgetFileSystem } from "./WidgetFileSystem/WidgetFileSystem.svelte";
33
35
  export { default as WidgetStackInfo } from "./WidgetStackInfo/WidgetStackInfo.svelte";
34
36
  export { default as WidgetRGBStrip } from "./WidgetRGBStrip/WidgetRGBStrip.svelte";
@@ -68,5 +70,5 @@ export { default as IconGripVerticalRight } from "./libIcons/IconGripVerticalRig
68
70
  export { escapeHtml, htmlToText, sanitizeHtml } from "./html";
69
71
  export { hintsSetting, hint, type HintParams } from "./hints";
70
72
  export { applyDragGhost, clearDragGhost, createDropPlaceholder } from "./dragStyle";
71
- export { type UIComponent, type UIComponentPropsMap, type UIType, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type IOption, type SelectValue, type IconSource, type ISwitchProps, type IDividerProps, type ISliderProps, type ITextFieldProps, type IProgressBarProps, type IWidgetProps, type IWidgetWiFiProps, type IWidgetWiFiConfig, type IWidgetDeviceInfoProps, type IWidgetDeviceInfoConfig, type IWidgetFileSystemProps, type IWidgetFileSystemInfo, type IWidgetFileSystemFile, type IWidgetFileSystemUpload, type IWidgetStackInfoProps, type IWidgetStackInfo, type IWidgetStackInfoHeap, type IWidgetStackInfoTask, type IWidgetRGBStripProps, type IWidgetRGBStripConfig, type IWidgetPFDProps, type IWidgetPFDData, type IWidgetPFDLimits, type IWidgetMapProps, type IWidgetMapData, type IGraphProps, type IGraphDataObject, type IGraphHistoryPoint, type IGraphHistorySeries, type ITableHeader, type ITableText, type ITableSelect, type ITableButton, type ITableMenu, type ITableProgressBar, type ITableImage, type ITableContent, type ITableProps, type ITabsProps, type IJoystickProps, type IFileAttachProps, type FileAttachValue, type IDropdownProps, type IDropdownItem, type IDropdownTriggerProps, type ICarouselProps, type IReceivingDataObject, type IVideoViewerProps, type IPeriodChartProps, type IPeriodChartLevel, } from "./types";
73
+ export { type UIComponent, type UIComponentPropsMap, type UIType, type Position, type IUIComponentHandler, type IButtonProps, type IAccordionProps, type IInputProps, type ISelectProps, type IOption, type SelectValue, type IconSource, type ISwitchProps, type IDividerProps, type ISliderProps, type ITextFieldProps, type IProgressBarProps, type IWidgetProps, type IWidgetWiFiProps, type IWidgetWiFiConfig, type IWidgetDeviceInfoProps, type IWidgetDeviceInfoConfig, type IWidgetLoRaProps, type LoRaParams, type ILoRaParamConfig, type IWidgetFileSystemProps, type IWidgetFileSystemInfo, type IWidgetFileSystemFile, type IWidgetFileSystemUpload, type IWidgetStackInfoProps, type IWidgetStackInfo, type IWidgetStackInfoHeap, type IWidgetStackInfoTask, type IWidgetRGBStripProps, type IWidgetRGBStripConfig, type IWidgetPFDProps, type IWidgetPFDData, type IWidgetPFDLimits, type IWidgetMapProps, type IWidgetMapData, type IGraphProps, type IGraphDataObject, type IGraphHistoryPoint, type IGraphHistorySeries, type ITableHeader, type ITableText, type ITableSelect, type ITableButton, type ITableMenu, type ITableProgressBar, type ITableImage, type ITableContent, type ITableProps, type ITabsProps, type IJoystickProps, type IFileAttachProps, type FileAttachValue, type IDropdownProps, type IDropdownItem, type IDropdownTriggerProps, type ICarouselProps, type IReceivingDataObject, type IVideoViewerProps, type IPeriodChartProps, type IPeriodChartLevel, } from "./types";
72
74
  export { ICONS, ICON_NAMES, ICONS_ARRAY } from "./icons";
package/dist/index.js CHANGED
@@ -30,6 +30,8 @@ export { default as VideoViewer } from "./VideoViewer/VideoViewer.svelte";
30
30
  export { default as Widget } from "./Widget/Widget.svelte";
31
31
  export { default as WidgetWiFi } from "./WidgetWiFi/WidgetWiFi.svelte";
32
32
  export { default as WidgetDeviceInfo } from "./WidgetDeviceInfo/WidgetDeviceInfo.svelte";
33
+ export { default as WidgetLoRa } from "./WidgetLoRa/WidgetLoRa.svelte";
34
+ export { LORA_PARAMS, LORA_PRESETS, loraDecode, loraEncode, loraKeys } from "./WidgetLoRa/lora";
33
35
  export { default as WidgetFileSystem } from "./WidgetFileSystem/WidgetFileSystem.svelte";
34
36
  export { default as WidgetStackInfo } from "./WidgetStackInfo/WidgetStackInfo.svelte";
35
37
  export { default as WidgetRGBStrip } from "./WidgetRGBStrip/WidgetRGBStrip.svelte";
@@ -1129,6 +1129,21 @@ declare const constructorTranslations: {
1129
1129
  en: string;
1130
1130
  zh: string;
1131
1131
  };
1132
+ "constructor.props.table.hideIf.key": {
1133
+ ru: string;
1134
+ en: string;
1135
+ zh: string;
1136
+ };
1137
+ "constructor.props.table.hideIf.value": {
1138
+ ru: string;
1139
+ en: string;
1140
+ zh: string;
1141
+ };
1142
+ "constructor.props.table.hideIf.info": {
1143
+ ru: string;
1144
+ en: string;
1145
+ zh: string;
1146
+ };
1132
1147
  "constructor.props.table.keys.info": {
1133
1148
  ru: string;
1134
1149
  en: string;
@@ -363,6 +363,13 @@ const constructorTranslations = {
363
363
  "constructor.props.table.columns.image.width": { ru: "Ширина иконки, rem", en: "Icon width, rem", zh: "图标宽度,rem" },
364
364
  "constructor.props.table.columns.image.height": { ru: "Высота иконки, rem", en: "Icon height, rem", zh: "图标高度,rem" },
365
365
  "constructor.props.table.keys": { ru: "Перечень ключей", en: "List of keys", zh: "键列表" },
366
+ "constructor.props.table.hideIf.key": { ru: "Скрыть, если ключ", en: "Hide if key", zh: "隐藏条件键" },
367
+ "constructor.props.table.hideIf.value": { ru: "равен", en: "equals", zh: "等于" },
368
+ "constructor.props.table.hideIf.info": {
369
+ ru: "Кнопка не показывается в строке, где значение этого ключа равно заданному. Пусто - кнопка во всех строках",
370
+ en: "The button is hidden in rows where this key equals the given value. Empty - the button is in every row",
371
+ zh: "当该键的值等于给定值时,该行不显示按钮。为空 - 所有行都显示按钮",
372
+ },
366
373
  "constructor.props.table.keys.info": {
367
374
  ru: "Ключи колонок, значения которых будут возвращаться. Перечислить через пробел",
368
375
  en: "Column keys whose values will be returned. List them separated by spaces",
@@ -58,6 +58,7 @@ export const extendTranslations = (dictionary) => void Object.assign(translation
58
58
  const WIDGET_TITLE_KEYS = {
59
59
  WidgetWiFi: "widget.wifi.title",
60
60
  WidgetDeviceInfo: "widget.info.title",
61
+ WidgetLoRa: "widget.lora.title",
61
62
  WidgetFileSystem: "widget.fs.title",
62
63
  WidgetStackInfo: "widget.stack.title",
63
64
  WidgetRGBStrip: "widget.rgb.title",
@@ -759,6 +759,186 @@ declare const translations: {
759
759
  en: string;
760
760
  zh: string;
761
761
  };
762
+ "widget.lora.title": {
763
+ ru: string;
764
+ en: string;
765
+ zh: string;
766
+ };
767
+ "widget.lora.empty": {
768
+ ru: string;
769
+ en: string;
770
+ zh: string;
771
+ };
772
+ "widget.lora.unsaved": {
773
+ ru: string;
774
+ en: string;
775
+ zh: string;
776
+ };
777
+ "widget.lora.Freq": {
778
+ ru: string;
779
+ en: string;
780
+ zh: string;
781
+ };
782
+ "widget.lora.TxP": {
783
+ ru: string;
784
+ en: string;
785
+ zh: string;
786
+ };
787
+ "widget.lora.BW": {
788
+ ru: string;
789
+ en: string;
790
+ zh: string;
791
+ };
792
+ "widget.lora.SF": {
793
+ ru: string;
794
+ en: string;
795
+ zh: string;
796
+ };
797
+ "widget.lora.CR": {
798
+ ru: string;
799
+ en: string;
800
+ zh: string;
801
+ };
802
+ "widget.lora.Preamble": {
803
+ ru: string;
804
+ en: string;
805
+ zh: string;
806
+ };
807
+ "widget.lora.CRC": {
808
+ ru: string;
809
+ en: string;
810
+ zh: string;
811
+ };
812
+ "widget.lora.InvIQ": {
813
+ ru: string;
814
+ en: string;
815
+ zh: string;
816
+ };
817
+ "widget.lora.hint.Freq": {
818
+ ru: string;
819
+ en: string;
820
+ zh: string;
821
+ };
822
+ "widget.lora.hint.TxP": {
823
+ ru: string;
824
+ en: string;
825
+ zh: string;
826
+ };
827
+ "widget.lora.hint.BW": {
828
+ ru: string;
829
+ en: string;
830
+ zh: string;
831
+ };
832
+ "widget.lora.hint.SF": {
833
+ ru: string;
834
+ en: string;
835
+ zh: string;
836
+ };
837
+ "widget.lora.hint.CR": {
838
+ ru: string;
839
+ en: string;
840
+ zh: string;
841
+ };
842
+ "widget.lora.hint.Preamble": {
843
+ ru: string;
844
+ en: string;
845
+ zh: string;
846
+ };
847
+ "widget.lora.hint.CRC": {
848
+ ru: string;
849
+ en: string;
850
+ zh: string;
851
+ };
852
+ "widget.lora.hint.InvIQ": {
853
+ ru: string;
854
+ en: string;
855
+ zh: string;
856
+ };
857
+ "widget.lora.props.params": {
858
+ ru: string;
859
+ en: string;
860
+ zh: string;
861
+ };
862
+ "widget.lora.props.preset": {
863
+ ru: string;
864
+ en: string;
865
+ zh: string;
866
+ };
867
+ "widget.lora.props.list": {
868
+ ru: string;
869
+ en: string;
870
+ zh: string;
871
+ };
872
+ "widget.lora.props.list.info": {
873
+ ru: string;
874
+ en: string;
875
+ zh: string;
876
+ };
877
+ "widget.lora.props.key": {
878
+ ru: string;
879
+ en: string;
880
+ zh: string;
881
+ };
882
+ "widget.lora.props.bits": {
883
+ ru: string;
884
+ en: string;
885
+ zh: string;
886
+ };
887
+ "widget.lora.props.bits.info": {
888
+ ru: string;
889
+ en: string;
890
+ zh: string;
891
+ };
892
+ "widget.lora.props.variants": {
893
+ ru: string;
894
+ en: string;
895
+ zh: string;
896
+ };
897
+ "widget.lora.props.bit": {
898
+ ru: string;
899
+ en: string;
900
+ zh: string;
901
+ };
902
+ "widget.lora.props.bit_range": {
903
+ ru: string;
904
+ en: string;
905
+ zh: string;
906
+ };
907
+ "widget.lora.props.options": {
908
+ ru: string;
909
+ en: string;
910
+ zh: string;
911
+ };
912
+ "widget.lora.props.options.info": {
913
+ ru: string;
914
+ en: string;
915
+ zh: string;
916
+ };
917
+ "widget.lora.props.scale": {
918
+ ru: string;
919
+ en: string;
920
+ zh: string;
921
+ };
922
+ "widget.lora.props.offset": {
923
+ ru: string;
924
+ en: string;
925
+ zh: string;
926
+ };
927
+ "widget.lora.props.min": {
928
+ ru: string;
929
+ en: string;
930
+ zh: string;
931
+ };
932
+ "widget.lora.props.max": {
933
+ ru: string;
934
+ en: string;
935
+ zh: string;
936
+ };
937
+ "widget.lora.props.step": {
938
+ ru: string;
939
+ en: string;
940
+ zh: string;
941
+ };
762
942
  "widget.rgb.title": {
763
943
  ru: string;
764
944
  en: string;
@@ -336,6 +336,82 @@ const translations = {
336
336
  "widget.fs.downloading": { ru: "Скачивание: {name}", en: "Downloading: {name}", zh: "正在下载:{name}" },
337
337
  "widget.fs.download_failed": { ru: "Скачивание прервано: {error}", en: "Download aborted: {error}", zh: "下载中断:{error}" },
338
338
  "widget.fs.delete_confirm": { ru: "Удалить файл?", en: "Delete file?", zh: "删除文件?" },
339
+ "widget.lora.title": { ru: "Настройки LoRa", en: "LoRa settings", zh: "LoRa 设置" },
340
+ "widget.lora.empty": {
341
+ ru: "Параметры не выбраны: задайте их в конструкторе",
342
+ en: "No parameters selected: set them in the constructor",
343
+ zh: "未选择参数:请在构造器中设置",
344
+ },
345
+ "widget.lora.unsaved": {
346
+ ru: "Не сохранено. У базы и модулей радио должно быть настроено одинаково, иначе связь пропадёт",
347
+ en: "Not saved. The hub and modules must use the same radio settings, otherwise the link is lost",
348
+ zh: "未保存。基站和模块的无线设置必须一致,否则会断开连接",
349
+ },
350
+ "widget.lora.Freq": { ru: "Частота, МГц", en: "Frequency, MHz", zh: "频率, MHz" },
351
+ "widget.lora.TxP": { ru: "Мощность, дБм", en: "Power, dBm", zh: "功率, dBm" },
352
+ "widget.lora.BW": { ru: "Полоса, кГц", en: "Bandwidth, kHz", zh: "带宽, kHz" },
353
+ "widget.lora.SF": { ru: "Спред-фактор", en: "Spreading factor", zh: "扩频因子" },
354
+ "widget.lora.CR": { ru: "Скорость кодирования", en: "Coding rate", zh: "编码率" },
355
+ "widget.lora.Preamble": { ru: "Преамбула, символов", en: "Preamble, symbols", zh: "前导码, 符号" },
356
+ "widget.lora.CRC": { ru: "CRC", en: "CRC", zh: "CRC" },
357
+ "widget.lora.InvIQ": { ru: "Инверсия IQ", en: "IQ inversion", zh: "IQ 反转" },
358
+ "widget.lora.hint.Freq": { ru: "Несущая частота радио", en: "Radio carrier frequency", zh: "无线载波频率" },
359
+ "widget.lora.hint.TxP": {
360
+ ru: "Мощность передатчика: больше - дальше связь и выше расход",
361
+ en: "Transmitter power: higher means longer range and more consumption",
362
+ zh: "发射功率:越高距离越远、功耗越大",
363
+ },
364
+ "widget.lora.hint.BW": {
365
+ ru: "Полоса сигнала: уже - дальше связь, но медленнее",
366
+ en: "Signal bandwidth: narrower means longer range but slower",
367
+ zh: "信号带宽:越窄距离越远但速度越慢",
368
+ },
369
+ "widget.lora.hint.SF": {
370
+ ru: "Больше - дальше связь, но дольше каждый пакет в эфире",
371
+ en: "Higher means longer range but longer airtime per packet",
372
+ zh: "越大距离越远,但每包空中时间越长",
373
+ },
374
+ "widget.lora.hint.CR": {
375
+ ru: "Избыточность для исправления ошибок: 4/8 надёжнее, 4/5 быстрее",
376
+ en: "Error correction redundancy: 4/8 is more robust, 4/5 is faster",
377
+ zh: "纠错冗余:4/8 更可靠,4/5 更快",
378
+ },
379
+ "widget.lora.hint.Preamble": { ru: "Длина вступления перед пакетом", en: "Length of the preamble before a packet", zh: "数据包前导码长度" },
380
+ "widget.lora.hint.CRC": { ru: "Проверка целостности пакета", en: "Packet integrity check", zh: "数据包完整性校验" },
381
+ "widget.lora.hint.InvIQ": {
382
+ ru: "Инверсия IQ: нужна, когда так настроена другая сторона",
383
+ en: "IQ inversion: needed when the other side uses it",
384
+ zh: "IQ 反转:对方启用时需要",
385
+ },
386
+ "widget.lora.props.params": { ru: "Параметры радио", en: "Radio parameters", zh: "无线参数" },
387
+ "widget.lora.props.preset": { ru: "Шаблон драйвера", en: "Driver template", zh: "驱动模板" },
388
+ "widget.lora.props.list": { ru: "Параметр и его место в прошивке", en: "Parameter and its firmware location", zh: "参数及其在固件中的位置" },
389
+ "widget.lora.props.list.info": {
390
+ ru: "Галочка - показывать параметр. Ключ - имя в группе (Cfg, Freq), биты - где поле лежит в слове (пусто - значение ключа целиком). Число в прошивке = значение * масштаб + смещение. Таблица кодов делает параметр списком",
391
+ en: "Checkbox - show the parameter. Key - name in the group (Cfg, Freq), bits - where the field lies in the word (empty - the whole key value). Firmware number = value * scale + offset. A code table turns the parameter into a list",
392
+ zh: "复选框 - 显示参数。键 - 组内名称(Cfg、Freq),位 - 字段在字中的位置(为空 - 整个键值)。固件数值 = 值 * 比例 + 偏移。代码表使参数成为列表",
393
+ },
394
+ "widget.lora.props.key": { ru: "Ключ", en: "Key", zh: "键" },
395
+ "widget.lora.props.bits": { ru: "Биты слова", en: "Word bits", zh: "字中的位" },
396
+ "widget.lora.props.bits.info": {
397
+ ru: "Включено - параметр лежит в битах слова ключа, выключено - значение ключа целиком",
398
+ en: "On - the parameter lies in bits of the key word, off - the whole key value",
399
+ zh: "开启 - 参数位于键字的位中,关闭 - 整个键值",
400
+ },
401
+ "widget.lora.props.variants": { ru: "вариантов", en: "options", zh: "选项" },
402
+ "widget.lora.props.bit": { ru: "Бит", en: "Bit", zh: "位" },
403
+ "widget.lora.props.bit_range": { ru: "Биты", en: "Bits", zh: "位" },
404
+ "widget.lora.props.options": { ru: "Таблица кодов", en: "Code table", zh: "代码表" },
405
+ "widget.lora.props.options.info": {
406
+ ru: "Пары имя=код через пробел, например 125=4 250=5 500=6. Пусто - параметр вводится числом",
407
+ en: "Pairs name=code separated by spaces, e.g. 125=4 250=5 500=6. Empty - the parameter is entered as a number",
408
+ zh: "以空格分隔的 名称=代码 对,例如 125=4 250=5 500=6。为空 - 参数以数字输入",
409
+ },
410
+ "widget.lora.props.scale": { ru: "Масштаб", en: "Scale", zh: "比例" },
411
+ "widget.lora.props.offset": { ru: "Смещение", en: "Offset", zh: "偏移" },
412
+ "widget.lora.props.min": { ru: "Мин.", en: "Min", zh: "最小" },
413
+ "widget.lora.props.max": { ru: "Макс.", en: "Max", zh: "最大" },
414
+ "widget.lora.props.step": { ru: "Шаг", en: "Step", zh: "步长" },
339
415
  "widget.rgb.title": { ru: "RGB лента", en: "RGB Strip", zh: "RGB 灯带" },
340
416
  "widget.rgb.effect.static": { ru: "Статичный", en: "Static", zh: "静态" },
341
417
  "widget.rgb.effect.rainbow": { ru: "Радуга", en: "Rainbow", zh: "彩虹" },
package/dist/registry.js CHANGED
@@ -17,6 +17,7 @@ import VideoViewer from "./VideoViewer/VideoViewer.svelte";
17
17
  import Widget from "./Widget/Widget.svelte";
18
18
  import WidgetWiFi from "./WidgetWiFi/WidgetWiFi.svelte";
19
19
  import WidgetDeviceInfo from "./WidgetDeviceInfo/WidgetDeviceInfo.svelte";
20
+ import WidgetLoRa from "./WidgetLoRa/WidgetLoRa.svelte";
20
21
  import WidgetFileSystem from "./WidgetFileSystem/WidgetFileSystem.svelte";
21
22
  import WidgetStackInfo from "./WidgetStackInfo/WidgetStackInfo.svelte";
22
23
  import WidgetRGBStrip from "./WidgetRGBStrip/WidgetRGBStrip.svelte";
@@ -44,6 +45,7 @@ const VIEWS = {
44
45
  Widget,
45
46
  WidgetWiFi,
46
47
  WidgetDeviceInfo,
48
+ WidgetLoRa,
47
49
  WidgetFileSystem,
48
50
  WidgetStackInfo,
49
51
  WidgetRGBStrip,
package/dist/types.d.ts CHANGED
@@ -3,9 +3,11 @@ import type { AccentColor } from "./accent";
3
3
  import type { IMissionPlan } from "./WidgetMap/mission/plan";
4
4
  import type { IRoutePlan } from "./WidgetMap/mission/route";
5
5
  import type { IWidgetWiFiConfig, IWidgetDeviceInfoConfig, IWidgetRGBStripConfig, IWidgetPFDData, IWidgetMapData } from "./gui";
6
+ import type { LoRaParams } from "./WidgetLoRa/lora";
6
7
  export type { AccentColor } from "./accent";
7
8
  export type { PropertyChange } from "./propsEditor";
8
9
  export type { IWidgetWiFiConfig, IWidgetDeviceInfoConfig, IWidgetRGBStripConfig, IWidgetPFDData, IWidgetMapData } from "./gui";
10
+ export type { LoRaParams, LoRaParam, LoRaValues, ILoRaParamConfig, ILoRaOption } from "./WidgetLoRa/lora";
9
11
  export type IconSource = ConstructorOfATypedSvelteComponent | string;
10
12
  export interface UIComponentPropsMap {
11
13
  Accordion: IAccordionProps;
@@ -27,6 +29,7 @@ export interface UIComponentPropsMap {
27
29
  Widget: IWidgetProps;
28
30
  WidgetWiFi: IWidgetWiFiProps;
29
31
  WidgetDeviceInfo: IWidgetDeviceInfoProps;
32
+ WidgetLoRa: IWidgetLoRaProps;
30
33
  WidgetFileSystem: IWidgetFileSystemProps;
31
34
  WidgetStackInfo: IWidgetStackInfoProps;
32
35
  WidgetRGBStrip: IWidgetRGBStripProps;
@@ -436,6 +439,10 @@ export interface ITableButton<T extends object> {
436
439
  class?: string | ((row: T) => string);
437
440
  eventHandler?: IUIComponentHandler;
438
441
  onClick?: (row: T) => void;
442
+ hideIf?: {
443
+ key: string;
444
+ value: string | number;
445
+ };
439
446
  }
440
447
  export interface ITableProgressBar<T extends object> {
441
448
  key: keyof T;
@@ -647,6 +654,20 @@ export interface IWidgetDeviceInfoProps {
647
654
  onRestart?: () => void;
648
655
  onFactoryReset?: () => void;
649
656
  }
657
+ export interface IWidgetLoRaProps {
658
+ id?: string;
659
+ wrapperClass?: string;
660
+ accent?: AccentColor;
661
+ label?: {
662
+ name?: string;
663
+ };
664
+ value?: Record<string, unknown>;
665
+ params?: LoRaParams;
666
+ preset?: string;
667
+ collapsed?: boolean;
668
+ persistKey?: string;
669
+ onSave?: (values: Record<string, number>) => void;
670
+ }
650
671
  export interface IWidgetFileSystemFile {
651
672
  Name: string;
652
673
  Size: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "2.14.1",
3
+ "version": "2.15.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Oleg-Perevyshin/ElementsUI.git"