@azohra/meteo.station 0.3.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/climatology.d.ts +27 -0
- package/dist/client/climatology.js +83 -0
- package/dist/client/history.d.ts +53 -0
- package/dist/client/history.js +114 -0
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.js +3 -1
- package/dist/client/live.js +15 -0
- package/dist/climatology.d.ts +61 -0
- package/dist/climatology.js +208 -0
- package/dist/contract-climatology.d.ts +69 -0
- package/dist/contract-climatology.js +50 -0
- package/dist/contract.d.ts +234 -1
- package/dist/contract.js +52 -4
- package/dist/derive.d.ts +23 -1
- package/dist/derive.js +43 -4
- package/dist/display.d.ts +4 -0
- package/dist/display.js +2 -1
- package/dist/elements/elements/AirExtremesElement.d.ts +8 -0
- package/dist/elements/elements/AirExtremesElement.js +33 -0
- package/dist/elements/elements/ClimatologyDailyPatternElement.d.ts +15 -0
- package/dist/elements/elements/ClimatologyDailyPatternElement.js +84 -0
- package/dist/elements/elements/ClimatologyRoseElement.d.ts +14 -0
- package/dist/elements/elements/ClimatologyRoseElement.js +51 -0
- package/dist/elements/elements/CompassFanElement.d.ts +14 -0
- package/dist/elements/elements/CompassFanElement.js +92 -0
- package/dist/elements/elements/DailyPatternElement.d.ts +1 -0
- package/dist/elements/elements/DailyPatternElement.js +20 -12
- package/dist/elements/elements/DialElement.js +14 -3
- package/dist/elements/elements/FavorableShareElement.d.ts +14 -0
- package/dist/elements/elements/FavorableShareElement.js +47 -0
- package/dist/elements/elements/RecentSummariesElement.d.ts +14 -0
- package/dist/elements/elements/RecentSummariesElement.js +54 -0
- package/dist/elements/elements/StationFeedElement.d.ts +3 -0
- package/dist/elements/elements/StationFeedElement.js +13 -2
- package/dist/elements/elements/WindHistoryChartElement.js +16 -3
- package/dist/elements/elements/WindRoseElement.d.ts +1 -3
- package/dist/elements/elements/WindRoseElement.js +60 -62
- package/dist/elements/elements/atoms.js +3 -3
- package/dist/elements/index.d.ts +13 -1
- package/dist/elements/index.js +15 -3
- package/dist/elements/lib/ambient.d.ts +2 -0
- package/dist/elements/lib/attributes.js +24 -1
- package/dist/elements/lib/base.d.ts +3 -0
- package/dist/elements/lib/base.js +14 -2
- package/dist/endpoints.d.ts +7 -1
- package/dist/endpoints.js +13 -1
- package/dist/geometry.d.ts +22 -3
- package/dist/geometry.js +41 -5
- package/dist/index.d.ts +8 -6
- package/dist/index.js +8 -6
- package/dist/instruments.d.ts +7 -5
- package/dist/instruments.js +20 -7
- package/dist/merge-current.js +2 -1
- package/dist/react/components/AirExtremes.d.ts +16 -0
- package/dist/react/components/AirExtremes.js +38 -0
- package/dist/react/components/ClimatologyDailyPattern.d.ts +20 -0
- package/dist/react/components/ClimatologyDailyPattern.js +59 -0
- package/dist/react/components/ClimatologyRose.d.ts +18 -0
- package/dist/react/components/ClimatologyRose.js +45 -0
- package/dist/react/components/CompassFan.d.ts +17 -0
- package/dist/react/components/CompassFan.js +93 -0
- package/dist/react/components/DailyPattern.d.ts +4 -1
- package/dist/react/components/DailyPattern.js +13 -6
- package/dist/react/components/Dial.d.ts +3 -1
- package/dist/react/components/Dial.js +13 -2
- package/dist/react/components/FavorableShare.d.ts +14 -0
- package/dist/react/components/FavorableShare.js +43 -0
- package/dist/react/components/RecentSummaries.d.ts +19 -0
- package/dist/react/components/RecentSummaries.js +65 -0
- package/dist/react/components/StationFeedProvider.d.ts +4 -1
- package/dist/react/components/StationFeedProvider.js +5 -3
- package/dist/react/components/WindHistoryChart.d.ts +6 -1
- package/dist/react/components/WindHistoryChart.js +18 -3
- package/dist/react/components/WindRose.d.ts +4 -2
- package/dist/react/components/WindRose.js +80 -71
- package/dist/react/components/WindSampleStrip.d.ts +3 -1
- package/dist/react/components/WindSampleStrip.js +6 -3
- package/dist/react/components/atoms.d.ts +4 -1
- package/dist/react/components/atoms.js +6 -3
- package/dist/react/hooks/useStationClimatology.d.ts +18 -0
- package/dist/react/hooks/useStationClimatology.js +25 -0
- package/dist/react/index.d.ts +10 -3
- package/dist/react/index.js +9 -2
- package/dist/scene/air-extremes.d.ts +2 -0
- package/dist/scene/air-extremes.js +42 -0
- package/dist/scene/atoms.d.ts +2 -1
- package/dist/scene/atoms.js +6 -4
- package/dist/scene/climatology-pattern.d.ts +6 -0
- package/dist/scene/climatology-pattern.js +35 -0
- package/dist/scene/climatology-rose.d.ts +5 -0
- package/dist/scene/climatology-rose.js +49 -0
- package/dist/scene/compass-fan.d.ts +3 -0
- package/dist/scene/compass-fan.js +115 -0
- package/dist/scene/daily-pattern.d.ts +1 -0
- package/dist/scene/daily-pattern.js +20 -6
- package/dist/scene/dial.d.ts +1 -0
- package/dist/scene/dial.js +16 -3
- package/dist/scene/favorable-share.d.ts +3 -0
- package/dist/scene/favorable-share.js +41 -0
- package/dist/scene/index.d.ts +9 -3
- package/dist/scene/recent-summaries.d.ts +4 -0
- package/dist/scene/recent-summaries.js +75 -0
- package/dist/scene/rose.d.ts +2 -1
- package/dist/scene/rose.js +18 -3
- package/dist/scene/sample-strip.d.ts +1 -0
- package/dist/scene/sample-strip.js +1 -1
- package/dist/scene/wind-history.d.ts +1 -0
- package/dist/scene/wind-history.js +4 -3
- package/dist/scene/wind-plot.d.ts +1 -0
- package/dist/scene/wind-plot.js +30 -3
- package/dist/server/adapter.d.ts +2 -1
- package/dist/server/adapter.js +2 -1
- package/dist/server/adapters/windnerd-climatology.d.ts +33 -0
- package/dist/server/adapters/windnerd-climatology.js +81 -0
- package/dist/server/adapters/windnerd-live.js +21 -13
- package/dist/server/adapters/windnerd.d.ts +31 -4
- package/dist/server/adapters/windnerd.js +197 -19
- package/dist/server/feed.d.ts +44 -2
- package/dist/server/feed.js +63 -2
- package/dist/server/handler.d.ts +11 -1
- package/dist/server/handler.js +83 -2
- package/dist/server/index.d.ts +4 -3
- package/dist/server/index.js +4 -3
- package/dist/strings.d.ts +12 -0
- package/dist/strings.js +12 -0
- package/package.json +2 -2
- package/schema/example-climatology.json +86 -0
- package/schema/example-history.json +38 -0
- package/schema/stationclimatology.schema.json +195 -0
- package/schema/stationcurrent.schema.json +173 -0
- package/schema/stationfeed.schema.json +173 -0
- package/schema/stationhistory.schema.json +186 -0
- package/schema/stationlive.schema.json +202 -0
- package/styles.css +215 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { resolveDisplay } from "../../display.js";
|
|
3
|
+
import { compassFanGate, compassFanScene, compassFanSource } from "../../scene/compass-fan.js";
|
|
4
|
+
import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/react/components/CompassFan.tsx
|
|
7
|
+
/** The live compass: the newest sample as the solid needle, every sample of
|
|
8
|
+
* the rolling window as a faint fan aged by tenth — a tight fan means
|
|
9
|
+
* steady direction. */
|
|
10
|
+
function CompassFan({ samples, station: stationProp, stationId, favorableDirections: favorableDirectionsProp, strings: stringsProp }) {
|
|
11
|
+
const context = useStationFeedContext();
|
|
12
|
+
const station = stationProp ?? (samples == null ? resolveStation(context, stationId) ?? void 0 : void 0);
|
|
13
|
+
const { favorableDirections, words } = resolveDisplay(context, {
|
|
14
|
+
strings: stringsProp,
|
|
15
|
+
favorableDirections: favorableDirectionsProp
|
|
16
|
+
});
|
|
17
|
+
const gate = compassFanGate(compassFanSource(samples, station), station, words);
|
|
18
|
+
if (gate.kind === "hidden") return null;
|
|
19
|
+
if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: gate.className,
|
|
21
|
+
role: "note",
|
|
22
|
+
children: gate.text
|
|
23
|
+
});
|
|
24
|
+
const scene = compassFanScene({
|
|
25
|
+
favorableDirections,
|
|
26
|
+
samples: gate.samples,
|
|
27
|
+
stationName: station?.name,
|
|
28
|
+
words
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
31
|
+
"aria-label": scene.svg.ariaLabel,
|
|
32
|
+
className: scene.svg.className,
|
|
33
|
+
height: scene.svg.height,
|
|
34
|
+
role: "img",
|
|
35
|
+
viewBox: scene.svg.viewBox,
|
|
36
|
+
width: scene.svg.width,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx("circle", {
|
|
39
|
+
className: scene.ring.className,
|
|
40
|
+
cx: scene.ring.cx,
|
|
41
|
+
cy: scene.ring.cy,
|
|
42
|
+
r: scene.ring.r
|
|
43
|
+
}),
|
|
44
|
+
scene.verdictRing && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
|
|
45
|
+
className: scene.verdictRing.unfavorable.className,
|
|
46
|
+
cx: scene.verdictRing.unfavorable.cx,
|
|
47
|
+
cy: scene.verdictRing.unfavorable.cy,
|
|
48
|
+
r: scene.verdictRing.unfavorable.r
|
|
49
|
+
}), scene.verdictRing.favorable.map((arc) => /* @__PURE__ */ jsx("path", {
|
|
50
|
+
className: arc.className,
|
|
51
|
+
d: arc.d
|
|
52
|
+
}, arc.key))] }),
|
|
53
|
+
scene.ticks.map((tick) => /* @__PURE__ */ jsx("line", {
|
|
54
|
+
className: tick.className,
|
|
55
|
+
x1: tick.x1,
|
|
56
|
+
x2: tick.x2,
|
|
57
|
+
y1: tick.y1,
|
|
58
|
+
y2: tick.y2
|
|
59
|
+
}, tick.key)),
|
|
60
|
+
scene.letters.map((letter) => /* @__PURE__ */ jsx("text", {
|
|
61
|
+
className: letter.className,
|
|
62
|
+
textAnchor: letter.anchor,
|
|
63
|
+
x: letter.x,
|
|
64
|
+
y: letter.y,
|
|
65
|
+
children: letter.text
|
|
66
|
+
}, letter.key)),
|
|
67
|
+
scene.ghosts.map((ghost) => /* @__PURE__ */ jsx("path", {
|
|
68
|
+
className: ghost.className,
|
|
69
|
+
d: ghost.d
|
|
70
|
+
}, ghost.key)),
|
|
71
|
+
scene.needle && /* @__PURE__ */ jsxs("g", {
|
|
72
|
+
className: scene.needle.className,
|
|
73
|
+
children: [/* @__PURE__ */ jsx("polygon", {
|
|
74
|
+
className: scene.needle.blade.className,
|
|
75
|
+
points: scene.needle.blade.points
|
|
76
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
77
|
+
className: scene.needle.counterweight.className,
|
|
78
|
+
cx: scene.needle.counterweight.cx,
|
|
79
|
+
cy: scene.needle.counterweight.cy,
|
|
80
|
+
r: scene.needle.counterweight.r
|
|
81
|
+
})]
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx("circle", {
|
|
84
|
+
className: scene.hub.className,
|
|
85
|
+
cx: scene.hub.cx,
|
|
86
|
+
cy: scene.hub.cy,
|
|
87
|
+
r: scene.hub.r
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { CompassFan };
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { HistoryPoint, Station } from "../../contract.js";
|
|
2
2
|
import { SpeedThresholds, SpeedUnit, compassDirection } from "../../derive.js";
|
|
3
3
|
import { StationStringOverrides } from "../../strings.js";
|
|
4
|
+
import { FavorableDirection } from "../../instruments.js";
|
|
4
5
|
import "../../index.js";
|
|
6
|
+
import "../../scene/index.js";
|
|
5
7
|
import { WindArrow } from "./WindArrow.js";
|
|
6
8
|
//#region src/react/components/DailyPattern.d.ts
|
|
7
|
-
declare function DailyPattern({ station: stationProp, stationId, points, slotMinutes, utcOffsetMinutes, thresholds: thresholdsProp, unit: unitProp, plotHeight, strings: stringsProp }: {
|
|
9
|
+
declare function DailyPattern({ station: stationProp, stationId, points, slotMinutes, utcOffsetMinutes, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, strings: stringsProp }: {
|
|
8
10
|
station?: Station;
|
|
9
11
|
stationId?: string;
|
|
10
12
|
points?: HistoryPoint[];
|
|
11
13
|
slotMinutes?: number;
|
|
12
14
|
utcOffsetMinutes?: number;
|
|
13
15
|
thresholds?: SpeedThresholds | null;
|
|
16
|
+
favorableDirections?: FavorableDirection[] | null;
|
|
14
17
|
unit?: SpeedUnit;
|
|
15
18
|
plotHeight?: number;
|
|
16
19
|
strings?: StationStringOverrides;
|
|
@@ -8,12 +8,13 @@ import "./WindArrow.js";
|
|
|
8
8
|
import { useEffect, useId, useRef, useState } from "react";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/react/components/DailyPattern.tsx
|
|
11
|
-
function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 180, utcOffsetMinutes = 0, thresholds: thresholdsProp, unit: unitProp, plotHeight, strings: stringsProp }) {
|
|
11
|
+
function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 180, utcOffsetMinutes = 0, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, strings: stringsProp }) {
|
|
12
12
|
const context = useStationFeedContext();
|
|
13
13
|
const station = stationProp ?? (points == null ? resolveStation(context, stationId) ?? void 0 : void 0);
|
|
14
|
-
const { thresholds, unit, words } = resolveDisplay(context, {
|
|
14
|
+
const { favorableDirections, thresholds, unit, words } = resolveDisplay(context, {
|
|
15
15
|
strings: stringsProp,
|
|
16
16
|
thresholds: thresholdsProp,
|
|
17
|
+
favorableDirections: favorableDirectionsProp,
|
|
17
18
|
unit: unitProp
|
|
18
19
|
});
|
|
19
20
|
const wrapRef = useRef(null);
|
|
@@ -42,6 +43,7 @@ function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 1
|
|
|
42
43
|
className: DAILY_PATTERN_CLASS,
|
|
43
44
|
ref: wrapRef,
|
|
44
45
|
children: width != null && /* @__PURE__ */ jsx(MeasuredDailyPattern, {
|
|
46
|
+
favorableDirections,
|
|
45
47
|
periodMinutes,
|
|
46
48
|
plotHeight,
|
|
47
49
|
points: source,
|
|
@@ -55,8 +57,9 @@ function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 1
|
|
|
55
57
|
})
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
|
-
function MeasuredDailyPattern({ periodMinutes, plotHeight, points, slotMinutes, stationName, thresholds, unit, utcOffsetMinutes, width, words }) {
|
|
59
|
-
|
|
60
|
+
function MeasuredDailyPattern({ favorableDirections, periodMinutes, plotHeight, points, slotMinutes, stationName, thresholds, unit, utcOffsetMinutes, width, words }) {
|
|
61
|
+
return /* @__PURE__ */ jsx(DailyPatternSceneView, { scene: dailyPatternScene({
|
|
62
|
+
favorableDirections,
|
|
60
63
|
hatchId: `meteo-daily-pattern-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`,
|
|
61
64
|
periodMinutes,
|
|
62
65
|
plotHeight,
|
|
@@ -68,7 +71,11 @@ function MeasuredDailyPattern({ periodMinutes, plotHeight, points, slotMinutes,
|
|
|
68
71
|
utcOffsetMinutes,
|
|
69
72
|
width,
|
|
70
73
|
words
|
|
71
|
-
});
|
|
74
|
+
}) });
|
|
75
|
+
}
|
|
76
|
+
/** One scene, one drawing — shared by the history-fed pattern above and the
|
|
77
|
+
* climatology-fed twin. */
|
|
78
|
+
function DailyPatternSceneView({ scene }) {
|
|
72
79
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("output", {
|
|
73
80
|
className: scene.caption.className,
|
|
74
81
|
children: scene.caption.text
|
|
@@ -208,4 +215,4 @@ function MeasuredDailyPattern({ periodMinutes, plotHeight, points, slotMinutes,
|
|
|
208
215
|
})] });
|
|
209
216
|
}
|
|
210
217
|
//#endregion
|
|
211
|
-
export { DailyPattern };
|
|
218
|
+
export { DailyPattern, DailyPatternSceneView };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Station } from "../../contract.js";
|
|
2
2
|
import { SpeedThresholds, SpeedUnit } from "../../derive.js";
|
|
3
3
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
4
|
+
import { FavorableDirection } from "../../instruments.js";
|
|
4
5
|
import "../../index.js";
|
|
5
6
|
//#region src/react/components/Dial.d.ts
|
|
6
|
-
declare function Dial({ station: stationProp, stationId, thresholds: thresholdsProp, unit: unitProp, size, calmWord, strings: stringsProp }: {
|
|
7
|
+
declare function Dial({ station: stationProp, stationId, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, size, calmWord, strings: stringsProp }: {
|
|
7
8
|
station?: Station;
|
|
8
9
|
stationId?: string;
|
|
9
10
|
thresholds?: SpeedThresholds | null;
|
|
11
|
+
favorableDirections?: FavorableDirection[] | null;
|
|
10
12
|
unit?: SpeedUnit;
|
|
11
13
|
size?: number;
|
|
12
14
|
calmWord?: boolean;
|
|
@@ -6,17 +6,19 @@ import { requireResolved, resolveStation, useStationFeedContext } from "./Statio
|
|
|
6
6
|
import { useId } from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/react/components/Dial.tsx
|
|
9
|
-
function Dial({ station: stationProp, stationId, thresholds: thresholdsProp, unit: unitProp, size = 160, calmWord = true, strings: stringsProp }) {
|
|
9
|
+
function Dial({ station: stationProp, stationId, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, size = 160, calmWord = true, strings: stringsProp }) {
|
|
10
10
|
const context = useStationFeedContext();
|
|
11
11
|
const station = requireResolved("Dial", "station", stationProp ?? resolveStation(context, stationId));
|
|
12
|
-
const { thresholds, unit, words } = resolveDisplay(context, {
|
|
12
|
+
const { favorableDirections, thresholds, unit, words } = resolveDisplay(context, {
|
|
13
13
|
strings: stringsProp,
|
|
14
14
|
thresholds: thresholdsProp,
|
|
15
|
+
favorableDirections: favorableDirectionsProp,
|
|
15
16
|
unit: unitProp
|
|
16
17
|
});
|
|
17
18
|
const scene = dialScene({
|
|
18
19
|
bezelId: `meteo-bezel-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`,
|
|
19
20
|
calmWord,
|
|
21
|
+
favorableDirections,
|
|
20
22
|
size,
|
|
21
23
|
station,
|
|
22
24
|
thresholds,
|
|
@@ -61,6 +63,15 @@ function Dial({ station: stationProp, stationId, thresholds: thresholdsProp, uni
|
|
|
61
63
|
cy: scene.ring.cy,
|
|
62
64
|
r: scene.ring.r
|
|
63
65
|
}),
|
|
66
|
+
scene.verdictRing && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
|
|
67
|
+
className: scene.verdictRing.unfavorable.className,
|
|
68
|
+
cx: scene.verdictRing.unfavorable.cx,
|
|
69
|
+
cy: scene.verdictRing.unfavorable.cy,
|
|
70
|
+
r: scene.verdictRing.unfavorable.r
|
|
71
|
+
}), scene.verdictRing.favorable.map((arc) => /* @__PURE__ */ jsx("path", {
|
|
72
|
+
className: arc.className,
|
|
73
|
+
d: arc.d
|
|
74
|
+
}, arc.key))] }),
|
|
64
75
|
scene.arc && /* @__PURE__ */ jsx("path", {
|
|
65
76
|
className: scene.arc.className,
|
|
66
77
|
d: scene.arc.d
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HistoryPoint, Station } from "../../contract.js";
|
|
2
|
+
import { StationStringOverrides } from "../../strings.js";
|
|
3
|
+
import { FavorableDirection } from "../../instruments.js";
|
|
4
|
+
import "../../index.js";
|
|
5
|
+
//#region src/react/components/FavorableShare.d.ts
|
|
6
|
+
declare function FavorableShare({ station: stationProp, stationId, points, favorableDirections: favorableDirectionsProp, strings: stringsProp }: {
|
|
7
|
+
station?: Station;
|
|
8
|
+
stationId?: string;
|
|
9
|
+
points?: HistoryPoint[];
|
|
10
|
+
favorableDirections?: FavorableDirection[] | null;
|
|
11
|
+
strings?: StationStringOverrides;
|
|
12
|
+
}): import("react").JSX.Element | null;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { FavorableShare };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { resolveDisplay } from "../../display.js";
|
|
3
|
+
import { favorableShareGate, favorableShareScene, favorableShareSource } from "../../scene/favorable-share.js";
|
|
4
|
+
import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/react/components/FavorableShare.tsx
|
|
7
|
+
function FavorableShare({ station: stationProp, stationId, points, favorableDirections: favorableDirectionsProp, strings: stringsProp }) {
|
|
8
|
+
const context = useStationFeedContext();
|
|
9
|
+
const station = stationProp ?? (points == null ? resolveStation(context, stationId) ?? void 0 : void 0);
|
|
10
|
+
const { favorableDirections, words } = resolveDisplay(context, {
|
|
11
|
+
strings: stringsProp,
|
|
12
|
+
favorableDirections: favorableDirectionsProp
|
|
13
|
+
});
|
|
14
|
+
const gate = favorableShareGate(favorableShareSource(points, station), favorableDirections, words);
|
|
15
|
+
if (gate.kind === "hidden") return null;
|
|
16
|
+
if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
|
|
17
|
+
className: gate.className,
|
|
18
|
+
role: "note",
|
|
19
|
+
children: gate.text
|
|
20
|
+
});
|
|
21
|
+
const scene = favorableShareScene({
|
|
22
|
+
share: gate.share,
|
|
23
|
+
stationName: station?.name,
|
|
24
|
+
words
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
"aria-label": scene.ariaLabel,
|
|
28
|
+
className: scene.className,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsx("span", {
|
|
31
|
+
className: scene.label.className,
|
|
32
|
+
children: scene.label.text
|
|
33
|
+
}),
|
|
34
|
+
" ",
|
|
35
|
+
/* @__PURE__ */ jsx("span", {
|
|
36
|
+
className: scene.value.className,
|
|
37
|
+
children: scene.value.text
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { FavorableShare };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RecentSummary, Station } from "../../contract.js";
|
|
2
|
+
import { SpeedUnit } from "../../derive.js";
|
|
3
|
+
import { StationStringOverrides } from "../../strings.js";
|
|
4
|
+
import { FavorableDirection } from "../../instruments.js";
|
|
5
|
+
import "../../index.js";
|
|
6
|
+
//#region src/react/components/RecentSummaries.d.ts
|
|
7
|
+
/** The source's own step digests as summary panels: per window, the
|
|
8
|
+
* average, gust, and lull beside one small arrow per step — the direction's
|
|
9
|
+
* recent story at a glance. */
|
|
10
|
+
declare function RecentSummaries({ summaries, station: stationProp, stationId, favorableDirections: favorableDirectionsProp, unit: unitProp, strings: stringsProp }: {
|
|
11
|
+
summaries?: RecentSummary[] | null;
|
|
12
|
+
station?: Station;
|
|
13
|
+
stationId?: string;
|
|
14
|
+
favorableDirections?: FavorableDirection[] | null;
|
|
15
|
+
unit?: SpeedUnit;
|
|
16
|
+
strings?: StationStringOverrides;
|
|
17
|
+
}): import("react").JSX.Element | null;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { RecentSummaries };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { resolveDisplay } from "../../display.js";
|
|
3
|
+
import { recentSummariesGate, recentSummariesScene } from "../../scene/recent-summaries.js";
|
|
4
|
+
import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
5
|
+
import { WindArrow } from "./WindArrow.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/react/components/RecentSummaries.tsx
|
|
8
|
+
/** The source's own step digests as summary panels: per window, the
|
|
9
|
+
* average, gust, and lull beside one small arrow per step — the direction's
|
|
10
|
+
* recent story at a glance. */
|
|
11
|
+
function RecentSummaries({ summaries, station: stationProp, stationId, favorableDirections: favorableDirectionsProp, unit: unitProp, strings: stringsProp }) {
|
|
12
|
+
const context = useStationFeedContext();
|
|
13
|
+
const station = stationProp ?? (summaries == null ? resolveStation(context, stationId) ?? void 0 : void 0);
|
|
14
|
+
const { favorableDirections, unit, words } = resolveDisplay(context, {
|
|
15
|
+
strings: stringsProp,
|
|
16
|
+
favorableDirections: favorableDirectionsProp,
|
|
17
|
+
unit: unitProp
|
|
18
|
+
});
|
|
19
|
+
const gate = recentSummariesGate(station, summaries, words);
|
|
20
|
+
if (gate.kind === "hidden") return null;
|
|
21
|
+
if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: gate.className,
|
|
23
|
+
role: "note",
|
|
24
|
+
children: gate.text
|
|
25
|
+
});
|
|
26
|
+
const scene = recentSummariesScene({
|
|
27
|
+
favorableDirections,
|
|
28
|
+
stationName: station?.name,
|
|
29
|
+
summaries: gate.summaries,
|
|
30
|
+
unit,
|
|
31
|
+
words
|
|
32
|
+
});
|
|
33
|
+
return /* @__PURE__ */ jsx("div", {
|
|
34
|
+
"aria-label": scene.ariaLabel,
|
|
35
|
+
className: scene.className,
|
|
36
|
+
children: scene.panels.map((panel) => /* @__PURE__ */ jsxs("section", {
|
|
37
|
+
className: panel.className,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx("h4", {
|
|
40
|
+
className: panel.label.className,
|
|
41
|
+
children: panel.label.text
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ jsx("div", {
|
|
44
|
+
className: "meteo-recent-summary-ghosts",
|
|
45
|
+
children: panel.ghosts.map((ghost) => /* @__PURE__ */ jsx("span", {
|
|
46
|
+
className: ghost.className,
|
|
47
|
+
children: /* @__PURE__ */ jsx(WindArrow, { deg: ghost.deg })
|
|
48
|
+
}, ghost.key))
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ jsx("dl", {
|
|
51
|
+
className: "meteo-recent-summary-stats",
|
|
52
|
+
children: panel.stats.map((stat) => /* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: stat.className,
|
|
54
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
55
|
+
className: "meteo-microlabel",
|
|
56
|
+
children: stat.label
|
|
57
|
+
}), /* @__PURE__ */ jsx("dd", { children: stat.value })]
|
|
58
|
+
}, stat.key))
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
}, panel.key))
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { RecentSummaries };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StationFeed } from "../../contract.js";
|
|
2
2
|
import { SpeedThresholds, SpeedUnit } from "../../derive.js";
|
|
3
3
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
4
|
+
import { FavorableDirection } from "../../instruments.js";
|
|
4
5
|
import "../../index.js";
|
|
5
6
|
import { ReactNode } from "react";
|
|
6
7
|
//#region src/react/components/StationFeedProvider.d.ts
|
|
@@ -11,14 +12,16 @@ type StationFeedContextValue = {
|
|
|
11
12
|
unit: SpeedUnit | undefined;
|
|
12
13
|
formatTime: FormatTime | undefined;
|
|
13
14
|
thresholds: SpeedThresholds | undefined;
|
|
15
|
+
favorableDirections: FavorableDirection[] | undefined;
|
|
14
16
|
};
|
|
15
|
-
declare function StationFeedProvider({ feed, receivedAtMs, strings, unit, formatTime, thresholds, locale, children }: {
|
|
17
|
+
declare function StationFeedProvider({ feed, receivedAtMs, strings, unit, formatTime, thresholds, favorableDirections, locale, children }: {
|
|
16
18
|
feed: StationFeed | null;
|
|
17
19
|
receivedAtMs: number | null;
|
|
18
20
|
strings?: StationStringOverrides;
|
|
19
21
|
unit?: SpeedUnit;
|
|
20
22
|
formatTime?: FormatTime;
|
|
21
23
|
thresholds?: SpeedThresholds;
|
|
24
|
+
favorableDirections?: FavorableDirection[];
|
|
22
25
|
locale?: string;
|
|
23
26
|
children?: ReactNode;
|
|
24
27
|
}): import("react").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { createContext, useContext, useMemo } from "react";
|
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/react/components/StationFeedProvider.tsx
|
|
7
7
|
const StationFeedContext = createContext(null);
|
|
8
|
-
function StationFeedProvider({ feed, receivedAtMs, strings, unit, formatTime, thresholds, locale, children }) {
|
|
8
|
+
function StationFeedProvider({ feed, receivedAtMs, strings, unit, formatTime, thresholds, favorableDirections, locale, children }) {
|
|
9
9
|
const resolvedFormatTime = formatTime ?? (locale == null ? void 0 : localeFormatTime(locale));
|
|
10
10
|
const value = useMemo(() => ({
|
|
11
11
|
feed,
|
|
@@ -13,14 +13,16 @@ function StationFeedProvider({ feed, receivedAtMs, strings, unit, formatTime, th
|
|
|
13
13
|
strings,
|
|
14
14
|
unit,
|
|
15
15
|
formatTime: resolvedFormatTime,
|
|
16
|
-
thresholds
|
|
16
|
+
thresholds,
|
|
17
|
+
favorableDirections
|
|
17
18
|
}), [
|
|
18
19
|
feed,
|
|
19
20
|
receivedAtMs,
|
|
20
21
|
strings,
|
|
21
22
|
unit,
|
|
22
23
|
resolvedFormatTime,
|
|
23
|
-
thresholds
|
|
24
|
+
thresholds,
|
|
25
|
+
favorableDirections
|
|
24
26
|
]);
|
|
25
27
|
return /* @__PURE__ */ jsx(StationFeedContext.Provider, {
|
|
26
28
|
value,
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { Station } from "../../contract.js";
|
|
2
2
|
import { SpeedThresholds, SpeedUnit } from "../../derive.js";
|
|
3
3
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
4
|
+
import { FavorableDirection } from "../../instruments.js";
|
|
4
5
|
import "../../index.js";
|
|
5
6
|
//#region src/react/components/WindHistoryChart.d.ts
|
|
6
|
-
declare function WindHistoryChart({ station: stationProp, stationId, thresholds: thresholdsProp, unit: unitProp, plotHeight, windowHours, compareOffsetDays, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
7
|
+
declare function WindHistoryChart({ station: stationProp, stationId, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, windowHours, compareOffsetDays, nightShading, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
7
8
|
station?: Station;
|
|
8
9
|
stationId?: string;
|
|
9
10
|
thresholds?: SpeedThresholds | null;
|
|
11
|
+
favorableDirections?: FavorableDirection[] | null;
|
|
10
12
|
unit?: SpeedUnit;
|
|
11
13
|
plotHeight?: number;
|
|
12
14
|
windowHours?: number;
|
|
13
15
|
compareOffsetDays?: 1 | 2 | 3;
|
|
16
|
+
/** Gray sunset-to-sunrise columns from the station's own coordinates;
|
|
17
|
+
* a station without them shades nothing — real astronomy or none. */
|
|
18
|
+
nightShading?: boolean;
|
|
14
19
|
strings?: StationStringOverrides;
|
|
15
20
|
formatTime?: FormatTime;
|
|
16
21
|
}): import("react").JSX.Element | null;
|
|
@@ -8,13 +8,14 @@ import { useMeasuredChartWidth } from "../hooks/useMeasuredChartWidth.js";
|
|
|
8
8
|
import { useId, useRef, useState } from "react";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/react/components/WindHistoryChart.tsx
|
|
11
|
-
function WindHistoryChart({ station: stationProp, stationId, thresholds: thresholdsProp, unit: unitProp, plotHeight, windowHours, compareOffsetDays, strings: stringsProp, formatTime: formatTimeProp }) {
|
|
11
|
+
function WindHistoryChart({ station: stationProp, stationId, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, windowHours, compareOffsetDays, nightShading = false, strings: stringsProp, formatTime: formatTimeProp }) {
|
|
12
12
|
const context = useStationFeedContext();
|
|
13
13
|
const station = requireResolved("WindHistoryChart", "station", stationProp ?? resolveStation(context, stationId));
|
|
14
|
-
const { formatTime, thresholds, unit, words } = resolveDisplay(context, {
|
|
14
|
+
const { favorableDirections, formatTime, thresholds, unit, words } = resolveDisplay(context, {
|
|
15
15
|
formatTime: formatTimeProp,
|
|
16
16
|
strings: stringsProp,
|
|
17
17
|
thresholds: thresholdsProp,
|
|
18
|
+
favorableDirections: favorableDirectionsProp,
|
|
18
19
|
unit: unitProp
|
|
19
20
|
});
|
|
20
21
|
const wrapRef = useRef(null);
|
|
@@ -31,8 +32,13 @@ function WindHistoryChart({ station: stationProp, stationId, thresholds: thresho
|
|
|
31
32
|
ref: wrapRef,
|
|
32
33
|
children: width != null && /* @__PURE__ */ jsx(MeasuredChart, {
|
|
33
34
|
compareOffsetDays,
|
|
35
|
+
favorableDirections,
|
|
34
36
|
formatTime,
|
|
35
37
|
history: gate.history,
|
|
38
|
+
night: nightShading ? {
|
|
39
|
+
latitude: station.latitude,
|
|
40
|
+
longitude: station.longitude
|
|
41
|
+
} : null,
|
|
36
42
|
plotHeight,
|
|
37
43
|
stationName: station.name,
|
|
38
44
|
thresholds,
|
|
@@ -43,15 +49,17 @@ function WindHistoryChart({ station: stationProp, stationId, thresholds: thresho
|
|
|
43
49
|
})
|
|
44
50
|
});
|
|
45
51
|
}
|
|
46
|
-
function MeasuredChart({ compareOffsetDays, formatTime, history, plotHeight, stationName, thresholds, unit, width, windowHours, words }) {
|
|
52
|
+
function MeasuredChart({ compareOffsetDays, favorableDirections, formatTime, history, night, plotHeight, stationName, thresholds, unit, width, windowHours, words }) {
|
|
47
53
|
const hatchId = `meteo-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
48
54
|
const [pinnedAt, setPinnedAt] = useState(null);
|
|
49
55
|
const [previewIndex, setPreviewIndex] = useState(null);
|
|
50
56
|
const scene = windChartScene({
|
|
51
57
|
compareOffsetDays,
|
|
58
|
+
favorableDirections,
|
|
52
59
|
formatTime,
|
|
53
60
|
hatchId,
|
|
54
61
|
history,
|
|
62
|
+
night,
|
|
55
63
|
plotHeight,
|
|
56
64
|
stationName,
|
|
57
65
|
thresholds,
|
|
@@ -122,6 +130,13 @@ function MeasuredChart({ compareOffsetDays, formatTime, history, plotHeight, sta
|
|
|
122
130
|
x: zone.x,
|
|
123
131
|
y: zone.y
|
|
124
132
|
}, zone.key)),
|
|
133
|
+
scene.nightRects.map((rect) => /* @__PURE__ */ jsx("rect", {
|
|
134
|
+
className: rect.className,
|
|
135
|
+
height: rect.height,
|
|
136
|
+
width: rect.width,
|
|
137
|
+
x: rect.x,
|
|
138
|
+
y: rect.y
|
|
139
|
+
}, rect.key)),
|
|
125
140
|
scene.grid.map(({ key, line, label }) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
|
|
126
141
|
className: line.className,
|
|
127
142
|
x1: line.x1,
|
|
@@ -3,14 +3,16 @@ import { SpeedThresholds } from "../../derive.js";
|
|
|
3
3
|
import { StationStringOverrides } from "../../strings.js";
|
|
4
4
|
import { FavorableDirection } from "../../instruments.js";
|
|
5
5
|
import "../../index.js";
|
|
6
|
+
import "../../scene/index.js";
|
|
7
|
+
import { ReactNode } from "react";
|
|
6
8
|
//#region src/react/components/WindRose.d.ts
|
|
7
|
-
declare function WindRose({ station: stationProp, stationId, points, sectorCount, thresholds: thresholdsProp, favorableDirections, strings: stringsProp }: {
|
|
9
|
+
declare function WindRose({ station: stationProp, stationId, points, sectorCount, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, strings: stringsProp }: {
|
|
8
10
|
station?: Station;
|
|
9
11
|
stationId?: string;
|
|
10
12
|
points?: HistoryPoint[];
|
|
11
13
|
sectorCount?: number;
|
|
12
14
|
thresholds?: SpeedThresholds | null;
|
|
13
|
-
favorableDirections?: FavorableDirection[];
|
|
15
|
+
favorableDirections?: FavorableDirection[] | null;
|
|
14
16
|
strings?: StationStringOverrides;
|
|
15
17
|
}): import("react").JSX.Element;
|
|
16
18
|
//#endregion
|