@azohra/meteo.station 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -17
- package/dist/connectivity.d.ts +2 -2
- package/dist/contract.d.ts +105 -105
- package/dist/derive.js +4 -4
- package/dist/elements/elements/AirExtremesElement.js +5 -18
- package/dist/elements/elements/AirMatrixElement.js +6 -31
- package/dist/elements/elements/ClimatologyDailyPatternElement.js +17 -12
- package/dist/elements/elements/ClimatologyRoseElement.js +5 -15
- package/dist/elements/elements/CompassFanElement.js +5 -64
- package/dist/elements/elements/CurrentConditionsElement.js +7 -26
- package/dist/elements/elements/DailyPatternElement.d.ts +0 -1
- package/dist/elements/elements/DailyPatternElement.js +6 -120
- package/dist/elements/elements/DialElement.js +3 -95
- package/dist/elements/elements/FavorableShareElement.js +6 -21
- package/dist/elements/elements/RecentSummariesElement.js +6 -23
- package/dist/elements/elements/SparklineElement.d.ts +0 -1
- package/dist/elements/elements/SparklineElement.js +4 -39
- package/dist/elements/elements/StationCardElement.js +4 -18
- package/dist/elements/elements/StationFeedElement.js +4 -2
- package/dist/elements/elements/StationStripElement.js +4 -18
- package/dist/elements/elements/StationTableElement.js +15 -51
- package/dist/elements/elements/TrendChartElement.js +21 -69
- package/dist/elements/elements/WindHistoryChartElement.js +23 -164
- package/dist/elements/elements/WindRoseElement.d.ts +0 -1
- package/dist/elements/elements/WindRoseElement.js +6 -70
- package/dist/elements/elements/atoms.d.ts +1 -1
- package/dist/elements/elements/atoms.js +11 -38
- package/dist/elements/index.js +3 -3
- package/dist/elements/lib/fragments.js +8 -37
- package/dist/elements/lib/h.js +1 -1
- package/dist/elements/lib/render.js +30 -0
- package/dist/geometry.js +2 -1
- package/dist/instruments.js +2 -2
- package/dist/react/components/AirExtremes.d.ts +1 -1
- package/dist/react/components/AirExtremes.js +5 -22
- package/dist/react/components/AirMatrix.js +10 -43
- package/dist/react/components/ClimatologyDailyPattern.d.ts +1 -1
- package/dist/react/components/ClimatologyDailyPattern.js +19 -13
- package/dist/react/components/ClimatologyRose.d.ts +1 -1
- package/dist/react/components/ClimatologyRose.js +11 -28
- package/dist/react/components/CompassFan.d.ts +1 -1
- package/dist/react/components/CompassFan.js +6 -73
- package/dist/react/components/CurrentConditions.d.ts +1 -1
- package/dist/react/components/CurrentConditions.js +11 -74
- package/dist/react/components/DailyPattern.d.ts +1 -3
- package/dist/react/components/DailyPattern.js +10 -149
- package/dist/react/components/Dial.d.ts +1 -1
- package/dist/react/components/Dial.js +5 -118
- package/dist/react/components/FavorableShare.d.ts +1 -1
- package/dist/react/components/FavorableShare.js +6 -27
- package/dist/react/components/FreshnessBadge.d.ts +1 -1
- package/dist/react/components/FreshnessBadge.js +5 -12
- package/dist/react/components/RecentSummaries.d.ts +1 -1
- package/dist/react/components/RecentSummaries.js +6 -44
- package/dist/react/components/SceneTree.js +38 -0
- package/dist/react/components/Sparkline.d.ts +1 -1
- package/dist/react/components/Sparkline.js +3 -39
- package/dist/react/components/StationCard.d.ts +2 -2
- package/dist/react/components/StationCard.js +5 -45
- package/dist/react/components/StationStrip.d.ts +1 -1
- package/dist/react/components/StationStrip.js +5 -60
- package/dist/react/components/StationTable.js +21 -75
- package/dist/react/components/TrendChart.js +8 -63
- package/dist/react/components/WindArrow.d.ts +1 -1
- package/dist/react/components/WindArrow.js +3 -15
- package/dist/react/components/WindHistoryChart.js +8 -182
- package/dist/react/components/WindRose.d.ts +1 -3
- package/dist/react/components/WindRose.js +6 -89
- package/dist/react/components/WindSampleStrip.js +8 -115
- package/dist/react/components/atoms.d.ts +5 -5
- package/dist/react/components/atoms.js +12 -48
- package/dist/react/hooks/useStationCurrent.js +3 -2
- package/dist/react/hooks/useStationFeed.js +3 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +5 -5
- package/dist/react/lib/cells.js +4 -24
- package/dist/scene/air-extremes.js +12 -27
- package/dist/scene/air-matrix.js +45 -58
- package/dist/scene/card.js +14 -40
- package/dist/scene/cells.d.ts +4 -0
- package/dist/scene/cells.js +51 -0
- package/dist/scene/chart.js +2 -1
- package/dist/scene/climatology-pattern.d.ts +1 -2
- package/dist/scene/climatology-pattern.js +10 -11
- package/dist/scene/climatology-rose.d.ts +1 -2
- package/dist/scene/climatology-rose.js +14 -33
- package/dist/scene/compass-fan.js +28 -100
- package/dist/scene/current.d.ts +2 -1
- package/dist/scene/current.js +29 -56
- package/dist/scene/daily-pattern.d.ts +1 -3
- package/dist/scene/daily-pattern.js +20 -27
- package/dist/scene/dial-parts.d.ts +1 -0
- package/dist/scene/dial-parts.js +70 -0
- package/dist/scene/dial.d.ts +1 -2
- package/dist/scene/dial.js +48 -136
- package/dist/scene/favorable-share.js +16 -33
- package/dist/scene/glyphs.js +20 -16
- package/dist/scene/index.d.ts +5 -3
- package/dist/scene/node.js +19 -0
- package/dist/scene/recent-summaries.js +26 -63
- package/dist/scene/rose.js +89 -117
- package/dist/scene/sample-strip.d.ts +1 -2
- package/dist/scene/sample-strip.js +35 -36
- package/dist/scene/sparkline.js +31 -40
- package/dist/scene/strip.js +18 -57
- package/dist/scene/table.js +47 -69
- package/dist/scene/trend.d.ts +1 -2
- package/dist/scene/trend.js +29 -55
- package/dist/scene/wind-history.d.ts +1 -2
- package/dist/scene/wind-history.js +41 -51
- package/dist/scene/wind-plot.js +70 -140
- package/dist/server/adapters/campbell.d.ts +7 -7
- package/dist/server/adapters/campbell.js +1 -1
- package/dist/server/adapters/ecowitt.d.ts +8 -8
- package/dist/server/adapters/tempest.d.ts +6 -6
- package/dist/server/adapters/windnerd-climatology.js +4 -3
- package/dist/server/adapters/windnerd-live.js +3 -2
- package/dist/server/adapters/windnerd.d.ts +8 -8
- package/dist/server/adapters/windnerd.js +1 -1
- package/dist/server/config.d.ts +48 -48
- package/dist/server/hologram.js +2 -1
- package/package.json +6 -11
- 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,22 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { pressureAtomScene, speedAtomScene, temperatureAtomScene } from "../../scene/atoms.js";
|
|
2
|
+
import { bandChipNode, directionAtomNode, updatedAtNode, valueAtomNode } from "../../scene/cells.js";
|
|
2
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
3
|
-
import {
|
|
4
|
-
import { directionCellNodes } from "../lib/fragments.js";
|
|
4
|
+
import { renderScene } from "../lib/render.js";
|
|
5
5
|
//#region src/elements/elements/atoms.ts
|
|
6
6
|
const STATION_ATTRIBUTES = ["station-id", "unit"];
|
|
7
|
-
function valueAtomNode(scene) {
|
|
8
|
-
const children = scene.content.kind === "dash" ? [scene.content.text] : [scene.content.text, h("span", { class: scene.content.unit.className }, scene.content.unit.text)];
|
|
9
|
-
return h("data", {
|
|
10
|
-
class: scene.className,
|
|
11
|
-
value: scene.value
|
|
12
|
-
}, ...children);
|
|
13
|
-
}
|
|
14
7
|
var SpeedAtomElement = class extends MeteoStationElement {
|
|
15
8
|
static observedAttributes = [...STATION_ATTRIBUTES];
|
|
16
9
|
render() {
|
|
17
10
|
const station = this.requiredStation(this.component);
|
|
18
11
|
const { unit, words } = this.display();
|
|
19
|
-
this.replaceChildren(valueAtomNode(speedAtomScene(station, this.kind, unit, words)));
|
|
12
|
+
this.replaceChildren(renderScene(valueAtomNode(speedAtomScene(station, this.kind, unit, words))));
|
|
20
13
|
}
|
|
21
14
|
};
|
|
22
15
|
var SpeedElement = class extends SpeedAtomElement {
|
|
@@ -36,7 +29,7 @@ var TemperatureElement = class extends MeteoStationElement {
|
|
|
36
29
|
render() {
|
|
37
30
|
const station = this.requiredStation("meteo-temperature");
|
|
38
31
|
const { words } = this.display();
|
|
39
|
-
this.replaceChildren(valueAtomNode(temperatureAtomScene(station, words)));
|
|
32
|
+
this.replaceChildren(renderScene(valueAtomNode(temperatureAtomScene(station, words))));
|
|
40
33
|
}
|
|
41
34
|
};
|
|
42
35
|
var PressureElement = class extends MeteoStationElement {
|
|
@@ -44,7 +37,7 @@ var PressureElement = class extends MeteoStationElement {
|
|
|
44
37
|
render() {
|
|
45
38
|
const station = this.requiredStation("meteo-pressure");
|
|
46
39
|
const { words } = this.display();
|
|
47
|
-
this.replaceChildren(valueAtomNode(pressureAtomScene(station, words)));
|
|
40
|
+
this.replaceChildren(renderScene(valueAtomNode(pressureAtomScene(station, words))));
|
|
48
41
|
}
|
|
49
42
|
};
|
|
50
43
|
var DirectionElement = class extends MeteoStationElement {
|
|
@@ -52,15 +45,7 @@ var DirectionElement = class extends MeteoStationElement {
|
|
|
52
45
|
render() {
|
|
53
46
|
const station = this.requiredStation("meteo-direction");
|
|
54
47
|
const { favorableDirections, words } = this.display();
|
|
55
|
-
|
|
56
|
-
if (scene.cell == null) {
|
|
57
|
-
this.replaceChildren(h("span", { class: scene.className }, scene.dashText));
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
this.replaceChildren(h("span", {
|
|
61
|
-
"aria-label": scene.ariaLabel,
|
|
62
|
-
class: scene.className
|
|
63
|
-
}, ...directionCellNodes(scene.cell.windAvgMps, scene.cell.windDirectionDeg, words)));
|
|
48
|
+
this.replaceChildren(renderScene(directionAtomNode(station, words, favorableDirections)));
|
|
64
49
|
}
|
|
65
50
|
};
|
|
66
51
|
var UpdatedAtElement = class extends MeteoStationElement {
|
|
@@ -75,22 +60,14 @@ var UpdatedAtElement = class extends MeteoStationElement {
|
|
|
75
60
|
render() {
|
|
76
61
|
const station = this.requiredStation("meteo-updated-at");
|
|
77
62
|
const { formatTime, words } = this.display();
|
|
78
|
-
|
|
63
|
+
this.replaceChildren(renderScene(updatedAtNode({
|
|
79
64
|
formatTime,
|
|
80
65
|
nowMs: Date.now(),
|
|
81
66
|
receivedAtMs: this.receivedAtMsValue(),
|
|
82
67
|
servedAt: this.servedAtValue(),
|
|
83
68
|
station,
|
|
84
69
|
words
|
|
85
|
-
});
|
|
86
|
-
if (scene.kind === "dash") {
|
|
87
|
-
this.replaceChildren(h("span", { class: scene.className }, scene.text));
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
this.replaceChildren(h("time", {
|
|
91
|
-
class: scene.className,
|
|
92
|
-
datetime: scene.dateTime
|
|
93
|
-
}, scene.text));
|
|
70
|
+
})));
|
|
94
71
|
}
|
|
95
72
|
};
|
|
96
73
|
var BandChipElement = class extends MeteoStationElement {
|
|
@@ -114,17 +91,13 @@ var BandChipElement = class extends MeteoStationElement {
|
|
|
114
91
|
render() {
|
|
115
92
|
const station = this.requiredStation("meteo-band-chip");
|
|
116
93
|
const { thresholds, unit, words } = this.display();
|
|
117
|
-
|
|
94
|
+
this.replaceChildren(renderScene(bandChipNode({
|
|
118
95
|
labels: this.#labels,
|
|
119
96
|
station,
|
|
120
97
|
thresholds,
|
|
121
98
|
unit,
|
|
122
99
|
words
|
|
123
|
-
});
|
|
124
|
-
this.replaceChildren(h("span", {
|
|
125
|
-
class: scene.className,
|
|
126
|
-
"data-band": scene.band
|
|
127
|
-
}, scene.text));
|
|
100
|
+
})));
|
|
128
101
|
}
|
|
129
102
|
};
|
|
130
103
|
//#endregion
|
package/dist/elements/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { BandChipElement, DirectionElement, GustElement, LullElement, PressureElement, SpeedElement, TemperatureElement, UpdatedAtElement } from "./elements/atoms.js";
|
|
2
2
|
import { AirExtremesElement } from "./elements/AirExtremesElement.js";
|
|
3
3
|
import { AirMatrixElement } from "./elements/AirMatrixElement.js";
|
|
4
|
-
import { DailyPatternElement } from "./elements/DailyPatternElement.js";
|
|
5
4
|
import { ClimatologyDailyPatternElement } from "./elements/ClimatologyDailyPatternElement.js";
|
|
6
5
|
import { CompassFanElement } from "./elements/CompassFanElement.js";
|
|
7
6
|
import { RecentSummariesElement } from "./elements/RecentSummariesElement.js";
|
|
8
|
-
import { WindRoseElement } from "./elements/WindRoseElement.js";
|
|
9
7
|
import { ClimatologyRoseElement } from "./elements/ClimatologyRoseElement.js";
|
|
10
|
-
import { DialElement } from "./elements/DialElement.js";
|
|
11
8
|
import { CurrentConditionsElement } from "./elements/CurrentConditionsElement.js";
|
|
9
|
+
import { DailyPatternElement } from "./elements/DailyPatternElement.js";
|
|
10
|
+
import { DialElement } from "./elements/DialElement.js";
|
|
12
11
|
import { FavorableShareElement } from "./elements/FavorableShareElement.js";
|
|
13
12
|
import { FreshnessBadgeElement } from "./elements/FreshnessBadgeElement.js";
|
|
14
13
|
import { SparklineElement } from "./elements/SparklineElement.js";
|
|
@@ -18,6 +17,7 @@ import { StationTableElement } from "./elements/StationTableElement.js";
|
|
|
18
17
|
import { TrendChartElement } from "./elements/TrendChartElement.js";
|
|
19
18
|
import { WindArrowElement } from "./elements/WindArrowElement.js";
|
|
20
19
|
import { WindHistoryChartElement } from "./elements/WindHistoryChartElement.js";
|
|
20
|
+
import { WindRoseElement } from "./elements/WindRoseElement.js";
|
|
21
21
|
import { StationCardChartElement, StationCardElement, StationCardHeaderElement, StationCardInstrumentElement, StationCardSummaryElement } from "./elements/StationCardElement.js";
|
|
22
22
|
//#region src/elements/index.ts
|
|
23
23
|
const meteoElementTags = {
|
|
@@ -1,45 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { freshnessBadgeNode, windArrowNode } from "../../scene/glyphs.js";
|
|
2
|
+
import { stationNameNode as stationNameNode$1 } from "../../scene/cells.js";
|
|
3
|
+
import { renderScene } from "./render.js";
|
|
4
4
|
//#region src/elements/lib/fragments.ts
|
|
5
5
|
function windArrowSvg(deg, size = 12) {
|
|
6
|
-
|
|
7
|
-
const svg = hs("svg", {
|
|
8
|
-
"aria-hidden": "true",
|
|
9
|
-
class: spec.className,
|
|
10
|
-
height: spec.height,
|
|
11
|
-
viewBox: spec.viewBox,
|
|
12
|
-
width: spec.width
|
|
13
|
-
}, hs("path", {
|
|
14
|
-
d: spec.path.d,
|
|
15
|
-
fill: spec.path.fill
|
|
16
|
-
}));
|
|
17
|
-
svg.style.transform = spec.transform;
|
|
18
|
-
return svg;
|
|
19
|
-
}
|
|
20
|
-
function directionCellNodes(windAvgMps, windDirectionDeg, words) {
|
|
21
|
-
const cell = directionCell(windAvgMps, windDirectionDeg);
|
|
22
|
-
if (cell.kind === "calm") return [words.calm];
|
|
23
|
-
if (cell.kind === "dash") return ["—"];
|
|
24
|
-
return [windArrowSvg(cell.deg), ` ${cell.compass} ${cell.rounded}°`];
|
|
6
|
+
return renderScene(windArrowNode(deg, size));
|
|
25
7
|
}
|
|
26
8
|
function stationNameNode(station) {
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
href: station.pageUrl,
|
|
30
|
-
rel: "noreferrer",
|
|
31
|
-
target: "_blank"
|
|
32
|
-
}, station.name);
|
|
9
|
+
const node = stationNameNode$1(station);
|
|
10
|
+
return typeof node === "object" && node !== null ? renderScene(node) : node;
|
|
33
11
|
}
|
|
34
12
|
function freshnessBadgeSpan(status, words) {
|
|
35
|
-
|
|
36
|
-
return h("span", {
|
|
37
|
-
class: spec.className,
|
|
38
|
-
"data-freshness": spec.status
|
|
39
|
-
}, h("span", {
|
|
40
|
-
"aria-hidden": "true",
|
|
41
|
-
class: spec.dot.className
|
|
42
|
-
}), spec.text);
|
|
13
|
+
return renderScene(freshnessBadgeNode(status, words));
|
|
43
14
|
}
|
|
44
15
|
//#endregion
|
|
45
|
-
export {
|
|
16
|
+
export { freshnessBadgeSpan, stationNameNode, windArrowSvg };
|
package/dist/elements/lib/h.js
CHANGED
|
@@ -4,7 +4,7 @@ function apply(element, attrs, children) {
|
|
|
4
4
|
if (attrs != null) for (const [name, value] of Object.entries(attrs)) {
|
|
5
5
|
if (value == null || value === false) continue;
|
|
6
6
|
if (typeof value === "function") {
|
|
7
|
-
element.addEventListener(name.slice(2), value);
|
|
7
|
+
element.addEventListener(name.slice(2).toLowerCase(), value);
|
|
8
8
|
continue;
|
|
9
9
|
}
|
|
10
10
|
element.setAttribute(name, value === true ? "" : String(value));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SVG_ROOT_TAGS } from "../../scene/node.js";
|
|
2
|
+
import { h, hs } from "./h.js";
|
|
3
|
+
//#region src/elements/lib/render.ts
|
|
4
|
+
function renderChild(child, svg = false) {
|
|
5
|
+
if (child == null || child === false) return null;
|
|
6
|
+
if (typeof child === "string") return child;
|
|
7
|
+
if (typeof child === "number") return String(child);
|
|
8
|
+
return renderScene(child, svg);
|
|
9
|
+
}
|
|
10
|
+
function renderScene(node, svg = false) {
|
|
11
|
+
const inSvg = svg || SVG_ROOT_TAGS.has(node.tag);
|
|
12
|
+
const children = (node.children ?? []).map((child) => renderChild(child, inSvg));
|
|
13
|
+
const element = inSvg ? hs(node.tag, node.attrs ?? null, ...children) : h(node.tag, node.attrs ?? null, ...children);
|
|
14
|
+
if (node.style !== void 0) {
|
|
15
|
+
const style = element.style;
|
|
16
|
+
for (const [property, value] of Object.entries(node.style)) if (property.startsWith("--")) element.style.setProperty(property, value);
|
|
17
|
+
else style[property] = value;
|
|
18
|
+
}
|
|
19
|
+
return element;
|
|
20
|
+
}
|
|
21
|
+
/** The scene, or nothing when the widget has no surface to draw. */
|
|
22
|
+
function renderOptional(node) {
|
|
23
|
+
return node === null ? [] : [renderScene(node)];
|
|
24
|
+
}
|
|
25
|
+
/** A run of children with no element of their own to sit in. */
|
|
26
|
+
function renderChildren(children) {
|
|
27
|
+
return children.map((child) => renderChild(child)).filter((node) => node !== null);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { renderChild, renderChildren, renderOptional, renderScene };
|
package/dist/geometry.js
CHANGED
|
@@ -87,7 +87,8 @@ function averagePoints(points, scales) {
|
|
|
87
87
|
return tracePointsOf(points, scales, (point) => point.windAvgMps);
|
|
88
88
|
}
|
|
89
89
|
function meanDirectionDegOf(points, speedOf, directionOf) {
|
|
90
|
-
|
|
90
|
+
const blowing = points.filter((point) => !isCalm(speedOf(point)) && directionOf(point) != null);
|
|
91
|
+
return meanDirectionDeg(blowing.map((point) => directionOf(point)));
|
|
91
92
|
}
|
|
92
93
|
function meanDirectionDeg$1(points) {
|
|
93
94
|
return meanDirectionDegOf(points, (point) => point.windAvgMps, (point) => point.windDirectionDeg);
|
package/dist/instruments.js
CHANGED
|
@@ -2,7 +2,7 @@ import { COMPASS_POINTS, KMH_PER_MPS, normalizeDegrees, radians, speedToMps } fr
|
|
|
2
2
|
import { HISTORY_GAP_TOLERANCE_FACTOR } from "./geometry.js";
|
|
3
3
|
//#region src/instruments.ts
|
|
4
4
|
const DIAL_SIZE = 160;
|
|
5
|
-
const DIAL_CENTRE =
|
|
5
|
+
const DIAL_CENTRE = 80;
|
|
6
6
|
const DIAL_RING_RADIUS = 70;
|
|
7
7
|
const DIAL_TICK_INNER = 64;
|
|
8
8
|
const DIAL_CARDINAL_TICK_INNER = 58;
|
|
@@ -62,7 +62,7 @@ const DIAL_CARDINALS = [
|
|
|
62
62
|
}
|
|
63
63
|
];
|
|
64
64
|
const ROSE_SIZE = 190;
|
|
65
|
-
const ROSE_CENTRE =
|
|
65
|
+
const ROSE_CENTRE = 95;
|
|
66
66
|
const ROSE_MAX_RADIUS = 70;
|
|
67
67
|
const ROSE_FAVORABLE_RING_RADIUS = 75;
|
|
68
68
|
const ROSE_HUB_RADIUS = 16;
|
|
@@ -11,6 +11,6 @@ declare function AirExtremes({ station: stationProp, stationId, nowMs, strings:
|
|
|
11
11
|
/** Pinned in tests; defaults to the wall clock. */
|
|
12
12
|
nowMs?: number;
|
|
13
13
|
strings?: StationStringOverrides;
|
|
14
|
-
}): import("react").
|
|
14
|
+
}): import("react").ReactNode;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { AirExtremes };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
|
-
import {
|
|
3
|
+
import { airExtremesScene } from "../../scene/air-extremes.js";
|
|
4
|
+
import { renderOptional } from "./SceneTree.js";
|
|
4
5
|
import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/react/components/AirExtremes.tsx
|
|
7
7
|
/** Derived atmo tiles from served history: the last completed night's low
|
|
8
8
|
* (real astronomy — no coordinates, no tile) and the trailing pressure
|
|
@@ -11,28 +11,11 @@ function AirExtremes({ station: stationProp, stationId, nowMs, strings: stringsP
|
|
|
11
11
|
const context = useStationFeedContext();
|
|
12
12
|
const station = stationProp ?? resolveStation(context, stationId) ?? void 0;
|
|
13
13
|
const { words } = resolveDisplay(context, { strings: stringsProp });
|
|
14
|
-
|
|
15
|
-
if (gate.kind === "hidden") return null;
|
|
16
|
-
const scene = airExtremesScene({
|
|
14
|
+
return renderOptional(airExtremesScene({
|
|
17
15
|
nowMs: nowMs ?? Date.now(),
|
|
18
|
-
station
|
|
16
|
+
station,
|
|
19
17
|
words
|
|
20
|
-
});
|
|
21
|
-
if (scene == null) return null;
|
|
22
|
-
return /* @__PURE__ */ jsx("dl", {
|
|
23
|
-
"aria-label": scene.ariaLabel,
|
|
24
|
-
className: scene.className,
|
|
25
|
-
children: scene.tiles.map((tile) => /* @__PURE__ */ jsxs("div", {
|
|
26
|
-
className: tile.className,
|
|
27
|
-
children: [/* @__PURE__ */ jsx("dt", {
|
|
28
|
-
className: "meteo-microlabel",
|
|
29
|
-
children: tile.label
|
|
30
|
-
}), /* @__PURE__ */ jsx("dd", {
|
|
31
|
-
className: "meteo-air-extremes-value",
|
|
32
|
-
children: tile.value
|
|
33
|
-
})]
|
|
34
|
-
}, tile.key))
|
|
35
|
-
});
|
|
18
|
+
}));
|
|
36
19
|
}
|
|
37
20
|
//#endregion
|
|
38
21
|
export { AirExtremes };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
3
|
import { airMatrixScene } from "../../scene/air-matrix.js";
|
|
4
|
+
import { renderChildren } from "./SceneTree.js";
|
|
4
5
|
import { requireResolved, useStationFeedContext } from "./StationFeedProvider.js";
|
|
5
6
|
import { useId, useState } from "react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -20,61 +21,27 @@ function AirMatrix({ stations: stationsProp, strings: stringsProp, formatTime: f
|
|
|
20
21
|
words
|
|
21
22
|
});
|
|
22
23
|
if (scene == null) return null;
|
|
23
|
-
const rowTemplate = { gridTemplateColumns: scene.matrix.gridTemplateColumns };
|
|
24
24
|
return /* @__PURE__ */ jsxs("section", {
|
|
25
|
-
className:
|
|
25
|
+
className: "meteo-air",
|
|
26
26
|
"data-expanded": expanded,
|
|
27
27
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
28
28
|
"aria-controls": panelId,
|
|
29
29
|
"aria-expanded": expanded,
|
|
30
|
-
className:
|
|
30
|
+
className: "meteo-air-trigger",
|
|
31
31
|
onClick: () => setExpanded((current) => !current),
|
|
32
32
|
type: "button",
|
|
33
33
|
children: [/* @__PURE__ */ jsx("strong", {
|
|
34
|
-
className:
|
|
35
|
-
children: scene.
|
|
34
|
+
className: "meteo-air-title",
|
|
35
|
+
children: scene.title
|
|
36
36
|
}), /* @__PURE__ */ jsx("span", {
|
|
37
|
-
className:
|
|
38
|
-
children: scene.
|
|
37
|
+
className: "meteo-air-summary",
|
|
38
|
+
children: scene.summary
|
|
39
39
|
})]
|
|
40
|
-
}), /* @__PURE__ */
|
|
41
|
-
className:
|
|
40
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
41
|
+
className: "meteo-air-panel",
|
|
42
42
|
hidden: !expanded,
|
|
43
43
|
id: panelId,
|
|
44
|
-
children:
|
|
45
|
-
"aria-label": scene.matrix.ariaLabel,
|
|
46
|
-
className: scene.matrix.className,
|
|
47
|
-
role: "table",
|
|
48
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
49
|
-
className: scene.matrix.head.className,
|
|
50
|
-
role: "row",
|
|
51
|
-
style: rowTemplate,
|
|
52
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
53
|
-
className: scene.matrix.head.corner.className,
|
|
54
|
-
role: "columnheader"
|
|
55
|
-
}), scene.matrix.head.columns.map((column) => /* @__PURE__ */ jsx("span", {
|
|
56
|
-
className: scene.matrix.head.columnClassName,
|
|
57
|
-
role: "columnheader",
|
|
58
|
-
children: column.text
|
|
59
|
-
}, column.key))]
|
|
60
|
-
}), scene.matrix.rows.map((row) => /* @__PURE__ */ jsxs("div", {
|
|
61
|
-
className: row.className,
|
|
62
|
-
role: "row",
|
|
63
|
-
style: rowTemplate,
|
|
64
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
65
|
-
className: row.labelClassName,
|
|
66
|
-
role: "rowheader",
|
|
67
|
-
children: [row.label, /* @__PURE__ */ jsx("small", { children: row.unit })]
|
|
68
|
-
}), row.cells.map((cell) => /* @__PURE__ */ jsx("span", {
|
|
69
|
-
className: cell.className,
|
|
70
|
-
role: "cell",
|
|
71
|
-
children: cell.text
|
|
72
|
-
}, cell.key))]
|
|
73
|
-
}, row.key))]
|
|
74
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
75
|
-
className: scene.note.className,
|
|
76
|
-
children: scene.note.text
|
|
77
|
-
})]
|
|
44
|
+
children: renderChildren(scene.panel)
|
|
78
45
|
})]
|
|
79
46
|
});
|
|
80
47
|
}
|
|
@@ -15,6 +15,6 @@ declare function ClimatologyDailyPattern({ document, months, favorableDirections
|
|
|
15
15
|
plotHeight?: number;
|
|
16
16
|
stationName?: string;
|
|
17
17
|
strings?: StationStringOverrides;
|
|
18
|
-
}): import("react").JSX.Element;
|
|
18
|
+
}): string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { ClimatologyDailyPattern };
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
3
|
import { measuredChartWidth } from "../../geometry.js";
|
|
4
|
-
import { CLIMATOLOGY_PATTERN_CLASS,
|
|
4
|
+
import { CLIMATOLOGY_PATTERN_CLASS, climatologyPatternScene, hasClimatology } from "../../scene/climatology-pattern.js";
|
|
5
|
+
import { renderChildren } from "./SceneTree.js";
|
|
5
6
|
import { useStationFeedContext } from "./StationFeedProvider.js";
|
|
6
|
-
import { DailyPatternSceneView } from "./DailyPattern.js";
|
|
7
7
|
import { useEffect, useId, useRef, useState } from "react";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
9
|
//#region src/react/components/ClimatologyDailyPattern.tsx
|
|
10
10
|
/** The cube's typical day through the daily-pattern drawing, month-filtered
|
|
11
11
|
* client-side. The host owns the document and the filters. */
|
|
12
12
|
function ClimatologyDailyPattern({ document, months, favorableDirections: favorableDirectionsProp, thresholds: thresholdsProp, unit: unitProp, plotHeight, stationName, strings: stringsProp }) {
|
|
13
|
-
const
|
|
13
|
+
const context = useStationFeedContext();
|
|
14
|
+
const { favorableDirections, thresholds, unit, words } = resolveDisplay(context, {
|
|
14
15
|
strings: stringsProp,
|
|
15
16
|
thresholds: thresholdsProp,
|
|
16
17
|
favorableDirections: favorableDirectionsProp,
|
|
@@ -19,7 +20,7 @@ function ClimatologyDailyPattern({ document, months, favorableDirections: favora
|
|
|
19
20
|
const wrapRef = useRef(null);
|
|
20
21
|
const [width, setWidth] = useState(null);
|
|
21
22
|
const hatchId = `meteo-climatology-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
22
|
-
const
|
|
23
|
+
const drawable = hasClimatology(document);
|
|
23
24
|
useEffect(() => {
|
|
24
25
|
const element = wrapRef.current;
|
|
25
26
|
if (!element) return;
|
|
@@ -32,17 +33,22 @@ function ClimatologyDailyPattern({ document, months, favorableDirections: favora
|
|
|
32
33
|
});
|
|
33
34
|
observer.observe(element);
|
|
34
35
|
return () => observer.disconnect();
|
|
35
|
-
}, [
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
}, [drawable]);
|
|
37
|
+
if (!drawable) return renderChildren(climatologyPatternScene({
|
|
38
|
+
document,
|
|
39
|
+
hatchId,
|
|
40
|
+
plotHeight,
|
|
41
|
+
stationName,
|
|
42
|
+
thresholds,
|
|
43
|
+
unit,
|
|
44
|
+
width: 0,
|
|
45
|
+
words
|
|
46
|
+
}));
|
|
41
47
|
return /* @__PURE__ */ jsx("div", {
|
|
42
48
|
className: CLIMATOLOGY_PATTERN_CLASS,
|
|
43
49
|
ref: wrapRef,
|
|
44
|
-
children: width != null &&
|
|
45
|
-
document
|
|
50
|
+
children: width != null && renderChildren(climatologyPatternScene({
|
|
51
|
+
document,
|
|
46
52
|
favorableDirections,
|
|
47
53
|
filters: { months },
|
|
48
54
|
hatchId,
|
|
@@ -52,7 +58,7 @@ function ClimatologyDailyPattern({ document, months, favorableDirections: favora
|
|
|
52
58
|
unit,
|
|
53
59
|
width,
|
|
54
60
|
words
|
|
55
|
-
})
|
|
61
|
+
}))
|
|
56
62
|
});
|
|
57
63
|
}
|
|
58
64
|
//#endregion
|
|
@@ -13,6 +13,6 @@ declare function ClimatologyRose({ document, months, slots, favorableDirections:
|
|
|
13
13
|
favorableDirections?: FavorableDirection[] | null;
|
|
14
14
|
stationName?: string;
|
|
15
15
|
strings?: StationStringOverrides;
|
|
16
|
-
}): import("react").
|
|
16
|
+
}): import("react").ReactNode;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { ClimatologyRose };
|
|
@@ -1,45 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
|
-
import {
|
|
3
|
+
import { climatologyRoseScene } from "../../scene/climatology-rose.js";
|
|
4
|
+
import { renderScene } from "./SceneTree.js";
|
|
4
5
|
import { useStationFeedContext } from "./StationFeedProvider.js";
|
|
5
|
-
import { WindRoseSceneView } from "./WindRose.js";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
6
|
//#region src/react/components/ClimatologyRose.tsx
|
|
8
7
|
/** The whole archive as a stacked rose: the cube's sectors, each wedge split
|
|
9
8
|
* by the document's own thresholds, with the honesty captions beneath. The
|
|
10
9
|
* host owns the document (a fetch-once store) and the filters. */
|
|
11
10
|
function ClimatologyRose({ document, months, slots, favorableDirections: favorableDirectionsProp, stationName, strings: stringsProp }) {
|
|
12
|
-
const
|
|
11
|
+
const context = useStationFeedContext();
|
|
12
|
+
const { favorableDirections, words } = resolveDisplay(context, {
|
|
13
13
|
strings: stringsProp,
|
|
14
14
|
favorableDirections: favorableDirectionsProp
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
className: gate.className,
|
|
19
|
-
role: "note",
|
|
20
|
-
children: gate.text
|
|
21
|
-
});
|
|
22
|
-
const filters = {
|
|
23
|
-
months,
|
|
24
|
-
slots
|
|
25
|
-
};
|
|
26
|
-
const scene = climatologyRoseScene({
|
|
27
|
-
document: gate.document,
|
|
16
|
+
return renderScene(climatologyRoseScene({
|
|
17
|
+
document,
|
|
28
18
|
favorableDirections,
|
|
29
|
-
filters
|
|
19
|
+
filters: {
|
|
20
|
+
months,
|
|
21
|
+
slots
|
|
22
|
+
},
|
|
30
23
|
stationName,
|
|
31
24
|
words
|
|
32
|
-
});
|
|
33
|
-
return /* @__PURE__ */ jsx("div", {
|
|
34
|
-
className: scene.className,
|
|
35
|
-
children: /* @__PURE__ */ jsx(WindRoseSceneView, {
|
|
36
|
-
scene: scene.rose,
|
|
37
|
-
children: scene.captions.map((caption) => /* @__PURE__ */ jsx("p", {
|
|
38
|
-
className: caption.className,
|
|
39
|
-
children: caption.text
|
|
40
|
-
}, caption.key))
|
|
41
|
-
})
|
|
42
|
-
});
|
|
25
|
+
}));
|
|
43
26
|
}
|
|
44
27
|
//#endregion
|
|
45
28
|
export { ClimatologyRose };
|
|
@@ -12,6 +12,6 @@ declare function CompassFan({ samples, station: stationProp, stationId, favorabl
|
|
|
12
12
|
stationId?: string;
|
|
13
13
|
favorableDirections?: FavorableDirection[] | null;
|
|
14
14
|
strings?: StationStringOverrides;
|
|
15
|
-
}): import("react").
|
|
15
|
+
}): import("react").ReactNode;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { CompassFan };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
|
-
import {
|
|
3
|
+
import { compassFanScene, compassFanSource } from "../../scene/compass-fan.js";
|
|
4
|
+
import { renderOptional } from "./SceneTree.js";
|
|
4
5
|
import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/react/components/CompassFan.tsx
|
|
7
7
|
/** The live compass: the newest sample as the solid needle, every sample of
|
|
8
8
|
* the rolling window as a faint fan aged by tenth — a tight fan means
|
|
@@ -14,80 +14,13 @@ function CompassFan({ samples, station: stationProp, stationId, favorableDirecti
|
|
|
14
14
|
strings: stringsProp,
|
|
15
15
|
favorableDirections: favorableDirectionsProp
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
if (gate.kind === "hidden") return null;
|
|
19
|
-
if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
|
|
20
|
-
className: gate.className,
|
|
21
|
-
role: "note",
|
|
22
|
-
children: gate.text
|
|
23
|
-
});
|
|
24
|
-
const scene = compassFanScene({
|
|
17
|
+
return renderOptional(compassFanScene({
|
|
25
18
|
favorableDirections,
|
|
26
|
-
samples:
|
|
19
|
+
samples: compassFanSource(samples, station),
|
|
20
|
+
station,
|
|
27
21
|
stationName: station?.name,
|
|
28
22
|
words
|
|
29
|
-
});
|
|
30
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
31
|
-
"aria-label": scene.svg.ariaLabel,
|
|
32
|
-
className: scene.svg.className,
|
|
33
|
-
height: scene.svg.height,
|
|
34
|
-
role: "img",
|
|
35
|
-
viewBox: scene.svg.viewBox,
|
|
36
|
-
width: scene.svg.width,
|
|
37
|
-
children: [
|
|
38
|
-
/* @__PURE__ */ jsx("circle", {
|
|
39
|
-
className: scene.ring.className,
|
|
40
|
-
cx: scene.ring.cx,
|
|
41
|
-
cy: scene.ring.cy,
|
|
42
|
-
r: scene.ring.r
|
|
43
|
-
}),
|
|
44
|
-
scene.verdictRing && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
|
|
45
|
-
className: scene.verdictRing.unfavorable.className,
|
|
46
|
-
cx: scene.verdictRing.unfavorable.cx,
|
|
47
|
-
cy: scene.verdictRing.unfavorable.cy,
|
|
48
|
-
r: scene.verdictRing.unfavorable.r
|
|
49
|
-
}), scene.verdictRing.favorable.map((arc) => /* @__PURE__ */ jsx("path", {
|
|
50
|
-
className: arc.className,
|
|
51
|
-
d: arc.d
|
|
52
|
-
}, arc.key))] }),
|
|
53
|
-
scene.ticks.map((tick) => /* @__PURE__ */ jsx("line", {
|
|
54
|
-
className: tick.className,
|
|
55
|
-
x1: tick.x1,
|
|
56
|
-
x2: tick.x2,
|
|
57
|
-
y1: tick.y1,
|
|
58
|
-
y2: tick.y2
|
|
59
|
-
}, tick.key)),
|
|
60
|
-
scene.letters.map((letter) => /* @__PURE__ */ jsx("text", {
|
|
61
|
-
className: letter.className,
|
|
62
|
-
textAnchor: letter.anchor,
|
|
63
|
-
x: letter.x,
|
|
64
|
-
y: letter.y,
|
|
65
|
-
children: letter.text
|
|
66
|
-
}, letter.key)),
|
|
67
|
-
scene.ghosts.map((ghost) => /* @__PURE__ */ jsx("path", {
|
|
68
|
-
className: ghost.className,
|
|
69
|
-
d: ghost.d
|
|
70
|
-
}, ghost.key)),
|
|
71
|
-
scene.needle && /* @__PURE__ */ jsxs("g", {
|
|
72
|
-
className: scene.needle.className,
|
|
73
|
-
children: [/* @__PURE__ */ jsx("polygon", {
|
|
74
|
-
className: scene.needle.blade.className,
|
|
75
|
-
points: scene.needle.blade.points
|
|
76
|
-
}), /* @__PURE__ */ jsx("circle", {
|
|
77
|
-
className: scene.needle.counterweight.className,
|
|
78
|
-
cx: scene.needle.counterweight.cx,
|
|
79
|
-
cy: scene.needle.counterweight.cy,
|
|
80
|
-
r: scene.needle.counterweight.r
|
|
81
|
-
})]
|
|
82
|
-
}),
|
|
83
|
-
/* @__PURE__ */ jsx("circle", {
|
|
84
|
-
className: scene.hub.className,
|
|
85
|
-
cx: scene.hub.cx,
|
|
86
|
-
cy: scene.hub.cy,
|
|
87
|
-
r: scene.hub.r
|
|
88
|
-
})
|
|
89
|
-
]
|
|
90
|
-
});
|
|
23
|
+
}));
|
|
91
24
|
}
|
|
92
25
|
//#endregion
|
|
93
26
|
export { CompassFan };
|
|
@@ -12,6 +12,6 @@ declare function CurrentConditions({ station: stationProp, stationId, servedAt:
|
|
|
12
12
|
unit?: SpeedUnit;
|
|
13
13
|
strings?: StationStringOverrides;
|
|
14
14
|
formatTime?: FormatTime;
|
|
15
|
-
}): import("react").
|
|
15
|
+
}): import("react").ReactNode;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { CurrentConditions };
|