@azohra/meteo.station 0.6.0 → 0.7.1

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 (237) hide show
  1. package/README.md +17 -17
  2. package/dist/air.d.ts +4 -7
  3. package/dist/air.js +1 -2
  4. package/dist/client/climatology.d.ts +4 -7
  5. package/dist/client/climatology.js +1 -2
  6. package/dist/client/history.d.ts +14 -17
  7. package/dist/client/history.js +1 -2
  8. package/dist/client/live.d.ts +9 -11
  9. package/dist/client/live.js +1 -2
  10. package/dist/client/poll.d.ts +9 -12
  11. package/dist/client/poll.js +1 -2
  12. package/dist/client/stores.d.ts +8 -10
  13. package/dist/client/stores.js +1 -2
  14. package/dist/client/ticker.d.ts +1 -4
  15. package/dist/client/ticker.js +1 -2
  16. package/dist/climatology.d.ts +13 -15
  17. package/dist/climatology.js +1 -2
  18. package/dist/connectivity.d.ts +9 -12
  19. package/dist/connectivity.js +1 -2
  20. package/dist/contract-climatology.d.ts +11 -14
  21. package/dist/contract-climatology.js +1 -2
  22. package/dist/contract.d.ts +148 -151
  23. package/dist/contract.js +1 -2
  24. package/dist/derive.d.ts +24 -26
  25. package/dist/derive.js +5 -6
  26. package/dist/display.d.ts +6 -9
  27. package/dist/display.js +1 -2
  28. package/dist/elements/elements/AirExtremesElement.d.ts +2 -5
  29. package/dist/elements/elements/AirExtremesElement.js +6 -20
  30. package/dist/elements/elements/AirMatrixElement.d.ts +2 -5
  31. package/dist/elements/elements/AirMatrixElement.js +7 -33
  32. package/dist/elements/elements/ClimatologyDailyPatternElement.d.ts +2 -5
  33. package/dist/elements/elements/ClimatologyDailyPatternElement.js +18 -14
  34. package/dist/elements/elements/ClimatologyRoseElement.d.ts +2 -5
  35. package/dist/elements/elements/ClimatologyRoseElement.js +6 -17
  36. package/dist/elements/elements/CompassFanElement.d.ts +2 -5
  37. package/dist/elements/elements/CompassFanElement.js +6 -66
  38. package/dist/elements/elements/CurrentConditionsElement.d.ts +2 -5
  39. package/dist/elements/elements/CurrentConditionsElement.js +8 -28
  40. package/dist/elements/elements/DailyPatternElement.d.ts +2 -6
  41. package/dist/elements/elements/DailyPatternElement.js +7 -122
  42. package/dist/elements/elements/DialElement.d.ts +2 -5
  43. package/dist/elements/elements/DialElement.js +4 -97
  44. package/dist/elements/elements/FavorableShareElement.d.ts +2 -5
  45. package/dist/elements/elements/FavorableShareElement.js +7 -23
  46. package/dist/elements/elements/FreshnessBadgeElement.d.ts +2 -5
  47. package/dist/elements/elements/FreshnessBadgeElement.js +1 -2
  48. package/dist/elements/elements/RecentSummariesElement.d.ts +2 -5
  49. package/dist/elements/elements/RecentSummariesElement.js +7 -25
  50. package/dist/elements/elements/SparklineElement.d.ts +2 -6
  51. package/dist/elements/elements/SparklineElement.js +5 -41
  52. package/dist/elements/elements/StationCardElement.d.ts +6 -8
  53. package/dist/elements/elements/StationCardElement.js +5 -20
  54. package/dist/elements/elements/StationFeedElement.d.ts +2 -5
  55. package/dist/elements/elements/StationFeedElement.js +5 -4
  56. package/dist/elements/elements/StationStripElement.d.ts +2 -5
  57. package/dist/elements/elements/StationStripElement.js +5 -20
  58. package/dist/elements/elements/StationTableElement.d.ts +3 -6
  59. package/dist/elements/elements/StationTableElement.js +16 -53
  60. package/dist/elements/elements/TrendChartElement.d.ts +2 -5
  61. package/dist/elements/elements/TrendChartElement.js +22 -71
  62. package/dist/elements/elements/WindArrowElement.d.ts +2 -5
  63. package/dist/elements/elements/WindArrowElement.js +1 -2
  64. package/dist/elements/elements/WindHistoryChartElement.d.ts +2 -5
  65. package/dist/elements/elements/WindHistoryChartElement.js +24 -166
  66. package/dist/elements/elements/WindRoseElement.d.ts +2 -6
  67. package/dist/elements/elements/WindRoseElement.js +7 -72
  68. package/dist/elements/elements/atoms.d.ts +10 -12
  69. package/dist/elements/elements/atoms.js +12 -40
  70. package/dist/elements/index.d.ts +3 -5
  71. package/dist/elements/index.js +4 -5
  72. package/dist/elements/lib/ambient.d.ts +2 -5
  73. package/dist/elements/lib/ambient.js +1 -2
  74. package/dist/elements/lib/attributes.js +1 -2
  75. package/dist/elements/lib/base.d.ts +3 -6
  76. package/dist/elements/lib/base.js +1 -2
  77. package/dist/elements/lib/context.js +1 -2
  78. package/dist/elements/lib/fragments.js +9 -39
  79. package/dist/elements/lib/h.js +2 -3
  80. package/dist/elements/lib/pinned-cursor.js +1 -2
  81. package/dist/elements/lib/render.js +29 -0
  82. package/dist/elements/register.js +1 -2
  83. package/dist/endpoints.d.ts +6 -9
  84. package/dist/endpoints.js +1 -2
  85. package/dist/fixtures.d.ts +7 -10
  86. package/dist/fixtures.js +1 -2
  87. package/dist/format.d.ts +11 -14
  88. package/dist/format.js +1 -2
  89. package/dist/geometry.d.ts +36 -38
  90. package/dist/geometry.js +3 -3
  91. package/dist/instruments.d.ts +37 -40
  92. package/dist/instruments.js +3 -4
  93. package/dist/merge-current.d.ts +4 -7
  94. package/dist/merge-current.js +1 -2
  95. package/dist/react/components/AirExtremes.d.ts +2 -5
  96. package/dist/react/components/AirExtremes.js +6 -24
  97. package/dist/react/components/AirMatrix.d.ts +2 -5
  98. package/dist/react/components/AirMatrix.js +11 -45
  99. package/dist/react/components/ClimatologyDailyPattern.d.ts +2 -5
  100. package/dist/react/components/ClimatologyDailyPattern.js +20 -15
  101. package/dist/react/components/ClimatologyRose.d.ts +2 -5
  102. package/dist/react/components/ClimatologyRose.js +12 -30
  103. package/dist/react/components/CompassFan.d.ts +2 -5
  104. package/dist/react/components/CompassFan.js +7 -75
  105. package/dist/react/components/CurrentConditions.d.ts +2 -5
  106. package/dist/react/components/CurrentConditions.js +12 -76
  107. package/dist/react/components/DailyPattern.d.ts +3 -8
  108. package/dist/react/components/DailyPattern.js +11 -151
  109. package/dist/react/components/Dial.d.ts +2 -5
  110. package/dist/react/components/Dial.js +6 -120
  111. package/dist/react/components/FavorableShare.d.ts +2 -5
  112. package/dist/react/components/FavorableShare.js +7 -29
  113. package/dist/react/components/FreshnessBadge.d.ts +2 -5
  114. package/dist/react/components/FreshnessBadge.js +6 -14
  115. package/dist/react/components/Readout.d.ts +2 -5
  116. package/dist/react/components/Readout.js +1 -2
  117. package/dist/react/components/RecentSummaries.d.ts +2 -5
  118. package/dist/react/components/RecentSummaries.js +7 -46
  119. package/dist/react/components/SceneTree.js +37 -0
  120. package/dist/react/components/Sparkline.d.ts +2 -5
  121. package/dist/react/components/Sparkline.js +4 -41
  122. package/dist/react/components/StationCard.d.ts +8 -10
  123. package/dist/react/components/StationCard.js +6 -47
  124. package/dist/react/components/StationFeedProvider.d.ts +3 -6
  125. package/dist/react/components/StationFeedProvider.js +1 -2
  126. package/dist/react/components/StationStrip.d.ts +2 -5
  127. package/dist/react/components/StationStrip.js +6 -62
  128. package/dist/react/components/StationTable.d.ts +3 -6
  129. package/dist/react/components/StationTable.js +22 -77
  130. package/dist/react/components/TrendChart.d.ts +2 -5
  131. package/dist/react/components/TrendChart.js +9 -65
  132. package/dist/react/components/WindArrow.d.ts +2 -5
  133. package/dist/react/components/WindArrow.js +4 -17
  134. package/dist/react/components/WindHistoryChart.d.ts +2 -5
  135. package/dist/react/components/WindHistoryChart.js +9 -184
  136. package/dist/react/components/WindRose.d.ts +2 -7
  137. package/dist/react/components/WindRose.js +7 -91
  138. package/dist/react/components/WindSampleStrip.d.ts +2 -5
  139. package/dist/react/components/WindSampleStrip.js +9 -117
  140. package/dist/react/components/atoms.d.ts +12 -14
  141. package/dist/react/components/atoms.js +13 -50
  142. package/dist/react/hooks/useFreshness.d.ts +1 -4
  143. package/dist/react/hooks/useFreshness.js +1 -2
  144. package/dist/react/hooks/useMeasuredChartWidth.d.ts +2 -5
  145. package/dist/react/hooks/useMeasuredChartWidth.js +1 -2
  146. package/dist/react/hooks/usePolledJson.js +1 -2
  147. package/dist/react/hooks/useStation.d.ts +2 -5
  148. package/dist/react/hooks/useStation.js +1 -2
  149. package/dist/react/hooks/useStationClimatology.d.ts +2 -5
  150. package/dist/react/hooks/useStationClimatology.js +1 -2
  151. package/dist/react/hooks/useStationCurrent.d.ts +2 -5
  152. package/dist/react/hooks/useStationCurrent.js +4 -4
  153. package/dist/react/hooks/useStationFeed.d.ts +2 -5
  154. package/dist/react/hooks/useStationFeed.js +4 -4
  155. package/dist/react/hooks/useStationLive.d.ts +2 -5
  156. package/dist/react/hooks/useStationLive.js +1 -2
  157. package/dist/react/index.d.ts +2 -2
  158. package/dist/react/index.js +5 -5
  159. package/dist/react/lib/cells.js +5 -26
  160. package/dist/react/lib/use-pinned-cursor.js +1 -2
  161. package/dist/samples.d.ts +8 -11
  162. package/dist/samples.js +1 -2
  163. package/dist/scene/air-extremes.js +13 -29
  164. package/dist/scene/air-matrix.js +46 -60
  165. package/dist/scene/atoms.js +1 -2
  166. package/dist/scene/card.js +15 -42
  167. package/dist/scene/cells.d.ts +4 -0
  168. package/dist/scene/cells.js +50 -0
  169. package/dist/scene/chart.d.ts +2 -5
  170. package/dist/scene/chart.js +3 -3
  171. package/dist/scene/climatology-pattern.d.ts +1 -2
  172. package/dist/scene/climatology-pattern.js +11 -13
  173. package/dist/scene/climatology-rose.d.ts +1 -2
  174. package/dist/scene/climatology-rose.js +15 -35
  175. package/dist/scene/compass-fan.js +29 -102
  176. package/dist/scene/current.d.ts +2 -1
  177. package/dist/scene/current.js +30 -58
  178. package/dist/scene/daily-pattern.d.ts +1 -3
  179. package/dist/scene/daily-pattern.js +21 -29
  180. package/dist/scene/dial-parts.d.ts +1 -0
  181. package/dist/scene/dial-parts.js +69 -0
  182. package/dist/scene/dial.d.ts +1 -2
  183. package/dist/scene/dial.js +49 -138
  184. package/dist/scene/favorable-share.js +17 -35
  185. package/dist/scene/glyphs.js +21 -18
  186. package/dist/scene/index.d.ts +5 -3
  187. package/dist/scene/node.js +18 -0
  188. package/dist/scene/recent-summaries.js +27 -65
  189. package/dist/scene/rose.js +90 -119
  190. package/dist/scene/sample-strip.d.ts +1 -2
  191. package/dist/scene/sample-strip.js +36 -38
  192. package/dist/scene/sparkline.js +32 -42
  193. package/dist/scene/strip.js +19 -59
  194. package/dist/scene/table.js +48 -71
  195. package/dist/scene/trend.d.ts +1 -2
  196. package/dist/scene/trend.js +30 -57
  197. package/dist/scene/wind-history.d.ts +1 -2
  198. package/dist/scene/wind-history.js +42 -53
  199. package/dist/scene/wind-plot.js +71 -142
  200. package/dist/server/adapter.d.ts +7 -10
  201. package/dist/server/adapter.js +1 -2
  202. package/dist/server/adapters/campbell.d.ts +18 -20
  203. package/dist/server/adapters/campbell.js +2 -3
  204. package/dist/server/adapters/ecowitt.d.ts +12 -15
  205. package/dist/server/adapters/ecowitt.js +1 -2
  206. package/dist/server/adapters/tempest.d.ts +10 -13
  207. package/dist/server/adapters/tempest.js +1 -2
  208. package/dist/server/adapters/windnerd-climatology.d.ts +5 -8
  209. package/dist/server/adapters/windnerd-climatology.js +5 -5
  210. package/dist/server/adapters/windnerd-live.d.ts +2 -5
  211. package/dist/server/adapters/windnerd-live.js +4 -4
  212. package/dist/server/adapters/windnerd.d.ts +30 -33
  213. package/dist/server/adapters/windnerd.js +2 -3
  214. package/dist/server/config.d.ts +61 -63
  215. package/dist/server/config.js +1 -2
  216. package/dist/server/environment.d.ts +20 -22
  217. package/dist/server/environment.js +1 -2
  218. package/dist/server/feed.d.ts +19 -21
  219. package/dist/server/feed.js +1 -2
  220. package/dist/server/handler.d.ts +4 -7
  221. package/dist/server/handler.js +1 -2
  222. package/dist/server/hologram.d.ts +9 -12
  223. package/dist/server/hologram.js +3 -3
  224. package/dist/server/live.d.ts +2 -5
  225. package/dist/server/live.js +1 -2
  226. package/dist/sse.js +1 -2
  227. package/dist/strings.d.ts +8 -11
  228. package/dist/strings.js +1 -2
  229. package/dist/windnerd.d.ts +4 -7
  230. package/dist/windnerd.js +1 -2
  231. package/package.json +12 -17
  232. package/schema/README.md +1 -1
  233. package/schema/stationclimatology.schema.json +64 -61
  234. package/schema/stationcurrent.schema.json +68 -156
  235. package/schema/stationfeed.schema.json +71 -163
  236. package/schema/stationhistory.schema.json +37 -46
  237. package/schema/stationlive.schema.json +221 -306
