@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,381 @@
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
+ SECOND2,
11
+ MINUTE2,
12
+ formatShort2,
13
+ useEdgeClock2
14
+ } from "./chunk-gb56m10p.js";
15
+
16
+ // blocks/activities/agenda/index.tsx
17
+ import Button from "@justanarthur/modo-ui/components/actions/button";
18
+ import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
19
+ import { cn } from "@justanarthur/modo-ui/lib/utils";
20
+ import { CalendarCheck, CalendarDays, ChevronDown, ChevronUp, Clock, Lock, MapPin, Video } from "lucide-react";
21
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
22
+ /*!
23
+ * Local addition: a notch app's calendar, the next event and the rest of
24
+ * today and tomorrow, with the countdown to the next one. Rebuilt from Just
25
+ * Notch's calendar plugin (`Agenda`, `Upcoming`, `Starting`, `Ring`,
26
+ * `Countdown`) as presentational parts: events, access and actions come in
27
+ * as props.
28
+ */
29
+ var ROWS = 3;
30
+ var time = (ms, locale) => new Date(ms).toLocaleTimeString(locale, { hour: "numeric", minute: "2-digit" });
31
+ function timeParts(ms, locale) {
32
+ const parts = new Intl.DateTimeFormat(locale, { hour: "numeric", minute: "2-digit" }).formatToParts(ms);
33
+ const period = parts.find((part) => part.type === "dayPeriod")?.value;
34
+ const value = parts.filter((part) => part.type !== "dayPeriod").map((part) => part.value).join("").trim();
35
+ return { value, period };
36
+ }
37
+ var range = (event, locale) => `${time(event.start, locale)} – ${time(event.end, locale)}`;
38
+ function length(ms) {
39
+ const minutes = Math.round(ms / MINUTE2);
40
+ if (minutes < 60)
41
+ return `${minutes} min`;
42
+ const hours = Math.floor(minutes / 60);
43
+ return minutes % 60 ? `${hours} h ${minutes % 60} min` : `${hours} h`;
44
+ }
45
+ function useUntil(start, unit = MINUTE2) {
46
+ const now = useEdgeClock2(start, Date.now() < start + SECOND2, unit);
47
+ return start - now;
48
+ }
49
+ function Dot({ color, className }) {
50
+ return /* @__PURE__ */ jsx("span", {
51
+ "aria-hidden": true,
52
+ className: cn("size-2.5 shrink-0 rounded-full", className),
53
+ style: { backgroundColor: color }
54
+ });
55
+ }
56
+ function Join({
57
+ event,
58
+ size,
59
+ onJoin
60
+ }) {
61
+ return /* @__PURE__ */ jsx(Button, {
62
+ variant: "primary",
63
+ size,
64
+ leadingIcon: Video,
65
+ onClick: () => onJoin?.(event),
66
+ children: "Join"
67
+ });
68
+ }
69
+ function When({ event, now, midnight, locale }) {
70
+ if (event.start <= now)
71
+ return /* @__PURE__ */ jsx(widget_default.Figure, {
72
+ value: "Now",
73
+ unit: `${length(event.end - now)} left`
74
+ });
75
+ if (event.start - now < 60 * MINUTE2)
76
+ return /* @__PURE__ */ jsx(widget_default.Figure, {
77
+ prefix: "in",
78
+ value: Math.max(1, Math.ceil((event.start - now) / MINUTE2)),
79
+ unit: "min"
80
+ });
81
+ const { value, period } = timeParts(event.start, locale);
82
+ return /* @__PURE__ */ jsx(widget_default.Figure, {
83
+ prefix: event.start >= midnight ? "Tomorrow" : "at",
84
+ value,
85
+ unit: period
86
+ });
87
+ }
88
+ function Hero({ event, now, midnight, locale, onJoin }) {
89
+ return /* @__PURE__ */ jsxs("div", {
90
+ className: "flex min-w-0 flex-col gap-1.5",
91
+ children: [
92
+ /* @__PURE__ */ jsxs("div", {
93
+ className: "flex min-w-0 items-end justify-between gap-3",
94
+ children: [
95
+ /* @__PURE__ */ jsx(When, {
96
+ event,
97
+ now,
98
+ midnight,
99
+ locale
100
+ }),
101
+ event.meetingUrl && /* @__PURE__ */ jsx(Join, {
102
+ event,
103
+ size: "compact",
104
+ onJoin
105
+ })
106
+ ]
107
+ }),
108
+ /* @__PURE__ */ jsxs("div", {
109
+ className: "flex min-w-0 flex-col gap-0.5",
110
+ children: [
111
+ /* @__PURE__ */ jsx(widget_default.Title, {
112
+ leading: /* @__PURE__ */ jsx(Dot, {
113
+ color: event.color
114
+ }),
115
+ children: event.title
116
+ }),
117
+ /* @__PURE__ */ jsxs(widget_default.Meta, {
118
+ className: "pl-4.5",
119
+ children: [
120
+ /* @__PURE__ */ jsx(widget_default.MetaItem, {
121
+ icon: Clock,
122
+ children: range(event, locale)
123
+ }),
124
+ event.meetingUrl && /* @__PURE__ */ jsx(widget_default.MetaItem, {
125
+ icon: Video,
126
+ children: "Video call"
127
+ }),
128
+ event.location && /* @__PURE__ */ jsx(widget_default.MetaItem, {
129
+ icon: MapPin,
130
+ children: event.location
131
+ })
132
+ ]
133
+ })
134
+ ]
135
+ })
136
+ ]
137
+ });
138
+ }
139
+ function Rows({ events, locale }) {
140
+ return events.map((event) => /* @__PURE__ */ jsx(widget_default.Row, {
141
+ leading: time(event.start, locale),
142
+ color: event.color,
143
+ trailing: event.meetingUrl ? /* @__PURE__ */ jsx(Video, {
144
+ size: 12,
145
+ strokeWidth: 1.5,
146
+ "aria-label": "Video call"
147
+ }) : event.location && /* @__PURE__ */ jsx("span", {
148
+ className: "max-w-24 truncate",
149
+ children: event.location
150
+ }),
151
+ children: event.title
152
+ }, event.id));
153
+ }
154
+ function More({ count }) {
155
+ if (count <= 0)
156
+ return null;
157
+ return /* @__PURE__ */ jsxs("span", {
158
+ className: "flex h-6 items-center pl-17.5 text-caption text-muted-foreground",
159
+ children: [
160
+ count,
161
+ " more"
162
+ ]
163
+ });
164
+ }
165
+ function AgendaLeading2({ event }) {
166
+ return /* @__PURE__ */ jsx(CalendarDays, {
167
+ size: 16,
168
+ strokeWidth: 1.5,
169
+ style: { color: event.color }
170
+ });
171
+ }
172
+ function AgendaTrailing2({ event }) {
173
+ const left = useUntil(event.start);
174
+ return /* @__PURE__ */ jsxs("span", {
175
+ className: "flex items-center gap-1 text-caption weight-semibold text-foreground tabular-nums",
176
+ children: [
177
+ /* @__PURE__ */ jsx(Dot, {
178
+ color: event.color,
179
+ className: "size-1.5"
180
+ }),
181
+ left > 0 ? formatShort2(left / SECOND2) : "now"
182
+ ]
183
+ });
184
+ }
185
+ var RING = 2 * Math.PI * 8;
186
+ function AgendaMinimal2({ event, lead = 10 * MINUTE2 }) {
187
+ const left = Math.max(0, useUntil(event.start, SECOND2));
188
+ const share = Math.min(1, left / lead);
189
+ return /* @__PURE__ */ jsxs("svg", {
190
+ role: "img",
191
+ "aria-label": `${event.title}, in ${formatShort2(left / SECOND2)}`,
192
+ viewBox: "0 0 20 20",
193
+ className: "size-5.5 -rotate-90",
194
+ children: [
195
+ /* @__PURE__ */ jsx("circle", {
196
+ cx: "10",
197
+ cy: "10",
198
+ r: "8",
199
+ fill: "none",
200
+ strokeWidth: "2.5",
201
+ className: "stroke-current text-border"
202
+ }),
203
+ /* @__PURE__ */ jsx("circle", {
204
+ cx: "10",
205
+ cy: "10",
206
+ r: "8",
207
+ fill: "none",
208
+ strokeWidth: "2.5",
209
+ strokeLinecap: "round",
210
+ strokeDasharray: RING,
211
+ strokeDashoffset: RING * (1 - share),
212
+ style: { stroke: event.color }
213
+ })
214
+ ]
215
+ });
216
+ }
217
+ function AgendaUpNext2({ event, locale, onJoin }) {
218
+ const now = event.start - useUntil(event.start);
219
+ return /* @__PURE__ */ jsx(widget_default, {
220
+ children: /* @__PURE__ */ jsx(Hero, {
221
+ event,
222
+ now,
223
+ midnight: new Date(now).setHours(24, 0, 0, 0),
224
+ locale,
225
+ onJoin
226
+ })
227
+ });
228
+ }
229
+ function AgendaStarting2({ event, onJoin }) {
230
+ const left = useUntil(event.start, SECOND2);
231
+ const when = left > 0 ? `Starts in ${formatShort2(left / SECOND2)}` : "Starting now";
232
+ return /* @__PURE__ */ jsx(IslandFlash2, {
233
+ icon: /* @__PURE__ */ jsx("span", {
234
+ className: "flex size-9 items-center justify-center rounded-lg",
235
+ style: { color: event.color, backgroundColor: `color-mix(in oklab, ${event.color} 22%, transparent)` },
236
+ children: event.meetingUrl ? /* @__PURE__ */ jsx(Video, {
237
+ size: 16,
238
+ strokeWidth: 1.5
239
+ }) : /* @__PURE__ */ jsx(CalendarDays, {
240
+ size: 16,
241
+ strokeWidth: 1.5
242
+ })
243
+ }),
244
+ title: event.title,
245
+ caption: event.location ? `${when} · ${event.location}` : when,
246
+ action: event.meetingUrl && /* @__PURE__ */ jsx(Join, {
247
+ event,
248
+ size: "compact",
249
+ onJoin
250
+ })
251
+ });
252
+ }
253
+ var Agenda2 = Object.assign(function Agenda({
254
+ events,
255
+ access = "granted",
256
+ now: nowProp,
257
+ locale,
258
+ tomorrowOpen: tomorrowOpenProp,
259
+ defaultTomorrowOpen = false,
260
+ onTomorrowOpenChange,
261
+ onRequestAccess,
262
+ onOpenSettings,
263
+ onJoin,
264
+ className
265
+ }) {
266
+ const ticking = useEdgeClock2(0, nowProp === undefined, MINUTE2);
267
+ const now = nowProp ?? ticking;
268
+ const [tomorrowOpen, setTomorrowOpen] = useControllableState(tomorrowOpenProp, defaultTomorrowOpen, onTomorrowOpenChange);
269
+ if (access === "undetermined")
270
+ return /* @__PURE__ */ jsx(widget_default.Message, {
271
+ icon: CalendarDays,
272
+ title: "See what's next",
273
+ description: "Your next event with a countdown, and the rest of today and tomorrow.",
274
+ actions: /* @__PURE__ */ jsx(Button, {
275
+ variant: "primary",
276
+ size: "compact",
277
+ onClick: onRequestAccess,
278
+ children: "Connect calendar"
279
+ }),
280
+ className
281
+ });
282
+ if (access === "denied")
283
+ return /* @__PURE__ */ jsx(widget_default.Message, {
284
+ icon: Lock,
285
+ title: "Calendar access is off",
286
+ description: "Turn it on in System Settings › Privacy & Security › Calendars.",
287
+ actions: /* @__PURE__ */ jsx(Button, {
288
+ variant: "secondary",
289
+ size: "compact",
290
+ onClick: onOpenSettings,
291
+ children: "Open System Settings"
292
+ }),
293
+ className
294
+ });
295
+ const midnight = new Date(now).setHours(24, 0, 0, 0);
296
+ 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);
298
+ const allDay = live.filter((event) => event.allDay && event.start < midnight);
299
+ const timed = live.filter((event) => !event.allDay);
300
+ const [hero] = timed;
301
+ if (!hero)
302
+ return /* @__PURE__ */ jsx(widget_default.Message, {
303
+ icon: CalendarCheck,
304
+ title: allDay.length ? allDay.map((event) => event.title).join(", ") : "Nothing planned",
305
+ description: allDay.length ? "All day today; nothing else on the calendar." : "No more events today or tomorrow.",
306
+ className
307
+ });
308
+ const today = timed.filter((event) => event !== hero && event.start < midnight);
309
+ const tomorrow = timed.filter((event) => event !== hero && event.start >= midnight);
310
+ const tomorrowShown = tomorrowOpen ? tomorrow.slice(0, ROWS) : tomorrow.slice(0, 1);
311
+ const date = new Date(now).toLocaleDateString(locale, { weekday: "long", month: "long", day: "numeric" });
312
+ return /* @__PURE__ */ jsxs(widget_default, {
313
+ className,
314
+ aside: /* @__PURE__ */ jsxs(Fragment, {
315
+ children: [
316
+ /* @__PURE__ */ jsxs(widget_default.Section, {
317
+ label: "Later today",
318
+ children: [
319
+ today.length ? /* @__PURE__ */ jsx(Rows, {
320
+ events: today.slice(0, ROWS),
321
+ locale
322
+ }) : /* @__PURE__ */ jsx("span", {
323
+ className: "flex h-7 items-center text-body text-muted-foreground",
324
+ children: "Nothing else today"
325
+ }),
326
+ /* @__PURE__ */ jsx(More, {
327
+ count: today.length - ROWS
328
+ })
329
+ ]
330
+ }),
331
+ tomorrow.length > 0 && /* @__PURE__ */ jsxs(widget_default.Section, {
332
+ className: "mt-1",
333
+ label: "Tomorrow",
334
+ trailing: tomorrow.length > 1 && /* @__PURE__ */ jsx(Button, {
335
+ variant: "ghost",
336
+ size: "compact",
337
+ className: "-mr-2 h-6 px-2",
338
+ "aria-expanded": tomorrowOpen,
339
+ trailingIcon: tomorrowOpen ? ChevronUp : ChevronDown,
340
+ onClick: () => setTomorrowOpen(!tomorrowOpen),
341
+ children: tomorrowOpen ? "Less" : `${tomorrow.length - 1} more`
342
+ }),
343
+ children: [
344
+ /* @__PURE__ */ jsx(Rows, {
345
+ events: tomorrowShown,
346
+ locale
347
+ }),
348
+ tomorrowOpen && /* @__PURE__ */ jsx(More, {
349
+ count: tomorrow.length - ROWS
350
+ })
351
+ ]
352
+ })
353
+ ]
354
+ }),
355
+ 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
+ })
371
+ ]
372
+ });
373
+ }, {
374
+ Leading: AgendaLeading2,
375
+ Trailing: AgendaTrailing2,
376
+ Minimal: AgendaMinimal2,
377
+ UpNext: AgendaUpNext2,
378
+ Starting: AgendaStarting2
379
+ });
380
+ var agenda_default = Agenda2;
381
+ export { AgendaLeading2, AgendaTrailing2, AgendaMinimal2, AgendaUpNext2, AgendaStarting2, Agenda2, agenda_default };
@@ -3,21 +3,28 @@
3
3
  import {
4
4
  DEFAULT_NOTCH2,
5
5
  INSET2
6
- } from "./chunk-zvh0d3qb.js";
6
+ } from "./chunk-61t2dfte.js";
7
7
  import {
8
8
  useIsland2
9
9
  } from "./chunk-d5qm9cps.js";
