@azohra/meteo.station 0.3.1 → 0.5.0

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 (138) hide show
  1. package/dist/client/climatology.d.ts +27 -0
  2. package/dist/client/climatology.js +83 -0
  3. package/dist/client/history.d.ts +47 -0
  4. package/dist/client/history.js +112 -0
  5. package/dist/client/index.d.ts +3 -1
  6. package/dist/client/index.js +3 -1
  7. package/dist/client/live.js +15 -0
  8. package/dist/climatology.d.ts +66 -0
  9. package/dist/climatology.js +230 -0
  10. package/dist/contract-climatology.d.ts +73 -0
  11. package/dist/contract-climatology.js +52 -0
  12. package/dist/contract.d.ts +234 -1
  13. package/dist/contract.js +52 -4
  14. package/dist/derive.d.ts +23 -1
  15. package/dist/derive.js +43 -4
  16. package/dist/display.d.ts +4 -0
  17. package/dist/display.js +2 -1
  18. package/dist/elements/elements/AirExtremesElement.d.ts +8 -0
  19. package/dist/elements/elements/AirExtremesElement.js +33 -0
  20. package/dist/elements/elements/ClimatologyDailyPatternElement.d.ts +15 -0
  21. package/dist/elements/elements/ClimatologyDailyPatternElement.js +84 -0
  22. package/dist/elements/elements/ClimatologyRoseElement.d.ts +14 -0
  23. package/dist/elements/elements/ClimatologyRoseElement.js +51 -0
  24. package/dist/elements/elements/CompassFanElement.d.ts +14 -0
  25. package/dist/elements/elements/CompassFanElement.js +92 -0
  26. package/dist/elements/elements/DailyPatternElement.d.ts +1 -0
  27. package/dist/elements/elements/DailyPatternElement.js +24 -16
  28. package/dist/elements/elements/DialElement.js +14 -3
  29. package/dist/elements/elements/FavorableShareElement.d.ts +14 -0
  30. package/dist/elements/elements/FavorableShareElement.js +47 -0
  31. package/dist/elements/elements/RecentSummariesElement.d.ts +14 -0
  32. package/dist/elements/elements/RecentSummariesElement.js +54 -0
  33. package/dist/elements/elements/StationFeedElement.d.ts +3 -0
  34. package/dist/elements/elements/StationFeedElement.js +13 -2
  35. package/dist/elements/elements/WindHistoryChartElement.js +20 -7
  36. package/dist/elements/elements/WindRoseElement.d.ts +1 -3
  37. package/dist/elements/elements/WindRoseElement.js +60 -62
  38. package/dist/elements/elements/atoms.js +3 -3
  39. package/dist/elements/index.d.ts +13 -1
  40. package/dist/elements/index.js +15 -3
  41. package/dist/elements/lib/ambient.d.ts +2 -0
  42. package/dist/elements/lib/attributes.js +24 -1
  43. package/dist/elements/lib/base.d.ts +3 -0
  44. package/dist/elements/lib/base.js +14 -2
  45. package/dist/endpoints.d.ts +7 -1
  46. package/dist/endpoints.js +13 -1
  47. package/dist/geometry.d.ts +23 -4
  48. package/dist/geometry.js +44 -13
  49. package/dist/index.d.ts +8 -6
  50. package/dist/index.js +8 -6
  51. package/dist/instruments.d.ts +7 -5
  52. package/dist/instruments.js +20 -7
  53. package/dist/merge-current.js +2 -1
  54. package/dist/react/components/AirExtremes.d.ts +16 -0
  55. package/dist/react/components/AirExtremes.js +38 -0
  56. package/dist/react/components/ClimatologyDailyPattern.d.ts +20 -0
  57. package/dist/react/components/ClimatologyDailyPattern.js +59 -0
  58. package/dist/react/components/ClimatologyRose.d.ts +18 -0
  59. package/dist/react/components/ClimatologyRose.js +45 -0
  60. package/dist/react/components/CompassFan.d.ts +17 -0
  61. package/dist/react/components/CompassFan.js +93 -0
  62. package/dist/react/components/DailyPattern.d.ts +4 -1
  63. package/dist/react/components/DailyPattern.js +15 -8
  64. package/dist/react/components/Dial.d.ts +3 -1
  65. package/dist/react/components/Dial.js +13 -2
  66. package/dist/react/components/FavorableShare.d.ts +14 -0
  67. package/dist/react/components/FavorableShare.js +43 -0
  68. package/dist/react/components/RecentSummaries.d.ts +18 -0
  69. package/dist/react/components/RecentSummaries.js +64 -0
  70. package/dist/react/components/StationFeedProvider.d.ts +4 -1
  71. package/dist/react/components/StationFeedProvider.js +5 -3
  72. package/dist/react/components/WindHistoryChart.d.ts +6 -1
  73. package/dist/react/components/WindHistoryChart.js +20 -5
  74. package/dist/react/components/WindRose.d.ts +4 -2
  75. package/dist/react/components/WindRose.js +80 -71
  76. package/dist/react/components/WindSampleStrip.d.ts +3 -1
  77. package/dist/react/components/WindSampleStrip.js +8 -5
  78. package/dist/react/components/atoms.d.ts +4 -1
  79. package/dist/react/components/atoms.js +6 -3
  80. package/dist/react/hooks/useStationClimatology.d.ts +18 -0
  81. package/dist/react/hooks/useStationClimatology.js +25 -0
  82. package/dist/react/index.d.ts +10 -3
  83. package/dist/react/index.js +9 -2
  84. package/dist/scene/air-extremes.d.ts +2 -0
  85. package/dist/scene/air-extremes.js +42 -0
  86. package/dist/scene/atoms.d.ts +2 -1
  87. package/dist/scene/atoms.js +6 -4
  88. package/dist/scene/climatology-pattern.d.ts +6 -0
  89. package/dist/scene/climatology-pattern.js +35 -0
  90. package/dist/scene/climatology-rose.d.ts +5 -0
  91. package/dist/scene/climatology-rose.js +49 -0
  92. package/dist/scene/compass-fan.d.ts +3 -0
  93. package/dist/scene/compass-fan.js +115 -0
  94. package/dist/scene/daily-pattern.d.ts +1 -0
  95. package/dist/scene/daily-pattern.js +21 -7
  96. package/dist/scene/dial.d.ts +1 -0
  97. package/dist/scene/dial.js +16 -3
  98. package/dist/scene/favorable-share.d.ts +3 -0
  99. package/dist/scene/favorable-share.js +41 -0
  100. package/dist/scene/index.d.ts +9 -3
  101. package/dist/scene/recent-summaries.d.ts +4 -0
  102. package/dist/scene/recent-summaries.js +75 -0
  103. package/dist/scene/rose.d.ts +2 -1
  104. package/dist/scene/rose.js +18 -3
  105. package/dist/scene/sample-strip.d.ts +1 -0
  106. package/dist/scene/sample-strip.js +1 -1
  107. package/dist/scene/trend.js +2 -7
  108. package/dist/scene/wind-history.d.ts +1 -0
  109. package/dist/scene/wind-history.js +4 -3
  110. package/dist/scene/wind-plot.d.ts +1 -0
  111. package/dist/scene/wind-plot.js +44 -9
  112. package/dist/server/adapter.d.ts +2 -1
  113. package/dist/server/adapter.js +2 -1
  114. package/dist/server/adapters/windnerd-climatology.d.ts +30 -0
  115. package/dist/server/adapters/windnerd-climatology.js +82 -0
  116. package/dist/server/adapters/windnerd-live.d.ts +5 -8
  117. package/dist/server/adapters/windnerd-live.js +26 -21
  118. package/dist/server/adapters/windnerd.d.ts +31 -4
  119. package/dist/server/adapters/windnerd.js +196 -19
  120. package/dist/server/environment.d.ts +4 -10
  121. package/dist/server/environment.js +4 -10
  122. package/dist/server/feed.d.ts +44 -2
  123. package/dist/server/feed.js +63 -2
  124. package/dist/server/handler.d.ts +11 -1
  125. package/dist/server/handler.js +83 -2
  126. package/dist/server/index.d.ts +4 -3
  127. package/dist/server/index.js +4 -3
  128. package/dist/strings.d.ts +13 -1
  129. package/dist/strings.js +13 -1
  130. package/package.json +2 -2
  131. package/schema/example-climatology.json +86 -0
  132. package/schema/example-history.json +38 -0
  133. package/schema/stationclimatology.schema.json +221 -0
  134. package/schema/stationcurrent.schema.json +173 -0
  135. package/schema/stationfeed.schema.json +173 -0
  136. package/schema/stationhistory.schema.json +186 -0
  137. package/schema/stationlive.schema.json +202 -0
  138. package/styles.css +232 -19
