@justanarthur/modo-ui-notch 0.2.0 → 0.4.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 (148) hide show
  1. package/README.md +11 -11
  2. package/blocks/activities/agenda/examples.mdx +29 -5
  3. package/blocks/activities/agenda/index.tsx +438 -181
  4. package/blocks/activities/clock/examples.mdx +89 -0
  5. package/blocks/activities/clock/index.tsx +917 -0
  6. package/blocks/activities/now-playing/examples.mdx +40 -13
  7. package/blocks/activities/now-playing/index.tsx +399 -120
  8. package/blocks/activities/weather/examples.mdx +123 -0
  9. package/blocks/activities/weather/index.tsx +863 -0
  10. package/blocks/app/expanded-island/examples.mdx +8 -7
  11. package/blocks/app/expanded-island/index.tsx +22 -4
  12. package/blocks/app/settings-window/examples.mdx +14 -2
  13. package/blocks/app/settings-window/index.tsx +33 -10
  14. package/blocks/system/clipboard/examples.mdx +91 -0
  15. package/blocks/system/clipboard/index.tsx +773 -0
  16. package/blocks/system/recent-files/examples.mdx +80 -0
  17. package/blocks/system/recent-files/index.tsx +627 -0
  18. package/blocks/system/system-stats/examples.mdx +46 -9
  19. package/blocks/system/system-stats/index.tsx +445 -104
  20. package/components/indicators/media-scrubber/examples.mdx +8 -0
  21. package/components/indicators/media-scrubber/index.tsx +37 -13
  22. package/components/island/island/examples.mdx +4 -4
  23. package/components/island/island/index.tsx +2 -2
  24. package/components/island/island-flash/examples.mdx +15 -18
  25. package/components/island/island-flash/index.tsx +4 -4
  26. package/components/island/island-tabs/examples.mdx +5 -5
  27. package/components/island/widget/examples.mdx +76 -0
  28. package/components/island/widget/index.tsx +465 -0
  29. package/dist/blocks/activities/agenda/index.d.ts +2 -1
  30. package/dist/blocks/activities/agenda/index.js +3 -3
  31. package/dist/blocks/activities/clock/index.d.ts +3 -0
  32. package/dist/blocks/activities/clock/index.js +25 -0
  33. package/dist/blocks/activities/now-playing/index.d.ts +4 -2
  34. package/dist/blocks/activities/now-playing/index.js +5 -3
  35. package/dist/blocks/activities/weather/index.d.ts +3 -0
  36. package/dist/blocks/activities/weather/index.js +21 -0
  37. package/dist/blocks/app/expanded-island/index.d.ts +1 -1
  38. package/dist/blocks/app/expanded-island/index.js +4 -3
  39. package/dist/blocks/app/settings-window/index.d.ts +1 -1
  40. package/dist/blocks/app/settings-window/index.js +1 -1
  41. package/dist/blocks/system/clipboard/index.d.ts +3 -0
  42. package/dist/blocks/system/clipboard/index.js +17 -0
  43. package/dist/blocks/system/recent-files/index.d.ts +3 -0
  44. package/dist/blocks/system/recent-files/index.js +19 -0
  45. package/dist/blocks/system/system-stats/index.d.ts +3 -2
  46. package/dist/blocks/system/system-stats/index.js +4 -1
  47. package/dist/components/indicators/media-scrubber/index.d.ts +1 -1
  48. package/dist/components/indicators/media-scrubber/index.js +1 -1
  49. package/dist/components/island/island/index.d.ts +1 -1
  50. package/dist/components/island/island/index.js +2 -2
  51. package/dist/components/island/island-flash/index.d.ts +1 -1
  52. package/dist/components/island/island-flash/index.js +1 -1
  53. package/dist/components/island/island-tabs/index.js +2 -2
  54. package/dist/components/island/widget/index.d.ts +2 -0
  55. package/dist/components/island/widget/index.js +32 -0
  56. package/dist/index.d.ts +15 -15
  57. package/dist/index.js +104 -58
  58. package/dist/lib/artwork.d.ts +2 -0
  59. package/dist/lib/artwork.js +8 -0
  60. package/dist/lib/geometry.js +1 -1
  61. package/dist/shared/{chunk-yngkkxz2.d.ts → chunk-0ym9mcqc.d.ts} +10 -6
  62. package/dist/shared/chunk-2b6gpn8k.js +444 -0
  63. package/dist/shared/chunk-3hcnf4yx.js +481 -0
  64. package/dist/shared/chunk-42wab62s.d.ts +197 -0
  65. package/dist/shared/{chunk-zvh0d3qb.js → chunk-61t2dfte.js} +1 -1
  66. package/dist/shared/{chunk-9nhpg9t8.d.ts → chunk-6tnq6p89.d.ts} +9 -1
  67. package/dist/shared/{chunk-hpsabfsd.d.ts → chunk-81fpptwp.d.ts} +1 -1
  68. package/dist/shared/chunk-93dtpjz7.js +789 -0
  69. package/dist/shared/{chunk-wwjxs75m.js → chunk-9xtcv3sy.js} +26 -12
  70. package/dist/shared/chunk-a6njb8db.d.ts +129 -0
  71. package/dist/shared/chunk-ab8mdg0n.d.ts +149 -0
  72. package/dist/shared/chunk-evqpf92s.d.ts +168 -0
  73. package/dist/shared/{chunk-6c1jbefs.d.ts → chunk-fexwzycv.d.ts} +3 -3
  74. package/dist/shared/chunk-gcyspvgr.js +582 -0
  75. package/dist/shared/chunk-gejenfap.d.ts +25 -0
  76. package/dist/shared/chunk-gkj0hjrn.d.ts +136 -0
  77. package/dist/shared/{chunk-rr5e0g15.d.ts → chunk-j755a1a5.d.ts} +7 -1
  78. package/dist/shared/chunk-n739am8j.d.ts +112 -0
  79. package/dist/shared/{chunk-78w7qwp0.js → chunk-ndf79pv5.js} +1 -1
  80. package/dist/shared/chunk-nwzpekvy.js +774 -0
  81. package/dist/shared/{chunk-rpfwv3pz.js → chunk-r471sknr.js} +1 -1
  82. package/dist/shared/chunk-sbrtesdg.d.ts +138 -0
  83. package/dist/shared/chunk-swc7dqpw.d.ts +115 -0
  84. package/dist/shared/chunk-t9wqhgzt.js +765 -0
  85. package/dist/shared/chunk-w5h6ay93.js +72 -0
  86. package/dist/shared/{chunk-mp1nx0ez.js → chunk-wayv5rhr.js} +15 -4
  87. package/dist/shared/chunk-wf0jtzhs.js +295 -0
  88. package/dist/shared/{chunk-sbnrhy5m.js → chunk-y0188bbn.js} +2 -2
  89. package/dist/shared/chunk-yq5svpk7.js +524 -0
  90. package/dist/shared/{chunk-s33y1pcq.js → chunk-z3tj1ydg.js} +23 -10
  91. package/dist/styles.css +151 -49
  92. package/index.ts +7 -6
  93. package/lib/artwork.ts +112 -0
  94. package/lib/geometry.ts +1 -1
  95. package/mock/activities.tsx +9 -32
  96. package/mock/artwork.tsx +13 -1
  97. package/mock/clipboard.tsx +113 -0
  98. package/mock/clock.tsx +77 -0
  99. package/mock/data.ts +78 -44
  100. package/mock/files.tsx +83 -0
  101. package/mock/island-content.tsx +79 -122
  102. package/mock/screen.tsx +76 -0
  103. package/mock/settings.tsx +370 -91
  104. package/mock/system.ts +49 -0
  105. package/mock/weather.tsx +135 -0
  106. package/package.json +7 -2
  107. package/blocks/activities/shelf/examples.mdx +0 -33
  108. package/blocks/activities/shelf/index.tsx +0 -289
  109. package/blocks/activities/timer/examples.mdx +0 -52
  110. package/blocks/activities/timer/index.tsx +0 -292
  111. package/blocks/system/controls/examples.mdx +0 -34
  112. package/blocks/system/controls/index.tsx +0 -167
  113. package/blocks/system/devices/examples.mdx +0 -25
  114. package/blocks/system/devices/index.tsx +0 -172
  115. package/blocks/system/power-alert/examples.mdx +0 -32
  116. package/blocks/system/power-alert/index.tsx +0 -89
  117. package/components/indicators/battery-glyph/examples.mdx +0 -22
  118. package/components/indicators/battery-glyph/index.tsx +0 -91
  119. package/dist/blocks/activities/shelf/index.d.ts +0 -2
  120. package/dist/blocks/activities/shelf/index.js +0 -14
  121. package/dist/blocks/activities/timer/index.d.ts +0 -2
  122. package/dist/blocks/activities/timer/index.js +0 -19
  123. package/dist/blocks/system/controls/index.d.ts +0 -2
  124. package/dist/blocks/system/controls/index.js +0 -10
  125. package/dist/blocks/system/devices/index.d.ts +0 -2
  126. package/dist/blocks/system/devices/index.js +0 -12
  127. package/dist/blocks/system/power-alert/index.d.ts +0 -2
  128. package/dist/blocks/system/power-alert/index.js +0 -9
  129. package/dist/components/indicators/battery-glyph/index.d.ts +0 -2
  130. package/dist/components/indicators/battery-glyph/index.js +0 -9
  131. package/dist/shared/chunk-2qpcsv5h.d.ts +0 -45
  132. package/dist/shared/chunk-45gytfr1.d.ts +0 -84
  133. package/dist/shared/chunk-50ffk4r7.d.ts +0 -69
  134. package/dist/shared/chunk-5w0yck07.d.ts +0 -32
  135. package/dist/shared/chunk-7hr53mby.js +0 -116
  136. package/dist/shared/chunk-b8jb1w72.js +0 -145
  137. package/dist/shared/chunk-cpewy6yg.js +0 -178
  138. package/dist/shared/chunk-e3e4s4ds.d.ts +0 -77
  139. package/dist/shared/chunk-enm6td0p.js +0 -280
  140. package/dist/shared/chunk-fvedaas2.d.ts +0 -33
  141. package/dist/shared/chunk-gex38j8x.d.ts +0 -82
  142. package/dist/shared/chunk-hwtxpzg0.js +0 -69
  143. package/dist/shared/chunk-phb53x1f.js +0 -252
  144. package/dist/shared/chunk-r8esmjfs.d.ts +0 -42
  145. package/dist/shared/chunk-rcp1g9ca.js +0 -70
  146. package/dist/shared/chunk-rx9sphz2.js +0 -266
  147. package/dist/shared/chunk-xdeek16r.d.ts +0 -58
  148. 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 Radio from '@justanarthur/modo-ui/components/inputs/radio'
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
- function AlertSwitches() {
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
- <Switch.Group>
32
- <Switch label="Charging" description="When you plug in a charger." defaultChecked />
33
- <Switch label="On battery" description="When you unplug the charger." defaultChecked />
34
- <Switch label="Low battery" description="Once when the battery drops to 20%." defaultChecked />
35
- <Switch label="Critically low battery" description="Once when the battery drops to 10%." defaultChecked />
36
- </Switch.Group>
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
- function CalendarSettings() {
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
- <div className="flex flex-col gap-6">
43
- <div className="flex flex-col gap-2">
44
- <span className="text-body text-muted-foreground">Show the countdown</span>
45
- <Radio.Group defaultValue="10">
46
- {[5, 10, 15].map(m => (
47
- <Radio key={m} value={String(m)} label={`${m} minutes before`} />
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
- </Radio.Group>
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
- <Switch.Group>
52
- <Switch
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="Expands the island when an event is about to start."
148
+ description="Drops the island open with the event and Join when it has a call link."
55
149
  defaultChecked
56
150
  />
57
- </Switch.Group>
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 HudSettings() {
63
- const [on, setOn] = useState(true)
216
+ function ClockSettings() {
217
+ const [zones, setZones] = useState(ZONES)
64
218
  return (
65
- <div className="flex flex-col gap-4">
66
- <Switch.Group>
67
- <Switch
68
- label="Replace system volume & brightness HUD"
69
- description="Volume, brightness and keyboard backlight keys show their level in the island."
70
- checked={on}
71
- onCheckedChange={setOn}
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
- </Switch.Group>
74
- {on && (
75
- <div className="flex items-center justify-between gap-4 rounded-xl bg-status-warning/16 px-4 py-3">
76
- <div className="flex min-w-0 flex-col">
77
- <span className="text-body weight-medium text-foreground">Needs Accessibility</span>
78
- <span className="text-caption text-muted-foreground">
79
- Allow the app under Privacy & Security › Accessibility so it can take over the keys.
80
- </span>
81
- </div>
82
- <Button className="shrink-0" variant="secondary" size="compact">
83
- Open Settings
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
- </div>
86
- )}
87
- </div>
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 one(label: string, description: string, defaultChecked = false): ReactNode {
336
+ function RecentFilesSettings() {
92
337
  return (
93
- <Switch.Group>
94
- <Switch label={label} description={description} defaultChecked={defaultChecked} />
95
- </Switch.Group>
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: one('Announce track changes', 'Shows the new track for a moment while the island is collapsed.'),
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: 'controls',
131
- name: 'Controls',
132
- description: 'Volume and brightness, and their HUD.',
133
- icon: SlidersHorizontal,
134
- settings: <HudSettings />,
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: 'stats',
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 network load.',
400
+ description: 'CPU, memory, battery and the busiest processes.',
141
401
  icon: Activity,
142
- settings: one(
143
- 'Show CPU load beside the notch',
144
- 'Keeps sampling while it shows; otherwise only while the widget is open.',
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: 'accessibility',
152
- label: 'Accessibility',
153
- description: 'Replaces the volume and brightness HUD with the island.',
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
- { id: 'calendar', label: 'Calendar', description: 'Shows upcoming events.', granted: true },
157
- { id: 'bluetooth', label: 'Bluetooth', description: 'Announces connected devices and their battery.', granted: true },
158
- { id: 'automation', label: 'Automation', description: 'Controls the apps that play media.' },
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,49 @@
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
+ { id: '644', name: 'Slack', cpu: 0.019, memory: 0.8e9 },
47
+ { id: '388', name: 'mds_stores', cpu: 0.024, memory: 0.2e9 },
48
+ { id: '0', name: 'kernel_task', cpu: 0.041, memory: 2.1e9 },
49
+ ]