@justanarthur/modo-ui-notch 0.3.0 → 0.4.1
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/blocks/activities/agenda/examples.mdx +8 -0
- package/blocks/activities/agenda/index.tsx +164 -16
- package/blocks/activities/clock/examples.mdx +16 -0
- package/blocks/activities/clock/index.tsx +357 -59
- package/blocks/activities/now-playing/examples.mdx +8 -0
- package/blocks/activities/now-playing/index.tsx +140 -54
- package/blocks/activities/weather/examples.mdx +9 -1
- package/blocks/activities/weather/index.tsx +241 -12
- package/blocks/app/expanded-island/index.tsx +3 -1
- package/blocks/app/settings-window/examples.mdx +8 -0
- package/blocks/app/settings-window/index.tsx +8 -3
- package/blocks/system/clipboard/examples.mdx +8 -0
- package/blocks/system/clipboard/index.tsx +262 -52
- package/blocks/system/recent-files/examples.mdx +14 -0
- package/blocks/system/recent-files/index.tsx +110 -25
- package/blocks/system/system-stats/examples.mdx +8 -0
- package/blocks/system/system-stats/index.tsx +211 -4
- package/components/island/widget/index.tsx +38 -4
- package/dist/blocks/activities/agenda/index.d.ts +2 -1
- package/dist/blocks/activities/agenda/index.js +2 -2
- package/dist/blocks/activities/clock/index.d.ts +2 -1
- package/dist/blocks/activities/clock/index.js +2 -2
- package/dist/blocks/activities/now-playing/index.d.ts +2 -1
- package/dist/blocks/activities/now-playing/index.js +2 -2
- package/dist/blocks/activities/weather/index.d.ts +2 -1
- package/dist/blocks/activities/weather/index.js +2 -2
- package/dist/blocks/app/expanded-island/index.d.ts +1 -1
- package/dist/blocks/app/expanded-island/index.js +1 -1
- 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 -1
- package/dist/blocks/system/clipboard/index.js +2 -2
- package/dist/blocks/system/recent-files/index.d.ts +2 -1
- package/dist/blocks/system/recent-files/index.js +2 -2
- package/dist/blocks/system/system-stats/index.d.ts +2 -1
- package/dist/blocks/system/system-stats/index.js +2 -2
- package/dist/components/island/widget/index.d.ts +2 -2
- package/dist/components/island/widget/index.js +3 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +12 -10
- package/dist/shared/{chunk-2m5dz8nf.d.ts → chunk-0ym9mcqc.d.ts} +6 -2
- package/dist/shared/{chunk-7fvnrtz4.d.ts → chunk-1v35ck2y.d.ts} +12 -2
- package/dist/shared/{chunk-wkg17nxs.d.ts → chunk-2bqmmfg9.d.ts} +13 -2
- package/dist/shared/{chunk-mt0k6v8x.js → chunk-2nxwdn5s.js} +147 -39
- package/dist/shared/{chunk-pfhy5e4q.d.ts → chunk-6tnq6p89.d.ts} +2 -0
- package/dist/shared/{chunk-bvtyjcce.d.ts → chunk-72s4sqwh.d.ts} +16 -1
- package/dist/shared/{chunk-t0hcxh89.d.ts → chunk-9b8b7fw6.d.ts} +12 -0
- package/dist/shared/{chunk-xq5hc5gv.js → chunk-a059ccj0.js} +177 -66
- package/dist/shared/{chunk-qdzemt2v.js → chunk-cry81asr.js} +401 -89
- package/dist/shared/{chunk-da177e8r.d.ts → chunk-fr9jf804.d.ts} +16 -1
- package/dist/shared/{chunk-9c7ewvkk.js → chunk-kbk4bp6p.js} +162 -19
- package/dist/shared/{chunk-3thgcfcq.d.ts → chunk-kv0w8vhq.d.ts} +18 -1
- package/dist/shared/{chunk-416tsgbc.d.ts → chunk-nqjermbr.d.ts} +25 -3
- package/dist/shared/chunk-p3nezxvx.js +481 -0
- package/dist/shared/{chunk-2818esrq.d.ts → chunk-sen170mz.d.ts} +10 -1
- package/dist/shared/{chunk-9m0xbg5v.js → chunk-wayv5rhr.js} +1 -1
- package/dist/shared/{chunk-ym0xbses.js → chunk-ygnrrqta.js} +274 -18
- package/dist/shared/{chunk-j77cx8dp.js → chunk-yw478nmj.js} +325 -58
- package/dist/shared/{chunk-cc9nwbtf.js → chunk-z3tj1ydg.js} +3 -0
- package/dist/shared/{chunk-x7f3g82r.js → chunk-zxsw11dr.js} +14 -4
- package/dist/styles.css +61 -1
- package/mock/clipboard.tsx +34 -0
- package/mock/clock.tsx +3 -3
- package/mock/data.ts +48 -0
- package/mock/files.tsx +14 -1
- package/mock/island-content.tsx +47 -15
- package/mock/system.ts +3 -0
- package/mock/weather.tsx +42 -12
- package/package.json +2 -2
- package/dist/shared/chunk-s2jeqqan.js +0 -243
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-ndf79pv5.js";
|
|
6
6
|
import {
|
|
7
7
|
widget_default
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-zxsw11dr.js";
|
|
9
9
|
import {
|
|
10
10
|
SECOND2,
|
|
11
11
|
MINUTE2,
|
|
@@ -20,6 +20,7 @@ import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable
|
|
|
20
20
|
import { cn } from "@justanarthur/modo-ui/lib/utils";
|
|
21
21
|
import {
|
|
22
22
|
CalendarDays,
|
|
23
|
+
Check,
|
|
23
24
|
Clock3,
|
|
24
25
|
Coffee,
|
|
25
26
|
Moon,
|
|
@@ -61,7 +62,13 @@ var MARK = {
|
|
|
61
62
|
"short-break": "var(--status-success)",
|
|
62
63
|
"long-break": "var(--status-success)"
|
|
63
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
|
+
};
|
|
64
70
|
var GLYPH = { focus: Target, "short-break": Coffee, "long-break": Coffee };
|
|
71
|
+
var PHASES = ["focus", "short-break", "long-break"];
|
|
65
72
|
var settingsOf = (pomodoro) => ({
|
|
66
73
|
...DEFAULTS,
|
|
67
74
|
...pomodoro || {}
|
|
@@ -97,6 +104,20 @@ function useLeft(run) {
|
|
|
97
104
|
const now = useEdgeClock2(end, run.endsAt !== undefined && Date.now() < end + SECOND2);
|
|
98
105
|
return run.endsAt === undefined ? run.remaining ?? run.total : Math.max(0, end - now);
|
|
99
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
|
+
}
|
|
100
121
|
function phaseName(run, rounds) {
|
|
101
122
|
if (run.phase === "focus")
|
|
102
123
|
return `Focus ${run.round} of ${rounds}`;
|
|
@@ -140,12 +161,18 @@ function offsetLabel(minutes) {
|
|
|
140
161
|
}
|
|
141
162
|
var dayKey = (ms, timeZone) => new Intl.DateTimeFormat("en-CA", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" }).format(ms);
|
|
142
163
|
var hourIn = (ms, timeZone) => Number(new Intl.DateTimeFormat("en-US", { timeZone, hour: "numeric", hourCycle: "h23" }).format(ms));
|
|
143
|
-
function
|
|
164
|
+
function zoneFacts(zone, now, timeZone) {
|
|
144
165
|
const there = dayKey(now, zone.timeZone);
|
|
145
166
|
const here = dayKey(now, timeZone);
|
|
146
|
-
const day = there > here ? "Tomorrow" : there < here ? "Yesterday" : undefined;
|
|
147
167
|
const hour = hourIn(now, zone.timeZone);
|
|
148
|
-
|
|
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);
|
|
149
176
|
return /* @__PURE__ */ jsx(widget_default.Row, {
|
|
150
177
|
leading: shortTime(now, { locale, hour12, timeZone: zone.timeZone }),
|
|
151
178
|
trailing: /* @__PURE__ */ jsxs(Fragment, {
|
|
@@ -158,7 +185,7 @@ function ZoneRow({ zone, now, locale, hour12, timeZone }) {
|
|
|
158
185
|
}),
|
|
159
186
|
/* @__PURE__ */ jsx("span", {
|
|
160
187
|
className: "tabular-nums",
|
|
161
|
-
children:
|
|
188
|
+
children: offset
|
|
162
189
|
}),
|
|
163
190
|
/* @__PURE__ */ jsx(DayGlyph, {
|
|
164
191
|
size: 12,
|
|
@@ -171,6 +198,101 @@ function ZoneRow({ zone, now, locale, hour12, timeZone }) {
|
|
|
171
198
|
children: zone.city
|
|
172
199
|
});
|
|
173
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
|
+
}
|
|
174
296
|
function PhaseRing({ run, rounds = DEFAULTS.rounds, className }) {
|
|
175
297
|
const left = useLeft(run);
|
|
176
298
|
return /* @__PURE__ */ jsx(Meter, {
|
|
@@ -250,7 +372,19 @@ function schedule(run, start, settings, count) {
|
|
|
250
372
|
}
|
|
251
373
|
return phases;
|
|
252
374
|
}
|
|
253
|
-
function Running({
|
|
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
|
+
}) {
|
|
254
388
|
const left = useLeft(run);
|
|
255
389
|
const running = run.endsAt !== undefined;
|
|
256
390
|
const now = running ? (run.endsAt ?? 0) - left : Date.now();
|
|
@@ -267,6 +401,149 @@ function Running({ run, settings, onChange, onPhaseEnd, locale, hour12, timeZone
|
|
|
267
401
|
const options = { locale, hour12, timeZone };
|
|
268
402
|
const status = running ? `Until ${shortTime(ends, options)}` : ready ? `Ready · ${Math.round(run.total / MINUTE2)} min` : "Paused";
|
|
269
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
|
+
}
|
|
270
547
|
return /* @__PURE__ */ jsxs(widget_default, {
|
|
271
548
|
className,
|
|
272
549
|
media: /* @__PURE__ */ jsx(PhaseRing, {
|
|
@@ -288,71 +565,15 @@ function Running({ run, settings, onChange, onPhaseEnd, locale, hour12, timeZone
|
|
|
288
565
|
}, `${phase.phase}-${phase.round}-${phase.start}`))
|
|
289
566
|
}),
|
|
290
567
|
children: [
|
|
291
|
-
|
|
292
|
-
icon: Timer,
|
|
293
|
-
trailing: /* @__PURE__ */ jsx(widget_default.Action, {
|
|
294
|
-
icon: RotateCcw,
|
|
295
|
-
label: "Reset",
|
|
296
|
-
onClick: () => onChange(null)
|
|
297
|
-
}),
|
|
298
|
-
children: "Pomodoro"
|
|
299
|
-
}),
|
|
568
|
+
header,
|
|
300
569
|
/* @__PURE__ */ jsxs("div", {
|
|
301
570
|
className: "flex min-w-0 items-center justify-between gap-3",
|
|
302
571
|
children: [
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}),
|
|
306
|
-
/* @__PURE__ */ jsxs("div", {
|
|
307
|
-
className: "-mr-1 flex shrink-0 items-center gap-1",
|
|
308
|
-
children: [
|
|
309
|
-
/* @__PURE__ */ jsx(widget_default.Action, {
|
|
310
|
-
icon: Plus,
|
|
311
|
-
label: "Add a minute",
|
|
312
|
-
onClick: () => onChange(addMinute(run))
|
|
313
|
-
}),
|
|
314
|
-
/* @__PURE__ */ jsx(widget_default.Action, {
|
|
315
|
-
icon: running ? Pause : Play,
|
|
316
|
-
label: running ? "Pause" : ready ? "Start" : "Resume",
|
|
317
|
-
emphasis: "primary",
|
|
318
|
-
filled: true,
|
|
319
|
-
onClick: () => onChange(running ? pause(run, left) : resumePomodoro2(run))
|
|
320
|
-
}),
|
|
321
|
-
/* @__PURE__ */ jsx(widget_default.Action, {
|
|
322
|
-
icon: SkipForward,
|
|
323
|
-
label: next.phase === "focus" ? "Skip to focus" : "Skip to break",
|
|
324
|
-
filled: true,
|
|
325
|
-
onClick: () => onChange(resumePomodoro2(advancePomodoro2(run, settings)))
|
|
326
|
-
})
|
|
327
|
-
]
|
|
328
|
-
})
|
|
572
|
+
figure,
|
|
573
|
+
controls
|
|
329
574
|
]
|
|
330
575
|
}),
|
|
331
|
-
|
|
332
|
-
className: "flex min-w-0 flex-col gap-0.5",
|
|
333
|
-
children: [
|
|
334
|
-
/* @__PURE__ */ jsx(widget_default.Title, {
|
|
335
|
-
leading: /* @__PURE__ */ jsx("span", {
|
|
336
|
-
"aria-hidden": true,
|
|
337
|
-
className: cn("size-2.5 shrink-0 rounded-full", DOT[run.phase])
|
|
338
|
-
}),
|
|
339
|
-
children: phaseName(run, settings.rounds)
|
|
340
|
-
}),
|
|
341
|
-
/* @__PURE__ */ jsxs(widget_default.Meta, {
|
|
342
|
-
className: "pl-4.5",
|
|
343
|
-
children: [
|
|
344
|
-
/* @__PURE__ */ jsx(widget_default.MetaItem, {
|
|
345
|
-
icon: running ? Clock3 : Pause,
|
|
346
|
-
children: status
|
|
347
|
-
}),
|
|
348
|
-
/* @__PURE__ */ jsx(widget_default.MetaItem, {
|
|
349
|
-
icon: GLYPH[next.phase],
|
|
350
|
-
children: nextLabel
|
|
351
|
-
})
|
|
352
|
-
]
|
|
353
|
-
})
|
|
354
|
-
]
|
|
355
|
-
})
|
|
576
|
+
phase
|
|
356
577
|
]
|
|
357
578
|
});
|
|
358
579
|
}
|
|
@@ -368,6 +589,8 @@ var Clock2 = Object.assign(function Clock({
|
|
|
368
589
|
defaultValue = null,
|
|
369
590
|
onValueChange,
|
|
370
591
|
onPhaseEnd,
|
|
592
|
+
completedToday,
|
|
593
|
+
layout = "fit",
|
|
371
594
|
className
|
|
372
595
|
}) {
|
|
373
596
|
const [run, setRun] = useControllableState(value, defaultValue, onValueChange);
|
|
@@ -379,6 +602,9 @@ var Clock2 = Object.assign(function Clock({
|
|
|
379
602
|
settings,
|
|
380
603
|
onChange: setRun,
|
|
381
604
|
onPhaseEnd,
|
|
605
|
+
zones,
|
|
606
|
+
completedToday,
|
|
607
|
+
layout,
|
|
382
608
|
locale,
|
|
383
609
|
hour12,
|
|
384
610
|
timeZone,
|
|
@@ -389,6 +615,113 @@ var Clock2 = Object.assign(function Clock({
|
|
|
389
615
|
const second = seconds && new Intl.DateTimeFormat("en-US", { second: "2-digit", timeZone }).format(now);
|
|
390
616
|
const date = new Date(now).toLocaleDateString(locale, { weekday: "long", month: "long", day: "numeric", timeZone });
|
|
391
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
|
+
});
|
|
392
725
|
return /* @__PURE__ */ jsxs(widget_default, {
|
|
393
726
|
className,
|
|
394
727
|
aside: zones.length > 0 && /* @__PURE__ */ jsx(widget_default.Section, {
|
|
@@ -409,29 +742,8 @@ var Clock2 = Object.assign(function Clock({
|
|
|
409
742
|
/* @__PURE__ */ jsxs("div", {
|
|
410
743
|
className: "flex min-w-0 items-end justify-between gap-3",
|
|
411
744
|
children: [
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
children: [
|
|
415
|
-
time.text,
|
|
416
|
-
second && /* @__PURE__ */ jsxs("span", {
|
|
417
|
-
className: "text-muted-foreground",
|
|
418
|
-
children: [
|
|
419
|
-
":",
|
|
420
|
-
second.padStart(2, "0")
|
|
421
|
-
]
|
|
422
|
-
})
|
|
423
|
-
]
|
|
424
|
-
}),
|
|
425
|
-
unit: time.period
|
|
426
|
-
}),
|
|
427
|
-
pomodoro !== false && /* @__PURE__ */ jsx(Button, {
|
|
428
|
-
variant: "secondary",
|
|
429
|
-
size: "compact",
|
|
430
|
-
leadingIcon: Play,
|
|
431
|
-
className: "mb-1",
|
|
432
|
-
onClick: () => setRun(startPomodoro2(settings)),
|
|
433
|
-
children: "Start focus"
|
|
434
|
-
})
|
|
745
|
+
figure,
|
|
746
|
+
start
|
|
435
747
|
]
|
|
436
748
|
}),
|
|
437
749
|
zoneName && /* @__PURE__ */ jsx(widget_default.Subtitle, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WidgetLayout2 } from "./chunk-nqjermbr.js";
|
|
1
2
|
import { SizeVariant } from "@justanarthur/modo-ui/lib/size-context";
|
|
2
3
|
import { ReactNode } from "react";
|
|
3
4
|
import { JSX as JSX_1kxb } from "react";
|
|
@@ -55,6 +56,8 @@ interface ClipboardHistoryProps2 {
|
|
|
55
56
|
onDelete?: (clip: ClipboardClip2) => void;
|
|
56
57
|
/** The moment the times are read at, in epoch ms. Defaults to now, re-read on each minute. */
|
|
57
58
|
now?: number;
|
|
59
|
+
/** `tall` is the open island's tall snap: the search across the top, every clip as a two-line row with its picture, and the selected clip in full beside them with its actions. Defaults to `'fit'`. */
|
|
60
|
+
layout?: WidgetLayout2;
|
|
58
61
|
/** Step on the size ladder. Omitted, it follows the surrounding SizeProvider. */
|
|
59
62
|
size?: SizeVariant;
|
|
60
63
|
/** Classes for the root, which fills its container. */
|
|
@@ -100,13 +103,25 @@ declare function ClipboardHistoryCopied2({ clip, onPin }: CopiedProps): Element_
|
|
|
100
103
|
* (`ignoredApp`). With no clips it says what will show up here, or that
|
|
101
104
|
* the history is paused.
|
|
102
105
|
*
|
|
106
|
+
* At the open island's tall snap (`layout="tall"`) it becomes a sheet: the
|
|
107
|
+
* search across the top with the pause and the chips beside it, then a
|
|
108
|
+
* master and detail split. On the left every clip, not three, as a row of
|
|
109
|
+
* two lines: its swatch, thumbnail or glyph on a tile, its text (a link's
|
|
110
|
+
* page title), and where and when it was copied, pinned ones first. On the
|
|
111
|
+
* right, past a hairline and held in view as the list scrolls, the
|
|
112
|
+
* selected clip in full: the whole text over up to eight lines, a link's
|
|
113
|
+
* title with its whole address, an image or a color large, a file on a
|
|
114
|
+
* tile; under it its kind, its length in words and characters, the time
|
|
115
|
+
* it was copied, and Pin, Delete and Copy. The keys work as in the fit
|
|
116
|
+
* layout.
|
|
117
|
+
*
|
|
103
118
|
* `ClipboardHistory.Leading` and `ClipboardHistory.Trailing` show the
|
|
104
119
|
* glyph and the count of new clips in the compact island's wings, and
|
|
105
120
|
* `ClipboardHistory.Copied` is the flash when something is copied.
|
|
106
121
|
*
|
|
107
122
|
* @example {@include ./examples.mdx}
|
|
108
123
|
*/
|
|
109
|
-
declare const ClipboardHistory2: (({ clips, value: valueProp, defaultValue, onValueChange, pinned: pinnedProp, defaultPinned, onPinnedChange, query: queryProp, defaultQuery, onQueryChange, paused: pausedProp, defaultPaused, onPausedChange, ignoredApp, onCopy, onDelete, now: nowProp, size, className }: ClipboardHistoryProps2) => Element_12xgc) & {
|
|
124
|
+
declare const ClipboardHistory2: (({ clips, value: valueProp, defaultValue, onValueChange, pinned: pinnedProp, defaultPinned, onPinnedChange, query: queryProp, defaultQuery, onQueryChange, paused: pausedProp, defaultPaused, onPausedChange, ignoredApp, onCopy, onDelete, now: nowProp, layout, size, className }: ClipboardHistoryProps2) => Element_12xgc) & {
|
|
110
125
|
Leading: typeof ClipboardHistoryLeading2;
|
|
111
126
|
Trailing: typeof ClipboardHistoryTrailing2;
|
|
112
127
|
Copied: typeof ClipboardHistoryCopied2;
|