@azohra/meteo.station 0.3.1 → 0.5.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.
Files changed (138) hide show
  1. package/dist/client/climatology.d.ts +27 -0
  2. package/dist/client/climatology.js +83 -0
  3. package/dist/client/history.d.ts +47 -0
  4. package/dist/client/history.js +112 -0
  5. package/dist/client/index.d.ts +3 -1
  6. package/dist/client/index.js +3 -1
  7. package/dist/client/live.js +15 -0
  8. package/dist/climatology.d.ts +66 -0
  9. package/dist/climatology.js +230 -0
  10. package/dist/contract-climatology.d.ts +73 -0
  11. package/dist/contract-climatology.js +52 -0
  12. package/dist/contract.d.ts +234 -1
  13. package/dist/contract.js +52 -4
  14. package/dist/derive.d.ts +23 -1
  15. package/dist/derive.js +43 -4
  16. package/dist/display.d.ts +4 -0
  17. package/dist/display.js +2 -1
  18. package/dist/elements/elements/AirExtremesElement.d.ts +8 -0
  19. package/dist/elements/elements/AirExtremesElement.js +33 -0
  20. package/dist/elements/elements/ClimatologyDailyPatternElement.d.ts +15 -0
  21. package/dist/elements/elements/ClimatologyDailyPatternElement.js +84 -0
  22. package/dist/elements/elements/ClimatologyRoseElement.d.ts +14 -0
  23. package/dist/elements/elements/ClimatologyRoseElement.js +51 -0
  24. package/dist/elements/elements/CompassFanElement.d.ts +14 -0
  25. package/dist/elements/elements/CompassFanElement.js +92 -0
  26. package/dist/elements/elements/DailyPatternElement.d.ts +1 -0
  27. package/dist/elements/elements/DailyPatternElement.js +24 -16
  28. package/dist/elements/elements/DialElement.js +14 -3
  29. package/dist/elements/elements/FavorableShareElement.d.ts +14 -0
  30. package/dist/elements/elements/FavorableShareElement.js +47 -0
  31. package/dist/elements/elements/RecentSummariesElement.d.ts +14 -0
  32. package/dist/elements/elements/RecentSummariesElement.js +54 -0
  33. package/dist/elements/elements/StationFeedElement.d.ts +3 -0
  34. package/dist/elements/elements/StationFeedElement.js +13 -2
  35. package/dist/elements/elements/WindHistoryChartElement.js +20 -7
  36. package/dist/elements/elements/WindRoseElement.d.ts +1 -3
  37. package/dist/elements/elements/WindRoseElement.js +60 -62
  38. package/dist/elements/elements/atoms.js +3 -3
  39. package/dist/elements/index.d.ts +13 -1
  40. package/dist/elements/index.js +15 -3
  41. package/dist/elements/lib/ambient.d.ts +2 -0
  42. package/dist/elements/lib/attributes.js +24 -1
  43. package/dist/elements/lib/base.d.ts +3 -0
  44. package/dist/elements/lib/base.js +14 -2
  45. package/dist/endpoints.d.ts +7 -1
  46. package/dist/endpoints.js +13 -1
  47. package/dist/geometry.d.ts +23 -4
  48. package/dist/geometry.js +44 -13
  49. package/dist/index.d.ts +8 -6
  50. package/dist/index.js +8 -6
  51. package/dist/instruments.d.ts +7 -5
  52. package/dist/instruments.js +20 -7
  53. package/dist/merge-current.js +2 -1
  54. package/dist/react/components/AirExtremes.d.ts +16 -0
  55. package/dist/react/components/AirExtremes.js +38 -0
  56. package/dist/react/components/ClimatologyDailyPattern.d.ts +20 -0
  57. package/dist/react/components/ClimatologyDailyPattern.js +59 -0
  58. package/dist/react/components/ClimatologyRose.d.ts +18 -0
  59. package/dist/react/components/ClimatologyRose.js +45 -0
  60. package/dist/react/components/CompassFan.d.ts +17 -0
  61. package/dist/react/components/CompassFan.js +93 -0
  62. package/dist/react/components/DailyPattern.d.ts +4 -1
  63. package/dist/react/components/DailyPattern.js +15 -8
  64. package/dist/react/components/Dial.d.ts +3 -1
  65. package/dist/react/components/Dial.js +13 -2
  66. package/dist/react/components/FavorableShare.d.ts +14 -0
  67. package/dist/react/components/FavorableShare.js +43 -0
  68. package/dist/react/components/RecentSummaries.d.ts +18 -0
  69. package/dist/react/components/RecentSummaries.js +64 -0
  70. package/dist/react/components/StationFeedProvider.d.ts +4 -1
  71. package/dist/react/components/StationFeedProvider.js +5 -3
  72. package/dist/react/components/WindHistoryChart.d.ts +6 -1
  73. package/dist/react/components/WindHistoryChart.js +20 -5
  74. package/dist/react/components/WindRose.d.ts +4 -2
  75. package/dist/react/components/WindRose.js +80 -71
  76. package/dist/react/components/WindSampleStrip.d.ts +3 -1
  77. package/dist/react/components/WindSampleStrip.js +8 -5
  78. package/dist/react/components/atoms.d.ts +4 -1
  79. package/dist/react/components/atoms.js +6 -3
  80. package/dist/react/hooks/useStationClimatology.d.ts +18 -0
  81. package/dist/react/hooks/useStationClimatology.js +25 -0
  82. package/dist/react/index.d.ts +10 -3
  83. package/dist/react/index.js +9 -2
  84. package/dist/scene/air-extremes.d.ts +2 -0
  85. package/dist/scene/air-extremes.js +42 -0
  86. package/dist/scene/atoms.d.ts +2 -1
  87. package/dist/scene/atoms.js +6 -4
  88. package/dist/scene/climatology-pattern.d.ts +6 -0
  89. package/dist/scene/climatology-pattern.js +35 -0
  90. package/dist/scene/climatology-rose.d.ts +5 -0
  91. package/dist/scene/climatology-rose.js +49 -0
  92. package/dist/scene/compass-fan.d.ts +3 -0
  93. package/dist/scene/compass-fan.js +115 -0
  94. package/dist/scene/daily-pattern.d.ts +1 -0
  95. package/dist/scene/daily-pattern.js +21 -7
  96. package/dist/scene/dial.d.ts +1 -0
  97. package/dist/scene/dial.js +16 -3
  98. package/dist/scene/favorable-share.d.ts +3 -0
  99. package/dist/scene/favorable-share.js +41 -0
  100. package/dist/scene/index.d.ts +9 -3
  101. package/dist/scene/recent-summaries.d.ts +4 -0
  102. package/dist/scene/recent-summaries.js +75 -0
  103. package/dist/scene/rose.d.ts +2 -1
  104. package/dist/scene/rose.js +18 -3
  105. package/dist/scene/sample-strip.d.ts +1 -0
  106. package/dist/scene/sample-strip.js +1 -1
  107. package/dist/scene/trend.js +2 -7
  108. package/dist/scene/wind-history.d.ts +1 -0
  109. package/dist/scene/wind-history.js +4 -3
  110. package/dist/scene/wind-plot.d.ts +1 -0
  111. package/dist/scene/wind-plot.js +44 -9
  112. package/dist/server/adapter.d.ts +2 -1
  113. package/dist/server/adapter.js +2 -1
  114. package/dist/server/adapters/windnerd-climatology.d.ts +30 -0
  115. package/dist/server/adapters/windnerd-climatology.js +82 -0
  116. package/dist/server/adapters/windnerd-live.d.ts +5 -8
  117. package/dist/server/adapters/windnerd-live.js +26 -21
  118. package/dist/server/adapters/windnerd.d.ts +31 -4
  119. package/dist/server/adapters/windnerd.js +196 -19
  120. package/dist/server/environment.d.ts +4 -10
  121. package/dist/server/environment.js +4 -10
  122. package/dist/server/feed.d.ts +44 -2
  123. package/dist/server/feed.js +63 -2
  124. package/dist/server/handler.d.ts +11 -1
  125. package/dist/server/handler.js +83 -2
  126. package/dist/server/index.d.ts +4 -3
  127. package/dist/server/index.js +4 -3
  128. package/dist/strings.d.ts +13 -1
  129. package/dist/strings.js +13 -1
  130. package/package.json +2 -2
  131. package/schema/example-climatology.json +86 -0
  132. package/schema/example-history.json +38 -0
  133. package/schema/stationclimatology.schema.json +221 -0
  134. package/schema/stationcurrent.schema.json +173 -0
  135. package/schema/stationfeed.schema.json +173 -0
  136. package/schema/stationhistory.schema.json +186 -0
  137. package/schema/stationlive.schema.json +202 -0
  138. package/styles.css +232 -19
