@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,71 +1,57 @@
1
1
  import { airRows, airSummary, lastStrikeWords } from "../air.js";
2
- //#region src/scene/air-matrix.ts
2
+ import { el, keyed } from "./node.js";
3
+ // src/scene/air-matrix.ts
4
+ /** The disclosure's own words, plus the panel it opens. The shell stays
5
+ * with each binding: the trigger owns expansion state and its handler. */
3
6
  function airMatrixScene(input) {
4
7
  const { formatTime, stations, words } = input;
5
8
  const capable = stations.filter((station) => station.capabilities.conditions);
6
9
  if (capable.length === 0) return null;
7
10
  const firstConditions = capable.map((station) => station.reading?.conditions ?? null).find((conditions) => conditions != null) ?? null;
8
- const cellsOf = (value) => capable.map((station) => ({
9
- key: station.id,
10
- className: "meteo-air-cell",
11
- text: value(station) ?? "—"
12
- }));
13
- const feelsLikeRows = capable.some((station) => station.reading?.windChillC != null) ? [{
14
- key: words.air.feelsLike,
15
- className: "meteo-air-row",
16
- labelClassName: "meteo-air-label",
17
- label: words.air.feelsLike,
18
- unit: words.degC,
19
- cells: cellsOf((station) => station.reading?.windChillC?.toFixed(1) ?? null)
20
- }] : [];
21
- const conditionRows = airRows(words).filter((row) => capable.some((station) => {
11
+ const rowTemplate = { gridTemplateColumns: `minmax(7.5rem, 1.4fr) repeat(${capable.length}, minmax(4.5rem, 1fr))` };
12
+ const cellsOf = (value) => capable.map((station) => keyed(station.id, "span", {
13
+ class: "meteo-air-cell",
14
+ role: "cell"
15
+ }, value(station) ?? "—"));
16
+ const row = (label, unit, cells) => ({
17
+ ...keyed(label, "div", {
18
+ class: "meteo-air-row",
19
+ role: "row"
20
+ }, el("span", {
21
+ class: "meteo-air-label",
22
+ role: "rowheader"
23
+ }, label, el("small", void 0, unit)), cells),
24
+ style: rowTemplate
25
+ });
26
+ const feelsLikeRows = capable.some((station) => station.reading?.windChillC != null) ? [row(words.air.feelsLike, words.degC, cellsOf((station) => station.reading?.windChillC?.toFixed(1) ?? null))] : [];
27
+ const conditionRows = airRows(words).filter((entry) => capable.some((station) => {
22
28
  const conditions = station.reading?.conditions;
23
- return conditions != null && row.value(conditions) != null;
24
- })).map((row) => ({
25
- key: row.label,
26
- className: "meteo-air-row",
27
- labelClassName: "meteo-air-label",
28
- label: row.label,
29
- unit: row.unit,
30
- cells: cellsOf((station) => {
31
- const conditions = station.reading?.conditions;
32
- return conditions == null ? null : row.value(conditions);
33
- })
34
- }));
29
+ return conditions != null && entry.value(conditions) != null;
30
+ })).map((entry) => row(entry.label, entry.unit, cellsOf((station) => {
31
+ const conditions = station.reading?.conditions;
32
+ return conditions == null ? null : entry.value(conditions);
33
+ })));
34
+ const panel = [el("div", {
35
+ "aria-label": words.aria.air(capable.length),
36
+ class: "meteo-air-matrix",
37
+ role: "table"
38
+ }, {
39
+ ...el("div", {
40
+ class: "meteo-air-row meteo-air-head",
41
+ role: "row"
42
+ }, el("span", {
43
+ class: "meteo-air-corner",
44
+ role: "columnheader"
45
+ }), capable.map((station) => keyed(station.id, "span", {
46
+ class: "meteo-microlabel",
47
+ role: "columnheader"
48
+ }, station.name))),
49
+ style: rowTemplate
50
+ }, [...feelsLikeRows, ...conditionRows]), el("p", { class: "meteo-air-note" }, firstConditions == null ? words.air.noStrike : lastStrikeWords(firstConditions, formatTime, words))];
35
51
  return {
36
- className: "meteo-air",
37
- trigger: {
38
- className: "meteo-air-trigger",
39
- title: {
40
- className: "meteo-air-title",
41
- text: words.air.title
42
- },
43
- summary: {
44
- className: "meteo-air-summary",
45
- text: firstConditions == null ? words.air.summaryFallback : airSummary(firstConditions, words)
46
- }
47
- },
48
- panelClassName: "meteo-air-panel",
49
- matrix: {
50
- ariaLabel: words.aria.air(capable.length),
51
- className: "meteo-air-matrix",
52
- gridTemplateColumns: `minmax(7.5rem, 1.4fr) repeat(${capable.length}, minmax(4.5rem, 1fr))`,
53
- head: {
54
- className: "meteo-air-row meteo-air-head",
55
- corner: { className: "meteo-air-corner" },
56
- columnClassName: "meteo-microlabel",
57
- columns: capable.map((station) => ({
58
- key: station.id,
59
- text: station.name
60
- }))
61
- },
62
- rows: [...feelsLikeRows, ...conditionRows]
63
- },
64
- note: {
65
- className: "meteo-air-note",
66
- text: firstConditions == null ? words.air.noStrike : lastStrikeWords(firstConditions, formatTime, words)
67
- }
52
+ title: words.air.title,
53
+ summary: firstConditions == null ? words.air.summaryFallback : airSummary(firstConditions, words),
54
+ panel
68
55
  };
69
56
  }
