@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/clock.tsx
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Mock: world clocks and Pomodoro runs for the clock's docs, and the island
|
|
3
|
+
* scenes around them. Runs are made once, on mount, so they keep counting
|
|
4
|
+
* down across renders. Nothing here ships in the barrel.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import { useState } from 'react'
|
|
10
|
+
import Clock, { type ClockZone, type PomodoroRun } from '../blocks/activities/clock'
|
|
11
|
+
import NowPlaying from '../blocks/activities/now-playing'
|
|
12
|
+
import { PLAYING } from './artwork'
|
|
13
|
+
import { FlashIsland, WingsIsland } from './screen'
|
|
14
|
+
|
|
15
|
+
const MINUTE = 60_000
|
|
16
|
+
|
|
17
|
+
/** The moment the clock shows: today, 16:42. */
|
|
18
|
+
export const CLOCK_NOW = new Date().setHours(16, 42, 0, 0)
|
|
19
|
+
|
|
20
|
+
export const ZONES: ClockZone[] = [
|
|
21
|
+
{ city: 'New York', timeZone: 'America/New_York' },
|
|
22
|
+
{ city: 'San Francisco', timeZone: 'America/Los_Angeles' },
|
|
23
|
+
{ city: 'Tokyo', timeZone: 'Asia/Tokyo' },
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
/** A run of `phase` with `left` of its length to go, running unless `paused`. */
|
|
27
|
+
export function pomodoroRun(
|
|
28
|
+
phase: PomodoroRun['phase'] = 'focus',
|
|
29
|
+
{ round = 2, minutes = 25, left = 0.62, paused = false } = {},
|
|
30
|
+
): PomodoroRun {
|
|
31
|
+
const total = minutes * MINUTE
|
|
32
|
+
return paused
|
|
33
|
+
? { phase, round, total, remaining: left * total }
|
|
34
|
+
: { phase, round, total, endsAt: Date.now() + left * total }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** A run made once, when the component mounts. */
|
|
38
|
+
export function useRun(...args: Parameters<typeof pomodoroRun>) {
|
|
39
|
+
return useState(() => pomodoroRun(...args))[0]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The clock in focus, round 2 of 4, 62% to go. */
|
|
43
|
+
export function FocusClock() {
|
|
44
|
+
return <Clock zones={ZONES} defaultValue={useRun()} />
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** A short break, paused with half of it left. */
|
|
48
|
+
export function PausedBreak() {
|
|
49
|
+
return <Clock zones={ZONES} defaultValue={useRun('short-break', { minutes: 5, left: 0.5, paused: true })} />
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The Pomodoro in the compact island's wings. */
|
|
53
|
+
export function ClockWings() {
|
|
54
|
+
const run = useRun()
|
|
55
|
+
return <WingsIsland leading={<Clock.Leading run={run} />} trailing={<Clock.Trailing run={run} />} />
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Music in the wings, the Pomodoro's ring on the bubble. */
|
|
59
|
+
export function ClockSplit() {
|
|
60
|
+
const run = useRun('short-break', { minutes: 5, left: 0.7 })
|
|
61
|
+
return (
|
|
62
|
+
<WingsIsland
|
|
63
|
+
leading={<NowPlaying.Leading track={PLAYING} />}
|
|
64
|
+
trailing={<NowPlaying.Trailing track={PLAYING} />}
|
|
65
|
+
minimal={<Clock.Minimal run={run} />}
|
|
66
|
+
/>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The flash at the end of a phase. */
|
|
71
|
+
export function PhaseDoneFlash({ ended }: { ended: Pick<PomodoroRun, 'phase' | 'round'> }) {
|
|
72
|
+
return (
|
|
73
|
+
<FlashIsland activity={`${ended.phase}-${ended.round}`}>
|
|
74
|
+
<Clock.PhaseDone ended={ended} onStart={() => {}} />
|
|
75
|
+
</FlashIsland>
|
|
76
|
+
)
|
|
77
|
+
}
|
package/mock/data.ts
CHANGED
|
@@ -3,11 +3,8 @@
|
|
|
3
3
|
* and examples read it; nothing here ships in the barrel.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Activity, CalendarDays,
|
|
6
|
+
import { Activity, CalendarDays, ClipboardList, Clock3, CloudSun, FolderDown, Music } from 'lucide-react'
|
|
7
7
|
import type { AgendaEvent } from '../blocks/activities/agenda'
|
|
8
|
-
import type { ShelfFile } from '../blocks/activities/shelf'
|
|
9
|
-
import type { DeviceInfo } from '../blocks/system/devices'
|
|
10
|
-
import type { StatsSample } from '../blocks/system/system-stats'
|
|
11
8
|
import type { IslandTab } from '../components/island/island-tabs'
|
|
12
9
|
|
|
13
10
|
export interface Track {
|
|
@@ -15,6 +12,8 @@ export interface Track {
|
|
|
15
12
|
artist: string
|
|
16
13
|
album: string
|
|
17
14
|
source: string
|
|
15
|
+
output: string
|
|
16
|
+
outputKind: 'built-in' | 'headphones' | 'speaker' | 'airplay'
|
|
18
17
|
/** Seconds. */
|
|
19
18
|
duration: number
|
|
20
19
|
/** Seconds. */
|
|
@@ -26,20 +25,36 @@ export const TRACK: Track = {
|
|
|
26
25
|
artist: 'M83',
|
|
27
26
|
album: "Hurry Up, We're Dreaming",
|
|
28
27
|
source: 'Music',
|
|
28
|
+
output: 'AirPods Pro',
|
|
29
|
+
outputKind: 'headphones',
|
|
29
30
|
duration: 243,
|
|
30
31
|
position: 71,
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export const TRACKS: Track[] = [
|
|
34
35
|
TRACK,
|
|
35
|
-
{
|
|
36
|
-
|
|
36
|
+
{
|
|
37
|
+
title: 'Teardrop',
|
|
38
|
+
artist: 'Massive Attack',
|
|
39
|
+
album: 'Mezzanine',
|
|
40
|
+
source: 'Spotify',
|
|
41
|
+
output: 'Living room',
|
|
42
|
+
outputKind: 'airplay',
|
|
43
|
+
duration: 330,
|
|
44
|
+
position: 12,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: 'Nightcall',
|
|
48
|
+
artist: 'Kavinsky',
|
|
49
|
+
album: 'OutRun',
|
|
50
|
+
source: 'Safari',
|
|
51
|
+
output: 'MacBook Pro Speakers',
|
|
52
|
+
outputKind: 'built-in',
|
|
53
|
+
duration: 258,
|
|
54
|
+
position: 190,
|
|
55
|
+
},
|
|
37
56
|
]
|
|
38
57
|
|
|
39
|
-
export const POWER = { level: 82, charging: true, untilFull: 38, remaining: 252 }
|
|
40
|
-
|
|
41
|
-
export const TIMER = { label: 'Focus', minutes: 25 }
|
|
42
|
-
|
|
43
58
|
const MINUTE = 60_000
|
|
44
59
|
const at = (day: number, hours: number, minutes: number) => {
|
|
45
60
|
const date = new Date()
|
|
@@ -110,44 +125,15 @@ export function soonEvent(minutes = 4): AgendaEvent {
|
|
|
110
125
|
}
|
|
111
126
|
}
|
|
112
127
|
|
|
113
|
-
export const DEVICES: DeviceInfo[] = [
|
|
114
|
-
{ id: 'airpods', name: 'AirPods Pro', kind: 'headphones', connected: true, battery: 74 },
|
|
115
|
-
{ id: 'keyboard', name: 'Magic Keyboard', kind: 'keyboard', connected: true, battery: 18 },
|
|
116
|
-
{ id: 'mouse', name: 'Magic Mouse', kind: 'mouse', connected: false },
|
|
117
|
-
{ id: 'controller', name: 'DualSense', kind: 'gamepad', connected: true, battery: 56, charging: true },
|
|
118
|
-
{ id: 'speaker', name: 'Living room', kind: 'speaker', connected: false },
|
|
119
|
-
]
|
|
120
|
-
|
|
121
|
-
export const FILES: ShelfFile[] = [
|
|
122
|
-
{ id: 'brief', name: 'Island brief.pdf' },
|
|
123
|
-
{ id: 'cover', name: 'Cover.png' },
|
|
124
|
-
{ id: 'notes', name: 'Notes.md' },
|
|
125
|
-
{ id: 'demo', name: 'Demo.mov' },
|
|
126
|
-
{ id: 'archive', name: 'Assets.zip' },
|
|
127
|
-
{ id: 'theme', name: 'theme.ts' },
|
|
128
|
-
]
|
|
129
|
-
|
|
130
|
-
const wave = (i: number, base: number, swing: number) =>
|
|
131
|
-
base + swing * Math.sin(i / 2.4) + swing * 0.4 * Math.sin(i * 1.7)
|
|
132
|
-
|
|
133
|
-
/** Thirty seconds of samples, oldest first. */
|
|
134
|
-
export const SAMPLES: StatsSample[] = Array.from({ length: 30 }, (_, i) => ({
|
|
135
|
-
cpu: Math.min(1, Math.max(0.02, wave(i, 0.32, 0.14))),
|
|
136
|
-
memoryUsed: wave(i, 11.2e9, 0.25e9),
|
|
137
|
-
memoryTotal: 16e9,
|
|
138
|
-
netIn: Math.max(0, wave(i, 2.4e6, 1.6e6)),
|
|
139
|
-
netOut: Math.max(0, wave(i + 5, 0.4e6, 0.3e6)),
|
|
140
|
-
}))
|
|
141
|
-
|
|
142
128
|
/** The open island's tabs: one per widget. */
|
|
143
129
|
export const TABS: IslandTab[] = [
|
|
144
130
|
{ value: 'now-playing', label: 'Now Playing', icon: Music },
|
|
145
|
-
{ value: 'timer', label: 'Timer', icon: Timer },
|
|
146
131
|
{ value: 'calendar', label: 'Calendar', icon: CalendarDays },
|
|
147
|
-
{ value: '
|
|
148
|
-
{ value: '
|
|
149
|
-
{ value: '
|
|
150
|
-
{ value: '
|
|
132
|
+
{ value: 'weather', label: 'Weather', icon: CloudSun },
|
|
133
|
+
{ value: 'clock', label: 'Clock', icon: Clock3 },
|
|
134
|
+
{ value: 'system', label: 'System', icon: Activity },
|
|
135
|
+
{ value: 'clipboard', label: 'Clipboard', icon: ClipboardList },
|
|
136
|
+
{ value: 'files', label: 'Recent files', icon: FolderDown },
|
|
151
137
|
]
|
|
152
138
|
|
|
153
139
|
export const MENUS = ['Finder', 'File', 'Edit', 'View', 'Go', 'Window', 'Help']
|
package/mock/files.tsx
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Mock: a Downloads folder and a Screenshots folder for the recent-files
|
|
3
|
+
* widget, read at a pinned moment so the times hold, and a download under
|
|
4
|
+
* way. Nothing here ships in the barrel.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { RecentDownload, RecentFile } from '../blocks/system/recent-files'
|
|
8
|
+
import { MockArtwork } from './artwork'
|
|
9
|
+
|
|
10
|
+
const MINUTE = 60_000
|
|
11
|
+
|
|
12
|
+
/** The moment the folders are read at. */
|
|
13
|
+
export const FILES_NOW = new Date(2026, 10, 17, 15, 42).getTime()
|
|
14
|
+
|
|
15
|
+
const ago = (minutes: number) => FILES_NOW - minutes * MINUTE
|
|
16
|
+
|
|
17
|
+
export const DOWNLOADS: RecentFile[] = [
|
|
18
|
+
{
|
|
19
|
+
id: 'report',
|
|
20
|
+
name: 'Quarterly report.pdf',
|
|
21
|
+
size: 2.4e6,
|
|
22
|
+
addedAt: ago(0),
|
|
23
|
+
source: 'downloads',
|
|
24
|
+
from: 'drive.google.com',
|
|
25
|
+
},
|
|
26
|
+
{ id: 'kit', name: 'modo-ui-notch-0.2.0.tgz', size: 84e3, addedAt: ago(12), source: 'downloads', from: 'npmjs.com' },
|
|
27
|
+
{ id: 'demo', name: 'Demo.mov', size: 182e6, addedAt: ago(48), source: 'downloads', from: 'wetransfer.com' },
|
|
28
|
+
{
|
|
29
|
+
id: 'cover',
|
|
30
|
+
name: 'Cover.png',
|
|
31
|
+
size: 1.1e6,
|
|
32
|
+
addedAt: ago(130),
|
|
33
|
+
source: 'downloads',
|
|
34
|
+
thumbnail: <MockArtwork variant="dusk" />,
|
|
35
|
+
},
|
|
36
|
+
{ id: 'assets', name: 'Assets.zip', size: 36e6, addedAt: ago(26 * 60), source: 'downloads' },
|
|
37
|
+
{ id: 'inter', name: 'Inter-4.1.zip', size: 18e6, addedAt: ago(3 * 24 * 60), source: 'downloads' },
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
const pad = (n: number) => String(n).padStart(2, '0')
|
|
41
|
+
|
|
42
|
+
/** The name macOS gives a screenshot: `Screenshot 2026-11-17 at 15.39.00.png`. */
|
|
43
|
+
function shotName(ms: number) {
|
|
44
|
+
const d = new Date(ms)
|
|
45
|
+
return `Screenshot ${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} at ${d.getHours()}.${pad(d.getMinutes())}.${pad(d.getSeconds())}.png`
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const VARIANTS = ['aurora', 'dusk', 'night'] as const
|
|
49
|
+
|
|
50
|
+
export const SCREENSHOTS: RecentFile[] = [3, 15, 22, 64, 140, 300, 1500].map((minutes, i) => ({
|
|
51
|
+
id: `shot-${i}`,
|
|
52
|
+
name: shotName(ago(minutes)),
|
|
53
|
+
size: (1.2 + i * 0.35) * 1e6,
|
|
54
|
+
addedAt: ago(minutes),
|
|
55
|
+
source: 'screenshots',
|
|
56
|
+
thumbnail: <MockArtwork variant={VARIANTS[i % VARIANTS.length]} />,
|
|
57
|
+
}))
|
|
58
|
+
|
|
59
|
+
/** Both folders. */
|
|
60
|
+
export const RECENT_FILES: RecentFile[] = [...DOWNLOADS, ...SCREENSHOTS]
|
|
61
|
+
|
|
62
|
+
/** A download under way: 40% in, 6.2 MB/s. */
|
|
63
|
+
export const DOWNLOAD: RecentDownload = {
|
|
64
|
+
id: 'wallpapers',
|
|
65
|
+
name: 'Wallpapers 4K.zip',
|
|
66
|
+
received: 48e6,
|
|
67
|
+
total: 120e6,
|
|
68
|
+
rate: 6.2e6,
|
|
69
|
+
from: 'unsplash.com',
|
|
70
|
+
}
|
package/mock/island-content.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Mock: what the docs put in the island, on the kit's blocks and mock data:
|
|
3
|
-
* the now-playing wings, a
|
|
4
|
-
* island with a tab per widget. Pages and examples start from
|
|
5
|
-
* here ships in the barrel.
|
|
3
|
+
* the now-playing wings, a Pomodoro ring in the bubble, a download's flash
|
|
4
|
+
* and the open island with a tab per widget. Pages and examples start from
|
|
5
|
+
* these; nothing here ships in the barrel.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
'use client'
|
|
@@ -11,69 +11,59 @@ import Tabs from '@justanarthur/modo-ui/components/navigation/tabs'
|
|
|
11
11
|
import { useSize } from '@justanarthur/modo-ui/lib/size-context'
|
|
12
12
|
import { type ReactNode, useState } from 'react'
|
|
13
13
|
import Agenda from '../blocks/activities/agenda'
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
14
|
+
import Clock from '../blocks/activities/clock'
|
|
15
|
+
import NowPlaying from '../blocks/activities/now-playing'
|
|
16
|
+
import Weather from '../blocks/activities/weather'
|
|
17
17
|
import ExpandedIsland, { type ExpandedIslandTab } from '../blocks/app/expanded-island'
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import PowerAlert from '../blocks/system/power-alert'
|
|
18
|
+
import ClipboardHistory from '../blocks/system/clipboard'
|
|
19
|
+
import RecentFiles from '../blocks/system/recent-files'
|
|
21
20
|
import SystemStats from '../blocks/system/system-stats'
|
|
22
21
|
import Island from '../components/island/island'
|
|
23
22
|
import { ISLAND_STATES, type IslandState } from '../lib/geometry'
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export
|
|
35
|
-
file.id === 'cover'
|
|
36
|
-
? { ...file, thumbnail: <MockArtwork variant="dusk" /> }
|
|
37
|
-
: file.id === 'demo'
|
|
38
|
-
? { ...file, thumbnail: <MockArtwork variant="night" /> }
|
|
39
|
-
: file,
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
/** A focus run with `left` of its length to go, from now. */
|
|
43
|
-
export function focusRun(left = 0.62, minutes = TIMER.minutes): TimerRun {
|
|
44
|
-
return { kind: 'focus', total: minutes * MINUTE, endsAt: Date.now() + left * minutes * MINUTE }
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** A run made once, when the component mounts, so it keeps counting down across renders. */
|
|
48
|
-
export function useRun(left?: number) {
|
|
49
|
-
return useState(() => focusRun(left))[0]
|
|
50
|
-
}
|
|
23
|
+
import { PLAYING } from './artwork'
|
|
24
|
+
import { CLIP_NOW, CLIPS, PINNED } from './clipboard'
|
|
25
|
+
import { useRun, ZONES } from './clock'
|
|
26
|
+
import { AGENDA_NOW, EVENTS, TABS } from './data'
|
|
27
|
+
import { DOWNLOADS, FILES_NOW, RECENT_FILES } from './files'
|
|
28
|
+
import { ScreenEdge } from './screen'
|
|
29
|
+
import { BATTERY, DISK, PROCESSES, READINGS, UPTIME } from './system'
|
|
30
|
+
import { FORECAST } from './weather'
|
|
31
|
+
|
|
32
|
+
export { PLAYING } from './artwork'
|
|
33
|
+
export { Fit, FlashIsland, ScreenEdge, WingsIsland } from './screen'
|
|
51
34
|
|
|
52
35
|
/** The now-playing glyph for the compact island's left wing. */
|
|
53
36
|
export function ArtworkTile() {
|
|
54
37
|
return <NowPlaying.Leading track={PLAYING} />
|
|
55
38
|
}
|
|
56
39
|
|
|
57
|
-
/**
|
|
58
|
-
export function
|
|
59
|
-
return <
|
|
40
|
+
/** A focus round's ring for the split bubble, 62% to go. */
|
|
41
|
+
export function PomodoroBubble() {
|
|
42
|
+
return <Clock.Minimal run={useRun()} />
|
|
60
43
|
}
|
|
61
44
|
|
|
62
|
-
/**
|
|
63
|
-
export function
|
|
64
|
-
return <
|
|
45
|
+
/** A download landing, for the island's `flash`. */
|
|
46
|
+
export function DownloadedFlash() {
|
|
47
|
+
return <RecentFiles.Saved file={DOWNLOADS[0]!} onOpen={() => {}} />
|
|
65
48
|
}
|
|
66
49
|
|
|
50
|
+
const noop = () => {}
|
|
51
|
+
|
|
67
52
|
/** Every widget of the open island, by tab value. */
|
|
68
53
|
export function widgetFor(tab: string): ReactNode {
|
|
69
|
-
if (tab === 'now-playing')
|
|
70
|
-
|
|
54
|
+
if (tab === 'now-playing')
|
|
55
|
+
return <NowPlaying track={PLAYING} defaultShuffle={false} defaultRepeat="all" defaultLiked />
|
|
71
56
|
if (tab === 'calendar') return <Agenda events={EVENTS} now={AGENDA_NOW} />
|
|
72
|
-
if (tab === '
|
|
73
|
-
if (tab === '
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (tab === '
|
|
57
|
+
if (tab === 'weather') return <Weather {...FORECAST} onRefresh={noop} />
|
|
58
|
+
if (tab === 'clock') return <Clock zones={ZONES} />
|
|
59
|
+
if (tab === 'system')
|
|
60
|
+
return <SystemStats samples={READINGS} battery={BATTERY} disk={DISK} uptime={UPTIME} processes={PROCESSES} />
|
|
61
|
+
if (tab === 'clipboard')
|
|
62
|
+
return <ClipboardHistory clips={CLIPS} defaultPinned={PINNED} now={CLIP_NOW} onDelete={noop} />
|
|
63
|
+
if (tab === 'files')
|
|
64
|
+
return (
|
|
65
|
+
<RecentFiles files={RECENT_FILES} now={FILES_NOW} onReveal={noop} onCopy={noop} onDelete={noop} onClear={noop} />
|
|
66
|
+
)
|
|
77
67
|
return null
|
|
78
68
|
}
|
|
79
69
|
|
|
@@ -99,9 +89,9 @@ export function DemoIsland({ defaultTab, ...props }: DemoIslandProps) {
|
|
|
99
89
|
return (
|
|
100
90
|
<Island
|
|
101
91
|
leading={<ArtworkTile />}
|
|
102
|
-
trailing={<NowPlaying.Trailing />}
|
|
103
|
-
minimal={<
|
|
104
|
-
flash={<
|
|
92
|
+
trailing={<NowPlaying.Trailing track={PLAYING} />}
|
|
93
|
+
minimal={<PomodoroBubble />}
|
|
94
|
+
flash={<DownloadedFlash />}
|
|
105
95
|
expanded={<ExpandedPanel defaultTab={defaultTab} />}
|
|
106
96
|
activity="now-playing"
|
|
107
97
|
{...props}
|
|
@@ -137,35 +127,8 @@ export function IslandPlayground({ defaultState = 'compact' }: { defaultState?:
|
|
|
137
127
|
)
|
|
138
128
|
}
|
|
139
129
|
|
|
140
|
-
/**
|
|
141
|
-
* The top of a screen: a band the island hangs from, tall enough for what it
|
|
142
|
-
* shows. Narrower than `width`, it scales down whole, so the island keeps the
|
|
143
|
-
* proportions it has on a Mac.
|
|
144
|
-
*/
|
|
145
|
-
export function ScreenEdge({
|
|
146
|
-
children,
|
|
147
|
-
height = 360,
|
|
148
|
-
width = 760,
|
|
149
|
-
}: {
|
|
150
|
-
children: ReactNode
|
|
151
|
-
height?: number
|
|
152
|
-
width?: number
|
|
153
|
-
}) {
|
|
154
|
-
const { outer, scale } = useFitScale(width)
|
|
155
|
-
return (
|
|
156
|
-
<div ref={outer} className="w-full" style={{ height: height * scale }}>
|
|
157
|
-
<div
|
|
158
|
-
className="relative mx-auto overflow-hidden rounded-box bg-sunken"
|
|
159
|
-
style={{ width: scale < 1 ? width : '100%', maxWidth: width, height, zoom: scale }}
|
|
160
|
-
>
|
|
161
|
-
{children}
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
130
|
/** The open island on a strip of screen, on `tab`, its view replaced by `children` when given. */
|
|
168
|
-
export function WidgetIsland({ tab, children, height =
|
|
131
|
+
export function WidgetIsland({ tab, children, height = 260 }: { tab: string; children?: ReactNode; height?: number }) {
|
|
169
132
|
const tabs = panelTabs(children ? { [tab]: children } : {})
|
|
170
133
|
return (
|
|
171
134
|
<ScreenEdge height={height}>
|
|
@@ -177,41 +140,3 @@ export function WidgetIsland({ tab, children, height = 340 }: { tab: string; chi
|
|
|
177
140
|
</ScreenEdge>
|
|
178
141
|
)
|
|
179
142
|
}
|
|
180
|
-
|
|
181
|
-
/** A flash below the notch, on a strip of screen. */
|
|
182
|
-
export function FlashIsland({ children, activity }: { children: ReactNode; activity?: string }) {
|
|
183
|
-
return (
|
|
184
|
-
<ScreenEdge height={112}>
|
|
185
|
-
<Island defaultState="flash" collapsedState="idle" flash={children} activity={activity} />
|
|
186
|
-
</ScreenEdge>
|
|
187
|
-
)
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/** An activity in the compact island's wings, with a second one's bubble when `minimal` is given. */
|
|
191
|
-
export function WingsIsland({
|
|
192
|
-
leading,
|
|
193
|
-
trailing,
|
|
194
|
-
minimal,
|
|
195
|
-
}: {
|
|
196
|
-
leading: ReactNode
|
|
197
|
-
trailing: ReactNode
|
|
198
|
-
minimal?: ReactNode
|
|
199
|
-
}) {
|
|
200
|
-
return (
|
|
201
|
-
<ScreenEdge height={64}>
|
|
202
|
-
<Island defaultState={minimal ? 'split' : 'compact'} leading={leading} trailing={trailing} minimal={minimal} />
|
|
203
|
-
</ScreenEdge>
|
|
204
|
-
)
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/** Lays `children` out at `width` and scales them down whole when the column is narrower. */
|
|
208
|
-
export function Fit({ width, children }: { width: number; children: ReactNode }) {
|
|
209
|
-
const { outer, scale } = useFitScale(width)
|
|
210
|
-
return (
|
|
211
|
-
<div ref={outer} className="flex w-full justify-center">
|
|
212
|
-
<div className="shrink-0" style={{ width: scale < 1 ? width : '100%', maxWidth: width, zoom: scale }}>
|
|
213
|
-
{children}
|
|
214
|
-
</div>
|
|
215
|
-
</div>
|
|
216
|
-
)
|
|
217
|
-
}
|
package/mock/screen.tsx
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Mock: strips of screen edge the island hangs from in the docs, a flash or
|
|
3
|
+
* the wings on their own, and a stage that scales down to its column.
|
|
4
|
+
* Nothing here ships in the barrel.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import type { ReactNode } from 'react'
|
|
10
|
+
import Island from '../components/island/island'
|
|
11
|
+
import { useFitScale } from './fit'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The top of a screen: a band the island hangs from, tall enough for what it
|
|
15
|
+
* shows. Narrower than `width`, it scales down whole, so the island keeps the
|
|
16
|
+
* proportions it has on a Mac.
|
|
17
|
+
*/
|
|
18
|
+
export function ScreenEdge({
|
|
19
|
+
children,
|
|
20
|
+
height = 360,
|
|
21
|
+
width = 760,
|
|
22
|
+
}: {
|
|
23
|
+
children: ReactNode
|
|
24
|
+
height?: number
|
|
25
|
+
width?: number
|
|
26
|
+
}) {
|
|
27
|
+
const { outer, scale } = useFitScale(width)
|
|
28
|
+
return (
|
|
29
|
+
<div ref={outer} className="w-full" style={{ height: height * scale }}>
|
|
30
|
+
<div
|
|
31
|
+
className="relative mx-auto overflow-hidden rounded-box bg-sunken"
|
|
32
|
+
style={{ width: scale < 1 ? width : '100%', maxWidth: width, height, zoom: scale }}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A flash below the notch, on a strip of screen. */
|
|
41
|
+
export function FlashIsland({ children, activity }: { children: ReactNode; activity?: string }) {
|
|
42
|
+
return (
|
|
43
|
+
<ScreenEdge height={112}>
|
|
44
|
+
<Island defaultState="flash" collapsedState="idle" flash={children} activity={activity} />
|
|
45
|
+
</ScreenEdge>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** An activity in the compact island's wings, with a second one's bubble when `minimal` is given. */
|
|
50
|
+
export function WingsIsland({
|
|
51
|
+
leading,
|
|
52
|
+
trailing,
|
|
53
|
+
minimal,
|
|
54
|
+
}: {
|
|
55
|
+
leading: ReactNode
|
|
56
|
+
trailing: ReactNode
|
|
57
|
+
minimal?: ReactNode
|
|
58
|
+
}) {
|
|
59
|
+
return (
|
|
60
|
+
<ScreenEdge height={64}>
|
|
61
|
+
<Island defaultState={minimal ? 'split' : 'compact'} leading={leading} trailing={trailing} minimal={minimal} />
|
|
62
|
+
</ScreenEdge>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Lays `children` out at `width` and scales them down whole when the column is narrower. */
|
|
67
|
+
export function Fit({ width, children }: { width: number; children: ReactNode }) {
|
|
68
|
+
const { outer, scale } = useFitScale(width)
|
|
69
|
+
return (
|
|
70
|
+
<div ref={outer} className="flex w-full justify-center">
|
|
71
|
+
<div className="shrink-0" style={{ width: scale < 1 ? width : '100%', maxWidth: width, zoom: scale }}>
|
|
72
|
+
{children}
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
)
|
|
76
|
+
}
|