flight-indicators 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -4
- package/dist/index.cjs +595 -160
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +91 -2
- package/dist/index.d.ts +91 -2
- package/dist/index.js +587 -161
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ function InstrumentFrame({
|
|
|
66
66
|
className,
|
|
67
67
|
style,
|
|
68
68
|
title,
|
|
69
|
-
label,
|
|
69
|
+
label: label2,
|
|
70
70
|
children
|
|
71
71
|
}) {
|
|
72
72
|
const titleId = useSvgId("fi-title");
|
|
@@ -84,7 +84,7 @@ function InstrumentFrame({
|
|
|
84
84
|
style: { display: "inline-block", userSelect: "none", ...style },
|
|
85
85
|
fontFamily: "'Helvetica Neue', Arial, sans-serif",
|
|
86
86
|
children: [
|
|
87
|
-
/* @__PURE__ */ jsx("title", { id: titleId, children: title ??
|
|
87
|
+
/* @__PURE__ */ jsx("title", { id: titleId, children: title ?? label2 }),
|
|
88
88
|
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: bezelId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
89
89
|
/* @__PURE__ */ jsx("stop", { offset: "0", stopColor: "#5a5a5a" }),
|
|
90
90
|
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#1a1a1a" })
|
|
@@ -188,7 +188,7 @@ function HeadingIndicator({ heading = 0, ...props }) {
|
|
|
188
188
|
/* @__PURE__ */ jsx3("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx3("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
189
189
|
range(0, 330, 30).map((a) => {
|
|
190
190
|
const [x, y] = polar(132, a);
|
|
191
|
-
const
|
|
191
|
+
const label2 = CARDINALS[a] ?? String(a / 10);
|
|
192
192
|
return /* @__PURE__ */ jsx3(
|
|
193
193
|
"text",
|
|
194
194
|
{
|
|
@@ -200,7 +200,7 @@ function HeadingIndicator({ heading = 0, ...props }) {
|
|
|
200
200
|
fontWeight: "bold",
|
|
201
201
|
textAnchor: "middle",
|
|
202
202
|
dominantBaseline: "central",
|
|
203
|
-
children:
|
|
203
|
+
children: label2
|
|
204
204
|
},
|
|
205
205
|
a
|
|
206
206
|
);
|
|
@@ -503,8 +503,8 @@ function WindIndicator({
|
|
|
503
503
|
const dirText = String(Math.round(norm(dir)) || 360).padStart(3, "0");
|
|
504
504
|
const windText = calm ? "CALM" : `${dirText}\xB0 ${Math.round(speed)}${hasGust ? `G${Math.round(gust)}` : ""}KT`;
|
|
505
505
|
const crossText = crosswind === 0 ? "0" : `${Math.abs(crosswind)}${crosswind > 0 ? "R" : "L"}`;
|
|
506
|
-
const
|
|
507
|
-
return /* @__PURE__ */ jsxs8(InstrumentFrame, { ...props, label, children: [
|
|
506
|
+
const label2 = `Wind: ${calm ? "calm" : `${dirText}\xB0 at ${Math.round(speed)}${hasGust ? ` gusting ${Math.round(gust)}` : ""} knots`}, runway ${activeNumber}${activeSide ?? ""} in use, ${headwind < 0 ? "tailwind" : "headwind"} ${Math.abs(headwind)}, crosswind ${Math.abs(crosswind)}${crosswind === 0 ? "" : crosswind > 0 ? " from the right" : " from the left"}`;
|
|
507
|
+
return /* @__PURE__ */ jsxs8(InstrumentFrame, { ...props, label: label2, children: [
|
|
508
508
|
/* @__PURE__ */ jsx8("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 350, 10).map((a) => /* @__PURE__ */ jsx8("path", { d: tickPath(176, a % 30 === 0 ? 162 : 168, a), strokeWidth: a % 30 === 0 ? 3 : 2, opacity: a % 30 === 0 ? 1 : 0.7 }, a)) }),
|
|
509
509
|
range(0, 330, 30).map((a) => {
|
|
510
510
|
const [x, y] = polar(146, a);
|
|
@@ -562,12 +562,17 @@ function WindIndicator({
|
|
|
562
562
|
}
|
|
563
563
|
|
|
564
564
|
// src/components/VorIndicator.tsx
|
|
565
|
-
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
565
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
566
566
|
var CARDINALS3 = { 0: "N", 90: "E", 180: "S", 270: "W" };
|
|
567
567
|
var AMBER2 = "#ffb000";
|
|
568
568
|
var FULL_SCALE_DEG = 10;
|
|
569
569
|
var DOT_SPACING = 22;
|
|
570
570
|
var FULL_SCALE_PX = DOT_SPACING * 5;
|
|
571
|
+
var PIVOT_Y = CENTER - 100;
|
|
572
|
+
var SWING_LENGTH = 165;
|
|
573
|
+
var SWING_DOT_RADIUS = 156;
|
|
574
|
+
var SWING_DEG_PER_DOT = 7.5;
|
|
575
|
+
var SWING_FULL_SCALE_DEG = SWING_DEG_PER_DOT * 5;
|
|
571
576
|
var norm2 = (deg) => (deg % 360 + 360) % 360;
|
|
572
577
|
var signedDiff = (a, b) => ((a - b) % 360 + 540) % 360 - 180;
|
|
573
578
|
function vorDeviation(course, radial) {
|
|
@@ -593,7 +598,7 @@ function Flag({ y, up, visible, testId }) {
|
|
|
593
598
|
/* @__PURE__ */ jsx9("text", { x: CENTER + 22, y, fill: "#fff", fontSize: "15", fontWeight: "bold", dominantBaseline: "central", children: up ? "TO" : "FROM" })
|
|
594
599
|
] });
|
|
595
600
|
}
|
|
596
|
-
function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ...props }) {
|
|
601
|
+
function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, needle = "slide", ...props }) {
|
|
597
602
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
598
603
|
const crs = finite(course);
|
|
599
604
|
const computed = typeof radial === "number" && Number.isFinite(radial) ? vorDeviation(crs, radial) : void 0;
|
|
@@ -602,10 +607,12 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
602
607
|
const flag = !signal ? "OFF" : toFrom ?? computed?.toFrom ?? "OFF";
|
|
603
608
|
const displayCourse = useContinuousAngle(crs);
|
|
604
609
|
const courseText = String(Math.round(norm2(crs)) || 360).padStart(3, "0");
|
|
610
|
+
const swing = needle === "swing";
|
|
605
611
|
const needleX = dev / FULL_SCALE_DEG * FULL_SCALE_PX;
|
|
612
|
+
const needleAngle = -(dev / FULL_SCALE_DEG) * SWING_FULL_SCALE_DEG;
|
|
606
613
|
const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
|
|
607
|
-
const
|
|
608
|
-
return /* @__PURE__ */ jsxs9(InstrumentFrame, { ...props, label, children: [
|
|
614
|
+
const label2 = signal ? `VOR indicator: course ${courseText}\xB0, needle ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `VOR indicator: course ${courseText}\xB0, no signal`;
|
|
615
|
+
return /* @__PURE__ */ jsxs9(InstrumentFrame, { ...props, label: label2, children: [
|
|
609
616
|
/* @__PURE__ */ jsxs9("g", { "data-testid": "vor-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
|
|
610
617
|
/* @__PURE__ */ jsx9("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx9("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
611
618
|
range(0, 330, 30).map((a) => {
|
|
@@ -630,11 +637,77 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
630
637
|
/* @__PURE__ */ jsx9("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER2, stroke: "#000", strokeWidth: "1.5" }),
|
|
631
638
|
/* @__PURE__ */ jsx9("path", { d: `M ${CENTER} ${CENTER + 150} l -8 24 h 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }),
|
|
632
639
|
/* @__PURE__ */ jsx9("g", { stroke: AMBER2, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 225, 270, 315].map((a) => /* @__PURE__ */ jsx9("path", { d: tickPath(192, 178, a) }, a)) }),
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
640
|
+
swing ? /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
641
|
+
/* @__PURE__ */ jsx9("g", { fill: "#fff", stroke: "#000", strokeWidth: "1", children: range(1, 5, 1).flatMap((i) => [-i, i]).map((i) => {
|
|
642
|
+
const [x, y] = polar(SWING_DOT_RADIUS, 180 - i * SWING_DEG_PER_DOT, CENTER, PIVOT_Y);
|
|
643
|
+
return /* @__PURE__ */ jsx9("circle", { cx: x, cy: y, r: "5" }, i);
|
|
644
|
+
}) }),
|
|
645
|
+
/* @__PURE__ */ jsx9(
|
|
646
|
+
"rect",
|
|
647
|
+
{
|
|
648
|
+
x: CENTER - 6,
|
|
649
|
+
y: PIVOT_Y + SWING_DOT_RADIUS - 10,
|
|
650
|
+
width: "12",
|
|
651
|
+
height: "20",
|
|
652
|
+
rx: "2",
|
|
653
|
+
fill: "none",
|
|
654
|
+
stroke: "#fff",
|
|
655
|
+
strokeWidth: "2.5"
|
|
656
|
+
}
|
|
657
|
+
),
|
|
658
|
+
/* @__PURE__ */ jsx9("rect", { x: CENTER + 46, y: CENTER - 72, width: "46", height: "76", rx: "5", fill: "#000", stroke: "#555", strokeWidth: "2" }),
|
|
659
|
+
/* @__PURE__ */ jsxs9("g", { fill: "#ccc", fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
660
|
+
/* @__PURE__ */ jsx9("text", { x: CENTER + 69, y: CENTER - 59, children: "TO" }),
|
|
661
|
+
/* @__PURE__ */ jsx9("text", { x: CENTER + 69, y: CENTER - 9, children: "FR" })
|
|
662
|
+
] }),
|
|
663
|
+
/* @__PURE__ */ jsxs9("g", { stroke: "#000", strokeWidth: "1.5", strokeLinejoin: "round", fill: "#fff", children: [
|
|
664
|
+
/* @__PURE__ */ jsx9(
|
|
665
|
+
"path",
|
|
666
|
+
{
|
|
667
|
+
"data-testid": "vor-to",
|
|
668
|
+
d: `M ${CENTER + 69} ${CENTER - 44} l 11 18 h -22 z`,
|
|
669
|
+
opacity: flag === "TO" ? 1 : 0,
|
|
670
|
+
style: { transition: "opacity 200ms ease-out" }
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
/* @__PURE__ */ jsx9(
|
|
674
|
+
"path",
|
|
675
|
+
{
|
|
676
|
+
"data-testid": "vor-from",
|
|
677
|
+
d: `M ${CENTER + 69} ${CENTER - 22} l 11 -18 h -22 z`,
|
|
678
|
+
opacity: flag === "FROM" ? 1 : 0,
|
|
679
|
+
style: { transition: "opacity 200ms ease-out" }
|
|
680
|
+
}
|
|
681
|
+
)
|
|
682
|
+
] }),
|
|
683
|
+
/* @__PURE__ */ jsxs9("g", { "data-testid": "vor-needle", style: motionStyle(`rotate(${needleAngle}deg)`, duration, CENTER, PIVOT_Y), children: [
|
|
684
|
+
/* @__PURE__ */ jsx9(
|
|
685
|
+
"path",
|
|
686
|
+
{
|
|
687
|
+
d: `M ${CENTER} ${PIVOT_Y} V ${PIVOT_Y + SWING_LENGTH}`,
|
|
688
|
+
stroke: "#000",
|
|
689
|
+
strokeWidth: "7",
|
|
690
|
+
strokeLinecap: "round"
|
|
691
|
+
}
|
|
692
|
+
),
|
|
693
|
+
/* @__PURE__ */ jsx9(
|
|
694
|
+
"path",
|
|
695
|
+
{
|
|
696
|
+
d: `M ${CENTER} ${PIVOT_Y} V ${PIVOT_Y + SWING_LENGTH}`,
|
|
697
|
+
stroke: "#fff",
|
|
698
|
+
strokeWidth: "4",
|
|
699
|
+
strokeLinecap: "round"
|
|
700
|
+
}
|
|
701
|
+
)
|
|
702
|
+
] }),
|
|
703
|
+
/* @__PURE__ */ jsx9("circle", { cx: CENTER, cy: PIVOT_Y, r: "6", fill: "#333", stroke: "#fff", strokeWidth: "2" })
|
|
704
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
705
|
+
/* @__PURE__ */ jsx9("g", { fill: "#fff", stroke: "#000", strokeWidth: "1", children: range(1, 5, 1).flatMap((i) => [-i, i]).map((i) => /* @__PURE__ */ jsx9("circle", { cx: CENTER + i * DOT_SPACING, cy: CENTER, r: "5" }, i)) }),
|
|
706
|
+
/* @__PURE__ */ jsx9("circle", { cx: CENTER, cy: CENTER, r: "9", fill: "none", stroke: "#fff", strokeWidth: "2.5" }),
|
|
707
|
+
/* @__PURE__ */ jsx9(Flag, { y: CENTER - 54, up: true, visible: flag === "TO", testId: "vor-to" }),
|
|
708
|
+
/* @__PURE__ */ jsx9(Flag, { y: CENTER + 54, up: false, visible: flag === "FROM", testId: "vor-from" }),
|
|
709
|
+
/* @__PURE__ */ jsx9("g", { "data-testid": "vor-needle", style: motionStyle(`translate(${needleX}px, 0px)`, duration), children: /* @__PURE__ */ jsx9("rect", { x: CENTER - 3, y: CENTER - 68, width: "6", height: "136", rx: "3", fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) })
|
|
710
|
+
] }),
|
|
638
711
|
/* @__PURE__ */ jsx9("rect", { x: CENTER - 44, y: CENTER + 72, width: "88", height: "26", rx: "4", fill: "#000", stroke: "#555", strokeWidth: "2" }),
|
|
639
712
|
/* @__PURE__ */ jsxs9(
|
|
640
713
|
"text",
|
|
@@ -654,20 +727,364 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
654
727
|
]
|
|
655
728
|
}
|
|
656
729
|
),
|
|
657
|
-
/* @__PURE__ */ jsxs9(
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
730
|
+
/* @__PURE__ */ jsxs9(
|
|
731
|
+
"g",
|
|
732
|
+
{
|
|
733
|
+
"data-testid": "vor-nav-flag",
|
|
734
|
+
opacity: signal ? 0 : 1,
|
|
735
|
+
style: { transition: "opacity 200ms ease-out" },
|
|
736
|
+
transform: swing ? "translate(-64 52)" : void 0,
|
|
737
|
+
children: [
|
|
738
|
+
/* @__PURE__ */ jsx9("rect", { x: CENTER - 28, y: CENTER - 98, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
|
|
739
|
+
/* @__PURE__ */ jsx9("text", { x: CENTER, y: CENTER - 85, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "NAV" })
|
|
740
|
+
]
|
|
741
|
+
}
|
|
742
|
+
)
|
|
661
743
|
] });
|
|
662
744
|
}
|
|
663
745
|
|
|
664
|
-
// src/components/
|
|
746
|
+
// src/components/AdfIndicator.tsx
|
|
665
747
|
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
666
|
-
var
|
|
748
|
+
var CARDINALS4 = { 0: "N", 90: "E", 180: "S", 270: "W" };
|
|
749
|
+
var AMBER3 = "#ffb000";
|
|
750
|
+
var NEEDLE = "#ffe14d";
|
|
751
|
+
var PARKED_DEG = 90;
|
|
752
|
+
var norm3 = (deg) => (deg % 360 + 360) % 360;
|
|
753
|
+
var pad3 = (deg) => String(Math.round(norm3(deg)) % 360).padStart(3, "0");
|
|
754
|
+
function relativeBearing(heading, bearingToStation) {
|
|
755
|
+
return norm3(finite(bearingToStation) - finite(heading));
|
|
756
|
+
}
|
|
757
|
+
function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
758
|
+
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
759
|
+
const rel = finite(bearing);
|
|
760
|
+
const hdg = finite(heading);
|
|
761
|
+
const displayCard = useContinuousAngle(hdg);
|
|
762
|
+
const displayNeedle = useContinuousAngle(signal ? rel : PARKED_DEG);
|
|
763
|
+
const label2 = signal ? `ADF indicator: station ${pad3(rel)}\xB0 relative, bearing ${pad3(rel + hdg)}\xB0 to station` : "ADF indicator: no signal";
|
|
764
|
+
return /* @__PURE__ */ jsxs10(InstrumentFrame, { ...props, label: label2, children: [
|
|
765
|
+
/* @__PURE__ */ jsxs10("g", { "data-testid": "adf-card", style: motionStyle(`rotate(${-displayCard}deg)`, duration), children: [
|
|
766
|
+
/* @__PURE__ */ jsx10("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx10("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
767
|
+
range(0, 330, 30).map((a) => {
|
|
768
|
+
const [x, y] = polar(132, a);
|
|
769
|
+
return /* @__PURE__ */ jsx10(
|
|
770
|
+
"text",
|
|
771
|
+
{
|
|
772
|
+
x,
|
|
773
|
+
y,
|
|
774
|
+
transform: `rotate(${a} ${x} ${y})`,
|
|
775
|
+
fill: a % 90 === 0 ? AMBER3 : "#fff",
|
|
776
|
+
fontSize: a % 90 === 0 ? 28 : 24,
|
|
777
|
+
fontWeight: "bold",
|
|
778
|
+
textAnchor: "middle",
|
|
779
|
+
dominantBaseline: "central",
|
|
780
|
+
children: CARDINALS4[a] ?? String(a / 10)
|
|
781
|
+
},
|
|
782
|
+
a
|
|
783
|
+
);
|
|
784
|
+
})
|
|
785
|
+
] }),
|
|
786
|
+
/* @__PURE__ */ jsx10("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER3, stroke: "#000", strokeWidth: "1.5" }),
|
|
787
|
+
/* @__PURE__ */ jsx10("g", { stroke: AMBER3, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 180, 225, 270, 315].map((a) => /* @__PURE__ */ jsx10("path", { d: tickPath(192, 178, a) }, a)) }),
|
|
788
|
+
/* @__PURE__ */ jsxs10("g", { stroke: AMBER3, strokeWidth: "2", strokeLinecap: "round", opacity: "0.7", children: [
|
|
789
|
+
/* @__PURE__ */ jsx10("path", { d: `M ${CENTER - 26} ${CENTER} H ${CENTER + 26}` }),
|
|
790
|
+
/* @__PURE__ */ jsx10("path", { d: `M ${CENTER} ${CENTER - 26} V ${CENTER + 14}` })
|
|
791
|
+
] }),
|
|
792
|
+
/* @__PURE__ */ jsx10("text", { x: CENTER, y: CENTER + 62, fill: "#ccc", fontSize: "15", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: "ADF" }),
|
|
793
|
+
/* @__PURE__ */ jsxs10("g", { "data-testid": "adf-flag", opacity: signal ? 0 : 1, style: { transition: "opacity 200ms ease-out" }, children: [
|
|
794
|
+
/* @__PURE__ */ jsx10("rect", { x: CENTER - 28, y: CENTER - 76, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
|
|
795
|
+
/* @__PURE__ */ jsx10("text", { x: CENTER, y: CENTER - 63, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "ADF" })
|
|
796
|
+
] }),
|
|
797
|
+
/* @__PURE__ */ jsx10("g", { "data-testid": "adf-needle", style: motionStyle(`rotate(${displayNeedle}deg)`, duration), children: /* @__PURE__ */ jsx10(
|
|
798
|
+
"path",
|
|
799
|
+
{
|
|
800
|
+
d: `M ${CENTER} ${CENTER - 146} l -13 30 h 9 V ${CENTER + 140} h 8 V ${CENTER - 116} h 9 z`,
|
|
801
|
+
fill: NEEDLE,
|
|
802
|
+
stroke: "#000",
|
|
803
|
+
strokeWidth: "1.5",
|
|
804
|
+
strokeLinejoin: "round"
|
|
805
|
+
}
|
|
806
|
+
) }),
|
|
807
|
+
/* @__PURE__ */ jsx10(Hub, { r: 10 })
|
|
808
|
+
] });
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// src/components/RadioPanel.tsx
|
|
812
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
667
813
|
var SIDE = 252;
|
|
814
|
+
var ORIGIN = CENTER - SIDE / 2;
|
|
815
|
+
var ROW_H = 60;
|
|
816
|
+
var ROW_GAP = 8;
|
|
817
|
+
var FIRST_ROW = ORIGIN + 32;
|
|
818
|
+
var LABEL_X = ORIGIN + 10;
|
|
819
|
+
var ACTIVE_X = ORIGIN + 48;
|
|
820
|
+
var DISPLAY_W = 88;
|
|
821
|
+
var STANDBY_X = ORIGIN + SIDE - 8 - DISPLAY_W;
|
|
822
|
+
var SWAP_X = (ACTIVE_X + DISPLAY_W + STANDBY_X) / 2;
|
|
823
|
+
var usable = (n) => typeof n === "number" && Number.isFinite(n) && n >= 0;
|
|
824
|
+
var formatNav = (mhz) => usable(mhz) ? mhz.toFixed(2) : "---.--";
|
|
825
|
+
var formatAdf = (khz) => usable(khz) ? Number.isInteger(khz) ? String(khz) : khz.toFixed(1) : "---";
|
|
826
|
+
var formatDme = (nm) => usable(nm) ? nm < 99.95 ? nm.toFixed(1) : nm.toFixed(0) : "--.-";
|
|
827
|
+
function Display({ x, y, width, value, color, testId, unit }) {
|
|
828
|
+
const h = ROW_H - 16;
|
|
829
|
+
return /* @__PURE__ */ jsxs11("g", { children: [
|
|
830
|
+
/* @__PURE__ */ jsx11("rect", { x, y: y + 8, width, height: h, rx: "5", fill: "#1a0d00", stroke: "#3a2a14", strokeWidth: "1.5" }),
|
|
831
|
+
/* @__PURE__ */ jsx11(
|
|
832
|
+
"text",
|
|
833
|
+
{
|
|
834
|
+
"data-testid": testId,
|
|
835
|
+
x: unit ? x + width - 40 : x + width / 2,
|
|
836
|
+
y: y + ROW_H / 2 + 1,
|
|
837
|
+
fill: color,
|
|
838
|
+
fontSize: unit ? 28 : 22,
|
|
839
|
+
fontFamily: "monospace",
|
|
840
|
+
fontWeight: "bold",
|
|
841
|
+
textAnchor: unit ? "end" : "middle",
|
|
842
|
+
dominantBaseline: "central",
|
|
843
|
+
children: value
|
|
844
|
+
}
|
|
845
|
+
),
|
|
846
|
+
unit && /* @__PURE__ */ jsx11("text", { x: x + width - 10, y: y + ROW_H / 2 + 5, fill: "#9aa4b1", fontSize: "13", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: unit })
|
|
847
|
+
] });
|
|
848
|
+
}
|
|
849
|
+
function Swap({ y }) {
|
|
850
|
+
const cy = y + ROW_H / 2;
|
|
851
|
+
return /* @__PURE__ */ jsxs11("g", { stroke: "#9aa4b1", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
852
|
+
/* @__PURE__ */ jsx11("path", { d: `M ${SWAP_X - 7} ${cy - 4} H ${SWAP_X + 7} m -4 -3 l 4 3 l -4 3` }),
|
|
853
|
+
/* @__PURE__ */ jsx11("path", { d: `M ${SWAP_X + 7} ${cy + 4} H ${SWAP_X - 7} m 4 -3 l -4 3 l 4 3` })
|
|
854
|
+
] });
|
|
855
|
+
}
|
|
856
|
+
function RowLabel({ y, children }) {
|
|
857
|
+
return /* @__PURE__ */ jsx11("text", { x: LABEL_X, y: y + ROW_H / 2 + 1, fill: "#ccc", fontSize: "14", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children });
|
|
858
|
+
}
|
|
859
|
+
function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
|
|
860
|
+
const rows = [
|
|
861
|
+
{ key: "nav", name: "NAV", unit: "MHz", active: formatNav(nav?.active), standby: formatNav(nav?.standby), tuned: usable(nav?.active) },
|
|
862
|
+
{ key: "adf", name: "ADF", unit: "kHz", active: formatAdf(adf?.active), standby: formatAdf(adf?.standby), tuned: usable(adf?.active) }
|
|
863
|
+
];
|
|
864
|
+
const dmeText = formatDme(dme);
|
|
865
|
+
const dmeY = FIRST_ROW + 2 * (ROW_H + ROW_GAP);
|
|
866
|
+
const label2 = "Radio panel: " + rows.map((r) => `${r.name} ${r.tuned ? `${r.active} ${r.unit}` : "not tuned"}`).join(", ") + `, DME ${usable(dme) ? `${dmeText} NM` : "no distance"}`;
|
|
867
|
+
return /* @__PURE__ */ jsxs11(InstrumentFrame, { ...props, label: label2, children: [
|
|
868
|
+
/* @__PURE__ */ jsx11("rect", { x: ORIGIN, y: ORIGIN, width: SIDE, height: SIDE, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
869
|
+
/* @__PURE__ */ jsxs11("g", { fill: "#9aa4b1", fontSize: "11", fontWeight: "bold", letterSpacing: "1.5", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
870
|
+
/* @__PURE__ */ jsx11("text", { x: ACTIVE_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "ACTIVE" }),
|
|
871
|
+
/* @__PURE__ */ jsx11("text", { x: STANDBY_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "STBY" })
|
|
872
|
+
] }),
|
|
873
|
+
rows.map((r, i) => {
|
|
874
|
+
const y = FIRST_ROW + i * (ROW_H + ROW_GAP);
|
|
875
|
+
return /* @__PURE__ */ jsxs11("g", { children: [
|
|
876
|
+
/* @__PURE__ */ jsx11(RowLabel, { y, children: r.name }),
|
|
877
|
+
/* @__PURE__ */ jsx11(Display, { x: ACTIVE_X, y, width: DISPLAY_W, value: r.active, color, testId: `radio-${r.key}-active` }),
|
|
878
|
+
/* @__PURE__ */ jsx11(Swap, { y }),
|
|
879
|
+
/* @__PURE__ */ jsx11(Display, { x: STANDBY_X, y, width: DISPLAY_W, value: r.standby, color, testId: `radio-${r.key}-standby` })
|
|
880
|
+
] }, r.key);
|
|
881
|
+
}),
|
|
882
|
+
/* @__PURE__ */ jsx11(RowLabel, { y: dmeY, children: "DME" }),
|
|
883
|
+
/* @__PURE__ */ jsx11(Display, { x: ACTIVE_X, y: dmeY, width: STANDBY_X + DISPLAY_W - ACTIVE_X, value: dmeText, color, testId: "radio-dme", unit: "NM" })
|
|
884
|
+
] });
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// src/components/RadioStack.tsx
|
|
888
|
+
import { useState } from "react";
|
|
889
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
890
|
+
var parseNav = (text) => {
|
|
891
|
+
const mhz = Math.round(Number.parseFloat(text.replace(",", ".")) * 100) / 100;
|
|
892
|
+
return mhz >= 108 && mhz <= 117.95 ? mhz : void 0;
|
|
893
|
+
};
|
|
894
|
+
var parseAdf = (text) => {
|
|
895
|
+
const khz = Math.round(Number.parseFloat(text.replace(",", ".")) * 10) / 10;
|
|
896
|
+
return khz >= 190 && khz <= 1750 ? khz : void 0;
|
|
897
|
+
};
|
|
898
|
+
var MONO = "ui-monospace, 'SF Mono', Menlo, Consolas, monospace";
|
|
899
|
+
var LABEL = "#ccc";
|
|
900
|
+
var MUTED = "#9aa4b1";
|
|
901
|
+
var display = {
|
|
902
|
+
boxSizing: "border-box",
|
|
903
|
+
width: "100%",
|
|
904
|
+
minWidth: 0,
|
|
905
|
+
height: "2.1em",
|
|
906
|
+
margin: 0,
|
|
907
|
+
padding: "0 0.1em",
|
|
908
|
+
borderRadius: "0.25em",
|
|
909
|
+
border: "0.08em solid #3a2a14",
|
|
910
|
+
background: "#1a0d00",
|
|
911
|
+
fontFamily: MONO,
|
|
912
|
+
fontSize: "1.2em",
|
|
913
|
+
fontWeight: "bold",
|
|
914
|
+
lineHeight: "2em",
|
|
915
|
+
textAlign: "center",
|
|
916
|
+
whiteSpace: "nowrap",
|
|
917
|
+
overflow: "hidden"
|
|
918
|
+
};
|
|
919
|
+
var label = { display: "flex", flexDirection: "column", justifyContent: "center", color: LABEL, fontWeight: "bold", letterSpacing: "0.06em", lineHeight: 1.15 };
|
|
920
|
+
var ident = { color: "#3cc8ff", fontSize: "0.72em", fontFamily: MONO, minHeight: "1.15em" };
|
|
921
|
+
function SwapIcon() {
|
|
922
|
+
return /* @__PURE__ */ jsxs12("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
923
|
+
/* @__PURE__ */ jsx12("path", { d: "M2 5.5 H14 M11 2.5 l3 3 l-3 3" }),
|
|
924
|
+
/* @__PURE__ */ jsx12("path", { d: "M14 10.5 H2 M5 7.5 l-3 3 l3 3" })
|
|
925
|
+
] });
|
|
926
|
+
}
|
|
927
|
+
function Receiver({ name, unit, value, ident: station, color, format, parse, onChange }) {
|
|
928
|
+
const [draft, setDraft] = useState(null);
|
|
929
|
+
const [focused, setFocused] = useState(false);
|
|
930
|
+
const [invalid, setInvalid] = useState(false);
|
|
931
|
+
const key = name.toLowerCase();
|
|
932
|
+
const shown = value.standby === void 0 ? "" : format(value.standby);
|
|
933
|
+
const swap = (standby = value.standby) => onChange({ active: standby, standby: value.active });
|
|
934
|
+
const onKeyDown = (e) => {
|
|
935
|
+
if (e.key === "Escape") {
|
|
936
|
+
setDraft(null);
|
|
937
|
+
setInvalid(false);
|
|
938
|
+
}
|
|
939
|
+
if (e.key !== "Enter") return;
|
|
940
|
+
e.preventDefault();
|
|
941
|
+
const text = (draft ?? shown).trim();
|
|
942
|
+
const standby = text ? parse(text) : void 0;
|
|
943
|
+
if (text && standby === void 0) return setInvalid(true);
|
|
944
|
+
setDraft(null);
|
|
945
|
+
setInvalid(false);
|
|
946
|
+
swap(standby);
|
|
947
|
+
};
|
|
948
|
+
const onBlur = () => {
|
|
949
|
+
setFocused(false);
|
|
950
|
+
setInvalid(false);
|
|
951
|
+
if (draft === null) return;
|
|
952
|
+
const text = draft.trim();
|
|
953
|
+
const standby = text ? parse(text) : void 0;
|
|
954
|
+
setDraft(null);
|
|
955
|
+
if (text && standby === void 0 || standby === value.standby) return;
|
|
956
|
+
onChange({ active: value.active, standby });
|
|
957
|
+
};
|
|
958
|
+
return /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
959
|
+
/* @__PURE__ */ jsxs12("div", { style: label, children: [
|
|
960
|
+
/* @__PURE__ */ jsx12("span", { children: name }),
|
|
961
|
+
/* @__PURE__ */ jsx12("span", { "data-testid": `radio-stack-${key}-ident`, style: ident, children: station ?? "" })
|
|
962
|
+
] }),
|
|
963
|
+
/* @__PURE__ */ jsx12("div", { "data-testid": `radio-stack-${key}-active`, "aria-label": `${name} active frequency`, style: { ...display, color }, children: format(value.active) }),
|
|
964
|
+
/* @__PURE__ */ jsx12(
|
|
965
|
+
"button",
|
|
966
|
+
{
|
|
967
|
+
type: "button",
|
|
968
|
+
onClick: () => swap(),
|
|
969
|
+
"aria-label": `Swap ${name} active and standby`,
|
|
970
|
+
title: "Swap active and standby",
|
|
971
|
+
style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "2em", padding: 0, margin: 0, border: "0.08em solid #555", borderRadius: "0.3em", background: "#3a3a3a", color: "#ddd", font: "inherit", fontSize: "1.2em", cursor: "pointer" },
|
|
972
|
+
children: /* @__PURE__ */ jsx12(SwapIcon, {})
|
|
973
|
+
}
|
|
974
|
+
),
|
|
975
|
+
/* @__PURE__ */ jsx12(
|
|
976
|
+
"input",
|
|
977
|
+
{
|
|
978
|
+
type: "text",
|
|
979
|
+
inputMode: "decimal",
|
|
980
|
+
autoComplete: "off",
|
|
981
|
+
spellCheck: false,
|
|
982
|
+
"data-testid": `radio-stack-${key}-standby`,
|
|
983
|
+
"aria-label": `${name} standby frequency (${unit})`,
|
|
984
|
+
"aria-invalid": invalid || void 0,
|
|
985
|
+
placeholder: format(void 0),
|
|
986
|
+
value: draft ?? shown,
|
|
987
|
+
onChange: (e) => {
|
|
988
|
+
setDraft(e.target.value);
|
|
989
|
+
setInvalid(false);
|
|
990
|
+
},
|
|
991
|
+
onFocus: (e) => {
|
|
992
|
+
setFocused(true);
|
|
993
|
+
e.target.select();
|
|
994
|
+
},
|
|
995
|
+
onBlur,
|
|
996
|
+
onKeyDown,
|
|
997
|
+
style: { ...display, color, outline: "none", borderColor: invalid ? "#ff4d4d" : focused ? color : "#3a2a14", cursor: "text" }
|
|
998
|
+
}
|
|
999
|
+
)
|
|
1000
|
+
] });
|
|
1001
|
+
}
|
|
1002
|
+
var SCREWS2 = [
|
|
1003
|
+
{ top: "0.3em", left: "0.3em" },
|
|
1004
|
+
{ top: "0.3em", right: "0.3em" },
|
|
1005
|
+
{ bottom: "0.3em", left: "0.3em" },
|
|
1006
|
+
{ bottom: "0.3em", right: "0.3em" }
|
|
1007
|
+
];
|
|
1008
|
+
function RadioStack({
|
|
1009
|
+
nav,
|
|
1010
|
+
adf,
|
|
1011
|
+
defaultNav,
|
|
1012
|
+
defaultAdf,
|
|
1013
|
+
onNavChange,
|
|
1014
|
+
onAdfChange,
|
|
1015
|
+
navIdent,
|
|
1016
|
+
adfIdent,
|
|
1017
|
+
dme,
|
|
1018
|
+
color = "#ff9a2e",
|
|
1019
|
+
width = 320,
|
|
1020
|
+
className,
|
|
1021
|
+
style,
|
|
1022
|
+
title = "Radio panel"
|
|
1023
|
+
}) {
|
|
1024
|
+
const [innerNav, setInnerNav] = useState(defaultNav ?? {});
|
|
1025
|
+
const [innerAdf, setInnerAdf] = useState(defaultAdf ?? {});
|
|
1026
|
+
const changeNav = (next) => {
|
|
1027
|
+
if (nav === void 0) setInnerNav(next);
|
|
1028
|
+
onNavChange?.(next);
|
|
1029
|
+
};
|
|
1030
|
+
const changeAdf = (next) => {
|
|
1031
|
+
if (adf === void 0) setInnerAdf(next);
|
|
1032
|
+
onAdfChange?.(next);
|
|
1033
|
+
};
|
|
1034
|
+
const heading = { color: MUTED, fontSize: "0.72em", fontWeight: "bold", letterSpacing: "0.12em", textAlign: "center" };
|
|
1035
|
+
return (
|
|
1036
|
+
// The outer box is a size container so every inner measurement can follow the width.
|
|
1037
|
+
/* @__PURE__ */ jsx12("div", { className, style: { display: "inline-block", width, maxWidth: "100%", verticalAlign: "top", containerType: "inline-size", ...style }, children: /* @__PURE__ */ jsxs12(
|
|
1038
|
+
"div",
|
|
1039
|
+
{
|
|
1040
|
+
role: "group",
|
|
1041
|
+
"aria-label": title,
|
|
1042
|
+
style: {
|
|
1043
|
+
position: "relative",
|
|
1044
|
+
boxSizing: "border-box",
|
|
1045
|
+
display: "grid",
|
|
1046
|
+
gridTemplateColumns: "2.6em minmax(0, 1fr) 2.4em minmax(0, 1fr)",
|
|
1047
|
+
gap: "0.5em 0.4em",
|
|
1048
|
+
alignItems: "center",
|
|
1049
|
+
padding: "1.1em 1.2em 1.2em",
|
|
1050
|
+
borderRadius: "0.9em",
|
|
1051
|
+
border: "0.15em solid #0d0d0d",
|
|
1052
|
+
background: "#232323",
|
|
1053
|
+
color: LABEL,
|
|
1054
|
+
fontFamily: "'Helvetica Neue', Arial, sans-serif",
|
|
1055
|
+
fontSize: "5cqw",
|
|
1056
|
+
textAlign: "left",
|
|
1057
|
+
userSelect: "none"
|
|
1058
|
+
},
|
|
1059
|
+
children: [
|
|
1060
|
+
SCREWS2.map((position, i) => /* @__PURE__ */ jsxs12("svg", { viewBox: "-14 -14 28 28", "aria-hidden": "true", style: { position: "absolute", width: "0.75em", height: "0.75em", ...position }, children: [
|
|
1061
|
+
/* @__PURE__ */ jsx12("circle", { r: "12", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
|
|
1062
|
+
/* @__PURE__ */ jsx12("path", { d: "M -8 3 L 8 -3", stroke: "#111", strokeWidth: "3" })
|
|
1063
|
+
] }, i)),
|
|
1064
|
+
/* @__PURE__ */ jsx12("span", {}),
|
|
1065
|
+
/* @__PURE__ */ jsx12("span", { style: heading, children: "ACTIVE" }),
|
|
1066
|
+
/* @__PURE__ */ jsx12("span", {}),
|
|
1067
|
+
/* @__PURE__ */ jsx12("span", { style: heading, children: "STBY" }),
|
|
1068
|
+
/* @__PURE__ */ jsx12(Receiver, { name: "NAV", unit: "MHz", value: nav ?? innerNav, ident: navIdent, color, format: formatNav, parse: parseNav, onChange: changeNav }),
|
|
1069
|
+
/* @__PURE__ */ jsx12(Receiver, { name: "ADF", unit: "kHz", value: adf ?? innerAdf, ident: adfIdent, color, format: formatAdf, parse: parseAdf, onChange: changeAdf }),
|
|
1070
|
+
/* @__PURE__ */ jsx12("div", { style: label, children: "DME" }),
|
|
1071
|
+
/* @__PURE__ */ jsxs12("div", { "aria-label": "DME distance", style: { ...display, gridColumn: "span 3", display: "flex", alignItems: "baseline", justifyContent: "flex-end", gap: "0.4em", padding: "0 0.5em", color }, children: [
|
|
1072
|
+
/* @__PURE__ */ jsx12("span", { "data-testid": "radio-stack-dme", children: formatDme(dme) }),
|
|
1073
|
+
/* @__PURE__ */ jsx12("span", { style: { color: MUTED, fontFamily: "'Helvetica Neue', Arial, sans-serif", fontSize: "0.5em" }, children: "NM" })
|
|
1074
|
+
] })
|
|
1075
|
+
]
|
|
1076
|
+
}
|
|
1077
|
+
) })
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
// src/components/DataPanel.tsx
|
|
1082
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1083
|
+
var MAX_FIELDS = 6;
|
|
1084
|
+
var SIDE2 = 252;
|
|
668
1085
|
var PAD = 8;
|
|
669
1086
|
var GAP = 8;
|
|
670
|
-
var
|
|
1087
|
+
var ORIGIN2 = CENTER - SIDE2 / 2;
|
|
671
1088
|
var VALUE_SIZE = { 1: 52, 2: 36, 3: 27 };
|
|
672
1089
|
function formatValue(field) {
|
|
673
1090
|
if (typeof field.value === "string") return field.value;
|
|
@@ -678,24 +1095,24 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
678
1095
|
const shown = fields.slice(0, MAX_FIELDS);
|
|
679
1096
|
const cols = shown.length <= 2 ? 1 : 2;
|
|
680
1097
|
const rows = Math.max(1, Math.ceil(shown.length / cols));
|
|
681
|
-
const cellW = (
|
|
682
|
-
const cellH = (
|
|
1098
|
+
const cellW = (SIDE2 - PAD * 2 - GAP * (cols - 1)) / cols;
|
|
1099
|
+
const cellH = (SIDE2 - PAD * 2 - GAP * (rows - 1)) / rows;
|
|
683
1100
|
const valueSize = VALUE_SIZE[rows] ?? 27;
|
|
684
|
-
const
|
|
685
|
-
return /* @__PURE__ */
|
|
686
|
-
heading && /* @__PURE__ */
|
|
687
|
-
/* @__PURE__ */
|
|
1101
|
+
const label2 = `${heading ?? "Data panel"}: ` + (shown.length ? shown.map((f) => `${f.name} ${formatValue(f)}${f.unit ? ` ${f.unit}` : ""}`).join(", ") : "no data");
|
|
1102
|
+
return /* @__PURE__ */ jsxs13(InstrumentFrame, { ...props, label: label2, children: [
|
|
1103
|
+
heading && /* @__PURE__ */ jsx13("text", { x: CENTER, y: ORIGIN2 - 14, fill: "#ccc", fontSize: "13", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: heading.toUpperCase() }),
|
|
1104
|
+
/* @__PURE__ */ jsx13("rect", { x: ORIGIN2, y: ORIGIN2, width: SIDE2, height: SIDE2, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
688
1105
|
shown.map((f, i) => {
|
|
689
1106
|
const col = i % cols;
|
|
690
1107
|
const row = Math.floor(i / cols);
|
|
691
|
-
const x =
|
|
692
|
-
const y =
|
|
1108
|
+
const x = ORIGIN2 + PAD + col * (cellW + GAP);
|
|
1109
|
+
const y = ORIGIN2 + PAD + row * (cellH + GAP);
|
|
693
1110
|
const value = formatValue(f);
|
|
694
1111
|
const fit = Math.min(valueSize, (cellW - 16) / (0.62 * Math.max(1, value.length)));
|
|
695
|
-
return /* @__PURE__ */
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
1112
|
+
return /* @__PURE__ */ jsxs13("g", { "data-testid": `data-field-${i}`, children: [
|
|
1113
|
+
/* @__PURE__ */ jsx13("rect", { x, y, width: cellW, height: cellH, rx: "6", fill: "#000", stroke: "#262a30", strokeWidth: "1" }),
|
|
1114
|
+
/* @__PURE__ */ jsx13("text", { x: x + 8, y: y + 12, fill: "#9aa4b1", fontSize: "12", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children: f.name.toUpperCase() }),
|
|
1115
|
+
/* @__PURE__ */ jsx13(
|
|
699
1116
|
"text",
|
|
700
1117
|
{
|
|
701
1118
|
"data-testid": `data-value-${i}`,
|
|
@@ -710,25 +1127,25 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
710
1127
|
children: value
|
|
711
1128
|
}
|
|
712
1129
|
),
|
|
713
|
-
f.unit && /* @__PURE__ */
|
|
1130
|
+
f.unit && /* @__PURE__ */ jsx13("text", { x: x + cellW - 8, y: y + cellH - 12, fill: "#9aa4b1", fontSize: "12", textAnchor: "end", dominantBaseline: "central", children: f.unit })
|
|
714
1131
|
] }, i);
|
|
715
1132
|
})
|
|
716
1133
|
] });
|
|
717
1134
|
}
|
|
718
1135
|
|
|
719
1136
|
// src/components/FuelIndicator.tsx
|
|
720
|
-
import { jsx as
|
|
1137
|
+
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
721
1138
|
var MAX_TANKS = 4;
|
|
722
1139
|
var GREEN2 = "#2ee05a";
|
|
723
1140
|
var RED = "#ff3b3b";
|
|
724
1141
|
var GREY = "#9aa4b1";
|
|
725
|
-
var
|
|
1142
|
+
var SIDE3 = 252;
|
|
726
1143
|
var PAD2 = 6;
|
|
727
|
-
var
|
|
728
|
-
var INNER_LEFT =
|
|
729
|
-
var INNER_W =
|
|
730
|
-
var FOOTER_Y =
|
|
731
|
-
var BAR_TOP =
|
|
1144
|
+
var ORIGIN3 = CENTER - SIDE3 / 2;
|
|
1145
|
+
var INNER_LEFT = ORIGIN3 + PAD2;
|
|
1146
|
+
var INNER_W = SIDE3 - PAD2 * 2;
|
|
1147
|
+
var FOOTER_Y = ORIGIN3 + SIDE3 - 36;
|
|
1148
|
+
var BAR_TOP = ORIGIN3 + 38;
|
|
732
1149
|
var BAR_H = 114;
|
|
733
1150
|
var BAR_BOTTOM = BAR_TOP + BAR_H;
|
|
734
1151
|
var DEFAULT_TANKS = [
|
|
@@ -741,7 +1158,7 @@ function FuelIndicator({
|
|
|
741
1158
|
unit = "gal",
|
|
742
1159
|
low,
|
|
743
1160
|
decimals = 1,
|
|
744
|
-
label = "FUEL",
|
|
1161
|
+
label: label2 = "FUEL",
|
|
745
1162
|
...props
|
|
746
1163
|
}) {
|
|
747
1164
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
@@ -759,17 +1176,17 @@ function FuelIndicator({
|
|
|
759
1176
|
const isLow = qty <= finite(low, cap * 0.1);
|
|
760
1177
|
return { name: t.name, qty, cap, fraction, full, isLow, text: full ? "FULL" : qty.toFixed(places) };
|
|
761
1178
|
});
|
|
762
|
-
const title = `${
|
|
763
|
-
return /* @__PURE__ */
|
|
764
|
-
/* @__PURE__ */
|
|
1179
|
+
const title = `${label2}: ` + (readings.length ? readings.map((r) => `${r.name} ${r.full ? "full" : `${r.text} of ${r.cap.toFixed(places)} ${unit}`}${r.isLow ? " (low)" : ""}`).join(", ") : "no tanks");
|
|
1180
|
+
return /* @__PURE__ */ jsxs14(InstrumentFrame, { ...props, label: title, children: [
|
|
1181
|
+
/* @__PURE__ */ jsx14("rect", { x: ORIGIN3, y: ORIGIN3, width: SIDE3, height: SIDE3, rx: "10", fill: "#000", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
765
1182
|
readings.map((r, i) => {
|
|
766
1183
|
const cx = INNER_LEFT + colW * (i + 0.5);
|
|
767
1184
|
const color = r.isLow ? RED : GREEN2;
|
|
768
1185
|
const tickX = cx - barW / 2 - 14;
|
|
769
|
-
return /* @__PURE__ */
|
|
770
|
-
i > 0 && /* @__PURE__ */
|
|
771
|
-
/* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
1186
|
+
return /* @__PURE__ */ jsxs14("g", { "data-testid": `fuel-tank-${i}`, children: [
|
|
1187
|
+
i > 0 && /* @__PURE__ */ jsx14("path", { d: `M ${INNER_LEFT + colW * i} ${ORIGIN3 + 10} V ${FOOTER_Y}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1188
|
+
/* @__PURE__ */ jsx14("text", { x: cx, y: ORIGIN3 + 22, fill: "#fff", fontSize: Math.min(17, colW / 5), fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: r.name.toUpperCase() }),
|
|
1189
|
+
/* @__PURE__ */ jsx14("g", { strokeWidth: "2.5", strokeLinecap: "round", children: [0, 0.25, 0.5, 0.75, 1].map((f) => /* @__PURE__ */ jsx14(
|
|
773
1190
|
"path",
|
|
774
1191
|
{
|
|
775
1192
|
d: `M ${tickX - 7} ${BAR_BOTTOM - f * BAR_H} h 7`,
|
|
@@ -777,9 +1194,9 @@ function FuelIndicator({
|
|
|
777
1194
|
},
|
|
778
1195
|
f
|
|
779
1196
|
)) }),
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
1197
|
+
/* @__PURE__ */ jsx14("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: "#15181c" }),
|
|
1198
|
+
/* @__PURE__ */ jsx14("g", { "data-testid": `fuel-bar-${i}`, style: motionStyle(`scaleY(${r.fraction})`, duration, cx, BAR_BOTTOM), children: /* @__PURE__ */ jsx14("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: color }) }),
|
|
1199
|
+
/* @__PURE__ */ jsx14(
|
|
783
1200
|
"text",
|
|
784
1201
|
{
|
|
785
1202
|
"data-testid": `fuel-value-${i}`,
|
|
@@ -794,23 +1211,23 @@ function FuelIndicator({
|
|
|
794
1211
|
children: r.text
|
|
795
1212
|
}
|
|
796
1213
|
),
|
|
797
|
-
/* @__PURE__ */
|
|
1214
|
+
/* @__PURE__ */ jsx14("text", { x: cx, y: BAR_BOTTOM + 44, fill: "#fff", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: unit })
|
|
798
1215
|
] }, i);
|
|
799
1216
|
}),
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
1217
|
+
/* @__PURE__ */ jsx14("path", { d: `M ${ORIGIN3 + 8} ${FOOTER_Y} H ${ORIGIN3 + SIDE3 - 8}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1218
|
+
/* @__PURE__ */ jsx14("text", { x: CENTER, y: FOOTER_Y + 19, fill: "#fff", fontSize: "24", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: label2.toUpperCase() })
|
|
802
1219
|
] });
|
|
803
1220
|
}
|
|
804
1221
|
|
|
805
1222
|
// src/components/EngineIndicator.tsx
|
|
806
|
-
import { jsx as
|
|
1223
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
807
1224
|
var MAX_CYLINDERS = 6;
|
|
808
1225
|
var MAX_BAR_GAUGES = 4;
|
|
809
1226
|
var GREEN3 = "#5fe04a";
|
|
810
1227
|
var YELLOW = "#ffd400";
|
|
811
1228
|
var RED2 = "#ff3030";
|
|
812
1229
|
var BLUE = "#4fb7e8";
|
|
813
|
-
var
|
|
1230
|
+
var LABEL2 = "#b9c8e6";
|
|
814
1231
|
var LINE = "#8a8f99";
|
|
815
1232
|
var round2 = (n) => Math.round(n * 100) / 100;
|
|
816
1233
|
var DIAL_R = 182;
|
|
@@ -859,24 +1276,24 @@ function arcAt(cx, cy, r, a0, a1) {
|
|
|
859
1276
|
const [x1, y1] = polar(r, a1, cx, cy);
|
|
860
1277
|
return `M ${x0} ${y0} A ${r} ${r} 0 ${a1 - a0 > 180 ? 1 : 0} 1 ${x1} ${y1}`;
|
|
861
1278
|
}
|
|
862
|
-
function ArcGauge({ cx, label, g, duration, testId }) {
|
|
1279
|
+
function ArcGauge({ cx, label: label2, g, duration, testId }) {
|
|
863
1280
|
const span = g.max - g.min;
|
|
864
1281
|
const angle = (v) => round2(-ARC_SWEEP + 2 * ARC_SWEEP * clamp((v - g.min) / span, 0, 1));
|
|
865
|
-
const band = (from, to, color) => /* @__PURE__ */
|
|
1282
|
+
const band = (from, to, color) => /* @__PURE__ */ jsx15("path", { d: arcAt(cx, ARC_Y, ARC_R, angle(from), angle(to)), stroke: color, strokeWidth: "6", fill: "none" });
|
|
866
1283
|
const [tipX, tipY] = polar(ARC_R - 4, 0, cx, ARC_Y);
|
|
867
1284
|
const [lx, ly] = polar(ARC_R - 16, -7, cx, ARC_Y);
|
|
868
1285
|
const [rx, ry] = polar(ARC_R - 16, 7, cx, ARC_Y);
|
|
869
|
-
return /* @__PURE__ */
|
|
870
|
-
/* @__PURE__ */
|
|
1286
|
+
return /* @__PURE__ */ jsxs15("g", { children: [
|
|
1287
|
+
/* @__PURE__ */ jsx15("path", { d: arcAt(cx, ARC_Y, ARC_R, -ARC_SWEEP, ARC_SWEEP), stroke: "#fff", strokeWidth: "1.5", fill: "none" }),
|
|
871
1288
|
g.green && band(g.green[0], g.green[1], GREEN3),
|
|
872
1289
|
g.yellow && band(g.yellow[0], g.yellow[1], YELLOW),
|
|
873
1290
|
g.low !== void 0 && band(g.min, g.low, RED2),
|
|
874
1291
|
g.high !== void 0 && band(g.high, g.max, RED2),
|
|
875
|
-
/* @__PURE__ */
|
|
876
|
-
/* @__PURE__ */
|
|
877
|
-
/* @__PURE__ */
|
|
1292
|
+
/* @__PURE__ */ jsx15("g", { "data-testid": testId, style: motionStyle(`rotate(${angle(g.value)}deg)`, duration, cx, ARC_Y), children: /* @__PURE__ */ jsx15("path", { d: `M ${tipX} ${tipY} L ${lx} ${ly} L ${rx} ${ry} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1293
|
+
/* @__PURE__ */ jsx15("text", { x: cx, y: ARC_Y - 20, fill: LABEL2, fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 }),
|
|
1294
|
+
/* @__PURE__ */ jsxs15("text", { x: cx, y: ARC_Y + 4, fill: g.color, fontSize: "28", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
878
1295
|
g.text,
|
|
879
|
-
g.unit && /* @__PURE__ */
|
|
1296
|
+
g.unit && /* @__PURE__ */ jsx15("tspan", { fontSize: "11", dx: "2", children: g.unit })
|
|
880
1297
|
] })
|
|
881
1298
|
] });
|
|
882
1299
|
}
|
|
@@ -884,30 +1301,30 @@ var BAR_X0 = 210;
|
|
|
884
1301
|
var BAR_X1 = 296;
|
|
885
1302
|
var BAR_ROW_H = 39;
|
|
886
1303
|
var BAR_TOP2 = 137;
|
|
887
|
-
function BarGauge({ top, g, label, duration, testId }) {
|
|
1304
|
+
function BarGauge({ top, g, label: label2, duration, testId }) {
|
|
888
1305
|
const y = top + 14;
|
|
889
1306
|
const at = (v) => round2(BAR_X0 + (BAR_X1 - BAR_X0) * clamp((v - g.min) / (g.max - g.min), 0, 1));
|
|
890
|
-
const seg = (from, to, color, w = 7) => /* @__PURE__ */
|
|
891
|
-
return /* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
1307
|
+
const seg = (from, to, color, w = 7) => /* @__PURE__ */ jsx15("path", { d: `M ${at(from)} ${y} H ${at(to)}`, stroke: color, strokeWidth: w });
|
|
1308
|
+
return /* @__PURE__ */ jsxs15("g", { children: [
|
|
1309
|
+
/* @__PURE__ */ jsx15("path", { d: `M ${BAR_X0} ${y} H ${BAR_X1}`, stroke: "#fff", strokeWidth: "2" }),
|
|
1310
|
+
/* @__PURE__ */ jsx15("path", { d: `M ${BAR_X0} ${y - 4} v 8 M ${BAR_X1} ${y - 4} v 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
894
1311
|
g.green && seg(g.green[0], g.green[1], GREEN3),
|
|
895
1312
|
g.yellow && seg(g.yellow[0], g.yellow[1], YELLOW),
|
|
896
1313
|
g.low !== void 0 && seg(g.min, g.low, RED2),
|
|
897
1314
|
g.high !== void 0 && seg(g.high, g.max, RED2),
|
|
898
|
-
/* @__PURE__ */
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
/* @__PURE__ */
|
|
901
|
-
g.unit && /* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ jsx15("g", { "data-testid": testId, style: motionStyle(`translate(${round2(at(g.value) - BAR_X0)}px, 0px)`, duration), children: /* @__PURE__ */ jsx15("path", { d: `M ${BAR_X0} ${y - 3} l -5 -9 h 10 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1316
|
+
/* @__PURE__ */ jsx15("text", { x: BAR_X0, y: top + 31, fill: LABEL2, fontSize: "13", fontWeight: "bold", dominantBaseline: "central", children: label2 }),
|
|
1317
|
+
/* @__PURE__ */ jsx15("text", { x: 350, y: top + 15, fill: g.color, fontSize: "20", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.text }),
|
|
1318
|
+
g.unit && /* @__PURE__ */ jsx15("text", { x: 350, y: top + 31, fill: LABEL2, fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.unit })
|
|
902
1319
|
] });
|
|
903
1320
|
}
|
|
904
1321
|
function Tank({ x, fraction, duration, testId }) {
|
|
905
1322
|
const top = 304;
|
|
906
1323
|
const h = 40;
|
|
907
|
-
return /* @__PURE__ */
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
/* @__PURE__ */
|
|
910
|
-
/* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ jsxs15("g", { children: [
|
|
1325
|
+
/* @__PURE__ */ jsx15("rect", { x: x - 7, y: top, width: "14", height: h, rx: "3", fill: "#000", stroke: "#fff", strokeWidth: "1.5" }),
|
|
1326
|
+
/* @__PURE__ */ jsx15("g", { "data-testid": testId, style: motionStyle(`scaleY(${fraction})`, duration, x, top + h - 2), children: /* @__PURE__ */ jsx15("rect", { x: x - 5.5, y: top + 2, width: "11", height: h - 4, fill: BLUE }) }),
|
|
1327
|
+
/* @__PURE__ */ jsx15("rect", { x: x - 5.5, y: top + h - 5, width: "11", height: "3", fill: RED2 })
|
|
911
1328
|
] });
|
|
912
1329
|
}
|
|
913
1330
|
var hottest = (values) => {
|
|
@@ -963,7 +1380,7 @@ function EngineIndicator({
|
|
|
963
1380
|
{ name: "EGT", value: egtMax, color: BLUE, x: 118 },
|
|
964
1381
|
{ name: "TIT", value: hasTit ? tit : void 0, color: "#fff", x: 170 }
|
|
965
1382
|
].filter((r) => r.value !== void 0);
|
|
966
|
-
const
|
|
1383
|
+
const label2 = "Engine: " + [
|
|
967
1384
|
power !== void 0 ? `power ${fmt(power)}%` : null,
|
|
968
1385
|
`MAN ${man.text}${man.unit ? ` ${man.unit}` : ""}`,
|
|
969
1386
|
`RPM ${speed.text}`,
|
|
@@ -975,79 +1392,79 @@ function EngineIndicator({
|
|
|
975
1392
|
fuelLeft !== void 0 || fuelRight !== void 0 ? `fuel ${fmt(fuelLeft)}/${fmt(fuelRight)} ${fuelUnit}` : null,
|
|
976
1393
|
volts !== void 0 ? `${fmt(volts, 1)} V` : null
|
|
977
1394
|
].filter(Boolean).join(", ");
|
|
978
|
-
return /* @__PURE__ */
|
|
979
|
-
power !== void 0 && /* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
1395
|
+
return /* @__PURE__ */ jsxs15(InstrumentFrame, { ...props, label: label2, children: [
|
|
1396
|
+
power !== void 0 && /* @__PURE__ */ jsxs15("text", { x: CENTER, y: 44, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1397
|
+
/* @__PURE__ */ jsxs15("tspan", { fill: LABEL2, fontSize: "11", children: [
|
|
981
1398
|
"POWER",
|
|
982
1399
|
" "
|
|
983
1400
|
] }),
|
|
984
1401
|
fmt(power),
|
|
985
|
-
/* @__PURE__ */
|
|
1402
|
+
/* @__PURE__ */ jsx15("tspan", { fontSize: "11", children: "%" })
|
|
986
1403
|
] }),
|
|
987
|
-
/* @__PURE__ */
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
993
|
-
/* @__PURE__ */
|
|
1404
|
+
/* @__PURE__ */ jsx15(ArcGauge, { cx: 118, label: "MAN", g: man, duration, testId: "engine-man" }),
|
|
1405
|
+
/* @__PURE__ */ jsx15(ArcGauge, { cx: 282, label: "RPM", g: speed, duration, testId: "engine-rpm" }),
|
|
1406
|
+
/* @__PURE__ */ jsxs15("g", { stroke: LINE, strokeWidth: "1.5", children: [
|
|
1407
|
+
/* @__PURE__ */ jsx15("path", { d: chord(133) }),
|
|
1408
|
+
/* @__PURE__ */ jsx15("path", { d: "M 200 133 V 298" }),
|
|
1409
|
+
/* @__PURE__ */ jsx15("path", { d: chord(298) }),
|
|
1410
|
+
/* @__PURE__ */ jsx15("path", { d: "M 136 298 V 348 M 264 298 V 348" })
|
|
994
1411
|
] }),
|
|
995
|
-
/* @__PURE__ */
|
|
996
|
-
/* @__PURE__ */
|
|
1412
|
+
/* @__PURE__ */ jsx15("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: readouts.map((r) => /* @__PURE__ */ jsxs15("g", { children: [
|
|
1413
|
+
/* @__PURE__ */ jsxs15("text", { x: r.x, y: 144, fill: LABEL2, fontSize: "13", children: [
|
|
997
1414
|
r.name,
|
|
998
|
-
/* @__PURE__ */
|
|
1415
|
+
/* @__PURE__ */ jsx15("tspan", { fontSize: "9", children: temperatureUnit })
|
|
999
1416
|
] }),
|
|
1000
|
-
/* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ jsx15("text", { "data-testid": `engine-${r.name.toLowerCase()}`, x: r.x, y: 165, fill: r.color, fontSize: "22", children: fmt(r.value) })
|
|
1001
1418
|
] }, r.name)) }),
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
columns > 0 && /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1419
|
+
/* @__PURE__ */ jsx15("path", { d: "M 40 178 H 190", stroke: LINE, strokeWidth: "1" }),
|
|
1420
|
+
columns > 0 && /* @__PURE__ */ jsxs15("g", { children: [
|
|
1421
|
+
/* @__PURE__ */ jsx15("path", { d: `M ${chartX0} ${limitY} H ${chartX1}`, stroke: RED2, strokeWidth: "1.5", strokeDasharray: "5 4" }),
|
|
1422
|
+
/* @__PURE__ */ jsx15("text", { x: chartX0 - 4, y: limitY, fill: "#fff", fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: "CHT" }),
|
|
1006
1423
|
Array.from({ length: cylinders }, (_, i) => {
|
|
1007
1424
|
const x0 = chartX0 + colW * i;
|
|
1008
1425
|
const mid = x0 + colW / 2;
|
|
1009
1426
|
const c = chtValues[i];
|
|
1010
1427
|
const e = egtValues[i];
|
|
1011
|
-
return /* @__PURE__ */
|
|
1012
|
-
c !== void 0 && /* @__PURE__ */
|
|
1013
|
-
e !== void 0 && /* @__PURE__ */
|
|
1014
|
-
/* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ jsxs15("g", { children: [
|
|
1429
|
+
c !== void 0 && /* @__PURE__ */ jsx15("g", { "data-testid": `engine-cht-${i}`, style: motionStyle(`scaleY(${chtFrac(c)})`, duration, mid, chartBase), children: /* @__PURE__ */ jsx15("rect", { x: mid - barW - 1, y: chartBase - chartH, width: barW, height: chartH, fill: GREEN3 }) }),
|
|
1430
|
+
e !== void 0 && /* @__PURE__ */ jsx15("g", { "data-testid": `engine-egt-${i}`, style: motionStyle(`scaleY(${egtFrac(e)})`, duration, mid, chartBase), children: /* @__PURE__ */ jsx15("rect", { x: mid + 1, y: chartBase - chartH, width: barW, height: chartH, fill: BLUE }) }),
|
|
1431
|
+
/* @__PURE__ */ jsx15("text", { x: mid, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: i + 1 })
|
|
1015
1432
|
] }, i);
|
|
1016
1433
|
}),
|
|
1017
|
-
hasTit && /* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
/* @__PURE__ */
|
|
1434
|
+
hasTit && /* @__PURE__ */ jsxs15("g", { children: [
|
|
1435
|
+
/* @__PURE__ */ jsx15("g", { "data-testid": "engine-tit-bar", style: motionStyle(`scaleY(${egtFrac(tit)})`, duration, chartX1 - colW / 2, chartBase), children: /* @__PURE__ */ jsx15("rect", { x: chartX1 - colW / 2 - barW / 2, y: chartBase - chartH, width: barW, height: chartH, fill: "#fff" }) }),
|
|
1436
|
+
/* @__PURE__ */ jsx15("text", { x: chartX1 - colW / 2, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "T" })
|
|
1020
1437
|
] })
|
|
1021
1438
|
] }),
|
|
1022
|
-
bars.map((b, i) => /* @__PURE__ */
|
|
1023
|
-
i > 0 && /* @__PURE__ */
|
|
1024
|
-
/* @__PURE__ */
|
|
1439
|
+
bars.map((b, i) => /* @__PURE__ */ jsxs15("g", { children: [
|
|
1440
|
+
i > 0 && /* @__PURE__ */ jsx15("path", { d: `M 206 ${BAR_TOP2 + BAR_ROW_H * i - 2} H 352`, stroke: LINE, strokeWidth: "1" }),
|
|
1441
|
+
/* @__PURE__ */ jsx15(BarGauge, { top: BAR_TOP2 + BAR_ROW_H * i, g: b.g, label: b.label, duration, testId: `engine-bar-${i}` })
|
|
1025
1442
|
] }, b.label)),
|
|
1026
|
-
/* @__PURE__ */
|
|
1027
|
-
/* @__PURE__ */
|
|
1443
|
+
/* @__PURE__ */ jsxs15("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1444
|
+
/* @__PURE__ */ jsxs15("text", { "data-testid": "engine-amps", x: 104, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1028
1445
|
fmt(amps),
|
|
1029
|
-
/* @__PURE__ */
|
|
1446
|
+
/* @__PURE__ */ jsx15("tspan", { fontSize: "11", dx: "2", children: "A" })
|
|
1030
1447
|
] }),
|
|
1031
|
-
/* @__PURE__ */
|
|
1032
|
-
/* @__PURE__ */
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
1448
|
+
/* @__PURE__ */ jsx15("text", { x: 104, y: 338, fill: LABEL2, fontSize: "13", children: "ALT" }),
|
|
1449
|
+
/* @__PURE__ */ jsx15(Tank, { x: 152, fraction: left / cap, duration, testId: "engine-fuel-left" }),
|
|
1450
|
+
/* @__PURE__ */ jsx15(Tank, { x: 248, fraction: right / cap, duration, testId: "engine-fuel-right" }),
|
|
1451
|
+
/* @__PURE__ */ jsxs15("text", { "data-testid": "engine-fuel", x: 200, y: 316, fill: "#fff", fontSize: "20", children: [
|
|
1035
1452
|
fmt(left),
|
|
1036
|
-
/* @__PURE__ */
|
|
1453
|
+
/* @__PURE__ */ jsx15("tspan", { dx: "14", children: fmt(right) })
|
|
1037
1454
|
] }),
|
|
1038
|
-
/* @__PURE__ */
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
1455
|
+
/* @__PURE__ */ jsx15("text", { x: 200, y: 335, fill: LABEL2, fontSize: "13", children: "Fuel" }),
|
|
1456
|
+
/* @__PURE__ */ jsx15("text", { x: 200, y: 348, fill: LABEL2, fontSize: "9", children: fuelUnit }),
|
|
1457
|
+
/* @__PURE__ */ jsxs15("text", { "data-testid": "engine-volts", x: 296, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1041
1458
|
fmt(volts, 1),
|
|
1042
|
-
/* @__PURE__ */
|
|
1459
|
+
/* @__PURE__ */ jsx15("tspan", { fontSize: "11", dx: "2", children: "V" })
|
|
1043
1460
|
] }),
|
|
1044
|
-
/* @__PURE__ */
|
|
1461
|
+
/* @__PURE__ */ jsx15("text", { x: 296, y: 338, fill: LABEL2, fontSize: "13", children: "BATT" })
|
|
1045
1462
|
] })
|
|
1046
1463
|
] });
|
|
1047
1464
|
}
|
|
1048
1465
|
|
|
1049
1466
|
// src/components/FlapIndicator.tsx
|
|
1050
|
-
import { jsx as
|
|
1467
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1051
1468
|
var GREEN4 = "#3ddc3d";
|
|
1052
1469
|
var YELLOW2 = "#ffd400";
|
|
1053
1470
|
var ORANGE = "#ff8a00";
|
|
@@ -1070,7 +1487,7 @@ function FlapIndicator({
|
|
|
1070
1487
|
segments = 20,
|
|
1071
1488
|
speedLimits,
|
|
1072
1489
|
airspeed,
|
|
1073
|
-
label = "WING FLAP",
|
|
1490
|
+
label: label2 = "WING FLAP",
|
|
1074
1491
|
...props
|
|
1075
1492
|
}) {
|
|
1076
1493
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
@@ -1085,13 +1502,13 @@ function FlapIndicator({
|
|
|
1085
1502
|
const ias = finite(airspeed, NaN);
|
|
1086
1503
|
const overspeed = limit !== void 0 && !Number.isNaN(ias) && ias > limit.speed;
|
|
1087
1504
|
const segH = BAR_H2 / count;
|
|
1088
|
-
const title = `${
|
|
1089
|
-
return /* @__PURE__ */
|
|
1090
|
-
/* @__PURE__ */
|
|
1505
|
+
const title = `${label2}: ${Math.round(position)}\xB0 of ${Math.round(full)}\xB0` + (limit ? `, max ${Math.round(limit.speed)} knots${overspeed ? " (overspeed)" : ""}` : "");
|
|
1506
|
+
return /* @__PURE__ */ jsxs16(InstrumentFrame, { ...props, label: title, children: [
|
|
1507
|
+
/* @__PURE__ */ jsx16("rect", { x: BAR_X - BAR_W / 2 - 4, y: BAR_TOP3 - 4, width: BAR_W + 8, height: BAR_H2 + 8, rx: "4", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
|
|
1091
1508
|
Array.from({ length: count }, (_, i) => {
|
|
1092
1509
|
const y = BAR_TOP3 + i * segH;
|
|
1093
1510
|
const on = i < lit;
|
|
1094
|
-
return /* @__PURE__ */
|
|
1511
|
+
return /* @__PURE__ */ jsx16(
|
|
1095
1512
|
"rect",
|
|
1096
1513
|
{
|
|
1097
1514
|
"data-testid": `flap-segment-${i}`,
|
|
@@ -1108,26 +1525,26 @@ function FlapIndicator({
|
|
|
1108
1525
|
i
|
|
1109
1526
|
);
|
|
1110
1527
|
}),
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
1528
|
+
/* @__PURE__ */ jsx16("g", { fill: "#fff", fontSize: "18", fontWeight: "bold", dominantBaseline: "central", children: scale.map((d) => /* @__PURE__ */ jsxs16("g", { children: [
|
|
1529
|
+
/* @__PURE__ */ jsx16("path", { d: `M ${BAR_X + BAR_W / 2 + 8} ${yAt(d)} h 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
1530
|
+
/* @__PURE__ */ jsx16("text", { x: BAR_X + BAR_W / 2 + 22, y: yAt(d), children: d })
|
|
1114
1531
|
] }, d)) }),
|
|
1115
|
-
/* @__PURE__ */
|
|
1116
|
-
limit && /* @__PURE__ */
|
|
1117
|
-
/* @__PURE__ */
|
|
1532
|
+
/* @__PURE__ */ jsx16("g", { "data-testid": "flap-pointer", style: motionStyle(`translate(0px, ${yAt(position) - BAR_TOP3}px)`, duration), children: /* @__PURE__ */ jsx16("path", { d: `M ${BAR_X - BAR_W / 2 - 8} ${BAR_TOP3} l -14 -8 v 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1533
|
+
limit && /* @__PURE__ */ jsxs16("g", { textAnchor: "middle", dominantBaseline: "central", fill: overspeed ? RED3 : "#fff", children: [
|
|
1534
|
+
/* @__PURE__ */ jsxs16("text", { "data-testid": "flap-speed", x: 118, y: 176, fontSize: "36", fontWeight: "bold", children: [
|
|
1118
1535
|
Math.round(limit.speed),
|
|
1119
|
-
/* @__PURE__ */
|
|
1536
|
+
/* @__PURE__ */ jsx16("tspan", { fontSize: "13", dx: "3", children: "KTS" })
|
|
1120
1537
|
] }),
|
|
1121
|
-
/* @__PURE__ */
|
|
1538
|
+
/* @__PURE__ */ jsx16("text", { x: 118, y: 212, fontSize: "13", fontWeight: "bold", fill: "#bbb", letterSpacing: "2", children: "MAX" })
|
|
1122
1539
|
] }),
|
|
1123
|
-
/* @__PURE__ */
|
|
1540
|
+
/* @__PURE__ */ jsx16("text", { x: CENTER, y: 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1124
1541
|
] });
|
|
1125
1542
|
}
|
|
1126
1543
|
|
|
1127
1544
|
// src/components/AoaIndicator.tsx
|
|
1128
|
-
import { Fragment as
|
|
1545
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1129
1546
|
var GREEN5 = "#3ddc3d";
|
|
1130
|
-
var
|
|
1547
|
+
var AMBER4 = "#ffb000";
|
|
1131
1548
|
var RED4 = "#ff2a2a";
|
|
1132
1549
|
var UNLIT_OPACITY = 0.15;
|
|
1133
1550
|
var ROWS = [
|
|
@@ -1136,10 +1553,10 @@ var ROWS = [
|
|
|
1136
1553
|
{ shape: "bar", color: GREEN5, y: 256 },
|
|
1137
1554
|
{ shape: "bar", color: GREEN5, y: 234 },
|
|
1138
1555
|
{ shape: "donut", color: GREEN5, y: 208 },
|
|
1139
|
-
{ shape: "bar", color:
|
|
1140
|
-
{ shape: "split", color:
|
|
1141
|
-
{ shape: "chevron", color:
|
|
1142
|
-
{ shape: "chevron", color:
|
|
1556
|
+
{ shape: "bar", color: AMBER4, y: 182 },
|
|
1557
|
+
{ shape: "split", color: AMBER4, y: 160 },
|
|
1558
|
+
{ shape: "chevron", color: AMBER4, y: 125 },
|
|
1559
|
+
{ shape: "chevron", color: AMBER4, y: 103 },
|
|
1143
1560
|
{ shape: "chevron", color: RED4, y: 74 },
|
|
1144
1561
|
{ shape: "chevron", color: RED4, y: 52 }
|
|
1145
1562
|
];
|
|
@@ -1153,23 +1570,23 @@ function RowShape({ shape, y }) {
|
|
|
1153
1570
|
const r = CENTER + HALF;
|
|
1154
1571
|
switch (shape) {
|
|
1155
1572
|
case "bar":
|
|
1156
|
-
return /* @__PURE__ */
|
|
1573
|
+
return /* @__PURE__ */ jsx17("rect", { x: l, y: y - BAR_H3 / 2, width: HALF * 2, height: BAR_H3, rx: "2" });
|
|
1157
1574
|
case "split":
|
|
1158
|
-
return /* @__PURE__ */
|
|
1159
|
-
/* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1575
|
+
return /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
1576
|
+
/* @__PURE__ */ jsx17("rect", { x: l, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" }),
|
|
1577
|
+
/* @__PURE__ */ jsx17("rect", { x: r - 50, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" })
|
|
1161
1578
|
] });
|
|
1162
1579
|
case "donut":
|
|
1163
|
-
return /* @__PURE__ */
|
|
1164
|
-
/* @__PURE__ */
|
|
1165
|
-
/* @__PURE__ */
|
|
1166
|
-
/* @__PURE__ */
|
|
1580
|
+
return /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
1581
|
+
/* @__PURE__ */ jsx17("rect", { x: l, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
1582
|
+
/* @__PURE__ */ jsx17("rect", { x: CENTER + 24, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
1583
|
+
/* @__PURE__ */ jsx17("circle", { cx: CENTER, cy: y, r: 13, fill: "none", strokeWidth: "7" })
|
|
1167
1584
|
] });
|
|
1168
1585
|
case "chevron":
|
|
1169
|
-
return /* @__PURE__ */
|
|
1586
|
+
return /* @__PURE__ */ jsx17("path", { d: `M ${l} ${y} L ${CENTER} ${y + CHEVRON_DEPTH} L ${r} ${y}`, fill: "none", strokeWidth: "11", strokeLinejoin: "miter" });
|
|
1170
1587
|
}
|
|
1171
1588
|
}
|
|
1172
|
-
function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label = "AOA", ...props }) {
|
|
1589
|
+
function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label: label2 = "AOA", ...props }) {
|
|
1173
1590
|
const lo = finite(min, 0);
|
|
1174
1591
|
const hi = Math.max(lo + 1e-6, finite(max, 20));
|
|
1175
1592
|
const opt = clamp(finite(optimum, (lo + hi) / 2), lo, hi);
|
|
@@ -1179,12 +1596,12 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1179
1596
|
const stall = lit === ROWS.length;
|
|
1180
1597
|
const reading = Number.isNaN(value) ? "---" : `${value.toFixed(1)}\xB0`;
|
|
1181
1598
|
const state = stall ? " (stall warning)" : lit > DONUT + 1 ? " (high)" : lit === DONUT + 1 ? " (optimum)" : "";
|
|
1182
|
-
const title = `${
|
|
1183
|
-
return /* @__PURE__ */
|
|
1184
|
-
/* @__PURE__ */
|
|
1599
|
+
const title = `${label2}: ${reading}${Number.isNaN(value) ? "" : state}`;
|
|
1600
|
+
return /* @__PURE__ */ jsxs17(InstrumentFrame, { ...props, label: title, children: [
|
|
1601
|
+
/* @__PURE__ */ jsx17("rect", { x: CENTER - HALF - 10, y: 40, width: (HALF + 10) * 2, height: 278, rx: "10", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
|
|
1185
1602
|
ROWS.map((row, i) => {
|
|
1186
1603
|
const on = i < lit;
|
|
1187
|
-
return /* @__PURE__ */
|
|
1604
|
+
return /* @__PURE__ */ jsxs17(
|
|
1188
1605
|
"g",
|
|
1189
1606
|
{
|
|
1190
1607
|
"data-testid": `aoa-row-${i}`,
|
|
@@ -1195,18 +1612,19 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1195
1612
|
opacity: on ? 1 : UNLIT_OPACITY,
|
|
1196
1613
|
style: { transition: "opacity 150ms ease-out" },
|
|
1197
1614
|
children: [
|
|
1198
|
-
/* @__PURE__ */
|
|
1199
|
-
on && stall && row.shape === "chevron" && /* @__PURE__ */
|
|
1615
|
+
/* @__PURE__ */ jsx17(RowShape, { shape: row.shape, y: row.y }),
|
|
1616
|
+
on && stall && row.shape === "chevron" && /* @__PURE__ */ jsx17("animate", { attributeName: "opacity", values: "1;0.25;1", dur: "0.6s", repeatCount: "indefinite" })
|
|
1200
1617
|
]
|
|
1201
1618
|
},
|
|
1202
1619
|
i
|
|
1203
1620
|
);
|
|
1204
1621
|
}),
|
|
1205
|
-
showValue && /* @__PURE__ */
|
|
1206
|
-
/* @__PURE__ */
|
|
1622
|
+
showValue && /* @__PURE__ */ jsx17("text", { "data-testid": "aoa-value", x: CENTER, y: 340, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", children: reading }),
|
|
1623
|
+
/* @__PURE__ */ jsx17("text", { x: CENTER, y: showValue ? 362 : 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1207
1624
|
] });
|
|
1208
1625
|
}
|
|
1209
1626
|
export {
|
|
1627
|
+
AdfIndicator,
|
|
1210
1628
|
Airspeed,
|
|
1211
1629
|
Altimeter,
|
|
1212
1630
|
AoaIndicator,
|
|
@@ -1223,11 +1641,19 @@ export {
|
|
|
1223
1641
|
MAX_CYLINDERS,
|
|
1224
1642
|
MAX_FIELDS,
|
|
1225
1643
|
MAX_TANKS,
|
|
1644
|
+
RadioPanel,
|
|
1645
|
+
RadioStack,
|
|
1226
1646
|
TurnCoordinator,
|
|
1227
1647
|
VerticalSpeed,
|
|
1228
1648
|
VorIndicator,
|
|
1229
1649
|
WindIndicator,
|
|
1650
|
+
formatAdf,
|
|
1651
|
+
formatDme,
|
|
1652
|
+
formatNav,
|
|
1230
1653
|
formatValue,
|
|
1654
|
+
parseAdf,
|
|
1655
|
+
parseNav,
|
|
1656
|
+
relativeBearing,
|
|
1231
1657
|
vorDeviation
|
|
1232
1658
|
};
|
|
1233
1659
|
//# sourceMappingURL=index.js.map
|