@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
@@ -1,3 +1,4 @@
1
+ import { WidgetLayout2 } from "./chunk-42wab62s.js";
1
2
  import { JSX as JSX_1kxb } from "react";
2
3
  type WeatherCondition2 = "clear" | "partly-cloudy" | "cloudy" | "fog" | "drizzle" | "rain" | "heavy-rain" | "sleet" | "snow" | "thunderstorm";
3
4
  type WeatherUnit2 = "celsius" | "fahrenheit";
@@ -40,6 +41,10 @@ interface WeatherDay2 {
40
41
  low: number;
41
42
  /** The day's highest chance of rain or snow, 0–100: `precipitation_probability_max`. */
42
43
  precipitation?: number;
44
+ /** When the sun rises, in epoch ms: `sunrise`. The tall layout lists today's. */
45
+ sunrise?: number;
46
+ /** When the sun sets, in epoch ms: `sunset`. The tall layout lists today's. */
47
+ sunset?: number;
43
48
  }
44
49
  interface WeatherProps2 {
45
50
  /** Where the forecast is for: a city's name. */
@@ -66,6 +71,8 @@ interface WeatherProps2 {
66
71
  onRequestAccess?: () => void;
67
72
  /** Called by Open System Settings while access is denied. */
68
73
  onOpenSettings?: () => void;
74
+ /** `tall` is the open island's tall snap: the hero larger, the next 24 hours as a scrolling strip with a temperature curve and the chance of rain, the week as rows with a range bar, and the wind, humidity, UV and the sun's times as details. Defaults to `'fit'`. */
75
+ layout?: WidgetLayout2;
69
76
  /** Classes for the root, which fills its container. */
70
77
  className?: string;
71
78
  }
@@ -134,6 +141,16 @@ declare function WeatherAlert2({ condition, startsAt, title, caption, severity,
134
141
  * (`"offline"`). Once there is a forecast, those keep it up and say so in
135
142
  * the header instead.
136
143
  *
144
+ * At the open island's tall snap (`layout="tall"`) it becomes a sheet: the
145
+ * hero larger, the condition, how warm it feels and today's high and low
146
+ * beside it; then the next 24 hours as a strip that scrolls sideways, each
147
+ * hour's glyph and temperature with the temperature's curve running through
148
+ * them and the chance of rain under each once any hour is wet; then, split
149
+ * by a hairline, the week as rows of day, glyph, chance of rain and the low
150
+ * and high on a bar spanning the week's range, and beside it the details:
151
+ * how warm it feels, the wind, the humidity, the UV index in words and
152
+ * today's sunrise and sunset (`sunrise` / `sunset` on the day).
153
+ *
137
154
  * The other forms are parts: `Weather.Leading` and `Weather.Trailing` for
138
155
  * the compact island's wings (the glyph and the temperature),
139
156
  * `Weather.Minimal`, the glyph on a disc, for the split island's bubble,
@@ -142,7 +159,7 @@ declare function WeatherAlert2({ condition, startsAt, title, caption, severity,
142
159
  *
143
160
  * @example {@include ./examples.mdx}
144
161
  */
145
- declare const Weather2: (({ location, current, hours, days, unit, access, status, now: nowProp, locale, onRefresh, onRequestAccess, onOpenSettings, className }: WeatherProps2) => Element_12xgc) & {
162
+ declare const Weather2: (({ location, current, hours, days, unit, access, status, now: nowProp, locale, onRefresh, onRequestAccess, onOpenSettings, layout, className }: WeatherProps2) => Element_12xgc) & {
146
163
  Leading: typeof WeatherLeading2;
147
164
  Trailing: typeof WeatherTrailing2;
148
165
  Minimal: typeof WeatherMinimal2;
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-ndf79pv5.js";
6
6
  import {
7
7
  widget_default
8
- } from "./chunk-x7f3g82r.js";
8
+ } from "./chunk-wf0jtzhs.js";
9
9
  import {
10
10
  MINUTE2,
11
11
  useEdgeClock2
@@ -97,6 +97,7 @@ function left(seconds) {
97
97
  }
98
98
  var dragOf = (file, onDragStart) => onDragStart ? { draggable: true, onDragStart: (event) => onDragStart(file, event) } : {};
99
99
  var TILE = { default: "size-24 rounded-xl", compact: "size-20 rounded-xl" };
100
+ var SHEET_TILE = { default: "h-32 w-48 rounded-2xl", compact: "h-28 w-42 rounded-2xl" };
100
101
  function Thumbnail({
101
102
  file,
102
103
  className,
@@ -292,6 +293,44 @@ function Tiles({ files, onOpen, onDragStart }) {
292
293
  }, file.id))
293
294
  });
294
295
  }
296
+ function Grid({ files, now, onOpen, onDragStart }) {
297
+ return /* @__PURE__ */ jsx(FluidHover, {
298
+ columns: 5,
299
+ className: "-m-1.5 grid-cols-5 gap-0",
300
+ highlightClassName: "rounded-xl",
301
+ children: files.map((file, index) => /* @__PURE__ */ jsxs(FluidHover.Item, {
302
+ index,
303
+ title: file.name,
304
+ className: "min-h-0 flex-col items-stretch gap-1.5 p-1.5 text-left",
305
+ onClick: () => onOpen?.(file),
306
+ ...dragOf(file, onDragStart),
307
+ children: [
308
+ /* @__PURE__ */ jsx(Thumbnail, {
309
+ file,
310
+ glyph: 24,
311
+ className: "aspect-[4/3] w-full rounded-lg"
312
+ }),
313
+ /* @__PURE__ */ jsxs("span", {
314
+ className: "flex min-w-0 flex-col px-0.5",
315
+ children: [
316
+ /* @__PURE__ */ jsx("span", {
317
+ className: "truncate text-caption text-foreground",
318
+ children: file.name
319
+ }),
320
+ /* @__PURE__ */ jsxs("span", {
321
+ className: "truncate text-micro tabular-nums text-muted-foreground",
322
+ children: [
323
+ bytes(file.size),
324
+ " · ",
325
+ short(now - file.addedAt)
326
+ ]
327
+ })
328
+ ]
329
+ })
330
+ ]
331
+ }, file.id))
332
+ });
333
+ }
295
334
  function RecentFilesLeading2({ source = "downloads" }) {
296
335
  const Icon = SOURCE_ICON[source];
297
336
  return /* @__PURE__ */ jsx(Icon, {
@@ -346,6 +385,7 @@ var RecentFiles2 = Object.assign(function RecentFiles(props) {
346
385
  onClear,
347
386
  onCancelDownload,
348
387
  now: nowProp,
388
+ layout = "fit",
349
389
  size,
350
390
  className
351
391
  } = props;
@@ -377,6 +417,109 @@ var RecentFiles2 = Object.assign(function RecentFiles(props) {
377
417
  source,
378
418
  className: TILE[step]
379
419
  });
420
+ const tabs = /* @__PURE__ */ jsx(Tabs, {
421
+ variant: "subtle",
422
+ size: "compact",
423
+ value: source,
424
+ onValueChange: (v) => setSource(v),
425
+ children: /* @__PURE__ */ jsxs(Tabs.List, {
426
+ className: "-ml-2",
427
+ children: [
428
+ /* @__PURE__ */ jsx(Tabs.Item, {
429
+ value: "downloads",
430
+ label: "Downloads"
431
+ }),
432
+ /* @__PURE__ */ jsx(Tabs.Item, {
433
+ value: "screenshots",
434
+ label: "Screenshots"
435
+ })
436
+ ]
437
+ })
438
+ });
439
+ const clear = onClear && !empty && /* @__PURE__ */ jsx(Button, {
440
+ variant: "ghost",
441
+ size: "compact",
442
+ className: "-mr-2 h-6 px-2",
443
+ onClick: () => onClear(source),
444
+ children: "Clear"
445
+ });
446
+ const nothing = /* @__PURE__ */ jsxs("div", {
447
+ className: "flex min-w-0 flex-col gap-0.5",
448
+ children: [
449
+ /* @__PURE__ */ jsx(widget_default.Title, {
450
+ children: source === "downloads" ? "No downloads yet" : "No screenshots yet"
451
+ }),
452
+ /* @__PURE__ */ jsx("span", {
453
+ className: "text-pretty text-caption text-muted-foreground",
454
+ 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."
455
+ })
456
+ ]
457
+ });
458
+ if (layout === "tall")
459
+ return /* @__PURE__ */ jsxs(widget_default.Sheet, {
460
+ size,
461
+ className,
462
+ children: [
463
+ /* @__PURE__ */ jsxs("div", {
464
+ className: "flex min-w-0 items-center justify-between gap-2",
465
+ children: [
466
+ tabs,
467
+ clear
468
+ ]
469
+ }),
470
+ /* @__PURE__ */ jsxs("div", {
471
+ className: "flex min-w-0 items-center gap-6",
472
+ children: [
473
+ active ? /* @__PURE__ */ jsx(Thumbnail, {
474
+ file: active,
475
+ glyph: 40,
476
+ className: SHEET_TILE[step]
477
+ }) : newest ? /* @__PURE__ */ jsx("span", {
478
+ ...dragOf(newest, onDragStart),
479
+ className: cn("shrink-0", onDragStart && "cursor-grab"),
480
+ children: /* @__PURE__ */ jsx(Thumbnail, {
481
+ file: newest,
482
+ glyph: 40,
483
+ className: SHEET_TILE[step]
484
+ })
485
+ }) : /* @__PURE__ */ jsx(Empty, {
486
+ source,
487
+ className: SHEET_TILE[step]
488
+ }),
489
+ /* @__PURE__ */ jsxs("div", {
490
+ className: "flex min-w-0 flex-1 flex-col gap-1",
491
+ children: [
492
+ header,
493
+ active ? /* @__PURE__ */ jsx(Downloading, {
494
+ download: active,
495
+ onCancel: onCancelDownload
496
+ }) : newest ? /* @__PURE__ */ jsx(Hero, {
497
+ file: newest,
498
+ now,
499
+ props
500
+ }) : nothing
501
+ ]
502
+ })
503
+ ]
504
+ }),
505
+ earlier.length > 0 && /* @__PURE__ */ jsx(widget_default.Section, {
506
+ label: active ? "Latest" : "Earlier",
507
+ trailing: /* @__PURE__ */ jsx("span", {
508
+ className: "tabular-nums",
509
+ children: earlier.length
510
+ }),
511
+ children: /* @__PURE__ */ jsx("div", {
512
+ className: "pt-1.5",
513
+ children: /* @__PURE__ */ jsx(Grid, {
514
+ files: earlier,
515
+ now,
516
+ onOpen,
517
+ onDragStart
518
+ })
519
+ })
520
+ })
521
+ ]
522
+ });
380
523
  return /* @__PURE__ */ jsxs(widget_default, {
381
524
  size,
382
525
  className: cn("h-full", className),
@@ -387,25 +530,7 @@ var RecentFiles2 = Object.assign(function RecentFiles(props) {
387
530
  /* @__PURE__ */ jsxs("div", {
388
531
  className: "flex min-w-0 items-center justify-between gap-2",
389
532
  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
- }),
533
+ tabs,
409
534
  /* @__PURE__ */ jsxs("span", {
410
535
  className: "flex shrink-0 items-center gap-1.5 text-caption tabular-nums text-muted-foreground",
411
536
  children: [
@@ -415,13 +540,7 @@ var RecentFiles2 = Object.assign(function RecentFiles(props) {
415
540
  " more"
416
541
  ]
417
542
  }),
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
- })
543
+ clear
425
544
  ]
426
545
  })
427
546
  ]
@@ -450,18 +569,7 @@ var RecentFiles2 = Object.assign(function RecentFiles(props) {
450
569
  file: newest,
451
570
  now,
452
571
  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
- })
572
+ }) : nothing
465
573
  ]
466
574
  });
467
575
  }, {
@@ -1,3 +1,4 @@
1
+ import { WidgetLayout2 } from "./chunk-42wab62s.js";
1
2
  import { SizeVariant } from "@justanarthur/modo-ui/lib/size-context";
2
3
  import { DragEvent, ReactNode } from "react";
3
4
  import { JSX as JSX_1kxb } from "react";
@@ -59,6 +60,8 @@ interface RecentFilesProps2 {
59
60
  onCancelDownload?: (download: RecentDownload2) => void;
60
61
  /** The moment the times are read at, in epoch ms. Defaults to now, re-read on each minute. */
61
62
  now?: number;
63
+ /** `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'`. */
64
+ layout?: WidgetLayout2;
62
65
  /** Step on the size ladder. Omitted, it follows the surrounding SizeProvider. */
63
66
  size?: SizeVariant;
64
67
  /** Classes for the root, which fills its container. */
@@ -108,6 +111,15 @@ declare function RecentFilesSaved2({ file, onOpen }: SavedProps): Element_12xgc;
108
111
  * in, the speed and the time left, and Cancel. An empty folder says what
109
112
  * will land in it, the switch still beside it.
110
113
  *
114
+ * At the open island's tall snap (`layout="tall"`) it becomes a sheet:
115
+ * the switch and Clear across the top; the newest file (or the download
116
+ * under way) large beside its name, its facts and its actions; then every
117
+ * earlier file of the folder, not three, as a grid five across, each tile
118
+ * its thumbnail or its type's glyph over its name, its size and how long
119
+ * ago it landed. Downloads and screenshots read alike there, since a tile
120
+ * has room for both the look and the name; the grid scrolls with the
121
+ * island, and every tile opens on a press and drags out like the rows.
122
+ *
111
123
  * `RecentFiles.Leading` and `RecentFiles.Trailing` show the glyph and the
112
124
  * download's progress (or the count of new files) in the compact island's
113
125
  * wings, `RecentFiles.Minimal` the progress as a ring in the split
@@ -1,3 +1,4 @@
1
+ import { WidgetLayout2 } from "./chunk-42wab62s.js";
1
2
  import { JSX as JSX_1kxb } from "react";
2
3
  type AgendaAccess2 = "granted" | "undetermined" | "denied";
3
4
  interface AgendaEvent2 {
@@ -33,8 +34,10 @@ interface AgendaProps2 {
33
34
  onRequestAccess?: () => void;
34
35
  /** Called by Open System Settings while access is denied. */
35
36
  onOpenSettings?: () => void;
36
- /** Called by the next event's Join button. */
37
+ /** Called by the next event's Join button, and at the tall snap by every call's. */
37
38
  onJoin?: (event: AgendaEvent2) => void;
39
+ /** `tall` is the open island's tall snap: the next event as the hero, then today and tomorrow listed in full, each event with its times, place or call and Join, then the rest of the week by day. Defaults to `'fit'`. */
40
+ layout?: WidgetLayout2;
38
41
  /** Classes for the root, which fills its container. */
39
42
  className?: string;
40
43
  }
@@ -77,6 +80,14 @@ declare function AgendaStarting2({ event, onJoin }: Omit<ActivityProps, "locale"
77
80
  * (`tomorrowOpen` / `onTomorrowOpenChange`, or kept here). Ended events drop
78
81
  * off; `now` follows the clock on each minute unless you pin it.
79
82
  *
83
+ * At the open island's tall snap (`layout="tall"`) it becomes a sheet: the
84
+ * date and the hero as above, then the rest of today and all of tomorrow
85
+ * listed in full, each event with its start over its end, its calendar's
86
+ * mark, the title over how long it runs and where (or that it's a call),
87
+ * and Join for every call; then the rest of the week, a section per day
88
+ * with events, named by its weekday and date, its all-day events as chips
89
+ * on the name's line.
90
+ *
80
91
  * Before the calendar may be read it asks to connect
81
92
  * (`access="undetermined"`), and when access is off it says where to turn it
82
93
  * on (`"denied"`).
@@ -91,7 +102,7 @@ declare function AgendaStarting2({ event, onJoin }: Omit<ActivityProps, "locale"
91
102
  *
92
103
  * @example {@include ./examples.mdx}
93
104
  */
94
- declare const Agenda2: (({ events, access, now: nowProp, locale, tomorrowOpen: tomorrowOpenProp, defaultTomorrowOpen, onTomorrowOpenChange, onRequestAccess, onOpenSettings, onJoin, className }: AgendaProps2) => Element_12xgc) & {
105
+ declare const Agenda2: (({ events, access, now: nowProp, locale, tomorrowOpen: tomorrowOpenProp, defaultTomorrowOpen, onTomorrowOpenChange, onRequestAccess, onOpenSettings, onJoin, layout, className }: AgendaProps2) => Element_12xgc) & {
95
106
  Leading: typeof AgendaLeading2;
96
107
  Trailing: typeof AgendaTrailing2;
97
108
  Minimal: typeof AgendaMinimal2;