@open-slide/core 1.19.0 → 1.19.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/dist/index.d.ts +6 -6
- package/package.json +1 -1
- package/src/app/app.tsx +20 -15
- package/src/app/components/asset-view.tsx +38 -23
- package/src/app/components/command/command-menu.tsx +5 -1
- package/src/app/components/command/command.tsx +4 -2
- package/src/app/components/icon-tooltip.tsx +24 -15
- package/src/app/components/inspector/asset-picker-dialog.tsx +18 -16
- package/src/app/components/inspector/comment-widget.tsx +33 -7
- package/src/app/components/inspector/image-crop-dialog.tsx +8 -2
- package/src/app/components/inspector/inspect-overlay.tsx +5 -4
- package/src/app/components/inspector/inspector-panel.tsx +15 -5
- package/src/app/components/language-toggle.tsx +2 -3
- package/src/app/components/notes-drawer.tsx +3 -3
- package/src/app/components/overview-grid.tsx +10 -4
- package/src/app/components/panel/panel-shell.tsx +1 -1
- package/src/app/components/panel/save-card.tsx +12 -3
- package/src/app/components/pdf-progress-toast.tsx +7 -3
- package/src/app/components/pptx-progress-toast.tsx +7 -3
- package/src/app/components/present/blackout-overlay.tsx +16 -3
- package/src/app/components/present/control-bar.tsx +17 -9
- package/src/app/components/present/jump-input.tsx +24 -3
- package/src/app/components/present/laser-pointer.tsx +34 -11
- package/src/app/components/present/progress-bar.tsx +1 -1
- package/src/app/components/present/use-touch-swipe.ts +9 -2
- package/src/app/components/sidebar/folder-item.tsx +9 -5
- package/src/app/components/sidebar/icon-picker.tsx +1 -1
- package/src/app/components/sidebar/sidebar-footer.tsx +13 -6
- package/src/app/components/sidebar/sidebar.tsx +2 -2
- package/src/app/components/style-panel/style-panel.tsx +16 -12
- package/src/app/components/theme-toggle.tsx +4 -5
- package/src/app/components/themes/theme-detail.tsx +8 -5
- package/src/app/components/themes/themes-gallery.tsx +3 -3
- package/src/app/components/thumbnail-rail.tsx +7 -3
- package/src/app/index.html +21 -0
- package/src/app/routes/home-shell.tsx +1 -1
- package/src/app/routes/home.tsx +10 -7
- package/src/app/routes/presenter.tsx +4 -3
- package/src/app/routes/slide.tsx +6 -6
- package/src/app/styles.css +7 -0
|
@@ -56,12 +56,12 @@ export function NotesDrawer({ slideId, index, total, initial }: Props) {
|
|
|
56
56
|
return !o;
|
|
57
57
|
});
|
|
58
58
|
}}
|
|
59
|
-
className="flex h-9 w-full items-center gap-2 px-3 text-[12px] text-foreground/80 hover:bg-muted/40"
|
|
59
|
+
className="flex h-9 w-full items-center gap-2 px-3 text-[12px] text-foreground/80 transition-colors duration-150 hover:bg-muted/40 active:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/30"
|
|
60
60
|
aria-expanded={open}
|
|
61
61
|
>
|
|
62
62
|
<NotebookPen className="size-3.5 text-muted-foreground" />
|
|
63
63
|
<span className="font-medium">{t.notesDrawer.toggle}</span>
|
|
64
|
-
<span className="font-mono text-[11px] text-muted-foreground">
|
|
64
|
+
<span className="font-mono text-[11px] tabular-nums text-muted-foreground">
|
|
65
65
|
{format(t.notesDrawer.pageLabel, { n: index + 1, total })}
|
|
66
66
|
</span>
|
|
67
67
|
<span
|
|
@@ -81,7 +81,7 @@ export function NotesDrawer({ slideId, index, total, initial }: Props) {
|
|
|
81
81
|
</button>
|
|
82
82
|
{mounted && (
|
|
83
83
|
<div
|
|
84
|
-
className="overflow-hidden border-t border-hairline transition-[height] ease-
|
|
84
|
+
className="overflow-hidden border-t border-hairline transition-[height] ease-swift motion-reduce:transition-none"
|
|
85
85
|
style={{
|
|
86
86
|
height: animVisible ? DRAWER_CONTENT_H : 0,
|
|
87
87
|
transitionDuration: `${PANEL_TRANSITION_MS}ms`,
|
|
@@ -52,7 +52,9 @@ export function OverviewGrid({
|
|
|
52
52
|
useEffect(() => {
|
|
53
53
|
if (!open) return;
|
|
54
54
|
focusedRef.current?.focus();
|
|
55
|
-
|
|
55
|
+
// Keyboard-driven focus moves repeat quickly; queued smooth scrolls
|
|
56
|
+
// fight each other during key repeat, so jump instantly.
|
|
57
|
+
focusedRef.current?.scrollIntoView({ block: 'nearest', behavior: 'auto' });
|
|
56
58
|
}, [focused, open]);
|
|
57
59
|
|
|
58
60
|
useEffect(() => {
|
|
@@ -108,7 +110,11 @@ export function OverviewGrid({
|
|
|
108
110
|
role="dialog"
|
|
109
111
|
aria-modal="true"
|
|
110
112
|
aria-label={t.present.overviewDialogAria}
|
|
111
|
-
className={cn(
|
|
113
|
+
className={cn(
|
|
114
|
+
'absolute inset-0 z-50 flex flex-col backdrop-blur-sm',
|
|
115
|
+
'motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150',
|
|
116
|
+
styles.surface,
|
|
117
|
+
)}
|
|
112
118
|
>
|
|
113
119
|
<div className="flex shrink-0 items-center justify-between px-8 pt-6 pb-3">
|
|
114
120
|
<span className={cn('eyebrow', styles.eyebrow)}>{t.present.overviewEyebrow}</span>
|
|
@@ -121,7 +127,7 @@ export function OverviewGrid({
|
|
|
121
127
|
onClick={onClose}
|
|
122
128
|
aria-label={t.common.close}
|
|
123
129
|
className={cn(
|
|
124
|
-
'flex size-6 items-center justify-center rounded-[4px] outline-none transition-
|
|
130
|
+
'flex size-6 items-center justify-center rounded-[4px] outline-none transition-[background-color,color,scale] duration-150 active:scale-90',
|
|
125
131
|
styles.closeButton,
|
|
126
132
|
)}
|
|
127
133
|
>
|
|
@@ -216,7 +222,7 @@ function OverviewThumb({
|
|
|
216
222
|
aria-label={format(t.present.overviewGoToAria, { n: index + 1 })}
|
|
217
223
|
aria-current={isCurrent ? 'true' : undefined}
|
|
218
224
|
className={cn(
|
|
219
|
-
'group/thumb flex flex-col items-start gap-2 rounded-[6px] p-1.5 outline-none transition-
|
|
225
|
+
'group/thumb flex flex-col items-start gap-2 rounded-[6px] p-1.5 outline-none transition-[background-color,scale] duration-150 active:scale-[0.98]',
|
|
220
226
|
isFocused ? styles.thumbFocused : styles.thumbHover,
|
|
221
227
|
)}
|
|
222
228
|
>
|
|
@@ -55,7 +55,7 @@ export function PanelShell({
|
|
|
55
55
|
return (
|
|
56
56
|
<aside
|
|
57
57
|
{...dataAttrs}
|
|
58
|
-
className="flex h-full shrink-0 justify-end overflow-hidden bg-sidebar transition-[width,border-left-width] ease-
|
|
58
|
+
className="flex h-full shrink-0 justify-end overflow-hidden bg-sidebar transition-[width,border-left-width] ease-swift motion-reduce:transition-none"
|
|
59
59
|
style={{
|
|
60
60
|
width: animVisible ? PANEL_W : 0,
|
|
61
61
|
borderLeftWidth: animVisible ? 1 : 0,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Check, Loader2, Redo2, Save, Undo2 } from 'lucide-react';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
+
import { usePanelMount } from '@/components/panel/panel-shell';
|
|
3
4
|
import { Button } from '@/components/ui/button';
|
|
4
5
|
import { useLocale } from '@/lib/use-locale';
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
5
7
|
|
|
6
8
|
type SaveCardProps = {
|
|
7
9
|
dirty: boolean;
|
|
@@ -44,7 +46,8 @@ export function SaveCard({
|
|
|
44
46
|
}, [justSaved]);
|
|
45
47
|
|
|
46
48
|
const visible = dirty || committing || justSaved || canUndo || canRedo;
|
|
47
|
-
|
|
49
|
+
const { mounted, animVisible } = usePanelMount(visible);
|
|
50
|
+
if (!mounted) return null;
|
|
48
51
|
|
|
49
52
|
const handleSave = async () => {
|
|
50
53
|
await onSave();
|
|
@@ -58,7 +61,13 @@ export function SaveCard({
|
|
|
58
61
|
return (
|
|
59
62
|
<div
|
|
60
63
|
{...dataAttrs}
|
|
61
|
-
className=
|
|
64
|
+
className={cn(
|
|
65
|
+
'pointer-events-none absolute bottom-6 left-1/2 z-30 -translate-x-1/2',
|
|
66
|
+
'motion-safe:transition-[opacity,translate,scale] motion-safe:duration-200 motion-safe:ease-swift',
|
|
67
|
+
animVisible
|
|
68
|
+
? 'translate-y-0 scale-100 opacity-100'
|
|
69
|
+
: 'translate-y-2 scale-[0.98] opacity-0',
|
|
70
|
+
)}
|
|
62
71
|
>
|
|
63
72
|
<div className="pointer-events-auto flex h-9 items-center gap-1 rounded-[8px] border border-border bg-popover/95 py-0.5 pr-0.5 pl-1 shadow-overlay backdrop-blur-md">
|
|
64
73
|
{showHistory && (
|
|
@@ -125,7 +134,7 @@ export function SaveCard({
|
|
|
125
134
|
>
|
|
126
135
|
{committing ? (
|
|
127
136
|
<>
|
|
128
|
-
<Loader2 className="size-3.5 animate-spin" />
|
|
137
|
+
<Loader2 className="size-3.5 animate-spin motion-reduce:animate-none" />
|
|
129
138
|
{t.common.saving}
|
|
130
139
|
</>
|
|
131
140
|
) : (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Loader2 } from 'lucide-react';
|
|
1
|
+
import { Check, Loader2 } from 'lucide-react';
|
|
2
2
|
import { format, useLocale } from '@/lib/use-locale';
|
|
3
3
|
import type { PdfExportProgress } from '../lib/export-pdf';
|
|
4
4
|
import { Progress } from './ui/progress';
|
|
@@ -17,12 +17,16 @@ export function PdfProgressToast({ progress }: { progress: PdfExportProgress })
|
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<div className="flex w-80 items-start gap-3 rounded-[8px] border border-border bg-popover px-3.5 py-3 text-popover-foreground shadow-floating">
|
|
20
|
-
|
|
20
|
+
{progress.phase === 'done' ? (
|
|
21
|
+
<Check className="mt-0.5 size-3.5 shrink-0 text-[oklch(0.55_0.13_165)]" strokeWidth={2.5} />
|
|
22
|
+
) : (
|
|
23
|
+
<Loader2 className="mt-0.5 size-3.5 shrink-0 animate-spin text-brand motion-reduce:animate-none" />
|
|
24
|
+
)}
|
|
21
25
|
<div className="min-w-0 flex-1">
|
|
22
26
|
<p className="font-heading text-[12.5px] font-semibold tracking-tight">
|
|
23
27
|
{t.pdfToast.title}
|
|
24
28
|
</p>
|
|
25
|
-
<p className="truncate font-mono text-[10.5px] tracking-[0.04em] text-muted-foreground">
|
|
29
|
+
<p className="nums truncate font-mono text-[10.5px] tracking-[0.04em] text-muted-foreground">
|
|
26
30
|
{text}
|
|
27
31
|
</p>
|
|
28
32
|
<Progress value={Math.round(progress.percent)} className="mt-2 h-[3px]" />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Loader2 } from 'lucide-react';
|
|
1
|
+
import { Check, Loader2 } from 'lucide-react';
|
|
2
2
|
import { format, useLocale } from '@/lib/use-locale';
|
|
3
3
|
import type { PptxExportProgress } from '../lib/export-pptx';
|
|
4
4
|
import { Progress } from './ui/progress';
|
|
@@ -17,12 +17,16 @@ export function PptxProgressToast({ progress }: { progress: PptxExportProgress }
|
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<div className="flex w-80 items-start gap-3 rounded-[8px] border border-border bg-popover px-3.5 py-3 text-popover-foreground shadow-floating">
|
|
20
|
-
|
|
20
|
+
{progress.phase === 'done' ? (
|
|
21
|
+
<Check className="mt-0.5 size-3.5 shrink-0 text-[oklch(0.55_0.13_165)]" strokeWidth={2.5} />
|
|
22
|
+
) : (
|
|
23
|
+
<Loader2 className="mt-0.5 size-3.5 shrink-0 animate-spin text-brand motion-reduce:animate-none" />
|
|
24
|
+
)}
|
|
21
25
|
<div className="min-w-0 flex-1">
|
|
22
26
|
<p className="font-heading text-[12.5px] font-semibold tracking-tight">
|
|
23
27
|
{t.pptxToast.title}
|
|
24
28
|
</p>
|
|
25
|
-
<p className="truncate font-mono text-[10.5px] tracking-[0.04em] text-muted-foreground">
|
|
29
|
+
<p className="nums truncate font-mono text-[10.5px] tracking-[0.04em] text-muted-foreground">
|
|
26
30
|
{text}
|
|
27
31
|
</p>
|
|
28
32
|
<Progress value={Math.round(progress.percent)} className="mt-2 h-[3px]" />
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { usePanelMount } from '@/components/panel/panel-shell';
|
|
1
3
|
import { cn } from '@/lib/utils';
|
|
2
4
|
|
|
3
5
|
type Props = {
|
|
@@ -5,13 +7,24 @@ type Props = {
|
|
|
5
7
|
};
|
|
6
8
|
|
|
7
9
|
export function PresentBlackoutOverlay({ mode }: Props) {
|
|
8
|
-
|
|
10
|
+
// Latch the last color so the surface keeps its tone while fading out,
|
|
11
|
+
// and unmount only after the fade so the DOM reflects the cleared state.
|
|
12
|
+
const [color, setColor] = useState<'black' | 'white'>('black');
|
|
13
|
+
const { mounted, animVisible } = usePanelMount(mode !== null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (mode) setColor(mode);
|
|
16
|
+
}, [mode]);
|
|
17
|
+
// Render from `mode` directly while active — the latched state is one
|
|
18
|
+
// frame behind and would flash the previous color on a direct switch.
|
|
19
|
+
const visibleColor = mode ?? color;
|
|
20
|
+
if (!mounted) return null;
|
|
9
21
|
return (
|
|
10
22
|
<div
|
|
11
23
|
aria-hidden
|
|
12
24
|
className={cn(
|
|
13
|
-
'pointer-events-none absolute inset-0 z-20 motion-safe:transition-opacity
|
|
14
|
-
|
|
25
|
+
'pointer-events-none absolute inset-0 z-20 motion-safe:transition-opacity',
|
|
26
|
+
animVisible ? 'opacity-100 motion-safe:duration-150' : 'opacity-0 motion-safe:duration-100',
|
|
27
|
+
visibleColor === 'black' ? 'bg-black' : 'bg-white',
|
|
15
28
|
)}
|
|
16
29
|
/>
|
|
17
30
|
);
|
|
@@ -79,11 +79,10 @@ export function PresentControlBar({
|
|
|
79
79
|
className={cn(
|
|
80
80
|
'pointer-events-none absolute inset-x-0 bottom-0 z-40 flex justify-center px-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] md:px-4 md:pb-4',
|
|
81
81
|
'will-change-[translate,scale,opacity,filter]',
|
|
82
|
-
'motion-safe:transition-[translate,scale,opacity,filter]',
|
|
83
|
-
'motion-safe:duration-[420ms] motion-safe:[transition-timing-function:cubic-bezier(0.22,1,0.36,1)]',
|
|
82
|
+
'motion-safe:transition-[translate,scale,opacity,filter] motion-safe:ease-swift',
|
|
84
83
|
visible
|
|
85
|
-
? 'translate-y-0 scale-100 opacity-100 blur-none'
|
|
86
|
-
: 'translate-y-8 scale-90 opacity-0 blur-
|
|
84
|
+
? 'translate-y-0 scale-100 opacity-100 blur-none motion-safe:duration-[360ms]'
|
|
85
|
+
: 'translate-y-8 scale-90 opacity-0 blur-sm motion-safe:duration-[220ms]',
|
|
87
86
|
)}
|
|
88
87
|
>
|
|
89
88
|
<TooltipProvider delay={300}>
|
|
@@ -229,8 +228,9 @@ function MobileBarButton({
|
|
|
229
228
|
onClick();
|
|
230
229
|
}}
|
|
231
230
|
className={cn(
|
|
232
|
-
'inline-flex size-8 shrink-0 touch-manipulation items-center justify-center rounded-full transition-
|
|
231
|
+
'inline-flex size-8 shrink-0 touch-manipulation items-center justify-center rounded-full transition-[background-color,color,opacity,scale] duration-150',
|
|
233
232
|
'text-white/85 hover:bg-white/12 focus-visible:bg-white/12 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/35',
|
|
233
|
+
'active:scale-[0.94] active:bg-white/12',
|
|
234
234
|
'disabled:pointer-events-none disabled:opacity-30',
|
|
235
235
|
)}
|
|
236
236
|
>
|
|
@@ -270,8 +270,9 @@ function BarButton({
|
|
|
270
270
|
onClick();
|
|
271
271
|
}}
|
|
272
272
|
className={cn(
|
|
273
|
-
'inline-flex size-8 items-center justify-center rounded-full transition-
|
|
274
|
-
'hover:bg-white/12 focus-visible:bg-white/12 focus-visible:outline-none',
|
|
273
|
+
'inline-flex size-8 items-center justify-center rounded-full transition-[background-color,color,opacity,scale] duration-150',
|
|
274
|
+
'hover:bg-white/12 focus-visible:bg-white/12 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/35',
|
|
275
|
+
'active:scale-[0.94]',
|
|
275
276
|
'disabled:pointer-events-none disabled:opacity-30',
|
|
276
277
|
active && 'bg-[var(--brand,#e5484d)]/85 text-white hover:bg-[var(--brand,#e5484d)]',
|
|
277
278
|
)}
|
|
@@ -301,8 +302,15 @@ function ElapsedClock({ startedAt }: { startedAt: number }) {
|
|
|
301
302
|
const [now, setNow] = useState(() => Date.now());
|
|
302
303
|
const t = useLocale();
|
|
303
304
|
useEffect(() => {
|
|
304
|
-
|
|
305
|
-
|
|
305
|
+
// Re-arm against the wall clock each tick; a plain setInterval drifts
|
|
306
|
+
// and visibly skips seconds over a long talk.
|
|
307
|
+
let id: ReturnType<typeof setTimeout>;
|
|
308
|
+
const tick = () => {
|
|
309
|
+
setNow(Date.now());
|
|
310
|
+
id = setTimeout(tick, 1000 - (Date.now() % 1000));
|
|
311
|
+
};
|
|
312
|
+
id = setTimeout(tick, 1000 - (Date.now() % 1000));
|
|
313
|
+
return () => clearTimeout(id);
|
|
306
314
|
}, []);
|
|
307
315
|
const elapsed = Math.max(0, Math.floor((now - startedAt) / 1000));
|
|
308
316
|
const m = Math.floor(elapsed / 60);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { cn } from '@/lib/utils';
|
|
2
3
|
|
|
3
4
|
const FLUSH_DELAY_MS = 1200;
|
|
4
5
|
|
|
@@ -15,8 +16,22 @@ type Props = {
|
|
|
15
16
|
*/
|
|
16
17
|
export function PresentJumpInput({ pageCount, onJump }: Props) {
|
|
17
18
|
const [buffer, setBuffer] = useState('');
|
|
19
|
+
// Latch the last text so the badge keeps its digits while fading out.
|
|
20
|
+
const [display, setDisplay] = useState('');
|
|
18
21
|
const flushRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
19
22
|
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (buffer) setDisplay(buffer);
|
|
25
|
+
}, [buffer]);
|
|
26
|
+
|
|
27
|
+
// Drop the latched text once the exit fade finishes so the aria-live
|
|
28
|
+
// region does not keep a stale value mounted.
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (buffer || !display) return;
|
|
31
|
+
const id = setTimeout(() => setDisplay(''), 150);
|
|
32
|
+
return () => clearTimeout(id);
|
|
33
|
+
}, [buffer, display]);
|
|
34
|
+
|
|
20
35
|
useEffect(() => {
|
|
21
36
|
const flush = () => {
|
|
22
37
|
setBuffer((current) => {
|
|
@@ -61,14 +76,20 @@ export function PresentJumpInput({ pageCount, onJump }: Props) {
|
|
|
61
76
|
};
|
|
62
77
|
}, [pageCount, onJump]);
|
|
63
78
|
|
|
64
|
-
if (!buffer) return null;
|
|
79
|
+
if (!display && !buffer) return null;
|
|
65
80
|
return (
|
|
66
81
|
<div
|
|
67
82
|
aria-live="polite"
|
|
68
|
-
className=
|
|
83
|
+
className={cn(
|
|
84
|
+
'pointer-events-none absolute top-1/2 left-1/2 z-40 -translate-x-1/2 -translate-y-1/2 select-none rounded-[10px] bg-black/70 px-6 py-4 font-mono text-[44px] font-medium tracking-[0.05em] text-white tabular-nums shadow-[0_8px_40px_-8px_oklch(0_0_0/0.6)] backdrop-blur-md',
|
|
85
|
+
'motion-safe:transition-[opacity,scale] motion-safe:ease-swift',
|
|
86
|
+
buffer
|
|
87
|
+
? 'scale-100 opacity-100 motion-safe:duration-200'
|
|
88
|
+
: 'scale-95 opacity-0 motion-safe:duration-150',
|
|
89
|
+
)}
|
|
69
90
|
>
|
|
70
91
|
<span className="text-white/60">→ </span>
|
|
71
|
-
{buffer}
|
|
92
|
+
{buffer || display}
|
|
72
93
|
</div>
|
|
73
94
|
);
|
|
74
95
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
type Pos = { x: number; y: number } | null;
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { cn } from '@/lib/utils';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Soft red dot that follows the cursor when the laser tool is active.
|
|
@@ -8,27 +7,51 @@ type Pos = { x: number; y: number } | null;
|
|
|
8
7
|
* applied by the parent.
|
|
9
8
|
*/
|
|
10
9
|
export function PresentLaserPointer({ enabled }: { enabled: boolean }) {
|
|
11
|
-
const
|
|
10
|
+
const dotRef = useRef<HTMLDivElement | null>(null);
|
|
11
|
+
const posRef = useRef<{ x: number; y: number } | null>(null);
|
|
12
|
+
const rafRef = useRef(0);
|
|
13
|
+
const [tracking, setTracking] = useState(false);
|
|
12
14
|
|
|
13
15
|
useEffect(() => {
|
|
14
16
|
if (!enabled) {
|
|
15
|
-
|
|
17
|
+
setTracking(false);
|
|
18
|
+
posRef.current = null;
|
|
16
19
|
return;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
// Position is written straight to the element inside rAF — routing it
|
|
22
|
+
// through React state would re-render at pointer rate and lag the hand.
|
|
23
|
+
const onMove = (e: PointerEvent) => {
|
|
24
|
+
posRef.current = { x: e.clientX, y: e.clientY };
|
|
25
|
+
if (!rafRef.current) {
|
|
26
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
27
|
+
rafRef.current = 0;
|
|
28
|
+
const el = dotRef.current;
|
|
29
|
+
const p = posRef.current;
|
|
30
|
+
if (el && p) el.style.transform = `translate3d(${p.x - 9}px, ${p.y - 9}px, 0)`;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
setTracking(true);
|
|
34
|
+
};
|
|
35
|
+
window.addEventListener('pointermove', onMove, { passive: true });
|
|
36
|
+
return () => {
|
|
37
|
+
window.removeEventListener('pointermove', onMove);
|
|
38
|
+
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
39
|
+
rafRef.current = 0;
|
|
40
|
+
};
|
|
21
41
|
}, [enabled]);
|
|
22
42
|
|
|
23
|
-
if (!enabled
|
|
43
|
+
if (!enabled) return null;
|
|
24
44
|
return (
|
|
25
45
|
<div
|
|
46
|
+
ref={dotRef}
|
|
26
47
|
aria-hidden
|
|
27
|
-
className=
|
|
48
|
+
className={cn(
|
|
49
|
+
'pointer-events-none fixed top-0 left-0 z-[60] motion-safe:transition-opacity motion-safe:duration-150',
|
|
50
|
+
tracking ? 'opacity-100' : 'opacity-0',
|
|
51
|
+
)}
|
|
28
52
|
style={{
|
|
29
53
|
width: 18,
|
|
30
54
|
height: 18,
|
|
31
|
-
transform: `translate3d(${pos.x - 9}px, ${pos.y - 9}px, 0)`,
|
|
32
55
|
willChange: 'transform',
|
|
33
56
|
borderRadius: '50%',
|
|
34
57
|
background: 'radial-gradient(circle, oklch(0.66 0.24 28 / 0.95) 30%, transparent 70%)',
|
|
@@ -18,7 +18,7 @@ export function PresentProgressBar({ index, total, visible }: Props) {
|
|
|
18
18
|
)}
|
|
19
19
|
>
|
|
20
20
|
<div
|
|
21
|
-
className="h-full w-full origin-left bg-[var(--brand,#e5484d)] transition-transform duration-200
|
|
21
|
+
className="h-full w-full origin-left bg-[var(--brand,#e5484d)] ease-swift motion-safe:transition-transform motion-safe:duration-200"
|
|
22
22
|
style={{ transform: `scaleX(${pct})` }}
|
|
23
23
|
/>
|
|
24
24
|
</div>
|
|
@@ -2,6 +2,10 @@ import { type RefObject, useEffect, useRef } from 'react';
|
|
|
2
2
|
|
|
3
3
|
const MIN_SWIPE_PX = 50;
|
|
4
4
|
const MAX_SWIPE_MS = 600;
|
|
5
|
+
// A fast flick should turn the page even if it travelled a short distance —
|
|
6
|
+
// momentum, not displacement, is what the finger communicated.
|
|
7
|
+
const FLICK_VELOCITY_PX_MS = 0.4;
|
|
8
|
+
const MIN_FLICK_PX = 24;
|
|
5
9
|
|
|
6
10
|
type Options<T extends HTMLElement> = {
|
|
7
11
|
ref: RefObject<T | null>;
|
|
@@ -43,9 +47,12 @@ export function useTouchSwipe<T extends HTMLElement>({
|
|
|
43
47
|
if (!t) return;
|
|
44
48
|
const dx = t.clientX - s.x;
|
|
45
49
|
const dy = t.clientY - s.y;
|
|
46
|
-
if (performance.now() - s.t > MAX_SWIPE_MS) return;
|
|
47
|
-
if (Math.abs(dx) < MIN_SWIPE_PX) return;
|
|
48
50
|
if (Math.abs(dx) <= Math.abs(dy)) return;
|
|
51
|
+
const dt = performance.now() - s.t;
|
|
52
|
+
const velocity = Math.abs(dx) / Math.max(dt, 1);
|
|
53
|
+
const distanceCommit = Math.abs(dx) >= MIN_SWIPE_PX && dt <= MAX_SWIPE_MS;
|
|
54
|
+
const flickCommit = velocity >= FLICK_VELOCITY_PX_MS && Math.abs(dx) >= MIN_FLICK_PX;
|
|
55
|
+
if (!distanceCommit && !flickCommit) return;
|
|
49
56
|
if (dx < 0) onNext();
|
|
50
57
|
else onPrev();
|
|
51
58
|
};
|
|
@@ -158,13 +158,13 @@ export function FolderItem({
|
|
|
158
158
|
// biome-ignore lint/a11y/noStaticElementInteractions: drag-and-drop target wraps interactive children
|
|
159
159
|
<div
|
|
160
160
|
className={cn(
|
|
161
|
-
'group relative flex items-center gap-2.5 rounded-[5px] px-2 py-[5px] text-[12.5px] transition-
|
|
161
|
+
'group relative flex items-center gap-2.5 rounded-[5px] px-2 py-[5px] text-[12.5px] transition-[background-color,color,scale] duration-150',
|
|
162
162
|
selected
|
|
163
163
|
? 'bg-muted text-foreground before:absolute before:inset-y-1.5 before:-left-0.5 before:w-[2px] before:rounded-full before:bg-brand'
|
|
164
164
|
: 'text-foreground/70 hover:bg-muted/60 hover:text-foreground',
|
|
165
165
|
slideDragActive && acceptsSlideDrop && !dragOver && 'ring-1 ring-foreground/10',
|
|
166
166
|
dragOver &&
|
|
167
|
-
'bg-brand/10 text-foreground ring-1 ring-brand ring-offset-1 ring-offset-sidebar motion-safe:scale-[1.01]
|
|
167
|
+
'bg-brand/10 text-foreground ring-1 ring-brand ring-offset-1 ring-offset-sidebar motion-safe:scale-[1.01]',
|
|
168
168
|
)}
|
|
169
169
|
onDragEnter={handleDragEnter}
|
|
170
170
|
onDragOver={handleDragOver}
|
|
@@ -177,7 +177,7 @@ export function FolderItem({
|
|
|
177
177
|
render={
|
|
178
178
|
<button
|
|
179
179
|
type="button"
|
|
180
|
-
className="flex size-5 shrink-0 items-center justify-center rounded transition-transform hover:scale-110"
|
|
180
|
+
className="flex size-5 shrink-0 items-center justify-center rounded outline-none motion-safe:transition-transform motion-safe:duration-150 hover:scale-110 active:scale-95 focus-visible:ring-1 focus-visible:ring-brand"
|
|
181
181
|
aria-label={t.home.changeIcon}
|
|
182
182
|
onClick={(e) => e.stopPropagation()}
|
|
183
183
|
>
|
|
@@ -217,7 +217,11 @@ export function FolderItem({
|
|
|
217
217
|
className="min-w-0 flex-1 rounded-[3px] bg-card px-1 text-[12.5px] outline-none ring-1 ring-foreground/20"
|
|
218
218
|
/>
|
|
219
219
|
) : (
|
|
220
|
-
<button
|
|
220
|
+
<button
|
|
221
|
+
type="button"
|
|
222
|
+
onClick={onSelect}
|
|
223
|
+
className="min-w-0 flex-1 truncate rounded-[3px] text-left outline-none focus-visible:ring-1 focus-visible:ring-brand"
|
|
224
|
+
>
|
|
221
225
|
{label}
|
|
222
226
|
</button>
|
|
223
227
|
)}
|
|
@@ -240,7 +244,7 @@ export function FolderItem({
|
|
|
240
244
|
<button
|
|
241
245
|
type="button"
|
|
242
246
|
onClick={(e) => e.stopPropagation()}
|
|
243
|
-
className="absolute right-2 top-1/2 size-5 -translate-y-1/2 rounded opacity-0 transition-opacity hover:bg-foreground/10 group-hover:opacity-100 aria-expanded:opacity-100"
|
|
247
|
+
className="absolute right-2 top-1/2 size-5 -translate-y-1/2 rounded opacity-0 outline-none transition-opacity duration-150 hover:bg-foreground/10 group-hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-1 focus-visible:ring-brand aria-expanded:opacity-100"
|
|
244
248
|
aria-label={t.home.folderActions}
|
|
245
249
|
>
|
|
246
250
|
<MoreHorizontal className="mx-auto size-3.5" />
|
|
@@ -49,7 +49,7 @@ export function IconPicker({
|
|
|
49
49
|
key={c}
|
|
50
50
|
type="button"
|
|
51
51
|
onClick={() => onChange({ type: 'color', value: c })}
|
|
52
|
-
className="size-6 rounded-[4px] ring-1 ring-foreground/10 shadow-[inset_0_1px_0_oklch(1_0_0/0.18)] transition-transform hover:scale-110"
|
|
52
|
+
className="size-6 rounded-[4px] ring-1 ring-foreground/10 shadow-[inset_0_1px_0_oklch(1_0_0/0.18)] outline-none motion-safe:transition-transform motion-safe:duration-100 hover:scale-110 active:scale-95 focus-visible:ring-2 focus-visible:ring-brand"
|
|
53
53
|
style={{ background: c }}
|
|
54
54
|
aria-label={c}
|
|
55
55
|
/>
|
|
@@ -53,11 +53,18 @@ export function SidebarFooter() {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
const versionRow = (
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
const versionRow = update?.latest ? (
|
|
57
|
+
// Real button: the tooltip holds actionable controls, so keyboard users
|
|
58
|
+
// must be able to reach and open it.
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
className="inline-flex cursor-default items-center gap-1.5 rounded-[3px] outline-none focus-visible:ring-1 focus-visible:ring-brand"
|
|
62
|
+
>
|
|
63
|
+
<span className="size-1.5 rounded-full bg-brand" aria-hidden />
|
|
59
64
|
{label}
|
|
60
|
-
</
|
|
65
|
+
</button>
|
|
66
|
+
) : (
|
|
67
|
+
<span className="inline-flex cursor-default items-center gap-1.5">{label}</span>
|
|
61
68
|
);
|
|
62
69
|
|
|
63
70
|
return (
|
|
@@ -93,7 +100,7 @@ export function SidebarFooter() {
|
|
|
93
100
|
onClick={restartServer}
|
|
94
101
|
>
|
|
95
102
|
{restarting ? (
|
|
96
|
-
<Loader2 className="animate-spin" aria-hidden />
|
|
103
|
+
<Loader2 className="animate-spin motion-reduce:animate-none" aria-hidden />
|
|
97
104
|
) : (
|
|
98
105
|
<RotateCw aria-hidden />
|
|
99
106
|
)}
|
|
@@ -115,7 +122,7 @@ export function SidebarFooter() {
|
|
|
115
122
|
onClick={updatePackage}
|
|
116
123
|
>
|
|
117
124
|
{isUpdating ? (
|
|
118
|
-
<Loader2 className="animate-spin" aria-hidden />
|
|
125
|
+
<Loader2 className="animate-spin motion-reduce:animate-none" aria-hidden />
|
|
119
126
|
) : (
|
|
120
127
|
<RefreshCw aria-hidden />
|
|
121
128
|
)}
|
|
@@ -257,7 +257,7 @@ export function Sidebar({
|
|
|
257
257
|
render={
|
|
258
258
|
<button
|
|
259
259
|
type="button"
|
|
260
|
-
className="flex size-5 shrink-0 items-center justify-center rounded transition-transform hover:scale-110"
|
|
260
|
+
className="flex size-5 shrink-0 items-center justify-center rounded outline-none motion-safe:transition-transform motion-safe:duration-150 hover:scale-110 active:scale-95 focus-visible:ring-1 focus-visible:ring-brand"
|
|
261
261
|
aria-label={t.home.pickIcon}
|
|
262
262
|
>
|
|
263
263
|
<FolderIconChip icon={newIcon} />
|
|
@@ -286,7 +286,7 @@ export function Sidebar({
|
|
|
286
286
|
<button
|
|
287
287
|
type="button"
|
|
288
288
|
onClick={startCreating}
|
|
289
|
-
className="mt-1 flex w-full items-center gap-2 rounded-[5px] px-2 py-1.5 text-[12px] text-muted-foreground transition-
|
|
289
|
+
className="mt-1 flex w-full items-center gap-2 rounded-[5px] px-2 py-1.5 text-[12px] text-muted-foreground outline-none transition-[background-color,color,scale] duration-100 hover:bg-muted/60 hover:text-foreground active:scale-[0.98] focus-visible:ring-1 focus-visible:ring-brand"
|
|
290
290
|
>
|
|
291
291
|
<Plus className="size-3.5" />
|
|
292
292
|
<span>{t.home.newFolder}</span>
|
|
@@ -3,6 +3,7 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
import { Field, NumberField, Section } from '@/components/panel/panel-fields';
|
|
4
4
|
import { PanelShell, usePanelMount } from '@/components/panel/panel-shell';
|
|
5
5
|
import { useLocale } from '@/lib/use-locale';
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
6
7
|
import { Button } from '../ui/button';
|
|
7
8
|
import { Input } from '../ui/input';
|
|
8
9
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/select';
|
|
@@ -29,12 +30,14 @@ type DesignPanelProps = {
|
|
|
29
30
|
|
|
30
31
|
export function DesignPanel({ open, onClose }: DesignPanelProps) {
|
|
31
32
|
const { draft, exists, warning, loaded, dirty, update, shuffle } = useDesignPanelState();
|
|
32
|
-
|
|
33
|
+
// Gate the mount on data readiness so the first open still slides in
|
|
34
|
+
// instead of popping fully expanded once loading finishes.
|
|
35
|
+
const ready = loaded && draft != null;
|
|
36
|
+
const { mounted, animVisible } = usePanelMount(open && ready);
|
|
33
37
|
const t = useLocale();
|
|
34
38
|
|
|
35
|
-
if (!
|
|
39
|
+
if (!ready) return null;
|
|
36
40
|
if (!mounted) return null;
|
|
37
|
-
if (!draft) return null;
|
|
38
41
|
|
|
39
42
|
return (
|
|
40
43
|
<PanelShell
|
|
@@ -52,13 +55,14 @@ export function DesignPanel({ open, onClose }: DesignPanelProps) {
|
|
|
52
55
|
{t.stylePanel.draftBadge}
|
|
53
56
|
</span>
|
|
54
57
|
)}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
<span
|
|
59
|
+
className={cn(
|
|
60
|
+
'size-1.5 rounded-full bg-brand transition-opacity duration-150',
|
|
61
|
+
dirty ? 'opacity-100' : 'opacity-0',
|
|
62
|
+
)}
|
|
63
|
+
title={dirty ? t.stylePanel.unsavedTitle : undefined}
|
|
64
|
+
aria-hidden
|
|
65
|
+
/>
|
|
62
66
|
</div>
|
|
63
67
|
<div className="flex items-center gap-0.5">
|
|
64
68
|
<Button
|
|
@@ -232,7 +236,7 @@ function ColorField({
|
|
|
232
236
|
|
|
233
237
|
return (
|
|
234
238
|
<Field label={label}>
|
|
235
|
-
<label className="relative inline-flex size-8 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-md border bg-background shadow-xs">
|
|
239
|
+
<label className="relative inline-flex size-8 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-md border bg-background shadow-xs transition-[border-color,scale] duration-150 hover:border-foreground/20 active:scale-[0.96] has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring/40">
|
|
236
240
|
<span className="size-5 rounded-sm" style={{ backgroundColor: value }} />
|
|
237
241
|
<input
|
|
238
242
|
type="color"
|
|
@@ -252,7 +256,7 @@ function ColorField({
|
|
|
252
256
|
onBlur={() => {
|
|
253
257
|
if (!/^#[0-9a-fA-F]{6}$/.test(hexDraft)) setHexDraft(value);
|
|
254
258
|
}}
|
|
255
|
-
className="h-8 flex-1 font-mono text-[11px] uppercase"
|
|
259
|
+
className="nums h-8 flex-1 font-mono text-[11px] uppercase"
|
|
256
260
|
spellCheck={false}
|
|
257
261
|
/>
|
|
258
262
|
</Field>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Monitor, Moon, Sun } from 'lucide-react';
|
|
2
2
|
import { useTheme } from 'next-themes';
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
|
-
import { IconTooltip } from '@/components/icon-tooltip';
|
|
4
|
+
import { IconTooltip, MenuTooltipTrigger } from '@/components/icon-tooltip';
|
|
5
5
|
import { buttonVariants } from '@/components/ui/button';
|
|
6
6
|
import {
|
|
7
7
|
DropdownMenu,
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
DropdownMenuItem,
|
|
10
10
|
DropdownMenuTrigger,
|
|
11
11
|
} from '@/components/ui/dropdown-menu';
|
|
12
|
-
import { TooltipTrigger } from '@/components/ui/tooltip';
|
|
13
12
|
import { useLocale } from '@/lib/use-locale';
|
|
14
13
|
import { cn } from '@/lib/utils';
|
|
15
14
|
|
|
@@ -27,15 +26,15 @@ export function ThemeToggle() {
|
|
|
27
26
|
<IconTooltip label={t.themeToggle.title}>
|
|
28
27
|
<DropdownMenuTrigger
|
|
29
28
|
render={
|
|
30
|
-
<
|
|
29
|
+
<MenuTooltipTrigger
|
|
31
30
|
type="button"
|
|
32
31
|
aria-label={t.themeToggle.toggleAria}
|
|
33
32
|
className={cn(buttonVariants({ variant: 'ghost', size: 'icon-sm' }), 'relative')}
|
|
34
33
|
/>
|
|
35
34
|
}
|
|
36
35
|
>
|
|
37
|
-
<Sun className="size-3.5 scale-100 rotate-0 transition-
|
|
38
|
-
<Moon className="absolute size-3.5 scale-
|
|
36
|
+
<Sun className="size-3.5 scale-100 rotate-0 opacity-100 ease-swift motion-safe:transition-[opacity,scale,rotate] motion-safe:duration-200 dark:scale-75 dark:-rotate-90 dark:opacity-0" />
|
|
37
|
+
<Moon className="absolute size-3.5 scale-75 rotate-90 opacity-0 ease-swift motion-safe:transition-[opacity,scale,rotate] motion-safe:duration-200 dark:scale-100 dark:rotate-0 dark:opacity-100" />
|
|
39
38
|
</DropdownMenuTrigger>
|
|
40
39
|
</IconTooltip>
|
|
41
40
|
<DropdownMenuContent align="end" className="min-w-[140px]">
|