@@ -8,6 +8,7 @@ import { h, hs } from "../lib/h.js";
8
8
  let hatchCounter = 0;
9
9
  var DailyPatternElement = class extends MeteoStationElement {
10
10
  static observedAttributes = [
11
+ "favorable-directions",
11
12
  "plot-height",
12
13
  "slot-minutes",
13
14
  "station-id",
@@ -35,7 +36,7 @@ var DailyPatternElement = class extends MeteoStationElement {
35
36
  }
36
37
  render() {
37
38
  const station = this.station ?? (this.#points == null ? resolveStation(this.ambient()?.feed ?? null, this.getAttribute("station-id") ?? void 0) ?? void 0 : void 0);
38
- const { thresholds, unit, words } = this.display();
39
+ const { favorableDirections, thresholds, unit, words } = this.display();
39
40
  const { source, periodMinutes } = dailyPatternSource(this.#points, station);
40
41
  const gate = dailyPatternGate(source, words);
41
42
  if (gate.kind === "note") {
@@ -51,7 +52,7 @@ var DailyPatternElement = class extends MeteoStationElement {
51
52
  this.replaceChildren(wrap);
52
53
  this.#observe(wrap);
53
54
  if (this.#width == null) return;
54
- this.#buildChart(wrap, source, periodMinutes, thresholds, unit, words, this.#width, station?.name);
55
+ this.#buildChart(wrap, source, periodMinutes, thresholds, favorableDirections, unit, words, this.#width, station?.name);
55
56
  }
56
57
  #observe(wrap) {
57
58
  this.#observer?.disconnect();
@@ -69,8 +70,9 @@ var DailyPatternElement = class extends MeteoStationElement {
69
70
  });
70
71
  this.#observer.observe(wrap);
71
72
  }
72
- #buildChart(wrap, points, periodMinutes, thresholds, unit, words, width, stationName) {
73
- const scene = dailyPatternScene({
73
+ #buildChart(wrap, points, periodMinutes, thresholds, favorableDirections, unit, words, width, stationName) {
74
+ const { caption, svg } = dailyPatternSceneDom(dailyPatternScene({
75
+ favorableDirections,
74
76
  hatchId: `meteo-daily-pattern-hatch-e${++hatchCounter}`,
75
77
  periodMinutes,
76
78
  plotHeight: numberAttribute(this.getAttribute("plot-height")),
@@ -82,9 +84,16 @@ var DailyPatternElement = class extends MeteoStationElement {
82
84
  utcOffsetMinutes: numberAttribute(this.getAttribute("utc-offset-minutes")) ?? 0,
83
85
  width,
84
86
  words
85
- });
86
- const caption = h("output", { class: scene.caption.className }, scene.caption.text);
87
- const svg = hs("svg", {
87
+ }));
88
+ wrap.replaceChildren(caption, svg);
89
+ }
90
+ };
91
+ /** One scene, one drawing — shared by the history-fed pattern above and the
92
+ * climatology-fed twin. */
93
+ function dailyPatternSceneDom(scene) {
94
+ return {
95
+ caption: h("output", { class: scene.caption.className }, scene.caption.text),
96
+ svg: hs("svg", {
88
97
  "aria-label": scene.svg.ariaLabel,
89
98
  class: scene.svg.className,
90
99
  height: scene.svg.height,
@@ -171,29 +180,28 @@ var DailyPatternElement = class extends MeteoStationElement {
171
180
  }, vane.mark.text.text) : hs("path", {
172
181
  class: vane.mark.className,
173
182
  d: vane.mark.d
174
- })), scene.vanes.map((vane) => hs("text", {
183
+ })), scene.vanes.flatMap((vane) => vane.label == null ? [] : [hs("text", {
175
184
  class: vane.label.className,
176
185
  "text-anchor": vane.label.anchor,
177
186
  x: vane.label.x,
178
187
  y: vane.label.y
179
- }, vane.label.text)), hs("text", {
188
+ }, vane.label.text)]), hs("text", {
180
189
  class: scene.rowLabels.avg.className,
181
190
  "text-anchor": scene.rowLabels.avg.anchor,
182
191
  x: scene.rowLabels.avg.x,
183
192
  y: scene.rowLabels.avg.y
184
- }, scene.rowLabels.avg.text), scene.vanes.map((vane) => hs("text", {
193
+ }, scene.rowLabels.avg.text), scene.vanes.flatMap((vane) => vane.value == null ? [] : [hs("text", {
185
194
  class: vane.value.className,
186
195
  "text-anchor": vane.value.anchor,
187
196
  x: vane.value.x,
188
197
  y: vane.value.y
189
- }, vane.value.text)), scene.ticks.map((tick) => hs("text", {
198
+ }, vane.value.text)]), scene.ticks.map((tick) => hs("text", {
190
199
  class: tick.className,
191
200
  "text-anchor": tick.anchor,
192
201
  x: tick.x,
193
202
  y: tick.y
194
- }, tick.text)));
195
- wrap.replaceChildren(caption, svg);
196
- }
197
- };
203
+ }, tick.text)))
204
+ };
205
+ }
198
206
  //#endregion
