@open-slide/core 1.18.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.
Files changed (61) hide show
  1. package/dist/{build-DaL4Gjn-.js → build-CaV_vhIw.js} +1 -1
  2. package/dist/cli/bin.js +3 -3
  3. package/dist/{config-CYs4WJfL.d.ts → config-CDHB8Oow.d.ts} +2 -1
  4. package/dist/{config-CCHio3pk.js → config-GA6NMgs_.js} +1 -0
  5. package/dist/{dev-DLRQoCkT.js → dev-D57ui2yV.js} +1 -1
  6. package/dist/{format-CxPnpVRu.js → format-74A3B6zu.js} +16 -4
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.js +1 -1
  9. package/dist/locale/index.d.ts +1 -1
  10. package/dist/locale/index.js +1 -1
  11. package/dist/{preview-D3qVGc0S.js → preview-D40Zw_o0.js} +1 -1
  12. package/dist/{types-Wz88-Fe1.d.ts → types-8HghULIe.d.ts} +3 -0
  13. package/dist/vite/index.d.ts +2 -2
  14. package/dist/vite/index.js +1 -1
  15. package/package.json +2 -2
  16. package/src/app/app.tsx +20 -15
  17. package/src/app/components/asset-view.tsx +38 -23
  18. package/src/app/components/command/command-menu.tsx +5 -1
  19. package/src/app/components/command/command.tsx +4 -2
  20. package/src/app/components/icon-tooltip.tsx +24 -15
  21. package/src/app/components/inspector/asset-picker-dialog.tsx +18 -16
  22. package/src/app/components/inspector/comment-widget.tsx +33 -7
  23. package/src/app/components/inspector/image-crop-dialog.tsx +8 -2
  24. package/src/app/components/inspector/inspect-overlay.tsx +5 -4
  25. package/src/app/components/inspector/inspector-panel.tsx +15 -5
  26. package/src/app/components/language-toggle.tsx +2 -3
  27. package/src/app/components/notes-drawer.tsx +3 -3
  28. package/src/app/components/overview-grid.tsx +10 -4
  29. package/src/app/components/panel/panel-shell.tsx +1 -1
  30. package/src/app/components/panel/save-card.tsx +12 -3
  31. package/src/app/components/pdf-progress-toast.tsx +7 -3
  32. package/src/app/components/player.tsx +8 -1
  33. package/src/app/components/pptx-progress-toast.tsx +7 -3
  34. package/src/app/components/present/blackout-overlay.tsx +16 -3
  35. package/src/app/components/present/control-bar.tsx +17 -9
  36. package/src/app/components/present/jump-input.tsx +24 -3
  37. package/src/app/components/present/laser-pointer.tsx +34 -11
  38. package/src/app/components/present/progress-bar.tsx +1 -1
  39. package/src/app/components/present/use-presenter-channel.ts +2 -1
  40. package/src/app/components/present/use-touch-swipe.ts +9 -2
  41. package/src/app/components/sidebar/folder-item.tsx +9 -5
  42. package/src/app/components/sidebar/icon-picker.tsx +1 -1
  43. package/src/app/components/sidebar/sidebar-footer.tsx +13 -6
  44. package/src/app/components/sidebar/sidebar.tsx +2 -2
  45. package/src/app/components/style-panel/style-panel.tsx +16 -12
  46. package/src/app/components/theme-toggle.tsx +4 -5
  47. package/src/app/components/themes/theme-detail.tsx +8 -5
  48. package/src/app/components/themes/themes-gallery.tsx +3 -3
  49. package/src/app/components/thumbnail-rail.tsx +7 -3
  50. package/src/app/index.html +21 -0
  51. package/src/app/lib/export-html.ts +15 -2
  52. package/src/app/routes/home-shell.tsx +1 -1
  53. package/src/app/routes/home.tsx +10 -7
  54. package/src/app/routes/presenter.tsx +216 -9
  55. package/src/app/routes/slide.tsx +66 -23
  56. package/src/app/styles.css +7 -0
  57. package/src/locale/en.ts +3 -0
  58. package/src/locale/ja.ts +3 -0
  59. package/src/locale/types.ts +3 -0
  60. package/src/locale/zh-cn.ts +3 -0
  61. package/src/locale/zh-tw.ts +3 -0