70
- //#endregion
71
57
  export { airMatrixScene };
@@ -2,7 +2,7 @@ import { compassDirection, isCalm, thresholdsToMps } from "../derive.js";
2
2
  import { speedBand } from "../geometry.js";
3
3
  import { readingAgeMs, roundSpeed, speedMpsOf, temperatureValue, updatedAtText } from "../format.js";
4
4
  import { inDirectionArcs } from "@azohra/meteo.core";
5
- //#region src/scene/atoms.ts
5
+ // src/scene/atoms.ts
6
6
  const valueContent = (value, shown, unitWord) => value == null ? {
7
7
  kind: "dash",
8
8
  text: "—"
@@ -100,5 +100,4 @@ function bandChipScene(input) {
100
100
  text: labels?.[band] ?? `${roundSpeed(reading.windAvgMps, unit)} ${words.speedUnits[unit]}`
101
101
  };
102
102
  }
103
- //#endregion
104
103
  export { bandChipScene, directionAtomScene, pressureAtomScene, speedAtomScene, temperatureAtomScene, updatedAtScene };
@@ -1,5 +1,7 @@
1
1
  import { summaryEntries } from "../format.js";
2
- //#region src/scene/card.ts
2
+ import { el, keyed } from "./node.js";
3
+ import { freshnessBadgeNode } from "./glyphs.js";
4
+ // src/scene/card.ts
3
5
  const STATION_CARD_CLASS = "meteo-station-card";
