@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
@@ -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-zxsw11dr.js";
9
9
  import {
10
10
  SECOND2,
11
11
  MINUTE2,
@@ -27,6 +27,13 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
27
27
  * as props.
28
28
  */
29
29
  var ROWS = 3;
30
+ var WEEK = 7;
31
+ var addDays = (ms, days) => {
32
+ const date = new Date(ms);
33
+ date.setDate(date.getDate() + days);
34
+ return date.getTime();
35
+ };
36
+ var covers = (event, start, end) => event.start < end && event.end > start;
30
37
  var time = (ms, locale) => new Date(ms).toLocaleTimeString(locale, { hour: "numeric", minute: "2-digit" });
31
38
  function timeParts(ms, locale) {
32
39
  const parts = new Intl.DateTimeFormat(locale, { hour: "numeric", minute: "2-digit" }).formatToParts(ms);
@@ -79,8 +86,9 @@ function When({ event, now, midnight, locale }) {
79
86
  unit: "min"
80
87
  });
81
88
  const { value, period } = timeParts(event.start, locale);
89
+ const prefix = event.start >= addDays(midnight, 1) ? new Date(event.start).toLocaleDateString(locale, { weekday: "long" }) : event.start >= midnight ? "Tomorrow" : "at";
82
90
  return /* @__PURE__ */ jsx(widget_default.Figure, {
83
- prefix: event.start >= midnight ? "Tomorrow" : "at",
91
+ prefix,
84
92
  value,
85
93
  unit: period
86
94
  });
@@ -151,6 +159,83 @@ function Rows({ events, locale }) {
151
159
  children: event.title
152
160
  }, event.id));
153
161
  }
