@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.
- package/LICENSE +21 -0
- package/README.md +75 -2
- package/blocks/activities/agenda/examples.mdx +74 -0
- package/blocks/activities/agenda/index.tsx +441 -0
- package/blocks/activities/clock/examples.mdx +73 -0
- package/blocks/activities/clock/index.tsx +619 -0
- package/blocks/activities/now-playing/examples.mdx +68 -0
- package/blocks/activities/now-playing/index.tsx +411 -0
- package/blocks/activities/weather/examples.mdx +115 -0
- package/blocks/activities/weather/index.tsx +634 -0
- package/blocks/app/expanded-island/examples.mdx +46 -0
- package/blocks/app/expanded-island/index.tsx +143 -0
- package/blocks/app/settings-window/examples.mdx +34 -0
- package/blocks/app/settings-window/index.tsx +375 -0
- 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 +52 -0
- package/blocks/system/system-stats/index.tsx +312 -0
- package/components/indicators/countdown/examples.mdx +25 -0
- package/components/indicators/countdown/index.tsx +83 -0
- package/components/indicators/equalizer/examples.mdx +20 -0
- package/components/indicators/equalizer/index.tsx +116 -0
- package/components/indicators/media-scrubber/examples.mdx +29 -0
- package/components/indicators/media-scrubber/index.tsx +122 -0
- package/components/island/island/examples.mdx +57 -0
- package/components/island/island/index.tsx +415 -0
- package/components/island/island-flash/examples.mdx +52 -0
- package/components/island/island-flash/index.tsx +79 -0
- package/components/island/island-tabs/examples.mdx +53 -0
- package/components/island/island-tabs/index.tsx +285 -0
- package/components/island/widget/examples.mdx +76 -0
- package/components/island/widget/index.tsx +431 -0
- package/dist/blocks/activities/agenda/index.d.ts +2 -0
- package/dist/blocks/activities/agenda/index.js +21 -0
- 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 -0
- package/dist/blocks/activities/now-playing/index.js +24 -0
- 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 +3 -0
- package/dist/blocks/app/expanded-island/index.js +11 -0
- package/dist/blocks/app/settings-window/index.d.ts +2 -0
- package/dist/blocks/app/settings-window/index.js +7 -0
- 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 -0
- package/dist/blocks/system/system-stats/index.js +15 -0
- package/dist/components/indicators/countdown/index.d.ts +2 -0
- package/dist/components/indicators/countdown/index.js +8 -0
- package/dist/components/indicators/equalizer/index.d.ts +2 -0
- package/dist/components/indicators/equalizer/index.js +7 -0
- package/dist/components/indicators/media-scrubber/index.d.ts +2 -0
- package/dist/components/indicators/media-scrubber/index.js +8 -0
- package/dist/components/island/island/index.d.ts +3 -0
- package/dist/components/island/island/index.js +10 -0
- package/dist/components/island/island-flash/index.d.ts +2 -0
- package/dist/components/island/island-flash/index.js +7 -0
- package/dist/components/island/island-tabs/index.d.ts +2 -0
- package/dist/components/island/island-tabs/index.js +9 -0
- package/dist/components/island/widget/index.d.ts +2 -0
- package/dist/components/island/widget/index.js +30 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +195 -0
- package/dist/lib/artwork.d.ts +2 -0
- package/dist/lib/artwork.js +8 -0
- package/dist/lib/clock.d.ts +2 -0
- package/dist/lib/clock.js +14 -0
- package/dist/lib/geometry.d.ts +2 -0
- package/dist/lib/geometry.js +24 -0
- package/dist/lib/island-context.d.ts +3 -0
- package/dist/lib/island-context.js +8 -0
- package/dist/lib/motion.d.ts +21 -0
- package/dist/lib/motion.js +16 -0
- package/dist/shared/chunk-152gpyq3.d.ts +13 -0
- package/dist/shared/chunk-2818esrq.d.ts +140 -0
- package/dist/shared/chunk-2f7zxrbk.js +65 -0
- package/dist/shared/chunk-2m5dz8nf.d.ts +88 -0
- package/dist/shared/chunk-2s4q6mt0.js +27 -0
- package/dist/shared/chunk-3thgcfcq.d.ts +151 -0
- package/dist/shared/chunk-416tsgbc.d.ts +175 -0
- package/dist/shared/chunk-502rmtap.js +54 -0
- package/dist/shared/chunk-52gb3g6r.d.ts +12 -0
- package/dist/shared/chunk-5en5aaj1.d.ts +33 -0
- package/dist/shared/chunk-61t2dfte.js +63 -0
- package/dist/shared/chunk-7fvnrtz4.d.ts +105 -0
- package/dist/shared/chunk-81fpptwp.d.ts +75 -0
- package/dist/shared/chunk-9c7ewvkk.js +381 -0
- package/dist/shared/chunk-9m0xbg5v.js +112 -0
- package/dist/shared/chunk-9xtcv3sy.js +88 -0
- package/dist/shared/chunk-bvtyjcce.d.ts +123 -0
- package/dist/shared/chunk-cc9nwbtf.js +315 -0
- package/dist/shared/chunk-cfzmfnyh.d.ts +63 -0
- package/dist/shared/chunk-d5qm9cps.js +10 -0
- package/dist/shared/chunk-da177e8r.d.ts +114 -0
- package/dist/shared/chunk-fexwzycv.d.ts +36 -0
- package/dist/shared/chunk-gb56m10p.js +39 -0
- package/dist/shared/chunk-gejenfap.d.ts +25 -0
- package/dist/shared/chunk-hrpxbqmx.d.ts +28 -0
- package/dist/shared/chunk-j755a1a5.d.ts +41 -0
- package/dist/shared/chunk-j77cx8dp.js +498 -0
- package/dist/shared/chunk-mt0k6v8x.js +474 -0
- package/dist/shared/chunk-ndf79pv5.js +58 -0
- package/dist/shared/chunk-pfhy5e4q.d.ts +53 -0
- package/dist/shared/chunk-qdzemt2v.js +477 -0
- package/dist/shared/chunk-r471sknr.js +209 -0
- package/dist/shared/chunk-s2jeqqan.js +243 -0
- package/dist/shared/chunk-t0hcxh89.d.ts +124 -0
- package/dist/shared/chunk-w48eyvfr.d.ts +56 -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-y0188bbn.js +331 -0
- package/dist/shared/chunk-ym0xbses.js +518 -0
- package/dist/styles.css +264 -0
- package/index.ts +22 -0
- package/lib/artwork.ts +112 -0
- package/lib/clock.ts +53 -0
- package/lib/geometry.ts +130 -0
- package/lib/island-context.tsx +24 -0
- package/lib/motion.ts +42 -0
- package/mock/activities.tsx +77 -0
- package/mock/artwork.tsx +37 -0
- package/mock/clipboard.tsx +79 -0
- package/mock/clock.tsx +77 -0
- package/mock/data.ts +139 -0
- package/mock/desktop.tsx +83 -0
- package/mock/files.tsx +70 -0
- package/mock/fit.ts +26 -0
- package/mock/island-content.tsx +142 -0
- package/mock/scene.tsx +52 -0
- package/mock/screen.tsx +76 -0
- package/mock/settings.tsx +489 -0
- package/mock/system.ts +46 -0
- package/mock/weather.tsx +105 -0
- package/package.json +122 -4
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Mock: the settings window's data for the docs, the plugins with their own
|
|
3
|
+
* settings, the permissions and the about rows, and a window frame made of
|
|
4
|
+
* tokens that scales down to the column it gets. Nothing here ships in the
|
|
5
|
+
* barrel.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use client'
|
|
9
|
+
|
|
10
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
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'
|
|
14
|
+
import Switch from '@justanarthur/modo-ui/components/inputs/switch'
|
|
15
|
+
import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
|
|
16
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
17
|
+
import { Activity, CalendarDays, ClipboardList, Clock3, CloudSun, FolderDown, MapPin, Music, X } from 'lucide-react'
|
|
18
|
+
import { type ReactNode, useState } from 'react'
|
|
19
|
+
import type { AboutRow, SettingsPermission, SettingsPlugin } from '../blocks/app/settings-window'
|
|
20
|
+
import { ZONES } from './clock'
|
|
21
|
+
import { useFitScale } from './fit'
|
|
22
|
+
|
|
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
|
+
}) {
|
|
42
|
+
return (
|
|
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>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
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
|
+
}) {
|
|
71
|
+
return (
|
|
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>
|
|
80
|
+
))}
|
|
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>
|
|
106
|
+
</div>
|
|
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
|
|
147
|
+
label="Alert a minute before"
|
|
148
|
+
description="Drops the island open with the event and Join when it has a call link."
|
|
149
|
+
defaultChecked
|
|
150
|
+
/>
|
|
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>
|
|
212
|
+
</div>
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function ClockSettings() {
|
|
217
|
+
const [zones, setZones] = useState(ZONES)
|
|
218
|
+
return (
|
|
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"
|
|
229
|
+
/>
|
|
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
|
|
244
|
+
</Button>
|
|
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>
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function RecentFilesSettings() {
|
|
337
|
+
return (
|
|
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>
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export const PLUGINS: SettingsPlugin[] = [
|
|
369
|
+
{
|
|
370
|
+
id: 'now-playing',
|
|
371
|
+
name: 'Now Playing',
|
|
372
|
+
description: 'What plays in Music, Spotify or a browser.',
|
|
373
|
+
icon: Music,
|
|
374
|
+
settings: <NowPlayingSettings />,
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
id: 'calendar',
|
|
378
|
+
name: 'Calendar',
|
|
379
|
+
description: 'Today and tomorrow, and a countdown to the next event.',
|
|
380
|
+
icon: CalendarDays,
|
|
381
|
+
settings: <CalendarSettings />,
|
|
382
|
+
},
|
|
383
|
+
{
|
|
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 />,
|
|
389
|
+
},
|
|
390
|
+
{
|
|
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',
|
|
399
|
+
name: 'System',
|
|
400
|
+
description: 'CPU, memory, battery and the busiest processes.',
|
|
401
|
+
icon: Activity,
|
|
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 />,
|
|
417
|
+
},
|
|
418
|
+
]
|
|
419
|
+
|
|
420
|
+
export const PERMISSIONS: SettingsPermission[] = [
|
|
421
|
+
{
|
|
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.',
|
|
431
|
+
granted: false,
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
id: 'automation',
|
|
435
|
+
label: 'Automation',
|
|
436
|
+
description: "Reads and controls a player when macOS doesn't report what plays.",
|
|
437
|
+
},
|
|
438
|
+
]
|
|
439
|
+
|
|
440
|
+
export const ABOUT: AboutRow[] = [
|
|
441
|
+
{ label: 'Version', value: '1.4.0' },
|
|
442
|
+
{ label: 'Mode', value: 'Release' },
|
|
443
|
+
{ label: 'Screen', value: '1512 × 982 panel, hardware notch' },
|
|
444
|
+
]
|
|
445
|
+
|
|
446
|
+
const LIGHTS = ['bg-status-error', 'bg-status-warning', 'bg-status-success']
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* A desktop window's frame for the docs: traffic lights and a title over the
|
|
450
|
+
* content, laid out at a fixed size and scaled down whole to the width it
|
|
451
|
+
* gets, so the window keeps its proportions in a narrow column.
|
|
452
|
+
*/
|
|
453
|
+
export function MockWindow({
|
|
454
|
+
title,
|
|
455
|
+
width = 760,
|
|
456
|
+
height = 520,
|
|
457
|
+
children,
|
|
458
|
+
}: {
|
|
459
|
+
title?: string
|
|
460
|
+
width?: number
|
|
461
|
+
height?: number
|
|
462
|
+
children: ReactNode
|
|
463
|
+
}) {
|
|
464
|
+
const shape = useShape()
|
|
465
|
+
const { outer, scale } = useFitScale(width)
|
|
466
|
+
return (
|
|
467
|
+
<div ref={outer} className="w-full" style={{ height: height * scale }}>
|
|
468
|
+
<div
|
|
469
|
+
className={cn(
|
|
470
|
+
'mx-auto flex flex-col overflow-hidden border border-border bg-background shadow-surface-5',
|
|
471
|
+
shape.container,
|
|
472
|
+
)}
|
|
473
|
+
style={{ width, height, zoom: scale }}
|
|
474
|
+
>
|
|
475
|
+
<div className="relative flex h-9 shrink-0 items-center gap-2 border-b border-border px-3.5">
|
|
476
|
+
{LIGHTS.map(light => (
|
|
477
|
+
<span key={light} aria-hidden className={cn('size-3 rounded-full', light)} />
|
|
478
|
+
))}
|
|
479
|
+
{title && (
|
|
480
|
+
<span className="pointer-events-none absolute inset-x-0 text-center text-body weight-medium text-foreground">
|
|
481
|
+
{title}
|
|
482
|
+
</span>
|
|
483
|
+
)}
|
|
484
|
+
</div>
|
|
485
|
+
<div className="min-h-0 flex-1">{children}</div>
|
|
486
|
+
</div>
|
|
487
|
+
</div>
|
|
488
|
+
)
|
|
489
|
+
}
|
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
|
+
}
|