@azohra/meteo.station 0.3.0 → 0.4.2

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 (139) hide show
  1. package/README.md +2 -2
  2. package/dist/client/climatology.d.ts +27 -0
  3. package/dist/client/climatology.js +83 -0
  4. package/dist/client/history.d.ts +53 -0
  5. package/dist/client/history.js +114 -0
  6. package/dist/client/index.d.ts +3 -1
  7. package/dist/client/index.js +3 -1
  8. package/dist/client/live.js +15 -0
  9. package/dist/climatology.d.ts +61 -0
  10. package/dist/climatology.js +208 -0
  11. package/dist/connectivity.d.ts +46 -0
  12. package/dist/connectivity.js +44 -0
  13. package/dist/contract-climatology.d.ts +69 -0
  14. package/dist/contract-climatology.js +50 -0
  15. package/dist/contract.d.ts +234 -1
  16. package/dist/contract.js +52 -4
  17. package/dist/derive.d.ts +23 -1
  18. package/dist/derive.js +43 -4
  19. package/dist/display.d.ts +4 -0
  20. package/dist/display.js +2 -1
  21. package/dist/elements/elements/AirExtremesElement.d.ts +8 -0
  22. package/dist/elements/elements/AirExtremesElement.js +33 -0
  23. package/dist/elements/elements/ClimatologyDailyPatternElement.d.ts +15 -0
  24. package/dist/elements/elements/ClimatologyDailyPatternElement.js +84 -0
  25. package/dist/elements/elements/ClimatologyRoseElement.d.ts +14 -0
  26. package/dist/elements/elements/ClimatologyRoseElement.js +51 -0
  27. package/dist/elements/elements/CompassFanElement.d.ts +14 -0
  28. package/dist/elements/elements/CompassFanElement.js +92 -0
  29. package/dist/elements/elements/DailyPatternElement.d.ts +1 -0
  30. package/dist/elements/elements/DailyPatternElement.js +20 -12
  31. package/dist/elements/elements/DialElement.js +14 -3
  32. package/dist/elements/elements/FavorableShareElement.d.ts +14 -0
  33. package/dist/elements/elements/FavorableShareElement.js +47 -0
  34. package/dist/elements/elements/RecentSummariesElement.d.ts +14 -0
  35. package/dist/elements/elements/RecentSummariesElement.js +54 -0
  36. package/dist/elements/elements/StationFeedElement.d.ts +3 -0
  37. package/dist/elements/elements/StationFeedElement.js +13 -2
  38. package/dist/elements/elements/WindHistoryChartElement.js +16 -3
  39. package/dist/elements/elements/WindRoseElement.d.ts +1 -3
  40. package/dist/elements/elements/WindRoseElement.js +60 -62
  41. package/dist/elements/elements/atoms.js +3 -3
  42. package/dist/elements/index.d.ts +13 -1
  43. package/dist/elements/index.js +15 -3
  44. package/dist/elements/lib/ambient.d.ts +2 -0
  45. package/dist/elements/lib/attributes.js +24 -1
  46. package/dist/elements/lib/base.d.ts +3 -0
  47. package/dist/elements/lib/base.js +14 -2
  48. package/dist/endpoints.d.ts +7 -1
  49. package/dist/endpoints.js +13 -1
  50. package/dist/geometry.d.ts +22 -3
  51. package/dist/geometry.js +41 -5
  52. package/dist/index.d.ts +9 -6
  53. package/dist/index.js +9 -6
  54. package/dist/instruments.d.ts +7 -5
  55. package/dist/instruments.js +20 -7
  56. package/dist/merge-current.js +2 -1
  57. package/dist/react/components/AirExtremes.d.ts +16 -0
  58. package/dist/react/components/AirExtremes.js +38 -0
  59. package/dist/react/components/ClimatologyDailyPattern.d.ts +20 -0
  60. package/dist/react/components/ClimatologyDailyPattern.js +59 -0
  61. package/dist/react/components/ClimatologyRose.d.ts +18 -0
  62. package/dist/react/components/ClimatologyRose.js +45 -0
  63. package/dist/react/components/CompassFan.d.ts +17 -0
  64. package/dist/react/components/CompassFan.js +93 -0
  65. package/dist/react/components/DailyPattern.d.ts +4 -1
  66. package/dist/react/components/DailyPattern.js +13 -6
  67. package/dist/react/components/Dial.d.ts +3 -1
  68. package/dist/react/components/Dial.js +13 -2
  69. package/dist/react/components/FavorableShare.d.ts +14 -0
  70. package/dist/react/components/FavorableShare.js +43 -0
  71. package/dist/react/components/RecentSummaries.d.ts +19 -0
  72. package/dist/react/components/RecentSummaries.js +65 -0
  73. package/dist/react/components/StationFeedProvider.d.ts +4 -1
  74. package/dist/react/components/StationFeedProvider.js +5 -3
  75. package/dist/react/components/WindHistoryChart.d.ts +6 -1
  76. package/dist/react/components/WindHistoryChart.js +18 -3
  77. package/dist/react/components/WindRose.d.ts +4 -2
  78. package/dist/react/components/WindRose.js +80 -71
  79. package/dist/react/components/WindSampleStrip.d.ts +3 -1
  80. package/dist/react/components/WindSampleStrip.js +6 -3
  81. package/dist/react/components/atoms.d.ts +4 -1
  82. package/dist/react/components/atoms.js +6 -3
  83. package/dist/react/hooks/useStationClimatology.d.ts +18 -0
  84. package/dist/react/hooks/useStationClimatology.js +25 -0
  85. package/dist/react/index.d.ts +10 -3
  86. package/dist/react/index.js +9 -2
  87. package/dist/scene/air-extremes.d.ts +2 -0
  88. package/dist/scene/air-extremes.js +42 -0
  89. package/dist/scene/atoms.d.ts +2 -1
  90. package/dist/scene/atoms.js +6 -4
  91. package/dist/scene/climatology-pattern.d.ts +6 -0
  92. package/dist/scene/climatology-pattern.js +35 -0
  93. package/dist/scene/climatology-rose.d.ts +5 -0
  94. package/dist/scene/climatology-rose.js +49 -0
  95. package/dist/scene/compass-fan.d.ts +3 -0
  96. package/dist/scene/compass-fan.js +115 -0
  97. package/dist/scene/daily-pattern.d.ts +1 -0
  98. package/dist/scene/daily-pattern.js +20 -6
  99. package/dist/scene/dial.d.ts +1 -0
  100. package/dist/scene/dial.js +16 -3
  101. package/dist/scene/favorable-share.d.ts +3 -0
  102. package/dist/scene/favorable-share.js +41 -0
  103. package/dist/scene/index.d.ts +9 -3
  104. package/dist/scene/recent-summaries.d.ts +4 -0
  105. package/dist/scene/recent-summaries.js +75 -0
  106. package/dist/scene/rose.d.ts +2 -1
  107. package/dist/scene/rose.js +18 -3
  108. package/dist/scene/sample-strip.d.ts +1 -0
  109. package/dist/scene/sample-strip.js +1 -1
  110. package/dist/scene/wind-history.d.ts +1 -0
  111. package/dist/scene/wind-history.js +4 -3
  112. package/dist/scene/wind-plot.d.ts +1 -0
  113. package/dist/scene/wind-plot.js +30 -3
  114. package/dist/server/adapter.d.ts +2 -1
  115. package/dist/server/adapter.js +2 -1
  116. package/dist/server/adapters/windnerd-climatology.d.ts +33 -0
  117. package/dist/server/adapters/windnerd-climatology.js +81 -0
  118. package/dist/server/adapters/windnerd-live.js +21 -13
  119. package/dist/server/adapters/windnerd.d.ts +31 -4
  120. package/dist/server/adapters/windnerd.js +197 -19
  121. package/dist/server/feed.d.ts +44 -2
  122. package/dist/server/feed.js +63 -2
  123. package/dist/server/handler.d.ts +11 -1
  124. package/dist/server/handler.js +83 -2
  125. package/dist/server/hologram.d.ts +22 -0
  126. package/dist/server/hologram.js +113 -0
  127. package/dist/server/index.d.ts +5 -3
  128. package/dist/server/index.js +5 -3
  129. package/dist/strings.d.ts +12 -0
  130. package/dist/strings.js +12 -0
  131. package/package.json +2 -2
  132. package/schema/example-climatology.json +86 -0
  133. package/schema/example-history.json +38 -0
  134. package/schema/stationclimatology.schema.json +195 -0
  135. package/schema/stationcurrent.schema.json +173 -0
  136. package/schema/stationfeed.schema.json +173 -0
  137. package/schema/stationhistory.schema.json +186 -0
  138. package/schema/stationlive.schema.json +202 -0
  139. package/styles.css +215 -0
