@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
@@ -0,0 +1,474 @@
1
+ "use client";
2
+
3
+ import {
4
+ IslandFlash2
5
+ } from "./chunk-ndf79pv5.js";
6
+ import {
7
+ widget_default
8
+ } from "./chunk-x7f3g82r.js";
9
+ import {
10
+ MINUTE2,
11
+ useEdgeClock2
12
+ } from "./chunk-gb56m10p.js";
13
+
14
+ // blocks/system/recent-files/index.tsx
15
+ import Button from "@justanarthur/modo-ui/components/actions/button";
16
+ import Meter from "@justanarthur/modo-ui/components/feedback/meter";
17
+ import Tabs from "@justanarthur/modo-ui/components/navigation/tabs";
18
+ import { SURFACE_BG } from "@justanarthur/modo-ui/lib/surface-classes";
19
+ import { useLift } from "@justanarthur/modo-ui/lib/surface-context";
20
+ import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
21
+ import { cn } from "@justanarthur/modo-ui/lib/utils";
22
+ import FluidHover from "@justanarthur/modo-ui/primitives/systems/fluid-hover";
23
+ import {
24
+ ArrowDownToLine,
25
+ ArrowUpRight,
26
+ Camera,
27
+ Copy,
28
+ File,
29
+ FileArchive,
30
+ FileAudio,
31
+ FileCode,
32
+ FileImage,
33
+ FileText,
34
+ FileVideo,
35
+ FolderSearch,
36
+ Trash2,
37
+ X
38
+ } from "lucide-react";
39
+ import { jsx, jsxs } from "react/jsx-runtime";
40
+ /*!
41
+ * Local addition: a notch app's recent files, the newest download or
42
+ * screenshot as the hero and the ones before it beside it, ready to open or
43
+ * drag out. Presentational: the files and what to do with them come in as
44
+ * props.
45
+ */
46
+ var SOURCE_LABEL = { downloads: "Downloads", screenshots: "Screenshots" };
47
+ var SOURCE_ICON = { downloads: ArrowDownToLine, screenshots: Camera };
48
+ var ROWS = 3;
49
+ var TILES = 6;
50
+ var TYPES = [
51
+ [/\.(png|jpe?g|gif|webp|heic|svg|tiff?)$/i, FileImage],
52
+ [/\.(mov|mp4|m4v|avi|mkv|webm)$/i, FileVideo],
53
+ [/\.(mp3|m4a|wav|aiff?|flac|ogg)$/i, FileAudio],
54
+ [/\.(zip|tar|gz|tgz|rar|7z|dmg|xip)$/i, FileArchive],
55
+ [/\.(m?[jt]sx?|json|css|html|swift|rs|go|py|rb|sh|ya?ml|toml)$/i, FileCode],
56
+ [/\.(pdf|md|txt|rtf|docx?|pages|key|numbers|csv)$/i, FileText]
57
+ ];
58
+ var iconFor = (name) => TYPES.find(([pattern]) => pattern.test(name))?.[1] ?? File;
59
+ function bytes(n) {
60
+ if (n >= 1e9)
61
+ return `${(n / 1e9).toFixed(1)} GB`;
62
+ if (n >= 1e6)
63
+ return `${n >= 1e8 ? Math.round(n / 1e6) : (n / 1e6).toFixed(1)} MB`;
64
+ return `${Math.max(1, Math.round(n / 1000))} KB`;
65
+ }
66
+ function part(n, total) {
67
+ const [unit, scale] = total >= 1e9 ? ["GB", 1e9] : total >= 1e6 ? ["MB", 1e6] : ["KB", 1000];
68
+ const digits = total / scale < 10 ? 1 : 0;
69
+ return `${(n / scale).toFixed(digits)} of ${(total / scale).toFixed(digits)} ${unit}`;
70
+ }
71
+ function ago(ms) {
72
+ const minutes = Math.floor(ms / MINUTE2);
73
+ if (minutes < 1)
74
+ return "just now";
75
+ if (minutes < 60)
76
+ return `${minutes} min ago`;
77
+ if (minutes < 24 * 60)
78
+ return `${Math.floor(minutes / 60)} h ago`;
79
+ return `${Math.floor(minutes / (24 * 60))} d ago`;
80
+ }
81
+ function short(ms) {
82
+ const minutes = Math.floor(ms / MINUTE2);
83
+ if (minutes < 1)
84
+ return "now";
85
+ if (minutes < 60)
86
+ return `${minutes} min`;
87
+ if (minutes < 24 * 60)
88
+ return `${Math.floor(minutes / 60)} h`;
89
+ return `${Math.floor(minutes / (24 * 60))} d`;
90
+ }
91
+ function left(seconds) {
92
+ if (seconds < 60)
93
+ return `${Math.max(1, Math.ceil(seconds))} s left`;
94
+ if (seconds < 3600)
95
+ return `${Math.ceil(seconds / 60)} min left`;
96
+ return `${Math.floor(seconds / 3600)} h ${Math.ceil(seconds % 3600 / 60)} min left`;
97
+ }
98
+ var dragOf = (file, onDragStart) => onDragStart ? { draggable: true, onDragStart: (event) => onDragStart(file, event) } : {};
99
+ var TILE = { default: "size-24 rounded-xl", compact: "size-20 rounded-xl" };
100
+ function Thumbnail({
101
+ file,
102
+ className,
103
+ glyph = 28
104
+ }) {
105
+ const level = useLift(1);
106
+ const Icon = iconFor(file.name);
107
+ return /* @__PURE__ */ jsxs("span", {
108
+ className: cn("relative flex shrink-0 items-center justify-center overflow-hidden text-muted-foreground", file.thumbnail == null && SURFACE_BG[level], className),
109
+ children: [
110
+ typeof file.thumbnail === "string" ? /* @__PURE__ */ jsx("img", {
111
+ alt: "",
112
+ src: file.thumbnail,
113
+ draggable: false,
114
+ className: "size-full object-cover"
115
+ }) : file.thumbnail ?? /* @__PURE__ */ jsx(Icon, {
116
+ size: glyph,
117
+ strokeWidth: 1.25
118
+ }),
119
+ /* @__PURE__ */ jsx("span", {
120
+ "aria-hidden": true,
121
+ className: "pointer-events-none absolute inset-0 rounded-[inherit] ring-1 ring-border ring-inset"
122
+ })
123
+ ]
124
+ });
125
+ }
126
+ function Hero({ file, now, props }) {
127
+ const { onOpen, onReveal, onCopy, onDelete } = props;
128
+ return /* @__PURE__ */ jsxs("div", {
129
+ className: "flex min-w-0 flex-col gap-2",
130
+ children: [
131
+ /* @__PURE__ */ jsxs("div", {
132
+ className: "flex min-w-0 flex-col gap-0.5",
133
+ children: [
134
+ /* @__PURE__ */ jsx(widget_default.Title, {
135
+ children: file.name
136
+ }),
137
+ /* @__PURE__ */ jsx(widget_default.Subtitle, {
138
+ children: [bytes(file.size), ago(now - file.addedAt), file.from && `from ${file.from}`].filter(Boolean).join(" · ")
139
+ })
140
+ ]
141
+ }),
142
+ /* @__PURE__ */ jsxs("div", {
143
+ className: "-mr-1 flex min-w-0 items-center justify-end gap-0.5",
144
+ children: [
145
+ onReveal && /* @__PURE__ */ jsx(widget_default.Action, {
146
+ icon: FolderSearch,
147
+ label: "Show in Finder",
148
+ onClick: () => onReveal(file)
149
+ }),
150
+ onCopy && /* @__PURE__ */ jsx(widget_default.Action, {
151
+ icon: Copy,
152
+ label: "Copy",
153
+ onClick: () => onCopy(file)
154
+ }),
155
+ onDelete && /* @__PURE__ */ jsx(widget_default.Action, {
156
+ icon: Trash2,
157
+ label: "Move to Trash",
158
+ onClick: () => onDelete(file)
159
+ }),
160
+ /* @__PURE__ */ jsx(Button, {
161
+ variant: "primary",
162
+ size: "compact",
163
+ leadingIcon: ArrowUpRight,
164
+ className: "ml-1.5",
165
+ onClick: () => onOpen?.(file),
166
+ children: "Open"
167
+ })
168
+ ]
169
+ })
170
+ ]
171
+ });
172
+ }
173
+ function Downloading({
174
+ download,
175
+ onCancel
176
+ }) {
177
+ const share = download.received / download.total;
178
+ return /* @__PURE__ */ jsxs("div", {
179
+ className: "flex min-w-0 flex-col gap-1.5",
180
+ children: [
181
+ /* @__PURE__ */ jsxs("div", {
182
+ className: "flex min-w-0 items-center gap-3",
183
+ children: [
184
+ /* @__PURE__ */ jsx(widget_default.Title, {
185
+ className: "flex-1",
186
+ children: download.name
187
+ }),
188
+ /* @__PURE__ */ jsxs("span", {
189
+ className: "shrink-0 text-caption tabular-nums text-muted-foreground",
190
+ children: [
191
+ Math.round(share * 100),
192
+ "%"
193
+ ]
194
+ }),
195
+ onCancel && /* @__PURE__ */ jsx("span", {
196
+ className: "-my-1 -mr-1 flex shrink-0",
197
+ children: /* @__PURE__ */ jsx(widget_default.Action, {
198
+ icon: X,
199
+ label: "Cancel download",
200
+ onClick: () => onCancel(download)
201
+ })
202
+ })
203
+ ]
204
+ }),
205
+ /* @__PURE__ */ jsx(Meter, {
206
+ variant: "line",
207
+ value: share,
208
+ tone: "default",
209
+ label: `${download.name}, ${Math.round(share * 100)}%`
210
+ }),
211
+ /* @__PURE__ */ jsxs(widget_default.Meta, {
212
+ children: [
213
+ /* @__PURE__ */ jsx(widget_default.MetaItem, {
214
+ children: part(download.received, download.total)
215
+ }),
216
+ /* @__PURE__ */ jsxs(widget_default.MetaItem, {
217
+ children: [
218
+ bytes(download.rate),
219
+ "/s"
220
+ ]
221
+ }),
222
+ /* @__PURE__ */ jsx(widget_default.MetaItem, {
223
+ children: left((download.total - download.received) / Math.max(1, download.rate))
224
+ })
225
+ ]
226
+ })
227
+ ]
228
+ });
229
+ }
230
+ function Empty({ source, className }) {
231
+ const level = useLift(1);
232
+ const Icon = SOURCE_ICON[source];
233
+ return /* @__PURE__ */ jsx("span", {
234
+ className: cn("flex shrink-0 items-center justify-center text-muted-foreground", SURFACE_BG[level], className),
235
+ children: /* @__PURE__ */ jsx(Icon, {
236
+ size: 28,
237
+ strokeWidth: 1.25
238
+ })
239
+ });
240
+ }
241
+ function Rows({ files, now, onOpen, onDragStart }) {
242
+ return /* @__PURE__ */ jsx(FluidHover, {
243
+ className: "-mx-2 flex flex-col gap-0",
244
+ children: files.slice(0, ROWS).map((file, index) => {
245
+ const Icon = iconFor(file.name);
246
+ return /* @__PURE__ */ jsx(FluidHover.Item, {
247
+ index,
248
+ title: file.name,
249
+ className: "h-7 px-2",
250
+ onClick: () => onOpen?.(file),
251
+ ...dragOf(file, onDragStart),
252
+ children: /* @__PURE__ */ jsx(widget_default.Row, {
253
+ className: "w-full",
254
+ leading: short(now - file.addedAt),
255
+ trailing: bytes(file.size),
256
+ children: /* @__PURE__ */ jsxs("span", {
257
+ className: "flex min-w-0 items-center gap-2",
258
+ children: [
259
+ /* @__PURE__ */ jsx(Icon, {
260
+ size: 14,
261
+ strokeWidth: 1.5,
262
+ className: "shrink-0 text-muted-foreground"
263
+ }),
264
+ /* @__PURE__ */ jsx("span", {
265
+ className: "min-w-0 truncate",
266
+ children: file.name
267
+ })
268
+ ]
269
+ })
270
+ })
271
+ }, file.id);
272
+ })
273
+ });
274
+ }
275
+ function Tiles({ files, onOpen, onDragStart }) {
276
+ return /* @__PURE__ */ jsx(FluidHover, {
277
+ columns: 3,
278
+ className: "-m-1 grid-cols-3 gap-0",
279
+ highlightClassName: "rounded-lg",
280
+ children: files.slice(0, TILES).map((file, index) => /* @__PURE__ */ jsx(FluidHover.Item, {
281
+ index,
282
+ title: file.name,
283
+ "aria-label": file.name,
284
+ className: "min-h-0 p-1",
285
+ onClick: () => onOpen?.(file),
286
+ ...dragOf(file, onDragStart),
287
+ children: /* @__PURE__ */ jsx(Thumbnail, {
288
+ file,
289
+ glyph: 16,
290
+ className: "aspect-[16/10] w-full rounded-md"
291
+ })
292
+ }, file.id))
293
+ });
294
+ }
295
+ function RecentFilesLeading2({ source = "downloads" }) {
296
+ const Icon = SOURCE_ICON[source];
297
+ return /* @__PURE__ */ jsx(Icon, {
298
+ size: 16,
299
+ strokeWidth: 1.5,
300
+ className: "text-foreground"
301
+ });
302
+ }
303
+ function RecentFilesTrailing2({ download, count = 0 }) {
304
+ return /* @__PURE__ */ jsx("span", {
305
+ className: "text-caption weight-semibold tabular-nums text-foreground",
306
+ children: download ? `${Math.round(download.received / download.total * 100)}%` : count
307
+ });
308
+ }
309
+ function RecentFilesMinimal2({ download }) {
310
+ const share = download.received / download.total;
311
+ return /* @__PURE__ */ jsx(Meter, {
312
+ variant: "ring",
313
+ className: "size-5.5",
314
+ size: "compact",
315
+ tone: "default",
316
+ value: share,
317
+ label: `${download.name}, ${Math.round(share * 100)}%`
318
+ });
319
+ }
320
+ function RecentFilesSaved2({ file, onOpen }) {
321
+ return /* @__PURE__ */ jsx(IslandFlash2, {
322
+ icon: /* @__PURE__ */ jsx(Thumbnail, {
323
+ file,
324
+ glyph: 16,
325
+ className: "size-9 rounded-lg"
326
+ }),
327
+ title: file.source === "screenshots" ? "Screenshot saved" : "Downloaded",
328
+ caption: `${file.name} · ${bytes(file.size)}`,
329
+ action: onOpen && /* @__PURE__ */ jsx(Button, {
330
+ variant: "secondary",
331
+ size: "compact",
332
+ onClick: () => onOpen(file),
333
+ children: "Open"
334
+ })
335
+ });
336
+ }
337
+ var RecentFiles2 = Object.assign(function RecentFiles(props) {
338
+ const {
339
+ files,
340
+ download,
341
+ value: valueProp,
342
+ defaultValue = "downloads",
343
+ onValueChange,
344
+ onOpen,
345
+ onDragStart,
346
+ onClear,
347
+ onCancelDownload,
348
+ now: nowProp,
349
+ size,
350
+ className
351
+ } = props;
352
+ const ticking = useEdgeClock2(0, nowProp === undefined, MINUTE2);
353
+ const now = nowProp ?? ticking;
354
+ const [source, setSource] = useControllableState(valueProp, defaultValue, onValueChange);
355
+ const step = size ?? "default";
356
+ const shown = files.filter((file) => file.source === source).sort((a, b) => b.addedAt - a.addedAt);
357
+ const active = source === "downloads" ? download : undefined;
358
+ const [newest, ...rest] = shown;
359
+ const earlier = active ? shown : rest;
360
+ const limit = source === "screenshots" ? TILES : ROWS;
361
+ const empty = !newest && !active;
362
+ const header = /* @__PURE__ */ jsx(widget_default.Header, {
363
+ icon: SOURCE_ICON[source],
364
+ children: active ? ["Downloading", active.from].filter(Boolean).join(" · ") : [SOURCE_LABEL[source], shown.length && `${shown.length} ${shown.length === 1 ? "file" : "files"}`].filter(Boolean).join(" · ")
365
+ });
366
+ const media = active ? /* @__PURE__ */ jsx(Thumbnail, {
367
+ file: active,
368
+ className: TILE[step]
369
+ }) : newest ? /* @__PURE__ */ jsx("span", {
370
+ ...dragOf(newest, onDragStart),
371
+ className: cn(onDragStart && "cursor-grab"),
372
+ children: /* @__PURE__ */ jsx(Thumbnail, {
373
+ file: newest,
374
+ className: TILE[step]
375
+ })
376
+ }) : /* @__PURE__ */ jsx(Empty, {
377
+ source,
378
+ className: TILE[step]
379
+ });
380
+ return /* @__PURE__ */ jsxs(widget_default, {
381
+ size,
382
+ className: cn("h-full", className),
383
+ media,
384
+ aside: /* @__PURE__ */ jsxs("div", {
385
+ className: "flex min-w-0 flex-col gap-1.5",
386
+ children: [
387
+ /* @__PURE__ */ jsxs("div", {
388
+ className: "flex min-w-0 items-center justify-between gap-2",
389
+ children: [
390
+ /* @__PURE__ */ jsx(Tabs, {
391
+ variant: "subtle",
392
+ size: "compact",
393
+ value: source,
394
+ onValueChange: (v) => setSource(v),
395
+ children: /* @__PURE__ */ jsxs(Tabs.List, {
396
+ className: "-ml-2",
397
+ children: [
398
+ /* @__PURE__ */ jsx(Tabs.Item, {
399
+ value: "downloads",
400
+ label: "Downloads"
401
+ }),
402
+ /* @__PURE__ */ jsx(Tabs.Item, {
403
+ value: "screenshots",
404
+ label: "Screenshots"
405
+ })
406
+ ]
407
+ })
408
+ }),
409
+ /* @__PURE__ */ jsxs("span", {
410
+ className: "flex shrink-0 items-center gap-1.5 text-caption tabular-nums text-muted-foreground",
411
+ children: [
412
+ earlier.length > limit && /* @__PURE__ */ jsxs("span", {
413
+ children: [
414
+ earlier.length - limit,
415
+ " more"
416
+ ]
417
+ }),
418
+ onClear && !empty && /* @__PURE__ */ jsx(Button, {
419
+ variant: "ghost",
420
+ size: "compact",
421
+ className: "-mr-2 h-6 px-2",
422
+ onClick: () => onClear(source),
423
+ children: "Clear"
424
+ })
425
+ ]
426
+ })
427
+ ]
428
+ }),
429
+ empty ? null : earlier.length === 0 ? /* @__PURE__ */ jsx("span", {
430
+ className: "flex h-7 items-center text-body text-muted-foreground",
431
+ children: "Nothing earlier"
432
+ }) : source === "screenshots" ? /* @__PURE__ */ jsx(Tiles, {
433
+ files: earlier,
434
+ onOpen,
435
+ onDragStart
436
+ }) : /* @__PURE__ */ jsx(Rows, {
437
+ files: earlier,
438
+ now,
439
+ onOpen,
440
+ onDragStart
441
+ })
442
+ ]
443
+ }),
444
+ children: [
445
+ header,
446
+ active ? /* @__PURE__ */ jsx(Downloading, {
447
+ download: active,
448
+ onCancel: onCancelDownload
449
+ }) : newest ? /* @__PURE__ */ jsx(Hero, {
450
+ file: newest,
451
+ now,
452
+ props
453
+ }) : /* @__PURE__ */ jsxs("div", {
454
+ className: "flex min-w-0 flex-col gap-0.5",
455
+ children: [
456
+ /* @__PURE__ */ jsx(widget_default.Title, {
457
+ children: source === "downloads" ? "No downloads yet" : "No screenshots yet"
458
+ }),
459
+ /* @__PURE__ */ jsx("span", {
460
+ className: "text-pretty text-caption text-muted-foreground",
461
+ children: source === "downloads" ? "Files you download land here, ready to open or drag out." : "Take one with ⇧⌘4 and it shows up here, ready to drag into a message."
462
+ })
463
+ ]
464
+ })
465
+ ]
466
+ });
467
+ }, {
468
+ Leading: RecentFilesLeading2,
469
+ Trailing: RecentFilesTrailing2,
470
+ Minimal: RecentFilesMinimal2,
471
+ Saved: RecentFilesSaved2
472
+ });
473
+ var recent_files_default = RecentFiles2;
474
+ export { RecentFilesLeading2, RecentFilesTrailing2, RecentFilesMinimal2, RecentFilesSaved2, RecentFiles2, recent_files_default };
@@ -4,7 +4,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
4
4
  /*!
5
5
  * Local addition: the layout of a notch app's transient alert, the island's
6
6
  * `flash` content. Generalised from Just Notch's power, HUD and now-playing
7
- * flashes.
7
+ * flashes; the kit's blocks build their own on it.
8
8
  */
9
9
  var TONE = {
10
10
  default: "text-foreground",
@@ -34,9 +34,15 @@ type Element_12xgc = JSX_1kxb["Element"];
34
34
  * the selected tab's title, or the hovered tab's as a preview. The view
35
35
  * fills the rest: the area keeps its height whatever the view holds, and a
36
36
  * taller view scrolls inside it, its edges fading with `scroll-fade` (a
37
- * modo-ui ScrollArea), back at the top on each new tab. Every part starts at
37
+ * modo-ui ScrollArea), back at the top on each new tab, where the new view
38
+ * sharpens in the way the island swaps its content. Every part starts at
38
39
  * the island's one inset, clear of its rounded bottom corners.
39
40
  *
41
+ * The views are made for the area the default panel leaves (about 680 × 165
42
+ * at 720 × 240): build each one on the kit's Widget frame, so every tab has
43
+ * one hero set large, a muted line, its facts and quiet actions in the same
44
+ * places.
45
+ *
40
46
  * Pass it as the Island's `expanded`; it reads the notch from the Island.
41
47
  * Selection runs through `value` / `onValueChange`, or is kept here from
42
48
  * `defaultValue`.