@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.
- package/README.md +11 -11
- package/blocks/activities/agenda/examples.mdx +29 -5
- package/blocks/activities/agenda/index.tsx +438 -181
- package/blocks/activities/clock/examples.mdx +89 -0
- package/blocks/activities/clock/index.tsx +917 -0
- package/blocks/activities/now-playing/examples.mdx +40 -13
- package/blocks/activities/now-playing/index.tsx +399 -120
- package/blocks/activities/weather/examples.mdx +123 -0
- package/blocks/activities/weather/index.tsx +863 -0
- package/blocks/app/expanded-island/examples.mdx +8 -7
- package/blocks/app/expanded-island/index.tsx +22 -4
- package/blocks/app/settings-window/examples.mdx +14 -2
- package/blocks/app/settings-window/index.tsx +33 -10
- package/blocks/system/clipboard/examples.mdx +91 -0
- package/blocks/system/clipboard/index.tsx +773 -0
- package/blocks/system/recent-files/examples.mdx +80 -0
- package/blocks/system/recent-files/index.tsx +627 -0
- package/blocks/system/system-stats/examples.mdx +46 -9
- package/blocks/system/system-stats/index.tsx +445 -104
- package/components/indicators/media-scrubber/examples.mdx +8 -0
- package/components/indicators/media-scrubber/index.tsx +37 -13
- package/components/island/island/examples.mdx +4 -4
- package/components/island/island/index.tsx +2 -2
- package/components/island/island-flash/examples.mdx +15 -18
- package/components/island/island-flash/index.tsx +4 -4
- package/components/island/island-tabs/examples.mdx +5 -5
- package/components/island/widget/examples.mdx +76 -0
- package/components/island/widget/index.tsx +465 -0
- package/dist/blocks/activities/agenda/index.d.ts +2 -1
- package/dist/blocks/activities/agenda/index.js +3 -3
- package/dist/blocks/activities/clock/index.d.ts +3 -0
- package/dist/blocks/activities/clock/index.js +25 -0
- package/dist/blocks/activities/now-playing/index.d.ts +4 -2
- package/dist/blocks/activities/now-playing/index.js +5 -3
- package/dist/blocks/activities/weather/index.d.ts +3 -0
- package/dist/blocks/activities/weather/index.js +21 -0
- package/dist/blocks/app/expanded-island/index.d.ts +1 -1
- package/dist/blocks/app/expanded-island/index.js +4 -3
- package/dist/blocks/app/settings-window/index.d.ts +1 -1
- package/dist/blocks/app/settings-window/index.js +1 -1
- package/dist/blocks/system/clipboard/index.d.ts +3 -0
- package/dist/blocks/system/clipboard/index.js +17 -0
- package/dist/blocks/system/recent-files/index.d.ts +3 -0
- package/dist/blocks/system/recent-files/index.js +19 -0
- package/dist/blocks/system/system-stats/index.d.ts +3 -2
- package/dist/blocks/system/system-stats/index.js +4 -1
- package/dist/components/indicators/media-scrubber/index.d.ts +1 -1
- package/dist/components/indicators/media-scrubber/index.js +1 -1
- package/dist/components/island/island/index.d.ts +1 -1
- package/dist/components/island/island/index.js +2 -2
- package/dist/components/island/island-flash/index.d.ts +1 -1
- package/dist/components/island/island-flash/index.js +1 -1
- package/dist/components/island/island-tabs/index.js +2 -2
- package/dist/components/island/widget/index.d.ts +2 -0
- package/dist/components/island/widget/index.js +32 -0
- package/dist/index.d.ts +15 -15
- package/dist/index.js +104 -58
- package/dist/lib/artwork.d.ts +2 -0
- package/dist/lib/artwork.js +8 -0
- package/dist/lib/geometry.js +1 -1
- package/dist/shared/{chunk-yngkkxz2.d.ts → chunk-0ym9mcqc.d.ts} +10 -6
- package/dist/shared/chunk-2b6gpn8k.js +444 -0
- package/dist/shared/chunk-3hcnf4yx.js +481 -0
- package/dist/shared/chunk-42wab62s.d.ts +197 -0
- package/dist/shared/{chunk-zvh0d3qb.js → chunk-61t2dfte.js} +1 -1
- package/dist/shared/{chunk-9nhpg9t8.d.ts → chunk-6tnq6p89.d.ts} +9 -1
- package/dist/shared/{chunk-hpsabfsd.d.ts → chunk-81fpptwp.d.ts} +1 -1
- package/dist/shared/chunk-93dtpjz7.js +789 -0
- package/dist/shared/{chunk-wwjxs75m.js → chunk-9xtcv3sy.js} +26 -12
- package/dist/shared/chunk-a6njb8db.d.ts +129 -0
- package/dist/shared/chunk-ab8mdg0n.d.ts +149 -0
- package/dist/shared/chunk-evqpf92s.d.ts +168 -0
- package/dist/shared/{chunk-6c1jbefs.d.ts → chunk-fexwzycv.d.ts} +3 -3
- package/dist/shared/chunk-gcyspvgr.js +582 -0
- package/dist/shared/chunk-gejenfap.d.ts +25 -0
- package/dist/shared/chunk-gkj0hjrn.d.ts +136 -0
- package/dist/shared/{chunk-rr5e0g15.d.ts → chunk-j755a1a5.d.ts} +7 -1
- package/dist/shared/chunk-n739am8j.d.ts +112 -0
- package/dist/shared/{chunk-78w7qwp0.js → chunk-ndf79pv5.js} +1 -1
- package/dist/shared/chunk-nwzpekvy.js +774 -0
- package/dist/shared/{chunk-rpfwv3pz.js → chunk-r471sknr.js} +1 -1
- package/dist/shared/chunk-sbrtesdg.d.ts +138 -0
- package/dist/shared/chunk-swc7dqpw.d.ts +115 -0
- package/dist/shared/chunk-t9wqhgzt.js +765 -0
- package/dist/shared/chunk-w5h6ay93.js +72 -0
- package/dist/shared/{chunk-mp1nx0ez.js → chunk-wayv5rhr.js} +15 -4
- package/dist/shared/chunk-wf0jtzhs.js +295 -0
- package/dist/shared/{chunk-sbnrhy5m.js → chunk-y0188bbn.js} +2 -2
- package/dist/shared/chunk-yq5svpk7.js +524 -0
- package/dist/shared/{chunk-s33y1pcq.js → chunk-z3tj1ydg.js} +23 -10
- package/dist/styles.css +151 -49
- package/index.ts +7 -6
- package/lib/artwork.ts +112 -0
- package/lib/geometry.ts +1 -1
- package/mock/activities.tsx +9 -32
- package/mock/artwork.tsx +13 -1
- package/mock/clipboard.tsx +113 -0
- package/mock/clock.tsx +77 -0
- package/mock/data.ts +78 -44
- package/mock/files.tsx +83 -0
- package/mock/island-content.tsx +79 -122
- package/mock/screen.tsx +76 -0
- package/mock/settings.tsx +370 -91
- package/mock/system.ts +49 -0
- package/mock/weather.tsx +135 -0
- package/package.json +7 -2
- package/blocks/activities/shelf/examples.mdx +0 -33
- package/blocks/activities/shelf/index.tsx +0 -289
- package/blocks/activities/timer/examples.mdx +0 -52
- package/blocks/activities/timer/index.tsx +0 -292
- package/blocks/system/controls/examples.mdx +0 -34
- package/blocks/system/controls/index.tsx +0 -167
- package/blocks/system/devices/examples.mdx +0 -25
- package/blocks/system/devices/index.tsx +0 -172
- package/blocks/system/power-alert/examples.mdx +0 -32
- package/blocks/system/power-alert/index.tsx +0 -89
- package/components/indicators/battery-glyph/examples.mdx +0 -22
- package/components/indicators/battery-glyph/index.tsx +0 -91
- package/dist/blocks/activities/shelf/index.d.ts +0 -2
- package/dist/blocks/activities/shelf/index.js +0 -14
- package/dist/blocks/activities/timer/index.d.ts +0 -2
- package/dist/blocks/activities/timer/index.js +0 -19
- package/dist/blocks/system/controls/index.d.ts +0 -2
- package/dist/blocks/system/controls/index.js +0 -10
- package/dist/blocks/system/devices/index.d.ts +0 -2
- package/dist/blocks/system/devices/index.js +0 -12
- package/dist/blocks/system/power-alert/index.d.ts +0 -2
- package/dist/blocks/system/power-alert/index.js +0 -9
- package/dist/components/indicators/battery-glyph/index.d.ts +0 -2
- package/dist/components/indicators/battery-glyph/index.js +0 -9
- package/dist/shared/chunk-2qpcsv5h.d.ts +0 -45
- package/dist/shared/chunk-45gytfr1.d.ts +0 -84
- package/dist/shared/chunk-50ffk4r7.d.ts +0 -69
- package/dist/shared/chunk-5w0yck07.d.ts +0 -32
- package/dist/shared/chunk-7hr53mby.js +0 -116
- package/dist/shared/chunk-b8jb1w72.js +0 -145
- package/dist/shared/chunk-cpewy6yg.js +0 -178
- package/dist/shared/chunk-e3e4s4ds.d.ts +0 -77
- package/dist/shared/chunk-enm6td0p.js +0 -280
- package/dist/shared/chunk-fvedaas2.d.ts +0 -33
- package/dist/shared/chunk-gex38j8x.d.ts +0 -82
- package/dist/shared/chunk-hwtxpzg0.js +0 -69
- package/dist/shared/chunk-phb53x1f.js +0 -252
- package/dist/shared/chunk-r8esmjfs.d.ts +0 -42
- package/dist/shared/chunk-rcp1g9ca.js +0 -70
- package/dist/shared/chunk-rx9sphz2.js +0 -266
- package/dist/shared/chunk-xdeek16r.d.ts +0 -58
- package/dist/shared/chunk-xkzjk1tq.js +0 -206
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
SECOND2,
|
|
5
|
-
MINUTE2,
|
|
6
|
-
formatShort2,
|
|
7
|
-
useEdgeClock2
|
|
8
|
-
} from "./chunk-gb56m10p.js";
|
|
9
|
-
import {
|
|
10
|
-
Countdown2
|
|
11
|
-
} from "./chunk-502rmtap.js";
|
|
12
|
-
import {
|
|
13
|
-
IslandFlash2
|
|
14
|
-
} from "./chunk-78w7qwp0.js";
|
|
15
|
-
|
|
16
|
-
// blocks/activities/agenda/index.tsx
|
|
17
|
-
import Button from "@justanarthur/modo-ui/components/actions/button";
|
|
18
|
-
import EmptyState from "@justanarthur/modo-ui/components/feedback/empty-state";
|
|
19
|
-
import Meter from "@justanarthur/modo-ui/components/feedback/meter";
|
|
20
|
-
import { useSize } from "@justanarthur/modo-ui/lib/size-context";
|
|
21
|
-
import { cn } from "@justanarthur/modo-ui/lib/utils";
|
|
22
|
-
import { CalendarCheck, CalendarDays, Video } from "lucide-react";
|
|
23
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
-
/*!
|
|
25
|
-
* Local addition: a notch app's calendar, today's and tomorrow's events and
|
|
26
|
-
* the countdown to the next one. Rebuilt from Just Notch's calendar plugin
|
|
27
|
-
* (`Agenda`, `Upcoming`, `Starting`, `Ring`, `Countdown`) as presentational
|
|
28
|
-
* parts: events, access and actions come in as props.
|
|
29
|
-
*/
|
|
30
|
-
var clock = (ms, locale) => new Date(ms).toLocaleTimeString(locale, { hour: "numeric", minute: "2-digit" });
|
|
31
|
-
var span = (event, locale) => event.allDay ? "All day" : `${clock(event.start, locale)} – ${clock(event.end, locale)}`;
|
|
32
|
-
var meta = (event, locale) => event.location ? `${span(event, locale)} · ${event.location}` : span(event, locale);
|
|
33
|
-
function relative(ms) {
|
|
34
|
-
if (ms <= 0)
|
|
35
|
-
return "Now";
|
|
36
|
-
if (ms < MINUTE2)
|
|
37
|
-
return "In less than a minute";
|
|
38
|
-
return `In ${Math.ceil(ms / MINUTE2)} min`;
|
|
39
|
-
}
|
|
40
|
-
function useUntil(start, unit = MINUTE2) {
|
|
41
|
-
const now = useEdgeClock2(start, Date.now() < start + SECOND2, unit);
|
|
42
|
-
return start - now;
|
|
43
|
-
}
|
|
44
|
-
function Join({
|
|
45
|
-
event,
|
|
46
|
-
size,
|
|
47
|
-
onJoin
|
|
48
|
-
}) {
|
|
49
|
-
return /* @__PURE__ */ jsx(Button, {
|
|
50
|
-
variant: "secondary",
|
|
51
|
-
size,
|
|
52
|
-
leadingIcon: Video,
|
|
53
|
-
onClick: () => onJoin?.(event),
|
|
54
|
-
children: "Join"
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function AgendaLeading2({ event }) {
|
|
58
|
-
return /* @__PURE__ */ jsx(CalendarDays, {
|
|
59
|
-
size: 16,
|
|
60
|
-
strokeWidth: 1.5,
|
|
61
|
-
style: { color: event.color }
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function AgendaTrailing2({ event }) {
|
|
65
|
-
return /* @__PURE__ */ jsx("span", {
|
|
66
|
-
className: "text-caption weight-semibold",
|
|
67
|
-
style: { color: event.color },
|
|
68
|
-
children: /* @__PURE__ */ jsx(Countdown2, {
|
|
69
|
-
endsAt: event.start,
|
|
70
|
-
format: "short"
|
|
71
|
-
})
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function AgendaMinimal2({ event, lead = 10 * MINUTE2 }) {
|
|
75
|
-
const left = Math.max(0, useUntil(event.start, SECOND2));
|
|
76
|
-
return /* @__PURE__ */ jsx(Meter, {
|
|
77
|
-
variant: "ring",
|
|
78
|
-
label: `${event.title}, in ${formatShort2(left / SECOND2)}`,
|
|
79
|
-
value: Math.min(1, left / lead),
|
|
80
|
-
tone: "default",
|
|
81
|
-
animate: false,
|
|
82
|
-
className: "size-5.5"
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function AgendaUpNext2({ event, locale, onJoin }) {
|
|
86
|
-
const left = useUntil(event.start);
|
|
87
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
88
|
-
className: "flex size-full items-center gap-4",
|
|
89
|
-
children: [
|
|
90
|
-
/* @__PURE__ */ jsx("span", {
|
|
91
|
-
className: "h-14 w-1 shrink-0 rounded-full",
|
|
92
|
-
style: { backgroundColor: event.color }
|
|
93
|
-
}),
|
|
94
|
-
/* @__PURE__ */ jsxs("div", {
|
|
95
|
-
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
96
|
-
children: [
|
|
97
|
-
/* @__PURE__ */ jsx("span", {
|
|
98
|
-
className: "text-caption weight-semibold tabular-nums",
|
|
99
|
-
style: { color: event.color },
|
|
100
|
-
children: relative(left)
|
|
101
|
-
}),
|
|
102
|
-
/* @__PURE__ */ jsx("span", {
|
|
103
|
-
className: "truncate text-title weight-semibold text-foreground",
|
|
104
|
-
children: event.title
|
|
105
|
-
}),
|
|
106
|
-
/* @__PURE__ */ jsx("span", {
|
|
107
|
-
className: "truncate text-body text-muted-foreground",
|
|
108
|
-
children: meta(event, locale)
|
|
109
|
-
})
|
|
110
|
-
]
|
|
111
|
-
}),
|
|
112
|
-
event.meetingUrl && /* @__PURE__ */ jsx(Join, {
|
|
113
|
-
event,
|
|
114
|
-
size: "default",
|
|
115
|
-
onJoin
|
|
116
|
-
})
|
|
117
|
-
]
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function AgendaStarting2({ event, onJoin }) {
|
|
121
|
-
const left = useUntil(event.start, SECOND2);
|
|
122
|
-
return /* @__PURE__ */ jsx(IslandFlash2, {
|
|
123
|
-
icon: /* @__PURE__ */ jsx("span", {
|
|
124
|
-
className: "size-2.5 rounded-full",
|
|
125
|
-
style: { backgroundColor: event.color }
|
|
126
|
-
}),
|
|
127
|
-
title: event.title,
|
|
128
|
-
caption: relative(left),
|
|
129
|
-
action: event.meetingUrl && /* @__PURE__ */ jsx(Join, {
|
|
130
|
-
event,
|
|
131
|
-
size: "compact",
|
|
132
|
-
onJoin
|
|
133
|
-
})
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
function Row({
|
|
137
|
-
event,
|
|
138
|
-
locale,
|
|
139
|
-
onJoin
|
|
140
|
-
}) {
|
|
141
|
-
const size = useSize();
|
|
142
|
-
return /* @__PURE__ */ jsxs("li", {
|
|
143
|
-
className: cn("flex items-center gap-3", size.control),
|
|
144
|
-
children: [
|
|
145
|
-
/* @__PURE__ */ jsx("span", {
|
|
146
|
-
className: "size-2 shrink-0 rounded-full",
|
|
147
|
-
style: { backgroundColor: event.color }
|
|
148
|
-
}),
|
|
149
|
-
/* @__PURE__ */ jsx("span", {
|
|
150
|
-
className: "w-16 shrink-0 whitespace-nowrap text-caption tabular-nums text-muted-foreground",
|
|
151
|
-
children: event.allDay ? "All day" : clock(event.start, locale)
|
|
152
|
-
}),
|
|
153
|
-
/* @__PURE__ */ jsxs("span", {
|
|
154
|
-
className: "flex min-w-0 flex-1 items-baseline gap-2",
|
|
155
|
-
children: [
|
|
156
|
-
/* @__PURE__ */ jsx("span", {
|
|
157
|
-
className: "min-w-0 truncate text-body text-foreground",
|
|
158
|
-
children: event.title
|
|
159
|
-
}),
|
|
160
|
-
event.location && !event.meetingUrl && /* @__PURE__ */ jsx("span", {
|
|
161
|
-
className: "min-w-0 shrink-[100] truncate text-caption text-muted-foreground",
|
|
162
|
-
children: event.location
|
|
163
|
-
})
|
|
164
|
-
]
|
|
165
|
-
}),
|
|
166
|
-
event.meetingUrl && /* @__PURE__ */ jsx(Join, {
|
|
167
|
-
event,
|
|
168
|
-
size: "compact",
|
|
169
|
-
onJoin
|
|
170
|
-
})
|
|
171
|
-
]
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
function Day({ title, events, empty, locale, onJoin }) {
|
|
175
|
-
return /* @__PURE__ */ jsxs("section", {
|
|
176
|
-
"aria-label": title,
|
|
177
|
-
className: "flex min-w-0 flex-1 flex-col",
|
|
178
|
-
children: [
|
|
179
|
-
/* @__PURE__ */ jsx("h3", {
|
|
180
|
-
className: "m-0 flex h-5 items-center text-caption weight-normal text-muted-foreground",
|
|
181
|
-
children: title
|
|
182
|
-
}),
|
|
183
|
-
events.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
184
|
-
className: "m-0 flex h-9 items-center text-body text-muted-foreground",
|
|
185
|
-
children: empty
|
|
186
|
-
}) : /* @__PURE__ */ jsx("ul", {
|
|
187
|
-
className: "m-0 flex list-none flex-col p-0",
|
|
188
|
-
children: events.map((event) => /* @__PURE__ */ jsx(Row, {
|
|
189
|
-
event,
|
|
190
|
-
locale,
|
|
191
|
-
onJoin
|
|
192
|
-
}, event.id))
|
|
193
|
-
})
|
|
194
|
-
]
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
function Agenda2({
|
|
198
|
-
events,
|
|
199
|
-
access = "granted",
|
|
200
|
-
now: nowProp,
|
|
201
|
-
locale,
|
|
202
|
-
onRequestAccess,
|
|
203
|
-
onOpenSettings,
|
|
204
|
-
onJoin,
|
|
205
|
-
className
|
|
206
|
-
}) {
|
|
207
|
-
const ticking = useEdgeClock2(0, nowProp === undefined, MINUTE2);
|
|
208
|
-
const now = nowProp ?? ticking;
|
|
209
|
-
if (access === "undetermined")
|
|
210
|
-
return /* @__PURE__ */ jsx("div", {
|
|
211
|
-
className: cn("flex size-full items-center justify-center", className),
|
|
212
|
-
children: /* @__PURE__ */ jsx(EmptyState, {
|
|
213
|
-
size: "compact",
|
|
214
|
-
icon: CalendarDays,
|
|
215
|
-
title: "See what's next",
|
|
216
|
-
description: "Today's and tomorrow's events, with a countdown before each one starts.",
|
|
217
|
-
actions: /* @__PURE__ */ jsx(Button, {
|
|
218
|
-
variant: "primary",
|
|
219
|
-
size: "compact",
|
|
220
|
-
onClick: onRequestAccess,
|
|
221
|
-
children: "Connect calendar"
|
|
222
|
-
})
|
|
223
|
-
})
|
|
224
|
-
});
|
|
225
|
-
if (access === "denied")
|
|
226
|
-
return /* @__PURE__ */ jsx("div", {
|
|
227
|
-
className: cn("flex size-full items-center justify-center", className),
|
|
228
|
-
children: /* @__PURE__ */ jsx(EmptyState, {
|
|
229
|
-
size: "compact",
|
|
230
|
-
icon: CalendarDays,
|
|
231
|
-
title: "Calendar access is off",
|
|
232
|
-
description: "Turn it on in Privacy & Security › Calendars.",
|
|
233
|
-
actions: /* @__PURE__ */ jsx(Button, {
|
|
234
|
-
variant: "secondary",
|
|
235
|
-
size: "compact",
|
|
236
|
-
onClick: onOpenSettings,
|
|
237
|
-
children: "Open System Settings"
|
|
238
|
-
})
|
|
239
|
-
})
|
|
240
|
-
});
|
|
241
|
-
const midnight = new Date(now).setHours(24, 0, 0, 0);
|
|
242
|
-
const next = new Date(midnight).setHours(24, 0, 0, 0);
|
|
243
|
-
const live = events.filter((event) => event.end > now && event.start < next);
|
|
244
|
-
if (live.length === 0)
|
|
245
|
-
return /* @__PURE__ */ jsx("div", {
|
|
246
|
-
className: cn("flex size-full items-center justify-center", className),
|
|
247
|
-
children: /* @__PURE__ */ jsx(EmptyState, {
|
|
248
|
-
size: "compact",
|
|
249
|
-
icon: CalendarCheck,
|
|
250
|
-
title: "Nothing planned",
|
|
251
|
-
description: "No events for the rest of today or tomorrow."
|
|
252
|
-
})
|
|
253
|
-
});
|
|
254
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
255
|
-
className: cn("flex min-h-full gap-8", className),
|
|
256
|
-
children: [
|
|
257
|
-
/* @__PURE__ */ jsx(Day, {
|
|
258
|
-
title: "Today",
|
|
259
|
-
events: live.filter((event) => event.start < midnight),
|
|
260
|
-
empty: "Nothing else today",
|
|
261
|
-
locale,
|
|
262
|
-
onJoin
|
|
263
|
-
}),
|
|
264
|
-
/* @__PURE__ */ jsx(Day, {
|
|
265
|
-
title: "Tomorrow",
|
|
266
|
-
events: live.filter((event) => event.start >= midnight),
|
|
267
|
-
empty: "Nothing planned",
|
|
268
|
-
locale,
|
|
269
|
-
onJoin
|
|
270
|
-
})
|
|
271
|
-
]
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
Agenda2.Leading = AgendaLeading2;
|
|
275
|
-
Agenda2.Trailing = AgendaTrailing2;
|
|
276
|
-
Agenda2.Minimal = AgendaMinimal2;
|
|
277
|
-
Agenda2.UpNext = AgendaUpNext2;
|
|
278
|
-
Agenda2.Starting = AgendaStarting2;
|
|
279
|
-
var agenda_default = Agenda2;
|
|
280
|
-
export { AgendaLeading2, AgendaTrailing2, AgendaMinimal2, AgendaUpNext2, AgendaStarting2, Agenda2, agenda_default };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { JSX as JSX_1kxb } from "react";
|
|
2
|
-
type BatteryTone2 = "default" | "success" | "warning" | "error";
|
|
3
|
-
interface BatteryGlyphProps2 {
|
|
4
|
-
/** The charge, in percent (0 to 100). */
|
|
5
|
-
level: number;
|
|
6
|
-
/** A charger is connected: the bolt shows and the tone turns to success. Defaults to `false`. */
|
|
7
|
-
charging?: boolean;
|
|
8
|
-
/** The fill's hue. Defaults to success while charging, error at 10% and below, warning at 20% and below, else the text color. */
|
|
9
|
-
tone?: BatteryTone2;
|
|
10
|
-
/** Fill up from empty when it first shows, as a flash opens. Defaults to `true`. */
|
|
11
|
-
fillIn?: boolean;
|
|
12
|
-
/** What screen readers hear. Defaults to the level, and "charging" while it charges. */
|
|
13
|
-
label?: string;
|
|
14
|
-
/** Classes for the glyph. */
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
/** The tone a battery at `level` takes on its own. */
|
|
18
|
-
declare function batteryTone2(level: number, charging: boolean): BatteryTone2;
|
|
19
|
-
type Element_12xgc = JSX_1kxb["Element"];
|
|
20
|
-
/**
|
|
21
|
-
* A battery at a glance: a case that fills to the charge, a bolt while it
|
|
22
|
-
* charges.
|
|
23
|
-
*
|
|
24
|
-
* The fill turns to the success hue while charging and to the warning and
|
|
25
|
-
* error hues as the charge runs low, unless `tone` pins one. It fills up from
|
|
26
|
-
* empty when it first shows, on the slow spring, the way a power alert opens;
|
|
27
|
-
* a later change of level springs from where it was. A sliver always shows,
|
|
28
|
-
* so an empty battery still reads as one.
|
|
29
|
-
*
|
|
30
|
-
* @example {@include ./examples.mdx}
|
|
31
|
-
*/
|
|
32
|
-
declare function BatteryGlyph2({ level, charging, tone, fillIn, label, className }: BatteryGlyphProps2): Element_12xgc;
|
|
33
|
-
export { BatteryTone2, BatteryGlyphProps2, batteryTone2, BatteryGlyph2 };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { JSX as JSX_1kxb } from "react";
|
|
2
|
-
type AgendaAccess2 = "granted" | "undetermined" | "denied";
|
|
3
|
-
interface AgendaEvent2 {
|
|
4
|
-
id: string;
|
|
5
|
-
title: string;
|
|
6
|
-
/** When it starts, in epoch ms. */
|
|
7
|
-
start: number;
|
|
8
|
-
/** When it ends, in epoch ms. */
|
|
9
|
-
end: number;
|
|
10
|
-
allDay?: boolean;
|
|
11
|
-
location?: string;
|
|
12
|
-
/** A video call's link: the event gets a Join button. */
|
|
13
|
-
meetingUrl?: string;
|
|
14
|
-
/** Its calendar's color, any CSS color: data, so it paints the dot and the countdown inline. */
|
|
15
|
-
color: string;
|
|
16
|
-
}
|
|
17
|
-
interface AgendaProps2 {
|
|
18
|
-
/** The events, in start order. */
|
|
19
|
-
events: AgendaEvent2[];
|
|
20
|
-
/** Whether the calendar may be read: undetermined asks, denied points to the system's settings. Defaults to `'granted'`. */
|
|
21
|
-
access?: AgendaAccess2;
|
|
22
|
-
/** The moment the agenda is read at, in epoch ms. Defaults to now, re-read on each minute. */
|
|
23
|
-
now?: number;
|
|
24
|
-
/** Formats the times. Defaults to the browser's locale. */
|
|
25
|
-
locale?: Intl.LocalesArgument;
|
|
26
|
-
/** Called by Connect calendar while access is undetermined. */
|
|
27
|
-
onRequestAccess?: () => void;
|
|
28
|
-
/** Called by Open System Settings while access is denied. */
|
|
29
|
-
onOpenSettings?: () => void;
|
|
30
|
-
/** Called by an event's Join button. */
|
|
31
|
-
onJoin?: (event: AgendaEvent2) => void;
|
|
32
|
-
/** Classes for the root, which fills its container. */
|
|
33
|
-
className?: string;
|
|
34
|
-
}
|
|
35
|
-
interface PartProps {
|
|
36
|
-
/** The event the activity counts down to. */
|
|
37
|
-
event: AgendaEvent2;
|
|
38
|
-
}
|
|
39
|
-
type Element_12xgc = JSX_1kxb["Element"];
|
|
40
|
-
/** The compact island's left wing: the calendar glyph in the event's color. */
|
|
41
|
-
declare function AgendaLeading2({ event }: PartProps): Element_12xgc;
|
|
42
|
-
/** The compact island's right wing: the time until it starts, `4m` then `45s`. */
|
|
43
|
-
declare function AgendaTrailing2({ event }: PartProps): Element_12xgc;
|
|
44
|
-
interface MinimalProps extends PartProps {
|
|
45
|
-
/** How long before the start the countdown opens, in ms: the full ring. Defaults to 10 minutes. */
|
|
46
|
-
lead?: number;
|
|
47
|
-
}
|
|
48
|
-
/** The split island's bubble: a ring that empties as the start nears. */
|
|
49
|
-
declare function AgendaMinimal2({ event, lead }: MinimalProps): Element_12xgc;
|
|
50
|
-
interface ActivityProps extends PartProps {
|
|
51
|
-
/** Formats the times. Defaults to the browser's locale. */
|
|
52
|
-
locale?: Intl.LocalesArgument;
|
|
53
|
-
/** Called by the Join button, shown when the event has a `meetingUrl`. */
|
|
54
|
-
onJoin?: (event: AgendaEvent2) => void;
|
|
55
|
-
}
|
|
56
|
-
/** The open island's "Up next" view: how soon, the title, the time and place, and Join. */
|
|
57
|
-
declare function AgendaUpNext2({ event, locale, onJoin }: ActivityProps): Element_12xgc;
|
|
58
|
-
/** The island's flash a minute before the start: the title, how soon, and Join. */
|
|
59
|
-
declare function AgendaStarting2({ event, onJoin }: Omit<ActivityProps, "locale">): Element_12xgc;
|
|
60
|
-
/**
|
|
61
|
-
* A notch app's calendar: what's left of today and what's on tomorrow, side
|
|
62
|
-
* by side.
|
|
63
|
-
*
|
|
64
|
-
* Each event is a row with its calendar's color as a dot, its start time (or
|
|
65
|
-
* All day), its title and place, and a Join button when it has a video call.
|
|
66
|
-
* Events that have ended drop off; the day boundary is read from `now`, which
|
|
67
|
-
* follows the clock on each minute unless you pin it. Before the calendar may
|
|
68
|
-
* be read it asks to connect (`access="undetermined"`), and when access is
|
|
69
|
-
* off it points to the system's settings (`"denied"`).
|
|
70
|
-
*
|
|
71
|
-
* The countdown to the next event is an activity of parts:
|
|
72
|
-
* `Agenda.Leading` and `Agenda.Trailing` for the compact island's wings (the
|
|
73
|
-
* glyph in the event's color, and `4m` that turns to seconds in the last
|
|
74
|
-
* minute), `Agenda.Minimal`, a ring that empties toward the start, for the
|
|
75
|
-
* split island's bubble, `Agenda.UpNext` for the open island and
|
|
76
|
-
* `Agenda.Starting`, the flash a minute before. Each re-renders only on the
|
|
77
|
-
* edge of the unit it shows.
|
|
78
|
-
*
|
|
79
|
-
* @example {@include ./examples.mdx}
|
|
80
|
-
*/
|
|
81
|
-
declare function Agenda2({ events, access, now: nowProp, locale, onRequestAccess, onOpenSettings, onJoin, className }: AgendaProps2): Element_12xgc;
|
|
82
|
-
export { AgendaAccess2, AgendaEvent2, AgendaProps2, AgendaLeading2, AgendaTrailing2, AgendaMinimal2, AgendaUpNext2, AgendaStarting2, Agenda2 };
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// components/indicators/battery-glyph/index.tsx
|
|
4
|
-
import { useReduceMotion } from "@justanarthur/modo-ui/lib/reduced-motion";
|
|
5
|
-
import { spring } from "@justanarthur/modo-ui/lib/springs";
|
|
6
|
-
import { cn } from "@justanarthur/modo-ui/lib/utils";
|
|
7
|
-
import { motion } from "motion/react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
/*!
|
|
10
|
-
* Local addition: a battery that fills to its level, for a notch app's power
|
|
11
|
-
* alerts. Rebuilt from Just Notch's power plugin (`Battery`).
|
|
12
|
-
*/
|
|
13
|
-
var FILL = {
|
|
14
|
-
default: "bg-foreground",
|
|
15
|
-
success: "bg-status-success",
|
|
16
|
-
warning: "bg-status-warning",
|
|
17
|
-
error: "bg-status-error"
|
|
18
|
-
};
|
|
19
|
-
function batteryTone2(level, charging) {
|
|
20
|
-
if (charging)
|
|
21
|
-
return "success";
|
|
22
|
-
if (level <= 10)
|
|
23
|
-
return "error";
|
|
24
|
-
if (level <= 20)
|
|
25
|
-
return "warning";
|
|
26
|
-
return "default";
|
|
27
|
-
}
|
|
28
|
-
function BatteryGlyph2({
|
|
29
|
-
level,
|
|
30
|
-
charging = false,
|
|
31
|
-
tone,
|
|
32
|
-
fillIn = true,
|
|
33
|
-
label,
|
|
34
|
-
className
|
|
35
|
-
}) {
|
|
36
|
-
const reduced = useReduceMotion();
|
|
37
|
-
const share = Math.max(0.06, Math.min(1, level / 100));
|
|
38
|
-
const name = label ?? `${Math.round(level)}%${charging ? ", charging" : ""}`;
|
|
39
|
-
return /* @__PURE__ */ jsxs("span", {
|
|
40
|
-
role: "img",
|
|
41
|
-
"aria-label": name,
|
|
42
|
-
className: cn("inline-flex shrink-0 items-center gap-px", className),
|
|
43
|
-
children: [
|
|
44
|
-
/* @__PURE__ */ jsxs("span", {
|
|
45
|
-
className: "relative h-3.5 w-7 overflow-hidden rounded-box bg-active p-0.5",
|
|
46
|
-
children: [
|
|
47
|
-
/* @__PURE__ */ jsx(motion.span, {
|
|
48
|
-
className: cn("block h-full w-full origin-left rounded-glyph", FILL[tone ?? batteryTone2(level, charging)]),
|
|
49
|
-
initial: fillIn && !reduced ? { scaleX: 0 } : false,
|
|
50
|
-
animate: { scaleX: share },
|
|
51
|
-
transition: reduced ? { duration: 0 } : spring.slow
|
|
52
|
-
}),
|
|
53
|
-
charging && /* @__PURE__ */ jsx("svg", {
|
|
54
|
-
"aria-hidden": true,
|
|
55
|
-
viewBox: "0 0 24 24",
|
|
56
|
-
className: "absolute inset-0 m-auto size-3 fill-foreground",
|
|
57
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
58
|
-
d: "M13 2 4.5 13.5H11L10 22l8.5-11.5H12z"
|
|
59
|
-
})
|
|
60
|
-
})
|
|
61
|
-
]
|
|
62
|
-
}),
|
|
63
|
-
/* @__PURE__ */ jsx("span", {
|
|
64
|
-
className: "h-1.5 w-0.5 rounded-r-full bg-active"
|
|
65
|
-
})
|
|
66
|
-
]
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
export { batteryTone2, BatteryGlyph2 };
|