@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
package/mock/settings.tsx
CHANGED
|
@@ -8,91 +8,360 @@
|
|
|
8
8
|
'use client'
|
|
9
9
|
|
|
10
10
|
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
11
|
-
import
|
|
11
|
+
import List, { LIST_SWITCH } from '@justanarthur/modo-ui/components/data-display/list'
|
|
12
|
+
import Input from '@justanarthur/modo-ui/components/inputs/input'
|
|
13
|
+
import Select from '@justanarthur/modo-ui/components/inputs/select'
|
|
12
14
|
import Switch from '@justanarthur/modo-ui/components/inputs/switch'
|
|
13
15
|
import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
|
|
14
16
|
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
15
|
-
import {
|
|
16
|
-
Activity,
|
|
17
|
-
BatteryCharging,
|
|
18
|
-
CalendarDays,
|
|
19
|
-
Files,
|
|
20
|
-
Headphones,
|
|
21
|
-
Music,
|
|
22
|
-
SlidersHorizontal,
|
|
23
|
-
Timer,
|
|
24
|
-
} from 'lucide-react'
|
|
17
|
+
import { Activity, CalendarDays, ClipboardList, Clock3, CloudSun, FolderDown, MapPin, Music, X } from 'lucide-react'
|
|
25
18
|
import { type ReactNode, useState } from 'react'
|
|
26
19
|
import type { AboutRow, SettingsPermission, SettingsPlugin } from '../blocks/app/settings-window'
|
|
20
|
+
import { ZONES } from './clock'
|
|
27
21
|
import { useFitScale } from './fit'
|
|
28
22
|
|
|
29
|
-
|
|
23
|
+
interface Option {
|
|
24
|
+
value: string
|
|
25
|
+
label: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A switch row: the label, what it does, the switch at the end. */
|
|
29
|
+
function SwitchRow({
|
|
30
|
+
label,
|
|
31
|
+
description,
|
|
32
|
+
defaultChecked = false,
|
|
33
|
+
checked,
|
|
34
|
+
onCheckedChange,
|
|
35
|
+
}: {
|
|
36
|
+
label: string
|
|
37
|
+
description?: ReactNode
|
|
38
|
+
defaultChecked?: boolean
|
|
39
|
+
checked?: boolean
|
|
40
|
+
onCheckedChange?: (checked: boolean) => void
|
|
41
|
+
}) {
|
|
30
42
|
return (
|
|
31
|
-
<
|
|
32
|
-
<Switch
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
<List.Row label={label} description={description}>
|
|
44
|
+
<Switch
|
|
45
|
+
aria-label={label}
|
|
46
|
+
className={LIST_SWITCH}
|
|
47
|
+
defaultChecked={defaultChecked}
|
|
48
|
+
checked={checked}
|
|
49
|
+
onCheckedChange={onCheckedChange}
|
|
50
|
+
/>
|
|
51
|
+
</List.Row>
|
|
37
52
|
)
|
|
38
53
|
}
|
|
39
54
|
|
|
40
|
-
|
|
55
|
+
/** A choice row: the label, what it does, a borderless Select at the end. */
|
|
56
|
+
function SelectRow({
|
|
57
|
+
label,
|
|
58
|
+
description,
|
|
59
|
+
options,
|
|
60
|
+
defaultValue,
|
|
61
|
+
value,
|
|
62
|
+
onValueChange,
|
|
63
|
+
}: {
|
|
64
|
+
label: string
|
|
65
|
+
description?: ReactNode
|
|
66
|
+
options: Option[]
|
|
67
|
+
defaultValue?: string
|
|
68
|
+
value?: string
|
|
69
|
+
onValueChange?: (value: string) => void
|
|
70
|
+
}) {
|
|
41
71
|
return (
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
<
|
|
45
|
-
<
|
|
46
|
-
{
|
|
47
|
-
<
|
|
72
|
+
<List.Row label={label} description={description}>
|
|
73
|
+
<Select defaultValue={defaultValue} value={value} onValueChange={onValueChange}>
|
|
74
|
+
<Select.Trigger variant="borderless" className="min-w-0" aria-label={label} />
|
|
75
|
+
<Select.Content>
|
|
76
|
+
{options.map(option => (
|
|
77
|
+
<Select.Item key={option.value} value={option.value}>
|
|
78
|
+
{option.label}
|
|
79
|
+
</Select.Item>
|
|
48
80
|
))}
|
|
49
|
-
</
|
|
81
|
+
</Select.Content>
|
|
82
|
+
</Select>
|
|
83
|
+
</List.Row>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** A row of a list the user edits: the item, a muted detail, and Remove. */
|
|
88
|
+
function RemovableRow({ label, detail, onRemove }: { label: string; detail?: ReactNode; onRemove: () => void }) {
|
|
89
|
+
return (
|
|
90
|
+
<List.Row label={label}>
|
|
91
|
+
{detail && <span className="min-w-0 truncate text-caption text-muted-foreground">{detail}</span>}
|
|
92
|
+
<Button variant="ghost" size="icon" aria-label={`Remove ${label}`} onClick={onRemove}>
|
|
93
|
+
<X />
|
|
94
|
+
</Button>
|
|
95
|
+
</List.Row>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** What a setting needs from macOS and isn't granted: a line and the way to System Settings. */
|
|
100
|
+
function Notice({ title, children }: { title: string; children: ReactNode }) {
|
|
101
|
+
return (
|
|
102
|
+
<div className="flex items-center justify-between gap-4 rounded-xl bg-status-warning/16 px-4 py-3">
|
|
103
|
+
<div className="flex min-w-0 flex-col">
|
|
104
|
+
<span className="text-body weight-medium text-foreground">{title}</span>
|
|
105
|
+
<span className="text-caption text-muted-foreground">{children}</span>
|
|
50
106
|
</div>
|
|
51
|
-
<
|
|
52
|
-
|
|
107
|
+
<Button className="shrink-0" variant="secondary" size="compact">
|
|
108
|
+
Open Settings
|
|
109
|
+
</Button>
|
|
110
|
+
</div>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const minutes = (values: number[]): Option[] => values.map(m => ({ value: String(m), label: `${m} min` }))
|
|
115
|
+
|
|
116
|
+
function NowPlayingSettings() {
|
|
117
|
+
return (
|
|
118
|
+
<List>
|
|
119
|
+
<List.Section title="Announcements">
|
|
120
|
+
<SwitchRow
|
|
121
|
+
label="Announce track changes"
|
|
122
|
+
description="Shows the new track below the notch for a moment while the island is collapsed."
|
|
123
|
+
defaultChecked
|
|
124
|
+
/>
|
|
125
|
+
<SwitchRow
|
|
126
|
+
label="Only while a player is in the background"
|
|
127
|
+
description="Stays quiet while Music, Spotify or the browser playing is the app in front."
|
|
128
|
+
/>
|
|
129
|
+
</List.Section>
|
|
130
|
+
</List>
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function CalendarSettings() {
|
|
135
|
+
return (
|
|
136
|
+
<List>
|
|
137
|
+
<List.Section title="Up next">
|
|
138
|
+
<SelectRow
|
|
139
|
+
label="Show the countdown"
|
|
140
|
+
description="The next event takes the wings this long before it starts."
|
|
141
|
+
options={[5, 10, 15, 30].map(m => ({ value: String(m), label: `${m} min before` }))}
|
|
142
|
+
defaultValue="10"
|
|
143
|
+
/>
|
|
144
|
+
</List.Section>
|
|
145
|
+
<List.Section title="Alerts">
|
|
146
|
+
<SwitchRow
|
|
53
147
|
label="Alert a minute before"
|
|
54
|
-
description="
|
|
148
|
+
description="Drops the island open with the event and Join when it has a call link."
|
|
55
149
|
defaultChecked
|
|
56
150
|
/>
|
|
57
|
-
|
|
151
|
+
<SwitchRow
|
|
152
|
+
label="Include all-day events"
|
|
153
|
+
description="Off, they show as chips on the date line and never alert."
|
|
154
|
+
/>
|
|
155
|
+
</List.Section>
|
|
156
|
+
</List>
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function WeatherSettings() {
|
|
161
|
+
const [location, setLocation] = useState('automatic')
|
|
162
|
+
return (
|
|
163
|
+
<div className="flex flex-col gap-6">
|
|
164
|
+
{location === 'automatic' && (
|
|
165
|
+
<Notice title="Needs Location">
|
|
166
|
+
Allow the app under Privacy & Security › Location Services, or pick a city.
|
|
167
|
+
</Notice>
|
|
168
|
+
)}
|
|
169
|
+
<List>
|
|
170
|
+
<List.Section title="Location">
|
|
171
|
+
<SelectRow
|
|
172
|
+
label="Forecast for"
|
|
173
|
+
description="Your Mac's location follows you; a city stays put."
|
|
174
|
+
options={[
|
|
175
|
+
{ value: 'automatic', label: 'Current location' },
|
|
176
|
+
{ value: 'city', label: 'A city' },
|
|
177
|
+
]}
|
|
178
|
+
value={location}
|
|
179
|
+
onValueChange={setLocation}
|
|
180
|
+
/>
|
|
181
|
+
{location === 'city' && (
|
|
182
|
+
<List.Row label="City">
|
|
183
|
+
<Input
|
|
184
|
+
aria-label="City"
|
|
185
|
+
icon={MapPin}
|
|
186
|
+
defaultValue="Bratislava"
|
|
187
|
+
placeholder="Search for a city"
|
|
188
|
+
className="w-48"
|
|
189
|
+
/>
|
|
190
|
+
</List.Row>
|
|
191
|
+
)}
|
|
192
|
+
</List.Section>
|
|
193
|
+
<List.Section title="Units">
|
|
194
|
+
<SelectRow
|
|
195
|
+
label="Temperature"
|
|
196
|
+
description="Wind speed follows: km/h with Celsius, mph with Fahrenheit."
|
|
197
|
+
options={[
|
|
198
|
+
{ value: 'celsius', label: 'Celsius (°C)' },
|
|
199
|
+
{ value: 'fahrenheit', label: 'Fahrenheit (°F)' },
|
|
200
|
+
]}
|
|
201
|
+
defaultValue="celsius"
|
|
202
|
+
/>
|
|
203
|
+
</List.Section>
|
|
204
|
+
<List.Section title="Alerts">
|
|
205
|
+
<SwitchRow
|
|
206
|
+
label="Rain soon"
|
|
207
|
+
description="Flashes about a quarter of an hour before rain starts, with how long it lasts."
|
|
208
|
+
defaultChecked
|
|
209
|
+
/>
|
|
210
|
+
</List.Section>
|
|
211
|
+
</List>
|
|
58
212
|
</div>
|
|
59
213
|
)
|
|
60
214
|
}
|
|
61
215
|
|
|
62
|
-
function
|
|
63
|
-
const [
|
|
216
|
+
function ClockSettings() {
|
|
217
|
+
const [zones, setZones] = useState(ZONES)
|
|
64
218
|
return (
|
|
65
|
-
<
|
|
66
|
-
<
|
|
67
|
-
<
|
|
68
|
-
label="
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
219
|
+
<List>
|
|
220
|
+
<List.Section title="Clock">
|
|
221
|
+
<SelectRow
|
|
222
|
+
label="Time format"
|
|
223
|
+
options={[
|
|
224
|
+
{ value: 'auto', label: 'As the system' },
|
|
225
|
+
{ value: '12', label: '12-hour (4:42 PM)' },
|
|
226
|
+
{ value: '24', label: '24-hour (16:42)' },
|
|
227
|
+
]}
|
|
228
|
+
defaultValue="auto"
|
|
72
229
|
/>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
230
|
+
<SwitchRow label="Show seconds" description="The seconds tick, muted, after the minutes." />
|
|
231
|
+
</List.Section>
|
|
232
|
+
<List.Section title="World clocks" aside={`${zones.length} of 3`}>
|
|
233
|
+
{zones.map(zone => (
|
|
234
|
+
<RemovableRow
|
|
235
|
+
key={zone.timeZone}
|
|
236
|
+
label={zone.city}
|
|
237
|
+
detail={zone.timeZone}
|
|
238
|
+
onRemove={() => setZones(zones.filter(z => z !== zone))}
|
|
239
|
+
/>
|
|
240
|
+
))}
|
|
241
|
+
<List.Row label={<span className="text-muted-foreground">Up to three beside the time</span>}>
|
|
242
|
+
<Button variant="ghost" size="compact" disabled={zones.length >= 3}>
|
|
243
|
+
Add city
|
|
84
244
|
</Button>
|
|
85
|
-
</
|
|
86
|
-
|
|
87
|
-
|
|
245
|
+
</List.Row>
|
|
246
|
+
</List.Section>
|
|
247
|
+
<List.Section title="Pomodoro">
|
|
248
|
+
<SelectRow label="Focus" options={minutes([15, 20, 25, 30, 45, 50, 60])} defaultValue="25" />
|
|
249
|
+
<SelectRow label="Short break" options={minutes([3, 5, 10])} defaultValue="5" />
|
|
250
|
+
<SelectRow label="Long break" options={minutes([10, 15, 20, 30])} defaultValue="15" />
|
|
251
|
+
<SelectRow
|
|
252
|
+
label="Rounds before a long break"
|
|
253
|
+
options={[2, 3, 4, 5, 6].map(n => ({ value: String(n), label: String(n) }))}
|
|
254
|
+
defaultValue="4"
|
|
255
|
+
/>
|
|
256
|
+
<SwitchRow
|
|
257
|
+
label="Start breaks on their own"
|
|
258
|
+
description="Off, a finished round waits for you to start the break."
|
|
259
|
+
defaultChecked
|
|
260
|
+
/>
|
|
261
|
+
</List.Section>
|
|
262
|
+
</List>
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function SystemSettings() {
|
|
267
|
+
return (
|
|
268
|
+
<List>
|
|
269
|
+
<List.Section title="Widget">
|
|
270
|
+
<SelectRow
|
|
271
|
+
label="Hero"
|
|
272
|
+
description="The figure set large; the other shows among the facts under it."
|
|
273
|
+
options={[
|
|
274
|
+
{ value: 'cpu', label: 'CPU load' },
|
|
275
|
+
{ value: 'memory', label: 'Memory pressure' },
|
|
276
|
+
]}
|
|
277
|
+
defaultValue="cpu"
|
|
278
|
+
/>
|
|
279
|
+
</List.Section>
|
|
280
|
+
<List.Section title="Wings">
|
|
281
|
+
<SwitchRow
|
|
282
|
+
label="Show CPU load beside the notch"
|
|
283
|
+
description="Keeps sampling while it shows; otherwise only while the widget is open."
|
|
284
|
+
/>
|
|
285
|
+
</List.Section>
|
|
286
|
+
</List>
|
|
287
|
+
)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const IGNORED = ['1Password', 'Keychain Access']
|
|
291
|
+
|
|
292
|
+
function ClipboardSettings() {
|
|
293
|
+
const [ignored, setIgnored] = useState(IGNORED)
|
|
294
|
+
return (
|
|
295
|
+
<List>
|
|
296
|
+
<List.Section title="History">
|
|
297
|
+
<SelectRow
|
|
298
|
+
label="Keep"
|
|
299
|
+
description="The oldest clips go first; pinned ones stay."
|
|
300
|
+
options={[25, 50, 100, 250].map(n => ({ value: String(n), label: `${n} clips` }))}
|
|
301
|
+
defaultValue="100"
|
|
302
|
+
/>
|
|
303
|
+
<SwitchRow label="Pause recording" description="Nothing new is kept until you resume." />
|
|
304
|
+
<SwitchRow label="Clear when quitting" description="Pinned clips are kept." />
|
|
305
|
+
</List.Section>
|
|
306
|
+
<List.Section title="Never record from" aside={`${ignored.length} apps`}>
|
|
307
|
+
<SwitchRow
|
|
308
|
+
label="Passwords and concealed text"
|
|
309
|
+
description="Skips what password managers mark as concealed, whatever the app."
|
|
310
|
+
defaultChecked
|
|
311
|
+
/>
|
|
312
|
+
{ignored.map(app => (
|
|
313
|
+
<RemovableRow key={app} label={app} onRemove={() => setIgnored(ignored.filter(a => a !== app))} />
|
|
314
|
+
))}
|
|
315
|
+
<List.Row label={<span className="text-muted-foreground">Copies from these apps are never kept</span>}>
|
|
316
|
+
<Button variant="ghost" size="compact">
|
|
317
|
+
Add app
|
|
318
|
+
</Button>
|
|
319
|
+
</List.Row>
|
|
320
|
+
</List.Section>
|
|
321
|
+
</List>
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function FolderRow({ label, path }: { label: string; path: string }) {
|
|
326
|
+
return (
|
|
327
|
+
<List.Row label={label}>
|
|
328
|
+
<span className="min-w-0 truncate text-caption text-muted-foreground">{path}</span>
|
|
329
|
+
<Button variant="ghost" size="compact">
|
|
330
|
+
Change
|
|
331
|
+
</Button>
|
|
332
|
+
</List.Row>
|
|
88
333
|
)
|
|
89
334
|
}
|
|
90
335
|
|
|
91
|
-
function
|
|
336
|
+
function RecentFilesSettings() {
|
|
92
337
|
return (
|
|
93
|
-
<
|
|
94
|
-
<
|
|
95
|
-
|
|
338
|
+
<List>
|
|
339
|
+
<List.Section title="Sources">
|
|
340
|
+
<SwitchRow
|
|
341
|
+
label="Downloads"
|
|
342
|
+
description="Files as they finish downloading, and a download under way."
|
|
343
|
+
defaultChecked
|
|
344
|
+
/>
|
|
345
|
+
<SwitchRow label="Screenshots" description="Each screenshot as it is saved." defaultChecked />
|
|
346
|
+
</List.Section>
|
|
347
|
+
<List.Section title="Folders">
|
|
348
|
+
<FolderRow label="Downloads" path="~/Downloads" />
|
|
349
|
+
<FolderRow label="Screenshots" path="~/Desktop" />
|
|
350
|
+
</List.Section>
|
|
351
|
+
<List.Section title="List">
|
|
352
|
+
<SelectRow
|
|
353
|
+
label="Show"
|
|
354
|
+
description="How many files each list keeps, the newest first."
|
|
355
|
+
options={[6, 12, 24].map(n => ({ value: String(n), label: `${n} files` }))}
|
|
356
|
+
defaultValue="12"
|
|
357
|
+
/>
|
|
358
|
+
<SwitchRow
|
|
359
|
+
label="Flash when a file lands"
|
|
360
|
+
description="Shows the file below the notch for a moment, with Open."
|
|
361
|
+
defaultChecked
|
|
362
|
+
/>
|
|
363
|
+
</List.Section>
|
|
364
|
+
</List>
|
|
96
365
|
)
|
|
97
366
|
}
|
|
98
367
|
|
|
@@ -102,21 +371,7 @@ export const PLUGINS: SettingsPlugin[] = [
|
|
|
102
371
|
name: 'Now Playing',
|
|
103
372
|
description: 'What plays in Music, Spotify or a browser.',
|
|
104
373
|
icon: Music,
|
|
105
|
-
settings:
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
id: 'power',
|
|
109
|
-
name: 'Power',
|
|
110
|
-
description: 'Charging and low battery alerts.',
|
|
111
|
-
icon: BatteryCharging,
|
|
112
|
-
settings: <AlertSwitches />,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
id: 'timer',
|
|
116
|
-
name: 'Timer',
|
|
117
|
-
description: 'Countdowns and Pomodoro focus runs.',
|
|
118
|
-
icon: Timer,
|
|
119
|
-
settings: one('Pomodoro cycles', 'After a 25 min focus a 5 min break starts on its own, then focus again.', true),
|
|
374
|
+
settings: <NowPlayingSettings />,
|
|
120
375
|
},
|
|
121
376
|
{
|
|
122
377
|
id: 'calendar',
|
|
@@ -125,37 +380,61 @@ export const PLUGINS: SettingsPlugin[] = [
|
|
|
125
380
|
icon: CalendarDays,
|
|
126
381
|
settings: <CalendarSettings />,
|
|
127
382
|
},
|
|
128
|
-
{ id: 'shelf', name: 'Shelf', description: 'Files dropped on the notch, kept for later.', icon: Files },
|
|
129
383
|
{
|
|
130
|
-
id: '
|
|
131
|
-
name: '
|
|
132
|
-
description: '
|
|
133
|
-
icon:
|
|
134
|
-
settings: <
|
|
384
|
+
id: 'weather',
|
|
385
|
+
name: 'Weather',
|
|
386
|
+
description: 'The temperature now, the next hours and rain on its way.',
|
|
387
|
+
icon: CloudSun,
|
|
388
|
+
settings: <WeatherSettings />,
|
|
135
389
|
},
|
|
136
|
-
{ id: 'devices', name: 'Devices', description: 'Bluetooth devices and their batteries.', icon: Headphones },
|
|
137
390
|
{
|
|
138
|
-
id: '
|
|
391
|
+
id: 'clock',
|
|
392
|
+
name: 'Clock',
|
|
393
|
+
description: 'The time, world clocks and a Pomodoro cycle.',
|
|
394
|
+
icon: Clock3,
|
|
395
|
+
settings: <ClockSettings />,
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
id: 'system',
|
|
139
399
|
name: 'System',
|
|
140
|
-
description: 'CPU, memory and
|
|
400
|
+
description: 'CPU, memory, battery and the busiest processes.',
|
|
141
401
|
icon: Activity,
|
|
142
|
-
settings:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
402
|
+
settings: <SystemSettings />,
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
id: 'clipboard',
|
|
406
|
+
name: 'Clipboard',
|
|
407
|
+
description: 'What you copied, kept and searchable.',
|
|
408
|
+
icon: ClipboardList,
|
|
409
|
+
settings: <ClipboardSettings />,
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
id: 'files',
|
|
413
|
+
name: 'Recent files',
|
|
414
|
+
description: 'The newest downloads and screenshots, ready to drag out.',
|
|
415
|
+
icon: FolderDown,
|
|
416
|
+
settings: <RecentFilesSettings />,
|
|
146
417
|
},
|
|
147
418
|
]
|
|
148
419
|
|
|
149
420
|
export const PERMISSIONS: SettingsPermission[] = [
|
|
150
421
|
{
|
|
151
|
-
id: '
|
|
152
|
-
label: '
|
|
153
|
-
description: '
|
|
422
|
+
id: 'calendar',
|
|
423
|
+
label: 'Calendar',
|
|
424
|
+
description: 'Shows your events and counts down to the next one.',
|
|
425
|
+
granted: true,
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
id: 'location',
|
|
429
|
+
label: 'Location',
|
|
430
|
+
description: 'Finds the weather where you are; a city in Weather needs none.',
|
|
154
431
|
granted: false,
|
|
155
432
|
},
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
433
|
+
{
|
|
434
|
+
id: 'automation',
|
|
435
|
+
label: 'Automation',
|
|
436
|
+
description: "Reads and controls a player when macOS doesn't report what plays.",
|
|
437
|
+
},
|
|
159
438
|
]
|
|
160
439
|
|
|
161
440
|
export const ABOUT: AboutRow[] = [
|
package/mock/system.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Mock: a busy minute on a laptop for the System widget, readings with
|
|
3
|
+
* memory pressure, the battery, the disk, the uptime and the busiest
|
|
4
|
+
* processes. Nothing here ships in the barrel.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { StatsBattery, StatsDisk, StatsProcess, StatsSample } from '../blocks/system/system-stats'
|
|
8
|
+
|
|
9
|
+
const wave = (i: number, base: number, swing: number) =>
|
|
10
|
+
base + swing * Math.sin(i / 2.4) + swing * 0.4 * Math.sin(i * 1.7)
|
|
11
|
+
|
|
12
|
+
const clamp = (v: number) => Math.min(1, Math.max(0.02, v))
|
|
13
|
+
|
|
14
|
+
/** Forty readings a second apart, oldest first, CPU climbing toward the end. */
|
|
15
|
+
export const READINGS: StatsSample[] = Array.from({ length: 40 }, (_, i) => ({
|
|
16
|
+
cpu: clamp(wave(i, 0.3 + i * 0.006, 0.12)),
|
|
17
|
+
memoryUsed: wave(i, 11.4e9, 0.2e9),
|
|
18
|
+
memoryTotal: 16e9,
|
|
19
|
+
memoryPressure: clamp(wave(i, 0.46, 0.04)),
|
|
20
|
+
netIn: Math.max(0, wave(i, 2.4e6, 1.6e6)),
|
|
21
|
+
netOut: Math.max(0, wave(i + 5, 0.4e6, 0.3e6)),
|
|
22
|
+
}))
|
|
23
|
+
|
|
24
|
+
/** Readings with memory nearly full: pressure is the telling figure. */
|
|
25
|
+
export const PRESSURE_READINGS: StatsSample[] = READINGS.map((sample, i) => ({
|
|
26
|
+
...sample,
|
|
27
|
+
memoryUsed: 15.1e9 + 0.2e9 * Math.sin(i / 3),
|
|
28
|
+
memoryPressure: clamp(0.82 + 0.06 * Math.sin(i / 3)),
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
export const BATTERY: StatsBattery = { level: 64, charging: false, minutesLeft: 3 * 60 + 40 }
|
|
32
|
+
|
|
33
|
+
export const CHARGING: StatsBattery = { level: 82, charging: true, minutesLeft: 38 }
|
|
34
|
+
|
|
35
|
+
export const DISK: StatsDisk = { free: 212e9, total: 494e9 }
|
|
36
|
+
|
|
37
|
+
/** Three days, four hours. */
|
|
38
|
+
export const UPTIME = (3 * 24 + 4) * 3600 + 17 * 60
|
|
39
|
+
|
|
40
|
+
export const PROCESSES: StatsProcess[] = [
|
|
41
|
+
{ id: '812', name: 'Xcode', cpu: 0.214, memory: 3.2e9 },
|
|
42
|
+
{ id: '233', name: 'Safari', cpu: 0.087, memory: 1.9e9 },
|
|
43
|
+
{ id: '1043', name: 'WindowServer', cpu: 0.052, memory: 0.6e9 },
|
|
44
|
+
{ id: '97', name: 'Figma', cpu: 0.031, memory: 1.1e9 },
|
|
45
|
+
{ id: '1520', name: 'Music', cpu: 0.012, memory: 0.3e9 },
|
|
46
|
+
]
|
package/mock/weather.tsx
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Mock: a forecast in Open-Meteo's shape for the weather's docs, read at
|
|
3
|
+
* today 14:20, and the island scenes around it. Nothing here ships in the
|
|
4
|
+
* barrel.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import { useState } from 'react'
|
|
10
|
+
import Weather, { type WeatherDay, type WeatherHour, type WeatherNow } from '../blocks/activities/weather'
|
|
11
|
+
import { FlashIsland, WingsIsland } from './screen'
|
|
12
|
+
|
|
13
|
+
const MINUTE = 60_000
|
|
14
|
+
const HOUR = 60 * MINUTE
|
|
15
|
+
|
|
16
|
+
const today = (hours: number, minutes = 0) => new Date().setHours(hours, minutes, 0, 0)
|
|
17
|
+
|
|
18
|
+
/** The moment the forecast is read at: today, 14:20. */
|
|
19
|
+
export const WEATHER_NOW = today(14, 20)
|
|
20
|
+
|
|
21
|
+
export const WEATHER_LOCATION = 'Bratislava'
|
|
22
|
+
|
|
23
|
+
export const CURRENT: WeatherNow = {
|
|
24
|
+
time: WEATHER_NOW - 5 * MINUTE,
|
|
25
|
+
temperature: 18.4,
|
|
26
|
+
apparent: 16.2,
|
|
27
|
+
condition: 'partly-cloudy',
|
|
28
|
+
isDay: true,
|
|
29
|
+
wind: 12,
|
|
30
|
+
humidity: 64,
|
|
31
|
+
uv: 4,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Temperature, condition and chance of rain from 14:00 on: a dry afternoon that turns wet by evening.
|
|
35
|
+
const AFTERNOON: [number, WeatherHour['condition'], number][] = [
|
|
36
|
+
[18.4, 'partly-cloudy', 5],
|
|
37
|
+
[19.1, 'partly-cloudy', 10],
|
|
38
|
+
[18.6, 'cloudy', 20],
|
|
39
|
+
[17.2, 'cloudy', 45],
|
|
40
|
+
[15.8, 'rain', 70],
|
|
41
|
+
[14.9, 'rain', 80],
|
|
42
|
+
[14.1, 'drizzle', 40],
|
|
43
|
+
[13.5, 'cloudy', 20],
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
export const HOURS: WeatherHour[] = AFTERNOON.map(([temperature, condition, precipitation], i) => ({
|
|
47
|
+
time: today(14) + i * HOUR,
|
|
48
|
+
temperature,
|
|
49
|
+
condition,
|
|
50
|
+
isDay: 14 + i < 17,
|
|
51
|
+
precipitation,
|
|
52
|
+
}))
|
|
53
|
+
|
|
54
|
+
/** A clear night: the same strip, read at 22:00. */
|
|
55
|
+
export const NIGHT: { current: WeatherNow; hours: WeatherHour[] } = {
|
|
56
|
+
current: { ...CURRENT, time: today(22), temperature: 9.2, apparent: 7.4, condition: 'clear', isDay: false, uv: 0 },
|
|
57
|
+
hours: Array.from({ length: 6 }, (_, i) => ({
|
|
58
|
+
time: today(22) + i * HOUR,
|
|
59
|
+
temperature: 9 - i * 0.6,
|
|
60
|
+
condition: i < 3 ? 'clear' : 'partly-cloudy',
|
|
61
|
+
isDay: false,
|
|
62
|
+
precipitation: 0,
|
|
63
|
+
})),
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const DAYS: WeatherDay[] = [
|
|
67
|
+
{ date: today(0), condition: 'rain', high: 19.6, low: 11.2, precipitation: 80 },
|
|
68
|
+
{ date: today(24), condition: 'drizzle', high: 16.1, low: 9.4, precipitation: 40 },
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
/** The forecast for `Weather`'s props. */
|
|
72
|
+
export const FORECAST = { location: WEATHER_LOCATION, current: CURRENT, hours: HOURS, days: DAYS, now: WEATHER_NOW }
|
|
73
|
+
|
|
74
|
+
/** The weather in the compact island's wings. */
|
|
75
|
+
export function WeatherWings() {
|
|
76
|
+
return (
|
|
77
|
+
<WingsIsland leading={<Weather.Leading current={CURRENT} />} trailing={<Weather.Trailing current={CURRENT} />} />
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The weather in the wings, a clear night's glyph on the bubble. */
|
|
82
|
+
export function WeatherSplit() {
|
|
83
|
+
return (
|
|
84
|
+
<WingsIsland
|
|
85
|
+
leading={<Weather.Leading current={CURRENT} />}
|
|
86
|
+
trailing={<Weather.Trailing current={CURRENT} />}
|
|
87
|
+
minimal={<Weather.Minimal current={NIGHT.current} />}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Rain a quarter of an hour out, made once. */
|
|
93
|
+
export function RainSoonFlash() {
|
|
94
|
+
const startsAt = useState(() => Date.now() + 15 * MINUTE)[0]
|
|
95
|
+
return (
|
|
96
|
+
<FlashIsland>
|
|
97
|
+
<Weather.Alert
|
|
98
|
+
condition="rain"
|
|
99
|
+
startsAt={startsAt}
|
|
100
|
+
caption="Light rain for about an hour · 70%"
|
|
101
|
+
onAction={() => {}}
|
|
102
|
+
/>
|
|
103
|
+
</FlashIsland>
|
|
104
|
+
)
|
|
105
|
+
}
|