@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
|
@@ -0,0 +1,789 @@
|
|
|
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
|
+
formatClock2,
|
|
13
|
+
useEdgeClock2
|
|
14
|
+
} from "./chunk-gb56m10p.js";
|
|
15
|
+
|
|
16
|
+
// blocks/activities/clock/index.tsx
|
|
17
|
+
import Button from "@justanarthur/modo-ui/components/actions/button";
|
|
18
|
+
import Meter from "@justanarthur/modo-ui/components/feedback/meter";
|
|
19
|
+
import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
|
|
20
|
+
import { cn } from "@justanarthur/modo-ui/lib/utils";
|
|
21
|
+
import {
|
|
22
|
+
CalendarDays,
|
|
23
|
+
Check,
|
|
24
|
+
Clock3,
|
|
25
|
+
Coffee,
|
|
26
|
+
Moon,
|
|
27
|
+
Pause,
|
|
28
|
+
Play,
|
|
29
|
+
Plus,
|
|
30
|
+
Repeat,
|
|
31
|
+
RotateCcw,
|
|
32
|
+
SkipForward,
|
|
33
|
+
Sun,
|
|
34
|
+
Target,
|
|
35
|
+
Timer
|
|
36
|
+
} from "lucide-react";
|
|
37
|
+
import { useEffect } from "react";
|
|
38
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
39
|
+
/*!
|
|
40
|
+
* Local addition: a notch app's clock, the time, the date and a few world
|
|
41
|
+
* clocks, with a Pomodoro cycle that takes the widget over while it runs.
|
|
42
|
+
* The run is a value the host may own and persist.
|
|
43
|
+
*/
|
|
44
|
+
var DEFAULTS = { focus: 25, shortBreak: 5, longBreak: 15, rounds: 4 };
|
|
45
|
+
var RING = {
|
|
46
|
+
focus: "[&_circle:last-child]:text-status-warning",
|
|
47
|
+
"short-break": "[&_circle:last-child]:text-status-success",
|
|
48
|
+
"long-break": "[&_circle:last-child]:text-status-success"
|
|
49
|
+
};
|
|
50
|
+
var DOT = {
|
|
51
|
+
focus: "bg-status-warning",
|
|
52
|
+
"short-break": "bg-status-success",
|
|
53
|
+
"long-break": "bg-status-success"
|
|
54
|
+
};
|
|
55
|
+
var TILE = {
|
|
56
|
+
focus: "bg-status-warning/16 text-status-warning",
|
|
57
|
+
"short-break": "bg-status-success/16 text-status-success",
|
|
58
|
+
"long-break": "bg-status-success/16 text-status-success"
|
|
59
|
+
};
|
|
60
|
+
var MARK = {
|
|
61
|
+
focus: "var(--status-warning)",
|
|
62
|
+
"short-break": "var(--status-success)",
|
|
63
|
+
"long-break": "var(--status-success)"
|
|
64
|
+
};
|
|
65
|
+
var WASH = {
|
|
66
|
+
focus: "bg-status-warning/16",
|
|
67
|
+
"short-break": "bg-status-success/16",
|
|
68
|
+
"long-break": "bg-status-success/16"
|
|
69
|
+
};
|
|
70
|
+
var GLYPH = { focus: Target, "short-break": Coffee, "long-break": Coffee };
|
|
71
|
+
var PHASES = ["focus", "short-break", "long-break"];
|
|
72
|
+
var settingsOf = (pomodoro) => ({
|
|
73
|
+
...DEFAULTS,
|
|
74
|
+
...pomodoro || {}
|
|
75
|
+
});
|
|
76
|
+
var lengthOf = (phase, settings) => (phase === "focus" ? settings.focus : phase === "short-break" ? settings.shortBreak : settings.longBreak) * MINUTE2;
|
|
77
|
+
function following(run, settings) {
|
|
78
|
+
if (run.phase === "focus")
|
|
79
|
+
return { phase: run.round >= settings.rounds ? "long-break" : "short-break", round: run.round };
|
|
80
|
+
return { phase: "focus", round: run.phase === "long-break" ? 1 : run.round + 1 };
|
|
81
|
+
}
|
|
82
|
+
function startPomodoro2(pomodoro) {
|
|
83
|
+
const total = lengthOf("focus", settingsOf(pomodoro));
|
|
84
|
+
return { phase: "focus", round: 1, total, endsAt: Date.now() + total };
|
|
85
|
+
}
|
|
86
|
+
function advancePomodoro2(run, pomodoro) {
|
|
87
|
+
const settings = settingsOf(pomodoro);
|
|
88
|
+
const next = following(run, settings);
|
|
89
|
+
const total = lengthOf(next.phase, settings);
|
|
90
|
+
return { ...next, total, remaining: total };
|
|
91
|
+
}
|
|
92
|
+
function resumePomodoro2(run) {
|
|
93
|
+
return { phase: run.phase, round: run.round, total: run.total, endsAt: Date.now() + (run.remaining ?? run.total) };
|
|
94
|
+
}
|
|
95
|
+
var pause = (run, left) => ({
|
|
96
|
+
phase: run.phase,
|
|
97
|
+
round: run.round,
|
|
98
|
+
total: run.total,
|
|
99
|
+
remaining: left
|
|
100
|
+
});
|
|
101
|
+
var addMinute = (run) => run.endsAt === undefined ? { ...run, total: run.total + MINUTE2, remaining: (run.remaining ?? run.total) + MINUTE2 } : { ...run, total: run.total + MINUTE2, endsAt: run.endsAt + MINUTE2 };
|
|
102
|
+
function useLeft(run) {
|
|
103
|
+
const end = run.endsAt ?? 0;
|
|
104
|
+
const now = useEdgeClock2(end, run.endsAt !== undefined && Date.now() < end + SECOND2);
|
|
105
|
+
return run.endsAt === undefined ? run.remaining ?? run.total : Math.max(0, end - now);
|
|
106
|
+
}
|
|
107
|
+
function cycleOf(settings) {
|
|
108
|
+
return Array.from({ length: settings.rounds }, (_, i) => [
|
|
109
|
+
{ phase: "focus", round: i + 1 },
|
|
110
|
+
{ phase: i + 1 === settings.rounds ? "long-break" : "short-break", round: i + 1 }
|
|
111
|
+
]).flat();
|
|
112
|
+
}
|
|
113
|
+
var indexIn = (run, settings) => Math.min(settings.rounds * 2 - 1, (run.round - 1) * 2 + (run.phase === "focus" ? 0 : 1));
|
|
114
|
+
function minutesLabel(minutes) {
|
|
115
|
+
const h = Math.floor(minutes / 60);
|
|
116
|
+
const m = minutes % 60;
|
|
117
|
+
if (!h)
|
|
118
|
+
return `${m} min`;
|
|
119
|
+
return m ? `${h} h ${m} min` : `${h} h`;
|
|
120
|
+
}
|
|
121
|
+
function phaseName(run, rounds) {
|
|
122
|
+
if (run.phase === "focus")
|
|
123
|
+
return `Focus ${run.round} of ${rounds}`;
|
|
124
|
+
return run.phase === "long-break" ? "Long break" : "Short break";
|
|
125
|
+
}
|
|
126
|
+
function timeParts(ms, { locale, hour12, timeZone, seconds }) {
|
|
127
|
+
const parts = new Intl.DateTimeFormat(locale, {
|
|
128
|
+
hour: "numeric",
|
|
129
|
+
minute: "2-digit",
|
|
130
|
+
second: seconds ? "2-digit" : undefined,
|
|
131
|
+
hour12,
|
|
132
|
+
timeZone
|
|
133
|
+
}).formatToParts(ms);
|
|
134
|
+
const period = parts.find((part) => part.type === "dayPeriod")?.value;
|
|
135
|
+
const text = parts.filter((part) => part.type !== "dayPeriod").map((part) => part.value).join("").trim();
|
|
136
|
+
return { text, period };
|
|
137
|
+
}
|
|
138
|
+
var shortTime = (ms, options) => new Date(ms).toLocaleTimeString(options.locale, {
|
|
139
|
+
hour: "numeric",
|
|
140
|
+
minute: "2-digit",
|
|
141
|
+
hour12: options.hour12,
|
|
142
|
+
timeZone: options.timeZone
|
|
143
|
+
});
|
|
144
|
+
function offsetOf(ms, timeZone) {
|
|
145
|
+
if (!timeZone)
|
|
146
|
+
return -new Date(ms).getTimezoneOffset();
|
|
147
|
+
const name = new Intl.DateTimeFormat("en-US", { timeZone, timeZoneName: "longOffset" }).formatToParts(ms).find((part) => part.type === "timeZoneName")?.value;
|
|
148
|
+
const match = name?.match(/([+-])(\d{2}):(\d{2})/);
|
|
149
|
+
if (!match)
|
|
150
|
+
return 0;
|
|
151
|
+
const minutes = Number(match[2]) * 60 + Number(match[3]);
|
|
152
|
+
return match[1] === "-" ? -minutes : minutes;
|
|
153
|
+
}
|
|
154
|
+
function offsetLabel(minutes) {
|
|
155
|
+
if (minutes === 0)
|
|
156
|
+
return "Same time";
|
|
157
|
+
const sign = minutes > 0 ? "+" : "−";
|
|
158
|
+
const h = Math.floor(Math.abs(minutes) / 60);
|
|
159
|
+
const m = Math.abs(minutes) % 60;
|
|
160
|
+
return m ? `${sign}${h}:${String(m).padStart(2, "0")}` : `${sign}${h}h`;
|
|
161
|
+
}
|
|
162
|
+
var dayKey = (ms, timeZone) => new Intl.DateTimeFormat("en-CA", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" }).format(ms);
|
|
163
|
+
var hourIn = (ms, timeZone) => Number(new Intl.DateTimeFormat("en-US", { timeZone, hour: "numeric", hourCycle: "h23" }).format(ms));
|
|
164
|
+
function zoneFacts(zone, now, timeZone) {
|
|
165
|
+
const there = dayKey(now, zone.timeZone);
|
|
166
|
+
const here = dayKey(now, timeZone);
|
|
167
|
+
const hour = hourIn(now, zone.timeZone);
|
|
168
|
+
return {
|
|
169
|
+
day: there > here ? "Tomorrow" : there < here ? "Yesterday" : undefined,
|
|
170
|
+
offset: offsetLabel(offsetOf(now, zone.timeZone) - offsetOf(now, timeZone)),
|
|
171
|
+
DayGlyph: hour >= 6 && hour < 18 ? Sun : Moon
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function ZoneRow({ zone, now, locale, hour12, timeZone }) {
|
|
175
|
+
const { day, offset, DayGlyph } = zoneFacts(zone, now, timeZone);
|
|
176
|
+
return /* @__PURE__ */ jsx(widget_default.Row, {
|
|
177
|
+
leading: shortTime(now, { locale, hour12, timeZone: zone.timeZone }),
|
|
178
|
+
trailing: /* @__PURE__ */ jsxs(Fragment, {
|
|
179
|
+
children: [
|
|
180
|
+
day && /* @__PURE__ */ jsxs("span", {
|
|
181
|
+
children: [
|
|
182
|
+
day,
|
|
183
|
+
" ·"
|
|
184
|
+
]
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ jsx("span", {
|
|
187
|
+
className: "tabular-nums",
|
|
188
|
+
children: offset
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ jsx(DayGlyph, {
|
|
191
|
+
size: 12,
|
|
192
|
+
strokeWidth: 1.5,
|
|
193
|
+
"aria-label": DayGlyph === Sun ? "Day" : "Night",
|
|
194
|
+
className: "ml-1"
|
|
195
|
+
})
|
|
196
|
+
]
|
|
197
|
+
}),
|
|
198
|
+
children: zone.city
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function ZoneTile({ zone, now, locale, hour12, timeZone }) {
|
|
202
|
+
const { day, offset, DayGlyph } = zoneFacts(zone, now, timeZone);
|
|
203
|
+
const time = timeParts(now, { locale, hour12, timeZone: zone.timeZone });
|
|
204
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
205
|
+
className: "flex min-w-0 flex-col gap-0.5 px-5 first:pl-0 last:pr-0",
|
|
206
|
+
children: [
|
|
207
|
+
/* @__PURE__ */ jsx("span", {
|
|
208
|
+
className: "truncate text-body text-foreground",
|
|
209
|
+
children: zone.city
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ jsxs("span", {
|
|
212
|
+
className: "flex items-baseline gap-1 whitespace-nowrap tabular-nums",
|
|
213
|
+
children: [
|
|
214
|
+
/* @__PURE__ */ jsx("span", {
|
|
215
|
+
className: "text-title weight-semibold text-foreground",
|
|
216
|
+
children: time.text
|
|
217
|
+
}),
|
|
218
|
+
time.period && /* @__PURE__ */ jsx("span", {
|
|
219
|
+
className: "text-caption text-muted-foreground",
|
|
220
|
+
children: time.period
|
|
221
|
+
})
|
|
222
|
+
]
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ jsxs("span", {
|
|
225
|
+
className: "flex min-w-0 items-center gap-1.5 text-caption text-muted-foreground",
|
|
226
|
+
children: [
|
|
227
|
+
/* @__PURE__ */ jsx(DayGlyph, {
|
|
228
|
+
size: 12,
|
|
229
|
+
strokeWidth: 1.5,
|
|
230
|
+
"aria-label": DayGlyph === Sun ? "Day" : "Night",
|
|
231
|
+
className: "shrink-0"
|
|
232
|
+
}),
|
|
233
|
+
/* @__PURE__ */ jsxs("span", {
|
|
234
|
+
className: "truncate tabular-nums",
|
|
235
|
+
children: [
|
|
236
|
+
day ?? "Today",
|
|
237
|
+
", ",
|
|
238
|
+
offset
|
|
239
|
+
]
|
|
240
|
+
})
|
|
241
|
+
]
|
|
242
|
+
})
|
|
243
|
+
]
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function WorldClocks({ zones, ...rest }) {
|
|
247
|
+
return /* @__PURE__ */ jsx(widget_default.Section, {
|
|
248
|
+
label: "World clock",
|
|
249
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
250
|
+
className: "grid auto-cols-fr grid-flow-col divide-x divide-border pt-1",
|
|
251
|
+
children: zones.map((zone) => /* @__PURE__ */ jsx(ZoneTile, {
|
|
252
|
+
zone,
|
|
253
|
+
...rest
|
|
254
|
+
}, zone.timeZone + zone.city))
|
|
255
|
+
})
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function CycleStrip({ settings, at = -1, progress = 0 }) {
|
|
259
|
+
return /* @__PURE__ */ jsx("div", {
|
|
260
|
+
"aria-hidden": true,
|
|
261
|
+
className: "flex h-1.5 w-full gap-1",
|
|
262
|
+
children: cycleOf(settings).map((step, i) => /* @__PURE__ */ jsx("span", {
|
|
263
|
+
className: cn("relative basis-0 overflow-hidden rounded-full", i < at ? DOT[step.phase] : WASH[step.phase]),
|
|
264
|
+
style: { flexGrow: lengthOf(step.phase, settings) },
|
|
265
|
+
children: i === at && /* @__PURE__ */ jsx("span", {
|
|
266
|
+
className: cn("absolute inset-y-0 left-0", DOT[step.phase]),
|
|
267
|
+
style: { width: `${progress * 100}%` }
|
|
268
|
+
})
|
|
269
|
+
}, `${step.phase}-${step.round}`))
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
function Today({ completed, settings }) {
|
|
273
|
+
const slots = Math.min(24, Math.max(1, Math.ceil(completed / settings.rounds)) * settings.rounds);
|
|
274
|
+
return /* @__PURE__ */ jsx(widget_default.Section, {
|
|
275
|
+
label: "Today",
|
|
276
|
+
trailing: /* @__PURE__ */ jsxs("span", {
|
|
277
|
+
className: "tabular-nums",
|
|
278
|
+
children: [
|
|
279
|
+
completed,
|
|
280
|
+
" ",
|
|
281
|
+
completed === 1 ? "round" : "rounds",
|
|
282
|
+
" · ",
|
|
283
|
+
minutesLabel(completed * settings.focus),
|
|
284
|
+
" focused"
|
|
285
|
+
]
|
|
286
|
+
}),
|
|
287
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
288
|
+
className: "flex flex-wrap items-center gap-1.5 py-1",
|
|
289
|
+
children: Array.from({ length: slots }, (_, slot) => slot).map((slot) => /* @__PURE__ */ jsx("span", {
|
|
290
|
+
"aria-hidden": true,
|
|
291
|
+
className: cn("size-2.5 rounded-full", slot < completed ? DOT.focus : WASH.focus)
|
|
292
|
+
}, slot))
|
|
293
|
+
})
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function PhaseRing({ run, rounds = DEFAULTS.rounds, className }) {
|
|
297
|
+
const left = useLeft(run);
|
|
298
|
+
return /* @__PURE__ */ jsx(Meter, {
|
|
299
|
+
variant: "ring",
|
|
300
|
+
label: `${phaseName(run, rounds)}, ${formatClock2(Math.ceil(left / SECOND2))} left`,
|
|
301
|
+
value: run.total ? left / run.total : 0,
|
|
302
|
+
tone: "default",
|
|
303
|
+
animate: false,
|
|
304
|
+
className: cn(RING[run.phase], className)
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
function ClockLeading2({ run }) {
|
|
308
|
+
if (!run)
|
|
309
|
+
return null;
|
|
310
|
+
return /* @__PURE__ */ jsx(PhaseRing, {
|
|
311
|
+
run,
|
|
312
|
+
className: "size-4"
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
function TimeLeft({ run }) {
|
|
316
|
+
const left = useLeft(run);
|
|
317
|
+
return /* @__PURE__ */ jsx("span", {
|
|
318
|
+
className: cn("text-caption weight-semibold tabular-nums", run.endsAt === undefined ? "text-muted-foreground" : "text-foreground"),
|
|
319
|
+
children: formatClock2(Math.ceil(left / SECOND2))
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
function ClockTrailing2({ run }) {
|
|
323
|
+
if (!run)
|
|
324
|
+
return null;
|
|
325
|
+
return /* @__PURE__ */ jsx(TimeLeft, {
|
|
326
|
+
run
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function ClockMinimal2({ run }) {
|
|
330
|
+
if (!run)
|
|
331
|
+
return null;
|
|
332
|
+
return /* @__PURE__ */ jsx(PhaseRing, {
|
|
333
|
+
run,
|
|
334
|
+
className: "size-5.5"
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
function ClockPhaseDone2({ ended, pomodoro, onStart }) {
|
|
338
|
+
const settings = settingsOf(pomodoro);
|
|
339
|
+
const next = following(ended, settings);
|
|
340
|
+
const minutes = lengthOf(next.phase, settings) / MINUTE2;
|
|
341
|
+
const Glyph = GLYPH[next.phase];
|
|
342
|
+
const breakNext = next.phase !== "focus";
|
|
343
|
+
const title = !breakNext ? "Break over" : next.phase === "long-break" ? "Focus done — long break" : "Focus done — break time";
|
|
344
|
+
const caption = !breakNext ? `${phaseName(next, settings.rounds)} · ${minutes} min` : next.phase === "long-break" ? `${minutes} min break · all ${settings.rounds} rounds done` : `${minutes} min break · ${ended.round} of ${settings.rounds} rounds done`;
|
|
345
|
+
return /* @__PURE__ */ jsx(IslandFlash2, {
|
|
346
|
+
icon: /* @__PURE__ */ jsx("span", {
|
|
347
|
+
className: cn("flex size-9 items-center justify-center rounded-lg", TILE[next.phase]),
|
|
348
|
+
children: /* @__PURE__ */ jsx(Glyph, {
|
|
349
|
+
size: 16,
|
|
350
|
+
strokeWidth: 1.5
|
|
351
|
+
})
|
|
352
|
+
}),
|
|
353
|
+
title,
|
|
354
|
+
caption,
|
|
355
|
+
action: onStart && /* @__PURE__ */ jsx(Button, {
|
|
356
|
+
variant: "secondary",
|
|
357
|
+
size: "compact",
|
|
358
|
+
onClick: onStart,
|
|
359
|
+
children: breakNext ? "Start break" : "Start focus"
|
|
360
|
+
})
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
function schedule(run, start, settings, count) {
|
|
364
|
+
const phases = [];
|
|
365
|
+
let at = run;
|
|
366
|
+
let when = start;
|
|
367
|
+
for (let i = 0;i < count; i++) {
|
|
368
|
+
at = following(at, settings);
|
|
369
|
+
const length = lengthOf(at.phase, settings);
|
|
370
|
+
phases.push({ ...at, start: when, length });
|
|
371
|
+
when += length;
|
|
372
|
+
}
|
|
373
|
+
return phases;
|
|
374
|
+
}
|
|
375
|
+
function Running({
|
|
376
|
+
run,
|
|
377
|
+
settings,
|
|
378
|
+
onChange,
|
|
379
|
+
onPhaseEnd,
|
|
380
|
+
zones = [],
|
|
381
|
+
locale,
|
|
382
|
+
hour12,
|
|
383
|
+
timeZone,
|
|
384
|
+
completedToday,
|
|
385
|
+
layout = "fit",
|
|
386
|
+
className
|
|
387
|
+
}) {
|
|
388
|
+
const left = useLeft(run);
|
|
389
|
+
const running = run.endsAt !== undefined;
|
|
390
|
+
const now = running ? (run.endsAt ?? 0) - left : Date.now();
|
|
391
|
+
useEffect(() => {
|
|
392
|
+
if (!running || left > 0)
|
|
393
|
+
return;
|
|
394
|
+
const next = advancePomodoro2(run, settings);
|
|
395
|
+
onPhaseEnd?.(run, next);
|
|
396
|
+
onChange(next);
|
|
397
|
+
}, [running, left, run, settings, onChange, onPhaseEnd]);
|
|
398
|
+
const ends = now + left;
|
|
399
|
+
const ready = !running && left === run.total;
|
|
400
|
+
const next = following(run, settings);
|
|
401
|
+
const options = { locale, hour12, timeZone };
|
|
402
|
+
const status = running ? `Until ${shortTime(ends, options)}` : ready ? `Ready · ${Math.round(run.total / MINUTE2)} min` : "Paused";
|
|
403
|
+
const nextLabel = next.phase === "focus" ? `${phaseName(next, settings.rounds)} next` : `${lengthOf(next.phase, settings) / MINUTE2} min ${next.phase === "long-break" ? "long break" : "break"} next`;
|
|
404
|
+
const figure = /* @__PURE__ */ jsx(widget_default.Figure, {
|
|
405
|
+
value: formatClock2(Math.ceil(left / SECOND2))
|
|
406
|
+
});
|
|
407
|
+
const controls = /* @__PURE__ */ jsxs("div", {
|
|
408
|
+
className: "-mr-1 flex shrink-0 items-center gap-1",
|
|
409
|
+
children: [
|
|
410
|
+
/* @__PURE__ */ jsx(widget_default.Action, {
|
|
411
|
+
icon: Plus,
|
|
412
|
+
label: "Add a minute",
|
|
413
|
+
onClick: () => onChange(addMinute(run))
|
|
414
|
+
}),
|
|
415
|
+
/* @__PURE__ */ jsx(widget_default.Action, {
|
|
416
|
+
icon: running ? Pause : Play,
|
|
417
|
+
label: running ? "Pause" : ready ? "Start" : "Resume",
|
|
418
|
+
emphasis: "primary",
|
|
419
|
+
filled: true,
|
|
420
|
+
onClick: () => onChange(running ? pause(run, left) : resumePomodoro2(run))
|
|
421
|
+
}),
|
|
422
|
+
/* @__PURE__ */ jsx(widget_default.Action, {
|
|
423
|
+
icon: SkipForward,
|
|
424
|
+
label: next.phase === "focus" ? "Skip to focus" : "Skip to break",
|
|
425
|
+
filled: true,
|
|
426
|
+
onClick: () => onChange(resumePomodoro2(advancePomodoro2(run, settings)))
|
|
427
|
+
})
|
|
428
|
+
]
|
|
429
|
+
});
|
|
430
|
+
const header = /* @__PURE__ */ jsx(widget_default.Header, {
|
|
431
|
+
icon: Timer,
|
|
432
|
+
trailing: /* @__PURE__ */ jsx(widget_default.Action, {
|
|
433
|
+
icon: RotateCcw,
|
|
434
|
+
label: "Reset",
|
|
435
|
+
onClick: () => onChange(null)
|
|
436
|
+
}),
|
|
437
|
+
children: "Pomodoro"
|
|
438
|
+
});
|
|
439
|
+
const phase = /* @__PURE__ */ jsxs("div", {
|
|
440
|
+
className: "flex min-w-0 flex-col gap-0.5",
|
|
441
|
+
children: [
|
|
442
|
+
/* @__PURE__ */ jsx(widget_default.Title, {
|
|
443
|
+
leading: /* @__PURE__ */ jsx("span", {
|
|
444
|
+
"aria-hidden": true,
|
|
445
|
+
className: cn("size-2.5 shrink-0 rounded-full", DOT[run.phase])
|
|
446
|
+
}),
|
|
447
|
+
children: phaseName(run, settings.rounds)
|
|
448
|
+
}),
|
|
449
|
+
/* @__PURE__ */ jsxs(widget_default.Meta, {
|
|
450
|
+
className: "pl-4.5",
|
|
451
|
+
children: [
|
|
452
|
+
/* @__PURE__ */ jsx(widget_default.MetaItem, {
|
|
453
|
+
icon: running ? Clock3 : Pause,
|
|
454
|
+
children: status
|
|
455
|
+
}),
|
|
456
|
+
/* @__PURE__ */ jsx(widget_default.MetaItem, {
|
|
457
|
+
icon: GLYPH[next.phase],
|
|
458
|
+
children: nextLabel
|
|
459
|
+
})
|
|
460
|
+
]
|
|
461
|
+
})
|
|
462
|
+
]
|
|
463
|
+
});
|
|
464
|
+
if (layout === "tall") {
|
|
465
|
+
const cycle = cycleOf(settings);
|
|
466
|
+
const at = indexIn(run, settings);
|
|
467
|
+
const starts = [];
|
|
468
|
+
let when = ends;
|
|
469
|
+
for (const step of cycle.slice(at + 1)) {
|
|
470
|
+
starts.push(when);
|
|
471
|
+
when += lengthOf(step.phase, settings);
|
|
472
|
+
}
|
|
473
|
+
return /* @__PURE__ */ jsxs(widget_default.Sheet, {
|
|
474
|
+
className,
|
|
475
|
+
children: [
|
|
476
|
+
/* @__PURE__ */ jsxs("div", {
|
|
477
|
+
className: "flex min-w-0 items-center gap-8",
|
|
478
|
+
children: [
|
|
479
|
+
/* @__PURE__ */ jsx(PhaseRing, {
|
|
480
|
+
run,
|
|
481
|
+
rounds: settings.rounds,
|
|
482
|
+
className: "size-36 shrink-0"
|
|
483
|
+
}),
|
|
484
|
+
/* @__PURE__ */ jsxs("div", {
|
|
485
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
486
|
+
children: [
|
|
487
|
+
header,
|
|
488
|
+
/* @__PURE__ */ jsxs("div", {
|
|
489
|
+
className: "flex min-w-0 items-center justify-between gap-3",
|
|
490
|
+
children: [
|
|
491
|
+
figure,
|
|
492
|
+
controls
|
|
493
|
+
]
|
|
494
|
+
}),
|
|
495
|
+
phase
|
|
496
|
+
]
|
|
497
|
+
})
|
|
498
|
+
]
|
|
499
|
+
}),
|
|
500
|
+
/* @__PURE__ */ jsxs(widget_default.Section, {
|
|
501
|
+
label: "This cycle",
|
|
502
|
+
trailing: /* @__PURE__ */ jsxs("span", {
|
|
503
|
+
className: "tabular-nums",
|
|
504
|
+
children: [
|
|
505
|
+
"Ends at ",
|
|
506
|
+
shortTime(when, options)
|
|
507
|
+
]
|
|
508
|
+
}),
|
|
509
|
+
children: [
|
|
510
|
+
/* @__PURE__ */ jsx("div", {
|
|
511
|
+
className: "pt-1 pb-2",
|
|
512
|
+
children: /* @__PURE__ */ jsx(CycleStrip, {
|
|
513
|
+
settings,
|
|
514
|
+
at,
|
|
515
|
+
progress: run.total ? 1 - left / run.total : 0
|
|
516
|
+
})
|
|
517
|
+
}),
|
|
518
|
+
/* @__PURE__ */ jsx("div", {
|
|
519
|
+
className: "grid grid-cols-2 gap-x-8",
|
|
520
|
+
children: cycle.map((step, i) => /* @__PURE__ */ jsx(widget_default.Row, {
|
|
521
|
+
leading: i < at ? "Done" : i === at ? "Now" : shortTime(starts[i - at - 1] ?? when, options),
|
|
522
|
+
color: MARK[step.phase],
|
|
523
|
+
trailing: i < at ? /* @__PURE__ */ jsx(Check, {
|
|
524
|
+
size: 14,
|
|
525
|
+
strokeWidth: 1.5,
|
|
526
|
+
"aria-label": "Done"
|
|
527
|
+
}) : i === at ? `${formatClock2(Math.ceil(left / SECOND2))} left` : `${lengthOf(step.phase, settings) / MINUTE2} min`,
|
|
528
|
+
children: phaseName(step, settings.rounds)
|
|
529
|
+
}, `${step.phase}-${step.round}`))
|
|
530
|
+
})
|
|
531
|
+
]
|
|
532
|
+
}),
|
|
533
|
+
completedToday !== undefined && /* @__PURE__ */ jsx(Today, {
|
|
534
|
+
completed: completedToday,
|
|
535
|
+
settings
|
|
536
|
+
}),
|
|
537
|
+
zones.length > 0 && /* @__PURE__ */ jsx(WorldClocks, {
|
|
538
|
+
zones,
|
|
539
|
+
now,
|
|
540
|
+
locale,
|
|
541
|
+
hour12,
|
|
542
|
+
timeZone
|
|
543
|
+
})
|
|
544
|
+
]
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
return /* @__PURE__ */ jsxs(widget_default, {
|
|
548
|
+
className,
|
|
549
|
+
media: /* @__PURE__ */ jsx(PhaseRing, {
|
|
550
|
+
run,
|
|
551
|
+
rounds: settings.rounds,
|
|
552
|
+
className: "size-24"
|
|
553
|
+
}),
|
|
554
|
+
aside: /* @__PURE__ */ jsx(widget_default.Section, {
|
|
555
|
+
label: "Up next",
|
|
556
|
+
trailing: /* @__PURE__ */ jsx("span", {
|
|
557
|
+
className: "tabular-nums",
|
|
558
|
+
children: shortTime(Date.now(), options)
|
|
559
|
+
}),
|
|
560
|
+
children: schedule(run, ends, settings, 3).map((phase) => /* @__PURE__ */ jsx(widget_default.Row, {
|
|
561
|
+
leading: shortTime(phase.start, options),
|
|
562
|
+
color: MARK[phase.phase],
|
|
563
|
+
trailing: `${phase.length / MINUTE2} min`,
|
|
564
|
+
children: phaseName(phase, settings.rounds)
|
|
565
|
+
}, `${phase.phase}-${phase.round}-${phase.start}`))
|
|
566
|
+
}),
|
|
567
|
+
children: [
|
|
568
|
+
header,
|
|
569
|
+
/* @__PURE__ */ jsxs("div", {
|
|
570
|
+
className: "flex min-w-0 items-center justify-between gap-3",
|
|
571
|
+
children: [
|
|
572
|
+
figure,
|
|
573
|
+
controls
|
|
574
|
+
]
|
|
575
|
+
}),
|
|
576
|
+
phase
|
|
577
|
+
]
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
var Clock2 = Object.assign(function Clock({
|
|
581
|
+
zones = [],
|
|
582
|
+
seconds = false,
|
|
583
|
+
hour12,
|
|
584
|
+
timeZone,
|
|
585
|
+
locale,
|
|
586
|
+
now: nowProp,
|
|
587
|
+
pomodoro,
|
|
588
|
+
value,
|
|
589
|
+
defaultValue = null,
|
|
590
|
+
onValueChange,
|
|
591
|
+
onPhaseEnd,
|
|
592
|
+
completedToday,
|
|
593
|
+
layout = "fit",
|
|
594
|
+
className
|
|
595
|
+
}) {
|
|
596
|
+
const [run, setRun] = useControllableState(value, defaultValue, onValueChange);
|
|
597
|
+
const ticking = useEdgeClock2(0, nowProp === undefined && !run, seconds ? SECOND2 : MINUTE2);
|
|
598
|
+
const settings = settingsOf(pomodoro);
|
|
599
|
+
if (run)
|
|
600
|
+
return /* @__PURE__ */ jsx(Running, {
|
|
601
|
+
run,
|
|
602
|
+
settings,
|
|
603
|
+
onChange: setRun,
|
|
604
|
+
onPhaseEnd,
|
|
605
|
+
zones,
|
|
606
|
+
completedToday,
|
|
607
|
+
layout,
|
|
608
|
+
locale,
|
|
609
|
+
hour12,
|
|
610
|
+
timeZone,
|
|
611
|
+
className
|
|
612
|
+
});
|
|
613
|
+
const now = nowProp ?? ticking;
|
|
614
|
+
const time = timeParts(now, { locale, hour12, timeZone });
|
|
615
|
+
const second = seconds && new Intl.DateTimeFormat("en-US", { second: "2-digit", timeZone }).format(now);
|
|
616
|
+
const date = new Date(now).toLocaleDateString(locale, { weekday: "long", month: "long", day: "numeric", timeZone });
|
|
617
|
+
const zoneName = new Intl.DateTimeFormat(locale, { timeZone, timeZoneName: "long" }).formatToParts(now).find((part) => part.type === "timeZoneName")?.value;
|
|
618
|
+
const figure = /* @__PURE__ */ jsx(widget_default.Figure, {
|
|
619
|
+
value: /* @__PURE__ */ jsxs(Fragment, {
|
|
620
|
+
children: [
|
|
621
|
+
time.text,
|
|
622
|
+
second && /* @__PURE__ */ jsxs("span", {
|
|
623
|
+
className: "text-muted-foreground",
|
|
624
|
+
children: [
|
|
625
|
+
":",
|
|
626
|
+
second.padStart(2, "0")
|
|
627
|
+
]
|
|
628
|
+
})
|
|
629
|
+
]
|
|
630
|
+
}),
|
|
631
|
+
unit: time.period
|
|
632
|
+
});
|
|
633
|
+
const start = pomodoro !== false && /* @__PURE__ */ jsx(Button, {
|
|
634
|
+
variant: "secondary",
|
|
635
|
+
size: "compact",
|
|
636
|
+
leadingIcon: Play,
|
|
637
|
+
className: "mb-1",
|
|
638
|
+
onClick: () => setRun(startPomodoro2(settings)),
|
|
639
|
+
children: "Start focus"
|
|
640
|
+
});
|
|
641
|
+
if (layout === "tall")
|
|
642
|
+
return /* @__PURE__ */ jsxs(widget_default.Sheet, {
|
|
643
|
+
className,
|
|
644
|
+
children: [
|
|
645
|
+
/* @__PURE__ */ jsxs("div", {
|
|
646
|
+
className: "flex min-w-0 items-end justify-between gap-6",
|
|
647
|
+
children: [
|
|
648
|
+
/* @__PURE__ */ jsxs("div", {
|
|
649
|
+
className: "flex min-w-0 flex-col gap-1",
|
|
650
|
+
children: [
|
|
651
|
+
/* @__PURE__ */ jsx(widget_default.Header, {
|
|
652
|
+
icon: CalendarDays,
|
|
653
|
+
children: date
|
|
654
|
+
}),
|
|
655
|
+
figure,
|
|
656
|
+
zoneName && /* @__PURE__ */ jsx(widget_default.Subtitle, {
|
|
657
|
+
children: zoneName
|
|
658
|
+
})
|
|
659
|
+
]
|
|
660
|
+
}),
|
|
661
|
+
start
|
|
662
|
+
]
|
|
663
|
+
}),
|
|
664
|
+
zones.length > 0 && /* @__PURE__ */ jsx(WorldClocks, {
|
|
665
|
+
zones,
|
|
666
|
+
now,
|
|
667
|
+
locale,
|
|
668
|
+
hour12,
|
|
669
|
+
timeZone
|
|
670
|
+
}),
|
|
671
|
+
pomodoro !== false && /* @__PURE__ */ jsxs(widget_default.Section, {
|
|
672
|
+
label: "Pomodoro",
|
|
673
|
+
trailing: /* @__PURE__ */ jsxs("span", {
|
|
674
|
+
className: "tabular-nums",
|
|
675
|
+
children: [
|
|
676
|
+
minutesLabel(cycleOf(settings).reduce((sum, step) => sum + lengthOf(step.phase, settings), 0) / MINUTE2),
|
|
677
|
+
" ",
|
|
678
|
+
"a cycle"
|
|
679
|
+
]
|
|
680
|
+
}),
|
|
681
|
+
children: [
|
|
682
|
+
/* @__PURE__ */ jsx("div", {
|
|
683
|
+
className: "pt-1 pb-3",
|
|
684
|
+
children: /* @__PURE__ */ jsx(CycleStrip, {
|
|
685
|
+
settings
|
|
686
|
+
})
|
|
687
|
+
}),
|
|
688
|
+
/* @__PURE__ */ jsx("div", {
|
|
689
|
+
className: "grid grid-cols-3 divide-x divide-border",
|
|
690
|
+
children: PHASES.map((phase) => /* @__PURE__ */ jsxs("div", {
|
|
691
|
+
className: "flex min-w-0 flex-col gap-0.5 px-5 first:pl-0",
|
|
692
|
+
children: [
|
|
693
|
+
/* @__PURE__ */ jsxs("span", {
|
|
694
|
+
className: "flex items-center gap-2 text-caption text-muted-foreground",
|
|
695
|
+
children: [
|
|
696
|
+
/* @__PURE__ */ jsx("span", {
|
|
697
|
+
"aria-hidden": true,
|
|
698
|
+
className: cn("size-2 shrink-0 rounded-full", DOT[phase])
|
|
699
|
+
}),
|
|
700
|
+
phase === "focus" ? "Focus" : phase === "long-break" ? "Long break" : "Short break"
|
|
701
|
+
]
|
|
702
|
+
}),
|
|
703
|
+
/* @__PURE__ */ jsxs("span", {
|
|
704
|
+
className: "text-title weight-semibold tabular-nums text-foreground",
|
|
705
|
+
children: [
|
|
706
|
+
lengthOf(phase, settings) / MINUTE2,
|
|
707
|
+
" min"
|
|
708
|
+
]
|
|
709
|
+
}),
|
|
710
|
+
/* @__PURE__ */ jsx("span", {
|
|
711
|
+
className: "truncate text-caption text-muted-foreground",
|
|
712
|
+
children: phase === "focus" ? `${settings.rounds} rounds` : phase === "long-break" ? `After round ${settings.rounds}` : `Between rounds`
|
|
713
|
+
})
|
|
714
|
+
]
|
|
715
|
+
}, phase))
|
|
716
|
+
})
|
|
717
|
+
]
|
|
718
|
+
}),
|
|
719
|
+
pomodoro !== false && completedToday !== undefined && /* @__PURE__ */ jsx(Today, {
|
|
720
|
+
completed: completedToday,
|
|
721
|
+
settings
|
|
722
|
+
})
|
|
723
|
+
]
|
|
724
|
+
});
|
|
725
|
+
return /* @__PURE__ */ jsxs(widget_default, {
|
|
726
|
+
className,
|
|
727
|
+
aside: zones.length > 0 && /* @__PURE__ */ jsx(widget_default.Section, {
|
|
728
|
+
label: "World clock",
|
|
729
|
+
children: zones.slice(0, 3).map((zone) => /* @__PURE__ */ jsx(ZoneRow, {
|
|
730
|
+
zone,
|
|
731
|
+
now,
|
|
732
|
+
locale,
|
|
733
|
+
hour12,
|
|
734
|
+
timeZone
|
|
735
|
+
}, zone.timeZone + zone.city))
|
|
736
|
+
}),
|
|
737
|
+
children: [
|
|
738
|
+
/* @__PURE__ */ jsx(widget_default.Header, {
|
|
739
|
+
icon: CalendarDays,
|
|
740
|
+
children: date
|
|
741
|
+
}),
|
|
742
|
+
/* @__PURE__ */ jsxs("div", {
|
|
743
|
+
className: "flex min-w-0 items-end justify-between gap-3",
|
|
744
|
+
children: [
|
|
745
|
+
figure,
|
|
746
|
+
start
|
|
747
|
+
]
|
|
748
|
+
}),
|
|
749
|
+
zoneName && /* @__PURE__ */ jsx(widget_default.Subtitle, {
|
|
750
|
+
children: zoneName
|
|
751
|
+
}),
|
|
752
|
+
pomodoro !== false && /* @__PURE__ */ jsxs(widget_default.Meta, {
|
|
753
|
+
className: "mt-1",
|
|
754
|
+
children: [
|
|
755
|
+
/* @__PURE__ */ jsxs(widget_default.MetaItem, {
|
|
756
|
+
icon: Target,
|
|
757
|
+
children: [
|
|
758
|
+
settings.focus,
|
|
759
|
+
" min focus"
|
|
760
|
+
]
|
|
761
|
+
}),
|
|
762
|
+
/* @__PURE__ */ jsxs(widget_default.MetaItem, {
|
|
763
|
+
icon: Coffee,
|
|
764
|
+
children: [
|
|
765
|
+
settings.shortBreak,
|
|
766
|
+
" / ",
|
|
767
|
+
settings.longBreak,
|
|
768
|
+
" min breaks"
|
|
769
|
+
]
|
|
770
|
+
}),
|
|
771
|
+
/* @__PURE__ */ jsxs(widget_default.MetaItem, {
|
|
772
|
+
icon: Repeat,
|
|
773
|
+
children: [
|
|
774
|
+
settings.rounds,
|
|
775
|
+
" rounds"
|
|
776
|
+
]
|
|
777
|
+
})
|
|
778
|
+
]
|
|
779
|
+
})
|
|
780
|
+
]
|
|
781
|
+
});
|
|
782
|
+
}, {
|
|
783
|
+
Leading: ClockLeading2,
|
|
784
|
+
Trailing: ClockTrailing2,
|
|
785
|
+
Minimal: ClockMinimal2,
|
|
786
|
+
PhaseDone: ClockPhaseDone2
|
|
787
|
+
});
|
|
788
|
+
var clock_default = Clock2;
|
|
789
|
+
export { startPomodoro2, advancePomodoro2, resumePomodoro2, ClockLeading2, ClockTrailing2, ClockMinimal2, ClockPhaseDone2, Clock2, clock_default };
|