@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
@@ -2,17 +2,14 @@ import { StationClimatology } from "../../contract-climatology.js";
2
2
  import { StationStringOverrides } from "../../strings.js";
3
3
  import { FavorableDirection } from "../../instruments.js";
4
4
  import "../../index.js";
5
- //#region src/react/components/ClimatologyRose.d.ts
6
5
  /** The whole archive as a stacked rose: the cube's sectors, each wedge split
7
6
  * by the document's own thresholds, with the honesty captions beneath. The
8
7
  * host owns the document (a fetch-once store) and the filters. */
9
- declare function ClimatologyRose({ document, months, slots, favorableDirections: favorableDirectionsProp, stationName, strings: stringsProp }: {
8
+ export declare function ClimatologyRose({ document, months, slots, favorableDirections: favorableDirectionsProp, stationName, strings: stringsProp }: {
10
9
  document: StationClimatology | null | undefined;
11
10
  months?: ReadonlyArray<number>;
12
11
  slots?: ReadonlyArray<number>;
13
12
  favorableDirections?: FavorableDirection[] | null;
14
13
  stationName?: string;
15
14
  strings?: StationStringOverrides;
16
- }): import("react").JSX.Element;
17
- //#endregion
18
- export { ClimatologyRose };
15
+ }): import("react").ReactNode;
@@ -1,45 +1,27 @@
1
1
  "use client";
2
2
  import { resolveDisplay } from "../../display.js";
3
- import { climatologyRoseGate, climatologyRoseScene } from "../../scene/climatology-rose.js";
3
+ import { climatologyRoseScene } from "../../scene/climatology-rose.js";
4
+ import { renderScene } from "./SceneTree.js";
4
5
  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
6
+ // src/react/components/ClimatologyRose.tsx
8
7
  /** The whole archive as a stacked rose: the cube's sectors, each wedge split
9
8
  * by the document's own thresholds, with the honesty captions beneath. The
10
9
  * host owns the document (a fetch-once store) and the filters. */
