@azohra/meteo.station 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -17
- package/dist/connectivity.d.ts +2 -2
- package/dist/contract.d.ts +105 -105
- package/dist/derive.js +4 -4
- package/dist/elements/elements/AirExtremesElement.js +5 -18
- package/dist/elements/elements/AirMatrixElement.js +6 -31
- package/dist/elements/elements/ClimatologyDailyPatternElement.js +17 -12
- package/dist/elements/elements/ClimatologyRoseElement.js +5 -15
- package/dist/elements/elements/CompassFanElement.js +5 -64
- package/dist/elements/elements/CurrentConditionsElement.js +7 -26
- package/dist/elements/elements/DailyPatternElement.d.ts +0 -1
- package/dist/elements/elements/DailyPatternElement.js +6 -120
- package/dist/elements/elements/DialElement.js +3 -95
- package/dist/elements/elements/FavorableShareElement.js +6 -21
- package/dist/elements/elements/RecentSummariesElement.js +6 -23
- package/dist/elements/elements/SparklineElement.d.ts +0 -1
- package/dist/elements/elements/SparklineElement.js +4 -39
- package/dist/elements/elements/StationCardElement.js +4 -18
- package/dist/elements/elements/StationFeedElement.js +4 -2
- package/dist/elements/elements/StationStripElement.js +4 -18
- package/dist/elements/elements/StationTableElement.js +15 -51
- package/dist/elements/elements/TrendChartElement.js +21 -69
- package/dist/elements/elements/WindHistoryChartElement.js +23 -164
- package/dist/elements/elements/WindRoseElement.d.ts +0 -1
- package/dist/elements/elements/WindRoseElement.js +6 -70
- package/dist/elements/elements/atoms.d.ts +1 -1
- package/dist/elements/elements/atoms.js +11 -38
- package/dist/elements/index.js +3 -3
- package/dist/elements/lib/fragments.js +8 -37
- package/dist/elements/lib/h.js +1 -1
- package/dist/elements/lib/render.js +30 -0
- package/dist/geometry.js +2 -1
- package/dist/instruments.js +2 -2
- package/dist/react/components/AirExtremes.d.ts +1 -1
- package/dist/react/components/AirExtremes.js +5 -22
- package/dist/react/components/AirMatrix.js +10 -43
- package/dist/react/components/ClimatologyDailyPattern.d.ts +1 -1
- package/dist/react/components/ClimatologyDailyPattern.js +19 -13
- package/dist/react/components/ClimatologyRose.d.ts +1 -1
- package/dist/react/components/ClimatologyRose.js +11 -28
- package/dist/react/components/CompassFan.d.ts +1 -1
- package/dist/react/components/CompassFan.js +6 -73
- package/dist/react/components/CurrentConditions.d.ts +1 -1
- package/dist/react/components/CurrentConditions.js +11 -74
- package/dist/react/components/DailyPattern.d.ts +1 -3
- package/dist/react/components/DailyPattern.js +10 -149
- package/dist/react/components/Dial.d.ts +1 -1
- package/dist/react/components/Dial.js +5 -118
- package/dist/react/components/FavorableShare.d.ts +1 -1
- package/dist/react/components/FavorableShare.js +6 -27
- package/dist/react/components/FreshnessBadge.d.ts +1 -1
- package/dist/react/components/FreshnessBadge.js +5 -12
- package/dist/react/components/RecentSummaries.d.ts +1 -1
- package/dist/react/components/RecentSummaries.js +6 -44
- package/dist/react/components/SceneTree.js +38 -0
- package/dist/react/components/Sparkline.d.ts +1 -1
- package/dist/react/components/Sparkline.js +3 -39
- package/dist/react/components/StationCard.d.ts +2 -2
- package/dist/react/components/StationCard.js +5 -45
- package/dist/react/components/StationStrip.d.ts +1 -1
- package/dist/react/components/StationStrip.js +5 -60
- package/dist/react/components/StationTable.js +21 -75
- package/dist/react/components/TrendChart.js +8 -63
- package/dist/react/components/WindArrow.d.ts +1 -1
- package/dist/react/components/WindArrow.js +3 -15
- package/dist/react/components/WindHistoryChart.js +8 -182
- package/dist/react/components/WindRose.d.ts +1 -3
- package/dist/react/components/WindRose.js +6 -89
- package/dist/react/components/WindSampleStrip.js +8 -115
- package/dist/react/components/atoms.d.ts +5 -5
- package/dist/react/components/atoms.js +12 -48
- package/dist/react/hooks/useStationCurrent.js +3 -2
- package/dist/react/hooks/useStationFeed.js +3 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +5 -5
- package/dist/react/lib/cells.js +4 -24
- package/dist/scene/air-extremes.js +12 -27
- package/dist/scene/air-matrix.js +45 -58
- package/dist/scene/card.js +14 -40
- package/dist/scene/cells.d.ts +4 -0
- package/dist/scene/cells.js +51 -0
- package/dist/scene/chart.js +2 -1
- package/dist/scene/climatology-pattern.d.ts +1 -2
- package/dist/scene/climatology-pattern.js +10 -11
- package/dist/scene/climatology-rose.d.ts +1 -2
- package/dist/scene/climatology-rose.js +14 -33
- package/dist/scene/compass-fan.js +28 -100
- package/dist/scene/current.d.ts +2 -1
- package/dist/scene/current.js +29 -56
- package/dist/scene/daily-pattern.d.ts +1 -3
- package/dist/scene/daily-pattern.js +20 -27
- package/dist/scene/dial-parts.d.ts +1 -0
- package/dist/scene/dial-parts.js +70 -0
- package/dist/scene/dial.d.ts +1 -2
- package/dist/scene/dial.js +48 -136
- package/dist/scene/favorable-share.js +16 -33
- package/dist/scene/glyphs.js +20 -16
- package/dist/scene/index.d.ts +5 -3
- package/dist/scene/node.js +19 -0
- package/dist/scene/recent-summaries.js +26 -63
- package/dist/scene/rose.js +89 -117
- package/dist/scene/sample-strip.d.ts +1 -2
- package/dist/scene/sample-strip.js +35 -36
- package/dist/scene/sparkline.js +31 -40
- package/dist/scene/strip.js +18 -57
- package/dist/scene/table.js +47 -69
- package/dist/scene/trend.d.ts +1 -2
- package/dist/scene/trend.js +29 -55
- package/dist/scene/wind-history.d.ts +1 -2
- package/dist/scene/wind-history.js +41 -51
- package/dist/scene/wind-plot.js +70 -140
- package/dist/server/adapters/campbell.d.ts +7 -7
- package/dist/server/adapters/campbell.js +1 -1
- package/dist/server/adapters/ecowitt.d.ts +8 -8
- package/dist/server/adapters/tempest.d.ts +6 -6
- package/dist/server/adapters/windnerd-climatology.js +4 -3
- package/dist/server/adapters/windnerd-live.js +3 -2
- package/dist/server/adapters/windnerd.d.ts +8 -8
- package/dist/server/adapters/windnerd.js +1 -1
- package/dist/server/config.d.ts +48 -48
- package/dist/server/hologram.js +2 -1
- package/package.json +6 -11
- package/schema/README.md +1 -1
- package/schema/stationclimatology.schema.json +64 -61
- package/schema/stationcurrent.schema.json +68 -156
- package/schema/stationfeed.schema.json +71 -163
- package/schema/stationhistory.schema.json +37 -46
- package/schema/stationlive.schema.json +221 -306
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
3
|
import { readoutAriaLive } from "../../scene/chart.js";
|
|
4
4
|
import { WIND_CHART_CLASS, windChartGate, windChartScene } from "../../scene/wind-history.js";
|
|
5
|
+
import { renderScene } from "./SceneTree.js";
|
|
5
6
|
import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
6
7
|
import { usePinnedCursor } from "../lib/use-pinned-cursor.js";
|
|
7
8
|
import { Readout } from "./Readout.js";
|
|
@@ -51,11 +52,12 @@ function WindHistoryChart({ station: stationProp, stationId, thresholds: thresho
|
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
function MeasuredChart({ compareOffsetDays, favorableDirections, formatTime, history, night, plotHeight, stationName, thresholds, unit, width, windowHours, words }) {
|
|
55
|
+
const hatchId = `meteo-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
54
56
|
const scene = windChartScene({
|
|
55
57
|
compareOffsetDays,
|
|
56
58
|
favorableDirections,
|
|
57
59
|
formatTime,
|
|
58
|
-
hatchId
|
|
60
|
+
hatchId,
|
|
59
61
|
history,
|
|
60
62
|
night,
|
|
61
63
|
plotHeight,
|
|
@@ -74,187 +76,11 @@ function MeasuredChart({ compareOffsetDays, favorableDirections, formatTime, his
|
|
|
74
76
|
className: scene.readout.className,
|
|
75
77
|
parts: readout.span,
|
|
76
78
|
strong: readout.strong
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
viewBox: scene.svg.viewBox,
|
|
83
|
-
width: scene.svg.width,
|
|
84
|
-
children: [
|
|
85
|
-
/* @__PURE__ */ jsxs("defs", { children: [/* @__PURE__ */ jsx("pattern", {
|
|
86
|
-
height: scene.defs.pattern.height,
|
|
87
|
-
id: scene.defs.pattern.id,
|
|
88
|
-
patternTransform: scene.defs.pattern.transform,
|
|
89
|
-
patternUnits: scene.defs.pattern.units,
|
|
90
|
-
width: scene.defs.pattern.width,
|
|
91
|
-
children: /* @__PURE__ */ jsx("line", {
|
|
92
|
-
className: scene.defs.pattern.line.className,
|
|
93
|
-
x1: scene.defs.pattern.line.x1,
|
|
94
|
-
x2: scene.defs.pattern.line.x2,
|
|
95
|
-
y1: scene.defs.pattern.line.y1,
|
|
96
|
-
y2: scene.defs.pattern.line.y2
|
|
97
|
-
})
|
|
98
|
-
}), /* @__PURE__ */ jsx("clipPath", {
|
|
99
|
-
id: scene.defs.clip.id,
|
|
100
|
-
children: /* @__PURE__ */ jsx("rect", {
|
|
101
|
-
height: scene.defs.clip.rect.height,
|
|
102
|
-
width: scene.defs.clip.rect.width,
|
|
103
|
-
x: scene.defs.clip.rect.x,
|
|
104
|
-
y: scene.defs.clip.rect.y
|
|
105
|
-
})
|
|
106
|
-
})] }),
|
|
107
|
-
scene.zones.map((zone) => /* @__PURE__ */ jsx("rect", {
|
|
108
|
-
className: zone.className,
|
|
109
|
-
height: zone.height,
|
|
110
|
-
width: zone.width,
|
|
111
|
-
x: zone.x,
|
|
112
|
-
y: zone.y
|
|
113
|
-
}, zone.key)),
|
|
114
|
-
scene.nightRects.map((rect) => /* @__PURE__ */ jsx("rect", {
|
|
115
|
-
className: rect.className,
|
|
116
|
-
height: rect.height,
|
|
117
|
-
width: rect.width,
|
|
118
|
-
x: rect.x,
|
|
119
|
-
y: rect.y
|
|
120
|
-
}, rect.key)),
|
|
121
|
-
scene.grid.map(({ key, line, label }) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
|
|
122
|
-
className: line.className,
|
|
123
|
-
x1: line.x1,
|
|
124
|
-
x2: line.x2,
|
|
125
|
-
y1: line.y1,
|
|
126
|
-
y2: line.y2
|
|
127
|
-
}), /* @__PURE__ */ jsx("text", {
|
|
128
|
-
className: label.className,
|
|
129
|
-
textAnchor: label.anchor,
|
|
130
|
-
x: label.x,
|
|
131
|
-
y: label.y,
|
|
132
|
-
children: label.text
|
|
133
|
-
})] }, key)),
|
|
134
|
-
scene.thresholdGuides.map(({ key, line, label }) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
|
|
135
|
-
className: line.className,
|
|
136
|
-
x1: line.x1,
|
|
137
|
-
x2: line.x2,
|
|
138
|
-
y1: line.y1,
|
|
139
|
-
y2: line.y2
|
|
140
|
-
}), /* @__PURE__ */ jsx("text", {
|
|
141
|
-
className: label.className,
|
|
142
|
-
textAnchor: label.anchor,
|
|
143
|
-
x: label.x,
|
|
144
|
-
y: label.y,
|
|
145
|
-
children: label.text
|
|
146
|
-
})] }, key)),
|
|
147
|
-
scene.vaneGuides.map((guide) => /* @__PURE__ */ jsx("line", {
|
|
148
|
-
className: guide.className,
|
|
149
|
-
x1: guide.x1,
|
|
150
|
-
x2: guide.x2,
|
|
151
|
-
y1: guide.y1,
|
|
152
|
-
y2: guide.y2
|
|
153
|
-
}, `guide-${guide.key}`)),
|
|
154
|
-
scene.gaps.map((gap) => /* @__PURE__ */ jsx("rect", {
|
|
155
|
-
className: gap.className,
|
|
156
|
-
fill: gap.fill,
|
|
157
|
-
height: gap.height,
|
|
158
|
-
width: gap.width,
|
|
159
|
-
x: gap.x,
|
|
160
|
-
y: gap.y
|
|
161
|
-
}, gap.key)),
|
|
162
|
-
scene.band && /* @__PURE__ */ jsx("polygon", {
|
|
163
|
-
className: scene.band.className,
|
|
164
|
-
points: scene.band.points
|
|
165
|
-
}),
|
|
166
|
-
scene.compare && /* @__PURE__ */ jsx("polyline", {
|
|
167
|
-
className: scene.compare.className,
|
|
168
|
-
clipPath: scene.compare.clipPath,
|
|
169
|
-
points: scene.compare.points
|
|
170
|
-
}),
|
|
171
|
-
scene.mean.kind === "polyline" ? /* @__PURE__ */ jsx("polyline", {
|
|
172
|
-
className: scene.mean.className,
|
|
173
|
-
points: scene.mean.points
|
|
174
|
-
}) : scene.mean.segments.map((segment) => /* @__PURE__ */ jsx("line", {
|
|
175
|
-
className: segment.className,
|
|
176
|
-
x1: segment.x1,
|
|
177
|
-
x2: segment.x2,
|
|
178
|
-
y1: segment.y1,
|
|
179
|
-
y2: segment.y2
|
|
180
|
-
}, segment.key)),
|
|
181
|
-
scene.calmNote && /* @__PURE__ */ jsx("text", {
|
|
182
|
-
className: scene.calmNote.className,
|
|
183
|
-
textAnchor: scene.calmNote.anchor,
|
|
184
|
-
x: scene.calmNote.x,
|
|
185
|
-
y: scene.calmNote.y,
|
|
186
|
-
children: scene.calmNote.text
|
|
187
|
-
}),
|
|
188
|
-
/* @__PURE__ */ jsx("text", {
|
|
189
|
-
className: scene.rowLabels.to.className,
|
|
190
|
-
textAnchor: scene.rowLabels.to.anchor,
|
|
191
|
-
x: scene.rowLabels.to.x,
|
|
192
|
-
y: scene.rowLabels.to.y,
|
|
193
|
-
children: scene.rowLabels.to.text
|
|
194
|
-
}),
|
|
195
|
-
scene.vanes.map((vane) => vane.mark.kind === "calm" ? /* @__PURE__ */ jsx("text", {
|
|
196
|
-
className: vane.mark.text.className,
|
|
197
|
-
textAnchor: vane.mark.text.anchor,
|
|
198
|
-
x: vane.mark.text.x,
|
|
199
|
-
y: vane.mark.text.y,
|
|
200
|
-
children: vane.mark.text.text
|
|
201
|
-
}, vane.key) : /* @__PURE__ */ jsx("path", {
|
|
202
|
-
className: vane.mark.className,
|
|
203
|
-
d: vane.mark.d
|
|
204
|
-
}, vane.key)),
|
|
205
|
-
scene.vanes.map((vane) => vane.label && /* @__PURE__ */ jsx("text", {
|
|
206
|
-
className: vane.label.className,
|
|
207
|
-
textAnchor: vane.label.anchor,
|
|
208
|
-
x: vane.label.x,
|
|
209
|
-
y: vane.label.y,
|
|
210
|
-
children: vane.label.text
|
|
211
|
-
}, `label-${vane.key}`)),
|
|
212
|
-
/* @__PURE__ */ jsx("text", {
|
|
213
|
-
className: scene.rowLabels.avg.className,
|
|
214
|
-
textAnchor: scene.rowLabels.avg.anchor,
|
|
215
|
-
x: scene.rowLabels.avg.x,
|
|
216
|
-
y: scene.rowLabels.avg.y,
|
|
217
|
-
children: scene.rowLabels.avg.text
|
|
218
|
-
}),
|
|
219
|
-
scene.vanes.map((vane) => vane.value && /* @__PURE__ */ jsx("text", {
|
|
220
|
-
className: vane.value.className,
|
|
221
|
-
textAnchor: vane.value.anchor,
|
|
222
|
-
x: vane.value.x,
|
|
223
|
-
y: vane.value.y,
|
|
224
|
-
children: vane.value.text
|
|
225
|
-
}, `value-${vane.key}`)),
|
|
226
|
-
scene.ticks.map((tick) => /* @__PURE__ */ jsx("text", {
|
|
227
|
-
className: tick.className,
|
|
228
|
-
textAnchor: tick.anchor,
|
|
229
|
-
x: tick.x,
|
|
230
|
-
y: tick.y,
|
|
231
|
-
children: tick.text
|
|
232
|
-
}, tick.key)),
|
|
233
|
-
cursor && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("line", {
|
|
234
|
-
className: cursor.line.className,
|
|
235
|
-
x1: cursor.line.x1,
|
|
236
|
-
x2: cursor.line.x2,
|
|
237
|
-
y1: cursor.line.y1,
|
|
238
|
-
y2: cursor.line.y2
|
|
239
|
-
}), /* @__PURE__ */ jsx("circle", {
|
|
240
|
-
className: cursor.dot.className,
|
|
241
|
-
cx: cursor.dot.cx,
|
|
242
|
-
cy: cursor.dot.cy,
|
|
243
|
-
r: cursor.dot.r
|
|
244
|
-
})] }),
|
|
245
|
-
/* @__PURE__ */ jsx("rect", {
|
|
246
|
-
className: scene.hit.className,
|
|
247
|
-
fill: scene.hit.fill,
|
|
248
|
-
height: scene.hit.height,
|
|
249
|
-
onClick: pinned.handleClick,
|
|
250
|
-
onPointerLeave: pinned.handlePointerLeave,
|
|
251
|
-
onPointerMove: pinned.handlePointerMove,
|
|
252
|
-
width: scene.hit.width,
|
|
253
|
-
x: scene.hit.x,
|
|
254
|
-
y: scene.hit.y
|
|
255
|
-
})
|
|
256
|
-
]
|
|
257
|
-
})] });
|
|
79
|
+
}), renderScene(scene.draw(cursor, {
|
|
80
|
+
onClick: pinned.handleClick,
|
|
81
|
+
onPointerLeave: pinned.handlePointerLeave,
|
|
82
|
+
onPointerMove: pinned.handlePointerMove
|
|
83
|
+
}))] });
|
|
258
84
|
}
|
|
259
85
|
//#endregion
|
|
260
86
|
export { WindHistoryChart };
|
|
@@ -3,8 +3,6 @@ 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
|
-
import "../../scene/index.js";
|
|
7
|
-
import { ReactNode } from "react";
|
|
8
6
|
//#region src/react/components/WindRose.d.ts
|
|
9
7
|
declare function WindRose({ station: stationProp, stationId, points, sectorCount, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, strings: stringsProp }: {
|
|
10
8
|
station?: Station;
|
|
@@ -14,6 +12,6 @@ declare function WindRose({ station: stationProp, stationId, points, sectorCount
|
|
|
14
12
|
thresholds?: SpeedThresholds | null;
|
|
15
13
|
favorableDirections?: FavorableDirection[] | null;
|
|
16
14
|
strings?: StationStringOverrides;
|
|
17
|
-
}): import("react").
|
|
15
|
+
}): import("react").ReactNode;
|
|
18
16
|
//#endregion
|
|
19
17
|
export { WindRose };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
|
-
import {
|
|
3
|
+
import { windRoseScene, windRoseSource } from "../../scene/rose.js";
|
|
4
|
+
import { renderScene } from "./SceneTree.js";
|
|
4
5
|
import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/react/components/WindRose.tsx
|
|
7
7
|
function WindRose({ station: stationProp, stationId, points, sectorCount = 16, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, strings: stringsProp }) {
|
|
8
8
|
const context = useStationFeedContext();
|
|
@@ -12,97 +12,14 @@ function WindRose({ station: stationProp, stationId, points, sectorCount = 16, t
|
|
|
12
12
|
thresholds: thresholdsProp,
|
|
13
13
|
favorableDirections: favorableDirectionsProp
|
|
14
14
|
});
|
|
15
|
-
|
|
16
|
-
const gate = windRoseGate(source, words);
|
|
17
|
-
if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
|
|
18
|
-
className: gate.className,
|
|
19
|
-
role: "note",
|
|
20
|
-
children: gate.text
|
|
21
|
-
});
|
|
22
|
-
return /* @__PURE__ */ jsx(WindRoseSceneView, { scene: windRoseScene({
|
|
15
|
+
return renderScene(windRoseScene({
|
|
23
16
|
favorableDirections,
|
|
24
17
|
sectorCount,
|
|
25
|
-
source,
|
|
18
|
+
source: windRoseSource(points, station),
|
|
26
19
|
stationName: station?.name,
|
|
27
20
|
thresholds,
|
|
28
21
|
words
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
/** One scene, one drawing — shared by the history-fed rose above and the
|
|
32
|
-
* climatology-fed twin, which appends its caption row as children. */
|
|
33
|
-
function WindRoseSceneView({ scene, children }) {
|
|
34
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
35
|
-
className: scene.className,
|
|
36
|
-
children: [
|
|
37
|
-
/* @__PURE__ */ jsxs("svg", {
|
|
38
|
-
"aria-label": scene.svg.ariaLabel,
|
|
39
|
-
className: scene.svg.className,
|
|
40
|
-
height: scene.svg.height,
|
|
41
|
-
role: "img",
|
|
42
|
-
viewBox: scene.svg.viewBox,
|
|
43
|
-
width: scene.svg.width,
|
|
44
|
-
children: [
|
|
45
|
-
scene.gridCircles.map((circle) => /* @__PURE__ */ jsx("circle", {
|
|
46
|
-
className: circle.className,
|
|
47
|
-
cx: circle.cx,
|
|
48
|
-
cy: circle.cy,
|
|
49
|
-
r: circle.r
|
|
50
|
-
}, circle.key)),
|
|
51
|
-
scene.ring && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
|
|
52
|
-
className: scene.ring.unfavorable.className,
|
|
53
|
-
cx: scene.ring.unfavorable.cx,
|
|
54
|
-
cy: scene.ring.unfavorable.cy,
|
|
55
|
-
r: scene.ring.unfavorable.r
|
|
56
|
-
}), scene.ring.favorable.map((arc) => /* @__PURE__ */ jsx("path", {
|
|
57
|
-
className: arc.className,
|
|
58
|
-
d: arc.d
|
|
59
|
-
}, arc.key))] }),
|
|
60
|
-
scene.ticks.map((tick) => /* @__PURE__ */ jsx("line", {
|
|
61
|
-
className: tick.className,
|
|
62
|
-
x1: tick.x1,
|
|
63
|
-
x2: tick.x2,
|
|
64
|
-
y1: tick.y1,
|
|
65
|
-
y2: tick.y2
|
|
66
|
-
}, tick.key)),
|
|
67
|
-
scene.letters.map((letter) => /* @__PURE__ */ jsx("text", {
|
|
68
|
-
className: letter.className,
|
|
69
|
-
textAnchor: letter.anchor,
|
|
70
|
-
x: letter.x,
|
|
71
|
-
y: letter.y,
|
|
72
|
-
children: letter.text
|
|
73
|
-
}, letter.key)),
|
|
74
|
-
scene.petals.map((petal) => /* @__PURE__ */ jsx("path", {
|
|
75
|
-
className: petal.className,
|
|
76
|
-
d: petal.d
|
|
77
|
-
}, petal.key)),
|
|
78
|
-
scene.ringLabel && /* @__PURE__ */ jsx("text", {
|
|
79
|
-
className: scene.ringLabel.className,
|
|
80
|
-
textAnchor: scene.ringLabel.anchor,
|
|
81
|
-
x: scene.ringLabel.x,
|
|
82
|
-
y: scene.ringLabel.y,
|
|
83
|
-
children: scene.ringLabel.text
|
|
84
|
-
}),
|
|
85
|
-
/* @__PURE__ */ jsx("circle", {
|
|
86
|
-
className: scene.hub.className,
|
|
87
|
-
cx: scene.hub.cx,
|
|
88
|
-
cy: scene.hub.cy,
|
|
89
|
-
r: scene.hub.r
|
|
90
|
-
}),
|
|
91
|
-
/* @__PURE__ */ jsx("circle", {
|
|
92
|
-
className: scene.dot.className,
|
|
93
|
-
cx: scene.dot.cx,
|
|
94
|
-
cy: scene.dot.cy,
|
|
95
|
-
r: scene.dot.r
|
|
96
|
-
})
|
|
97
|
-
]
|
|
98
|
-
}),
|
|
99
|
-
scene.calmCaption && /* @__PURE__ */ jsx("p", {
|
|
100
|
-
className: scene.calmCaption.className,
|
|
101
|
-
children: scene.calmCaption.text
|
|
102
|
-
}),
|
|
103
|
-
children
|
|
104
|
-
]
|
|
105
|
-
});
|
|
22
|
+
}));
|
|
106
23
|
}
|
|
107
24
|
//#endregion
|
|
108
|
-
export { WindRose
|
|
25
|
+
export { WindRose };
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
3
|
import { readoutAriaLive } from "../../scene/chart.js";
|
|
4
4
|
import { SAMPLE_STRIP_CLASS, sampleStripGate, sampleStripScene } from "../../scene/sample-strip.js";
|
|
5
|
+
import { renderScene } from "./SceneTree.js";
|
|
5
6
|
import { useStationFeedContext } from "./StationFeedProvider.js";
|
|
6
7
|
import { usePinnedCursor } from "../lib/use-pinned-cursor.js";
|
|
7
8
|
import { Readout } from "./Readout.js";
|
|
@@ -10,7 +11,8 @@ import { useRef } from "react";
|
|
|
10
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
12
|
//#region src/react/components/WindSampleStrip.tsx
|
|
12
13
|
function WindSampleStrip({ samples, stationName, unit: unitProp, favorableDirections: favorableDirectionsProp, plotHeight, strings: stringsProp, formatTime: formatTimeProp }) {
|
|
13
|
-
const
|
|
14
|
+
const context = useStationFeedContext();
|
|
15
|
+
const { favorableDirections, formatTime, unit, words } = resolveDisplay(context, {
|
|
14
16
|
formatTime: formatTimeProp,
|
|
15
17
|
strings: stringsProp,
|
|
16
18
|
favorableDirections: favorableDirectionsProp,
|
|
@@ -58,120 +60,11 @@ function MeasuredStrip({ favorableDirections, formatTime, plotHeight, samples, s
|
|
|
58
60
|
className: scene.readout.className,
|
|
59
61
|
parts: readout.span,
|
|
60
62
|
strong: readout.strong
|
|
61
|
-
}),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
viewBox: scene.svg.viewBox,
|
|
67
|
-
width: scene.svg.width,
|
|
68
|
-
children: [
|
|
69
|
-
scene.grid.map(({ key, line, label }) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
|
|
70
|
-
className: line.className,
|
|
71
|
-
x1: line.x1,
|
|
72
|
-
x2: line.x2,
|
|
73
|
-
y1: line.y1,
|
|
74
|
-
y2: line.y2
|
|
75
|
-
}), /* @__PURE__ */ jsx("text", {
|
|
76
|
-
className: label.className,
|
|
77
|
-
textAnchor: label.anchor,
|
|
78
|
-
x: label.x,
|
|
79
|
-
y: label.y,
|
|
80
|
-
children: label.text
|
|
81
|
-
})] }, key)),
|
|
82
|
-
scene.vaneGuides.map((guide) => /* @__PURE__ */ jsx("line", {
|
|
83
|
-
className: guide.className,
|
|
84
|
-
x1: guide.x1,
|
|
85
|
-
x2: guide.x2,
|
|
86
|
-
y1: guide.y1,
|
|
87
|
-
y2: guide.y2
|
|
88
|
-
}, `guide-${guide.key}`)),
|
|
89
|
-
scene.trace.map((part) => part.kind === "dot" ? /* @__PURE__ */ jsx("circle", {
|
|
90
|
-
className: part.className,
|
|
91
|
-
cx: part.cx,
|
|
92
|
-
cy: part.cy,
|
|
93
|
-
r: part.r
|
|
94
|
-
}, part.key) : /* @__PURE__ */ jsx("polyline", {
|
|
95
|
-
className: part.className,
|
|
96
|
-
points: part.points
|
|
97
|
-
}, part.key)),
|
|
98
|
-
scene.calmNote && /* @__PURE__ */ jsx("text", {
|
|
99
|
-
className: scene.calmNote.className,
|
|
100
|
-
textAnchor: scene.calmNote.anchor,
|
|
101
|
-
x: scene.calmNote.x,
|
|
102
|
-
y: scene.calmNote.y,
|
|
103
|
-
children: scene.calmNote.text
|
|
104
|
-
}),
|
|
105
|
-
/* @__PURE__ */ jsx("text", {
|
|
106
|
-
className: scene.rowLabels.to.className,
|
|
107
|
-
textAnchor: scene.rowLabels.to.anchor,
|
|
108
|
-
x: scene.rowLabels.to.x,
|
|
109
|
-
y: scene.rowLabels.to.y,
|
|
110
|
-
children: scene.rowLabels.to.text
|
|
111
|
-
}),
|
|
112
|
-
scene.vanes.map((vane) => vane.mark.kind === "calm" ? /* @__PURE__ */ jsx("text", {
|
|
113
|
-
className: vane.mark.text.className,
|
|
114
|
-
textAnchor: vane.mark.text.anchor,
|
|
115
|
-
x: vane.mark.text.x,
|
|
116
|
-
y: vane.mark.text.y,
|
|
117
|
-
children: vane.mark.text.text
|
|
118
|
-
}, vane.key) : /* @__PURE__ */ jsx("path", {
|
|
119
|
-
className: vane.mark.className,
|
|
120
|
-
d: vane.mark.d
|
|
121
|
-
}, vane.key)),
|
|
122
|
-
scene.vanes.map((vane) => vane.label && /* @__PURE__ */ jsx("text", {
|
|
123
|
-
className: vane.label.className,
|
|
124
|
-
textAnchor: vane.label.anchor,
|
|
125
|
-
x: vane.label.x,
|
|
126
|
-
y: vane.label.y,
|
|
127
|
-
children: vane.label.text
|
|
128
|
-
}, `label-${vane.key}`)),
|
|
129
|
-
/* @__PURE__ */ jsx("text", {
|
|
130
|
-
className: scene.rowLabels.avg.className,
|
|
131
|
-
textAnchor: scene.rowLabels.avg.anchor,
|
|
132
|
-
x: scene.rowLabels.avg.x,
|
|
133
|
-
y: scene.rowLabels.avg.y,
|
|
134
|
-
children: scene.rowLabels.avg.text
|
|
135
|
-
}),
|
|
136
|
-
scene.vanes.map((vane) => vane.value && /* @__PURE__ */ jsx("text", {
|
|
137
|
-
className: vane.value.className,
|
|
138
|
-
textAnchor: vane.value.anchor,
|
|
139
|
-
x: vane.value.x,
|
|
140
|
-
y: vane.value.y,
|
|
141
|
-
children: vane.value.text
|
|
142
|
-
}, `value-${vane.key}`)),
|
|
143
|
-
scene.ticks.map((tick) => /* @__PURE__ */ jsx("text", {
|
|
144
|
-
className: tick.className,
|
|
145
|
-
textAnchor: tick.anchor,
|
|
146
|
-
x: tick.x,
|
|
147
|
-
y: tick.y,
|
|
148
|
-
children: tick.text
|
|
149
|
-
}, tick.key)),
|
|
150
|
-
cursor && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("line", {
|
|
151
|
-
className: cursor.line.className,
|
|
152
|
-
x1: cursor.line.x1,
|
|
153
|
-
x2: cursor.line.x2,
|
|
154
|
-
y1: cursor.line.y1,
|
|
155
|
-
y2: cursor.line.y2
|
|
156
|
-
}), /* @__PURE__ */ jsx("circle", {
|
|
157
|
-
className: cursor.dot.className,
|
|
158
|
-
cx: cursor.dot.cx,
|
|
159
|
-
cy: cursor.dot.cy,
|
|
160
|
-
r: cursor.dot.r
|
|
161
|
-
})] }),
|
|
162
|
-
/* @__PURE__ */ jsx("rect", {
|
|
163
|
-
className: scene.hit.className,
|
|
164
|
-
fill: scene.hit.fill,
|
|
165
|
-
height: scene.hit.height,
|
|
166
|
-
onClick: pinned.handleClick,
|
|
167
|
-
onPointerLeave: pinned.handlePointerLeave,
|
|
168
|
-
onPointerMove: pinned.handlePointerMove,
|
|
169
|
-
width: scene.hit.width,
|
|
170
|
-
x: scene.hit.x,
|
|
171
|
-
y: scene.hit.y
|
|
172
|
-
})
|
|
173
|
-
]
|
|
174
|
-
})] });
|
|
63
|
+
}), renderScene(scene.draw(cursor, {
|
|
64
|
+
onClick: pinned.handleClick,
|
|
65
|
+
onPointerLeave: pinned.handlePointerLeave,
|
|
66
|
+
onPointerMove: pinned.handlePointerMove
|
|
67
|
+
}))] });
|
|
175
68
|
}
|
|
176
69
|
//#endregion
|
|
177
70
|
export { WindSampleStrip };
|
|
@@ -15,11 +15,11 @@ type SpeedAtomProps = AtomProps & {
|
|
|
15
15
|
declare function Speed(props: SpeedAtomProps): import("react").JSX.Element;
|
|
16
16
|
declare function Gust(props: SpeedAtomProps): import("react").JSX.Element;
|
|
17
17
|
declare function Lull(props: SpeedAtomProps): import("react").JSX.Element;
|
|
18
|
-
declare function Temperature({ station: stationProp, stationId, strings: stringsProp }: AtomProps): import("react").
|
|
19
|
-
declare function Pressure({ station: stationProp, stationId, strings: stringsProp }: AtomProps): import("react").
|
|
18
|
+
declare function Temperature({ station: stationProp, stationId, strings: stringsProp }: AtomProps): import("react").ReactNode;
|
|
19
|
+
declare function Pressure({ station: stationProp, stationId, strings: stringsProp }: AtomProps): import("react").ReactNode;
|
|
20
20
|
declare function Direction({ station: stationProp, stationId, strings: stringsProp, favorableDirections: favorableDirectionsProp }: AtomProps & {
|
|
21
21
|
favorableDirections?: FavorableDirection[] | null;
|
|
22
|
-
}): import("react").
|
|
22
|
+
}): import("react").ReactNode;
|
|
23
23
|
declare function UpdatedAt({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, strings: stringsProp, formatTime: formatTimeProp }: {
|
|
24
24
|
station?: Station;
|
|
25
25
|
stationId?: string;
|
|
@@ -27,10 +27,10 @@ declare function UpdatedAt({ station: stationProp, stationId, servedAt: servedAt
|
|
|
27
27
|
receivedAtMs?: number | null;
|
|
28
28
|
strings?: StationStringOverrides;
|
|
29
29
|
formatTime?: FormatTime;
|
|
30
|
-
}): import("react").
|
|
30
|
+
}): import("react").ReactNode;
|
|
31
31
|
declare function BandChip({ station: stationProp, stationId, thresholds: thresholdsProp, labels, unit: unitProp, strings: stringsProp }: SpeedAtomProps & {
|
|
32
32
|
thresholds?: SpeedThresholds | null;
|
|
33
33
|
labels?: readonly string[];
|
|
34
|
-
}): import("react").
|
|
34
|
+
}): import("react").ReactNode;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { BandChip, Direction, Gust, Lull, Pressure, Speed, Temperature, UpdatedAt };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolveDisplay } from "../../display.js";
|
|
3
3
|
import { subscribeTicker } from "../../client/ticker.js";
|
|
4
|
-
import {
|
|
4
|
+
import { pressureAtomScene, speedAtomScene, temperatureAtomScene } from "../../scene/atoms.js";
|
|
5
|
+
import { bandChipNode, directionAtomNode, updatedAtNode, valueAtomNode } from "../../scene/cells.js";
|
|
6
|
+
import { renderScene } from "./SceneTree.js";
|
|
5
7
|
import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
|
|
6
|
-
import { DirectionCell } from "../lib/cells.js";
|
|
7
8
|
import { useEffect, useState } from "react";
|
|
8
|
-
import {
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
10
|
//#region src/react/components/atoms.tsx
|
|
10
11
|
function useResolvedStation(component, stationProp, stationId) {
|
|
11
12
|
const context = useStationFeedContext();
|
|
@@ -14,23 +15,13 @@ function useResolvedStation(component, stationProp, stationId) {
|
|
|
14
15
|
station: requireResolved(component, "station", stationProp ?? resolveStation(context, stationId))
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
function ValueAtom({ scene }) {
|
|
18
|
-
return /* @__PURE__ */ jsx("data", {
|
|
19
|
-
className: scene.className,
|
|
20
|
-
value: scene.value,
|
|
21
|
-
children: scene.content.kind === "dash" ? scene.content.text : /* @__PURE__ */ jsxs(Fragment, { children: [scene.content.text, /* @__PURE__ */ jsx("span", {
|
|
22
|
-
className: scene.content.unit.className,
|
|
23
|
-
children: scene.content.unit.text
|
|
24
|
-
})] })
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
18
|
function SpeedValue({ component, kind, station: stationProp, stationId, unit: unitProp, strings: stringsProp }) {
|
|
28
19
|
const { context, station } = useResolvedStation(component, stationProp, stationId);
|
|
29
20
|
const { unit, words } = resolveDisplay(context, {
|
|
30
21
|
strings: stringsProp,
|
|
31
22
|
unit: unitProp
|
|
32
23
|
});
|
|
33
|
-
return
|
|
24
|
+
return renderScene(valueAtomNode(speedAtomScene(station, kind, unit, words)));
|
|
34
25
|
}
|
|
35
26
|
function Speed(props) {
|
|
36
27
|
return /* @__PURE__ */ jsx(SpeedValue, {
|
|
@@ -56,12 +47,12 @@ function Lull(props) {
|
|
|
56
47
|
function Temperature({ station: stationProp, stationId, strings: stringsProp }) {
|
|
57
48
|
const { context, station } = useResolvedStation("Temperature", stationProp, stationId);
|
|
58
49
|
const { words } = resolveDisplay(context, { strings: stringsProp });
|
|
59
|
-
return
|
|
50
|
+
return renderScene(valueAtomNode(temperatureAtomScene(station, words)));
|
|
60
51
|
}
|
|
61
52
|
function Pressure({ station: stationProp, stationId, strings: stringsProp }) {
|
|
62
53
|
const { context, station } = useResolvedStation("Pressure", stationProp, stationId);
|
|
63
54
|
const { words } = resolveDisplay(context, { strings: stringsProp });
|
|
64
|
-
return
|
|
55
|
+
return renderScene(valueAtomNode(pressureAtomScene(station, words)));
|
|
65
56
|
}
|
|
66
57
|
function Direction({ station: stationProp, stationId, strings: stringsProp, favorableDirections: favorableDirectionsProp }) {
|
|
67
58
|
const { context, station } = useResolvedStation("Direction", stationProp, stationId);
|
|
@@ -69,20 +60,7 @@ function Direction({ station: stationProp, stationId, strings: stringsProp, favo
|
|
|
69
60
|
strings: stringsProp,
|
|
70
61
|
favorableDirections: favorableDirectionsProp
|
|
71
62
|
});
|
|
72
|
-
|
|
73
|
-
if (scene.cell == null) return /* @__PURE__ */ jsx("span", {
|
|
74
|
-
className: scene.className,
|
|
75
|
-
children: scene.dashText
|
|
76
|
-
});
|
|
77
|
-
return /* @__PURE__ */ jsx("span", {
|
|
78
|
-
"aria-label": scene.ariaLabel,
|
|
79
|
-
className: scene.className,
|
|
80
|
-
children: /* @__PURE__ */ jsx(DirectionCell, {
|
|
81
|
-
windAvgMps: scene.cell.windAvgMps,
|
|
82
|
-
windDirectionDeg: scene.cell.windDirectionDeg,
|
|
83
|
-
words
|
|
84
|
-
})
|
|
85
|
-
});
|
|
63
|
+
return renderScene(directionAtomNode(station, words, favorableDirections));
|
|
86
64
|
}
|
|
87
65
|
function UpdatedAt({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, strings: stringsProp, formatTime: formatTimeProp }) {
|
|
88
66
|
const { context, station } = useResolvedStation("UpdatedAt", stationProp, stationId);
|
|
@@ -97,23 +75,14 @@ function UpdatedAt({ station: stationProp, stationId, servedAt: servedAtProp, re
|
|
|
97
75
|
setNowMs(Date.now());
|
|
98
76
|
return subscribeTicker(() => setNowMs(Date.now()));
|
|
99
77
|
}, []);
|
|
100
|
-
|
|
78
|
+
return renderScene(updatedAtNode({
|
|
101
79
|
formatTime,
|
|
102
80
|
nowMs,
|
|
103
81
|
receivedAtMs,
|
|
104
82
|
servedAt,
|
|
105
83
|
station,
|
|
106
84
|
words
|
|
107
|
-
});
|
|
108
|
-
if (scene.kind === "dash") return /* @__PURE__ */ jsx("span", {
|
|
109
|
-
className: scene.className,
|
|
110
|
-
children: scene.text
|
|
111
|
-
});
|
|
112
|
-
return /* @__PURE__ */ jsx("time", {
|
|
113
|
-
className: scene.className,
|
|
114
|
-
dateTime: scene.dateTime,
|
|
115
|
-
children: scene.text
|
|
116
|
-
});
|
|
85
|
+
}));
|
|
117
86
|
}
|
|
118
87
|
function BandChip({ station: stationProp, stationId, thresholds: thresholdsProp, labels, unit: unitProp, strings: stringsProp }) {
|
|
119
88
|
const { context, station } = useResolvedStation("BandChip", stationProp, stationId);
|
|
@@ -122,18 +91,13 @@ function BandChip({ station: stationProp, stationId, thresholds: thresholdsProp,
|
|
|
122
91
|
thresholds: thresholdsProp,
|
|
123
92
|
unit: unitProp
|
|
124
93
|
});
|
|
125
|
-
|
|
94
|
+
return renderScene(bandChipNode({
|
|
126
95
|
labels,
|
|
127
96
|
station,
|
|
128
97
|
thresholds,
|
|
129
98
|
unit,
|
|
130
99
|
words
|
|
131
|
-
});
|
|
132
|
-
return /* @__PURE__ */ jsx("span", {
|
|
133
|
-
className: scene.className,
|
|
134
|
-
"data-band": scene.band,
|
|
135
|
-
children: scene.text
|
|
136
|
-
});
|
|
100
|
+
}));
|
|
137
101
|
}
|
|
138
102
|
//#endregion
|
|
139
103
|
export { BandChip, Direction, Gust, Lull, Pressure, Speed, Temperature, UpdatedAt };
|
|
@@ -10,7 +10,7 @@ function useStationCurrent(url, stationId, options = {}) {
|
|
|
10
10
|
const initialRef = useRef(initialData);
|
|
11
11
|
const mountUrlRef = useRef(url);
|
|
12
12
|
const mountStationRef = useRef(stationId);
|
|
13
|
-
const
|
|
13
|
+
const store = useMemo(() => createStationCurrentStore(url, stationId, {
|
|
14
14
|
...pollSeconds != null ? { pollSeconds } : {},
|
|
15
15
|
fetchInit: () => fetchInitRef.current,
|
|
16
16
|
...url === mountUrlRef.current && stationId === mountStationRef.current && initialRef.current != null ? { initial: initialRef.current } : {}
|
|
@@ -18,7 +18,8 @@ function useStationCurrent(url, stationId, options = {}) {
|
|
|
18
18
|
url,
|
|
19
19
|
stationId,
|
|
20
20
|
pollSeconds
|
|
21
|
-
])
|
|
21
|
+
]);
|
|
22
|
+
const { snapshot, refresh } = usePoller(store, enabled);
|
|
22
23
|
return {
|
|
23
24
|
current: snapshot.data,
|
|
24
25
|
station: snapshot.data?.station ?? null,
|
|
@@ -9,14 +9,15 @@ function useStationFeed(url, options = {}) {
|
|
|
9
9
|
fetchInitRef.current = fetchInit;
|
|
10
10
|
const initialRef = useRef(initialData);
|
|
11
11
|
const mountUrlRef = useRef(url);
|
|
12
|
-
const
|
|
12
|
+
const store = useMemo(() => createStationFeedStore(url, {
|
|
13
13
|
...pollSeconds != null ? { pollSeconds } : {},
|
|
14
14
|
fetchInit: () => fetchInitRef.current,
|
|
15
15
|
...url === mountUrlRef.current && initialRef.current != null ? { initial: {
|
|
16
16
|
feed: initialRef.current.feed,
|
|
17
17
|
receivedAtMs: initialRef.current.receivedAtMs
|
|
18
18
|
} } : {}
|
|
19
|
-
}), [url, pollSeconds])
|
|
19
|
+
}), [url, pollSeconds]);
|
|
20
|
+
const { snapshot, refresh } = usePoller(store, enabled);
|
|
20
21
|
return {
|
|
21
22
|
feed: snapshot.data,
|
|
22
23
|
error: snapshot.error,
|