@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.
Files changed (141) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -2
  3. package/blocks/activities/agenda/examples.mdx +74 -0
  4. package/blocks/activities/agenda/index.tsx +441 -0
  5. package/blocks/activities/clock/examples.mdx +73 -0
  6. package/blocks/activities/clock/index.tsx +619 -0
  7. package/blocks/activities/now-playing/examples.mdx +68 -0
  8. package/blocks/activities/now-playing/index.tsx +411 -0
  9. package/blocks/activities/weather/examples.mdx +115 -0
  10. package/blocks/activities/weather/index.tsx +634 -0
  11. package/blocks/app/expanded-island/examples.mdx +46 -0
  12. package/blocks/app/expanded-island/index.tsx +143 -0
  13. package/blocks/app/settings-window/examples.mdx +34 -0
  14. package/blocks/app/settings-window/index.tsx +375 -0
  15. package/blocks/system/clipboard/examples.mdx +83 -0
  16. package/blocks/system/clipboard/index.tsx +563 -0
  17. package/blocks/system/recent-files/examples.mdx +66 -0
  18. package/blocks/system/recent-files/index.tsx +542 -0
  19. package/blocks/system/system-stats/examples.mdx +52 -0
  20. package/blocks/system/system-stats/index.tsx +312 -0
  21. package/components/indicators/countdown/examples.mdx +25 -0
  22. package/components/indicators/countdown/index.tsx +83 -0
  23. package/components/indicators/equalizer/examples.mdx +20 -0
  24. package/components/indicators/equalizer/index.tsx +116 -0
  25. package/components/indicators/media-scrubber/examples.mdx +29 -0
  26. package/components/indicators/media-scrubber/index.tsx +122 -0
  27. package/components/island/island/examples.mdx +57 -0
  28. package/components/island/island/index.tsx +415 -0
  29. package/components/island/island-flash/examples.mdx +52 -0
  30. package/components/island/island-flash/index.tsx +79 -0
  31. package/components/island/island-tabs/examples.mdx +53 -0
  32. package/components/island/island-tabs/index.tsx +285 -0
  33. package/components/island/widget/examples.mdx +76 -0
  34. package/components/island/widget/index.tsx +431 -0
  35. package/dist/blocks/activities/agenda/index.d.ts +2 -0
  36. package/dist/blocks/activities/agenda/index.js +21 -0
  37. package/dist/blocks/activities/clock/index.d.ts +2 -0
  38. package/dist/blocks/activities/clock/index.js +25 -0
  39. package/dist/blocks/activities/now-playing/index.d.ts +3 -0
  40. package/dist/blocks/activities/now-playing/index.js +24 -0
  41. package/dist/blocks/activities/weather/index.d.ts +2 -0
  42. package/dist/blocks/activities/weather/index.js +21 -0
  43. package/dist/blocks/app/expanded-island/index.d.ts +3 -0
  44. package/dist/blocks/app/expanded-island/index.js +11 -0
  45. package/dist/blocks/app/settings-window/index.d.ts +2 -0
  46. package/dist/blocks/app/settings-window/index.js +7 -0
  47. package/dist/blocks/system/clipboard/index.d.ts +2 -0
  48. package/dist/blocks/system/clipboard/index.js +17 -0
  49. package/dist/blocks/system/recent-files/index.d.ts +2 -0
  50. package/dist/blocks/system/recent-files/index.js +19 -0
  51. package/dist/blocks/system/system-stats/index.d.ts +2 -0
  52. package/dist/blocks/system/system-stats/index.js +15 -0
  53. package/dist/components/indicators/countdown/index.d.ts +2 -0
  54. package/dist/components/indicators/countdown/index.js +8 -0
  55. package/dist/components/indicators/equalizer/index.d.ts +2 -0
  56. package/dist/components/indicators/equalizer/index.js +7 -0
  57. package/dist/components/indicators/media-scrubber/index.d.ts +2 -0
  58. package/dist/components/indicators/media-scrubber/index.js +8 -0
  59. package/dist/components/island/island/index.d.ts +3 -0
  60. package/dist/components/island/island/index.js +10 -0
  61. package/dist/components/island/island-flash/index.d.ts +2 -0
  62. package/dist/components/island/island-flash/index.js +7 -0
  63. package/dist/components/island/island-tabs/index.d.ts +2 -0
  64. package/dist/components/island/island-tabs/index.js +9 -0
  65. package/dist/components/island/widget/index.d.ts +2 -0
  66. package/dist/components/island/widget/index.js +30 -0
  67. package/dist/index.d.ts +21 -0
  68. package/dist/index.js +195 -0
  69. package/dist/lib/artwork.d.ts +2 -0
  70. package/dist/lib/artwork.js +8 -0
  71. package/dist/lib/clock.d.ts +2 -0
  72. package/dist/lib/clock.js +14 -0
  73. package/dist/lib/geometry.d.ts +2 -0
  74. package/dist/lib/geometry.js +24 -0
  75. package/dist/lib/island-context.d.ts +3 -0
  76. package/dist/lib/island-context.js +8 -0
  77. package/dist/lib/motion.d.ts +21 -0
  78. package/dist/lib/motion.js +16 -0
  79. package/dist/shared/chunk-152gpyq3.d.ts +13 -0
  80. package/dist/shared/chunk-2818esrq.d.ts +140 -0
  81. package/dist/shared/chunk-2f7zxrbk.js +65 -0
  82. package/dist/shared/chunk-2m5dz8nf.d.ts +88 -0
  83. package/dist/shared/chunk-2s4q6mt0.js +27 -0
  84. package/dist/shared/chunk-3thgcfcq.d.ts +151 -0
  85. package/dist/shared/chunk-416tsgbc.d.ts +175 -0
  86. package/dist/shared/chunk-502rmtap.js +54 -0
  87. package/dist/shared/chunk-52gb3g6r.d.ts +12 -0
  88. package/dist/shared/chunk-5en5aaj1.d.ts +33 -0
  89. package/dist/shared/chunk-61t2dfte.js +63 -0
  90. package/dist/shared/chunk-7fvnrtz4.d.ts +105 -0
  91. package/dist/shared/chunk-81fpptwp.d.ts +75 -0
  92. package/dist/shared/chunk-9c7ewvkk.js +381 -0
  93. package/dist/shared/chunk-9m0xbg5v.js +112 -0
  94. package/dist/shared/chunk-9xtcv3sy.js +88 -0
  95. package/dist/shared/chunk-bvtyjcce.d.ts +123 -0
  96. package/dist/shared/chunk-cc9nwbtf.js +315 -0
  97. package/dist/shared/chunk-cfzmfnyh.d.ts +63 -0
  98. package/dist/shared/chunk-d5qm9cps.js +10 -0
  99. package/dist/shared/chunk-da177e8r.d.ts +114 -0
  100. package/dist/shared/chunk-fexwzycv.d.ts +36 -0
  101. package/dist/shared/chunk-gb56m10p.js +39 -0
  102. package/dist/shared/chunk-gejenfap.d.ts +25 -0
  103. package/dist/shared/chunk-hrpxbqmx.d.ts +28 -0
  104. package/dist/shared/chunk-j755a1a5.d.ts +41 -0
  105. package/dist/shared/chunk-j77cx8dp.js +498 -0
  106. package/dist/shared/chunk-mt0k6v8x.js +474 -0
  107. package/dist/shared/chunk-ndf79pv5.js +58 -0
  108. package/dist/shared/chunk-pfhy5e4q.d.ts +53 -0
  109. package/dist/shared/chunk-qdzemt2v.js +477 -0
  110. package/dist/shared/chunk-r471sknr.js +209 -0
  111. package/dist/shared/chunk-s2jeqqan.js +243 -0
  112. package/dist/shared/chunk-t0hcxh89.d.ts +124 -0
  113. package/dist/shared/chunk-w48eyvfr.d.ts +56 -0
  114. package/dist/shared/chunk-w5h6ay93.js +72 -0
  115. package/dist/shared/chunk-wkg17nxs.d.ts +101 -0
  116. package/dist/shared/chunk-x7f3g82r.js +285 -0
  117. package/dist/shared/chunk-xq5hc5gv.js +333 -0
  118. package/dist/shared/chunk-y0188bbn.js +331 -0
  119. package/dist/shared/chunk-ym0xbses.js +518 -0
  120. package/dist/styles.css +264 -0
  121. package/index.ts +22 -0
  122. package/lib/artwork.ts +112 -0
  123. package/lib/clock.ts +53 -0
  124. package/lib/geometry.ts +130 -0
  125. package/lib/island-context.tsx +24 -0
  126. package/lib/motion.ts +42 -0
  127. package/mock/activities.tsx +77 -0
  128. package/mock/artwork.tsx +37 -0
  129. package/mock/clipboard.tsx +79 -0
  130. package/mock/clock.tsx +77 -0
  131. package/mock/data.ts +139 -0
  132. package/mock/desktop.tsx +83 -0
  133. package/mock/files.tsx +70 -0
  134. package/mock/fit.ts +26 -0
  135. package/mock/island-content.tsx +142 -0
  136. package/mock/scene.tsx +52 -0
  137. package/mock/screen.tsx +76 -0
  138. package/mock/settings.tsx +489 -0
  139. package/mock/system.ts +46 -0
  140. package/mock/weather.tsx +105 -0
  141. package/package.json +122 -4
