@justanarthur/modo-ui-notch 0.2.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 (148) hide show
  1. package/README.md +11 -11
  2. package/blocks/activities/agenda/examples.mdx +29 -5
  3. package/blocks/activities/agenda/index.tsx +438 -181
  4. package/blocks/activities/clock/examples.mdx +89 -0
  5. package/blocks/activities/clock/index.tsx +917 -0
  6. package/blocks/activities/now-playing/examples.mdx +40 -13
  7. package/blocks/activities/now-playing/index.tsx +399 -120
  8. package/blocks/activities/weather/examples.mdx +123 -0
  9. package/blocks/activities/weather/index.tsx +863 -0
  10. package/blocks/app/expanded-island/examples.mdx +8 -7
  11. package/blocks/app/expanded-island/index.tsx +22 -4
  12. package/blocks/app/settings-window/examples.mdx +14 -2
  13. package/blocks/app/settings-window/index.tsx +33 -10
  14. package/blocks/system/clipboard/examples.mdx +91 -0
  15. package/blocks/system/clipboard/index.tsx +773 -0
  16. package/blocks/system/recent-files/examples.mdx +80 -0
  17. package/blocks/system/recent-files/index.tsx +627 -0
  18. package/blocks/system/system-stats/examples.mdx +46 -9
  19. package/blocks/system/system-stats/index.tsx +445 -104
  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 +465 -0
  29. package/dist/blocks/activities/agenda/index.d.ts +2 -1
  30. package/dist/blocks/activities/agenda/index.js +3 -3
  31. package/dist/blocks/activities/clock/index.d.ts +3 -0
  32. package/dist/blocks/activities/clock/index.js +25 -0
  33. package/dist/blocks/activities/now-playing/index.d.ts +4 -2
  34. package/dist/blocks/activities/now-playing/index.js +5 -3
  35. package/dist/blocks/activities/weather/index.d.ts +3 -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 +3 -0
  42. package/dist/blocks/system/clipboard/index.js +17 -0
  43. package/dist/blocks/system/recent-files/index.d.ts +3 -0
  44. package/dist/blocks/system/recent-files/index.js +19 -0
  45. package/dist/blocks/system/system-stats/index.d.ts +3 -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 +32 -0
  56. package/dist/index.d.ts +15 -15
  57. package/dist/index.js +104 -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-yngkkxz2.d.ts → chunk-0ym9mcqc.d.ts} +10 -6
  62. package/dist/shared/chunk-2b6gpn8k.js +444 -0
  63. package/dist/shared/chunk-3hcnf4yx.js +481 -0
  64. package/dist/shared/chunk-42wab62s.d.ts +197 -0
  65. package/dist/shared/{chunk-zvh0d3qb.js → chunk-61t2dfte.js} +1 -1
  66. package/dist/shared/{chunk-9nhpg9t8.d.ts → chunk-6tnq6p89.d.ts} +9 -1
  67. package/dist/shared/{chunk-hpsabfsd.d.ts → chunk-81fpptwp.d.ts} +1 -1
  68. package/dist/shared/chunk-93dtpjz7.js +789 -0
  69. package/dist/shared/{chunk-wwjxs75m.js → chunk-9xtcv3sy.js} +26 -12
  70. package/dist/shared/chunk-a6njb8db.d.ts +129 -0
  71. package/dist/shared/chunk-ab8mdg0n.d.ts +149 -0
  72. package/dist/shared/chunk-evqpf92s.d.ts +168 -0
  73. package/dist/shared/{chunk-6c1jbefs.d.ts → chunk-fexwzycv.d.ts} +3 -3
  74. package/dist/shared/chunk-gcyspvgr.js +582 -0
  75. package/dist/shared/chunk-gejenfap.d.ts +25 -0
  76. package/dist/shared/chunk-gkj0hjrn.d.ts +136 -0
  77. package/dist/shared/{chunk-rr5e0g15.d.ts → chunk-j755a1a5.d.ts} +7 -1
  78. package/dist/shared/chunk-n739am8j.d.ts +112 -0
  79. package/dist/shared/{chunk-78w7qwp0.js → chunk-ndf79pv5.js} +1 -1
  80. package/dist/shared/chunk-nwzpekvy.js +774 -0
  81. package/dist/shared/{chunk-rpfwv3pz.js → chunk-r471sknr.js} +1 -1
  82. package/dist/shared/chunk-sbrtesdg.d.ts +138 -0
  83. package/dist/shared/chunk-swc7dqpw.d.ts +115 -0
  84. package/dist/shared/chunk-t9wqhgzt.js +765 -0
  85. package/dist/shared/chunk-w5h6ay93.js +72 -0
  86. package/dist/shared/{chunk-mp1nx0ez.js → chunk-wayv5rhr.js} +15 -4
  87. package/dist/shared/chunk-wf0jtzhs.js +295 -0
  88. package/dist/shared/{chunk-sbnrhy5m.js → chunk-y0188bbn.js} +2 -2
  89. package/dist/shared/chunk-yq5svpk7.js +524 -0
  90. package/dist/shared/{chunk-s33y1pcq.js → chunk-z3tj1ydg.js} +23 -10
  91. package/dist/styles.css +151 -49
  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 +113 -0
  98. package/mock/clock.tsx +77 -0
  99. package/mock/data.ts +78 -44
  100. package/mock/files.tsx +83 -0
  101. package/mock/island-content.tsx +79 -122
  102. package/mock/screen.tsx +76 -0
  103. package/mock/settings.tsx +370 -91
  104. package/mock/system.ts +49 -0
  105. package/mock/weather.tsx +135 -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,524 @@
