@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/format.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Station } from "./contract.js";
|
|
2
2
|
import { CompassPoint, SpeedUnit } from "./derive.js";
|
|
3
3
|
import { FormatTime, StationStrings } from "./strings.js";
|
|
4
|
-
|
|
5
|
-
declare function
|
|
6
|
-
declare function
|
|
7
|
-
declare function
|
|
8
|
-
|
|
9
|
-
type
|
|
10
|
-
type DirectionCellData = {
|
|
4
|
+
export declare function roundSpeed(mps: number, unit: SpeedUnit): number;
|
|
5
|
+
export declare function optionalSpeed(mps: number | null, unit: SpeedUnit): string;
|
|
6
|
+
export declare function temperatureValue(temperatureC: number): string;
|
|
7
|
+
export declare function temperatureText(temperatureC: number | null, words: StationStrings): string;
|
|
8
|
+
export type SpeedKind = "average" | "gust" | "lull";
|
|
9
|
+
export type DirectionCellData = {
|
|
11
10
|
kind: "calm";
|
|
12
11
|
} | {
|
|
13
12
|
kind: "dash";
|
|
@@ -17,15 +16,13 @@ type DirectionCellData = {
|
|
|
17
16
|
compass: CompassPoint;
|
|
18
17
|
rounded: number;
|
|
19
18
|
};
|
|
20
|
-
declare function directionCell(windAvgMps: number, windDirectionDeg: number | null): DirectionCellData;
|
|
21
|
-
declare function updatedAtText(ageMs: number, observedAt: string, words: StationStrings, formatTime: FormatTime): string;
|
|
22
|
-
type SummaryEntry = {
|
|
19
|
+
export declare function directionCell(windAvgMps: number, windDirectionDeg: number | null): DirectionCellData;
|
|
20
|
+
export declare function updatedAtText(ageMs: number, observedAt: string, words: StationStrings, formatTime: FormatTime): string;
|
|
21
|
+
export type SummaryEntry = {
|
|
23
22
|
label: string;
|
|
24
23
|
value: string;
|
|
25
24
|
};
|
|
26
|
-
declare function summaryEntries(station: Station, unit: SpeedUnit, words: StationStrings, formatTime: FormatTime): {
|
|
25
|
+
export declare function summaryEntries(station: Station, unit: SpeedUnit, words: StationStrings, formatTime: FormatTime): {
|
|
27
26
|
entries: SummaryEntry[];
|
|
28
27
|
periodEndedAt: string;
|
|
29
|
-
} | null;
|
|
30
|
-
//#endregion
|
|
31
|
-
export { DirectionCellData, SpeedKind, SummaryEntry, directionCell, optionalSpeed, roundSpeed, summaryEntries, temperatureText, temperatureValue, updatedAtText };
|
|
28
|
+
} | null;
|
package/dist/format.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { anchoredAgeMs, compassDirection, isCalm, periodSummary, speedFromMps } from "./derive.js";
|
|
2
|
-
|
|
2
|
+
// src/format.ts
|
|
3
3
|
function roundSpeed(mps, unit) {
|
|
4
4
|
return Math.round(speedFromMps(mps, unit));
|
|
5
5
|
}
|
|
@@ -82,5 +82,4 @@ function summaryEntries(station, unit, words, formatTime) {
|
|
|
82
82
|
periodEndedAt: summary.periodEndedAt
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
//#endregion
|
|
86
85
|
export { UPDATED_ABSOLUTE_AFTER_MS, directionCell, optionalSpeed, readingAgeMs, relativeWords, roundSpeed, speedMpsOf, summaryEntries, temperatureText, temperatureValue, updatedAtText };
|
package/dist/geometry.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { History, HistoryPoint } from "./contract.js";
|
|
2
2
|
import { DirectionArc } from "@azohra/meteo.core";
|
|
3
|
-
|
|
4
|
-
type ChartFrame = {
|
|
3
|
+
export type ChartFrame = {
|
|
5
4
|
height: number;
|
|
6
5
|
labelRow: number;
|
|
7
6
|
left: number;
|
|
@@ -13,12 +12,12 @@ type ChartFrame = {
|
|
|
13
12
|
valueRow: number;
|
|
14
13
|
width: number;
|
|
15
14
|
};
|
|
16
|
-
declare const CHART_FALLBACK_WIDTH = 360;
|
|
17
|
-
declare function measuredChartWidth(measured: number): number;
|
|
18
|
-
type TickAnchor = "end" | "middle" | "start";
|
|
19
|
-
declare function tickAnchor(index: number, lastIndex: number): TickAnchor;
|
|
20
|
-
declare function chartFrame(width: number): ChartFrame;
|
|
21
|
-
type ChartScales = {
|
|
15
|
+
export declare const CHART_FALLBACK_WIDTH = 360;
|
|
16
|
+
export declare function measuredChartWidth(measured: number): number;
|
|
17
|
+
export type TickAnchor = "end" | "middle" | "start";
|
|
18
|
+
export declare function tickAnchor(index: number, lastIndex: number): TickAnchor;
|
|
19
|
+
export declare function chartFrame(width: number): ChartFrame;
|
|
20
|
+
export type ChartScales = {
|
|
22
21
|
startMs: number;
|
|
23
22
|
endMs: number;
|
|
24
23
|
durationMs: number;
|
|
@@ -27,37 +26,37 @@ type ChartScales = {
|
|
|
27
26
|
xAt: (observedAt: string) => number;
|
|
28
27
|
yAt: (speedMps: number) => number;
|
|
29
28
|
};
|
|
30
|
-
type ChartScaleOptions = {
|
|
29
|
+
export type ChartScaleOptions = {
|
|
31
30
|
niceStepMps?: number;
|
|
32
31
|
floorMps?: number;
|
|
33
32
|
};
|
|
34
|
-
declare function chartScales(points: ReadonlyArray<HistoryPoint>, frame: ChartFrame, options?: ChartScaleOptions): ChartScales;
|
|
35
|
-
declare function bandPoints(points: ReadonlyArray<HistoryPoint>, scales: ChartScales): string | null;
|
|
36
|
-
declare function averagePoints(points: ReadonlyArray<HistoryPoint>, scales: ChartScales): string;
|
|
33
|
+
export declare function chartScales(points: ReadonlyArray<HistoryPoint>, frame: ChartFrame, options?: ChartScaleOptions): ChartScales;
|
|
34
|
+
export declare function bandPoints(points: ReadonlyArray<HistoryPoint>, scales: ChartScales): string | null;
|
|
35
|
+
export declare function averagePoints(points: ReadonlyArray<HistoryPoint>, scales: ChartScales): string;
|
|
37
36
|
declare function meanDirectionDeg$1(points: ReadonlyArray<HistoryPoint>): number | null;
|
|
38
|
-
type Vane = {
|
|
37
|
+
export type Vane = {
|
|
39
38
|
windAvgMps: number;
|
|
40
39
|
windDirectionDeg: number | null;
|
|
41
40
|
endIndex: number;
|
|
42
41
|
midMs: number;
|
|
43
42
|
startIndex: number;
|
|
44
43
|
};
|
|
45
|
-
declare function thinVanes(points: ReadonlyArray<HistoryPoint>, target?: number): Vane[];
|
|
46
|
-
declare function vanePath(cx: number, cy: number, fromBearingDeg: number, { reach, spread }?: {
|
|
44
|
+
export declare function thinVanes(points: ReadonlyArray<HistoryPoint>, target?: number): Vane[];
|
|
45
|
+
export declare function vanePath(cx: number, cy: number, fromBearingDeg: number, { reach, spread }?: {
|
|
47
46
|
reach?: number;
|
|
48
47
|
spread?: number;
|
|
49
48
|
}): string;
|
|
50
|
-
type ChartTick = {
|
|
49
|
+
export type ChartTick = {
|
|
51
50
|
index: number;
|
|
52
51
|
timeMs: number;
|
|
53
52
|
x: number;
|
|
54
53
|
};
|
|
55
|
-
declare function vaneTicks(vanes: ReadonlyArray<Vane>, scales: ChartScales, labelCount?: number): ChartTick[];
|
|
56
|
-
declare function nearestIndex(points: ReadonlyArray<{
|
|
54
|
+
export declare function vaneTicks(vanes: ReadonlyArray<Vane>, scales: ChartScales, labelCount?: number): ChartTick[];
|
|
55
|
+
export declare function nearestIndex(points: ReadonlyArray<{
|
|
57
56
|
observedAt: string;
|
|
58
57
|
}>, chartX: number, frame: ChartFrame, scales: ChartScales): number | null;
|
|
59
|
-
declare function speedBand(speedMps: number, thresholdsMps: ReadonlyArray<number>): number;
|
|
60
|
-
type RoseSector = {
|
|
58
|
+
export declare function speedBand(speedMps: number, thresholdsMps: ReadonlyArray<number>): number;
|
|
59
|
+
export type RoseSector = {
|
|
61
60
|
bearingDeg: number;
|
|
62
61
|
frequency: number;
|
|
63
62
|
meanSpeedMps: number | null;
|
|
@@ -67,32 +66,32 @@ type RoseSector = {
|
|
|
67
66
|
* bandThresholdsMps — stacking is a judgment the consumer supplies. */
|
|
68
67
|
bandCounts?: number[] | undefined;
|
|
69
68
|
};
|
|
70
|
-
type WindRoseSummary = {
|
|
69
|
+
export type WindRoseSummary = {
|
|
71
70
|
sectors: RoseSector[];
|
|
72
71
|
calmFraction: number;
|
|
73
72
|
sampleCount: number;
|
|
74
73
|
};
|
|
75
|
-
declare function windRose(points: ReadonlyArray<HistoryPoint>, sectorCount?: number, options?: {
|
|
74
|
+
export declare function windRose(points: ReadonlyArray<HistoryPoint>, sectorCount?: number, options?: {
|
|
76
75
|
bandThresholdsMps?: ReadonlyArray<number>;
|
|
77
76
|
}): WindRoseSummary;
|
|
78
|
-
declare const DAILY_PATTERN_DEFAULT_SLOT_MINUTES = 180;
|
|
79
|
-
type DailyPatternSlot = {
|
|
77
|
+
export declare const DAILY_PATTERN_DEFAULT_SLOT_MINUTES = 180;
|
|
78
|
+
export type DailyPatternSlot = {
|
|
80
79
|
startMinuteOfDay: number;
|
|
81
80
|
sampleCount: number;
|
|
82
81
|
windDirectionDeg: number | null;
|
|
83
82
|
speedMps: number;
|
|
84
83
|
};
|
|
85
|
-
declare function dailyPattern(points: ReadonlyArray<HistoryPoint>, options?: {
|
|
84
|
+
export declare function dailyPattern(points: ReadonlyArray<HistoryPoint>, options?: {
|
|
86
85
|
slotMinutes?: number;
|
|
87
86
|
utcOffsetMinutes?: number;
|
|
88
87
|
}): DailyPatternSlot[];
|
|
89
|
-
declare const METEOROLOGICAL_SEASON_MONTHS: Record<"fall" | "spring" | "summer" | "winter", number[]>;
|
|
90
|
-
declare function filterByMonth(points: ReadonlyArray<HistoryPoint>, months: ReadonlyArray<number>, utcOffsetMinutes?: number): HistoryPoint[];
|
|
91
|
-
declare function filterByTimeOfDay(points: ReadonlyArray<HistoryPoint>, fromMinute: number, toMinute: number, utcOffsetMinutes?: number): HistoryPoint[];
|
|
88
|
+
export declare const METEOROLOGICAL_SEASON_MONTHS: Record<"fall" | "spring" | "summer" | "winter", number[]>;
|
|
89
|
+
export declare function filterByMonth(points: ReadonlyArray<HistoryPoint>, months: ReadonlyArray<number>, utcOffsetMinutes?: number): HistoryPoint[];
|
|
90
|
+
export declare function filterByTimeOfDay(points: ReadonlyArray<HistoryPoint>, fromMinute: number, toMinute: number, utcOffsetMinutes?: number): HistoryPoint[];
|
|
92
91
|
/** The share of non-calm history blowing from inside the consumer's arcs;
|
|
93
92
|
* null when nothing non-calm was measured. */
|
|
94
|
-
declare function favorableShare(points: ReadonlyArray<HistoryPoint>, arcs: ReadonlyArray<DirectionArc>): number | null;
|
|
95
|
-
type HistoryCoverage = {
|
|
93
|
+
export declare function favorableShare(points: ReadonlyArray<HistoryPoint>, arcs: ReadonlyArray<DirectionArc>): number | null;
|
|
94
|
+
export type HistoryCoverage = {
|
|
96
95
|
actualCount: number;
|
|
97
96
|
expectedCount: number;
|
|
98
97
|
ratio: number;
|
|
@@ -101,11 +100,10 @@ type HistoryCoverage = {
|
|
|
101
100
|
* implies for [fromMs, toMs). Expected comes from the request, never from the
|
|
102
101
|
* first-to-last point span, so leading and trailing dropouts lower the ratio
|
|
103
102
|
* instead of hiding. */
|
|
104
|
-
declare function historyCoverage(points: ReadonlyArray<HistoryPoint>, periodMinutes: number, fromMs: number, toMs: number): HistoryCoverage;
|
|
105
|
-
declare function historyGaps(history: History, toleranceFactor?: number): Array<[number, number]>;
|
|
106
|
-
type TrendSeries = "temperature" | "pressure";
|
|
107
|
-
declare function windowPoints(points: ReadonlyArray<HistoryPoint>, hours?: number): ReadonlyArray<HistoryPoint>;
|
|
108
|
-
declare function compareWindow(points: ReadonlyArray<HistoryPoint>, offsetDays: number, windowHours?: number): HistoryPoint[] | null;
|
|
109
|
-
declare function compareTracePoints(comparePoints: ReadonlyArray<HistoryPoint>, scales: ChartScales, offsetDays: number): string;
|
|
110
|
-
|
|
111
|
-
export { CHART_FALLBACK_WIDTH, ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, HistoryCoverage, METEOROLOGICAL_SEASON_MONTHS, RoseSector, TickAnchor, TrendSeries, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, favorableShare, filterByMonth, filterByTimeOfDay, historyCoverage, historyGaps, meanDirectionDeg$1 as meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints };
|
|
103
|
+
export declare function historyCoverage(points: ReadonlyArray<HistoryPoint>, periodMinutes: number, fromMs: number, toMs: number): HistoryCoverage;
|
|
104
|
+
export declare function historyGaps(history: History, toleranceFactor?: number): Array<[number, number]>;
|
|
105
|
+
export type TrendSeries = "temperature" | "pressure";
|
|
106
|
+
export declare function windowPoints(points: ReadonlyArray<HistoryPoint>, hours?: number): ReadonlyArray<HistoryPoint>;
|
|
107
|
+
export declare function compareWindow(points: ReadonlyArray<HistoryPoint>, offsetDays: number, windowHours?: number): HistoryPoint[] | null;
|
|
108
|
+
export declare function compareTracePoints(comparePoints: ReadonlyArray<HistoryPoint>, scales: ChartScales, offsetDays: number): string;
|
|
109
|
+
export { meanDirectionDeg$1 as meanDirectionDeg };
|
package/dist/geometry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KMH_PER_MPS, isCalm, normalizeDegrees, radians } from "./derive.js";
|
|
2
2
|
import { componentsToWind, inDirectionArcs, meanDirectionDeg, windToComponents } from "@azohra/meteo.core";
|
|
3
|
-
|
|
3
|
+
// src/geometry.ts
|
|
4
4
|
const CHART_FALLBACK_WIDTH = 360;
|
|
5
5
|
const CHART_AXIS_GUTTER = 46;
|
|
6
6
|
function measuredChartWidth(measured) {
|
|
@@ -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);
|
|
@@ -379,5 +380,4 @@ function compareTracePoints(comparePoints, scales, offsetDays) {
|
|
|
379
380
|
const shiftMs = offsetDays * DAY_MS;
|
|
380
381
|
return comparePoints.map((point) => coordinate(scales.xAtMs(Date.parse(point.observedAt) + shiftMs), scales.yAt(point.windAvgMps))).join(" ");
|
|
381
382
|
}
|
|
382
|
-
//#endregion
|
|
383
383
|
export { CHART_FALLBACK_WIDTH, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, HISTORY_GAP_TOLERANCE_FACTOR, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, chartScalesOf, compareTracePoints, compareWindow, dailyPattern, favorableShare, filterByMonth, filterByTimeOfDay, historyCoverage, historyGaps, isCalmHistory, meanDirectionDeg$1 as meanDirectionDeg, meanDirectionDegOf, measuredChartWidth, nearestIndex, speedBand, stretchFrame, thinVanes, thinVanesOf, tickAnchor, tracePointsOf, trendRuns, trendSeriesPad, trendValueOf, valueScale, vanePath, vaneTicks, vectorMeanWind, windRose, windowPoints };
|
package/dist/instruments.d.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { HistoryPoint } from "./contract.js";
|
|
2
2
|
import { SpeedUnit } from "./derive.js";
|
|
3
3
|
import { DirectionArc } from "@azohra/meteo.core";
|
|
4
|
-
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
7
|
-
declare const
|
|
8
|
-
declare const
|
|
9
|
-
declare const
|
|
10
|
-
declare const
|
|
11
|
-
declare const
|
|
12
|
-
declare const
|
|
13
|
-
declare const
|
|
14
|
-
declare
|
|
15
|
-
declare function
|
|
16
|
-
declare function
|
|
17
|
-
declare function
|
|
18
|
-
declare
|
|
19
|
-
declare const DIAL_CARDINALS: readonly [{
|
|
4
|
+
export declare const DIAL_SIZE = 160;
|
|
5
|
+
export declare const DIAL_CENTRE: number;
|
|
6
|
+
export declare const DIAL_RING_RADIUS = 70;
|
|
7
|
+
export declare const DIAL_TICK_INNER = 64;
|
|
8
|
+
export declare const DIAL_CARDINAL_TICK_INNER = 58;
|
|
9
|
+
export declare const DIAL_LETTER_RADIUS = 46;
|
|
10
|
+
export declare const DIAL_HUB_RADIUS = 36;
|
|
11
|
+
export declare const DIAL_COUNTERWEIGHT_RADIUS = 4.5;
|
|
12
|
+
export declare const DIAL_COUNTERWEIGHT_REACH = 46;
|
|
13
|
+
export declare const DIAL_MIN_MAX_MPS: number;
|
|
14
|
+
export declare function dialPolar(bearingDeg: number, radius: number): readonly [number, number];
|
|
15
|
+
export declare function dialNeedlePoints(fromDeg: number): string;
|
|
16
|
+
export declare function dialSpeedArcPath(fraction: number): string;
|
|
17
|
+
export declare function dialScaleMaxMps(windAvgMps: number | null, windGustMps: number | null, unit: SpeedUnit): number;
|
|
18
|
+
export declare const DIAL_CARDINALS: readonly [{
|
|
20
19
|
readonly bearing: 0;
|
|
21
20
|
readonly letter: "N";
|
|
22
21
|
}, {
|
|
@@ -29,24 +28,24 @@ declare const DIAL_CARDINALS: readonly [{
|
|
|
29
28
|
readonly bearing: 270;
|
|
30
29
|
readonly letter: "W";
|
|
31
30
|
}];
|
|
32
|
-
declare const ROSE_SIZE = 190;
|
|
33
|
-
declare const ROSE_CENTRE: number;
|
|
34
|
-
declare const ROSE_MAX_RADIUS = 70;
|
|
35
|
-
declare const ROSE_FAVORABLE_RING_RADIUS = 75;
|
|
36
|
-
declare const ROSE_HUB_RADIUS = 16;
|
|
37
|
-
declare const ROSE_HUB_DOT_RADIUS = 3;
|
|
38
|
-
declare const ROSE_LETTER_RADIUS = 82;
|
|
39
|
-
declare const ROSE_TICK_REACH = 4;
|
|
40
|
-
declare const ROSE_PETAL_FILL = 0.82;
|
|
41
|
-
declare function rosePolar(bearingDeg: number, radius: number): readonly [number, number];
|
|
42
|
-
declare function rosePetalPath(bearingDeg: number, radius: number, halfWidthDeg: number): string;
|
|
31
|
+
export declare const ROSE_SIZE = 190;
|
|
32
|
+
export declare const ROSE_CENTRE: number;
|
|
33
|
+
export declare const ROSE_MAX_RADIUS = 70;
|
|
34
|
+
export declare const ROSE_FAVORABLE_RING_RADIUS = 75;
|
|
35
|
+
export declare const ROSE_HUB_RADIUS = 16;
|
|
36
|
+
export declare const ROSE_HUB_DOT_RADIUS = 3;
|
|
37
|
+
export declare const ROSE_LETTER_RADIUS = 82;
|
|
38
|
+
export declare const ROSE_TICK_REACH = 4;
|
|
39
|
+
export declare const ROSE_PETAL_FILL = 0.82;
|
|
40
|
+
export declare function rosePolar(bearingDeg: number, radius: number): readonly [number, number];
|
|
41
|
+
export declare function rosePetalPath(bearingDeg: number, radius: number, halfWidthDeg: number): string;
|
|
43
42
|
/** One radial slice of a petal — a stacked wedge's band segment; the petal
|
|
44
43
|
* itself is the slice from the hub out. */
|
|
45
|
-
declare function roseBandPath(bearingDeg: number, innerRadius: number, outerRadius: number, halfWidthDeg: number): string;
|
|
44
|
+
export declare function roseBandPath(bearingDeg: number, innerRadius: number, outerRadius: number, halfWidthDeg: number): string;
|
|
46
45
|
/** The rose ring's arc input; the shape is core's `DirectionArc`. */
|
|
47
|
-
type FavorableDirection = DirectionArc;
|
|
48
|
-
declare function roseRingArcPath(sector: FavorableDirection): string;
|
|
49
|
-
declare const ROSE_CARDINAL_LETTERS: readonly [{
|
|
46
|
+
export type FavorableDirection = DirectionArc;
|
|
47
|
+
export declare function roseRingArcPath(sector: FavorableDirection): string;
|
|
48
|
+
export declare const ROSE_CARDINAL_LETTERS: readonly [{
|
|
50
49
|
readonly bearing: 0;
|
|
51
50
|
readonly letter: "N";
|
|
52
51
|
}, {
|
|
@@ -59,19 +58,17 @@ declare const ROSE_CARDINAL_LETTERS: readonly [{
|
|
|
59
58
|
readonly bearing: 270;
|
|
60
59
|
readonly letter: "W";
|
|
61
60
|
}];
|
|
62
|
-
declare const ROSE_INTERCARDINAL_BEARINGS: readonly [45, 135, 225, 315];
|
|
63
|
-
declare const SPARKLINE_EDGE_INSET = 1;
|
|
64
|
-
declare const SPARKLINE_MAX_PADDING = 1.1;
|
|
65
|
-
declare function sparklineScale(points: ReadonlyArray<HistoryPoint>, width: number, height: number): {
|
|
61
|
+
export declare const ROSE_INTERCARDINAL_BEARINGS: readonly [45, 135, 225, 315];
|
|
62
|
+
export declare const SPARKLINE_EDGE_INSET = 1;
|
|
63
|
+
export declare const SPARKLINE_MAX_PADDING = 1.1;
|
|
64
|
+
export declare function sparklineScale(points: ReadonlyArray<HistoryPoint>, width: number, height: number): {
|
|
66
65
|
scaleMax: number;
|
|
67
66
|
xAt(ms: number): number;
|
|
68
67
|
yAt(speedMps: number): number;
|
|
69
68
|
};
|
|
70
|
-
type HistoryRun = {
|
|
69
|
+
export type HistoryRun = {
|
|
71
70
|
startedAt: string;
|
|
72
71
|
points: HistoryPoint[];
|
|
73
72
|
};
|
|
74
|
-
declare function historyRuns(points: ReadonlyArray<HistoryPoint>, periodMinutes: number): HistoryRun[];
|
|
75
|
-
declare function bandStrips(runs: ReadonlyArray<HistoryRun>): HistoryRun[];
|
|
76
|
-
//#endregion
|
|
77
|
-
export { DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, FavorableDirection, HistoryRun, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, bandStrips, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, historyRuns, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale };
|
|
73
|
+
export declare function historyRuns(points: ReadonlyArray<HistoryPoint>, periodMinutes: number): HistoryRun[];
|
|
74
|
+
export declare function bandStrips(runs: ReadonlyArray<HistoryRun>): HistoryRun[];
|
package/dist/instruments.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { COMPASS_POINTS, KMH_PER_MPS, normalizeDegrees, radians, speedToMps } from "./derive.js";
|
|
2
2
|
import { HISTORY_GAP_TOLERANCE_FACTOR } from "./geometry.js";
|
|
3
|
-
|
|
3
|
+
// 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;
|
|
@@ -182,5 +182,4 @@ function bandStrips(runs) {
|
|
|
182
182
|
}
|
|
183
183
|
return strips;
|
|
184
184
|
}
|
|
185
|
-
//#endregion
|
|
186
185
|
export { DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIGHT_RADIUS, DIAL_COUNTERWEIGHT_REACH, DIAL_HUB_RADIUS, DIAL_LETTER_RADIUS, DIAL_MIN_MAX_MPS, DIAL_RING_RADIUS, DIAL_SIZE, DIAL_TICK_INNER, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, bandStrips, dialNeedlePoints, dialPolar, dialRingArcPath, dialScaleMaxMps, dialSpeedArcPath, historyRuns, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale };
|
package/dist/merge-current.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { StationCurrent, StationFeed } from "./contract.js";
|
|
2
|
-
|
|
3
|
-
type MergeResult = {
|
|
2
|
+
export type MergeResult = {
|
|
4
3
|
feed: StationFeed;
|
|
5
4
|
merged: boolean;
|
|
6
5
|
};
|
|
7
|
-
declare function mergeCurrent(feed: StationFeed, current: StationCurrent): MergeResult;
|
|
8
|
-
declare function foldCurrent(feed: StationFeed | null, feedReceivedAtMs: number | null, current: StationCurrent | null, currentReceivedAtMs: number | null): {
|
|
6
|
+
export declare function mergeCurrent(feed: StationFeed, current: StationCurrent): MergeResult;
|
|
7
|
+
export declare function foldCurrent(feed: StationFeed | null, feedReceivedAtMs: number | null, current: StationCurrent | null, currentReceivedAtMs: number | null): {
|
|
9
8
|
feed: StationFeed | null;
|
|
10
9
|
receivedAtMs: number | null;
|
|
11
|
-
};
|
|
12
|
-
//#endregion
|
|
13
|
-
export { MergeResult, foldCurrent, mergeCurrent };
|
|
10
|
+
};
|
package/dist/merge-current.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/merge-current.ts
|
|
2
2
|
function preserveOmitted(incoming, prior) {
|
|
3
3
|
if (prior == null) return incoming;
|
|
4
4
|
return {
|
|
@@ -51,5 +51,4 @@ function foldCurrent(feed, feedReceivedAtMs, current, currentReceivedAtMs) {
|
|
|
51
51
|
receivedAtMs: result.merged ? currentReceivedAtMs : feedReceivedAtMs
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
//#endregion
|
|
55
54
|
export { foldCurrent, mergeCurrent };
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Station } from "../../contract.js";
|
|
2
2
|
import { StationStringOverrides } from "../../strings.js";
|
|
3
3
|
import "../../index.js";
|
|
4
|
-
//#region src/react/components/AirExtremes.d.ts
|
|
5
4
|
/** Derived atmo tiles from served history: the last completed night's low
|
|
6
5
|
* (real astronomy — no coordinates, no tile) and the trailing pressure
|
|
7
6
|
* delta. Nothing derivable, nothing rendered. */
|
|
8
|
-
declare function AirExtremes({ station: stationProp, stationId, nowMs, strings: stringsProp }: {
|
|
7
|
+
export declare function AirExtremes({ station: stationProp, stationId, nowMs, strings: stringsProp }: {
|
|
9
8
|
station?: Station;
|
|
10
9
|
stationId?: string;
|
|
11
10
|
/** Pinned in tests; defaults to the wall clock. */
|
|
12
11
|
nowMs?: number;
|
|
13
12
|
strings?: StationStringOverrides;
|
|
14
|
-
}): import("react").
|
|
15
|
-
//#endregion
|
|
16
|
-
export { AirExtremes };
|
|
13
|
+
}): import("react").ReactNode;
|
|
@@ -1,9 +1,9 @@
|
|
|
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
|
-
|
|
6
|
-
//#region src/react/components/AirExtremes.tsx
|
|
6
|
+
// 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
|
|
9
9
|
* delta. Nothing derivable, nothing rendered. */
|
|
@@ -11,28 +11,10 @@ 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
|
-
//#endregion
|
|
38
20
|
export { AirExtremes };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Station } from "../../contract.js";
|
|
2
2
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
3
3
|
import "../../index.js";
|
|
4
|
-
|
|
5
|
-
declare function AirMatrix({ stations: stationsProp, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
4
|
+
export declare function AirMatrix({ stations: stationsProp, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
6
5
|
stations?: readonly Station[];
|
|
7
6
|
strings?: StationStringOverrides;
|
|
8
7
|
formatTime?: FormatTime;
|
|
9
|
-
}): import("react").JSX.Element | null;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { AirMatrix };
|
|
8
|
+
}): import("react").JSX.Element | null;
|
|
@@ -1,10 +1,11 @@
|
|
|
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";
|
|
7
|
-
|
|
8
|
+
// src/react/components/AirMatrix.tsx
|
|
8
9
|
function AirMatrix({ stations: stationsProp, strings: stringsProp, formatTime: formatTimeProp }) {
|
|
9
10
|
const context = useStationFeedContext();
|
|
10
11
|
const stations = requireResolved("AirMatrix", "stations", stationsProp ?? context?.feed?.stations);
|
|
@@ -20,63 +21,28 @@ 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
|
}
|
|
81
|
-
//#endregion
|
|
82
48
|
export { AirMatrix };
|
|
@@ -3,10 +3,9 @@ import { SpeedThresholds } from "../../derive.js";
|
|
|
3
3
|
import { StationStringOverrides } from "../../strings.js";
|
|
4
4
|
import { FavorableDirection } from "../../instruments.js";
|
|
5
5
|
import "../../index.js";
|
|
6
|
-
//#region src/react/components/ClimatologyDailyPattern.d.ts
|
|
7
6
|
/** The cube's typical day through the daily-pattern drawing, month-filtered
|
|
8
7
|
* client-side. The host owns the document and the filters. */
|
|
9
|
-
declare function ClimatologyDailyPattern({ document, months, favorableDirections: favorableDirectionsProp, thresholds: thresholdsProp, unit: unitProp, plotHeight, stationName, strings: stringsProp }: {
|
|
8
|
+
export declare function ClimatologyDailyPattern({ document, months, favorableDirections: favorableDirectionsProp, thresholds: thresholdsProp, unit: unitProp, plotHeight, stationName, strings: stringsProp }: {
|
|
10
9
|
document: StationClimatology | null | undefined;
|
|
11
10
|
months?: ReadonlyArray<number>;
|
|
12
11
|
favorableDirections?: FavorableDirection[] | null;
|
|
@@ -15,6 +14,4 @@ declare function ClimatologyDailyPattern({ document, months, favorableDirections
|
|
|
15
14
|
plotHeight?: number;
|
|
16
15
|
stationName?: string;
|
|
17
16
|
strings?: StationStringOverrides;
|
|
18
|
-
}): import("react").JSX.Element;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { ClimatologyDailyPattern };
|
|
17
|
+
}): 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;
|
|
@@ -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
|
+
// 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,8 +58,7 @@ function ClimatologyDailyPattern({ document, months, favorableDirections: favora
|
|
|
52
58
|
unit,
|
|
53
59
|
width,
|
|
54
60
|
words
|
|
55
|
-
})
|
|
61
|
+
}))
|
|
56
62
|
});
|
|
57
63
|
}
|
|
58
|
-
//#endregion
|
|
59
64
|
export { ClimatologyDailyPattern };
|