@azohra/meteo.station 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +17 -17
  2. package/dist/connectivity.d.ts +2 -2
  3. package/dist/contract.d.ts +105 -105
  4. package/dist/derive.js +4 -4
  5. package/dist/elements/elements/AirExtremesElement.js +5 -18
  6. package/dist/elements/elements/AirMatrixElement.js +6 -31
  7. package/dist/elements/elements/ClimatologyDailyPatternElement.js +17 -12
  8. package/dist/elements/elements/ClimatologyRoseElement.js +5 -15
  9. package/dist/elements/elements/CompassFanElement.js +5 -64
  10. package/dist/elements/elements/CurrentConditionsElement.js +7 -26
  11. package/dist/elements/elements/DailyPatternElement.d.ts +0 -1
  12. package/dist/elements/elements/DailyPatternElement.js +6 -120
  13. package/dist/elements/elements/DialElement.js +3 -95
  14. package/dist/elements/elements/FavorableShareElement.js +6 -21
  15. package/dist/elements/elements/RecentSummariesElement.js +6 -23
  16. package/dist/elements/elements/SparklineElement.d.ts +0 -1
  17. package/dist/elements/elements/SparklineElement.js +4 -39
  18. package/dist/elements/elements/StationCardElement.js +4 -18
  19. package/dist/elements/elements/StationFeedElement.js +4 -2
  20. package/dist/elements/elements/StationStripElement.js +4 -18
  21. package/dist/elements/elements/StationTableElement.js +15 -51
  22. package/dist/elements/elements/TrendChartElement.js +21 -69
  23. package/dist/elements/elements/WindHistoryChartElement.js +23 -164
  24. package/dist/elements/elements/WindRoseElement.d.ts +0 -1
  25. package/dist/elements/elements/WindRoseElement.js +6 -70
  26. package/dist/elements/elements/atoms.d.ts +1 -1
  27. package/dist/elements/elements/atoms.js +11 -38
  28. package/dist/elements/index.js +3 -3
  29. package/dist/elements/lib/fragments.js +8 -37
  30. package/dist/elements/lib/h.js +1 -1
  31. package/dist/elements/lib/render.js +30 -0
  32. package/dist/geometry.js +2 -1
  33. package/dist/instruments.js +2 -2
  34. package/dist/react/components/AirExtremes.d.ts +1 -1
  35. package/dist/react/components/AirExtremes.js +5 -22
  36. package/dist/react/components/AirMatrix.js +10 -43
  37. package/dist/react/components/ClimatologyDailyPattern.d.ts +1 -1
  38. package/dist/react/components/ClimatologyDailyPattern.js +19 -13
  39. package/dist/react/components/ClimatologyRose.d.ts +1 -1
  40. package/dist/react/components/ClimatologyRose.js +11 -28
  41. package/dist/react/components/CompassFan.d.ts +1 -1
  42. package/dist/react/components/CompassFan.js +6 -73
  43. package/dist/react/components/CurrentConditions.d.ts +1 -1
  44. package/dist/react/components/CurrentConditions.js +11 -74
  45. package/dist/react/components/DailyPattern.d.ts +1 -3
  46. package/dist/react/components/DailyPattern.js +10 -149
  47. package/dist/react/components/Dial.d.ts +1 -1
  48. package/dist/react/components/Dial.js +5 -118
  49. package/dist/react/components/FavorableShare.d.ts +1 -1
  50. package/dist/react/components/FavorableShare.js +6 -27
  51. package/dist/react/components/FreshnessBadge.d.ts +1 -1
  52. package/dist/react/components/FreshnessBadge.js +5 -12
  53. package/dist/react/components/RecentSummaries.d.ts +1 -1
  54. package/dist/react/components/RecentSummaries.js +6 -44
  55. package/dist/react/components/SceneTree.js +38 -0
  56. package/dist/react/components/Sparkline.d.ts +1 -1
  57. package/dist/react/components/Sparkline.js +3 -39
  58. package/dist/react/components/StationCard.d.ts +2 -2
  59. package/dist/react/components/StationCard.js +5 -45
  60. package/dist/react/components/StationStrip.d.ts +1 -1
  61. package/dist/react/components/StationStrip.js +5 -60
  62. package/dist/react/components/StationTable.js +21 -75
  63. package/dist/react/components/TrendChart.js +8 -63
  64. package/dist/react/components/WindArrow.d.ts +1 -1
  65. package/dist/react/components/WindArrow.js +3 -15
  66. package/dist/react/components/WindHistoryChart.js +8 -182
  67. package/dist/react/components/WindRose.d.ts +1 -3
  68. package/dist/react/components/WindRose.js +6 -89
  69. package/dist/react/components/WindSampleStrip.js +8 -115
  70. package/dist/react/components/atoms.d.ts +5 -5
  71. package/dist/react/components/atoms.js +12 -48
  72. package/dist/react/hooks/useStationCurrent.js +3 -2
  73. package/dist/react/hooks/useStationFeed.js +3 -2
  74. package/dist/react/index.d.ts +2 -2
  75. package/dist/react/index.js +5 -5
  76. package/dist/react/lib/cells.js +4 -24
  77. package/dist/scene/air-extremes.js +12 -27
  78. package/dist/scene/air-matrix.js +45 -58
  79. package/dist/scene/card.js +14 -40
  80. package/dist/scene/cells.d.ts +4 -0
  81. package/dist/scene/cells.js +51 -0
  82. package/dist/scene/chart.js +2 -1
  83. package/dist/scene/climatology-pattern.d.ts +1 -2
  84. package/dist/scene/climatology-pattern.js +10 -11
  85. package/dist/scene/climatology-rose.d.ts +1 -2
  86. package/dist/scene/climatology-rose.js +14 -33
  87. package/dist/scene/compass-fan.js +28 -100
  88. package/dist/scene/current.d.ts +2 -1
  89. package/dist/scene/current.js +29 -56
  90. package/dist/scene/daily-pattern.d.ts +1 -3
  91. package/dist/scene/daily-pattern.js +20 -27
  92. package/dist/scene/dial-parts.d.ts +1 -0
  93. package/dist/scene/dial-parts.js +70 -0
  94. package/dist/scene/dial.d.ts +1 -2
  95. package/dist/scene/dial.js +48 -136
  96. package/dist/scene/favorable-share.js +16 -33
  97. package/dist/scene/glyphs.js +20 -16
  98. package/dist/scene/index.d.ts +5 -3
  99. package/dist/scene/node.js +19 -0
  100. package/dist/scene/recent-summaries.js +26 -63
  101. package/dist/scene/rose.js +89 -117
  102. package/dist/scene/sample-strip.d.ts +1 -2
  103. package/dist/scene/sample-strip.js +35 -36
  104. package/dist/scene/sparkline.js +31 -40
  105. package/dist/scene/strip.js +18 -57
  106. package/dist/scene/table.js +47 -69
  107. package/dist/scene/trend.d.ts +1 -2
  108. package/dist/scene/trend.js +29 -55
  109. package/dist/scene/wind-history.d.ts +1 -2
  110. package/dist/scene/wind-history.js +41 -51
  111. package/dist/scene/wind-plot.js +70 -140
  112. package/dist/server/adapters/campbell.d.ts +7 -7
  113. package/dist/server/adapters/campbell.js +1 -1
  114. package/dist/server/adapters/ecowitt.d.ts +8 -8
  115. package/dist/server/adapters/tempest.d.ts +6 -6
  116. package/dist/server/adapters/windnerd-climatology.js +4 -3
  117. package/dist/server/adapters/windnerd-live.js +3 -2
  118. package/dist/server/adapters/windnerd.d.ts +8 -8
  119. package/dist/server/adapters/windnerd.js +1 -1
  120. package/dist/server/config.d.ts +48 -48
  121. package/dist/server/hologram.js +2 -1
  122. package/package.json +6 -11
  123. package/schema/README.md +1 -1
  124. package/schema/stationclimatology.schema.json +64 -61
  125. package/schema/stationcurrent.schema.json +68 -156
  126. package/schema/stationfeed.schema.json +71 -163
  127. package/schema/stationhistory.schema.json +37 -46
  128. package/schema/stationlive.schema.json +221 -306
