@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.
Files changed (134) 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 +53 -0
  4. package/dist/client/history.js +114 -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 +61 -0
  9. package/dist/climatology.js +208 -0
  10. package/dist/contract-climatology.d.ts +69 -0
  11. package/dist/contract-climatology.js +50 -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 +20 -12
  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 +16 -3
  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 +22 -3
  48. package/dist/geometry.js +41 -5
  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 +13 -6
  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 +19 -0
  69. package/dist/react/components/RecentSummaries.js +65 -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 +18 -3
  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 +6 -3
  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 +20 -6
  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/wind-history.d.ts +1 -0
  108. package/dist/scene/wind-history.js +4 -3
  109. package/dist/scene/wind-plot.d.ts +1 -0
  110. package/dist/scene/wind-plot.js +30 -3
  111. package/dist/server/adapter.d.ts +2 -1
  112. package/dist/server/adapter.js +2 -1
  113. package/dist/server/adapters/windnerd-climatology.d.ts +33 -0
  114. package/dist/server/adapters/windnerd-climatology.js +81 -0
  115. package/dist/server/adapters/windnerd-live.js +21 -13
  116. package/dist/server/adapters/windnerd.d.ts +31 -4
  117. package/dist/server/adapters/windnerd.js +197 -19
  118. package/dist/server/feed.d.ts +44 -2
  119. package/dist/server/feed.js +63 -2
  120. package/dist/server/handler.d.ts +11 -1
  121. package/dist/server/handler.js +83 -2
  122. package/dist/server/index.d.ts +4 -3
  123. package/dist/server/index.js +4 -3
  124. package/dist/strings.d.ts +12 -0
  125. package/dist/strings.js +12 -0
  126. package/package.json +2 -2
  127. package/schema/example-climatology.json +86 -0
  128. package/schema/example-history.json +38 -0
  129. package/schema/stationclimatology.schema.json +195 -0
  130. package/schema/stationcurrent.schema.json +173 -0
  131. package/schema/stationfeed.schema.json +173 -0
  132. package/schema/stationhistory.schema.json +186 -0
  133. package/schema/stationlive.schema.json +202 -0
  134. package/styles.css +215 -0
@@ -4,12 +4,13 @@ import { windRoseGate, windRoseScene, windRoseSource } from "../../scene/rose.js
4
4
  import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/react/components/WindRose.tsx
