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.cjs
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
var index_exports = {};
|
|
23
23
|
__export(index_exports, {
|
|
24
|
+
AdfIndicator: () => AdfIndicator,
|
|
24
25
|
Airspeed: () => Airspeed,
|
|
25
26
|
Altimeter: () => Altimeter,
|
|
26
27
|
AoaIndicator: () => AoaIndicator,
|
|
@@ -37,11 +38,19 @@ __export(index_exports, {
|
|
|
37
38
|
MAX_CYLINDERS: () => MAX_CYLINDERS,
|
|
38
39
|
MAX_FIELDS: () => MAX_FIELDS,
|
|
39
40
|
MAX_TANKS: () => MAX_TANKS,
|
|
41
|
+
RadioPanel: () => RadioPanel,
|
|
42
|
+
RadioStack: () => RadioStack,
|
|
40
43
|
TurnCoordinator: () => TurnCoordinator,
|
|
41
44
|
VerticalSpeed: () => VerticalSpeed,
|
|
42
45
|
VorIndicator: () => VorIndicator,
|
|
43
46
|
WindIndicator: () => WindIndicator,
|
|
47
|
+
formatAdf: () => formatAdf,
|
|
48
|
+
formatDme: () => formatDme,
|
|
49
|
+
formatNav: () => formatNav,
|
|
44
50
|
formatValue: () => formatValue,
|
|
51
|
+
parseAdf: () => parseAdf,
|
|
52
|
+
parseNav: () => parseNav,
|
|
53
|
+
relativeBearing: () => relativeBearing,
|
|
45
54
|
vorDeviation: () => vorDeviation
|
|
46
55
|
});
|
|
47
56
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -112,7 +121,7 @@ function InstrumentFrame({
|
|
|
112
121
|
className,
|
|
113
122
|
style,
|
|
114
123
|
title,
|
|
115
|
-
label,
|
|
124
|
+
label: label2,
|
|
116
125
|
children
|
|
117
126
|
}) {
|
|
118
127
|
const titleId = useSvgId("fi-title");
|
|
@@ -130,7 +139,7 @@ function InstrumentFrame({
|
|
|
130
139
|
style: { display: "inline-block", userSelect: "none", ...style },
|
|
131
140
|
fontFamily: "'Helvetica Neue', Arial, sans-serif",
|
|
132
141
|
children: [
|
|
133
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", { id: titleId, children: title ??
|
|
142
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", { id: titleId, children: title ?? label2 }),
|
|
134
143
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id: bezelId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
135
144
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "0", stopColor: "#5a5a5a" }),
|
|
136
145
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "1", stopColor: "#1a1a1a" })
|
|
@@ -234,7 +243,7 @@ function HeadingIndicator({ heading = 0, ...props }) {
|
|
|
234
243
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
235
244
|
range(0, 330, 30).map((a) => {
|
|
236
245
|
const [x, y] = polar(132, a);
|
|
237
|
-
const
|
|
246
|
+
const label2 = CARDINALS[a] ?? String(a / 10);
|
|
238
247
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
239
248
|
"text",
|
|
240
249
|
{
|
|
@@ -246,7 +255,7 @@ function HeadingIndicator({ heading = 0, ...props }) {
|
|
|
246
255
|
fontWeight: "bold",
|
|
247
256
|
textAnchor: "middle",
|
|
248
257
|
dominantBaseline: "central",
|
|
249
|
-
children:
|
|
258
|
+
children: label2
|
|
250
259
|
},
|
|
251
260
|
a
|
|
252
261
|
);
|
|
@@ -549,8 +558,8 @@ function WindIndicator({
|
|
|
549
558
|
const dirText = String(Math.round(norm(dir)) || 360).padStart(3, "0");
|
|
550
559
|
const windText = calm ? "CALM" : `${dirText}\xB0 ${Math.round(speed)}${hasGust ? `G${Math.round(gust)}` : ""}KT`;
|
|
551
560
|
const crossText = crosswind === 0 ? "0" : `${Math.abs(crosswind)}${crosswind > 0 ? "R" : "L"}`;
|
|
552
|
-
const
|
|
553
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(InstrumentFrame, { ...props, label, children: [
|
|
561
|
+
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"}`;
|
|
562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
554
563
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 350, 10).map((a) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: tickPath(176, a % 30 === 0 ? 162 : 168, a), strokeWidth: a % 30 === 0 ? 3 : 2, opacity: a % 30 === 0 ? 1 : 0.7 }, a)) }),
|
|
555
564
|
range(0, 330, 30).map((a) => {
|
|
556
565
|
const [x, y] = polar(146, a);
|
|
@@ -614,6 +623,11 @@ var AMBER2 = "#ffb000";
|
|
|
614
623
|
var FULL_SCALE_DEG = 10;
|
|
615
624
|
var DOT_SPACING = 22;
|
|
616
625
|
var FULL_SCALE_PX = DOT_SPACING * 5;
|
|
626
|
+
var PIVOT_Y = CENTER - 100;
|
|
627
|
+
var SWING_LENGTH = 165;
|
|
628
|
+
var SWING_DOT_RADIUS = 156;
|
|
629
|
+
var SWING_DEG_PER_DOT = 7.5;
|
|
630
|
+
var SWING_FULL_SCALE_DEG = SWING_DEG_PER_DOT * 5;
|
|
617
631
|
var norm2 = (deg) => (deg % 360 + 360) % 360;
|
|
618
632
|
var signedDiff = (a, b) => ((a - b) % 360 + 540) % 360 - 180;
|
|
619
633
|
function vorDeviation(course, radial) {
|
|
@@ -639,7 +653,7 @@ function Flag({ y, up, visible, testId }) {
|
|
|
639
653
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("text", { x: CENTER + 22, y, fill: "#fff", fontSize: "15", fontWeight: "bold", dominantBaseline: "central", children: up ? "TO" : "FROM" })
|
|
640
654
|
] });
|
|
641
655
|
}
|
|
642
|
-
function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ...props }) {
|
|
656
|
+
function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, needle = "slide", ...props }) {
|
|
643
657
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
644
658
|
const crs = finite(course);
|
|
645
659
|
const computed = typeof radial === "number" && Number.isFinite(radial) ? vorDeviation(crs, radial) : void 0;
|
|
@@ -648,10 +662,12 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
648
662
|
const flag = !signal ? "OFF" : toFrom ?? computed?.toFrom ?? "OFF";
|
|
649
663
|
const displayCourse = useContinuousAngle(crs);
|
|
650
664
|
const courseText = String(Math.round(norm2(crs)) || 360).padStart(3, "0");
|
|
665
|
+
const swing = needle === "swing";
|
|
651
666
|
const needleX = dev / FULL_SCALE_DEG * FULL_SCALE_PX;
|
|
667
|
+
const needleAngle = -(dev / FULL_SCALE_DEG) * SWING_FULL_SCALE_DEG;
|
|
652
668
|
const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
|
|
653
|
-
const
|
|
654
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(InstrumentFrame, { ...props, label, children: [
|
|
669
|
+
const label2 = signal ? `VOR indicator: course ${courseText}\xB0, needle ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `VOR indicator: course ${courseText}\xB0, no signal`;
|
|
670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
655
671
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { "data-testid": "vor-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
|
|
656
672
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
657
673
|
range(0, 330, 30).map((a) => {
|
|
@@ -676,11 +692,77 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
676
692
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER2, stroke: "#000", strokeWidth: "1.5" }),
|
|
677
693
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: `M ${CENTER} ${CENTER + 150} l -8 24 h 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1.5" }),
|
|
678
694
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { stroke: AMBER2, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 225, 270, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
|
|
679
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
695
|
+
swing ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
696
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { fill: "#fff", stroke: "#000", strokeWidth: "1", children: range(1, 5, 1).flatMap((i) => [-i, i]).map((i) => {
|
|
697
|
+
const [x, y] = polar(SWING_DOT_RADIUS, 180 - i * SWING_DEG_PER_DOT, CENTER, PIVOT_Y);
|
|
698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: x, cy: y, r: "5" }, i);
|
|
699
|
+
}) }),
|
|
700
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
701
|
+
"rect",
|
|
702
|
+
{
|
|
703
|
+
x: CENTER - 6,
|
|
704
|
+
y: PIVOT_Y + SWING_DOT_RADIUS - 10,
|
|
705
|
+
width: "12",
|
|
706
|
+
height: "20",
|
|
707
|
+
rx: "2",
|
|
708
|
+
fill: "none",
|
|
709
|
+
stroke: "#fff",
|
|
710
|
+
strokeWidth: "2.5"
|
|
711
|
+
}
|
|
712
|
+
),
|
|
713
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: CENTER + 46, y: CENTER - 72, width: "46", height: "76", rx: "5", fill: "#000", stroke: "#555", strokeWidth: "2" }),
|
|
714
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { fill: "#ccc", fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("text", { x: CENTER + 69, y: CENTER - 59, children: "TO" }),
|
|
716
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("text", { x: CENTER + 69, y: CENTER - 9, children: "FR" })
|
|
717
|
+
] }),
|
|
718
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { stroke: "#000", strokeWidth: "1.5", strokeLinejoin: "round", fill: "#fff", children: [
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
720
|
+
"path",
|
|
721
|
+
{
|
|
722
|
+
"data-testid": "vor-to",
|
|
723
|
+
d: `M ${CENTER + 69} ${CENTER - 44} l 11 18 h -22 z`,
|
|
724
|
+
opacity: flag === "TO" ? 1 : 0,
|
|
725
|
+
style: { transition: "opacity 200ms ease-out" }
|
|
726
|
+
}
|
|
727
|
+
),
|
|
728
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
729
|
+
"path",
|
|
730
|
+
{
|
|
731
|
+
"data-testid": "vor-from",
|
|
732
|
+
d: `M ${CENTER + 69} ${CENTER - 22} l 11 -18 h -22 z`,
|
|
733
|
+
opacity: flag === "FROM" ? 1 : 0,
|
|
734
|
+
style: { transition: "opacity 200ms ease-out" }
|
|
735
|
+
}
|
|
736
|
+
)
|
|
737
|
+
] }),
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { "data-testid": "vor-needle", style: motionStyle(`rotate(${needleAngle}deg)`, duration, CENTER, PIVOT_Y), children: [
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
740
|
+
"path",
|
|
741
|
+
{
|
|
742
|
+
d: `M ${CENTER} ${PIVOT_Y} V ${PIVOT_Y + SWING_LENGTH}`,
|
|
743
|
+
stroke: "#000",
|
|
744
|
+
strokeWidth: "7",
|
|
745
|
+
strokeLinecap: "round"
|
|
746
|
+
}
|
|
747
|
+
),
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
749
|
+
"path",
|
|
750
|
+
{
|
|
751
|
+
d: `M ${CENTER} ${PIVOT_Y} V ${PIVOT_Y + SWING_LENGTH}`,
|
|
752
|
+
stroke: "#fff",
|
|
753
|
+
strokeWidth: "4",
|
|
754
|
+
strokeLinecap: "round"
|
|
755
|
+
}
|
|
756
|
+
)
|
|
757
|
+
] }),
|
|
758
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: CENTER, cy: PIVOT_Y, r: "6", fill: "#333", stroke: "#fff", strokeWidth: "2" })
|
|
759
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { fill: "#fff", stroke: "#000", strokeWidth: "1", children: range(1, 5, 1).flatMap((i) => [-i, i]).map((i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: CENTER + i * DOT_SPACING, cy: CENTER, r: "5" }, i)) }),
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: CENTER, cy: CENTER, r: "9", fill: "none", stroke: "#fff", strokeWidth: "2.5" }),
|
|
762
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Flag, { y: CENTER - 54, up: true, visible: flag === "TO", testId: "vor-to" }),
|
|
763
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Flag, { y: CENTER + 54, up: false, visible: flag === "FROM", testId: "vor-from" }),
|
|
764
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { "data-testid": "vor-needle", style: motionStyle(`translate(${needleX}px, 0px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: CENTER - 3, y: CENTER - 68, width: "6", height: "136", rx: "3", fill: "#fff", stroke: "#000", strokeWidth: "1.5" }) })
|
|
765
|
+
] }),
|
|
684
766
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: CENTER - 44, y: CENTER + 72, width: "88", height: "26", rx: "4", fill: "#000", stroke: "#555", strokeWidth: "2" }),
|
|
685
767
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
686
768
|
"text",
|
|
@@ -700,20 +782,364 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
700
782
|
]
|
|
701
783
|
}
|
|
702
784
|
),
|
|
703
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
786
|
+
"g",
|
|
787
|
+
{
|
|
788
|
+
"data-testid": "vor-nav-flag",
|
|
789
|
+
opacity: signal ? 0 : 1,
|
|
790
|
+
style: { transition: "opacity 200ms ease-out" },
|
|
791
|
+
transform: swing ? "translate(-64 52)" : void 0,
|
|
792
|
+
children: [
|
|
793
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: CENTER - 28, y: CENTER - 98, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("text", { x: CENTER, y: CENTER - 85, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "NAV" })
|
|
795
|
+
]
|
|
796
|
+
}
|
|
797
|
+
)
|
|
707
798
|
] });
|
|
708
799
|
}
|
|
709
800
|
|
|
710
|
-
// src/components/
|
|
801
|
+
// src/components/AdfIndicator.tsx
|
|
711
802
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
712
|
-
var
|
|
803
|
+
var CARDINALS4 = { 0: "N", 90: "E", 180: "S", 270: "W" };
|
|
804
|
+
var AMBER3 = "#ffb000";
|
|
805
|
+
var NEEDLE = "#ffe14d";
|
|
806
|
+
var PARKED_DEG = 90;
|
|
807
|
+
var norm3 = (deg) => (deg % 360 + 360) % 360;
|
|
808
|
+
var pad3 = (deg) => String(Math.round(norm3(deg)) % 360).padStart(3, "0");
|
|
809
|
+
function relativeBearing(heading, bearingToStation) {
|
|
810
|
+
return norm3(finite(bearingToStation) - finite(heading));
|
|
811
|
+
}
|
|
812
|
+
function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
813
|
+
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
814
|
+
const rel = finite(bearing);
|
|
815
|
+
const hdg = finite(heading);
|
|
816
|
+
const displayCard = useContinuousAngle(hdg);
|
|
817
|
+
const displayNeedle = useContinuousAngle(signal ? rel : PARKED_DEG);
|
|
818
|
+
const label2 = signal ? `ADF indicator: station ${pad3(rel)}\xB0 relative, bearing ${pad3(rel + hdg)}\xB0 to station` : "ADF indicator: no signal";
|
|
819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { "data-testid": "adf-card", style: motionStyle(`rotate(${-displayCard}deg)`, duration), children: [
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
822
|
+
range(0, 330, 30).map((a) => {
|
|
823
|
+
const [x, y] = polar(132, a);
|
|
824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
825
|
+
"text",
|
|
826
|
+
{
|
|
827
|
+
x,
|
|
828
|
+
y,
|
|
829
|
+
transform: `rotate(${a} ${x} ${y})`,
|
|
830
|
+
fill: a % 90 === 0 ? AMBER3 : "#fff",
|
|
831
|
+
fontSize: a % 90 === 0 ? 28 : 24,
|
|
832
|
+
fontWeight: "bold",
|
|
833
|
+
textAnchor: "middle",
|
|
834
|
+
dominantBaseline: "central",
|
|
835
|
+
children: CARDINALS4[a] ?? String(a / 10)
|
|
836
|
+
},
|
|
837
|
+
a
|
|
838
|
+
);
|
|
839
|
+
})
|
|
840
|
+
] }),
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER3, stroke: "#000", strokeWidth: "1.5" }),
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { stroke: AMBER3, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 180, 225, 270, 315].map((a) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: tickPath(192, 178, a) }, a)) }),
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { stroke: AMBER3, strokeWidth: "2", strokeLinecap: "round", opacity: "0.7", children: [
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER - 26} ${CENTER} H ${CENTER + 26}` }),
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER} ${CENTER - 26} V ${CENTER + 14}` })
|
|
846
|
+
] }),
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("text", { x: CENTER, y: CENTER + 62, fill: "#ccc", fontSize: "15", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: "ADF" }),
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { "data-testid": "adf-flag", opacity: signal ? 0 : 1, style: { transition: "opacity 200ms ease-out" }, children: [
|
|
849
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: CENTER - 28, y: CENTER - 76, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("text", { x: CENTER, y: CENTER - 63, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "ADF" })
|
|
851
|
+
] }),
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { "data-testid": "adf-needle", style: motionStyle(`rotate(${displayNeedle}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
853
|
+
"path",
|
|
854
|
+
{
|
|
855
|
+
d: `M ${CENTER} ${CENTER - 146} l -13 30 h 9 V ${CENTER + 140} h 8 V ${CENTER - 116} h 9 z`,
|
|
856
|
+
fill: NEEDLE,
|
|
857
|
+
stroke: "#000",
|
|
858
|
+
strokeWidth: "1.5",
|
|
859
|
+
strokeLinejoin: "round"
|
|
860
|
+
}
|
|
861
|
+
) }),
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Hub, { r: 10 })
|
|
863
|
+
] });
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// src/components/RadioPanel.tsx
|
|
867
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
713
868
|
var SIDE = 252;
|
|
869
|
+
var ORIGIN = CENTER - SIDE / 2;
|
|
870
|
+
var ROW_H = 60;
|
|
871
|
+
var ROW_GAP = 8;
|
|
872
|
+
var FIRST_ROW = ORIGIN + 32;
|
|
873
|
+
var LABEL_X = ORIGIN + 10;
|
|
874
|
+
var ACTIVE_X = ORIGIN + 48;
|
|
875
|
+
var DISPLAY_W = 88;
|
|
876
|
+
var STANDBY_X = ORIGIN + SIDE - 8 - DISPLAY_W;
|
|
877
|
+
var SWAP_X = (ACTIVE_X + DISPLAY_W + STANDBY_X) / 2;
|
|
878
|
+
var usable = (n) => typeof n === "number" && Number.isFinite(n) && n >= 0;
|
|
879
|
+
var formatNav = (mhz) => usable(mhz) ? mhz.toFixed(2) : "---.--";
|
|
880
|
+
var formatAdf = (khz) => usable(khz) ? Number.isInteger(khz) ? String(khz) : khz.toFixed(1) : "---";
|
|
881
|
+
var formatDme = (nm) => usable(nm) ? nm < 99.95 ? nm.toFixed(1) : nm.toFixed(0) : "--.-";
|
|
882
|
+
function Display({ x, y, width, value, color, testId, unit }) {
|
|
883
|
+
const h = ROW_H - 16;
|
|
884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { children: [
|
|
885
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x, y: y + 8, width, height: h, rx: "5", fill: "#1a0d00", stroke: "#3a2a14", strokeWidth: "1.5" }),
|
|
886
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
887
|
+
"text",
|
|
888
|
+
{
|
|
889
|
+
"data-testid": testId,
|
|
890
|
+
x: unit ? x + width - 40 : x + width / 2,
|
|
891
|
+
y: y + ROW_H / 2 + 1,
|
|
892
|
+
fill: color,
|
|
893
|
+
fontSize: unit ? 28 : 22,
|
|
894
|
+
fontFamily: "monospace",
|
|
895
|
+
fontWeight: "bold",
|
|
896
|
+
textAnchor: unit ? "end" : "middle",
|
|
897
|
+
dominantBaseline: "central",
|
|
898
|
+
children: value
|
|
899
|
+
}
|
|
900
|
+
),
|
|
901
|
+
unit && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: x + width - 10, y: y + ROW_H / 2 + 5, fill: "#9aa4b1", fontSize: "13", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: unit })
|
|
902
|
+
] });
|
|
903
|
+
}
|
|
904
|
+
function Swap({ y }) {
|
|
905
|
+
const cy = y + ROW_H / 2;
|
|
906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { stroke: "#9aa4b1", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
907
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${SWAP_X - 7} ${cy - 4} H ${SWAP_X + 7} m -4 -3 l 4 3 l -4 3` }),
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: `M ${SWAP_X + 7} ${cy + 4} H ${SWAP_X - 7} m 4 -3 l -4 3 l 4 3` })
|
|
909
|
+
] });
|
|
910
|
+
}
|
|
911
|
+
function RowLabel({ y, children }) {
|
|
912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: LABEL_X, y: y + ROW_H / 2 + 1, fill: "#ccc", fontSize: "14", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children });
|
|
913
|
+
}
|
|
914
|
+
function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
|
|
915
|
+
const rows = [
|
|
916
|
+
{ key: "nav", name: "NAV", unit: "MHz", active: formatNav(nav?.active), standby: formatNav(nav?.standby), tuned: usable(nav?.active) },
|
|
917
|
+
{ key: "adf", name: "ADF", unit: "kHz", active: formatAdf(adf?.active), standby: formatAdf(adf?.standby), tuned: usable(adf?.active) }
|
|
918
|
+
];
|
|
919
|
+
const dmeText = formatDme(dme);
|
|
920
|
+
const dmeY = FIRST_ROW + 2 * (ROW_H + ROW_GAP);
|
|
921
|
+
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"}`;
|
|
922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x: ORIGIN, y: ORIGIN, width: SIDE, height: SIDE, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { fill: "#9aa4b1", fontSize: "11", fontWeight: "bold", letterSpacing: "1.5", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
925
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: ACTIVE_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "ACTIVE" }),
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: STANDBY_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "STBY" })
|
|
927
|
+
] }),
|
|
928
|
+
rows.map((r, i) => {
|
|
929
|
+
const y = FIRST_ROW + i * (ROW_H + ROW_GAP);
|
|
930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { children: [
|
|
931
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RowLabel, { y, children: r.name }),
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Display, { x: ACTIVE_X, y, width: DISPLAY_W, value: r.active, color, testId: `radio-${r.key}-active` }),
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Swap, { y }),
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Display, { x: STANDBY_X, y, width: DISPLAY_W, value: r.standby, color, testId: `radio-${r.key}-standby` })
|
|
935
|
+
] }, r.key);
|
|
936
|
+
}),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RowLabel, { y: dmeY, children: "DME" }),
|
|
938
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Display, { x: ACTIVE_X, y: dmeY, width: STANDBY_X + DISPLAY_W - ACTIVE_X, value: dmeText, color, testId: "radio-dme", unit: "NM" })
|
|
939
|
+
] });
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// src/components/RadioStack.tsx
|
|
943
|
+
var import_react2 = require("react");
|
|
944
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
945
|
+
var parseNav = (text) => {
|
|
946
|
+
const mhz = Math.round(Number.parseFloat(text.replace(",", ".")) * 100) / 100;
|
|
947
|
+
return mhz >= 108 && mhz <= 117.95 ? mhz : void 0;
|
|
948
|
+
};
|
|
949
|
+
var parseAdf = (text) => {
|
|
950
|
+
const khz = Math.round(Number.parseFloat(text.replace(",", ".")) * 10) / 10;
|
|
951
|
+
return khz >= 190 && khz <= 1750 ? khz : void 0;
|
|
952
|
+
};
|
|
953
|
+
var MONO = "ui-monospace, 'SF Mono', Menlo, Consolas, monospace";
|
|
954
|
+
var LABEL = "#ccc";
|
|
955
|
+
var MUTED = "#9aa4b1";
|
|
956
|
+
var display = {
|
|
957
|
+
boxSizing: "border-box",
|
|
958
|
+
width: "100%",
|
|
959
|
+
minWidth: 0,
|
|
960
|
+
height: "2.1em",
|
|
961
|
+
margin: 0,
|
|
962
|
+
padding: "0 0.1em",
|
|
963
|
+
borderRadius: "0.25em",
|
|
964
|
+
border: "0.08em solid #3a2a14",
|
|
965
|
+
background: "#1a0d00",
|
|
966
|
+
fontFamily: MONO,
|
|
967
|
+
fontSize: "1.2em",
|
|
968
|
+
fontWeight: "bold",
|
|
969
|
+
lineHeight: "2em",
|
|
970
|
+
textAlign: "center",
|
|
971
|
+
whiteSpace: "nowrap",
|
|
972
|
+
overflow: "hidden"
|
|
973
|
+
};
|
|
974
|
+
var label = { display: "flex", flexDirection: "column", justifyContent: "center", color: LABEL, fontWeight: "bold", letterSpacing: "0.06em", lineHeight: 1.15 };
|
|
975
|
+
var ident = { color: "#3cc8ff", fontSize: "0.72em", fontFamily: MONO, minHeight: "1.15em" };
|
|
976
|
+
function SwapIcon() {
|
|
977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("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: [
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M2 5.5 H14 M11 2.5 l3 3 l-3 3" }),
|
|
979
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M14 10.5 H2 M5 7.5 l-3 3 l3 3" })
|
|
980
|
+
] });
|
|
981
|
+
}
|
|
982
|
+
function Receiver({ name, unit, value, ident: station, color, format, parse, onChange }) {
|
|
983
|
+
const [draft, setDraft] = (0, import_react2.useState)(null);
|
|
984
|
+
const [focused, setFocused] = (0, import_react2.useState)(false);
|
|
985
|
+
const [invalid, setInvalid] = (0, import_react2.useState)(false);
|
|
986
|
+
const key = name.toLowerCase();
|
|
987
|
+
const shown = value.standby === void 0 ? "" : format(value.standby);
|
|
988
|
+
const swap = (standby = value.standby) => onChange({ active: standby, standby: value.active });
|
|
989
|
+
const onKeyDown = (e) => {
|
|
990
|
+
if (e.key === "Escape") {
|
|
991
|
+
setDraft(null);
|
|
992
|
+
setInvalid(false);
|
|
993
|
+
}
|
|
994
|
+
if (e.key !== "Enter") return;
|
|
995
|
+
e.preventDefault();
|
|
996
|
+
const text = (draft ?? shown).trim();
|
|
997
|
+
const standby = text ? parse(text) : void 0;
|
|
998
|
+
if (text && standby === void 0) return setInvalid(true);
|
|
999
|
+
setDraft(null);
|
|
1000
|
+
setInvalid(false);
|
|
1001
|
+
swap(standby);
|
|
1002
|
+
};
|
|
1003
|
+
const onBlur = () => {
|
|
1004
|
+
setFocused(false);
|
|
1005
|
+
setInvalid(false);
|
|
1006
|
+
if (draft === null) return;
|
|
1007
|
+
const text = draft.trim();
|
|
1008
|
+
const standby = text ? parse(text) : void 0;
|
|
1009
|
+
setDraft(null);
|
|
1010
|
+
if (text && standby === void 0 || standby === value.standby) return;
|
|
1011
|
+
onChange({ active: value.active, standby });
|
|
1012
|
+
};
|
|
1013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1014
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: label, children: [
|
|
1015
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: name }),
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "data-testid": `radio-stack-${key}-ident`, style: ident, children: station ?? "" })
|
|
1017
|
+
] }),
|
|
1018
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { "data-testid": `radio-stack-${key}-active`, "aria-label": `${name} active frequency`, style: { ...display, color }, children: format(value.active) }),
|
|
1019
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1020
|
+
"button",
|
|
1021
|
+
{
|
|
1022
|
+
type: "button",
|
|
1023
|
+
onClick: () => swap(),
|
|
1024
|
+
"aria-label": `Swap ${name} active and standby`,
|
|
1025
|
+
title: "Swap active and standby",
|
|
1026
|
+
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" },
|
|
1027
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SwapIcon, {})
|
|
1028
|
+
}
|
|
1029
|
+
),
|
|
1030
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1031
|
+
"input",
|
|
1032
|
+
{
|
|
1033
|
+
type: "text",
|
|
1034
|
+
inputMode: "decimal",
|
|
1035
|
+
autoComplete: "off",
|
|
1036
|
+
spellCheck: false,
|
|
1037
|
+
"data-testid": `radio-stack-${key}-standby`,
|
|
1038
|
+
"aria-label": `${name} standby frequency (${unit})`,
|
|
1039
|
+
"aria-invalid": invalid || void 0,
|
|
1040
|
+
placeholder: format(void 0),
|
|
1041
|
+
value: draft ?? shown,
|
|
1042
|
+
onChange: (e) => {
|
|
1043
|
+
setDraft(e.target.value);
|
|
1044
|
+
setInvalid(false);
|
|
1045
|
+
},
|
|
1046
|
+
onFocus: (e) => {
|
|
1047
|
+
setFocused(true);
|
|
1048
|
+
e.target.select();
|
|
1049
|
+
},
|
|
1050
|
+
onBlur,
|
|
1051
|
+
onKeyDown,
|
|
1052
|
+
style: { ...display, color, outline: "none", borderColor: invalid ? "#ff4d4d" : focused ? color : "#3a2a14", cursor: "text" }
|
|
1053
|
+
}
|
|
1054
|
+
)
|
|
1055
|
+
] });
|
|
1056
|
+
}
|
|
1057
|
+
var SCREWS2 = [
|
|
1058
|
+
{ top: "0.3em", left: "0.3em" },
|
|
1059
|
+
{ top: "0.3em", right: "0.3em" },
|
|
1060
|
+
{ bottom: "0.3em", left: "0.3em" },
|
|
1061
|
+
{ bottom: "0.3em", right: "0.3em" }
|
|
1062
|
+
];
|
|
1063
|
+
function RadioStack({
|
|
1064
|
+
nav,
|
|
1065
|
+
adf,
|
|
1066
|
+
defaultNav,
|
|
1067
|
+
defaultAdf,
|
|
1068
|
+
onNavChange,
|
|
1069
|
+
onAdfChange,
|
|
1070
|
+
navIdent,
|
|
1071
|
+
adfIdent,
|
|
1072
|
+
dme,
|
|
1073
|
+
color = "#ff9a2e",
|
|
1074
|
+
width = 320,
|
|
1075
|
+
className,
|
|
1076
|
+
style,
|
|
1077
|
+
title = "Radio panel"
|
|
1078
|
+
}) {
|
|
1079
|
+
const [innerNav, setInnerNav] = (0, import_react2.useState)(defaultNav ?? {});
|
|
1080
|
+
const [innerAdf, setInnerAdf] = (0, import_react2.useState)(defaultAdf ?? {});
|
|
1081
|
+
const changeNav = (next) => {
|
|
1082
|
+
if (nav === void 0) setInnerNav(next);
|
|
1083
|
+
onNavChange?.(next);
|
|
1084
|
+
};
|
|
1085
|
+
const changeAdf = (next) => {
|
|
1086
|
+
if (adf === void 0) setInnerAdf(next);
|
|
1087
|
+
onAdfChange?.(next);
|
|
1088
|
+
};
|
|
1089
|
+
const heading = { color: MUTED, fontSize: "0.72em", fontWeight: "bold", letterSpacing: "0.12em", textAlign: "center" };
|
|
1090
|
+
return (
|
|
1091
|
+
// The outer box is a size container so every inner measurement can follow the width.
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className, style: { display: "inline-block", width, maxWidth: "100%", verticalAlign: "top", containerType: "inline-size", ...style }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1093
|
+
"div",
|
|
1094
|
+
{
|
|
1095
|
+
role: "group",
|
|
1096
|
+
"aria-label": title,
|
|
1097
|
+
style: {
|
|
1098
|
+
position: "relative",
|
|
1099
|
+
boxSizing: "border-box",
|
|
1100
|
+
display: "grid",
|
|
1101
|
+
gridTemplateColumns: "2.6em minmax(0, 1fr) 2.4em minmax(0, 1fr)",
|
|
1102
|
+
gap: "0.5em 0.4em",
|
|
1103
|
+
alignItems: "center",
|
|
1104
|
+
padding: "1.1em 1.2em 1.2em",
|
|
1105
|
+
borderRadius: "0.9em",
|
|
1106
|
+
border: "0.15em solid #0d0d0d",
|
|
1107
|
+
background: "#232323",
|
|
1108
|
+
color: LABEL,
|
|
1109
|
+
fontFamily: "'Helvetica Neue', Arial, sans-serif",
|
|
1110
|
+
fontSize: "5cqw",
|
|
1111
|
+
textAlign: "left",
|
|
1112
|
+
userSelect: "none"
|
|
1113
|
+
},
|
|
1114
|
+
children: [
|
|
1115
|
+
SCREWS2.map((position, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { viewBox: "-14 -14 28 28", "aria-hidden": "true", style: { position: "absolute", width: "0.75em", height: "0.75em", ...position }, children: [
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { r: "12", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M -8 3 L 8 -3", stroke: "#111", strokeWidth: "3" })
|
|
1118
|
+
] }, i)),
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", {}),
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: heading, children: "ACTIVE" }),
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", {}),
|
|
1122
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: heading, children: "STBY" }),
|
|
1123
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Receiver, { name: "NAV", unit: "MHz", value: nav ?? innerNav, ident: navIdent, color, format: formatNav, parse: parseNav, onChange: changeNav }),
|
|
1124
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Receiver, { name: "ADF", unit: "kHz", value: adf ?? innerAdf, ident: adfIdent, color, format: formatAdf, parse: parseAdf, onChange: changeAdf }),
|
|
1125
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: label, children: "DME" }),
|
|
1126
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("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: [
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "data-testid": "radio-stack-dme", children: formatDme(dme) }),
|
|
1128
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { color: MUTED, fontFamily: "'Helvetica Neue', Arial, sans-serif", fontSize: "0.5em" }, children: "NM" })
|
|
1129
|
+
] })
|
|
1130
|
+
]
|
|
1131
|
+
}
|
|
1132
|
+
) })
|
|
1133
|
+
);
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
// src/components/DataPanel.tsx
|
|
1137
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1138
|
+
var MAX_FIELDS = 6;
|
|
1139
|
+
var SIDE2 = 252;
|
|
714
1140
|
var PAD = 8;
|
|
715
1141
|
var GAP = 8;
|
|
716
|
-
var
|
|
1142
|
+
var ORIGIN2 = CENTER - SIDE2 / 2;
|
|
717
1143
|
var VALUE_SIZE = { 1: 52, 2: 36, 3: 27 };
|
|
718
1144
|
function formatValue(field) {
|
|
719
1145
|
if (typeof field.value === "string") return field.value;
|
|
@@ -724,24 +1150,24 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
724
1150
|
const shown = fields.slice(0, MAX_FIELDS);
|
|
725
1151
|
const cols = shown.length <= 2 ? 1 : 2;
|
|
726
1152
|
const rows = Math.max(1, Math.ceil(shown.length / cols));
|
|
727
|
-
const cellW = (
|
|
728
|
-
const cellH = (
|
|
1153
|
+
const cellW = (SIDE2 - PAD * 2 - GAP * (cols - 1)) / cols;
|
|
1154
|
+
const cellH = (SIDE2 - PAD * 2 - GAP * (rows - 1)) / rows;
|
|
729
1155
|
const valueSize = VALUE_SIZE[rows] ?? 27;
|
|
730
|
-
const
|
|
731
|
-
return /* @__PURE__ */ (0,
|
|
732
|
-
heading && /* @__PURE__ */ (0,
|
|
733
|
-
/* @__PURE__ */ (0,
|
|
1156
|
+
const label2 = `${heading ?? "Data panel"}: ` + (shown.length ? shown.map((f) => `${f.name} ${formatValue(f)}${f.unit ? ` ${f.unit}` : ""}`).join(", ") : "no data");
|
|
1157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
1158
|
+
heading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: CENTER, y: ORIGIN2 - 14, fill: "#ccc", fontSize: "13", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: heading.toUpperCase() }),
|
|
1159
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x: ORIGIN2, y: ORIGIN2, width: SIDE2, height: SIDE2, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
734
1160
|
shown.map((f, i) => {
|
|
735
1161
|
const col = i % cols;
|
|
736
1162
|
const row = Math.floor(i / cols);
|
|
737
|
-
const x =
|
|
738
|
-
const y =
|
|
1163
|
+
const x = ORIGIN2 + PAD + col * (cellW + GAP);
|
|
1164
|
+
const y = ORIGIN2 + PAD + row * (cellH + GAP);
|
|
739
1165
|
const value = formatValue(f);
|
|
740
1166
|
const fit = Math.min(valueSize, (cellW - 16) / (0.62 * Math.max(1, value.length)));
|
|
741
|
-
return /* @__PURE__ */ (0,
|
|
742
|
-
/* @__PURE__ */ (0,
|
|
743
|
-
/* @__PURE__ */ (0,
|
|
744
|
-
/* @__PURE__ */ (0,
|
|
1167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { "data-testid": `data-field-${i}`, children: [
|
|
1168
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x, y, width: cellW, height: cellH, rx: "6", fill: "#000", stroke: "#262a30", strokeWidth: "1" }),
|
|
1169
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: x + 8, y: y + 12, fill: "#9aa4b1", fontSize: "12", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children: f.name.toUpperCase() }),
|
|
1170
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
745
1171
|
"text",
|
|
746
1172
|
{
|
|
747
1173
|
"data-testid": `data-value-${i}`,
|
|
@@ -756,25 +1182,25 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
756
1182
|
children: value
|
|
757
1183
|
}
|
|
758
1184
|
),
|
|
759
|
-
f.unit && /* @__PURE__ */ (0,
|
|
1185
|
+
f.unit && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("text", { x: x + cellW - 8, y: y + cellH - 12, fill: "#9aa4b1", fontSize: "12", textAnchor: "end", dominantBaseline: "central", children: f.unit })
|
|
760
1186
|
] }, i);
|
|
761
1187
|
})
|
|
762
1188
|
] });
|
|
763
1189
|
}
|
|
764
1190
|
|
|
765
1191
|
// src/components/FuelIndicator.tsx
|
|
766
|
-
var
|
|
1192
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
767
1193
|
var MAX_TANKS = 4;
|
|
768
1194
|
var GREEN2 = "#2ee05a";
|
|
769
1195
|
var RED = "#ff3b3b";
|
|
770
1196
|
var GREY = "#9aa4b1";
|
|
771
|
-
var
|
|
1197
|
+
var SIDE3 = 252;
|
|
772
1198
|
var PAD2 = 6;
|
|
773
|
-
var
|
|
774
|
-
var INNER_LEFT =
|
|
775
|
-
var INNER_W =
|
|
776
|
-
var FOOTER_Y =
|
|
777
|
-
var BAR_TOP =
|
|
1199
|
+
var ORIGIN3 = CENTER - SIDE3 / 2;
|
|
1200
|
+
var INNER_LEFT = ORIGIN3 + PAD2;
|
|
1201
|
+
var INNER_W = SIDE3 - PAD2 * 2;
|
|
1202
|
+
var FOOTER_Y = ORIGIN3 + SIDE3 - 36;
|
|
1203
|
+
var BAR_TOP = ORIGIN3 + 38;
|
|
778
1204
|
var BAR_H = 114;
|
|
779
1205
|
var BAR_BOTTOM = BAR_TOP + BAR_H;
|
|
780
1206
|
var DEFAULT_TANKS = [
|
|
@@ -787,7 +1213,7 @@ function FuelIndicator({
|
|
|
787
1213
|
unit = "gal",
|
|
788
1214
|
low,
|
|
789
1215
|
decimals = 1,
|
|
790
|
-
label = "FUEL",
|
|
1216
|
+
label: label2 = "FUEL",
|
|
791
1217
|
...props
|
|
792
1218
|
}) {
|
|
793
1219
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
@@ -805,17 +1231,17 @@ function FuelIndicator({
|
|
|
805
1231
|
const isLow = qty <= finite(low, cap * 0.1);
|
|
806
1232
|
return { name: t.name, qty, cap, fraction, full, isLow, text: full ? "FULL" : qty.toFixed(places) };
|
|
807
1233
|
});
|
|
808
|
-
const title = `${
|
|
809
|
-
return /* @__PURE__ */ (0,
|
|
810
|
-
/* @__PURE__ */ (0,
|
|
1234
|
+
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");
|
|
1235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1236
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: ORIGIN3, y: ORIGIN3, width: SIDE3, height: SIDE3, rx: "10", fill: "#000", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
811
1237
|
readings.map((r, i) => {
|
|
812
1238
|
const cx = INNER_LEFT + colW * (i + 0.5);
|
|
813
1239
|
const color = r.isLow ? RED : GREEN2;
|
|
814
1240
|
const tickX = cx - barW / 2 - 14;
|
|
815
|
-
return /* @__PURE__ */ (0,
|
|
816
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
817
|
-
/* @__PURE__ */ (0,
|
|
818
|
-
/* @__PURE__ */ (0,
|
|
1241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("g", { "data-testid": `fuel-tank-${i}`, children: [
|
|
1242
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: `M ${INNER_LEFT + colW * i} ${ORIGIN3 + 10} V ${FOOTER_Y}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1243
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("text", { x: cx, y: ORIGIN3 + 22, fill: "#fff", fontSize: Math.min(17, colW / 5), fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: r.name.toUpperCase() }),
|
|
1244
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { strokeWidth: "2.5", strokeLinecap: "round", children: [0, 0.25, 0.5, 0.75, 1].map((f) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
819
1245
|
"path",
|
|
820
1246
|
{
|
|
821
1247
|
d: `M ${tickX - 7} ${BAR_BOTTOM - f * BAR_H} h 7`,
|
|
@@ -823,9 +1249,9 @@ function FuelIndicator({
|
|
|
823
1249
|
},
|
|
824
1250
|
f
|
|
825
1251
|
)) }),
|
|
826
|
-
/* @__PURE__ */ (0,
|
|
827
|
-
/* @__PURE__ */ (0,
|
|
828
|
-
/* @__PURE__ */ (0,
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: "#15181c" }),
|
|
1253
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { "data-testid": `fuel-bar-${i}`, style: motionStyle(`scaleY(${r.fraction})`, duration, cx, BAR_BOTTOM), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: color }) }),
|
|
1254
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
829
1255
|
"text",
|
|
830
1256
|
{
|
|
831
1257
|
"data-testid": `fuel-value-${i}`,
|
|
@@ -840,23 +1266,23 @@ function FuelIndicator({
|
|
|
840
1266
|
children: r.text
|
|
841
1267
|
}
|
|
842
1268
|
),
|
|
843
|
-
/* @__PURE__ */ (0,
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("text", { x: cx, y: BAR_BOTTOM + 44, fill: "#fff", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: unit })
|
|
844
1270
|
] }, i);
|
|
845
1271
|
}),
|
|
846
|
-
/* @__PURE__ */ (0,
|
|
847
|
-
/* @__PURE__ */ (0,
|
|
1272
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: `M ${ORIGIN3 + 8} ${FOOTER_Y} H ${ORIGIN3 + SIDE3 - 8}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1273
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("text", { x: CENTER, y: FOOTER_Y + 19, fill: "#fff", fontSize: "24", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: label2.toUpperCase() })
|
|
848
1274
|
] });
|
|
849
1275
|
}
|
|
850
1276
|
|
|
851
1277
|
// src/components/EngineIndicator.tsx
|
|
852
|
-
var
|
|
1278
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
853
1279
|
var MAX_CYLINDERS = 6;
|
|
854
1280
|
var MAX_BAR_GAUGES = 4;
|
|
855
1281
|
var GREEN3 = "#5fe04a";
|
|
856
1282
|
var YELLOW = "#ffd400";
|
|
857
1283
|
var RED2 = "#ff3030";
|
|
858
1284
|
var BLUE = "#4fb7e8";
|
|
859
|
-
var
|
|
1285
|
+
var LABEL2 = "#b9c8e6";
|
|
860
1286
|
var LINE = "#8a8f99";
|
|
861
1287
|
var round2 = (n) => Math.round(n * 100) / 100;
|
|
862
1288
|
var DIAL_R = 182;
|
|
@@ -905,24 +1331,24 @@ function arcAt(cx, cy, r, a0, a1) {
|
|
|
905
1331
|
const [x1, y1] = polar(r, a1, cx, cy);
|
|
906
1332
|
return `M ${x0} ${y0} A ${r} ${r} 0 ${a1 - a0 > 180 ? 1 : 0} 1 ${x1} ${y1}`;
|
|
907
1333
|
}
|
|
908
|
-
function ArcGauge({ cx, label, g, duration, testId }) {
|
|
1334
|
+
function ArcGauge({ cx, label: label2, g, duration, testId }) {
|
|
909
1335
|
const span = g.max - g.min;
|
|
910
1336
|
const angle = (v) => round2(-ARC_SWEEP + 2 * ARC_SWEEP * clamp((v - g.min) / span, 0, 1));
|
|
911
|
-
const band = (from, to, color) => /* @__PURE__ */ (0,
|
|
1337
|
+
const band = (from, to, color) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: arcAt(cx, ARC_Y, ARC_R, angle(from), angle(to)), stroke: color, strokeWidth: "6", fill: "none" });
|
|
912
1338
|
const [tipX, tipY] = polar(ARC_R - 4, 0, cx, ARC_Y);
|
|
913
1339
|
const [lx, ly] = polar(ARC_R - 16, -7, cx, ARC_Y);
|
|
914
1340
|
const [rx, ry] = polar(ARC_R - 16, 7, cx, ARC_Y);
|
|
915
|
-
return /* @__PURE__ */ (0,
|
|
916
|
-
/* @__PURE__ */ (0,
|
|
1341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1342
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: arcAt(cx, ARC_Y, ARC_R, -ARC_SWEEP, ARC_SWEEP), stroke: "#fff", strokeWidth: "1.5", fill: "none" }),
|
|
917
1343
|
g.green && band(g.green[0], g.green[1], GREEN3),
|
|
918
1344
|
g.yellow && band(g.yellow[0], g.yellow[1], YELLOW),
|
|
919
1345
|
g.low !== void 0 && band(g.min, g.low, RED2),
|
|
920
1346
|
g.high !== void 0 && band(g.high, g.max, RED2),
|
|
921
|
-
/* @__PURE__ */ (0,
|
|
922
|
-
/* @__PURE__ */ (0,
|
|
923
|
-
/* @__PURE__ */ (0,
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { "data-testid": testId, style: motionStyle(`rotate(${angle(g.value)}deg)`, duration, cx, ARC_Y), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${tipX} ${tipY} L ${lx} ${ly} L ${rx} ${ry} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1348
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: cx, y: ARC_Y - 20, fill: LABEL2, fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 }),
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("text", { x: cx, y: ARC_Y + 4, fill: g.color, fontSize: "28", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
924
1350
|
g.text,
|
|
925
|
-
g.unit && /* @__PURE__ */ (0,
|
|
1351
|
+
g.unit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { fontSize: "11", dx: "2", children: g.unit })
|
|
926
1352
|
] })
|
|
927
1353
|
] });
|
|
928
1354
|
}
|
|
@@ -930,30 +1356,30 @@ var BAR_X0 = 210;
|
|
|
930
1356
|
var BAR_X1 = 296;
|
|
931
1357
|
var BAR_ROW_H = 39;
|
|
932
1358
|
var BAR_TOP2 = 137;
|
|
933
|
-
function BarGauge({ top, g, label, duration, testId }) {
|
|
1359
|
+
function BarGauge({ top, g, label: label2, duration, testId }) {
|
|
934
1360
|
const y = top + 14;
|
|
935
1361
|
const at = (v) => round2(BAR_X0 + (BAR_X1 - BAR_X0) * clamp((v - g.min) / (g.max - g.min), 0, 1));
|
|
936
|
-
const seg = (from, to, color, w = 7) => /* @__PURE__ */ (0,
|
|
937
|
-
return /* @__PURE__ */ (0,
|
|
938
|
-
/* @__PURE__ */ (0,
|
|
939
|
-
/* @__PURE__ */ (0,
|
|
1362
|
+
const seg = (from, to, color, w = 7) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${at(from)} ${y} H ${at(to)}`, stroke: color, strokeWidth: w });
|
|
1363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1364
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${BAR_X0} ${y} H ${BAR_X1}`, stroke: "#fff", strokeWidth: "2" }),
|
|
1365
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${BAR_X0} ${y - 4} v 8 M ${BAR_X1} ${y - 4} v 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
940
1366
|
g.green && seg(g.green[0], g.green[1], GREEN3),
|
|
941
1367
|
g.yellow && seg(g.yellow[0], g.yellow[1], YELLOW),
|
|
942
1368
|
g.low !== void 0 && seg(g.min, g.low, RED2),
|
|
943
1369
|
g.high !== void 0 && seg(g.high, g.max, RED2),
|
|
944
|
-
/* @__PURE__ */ (0,
|
|
945
|
-
/* @__PURE__ */ (0,
|
|
946
|
-
/* @__PURE__ */ (0,
|
|
947
|
-
g.unit && /* @__PURE__ */ (0,
|
|
1370
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { "data-testid": testId, style: motionStyle(`translate(${round2(at(g.value) - BAR_X0)}px, 0px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${BAR_X0} ${y - 3} l -5 -9 h 10 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1371
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: BAR_X0, y: top + 31, fill: LABEL2, fontSize: "13", fontWeight: "bold", dominantBaseline: "central", children: label2 }),
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: 350, y: top + 15, fill: g.color, fontSize: "20", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.text }),
|
|
1373
|
+
g.unit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: 350, y: top + 31, fill: LABEL2, fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.unit })
|
|
948
1374
|
] });
|
|
949
1375
|
}
|
|
950
1376
|
function Tank({ x, fraction, duration, testId }) {
|
|
951
1377
|
const top = 304;
|
|
952
1378
|
const h = 40;
|
|
953
|
-
return /* @__PURE__ */ (0,
|
|
954
|
-
/* @__PURE__ */ (0,
|
|
955
|
-
/* @__PURE__ */ (0,
|
|
956
|
-
/* @__PURE__ */ (0,
|
|
1379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1380
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: x - 7, y: top, width: "14", height: h, rx: "3", fill: "#000", stroke: "#fff", strokeWidth: "1.5" }),
|
|
1381
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { "data-testid": testId, style: motionStyle(`scaleY(${fraction})`, duration, x, top + h - 2), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: x - 5.5, y: top + 2, width: "11", height: h - 4, fill: BLUE }) }),
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: x - 5.5, y: top + h - 5, width: "11", height: "3", fill: RED2 })
|
|
957
1383
|
] });
|
|
958
1384
|
}
|
|
959
1385
|
var hottest = (values) => {
|
|
@@ -1009,7 +1435,7 @@ function EngineIndicator({
|
|
|
1009
1435
|
{ name: "EGT", value: egtMax, color: BLUE, x: 118 },
|
|
1010
1436
|
{ name: "TIT", value: hasTit ? tit : void 0, color: "#fff", x: 170 }
|
|
1011
1437
|
].filter((r) => r.value !== void 0);
|
|
1012
|
-
const
|
|
1438
|
+
const label2 = "Engine: " + [
|
|
1013
1439
|
power !== void 0 ? `power ${fmt(power)}%` : null,
|
|
1014
1440
|
`MAN ${man.text}${man.unit ? ` ${man.unit}` : ""}`,
|
|
1015
1441
|
`RPM ${speed.text}`,
|
|
@@ -1021,79 +1447,79 @@ function EngineIndicator({
|
|
|
1021
1447
|
fuelLeft !== void 0 || fuelRight !== void 0 ? `fuel ${fmt(fuelLeft)}/${fmt(fuelRight)} ${fuelUnit}` : null,
|
|
1022
1448
|
volts !== void 0 ? `${fmt(volts, 1)} V` : null
|
|
1023
1449
|
].filter(Boolean).join(", ");
|
|
1024
|
-
return /* @__PURE__ */ (0,
|
|
1025
|
-
power !== void 0 && /* @__PURE__ */ (0,
|
|
1026
|
-
/* @__PURE__ */ (0,
|
|
1450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
1451
|
+
power !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("text", { x: CENTER, y: 44, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1452
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("tspan", { fill: LABEL2, fontSize: "11", children: [
|
|
1027
1453
|
"POWER",
|
|
1028
1454
|
" "
|
|
1029
1455
|
] }),
|
|
1030
1456
|
fmt(power),
|
|
1031
|
-
/* @__PURE__ */ (0,
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { fontSize: "11", children: "%" })
|
|
1032
1458
|
] }),
|
|
1033
|
-
/* @__PURE__ */ (0,
|
|
1034
|
-
/* @__PURE__ */ (0,
|
|
1035
|
-
/* @__PURE__ */ (0,
|
|
1036
|
-
/* @__PURE__ */ (0,
|
|
1037
|
-
/* @__PURE__ */ (0,
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1039
|
-
/* @__PURE__ */ (0,
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArcGauge, { cx: 118, label: "MAN", g: man, duration, testId: "engine-man" }),
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArcGauge, { cx: 282, label: "RPM", g: speed, duration, testId: "engine-rpm" }),
|
|
1461
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { stroke: LINE, strokeWidth: "1.5", children: [
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: chord(133) }),
|
|
1463
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M 200 133 V 298" }),
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: chord(298) }),
|
|
1465
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M 136 298 V 348 M 264 298 V 348" })
|
|
1040
1466
|
] }),
|
|
1041
|
-
/* @__PURE__ */ (0,
|
|
1042
|
-
/* @__PURE__ */ (0,
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: readouts.map((r) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("text", { x: r.x, y: 144, fill: LABEL2, fontSize: "13", children: [
|
|
1043
1469
|
r.name,
|
|
1044
|
-
/* @__PURE__ */ (0,
|
|
1470
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { fontSize: "9", children: temperatureUnit })
|
|
1045
1471
|
] }),
|
|
1046
|
-
/* @__PURE__ */ (0,
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { "data-testid": `engine-${r.name.toLowerCase()}`, x: r.x, y: 165, fill: r.color, fontSize: "22", children: fmt(r.value) })
|
|
1047
1473
|
] }, r.name)) }),
|
|
1048
|
-
/* @__PURE__ */ (0,
|
|
1049
|
-
columns > 0 && /* @__PURE__ */ (0,
|
|
1050
|
-
/* @__PURE__ */ (0,
|
|
1051
|
-
/* @__PURE__ */ (0,
|
|
1474
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M 40 178 H 190", stroke: LINE, strokeWidth: "1" }),
|
|
1475
|
+
columns > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1476
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${chartX0} ${limitY} H ${chartX1}`, stroke: RED2, strokeWidth: "1.5", strokeDasharray: "5 4" }),
|
|
1477
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: chartX0 - 4, y: limitY, fill: "#fff", fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: "CHT" }),
|
|
1052
1478
|
Array.from({ length: cylinders }, (_, i) => {
|
|
1053
1479
|
const x0 = chartX0 + colW * i;
|
|
1054
1480
|
const mid = x0 + colW / 2;
|
|
1055
1481
|
const c = chtValues[i];
|
|
1056
1482
|
const e = egtValues[i];
|
|
1057
|
-
return /* @__PURE__ */ (0,
|
|
1058
|
-
c !== void 0 && /* @__PURE__ */ (0,
|
|
1059
|
-
e !== void 0 && /* @__PURE__ */ (0,
|
|
1060
|
-
/* @__PURE__ */ (0,
|
|
1483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1484
|
+
c !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { "data-testid": `engine-cht-${i}`, style: motionStyle(`scaleY(${chtFrac(c)})`, duration, mid, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: mid - barW - 1, y: chartBase - chartH, width: barW, height: chartH, fill: GREEN3 }) }),
|
|
1485
|
+
e !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { "data-testid": `engine-egt-${i}`, style: motionStyle(`scaleY(${egtFrac(e)})`, duration, mid, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: mid + 1, y: chartBase - chartH, width: barW, height: chartH, fill: BLUE }) }),
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: mid, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: i + 1 })
|
|
1061
1487
|
] }, i);
|
|
1062
1488
|
}),
|
|
1063
|
-
hasTit && /* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
1489
|
+
hasTit && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("g", { "data-testid": "engine-tit-bar", style: motionStyle(`scaleY(${egtFrac(tit)})`, duration, chartX1 - colW / 2, chartBase), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: chartX1 - colW / 2 - barW / 2, y: chartBase - chartH, width: barW, height: chartH, fill: "#fff" }) }),
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: chartX1 - colW / 2, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "T" })
|
|
1066
1492
|
] })
|
|
1067
1493
|
] }),
|
|
1068
|
-
bars.map((b, i) => /* @__PURE__ */ (0,
|
|
1069
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
1070
|
-
/* @__PURE__ */ (0,
|
|
1494
|
+
bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1495
|
+
i > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M 206 ${BAR_TOP2 + BAR_ROW_H * i - 2} H 352`, stroke: LINE, strokeWidth: "1" }),
|
|
1496
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BarGauge, { top: BAR_TOP2 + BAR_ROW_H * i, g: b.g, label: b.label, duration, testId: `engine-bar-${i}` })
|
|
1071
1497
|
] }, b.label)),
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1498
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("text", { "data-testid": "engine-amps", x: 104, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1074
1500
|
fmt(amps),
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { fontSize: "11", dx: "2", children: "A" })
|
|
1076
1502
|
] }),
|
|
1077
|
-
/* @__PURE__ */ (0,
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1079
|
-
/* @__PURE__ */ (0,
|
|
1080
|
-
/* @__PURE__ */ (0,
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: 104, y: 338, fill: LABEL2, fontSize: "13", children: "ALT" }),
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Tank, { x: 152, fraction: left / cap, duration, testId: "engine-fuel-left" }),
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Tank, { x: 248, fraction: right / cap, duration, testId: "engine-fuel-right" }),
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("text", { "data-testid": "engine-fuel", x: 200, y: 316, fill: "#fff", fontSize: "20", children: [
|
|
1081
1507
|
fmt(left),
|
|
1082
|
-
/* @__PURE__ */ (0,
|
|
1508
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { dx: "14", children: fmt(right) })
|
|
1083
1509
|
] }),
|
|
1084
|
-
/* @__PURE__ */ (0,
|
|
1085
|
-
/* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1510
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: 200, y: 335, fill: LABEL2, fontSize: "13", children: "Fuel" }),
|
|
1511
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: 200, y: 348, fill: LABEL2, fontSize: "9", children: fuelUnit }),
|
|
1512
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("text", { "data-testid": "engine-volts", x: 296, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1087
1513
|
fmt(volts, 1),
|
|
1088
|
-
/* @__PURE__ */ (0,
|
|
1514
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { fontSize: "11", dx: "2", children: "V" })
|
|
1089
1515
|
] }),
|
|
1090
|
-
/* @__PURE__ */ (0,
|
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: 296, y: 338, fill: LABEL2, fontSize: "13", children: "BATT" })
|
|
1091
1517
|
] })
|
|
1092
1518
|
] });
|
|
1093
1519
|
}
|
|
1094
1520
|
|
|
1095
1521
|
// src/components/FlapIndicator.tsx
|
|
1096
|
-
var
|
|
1522
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1097
1523
|
var GREEN4 = "#3ddc3d";
|
|
1098
1524
|
var YELLOW2 = "#ffd400";
|
|
1099
1525
|
var ORANGE = "#ff8a00";
|
|
@@ -1116,7 +1542,7 @@ function FlapIndicator({
|
|
|
1116
1542
|
segments = 20,
|
|
1117
1543
|
speedLimits,
|
|
1118
1544
|
airspeed,
|
|
1119
|
-
label = "WING FLAP",
|
|
1545
|
+
label: label2 = "WING FLAP",
|
|
1120
1546
|
...props
|
|
1121
1547
|
}) {
|
|
1122
1548
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
@@ -1131,13 +1557,13 @@ function FlapIndicator({
|
|
|
1131
1557
|
const ias = finite(airspeed, NaN);
|
|
1132
1558
|
const overspeed = limit !== void 0 && !Number.isNaN(ias) && ias > limit.speed;
|
|
1133
1559
|
const segH = BAR_H2 / count;
|
|
1134
|
-
const title = `${
|
|
1135
|
-
return /* @__PURE__ */ (0,
|
|
1136
|
-
/* @__PURE__ */ (0,
|
|
1560
|
+
const title = `${label2}: ${Math.round(position)}\xB0 of ${Math.round(full)}\xB0` + (limit ? `, max ${Math.round(limit.speed)} knots${overspeed ? " (overspeed)" : ""}` : "");
|
|
1561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1562
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }),
|
|
1137
1563
|
Array.from({ length: count }, (_, i) => {
|
|
1138
1564
|
const y = BAR_TOP3 + i * segH;
|
|
1139
1565
|
const on = i < lit;
|
|
1140
|
-
return /* @__PURE__ */ (0,
|
|
1566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1141
1567
|
"rect",
|
|
1142
1568
|
{
|
|
1143
1569
|
"data-testid": `flap-segment-${i}`,
|
|
@@ -1154,26 +1580,26 @@ function FlapIndicator({
|
|
|
1154
1580
|
i
|
|
1155
1581
|
);
|
|
1156
1582
|
}),
|
|
1157
|
-
/* @__PURE__ */ (0,
|
|
1158
|
-
/* @__PURE__ */ (0,
|
|
1159
|
-
/* @__PURE__ */ (0,
|
|
1583
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { fill: "#fff", fontSize: "18", fontWeight: "bold", dominantBaseline: "central", children: scale.map((d) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { children: [
|
|
1584
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${BAR_X + BAR_W / 2 + 8} ${yAt(d)} h 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
1585
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: BAR_X + BAR_W / 2 + 22, y: yAt(d), children: d })
|
|
1160
1586
|
] }, d)) }),
|
|
1161
|
-
/* @__PURE__ */ (0,
|
|
1162
|
-
limit && /* @__PURE__ */ (0,
|
|
1163
|
-
/* @__PURE__ */ (0,
|
|
1587
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("g", { "data-testid": "flap-pointer", style: motionStyle(`translate(0px, ${yAt(position) - BAR_TOP3}px)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${BAR_X - BAR_W / 2 - 8} ${BAR_TOP3} l -14 -8 v 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1588
|
+
limit && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { textAnchor: "middle", dominantBaseline: "central", fill: overspeed ? RED3 : "#fff", children: [
|
|
1589
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { "data-testid": "flap-speed", x: 118, y: 176, fontSize: "36", fontWeight: "bold", children: [
|
|
1164
1590
|
Math.round(limit.speed),
|
|
1165
|
-
/* @__PURE__ */ (0,
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "13", dx: "3", children: "KTS" })
|
|
1166
1592
|
] }),
|
|
1167
|
-
/* @__PURE__ */ (0,
|
|
1593
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 118, y: 212, fontSize: "13", fontWeight: "bold", fill: "#bbb", letterSpacing: "2", children: "MAX" })
|
|
1168
1594
|
] }),
|
|
1169
|
-
/* @__PURE__ */ (0,
|
|
1595
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: CENTER, y: 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1170
1596
|
] });
|
|
1171
1597
|
}
|
|
1172
1598
|
|
|
1173
1599
|
// src/components/AoaIndicator.tsx
|
|
1174
|
-
var
|
|
1600
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1175
1601
|
var GREEN5 = "#3ddc3d";
|
|
1176
|
-
var
|
|
1602
|
+
var AMBER4 = "#ffb000";
|
|
1177
1603
|
var RED4 = "#ff2a2a";
|
|
1178
1604
|
var UNLIT_OPACITY = 0.15;
|
|
1179
1605
|
var ROWS = [
|
|
@@ -1182,10 +1608,10 @@ var ROWS = [
|
|
|
1182
1608
|
{ shape: "bar", color: GREEN5, y: 256 },
|
|
1183
1609
|
{ shape: "bar", color: GREEN5, y: 234 },
|
|
1184
1610
|
{ shape: "donut", color: GREEN5, y: 208 },
|
|
1185
|
-
{ shape: "bar", color:
|
|
1186
|
-
{ shape: "split", color:
|
|
1187
|
-
{ shape: "chevron", color:
|
|
1188
|
-
{ shape: "chevron", color:
|
|
1611
|
+
{ shape: "bar", color: AMBER4, y: 182 },
|
|
1612
|
+
{ shape: "split", color: AMBER4, y: 160 },
|
|
1613
|
+
{ shape: "chevron", color: AMBER4, y: 125 },
|
|
1614
|
+
{ shape: "chevron", color: AMBER4, y: 103 },
|
|
1189
1615
|
{ shape: "chevron", color: RED4, y: 74 },
|
|
1190
1616
|
{ shape: "chevron", color: RED4, y: 52 }
|
|
1191
1617
|
];
|
|
@@ -1199,23 +1625,23 @@ function RowShape({ shape, y }) {
|
|
|
1199
1625
|
const r = CENTER + HALF;
|
|
1200
1626
|
switch (shape) {
|
|
1201
1627
|
case "bar":
|
|
1202
|
-
return /* @__PURE__ */ (0,
|
|
1628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF * 2, height: BAR_H3, rx: "2" });
|
|
1203
1629
|
case "split":
|
|
1204
|
-
return /* @__PURE__ */ (0,
|
|
1205
|
-
/* @__PURE__ */ (0,
|
|
1206
|
-
/* @__PURE__ */ (0,
|
|
1630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
1631
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" }),
|
|
1632
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: r - 50, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" })
|
|
1207
1633
|
] });
|
|
1208
1634
|
case "donut":
|
|
1209
|
-
return /* @__PURE__ */ (0,
|
|
1210
|
-
/* @__PURE__ */ (0,
|
|
1211
|
-
/* @__PURE__ */ (0,
|
|
1212
|
-
/* @__PURE__ */ (0,
|
|
1635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: CENTER + 24, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: CENTER, cy: y, r: 13, fill: "none", strokeWidth: "7" })
|
|
1213
1639
|
] });
|
|
1214
1640
|
case "chevron":
|
|
1215
|
-
return /* @__PURE__ */ (0,
|
|
1641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: `M ${l} ${y} L ${CENTER} ${y + CHEVRON_DEPTH} L ${r} ${y}`, fill: "none", strokeWidth: "11", strokeLinejoin: "miter" });
|
|
1216
1642
|
}
|
|
1217
1643
|
}
|
|
1218
|
-
function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label = "AOA", ...props }) {
|
|
1644
|
+
function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label: label2 = "AOA", ...props }) {
|
|
1219
1645
|
const lo = finite(min, 0);
|
|
1220
1646
|
const hi = Math.max(lo + 1e-6, finite(max, 20));
|
|
1221
1647
|
const opt = clamp(finite(optimum, (lo + hi) / 2), lo, hi);
|
|
@@ -1225,12 +1651,12 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1225
1651
|
const stall = lit === ROWS.length;
|
|
1226
1652
|
const reading = Number.isNaN(value) ? "---" : `${value.toFixed(1)}\xB0`;
|
|
1227
1653
|
const state = stall ? " (stall warning)" : lit > DONUT + 1 ? " (high)" : lit === DONUT + 1 ? " (optimum)" : "";
|
|
1228
|
-
const title = `${
|
|
1229
|
-
return /* @__PURE__ */ (0,
|
|
1230
|
-
/* @__PURE__ */ (0,
|
|
1654
|
+
const title = `${label2}: ${reading}${Number.isNaN(value) ? "" : state}`;
|
|
1655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1656
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: CENTER - HALF - 10, y: 40, width: (HALF + 10) * 2, height: 278, rx: "10", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
|
|
1231
1657
|
ROWS.map((row, i) => {
|
|
1232
1658
|
const on = i < lit;
|
|
1233
|
-
return /* @__PURE__ */ (0,
|
|
1659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1234
1660
|
"g",
|
|
1235
1661
|
{
|
|
1236
1662
|
"data-testid": `aoa-row-${i}`,
|
|
@@ -1241,19 +1667,20 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1241
1667
|
opacity: on ? 1 : UNLIT_OPACITY,
|
|
1242
1668
|
style: { transition: "opacity 150ms ease-out" },
|
|
1243
1669
|
children: [
|
|
1244
|
-
/* @__PURE__ */ (0,
|
|
1245
|
-
on && stall && row.shape === "chevron" && /* @__PURE__ */ (0,
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RowShape, { shape: row.shape, y: row.y }),
|
|
1671
|
+
on && stall && row.shape === "chevron" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("animate", { attributeName: "opacity", values: "1;0.25;1", dur: "0.6s", repeatCount: "indefinite" })
|
|
1246
1672
|
]
|
|
1247
1673
|
},
|
|
1248
1674
|
i
|
|
1249
1675
|
);
|
|
1250
1676
|
}),
|
|
1251
|
-
showValue && /* @__PURE__ */ (0,
|
|
1252
|
-
/* @__PURE__ */ (0,
|
|
1677
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { "data-testid": "aoa-value", x: CENTER, y: 340, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", children: reading }),
|
|
1678
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: CENTER, y: showValue ? 362 : 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1253
1679
|
] });
|
|
1254
1680
|
}
|
|
1255
1681
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1256
1682
|
0 && (module.exports = {
|
|
1683
|
+
AdfIndicator,
|
|
1257
1684
|
Airspeed,
|
|
1258
1685
|
Altimeter,
|
|
1259
1686
|
AoaIndicator,
|
|
@@ -1270,11 +1697,19 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1270
1697
|
MAX_CYLINDERS,
|
|
1271
1698
|
MAX_FIELDS,
|
|
1272
1699
|
MAX_TANKS,
|
|
1700
|
+
RadioPanel,
|
|
1701
|
+
RadioStack,
|
|
1273
1702
|
TurnCoordinator,
|
|
1274
1703
|
VerticalSpeed,
|
|
1275
1704
|
VorIndicator,
|
|
1276
1705
|
WindIndicator,
|
|
1706
|
+
formatAdf,
|
|
1707
|
+
formatDme,
|
|
1708
|
+
formatNav,
|
|
1277
1709
|
formatValue,
|
|
1710
|
+
parseAdf,
|
|
1711
|
+
parseNav,
|
|
1712
|
+
relativeBearing,
|
|
1278
1713
|
vorDeviation
|
|
1279
1714
|
});
|
|
1280
1715
|
//# sourceMappingURL=index.cjs.map
|