flight-indicators 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -4
- package/dist/index.cjs +503 -150
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -1
- package/dist/index.d.ts +82 -1
- package/dist/index.js +494 -150
- 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);
|
|
@@ -650,8 +659,8 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
650
659
|
const courseText = String(Math.round(norm2(crs)) || 360).padStart(3, "0");
|
|
651
660
|
const needleX = dev / FULL_SCALE_DEG * FULL_SCALE_PX;
|
|
652
661
|
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: [
|
|
662
|
+
const label2 = signal ? `VOR indicator: course ${courseText}\xB0, needle ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `VOR indicator: course ${courseText}\xB0, no signal`;
|
|
663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
655
664
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { "data-testid": "vor-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
|
|
656
665
|
/* @__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
666
|
range(0, 330, 30).map((a) => {
|
|
@@ -707,13 +716,348 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
707
716
|
] });
|
|
708
717
|
}
|
|
709
718
|
|
|
710
|
-
// src/components/
|
|
719
|
+
// src/components/AdfIndicator.tsx
|
|
711
720
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
712
|
-
var
|
|
721
|
+
var CARDINALS4 = { 0: "N", 90: "E", 180: "S", 270: "W" };
|
|
722
|
+
var AMBER3 = "#ffb000";
|
|
723
|
+
var NEEDLE = "#ffe14d";
|
|
724
|
+
var PARKED_DEG = 90;
|
|
725
|
+
var norm3 = (deg) => (deg % 360 + 360) % 360;
|
|
726
|
+
var pad3 = (deg) => String(Math.round(norm3(deg)) % 360).padStart(3, "0");
|
|
727
|
+
function relativeBearing(heading, bearingToStation) {
|
|
728
|
+
return norm3(finite(bearingToStation) - finite(heading));
|
|
729
|
+
}
|
|
730
|
+
function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
731
|
+
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
732
|
+
const rel = finite(bearing);
|
|
733
|
+
const hdg = finite(heading);
|
|
734
|
+
const displayCard = useContinuousAngle(hdg);
|
|
735
|
+
const displayNeedle = useContinuousAngle(signal ? rel : PARKED_DEG);
|
|
736
|
+
const label2 = signal ? `ADF indicator: station ${pad3(rel)}\xB0 relative, bearing ${pad3(rel + hdg)}\xB0 to station` : "ADF indicator: no signal";
|
|
737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { "data-testid": "adf-card", style: motionStyle(`rotate(${-displayCard}deg)`, duration), children: [
|
|
739
|
+
/* @__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)) }),
|
|
740
|
+
range(0, 330, 30).map((a) => {
|
|
741
|
+
const [x, y] = polar(132, a);
|
|
742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
743
|
+
"text",
|
|
744
|
+
{
|
|
745
|
+
x,
|
|
746
|
+
y,
|
|
747
|
+
transform: `rotate(${a} ${x} ${y})`,
|
|
748
|
+
fill: a % 90 === 0 ? AMBER3 : "#fff",
|
|
749
|
+
fontSize: a % 90 === 0 ? 28 : 24,
|
|
750
|
+
fontWeight: "bold",
|
|
751
|
+
textAnchor: "middle",
|
|
752
|
+
dominantBaseline: "central",
|
|
753
|
+
children: CARDINALS4[a] ?? String(a / 10)
|
|
754
|
+
},
|
|
755
|
+
a
|
|
756
|
+
);
|
|
757
|
+
})
|
|
758
|
+
] }),
|
|
759
|
+
/* @__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" }),
|
|
760
|
+
/* @__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)) }),
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { stroke: AMBER3, strokeWidth: "2", strokeLinecap: "round", opacity: "0.7", children: [
|
|
762
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER - 26} ${CENTER} H ${CENTER + 26}` }),
|
|
763
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: `M ${CENTER} ${CENTER - 26} V ${CENTER + 14}` })
|
|
764
|
+
] }),
|
|
765
|
+
/* @__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" }),
|
|
766
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { "data-testid": "adf-flag", opacity: signal ? 0 : 1, style: { transition: "opacity 200ms ease-out" }, children: [
|
|
767
|
+
/* @__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" }),
|
|
768
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("text", { x: CENTER, y: CENTER - 63, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "ADF" })
|
|
769
|
+
] }),
|
|
770
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("g", { "data-testid": "adf-needle", style: motionStyle(`rotate(${displayNeedle}deg)`, duration), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
771
|
+
"path",
|
|
772
|
+
{
|
|
773
|
+
d: `M ${CENTER} ${CENTER - 146} l -13 30 h 9 V ${CENTER + 140} h 8 V ${CENTER - 116} h 9 z`,
|
|
774
|
+
fill: NEEDLE,
|
|
775
|
+
stroke: "#000",
|
|
776
|
+
strokeWidth: "1.5",
|
|
777
|
+
strokeLinejoin: "round"
|
|
778
|
+
}
|
|
779
|
+
) }),
|
|
780
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Hub, { r: 10 })
|
|
781
|
+
] });
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// src/components/RadioPanel.tsx
|
|
785
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
713
786
|
var SIDE = 252;
|
|
787
|
+
var ORIGIN = CENTER - SIDE / 2;
|
|
788
|
+
var ROW_H = 60;
|
|
789
|
+
var ROW_GAP = 8;
|
|
790
|
+
var FIRST_ROW = ORIGIN + 32;
|
|
791
|
+
var LABEL_X = ORIGIN + 10;
|
|
792
|
+
var ACTIVE_X = ORIGIN + 48;
|
|
793
|
+
var DISPLAY_W = 88;
|
|
794
|
+
var STANDBY_X = ORIGIN + SIDE - 8 - DISPLAY_W;
|
|
795
|
+
var SWAP_X = (ACTIVE_X + DISPLAY_W + STANDBY_X) / 2;
|
|
796
|
+
var usable = (n) => typeof n === "number" && Number.isFinite(n) && n >= 0;
|
|
797
|
+
var formatNav = (mhz) => usable(mhz) ? mhz.toFixed(2) : "---.--";
|
|
798
|
+
var formatAdf = (khz) => usable(khz) ? Number.isInteger(khz) ? String(khz) : khz.toFixed(1) : "---";
|
|
799
|
+
var formatDme = (nm) => usable(nm) ? nm < 99.95 ? nm.toFixed(1) : nm.toFixed(0) : "--.-";
|
|
800
|
+
function Display({ x, y, width, value, color, testId, unit }) {
|
|
801
|
+
const h = ROW_H - 16;
|
|
802
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { children: [
|
|
803
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x, y: y + 8, width, height: h, rx: "5", fill: "#1a0d00", stroke: "#3a2a14", strokeWidth: "1.5" }),
|
|
804
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
805
|
+
"text",
|
|
806
|
+
{
|
|
807
|
+
"data-testid": testId,
|
|
808
|
+
x: unit ? x + width - 40 : x + width / 2,
|
|
809
|
+
y: y + ROW_H / 2 + 1,
|
|
810
|
+
fill: color,
|
|
811
|
+
fontSize: unit ? 28 : 22,
|
|
812
|
+
fontFamily: "monospace",
|
|
813
|
+
fontWeight: "bold",
|
|
814
|
+
textAnchor: unit ? "end" : "middle",
|
|
815
|
+
dominantBaseline: "central",
|
|
816
|
+
children: value
|
|
817
|
+
}
|
|
818
|
+
),
|
|
819
|
+
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 })
|
|
820
|
+
] });
|
|
821
|
+
}
|
|
822
|
+
function Swap({ y }) {
|
|
823
|
+
const cy = y + ROW_H / 2;
|
|
824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { stroke: "#9aa4b1", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
825
|
+
/* @__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` }),
|
|
826
|
+
/* @__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` })
|
|
827
|
+
] });
|
|
828
|
+
}
|
|
829
|
+
function RowLabel({ y, children }) {
|
|
830
|
+
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 });
|
|
831
|
+
}
|
|
832
|
+
function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
|
|
833
|
+
const rows = [
|
|
834
|
+
{ key: "nav", name: "NAV", unit: "MHz", active: formatNav(nav?.active), standby: formatNav(nav?.standby), tuned: usable(nav?.active) },
|
|
835
|
+
{ key: "adf", name: "ADF", unit: "kHz", active: formatAdf(adf?.active), standby: formatAdf(adf?.standby), tuned: usable(adf?.active) }
|
|
836
|
+
];
|
|
837
|
+
const dmeText = formatDme(dme);
|
|
838
|
+
const dmeY = FIRST_ROW + 2 * (ROW_H + ROW_GAP);
|
|
839
|
+
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"}`;
|
|
840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", { x: ORIGIN, y: ORIGIN, width: SIDE, height: SIDE, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { fill: "#9aa4b1", fontSize: "11", fontWeight: "bold", letterSpacing: "1.5", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: ACTIVE_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "ACTIVE" }),
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("text", { x: STANDBY_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "STBY" })
|
|
845
|
+
] }),
|
|
846
|
+
rows.map((r, i) => {
|
|
847
|
+
const y = FIRST_ROW + i * (ROW_H + ROW_GAP);
|
|
848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("g", { children: [
|
|
849
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RowLabel, { y, children: r.name }),
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Display, { x: ACTIVE_X, y, width: DISPLAY_W, value: r.active, color, testId: `radio-${r.key}-active` }),
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Swap, { y }),
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Display, { x: STANDBY_X, y, width: DISPLAY_W, value: r.standby, color, testId: `radio-${r.key}-standby` })
|
|
853
|
+
] }, r.key);
|
|
854
|
+
}),
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RowLabel, { y: dmeY, children: "DME" }),
|
|
856
|
+
/* @__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" })
|
|
857
|
+
] });
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
// src/components/RadioStack.tsx
|
|
861
|
+
var import_react2 = require("react");
|
|
862
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
863
|
+
var parseNav = (text) => {
|
|
864
|
+
const mhz = Math.round(Number.parseFloat(text.replace(",", ".")) * 100) / 100;
|
|
865
|
+
return mhz >= 108 && mhz <= 117.95 ? mhz : void 0;
|
|
866
|
+
};
|
|
867
|
+
var parseAdf = (text) => {
|
|
868
|
+
const khz = Math.round(Number.parseFloat(text.replace(",", ".")) * 10) / 10;
|
|
869
|
+
return khz >= 190 && khz <= 1750 ? khz : void 0;
|
|
870
|
+
};
|
|
871
|
+
var MONO = "ui-monospace, 'SF Mono', Menlo, Consolas, monospace";
|
|
872
|
+
var LABEL = "#ccc";
|
|
873
|
+
var MUTED = "#9aa4b1";
|
|
874
|
+
var display = {
|
|
875
|
+
boxSizing: "border-box",
|
|
876
|
+
width: "100%",
|
|
877
|
+
minWidth: 0,
|
|
878
|
+
height: "2.1em",
|
|
879
|
+
margin: 0,
|
|
880
|
+
padding: "0 0.1em",
|
|
881
|
+
borderRadius: "0.25em",
|
|
882
|
+
border: "0.08em solid #3a2a14",
|
|
883
|
+
background: "#1a0d00",
|
|
884
|
+
fontFamily: MONO,
|
|
885
|
+
fontSize: "1.2em",
|
|
886
|
+
fontWeight: "bold",
|
|
887
|
+
lineHeight: "2em",
|
|
888
|
+
textAlign: "center",
|
|
889
|
+
whiteSpace: "nowrap",
|
|
890
|
+
overflow: "hidden"
|
|
891
|
+
};
|
|
892
|
+
var label = { display: "flex", flexDirection: "column", justifyContent: "center", color: LABEL, fontWeight: "bold", letterSpacing: "0.06em", lineHeight: 1.15 };
|
|
893
|
+
var ident = { color: "#3cc8ff", fontSize: "0.72em", fontFamily: MONO, minHeight: "1.15em" };
|
|
894
|
+
function SwapIcon() {
|
|
895
|
+
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: [
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M2 5.5 H14 M11 2.5 l3 3 l-3 3" }),
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M14 10.5 H2 M5 7.5 l-3 3 l3 3" })
|
|
898
|
+
] });
|
|
899
|
+
}
|
|
900
|
+
function Receiver({ name, unit, value, ident: station, color, format, parse, onChange }) {
|
|
901
|
+
const [draft, setDraft] = (0, import_react2.useState)(null);
|
|
902
|
+
const [focused, setFocused] = (0, import_react2.useState)(false);
|
|
903
|
+
const [invalid, setInvalid] = (0, import_react2.useState)(false);
|
|
904
|
+
const key = name.toLowerCase();
|
|
905
|
+
const shown = value.standby === void 0 ? "" : format(value.standby);
|
|
906
|
+
const swap = (standby = value.standby) => onChange({ active: standby, standby: value.active });
|
|
907
|
+
const onKeyDown = (e) => {
|
|
908
|
+
if (e.key === "Escape") {
|
|
909
|
+
setDraft(null);
|
|
910
|
+
setInvalid(false);
|
|
911
|
+
}
|
|
912
|
+
if (e.key !== "Enter") return;
|
|
913
|
+
e.preventDefault();
|
|
914
|
+
const text = (draft ?? shown).trim();
|
|
915
|
+
const standby = text ? parse(text) : void 0;
|
|
916
|
+
if (text && standby === void 0) return setInvalid(true);
|
|
917
|
+
setDraft(null);
|
|
918
|
+
setInvalid(false);
|
|
919
|
+
swap(standby);
|
|
920
|
+
};
|
|
921
|
+
const onBlur = () => {
|
|
922
|
+
setFocused(false);
|
|
923
|
+
setInvalid(false);
|
|
924
|
+
if (draft === null) return;
|
|
925
|
+
const text = draft.trim();
|
|
926
|
+
const standby = text ? parse(text) : void 0;
|
|
927
|
+
setDraft(null);
|
|
928
|
+
if (text && standby === void 0 || standby === value.standby) return;
|
|
929
|
+
onChange({ active: value.active, standby });
|
|
930
|
+
};
|
|
931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: label, children: [
|
|
933
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: name }),
|
|
934
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "data-testid": `radio-stack-${key}-ident`, style: ident, children: station ?? "" })
|
|
935
|
+
] }),
|
|
936
|
+
/* @__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) }),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
938
|
+
"button",
|
|
939
|
+
{
|
|
940
|
+
type: "button",
|
|
941
|
+
onClick: () => swap(),
|
|
942
|
+
"aria-label": `Swap ${name} active and standby`,
|
|
943
|
+
title: "Swap active and standby",
|
|
944
|
+
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" },
|
|
945
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SwapIcon, {})
|
|
946
|
+
}
|
|
947
|
+
),
|
|
948
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
949
|
+
"input",
|
|
950
|
+
{
|
|
951
|
+
type: "text",
|
|
952
|
+
inputMode: "decimal",
|
|
953
|
+
autoComplete: "off",
|
|
954
|
+
spellCheck: false,
|
|
955
|
+
"data-testid": `radio-stack-${key}-standby`,
|
|
956
|
+
"aria-label": `${name} standby frequency (${unit})`,
|
|
957
|
+
"aria-invalid": invalid || void 0,
|
|
958
|
+
placeholder: format(void 0),
|
|
959
|
+
value: draft ?? shown,
|
|
960
|
+
onChange: (e) => {
|
|
961
|
+
setDraft(e.target.value);
|
|
962
|
+
setInvalid(false);
|
|
963
|
+
},
|
|
964
|
+
onFocus: (e) => {
|
|
965
|
+
setFocused(true);
|
|
966
|
+
e.target.select();
|
|
967
|
+
},
|
|
968
|
+
onBlur,
|
|
969
|
+
onKeyDown,
|
|
970
|
+
style: { ...display, color, outline: "none", borderColor: invalid ? "#ff4d4d" : focused ? color : "#3a2a14", cursor: "text" }
|
|
971
|
+
}
|
|
972
|
+
)
|
|
973
|
+
] });
|
|
974
|
+
}
|
|
975
|
+
var SCREWS2 = [
|
|
976
|
+
{ top: "0.3em", left: "0.3em" },
|
|
977
|
+
{ top: "0.3em", right: "0.3em" },
|
|
978
|
+
{ bottom: "0.3em", left: "0.3em" },
|
|
979
|
+
{ bottom: "0.3em", right: "0.3em" }
|
|
980
|
+
];
|
|
981
|
+
function RadioStack({
|
|
982
|
+
nav,
|
|
983
|
+
adf,
|
|
984
|
+
defaultNav,
|
|
985
|
+
defaultAdf,
|
|
986
|
+
onNavChange,
|
|
987
|
+
onAdfChange,
|
|
988
|
+
navIdent,
|
|
989
|
+
adfIdent,
|
|
990
|
+
dme,
|
|
991
|
+
color = "#ff9a2e",
|
|
992
|
+
width = 320,
|
|
993
|
+
className,
|
|
994
|
+
style,
|
|
995
|
+
title = "Radio panel"
|
|
996
|
+
}) {
|
|
997
|
+
const [innerNav, setInnerNav] = (0, import_react2.useState)(defaultNav ?? {});
|
|
998
|
+
const [innerAdf, setInnerAdf] = (0, import_react2.useState)(defaultAdf ?? {});
|
|
999
|
+
const changeNav = (next) => {
|
|
1000
|
+
if (nav === void 0) setInnerNav(next);
|
|
1001
|
+
onNavChange?.(next);
|
|
1002
|
+
};
|
|
1003
|
+
const changeAdf = (next) => {
|
|
1004
|
+
if (adf === void 0) setInnerAdf(next);
|
|
1005
|
+
onAdfChange?.(next);
|
|
1006
|
+
};
|
|
1007
|
+
const heading = { color: MUTED, fontSize: "0.72em", fontWeight: "bold", letterSpacing: "0.12em", textAlign: "center" };
|
|
1008
|
+
return (
|
|
1009
|
+
// The outer box is a size container so every inner measurement can follow the width.
|
|
1010
|
+
/* @__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)(
|
|
1011
|
+
"div",
|
|
1012
|
+
{
|
|
1013
|
+
role: "group",
|
|
1014
|
+
"aria-label": title,
|
|
1015
|
+
style: {
|
|
1016
|
+
position: "relative",
|
|
1017
|
+
boxSizing: "border-box",
|
|
1018
|
+
display: "grid",
|
|
1019
|
+
gridTemplateColumns: "2.6em minmax(0, 1fr) 2.4em minmax(0, 1fr)",
|
|
1020
|
+
gap: "0.5em 0.4em",
|
|
1021
|
+
alignItems: "center",
|
|
1022
|
+
padding: "1.1em 1.2em 1.2em",
|
|
1023
|
+
borderRadius: "0.9em",
|
|
1024
|
+
border: "0.15em solid #0d0d0d",
|
|
1025
|
+
background: "#232323",
|
|
1026
|
+
color: LABEL,
|
|
1027
|
+
fontFamily: "'Helvetica Neue', Arial, sans-serif",
|
|
1028
|
+
fontSize: "5cqw",
|
|
1029
|
+
textAlign: "left",
|
|
1030
|
+
userSelect: "none"
|
|
1031
|
+
},
|
|
1032
|
+
children: [
|
|
1033
|
+
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: [
|
|
1034
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { r: "12", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
|
|
1035
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M -8 3 L 8 -3", stroke: "#111", strokeWidth: "3" })
|
|
1036
|
+
] }, i)),
|
|
1037
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", {}),
|
|
1038
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: heading, children: "ACTIVE" }),
|
|
1039
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", {}),
|
|
1040
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: heading, children: "STBY" }),
|
|
1041
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Receiver, { name: "NAV", unit: "MHz", value: nav ?? innerNav, ident: navIdent, color, format: formatNav, parse: parseNav, onChange: changeNav }),
|
|
1042
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Receiver, { name: "ADF", unit: "kHz", value: adf ?? innerAdf, ident: adfIdent, color, format: formatAdf, parse: parseAdf, onChange: changeAdf }),
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: label, children: "DME" }),
|
|
1044
|
+
/* @__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: [
|
|
1045
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "data-testid": "radio-stack-dme", children: formatDme(dme) }),
|
|
1046
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { color: MUTED, fontFamily: "'Helvetica Neue', Arial, sans-serif", fontSize: "0.5em" }, children: "NM" })
|
|
1047
|
+
] })
|
|
1048
|
+
]
|
|
1049
|
+
}
|
|
1050
|
+
) })
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
// src/components/DataPanel.tsx
|
|
1055
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1056
|
+
var MAX_FIELDS = 6;
|
|
1057
|
+
var SIDE2 = 252;
|
|
714
1058
|
var PAD = 8;
|
|
715
1059
|
var GAP = 8;
|
|
716
|
-
var
|
|
1060
|
+
var ORIGIN2 = CENTER - SIDE2 / 2;
|
|
717
1061
|
var VALUE_SIZE = { 1: 52, 2: 36, 3: 27 };
|
|
718
1062
|
function formatValue(field) {
|
|
719
1063
|
if (typeof field.value === "string") return field.value;
|
|
@@ -724,24 +1068,24 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
724
1068
|
const shown = fields.slice(0, MAX_FIELDS);
|
|
725
1069
|
const cols = shown.length <= 2 ? 1 : 2;
|
|
726
1070
|
const rows = Math.max(1, Math.ceil(shown.length / cols));
|
|
727
|
-
const cellW = (
|
|
728
|
-
const cellH = (
|
|
1071
|
+
const cellW = (SIDE2 - PAD * 2 - GAP * (cols - 1)) / cols;
|
|
1072
|
+
const cellH = (SIDE2 - PAD * 2 - GAP * (rows - 1)) / rows;
|
|
729
1073
|
const valueSize = VALUE_SIZE[rows] ?? 27;
|
|
730
|
-
const
|
|
731
|
-
return /* @__PURE__ */ (0,
|
|
732
|
-
heading && /* @__PURE__ */ (0,
|
|
733
|
-
/* @__PURE__ */ (0,
|
|
1074
|
+
const label2 = `${heading ?? "Data panel"}: ` + (shown.length ? shown.map((f) => `${f.name} ${formatValue(f)}${f.unit ? ` ${f.unit}` : ""}`).join(", ") : "no data");
|
|
1075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
1076
|
+
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() }),
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x: ORIGIN2, y: ORIGIN2, width: SIDE2, height: SIDE2, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
734
1078
|
shown.map((f, i) => {
|
|
735
1079
|
const col = i % cols;
|
|
736
1080
|
const row = Math.floor(i / cols);
|
|
737
|
-
const x =
|
|
738
|
-
const y =
|
|
1081
|
+
const x = ORIGIN2 + PAD + col * (cellW + GAP);
|
|
1082
|
+
const y = ORIGIN2 + PAD + row * (cellH + GAP);
|
|
739
1083
|
const value = formatValue(f);
|
|
740
1084
|
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,
|
|
1085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { "data-testid": `data-field-${i}`, children: [
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x, y, width: cellW, height: cellH, rx: "6", fill: "#000", stroke: "#262a30", strokeWidth: "1" }),
|
|
1087
|
+
/* @__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() }),
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
745
1089
|
"text",
|
|
746
1090
|
{
|
|
747
1091
|
"data-testid": `data-value-${i}`,
|
|
@@ -756,25 +1100,25 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
756
1100
|
children: value
|
|
757
1101
|
}
|
|
758
1102
|
),
|
|
759
|
-
f.unit && /* @__PURE__ */ (0,
|
|
1103
|
+
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
1104
|
] }, i);
|
|
761
1105
|
})
|
|
762
1106
|
] });
|
|
763
1107
|
}
|
|
764
1108
|
|
|
765
1109
|
// src/components/FuelIndicator.tsx
|
|
766
|
-
var
|
|
1110
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
767
1111
|
var MAX_TANKS = 4;
|
|
768
1112
|
var GREEN2 = "#2ee05a";
|
|
769
1113
|
var RED = "#ff3b3b";
|
|
770
1114
|
var GREY = "#9aa4b1";
|
|
771
|
-
var
|
|
1115
|
+
var SIDE3 = 252;
|
|
772
1116
|
var PAD2 = 6;
|
|
773
|
-
var
|
|
774
|
-
var INNER_LEFT =
|
|
775
|
-
var INNER_W =
|
|
776
|
-
var FOOTER_Y =
|
|
777
|
-
var BAR_TOP =
|
|
1117
|
+
var ORIGIN3 = CENTER - SIDE3 / 2;
|
|
1118
|
+
var INNER_LEFT = ORIGIN3 + PAD2;
|
|
1119
|
+
var INNER_W = SIDE3 - PAD2 * 2;
|
|
1120
|
+
var FOOTER_Y = ORIGIN3 + SIDE3 - 36;
|
|
1121
|
+
var BAR_TOP = ORIGIN3 + 38;
|
|
778
1122
|
var BAR_H = 114;
|
|
779
1123
|
var BAR_BOTTOM = BAR_TOP + BAR_H;
|
|
780
1124
|
var DEFAULT_TANKS = [
|
|
@@ -787,7 +1131,7 @@ function FuelIndicator({
|
|
|
787
1131
|
unit = "gal",
|
|
788
1132
|
low,
|
|
789
1133
|
decimals = 1,
|
|
790
|
-
label = "FUEL",
|
|
1134
|
+
label: label2 = "FUEL",
|
|
791
1135
|
...props
|
|
792
1136
|
}) {
|
|
793
1137
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
@@ -805,17 +1149,17 @@ function FuelIndicator({
|
|
|
805
1149
|
const isLow = qty <= finite(low, cap * 0.1);
|
|
806
1150
|
return { name: t.name, qty, cap, fraction, full, isLow, text: full ? "FULL" : qty.toFixed(places) };
|
|
807
1151
|
});
|
|
808
|
-
const title = `${
|
|
809
|
-
return /* @__PURE__ */ (0,
|
|
810
|
-
/* @__PURE__ */ (0,
|
|
1152
|
+
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");
|
|
1153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: ORIGIN3, y: ORIGIN3, width: SIDE3, height: SIDE3, rx: "10", fill: "#000", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
811
1155
|
readings.map((r, i) => {
|
|
812
1156
|
const cx = INNER_LEFT + colW * (i + 0.5);
|
|
813
1157
|
const color = r.isLow ? RED : GREEN2;
|
|
814
1158
|
const tickX = cx - barW / 2 - 14;
|
|
815
|
-
return /* @__PURE__ */ (0,
|
|
816
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
817
|
-
/* @__PURE__ */ (0,
|
|
818
|
-
/* @__PURE__ */ (0,
|
|
1159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("g", { "data-testid": `fuel-tank-${i}`, children: [
|
|
1160
|
+
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" }),
|
|
1161
|
+
/* @__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() }),
|
|
1162
|
+
/* @__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
1163
|
"path",
|
|
820
1164
|
{
|
|
821
1165
|
d: `M ${tickX - 7} ${BAR_BOTTOM - f * BAR_H} h 7`,
|
|
@@ -823,9 +1167,9 @@ function FuelIndicator({
|
|
|
823
1167
|
},
|
|
824
1168
|
f
|
|
825
1169
|
)) }),
|
|
826
|
-
/* @__PURE__ */ (0,
|
|
827
|
-
/* @__PURE__ */ (0,
|
|
828
|
-
/* @__PURE__ */ (0,
|
|
1170
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: "#15181c" }),
|
|
1171
|
+
/* @__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 }) }),
|
|
1172
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
829
1173
|
"text",
|
|
830
1174
|
{
|
|
831
1175
|
"data-testid": `fuel-value-${i}`,
|
|
@@ -840,23 +1184,23 @@ function FuelIndicator({
|
|
|
840
1184
|
children: r.text
|
|
841
1185
|
}
|
|
842
1186
|
),
|
|
843
|
-
/* @__PURE__ */ (0,
|
|
1187
|
+
/* @__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
1188
|
] }, i);
|
|
845
1189
|
}),
|
|
846
|
-
/* @__PURE__ */ (0,
|
|
847
|
-
/* @__PURE__ */ (0,
|
|
1190
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: `M ${ORIGIN3 + 8} ${FOOTER_Y} H ${ORIGIN3 + SIDE3 - 8}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1191
|
+
/* @__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
1192
|
] });
|
|
849
1193
|
}
|
|
850
1194
|
|
|
851
1195
|
// src/components/EngineIndicator.tsx
|
|
852
|
-
var
|
|
1196
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
853
1197
|
var MAX_CYLINDERS = 6;
|
|
854
1198
|
var MAX_BAR_GAUGES = 4;
|
|
855
1199
|
var GREEN3 = "#5fe04a";
|
|
856
1200
|
var YELLOW = "#ffd400";
|
|
857
1201
|
var RED2 = "#ff3030";
|
|
858
1202
|
var BLUE = "#4fb7e8";
|
|
859
|
-
var
|
|
1203
|
+
var LABEL2 = "#b9c8e6";
|
|
860
1204
|
var LINE = "#8a8f99";
|
|
861
1205
|
var round2 = (n) => Math.round(n * 100) / 100;
|
|
862
1206
|
var DIAL_R = 182;
|
|
@@ -905,24 +1249,24 @@ function arcAt(cx, cy, r, a0, a1) {
|
|
|
905
1249
|
const [x1, y1] = polar(r, a1, cx, cy);
|
|
906
1250
|
return `M ${x0} ${y0} A ${r} ${r} 0 ${a1 - a0 > 180 ? 1 : 0} 1 ${x1} ${y1}`;
|
|
907
1251
|
}
|
|
908
|
-
function ArcGauge({ cx, label, g, duration, testId }) {
|
|
1252
|
+
function ArcGauge({ cx, label: label2, g, duration, testId }) {
|
|
909
1253
|
const span = g.max - g.min;
|
|
910
1254
|
const angle = (v) => round2(-ARC_SWEEP + 2 * ARC_SWEEP * clamp((v - g.min) / span, 0, 1));
|
|
911
|
-
const band = (from, to, color) => /* @__PURE__ */ (0,
|
|
1255
|
+
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
1256
|
const [tipX, tipY] = polar(ARC_R - 4, 0, cx, ARC_Y);
|
|
913
1257
|
const [lx, ly] = polar(ARC_R - 16, -7, cx, ARC_Y);
|
|
914
1258
|
const [rx, ry] = polar(ARC_R - 16, 7, cx, ARC_Y);
|
|
915
|
-
return /* @__PURE__ */ (0,
|
|
916
|
-
/* @__PURE__ */ (0,
|
|
1259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1260
|
+
/* @__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
1261
|
g.green && band(g.green[0], g.green[1], GREEN3),
|
|
918
1262
|
g.yellow && band(g.yellow[0], g.yellow[1], YELLOW),
|
|
919
1263
|
g.low !== void 0 && band(g.min, g.low, RED2),
|
|
920
1264
|
g.high !== void 0 && band(g.high, g.max, RED2),
|
|
921
|
-
/* @__PURE__ */ (0,
|
|
922
|
-
/* @__PURE__ */ (0,
|
|
923
|
-
/* @__PURE__ */ (0,
|
|
1265
|
+
/* @__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" }) }),
|
|
1266
|
+
/* @__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 }),
|
|
1267
|
+
/* @__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
1268
|
g.text,
|
|
925
|
-
g.unit && /* @__PURE__ */ (0,
|
|
1269
|
+
g.unit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { fontSize: "11", dx: "2", children: g.unit })
|
|
926
1270
|
] })
|
|
927
1271
|
] });
|
|
928
1272
|
}
|
|
@@ -930,30 +1274,30 @@ var BAR_X0 = 210;
|
|
|
930
1274
|
var BAR_X1 = 296;
|
|
931
1275
|
var BAR_ROW_H = 39;
|
|
932
1276
|
var BAR_TOP2 = 137;
|
|
933
|
-
function BarGauge({ top, g, label, duration, testId }) {
|
|
1277
|
+
function BarGauge({ top, g, label: label2, duration, testId }) {
|
|
934
1278
|
const y = top + 14;
|
|
935
1279
|
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,
|
|
1280
|
+
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 });
|
|
1281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1282
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${BAR_X0} ${y} H ${BAR_X1}`, stroke: "#fff", strokeWidth: "2" }),
|
|
1283
|
+
/* @__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
1284
|
g.green && seg(g.green[0], g.green[1], GREEN3),
|
|
941
1285
|
g.yellow && seg(g.yellow[0], g.yellow[1], YELLOW),
|
|
942
1286
|
g.low !== void 0 && seg(g.min, g.low, RED2),
|
|
943
1287
|
g.high !== void 0 && seg(g.high, g.max, RED2),
|
|
944
|
-
/* @__PURE__ */ (0,
|
|
945
|
-
/* @__PURE__ */ (0,
|
|
946
|
-
/* @__PURE__ */ (0,
|
|
947
|
-
g.unit && /* @__PURE__ */ (0,
|
|
1288
|
+
/* @__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" }) }),
|
|
1289
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: BAR_X0, y: top + 31, fill: LABEL2, fontSize: "13", fontWeight: "bold", dominantBaseline: "central", children: label2 }),
|
|
1290
|
+
/* @__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 }),
|
|
1291
|
+
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
1292
|
] });
|
|
949
1293
|
}
|
|
950
1294
|
function Tank({ x, fraction, duration, testId }) {
|
|
951
1295
|
const top = 304;
|
|
952
1296
|
const h = 40;
|
|
953
|
-
return /* @__PURE__ */ (0,
|
|
954
|
-
/* @__PURE__ */ (0,
|
|
955
|
-
/* @__PURE__ */ (0,
|
|
956
|
-
/* @__PURE__ */ (0,
|
|
1297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1298
|
+
/* @__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" }),
|
|
1299
|
+
/* @__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 }) }),
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: x - 5.5, y: top + h - 5, width: "11", height: "3", fill: RED2 })
|
|
957
1301
|
] });
|
|
958
1302
|
}
|
|
959
1303
|
var hottest = (values) => {
|
|
@@ -1009,7 +1353,7 @@ function EngineIndicator({
|
|
|
1009
1353
|
{ name: "EGT", value: egtMax, color: BLUE, x: 118 },
|
|
1010
1354
|
{ name: "TIT", value: hasTit ? tit : void 0, color: "#fff", x: 170 }
|
|
1011
1355
|
].filter((r) => r.value !== void 0);
|
|
1012
|
-
const
|
|
1356
|
+
const label2 = "Engine: " + [
|
|
1013
1357
|
power !== void 0 ? `power ${fmt(power)}%` : null,
|
|
1014
1358
|
`MAN ${man.text}${man.unit ? ` ${man.unit}` : ""}`,
|
|
1015
1359
|
`RPM ${speed.text}`,
|
|
@@ -1021,79 +1365,79 @@ function EngineIndicator({
|
|
|
1021
1365
|
fuelLeft !== void 0 || fuelRight !== void 0 ? `fuel ${fmt(fuelLeft)}/${fmt(fuelRight)} ${fuelUnit}` : null,
|
|
1022
1366
|
volts !== void 0 ? `${fmt(volts, 1)} V` : null
|
|
1023
1367
|
].filter(Boolean).join(", ");
|
|
1024
|
-
return /* @__PURE__ */ (0,
|
|
1025
|
-
power !== void 0 && /* @__PURE__ */ (0,
|
|
1026
|
-
/* @__PURE__ */ (0,
|
|
1368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(InstrumentFrame, { ...props, label: label2, children: [
|
|
1369
|
+
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: [
|
|
1370
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("tspan", { fill: LABEL2, fontSize: "11", children: [
|
|
1027
1371
|
"POWER",
|
|
1028
1372
|
" "
|
|
1029
1373
|
] }),
|
|
1030
1374
|
fmt(power),
|
|
1031
|
-
/* @__PURE__ */ (0,
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { fontSize: "11", children: "%" })
|
|
1032
1376
|
] }),
|
|
1033
|
-
/* @__PURE__ */ (0,
|
|
1034
|
-
/* @__PURE__ */ (0,
|
|
1035
|
-
/* @__PURE__ */ (0,
|
|
1036
|
-
/* @__PURE__ */ (0,
|
|
1037
|
-
/* @__PURE__ */ (0,
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1039
|
-
/* @__PURE__ */ (0,
|
|
1377
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArcGauge, { cx: 118, label: "MAN", g: man, duration, testId: "engine-man" }),
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArcGauge, { cx: 282, label: "RPM", g: speed, duration, testId: "engine-rpm" }),
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { stroke: LINE, strokeWidth: "1.5", children: [
|
|
1380
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: chord(133) }),
|
|
1381
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M 200 133 V 298" }),
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: chord(298) }),
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M 136 298 V 348 M 264 298 V 348" })
|
|
1040
1384
|
] }),
|
|
1041
|
-
/* @__PURE__ */ (0,
|
|
1042
|
-
/* @__PURE__ */ (0,
|
|
1385
|
+
/* @__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: [
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("text", { x: r.x, y: 144, fill: LABEL2, fontSize: "13", children: [
|
|
1043
1387
|
r.name,
|
|
1044
|
-
/* @__PURE__ */ (0,
|
|
1388
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { fontSize: "9", children: temperatureUnit })
|
|
1045
1389
|
] }),
|
|
1046
|
-
/* @__PURE__ */ (0,
|
|
1390
|
+
/* @__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
1391
|
] }, r.name)) }),
|
|
1048
|
-
/* @__PURE__ */ (0,
|
|
1049
|
-
columns > 0 && /* @__PURE__ */ (0,
|
|
1050
|
-
/* @__PURE__ */ (0,
|
|
1051
|
-
/* @__PURE__ */ (0,
|
|
1392
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M 40 178 H 190", stroke: LINE, strokeWidth: "1" }),
|
|
1393
|
+
columns > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: `M ${chartX0} ${limitY} H ${chartX1}`, stroke: RED2, strokeWidth: "1.5", strokeDasharray: "5 4" }),
|
|
1395
|
+
/* @__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
1396
|
Array.from({ length: cylinders }, (_, i) => {
|
|
1053
1397
|
const x0 = chartX0 + colW * i;
|
|
1054
1398
|
const mid = x0 + colW / 2;
|
|
1055
1399
|
const c = chtValues[i];
|
|
1056
1400
|
const e = egtValues[i];
|
|
1057
|
-
return /* @__PURE__ */ (0,
|
|
1058
|
-
c !== void 0 && /* @__PURE__ */ (0,
|
|
1059
|
-
e !== void 0 && /* @__PURE__ */ (0,
|
|
1060
|
-
/* @__PURE__ */ (0,
|
|
1401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1402
|
+
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 }) }),
|
|
1403
|
+
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 }) }),
|
|
1404
|
+
/* @__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
1405
|
] }, i);
|
|
1062
1406
|
}),
|
|
1063
|
-
hasTit && /* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
1407
|
+
hasTit && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1408
|
+
/* @__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" }) }),
|
|
1409
|
+
/* @__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
1410
|
] })
|
|
1067
1411
|
] }),
|
|
1068
|
-
bars.map((b, i) => /* @__PURE__ */ (0,
|
|
1069
|
-
i > 0 && /* @__PURE__ */ (0,
|
|
1070
|
-
/* @__PURE__ */ (0,
|
|
1412
|
+
bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { children: [
|
|
1413
|
+
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" }),
|
|
1414
|
+
/* @__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
1415
|
] }, b.label)),
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1416
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1417
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("text", { "data-testid": "engine-amps", x: 104, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1074
1418
|
fmt(amps),
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { fontSize: "11", dx: "2", children: "A" })
|
|
1076
1420
|
] }),
|
|
1077
|
-
/* @__PURE__ */ (0,
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1079
|
-
/* @__PURE__ */ (0,
|
|
1080
|
-
/* @__PURE__ */ (0,
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: 104, y: 338, fill: LABEL2, fontSize: "13", children: "ALT" }),
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Tank, { x: 152, fraction: left / cap, duration, testId: "engine-fuel-left" }),
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Tank, { x: 248, fraction: right / cap, duration, testId: "engine-fuel-right" }),
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("text", { "data-testid": "engine-fuel", x: 200, y: 316, fill: "#fff", fontSize: "20", children: [
|
|
1081
1425
|
fmt(left),
|
|
1082
|
-
/* @__PURE__ */ (0,
|
|
1426
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { dx: "14", children: fmt(right) })
|
|
1083
1427
|
] }),
|
|
1084
|
-
/* @__PURE__ */ (0,
|
|
1085
|
-
/* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1428
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: 200, y: 335, fill: LABEL2, fontSize: "13", children: "Fuel" }),
|
|
1429
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: 200, y: 348, fill: LABEL2, fontSize: "9", children: fuelUnit }),
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("text", { "data-testid": "engine-volts", x: 296, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1087
1431
|
fmt(volts, 1),
|
|
1088
|
-
/* @__PURE__ */ (0,
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tspan", { fontSize: "11", dx: "2", children: "V" })
|
|
1089
1433
|
] }),
|
|
1090
|
-
/* @__PURE__ */ (0,
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("text", { x: 296, y: 338, fill: LABEL2, fontSize: "13", children: "BATT" })
|
|
1091
1435
|
] })
|
|
1092
1436
|
] });
|
|
1093
1437
|
}
|
|
1094
1438
|
|
|
1095
1439
|
// src/components/FlapIndicator.tsx
|
|
1096
|
-
var
|
|
1440
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1097
1441
|
var GREEN4 = "#3ddc3d";
|
|
1098
1442
|
var YELLOW2 = "#ffd400";
|
|
1099
1443
|
var ORANGE = "#ff8a00";
|
|
@@ -1116,7 +1460,7 @@ function FlapIndicator({
|
|
|
1116
1460
|
segments = 20,
|
|
1117
1461
|
speedLimits,
|
|
1118
1462
|
airspeed,
|
|
1119
|
-
label = "WING FLAP",
|
|
1463
|
+
label: label2 = "WING FLAP",
|
|
1120
1464
|
...props
|
|
1121
1465
|
}) {
|
|
1122
1466
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
@@ -1131,13 +1475,13 @@ function FlapIndicator({
|
|
|
1131
1475
|
const ias = finite(airspeed, NaN);
|
|
1132
1476
|
const overspeed = limit !== void 0 && !Number.isNaN(ias) && ias > limit.speed;
|
|
1133
1477
|
const segH = BAR_H2 / count;
|
|
1134
|
-
const title = `${
|
|
1135
|
-
return /* @__PURE__ */ (0,
|
|
1136
|
-
/* @__PURE__ */ (0,
|
|
1478
|
+
const title = `${label2}: ${Math.round(position)}\xB0 of ${Math.round(full)}\xB0` + (limit ? `, max ${Math.round(limit.speed)} knots${overspeed ? " (overspeed)" : ""}` : "");
|
|
1479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1480
|
+
/* @__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
1481
|
Array.from({ length: count }, (_, i) => {
|
|
1138
1482
|
const y = BAR_TOP3 + i * segH;
|
|
1139
1483
|
const on = i < lit;
|
|
1140
|
-
return /* @__PURE__ */ (0,
|
|
1484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1141
1485
|
"rect",
|
|
1142
1486
|
{
|
|
1143
1487
|
"data-testid": `flap-segment-${i}`,
|
|
@@ -1154,26 +1498,26 @@ function FlapIndicator({
|
|
|
1154
1498
|
i
|
|
1155
1499
|
);
|
|
1156
1500
|
}),
|
|
1157
|
-
/* @__PURE__ */ (0,
|
|
1158
|
-
/* @__PURE__ */ (0,
|
|
1159
|
-
/* @__PURE__ */ (0,
|
|
1501
|
+
/* @__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: [
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: `M ${BAR_X + BAR_W / 2 + 8} ${yAt(d)} h 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: BAR_X + BAR_W / 2 + 22, y: yAt(d), children: d })
|
|
1160
1504
|
] }, d)) }),
|
|
1161
|
-
/* @__PURE__ */ (0,
|
|
1162
|
-
limit && /* @__PURE__ */ (0,
|
|
1163
|
-
/* @__PURE__ */ (0,
|
|
1505
|
+
/* @__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" }) }),
|
|
1506
|
+
limit && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("g", { textAnchor: "middle", dominantBaseline: "central", fill: overspeed ? RED3 : "#fff", children: [
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("text", { "data-testid": "flap-speed", x: 118, y: 176, fontSize: "36", fontWeight: "bold", children: [
|
|
1164
1508
|
Math.round(limit.speed),
|
|
1165
|
-
/* @__PURE__ */ (0,
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("tspan", { fontSize: "13", dx: "3", children: "KTS" })
|
|
1166
1510
|
] }),
|
|
1167
|
-
/* @__PURE__ */ (0,
|
|
1511
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: 118, y: 212, fontSize: "13", fontWeight: "bold", fill: "#bbb", letterSpacing: "2", children: "MAX" })
|
|
1168
1512
|
] }),
|
|
1169
|
-
/* @__PURE__ */ (0,
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("text", { x: CENTER, y: 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1170
1514
|
] });
|
|
1171
1515
|
}
|
|
1172
1516
|
|
|
1173
1517
|
// src/components/AoaIndicator.tsx
|
|
1174
|
-
var
|
|
1518
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1175
1519
|
var GREEN5 = "#3ddc3d";
|
|
1176
|
-
var
|
|
1520
|
+
var AMBER4 = "#ffb000";
|
|
1177
1521
|
var RED4 = "#ff2a2a";
|
|
1178
1522
|
var UNLIT_OPACITY = 0.15;
|
|
1179
1523
|
var ROWS = [
|
|
@@ -1182,10 +1526,10 @@ var ROWS = [
|
|
|
1182
1526
|
{ shape: "bar", color: GREEN5, y: 256 },
|
|
1183
1527
|
{ shape: "bar", color: GREEN5, y: 234 },
|
|
1184
1528
|
{ shape: "donut", color: GREEN5, y: 208 },
|
|
1185
|
-
{ shape: "bar", color:
|
|
1186
|
-
{ shape: "split", color:
|
|
1187
|
-
{ shape: "chevron", color:
|
|
1188
|
-
{ shape: "chevron", color:
|
|
1529
|
+
{ shape: "bar", color: AMBER4, y: 182 },
|
|
1530
|
+
{ shape: "split", color: AMBER4, y: 160 },
|
|
1531
|
+
{ shape: "chevron", color: AMBER4, y: 125 },
|
|
1532
|
+
{ shape: "chevron", color: AMBER4, y: 103 },
|
|
1189
1533
|
{ shape: "chevron", color: RED4, y: 74 },
|
|
1190
1534
|
{ shape: "chevron", color: RED4, y: 52 }
|
|
1191
1535
|
];
|
|
@@ -1199,23 +1543,23 @@ function RowShape({ shape, y }) {
|
|
|
1199
1543
|
const r = CENTER + HALF;
|
|
1200
1544
|
switch (shape) {
|
|
1201
1545
|
case "bar":
|
|
1202
|
-
return /* @__PURE__ */ (0,
|
|
1546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF * 2, height: BAR_H3, rx: "2" });
|
|
1203
1547
|
case "split":
|
|
1204
|
-
return /* @__PURE__ */ (0,
|
|
1205
|
-
/* @__PURE__ */ (0,
|
|
1206
|
-
/* @__PURE__ */ (0,
|
|
1548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
1549
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" }),
|
|
1550
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: r - 50, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" })
|
|
1207
1551
|
] });
|
|
1208
1552
|
case "donut":
|
|
1209
|
-
return /* @__PURE__ */ (0,
|
|
1210
|
-
/* @__PURE__ */ (0,
|
|
1211
|
-
/* @__PURE__ */ (0,
|
|
1212
|
-
/* @__PURE__ */ (0,
|
|
1553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
1554
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: l, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: CENTER + 24, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
1556
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: CENTER, cy: y, r: 13, fill: "none", strokeWidth: "7" })
|
|
1213
1557
|
] });
|
|
1214
1558
|
case "chevron":
|
|
1215
|
-
return /* @__PURE__ */ (0,
|
|
1559
|
+
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
1560
|
}
|
|
1217
1561
|
}
|
|
1218
|
-
function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label = "AOA", ...props }) {
|
|
1562
|
+
function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label: label2 = "AOA", ...props }) {
|
|
1219
1563
|
const lo = finite(min, 0);
|
|
1220
1564
|
const hi = Math.max(lo + 1e-6, finite(max, 20));
|
|
1221
1565
|
const opt = clamp(finite(optimum, (lo + hi) / 2), lo, hi);
|
|
@@ -1225,12 +1569,12 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1225
1569
|
const stall = lit === ROWS.length;
|
|
1226
1570
|
const reading = Number.isNaN(value) ? "---" : `${value.toFixed(1)}\xB0`;
|
|
1227
1571
|
const state = stall ? " (stall warning)" : lit > DONUT + 1 ? " (high)" : lit === DONUT + 1 ? " (optimum)" : "";
|
|
1228
|
-
const title = `${
|
|
1229
|
-
return /* @__PURE__ */ (0,
|
|
1230
|
-
/* @__PURE__ */ (0,
|
|
1572
|
+
const title = `${label2}: ${reading}${Number.isNaN(value) ? "" : state}`;
|
|
1573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(InstrumentFrame, { ...props, label: title, children: [
|
|
1574
|
+
/* @__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
1575
|
ROWS.map((row, i) => {
|
|
1232
1576
|
const on = i < lit;
|
|
1233
|
-
return /* @__PURE__ */ (0,
|
|
1577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1234
1578
|
"g",
|
|
1235
1579
|
{
|
|
1236
1580
|
"data-testid": `aoa-row-${i}`,
|
|
@@ -1241,19 +1585,20 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1241
1585
|
opacity: on ? 1 : UNLIT_OPACITY,
|
|
1242
1586
|
style: { transition: "opacity 150ms ease-out" },
|
|
1243
1587
|
children: [
|
|
1244
|
-
/* @__PURE__ */ (0,
|
|
1245
|
-
on && stall && row.shape === "chevron" && /* @__PURE__ */ (0,
|
|
1588
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RowShape, { shape: row.shape, y: row.y }),
|
|
1589
|
+
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
1590
|
]
|
|
1247
1591
|
},
|
|
1248
1592
|
i
|
|
1249
1593
|
);
|
|
1250
1594
|
}),
|
|
1251
|
-
showValue && /* @__PURE__ */ (0,
|
|
1252
|
-
/* @__PURE__ */ (0,
|
|
1595
|
+
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 }),
|
|
1596
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("text", { x: CENTER, y: showValue ? 362 : 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1253
1597
|
] });
|
|
1254
1598
|
}
|
|
1255
1599
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1256
1600
|
0 && (module.exports = {
|
|
1601
|
+
AdfIndicator,
|
|
1257
1602
|
Airspeed,
|
|
1258
1603
|
Altimeter,
|
|
1259
1604
|
AoaIndicator,
|
|
@@ -1270,11 +1615,19 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1270
1615
|
MAX_CYLINDERS,
|
|
1271
1616
|
MAX_FIELDS,
|
|
1272
1617
|
MAX_TANKS,
|
|
1618
|
+
RadioPanel,
|
|
1619
|
+
RadioStack,
|
|
1273
1620
|
TurnCoordinator,
|
|
1274
1621
|
VerticalSpeed,
|
|
1275
1622
|
VorIndicator,
|
|
1276
1623
|
WindIndicator,
|
|
1624
|
+
formatAdf,
|
|
1625
|
+
formatDme,
|
|
1626
|
+
formatNav,
|
|
1277
1627
|
formatValue,
|
|
1628
|
+
parseAdf,
|
|
1629
|
+
parseNav,
|
|
1630
|
+
relativeBearing,
|
|
1278
1631
|
vorDeviation
|
|
1279
1632
|
});
|
|
1280
1633
|
//# sourceMappingURL=index.cjs.map
|