@justanarthur/modo-ui-notch 0.0.0-stage → 0.3.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 (141) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -2
  3. package/blocks/activities/agenda/examples.mdx +74 -0
  4. package/blocks/activities/agenda/index.tsx +441 -0
  5. package/blocks/activities/clock/examples.mdx +73 -0
  6. package/blocks/activities/clock/index.tsx +619 -0
  7. package/blocks/activities/now-playing/examples.mdx +68 -0
  8. package/blocks/activities/now-playing/index.tsx +411 -0
  9. package/blocks/activities/weather/examples.mdx +115 -0
  10. package/blocks/activities/weather/index.tsx +634 -0
  11. package/blocks/app/expanded-island/examples.mdx +46 -0
  12. package/blocks/app/expanded-island/index.tsx +143 -0
  13. package/blocks/app/settings-window/examples.mdx +34 -0
  14. package/blocks/app/settings-window/index.tsx +375 -0
  15. package/blocks/system/clipboard/examples.mdx +83 -0
  16. package/blocks/system/clipboard/index.tsx +563 -0
  17. package/blocks/system/recent-files/examples.mdx +66 -0
  18. package/blocks/system/recent-files/index.tsx +542 -0
  19. package/blocks/system/system-stats/examples.mdx +52 -0
  20. package/blocks/system/system-stats/index.tsx +312 -0
  21. package/components/indicators/countdown/examples.mdx +25 -0
  22. package/components/indicators/countdown/index.tsx +83 -0
  23. package/components/indicators/equalizer/examples.mdx +20 -0
  24. package/components/indicators/equalizer/index.tsx +116 -0
  25. package/components/indicators/media-scrubber/examples.mdx +29 -0
  26. package/components/indicators/media-scrubber/index.tsx +122 -0
  27. package/components/island/island/examples.mdx +57 -0
  28. package/components/island/island/index.tsx +415 -0
  29. package/components/island/island-flash/examples.mdx +52 -0
  30. package/components/island/island-flash/index.tsx +79 -0
  31. package/components/island/island-tabs/examples.mdx +53 -0
  32. package/components/island/island-tabs/index.tsx +285 -0
  33. package/components/island/widget/examples.mdx +76 -0
  34. package/components/island/widget/index.tsx +431 -0
  35. package/dist/blocks/activities/agenda/index.d.ts +2 -0
  36. package/dist/blocks/activities/agenda/index.js +21 -0
  37. package/dist/blocks/activities/clock/index.d.ts +2 -0
  38. package/dist/blocks/activities/clock/index.js +25 -0
  39. package/dist/blocks/activities/now-playing/index.d.ts +3 -0
  40. package/dist/blocks/activities/now-playing/index.js +24 -0
  41. package/dist/blocks/activities/weather/index.d.ts +2 -0
  42. package/dist/blocks/activities/weather/index.js +21 -0
  43. package/dist/blocks/app/expanded-island/index.d.ts +3 -0
  44. package/dist/blocks/app/expanded-island/index.js +11 -0
  45. package/dist/blocks/app/settings-window/index.d.ts +2 -0
  46. package/dist/blocks/app/settings-window/index.js +7 -0
  47. package/dist/blocks/system/clipboard/index.d.ts +2 -0
  48. package/dist/blocks/system/clipboard/index.js +17 -0
  49. package/dist/blocks/system/recent-files/index.d.ts +2 -0
  50. package/dist/blocks/system/recent-files/index.js +19 -0
  51. package/dist/blocks/system/system-stats/index.d.ts +2 -0
  52. package/dist/blocks/system/system-stats/index.js +15 -0
  53. package/dist/components/indicators/countdown/index.d.ts +2 -0
  54. package/dist/components/indicators/countdown/index.js +8 -0
  55. package/dist/components/indicators/equalizer/index.d.ts +2 -0
  56. package/dist/components/indicators/equalizer/index.js +7 -0
  57. package/dist/components/indicators/media-scrubber/index.d.ts +2 -0
  58. package/dist/components/indicators/media-scrubber/index.js +8 -0
  59. package/dist/components/island/island/index.d.ts +3 -0
  60. package/dist/components/island/island/index.js +10 -0
  61. package/dist/components/island/island-flash/index.d.ts +2 -0
  62. package/dist/components/island/island-flash/index.js +7 -0
  63. package/dist/components/island/island-tabs/index.d.ts +2 -0
  64. package/dist/components/island/island-tabs/index.js +9 -0
  65. package/dist/components/island/widget/index.d.ts +2 -0
  66. package/dist/components/island/widget/index.js +30 -0
  67. package/dist/index.d.ts +21 -0
  68. package/dist/index.js +195 -0
  69. package/dist/lib/artwork.d.ts +2 -0
  70. package/dist/lib/artwork.js +8 -0
  71. package/dist/lib/clock.d.ts +2 -0
  72. package/dist/lib/clock.js +14 -0
  73. package/dist/lib/geometry.d.ts +2 -0
  74. package/dist/lib/geometry.js +24 -0
  75. package/dist/lib/island-context.d.ts +3 -0
  76. package/dist/lib/island-context.js +8 -0
  77. package/dist/lib/motion.d.ts +21 -0
  78. package/dist/lib/motion.js +16 -0
  79. package/dist/shared/chunk-152gpyq3.d.ts +13 -0
  80. package/dist/shared/chunk-2818esrq.d.ts +140 -0
  81. package/dist/shared/chunk-2f7zxrbk.js +65 -0
  82. package/dist/shared/chunk-2m5dz8nf.d.ts +88 -0
  83. package/dist/shared/chunk-2s4q6mt0.js +27 -0
  84. package/dist/shared/chunk-3thgcfcq.d.ts +151 -0
  85. package/dist/shared/chunk-416tsgbc.d.ts +175 -0
  86. package/dist/shared/chunk-502rmtap.js +54 -0
  87. package/dist/shared/chunk-52gb3g6r.d.ts +12 -0
  88. package/dist/shared/chunk-5en5aaj1.d.ts +33 -0
  89. package/dist/shared/chunk-61t2dfte.js +63 -0
  90. package/dist/shared/chunk-7fvnrtz4.d.ts +105 -0
  91. package/dist/shared/chunk-81fpptwp.d.ts +75 -0
  92. package/dist/shared/chunk-9c7ewvkk.js +381 -0
  93. package/dist/shared/chunk-9m0xbg5v.js +112 -0
  94. package/dist/shared/chunk-9xtcv3sy.js +88 -0
  95. package/dist/shared/chunk-bvtyjcce.d.ts +123 -0
  96. package/dist/shared/chunk-cc9nwbtf.js +315 -0
  97. package/dist/shared/chunk-cfzmfnyh.d.ts +63 -0
  98. package/dist/shared/chunk-d5qm9cps.js +10 -0
  99. package/dist/shared/chunk-da177e8r.d.ts +114 -0
  100. package/dist/shared/chunk-fexwzycv.d.ts +36 -0
  101. package/dist/shared/chunk-gb56m10p.js +39 -0
  102. package/dist/shared/chunk-gejenfap.d.ts +25 -0
  103. package/dist/shared/chunk-hrpxbqmx.d.ts +28 -0
  104. package/dist/shared/chunk-j755a1a5.d.ts +41 -0
  105. package/dist/shared/chunk-j77cx8dp.js +498 -0
  106. package/dist/shared/chunk-mt0k6v8x.js +474 -0
  107. package/dist/shared/chunk-ndf79pv5.js +58 -0
  108. package/dist/shared/chunk-pfhy5e4q.d.ts +53 -0
  109. package/dist/shared/chunk-qdzemt2v.js +477 -0
  110. package/dist/shared/chunk-r471sknr.js +209 -0
  111. package/dist/shared/chunk-s2jeqqan.js +243 -0
  112. package/dist/shared/chunk-t0hcxh89.d.ts +124 -0
  113. package/dist/shared/chunk-w48eyvfr.d.ts +56 -0
  114. package/dist/shared/chunk-w5h6ay93.js +72 -0
  115. package/dist/shared/chunk-wkg17nxs.d.ts +101 -0
  116. package/dist/shared/chunk-x7f3g82r.js +285 -0
  117. package/dist/shared/chunk-xq5hc5gv.js +333 -0
  118. package/dist/shared/chunk-y0188bbn.js +331 -0
  119. package/dist/shared/chunk-ym0xbses.js +518 -0
  120. package/dist/styles.css +264 -0
  121. package/index.ts +22 -0
  122. package/lib/artwork.ts +112 -0
  123. package/lib/clock.ts +53 -0
  124. package/lib/geometry.ts +130 -0
  125. package/lib/island-context.tsx +24 -0
  126. package/lib/motion.ts +42 -0
  127. package/mock/activities.tsx +77 -0
  128. package/mock/artwork.tsx +37 -0
  129. package/mock/clipboard.tsx +79 -0
  130. package/mock/clock.tsx +77 -0
  131. package/mock/data.ts +139 -0
  132. package/mock/desktop.tsx +83 -0
  133. package/mock/files.tsx +70 -0
  134. package/mock/fit.ts +26 -0
  135. package/mock/island-content.tsx +142 -0
  136. package/mock/scene.tsx +52 -0
  137. package/mock/screen.tsx +76 -0
  138. package/mock/settings.tsx +489 -0
  139. package/mock/system.ts +46 -0
  140. package/mock/weather.tsx +105 -0
  141. package/package.json +122 -4
