@azohra/meteo.station 0.4.2 → 0.6.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.
Files changed (61) hide show
  1. package/README.md +1 -1
  2. package/dist/client/climatology.js +1 -1
  3. package/dist/client/history.d.ts +8 -14
  4. package/dist/client/history.js +8 -18
  5. package/dist/client/live.d.ts +2 -1
  6. package/dist/client/live.js +7 -4
  7. package/dist/client/stores.js +10 -2
  8. package/dist/climatology.d.ts +9 -4
  9. package/dist/climatology.js +28 -6
  10. package/dist/contract-climatology.d.ts +4 -0
  11. package/dist/contract-climatology.js +3 -1
  12. package/dist/contract.d.ts +7 -7
  13. package/dist/derive.js +5 -4
  14. package/dist/elements/elements/DailyPatternElement.js +4 -4
  15. package/dist/elements/elements/TrendChartElement.js +12 -31
  16. package/dist/elements/elements/WindHistoryChartElement.js +16 -35
  17. package/dist/elements/elements/atoms.d.ts +1 -1
  18. package/dist/elements/lib/pinned-cursor.js +48 -0
  19. package/dist/fixtures.d.ts +6 -2
  20. package/dist/fixtures.js +30 -2
  21. package/dist/format.js +7 -3
  22. package/dist/geometry.d.ts +2 -2
  23. package/dist/geometry.js +24 -17
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.js +2 -2
  26. package/dist/react/components/DailyPattern.js +2 -2
  27. package/dist/react/components/Dial.d.ts +1 -2
  28. package/dist/react/components/RecentSummaries.d.ts +1 -2
  29. package/dist/react/components/RecentSummaries.js +1 -2
  30. package/dist/react/components/TrendChart.js +8 -26
  31. package/dist/react/components/WindHistoryChart.js +12 -31
  32. package/dist/react/components/WindSampleStrip.js +11 -29
  33. package/dist/react/hooks/useStation.js +28 -50
  34. package/dist/react/hooks/useStationFeed.d.ts +0 -1
  35. package/dist/react/index.js +2 -2
  36. package/dist/react/lib/use-pinned-cursor.js +32 -0
  37. package/dist/samples.js +7 -43
  38. package/dist/scene/climatology-pattern.js +1 -1
  39. package/dist/scene/climatology-rose.js +1 -1
  40. package/dist/scene/daily-pattern.js +3 -3
  41. package/dist/scene/recent-summaries.js +1 -4
  42. package/dist/scene/trend.js +2 -7
  43. package/dist/scene/wind-plot.js +14 -6
  44. package/dist/server/adapters/windnerd-climatology.d.ts +5 -8
  45. package/dist/server/adapters/windnerd-climatology.js +11 -10
  46. package/dist/server/adapters/windnerd-live.d.ts +5 -8
  47. package/dist/server/adapters/windnerd-live.js +5 -8
  48. package/dist/server/adapters/windnerd.d.ts +2 -3
  49. package/dist/server/adapters/windnerd.js +4 -15
  50. package/dist/server/environment.d.ts +4 -10
  51. package/dist/server/environment.js +4 -10
  52. package/dist/server/index.d.ts +2 -2
  53. package/dist/server/index.js +2 -2
  54. package/dist/strings.d.ts +1 -1
  55. package/dist/strings.js +1 -1
  56. package/dist/windnerd.d.ts +3 -1
  57. package/dist/windnerd.js +11 -1
  58. package/package.json +3 -3
  59. package/schema/README.md +2 -2
  60. package/schema/stationclimatology.schema.json +26 -0
  61. package/styles.css +19 -21
@@ -1,10 +1,11 @@
1
1
  import { measuredChartWidth } from "../../geometry.js";
