@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.
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 +34 -0
  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-xq5hc5gv.js → chunk-2b6gpn8k.js} +177 -66
  43. package/dist/shared/chunk-3hcnf4yx.js +481 -0
  44. package/dist/shared/{chunk-416tsgbc.d.ts → chunk-42wab62s.d.ts} +23 -1
  45. package/dist/shared/{chunk-pfhy5e4q.d.ts → chunk-6tnq6p89.d.ts} +2 -0
  46. package/dist/shared/{chunk-qdzemt2v.js → chunk-93dtpjz7.js} +401 -89
  47. package/dist/shared/{chunk-da177e8r.d.ts → chunk-a6njb8db.d.ts} +16 -1
  48. package/dist/shared/{chunk-2818esrq.d.ts → chunk-ab8mdg0n.d.ts} +10 -1
  49. package/dist/shared/{chunk-3thgcfcq.d.ts → chunk-evqpf92s.d.ts} +18 -1
  50. package/dist/shared/{chunk-mt0k6v8x.js → chunk-gcyspvgr.js} +147 -39
  51. package/dist/shared/{chunk-t0hcxh89.d.ts → chunk-gkj0hjrn.d.ts} +12 -0
  52. package/dist/shared/{chunk-wkg17nxs.d.ts → chunk-n739am8j.d.ts} +13 -2
  53. package/dist/shared/{chunk-ym0xbses.js → chunk-nwzpekvy.js} +274 -18
  54. package/dist/shared/{chunk-bvtyjcce.d.ts → chunk-sbrtesdg.d.ts} +16 -1
  55. package/dist/shared/{chunk-7fvnrtz4.d.ts → chunk-swc7dqpw.d.ts} +12 -2
  56. package/dist/shared/{chunk-j77cx8dp.js → chunk-t9wqhgzt.js} +325 -58
  57. package/dist/shared/{chunk-9m0xbg5v.js → chunk-wayv5rhr.js} +1 -1
  58. package/dist/shared/{chunk-x7f3g82r.js → chunk-wf0jtzhs.js} +12 -2
  59. package/dist/shared/{chunk-9c7ewvkk.js → chunk-yq5svpk7.js} +162 -19
  60. package/dist/shared/{chunk-cc9nwbtf.js → chunk-z3tj1ydg.js} +3 -0
  61. package/dist/styles.css +60 -0
  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 +1 -1
  70. package/dist/shared/chunk-s2jeqqan.js +0 -243
package/dist/index.js CHANGED
@@ -13,8 +13,9 @@ import {
13
13
  WidgetSection2,
14
14
  WidgetRow2,
15
15
  WidgetChip2,
16
+ WidgetSheet2,
16
17
  Widget2
17
- } from "./shared/chunk-x7f3g82r.js";
18
+ } from "./shared/chunk-wf0jtzhs.js";
18
19
  import {
19
20
  formatClock2,
20
21
  formatShort2,
@@ -27,7 +28,7 @@ import {
27
28
  AgendaUpNext2,
28
29
  AgendaStarting2,
29
30
  Agenda2
30
- } from "./shared/chunk-9c7ewvkk.js";
31
+ } from "./shared/chunk-yq5svpk7.js";
31
32
  import {
32
33
  startPomodoro2,
33
34
  advancePomodoro2,
@@ -37,7 +38,7 @@ import {
37
38
  ClockMinimal2,
38
39
  ClockPhaseDone2,
39
40
  Clock2
40
- } from "./shared/chunk-qdzemt2v.js";
41
+ } from "./shared/chunk-93dtpjz7.js";
41
42
  import {
42
43
  Equalizer2
43
44
  } from "./shared/chunk-2f7zxrbk.js";
