@justanarthur/modo-ui-notch 0.3.0 → 0.4.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/blocks/activities/agenda/examples.mdx +8 -0
- package/blocks/activities/agenda/index.tsx +164 -16
- package/blocks/activities/clock/examples.mdx +16 -0
- package/blocks/activities/clock/index.tsx +357 -59
- package/blocks/activities/now-playing/examples.mdx +8 -0
- package/blocks/activities/now-playing/index.tsx +140 -54
- package/blocks/activities/weather/examples.mdx +9 -1
- package/blocks/activities/weather/index.tsx +241 -12
- package/blocks/app/expanded-island/index.tsx +3 -1
- package/blocks/app/settings-window/examples.mdx +8 -0
- package/blocks/app/settings-window/index.tsx +8 -3
- package/blocks/system/clipboard/examples.mdx +8 -0
- package/blocks/system/clipboard/index.tsx +262 -52
- package/blocks/system/recent-files/examples.mdx +14 -0
- package/blocks/system/recent-files/index.tsx +110 -25
- package/blocks/system/system-stats/examples.mdx +8 -0
- package/blocks/system/system-stats/index.tsx +211 -4
- package/components/island/widget/index.tsx +34 -0
- package/dist/blocks/activities/agenda/index.d.ts +2 -1
- package/dist/blocks/activities/agenda/index.js +2 -2
- package/dist/blocks/activities/clock/index.d.ts +2 -1
- package/dist/blocks/activities/clock/index.js +2 -2
- package/dist/blocks/activities/now-playing/index.d.ts +2 -1
- package/dist/blocks/activities/now-playing/index.js +2 -2
- package/dist/blocks/activities/weather/index.d.ts +2 -1
- package/dist/blocks/activities/weather/index.js +2 -2
- package/dist/blocks/app/expanded-island/index.d.ts +1 -1
- package/dist/blocks/app/expanded-island/index.js +1 -1
- 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 -1
- package/dist/blocks/system/clipboard/index.js +2 -2
- package/dist/blocks/system/recent-files/index.d.ts +2 -1
- package/dist/blocks/system/recent-files/index.js +2 -2
- package/dist/blocks/system/system-stats/index.d.ts +2 -1
- package/dist/blocks/system/system-stats/index.js +2 -2
- package/dist/components/island/widget/index.d.ts +2 -2
- package/dist/components/island/widget/index.js +3 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +12 -10
- package/dist/shared/{chunk-2m5dz8nf.d.ts → chunk-0ym9mcqc.d.ts} +6 -2
- package/dist/shared/{chunk-xq5hc5gv.js → chunk-2b6gpn8k.js} +177 -66
- package/dist/shared/chunk-3hcnf4yx.js +481 -0
- package/dist/shared/{chunk-416tsgbc.d.ts → chunk-42wab62s.d.ts} +23 -1
- package/dist/shared/{chunk-pfhy5e4q.d.ts → chunk-6tnq6p89.d.ts} +2 -0
- package/dist/shared/{chunk-qdzemt2v.js → chunk-93dtpjz7.js} +401 -89
- package/dist/shared/{chunk-da177e8r.d.ts → chunk-a6njb8db.d.ts} +16 -1
- package/dist/shared/{chunk-2818esrq.d.ts → chunk-ab8mdg0n.d.ts} +10 -1
- package/dist/shared/{chunk-3thgcfcq.d.ts → chunk-evqpf92s.d.ts} +18 -1
- package/dist/shared/{chunk-mt0k6v8x.js → chunk-gcyspvgr.js} +147 -39
- package/dist/shared/{chunk-t0hcxh89.d.ts → chunk-gkj0hjrn.d.ts} +12 -0
- package/dist/shared/{chunk-wkg17nxs.d.ts → chunk-n739am8j.d.ts} +13 -2
- package/dist/shared/{chunk-ym0xbses.js → chunk-nwzpekvy.js} +274 -18
- package/dist/shared/{chunk-bvtyjcce.d.ts → chunk-sbrtesdg.d.ts} +16 -1
- package/dist/shared/{chunk-7fvnrtz4.d.ts → chunk-swc7dqpw.d.ts} +12 -2
- package/dist/shared/{chunk-j77cx8dp.js → chunk-t9wqhgzt.js} +325 -58
- package/dist/shared/{chunk-9m0xbg5v.js → chunk-wayv5rhr.js} +1 -1
- package/dist/shared/{chunk-x7f3g82r.js → chunk-wf0jtzhs.js} +12 -2
- package/dist/shared/{chunk-9c7ewvkk.js → chunk-yq5svpk7.js} +162 -19
- package/dist/shared/{chunk-cc9nwbtf.js → chunk-z3tj1ydg.js} +3 -0
- package/dist/styles.css +60 -0
- package/mock/clipboard.tsx +34 -0
- package/mock/clock.tsx +3 -3
- package/mock/data.ts +48 -0
- package/mock/files.tsx +14 -1
- package/mock/island-content.tsx +47 -15
- package/mock/system.ts +3 -0
- package/mock/weather.tsx +42 -12
- package/package.json +1 -1
- package/dist/shared/chunk-s2jeqqan.js +0 -243
|
@@ -82,6 +82,8 @@ interface SettingsWindowProps {
|
|
|
82
82
|
onOpenPermission?: (id: string) => void
|
|
83
83
|
/** The About page's rows: version, mode, screen. Defaults to `[]`. */
|
|
84
84
|
about?: AboutRow[]
|
|
85
|
+
/** Drops the sidebar's inset on the left: its rows run to the window's edge and their text sits only the row's own padding in, so a host can line it up with an edge of its own (the open island's inset). Defaults to `false`. */
|
|
86
|
+
flush?: boolean
|
|
85
87
|
/** Classes for the window's content, which fills its container. */
|
|
86
88
|
className?: string
|
|
87
89
|
}
|
|
@@ -280,7 +282,9 @@ const PAGES: { value: string; label: string; icon: IconComponent }[] = [
|
|
|
280
282
|
* The page, the preferences and the plugins' states each run both ways
|
|
281
283
|
* (`value`, `preferences`, `enabled` with their `default*` and `on*Change`),
|
|
282
284
|
* so the window works on its own or on a host's store. It fills its
|
|
283
|
-
* container; the window's frame and title bar are the host's.
|
|
285
|
+
* container; the window's frame and title bar are the host's. In a frame
|
|
286
|
+
* of the host's own, such as the open island, `flush` drops the sidebar's
|
|
287
|
+
* left inset, so the rows' text sits just the row's padding from the edge.
|
|
284
288
|
*
|
|
285
289
|
* @example {@include ./examples.mdx}
|
|
286
290
|
*/
|
|
@@ -299,6 +303,7 @@ export default function SettingsWindow({
|
|
|
299
303
|
permissions = [],
|
|
300
304
|
onOpenPermission,
|
|
301
305
|
about = [],
|
|
306
|
+
flush = false,
|
|
302
307
|
className,
|
|
303
308
|
}: SettingsWindowProps) {
|
|
304
309
|
const [page, setPage] = useControllableState(value, defaultValue, onValueChange)
|
|
@@ -317,7 +322,7 @@ export default function SettingsWindow({
|
|
|
317
322
|
>
|
|
318
323
|
<Sidebar className="h-full" collapsible="none" value={page} onValueChange={setPage}>
|
|
319
324
|
<Sidebar.Content>
|
|
320
|
-
<Sidebar.Group>
|
|
325
|
+
<Sidebar.Group className={cn(flush && 'pl-0')}>
|
|
321
326
|
<Sidebar.GroupLabel>{name}</Sidebar.GroupLabel>
|
|
322
327
|
<Sidebar.Menu>
|
|
323
328
|
{PAGES.map(item => (
|
|
@@ -330,7 +335,7 @@ export default function SettingsWindow({
|
|
|
330
335
|
</Sidebar.Menu>
|
|
331
336
|
</Sidebar.Group>
|
|
332
337
|
{withSettings.length > 0 && (
|
|
333
|
-
<Sidebar.Group>
|
|
338
|
+
<Sidebar.Group className={cn(flush && 'pl-0')}>
|
|
334
339
|
<Sidebar.GroupLabel>Plugin settings</Sidebar.GroupLabel>
|
|
335
340
|
<Sidebar.Menu>
|
|
336
341
|
{withSettings.map(p => (
|
|
@@ -81,3 +81,11 @@ The domain with its favicon, the page's title, the path.
|
|
|
81
81
|
<FlashIsland>
|
|
82
82
|
<ClipboardHistory.Copied clip={CLIPS[3]} onPin={() => {}} />
|
|
83
83
|
</FlashIsland>
|
|
84
|
+
|
|
85
|
+
# Tall
|
|
86
|
+
|
|
87
|
+
`layout="tall"` at the island's tall snap: the search across the top, every clip as a row with its picture, and the selected clip in full beside them, held in view as the list scrolls.
|
|
88
|
+
|
|
89
|
+
<WidgetIsland tab="clipboard" tall>
|
|
90
|
+
<ClipboardHistory clips={CLIPS} defaultPinned={PINNED} now={CLIP_NOW} onDelete={() => {}} layout="tall" />
|
|
91
|
+
</WidgetIsland>
|
|
@@ -18,7 +18,7 @@ import FluidHover from '@justanarthur/modo-ui/primitives/systems/fluid-hover'
|
|
|
18
18
|
import { ClipboardList, Copy, File, Image, Link2, Palette, Pause, Pin, Play, Search, Trash2, Type } from 'lucide-react'
|
|
19
19
|
import type { KeyboardEvent, ReactNode } from 'react'
|
|
20
20
|
import IslandFlash from '../../../components/island/island-flash'
|
|
21
|
-
import Widget from '../../../components/island/widget'
|
|
21
|
+
import Widget, { type WidgetLayout } from '../../../components/island/widget'
|
|
22
22
|
import { MINUTE, useEdgeClock } from '../../../lib/clock'
|
|
23
23
|
|
|
24
24
|
type ClipboardClipKind = 'text' | 'link' | 'image' | 'color' | 'file'
|
|
@@ -77,6 +77,8 @@ interface ClipboardHistoryProps {
|
|
|
77
77
|
onDelete?: (clip: ClipboardClip) => void
|
|
78
78
|
/** The moment the times are read at, in epoch ms. Defaults to now, re-read on each minute. */
|
|
79
79
|
now?: number
|
|
80
|
+
/** `tall` is the open island's tall snap: the search across the top, every clip as a two-line row with its picture, and the selected clip in full beside them with its actions. Defaults to `'fit'`. */
|
|
81
|
+
layout?: WidgetLayout
|
|
80
82
|
/** Step on the size ladder. Omitted, it follows the surrounding SizeProvider. */
|
|
81
83
|
size?: SizeVariant
|
|
82
84
|
/** Classes for the root, which fills its container. */
|
|
@@ -230,20 +232,28 @@ interface HeroProps {
|
|
|
230
232
|
onDelete?: (clip: ClipboardClip) => void
|
|
231
233
|
}
|
|
232
234
|
|
|
233
|
-
|
|
235
|
+
/** Pin, Delete and Copy for the selected clip. */
|
|
236
|
+
function Actions({ clip, pinned, onPin, onCopy, onDelete }: HeroProps) {
|
|
237
|
+
return (
|
|
238
|
+
<div className="-mr-1 flex shrink-0 items-center gap-0.5">
|
|
239
|
+
<Widget.Action icon={Pin} label={pinned ? 'Unpin' : 'Pin'} pressed={pinned} onClick={onPin} />
|
|
240
|
+
{onDelete && <Widget.Action icon={Trash2} label="Delete" onClick={() => onDelete(clip)} />}
|
|
241
|
+
<Button variant="primary" size="compact" leadingIcon={Copy} className="ml-1.5" onClick={() => onCopy?.(clip)}>
|
|
242
|
+
Copy
|
|
243
|
+
</Button>
|
|
244
|
+
</div>
|
|
245
|
+
)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function Hero(props: HeroProps) {
|
|
249
|
+
const { clip } = props
|
|
234
250
|
const line = fact(clip)
|
|
235
251
|
return (
|
|
236
252
|
<div className="flex min-w-0 flex-col gap-2">
|
|
237
253
|
<Body clip={clip} />
|
|
238
254
|
<div className="flex min-w-0 items-center justify-between gap-3">
|
|
239
255
|
<Widget.Meta>{line && <Widget.MetaItem icon={KIND_ICON[clip.kind]}>{line}</Widget.MetaItem>}</Widget.Meta>
|
|
240
|
-
<
|
|
241
|
-
<Widget.Action icon={Pin} label={pinned ? 'Unpin' : 'Pin'} pressed={pinned} onClick={onPin} />
|
|
242
|
-
{onDelete && <Widget.Action icon={Trash2} label="Delete" onClick={() => onDelete(clip)} />}
|
|
243
|
-
<Button variant="primary" size="compact" leadingIcon={Copy} className="ml-1.5" onClick={() => onCopy?.(clip)}>
|
|
244
|
-
Copy
|
|
245
|
-
</Button>
|
|
246
|
-
</div>
|
|
256
|
+
<Actions {...props} />
|
|
247
257
|
</div>
|
|
248
258
|
</div>
|
|
249
259
|
)
|
|
@@ -320,6 +330,182 @@ function List({ order, selected, pinned, now, searching, onPick, onCopy }: ListP
|
|
|
320
330
|
)
|
|
321
331
|
}
|
|
322
332
|
|
|
333
|
+
/** A tall row's picture: a swatch, a thumbnail or favicon, else its kind's glyph, on a tile one surface up. */
|
|
334
|
+
function Tile({ clip }: { clip: ClipboardClip }) {
|
|
335
|
+
const level = useLift(1)
|
|
336
|
+
if (clip.kind === 'color')
|
|
337
|
+
return (
|
|
338
|
+
<span
|
|
339
|
+
aria-hidden
|
|
340
|
+
className="size-8 shrink-0 rounded-lg ring-1 ring-border ring-inset"
|
|
341
|
+
style={{ backgroundColor: paint(clip) }}
|
|
342
|
+
/>
|
|
343
|
+
)
|
|
344
|
+
if (clip.kind === 'image' && clip.preview != null)
|
|
345
|
+
return <Picture preview={clip.preview} className="size-8 rounded-lg" />
|
|
346
|
+
const Icon = KIND_ICON[clip.kind]
|
|
347
|
+
return (
|
|
348
|
+
<span
|
|
349
|
+
className={cn(
|
|
350
|
+
'flex size-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground',
|
|
351
|
+
SURFACE_BG[level],
|
|
352
|
+
)}
|
|
353
|
+
>
|
|
354
|
+
{clip.kind === 'link' && clip.preview != null ? (
|
|
355
|
+
<Picture preview={clip.preview} className="size-4 rounded-sm" />
|
|
356
|
+
) : (
|
|
357
|
+
<Icon size={15} strokeWidth={1.5} />
|
|
358
|
+
)}
|
|
359
|
+
</span>
|
|
360
|
+
)
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** Every clip as a two-line row: its picture, its text, where and when; pinned first, the selected one lit one surface up. */
|
|
364
|
+
function SheetList({ order, selected, pinned, now, searching, onPick, onCopy }: ListProps) {
|
|
365
|
+
const level = useLift(1)
|
|
366
|
+
if (!order.length)
|
|
367
|
+
return <span className="flex h-12 items-center text-body text-muted-foreground">No clips match</span>
|
|
368
|
+
|
|
369
|
+
const groups = [
|
|
370
|
+
{ label: 'Pinned', clips: order.filter(clip => pinned.includes(clip.id)) },
|
|
371
|
+
{ label: searching ? 'Matches' : 'Recent', clips: order.filter(clip => !pinned.includes(clip.id)) },
|
|
372
|
+
].filter(group => group.clips.length)
|
|
373
|
+
|
|
374
|
+
return (
|
|
375
|
+
<FluidHover className="-mx-2 flex flex-col gap-0" role="listbox" aria-label="Clipboard history">
|
|
376
|
+
{groups.map(group => (
|
|
377
|
+
<div key={group.label} role="presentation" className="flex min-w-0 flex-col">
|
|
378
|
+
<div className="flex h-7 items-end justify-between px-2 pb-1 text-caption text-muted-foreground">
|
|
379
|
+
<span>{group.label}</span>
|
|
380
|
+
<span className="tabular-nums">{group.clips.length}</span>
|
|
381
|
+
</div>
|
|
382
|
+
{group.clips.map(clip => {
|
|
383
|
+
const index = order.indexOf(clip)
|
|
384
|
+
const current = index === selected
|
|
385
|
+
return (
|
|
386
|
+
<FluidHover.Item
|
|
387
|
+
key={clip.id}
|
|
388
|
+
index={index}
|
|
389
|
+
role="option"
|
|
390
|
+
aria-selected={current}
|
|
391
|
+
tabIndex={-1}
|
|
392
|
+
className={cn('h-12 px-2', current && SURFACE_BG[level])}
|
|
393
|
+
onClick={() => onPick(clip.id)}
|
|
394
|
+
onDoubleClick={() => onCopy?.(clip)}
|
|
395
|
+
>
|
|
396
|
+
<span className="flex w-full min-w-0 items-center gap-3">
|
|
397
|
+
<Tile clip={clip} />
|
|
398
|
+
<span className="flex min-w-0 flex-1 flex-col">
|
|
399
|
+
<span className="truncate text-body text-foreground">
|
|
400
|
+
{clip.kind === 'link' ? (clip.detail ?? domain(clip.content)) : clip.content}
|
|
401
|
+
</span>
|
|
402
|
+
<span className="truncate text-caption text-muted-foreground">
|
|
403
|
+
{[
|
|
404
|
+
clip.kind === 'link' ? domain(clip.content) : (clip.app ?? KIND_LABEL[clip.kind]),
|
|
405
|
+
short(now - clip.copiedAt),
|
|
406
|
+
].join(' · ')}
|
|
407
|
+
</span>
|
|
408
|
+
</span>
|
|
409
|
+
{pinned.includes(clip.id) && (
|
|
410
|
+
<Pin size={12} strokeWidth={1.5} aria-label="Pinned" className="shrink-0 text-muted-foreground" />
|
|
411
|
+
)}
|
|
412
|
+
</span>
|
|
413
|
+
</FluidHover.Item>
|
|
414
|
+
)
|
|
415
|
+
})}
|
|
416
|
+
</div>
|
|
417
|
+
))}
|
|
418
|
+
</FluidHover>
|
|
419
|
+
)
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/** The selected clip in full: the whole text, the link with its title and address, the image or the color large, the file on a tile. */
|
|
423
|
+
function Full({ clip }: { clip: ClipboardClip }) {
|
|
424
|
+
const level = useLift(1)
|
|
425
|
+
if (clip.kind === 'text')
|
|
426
|
+
return (
|
|
427
|
+
<p className="line-clamp-8 min-w-0 whitespace-pre-wrap text-title weight-medium break-words text-foreground">
|
|
428
|
+
{clip.content}
|
|
429
|
+
</p>
|
|
430
|
+
)
|
|
431
|
+
if (clip.kind === 'link')
|
|
432
|
+
return (
|
|
433
|
+
<div className="flex min-w-0 flex-col gap-1">
|
|
434
|
+
<Widget.Title
|
|
435
|
+
leading={clip.preview != null && <Picture preview={clip.preview} className="size-5 rounded-md" />}
|
|
436
|
+
>
|
|
437
|
+
{clip.detail ?? domain(clip.content)}
|
|
438
|
+
</Widget.Title>
|
|
439
|
+
<span className="min-w-0 text-body break-all text-muted-foreground">{clip.content}</span>
|
|
440
|
+
</div>
|
|
441
|
+
)
|
|
442
|
+
|
|
443
|
+
const picture =
|
|
444
|
+
clip.kind === 'color' ? (
|
|
445
|
+
<span
|
|
446
|
+
aria-hidden
|
|
447
|
+
className="block h-36 w-full rounded-2xl ring-1 ring-border ring-inset"
|
|
448
|
+
style={{ backgroundColor: paint(clip) }}
|
|
449
|
+
/>
|
|
450
|
+
) : clip.kind === 'image' && clip.preview != null ? (
|
|
451
|
+
<Picture preview={clip.preview} className="aspect-[16/10] w-full rounded-2xl" />
|
|
452
|
+
) : (
|
|
453
|
+
<span
|
|
454
|
+
className={cn(
|
|
455
|
+
'flex h-36 w-full items-center justify-center rounded-2xl text-muted-foreground',
|
|
456
|
+
SURFACE_BG[level],
|
|
457
|
+
)}
|
|
458
|
+
>
|
|
459
|
+
{clip.kind === 'file' ? <File size={40} strokeWidth={1.25} /> : <Image size={40} strokeWidth={1.25} />}
|
|
460
|
+
</span>
|
|
461
|
+
)
|
|
462
|
+
return (
|
|
463
|
+
<div className="flex min-w-0 flex-col gap-3">
|
|
464
|
+
{picture}
|
|
465
|
+
<div className="flex min-w-0 flex-col gap-0.5">
|
|
466
|
+
<Widget.Title className={cn(clip.kind === 'color' && 'font-mono')}>{clip.content}</Widget.Title>
|
|
467
|
+
{clip.detail && <Widget.Subtitle>{clip.detail}</Widget.Subtitle>}
|
|
468
|
+
</div>
|
|
469
|
+
</div>
|
|
470
|
+
)
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/** The facts under the full clip: its kind, its length or a link's domain, the time it was copied. */
|
|
474
|
+
function Facts({ clip }: { clip: ClipboardClip }) {
|
|
475
|
+
const words = clip.content.trim().split(/\s+/).length
|
|
476
|
+
return (
|
|
477
|
+
<Widget.Meta>
|
|
478
|
+
<Widget.MetaItem icon={KIND_ICON[clip.kind]}>{KIND_LABEL[clip.kind]}</Widget.MetaItem>
|
|
479
|
+
{clip.kind === 'text' && (
|
|
480
|
+
<Widget.MetaItem>
|
|
481
|
+
{words} {words === 1 ? 'word' : 'words'} · {clip.content.length} characters
|
|
482
|
+
</Widget.MetaItem>
|
|
483
|
+
)}
|
|
484
|
+
{clip.kind === 'link' && <Widget.MetaItem>{domain(clip.content)}</Widget.MetaItem>}
|
|
485
|
+
<Widget.MetaItem>
|
|
486
|
+
Copied {new Date(clip.copiedAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
|
|
487
|
+
</Widget.MetaItem>
|
|
488
|
+
</Widget.Meta>
|
|
489
|
+
)
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/** The selected clip beside the list, held in view as the list scrolls: where it came from, the clip in full, its facts and actions. */
|
|
493
|
+
function Detail(props: HeroProps & { now: number }) {
|
|
494
|
+
const { clip, now } = props
|
|
495
|
+
return (
|
|
496
|
+
<div className="sticky top-0 flex min-w-0 flex-col gap-3">
|
|
497
|
+
<Widget.Header icon={KIND_ICON[clip.kind]}>
|
|
498
|
+
{[clip.app ?? KIND_LABEL[clip.kind], ago(now - clip.copiedAt)].join(' · ')}
|
|
499
|
+
</Widget.Header>
|
|
500
|
+
<Full clip={clip} />
|
|
501
|
+
<Facts clip={clip} />
|
|
502
|
+
<div className="flex justify-end pt-1">
|
|
503
|
+
<Actions {...props} />
|
|
504
|
+
</div>
|
|
505
|
+
</div>
|
|
506
|
+
)
|
|
507
|
+
}
|
|
508
|
+
|
|
323
509
|
/** The compact island's left wing: the clipboard glyph. */
|
|
324
510
|
function ClipboardHistoryLeading() {
|
|
325
511
|
return <ClipboardList size={16} strokeWidth={1.5} className="text-foreground" />
|
|
@@ -403,6 +589,18 @@ function ClipboardHistoryCopied({ clip, onPin }: CopiedProps) {
|
|
|
403
589
|
* (`ignoredApp`). With no clips it says what will show up here, or that
|
|
404
590
|
* the history is paused.
|
|
405
591
|
*
|
|
592
|
+
* At the open island's tall snap (`layout="tall"`) it becomes a sheet: the
|
|
593
|
+
* search across the top with the pause and the chips beside it, then a
|
|
594
|
+
* master and detail split. On the left every clip, not three, as a row of
|
|
595
|
+
* two lines: its swatch, thumbnail or glyph on a tile, its text (a link's
|
|
596
|
+
* page title), and where and when it was copied, pinned ones first. On the
|
|
597
|
+
* right, past a hairline and held in view as the list scrolls, the
|
|
598
|
+
* selected clip in full: the whole text over up to eight lines, a link's
|
|
599
|
+
* title with its whole address, an image or a color large, a file on a
|
|
600
|
+
* tile; under it its kind, its length in words and characters, the time
|
|
601
|
+
* it was copied, and Pin, Delete and Copy. The keys work as in the fit
|
|
602
|
+
* layout.
|
|
603
|
+
*
|
|
406
604
|
* `ClipboardHistory.Leading` and `ClipboardHistory.Trailing` show the
|
|
407
605
|
* glyph and the count of new clips in the compact island's wings, and
|
|
408
606
|
* `ClipboardHistory.Copied` is the flash when something is copied.
|
|
@@ -428,6 +626,7 @@ const ClipboardHistory = Object.assign(
|
|
|
428
626
|
onCopy,
|
|
429
627
|
onDelete,
|
|
430
628
|
now: nowProp,
|
|
629
|
+
layout = 'fit',
|
|
431
630
|
size,
|
|
432
631
|
className,
|
|
433
632
|
}: ClipboardHistoryProps) {
|
|
@@ -438,12 +637,15 @@ const ClipboardHistory = Object.assign(
|
|
|
438
637
|
const [query, setQuery] = useControllableState(queryProp, defaultQuery, onQueryChange)
|
|
439
638
|
const [paused, setPaused] = useControllableState(pausedProp, defaultPaused, onPausedChange)
|
|
440
639
|
|
|
441
|
-
const
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
640
|
+
const status = (
|
|
641
|
+
<>
|
|
642
|
+
{paused ? <Widget.Chip>Paused</Widget.Chip> : ignoredApp && <Widget.Chip>Ignoring {ignoredApp}</Widget.Chip>}
|
|
643
|
+
<Widget.Action
|
|
644
|
+
icon={paused ? Play : Pause}
|
|
645
|
+
label={paused ? 'Resume history' : 'Pause history'}
|
|
646
|
+
onClick={() => setPaused(!paused)}
|
|
647
|
+
/>
|
|
648
|
+
</>
|
|
447
649
|
)
|
|
448
650
|
|
|
449
651
|
if (!clips.length)
|
|
@@ -480,6 +682,7 @@ const ClipboardHistory = Object.assign(
|
|
|
480
682
|
const selected = found < 0 ? Math.max(0, order.indexOf(newest[0]!)) : found
|
|
481
683
|
const hero = order[selected] ?? clips[0]!
|
|
482
684
|
const heroPinned = pinned.includes(hero.id)
|
|
685
|
+
const togglePin = () => setPinned(heroPinned ? pinned.filter(id => id !== hero.id) : [...pinned, hero.id])
|
|
483
686
|
|
|
484
687
|
const onKeyDown = (event: KeyboardEvent) => {
|
|
485
688
|
const step = event.key === 'ArrowDown' ? 1 : event.key === 'ArrowUp' ? -1 : 0
|
|
@@ -495,6 +698,46 @@ const ClipboardHistory = Object.assign(
|
|
|
495
698
|
}
|
|
496
699
|
}
|
|
497
700
|
|
|
701
|
+
const search = (
|
|
702
|
+
<Input
|
|
703
|
+
size="compact"
|
|
704
|
+
icon={Search}
|
|
705
|
+
placeholder="Search clips"
|
|
706
|
+
aria-label="Search clips"
|
|
707
|
+
value={query}
|
|
708
|
+
onValueChange={setQuery}
|
|
709
|
+
/>
|
|
710
|
+
)
|
|
711
|
+
const listProps = { order, selected, pinned, now, searching: !!needle, onPick: setValue, onCopy }
|
|
712
|
+
|
|
713
|
+
if (layout === 'tall')
|
|
714
|
+
return (
|
|
715
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: the keys bubble up from the search and the rows
|
|
716
|
+
<div className={cn('flex min-w-0 flex-col', className)} onKeyDown={onKeyDown}>
|
|
717
|
+
<Widget.Sheet size={size} className="gap-4">
|
|
718
|
+
<div className="flex min-w-0 items-center gap-3">
|
|
719
|
+
<div className="min-w-0 flex-1">{search}</div>
|
|
720
|
+
<span className="-mr-1 flex shrink-0 items-center gap-1.5">{status}</span>
|
|
721
|
+
</div>
|
|
722
|
+
<div className="flex min-w-0 items-stretch gap-5">
|
|
723
|
+
<div className="w-[46%] min-w-0 shrink-0">
|
|
724
|
+
<SheetList {...listProps} />
|
|
725
|
+
</div>
|
|
726
|
+
<div className="min-w-0 flex-1 border-l border-border pl-5">
|
|
727
|
+
<Detail
|
|
728
|
+
clip={hero}
|
|
729
|
+
pinned={heroPinned}
|
|
730
|
+
onPin={togglePin}
|
|
731
|
+
onCopy={onCopy}
|
|
732
|
+
onDelete={onDelete}
|
|
733
|
+
now={now}
|
|
734
|
+
/>
|
|
735
|
+
</div>
|
|
736
|
+
</div>
|
|
737
|
+
</Widget.Sheet>
|
|
738
|
+
</div>
|
|
739
|
+
)
|
|
740
|
+
|
|
498
741
|
return (
|
|
499
742
|
// biome-ignore lint/a11y/noStaticElementInteractions: the keys bubble up from the search and the rows
|
|
500
743
|
<div className={cn('flex min-h-0 flex-col', className)} onKeyDown={onKeyDown}>
|
|
@@ -503,49 +746,16 @@ const ClipboardHistory = Object.assign(
|
|
|
503
746
|
className="flex-1"
|
|
504
747
|
aside={
|
|
505
748
|
<div className="flex min-w-0 flex-col gap-1">
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
icon={Search}
|
|
509
|
-
placeholder="Search clips"
|
|
510
|
-
aria-label="Search clips"
|
|
511
|
-
value={query}
|
|
512
|
-
onValueChange={setQuery}
|
|
513
|
-
/>
|
|
514
|
-
<List
|
|
515
|
-
order={order}
|
|
516
|
-
selected={selected}
|
|
517
|
-
pinned={pinned}
|
|
518
|
-
now={now}
|
|
519
|
-
searching={!!needle}
|
|
520
|
-
onPick={setValue}
|
|
521
|
-
onCopy={onCopy}
|
|
522
|
-
/>
|
|
749
|
+
{search}
|
|
750
|
+
<List {...listProps} />
|
|
523
751
|
</div>
|
|
524
752
|
}
|
|
525
753
|
media={hasMedia(hero) && <Media clip={hero} />}
|
|
526
754
|
>
|
|
527
|
-
<Widget.Header
|
|
528
|
-
icon={KIND_ICON[hero.kind]}
|
|
529
|
-
trailing={
|
|
530
|
-
<>
|
|
531
|
-
{paused ? (
|
|
532
|
-
<Widget.Chip>Paused</Widget.Chip>
|
|
533
|
-
) : (
|
|
534
|
-
ignoredApp && <Widget.Chip>Ignoring {ignoredApp}</Widget.Chip>
|
|
535
|
-
)}
|
|
536
|
-
{resume}
|
|
537
|
-
</>
|
|
538
|
-
}
|
|
539
|
-
>
|
|
755
|
+
<Widget.Header icon={KIND_ICON[hero.kind]} trailing={status}>
|
|
540
756
|
{[hero.app ?? KIND_LABEL[hero.kind], ago(now - hero.copiedAt)].join(' · ')}
|
|
541
757
|
</Widget.Header>
|
|
542
|
-
<Hero
|
|
543
|
-
clip={hero}
|
|
544
|
-
pinned={heroPinned}
|
|
545
|
-
onPin={() => setPinned(heroPinned ? pinned.filter(id => id !== hero.id) : [...pinned, hero.id])}
|
|
546
|
-
onCopy={onCopy}
|
|
547
|
-
onDelete={onDelete}
|
|
548
|
-
/>
|
|
758
|
+
<Hero clip={hero} pinned={heroPinned} onPin={togglePin} onCopy={onCopy} onDelete={onDelete} />
|
|
549
759
|
</Widget>
|
|
550
760
|
</div>
|
|
551
761
|
)
|
|
@@ -64,3 +64,17 @@ Each folder says when it is empty; the switch stays.
|
|
|
64
64
|
<FlashIsland>
|
|
65
65
|
<RecentFiles.Saved file={SCREENSHOTS[0]} onOpen={() => {}} />
|
|
66
66
|
</FlashIsland>
|
|
67
|
+
|
|
68
|
+
# Tall
|
|
69
|
+
|
|
70
|
+
`layout="tall"` at the island's tall snap: the newest file large with its actions, and every earlier one as a grid of named tiles.
|
|
71
|
+
|
|
72
|
+
<WidgetIsland tab="files" tall>
|
|
73
|
+
<RecentFiles files={RECENT_FILES} now={FILES_NOW} onReveal={() => {}} onCopy={() => {}} onDelete={() => {}} onClear={() => {}} onDragStart={() => {}} layout="tall" />
|
|
74
|
+
</WidgetIsland>
|
|
75
|
+
|
|
76
|
+
# Tall, screenshots
|
|
77
|
+
|
|
78
|
+
<WidgetIsland tab="files" tall>
|
|
79
|
+
<RecentFiles files={RECENT_FILES} defaultValue="screenshots" now={FILES_NOW} onReveal={() => {}} onCopy={() => {}} onDelete={() => {}} onClear={() => {}} layout="tall" />
|
|
80
|
+
</WidgetIsland>
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
} from 'lucide-react'
|
|
36
36
|
import type { DragEvent, ReactNode } from 'react'
|
|
37
37
|
import IslandFlash from '../../../components/island/island-flash'
|
|
38
|
-
import Widget from '../../../components/island/widget'
|
|
38
|
+
import Widget, { type WidgetLayout } from '../../../components/island/widget'
|
|
39
39
|
import { MINUTE, useEdgeClock } from '../../../lib/clock'
|
|
40
40
|
|
|
41
41
|
type RecentFilesSource = 'downloads' | 'screenshots'
|
|
@@ -99,6 +99,8 @@ interface RecentFilesProps {
|
|
|
99
99
|
onCancelDownload?: (download: RecentDownload) => void
|
|
100
100
|
/** The moment the times are read at, in epoch ms. Defaults to now, re-read on each minute. */
|
|
101
101
|
now?: number
|
|
102
|
+
/** `tall` is the open island's tall snap: the switch across the top, the newest file large with its actions, and every earlier file of the folder as a grid of named tiles. Defaults to `'fit'`. */
|
|
103
|
+
layout?: WidgetLayout
|
|
102
104
|
/** Step on the size ladder. Omitted, it follows the surrounding SizeProvider. */
|
|
103
105
|
size?: SizeVariant
|
|
104
106
|
/** Classes for the root, which fills its container. */
|
|
@@ -169,6 +171,7 @@ const dragOf = (file: RecentFile, onDragStart?: RecentFilesProps['onDragStart'])
|
|
|
169
171
|
|
|
170
172
|
// Literal tables: UnoCSS only generates the classes it can read whole.
|
|
171
173
|
const TILE = { default: 'size-24 rounded-xl', compact: 'size-20 rounded-xl' }
|
|
174
|
+
const SHEET_TILE = { default: 'h-32 w-48 rounded-2xl', compact: 'h-28 w-42 rounded-2xl' }
|
|
172
175
|
|
|
173
176
|
function Thumbnail({
|
|
174
177
|
file,
|
|
@@ -336,6 +339,32 @@ function Tiles({ files, onOpen, onDragStart }: Omit<ListProps, 'now'>) {
|
|
|
336
339
|
)
|
|
337
340
|
}
|
|
338
341
|
|
|
342
|
+
/** Every earlier file as a grid of tiles, five across: its thumbnail or glyph, its name, its size and age. */
|
|
343
|
+
function Grid({ files, now, onOpen, onDragStart }: ListProps) {
|
|
344
|
+
return (
|
|
345
|
+
<FluidHover columns={5} className="-m-1.5 grid-cols-5 gap-0" highlightClassName="rounded-xl">
|
|
346
|
+
{files.map((file, index) => (
|
|
347
|
+
<FluidHover.Item
|
|
348
|
+
key={file.id}
|
|
349
|
+
index={index}
|
|
350
|
+
title={file.name}
|
|
351
|
+
className="min-h-0 flex-col items-stretch gap-1.5 p-1.5 text-left"
|
|
352
|
+
onClick={() => onOpen?.(file)}
|
|
353
|
+
{...dragOf(file, onDragStart)}
|
|
354
|
+
>
|
|
355
|
+
<Thumbnail file={file} glyph={24} className="aspect-[4/3] w-full rounded-lg" />
|
|
356
|
+
<span className="flex min-w-0 flex-col px-0.5">
|
|
357
|
+
<span className="truncate text-caption text-foreground">{file.name}</span>
|
|
358
|
+
<span className="truncate text-micro tabular-nums text-muted-foreground">
|
|
359
|
+
{bytes(file.size)} · {short(now - file.addedAt)}
|
|
360
|
+
</span>
|
|
361
|
+
</span>
|
|
362
|
+
</FluidHover.Item>
|
|
363
|
+
))}
|
|
364
|
+
</FluidHover>
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
|
|
339
368
|
/** The compact island's left wing: the download glyph, or the camera for a screenshot. */
|
|
340
369
|
function RecentFilesLeading({ source = 'downloads' }: { source?: RecentFilesSource }) {
|
|
341
370
|
const Icon = SOURCE_ICON[source]
|
|
@@ -417,6 +446,15 @@ function RecentFilesSaved({ file, onOpen }: SavedProps) {
|
|
|
417
446
|
* in, the speed and the time left, and Cancel. An empty folder says what
|
|
418
447
|
* will land in it, the switch still beside it.
|
|
419
448
|
*
|
|
449
|
+
* At the open island's tall snap (`layout="tall"`) it becomes a sheet:
|
|
450
|
+
* the switch and Clear across the top; the newest file (or the download
|
|
451
|
+
* under way) large beside its name, its facts and its actions; then every
|
|
452
|
+
* earlier file of the folder, not three, as a grid five across, each tile
|
|
453
|
+
* its thumbnail or its type's glyph over its name, its size and how long
|
|
454
|
+
* ago it landed. Downloads and screenshots read alike there, since a tile
|
|
455
|
+
* has room for both the look and the name; the grid scrolls with the
|
|
456
|
+
* island, and every tile opens on a press and drags out like the rows.
|
|
457
|
+
*
|
|
420
458
|
* `RecentFiles.Leading` and `RecentFiles.Trailing` show the glyph and the
|
|
421
459
|
* download's progress (or the count of new files) in the compact island's
|
|
422
460
|
* wings, `RecentFiles.Minimal` the progress as a ring in the split
|
|
@@ -437,6 +475,7 @@ const RecentFiles = Object.assign(
|
|
|
437
475
|
onClear,
|
|
438
476
|
onCancelDownload,
|
|
439
477
|
now: nowProp,
|
|
478
|
+
layout = 'fit',
|
|
440
479
|
size,
|
|
441
480
|
className,
|
|
442
481
|
} = props
|
|
@@ -472,6 +511,73 @@ const RecentFiles = Object.assign(
|
|
|
472
511
|
<Empty source={source} className={TILE[step]} />
|
|
473
512
|
)
|
|
474
513
|
|
|
514
|
+
const tabs = (
|
|
515
|
+
<Tabs variant="subtle" size="compact" value={source} onValueChange={v => setSource(v as RecentFilesSource)}>
|
|
516
|
+
<Tabs.List className="-ml-2">
|
|
517
|
+
<Tabs.Item value="downloads" label="Downloads" />
|
|
518
|
+
<Tabs.Item value="screenshots" label="Screenshots" />
|
|
519
|
+
</Tabs.List>
|
|
520
|
+
</Tabs>
|
|
521
|
+
)
|
|
522
|
+
const clear = onClear && !empty && (
|
|
523
|
+
<Button variant="ghost" size="compact" className="-mr-2 h-6 px-2" onClick={() => onClear(source)}>
|
|
524
|
+
Clear
|
|
525
|
+
</Button>
|
|
526
|
+
)
|
|
527
|
+
const nothing = (
|
|
528
|
+
<div className="flex min-w-0 flex-col gap-0.5">
|
|
529
|
+
<Widget.Title>{source === 'downloads' ? 'No downloads yet' : 'No screenshots yet'}</Widget.Title>
|
|
530
|
+
<span className="text-pretty text-caption text-muted-foreground">
|
|
531
|
+
{source === 'downloads'
|
|
532
|
+
? 'Files you download land here, ready to open or drag out.'
|
|
533
|
+
: 'Take one with ⇧⌘4 and it shows up here, ready to drag into a message.'}
|
|
534
|
+
</span>
|
|
535
|
+
</div>
|
|
536
|
+
)
|
|
537
|
+
|
|
538
|
+
if (layout === 'tall')
|
|
539
|
+
return (
|
|
540
|
+
<Widget.Sheet size={size} className={className}>
|
|
541
|
+
<div className="flex min-w-0 items-center justify-between gap-2">
|
|
542
|
+
{tabs}
|
|
543
|
+
{clear}
|
|
544
|
+
</div>
|
|
545
|
+
|
|
546
|
+
<div className="flex min-w-0 items-center gap-6">
|
|
547
|
+
{active ? (
|
|
548
|
+
<Thumbnail file={active} glyph={40} className={SHEET_TILE[step]} />
|
|
549
|
+
) : newest ? (
|
|
550
|
+
<span {...dragOf(newest, onDragStart)} className={cn('shrink-0', onDragStart && 'cursor-grab')}>
|
|
551
|
+
<Thumbnail file={newest} glyph={40} className={SHEET_TILE[step]} />
|
|
552
|
+
</span>
|
|
553
|
+
) : (
|
|
554
|
+
<Empty source={source} className={SHEET_TILE[step]} />
|
|
555
|
+
)}
|
|
556
|
+
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
557
|
+
{header}
|
|
558
|
+
{active ? (
|
|
559
|
+
<Downloading download={active} onCancel={onCancelDownload} />
|
|
560
|
+
) : newest ? (
|
|
561
|
+
<Hero file={newest} now={now} props={props} />
|
|
562
|
+
) : (
|
|
563
|
+
nothing
|
|
564
|
+
)}
|
|
565
|
+
</div>
|
|
566
|
+
</div>
|
|
567
|
+
|
|
568
|
+
{earlier.length > 0 && (
|
|
569
|
+
<Widget.Section
|
|
570
|
+
label={active ? 'Latest' : 'Earlier'}
|
|
571
|
+
trailing={<span className="tabular-nums">{earlier.length}</span>}
|
|
572
|
+
>
|
|
573
|
+
<div className="pt-1.5">
|
|
574
|
+
<Grid files={earlier} now={now} onOpen={onOpen} onDragStart={onDragStart} />
|
|
575
|
+
</div>
|
|
576
|
+
</Widget.Section>
|
|
577
|
+
)}
|
|
578
|
+
</Widget.Sheet>
|
|
579
|
+
)
|
|
580
|
+
|
|
475
581
|
return (
|
|
476
582
|
<Widget
|
|
477
583
|
size={size}
|
|
@@ -480,24 +586,10 @@ const RecentFiles = Object.assign(
|
|
|
480
586
|
aside={
|
|
481
587
|
<div className="flex min-w-0 flex-col gap-1.5">
|
|
482
588
|
<div className="flex min-w-0 items-center justify-between gap-2">
|
|
483
|
-
|
|
484
|
-
variant="subtle"
|
|
485
|
-
size="compact"
|
|
486
|
-
value={source}
|
|
487
|
-
onValueChange={v => setSource(v as RecentFilesSource)}
|
|
488
|
-
>
|
|
489
|
-
<Tabs.List className="-ml-2">
|
|
490
|
-
<Tabs.Item value="downloads" label="Downloads" />
|
|
491
|
-
<Tabs.Item value="screenshots" label="Screenshots" />
|
|
492
|
-
</Tabs.List>
|
|
493
|
-
</Tabs>
|
|
589
|
+
{tabs}
|
|
494
590
|
<span className="flex shrink-0 items-center gap-1.5 text-caption tabular-nums text-muted-foreground">
|
|
495
591
|
{earlier.length > limit && <span>{earlier.length - limit} more</span>}
|
|
496
|
-
{
|
|
497
|
-
<Button variant="ghost" size="compact" className="-mr-2 h-6 px-2" onClick={() => onClear(source)}>
|
|
498
|
-
Clear
|
|
499
|
-
</Button>
|
|
500
|
-
)}
|
|
592
|
+
{clear}
|
|
501
593
|
</span>
|
|
502
594
|
</div>
|
|
503
595
|
{empty ? null : earlier.length === 0 ? (
|
|
@@ -516,14 +608,7 @@ const RecentFiles = Object.assign(
|
|
|
516
608
|
) : newest ? (
|
|
517
609
|
<Hero file={newest} now={now} props={props} />
|
|
518
610
|
) : (
|
|
519
|
-
|
|
520
|
-
<Widget.Title>{source === 'downloads' ? 'No downloads yet' : 'No screenshots yet'}</Widget.Title>
|
|
521
|
-
<span className="text-pretty text-caption text-muted-foreground">
|
|
522
|
-
{source === 'downloads'
|
|
523
|
-
? 'Files you download land here, ready to open or drag out.'
|
|
524
|
-
: 'Take one with ⇧⌘4 and it shows up here, ready to drag into a message.'}
|
|
525
|
-
</span>
|
|
526
|
-
</div>
|
|
611
|
+
nothing
|
|
527
612
|
)}
|
|
528
613
|
</Widget>
|
|
529
614
|
)
|
|
@@ -50,3 +50,11 @@ Before the first reading the figures are dashes over the Sparkline's baseline; t
|
|
|
50
50
|
trailing={<NowPlaying.Trailing track={PLAYING} />}
|
|
51
51
|
minimal={<SystemStats.Minimal sample={READINGS[READINGS.length - 1]} />}
|
|
52
52
|
/>
|
|
53
|
+
|
|
54
|
+
# Tall
|
|
55
|
+
|
|
56
|
+
`layout="tall"` at the island's tall snap: CPU and memory pressure side by side with their trends, the network's in and out as one graph beside the battery and the disk, and the top eight processes as a table.
|
|
57
|
+
|
|
58
|
+
<WidgetIsland tab="system" tall>
|
|
59
|
+
<SystemStats samples={READINGS} battery={BATTERY} disk={DISK} uptime={UPTIME} processes={PROCESSES} layout="tall" />
|
|
60
|
+
</WidgetIsland>
|