@justanarthur/modo-ui-notch 0.3.0 → 0.4.1

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 (70) hide show
  1. package/blocks/activities/agenda/examples.mdx +8 -0
  2. package/blocks/activities/agenda/index.tsx +164 -16
  3. package/blocks/activities/clock/examples.mdx +16 -0
  4. package/blocks/activities/clock/index.tsx +357 -59
  5. package/blocks/activities/now-playing/examples.mdx +8 -0
  6. package/blocks/activities/now-playing/index.tsx +140 -54
  7. package/blocks/activities/weather/examples.mdx +9 -1
  8. package/blocks/activities/weather/index.tsx +241 -12
  9. package/blocks/app/expanded-island/index.tsx +3 -1
  10. package/blocks/app/settings-window/examples.mdx +8 -0
  11. package/blocks/app/settings-window/index.tsx +8 -3
  12. package/blocks/system/clipboard/examples.mdx +8 -0
  13. package/blocks/system/clipboard/index.tsx +262 -52
  14. package/blocks/system/recent-files/examples.mdx +14 -0
  15. package/blocks/system/recent-files/index.tsx +110 -25
  16. package/blocks/system/system-stats/examples.mdx +8 -0
  17. package/blocks/system/system-stats/index.tsx +211 -4
  18. package/components/island/widget/index.tsx +38 -4
  19. package/dist/blocks/activities/agenda/index.d.ts +2 -1
  20. package/dist/blocks/activities/agenda/index.js +2 -2
  21. package/dist/blocks/activities/clock/index.d.ts +2 -1
  22. package/dist/blocks/activities/clock/index.js +2 -2
  23. package/dist/blocks/activities/now-playing/index.d.ts +2 -1
  24. package/dist/blocks/activities/now-playing/index.js +2 -2
  25. package/dist/blocks/activities/weather/index.d.ts +2 -1
  26. package/dist/blocks/activities/weather/index.js +2 -2
  27. package/dist/blocks/app/expanded-island/index.d.ts +1 -1
  28. package/dist/blocks/app/expanded-island/index.js +1 -1
  29. package/dist/blocks/app/settings-window/index.d.ts +1 -1
  30. package/dist/blocks/app/settings-window/index.js +1 -1
  31. package/dist/blocks/system/clipboard/index.d.ts +2 -1
  32. package/dist/blocks/system/clipboard/index.js +2 -2
  33. package/dist/blocks/system/recent-files/index.d.ts +2 -1
  34. package/dist/blocks/system/recent-files/index.js +2 -2
  35. package/dist/blocks/system/system-stats/index.d.ts +2 -1
  36. package/dist/blocks/system/system-stats/index.js +2 -2
  37. package/dist/components/island/widget/index.d.ts +2 -2
  38. package/dist/components/island/widget/index.js +3 -1
  39. package/dist/index.d.ts +11 -11
  40. package/dist/index.js +12 -10
  41. package/dist/shared/{chunk-2m5dz8nf.d.ts → chunk-0ym9mcqc.d.ts} +6 -2
  42. package/dist/shared/{chunk-7fvnrtz4.d.ts → chunk-1v35ck2y.d.ts} +12 -2
  43. package/dist/shared/{chunk-wkg17nxs.d.ts → chunk-2bqmmfg9.d.ts} +13 -2
  44. package/dist/shared/{chunk-mt0k6v8x.js → chunk-2nxwdn5s.js} +147 -39
  45. package/dist/shared/{chunk-pfhy5e4q.d.ts → chunk-6tnq6p89.d.ts} +2 -0
  46. package/dist/shared/{chunk-bvtyjcce.d.ts → chunk-72s4sqwh.d.ts} +16 -1
  47. package/dist/shared/{chunk-t0hcxh89.d.ts → chunk-9b8b7fw6.d.ts} +12 -0
  48. package/dist/shared/{chunk-xq5hc5gv.js → chunk-a059ccj0.js} +177 -66
  49. package/dist/shared/{chunk-qdzemt2v.js → chunk-cry81asr.js} +401 -89
  50. package/dist/shared/{chunk-da177e8r.d.ts → chunk-fr9jf804.d.ts} +16 -1
  51. package/dist/shared/{chunk-9c7ewvkk.js → chunk-kbk4bp6p.js} +162 -19
  52. package/dist/shared/{chunk-3thgcfcq.d.ts → chunk-kv0w8vhq.d.ts} +18 -1
  53. package/dist/shared/{chunk-416tsgbc.d.ts → chunk-nqjermbr.d.ts} +25 -3
  54. package/dist/shared/chunk-p3nezxvx.js +481 -0
  55. package/dist/shared/{chunk-2818esrq.d.ts → chunk-sen170mz.d.ts} +10 -1
  56. package/dist/shared/{chunk-9m0xbg5v.js → chunk-wayv5rhr.js} +1 -1
  57. package/dist/shared/{chunk-ym0xbses.js → chunk-ygnrrqta.js} +274 -18
  58. package/dist/shared/{chunk-j77cx8dp.js → chunk-yw478nmj.js} +325 -58
  59. package/dist/shared/{chunk-cc9nwbtf.js → chunk-z3tj1ydg.js} +3 -0
  60. package/dist/shared/{chunk-x7f3g82r.js → chunk-zxsw11dr.js} +14 -4
  61. package/dist/styles.css +61 -1
  62. package/mock/clipboard.tsx +34 -0
  63. package/mock/clock.tsx +3 -3
  64. package/mock/data.ts +48 -0
  65. package/mock/files.tsx +14 -1
  66. package/mock/island-content.tsx +47 -15
  67. package/mock/system.ts +3 -0
  68. package/mock/weather.tsx +42 -12
  69. package/package.json +2 -2
  70. package/dist/shared/chunk-s2jeqqan.js +0 -243
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-ndf79pv5.js";
12
12
  import {
13
13
  widget_default
14
- } from "./chunk-x7f3g82r.js";
14
+ } from "./chunk-zxsw11dr.js";
15
15
  import {
16
16
  useStableArtwork2,
17
17
  useArtworkTint2
@@ -43,13 +43,19 @@ import {
43
43
  } from "lucide-react";
44
44
  import { motion } from "motion/react";
45
45
  import { useState } from "react";
46
- import { jsx, jsxs } from "react/jsx-runtime";
46
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
47
47
  /*!
48
48
  * Local addition: what's playing, in every form a notch app shows it.
49
49
  * Rebuilt from Just Notch's now-playing plugin (`Player`, `Artwork`,
50
50
  * `TrackFlash`) as presentational parts: the track and the commands come in
51
51
  * as props.
52
52
  */
53
+ var OUTPUT_LABEL = {
54
+ "built-in": "Built-in speakers",
55
+ headphones: "Headphones",
56
+ speaker: "Speaker",
57
+ airplay: "AirPlay"
58
+ };
53
59
  var OUTPUT_ICON = { "built-in": Laptop, headphones: Headphones, speaker: Speaker, airplay: Airplay };
54
60
  var NEXT_REPEAT = { off: "all", all: "one", one: "off" };
55
61
  var REPEAT_LABEL = {
@@ -164,6 +170,21 @@ function NowPlayingFlash2({ track, playing = true }) {
164
170
  });
165
171
  }