@@ -0,0 +1,77 @@
1
+ /*!
2
+ * Mock: activities that count down for real in the docs, an event a few
3
+ * minutes out, made once on mount so a re-render never resets it. Nothing
4
+ * here ships in the barrel.
5
+ */
6
+
7
+ 'use client'
8
+
9
+ import { CalendarDays } from 'lucide-react'
10
+ import { useState } from 'react'
11
+ import Agenda from '../blocks/activities/agenda'
12
+ import Clock from '../blocks/activities/clock'
13
+ import ExpandedIsland from '../blocks/app/expanded-island'
14
+ import Island from '../components/island/island'
15
+ import { useRun } from './clock'
16
+ import { soonEvent } from './data'
17
+ import { FlashIsland, ScreenEdge, WingsIsland } from './screen'
18
+
19
+ /** An event `minutes` out, made once. */
20
+ export function useSoon(minutes = 4) {
21
+ return useState(() => soonEvent(minutes))[0]
22
+ }
23
+
24
+ /** The next event counting down in the compact island's wings. */
25
+ export function AgendaWings() {
26
+ const event = useSoon()
27
+ return <WingsIsland leading={<Agenda.Leading event={event} />} trailing={<Agenda.Trailing event={event} />} />
28
+ }
29
+
30
+ /** A focus round in the wings, the next event's ring in the bubble. */
31
+ export function AgendaSplit() {
32
+ const run = useRun()
33
+ const event = useSoon()
34
+ return (
35
+ <WingsIsland
36
+ leading={<Clock.Leading run={run} />}
37
+ trailing={<Clock.Trailing run={run} />}
38
+ minimal={<Agenda.Minimal event={event} />}
39
+ />
40
+ )
41
+ }
42
+
43
+ /** The open island on the "Up next" view. */
44
+ export function UpNextIsland() {
45
+ const event = useSoon()
46
+ return (
47
+ <ScreenEdge height={260}>
48
+ <Island
49
+ defaultState="expanded"
50
+ collapsedState="idle"
51
+ panelHeight={200}
52
+ expanded={
53
+ <ExpandedIsland
54
+ tabs={[
55
+ {
56
+ value: 'up-next',
57
+ label: 'Up next',
58
+ icon: CalendarDays,
59
+ content: <Agenda.UpNext event={event} />,
60
+ },
61
+ ]}
62
+ />
63
+ }
64
+ />
65
+ </ScreenEdge>
66
+ )
67
+ }
68
+
69
+ /** The flash a minute before an event. */
70
+ export function AgendaFlash() {
71
+ const event = useSoon(0.9)
72
+ return (
73
+ <FlashIsland>
74
+ <Agenda.Starting event={event} />
75
+ </FlashIsland>
76
+ )
77
+ }
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Mock: album art and file previews for the docs, made only of tokens (a
3
+ * gradient across the theme's hues), so nothing loads and both schemes hold.
4
+ */
5
+
6
+ import { cn } from '@justanarthur/modo-ui/lib/utils'
7
+ import type { NowPlayingTrack } from '../blocks/activities/now-playing'
8
+ import { TRACK } from './data'
9
+
10
+ export type ArtworkVariant = 'aurora' | 'dusk' | 'night'
11
+
12
+ // Literal table: UnoCSS only generates the classes it can read whole.
13
+ const FILL: Record<ArtworkVariant, string> = {
14
+ aurora: 'bg-linear-to-br from-status-info via-brand to-status-success',
15
+ dusk: 'bg-linear-to-br from-status-warning via-status-error to-brand',
16
+ night: 'bg-linear-to-tr from-ink via-brand to-status-info',
17
+ }
18
+
19
+ /** The color each variant leans to: the artwork's tint, data a player would read from the image. */
20
+ export const ARTWORK_TINT: Record<ArtworkVariant, string> = {
21
+ aurora: 'var(--badge-cyan)',
22
+ dusk: 'var(--badge-orange)',
23
+ night: 'var(--badge-violet)',
24
+ }
25
+
26
+ /** A square of generated art that fills its tile. */
27
+ export function MockArtwork({ variant = 'aurora', className }: { variant?: ArtworkVariant; className?: string }) {
28
+ return (
29
+ <span aria-hidden className={cn('relative block size-full overflow-hidden', FILL[variant], className)}>
30
+ <span className="absolute -right-1/4 -bottom-1/4 size-3/4 rounded-full bg-ink/25" />
31
+ <span className="absolute top-1/5 left-1/5 size-1/4 rounded-full bg-thumb/40" />
32
+ </span>
33
+ )
34
+ }
35
+
36
+ /** The mock track, with generated artwork. */
37
+ export const PLAYING: NowPlayingTrack = { ...TRACK, artwork: <MockArtwork />, tint: ARTWORK_TINT.aurora }
@@ -0,0 +1,79 @@
1
+ /*
2
+ * Mock: an afternoon of copying for the clipboard widget, one clip of each
3
+ * kind, read at a pinned moment so the times hold. Nothing here ships in the
4
+ * barrel.
5
+ */
6
+
7
+ import type { ClipboardClip } from '../blocks/system/clipboard'
8
+ import { MockArtwork } from './artwork'
9
+
10
+ const MINUTE = 60_000
11
+
12
+ /** The moment the history is read at. */
13
+ export const CLIP_NOW = new Date(2026, 10, 17, 15, 42).getTime()
14
+
15
+ const ago = (minutes: number) => CLIP_NOW - minutes * MINUTE
16
+
17
+ export const CLIPS: ClipboardClip[] = [
18
+ {
19
+ id: 'quote',
20
+ kind: 'text',
21
+ content:
22
+ 'The island grows out of the notch and melts back into it; nothing on screen should feel like it came from nowhere.',
23
+ app: 'Notes',
24
+ copiedAt: ago(2),
25
+ },
26
+ {
27
+ id: 'docs',
28
+ kind: 'link',
29
+ content: 'https://justanarthur.github.io/modo/notch/docs/blocks/agenda',
30
+ detail: 'Agenda · modo ui notch',
31
+ preview: <MockArtwork variant="night" />,
32
+ app: 'Safari',
33
+ copiedAt: ago(9),
34
+ },
35
+ {
36
+ id: 'shot',
37
+ kind: 'image',
38
+ content: 'Screenshot 2026-11-17 at 15.21',
39
+ detail: '1440 × 900 · PNG',
40
+ preview: <MockArtwork variant="dusk" />,
41
+ app: 'Screenshot',
42
+ copiedAt: ago(21),
43
+ },
44
+ {
45
+ id: 'brand',
46
+ kind: 'color',
47
+ // A theme token as copied from code; the swatch paints it, so it follows the scheme and no literal color sits in the docs.
48
+ content: '--badge-blue',
49
+ color: 'var(--badge-blue)',
50
+ detail: 'modo-ui badge blue',
51
+ app: 'Zed',
52
+ copiedAt: ago(48),
53
+ },
54
+ {
55
+ id: 'brief',
56
+ kind: 'file',
57
+ content: 'Island brief.pdf',
58
+ detail: '2.4 MB',
59
+ app: 'Finder',
60
+ copiedAt: ago(95),
61
+ },
62
+ {
63
+ id: 'cmd',
64
+ kind: 'text',
65
+ content: 'bun run build && bun run check',
66
+ app: 'Terminal',
67
+ copiedAt: ago(130),
68
+ },
69
+ {
70
+ id: 'address',
71
+ kind: 'text',
72
+ content: 'Main St 12, 2nd floor',
73
+ app: 'Messages',
74
+ copiedAt: ago(26 * 60),
75
+ },
76
+ ]
77
+
78
+ /** Kept on top: the build command and the color. */
79
+ export const PINNED = ['cmd', 'brand']
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 ADDED
@@ -0,0 +1,139 @@
1
+ /*
2
+ * Mock data for the docs: what a notch app's activities would report. Pages
3
+ * and examples read it; nothing here ships in the barrel.
4
+ */
5
+
6
+ import { Activity, CalendarDays, ClipboardList, Clock3, CloudSun, FolderDown, Music } from 'lucide-react'
7
+ import type { AgendaEvent } from '../blocks/activities/agenda'
8
+ import type { IslandTab } from '../components/island/island-tabs'
9
+
10
+ export interface Track {
11
+ title: string
12
+ artist: string
13
+ album: string
14
+ source: string
15
+ output: string
16
+ outputKind: 'built-in' | 'headphones' | 'speaker' | 'airplay'
17
+ /** Seconds. */
18
+ duration: number
19
+ /** Seconds. */
20
+ position: number
21
+ }
22
+
23
+ export const TRACK: Track = {
24
+ title: 'Midnight City',
25
+ artist: 'M83',
26
+ album: "Hurry Up, We're Dreaming",
27
+ source: 'Music',
28
+ output: 'AirPods Pro',
29
+ outputKind: 'headphones',
30
+ duration: 243,
31
+ position: 71,
32
+ }
33
+
34
+ export const TRACKS: Track[] = [
35
+ TRACK,
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
+ },
56
+ ]
57
+
58
+ const MINUTE = 60_000
59
+ const at = (day: number, hours: number, minutes: number) => {
60
+ const date = new Date()
61
+ date.setDate(date.getDate() + day)
62
+ date.setHours(hours, minutes, 0, 0)
63
+ return date.getTime()
64
+ }
65
+
66
+ /** The moment the agenda is read at: today, 9:40. */
67
+ export const AGENDA_NOW = at(0, 9, 40)
68
+
69
+ // A calendar's color is data; here it reads modo-ui's badge palette, so it follows the theme.
70
+ export const EVENTS: AgendaEvent[] = [
71
+ {
72
+ id: 'offsite',
73
+ title: 'Team offsite',
74
+ start: at(0, 0, 0),
75
+ end: at(1, 0, 0),
76
+ allDay: true,
77
+ color: 'var(--badge-green)',
78
+ },
79
+ {
80
+ id: 'review',
81
+ title: 'Design review',
82
+ start: at(0, 10, 30),
83
+ end: at(0, 11, 15),
84
+ location: 'Studio 2',
85
+ color: 'var(--badge-blue)',
86
+ },
87
+ { id: 'lunch', title: 'Lunch with Ana', start: at(0, 12, 45), end: at(0, 13, 45), color: 'var(--badge-orange)' },
88
+ {
89
+ id: 'ship',
90
+ title: 'Ship the island kit',
91
+ start: at(0, 16, 0),
92
+ end: at(0, 16, 30),
93
+ meetingUrl: 'https://meet.example.com/ship',
94
+ color: 'var(--badge-violet)',
95
+ },
96
+ {
97
+ id: 'standup',
98
+ title: 'Standup',
99
+ start: at(1, 9, 30),
100
+ end: at(1, 9, 45),
101
+ meetingUrl: 'https://meet.example.com/standup',
102
+ color: 'var(--badge-blue)',
103
+ },
104
+ {
105
+ id: 'dentist',
106
+ title: 'Dentist',
107
+ start: at(1, 14, 0),
108
+ end: at(1, 15, 0),
109
+ location: 'Main St 12',
110
+ color: 'var(--badge-rose)',
111
+ },
112
+ ]
113
+
114
+ /** An event a few minutes out, for the "Up next" activity: it counts down for real. */
115
+ export function soonEvent(minutes = 4): AgendaEvent {
116
+ const start = Date.now() + minutes * MINUTE
117
+ return {
118
+ id: `soon-${minutes}`,
119
+ title: 'Design review',
120
+ start,
121
+ end: start + 45 * MINUTE,
122
+ location: 'Studio 2',
123
+ meetingUrl: 'https://meet.example.com/review',
124
+ color: 'var(--badge-blue)',
125
+ }
126
+ }
127
+
128
+ /** The open island's tabs: one per widget. */
129
+ export const TABS: IslandTab[] = [
130
+ { value: 'now-playing', label: 'Now Playing', icon: Music },
131
+ { value: 'calendar', label: 'Calendar', icon: CalendarDays },
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 },
137
+ ]
138
+
139
+ export const MENUS = ['Finder', 'File', 'Edit', 'View', 'Go', 'Window', 'Help']
@@ -0,0 +1,83 @@
1
+ /*!
2
+ * Mock: a Mac's screen for the docs, made only of tokens: a wallpaper, a menu
3
+ * bar as tall as the notch, and the island hanging from the top edge over it.
4
+ * It lays the screen out at a fixed size and scales it down to the width it
5
+ * gets (CSS zoom), so a whole desktop reads inside a docs column.
6
+ */
7
+
8
+ 'use client'
9
+
10
+ import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
11
+ import { cn } from '@justanarthur/modo-ui/lib/utils'
12
+ import type { ReactNode } from 'react'
13
+ import { DEFAULT_NOTCH } from '../lib/geometry'
14
+ import { MENUS } from './data'
15
+ import { useFitScale } from './fit'
16
+
17
+ export interface MockDesktopProps {
18
+ /** The screen's width in px. Defaults to `1024`. */
19
+ width?: number
20
+ /** The screen's height in px. Defaults to `640`. */
21
+ height?: number
22
+ /** The menu bar's height: the notch's. Defaults to `32`. */
23
+ notchHeight?: number
24
+ /** The notch's width, kept free in the menu bar. Defaults to `185`. */
25
+ notchWidth?: number
26
+ /** The app named first in the menu bar. Defaults to `'Finder'`. */
27
+ app?: string
28
+ /** The clock at the right end. Defaults to `'Mon 16 Nov 13:05'`. */
29
+ clock?: string
30
+ /** The island, hung from the top edge across the screen's width. */
31
+ island?: ReactNode
32
+ /** Anything else on the desktop, under the menu bar. */
33
+ children?: ReactNode
34
+ className?: string
35
+ }
36
+
37
+ export function MockDesktop({
38
+ width = 1024,
39
+ height = 640,
40
+ notchHeight = DEFAULT_NOTCH.height,
41
+ notchWidth = DEFAULT_NOTCH.width,
42
+ app = 'Finder',
43
+ clock = 'Mon 16 Nov 13:05',
44
+ island,
45
+ children,
46
+ className,
47
+ }: MockDesktopProps) {
48
+ const shape = useShape()
49
+ const { outer, scale } = useFitScale(width)
50
+
51
+ return (
52
+ <div ref={outer} className="w-full" style={{ height: height * scale }}>
53
+ <div
54
+ className={cn(
55
+ 'relative overflow-hidden border border-border bg-linear-to-br from-brand/30 via-surface-2 to-status-info/25',
56
+ shape.container,
57
+ className,
58
+ )}
59
+ style={{ width, height, zoom: scale }}
60
+ >
61
+ <div
62
+ className="absolute inset-x-0 top-0 flex items-center bg-background/70 text-caption text-foreground"
63
+ style={{ height: notchHeight }}
64
+ >
65
+ <div className="flex flex-1 items-center gap-4 px-4">
66
+ <span className="weight-semibold">{app}</span>
67
+ {MENUS.slice(1).map(menu => (
68
+ <span key={menu}>{menu}</span>
69
+ ))}
70
+ </div>
71
+ <div aria-hidden className="shrink-0" style={{ width: notchWidth }} />
72
+ <div className="flex flex-1 items-center justify-end gap-4 px-4 tabular-nums">
73
+ <span>{clock}</span>
74
+ </div>
75
+ </div>
76
+ <div className="absolute inset-x-0 bottom-0" style={{ top: notchHeight }}>
77
+ {children}
78
+ </div>
79
+ <div className="absolute inset-x-0 top-0">{island}</div>
80
+ </div>
81
+ </div>
82
+ )
83
+ }
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/fit.ts ADDED
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Mock: scale a fixed-size stage down to the width it gets (CSS zoom, as the
3
+ * docs' bento previews do), so a screen keeps its proportions in a narrow
4
+ * column. Never above 1:1.
5
+ */
6
+
7
+ 'use client'
8
+
9
+ import { useLayoutEffect, useRef, useState } from 'react'
10
+
11
+ export function useFitScale(width: number) {
12
+ const outer = useRef<HTMLDivElement | null>(null)
13
+ const [scale, setScale] = useState(1)
14
+
15
+ useLayoutEffect(() => {
16
+ const el = outer.current
17
+ if (!el) return
18
+ const observer = new ResizeObserver(([entry]) => {
19
+ if (entry) setScale(Math.min(1, entry.contentRect.width / width))
20
+ })
21
+ observer.observe(el)
22
+ return () => observer.disconnect()
23
+ }, [width])
24
+
25
+ return { outer, scale }
26
+ }