@azohra/meteo.station 0.5.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 (147) hide show
  1. package/README.md +17 -17
  2. package/dist/client/climatology.js +1 -1
  3. package/dist/client/history.js +3 -11
  4. package/dist/client/live.d.ts +2 -1
  5. package/dist/client/live.js +7 -4
  6. package/dist/client/stores.js +10 -2
  7. package/dist/climatology.d.ts +1 -1
  8. package/dist/climatology.js +1 -1
  9. package/dist/connectivity.d.ts +2 -2
  10. package/dist/contract.d.ts +98 -98
  11. package/dist/derive.js +9 -8
  12. package/dist/elements/elements/AirExtremesElement.js +5 -18
  13. package/dist/elements/elements/AirMatrixElement.js +6 -31
  14. package/dist/elements/elements/ClimatologyDailyPatternElement.js +17 -12
  15. package/dist/elements/elements/ClimatologyRoseElement.js +5 -15
  16. package/dist/elements/elements/CompassFanElement.js +5 -64
  17. package/dist/elements/elements/CurrentConditionsElement.js +7 -26
  18. package/dist/elements/elements/DailyPatternElement.d.ts +0 -1
  19. package/dist/elements/elements/DailyPatternElement.js +6 -120
  20. package/dist/elements/elements/DialElement.js +3 -95
  21. package/dist/elements/elements/FavorableShareElement.js +6 -21
  22. package/dist/elements/elements/RecentSummariesElement.js +6 -23
  23. package/dist/elements/elements/SparklineElement.d.ts +0 -1
  24. package/dist/elements/elements/SparklineElement.js +4 -39
  25. package/dist/elements/elements/StationCardElement.js +4 -18
  26. package/dist/elements/elements/StationFeedElement.js +4 -2
  27. package/dist/elements/elements/StationStripElement.js +4 -18
  28. package/dist/elements/elements/StationTableElement.js +15 -51
  29. package/dist/elements/elements/TrendChartElement.js +27 -94
  30. package/dist/elements/elements/WindHistoryChartElement.js +29 -189
  31. package/dist/elements/elements/WindRoseElement.d.ts +0 -1
  32. package/dist/elements/elements/WindRoseElement.js +6 -70
  33. package/dist/elements/elements/atoms.js +11 -38
  34. package/dist/elements/index.js +3 -3
  35. package/dist/elements/lib/fragments.js +8 -37
  36. package/dist/elements/lib/h.js +1 -1
  37. package/dist/elements/lib/pinned-cursor.js +48 -0
  38. package/dist/elements/lib/render.js +30 -0
  39. package/dist/fixtures.d.ts +6 -2
  40. package/dist/fixtures.js +30 -2
  41. package/dist/format.js +7 -3
  42. package/dist/geometry.d.ts +1 -1
  43. package/dist/geometry.js +22 -9
  44. package/dist/instruments.js +2 -2
  45. package/dist/react/components/AirExtremes.d.ts +1 -1
  46. package/dist/react/components/AirExtremes.js +5 -22
  47. package/dist/react/components/AirMatrix.js +10 -43
  48. package/dist/react/components/ClimatologyDailyPattern.d.ts +1 -1
  49. package/dist/react/components/ClimatologyDailyPattern.js +19 -13
  50. package/dist/react/components/ClimatologyRose.d.ts +1 -1
  51. package/dist/react/components/ClimatologyRose.js +11 -28
  52. package/dist/react/components/CompassFan.d.ts +1 -1
  53. package/dist/react/components/CompassFan.js +6 -73
  54. package/dist/react/components/CurrentConditions.d.ts +1 -1
  55. package/dist/react/components/CurrentConditions.js +11 -74
  56. package/dist/react/components/DailyPattern.d.ts +1 -3
  57. package/dist/react/components/DailyPattern.js +10 -149
  58. package/dist/react/components/Dial.d.ts +2 -3
  59. package/dist/react/components/Dial.js +5 -118
  60. package/dist/react/components/FavorableShare.d.ts +1 -1
  61. package/dist/react/components/FavorableShare.js +6 -27
  62. package/dist/react/components/FreshnessBadge.d.ts +1 -1
  63. package/dist/react/components/FreshnessBadge.js +5 -12
  64. package/dist/react/components/RecentSummaries.d.ts +1 -1
  65. package/dist/react/components/RecentSummaries.js +6 -44
  66. package/dist/react/components/SceneTree.js +38 -0
  67. package/dist/react/components/Sparkline.d.ts +1 -1
  68. package/dist/react/components/Sparkline.js +3 -39
  69. package/dist/react/components/StationCard.d.ts +2 -2
  70. package/dist/react/components/StationCard.js +5 -45
  71. package/dist/react/components/StationStrip.d.ts +1 -1
  72. package/dist/react/components/StationStrip.js +5 -60
  73. package/dist/react/components/StationTable.js +21 -75
  74. package/dist/react/components/TrendChart.js +13 -86
  75. package/dist/react/components/WindArrow.d.ts +1 -1
  76. package/dist/react/components/WindArrow.js +3 -15
  77. package/dist/react/components/WindHistoryChart.js +12 -205
  78. package/dist/react/components/WindRose.d.ts +1 -3
  79. package/dist/react/components/WindRose.js +6 -89
  80. package/dist/react/components/WindSampleStrip.js +14 -139
  81. package/dist/react/components/atoms.d.ts +5 -5
  82. package/dist/react/components/atoms.js +12 -48
  83. package/dist/react/hooks/useStation.js +28 -50
  84. package/dist/react/hooks/useStationCurrent.js +3 -2
  85. package/dist/react/hooks/useStationFeed.d.ts +0 -1
  86. package/dist/react/hooks/useStationFeed.js +3 -2
  87. package/dist/react/index.d.ts +2 -2
  88. package/dist/react/index.js +7 -7
  89. package/dist/react/lib/cells.js +4 -24
  90. package/dist/react/lib/use-pinned-cursor.js +32 -0
  91. package/dist/samples.js +7 -43
  92. package/dist/scene/air-extremes.js +12 -27
  93. package/dist/scene/air-matrix.js +45 -58
  94. package/dist/scene/card.js +14 -40
  95. package/dist/scene/cells.d.ts +4 -0
  96. package/dist/scene/cells.js +51 -0
  97. package/dist/scene/chart.js +2 -1
  98. package/dist/scene/climatology-pattern.d.ts +1 -2
  99. package/dist/scene/climatology-pattern.js +10 -11
  100. package/dist/scene/climatology-rose.d.ts +1 -2
  101. package/dist/scene/climatology-rose.js +14 -33
  102. package/dist/scene/compass-fan.js +28 -100
  103. package/dist/scene/current.d.ts +2 -1
  104. package/dist/scene/current.js +29 -56
  105. package/dist/scene/daily-pattern.d.ts +1 -3
  106. package/dist/scene/daily-pattern.js +20 -27
  107. package/dist/scene/dial-parts.d.ts +1 -0
  108. package/dist/scene/dial-parts.js +70 -0
  109. package/dist/scene/dial.d.ts +1 -2
  110. package/dist/scene/dial.js +48 -136
  111. package/dist/scene/favorable-share.js +16 -33
  112. package/dist/scene/glyphs.js +20 -16
  113. package/dist/scene/index.d.ts +5 -3
  114. package/dist/scene/node.js +19 -0
  115. package/dist/scene/recent-summaries.js +26 -66
  116. package/dist/scene/rose.js +89 -117
  117. package/dist/scene/sample-strip.d.ts +1 -2
  118. package/dist/scene/sample-strip.js +35 -36
  119. package/dist/scene/sparkline.js +31 -40
  120. package/dist/scene/strip.js +18 -57
  121. package/dist/scene/table.js +47 -69
  122. package/dist/scene/trend.d.ts +1 -2
  123. package/dist/scene/trend.js +29 -55
  124. package/dist/scene/wind-history.d.ts +1 -2
  125. package/dist/scene/wind-history.js +41 -51
  126. package/dist/scene/wind-plot.js +70 -140
  127. package/dist/server/adapters/campbell.d.ts +7 -7
  128. package/dist/server/adapters/campbell.js +1 -1
  129. package/dist/server/adapters/ecowitt.d.ts +8 -8
  130. package/dist/server/adapters/tempest.d.ts +6 -6
  131. package/dist/server/adapters/windnerd-climatology.js +4 -3
  132. package/dist/server/adapters/windnerd-live.js +3 -2
  133. package/dist/server/adapters/windnerd.d.ts +10 -11
  134. package/dist/server/adapters/windnerd.js +3 -13
  135. package/dist/server/config.d.ts +48 -48
  136. package/dist/server/hologram.js +2 -1
  137. package/dist/server/index.d.ts +2 -2
  138. package/dist/server/index.js +2 -2
  139. package/dist/windnerd.d.ts +3 -1
  140. package/dist/windnerd.js +11 -1
  141. package/package.json +7 -12
  142. package/schema/README.md +3 -3
  143. package/schema/stationclimatology.schema.json +64 -61
  144. package/schema/stationcurrent.schema.json +68 -156
  145. package/schema/stationfeed.schema.json +71 -163
  146. package/schema/stationhistory.schema.json +37 -46
  147. package/schema/stationlive.schema.json +221 -306
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { resolveDisplay } from "../../display.js";
3
3
  import { airMatrixScene } from "../../scene/air-matrix.js";