166
172
  var ART = { default: "size-36 rounded-2xl", compact: "size-28 rounded-xl" };
173
+ var SHEET_ART = { default: "size-52 rounded-3xl", compact: "size-44 rounded-2xl" };
174
+ var SHEET_TITLE = { default: "text-display", compact: "text-display-compact" };
175
+ function Glow({ tint, children }) {
176
+ return /* @__PURE__ */ jsxs("span", {
177
+ className: "relative flex",
178
+ children: [
179
+ tint && /* @__PURE__ */ jsx("span", {
180
+ "aria-hidden": true,
181
+ className: "absolute -inset-x-8 -inset-y-4 -z-1 opacity-70",
182
+ style: { backgroundImage: `radial-gradient(closest-side, ${tint}, transparent)` }
183
+ }),
184
+ children
185
+ ]
186
+ });
187
+ }
167
188
  var NowPlaying2 = Object.assign(function NowPlaying({
168
189
  track,
169
190
  playing: playingProp,
@@ -183,6 +204,7 @@ var NowPlaying2 = Object.assign(function NowPlaying({
183
204
  onLikedChange,
184
205
  emptyDescription = "Play something in Music, Spotify or a browser and it shows up here.",
185
206
  emptyActions,
207
+ layout = "fit",
186
208
  className
187
209
  }) {
188
210
  const size = useSize();
@@ -203,23 +225,158 @@ var NowPlaying2 = Object.assign(function NowPlaying({
203
225
  const showRepeat = repeatProp !== undefined || defaultRepeat !== undefined || onRepeatChange !== undefined;
204
226
  const showLiked = likedProp !== undefined || defaultLiked !== undefined || onLikedChange !== undefined;
205
227
  const byline = [track.artist, track.album].filter(Boolean).join(" — ");
228
+ const toggles = /* @__PURE__ */ jsxs(Fragment, {
229
+ children: [
230
+ showShuffle && /* @__PURE__ */ jsx(widget_default.Action, {
231
+ icon: Shuffle,
232
+ label: "Shuffle",
233
+ pressed: shuffle,
234
+ color: tint,
235
+ onClick: () => setShuffle(!shuffle)
236
+ }),
237
+ showRepeat && /* @__PURE__ */ jsx(widget_default.Action, {
238
+ icon: repeat === "one" ? Repeat1 : Repeat,
239
+ label: REPEAT_LABEL[repeat],
240
+ pressed: repeat !== "off",
241
+ color: tint,
242
+ onClick: () => setRepeat(NEXT_REPEAT[repeat])
243
+ }),
244
+ showLiked && /* @__PURE__ */ jsx(widget_default.Action, {
245
+ icon: Heart,
246
+ label: liked ? "Remove from library" : "Add to library",
247
+ pressed: liked,
248
+ filled: liked,
249
+ color: tint,
250
+ onClick: () => setLiked(!liked)
251
+ })
252
+ ]
253
+ });
254
+ const transport = /* @__PURE__ */ jsxs("div", {
255
+ className: "flex items-center gap-1",
256
+ children: [
257
+ /* @__PURE__ */ jsx(widget_default.Action, {
258
+ icon: SkipBack,
259
+ label: "Previous",
260
+ filled: true,
261
+ onClick: onPrevious
262
+ }),
263
+ /* @__PURE__ */ jsx(widget_default.Action, {
264
+ icon: playing ? Pause : Play,
265
+ label: playing ? "Pause" : "Play",
266
+ emphasis: "primary",
267
+ filled: true,
268
+ onClick: () => setPlaying(!playing)
269
+ }),
270
+ /* @__PURE__ */ jsx(widget_default.Action, {
271
+ icon: SkipForward,
272
+ label: "Next",
273
+ filled: true,
274
+ onClick: onNext
275
+ })
276
+ ]
277
+ });
278
+ const OutputIcon = OUTPUT_ICON[track.outputKind ?? "built-in"];
279
+ if (layout === "tall")
280
+ return /* @__PURE__ */ jsxs(widget_default.Sheet, {
281
+ className: cn("relative isolate", className),
282
+ children: [
283
+ /* @__PURE__ */ jsxs("div", {
284
+ className: "flex min-w-0 items-center gap-6",
285
+ children: [
286
+ /* @__PURE__ */ jsx(Glow, {
287
+ tint,
288
+ children: /* @__PURE__ */ jsx(NowPlayingArtwork2, {
289
+ track,
290
+ glyph: 40,
291
+ className: SHEET_ART[size.variant]
292
+ })
293
+ }),
294
+ /* @__PURE__ */ jsxs("div", {
295
+ className: "flex min-w-0 flex-1 flex-col gap-1",
296
+ children: [
297
+ /* @__PURE__ */ jsx(widget_default.Header, {
298
+ icon: Disc3,
299
+ trailing: /* @__PURE__ */ jsx(TintedBars, {
300
+ track,
301
+ playing
302
+ }),
303
+ children: track.source ?? "Now playing"
304
+ }),
305
+ /* @__PURE__ */ jsx("span", {
306
+ className: cn("line-clamp-2 weight-bold text-foreground text-balance", SHEET_TITLE[size.variant]),
307
+ children: track.title || "Unknown title"
308
+ }),
309
+ track.artist && /* @__PURE__ */ jsx("span", {
310
+ className: "truncate text-title text-foreground",
311
+ children: track.artist
312
+ }),
313
+ track.album && /* @__PURE__ */ jsx(widget_default.Subtitle, {
314
+ children: track.album
315
+ })
316
+ ]
317
+ })
318
+ ]
319
+ }),
320
+ /* @__PURE__ */ jsxs("div", {
321
+ className: "flex flex-col gap-2",
322
+ children: [
323
+ track.duration > 0 && /* @__PURE__ */ jsx(MediaScrubber2, {
324
+ position: track.position,
325
+ duration: track.duration,
326
+ playing,
327
+ onSeek
328
+ }),
329
+ /* @__PURE__ */ jsxs("div", {
330
+ className: "grid grid-cols-[1fr_auto_1fr] items-center gap-2",
331
+ children: [
332
+ /* @__PURE__ */ jsx("span", {}),
333
+ transport,
334
+ /* @__PURE__ */ jsx("div", {
335
+ className: "flex items-center justify-end",
336
+ children: toggles
337
+ })
338
+ ]
339
+ })
340
+ ]
341
+ }),
342
+ (track.source || track.output) && /* @__PURE__ */ jsxs(widget_default.Section, {
343
+ label: "Playing",
344
+ children: [
345
+ track.source && /* @__PURE__ */ jsx(widget_default.Row, {
346
+ trailing: /* @__PURE__ */ jsx(Disc3, {
347
+ size: 14,
348
+ strokeWidth: 1.5
349
+ }),
350
+ leading: "From",
351
+ children: track.source
352
+ }),
353
+ track.output && /* @__PURE__ */ jsx(widget_default.Row, {
354
+ leading: "On",
355
+ trailing: /* @__PURE__ */ jsxs(Fragment, {
356
+ children: [
357
+ /* @__PURE__ */ jsx(OutputIcon, {
358
+ size: 14,
359
+ strokeWidth: 1.5
360
+ }),
361
+ OUTPUT_LABEL[track.outputKind ?? "built-in"]
362
+ ]
363
+ }),
364
+ children: track.output
365
+ })
366
+ ]
367
+ })
368
+ ]
369
+ });
206
370
  return /* @__PURE__ */ jsx("div", {
207
371
  className: cn("relative isolate flex w-full flex-col justify-center", className),
208
372
  children: /* @__PURE__ */ jsxs(widget_default, {
209
- media: /* @__PURE__ */ jsxs("span", {
210
- className: "relative flex",
211
- children: [
212
- tint && /* @__PURE__ */ jsx("span", {
213
- "aria-hidden": true,
214
- className: "absolute -inset-x-8 -inset-y-4 -z-1 opacity-70",
215
- style: { backgroundImage: `radial-gradient(closest-side, ${tint}, transparent)` }
216
- }),
217
- /* @__PURE__ */ jsx(NowPlayingArtwork2, {
218
- track,
219
- glyph: 28,
220
- className: ART[size.variant]
221
- })
222
- ]
373
+ media: /* @__PURE__ */ jsx(Glow, {
374
+ tint,
375
+ children: /* @__PURE__ */ jsx(NowPlayingArtwork2, {
376
+ track,
377
+ glyph: 28,
378
+ className: ART[size.variant]
379
+ })
223
380
  }),
224
381
  children: [
225
382
  /* @__PURE__ */ jsxs("div", {
@@ -261,61 +418,15 @@ var NowPlaying2 = Object.assign(function NowPlaying({
261
418
  children: track.source
262
419
  }),
263
420
  track.output && /* @__PURE__ */ jsx(widget_default.MetaItem, {
264
- icon: OUTPUT_ICON[track.outputKind ?? "built-in"],
421
+ icon: OutputIcon,
265
422
  children: track.output
266
423
  })
267
424
  ]
268
425
  }),
269
- /* @__PURE__ */ jsxs("div", {
270
- className: "flex items-center gap-1",
271
- children: [
272
- /* @__PURE__ */ jsx(widget_default.Action, {
273
- icon: SkipBack,
274
- label: "Previous",
275
- filled: true,
276
- onClick: onPrevious
277
- }),
278
- /* @__PURE__ */ jsx(widget_default.Action, {
279
- icon: playing ? Pause : Play,
280
- label: playing ? "Pause" : "Play",
281
- emphasis: "primary",
282
- filled: true,
283
- onClick: () => setPlaying(!playing)
284
- }),
285
- /* @__PURE__ */ jsx(widget_default.Action, {
286
- icon: SkipForward,
287
- label: "Next",
288
- filled: true,
289
- onClick: onNext
290
- })
291
- ]
292
- }),
293
- /* @__PURE__ */ jsxs("div", {
426
+ transport,
427
+ /* @__PURE__ */ jsx("div", {
294
428
  className: "flex items-center justify-end",
295
- children: [
296
- showShuffle && /* @__PURE__ */ jsx(widget_default.Action, {
297
- icon: Shuffle,
298
- label: "Shuffle",
299
- pressed: shuffle,
300
- color: tint,
301
- onClick: () => setShuffle(!shuffle)
302
- }),
303
- showRepeat && /* @__PURE__ */ jsx(widget_default.Action, {
304
- icon: repeat === "one" ? Repeat1 : Repeat,
305
- label: REPEAT_LABEL[repeat],
306
- pressed: repeat !== "off",
307
- color: tint,
308
- onClick: () => setRepeat(NEXT_REPEAT[repeat])
309
- }),
310
- showLiked && /* @__PURE__ */ jsx(widget_default.Action, {
311
- icon: Heart,
312
- label: liked ? "Remove from library" : "Add to library",
313
- pressed: liked,
314
- filled: liked,
315
- color: tint,
316
- onClick: () => setLiked(!liked)
317
- })
318
- ]
429
+ children: toggles
319
430
  })
320
431
  ]
321
432
  })