@azohra/meteo.station 0.5.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/client/climatology.js +1 -1
- package/dist/client/history.js +3 -11
- package/dist/client/live.d.ts +2 -1
- package/dist/client/live.js +7 -4
- package/dist/client/stores.js +10 -2
- package/dist/climatology.d.ts +1 -1
- package/dist/climatology.js +1 -1
- package/dist/connectivity.d.ts +2 -2
- package/dist/contract.d.ts +98 -98
- package/dist/derive.js +9 -8
- 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 +27 -94
- package/dist/elements/elements/WindHistoryChartElement.js +29 -189
- package/dist/elements/elements/WindRoseElement.d.ts +0 -1
- package/dist/elements/elements/WindRoseElement.js +6 -70
- 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/pinned-cursor.js +48 -0
- package/dist/elements/lib/render.js +30 -0
- package/dist/fixtures.d.ts +6 -2
- package/dist/fixtures.js +30 -2
- package/dist/format.js +7 -3
- package/dist/geometry.d.ts +1 -1
- package/dist/geometry.js +22 -9
- 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 +2 -3
- 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 +13 -86
- package/dist/react/components/WindArrow.d.ts +1 -1
- package/dist/react/components/WindArrow.js +3 -15
- package/dist/react/components/WindHistoryChart.js +12 -205
- package/dist/react/components/WindRose.d.ts +1 -3
- package/dist/react/components/WindRose.js +6 -89
- package/dist/react/components/WindSampleStrip.js +14 -139
- package/dist/react/components/atoms.d.ts +5 -5
- package/dist/react/components/atoms.js +12 -48
- package/dist/react/hooks/useStation.js +28 -50
- package/dist/react/hooks/useStationCurrent.js +3 -2
- package/dist/react/hooks/useStationFeed.d.ts +0 -1
- package/dist/react/hooks/useStationFeed.js +3 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +7 -7
- package/dist/react/lib/cells.js +4 -24
- package/dist/react/lib/use-pinned-cursor.js +32 -0
- package/dist/samples.js +7 -43
- 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 -66
- 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 +10 -11
- package/dist/server/adapters/windnerd.js +3 -13
- package/dist/server/config.d.ts +48 -48
- package/dist/server/hologram.js +2 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -2
- package/dist/windnerd.d.ts +3 -1
- package/dist/windnerd.js +11 -1
- package/package.json +7 -12
- package/schema/README.md +3 -3
- 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
|
@@ -3,6 +3,7 @@ import { airMatrixScene } from "../../scene/air-matrix.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 { renderScene } from "../lib/render.js";
|
|
6
7
|
//#region src/elements/elements/AirMatrixElement.ts
|
|
7
8
|
let panelCounter = 0;
|
|
8
9
|
var AirMatrixElement = class extends MeteoStationElement {
|
|
@@ -34,49 +35,23 @@ var AirMatrixElement = class extends MeteoStationElement {
|
|
|
34
35
|
this.replaceChildren();
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
|
-
const rowStyled = (element) => {
|
|
38
|
-
element.style.gridTemplateColumns = scene.matrix.gridTemplateColumns;
|
|
39
|
-
return element;
|
|
40
|
-
};
|
|
41
38
|
this.replaceChildren(h("section", {
|
|
42
|
-
class:
|
|
39
|
+
class: "meteo-air",
|
|
43
40
|
"data-expanded": String(expanded)
|
|
44
41
|
}, h("button", {
|
|
45
42
|
"aria-controls": this.#panelId,
|
|
46
43
|
"aria-expanded": String(expanded),
|
|
47
|
-
class:
|
|
44
|
+
class: "meteo-air-trigger",
|
|
48
45
|
onclick: () => {
|
|
49
46
|
this.#expanded = !this.#expanded;
|
|
50
47
|
this.requestRender();
|
|
51
48
|
},
|
|
52
49
|
type: "button"
|
|
53
|
-
}, h("strong", { class:
|
|
54
|
-
class:
|
|
50
|
+
}, h("strong", { class: "meteo-air-title" }, scene.title), h("span", { class: "meteo-air-summary" }, scene.summary)), h("div", {
|
|
51
|
+
class: "meteo-air-panel",
|
|
55
52
|
hidden: !expanded,
|
|
56
53
|
id: this.#panelId
|
|
57
|
-
},
|
|
58
|
-
"aria-label": scene.matrix.ariaLabel,
|
|
59
|
-
class: scene.matrix.className,
|
|
60
|
-
role: "table"
|
|
61
|
-
}, rowStyled(h("div", {
|
|
62
|
-
class: scene.matrix.head.className,
|
|
63
|
-
role: "row"
|
|
64
|
-
}, h("span", {
|
|
65
|
-
class: scene.matrix.head.corner.className,
|
|
66
|
-
role: "columnheader"
|
|
67
|
-
}), scene.matrix.head.columns.map((column) => h("span", {
|
|
68
|
-
class: scene.matrix.head.columnClassName,
|
|
69
|
-
role: "columnheader"
|
|
70
|
-
}, column.text)))), scene.matrix.rows.map((row) => rowStyled(h("div", {
|
|
71
|
-
class: row.className,
|
|
72
|
-
role: "row"
|
|
73
|
-
}, h("span", {
|
|
74
|
-
class: row.labelClassName,
|
|
75
|
-
role: "rowheader"
|
|
76
|
-
}, row.label, h("small", null, row.unit)), row.cells.map((cell) => h("span", {
|
|
77
|
-
class: cell.className,
|
|
78
|
-
role: "cell"
|
|
79
|
-
}, cell.text)))))), h("p", { class: scene.note.className }, scene.note.text))));
|
|
54
|
+
}, scene.panel.map((child) => typeof child === "object" && child !== null ? renderScene(child) : child))));
|
|
80
55
|
}
|
|
81
56
|
};
|
|
82
57
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { measuredChartWidth } from "../../geometry.js";
|
|
2
|
-
import { CLIMATOLOGY_PATTERN_CLASS,
|
|
2
|
+
import { CLIMATOLOGY_PATTERN_CLASS, climatologyPatternScene, hasClimatology } from "../../scene/climatology-pattern.js";
|
|
3
3
|
import { numberAttribute, parseMonthsAttribute } from "../lib/attributes.js";
|
|
4
4
|
import { MeteoStationElement } from "../lib/base.js";
|
|
5
5
|
import { h } from "../lib/h.js";
|
|
6
|
-
import {
|
|
6
|
+
import { renderChildren } from "../lib/render.js";
|
|
7
7
|
//#region src/elements/elements/ClimatologyDailyPatternElement.ts
|
|
8
8
|
let hatchCounter = 0;
|
|
9
9
|
var ClimatologyDailyPatternElement = class extends MeteoStationElement {
|
|
@@ -35,22 +35,27 @@ var ClimatologyDailyPatternElement = class extends MeteoStationElement {
|
|
|
35
35
|
}
|
|
36
36
|
render() {
|
|
37
37
|
const { favorableDirections, thresholds, unit, words } = this.display();
|
|
38
|
-
|
|
39
|
-
if (gate.kind === "note") {
|
|
38
|
+
if (!hasClimatology(this.#document)) {
|
|
40
39
|
this.#observer?.disconnect();
|
|
41
40
|
this.#observer = null;
|
|
42
|
-
this.replaceChildren(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
this.replaceChildren(...renderChildren(climatologyPatternScene({
|
|
42
|
+
document: this.#document,
|
|
43
|
+
hatchId: "",
|
|
44
|
+
plotHeight: void 0,
|
|
45
|
+
stationName: void 0,
|
|
46
|
+
thresholds: void 0,
|
|
47
|
+
unit,
|
|
48
|
+
width: 0,
|
|
49
|
+
words
|
|
50
|
+
})));
|
|
46
51
|
return;
|
|
47
52
|
}
|
|
48
53
|
const wrap = h("div", { class: CLIMATOLOGY_PATTERN_CLASS });
|
|
49
54
|
this.replaceChildren(wrap);
|
|
50
55
|
this.#observe(wrap);
|
|
51
56
|
if (this.#width == null) return;
|
|
52
|
-
const
|
|
53
|
-
document:
|
|
57
|
+
const scene = climatologyPatternScene({
|
|
58
|
+
document: this.#document,
|
|
54
59
|
favorableDirections,
|
|
55
60
|
filters: { months: parseMonthsAttribute(this.getAttribute("months")) },
|
|
56
61
|
hatchId: `meteo-climatology-hatch-e${++hatchCounter}`,
|
|
@@ -60,8 +65,8 @@ var ClimatologyDailyPatternElement = class extends MeteoStationElement {
|
|
|
60
65
|
unit,
|
|
61
66
|
width: this.#width,
|
|
62
67
|
words
|
|
63
|
-
})
|
|
64
|
-
wrap.replaceChildren(
|
|
68
|
+
});
|
|
69
|
+
wrap.replaceChildren(...renderChildren(scene));
|
|
65
70
|
}
|
|
66
71
|
#observe(wrap) {
|
|
67
72
|
this.#observer?.disconnect();
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { climatologyRoseScene } from "../../scene/climatology-rose.js";
|
|
2
2
|
import { parseMonthsAttribute, parseSlotsAttribute } from "../lib/attributes.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
import {
|
|
5
|
-
import { windRoseSceneDom } from "./WindRoseElement.js";
|
|
4
|
+
import { renderScene } from "../lib/render.js";
|
|
6
5
|
//#region src/elements/elements/ClimatologyRoseElement.ts
|
|
7
6
|
var ClimatologyRoseElement = class extends MeteoStationElement {
|
|
8
7
|
static observedAttributes = [
|
|
@@ -25,26 +24,17 @@ var ClimatologyRoseElement = class extends MeteoStationElement {
|
|
|
25
24
|
}
|
|
26
25
|
render() {
|
|
27
26
|
const { favorableDirections, words } = this.display();
|
|
28
|
-
const gate = climatologyRoseGate(this.#document, words);
|
|
29
|
-
if (gate.kind === "note") {
|
|
30
|
-
this.replaceChildren(h("div", {
|
|
31
|
-
class: gate.className,
|
|
32
|
-
role: "note"
|
|
33
|
-
}, gate.text));
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
27
|
const filters = {
|
|
37
28
|
months: parseMonthsAttribute(this.getAttribute("months")),
|
|
38
29
|
slots: parseSlotsAttribute(this.getAttribute("slots"))
|
|
39
30
|
};
|
|
40
|
-
|
|
41
|
-
document:
|
|
31
|
+
this.replaceChildren(renderScene(climatologyRoseScene({
|
|
32
|
+
document: this.#document,
|
|
42
33
|
favorableDirections,
|
|
43
34
|
filters,
|
|
44
35
|
stationName: this.getAttribute("station-name") ?? void 0,
|
|
45
36
|
words
|
|
46
|
-
});
|
|
47
|
-
this.replaceChildren(h("div", { class: scene.className }, windRoseSceneDom(scene.rose, ...scene.captions.map((caption) => h("p", { class: caption.className }, caption.text)))));
|
|
37
|
+
})));
|
|
48
38
|
}
|
|
49
39
|
};
|
|
50
40
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveStation } from "../../display.js";
|
|
2
|
-
import {
|
|
2
|
+
import { compassFanScene, compassFanSource } from "../../scene/compass-fan.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
import {
|
|
4
|
+
import { renderOptional } from "../lib/render.js";
|
|
5
5
|
//#region src/elements/elements/CompassFanElement.ts
|
|
6
6
|
var CompassFanElement = class extends MeteoStationElement {
|
|
7
7
|
static observedAttributes = ["favorable-directions", "station-id"];
|
|
@@ -20,71 +20,12 @@ var CompassFanElement = class extends MeteoStationElement {
|
|
|
20
20
|
render() {
|
|
21
21
|
const station = this.station ?? (this.#samples == null ? resolveStation(this.ambient()?.feed ?? null, this.getAttribute("station-id") ?? void 0) ?? void 0 : void 0);
|
|
22
22
|
const { favorableDirections, words } = this.display();
|
|
23
|
-
|
|
24
|
-
if (gate.kind === "hidden") {
|
|
25
|
-
this.replaceChildren();
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (gate.kind === "note") {
|
|
29
|
-
this.replaceChildren(h("div", {
|
|
30
|
-
class: gate.className,
|
|
31
|
-
role: "note"
|
|
32
|
-
}, gate.text));
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const scene = compassFanScene({
|
|
23
|
+
this.replaceChildren(...renderOptional(compassFanScene({
|
|
36
24
|
favorableDirections,
|
|
37
|
-
samples:
|
|
25
|
+
samples: compassFanSource(this.#samples, station),
|
|
26
|
+
station,
|
|
38
27
|
stationName: station?.name,
|
|
39
28
|
words
|
|
40
|
-
});
|
|
41
|
-
this.replaceChildren(hs("svg", {
|
|
42
|
-
"aria-label": scene.svg.ariaLabel,
|
|
43
|
-
class: scene.svg.className,
|
|
44
|
-
height: scene.svg.height,
|
|
45
|
-
role: "img",
|
|
46
|
-
viewBox: scene.svg.viewBox,
|
|
47
|
-
width: scene.svg.width
|
|
48
|
-
}, hs("circle", {
|
|
49
|
-
class: scene.ring.className,
|
|
50
|
-
cx: scene.ring.cx,
|
|
51
|
-
cy: scene.ring.cy,
|
|
52
|
-
r: scene.ring.r
|
|
53
|
-
}), scene.verdictRing != null ? [hs("circle", {
|
|
54
|
-
class: scene.verdictRing.unfavorable.className,
|
|
55
|
-
cx: scene.verdictRing.unfavorable.cx,
|
|
56
|
-
cy: scene.verdictRing.unfavorable.cy,
|
|
57
|
-
r: scene.verdictRing.unfavorable.r
|
|
58
|
-
}), scene.verdictRing.favorable.map((arc) => hs("path", {
|
|
59
|
-
class: arc.className,
|
|
60
|
-
d: arc.d
|
|
61
|
-
}))] : null, scene.ticks.map((tick) => hs("line", {
|
|
62
|
-
class: tick.className,
|
|
63
|
-
x1: tick.x1,
|
|
64
|
-
x2: tick.x2,
|
|
65
|
-
y1: tick.y1,
|
|
66
|
-
y2: tick.y2
|
|
67
|
-
})), scene.letters.map((letter) => hs("text", {
|
|
68
|
-
class: letter.className,
|
|
69
|
-
"text-anchor": letter.anchor,
|
|
70
|
-
x: letter.x,
|
|
71
|
-
y: letter.y
|
|
72
|
-
}, letter.text)), scene.ghosts.map((ghost) => hs("path", {
|
|
73
|
-
class: ghost.className,
|
|
74
|
-
d: ghost.d
|
|
75
|
-
})), scene.needle != null && hs("g", { class: scene.needle.className }, hs("polygon", {
|
|
76
|
-
class: scene.needle.blade.className,
|
|
77
|
-
points: scene.needle.blade.points
|
|
78
|
-
}), hs("circle", {
|
|
79
|
-
class: scene.needle.counterweight.className,
|
|
80
|
-
cx: scene.needle.counterweight.cx,
|
|
81
|
-
cy: scene.needle.counterweight.cy,
|
|
82
|
-
r: scene.needle.counterweight.r
|
|
83
|
-
})), hs("circle", {
|
|
84
|
-
class: scene.hub.className,
|
|
85
|
-
cx: scene.hub.cx,
|
|
86
|
-
cy: scene.hub.cy,
|
|
87
|
-
r: scene.hub.r
|
|
88
29
|
})));
|
|
89
30
|
}
|
|
90
31
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { currentConditionsScene } from "../../scene/current.js";
|
|
2
2
|
import { MeteoStationElement } from "../lib/base.js";
|
|
3
|
-
import {
|
|
4
|
-
import { freshnessBadgeSpan, windArrowSvg } from "../lib/fragments.js";
|
|
5
|
-
import { dialSvg } from "./DialElement.js";
|
|
3
|
+
import { renderScene } from "../lib/render.js";
|
|
6
4
|
//#region src/elements/elements/CurrentConditionsElement.ts
|
|
5
|
+
let bezelCounter = 0;
|
|
7
6
|
var CurrentConditionsElement = class extends MeteoStationElement {
|
|
8
7
|
static observedAttributes = [
|
|
9
8
|
"received-at-ms",
|
|
@@ -19,33 +18,15 @@ var CurrentConditionsElement = class extends MeteoStationElement {
|
|
|
19
18
|
const station = this.requiredStation("meteo-current-conditions");
|
|
20
19
|
const { formatTime, thresholds, unit, words } = this.display();
|
|
21
20
|
const status = this.freshnessOf(station);
|
|
22
|
-
|
|
21
|
+
this.replaceChildren(renderScene(currentConditionsScene({
|
|
22
|
+
bezelId: `meteo-bezel-e${++bezelCounter}`,
|
|
23
23
|
formatTime,
|
|
24
|
-
|
|
25
|
-
unit,
|
|
26
|
-
words
|
|
27
|
-
});
|
|
28
|
-
const { direction, temperature, footer } = scene;
|
|
29
|
-
const directionChildren = direction.content.kind === "text" ? [direction.content.text] : [
|
|
30
|
-
h("span", { class: direction.content.labelClassName }, direction.content.label),
|
|
31
|
-
" ",
|
|
32
|
-
windArrowSvg(direction.content.deg),
|
|
33
|
-
" ",
|
|
34
|
-
h("strong", null, direction.content.compass),
|
|
35
|
-
direction.content.tail
|
|
36
|
-
];
|
|
37
|
-
this.replaceChildren(h("div", {
|
|
38
|
-
"aria-label": scene.root.ariaLabel,
|
|
39
|
-
class: scene.root.className,
|
|
40
|
-
"data-status": scene.root.status,
|
|
41
|
-
role: "group"
|
|
42
|
-
}, h("div", { class: scene.instrumentClassName }, scene.flanks != null && h("div", { class: scene.flanks.lull.className }, h("small", { class: scene.flanks.lull.labelClassName }, scene.flanks.lull.label), h("strong", null, scene.flanks.lull.value)), dialSvg({
|
|
24
|
+
freshness: status,
|
|
43
25
|
station,
|
|
44
26
|
thresholds,
|
|
45
27
|
unit,
|
|
46
|
-
words
|
|
47
|
-
|
|
48
|
-
}), scene.flanks != null && h("div", { class: scene.flanks.gust.className }, h("small", { class: scene.flanks.gust.labelClassName }, scene.flanks.gust.label), h("strong", null, scene.flanks.gust.value))), h("p", { class: direction.className }, ...directionChildren), temperature != null && h("p", { class: temperature.className }, temperature.text, temperature.chill != null && h("span", { class: temperature.chill.className }, temperature.chill.text)), h("p", { class: footer.className }, status != null && freshnessBadgeSpan(status, words), h("span", { class: footer.observed.className }, footer.observed.text))));
|
|
28
|
+
words
|
|
29
|
+
})));
|
|
49
30
|
}
|
|
50
31
|
};
|
|
51
32
|
//#endregion
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { HistoryPoint } from "../../contract.js";
|
|
2
2
|
import "../../index.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
import "../../scene/index.js";
|
|
5
4
|
//#region src/elements/elements/DailyPatternElement.d.ts
|
|
6
5
|
declare class DailyPatternElement extends MeteoStationElement {
|
|
7
6
|
#private;
|
|
@@ -3,7 +3,8 @@ import { measuredChartWidth } from "../../geometry.js";
|
|
|
3
3
|
import { DAILY_PATTERN_CLASS, dailyPatternGate, dailyPatternScene, dailyPatternSource } from "../../scene/daily-pattern.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 } from "../lib/render.js";
|
|
7
8
|
//#region src/elements/elements/DailyPatternElement.ts
|
|
8
9
|
let hatchCounter = 0;
|
|
9
10
|
var DailyPatternElement = class extends MeteoStationElement {
|
|
@@ -71,7 +72,7 @@ var DailyPatternElement = class extends MeteoStationElement {
|
|
|
71
72
|
this.#observer.observe(wrap);
|
|
72
73
|
}
|
|
73
74
|
#buildChart(wrap, points, periodMinutes, thresholds, favorableDirections, unit, words, width, stationName) {
|
|
74
|
-
const
|
|
75
|
+
const scene = dailyPatternScene({
|
|
75
76
|
favorableDirections,
|
|
76
77
|
hatchId: `meteo-daily-pattern-hatch-e${++hatchCounter}`,
|
|
77
78
|
periodMinutes,
|
|
@@ -84,124 +85,9 @@ var DailyPatternElement = class extends MeteoStationElement {
|
|
|
84
85
|
utcOffsetMinutes: numberAttribute(this.getAttribute("utc-offset-minutes")) ?? 0,
|
|
85
86
|
width,
|
|
86
87
|
words
|
|
87
|
-
})
|
|
88
|
-
wrap.replaceChildren(
|
|
88
|
+
});
|
|
89
|
+
wrap.replaceChildren(...renderChildren(scene));
|
|
89
90
|
}
|
|
90
91
|
};
|
|
91
|
-
/** One scene, one drawing — shared by the history-fed pattern above and the
|
|
92
|
-
* climatology-fed twin. */
|
|
93
|
-
function dailyPatternSceneDom(scene) {
|
|
94
|
-
return {
|
|
95
|
-
caption: h("output", { class: scene.caption.className }, scene.caption.text),
|
|
96
|
-
svg: hs("svg", {
|
|
97
|
-
"aria-label": scene.svg.ariaLabel,
|
|
98
|
-
class: scene.svg.className,
|
|
99
|
-
height: scene.svg.height,
|
|
100
|
-
role: "img",
|
|
101
|
-
viewBox: scene.svg.viewBox,
|
|
102
|
-
width: scene.svg.width
|
|
103
|
-
}, hs("defs", null, hs("pattern", {
|
|
104
|
-
height: scene.defs.pattern.height,
|
|
105
|
-
id: scene.defs.pattern.id,
|
|
106
|
-
patternTransform: scene.defs.pattern.transform,
|
|
107
|
-
patternUnits: scene.defs.pattern.units,
|
|
108
|
-
width: scene.defs.pattern.width
|
|
109
|
-
}, hs("line", {
|
|
110
|
-
class: scene.defs.pattern.line.className,
|
|
111
|
-
x1: scene.defs.pattern.line.x1,
|
|
112
|
-
x2: scene.defs.pattern.line.x2,
|
|
113
|
-
y1: scene.defs.pattern.line.y1,
|
|
114
|
-
y2: scene.defs.pattern.line.y2
|
|
115
|
-
}))), scene.zones.map((zone) => hs("rect", {
|
|
116
|
-
class: zone.className,
|
|
117
|
-
height: zone.height,
|
|
118
|
-
width: zone.width,
|
|
119
|
-
x: zone.x,
|
|
120
|
-
y: zone.y
|
|
121
|
-
})), scene.grid.map(({ line, label }) => hs("g", null, hs("line", {
|
|
122
|
-
class: line.className,
|
|
123
|
-
x1: line.x1,
|
|
124
|
-
x2: line.x2,
|
|
125
|
-
y1: line.y1,
|
|
126
|
-
y2: line.y2
|
|
127
|
-
}), hs("text", {
|
|
128
|
-
class: label.className,
|
|
129
|
-
"text-anchor": label.anchor,
|
|
130
|
-
x: label.x,
|
|
131
|
-
y: label.y
|
|
132
|
-
}, label.text))), scene.thresholdGuides.map(({ line, label }) => hs("g", null, hs("line", {
|
|
133
|
-
class: line.className,
|
|
134
|
-
x1: line.x1,
|
|
135
|
-
x2: line.x2,
|
|
136
|
-
y1: line.y1,
|
|
137
|
-
y2: line.y2
|
|
138
|
-
}), hs("text", {
|
|
139
|
-
class: label.className,
|
|
140
|
-
"text-anchor": label.anchor,
|
|
141
|
-
x: label.x,
|
|
142
|
-
y: label.y
|
|
143
|
-
}, label.text))), scene.vaneGuides.map((guide) => hs("line", {
|
|
144
|
-
class: guide.className,
|
|
145
|
-
x1: guide.x1,
|
|
146
|
-
x2: guide.x2,
|
|
147
|
-
y1: guide.y1,
|
|
148
|
-
y2: guide.y2
|
|
149
|
-
})), scene.gaps.map((gap) => hs("rect", {
|
|
150
|
-
class: gap.className,
|
|
151
|
-
fill: gap.fill,
|
|
152
|
-
height: gap.height,
|
|
153
|
-
width: gap.width,
|
|
154
|
-
x: gap.x,
|
|
155
|
-
y: gap.y
|
|
156
|
-
})), scene.mean.kind === "polyline" ? hs("polyline", {
|
|
157
|
-
class: scene.mean.className,
|
|
158
|
-
points: scene.mean.points
|
|
159
|
-
}) : scene.mean.segments.map((segment) => hs("line", {
|
|
160
|
-
class: segment.className,
|
|
161
|
-
x1: segment.x1,
|
|
162
|
-
x2: segment.x2,
|
|
163
|
-
y1: segment.y1,
|
|
164
|
-
y2: segment.y2
|
|
165
|
-
})), scene.calmNote != null && hs("text", {
|
|
166
|
-
class: scene.calmNote.className,
|
|
167
|
-
"text-anchor": scene.calmNote.anchor,
|
|
168
|
-
x: scene.calmNote.x,
|
|
169
|
-
y: scene.calmNote.y
|
|
170
|
-
}, scene.calmNote.text), hs("text", {
|
|
171
|
-
class: scene.rowLabels.to.className,
|
|
172
|
-
"text-anchor": scene.rowLabels.to.anchor,
|
|
173
|
-
x: scene.rowLabels.to.x,
|
|
174
|
-
y: scene.rowLabels.to.y
|
|
175
|
-
}, scene.rowLabels.to.text), scene.vanes.map((vane) => vane.mark.kind === "calm" ? hs("text", {
|
|
176
|
-
class: vane.mark.text.className,
|
|
177
|
-
"text-anchor": vane.mark.text.anchor,
|
|
178
|
-
x: vane.mark.text.x,
|
|
179
|
-
y: vane.mark.text.y
|
|
180
|
-
}, vane.mark.text.text) : hs("path", {
|
|
181
|
-
class: vane.mark.className,
|
|
182
|
-
d: vane.mark.d
|
|
183
|
-
})), scene.vanes.flatMap((vane) => vane.label == null ? [] : [hs("text", {
|
|
184
|
-
class: vane.label.className,
|
|
185
|
-
"text-anchor": vane.label.anchor,
|
|
186
|
-
x: vane.label.x,
|
|
187
|
-
y: vane.label.y
|
|
188
|
-
}, vane.label.text)]), hs("text", {
|
|
189
|
-
class: scene.rowLabels.avg.className,
|
|
190
|
-
"text-anchor": scene.rowLabels.avg.anchor,
|
|
191
|
-
x: scene.rowLabels.avg.x,
|
|
192
|
-
y: scene.rowLabels.avg.y
|
|
193
|
-
}, scene.rowLabels.avg.text), scene.vanes.flatMap((vane) => vane.value == null ? [] : [hs("text", {
|
|
194
|
-
class: vane.value.className,
|
|
195
|
-
"text-anchor": vane.value.anchor,
|
|
196
|
-
x: vane.value.x,
|
|
197
|
-
y: vane.value.y
|
|
198
|
-
}, vane.value.text)]), scene.ticks.map((tick) => hs("text", {
|
|
199
|
-
class: tick.className,
|
|
200
|
-
"text-anchor": tick.anchor,
|
|
201
|
-
x: tick.x,
|
|
202
|
-
y: tick.y
|
|
203
|
-
}, tick.text)))
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
92
|
//#endregion
|
|
207
|
-
export { DailyPatternElement
|
|
93
|
+
export { DailyPatternElement };
|
|
@@ -2,12 +2,12 @@ import "../../instruments.js";
|
|
|
2
2
|
import { dialScene } from "../../scene/dial.js";
|
|
3
3
|
import { numberAttribute } from "../lib/attributes.js";
|
|
4
4
|
import { MeteoStationElement } from "../lib/base.js";
|
|
5
|
-
import {
|
|
5
|
+
import { renderScene } from "../lib/render.js";
|
|
6
6
|
//#region src/elements/elements/DialElement.ts
|
|
7
7
|
let bezelCounter = 0;
|
|
8
8
|
function dialSvg(options) {
|
|
9
9
|
const { station, thresholds, favorableDirections, unit, words, size = 160, calmWord = true } = options;
|
|
10
|
-
|
|
10
|
+
return renderScene(dialScene({
|
|
11
11
|
bezelId: `meteo-bezel-e${++bezelCounter}`,
|
|
12
12
|
calmWord,
|
|
13
13
|
favorableDirections,
|
|
@@ -16,99 +16,7 @@ function dialSvg(options) {
|
|
|
16
16
|
thresholds,
|
|
17
17
|
unit,
|
|
18
18
|
words
|
|
19
|
-
});
|
|
20
|
-
const { gradient, centre } = scene;
|
|
21
|
-
return hs("svg", {
|
|
22
|
-
"aria-label": scene.svg.ariaLabel,
|
|
23
|
-
class: scene.svg.className,
|
|
24
|
-
height: scene.svg.height,
|
|
25
|
-
role: "img",
|
|
26
|
-
viewBox: scene.svg.viewBox,
|
|
27
|
-
width: scene.svg.width
|
|
28
|
-
}, hs("defs", null, hs("radialGradient", {
|
|
29
|
-
cx: gradient.cx,
|
|
30
|
-
cy: gradient.cy,
|
|
31
|
-
id: gradient.id,
|
|
32
|
-
r: gradient.r
|
|
33
|
-
}, gradient.stops.map((stop) => hs("stop", {
|
|
34
|
-
class: stop.className,
|
|
35
|
-
offset: stop.offset
|
|
36
|
-
})))), hs("circle", {
|
|
37
|
-
class: scene.face.className,
|
|
38
|
-
cx: scene.face.cx,
|
|
39
|
-
cy: scene.face.cy,
|
|
40
|
-
r: scene.face.r
|
|
41
|
-
}), hs("circle", {
|
|
42
|
-
class: scene.bezel.className,
|
|
43
|
-
cx: scene.bezel.cx,
|
|
44
|
-
cy: scene.bezel.cy,
|
|
45
|
-
fill: scene.bezel.fill,
|
|
46
|
-
r: scene.bezel.r
|
|
47
|
-
}), hs("circle", {
|
|
48
|
-
class: scene.ring.className,
|
|
49
|
-
cx: scene.ring.cx,
|
|
50
|
-
cy: scene.ring.cy,
|
|
51
|
-
r: scene.ring.r
|
|
52
|
-
}), scene.verdictRing != null ? [hs("circle", {
|
|
53
|
-
class: scene.verdictRing.unfavorable.className,
|
|
54
|
-
cx: scene.verdictRing.unfavorable.cx,
|
|
55
|
-
cy: scene.verdictRing.unfavorable.cy,
|
|
56
|
-
r: scene.verdictRing.unfavorable.r
|
|
57
|
-
}), scene.verdictRing.favorable.map((arc) => hs("path", {
|
|
58
|
-
class: arc.className,
|
|
59
|
-
d: arc.d
|
|
60
|
-
}))] : null, scene.arc != null && hs("path", {
|
|
61
|
-
class: scene.arc.className,
|
|
62
|
-
d: scene.arc.d
|
|
63
|
-
}), scene.ticks.map((tick) => hs("line", {
|
|
64
|
-
class: tick.className,
|
|
65
|
-
x1: tick.x1,
|
|
66
|
-
x2: tick.x2,
|
|
67
|
-
y1: tick.y1,
|
|
68
|
-
y2: tick.y2
|
|
69
|
-
})), scene.letters.map((letter) => hs("text", {
|
|
70
|
-
class: letter.className,
|
|
71
|
-
"text-anchor": letter.anchor,
|
|
72
|
-
x: letter.x,
|
|
73
|
-
y: letter.y
|
|
74
|
-
}, letter.text)), scene.needle != null && hs("g", { class: scene.needle.className }, hs("polygon", {
|
|
75
|
-
class: scene.needle.blade.className,
|
|
76
|
-
points: scene.needle.blade.points
|
|
77
|
-
}), hs("circle", {
|
|
78
|
-
class: scene.needle.counterweight.className,
|
|
79
|
-
cx: scene.needle.counterweight.cx,
|
|
80
|
-
cy: scene.needle.counterweight.cy,
|
|
81
|
-
r: scene.needle.counterweight.r
|
|
82
|
-
})), hs("circle", {
|
|
83
|
-
class: scene.hub.className,
|
|
84
|
-
cx: scene.hub.cx,
|
|
85
|
-
cy: scene.hub.cy,
|
|
86
|
-
r: scene.hub.r
|
|
87
|
-
}), centre.kind === "reason" ? hs("text", {
|
|
88
|
-
class: centre.text.className,
|
|
89
|
-
"text-anchor": centre.text.anchor,
|
|
90
|
-
x: centre.text.x,
|
|
91
|
-
y: centre.text.y
|
|
92
|
-
}, centre.text.text) : [
|
|
93
|
-
centre.calmWord != null ? hs("text", {
|
|
94
|
-
class: centre.calmWord.className,
|
|
95
|
-
"text-anchor": centre.calmWord.anchor,
|
|
96
|
-
x: centre.calmWord.x,
|
|
97
|
-
y: centre.calmWord.y
|
|
98
|
-
}, centre.calmWord.text) : null,
|
|
99
|
-
hs("text", {
|
|
100
|
-
class: centre.speed.className,
|
|
101
|
-
"text-anchor": centre.speed.anchor,
|
|
102
|
-
x: centre.speed.x,
|
|
103
|
-
y: centre.speed.y
|
|
104
|
-
}, centre.speed.text),
|
|
105
|
-
hs("text", {
|
|
106
|
-
class: centre.unit.className,
|
|
107
|
-
"text-anchor": centre.unit.anchor,
|
|
108
|
-
x: centre.unit.x,
|
|
109
|
-
y: centre.unit.y
|
|
110
|
-
}, centre.unit.text)
|
|
111
|
-
]);
|
|
19
|
+
}));
|
|
112
20
|
}
|
|
113
21
|
var DialElement = class extends MeteoStationElement {
|
|
114
22
|
static observedAttributes = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveStation } from "../../display.js";
|
|
2
|
-
import {
|
|
2
|
+
import { favorableShareScene, favorableShareSource } from "../../scene/favorable-share.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
import {
|
|
4
|
+
import { renderOptional } from "../lib/render.js";
|
|
5
5
|
//#region src/elements/elements/FavorableShareElement.ts
|
|
6
6
|
var FavorableShareElement = class extends MeteoStationElement {
|
|
7
7
|
static observedAttributes = ["favorable-directions", "station-id"];
|
|
@@ -20,27 +20,12 @@ var FavorableShareElement = class extends MeteoStationElement {
|
|
|
20
20
|
render() {
|
|
21
21
|
const station = this.station ?? (this.#points == null ? resolveStation(this.ambient()?.feed ?? null, this.getAttribute("station-id") ?? void 0) ?? void 0 : void 0);
|
|
22
22
|
const { favorableDirections, words } = this.display();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (gate.kind === "note") {
|
|
29
|
-
this.replaceChildren(h("div", {
|
|
30
|
-
class: gate.className,
|
|
31
|
-
role: "note"
|
|
32
|
-
}, gate.text));
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const scene = favorableShareScene({
|
|
36
|
-
share: gate.share,
|
|
23
|
+
this.replaceChildren(...renderOptional(favorableShareScene({
|
|
24
|
+
favorableDirections,
|
|
25
|
+
source: favorableShareSource(this.#points, station),
|
|
37
26
|
stationName: station?.name,
|
|
38
27
|
words
|
|
39
|
-
});
|
|
40
|
-
this.replaceChildren(h("div", {
|
|
41
|
-
"aria-label": scene.ariaLabel,
|
|
42
|
-
class: scene.className
|
|
43
|
-
}, h("span", { class: scene.label.className }, scene.label.text), " ", h("span", { class: scene.value.className }, scene.value.text)));
|
|
28
|
+
})));
|
|
44
29
|
}
|
|
45
30
|
};
|
|
46
31
|
//#endregion
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { resolveStation } from "../../display.js";
|
|
2
|
-
import {
|
|
2
|
+
import { recentSummariesScene } from "../../scene/recent-summaries.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
import {
|
|
5
|
-
import { windArrowSvg } from "../lib/fragments.js";
|
|
4
|
+
import { renderOptional } from "../lib/render.js";
|
|
6
5
|
//#region src/elements/elements/RecentSummariesElement.ts
|
|
7
6
|
var RecentSummariesElement = class extends MeteoStationElement {
|
|
8
7
|
static observedAttributes = [
|
|
@@ -25,29 +24,13 @@ var RecentSummariesElement = class extends MeteoStationElement {
|
|
|
25
24
|
render() {
|
|
26
25
|
const station = this.station ?? (this.#summaries == null ? resolveStation(this.ambient()?.feed ?? null, this.getAttribute("station-id") ?? void 0) ?? void 0 : void 0);
|
|
27
26
|
const { favorableDirections, unit, words } = this.display();
|
|
28
|
-
|
|
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({
|
|
27
|
+
this.replaceChildren(...renderOptional(recentSummariesScene({
|
|
41
28
|
favorableDirections,
|
|
42
|
-
|
|
43
|
-
summaries:
|
|
29
|
+
station,
|
|
30
|
+
summaries: this.#summaries,
|
|
44
31
|
unit,
|
|
45
32
|
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))))))));
|
|
33
|
+
})));
|
|
51
34
|
}
|
|
52
35
|
};
|
|
53
36
|
//#endregion
|