@@ -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,
@@ -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 };
@@ -1,8 +1,15 @@
1
1
  import { BandChipElement, DirectionElement, GustElement, LullElement, PressureElement, SpeedElement, TemperatureElement, UpdatedAtElement } from "./elements/atoms.js";
2
+ import { AirExtremesElement } from "./elements/AirExtremesElement.js";
2
3
  import { AirMatrixElement } from "./elements/AirMatrixElement.js";
4
+ import { DailyPatternElement } from "./elements/DailyPatternElement.js";
5
+ import { ClimatologyDailyPatternElement } from "./elements/ClimatologyDailyPatternElement.js";
6
+ import { CompassFanElement } from "./elements/CompassFanElement.js";
7
+ import { RecentSummariesElement } from "./elements/RecentSummariesElement.js";
8
+ import { WindRoseElement } from "./elements/WindRoseElement.js";
9
+ import { ClimatologyRoseElement } from "./elements/ClimatologyRoseElement.js";
3
10
  import { DialElement } from "./elements/DialElement.js";
4
11
  import { CurrentConditionsElement } from "./elements/CurrentConditionsElement.js";
5
- import { DailyPatternElement } from "./elements/DailyPatternElement.js";
12
+ import { FavorableShareElement } from "./elements/FavorableShareElement.js";
6
13
  import { FreshnessBadgeElement } from "./elements/FreshnessBadgeElement.js";
