@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
package/dist/derive.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { KMH_PER_MPS, degreesToRadians, normalizeDegrees, solarEventsForDate } from "@azohra/meteo.core";
|
|
2
|
-
|
|
2
|
+
// src/derive.ts
|
|
3
3
|
const CALM_THRESHOLD_MPS = .5;
|
|
4
4
|
function isCalm(speedMps) {
|
|
5
5
|
return speedMps < CALM_THRESHOLD_MPS;
|
|
@@ -150,15 +150,15 @@ function lastNightLowC(points, latitude, longitude, nowMs) {
|
|
|
150
150
|
return null;
|
|
151
151
|
}
|
|
152
152
|
const DEFAULT_FRESHNESS_THRESHOLDS = {
|
|
153
|
-
currentForMs:
|
|
154
|
-
staleAfterMs:
|
|
153
|
+
currentForMs: 6e5,
|
|
154
|
+
staleAfterMs: 27e5
|
|
155
155
|
};
|
|
156
156
|
const clampMs = (value, low, high) => Math.min(high, Math.max(low, value));
|
|
157
157
|
function stationFreshnessThresholds(meta) {
|
|
158
|
-
const currentForMs = clampMs(meta.recommendedPollSeconds * 5 * 1e3, 6e4,
|
|
158
|
+
const currentForMs = clampMs(meta.recommendedPollSeconds * 5 * 1e3, 6e4, 6e5);
|
|
159
159
|
return {
|
|
160
160
|
currentForMs,
|
|
161
|
-
staleAfterMs: clampMs(currentForMs * 6,
|
|
161
|
+
staleAfterMs: clampMs(currentForMs * 6, 6e5, 27e5)
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
function anchoredAgeMs(input) {
|
|
@@ -170,5 +170,4 @@ function freshness(input, thresholds = DEFAULT_FRESHNESS_THRESHOLDS) {
|
|
|
170
170
|
if (ageMs <= thresholds.staleAfterMs) return "aging";
|
|
171
171
|
return "stale";
|
|
172
172
|
}
|
|
173
|
-
//#endregion
|
|
174
173
|
export { CALM_THRESHOLD_MPS, COMPASS_POINTS, DEFAULT_FRESHNESS_THRESHOLDS, KMH_PER_MPS, SPEED_UNITS, anchoredAgeMs, compassDirection, freshness, isCalm, lastNightLowC, normalizeDegrees, periodSummary, pressureDeltaHpa, pressureTendency, radians, seaLevelPressureHpa, speedFromMps, speedToMps, speedUnitLabel, stationFreshnessThresholds, thresholdsToMps };
|
package/dist/display.d.ts
CHANGED
|
@@ -2,22 +2,21 @@ import { Station, StationFeed } from "./contract.js";
|
|
|
2
2
|
import { SpeedThresholds, SpeedUnit } from "./derive.js";
|
|
3
3
|
import { FormatTime, StationStringOverrides, StationStrings } from "./strings.js";
|
|
4
4
|
import { FavorableDirection } from "./instruments.js";
|
|
5
|
-
|
|
6
|
-
type DisplayDefaults = {
|
|
5
|
+
export type DisplayDefaults = {
|
|
7
6
|
strings?: StationStringOverrides | undefined;
|
|
8
7
|
unit?: SpeedUnit | undefined;
|
|
9
8
|
formatTime?: FormatTime | undefined;
|
|
10
9
|
thresholds?: SpeedThresholds | undefined;
|
|
11
10
|
favorableDirections?: FavorableDirection[] | undefined;
|
|
12
11
|
};
|
|
13
|
-
type DisplayProps = {
|
|
12
|
+
export type DisplayProps = {
|
|
14
13
|
strings?: StationStringOverrides | undefined;
|
|
15
14
|
unit?: SpeedUnit | undefined;
|
|
16
15
|
formatTime?: FormatTime | undefined;
|
|
17
16
|
thresholds?: SpeedThresholds | null | undefined;
|
|
18
17
|
favorableDirections?: FavorableDirection[] | null | undefined;
|
|
19
18
|
};
|
|
20
|
-
type ResolvedDisplay = {
|
|
19
|
+
export type ResolvedDisplay = {
|
|
21
20
|
strings: StationStringOverrides | undefined;
|
|
22
21
|
words: StationStrings;
|
|
23
22
|
unit: SpeedUnit;
|
|
@@ -25,8 +24,6 @@ type ResolvedDisplay = {
|
|
|
25
24
|
thresholds: SpeedThresholds | undefined;
|
|
26
25
|
favorableDirections: FavorableDirection[] | undefined;
|
|
27
26
|
};
|
|
28
|
-
declare function resolveDisplay(defaults: DisplayDefaults | null | undefined, props: DisplayProps): ResolvedDisplay;
|
|
29
|
-
declare function resolveStation(feed: StationFeed | null | undefined, stationId: string | undefined): Station | null;
|
|
30
|
-
declare function requireResolved<T>(component: string, what: string, value: T | null | undefined, ambientHint: string): T;
|
|
31
|
-
//#endregion
|
|
32
|
-
export { DisplayDefaults, DisplayProps, ResolvedDisplay, requireResolved, resolveDisplay, resolveStation };
|
|
27
|
+
export declare function resolveDisplay(defaults: DisplayDefaults | null | undefined, props: DisplayProps): ResolvedDisplay;
|
|
28
|
+
export declare function resolveStation(feed: StationFeed | null | undefined, stationId: string | undefined): Station | null;
|
|
29
|
+
export declare function requireResolved<T>(component: string, what: string, value: T | null | undefined, ambientHint: string): T;
|
package/dist/display.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defaultFormatTime, mergeStringOverrides, resolveStrings } from "./strings.js";
|
|
2
|
-
|
|
2
|
+
// src/display.ts
|
|
3
3
|
function resolveDisplay(defaults, props) {
|
|
4
4
|
const strings = mergeStringOverrides(defaults?.strings, props.strings);
|
|
5
5
|
return {
|
|
@@ -24,5 +24,4 @@ function requireResolved(component, what, value, ambientHint) {
|
|
|
24
24
|
if (value == null) throw new Error(`<${component}> resolved no ${what} — pass the prop explicitly or ${ambientHint}.`);
|
|
25
25
|
return value;
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { requireResolved, resolveDisplay, resolveStation };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { MeteoStationElement } from "../lib/base.js";
|
|
2
|
-
|
|
3
|
-
declare class AirExtremesElement extends MeteoStationElement {
|
|
2
|
+
export declare class AirExtremesElement extends MeteoStationElement {
|
|
4
3
|
static readonly observedAttributes: string[];
|
|
5
4
|
protected render(): void;
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
export { AirExtremesElement };
|
|
5
|
+
}
|
|
@@ -1,33 +1,19 @@
|
|
|
1
1
|
import { resolveStation } from "../../display.js";
|
|
2
|
-
import {
|
|
2
|
+
import { airExtremesScene } from "../../scene/air-extremes.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { renderOptional } from "../lib/render.js";
|
|
5
|
+
// src/elements/elements/AirExtremesElement.ts
|
|
6
6
|
var AirExtremesElement = class extends MeteoStationElement {
|
|
7
7
|
static observedAttributes = ["now-ms", "station-id"];
|
|
8
8
|
render() {
|
|
9
9
|
const station = this.station ?? resolveStation(this.ambient()?.feed ?? null, this.getAttribute("station-id") ?? void 0) ?? void 0;
|
|
10
10
|
const { words } = this.display();
|
|
11
|
-
const gate = airExtremesGate(station);
|
|
12
|
-
if (gate.kind === "hidden") {
|
|
13
|
-
this.replaceChildren();
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
11
|
const nowAttribute = Number(this.getAttribute("now-ms"));
|
|
17
|
-
|
|
12
|
+
this.replaceChildren(...renderOptional(airExtremesScene({
|
|
18
13
|
nowMs: Number.isFinite(nowAttribute) && nowAttribute > 0 ? nowAttribute : Date.now(),
|
|
19
|
-
station
|
|
14
|
+
station,
|
|
20
15
|
words
|
|
21
|
-
});
|
|
22
|
-
if (scene == null) {
|
|
23
|
-
this.replaceChildren();
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
this.replaceChildren(h("dl", {
|
|
27
|
-
"aria-label": scene.ariaLabel,
|
|
28
|
-
class: scene.className
|
|
29
|
-
}, scene.tiles.map((tile) => h("div", { class: tile.className }, h("dt", { class: "meteo-microlabel" }, tile.label), h("dd", { class: "meteo-air-extremes-value" }, tile.value)))));
|
|
16
|
+
})));
|
|
30
17
|
}
|
|
31
18
|
};
|
|
32
|
-
//#endregion
|
|
33
19
|
export { AirExtremesElement };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { Station } from "../../contract.js";
|
|
2
2
|
import "../../index.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
|
|
5
|
-
declare class AirMatrixElement extends MeteoStationElement {
|
|
4
|
+
export declare class AirMatrixElement extends MeteoStationElement {
|
|
6
5
|
#private;
|
|
7
6
|
static readonly observedAttributes: string[];
|
|
8
7
|
constructor();
|
|
9
8
|
get stations(): readonly Station[] | undefined;
|
|
10
9
|
set stations(value: readonly Station[] | undefined);
|
|
11
10
|
protected render(): void;
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { AirMatrixElement };
|
|
11
|
+
}
|
|
@@ -3,7 +3,8 @@ 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
|
-
|
|
6
|
+
import { renderScene } from "../lib/render.js";
|
|
7
|
+
// src/elements/elements/AirMatrixElement.ts
|
|
7
8
|
let panelCounter = 0;
|
|
8
9
|
var AirMatrixElement = class extends MeteoStationElement {
|
|
9
10
|
static observedAttributes = ["received-at-ms", "served-at"];
|
|
@@ -34,50 +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
|
-
//#endregion
|
|
83
57
|
export { AirMatrixElement };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { StationClimatology } from "../../contract-climatology.js";
|
|
2
2
|
import "../../index.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
|
|
5
|
-
declare class ClimatologyDailyPatternElement extends MeteoStationElement {
|
|
4
|
+
export declare class ClimatologyDailyPatternElement extends MeteoStationElement {
|
|
6
5
|
#private;
|
|
7
6
|
static readonly observedAttributes: string[];
|
|
8
7
|
constructor();
|
|
@@ -10,6 +9,4 @@ declare class ClimatologyDailyPatternElement extends MeteoStationElement {
|
|
|
10
9
|
set document(value: StationClimatology | null | undefined);
|
|
11
10
|
protected disconnected(): void;
|
|
12
11
|
protected render(): void;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { ClimatologyDailyPatternElement };
|
|
12
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
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 {
|
|
7
|
-
|
|
6
|
+
import { renderChildren } from "../lib/render.js";
|
|
7
|
+
// src/elements/elements/ClimatologyDailyPatternElement.ts
|
|
8
8
|
let hatchCounter = 0;
|
|
9
9
|
var ClimatologyDailyPatternElement = class extends MeteoStationElement {
|
|
10
10
|
static observedAttributes = [
|
|
@@ -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();
|
|
@@ -80,5 +85,4 @@ var ClimatologyDailyPatternElement = class extends MeteoStationElement {
|
|
|
80
85
|
this.#observer.observe(wrap);
|
|
81
86
|
}
|
|
82
87
|
};
|
|
83
|
-
//#endregion
|
|
84
88
|
export { ClimatologyDailyPatternElement };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { StationClimatology } from "../../contract-climatology.js";
|
|
2
2
|
import "../../index.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
|
|
5
|
-
declare class ClimatologyRoseElement extends MeteoStationElement {
|
|
4
|
+
export declare class ClimatologyRoseElement extends MeteoStationElement {
|
|
6
5
|
#private;
|
|
7
6
|
static readonly observedAttributes: string[];
|
|
8
7
|
constructor();
|
|
9
8
|
get document(): StationClimatology | null | undefined;
|
|
10
9
|
set document(value: StationClimatology | null | undefined);
|
|
11
10
|
protected render(): void;
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { ClimatologyRoseElement };
|
|
11
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
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
|
-
|
|
6
|
-
//#region src/elements/elements/ClimatologyRoseElement.ts
|
|
4
|
+
import { renderScene } from "../lib/render.js";
|
|
5
|
+
// src/elements/elements/ClimatologyRoseElement.ts
|
|
7
6
|
var ClimatologyRoseElement = class extends MeteoStationElement {
|
|
8
7
|
static observedAttributes = [
|
|
9
8
|
"favorable-directions",
|
|
@@ -25,27 +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
|
-
//#endregion
|
|
51
40
|
export { ClimatologyRoseElement };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { LiveSamples } from "../../contract.js";
|
|
2
2
|
import "../../index.js";
|
|
3
3
|
import { MeteoStationElement } from "../lib/base.js";
|
|
4
|
-
|
|
5
|
-
declare class CompassFanElement extends MeteoStationElement {
|
|
4
|
+
export declare class CompassFanElement extends MeteoStationElement {
|
|
6
5
|
#private;
|
|
7
6
|
static readonly observedAttributes: string[];
|
|
8
7
|
constructor();
|
|
9
8
|
get samples(): LiveSamples | null | undefined;
|
|
10
9
|
set samples(value: LiveSamples | null | undefined);
|
|
11
10
|
protected render(): void;
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { CompassFanElement };
|
|
11
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
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 {
|
|
5
|
-
|
|
4
|
+
import { renderOptional } from "../lib/render.js";
|
|
5
|
+
// src/elements/elements/CompassFanElement.ts
|
|
6
6
|
var CompassFanElement = class extends MeteoStationElement {
|
|
7
7
|
static observedAttributes = ["favorable-directions", "station-id"];
|
|
8
8
|
#samples;
|
|
@@ -20,73 +20,13 @@ 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
|
};
|
|
91
|
-
//#endregion
|
|
92
32
|
export { CompassFanElement };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { MeteoStationElement } from "../lib/base.js";
|
|
2
|
-
|
|
3
|
-
declare class CurrentConditionsElement extends MeteoStationElement {
|
|
2
|
+
export declare class CurrentConditionsElement extends MeteoStationElement {
|
|
4
3
|
static readonly observedAttributes: string[];
|
|
5
4
|
protected connected(): void;
|
|
6
5
|
protected render(): void;
|
|
7
|
-
}
|
|
8
|
-
//#endregion
|
|
9
|
-
export { CurrentConditionsElement };
|
|
6
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { currentConditionsScene } from "../../scene/current.js";
|
|
2
2
|
import { MeteoStationElement } from "../lib/base.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//#region src/elements/elements/CurrentConditionsElement.ts
|
|
3
|
+
import { renderScene } from "../lib/render.js";
|
|
4
|
+
// 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,34 +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
|
-
//#endregion
|
|
52
32
|
export { CurrentConditionsElement };
|
|
@@ -1,9 +1,7 @@
|
|
|
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/DailyPatternElement.d.ts
|
|
6
|
-
declare class DailyPatternElement extends MeteoStationElement {
|
|
4
|
+
export declare class DailyPatternElement extends MeteoStationElement {
|
|
7
5
|
#private;
|
|
8
6
|
static readonly observedAttributes: string[];
|
|
9
7
|
constructor();
|
|
@@ -11,6 +9,4 @@ declare class DailyPatternElement extends MeteoStationElement {
|
|
|
11
9
|
set points(value: HistoryPoint[] | undefined);
|
|
12
10
|
protected disconnected(): void;
|
|
13
11
|
protected render(): void;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { DailyPatternElement };
|
|
12
|
+
}
|