4
+ import { renderChildren } from "./SceneTree.js";
4
5
  import { requireResolved, useStationFeedContext } from "./StationFeedProvider.js";
5
6
  import { useId, useState } from "react";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -20,61 +21,27 @@ function AirMatrix({ stations: stationsProp, strings: stringsProp, formatTime: f
20
21
  words
21
22
  });
22
23
  if (scene == null) return null;
23
- const rowTemplate = { gridTemplateColumns: scene.matrix.gridTemplateColumns };
24
24
  return /* @__PURE__ */ jsxs("section", {
25
- className: scene.className,
25
+ className: "meteo-air",
26
26
  "data-expanded": expanded,
27
27
  children: [/* @__PURE__ */ jsxs("button", {
28
28
  "aria-controls": panelId,
29
29
  "aria-expanded": expanded,
30
- className: scene.trigger.className,
30
+ className: "meteo-air-trigger",
31
31
  onClick: () => setExpanded((current) => !current),
32
32
  type: "button",
33
33
  children: [/* @__PURE__ */ jsx("strong", {
34
- className: scene.trigger.title.className,
35
- children: scene.trigger.title.text
34
+ className: "meteo-air-title",
35
+ children: scene.title
36
36
  }), /* @__PURE__ */ jsx("span", {
37
- className: scene.trigger.summary.className,
38
- children: scene.trigger.summary.text
37
+ className: "meteo-air-summary",
38
+ children: scene.summary
39
39
  })]
40
- }), /* @__PURE__ */ jsxs("div", {
41
- className: scene.panelClassName,
40
+ }), /* @__PURE__ */ jsx("div", {
41
+ className: "meteo-air-panel",
42
42
  hidden: !expanded,
43
43
  id: panelId,
44
- children: [/* @__PURE__ */ jsxs("div", {
45
- "aria-label": scene.matrix.ariaLabel,
46
- className: scene.matrix.className,
47
- role: "table",
48
- children: [/* @__PURE__ */ jsxs("div", {
49
- className: scene.matrix.head.className,
50
- role: "row",
51
- style: rowTemplate,
52
- children: [/* @__PURE__ */ jsx("span", {
53
- className: scene.matrix.head.corner.className,
54
- role: "columnheader"
55
- }), scene.matrix.head.columns.map((column) => /* @__PURE__ */ jsx("span", {
56
- className: scene.matrix.head.columnClassName,
57
- role: "columnheader",
58
- children: column.text
59
- }, column.key))]
60
- }), scene.matrix.rows.map((row) => /* @__PURE__ */ jsxs("div", {
61
- className: row.className,
62
- role: "row",
63
- style: rowTemplate,
64
- children: [/* @__PURE__ */ jsxs("span", {
65
- className: row.labelClassName,
66
- role: "rowheader",
67
- children: [row.label, /* @__PURE__ */ jsx("small", { children: row.unit })]
68
- }), row.cells.map((cell) => /* @__PURE__ */ jsx("span", {
69
- className: cell.className,
70
- role: "cell",
71
- children: cell.text
72
- }, cell.key))]
73
- }, row.key))]
74
- }), /* @__PURE__ */ jsx("p", {
75
- className: scene.note.className,
76
- children: scene.note.text
77
- })]
44
+ children: renderChildren(scene.panel)
78
45
  })]
79
46
  });
