@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.
Files changed (148) hide show
  1. package/README.md +11 -11
  2. package/blocks/activities/agenda/examples.mdx +21 -5
  3. package/blocks/activities/agenda/index.tsx +291 -182
  4. package/blocks/activities/clock/examples.mdx +73 -0
  5. package/blocks/activities/clock/index.tsx +619 -0
  6. package/blocks/activities/now-playing/examples.mdx +32 -13
  7. package/blocks/activities/now-playing/index.tsx +319 -126
  8. package/blocks/activities/weather/examples.mdx +115 -0
  9. package/blocks/activities/weather/index.tsx +634 -0
  10. package/blocks/app/expanded-island/examples.mdx +8 -7
  11. package/blocks/app/expanded-island/index.tsx +19 -3
  12. package/blocks/app/settings-window/examples.mdx +6 -2
  13. package/blocks/app/settings-window/index.tsx +25 -7
  14. package/blocks/system/clipboard/examples.mdx +83 -0
  15. package/blocks/system/clipboard/index.tsx +563 -0
  16. package/blocks/system/recent-files/examples.mdx +66 -0
  17. package/blocks/system/recent-files/index.tsx +542 -0
  18. package/blocks/system/system-stats/examples.mdx +38 -9
  19. package/blocks/system/system-stats/index.tsx +241 -107
  20. package/components/indicators/media-scrubber/examples.mdx +8 -0
  21. package/components/indicators/media-scrubber/index.tsx +37 -13
  22. package/components/island/island/examples.mdx +4 -4
  23. package/components/island/island/index.tsx +2 -2
  24. package/components/island/island-flash/examples.mdx +15 -18
  25. package/components/island/island-flash/index.tsx +4 -4
  26. package/components/island/island-tabs/examples.mdx +5 -5
  27. package/components/island/widget/examples.mdx +76 -0
  28. package/components/island/widget/index.tsx +431 -0
  29. package/dist/blocks/activities/agenda/index.d.ts +1 -1
  30. package/dist/blocks/activities/agenda/index.js +3 -3
  31. package/dist/blocks/activities/clock/index.d.ts +2 -0
  32. package/dist/blocks/activities/clock/index.js +25 -0
  33. package/dist/blocks/activities/now-playing/index.d.ts +3 -2
  34. package/dist/blocks/activities/now-playing/index.js +5 -3
  35. package/dist/blocks/activities/weather/index.d.ts +2 -0
  36. package/dist/blocks/activities/weather/index.js +21 -0
  37. package/dist/blocks/app/expanded-island/index.d.ts +1 -1
  38. package/dist/blocks/app/expanded-island/index.js +4 -3
  39. package/dist/blocks/app/settings-window/index.d.ts +1 -1
  40. package/dist/blocks/app/settings-window/index.js +1 -1
  41. package/dist/blocks/system/clipboard/index.d.ts +2 -0
  42. package/dist/blocks/system/clipboard/index.js +17 -0
  43. package/dist/blocks/system/recent-files/index.d.ts +2 -0
  44. package/dist/blocks/system/recent-files/index.js +19 -0
  45. package/dist/blocks/system/system-stats/index.d.ts +2 -2
  46. package/dist/blocks/system/system-stats/index.js +4 -1
  47. package/dist/components/indicators/media-scrubber/index.d.ts +1 -1
  48. package/dist/components/indicators/media-scrubber/index.js +1 -1
  49. package/dist/components/island/island/index.d.ts +1 -1
  50. package/dist/components/island/island/index.js +2 -2
  51. package/dist/components/island/island-flash/index.d.ts +1 -1
  52. package/dist/components/island/island-flash/index.js +1 -1
  53. package/dist/components/island/island-tabs/index.js +2 -2
  54. package/dist/components/island/widget/index.d.ts +2 -0
  55. package/dist/components/island/widget/index.js +30 -0
  56. package/dist/index.d.ts +15 -15
  57. package/dist/index.js +102 -58
  58. package/dist/lib/artwork.d.ts +2 -0
  59. package/dist/lib/artwork.js +8 -0
  60. package/dist/lib/geometry.js +1 -1
  61. package/dist/shared/chunk-2818esrq.d.ts +140 -0
  62. package/dist/shared/{chunk-yngkkxz2.d.ts → chunk-2m5dz8nf.d.ts} +4 -4
  63. package/dist/shared/chunk-3thgcfcq.d.ts +151 -0
  64. package/dist/shared/chunk-416tsgbc.d.ts +175 -0
  65. package/dist/shared/{chunk-zvh0d3qb.js → chunk-61t2dfte.js} +1 -1
  66. package/dist/shared/chunk-7fvnrtz4.d.ts +105 -0
  67. package/dist/shared/{chunk-hpsabfsd.d.ts → chunk-81fpptwp.d.ts} +1 -1
  68. package/dist/shared/chunk-9c7ewvkk.js +381 -0
  69. package/dist/shared/{chunk-mp1nx0ez.js → chunk-9m0xbg5v.js} +14 -3
  70. package/dist/shared/{chunk-wwjxs75m.js → chunk-9xtcv3sy.js} +26 -12
  71. package/dist/shared/chunk-bvtyjcce.d.ts +123 -0
  72. package/dist/shared/{chunk-s33y1pcq.js → chunk-cc9nwbtf.js} +20 -10
  73. package/dist/shared/chunk-da177e8r.d.ts +114 -0
  74. package/dist/shared/{chunk-6c1jbefs.d.ts → chunk-fexwzycv.d.ts} +3 -3
  75. package/dist/shared/chunk-gejenfap.d.ts +25 -0
  76. package/dist/shared/{chunk-rr5e0g15.d.ts → chunk-j755a1a5.d.ts} +7 -1
  77. package/dist/shared/chunk-j77cx8dp.js +498 -0
  78. package/dist/shared/chunk-mt0k6v8x.js +474 -0
  79. package/dist/shared/{chunk-78w7qwp0.js → chunk-ndf79pv5.js} +1 -1
  80. package/dist/shared/{chunk-9nhpg9t8.d.ts → chunk-pfhy5e4q.d.ts} +7 -1
  81. package/dist/shared/chunk-qdzemt2v.js +477 -0
  82. package/dist/shared/{chunk-rpfwv3pz.js → chunk-r471sknr.js} +1 -1
  83. package/dist/shared/chunk-s2jeqqan.js +243 -0
  84. package/dist/shared/chunk-t0hcxh89.d.ts +124 -0
  85. package/dist/shared/chunk-w5h6ay93.js +72 -0
  86. package/dist/shared/chunk-wkg17nxs.d.ts +101 -0
  87. package/dist/shared/chunk-x7f3g82r.js +285 -0
  88. package/dist/shared/chunk-xq5hc5gv.js +333 -0
  89. package/dist/shared/{chunk-sbnrhy5m.js → chunk-y0188bbn.js} +2 -2
  90. package/dist/shared/chunk-ym0xbses.js +518 -0
  91. package/dist/styles.css +97 -55
  92. package/index.ts +7 -6
  93. package/lib/artwork.ts +112 -0
  94. package/lib/geometry.ts +1 -1
  95. package/mock/activities.tsx +9 -32
  96. package/mock/artwork.tsx +13 -1
  97. package/mock/clipboard.tsx +79 -0
  98. package/mock/clock.tsx +77 -0
  99. package/mock/data.ts +30 -44
  100. package/mock/files.tsx +70 -0
  101. package/mock/island-content.tsx +43 -118
  102. package/mock/screen.tsx +76 -0
  103. package/mock/settings.tsx +370 -91
  104. package/mock/system.ts +46 -0
  105. package/mock/weather.tsx +105 -0
  106. package/package.json +7 -2
  107. package/blocks/activities/shelf/examples.mdx +0 -33
  108. package/blocks/activities/shelf/index.tsx +0 -289
  109. package/blocks/activities/timer/examples.mdx +0 -52
  110. package/blocks/activities/timer/index.tsx +0 -292
  111. package/blocks/system/controls/examples.mdx +0 -34
  112. package/blocks/system/controls/index.tsx +0 -167
  113. package/blocks/system/devices/examples.mdx +0 -25
  114. package/blocks/system/devices/index.tsx +0 -172
  115. package/blocks/system/power-alert/examples.mdx +0 -32
  116. package/blocks/system/power-alert/index.tsx +0 -89
  117. package/components/indicators/battery-glyph/examples.mdx +0 -22
  118. package/components/indicators/battery-glyph/index.tsx +0 -91
  119. package/dist/blocks/activities/shelf/index.d.ts +0 -2
  120. package/dist/blocks/activities/shelf/index.js +0 -14
  121. package/dist/blocks/activities/timer/index.d.ts +0 -2
  122. package/dist/blocks/activities/timer/index.js +0 -19
  123. package/dist/blocks/system/controls/index.d.ts +0 -2
  124. package/dist/blocks/system/controls/index.js +0 -10
  125. package/dist/blocks/system/devices/index.d.ts +0 -2
  126. package/dist/blocks/system/devices/index.js +0 -12
  127. package/dist/blocks/system/power-alert/index.d.ts +0 -2
  128. package/dist/blocks/system/power-alert/index.js +0 -9
  129. package/dist/components/indicators/battery-glyph/index.d.ts +0 -2
  130. package/dist/components/indicators/battery-glyph/index.js +0 -9
  131. package/dist/shared/chunk-2qpcsv5h.d.ts +0 -45
  132. package/dist/shared/chunk-45gytfr1.d.ts +0 -84
  133. package/dist/shared/chunk-50ffk4r7.d.ts +0 -69
  134. package/dist/shared/chunk-5w0yck07.d.ts +0 -32
  135. package/dist/shared/chunk-7hr53mby.js +0 -116
  136. package/dist/shared/chunk-b8jb1w72.js +0 -145
  137. package/dist/shared/chunk-cpewy6yg.js +0 -178
  138. package/dist/shared/chunk-e3e4s4ds.d.ts +0 -77
  139. package/dist/shared/chunk-enm6td0p.js +0 -280
  140. package/dist/shared/chunk-fvedaas2.d.ts +0 -33
  141. package/dist/shared/chunk-gex38j8x.d.ts +0 -82
  142. package/dist/shared/chunk-hwtxpzg0.js +0 -69
  143. package/dist/shared/chunk-phb53x1f.js +0 -252
  144. package/dist/shared/chunk-r8esmjfs.d.ts +0 -42
  145. package/dist/shared/chunk-rcp1g9ca.js +0 -70
  146. package/dist/shared/chunk-rx9sphz2.js +0 -266
  147. package/dist/shared/chunk-xdeek16r.d.ts +0 -58
  148. package/dist/shared/chunk-xkzjk1tq.js +0 -206
