poe-svelte-ui-lib 2.36.0 → 2.38.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/dist/FieldLabel.svelte +6 -6
- package/dist/GUIRenderer/GUIRenderer.svelte +13 -6
- package/dist/Graph/Graph.svelte +3 -1
- package/dist/InfoHint.svelte +2 -1
- package/dist/Input/Input.svelte +7 -5
- package/dist/Joystick/Joystick.svelte +20 -19
- package/dist/Loader/Loader.svelte +4 -4
- package/dist/Select/Select.svelte +6 -4
- package/dist/Slider/Slider.svelte +3 -1
- package/dist/Switch/Switch.svelte +6 -2
- package/dist/Table/Table.svelte +3 -1
- package/dist/Widget/Widget.svelte +6 -2
- package/dist/WidgetDeviceInfo/CpuIcon.svelte +6 -6
- package/dist/WidgetDeviceInfo/RestartIcon.svelte +3 -3
- package/dist/WidgetFileSystem/RefreshIcon.svelte +4 -4
- package/dist/WidgetFileSystem/StorageIcon.svelte +4 -4
- package/dist/WidgetFileSystem/WidgetFileSystem.svelte +3 -3
- package/dist/WidgetFirmware/FirmwareIcon.svelte +4 -4
- package/dist/WidgetFirmware/README.md +14 -13
- package/dist/WidgetFirmware/WidgetFirmware.svelte +18 -15
- package/dist/WidgetFirmware/progress.d.ts +12 -0
- package/dist/WidgetFirmware/progress.js +9 -0
- package/dist/WidgetHeader.svelte +3 -1
- package/dist/WidgetLoRa/RadioIcon.svelte +4 -4
- package/dist/WidgetMap/FitIcon.svelte +4 -4
- package/dist/WidgetMap/MapIcon.svelte +3 -10
- package/dist/WidgetMap/WidgetMap.svelte +6 -6
- package/dist/WidgetMap/mapWrapper/utils.js +1 -1
- package/dist/WidgetMap/mission/MapAgro.svelte +57 -47
- package/dist/WidgetMap/mission/MapRoute.svelte +16 -12
- package/dist/WidgetMap/mission/MissionIcon.svelte +3 -3
- package/dist/WidgetMap/mission/MissionSim.svelte +9 -9
- package/dist/WidgetPFD/PlaneIcon.svelte +4 -4
- package/dist/WidgetPFD/WidgetPFD.svelte +25 -23
- package/dist/WidgetRGBStrip/LightIcon.svelte +4 -4
- package/dist/WidgetStackInfo/MemoryIcon.svelte +4 -4
- package/dist/WidgetStackInfo/RefreshIcon.svelte +4 -4
- package/dist/WidgetStackInfo/WidgetStackInfo.svelte +6 -6
- package/dist/WidgetWiFi/SearchIcon.svelte +4 -4
- package/dist/WidgetWiFi/WarningIcon.svelte +4 -4
- package/dist/WidgetWiFi/WifiIcon.svelte +4 -4
- package/dist/libIcons/ArrowIcon.svelte +4 -4
- package/dist/libIcons/ButtonAdd.svelte +4 -4
- package/dist/libIcons/ButtonClear.svelte +6 -6
- package/dist/libIcons/ButtonDelete.svelte +4 -4
- package/dist/libIcons/ButtonDownload.svelte +4 -4
- package/dist/libIcons/ColumnsIcon.svelte +5 -5
- package/dist/libIcons/CommandListIcon.svelte +4 -4
- package/dist/libIcons/CrossIcon.svelte +6 -6
- package/dist/libIcons/Error.svelte +4 -4
- package/dist/libIcons/EyeIcon.svelte +5 -5
- package/dist/libIcons/EyeSlashIcon.svelte +6 -6
- package/dist/libIcons/GraphIcon.svelte +4 -4
- package/dist/libIcons/InfoIcon.svelte +5 -5
- package/dist/libIcons/Library.svelte +4 -4
- package/dist/libIcons/MoreIcon.svelte +3 -3
- package/dist/libIcons/MoveVerticalIcon.svelte +6 -6
- package/dist/libIcons/PlugIcon.svelte +3 -1
- package/dist/libIcons/RestartIcon.svelte +4 -4
- package/dist/libIcons/SendIcon.svelte +4 -4
- package/dist/libIcons/ThemeIcon.svelte +6 -6
- package/dist/libIcons/UnplugIcon.svelte +4 -3
- package/dist/types.d.ts +1 -0
- package/package.json +8 -7
package/dist/FieldLabel.svelte
CHANGED
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
|
|
20
20
|
{#if label?.name}
|
|
21
21
|
{#if htmlFor}
|
|
22
|
-
<label for={htmlFor} {id} class={base}
|
|
23
|
-
|
|
24
|
-
>
|
|
22
|
+
<label for={htmlFor} {id} class={base}>
|
|
23
|
+
{label.name}{#if info}<InfoHint text={info} />{/if}
|
|
24
|
+
</label>
|
|
25
25
|
{:else}
|
|
26
|
-
<span {id} class={base}
|
|
27
|
-
|
|
28
|
-
>
|
|
26
|
+
<span {id} class={base}>
|
|
27
|
+
{label.name}{#if info}<InfoHint text={info} />{/if}
|
|
28
|
+
</span>
|
|
29
29
|
{/if}
|
|
30
30
|
{:else if info}
|
|
31
31
|
<span class={twMerge(base, "min-h-4")}><InfoHint text={info} /></span>
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
} from "../gui"
|
|
31
31
|
import { loraKeys } from "../WidgetLoRa/lora"
|
|
32
32
|
import { updateViaHub, type FirmwareTarget } from "../WidgetFirmware/firmware"
|
|
33
|
+
import { flashingModules } from "../WidgetFirmware/progress"
|
|
33
34
|
import { COMPONENT_META } from "../componentMeta"
|
|
34
35
|
import DeviceTable from "./DeviceTable.svelte"
|
|
35
36
|
import type { GuiViews } from "../guiViews"
|
|
@@ -158,11 +159,10 @@
|
|
|
158
159
|
const key = `${argument}:${maxNameLength}`
|
|
159
160
|
return transfers.get(key) ?? transfers.set(key, createFsTransfer(link, { argument, maxNameLength })).get(key)!
|
|
160
161
|
}
|
|
161
|
-
/* Обновление прошивки модуля (WidgetFirmware): версия - через хаб, иначе образ из каталога напрямую через загрузчик; файл - напрямую; одно обновление за раз */
|
|
162
|
-
let flashing = false
|
|
162
|
+
/* Обновление прошивки модуля (WidgetFirmware): версия - через хаб, иначе образ из каталога напрямую через загрузчик; файл - напрямую; одно обновление за раз на всё приложение (не на экземпляр рендерера: GUI мог пересоздаться посреди обновления) */
|
|
163
163
|
const updateFirmware = async (target: FirmwareTarget, source: WidgetFirmwareSource, onProgress: (stage: WidgetFirmwareStage, percent: number) => void) => {
|
|
164
|
-
if (
|
|
165
|
-
|
|
164
|
+
if (flashingModules.size) return fail(new Error($T("widget.firmware.busy")))
|
|
165
|
+
flashingModules.add(target.ModSN)
|
|
166
166
|
const direct = (image: Uint8Array) =>
|
|
167
167
|
updateModuleFirmware(link, image, {
|
|
168
168
|
onProgress: (stage, done, total) => onProgress(stage, stage === "write" ? (total ? (done / total) * 100 : 0) : stage === "verify" ? 100 : 0),
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
} catch (error) {
|
|
175
175
|
fail(error)
|
|
176
176
|
} finally {
|
|
177
|
-
|
|
177
|
+
flashingModules.delete(target.ModSN)
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
@@ -246,6 +246,9 @@
|
|
|
246
246
|
/* Уже NARROW_MAX_PX (телефон, узкая панель) - раскладка по группам автора (layoutFlow в gui.ts), иначе его сетка */
|
|
247
247
|
const NARROW_MAX_PX = 640
|
|
248
248
|
let width = $state(0)
|
|
249
|
+
|
|
250
|
+
/* Раскрытие аккордеонов по id: смена раскладки (ширина около NARROW_MAX_PX, полоса прокрутки появилась от раскрытия) пересоздаёт их, без этой памяти раздел закрывался сразу после открытия */
|
|
251
|
+
const opened = $state<Record<string, boolean>>({})
|
|
249
252
|
const narrow = $derived(width > 0 && width < NARROW_MAX_PX)
|
|
250
253
|
|
|
251
254
|
/* Группа из мелких блоков (канал, мотор) - в рамке; виджеты и графики - уже карточки */
|
|
@@ -333,7 +336,10 @@
|
|
|
333
336
|
{@render render[component.type]?.(component)}
|
|
334
337
|
{:else if component.type === "Accordion" && views.Accordion}
|
|
335
338
|
{@const Accordion = views.Accordion}
|
|
336
|
-
<Accordion
|
|
339
|
+
<Accordion
|
|
340
|
+
{...component.properties}
|
|
341
|
+
bind:isOpen={() => opened[component.id] ?? !!component.properties.isOpen, (open: boolean) => (opened[component.id] = open)}
|
|
342
|
+
>
|
|
337
343
|
<!-- Своя сетка содержимого во всю ширину аккордеона: колонок не меньше, чем у самого дальнего блока -->
|
|
338
344
|
<div class="min-w-0" style="grid-column: 1 / -1; grid-row: 1 / -1">
|
|
339
345
|
{@render Layout(childrenOf(component).filter(visible), component.properties.size?.width ?? 1, !!component.properties.image)}
|
|
@@ -529,6 +535,7 @@
|
|
|
529
535
|
versions={(link.get("VerFW-S") as IOption<number>[] | undefined) ?? []}
|
|
530
536
|
sources={{ version: !!(target?.hub || target?.catalog), file: !!target?.file }}
|
|
531
537
|
persistKey={persist(component)}
|
|
538
|
+
progressKey={firmware?.ModSN}
|
|
532
539
|
onUpdate={target ? (source, onProgress) => updateFirmware(target, source, onProgress) : undefined}
|
|
533
540
|
/>
|
|
534
541
|
{:else if component.type === "WidgetRGBStrip" && views.WidgetRGBStrip}
|
package/dist/Graph/Graph.svelte
CHANGED
|
@@ -511,8 +511,10 @@
|
|
|
511
511
|
<span class="truncate font-semibold" title={item.name}>{item.name}</span>
|
|
512
512
|
<span
|
|
513
513
|
class="min-w-[10ch] text-right whitespace-nowrap tabular-nums {outOfScale[i] ? 'text-(--red-text)' : ''}"
|
|
514
|
-
title={outOfScale[i] ? $T("ui.scale.out") : undefined}
|
|
514
|
+
title={outOfScale[i] ? $T("ui.scale.out") : undefined}
|
|
515
515
|
>
|
|
516
|
+
{item.value?.toFixed(2)}
|
|
517
|
+
</span>
|
|
516
518
|
{/each}
|
|
517
519
|
</div>
|
|
518
520
|
</div>
|
package/dist/InfoHint.svelte
CHANGED
|
@@ -70,7 +70,8 @@
|
|
|
70
70
|
>
|
|
71
71
|
<span
|
|
72
72
|
class="w-max max-w-full rounded-lg border border-(--hairline-color) bg-(--back-color) px-2.5 py-1.5 text-left text-[12px] font-medium whitespace-pre-line text-(--font-color) normal-case shadow-(--elevation-2)"
|
|
73
|
-
>{#each hintParts(text) as part}{#if part.bold}<b class="font-bold">{part.text}</b>{:else}{part.text}{/if}{/each}</span
|
|
74
73
|
>
|
|
74
|
+
{#each hintParts(text) as part}{#if part.bold}<b class="font-bold">{part.text}</b>{:else}{part.text}{/if}{/each}
|
|
75
|
+
</span>
|
|
75
76
|
</div>
|
|
76
77
|
{/if}
|
package/dist/Input/Input.svelte
CHANGED
|
@@ -159,8 +159,8 @@
|
|
|
159
159
|
onclick={() => (showPassword = !showPassword)}
|
|
160
160
|
aria-label={showPassword ? $T("ui.password.hide") : $T("ui.password.show")}
|
|
161
161
|
>
|
|
162
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"
|
|
163
|
-
|
|
162
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
|
|
163
|
+
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
|
|
164
164
|
{#if showPassword}
|
|
165
165
|
<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" />
|
|
166
166
|
{:else}
|
|
@@ -168,8 +168,8 @@
|
|
|
168
168
|
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"
|
|
169
169
|
/><path d="m4 4l16 16" />
|
|
170
170
|
{/if}
|
|
171
|
-
</g
|
|
172
|
-
>
|
|
171
|
+
</g>
|
|
172
|
+
</svg>
|
|
173
173
|
</button>
|
|
174
174
|
{/if}
|
|
175
175
|
|
|
@@ -201,8 +201,10 @@
|
|
|
201
201
|
? 'border-b border-(--hairline-color)'
|
|
202
202
|
: ''}"
|
|
203
203
|
onclick={() => stepBy(direction)}
|
|
204
|
-
aria-label={direction === 1 ? $T("ui.increase") : $T("ui.decrease")}
|
|
204
|
+
aria-label={direction === 1 ? $T("ui.increase") : $T("ui.decrease")}
|
|
205
205
|
>
|
|
206
|
+
{direction === 1 ? "▲" : "▼"}
|
|
207
|
+
</button>
|
|
206
208
|
{/each}
|
|
207
209
|
</div>
|
|
208
210
|
{/if}
|
|
@@ -97,11 +97,12 @@
|
|
|
97
97
|
width={direction.main ? 32 : 16}
|
|
98
98
|
height={direction.main ? 32 : 16}
|
|
99
99
|
viewBox="0 0 24 24"
|
|
100
|
-
|
|
100
|
+
>
|
|
101
|
+
<path
|
|
101
102
|
fill="currentColor"
|
|
102
103
|
d="M12.6 12L8.7 8.1q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275l4.6 4.6q.15.15.213.325t.062.375t-.062.375t-.213.325l-4.6 4.6q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7z"
|
|
103
|
-
|
|
104
|
-
>
|
|
104
|
+
/>
|
|
105
|
+
</svg>
|
|
105
106
|
</span>
|
|
106
107
|
</button>
|
|
107
108
|
{/each}
|
|
@@ -134,12 +135,12 @@
|
|
|
134
135
|
{#if buttonIcon}
|
|
135
136
|
<Icon icon={buttonIcon} class="contents" />
|
|
136
137
|
{:else}
|
|
137
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"
|
|
138
|
-
|
|
138
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">
|
|
139
|
+
<path
|
|
139
140
|
fill="currentColor"
|
|
140
141
|
d="M6 19h3v-5q0-.425.288-.712T10 13h4q.425 0 .713.288T15 14v5h3v-9l-6-4.5L6 10zm-2 0v-9q0-.475.213-.9t.587-.7l6-4.5q.525-.4 1.2-.4t1.2.4l6 4.5q.375.275.588.7T20 10v9q0 .825-.588 1.413T18 21h-4q-.425 0-.712-.288T13 20v-5h-2v5q0 .425-.288.713T10 21H6q-.825 0-1.412-.587T4 19m8-6.75"
|
|
141
|
-
|
|
142
|
-
>
|
|
142
|
+
/>
|
|
143
|
+
</svg>
|
|
143
144
|
{/if}
|
|
144
145
|
</button>
|
|
145
146
|
</div>
|
|
@@ -174,14 +175,14 @@
|
|
|
174
175
|
onmouseenter={(e) => (e.currentTarget.style.backgroundColor = "color-mix(in srgb, var(--bg-color), var(--shadow-color) 30%)")}
|
|
175
176
|
onmouseleave={(e) => (e.currentTarget.style.backgroundColor = "")}
|
|
176
177
|
>
|
|
177
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="segment-icon rotate-270" width="24" height="24" viewBox="0 0 24 24"
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="segment-icon rotate-270" width="24" height="24" viewBox="0 0 24 24">
|
|
179
|
+
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5">
|
|
180
|
+
<path
|
|
180
181
|
stroke-miterlimit="10"
|
|
181
182
|
d="M6.395 7.705A7.9 7.9 0 0 1 12 5.382a7.93 7.93 0 0 1 7.929 7.929A7.94 7.94 0 0 1 12 21.25a7.94 7.94 0 0 1-7.929-7.94"
|
|
182
|
-
/><path stroke-linejoin="round" d="m7.12 2.75l-.95 3.858a1.33 1.33 0 0 0 .97 1.609l3.869.948"
|
|
183
|
-
|
|
184
|
-
>
|
|
183
|
+
/><path stroke-linejoin="round" d="m7.12 2.75l-.95 3.858a1.33 1.33 0 0 0 .97 1.609l3.869.948" />
|
|
184
|
+
</g>
|
|
185
|
+
</svg>
|
|
185
186
|
</button>
|
|
186
187
|
<button
|
|
187
188
|
class="btn-segment h-full cursor-pointer rounded-r-full px-3.5"
|
|
@@ -190,14 +191,14 @@
|
|
|
190
191
|
onmouseenter={(e) => (e.currentTarget.style.backgroundColor = "color-mix(in srgb, var(--bg-color), var(--shadow-color) 30%)")}
|
|
191
192
|
onmouseleave={(e) => (e.currentTarget.style.backgroundColor = "")}
|
|
192
193
|
>
|
|
193
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="segment-icon rotate-90" width="24" height="24" viewBox="0 0 24 24"
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="segment-icon rotate-90" width="24" height="24" viewBox="0 0 24 24">
|
|
195
|
+
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5">
|
|
196
|
+
<path
|
|
196
197
|
stroke-miterlimit="10"
|
|
197
198
|
d="M17.605 7.705A7.9 7.9 0 0 0 12 5.382a7.93 7.93 0 0 0-7.929 7.929A7.94 7.94 0 0 0 12 21.25a7.94 7.94 0 0 0 7.929-7.94"
|
|
198
|
-
/><path stroke-linejoin="round" d="m16.88 2.75l.95 3.858a1.33 1.33 0 0 1-.97 1.609l-3.869.948"
|
|
199
|
-
|
|
200
|
-
>
|
|
199
|
+
/><path stroke-linejoin="round" d="m16.88 2.75l.95 3.858a1.33 1.33 0 0 1-.97 1.609l-3.869.948" />
|
|
200
|
+
</g>
|
|
201
|
+
</svg>
|
|
201
202
|
</button>
|
|
202
203
|
</div>
|
|
203
204
|
{/if}
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
aria-label={label || undefined}
|
|
13
13
|
aria-hidden={label ? undefined : "true"}
|
|
14
14
|
>
|
|
15
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" class="animate-spin [animation-duration:0.8s]"
|
|
16
|
-
|
|
15
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" class="animate-spin [animation-duration:0.8s]">
|
|
16
|
+
<path fill="currentColor" d="M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z" opacity=".35" /><path
|
|
17
17
|
fill="currentColor"
|
|
18
18
|
d="M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"
|
|
19
|
-
|
|
20
|
-
>
|
|
19
|
+
/>
|
|
20
|
+
</svg>
|
|
21
21
|
</span>
|
|
@@ -233,9 +233,9 @@
|
|
|
233
233
|
<!-- Невидимые подписи вариантов: по их ширине решается, помещается ли группа кнопок -->
|
|
234
234
|
<div bind:this={measureElement} class="pointer-events-none invisible absolute top-0 left-0 flex h-0 w-max overflow-hidden" aria-hidden="true">
|
|
235
235
|
{#each options as option, index (option.id ?? index)}
|
|
236
|
-
<span class="flex gap-1.5 text-[13px] font-semibold whitespace-nowrap"
|
|
237
|
-
|
|
238
|
-
>
|
|
236
|
+
<span class="flex gap-1.5 text-[13px] font-semibold whitespace-nowrap">
|
|
237
|
+
{#if option.icon}<span class="w-(--icon-size)"></span>{/if}{option.icon && !showNames ? "" : option.name}
|
|
238
|
+
</span>
|
|
239
239
|
{/each}
|
|
240
240
|
</div>
|
|
241
241
|
{/if}
|
|
@@ -265,8 +265,10 @@
|
|
|
265
265
|
stroke="currentColor"
|
|
266
266
|
stroke-width="2"
|
|
267
267
|
stroke-linecap="round"
|
|
268
|
-
stroke-linejoin="round"
|
|
268
|
+
stroke-linejoin="round"
|
|
269
269
|
>
|
|
270
|
+
<path d="M6 9l6 6 6-6" />
|
|
271
|
+
</svg>
|
|
270
272
|
</button>
|
|
271
273
|
{:else if shownType === "input"}
|
|
272
274
|
<input
|
|
@@ -91,8 +91,10 @@
|
|
|
91
91
|
: target === "upper" || !isRange
|
|
92
92
|
? v >= number.maxNum
|
|
93
93
|
: v >= upper - number.step)}
|
|
94
|
-
aria-label={direction === 1 ? $T("ui.increase") : $T("ui.decrease")}
|
|
94
|
+
aria-label={direction === 1 ? $T("ui.increase") : $T("ui.decrease")}
|
|
95
95
|
>
|
|
96
|
+
{direction === 1 ? "+" : "−"}
|
|
97
|
+
</button>
|
|
96
98
|
{/each}
|
|
97
99
|
<span class="inline-block text-center text-[13px] font-semibold tabular-nums" style="width: {valueWidth}">{v}</span>
|
|
98
100
|
</div>
|
|
@@ -79,8 +79,10 @@
|
|
|
79
79
|
? 'cursor-pointer text-(--muted-color)'
|
|
80
80
|
: 'cursor-pointer text-(--font-color)'}"
|
|
81
81
|
style="width: {maxCaptionWidth}; text-align: end;"
|
|
82
|
-
onclick={() => handleCaptionClick(0)}
|
|
82
|
+
onclick={() => handleCaptionClick(0)}
|
|
83
83
|
>
|
|
84
|
+
{label.captionLeft}
|
|
85
|
+
</button>
|
|
84
86
|
{/if}
|
|
85
87
|
|
|
86
88
|
<label class="relative flex items-center justify-between {option.disabled ? 'cursor-not-allowed' : ''}">
|
|
@@ -120,8 +122,10 @@
|
|
|
120
122
|
? 'cursor-pointer text-(--font-color)'
|
|
121
123
|
: 'cursor-pointer text-(--muted-color)'}"
|
|
122
124
|
style="width: {maxCaptionWidth}; text-align: start;"
|
|
123
|
-
onclick={() => handleCaptionClick(1)}
|
|
125
|
+
onclick={() => handleCaptionClick(1)}
|
|
124
126
|
>
|
|
127
|
+
{label.captionRight}
|
|
128
|
+
</button>
|
|
125
129
|
{#if infoAfterCaption && help?.info}<span class="ml-1 flex"><InfoHint text={help.info} /></span>{/if}
|
|
126
130
|
{/if}
|
|
127
131
|
</div>
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -87,8 +87,10 @@
|
|
|
87
87
|
: 'text-(--muted-color)'}"
|
|
88
88
|
style="width: {maxCaptionWidth}; text-align: {align};"
|
|
89
89
|
disabled={readonly}
|
|
90
|
-
onclick={() => handleCaptionClick(next)}
|
|
90
|
+
onclick={() => handleCaptionClick(next)}
|
|
91
91
|
>
|
|
92
|
+
{text}
|
|
93
|
+
</button>
|
|
92
94
|
{/if}
|
|
93
95
|
{/snippet}
|
|
94
96
|
|
|
@@ -97,8 +99,10 @@
|
|
|
97
99
|
class={stepBtn}
|
|
98
100
|
onclick={() => commit(clamp(current + direction * step))}
|
|
99
101
|
disabled={readonly || (direction === 1 ? current >= maxNumber : current <= minNumber)}
|
|
100
|
-
aria-label={direction === 1 ? $T("ui.increase") : $T("ui.decrease")}
|
|
102
|
+
aria-label={direction === 1 ? $T("ui.increase") : $T("ui.decrease")}
|
|
101
103
|
>
|
|
104
|
+
{direction === 1 ? "+" : "−"}
|
|
105
|
+
</button>
|
|
102
106
|
{/snippet}
|
|
103
107
|
|
|
104
108
|
<div class={twMerge("h-full w-full", wrapperClass)} style={accentStyle(accent)}>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts"></script>
|
|
2
2
|
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
4
|
+
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
|
|
5
|
+
<rect x="4" y="4" width="16" height="16" rx="2" /><rect x="9" y="9" width="6" height="6" /><path
|
|
6
6
|
d="M9 1v3M15 1v3M9 20v3M15 20v3M20 9h3M20 14h3M1 9h3M1 14h3"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
>
|
|
7
|
+
/>
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts"></script>
|
|
2
2
|
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
|
|
4
|
-
|
|
5
|
-
>
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
4
|
+
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6" />
|
|
5
|
+
</svg>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts"></script>
|
|
2
2
|
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
|
|
4
|
-
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
4
|
+
<path
|
|
5
5
|
fill="none"
|
|
6
6
|
stroke="currentColor"
|
|
7
7
|
stroke-linecap="round"
|
|
8
8
|
stroke-linejoin="round"
|
|
9
9
|
stroke-width="2"
|
|
10
10
|
d="M21 12a9 9 0 0 0-9-9a9.75 9.75 0 0 0-6.74 2.74L3 8m0-5v5h5m-5 4a9 9 0 0 0 9 9a9.75 9.75 0 0 0 6.74-2.74L21 16m-5 0h5v5"
|
|
11
|
-
|
|
12
|
-
>
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts"></script>
|
|
2
2
|
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
|
|
4
|
-
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
4
|
+
<path
|
|
5
5
|
fill="none"
|
|
6
6
|
stroke="currentColor"
|
|
7
7
|
stroke-linecap="round"
|
|
8
8
|
stroke-linejoin="round"
|
|
9
9
|
stroke-width="2"
|
|
10
10
|
d="M22 12H2m20 0v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-6m20 0-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11L2 12m4 4h.01M10 16h.01"
|
|
11
|
-
|
|
12
|
-
>
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
@@ -182,9 +182,9 @@
|
|
|
182
182
|
</div>
|
|
183
183
|
{/if}
|
|
184
184
|
{#if downloading}
|
|
185
|
-
<span class="mt-2 truncate text-[12px] text-(--muted-color)" transition:slide={{ duration: 100 }}
|
|
186
|
-
|
|
187
|
-
>
|
|
185
|
+
<span class="mt-2 truncate text-[12px] text-(--muted-color)" transition:slide={{ duration: 100 }}>
|
|
186
|
+
{$T("widget.fs.downloading", { name: downloading })}
|
|
187
|
+
</span>
|
|
188
188
|
{/if}
|
|
189
189
|
{#if downloadError}
|
|
190
190
|
<span class="mt-2 text-[12px] text-(--red-text)" transition:slide={{ duration: 100 }}>{downloadError}</span>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts"></script>
|
|
2
2
|
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
|
|
4
|
-
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
4
|
+
<path
|
|
5
5
|
fill="none"
|
|
6
6
|
stroke="currentColor"
|
|
7
7
|
stroke-linecap="round"
|
|
8
8
|
stroke-linejoin="round"
|
|
9
9
|
stroke-width="2"
|
|
10
10
|
d="M9 2v2m6-2v2M9 20v2m6-2v2M2 9h2m-2 6h2m16-6h2m-2 6h2M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m6 4v8m-3-3l3 3l3-3"
|
|
11
|
-
|
|
12
|
-
>
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
@@ -95,19 +95,20 @@ interface FirmwareTarget {
|
|
|
95
95
|
<details>
|
|
96
96
|
<summary>⚙️ Пропсы</summary>
|
|
97
97
|
|
|
98
|
-
| Название | Тип | По умолчанию | Описание
|
|
99
|
-
| -------------- | ------------------------------------------------------------------------------------ | ------------ |
|
|
100
|
-
| `id` | `string` | `"CFG"` | Группа поля `DevFW`
|
|
101
|
-
| `value` | `{ DevFW?: number }` | | Текущая версия
|
|
102
|
-
| `versions` | `IOption<number>[]` | `[]` | Версии из каталога (`VerFW-S`)
|
|
103
|
-
| `accept` | `string` | `".bin"` | Какие файлы можно выбрать
|
|
104
|
-
| `sources` | `{ version?: boolean; file?: boolean }` | `{}` | Что умеет приложение: версия из каталога, файл
|
|
105
|
-
| `label.name` | `string` | | Заголовок. Пусто - «Прошивка» на языке пользователя
|
|
106
|
-
| `wrapperClass` | `string` | `""` | Классы обёртки
|
|
107
|
-
| `accent` | `AccentColor` | | Мастер-цвет
|
|
108
|
-
| `collapsed` | `boolean` | `false` | Свёрнут ли. Можно связать через `bind:collapsed`
|
|
109
|
-
| `persistKey` | `string` | | Ключ для запоминания свёрнутости и подсказок
|
|
110
|
-
| `
|
|
98
|
+
| Название | Тип | По умолчанию | Описание |
|
|
99
|
+
| -------------- | ------------------------------------------------------------------------------------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| `id` | `string` | `"CFG"` | Группа поля `DevFW` |
|
|
101
|
+
| `value` | `{ DevFW?: number }` | | Текущая версия |
|
|
102
|
+
| `versions` | `IOption<number>[]` | `[]` | Версии из каталога (`VerFW-S`) |
|
|
103
|
+
| `accept` | `string` | `".bin"` | Какие файлы можно выбрать |
|
|
104
|
+
| `sources` | `{ version?: boolean; file?: boolean }` | `{}` | Что умеет приложение: версия из каталога, файл |
|
|
105
|
+
| `label.name` | `string` | | Заголовок. Пусто - «Прошивка» на языке пользователя |
|
|
106
|
+
| `wrapperClass` | `string` | `""` | Классы обёртки |
|
|
107
|
+
| `accent` | `AccentColor` | | Мастер-цвет |
|
|
108
|
+
| `collapsed` | `boolean` | `false` | Свёрнут ли. Можно связать через `bind:collapsed` |
|
|
109
|
+
| `persistKey` | `string` | | Ключ для запоминания свёрнутости и подсказок |
|
|
110
|
+
| `progressKey` | `string` | | Ключ хода обновления вне виджета, обычно серийный номер модуля (GUIRenderer передаёт `firmware.ModSN`): виджет, пересозданный посреди обновления, сразу показывает идущий ход, второе обновление того же модуля не запускается; ход - `firmwareProgress` из `progress.ts` |
|
|
111
|
+
| `onUpdate` | `(source: {VerFW} \| {file}, onProgress: (stage, percent) => void) => Promise<void>` | | Запуск обновления; промис завершается вместе с ним. Без него виджет неактивен |
|
|
111
112
|
|
|
112
113
|
`stage` - `"start" | "bootloader" | "erase" | "write" | "verify" | "hub"` (`WidgetFirmwareStage`).
|
|
113
114
|
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import { accentStyle } from "../accent"
|
|
13
13
|
import { readPersistedCollapsed, writePersistedCollapsed } from "../widgetCollapse"
|
|
14
14
|
import { FirmwareUpdateError } from "../firmwareUpdate"
|
|
15
|
+
import { FIRMWARE_PROGRESS_IDLE, firmwareProgress, patchFirmwareProgress } from "./progress"
|
|
15
16
|
|
|
16
17
|
let {
|
|
17
18
|
wrapperClass = "",
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
sources = {},
|
|
24
25
|
collapsed = $bindable(false),
|
|
25
26
|
persistKey,
|
|
27
|
+
progressKey,
|
|
26
28
|
onUpdate,
|
|
27
29
|
}: IWidgetFirmwareProps = $props()
|
|
28
30
|
|
|
@@ -51,10 +53,15 @@
|
|
|
51
53
|
const enabled = $derived(!!onUpdate && (!!sources.version || !!sources.file))
|
|
52
54
|
|
|
53
55
|
let selected: number | null = $state(null)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
|
|
57
|
+
/* Ход - в общем хранилище по progressKey (серийный номер модуля): обновление идёт дальше, даже если GUI пересоздан, новый виджет его показывает; без ключа - свой у экземпляра */
|
|
58
|
+
const ownKey = `local:${Math.random().toString(36).slice(2)}`
|
|
59
|
+
const key = $derived(progressKey ?? ownKey)
|
|
60
|
+
const progress = $derived(firmwareProgress.get(key) ?? FIRMWARE_PROGRESS_IDLE)
|
|
61
|
+
const running = $derived(progress.running)
|
|
62
|
+
const stage = $derived(progress.stage)
|
|
63
|
+
const percent = $derived(progress.percent)
|
|
64
|
+
const errorText = $derived(progress.errorText)
|
|
58
65
|
|
|
59
66
|
const canUpdate = $derived(enabled && !!sources.version && selected !== null && !running)
|
|
60
67
|
|
|
@@ -72,23 +79,19 @@
|
|
|
72
79
|
/* Одно обновление за раз: ход приходит от приложения через onProgress */
|
|
73
80
|
const start = async (source: WidgetFirmwareSource) => {
|
|
74
81
|
if (!onUpdate || running) return
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
percent
|
|
78
|
-
stage = "start"
|
|
82
|
+
/* Ключ запоминается на всё обновление: ход пишется туда же, даже если виджет за это время пересоздан */
|
|
83
|
+
const at = key
|
|
84
|
+
patchFirmwareProgress(at, { running: true, errorText: "", percent: 0, stage: "start" })
|
|
79
85
|
try {
|
|
80
86
|
await onUpdate(source, (next, value) => {
|
|
81
|
-
stage = next
|
|
82
87
|
/* Целые проценты: полоса показывает 1, 2, 3 без дробей */
|
|
83
|
-
percent
|
|
88
|
+
patchFirmwareProgress(at, { stage: next, percent: Math.floor(Math.min(100, Math.max(0, Number.isFinite(value) ? value : 0))) })
|
|
84
89
|
})
|
|
85
|
-
percent
|
|
86
|
-
stage = "done"
|
|
90
|
+
patchFirmwareProgress(at, { percent: 100, stage: "done" })
|
|
87
91
|
} catch (error) {
|
|
88
|
-
errorText
|
|
89
|
-
stage = "error"
|
|
92
|
+
patchFirmwareProgress(at, { errorText: describe(error), stage: "error" })
|
|
90
93
|
} finally {
|
|
91
|
-
running
|
|
94
|
+
patchFirmwareProgress(at, { running: false })
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SvelteMap } from "svelte/reactivity";
|
|
2
|
+
import type { WidgetFirmwareStage } from "../types";
|
|
3
|
+
export interface FirmwareProgressState {
|
|
4
|
+
running: boolean;
|
|
5
|
+
stage: WidgetFirmwareStage | "done" | "error" | null;
|
|
6
|
+
percent: number;
|
|
7
|
+
errorText: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const FIRMWARE_PROGRESS_IDLE: FirmwareProgressState;
|
|
10
|
+
export declare const firmwareProgress: SvelteMap<string, FirmwareProgressState>;
|
|
11
|
+
export declare const patchFirmwareProgress: (key: string, patch: Partial<FirmwareProgressState>) => SvelteMap<string, FirmwareProgressState>;
|
|
12
|
+
export declare const flashingModules: Set<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* $lib/WidgetFirmware/progress.ts - ход обновления прошивки вне виджета: по ключу (серийный номер модуля), живёт, пока открыто приложение. GUI пересоздаётся (смена раскладки, новый GUI, модуль ушёл в загрузчик) - новый WidgetFirmware сразу показывает идущее обновление, а второе на тот же модуль не запускается */
|
|
2
|
+
import { SvelteMap } from "svelte/reactivity";
|
|
3
|
+
export const FIRMWARE_PROGRESS_IDLE = { running: false, stage: null, percent: 0, errorText: "" };
|
|
4
|
+
/* Ход по ключу; запись целиком (set), чтобы виджеты видели изменение */
|
|
5
|
+
export const firmwareProgress = new SvelteMap();
|
|
6
|
+
/* Обновить ход по ключу частично */
|
|
7
|
+
export const patchFirmwareProgress = (key, patch) => firmwareProgress.set(key, { ...(firmwareProgress.get(key) ?? FIRMWARE_PROGRESS_IDLE), ...patch });
|
|
8
|
+
/* Модули, чья прошивка обновляется сейчас: одно обновление за раз на всё приложение, а не на экземпляр GUIRenderer */
|
|
9
|
+
export const flashingModules = new Set();
|
package/dist/WidgetHeader.svelte
CHANGED
|
@@ -66,8 +66,10 @@
|
|
|
66
66
|
: 'border-(--hairline-color) bg-transparent text-(--faint-color) hover:text-(--muted-color)'}"
|
|
67
67
|
title={$hints ? $T("widget.hints.on") : $T("widget.hints.off")}
|
|
68
68
|
aria-pressed={$hints}
|
|
69
|
-
onclick={() => hints.update((on) => !on)}
|
|
69
|
+
onclick={() => hints.update((on) => !on)}
|
|
70
70
|
>
|
|
71
|
+
?
|
|
72
|
+
</button>
|
|
71
73
|
{/if}
|
|
72
74
|
</div>
|
|
73
75
|
{#if right && wrapped}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts"></script>
|
|
2
2
|
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
|
|
4
|
-
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
4
|
+
<path
|
|
5
5
|
fill="none"
|
|
6
6
|
stroke="currentColor"
|
|
7
7
|
stroke-linecap="round"
|
|
8
8
|
stroke-linejoin="round"
|
|
9
9
|
stroke-width="2"
|
|
10
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
|
-
|
|
12
|
-
>
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts"></script>
|
|
2
2
|
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"
|
|
4
|
-
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
|
4
|
+
<path
|
|
5
5
|
fill="none"
|
|
6
6
|
stroke="currentColor"
|
|
7
7
|
stroke-linecap="round"
|
|
8
8
|
stroke-linejoin="round"
|
|
9
9
|
stroke-width="2"
|
|
10
10
|
d="M4 9V5a1 1 0 0 1 1-1h4m6 0h4a1 1 0 0 1 1 1v4m0 6v4a1 1 0 0 1-1 1h-4m-6 0H5a1 1 0 0 1-1-1v-4m5-3a3 3 0 1 0 6 0a3 3 0 1 0-6 0"
|
|
11
|
-
|
|
12
|
-
>
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|