4
6
  function cardPartThresholds(own, card) {
5
7
  return (own === void 0 ? card : own ?? void 0) ?? null;
@@ -7,48 +9,19 @@ function cardPartThresholds(own, card) {
7
9
  function cardPartWiringError(part, provider) {
8
10
  return `${part} must render inside ${provider} — the provider carries the station, clocks, and display settings.`;
9
11
  }
10
- function cardHeaderScene(station, words) {
11
- return {
12
- className: "meteo-station-card-header",
13
- identity: {
14
- className: "meteo-station-card-identity",
15
- name: {
16
- className: "meteo-station-card-name",
17
- link: station.pageUrl == null ? null : {
18
- href: station.pageUrl,
19
- rel: "noreferrer",
20
- target: "_blank",
21
- text: `${station.name} ↗`
22
- },
23
- text: station.name
24
- },
25
- meta: {
26
- className: "meteo-station-card-meta",
27
- source: {
28
- className: "meteo-station-card-source",
29
- text: station.sourceLabel
30
- },
31
- elevation: station.elevationM == null ? null : {
32
- className: "meteo-station-card-elevation",
33
- text: ` · ${words.elevation(Math.round(station.elevationM))}`
34
- }
35
- }
36
- }
37
- };
12
+ function cardHeaderNode(station, freshness, words) {
13
+ return el("header", { class: "meteo-station-card-header" }, el("div", { class: "meteo-station-card-identity" }, el("h3", { class: "meteo-station-card-name" }, station.pageUrl == null ? station.name : el("a", {
14
+ href: station.pageUrl,
15
+ rel: "noreferrer",
16
+ target: "_blank"
17
+ }, `${station.name} \u2197`)), el("p", { class: "meteo-station-card-meta" }, el("span", { class: "meteo-station-card-source" }, station.sourceLabel), station.elevationM == null ? null : el("span", { class: "meteo-station-card-elevation" }, ` \u00b7 ${words.elevation(Math.round(station.elevationM))}`))), freshness != null ? freshnessBadgeNode(freshness, words) : null);
38
18
  }
39
- function summaryScene(station, unit, words, formatTime) {
19
+ function summaryNode(station, unit, words, formatTime) {
40
20
  const summary = summaryEntries(station, unit, words, formatTime);
41
21
  if (summary == null) return null;
42
- return {
43
- ariaLabel: words.aria.summary(formatTime(new Date(summary.periodEndedAt))),
44
- className: "meteo-summary",
45
- itemClassName: "meteo-summary-item",
46
- labelClassName: "meteo-microlabel",
47
- items: summary.entries.map((entry) => ({
48
- label: entry.label,
49
- value: entry.value
50
- }))
51
- };
22
+ return el("dl", {
23
+ "aria-label": words.aria.summary(formatTime(new Date(summary.periodEndedAt))),
24
+ class: "meteo-summary"
25
+ }, summary.entries.map((entry) => keyed(entry.label, "div", { class: "meteo-summary-item" }, el("dt", { class: "meteo-microlabel" }, entry.label), el("dd", void 0, entry.value))));
52
26
  }
53
- //#endregion
54
- export { STATION_CARD_CLASS, cardHeaderScene, cardPartThresholds, cardPartWiringError, summaryScene };
27
+ export { STATION_CARD_CLASS, cardHeaderNode, cardPartThresholds, cardPartWiringError, summaryNode };
@@ -0,0 +1,4 @@
1
+ import "../contract.js";
2
+ import "../strings.js";
3
+ import "../instruments.js";
4
+ import "./atoms.js";
@@ -0,0 +1,50 @@
1
+ import { directionCell } from "../format.js";
2
+ import { el } from "./node.js";
3
+ import { bandChipScene, directionAtomScene, updatedAtScene } from "./atoms.js";
4
+ import { windArrowNode } from "./glyphs.js";
5
+ // src/scene/cells.ts
6
+ /** The direction reading: an arrow plus its compass point, or the word for
7
+ * calm, or a dash — one spelling for both display bindings. */
8
+ function directionCellNodes(windAvgMps, windDirectionDeg, words) {
9
+ const cell = directionCell(windAvgMps, windDirectionDeg);
10
+ if (cell.kind === "calm") return [words.calm];
11
+ if (cell.kind === "dash") return ["—"];
12
+ return [windArrowNode(cell.deg), ` ${cell.compass} ${cell.rounded}°`];
13
+ }
14
+ function stationNameNode(station) {
15
+ if (station.pageUrl == null) return station.name;
16
+ return el("a", {
17
+ href: station.pageUrl,
18
+ rel: "noreferrer",
19
+ target: "_blank"
20
+ }, station.name);
21
+ }
22
+ function valueAtomNode(scene) {
23
+ return el("data", {
24
+ class: scene.className,
25
+ value: scene.value
26
+ }, scene.content.kind === "dash" ? scene.content.text : [scene.content.text, el("span", { class: scene.content.unit.className }, scene.content.unit.text)]);
27
+ }
28
+ function directionAtomNode(station, words, favorableDirections) {
29
+ const scene = directionAtomScene(station, words, favorableDirections);
30
+ if (scene.cell == null) return el("span", { class: scene.className }, scene.dashText);
31
+ return el("span", {
32
+ "aria-label": scene.ariaLabel,
33
+ class: scene.className
34
+ }, directionCellNodes(scene.cell.windAvgMps, scene.cell.windDirectionDeg, words));
35
+ }
36
+ function updatedAtNode(input) {
37
+ const scene = updatedAtScene(input);
38
+ return scene.kind === "dash" ? el("span", { class: scene.className }, scene.text) : el("time", {
39
+ class: scene.className,
40
+ datetime: scene.dateTime
41
+ }, scene.text);
42
+ }
43
+ function bandChipNode(input) {
44
+ const scene = bandChipScene(input);
45
+ return el("span", {
46
+ class: scene.className,
47
+ "data-band": scene.band
48
+ }, scene.text);
49
+ }
50
+ export { bandChipNode, directionAtomNode, directionCellNodes, stationNameNode, updatedAtNode, valueAtomNode };
@@ -1,11 +1,8 @@
1
1
  import { TickAnchor, measuredChartWidth, tickAnchor } from "../geometry.js";
2
- //#region src/scene/chart.d.ts
3
- type ReadoutPart = {
2
+ export type ReadoutPart = {
4
3
  kind: "text";
5
4
  text: string;
6
5
  } | {
7
6
  kind: "arrow";
8
7
  deg: number;
9
- };
10
- //#endregion
11
- export { ReadoutPart };
8
+ };
@@ -1,5 +1,5 @@
1
1
  import { measuredChartWidth, nearestIndex, tickAnchor } from "../geometry.js";
2
- //#region src/scene/chart.ts
2
+ // src/scene/chart.ts
3
3
  function pinnedIndexOf(points, pinnedAt) {
4
4
  if (pinnedAt == null) return null;
5
5
  const found = points.findIndex((point) => point.observedAt === pinnedAt);
@@ -10,7 +10,8 @@ function activeChartIndex(points, pinnedAt, previewIndex) {
10
10
  }
11
11
  function chartIndexAtClient(points, frame, scales, clientX, bounds) {
12
12
  if (bounds.width === 0) return null;
13
- return nearestIndex(points, (clientX - bounds.left) / bounds.width * frame.width, frame, scales);
13
+ const chartX = (clientX - bounds.left) / bounds.width * frame.width;
14
+ return nearestIndex(points, chartX, frame, scales);
14
15
  }
15
16
  function togglePinnedAt(current, observedAt) {
16
17
  return current === observedAt ? null : observedAt;
@@ -18,5 +19,4 @@ function togglePinnedAt(current, observedAt) {
18
19
  function readoutAriaLive(previewIndex) {
19
20
  return previewIndex == null ? "polite" : "off";
20
21
  }
21
- //#endregion
22
22
  export { activeChartIndex, chartIndexAtClient, measuredChartWidth, pinnedIndexOf, readoutAriaLive, tickAnchor, togglePinnedAt };
@@ -2,5 +2,4 @@ import "../contract-climatology.js";
2
2
  import "../derive.js";
3
3
  import "../strings.js";
4
4
  import "../instruments.js";
5
- import "../climatology.js";
6
- import "./daily-pattern.js";
5
+ import "../climatology.js";
@@ -1,23 +1,22 @@
1
1
  import { climatologyCoverage, climatologyPattern } from "../climatology.js";
2
+ import { el } from "./node.js";
2
3
  import { dailyPatternSlotsScene } from "./daily-pattern.js";
3
- //#region src/scene/climatology-pattern.ts
4
+ // src/scene/climatology-pattern.ts
4
5
  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
- };
6
+ /** Whether the cube has anything to draw — the bindings consult it to
7
+ * decide whether to keep a width observer alive. */
8
+ function hasClimatology(document) {
9
+ return document != null && document.cells.length > 0;
15
10
  }
16
11
  /** The cube's typical day through the daily-pattern drawing. The coverage
17
12
  * percentage rides only the unfiltered view — the ledger cannot vouch for a
18
13
  * filtered slice, which captions a plain sample count instead. */
19
14
  function climatologyPatternScene(input) {
20
15
  const { document, filters, ...rest } = input;
16
+ if (document == null || document.cells.length === 0) return [el("div", {
17
+ class: "meteo-climatology-daily-pattern meteo-climatology-daily-pattern-na",
18
+ role: "note"
19
+ }, rest.words.noClimatology)];
21
20
  const slots = climatologyPattern(document, filters);
22
21
  const totalSamples = slots.reduce((sum, slot) => sum + slot.sampleCount, 0);
23
22
  const coverage = filters?.months == null ? climatologyCoverage(document) : null;
@@ -31,5 +30,4 @@ function climatologyPatternScene(input) {
31
30
  }
32
31
  });
33
32
  }
34
- //#endregion
35
- export { CLIMATOLOGY_PATTERN_CLASS, climatologyPatternGate, climatologyPatternScene };
33
+ export { CLIMATOLOGY_PATTERN_CLASS, climatologyPatternScene, hasClimatology };
@@ -1,5 +1,4 @@
1
1
  import "../contract-climatology.js";
2
2
  import "../strings.js";
3
3
  import "../instruments.js";
4
- import "../climatology.js";
5
- import "./rose.js";
4
+ import "../climatology.js";
@@ -1,22 +1,22 @@
1
1
  import { climatologyCoverage, climatologyFavorableShare, climatologyRose } from "../climatology.js";
2
+ import { el, keyed } from "./node.js";
2
3
  import { windRoseScene } from "./rose.js";
3
- //#region src/scene/climatology-rose.ts
4
+ // src/scene/climatology-rose.ts
4
5
  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
6
  function climatologyRoseScene(input) {
17
7
  const { document, favorableDirections, filters, stationName, words } = input;
8
+ if (document == null || document.cells.length === 0) return el("div", {
9
+ class: "meteo-climatology-rose meteo-climatology-rose-na",
10
+ role: "note"
11
+ }, words.noClimatology);
18
12
  const summary = climatologyRose(document, filters);
19
- const rose = windRoseScene({
13
+ const captions = [];
14
+ const arcs = favorableDirections ?? [];
15
+ const share = arcs.length === 0 ? null : climatologyFavorableShare(document, arcs, filters);
16
+ if (share != null) captions.push(keyed("favorable", "p", { class: "meteo-climatology-caption meteo-climatology-caption-favorable" }, words.percentFavorable(Math.round(share * 100))));
17
+ const coverage = filters?.months == null && filters?.slots == null ? climatologyCoverage(document) : null;
18
+ captions.push(keyed("samples", "p", { class: "meteo-climatology-caption" }, coverage != null && coverage.ratio != null ? words.dailyPatternCoverage(summary.sampleCount, Math.round(coverage.ratio * 100)) : words.dailyPatternSamples(summary.sampleCount)));
19
+ return el("div", { class: CLIMATOLOGY_ROSE_CLASS }, windRoseScene({
20
20
  favorableDirections,
21
21
  sectorCount: document.sectorCount,
22
22
  source: [],
@@ -24,26 +24,6 @@ function climatologyRoseScene(input) {
24
24
  summary,
25
25
  thresholds: void 0,
26
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.ratio != null ? words.dailyPatternCoverage(summary.sampleCount, Math.round(coverage.ratio * 100)) : words.dailyPatternSamples(summary.sampleCount)
41
- });
42
- return {
43
- className: CLIMATOLOGY_ROSE_CLASS,
44
- rose,
45
- captions
46
- };
27
+ }, captions));
47
28
  }
48
- //#endregion
49
- export { CLIMATOLOGY_ROSE_CLASS, climatologyRoseGate, climatologyRoseScene };
29
+ export { CLIMATOLOGY_ROSE_CLASS, climatologyRoseScene };
@@ -1,115 +1,42 @@
1
1
  import { isCalm } from "../derive.js";
2
2
  import { vanePath } from "../geometry.js";
3
- import { DIAL_CARDINALS, DIAL_COUNTERWEIGHT_RADIUS, dialNeedlePoints, dialPolar, dialRingArcPath } from "../instruments.js";
4
- //#region src/scene/compass-fan.ts
5
- const COMPASS_FAN_CLASS = "meteo-compass-fan";
3
+ import { dialPolar } from "../instruments.js";
4
+ import { el, keyed } from "./node.js";
5
+ import { dialHub, dialLetters, dialNeedle, dialRing, dialTicks, dialVerdictRing } from "./dial-parts.js";
6
+ // src/scene/compass-fan.ts
6
7
  const FAN_RADIUS = 58;
7
8
  const FAN_GHOST_STEPS = 10;
8
9
  function compassFanSource(samples, station) {
9
10
  return samples ?? (station?.status === "ok" ? station.samples ?? null : null);
10
11
  }
11
- /** hidden without the declared live capability (when judging a station);
12
- * the no-samples words when the ring is empty. */
13
- function compassFanGate(source, station, words) {
14
- if (station != null && station.capabilities.live !== true) return { kind: "hidden" };
15
- if (source == null || source.points.length === 0) return {
16
- kind: "note",
17
- className: `${COMPASS_FAN_CLASS} meteo-compass-fan-na`,
18
- text: words.noSamples
19
- };
20
- return {
21
- kind: "draw",
22
- samples: source
23
- };
24
- }
12
+ /** Null without the declared live capability (when judging a station); the
13
+ * no-samples words when the ring is empty. */
25
14
  function compassFanScene(input) {
26
- const { favorableDirections, samples, stationName, words } = input;
15
+ const { favorableDirections, samples, station, stationName, words } = input;
16
+ if (station != null && station.capabilities.live !== true) return null;
17
+ if (samples == null || samples.points.length === 0) return el("div", {
18
+ class: "meteo-compass-fan meteo-compass-fan-na",
19
+ role: "note"
20
+ }, words.noSamples);
27
21
  const points = samples.points;
28
22
  const count = points.length;
29
23
  const newest = points[count - 1];
30
24
  const newestBlowing = newest != null && !isCalm(newest.windMps) && newest.windDirectionDeg != null;
31
- return {
32
- svg: {
33
- ariaLabel: words.aria.compassFan(stationName ?? ""),
34
- className: "meteo-compass-fan-svg",
35
- height: 160,
36
- viewBox: `0 0 160 160`,
37
- width: 160
38
- },
39
- ring: {
40
- className: "meteo-wind-dial-ring",
41
- cx: 80,
42
- cy: 80,
43
- r: 70
44
- },
45
- verdictRing: favorableDirections != null && favorableDirections.length > 0 ? {
46
- unfavorable: {
47
- className: "meteo-wind-dial-ring-unfavorable",
48
- cx: 80,
49
- cy: 80,
50
- r: 70
51
- },
52
- favorable: favorableDirections.map((sector) => ({
53
- key: `${sector.fromDeg}-${sector.toDeg}`,
54
- className: "meteo-wind-dial-ring-favorable",
55
- d: dialRingArcPath(sector)
56
- }))
57
- } : null,
58
- ticks: Array.from({ length: 16 }, (_, index) => {
59
- const bearing = index * 22.5;
60
- const cardinal = index % 4 === 0;
61
- const [x1, y1] = dialPolar(bearing, 70);
62
- const [x2, y2] = dialPolar(bearing, cardinal ? 58 : 64);
63
- return {
64
- key: bearing,
65
- className: cardinal ? "meteo-wind-dial-tick meteo-wind-dial-tick-cardinal" : "meteo-wind-dial-tick",
66
- x1,
67
- x2,
68
- y1,
69
- y2
70
- };
71
- }),
72
- letters: DIAL_CARDINALS.map(({ bearing, letter }) => {
73
- const [x, y] = dialPolar(bearing, 46);
74
- return {
75
- key: letter,
76
- className: "meteo-wind-dial-letter",
77
- anchor: "middle",
78
- x,
79
- y: y + 3.5,
80
- text: letter
81
- };
82
- }),
83
- ghosts: points.slice(0, -1).flatMap((sample, index) => {
84
- if (isCalm(sample.windMps) || sample.windDirectionDeg == null) return [];
85
- const decile = Math.min(FAN_GHOST_STEPS - 1, Math.floor((count - 1 - index) / count * FAN_GHOST_STEPS));
86
- const [cx, cy] = dialPolar(sample.windDirectionDeg, FAN_RADIUS);
87
- return [{
88
- key: sample.observedAt,
89
- className: `meteo-fan-ghost-${decile}`,
90
- d: vanePath(cx, cy, sample.windDirectionDeg)
91
- }];
92
- }),
93
- needle: newestBlowing && newest.windDirectionDeg != null ? {
94
- className: "meteo-wind-needle",
95
- blade: {
96
- className: "meteo-wind-needle-blade",
97
- points: dialNeedlePoints(newest.windDirectionDeg)
98
- },
99
- counterweight: {
100
- className: "meteo-wind-needle-counterweight",
101
- cx: dialPolar(newest.windDirectionDeg, 46)[0],
102
- cy: dialPolar(newest.windDirectionDeg, 46)[1],
103
- r: DIAL_COUNTERWEIGHT_RADIUS
104
- }
105
- } : null,
106
- hub: {
107
- className: "meteo-wind-dial-hub",
108
- cx: 80,
109
- cy: 80,
110
- r: 36
111
- }
112
- };
25
+ return el("svg", {
26
+ "aria-label": words.aria.compassFan(stationName ?? ""),
27
+ class: "meteo-compass-fan-svg",
28
+ height: 160,
29
+ role: "img",
30
+ viewBox: `0 0 160 160`,
31
+ width: 160
32
+ }, dialRing(), dialVerdictRing(favorableDirections), dialTicks(), dialLetters(), points.slice(0, -1).flatMap((sample, index) => {
33
+ if (isCalm(sample.windMps) || sample.windDirectionDeg == null) return [];
34
+ const decile = Math.min(9, Math.floor((count - 1 - index) / count * FAN_GHOST_STEPS));
35
+ const [cx, cy] = dialPolar(sample.windDirectionDeg, FAN_RADIUS);
36
+ return [keyed(sample.observedAt, "path", {
37
+ class: `meteo-fan-ghost-${decile}`,
38
+ d: vanePath(cx, cy, sample.windDirectionDeg)
39
+ })];
40
+ }), newestBlowing && newest.windDirectionDeg != null ? dialNeedle(newest.windDirectionDeg) : null, dialHub());
113
41
  }
114
- //#endregion
115
- export { COMPASS_FAN_CLASS, compassFanGate, compassFanScene, compassFanSource };
42
+ export { compassFanScene, compassFanSource };
@@ -1,3 +1,4 @@
1
1
  import "../contract.js";
2
2
  import "../derive.js";
3
- import "../strings.js";
3
+ import "../strings.js";
4
+ import "../instruments.js";