7
- function WindRose({ station: stationProp, stationId, points, sectorCount = 16, thresholds: thresholdsProp, favorableDirections, strings: stringsProp }) {
7
+ function WindRose({ station: stationProp, stationId, points, sectorCount = 16, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, strings: stringsProp }) {
8
8
  const context = useStationFeedContext();
9
9
  const station = stationProp ?? (points == null ? resolveStation(context, stationId) ?? void 0 : void 0);
10
- const { thresholds, words } = resolveDisplay(context, {
10
+ const { favorableDirections, thresholds, words } = resolveDisplay(context, {
11
11
  strings: stringsProp,
12
- thresholds: thresholdsProp
12
+ thresholds: thresholdsProp,
13
+ favorableDirections: favorableDirectionsProp
13
14
  });
14
15
  const source = windRoseSource(points, station);
15
16
  const gate = windRoseGate(source, words);
@@ -18,82 +19,90 @@ function WindRose({ station: stationProp, stationId, points, sectorCount = 16, t
18
19
  role: "note",
19
20
  children: gate.text
20
21
  });
21
- const scene = windRoseScene({
22
+ return /* @__PURE__ */ jsx(WindRoseSceneView, { scene: windRoseScene({
22
23
  favorableDirections,
23
24
  sectorCount,
24
25
  source,
25
26
  stationName: station?.name,
26
27
  thresholds,
27
28
  words
28
- });
29
+ }) });
30
+ }
31
+ /** One scene, one drawing — shared by the history-fed rose above and the
32
+ * climatology-fed twin, which appends its caption row as children. */
33
+ function WindRoseSceneView({ scene, children }) {
29
34
  return /* @__PURE__ */ jsxs("div", {
30
35
  className: scene.className,
31
- children: [/* @__PURE__ */ jsxs("svg", {
32
- "aria-label": scene.svg.ariaLabel,
33
- className: scene.svg.className,
34
- height: scene.svg.height,
35
- role: "img",
36
- viewBox: scene.svg.viewBox,
37
- width: scene.svg.width,
38
- children: [
39
- scene.gridCircles.map((circle) => /* @__PURE__ */ jsx("circle", {
40
- className: circle.className,
41
- cx: circle.cx,
42
- cy: circle.cy,
43
- r: circle.r
44
- }, circle.key)),
45
- scene.ring && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
46
- className: scene.ring.unfavorable.className,
47
- cx: scene.ring.unfavorable.cx,
48
- cy: scene.ring.unfavorable.cy,
49
- r: scene.ring.unfavorable.r
50
- }), scene.ring.favorable.map((arc) => /* @__PURE__ */ jsx("path", {
51
- className: arc.className,
52
- d: arc.d
53
- }, arc.key))] }),
54
- scene.ticks.map((tick) => /* @__PURE__ */ jsx("line", {
55
- className: tick.className,
56
- x1: tick.x1,
57
- x2: tick.x2,
58
- y1: tick.y1,
59
- y2: tick.y2
60
- }, tick.key)),
61
- scene.letters.map((letter) => /* @__PURE__ */ jsx("text", {
62
- className: letter.className,
63
- textAnchor: letter.anchor,
64
- x: letter.x,
65
- y: letter.y,
66
- children: letter.text
67
- }, letter.key)),
68
- scene.petals.map((petal) => /* @__PURE__ */ jsx("path", {
69
- className: petal.className,
70
- d: petal.d
71
- }, petal.key)),
72
- scene.ringLabel && /* @__PURE__ */ jsx("text", {
73
- className: scene.ringLabel.className,
74
- textAnchor: scene.ringLabel.anchor,
75
- x: scene.ringLabel.x,
76
- y: scene.ringLabel.y,
77
- children: scene.ringLabel.text
78
- }),
79
- /* @__PURE__ */ jsx("circle", {
80
- className: scene.hub.className,
81
- cx: scene.hub.cx,
82
- cy: scene.hub.cy,
83
- r: scene.hub.r
84
- }),
85
- /* @__PURE__ */ jsx("circle", {
86
- className: scene.dot.className,
87
- cx: scene.dot.cx,
88
- cy: scene.dot.cy,
89
- r: scene.dot.r
90
- })
91
- ]
92
- }), scene.calmCaption && /* @__PURE__ */ jsx("p", {
93
- className: scene.calmCaption.className,
94
- children: scene.calmCaption.text
95
- })]
36
+ children: [
37
+ /* @__PURE__ */ jsxs("svg", {
38
+ "aria-label": scene.svg.ariaLabel,
39
+ className: scene.svg.className,
40
+ height: scene.svg.height,
41
+ role: "img",
42
+ viewBox: scene.svg.viewBox,
43
+ width: scene.svg.width,
44
+ children: [
45
+ scene.gridCircles.map((circle) => /* @__PURE__ */ jsx("circle", {
46
+ className: circle.className,
47
+ cx: circle.cx,
48
+ cy: circle.cy,
49
+ r: circle.r
50
+ }, circle.key)),
51
+ scene.ring && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
52
+ className: scene.ring.unfavorable.className,
53
+ cx: scene.ring.unfavorable.cx,
54
+ cy: scene.ring.unfavorable.cy,
55
+ r: scene.ring.unfavorable.r
56
+ }), scene.ring.favorable.map((arc) => /* @__PURE__ */ jsx("path", {
57
+ className: arc.className,
58
+ d: arc.d
59
+ }, arc.key))] }),
60
+ scene.ticks.map((tick) => /* @__PURE__ */ jsx("line", {
61
+ className: tick.className,
62
+ x1: tick.x1,
63
+ x2: tick.x2,
64
+ y1: tick.y1,
65
+ y2: tick.y2
66
+ }, tick.key)),
67
+ scene.letters.map((letter) => /* @__PURE__ */ jsx("text", {
68
+ className: letter.className,
69
+ textAnchor: letter.anchor,
70
+ x: letter.x,
71
+ y: letter.y,
72
+ children: letter.text
73
+ }, letter.key)),
74
+ scene.petals.map((petal) => /* @__PURE__ */ jsx("path", {
75
+ className: petal.className,
76
+ d: petal.d
77
+ }, petal.key)),
78
+ scene.ringLabel && /* @__PURE__ */ jsx("text", {
79
+ className: scene.ringLabel.className,
80
+ textAnchor: scene.ringLabel.anchor,
81
+ x: scene.ringLabel.x,
82
+ y: scene.ringLabel.y,
83
+ children: scene.ringLabel.text
84
+ }),
85
+ /* @__PURE__ */ jsx("circle", {
86
+ className: scene.hub.className,
87
+ cx: scene.hub.cx,
88
+ cy: scene.hub.cy,
89
+ r: scene.hub.r
90
+ }),
91
+ /* @__PURE__ */ jsx("circle", {
92
+ className: scene.dot.className,
93
+ cx: scene.dot.cx,
94
+ cy: scene.dot.cy,
95
+ r: scene.dot.r
96
+ })
97
+ ]
98
+ }),
99
+ scene.calmCaption && /* @__PURE__ */ jsx("p", {
100
+ className: scene.calmCaption.className,
101
+ children: scene.calmCaption.text
102
+ }),
103
+ children
104
+ ]
96
105
  });