11
10
  function ClimatologyRose({ document, months, slots, favorableDirections: favorableDirectionsProp, stationName, strings: stringsProp }) {
12
- const { favorableDirections, words } = resolveDisplay(useStationFeedContext(), {
11
+ const context = useStationFeedContext();
12
+ const { favorableDirections, words } = resolveDisplay(context, {
13
13
  strings: stringsProp,
14
14
  favorableDirections: favorableDirectionsProp
15
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,
16
+ return renderScene(climatologyRoseScene({
17
+ document,
28
18
  favorableDirections,
29
- filters,
19
+ filters: {
20
+ months,
21
+ slots
22
+ },
30
23
  stationName,
31
24
  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
- });
25
+ }));
43
26
  }
44
- //#endregion
45
27
  export { ClimatologyRose };
@@ -2,16 +2,13 @@ import { LiveSamples, Station } from "../../contract.js";
2
2
  import { StationStringOverrides } from "../../strings.js";
3
3
  import { FavorableDirection } from "../../instruments.js";
4
4
  import "../../index.js";
5
- //#region src/react/components/CompassFan.d.ts
6
5
  /** The live compass: the newest sample as the solid needle, every sample of
7
6
  * the rolling window as a faint fan aged by tenth — a tight fan means
8
7
  * steady direction. */
9
- declare function CompassFan({ samples, station: stationProp, stationId, favorableDirections: favorableDirectionsProp, strings: stringsProp }: {
8
+ export declare function CompassFan({ samples, station: stationProp, stationId, favorableDirections: favorableDirectionsProp, strings: stringsProp }: {
10
9
  samples?: LiveSamples | null;
11
10
  station?: Station;
12
11
  stationId?: string;
13
12
  favorableDirections?: FavorableDirection[] | null;
14
13
  strings?: StationStringOverrides;
15
- }): import("react").JSX.Element | null;
16
- //#endregion
17
- export { CompassFan };
14
+ }): import("react").ReactNode;
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { resolveDisplay } from "../../display.js";
3
- import { compassFanGate, compassFanScene, compassFanSource } from "../../scene/compass-fan.js";
3
+ import { compassFanScene, compassFanSource } from "../../scene/compass-fan.js";
4
+ import { renderOptional } from "./SceneTree.js";
4
5
  import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- //#region src/react/components/CompassFan.tsx
6
+ // src/react/components/CompassFan.tsx
7
7
  /** The live compass: the newest sample as the solid needle, every sample of
8
8
  * the rolling window as a faint fan aged by tenth — a tight fan means
9
9
  * steady direction. */
@@ -14,80 +14,12 @@ function CompassFan({ samples, station: stationProp, stationId, favorableDirecti
14
14
  strings: stringsProp,
15
15
  favorableDirections: favorableDirectionsProp
16
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({
17
+ return renderOptional(compassFanScene({
25
18
  favorableDirections,
26
- samples: gate.samples,
19
+ samples: compassFanSource(samples, station),
20
+ station,
27
21
  stationName: station?.name,
28
22
  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
- });
23
+ }));
91
24
  }
92
- //#endregion
93
25
  export { CompassFan };
@@ -2,8 +2,7 @@ import { Station } from "../../contract.js";
2
2
  import { SpeedThresholds, SpeedUnit } from "../../derive.js";
3
3
  import { FormatTime, StationStringOverrides } from "../../strings.js";
4
4
  import "../../index.js";
5
- //#region src/react/components/CurrentConditions.d.ts
6
- declare function CurrentConditions({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, thresholds: thresholdsProp, unit: unitProp, strings: stringsProp, formatTime: formatTimeProp }: {
5
+ export declare function CurrentConditions({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, thresholds: thresholdsProp, unit: unitProp, strings: stringsProp, formatTime: formatTimeProp }: {
7
6
  station?: Station;
8
7
  stationId?: string;
9
8
  servedAt?: string | null;
@@ -12,6 +11,4 @@ declare function CurrentConditions({ station: stationProp, stationId, servedAt:
12
11
  unit?: SpeedUnit;
13
12
  strings?: StationStringOverrides;
14
13
  formatTime?: FormatTime;
15
- }): import("react").JSX.Element;
16
- //#endregion
17
- export { CurrentConditions };
14
+ }): import("react").ReactNode;
@@ -2,97 +2,33 @@
2
2
  import { stationFreshnessThresholds } from "../../derive.js";
3
3
  import { resolveDisplay } from "../../display.js";
4
4
  import { currentConditionsScene } from "../../scene/current.js";
5
+ import { renderScene } from "./SceneTree.js";
5
6
  import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
6
- import { WindArrow } from "./WindArrow.js";
7
7
  import { useFreshness } from "../hooks/useFreshness.js";
8
- import { Dial } from "./Dial.js";
9
- import { FreshnessBadge } from "./FreshnessBadge.js";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
- //#region src/react/components/CurrentConditions.tsx
8
+ import { useId } from "react";
9
+ // src/react/components/CurrentConditions.tsx
12
10
  function CurrentConditions({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, thresholds: thresholdsProp, unit: unitProp, strings: stringsProp, formatTime: formatTimeProp }) {
13
11
  const context = useStationFeedContext();
12
+ const bezelId = useId();
14
13
  const station = requireResolved("CurrentConditions", "station", stationProp ?? resolveStation(context, stationId));
15
14
  const servedAt = servedAtProp ?? context?.feed?.servedAt ?? null;
16
15
  const receivedAtMs = receivedAtMsProp !== void 0 ? receivedAtMsProp : context?.receivedAtMs ?? null;
17
- const { formatTime, strings, thresholds, unit, words } = resolveDisplay(context, {
16
+ const { formatTime, thresholds, unit, words } = resolveDisplay(context, {
18
17
  formatTime: formatTimeProp,
19
18
  strings: stringsProp,
20
19
  thresholds: thresholdsProp,
21
20
  unit: unitProp
22
21
  });
23
- const status = useFreshness((station.status === "ok" ? station.reading : null)?.observedAt ?? null, servedAt, receivedAtMs, stationFreshnessThresholds(station));
24
- const scene = currentConditionsScene({
22
+ const reading = station.status === "ok" ? station.reading : null;
23
+ const status = useFreshness(reading?.observedAt ?? null, servedAt, receivedAtMs, stationFreshnessThresholds(station));
24
+ return renderScene(currentConditionsScene({
25
+ bezelId: `meteo-bezel-${bezelId.replace(/[^a-zA-Z0-9_-]/g, "")}`,
25
26
  formatTime,
27
+ freshness: status,
26
28
  station,
29
+ thresholds,
27
30
  unit,
28
31
  words
29
- });
30
- const { direction, temperature, footer } = scene;
31
- return /* @__PURE__ */ jsxs("div", {
32
- "aria-label": scene.root.ariaLabel,
33
- className: scene.root.className,
34
- "data-status": scene.root.status,
35
- role: "group",
36
- children: [
37
- /* @__PURE__ */ jsxs("div", {
38
- className: scene.instrumentClassName,
39
- children: [
40
- scene.flanks && /* @__PURE__ */ jsxs("div", {
41
- className: scene.flanks.lull.className,
42
- children: [/* @__PURE__ */ jsx("small", {
43
- className: scene.flanks.lull.labelClassName,
44
- children: scene.flanks.lull.label
45
- }), /* @__PURE__ */ jsx("strong", { children: scene.flanks.lull.value })]
46
- }),
47
- /* @__PURE__ */ jsx(Dial, {
48
- calmWord: false,
49
- station,
50
- strings,
51
- thresholds: thresholds ?? null,
52
- unit
53
- }),
54
- scene.flanks && /* @__PURE__ */ jsxs("div", {
55
- className: scene.flanks.gust.className,
56
- children: [/* @__PURE__ */ jsx("small", {
57
- className: scene.flanks.gust.labelClassName,
58
- children: scene.flanks.gust.label
59
- }), /* @__PURE__ */ jsx("strong", { children: scene.flanks.gust.value })]
60
- })
61
- ]
62
- }),
63
- /* @__PURE__ */ jsx("p", {
64
- className: direction.className,
65
- children: direction.content.kind === "text" ? direction.content.text : /* @__PURE__ */ jsxs(Fragment, { children: [
66
- /* @__PURE__ */ jsx("span", {
67
- className: direction.content.labelClassName,
68
- children: direction.content.label
69
- }),
70
- " ",
71
- /* @__PURE__ */ jsx(WindArrow, { deg: direction.content.deg }),
72
- " ",
73
- /* @__PURE__ */ jsx("strong", { children: direction.content.compass }),
74
- direction.content.tail
75
- ] })
76
- }),
77
- temperature && /* @__PURE__ */ jsxs("p", {
78
- className: temperature.className,
79
- children: [temperature.text, temperature.chill && /* @__PURE__ */ jsx("span", {
80
- className: temperature.chill.className,
81
- children: temperature.chill.text
82
- })]
83
- }),
84
- /* @__PURE__ */ jsxs("p", {
85
- className: footer.className,
86
- children: [status != null && /* @__PURE__ */ jsx(FreshnessBadge, {
87
- status,
88
- strings
89
- }), /* @__PURE__ */ jsx("span", {
90
- className: footer.observed.className,
91
- children: footer.observed.text
92
- })]
93
- })
94
- ]
95
- });
32
+ }));
96
33
  }
97
- //#endregion
98
34
  export { CurrentConditions };
@@ -1,12 +1,9 @@
1
1
  import { HistoryPoint, Station } from "../../contract.js";
2
- import { SpeedThresholds, SpeedUnit, compassDirection } from "../../derive.js";
2
+ import { SpeedThresholds, SpeedUnit } from "../../derive.js";
3
3
  import { StationStringOverrides } from "../../strings.js";
4
4
  import { FavorableDirection } from "../../instruments.js";
5
5
  import "../../index.js";
6
- import "../../scene/index.js";
7
- import { WindArrow } from "./WindArrow.js";
8
- //#region src/react/components/DailyPattern.d.ts
9
- declare function DailyPattern({ station: stationProp, stationId, points, slotMinutes, utcOffsetMinutes, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, strings: stringsProp }: {
6
+ export declare function DailyPattern({ station: stationProp, stationId, points, slotMinutes, utcOffsetMinutes, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, strings: stringsProp }: {
10
7
  station?: Station;
11
8
  stationId?: string;
12
9
  points?: HistoryPoint[];
@@ -17,6 +14,4 @@ declare function DailyPattern({ station: stationProp, stationId, points, slotMin
17
14
  unit?: SpeedUnit;
18
15
  plotHeight?: number;
19
16
  strings?: StationStringOverrides;
20
- }): import("react").JSX.Element;
21
- //#endregion
22
- export { DailyPattern };
17
+ }): import("react").JSX.Element;
@@ -1,13 +1,12 @@
1
1
  "use client";
2
- import "../../derive.js";
3
2
  import { resolveDisplay } from "../../display.js";
4
3
  import { measuredChartWidth } from "../../geometry.js";
5
4
  import { DAILY_PATTERN_CLASS, dailyPatternGate, dailyPatternScene, dailyPatternSource } from "../../scene/daily-pattern.js";
5
+ import { renderChildren } from "./SceneTree.js";
6
6
  import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
7
- import "./WindArrow.js";
8
7
  import { useEffect, useId, useRef, useState } from "react";
9
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
- //#region src/react/components/DailyPattern.tsx
8
+ import { jsx } from "react/jsx-runtime";
9
+ // src/react/components/DailyPattern.tsx
11
10
  function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 180, utcOffsetMinutes = 0, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, strings: stringsProp }) {
12
11
  const context = useStationFeedContext();
13
12
  const station = stationProp ?? (points == null ? resolveStation(context, stationId) ?? void 0 : void 0);
@@ -21,6 +20,7 @@ function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 1
21
20
  const [width, setWidth] = useState(null);
22
21
  const { source, periodMinutes } = dailyPatternSource(points, station);
23
22
  const gate = dailyPatternGate(source, words);
23
+ const drawable = gate.kind === "draw";
24
24
  useEffect(() => {
25
25
  const element = wrapRef.current;
26
26
  if (!element) return;
@@ -33,7 +33,7 @@ function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 1
33
33
  });
34
34
  observer.observe(element);
35
35
  return () => observer.disconnect();
36
- }, [gate.kind === "draw"]);
36
+ }, [drawable]);
37
37
  if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
38
38
  className: gate.className,
39
39
  role: "note",
@@ -58,9 +58,10 @@ function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 1
58
58
  });
59
59
  }
60
60
  function MeasuredDailyPattern({ favorableDirections, periodMinutes, plotHeight, points, slotMinutes, stationName, thresholds, unit, utcOffsetMinutes, width, words }) {
61
- return /* @__PURE__ */ jsx(DailyPatternSceneView, { scene: dailyPatternScene({
61
+ const hatchId = `meteo-daily-pattern-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
62
+ const scene = dailyPatternScene({
62
63
  favorableDirections,
63
- hatchId: `meteo-daily-pattern-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`,
64
+ hatchId,
64
65
  periodMinutes,
65
66
  plotHeight,
66
67
  points,
@@ -71,148 +72,7 @@ function MeasuredDailyPattern({ favorableDirections, periodMinutes, plotHeight,
71
72
  utcOffsetMinutes,
72
73
  width,
73
74
  words
74
- }) });
75
- }
76
- /** One scene, one drawing — shared by the history-fed pattern above and the
77
- * climatology-fed twin. */
78
- function DailyPatternSceneView({ scene }) {
79
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("output", {
80
- className: scene.caption.className,
81
- children: scene.caption.text
82
- }), /* @__PURE__ */ jsxs("svg", {
83
- "aria-label": scene.svg.ariaLabel,
84
- className: scene.svg.className,
85
- height: scene.svg.height,
86
- role: "img",
87
- viewBox: scene.svg.viewBox,
88
- width: scene.svg.width,
89
- children: [
90
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", {
91
- height: scene.defs.pattern.height,
92
- id: scene.defs.pattern.id,
93
- patternTransform: scene.defs.pattern.transform,
94
- patternUnits: scene.defs.pattern.units,
95
- width: scene.defs.pattern.width,
96
- children: /* @__PURE__ */ jsx("line", {
97
- className: scene.defs.pattern.line.className,
98
- x1: scene.defs.pattern.line.x1,
99
- x2: scene.defs.pattern.line.x2,
100
- y1: scene.defs.pattern.line.y1,
101
- y2: scene.defs.pattern.line.y2
102
- })
103
- }) }),
104
- scene.zones.map((zone) => /* @__PURE__ */ jsx("rect", {
105
- className: zone.className,
106
- height: zone.height,
107
- width: zone.width,
108
- x: zone.x,
109
- y: zone.y
110
- }, zone.key)),
111
- scene.grid.map(({ key, line, label }) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
112
- className: line.className,
113
- x1: line.x1,
114
- x2: line.x2,
115
- y1: line.y1,
116
- y2: line.y2
117
- }), /* @__PURE__ */ jsx("text", {
118
- className: label.className,
119
- textAnchor: label.anchor,
120
- x: label.x,
121
- y: label.y,
122
- children: label.text
123
- })] }, key)),
124
- scene.thresholdGuides.map(({ key, line, label }) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
125
- className: line.className,
126
- x1: line.x1,
127
- x2: line.x2,
128
- y1: line.y1,
129
- y2: line.y2
130
- }), /* @__PURE__ */ jsx("text", {
131
- className: label.className,
132
- textAnchor: label.anchor,
133
- x: label.x,
134
- y: label.y,
135
- children: label.text
136
- })] }, key)),
137
- scene.vaneGuides.map((guide) => /* @__PURE__ */ jsx("line", {
138
- className: guide.className,
139
- x1: guide.x1,
140
- x2: guide.x2,
141
- y1: guide.y1,
142
- y2: guide.y2
143
- }, `guide-${guide.key}`)),
144
- scene.gaps.map((gap) => /* @__PURE__ */ jsx("rect", {
145
- className: gap.className,
146
- fill: gap.fill,
147
- height: gap.height,
148
- width: gap.width,
149
- x: gap.x,
150
- y: gap.y
151
- }, gap.key)),
152
- scene.mean.kind === "polyline" ? /* @__PURE__ */ jsx("polyline", {
153
- className: scene.mean.className,
154
- points: scene.mean.points
155
- }) : scene.mean.segments.map((segment) => /* @__PURE__ */ jsx("line", {
156
- className: segment.className,
157
- x1: segment.x1,
158
- x2: segment.x2,
159
- y1: segment.y1,
160
- y2: segment.y2
161
- }, segment.key)),
162
- scene.calmNote && /* @__PURE__ */ jsx("text", {
163
- className: scene.calmNote.className,
164
- textAnchor: scene.calmNote.anchor,
165
- x: scene.calmNote.x,
166
- y: scene.calmNote.y,
167
- children: scene.calmNote.text
168
- }),
169
- /* @__PURE__ */ jsx("text", {
170
- className: scene.rowLabels.to.className,
171
- textAnchor: scene.rowLabels.to.anchor,
172
- x: scene.rowLabels.to.x,
173
- y: scene.rowLabels.to.y,
174
- children: scene.rowLabels.to.text
175
- }),
176
- scene.vanes.map((vane) => vane.mark.kind === "calm" ? /* @__PURE__ */ jsx("text", {
177
- className: vane.mark.text.className,
178
- textAnchor: vane.mark.text.anchor,
179
- x: vane.mark.text.x,
180
- y: vane.mark.text.y,
181
- children: vane.mark.text.text
182
- }, vane.key) : /* @__PURE__ */ jsx("path", {
183
- className: vane.mark.className,
184
- d: vane.mark.d
185
- }, vane.key)),
186
- scene.vanes.map((vane) => vane.label && /* @__PURE__ */ jsx("text", {
187
- className: vane.label.className,
188
- textAnchor: vane.label.anchor,
189
- x: vane.label.x,
190
- y: vane.label.y,
191
- children: vane.label.text
192
- }, `label-${vane.key}`)),
193
- /* @__PURE__ */ jsx("text", {
194
- className: scene.rowLabels.avg.className,
195
- textAnchor: scene.rowLabels.avg.anchor,
196
- x: scene.rowLabels.avg.x,
197
- y: scene.rowLabels.avg.y,
198
- children: scene.rowLabels.avg.text
199
- }),
200
- scene.vanes.map((vane) => vane.value && /* @__PURE__ */ jsx("text", {
201
- className: vane.value.className,
202
- textAnchor: vane.value.anchor,
203
- x: vane.value.x,
204
- y: vane.value.y,
205
- children: vane.value.text
206
- }, `value-${vane.key}`)),
207
- scene.ticks.map((tick) => /* @__PURE__ */ jsx("text", {
208
- className: tick.className,
209
- textAnchor: tick.anchor,
210
- x: tick.x,
211
- y: tick.y,
212
- children: tick.text
213
- }, tick.key))
214
- ]
215
- })] });
75
+ });
76
+ return renderChildren(scene);
216
77
  }
217
- //#endregion
218
- export { DailyPattern, DailyPatternSceneView };
78
+ export { DailyPattern };
@@ -3,8 +3,7 @@ import { SpeedThresholds, SpeedUnit } from "../../derive.js";
3
3
  import { StationStringOverrides } from "../../strings.js";
4
4
  import { FavorableDirection } from "../../instruments.js";
5
5
  import "../../index.js";
6
- //#region src/react/components/Dial.d.ts
7
- declare function Dial({ station: stationProp, stationId, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, size, calmWord, strings: stringsProp }: {
6
+ export declare function Dial({ station: stationProp, stationId, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, size, calmWord, strings: stringsProp }: {
8
7
  station?: Station;
9
8
  stationId?: string;
10
9
  thresholds?: SpeedThresholds | null;
@@ -13,6 +12,4 @@ declare function Dial({ station: stationProp, stationId, thresholds: thresholdsP
13
12
  size?: number;
14
13
  calmWord?: boolean;
15
14
  strings?: StationStringOverrides;
16
- }): import("react").JSX.Element;
17
- //#endregion
18
- export { Dial };
15
+ }): import("react").ReactNode;