@@ -0,0 +1,20 @@
1
+ import { StationClimatology } from "../../contract-climatology.js";
2
+ import { SpeedThresholds } from "../../derive.js";
3
+ import { StationStringOverrides } from "../../strings.js";
4
+ import { FavorableDirection } from "../../instruments.js";
5
+ import "../../index.js";
6
+ //#region src/react/components/ClimatologyDailyPattern.d.ts
7
+ /** The cube's typical day through the daily-pattern drawing, month-filtered
8
+ * client-side. The host owns the document and the filters. */
9
+ declare function ClimatologyDailyPattern({ document, months, favorableDirections: favorableDirectionsProp, thresholds: thresholdsProp, unit: unitProp, plotHeight, stationName, strings: stringsProp }: {
10
+ document: StationClimatology | null | undefined;
11
+ months?: ReadonlyArray<number>;
12
+ favorableDirections?: FavorableDirection[] | null;
13
+ thresholds?: SpeedThresholds | null;
14
+ unit?: "kmh" | "knots" | "mph" | "mps";
15
+ plotHeight?: number;
16
+ stationName?: string;
17
+ strings?: StationStringOverrides;
18
+ }): import("react").JSX.Element;
19
+ //#endregion
20
+ export { ClimatologyDailyPattern };
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { resolveDisplay } from "../../display.js";
3
+ import { measuredChartWidth } from "../../geometry.js";
4
+ import { CLIMATOLOGY_PATTERN_CLASS, climatologyPatternGate, climatologyPatternScene } from "../../scene/climatology-pattern.js";
5
+ import { useStationFeedContext } from "./StationFeedProvider.js";
6
+ import { DailyPatternSceneView } from "./DailyPattern.js";
7
+ import { useEffect, useId, useRef, useState } from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ //#region src/react/components/ClimatologyDailyPattern.tsx
10
+ /** The cube's typical day through the daily-pattern drawing, month-filtered
11
+ * client-side. The host owns the document and the filters. */
12
+ function ClimatologyDailyPattern({ document, months, favorableDirections: favorableDirectionsProp, thresholds: thresholdsProp, unit: unitProp, plotHeight, stationName, strings: stringsProp }) {
13
+ const { favorableDirections, thresholds, unit, words } = resolveDisplay(useStationFeedContext(), {
14
+ strings: stringsProp,
15
+ thresholds: thresholdsProp,
16
+ favorableDirections: favorableDirectionsProp,
17
+ unit: unitProp
18
+ });
19
+ const wrapRef = useRef(null);
20
+ const [width, setWidth] = useState(null);
21
+ const hatchId = `meteo-climatology-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
22
+ const gate = climatologyPatternGate(document, words);
23
+ useEffect(() => {
24
+ const element = wrapRef.current;
25
+ if (!element) return;
26
+ if (typeof ResizeObserver === "undefined") {
27
+ setWidth(360);
28
+ return;
29
+ }
30
+ const observer = new ResizeObserver((entries) => {
31
+ setWidth(measuredChartWidth(entries[0]?.contentRect.width ?? 0));
32
+ });
33
+ observer.observe(element);
34
+ return () => observer.disconnect();
35
+ }, [gate.kind === "draw"]);
36
+ if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
37
+ className: gate.className,
38
+ role: "note",
39
+ children: gate.text
40
+ });
41
+ return /* @__PURE__ */ jsx("div", {
42
+ className: CLIMATOLOGY_PATTERN_CLASS,
43
+ ref: wrapRef,
44
+ children: width != null && /* @__PURE__ */ jsx(DailyPatternSceneView, { scene: climatologyPatternScene({
45
+ document: gate.document,
46
+ favorableDirections,
47
+ filters: { months },
48
+ hatchId,
49
+ plotHeight,
50
+ stationName,
51
+ thresholds,
52
+ unit,
53
+ width,
54
+ words
55
+ }) })
56
+ });
57
+ }
58
+ //#endregion
59
+ export { ClimatologyDailyPattern };
@@ -0,0 +1,18 @@
1
+ import { StationClimatology } from "../../contract-climatology.js";
2
+ import { StationStringOverrides } from "../../strings.js";
3
+ import { FavorableDirection } from "../../instruments.js";
4
+ import "../../index.js";
5
+ //#region src/react/components/ClimatologyRose.d.ts
6
+ /** The whole archive as a stacked rose: the cube's sectors, each wedge split
7
+ * by the document's own thresholds, with the honesty captions beneath. The
8
+ * host owns the document (a fetch-once store) and the filters. */
9
+ declare function ClimatologyRose({ document, months, slots, favorableDirections: favorableDirectionsProp, stationName, strings: stringsProp }: {
10
+ document: StationClimatology | null | undefined;
11
+ months?: ReadonlyArray<number>;
12
+ slots?: ReadonlyArray<number>;
13
+ favorableDirections?: FavorableDirection[] | null;
14
+ stationName?: string;
15
+ strings?: StationStringOverrides;
16
+ }): import("react").JSX.Element;
17
+ //#endregion
18
+ export { ClimatologyRose };
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { resolveDisplay } from "../../display.js";
3
+ import { climatologyRoseGate, climatologyRoseScene } from "../../scene/climatology-rose.js";
4
+ import { useStationFeedContext } from "./StationFeedProvider.js";
5
+ import { WindRoseSceneView } from "./WindRose.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+ //#region src/react/components/ClimatologyRose.tsx
8
+ /** The whole archive as a stacked rose: the cube's sectors, each wedge split
9
+ * by the document's own thresholds, with the honesty captions beneath. The
10
+ * host owns the document (a fetch-once store) and the filters. */
11
+ function ClimatologyRose({ document, months, slots, favorableDirections: favorableDirectionsProp, stationName, strings: stringsProp }) {
12
+ const { favorableDirections, words } = resolveDisplay(useStationFeedContext(), {
13
+ strings: stringsProp,
14
+ favorableDirections: favorableDirectionsProp
15
+ });
16
+ const gate = climatologyRoseGate(document, words);
17
+ if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
18
+ className: gate.className,
19
+ role: "note",
20
+ children: gate.text
21
+ });
22
+ const filters = {
23
+ months,
24
+ slots
25
+ };
26
+ const scene = climatologyRoseScene({
27
+ document: gate.document,
28
+ favorableDirections,
29
+ filters,
30
+ stationName,
31
+ words
32
+ });
33
+ return /* @__PURE__ */ jsx("div", {
34
+ className: scene.className,
35
+ children: /* @__PURE__ */ jsx(WindRoseSceneView, {
36
+ scene: scene.rose,
37
+ children: scene.captions.map((caption) => /* @__PURE__ */ jsx("p", {
38
+ className: caption.className,
39
+ children: caption.text
40
+ }, caption.key))
41
+ })
42
+ });
43
+ }
44
+ //#endregion
45
+ export { ClimatologyRose };
@@ -0,0 +1,17 @@
1
+ import { LiveSamples, 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/CompassFan.d.ts
6
+ /** The live compass: the newest sample as the solid needle, every sample of
7
+ * the rolling window as a faint fan aged by tenth — a tight fan means
8
+ * steady direction. */
9
+ declare function CompassFan({ samples, station: stationProp, stationId, favorableDirections: favorableDirectionsProp, strings: stringsProp }: {
10
+ samples?: LiveSamples | null;
11
+ station?: Station;
12
+ stationId?: string;
13
+ favorableDirections?: FavorableDirection[] | null;
14
+ strings?: StationStringOverrides;
15
+ }): import("react").JSX.Element | null;
16
+ //#endregion
17
+ export { CompassFan };
@@ -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
- const scene = dailyPatternScene({
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
@@ -176,7 +183,7 @@ function MeasuredDailyPattern({ periodMinutes, plotHeight, points, slotMinutes,
176
183
  className: vane.mark.className,
177
184
  d: vane.mark.d
178
185
  }, vane.key)),
179
- scene.vanes.map((vane) => /* @__PURE__ */ jsx("text", {
186
+ scene.vanes.map((vane) => vane.label && /* @__PURE__ */ jsx("text", {
180
187
  className: vane.label.className,
181
188
  textAnchor: vane.label.anchor,
182
189
  x: vane.label.x,
@@ -190,7 +197,7 @@ function MeasuredDailyPattern({ periodMinutes, plotHeight, points, slotMinutes,
190
197
  y: scene.rowLabels.avg.y,
191
198
  children: scene.rowLabels.avg.text
192
199
  }),
193
- scene.vanes.map((vane) => /* @__PURE__ */ jsx("text", {
200
+ scene.vanes.map((vane) => vane.value && /* @__PURE__ */ jsx("text", {
194
201
  className: vane.value.className,
195
202
  textAnchor: vane.value.anchor,
196
203
  x: vane.value.x,
@@ -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,18 @@
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. */
9
+ declare function RecentSummaries({ summaries, station: stationProp, stationId, favorableDirections: favorableDirectionsProp, unit: unitProp, strings: stringsProp }: {
10
+ summaries?: RecentSummary[] | null;
11
+ station?: Station;
12
+ stationId?: string;
13
+ favorableDirections?: FavorableDirection[] | null;
14
+ unit?: SpeedUnit;
15
+ strings?: StationStringOverrides;
16
+ }): import("react").JSX.Element | null;
17
+ //#endregion
18
+ export { RecentSummaries };
@@ -0,0 +1,64 @@
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. */
10
+ function RecentSummaries({ summaries, station: stationProp, stationId, favorableDirections: favorableDirectionsProp, unit: unitProp, strings: stringsProp }) {
11
+ const context = useStationFeedContext();
12
+ const station = stationProp ?? (summaries == null ? resolveStation(context, stationId) ?? void 0 : void 0);
13
+ const { favorableDirections, unit, words } = resolveDisplay(context, {
14
+ strings: stringsProp,
15
+ favorableDirections: favorableDirectionsProp,
16
+ unit: unitProp
17
+ });
18
+ const gate = recentSummariesGate(station, summaries, words);
19
+ if (gate.kind === "hidden") return null;
20
+ if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
21
+ className: gate.className,
22
+ role: "note",
23
+ children: gate.text
24
+ });
25
+ const scene = recentSummariesScene({
26
+ favorableDirections,
27
+ stationName: station?.name,
28
+ summaries: gate.summaries,
29
+ unit,
30
+ words
31
+ });
32
+ return /* @__PURE__ */ jsx("div", {
33
+ "aria-label": scene.ariaLabel,
34
+ className: scene.className,
35
+ children: scene.panels.map((panel) => /* @__PURE__ */ jsxs("section", {
36
+ className: panel.className,
37
+ children: [
38
+ /* @__PURE__ */ jsx("h4", {
39
+ className: panel.label.className,
40
+ children: panel.label.text
41
+ }),
42
+ /* @__PURE__ */ jsx("div", {
43
+ className: "meteo-recent-summary-ghosts",
44
+ children: panel.ghosts.map((ghost) => /* @__PURE__ */ jsx("span", {
45
+ className: ghost.className,
46
+ children: /* @__PURE__ */ jsx(WindArrow, { deg: ghost.deg })
47
+ }, ghost.key))
48
+ }),
49
+ /* @__PURE__ */ jsx("dl", {
50
+ className: "meteo-recent-summary-stats",
51
+ children: panel.stats.map((stat) => /* @__PURE__ */ jsxs("div", {
52
+ className: stat.className,
53
+ children: [/* @__PURE__ */ jsx("dt", {
54
+ className: "meteo-microlabel",
55
+ children: stat.label
56
+ }), /* @__PURE__ */ jsx("dd", { children: stat.value })]
57
+ }, stat.key))
58
+ })
59
+ ]
60
+ }, panel.key))
61
+ });
62
+ }
63
+ //#endregion
64
+ 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;