7
14
  import { SparklineElement } from "./elements/SparklineElement.js";
8
15
  import { StationFeedElement } from "./elements/StationFeedElement.js";
@@ -11,22 +18,27 @@ import { StationTableElement } from "./elements/StationTableElement.js";
11
18
  import { TrendChartElement } from "./elements/TrendChartElement.js";
12
19
  import { WindArrowElement } from "./elements/WindArrowElement.js";
13
20
  import { WindHistoryChartElement } from "./elements/WindHistoryChartElement.js";
14
- import { WindRoseElement } from "./elements/WindRoseElement.js";
15
21
  import { StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement } from "./elements/StationCardElement.js";
16
22
  //#region src/elements/index.ts
17
23
  const meteoElementTags = {
18
24
  "meteo-station-feed": StationFeedElement,
19
25
  "meteo-station-card": StationCardElement,
26
+ "meteo-air-extremes": AirExtremesElement,
20
27
  "meteo-air-matrix": AirMatrixElement,
21
28
  "meteo-band-chip": BandChipElement,
29
+ "meteo-compass-fan": CompassFanElement,
30
+ "meteo-climatology-daily-pattern": ClimatologyDailyPatternElement,
31
+ "meteo-climatology-rose": ClimatologyRoseElement,
22
32
  "meteo-current-conditions": CurrentConditionsElement,
23
33
  "meteo-daily-pattern": DailyPatternElement,
24
34
  "meteo-dial": DialElement,
25
35
  "meteo-direction": DirectionElement,
36
+ "meteo-favorable-share": FavorableShareElement,
26
37
  "meteo-freshness-badge": FreshnessBadgeElement,
27
38
  "meteo-gust": GustElement,
28
39
  "meteo-lull": LullElement,
29
40
  "meteo-pressure": PressureElement,
41
+ "meteo-recent-summaries": RecentSummariesElement,
30
42
  "meteo-sparkline": SparklineElement,
31
43
  "meteo-speed": SpeedElement,
32
44
  "meteo-station-strip": StationStripElement,
@@ -54,4 +66,4 @@ function defineMeteoElements(registry = customElements) {
54
66
  }
55
67
  }
