poe-svelte-ui-lib 2.3.0 → 2.3.2
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/Button/Button.svelte +1 -1
- package/dist/ExpandIcon.svelte +19 -0
- package/dist/ExpandIcon.svelte.d.ts +7 -0
- package/dist/SectionHead.svelte +21 -0
- package/dist/SectionHead.svelte.d.ts +9 -0
- package/dist/WidgetDeviceInfo/WidgetDeviceInfo.svelte +8 -6
- package/dist/WidgetFileSystem/WidgetFileSystem.svelte +5 -3
- package/dist/WidgetHeader.svelte +10 -7
- package/dist/WidgetHeader.svelte.d.ts +1 -1
- package/dist/WidgetMap/WidgetMap.svelte +11 -5
- package/dist/WidgetMap/mission/MapAgro.svelte +43 -51
- package/dist/WidgetMap/mission/MapRoute.svelte +26 -40
- package/dist/WidgetMap/mission/MissionActions.svelte +10 -3
- package/dist/WidgetMap/mission/MissionSim.svelte +9 -4
- package/dist/WidgetMap/mission/MissionSim.svelte.d.ts +1 -0
- package/dist/WidgetPFD/WidgetPFD.svelte +3 -3
- package/dist/WidgetRGBStrip/WidgetRGBStrip.svelte +8 -21
- package/dist/WidgetStackInfo/WidgetStackInfo.svelte +15 -5
- package/dist/WidgetWiFi/WidgetWiFi.svelte +8 -8
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/locales/translations.d.ts +15 -0
- package/dist/locales/translations.js +3 -0
- package/package.json +1 -1
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
|
|
82
82
|
{#if content.name?.trim()}
|
|
83
83
|
<!-- Длинная подпись на узкой кнопке - в две строки, а не обрезка -->
|
|
84
|
-
<span class="line-clamp-2 text-center leading-[1.05]
|
|
84
|
+
<span class="line-clamp-2 text-center leading-[1.05]">{content.name}</span>
|
|
85
85
|
{#if keyBind.key && keyBind.showHint}
|
|
86
86
|
<span class="ml-1 text-[11px] font-medium tabular-nums opacity-80">
|
|
87
87
|
{keyBind.ctrlKey ? "Ctrl+" : ""}{keyBind.shiftKey ? "Shift+" : ""}{keyBind.altKey ? "Alt+" : ""}{keyBind.key}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- $lib/ExpandIcon.svelte - значок раскрытия области: круглая кнопка со стрелкой вниз (можно раскрыть) или вверх (свернуть); рамка подсвечивается при наведении на предка с классом group -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { twMerge } from "tailwind-merge"
|
|
4
|
+
import ArrowIcon from "./libIcons/ArrowIcon.svelte"
|
|
5
|
+
|
|
6
|
+
let { open = false, class: className = "" }: { open?: boolean; class?: string } = $props()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<span
|
|
10
|
+
class={twMerge(
|
|
11
|
+
"flex size-7 shrink-0 items-center justify-center rounded-full border border-(--border-color) text-(--accent-text) transition-colors duration-150 group-hover:border-(--accent-text)",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
>
|
|
16
|
+
<span class="flex size-3.5 transition-transform duration-150 [&_svg]:h-full [&_svg]:w-full" style="transform: rotate({open ? -90 : 90}deg)">
|
|
17
|
+
<ArrowIcon />
|
|
18
|
+
</span>
|
|
19
|
+
</span>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!-- $lib/SectionHead.svelte - заголовок сворачиваемого раздела внутри виджета: название, под ним сводка, справа значок раскрытия; вся строка кликабельна и подсвечивается при наведении. onToggle - если открытость считает родитель -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import ExpandIcon from "./ExpandIcon.svelte"
|
|
4
|
+
|
|
5
|
+
let { title, summary = "", open = $bindable(false), onToggle }: { title: string; summary?: string; open?: boolean; onToggle?: () => void } = $props()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<button
|
|
9
|
+
type="button"
|
|
10
|
+
class="group -m-1.5 flex w-[calc(100%+0.75rem)] cursor-pointer items-center gap-3 rounded-lg border-none bg-transparent p-1.5 text-left transition-colors duration-150 hover:bg-(--container-color)"
|
|
11
|
+
aria-expanded={open}
|
|
12
|
+
onclick={() => (onToggle ? onToggle() : (open = !open))}
|
|
13
|
+
>
|
|
14
|
+
<span class="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
15
|
+
<span class="text-[13px] font-semibold text-(--font-color)">{title}</span>
|
|
16
|
+
{#if summary}
|
|
17
|
+
<span class="text-[12px] text-(--muted-color) tabular-nums {open ? '' : 'line-clamp-2'}">{summary}</span>
|
|
18
|
+
{/if}
|
|
19
|
+
</span>
|
|
20
|
+
<ExpandIcon {open} />
|
|
21
|
+
</button>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
title: string;
|
|
3
|
+
summary?: string;
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onToggle?: () => void;
|
|
6
|
+
};
|
|
7
|
+
declare const SectionHead: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
8
|
+
type SectionHead = ReturnType<typeof SectionHead>;
|
|
9
|
+
export default SectionHead;
|
|
@@ -91,17 +91,19 @@
|
|
|
91
91
|
</script>
|
|
92
92
|
|
|
93
93
|
<div
|
|
94
|
-
class={twMerge("relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
94
|
+
class={twMerge("@container relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
95
95
|
style={rootStyle}
|
|
96
96
|
>
|
|
97
97
|
<!-- Заголовок -->
|
|
98
98
|
<WidgetHeader icon={CpuIcon} label={label?.name || $T("widget.info.title")} bind:collapsed {hints}>
|
|
99
|
-
{#snippet right()}
|
|
99
|
+
{#snippet right(narrow: boolean)}
|
|
100
100
|
<div use:hint={{ text: $T("widget.info.hint.restart"), enabled: $hints }}>
|
|
101
101
|
<UI.Button
|
|
102
102
|
wrapperClass="w-auto"
|
|
103
103
|
componentClass="px-3"
|
|
104
|
-
content={
|
|
104
|
+
content={narrow
|
|
105
|
+
? { icon: RestartIcon, info: { text: $T("widget.info.restart"), side: "left" } }
|
|
106
|
+
: { icon: RestartIcon, name: $T("widget.info.restart") }}
|
|
105
107
|
disabled={!onRestart}
|
|
106
108
|
onClick={() => onRestart?.()}
|
|
107
109
|
/>
|
|
@@ -117,7 +119,7 @@
|
|
|
117
119
|
<div use:hint={{ text: $T("widget.info.hint.sn"), enabled: $hints }}>
|
|
118
120
|
<UI.Input label={{ name: $T("widget.info.sn") }} value={info.DevSN} readonly help={{ copyButton: true }} />
|
|
119
121
|
</div>
|
|
120
|
-
<div class="grid grid-cols-1 gap-2
|
|
122
|
+
<div class="grid grid-cols-1 gap-2 @md:grid-cols-3">
|
|
121
123
|
<div use:hint={{ text: $T("widget.info.hint.id"), enabled: $hints }}>
|
|
122
124
|
<UI.Input label={{ name: $T("widget.info.id") }} value={info.DevID} readonly />
|
|
123
125
|
</div>
|
|
@@ -128,7 +130,7 @@
|
|
|
128
130
|
<UI.Input label={{ name: $T("widget.info.runs") }} value={info.RunCnt} readonly />
|
|
129
131
|
</div>
|
|
130
132
|
</div>
|
|
131
|
-
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
|
133
|
+
<div class="grid grid-cols-1 gap-2 @sm:grid-cols-2">
|
|
132
134
|
<div use:hint={{ text: $T("widget.info.hint.sta_ip"), enabled: $hints }}>
|
|
133
135
|
<UI.Input label={{ name: $T("widget.info.sta_ip") }} value={info.StaIP} readonly />
|
|
134
136
|
</div>
|
|
@@ -140,7 +142,7 @@
|
|
|
140
142
|
|
|
141
143
|
<!-- Редактируемые настройки -->
|
|
142
144
|
<div class="flex flex-col gap-3 rounded-[10px] border border-(--hairline-color) bg-(--back-color) p-3">
|
|
143
|
-
<div class="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
|
145
|
+
<div class="grid grid-cols-1 gap-2 @sm:grid-cols-2">
|
|
144
146
|
<div use:hint={{ text: $T("widget.info.hint.name"), enabled: $hints }}>
|
|
145
147
|
<UI.Input
|
|
146
148
|
label={{ name: $T("widget.info.name") }}
|
|
@@ -135,16 +135,18 @@
|
|
|
135
135
|
</script>
|
|
136
136
|
|
|
137
137
|
<div
|
|
138
|
-
class={twMerge("relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
138
|
+
class={twMerge("@container relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
139
139
|
style={rootStyle}
|
|
140
140
|
>
|
|
141
141
|
<!-- Заголовок -->
|
|
142
142
|
<WidgetHeader icon={StorageIcon} label={label?.name || $T("widget.fs.title")} bind:collapsed {hints}>
|
|
143
|
-
{#snippet right()}
|
|
143
|
+
{#snippet right(narrow: boolean)}
|
|
144
144
|
<UI.Button
|
|
145
145
|
wrapperClass="w-auto"
|
|
146
146
|
componentClass="px-3"
|
|
147
|
-
content={
|
|
147
|
+
content={narrow
|
|
148
|
+
? { icon: RefreshIcon, info: { text: $T("widget.common.refresh"), side: "left" } }
|
|
149
|
+
: { icon: RefreshIcon, name: $T("widget.common.refresh") }}
|
|
148
150
|
disabled={!onRefresh}
|
|
149
151
|
onClick={() => onRefresh?.()}
|
|
150
152
|
/>
|
package/dist/WidgetHeader.svelte
CHANGED
|
@@ -15,17 +15,20 @@
|
|
|
15
15
|
icon: Component
|
|
16
16
|
label: string
|
|
17
17
|
collapsed?: boolean
|
|
18
|
-
|
|
18
|
+
/* Правая часть; narrow - шапка узкая: кнопки только значком, списки сжаты, чтобы всё стояло в одной строке */
|
|
19
|
+
right?: Snippet<[boolean]>
|
|
19
20
|
/* Настройка подсказок этого виджета (hintsSetting) - показывает кнопку «?», переключающую только его подсказки */
|
|
20
21
|
hints?: Writable<boolean>
|
|
21
22
|
} = $props()
|
|
22
23
|
|
|
23
24
|
const Icon = $derived(icon)
|
|
24
25
|
|
|
25
|
-
/*
|
|
26
|
-
const
|
|
26
|
+
/* Уже NARROW_PX шапка сжимает правую часть; если и сжатая не помещается рядом с заголовком (место под значок, заголовок и «?»), она уходит второй строкой */
|
|
27
|
+
const NARROW_PX = 640
|
|
28
|
+
const TITLE_MIN_PX = 120
|
|
27
29
|
let headerWidth = $state(0)
|
|
28
30
|
let rightWidth = $state(0)
|
|
31
|
+
let narrow = $derived(headerWidth > 0 && headerWidth < NARROW_PX)
|
|
29
32
|
let wrapped = $derived(!!right && headerWidth > 0 && rightWidth + TITLE_MIN_PX + (hints ? 34 : 0) > headerWidth)
|
|
30
33
|
</script>
|
|
31
34
|
|
|
@@ -51,7 +54,7 @@
|
|
|
51
54
|
</button>
|
|
52
55
|
{#if right && !wrapped}
|
|
53
56
|
<div class="flex w-max shrink-0 items-center justify-end" bind:clientWidth={rightWidth}>
|
|
54
|
-
{@render right()}
|
|
57
|
+
{@render right(narrow)}
|
|
55
58
|
</div>
|
|
56
59
|
{/if}
|
|
57
60
|
{#if hints}
|
|
@@ -68,9 +71,9 @@
|
|
|
68
71
|
{/if}
|
|
69
72
|
</div>
|
|
70
73
|
{#if right && wrapped}
|
|
71
|
-
<!-- Во второй строке элементы могут переноситься;
|
|
72
|
-
<div class="flex max-w-full flex-wrap items-center justify-end gap-2">
|
|
73
|
-
{@render right()}
|
|
74
|
+
<!-- Во второй строке элементы могут переноситься; ширина замеряется и здесь - сжатая часть возвращается в первую строку -->
|
|
75
|
+
<div class="flex w-max max-w-full flex-wrap items-center justify-end gap-2 self-end" bind:clientWidth={rightWidth}>
|
|
76
|
+
{@render right(narrow)}
|
|
74
77
|
</div>
|
|
75
78
|
{/if}
|
|
76
79
|
</div>
|
|
@@ -248,6 +248,8 @@
|
|
|
248
248
|
|
|
249
249
|
/* Тема карты - по ближайшему предку .dark/.light (как у токенов theme.css): работает и внутри блока с другой темой, смена темы отслеживается */
|
|
250
250
|
let rootEl: HTMLDivElement | undefined = $state()
|
|
251
|
+
/* Ширина карты: панель оператора поверх неё не заходит под кнопки справа */
|
|
252
|
+
let mapWidth = $state(0)
|
|
251
253
|
const theme = themeState(
|
|
252
254
|
() => rootEl,
|
|
253
255
|
() => rootStyle,
|
|
@@ -438,16 +440,16 @@
|
|
|
438
440
|
{:else}
|
|
439
441
|
<div
|
|
440
442
|
bind:this={rootEl}
|
|
441
|
-
class={twMerge("relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
443
|
+
class={twMerge("@container relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
442
444
|
style={rootStyle}
|
|
443
445
|
>
|
|
444
446
|
<WidgetHeader icon={MapIcon} label={label?.name || $T("widget.map.title")} bind:collapsed {hints}>
|
|
445
|
-
{#snippet right()}
|
|
447
|
+
{#snippet right(narrow: boolean)}
|
|
446
448
|
<div class="flex items-center gap-3">
|
|
447
449
|
<Button
|
|
448
450
|
wrapperClass="w-auto"
|
|
449
451
|
componentClass="px-3"
|
|
450
|
-
content={{ icon: FitIcon, name: $T("widget.map.fitAll"), info: { text: $T("widget.map.fitAllHint"), side: "bottom" } }}
|
|
452
|
+
content={{ icon: FitIcon, name: narrow ? undefined : $T("widget.map.fitAll"), info: { text: $T("widget.map.fitAllHint"), side: "bottom" } }}
|
|
451
453
|
disabled={collapsed || visibleBoards.length === 0}
|
|
452
454
|
onClick={fitAllBoards}
|
|
453
455
|
/>
|
|
@@ -466,7 +468,7 @@
|
|
|
466
468
|
</WidgetHeader>
|
|
467
469
|
|
|
468
470
|
{#if !collapsed}
|
|
469
|
-
<div transition:slide={{ duration: 150 }} style="height: {height}px">
|
|
471
|
+
<div transition:slide={{ duration: 150 }} style="height: {height}px" bind:clientWidth={mapWidth}>
|
|
470
472
|
<MapLibre
|
|
471
473
|
bind:map={mapInstance}
|
|
472
474
|
class="h-full w-full overflow-hidden rounded-[14px] border border-(--hairline-color)"
|
|
@@ -483,7 +485,11 @@
|
|
|
483
485
|
|
|
484
486
|
<!-- Панель оператора поверх карты -->
|
|
485
487
|
<CustomControl position="top-left">
|
|
486
|
-
|
|
488
|
+
<!-- Не шире карты без колонки кнопок справа: на узкой карте пункты переносятся -->
|
|
489
|
+
<div
|
|
490
|
+
class="flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg px-2 py-1 text-(--font-color)"
|
|
491
|
+
style="max-width: {Math.max(mapWidth - 72, 120)}px"
|
|
492
|
+
>
|
|
487
493
|
<label class="flex items-center gap-1.5 text-sm font-medium" use:hint={{ text: $T("widget.map.hint.track"), enabled: $hints }}>
|
|
488
494
|
<input type="checkbox" bind:checked={trackEnabled} />
|
|
489
495
|
{$T("constructor.props.map.track")}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { accentStyle, type AccentColor } from "../../accent"
|
|
10
10
|
import { themeState } from "../mapTheme.svelte"
|
|
11
11
|
import MissionActions from "./MissionActions.svelte"
|
|
12
|
+
import SectionHead from "../../SectionHead.svelte"
|
|
12
13
|
import Button from "../../Button/Button.svelte"
|
|
13
14
|
import Input from "../../Input/Input.svelte"
|
|
14
15
|
import Modal from "../../Modal.svelte"
|
|
@@ -24,7 +25,6 @@
|
|
|
24
25
|
import InfoIcon from "../../libIcons/InfoIcon.svelte"
|
|
25
26
|
import { missionProgress } from "./progress"
|
|
26
27
|
import MissionIcon from "./MissionIcon.svelte"
|
|
27
|
-
import ArrowIcon from "../../libIcons/ArrowIcon.svelte"
|
|
28
28
|
import { planFields, bestFieldAngle, searchFieldAngle, toMission, fieldArea, fieldsArea, type LngLat, type SprayControl } from "./coverage"
|
|
29
29
|
import { DEFAULT_MISSION_PLAN, type IMissionPlan } from "./plan"
|
|
30
30
|
|
|
@@ -384,67 +384,58 @@
|
|
|
384
384
|
/* Два сворачиваемых блока: «Маршрут и внесение» и «Итог» (контуры и расчёт) */
|
|
385
385
|
type Section = "settings" | "summary"
|
|
386
386
|
let open = $state<Record<Section, boolean>>({ settings: false, summary: false })
|
|
387
|
+
/* Узкая карта: короткие подписи кнопок редакторов, компактная панель имитации */
|
|
388
|
+
let mapWidth = $state(0)
|
|
389
|
+
let compactMap = $derived(mapWidth > 0 && mapWidth < 480)
|
|
387
390
|
const card = "flex flex-col gap-3 rounded-[10px] border border-(--hairline-color) bg-(--back-color) p-3"
|
|
388
391
|
/* Метка у кнопки повторяет цвет объекта на карте */
|
|
389
392
|
let tools = $derived([
|
|
390
393
|
{
|
|
391
394
|
mode: "field" as Mode,
|
|
392
395
|
label: "widget.mission.editField",
|
|
396
|
+
short: "widget.mission.editFieldShort",
|
|
393
397
|
dot: "rounded-sm border-(--green-mark) bg-(--green-mark)/30",
|
|
394
398
|
disabled: false,
|
|
395
399
|
},
|
|
396
|
-
{
|
|
400
|
+
{
|
|
401
|
+
mode: "hole" as Mode,
|
|
402
|
+
label: "widget.mission.editHoles",
|
|
403
|
+
short: "widget.mission.editHolesShort",
|
|
404
|
+
dot: "rounded-sm border-(--red-mark) bg-(--red-mark)/40",
|
|
405
|
+
disabled: !hasField,
|
|
406
|
+
},
|
|
397
407
|
])
|
|
398
408
|
</script>
|
|
399
409
|
|
|
400
410
|
<svelte:window onkeydown={onKey} />
|
|
401
411
|
|
|
402
|
-
{#snippet head(key: Section, title: string, summary: string)}
|
|
403
|
-
<button
|
|
404
|
-
type="button"
|
|
405
|
-
class="flex w-full cursor-pointer items-center justify-between gap-2 border-none bg-transparent p-0 text-left"
|
|
406
|
-
aria-expanded={open[key]}
|
|
407
|
-
onclick={() => (open[key] = !open[key])}
|
|
408
|
-
>
|
|
409
|
-
<span class="text-[12px] font-semibold text-(--muted-color)">
|
|
410
|
-
{title}
|
|
411
|
-
<span class="font-normal text-(--faint-color) tabular-nums">· {summary}</span>
|
|
412
|
-
</span>
|
|
413
|
-
<span
|
|
414
|
-
class="flex size-3.5 shrink-0 text-(--faint-color) transition-transform duration-150 [&_svg]:h-full [&_svg]:w-full"
|
|
415
|
-
style="transform: rotate({open[key] ? 90 : 0}deg)"
|
|
416
|
-
>
|
|
417
|
-
<ArrowIcon />
|
|
418
|
-
</span>
|
|
419
|
-
</button>
|
|
420
|
-
{/snippet}
|
|
421
|
-
|
|
422
412
|
<div
|
|
423
413
|
bind:this={rootEl}
|
|
424
|
-
class={twMerge("relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
414
|
+
class={twMerge("@container relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
425
415
|
style={rootStyle}
|
|
426
416
|
>
|
|
427
417
|
<WidgetHeader icon={MissionIcon} label={label?.name || $T("widget.mission.title")} bind:collapsed {hints}>
|
|
428
|
-
{#snippet right()}
|
|
418
|
+
{#snippet right(narrow: boolean)}
|
|
419
|
+
<!-- На узкой шапке: кнопка значком, во время полёта - только процент, иначе - сводка -->
|
|
429
420
|
<div class="flex items-center gap-3">
|
|
430
421
|
<Button
|
|
431
422
|
wrapperClass="w-auto"
|
|
432
423
|
componentClass="px-3"
|
|
433
|
-
content={{ icon: FitIcon, name: $T("widget.map.fitAll"), info: { text: $T("widget.mission.fitHint"), side: "bottom" } }}
|
|
424
|
+
content={{ icon: FitIcon, name: narrow ? undefined : $T("widget.map.fitAll"), info: { text: $T("widget.mission.fitHint"), side: "bottom" } }}
|
|
434
425
|
disabled={collapsed || missionPoints().length === 0}
|
|
435
426
|
onClick={() => fitAll()}
|
|
436
427
|
/>
|
|
437
428
|
<span class="flex items-center gap-3 text-[12px] font-semibold text-(--muted-color) tabular-nums">
|
|
438
429
|
{#if headerProgress !== null}
|
|
439
430
|
<span class="flex items-center gap-1.5" title={simulate ? $T("widget.sim.title") : $T("widget.mission.progressHint")}>
|
|
440
|
-
<span class="h-1.5 w-14 overflow-hidden rounded-full bg-(--hairline-color)"
|
|
431
|
+
<span class="h-1.5 w-14 overflow-hidden rounded-full bg-(--hairline-color) {narrow ? 'hidden' : ''}"
|
|
441
432
|
><span class="block h-full rounded-full bg-(--accent-color)" style="width: {Math.round(headerProgress * 100)}%"></span></span
|
|
442
433
|
>
|
|
443
|
-
{Math.round(headerProgress * 100)}%{#if live}
|
|
434
|
+
{Math.round(headerProgress * 100)}%{#if live && !narrow}
|
|
444
435
|
· {$T("widget.mission.treated")} {fmt(treatedHa, 2)} {$T("widget.mission.ha")}{/if}
|
|
445
436
|
</span>
|
|
446
437
|
{/if}
|
|
447
|
-
{#if stats}
|
|
438
|
+
{#if stats && (!narrow || headerProgress === null)}
|
|
448
439
|
<span class="text-[12px] font-semibold text-(--muted-color) tabular-nums"
|
|
449
440
|
>{fmt(stats.ha, 2)} {$T("widget.mission.ha")} · {fmt(stats.total, 2)} {$T("widget.mission.km")}</span
|
|
450
441
|
>
|
|
@@ -456,7 +447,7 @@
|
|
|
456
447
|
|
|
457
448
|
{#if !collapsed}
|
|
458
449
|
<div transition:slide={{ duration: 150 }} class="flex flex-col gap-4">
|
|
459
|
-
<div style="height: {height}px">
|
|
450
|
+
<div style="height: {height}px" bind:clientWidth={mapWidth}>
|
|
460
451
|
<MapLibre
|
|
461
452
|
bind:map={mapInstance}
|
|
462
453
|
class="h-full w-full overflow-hidden rounded-[14px] border border-(--hairline-color)"
|
|
@@ -479,7 +470,7 @@
|
|
|
479
470
|
use:hint={{ text: $T(`widget.mission.hint.${tool.mode}`), enabled: $hints }}
|
|
480
471
|
>
|
|
481
472
|
<span class="size-3 shrink-0 border-2 {tool.dot}"></span>
|
|
482
|
-
{$T(tool.label)}
|
|
473
|
+
{$T(compactMap ? tool.short : tool.label)}
|
|
483
474
|
</button>
|
|
484
475
|
{/each}
|
|
485
476
|
{#if draft.length}
|
|
@@ -530,7 +521,7 @@
|
|
|
530
521
|
</div>
|
|
531
522
|
{/if}
|
|
532
523
|
{#if simulate}
|
|
533
|
-
<MissionSim clock={sim} showSpray icon="quad" colors={theme.colors} />
|
|
524
|
+
<MissionSim clock={sim} showSpray icon="quad" colors={theme.colors} compact={compactMap} />
|
|
534
525
|
{/if}
|
|
535
526
|
</MapLibre>
|
|
536
527
|
</div>
|
|
@@ -538,26 +529,27 @@
|
|
|
538
529
|
<!-- Маршрут и внесение, итог: свёрнуты по умолчанию, в заголовке краткая сводка -->
|
|
539
530
|
<div class="flex flex-col gap-3">
|
|
540
531
|
<div class={card}>
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
$T("widget.mission.settings")
|
|
544
|
-
[
|
|
532
|
+
<SectionHead
|
|
533
|
+
bind:open={open.settings}
|
|
534
|
+
title={$T("widget.mission.settings")}
|
|
535
|
+
summary={[
|
|
545
536
|
`${$T(fieldList.length > 1 ? "widget.mission.s.angles" : "widget.mission.s.angle")} ${fieldList.map((f) => `${fmt(f.angle, 0)}°`).join(" / ") || "-"}`,
|
|
546
537
|
`${$T("widget.mission.s.swath")} ${plan.spacing} ${$T("widget.mission.m")}`,
|
|
547
538
|
`${$T("widget.mission.s.alt")} ${plan.alt} ${$T("widget.mission.m")}`,
|
|
548
539
|
`${$T("widget.mission.s.speed")} ${plan.speed} ${$T("widget.mission.ms")}`,
|
|
549
540
|
`${$T("widget.mission.s.rate")} ${plan.rate} ${$T("widget.mission.lha")}`,
|
|
550
541
|
`${$T("widget.mission.s.tank")} ${plan.tank} ${$T("widget.mission.l")}`,
|
|
551
|
-
].join(" · ")
|
|
552
|
-
|
|
542
|
+
].join(" · ")}
|
|
543
|
+
/>
|
|
553
544
|
{#if open.settings}
|
|
554
545
|
<!-- Слева маршрут, справа внесение; на узком экране друг под другом -->
|
|
555
|
-
<div class="grid grid-cols-1 divide-y divide-(--hairline-color)
|
|
556
|
-
<div class="flex flex-col gap-3 pb-3
|
|
546
|
+
<div class="grid grid-cols-1 divide-y divide-(--hairline-color) @xl:grid-cols-2 @xl:divide-x @xl:divide-y-0" transition:slide={{ duration: 150 }}>
|
|
547
|
+
<div class="flex flex-col gap-3 pb-3 @xl:pr-4 @xl:pb-0">
|
|
557
548
|
<span class="text-[11px] font-semibold tracking-wide text-(--faint-color) uppercase">{$T("widget.mission.passes")}</span>
|
|
558
|
-
|
|
549
|
+
<!-- На узком месте ползунок во всю ширину, кнопки авторасчёта строкой ниже -->
|
|
550
|
+
<div class="flex flex-wrap items-end gap-2">
|
|
559
551
|
<Slider
|
|
560
|
-
wrapperClass="flex-1"
|
|
552
|
+
wrapperClass="flex-1 basis-full @md:basis-0"
|
|
561
553
|
label={{ name: `${$T(fieldList.length > 1 ? "widget.mission.angleAll" : "widget.mission.angle")}: ${fmt(allAngle, 1)}°` }}
|
|
562
554
|
value={allAngle}
|
|
563
555
|
number={{ minNum: 0, maxNum: 179, step: 1 }}
|
|
@@ -592,7 +584,7 @@
|
|
|
592
584
|
{$T("widget.mission.returnHome")}
|
|
593
585
|
</label>
|
|
594
586
|
</div>
|
|
595
|
-
<div class="flex flex-col gap-3 pt-3
|
|
587
|
+
<div class="flex flex-col gap-3 pt-3 @xl:pt-0 @xl:pl-4">
|
|
596
588
|
<span class="text-[11px] font-semibold tracking-wide text-(--faint-color) uppercase">{$T("widget.mission.spraying")}</span>
|
|
597
589
|
<div class="grid grid-cols-2 gap-2">
|
|
598
590
|
<Input type="number" label={{ name: $T("widget.mission.rate") }} {...numField("rate", 0, 500, 0.5)} />
|
|
@@ -625,10 +617,10 @@
|
|
|
625
617
|
</div>
|
|
626
618
|
|
|
627
619
|
<div class={card}>
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
$T("widget.mission.summary")
|
|
631
|
-
[
|
|
620
|
+
<SectionHead
|
|
621
|
+
bind:open={open.summary}
|
|
622
|
+
title={$T("widget.mission.summary")}
|
|
623
|
+
summary={[
|
|
632
624
|
hasField ? `${$T("widget.mission.s.fields")}: ${fields.length}` : $T("widget.mission.noField"),
|
|
633
625
|
`${$T("widget.mission.s.holes")}: ${plan.holes.length}`,
|
|
634
626
|
...(stats
|
|
@@ -639,12 +631,12 @@
|
|
|
639
631
|
`${$T("widget.mission.s.liquid")} ${fmt(stats.liquid, 0)} ${$T("widget.mission.l")}`,
|
|
640
632
|
]
|
|
641
633
|
: []),
|
|
642
|
-
].join(" · ")
|
|
643
|
-
|
|
634
|
+
].join(" · ")}
|
|
635
|
+
/>
|
|
644
636
|
{#if open.summary}
|
|
645
637
|
<!-- Слева контуры, справа расчёт; на узком экране друг под другом -->
|
|
646
|
-
<div class="grid grid-cols-1 divide-y divide-(--hairline-color)
|
|
647
|
-
<div class="flex flex-col gap-3 pb-3
|
|
638
|
+
<div class="grid grid-cols-1 divide-y divide-(--hairline-color) @xl:grid-cols-2 @xl:divide-x @xl:divide-y-0" transition:slide={{ duration: 150 }}>
|
|
639
|
+
<div class="flex flex-col gap-3 pb-3 @xl:pr-4 @xl:pb-0">
|
|
648
640
|
<span class="text-[11px] font-semibold tracking-wide text-(--faint-color) uppercase">{$T("widget.mission.zones")}</span>
|
|
649
641
|
<div class="flex flex-col gap-1.5 rounded-lg bg-(--container-color) p-3 text-[13px] tabular-nums">
|
|
650
642
|
{#each fields as field, i}
|
|
@@ -724,7 +716,7 @@
|
|
|
724
716
|
{/if}
|
|
725
717
|
</div>
|
|
726
718
|
|
|
727
|
-
<div class="flex flex-col gap-3 pt-3
|
|
719
|
+
<div class="flex flex-col gap-3 pt-3 @xl:pt-0 @xl:pl-4">
|
|
728
720
|
<span class="text-[11px] font-semibold tracking-wide text-(--faint-color) uppercase">{$T("widget.mission.calc")}</span>
|
|
729
721
|
{#if stats}
|
|
730
722
|
<div class="grid grid-cols-2 gap-x-4 gap-y-1.5 rounded-lg bg-(--container-color) p-3 text-[13px] tabular-nums">
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { accentStyle, type AccentColor } from "../../accent"
|
|
10
10
|
import { themeState } from "../mapTheme.svelte"
|
|
11
11
|
import MissionActions from "./MissionActions.svelte"
|
|
12
|
+
import SectionHead from "../../SectionHead.svelte"
|
|
12
13
|
import Button from "../../Button/Button.svelte"
|
|
13
14
|
import Dragging from "../../Dragging.svelte"
|
|
14
15
|
import Input from "../../Input/Input.svelte"
|
|
@@ -20,7 +21,6 @@
|
|
|
20
21
|
import { SimClock } from "./simClock.svelte"
|
|
21
22
|
import { missionProgress } from "./progress"
|
|
22
23
|
import MapIcon from "../MapIcon.svelte"
|
|
23
|
-
import ArrowIcon from "../../libIcons/ArrowIcon.svelte"
|
|
24
24
|
import type { LngLat } from "./coverage"
|
|
25
25
|
import { DEFAULT_ROUTE_PLAN, ROUTE_FIRST_ALT, ROUTE_FIRST_SPEED, routeLegs, routeStats, routeMission, type IRoutePlan, type IRouteWaypoint } from "./route"
|
|
26
26
|
|
|
@@ -186,8 +186,11 @@
|
|
|
186
186
|
const mapBtnMain = "border-(--accent-color)! bg-(--accent-color)! text-(--on-accent)!"
|
|
187
187
|
type Section = "summary"
|
|
188
188
|
let open = $state<Record<Section, boolean>>({ summary: false })
|
|
189
|
-
/*
|
|
190
|
-
|
|
189
|
+
/* Узкая карта: короткая подпись кнопки редактора, компактная панель имитации */
|
|
190
|
+
let mapWidth = $state(0)
|
|
191
|
+
let compactMap = $derived(mapWidth > 0 && mapWidth < 480)
|
|
192
|
+
/* Сетка строки точки: ручка, номер, высота, скорость, расстояние от прошлой, удаление; поля сужаются до узкой карточки, не шире 8rem */
|
|
193
|
+
const ROW_GRID = "grid-cols-[1.25rem_1.5rem_minmax(0,8rem)_minmax(0,8rem)_minmax(3.5rem,1fr)_1rem]"
|
|
191
194
|
let listEl: HTMLDivElement | undefined = $state()
|
|
192
195
|
const listId = Math.floor(Math.random() * 1e6)
|
|
193
196
|
const card = "flex flex-col gap-3 rounded-[10px] border border-(--hairline-color) bg-(--back-color) p-3"
|
|
@@ -196,48 +199,29 @@
|
|
|
196
199
|
|
|
197
200
|
<svelte:window onkeydown={onKey} />
|
|
198
201
|
|
|
199
|
-
{#snippet head(key: Section, title: string, summary: string)}
|
|
200
|
-
<button
|
|
201
|
-
type="button"
|
|
202
|
-
class="flex w-full cursor-pointer items-center justify-between gap-2 border-none bg-transparent p-0 text-left"
|
|
203
|
-
aria-expanded={open[key]}
|
|
204
|
-
onclick={() => (open[key] = !open[key])}
|
|
205
|
-
>
|
|
206
|
-
<span class="text-[12px] font-semibold text-(--muted-color)">
|
|
207
|
-
{title}
|
|
208
|
-
<span class="font-normal text-(--faint-color) tabular-nums">· {summary}</span>
|
|
209
|
-
</span>
|
|
210
|
-
<span
|
|
211
|
-
class="flex size-3.5 shrink-0 text-(--faint-color) transition-transform duration-150 [&_svg]:h-full [&_svg]:w-full"
|
|
212
|
-
style="transform: rotate({open[key] ? 90 : 0}deg)"
|
|
213
|
-
>
|
|
214
|
-
<ArrowIcon />
|
|
215
|
-
</span>
|
|
216
|
-
</button>
|
|
217
|
-
{/snippet}
|
|
218
|
-
|
|
219
202
|
<div
|
|
220
203
|
bind:this={rootEl}
|
|
221
|
-
class={twMerge("relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
204
|
+
class={twMerge("@container relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
222
205
|
style={rootStyle}
|
|
223
206
|
>
|
|
224
207
|
<WidgetHeader icon={MapIcon} label={label?.name || $T("widget.route.title")} bind:collapsed {hints}>
|
|
225
|
-
{#snippet right()}
|
|
208
|
+
{#snippet right(narrow: boolean)}
|
|
209
|
+
<!-- На узкой шапке: кнопка значком, во время полёта - только процент, иначе - сводка -->
|
|
226
210
|
<div class="flex items-center gap-3">
|
|
227
211
|
<Button
|
|
228
212
|
wrapperClass="w-auto"
|
|
229
213
|
componentClass="px-3"
|
|
230
|
-
content={{ icon: FitIcon, name: $T("widget.map.fitAll"), info: { text: $T("widget.route.fitHint"), side: "bottom" } }}
|
|
214
|
+
content={{ icon: FitIcon, name: narrow ? undefined : $T("widget.map.fitAll"), info: { text: $T("widget.route.fitHint"), side: "bottom" } }}
|
|
231
215
|
disabled={collapsed || missionPoints().length === 0}
|
|
232
216
|
onClick={() => fitAll()}
|
|
233
217
|
/>
|
|
234
218
|
<span class="flex items-center gap-3 text-[12px] font-semibold text-(--muted-color) tabular-nums">
|
|
235
219
|
{#if headerProgress !== null}
|
|
236
220
|
<span class="flex items-center gap-1.5" title={simulate ? $T("widget.sim.title") : $T("widget.mission.progressHint")}>
|
|
237
|
-
<span class="h-1.5 w-14 overflow-hidden rounded-full bg-(--hairline-color)"
|
|
221
|
+
<span class="h-1.5 w-14 overflow-hidden rounded-full bg-(--hairline-color) {narrow ? 'hidden' : ''}"
|
|
238
222
|
><span class="block h-full rounded-full bg-(--accent-color)" style="width: {Math.round(headerProgress * 100)}%"></span></span
|
|
239
223
|
>
|
|
240
|
-
{Math.round(headerProgress * 100)}%{#if live}
|
|
224
|
+
{Math.round(headerProgress * 100)}%{#if live && !narrow}
|
|
241
225
|
· {live.finished
|
|
242
226
|
? $T("widget.route.finished")
|
|
243
227
|
: live.target > route.points.length
|
|
@@ -245,7 +229,9 @@
|
|
|
245
229
|
: `${$T("widget.route.toPoint")} ${live.target}/${route.points.length}`}{/if}
|
|
246
230
|
</span>
|
|
247
231
|
{/if}
|
|
248
|
-
|
|
232
|
+
{#if !narrow || headerProgress === null}
|
|
233
|
+
<span>{stats.points} {$T("widget.route.pts")} · {km(stats.length)}</span>
|
|
234
|
+
{/if}
|
|
249
235
|
</span>
|
|
250
236
|
</div>
|
|
251
237
|
{/snippet}
|
|
@@ -253,7 +239,7 @@
|
|
|
253
239
|
|
|
254
240
|
{#if !collapsed}
|
|
255
241
|
<div transition:slide={{ duration: 150 }} class="flex flex-col gap-4">
|
|
256
|
-
<div style="height: {height}px">
|
|
242
|
+
<div style="height: {height}px" bind:clientWidth={mapWidth}>
|
|
257
243
|
<MapLibre
|
|
258
244
|
bind:map={mapInstance}
|
|
259
245
|
class="h-full w-full overflow-hidden rounded-[14px] border border-(--hairline-color)"
|
|
@@ -274,7 +260,7 @@
|
|
|
274
260
|
use:hint={{ text: $T("widget.route.hint.add"), enabled: $hints }}
|
|
275
261
|
>
|
|
276
262
|
<span class="size-3 shrink-0 rounded-full border-2 border-white bg-(--accent-color) outline outline-(--accent-color)"></span>
|
|
277
|
-
{$T("widget.route.add")}
|
|
263
|
+
{$T(compactMap ? "widget.route.addShort" : "widget.route.add")}
|
|
278
264
|
</button>
|
|
279
265
|
{#if adding}
|
|
280
266
|
<button class="{mapBtn} {mapBtnMain}" onclick={() => (adding = false)}>{$T("widget.mission.finish")}</button>
|
|
@@ -297,23 +283,23 @@
|
|
|
297
283
|
/>
|
|
298
284
|
{@render overlay?.()}
|
|
299
285
|
{#if simulate}
|
|
300
|
-
<MissionSim clock={sim} colors={theme.colors} />
|
|
286
|
+
<MissionSim clock={sim} colors={theme.colors} compact={compactMap} />
|
|
301
287
|
{/if}
|
|
302
288
|
</MapLibre>
|
|
303
289
|
</div>
|
|
304
290
|
|
|
305
291
|
<!-- Итог: расчёт и точки с высотой и скоростью; свёрнут по умолчанию, в заголовке краткая сводка -->
|
|
306
292
|
<div class={card}>
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
$T("widget.mission.summary")
|
|
310
|
-
[
|
|
293
|
+
<SectionHead
|
|
294
|
+
bind:open={open.summary}
|
|
295
|
+
title={$T("widget.mission.summary")}
|
|
296
|
+
summary={[
|
|
311
297
|
`${$T("widget.route.s.points")} ${stats.points}`,
|
|
312
298
|
`${$T("widget.route.s.maxAlt")} ${stats.maxAlt} ${$T("widget.mission.m")}`,
|
|
313
299
|
`${$T("widget.mission.s.path")} ${km(stats.length)}`,
|
|
314
300
|
`${$T("widget.mission.s.time")} ${fmt(stats.timeMin, 0)} ${$T("widget.mission.min")}`,
|
|
315
|
-
].join(" · ")
|
|
316
|
-
|
|
301
|
+
].join(" · ")}
|
|
302
|
+
/>
|
|
317
303
|
{#if open.summary}
|
|
318
304
|
<!-- Сверху расчёт, ниже точки на всю ширину: у каждой высота и скорость -->
|
|
319
305
|
<div class="flex flex-col gap-3" transition:slide={{ duration: 150 }}>
|
|
@@ -334,7 +320,7 @@
|
|
|
334
320
|
<span class="text-[11px] font-semibold tracking-wide text-(--faint-color) uppercase">{$T("widget.route.points")}</span>
|
|
335
321
|
{#if route.points.length}
|
|
336
322
|
<!-- Строки переставляются ручкой, как списки в панелях свойств (Dragging) -->
|
|
337
|
-
<div class="grid {ROW_GRID} items-end gap-x-
|
|
323
|
+
<div class="grid {ROW_GRID} items-end gap-x-2 border border-transparent px-2 text-[11px] leading-tight text-(--faint-color)">
|
|
338
324
|
<span></span>
|
|
339
325
|
<span>№</span>
|
|
340
326
|
<span use:hint={{ text: $T("widget.route.hint.alt"), enabled: $hints }}>{$T("widget.route.alt")}</span>
|
|
@@ -349,7 +335,7 @@
|
|
|
349
335
|
>
|
|
350
336
|
{#each route.points as p, i}
|
|
351
337
|
{@const leg = legs.legs[route.start ? i : i - 1]}
|
|
352
|
-
<div id="item-{i}-{listId}" class="grid {ROW_GRID} items-center gap-x-
|
|
338
|
+
<div id="item-{i}-{listId}" class="grid {ROW_GRID} items-center gap-x-2 px-2 py-1">
|
|
353
339
|
<Dragging
|
|
354
340
|
wrapperClass="size-5"
|
|
355
341
|
container={listEl!}
|
|
@@ -51,15 +51,22 @@
|
|
|
51
51
|
</script>
|
|
52
52
|
|
|
53
53
|
<!-- Три кнопки в ряд, на узком месте переносятся -->
|
|
54
|
-
<div class="grid grid-cols-[repeat(auto-fit,minmax(
|
|
54
|
+
<div class="grid grid-cols-[repeat(auto-fit,minmax(6.5rem,1fr))] gap-3">
|
|
55
55
|
<div class="min-w-0" use:hint={{ text: $T("widget.mission.hint.download"), enabled: hints }}>
|
|
56
|
-
<Button variant="primary" content={{ name: $T("widget.mission.download") }} disabled={off} onClick={download} />
|
|
56
|
+
<Button componentClass="px-2" variant="primary" content={{ name: $T("widget.mission.download") }} disabled={off} onClick={download} />
|
|
57
57
|
</div>
|
|
58
58
|
<div class="min-w-0" use:hint={{ text: $T("widget.mission.hint.copy"), enabled: hints }}>
|
|
59
|
-
<Button
|
|
59
|
+
<Button
|
|
60
|
+
componentClass="px-2"
|
|
61
|
+
variant="primary"
|
|
62
|
+
content={{ name: $T(copied ? "widget.mission.copied" : "widget.mission.copy") }}
|
|
63
|
+
disabled={off}
|
|
64
|
+
onClick={copy}
|
|
65
|
+
/>
|
|
60
66
|
</div>
|
|
61
67
|
<div class="min-w-0" use:hint={{ text: $T("widget.mission.hint.send"), enabled: hints }}>
|
|
62
68
|
<Button
|
|
69
|
+
componentClass="px-2"
|
|
63
70
|
variant="primary"
|
|
64
71
|
accent={sendState === "error" ? "red" : undefined}
|
|
65
72
|
content={{ name: $T(`widget.mission.send.${sendState}`) }}
|
|
@@ -12,11 +12,14 @@
|
|
|
12
12
|
showSpray = false,
|
|
13
13
|
icon = "arrow",
|
|
14
14
|
colors,
|
|
15
|
+
compact = false,
|
|
15
16
|
}: {
|
|
16
17
|
clock: SimClock
|
|
17
18
|
showSpray?: boolean
|
|
18
19
|
icon?: "arrow" | "quad"
|
|
19
20
|
colors: IMapColors /* Аппарат и след - мастер-цвет виджета, распыление - зелёный */
|
|
21
|
+
/* Узкая карта: без заголовка, высоты и скорости, панель почти во всю ширину над масштабом */
|
|
22
|
+
compact?: boolean
|
|
20
23
|
} = $props()
|
|
21
24
|
|
|
22
25
|
const toRad = Math.PI / 180
|
|
@@ -82,11 +85,13 @@
|
|
|
82
85
|
|
|
83
86
|
<!-- Панель имитации внизу карты по центру, оформлена как кнопки MapLibre -->
|
|
84
87
|
<div
|
|
85
|
-
class="absolute
|
|
88
|
+
class="absolute left-1/2 z-10 w-max -translate-x-1/2 rounded-[4px] bg-(--back-color) shadow-[0_0_0_1px_var(--hairline-color)] {compact
|
|
89
|
+
? 'bottom-9 max-w-[calc(100%-1rem)]'
|
|
90
|
+
: 'bottom-2.5 max-w-[calc(100%-8rem)]'}"
|
|
86
91
|
>
|
|
87
92
|
<div class="flex flex-col gap-1 px-3 py-1.5 text-[12px] whitespace-nowrap text-(--font-color) tabular-nums">
|
|
88
93
|
<div class="flex flex-wrap items-center gap-x-3 gap-y-1">
|
|
89
|
-
<span class="font-semibold">{$T("widget.sim.title")}</span>
|
|
94
|
+
{#if !compact}<span class="font-semibold">{$T("widget.sim.title")}</span>{/if}
|
|
90
95
|
<button
|
|
91
96
|
class={iconBtn}
|
|
92
97
|
onclick={() => clock.toggle()}
|
|
@@ -109,9 +114,9 @@
|
|
|
109
114
|
{/each}
|
|
110
115
|
</select>
|
|
111
116
|
<span>{clockText(clock.t)} / {clockText(clock.duration)} · {Math.round((clock.t / Math.max(1, clock.duration)) * 100)}%</span>
|
|
112
|
-
<span>{pos.alt.toFixed(0)} {$T("widget.mission.m")} · {pos.speed.toFixed(1)} {$T("widget.mission.ms")}</span>
|
|
117
|
+
{#if !compact}<span>{pos.alt.toFixed(0)} {$T("widget.mission.m")} · {pos.speed.toFixed(1)} {$T("widget.mission.ms")}</span>{/if}
|
|
113
118
|
{#if showSpray}
|
|
114
|
-
<span class="min-w-[7.5rem] font-semibold {pos.spray ? 'text-(--green-text)' : 'text-(--muted-color)'}"
|
|
119
|
+
<span class="{compact ? '' : 'min-w-[7.5rem]'} font-semibold {pos.spray ? 'text-(--green-text)' : 'text-(--muted-color)'}"
|
|
115
120
|
>{pos.spray ? $T("widget.sim.sprayOn") : $T("widget.sim.sprayOff")}</span
|
|
116
121
|
>
|
|
117
122
|
{/if}
|
|
@@ -278,8 +278,8 @@
|
|
|
278
278
|
let width = $state(600)
|
|
279
279
|
let compact = $derived(width < 440)
|
|
280
280
|
|
|
281
|
-
/* Геометрия
|
|
282
|
-
|
|
281
|
+
/* Геометрия прибора: viewBox 600×320; в компактном режиме ширина viewBox - фактическая ширина прибора (не уже 300), чтобы он рисовался 1:1, а не сжимался */
|
|
282
|
+
let VW = $derived(compact ? Math.max(300, Math.round(width)) : 600)
|
|
283
283
|
const HH = 270
|
|
284
284
|
let HX = $derived(compact ? 0 : 80)
|
|
285
285
|
let HW = $derived(compact ? VW : 440)
|
|
@@ -462,7 +462,7 @@
|
|
|
462
462
|
</script>
|
|
463
463
|
|
|
464
464
|
<div
|
|
465
|
-
class={twMerge("relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
465
|
+
class={twMerge("@container relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
466
466
|
style={rootStyle}
|
|
467
467
|
>
|
|
468
468
|
<WidgetHeader icon={PlaneIcon} label={label?.name || $T("pfd.title")} bind:collapsed {hints}>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import ColorPicker from "./ColorPicker.svelte"
|
|
11
11
|
import WidgetHeader from "../WidgetHeader.svelte"
|
|
12
12
|
import { hint, hintsSetting } from "../hints"
|
|
13
|
-
import
|
|
13
|
+
import SectionHead from "../SectionHead.svelte"
|
|
14
14
|
import { accentStyle } from "../accent"
|
|
15
15
|
import { readPersistedCollapsed, writePersistedCollapsed } from "../widgetCollapse"
|
|
16
16
|
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
</script>
|
|
100
100
|
|
|
101
101
|
<div
|
|
102
|
-
class={twMerge("relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
102
|
+
class={twMerge("@container relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
103
103
|
style={rootStyle}
|
|
104
104
|
>
|
|
105
105
|
<!-- Заголовок: образец текущего цвета -->
|
|
@@ -151,25 +151,12 @@
|
|
|
151
151
|
|
|
152
152
|
<!-- Оборудование: свёрнуто по умолчанию, сохраняется одним пакетом, лента перезапускается -->
|
|
153
153
|
<div class="flex flex-col gap-3 rounded-[10px] border border-(--hairline-color) bg-(--back-color) p-3">
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<span class="text-[12px] font-semibold text-(--muted-color)">
|
|
161
|
-
{$T("widget.rgb.hardware")}
|
|
162
|
-
<span class="font-normal text-(--faint-color)">
|
|
163
|
-
· {hardware.Count} LED · {MODELS[hardware.Model]?.name ?? "-"} · {ORDERS[hardware.Order]?.name ?? "-"}
|
|
164
|
-
</span>
|
|
165
|
-
</span>
|
|
166
|
-
<span
|
|
167
|
-
class="flex size-3.5 shrink-0 text-(--faint-color) transition-transform duration-150 [&_svg]:h-full [&_svg]:w-full"
|
|
168
|
-
style="transform: rotate({hardwareOpen || isDirty ? 90 : 0}deg)"
|
|
169
|
-
>
|
|
170
|
-
<ArrowIcon />
|
|
171
|
-
</span>
|
|
172
|
-
</button>
|
|
154
|
+
<SectionHead
|
|
155
|
+
title={$T("widget.rgb.hardware")}
|
|
156
|
+
summary={`${hardware.Count} LED · ${MODELS[hardware.Model]?.name ?? "-"} · ${ORDERS[hardware.Order]?.name ?? "-"}`}
|
|
157
|
+
open={hardwareOpen || isDirty}
|
|
158
|
+
onToggle={() => (hardwareOpen = !hardwareOpen)}
|
|
159
|
+
/>
|
|
173
160
|
{#if hardwareOpen || isDirty}
|
|
174
161
|
<div class="flex flex-col gap-3" transition:slide={{ duration: 150 }}>
|
|
175
162
|
<div use:hint={{ text: $T("widget.rgb.hint.count"), enabled: $hints }}>
|
|
@@ -133,18 +133,28 @@
|
|
|
133
133
|
</script>
|
|
134
134
|
|
|
135
135
|
<div
|
|
136
|
-
class={twMerge("relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
136
|
+
class={twMerge("@container relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
137
137
|
style={rootStyle}
|
|
138
138
|
>
|
|
139
139
|
<!-- Заголовок -->
|
|
140
140
|
<WidgetHeader icon={MemoryIcon} label={label?.name || $T("widget.stack.title")} bind:collapsed {hints}>
|
|
141
|
-
{#snippet right()}
|
|
141
|
+
{#snippet right(narrow: boolean)}
|
|
142
142
|
<div class="flex flex-wrap items-center justify-end gap-2" use:hint={{ text: $T("widget.stack.hint.poll"), enabled: $hints }}>
|
|
143
|
-
|
|
143
|
+
<!-- На узком - список вместо ряда кнопок и кнопка значком -->
|
|
144
|
+
<UI.Select
|
|
145
|
+
wrapperClass={narrow ? "w-28" : "w-64"}
|
|
146
|
+
type="buttons"
|
|
147
|
+
options={periods}
|
|
148
|
+
value={period}
|
|
149
|
+
disabled={!onRefresh}
|
|
150
|
+
onUpdate={(value) => (period = value)}
|
|
151
|
+
/>
|
|
144
152
|
<UI.Button
|
|
145
153
|
wrapperClass="w-auto"
|
|
146
154
|
componentClass="px-3"
|
|
147
|
-
content={
|
|
155
|
+
content={narrow
|
|
156
|
+
? { icon: RefreshIcon, info: { text: $T("widget.common.refresh"), side: "left" } }
|
|
157
|
+
: { icon: RefreshIcon, name: $T("widget.common.refresh") }}
|
|
148
158
|
disabled={!onRefresh}
|
|
149
159
|
onClick={() => onRefresh?.()}
|
|
150
160
|
/>
|
|
@@ -160,7 +170,7 @@
|
|
|
160
170
|
</div>
|
|
161
171
|
{:else}
|
|
162
172
|
<!-- Кучи -->
|
|
163
|
-
<div class="grid gap-3 {heaps.length > 1 ? 'sm:grid-cols-2' : ''}">
|
|
173
|
+
<div class="grid gap-3 {heaps.length > 1 ? '@sm:grid-cols-2' : ''}">
|
|
164
174
|
{#each heaps as heap (heap.Name)}
|
|
165
175
|
<div
|
|
166
176
|
class="flex flex-col gap-2 rounded-[10px] border border-(--hairline-color) bg-(--back-color) p-3"
|
|
@@ -123,13 +123,13 @@
|
|
|
123
123
|
</script>
|
|
124
124
|
|
|
125
125
|
<div
|
|
126
|
-
class={twMerge("relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
126
|
+
class={twMerge("@container relative flex w-full flex-col gap-4 rounded-2xl border border-(--hairline-color) bg-(--container-color) p-4", wrapperClass)}
|
|
127
127
|
style={rootStyle}
|
|
128
128
|
>
|
|
129
129
|
<!-- Заголовок и переключатель режима -->
|
|
130
130
|
<WidgetHeader icon={WifiIcon} label={label?.name || $T("widget.wifi.title")} bind:collapsed {hints}>
|
|
131
|
-
{#snippet right()}
|
|
132
|
-
<div class="w-
|
|
131
|
+
{#snippet right(narrow: boolean)}
|
|
132
|
+
<div class={narrow ? "w-36" : "w-72"} use:hint={{ text: $T("widget.wifi.hint.mode"), enabled: $hints }}>
|
|
133
133
|
<UI.Select
|
|
134
134
|
wrapperClass="w-full"
|
|
135
135
|
type="buttons"
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
<!-- Клиентский режим (STA) -->
|
|
148
148
|
<div class="flex flex-col gap-3 rounded-[10px] border border-(--hairline-color) bg-(--back-color) p-3" transition:slide={{ duration: 150 }}>
|
|
149
149
|
<!-- SSID с поиском и пароль - одной строкой по 50%, на узком экране друг под другом -->
|
|
150
|
-
<div class="grid grid-cols-1 gap-x-4 gap-y-3 sm:grid-cols-2">
|
|
150
|
+
<div class="grid grid-cols-1 gap-x-4 gap-y-3 @sm:grid-cols-2">
|
|
151
151
|
<div class="flex min-w-0 items-end gap-2">
|
|
152
152
|
<div class="min-w-0 flex-1" use:hint={{ text: $T("widget.wifi.hint.ssid"), enabled: $hints }}>
|
|
153
153
|
<UI.Select
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
/>
|
|
179
179
|
</div>
|
|
180
180
|
|
|
181
|
-
<div class="w-full sm:w-72" use:hint={{ text: $T("widget.wifi.hint.ip_mode"), enabled: $hints }}>
|
|
181
|
+
<div class="w-full @sm:w-72" use:hint={{ text: $T("widget.wifi.hint.ip_mode"), enabled: $hints }}>
|
|
182
182
|
<UI.Select
|
|
183
183
|
wrapperClass="w-full"
|
|
184
184
|
type="buttons"
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
</div>
|
|
191
191
|
|
|
192
192
|
{#if cfg.StaticIP === 1}
|
|
193
|
-
<div class="grid grid-cols-1 gap-2
|
|
193
|
+
<div class="grid grid-cols-1 gap-2 @md:grid-cols-3" transition:slide={{ duration: 150 }}>
|
|
194
194
|
<div use:hint={{ text: $T("widget.wifi.hint.ip"), enabled: $hints }}>
|
|
195
195
|
<UI.Input
|
|
196
196
|
label={{ name: $T("widget.common.ip") }}
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
<!-- Точка доступа (AP) -->
|
|
228
228
|
<div class="flex flex-col gap-3 rounded-[10px] border border-(--hairline-color) bg-(--back-color) p-3" transition:slide={{ duration: 150 }}>
|
|
229
229
|
<!-- Те же колонки, что у STA: в режиме STA + AP пароли стоят друг под другом -->
|
|
230
|
-
<div class="grid grid-cols-1 gap-x-4 gap-y-3 sm:grid-cols-2">
|
|
230
|
+
<div class="grid grid-cols-1 gap-x-4 gap-y-3 @sm:grid-cols-2">
|
|
231
231
|
<div use:hint={{ text: $T("widget.wifi.hint.ap"), enabled: $hints }}>
|
|
232
232
|
<UI.Input label={{ name: $T("widget.wifi.ap_ssid") }} bind:value={cfg.ApSSID} maxlength={32} />
|
|
233
233
|
</div>
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
/>
|
|
241
241
|
</div>
|
|
242
242
|
|
|
243
|
-
<div class="grid grid-cols-1 gap-2
|
|
243
|
+
<div class="grid grid-cols-1 gap-2 @md:grid-cols-3">
|
|
244
244
|
<div use:hint={{ text: $T("widget.wifi.hint.ap_ip"), enabled: $hints }}>
|
|
245
245
|
<UI.Input label={{ name: $T("widget.common.ip") }} bind:value={cfg.ApIP} maxlength={15} help={{ regExp: IP_REGEXP }} />
|
|
246
246
|
</div>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as Accordion } from "./Accordion/Accordion.svelte";
|
|
2
|
+
export { default as ExpandIcon } from "./ExpandIcon.svelte";
|
|
3
|
+
export { default as SectionHead } from "./SectionHead.svelte";
|
|
2
4
|
export { default as Button } from "./Button/Button.svelte";
|
|
3
5
|
export { default as Carousel } from "./Carousel/Carousel.svelte";
|
|
4
6
|
export { default as Divider } from "./Divider/Divider.svelte";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* Реэкспорт всех UI компонентов для удобного импорта */
|
|
2
2
|
export { default as Accordion } from "./Accordion/Accordion.svelte";
|
|
3
|
+
export { default as ExpandIcon } from "./ExpandIcon.svelte";
|
|
4
|
+
export { default as SectionHead } from "./SectionHead.svelte";
|
|
3
5
|
export { default as Button } from "./Button/Button.svelte";
|
|
4
6
|
export { default as Carousel } from "./Carousel/Carousel.svelte";
|
|
5
7
|
export { default as Divider } from "./Divider/Divider.svelte";
|
|
@@ -984,6 +984,16 @@ declare const translations: {
|
|
|
984
984
|
en: string;
|
|
985
985
|
zh: string;
|
|
986
986
|
};
|
|
987
|
+
"widget.mission.editFieldShort": {
|
|
988
|
+
ru: string;
|
|
989
|
+
en: string;
|
|
990
|
+
zh: string;
|
|
991
|
+
};
|
|
992
|
+
"widget.mission.editHolesShort": {
|
|
993
|
+
ru: string;
|
|
994
|
+
en: string;
|
|
995
|
+
zh: string;
|
|
996
|
+
};
|
|
987
997
|
"widget.mission.close": {
|
|
988
998
|
ru: string;
|
|
989
999
|
en: string;
|
|
@@ -1129,6 +1139,11 @@ declare const translations: {
|
|
|
1129
1139
|
en: string;
|
|
1130
1140
|
zh: string;
|
|
1131
1141
|
};
|
|
1142
|
+
"widget.route.addShort": {
|
|
1143
|
+
ru: string;
|
|
1144
|
+
en: string;
|
|
1145
|
+
zh: string;
|
|
1146
|
+
};
|
|
1132
1147
|
"widget.route.helpEmpty": {
|
|
1133
1148
|
ru: string;
|
|
1134
1149
|
en: string;
|
|
@@ -381,6 +381,8 @@ const translations = {
|
|
|
381
381
|
"widget.mission.lha": { ru: "л/га", en: "l/ha", zh: "升/公顷" },
|
|
382
382
|
"widget.mission.editField": { ru: "Редактор полей", en: "Field editor", zh: "田块编辑" },
|
|
383
383
|
"widget.mission.editHoles": { ru: "Редактор запретных зон", en: "No-fly zone editor", zh: "禁飞区编辑" },
|
|
384
|
+
"widget.mission.editFieldShort": { ru: "Поля", en: "Fields", zh: "田块" },
|
|
385
|
+
"widget.mission.editHolesShort": { ru: "Запретные зоны", en: "No-fly zones", zh: "禁飞区" },
|
|
384
386
|
"widget.mission.close": { ru: "Замкнуть", en: "Close", zh: "闭合" },
|
|
385
387
|
"widget.mission.settings": { ru: "Маршрут и внесение", en: "Route and application", zh: "航线与喷洒" },
|
|
386
388
|
"widget.mission.s.angle": { ru: "угол", en: "angle", zh: "角度" },
|
|
@@ -458,6 +460,7 @@ const translations = {
|
|
|
458
460
|
"widget.route.title": { ru: "Планировщик маршрута", en: "Route planner", zh: "航线规划" },
|
|
459
461
|
"widget.route.pts": { ru: "т.", en: "pts", zh: "点" },
|
|
460
462
|
"widget.route.add": { ru: "Редактор точек", en: "Waypoint editor", zh: "航点编辑" },
|
|
463
|
+
"widget.route.addShort": { ru: "Точки", en: "Waypoints", zh: "航点" },
|
|
461
464
|
"widget.route.helpEmpty": {
|
|
462
465
|
ru: "Нажмите «Изменить точки» и кликайте по карте по порядку облёта.",
|
|
463
466
|
en: "Press “Edit points” and click the map in flight order.",
|