@justanarthur/modo-ui-notch 0.0.0-stage → 0.2.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 (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +75 -2
  3. package/blocks/activities/agenda/examples.mdx +58 -0
  4. package/blocks/activities/agenda/index.tsx +332 -0
  5. package/blocks/activities/now-playing/examples.mdx +49 -0
  6. package/blocks/activities/now-playing/index.tsx +218 -0
  7. package/blocks/activities/shelf/examples.mdx +33 -0
  8. package/blocks/activities/shelf/index.tsx +289 -0
  9. package/blocks/activities/timer/examples.mdx +52 -0
  10. package/blocks/activities/timer/index.tsx +292 -0
  11. package/blocks/app/expanded-island/examples.mdx +45 -0
  12. package/blocks/app/expanded-island/index.tsx +127 -0
  13. package/blocks/app/settings-window/examples.mdx +30 -0
  14. package/blocks/app/settings-window/index.tsx +357 -0
  15. package/blocks/system/controls/examples.mdx +34 -0
  16. package/blocks/system/controls/index.tsx +167 -0
  17. package/blocks/system/devices/examples.mdx +25 -0
  18. package/blocks/system/devices/index.tsx +172 -0
  19. package/blocks/system/power-alert/examples.mdx +32 -0
  20. package/blocks/system/power-alert/index.tsx +89 -0
  21. package/blocks/system/system-stats/examples.mdx +23 -0
  22. package/blocks/system/system-stats/index.tsx +178 -0
  23. package/components/indicators/battery-glyph/examples.mdx +22 -0
  24. package/components/indicators/battery-glyph/index.tsx +91 -0
  25. package/components/indicators/countdown/examples.mdx +25 -0
  26. package/components/indicators/countdown/index.tsx +83 -0
  27. package/components/indicators/equalizer/examples.mdx +20 -0
  28. package/components/indicators/equalizer/index.tsx +116 -0
  29. package/components/indicators/media-scrubber/examples.mdx +21 -0
  30. package/components/indicators/media-scrubber/index.tsx +98 -0
  31. package/components/island/island/examples.mdx +57 -0
  32. package/components/island/island/index.tsx +415 -0
  33. package/components/island/island-flash/examples.mdx +55 -0
  34. package/components/island/island-flash/index.tsx +79 -0
  35. package/components/island/island-tabs/examples.mdx +53 -0
  36. package/components/island/island-tabs/index.tsx +285 -0
  37. package/dist/blocks/activities/agenda/index.d.ts +2 -0
  38. package/dist/blocks/activities/agenda/index.js +21 -0
  39. package/dist/blocks/activities/now-playing/index.d.ts +2 -0
  40. package/dist/blocks/activities/now-playing/index.js +22 -0
  41. package/dist/blocks/activities/shelf/index.d.ts +2 -0
  42. package/dist/blocks/activities/shelf/index.js +14 -0
  43. package/dist/blocks/activities/timer/index.d.ts +2 -0
  44. package/dist/blocks/activities/timer/index.js +19 -0
  45. package/dist/blocks/app/expanded-island/index.d.ts +3 -0
  46. package/dist/blocks/app/expanded-island/index.js +10 -0
  47. package/dist/blocks/app/settings-window/index.d.ts +2 -0
  48. package/dist/blocks/app/settings-window/index.js +7 -0
  49. package/dist/blocks/system/controls/index.d.ts +2 -0
  50. package/dist/blocks/system/controls/index.js +10 -0
  51. package/dist/blocks/system/devices/index.d.ts +2 -0
  52. package/dist/blocks/system/devices/index.js +12 -0
  53. package/dist/blocks/system/power-alert/index.d.ts +2 -0
  54. package/dist/blocks/system/power-alert/index.js +9 -0
  55. package/dist/blocks/system/system-stats/index.d.ts +2 -0
  56. package/dist/blocks/system/system-stats/index.js +12 -0
  57. package/dist/components/indicators/battery-glyph/index.d.ts +2 -0
  58. package/dist/components/indicators/battery-glyph/index.js +9 -0
  59. package/dist/components/indicators/countdown/index.d.ts +2 -0
  60. package/dist/components/indicators/countdown/index.js +8 -0
  61. package/dist/components/indicators/equalizer/index.d.ts +2 -0
  62. package/dist/components/indicators/equalizer/index.js +7 -0
  63. package/dist/components/indicators/media-scrubber/index.d.ts +2 -0
  64. package/dist/components/indicators/media-scrubber/index.js +8 -0
  65. package/dist/components/island/island/index.d.ts +3 -0
  66. package/dist/components/island/island/index.js +10 -0
  67. package/dist/components/island/island-flash/index.d.ts +2 -0
  68. package/dist/components/island/island-flash/index.js +7 -0
  69. package/dist/components/island/island-tabs/index.d.ts +2 -0
  70. package/dist/components/island/island-tabs/index.js +9 -0
  71. package/dist/index.d.ts +21 -0
  72. package/dist/index.js +151 -0
  73. package/dist/lib/clock.d.ts +2 -0
  74. package/dist/lib/clock.js +14 -0
  75. package/dist/lib/geometry.d.ts +2 -0
  76. package/dist/lib/geometry.js +24 -0
  77. package/dist/lib/island-context.d.ts +3 -0
  78. package/dist/lib/island-context.js +8 -0
  79. package/dist/lib/motion.d.ts +21 -0
  80. package/dist/lib/motion.js +16 -0
  81. package/dist/shared/chunk-152gpyq3.d.ts +13 -0
  82. package/dist/shared/chunk-2f7zxrbk.js +65 -0
  83. package/dist/shared/chunk-2qpcsv5h.d.ts +45 -0
  84. package/dist/shared/chunk-2s4q6mt0.js +27 -0
  85. package/dist/shared/chunk-45gytfr1.d.ts +84 -0
  86. package/dist/shared/chunk-502rmtap.js +54 -0
  87. package/dist/shared/chunk-50ffk4r7.d.ts +69 -0
  88. package/dist/shared/chunk-52gb3g6r.d.ts +12 -0
  89. package/dist/shared/chunk-5en5aaj1.d.ts +33 -0
  90. package/dist/shared/chunk-5w0yck07.d.ts +32 -0
  91. package/dist/shared/chunk-6c1jbefs.d.ts +36 -0
  92. package/dist/shared/chunk-78w7qwp0.js +58 -0
  93. package/dist/shared/chunk-7hr53mby.js +116 -0
  94. package/dist/shared/chunk-9nhpg9t8.d.ts +47 -0
  95. package/dist/shared/chunk-b8jb1w72.js +145 -0
  96. package/dist/shared/chunk-cfzmfnyh.d.ts +63 -0
  97. package/dist/shared/chunk-cpewy6yg.js +178 -0
  98. package/dist/shared/chunk-d5qm9cps.js +10 -0
  99. package/dist/shared/chunk-e3e4s4ds.d.ts +77 -0
  100. package/dist/shared/chunk-enm6td0p.js +280 -0
  101. package/dist/shared/chunk-fvedaas2.d.ts +33 -0
  102. package/dist/shared/chunk-gb56m10p.js +39 -0
  103. package/dist/shared/chunk-gex38j8x.d.ts +82 -0
  104. package/dist/shared/chunk-hpsabfsd.d.ts +75 -0
  105. package/dist/shared/chunk-hrpxbqmx.d.ts +28 -0
  106. package/dist/shared/chunk-hwtxpzg0.js +69 -0
  107. package/dist/shared/chunk-mp1nx0ez.js +101 -0
  108. package/dist/shared/chunk-phb53x1f.js +252 -0
  109. package/dist/shared/chunk-r8esmjfs.d.ts +42 -0
  110. package/dist/shared/chunk-rcp1g9ca.js +70 -0
  111. package/dist/shared/chunk-rpfwv3pz.js +209 -0
  112. package/dist/shared/chunk-rr5e0g15.d.ts +35 -0
  113. package/dist/shared/chunk-rx9sphz2.js +266 -0
  114. package/dist/shared/chunk-s33y1pcq.js +305 -0
  115. package/dist/shared/chunk-sbnrhy5m.js +331 -0
  116. package/dist/shared/chunk-w48eyvfr.d.ts +56 -0
  117. package/dist/shared/chunk-wwjxs75m.js +74 -0
  118. package/dist/shared/chunk-xdeek16r.d.ts +58 -0
  119. package/dist/shared/chunk-xkzjk1tq.js +206 -0
  120. package/dist/shared/chunk-yngkkxz2.d.ts +88 -0
  121. package/dist/shared/chunk-zvh0d3qb.js +63 -0
  122. package/dist/styles.css +222 -0
  123. package/index.ts +21 -0
  124. package/lib/clock.ts +53 -0
  125. package/lib/geometry.ts +130 -0
  126. package/lib/island-context.tsx +24 -0
  127. package/lib/motion.ts +42 -0
  128. package/mock/activities.tsx +100 -0
  129. package/mock/artwork.tsx +25 -0
  130. package/mock/data.ts +153 -0
  131. package/mock/desktop.tsx +83 -0
  132. package/mock/fit.ts +26 -0
  133. package/mock/island-content.tsx +217 -0
  134. package/mock/scene.tsx +52 -0
  135. package/mock/settings.tsx +210 -0
  136. package/package.json +117 -4
@@ -0,0 +1,210 @@
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 Radio from '@justanarthur/modo-ui/components/inputs/radio'
12
+ import Switch from '@justanarthur/modo-ui/components/inputs/switch'
13
+ import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
14
+ 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'
25
+ import { type ReactNode, useState } from 'react'
26
+ import type { AboutRow, SettingsPermission, SettingsPlugin } from '../blocks/app/settings-window'
27
+ import { useFitScale } from './fit'
28
+
29
+ function AlertSwitches() {
30
+ 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>
37
+ )
38
+ }
39
+
40
+ function CalendarSettings() {
41
+ 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`} />
48
+ ))}
49
+ </Radio.Group>
50
+ </div>
51
+ <Switch.Group>
52
+ <Switch
53
+ label="Alert a minute before"
54
+ description="Expands the island when an event is about to start."
55
+ defaultChecked
56
+ />
57
+ </Switch.Group>
58
+ </div>
59
+ )
60
+ }
61
+
62
+ function HudSettings() {
63
+ const [on, setOn] = useState(true)
64
+ 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}
72
+ />
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
84
+ </Button>
85
+ </div>
86
+ )}
87
+ </div>
88
+ )
89
+ }
90
+
91
+ function one(label: string, description: string, defaultChecked = false): ReactNode {
92
+ return (
93
+ <Switch.Group>
94
+ <Switch label={label} description={description} defaultChecked={defaultChecked} />
95
+ </Switch.Group>
96
+ )
97
+ }
98
+
99
+ export const PLUGINS: SettingsPlugin[] = [
100
+ {
101
+ id: 'now-playing',
102
+ name: 'Now Playing',
103
+ description: 'What plays in Music, Spotify or a browser.',
104
+ 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),
120
+ },
121
+ {
122
+ id: 'calendar',
123
+ name: 'Calendar',
124
+ description: 'Today and tomorrow, and a countdown to the next event.',
125
+ icon: CalendarDays,
126
+ settings: <CalendarSettings />,
127
+ },
128
+ { id: 'shelf', name: 'Shelf', description: 'Files dropped on the notch, kept for later.', icon: Files },
129
+ {
130
+ id: 'controls',
131
+ name: 'Controls',
132
+ description: 'Volume and brightness, and their HUD.',
133
+ icon: SlidersHorizontal,
134
+ settings: <HudSettings />,
135
+ },
136
+ { id: 'devices', name: 'Devices', description: 'Bluetooth devices and their batteries.', icon: Headphones },
137
+ {
138
+ id: 'stats',
139
+ name: 'System',
140
+ description: 'CPU, memory and network load.',
141
+ 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
+ ),
146
+ },
147
+ ]
148
+
149
+ export const PERMISSIONS: SettingsPermission[] = [
150
+ {
151
+ id: 'accessibility',
152
+ label: 'Accessibility',
153
+ description: 'Replaces the volume and brightness HUD with the island.',
154
+ granted: false,
155
+ },
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.' },
159
+ ]
160
+
161
+ export const ABOUT: AboutRow[] = [
162
+ { label: 'Version', value: '1.4.0' },
163
+ { label: 'Mode', value: 'Release' },
164
+ { label: 'Screen', value: '1512 × 982 panel, hardware notch' },
165
+ ]
166
+
167
+ const LIGHTS = ['bg-status-error', 'bg-status-warning', 'bg-status-success']
168
+
169
+ /**
170
+ * A desktop window's frame for the docs: traffic lights and a title over the
171
+ * content, laid out at a fixed size and scaled down whole to the width it
172
+ * gets, so the window keeps its proportions in a narrow column.
173
+ */
174
+ export function MockWindow({
175
+ title,
176
+ width = 760,
177
+ height = 520,
178
+ children,
179
+ }: {
180
+ title?: string
181
+ width?: number
182
+ height?: number
183
+ children: ReactNode
184
+ }) {
185
+ const shape = useShape()
186
+ const { outer, scale } = useFitScale(width)
187
+ return (
188
+ <div ref={outer} className="w-full" style={{ height: height * scale }}>
189
+ <div
190
+ className={cn(
191
+ 'mx-auto flex flex-col overflow-hidden border border-border bg-background shadow-surface-5',
192
+ shape.container,
193
+ )}
194
+ style={{ width, height, zoom: scale }}
195
+ >
196
+ <div className="relative flex h-9 shrink-0 items-center gap-2 border-b border-border px-3.5">
197
+ {LIGHTS.map(light => (
198
+ <span key={light} aria-hidden className={cn('size-3 rounded-full', light)} />
199
+ ))}
200
+ {title && (
201
+ <span className="pointer-events-none absolute inset-x-0 text-center text-body weight-medium text-foreground">
202
+ {title}
203
+ </span>
204
+ )}
205
+ </div>
206
+ <div className="min-h-0 flex-1">{children}</div>
207
+ </div>
208
+ </div>
209
+ )
210
+ }
package/package.json CHANGED
@@ -1,6 +1,119 @@
1
1
  {
2
2
  "name": "@justanarthur/modo-ui-notch",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "type": "module",
4
+ "version": "0.2.0",
5
+ "description": "A macOS notch app kit on modo-ui: the island that grows out of the notch (idle, compact, split, expanded, flash), its tabs across the wings and the pieces its activities show. Documented with modo.",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "design-system",
9
+ "react",
10
+ "components",
11
+ "notch",
12
+ "dynamic-island",
13
+ "macos",
14
+ "modo-ui"
15
+ ],
16
+ "homepage": "https://justanarthur.github.io/modo/notch/",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/justAnArthur/modo.git",
20
+ "directory": "kits/notch"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/justAnArthur/modo/issues"
24
+ },
25
+ "author": {
26
+ "name": "justAnArthur",
27
+ "email": "kozubov.arthur@gmail.com"
28
+ },
29
+ "properties": {
30
+ "gitCommitScopeRelatedNames": "notch,modo-ui-notch,@justanarthur/modo-ui-notch,justanarthur/modo-ui-notch"
31
+ },
32
+ "publishConfig": {
33
+ "registry": "https://registry.npmjs.org/",
34
+ "access": "public"
35
+ },
36
+ "files": [
37
+ "dist",
38
+ "index.ts",
39
+ "lib/*.ts",
40
+ "lib/*.tsx",
41
+ "components",
42
+ "blocks",
43
+ "mock",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
47
+ "engines": {
48
+ "node": ">=20"
49
+ },
50
+ "module": "./dist/index.js",
51
+ "types": "./dist/index.d.ts",
52
+ "exports": {
53
+ ".": {
54
+ "types": "./dist/index.d.ts",
55
+ "source": "./index.ts",
56
+ "default": "./dist/index.js"
57
+ },
58
+ "./components/*": {
59
+ "types": "./dist/components/*/index.d.ts",
60
+ "source": "./components/*/index.tsx",
61
+ "default": "./dist/components/*/index.js"
62
+ },
63
+ "./blocks/*": {
64
+ "types": "./dist/blocks/*/index.d.ts",
65
+ "source": "./blocks/*/index.tsx",
66
+ "default": "./dist/blocks/*/index.js"
67
+ },
68
+ "./lib/geometry": {
69
+ "types": "./dist/lib/geometry.d.ts",
70
+ "source": "./lib/geometry.ts",
71
+ "default": "./dist/lib/geometry.js"
72
+ },
73
+ "./lib/island-context": {
74
+ "types": "./dist/lib/island-context.d.ts",
75
+ "source": "./lib/island-context.tsx",
76
+ "default": "./dist/lib/island-context.js"
77
+ },
78
+ "./lib/clock": {
79
+ "types": "./dist/lib/clock.d.ts",
80
+ "source": "./lib/clock.ts",
81
+ "default": "./dist/lib/clock.js"
82
+ },
83
+ "./lib/motion": {
84
+ "types": "./dist/lib/motion.d.ts",
85
+ "source": "./lib/motion.ts",
86
+ "default": "./dist/lib/motion.js"
87
+ },
88
+ "./styles.css": "./dist/styles.css",
89
+ "./package.json": "./package.json"
90
+ },
91
+ "scripts": {
92
+ "build": "rm -rf dist && NODE_ENV=production bunup && bun scripts/build-css.ts",
93
+ "build:docs": "modo build --out docs-dist",
94
+ "dev": "modo dev",
95
+ "check": "tsc --noEmit",
96
+ "check:dist": "bun scripts/check-dist.ts"
97
+ },
98
+ "dependencies": {
99
+ "lucide-react": "^1.47.0",
100
+ "motion": "^13.4.0"
101
+ },
102
+ "peerDependencies": {
103
+ "@justanarthur/modo-ui": "^2.1.0",
104
+ "react": ">=18",
105
+ "react-dom": ">=18"
106
+ },
107
+ "devDependencies": {
108
+ "@justanarthur/modo": "1.1.0",
109
+ "@justanarthur/modo-ui": "2.1.0",
110
+ "@types/react": "^18.3.0",
111
+ "@types/react-dom": "^18.3.0",
112
+ "bunup": "^0.16.0",
113
+ "react": "^18.3.0",
114
+ "react-dom": "^18.3.0",
115
+ "typescript": "^5.4.0",
116
+ "unocss": "66.10.5",
117
+ "vite": "^8.3.8"
118
+ }
119
+ }