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.js
CHANGED
|
@@ -66,7 +66,7 @@ function InstrumentFrame({
|
|
|
66
66
|
className,
|
|
67
67
|
style,
|
|
68
68
|
title,
|
|
69
|
-
label,
|
|
69
|
+
label: label2,
|
|
70
70
|
children
|
|
71
71
|
}) {
|
|
72
72
|
const titleId = useSvgId("fi-title");
|
|
@@ -84,7 +84,7 @@ function InstrumentFrame({
|
|
|
84
84
|
style: { display: "inline-block", userSelect: "none", ...style },
|
|
85
85
|
fontFamily: "'Helvetica Neue', Arial, sans-serif",
|
|
86
86
|
children: [
|
|
87
|
-
/* @__PURE__ */ jsx("title", { id: titleId, children: title ??
|
|
87
|
+
/* @__PURE__ */ jsx("title", { id: titleId, children: title ?? label2 }),
|
|
88
88
|
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: bezelId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
89
89
|
/* @__PURE__ */ jsx("stop", { offset: "0", stopColor: "#5a5a5a" }),
|
|
90
90
|
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#1a1a1a" })
|
|
@@ -188,7 +188,7 @@ function HeadingIndicator({ heading = 0, ...props }) {
|
|
|
188
188
|
/* @__PURE__ */ jsx3("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx3("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
189
189
|
range(0, 330, 30).map((a) => {
|
|
190
190
|
const [x, y] = polar(132, a);
|
|
191
|
-
const
|
|
191
|
+
const label2 = CARDINALS[a] ?? String(a / 10);
|
|
192
192
|
return /* @__PURE__ */ jsx3(
|
|
193
193
|
"text",
|
|
194
194
|
{
|
|
@@ -200,7 +200,7 @@ function HeadingIndicator({ heading = 0, ...props }) {
|
|
|
200
200
|
fontWeight: "bold",
|
|
201
201
|
textAnchor: "middle",
|
|
202
202
|
dominantBaseline: "central",
|
|
203
|
-
children:
|
|
203
|
+
children: label2
|
|
204
204
|
},
|
|
205
205
|
a
|
|
206
206
|
);
|
|
@@ -503,8 +503,8 @@ function WindIndicator({
|
|
|
503
503
|
const dirText = String(Math.round(norm(dir)) || 360).padStart(3, "0");
|
|
504
504
|
const windText = calm ? "CALM" : `${dirText}\xB0 ${Math.round(speed)}${hasGust ? `G${Math.round(gust)}` : ""}KT`;
|
|
505
505
|
const crossText = crosswind === 0 ? "0" : `${Math.abs(crosswind)}${crosswind > 0 ? "R" : "L"}`;
|
|
506
|
-
const
|
|
507
|
-
return /* @__PURE__ */ jsxs8(InstrumentFrame, { ...props, label, children: [
|
|
506
|
+
const label2 = `Wind: ${calm ? "calm" : `${dirText}\xB0 at ${Math.round(speed)}${hasGust ? ` gusting ${Math.round(gust)}` : ""} knots`}, runway ${activeNumber}${activeSide ?? ""} in use, ${headwind < 0 ? "tailwind" : "headwind"} ${Math.abs(headwind)}, crosswind ${Math.abs(crosswind)}${crosswind === 0 ? "" : crosswind > 0 ? " from the right" : " from the left"}`;
|
|
507
|
+
return /* @__PURE__ */ jsxs8(InstrumentFrame, { ...props, label: label2, children: [
|
|
508
508
|
/* @__PURE__ */ jsx8("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 350, 10).map((a) => /* @__PURE__ */ jsx8("path", { d: tickPath(176, a % 30 === 0 ? 162 : 168, a), strokeWidth: a % 30 === 0 ? 3 : 2, opacity: a % 30 === 0 ? 1 : 0.7 }, a)) }),
|
|
509
509
|
range(0, 330, 30).map((a) => {
|
|
510
510
|
const [x, y] = polar(146, a);
|
|
@@ -604,8 +604,8 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
604
604
|
const courseText = String(Math.round(norm2(crs)) || 360).padStart(3, "0");
|
|
605
605
|
const needleX = dev / FULL_SCALE_DEG * FULL_SCALE_PX;
|
|
606
606
|
const devText = Math.abs(dev) < 0.05 ? "centred" : `${Math.abs(dev).toFixed(1)}\xB0 ${dev > 0 ? "right" : "left"}`;
|
|
607
|
-
const
|
|
608
|
-
return /* @__PURE__ */ jsxs9(InstrumentFrame, { ...props, label, children: [
|
|
607
|
+
const label2 = signal ? `VOR indicator: course ${courseText}\xB0, needle ${devText}, ${flag === "OFF" ? "no TO/FROM indication" : flag}` : `VOR indicator: course ${courseText}\xB0, no signal`;
|
|
608
|
+
return /* @__PURE__ */ jsxs9(InstrumentFrame, { ...props, label: label2, children: [
|
|
609
609
|
/* @__PURE__ */ jsxs9("g", { "data-testid": "vor-card", style: motionStyle(`rotate(${-displayCourse}deg)`, duration), children: [
|
|
610
610
|
/* @__PURE__ */ jsx9("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx9("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
611
611
|
range(0, 330, 30).map((a) => {
|
|
@@ -661,13 +661,348 @@ function VorIndicator({ course = 0, radial, deviation, toFrom, signal = true, ..
|
|
|
661
661
|
] });
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
-
// src/components/
|
|
664
|
+
// src/components/AdfIndicator.tsx
|
|
665
665
|
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
666
|
-
var
|
|
666
|
+
var CARDINALS4 = { 0: "N", 90: "E", 180: "S", 270: "W" };
|
|
667
|
+
var AMBER3 = "#ffb000";
|
|
668
|
+
var NEEDLE = "#ffe14d";
|
|
669
|
+
var PARKED_DEG = 90;
|
|
670
|
+
var norm3 = (deg) => (deg % 360 + 360) % 360;
|
|
671
|
+
var pad3 = (deg) => String(Math.round(norm3(deg)) % 360).padStart(3, "0");
|
|
672
|
+
function relativeBearing(heading, bearingToStation) {
|
|
673
|
+
return norm3(finite(bearingToStation) - finite(heading));
|
|
674
|
+
}
|
|
675
|
+
function AdfIndicator({ bearing = 0, heading = 0, signal = true, ...props }) {
|
|
676
|
+
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
677
|
+
const rel = finite(bearing);
|
|
678
|
+
const hdg = finite(heading);
|
|
679
|
+
const displayCard = useContinuousAngle(hdg);
|
|
680
|
+
const displayNeedle = useContinuousAngle(signal ? rel : PARKED_DEG);
|
|
681
|
+
const label2 = signal ? `ADF indicator: station ${pad3(rel)}\xB0 relative, bearing ${pad3(rel + hdg)}\xB0 to station` : "ADF indicator: no signal";
|
|
682
|
+
return /* @__PURE__ */ jsxs10(InstrumentFrame, { ...props, label: label2, children: [
|
|
683
|
+
/* @__PURE__ */ jsxs10("g", { "data-testid": "adf-card", style: motionStyle(`rotate(${-displayCard}deg)`, duration), children: [
|
|
684
|
+
/* @__PURE__ */ jsx10("g", { stroke: "#fff", strokeLinecap: "round", children: range(0, 355, 5).map((a) => /* @__PURE__ */ jsx10("path", { d: tickPath(176, a % 10 === 0 ? 152 : 164, a), strokeWidth: a % 10 === 0 ? 3 : 2 }, a)) }),
|
|
685
|
+
range(0, 330, 30).map((a) => {
|
|
686
|
+
const [x, y] = polar(132, a);
|
|
687
|
+
return /* @__PURE__ */ jsx10(
|
|
688
|
+
"text",
|
|
689
|
+
{
|
|
690
|
+
x,
|
|
691
|
+
y,
|
|
692
|
+
transform: `rotate(${a} ${x} ${y})`,
|
|
693
|
+
fill: a % 90 === 0 ? AMBER3 : "#fff",
|
|
694
|
+
fontSize: a % 90 === 0 ? 28 : 24,
|
|
695
|
+
fontWeight: "bold",
|
|
696
|
+
textAnchor: "middle",
|
|
697
|
+
dominantBaseline: "central",
|
|
698
|
+
children: CARDINALS4[a] ?? String(a / 10)
|
|
699
|
+
},
|
|
700
|
+
a
|
|
701
|
+
);
|
|
702
|
+
})
|
|
703
|
+
] }),
|
|
704
|
+
/* @__PURE__ */ jsx10("path", { d: `M ${CENTER} ${CENTER - 150} l -10 -28 h 20 z`, fill: AMBER3, stroke: "#000", strokeWidth: "1.5" }),
|
|
705
|
+
/* @__PURE__ */ jsx10("g", { stroke: AMBER3, strokeWidth: "4", strokeLinecap: "round", children: [45, 90, 135, 180, 225, 270, 315].map((a) => /* @__PURE__ */ jsx10("path", { d: tickPath(192, 178, a) }, a)) }),
|
|
706
|
+
/* @__PURE__ */ jsxs10("g", { stroke: AMBER3, strokeWidth: "2", strokeLinecap: "round", opacity: "0.7", children: [
|
|
707
|
+
/* @__PURE__ */ jsx10("path", { d: `M ${CENTER - 26} ${CENTER} H ${CENTER + 26}` }),
|
|
708
|
+
/* @__PURE__ */ jsx10("path", { d: `M ${CENTER} ${CENTER - 26} V ${CENTER + 14}` })
|
|
709
|
+
] }),
|
|
710
|
+
/* @__PURE__ */ jsx10("text", { x: CENTER, y: CENTER + 62, fill: "#ccc", fontSize: "15", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: "ADF" }),
|
|
711
|
+
/* @__PURE__ */ jsxs10("g", { "data-testid": "adf-flag", opacity: signal ? 0 : 1, style: { transition: "opacity 200ms ease-out" }, children: [
|
|
712
|
+
/* @__PURE__ */ jsx10("rect", { x: CENTER - 28, y: CENTER - 76, width: "56", height: "24", rx: "3", fill: "#d42626", stroke: "#000", strokeWidth: "1.5" }),
|
|
713
|
+
/* @__PURE__ */ jsx10("text", { x: CENTER, y: CENTER - 63, fill: "#fff", fontSize: "15", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "ADF" })
|
|
714
|
+
] }),
|
|
715
|
+
/* @__PURE__ */ jsx10("g", { "data-testid": "adf-needle", style: motionStyle(`rotate(${displayNeedle}deg)`, duration), children: /* @__PURE__ */ jsx10(
|
|
716
|
+
"path",
|
|
717
|
+
{
|
|
718
|
+
d: `M ${CENTER} ${CENTER - 146} l -13 30 h 9 V ${CENTER + 140} h 8 V ${CENTER - 116} h 9 z`,
|
|
719
|
+
fill: NEEDLE,
|
|
720
|
+
stroke: "#000",
|
|
721
|
+
strokeWidth: "1.5",
|
|
722
|
+
strokeLinejoin: "round"
|
|
723
|
+
}
|
|
724
|
+
) }),
|
|
725
|
+
/* @__PURE__ */ jsx10(Hub, { r: 10 })
|
|
726
|
+
] });
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
// src/components/RadioPanel.tsx
|
|
730
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
667
731
|
var SIDE = 252;
|
|
732
|
+
var ORIGIN = CENTER - SIDE / 2;
|
|
733
|
+
var ROW_H = 60;
|
|
734
|
+
var ROW_GAP = 8;
|
|
735
|
+
var FIRST_ROW = ORIGIN + 32;
|
|
736
|
+
var LABEL_X = ORIGIN + 10;
|
|
737
|
+
var ACTIVE_X = ORIGIN + 48;
|
|
738
|
+
var DISPLAY_W = 88;
|
|
739
|
+
var STANDBY_X = ORIGIN + SIDE - 8 - DISPLAY_W;
|
|
740
|
+
var SWAP_X = (ACTIVE_X + DISPLAY_W + STANDBY_X) / 2;
|
|
741
|
+
var usable = (n) => typeof n === "number" && Number.isFinite(n) && n >= 0;
|
|
742
|
+
var formatNav = (mhz) => usable(mhz) ? mhz.toFixed(2) : "---.--";
|
|
743
|
+
var formatAdf = (khz) => usable(khz) ? Number.isInteger(khz) ? String(khz) : khz.toFixed(1) : "---";
|
|
744
|
+
var formatDme = (nm) => usable(nm) ? nm < 99.95 ? nm.toFixed(1) : nm.toFixed(0) : "--.-";
|
|
745
|
+
function Display({ x, y, width, value, color, testId, unit }) {
|
|
746
|
+
const h = ROW_H - 16;
|
|
747
|
+
return /* @__PURE__ */ jsxs11("g", { children: [
|
|
748
|
+
/* @__PURE__ */ jsx11("rect", { x, y: y + 8, width, height: h, rx: "5", fill: "#1a0d00", stroke: "#3a2a14", strokeWidth: "1.5" }),
|
|
749
|
+
/* @__PURE__ */ jsx11(
|
|
750
|
+
"text",
|
|
751
|
+
{
|
|
752
|
+
"data-testid": testId,
|
|
753
|
+
x: unit ? x + width - 40 : x + width / 2,
|
|
754
|
+
y: y + ROW_H / 2 + 1,
|
|
755
|
+
fill: color,
|
|
756
|
+
fontSize: unit ? 28 : 22,
|
|
757
|
+
fontFamily: "monospace",
|
|
758
|
+
fontWeight: "bold",
|
|
759
|
+
textAnchor: unit ? "end" : "middle",
|
|
760
|
+
dominantBaseline: "central",
|
|
761
|
+
children: value
|
|
762
|
+
}
|
|
763
|
+
),
|
|
764
|
+
unit && /* @__PURE__ */ jsx11("text", { x: x + width - 10, y: y + ROW_H / 2 + 5, fill: "#9aa4b1", fontSize: "13", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: unit })
|
|
765
|
+
] });
|
|
766
|
+
}
|
|
767
|
+
function Swap({ y }) {
|
|
768
|
+
const cy = y + ROW_H / 2;
|
|
769
|
+
return /* @__PURE__ */ jsxs11("g", { stroke: "#9aa4b1", strokeWidth: "1.8", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
770
|
+
/* @__PURE__ */ jsx11("path", { d: `M ${SWAP_X - 7} ${cy - 4} H ${SWAP_X + 7} m -4 -3 l 4 3 l -4 3` }),
|
|
771
|
+
/* @__PURE__ */ jsx11("path", { d: `M ${SWAP_X + 7} ${cy + 4} H ${SWAP_X - 7} m 4 -3 l -4 3 l 4 3` })
|
|
772
|
+
] });
|
|
773
|
+
}
|
|
774
|
+
function RowLabel({ y, children }) {
|
|
775
|
+
return /* @__PURE__ */ jsx11("text", { x: LABEL_X, y: y + ROW_H / 2 + 1, fill: "#ccc", fontSize: "14", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children });
|
|
776
|
+
}
|
|
777
|
+
function RadioPanel({ nav, adf, dme, color = "#ff9a2e", ...props }) {
|
|
778
|
+
const rows = [
|
|
779
|
+
{ key: "nav", name: "NAV", unit: "MHz", active: formatNav(nav?.active), standby: formatNav(nav?.standby), tuned: usable(nav?.active) },
|
|
780
|
+
{ key: "adf", name: "ADF", unit: "kHz", active: formatAdf(adf?.active), standby: formatAdf(adf?.standby), tuned: usable(adf?.active) }
|
|
781
|
+
];
|
|
782
|
+
const dmeText = formatDme(dme);
|
|
783
|
+
const dmeY = FIRST_ROW + 2 * (ROW_H + ROW_GAP);
|
|
784
|
+
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"}`;
|
|
785
|
+
return /* @__PURE__ */ jsxs11(InstrumentFrame, { ...props, label: label2, children: [
|
|
786
|
+
/* @__PURE__ */ jsx11("rect", { x: ORIGIN, y: ORIGIN, width: SIDE, height: SIDE, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
787
|
+
/* @__PURE__ */ jsxs11("g", { fill: "#9aa4b1", fontSize: "11", fontWeight: "bold", letterSpacing: "1.5", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
788
|
+
/* @__PURE__ */ jsx11("text", { x: ACTIVE_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "ACTIVE" }),
|
|
789
|
+
/* @__PURE__ */ jsx11("text", { x: STANDBY_X + DISPLAY_W / 2, y: ORIGIN + 22, children: "STBY" })
|
|
790
|
+
] }),
|
|
791
|
+
rows.map((r, i) => {
|
|
792
|
+
const y = FIRST_ROW + i * (ROW_H + ROW_GAP);
|
|
793
|
+
return /* @__PURE__ */ jsxs11("g", { children: [
|
|
794
|
+
/* @__PURE__ */ jsx11(RowLabel, { y, children: r.name }),
|
|
795
|
+
/* @__PURE__ */ jsx11(Display, { x: ACTIVE_X, y, width: DISPLAY_W, value: r.active, color, testId: `radio-${r.key}-active` }),
|
|
796
|
+
/* @__PURE__ */ jsx11(Swap, { y }),
|
|
797
|
+
/* @__PURE__ */ jsx11(Display, { x: STANDBY_X, y, width: DISPLAY_W, value: r.standby, color, testId: `radio-${r.key}-standby` })
|
|
798
|
+
] }, r.key);
|
|
799
|
+
}),
|
|
800
|
+
/* @__PURE__ */ jsx11(RowLabel, { y: dmeY, children: "DME" }),
|
|
801
|
+
/* @__PURE__ */ jsx11(Display, { x: ACTIVE_X, y: dmeY, width: STANDBY_X + DISPLAY_W - ACTIVE_X, value: dmeText, color, testId: "radio-dme", unit: "NM" })
|
|
802
|
+
] });
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// src/components/RadioStack.tsx
|
|
806
|
+
import { useState } from "react";
|
|
807
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
808
|
+
var parseNav = (text) => {
|
|
809
|
+
const mhz = Math.round(Number.parseFloat(text.replace(",", ".")) * 100) / 100;
|
|
810
|
+
return mhz >= 108 && mhz <= 117.95 ? mhz : void 0;
|
|
811
|
+
};
|
|
812
|
+
var parseAdf = (text) => {
|
|
813
|
+
const khz = Math.round(Number.parseFloat(text.replace(",", ".")) * 10) / 10;
|
|
814
|
+
return khz >= 190 && khz <= 1750 ? khz : void 0;
|
|
815
|
+
};
|
|
816
|
+
var MONO = "ui-monospace, 'SF Mono', Menlo, Consolas, monospace";
|
|
817
|
+
var LABEL = "#ccc";
|
|
818
|
+
var MUTED = "#9aa4b1";
|
|
819
|
+
var display = {
|
|
820
|
+
boxSizing: "border-box",
|
|
821
|
+
width: "100%",
|
|
822
|
+
minWidth: 0,
|
|
823
|
+
height: "2.1em",
|
|
824
|
+
margin: 0,
|
|
825
|
+
padding: "0 0.1em",
|
|
826
|
+
borderRadius: "0.25em",
|
|
827
|
+
border: "0.08em solid #3a2a14",
|
|
828
|
+
background: "#1a0d00",
|
|
829
|
+
fontFamily: MONO,
|
|
830
|
+
fontSize: "1.2em",
|
|
831
|
+
fontWeight: "bold",
|
|
832
|
+
lineHeight: "2em",
|
|
833
|
+
textAlign: "center",
|
|
834
|
+
whiteSpace: "nowrap",
|
|
835
|
+
overflow: "hidden"
|
|
836
|
+
};
|
|
837
|
+
var label = { display: "flex", flexDirection: "column", justifyContent: "center", color: LABEL, fontWeight: "bold", letterSpacing: "0.06em", lineHeight: 1.15 };
|
|
838
|
+
var ident = { color: "#3cc8ff", fontSize: "0.72em", fontFamily: MONO, minHeight: "1.15em" };
|
|
839
|
+
function SwapIcon() {
|
|
840
|
+
return /* @__PURE__ */ jsxs12("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
841
|
+
/* @__PURE__ */ jsx12("path", { d: "M2 5.5 H14 M11 2.5 l3 3 l-3 3" }),
|
|
842
|
+
/* @__PURE__ */ jsx12("path", { d: "M14 10.5 H2 M5 7.5 l-3 3 l3 3" })
|
|
843
|
+
] });
|
|
844
|
+
}
|
|
845
|
+
function Receiver({ name, unit, value, ident: station, color, format, parse, onChange }) {
|
|
846
|
+
const [draft, setDraft] = useState(null);
|
|
847
|
+
const [focused, setFocused] = useState(false);
|
|
848
|
+
const [invalid, setInvalid] = useState(false);
|
|
849
|
+
const key = name.toLowerCase();
|
|
850
|
+
const shown = value.standby === void 0 ? "" : format(value.standby);
|
|
851
|
+
const swap = (standby = value.standby) => onChange({ active: standby, standby: value.active });
|
|
852
|
+
const onKeyDown = (e) => {
|
|
853
|
+
if (e.key === "Escape") {
|
|
854
|
+
setDraft(null);
|
|
855
|
+
setInvalid(false);
|
|
856
|
+
}
|
|
857
|
+
if (e.key !== "Enter") return;
|
|
858
|
+
e.preventDefault();
|
|
859
|
+
const text = (draft ?? shown).trim();
|
|
860
|
+
const standby = text ? parse(text) : void 0;
|
|
861
|
+
if (text && standby === void 0) return setInvalid(true);
|
|
862
|
+
setDraft(null);
|
|
863
|
+
setInvalid(false);
|
|
864
|
+
swap(standby);
|
|
865
|
+
};
|
|
866
|
+
const onBlur = () => {
|
|
867
|
+
setFocused(false);
|
|
868
|
+
setInvalid(false);
|
|
869
|
+
if (draft === null) return;
|
|
870
|
+
const text = draft.trim();
|
|
871
|
+
const standby = text ? parse(text) : void 0;
|
|
872
|
+
setDraft(null);
|
|
873
|
+
if (text && standby === void 0 || standby === value.standby) return;
|
|
874
|
+
onChange({ active: value.active, standby });
|
|
875
|
+
};
|
|
876
|
+
return /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
877
|
+
/* @__PURE__ */ jsxs12("div", { style: label, children: [
|
|
878
|
+
/* @__PURE__ */ jsx12("span", { children: name }),
|
|
879
|
+
/* @__PURE__ */ jsx12("span", { "data-testid": `radio-stack-${key}-ident`, style: ident, children: station ?? "" })
|
|
880
|
+
] }),
|
|
881
|
+
/* @__PURE__ */ jsx12("div", { "data-testid": `radio-stack-${key}-active`, "aria-label": `${name} active frequency`, style: { ...display, color }, children: format(value.active) }),
|
|
882
|
+
/* @__PURE__ */ jsx12(
|
|
883
|
+
"button",
|
|
884
|
+
{
|
|
885
|
+
type: "button",
|
|
886
|
+
onClick: () => swap(),
|
|
887
|
+
"aria-label": `Swap ${name} active and standby`,
|
|
888
|
+
title: "Swap active and standby",
|
|
889
|
+
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" },
|
|
890
|
+
children: /* @__PURE__ */ jsx12(SwapIcon, {})
|
|
891
|
+
}
|
|
892
|
+
),
|
|
893
|
+
/* @__PURE__ */ jsx12(
|
|
894
|
+
"input",
|
|
895
|
+
{
|
|
896
|
+
type: "text",
|
|
897
|
+
inputMode: "decimal",
|
|
898
|
+
autoComplete: "off",
|
|
899
|
+
spellCheck: false,
|
|
900
|
+
"data-testid": `radio-stack-${key}-standby`,
|
|
901
|
+
"aria-label": `${name} standby frequency (${unit})`,
|
|
902
|
+
"aria-invalid": invalid || void 0,
|
|
903
|
+
placeholder: format(void 0),
|
|
904
|
+
value: draft ?? shown,
|
|
905
|
+
onChange: (e) => {
|
|
906
|
+
setDraft(e.target.value);
|
|
907
|
+
setInvalid(false);
|
|
908
|
+
},
|
|
909
|
+
onFocus: (e) => {
|
|
910
|
+
setFocused(true);
|
|
911
|
+
e.target.select();
|
|
912
|
+
},
|
|
913
|
+
onBlur,
|
|
914
|
+
onKeyDown,
|
|
915
|
+
style: { ...display, color, outline: "none", borderColor: invalid ? "#ff4d4d" : focused ? color : "#3a2a14", cursor: "text" }
|
|
916
|
+
}
|
|
917
|
+
)
|
|
918
|
+
] });
|
|
919
|
+
}
|
|
920
|
+
var SCREWS2 = [
|
|
921
|
+
{ top: "0.3em", left: "0.3em" },
|
|
922
|
+
{ top: "0.3em", right: "0.3em" },
|
|
923
|
+
{ bottom: "0.3em", left: "0.3em" },
|
|
924
|
+
{ bottom: "0.3em", right: "0.3em" }
|
|
925
|
+
];
|
|
926
|
+
function RadioStack({
|
|
927
|
+
nav,
|
|
928
|
+
adf,
|
|
929
|
+
defaultNav,
|
|
930
|
+
defaultAdf,
|
|
931
|
+
onNavChange,
|
|
932
|
+
onAdfChange,
|
|
933
|
+
navIdent,
|
|
934
|
+
adfIdent,
|
|
935
|
+
dme,
|
|
936
|
+
color = "#ff9a2e",
|
|
937
|
+
width = 320,
|
|
938
|
+
className,
|
|
939
|
+
style,
|
|
940
|
+
title = "Radio panel"
|
|
941
|
+
}) {
|
|
942
|
+
const [innerNav, setInnerNav] = useState(defaultNav ?? {});
|
|
943
|
+
const [innerAdf, setInnerAdf] = useState(defaultAdf ?? {});
|
|
944
|
+
const changeNav = (next) => {
|
|
945
|
+
if (nav === void 0) setInnerNav(next);
|
|
946
|
+
onNavChange?.(next);
|
|
947
|
+
};
|
|
948
|
+
const changeAdf = (next) => {
|
|
949
|
+
if (adf === void 0) setInnerAdf(next);
|
|
950
|
+
onAdfChange?.(next);
|
|
951
|
+
};
|
|
952
|
+
const heading = { color: MUTED, fontSize: "0.72em", fontWeight: "bold", letterSpacing: "0.12em", textAlign: "center" };
|
|
953
|
+
return (
|
|
954
|
+
// The outer box is a size container so every inner measurement can follow the width.
|
|
955
|
+
/* @__PURE__ */ jsx12("div", { className, style: { display: "inline-block", width, maxWidth: "100%", verticalAlign: "top", containerType: "inline-size", ...style }, children: /* @__PURE__ */ jsxs12(
|
|
956
|
+
"div",
|
|
957
|
+
{
|
|
958
|
+
role: "group",
|
|
959
|
+
"aria-label": title,
|
|
960
|
+
style: {
|
|
961
|
+
position: "relative",
|
|
962
|
+
boxSizing: "border-box",
|
|
963
|
+
display: "grid",
|
|
964
|
+
gridTemplateColumns: "2.6em minmax(0, 1fr) 2.4em minmax(0, 1fr)",
|
|
965
|
+
gap: "0.5em 0.4em",
|
|
966
|
+
alignItems: "center",
|
|
967
|
+
padding: "1.1em 1.2em 1.2em",
|
|
968
|
+
borderRadius: "0.9em",
|
|
969
|
+
border: "0.15em solid #0d0d0d",
|
|
970
|
+
background: "#232323",
|
|
971
|
+
color: LABEL,
|
|
972
|
+
fontFamily: "'Helvetica Neue', Arial, sans-serif",
|
|
973
|
+
fontSize: "5cqw",
|
|
974
|
+
textAlign: "left",
|
|
975
|
+
userSelect: "none"
|
|
976
|
+
},
|
|
977
|
+
children: [
|
|
978
|
+
SCREWS2.map((position, i) => /* @__PURE__ */ jsxs12("svg", { viewBox: "-14 -14 28 28", "aria-hidden": "true", style: { position: "absolute", width: "0.75em", height: "0.75em", ...position }, children: [
|
|
979
|
+
/* @__PURE__ */ jsx12("circle", { r: "12", fill: "#3a3a3a", stroke: "#111", strokeWidth: "2" }),
|
|
980
|
+
/* @__PURE__ */ jsx12("path", { d: "M -8 3 L 8 -3", stroke: "#111", strokeWidth: "3" })
|
|
981
|
+
] }, i)),
|
|
982
|
+
/* @__PURE__ */ jsx12("span", {}),
|
|
983
|
+
/* @__PURE__ */ jsx12("span", { style: heading, children: "ACTIVE" }),
|
|
984
|
+
/* @__PURE__ */ jsx12("span", {}),
|
|
985
|
+
/* @__PURE__ */ jsx12("span", { style: heading, children: "STBY" }),
|
|
986
|
+
/* @__PURE__ */ jsx12(Receiver, { name: "NAV", unit: "MHz", value: nav ?? innerNav, ident: navIdent, color, format: formatNav, parse: parseNav, onChange: changeNav }),
|
|
987
|
+
/* @__PURE__ */ jsx12(Receiver, { name: "ADF", unit: "kHz", value: adf ?? innerAdf, ident: adfIdent, color, format: formatAdf, parse: parseAdf, onChange: changeAdf }),
|
|
988
|
+
/* @__PURE__ */ jsx12("div", { style: label, children: "DME" }),
|
|
989
|
+
/* @__PURE__ */ jsxs12("div", { "aria-label": "DME distance", style: { ...display, gridColumn: "span 3", display: "flex", alignItems: "baseline", justifyContent: "flex-end", gap: "0.4em", padding: "0 0.5em", color }, children: [
|
|
990
|
+
/* @__PURE__ */ jsx12("span", { "data-testid": "radio-stack-dme", children: formatDme(dme) }),
|
|
991
|
+
/* @__PURE__ */ jsx12("span", { style: { color: MUTED, fontFamily: "'Helvetica Neue', Arial, sans-serif", fontSize: "0.5em" }, children: "NM" })
|
|
992
|
+
] })
|
|
993
|
+
]
|
|
994
|
+
}
|
|
995
|
+
) })
|
|
996
|
+
);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
// src/components/DataPanel.tsx
|
|
1000
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1001
|
+
var MAX_FIELDS = 6;
|
|
1002
|
+
var SIDE2 = 252;
|
|
668
1003
|
var PAD = 8;
|
|
669
1004
|
var GAP = 8;
|
|
670
|
-
var
|
|
1005
|
+
var ORIGIN2 = CENTER - SIDE2 / 2;
|
|
671
1006
|
var VALUE_SIZE = { 1: 52, 2: 36, 3: 27 };
|
|
672
1007
|
function formatValue(field) {
|
|
673
1008
|
if (typeof field.value === "string") return field.value;
|
|
@@ -678,24 +1013,24 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
678
1013
|
const shown = fields.slice(0, MAX_FIELDS);
|
|
679
1014
|
const cols = shown.length <= 2 ? 1 : 2;
|
|
680
1015
|
const rows = Math.max(1, Math.ceil(shown.length / cols));
|
|
681
|
-
const cellW = (
|
|
682
|
-
const cellH = (
|
|
1016
|
+
const cellW = (SIDE2 - PAD * 2 - GAP * (cols - 1)) / cols;
|
|
1017
|
+
const cellH = (SIDE2 - PAD * 2 - GAP * (rows - 1)) / rows;
|
|
683
1018
|
const valueSize = VALUE_SIZE[rows] ?? 27;
|
|
684
|
-
const
|
|
685
|
-
return /* @__PURE__ */
|
|
686
|
-
heading && /* @__PURE__ */
|
|
687
|
-
/* @__PURE__ */
|
|
1019
|
+
const label2 = `${heading ?? "Data panel"}: ` + (shown.length ? shown.map((f) => `${f.name} ${formatValue(f)}${f.unit ? ` ${f.unit}` : ""}`).join(", ") : "no data");
|
|
1020
|
+
return /* @__PURE__ */ jsxs13(InstrumentFrame, { ...props, label: label2, children: [
|
|
1021
|
+
heading && /* @__PURE__ */ jsx13("text", { x: CENTER, y: ORIGIN2 - 14, fill: "#ccc", fontSize: "13", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: heading.toUpperCase() }),
|
|
1022
|
+
/* @__PURE__ */ jsx13("rect", { x: ORIGIN2, y: ORIGIN2, width: SIDE2, height: SIDE2, rx: "10", fill: "#1c1f24", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
688
1023
|
shown.map((f, i) => {
|
|
689
1024
|
const col = i % cols;
|
|
690
1025
|
const row = Math.floor(i / cols);
|
|
691
|
-
const x =
|
|
692
|
-
const y =
|
|
1026
|
+
const x = ORIGIN2 + PAD + col * (cellW + GAP);
|
|
1027
|
+
const y = ORIGIN2 + PAD + row * (cellH + GAP);
|
|
693
1028
|
const value = formatValue(f);
|
|
694
1029
|
const fit = Math.min(valueSize, (cellW - 16) / (0.62 * Math.max(1, value.length)));
|
|
695
|
-
return /* @__PURE__ */
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
1030
|
+
return /* @__PURE__ */ jsxs13("g", { "data-testid": `data-field-${i}`, children: [
|
|
1031
|
+
/* @__PURE__ */ jsx13("rect", { x, y, width: cellW, height: cellH, rx: "6", fill: "#000", stroke: "#262a30", strokeWidth: "1" }),
|
|
1032
|
+
/* @__PURE__ */ jsx13("text", { x: x + 8, y: y + 12, fill: "#9aa4b1", fontSize: "12", fontWeight: "bold", letterSpacing: "1", dominantBaseline: "central", children: f.name.toUpperCase() }),
|
|
1033
|
+
/* @__PURE__ */ jsx13(
|
|
699
1034
|
"text",
|
|
700
1035
|
{
|
|
701
1036
|
"data-testid": `data-value-${i}`,
|
|
@@ -710,25 +1045,25 @@ function DataPanel({ fields = [], heading, ...props }) {
|
|
|
710
1045
|
children: value
|
|
711
1046
|
}
|
|
712
1047
|
),
|
|
713
|
-
f.unit && /* @__PURE__ */
|
|
1048
|
+
f.unit && /* @__PURE__ */ jsx13("text", { x: x + cellW - 8, y: y + cellH - 12, fill: "#9aa4b1", fontSize: "12", textAnchor: "end", dominantBaseline: "central", children: f.unit })
|
|
714
1049
|
] }, i);
|
|
715
1050
|
})
|
|
716
1051
|
] });
|
|
717
1052
|
}
|
|
718
1053
|
|
|
719
1054
|
// src/components/FuelIndicator.tsx
|
|
720
|
-
import { jsx as
|
|
1055
|
+
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
721
1056
|
var MAX_TANKS = 4;
|
|
722
1057
|
var GREEN2 = "#2ee05a";
|
|
723
1058
|
var RED = "#ff3b3b";
|
|
724
1059
|
var GREY = "#9aa4b1";
|
|
725
|
-
var
|
|
1060
|
+
var SIDE3 = 252;
|
|
726
1061
|
var PAD2 = 6;
|
|
727
|
-
var
|
|
728
|
-
var INNER_LEFT =
|
|
729
|
-
var INNER_W =
|
|
730
|
-
var FOOTER_Y =
|
|
731
|
-
var BAR_TOP =
|
|
1062
|
+
var ORIGIN3 = CENTER - SIDE3 / 2;
|
|
1063
|
+
var INNER_LEFT = ORIGIN3 + PAD2;
|
|
1064
|
+
var INNER_W = SIDE3 - PAD2 * 2;
|
|
1065
|
+
var FOOTER_Y = ORIGIN3 + SIDE3 - 36;
|
|
1066
|
+
var BAR_TOP = ORIGIN3 + 38;
|
|
732
1067
|
var BAR_H = 114;
|
|
733
1068
|
var BAR_BOTTOM = BAR_TOP + BAR_H;
|
|
734
1069
|
var DEFAULT_TANKS = [
|
|
@@ -741,7 +1076,7 @@ function FuelIndicator({
|
|
|
741
1076
|
unit = "gal",
|
|
742
1077
|
low,
|
|
743
1078
|
decimals = 1,
|
|
744
|
-
label = "FUEL",
|
|
1079
|
+
label: label2 = "FUEL",
|
|
745
1080
|
...props
|
|
746
1081
|
}) {
|
|
747
1082
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
@@ -759,17 +1094,17 @@ function FuelIndicator({
|
|
|
759
1094
|
const isLow = qty <= finite(low, cap * 0.1);
|
|
760
1095
|
return { name: t.name, qty, cap, fraction, full, isLow, text: full ? "FULL" : qty.toFixed(places) };
|
|
761
1096
|
});
|
|
762
|
-
const title = `${
|
|
763
|
-
return /* @__PURE__ */
|
|
764
|
-
/* @__PURE__ */
|
|
1097
|
+
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");
|
|
1098
|
+
return /* @__PURE__ */ jsxs14(InstrumentFrame, { ...props, label: title, children: [
|
|
1099
|
+
/* @__PURE__ */ jsx14("rect", { x: ORIGIN3, y: ORIGIN3, width: SIDE3, height: SIDE3, rx: "10", fill: "#000", stroke: "#3a3f47", strokeWidth: "2" }),
|
|
765
1100
|
readings.map((r, i) => {
|
|
766
1101
|
const cx = INNER_LEFT + colW * (i + 0.5);
|
|
767
1102
|
const color = r.isLow ? RED : GREEN2;
|
|
768
1103
|
const tickX = cx - barW / 2 - 14;
|
|
769
|
-
return /* @__PURE__ */
|
|
770
|
-
i > 0 && /* @__PURE__ */
|
|
771
|
-
/* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
1104
|
+
return /* @__PURE__ */ jsxs14("g", { "data-testid": `fuel-tank-${i}`, children: [
|
|
1105
|
+
i > 0 && /* @__PURE__ */ jsx14("path", { d: `M ${INNER_LEFT + colW * i} ${ORIGIN3 + 10} V ${FOOTER_Y}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1106
|
+
/* @__PURE__ */ jsx14("text", { x: cx, y: ORIGIN3 + 22, fill: "#fff", fontSize: Math.min(17, colW / 5), fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: r.name.toUpperCase() }),
|
|
1107
|
+
/* @__PURE__ */ jsx14("g", { strokeWidth: "2.5", strokeLinecap: "round", children: [0, 0.25, 0.5, 0.75, 1].map((f) => /* @__PURE__ */ jsx14(
|
|
773
1108
|
"path",
|
|
774
1109
|
{
|
|
775
1110
|
d: `M ${tickX - 7} ${BAR_BOTTOM - f * BAR_H} h 7`,
|
|
@@ -777,9 +1112,9 @@ function FuelIndicator({
|
|
|
777
1112
|
},
|
|
778
1113
|
f
|
|
779
1114
|
)) }),
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
1115
|
+
/* @__PURE__ */ jsx14("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: "#15181c" }),
|
|
1116
|
+
/* @__PURE__ */ jsx14("g", { "data-testid": `fuel-bar-${i}`, style: motionStyle(`scaleY(${r.fraction})`, duration, cx, BAR_BOTTOM), children: /* @__PURE__ */ jsx14("rect", { x: cx - barW / 2, y: BAR_TOP, width: barW, height: BAR_H, fill: color }) }),
|
|
1117
|
+
/* @__PURE__ */ jsx14(
|
|
783
1118
|
"text",
|
|
784
1119
|
{
|
|
785
1120
|
"data-testid": `fuel-value-${i}`,
|
|
@@ -794,23 +1129,23 @@ function FuelIndicator({
|
|
|
794
1129
|
children: r.text
|
|
795
1130
|
}
|
|
796
1131
|
),
|
|
797
|
-
/* @__PURE__ */
|
|
1132
|
+
/* @__PURE__ */ jsx14("text", { x: cx, y: BAR_BOTTOM + 44, fill: "#fff", fontSize: "13", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: unit })
|
|
798
1133
|
] }, i);
|
|
799
1134
|
}),
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
1135
|
+
/* @__PURE__ */ jsx14("path", { d: `M ${ORIGIN3 + 8} ${FOOTER_Y} H ${ORIGIN3 + SIDE3 - 8}`, stroke: "#555", strokeWidth: "1.5" }),
|
|
1136
|
+
/* @__PURE__ */ jsx14("text", { x: CENTER, y: FOOTER_Y + 19, fill: "#fff", fontSize: "24", fontWeight: "bold", letterSpacing: "2", textAnchor: "middle", dominantBaseline: "central", children: label2.toUpperCase() })
|
|
802
1137
|
] });
|
|
803
1138
|
}
|
|
804
1139
|
|
|
805
1140
|
// src/components/EngineIndicator.tsx
|
|
806
|
-
import { jsx as
|
|
1141
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
807
1142
|
var MAX_CYLINDERS = 6;
|
|
808
1143
|
var MAX_BAR_GAUGES = 4;
|
|
809
1144
|
var GREEN3 = "#5fe04a";
|
|
810
1145
|
var YELLOW = "#ffd400";
|
|
811
1146
|
var RED2 = "#ff3030";
|
|
812
1147
|
var BLUE = "#4fb7e8";
|
|
813
|
-
var
|
|
1148
|
+
var LABEL2 = "#b9c8e6";
|
|
814
1149
|
var LINE = "#8a8f99";
|
|
815
1150
|
var round2 = (n) => Math.round(n * 100) / 100;
|
|
816
1151
|
var DIAL_R = 182;
|
|
@@ -859,24 +1194,24 @@ function arcAt(cx, cy, r, a0, a1) {
|
|
|
859
1194
|
const [x1, y1] = polar(r, a1, cx, cy);
|
|
860
1195
|
return `M ${x0} ${y0} A ${r} ${r} 0 ${a1 - a0 > 180 ? 1 : 0} 1 ${x1} ${y1}`;
|
|
861
1196
|
}
|
|
862
|
-
function ArcGauge({ cx, label, g, duration, testId }) {
|
|
1197
|
+
function ArcGauge({ cx, label: label2, g, duration, testId }) {
|
|
863
1198
|
const span = g.max - g.min;
|
|
864
1199
|
const angle = (v) => round2(-ARC_SWEEP + 2 * ARC_SWEEP * clamp((v - g.min) / span, 0, 1));
|
|
865
|
-
const band = (from, to, color) => /* @__PURE__ */
|
|
1200
|
+
const band = (from, to, color) => /* @__PURE__ */ jsx15("path", { d: arcAt(cx, ARC_Y, ARC_R, angle(from), angle(to)), stroke: color, strokeWidth: "6", fill: "none" });
|
|
866
1201
|
const [tipX, tipY] = polar(ARC_R - 4, 0, cx, ARC_Y);
|
|
867
1202
|
const [lx, ly] = polar(ARC_R - 16, -7, cx, ARC_Y);
|
|
868
1203
|
const [rx, ry] = polar(ARC_R - 16, 7, cx, ARC_Y);
|
|
869
|
-
return /* @__PURE__ */
|
|
870
|
-
/* @__PURE__ */
|
|
1204
|
+
return /* @__PURE__ */ jsxs15("g", { children: [
|
|
1205
|
+
/* @__PURE__ */ jsx15("path", { d: arcAt(cx, ARC_Y, ARC_R, -ARC_SWEEP, ARC_SWEEP), stroke: "#fff", strokeWidth: "1.5", fill: "none" }),
|
|
871
1206
|
g.green && band(g.green[0], g.green[1], GREEN3),
|
|
872
1207
|
g.yellow && band(g.yellow[0], g.yellow[1], YELLOW),
|
|
873
1208
|
g.low !== void 0 && band(g.min, g.low, RED2),
|
|
874
1209
|
g.high !== void 0 && band(g.high, g.max, RED2),
|
|
875
|
-
/* @__PURE__ */
|
|
876
|
-
/* @__PURE__ */
|
|
877
|
-
/* @__PURE__ */
|
|
1210
|
+
/* @__PURE__ */ jsx15("g", { "data-testid": testId, style: motionStyle(`rotate(${angle(g.value)}deg)`, duration, cx, ARC_Y), children: /* @__PURE__ */ jsx15("path", { d: `M ${tipX} ${tipY} L ${lx} ${ly} L ${rx} ${ry} Z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1211
|
+
/* @__PURE__ */ jsx15("text", { x: cx, y: ARC_Y - 20, fill: LABEL2, fontSize: "14", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: label2 }),
|
|
1212
|
+
/* @__PURE__ */ jsxs15("text", { x: cx, y: ARC_Y + 4, fill: g.color, fontSize: "28", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
878
1213
|
g.text,
|
|
879
|
-
g.unit && /* @__PURE__ */
|
|
1214
|
+
g.unit && /* @__PURE__ */ jsx15("tspan", { fontSize: "11", dx: "2", children: g.unit })
|
|
880
1215
|
] })
|
|
881
1216
|
] });
|
|
882
1217
|
}
|
|
@@ -884,30 +1219,30 @@ var BAR_X0 = 210;
|
|
|
884
1219
|
var BAR_X1 = 296;
|
|
885
1220
|
var BAR_ROW_H = 39;
|
|
886
1221
|
var BAR_TOP2 = 137;
|
|
887
|
-
function BarGauge({ top, g, label, duration, testId }) {
|
|
1222
|
+
function BarGauge({ top, g, label: label2, duration, testId }) {
|
|
888
1223
|
const y = top + 14;
|
|
889
1224
|
const at = (v) => round2(BAR_X0 + (BAR_X1 - BAR_X0) * clamp((v - g.min) / (g.max - g.min), 0, 1));
|
|
890
|
-
const seg = (from, to, color, w = 7) => /* @__PURE__ */
|
|
891
|
-
return /* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
1225
|
+
const seg = (from, to, color, w = 7) => /* @__PURE__ */ jsx15("path", { d: `M ${at(from)} ${y} H ${at(to)}`, stroke: color, strokeWidth: w });
|
|
1226
|
+
return /* @__PURE__ */ jsxs15("g", { children: [
|
|
1227
|
+
/* @__PURE__ */ jsx15("path", { d: `M ${BAR_X0} ${y} H ${BAR_X1}`, stroke: "#fff", strokeWidth: "2" }),
|
|
1228
|
+
/* @__PURE__ */ jsx15("path", { d: `M ${BAR_X0} ${y - 4} v 8 M ${BAR_X1} ${y - 4} v 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
894
1229
|
g.green && seg(g.green[0], g.green[1], GREEN3),
|
|
895
1230
|
g.yellow && seg(g.yellow[0], g.yellow[1], YELLOW),
|
|
896
1231
|
g.low !== void 0 && seg(g.min, g.low, RED2),
|
|
897
1232
|
g.high !== void 0 && seg(g.high, g.max, RED2),
|
|
898
|
-
/* @__PURE__ */
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
/* @__PURE__ */
|
|
901
|
-
g.unit && /* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ jsx15("g", { "data-testid": testId, style: motionStyle(`translate(${round2(at(g.value) - BAR_X0)}px, 0px)`, duration), children: /* @__PURE__ */ jsx15("path", { d: `M ${BAR_X0} ${y - 3} l -5 -9 h 10 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1234
|
+
/* @__PURE__ */ jsx15("text", { x: BAR_X0, y: top + 31, fill: LABEL2, fontSize: "13", fontWeight: "bold", dominantBaseline: "central", children: label2 }),
|
|
1235
|
+
/* @__PURE__ */ jsx15("text", { x: 350, y: top + 15, fill: g.color, fontSize: "20", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.text }),
|
|
1236
|
+
g.unit && /* @__PURE__ */ jsx15("text", { x: 350, y: top + 31, fill: LABEL2, fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: g.unit })
|
|
902
1237
|
] });
|
|
903
1238
|
}
|
|
904
1239
|
function Tank({ x, fraction, duration, testId }) {
|
|
905
1240
|
const top = 304;
|
|
906
1241
|
const h = 40;
|
|
907
|
-
return /* @__PURE__ */
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
/* @__PURE__ */
|
|
910
|
-
/* @__PURE__ */
|
|
1242
|
+
return /* @__PURE__ */ jsxs15("g", { children: [
|
|
1243
|
+
/* @__PURE__ */ jsx15("rect", { x: x - 7, y: top, width: "14", height: h, rx: "3", fill: "#000", stroke: "#fff", strokeWidth: "1.5" }),
|
|
1244
|
+
/* @__PURE__ */ jsx15("g", { "data-testid": testId, style: motionStyle(`scaleY(${fraction})`, duration, x, top + h - 2), children: /* @__PURE__ */ jsx15("rect", { x: x - 5.5, y: top + 2, width: "11", height: h - 4, fill: BLUE }) }),
|
|
1245
|
+
/* @__PURE__ */ jsx15("rect", { x: x - 5.5, y: top + h - 5, width: "11", height: "3", fill: RED2 })
|
|
911
1246
|
] });
|
|
912
1247
|
}
|
|
913
1248
|
var hottest = (values) => {
|
|
@@ -963,7 +1298,7 @@ function EngineIndicator({
|
|
|
963
1298
|
{ name: "EGT", value: egtMax, color: BLUE, x: 118 },
|
|
964
1299
|
{ name: "TIT", value: hasTit ? tit : void 0, color: "#fff", x: 170 }
|
|
965
1300
|
].filter((r) => r.value !== void 0);
|
|
966
|
-
const
|
|
1301
|
+
const label2 = "Engine: " + [
|
|
967
1302
|
power !== void 0 ? `power ${fmt(power)}%` : null,
|
|
968
1303
|
`MAN ${man.text}${man.unit ? ` ${man.unit}` : ""}`,
|
|
969
1304
|
`RPM ${speed.text}`,
|
|
@@ -975,79 +1310,79 @@ function EngineIndicator({
|
|
|
975
1310
|
fuelLeft !== void 0 || fuelRight !== void 0 ? `fuel ${fmt(fuelLeft)}/${fmt(fuelRight)} ${fuelUnit}` : null,
|
|
976
1311
|
volts !== void 0 ? `${fmt(volts, 1)} V` : null
|
|
977
1312
|
].filter(Boolean).join(", ");
|
|
978
|
-
return /* @__PURE__ */
|
|
979
|
-
power !== void 0 && /* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
1313
|
+
return /* @__PURE__ */ jsxs15(InstrumentFrame, { ...props, label: label2, children: [
|
|
1314
|
+
power !== void 0 && /* @__PURE__ */ jsxs15("text", { x: CENTER, y: 44, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1315
|
+
/* @__PURE__ */ jsxs15("tspan", { fill: LABEL2, fontSize: "11", children: [
|
|
981
1316
|
"POWER",
|
|
982
1317
|
" "
|
|
983
1318
|
] }),
|
|
984
1319
|
fmt(power),
|
|
985
|
-
/* @__PURE__ */
|
|
1320
|
+
/* @__PURE__ */ jsx15("tspan", { fontSize: "11", children: "%" })
|
|
986
1321
|
] }),
|
|
987
|
-
/* @__PURE__ */
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
993
|
-
/* @__PURE__ */
|
|
1322
|
+
/* @__PURE__ */ jsx15(ArcGauge, { cx: 118, label: "MAN", g: man, duration, testId: "engine-man" }),
|
|
1323
|
+
/* @__PURE__ */ jsx15(ArcGauge, { cx: 282, label: "RPM", g: speed, duration, testId: "engine-rpm" }),
|
|
1324
|
+
/* @__PURE__ */ jsxs15("g", { stroke: LINE, strokeWidth: "1.5", children: [
|
|
1325
|
+
/* @__PURE__ */ jsx15("path", { d: chord(133) }),
|
|
1326
|
+
/* @__PURE__ */ jsx15("path", { d: "M 200 133 V 298" }),
|
|
1327
|
+
/* @__PURE__ */ jsx15("path", { d: chord(298) }),
|
|
1328
|
+
/* @__PURE__ */ jsx15("path", { d: "M 136 298 V 348 M 264 298 V 348" })
|
|
994
1329
|
] }),
|
|
995
|
-
/* @__PURE__ */
|
|
996
|
-
/* @__PURE__ */
|
|
1330
|
+
/* @__PURE__ */ jsx15("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: readouts.map((r) => /* @__PURE__ */ jsxs15("g", { children: [
|
|
1331
|
+
/* @__PURE__ */ jsxs15("text", { x: r.x, y: 144, fill: LABEL2, fontSize: "13", children: [
|
|
997
1332
|
r.name,
|
|
998
|
-
/* @__PURE__ */
|
|
1333
|
+
/* @__PURE__ */ jsx15("tspan", { fontSize: "9", children: temperatureUnit })
|
|
999
1334
|
] }),
|
|
1000
|
-
/* @__PURE__ */
|
|
1335
|
+
/* @__PURE__ */ jsx15("text", { "data-testid": `engine-${r.name.toLowerCase()}`, x: r.x, y: 165, fill: r.color, fontSize: "22", children: fmt(r.value) })
|
|
1001
1336
|
] }, r.name)) }),
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
columns > 0 && /* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1337
|
+
/* @__PURE__ */ jsx15("path", { d: "M 40 178 H 190", stroke: LINE, strokeWidth: "1" }),
|
|
1338
|
+
columns > 0 && /* @__PURE__ */ jsxs15("g", { children: [
|
|
1339
|
+
/* @__PURE__ */ jsx15("path", { d: `M ${chartX0} ${limitY} H ${chartX1}`, stroke: RED2, strokeWidth: "1.5", strokeDasharray: "5 4" }),
|
|
1340
|
+
/* @__PURE__ */ jsx15("text", { x: chartX0 - 4, y: limitY, fill: "#fff", fontSize: "10", fontWeight: "bold", textAnchor: "end", dominantBaseline: "central", children: "CHT" }),
|
|
1006
1341
|
Array.from({ length: cylinders }, (_, i) => {
|
|
1007
1342
|
const x0 = chartX0 + colW * i;
|
|
1008
1343
|
const mid = x0 + colW / 2;
|
|
1009
1344
|
const c = chtValues[i];
|
|
1010
1345
|
const e = egtValues[i];
|
|
1011
|
-
return /* @__PURE__ */
|
|
1012
|
-
c !== void 0 && /* @__PURE__ */
|
|
1013
|
-
e !== void 0 && /* @__PURE__ */
|
|
1014
|
-
/* @__PURE__ */
|
|
1346
|
+
return /* @__PURE__ */ jsxs15("g", { children: [
|
|
1347
|
+
c !== void 0 && /* @__PURE__ */ jsx15("g", { "data-testid": `engine-cht-${i}`, style: motionStyle(`scaleY(${chtFrac(c)})`, duration, mid, chartBase), children: /* @__PURE__ */ jsx15("rect", { x: mid - barW - 1, y: chartBase - chartH, width: barW, height: chartH, fill: GREEN3 }) }),
|
|
1348
|
+
e !== void 0 && /* @__PURE__ */ jsx15("g", { "data-testid": `engine-egt-${i}`, style: motionStyle(`scaleY(${egtFrac(e)})`, duration, mid, chartBase), children: /* @__PURE__ */ jsx15("rect", { x: mid + 1, y: chartBase - chartH, width: barW, height: chartH, fill: BLUE }) }),
|
|
1349
|
+
/* @__PURE__ */ jsx15("text", { x: mid, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: i + 1 })
|
|
1015
1350
|
] }, i);
|
|
1016
1351
|
}),
|
|
1017
|
-
hasTit && /* @__PURE__ */
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
/* @__PURE__ */
|
|
1352
|
+
hasTit && /* @__PURE__ */ jsxs15("g", { children: [
|
|
1353
|
+
/* @__PURE__ */ jsx15("g", { "data-testid": "engine-tit-bar", style: motionStyle(`scaleY(${egtFrac(tit)})`, duration, chartX1 - colW / 2, chartBase), children: /* @__PURE__ */ jsx15("rect", { x: chartX1 - colW / 2 - barW / 2, y: chartBase - chartH, width: barW, height: chartH, fill: "#fff" }) }),
|
|
1354
|
+
/* @__PURE__ */ jsx15("text", { x: chartX1 - colW / 2, y: 294, fill: "#fff", fontSize: "12", fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: "T" })
|
|
1020
1355
|
] })
|
|
1021
1356
|
] }),
|
|
1022
|
-
bars.map((b, i) => /* @__PURE__ */
|
|
1023
|
-
i > 0 && /* @__PURE__ */
|
|
1024
|
-
/* @__PURE__ */
|
|
1357
|
+
bars.map((b, i) => /* @__PURE__ */ jsxs15("g", { children: [
|
|
1358
|
+
i > 0 && /* @__PURE__ */ jsx15("path", { d: `M 206 ${BAR_TOP2 + BAR_ROW_H * i - 2} H 352`, stroke: LINE, strokeWidth: "1" }),
|
|
1359
|
+
/* @__PURE__ */ jsx15(BarGauge, { top: BAR_TOP2 + BAR_ROW_H * i, g: b.g, label: b.label, duration, testId: `engine-bar-${i}` })
|
|
1025
1360
|
] }, b.label)),
|
|
1026
|
-
/* @__PURE__ */
|
|
1027
|
-
/* @__PURE__ */
|
|
1361
|
+
/* @__PURE__ */ jsxs15("g", { fontWeight: "bold", textAnchor: "middle", dominantBaseline: "central", children: [
|
|
1362
|
+
/* @__PURE__ */ jsxs15("text", { "data-testid": "engine-amps", x: 104, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1028
1363
|
fmt(amps),
|
|
1029
|
-
/* @__PURE__ */
|
|
1364
|
+
/* @__PURE__ */ jsx15("tspan", { fontSize: "11", dx: "2", children: "A" })
|
|
1030
1365
|
] }),
|
|
1031
|
-
/* @__PURE__ */
|
|
1032
|
-
/* @__PURE__ */
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
1366
|
+
/* @__PURE__ */ jsx15("text", { x: 104, y: 338, fill: LABEL2, fontSize: "13", children: "ALT" }),
|
|
1367
|
+
/* @__PURE__ */ jsx15(Tank, { x: 152, fraction: left / cap, duration, testId: "engine-fuel-left" }),
|
|
1368
|
+
/* @__PURE__ */ jsx15(Tank, { x: 248, fraction: right / cap, duration, testId: "engine-fuel-right" }),
|
|
1369
|
+
/* @__PURE__ */ jsxs15("text", { "data-testid": "engine-fuel", x: 200, y: 316, fill: "#fff", fontSize: "20", children: [
|
|
1035
1370
|
fmt(left),
|
|
1036
|
-
/* @__PURE__ */
|
|
1371
|
+
/* @__PURE__ */ jsx15("tspan", { dx: "14", children: fmt(right) })
|
|
1037
1372
|
] }),
|
|
1038
|
-
/* @__PURE__ */
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
1373
|
+
/* @__PURE__ */ jsx15("text", { x: 200, y: 335, fill: LABEL2, fontSize: "13", children: "Fuel" }),
|
|
1374
|
+
/* @__PURE__ */ jsx15("text", { x: 200, y: 348, fill: LABEL2, fontSize: "9", children: fuelUnit }),
|
|
1375
|
+
/* @__PURE__ */ jsxs15("text", { "data-testid": "engine-volts", x: 296, y: 318, fill: "#fff", fontSize: "20", children: [
|
|
1041
1376
|
fmt(volts, 1),
|
|
1042
|
-
/* @__PURE__ */
|
|
1377
|
+
/* @__PURE__ */ jsx15("tspan", { fontSize: "11", dx: "2", children: "V" })
|
|
1043
1378
|
] }),
|
|
1044
|
-
/* @__PURE__ */
|
|
1379
|
+
/* @__PURE__ */ jsx15("text", { x: 296, y: 338, fill: LABEL2, fontSize: "13", children: "BATT" })
|
|
1045
1380
|
] })
|
|
1046
1381
|
] });
|
|
1047
1382
|
}
|
|
1048
1383
|
|
|
1049
1384
|
// src/components/FlapIndicator.tsx
|
|
1050
|
-
import { jsx as
|
|
1385
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1051
1386
|
var GREEN4 = "#3ddc3d";
|
|
1052
1387
|
var YELLOW2 = "#ffd400";
|
|
1053
1388
|
var ORANGE = "#ff8a00";
|
|
@@ -1070,7 +1405,7 @@ function FlapIndicator({
|
|
|
1070
1405
|
segments = 20,
|
|
1071
1406
|
speedLimits,
|
|
1072
1407
|
airspeed,
|
|
1073
|
-
label = "WING FLAP",
|
|
1408
|
+
label: label2 = "WING FLAP",
|
|
1074
1409
|
...props
|
|
1075
1410
|
}) {
|
|
1076
1411
|
const duration = props.animationDuration ?? DEFAULT_ANIMATION_MS;
|
|
@@ -1085,13 +1420,13 @@ function FlapIndicator({
|
|
|
1085
1420
|
const ias = finite(airspeed, NaN);
|
|
1086
1421
|
const overspeed = limit !== void 0 && !Number.isNaN(ias) && ias > limit.speed;
|
|
1087
1422
|
const segH = BAR_H2 / count;
|
|
1088
|
-
const title = `${
|
|
1089
|
-
return /* @__PURE__ */
|
|
1090
|
-
/* @__PURE__ */
|
|
1423
|
+
const title = `${label2}: ${Math.round(position)}\xB0 of ${Math.round(full)}\xB0` + (limit ? `, max ${Math.round(limit.speed)} knots${overspeed ? " (overspeed)" : ""}` : "");
|
|
1424
|
+
return /* @__PURE__ */ jsxs16(InstrumentFrame, { ...props, label: title, children: [
|
|
1425
|
+
/* @__PURE__ */ jsx16("rect", { x: BAR_X - BAR_W / 2 - 4, y: BAR_TOP3 - 4, width: BAR_W + 8, height: BAR_H2 + 8, rx: "4", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
|
|
1091
1426
|
Array.from({ length: count }, (_, i) => {
|
|
1092
1427
|
const y = BAR_TOP3 + i * segH;
|
|
1093
1428
|
const on = i < lit;
|
|
1094
|
-
return /* @__PURE__ */
|
|
1429
|
+
return /* @__PURE__ */ jsx16(
|
|
1095
1430
|
"rect",
|
|
1096
1431
|
{
|
|
1097
1432
|
"data-testid": `flap-segment-${i}`,
|
|
@@ -1108,26 +1443,26 @@ function FlapIndicator({
|
|
|
1108
1443
|
i
|
|
1109
1444
|
);
|
|
1110
1445
|
}),
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
1446
|
+
/* @__PURE__ */ jsx16("g", { fill: "#fff", fontSize: "18", fontWeight: "bold", dominantBaseline: "central", children: scale.map((d) => /* @__PURE__ */ jsxs16("g", { children: [
|
|
1447
|
+
/* @__PURE__ */ jsx16("path", { d: `M ${BAR_X + BAR_W / 2 + 8} ${yAt(d)} h 8`, stroke: "#fff", strokeWidth: "2" }),
|
|
1448
|
+
/* @__PURE__ */ jsx16("text", { x: BAR_X + BAR_W / 2 + 22, y: yAt(d), children: d })
|
|
1114
1449
|
] }, d)) }),
|
|
1115
|
-
/* @__PURE__ */
|
|
1116
|
-
limit && /* @__PURE__ */
|
|
1117
|
-
/* @__PURE__ */
|
|
1450
|
+
/* @__PURE__ */ jsx16("g", { "data-testid": "flap-pointer", style: motionStyle(`translate(0px, ${yAt(position) - BAR_TOP3}px)`, duration), children: /* @__PURE__ */ jsx16("path", { d: `M ${BAR_X - BAR_W / 2 - 8} ${BAR_TOP3} l -14 -8 v 16 z`, fill: "#fff", stroke: "#000", strokeWidth: "1" }) }),
|
|
1451
|
+
limit && /* @__PURE__ */ jsxs16("g", { textAnchor: "middle", dominantBaseline: "central", fill: overspeed ? RED3 : "#fff", children: [
|
|
1452
|
+
/* @__PURE__ */ jsxs16("text", { "data-testid": "flap-speed", x: 118, y: 176, fontSize: "36", fontWeight: "bold", children: [
|
|
1118
1453
|
Math.round(limit.speed),
|
|
1119
|
-
/* @__PURE__ */
|
|
1454
|
+
/* @__PURE__ */ jsx16("tspan", { fontSize: "13", dx: "3", children: "KTS" })
|
|
1120
1455
|
] }),
|
|
1121
|
-
/* @__PURE__ */
|
|
1456
|
+
/* @__PURE__ */ jsx16("text", { x: 118, y: 212, fontSize: "13", fontWeight: "bold", fill: "#bbb", letterSpacing: "2", children: "MAX" })
|
|
1122
1457
|
] }),
|
|
1123
|
-
/* @__PURE__ */
|
|
1458
|
+
/* @__PURE__ */ jsx16("text", { x: CENTER, y: 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1124
1459
|
] });
|
|
1125
1460
|
}
|
|
1126
1461
|
|
|
1127
1462
|
// src/components/AoaIndicator.tsx
|
|
1128
|
-
import { Fragment as
|
|
1463
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1129
1464
|
var GREEN5 = "#3ddc3d";
|
|
1130
|
-
var
|
|
1465
|
+
var AMBER4 = "#ffb000";
|
|
1131
1466
|
var RED4 = "#ff2a2a";
|
|
1132
1467
|
var UNLIT_OPACITY = 0.15;
|
|
1133
1468
|
var ROWS = [
|
|
@@ -1136,10 +1471,10 @@ var ROWS = [
|
|
|
1136
1471
|
{ shape: "bar", color: GREEN5, y: 256 },
|
|
1137
1472
|
{ shape: "bar", color: GREEN5, y: 234 },
|
|
1138
1473
|
{ shape: "donut", color: GREEN5, y: 208 },
|
|
1139
|
-
{ shape: "bar", color:
|
|
1140
|
-
{ shape: "split", color:
|
|
1141
|
-
{ shape: "chevron", color:
|
|
1142
|
-
{ shape: "chevron", color:
|
|
1474
|
+
{ shape: "bar", color: AMBER4, y: 182 },
|
|
1475
|
+
{ shape: "split", color: AMBER4, y: 160 },
|
|
1476
|
+
{ shape: "chevron", color: AMBER4, y: 125 },
|
|
1477
|
+
{ shape: "chevron", color: AMBER4, y: 103 },
|
|
1143
1478
|
{ shape: "chevron", color: RED4, y: 74 },
|
|
1144
1479
|
{ shape: "chevron", color: RED4, y: 52 }
|
|
1145
1480
|
];
|
|
@@ -1153,23 +1488,23 @@ function RowShape({ shape, y }) {
|
|
|
1153
1488
|
const r = CENTER + HALF;
|
|
1154
1489
|
switch (shape) {
|
|
1155
1490
|
case "bar":
|
|
1156
|
-
return /* @__PURE__ */
|
|
1491
|
+
return /* @__PURE__ */ jsx17("rect", { x: l, y: y - BAR_H3 / 2, width: HALF * 2, height: BAR_H3, rx: "2" });
|
|
1157
1492
|
case "split":
|
|
1158
|
-
return /* @__PURE__ */
|
|
1159
|
-
/* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1493
|
+
return /* @__PURE__ */ jsxs17(Fragment3, { children: [
|
|
1494
|
+
/* @__PURE__ */ jsx17("rect", { x: l, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" }),
|
|
1495
|
+
/* @__PURE__ */ jsx17("rect", { x: r - 50, y: y - BAR_H3 / 2, width: 50, height: BAR_H3, rx: "2" })
|
|
1161
1496
|
] });
|
|
1162
1497
|
case "donut":
|
|
1163
|
-
return /* @__PURE__ */
|
|
1164
|
-
/* @__PURE__ */
|
|
1165
|
-
/* @__PURE__ */
|
|
1166
|
-
/* @__PURE__ */
|
|
1498
|
+
return /* @__PURE__ */ jsxs17(Fragment3, { children: [
|
|
1499
|
+
/* @__PURE__ */ jsx17("rect", { x: l, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
1500
|
+
/* @__PURE__ */ jsx17("rect", { x: CENTER + 24, y: y - BAR_H3 / 2, width: HALF - 24, height: BAR_H3, rx: "2" }),
|
|
1501
|
+
/* @__PURE__ */ jsx17("circle", { cx: CENTER, cy: y, r: 13, fill: "none", strokeWidth: "7" })
|
|
1167
1502
|
] });
|
|
1168
1503
|
case "chevron":
|
|
1169
|
-
return /* @__PURE__ */
|
|
1504
|
+
return /* @__PURE__ */ jsx17("path", { d: `M ${l} ${y} L ${CENTER} ${y + CHEVRON_DEPTH} L ${r} ${y}`, fill: "none", strokeWidth: "11", strokeLinejoin: "miter" });
|
|
1170
1505
|
}
|
|
1171
1506
|
}
|
|
1172
|
-
function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label = "AOA", ...props }) {
|
|
1507
|
+
function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false, label: label2 = "AOA", ...props }) {
|
|
1173
1508
|
const lo = finite(min, 0);
|
|
1174
1509
|
const hi = Math.max(lo + 1e-6, finite(max, 20));
|
|
1175
1510
|
const opt = clamp(finite(optimum, (lo + hi) / 2), lo, hi);
|
|
@@ -1179,12 +1514,12 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1179
1514
|
const stall = lit === ROWS.length;
|
|
1180
1515
|
const reading = Number.isNaN(value) ? "---" : `${value.toFixed(1)}\xB0`;
|
|
1181
1516
|
const state = stall ? " (stall warning)" : lit > DONUT + 1 ? " (high)" : lit === DONUT + 1 ? " (optimum)" : "";
|
|
1182
|
-
const title = `${
|
|
1183
|
-
return /* @__PURE__ */
|
|
1184
|
-
/* @__PURE__ */
|
|
1517
|
+
const title = `${label2}: ${reading}${Number.isNaN(value) ? "" : state}`;
|
|
1518
|
+
return /* @__PURE__ */ jsxs17(InstrumentFrame, { ...props, label: title, children: [
|
|
1519
|
+
/* @__PURE__ */ jsx17("rect", { x: CENTER - HALF - 10, y: 40, width: (HALF + 10) * 2, height: 278, rx: "10", fill: "#000", stroke: "#333", strokeWidth: "1.5" }),
|
|
1185
1520
|
ROWS.map((row, i) => {
|
|
1186
1521
|
const on = i < lit;
|
|
1187
|
-
return /* @__PURE__ */
|
|
1522
|
+
return /* @__PURE__ */ jsxs17(
|
|
1188
1523
|
"g",
|
|
1189
1524
|
{
|
|
1190
1525
|
"data-testid": `aoa-row-${i}`,
|
|
@@ -1195,18 +1530,19 @@ function AoaIndicator({ aoa = 0, min = 0, optimum, max = 20, showValue = false,
|
|
|
1195
1530
|
opacity: on ? 1 : UNLIT_OPACITY,
|
|
1196
1531
|
style: { transition: "opacity 150ms ease-out" },
|
|
1197
1532
|
children: [
|
|
1198
|
-
/* @__PURE__ */
|
|
1199
|
-
on && stall && row.shape === "chevron" && /* @__PURE__ */
|
|
1533
|
+
/* @__PURE__ */ jsx17(RowShape, { shape: row.shape, y: row.y }),
|
|
1534
|
+
on && stall && row.shape === "chevron" && /* @__PURE__ */ jsx17("animate", { attributeName: "opacity", values: "1;0.25;1", dur: "0.6s", repeatCount: "indefinite" })
|
|
1200
1535
|
]
|
|
1201
1536
|
},
|
|
1202
1537
|
i
|
|
1203
1538
|
);
|
|
1204
1539
|
}),
|
|
1205
|
-
showValue && /* @__PURE__ */
|
|
1206
|
-
/* @__PURE__ */
|
|
1540
|
+
showValue && /* @__PURE__ */ jsx17("text", { "data-testid": "aoa-value", x: CENTER, y: 340, fill: "#fff", fontSize: "18", fontWeight: "bold", textAnchor: "middle", children: reading }),
|
|
1541
|
+
/* @__PURE__ */ jsx17("text", { x: CENTER, y: showValue ? 362 : 345, fill: "#ccc", fontSize: "16", textAnchor: "middle", children: label2.toUpperCase() })
|
|
1207
1542
|
] });
|
|
1208
1543
|
}
|
|
1209
1544
|
export {
|
|
1545
|
+
AdfIndicator,
|
|
1210
1546
|
Airspeed,
|
|
1211
1547
|
Altimeter,
|
|
1212
1548
|
AoaIndicator,
|
|
@@ -1223,11 +1559,19 @@ export {
|
|
|
1223
1559
|
MAX_CYLINDERS,
|
|
1224
1560
|
MAX_FIELDS,
|
|
1225
1561
|
MAX_TANKS,
|
|
1562
|
+
RadioPanel,
|
|
1563
|
+
RadioStack,
|
|
1226
1564
|
TurnCoordinator,
|
|
1227
1565
|
VerticalSpeed,
|
|
1228
1566
|
VorIndicator,
|
|
1229
1567
|
WindIndicator,
|
|
1568
|
+
formatAdf,
|
|
1569
|
+
formatDme,
|
|
1570
|
+
formatNav,
|
|
1230
1571
|
formatValue,
|
|
1572
|
+
parseAdf,
|
|
1573
|
+
parseNav,
|
|
1574
|
+
relativeBearing,
|
|
1231
1575
|
vorDeviation
|
|
1232
1576
|
};
|
|
1233
1577
|
//# sourceMappingURL=index.js.map
|