2
- import { activeChartIndex, chartIndexAtClient, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
2
+ import { readoutAriaLive } from "../../scene/chart.js";
3
3
  import { WIND_CHART_CLASS, windChartGate, windChartScene } from "../../scene/wind-history.js";
4
4
  import { numberAttribute } from "../lib/attributes.js";
5
5
  import { MeteoStationElement } from "../lib/base.js";
6
6
  import { h, hs } from "../lib/h.js";
7
7
  import { windArrowSvg } from "../lib/fragments.js";
8
+ import { PinnedCursor } from "../lib/pinned-cursor.js";
8
9
  //#region src/elements/elements/WindHistoryChartElement.ts
9
10
  let hatchCounter = 0;
10
11
  function readoutSpan(parts) {
@@ -23,12 +24,15 @@ var WindHistoryChartElement = class extends MeteoStationElement {
23
24
  ];
24
25
  #width = null;
25
26
  #observer = null;
26
- #pinnedAt = null;
27
- #previewIndex = null;
28
27
  #scene = null;
29
28
  #readout = null;
30
29
  #svg = null;
31
30
  #hit = null;
31
+ #cursor = new PinnedCursor({
32
+ scene: () => this.#scene,
33
+ svg: () => this.#svg,
34
+ onChange: () => this.#updateCursor()
35
+ });
32
36
  disconnected() {
33
37
  this.#observer?.disconnect();
34
38
  this.#observer = null;
@@ -98,12 +102,9 @@ var WindHistoryChartElement = class extends MeteoStationElement {
98
102
  class: scene.hit.className,
99
103
  fill: scene.hit.fill,
100
104
  height: scene.hit.height,
101
- onclick: (event) => this.#handleClick(event),
102
- onpointerleave: () => {
103
- this.#previewIndex = null;
104
- this.#updateCursor();
105
- },
106
- onpointermove: (event) => this.#handlePointerMove(event),
105
+ onclick: (event) => this.#cursor.handleClick(event),
106
+ onpointerleave: () => this.#cursor.handlePointerLeave(),
107
+ onpointermove: (event) => this.#cursor.handlePointerMove(event),
107
108
  width: scene.hit.width,
108
109
  x: scene.hit.x,
109
110
  y: scene.hit.y
@@ -214,22 +215,22 @@ var WindHistoryChartElement = class extends MeteoStationElement {
214
215
  }, vane.mark.text.text) : hs("path", {
215
216
  class: vane.mark.className,
216
217
  d: vane.mark.d
217
- })), scene.vanes.map((vane) => hs("text", {
218
+ })), scene.vanes.flatMap((vane) => vane.label == null ? [] : [hs("text", {
218
219
  class: vane.label.className,
219
220
  "text-anchor": vane.label.anchor,
220
221
  x: vane.label.x,
221
222
  y: vane.label.y
222
- }, vane.label.text)), hs("text", {
223
+ }, vane.label.text)]), hs("text", {
223
224
  class: scene.rowLabels.avg.className,
224
225
  "text-anchor": scene.rowLabels.avg.anchor,
225
226
  x: scene.rowLabels.avg.x,
226
227
  y: scene.rowLabels.avg.y
227
- }, scene.rowLabels.avg.text), scene.vanes.map((vane) => hs("text", {
228
+ }, scene.rowLabels.avg.text), scene.vanes.flatMap((vane) => vane.value == null ? [] : [hs("text", {
228
229
  class: vane.value.className,
229
230
  "text-anchor": vane.value.anchor,
230
231
  x: vane.value.x,
231
232
  y: vane.value.y
232
- }, vane.value.text)), scene.ticks.map((tick) => hs("text", {
233
+ }, vane.value.text)]), scene.ticks.map((tick) => hs("text", {
233
234
  class: tick.className,
234
235
  "text-anchor": tick.anchor,
235
236
  x: tick.x,
@@ -239,34 +240,14 @@ var WindHistoryChartElement = class extends MeteoStationElement {
239
240
  wrap.replaceChildren(readout, svg);
240
241
  this.#updateCursor();
241
242
  }
242
- #indexAtPoint(clientX) {
243
- const scene = this.#scene;
244
- const svg = this.#svg;
245
- if (scene == null || svg == null) return null;
246
- return chartIndexAtClient(scene.points, scene.frame, scene.scales, clientX, svg.getBoundingClientRect());
247
- }
248
- #handlePointerMove(event) {
249
- if (event.pointerType === "touch") return;
250
- this.#previewIndex = this.#indexAtPoint(event.clientX);
251
- this.#updateCursor();
252
- }
253
- #handleClick(event) {
254
- const index = this.#indexAtPoint(event.clientX);
255
- if (index == null) return;
256
- const observedAt = this.#scene?.points[index]?.observedAt;
257
- if (observedAt == null) return;
258
- this.#pinnedAt = togglePinnedAt(this.#pinnedAt, observedAt);
259
- this.#previewIndex = null;
260
- this.#updateCursor();
261
- }
262
243
  #updateCursor() {
263
244
  const scene = this.#scene;
264
245
  const readout = this.#readout;
265
246
  const svg = this.#svg;
266
247
  const hit = this.#hit;
267
248
  if (scene == null || readout == null || svg == null || hit == null) return;
268
- const inspection = scene.inspect(activeChartIndex(scene.points, this.#pinnedAt, this.#previewIndex));
269
- readout.setAttribute("aria-live", readoutAriaLive(this.#previewIndex));
249
+ const inspection = scene.inspect(this.#cursor.activeIndex());
250
+ readout.setAttribute("aria-live", readoutAriaLive(this.#cursor.previewIndex));
270
251
  readout.replaceChildren(h("strong", null, inspection.readout.strong), readoutSpan(inspection.readout.span));
271
252
  for (const mark of [...svg.querySelectorAll(".meteo-cursor, .meteo-cursor-dot")]) mark.remove();
272
253
  const cursor = inspection.cursor;
@@ -2,7 +2,7 @@ import { SpeedKind } from "../../format.js";
2
2
  import { MeteoStationElement } from "../lib/base.js";
3
3
  //#region src/elements/elements/atoms.d.ts
4
4
  declare abstract class SpeedAtomElement extends MeteoStationElement {
5
- static readonly observedAttributes: ("station-id" | "unit")[];
5
+ static readonly observedAttributes: ("unit" | "station-id")[];
6
6
  protected abstract readonly kind: SpeedKind;
7
7
  protected abstract readonly component: string;
8
8
  protected render(): void;
@@ -0,0 +1,48 @@
1
+ import { activeChartIndex, chartIndexAtClient, togglePinnedAt } from "../../scene/chart.js";
2
+ //#region src/elements/lib/pinned-cursor.ts
3
+ var PinnedCursor = class {
4
+ #pinnedAt = null;
5
+ #previewIndex = null;
6
+ #scene;
7
+ #svg;
8
+ #onChange;
9
+ constructor(host) {
10
+ this.#scene = host.scene;
11
+ this.#svg = host.svg;
12
+ this.#onChange = host.onChange;
13
+ }
14
+ get previewIndex() {
15
+ return this.#previewIndex;
16
+ }
17
+ activeIndex() {
18
+ const scene = this.#scene();
19
+ if (scene == null) return null;
20
+ return activeChartIndex(scene.points, this.#pinnedAt, this.#previewIndex);
21
+ }
22
+ handlePointerMove(event) {
23
+ if (event.pointerType === "touch") return;
24
+ this.#previewIndex = this.#indexAtPoint(event.clientX);
25
+ this.#onChange();
26
+ }
27
+ handlePointerLeave() {
28
+ this.#previewIndex = null;
29
+ this.#onChange();
30
+ }
31
+ handleClick(event) {
32
+ const index = this.#indexAtPoint(event.clientX);
33
+ if (index == null) return;
34
+ const observedAt = this.#scene()?.points[index]?.observedAt;
35
+ if (observedAt == null) return;
36
+ this.#pinnedAt = togglePinnedAt(this.#pinnedAt, observedAt);
37
+ this.#previewIndex = null;
38
+ this.#onChange();
39
+ }
40
+ #indexAtPoint(clientX) {
41
+ const scene = this.#scene();
42
+ const svg = this.#svg();
43
+ if (scene == null || svg == null) return null;
44
+ return chartIndexAtClient(scene.points, scene.frame, scene.scales, clientX, svg.getBoundingClientRect());
45
+ }
46
+ };
47
+ //#endregion
48
+ export { PinnedCursor };
@@ -1,5 +1,9 @@
1
- import { HistoryPoint } from "./contract.js";
1
+ import { HistoryPoint, StationMeta } from "./contract.js";
2
+ import { SpeedThresholds } from "./derive.js";
2
3
  //#region src/fixtures.d.ts
4
+ declare const LAUNCH_RIDGE_META: StationMeta;
5
+ /** The wind grading the demo exhibits judge with. */
6
+ declare const EXHIBIT_THRESHOLDS: SpeedThresholds;
3
7
  /** Deterministic PRNG (mulberry32). */
4
8
  declare function mulberry32(seed: number): () => number;
5
9
  /** Smoothstep clamped to [0, 1]. */
@@ -20,4 +24,4 @@ interface LongHistoryOptions {
20
24
  /** A long-range deterministic synthetic history: seasonal, diurnal, with occasional dropouts. */
21
25
  declare function buildLongHistory({ nowMs, days, periodMinutes, seed, withGaps }: LongHistoryOptions): HistoryPoint[];
22
26
  //#endregion
23
- export { LongHistoryOptions, buildLongHistory, mulberry32, smooth, wobble };
27
+ export { EXHIBIT_THRESHOLDS, LAUNCH_RIDGE_META, LongHistoryOptions, buildLongHistory, mulberry32, smooth, wobble };
package/dist/fixtures.js CHANGED
@@ -1,6 +1,34 @@
1
+ import { kmhToMps } from "@azohra/meteo.core";
1
2
  //#region src/fixtures.ts
2
3
  const MINUTE_MS = 6e4;
3
4
  const DAY_MS = 1440 * MINUTE_MS;
5
+ const LAUNCH_RIDGE_META = {
6
+ id: "launch-ridge",
7
+ name: "Launch Ridge",
8
+ sourceLabel: "WindNerd",
9
+ pageUrl: null,
10
+ latitude: 49.078,
11
+ longitude: -117.785,
12
+ timeZone: "America/Vancouver",
13
+ elevationM: 1245,
14
+ capabilities: {
15
+ gustLull: true,
16
+ temperature: true,
17
+ conditions: false,
18
+ history: true
19
+ },
20
+ samplingWindowSeconds: 3,
21
+ recommendedPollSeconds: 5
22
+ };
23
+ /** The wind grading the demo exhibits judge with. */
24
+ const EXHIBIT_THRESHOLDS = {
25
+ unit: "kmh",
26
+ values: [
27
+ 12,
28
+ 20,
29
+ 28
30
+ ]
31
+ };
4
32
  /** Deterministic PRNG (mulberry32). */
5
33
  function mulberry32(seed) {
6
34
  let a = seed >>> 0;
@@ -20,7 +48,7 @@ const smooth = (value) => {
20
48
  const wobble = (seed) => (Math.sin(seed * 12.9898) + Math.sin(seed * 4.1414 + 1.3)) / 2;
21
49
  const round1 = (value) => Math.round(value * 10) / 10;
22
50
  const round2 = (value) => Math.round(value * 100) / 100;
23
- const mps = (kmh) => round2(kmh / 3.6);
51
+ const mps = (kmh) => round2(kmhToMps(kmh));
24
52
  const normalizeDeg = (deg) => (deg % 360 + 360) % 360;
25
53
  function seasonPhase(dateUtc) {
26
54
  const solsticeMs = Date.UTC(dateUtc.getUTCFullYear(), 11, 21);
@@ -64,4 +92,4 @@ function buildLongHistory({ nowMs, days = 420, periodMinutes = 15, seed = 995373
64
92
  return points;
65
93
  }
66
94
  //#endregion
67
- export { buildLongHistory, mulberry32, smooth, wobble };
95
+ export { EXHIBIT_THRESHOLDS, LAUNCH_RIDGE_META, buildLongHistory, mulberry32, smooth, wobble };
package/dist/format.js CHANGED
@@ -1,4 +1,4 @@
1
- import { compassDirection, isCalm, periodSummary, speedFromMps } from "./derive.js";
1
+ import { anchoredAgeMs, compassDirection, isCalm, periodSummary, speedFromMps } from "./derive.js";
2
2
  //#region src/format.ts
3
3
  function roundSpeed(mps, unit) {
4
4
  return Math.round(speedFromMps(mps, unit));
@@ -40,8 +40,12 @@ function relativeWords(ageMs, words) {
40
40
  return words.updated.hoursAgo(Math.floor(ageMs / HOUR_MS));
41
41
  }
42
42
  function readingAgeMs(args) {
43
- const observedMs = Date.parse(args.observedAt);
44
- return args.servedAt != null && args.receivedAtMs != null ? Math.max(0, Date.parse(args.servedAt) - observedMs) + Math.max(0, args.nowMs - args.receivedAtMs) : Math.max(0, args.nowMs - observedMs);
43
+ return args.servedAt != null && args.receivedAtMs != null ? anchoredAgeMs({
44
+ observedAt: args.observedAt,
45
+ servedAt: args.servedAt,
46
+ receivedAtMs: args.receivedAtMs,
47
+ nowMs: args.nowMs
48
+ }) : Math.max(0, args.nowMs - Date.parse(args.observedAt));
45
49
  }
46
50
  function updatedAtText(ageMs, observedAt, words, formatTime) {
47
51
  return ageMs >= 216e5 ? formatTime(new Date(Date.parse(observedAt))) : relativeWords(ageMs, words);
@@ -52,7 +52,7 @@ type ChartTick = {
52
52
  timeMs: number;
53
53
  x: number;
54
54
  };
55
- declare function vaneTicks(vanes: ReadonlyArray<Vane>, scales: ChartScales): ChartTick[];
55
+ declare function vaneTicks(vanes: ReadonlyArray<Vane>, scales: ChartScales, labelCount?: number): ChartTick[];
56
56
  declare function nearestIndex(points: ReadonlyArray<{
57
57
  observedAt: string;
58
58
  }>, chartX: number, frame: ChartFrame, scales: ChartScales): number | null;
@@ -90,7 +90,7 @@ declare const METEOROLOGICAL_SEASON_MONTHS: Record<"fall" | "spring" | "summer"
90
90
  declare function filterByMonth(points: ReadonlyArray<HistoryPoint>, months: ReadonlyArray<number>, utcOffsetMinutes?: number): HistoryPoint[];
91
91
  declare function filterByTimeOfDay(points: ReadonlyArray<HistoryPoint>, fromMinute: number, toMinute: number, utcOffsetMinutes?: number): HistoryPoint[];
92
92
  /** The share of non-calm history blowing from inside the consumer's arcs;
93
- * null when nothing non-calm was measured — absence over a fabricated zero. */
93
+ * null when nothing non-calm was measured. */
94
94
  declare function favorableShare(points: ReadonlyArray<HistoryPoint>, arcs: ReadonlyArray<DirectionArc>): number | null;
95
95
  type HistoryCoverage = {
96
96
  actualCount: number;
package/dist/geometry.js CHANGED
@@ -28,7 +28,7 @@ function chartFrame(width) {
28
28
  }
29
29
  const DEFAULT_NICE_STEP_MPS = 5 / KMH_PER_MPS;
30
30
  const DEFAULT_FLOOR_MPS = 10 / KMH_PER_MPS;
31
- function chartScales(points, frame, options = {}) {
31
+ function chartScalesOf(points, frame, speedOf, options = {}) {
32
32
  const niceStepMps = options.niceStepMps ?? DEFAULT_NICE_STEP_MPS;
33
33
  const floorMps = options.floorMps ?? DEFAULT_FLOOR_MPS;
34
34
  const first = points[0];
@@ -36,7 +36,7 @@ function chartScales(points, frame, options = {}) {
36
36
  const last = points[points.length - 1];
37
37
  const endMs = last ? Date.parse(last.observedAt) : startMs;
38
38
  const durationMs = Math.max(1, endMs - startMs);
39
- const top = points.reduce((max, point) => Math.max(max, point.windGustMps ?? point.windAvgMps), 0);
39
+ const top = points.reduce((max, point) => Math.max(max, speedOf(point)), 0);
40
40
  const scaleMax = Math.max(floorMps, Math.ceil(top / niceStepMps) * niceStepMps);
41
41
  const xAtMs = (ms) => frame.left + (ms - startMs) / durationMs * (frame.right - frame.left);
42
42
  return {
@@ -49,6 +49,9 @@ function chartScales(points, frame, options = {}) {
49
49
  yAt: (speedMps) => frame.plotBottom - speedMps / scaleMax * (frame.plotBottom - frame.plotTop)
50
50
  };
51
51
  }
52
+ function chartScales(points, frame, options = {}) {
53
+ return chartScalesOf(points, frame, (point) => point.windGustMps ?? point.windAvgMps, options);
54
+ }
52
55
  function valueScale(values, frame, options) {
53
56
  let low = Infinity;
54
57
  let high = -Infinity;
@@ -77,11 +80,17 @@ function bandPoints(points, scales) {
77
80
  const lull = [...points].reverse().map((point) => coordinate(scales.xAt(point.observedAt), scales.yAt(point.windLullMps)));
78
81
  return [...gust, ...lull].join(" ");
79
82
  }
83
+ function tracePointsOf(points, scales, speedOf) {
84
+ return points.map((point) => coordinate(scales.xAt(point.observedAt), scales.yAt(speedOf(point)))).join(" ");
85
+ }
80
86
  function averagePoints(points, scales) {
81
- return points.map((point) => coordinate(scales.xAt(point.observedAt), scales.yAt(point.windAvgMps))).join(" ");
87
+ return tracePointsOf(points, scales, (point) => point.windAvgMps);
88
+ }
89
+ function meanDirectionDegOf(points, speedOf, directionOf) {
90
+ return meanDirectionDeg(points.filter((point) => !isCalm(speedOf(point)) && directionOf(point) != null).map((point) => directionOf(point)));
82
91
  }
83
92
  function meanDirectionDeg$1(points) {
84
- return meanDirectionDeg(points.filter((point) => !isCalm(point.windAvgMps) && point.windDirectionDeg != null).map((point) => point.windDirectionDeg));
93
+ return meanDirectionDegOf(points, (point) => point.windAvgMps, (point) => point.windDirectionDeg);
85
94
  }
86
95
  function vectorMeanWind(points) {
87
96
  if (points.length === 0) return {
@@ -102,7 +111,7 @@ function vectorMeanWind(points) {
102
111
  speedMps: mean.speedMps
103
112
  };
104
113
  }
105
- function thinVanes(points, target = 13) {
114
+ function thinVanesOf(points, speedOf, directionOf, target = 13) {
106
115
  if (points.length === 0) return [];
107
116
  const step = Math.max(1, Math.round(points.length / target));
108
117
  return Array.from({ length: Math.ceil(points.length / step) }, (_, index) => {
@@ -112,14 +121,17 @@ function thinVanes(points, target = 13) {
112
121
  const first = Date.parse(window[0].observedAt);
113
122
  const last = Date.parse(window[window.length - 1].observedAt);
114
123
  return {
115
- windAvgMps: window.reduce((sum, point) => sum + point.windAvgMps, 0) / window.length,
116
- windDirectionDeg: meanDirectionDeg$1(window),
124
+ windAvgMps: window.reduce((sum, point) => sum + speedOf(point), 0) / window.length,
125
+ windDirectionDeg: meanDirectionDegOf(window, speedOf, directionOf),
117
126
  endIndex,
118
127
  midMs: first + (last - first) / 2,
119
128
  startIndex
120
129
  };
121
130
  });
122
131
  }
132
+ function thinVanes(points, target = 13) {
133
+ return thinVanesOf(points, (point) => point.windAvgMps, (point) => point.windDirectionDeg, target);
134
+ }
123
135
  function vanePath(cx, cy, fromBearingDeg, { reach = 7, spread = 3.2 } = {}) {
124
136
  const angle = radians(fromBearingDeg + 180);
125
137
  const sin = Math.sin(angle);
@@ -131,15 +143,10 @@ function vanePath(cx, cy, fromBearingDeg, { reach = 7, spread = 3.2 } = {}) {
131
143
  const at = ([px, py]) => `${px.toFixed(1)} ${py.toFixed(1)}`;
132
144
  return `M ${at(tail)} L ${at(tip)} M ${at(left)} L ${at(tip)} L ${at(right)}`;
133
145
  }
134
- function vaneTicks(vanes, scales) {
146
+ function vaneTicks(vanes, scales, labelCount = 5) {
135
147
  if (vanes.length === 0) return [];
136
- return [
137
- 0,
138
- .25,
139
- .5,
140
- .75,
141
- 1
142
- ].map((fraction, index) => {
148
+ const count = Math.max(2, Math.min(5, Math.floor(labelCount)));
149
+ return Array.from({ length: count }, (_, index) => index / (count - 1)).map((fraction, index) => {
143
150
  const vane = vanes[Math.round(fraction * (vanes.length - 1))];
144
151
  return {
145
152
  index,
@@ -260,7 +267,7 @@ function filterByTimeOfDay(points, fromMinute, toMinute, utcOffsetMinutes = 0) {
260
267
  });
261
268
  }
262
269
  /** The share of non-calm history blowing from inside the consumer's arcs;
263
- * null when nothing non-calm was measured — absence over a fabricated zero. */
270
+ * null when nothing non-calm was measured. */
264
271
  function favorableShare(points, arcs) {
265
272
  let blowing = 0;
266
273
  let favorable = 0;
@@ -373,4 +380,4 @@ function compareTracePoints(comparePoints, scales, offsetDays) {
373
380
  return comparePoints.map((point) => coordinate(scales.xAtMs(Date.parse(point.observedAt) + shiftMs), scales.yAt(point.windAvgMps))).join(" ");
374
381
  }
375
382
  //#endregion
376
- export { CHART_FALLBACK_WIDTH, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, HISTORY_GAP_TOLERANCE_FACTOR, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, favorableShare, filterByMonth, filterByTimeOfDay, historyCoverage, historyGaps, isCalmHistory, meanDirectionDeg$1 as meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, stretchFrame, thinVanes, tickAnchor, trendRuns, trendSeriesPad, trendValueOf, valueScale, vanePath, vaneTicks, vectorMeanWind, windRose, windowPoints };
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/index.d.ts CHANGED
@@ -8,9 +8,9 @@ import { DIAL_CARDINALS, DIAL_CARDINAL_TICK_INNER, DIAL_CENTRE, DIAL_COUNTERWEIG
8
8
  import { DisplayDefaults, DisplayProps, ResolvedDisplay, requireResolved, resolveDisplay, resolveStation } from "./display.js";
9
9
  import { climatologyEndpoint, currentEndpoint, feedEndpoint, historyEndpoint, liveEndpoint } from "./endpoints.js";
10
10
  import { CHART_FALLBACK_WIDTH, ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, HistoryCoverage, METEOROLOGICAL_SEASON_MONTHS, RoseSector, TickAnchor, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, favorableShare, filterByMonth, filterByTimeOfDay, historyCoverage, historyGaps, meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints } from "./geometry.js";
11
- import { ClimatologyAccumulator, ClimatologyCoverage, ClimatologyFilters, ClimatologyFoldParams, accumulatedCells, climatologyCoverage, climatologyFavorableShare, climatologyPattern, climatologyRose, createClimatologyAccumulator, foldClimatologyPoints } from "./climatology.js";
11
+ import { ClimatologyAccumulator, ClimatologyCoverage, ClimatologyFilters, ClimatologyFoldParams, accumulatedCells, climatologyCoverage, climatologyFavorableShare, climatologyPattern, climatologyRose, coveredSlotCountByYear, createClimatologyAccumulator, foldClimatologyPoints } from "./climatology.js";
12
12
  import { MergeResult, foldCurrent, mergeCurrent } from "./merge-current.js";
13
13
  import { SAMPLE_GAP_TOLERANCE_FACTOR, SamplesSummary, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes } from "./samples.js";
14
14
  import { AirRow, airRows, airSummary, lastStrikeWords } from "./air.js";
15
15
  import { normalizeWindnerdStationKey, windnerdStationUrl } from "./windnerd.js";
16
- export { type AirConditions, type AirRow, CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, CONNECTIVITY_SERVICE_STATES, type ChartFrame, type ChartScaleOptions, type ChartScales, type ChartTick, type ClimatologyAccumulator, type ClimatologyCell, type ClimatologyCoverage, type ClimatologyFilters, type ClimatologyFoldParams, type ClimatologySector, type ClimatologyYear, type CompassPoint, type ConnectivityServiceState, type ConnectivitySession, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, 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, type DailyPatternSlot, type DirectionCellData, type DisplayDefaults, type DisplayProps, type FavorableDirection, type FormatTime, type FreshnessStatus, type FreshnessThresholds, type History, type HistoryCoverage, type HistoryPoint, type HistoryRun, type LiveSample, type LiveSamples, METEOROLOGICAL_SEASON_MONTHS, type MergeResult, type PeriodSummary, type PressureTendency, 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, type Reading, type RecentSummary, type ResolvedDisplay, type RoseSector, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_CLIMATOLOGY_SCHEMA_VERSION, STATION_SCHEMA_VERSION, type SamplesSummary, type SpeedThresholds, type SpeedUnit, type Station, type StationCapabilities, type StationClimatology, type StationConnectivity, type StationCurrent, type StationFeed, type StationHistory, type StationLiveFrame, type StationMeta, type StationStringOverrides, type StationStrings, type StationTelemetry, type SummaryEntry, type TickAnchor, UNAVAILABLE_REASONS, type UnavailableReason, type Vane, type WindRoseSummary, accumulatedCells, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, climatologyCellSchema, climatologyCoverage, climatologyEndpoint, climatologyFavorableShare, climatologyPattern, climatologyRose, climatologySectorSchema, climatologyYearSchema, compareTracePoints, compareWindow, compassDirection, connectivitySessionSchema, createClimatologyAccumulator, currentEndpoint, dailyPattern, declaredFavorableDirections, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionArcSchema, directionCell, emptyConditions, favorableShare, feedEndpoint, filterByMonth, filterByTimeOfDay, foldClimatologyPoints, foldCurrent, freshness, historyCoverage, historyEndpoint, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastNightLowC, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationClimatology, parseStationClimatologyJson, parseStationConnectivity, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationHistory, parseStationHistoryJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureDeltaHpa, pressureTendency, readingSchema, recentSummarySchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationClimatologySchema, stationConnectivitySchema, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationHistorySchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
16
+ export { type AirConditions, type AirRow, CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, CONNECTIVITY_SERVICE_STATES, type ChartFrame, type ChartScaleOptions, type ChartScales, type ChartTick, type ClimatologyAccumulator, type ClimatologyCell, type ClimatologyCoverage, type ClimatologyFilters, type ClimatologyFoldParams, type ClimatologySector, type ClimatologyYear, type CompassPoint, type ConnectivityServiceState, type ConnectivitySession, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, 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, type DailyPatternSlot, type DirectionCellData, type DisplayDefaults, type DisplayProps, type FavorableDirection, type FormatTime, type FreshnessStatus, type FreshnessThresholds, type History, type HistoryCoverage, type HistoryPoint, type HistoryRun, type LiveSample, type LiveSamples, METEOROLOGICAL_SEASON_MONTHS, type MergeResult, type PeriodSummary, type PressureTendency, 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, type Reading, type RecentSummary, type ResolvedDisplay, type RoseSector, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_CLIMATOLOGY_SCHEMA_VERSION, STATION_SCHEMA_VERSION, type SamplesSummary, type SpeedThresholds, type SpeedUnit, type Station, type StationCapabilities, type StationClimatology, type StationConnectivity, type StationCurrent, type StationFeed, type StationHistory, type StationLiveFrame, type StationMeta, type StationStringOverrides, type StationStrings, type StationTelemetry, type SummaryEntry, type TickAnchor, UNAVAILABLE_REASONS, type UnavailableReason, type Vane, type WindRoseSummary, accumulatedCells, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, climatologyCellSchema, climatologyCoverage, climatologyEndpoint, climatologyFavorableShare, climatologyPattern, climatologyRose, climatologySectorSchema, climatologyYearSchema, compareTracePoints, compareWindow, compassDirection, connectivitySessionSchema, coveredSlotCountByYear, createClimatologyAccumulator, currentEndpoint, dailyPattern, declaredFavorableDirections, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionArcSchema, directionCell, emptyConditions, favorableShare, feedEndpoint, filterByMonth, filterByTimeOfDay, foldClimatologyPoints, foldCurrent, freshness, historyCoverage, historyEndpoint, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastNightLowC, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationClimatology, parseStationClimatologyJson, parseStationConnectivity, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationHistory, parseStationHistoryJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureDeltaHpa, pressureTendency, readingSchema, recentSummarySchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationClimatologySchema, stationConnectivitySchema, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationHistorySchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
package/dist/index.js CHANGED
@@ -6,11 +6,11 @@ import { requireResolved, resolveDisplay, resolveStation } from "./display.js";
6
6
  import { climatologyEndpoint, currentEndpoint, feedEndpoint, historyEndpoint, liveEndpoint } from "./endpoints.js";
7
7
  import { STATION_CLIMATOLOGY_SCHEMA_VERSION, climatologyCellSchema, climatologySectorSchema, climatologyYearSchema, parseStationClimatology, parseStationClimatologyJson, stationClimatologySchema } from "./contract-climatology.js";
8
8
  import { CHART_FALLBACK_WIDTH, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, favorableShare, filterByMonth, filterByTimeOfDay, historyCoverage, historyGaps, meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints } from "./geometry.js";
9
- import { accumulatedCells, climatologyCoverage, climatologyFavorableShare, climatologyPattern, climatologyRose, createClimatologyAccumulator, foldClimatologyPoints } from "./climatology.js";
9
+ import { accumulatedCells, climatologyCoverage, climatologyFavorableShare, climatologyPattern, climatologyRose, coveredSlotCountByYear, createClimatologyAccumulator, foldClimatologyPoints } from "./climatology.js";
10
10
  import { directionCell, optionalSpeed, roundSpeed, summaryEntries, temperatureText, temperatureValue, updatedAtText } from "./format.js";
11
11
  import { 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, dialScaleMaxMps, dialSpeedArcPath, historyRuns, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale } from "./instruments.js";
12
12
  import { foldCurrent, mergeCurrent } from "./merge-current.js";
13
13
  import { SAMPLE_GAP_TOLERANCE_FACTOR, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes } from "./samples.js";
14
14
  import { airRows, airSummary, lastStrikeWords } from "./air.js";
15
15
  import { normalizeWindnerdStationKey, windnerdStationUrl } from "./windnerd.js";
16
- export { CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, CONNECTIVITY_SERVICE_STATES, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, 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, METEOROLOGICAL_SEASON_MONTHS, 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, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_CLIMATOLOGY_SCHEMA_VERSION, STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, accumulatedCells, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, climatologyCellSchema, climatologyCoverage, climatologyEndpoint, climatologyFavorableShare, climatologyPattern, climatologyRose, climatologySectorSchema, climatologyYearSchema, compareTracePoints, compareWindow, compassDirection, connectivitySessionSchema, createClimatologyAccumulator, currentEndpoint, dailyPattern, declaredFavorableDirections, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionArcSchema, directionCell, emptyConditions, favorableShare, feedEndpoint, filterByMonth, filterByTimeOfDay, foldClimatologyPoints, foldCurrent, freshness, historyCoverage, historyEndpoint, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastNightLowC, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationClimatology, parseStationClimatologyJson, parseStationConnectivity, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationHistory, parseStationHistoryJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureDeltaHpa, pressureTendency, readingSchema, recentSummarySchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationClimatologySchema, stationConnectivitySchema, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationHistorySchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
16
+ export { CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, COMPASS_POINTS, CONNECTIVITY_SERVICE_STATES, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, 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, METEOROLOGICAL_SEASON_MONTHS, 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, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_CLIMATOLOGY_SCHEMA_VERSION, STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, accumulatedCells, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, climatologyCellSchema, climatologyCoverage, climatologyEndpoint, climatologyFavorableShare, climatologyPattern, climatologyRose, climatologySectorSchema, climatologyYearSchema, compareTracePoints, compareWindow, compassDirection, connectivitySessionSchema, coveredSlotCountByYear, createClimatologyAccumulator, currentEndpoint, dailyPattern, declaredFavorableDirections, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionArcSchema, directionCell, emptyConditions, favorableShare, feedEndpoint, filterByMonth, filterByTimeOfDay, foldClimatologyPoints, foldCurrent, freshness, historyCoverage, historyEndpoint, historyGaps, meanDirectionDeg as historyMeanDirectionDeg, historyPointSchema, historyRuns, historySchema, isCalm, lastNightLowC, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationClimatology, parseStationClimatologyJson, parseStationConnectivity, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationHistory, parseStationHistoryJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureDeltaHpa, pressureTendency, readingSchema, recentSummarySchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, roseBandPath, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationClimatologySchema, stationConnectivitySchema, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationHistorySchema, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
@@ -183,7 +183,7 @@ function DailyPatternSceneView({ scene }) {
183
183
  className: vane.mark.className,
184
184
  d: vane.mark.d
185
185
  }, vane.key)),
186
- scene.vanes.map((vane) => /* @__PURE__ */ jsx("text", {
186
+ scene.vanes.map((vane) => vane.label && /* @__PURE__ */ jsx("text", {
187
187
  className: vane.label.className,
188
188
  textAnchor: vane.label.anchor,
189
189
  x: vane.label.x,
@@ -197,7 +197,7 @@ function DailyPatternSceneView({ scene }) {
197
197
  y: scene.rowLabels.avg.y,
198
198
  children: scene.rowLabels.avg.text
199
199
  }),
200
- scene.vanes.map((vane) => /* @__PURE__ */ jsx("text", {
200
+ scene.vanes.map((vane) => vane.value && /* @__PURE__ */ jsx("text", {
201
201
  className: vane.value.className,
202
202
  textAnchor: vane.value.anchor,
203
203
  x: vane.value.x,
@@ -1,6 +1,6 @@
1
1
  import { Station } from "../../contract.js";
2
2
  import { SpeedThresholds, SpeedUnit } from "../../derive.js";
3
- import { FormatTime, StationStringOverrides } from "../../strings.js";
3
+ import { StationStringOverrides } from "../../strings.js";
4
4
  import { FavorableDirection } from "../../instruments.js";
5
5
  import "../../index.js";
6
6
  //#region src/react/components/Dial.d.ts
@@ -13,7 +13,6 @@ declare function Dial({ station: stationProp, stationId, thresholds: thresholdsP
13
13
  size?: number;
14
14
  calmWord?: boolean;
15
15
  strings?: StationStringOverrides;
16
- formatTime?: FormatTime;
17
16
  }): import("react").JSX.Element;
18
17
  //#endregion
19
18
  export { Dial };
@@ -5,8 +5,7 @@ import { FavorableDirection } from "../../instruments.js";
5
5
  import "../../index.js";
6
6
  //#region src/react/components/RecentSummaries.d.ts
7
7
  /** The source's own step digests as summary panels: per window, the
8
- * average, gust, and lull beside one small arrow per step — the direction's
9
- * recent story at a glance. */
8
+ * average, gust, and lull beside one small arrow per step. */
10
9
  declare function RecentSummaries({ summaries, station: stationProp, stationId, favorableDirections: favorableDirectionsProp, unit: unitProp, strings: stringsProp }: {
11
10
  summaries?: RecentSummary[] | null;
12
11
  station?: Station;
@@ -6,8 +6,7 @@ import { WindArrow } from "./WindArrow.js";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/react/components/RecentSummaries.tsx
8
8
  /** The source's own step digests as summary panels: per window, the
9
- * average, gust, and lull beside one small arrow per step — the direction's
10
- * recent story at a glance. */
9
+ * average, gust, and lull beside one small arrow per step. */
11
10
  function RecentSummaries({ summaries, station: stationProp, stationId, favorableDirections: favorableDirectionsProp, unit: unitProp, strings: stringsProp }) {
12
11
  const context = useStationFeedContext();
13
12
  const station = stationProp ?? (summaries == null ? resolveStation(context, stationId) ?? void 0 : void 0);
@@ -1,9 +1,10 @@
1
1
  "use client";
2
2
  import { resolveDisplay } from "../../display.js";
3
3
  import { measuredChartWidth } from "../../geometry.js";
4
- import { activeChartIndex, chartIndexAtClient, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
4
+ import { readoutAriaLive } from "../../scene/chart.js";
5
5
  import { TREND_CLASS, trendGate, trendScene } from "../../scene/trend.js";
6
6
  import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
7
+ import { usePinnedCursor } from "../lib/use-pinned-cursor.js";
7
8
  import { useEffect, useRef, useState } from "react";
8
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
10
  //#region src/react/components/TrendChart.tsx
@@ -50,8 +51,6 @@ function TrendChart({ station: stationProp, stationId, series, strings: stringsP
50
51
  });
51
52
  }
52
53
  function MeasuredTrend({ formatTime, history, series, stationName, width, words }) {
53
- const [pinnedAt, setPinnedAt] = useState(null);
54
- const [previewIndex, setPreviewIndex] = useState(null);
55
54
  const scene = trendScene({
56
55
  formatTime,
57
56
  history,
@@ -60,28 +59,11 @@ function MeasuredTrend({ formatTime, history, series, stationName, width, words
60
59
  width,
61
60
  words
62
61
  });
63
- const { readout, cursor } = scene.inspect(activeChartIndex(scene.points, pinnedAt, previewIndex));
64
- const indexAtPoint = (clientX, hit) => {
65
- const svg = hit.ownerSVGElement;
66
- if (!svg) return null;
67
- const bounds = svg.getBoundingClientRect();
68
- return chartIndexAtClient(scene.points, scene.frame, scene.scales, clientX, bounds);
69
- };
70
- const handlePointerMove = (event) => {
71
- if (event.pointerType === "touch") return;
72
- setPreviewIndex(indexAtPoint(event.clientX, event.currentTarget));
73
- };
74
- const handleClick = (event) => {
75
- const index = indexAtPoint(event.clientX, event.currentTarget);
76
- if (index == null) return;
77
- const observedAt = scene.points[index]?.observedAt;
78
- if (observedAt == null) return;
79
- setPinnedAt((current) => togglePinnedAt(current, observedAt));
80
- setPreviewIndex(null);
81
- };
62
+ const pinned = usePinnedCursor(scene);
63
+ const { readout, cursor } = scene.inspect(pinned.activeIndex);
82
64
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("output", {
83
65
  "aria-label": scene.readout.ariaLabel,
84
- "aria-live": readoutAriaLive(previewIndex),
66
+ "aria-live": readoutAriaLive(pinned.previewIndex),
85
67
  className: scene.readout.className,
86
68
  children: [/* @__PURE__ */ jsx("strong", { children: readout.strong }), /* @__PURE__ */ jsx("span", { children: readout.span })]
87
69
  }), /* @__PURE__ */ jsxs("svg", {
@@ -137,9 +119,9 @@ function MeasuredTrend({ formatTime, history, series, stationName, width, words
137
119
  className: scene.hit.className,
138
120
  fill: scene.hit.fill,
139
121
  height: scene.hit.height,
140
- onClick: handleClick,
141
- onPointerLeave: () => setPreviewIndex(null),
142
- onPointerMove: handlePointerMove,
122
+ onClick: pinned.handleClick,
123
+ onPointerLeave: pinned.handlePointerLeave,
124
+ onPointerMove: pinned.handlePointerMove,
143
125
  width: scene.hit.width,
144
126
  x: scene.hit.x,
145
127
  y: scene.hit.y