@azohra/meteo.station 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -17
- package/dist/air.d.ts +4 -7
- package/dist/air.js +1 -2
- package/dist/client/climatology.d.ts +4 -7
- package/dist/client/climatology.js +1 -2
- package/dist/client/history.d.ts +14 -17
- package/dist/client/history.js +1 -2
- package/dist/client/live.d.ts +9 -11
- package/dist/client/live.js +1 -2
- package/dist/client/poll.d.ts +9 -12
- package/dist/client/poll.js +1 -2
- package/dist/client/stores.d.ts +8 -10
- package/dist/client/stores.js +1 -2
- package/dist/client/ticker.d.ts +1 -4
- package/dist/client/ticker.js +1 -2
- package/dist/climatology.d.ts +13 -15
- package/dist/climatology.js +1 -2
- package/dist/connectivity.d.ts +9 -12
- package/dist/connectivity.js +1 -2
- package/dist/contract-climatology.d.ts +11 -14
- package/dist/contract-climatology.js +1 -2
- package/dist/contract.d.ts +148 -151
- package/dist/contract.js +1 -2
- package/dist/derive.d.ts +24 -26
- package/dist/derive.js +5 -6
- package/dist/display.d.ts +6 -9
- package/dist/display.js +1 -2
- package/dist/elements/elements/AirExtremesElement.d.ts +2 -5
- package/dist/elements/elements/AirExtremesElement.js +6 -20
- package/dist/elements/elements/AirMatrixElement.d.ts +2 -5
- package/dist/elements/elements/AirMatrixElement.js +7 -33
- package/dist/elements/elements/ClimatologyDailyPatternElement.d.ts +2 -5
- package/dist/elements/elements/ClimatologyDailyPatternElement.js +18 -14
- package/dist/elements/elements/ClimatologyRoseElement.d.ts +2 -5
- package/dist/elements/elements/ClimatologyRoseElement.js +6 -17
- package/dist/elements/elements/CompassFanElement.d.ts +2 -5
- package/dist/elements/elements/CompassFanElement.js +6 -66
- package/dist/elements/elements/CurrentConditionsElement.d.ts +2 -5
- package/dist/elements/elements/CurrentConditionsElement.js +8 -28
- package/dist/elements/elements/DailyPatternElement.d.ts +2 -6
- package/dist/elements/elements/DailyPatternElement.js +7 -122
- package/dist/elements/elements/DialElement.d.ts +2 -5
- package/dist/elements/elements/DialElement.js +4 -97
- package/dist/elements/elements/FavorableShareElement.d.ts +2 -5
- package/dist/elements/elements/FavorableShareElement.js +7 -23
- package/dist/elements/elements/FreshnessBadgeElement.d.ts +2 -5
- package/dist/elements/elements/FreshnessBadgeElement.js +1 -2
- package/dist/elements/elements/RecentSummariesElement.d.ts +2 -5
- package/dist/elements/elements/RecentSummariesElement.js +7 -25
- package/dist/elements/elements/SparklineElement.d.ts +2 -6
- package/dist/elements/elements/SparklineElement.js +5 -41
- package/dist/elements/elements/StationCardElement.d.ts +6 -8
- package/dist/elements/elements/StationCardElement.js +5 -20
- package/dist/elements/elements/StationFeedElement.d.ts +2 -5
- package/dist/elements/elements/StationFeedElement.js +5 -4
- package/dist/elements/elements/StationStripElement.d.ts +2 -5
- package/dist/elements/elements/StationStripElement.js +5 -20
- package/dist/elements/elements/StationTableElement.d.ts +3 -6
- package/dist/elements/elements/StationTableElement.js +16 -53
- package/dist/elements/elements/TrendChartElement.d.ts +2 -5
- package/dist/elements/elements/TrendChartElement.js +22 -71
- package/dist/elements/elements/WindArrowElement.d.ts +2 -5
- package/dist/elements/elements/WindArrowElement.js +1 -2
- package/dist/elements/elements/WindHistoryChartElement.d.ts +2 -5
- package/dist/elements/elements/WindHistoryChartElement.js +24 -166
- package/dist/elements/elements/WindRoseElement.d.ts +2 -6
- package/dist/elements/elements/WindRoseElement.js +7 -72
- package/dist/elements/elements/atoms.d.ts +10 -12
- package/dist/elements/elements/atoms.js +12 -40
- package/dist/elements/index.d.ts +3 -5
- package/dist/elements/index.js +4 -5
- package/dist/elements/lib/ambient.d.ts +2 -5
- package/dist/elements/lib/ambient.js +1 -2
- package/dist/elements/lib/attributes.js +1 -2
- package/dist/elements/lib/base.d.ts +3 -6
- package/dist/elements/lib/base.js +1 -2
- package/dist/elements/lib/context.js +1 -2
- package/dist/elements/lib/fragments.js +9 -39
- package/dist/elements/lib/h.js +2 -3
- package/dist/elements/lib/pinned-cursor.js +1 -2
- package/dist/elements/lib/render.js +29 -0
- package/dist/elements/register.js +1 -2
- package/dist/endpoints.d.ts +6 -9
- package/dist/endpoints.js +1 -2
- package/dist/fixtures.d.ts +7 -10
- package/dist/fixtures.js +1 -2
- package/dist/format.d.ts +11 -14
- package/dist/format.js +1 -2
- package/dist/geometry.d.ts +36 -38
- package/dist/geometry.js +3 -3
- package/dist/instruments.d.ts +37 -40
- package/dist/instruments.js +3 -4
- package/dist/merge-current.d.ts +4 -7
- package/dist/merge-current.js +1 -2
- package/dist/react/components/AirExtremes.d.ts +2 -5
- package/dist/react/components/AirExtremes.js +6 -24
- package/dist/react/components/AirMatrix.d.ts +2 -5
- package/dist/react/components/AirMatrix.js +11 -45
- package/dist/react/components/ClimatologyDailyPattern.d.ts +2 -5
- package/dist/react/components/ClimatologyDailyPattern.js +20 -15
- package/dist/react/components/ClimatologyRose.d.ts +2 -5
- package/dist/react/components/ClimatologyRose.js +12 -30
- package/dist/react/components/CompassFan.d.ts +2 -5
- package/dist/react/components/CompassFan.js +7 -75
- package/dist/react/components/CurrentConditions.d.ts +2 -5
- package/dist/react/components/CurrentConditions.js +12 -76
- package/dist/react/components/DailyPattern.d.ts +3 -8
- package/dist/react/components/DailyPattern.js +11 -151
- package/dist/react/components/Dial.d.ts +2 -5
- package/dist/react/components/Dial.js +6 -120
- package/dist/react/components/FavorableShare.d.ts +2 -5
- package/dist/react/components/FavorableShare.js +7 -29
- package/dist/react/components/FreshnessBadge.d.ts +2 -5
- package/dist/react/components/FreshnessBadge.js +6 -14
- package/dist/react/components/Readout.d.ts +2 -5
- package/dist/react/components/Readout.js +1 -2
- package/dist/react/components/RecentSummaries.d.ts +2 -5
- package/dist/react/components/RecentSummaries.js +7 -46
- package/dist/react/components/SceneTree.js +37 -0
- package/dist/react/components/Sparkline.d.ts +2 -5
- package/dist/react/components/Sparkline.js +4 -41
- package/dist/react/components/StationCard.d.ts +8 -10
- package/dist/react/components/StationCard.js +6 -47
- package/dist/react/components/StationFeedProvider.d.ts +3 -6
- package/dist/react/components/StationFeedProvider.js +1 -2
- package/dist/react/components/StationStrip.d.ts +2 -5
- package/dist/react/components/StationStrip.js +6 -62
- package/dist/react/components/StationTable.d.ts +3 -6
- package/dist/react/components/StationTable.js +22 -77
- package/dist/react/components/TrendChart.d.ts +2 -5
- package/dist/react/components/TrendChart.js +9 -65
- package/dist/react/components/WindArrow.d.ts +2 -5
- package/dist/react/components/WindArrow.js +4 -17
- package/dist/react/components/WindHistoryChart.d.ts +2 -5
- package/dist/react/components/WindHistoryChart.js +9 -184
- package/dist/react/components/WindRose.d.ts +2 -7
- package/dist/react/components/WindRose.js +7 -91
- package/dist/react/components/WindSampleStrip.d.ts +2 -5
- package/dist/react/components/WindSampleStrip.js +9 -117
- package/dist/react/components/atoms.d.ts +12 -14
- package/dist/react/components/atoms.js +13 -50
- package/dist/react/hooks/useFreshness.d.ts +1 -4
- package/dist/react/hooks/useFreshness.js +1 -2
- package/dist/react/hooks/useMeasuredChartWidth.d.ts +2 -5
- package/dist/react/hooks/useMeasuredChartWidth.js +1 -2
- package/dist/react/hooks/usePolledJson.js +1 -2
- package/dist/react/hooks/useStation.d.ts +2 -5
- package/dist/react/hooks/useStation.js +1 -2
- package/dist/react/hooks/useStationClimatology.d.ts +2 -5
- package/dist/react/hooks/useStationClimatology.js +1 -2
- package/dist/react/hooks/useStationCurrent.d.ts +2 -5
- package/dist/react/hooks/useStationCurrent.js +4 -4
- package/dist/react/hooks/useStationFeed.d.ts +2 -5
- package/dist/react/hooks/useStationFeed.js +4 -4
- package/dist/react/hooks/useStationLive.d.ts +2 -5
- package/dist/react/hooks/useStationLive.js +1 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +5 -5
- package/dist/react/lib/cells.js +5 -26
- package/dist/react/lib/use-pinned-cursor.js +1 -2
- package/dist/samples.d.ts +8 -11
- package/dist/samples.js +1 -2
- package/dist/scene/air-extremes.js +13 -29
- package/dist/scene/air-matrix.js +46 -60
- package/dist/scene/atoms.js +1 -2
- package/dist/scene/card.js +15 -42
- package/dist/scene/cells.d.ts +4 -0
- package/dist/scene/cells.js +50 -0
- package/dist/scene/chart.d.ts +2 -5
- package/dist/scene/chart.js +3 -3
- package/dist/scene/climatology-pattern.d.ts +1 -2
- package/dist/scene/climatology-pattern.js +11 -13
- package/dist/scene/climatology-rose.d.ts +1 -2
- package/dist/scene/climatology-rose.js +15 -35
- package/dist/scene/compass-fan.js +29 -102
- package/dist/scene/current.d.ts +2 -1
- package/dist/scene/current.js +30 -58
- package/dist/scene/daily-pattern.d.ts +1 -3
- package/dist/scene/daily-pattern.js +21 -29
- package/dist/scene/dial-parts.d.ts +1 -0
- package/dist/scene/dial-parts.js +69 -0
- package/dist/scene/dial.d.ts +1 -2
- package/dist/scene/dial.js +49 -138
- package/dist/scene/favorable-share.js +17 -35
- package/dist/scene/glyphs.js +21 -18
- package/dist/scene/index.d.ts +5 -3
- package/dist/scene/node.js +18 -0
- package/dist/scene/recent-summaries.js +27 -65
- package/dist/scene/rose.js +90 -119
- package/dist/scene/sample-strip.d.ts +1 -2
- package/dist/scene/sample-strip.js +36 -38
- package/dist/scene/sparkline.js +32 -42
- package/dist/scene/strip.js +19 -59
- package/dist/scene/table.js +48 -71
- package/dist/scene/trend.d.ts +1 -2
- package/dist/scene/trend.js +30 -57
- package/dist/scene/wind-history.d.ts +1 -2
- package/dist/scene/wind-history.js +42 -53
- package/dist/scene/wind-plot.js +71 -142
- package/dist/server/adapter.d.ts +7 -10
- package/dist/server/adapter.js +1 -2
- package/dist/server/adapters/campbell.d.ts +18 -20
- package/dist/server/adapters/campbell.js +2 -3
- package/dist/server/adapters/ecowitt.d.ts +12 -15
- package/dist/server/adapters/ecowitt.js +1 -2
- package/dist/server/adapters/tempest.d.ts +10 -13
- package/dist/server/adapters/tempest.js +1 -2
- package/dist/server/adapters/windnerd-climatology.d.ts +5 -8
- package/dist/server/adapters/windnerd-climatology.js +5 -5
- package/dist/server/adapters/windnerd-live.d.ts +2 -5
- package/dist/server/adapters/windnerd-live.js +4 -4
- package/dist/server/adapters/windnerd.d.ts +30 -33
- package/dist/server/adapters/windnerd.js +2 -3
- package/dist/server/config.d.ts +61 -63
- package/dist/server/config.js +1 -2
- package/dist/server/environment.d.ts +20 -22
- package/dist/server/environment.js +1 -2
- package/dist/server/feed.d.ts +19 -21
- package/dist/server/feed.js +1 -2
- package/dist/server/handler.d.ts +4 -7
- package/dist/server/handler.js +1 -2
- package/dist/server/hologram.d.ts +9 -12
- package/dist/server/hologram.js +3 -3
- package/dist/server/live.d.ts +2 -5
- package/dist/server/live.js +1 -2
- package/dist/sse.js +1 -2
- package/dist/strings.d.ts +8 -11
- package/dist/strings.js +1 -2
- package/dist/windnerd.d.ts +4 -7
- package/dist/windnerd.js +1 -2
- package/package.json +12 -17
- package/schema/README.md +1 -1
- package/schema/stationclimatology.schema.json +64 -61
- package/schema/stationcurrent.schema.json +68 -156
- package/schema/stationfeed.schema.json +71 -163
- package/schema/stationhistory.schema.json +37 -46
- package/schema/stationlive.schema.json +221 -306
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { MeteoStationElement } from "../lib/base.js";
|
|
2
|
-
|
|
3
|
-
declare class StationStripElement extends MeteoStationElement {
|
|
2
|
+
export declare class StationStripElement extends MeteoStationElement {
|
|
4
3
|
static readonly observedAttributes: string[];
|
|
5
4
|
protected connected(): void;
|
|
6
5
|
protected render(): void;
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { StationStripElement };
|
|
6
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { stationStripScene } from "../../scene/strip.js";
|
|
2
2
|
import { MeteoStationElement } from "../lib/base.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
//#region src/elements/elements/StationStripElement.ts
|
|
3
|
+
import { renderScene } from "../lib/render.js";
|
|
4
|
+
// src/elements/elements/StationStripElement.ts
|
|
6
5
|
var StationStripElement = class extends MeteoStationElement {
|
|
7
6
|
static observedAttributes = [
|
|
8
7
|
"received-at-ms",
|
|
@@ -17,27 +16,13 @@ var StationStripElement = class extends MeteoStationElement {
|
|
|
17
16
|
const station = this.requiredStation("meteo-station-strip");
|
|
18
17
|
const { formatTime, unit, words } = this.display();
|
|
19
18
|
const status = this.freshnessOf(station);
|
|
20
|
-
|
|
19
|
+
this.replaceChildren(renderScene(stationStripScene({
|
|
21
20
|
formatTime,
|
|
21
|
+
freshness: status,
|
|
22
22
|
station,
|
|
23
23
|
unit,
|
|
24
24
|
words
|
|
25
|
-
});
|
|
26
|
-
const { body } = scene;
|
|
27
|
-
const cells = body.kind === "reading" ? [
|
|
28
|
-
h("span", { class: body.wind.className }, h("strong", null, body.wind.value), h("small", null, body.wind.unitLabel)),
|
|
29
|
-
body.gustLull != null && [h("span", { class: body.gustLull.lull.className }, h("small", { class: body.gustLull.lull.labelClassName }, body.gustLull.lull.label), body.gustLull.lull.value), h("span", { class: body.gustLull.gust.className }, h("small", { class: body.gustLull.gust.labelClassName }, body.gustLull.gust.label), body.gustLull.gust.value)],
|
|
30
|
-
h("span", { class: body.from.className }, ...directionCellNodes(body.from.windAvgMps, body.from.windDirectionDeg, words)),
|
|
31
|
-
body.temperature != null && h("span", { class: body.temperature.className }, body.temperature.text),
|
|
32
|
-
h("span", { class: body.updated.className }, h("span", { class: body.updated.time.className }, body.updated.time.text), status != null && freshnessBadgeSpan(status, words))
|
|
33
|
-
] : [h("span", { class: body.className }, body.text)];
|
|
34
|
-
this.replaceChildren(h("div", {
|
|
35
|
-
"aria-label": scene.root.ariaLabel,
|
|
36
|
-
class: scene.root.className,
|
|
37
|
-
"data-status": scene.root.status,
|
|
38
|
-
role: "group"
|
|
39
|
-
}, h("span", { class: scene.stationClassName }, stationNameNode(station)), ...cells));
|
|
25
|
+
})));
|
|
40
26
|
}
|
|
41
27
|
};
|
|
42
|
-
//#endregion
|
|
43
28
|
export { StationStripElement };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Station } from "../../contract.js";
|
|
2
2
|
import "../../index.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare class StationTableElement extends MeteoStationElement {
|
|
4
|
+
export type StationMetaRenderer = (station: Station) => string | Node | null;
|
|
5
|
+
export declare class StationTableElement extends MeteoStationElement {
|
|
7
6
|
#private;
|
|
8
7
|
static readonly observedAttributes: string[];
|
|
9
8
|
constructor();
|
|
@@ -13,6 +12,4 @@ declare class StationTableElement extends MeteoStationElement {
|
|
|
13
12
|
set stationMeta(value: StationMetaRenderer | undefined);
|
|
14
13
|
protected connected(): void;
|
|
15
14
|
protected render(): void;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { StationMetaRenderer, StationTableElement };
|
|
15
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { requireResolved } from "../../display.js";
|
|
2
|
-
import {
|
|
2
|
+
import { TABLE_BODY_CLASS, TABLE_ROW_CLASS, TABLE_STATION_CELL_CLASS, stationTableHeadNode, stationTableRootAttrs, stationTableRowCells } from "../../scene/table.js";
|
|
3
3
|
import { ELEMENTS_AMBIENT_HINT } from "../lib/ambient.js";
|
|
4
4
|
import { MeteoStationElement } from "../lib/base.js";
|
|
5
5
|
import { h } from "../lib/h.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { renderScene } from "../lib/render.js";
|
|
7
|
+
import { stationNameNode } from "../lib/fragments.js";
|
|
8
|
+
// src/elements/elements/StationTableElement.ts
|
|
8
9
|
var StationTableElement = class extends MeteoStationElement {
|
|
9
10
|
static observedAttributes = [
|
|
10
11
|
"received-at-ms",
|
|
@@ -37,66 +38,28 @@ var StationTableElement = class extends MeteoStationElement {
|
|
|
37
38
|
render() {
|
|
38
39
|
const stations = requireResolved("meteo-station-table", "stations", this.#stations ?? this.ambient()?.feed?.stations, ELEMENTS_AMBIENT_HINT);
|
|
39
40
|
const { formatTime, unit, words } = this.display();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"aria-label": scene.root.ariaLabel,
|
|
43
|
-
class: scene.root.className,
|
|
44
|
-
role: "table"
|
|
45
|
-
}, h("div", {
|
|
46
|
-
class: scene.head.className,
|
|
47
|
-
role: "row"
|
|
48
|
-
}, scene.head.columns.map((column) => h("span", { role: "columnheader" }, column))), h("div", {
|
|
49
|
-
class: scene.bodyClassName,
|
|
41
|
+
this.replaceChildren(h("div", stationTableRootAttrs(stations, words), renderScene(stationTableHeadNode(words)), h("div", {
|
|
42
|
+
class: TABLE_BODY_CLASS,
|
|
50
43
|
role: "rowgroup"
|
|
51
44
|
}, stations.map((station) => this.#row(station, unit, words, formatTime)))));
|
|
52
45
|
}
|
|
53
46
|
#row(station, unit, words, formatTime) {
|
|
54
47
|
const status = this.freshnessOf(station);
|
|
55
48
|
const meta = this.#stationMeta ? this.#stationMeta(station) : station.sourceLabel;
|
|
56
|
-
const row = stationTableRowScene({
|
|
57
|
-
formatTime,
|
|
58
|
-
station,
|
|
59
|
-
unit,
|
|
60
|
-
words
|
|
61
|
-
});
|
|
62
|
-
const { cells } = row;
|
|
63
49
|
return h("div", {
|
|
64
|
-
class:
|
|
65
|
-
"data-status":
|
|
50
|
+
class: TABLE_ROW_CLASS,
|
|
51
|
+
"data-status": station.status,
|
|
66
52
|
role: "row"
|
|
67
53
|
}, h("span", {
|
|
68
|
-
class:
|
|
54
|
+
class: TABLE_STATION_CELL_CLASS,
|
|
69
55
|
role: "cell"
|
|
70
|
-
}, h("strong", null, stationNameNode(station)), h("small", null, meta)),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
role: "cell"
|
|
78
|
-
}, cells.lull.value),
|
|
79
|
-
h("span", {
|
|
80
|
-
class: cells.gust.className,
|
|
81
|
-
role: "cell"
|
|
82
|
-
}, cells.gust.value),
|
|
83
|
-
h("span", {
|
|
84
|
-
class: cells.from.className,
|
|
85
|
-
role: "cell"
|
|
86
|
-
}, ...directionCellNodes(cells.from.windAvgMps, cells.from.windDirectionDeg, words)),
|
|
87
|
-
h("span", {
|
|
88
|
-
class: cells.temperature.className,
|
|
89
|
-
role: "cell"
|
|
90
|
-
}, cells.temperature.value),
|
|
91
|
-
h("span", {
|
|
92
|
-
class: cells.updated.className,
|
|
93
|
-
role: "cell"
|
|
94
|
-
}, h("span", { class: cells.updated.time.className }, cells.updated.time.text), status != null && freshnessBadgeSpan(status, words))
|
|
95
|
-
] : h("span", {
|
|
96
|
-
class: cells.className,
|
|
97
|
-
role: "cell"
|
|
98
|
-
}, cells.text));
|
|
56
|
+
}, h("strong", null, stationNameNode(station)), h("small", null, meta)), stationTableRowCells({
|
|
57
|
+
formatTime,
|
|
58
|
+
freshness: status,
|
|
59
|
+
station,
|
|
60
|
+
unit,
|
|
61
|
+
words
|
|
62
|
+
}).map((child) => typeof child === "object" && child !== null ? renderScene(child) : child));
|
|
99
63
|
}
|
|
100
64
|
};
|
|
101
|
-
//#endregion
|
|
102
65
|
export { StationTableElement };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { MeteoStationElement } from "../lib/base.js";
|
|
2
|
-
|
|
3
|
-
declare class TrendChartElement extends MeteoStationElement {
|
|
2
|
+
export declare class TrendChartElement extends MeteoStationElement {
|
|
4
3
|
#private;
|
|
5
4
|
static readonly observedAttributes: string[];
|
|
6
5
|
protected disconnected(): void;
|
|
7
6
|
protected render(): void;
|
|
8
|
-
}
|
|
9
|
-
//#endregion
|
|
10
|
-
export { TrendChartElement };
|
|
7
|
+
}
|
|
@@ -4,20 +4,20 @@ import { readoutAriaLive } from "../../scene/chart.js";
|
|
|
4
4
|
import { TREND_CLASS, trendGate, trendScene } from "../../scene/trend.js";
|
|
5
5
|
import { ELEMENTS_AMBIENT_HINT } from "../lib/ambient.js";
|
|
6
6
|
import { MeteoStationElement } from "../lib/base.js";
|
|
7
|
-
import { h
|
|
7
|
+
import { h } from "../lib/h.js";
|
|
8
|
+
import { renderChildren, renderScene } from "../lib/render.js";
|
|
8
9
|
import { PinnedCursor } from "../lib/pinned-cursor.js";
|
|
9
|
-
|
|
10
|
+
// src/elements/elements/TrendChartElement.ts
|
|
10
11
|
var TrendChartElement = class extends MeteoStationElement {
|
|
11
12
|
static observedAttributes = ["series", "station-id"];
|
|
12
13
|
#width = null;
|
|
13
14
|
#observer = null;
|
|
14
15
|
#scene = null;
|
|
15
16
|
#readout = null;
|
|
16
|
-
#
|
|
17
|
-
#hit = null;
|
|
17
|
+
#wrap = null;
|
|
18
18
|
#cursor = new PinnedCursor({
|
|
19
19
|
scene: () => this.#scene,
|
|
20
|
-
svg: () => this.#svg,
|
|
20
|
+
svg: () => this.#wrap?.querySelector("svg") ?? null,
|
|
21
21
|
onChange: () => this.#updateCursor()
|
|
22
22
|
});
|
|
23
23
|
disconnected() {
|
|
@@ -76,81 +76,32 @@ var TrendChartElement = class extends MeteoStationElement {
|
|
|
76
76
|
class: scene.readout.className
|
|
77
77
|
});
|
|
78
78
|
this.#readout = readout;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
fill: scene.hit.fill,
|
|
82
|
-
height: scene.hit.height,
|
|
83
|
-
onclick: (event) => this.#cursor.handleClick(event),
|
|
84
|
-
onpointerleave: () => this.#cursor.handlePointerLeave(),
|
|
85
|
-
onpointermove: (event) => this.#cursor.handlePointerMove(event),
|
|
86
|
-
width: scene.hit.width,
|
|
87
|
-
x: scene.hit.x,
|
|
88
|
-
y: scene.hit.y
|
|
89
|
-
});
|
|
90
|
-
this.#hit = hit;
|
|
91
|
-
const svg = hs("svg", {
|
|
92
|
-
"aria-label": scene.svg.ariaLabel,
|
|
93
|
-
class: scene.svg.className,
|
|
94
|
-
height: scene.svg.height,
|
|
95
|
-
role: "img",
|
|
96
|
-
viewBox: scene.svg.viewBox,
|
|
97
|
-
width: scene.svg.width
|
|
98
|
-
}, scene.grid.map(({ line, label }) => hs("g", null, hs("line", {
|
|
99
|
-
class: line.className,
|
|
100
|
-
x1: line.x1,
|
|
101
|
-
x2: line.x2,
|
|
102
|
-
y1: line.y1,
|
|
103
|
-
y2: line.y2
|
|
104
|
-
}), hs("text", {
|
|
105
|
-
class: label.className,
|
|
106
|
-
"text-anchor": label.anchor,
|
|
107
|
-
x: label.x,
|
|
108
|
-
y: label.y
|
|
109
|
-
}, label.text))), scene.segments.map((segment) => segment.kind === "dot" ? hs("circle", {
|
|
110
|
-
class: segment.className,
|
|
111
|
-
cx: segment.cx,
|
|
112
|
-
cy: segment.cy,
|
|
113
|
-
r: segment.r
|
|
114
|
-
}) : hs("polyline", {
|
|
115
|
-
class: segment.className,
|
|
116
|
-
points: segment.points
|
|
117
|
-
})), scene.ticks.map((tick) => hs("text", {
|
|
118
|
-
class: tick.className,
|
|
119
|
-
"text-anchor": tick.anchor,
|
|
120
|
-
x: tick.x,
|
|
121
|
-
y: tick.y
|
|
122
|
-
}, tick.text)), hit);
|
|
123
|
-
this.#svg = svg;
|
|
124
|
-
wrap.replaceChildren(readout, svg);
|
|
79
|
+
this.#wrap = wrap;
|
|
80
|
+
wrap.replaceChildren(readout, this.#drawSvg());
|
|
125
81
|
this.#updateCursor();
|
|
126
82
|
}
|
|
83
|
+
#drawSvg() {
|
|
84
|
+
const scene = this.#scene;
|
|
85
|
+
if (scene == null) throw new Error("meteo-trend-chart: no scene to draw");
|
|
86
|
+
return renderScene(scene.draw([], {
|
|
87
|
+
onClick: (event) => this.#cursor.handleClick(event),
|
|
88
|
+
onPointerLeave: () => this.#cursor.handlePointerLeave(),
|
|
89
|
+
onPointerMove: (event) => this.#cursor.handlePointerMove(event)
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
127
92
|
#updateCursor() {
|
|
128
93
|
const scene = this.#scene;
|
|
129
94
|
const readout = this.#readout;
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
if (scene == null || readout == null || svg == null || hit == null) return;
|
|
95
|
+
const wrap = this.#wrap;
|
|
96
|
+
if (scene == null || readout == null || wrap == null) return;
|
|
133
97
|
const inspection = scene.inspect(this.#cursor.activeIndex());
|
|
134
98
|
readout.setAttribute("aria-live", readoutAriaLive(this.#cursor.previewIndex));
|
|
135
99
|
readout.replaceChildren(h("strong", null, inspection.readout.strong), h("span", null, inspection.readout.span));
|
|
100
|
+
const svg = wrap.querySelector("svg");
|
|
101
|
+
const hit = svg?.querySelector(".meteo-hit") ?? null;
|
|
102
|
+
if (svg == null) return;
|
|
136
103
|
for (const mark of [...svg.querySelectorAll(".meteo-cursor, .meteo-cursor-dot")]) mark.remove();
|
|
137
|
-
const
|
|
138
|
-
if (cursor != null) {
|
|
139
|
-
svg.insertBefore(hs("line", {
|
|
140
|
-
class: cursor.line.className,
|
|
141
|
-
x1: cursor.line.x1,
|
|
142
|
-
x2: cursor.line.x2,
|
|
143
|
-
y1: cursor.line.y1,
|
|
144
|
-
y2: cursor.line.y2
|
|
145
|
-
}), hit);
|
|
146
|
-
if (cursor.dot != null) svg.insertBefore(hs("circle", {
|
|
147
|
-
class: cursor.dot.className,
|
|
148
|
-
cx: cursor.dot.cx,
|
|
149
|
-
cy: cursor.dot.cy,
|
|
150
|
-
r: cursor.dot.r
|
|
151
|
-
}), hit);
|
|
152
|
-
}
|
|
104
|
+
for (const node of renderChildren(inspection.cursor)) svg.insertBefore(node, hit);
|
|
153
105
|
}
|
|
154
106
|
};
|
|
155
|
-
//#endregion
|
|
156
107
|
export { TrendChartElement };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { MeteoElement } from "../lib/base.js";
|
|
2
|
-
|
|
3
|
-
declare class WindArrowElement extends MeteoElement {
|
|
2
|
+
export declare class WindArrowElement extends MeteoElement {
|
|
4
3
|
static readonly observedAttributes: string[];
|
|
5
4
|
protected render(): void;
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
export { WindArrowElement };
|
|
5
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { numberAttribute } from "../lib/attributes.js";
|
|
2
2
|
import { MeteoElement } from "../lib/base.js";
|
|
3
3
|
import { windArrowSvg } from "../lib/fragments.js";
|
|
4
|
-
|
|
4
|
+
// src/elements/elements/WindArrowElement.ts
|
|
5
5
|
var WindArrowElement = class extends MeteoElement {
|
|
6
6
|
static observedAttributes = ["deg", "size"];
|
|
7
7
|
render() {
|
|
@@ -10,5 +10,4 @@ var WindArrowElement = class extends MeteoElement {
|
|
|
10
10
|
this.replaceChildren(windArrowSvg(deg, size));
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
13
|
export { WindArrowElement };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { MeteoStationElement } from "../lib/base.js";
|
|
2
|
-
|
|
3
|
-
declare class WindHistoryChartElement extends MeteoStationElement {
|
|
2
|
+
export declare class WindHistoryChartElement extends MeteoStationElement {
|
|
4
3
|
#private;
|
|
5
4
|
static readonly observedAttributes: string[];
|
|
6
5
|
protected disconnected(): void;
|
|
7
6
|
protected render(): void;
|
|
8
|
-
}
|
|
9
|
-
//#endregion
|
|
10
|
-
export { WindHistoryChartElement };
|
|
7
|
+
}
|
|
@@ -3,13 +3,15 @@ import { readoutAriaLive } from "../../scene/chart.js";
|
|
|
3
3
|
import { WIND_CHART_CLASS, windChartGate, windChartScene } from "../../scene/wind-history.js";
|
|
4
4
|
import { numberAttribute } from "../lib/attributes.js";
|
|
5
5
|
import { MeteoStationElement } from "../lib/base.js";
|
|
6
|
-
import { h
|
|
6
|
+
import { h } from "../lib/h.js";
|
|
7
|
+
import { renderChildren, renderScene } from "../lib/render.js";
|
|
7
8
|
import { windArrowSvg } from "../lib/fragments.js";
|
|
8
9
|
import { PinnedCursor } from "../lib/pinned-cursor.js";
|
|
9
|
-
|
|
10
|
+
// src/elements/elements/WindHistoryChartElement.ts
|
|
10
11
|
let hatchCounter = 0;
|
|
11
12
|
function readoutSpan(parts) {
|
|
12
|
-
|
|
13
|
+
const children = parts.map((part) => part.kind === "arrow" ? windArrowSvg(part.deg) : part.text);
|
|
14
|
+
return h("span", null, ...children);
|
|
13
15
|
}
|
|
14
16
|
var WindHistoryChartElement = class extends MeteoStationElement {
|
|
15
17
|
static observedAttributes = [
|
|
@@ -26,11 +28,10 @@ var WindHistoryChartElement = class extends MeteoStationElement {
|
|
|
26
28
|
#observer = null;
|
|
27
29
|
#scene = null;
|
|
28
30
|
#readout = null;
|
|
29
|
-
#
|
|
30
|
-
#hit = null;
|
|
31
|
+
#wrap = null;
|
|
31
32
|
#cursor = new PinnedCursor({
|
|
32
33
|
scene: () => this.#scene,
|
|
33
|
-
svg: () => this.#svg,
|
|
34
|
+
svg: () => this.#wrap?.querySelector("svg") ?? null,
|
|
34
35
|
onChange: () => this.#updateCursor()
|
|
35
36
|
});
|
|
36
37
|
disconnected() {
|
|
@@ -98,175 +99,32 @@ var WindHistoryChartElement = class extends MeteoStationElement {
|
|
|
98
99
|
class: scene.readout.className
|
|
99
100
|
});
|
|
100
101
|
this.#readout = readout;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
fill: scene.hit.fill,
|
|
104
|
-
height: scene.hit.height,
|
|
105
|
-
onclick: (event) => this.#cursor.handleClick(event),
|
|
106
|
-
onpointerleave: () => this.#cursor.handlePointerLeave(),
|
|
107
|
-
onpointermove: (event) => this.#cursor.handlePointerMove(event),
|
|
108
|
-
width: scene.hit.width,
|
|
109
|
-
x: scene.hit.x,
|
|
110
|
-
y: scene.hit.y
|
|
111
|
-
});
|
|
112
|
-
this.#hit = hit;
|
|
113
|
-
const svg = hs("svg", {
|
|
114
|
-
"aria-label": scene.svg.ariaLabel,
|
|
115
|
-
class: scene.svg.className,
|
|
116
|
-
height: scene.svg.height,
|
|
117
|
-
role: "img",
|
|
118
|
-
viewBox: scene.svg.viewBox,
|
|
119
|
-
width: scene.svg.width
|
|
120
|
-
}, hs("defs", null, hs("pattern", {
|
|
121
|
-
height: scene.defs.pattern.height,
|
|
122
|
-
id: scene.defs.pattern.id,
|
|
123
|
-
patternTransform: scene.defs.pattern.transform,
|
|
124
|
-
patternUnits: scene.defs.pattern.units,
|
|
125
|
-
width: scene.defs.pattern.width
|
|
126
|
-
}, hs("line", {
|
|
127
|
-
class: scene.defs.pattern.line.className,
|
|
128
|
-
x1: scene.defs.pattern.line.x1,
|
|
129
|
-
x2: scene.defs.pattern.line.x2,
|
|
130
|
-
y1: scene.defs.pattern.line.y1,
|
|
131
|
-
y2: scene.defs.pattern.line.y2
|
|
132
|
-
})), hs("clipPath", { id: scene.defs.clip.id }, hs("rect", {
|
|
133
|
-
height: scene.defs.clip.rect.height,
|
|
134
|
-
width: scene.defs.clip.rect.width,
|
|
135
|
-
x: scene.defs.clip.rect.x,
|
|
136
|
-
y: scene.defs.clip.rect.y
|
|
137
|
-
}))), scene.zones.map((zone) => hs("rect", {
|
|
138
|
-
class: zone.className,
|
|
139
|
-
height: zone.height,
|
|
140
|
-
width: zone.width,
|
|
141
|
-
x: zone.x,
|
|
142
|
-
y: zone.y
|
|
143
|
-
})), scene.nightRects.map((rect) => hs("rect", {
|
|
144
|
-
class: rect.className,
|
|
145
|
-
height: rect.height,
|
|
146
|
-
width: rect.width,
|
|
147
|
-
x: rect.x,
|
|
148
|
-
y: rect.y
|
|
149
|
-
})), scene.grid.map(({ line, label }) => hs("g", null, hs("line", {
|
|
150
|
-
class: line.className,
|
|
151
|
-
x1: line.x1,
|
|
152
|
-
x2: line.x2,
|
|
153
|
-
y1: line.y1,
|
|
154
|
-
y2: line.y2
|
|
155
|
-
}), hs("text", {
|
|
156
|
-
class: label.className,
|
|
157
|
-
"text-anchor": label.anchor,
|
|
158
|
-
x: label.x,
|
|
159
|
-
y: label.y
|
|
160
|
-
}, label.text))), scene.thresholdGuides.map(({ line, label }) => hs("g", null, hs("line", {
|
|
161
|
-
class: line.className,
|
|
162
|
-
x1: line.x1,
|
|
163
|
-
x2: line.x2,
|
|
164
|
-
y1: line.y1,
|
|
165
|
-
y2: line.y2
|
|
166
|
-
}), hs("text", {
|
|
167
|
-
class: label.className,
|
|
168
|
-
"text-anchor": label.anchor,
|
|
169
|
-
x: label.x,
|
|
170
|
-
y: label.y
|
|
171
|
-
}, label.text))), scene.vaneGuides.map((guide) => hs("line", {
|
|
172
|
-
class: guide.className,
|
|
173
|
-
x1: guide.x1,
|
|
174
|
-
x2: guide.x2,
|
|
175
|
-
y1: guide.y1,
|
|
176
|
-
y2: guide.y2
|
|
177
|
-
})), scene.gaps.map((gap) => hs("rect", {
|
|
178
|
-
class: gap.className,
|
|
179
|
-
fill: gap.fill,
|
|
180
|
-
height: gap.height,
|
|
181
|
-
width: gap.width,
|
|
182
|
-
x: gap.x,
|
|
183
|
-
y: gap.y
|
|
184
|
-
})), scene.band != null && hs("polygon", {
|
|
185
|
-
class: scene.band.className,
|
|
186
|
-
points: scene.band.points
|
|
187
|
-
}), scene.compare != null && hs("polyline", {
|
|
188
|
-
class: scene.compare.className,
|
|
189
|
-
"clip-path": scene.compare.clipPath,
|
|
190
|
-
points: scene.compare.points
|
|
191
|
-
}), scene.mean.kind === "polyline" ? hs("polyline", {
|
|
192
|
-
class: scene.mean.className,
|
|
193
|
-
points: scene.mean.points
|
|
194
|
-
}) : scene.mean.segments.map((segment) => hs("line", {
|
|
195
|
-
class: segment.className,
|
|
196
|
-
x1: segment.x1,
|
|
197
|
-
x2: segment.x2,
|
|
198
|
-
y1: segment.y1,
|
|
199
|
-
y2: segment.y2
|
|
200
|
-
})), scene.calmNote != null && hs("text", {
|
|
201
|
-
class: scene.calmNote.className,
|
|
202
|
-
"text-anchor": scene.calmNote.anchor,
|
|
203
|
-
x: scene.calmNote.x,
|
|
204
|
-
y: scene.calmNote.y
|
|
205
|
-
}, scene.calmNote.text), hs("text", {
|
|
206
|
-
class: scene.rowLabels.to.className,
|
|
207
|
-
"text-anchor": scene.rowLabels.to.anchor,
|
|
208
|
-
x: scene.rowLabels.to.x,
|
|
209
|
-
y: scene.rowLabels.to.y
|
|
210
|
-
}, scene.rowLabels.to.text), scene.vanes.map((vane) => vane.mark.kind === "calm" ? hs("text", {
|
|
211
|
-
class: vane.mark.text.className,
|
|
212
|
-
"text-anchor": vane.mark.text.anchor,
|
|
213
|
-
x: vane.mark.text.x,
|
|
214
|
-
y: vane.mark.text.y
|
|
215
|
-
}, vane.mark.text.text) : hs("path", {
|
|
216
|
-
class: vane.mark.className,
|
|
217
|
-
d: vane.mark.d
|
|
218
|
-
})), scene.vanes.flatMap((vane) => vane.label == null ? [] : [hs("text", {
|
|
219
|
-
class: vane.label.className,
|
|
220
|
-
"text-anchor": vane.label.anchor,
|
|
221
|
-
x: vane.label.x,
|
|
222
|
-
y: vane.label.y
|
|
223
|
-
}, vane.label.text)]), hs("text", {
|
|
224
|
-
class: scene.rowLabels.avg.className,
|
|
225
|
-
"text-anchor": scene.rowLabels.avg.anchor,
|
|
226
|
-
x: scene.rowLabels.avg.x,
|
|
227
|
-
y: scene.rowLabels.avg.y
|
|
228
|
-
}, scene.rowLabels.avg.text), scene.vanes.flatMap((vane) => vane.value == null ? [] : [hs("text", {
|
|
229
|
-
class: vane.value.className,
|
|
230
|
-
"text-anchor": vane.value.anchor,
|
|
231
|
-
x: vane.value.x,
|
|
232
|
-
y: vane.value.y
|
|
233
|
-
}, vane.value.text)]), scene.ticks.map((tick) => hs("text", {
|
|
234
|
-
class: tick.className,
|
|
235
|
-
"text-anchor": tick.anchor,
|
|
236
|
-
x: tick.x,
|
|
237
|
-
y: tick.y
|
|
238
|
-
}, tick.text)), hit);
|
|
239
|
-
this.#svg = svg;
|
|
240
|
-
wrap.replaceChildren(readout, svg);
|
|
102
|
+
this.#wrap = wrap;
|
|
103
|
+
wrap.replaceChildren(readout, this.#drawSvg());
|
|
241
104
|
this.#updateCursor();
|
|
242
105
|
}
|
|
106
|
+
#drawSvg() {
|
|
107
|
+
const scene = this.#scene;
|
|
108
|
+
if (scene == null) throw new Error("meteo-wind-history-chart: no scene to draw");
|
|
109
|
+
return renderScene(scene.draw([], {
|
|
110
|
+
onClick: (event) => this.#cursor.handleClick(event),
|
|
111
|
+
onPointerLeave: () => this.#cursor.handlePointerLeave(),
|
|
112
|
+
onPointerMove: (event) => this.#cursor.handlePointerMove(event)
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
243
115
|
#updateCursor() {
|
|
244
116
|
const scene = this.#scene;
|
|
245
117
|
const readout = this.#readout;
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
if (scene == null || readout == null || svg == null || hit == null) return;
|
|
118
|
+
const wrap = this.#wrap;
|
|
119
|
+
if (scene == null || readout == null || wrap == null) return;
|
|
249
120
|
const inspection = scene.inspect(this.#cursor.activeIndex());
|
|
250
121
|
readout.setAttribute("aria-live", readoutAriaLive(this.#cursor.previewIndex));
|
|
251
122
|
readout.replaceChildren(h("strong", null, inspection.readout.strong), readoutSpan(inspection.readout.span));
|
|
123
|
+
const svg = wrap.querySelector("svg");
|
|
124
|
+
const hit = svg?.querySelector(".meteo-hit") ?? null;
|
|
125
|
+
if (svg == null) return;
|
|
252
126
|
for (const mark of [...svg.querySelectorAll(".meteo-cursor, .meteo-cursor-dot")]) mark.remove();
|
|
253
|
-
const
|
|
254
|
-
if (cursor != null) {
|
|
255
|
-
svg.insertBefore(hs("line", {
|
|
256
|
-
class: cursor.line.className,
|
|
257
|
-
x1: cursor.line.x1,
|
|
258
|
-
x2: cursor.line.x2,
|
|
259
|
-
y1: cursor.line.y1,
|
|
260
|
-
y2: cursor.line.y2
|
|
261
|
-
}), hit);
|
|
262
|
-
svg.insertBefore(hs("circle", {
|
|
263
|
-
class: cursor.dot.className,
|
|
264
|
-
cx: cursor.dot.cx,
|
|
265
|
-
cy: cursor.dot.cy,
|
|
266
|
-
r: cursor.dot.r
|
|
267
|
-
}), hit);
|
|
268
|
-
}
|
|
127
|
+
for (const node of renderChildren(inspection.cursor)) svg.insertBefore(node, hit);
|
|
269
128
|
}
|
|
270
129
|
};
|
|
271
|
-
//#endregion
|
|
272
130
|
export { WindHistoryChartElement };
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { HistoryPoint } from "../../contract.js";
|
|
2
2
|
import "../../index.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
|
|
5
|
-
//#region src/elements/elements/WindRoseElement.d.ts
|
|
6
|
-
declare class WindRoseElement extends MeteoStationElement {
|
|
4
|
+
export declare class WindRoseElement extends MeteoStationElement {
|
|
7
5
|
#private;
|
|
8
6
|
static readonly observedAttributes: string[];
|
|
9
7
|
constructor();
|
|
10
8
|
get points(): HistoryPoint[] | undefined;
|
|
11
9
|
set points(value: HistoryPoint[] | undefined);
|
|
12
10
|
protected render(): void;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { WindRoseElement };
|
|
11
|
+
}
|