@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
|
@@ -3,7 +3,7 @@ import { localeFormatTime } from "../../strings.js";
|
|
|
3
3
|
import { requireResolved as requireResolved$1, resolveStation as resolveStation$1 } from "../../display.js";
|
|
4
4
|
import { createContext, useContext, useMemo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/react/components/StationFeedProvider.tsx
|
|
7
7
|
const StationFeedContext = createContext(null);
|
|
8
8
|
function StationFeedProvider({ feed, receivedAtMs, strings, unit, formatTime, thresholds, favorableDirections, locale, children }) {
|
|
9
9
|
const resolvedFormatTime = formatTime ?? (locale == null ? void 0 : localeFormatTime(locale));
|
|
@@ -38,5 +38,4 @@ function resolveStation(context, stationId) {
|
|
|
38
38
|
function requireResolved(component, what, value) {
|
|
39
39
|
return requireResolved$1(component, what, value, "render inside <StationFeedProvider> with a feed");
|
|
40
40
|
}
|
|
41
|
-
//#endregion
|
|
42
41
|
export { StationFeedProvider, requireResolved, resolveStation, useStationFeedContext };
|
|
@@ -2,8 +2,7 @@ import { Station } from "../../contract.js";
|
|
|
2
2
|
import { SpeedUnit } from "../../derive.js";
|
|
3
3
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
4
4
|
import "../../index.js";
|
|
5
|
-
|
|
6
|
-
declare function StationStrip({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, unit: unitProp, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
5
|
+
export declare function StationStrip({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, unit: unitProp, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
7
6
|
station?: Station;
|
|
8
7
|
stationId?: string;
|
|
9
8
|
servedAt?: string | null;
|
|
@@ -11,6 +10,4 @@ declare function StationStrip({ station: stationProp, stationId, servedAt: serve
|
|
|
11
10
|
unit?: SpeedUnit;
|
|
12
11
|
strings?: StationStringOverrides;
|
|
13
12
|
formatTime?: FormatTime;
|
|
14
|
-
}): import("react").
|
|
15
|
-
//#endregion
|
|
16
|
-
export { StationStrip };
|
|
13
|
+
}): import("react").ReactNode;
|
|
@@ -2,83 +2,27 @@
|
|
|
2
2
|
import { stationFreshnessThresholds } from "../../derive.js";
|
|
3
3
|
import { resolveDisplay } from "../../display.js";
|
|
4
4
|
import { stationStripScene } from "../../scene/strip.js";
|
|
5
|
+
import { renderScene } from "./SceneTree.js";
|
|
5
6
|
import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
6
|
-
import { DirectionCell, StationNameLink } from "../lib/cells.js";
|
|
7
7
|
import { useFreshness } from "../hooks/useFreshness.js";
|
|
8
|
-
|
|
9
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
//#region src/react/components/StationStrip.tsx
|
|
8
|
+
// src/react/components/StationStrip.tsx
|
|
11
9
|
function StationStrip({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, unit: unitProp, strings: stringsProp, formatTime: formatTimeProp }) {
|
|
12
10
|
const context = useStationFeedContext();
|
|
13
11
|
const station = requireResolved("StationStrip", "station", stationProp ?? resolveStation(context, stationId));
|
|
14
12
|
const servedAt = servedAtProp ?? context?.feed?.servedAt ?? null;
|
|
15
13
|
const receivedAtMs = receivedAtMsProp !== void 0 ? receivedAtMsProp : context?.receivedAtMs ?? null;
|
|
16
|
-
const { formatTime,
|
|
14
|
+
const { formatTime, unit, words } = resolveDisplay(context, {
|
|
17
15
|
formatTime: formatTimeProp,
|
|
18
16
|
strings: stringsProp,
|
|
19
17
|
unit: unitProp
|
|
20
18
|
});
|
|
21
19
|
const status = useFreshness(station.reading?.observedAt ?? null, servedAt, receivedAtMs, stationFreshnessThresholds(station));
|
|
22
|
-
|
|
20
|
+
return renderScene(stationStripScene({
|
|
23
21
|
formatTime,
|
|
22
|
+
freshness: status,
|
|
24
23
|
station,
|
|
25
24
|
unit,
|
|
26
25
|
words
|
|
27
|
-
});
|
|
28
|
-
const { body } = scene;
|
|
29
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
30
|
-
"aria-label": scene.root.ariaLabel,
|
|
31
|
-
className: scene.root.className,
|
|
32
|
-
"data-status": scene.root.status,
|
|
33
|
-
role: "group",
|
|
34
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
35
|
-
className: scene.stationClassName,
|
|
36
|
-
children: /* @__PURE__ */ jsx(StationNameLink, { station })
|
|
37
|
-
}), body.kind === "reading" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
-
/* @__PURE__ */ jsxs("span", {
|
|
39
|
-
className: body.wind.className,
|
|
40
|
-
children: [/* @__PURE__ */ jsx("strong", { children: body.wind.value }), /* @__PURE__ */ jsx("small", { children: body.wind.unitLabel })]
|
|
41
|
-
}),
|
|
42
|
-
body.gustLull && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
43
|
-
className: body.gustLull.lull.className,
|
|
44
|
-
children: [/* @__PURE__ */ jsx("small", {
|
|
45
|
-
className: body.gustLull.lull.labelClassName,
|
|
46
|
-
children: body.gustLull.lull.label
|
|
47
|
-
}), body.gustLull.lull.value]
|
|
48
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
49
|
-
className: body.gustLull.gust.className,
|
|
50
|
-
children: [/* @__PURE__ */ jsx("small", {
|
|
51
|
-
className: body.gustLull.gust.labelClassName,
|
|
52
|
-
children: body.gustLull.gust.label
|
|
53
|
-
}), body.gustLull.gust.value]
|
|
54
|
-
})] }),
|
|
55
|
-
/* @__PURE__ */ jsx("span", {
|
|
56
|
-
className: body.from.className,
|
|
57
|
-
children: /* @__PURE__ */ jsx(DirectionCell, {
|
|
58
|
-
windAvgMps: body.from.windAvgMps,
|
|
59
|
-
windDirectionDeg: body.from.windDirectionDeg,
|
|
60
|
-
words
|
|
61
|
-
})
|
|
62
|
-
}),
|
|
63
|
-
body.temperature && /* @__PURE__ */ jsx("span", {
|
|
64
|
-
className: body.temperature.className,
|
|
65
|
-
children: body.temperature.text
|
|
66
|
-
}),
|
|
67
|
-
/* @__PURE__ */ jsxs("span", {
|
|
68
|
-
className: body.updated.className,
|
|
69
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
70
|
-
className: body.updated.time.className,
|
|
71
|
-
children: body.updated.time.text
|
|
72
|
-
}), status != null && /* @__PURE__ */ jsx(FreshnessBadge, {
|
|
73
|
-
status,
|
|
74
|
-
strings
|
|
75
|
-
})]
|
|
76
|
-
})
|
|
77
|
-
] }) : /* @__PURE__ */ jsx("span", {
|
|
78
|
-
className: body.className,
|
|
79
|
-
children: body.text
|
|
80
|
-
})]
|
|
81
|
-
});
|
|
26
|
+
}));
|
|
82
27
|
}
|
|
83
|
-
//#endregion
|
|
84
28
|
export { StationStrip };
|
|
@@ -3,9 +3,8 @@ import { SpeedUnit } from "../../derive.js";
|
|
|
3
3
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
4
4
|
import "../../index.js";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
declare function StationTable({ stations: stationsProp, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, unit: unitProp, strings: stringsProp, formatTime: formatTimeProp, stationMeta }: {
|
|
6
|
+
export type StationMetaRenderer = (station: Station) => ReactNode;
|
|
7
|
+
export declare function StationTable({ stations: stationsProp, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, unit: unitProp, strings: stringsProp, formatTime: formatTimeProp, stationMeta }: {
|
|
9
8
|
stations?: readonly Station[];
|
|
10
9
|
servedAt?: string;
|
|
11
10
|
receivedAtMs?: number | null;
|
|
@@ -13,6 +12,4 @@ declare function StationTable({ stations: stationsProp, servedAt: servedAtProp,
|
|
|
13
12
|
strings?: StationStringOverrides;
|
|
14
13
|
formatTime?: FormatTime;
|
|
15
14
|
stationMeta?: StationMetaRenderer;
|
|
16
|
-
}): import("react").JSX.Element;
|
|
17
|
-
//#endregion
|
|
18
|
-
export { StationMetaRenderer, StationTable };
|
|
15
|
+
}): import("react").JSX.Element;
|
|
@@ -1,37 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { stationFreshnessThresholds } from "../../derive.js";
|
|
3
3
|
import { resolveDisplay } from "../../display.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TABLE_BODY_CLASS, TABLE_ROW_CLASS, TABLE_STATION_CELL_CLASS, stationTableHeadNode, stationTableRootAttrs, stationTableRowCells } from "../../scene/table.js";
|
|
5
|
+
import { renderChildren, renderScene } from "./SceneTree.js";
|
|
5
6
|
import { requireResolved, useStationFeedContext } from "./StationFeedProvider.js";
|
|
6
|
-
import { DirectionCell, StationNameLink } from "../lib/cells.js";
|
|
7
7
|
import { useFreshness } from "../hooks/useFreshness.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
8
|
+
import { StationNameLink } from "../lib/cells.js";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
// src/react/components/StationTable.tsx
|
|
11
11
|
function StationTable({ stations: stationsProp, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, unit: unitProp, strings: stringsProp, formatTime: formatTimeProp, stationMeta }) {
|
|
12
12
|
const context = useStationFeedContext();
|
|
13
13
|
const stations = requireResolved("StationTable", "stations", stationsProp ?? context?.feed?.stations);
|
|
14
14
|
const servedAt = servedAtProp ?? context?.feed?.servedAt ?? null;
|
|
15
15
|
const receivedAtMs = receivedAtMsProp !== void 0 ? receivedAtMsProp : context?.receivedAtMs ?? null;
|
|
16
|
-
const { formatTime,
|
|
16
|
+
const { formatTime, unit, words } = resolveDisplay(context, {
|
|
17
17
|
formatTime: formatTimeProp,
|
|
18
18
|
strings: stringsProp,
|
|
19
19
|
unit: unitProp
|
|
20
20
|
});
|
|
21
|
-
const
|
|
21
|
+
const root = stationTableRootAttrs(stations, words);
|
|
22
22
|
return /* @__PURE__ */ jsxs("div", {
|
|
23
|
-
"aria-label":
|
|
24
|
-
className:
|
|
23
|
+
"aria-label": root["aria-label"],
|
|
24
|
+
className: root["class"],
|
|
25
25
|
role: "table",
|
|
26
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
27
|
-
className:
|
|
28
|
-
role: "row",
|
|
29
|
-
children: scene.head.columns.map((column) => /* @__PURE__ */ jsx("span", {
|
|
30
|
-
role: "columnheader",
|
|
31
|
-
children: column
|
|
32
|
-
}, column))
|
|
33
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
34
|
-
className: scene.bodyClassName,
|
|
26
|
+
children: [renderScene(stationTableHeadNode(words)), /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: TABLE_BODY_CLASS,
|
|
35
28
|
role: "rowgroup",
|
|
36
29
|
children: stations.map((station) => /* @__PURE__ */ jsx(TableRow, {
|
|
37
30
|
formatTime,
|
|
@@ -39,77 +32,29 @@ function StationTable({ stations: stationsProp, servedAt: servedAtProp, received
|
|
|
39
32
|
servedAt,
|
|
40
33
|
station,
|
|
41
34
|
stationMeta,
|
|
42
|
-
strings,
|
|
43
35
|
unit,
|
|
44
36
|
words
|
|
45
37
|
}, station.id))
|
|
46
38
|
})]
|
|
47
39
|
});
|
|
48
40
|
}
|
|
49
|
-
function TableRow({ formatTime, receivedAtMs, servedAt, station, stationMeta,
|
|
41
|
+
function TableRow({ formatTime, receivedAtMs, servedAt, station, stationMeta, unit, words }) {
|
|
50
42
|
const status = useFreshness(station.reading?.observedAt ?? null, servedAt, receivedAtMs, stationFreshnessThresholds(station));
|
|
51
|
-
const row = stationTableRowScene({
|
|
52
|
-
formatTime,
|
|
53
|
-
station,
|
|
54
|
-
unit,
|
|
55
|
-
words
|
|
56
|
-
});
|
|
57
|
-
const { cells } = row;
|
|
58
43
|
return /* @__PURE__ */ jsxs("div", {
|
|
59
|
-
className:
|
|
60
|
-
"data-status":
|
|
44
|
+
className: TABLE_ROW_CLASS,
|
|
45
|
+
"data-status": station.status,
|
|
61
46
|
role: "row",
|
|
62
47
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
63
|
-
className:
|
|
48
|
+
className: TABLE_STATION_CELL_CLASS,
|
|
64
49
|
role: "cell",
|
|
65
50
|
children: [/* @__PURE__ */ jsx("strong", { children: /* @__PURE__ */ jsx(StationNameLink, { station }) }), /* @__PURE__ */ jsx("small", { children: stationMeta ? stationMeta(station) : station.sourceLabel })]
|
|
66
|
-
}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
className: cells.lull.className,
|
|
74
|
-
role: "cell",
|
|
75
|
-
children: cells.lull.value
|
|
76
|
-
}),
|
|
77
|
-
/* @__PURE__ */ jsx("span", {
|
|
78
|
-
className: cells.gust.className,
|
|
79
|
-
role: "cell",
|
|
80
|
-
children: cells.gust.value
|
|
81
|
-
}),
|
|
82
|
-
/* @__PURE__ */ jsx("span", {
|
|
83
|
-
className: cells.from.className,
|
|
84
|
-
role: "cell",
|
|
85
|
-
children: /* @__PURE__ */ jsx(DirectionCell, {
|
|
86
|
-
windAvgMps: cells.from.windAvgMps,
|
|
87
|
-
windDirectionDeg: cells.from.windDirectionDeg,
|
|
88
|
-
words
|
|
89
|
-
})
|
|
90
|
-
}),
|
|
91
|
-
/* @__PURE__ */ jsx("span", {
|
|
92
|
-
className: cells.temperature.className,
|
|
93
|
-
role: "cell",
|
|
94
|
-
children: cells.temperature.value
|
|
95
|
-
}),
|
|
96
|
-
/* @__PURE__ */ jsxs("span", {
|
|
97
|
-
className: cells.updated.className,
|
|
98
|
-
role: "cell",
|
|
99
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
100
|
-
className: cells.updated.time.className,
|
|
101
|
-
children: cells.updated.time.text
|
|
102
|
-
}), status != null && /* @__PURE__ */ jsx(FreshnessBadge, {
|
|
103
|
-
status,
|
|
104
|
-
strings
|
|
105
|
-
})]
|
|
106
|
-
})
|
|
107
|
-
] }) : /* @__PURE__ */ jsx("span", {
|
|
108
|
-
className: cells.className,
|
|
109
|
-
role: "cell",
|
|
110
|
-
children: cells.text
|
|
111
|
-
})]
|
|
51
|
+
}), renderChildren(stationTableRowCells({
|
|
52
|
+
formatTime,
|
|
53
|
+
freshness: status,
|
|
54
|
+
station,
|
|
55
|
+
unit,
|
|
56
|
+
words
|
|
57
|
+
}))]
|
|
112
58
|
});
|
|
113
59
|
}
|
|
114
|
-
//#endregion
|
|
115
60
|
export { StationTable };
|
|
@@ -2,13 +2,10 @@ import { Station } from "../../contract.js";
|
|
|
2
2
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
3
3
|
import { TrendSeries } from "../../geometry.js";
|
|
4
4
|
import "../../index.js";
|
|
5
|
-
|
|
6
|
-
declare function TrendChart({ station: stationProp, stationId, series, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
5
|
+
export declare function TrendChart({ station: stationProp, stationId, series, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
7
6
|
station?: Station;
|
|
8
7
|
stationId?: string;
|
|
9
8
|
series: TrendSeries;
|
|
10
9
|
strings?: StationStringOverrides;
|
|
11
10
|
formatTime?: FormatTime;
|
|
12
|
-
}): import("react").JSX.Element | null;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { TrendChart };
|
|
11
|
+
}): import("react").JSX.Element | null;
|
|
@@ -3,11 +3,12 @@ import { resolveDisplay } from "../../display.js";
|
|
|
3
3
|
import { measuredChartWidth } from "../../geometry.js";
|
|
4
4
|
import { readoutAriaLive } from "../../scene/chart.js";
|
|
5
5
|
import { TREND_CLASS, trendGate, trendScene } from "../../scene/trend.js";
|
|
6
|
+
import { renderScene } from "./SceneTree.js";
|
|
6
7
|
import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
7
8
|
import { usePinnedCursor } from "../lib/use-pinned-cursor.js";
|
|
8
9
|
import { useEffect, useRef, useState } from "react";
|
|
9
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
|
|
11
|
+
// src/react/components/TrendChart.tsx
|
|
11
12
|
function TrendChart({ station: stationProp, stationId, series, strings: stringsProp, formatTime: formatTimeProp }) {
|
|
12
13
|
const context = useStationFeedContext();
|
|
13
14
|
const station = requireResolved("TrendChart", "station", stationProp ?? resolveStation(context, stationId));
|
|
@@ -18,6 +19,7 @@ function TrendChart({ station: stationProp, stationId, series, strings: stringsP
|
|
|
18
19
|
const wrapRef = useRef(null);
|
|
19
20
|
const [width, setWidth] = useState(null);
|
|
20
21
|
const gate = trendGate(station, series, words);
|
|
22
|
+
const drawable = gate.kind === "draw";
|
|
21
23
|
useEffect(() => {
|
|
22
24
|
const element = wrapRef.current;
|
|
23
25
|
if (!element) return;
|
|
@@ -30,7 +32,7 @@ function TrendChart({ station: stationProp, stationId, series, strings: stringsP
|
|
|
30
32
|
});
|
|
31
33
|
observer.observe(element);
|
|
32
34
|
return () => observer.disconnect();
|
|
33
|
-
}, [
|
|
35
|
+
}, [drawable]);
|
|
34
36
|
if (gate.kind === "hidden") return null;
|
|
35
37
|
if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
|
|
36
38
|
className: gate.className,
|
|
@@ -66,68 +68,10 @@ function MeasuredTrend({ formatTime, history, series, stationName, width, words
|
|
|
66
68
|
"aria-live": readoutAriaLive(pinned.previewIndex),
|
|
67
69
|
className: scene.readout.className,
|
|
68
70
|
children: [/* @__PURE__ */ jsx("strong", { children: readout.strong }), /* @__PURE__ */ jsx("span", { children: readout.span })]
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
viewBox: scene.svg.viewBox,
|
|
75
|
-
width: scene.svg.width,
|
|
76
|
-
children: [
|
|
77
|
-
scene.grid.map(({ key, line, label }) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
|
|
78
|
-
className: line.className,
|
|
79
|
-
x1: line.x1,
|
|
80
|
-
x2: line.x2,
|
|
81
|
-
y1: line.y1,
|
|
82
|
-
y2: line.y2
|
|
83
|
-
}), /* @__PURE__ */ jsx("text", {
|
|
84
|
-
className: label.className,
|
|
85
|
-
textAnchor: label.anchor,
|
|
86
|
-
x: label.x,
|
|
87
|
-
y: label.y,
|
|
88
|
-
children: label.text
|
|
89
|
-
})] }, key)),
|
|
90
|
-
scene.segments.map((segment) => segment.kind === "dot" ? /* @__PURE__ */ jsx("circle", {
|
|
91
|
-
className: segment.className,
|
|
92
|
-
cx: segment.cx,
|
|
93
|
-
cy: segment.cy,
|
|
94
|
-
r: segment.r
|
|
95
|
-
}, segment.startedAt) : /* @__PURE__ */ jsx("polyline", {
|
|
96
|
-
className: segment.className,
|
|
97
|
-
points: segment.points
|
|
98
|
-
}, segment.startedAt)),
|
|
99
|
-
scene.ticks.map((tick) => /* @__PURE__ */ jsx("text", {
|
|
100
|
-
className: tick.className,
|
|
101
|
-
textAnchor: tick.anchor,
|
|
102
|
-
x: tick.x,
|
|
103
|
-
y: tick.y,
|
|
104
|
-
children: tick.text
|
|
105
|
-
}, tick.key)),
|
|
106
|
-
cursor && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("line", {
|
|
107
|
-
className: cursor.line.className,
|
|
108
|
-
x1: cursor.line.x1,
|
|
109
|
-
x2: cursor.line.x2,
|
|
110
|
-
y1: cursor.line.y1,
|
|
111
|
-
y2: cursor.line.y2
|
|
112
|
-
}), cursor.dot && /* @__PURE__ */ jsx("circle", {
|
|
113
|
-
className: cursor.dot.className,
|
|
114
|
-
cx: cursor.dot.cx,
|
|
115
|
-
cy: cursor.dot.cy,
|
|
116
|
-
r: cursor.dot.r
|
|
117
|
-
})] }),
|
|
118
|
-
/* @__PURE__ */ jsx("rect", {
|
|
119
|
-
className: scene.hit.className,
|
|
120
|
-
fill: scene.hit.fill,
|
|
121
|
-
height: scene.hit.height,
|
|
122
|
-
onClick: pinned.handleClick,
|
|
123
|
-
onPointerLeave: pinned.handlePointerLeave,
|
|
124
|
-
onPointerMove: pinned.handlePointerMove,
|
|
125
|
-
width: scene.hit.width,
|
|
126
|
-
x: scene.hit.x,
|
|
127
|
-
y: scene.hit.y
|
|
128
|
-
})
|
|
129
|
-
]
|
|
130
|
-
})] });
|
|
71
|
+
}), renderScene(scene.draw(cursor, {
|
|
72
|
+
onClick: pinned.handleClick,
|
|
73
|
+
onPointerLeave: pinned.handlePointerLeave,
|
|
74
|
+
onPointerMove: pinned.handlePointerMove
|
|
75
|
+
}))] });
|
|
131
76
|
}
|
|
132
|
-
//#endregion
|
|
133
77
|
export { TrendChart };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare function WindArrow({ deg, size }: {
|
|
1
|
+
export declare function WindArrow({ deg, size }: {
|
|
3
2
|
deg: number;
|
|
4
3
|
size?: number;
|
|
5
|
-
}): import("react").
|
|
6
|
-
//#endregion
|
|
7
|
-
export { WindArrow };
|
|
4
|
+
}): import("react").ReactNode;
|
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { windArrowNode } from "../../scene/glyphs.js";
|
|
3
|
+
import { renderScene } from "./SceneTree.js";
|
|
4
|
+
// src/react/components/WindArrow.tsx
|
|
5
5
|
function WindArrow({ deg, size = 12 }) {
|
|
6
|
-
|
|
7
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
8
|
-
"aria-hidden": "true",
|
|
9
|
-
className: spec.className,
|
|
10
|
-
height: spec.height,
|
|
11
|
-
style: { transform: spec.transform },
|
|
12
|
-
viewBox: spec.viewBox,
|
|
13
|
-
width: spec.width,
|
|
14
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
15
|
-
d: spec.path.d,
|
|
16
|
-
fill: spec.path.fill
|
|
17
|
-
})
|
|
18
|
-
});
|
|
6
|
+
return renderScene(windArrowNode(deg, size));
|
|
19
7
|
}
|
|
20
|
-
//#endregion
|
|
21
8
|
export { WindArrow };
|
|
@@ -3,8 +3,7 @@ import { SpeedThresholds, SpeedUnit } from "../../derive.js";
|
|
|
3
3
|
import { FormatTime, StationStringOverrides } from "../../strings.js";
|
|
4
4
|
import { FavorableDirection } from "../../instruments.js";
|
|
5
5
|
import "../../index.js";
|
|
6
|
-
|
|
7
|
-
declare function WindHistoryChart({ station: stationProp, stationId, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, windowHours, compareOffsetDays, nightShading, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
6
|
+
export declare function WindHistoryChart({ station: stationProp, stationId, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, windowHours, compareOffsetDays, nightShading, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
8
7
|
station?: Station;
|
|
9
8
|
stationId?: string;
|
|
10
9
|
thresholds?: SpeedThresholds | null;
|
|
@@ -18,6 +17,4 @@ declare function WindHistoryChart({ station: stationProp, stationId, thresholds:
|
|
|
18
17
|
nightShading?: boolean;
|
|
19
18
|
strings?: StationStringOverrides;
|
|
20
19
|
formatTime?: FormatTime;
|
|
21
|
-
}): import("react").JSX.Element | null;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { WindHistoryChart };
|
|
20
|
+
}): import("react").JSX.Element | null;
|