@@ -95,7 +95,7 @@ export function ImageCropDialog({
95
95
  </ToggleGroupItem>
96
96
  </ToggleGroup>
97
97
  </div>
98
- <div className="flex h-[420px] w-full items-center justify-center overflow-hidden rounded-md border bg-[repeating-conic-gradient(theme(colors.muted)_0_25%,transparent_0_50%)] bg-[length:12px_12px]">
98
+ <div className="flex h-[420px] w-full touch-none select-none items-center justify-center overflow-hidden rounded-md border bg-[repeating-conic-gradient(theme(colors.muted)_0_25%,transparent_0_50%)] bg-[length:12px_12px]">
99
99
  {fit === 'cover' ? (
100
100
  <ReactCrop
101
101
  crop={crop}
@@ -108,12 +108,18 @@ export function ImageCropDialog({
108
108
  ref={imgRef}
109
109
  src={src}
110
110
  alt=""
111
+ draggable={false}
111
112
  style={{ maxHeight: 420, maxWidth: '100%' }}
112
113
  onLoad={onImageLoad}
113
114
  />
114
115
  </ReactCrop>
115
116
  ) : (
116
- <img src={src} alt="" className="max-h-full max-w-full object-contain" />
117
+ <img
118
+ src={src}
119
+ alt=""
120
+ draggable={false}
121
+ className="max-h-full max-w-full object-contain"
122
+ />
117
123
  )}
118
124
  </div>
119
125
  <DialogFooter>
@@ -190,9 +190,10 @@ function Frame({
190
190
  }, [visible]);
191
191
 
192
192
  if (!rect) return null;
193
+ const morphEase = 'var(--ease-swift)';
193
194
  const transition = morph
194
- ? `left ${FRAME_MORPH_MS}ms ease-out, top ${FRAME_MORPH_MS}ms ease-out, ` +
195
- `width ${FRAME_MORPH_MS}ms ease-out, height ${FRAME_MORPH_MS}ms ease-out, ` +
195
+ ? `left ${FRAME_MORPH_MS}ms ${morphEase}, top ${FRAME_MORPH_MS}ms ${morphEase}, ` +
196
+ `width ${FRAME_MORPH_MS}ms ${morphEase}, height ${FRAME_MORPH_MS}ms ${morphEase}, ` +
196
197
  `opacity ${FRAME_FADE_MS}ms ease-out`
197
198
  : `opacity ${FRAME_FADE_MS}ms ease-out`;
198
199
 
@@ -265,7 +266,7 @@ function ImageActionPanel({
265
266
  e.stopPropagation();
266
267
  openReplace(anchor);
267
268
  }}
268
- className="inline-flex size-7 items-center justify-center rounded-[5px] text-foreground/85 transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
269
+ className="inline-flex size-7 items-center justify-center rounded-[5px] text-foreground/85 transition-[background-color,color,scale] duration-150 hover:bg-muted hover:text-foreground active:scale-[0.94] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
269
270
  >
270
271
  <ImageIcon className="size-3.5" />
271
272
  </button>
@@ -285,7 +286,7 @@ function ImageActionPanel({
285
286
  e.stopPropagation();
286
287
  openCrop(anchor as HTMLImageElement);
287
288
  }}
288
- className="inline-flex size-7 items-center justify-center rounded-[5px] text-foreground/85 transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
289
+ className="inline-flex size-7 items-center justify-center rounded-[5px] text-foreground/85 transition-[background-color,color,scale] duration-150 hover:bg-muted hover:text-foreground active:scale-[0.94] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
289
290
  >
290
291
  <Crop className="size-3.5" />
291
292
  </button>
@@ -32,6 +32,7 @@ import { findSlideSource } from '@/lib/inspector/fiber';
32
32
  import type { EditOp } from '@/lib/inspector/use-editor';
33
33
  import { useAgentSocketConnected } from '@/lib/use-agent-socket';
34
34
  import { useLocale } from '@/lib/use-locale';
35
+ import { cn } from '@/lib/utils';
35
36
  import type { Locale } from '../../../locale/types';
36
37
  import { AssetPickerDialog } from './asset-picker-dialog';
37
38
  import { type SelectedTarget, useInspector } from './inspector-provider';
@@ -688,7 +689,7 @@ function ColorField({
688
689
 
689
690
  return (
690
691
  <Field label={label}>
691
- <label className="relative inline-flex size-8 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-md border bg-background shadow-xs">
692
+ <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">
692
693
  <span
693
694
  className="size-5 rounded-sm"
694
695
  style={{
@@ -717,7 +718,7 @@ function ColorField({
717
718
  setDraft(e.target.value);
718
719
  commitHex(e.target.value);
719
720
  }}
720
- className="h-8 flex-1 font-mono text-[11px] uppercase"
721
+ className="nums h-8 flex-1 font-mono text-[11px] uppercase"
721
722
  spellCheck={false}
722
723
  />
723
724
  {clearable && onClear && (
@@ -851,12 +852,12 @@ function AgentWatchingBadge() {
851
852
  render={
852
853
  <button
853
854
  type="button"
854
- className="flex shrink-0 cursor-help items-center gap-1.5 rounded-[3px] border border-hairline bg-card px-1.5 py-px text-[10.5px] text-foreground/85 outline-none focus-visible:ring-2 focus-visible:ring-ring/30"
855
+ className="flex shrink-0 cursor-help items-center gap-1.5 rounded-[3px] border border-hairline bg-card px-1.5 py-px text-[10.5px] text-foreground/85 outline-none transition-colors duration-150 hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring/30"
855
856
  >
856
857
  <span aria-hidden className="relative flex size-1.5 items-center justify-center">
857
858
  {connected ? (
858
859
  <>
859
- <span className="absolute inline-flex size-full animate-ping rounded-full bg-emerald-500 opacity-60" />
860
+ <span className="absolute inline-flex size-full rounded-full bg-emerald-500 opacity-60 motion-safe:animate-ping" />
860
861
  <span className="relative inline-flex size-1.5 rounded-full bg-emerald-500" />
861
862
  </>
862
863
  ) : (
@@ -879,6 +880,10 @@ function AgentWatchingBadge() {
879
880
  );
880
881
  }
881
882
 
883
+ // The cue animation re-mounts with every element selection; without this
884
+ // guard it replays each time instead of once per inspector session.
885
+ let commentCuePlayed = false;
886
+
882
887
  function CommentsSection({
883
888
  selected,
884
889
  onAdd,
@@ -888,9 +893,14 @@ function CommentsSection({
888
893
  }) {
889
894
  const [draft, setDraft] = useState('');
890
895
  const [submitting, setSubmitting] = useState(false);
896
+ const [showCue] = useState(() => !commentCuePlayed);
891
897
  const wrapRef = useRef<HTMLDivElement>(null);
892
898
  const t = useLocale();
893
899
 
900
+ useEffect(() => {
901
+ commentCuePlayed = true;
902
+ }, []);
903
+
894
904
  useEffect(() => {
895
905
  const onKey = (e: KeyboardEvent) => {
896
906
  if (e.key !== '/') return;
@@ -920,7 +930,7 @@ function CommentsSection({
920
930
  return (
921
931
  <Section title={t.inspector.leaveComment}>
922
932
  <div className="flex flex-col gap-2">
923
- <div ref={wrapRef} className="comment-cue rounded-[6px]">
933
+ <div ref={wrapRef} className={cn('rounded-[6px]', showCue && 'comment-cue')}>
924
934
  <Textarea
925
935
  value={draft}
926
936
  onChange={(e) => setDraft(e.target.value)}
@@ -1,5 +1,5 @@
1
1
  import { Languages } from 'lucide-react';
2
- import { IconTooltip } from '@/components/icon-tooltip';
2
+ import { IconTooltip, MenuTooltipTrigger } from '@/components/icon-tooltip';
3
3
  import { buttonVariants } from '@/components/ui/button';
4
4
  import {
5
5
  DropdownMenu,
@@ -7,7 +7,6 @@ import {
7
7
  DropdownMenuItem,
8
8
  DropdownMenuTrigger,
9
9
  } from '@/components/ui/dropdown-menu';
10
- import { TooltipTrigger } from '@/components/ui/tooltip';
11
10
  import { LOCALE_OPTIONS, setLocale } from '@/lib/locale-store';
12
11
  import { useLocale } from '@/lib/use-locale';
13
12
  import { cn } from '@/lib/utils';
@@ -20,7 +19,7 @@ export function LanguageToggle() {
20
19
  <IconTooltip label={t.languageToggle.title}>
21
20
  <DropdownMenuTrigger
22
21
  render={
23
- <TooltipTrigger
22
+ <MenuTooltipTrigger
24
23
  type="button"
25
24
  aria-label={t.languageToggle.toggleAria}
26
25
  className={cn(buttonVariants({ variant: 'ghost', size: 'icon-sm' }))}
@@ -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-out"
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
- focusedRef.current?.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
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('absolute inset-0 z-50 flex flex-col backdrop-blur-sm', styles.surface)}
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-colors',
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-colors',
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-out"
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
- if (!visible) return null;
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="pointer-events-none absolute bottom-6 left-1/2 z-30 -translate-x-1/2 animate-in fade-in slide-in-from-bottom-2 duration-200 ease-out"
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
- <Loader2 className="mt-0.5 size-3.5 shrink-0 animate-spin text-brand" />
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]" />
@@ -40,6 +40,7 @@ type Props = {
40
40
  allowExit?: boolean;
41
41
  controls?: boolean;
42
42
  slideId?: string;
43
+ onSwitchSlide?: (slideId: string) => void;
43
44
  /**
44
45
  * When true, the Player enters the browser Fullscreen API on mount.
45
46
  * When false, it renders as a window-sized overlay (viewport-filling)
@@ -58,6 +59,7 @@ export function Player({
58
59
  allowExit = true,
59
60
  controls = false,
60
61
  slideId,
62
+ onSwitchSlide,
61
63
  fullscreen = true,
62
64
  }: Props) {
63
65
  const isMobile = useIsMobile();
@@ -250,9 +252,11 @@ export function Player({
250
252
  setBlackout((cur) => (cur === msg.mode ? null : msg.mode));
251
253
  } else if (msg.type === 'request-state') {
252
254
  send({ type: 'state', state: presenterStateRef.current });
255
+ } else if (msg.type === 'switch-slide') {
256
+ if (msg.slideId !== slideId) onSwitchSlide?.(msg.slideId);
253
257
  }
254
258
  },
255
- [goNext, goPrev, handleIndexChange, pages.length],
259
+ [goNext, goPrev, handleIndexChange, pages.length, slideId, onSwitchSlide],
256
260
  );
257
261
 
258
262
  const channel = usePresenterChannel(slideId ?? '__none__', (msg) => {
@@ -402,7 +406,10 @@ export function Player({
402
406
  style={design ? { background: design.palette.bg } : undefined}
403
407
  >
404
408
  <SlideCanvas flat design={design}>
409
+ {/* Keyed per deck so a presenter-driven deck switch cuts instead of
410
+ animating a transition between two unrelated decks. */}
405
411
  <SlideTransitionLayer
412
+ key={slideId}
406
413
  pages={pages}
407
414
  index={index}
408
415
  total={pages.length}
@@ -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
- <Loader2 className="mt-0.5 size-3.5 shrink-0 animate-spin text-brand" />
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
- if (!mode) return null;
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 motion-safe:duration-150',
14
- mode === 'black' ? 'bg-black' : 'bg-white',
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-md',
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-colors',
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-colors',
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
- const id = setInterval(() => setNow(Date.now()), 1000);
305
- return () => clearInterval(id);
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="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"
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 [pos, setPos] = useState<Pos>(null);
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
- setPos(null);
17
+ setTracking(false);
18
+ posRef.current = null;
16
19
  return;
17
20
  }
18
- const onMove = (e: MouseEvent) => setPos({ x: e.clientX, y: e.clientY });
19
- window.addEventListener('mousemove', onMove, { passive: true });
20
- return () => window.removeEventListener('mousemove', onMove);
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 || !pos) return null;
43
+ if (!enabled) return null;
24
44
  return (
25
45
  <div
46
+ ref={dotRef}
26
47
  aria-hidden
27
- className="pointer-events-none fixed top-0 left-0 z-[60]"
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 ease-out"
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>
@@ -16,7 +16,8 @@ export type PresenterCommand =
16
16
  | { type: 'prev' }
17
17
  | { type: 'request-state' }
18
18
  | { type: 'restart-timer' }
19
- | { type: 'toggle-blackout'; mode: 'black' | 'white' };
19
+ | { type: 'toggle-blackout'; mode: 'black' | 'white' }
20
+ | { type: 'switch-slide'; slideId: string };
20
21
 
21
22
  type Handler = (msg: PresenterCommand) => void;
22
23
 
@@ -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
  };