@@ -8,15 +8,18 @@
8
8
  'use client'
9
9
 
10
10
  import Button from '@justanarthur/modo-ui/components/actions/button'
11
+ import { useReduceMotion } from '@justanarthur/modo-ui/lib/reduced-motion'
11
12
  import { useControllableState } from '@justanarthur/modo-ui/lib/use-controllable-state'
12
13
  import { cn } from '@justanarthur/modo-ui/lib/utils'
13
14
  import ScrollArea from '@justanarthur/modo-ui/primitives/layout/scroll-area'
14
15
  import { SizeProvider } from '@justanarthur/modo-ui/primitives/systems/sizes'
15
16
  import { Settings } from 'lucide-react'
17
+ import { motion } from 'motion/react'
16
18
  import { type ReactNode, useState } from 'react'
17
19
  import IslandTabs, { type IslandTab } from '../../../components/island/island-tabs'
18
20
  import { DEFAULT_NOTCH, INSET } from '../../../lib/geometry'
19
21
  import { useIsland } from '../../../lib/island-context'
22
+ import { contentEnter, contentHidden, contentShown } from '../../../lib/motion'
20
23
 
21
24
  interface ExpandedIslandTab extends IslandTab {
22
25
  /** The tab's view, in the content area. */
@@ -52,9 +55,15 @@ interface ExpandedIslandProps {
52
55
  * the selected tab's title, or the hovered tab's as a preview. The view
53
56
  * fills the rest: the area keeps its height whatever the view holds, and a
54
57
  * taller view scrolls inside it, its edges fading with `scroll-fade` (a
55
- * modo-ui ScrollArea), back at the top on each new tab. Every part starts at
58
+ * modo-ui ScrollArea), back at the top on each new tab, where the new view
59
+ * sharpens in the way the island swaps its content. Every part starts at
56
60
  * the island's one inset, clear of its rounded bottom corners.
57
61
  *
62
+ * The views are made for the area the default panel leaves (about 680 × 165
63
+ * at 720 × 240): build each one on the kit's Widget frame, so every tab has
64
+ * one hero set large, a muted line, its facts and quiet actions in the same
65
+ * places.
66
+ *
58
67
  * Pass it as the Island's `expanded`; it reads the notch from the Island.
59
68
  * Selection runs through `value` / `onValueChange`, or is kept here from
60
69
  * `defaultValue`.
@@ -77,6 +86,7 @@ export default function ExpandedIsland({
77
86
  const tab = tabs.find(t => t.value === value) ?? tabs[0]
78
87
  const title = tabs.find(t => t.value === hovered)?.label ?? tab?.label
79
88
  const notch = island?.geometry.notch.height ?? DEFAULT_NOTCH.height
89
+ const reduced = useReduceMotion()
80
90
 
81
91
  return (
82
92
  <div className={cn('flex size-full flex-col', className)}>
@@ -110,13 +120,19 @@ export default function ExpandedIsland({
110
120
  className="min-h-0 flex-1"
111
121
  viewportClassName="scroll-fade [&>div]:flex [&>div]:min-h-full [&>div]:flex-col"
112
122
  >
113
- <div className="flex flex-1 flex-col py-1 [&>*]:flex-1" style={{ paddingInline: INSET }}>
123
+ <motion.div
124
+ className="flex flex-1 flex-col py-1 [&>*]:flex-1"
125
+ style={{ paddingInline: INSET }}
126
+ initial={reduced ? { opacity: 0 } : contentHidden}
127
+ animate={reduced ? { opacity: 1 } : contentShown}
128
+ transition={contentEnter}
129
+ >
114
130
  {tab ? (
115
131
  tab.content
116
132
  ) : (
117
133
  <div className="flex items-center justify-center text-caption text-muted-foreground">{empty}</div>
118
134
  )}
119
- </div>
135
+ </motion.div>
120
136
  </ScrollArea>
121
137
  </div>
122
138
  </div>
@@ -11,8 +11,10 @@ General, Plugins, Permissions and About, then a page per plugin's settings.
11
11
 
12
12
  # Plugins
13
13
 
14
+ A switch per plugin, and a chevron to the page of one that brings settings.
15
+
14
16
  <MockWindow title="Settings">
15
- <SettingsWindow name="Just Notch" defaultValue="plugins" plugins={PLUGINS} defaultEnabled={{ stats: false, devices: false }} permissions={PERMISSIONS} about={ABOUT} />
17
+ <SettingsWindow name="Just Notch" defaultValue="plugins" plugins={PLUGINS} defaultEnabled={{ system: false }} permissions={PERMISSIONS} about={ABOUT} />
16
18
  </MockWindow>
17
19
 
18
20
  # Permissions
@@ -25,6 +27,8 @@ A spinner while one is read; Open Settings beside one that isn't granted.
25
27
 
26
28
  # A plugin's settings
27
29
 
30
+ Grouped rows: a label, what it does, the control at the end.
31
+
28
32
  <MockWindow title="Settings">
29
- <SettingsWindow name="Just Notch" defaultValue="plugin:calendar" plugins={PLUGINS} permissions={PERMISSIONS} about={ABOUT} />
33
+ <SettingsWindow name="Just Notch" defaultValue="plugin:clock" plugins={PLUGINS} permissions={PERMISSIONS} about={ABOUT} />
30
34
  </MockWindow>
@@ -16,7 +16,7 @@ import type { IconComponent } from '@justanarthur/modo-ui/lib/icon-context'
16
16
  import { useControllableState } from '@justanarthur/modo-ui/lib/use-controllable-state'
17
17
  import { cn } from '@justanarthur/modo-ui/lib/utils'
18
18
  import ScrollArea from '@justanarthur/modo-ui/primitives/layout/scroll-area'
19
- import { Info, Puzzle, Settings2, ShieldCheck } from 'lucide-react'
19
+ import { ChevronRight, Info, Puzzle, Settings2, ShieldCheck } from 'lucide-react'
20
20
  import type { ReactNode } from 'react'
21
21
 
22
22
  type ScreensPreference = 'notched' | 'all'
@@ -149,9 +149,10 @@ interface PluginsProps {
149
149
  plugins: SettingsPlugin[]
150
150
  enabled: Record<string, boolean>
151
151
  onChange: (enabled: Record<string, boolean>) => void
152
+ onOpen: (id: string) => void
152
153
  }
153
154
 
154
- function Plugins({ plugins, enabled, onChange }: PluginsProps) {
155
+ function Plugins({ plugins, enabled, onChange, onOpen }: PluginsProps) {
155
156
  return (
156
157
  <Page title="Plugins" lead="Each plugin adds activities and widgets to the island.">
157
158
  {plugins.length === 0 ? (
@@ -172,6 +173,16 @@ function Plugins({ plugins, enabled, onChange }: PluginsProps) {
172
173
  }
173
174
  description={plugin.description}
174
175
  >
176
+ {plugin.settings !== undefined && (
177
+ <Button
178
+ variant="ghost"
179
+ size="icon"
180
+ aria-label={`${plugin.name} settings`}
181
+ onClick={() => onOpen(plugin.id)}
182
+ >
183
+ <ChevronRight />
184
+ </Button>
185
+ )}
175
186
  <Switch
176
187
  aria-label={plugin.name}
177
188
  className={LIST_SWITCH}
@@ -260,10 +271,10 @@ const PAGES: { value: string; label: string; icon: IconComponent }[] = [
260
271
  * it never folds into a drawer) lists the pages under the app's `name`, then
261
272
  * the plugins that bring settings. General holds the launch at login Switch
262
273
  * and a ChoiceList of the screens the island shows on. Plugins lists each
263
- * installed plugin with its glyph, its line and a Switch that turns it on or
264
- * off. Permissions shows what macOS granted as a StatusDot per row, with
265
- * Open Settings beside one that isn't granted, and a spinner while it's
266
- * being read. About lists the `about` rows. A plugin's page shows its
274
+ * installed plugin with its glyph, its line, a Switch that turns it on or
275
+ * off and, for one that brings settings, a chevron to its page. Permissions
276
+ * shows what macOS granted as a StatusDot per row, with Open Settings beside
277
+ * one that isn't granted, and a spinner while it's being read. About lists the `about` rows. A plugin's page shows its
267
278
  * `settings` node under its name.
268
279
  *
269
280
  * The page, the preferences and the plugins' states each run both ways
@@ -338,7 +349,14 @@ export default function SettingsWindow({
338
349
  <ScrollArea key={page} className="h-full" viewportClassName="scroll-fade">
339
350
  <div className="mx-auto flex w-full max-w-160 flex-col gap-8 p-8">
340
351
  {page === 'general' && <General preferences={preferences} onChange={setPreferences} />}
341
- {page === 'plugins' && <Plugins plugins={plugins} enabled={enabled} onChange={setEnabled} />}
352
+ {page === 'plugins' && (
353
+ <Plugins
354
+ plugins={plugins}
355
+ enabled={enabled}
356
+ onChange={setEnabled}
357
+ onOpen={id => setPage(`plugin:${id}`)}
358
+ />
359
+ )}
342
360
  {page === 'permissions' && <Permissions permissions={permissions} onOpen={onOpenPermission} />}
343
361
  {page === 'about' && <About rows={about} />}
344
362
  {plugin && (
@@ -0,0 +1,83 @@
1
+ import ClipboardHistory from './index'
2
+ import { FlashIsland, WidgetIsland, WingsIsland } from '../../../mock/island-content'
3
+ import { CLIP_NOW, CLIPS, PINNED } from '../../../mock/clipboard'
4
+
5
+ # Latest clip
6
+
7
+ The newest clip as the hero, with where it came from and Copy; the history beside it, pinned clips on top. Arrow keys move the selection, Enter copies.
8
+
9
+ <WidgetIsland tab="clipboard">
10
+ <ClipboardHistory clips={CLIPS} defaultPinned={PINNED} now={CLIP_NOW} onDelete={() => {}} />
11
+ </WidgetIsland>
12
+
13
+ # Kinds
14
+
15
+ Each kind previews as what it is.
16
+
17
+ ## Link
18
+
19
+ The domain with its favicon, the page's title, the path.
20
+
21
+ <WidgetIsland tab="clipboard">
22
+ <ClipboardHistory clips={CLIPS} defaultValue="docs" now={CLIP_NOW} onDelete={() => {}} />
23
+ </WidgetIsland>
24
+
25
+ ## Image
26
+
27
+ <WidgetIsland tab="clipboard">
28
+ <ClipboardHistory clips={CLIPS} defaultValue="shot" now={CLIP_NOW} onDelete={() => {}} />
29
+ </WidgetIsland>
30
+
31
+ ## Color
32
+
33
+ <WidgetIsland tab="clipboard">
34
+ <ClipboardHistory clips={CLIPS} defaultValue="brand" defaultPinned={PINNED} now={CLIP_NOW} onDelete={() => {}} />
35
+ </WidgetIsland>
36
+
37
+ ## File
38
+
39
+ <WidgetIsland tab="clipboard">
40
+ <ClipboardHistory clips={CLIPS} defaultValue="brief" now={CLIP_NOW} onDelete={() => {}} />
41
+ </WidgetIsland>
42
+
43
+ # Searching
44
+
45
+ `defaultQuery` (or `query`) narrows the list; the hero follows the first match.
46
+
47
+ <WidgetIsland tab="clipboard">
48
+ <ClipboardHistory clips={CLIPS} defaultQuery="main" now={CLIP_NOW} />
49
+ </WidgetIsland>
50
+
51
+ # Paused, an app ignored
52
+
53
+ `paused` stops recording, with a chip and Resume on the context line; `ignoredApp` says whose copies are never kept.
54
+
55
+ <WidgetIsland tab="clipboard">
56
+ <ClipboardHistory clips={CLIPS} defaultPaused ignoredApp="1Password" now={CLIP_NOW} />
57
+ </WidgetIsland>
58
+
59
+ # Empty
60
+
61
+ <WidgetIsland tab="clipboard">
62
+ <ClipboardHistory clips={[]} />
63
+ </WidgetIsland>
64
+
65
+ # Empty and paused
66
+
67
+ <WidgetIsland tab="clipboard">
68
+ <ClipboardHistory clips={[]} defaultPaused />
69
+ </WidgetIsland>
70
+
71
+ # Compact
72
+
73
+ `ClipboardHistory.Leading` and `ClipboardHistory.Trailing`: the glyph and the clips that came in since the island was open.
74
+
75
+ <WingsIsland leading={<ClipboardHistory.Leading />} trailing={<ClipboardHistory.Trailing count={3} />} />
76
+
77
+ # Copied
78
+
79
+ `ClipboardHistory.Copied`, the flash when something is copied, with Pin.
80
+
81
+ <FlashIsland>
82
+ <ClipboardHistory.Copied clip={CLIPS[3]} onPin={() => {}} />
83
+ </FlashIsland>