@azohra/meteo.station 0.1.2 → 0.2.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 (46) hide show
  1. package/README.md +1 -1
  2. package/dist/elements/elements/DailyPatternElement.js +1 -2
  3. package/dist/elements/elements/TrendChartElement.js +2 -1
  4. package/dist/elements/elements/WindHistoryChartElement.js +2 -1
  5. package/dist/geometry.d.ts +8 -1
  6. package/dist/geometry.js +8 -1
  7. package/dist/index.d.ts +3 -2
  8. package/dist/index.js +3 -2
  9. package/dist/react/components/DailyPattern.js +1 -2
  10. package/dist/react/components/Readout.d.ts +12 -0
  11. package/dist/react/components/Readout.js +14 -0
  12. package/dist/react/components/TrendChart.js +2 -1
  13. package/dist/react/components/WindHistoryChart.js +10 -24
  14. package/dist/react/components/WindSampleStrip.d.ts +15 -0
  15. package/dist/react/components/WindSampleStrip.js +192 -0
  16. package/dist/react/hooks/useMeasuredChartWidth.d.ts +8 -0
  17. package/dist/react/hooks/useMeasuredChartWidth.js +23 -0
  18. package/dist/react/index.d.ts +6 -1
  19. package/dist/react/index.js +4 -1
  20. package/dist/samples.d.ts +20 -0
  21. package/dist/samples.js +88 -0
  22. package/dist/scene/air-matrix.d.ts +2 -0
  23. package/dist/scene/atoms.d.ts +4 -0
  24. package/dist/scene/card.d.ts +3 -0
  25. package/dist/scene/chart.d.ts +11 -0
  26. package/dist/scene/chart.js +1 -7
  27. package/dist/scene/current.d.ts +3 -0
  28. package/dist/scene/daily-pattern.d.ts +6 -0
  29. package/dist/scene/dial.d.ts +4 -0
  30. package/dist/scene/glyphs.d.ts +2 -0
  31. package/dist/scene/index.d.ts +18 -0
  32. package/dist/scene/rose.d.ts +4 -0
  33. package/dist/scene/sample-strip.d.ts +6 -0
  34. package/dist/scene/sample-strip.js +130 -0
  35. package/dist/scene/sparkline.d.ts +3 -0
  36. package/dist/scene/strip.d.ts +3 -0
  37. package/dist/scene/table.d.ts +3 -0
  38. package/dist/scene/trend.d.ts +4 -0
  39. package/dist/scene/trend.js +1 -2
  40. package/dist/scene/wind-history.d.ts +6 -0
  41. package/dist/scene/wind-plot.d.ts +5 -0
  42. package/dist/scene/wind-plot.js +1 -2
  43. package/dist/strings.d.ts +2 -0
  44. package/dist/strings.js +2 -0
  45. package/package.json +1 -1
  46. package/styles.css +24 -0
package/README.md CHANGED
@@ -13,7 +13,7 @@ that render it — natively, in your design system, with no vendor iframe.
13
13
  | `@azohra/meteo.station` | The isomorphic root: the wire contract (zod), pure derivations (period stats, compass, freshness, unit and threshold conversion), framework-free chart and instrument geometry, and the shared display rules (strings, formatting, air sentences, display resolution, merge policy) every binding renders from. |
14
14
  | `@azohra/meteo.station/client` | The framework-free client data layer: `createJsonPoller` and the station stores (`createStationFeedStore`, `createStationCurrentStore`, `createStationStore`) every binding subscribes to. Client-only at runtime, import-safe anywhere. |
15
15
  | `@azohra/meteo.station/server` | Vendor adapters plus the custom-adapter interface and `defineStationAdapter`, data-level `loadStationFeed()` / `loadStationCurrent()`, and the mountable feed handler. Server-only, so it can never leak into a client bundle. |
16
- | `@azohra/meteo.station/react` | `StationFeedProvider`, polling hooks (`useStation`, `useStationFeed`, `useStationCurrent`), the component set — `StationCard`, `CurrentConditions`, `WindHistoryChart`, `TrendChart`, `WindRose`, `DailyPattern`, `StationTable`, `StationStrip`, `AirMatrix`, `FreshnessBadge` — and an atoms layer of inline primitives (`Speed`, `Gust`, `Lull`, `Temperature`, `Pressure`, `Direction`, `UpdatedAt`, `BandChip`, `Dial`, `Sparkline`) for composing your own layouts. |
16
+ | `@azohra/meteo.station/react` | `StationFeedProvider`, polling hooks (`useStation`, `useStationFeed`, `useStationCurrent`), the component set — `StationCard`, `CurrentConditions`, `WindHistoryChart`, `WindSampleStrip`, `TrendChart`, `WindRose`, `DailyPattern`, `StationTable`, `StationStrip`, `AirMatrix`, `FreshnessBadge` — and an atoms layer of inline primitives (`Speed`, `Gust`, `Lull`, `Temperature`, `Pressure`, `Direction`, `UpdatedAt`, `BandChip`, `Dial`, `Sparkline`, `Readout`) for composing your own layouts. |
17
17
  | `@azohra/meteo.station/elements` | The same surface as light-DOM custom elements (`<meteo-station-feed>`, `<meteo-station-card>`, `<meteo-station-table>`, the charts, the atoms…) — a full peer of the react binding, framework-free, held byte-identical by a parity suite. `/register` is the auto-defining one-liner. |
18
18
  | `@azohra/meteo.station/styles.css` | The default skin (an intentional side effect), shared by both bindings. |
19
19
 
@@ -1,6 +1,5 @@
1
1
  import { resolveStation } from "../../display.js";
2
- import "../../geometry.js";
3
- import { measuredChartWidth } from "../../scene/chart.js";
2
+ import { measuredChartWidth } from "../../geometry.js";
4
3
  import { DAILY_PATTERN_CLASS, dailyPatternGate, dailyPatternScene, dailyPatternSource } from "../../scene/daily-pattern.js";
5
4
  import { numberAttribute } from "../lib/attributes.js";
6
5
  import { MeteoStationElement } from "../lib/base.js";
@@ -1,5 +1,6 @@
1
1
  import { requireResolved } from "../../display.js";