162
+ function Entry({ event, locale, onJoin }) {
163
+ return /* @__PURE__ */ jsxs("div", {
164
+ className: "flex min-w-0 items-center gap-2.5 py-1.5",
165
+ children: [
166
+ /* @__PURE__ */ jsxs("span", {
167
+ className: "flex w-15 shrink-0 flex-col whitespace-nowrap text-caption tabular-nums",
168
+ children: [
169
+ /* @__PURE__ */ jsx("span", {
170
+ className: "text-foreground",
171
+ children: time(event.start, locale)
172
+ }),
173
+ /* @__PURE__ */ jsx("span", {
174
+ className: "text-muted-foreground",
175
+ children: time(event.end, locale)
176
+ })
177
+ ]
178
+ }),
179
+ /* @__PURE__ */ jsx("span", {
180
+ "aria-hidden": true,
181
+ className: "w-0.75 shrink-0 self-stretch rounded-full",
182
+ style: { backgroundColor: event.color }
183
+ }),
184
+ /* @__PURE__ */ jsxs("span", {
185
+ className: "flex min-w-0 flex-1 flex-col",
186
+ children: [
187
+ /* @__PURE__ */ jsx("span", {
188
+ className: "truncate text-body text-foreground",
189
+ children: event.title
190
+ }),
191
+ /* @__PURE__ */ jsxs(widget_default.Meta, {
192
+ children: [
193
+ /* @__PURE__ */ jsx(widget_default.MetaItem, {
194
+ icon: Clock,
195
+ children: length(event.end - event.start)
196
+ }),
197
+ event.meetingUrl && /* @__PURE__ */ jsx(widget_default.MetaItem, {
198
+ icon: Video,
199
+ children: "Video call"
200
+ }),
201
+ event.location && /* @__PURE__ */ jsx(widget_default.MetaItem, {
202
+ icon: MapPin,
203
+ children: event.location
204
+ })
205
+ ]
206
+ })
207
+ ]
208
+ }),
209
+ event.meetingUrl && /* @__PURE__ */ jsx(Button, {
210
+ variant: "secondary",
211
+ size: "compact",
212
+ leadingIcon: Video,
213
+ onClick: () => onJoin?.(event),
214
+ children: "Join"
215
+ })
216
+ ]
217
+ });
218
+ }
219
+ function Day({ label, events, allDay = [], empty, locale, onJoin }) {
220
+ return /* @__PURE__ */ jsxs(widget_default.Section, {
221
+ label,
222
+ trailing: allDay.map((event) => /* @__PURE__ */ jsx(widget_default.Chip, {
223
+ color: event.color,
224
+ children: event.title
225
+ }, event.id)),
226
+ children: [
227
+ events.map((event) => /* @__PURE__ */ jsx(Entry, {
228
+ event,
229
+ locale,
230
+ onJoin
231
+ }, event.id)),
232
+ !events.length && empty && /* @__PURE__ */ jsx("span", {
233
+ className: "flex h-7 items-center text-body text-muted-foreground",
234
+ children: empty
235
+ })
236
+ ]
237
+ });
238
+ }
154
239
  function More({ count }) {
155
240
  if (count <= 0)
156
241
  return null;
@@ -261,6 +346,7 @@ var Agenda2 = Object.assign(function Agenda({
261
346
  onRequestAccess,
262
347
  onOpenSettings,
263
348
  onJoin,
349
+ layout = "fit",
264
350
  className
265
351
  }) {
266
352
  const ticking = useEdgeClock2(0, nowProp === undefined, MINUTE2);
@@ -294,7 +380,8 @@ var Agenda2 = Object.assign(function Agenda({
294
380
  });
295
381
  const midnight = new Date(now).setHours(24, 0, 0, 0);
296
382
  const next = new Date(midnight).setHours(24, 0, 0, 0);
297
- const live = events.filter((event) => event.end > now && event.start < next).sort((a, b) => a.start - b.start);
383
+ const until = layout === "tall" ? addDays(midnight, WEEK - 1) : next;
384
+ const live = events.filter((event) => event.end > now && event.start < until).sort((a, b) => a.start - b.start);
298
385
  const allDay = live.filter((event) => event.allDay && event.start < midnight);
299
386
  const timed = live.filter((event) => !event.allDay);
300
387
  const [hero] = timed;
@@ -306,9 +393,78 @@ var Agenda2 = Object.assign(function Agenda({
306
393
  className
307
394
  });
308
395
  const today = timed.filter((event) => event !== hero && event.start < midnight);
309
- const tomorrow = timed.filter((event) => event !== hero && event.start >= midnight);
396
+ const tomorrow = timed.filter((event) => event !== hero && event.start >= midnight && event.start < next);
310
397
  const tomorrowShown = tomorrowOpen ? tomorrow.slice(0, ROWS) : tomorrow.slice(0, 1);
311
398
  const date = new Date(now).toLocaleDateString(locale, { weekday: "long", month: "long", day: "numeric" });
399
+ const header = /* @__PURE__ */ jsx(widget_default.Header, {
400
+ icon: CalendarDays,
401
+ trailing: allDay.map((event) => /* @__PURE__ */ jsx(widget_default.Chip, {
402
+ color: event.color,
403
+ children: event.title
404
+ }, event.id)),
405
+ children: date
406
+ });
407
+ const heroBlock = /* @__PURE__ */ jsx(Hero, {
408
+ event: hero,
409
+ now,
410
+ midnight,
411
+ locale,
412
+ onJoin
413
+ });
414
+ if (layout === "tall") {
415
+ const later = Array.from({ length: WEEK - 2 }, (_, i) => {
416
+ const start = addDays(next, i);
417
+ const end = addDays(next, i + 1);
418
+ return {
419
+ start,
420
+ events: timed.filter((event) => event !== hero && event.start >= start && event.start < end),
421
+ allDay: live.filter((event) => event.allDay && covers(event, start, end))
422
+ };
423
+ }).filter((day) => day.events.length || day.allDay.length);
424
+ return /* @__PURE__ */ jsxs(widget_default.Sheet, {
425
+ className,
426
+ children: [
427
+ /* @__PURE__ */ jsxs("div", {
428
+ className: "flex min-w-0 flex-col gap-2",
429
+ children: [
430
+ header,
431
+ heroBlock
432
+ ]
433
+ }),
434
+ /* @__PURE__ */ jsxs("div", {
435
+ className: "flex min-w-0 flex-col gap-3",
436
+ children: [
437
+ /* @__PURE__ */ jsx(Day, {
438
+ label: "Later today",
439
+ events: today,
440
+ empty: "Nothing else today",
441
+ locale,
442
+ onJoin
443
+ }),
444
+ /* @__PURE__ */ jsx(Day, {
445
+ label: "Tomorrow",
446
+ events: tomorrow,
447
+ allDay: live.filter((event) => event.allDay && covers(event, midnight, next)),
448
+ empty: "Nothing planned",
449
+ locale,
450
+ onJoin
451
+ }),
452
+ later.map((day) => /* @__PURE__ */ jsx(Day, {
453
+ label: new Date(day.start).toLocaleDateString(locale, {
454
+ weekday: "long",
455
+ month: "long",
456
+ day: "numeric"
457
+ }),
458
+ events: day.events,
459
+ allDay: day.allDay,
460
+ locale,
461
+ onJoin
462
+ }, day.start))
463
+ ]
464
+ })
465
+ ]
466
+ });
467
+ }
312
468
  return /* @__PURE__ */ jsxs(widget_default, {
313
469
  className,
314
470
  aside: /* @__PURE__ */ jsxs(Fragment, {
@@ -353,21 +509,8 @@ var Agenda2 = Object.assign(function Agenda({
353
509
  ]
354
510
  }),
355
511
  children: [
356
- /* @__PURE__ */ jsx(widget_default.Header, {
357
- icon: CalendarDays,
358
- trailing: allDay.map((event) => /* @__PURE__ */ jsx(widget_default.Chip, {
359
- color: event.color,
360
- children: event.title
361
- }, event.id)),
362
- children: date
363
- }),
364
- /* @__PURE__ */ jsx(Hero, {
365
- event: hero,
366
- now,
367
- midnight,
368
- locale,
369
- onJoin
370
- })
512
+ header,
513
+ heroBlock
371
514
  ]
372
515
  });
373
516
  }, {
@@ -1,3 +1,4 @@
1
+ import { WidgetLayout2 } from "./chunk-nqjermbr.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;
@@ -51,9 +51,9 @@ interface WidgetMetaItemProps2 {
51
51
  /** The fact. */
52
52
  children: ReactNode;
53
53
  }
54
- /** One fact of a meta row: a glyph and a few words. */
54
+ /** One fact of a meta row: a glyph and a few words. Only the last one truncates; the others keep their words whole. */
55
55
  declare function WidgetMetaItem2({ icon: Icon, children }: WidgetMetaItemProps2): Element_12xgc;
56
- /** Supporting facts in a row, each a glyph and a few words, muted; the last one gives way first. */
56
+ /** Supporting facts in a row, each a glyph and a few words, muted; the last one gives way, the others stay whole. */
57
57
  declare function WidgetMeta2({ children, className }: {
58
58
  children: ReactNode;
59
59
  className?: string;
@@ -126,6 +126,22 @@ interface WidgetChipProps2 {
126
126
  }
127
127
  /** A small label on a wash one surface up: an all-day event, a state. */
128
128
  declare function WidgetChip2({ color, children }: WidgetChipProps2): Element_12xgc;
129
+ type WidgetLayout2 = "fit" | "tall";
130
+ interface WidgetSheetProps2 {
131
+ /** The bands, top to bottom: the hero first, then the lists and details. */
132
+ children: ReactNode;
133
+ /** Step on the size ladder for every part inside. Omitted, the widget follows the surrounding SizeProvider. */
134
+ size?: SizeVariant;
135
+ /** Classes for the column. */
136
+ className?: string;
137
+ }
138
+ /**
139
+ * The frame of a widget at the open island's tall snap (a sheet about
140
+ * 692 × 476): bands stacked top to bottom, the hero first, set larger, then
141
+ * the lists and details the short island has no room for. Bands sit apart
142
+ * on space alone; a band of columns splits them with hairlines.
143
+ */
144
+ declare function WidgetSheet2({ children, size, className }: WidgetSheetProps2): Element_12xgc;
129
145
  interface WidgetProps2 {
130
146
  /** The hero's picture at the start, as tall as the widget: artwork, a ring. */
131
147
  media?: ReactNode;
@@ -154,6 +170,11 @@ interface WidgetProps2 {
154
170
  * Empty and permission states are a `Widget.Message`, laid out across the
155
171
  * wide, short island.
156
172
  *
173
+ * At the island's tall snap a widget shows more, not the same layout
174
+ * stretched: each block takes `layout="tall"` and builds a `Widget.Sheet`,
175
+ * bands of fuller lists, larger pictures and the details the short island
176
+ * leaves out.
177
+ *
157
178
  * The frame fills the island's content area. The aside folds away under
158
179
  * 30rem of width, so a narrower panel keeps the hero.
159
180
  *
@@ -171,5 +192,6 @@ declare const Widget2: (({ media, aside, children, size, className }: WidgetProp
171
192
  Section: typeof WidgetSection2;
172
193
  Row: typeof WidgetRow2;
173
194
  Chip: typeof WidgetChip2;
195
+ Sheet: typeof WidgetSheet2;
174
196
  };
175
- export { WidgetHeaderProps2, WidgetHeader2, WidgetTitleProps2, WidgetTitle2, WidgetSubtitle2, WidgetFigureProps2, WidgetFigure2, WidgetMetaItemProps2, WidgetMetaItem2, WidgetMeta2, WidgetActionProps2, WidgetAction2, WidgetMessageProps2, WidgetMessage2, WidgetSectionProps2, WidgetSection2, WidgetRowProps2, WidgetRow2, WidgetChipProps2, WidgetChip2, WidgetProps2, Widget2 };
197
+ export { WidgetHeaderProps2, WidgetHeader2, WidgetTitleProps2, WidgetTitle2, WidgetSubtitle2, WidgetFigureProps2, WidgetFigure2, WidgetMetaItemProps2, WidgetMetaItem2, WidgetMeta2, WidgetActionProps2, WidgetAction2, WidgetMessageProps2, WidgetMessage2, WidgetSectionProps2, WidgetSection2, WidgetRowProps2, WidgetRow2, WidgetChipProps2, WidgetChip2, WidgetLayout2, WidgetSheetProps2, WidgetSheet2, WidgetProps2, Widget2 };