@@ -0,0 +1,518 @@
1
+ "use client";
2
+
3
+ import {
4
+ IslandFlash2
5
+ } from "./chunk-ndf79pv5.js";
6
+ import {
7
+ widget_default
8
+ } from "./chunk-x7f3g82r.js";
9
+ import {
10
+ MINUTE2,
11
+ useEdgeClock2
12
+ } from "./chunk-gb56m10p.js";
13
+
14
+ // blocks/activities/weather/index.tsx
15
+ import Button from "@justanarthur/modo-ui/components/actions/button";
16
+ import { useSize } from "@justanarthur/modo-ui/lib/size-context";
17
+ import { SURFACE_BG } from "@justanarthur/modo-ui/lib/surface-classes";
18
+ import { useLift } from "@justanarthur/modo-ui/lib/surface-context";
19
+ import { cn } from "@justanarthur/modo-ui/lib/utils";
20
+ import Skeleton from "@justanarthur/modo-ui/primitives/content/skeleton";
21
+ import {
22
+ ArrowDown,
23
+ ArrowUp,
24
+ Cloud,
25
+ CloudDrizzle,
26
+ CloudFog,
27
+ CloudHail,
28
+ CloudLightning,
29
+ CloudMoon,
30
+ CloudOff,
31
+ CloudRain,
32
+ CloudRainWind,
33
+ CloudSnow,
34
+ CloudSun,
35
+ Droplets,
36
+ LocateOff,
37
+ MapPin,
38
+ Moon,
39
+ RotateCw,
40
+ Sun,
41
+ Umbrella,
42
+ WifiOff,
43
+ Wind
44
+ } from "lucide-react";
45
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
46
+ /*!
47
+ * Local addition: a notch app's weather, the temperature now, the next
48
+ * hours and tomorrow, with the location and loading states around it and a
49
+ * flash before rain. Presentational: the forecast comes in as props, shaped
50
+ * so a host can fill it from Open-Meteo (`conditionFromCode` reads its WMO
51
+ * weather codes).
52
+ */
53
+ var LABEL = {
54
+ clear: "Clear",
55
+ "partly-cloudy": "Partly cloudy",
56
+ cloudy: "Cloudy",
57
+ fog: "Fog",
58
+ drizzle: "Drizzle",
59
+ rain: "Rain",
60
+ "heavy-rain": "Heavy rain",
61
+ sleet: "Sleet",
62
+ snow: "Snow",
63
+ thunderstorm: "Thunderstorm"
64
+ };
65
+ var GLYPH = {
66
+ clear: Sun,
67
+ "partly-cloudy": CloudSun,
68
+ cloudy: Cloud,
69
+ fog: CloudFog,
70
+ drizzle: CloudDrizzle,
71
+ rain: CloudRain,
72
+ "heavy-rain": CloudRainWind,
73
+ sleet: CloudHail,
74
+ snow: CloudSnow,
75
+ thunderstorm: CloudLightning
76
+ };
77
+ var HUE = {
78
+ clear: "text-status-warning",
79
+ "partly-cloudy": "text-status-warning",
80
+ cloudy: "text-foreground",
81
+ fog: "text-foreground",
82
+ drizzle: "text-status-info",
83
+ rain: "text-status-info",
84
+ "heavy-rain": "text-status-info",
85
+ sleet: "text-status-info",
86
+ snow: "text-foreground",
87
+ thunderstorm: "text-status-info"
88
+ };
89
+ var HERO_GLYPH = { default: 30, compact: 24 };
90
+ var STRIP_GLYPH = { default: 16, compact: 14 };
91
+ var WET = 30;
92
+ var HOURS = 6;
93
+ function conditionFromCode2(code) {
94
+ if (code === 0)
95
+ return "clear";
96
+ if (code <= 2)
97
+ return "partly-cloudy";
98
+ if (code === 3)
99
+ return "cloudy";
100
+ if (code === 45 || code === 48)
101
+ return "fog";
102
+ if (code >= 51 && code <= 55)
103
+ return "drizzle";
104
+ if (code === 56 || code === 57 || code === 66 || code === 67)
105
+ return "sleet";
106
+ if (code === 65 || code === 82)
107
+ return "heavy-rain";
108
+ if (code >= 61 && code <= 63 || code === 80 || code === 81)
109
+ return "rain";
110
+ if (code >= 71 && code <= 77 || code === 85 || code === 86)
111
+ return "snow";
112
+ if (code >= 95)
113
+ return "thunderstorm";
114
+ return "cloudy";
115
+ }
116
+ function glyphFor(condition, isDay = true) {
117
+ if (!isDay && condition === "clear")
118
+ return Moon;
119
+ if (!isDay && condition === "partly-cloudy")
120
+ return CloudMoon;
121
+ return GLYPH[condition];
122
+ }
123
+ function hueFor(condition, isDay = true) {
124
+ if (!isDay && (condition === "clear" || condition === "partly-cloudy"))
125
+ return "text-foreground";
126
+ return HUE[condition];
127
+ }
128
+ var degrees = (celsius, unit) => Math.round(unit === "fahrenheit" ? celsius * 9 / 5 + 32 : celsius);
129
+ var temp = (celsius, unit) => `${degrees(celsius, unit)}°`;
130
+ var speed = (kmh, unit) => unit === "fahrenheit" ? `${Math.round(kmh / 1.609)} mph` : `${Math.round(kmh)} km/h`;
131
+ var hourOf = (ms, locale) => new Date(ms).toLocaleTimeString(locale, { hour: "numeric" });
132
+ function ago(ms) {
133
+ const minutes = Math.floor(ms / MINUTE2);
134
+ if (minutes < 1)
135
+ return "Just now";
136
+ if (minutes < 60)
137
+ return `${minutes} min ago`;
138
+ return `${Math.floor(minutes / 60)} h ago`;
139
+ }
140
+ function rainAhead(current, hours) {
141
+ if (HUE[current.condition] === "text-status-info")
142
+ return;
143
+ return hours.find((hour) => (hour.precipitation ?? 0) >= 50);
144
+ }
145
+ function Glyph({ condition, isDay, size, className }) {
146
+ const Icon = glyphFor(condition, isDay);
147
+ return /* @__PURE__ */ jsx(Icon, {
148
+ "aria-hidden": true,
149
+ size,
150
+ strokeWidth: 1.5,
151
+ className: cn("shrink-0", className)
152
+ });
153
+ }
154
+ function Hours({ hours, unit, locale }) {
155
+ const size = useSize();
156
+ const wet = hours.some((hour) => (hour.precipitation ?? 0) >= WET);
157
+ return /* @__PURE__ */ jsx("div", {
158
+ className: "flex min-w-0 justify-between",
159
+ children: hours.map((hour, i) => /* @__PURE__ */ jsxs("div", {
160
+ className: "flex min-w-0 flex-1 flex-col items-center gap-1 tabular-nums",
161
+ children: [
162
+ /* @__PURE__ */ jsx("span", {
163
+ className: "whitespace-nowrap text-caption text-muted-foreground",
164
+ children: i === 0 ? "Now" : hourOf(hour.time, locale)
165
+ }),
166
+ /* @__PURE__ */ jsx(Glyph, {
167
+ condition: hour.condition,
168
+ isDay: hour.isDay,
169
+ size: STRIP_GLYPH[size.variant],
170
+ className: "text-foreground"
171
+ }),
172
+ /* @__PURE__ */ jsx("span", {
173
+ className: "text-body text-foreground",
174
+ children: temp(hour.temperature, unit)
175
+ }),
176
+ wet && /* @__PURE__ */ jsx("span", {
177
+ className: "h-4 text-caption text-status-info",
178
+ children: (hour.precipitation ?? 0) >= WET && `${hour.precipitation}%`
179
+ })
180
+ ]
181
+ }, hour.time))
182
+ });
183
+ }
184
+ function Tomorrow({ day, unit }) {
185
+ return /* @__PURE__ */ jsx(widget_default.Row, {
186
+ leading: "Tomorrow",
187
+ trailing: /* @__PURE__ */ jsxs(Fragment, {
188
+ children: [
189
+ (day.precipitation ?? 0) >= WET && /* @__PURE__ */ jsxs("span", {
190
+ className: "text-status-info",
191
+ children: [
192
+ day.precipitation,
193
+ "%"
194
+ ]
195
+ }),
196
+ /* @__PURE__ */ jsx("span", {
197
+ className: "text-foreground",
198
+ children: temp(day.high, unit)
199
+ }),
200
+ /* @__PURE__ */ jsx("span", {
201
+ children: temp(day.low, unit)
202
+ })
203
+ ]
204
+ }),
205
+ children: /* @__PURE__ */ jsxs("span", {
206
+ className: "flex min-w-0 items-center gap-2",
207
+ children: [
208
+ /* @__PURE__ */ jsx(Glyph, {
209
+ condition: day.condition,
210
+ size: 14,
211
+ className: "text-muted-foreground"
212
+ }),
213
+ /* @__PURE__ */ jsx("span", {
214
+ className: "truncate",
215
+ children: LABEL[day.condition]
216
+ })
217
+ ]
218
+ })
219
+ });
220
+ }
221
+ function Loading({ location, className }) {
222
+ return /* @__PURE__ */ jsx(widget_default, {
223
+ className,
224
+ aside: /* @__PURE__ */ jsxs("div", {
225
+ "aria-hidden": true,
226
+ className: "flex flex-col gap-3",
227
+ children: [
228
+ /* @__PURE__ */ jsx(Skeleton, {
229
+ className: "h-3 w-20"
230
+ }),
231
+ /* @__PURE__ */ jsx("div", {
232
+ className: "flex justify-between",
233
+ children: Array.from({ length: HOURS }, (_, i) => /* @__PURE__ */ jsx(Skeleton, {
234
+ className: "h-14 w-7"
235
+ }, i))
236
+ }),
237
+ /* @__PURE__ */ jsx(Skeleton, {
238
+ className: "h-3 w-full"
239
+ })
240
+ ]
241
+ }),
242
+ children: /* @__PURE__ */ jsxs("div", {
243
+ "aria-busy": true,
244
+ className: "flex min-w-0 flex-col gap-2",
245
+ children: [
246
+ /* @__PURE__ */ jsx(widget_default.Header, {
247
+ icon: MapPin,
248
+ children: location ?? "Finding you…"
249
+ }),
250
+ /* @__PURE__ */ jsx(Skeleton, {
251
+ className: "h-8 w-28"
252
+ }),
253
+ /* @__PURE__ */ jsx(Skeleton, {
254
+ className: "h-4 w-40"
255
+ }),
256
+ /* @__PURE__ */ jsx(Skeleton, {
257
+ className: "h-3 w-56"
258
+ })
259
+ ]
260
+ })
261
+ });
262
+ }
263
+ function WeatherLeading2({ current }) {
264
+ return /* @__PURE__ */ jsx(Glyph, {
265
+ condition: current.condition,
266
+ isDay: current.isDay,
267
+ size: 16,
268
+ className: hueFor(current.condition, current.isDay)
269
+ });
270
+ }
271
+ function WeatherTrailing2({ current, unit = "celsius" }) {
272
+ return /* @__PURE__ */ jsx("span", {
273
+ className: "text-caption weight-semibold text-foreground tabular-nums",
274
+ children: temp(current.temperature, unit)
275
+ });
276
+ }
277
+ function WeatherMinimal2({ current }) {
278
+ const level = useLift(1);
279
+ return /* @__PURE__ */ jsx("span", {
280
+ role: "img",
281
+ "aria-label": LABEL[current.condition],
282
+ className: cn("flex size-6 items-center justify-center rounded-full", SURFACE_BG[level], hueFor(current.condition, current.isDay)),
283
+ children: /* @__PURE__ */ jsx(Glyph, {
284
+ condition: current.condition,
285
+ isDay: current.isDay,
286
+ size: 14
287
+ })
288
+ });
289
+ }
290
+ var ALERT_TILE = {
291
+ notice: "bg-status-info/16 text-status-info",
292
+ warning: "bg-status-warning/16 text-status-warning",
293
+ severe: "bg-status-error/16 text-status-error"
294
+ };
295
+ function WeatherAlert2({
296
+ condition,
297
+ startsAt,
298
+ title,
299
+ caption,
300
+ severity = "notice",
301
+ actionLabel = "Details",
302
+ onAction
303
+ }) {
304
+ const now = useEdgeClock2(startsAt ?? 0, startsAt !== undefined && title === undefined, MINUTE2);
305
+ const left = startsAt === undefined ? 0 : Math.ceil((startsAt - now) / MINUTE2);
306
+ const heading = title ?? (left > 0 ? `${LABEL[condition]} in ${left} min` : `${LABEL[condition]} now`);
307
+ return /* @__PURE__ */ jsx(IslandFlash2, {
308
+ icon: /* @__PURE__ */ jsx("span", {
309
+ className: cn("flex size-9 items-center justify-center rounded-lg", ALERT_TILE[severity]),
310
+ children: /* @__PURE__ */ jsx(Glyph, {
311
+ condition,
312
+ size: 16
313
+ })
314
+ }),
315
+ title: heading,
316
+ caption,
317
+ action: onAction && /* @__PURE__ */ jsx(Button, {
318
+ variant: "secondary",
319
+ size: "compact",
320
+ onClick: onAction,
321
+ children: actionLabel
322
+ })
323
+ });
324
+ }
325
+ var Weather2 = Object.assign(function Weather({
326
+ location,
327
+ current,
328
+ hours = [],
329
+ days = [],
330
+ unit = "celsius",
331
+ access = "granted",
332
+ status = "ready",
333
+ now: nowProp,
334
+ locale,
335
+ onRefresh,
336
+ onRequestAccess,
337
+ onOpenSettings,
338
+ className
339
+ }) {
340
+ const size = useSize();
341
+ const ticking = useEdgeClock2(current?.time ?? 0, nowProp === undefined, MINUTE2);
342
+ const now = nowProp ?? ticking;
343
+ if (access === "undetermined")
344
+ return /* @__PURE__ */ jsx(widget_default.Message, {
345
+ icon: MapPin,
346
+ title: "Weather where you are",
347
+ description: "The temperature now, the next hours and tomorrow, for your location.",
348
+ actions: /* @__PURE__ */ jsx(Button, {
349
+ variant: "primary",
350
+ size: "compact",
351
+ onClick: onRequestAccess,
352
+ children: "Allow location"
353
+ }),
354
+ className
355
+ });
356
+ if (access === "denied")
357
+ return /* @__PURE__ */ jsx(widget_default.Message, {
358
+ icon: LocateOff,
359
+ title: "Location access is off",
360
+ description: "Turn it on in System Settings › Privacy & Security › Location Services.",
361
+ actions: /* @__PURE__ */ jsx(Button, {
362
+ variant: "secondary",
363
+ size: "compact",
364
+ onClick: onOpenSettings,
365
+ children: "Open System Settings"
366
+ }),
367
+ className
368
+ });
369
+ if (!current && status === "error")
370
+ return /* @__PURE__ */ jsx(widget_default.Message, {
371
+ icon: CloudOff,
372
+ title: "Couldn't load the weather",
373
+ description: "The forecast service didn't answer. It tries again on its own in a few minutes.",
374
+ actions: onRefresh && /* @__PURE__ */ jsx(Button, {
375
+ variant: "secondary",
376
+ size: "compact",
377
+ onClick: onRefresh,
378
+ children: "Try again"
379
+ }),
380
+ className
381
+ });
382
+ if (!current && status === "offline")
383
+ return /* @__PURE__ */ jsx(widget_default.Message, {
384
+ icon: WifiOff,
385
+ title: "You're offline",
386
+ description: "The forecast loads as soon as you're back online.",
387
+ className
388
+ });
389
+ if (!current)
390
+ return /* @__PURE__ */ jsx(Loading, {
391
+ location,
392
+ className
393
+ });
394
+ const hourStart = new Date(now).setMinutes(0, 0, 0);
395
+ const ahead = hours.filter((hour) => hour.time >= hourStart).sort((a, b) => a.time - b.time);
396
+ const [today, tomorrow] = days;
397
+ const rain = rainAhead(current, ahead);
398
+ const fresh = ago(Math.max(0, now - current.time));
399
+ const freshness = status === "offline" ? `Offline · ${fresh}` : status === "error" ? `Not updated · ${fresh}` : fresh;
400
+ const feels = current.apparent !== undefined && `Feels like ${temp(current.apparent, unit)}`;
401
+ const soon = rain && `${LABEL[rain.condition]} around ${hourOf(rain.time, locale)}`;
402
+ return /* @__PURE__ */ jsxs(widget_default, {
403
+ className,
404
+ aside: ahead.length > 0 && /* @__PURE__ */ jsxs(Fragment, {
405
+ children: [
406
+ /* @__PURE__ */ jsx(widget_default.Section, {
407
+ label: "Next hours",
408
+ children: /* @__PURE__ */ jsx(Hours, {
409
+ hours: ahead.slice(0, HOURS),
410
+ unit,
411
+ locale
412
+ })
413
+ }),
414
+ tomorrow && /* @__PURE__ */ jsx("div", {
415
+ className: "mt-1.5",
416
+ children: /* @__PURE__ */ jsx(Tomorrow, {
417
+ day: tomorrow,
418
+ unit
419
+ })
420
+ })
421
+ ]
422
+ }),
423
+ children: [
424
+ /* @__PURE__ */ jsx(widget_default.Header, {
425
+ icon: MapPin,
426
+ trailing: /* @__PURE__ */ jsxs(Fragment, {
427
+ children: [
428
+ /* @__PURE__ */ jsx("span", {
429
+ className: "whitespace-nowrap pr-1 text-caption",
430
+ children: freshness
431
+ }),
432
+ onRefresh && /* @__PURE__ */ jsx(widget_default.Action, {
433
+ icon: RotateCw,
434
+ label: "Refresh",
435
+ onClick: onRefresh
436
+ })
437
+ ]
438
+ }),
439
+ children: location ?? "Current location"
440
+ }),
441
+ /* @__PURE__ */ jsxs("div", {
442
+ className: "flex min-w-0 items-center gap-2.5",
443
+ children: [
444
+ /* @__PURE__ */ jsx(Glyph, {
445
+ condition: current.condition,
446
+ isDay: current.isDay,
447
+ size: HERO_GLYPH[size.variant],
448
+ className: hueFor(current.condition, current.isDay)
449
+ }),
450
+ /* @__PURE__ */ jsx(widget_default.Figure, {
451
+ value: degrees(current.temperature, unit),
452
+ unit: unit === "fahrenheit" ? "°F" : "°C"
453
+ })
454
+ ]
455
+ }),
456
+ /* @__PURE__ */ jsxs("div", {
457
+ className: "flex min-w-0 flex-col gap-0.5",
458
+ children: [
459
+ /* @__PURE__ */ jsx(widget_default.Title, {
460
+ children: LABEL[current.condition]
461
+ }),
462
+ (feels || soon) && /* @__PURE__ */ jsx(widget_default.Subtitle, {
463
+ children: [feels, soon].filter(Boolean).join(" · ")
464
+ })
465
+ ]
466
+ }),
467
+ /* @__PURE__ */ jsxs(widget_default.Meta, {
468
+ className: "mt-1",
469
+ children: [
470
+ today && /* @__PURE__ */ jsxs(Fragment, {
471
+ children: [
472
+ /* @__PURE__ */ jsx(widget_default.MetaItem, {
473
+ icon: ArrowUp,
474
+ children: temp(today.high, unit)
475
+ }),
476
+ /* @__PURE__ */ jsx(widget_default.MetaItem, {
477
+ icon: ArrowDown,
478
+ children: temp(today.low, unit)
479
+ })
480
+ ]
481
+ }),
482
+ today?.precipitation !== undefined && /* @__PURE__ */ jsxs(widget_default.MetaItem, {
483
+ icon: Umbrella,
484
+ children: [
485
+ today.precipitation,
486
+ "%"
487
+ ]
488
+ }),
489
+ current.wind !== undefined && /* @__PURE__ */ jsx(widget_default.MetaItem, {
490
+ icon: Wind,
491
+ children: speed(current.wind, unit)
492
+ }),
493
+ current.humidity !== undefined && /* @__PURE__ */ jsxs(widget_default.MetaItem, {
494
+ icon: Droplets,
495
+ children: [
496
+ Math.round(current.humidity),
497
+ "%"
498
+ ]
499
+ }),
500
+ current.uv !== undefined && /* @__PURE__ */ jsxs(widget_default.MetaItem, {
501
+ icon: Sun,
502
+ children: [
503
+ "UV ",
504
+ Math.round(current.uv)
505
+ ]
506
+ })
507
+ ]
508
+ })
509
+ ]
510
+ });
511
+ }, {
512
+ Leading: WeatherLeading2,
513
+ Trailing: WeatherTrailing2,
514
+ Minimal: WeatherMinimal2,
515
+ Alert: WeatherAlert2
516
+ });
517
+ var weather_default = Weather2;
518
+ export { conditionFromCode2, WeatherLeading2, WeatherTrailing2, WeatherMinimal2, WeatherAlert2, Weather2, weather_default };