@azohra/meteo.station 0.3.1 → 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.
- package/dist/client/climatology.d.ts +27 -0
- package/dist/client/climatology.js +83 -0
- package/dist/client/history.d.ts +53 -0
- package/dist/client/history.js +114 -0
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.js +3 -1
- package/dist/client/live.js +15 -0
- package/dist/climatology.d.ts +61 -0
- package/dist/climatology.js +208 -0
- package/dist/contract-climatology.d.ts +69 -0
- package/dist/contract-climatology.js +50 -0
- package/dist/contract.d.ts +234 -1
- package/dist/contract.js +52 -4
- package/dist/derive.d.ts +23 -1
- package/dist/derive.js +43 -4
- package/dist/display.d.ts +4 -0
- package/dist/display.js +2 -1
- package/dist/elements/elements/AirExtremesElement.d.ts +8 -0
- package/dist/elements/elements/AirExtremesElement.js +33 -0
- package/dist/elements/elements/ClimatologyDailyPatternElement.d.ts +15 -0
- package/dist/elements/elements/ClimatologyDailyPatternElement.js +84 -0
- package/dist/elements/elements/ClimatologyRoseElement.d.ts +14 -0
- package/dist/elements/elements/ClimatologyRoseElement.js +51 -0
- package/dist/elements/elements/CompassFanElement.d.ts +14 -0
- package/dist/elements/elements/CompassFanElement.js +92 -0
- package/dist/elements/elements/DailyPatternElement.d.ts +1 -0
- package/dist/elements/elements/DailyPatternElement.js +20 -12
- package/dist/elements/elements/DialElement.js +14 -3
- package/dist/elements/elements/FavorableShareElement.d.ts +14 -0
- package/dist/elements/elements/FavorableShareElement.js +47 -0
- package/dist/elements/elements/RecentSummariesElement.d.ts +14 -0
- package/dist/elements/elements/RecentSummariesElement.js +54 -0
- package/dist/elements/elements/StationFeedElement.d.ts +3 -0
- package/dist/elements/elements/StationFeedElement.js +13 -2
- package/dist/elements/elements/WindHistoryChartElement.js +16 -3
- package/dist/elements/elements/WindRoseElement.d.ts +1 -3
- package/dist/elements/elements/WindRoseElement.js +60 -62
- package/dist/elements/elements/atoms.js +3 -3
- package/dist/elements/index.d.ts +13 -1
- package/dist/elements/index.js +15 -3
- package/dist/elements/lib/ambient.d.ts +2 -0
- package/dist/elements/lib/attributes.js +24 -1
- package/dist/elements/lib/base.d.ts +3 -0
- package/dist/elements/lib/base.js +14 -2
- package/dist/endpoints.d.ts +7 -1
- package/dist/endpoints.js +13 -1
- package/dist/geometry.d.ts +22 -3
- package/dist/geometry.js +41 -5
- package/dist/index.d.ts +8 -6
- package/dist/index.js +8 -6
- package/dist/instruments.d.ts +7 -5
- package/dist/instruments.js +20 -7
- package/dist/merge-current.js +2 -1
- package/dist/react/components/AirExtremes.d.ts +16 -0
- package/dist/react/components/AirExtremes.js +38 -0
- package/dist/react/components/ClimatologyDailyPattern.d.ts +20 -0
- package/dist/react/components/ClimatologyDailyPattern.js +59 -0
- package/dist/react/components/ClimatologyRose.d.ts +18 -0
- package/dist/react/components/ClimatologyRose.js +45 -0
- package/dist/react/components/CompassFan.d.ts +17 -0
- package/dist/react/components/CompassFan.js +93 -0
- package/dist/react/components/DailyPattern.d.ts +4 -1
- package/dist/react/components/DailyPattern.js +13 -6
- package/dist/react/components/Dial.d.ts +3 -1
- package/dist/react/components/Dial.js +13 -2
- package/dist/react/components/FavorableShare.d.ts +14 -0
- package/dist/react/components/FavorableShare.js +43 -0
- package/dist/react/components/RecentSummaries.d.ts +19 -0
- package/dist/react/components/RecentSummaries.js +65 -0
- package/dist/react/components/StationFeedProvider.d.ts +4 -1
- package/dist/react/components/StationFeedProvider.js +5 -3
- package/dist/react/components/WindHistoryChart.d.ts +6 -1
- package/dist/react/components/WindHistoryChart.js +18 -3
- package/dist/react/components/WindRose.d.ts +4 -2
- package/dist/react/components/WindRose.js +80 -71
- package/dist/react/components/WindSampleStrip.d.ts +3 -1
- package/dist/react/components/WindSampleStrip.js +6 -3
- package/dist/react/components/atoms.d.ts +4 -1
- package/dist/react/components/atoms.js +6 -3
- package/dist/react/hooks/useStationClimatology.d.ts +18 -0
- package/dist/react/hooks/useStationClimatology.js +25 -0
- package/dist/react/index.d.ts +10 -3
- package/dist/react/index.js +9 -2
- package/dist/scene/air-extremes.d.ts +2 -0
- package/dist/scene/air-extremes.js +42 -0
- package/dist/scene/atoms.d.ts +2 -1
- package/dist/scene/atoms.js +6 -4
- package/dist/scene/climatology-pattern.d.ts +6 -0
- package/dist/scene/climatology-pattern.js +35 -0
- package/dist/scene/climatology-rose.d.ts +5 -0
- package/dist/scene/climatology-rose.js +49 -0
- package/dist/scene/compass-fan.d.ts +3 -0
- package/dist/scene/compass-fan.js +115 -0
- package/dist/scene/daily-pattern.d.ts +1 -0
- package/dist/scene/daily-pattern.js +20 -6
- package/dist/scene/dial.d.ts +1 -0
- package/dist/scene/dial.js +16 -3
- package/dist/scene/favorable-share.d.ts +3 -0
- package/dist/scene/favorable-share.js +41 -0
- package/dist/scene/index.d.ts +9 -3
- package/dist/scene/recent-summaries.d.ts +4 -0
- package/dist/scene/recent-summaries.js +75 -0
- package/dist/scene/rose.d.ts +2 -1
- package/dist/scene/rose.js +18 -3
- package/dist/scene/sample-strip.d.ts +1 -0
- package/dist/scene/sample-strip.js +1 -1
- package/dist/scene/wind-history.d.ts +1 -0
- package/dist/scene/wind-history.js +4 -3
- package/dist/scene/wind-plot.d.ts +1 -0
- package/dist/scene/wind-plot.js +30 -3
- package/dist/server/adapter.d.ts +2 -1
- package/dist/server/adapter.js +2 -1
- package/dist/server/adapters/windnerd-climatology.d.ts +33 -0
- package/dist/server/adapters/windnerd-climatology.js +81 -0
- package/dist/server/adapters/windnerd-live.js +21 -13
- package/dist/server/adapters/windnerd.d.ts +31 -4
- package/dist/server/adapters/windnerd.js +197 -19
- package/dist/server/feed.d.ts +44 -2
- package/dist/server/feed.js +63 -2
- package/dist/server/handler.d.ts +11 -1
- package/dist/server/handler.js +83 -2
- package/dist/server/index.d.ts +4 -3
- package/dist/server/index.js +4 -3
- package/dist/strings.d.ts +12 -0
- package/dist/strings.js +12 -0
- package/package.json +2 -2
- package/schema/example-climatology.json +86 -0
- package/schema/example-history.json +38 -0
- package/schema/stationclimatology.schema.json +195 -0
- package/schema/stationcurrent.schema.json +173 -0
- package/schema/stationfeed.schema.json +173 -0
- package/schema/stationhistory.schema.json +186 -0
- package/schema/stationlive.schema.json +202 -0
- package/styles.css +215 -0
|
@@ -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"
|
|
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
|
|
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(
|
|
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;
|
package/dist/elements/index.d.ts
CHANGED
|
@@ -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 };
|
package/dist/elements/index.js
CHANGED
|
@@ -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 {
|
|
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 };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Station } from "../../contract.js";
|
|
2
2
|
import { FreshnessStatus, SpeedThresholds } from "../../derive.js";
|
|
3
3
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
4
|
+
import { FavorableDirection } from "../../instruments.js";
|
|
4
5
|
import { ResolvedDisplay } from "../../display.js";
|
|
5
6
|
import "../../index.js";
|
|
6
7
|
import { AmbientStationFeed } from "./ambient.js";
|
|
@@ -30,6 +31,8 @@ declare abstract class MeteoStationElement extends MeteoElement {
|
|
|
30
31
|
set formatTime(value: FormatTime | undefined);
|
|
31
32
|
get thresholds(): SpeedThresholds | null | undefined;
|
|
32
33
|
set thresholds(value: SpeedThresholds | null | undefined);
|
|
34
|
+
get favorableDirections(): FavorableDirection[] | null | undefined;
|
|
35
|
+
set favorableDirections(value: FavorableDirection[] | null | undefined);
|
|
33
36
|
protected display(): ResolvedDisplay;
|
|
34
37
|
protected requiredStation(component: string): Station;
|
|
35
38
|
get servedAt(): string | null | undefined;
|
|
@@ -2,7 +2,7 @@ import { freshness, stationFreshnessThresholds } from "../../derive.js";
|
|
|
2
2
|
import { requireResolved, resolveDisplay, resolveStation } from "../../display.js";
|
|
3
3
|
import { subscribeTicker } from "../../client/ticker.js";
|
|
4
4
|
import { ELEMENTS_AMBIENT_HINT, STATION_FEED_CONTEXT_KEY } from "./ambient.js";
|
|
5
|
-
import { numberAttribute, parseThresholdsAttribute, unitAttribute } from "./attributes.js";
|
|
5
|
+
import { numberAttribute, parseArcsAttribute, parseThresholdsAttribute, unitAttribute } from "./attributes.js";
|
|
6
6
|
import { requestContext } from "./context.js";
|
|
7
7
|
//#region src/elements/lib/base.ts
|
|
8
8
|
var MeteoElement = class extends HTMLElement {
|
|
@@ -56,6 +56,8 @@ var MeteoStationElement = class extends MeteoElement {
|
|
|
56
56
|
#formatTime;
|
|
57
57
|
#thresholds = void 0;
|
|
58
58
|
#thresholdsSet = false;
|
|
59
|
+
#favorableDirections = void 0;
|
|
60
|
+
#favorableDirectionsSet = false;
|
|
59
61
|
#servedAt = void 0;
|
|
60
62
|
#receivedAtMs = void 0;
|
|
61
63
|
constructor() {
|
|
@@ -65,6 +67,7 @@ var MeteoStationElement = class extends MeteoElement {
|
|
|
65
67
|
"strings",
|
|
66
68
|
"formatTime",
|
|
67
69
|
"thresholds",
|
|
70
|
+
"favorableDirections",
|
|
68
71
|
"servedAt",
|
|
69
72
|
"receivedAtMs"
|
|
70
73
|
]) this.upgradeProperty(name);
|
|
@@ -98,12 +101,21 @@ var MeteoStationElement = class extends MeteoElement {
|
|
|
98
101
|
this.#thresholdsSet = value !== void 0;
|
|
99
102
|
this.requestRender();
|
|
100
103
|
}
|
|
104
|
+
get favorableDirections() {
|
|
105
|
+
return this.#favorableDirections;
|
|
106
|
+
}
|
|
107
|
+
set favorableDirections(value) {
|
|
108
|
+
this.#favorableDirections = value;
|
|
109
|
+
this.#favorableDirectionsSet = value !== void 0;
|
|
110
|
+
this.requestRender();
|
|
111
|
+
}
|
|
101
112
|
display() {
|
|
102
113
|
return resolveDisplay(this.ambient(), {
|
|
103
114
|
strings: this.#strings,
|
|
104
115
|
unit: unitAttribute(this.getAttribute("unit")),
|
|
105
116
|
formatTime: this.#formatTime,
|
|
106
|
-
thresholds: this.#thresholdsSet ? this.#thresholds : parseThresholdsAttribute(this.getAttribute("thresholds"))
|
|
117
|
+
thresholds: this.#thresholdsSet ? this.#thresholds : parseThresholdsAttribute(this.getAttribute("thresholds")),
|
|
118
|
+
favorableDirections: this.#favorableDirectionsSet ? this.#favorableDirections : parseArcsAttribute(this.getAttribute("favorable-directions"))
|
|
107
119
|
});
|
|
108
120
|
}
|
|
109
121
|
requiredStation(component) {
|
package/dist/endpoints.d.ts
CHANGED
|
@@ -2,5 +2,11 @@
|
|
|
2
2
|
declare function feedEndpoint(base: string): string;
|
|
3
3
|
declare function currentEndpoint(base: string, stationId: string): string;
|
|
4
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: {
|
|
7
|
+
fromMs: number;
|
|
8
|
+
toMs: number;
|
|
9
|
+
periodMinutes: number;
|
|
10
|
+
}): string;
|
|
5
11
|
//#endregion
|
|
6
|
-
export { currentEndpoint, feedEndpoint, liveEndpoint };
|
|
12
|
+
export { climatologyEndpoint, currentEndpoint, feedEndpoint, historyEndpoint, liveEndpoint };
|
package/dist/endpoints.js
CHANGED
|
@@ -9,5 +9,17 @@ function currentEndpoint(base, stationId) {
|
|
|
9
9
|
function liveEndpoint(base, stationId) {
|
|
10
10
|
return `${trimBase(base)}/live?station=${encodeURIComponent(stationId)}`;
|
|
11
11
|
}
|
|
12
|
+
function climatologyEndpoint(base, stationId) {
|
|
13
|
+
return `${trimBase(base)}/climatology?station=${encodeURIComponent(stationId)}`;
|
|
14
|
+
}
|
|
15
|
+
function historyEndpoint(base, stationId, query) {
|
|
16
|
+
const params = new URLSearchParams({
|
|
17
|
+
station: stationId,
|
|
18
|
+
from: new Date(query.fromMs).toISOString(),
|
|
19
|
+
to: new Date(query.toMs).toISOString(),
|
|
20
|
+
period: String(query.periodMinutes)
|
|
21
|
+
});
|
|
22
|
+
return `${trimBase(base)}/history?${params.toString()}`;
|
|
23
|
+
}
|
|
12
24
|
//#endregion
|
|
13
|
-
export { currentEndpoint, feedEndpoint, liveEndpoint };
|
|
25
|
+
export { climatologyEndpoint, currentEndpoint, feedEndpoint, historyEndpoint, liveEndpoint };
|