package/README.md CHANGED
@@ -1,23 +1,24 @@
1
1
  # `@azohra/meteo.station`
2
2
 
3
- The **station** capability of meteo by Azohra: one wire contract, vendor
4
- adapters that normalize into it (WindNerd, WeatherFlow Tempest, Campbell
5
- Scientific loggers, Ecowitt, or your own), a mountable `Request → Response` handler
6
- that serves the whole inventory as a single feed, and hooks and components
7
- that render it natively, in your design system, with no vendor iframe.
3
+ Live weather stations for meteo by Azohra. Adapters read WindNerd,
4
+ WeatherFlow Tempest, Campbell Scientific loggers, Ecowitt, or your own
5
+ hardware and convert it to one wire contract. A handler you mount on your
6
+ server serves every station as a single feed, and React components or
7
+ custom elements render that feed on your page in your own styles, without a
8
+ vendor iframe.
8
9
 
9
10
  ## Surface
10
11
 
11
12
  | Entry point | What it is |
12
13
  |---|---|
13
- | `@azohra/meteo.station` | The isomorphic root: the wire contract (zod), the standalone connectivity contract (`StationConnectivity` — cellular backhaul health for the operator's own routes, never the public feed), 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
- | `@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
- | `@azohra/meteo.station/server` | Vendor adapters plus the custom-adapter interface and `defineStationAdapter`, data-level `loadStationFeed()` / `loadStationCurrent()`, the Hologram connectivity loader (`loadHologramConnectivity`), and the mountable feed handler. Server-only, so it can never leak into a client bundle. |
14
+ | `@azohra/meteo.station` | Runs on server and client. The wire contract (zod); the separate connectivity contract, `StationConnectivity`, which reports cellular backhaul health on the operator's own routes and is never part of the public feed; pure derivations (period stats, compass, freshness, unit and threshold conversion); chart and instrument geometry; and the display rules both bindings share (strings, formatting, air sentences, display resolution, merge policy). |
15
+ | `@azohra/meteo.station/client` | The framework-free client data layer: `createJsonPoller` and the station stores (`createStationFeedStore`, `createStationCurrentStore`, `createStationStore`) every binding subscribes to. It runs only in the browser but is safe to import anywhere. |
16
+ | `@azohra/meteo.station/server` | Vendor adapters plus the custom-adapter interface and `defineStationAdapter`, data-level `loadStationFeed()` / `loadStationCurrent()`, the Hologram connectivity loader (`loadHologramConnectivity`), and the mountable feed handler. It is server-only, so it cannot end up in a client bundle. |
16
17
  | `@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
- | `@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
+ | `@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…), with the same features as the React binding and no framework. A parity suite keeps the two byte-identical. Import `/register` to define every element. |
18
19
  | `@azohra/meteo.station/styles.css` | The default skin (an intentional side effect), shared by both bindings. |