80
47
  }
@@ -15,6 +15,6 @@ declare function ClimatologyDailyPattern({ document, months, favorableDirections
15
15
  plotHeight?: number;
16
16
  stationName?: string;
17
17
  strings?: StationStringOverrides;
18
- }): import("react").JSX.Element;
18
+ }): string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
19
19
  //#endregion
20
20
  export { ClimatologyDailyPattern };
@@ -1,16 +1,17 @@
1
1
  "use client";
2
2
  import { resolveDisplay } from "../../display.js";
3
3
  import { measuredChartWidth } from "../../geometry.js";
4
- import { CLIMATOLOGY_PATTERN_CLASS, climatologyPatternGate, climatologyPatternScene } from "../../scene/climatology-pattern.js";
4
+ import { CLIMATOLOGY_PATTERN_CLASS, climatologyPatternScene, hasClimatology } from "../../scene/climatology-pattern.js";
5
+ import { renderChildren } from "./SceneTree.js";
5
6
  import { useStationFeedContext } from "./StationFeedProvider.js";
6
- import { DailyPatternSceneView } from "./DailyPattern.js";
7
7
  import { useEffect, useId, useRef, useState } from "react";
8
8
  import { jsx } from "react/jsx-runtime";
9
9
  //#region src/react/components/ClimatologyDailyPattern.tsx
10
10
  /** The cube's typical day through the daily-pattern drawing, month-filtered
11
11
  * client-side. The host owns the document and the filters. */