10
10
  import {
11
11
  IslandTabs2
12
- } from "./chunk-rpfwv3pz.js";
12
+ } from "./chunk-r471sknr.js";
13
+ import {
14
+ contentShown2,
15
+ contentHidden2,
16
+ contentEnter2
17
+ } from "./chunk-2s4q6mt0.js";
13
18
 
14
19
  // blocks/app/expanded-island/index.tsx
15
20
  import Button from "@justanarthur/modo-ui/components/actions/button";
21
+ import { useReduceMotion } from "@justanarthur/modo-ui/lib/reduced-motion";
16
22
  import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
17
23
  import { cn } from "@justanarthur/modo-ui/lib/utils";
18
24
  import ScrollArea from "@justanarthur/modo-ui/primitives/layout/scroll-area";
19
25
  import { SizeProvider } from "@justanarthur/modo-ui/primitives/systems/sizes";
20
26
  import { Settings } from "lucide-react";
27
+ import { motion } from "motion/react";
21
28
  import { useState } from "react";
22
29
  import { jsx, jsxs } from "react/jsx-runtime";
23
30
  /*!
@@ -42,6 +49,7 @@ function ExpandedIsland2({
42
49
  const tab = tabs.find((t) => t.value === value) ?? tabs[0];
43
50
  const title = tabs.find((t) => t.value === hovered)?.label ?? tab?.label;
44
51
  const notch = island?.geometry.notch.height ?? DEFAULT_NOTCH2.height;
52
+ const reduced = useReduceMotion();
45
53
  return /* @__PURE__ */ jsxs("div", {
46
54
  className: cn("flex size-full flex-col", className),
47
55
  children: [
@@ -84,9 +92,12 @@ function ExpandedIsland2({
84
92
  /* @__PURE__ */ jsx(ScrollArea, {
85
93
  className: "min-h-0 flex-1",
86
94
  viewportClassName: "scroll-fade [&>div]:flex [&>div]:min-h-full [&>div]:flex-col",
87
- children: /* @__PURE__ */ jsx("div", {
95
+ children: /* @__PURE__ */ jsx(motion.div, {
88
96
  className: "flex flex-1 flex-col py-1 [&>*]:flex-1",
89
97
  style: { paddingInline: INSET2 },
98
+ initial: reduced ? { opacity: 0 } : contentHidden2,
99
+ animate: reduced ? { opacity: 1 } : contentShown2,
100
+ transition: contentEnter2,
90
101
  children: tab ? tab.content : /* @__PURE__ */ jsx("div", {
91
102
  className: "flex items-center justify-center text-caption text-muted-foreground",
92
103
  children: empty
@@ -24,6 +24,7 @@ function MediaScrubber2({
24
24
  size = "compact",
25
25
  label = "Position",
26
26
  disabled = false,
27
+ quiet = false,
27
28
  className
28
29
  }) {
29
30
  const [base, setBase] = useState(() => ({ seconds: position, since: Date.now() }));
@@ -48,18 +49,31 @@ function MediaScrubber2({
48
49
  className: "w-9 shrink-0 text-micro tabular-nums text-muted-foreground",
49
50
  children: formatClock2(value)
50
51
  }),
51
- /* @__PURE__ */ jsx(Slider, {
52
- className: "mb-0 min-w-0 flex-1",
53
- size,
54
- label,
55
- showValue: false,
56
- formatValue: formatClock2,
57
- min: 0,
58
- max: Math.max(1, duration),
59
- step: 1,
60
- value,
61
- disabled,
62
- onValueChange: (v) => setDragged(v)
52
+ /* @__PURE__ */ jsxs("span", {
53
+ className: "group/scrub relative flex min-w-0 flex-1 items-center",
54
+ children: [
55
+ /* @__PURE__ */ jsx(Slider, {
56
+ className: cn("mb-0 min-w-0 flex-1", quiet && "opacity-0 transition-[opacity] duration-fast group-hover/scrub:opacity-100 group-focus-within/scrub:opacity-100 pointer-coarse:opacity-100"),
57
+ size,
58
+ label,
59
+ showValue: false,
60
+ formatValue: formatClock2,
61
+ min: 0,
62
+ max: Math.max(1, duration),
63
+ step: 1,
64
+ value,
65
+ disabled,
66
+ onValueChange: (v) => setDragged(v)
67
+ }),
68
+ quiet && /* @__PURE__ */ jsx("span", {
69
+ "aria-hidden": true,
70
+ className: "pointer-events-none absolute inset-x-0 h-1 overflow-hidden rounded-full bg-active transition-[opacity] duration-fast group-hover/scrub:opacity-0 group-focus-within/scrub:opacity-0 pointer-coarse:opacity-0",
71
+ children: /* @__PURE__ */ jsx("span", {
72
+ className: "block size-full rounded-full bg-foreground",
73
+ style: { transform: `translateX(${(value / Math.max(1, duration) - 1) * 100}%)` }
74
+ })
75
+ })
76
+ ]
63
77
  }),
64
78
  /* @__PURE__ */ jsxs("span", {
65
79
  className: "w-9 shrink-0 text-right text-micro tabular-nums text-muted-foreground",
@@ -0,0 +1,123 @@
1
+ import { JSX as JSX_1kxb } from "react";
2
+ type PomodoroPhase2 = "focus" | "short-break" | "long-break";
3
+ /** A Pomodoro cycle's lengths, in minutes, and how many focus rounds come before the long break. */
4
+ interface PomodoroSettings2 {
5
+ focus: number;
6
+ shortBreak: number;
7
+ longBreak: number;
8
+ rounds: number;
9
+ }
10
+ /** A Pomodoro phase: running while it has `endsAt`, paused while it has `remaining`. */
11
+ interface PomodoroRun2 {
12
+ phase: PomodoroPhase2;
13
+ /** The focus round it belongs to, from 1: a break follows its round. */
14
+ round: number;
15
+ /** The phase's whole length, in ms. */
16
+ total: number;
17
+ /** When it ends, in epoch ms, while it runs. */
18
+ endsAt?: number;
19
+ /** The time left, in ms, while it is paused. */
20
+ remaining?: number;
21
+ }
22
+ /** A world clock: a city and its IANA time zone. */
23
+ interface ClockZone2 {
24
+ city: string;
25
+ /** An IANA time zone: `America/Chicago`. */
26
+ timeZone: string;
27
+ }
28
+ interface ClockProps2 {
29
+ /** The world clocks beside the time, two or three. */
30
+ zones?: ClockZone2[];
31
+ /** Shows the seconds, re-rendering on each second's edge instead of each minute's. Defaults to `false`. */
32
+ seconds?: boolean;
33
+ /** A 12-hour clock (`true`) or a 24-hour one (`false`). Defaults to the locale's. */
34
+ hour12?: boolean;
35
+ /** The time zone of the main clock. Defaults to the system's. */
36
+ timeZone?: string;
37
+ /** Formats the time and the date. Defaults to the browser's locale. */
38
+ locale?: Intl.LocalesArgument;
39
+ /** The moment the clock shows, in epoch ms. Defaults to now, re-read on each minute (or second). */
40
+ now?: number;
41
+ /** The Pomodoro cycle's lengths, merged over 25 / 5 / 15 minutes and 4 rounds; `false` leaves the Pomodoro out. */
42
+ pomodoro?: Partial<PomodoroSettings2> | false;
43
+ /** The Pomodoro run (controlled); `null` shows the clock. */
44
+ value?: PomodoroRun2 | null;
45
+ /** The run at first (uncontrolled). Defaults to `null`. */
46
+ defaultValue?: PomodoroRun2 | null;
47
+ /** Called with the run a start, pause, resume, skip, +1 min or reset leaves (`null` after a reset). */
48
+ onValueChange?: (run: PomodoroRun2 | null) => void;
49
+ /** Called when a phase reaches zero, with the next one, which waits paused to be started: show `Clock.PhaseDone`. */
50
+ onPhaseEnd?: (ended: PomodoroRun2, next: PomodoroRun2) => void;
51
+ /** Classes for the root, which fills its container. */
52
+ className?: string;
53
+ }
54
+ /** The first focus round, running from now. */
55
+ declare function startPomodoro2(pomodoro?: Partial<PomodoroSettings2>): PomodoroRun2;
56
+ /** The phase after `run`, paused at its whole length until it is started: what a phase reaching zero leaves. */
57
+ declare function advancePomodoro2(run: PomodoroRun2, pomodoro?: Partial<PomodoroSettings2>): PomodoroRun2;
58
+ /** `run` running from now, from the time it had left. */
59
+ declare function resumePomodoro2(run: PomodoroRun2): PomodoroRun2;
60
+ interface PartProps {
61
+ /** The Pomodoro run; without one the part shows nothing. */
62
+ run?: PomodoroRun2 | null;
63
+ }
64
+ type Element_12xgc = JSX_1kxb["Element"];
65
+ /** The compact island's left wing: the ring of the phase's time left. */
66
+ declare function ClockLeading2({ run }: PartProps): Element_12xgc | null;
67
+ /** The compact island's right wing: the phase's time left as `mm:ss`, muted while paused. */
68
+ declare function ClockTrailing2({ run }: PartProps): Element_12xgc | null;
69
+ /** The split island's bubble: the ring of the phase's time left. */
70
+ declare function ClockMinimal2({ run }: PartProps): Element_12xgc | null;
71
+ interface ClockPhaseDoneProps2 {
72
+ /** The phase that reached zero. */
73
+ ended: Pick<PomodoroRun2, "phase" | "round">;
74
+ /** The cycle's lengths, as given to the Clock. */
75
+ pomodoro?: Partial<PomodoroSettings2>;
76
+ /** Called by the button that starts the next phase; without it the button hides. */
77
+ onStart?: () => void;
78
+ }
79
+ /** The island's flash when a phase reaches zero: "Focus done — break time" or "Break over", and a button to start the next. */
80
+ declare function ClockPhaseDone2({ ended, pomodoro, onStart }: ClockPhaseDoneProps2): Element_12xgc;
81
+ /**
82
+ * A notch app's clock: the time as the hero, the date above it, the world
83
+ * clocks beside it, and a Pomodoro cycle that takes over while it runs.
84
+ *
85
+ * The time is set large in hours and minutes (`seconds` adds them, muted,
86
+ * and a tick on each second), on the locale's clock or the one `hour12`
87
+ * picks, with the time zone's name under it and the date on the line above.
88
+ * Beside it, past a hairline, the world clocks (`zones`): each city's time,
89
+ * how far it is from here (`−6h`), whether it's day or night there, and
90
+ * `Tomorrow` or `Yesterday` when its date differs. Nothing ticks between
91
+ * minutes; `now` pins the moment.
92
+ *
93
+ * Under the time the Pomodoro waits with its lengths (`pomodoro`: focus,
94
+ * short and long break in minutes, and the rounds before the long one) and
95
+ * a Start focus button. A run takes the widget over: the phase's ring in
96
+ * its hue (focus warm, a break green) as the picture, the time left as the
97
+ * hero, its round (`Focus 2 of 4`), when it ends and what comes next, and
98
+ * the next phases with their start times beside it. Pause / resume is the
99
+ * main action, with +1 min and skip beside it and reset at the top.
100
+ *
101
+ * The run is a value (`value` / `onValueChange`, or kept here from
102
+ * `defaultValue`): a running phase carries when it ends, a paused one the
103
+ * time it had left, so a host can persist it and pick it up after a
104
+ * reload. When a phase reaches zero the next one waits paused at its whole
105
+ * length and `onPhaseEnd` is called; the helpers `startPomodoro`,
106
+ * `advancePomodoro` and `resumePomodoro` build the same runs for a host
107
+ * that keeps time itself.
108
+ *
109
+ * The other forms are parts: `Clock.Leading` and `Clock.Trailing` for the
110
+ * compact island's wings (the ring and `mm:ss`, nothing without a run),
111
+ * `Clock.Minimal`, the ring, for the split island's bubble, and
112
+ * `Clock.PhaseDone`, the flash at a phase's end with a button to start the
113
+ * next.
114
+ *
115
+ * @example {@include ./examples.mdx}
116
+ */
117
+ declare const Clock2: (({ zones, seconds, hour12, timeZone, locale, now: nowProp, pomodoro, value, defaultValue, onValueChange, onPhaseEnd, className }: ClockProps2) => Element_12xgc) & {
118
+ Leading: typeof ClockLeading2;
119
+ Trailing: typeof ClockTrailing2;
120
+ Minimal: typeof ClockMinimal2;
121
+ PhaseDone: typeof ClockPhaseDone2;
122
+ };
123
+ export { PomodoroPhase2, PomodoroSettings2, PomodoroRun2, ClockZone2, ClockProps2, startPomodoro2, advancePomodoro2, resumePomodoro2, ClockLeading2, ClockTrailing2, ClockMinimal2, ClockPhaseDoneProps2, ClockPhaseDone2, Clock2 };
@@ -10,7 +10,7 @@ import Sidebar from "@justanarthur/modo-ui/components/navigation/sidebar";
10
10
  import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
11
11
  import { cn } from "@justanarthur/modo-ui/lib/utils";
12
12
  import ScrollArea from "@justanarthur/modo-ui/primitives/layout/scroll-area";
13
- import { Info, Puzzle, Settings2, ShieldCheck } from "lucide-react";
13
+ import { ChevronRight, Info, Puzzle, Settings2, ShieldCheck } from "lucide-react";
14
14
  import { jsx, jsxs } from "react/jsx-runtime";
15
15
  /*!
16
16
  * Local addition: a notch app's settings window. Rebuilt from Just Notch's
@@ -95,7 +95,7 @@ function General({ preferences, onChange }) {
95
95
  ]
96
96
  });
97
97
  }
98
- function Plugins({ plugins, enabled, onChange }) {
98
+ function Plugins({ plugins, enabled, onChange, onOpen }) {
99
99
  return /* @__PURE__ */ jsx(Page, {
100
100
  title: "Plugins",
101
101
  lead: "Each plugin adds activities and widgets to the island.",
@@ -108,7 +108,7 @@ function Plugins({ plugins, enabled, onChange }) {
108
108
  aside: `${plugins.filter((p) => enabled[p.id] ?? true).length} on`,
109
109
  children: plugins.map((plugin) => {
110
110
  const Icon = plugin.icon ?? Puzzle;
111
- return /* @__PURE__ */ jsx(List.Row, {
111
+ return /* @__PURE__ */ jsxs(List.Row, {
112
112
  label: /* @__PURE__ */ jsxs("span", {
113
113
  className: "flex min-w-0 items-center gap-2",
114
114
  children: [
@@ -124,12 +124,21 @@ function Plugins({ plugins, enabled, onChange }) {
124
124
  ]
125
125
  }),
126
126
  description: plugin.description,
127
- children: /* @__PURE__ */ jsx(Switch, {
128
- "aria-label": plugin.name,
129
- className: LIST_SWITCH,
130
- checked: enabled[plugin.id] ?? true,
131
- onCheckedChange: (on) => onChange({ ...enabled, [plugin.id]: on })
132
- })
127
+ children: [
128
+ plugin.settings !== undefined && /* @__PURE__ */ jsx(Button, {
129
+ variant: "ghost",
130
+ size: "icon",
131
+ "aria-label": `${plugin.name} settings`,
132
+ onClick: () => onOpen(plugin.id),
133
+ children: /* @__PURE__ */ jsx(ChevronRight, {})
134
+ }),
135
+ /* @__PURE__ */ jsx(Switch, {
136
+ "aria-label": plugin.name,
137
+ className: LIST_SWITCH,
138
+ checked: enabled[plugin.id] ?? true,
139
+ onCheckedChange: (on) => onChange({ ...enabled, [plugin.id]: on })
140
+ })
141
+ ]
133
142
  }, plugin.id);
134
143
  })
135
144
  })
@@ -281,7 +290,8 @@ function SettingsWindow2({
281
290
  page === "plugins" && /* @__PURE__ */ jsx(Plugins, {
282
291
  plugins,
283
292
  enabled,
284
- onChange: setEnabled
293
+ onChange: setEnabled,
294
+ onOpen: (id) => setPage(`plugin:${id}`)
285
295
  }),
286
296
  page === "permissions" && /* @__PURE__ */ jsx(Permissions, {
287
297
  permissions,