19
20
 
20
- ## Taste
21
+ ## Example
21
22
 
22
23
  ```tsx
23
24
  import { StationFeedProvider, useStation, StationCard } from "@azohra/meteo.station/react";
@@ -39,15 +40,14 @@ function LiveWind() {
39
40
 
40
41
  ## Documentation
41
42
 
42
- Station's reference lives in [`docs/`](docs/) and is served at
43
- <https://meteo.azohra.com/docs/station/>.
44
-
45
- JSON Schema for the wire documents lives in [`../schema/`](../schema/).
43
+ The documentation is in [`docs/`](docs/) and published at
44
+ <https://meteo.azohra.com/docs/station/>. JSON Schema for the wire
45
+ documents is in [`schema/`](schema/).
46
46
 
47
47
  ## Stability
48
48
 
49
- Pre-1.0: the wire contract and environment helpers are stable; handler
50
- internals are not. Pin a minor version if you reach past the documented
51
- surface.
49
+ The package is pre-1.0. The wire contract and environment helpers are
50
+ stable, and the handler's internals are not. Pin a minor version if you use
51
+ anything beyond the documented surface.
52
52
 
53
53
  MIT © Justin Watts
@@ -18,11 +18,11 @@ declare const stationConnectivitySchema: z.ZodObject<{
18
18
  radioTechnology: z.ZodNullable<z.ZodString>;
19
19
  sim: z.ZodObject<{
20
20
  service: z.ZodEnum<{
21
- unknown: "unknown";
22
21
  active: "active";
23
- paused: "paused";
24
22
  inactive: "inactive";
23
+ paused: "paused";
25
24
  retired: "retired";
25
+ unknown: "unknown";
26
26
  }>;
27
27
  vendorState: z.ZodNullable<z.ZodString>;
28
28
  expiresAt: z.ZodNullable<z.ZodString>;
@@ -13,10 +13,10 @@ declare const airConditionsSchema: z.ZodObject<{
13
13
  precipitationRateMmPerHour: z.ZodNullable<z.ZodNumber>;
14
14
  precipitationTodayMm: z.ZodNullable<z.ZodNumber>;
15
15
  pressureTrend: z.ZodNullable<z.ZodEnum<{
16
- unknown: "unknown";
17
16
  falling: "falling";
18
17
  rising: "rising";
19
18
  steady: "steady";
19
+ unknown: "unknown";
20
20
  }>>;
21
21
  relativeHumidityPercent: z.ZodNullable<z.ZodNumber>;
22
22
  seaLevelPressureHpa: z.ZodNullable<z.ZodNumber>;
@@ -45,10 +45,10 @@ declare const readingSchema: z.ZodObject<{
45
45
  precipitationRateMmPerHour: z.ZodNullable<z.ZodNumber>;
46
46
  precipitationTodayMm: z.ZodNullable<z.ZodNumber>;
47
47
  pressureTrend: z.ZodNullable<z.ZodEnum<{
48
- unknown: "unknown";
49
48
  falling: "falling";
50
49
  rising: "rising";
51
50
  steady: "steady";
51
+ unknown: "unknown";
52
52
  }>>;
53
53
  relativeHumidityPercent: z.ZodNullable<z.ZodNumber>;
54
54
  seaLevelPressureHpa: z.ZodNullable<z.ZodNumber>;
@@ -166,6 +166,30 @@ declare const stationMetaSchema: z.ZodObject<{
166
166
  }, z.core.$strip>;
167
167
  type StationMeta = z.infer<typeof stationMetaSchema>;
168
168
  declare const stationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
169
+ id: z.ZodString;
170
+ name: z.ZodString;
171
+ sourceLabel: z.ZodString;
172
+ pageUrl: z.ZodNullable<z.ZodString>;
173
+ latitude: z.ZodNullable<z.ZodNumber>;
174
+ longitude: z.ZodNullable<z.ZodNumber>;
175
+ timeZone: z.ZodNullable<z.ZodString>;
176
+ elevationM: z.ZodNullable<z.ZodNumber>;
177
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
178
+ fromDeg: z.ZodNumber;
179
+ toDeg: z.ZodNumber;
180
+ }, z.core.$strip>>>>;
181
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
182
+ capabilities: z.ZodObject<{
183
+ gustLull: z.ZodBoolean;
184
+ temperature: z.ZodBoolean;
185
+ conditions: z.ZodBoolean;
186
+ history: z.ZodBoolean;
187
+ live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
188
+ battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
189
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
190
+ }, z.core.$strip>;
191
+ samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
192
+ recommendedPollSeconds: z.ZodNumber;
169
193
  status: z.ZodLiteral<"ok">;
170
194
  reading: z.ZodObject<{
171
195
  observedAt: z.ZodString;
@@ -184,10 +208,10 @@ declare const stationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
184
208
  precipitationRateMmPerHour: z.ZodNullable<z.ZodNumber>;
185
209
  precipitationTodayMm: z.ZodNullable<z.ZodNumber>;
186
210
  pressureTrend: z.ZodNullable<z.ZodEnum<{
187
- unknown: "unknown";
188
211
  falling: "falling";
189
212
  rising: "rising";
190
213
  steady: "steady";
214
+ unknown: "unknown";
191
215
  }>>;
192
216
  relativeHumidityPercent: z.ZodNullable<z.ZodNumber>;
193
217
  seaLevelPressureHpa: z.ZodNullable<z.ZodNumber>;
@@ -241,6 +265,7 @@ declare const stationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
241
265
  seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
242
266
  }, z.core.$strip>>;
243
267
  }, z.core.$strip>>>>;
268
+ }, z.core.$strip>, z.ZodObject<{
244
269
  id: z.ZodString;
245
270
  name: z.ZodString;
246
271
  sourceLabel: z.ZodString;
@@ -265,41 +290,16 @@ declare const stationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
265
290
  }, z.core.$strip>;
266
291
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
267
292
  recommendedPollSeconds: z.ZodNumber;
268
- }, z.core.$strip>, z.ZodObject<{
269
293
  status: z.ZodLiteral<"unavailable">;
270
294
  reason: z.ZodEnum<{
271
- upstream_error: "upstream_error";
272
- timeout: "timeout";
273
- rate_limited: "rate_limited";
274
295
  contract_break: "contract_break";
275
296
  not_configured: "not_configured";
297
+ rate_limited: "rate_limited";
298
+ timeout: "timeout";
299
+ upstream_error: "upstream_error";
276
300
  }>;
277
301
  reading: z.ZodNull;
278
302
  history: z.ZodNull;
279
- id: z.ZodString;
280
- name: z.ZodString;
281
- sourceLabel: z.ZodString;
282
- pageUrl: z.ZodNullable<z.ZodString>;
283
- latitude: z.ZodNullable<z.ZodNumber>;
284
- longitude: z.ZodNullable<z.ZodNumber>;
285
- timeZone: z.ZodNullable<z.ZodString>;
286
- elevationM: z.ZodNullable<z.ZodNumber>;
287
- declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
288
- fromDeg: z.ZodNumber;
289
- toDeg: z.ZodNumber;
290
- }, z.core.$strip>>>>;
291
- broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
292
- capabilities: z.ZodObject<{
293
- gustLull: z.ZodBoolean;
294
- temperature: z.ZodBoolean;
295
- conditions: z.ZodBoolean;
296
- history: z.ZodBoolean;
297
- live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
298
- battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
299
- recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
300
- }, z.core.$strip>;
301
- samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
302
- recommendedPollSeconds: z.ZodNumber;
303
303
  }, z.core.$strip>], "status">;
304
304
  type Station = z.infer<typeof stationSchema>;
305
305
  declare const stationFeedSchema: z.ZodObject<{
@@ -307,6 +307,30 @@ declare const stationFeedSchema: z.ZodObject<{
307
307
  servedAt: z.ZodString;
308
308
  primaryStationId: z.ZodNullable<z.ZodString>;
309
309
  stations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
310
+ id: z.ZodString;
311
+ name: z.ZodString;
312
+ sourceLabel: z.ZodString;
313
+ pageUrl: z.ZodNullable<z.ZodString>;
314
+ latitude: z.ZodNullable<z.ZodNumber>;
315
+ longitude: z.ZodNullable<z.ZodNumber>;
316
+ timeZone: z.ZodNullable<z.ZodString>;
317
+ elevationM: z.ZodNullable<z.ZodNumber>;
318
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
319
+ fromDeg: z.ZodNumber;
320
+ toDeg: z.ZodNumber;
321
+ }, z.core.$strip>>>>;
322
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
323
+ capabilities: z.ZodObject<{
324
+ gustLull: z.ZodBoolean;
325
+ temperature: z.ZodBoolean;
326
+ conditions: z.ZodBoolean;
327
+ history: z.ZodBoolean;
328
+ live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
329
+ battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
330
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
331
+ }, z.core.$strip>;
332
+ samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
333
+ recommendedPollSeconds: z.ZodNumber;
310
334
  status: z.ZodLiteral<"ok">;
311
335
  reading: z.ZodObject<{
312
336
  observedAt: z.ZodString;
@@ -325,10 +349,10 @@ declare const stationFeedSchema: z.ZodObject<{
325
349
  precipitationRateMmPerHour: z.ZodNullable<z.ZodNumber>;
326
350
  precipitationTodayMm: z.ZodNullable<z.ZodNumber>;
327
351
  pressureTrend: z.ZodNullable<z.ZodEnum<{
328
- unknown: "unknown";
329
352
  falling: "falling";
330
353
  rising: "rising";
331
354
  steady: "steady";
355
+ unknown: "unknown";
332
356
  }>>;
333
357
  relativeHumidityPercent: z.ZodNullable<z.ZodNumber>;
334
358
  seaLevelPressureHpa: z.ZodNullable<z.ZodNumber>;
@@ -382,6 +406,7 @@ declare const stationFeedSchema: z.ZodObject<{
382
406
  seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
383
407
  }, z.core.$strip>>;
384
408
  }, z.core.$strip>>>>;
409
+ }, z.core.$strip>, z.ZodObject<{
385
410
  id: z.ZodString;
386
411
  name: z.ZodString;
387
412
  sourceLabel: z.ZodString;
@@ -406,17 +431,23 @@ declare const stationFeedSchema: z.ZodObject<{
406
431
  }, z.core.$strip>;
407
432
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
408
433
  recommendedPollSeconds: z.ZodNumber;
409
- }, z.core.$strip>, z.ZodObject<{
410
434
  status: z.ZodLiteral<"unavailable">;
411
435
  reason: z.ZodEnum<{
412
- upstream_error: "upstream_error";
413
- timeout: "timeout";
414
- rate_limited: "rate_limited";
415
436
  contract_break: "contract_break";
416
437
  not_configured: "not_configured";
438
+ rate_limited: "rate_limited";
439
+ timeout: "timeout";
440
+ upstream_error: "upstream_error";
417
441
  }>;
418
442
  reading: z.ZodNull;
419
443
  history: z.ZodNull;
444
+ }, z.core.$strip>], "status">>;
445
+ }, z.core.$strip>;
446
+ type StationFeed = z.infer<typeof stationFeedSchema>;
447
+ declare const stationCurrentSchema: z.ZodObject<{
448
+ schemaVersion: z.ZodLiteral<2>;
449
+ servedAt: z.ZodString;
450
+ station: z.ZodDiscriminatedUnion<[z.ZodObject<{
420
451
  id: z.ZodString;
421
452
  name: z.ZodString;
422
453
  sourceLabel: z.ZodString;
@@ -441,13 +472,6 @@ declare const stationFeedSchema: z.ZodObject<{
441
472
  }, z.core.$strip>;
442
473
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
443
474
  recommendedPollSeconds: z.ZodNumber;
444
- }, z.core.$strip>], "status">>;
445
- }, z.core.$strip>;
446
- type StationFeed = z.infer<typeof stationFeedSchema>;
447
- declare const stationCurrentSchema: z.ZodObject<{
448
- schemaVersion: z.ZodLiteral<2>;
449
- servedAt: z.ZodString;
450
- station: z.ZodDiscriminatedUnion<[z.ZodObject<{
451
475
  status: z.ZodLiteral<"ok">;
452
476
  reading: z.ZodObject<{
453
477
  observedAt: z.ZodString;
@@ -466,10 +490,10 @@ declare const stationCurrentSchema: z.ZodObject<{
466
490
  precipitationRateMmPerHour: z.ZodNullable<z.ZodNumber>;
467
491
  precipitationTodayMm: z.ZodNullable<z.ZodNumber>;
468
492
  pressureTrend: z.ZodNullable<z.ZodEnum<{
469
- unknown: "unknown";
470
493
  falling: "falling";
471
494
  rising: "rising";
472
495
  steady: "steady";
496
+ unknown: "unknown";
473
497
  }>>;
474
498
  relativeHumidityPercent: z.ZodNullable<z.ZodNumber>;
475
499
  seaLevelPressureHpa: z.ZodNullable<z.ZodNumber>;
@@ -523,6 +547,7 @@ declare const stationCurrentSchema: z.ZodObject<{
523
547
  seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
524
548
  }, z.core.$strip>>;
525
549
  }, z.core.$strip>>>>;
550
+ }, z.core.$strip>, z.ZodObject<{
526
551
  id: z.ZodString;
527
552
  name: z.ZodString;
528
553
  sourceLabel: z.ZodString;
@@ -547,41 +572,16 @@ declare const stationCurrentSchema: z.ZodObject<{
547
572
  }, z.core.$strip>;
548
573
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
549
574
  recommendedPollSeconds: z.ZodNumber;
550
- }, z.core.$strip>, z.ZodObject<{
551
575
  status: z.ZodLiteral<"unavailable">;
552
576
  reason: z.ZodEnum<{
553
- upstream_error: "upstream_error";
554
- timeout: "timeout";
555
- rate_limited: "rate_limited";
556
577
  contract_break: "contract_break";
557
578
  not_configured: "not_configured";
579
+ rate_limited: "rate_limited";
580
+ timeout: "timeout";
581
+ upstream_error: "upstream_error";
558
582
  }>;
559
583
  reading: z.ZodNull;
560
584
  history: z.ZodNull;
561
- id: z.ZodString;
562
- name: z.ZodString;
563
- sourceLabel: z.ZodString;
564
- pageUrl: z.ZodNullable<z.ZodString>;
565
- latitude: z.ZodNullable<z.ZodNumber>;
566
- longitude: z.ZodNullable<z.ZodNumber>;
567
- timeZone: z.ZodNullable<z.ZodString>;
568
- elevationM: z.ZodNullable<z.ZodNumber>;
569
- declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
570
- fromDeg: z.ZodNumber;
571
- toDeg: z.ZodNumber;
572
- }, z.core.$strip>>>>;
573
- broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
574
- capabilities: z.ZodObject<{
575
- gustLull: z.ZodBoolean;
576
- temperature: z.ZodBoolean;
577
- conditions: z.ZodBoolean;
578
- history: z.ZodBoolean;
579
- live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
580
- battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
581
- recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
582
- }, z.core.$strip>;
583
- samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
584
- recommendedPollSeconds: z.ZodNumber;
585
585
  }, z.core.$strip>], "status">;
586
586
  }, z.core.$strip>;
587
587
  type StationCurrent = z.infer<typeof stationCurrentSchema>;
@@ -615,6 +615,30 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
615
615
  schemaVersion: z.ZodLiteral<2>;
616
616
  servedAt: z.ZodString;
617
617
  station: z.ZodDiscriminatedUnion<[z.ZodObject<{
618
+ id: z.ZodString;
619
+ name: z.ZodString;
620
+ sourceLabel: z.ZodString;
621
+ pageUrl: z.ZodNullable<z.ZodString>;
622
+ latitude: z.ZodNullable<z.ZodNumber>;
623
+ longitude: z.ZodNullable<z.ZodNumber>;
624
+ timeZone: z.ZodNullable<z.ZodString>;
625
+ elevationM: z.ZodNullable<z.ZodNumber>;
626
+ declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
627
+ fromDeg: z.ZodNumber;
628
+ toDeg: z.ZodNumber;
629
+ }, z.core.$strip>>>>;
630
+ broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
631
+ capabilities: z.ZodObject<{
632
+ gustLull: z.ZodBoolean;
633
+ temperature: z.ZodBoolean;
634
+ conditions: z.ZodBoolean;
635
+ history: z.ZodBoolean;
636
+ live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
637
+ battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
638
+ recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
639
+ }, z.core.$strip>;
640
+ samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
641
+ recommendedPollSeconds: z.ZodNumber;
618
642
  status: z.ZodLiteral<"ok">;
619
643
  reading: z.ZodObject<{
620
644
  observedAt: z.ZodString;
@@ -633,10 +657,10 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
633
657
  precipitationRateMmPerHour: z.ZodNullable<z.ZodNumber>;
634
658
  precipitationTodayMm: z.ZodNullable<z.ZodNumber>;
635
659
  pressureTrend: z.ZodNullable<z.ZodEnum<{
636
- unknown: "unknown";
637
660
  falling: "falling";
638
661
  rising: "rising";
639
662
  steady: "steady";
663
+ unknown: "unknown";
640
664
  }>>;
641
665
  relativeHumidityPercent: z.ZodNullable<z.ZodNumber>;
642
666
  seaLevelPressureHpa: z.ZodNullable<z.ZodNumber>;
@@ -690,6 +714,7 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
690
714
  seaLevelPressureMaxHpa: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
691
715
  }, z.core.$strip>>;
692
716
  }, z.core.$strip>>>>;
717
+ }, z.core.$strip>, z.ZodObject<{
693
718
  id: z.ZodString;
694
719
  name: z.ZodString;
695
720
  sourceLabel: z.ZodString;
@@ -714,41 +739,16 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
714
739
  }, z.core.$strip>;
715
740
  samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
716
741
  recommendedPollSeconds: z.ZodNumber;
717
- }, z.core.$strip>, z.ZodObject<{
718
742
  status: z.ZodLiteral<"unavailable">;
719
743
  reason: z.ZodEnum<{
720
- upstream_error: "upstream_error";
721
- timeout: "timeout";
722
- rate_limited: "rate_limited";
723
744
  contract_break: "contract_break";
724
745
  not_configured: "not_configured";
746
+ rate_limited: "rate_limited";
747
+ timeout: "timeout";
748
+ upstream_error: "upstream_error";
725
749
  }>;
726
750
  reading: z.ZodNull;
727
751
  history: z.ZodNull;
728
- id: z.ZodString;
729
- name: z.ZodString;
730
- sourceLabel: z.ZodString;
731
- pageUrl: z.ZodNullable<z.ZodString>;
732
- latitude: z.ZodNullable<z.ZodNumber>;
733
- longitude: z.ZodNullable<z.ZodNumber>;
734
- timeZone: z.ZodNullable<z.ZodString>;
735
- elevationM: z.ZodNullable<z.ZodNumber>;
736
- declaredFavorableDirections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
737
- fromDeg: z.ZodNumber;
738
- toDeg: z.ZodNumber;
739
- }, z.core.$strip>>>>;
740
- broadcastDelaySeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
741
- capabilities: z.ZodObject<{
742
- gustLull: z.ZodBoolean;
743
- temperature: z.ZodBoolean;
744
- conditions: z.ZodBoolean;
745
- history: z.ZodBoolean;
746
- live: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
747
- battery: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
748
- recentSummaries: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
749
- }, z.core.$strip>;
750
- samplingWindowSeconds: z.ZodNullable<z.ZodNumber>;
751
- recommendedPollSeconds: z.ZodNumber;
752
752
  }, z.core.$strip>], "status">;
753
753
  }, z.core.$strip>, z.ZodObject<{
754
754
  type: z.ZodLiteral<"samples">;
@@ -782,10 +782,10 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
782
782
  precipitationRateMmPerHour: z.ZodNullable<z.ZodNumber>;
783
783
  precipitationTodayMm: z.ZodNullable<z.ZodNumber>;
784
784
  pressureTrend: z.ZodNullable<z.ZodEnum<{
785
- unknown: "unknown";
786
785
  falling: "falling";
787
786
  rising: "rising";
788
787
  steady: "steady";
788
+ unknown: "unknown";
789
789
  }>>;
790
790
  relativeHumidityPercent: z.ZodNullable<z.ZodNumber>;
791
791
  seaLevelPressureHpa: z.ZodNullable<z.ZodNumber>;
@@ -825,11 +825,11 @@ declare const stationLiveFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
825
825
  type: z.ZodLiteral<"unavailable">;
826
826
  stationId: z.ZodString;
827
827
  reason: z.ZodEnum<{
828
- upstream_error: "upstream_error";
829
- timeout: "timeout";
830
- rate_limited: "rate_limited";
831
828
  contract_break: "contract_break";
832
829
  not_configured: "not_configured";
830
+ rate_limited: "rate_limited";
831
+ timeout: "timeout";
832
+ upstream_error: "upstream_error";
833
833
  }>;
834
834
  }, z.core.$strip>], "type">;
835
835
  type StationLiveFrame = z.infer<typeof stationLiveFrameSchema>;
package/dist/derive.js CHANGED
@@ -150,15 +150,15 @@ function lastNightLowC(points, latitude, longitude, nowMs) {
150
150
  return null;
151
151
  }
152
152
  const DEFAULT_FRESHNESS_THRESHOLDS = {
153
- currentForMs: 10 * 6e4,
154
- staleAfterMs: 45 * 6e4
153
+ currentForMs: 6e5,
154
+ staleAfterMs: 27e5
155
155
  };
156
156
  const clampMs = (value, low, high) => Math.min(high, Math.max(low, value));
157
157
  function stationFreshnessThresholds(meta) {
158
- const currentForMs = clampMs(meta.recommendedPollSeconds * 5 * 1e3, 6e4, 10 * 6e4);
158
+ const currentForMs = clampMs(meta.recommendedPollSeconds * 5 * 1e3, 6e4, 6e5);
159
159
  return {
160
160
  currentForMs,
161
- staleAfterMs: clampMs(currentForMs * 6, 10 * 6e4, 45 * 6e4)
161
+ staleAfterMs: clampMs(currentForMs * 6, 6e5, 27e5)
162
162
  };
163
163
  }
164
164
  function anchoredAgeMs(input) {
@@ -1,32 +1,19 @@
1
1
  import { resolveStation } from "../../display.js";
2
- import { airExtremesGate, airExtremesScene } from "../../scene/air-extremes.js";
2
+ import { airExtremesScene } from "../../scene/air-extremes.js";
3
3
  import { MeteoStationElement } from "../lib/base.js";
4
- import { h } from "../lib/h.js";
4
+ import { renderOptional } from "../lib/render.js";
5
5
  //#region src/elements/elements/AirExtremesElement.ts
6
6
  var AirExtremesElement = class extends MeteoStationElement {
7
7
  static observedAttributes = ["now-ms", "station-id"];
8
8
  render() {
9
9
  const station = this.station ?? resolveStation(this.ambient()?.feed ?? null, this.getAttribute("station-id") ?? void 0) ?? void 0;
10
10
  const { words } = this.display();
11
- const gate = airExtremesGate(station);
12
- if (gate.kind === "hidden") {
13
- this.replaceChildren();
14
- return;
15
- }
16
11
  const nowAttribute = Number(this.getAttribute("now-ms"));
17
- const scene = airExtremesScene({
12
+ this.replaceChildren(...renderOptional(airExtremesScene({
18
13
  nowMs: Number.isFinite(nowAttribute) && nowAttribute > 0 ? nowAttribute : Date.now(),
19
- station: gate.station,
14
+ station,
20
15
  words
21
- });
22
- if (scene == null) {
23
- this.replaceChildren();
24
- return;
25
- }
26
- this.replaceChildren(h("dl", {
27
- "aria-label": scene.ariaLabel,
28
- class: scene.className
29
- }, scene.tiles.map((tile) => h("div", { class: tile.className }, h("dt", { class: "meteo-microlabel" }, tile.label), h("dd", { class: "meteo-air-extremes-value" }, tile.value)))));
16
+ })));
30
17
  }
31
18
  };
32
19
  //#endregion
@@ -3,6 +3,7 @@ import { airMatrixScene } from "../../scene/air-matrix.js";
3
3
  import { ELEMENTS_AMBIENT_HINT } from "../lib/ambient.js";
4
4
  import { MeteoStationElement } from "../lib/base.js";
5
5
  import { h } from "../lib/h.js";
6
+ import { renderScene } from "../lib/render.js";
6
7
  //#region src/elements/elements/AirMatrixElement.ts
7
8
  let panelCounter = 0;
8
9
  var AirMatrixElement = class extends MeteoStationElement {
@@ -34,49 +35,23 @@ var AirMatrixElement = class extends MeteoStationElement {
34
35
  this.replaceChildren();
35
36
  return;
36
37
  }
37
- const rowStyled = (element) => {
38
- element.style.gridTemplateColumns = scene.matrix.gridTemplateColumns;
39
- return element;
40
- };
41
38
  this.replaceChildren(h("section", {
42
- class: scene.className,
39
+ class: "meteo-air",
43
40
  "data-expanded": String(expanded)
44
41
  }, h("button", {
45
42
  "aria-controls": this.#panelId,
46
43
  "aria-expanded": String(expanded),
47
- class: scene.trigger.className,
44
+ class: "meteo-air-trigger",
48
45
  onclick: () => {
49
46
  this.#expanded = !this.#expanded;
50
47
  this.requestRender();
51
48
  },
52
49
  type: "button"
53
- }, h("strong", { class: scene.trigger.title.className }, scene.trigger.title.text), h("span", { class: scene.trigger.summary.className }, scene.trigger.summary.text)), h("div", {
54
- class: scene.panelClassName,
50
+ }, h("strong", { class: "meteo-air-title" }, scene.title), h("span", { class: "meteo-air-summary" }, scene.summary)), h("div", {
51
+ class: "meteo-air-panel",
55
52
  hidden: !expanded,
56
53
  id: this.#panelId
57
- }, h("div", {
58
- "aria-label": scene.matrix.ariaLabel,
59
- class: scene.matrix.className,
60
- role: "table"
61
- }, rowStyled(h("div", {
62
- class: scene.matrix.head.className,
63
- role: "row"
64
- }, h("span", {
65
- class: scene.matrix.head.corner.className,
66
- role: "columnheader"
67
- }), scene.matrix.head.columns.map((column) => h("span", {
68
- class: scene.matrix.head.columnClassName,
69
- role: "columnheader"
70
- }, column.text)))), scene.matrix.rows.map((row) => rowStyled(h("div", {
71
- class: row.className,
72
- role: "row"
73
- }, h("span", {
74
- class: row.labelClassName,
75
- role: "rowheader"
76
- }, row.label, h("small", null, row.unit)), row.cells.map((cell) => h("span", {
77
- class: cell.className,
78
- role: "cell"
79
- }, cell.text)))))), h("p", { class: scene.note.className }, scene.note.text))));
54
+ }, scene.panel.map((child) => typeof child === "object" && child !== null ? renderScene(child) : child))));
80
55
  }
81
56
  };
82
57
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { measuredChartWidth } from "../../geometry.js";
2
- import { CLIMATOLOGY_PATTERN_CLASS, climatologyPatternGate, climatologyPatternScene } from "../../scene/climatology-pattern.js";
2
+ import { CLIMATOLOGY_PATTERN_CLASS, climatologyPatternScene, hasClimatology } from "../../scene/climatology-pattern.js";
3
3
  import { numberAttribute, parseMonthsAttribute } from "../lib/attributes.js";
4
4
  import { MeteoStationElement } from "../lib/base.js";
5
5
  import { h } from "../lib/h.js";
6
- import { dailyPatternSceneDom } from "./DailyPatternElement.js";
6
+ import { renderChildren } from "../lib/render.js";
7
7
  //#region src/elements/elements/ClimatologyDailyPatternElement.ts
8
8
  let hatchCounter = 0;
9
9
  var ClimatologyDailyPatternElement = class extends MeteoStationElement {
@@ -35,22 +35,27 @@ var ClimatologyDailyPatternElement = class extends MeteoStationElement {
35
35
  }
36
36
  render() {
37
37
  const { favorableDirections, thresholds, unit, words } = this.display();
38
- const gate = climatologyPatternGate(this.#document, words);
39
- if (gate.kind === "note") {
38
+ if (!hasClimatology(this.#document)) {
40
39
  this.#observer?.disconnect();
41
40
  this.#observer = null;
42
- this.replaceChildren(h("div", {
43
- class: gate.className,
44
- role: "note"
45
- }, gate.text));
41
+ this.replaceChildren(...renderChildren(climatologyPatternScene({
42
+ document: this.#document,
43
+ hatchId: "",
44
+ plotHeight: void 0,
45
+ stationName: void 0,
46
+ thresholds: void 0,
47
+ unit,
48
+ width: 0,
49
+ words
50
+ })));
46
51
  return;
47
52
  }
48
53
  const wrap = h("div", { class: CLIMATOLOGY_PATTERN_CLASS });
49
54
  this.replaceChildren(wrap);
50
55
  this.#observe(wrap);
51
56
  if (this.#width == null) return;
52
- const { caption, svg } = dailyPatternSceneDom(climatologyPatternScene({
53
- document: gate.document,
57
+ const scene = climatologyPatternScene({
58
+ document: this.#document,
54
59
  favorableDirections,
55
60
  filters: { months: parseMonthsAttribute(this.getAttribute("months")) },
56
61
  hatchId: `meteo-climatology-hatch-e${++hatchCounter}`,
@@ -60,8 +65,8 @@ var ClimatologyDailyPatternElement = class extends MeteoStationElement {
60
65
  unit,
61
66
  width: this.#width,
62
67
  words
63
- }));
64
- wrap.replaceChildren(caption, svg);
68
+ });
69
+ wrap.replaceChildren(...renderChildren(scene));
65
70
  }
66
71
  #observe(wrap) {
67
72
  this.#observer?.disconnect();