56
68
  //#endregion
57
- export { AirMatrixElement, BandChipElement, CurrentConditionsElement, DailyPatternElement, DialElement, DirectionElement, FreshnessBadgeElement, GustElement, LullElement, PressureElement, SparklineElement, SpeedElement, StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement, StationFeedElement, StationStripElement, StationTableElement, TemperatureElement, TrendChartElement, UpdatedAtElement, WindArrowElement, WindHistoryChartElement, WindRoseElement, defineMeteoElements, meteoElementTags };
69
+ 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 };
@@ -1,6 +1,7 @@
1
1
  import { StationFeed } from "../../contract.js";
2
2
  import { SpeedThresholds, SpeedUnit } from "../../derive.js";
3
3
  import { FormatTime, StationStringOverrides } from "../../strings.js";
4
+ import { FavorableDirection } from "../../instruments.js";
4
5
  import "../../index.js";
5
6
  //#region src/elements/lib/ambient.d.ts
6
7
  type AmbientStationFeed = {
@@ -10,6 +11,7 @@ type AmbientStationFeed = {
10
11
  unit: SpeedUnit | undefined;
11
12
  formatTime: FormatTime | undefined;
12
13
  thresholds: SpeedThresholds | undefined;
14
+ favorableDirections: FavorableDirection[] | undefined;
13
15
  };
14
16
  //#endregion
15
17
  export { AmbientStationFeed };
@@ -17,5 +17,28 @@ function parseThresholdsAttribute(value) {
17
17
  } catch {}
18
18
  console.warn(`meteo: invalid thresholds attribute ${JSON.stringify(value)} — expected '{"unit":"kmh","values":[12,20,28]}' or "none"; treating as absent.`);
19
19
  }
20
+ function parseIntegerListAttribute(value, name, minimum, maximum) {
21
+ if (value == null || value.trim() === "") return void 0;
22
+ try {
23
+ const parsed = JSON.parse(value);
24
+ if (Array.isArray(parsed) && parsed.every((entry) => typeof entry === "number" && Number.isInteger(entry) && entry >= minimum && entry <= maximum)) return parsed;
25
+ } catch {}
26
+ console.warn(`meteo: invalid ${name} attribute ${JSON.stringify(value)} — expected a JSON list of integers in [${minimum}, ${maximum}]; treating as absent.`);
27
+ }
28
+ function parseMonthsAttribute(value) {
29
+ return parseIntegerListAttribute(value, "months", 1, 12);
30
+ }
31
+ function parseSlotsAttribute(value) {
32
+ return parseIntegerListAttribute(value, "slots", 0, 1439);
33
+ }
34
+ function parseArcsAttribute(value) {
35
+ if (value == null) return void 0;
36
+ if (value.trim() === "none") return null;
37
+ try {
38
+ const parsed = JSON.parse(value);
39
+ if (Array.isArray(parsed) && parsed.every((arc) => typeof arc === "object" && arc != null && typeof arc.fromDeg === "number" && Number.isFinite(arc.fromDeg) && typeof arc.toDeg === "number" && Number.isFinite(arc.toDeg))) return parsed;
40
+ } catch {}
41
+ console.warn(`meteo: invalid favorable-directions attribute ${JSON.stringify(value)} — expected '[{"fromDeg":260,"toDeg":340}]' or "none"; treating as absent.`);
42
+ }
20
43
  //#endregion
21
- export { numberAttribute, parseThresholdsAttribute, unitAttribute };
44
+ export { numberAttribute, parseArcsAttribute, parseMonthsAttribute, parseSlotsAttribute, parseThresholdsAttribute, unitAttribute };