@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.
- package/README.md +11 -11
- package/blocks/activities/agenda/examples.mdx +21 -5
- package/blocks/activities/agenda/index.tsx +291 -182
- package/blocks/activities/clock/examples.mdx +73 -0
- package/blocks/activities/clock/index.tsx +619 -0
- package/blocks/activities/now-playing/examples.mdx +32 -13
- package/blocks/activities/now-playing/index.tsx +319 -126
- package/blocks/activities/weather/examples.mdx +115 -0
- package/blocks/activities/weather/index.tsx +634 -0
- package/blocks/app/expanded-island/examples.mdx +8 -7
- package/blocks/app/expanded-island/index.tsx +19 -3
- package/blocks/app/settings-window/examples.mdx +6 -2
- package/blocks/app/settings-window/index.tsx +25 -7
- package/blocks/system/clipboard/examples.mdx +83 -0
- package/blocks/system/clipboard/index.tsx +563 -0
- package/blocks/system/recent-files/examples.mdx +66 -0
- package/blocks/system/recent-files/index.tsx +542 -0
- package/blocks/system/system-stats/examples.mdx +38 -9
- package/blocks/system/system-stats/index.tsx +241 -107
- 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 +431 -0
- package/dist/blocks/activities/agenda/index.d.ts +1 -1
- package/dist/blocks/activities/agenda/index.js +3 -3
- package/dist/blocks/activities/clock/index.d.ts +2 -0
- package/dist/blocks/activities/clock/index.js +25 -0
- package/dist/blocks/activities/now-playing/index.d.ts +3 -2
- package/dist/blocks/activities/now-playing/index.js +5 -3
- package/dist/blocks/activities/weather/index.d.ts +2 -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 +2 -0
- package/dist/blocks/system/clipboard/index.js +17 -0
- package/dist/blocks/system/recent-files/index.d.ts +2 -0
- package/dist/blocks/system/recent-files/index.js +19 -0
- package/dist/blocks/system/system-stats/index.d.ts +2 -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 +30 -0
- package/dist/index.d.ts +15 -15
- package/dist/index.js +102 -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-2818esrq.d.ts +140 -0
- package/dist/shared/{chunk-yngkkxz2.d.ts → chunk-2m5dz8nf.d.ts} +4 -4
- package/dist/shared/chunk-3thgcfcq.d.ts +151 -0
- package/dist/shared/chunk-416tsgbc.d.ts +175 -0
- package/dist/shared/{chunk-zvh0d3qb.js → chunk-61t2dfte.js} +1 -1
- package/dist/shared/chunk-7fvnrtz4.d.ts +105 -0
- package/dist/shared/{chunk-hpsabfsd.d.ts → chunk-81fpptwp.d.ts} +1 -1
- package/dist/shared/chunk-9c7ewvkk.js +381 -0
- package/dist/shared/{chunk-mp1nx0ez.js → chunk-9m0xbg5v.js} +14 -3
- package/dist/shared/{chunk-wwjxs75m.js → chunk-9xtcv3sy.js} +26 -12
- package/dist/shared/chunk-bvtyjcce.d.ts +123 -0
- package/dist/shared/{chunk-s33y1pcq.js → chunk-cc9nwbtf.js} +20 -10
- package/dist/shared/chunk-da177e8r.d.ts +114 -0
- package/dist/shared/{chunk-6c1jbefs.d.ts → chunk-fexwzycv.d.ts} +3 -3
- package/dist/shared/chunk-gejenfap.d.ts +25 -0
- package/dist/shared/{chunk-rr5e0g15.d.ts → chunk-j755a1a5.d.ts} +7 -1
- package/dist/shared/chunk-j77cx8dp.js +498 -0
- package/dist/shared/chunk-mt0k6v8x.js +474 -0
- package/dist/shared/{chunk-78w7qwp0.js → chunk-ndf79pv5.js} +1 -1
- package/dist/shared/{chunk-9nhpg9t8.d.ts → chunk-pfhy5e4q.d.ts} +7 -1
- package/dist/shared/chunk-qdzemt2v.js +477 -0
- package/dist/shared/{chunk-rpfwv3pz.js → chunk-r471sknr.js} +1 -1
- package/dist/shared/chunk-s2jeqqan.js +243 -0
- package/dist/shared/chunk-t0hcxh89.d.ts +124 -0
- package/dist/shared/chunk-w5h6ay93.js +72 -0
- package/dist/shared/chunk-wkg17nxs.d.ts +101 -0
- package/dist/shared/chunk-x7f3g82r.js +285 -0
- package/dist/shared/chunk-xq5hc5gv.js +333 -0
- package/dist/shared/{chunk-sbnrhy5m.js → chunk-y0188bbn.js} +2 -2
- package/dist/shared/chunk-ym0xbses.js +518 -0
- package/dist/styles.css +97 -55
- 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 +79 -0
- package/mock/clock.tsx +77 -0
- package/mock/data.ts +30 -44
- package/mock/files.tsx +70 -0
- package/mock/island-content.tsx +43 -118
- package/mock/screen.tsx +76 -0
- package/mock/settings.tsx +370 -91
- package/mock/system.ts +46 -0
- package/mock/weather.tsx +105 -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,178 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// blocks/system/system-stats/index.tsx
|
|
4
|
-
import Sparkline from "@justanarthur/modo-ui/components/data-display/sparkline";
|
|
5
|
-
import { cn } from "@justanarthur/modo-ui/lib/utils";
|
|
6
|
-
import { ArrowDown, ArrowUp, Cpu, MemoryStick, Network } from "lucide-react";
|
|
7
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
8
|
-
/*!
|
|
9
|
-
* Local addition: a notch app's system load, CPU, memory and network as
|
|
10
|
-
* tiles with their trends. Rebuilt from Just Notch's stats plugin (`System`,
|
|
11
|
-
* `Tile`, `Measuring`, `CpuLoad`) on modo-ui's Sparkline: the samples come
|
|
12
|
-
* in as props.
|
|
13
|
-
*/
|
|
14
|
-
var percent = (v) => `${Math.round(v * 100)}%`;
|
|
15
|
-
var gigabytes = (bytes) => `${(bytes / 1e9).toFixed(1)} GB`;
|
|
16
|
-
function rate(bps) {
|
|
17
|
-
if (bps >= 1e6)
|
|
18
|
-
return `${(bps / 1e6).toFixed(1)} MB/s`;
|
|
19
|
-
if (bps >= 1000)
|
|
20
|
-
return `${Math.round(bps / 1000)} KB/s`;
|
|
21
|
-
return `${Math.round(bps)} B/s`;
|
|
22
|
-
}
|
|
23
|
-
function Tile({ icon: Icon, label, value, children }) {
|
|
24
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
25
|
-
className: "flex min-w-0 flex-col gap-2 rounded-xl bg-surface-2 p-3",
|
|
26
|
-
children: [
|
|
27
|
-
/* @__PURE__ */ jsxs("span", {
|
|
28
|
-
className: "flex items-center gap-1.5 text-caption text-muted-foreground",
|
|
29
|
-
children: [
|
|
30
|
-
/* @__PURE__ */ jsx(Icon, {
|
|
31
|
-
size: 14,
|
|
32
|
-
strokeWidth: 1.5
|
|
33
|
-
}),
|
|
34
|
-
label
|
|
35
|
-
]
|
|
36
|
-
}),
|
|
37
|
-
/* @__PURE__ */ jsx("div", {
|
|
38
|
-
className: "flex min-w-0 items-baseline gap-2 text-subtitle weight-semibold tabular-nums text-foreground",
|
|
39
|
-
children: value
|
|
40
|
-
}),
|
|
41
|
-
/* @__PURE__ */ jsx("div", {
|
|
42
|
-
className: "mt-auto",
|
|
43
|
-
children
|
|
44
|
-
})
|
|
45
|
-
]
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function Measuring({ className }) {
|
|
49
|
-
const tiles = [
|
|
50
|
-
{ icon: Cpu, label: "CPU" },
|
|
51
|
-
{ icon: MemoryStick, label: "Memory" },
|
|
52
|
-
{ icon: Network, label: "Network" }
|
|
53
|
-
];
|
|
54
|
-
return /* @__PURE__ */ jsx("div", {
|
|
55
|
-
className: cn("grid size-full grid-cols-3 content-center gap-3", className),
|
|
56
|
-
"aria-busy": true,
|
|
57
|
-
children: tiles.map(({ icon, label }) => /* @__PURE__ */ jsx(Tile, {
|
|
58
|
-
icon,
|
|
59
|
-
label,
|
|
60
|
-
value: /* @__PURE__ */ jsx("span", {
|
|
61
|
-
className: "text-muted-foreground",
|
|
62
|
-
children: "–"
|
|
63
|
-
}),
|
|
64
|
-
children: /* @__PURE__ */ jsx(Sparkline, {
|
|
65
|
-
values: [],
|
|
66
|
-
label: `${label}, measuring`,
|
|
67
|
-
className: "h-10"
|
|
68
|
-
})
|
|
69
|
-
}, label))
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function SystemStatsLeading2() {
|
|
73
|
-
return /* @__PURE__ */ jsx(Cpu, {
|
|
74
|
-
size: 16,
|
|
75
|
-
strokeWidth: 1.5,
|
|
76
|
-
className: "text-muted-foreground"
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
function SystemStatsTrailing2({ sample }) {
|
|
80
|
-
if (!sample)
|
|
81
|
-
return /* @__PURE__ */ jsx("span", {
|
|
82
|
-
className: "text-caption weight-semibold text-muted-foreground",
|
|
83
|
-
children: "–"
|
|
84
|
-
});
|
|
85
|
-
return /* @__PURE__ */ jsx("span", {
|
|
86
|
-
className: "text-caption weight-semibold tabular-nums text-foreground",
|
|
87
|
-
children: percent(sample.cpu)
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function SystemStats2({ samples, className }) {
|
|
91
|
-
const last = samples.at(-1);
|
|
92
|
-
if (!last)
|
|
93
|
-
return /* @__PURE__ */ jsx(Measuring, {
|
|
94
|
-
className
|
|
95
|
-
});
|
|
96
|
-
const cpu = samples.map((s) => s.cpu);
|
|
97
|
-
const memory = samples.map((s) => s.memoryUsed);
|
|
98
|
-
const netIn = samples.map((s) => s.netIn);
|
|
99
|
-
const netOut = samples.map((s) => s.netOut);
|
|
100
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
101
|
-
className: cn("grid size-full grid-cols-3 content-center gap-3", className),
|
|
102
|
-
children: [
|
|
103
|
-
/* @__PURE__ */ jsx(Tile, {
|
|
104
|
-
icon: Cpu,
|
|
105
|
-
label: "CPU",
|
|
106
|
-
value: percent(last.cpu),
|
|
107
|
-
children: /* @__PURE__ */ jsx(Sparkline, {
|
|
108
|
-
values: cpu,
|
|
109
|
-
max: 1,
|
|
110
|
-
label: `CPU, ${percent(last.cpu)}`,
|
|
111
|
-
className: "h-10"
|
|
112
|
-
})
|
|
113
|
-
}),
|
|
114
|
-
/* @__PURE__ */ jsx(Tile, {
|
|
115
|
-
icon: MemoryStick,
|
|
116
|
-
label: "Memory",
|
|
117
|
-
value: /* @__PURE__ */ jsxs(Fragment, {
|
|
118
|
-
children: [
|
|
119
|
-
gigabytes(last.memoryUsed),
|
|
120
|
-
/* @__PURE__ */ jsxs("span", {
|
|
121
|
-
className: "truncate text-caption weight-normal text-muted-foreground",
|
|
122
|
-
children: [
|
|
123
|
-
"of ",
|
|
124
|
-
gigabytes(last.memoryTotal)
|
|
125
|
-
]
|
|
126
|
-
})
|
|
127
|
-
]
|
|
128
|
-
}),
|
|
129
|
-
children: /* @__PURE__ */ jsx(Sparkline, {
|
|
130
|
-
values: memory,
|
|
131
|
-
max: last.memoryTotal,
|
|
132
|
-
label: `Memory, ${gigabytes(last.memoryUsed)}`,
|
|
133
|
-
className: "h-10"
|
|
134
|
-
})
|
|
135
|
-
}),
|
|
136
|
-
/* @__PURE__ */ jsx(Tile, {
|
|
137
|
-
icon: Network,
|
|
138
|
-
label: "Network",
|
|
139
|
-
value: /* @__PURE__ */ jsxs(Fragment, {
|
|
140
|
-
children: [
|
|
141
|
-
/* @__PURE__ */ jsxs("span", {
|
|
142
|
-
className: "flex items-center gap-0.5",
|
|
143
|
-
children: [
|
|
144
|
-
/* @__PURE__ */ jsx(ArrowDown, {
|
|
145
|
-
size: 12,
|
|
146
|
-
strokeWidth: 2,
|
|
147
|
-
"aria-label": "In"
|
|
148
|
-
}),
|
|
149
|
-
rate(last.netIn)
|
|
150
|
-
]
|
|
151
|
-
}),
|
|
152
|
-
/* @__PURE__ */ jsxs("span", {
|
|
153
|
-
className: "flex min-w-0 items-center gap-0.5 truncate text-caption weight-normal text-muted-foreground",
|
|
154
|
-
children: [
|
|
155
|
-
/* @__PURE__ */ jsx(ArrowUp, {
|
|
156
|
-
size: 12,
|
|
157
|
-
strokeWidth: 2,
|
|
158
|
-
"aria-label": "Out"
|
|
159
|
-
}),
|
|
160
|
-
rate(last.netOut)
|
|
161
|
-
]
|
|
162
|
-
})
|
|
163
|
-
]
|
|
164
|
-
}),
|
|
165
|
-
children: /* @__PURE__ */ jsx(Sparkline, {
|
|
166
|
-
values: netIn,
|
|
167
|
-
secondary: netOut,
|
|
168
|
-
label: `Network, ${rate(last.netIn)} in, ${rate(last.netOut)} out`,
|
|
169
|
-
className: "h-10"
|
|
170
|
-
})
|
|
171
|
-
})
|
|
172
|
-
]
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
SystemStats2.Leading = SystemStatsLeading2;
|
|
176
|
-
SystemStats2.Trailing = SystemStatsTrailing2;
|
|
177
|
-
var system_stats_default = SystemStats2;
|
|
178
|
-
export { SystemStatsLeading2, SystemStatsTrailing2, SystemStats2, system_stats_default };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { JSX as JSX_1kxb } from "react";
|
|
2
|
-
type TimerKind2 = "focus" | "break" | "custom";
|
|
3
|
-
/** A run: running while it has `endsAt`, paused while it has `remaining`. */
|
|
4
|
-
interface TimerRun2 {
|
|
5
|
-
kind: TimerKind2;
|
|
6
|
-
/** Its whole length, in ms. */
|
|
7
|
-
total: number;
|
|
8
|
-
/** When it ends, in epoch ms, while it runs. */
|
|
9
|
-
endsAt?: number;
|
|
10
|
-
/** The time left, in ms, while it is paused. */
|
|
11
|
-
remaining?: number;
|
|
12
|
-
}
|
|
13
|
-
interface TimerProps2 {
|
|
14
|
-
/** The run (controlled); `null` shows the picker. */
|
|
15
|
-
value?: TimerRun2 | null;
|
|
16
|
-
/** The run at first (uncontrolled). Defaults to `null`. */
|
|
17
|
-
defaultValue?: TimerRun2 | null;
|
|
18
|
-
/** Called with the run a start, pause, resume, +1 min or cancel leaves, and `null` when it ends. */
|
|
19
|
-
onValueChange?: (run: TimerRun2 | null) => void;
|
|
20
|
-
/** Called when a run reaches zero, with the kind that starts next in a Pomodoro cycle. */
|
|
21
|
-
onEnd?: (run: TimerRun2, next?: TimerKind2) => void;
|
|
22
|
-
/** The picker's quick lengths, in minutes, before the Pomodoro preset. Defaults to `[1, 5, 10]`. */
|
|
23
|
-
presets?: number[];
|
|
24
|
-
/** Pomodoro cycles: when a focus run ends a break starts on its own, then focus again. Defaults to `false`. */
|
|
25
|
-
pomodoro?: boolean;
|
|
26
|
-
/** A focus run's length, in minutes. Defaults to `25`. */
|
|
27
|
-
focusMinutes?: number;
|
|
28
|
-
/** A break's length, in minutes. Defaults to `5`. */
|
|
29
|
-
breakMinutes?: number;
|
|
30
|
-
/** Classes for the root, which fills its container. */
|
|
31
|
-
className?: string;
|
|
32
|
-
}
|
|
33
|
-
type Element_12xgc = JSX_1kxb["Element"];
|
|
34
|
-
/** The compact island's left wing: the timer's glyph. */
|
|
35
|
-
declare function TimerLeading2(): Element_12xgc;
|
|
36
|
-
/** The compact island's right wing: the time left, muted while paused. */
|
|
37
|
-
declare function TimerTrailing2({ run }: {
|
|
38
|
-
run: TimerRun2;
|
|
39
|
-
}): Element_12xgc;
|
|
40
|
-
/** The split island's bubble: a ring of the time left. */
|
|
41
|
-
declare function TimerMinimal2({ run }: {
|
|
42
|
-
run: TimerRun2;
|
|
43
|
-
}): Element_12xgc;
|
|
44
|
-
interface TimerDoneProps2 {
|
|
45
|
-
/** The run that ended. Defaults to `'custom'`. */
|
|
46
|
-
kind?: TimerKind2;
|
|
47
|
-
/** The kind a Pomodoro cycle starts next. */
|
|
48
|
-
next?: TimerKind2;
|
|
49
|
-
/** The next run's length, in minutes. */
|
|
50
|
-
minutes?: number;
|
|
51
|
-
}
|
|
52
|
-
/** The island's flash when a run reaches zero: "Time's up", and what starts next in a Pomodoro cycle. */
|
|
53
|
-
declare function TimerDone2({ kind, next, minutes }: TimerDoneProps2): Element_12xgc;
|
|
54
|
-
/**
|
|
55
|
-
* A notch app's timer: pick a length, watch it run down, hear when it's up.
|
|
56
|
-
*
|
|
57
|
-
* Without a run it shows the picker: quick lengths (`presets`), a Pomodoro
|
|
58
|
-
* focus run and a custom length in minutes on a NumberInput. A run shows a
|
|
59
|
-
* Meter ring of the time left beside the time itself in display type, with
|
|
60
|
-
* +1 min, pause / resume and cancel. The run is a value (`value` /
|
|
61
|
-
* `onValueChange`, or kept here from `defaultValue`): a running one carries
|
|
62
|
-
* when it ends, a paused one the time it had left, so a host can persist it
|
|
63
|
-
* and resume after a reload. The time re-renders once a second, on the
|
|
64
|
-
* second's edge, and nothing runs while it is paused.
|
|
65
|
-
*
|
|
66
|
-
* At zero it calls `onEnd` and clears the run, unless `pomodoro` cycles:
|
|
67
|
-
* then a focus run hands over to a break and a break back to focus.
|
|
68
|
-
*
|
|
69
|
-
* The other forms are parts: `Timer.Leading` and `Timer.Trailing` for the
|
|
70
|
-
* compact island's wings (the glyph and the time left), `Timer.Minimal` for
|
|
71
|
-
* the split island's bubble (the ring) and `Timer.Done`, the "Time's up"
|
|
72
|
-
* flash.
|
|
73
|
-
*
|
|
74
|
-
* @example {@include ./examples.mdx}
|
|
75
|
-
*/
|
|
76
|
-
declare function Timer2({ value, defaultValue, onValueChange, onEnd, presets, pomodoro, focusMinutes, breakMinutes, className }: TimerProps2): Element_12xgc;
|
|
77
|
-
export { TimerKind2, TimerRun2, TimerProps2, TimerLeading2, TimerTrailing2, TimerMinimal2, TimerDoneProps2, TimerDone2, Timer2 };
|
|
@@ -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 };
|