@justanarthur/modo-ui-notch 0.2.0 → 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.
- package/README.md +11 -11
- package/blocks/activities/agenda/examples.mdx +21 -5
- package/blocks/activities/agenda/index.tsx +291 -182
- package/blocks/activities/clock/examples.mdx +73 -0
- package/blocks/activities/clock/index.tsx +619 -0
- package/blocks/activities/now-playing/examples.mdx +32 -13
- package/blocks/activities/now-playing/index.tsx +319 -126
- package/blocks/activities/weather/examples.mdx +115 -0
- package/blocks/activities/weather/index.tsx +634 -0
- package/blocks/app/expanded-island/examples.mdx +8 -7
- package/blocks/app/expanded-island/index.tsx +19 -3
- package/blocks/app/settings-window/examples.mdx +6 -2
- package/blocks/app/settings-window/index.tsx +25 -7
- package/blocks/system/clipboard/examples.mdx +83 -0
- package/blocks/system/clipboard/index.tsx +563 -0
- package/blocks/system/recent-files/examples.mdx +66 -0
- package/blocks/system/recent-files/index.tsx +542 -0
- package/blocks/system/system-stats/examples.mdx +38 -9
- package/blocks/system/system-stats/index.tsx +241 -107
- package/components/indicators/media-scrubber/examples.mdx +8 -0
- package/components/indicators/media-scrubber/index.tsx +37 -13
- package/components/island/island/examples.mdx +4 -4
- package/components/island/island/index.tsx +2 -2
- package/components/island/island-flash/examples.mdx +15 -18
- package/components/island/island-flash/index.tsx +4 -4
- package/components/island/island-tabs/examples.mdx +5 -5
- package/components/island/widget/examples.mdx +76 -0
- package/components/island/widget/index.tsx +431 -0
- package/dist/blocks/activities/agenda/index.d.ts +1 -1
- package/dist/blocks/activities/agenda/index.js +3 -3
- package/dist/blocks/activities/clock/index.d.ts +2 -0
- package/dist/blocks/activities/clock/index.js +25 -0
- package/dist/blocks/activities/now-playing/index.d.ts +3 -2
- package/dist/blocks/activities/now-playing/index.js +5 -3
- package/dist/blocks/activities/weather/index.d.ts +2 -0
- package/dist/blocks/activities/weather/index.js +21 -0
- package/dist/blocks/app/expanded-island/index.d.ts +1 -1
- package/dist/blocks/app/expanded-island/index.js +4 -3
- package/dist/blocks/app/settings-window/index.d.ts +1 -1
- package/dist/blocks/app/settings-window/index.js +1 -1
- package/dist/blocks/system/clipboard/index.d.ts +2 -0
- package/dist/blocks/system/clipboard/index.js +17 -0
- package/dist/blocks/system/recent-files/index.d.ts +2 -0
- package/dist/blocks/system/recent-files/index.js +19 -0
- package/dist/blocks/system/system-stats/index.d.ts +2 -2
- package/dist/blocks/system/system-stats/index.js +4 -1
- package/dist/components/indicators/media-scrubber/index.d.ts +1 -1
- package/dist/components/indicators/media-scrubber/index.js +1 -1
- package/dist/components/island/island/index.d.ts +1 -1
- package/dist/components/island/island/index.js +2 -2
- package/dist/components/island/island-flash/index.d.ts +1 -1
- package/dist/components/island/island-flash/index.js +1 -1
- package/dist/components/island/island-tabs/index.js +2 -2
- package/dist/components/island/widget/index.d.ts +2 -0
- package/dist/components/island/widget/index.js +30 -0
- package/dist/index.d.ts +15 -15
- package/dist/index.js +102 -58
- package/dist/lib/artwork.d.ts +2 -0
- package/dist/lib/artwork.js +8 -0
- package/dist/lib/geometry.js +1 -1
- package/dist/shared/chunk-2818esrq.d.ts +140 -0
- package/dist/shared/{chunk-yngkkxz2.d.ts → chunk-2m5dz8nf.d.ts} +4 -4
- package/dist/shared/chunk-3thgcfcq.d.ts +151 -0
- package/dist/shared/chunk-416tsgbc.d.ts +175 -0
- package/dist/shared/{chunk-zvh0d3qb.js → chunk-61t2dfte.js} +1 -1
- package/dist/shared/chunk-7fvnrtz4.d.ts +105 -0
- package/dist/shared/{chunk-hpsabfsd.d.ts → chunk-81fpptwp.d.ts} +1 -1
- package/dist/shared/chunk-9c7ewvkk.js +381 -0
- package/dist/shared/{chunk-mp1nx0ez.js → chunk-9m0xbg5v.js} +14 -3
- package/dist/shared/{chunk-wwjxs75m.js → chunk-9xtcv3sy.js} +26 -12
- package/dist/shared/chunk-bvtyjcce.d.ts +123 -0
- package/dist/shared/{chunk-s33y1pcq.js → chunk-cc9nwbtf.js} +20 -10
- package/dist/shared/chunk-da177e8r.d.ts +114 -0
- package/dist/shared/{chunk-6c1jbefs.d.ts → chunk-fexwzycv.d.ts} +3 -3
- package/dist/shared/chunk-gejenfap.d.ts +25 -0
- package/dist/shared/{chunk-rr5e0g15.d.ts → chunk-j755a1a5.d.ts} +7 -1
- package/dist/shared/chunk-j77cx8dp.js +498 -0
- package/dist/shared/chunk-mt0k6v8x.js +474 -0
- package/dist/shared/{chunk-78w7qwp0.js → chunk-ndf79pv5.js} +1 -1
- package/dist/shared/{chunk-9nhpg9t8.d.ts → chunk-pfhy5e4q.d.ts} +7 -1
- package/dist/shared/chunk-qdzemt2v.js +477 -0
- package/dist/shared/{chunk-rpfwv3pz.js → chunk-r471sknr.js} +1 -1
- package/dist/shared/chunk-s2jeqqan.js +243 -0
- package/dist/shared/chunk-t0hcxh89.d.ts +124 -0
- package/dist/shared/chunk-w5h6ay93.js +72 -0
- package/dist/shared/chunk-wkg17nxs.d.ts +101 -0
- package/dist/shared/chunk-x7f3g82r.js +285 -0
- package/dist/shared/chunk-xq5hc5gv.js +333 -0
- package/dist/shared/{chunk-sbnrhy5m.js → chunk-y0188bbn.js} +2 -2
- package/dist/shared/chunk-ym0xbses.js +518 -0
- package/dist/styles.css +97 -55
- package/index.ts +7 -6
- package/lib/artwork.ts +112 -0
- package/lib/geometry.ts +1 -1
- package/mock/activities.tsx +9 -32
- package/mock/artwork.tsx +13 -1
- package/mock/clipboard.tsx +79 -0
- package/mock/clock.tsx +77 -0
- package/mock/data.ts +30 -44
- package/mock/files.tsx +70 -0
- package/mock/island-content.tsx +43 -118
- package/mock/screen.tsx +76 -0
- package/mock/settings.tsx +370 -91
- package/mock/system.ts +46 -0
- package/mock/weather.tsx +105 -0
- package/package.json +7 -2
- package/blocks/activities/shelf/examples.mdx +0 -33
- package/blocks/activities/shelf/index.tsx +0 -289
- package/blocks/activities/timer/examples.mdx +0 -52
- package/blocks/activities/timer/index.tsx +0 -292
- package/blocks/system/controls/examples.mdx +0 -34
- package/blocks/system/controls/index.tsx +0 -167
- package/blocks/system/devices/examples.mdx +0 -25
- package/blocks/system/devices/index.tsx +0 -172
- package/blocks/system/power-alert/examples.mdx +0 -32
- package/blocks/system/power-alert/index.tsx +0 -89
- package/components/indicators/battery-glyph/examples.mdx +0 -22
- package/components/indicators/battery-glyph/index.tsx +0 -91
- package/dist/blocks/activities/shelf/index.d.ts +0 -2
- package/dist/blocks/activities/shelf/index.js +0 -14
- package/dist/blocks/activities/timer/index.d.ts +0 -2
- package/dist/blocks/activities/timer/index.js +0 -19
- package/dist/blocks/system/controls/index.d.ts +0 -2
- package/dist/blocks/system/controls/index.js +0 -10
- package/dist/blocks/system/devices/index.d.ts +0 -2
- package/dist/blocks/system/devices/index.js +0 -12
- package/dist/blocks/system/power-alert/index.d.ts +0 -2
- package/dist/blocks/system/power-alert/index.js +0 -9
- package/dist/components/indicators/battery-glyph/index.d.ts +0 -2
- package/dist/components/indicators/battery-glyph/index.js +0 -9
- package/dist/shared/chunk-2qpcsv5h.d.ts +0 -45
- package/dist/shared/chunk-45gytfr1.d.ts +0 -84
- package/dist/shared/chunk-50ffk4r7.d.ts +0 -69
- package/dist/shared/chunk-5w0yck07.d.ts +0 -32
- package/dist/shared/chunk-7hr53mby.js +0 -116
- package/dist/shared/chunk-b8jb1w72.js +0 -145
- package/dist/shared/chunk-cpewy6yg.js +0 -178
- package/dist/shared/chunk-e3e4s4ds.d.ts +0 -77
- package/dist/shared/chunk-enm6td0p.js +0 -280
- package/dist/shared/chunk-fvedaas2.d.ts +0 -33
- package/dist/shared/chunk-gex38j8x.d.ts +0 -82
- package/dist/shared/chunk-hwtxpzg0.js +0 -69
- package/dist/shared/chunk-phb53x1f.js +0 -252
- package/dist/shared/chunk-r8esmjfs.d.ts +0 -42
- package/dist/shared/chunk-rcp1g9ca.js +0 -70
- package/dist/shared/chunk-rx9sphz2.js +0 -266
- package/dist/shared/chunk-xdeek16r.d.ts +0 -58
- package/dist/shared/chunk-xkzjk1tq.js +0 -206
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import Weather from './index'
|
|
2
|
+
import { DAYS, FORECAST, NIGHT, RainSoonFlash, WEATHER_NOW, WeatherSplit, WeatherWings } from '../../../mock/weather'
|
|
3
|
+
import { FlashIsland, WidgetIsland } from '../../../mock/island-content'
|
|
4
|
+
|
|
5
|
+
# Now and the next hours
|
|
6
|
+
|
|
7
|
+
The temperature as the hero after the condition's glyph, how warm it feels and when the rain comes, today's high, low, rain, wind, humidity and UV; the next six hours beside it with the chance of rain once it turns wet, and tomorrow.
|
|
8
|
+
|
|
9
|
+
<WidgetIsland tab="weather">
|
|
10
|
+
<Weather {...FORECAST} onRefresh={() => {}} />
|
|
11
|
+
</WidgetIsland>
|
|
12
|
+
|
|
13
|
+
# Fahrenheit
|
|
14
|
+
|
|
15
|
+
`unit="fahrenheit"` converts what it shows, the wind to mph; the data stays in °C and km/h.
|
|
16
|
+
|
|
17
|
+
<WidgetIsland tab="weather">
|
|
18
|
+
<Weather {...FORECAST} unit="fahrenheit" />
|
|
19
|
+
</WidgetIsland>
|
|
20
|
+
|
|
21
|
+
# A clear night
|
|
22
|
+
|
|
23
|
+
The moon's glyph by night, the hue plain; a dry strip leaves the chance of rain out.
|
|
24
|
+
|
|
25
|
+
<WidgetIsland tab="weather">
|
|
26
|
+
<Weather location="Bratislava" current={NIGHT.current} hours={NIGHT.hours} days={DAYS} now={NIGHT.current.time + 10 * 60_000} />
|
|
27
|
+
</WidgetIsland>
|
|
28
|
+
|
|
29
|
+
# Offline
|
|
30
|
+
|
|
31
|
+
The last forecast stays up; the header says how old it is.
|
|
32
|
+
|
|
33
|
+
<WidgetIsland tab="weather">
|
|
34
|
+
<Weather {...FORECAST} now={WEATHER_NOW + 2 * 60 * 60_000} status="offline" />
|
|
35
|
+
</WidgetIsland>
|
|
36
|
+
|
|
37
|
+
# Loading
|
|
38
|
+
|
|
39
|
+
The first fetch shows the widget's shape.
|
|
40
|
+
|
|
41
|
+
<WidgetIsland tab="weather">
|
|
42
|
+
<Weather location="Bratislava" status="loading" />
|
|
43
|
+
</WidgetIsland>
|
|
44
|
+
|
|
45
|
+
# Couldn't load
|
|
46
|
+
|
|
47
|
+
<WidgetIsland tab="weather">
|
|
48
|
+
<Weather status="error" onRefresh={() => {}} />
|
|
49
|
+
</WidgetIsland>
|
|
50
|
+
|
|
51
|
+
# Asking for location
|
|
52
|
+
|
|
53
|
+
`access="undetermined"` asks for the location.
|
|
54
|
+
|
|
55
|
+
<WidgetIsland tab="weather">
|
|
56
|
+
<Weather access="undetermined" />
|
|
57
|
+
</WidgetIsland>
|
|
58
|
+
|
|
59
|
+
# Location off
|
|
60
|
+
|
|
61
|
+
`access="denied"` says where to turn it on.
|
|
62
|
+
|
|
63
|
+
<WidgetIsland tab="weather">
|
|
64
|
+
<Weather access="denied" />
|
|
65
|
+
</WidgetIsland>
|
|
66
|
+
|
|
67
|
+
# Compact
|
|
68
|
+
|
|
69
|
+
`Weather.Leading` and `Weather.Trailing` in the wings: the glyph in its hue and the temperature.
|
|
70
|
+
|
|
71
|
+
<WeatherWings />
|
|
72
|
+
|
|
73
|
+
# Minimal
|
|
74
|
+
|
|
75
|
+
`Weather.Minimal`, the glyph on a disc, in the split island's bubble.
|
|
76
|
+
|
|
77
|
+
<WeatherSplit />
|
|
78
|
+
|
|
79
|
+
# Rain soon
|
|
80
|
+
|
|
81
|
+
`Weather.Alert` counts down to the rain on each minute.
|
|
82
|
+
|
|
83
|
+
<RainSoonFlash />
|
|
84
|
+
|
|
85
|
+
# A warning
|
|
86
|
+
|
|
87
|
+
A `title` and `severity` for a warning in place of the countdown.
|
|
88
|
+
|
|
89
|
+
<FlashIsland>
|
|
90
|
+
<Weather.Alert condition="thunderstorm" title="Thunderstorm warning" caption="Strong gusts and hail until 19:00" severity="severe" onAction={() => {}} />
|
|
91
|
+
</FlashIsland>
|
|
92
|
+
|
|
93
|
+
# From Open-Meteo
|
|
94
|
+
|
|
95
|
+
`conditionFromCode` reads a WMO weather code; zip the arrays into objects and keep the units in °C and km/h.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import { conditionFromCode, type WeatherHour } from '@justanarthur/modo-ui-notch'
|
|
99
|
+
|
|
100
|
+
const res = await fetch(
|
|
101
|
+
`https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&timeformat=unixtime&timezone=auto` +
|
|
102
|
+
'¤t=temperature_2m,apparent_temperature,is_day,weather_code,wind_speed_10m,relative_humidity_2m,uv_index' +
|
|
103
|
+
'&hourly=temperature_2m,weather_code,is_day,precipitation_probability' +
|
|
104
|
+
'&daily=weather_code,temperature_2m_max,temperature_2m_min,precipitation_probability_max&forecast_days=2',
|
|
105
|
+
)
|
|
106
|
+
const { current, hourly, daily } = await res.json()
|
|
107
|
+
|
|
108
|
+
const hours: WeatherHour[] = hourly.time.map((time: number, i: number) => ({
|
|
109
|
+
time: time * 1000,
|
|
110
|
+
temperature: hourly.temperature_2m[i],
|
|
111
|
+
condition: conditionFromCode(hourly.weather_code[i]),
|
|
112
|
+
isDay: hourly.is_day[i] === 1,
|
|
113
|
+
precipitation: hourly.precipitation_probability[i],
|
|
114
|
+
}))
|
|
115
|
+
```
|