1
+ "use client";
2
+
3
+ import {
4
+ IslandFlash2
5
+ } from "./chunk-ndf79pv5.js";
6
+ import {
7
+ widget_default
8
+ } from "./chunk-wf0jtzhs.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 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;
37
+ var time = (ms, locale) => new Date(ms).toLocaleTimeString(locale, { hour: "numeric", minute: "2-digit" });
38
+ function timeParts(ms, locale) {
39
+ const parts = new Intl.DateTimeFormat(locale, { hour: "numeric", minute: "2-digit" }).formatToParts(ms);
40
+ const period = parts.find((part) => part.type === "dayPeriod")?.value;
41
+ const value = parts.filter((part) => part.type !== "dayPeriod").map((part) => part.value).join("").trim();
42
+ return { value, period };
43
+ }
44
+ var range = (event, locale) => `${time(event.start, locale)} – ${time(event.end, locale)}`;
45
+ function length(ms) {
46
+ const minutes = Math.round(ms / MINUTE2);
47
+ if (minutes < 60)
48
+ return `${minutes} min`;
49
+ const hours = Math.floor(minutes / 60);
50
+ return minutes % 60 ? `${hours} h ${minutes % 60} min` : `${hours} h`;
51
+ }
52
+ function useUntil(start, unit = MINUTE2) {
53
+ const now = useEdgeClock2(start, Date.now() < start + SECOND2, unit);
54
+ return start - now;
55
+ }
56
+ function Dot({ color, className }) {
57
+ return /* @__PURE__ */ jsx("span", {
58
+ "aria-hidden": true,
59
+ className: cn("size-2.5 shrink-0 rounded-full", className),
60
+ style: { backgroundColor: color }
61
+ });
62
+ }
63
+ function Join({
64
+ event,
65
+ size,
66
+ onJoin
67
+ }) {
68
+ return /* @__PURE__ */ jsx(Button, {
69
+ variant: "primary",
70
+ size,
71
+ leadingIcon: Video,
72
+ onClick: () => onJoin?.(event),
73
+ children: "Join"
74
+ });
75
+ }
76
+ function When({ event, now, midnight, locale }) {
77
+ if (event.start <= now)
78
+ return /* @__PURE__ */ jsx(widget_default.Figure, {
79
+ value: "Now",
80
+ unit: `${length(event.end - now)} left`
81
+ });
82
+ if (event.start - now < 60 * MINUTE2)
83
+ return /* @__PURE__ */ jsx(widget_default.Figure, {
84
+ prefix: "in",
85
+ value: Math.max(1, Math.ceil((event.start - now) / MINUTE2)),
86
+ unit: "min"
87
+ });
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";
90
+ return /* @__PURE__ */ jsx(widget_default.Figure, {
91
+ prefix,
92
+ value,
93
+ unit: period
94
+ });
95
+ }
96
+ function Hero({ event, now, midnight, locale, onJoin }) {
97
+ return /* @__PURE__ */ jsxs("div", {
98
+ className: "flex min-w-0 flex-col gap-1.5",
99
+ children: [
100
+ /* @__PURE__ */ jsxs("div", {
101
+ className: "flex min-w-0 items-end justify-between gap-3",
102
+ children: [
103
+ /* @__PURE__ */ jsx(When, {
104
+ event,
105
+ now,
106
+ midnight,
107
+ locale
108
+ }),
109
+ event.meetingUrl && /* @__PURE__ */ jsx(Join, {
110
+ event,
111
+ size: "compact",
112
+ onJoin
113
+ })
114
+ ]
115
+ }),
116
+ /* @__PURE__ */ jsxs("div", {
117
+ className: "flex min-w-0 flex-col gap-0.5",
118
+ children: [
119
+ /* @__PURE__ */ jsx(widget_default.Title, {
120
+ leading: /* @__PURE__ */ jsx(Dot, {
121
+ color: event.color
122
+ }),
123
+ children: event.title
124
+ }),
125
+ /* @__PURE__ */ jsxs(widget_default.Meta, {
126
+ className: "pl-4.5",
127
+ children: [
128
+ /* @__PURE__ */ jsx(widget_default.MetaItem, {
129
+ icon: Clock,
130
+ children: range(event, locale)
131
+ }),
132
+ event.meetingUrl && /* @__PURE__ */ jsx(widget_default.MetaItem, {
133
+ icon: Video,
134
+ children: "Video call"
135
+ }),
136
+ event.location && /* @__PURE__ */ jsx(widget_default.MetaItem, {
137
+ icon: MapPin,
138
+ children: event.location
139
+ })
140
+ ]
141
+ })
142
+ ]
143
+ })
144
+ ]
145
+ });
146
+ }
147
+ function Rows({ events, locale }) {
148
+ return events.map((event) => /* @__PURE__ */ jsx(widget_default.Row, {
149
+ leading: time(event.start, locale),
150
+ color: event.color,
151
+ trailing: event.meetingUrl ? /* @__PURE__ */ jsx(Video, {
152
+ size: 12,
153
+ strokeWidth: 1.5,
154
+ "aria-label": "Video call"
155
+ }) : event.location && /* @__PURE__ */ jsx("span", {
156
+ className: "max-w-24 truncate",
157
+ children: event.location
158
+ }),
159
+ children: event.title
160
+ }, event.id));
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
+ }
239
+ function More({ count }) {
240
+ if (count <= 0)
241
+ return null;
242
+ return /* @__PURE__ */ jsxs("span", {
243
+ className: "flex h-6 items-center pl-17.5 text-caption text-muted-foreground",
244
+ children: [
245
+ count,
246
+ " more"
247
+ ]
248
+ });
249
+ }
250
+ function AgendaLeading2({ event }) {
251
+ return /* @__PURE__ */ jsx(CalendarDays, {
252
+ size: 16,
253
+ strokeWidth: 1.5,
254
+ style: { color: event.color }
255
+ });
256
+ }
257
+ function AgendaTrailing2({ event }) {
258
+ const left = useUntil(event.start);
259
+ return /* @__PURE__ */ jsxs("span", {
260
+ className: "flex items-center gap-1 text-caption weight-semibold text-foreground tabular-nums",
261
+ children: [
262
+ /* @__PURE__ */ jsx(Dot, {
263
+ color: event.color,
264
+ className: "size-1.5"
265
+ }),
266
+ left > 0 ? formatShort2(left / SECOND2) : "now"
267
+ ]
268
+ });
269
+ }
270
+ var RING = 2 * Math.PI * 8;
271
+ function AgendaMinimal2({ event, lead = 10 * MINUTE2 }) {
272
+ const left = Math.max(0, useUntil(event.start, SECOND2));
273
+ const share = Math.min(1, left / lead);
274
+ return /* @__PURE__ */ jsxs("svg", {
275
+ role: "img",
276
+ "aria-label": `${event.title}, in ${formatShort2(left / SECOND2)}`,
277
+ viewBox: "0 0 20 20",
278
+ className: "size-5.5 -rotate-90",
279
+ children: [
280
+ /* @__PURE__ */ jsx("circle", {
281
+ cx: "10",
282
+ cy: "10",
283
+ r: "8",
284
+ fill: "none",
285
+ strokeWidth: "2.5",
286
+ className: "stroke-current text-border"
287
+ }),
288
+ /* @__PURE__ */ jsx("circle", {
289
+ cx: "10",
290
+ cy: "10",
291
+ r: "8",
292
+ fill: "none",
293
+ strokeWidth: "2.5",
294
+ strokeLinecap: "round",
295
+ strokeDasharray: RING,
296
+ strokeDashoffset: RING * (1 - share),
297
+ style: { stroke: event.color }
298
+ })
299
+ ]
300
+ });
301
+ }
302
+ function AgendaUpNext2({ event, locale, onJoin }) {
303
+ const now = event.start - useUntil(event.start);
304
+ return /* @__PURE__ */ jsx(widget_default, {
305
+ children: /* @__PURE__ */ jsx(Hero, {
306
+ event,
307
+ now,
308
+ midnight: new Date(now).setHours(24, 0, 0, 0),
309
+ locale,
310
+ onJoin
311
+ })
312
+ });
313
+ }
314
+ function AgendaStarting2({ event, onJoin }) {
315
+ const left = useUntil(event.start, SECOND2);
316
+ const when = left > 0 ? `Starts in ${formatShort2(left / SECOND2)}` : "Starting now";
317
+ return /* @__PURE__ */ jsx(IslandFlash2, {
318
+ icon: /* @__PURE__ */ jsx("span", {
319
+ className: "flex size-9 items-center justify-center rounded-lg",
320
+ style: { color: event.color, backgroundColor: `color-mix(in oklab, ${event.color} 22%, transparent)` },
321
+ children: event.meetingUrl ? /* @__PURE__ */ jsx(Video, {
322
+ size: 16,
323
+ strokeWidth: 1.5
324
+ }) : /* @__PURE__ */ jsx(CalendarDays, {
325
+ size: 16,
326
+ strokeWidth: 1.5
327
+ })
328
+ }),
329
+ title: event.title,
330
+ caption: event.location ? `${when} · ${event.location}` : when,
331
+ action: event.meetingUrl && /* @__PURE__ */ jsx(Join, {
332
+ event,
333
+ size: "compact",
334
+ onJoin
335
+ })
336
+ });
337
+ }
338
+ var Agenda2 = Object.assign(function Agenda({
339
+ events,
340
+ access = "granted",
341
+ now: nowProp,
342
+ locale,
343
+ tomorrowOpen: tomorrowOpenProp,
344
+ defaultTomorrowOpen = false,
345
+ onTomorrowOpenChange,
346
+ onRequestAccess,
347
+ onOpenSettings,
348
+ onJoin,
349
+ layout = "fit",
350
+ className
351
+ }) {
352
+ const ticking = useEdgeClock2(0, nowProp === undefined, MINUTE2);
353
+ const now = nowProp ?? ticking;
354
+ const [tomorrowOpen, setTomorrowOpen] = useControllableState(tomorrowOpenProp, defaultTomorrowOpen, onTomorrowOpenChange);
355
+ if (access === "undetermined")
356
+ return /* @__PURE__ */ jsx(widget_default.Message, {
357
+ icon: CalendarDays,
358
+ title: "See what's next",
359
+ description: "Your next event with a countdown, and the rest of today and tomorrow.",
360
+ actions: /* @__PURE__ */ jsx(Button, {
361
+ variant: "primary",
362
+ size: "compact",
363
+ onClick: onRequestAccess,
364
+ children: "Connect calendar"
365
+ }),
366
+ className
367
+ });
368
+ if (access === "denied")
369
+ return /* @__PURE__ */ jsx(widget_default.Message, {
370
+ icon: Lock,
371
+ title: "Calendar access is off",
372
+ description: "Turn it on in System Settings › Privacy & Security › Calendars.",
373
+ actions: /* @__PURE__ */ jsx(Button, {
374
+ variant: "secondary",
375
+ size: "compact",
376
+ onClick: onOpenSettings,
377
+ children: "Open System Settings"
378
+ }),
379
+ className
380
+ });
381
+ const midnight = new Date(now).setHours(24, 0, 0, 0);
382
+ const next = new Date(midnight).setHours(24, 0, 0, 0);
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);
385
+ const allDay = live.filter((event) => event.allDay && event.start < midnight);
386
+ const timed = live.filter((event) => !event.allDay);
387
+ const [hero] = timed;
388
+ if (!hero)
389
+ return /* @__PURE__ */ jsx(widget_default.Message, {
390
+ icon: CalendarCheck,
391
+ title: allDay.length ? allDay.map((event) => event.title).join(", ") : "Nothing planned",
392
+ description: allDay.length ? "All day today; nothing else on the calendar." : "No more events today or tomorrow.",
393
+ className
394
+ });
395
+ const today = timed.filter((event) => event !== hero && event.start < midnight);
396
+ const tomorrow = timed.filter((event) => event !== hero && event.start >= midnight && event.start < next);
397
+ const tomorrowShown = tomorrowOpen ? tomorrow.slice(0, ROWS) : tomorrow.slice(0, 1);
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
+ }
468
+ return /* @__PURE__ */ jsxs(widget_default, {
469
+ className,
470
+ aside: /* @__PURE__ */ jsxs(Fragment, {
471
+ children: [
472
+ /* @__PURE__ */ jsxs(widget_default.Section, {
473
+ label: "Later today",
474
+ children: [
475
+ today.length ? /* @__PURE__ */ jsx(Rows, {
476
+ events: today.slice(0, ROWS),
477
+ locale
478
+ }) : /* @__PURE__ */ jsx("span", {
479
+ className: "flex h-7 items-center text-body text-muted-foreground",
480
+ children: "Nothing else today"
481
+ }),
482
+ /* @__PURE__ */ jsx(More, {
483
+ count: today.length - ROWS
484
+ })
485
+ ]
486
+ }),
487
+ tomorrow.length > 0 && /* @__PURE__ */ jsxs(widget_default.Section, {
488
+ className: "mt-1",
489
+ label: "Tomorrow",
490
+ trailing: tomorrow.length > 1 && /* @__PURE__ */ jsx(Button, {
491
+ variant: "ghost",
492
+ size: "compact",
493
+ className: "-mr-2 h-6 px-2",
494
+ "aria-expanded": tomorrowOpen,
495
+ trailingIcon: tomorrowOpen ? ChevronUp : ChevronDown,
496
+ onClick: () => setTomorrowOpen(!tomorrowOpen),
497
+ children: tomorrowOpen ? "Less" : `${tomorrow.length - 1} more`
498
+ }),
499
+ children: [
500
+ /* @__PURE__ */ jsx(Rows, {
501
+ events: tomorrowShown,
502
+ locale
503
+ }),
504
+ tomorrowOpen && /* @__PURE__ */ jsx(More, {
505
+ count: tomorrow.length - ROWS
506
+ })
507
+ ]
508
+ })
509
+ ]
510
+ }),
511
+ children: [
512
+ header,
513
+ heroBlock
514
+ ]
515
+ });
516
+ }, {
517
+ Leading: AgendaLeading2,
518
+ Trailing: AgendaTrailing2,
519
+ Minimal: AgendaMinimal2,
520
+ UpNext: AgendaUpNext2,
521
+ Starting: AgendaStarting2
522
+ });
523
+ var agenda_default = Agenda2;
524
+ export { AgendaLeading2, AgendaTrailing2, AgendaMinimal2, AgendaUpNext2, AgendaStarting2, Agenda2, agenda_default };
@@ -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
  })