@@ -55,7 +56,7 @@ import {
55
56
  NowPlayingMinimal2,
56
57
  NowPlayingFlash2,
57
58
  NowPlaying2
58
- } from "./shared/chunk-xq5hc5gv.js";
59
+ } from "./shared/chunk-2b6gpn8k.js";
59
60
  import {
60
61
  conditionFromCode2,
61
62
  WeatherLeading2,
@@ -63,7 +64,7 @@ import {
63
64
  WeatherMinimal2,
64
65
  WeatherAlert2,
65
66
  Weather2
66
- } from "./shared/chunk-ym0xbses.js";
67
+ } from "./shared/chunk-nwzpekvy.js";
67
68
  import {
68
69
  ISLAND_STATES2,
69
70
  DEFAULT_NOTCH2,
@@ -86,29 +87,29 @@ import {
86
87
  import"./shared/chunk-2s4q6mt0.js";
87
88
  import {
88
89
  ExpandedIsland2
89
- } from "./shared/chunk-9m0xbg5v.js";
90
+ } from "./shared/chunk-wayv5rhr.js";
90
91
  import {
91
92
  SettingsWindow2
92
- } from "./shared/chunk-cc9nwbtf.js";
93
+ } from "./shared/chunk-z3tj1ydg.js";
93
94
  import {
94
95
  ClipboardHistoryLeading2,
95
96
  ClipboardHistoryTrailing2,
96
97
  ClipboardHistoryCopied2,
97
98
  ClipboardHistory2
98
- } from "./shared/chunk-j77cx8dp.js";
99
+ } from "./shared/chunk-t9wqhgzt.js";
99
100
  import {
100
101
  RecentFilesLeading2,
101
102
  RecentFilesTrailing2,
102
103
  RecentFilesMinimal2,
103
104
  RecentFilesSaved2,
104
105
  RecentFiles2
105
- } from "./shared/chunk-mt0k6v8x.js";
106
+ } from "./shared/chunk-gcyspvgr.js";
106
107
  import {
107
108
  SystemStatsLeading2,
108
109
  SystemStatsTrailing2,
109
110
  SystemStatsMinimal2,
110
111
  SystemStats2
111
- } from "./shared/chunk-s2jeqqan.js";
112
+ } from "./shared/chunk-3hcnf4yx.js";
112
113
  import {
113
114
  Countdown2
114
115
  } from "./shared/chunk-502rmtap.js";
@@ -175,6 +176,7 @@ export {
175
176
  WidgetMetaItem2 as WidgetMetaItem,
176
177
  WidgetRow2 as WidgetRow,
177
178
  WidgetSection2 as WidgetSection,
179
+ WidgetSheet2 as WidgetSheet,
178
180
  WidgetSubtitle2 as WidgetSubtitle,
179
181
  WidgetTitle2 as WidgetTitle,
180
182
  advancePomodoro2 as advancePomodoro,
@@ -59,6 +59,8 @@ interface SettingsWindowProps2 {
59
59
  onOpenPermission?: (id: string) => void;
60
60
  /** The About page's rows: version, mode, screen. Defaults to `[]`. */
61
61
  about?: AboutRow2[];
62
+ /** 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`. */
63
+ flush?: boolean;
62
64
  /** Classes for the window's content, which fills its container. */
63
65
  className?: string;
64
66
  }
@@ -80,9 +82,11 @@ type Element_12xgc = JSX_1kxb["Element"];
80
82
  * The page, the preferences and the plugins' states each run both ways
81
83
  * (`value`, `preferences`, `enabled` with their `default*` and `on*Change`),
82
84
  * so the window works on its own or on a host's store. It fills its
83
- * container; the window's frame and title bar are the host's.
85
+ * container; the window's frame and title bar are the host's. In a frame
86
+ * of the host's own, such as the open island, `flush` drops the sidebar's
87
+ * left inset, so the rows' text sits just the row's padding from the edge.
84
88
  *
85
89
  * @example {@include ./examples.mdx}
86
90
  */
87
- declare function SettingsWindow2({ name, value, defaultValue, onValueChange, preferences: preferencesProp, defaultPreferences, onPreferencesChange, plugins, enabled: enabledProp, defaultEnabled, onEnabledChange, permissions, onOpenPermission, about, className }: SettingsWindowProps2): Element_12xgc;
91
+ declare function SettingsWindow2({ name, value, defaultValue, onValueChange, preferences: preferencesProp, defaultPreferences, onPreferencesChange, plugins, enabled: enabledProp, defaultEnabled, onEnabledChange, permissions, onOpenPermission, about, flush, className }: SettingsWindowProps2): Element_12xgc;
88
92
  export { ScreensPreference2, AppPreferences2, SettingsPlugin2, SettingsPermission2, AboutRow2, SettingsWindowProps2, SettingsWindow2 };
@@ -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-wf0jtzhs.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
  })