2
- import { activeChartIndex, chartIndexAtClient, measuredChartWidth, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
2
+ import { measuredChartWidth } from "../../geometry.js";
3
+ import { activeChartIndex, chartIndexAtClient, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
3
4
  import { TREND_CLASS, trendGate, trendScene } from "../../scene/trend.js";
4
5
  import { ELEMENTS_AMBIENT_HINT } from "../lib/ambient.js";
5
6
  import { MeteoStationElement } from "../lib/base.js";
@@ -1,4 +1,5 @@
1
- import { activeChartIndex, chartIndexAtClient, measuredChartWidth, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
1
+ import { measuredChartWidth } from "../../geometry.js";
2
+ import { activeChartIndex, chartIndexAtClient, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
2
3
  import { WIND_CHART_CLASS, windChartGate, windChartScene } from "../../scene/wind-history.js";
3
4
  import { numberAttribute } from "../lib/attributes.js";
4
5
  import { MeteoStationElement } from "../lib/base.js";
@@ -12,6 +12,10 @@ type ChartFrame = {
12
12
  valueRow: number;
13
13
  width: number;
14
14
  };
15
+ declare const CHART_FALLBACK_WIDTH = 360;
16
+ declare function measuredChartWidth(measured: number): number;
17
+ type TickAnchor = "end" | "middle" | "start";
18
+ declare function tickAnchor(index: number, lastIndex: number): TickAnchor;
15
19
  declare function chartFrame(width: number): ChartFrame;
16
20
  type ChartScales = {
17
21
  startMs: number;
@@ -47,6 +51,9 @@ type ChartTick = {
47
51
  x: number;
48
52
  };
49
53
  declare function vaneTicks(vanes: ReadonlyArray<Vane>, scales: ChartScales): ChartTick[];
54
+ declare function nearestIndex(points: ReadonlyArray<{
55
+ observedAt: string;
56
+ }>, chartX: number, frame: ChartFrame, scales: ChartScales): number | null;
50
57
  declare function speedBand(speedMps: number, thresholdsMps: ReadonlyArray<number>): number;
51
58
  type RoseSector = {
52
59
  bearingDeg: number;
@@ -81,4 +88,4 @@ declare function windowPoints(points: ReadonlyArray<HistoryPoint>, hours?: numbe
81
88
  declare function compareWindow(points: ReadonlyArray<HistoryPoint>, offsetDays: number, windowHours?: number): HistoryPoint[] | null;
82
89
  declare function compareTracePoints(comparePoints: ReadonlyArray<HistoryPoint>, scales: ChartScales, offsetDays: number): string;
83
90
  //#endregion
84
- export { ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, METEOROLOGICAL_SEASON_MONTHS, RoseSector, TrendSeries, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, speedBand, thinVanes, vanePath, vaneTicks, windRose, windowPoints };
91
+ export { CHART_FALLBACK_WIDTH, ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, METEOROLOGICAL_SEASON_MONTHS, RoseSector, TickAnchor, TrendSeries, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints };
package/dist/geometry.js CHANGED
@@ -1,7 +1,14 @@
1
1
  import { KMH_PER_MPS, isCalm, normalizeDegrees, radians } from "./derive.js";
2
2
  import { componentsToWind, meanDirectionDeg, windToComponents } from "@azohra/meteo.core";
3
3
  //#region src/geometry.ts
4
+ const CHART_FALLBACK_WIDTH = 360;
4
5
  const CHART_AXIS_GUTTER = 46;
6
+ function measuredChartWidth(measured) {
7
+ return measured > 0 ? Math.round(measured) : 360;
8
+ }
9
+ function tickAnchor(index, lastIndex) {
10
+ return index === 0 ? "start" : index === lastIndex ? "end" : "middle";
11
+ }
5
12
  function chartFrame(width) {
6
13
  const plotHeight = width < 520 ? 76 : 116;
7
14
  const plotTop = 10;
@@ -330,4 +337,4 @@ function compareTracePoints(comparePoints, scales, offsetDays) {
330
337
  return comparePoints.map((point) => coordinate(scales.xAtMs(Date.parse(point.observedAt) + shiftMs), scales.yAt(point.windAvgMps))).join(" ");
331
338
  }
332
339
  //#endregion
333
- export { DAILY_PATTERN_DEFAULT_SLOT_MINUTES, HISTORY_GAP_TOLERANCE_FACTOR, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, isCalmHistory, meanDirectionDeg$1 as meanDirectionDeg, nearestIndex, speedBand, stretchFrame, thinVanes, trendRuns, trendSeriesPad, trendValueOf, valueScale, vanePath, vaneTicks, vectorMeanWind, windRose, windowPoints };
340
+ export { CHART_FALLBACK_WIDTH, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, HISTORY_GAP_TOLERANCE_FACTOR, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, isCalmHistory, meanDirectionDeg$1 as meanDirectionDeg, measuredChartWidth, nearestIndex, speedBand, stretchFrame, thinVanes, tickAnchor, trendRuns, trendSeriesPad, trendValueOf, valueScale, vanePath, vaneTicks, vectorMeanWind, windRose, windowPoints };
package/dist/index.d.ts CHANGED
@@ -4,9 +4,10 @@ import { FormatTime, StationStringOverrides, StationStrings, defaultFormatTime,
4
4
  import { DirectionCellData, SummaryEntry, directionCell, optionalSpeed, roundSpeed, summaryEntries, temperatureText, temperatureValue, updatedAtText } from "./format.js";
5
5
  import { DisplayDefaults, DisplayProps, ResolvedDisplay, requireResolved, resolveDisplay, resolveStation } from "./display.js";
6
6
  import { currentEndpoint, feedEndpoint, liveEndpoint } from "./endpoints.js";
7
- import { ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, METEOROLOGICAL_SEASON_MONTHS, RoseSector, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, speedBand, thinVanes, vanePath, vaneTicks, windRose, windowPoints } from "./geometry.js";
7
+ import { CHART_FALLBACK_WIDTH, ChartFrame, ChartScaleOptions, ChartScales, ChartTick, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, DailyPatternSlot, METEOROLOGICAL_SEASON_MONTHS, RoseSector, TickAnchor, Vane, WindRoseSummary, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints } from "./geometry.js";
8
8
  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, FavorableDirection, HistoryRun, ROSE_CARDINAL_LETTERS, ROSE_CENTRE, ROSE_FAVORABLE_RING_RADIUS, ROSE_HUB_DOT_RADIUS, ROSE_HUB_RADIUS, ROSE_INTERCARDINAL_BEARINGS, ROSE_LETTER_RADIUS, ROSE_MAX_RADIUS, ROSE_PETAL_FILL, ROSE_SIZE, ROSE_TICK_REACH, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, bandStrips, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, historyRuns, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale } from "./instruments.js";
9
9
  import { MergeResult, foldCurrent, mergeCurrent } from "./merge-current.js";
10
+ import { SAMPLE_GAP_TOLERANCE_FACTOR, SamplesSummary, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes } from "./samples.js";
10
11
  import { AirRow, airRows, airSummary, lastStrikeWords } from "./air.js";
11
12
  import { normalizeWindnerdStationKey, windnerdStationUrl } from "./windnerd.js";
12
- export { type AirConditions, type AirRow, CALM_THRESHOLD_MPS, type ChartFrame, type ChartScaleOptions, type ChartScales, type ChartTick, type CompassPoint, 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 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 ResolvedDisplay, type RoseSector, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_SCHEMA_VERSION, type SpeedThresholds, type SpeedUnit, type Station, type StationCapabilities, type StationCurrent, type StationFeed, type StationLiveFrame, type StationMeta, type StationStringOverrides, type StationStrings, type StationTelemetry, type SummaryEntry, UNAVAILABLE_REASONS, type UnavailableReason, type Vane, type WindRoseSummary, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, compareTracePoints, compareWindow, compassDirection, currentEndpoint, dailyPattern, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionCell, emptyConditions, feedEndpoint, filterByMonth, filterByTimeOfDay, foldCurrent, freshness, historyGaps, historyPointSchema, historyRuns, historySchema, isCalm, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, mergeCurrent, mergeStringOverrides, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureTendency, readingSchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinVanes, thresholdsToMps, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
13
+ export { type AirConditions, type AirRow, CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, type ChartFrame, type ChartScaleOptions, type ChartScales, type ChartTick, type CompassPoint, 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 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 ResolvedDisplay, type RoseSector, SAMPLE_GAP_TOLERANCE_FACTOR, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_SCHEMA_VERSION, type SamplesSummary, type SpeedThresholds, type SpeedUnit, type Station, type StationCapabilities, type StationCurrent, type StationFeed, type StationLiveFrame, type StationMeta, type StationStringOverrides, type StationStrings, type StationTelemetry, type SummaryEntry, type TickAnchor, UNAVAILABLE_REASONS, type UnavailableReason, type Vane, type WindRoseSummary, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, compareTracePoints, compareWindow, compassDirection, currentEndpoint, dailyPattern, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionCell, emptyConditions, feedEndpoint, filterByMonth, filterByTimeOfDay, foldCurrent, freshness, historyGaps, historyPointSchema, historyRuns, historySchema, isCalm, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureTendency, readingSchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
package/dist/index.js CHANGED
@@ -4,9 +4,10 @@ import { defaultFormatTime, defaultStrings, localeFormatTime, mergeStringOverrid
4
4
  import { requireResolved, resolveDisplay, resolveStation } from "./display.js";
5
5
  import { currentEndpoint, feedEndpoint, liveEndpoint } from "./endpoints.js";
6
6
  import { directionCell, optionalSpeed, roundSpeed, summaryEntries, temperatureText, temperatureValue, updatedAtText } from "./format.js";
7
- import { DAILY_PATTERN_DEFAULT_SLOT_MINUTES, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, speedBand, thinVanes, vanePath, vaneTicks, windRose, windowPoints } from "./geometry.js";
7
+ import { CHART_FALLBACK_WIDTH, DAILY_PATTERN_DEFAULT_SLOT_MINUTES, METEOROLOGICAL_SEASON_MONTHS, averagePoints, bandPoints, chartFrame, chartScales, compareTracePoints, compareWindow, dailyPattern, filterByMonth, filterByTimeOfDay, historyGaps, measuredChartWidth, nearestIndex, speedBand, thinVanes, tickAnchor, vanePath, vaneTicks, windRose, windowPoints } from "./geometry.js";
8
8
  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, rosePetalPath, rosePolar, roseRingArcPath, sparklineScale } from "./instruments.js";
9
9
  import { foldCurrent, mergeCurrent } from "./merge-current.js";
10
+ import { SAMPLE_GAP_TOLERANCE_FACTOR, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes } from "./samples.js";
10
11
  import { airRows, airSummary, lastStrikeWords } from "./air.js";
11
12
  import { normalizeWindnerdStationKey, windnerdStationUrl } from "./windnerd.js";
12
- export { CALM_THRESHOLD_MPS, 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, SPARKLINE_EDGE_INSET, SPARKLINE_MAX_PADDING, STATION_SCHEMA_VERSION, UNAVAILABLE_REASONS, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, compareTracePoints, compareWindow, compassDirection, currentEndpoint, dailyPattern, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionCell, emptyConditions, feedEndpoint, filterByMonth, filterByTimeOfDay, foldCurrent, freshness, historyGaps, historyPointSchema, historyRuns, historySchema, isCalm, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, mergeCurrent, mergeStringOverrides, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureTendency, readingSchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinVanes, thresholdsToMps, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
13
+ export { CALM_THRESHOLD_MPS, CHART_FALLBACK_WIDTH, 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_SCHEMA_VERSION, UNAVAILABLE_REASONS, airConditionsSchema, airRows, airSummary, averagePoints, bandPoints, bandStrips, capabilitiesSchema, chartFrame, chartScales, compareTracePoints, compareWindow, compassDirection, currentEndpoint, dailyPattern, defaultFormatTime, defaultStrings, dialNeedlePoints, dialPolar, dialScaleMaxMps, dialSpeedArcPath, directionCell, emptyConditions, feedEndpoint, filterByMonth, filterByTimeOfDay, foldCurrent, freshness, historyGaps, historyPointSchema, historyRuns, historySchema, isCalm, lastStrikeWords, liveEndpoint, liveSampleSchema, liveSamplesSchema, localeFormatTime, measuredChartWidth, mergeCurrent, mergeStringOverrides, nearestIndex, normalizeDegrees, normalizeWindnerdStationKey, optionalSpeed, parseStationCurrent, parseStationCurrentJson, parseStationFeed, parseStationFeedJson, parseStationLiveFrame, parseStationLiveFrameJson, periodSummary, pressureTendency, readingSchema, requireResolved, resolveDisplay, resolveStation, resolveStrings, rosePetalPath, rosePolar, roseRingArcPath, roundSpeed, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, seaLevelPressureHpa, sparklineScale, speedBand, speedFromMps, speedToMps, speedUnitLabel, stationCurrentSchema, stationFeedSchema, stationFreshnessThresholds, stationLiveFrameSchema, stationMetaSchema, stationSchema, summaryEntries, telemetrySchema, temperatureText, temperatureValue, thinSampleVanes, thinVanes, thresholdsToMps, tickAnchor, unavailableStation, updatedAtText, vanePath, vaneTicks, windRose, windnerdStationUrl, windowPoints };
@@ -1,8 +1,7 @@
1
1
  "use client";
2
2
  import "../../derive.js";
3
3
  import { resolveDisplay } from "../../display.js";
4
- import "../../geometry.js";
5
- import { measuredChartWidth } from "../../scene/chart.js";
4
+ import { measuredChartWidth } from "../../geometry.js";
6
5
  import { DAILY_PATTERN_CLASS, dailyPatternGate, dailyPatternScene, dailyPatternSource } from "../../scene/daily-pattern.js";
7
6
  import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
8
7
  import "./WindArrow.js";
@@ -0,0 +1,12 @@
1
+ import { ReadoutPart } from "../../scene/chart.js";
2
+ import "../../scene/index.js";
3
+ //#region src/react/components/Readout.d.ts
4
+ declare function Readout({ ariaLabel, ariaLive, className, strong, parts }: {
5
+ ariaLabel: string;
6
+ ariaLive: "off" | "polite";
7
+ className: string;
8
+ strong: string;
9
+ parts: ReadoutPart[];
10
+ }): import("react").JSX.Element;
11
+ //#endregion
12
+ export { Readout };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { WindArrow } from "./WindArrow.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/react/components/Readout.tsx
5
+ function Readout({ ariaLabel, ariaLive, className, strong, parts }) {
6
+ return /* @__PURE__ */ jsxs("output", {
7
+ "aria-label": ariaLabel,
8
+ "aria-live": ariaLive,
9
+ className,
10
+ children: [/* @__PURE__ */ jsx("strong", { children: strong }), /* @__PURE__ */ jsx("span", { children: parts.map((part, index) => part.kind === "arrow" ? /* @__PURE__ */ jsx(WindArrow, { deg: part.deg }, index) : part.text) })]
11
+ });
12
+ }
13
+ //#endregion
14
+ export { Readout };
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { resolveDisplay } from "../../display.js";
3
- import { activeChartIndex, chartIndexAtClient, measuredChartWidth, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
3
+ import { measuredChartWidth } from "../../geometry.js";
4
+ import { activeChartIndex, chartIndexAtClient, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
4
5
  import { TREND_CLASS, trendGate, trendScene } from "../../scene/trend.js";
5
6
  import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
6
7
  import { useEffect, useRef, useState } from "react";
@@ -1,10 +1,11 @@
1
1
  "use client";
2
2
  import { resolveDisplay } from "../../display.js";
3
- import { activeChartIndex, chartIndexAtClient, measuredChartWidth, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
3
+ import { activeChartIndex, chartIndexAtClient, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
4
4
  import { WIND_CHART_CLASS, windChartGate, windChartScene } from "../../scene/wind-history.js";
5
5
  import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
6
- import { WindArrow } from "./WindArrow.js";
7
- import { useEffect, useId, useRef, useState } from "react";
6
+ import { Readout } from "./Readout.js";
7
+ import { useMeasuredChartWidth } from "../hooks/useMeasuredChartWidth.js";
8
+ import { useId, useRef, useState } from "react";
8
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
10
  //#region src/react/components/WindHistoryChart.tsx
10
11
  function WindHistoryChart({ station: stationProp, stationId, thresholds: thresholdsProp, unit: unitProp, plotHeight, windowHours, compareOffsetDays, strings: stringsProp, formatTime: formatTimeProp }) {
@@ -17,21 +18,8 @@ function WindHistoryChart({ station: stationProp, stationId, thresholds: thresho
17
18
  unit: unitProp
18
19
  });
19
20
  const wrapRef = useRef(null);
20
- const [width, setWidth] = useState(null);
21
21
  const gate = windChartGate(station, words);
22
- useEffect(() => {
23
- const element = wrapRef.current;
24
- if (!element) return;
25
- if (typeof ResizeObserver === "undefined") {
26
- setWidth(360);
27
- return;
28
- }
29
- const observer = new ResizeObserver((entries) => {
30
- setWidth(measuredChartWidth(entries[0]?.contentRect.width ?? 0));
31
- });
32
- observer.observe(element);
33
- return () => observer.disconnect();
34
- }, [gate.kind === "draw"]);
22
+ const width = useMeasuredChartWidth(wrapRef, { enabled: gate.kind === "draw" });
35
23
  if (gate.kind === "hidden") return null;
36
24
  if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
37
25
  className: gate.className,
@@ -55,9 +43,6 @@ function WindHistoryChart({ station: stationProp, stationId, thresholds: thresho
55
43
  })
56
44
  });
57
45
  }
58
- function ReadoutSpan({ parts }) {
59
- return /* @__PURE__ */ jsx("span", { children: parts.map((part, index) => part.kind === "arrow" ? /* @__PURE__ */ jsx(WindArrow, { deg: part.deg }, index) : part.text) });
60
- }
61
46
  function MeasuredChart({ compareOffsetDays, formatTime, history, plotHeight, stationName, thresholds, unit, width, windowHours, words }) {
62
47
  const hatchId = `meteo-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
63
48
  const [pinnedAt, setPinnedAt] = useState(null);
@@ -94,11 +79,12 @@ function MeasuredChart({ compareOffsetDays, formatTime, history, plotHeight, sta
94
79
  setPinnedAt((current) => togglePinnedAt(current, observedAt));
95
80
  setPreviewIndex(null);
96
81
  };
97
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("output", {
98
- "aria-label": scene.readout.ariaLabel,
99
- "aria-live": readoutAriaLive(previewIndex),
82
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Readout, {
83
+ ariaLabel: scene.readout.ariaLabel,
84
+ ariaLive: readoutAriaLive(previewIndex),
100
85
  className: scene.readout.className,
101
- children: [/* @__PURE__ */ jsx("strong", { children: readout.strong }), /* @__PURE__ */ jsx(ReadoutSpan, { parts: readout.span })]
86
+ parts: readout.span,
87
+ strong: readout.strong
102
88
  }), /* @__PURE__ */ jsxs("svg", {
103
89
  "aria-label": scene.svg.ariaLabel,
104
90
  className: scene.svg.className,
@@ -0,0 +1,15 @@
1
+ import { LiveSamples } from "../../contract.js";
2
+ import { SpeedUnit } from "../../derive.js";
3
+ import { FormatTime, StationStringOverrides } from "../../strings.js";
4
+ import "../../index.js";
5
+ //#region src/react/components/WindSampleStrip.d.ts
6
+ declare function WindSampleStrip({ samples, stationName, unit: unitProp, plotHeight, strings: stringsProp, formatTime: formatTimeProp }: {
7
+ samples: LiveSamples | null | undefined;
8
+ stationName: string;
9
+ unit?: SpeedUnit;
10
+ plotHeight?: number;
11
+ strings?: StationStringOverrides;
12
+ formatTime?: FormatTime;
13
+ }): import("react").JSX.Element;
14
+ //#endregion
15
+ export { WindSampleStrip };
@@ -0,0 +1,192 @@
1
+ "use client";
2
+ import { resolveDisplay } from "../../display.js";
3
+ import { activeChartIndex, chartIndexAtClient, readoutAriaLive, togglePinnedAt } from "../../scene/chart.js";
4
+ import { SAMPLE_STRIP_CLASS, sampleStripGate, sampleStripScene } from "../../scene/sample-strip.js";
5
+ import { useStationFeedContext } from "./StationFeedProvider.js";
6
+ import { Readout } from "./Readout.js";
7
+ import { useMeasuredChartWidth } from "../hooks/useMeasuredChartWidth.js";
8
+ import { useRef, useState } from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ //#region src/react/components/WindSampleStrip.tsx
11
+ function WindSampleStrip({ samples, stationName, unit: unitProp, plotHeight, strings: stringsProp, formatTime: formatTimeProp }) {
12
+ const { formatTime, unit, words } = resolveDisplay(useStationFeedContext(), {
13
+ formatTime: formatTimeProp,
14
+ strings: stringsProp,
15
+ unit: unitProp
16
+ });
17
+ const wrapRef = useRef(null);
18
+ const gate = sampleStripGate(samples, words);
19
+ const width = useMeasuredChartWidth(wrapRef, { enabled: gate.kind === "draw" });
20
+ if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
21
+ className: gate.className,
22
+ role: "note",
23
+ children: gate.text
24
+ });
25
+ return /* @__PURE__ */ jsx("div", {
26
+ className: SAMPLE_STRIP_CLASS,
27
+ ref: wrapRef,
28
+ children: width != null && /* @__PURE__ */ jsx(MeasuredStrip, {
29
+ formatTime,
30
+ plotHeight,
31
+ samples: gate.samples,
32
+ stationName,
33
+ unit,
34
+ width,
35
+ words
36
+ })
37
+ });
38
+ }
39
+ function MeasuredStrip({ formatTime, plotHeight, samples, stationName, unit, width, words }) {
40
+ const [pinnedAt, setPinnedAt] = useState(null);
41
+ const [previewIndex, setPreviewIndex] = useState(null);
42
+ const scene = sampleStripScene({
43
+ formatTime,
44
+ plotHeight,
45
+ samples,
46
+ stationName,
47
+ unit,
48
+ width,
49
+ words
50
+ });
51
+ const { readout, cursor } = scene.inspect(activeChartIndex(scene.points, pinnedAt, previewIndex));
52
+ const indexAtPoint = (clientX, hit) => {
53
+ const svg = hit.ownerSVGElement;
54
+ if (!svg) return null;
55
+ const bounds = svg.getBoundingClientRect();
56
+ return chartIndexAtClient(scene.points, scene.frame, scene.scales, clientX, bounds);
57
+ };
58
+ const handlePointerMove = (event) => {
59
+ if (event.pointerType === "touch") return;
60
+ setPreviewIndex(indexAtPoint(event.clientX, event.currentTarget));
61
+ };
62
+ const handleClick = (event) => {
63
+ const index = indexAtPoint(event.clientX, event.currentTarget);
64
+ if (index == null) return;
65
+ const observedAt = scene.points[index]?.observedAt;
66
+ if (observedAt == null) return;
67
+ setPinnedAt((current) => togglePinnedAt(current, observedAt));
68
+ setPreviewIndex(null);
69
+ };
70
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Readout, {
71
+ ariaLabel: scene.readout.ariaLabel,
72
+ ariaLive: readoutAriaLive(previewIndex),
73
+ className: scene.readout.className,
74
+ parts: readout.span,
75
+ strong: readout.strong
76
+ }), /* @__PURE__ */ jsxs("svg", {
77
+ "aria-label": scene.svg.ariaLabel,
78
+ className: scene.svg.className,
79
+ height: scene.svg.height,
80
+ role: "img",
81
+ viewBox: scene.svg.viewBox,
82
+ width: scene.svg.width,
83
+ children: [
84
+ scene.grid.map(({ key, line, label }) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
85
+ className: line.className,
86
+ x1: line.x1,
87
+ x2: line.x2,
88
+ y1: line.y1,
89
+ y2: line.y2
90
+ }), /* @__PURE__ */ jsx("text", {
91
+ className: label.className,
92
+ textAnchor: label.anchor,
93
+ x: label.x,
94
+ y: label.y,
95
+ children: label.text
96
+ })] }, key)),
97
+ scene.vaneGuides.map((guide) => /* @__PURE__ */ jsx("line", {
98
+ className: guide.className,
99
+ x1: guide.x1,
100
+ x2: guide.x2,
101
+ y1: guide.y1,
102
+ y2: guide.y2
103
+ }, `guide-${guide.key}`)),
104
+ scene.trace.map((part) => part.kind === "dot" ? /* @__PURE__ */ jsx("circle", {
105
+ className: part.className,
106
+ cx: part.cx,
107
+ cy: part.cy,
108
+ r: part.r
109
+ }, part.key) : /* @__PURE__ */ jsx("polyline", {
110
+ className: part.className,
111
+ points: part.points
112
+ }, part.key)),
113
+ scene.calmNote && /* @__PURE__ */ jsx("text", {
114
+ className: scene.calmNote.className,
115
+ textAnchor: scene.calmNote.anchor,
116
+ x: scene.calmNote.x,
117
+ y: scene.calmNote.y,
118
+ children: scene.calmNote.text
119
+ }),
120
+ /* @__PURE__ */ jsx("text", {
121
+ className: scene.rowLabels.to.className,
122
+ textAnchor: scene.rowLabels.to.anchor,
123
+ x: scene.rowLabels.to.x,
124
+ y: scene.rowLabels.to.y,
125
+ children: scene.rowLabels.to.text
126
+ }),
127
+ scene.vanes.map((vane) => vane.mark.kind === "calm" ? /* @__PURE__ */ jsx("text", {
128
+ className: vane.mark.text.className,
129
+ textAnchor: vane.mark.text.anchor,
130
+ x: vane.mark.text.x,
131
+ y: vane.mark.text.y,
132
+ children: vane.mark.text.text
133
+ }, vane.key) : /* @__PURE__ */ jsx("path", {
134
+ className: vane.mark.className,
135
+ d: vane.mark.d
136
+ }, vane.key)),
137
+ scene.vanes.map((vane) => /* @__PURE__ */ jsx("text", {
138
+ className: vane.label.className,
139
+ textAnchor: vane.label.anchor,
140
+ x: vane.label.x,
141
+ y: vane.label.y,
142
+ children: vane.label.text
143
+ }, `label-${vane.key}`)),
144
+ /* @__PURE__ */ jsx("text", {
145
+ className: scene.rowLabels.avg.className,
146
+ textAnchor: scene.rowLabels.avg.anchor,
147
+ x: scene.rowLabels.avg.x,
148
+ y: scene.rowLabels.avg.y,
149
+ children: scene.rowLabels.avg.text
150
+ }),
151
+ scene.vanes.map((vane) => /* @__PURE__ */ jsx("text", {
152
+ className: vane.value.className,
153
+ textAnchor: vane.value.anchor,
154
+ x: vane.value.x,
155
+ y: vane.value.y,
156
+ children: vane.value.text
157
+ }, `value-${vane.key}`)),
158
+ scene.ticks.map((tick) => /* @__PURE__ */ jsx("text", {
159
+ className: tick.className,
160
+ textAnchor: tick.anchor,
161
+ x: tick.x,
162
+ y: tick.y,
163
+ children: tick.text
164
+ }, tick.key)),
165
+ cursor && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("line", {
166
+ className: cursor.line.className,
167
+ x1: cursor.line.x1,
168
+ x2: cursor.line.x2,
169
+ y1: cursor.line.y1,
170
+ y2: cursor.line.y2
171
+ }), /* @__PURE__ */ jsx("circle", {
172
+ className: cursor.dot.className,
173
+ cx: cursor.dot.cx,
174
+ cy: cursor.dot.cy,
175
+ r: cursor.dot.r
176
+ })] }),
177
+ /* @__PURE__ */ jsx("rect", {
178
+ className: scene.hit.className,
179
+ fill: scene.hit.fill,
180
+ height: scene.hit.height,
181
+ onClick: handleClick,
182
+ onPointerLeave: () => setPreviewIndex(null),
183
+ onPointerMove: handlePointerMove,
184
+ width: scene.hit.width,
185
+ x: scene.hit.x,
186
+ y: scene.hit.y
187
+ })
188
+ ]
189
+ })] });
190
+ }
191
+ //#endregion
192
+ export { WindSampleStrip };
@@ -0,0 +1,8 @@
1
+ //#region src/react/hooks/useMeasuredChartWidth.d.ts
2
+ declare function useMeasuredChartWidth(ref: {
3
+ readonly current: Element | null;
4
+ }, { enabled }?: {
5
+ enabled?: boolean;
6
+ }): number | null;
7
+ //#endregion
8
+ export { useMeasuredChartWidth };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { measuredChartWidth } from "../../geometry.js";
3
+ import { useEffect, useState } from "react";
4
+ //#region src/react/hooks/useMeasuredChartWidth.ts
5
+ function useMeasuredChartWidth(ref, { enabled = true } = {}) {
6
+ const [width, setWidth] = useState(null);
7
+ useEffect(() => {
8
+ const element = ref.current;
9
+ if (!enabled || element == null) return;
10
+ if (typeof ResizeObserver === "undefined") {
11
+ setWidth(360);
12
+ return;
13
+ }
14
+ const observer = new ResizeObserver((entries) => {
15
+ setWidth(measuredChartWidth(entries[0]?.contentRect.width ?? 0));
16
+ });
17
+ observer.observe(element);
18
+ return () => observer.disconnect();
19
+ }, [ref, enabled]);
20
+ return width;
21
+ }
22
+ //#endregion
23
+ export { useMeasuredChartWidth };
@@ -10,12 +10,17 @@ import { StationStrip } from "./components/StationStrip.js";
10
10
  import { TrendChart } from "./components/TrendChart.js";
11
11
  import { WindArrow } from "./components/WindArrow.js";
12
12
  import { DailyPattern } from "./components/DailyPattern.js";
13
+ import { ReadoutPart } from "../scene/chart.js";
14
+ import "../scene/index.js";
15
+ import { Readout } from "./components/Readout.js";
13
16
  import { WindHistoryChart } from "./components/WindHistoryChart.js";
14
17
  import { WindRose } from "./components/WindRose.js";
18
+ import { WindSampleStrip } from "./components/WindSampleStrip.js";
15
19
  import { StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary } from "./components/StationCard.js";
16
20
  import { useFreshness } from "./hooks/useFreshness.js";
21
+ import { useMeasuredChartWidth } from "./hooks/useMeasuredChartWidth.js";
17
22
  import { useStation } from "./hooks/useStation.js";
18
23
  import { useStationCurrent } from "./hooks/useStationCurrent.js";
19
24
  import { useStationFeed } from "./hooks/useStationFeed.js";
20
25
  import { useStationLive } from "./hooks/useStationLive.js";
21
- export { AirMatrix, BandChip, CurrentConditions, DailyPattern, Dial, Direction, FreshnessBadge, Gust, Lull, Pressure, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, type StationFeedContextValue, StationFeedProvider, type StationMetaRenderer, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, useFreshness, useStation, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
26
+ export { AirMatrix, BandChip, CurrentConditions, DailyPattern, Dial, Direction, FreshnessBadge, Gust, Lull, Pressure, Readout, type ReadoutPart, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, type StationFeedContextValue, StationFeedProvider, type StationMetaRenderer, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, WindSampleStrip, useFreshness, useMeasuredChartWidth, useStation, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
@@ -12,11 +12,14 @@ import { StationTable } from "./components/StationTable.js";
12
12
  import { StationStrip } from "./components/StationStrip.js";
13
13
  import { TrendChart } from "./components/TrendChart.js";
14
14
  import { DailyPattern } from "./components/DailyPattern.js";
15
+ import { Readout } from "./components/Readout.js";
16
+ import { useMeasuredChartWidth } from "./hooks/useMeasuredChartWidth.js";
15
17
  import { WindHistoryChart } from "./components/WindHistoryChart.js";
16
18
  import { WindRose } from "./components/WindRose.js";
19
+ import { WindSampleStrip } from "./components/WindSampleStrip.js";
17
20
  import { StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary } from "./components/StationCard.js";
18
21
  import { useStationCurrent } from "./hooks/useStationCurrent.js";
19
22
  import { useStationFeed } from "./hooks/useStationFeed.js";
20
23
  import { useStationLive } from "./hooks/useStationLive.js";
21
24
  import { useStation } from "./hooks/useStation.js";
22
- export { AirMatrix, BandChip, CurrentConditions, DailyPattern, Dial, Direction, FreshnessBadge, Gust, Lull, Pressure, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, StationFeedProvider, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, useFreshness, useStation, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
25
+ export { AirMatrix, BandChip, CurrentConditions, DailyPattern, Dial, Direction, FreshnessBadge, Gust, Lull, Pressure, Readout, Sparkline, Speed, StationCard, StationCardChart, StationCardHeader, StationCardInstrument, StationCardSummary, StationFeedProvider, StationStrip, StationTable, Temperature, TrendChart, UpdatedAt, WindArrow, WindHistoryChart, WindRose, WindSampleStrip, useFreshness, useMeasuredChartWidth, useStation, useStationCurrent, useStationFeed, useStationFeedContext, useStationLive };
@@ -0,0 +1,20 @@
1
+ import { LiveSample, LiveSamples } from "./contract.js";
2
+ import { ChartFrame, ChartScaleOptions, ChartScales, Vane } from "./geometry.js";
3
+ //#region src/samples.d.ts
4
+ declare const SAMPLE_GAP_TOLERANCE_FACTOR = 2.5;
5
+ declare function sampleRuns(samples: LiveSamples, toleranceFactor?: number): LiveSample[][];
6
+ declare function sampleScales(samples: LiveSamples, frame: ChartFrame, options?: ChartScaleOptions): ChartScales;
7
+ declare function samplePoints(run: ReadonlyArray<LiveSample>, scales: ChartScales): string;
8
+ declare function sampleMeanDirectionDeg(samples: ReadonlyArray<LiveSample>): number | null;
9
+ declare function thinSampleVanes(samples: ReadonlyArray<LiveSample>, target?: number): Vane[];
10
+ type SamplesSummary = {
11
+ latest: LiveSample;
12
+ peakMps: number;
13
+ peakAt: string;
14
+ meanMps: number;
15
+ meanDirectionDeg: number | null;
16
+ spanSeconds: number;
17
+ };
18
+ declare function samplesSummary(samples: LiveSamples): SamplesSummary | null;
19
+ //#endregion
20
+ export { SAMPLE_GAP_TOLERANCE_FACTOR, SamplesSummary, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes };
@@ -0,0 +1,88 @@
1
+ import { KMH_PER_MPS, isCalm } from "./derive.js";
2
+ import { HISTORY_GAP_TOLERANCE_FACTOR } from "./geometry.js";
3
+ import { meanDirectionDeg } from "@azohra/meteo.core";
4
+ //#region src/samples.ts
5
+ const SAMPLE_GAP_TOLERANCE_FACTOR = HISTORY_GAP_TOLERANCE_FACTOR;
6
+ const DEFAULT_NICE_STEP_MPS = 5 / KMH_PER_MPS;
7
+ const DEFAULT_FLOOR_MPS = 10 / KMH_PER_MPS;
8
+ function sampleRuns(samples, toleranceFactor = SAMPLE_GAP_TOLERANCE_FACTOR) {
9
+ const limitMs = samples.intervalSeconds * 1e3 * toleranceFactor;
10
+ const runs = [];
11
+ let previousMs = Number.NEGATIVE_INFINITY;
12
+ for (const sample of samples.points) {
13
+ const ms = Date.parse(sample.observedAt);
14
+ const run = runs[runs.length - 1];
15
+ if (run && ms - previousMs <= limitMs) run.push(sample);
16
+ else runs.push([sample]);
17
+ previousMs = ms;
18
+ }
19
+ return runs;
20
+ }
21
+ function sampleScales(samples, frame, options = {}) {
22
+ const niceStepMps = options.niceStepMps ?? DEFAULT_NICE_STEP_MPS;
23
+ const floorMps = options.floorMps ?? DEFAULT_FLOOR_MPS;
24
+ const points = samples.points;
25
+ const first = points[0];
26
+ const startMs = first ? Date.parse(first.observedAt) : 0;
27
+ const last = points[points.length - 1];
28
+ const endMs = last ? Date.parse(last.observedAt) : startMs;
29
+ const durationMs = Math.max(1, endMs - startMs);
30
+ const top = points.reduce((max, sample) => Math.max(max, sample.windMps), 0);
31
+ const scaleMax = Math.max(floorMps, Math.ceil(top / niceStepMps) * niceStepMps);
32
+ const xAtMs = (ms) => frame.left + (ms - startMs) / durationMs * (frame.right - frame.left);
33
+ return {
34
+ startMs,
35
+ endMs,
36
+ durationMs,
37
+ scaleMax,
38
+ xAtMs,
39
+ xAt: (observedAt) => xAtMs(Date.parse(observedAt)),
40
+ yAt: (speedMps) => frame.plotBottom - speedMps / scaleMax * (frame.plotBottom - frame.plotTop)
41
+ };
42
+ }
43
+ function samplePoints(run, scales) {
44
+ return run.map((sample) => `${scales.xAt(sample.observedAt).toFixed(1)},${scales.yAt(sample.windMps).toFixed(1)}`).join(" ");
45
+ }
46
+ function sampleMeanDirectionDeg(samples) {
47
+ return meanDirectionDeg(samples.filter((sample) => !isCalm(sample.windMps) && sample.windDirectionDeg != null).map((sample) => sample.windDirectionDeg));
48
+ }
49
+ function thinSampleVanes(samples, target = 13) {
50
+ if (samples.length === 0) return [];
51
+ const step = Math.max(1, Math.round(samples.length / target));
52
+ return Array.from({ length: Math.ceil(samples.length / step) }, (_, index) => {
53
+ const startIndex = index * step;
54
+ const endIndex = startIndex + step;
55
+ const window = samples.slice(startIndex, endIndex);
56
+ const first = Date.parse(window[0].observedAt);
57
+ const last = Date.parse(window[window.length - 1].observedAt);
58
+ return {
59
+ windAvgMps: window.reduce((sum, sample) => sum + sample.windMps, 0) / window.length,
60
+ windDirectionDeg: sampleMeanDirectionDeg(window),
61
+ endIndex,
62
+ midMs: first + (last - first) / 2,
63
+ startIndex
64
+ };
65
+ });
66
+ }
67
+ function samplesSummary(samples) {
68
+ const points = samples.points;
69
+ const latest = points[points.length - 1];
70
+ const first = points[0];
71
+ if (latest == null || first == null) return null;
72
+ let peak = first;
73
+ let sum = 0;
74
+ for (const sample of points) {
75
+ sum += sample.windMps;
76
+ if (sample.windMps > peak.windMps) peak = sample;
77
+ }
78
+ return {
79
+ latest,
80
+ peakMps: peak.windMps,
81
+ peakAt: peak.observedAt,
82
+ meanMps: sum / points.length,
83
+ meanDirectionDeg: sampleMeanDirectionDeg(points),
84
+ spanSeconds: (Date.parse(latest.observedAt) - Date.parse(first.observedAt)) / 1e3
85
+ };
86
+ }
87
+ //#endregion
88
+ export { SAMPLE_GAP_TOLERANCE_FACTOR, sampleMeanDirectionDeg, samplePoints, sampleRuns, sampleScales, samplesSummary, thinSampleVanes };
@@ -0,0 +1,2 @@
1
+ import "../contract.js";
2
+ import "../strings.js";
@@ -0,0 +1,4 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../format.js";
@@ -0,0 +1,3 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
@@ -0,0 +1,11 @@
1
+ import { TickAnchor, measuredChartWidth, tickAnchor } from "../geometry.js";
2
+ //#region src/scene/chart.d.ts
3
+ type ReadoutPart = {
4
+ kind: "text";
5
+ text: string;
6
+ } | {
7
+ kind: "arrow";
8
+ deg: number;
9
+ };
10
+ //#endregion
11
+ export { ReadoutPart };
@@ -1,11 +1,5 @@
1
- import { nearestIndex } from "../geometry.js";
1
+ import { measuredChartWidth, nearestIndex, tickAnchor } from "../geometry.js";
2
2
  //#region src/scene/chart.ts
3
- function tickAnchor(index, lastIndex) {
4
- return index === 0 ? "start" : index === lastIndex ? "end" : "middle";
5
- }
6
- function measuredChartWidth(measured) {
7
- return measured > 0 ? Math.round(measured) : 360;
8
- }
9
3
  function pinnedIndexOf(points, pinnedAt) {
10
4
  if (pinnedAt == null) return null;
11
5
  const found = points.findIndex((point) => point.observedAt === pinnedAt);
@@ -0,0 +1,3 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
@@ -0,0 +1,6 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../geometry.js";
5
+ import "./chart.js";
6
+ import "./wind-plot.js";
@@ -0,0 +1,4 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "./wind-plot.js";
@@ -0,0 +1,2 @@
1
+ import "../derive.js";
2
+ import "../strings.js";
@@ -0,0 +1,18 @@
1
+ import { TickAnchor, measuredChartWidth, tickAnchor } from "../geometry.js";
2
+ import "./air-matrix.js";
3
+ import "./atoms.js";
4
+ import "./card.js";
5
+ import { ReadoutPart } from "./chart.js";
6
+ import "./current.js";
7
+ import "./wind-plot.js";
8
+ import "./dial.js";
9
+ import "./glyphs.js";
10
+ import "./daily-pattern.js";
11
+ import "./rose.js";
12
+ import "./sample-strip.js";
13
+ import "./sparkline.js";
14
+ import "./strip.js";
15
+ import "./table.js";
16
+ import "./trend.js";
17
+ import "./wind-history.js";
18
+ export { ReadoutPart };
@@ -0,0 +1,4 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../instruments.js";
@@ -0,0 +1,6 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../geometry.js";
5
+ import "./chart.js";
6
+ import "./wind-plot.js";
@@ -0,0 +1,130 @@
1
+ import { compassDirection, isCalm, speedToMps } from "../derive.js";
2
+ import { roundSpeed } from "../format.js";
3
+ import { samplePoints, sampleRuns, sampleScales, thinSampleVanes } from "../samples.js";
4
+ import { calmNoteText, speedGridLines, stretchedChartFrame, vaneCells, vaneGuideLines, vaneTickTexts, windRowLabels } from "./wind-plot.js";
5
+ //#region src/scene/sample-strip.ts
6
+ const SAMPLE_STRIP_CLASS = "meteo-sample-strip";
7
+ function sampleStripGate(samples, words) {
8
+ if (samples == null || samples.points.length < 2) return {
9
+ kind: "note",
10
+ className: `${SAMPLE_STRIP_CLASS} meteo-sample-strip-na`,
11
+ text: words.noSamples
12
+ };
13
+ return {
14
+ kind: "draw",
15
+ samples
16
+ };
17
+ }
18
+ function sampleStripScene(input) {
19
+ const { formatTime, plotHeight, samples, stationName, unit, width, words } = input;
20
+ const points = samples.points;
21
+ const shown = (speedMps) => roundSpeed(speedMps, unit);
22
+ const frame = stretchedChartFrame(width, plotHeight);
23
+ const scales = sampleScales(samples, frame, {
24
+ niceStepMps: speedToMps(5, unit),
25
+ floorMps: speedToMps(10, unit)
26
+ });
27
+ const runs = sampleRuns(samples);
28
+ const vanes = thinSampleVanes(points);
29
+ return {
30
+ frame,
31
+ scales,
32
+ points,
33
+ readout: {
34
+ ariaLabel: words.aria.readout(stationName),
35
+ className: "meteo-sample-strip-readout"
36
+ },
37
+ svg: {
38
+ ariaLabel: words.aria.sampleStrip(stationName),
39
+ className: "meteo-sample-strip-svg",
40
+ height: frame.height,
41
+ viewBox: `0 0 ${frame.width} ${frame.height}`,
42
+ width: frame.width
43
+ },
44
+ grid: speedGridLines(frame, scales, shown),
45
+ vaneGuides: vaneGuideLines(vanes, frame, scales),
46
+ trace: runs.map((run) => run.length === 1 ? {
47
+ kind: "dot",
48
+ key: run[0].observedAt,
49
+ className: "meteo-sample-dot",
50
+ cx: scales.xAt(run[0].observedAt),
51
+ cy: scales.yAt(run[0].windMps),
52
+ r: 2
53
+ } : {
54
+ kind: "polyline",
55
+ key: run[0].observedAt,
56
+ className: "meteo-sample-trace",
57
+ points: samplePoints(run, scales)
58
+ }),
59
+ calmNote: points.every((sample) => isCalm(sample.windMps)) ? calmNoteText(frame, words) : null,
60
+ rowLabels: windRowLabels(frame, words),
61
+ vanes: vaneCells(vanes, frame, scales, (vane) => String(shown(vane.windAvgMps))),
62
+ ticks: vaneTickTexts(vanes, frame, scales, (timeMs) => formatTime(new Date(timeMs))),
63
+ hit: {
64
+ className: "meteo-hit",
65
+ fill: "transparent",
66
+ height: frame.height,
67
+ width: frame.width,
68
+ x: 0,
69
+ y: 0
70
+ },
71
+ inspect: (activeIndex) => {
72
+ const active = activeIndex == null ? void 0 : points[activeIndex];
73
+ if (active == null) return {
74
+ readout: {
75
+ strong: `${formatTime(new Date(scales.startMs))}–${formatTime(new Date(scales.endMs))}`,
76
+ span: [{
77
+ kind: "text",
78
+ text: words.inspectHint
79
+ }]
80
+ },
81
+ cursor: null
82
+ };
83
+ const lead = `${shown(active.windMps)} ${words.speedUnits[unit]} · `;
84
+ const span = isCalm(active.windMps) ? [{
85
+ kind: "text",
86
+ text: `${lead}${words.calm}`
87
+ }] : active.windDirectionDeg == null ? [{
88
+ kind: "text",
89
+ text: `${lead}—`
90
+ }] : [
91
+ {
92
+ kind: "text",
93
+ text: `${lead}${words.fromLabel} `
94
+ },
95
+ {
96
+ kind: "arrow",
97
+ deg: active.windDirectionDeg
98
+ },
99
+ {
100
+ kind: "text",
101
+ text: ` ${compassDirection(active.windDirectionDeg)} ${Math.round(active.windDirectionDeg)}°`
102
+ }
103
+ ];
104
+ const x = scales.xAt(active.observedAt);
105
+ return {
106
+ readout: {
107
+ strong: formatTime(new Date(active.observedAt)),
108
+ span
109
+ },
110
+ cursor: {
111
+ line: {
112
+ className: "meteo-cursor",
113
+ x1: x,
114
+ x2: x,
115
+ y1: frame.plotTop,
116
+ y2: frame.vaneRow + 9
117
+ },
118
+ dot: {
119
+ className: "meteo-cursor-dot",
120
+ cx: x,
121
+ cy: scales.yAt(active.windMps),
122
+ r: 3
123
+ }
124
+ }
125
+ };
126
+ }
127
+ };
128
+ }
129
+ //#endregion
130
+ export { SAMPLE_STRIP_CLASS, sampleStripGate, sampleStripScene };
@@ -0,0 +1,3 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
@@ -0,0 +1,3 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
@@ -0,0 +1,3 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
@@ -0,0 +1,4 @@
1
+ import "../contract.js";
2
+ import "../strings.js";
3
+ import "../geometry.js";
4
+ import "./chart.js";
@@ -1,5 +1,4 @@
1
- import { chartFrame, chartScales, trendRuns, trendSeriesPad, trendValueOf, valueScale } from "../geometry.js";
2
- import { tickAnchor } from "./chart.js";
1
+ import { chartFrame, chartScales, tickAnchor, trendRuns, trendSeriesPad, trendValueOf, valueScale } from "../geometry.js";
3
2
  //#region src/scene/trend.ts
4
3
  const TREND_CLASS = "meteo-trend";
5
4
  function trendGate(station, series, words) {
@@ -0,0 +1,6 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../geometry.js";
5
+ import "./chart.js";
6
+ import "./wind-plot.js";
@@ -0,0 +1,5 @@
1
+ import "../contract.js";
2
+ import "../derive.js";
3
+ import "../strings.js";
4
+ import "../geometry.js";
5
+ import "./chart.js";
@@ -1,6 +1,5 @@
1
1
  import { compassDirection, speedToMps } from "../derive.js";
2
- import { averagePoints, chartFrame, chartScales, speedBand, stretchFrame, vanePath, vaneTicks } from "../geometry.js";
3
- import { tickAnchor } from "./chart.js";
2
+ import { averagePoints, chartFrame, chartScales, speedBand, stretchFrame, tickAnchor, vanePath, vaneTicks } from "../geometry.js";
4
3
  //#region src/scene/wind-plot.ts
5
4
  function stretchedChartFrame(width, plotHeight) {
6
5
  const core = chartFrame(width);
package/dist/strings.d.ts CHANGED
@@ -15,6 +15,7 @@ type StationStrings = {
15
15
  lullLabel: string;
16
16
  minLabel: string;
17
17
  noHistory: string;
18
+ noSamples: string;
18
19
  notMeasured: string;
19
20
  notReporting: string;
20
21
  peakLabel: string;
@@ -92,6 +93,7 @@ type StationStrings = {
92
93
  rose: (stationName: string) => string;
93
94
  roseFavorable: (sectors: string) => string;
94
95
  roseGeneric: string;
96
+ sampleStrip: (stationName: string) => string;
95
97
  sparkline: (stationName: string) => string;
96
98
  strip: (stationName: string) => string;
97
99
  summary: (endedAtFormatted: string) => string;
package/dist/strings.js CHANGED
@@ -14,6 +14,7 @@ const defaultStrings = {
14
14
  lullLabel: "lull",
15
15
  minLabel: "Min",
16
16
  noHistory: "No history available",
17
+ noSamples: "No live samples",
17
18
  notMeasured: "Not measured here",
18
19
  notReporting: "Not reporting",
19
20
  peakLabel: "Peak",
@@ -123,6 +124,7 @@ const defaultStrings = {
123
124
  rose: (stationName) => `Wind direction distribution at ${stationName}`,
124
125
  roseFavorable: (sectors) => `The outer ring marks favorable directions: from ${sectors}.`,
125
126
  roseGeneric: "Wind direction distribution",
127
+ sampleStrip: (stationName) => `Live wind at ${stationName}: each point is a single sample, and the vanes below point where the wind blew to.`,
126
128
  sparkline: (stationName) => `six hours of wind at ${stationName}`,
127
129
  strip: (stationName) => `Latest reading at ${stationName}`,
128
130
  summary: (endedAtFormatted) => `Summary of the period ending ${endedAtFormatted}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azohra/meteo.station",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "The station capability of meteo by Azohra: live weather-station reading, derivation, and display - the wire contract, provider adapters, a polling client, a Node server, and React and custom-element display bindings.",
5
5
  "keywords": [
6
6
  "weather-station",
package/styles.css CHANGED
@@ -369,11 +369,13 @@
369
369
  /* ---------- history chart ---------- */
370
370
 
371
371
  .meteo-wind-chart,
372
+ .meteo-sample-strip,
372
373
  .meteo-daily-pattern {
373
374
  width: 100%;
374
375
  }
375
376
 
376
377
  .meteo-wind-chart-na,
378
+ .meteo-sample-strip-na,
377
379
  .meteo-daily-pattern-na,
378
380
  .meteo-trend-na,
379
381
  .meteo-wind-rose-na {
@@ -390,6 +392,7 @@
390
392
  * daily-pattern caption is static — no pin state — but shares the line so
391
393
  * it never wears a different rhythm than the chart above it. */
392
394
  .meteo-wind-chart-readout,
395
+ .meteo-sample-strip-readout,
393
396
  .meteo-daily-pattern-caption,
394
397
  .meteo-trend-readout {
395
398
  display: flex;
@@ -405,18 +408,21 @@
405
408
  }
406
409
 
407
410
  .meteo-wind-chart-readout strong,
411
+ .meteo-sample-strip-readout strong,
408
412
  .meteo-trend-readout strong {
409
413
  color: var(--meteo-accent, #0f7490);
410
414
  font-weight: 700;
411
415
  }
412
416
 
413
417
  .meteo-wind-chart-svg,
418
+ .meteo-sample-strip-svg,
414
419
  .meteo-daily-pattern-svg,
415
420
  .meteo-trend-svg {
416
421
  display: block;
417
422
  }
418
423
 
419
424
  .meteo-wind-chart-svg text,
425
+ .meteo-sample-strip-svg text,
420
426
  .meteo-daily-pattern-svg text,
421
427
  .meteo-trend-svg text {
422
428
  font-family: var(--meteo-font, ui-sans-serif, system-ui, sans-serif);
@@ -563,6 +569,24 @@
563
569
  touch-action: pan-y;
564
570
  }
565
571
 
572
+ /* ---------- sample strip ---------- */
573
+
574
+ /* The live trace: instants in the mean line's colour at a lighter weight —
575
+ * a single sample is a quieter fact than a period mean. Runs split at
576
+ * dropouts; the break itself is the outage. */
577
+ .meteo-sample-trace {
578
+ fill: none;
579
+ stroke: var(--meteo-wind-mean, #0f7490);
580
+ stroke-width: 2;
581
+ stroke-linejoin: round;
582
+ stroke-linecap: round;
583
+ }
584
+
585
+ /* A one-sample run between gaps: still a measurement, drawn as a dot. */
586
+ .meteo-sample-dot {
587
+ fill: var(--meteo-wind-mean, #0f7490);
588
+ }
589
+
566
590
  /* ---------- sparkline ---------- */
567
591
 
568
592
  /* The history chart at word size. Inline content (a table cell, a