@@ -210,6 +219,7 @@ function SettingsWindow2({
210
219
  permissions = [],
211
220
  onOpenPermission,
212
221
  about = [],
222
+ flush = false,
213
223
  className
214
224
  }) {
215
225
  const [page, setPage] = useControllableState(value, defaultValue, onValueChange);
@@ -232,6 +242,7 @@ function SettingsWindow2({
232
242
  children: /* @__PURE__ */ jsxs(Sidebar.Content, {
233
243
  children: [
234
244
  /* @__PURE__ */ jsxs(Sidebar.Group, {
245
+ className: cn(flush && "pl-0"),
235
246
  children: [
236
247
  /* @__PURE__ */ jsx(Sidebar.GroupLabel, {
237
248
  children: name
@@ -248,6 +259,7 @@ function SettingsWindow2({
248
259
  ]
249
260
  }),
250
261
  withSettings.length > 0 && /* @__PURE__ */ jsxs(Sidebar.Group, {
262
+ className: cn(flush && "pl-0"),
251
263
  children: [
252
264
  /* @__PURE__ */ jsx(Sidebar.GroupLabel, {
253
265
  children: "Plugin settings"
@@ -281,7 +293,8 @@ function SettingsWindow2({
281
293
  page === "plugins" && /* @__PURE__ */ jsx(Plugins, {
282
294
  plugins,
283
295
  enabled,
284
- onChange: setEnabled
296
+ onChange: setEnabled,
297
+ onOpen: (id) => setPage(`plugin:${id}`)
285
298
  }),
286
299
  page === "permissions" && /* @__PURE__ */ jsx(Permissions, {
287
300
  permissions,