199
- export { DailyPatternElement };
207
+ export { DailyPatternElement, dailyPatternSceneDom };
@@ -6,10 +6,11 @@ import { hs } from "../lib/h.js";
6
6
  //#region src/elements/elements/DialElement.ts
7
7
  let bezelCounter = 0;
8
8
  function dialSvg(options) {
9
- const { station, thresholds, unit, words, size = 160, calmWord = true } = options;
9
+ const { station, thresholds, favorableDirections, unit, words, size = 160, calmWord = true } = options;
10
10
  const scene = dialScene({
11
11
  bezelId: `meteo-bezel-e${++bezelCounter}`,
12
12
  calmWord,
13
+ favorableDirections,
13
14
  size,
14
15
  station,
15
16
  thresholds,
@@ -48,7 +49,15 @@ function dialSvg(options) {
48
49
  cx: scene.ring.cx,
49
50
  cy: scene.ring.cy,
50
51
  r: scene.ring.r
51
- }), scene.arc != null && hs("path", {
52
+ }), scene.verdictRing != null ? [hs("circle", {
53
+ class: scene.verdictRing.unfavorable.className,
54
+ cx: scene.verdictRing.unfavorable.cx,
55
+ cy: scene.verdictRing.unfavorable.cy,
56
+ r: scene.verdictRing.unfavorable.r
57
+ }), scene.verdictRing.favorable.map((arc) => hs("path", {
58
+ class: arc.className,
59
+ d: arc.d
60
+ }))] : null, scene.arc != null && hs("path", {
52
61
  class: scene.arc.className,
53
62
  d: scene.arc.d
54
63
  }), scene.ticks.map((tick) => hs("line", {
@@ -103,6 +112,7 @@ function dialSvg(options) {
103
112
  }
104
113
  var DialElement = class extends MeteoStationElement {
105
114
  static observedAttributes = [
115
+ "favorable-directions",
106
116
  "no-calm-word",
107
117
  "received-at-ms",
108
118
  "served-at",
@@ -113,10 +123,11 @@ var DialElement = class extends MeteoStationElement {
113
123
  ];
114
124
  render() {
115
125
  const station = this.requiredStation("meteo-dial");
116
- const { thresholds, unit, words } = this.display();
126
+ const { favorableDirections, thresholds, unit, words } = this.display();
117
127
  this.replaceChildren(dialSvg({
118
128
  station,
119
129
  thresholds,
130
+ favorableDirections,
120
131
  unit,
121
132
  words,
122
133
  size: numberAttribute(this.getAttribute("size")) ?? 160,
@@ -0,0 +1,14 @@
1
+ import { HistoryPoint } from "../../contract.js";
2
+ import "../../index.js";
3
+ import { MeteoStationElement } from "../lib/base.js";
4
+ //#region src/elements/elements/FavorableShareElement.d.ts
5
+ declare class FavorableShareElement extends MeteoStationElement {
6
+ #private;
7
+ static readonly observedAttributes: string[];
8
+ constructor();
9
+ get points(): HistoryPoint[] | undefined;
10
+ set points(value: HistoryPoint[] | undefined);
11
+ protected render(): void;
12
+ }
13
+ //#endregion
14
+ export { FavorableShareElement };
@@ -0,0 +1,47 @@
1
+ import { resolveStation } from "../../display.js";
2
+ import { favorableShareGate, favorableShareScene, favorableShareSource } from "../../scene/favorable-share.js";
3
+ import { MeteoStationElement } from "../lib/base.js";
4
+ import { h } from "../lib/h.js";
5
+ //#region src/elements/elements/FavorableShareElement.ts
6
+ var FavorableShareElement = class extends MeteoStationElement {
7
+ static observedAttributes = ["favorable-directions", "station-id"];
8
+ #points;
9
+ constructor() {
10
+ super();
11
+ for (const name of ["points"]) this.upgradeProperty(name);
12
+ }
13
+ get points() {
14
+ return this.#points;
15
+ }
16
+ set points(value) {
17
+ this.#points = value;
18
+ this.requestRender();
19
+ }
20
+ render() {
21
+ const station = this.station ?? (this.#points == null ? resolveStation(this.ambient()?.feed ?? null, this.getAttribute("station-id") ?? void 0) ?? void 0 : void 0);
22
+ const { favorableDirections, words } = this.display();
23
+ const gate = favorableShareGate(favorableShareSource(this.#points, station), favorableDirections, words);
24
+ if (gate.kind === "hidden") {
25
+ this.replaceChildren();
26
+ return;
27
+ }
28
+ if (gate.kind === "note") {
29
+ this.replaceChildren(h("div", {
30
+ class: gate.className,
31
+ role: "note"
32
+ }, gate.text));
33
+ return;
34
+ }
35
+ const scene = favorableShareScene({
36
+ share: gate.share,
37
+ stationName: station?.name,
38
+ words
39
+ });
40
+ this.replaceChildren(h("div", {
41
+ "aria-label": scene.ariaLabel,
42
+ class: scene.className
43
+ }, h("span", { class: scene.label.className }, scene.label.text), " ", h("span", { class: scene.value.className }, scene.value.text)));
44
+ }
45
+ };
46
+ //#endregion
47
+ export { FavorableShareElement };
@@ -0,0 +1,14 @@
1
+ import { RecentSummary } from "../../contract.js";
2
+ import "../../index.js";
3
+ import { MeteoStationElement } from "../lib/base.js";
4
+ //#region src/elements/elements/RecentSummariesElement.d.ts
5
+ declare class RecentSummariesElement extends MeteoStationElement {
6
+ #private;
7
+ static readonly observedAttributes: string[];
8
+ constructor();
9
+ get summaries(): RecentSummary[] | null | undefined;
10
+ set summaries(value: RecentSummary[] | null | undefined);
11
+ protected render(): void;
12
+ }
13
+ //#endregion
14
+ export { RecentSummariesElement };
@@ -0,0 +1,54 @@
1
+ import { resolveStation } from "../../display.js";
2
+ import { recentSummariesGate, recentSummariesScene } from "../../scene/recent-summaries.js";
3
+ import { MeteoStationElement } from "../lib/base.js";
4
+ import { h } from "../lib/h.js";
5
+ import { windArrowSvg } from "../lib/fragments.js";
6
+ //#region src/elements/elements/RecentSummariesElement.ts
7
+ var RecentSummariesElement = class extends MeteoStationElement {
8
+ static observedAttributes = [
9
+ "favorable-directions",
10
+ "station-id",
11
+ "unit"
12
+ ];
13
+ #summaries;
14
+ constructor() {
15
+ super();
16
+ for (const name of ["summaries"]) this.upgradeProperty(name);
17
+ }
18
+ get summaries() {
19
+ return this.#summaries;
20
+ }
21
+ set summaries(value) {
22
+ this.#summaries = value;
23
+ this.requestRender();
24
+ }
25
+ render() {
26
+ const station = this.station ?? (this.#summaries == null ? resolveStation(this.ambient()?.feed ?? null, this.getAttribute("station-id") ?? void 0) ?? void 0 : void 0);
27
+ const { favorableDirections, unit, words } = this.display();
28
+ const gate = recentSummariesGate(station, this.#summaries, words);
29
+ if (gate.kind === "hidden") {
30
+ this.replaceChildren();
31
+ return;
32
+ }
33
+ if (gate.kind === "note") {
34
+ this.replaceChildren(h("div", {
35
+ class: gate.className,
36
+ role: "note"
37
+ }, gate.text));
38
+ return;
39
+ }
40
+ const scene = recentSummariesScene({
41
+ favorableDirections,
42
+ stationName: station?.name,
43
+ summaries: gate.summaries,
44
+ unit,
45
+ words
46
+ });
47
+ this.replaceChildren(h("div", {
48
+ "aria-label": scene.ariaLabel,
49
+ class: scene.className
50
+ }, scene.panels.map((panel) => h("section", { class: panel.className }, h("h4", { class: panel.label.className }, panel.label.text), h("div", { class: "meteo-recent-summary-ghosts" }, panel.ghosts.map((ghost) => h("span", { class: ghost.className }, windArrowSvg(ghost.deg, 12)))), h("dl", { class: "meteo-recent-summary-stats" }, panel.stats.map((stat) => h("div", { class: stat.className }, h("dt", { class: "meteo-microlabel" }, stat.label), h("dd", null, stat.value))))))));
51
+ }
52
+ };
53
+ //#endregion
54
+ export { RecentSummariesElement };
@@ -3,6 +3,7 @@ import { StationFeed } from "../../contract.js";
3
3
  import "../../client/index.js";
4
4
  import { SpeedThresholds } from "../../derive.js";
5
5
  import { FormatTime, StationStringOverrides } from "../../strings.js";
6
+ import { FavorableDirection } from "../../instruments.js";
6
7
  import "../../index.js";
7
8
  import { MeteoElement } from "../lib/base.js";
8
9
  //#region src/elements/elements/StationFeedElement.d.ts
@@ -20,6 +21,8 @@ declare class StationFeedElement extends MeteoElement {
20
21
  set formatTime(value: FormatTime | undefined);
21
22
  get thresholds(): SpeedThresholds | undefined;
22
23
  set thresholds(value: SpeedThresholds | undefined);
24
+ get favorableDirections(): FavorableDirection[] | undefined;
25
+ set favorableDirections(value: FavorableDirection[] | undefined);
23
26
  get fetchInit(): RequestInit | undefined;
24
27
  set fetchInit(value: RequestInit | undefined);
25
28
  get error(): PollError | null;
@@ -1,7 +1,7 @@
1
1
  import { localeFormatTime } from "../../strings.js";
2
2
  import { createStationFeedStore, createStationStore } from "../../client/stores.js";
3
3
  import { STATION_FEED_CONTEXT_KEY } from "../lib/ambient.js";
4
- import { numberAttribute, parseThresholdsAttribute, unitAttribute } from "../lib/attributes.js";
4
+ import { numberAttribute, parseArcsAttribute, parseThresholdsAttribute, unitAttribute } from "../lib/attributes.js";
5
5
  import { provideContext } from "../lib/context.js";
6
6
  import { MeteoElement } from "../lib/base.js";
7
7
  //#region src/elements/elements/StationFeedElement.ts
@@ -11,6 +11,7 @@ var StationFeedElement = class extends MeteoElement {
11
11
  "locale",
12
12
  "paused",
13
13
  "poll-seconds",
14
+ "favorable-directions",
14
15
  "src",
15
16
  "station",
16
17
  "thresholds",
@@ -21,6 +22,7 @@ var StationFeedElement = class extends MeteoElement {
21
22
  #strings;
22
23
  #formatTime;
23
24
  #thresholds;
25
+ #favorableDirections;
24
26
  #fetchInit;
25
27
  #store = null;
26
28
  #storeKey = null;
@@ -36,6 +38,7 @@ var StationFeedElement = class extends MeteoElement {
36
38
  "strings",
37
39
  "formatTime",
38
40
  "thresholds",
41
+ "favorableDirections",
39
42
  "fetchInit"
40
43
  ]) this.upgradeProperty(name);
41
44
  }
@@ -48,7 +51,8 @@ var StationFeedElement = class extends MeteoElement {
48
51
  strings: this.#strings,
49
52
  unit: unitAttribute(this.getAttribute("unit")),
50
53
  formatTime: this.#formatTime ?? (locale != null ? localeFormatTime(locale) : void 0),
51
- thresholds: this.#thresholds ?? parseThresholdsAttribute(this.getAttribute("thresholds")) ?? void 0
54
+ thresholds: this.#thresholds ?? parseThresholdsAttribute(this.getAttribute("thresholds")) ?? void 0,
55
+ favorableDirections: this.#favorableDirections ?? parseArcsAttribute(this.getAttribute("favorable-directions")) ?? void 0
52
56
  };
53
57
  }
54
58
  #notify() {
@@ -89,6 +93,13 @@ var StationFeedElement = class extends MeteoElement {
89
93
  this.#thresholds = value;
90
94
  this.#notify();
91
95
  }
96
+ get favorableDirections() {
97
+ return this.#favorableDirections;
98
+ }
99
+ set favorableDirections(value) {
100
+ this.#favorableDirections = value;
101
+ this.#notify();
102
+ }
92
103
  get fetchInit() {
93
104
  return this.#fetchInit;
94
105
  }
@@ -13,6 +13,8 @@ function readoutSpan(parts) {
13
13
  var WindHistoryChartElement = class extends MeteoStationElement {
14
14
  static observedAttributes = [
15
15
  "compare-offset-days",
16
+ "favorable-directions",
17
+ "night-shading",
16
18
  "plot-height",
17
19
  "station-id",
18
20
  "thresholds",
@@ -33,7 +35,7 @@ var WindHistoryChartElement = class extends MeteoStationElement {
33
35
  }
34
36
  render() {
35
37
  const station = this.requiredStation("meteo-wind-history-chart");
36
- const { formatTime, thresholds, unit, words } = this.display();
38
+ const { favorableDirections, formatTime, thresholds, unit, words } = this.display();
37
39
  const gate = windChartGate(station, words);
38
40
  if (gate.kind !== "draw") {
39
41
  this.#observer?.disconnect();
@@ -49,7 +51,10 @@ var WindHistoryChartElement = class extends MeteoStationElement {
49
51
  this.replaceChildren(wrap);
50
52
  this.#observe(wrap);
51
53
  if (this.#width == null) return;
52
- this.#buildChart(wrap, gate.history, thresholds, unit, words, formatTime, this.#width, station.name);
54
+ this.#buildChart(wrap, gate.history, thresholds, favorableDirections, unit, words, formatTime, this.#width, station.name, this.hasAttribute("night-shading") ? {
55
+ latitude: station.latitude,
56
+ longitude: station.longitude
57
+ } : null);
53
58
  }
54
59
  #observe(wrap) {
55
60
  this.#observer?.disconnect();
@@ -67,10 +72,12 @@ var WindHistoryChartElement = class extends MeteoStationElement {
67
72
  });
68
73
  this.#observer.observe(wrap);
69
74
  }
70
- #buildChart(wrap, history, thresholds, unit, words, formatTime, width, stationName) {
75
+ #buildChart(wrap, history, thresholds, favorableDirections, unit, words, formatTime, width, stationName, night) {
71
76
  const scene = windChartScene({
72
77
  compareOffsetDays: numberAttribute(this.getAttribute("compare-offset-days")),
78
+ favorableDirections,
73
79
  formatTime,
80
+ night,
74
81
  hatchId: `meteo-hatch-e${++hatchCounter}`,
75
82
  history,
76
83
  plotHeight: numberAttribute(this.getAttribute("plot-height")),
@@ -132,6 +139,12 @@ var WindHistoryChartElement = class extends MeteoStationElement {
132
139
  width: zone.width,
133
140
  x: zone.x,
134
141
  y: zone.y
142
+ })), scene.nightRects.map((rect) => hs("rect", {
143
+ class: rect.className,
144
+ height: rect.height,
145
+ width: rect.width,
146
+ x: rect.x,
147
+ y: rect.y
135
148
  })), scene.grid.map(({ line, label }) => hs("g", null, hs("line", {
136
149
  class: line.className,
137
150
  x1: line.x1,
@@ -201,22 +214,22 @@ var WindHistoryChartElement = class extends MeteoStationElement {
201
214
  }, vane.mark.text.text) : hs("path", {
202
215
  class: vane.mark.className,
203
216
  d: vane.mark.d
204
- })), scene.vanes.map((vane) => hs("text", {
217
+ })), scene.vanes.flatMap((vane) => vane.label == null ? [] : [hs("text", {
205
218
  class: vane.label.className,
206
219
  "text-anchor": vane.label.anchor,
207
220
  x: vane.label.x,
208
221
  y: vane.label.y
209
- }, vane.label.text)), hs("text", {
222
+ }, vane.label.text)]), hs("text", {
210
223
  class: scene.rowLabels.avg.className,
211
224
  "text-anchor": scene.rowLabels.avg.anchor,
212
225
  x: scene.rowLabels.avg.x,
213
226
  y: scene.rowLabels.avg.y
214
- }, scene.rowLabels.avg.text), scene.vanes.map((vane) => hs("text", {
227
+ }, scene.rowLabels.avg.text), scene.vanes.flatMap((vane) => vane.value == null ? [] : [hs("text", {
215
228
  class: vane.value.className,
216
229
  "text-anchor": vane.value.anchor,
217
230
  x: vane.value.x,
218
231
  y: vane.value.y
219
- }, vane.value.text)), scene.ticks.map((tick) => hs("text", {
232
+ }, vane.value.text)]), scene.ticks.map((tick) => hs("text", {
220
233
  class: tick.className,
221
234
  "text-anchor": tick.anchor,
222
235
  x: tick.x,
@@ -1,7 +1,7 @@
1
1
  import { HistoryPoint } from "../../contract.js";
2
- import { FavorableDirection } from "../../instruments.js";
3
2
  import "../../index.js";
4
3
  import { MeteoStationElement } from "../lib/base.js";
4
+ import "../../scene/index.js";
5
5
  //#region src/elements/elements/WindRoseElement.d.ts
6
6
  declare class WindRoseElement extends MeteoStationElement {
7
7
  #private;
@@ -9,8 +9,6 @@ declare class WindRoseElement extends MeteoStationElement {
9
9
  constructor();
10
10
  get points(): HistoryPoint[] | undefined;
11
11
  set points(value: HistoryPoint[] | undefined);
12
- get favorableDirections(): FavorableDirection[] | undefined;
13
- set favorableDirections(value: FavorableDirection[] | undefined);
14
12
  protected render(): void;
15
13
  }
16
14
  //#endregion
@@ -6,15 +6,15 @@ import { h, hs } from "../lib/h.js";
6
6
  //#region src/elements/elements/WindRoseElement.ts
7
7
  var WindRoseElement = class extends MeteoStationElement {
8
8
  static observedAttributes = [
9
+ "favorable-directions",
9
10
  "sector-count",
10
11
  "station-id",
11
12
  "thresholds"
12
13
  ];
13
14
  #points;
14
- #favorableDirections;
15
15
  constructor() {
16
16
  super();
17
- for (const name of ["points", "favorableDirections"]) this.upgradeProperty(name);
17
+ for (const name of ["points"]) this.upgradeProperty(name);
18
18
  }
19
19
  get points() {
20
20
  return this.#points;
@@ -23,16 +23,9 @@ var WindRoseElement = class extends MeteoStationElement {
23
23
  this.#points = value;
24
24
  this.requestRender();
25
25
  }
26
- get favorableDirections() {
27
- return this.#favorableDirections;
28
- }
29
- set favorableDirections(value) {
30
- this.#favorableDirections = value;
31
- this.requestRender();
32
- }
33
26
  render() {
34
27
  const station = this.station ?? (this.#points == null ? resolveStation(this.ambient()?.feed ?? null, this.getAttribute("station-id") ?? void 0) ?? void 0 : void 0);
35
- const { thresholds, words } = this.display();
28
+ const { favorableDirections, thresholds, words } = this.display();
36
29
  const source = windRoseSource(this.#points, station);
37
30
  const gate = windRoseGate(source, words);
38
31
  if (gate.kind === "note") {
@@ -43,64 +36,69 @@ var WindRoseElement = class extends MeteoStationElement {
43
36
  return;
44
37
  }
45
38
  const scene = windRoseScene({
46
- favorableDirections: this.#favorableDirections,
39
+ favorableDirections,
47
40
  sectorCount: numberAttribute(this.getAttribute("sector-count")) ?? 16,
48
41
  source,
49
42
  stationName: station?.name,
50
43
  thresholds,
51
44
  words
52
45
  });
53
- this.replaceChildren(h("div", { class: scene.className }, hs("svg", {
54
- "aria-label": scene.svg.ariaLabel,
55
- class: scene.svg.className,
56
- height: scene.svg.height,
57
- role: "img",
58
- viewBox: scene.svg.viewBox,
59
- width: scene.svg.width
60
- }, scene.gridCircles.map((circle) => hs("circle", {
61
- class: circle.className,
62
- cx: circle.cx,
63
- cy: circle.cy,
64
- r: circle.r
65
- })), scene.ring != null ? [hs("circle", {
66
- class: scene.ring.unfavorable.className,
67
- cx: scene.ring.unfavorable.cx,
68
- cy: scene.ring.unfavorable.cy,
69
- r: scene.ring.unfavorable.r
70
- }), scene.ring.favorable.map((arc) => hs("path", {
71
- class: arc.className,
72
- d: arc.d
73
- }))] : null, scene.ticks.map((tick) => hs("line", {
74
- class: tick.className,
75
- x1: tick.x1,
76
- x2: tick.x2,
77
- y1: tick.y1,
78
- y2: tick.y2
79
- })), scene.letters.map((letter) => hs("text", {
80
- class: letter.className,
81
- "text-anchor": letter.anchor,
82
- x: letter.x,
83
- y: letter.y
84
- }, letter.text)), scene.petals.map((petal) => hs("path", {
85
- class: petal.className,
86
- d: petal.d
87
- })), scene.ringLabel != null && hs("text", {
88
- class: scene.ringLabel.className,
89
- "text-anchor": scene.ringLabel.anchor,
90
- x: scene.ringLabel.x,
91
- y: scene.ringLabel.y
92
- }, scene.ringLabel.text), hs("circle", {
93
- class: scene.hub.className,
94
- cx: scene.hub.cx,
95
- cy: scene.hub.cy,
96
- r: scene.hub.r
97
- }), hs("circle", {
98
- class: scene.dot.className,
99
- cx: scene.dot.cx,
100
- cy: scene.dot.cy,
101
- r: scene.dot.r
102
- })), scene.calmCaption != null ? h("p", { class: scene.calmCaption.className }, scene.calmCaption.text) : null));
46
+ this.replaceChildren(windRoseSceneDom(scene));
103
47
  }
104
48
  };
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
+ }
105
103
  //#endregion
106
- export { WindRoseElement };
104
+ export { WindRoseElement, windRoseSceneDom };
@@ -48,11 +48,11 @@ var PressureElement = class extends MeteoStationElement {
48
48
  }
49
49
  };
50
50
  var DirectionElement = class extends MeteoStationElement {
51
- static observedAttributes = ["station-id"];
51
+ static observedAttributes = ["favorable-directions", "station-id"];
52
52
  render() {
53
53
  const station = this.requiredStation("meteo-direction");
54
- const { words } = this.display();
55
- const scene = directionAtomScene(station, words);
54
+ const { favorableDirections, words } = this.display();
55
+ const scene = directionAtomScene(station, words, favorableDirections);
56
56
  if (scene.cell == null) {
57
57
  this.replaceChildren(h("span", { class: scene.className }, scene.dashText));
58
58
  return;
@@ -1,9 +1,15 @@
1
1
  import { AmbientStationFeed } from "./lib/ambient.js";
2
2
  import { BandChipElement, DirectionElement, GustElement, LullElement, PressureElement, SpeedElement, TemperatureElement, UpdatedAtElement } from "./elements/atoms.js";
3
+ import { AirExtremesElement } from "./elements/AirExtremesElement.js";
3
4
  import { AirMatrixElement } from "./elements/AirMatrixElement.js";
5
+ import { ClimatologyDailyPatternElement } from "./elements/ClimatologyDailyPatternElement.js";
6
+ import { CompassFanElement } from "./elements/CompassFanElement.js";
7
+ import { RecentSummariesElement } from "./elements/RecentSummariesElement.js";
8
+ import { ClimatologyRoseElement } from "./elements/ClimatologyRoseElement.js";
4
9
  import { CurrentConditionsElement } from "./elements/CurrentConditionsElement.js";
5
10
  import { DailyPatternElement } from "./elements/DailyPatternElement.js";
6
11
  import { DialElement } from "./elements/DialElement.js";
12
+ import { FavorableShareElement } from "./elements/FavorableShareElement.js";
7
13
  import { FreshnessBadgeElement } from "./elements/FreshnessBadgeElement.js";
8
14
  import { SparklineElement } from "./elements/SparklineElement.js";
9
15
  import { StationFeedElement } from "./elements/StationFeedElement.js";
@@ -18,16 +24,22 @@ import { StationCardChartElement, StationCardElement, StationCardHeaderElement,
18
24
  declare const meteoElementTags: {
19
25
  readonly "meteo-station-feed": typeof StationFeedElement;
20
26
  readonly "meteo-station-card": typeof StationCardElement;
27
+ readonly "meteo-air-extremes": typeof AirExtremesElement;
21
28
  readonly "meteo-air-matrix": typeof AirMatrixElement;
22
29
  readonly "meteo-band-chip": typeof BandChipElement;
30
+ readonly "meteo-compass-fan": typeof CompassFanElement;
31
+ readonly "meteo-climatology-daily-pattern": typeof ClimatologyDailyPatternElement;
32
+ readonly "meteo-climatology-rose": typeof ClimatologyRoseElement;
23
33
  readonly "meteo-current-conditions": typeof CurrentConditionsElement;
24
34
  readonly "meteo-daily-pattern": typeof DailyPatternElement;
25
35
  readonly "meteo-dial": typeof DialElement;
26
36
  readonly "meteo-direction": typeof DirectionElement;
37
+ readonly "meteo-favorable-share": typeof FavorableShareElement;
27
38
  readonly "meteo-freshness-badge": typeof FreshnessBadgeElement;
28
39
  readonly "meteo-gust": typeof GustElement;
29
40
  readonly "meteo-lull": typeof LullElement;
30
41
  readonly "meteo-pressure": typeof PressureElement;
42
+ readonly "meteo-recent-summaries": typeof RecentSummariesElement;
31
43
  readonly "meteo-sparkline": typeof SparklineElement;
32
44
  readonly "meteo-speed": typeof SpeedElement;
33
45
  readonly "meteo-station-strip": typeof StationStripElement;
@@ -45,4 +57,4 @@ declare const meteoElementTags: {
45
57
  };
46
58
  declare function defineMeteoElements(registry?: CustomElementRegistry): void;
47
59
  //#endregion
48
- export { AirMatrixElement, type AmbientStationFeed, BandChipElement, CurrentConditionsElement, DailyPatternElement, DialElement, DirectionElement, FreshnessBadgeElement, GustElement, LullElement, PressureElement, SparklineElement, SpeedElement, StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement, StationFeedElement, type StationMetaRenderer, StationStripElement, StationTableElement, TemperatureElement, TrendChartElement, UpdatedAtElement, WindArrowElement, WindHistoryChartElement, WindRoseElement, defineMeteoElements, meteoElementTags };
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 };