97
106
  }
98
107
  //#endregion
99
- export { WindRose };
108
+ export { WindRose, WindRoseSceneView };
@@ -1,12 +1,14 @@
1
1
  import { LiveSamples } from "../../contract.js";
2
2
  import { 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/WindSampleStrip.d.ts
6
- declare function WindSampleStrip({ samples, stationName, unit: unitProp, plotHeight, strings: stringsProp, formatTime: formatTimeProp }: {
7
+ declare function WindSampleStrip({ samples, stationName, unit: unitProp, favorableDirections: favorableDirectionsProp, plotHeight, strings: stringsProp, formatTime: formatTimeProp }: {
7
8
  samples: LiveSamples | null | undefined;
8
9
  stationName: string;
9
10
  unit?: SpeedUnit;
11
+ favorableDirections?: FavorableDirection[] | null;
10
12
  plotHeight?: number;
11
13
  strings?: StationStringOverrides;
12
14
  formatTime?: FormatTime;
@@ -8,10 +8,11 @@ import { useMeasuredChartWidth } from "../hooks/useMeasuredChartWidth.js";
8
8
  import { useRef, useState } from "react";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
10
  //#region src/react/components/WindSampleStrip.tsx
11
- function WindSampleStrip({ samples, stationName, unit: unitProp, plotHeight, strings: stringsProp, formatTime: formatTimeProp }) {
12
- const { formatTime, unit, words } = resolveDisplay(useStationFeedContext(), {
11
+ function WindSampleStrip({ samples, stationName, unit: unitProp, favorableDirections: favorableDirectionsProp, plotHeight, strings: stringsProp, formatTime: formatTimeProp }) {
12
+ const { favorableDirections, formatTime, unit, words } = resolveDisplay(useStationFeedContext(), {
13
13
  formatTime: formatTimeProp,
14
14
  strings: stringsProp,
15
+ favorableDirections: favorableDirectionsProp,
15
16
  unit: unitProp
16
17
  });
17
18
  const wrapRef = useRef(null);
@@ -26,6 +27,7 @@ function WindSampleStrip({ samples, stationName, unit: unitProp, plotHeight, str
26
27
  className: SAMPLE_STRIP_CLASS,
27
28
  ref: wrapRef,
28
29
  children: width != null && /* @__PURE__ */ jsx(MeasuredStrip, {
30
+ favorableDirections,
29
31
  formatTime,
30
32
  plotHeight,
31
33
  samples: gate.samples,
@@ -36,10 +38,11 @@ function WindSampleStrip({ samples, stationName, unit: unitProp, plotHeight, str
36
38
  })
37
39
  });
38
40
  }
39
- function MeasuredStrip({ formatTime, plotHeight, samples, stationName, unit, width, words }) {
41
+ function MeasuredStrip({ favorableDirections, formatTime, plotHeight, samples, stationName, unit, width, words }) {
40
42
  const [pinnedAt, setPinnedAt] = useState(null);
41
43
  const [previewIndex, setPreviewIndex] = useState(null);
42
44
  const scene = sampleStripScene({
45
+ favorableDirections,
43
46
  formatTime,
44
47
  plotHeight,
45
48
  samples,
@@ -1,6 +1,7 @@
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/atoms.d.ts
6
7
  type AtomProps = {
@@ -16,7 +17,9 @@ declare function Gust(props: SpeedAtomProps): import("react").JSX.Element;
16
17
  declare function Lull(props: SpeedAtomProps): import("react").JSX.Element;
17
18
  declare function Temperature({ station: stationProp, stationId, strings: stringsProp }: AtomProps): import("react").JSX.Element;
18
19
  declare function Pressure({ station: stationProp, stationId, strings: stringsProp }: AtomProps): import("react").JSX.Element;
19
- declare function Direction({ station: stationProp, stationId, strings: stringsProp }: AtomProps): import("react").JSX.Element;
20
+ declare function Direction({ station: stationProp, stationId, strings: stringsProp, favorableDirections: favorableDirectionsProp }: AtomProps & {
21
+ favorableDirections?: FavorableDirection[] | null;
22
+ }): import("react").JSX.Element;
20
23
  declare function UpdatedAt({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, strings: stringsProp, formatTime: formatTimeProp }: {
21
24
  station?: Station;
22
25
  stationId?: string;
@@ -63,10 +63,13 @@ function Pressure({ station: stationProp, stationId, strings: stringsProp }) {
63
63
  const { words } = resolveDisplay(context, { strings: stringsProp });
64
64
  return /* @__PURE__ */ jsx(ValueAtom, { scene: pressureAtomScene(station, words) });
65
65
  }
66
- function Direction({ station: stationProp, stationId, strings: stringsProp }) {
66
+ function Direction({ station: stationProp, stationId, strings: stringsProp, favorableDirections: favorableDirectionsProp }) {
67
67
  const { context, station } = useResolvedStation("Direction", stationProp, stationId);
68
- const { words } = resolveDisplay(context, { strings: stringsProp });
69
- const scene = directionAtomScene(station, words);
68
+ const { favorableDirections, words } = resolveDisplay(context, {
69
+ strings: stringsProp,
70
+ favorableDirections: favorableDirectionsProp
71
+ });
72
+ const scene = directionAtomScene(station, words, favorableDirections);
70
73
  if (scene.cell == null) return /* @__PURE__ */ jsx("span", {
71
74
  className: scene.className,
72
75
  children: scene.dashText
@@ -0,0 +1,18 @@
1
+ import { PollError } from "../../client/poll.js";
2
+ import { StationClimatology } from "../../contract-climatology.js";
3
+ import "../../client/index.js";
4
+ import "../../index.js";
5
+ //#region src/react/hooks/useStationClimatology.d.ts
6
+ /** Fetches the station's climatology document once and holds it — near-
7
+ * immutable history needs no poller; filters re-aggregate client-side. */
8
+ declare function useStationClimatology(base: string, stationId: string, options?: {
9
+ enabled?: boolean;
10
+ fetchInit?: RequestInit;
11
+ }): {
12
+ document: StationClimatology | null;
13
+ loading: boolean;
14
+ error: PollError | null;
15
+ refresh: () => void;
16
+ };
17
+ //#endregion
18
+ export { useStationClimatology };
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { climatologyEndpoint } from "../../endpoints.js";
3
+ import { createStationClimatologyStore } from "../../client/climatology.js";
4
+ import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
5
+ //#region src/react/hooks/useStationClimatology.ts
6
+ /** Fetches the station's climatology document once and holds it — near-
7
+ * immutable history needs no poller; filters re-aggregate client-side. */
8
+ function useStationClimatology(base, stationId, options = {}) {
9
+ const { enabled = true, fetchInit } = options;
10
+ const fetchInitRef = useRef(fetchInit);
11
+ fetchInitRef.current = fetchInit;
12
+ const store = useMemo(() => createStationClimatologyStore(climatologyEndpoint(base, stationId), { fetchInit: fetchInitRef.current }), [base, stationId]);
13
+ useEffect(() => {
14
+ if (enabled) store.load();
15
+ }, [store, enabled]);
16
+ const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
17
+ return {
18
+ document: snapshot.document,
19
+ loading: snapshot.loading,
20
+ error: snapshot.error,
21
+ refresh: () => void store.refresh()
22
+ };
23
+ }
24
+ //#endregion
25
+ export { useStationClimatology };
@@ -1,7 +1,10 @@
1
+ import { ReadoutPart } from "../scene/chart.js";
2
+ import "../scene/index.js";
1
3
  import { AirMatrix } from "./components/AirMatrix.js";
2
4
  import { BandChip, Direction, Gust, Lull, Pressure, Speed, Temperature, UpdatedAt } from "./components/atoms.js";
3
5
  import { CurrentConditions } from "./components/CurrentConditions.js";
4
6
  import { Dial } from "./components/Dial.js";
7
+ import { FavorableShare } from "./components/FavorableShare.js";
5
8
  import { FreshnessBadge } from "./components/FreshnessBadge.js";
6
9
  import { Sparkline } from "./components/Sparkline.js";
7
10
  import { StationMetaRenderer, StationTable } from "./components/StationTable.js";
@@ -9,9 +12,12 @@ import { StationFeedContextValue, StationFeedProvider, useStationFeedContext } f
9
12
  import { StationStrip } from "./components/StationStrip.js";
10
13
  import { TrendChart } from "./components/TrendChart.js";
11
14
  import { WindArrow } from "./components/WindArrow.js";
15
+ import { AirExtremes } from "./components/AirExtremes.js";
16
+ import { ClimatologyDailyPattern } from "./components/ClimatologyDailyPattern.js";
17
+ import { CompassFan } from "./components/CompassFan.js";
18
+ import { RecentSummaries } from "./components/RecentSummaries.js";
19
+ import { ClimatologyRose } from "./components/ClimatologyRose.js";
12
20
  import { DailyPattern } from "./components/DailyPattern.js";
13
- import { ReadoutPart } from "../scene/chart.js";
14
- import "../scene/index.js";
15
21
  import { Readout } from "./components/Readout.js";
16
22
  import { WindHistoryChart } from "./components/WindHistoryChart.js";
17
23
  import { WindRose } from "./components/WindRose.js";
@@ -20,7 +26,8 @@ import { StationCard, StationCardChart, StationCardHeader, StationCardInstrument
20
26
  import { useFreshness } from "./hooks/useFreshness.js";
21
27
  import { useMeasuredChartWidth } from "./hooks/useMeasuredChartWidth.js";
22
28
  import { useStation } from "./hooks/useStation.js";
29
+ import { useStationClimatology } from "./hooks/useStationClimatology.js";
23
30
  import { useStationCurrent } from "./hooks/useStationCurrent.js";
24
31
  import { useStationFeed } from "./hooks/useStationFeed.js";
25
32
  import { useStationLive } from "./hooks/useStationLive.js";
26
- export { AirMatrix, BandChip, CurrentConditions, DailyPattern, Dial, Direction, FreshnessBadge, Gust, Lull, Pressure, Readout, type ReadoutPart, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, type StationFeedContextValue, StationFeedProvider, type StationMetaRenderer, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, WindSampleStrip, useFreshness, useMeasuredChartWidth, useStation, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
33
+ export { AirExtremes, AirMatrix, BandChip, ClimatologyDailyPattern, ClimatologyRose, CompassFan, CurrentConditions, DailyPattern, Dial, Direction, FavorableShare, FreshnessBadge, Gust, Lull, Pressure, Readout, type ReadoutPart, RecentSummaries, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, type StationFeedContextValue, StationFeedProvider, type StationMetaRenderer, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, WindSampleStrip, useFreshness, useMeasuredChartWidth, useStation, useStationClimatology, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
@@ -7,19 +7,26 @@ import { useFreshness } from "./hooks/useFreshness.js";
7
7
  import { Dial } from "./components/Dial.js";
8
8
  import { FreshnessBadge } from "./components/FreshnessBadge.js";
9
9
  import { CurrentConditions } from "./components/CurrentConditions.js";
10
+ import { FavorableShare } from "./components/FavorableShare.js";
10
11
  import { Sparkline } from "./components/Sparkline.js";
11
12
  import { StationTable } from "./components/StationTable.js";
12
13
  import { StationStrip } from "./components/StationStrip.js";
13
14
  import { TrendChart } from "./components/TrendChart.js";
15
+ import { AirExtremes } from "./components/AirExtremes.js";
14
16
  import { DailyPattern } from "./components/DailyPattern.js";
17
+ import { ClimatologyDailyPattern } from "./components/ClimatologyDailyPattern.js";
18
+ import { CompassFan } from "./components/CompassFan.js";
19
+ import { RecentSummaries } from "./components/RecentSummaries.js";
20
+ import { WindRose } from "./components/WindRose.js";
21
+ import { ClimatologyRose } from "./components/ClimatologyRose.js";
15
22
  import { Readout } from "./components/Readout.js";
16
23
  import { useMeasuredChartWidth } from "./hooks/useMeasuredChartWidth.js";
17
24
  import { WindHistoryChart } from "./components/WindHistoryChart.js";
18
- import { WindRose } from "./components/WindRose.js";
19
25
  import { WindSampleStrip } from "./components/WindSampleStrip.js";
20
26
  import { StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary } from "./components/StationCard.js";
21
27
  import { useStationCurrent } from "./hooks/useStationCurrent.js";
22
28
  import { useStationFeed } from "./hooks/useStationFeed.js";
23
29
  import { useStationLive } from "./hooks/useStationLive.js";
24
30
  import { useStation } from "./hooks/useStation.js";
25
- export { AirMatrix, BandChip, CurrentConditions, DailyPattern, Dial, Direction, FreshnessBadge, Gust, Lull, Pressure, Readout, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, StationFeedProvider, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, WindSampleStrip, useFreshness, useMeasuredChartWidth, useStation, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
31
+ import { useStationClimatology } from "./hooks/useStationClimatology.js";
32
+ export { AirExtremes, AirMatrix, BandChip, ClimatologyDailyPattern, ClimatologyRose, CompassFan, CurrentConditions, DailyPattern, Dial, Direction, FavorableShare, FreshnessBadge, Gust, Lull, Pressure, Readout, RecentSummaries, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, StationFeedProvider, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, WindSampleStrip, useFreshness, useMeasuredChartWidth, useStation, useStationClimatology, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
@@ -0,0 +1,2 @@
1
+ import "../contract.js";
2
+ import "../strings.js";
@@ -0,0 +1,42 @@
1
+ import { lastNightLowC, pressureDeltaHpa } from "../derive.js";
2
+ import { temperatureValue } from "../format.js";
3
+ //#region src/scene/air-extremes.ts
4
+ const AIR_EXTREMES_CLASS = "meteo-air-extremes";
5
+ const PRESSURE_DELTA_WINDOW_HOURS = 3;
6
+ /** hidden without served history — the tiles are functions of it; each tile
7
+ * additionally stays absent when its own inputs are (no coordinates, no
8
+ * night; no carried pressure, no delta). */
9
+ function airExtremesGate(station) {
10
+ if (station == null || station.status !== "ok" || station.history == null) return { kind: "hidden" };
11
+ return {
12
+ kind: "draw",
13
+ station
14
+ };
15
+ }
16
+ function airExtremesScene(input) {
17
+ const { nowMs, station, words } = input;
18
+ const points = station.history?.points ?? [];
19
+ const tiles = [];
20
+ const night = lastNightLowC(points, station.latitude, station.longitude, nowMs);
21
+ if (night != null) tiles.push({
22
+ key: "last-night-low",
23
+ className: "meteo-air-extremes-tile",
24
+ label: words.lastNightLowLabel,
25
+ value: `${temperatureValue(night.lowC)} ${words.degC}`
26
+ });
27
+ const delta = pressureDeltaHpa(points, { windowHours: PRESSURE_DELTA_WINDOW_HOURS });
28
+ if (delta != null) tiles.push({
29
+ key: "pressure-delta",
30
+ className: "meteo-air-extremes-tile",
31
+ label: words.pressureDeltaLabel(PRESSURE_DELTA_WINDOW_HOURS),
32
+ value: `${delta >= 0 ? "+" : "−"}${Math.abs(delta).toFixed(1)} ${words.air.unitHpa}`
33
+ });
34
+ if (tiles.length === 0) return null;
35
+ return {
36
+ className: AIR_EXTREMES_CLASS,
37
+ ariaLabel: words.aria.airExtremes(station.name),
38
+ tiles
39
+ };
40
+ }
41
+ //#endregion
42
+ export { AIR_EXTREMES_CLASS, airExtremesGate, airExtremesScene };
@@ -1,4 +1,5 @@
1
1
  import "../contract.js";
2
2
  import "../derive.js";
3
3
  import "../strings.js";
4
- import "../format.js";
4
+ import "../format.js";
5
+ import "../instruments.js";
@@ -1,6 +1,7 @@
1
1
  import { compassDirection, isCalm, thresholdsToMps } from "../derive.js";
2
- import { readingAgeMs, roundSpeed, speedMpsOf, temperatureValue, updatedAtText } from "../format.js";
3
2
  import { speedBand } from "../geometry.js";
3
+ import { readingAgeMs, roundSpeed, speedMpsOf, temperatureValue, updatedAtText } from "../format.js";
4
+ import { inDirectionArcs } from "@azohra/meteo.core";
4
5
  //#region src/scene/atoms.ts
5
6
  const valueContent = (value, shown, unitWord) => value == null ? {
6
7
  kind: "dash",
@@ -37,7 +38,7 @@ function pressureAtomScene(station, words) {
37
38
  content: valueContent(hpa, (value) => value.toFixed(1), words.air.unitHpa)
38
39
  };
39
40
  }
40
- function directionAtomScene(station, words) {
41
+ function directionAtomScene(station, words, favorableDirections) {
41
42
  const reading = station.status === "ok" ? station.reading : null;
42
43
  if (reading == null) return {
43
44
  className: "meteo-direction",
@@ -47,9 +48,10 @@ function directionAtomScene(station, words) {
47
48
  };
48
49
  const bearingDeg = isCalm(reading.windAvgMps) ? null : reading.windDirectionDeg;
49
50
  const point = bearingDeg == null ? null : compassDirection(bearingDeg);
51
+ const verdict = bearingDeg == null || favorableDirections == null || favorableDirections.length === 0 ? null : inDirectionArcs(bearingDeg, favorableDirections);
50
52
  return {
51
- className: "meteo-direction",
52
- ariaLabel: point == null || bearingDeg == null ? void 0 : words.aria.direction(words.compassSpoken[point], Math.round(bearingDeg)),
53
+ className: verdict == null ? "meteo-direction" : verdict ? "meteo-direction meteo-direction-favorable" : "meteo-direction meteo-direction-unfavorable",
54
+ ariaLabel: point == null || bearingDeg == null ? void 0 : verdict == null ? words.aria.direction(words.compassSpoken[point], Math.round(bearingDeg)) : `${words.aria.direction(words.compassSpoken[point], Math.round(bearingDeg))} ${verdict ? words.aria.favorable : words.aria.unfavorable}`,
53
55
  cell: {
54
56
  windAvgMps: reading.windAvgMps,
55
57
  windDirectionDeg: reading.windDirectionDeg
@@ -0,0 +1,6 @@
1
+ import "../contract-climatology.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../instruments.js";
5
+ import "../climatology.js";
6
+ import "./daily-pattern.js";
@@ -0,0 +1,35 @@
1
+ import { climatologyCoverage, climatologyPattern } from "../climatology.js";
2
+ import { dailyPatternSlotsScene } from "./daily-pattern.js";
3
+ //#region src/scene/climatology-pattern.ts
4
+ const CLIMATOLOGY_PATTERN_CLASS = "meteo-climatology-daily-pattern";
5
+ function climatologyPatternGate(document, words) {
6
+ if (document == null || document.cells.length === 0) return {
7
+ kind: "note",
8
+ className: `${CLIMATOLOGY_PATTERN_CLASS} meteo-climatology-daily-pattern-na`,
9
+ text: words.noClimatology
10
+ };
11
+ return {
12
+ kind: "draw",
13
+ document
14
+ };
15
+ }
16
+ /** The cube's typical day through the daily-pattern drawing. The coverage
17
+ * percentage rides only the unfiltered view — the ledger cannot vouch for a
18
+ * filtered slice, which captions a plain sample count instead. */
19
+ function climatologyPatternScene(input) {
20
+ const { document, filters, ...rest } = input;
21
+ const slots = climatologyPattern(document, filters);
22
+ const totalSamples = slots.reduce((sum, slot) => sum + slot.sampleCount, 0);
23
+ const coverage = filters?.months == null ? climatologyCoverage(document) : null;
24
+ return dailyPatternSlotsScene({
25
+ ...rest,
26
+ slotMinutes: document.slotMinutes,
27
+ slots,
28
+ coverage: {
29
+ totalSamples,
30
+ expectedSamples: coverage != null && coverage.expectedCount > 0 ? coverage.expectedCount : null
31
+ }
32
+ });
33
+ }
34
+ //#endregion
35
+ export { CLIMATOLOGY_PATTERN_CLASS, climatologyPatternGate, climatologyPatternScene };
@@ -0,0 +1,5 @@
1
+ import "../contract-climatology.js";
2
+ import "../strings.js";
3
+ import "../instruments.js";
4
+ import "../climatology.js";
5
+ import "./rose.js";
@@ -0,0 +1,49 @@
1
+ import { climatologyCoverage, climatologyFavorableShare, climatologyRose } from "../climatology.js";
2
+ import { windRoseScene } from "./rose.js";
3
+ //#region src/scene/climatology-rose.ts
4
+ const CLIMATOLOGY_ROSE_CLASS = "meteo-climatology-rose";
5
+ function climatologyRoseGate(document, words) {
6
+ if (document == null || document.cells.length === 0) return {
7
+ kind: "note",
8
+ className: `${CLIMATOLOGY_ROSE_CLASS} meteo-climatology-rose-na`,
9
+ text: words.noClimatology
10
+ };
11
+ return {
12
+ kind: "draw",
13
+ document
14
+ };
15
+ }
16
+ function climatologyRoseScene(input) {
17
+ const { document, favorableDirections, filters, stationName, words } = input;
18
+ const summary = climatologyRose(document, filters);
19
+ const rose = windRoseScene({
20
+ favorableDirections,
21
+ sectorCount: document.sectorCount,
22
+ source: [],
23
+ stationName,
24
+ summary,
25
+ thresholds: void 0,
26
+ words
27
+ });
28
+ const captions = [];
29
+ const arcs = favorableDirections ?? [];
30
+ const share = arcs.length === 0 ? null : climatologyFavorableShare(document, arcs, filters);
31
+ if (share != null) captions.push({
32
+ key: "favorable",
33
+ className: "meteo-climatology-caption meteo-climatology-caption-favorable",
34
+ text: words.percentFavorable(Math.round(share * 100))
35
+ });
36
+ const coverage = filters?.months == null && filters?.slots == null ? climatologyCoverage(document) : null;
37
+ captions.push({
38
+ key: "samples",
39
+ className: "meteo-climatology-caption",
40
+ text: coverage != null && coverage.expectedCount > 0 ? words.dailyPatternCoverage(summary.sampleCount, coverage.expectedCount) : words.dailyPatternSamples(summary.sampleCount)
41
+ });
42
+ return {
43
+ className: CLIMATOLOGY_ROSE_CLASS,
44
+ rose,
45
+ captions
46
+ };
47
+ }
48
+ //#endregion
49
+ export { CLIMATOLOGY_ROSE_CLASS, climatologyRoseGate, climatologyRoseScene };
@@ -0,0 +1,3 @@
1
+ import "../contract.js";
2
+ import "../strings.js";
3
+ import "../instruments.js";