12
12
  function ClimatologyDailyPattern({ document, months, favorableDirections: favorableDirectionsProp, thresholds: thresholdsProp, unit: unitProp, plotHeight, stationName, strings: stringsProp }) {
13
- const { favorableDirections, thresholds, unit, words } = resolveDisplay(useStationFeedContext(), {
13
+ const context = useStationFeedContext();
14
+ const { favorableDirections, thresholds, unit, words } = resolveDisplay(context, {
14
15
  strings: stringsProp,
15
16
  thresholds: thresholdsProp,
16
17
  favorableDirections: favorableDirectionsProp,
@@ -19,7 +20,7 @@ function ClimatologyDailyPattern({ document, months, favorableDirections: favora
19
20
  const wrapRef = useRef(null);
20
21
  const [width, setWidth] = useState(null);
21
22
  const hatchId = `meteo-climatology-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
22
- const gate = climatologyPatternGate(document, words);
23
+ const drawable = hasClimatology(document);
23
24
  useEffect(() => {
24
25
  const element = wrapRef.current;
25
26
  if (!element) return;
@@ -32,17 +33,22 @@ function ClimatologyDailyPattern({ document, months, favorableDirections: favora
32
33
  });
33
34
  observer.observe(element);
34
35
  return () => observer.disconnect();
35
- }, [gate.kind === "draw"]);
36
- if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
37
- className: gate.className,
38
- role: "note",
39
- children: gate.text
40
- });
36
+ }, [drawable]);
37
+ if (!drawable) return renderChildren(climatologyPatternScene({
38
+ document,
39
+ hatchId,
40
+ plotHeight,
41
+ stationName,
42
+ thresholds,
43
+ unit,
44
+ width: 0,
45
+ words
46
+ }));
41
47
  return /* @__PURE__ */ jsx("div", {
42
48
  className: CLIMATOLOGY_PATTERN_CLASS,
43
49
  ref: wrapRef,
44
- children: width != null && /* @__PURE__ */ jsx(DailyPatternSceneView, { scene: climatologyPatternScene({
45
- document: gate.document,
50
+ children: width != null && renderChildren(climatologyPatternScene({
51
+ document,
46
52
  favorableDirections,
47
53
  filters: { months },
48
54
  hatchId,
@@ -52,7 +58,7 @@ function ClimatologyDailyPattern({ document, months, favorableDirections: favora
52
58
  unit,
53
59
  width,
54
60
  words
55
- }) })
61
+ }))
56
62
  });
57
63
  }
58
64
  //#endregion
@@ -13,6 +13,6 @@ declare function ClimatologyRose({ document, months, slots, favorableDirections:
13
13
  favorableDirections?: FavorableDirection[] | null;
14
14
  stationName?: string;
15
15
  strings?: StationStringOverrides;
16
- }): import("react").JSX.Element;
16
+ }): import("react").ReactNode;
17
17
  //#endregion
18
18
  export { ClimatologyRose };
@@ -1,45 +1,28 @@
1
1
  "use client";
2
2
  import { resolveDisplay } from "../../display.js";
3
- import { climatologyRoseGate, climatologyRoseScene } from "../../scene/climatology-rose.js";
3
+ import { climatologyRoseScene } from "../../scene/climatology-rose.js";
4
+ import { renderScene } from "./SceneTree.js";
4
5
  import { useStationFeedContext } from "./StationFeedProvider.js";
5
- import { WindRoseSceneView } from "./WindRose.js";
6
- import { jsx } from "react/jsx-runtime";
7
6
  //#region src/react/components/ClimatologyRose.tsx
8
7
  /** The whole archive as a stacked rose: the cube's sectors, each wedge split
9
8
  * by the document's own thresholds, with the honesty captions beneath. The
10
9
  * host owns the document (a fetch-once store) and the filters. */
11
10
  function ClimatologyRose({ document, months, slots, favorableDirections: favorableDirectionsProp, stationName, strings: stringsProp }) {
12
- const { favorableDirections, words } = resolveDisplay(useStationFeedContext(), {
11
+ const context = useStationFeedContext();
12
+ const { favorableDirections, words } = resolveDisplay(context, {
13
13
  strings: stringsProp,
14
14
  favorableDirections: favorableDirectionsProp
15
15
  });
16
- const gate = climatologyRoseGate(document, words);
17
- if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
18
- className: gate.className,
19
- role: "note",
20
- children: gate.text
21
- });
22
- const filters = {
23
- months,
24
- slots
25
- };
26
- const scene = climatologyRoseScene({
27
- document: gate.document,
16
+ return renderScene(climatologyRoseScene({
17
+ document,
28
18
  favorableDirections,
29
- filters,
19
+ filters: {
20
+ months,
21
+ slots
22
+ },
30
23
  stationName,
31
24
  words
32
- });
33
- return /* @__PURE__ */ jsx("div", {
34
- className: scene.className,
35
- children: /* @__PURE__ */ jsx(WindRoseSceneView, {
36
- scene: scene.rose,
37
- children: scene.captions.map((caption) => /* @__PURE__ */ jsx("p", {
38
- className: caption.className,
39
- children: caption.text
40
- }, caption.key))
41
- })
42
- });
25
+ }));
43
26
  }
44
27
  //#endregion
45
28
  export { ClimatologyRose };
@@ -12,6 +12,6 @@ declare function CompassFan({ samples, station: stationProp, stationId, favorabl
12
12
  stationId?: string;
13
13
  favorableDirections?: FavorableDirection[] | null;
14
14
  strings?: StationStringOverrides;
15
- }): import("react").JSX.Element | null;
15
+ }): import("react").ReactNode;
16
16
  //#endregion
17
17
  export { CompassFan };
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { resolveDisplay } from "../../display.js";
3
- import { compassFanGate, compassFanScene, compassFanSource } from "../../scene/compass-fan.js";
3
+ import { compassFanScene, compassFanSource } from "../../scene/compass-fan.js";
4
+ import { renderOptional } from "./SceneTree.js";
4
5
  import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/react/components/CompassFan.tsx
7
7
  /** The live compass: the newest sample as the solid needle, every sample of
8
8
  * the rolling window as a faint fan aged by tenth — a tight fan means
@@ -14,80 +14,13 @@ function CompassFan({ samples, station: stationProp, stationId, favorableDirecti
14
14
  strings: stringsProp,
15
15
  favorableDirections: favorableDirectionsProp
16
16
  });
17
- const gate = compassFanGate(compassFanSource(samples, station), station, words);
18
- if (gate.kind === "hidden") return null;
19
- if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
20
- className: gate.className,
21
- role: "note",
22
- children: gate.text
23
- });
24
- const scene = compassFanScene({
17
+ return renderOptional(compassFanScene({
25
18
  favorableDirections,
26
- samples: gate.samples,
19
+ samples: compassFanSource(samples, station),
20
+ station,
27
21
  stationName: station?.name,
28
22
  words
29
- });
30
- return /* @__PURE__ */ jsxs("svg", {
31
- "aria-label": scene.svg.ariaLabel,
32
- className: scene.svg.className,
33
- height: scene.svg.height,
34
- role: "img",
35
- viewBox: scene.svg.viewBox,
36
- width: scene.svg.width,
37
- children: [
38
- /* @__PURE__ */ jsx("circle", {
39
- className: scene.ring.className,
40
- cx: scene.ring.cx,
41
- cy: scene.ring.cy,
42
- r: scene.ring.r
43
- }),
44
- scene.verdictRing && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
45
- className: scene.verdictRing.unfavorable.className,
46
- cx: scene.verdictRing.unfavorable.cx,
47
- cy: scene.verdictRing.unfavorable.cy,
48
- r: scene.verdictRing.unfavorable.r
49
- }), scene.verdictRing.favorable.map((arc) => /* @__PURE__ */ jsx("path", {
50
- className: arc.className,
51
- d: arc.d
52
- }, arc.key))] }),
53
- scene.ticks.map((tick) => /* @__PURE__ */ jsx("line", {
54
- className: tick.className,
55
- x1: tick.x1,
56
- x2: tick.x2,
57
- y1: tick.y1,
58
- y2: tick.y2
59
- }, tick.key)),
60
- scene.letters.map((letter) => /* @__PURE__ */ jsx("text", {
61
- className: letter.className,
62
- textAnchor: letter.anchor,
63
- x: letter.x,
64
- y: letter.y,
65
- children: letter.text
66
- }, letter.key)),
67
- scene.ghosts.map((ghost) => /* @__PURE__ */ jsx("path", {
68
- className: ghost.className,
69
- d: ghost.d
70
- }, ghost.key)),
71
- scene.needle && /* @__PURE__ */ jsxs("g", {
72
- className: scene.needle.className,
73
- children: [/* @__PURE__ */ jsx("polygon", {
74
- className: scene.needle.blade.className,
75
- points: scene.needle.blade.points
76
- }), /* @__PURE__ */ jsx("circle", {
77
- className: scene.needle.counterweight.className,
78
- cx: scene.needle.counterweight.cx,
79
- cy: scene.needle.counterweight.cy,
80
- r: scene.needle.counterweight.r
81
- })]
82
- }),
83
- /* @__PURE__ */ jsx("circle", {
84
- className: scene.hub.className,
85
- cx: scene.hub.cx,
86
- cy: scene.hub.cy,
87
- r: scene.hub.r
88
- })
89
- ]
90
- });
23
+ }));
91
24
  }
92
25
  //#endregion
93
26
  export { CompassFan };
@@ -12,6 +12,6 @@ declare function CurrentConditions({ station: stationProp, stationId, servedAt:
12
12
  unit?: SpeedUnit;
13
13
  strings?: StationStringOverrides;
14
14
  formatTime?: FormatTime;
15
- }): import("react").JSX.Element;
15
+ }): import("react").ReactNode;
16
16
  //#endregion
17
17
  export { CurrentConditions };
@@ -2,97 +2,34 @@
2
2
  import { stationFreshnessThresholds } from "../../derive.js";
3
3
  import { resolveDisplay } from "../../display.js";
4
4
  import { currentConditionsScene } from "../../scene/current.js";
5
+ import { renderScene } from "./SceneTree.js";
5
6
  import { requireResolved, resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
6
- import { WindArrow } from "./WindArrow.js";
7
7
  import { useFreshness } from "../hooks/useFreshness.js";
8
- import { Dial } from "./Dial.js";
9
- import { FreshnessBadge } from "./FreshnessBadge.js";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { useId } from "react";
11
9
  //#region src/react/components/CurrentConditions.tsx
12
10
  function CurrentConditions({ station: stationProp, stationId, servedAt: servedAtProp, receivedAtMs: receivedAtMsProp, thresholds: thresholdsProp, unit: unitProp, strings: stringsProp, formatTime: formatTimeProp }) {
13
11
  const context = useStationFeedContext();
12
+ const bezelId = useId();
14
13
  const station = requireResolved("CurrentConditions", "station", stationProp ?? resolveStation(context, stationId));
15
14
  const servedAt = servedAtProp ?? context?.feed?.servedAt ?? null;
16
15
  const receivedAtMs = receivedAtMsProp !== void 0 ? receivedAtMsProp : context?.receivedAtMs ?? null;
17
- const { formatTime, strings, thresholds, unit, words } = resolveDisplay(context, {
16
+ const { formatTime, thresholds, unit, words } = resolveDisplay(context, {
18
17
  formatTime: formatTimeProp,
19
18
  strings: stringsProp,
20
19
  thresholds: thresholdsProp,
21
20
  unit: unitProp
22
21
  });
23
- const status = useFreshness((station.status === "ok" ? station.reading : null)?.observedAt ?? null, servedAt, receivedAtMs, stationFreshnessThresholds(station));
24
- const scene = currentConditionsScene({
22
+ const reading = station.status === "ok" ? station.reading : null;
23
+ const status = useFreshness(reading?.observedAt ?? null, servedAt, receivedAtMs, stationFreshnessThresholds(station));
24
+ return renderScene(currentConditionsScene({
25
+ bezelId: `meteo-bezel-${bezelId.replace(/[^a-zA-Z0-9_-]/g, "")}`,
25
26
  formatTime,
27
+ freshness: status,
26
28
  station,
29
+ thresholds,
27
30
  unit,
28
31
  words
29
- });
30
- const { direction, temperature, footer } = scene;
31
- return /* @__PURE__ */ jsxs("div", {
32
- "aria-label": scene.root.ariaLabel,
33
- className: scene.root.className,
34
- "data-status": scene.root.status,
35
- role: "group",
36
- children: [
37
- /* @__PURE__ */ jsxs("div", {
38
- className: scene.instrumentClassName,
39
- children: [
40
- scene.flanks && /* @__PURE__ */ jsxs("div", {
41
- className: scene.flanks.lull.className,
42
- children: [/* @__PURE__ */ jsx("small", {
43
- className: scene.flanks.lull.labelClassName,
44
- children: scene.flanks.lull.label
45
- }), /* @__PURE__ */ jsx("strong", { children: scene.flanks.lull.value })]
46
- }),
47
- /* @__PURE__ */ jsx(Dial, {
48
- calmWord: false,
49
- station,
50
- strings,
51
- thresholds: thresholds ?? null,
52
- unit
53
- }),
54
- scene.flanks && /* @__PURE__ */ jsxs("div", {
55
- className: scene.flanks.gust.className,
56
- children: [/* @__PURE__ */ jsx("small", {
57
- className: scene.flanks.gust.labelClassName,
58
- children: scene.flanks.gust.label
59
- }), /* @__PURE__ */ jsx("strong", { children: scene.flanks.gust.value })]
60
- })
61
- ]
62
- }),
63
- /* @__PURE__ */ jsx("p", {
64
- className: direction.className,
65
- children: direction.content.kind === "text" ? direction.content.text : /* @__PURE__ */ jsxs(Fragment, { children: [
66
- /* @__PURE__ */ jsx("span", {
67
- className: direction.content.labelClassName,
68
- children: direction.content.label
69
- }),
70
- " ",
71
- /* @__PURE__ */ jsx(WindArrow, { deg: direction.content.deg }),
72
- " ",
73
- /* @__PURE__ */ jsx("strong", { children: direction.content.compass }),
74
- direction.content.tail
75
- ] })
76
- }),
77
- temperature && /* @__PURE__ */ jsxs("p", {
78
- className: temperature.className,
79
- children: [temperature.text, temperature.chill && /* @__PURE__ */ jsx("span", {
80
- className: temperature.chill.className,
81
- children: temperature.chill.text
82
- })]
83
- }),
84
- /* @__PURE__ */ jsxs("p", {
85
- className: footer.className,
86
- children: [status != null && /* @__PURE__ */ jsx(FreshnessBadge, {
87
- status,
88
- strings
89
- }), /* @__PURE__ */ jsx("span", {
90
- className: footer.observed.className,
91
- children: footer.observed.text
92
- })]
93
- })
94
- ]
95
- });
32
+ }));
96
33
  }
97
34
  //#endregion
98
35
  export { CurrentConditions };
@@ -1,10 +1,8 @@
1
1
  import { HistoryPoint, Station } from "../../contract.js";
2
- import { SpeedThresholds, SpeedUnit, compassDirection } from "../../derive.js";
2
+ import { SpeedThresholds, SpeedUnit } from "../../derive.js";
3
3
  import { StationStringOverrides } from "../../strings.js";
4
4
  import { FavorableDirection } from "../../instruments.js";
5
5
  import "../../index.js";
6
- import "../../scene/index.js";
7
- import { WindArrow } from "./WindArrow.js";
8
6
  //#region src/react/components/DailyPattern.d.ts
9
7
  declare function DailyPattern({ station: stationProp, stationId, points, slotMinutes, utcOffsetMinutes, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, strings: stringsProp }: {
10
8
  station?: Station;
@@ -1,12 +1,11 @@
1
1
  "use client";
2
- import "../../derive.js";
3
2
  import { resolveDisplay } from "../../display.js";
4
3
  import { measuredChartWidth } from "../../geometry.js";
5
4
  import { DAILY_PATTERN_CLASS, dailyPatternGate, dailyPatternScene, dailyPatternSource } from "../../scene/daily-pattern.js";
5
+ import { renderChildren } from "./SceneTree.js";
6
6
  import { resolveStation, useStationFeedContext } from "./StationFeedProvider.js";
7
- import "./WindArrow.js";
8
7
  import { useEffect, useId, useRef, useState } from "react";
9
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { jsx } from "react/jsx-runtime";
10
9
  //#region src/react/components/DailyPattern.tsx
11
10
  function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 180, utcOffsetMinutes = 0, thresholds: thresholdsProp, favorableDirections: favorableDirectionsProp, unit: unitProp, plotHeight, strings: stringsProp }) {
12
11
  const context = useStationFeedContext();
@@ -21,6 +20,7 @@ function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 1
21
20
  const [width, setWidth] = useState(null);
22
21
  const { source, periodMinutes } = dailyPatternSource(points, station);
23
22
  const gate = dailyPatternGate(source, words);
23
+ const drawable = gate.kind === "draw";
24
24
  useEffect(() => {
25
25
  const element = wrapRef.current;
26
26
  if (!element) return;
@@ -33,7 +33,7 @@ function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 1
33
33
  });
34
34
  observer.observe(element);
35
35
  return () => observer.disconnect();
36
- }, [gate.kind === "draw"]);
36
+ }, [drawable]);
37
37
  if (gate.kind === "note") return /* @__PURE__ */ jsx("div", {
38
38
  className: gate.className,
39
39
  role: "note",
@@ -58,9 +58,10 @@ function DailyPattern({ station: stationProp, stationId, points, slotMinutes = 1
58
58
  });
59
59
  }
60
60
  function MeasuredDailyPattern({ favorableDirections, periodMinutes, plotHeight, points, slotMinutes, stationName, thresholds, unit, utcOffsetMinutes, width, words }) {
61
- return /* @__PURE__ */ jsx(DailyPatternSceneView, { scene: dailyPatternScene({
61
+ const hatchId = `meteo-daily-pattern-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
62
+ const scene = dailyPatternScene({
62
63
  favorableDirections,
63
- hatchId: `meteo-daily-pattern-hatch-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`,
64
+ hatchId,
64
65
  periodMinutes,
65
66
  plotHeight,
66
67
  points,
@@ -71,148 +72,8 @@ function MeasuredDailyPattern({ favorableDirections, periodMinutes, plotHeight,
71
72
  utcOffsetMinutes,
72
73
  width,
73
74
  words
74
- }) });
75
- }
76
- /** One scene, one drawing — shared by the history-fed pattern above and the
77
- * climatology-fed twin. */
78
- function DailyPatternSceneView({ scene }) {
79
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("output", {
80
- className: scene.caption.className,
81
- children: scene.caption.text
82
- }), /* @__PURE__ */ jsxs("svg", {
83
- "aria-label": scene.svg.ariaLabel,
84
- className: scene.svg.className,
85
- height: scene.svg.height,
86
- role: "img",
87
- viewBox: scene.svg.viewBox,
88
- width: scene.svg.width,
89
- children: [
90
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", {
91
- height: scene.defs.pattern.height,
92
- id: scene.defs.pattern.id,
93
- patternTransform: scene.defs.pattern.transform,
94
- patternUnits: scene.defs.pattern.units,
95
- width: scene.defs.pattern.width,
96
- children: /* @__PURE__ */ jsx("line", {
97
- className: scene.defs.pattern.line.className,
98
- x1: scene.defs.pattern.line.x1,
99
- x2: scene.defs.pattern.line.x2,
100
- y1: scene.defs.pattern.line.y1,
101
- y2: scene.defs.pattern.line.y2
102
- })
103
- }) }),
104
- scene.zones.map((zone) => /* @__PURE__ */ jsx("rect", {
105
- className: zone.className,
106
- height: zone.height,
107
- width: zone.width,
108
- x: zone.x,
109
- y: zone.y
110
- }, zone.key)),
111
- scene.grid.map(({ key, line, label }) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
112
- className: line.className,
113
- x1: line.x1,
114
- x2: line.x2,
115
- y1: line.y1,
116
- y2: line.y2
117
- }), /* @__PURE__ */ jsx("text", {
118
- className: label.className,
119
- textAnchor: label.anchor,
120
- x: label.x,
121
- y: label.y,
122
- children: label.text
123
- })] }, key)),
124
- scene.thresholdGuides.map(({ key, line, label }) => /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("line", {
125
- className: line.className,
126
- x1: line.x1,
127
- x2: line.x2,
128
- y1: line.y1,
129
- y2: line.y2
130
- }), /* @__PURE__ */ jsx("text", {
131
- className: label.className,
132
- textAnchor: label.anchor,
133
- x: label.x,
134
- y: label.y,
135
- children: label.text
136
- })] }, key)),
137
- scene.vaneGuides.map((guide) => /* @__PURE__ */ jsx("line", {
138
- className: guide.className,
139
- x1: guide.x1,
140
- x2: guide.x2,
141
- y1: guide.y1,
142
- y2: guide.y2
143
- }, `guide-${guide.key}`)),
144
- scene.gaps.map((gap) => /* @__PURE__ */ jsx("rect", {
145
- className: gap.className,
146
- fill: gap.fill,
147
- height: gap.height,
148
- width: gap.width,
149
- x: gap.x,
150
- y: gap.y
151
- }, gap.key)),
152
- scene.mean.kind === "polyline" ? /* @__PURE__ */ jsx("polyline", {
153
- className: scene.mean.className,
154
- points: scene.mean.points
155
- }) : scene.mean.segments.map((segment) => /* @__PURE__ */ jsx("line", {
156
- className: segment.className,
157
- x1: segment.x1,
158
- x2: segment.x2,
159
- y1: segment.y1,
160
- y2: segment.y2
161
- }, segment.key)),
162
- scene.calmNote && /* @__PURE__ */ jsx("text", {
163
- className: scene.calmNote.className,
164
- textAnchor: scene.calmNote.anchor,
165
- x: scene.calmNote.x,
166
- y: scene.calmNote.y,
167
- children: scene.calmNote.text
168
- }),
169
- /* @__PURE__ */ jsx("text", {
170
- className: scene.rowLabels.to.className,
171
- textAnchor: scene.rowLabels.to.anchor,
172
- x: scene.rowLabels.to.x,
173
- y: scene.rowLabels.to.y,
174
- children: scene.rowLabels.to.text
175
- }),
176
- scene.vanes.map((vane) => vane.mark.kind === "calm" ? /* @__PURE__ */ jsx("text", {
177
- className: vane.mark.text.className,
178
- textAnchor: vane.mark.text.anchor,
179
- x: vane.mark.text.x,
180
- y: vane.mark.text.y,
181
- children: vane.mark.text.text
182
- }, vane.key) : /* @__PURE__ */ jsx("path", {
183
- className: vane.mark.className,
184
- d: vane.mark.d
185
- }, vane.key)),
186
- scene.vanes.map((vane) => vane.label && /* @__PURE__ */ jsx("text", {
187
- className: vane.label.className,
188
- textAnchor: vane.label.anchor,
189
- x: vane.label.x,
190
- y: vane.label.y,
191
- children: vane.label.text
192
- }, `label-${vane.key}`)),
193
- /* @__PURE__ */ jsx("text", {
194
- className: scene.rowLabels.avg.className,
195
- textAnchor: scene.rowLabels.avg.anchor,
196
- x: scene.rowLabels.avg.x,
197
- y: scene.rowLabels.avg.y,
198
- children: scene.rowLabels.avg.text
199
- }),
200
- scene.vanes.map((vane) => vane.value && /* @__PURE__ */ jsx("text", {
201
- className: vane.value.className,
202
- textAnchor: vane.value.anchor,
203
- x: vane.value.x,
204
- y: vane.value.y,
205
- children: vane.value.text
206
- }, `value-${vane.key}`)),
207
- scene.ticks.map((tick) => /* @__PURE__ */ jsx("text", {
208
- className: tick.className,
209
- textAnchor: tick.anchor,
210
- x: tick.x,
211
- y: tick.y,
212
- children: tick.text
213
- }, tick.key))
214
- ]
215
- })] });
75
+ });
76
+ return renderChildren(scene);
216
77
  }
217
78
  //#endregion
218
- export { DailyPattern, DailyPatternSceneView };
79
+ export { DailyPattern };
@@ -1,6 +1,6 @@
1
1
  import { Station } from "../../contract.js";
2
2
  import { SpeedThresholds, SpeedUnit } from "../../derive.js";
3
- import { FormatTime, StationStringOverrides } from "../../strings.js";
3
+ import { StationStringOverrides } from "../../strings.js";
4
4
  import { FavorableDirection } from "../../instruments.js";
5
5
  import "../../index.js";
6
6
  //#region src/react/components/Dial.d.ts
@@ -13,7 +13,6 @@ declare function Dial({ station: stationProp, stationId, thresholds: thresholdsP
13
13
  size?: number;
14
14
  calmWord?: boolean;
15
15
  strings?: StationStringOverrides;
16
- formatTime?: FormatTime;
17
- }): import("react").JSX.Element;
16
+ }): import("react").ReactNode;
18
17
  //#endregion
19
18
  export { Dial };