@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,9 +1,9 @@
1
1
  import { resolveStation } from "../../display.js";
2
- import { windRoseGate, windRoseScene, windRoseSource } from "../../scene/rose.js";
2
+ import { windRoseScene, windRoseSource } from "../../scene/rose.js";
3
3
  import { numberAttribute } from "../lib/attributes.js";
4
4
  import { MeteoStationElement } from "../lib/base.js";
5
- import { h, hs } from "../lib/h.js";
6
- //#region src/elements/elements/WindRoseElement.ts
5
+ import { renderScene } from "../lib/render.js";
6
+ // src/elements/elements/WindRoseElement.ts
7
7
  var WindRoseElement = class extends MeteoStationElement {
8
8
  static observedAttributes = [
9
9
  "favorable-directions",
@@ -26,79 +26,14 @@ var WindRoseElement = class extends MeteoStationElement {
26
26
  render() {
27
27
  const station = this.station ?? (this.#points == null ? resolveStation(this.ambient()?.feed ?? null, this.getAttribute("station-id") ?? void 0) ?? void 0 : void 0);
28
28
  const { favorableDirections, thresholds, words } = this.display();
29
- const source = windRoseSource(this.#points, station);
30
- const gate = windRoseGate(source, words);
31
- if (gate.kind === "note") {
32
- this.replaceChildren(h("div", {
33
- class: gate.className,
34
- role: "note"
35
- }, gate.text));
36
- return;
37
- }
38
- const scene = windRoseScene({
29
+ this.replaceChildren(renderScene(windRoseScene({
39
30
  favorableDirections,
40
31
  sectorCount: numberAttribute(this.getAttribute("sector-count")) ?? 16,
41
- source,
32
+ source: windRoseSource(this.#points, station),
42
33
  stationName: station?.name,
43
34
  thresholds,
44
35
  words
45
- });
46
- this.replaceChildren(windRoseSceneDom(scene));
36
+ })));
47
37
  }
48
38
  };
49
- /** One scene, one drawing — shared by the history-fed rose above and the
50
- * climatology-fed twin, which appends its caption row as extra children. */
51
- function windRoseSceneDom(scene, ...extraChildren) {
52
- return h("div", { class: scene.className }, hs("svg", {
53
- "aria-label": scene.svg.ariaLabel,
54
- class: scene.svg.className,
55
- height: scene.svg.height,
56
- role: "img",
57
- viewBox: scene.svg.viewBox,
58
- width: scene.svg.width
59
- }, scene.gridCircles.map((circle) => hs("circle", {
60
- class: circle.className,
61
- cx: circle.cx,
62
- cy: circle.cy,
63
- r: circle.r
64
- })), scene.ring != null ? [hs("circle", {
65
- class: scene.ring.unfavorable.className,
66
- cx: scene.ring.unfavorable.cx,
67
- cy: scene.ring.unfavorable.cy,
68
- r: scene.ring.unfavorable.r
69
- }), scene.ring.favorable.map((arc) => hs("path", {
70
- class: arc.className,
71
- d: arc.d
72
- }))] : null, scene.ticks.map((tick) => hs("line", {
73
- class: tick.className,
74
- x1: tick.x1,
75
- x2: tick.x2,
76
- y1: tick.y1,
77
- y2: tick.y2
78
- })), scene.letters.map((letter) => hs("text", {
79
- class: letter.className,
80
- "text-anchor": letter.anchor,
81
- x: letter.x,
82
- y: letter.y
83
- }, letter.text)), scene.petals.map((petal) => hs("path", {
84
- class: petal.className,
85
- d: petal.d
86
- })), scene.ringLabel != null && hs("text", {
87
- class: scene.ringLabel.className,
88
- "text-anchor": scene.ringLabel.anchor,
89
- x: scene.ringLabel.x,
90
- y: scene.ringLabel.y
91
- }, scene.ringLabel.text), hs("circle", {
92
- class: scene.hub.className,
93
- cx: scene.hub.cx,
94
- cy: scene.hub.cy,
95
- r: scene.hub.r
96
- }), hs("circle", {
97
- class: scene.dot.className,
98
- cx: scene.dot.cx,
99
- cy: scene.dot.cy,
100
- r: scene.dot.r
101
- })), scene.calmCaption != null ? h("p", { class: scene.calmCaption.className }, scene.calmCaption.text) : null, ...extraChildren);
102
- }
103
- //#endregion
104
- export { WindRoseElement, windRoseSceneDom };
39
+ export { WindRoseElement };
@@ -1,42 +1,41 @@
1
1
  import { SpeedKind } from "../../format.js";
2
2
  import { MeteoStationElement } from "../lib/base.js";
3
- //#region src/elements/elements/atoms.d.ts
4
3
  declare abstract class SpeedAtomElement extends MeteoStationElement {
5
- static readonly observedAttributes: ("unit" | "station-id")[];
4
+ static readonly observedAttributes: ("station-id" | "unit")[];
6
5
  protected abstract readonly kind: SpeedKind;
7
6
  protected abstract readonly component: string;
8
7
  protected render(): void;
9
8
  }
10
- declare class SpeedElement extends SpeedAtomElement {
9
+ export declare class SpeedElement extends SpeedAtomElement {
11
10
  protected readonly kind = "average";
12
11
  protected readonly component = "meteo-speed";
13
12
  }
14
- declare class GustElement extends SpeedAtomElement {
13
+ export declare class GustElement extends SpeedAtomElement {
15
14
  protected readonly kind = "gust";
16
15
  protected readonly component = "meteo-gust";
17
16
  }
18
- declare class LullElement extends SpeedAtomElement {
17
+ export declare class LullElement extends SpeedAtomElement {
19
18
  protected readonly kind = "lull";
20
19
  protected readonly component = "meteo-lull";
21
20
  }
22
- declare class TemperatureElement extends MeteoStationElement {
21
+ export declare class TemperatureElement extends MeteoStationElement {
23
22
  static readonly observedAttributes: string[];
24
23
  protected render(): void;
25
24
  }
26
- declare class PressureElement extends MeteoStationElement {
25
+ export declare class PressureElement extends MeteoStationElement {
27
26
  static readonly observedAttributes: string[];
28
27
  protected render(): void;
29
28
  }
30
- declare class DirectionElement extends MeteoStationElement {
29
+ export declare class DirectionElement extends MeteoStationElement {
31
30
  static readonly observedAttributes: string[];
32
31
  protected render(): void;
33
32
  }
34
- declare class UpdatedAtElement extends MeteoStationElement {
33
+ export declare class UpdatedAtElement extends MeteoStationElement {
35
34
  static readonly observedAttributes: string[];
36
35
  protected connected(): void;
37
36
  protected render(): void;
38
37
  }
39
- declare class BandChipElement extends MeteoStationElement {
38
+ export declare class BandChipElement extends MeteoStationElement {
40
39
  #private;
41
40
  static readonly observedAttributes: string[];
42
41
  constructor();
@@ -44,5 +43,4 @@ declare class BandChipElement extends MeteoStationElement {
44
43
  set labels(value: readonly string[] | undefined);
45
44
  protected render(): void;
46
45
  }
47
- //#endregion
48
- export { BandChipElement, DirectionElement, GustElement, LullElement, PressureElement, SpeedElement, TemperatureElement, UpdatedAtElement };
46
+ export {};
@@ -1,22 +1,15 @@
1
- import { bandChipScene, directionAtomScene, pressureAtomScene, speedAtomScene, temperatureAtomScene, updatedAtScene } from "../../scene/atoms.js";
1
+ import { pressureAtomScene, speedAtomScene, temperatureAtomScene } from "../../scene/atoms.js";
2
+ import { bandChipNode, directionAtomNode, updatedAtNode, valueAtomNode } from "../../scene/cells.js";
2
3
  import { MeteoStationElement } from "../lib/base.js";
3
- import { h } from "../lib/h.js";
4
- import { directionCellNodes } from "../lib/fragments.js";
5
- //#region src/elements/elements/atoms.ts
4
+ import { renderScene } from "../lib/render.js";
5
+ // src/elements/elements/atoms.ts
6
6
  const STATION_ATTRIBUTES = ["station-id", "unit"];
7
- function valueAtomNode(scene) {
8
- const children = scene.content.kind === "dash" ? [scene.content.text] : [scene.content.text, h("span", { class: scene.content.unit.className }, scene.content.unit.text)];
9
- return h("data", {
10
- class: scene.className,
11
- value: scene.value
12
- }, ...children);
13
- }
14
7
  var SpeedAtomElement = class extends MeteoStationElement {
15
8
  static observedAttributes = [...STATION_ATTRIBUTES];
16
9
  render() {
17
10
  const station = this.requiredStation(this.component);
18
11
  const { unit, words } = this.display();
19
- this.replaceChildren(valueAtomNode(speedAtomScene(station, this.kind, unit, words)));
12
+ this.replaceChildren(renderScene(valueAtomNode(speedAtomScene(station, this.kind, unit, words))));
20
13
  }
21
14
  };
22
15
  var SpeedElement = class extends SpeedAtomElement {
@@ -36,7 +29,7 @@ var TemperatureElement = class extends MeteoStationElement {
36
29
  render() {
37
30
  const station = this.requiredStation("meteo-temperature");
38
31
  const { words } = this.display();
39
- this.replaceChildren(valueAtomNode(temperatureAtomScene(station, words)));
32
+ this.replaceChildren(renderScene(valueAtomNode(temperatureAtomScene(station, words))));
40
33
  }
41
34
  };
42
35
  var PressureElement = class extends MeteoStationElement {
@@ -44,7 +37,7 @@ var PressureElement = class extends MeteoStationElement {
44
37
  render() {
45
38
  const station = this.requiredStation("meteo-pressure");
46
39
  const { words } = this.display();
47
- this.replaceChildren(valueAtomNode(pressureAtomScene(station, words)));
40
+ this.replaceChildren(renderScene(valueAtomNode(pressureAtomScene(station, words))));
48
41
  }
49
42
  };
50
43
  var DirectionElement = class extends MeteoStationElement {
@@ -52,15 +45,7 @@ var DirectionElement = class extends MeteoStationElement {
52
45
  render() {
53
46
  const station = this.requiredStation("meteo-direction");
54
47
  const { favorableDirections, words } = this.display();
55
- const scene = directionAtomScene(station, words, favorableDirections);
56
- if (scene.cell == null) {
57
- this.replaceChildren(h("span", { class: scene.className }, scene.dashText));
58
- return;
59
- }
60
- this.replaceChildren(h("span", {
61
- "aria-label": scene.ariaLabel,
62
- class: scene.className
63
- }, ...directionCellNodes(scene.cell.windAvgMps, scene.cell.windDirectionDeg, words)));
48
+ this.replaceChildren(renderScene(directionAtomNode(station, words, favorableDirections)));
64
49
  }
65
50
  };
66
51
  var UpdatedAtElement = class extends MeteoStationElement {
@@ -75,22 +60,14 @@ var UpdatedAtElement = class extends MeteoStationElement {
75
60
  render() {
76
61
  const station = this.requiredStation("meteo-updated-at");
77
62
  const { formatTime, words } = this.display();
78
- const scene = updatedAtScene({
63
+ this.replaceChildren(renderScene(updatedAtNode({
79
64
  formatTime,
80
65
  nowMs: Date.now(),
81
66
  receivedAtMs: this.receivedAtMsValue(),
82
67
  servedAt: this.servedAtValue(),
83
68
  station,
84
69
  words
85
- });
86
- if (scene.kind === "dash") {
87
- this.replaceChildren(h("span", { class: scene.className }, scene.text));
88
- return;
89
- }
90
- this.replaceChildren(h("time", {
91
- class: scene.className,
92
- datetime: scene.dateTime
93
- }, scene.text));
70
+ })));
94
71
  }
95
72
  };
96
73
  var BandChipElement = class extends MeteoStationElement {
@@ -114,18 +91,13 @@ var BandChipElement = class extends MeteoStationElement {
114
91
  render() {
115
92
  const station = this.requiredStation("meteo-band-chip");
116
93
  const { thresholds, unit, words } = this.display();
117
- const scene = bandChipScene({
94
+ this.replaceChildren(renderScene(bandChipNode({
118
95
  labels: this.#labels,
119
96
  station,
120
97
  thresholds,
121
98
  unit,
122
99
  words
123
- });
124
- this.replaceChildren(h("span", {
125
- class: scene.className,
126
- "data-band": scene.band
127
- }, scene.text));
100
+ })));
128
101
  }
129
102
  };
130
- //#endregion
131
103
  export { BandChipElement, DirectionElement, GustElement, LullElement, PressureElement, SpeedElement, TemperatureElement, UpdatedAtElement };
@@ -20,8 +20,7 @@ import { WindArrowElement } from "./elements/WindArrowElement.js";
20
20
  import { WindHistoryChartElement } from "./elements/WindHistoryChartElement.js";
21
21
  import { WindRoseElement } from "./elements/WindRoseElement.js";
22
22
  import { StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement } from "./elements/StationCardElement.js";
23
- //#region src/elements/index.d.ts
24
- declare const meteoElementTags: {
23
+ export declare const meteoElementTags: {
25
24
  readonly "meteo-station-feed": typeof StationFeedElement;
26
25
  readonly "meteo-station-card": typeof StationCardElement;
27
26
  readonly "meteo-air-extremes": typeof AirExtremesElement;
@@ -55,6 +54,5 @@ declare const meteoElementTags: {
55
54
  readonly "meteo-station-card-instrument": typeof StationCardInstrumentElement;
56
55
  readonly "meteo-station-card-summary": typeof StationCardSummaryElement;
57
56
  };
58
- declare function defineMeteoElements(registry?: CustomElementRegistry): void;
59
- //#endregion
60
- export { AirExtremesElement, AirMatrixElement, type AmbientStationFeed, BandChipElement, ClimatologyDailyPatternElement, ClimatologyRoseElement, CompassFanElement, CurrentConditionsElement, DailyPatternElement, DialElement, DirectionElement, FavorableShareElement, FreshnessBadgeElement, GustElement, LullElement, PressureElement, RecentSummariesElement, SparklineElement, SpeedElement, StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement, StationFeedElement, type StationMetaRenderer, StationStripElement, StationTableElement, TemperatureElement, TrendChartElement, UpdatedAtElement, WindArrowElement, WindHistoryChartElement, WindRoseElement, defineMeteoElements, meteoElementTags };
57
+ export declare function defineMeteoElements(registry?: CustomElementRegistry): void;
58
+ export { AirExtremesElement, AirMatrixElement, type AmbientStationFeed, BandChipElement, ClimatologyDailyPatternElement, ClimatologyRoseElement, CompassFanElement, CurrentConditionsElement, DailyPatternElement, DialElement, DirectionElement, FavorableShareElement, FreshnessBadgeElement, GustElement, LullElement, PressureElement, RecentSummariesElement, SparklineElement, SpeedElement, StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement, StationFeedElement, type StationMetaRenderer, StationStripElement, StationTableElement, TemperatureElement, TrendChartElement, UpdatedAtElement, WindArrowElement, WindHistoryChartElement, WindRoseElement };
@@ -1,14 +1,13 @@
1
1
  import { BandChipElement, DirectionElement, GustElement, LullElement, PressureElement, SpeedElement, TemperatureElement, UpdatedAtElement } from "./elements/atoms.js";
2
2
  import { AirExtremesElement } from "./elements/AirExtremesElement.js";
3
3
  import { AirMatrixElement } from "./elements/AirMatrixElement.js";
4
- import { DailyPatternElement } from "./elements/DailyPatternElement.js";
5
4
  import { ClimatologyDailyPatternElement } from "./elements/ClimatologyDailyPatternElement.js";
6
5
  import { CompassFanElement } from "./elements/CompassFanElement.js";
7
6
  import { RecentSummariesElement } from "./elements/RecentSummariesElement.js";
8
- import { WindRoseElement } from "./elements/WindRoseElement.js";
9
7
  import { ClimatologyRoseElement } from "./elements/ClimatologyRoseElement.js";
10
- import { DialElement } from "./elements/DialElement.js";
11
8
  import { CurrentConditionsElement } from "./elements/CurrentConditionsElement.js";
9
+ import { DailyPatternElement } from "./elements/DailyPatternElement.js";
10
+ import { DialElement } from "./elements/DialElement.js";
12
11
  import { FavorableShareElement } from "./elements/FavorableShareElement.js";
13
12
  import { FreshnessBadgeElement } from "./elements/FreshnessBadgeElement.js";
14
13
  import { SparklineElement } from "./elements/SparklineElement.js";
@@ -18,8 +17,9 @@ import { StationTableElement } from "./elements/StationTableElement.js";
18
17
  import { TrendChartElement } from "./elements/TrendChartElement.js";
19
18
  import { WindArrowElement } from "./elements/WindArrowElement.js";
20
19
  import { WindHistoryChartElement } from "./elements/WindHistoryChartElement.js";
20
+ import { WindRoseElement } from "./elements/WindRoseElement.js";
21
21
  import { StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement } from "./elements/StationCardElement.js";
22
- //#region src/elements/index.ts
22
+ // src/elements/index.ts
23
23
  const meteoElementTags = {
24
24
  "meteo-station-feed": StationFeedElement,
25
25
  "meteo-station-card": StationCardElement,
@@ -65,5 +65,4 @@ function defineMeteoElements(registry = customElements) {
65
65
  registry.define(tag, constructor);
66
66
  }
67
67
  }
68
- //#endregion
69
68
  export { AirExtremesElement, AirMatrixElement, BandChipElement, ClimatologyDailyPatternElement, ClimatologyRoseElement, CompassFanElement, CurrentConditionsElement, DailyPatternElement, DialElement, DirectionElement, FavorableShareElement, FreshnessBadgeElement, GustElement, LullElement, PressureElement, RecentSummariesElement, SparklineElement, SpeedElement, StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement, StationFeedElement, StationStripElement, StationTableElement, TemperatureElement, TrendChartElement, UpdatedAtElement, WindArrowElement, WindHistoryChartElement, WindRoseElement, defineMeteoElements, meteoElementTags };
@@ -3,8 +3,7 @@ import { SpeedThresholds, SpeedUnit } from "../../derive.js";
3
3
  import { FormatTime, StationStringOverrides } from "../../strings.js";
4
4
  import { FavorableDirection } from "../../instruments.js";
5
5
  import "../../index.js";
6
- //#region src/elements/lib/ambient.d.ts
7
- type AmbientStationFeed = {
6
+ export type AmbientStationFeed = {
8
7
  feed: StationFeed | null;
9
8
  receivedAtMs: number | null;
10
9
  strings: StationStringOverrides | undefined;
@@ -12,6 +11,4 @@ type AmbientStationFeed = {
12
11
  formatTime: FormatTime | undefined;
13
12
  thresholds: SpeedThresholds | undefined;
14
13
  favorableDirections: FavorableDirection[] | undefined;
15
- };
16
- //#endregion
17
- export { AmbientStationFeed };
14
+ };
@@ -1,5 +1,4 @@
1
- //#region src/elements/lib/ambient.ts
1
+ // src/elements/lib/ambient.ts
2
2
  const STATION_FEED_CONTEXT_KEY = "station-feed";
3
3
  const ELEMENTS_AMBIENT_HINT = "render inside <meteo-station-feed> with a feed";
4
- //#endregion
5
4
  export { ELEMENTS_AMBIENT_HINT, STATION_FEED_CONTEXT_KEY };
@@ -1,5 +1,5 @@
1
1
  import { SPEED_UNITS } from "../../derive.js";
2
- //#region src/elements/lib/attributes.ts
2
+ // src/elements/lib/attributes.ts
3
3
  function numberAttribute(value) {
4
4
  if (value == null || value.trim() === "") return void 0;
5
5
  const parsed = Number(value);
@@ -40,5 +40,4 @@ function parseArcsAttribute(value) {
40
40
  } catch {}
41
41
  console.warn(`meteo: invalid favorable-directions attribute ${JSON.stringify(value)} — expected '[{"fromDeg":260,"toDeg":340}]' or "none"; treating as absent.`);
42
42
  }
43
- //#endregion
44
43
  export { numberAttribute, parseArcsAttribute, parseMonthsAttribute, parseSlotsAttribute, parseThresholdsAttribute, unitAttribute };
@@ -5,8 +5,7 @@ import { FavorableDirection } from "../../instruments.js";
5
5
  import { ResolvedDisplay } from "../../display.js";
6
6
  import "../../index.js";
7
7
  import { AmbientStationFeed } from "./ambient.js";
8
- //#region src/elements/lib/base.d.ts
9
- declare abstract class MeteoElement extends HTMLElement {
8
+ export declare abstract class MeteoElement extends HTMLElement {
10
9
  #private;
11
10
  connectedCallback(): void;
12
11
  disconnectedCallback(): void;
@@ -20,7 +19,7 @@ declare abstract class MeteoElement extends HTMLElement {
20
19
  protected disconnected(): void;
21
20
  protected abstract render(): void;
22
21
  }
23
- declare abstract class MeteoStationElement extends MeteoElement {
22
+ export declare abstract class MeteoStationElement extends MeteoElement {
24
23
  #private;
25
24
  constructor();
26
25
  get station(): Station | undefined;
@@ -43,6 +42,4 @@ declare abstract class MeteoStationElement extends MeteoElement {
43
42
  protected receivedAtMsValue(): number | null;
44
43
  protected watchFreshness(): void;
45
44
  protected freshnessOf(station: Station): FreshnessStatus | null;
46
- }
47
- //#endregion
48
- export { MeteoElement, MeteoStationElement };
45
+ }
@@ -4,7 +4,7 @@ import { subscribeTicker } from "../../client/ticker.js";
4
4
  import { ELEMENTS_AMBIENT_HINT, STATION_FEED_CONTEXT_KEY } from "./ambient.js";
5
5
  import { numberAttribute, parseArcsAttribute, parseThresholdsAttribute, unitAttribute } from "./attributes.js";
6
6
  import { requestContext } from "./context.js";
7
- //#region src/elements/lib/base.ts
7
+ // src/elements/lib/base.ts
8
8
  var MeteoElement = class extends HTMLElement {
9
9
  #cleanups = [];
10
10
  #ambient = null;
@@ -160,5 +160,4 @@ var MeteoStationElement = class extends MeteoElement {
160
160
  }, stationFreshnessThresholds(station));
161
161
  }
162
162
  };
163
- //#endregion
164
163
  export { MeteoElement, MeteoStationElement };
@@ -1,4 +1,4 @@
1
- //#region src/elements/lib/context.ts
1
+ // src/elements/lib/context.ts
2
2
  const CONTEXT_REQUEST_EVENT = "meteo-context-request";
3
3
  function requestContext(from, key) {
4
4
  let provision = null;
@@ -24,5 +24,4 @@ function provideContext(host, key, provision) {
24
24
  host.addEventListener(CONTEXT_REQUEST_EVENT, handler);
25
25
  return () => host.removeEventListener(CONTEXT_REQUEST_EVENT, handler);
26
26
  }
27
- //#endregion
28
27
  export { CONTEXT_REQUEST_EVENT, provideContext, requestContext };
@@ -1,45 +1,15 @@
1
- import { directionCell } from "../../format.js";
2
- import { freshnessBadgeSpec, windArrowSpec } from "../../scene/glyphs.js";
3
- import { h, hs } from "./h.js";
4
- //#region src/elements/lib/fragments.ts
1
+ import { freshnessBadgeNode, windArrowNode } from "../../scene/glyphs.js";
2
+ import { stationNameNode as stationNameNode$1 } from "../../scene/cells.js";
3
+ import { renderScene } from "./render.js";
4
+ // src/elements/lib/fragments.ts
5
5
  function windArrowSvg(deg, size = 12) {
6
- const spec = windArrowSpec(deg, size);
7
- const svg = hs("svg", {
8
- "aria-hidden": "true",
9
- class: spec.className,
10
- height: spec.height,
11
- viewBox: spec.viewBox,
12
- width: spec.width
13
- }, hs("path", {
14
- d: spec.path.d,
15
- fill: spec.path.fill
16
- }));
17
- svg.style.transform = spec.transform;
18
- return svg;
19
- }
20
- function directionCellNodes(windAvgMps, windDirectionDeg, words) {
21
- const cell = directionCell(windAvgMps, windDirectionDeg);
22
- if (cell.kind === "calm") return [words.calm];
23
- if (cell.kind === "dash") return ["—"];
24
- return [windArrowSvg(cell.deg), ` ${cell.compass} ${cell.rounded}°`];
6
+ return renderScene(windArrowNode(deg, size));
25
7
  }
26
8
  function stationNameNode(station) {
27
- if (station.pageUrl == null) return station.name;
28
- return h("a", {
29
- href: station.pageUrl,
30
- rel: "noreferrer",
31
- target: "_blank"
32
- }, station.name);
9
+ const node = stationNameNode$1(station);
10
+ return typeof node === "object" && node !== null ? renderScene(node) : node;
33
11
  }
34
12
  function freshnessBadgeSpan(status, words) {
35
- const spec = freshnessBadgeSpec(status, words);
36
- return h("span", {
37
- class: spec.className,
38
- "data-freshness": spec.status
39
- }, h("span", {
40
- "aria-hidden": "true",
41
- class: spec.dot.className
42
- }), spec.text);
13
+ return renderScene(freshnessBadgeNode(status, words));
43
14
  }
44
- //#endregion
45
- export { directionCellNodes, freshnessBadgeSpan, stationNameNode, windArrowSvg };
15
+ export { freshnessBadgeSpan, stationNameNode, windArrowSvg };
@@ -1,10 +1,10 @@
1
- //#region src/elements/lib/h.ts
1
+ // src/elements/lib/h.ts
2
2
  const SVG_NS = "http://www.w3.org/2000/svg";
3
3
  function apply(element, attrs, children) {
4
4
  if (attrs != null) for (const [name, value] of Object.entries(attrs)) {
5
5
  if (value == null || value === false) continue;
6
6
  if (typeof value === "function") {
7
- element.addEventListener(name.slice(2), value);
7
+ element.addEventListener(name.slice(2).toLowerCase(), value);
8
8
  continue;
9
9
  }
10
10
  element.setAttribute(name, value === true ? "" : String(value));
@@ -31,5 +31,4 @@ function hs(tag, attrs = null, ...children) {
31
31
  apply(element, attrs, children);
32
32
  return element;
33
33
  }
34
- //#endregion
35
34
  export { h, hs };
@@ -1,5 +1,5 @@
1
1
  import { activeChartIndex, chartIndexAtClient, togglePinnedAt } from "../../scene/chart.js";
2
- //#region src/elements/lib/pinned-cursor.ts
2
+ // src/elements/lib/pinned-cursor.ts
3
3
  var PinnedCursor = class {
4
4
  #pinnedAt = null;
5
5
  #previewIndex = null;
@@ -44,5 +44,4 @@ var PinnedCursor = class {
44
44
  return chartIndexAtClient(scene.points, scene.frame, scene.scales, clientX, svg.getBoundingClientRect());
45
45
  }
46
46
  };
47
- //#endregion
48
47
  export { PinnedCursor };
@@ -0,0 +1,29 @@
1
+ import { SVG_ROOT_TAGS } from "../../scene/node.js";
2
+ import { h, hs } from "./h.js";
3
+ // src/elements/lib/render.ts
4
+ function renderChild(child, svg = false) {
5
+ if (child == null || child === false) return null;
6
+ if (typeof child === "string") return child;
7
+ if (typeof child === "number") return String(child);
8
+ return renderScene(child, svg);
9
+ }
10
+ function renderScene(node, svg = false) {
11
+ const inSvg = svg || SVG_ROOT_TAGS.has(node.tag);
12
+ const children = (node.children ?? []).map((child) => renderChild(child, inSvg));
13
+ const element = inSvg ? hs(node.tag, node.attrs ?? null, ...children) : h(node.tag, node.attrs ?? null, ...children);
14
+ if (node.style !== void 0) {
15
+ const style = element.style;
16
+ for (const [property, value] of Object.entries(node.style)) if (property.startsWith("--")) element.style.setProperty(property, value);
17
+ else style[property] = value;
18
+ }
19
+ return element;
20
+ }
21
+ /** The scene, or nothing when the widget has no surface to draw. */
22
+ function renderOptional(node) {
23
+ return node === null ? [] : [renderScene(node)];
24
+ }
25
+ /** A run of children with no element of their own to sit in. */
26
+ function renderChildren(children) {
27
+ return children.map((child) => renderChild(child)).filter((node) => node !== null);
28
+ }
29
+ export { renderChild, renderChildren, renderOptional, renderScene };
@@ -1,5 +1,4 @@
1
1
  import { defineMeteoElements } from "./index.js";
2
- //#region src/elements/register.ts
2
+ // src/elements/register.ts
3
3
  defineMeteoElements();
4
- //#endregion
5
4
  export {};
@@ -1,12 +1,9 @@
1
- //#region src/endpoints.d.ts
2
- declare function feedEndpoint(base: string): string;
3
- declare function currentEndpoint(base: string, stationId: string): string;
4
- declare function liveEndpoint(base: string, stationId: string): string;
5
- declare function climatologyEndpoint(base: string, stationId: string): string;
6
- declare function historyEndpoint(base: string, stationId: string, query: {
1
+ export declare function feedEndpoint(base: string): string;
2
+ export declare function currentEndpoint(base: string, stationId: string): string;
3
+ export declare function liveEndpoint(base: string, stationId: string): string;
4
+ export declare function climatologyEndpoint(base: string, stationId: string): string;
5
+ export declare function historyEndpoint(base: string, stationId: string, query: {
7
6
  fromMs: number;
8
7
  toMs: number;
9
8
  periodMinutes: number;
10
- }): string;
11
- //#endregion
12
- export { climatologyEndpoint, currentEndpoint, feedEndpoint, historyEndpoint, liveEndpoint };
9
+ }): string;
package/dist/endpoints.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/endpoints.ts
1
+ // src/endpoints.ts
2
2
  const trimBase = (base) => base.replace(/\/+$/, "");
3
3
  function feedEndpoint(base) {
4
4
  return `${trimBase(base)}/feed`;
@@ -21,5 +21,4 @@ function historyEndpoint(base, stationId, query) {
21
21
  });
22
22
  return `${trimBase(base)}/history?${params.toString()}`;
23
23
  }
24
- //#endregion
25
24
  export { climatologyEndpoint, currentEndpoint, feedEndpoint, historyEndpoint, liveEndpoint };
@@ -1,16 +1,15 @@
1
1
  import { HistoryPoint, StationMeta } from "./contract.js";
2
2
  import { SpeedThresholds } from "./derive.js";
3
- //#region src/fixtures.d.ts
4
- declare const LAUNCH_RIDGE_META: StationMeta;
3
+ export declare const LAUNCH_RIDGE_META: StationMeta;
5
4
  /** The wind grading the demo exhibits judge with. */
6
- declare const EXHIBIT_THRESHOLDS: SpeedThresholds;
5
+ export declare const EXHIBIT_THRESHOLDS: SpeedThresholds;
7
6
  /** Deterministic PRNG (mulberry32). */
8
- declare function mulberry32(seed: number): () => number;
7
+ export declare function mulberry32(seed: number): () => number;
9
8
  /** Smoothstep clamped to [0, 1]. */
10
- declare const smooth: (value: number) => number;
9
+ export declare const smooth: (value: number) => number;
11
10
  /** Deterministic wobble in roughly [-1, 1]. */
12
- declare const wobble: (seed: number) => number;
13
- interface LongHistoryOptions {
11
+ export declare const wobble: (seed: number) => number;
12
+ export interface LongHistoryOptions {
14
13
  /** The series ends here. */
15
14
  nowMs: number;
16
15
  /** How many days of history to build. */
@@ -22,6 +21,4 @@ interface LongHistoryOptions {
22
21
  withGaps?: boolean;
23
22
  }
24
23
  /** A long-range deterministic synthetic history: seasonal, diurnal, with occasional dropouts. */
25
- declare function buildLongHistory({ nowMs, days, periodMinutes, seed, withGaps }: LongHistoryOptions): HistoryPoint[];
26
- //#endregion
27
- export { EXHIBIT_THRESHOLDS, LAUNCH_RIDGE_META, LongHistoryOptions, buildLongHistory, mulberry32, smooth, wobble };
24
+ export declare function buildLongHistory({ nowMs, days, periodMinutes, seed, withGaps }: LongHistoryOptions): HistoryPoint[];
package/dist/fixtures.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { kmhToMps } from "@azohra/meteo.core";
2
- //#region src/fixtures.ts
2
+ // src/fixtures.ts
3
3
  const MINUTE_MS = 6e4;
4
4
  const DAY_MS = 1440 * MINUTE_MS;
5
5
  const LAUNCH_RIDGE_META = {
@@ -91,5 +91,4 @@ function buildLongHistory({ nowMs, days = 420, periodMinutes = 15, seed = 995373
91
91
  }
92
92
  return points;
93
93
  }
94
- //#endregion
95
94
  export { EXHIBIT_THRESHOLDS, LAUNCH_RIDGE_META, buildLongHistory, mulberry32, smooth, wobble };