@@ -1,12 +1,13 @@
1
1
  "use client";
2
2
  import { resolveDisplay } from "../../display.js";
3
3
  import { subscribeTicker } from "../../client/ticker.js";
4
- import { bandChipScene, directionAtomScene, pressureAtomScene, speedAtomScene, temperatureAtomScene, updatedAtScene } from "../../scene/atoms.js";
4
+ import { pressureAtomScene, speedAtomScene, temperatureAtomScene } from "../../scene/atoms.js";
5
+ import { bandChipNode, directionAtomNode, updatedAtNode, valueAtomNode } from "../../scene/cells.js";
6
+ import { renderScene } from "./SceneTree.js";
5
7
  import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
6
- import { DirectionCell } from "../lib/cells.js";
7
8
  import { useEffect, useState } from "react";
8
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
- //#region src/react/components/atoms.tsx
9
+ import { jsx } from "react/jsx-runtime";
10
+ // src/react/components/atoms.tsx
10
11
  function useResolvedStation(component, stationProp, stationId) {
11
12
  const context = useStationFeedContext();
12
13
  return {
@@ -14,23 +15,13 @@ function useResolvedStation(component, stationProp, stationId) {
14
15
  station: requireResolved(component, "station", stationProp ?? resolveStation(context, stationId))
15
16
  };
16
17
  }
17
- function ValueAtom({ scene }) {
18
- return /* @__PURE__ */ jsx("data", {
19
- className: scene.className,
20
- value: scene.value,
21
- children: scene.content.kind === "dash" ? scene.content.text : /* @__PURE__ */ jsxs(Fragment, { children: [scene.content.text, /* @__PURE__ */ jsx("span", {
22
- className: scene.content.unit.className,
23
- children: scene.content.unit.text
24
- })] })
25
- });
26
- }
27
18
  function SpeedValue({ component, kind, station: stationProp, stationId, unit: unitProp, strings: stringsProp }) {
28
19
  const { context, station } = useResolvedStation(component, stationProp, stationId);
29
20
  const { unit, words } = resolveDisplay(context, {
30
21
  strings: stringsProp,
31
22
  unit: unitProp
32
23
  });
33
- return /* @__PURE__ */ jsx(ValueAtom, { scene: speedAtomScene(station, kind, unit, words) });
24
+ return renderScene(valueAtomNode(speedAtomScene(station, kind, unit, words)));
34
25
  }
35
26
  function Speed(props) {
36
27
  return /* @__PURE__ */ jsx(SpeedValue, {
@@ -56,12 +47,12 @@ function Lull(props) {
56
47
  function Temperature({ station: stationProp, stationId, strings: stringsProp }) {
57
48
  const { context, station } = useResolvedStation("Temperature", stationProp, stationId);
58
49
  const { words } = resolveDisplay(context, { strings: stringsProp });
59
- return /* @__PURE__ */ jsx(ValueAtom, { scene: temperatureAtomScene(station, words) });
50
+ return renderScene(valueAtomNode(temperatureAtomScene(station, words)));
60
51
  }
61
52
  function Pressure({ station: stationProp, stationId, strings: stringsProp }) {
62
53
  const { context, station } = useResolvedStation("Pressure", stationProp, stationId);
63
54
  const { words } = resolveDisplay(context, { strings: stringsProp });
64
- return /* @__PURE__ */ jsx(ValueAtom, { scene: pressureAtomScene(station, words) });
55
+ return renderScene(valueAtomNode(pressureAtomScene(station, words)));
65
56
  }
66
57
  function Direction({ station: stationProp, stationId, strings: stringsProp, favorableDirections: favorableDirectionsProp }) {
67
58
  const { context, station } = useResolvedStation("Direction", stationProp, stationId);
@@ -69,20 +60,7 @@ function Direction({ station: stationProp, stationId, strings: stringsProp, favo
69
60
  strings: stringsProp,
70
61
  favorableDirections: favorableDirectionsProp
71
62
  });
72
- const scene = directionAtomScene(station, words, favorableDirections);
73
- if (scene.cell == null) return /* @__PURE__ */ jsx("span", {
74
- className: scene.className,
75
- children: scene.dashText
76
- });
77
- return /* @__PURE__ */ jsx("span", {
78
- "aria-label": scene.ariaLabel,
79
- className: scene.className,
80
- children: /* @__PURE__ */ jsx(DirectionCell, {
81
- windAvgMps: scene.cell.windAvgMps,
82
- windDirectionDeg: scene.cell.windDirectionDeg,
83
- words
84
- })
85
- });
63
+ return renderScene(directionAtomNode(station, words, favorableDirections));
86
64
  }
87
65
  function UpdatedAt({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, strings: stringsProp, formatTime: formatTimeProp }) {
88
66
  const { context, station } = useResolvedStation("UpdatedAt", stationProp, stationId);
@@ -97,23 +75,14 @@ function UpdatedAt({ station: stationProp, stationId, servedAt: servedAtProp, re
97
75
  setNowMs(Date.now());
98
76
  return subscribeTicker(() => setNowMs(Date.now()));
99
77
  }, []);
100
- const scene = updatedAtScene({
78
+ return renderScene(updatedAtNode({
101
79
  formatTime,
102
80
  nowMs,
103
81
  receivedAtMs,
104
82
  servedAt,
105
83
  station,
106
84
  words
107
- });
108
- if (scene.kind === "dash") return /* @__PURE__ */ jsx("span", {
109
- className: scene.className,
110
- children: scene.text
111
- });
112
- return /* @__PURE__ */ jsx("time", {
113
- className: scene.className,
114
- dateTime: scene.dateTime,
115
- children: scene.text
116
- });
85
+ }));
117
86
  }
118
87
  function BandChip({ station: stationProp, stationId, thresholds: thresholdsProp, labels, unit: unitProp, strings: stringsProp }) {
119
88
  const { context, station } = useResolvedStation("BandChip", stationProp, stationId);
@@ -122,18 +91,12 @@ function BandChip({ station: stationProp, stationId, thresholds: thresholdsProp,
122
91
  thresholds: thresholdsProp,
123
92
  unit: unitProp
124
93
  });
125
- const scene = bandChipScene({
94
+ return renderScene(bandChipNode({
126
95
  labels,
127
96
  station,
128
97
  thresholds,
129
98
  unit,
130
99
  words
131
- });
132
- return /* @__PURE__ */ jsx("span", {
133
- className: scene.className,
134
- "data-band": scene.band,
135
- children: scene.text
136
- });
100
+ }));
137
101
  }
138
- //#endregion
139
102
  export { BandChip, Direction, Gust, Lull, Pressure, Speed, Temperature, UpdatedAt };
@@ -1,6 +1,3 @@
1
1
  import { FreshnessStatus, FreshnessThresholds } from "../../derive.js";
2
2
  import "../../index.js";
3
- //#region src/react/hooks/useFreshness.d.ts
4
- declare function useFreshness(observedAt: string | null | undefined, servedAt: string | null | undefined, receivedAtMs: number | null | undefined, thresholds?: FreshnessThresholds): FreshnessStatus | null;
5
- //#endregion
6
- export { useFreshness };
3
+ export declare function useFreshness(observedAt: string | null | undefined, servedAt: string | null | undefined, receivedAtMs: number | null | undefined, thresholds?: FreshnessThresholds): FreshnessStatus | null;
@@ -2,7 +2,7 @@
2
2
  import { freshness } from "../../derive.js";
3
3
  import { subscribeTicker } from "../../client/ticker.js";
4
4
  import { useEffect, useState } from "react";
5
- //#region src/react/hooks/useFreshness.ts
5
+ // src/react/hooks/useFreshness.ts
6
6
  function useFreshness(observedAt, servedAt, receivedAtMs, thresholds) {
7
7
  const [nowMs, setNowMs] = useState(() => receivedAtMs ?? Date.now());
8
8
  useEffect(() => {
@@ -17,5 +17,4 @@ function useFreshness(observedAt, servedAt, receivedAtMs, thresholds) {
17
17
  nowMs
18
18
  }, thresholds);
19
19
  }
20
- //#endregion
21
20
  export { useFreshness };
@@ -1,8 +1,5 @@
1
- //#region src/react/hooks/useMeasuredChartWidth.d.ts
2
- declare function useMeasuredChartWidth(ref: {
1
+ export declare function useMeasuredChartWidth(ref: {
3
2
  readonly current: Element | null;
4
3
  }, { enabled }?: {
5
4
  enabled?: boolean;
6
- }): number | null;
7
- //#endregion
8
- export { useMeasuredChartWidth };
5
+ }): number | null;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { measuredChartWidth } from "../../geometry.js";
3
3
  import { useEffect, useLayoutEffect, useState } from "react";
4
- //#region src/react/hooks/useMeasuredChartWidth.ts
4
+ // src/react/hooks/useMeasuredChartWidth.ts
5
5
  const useMeasureEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
6
6
  function useMeasuredChartWidth(ref, { enabled = true } = {}) {
7
7
  const [width, setWidth] = useState(null);
@@ -22,5 +22,4 @@ function useMeasuredChartWidth(ref, { enabled = true } = {}) {
22
22
  }, [ref, enabled]);
23
23
  return width;
24
24
  }
25
- //#endregion
26
25
  export { useMeasuredChartWidth };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useCallback, useEffect, useSyncExternalStore } from "react";
3
- //#region src/react/hooks/usePolledJson.ts
3
+ // src/react/hooks/usePolledJson.ts
4
4
  function usePoller(poller, enabled) {
5
5
  const snapshot = useSyncExternalStore(poller.subscribe, poller.getSnapshot, poller.getSnapshot);
6
6
  useEffect(() => {
@@ -13,5 +13,4 @@ function usePoller(poller, enabled) {
13
13
  refresh: useCallback(() => poller.refresh(), [poller])
14
14
  };
15
15
  }
16
- //#endregion
17
16
  export { usePoller };
@@ -2,8 +2,7 @@ import { PollError } from "../../client/poll.js";
2
2
  import { Station, StationFeed } from "../../contract.js";
3
3
  import "../../client/index.js";
4
4
  import "../../index.js";
5
- //#region src/react/hooks/useStation.d.ts
6
- declare function useStation(url: string, stationId: string, options?: {
5
+ export declare function useStation(url: string, stationId: string, options?: {
7
6
  pollSeconds?: number;
8
7
  currentPollSeconds?: number;
9
8
  enabled?: boolean;
@@ -19,6 +18,4 @@ declare function useStation(url: string, stationId: string, options?: {
19
18
  receivedAtMs: number | null;
20
19
  error: PollError | null;
21
20
  refresh: () => void;
22
- };
23
- //#endregion
24
- export { useStation };
21
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { createStationStore } from "../../client/stores.js";
3
3
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
4
- //#region src/react/hooks/useStation.ts
4
+ // src/react/hooks/useStation.ts
5
5
  function useStation(url, stationId, options = {}) {
6
6
  const { pollSeconds, currentPollSeconds, enabled = true, fetchInit, initialData } = options;
7
7
  const live = options.live === true;
@@ -36,5 +36,4 @@ function useStation(url, stationId, options = {}) {
36
36
  refresh: () => store.refresh()
37
37
  };
38
38
  }
39
- //#endregion
40
39
  export { useStation };
@@ -2,10 +2,9 @@ import { PollError } from "../../client/poll.js";
2
2
  import { StationClimatology } from "../../contract-climatology.js";
3
3
  import "../../client/index.js";
4
4
  import "../../index.js";
5
- //#region src/react/hooks/useStationClimatology.d.ts
6
5
  /** Fetches the station's climatology document once and holds it — near-
7
6
  * immutable history needs no poller; filters re-aggregate client-side. */
8
- declare function useStationClimatology(base: string, stationId: string, options?: {
7
+ export declare function useStationClimatology(base: string, stationId: string, options?: {
9
8
  enabled?: boolean;
10
9
  fetchInit?: RequestInit;
11
10
  }): {
@@ -13,6 +12,4 @@ declare function useStationClimatology(base: string, stationId: string, options?
13
12
  loading: boolean;
14
13
  error: PollError | null;
15
14
  refresh: () => void;
16
- };
17
- //#endregion
18
- export { useStationClimatology };
15
+ };
@@ -2,7 +2,7 @@
2
2
  import { climatologyEndpoint } from "../../endpoints.js";
3
3
  import { createStationClimatologyStore } from "../../client/climatology.js";
4
4
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
5
- //#region src/react/hooks/useStationClimatology.ts
5
+ // src/react/hooks/useStationClimatology.ts
6
6
  /** Fetches the station's climatology document once and holds it — near-
7
7
  * immutable history needs no poller; filters re-aggregate client-side. */
8
8
  function useStationClimatology(base, stationId, options = {}) {
@@ -21,5 +21,4 @@ function useStationClimatology(base, stationId, options = {}) {
21
21
  refresh: () => void store.refresh()
22
22
  };
23
23
  }
24
- //#endregion
25
24
  export { useStationClimatology };
@@ -2,8 +2,7 @@ import { PollError } from "../../client/poll.js";
2
2
  import { Station, StationCurrent } from "../../contract.js";
3
3
  import "../../client/index.js";
4
4
  import "../../index.js";
5
- //#region src/react/hooks/useStationCurrent.d.ts
6
- declare function useStationCurrent(url: string, stationId: string, options?: {
5
+ export declare function useStationCurrent(url: string, stationId: string, options?: {
7
6
  pollSeconds?: number;
8
7
  enabled?: boolean;
9
8
  fetchInit?: RequestInit;
@@ -18,6 +17,4 @@ declare function useStationCurrent(url: string, stationId: string, options?: {
18
17
  error: PollError | null;
19
18
  receivedAtMs: number | null;
20
19
  refresh: () => void;
21
- };
22
- //#endregion
23
- export { useStationCurrent };
20
+ };
@@ -2,7 +2,7 @@
2
2
  import { createStationCurrentStore } from "../../client/stores.js";
3
3
  import { usePoller } from "./usePolledJson.js";
4
4
  import { useMemo, useRef } from "react";
5
- //#region src/react/hooks/useStationCurrent.ts
5
+ // src/react/hooks/useStationCurrent.ts
6
6
  function useStationCurrent(url, stationId, options = {}) {
7
7
  const { pollSeconds, enabled = true, fetchInit, initialData } = options;
8
8
  const fetchInitRef = useRef(fetchInit);
@@ -10,7 +10,7 @@ function useStationCurrent(url, stationId, options = {}) {
10
10
  const initialRef = useRef(initialData);
11
11
  const mountUrlRef = useRef(url);
12
12
  const mountStationRef = useRef(stationId);
13
- const { snapshot, refresh } = usePoller(useMemo(() => createStationCurrentStore(url, stationId, {
13
+ const store = useMemo(() => createStationCurrentStore(url, stationId, {
14
14
  ...pollSeconds != null ? { pollSeconds } : {},
15
15
  fetchInit: () => fetchInitRef.current,
16
16
  ...url === mountUrlRef.current && stationId === mountStationRef.current && initialRef.current != null ? { initial: initialRef.current } : {}
@@ -18,7 +18,8 @@ function useStationCurrent(url, stationId, options = {}) {
18
18
  url,
19
19
  stationId,
20
20
  pollSeconds
21
- ]), enabled);
21
+ ]);
22
+ const { snapshot, refresh } = usePoller(store, enabled);
22
23
  return {
23
24
  current: snapshot.data,
24
25
  station: snapshot.data?.station ?? null,
@@ -28,5 +29,4 @@ function useStationCurrent(url, stationId, options = {}) {
28
29
  refresh
29
30
  };
30
31
  }
31
- //#endregion
32
32
  export { useStationCurrent };
@@ -2,8 +2,7 @@ import { PollError } from "../../client/poll.js";
2
2
  import { StationFeed } from "../../contract.js";
3
3
  import "../../client/index.js";
4
4
  import "../../index.js";
5
- //#region src/react/hooks/useStationFeed.d.ts
6
- declare function useStationFeed(url: string, options?: {
5
+ export declare function useStationFeed(url: string, options?: {
7
6
  pollSeconds?: number;
8
7
  enabled?: boolean;
9
8
  fetchInit?: RequestInit;
@@ -16,6 +15,4 @@ declare function useStationFeed(url: string, options?: {
16
15
  error: PollError | null;
17
16
  receivedAtMs: number | null;
18
17
  refresh: () => void;
19
- };
20
- //#endregion
21
- export { useStationFeed };
18
+ };
@@ -2,21 +2,22 @@
2
2
  import { createStationFeedStore } from "../../client/stores.js";
3
3
  import { usePoller } from "./usePolledJson.js";
4
4
  import { useMemo, useRef } from "react";
5
- //#region src/react/hooks/useStationFeed.ts
5
+ // src/react/hooks/useStationFeed.ts
6
6
  function useStationFeed(url, options = {}) {
7
7
  const { pollSeconds, enabled = true, fetchInit, initialData } = options;
8
8
  const fetchInitRef = useRef(fetchInit);
9
9
  fetchInitRef.current = fetchInit;
10
10
  const initialRef = useRef(initialData);
11
11
  const mountUrlRef = useRef(url);
12
- const { snapshot, refresh } = usePoller(useMemo(() => createStationFeedStore(url, {
12
+ const store = useMemo(() => createStationFeedStore(url, {
13
13
  ...pollSeconds != null ? { pollSeconds } : {},
14
14
  fetchInit: () => fetchInitRef.current,
15
15
  ...url === mountUrlRef.current && initialRef.current != null ? { initial: {
16
16
  feed: initialRef.current.feed,
17
17
  receivedAtMs: initialRef.current.receivedAtMs
18
18
  } } : {}
19
- }), [url, pollSeconds]), enabled);
19
+ }), [url, pollSeconds]);
20
+ const { snapshot, refresh } = usePoller(store, enabled);
20
21
  return {
21
22
  feed: snapshot.data,
22
23
  error: snapshot.error,
@@ -24,5 +25,4 @@ function useStationFeed(url, options = {}) {
24
25
  refresh
25
26
  };
26
27
  }
27
- //#endregion
28
28
  export { useStationFeed };
@@ -3,8 +3,7 @@ import { LiveSample, Station } from "../../contract.js";
3
3
  import { LiveStatus } from "../../client/live.js";
4
4
  import "../../client/index.js";
5
5
  import "../../index.js";
6
- //#region src/react/hooks/useStationLive.d.ts
7
- declare function useStationLive(url: string, stationId: string, options?: {
6
+ export declare function useStationLive(url: string, stationId: string, options?: {
8
7
  enabled?: boolean;
9
8
  fetchInit?: RequestInit;
10
9
  windowSeconds?: number;
@@ -15,6 +14,4 @@ declare function useStationLive(url: string, stationId: string, options?: {
15
14
  servedAt: string | null;
16
15
  receivedAtMs: number | null;
17
16
  error: PollError | null;
18
- };
19
- //#endregion
20
- export { useStationLive };
17
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { createStationLiveStore } from "../../client/live.js";
3
3
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
4
- //#region src/react/hooks/useStationLive.ts
4
+ // src/react/hooks/useStationLive.ts
5
5
  function useStationLive(url, stationId, options = {}) {
6
6
  const { enabled = true, fetchInit, windowSeconds } = options;
7
7
  const fetchInitRef = useRef(fetchInit);
@@ -29,5 +29,4 @@ function useStationLive(url, stationId, options = {}) {
29
29
  error: snapshot.error
30
30
  };
31
31
  }
32
- //#endregion
33
32
  export { useStationLive };
@@ -1,5 +1,3 @@
1
- import { ReadoutPart } from "../scene/chart.js";
2
- import "../scene/index.js";
3
1
  import { AirMatrix } from "./components/AirMatrix.js";
4
2
  import { BandChip, Direction, Gust, Lull, Pressure, Speed, Temperature, UpdatedAt } from "./components/atoms.js";
5
3
  import { CurrentConditions } from "./components/CurrentConditions.js";
@@ -18,6 +16,8 @@ import { CompassFan } from "./components/CompassFan.js";
18
16
  import { RecentSummaries } from "./components/RecentSummaries.js";
19
17
  import { ClimatologyRose } from "./components/ClimatologyRose.js";
20
18
  import { DailyPattern } from "./components/DailyPattern.js";
19
+ import { ReadoutPart } from "../scene/chart.js";
20
+ import "../scene/index.js";
21
21
  import { Readout } from "./components/Readout.js";
22
22
  import { WindHistoryChart } from "./components/WindHistoryChart.js";
23
23
  import { WindRose } from "./components/WindRose.js";
@@ -1,27 +1,27 @@
1
1
  "use client";
2
2
  import { StationFeedProvider, useStationFeedContext } from "./components/StationFeedProvider.js";
3
3
  import { AirMatrix } from "./components/AirMatrix.js";
4
- import { WindArrow } from "./components/WindArrow.js";
5
4
  import { BandChip, Direction, Gust, Lull, Pressure, Speed, Temperature, UpdatedAt } from "./components/atoms.js";
6
5
  import { useFreshness } from "./hooks/useFreshness.js";
7
- import { Dial } from "./components/Dial.js";
8
- import { FreshnessBadge } from "./components/FreshnessBadge.js";
9
6
  import { CurrentConditions } from "./components/CurrentConditions.js";
7
+ import { Dial } from "./components/Dial.js";
10
8
  import { FavorableShare } from "./components/FavorableShare.js";
9
+ import { FreshnessBadge } from "./components/FreshnessBadge.js";
11
10
  import { Sparkline } from "./components/Sparkline.js";
12
11
  import { StationTable } from "./components/StationTable.js";
13
12
  import { StationStrip } from "./components/StationStrip.js";
14
13
  import { TrendChart } from "./components/TrendChart.js";
14
+ import { WindArrow } from "./components/WindArrow.js";
15
15
  import { AirExtremes } from "./components/AirExtremes.js";
16
- import { DailyPattern } from "./components/DailyPattern.js";
17
16
  import { ClimatologyDailyPattern } from "./components/ClimatologyDailyPattern.js";
18
17
  import { CompassFan } from "./components/CompassFan.js";
19
18
  import { RecentSummaries } from "./components/RecentSummaries.js";
20
- import { WindRose } from "./components/WindRose.js";
21
19
  import { ClimatologyRose } from "./components/ClimatologyRose.js";
20
+ import { DailyPattern } from "./components/DailyPattern.js";
22
21
  import { Readout } from "./components/Readout.js";
23
22
  import { useMeasuredChartWidth } from "./hooks/useMeasuredChartWidth.js";
24
23
  import { WindHistoryChart } from "./components/WindHistoryChart.js";
24
+ import { WindRose } from "./components/WindRose.js";
25
25
  import { WindSampleStrip } from "./components/WindSampleStrip.js";
26
26
  import { StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary } from "./components/StationCard.js";
27
27
  import { useStation } from "./hooks/useStation.js";
@@ -1,29 +1,8 @@
1
1
  "use client";
2
- import { directionCell } from "../../format.js";
3
- import { WindArrow } from "../components/WindArrow.js";
4
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- //#region src/react/lib/cells.tsx
6
- function DirectionCell({ windAvgMps, windDirectionDeg, words }) {
7
- const cell = directionCell(windAvgMps, windDirectionDeg);
8
- if (cell.kind === "calm") return /* @__PURE__ */ jsx(Fragment, { children: words.calm });
9
- if (cell.kind === "dash") return /* @__PURE__ */ jsx(Fragment, { children: "—" });
10
- return /* @__PURE__ */ jsxs(Fragment, { children: [
11
- /* @__PURE__ */ jsx(WindArrow, { deg: cell.deg }),
12
- " ",
13
- cell.compass,
14
- " ",
15
- cell.rounded,
16
- "°"
17
- ] });
18
- }
2
+ import { stationNameNode } from "../../scene/cells.js";
3
+ import { renderChild } from "../components/SceneTree.js";
4
+ // src/react/lib/cells.tsx
19
5
  function StationNameLink({ station }) {
20
- if (station.pageUrl == null) return /* @__PURE__ */ jsx(Fragment, { children: station.name });
21
- return /* @__PURE__ */ jsx("a", {
22
- href: station.pageUrl,
23
- rel: "noreferrer",
24
- target: "_blank",
25
- children: station.name
26
- });
6
+ return renderChild(stationNameNode(station), 0);
27
7
  }
28
- //#endregion
29
- export { DirectionCell, StationNameLink };
8
+ export { StationNameLink };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { activeChartIndex, chartIndexAtClient, togglePinnedAt } from "../../scene/chart.js";
3
3
  import { useState } from "react";
4
- //#region src/react/lib/use-pinned-cursor.ts
4
+ // src/react/lib/use-pinned-cursor.ts
5
5
  function usePinnedCursor(scene) {
6
6
  const [pinnedAt, setPinnedAt] = useState(null);
7
7
  const [previewIndex, setPreviewIndex] = useState(null);
@@ -28,5 +28,4 @@ function usePinnedCursor(scene) {
28
28
  }
29
29
  };
30
30
  }
31
- //#endregion
32
31
  export { usePinnedCursor };
package/dist/samples.d.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  import { LiveSample, LiveSamples } from "./contract.js";
2
2
  import { ChartFrame, ChartScaleOptions, ChartScales, Vane } from "./geometry.js";
3
- //#region src/samples.d.ts
4
- declare const SAMPLE_GAP_TOLERANCE_FACTOR = 2.5;
5
- declare function sampleRuns(samples: LiveSamples, toleranceFactor?: number): LiveSample[][];
6
- declare function sampleScales(samples: LiveSamples, frame: ChartFrame, options?: ChartScaleOptions): ChartScales;
7
- declare function samplePoints(run: ReadonlyArray<LiveSample>, scales: ChartScales): string;
8
- declare function sampleMeanDirectionDeg(samples: ReadonlyArray<LiveSample>): number | null;
9
- declare function thinSampleVanes(samples: ReadonlyArray<LiveSample>, target?: number): Vane[];
10
- type SamplesSummary = {
3
+ export declare const SAMPLE_GAP_TOLERANCE_FACTOR = 2.5;
4
+ export declare function sampleRuns(samples: LiveSamples, toleranceFactor?: number): LiveSample[][];
5
+ export declare function sampleScales(samples: LiveSamples, frame: ChartFrame, options?: ChartScaleOptions): ChartScales;
6
+ export declare function samplePoints(run: ReadonlyArray<LiveSample>, scales: ChartScales): string;
7
+ export declare function sampleMeanDirectionDeg(samples: ReadonlyArray<LiveSample>): number | null;
8
+ export declare function thinSampleVanes(samples: ReadonlyArray<LiveSample>, target?: number): Vane[];
9
+ export type SamplesSummary = {
11
10
  latest: LiveSample;
12
11
  peakMps: number;
13
12
  peakAt: string;
@@ -15,6 +14,4 @@ type SamplesSummary = {
15
14
  meanDirectionDeg: number | null;
16
15
  spanSeconds: number;
17
16
  };
18
- declare function samplesSummary(samples: LiveSamples): SamplesSummary | null;
19
- //#endregion
20
- export { SAMPLE_GAP_TOLERANCE_FACTOR, SamplesSummary, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes };
17
+ export declare function samplesSummary(samples: LiveSamples): SamplesSummary | null;
package/dist/samples.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { HISTORY_GAP_TOLERANCE_FACTOR, chartScalesOf, meanDirectionDegOf, thinVanesOf, tracePointsOf } from "./geometry.js";
2
- //#region src/samples.ts
2
+ // src/samples.ts
3
3
  const speedOf = (sample) => sample.windMps;
4
4
  const directionOf = (sample) => sample.windDirectionDeg;
5
5
  const SAMPLE_GAP_TOLERANCE_FACTOR = HISTORY_GAP_TOLERANCE_FACTOR;
@@ -48,5 +48,4 @@ function samplesSummary(samples) {
48
48
  spanSeconds: (Date.parse(latest.observedAt) - Date.parse(first.observedAt)) / 1e3
49
49
  };
50
50
  }
51
- //#endregion
52
51
  export { SAMPLE_GAP_TOLERANCE_FACTOR, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes };
@@ -1,42 +1,26 @@
1
1
  import { lastNightLowC, pressureDeltaHpa } from "../derive.js";
2
2
  import { temperatureValue } from "../format.js";
3
- //#region src/scene/air-extremes.ts
3
+ import { el, keyed } from "./node.js";
4
+ // src/scene/air-extremes.ts
4
5
  const AIR_EXTREMES_CLASS = "meteo-air-extremes";
5
6
  const PRESSURE_DELTA_WINDOW_HOURS = 3;
6
- /** hidden without served history — the tiles are functions of it; each tile
7
+ /** Null without served history — the tiles are functions of it; each tile
7
8
  * additionally stays absent when its own inputs are (no coordinates, no
8
9
  * 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
10
  function airExtremesScene(input) {
17
11
  const { nowMs, station, words } = input;
18
- const points = station.history?.points ?? [];
12
+ if (station == null || station.status !== "ok" || station.history == null) return null;
13
+ const points = station.history.points;
14
+ const tile = (key, label, value) => keyed(key, "div", { class: "meteo-air-extremes-tile" }, el("dt", { class: "meteo-microlabel" }, label), el("dd", { class: "meteo-air-extremes-value" }, value));
19
15
  const tiles = [];
20
16
  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
- });
17
+ if (night != null) tiles.push(tile("last-night-low", words.lastNightLowLabel, `${temperatureValue(night.lowC)} ${words.degC}`));
27
18
  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
- });
19
+ if (delta != null) tiles.push(tile("pressure-delta", words.pressureDeltaLabel(PRESSURE_DELTA_WINDOW_HOURS), `${delta >= 0 ? "+" : "−"}${Math.abs(delta).toFixed(1)} ${words.air.unitHpa}`));
34
20
  if (tiles.length === 0) return null;
35
- return {
36
- className: AIR_EXTREMES_CLASS,
37
- ariaLabel: words.aria.airExtremes(station.name),
38
- tiles
39
- };
21
+ return el("dl", {
22
+ "aria-label": words.aria.airExtremes(station.name),
23
+ class: AIR_EXTREMES_CLASS
24
+ }, tiles);
40
25
  }
41
- //#endregion
42
- export { AIR_EXTREMES_CLASS, airExtremesGate, airExtremesScene };
26
+ export { AIR_EXTREMES_CLASS, airExtremesScene };