@open-slide/core 1.19.0 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/{build-CaV_vhIw.js → build-CfAxF6Dm.js} +2 -5
  2. package/dist/cli/bin.d.ts +1 -1
  3. package/dist/cli/bin.js +139 -13
  4. package/dist/{config-CDHB8Oow.d.ts → config-AtA2Bqtn.d.ts} +4 -4
  5. package/dist/{config-GA6NMgs_.js → config-C_VI2EpT.js} +545 -776
  6. package/dist/{design-cpzS8aud.js → design-Cpqx7SJs.js} +1 -2
  7. package/dist/{dev-D57ui2yV.js → dev-BChELmc-.js} +4 -7
  8. package/dist/index.d.ts +7 -37
  9. package/dist/index.js +51 -54
  10. package/dist/locale/index.d.ts +2 -8
  11. package/dist/locale/index.js +13 -3
  12. package/dist/{preview-D40Zw_o0.js → preview-CcCQa268.js} +3 -7
  13. package/dist/{types-8HghULIe.d.ts → types-BzPSOxe-.d.ts} +5 -9
  14. package/dist/vite/index.d.ts +1 -4
  15. package/dist/vite/index.js +2 -4
  16. package/dist/{format-74A3B6zu.js → zh-tw-BxZ_pYqe.js} +13 -49
  17. package/package.json +12 -12
  18. package/skills/create-slide/SKILL.md +4 -1
  19. package/skills/slide-authoring/SKILL.md +25 -2
  20. package/src/app/app.tsx +18 -15
  21. package/src/app/assets/open-slide.png +0 -0
  22. package/src/app/components/asset-view.tsx +46 -39
  23. package/src/app/components/command/command-menu.tsx +5 -1
  24. package/src/app/components/command/command.tsx +4 -2
  25. package/src/app/components/command/home-command-menu.tsx +6 -6
  26. package/src/app/components/export-progress-toast.tsx +80 -0
  27. package/src/app/components/history-provider.tsx +1 -5
  28. package/src/app/components/icon-tooltip.tsx +24 -15
  29. package/src/app/components/image-placeholder.tsx +4 -12
  30. package/src/app/components/inspector/asset-picker-dialog.tsx +24 -32
  31. package/src/app/components/inspector/comment-widget.tsx +33 -7
  32. package/src/app/components/inspector/image-crop-dialog.tsx +9 -6
  33. package/src/app/components/inspector/inline-text-editor.tsx +798 -0
  34. package/src/app/components/inspector/inspect-overlay.tsx +35 -76
  35. package/src/app/components/inspector/inspector-panel.tsx +31 -53
  36. package/src/app/components/inspector/inspector-provider.tsx +53 -36
  37. package/src/app/components/language-toggle.tsx +2 -3
  38. package/src/app/components/notes-drawer.tsx +4 -7
  39. package/src/app/components/overview-grid.tsx +15 -8
  40. package/src/app/components/panel/panel-shell.tsx +1 -3
  41. package/src/app/components/panel/save-card.tsx +12 -3
  42. package/src/app/components/player.tsx +5 -6
  43. package/src/app/components/present/blackout-overlay.tsx +16 -3
  44. package/src/app/components/present/control-bar.tsx +21 -13
  45. package/src/app/components/present/jump-input.tsx +27 -5
  46. package/src/app/components/present/laser-pointer.tsx +34 -11
  47. package/src/app/components/present/progress-bar.tsx +1 -1
  48. package/src/app/components/present/use-presenter-channel.ts +0 -1
  49. package/src/app/components/present/use-touch-swipe.ts +9 -2
  50. package/src/app/components/sidebar/folder-item.tsx +48 -21
  51. package/src/app/components/sidebar/icon-picker.tsx +1 -1
  52. package/src/app/components/sidebar/sidebar-footer.tsx +20 -7
  53. package/src/app/components/sidebar/sidebar.tsx +91 -64
  54. package/src/app/components/slide-canvas.tsx +2 -6
  55. package/src/app/components/slide-transition-layer.tsx +48 -76
  56. package/src/app/components/style-panel/design-provider.tsx +1 -14
  57. package/src/app/components/style-panel/style-panel.tsx +16 -12
  58. package/src/app/components/style-panel/use-design.ts +1 -28
  59. package/src/app/components/theme-toggle.tsx +4 -5
  60. package/src/app/components/themes/theme-detail.tsx +11 -8
  61. package/src/app/components/themes/themes-gallery.tsx +13 -8
  62. package/src/app/components/thumbnail-rail.tsx +14 -15
  63. package/src/app/index.html +21 -0
  64. package/src/app/lib/assets.ts +6 -7
  65. package/src/app/lib/dom.ts +42 -0
  66. package/src/app/lib/export-html.ts +10 -25
  67. package/src/app/lib/export-pdf.ts +11 -28
  68. package/src/app/lib/export-pptx.ts +6 -36
  69. package/src/app/lib/folders.ts +51 -46
  70. package/src/app/lib/inspector/inline-text.ts +31 -0
  71. package/src/app/lib/inspector/pick-target.ts +38 -0
  72. package/src/app/lib/inspector/use-comments.ts +1 -1
  73. package/src/app/lib/keys.ts +18 -0
  74. package/src/app/lib/last-home-location.ts +18 -0
  75. package/src/app/lib/print-ready.ts +2 -4
  76. package/src/app/lib/slides.ts +7 -4
  77. package/src/app/lib/text-diff.ts +19 -0
  78. package/src/app/lib/use-click-page-navigation.ts +2 -6
  79. package/src/app/lib/use-is-mobile.ts +2 -14
  80. package/src/app/lib/use-media-query.ts +20 -0
  81. package/src/app/lib/use-prefers-reduced-motion.ts +5 -13
  82. package/src/app/lib/use-slide-module.ts +1 -1
  83. package/src/app/lib/use-wheel-page-navigation.ts +1 -1
  84. package/src/app/lib/utils.test.ts +25 -1
  85. package/src/app/lib/utils.ts +8 -0
  86. package/src/app/routes/home-shell.tsx +71 -64
  87. package/src/app/routes/home.tsx +50 -58
  88. package/src/app/routes/presenter.tsx +14 -23
  89. package/src/app/routes/slide.tsx +90 -77
  90. package/src/app/routes/themes.tsx +7 -8
  91. package/src/app/styles.css +40 -44
  92. package/src/locale/en.ts +2 -7
  93. package/src/locale/ja.ts +2 -7
  94. package/src/locale/types.ts +2 -7
  95. package/src/locale/zh-cn.ts +2 -7
  96. package/src/locale/zh-tw.ts +2 -7
  97. package/dist/sync-BCJDRIqo.js +0 -139
  98. package/dist/sync-j9_QPovT.js +0 -3
  99. package/src/app/components/pdf-progress-toast.tsx +0 -32
  100. package/src/app/components/pptx-progress-toast.tsx +0 -32
@@ -1,8 +1,9 @@
1
1
  import { ListOrdered, type LucideIcon, Sparkles, X } from 'lucide-react';
2
2
  import { type Ref, useEffect, useRef, useState } from 'react';
3
3
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
4
+ import { isTypingTarget } from '@/lib/keys';
4
5
  import { format, useLocale } from '@/lib/use-locale';
5
- import { cn } from '@/lib/utils';
6
+ import { cn, pad2 } from '@/lib/utils';
6
7
  import type { DesignSystem } from '../lib/design';
7
8
  import { SlidePageProvider } from '../lib/page-context';
8
9
  import type { Page } from '../lib/sdk';
@@ -52,13 +53,15 @@ export function OverviewGrid({
52
53
  useEffect(() => {
53
54
  if (!open) return;
54
55
  focusedRef.current?.focus();
55
- focusedRef.current?.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
56
+ // Keyboard-driven focus moves repeat quickly; queued smooth scrolls
57
+ // fight each other during key repeat, so jump instantly.
58
+ focusedRef.current?.scrollIntoView({ block: 'nearest', behavior: 'auto' });
56
59
  }, [focused, open]);
57
60
 
58
61
  useEffect(() => {
59
62
  if (!open) return;
60
63
  const onKey = (e: KeyboardEvent) => {
61
- if (e.target instanceof HTMLElement && e.target.matches('input, textarea')) return;
64
+ if (isTypingTarget(e.target)) return;
62
65
  const cols = computeCols(gridRef.current);
63
66
  if (e.key === 'ArrowRight') {
64
67
  e.preventDefault();
@@ -108,20 +111,24 @@ export function OverviewGrid({
108
111
  role="dialog"
109
112
  aria-modal="true"
110
113
  aria-label={t.present.overviewDialogAria}
111
- className={cn('absolute inset-0 z-50 flex flex-col backdrop-blur-sm', styles.surface)}
114
+ className={cn(
115
+ 'absolute inset-0 z-50 flex flex-col backdrop-blur-sm',
116
+ 'motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150',
117
+ styles.surface,
118
+ )}
112
119
  >
113
120
  <div className="flex shrink-0 items-center justify-between px-8 pt-6 pb-3">
114
121
  <span className={cn('eyebrow', styles.eyebrow)}>{t.present.overviewEyebrow}</span>
115
122
  <div className="flex items-center gap-3">
116
123
  <span className={cn('font-mono text-[11px] tabular-nums', styles.eyebrow)}>
117
- {(focused + 1).toString().padStart(2, '0')} · {pages.length.toString().padStart(2, '0')}
124
+ {pad2(focused + 1)} · {pad2(pages.length)}
118
125
  </span>
119
126
  <button
120
127
  type="button"
121
128
  onClick={onClose}
122
129
  aria-label={t.common.close}
123
130
  className={cn(
124
- 'flex size-6 items-center justify-center rounded-[4px] outline-none transition-colors',
131
+ 'flex size-6 items-center justify-center rounded-[4px] outline-none transition-[background-color,color,scale] duration-150 active:scale-90',
125
132
  styles.closeButton,
126
133
  )}
127
134
  >
@@ -216,7 +223,7 @@ function OverviewThumb({
216
223
  aria-label={format(t.present.overviewGoToAria, { n: index + 1 })}
217
224
  aria-current={isCurrent ? 'true' : undefined}
218
225
  className={cn(
219
- 'group/thumb flex flex-col items-start gap-2 rounded-[6px] p-1.5 outline-none transition-colors',
226
+ '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
227
  isFocused ? styles.thumbFocused : styles.thumbHover,
221
228
  )}
222
229
  >
@@ -256,7 +263,7 @@ function OverviewThumb({
256
263
  isFocused || isCurrent ? styles.labelActive : styles.labelMuted,
257
264
  )}
258
265
  >
259
- {(index + 1).toString().padStart(2, '0')}
266
+ {pad2(index + 1)}
260
267
  </span>
261
268
  {(hasTransition || hasSteps) && (
262
269
  <span className="flex items-center gap-1">
@@ -55,11 +55,9 @@ 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] ease-swift motion-reduce:transition-none"
59
59
  style={{
60
60
  width: animVisible ? PANEL_W : 0,
61
- borderLeftWidth: animVisible ? 1 : 0,
62
- borderLeftColor: 'var(--hairline)',
63
61
  transitionDuration: `${PANEL_TRANSITION_MS}ms`,
64
62
  }}
65
63
  >
@@ -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,5 @@
1
1
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { hasModifier, isBackwardKey, isForwardKey, isTypingTarget } from '@/lib/keys';
2
3
  import { useClickPageNavigation } from '@/lib/use-click-page-navigation';
3
4
  import { useWheelPageNavigation } from '@/lib/use-wheel-page-navigation';
4
5
  import { cn } from '@/lib/utils';
@@ -271,8 +272,7 @@ export function Player({
271
272
 
272
273
  useEffect(() => {
273
274
  const onKey = (e: KeyboardEvent) => {
274
- const tgt = e.target;
275
- if (tgt instanceof HTMLElement && tgt.matches('input, textarea')) return;
275
+ if (isTypingTarget(e.target)) return;
276
276
 
277
277
  // While an overlay is open, only Esc and the toggle that owns it
278
278
  // should reach the Player. Overview installs its own capture-phase
@@ -300,9 +300,8 @@ export function Player({
300
300
  return;
301
301
  }
302
302
 
303
- const isNext =
304
- e.key === 'ArrowRight' || e.key === 'ArrowDown' || e.key === ' ' || e.key === 'PageDown';
305
- const isPrev = e.key === 'ArrowLeft' || e.key === 'ArrowUp' || e.key === 'PageUp';
303
+ const isNext = isForwardKey(e);
304
+ const isPrev = isBackwardKey(e);
306
305
 
307
306
  if (isNext || isPrev) {
308
307
  if (controls && blackout) setBlackout(null);
@@ -334,7 +333,7 @@ export function Player({
334
333
  if (!controls) return;
335
334
  // Single-letter shortcuts only fire when no modifier is held — keeps
336
335
  // browser shortcuts (Cmd/Ctrl-something) from being hijacked.
337
- if (e.altKey || e.ctrlKey || e.metaKey) return;
336
+ if (hasModifier(e)) return;
338
337
 
339
338
  if (e.key === 'b' || e.key === 'B') {
340
339
  e.preventDefault();
@@ -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
  );
@@ -14,7 +14,7 @@ import {
14
14
  import { createContext, useContext, useEffect, useState } from 'react';
15
15
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
16
16
  import { useLocale } from '@/lib/use-locale';
17
- import { cn } from '@/lib/utils';
17
+ import { cn, pad2 } from '@/lib/utils';
18
18
 
19
19
  const TooltipContainerCtx = createContext<HTMLElement | null>(null);
20
20
 
@@ -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}>
@@ -108,9 +107,9 @@ export function PresentControlBar({
108
107
  <Divider />
109
108
 
110
109
  <span className="px-2 font-mono text-[11.5px] tracking-[0.08em] tabular-nums uppercase select-none text-white/85">
111
- <span className="text-white">{(index + 1).toString().padStart(2, '0')}</span>
110
+ <span className="text-white">{pad2(index + 1)}</span>
112
111
  <span className="text-white/35"> / </span>
113
- <span>{total.toString().padStart(2, '0')}</span>
112
+ <span>{pad2(total)}</span>
114
113
  </span>
115
114
 
116
115
  <Divider />
@@ -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);
@@ -312,7 +320,7 @@ function ElapsedClock({ startedAt }: { startedAt: number }) {
312
320
  title={t.present.elapsedTime}
313
321
  className="px-2 font-mono text-[11.5px] tracking-[0.08em] tabular-nums uppercase select-none text-white/70"
314
322
  >
315
- {m.toString().padStart(2, '0')}:{s.toString().padStart(2, '0')}
323
+ {pad2(m)}:{pad2(s)}
316
324
  </time>
317
325
  );
318
326
  }
@@ -1,4 +1,6 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
+ import { hasModifier, isTypingTarget } from '@/lib/keys';
3
+ import { cn } from '@/lib/utils';
2
4
 
3
5
  const FLUSH_DELAY_MS = 1200;
4
6
 
@@ -15,8 +17,22 @@ type Props = {
15
17
  */
16
18
  export function PresentJumpInput({ pageCount, onJump }: Props) {
17
19
  const [buffer, setBuffer] = useState('');
20
+ // Latch the last text so the badge keeps its digits while fading out.
21
+ const [display, setDisplay] = useState('');
18
22
  const flushRef = useRef<ReturnType<typeof setTimeout> | null>(null);
19
23
 
24
+ useEffect(() => {
25
+ if (buffer) setDisplay(buffer);
26
+ }, [buffer]);
27
+
28
+ // Drop the latched text once the exit fade finishes so the aria-live
29
+ // region does not keep a stale value mounted.
30
+ useEffect(() => {
31
+ if (buffer || !display) return;
32
+ const id = setTimeout(() => setDisplay(''), 150);
33
+ return () => clearTimeout(id);
34
+ }, [buffer, display]);
35
+
20
36
  useEffect(() => {
21
37
  const flush = () => {
22
38
  setBuffer((current) => {
@@ -30,8 +46,8 @@ export function PresentJumpInput({ pageCount, onJump }: Props) {
30
46
  };
31
47
 
32
48
  const onKey = (e: KeyboardEvent) => {
33
- if (e.target instanceof HTMLElement && e.target.matches('input, textarea')) return;
34
- if (e.altKey || e.ctrlKey || e.metaKey) return;
49
+ if (isTypingTarget(e.target)) return;
50
+ if (hasModifier(e)) return;
35
51
 
36
52
  if (/^[0-9]$/.test(e.key)) {
37
53
  e.preventDefault();
@@ -61,14 +77,20 @@ export function PresentJumpInput({ pageCount, onJump }: Props) {
61
77
  };
62
78
  }, [pageCount, onJump]);
63
79
 
64
- if (!buffer) return null;
80
+ if (!display && !buffer) return null;
65
81
  return (
66
82
  <div
67
83
  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"
84
+ className={cn(
85
+ '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',
86
+ 'motion-safe:transition-[opacity,scale] motion-safe:ease-swift',
87
+ buffer
88
+ ? 'scale-100 opacity-100 motion-safe:duration-200'
89
+ : 'scale-95 opacity-0 motion-safe:duration-150',
90
+ )}
69
91
  >
70
92
  <span className="text-white/60">→ </span>
71
- {buffer}
93
+ {buffer || display}
72
94
  </div>
73
95
  );
74
96
  }
@@ -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>
@@ -15,7 +15,6 @@ export type PresenterCommand =
15
15
  | { type: 'next' }
16
16
  | { type: 'prev' }
17
17
  | { type: 'request-state' }
18
- | { type: 'restart-timer' }
19
18
  | { type: 'toggle-blackout'; mode: 'black' | 'white' }
20
19
  | { type: 'switch-slide'; slideId: string };
21
20
 
@@ -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
  };
@@ -1,4 +1,13 @@
1
- import { MoreHorizontal, Pencil, Trash2 } from 'lucide-react';
1
+ import {
2
+ FolderOpen,
3
+ LayoutGrid,
4
+ type LucideIcon,
5
+ MoreHorizontal,
6
+ Palette,
7
+ Pencil,
8
+ PenLine,
9
+ Trash2,
10
+ } from 'lucide-react';
2
11
  import { useEffect, useRef, useState } from 'react';
3
12
  import {
4
13
  DropdownMenu,
@@ -9,7 +18,7 @@ import {
9
18
  import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
10
19
  import type { Folder, FolderIcon } from '@/lib/sdk';
11
20
  import { useLocale } from '@/lib/use-locale';
12
- import { cn } from '@/lib/utils';
21
+ import { cn, pad2 } from '@/lib/utils';
13
22
  import { IconPicker } from './icon-picker';
14
23
 
15
24
  export const SLIDE_DND_MIME = 'application/x-slide-id';
@@ -33,6 +42,24 @@ function useSlideDragActive() {
33
42
  return active;
34
43
  }
35
44
 
45
+ export type SystemViewKind = 'all' | 'draft' | 'themes' | 'assets';
46
+
47
+ const SYSTEM_VIEW_ICONS: Record<SystemViewKind, LucideIcon> = {
48
+ all: LayoutGrid,
49
+ draft: PenLine,
50
+ themes: Palette,
51
+ assets: FolderOpen,
52
+ };
53
+
54
+ export function SystemViewIcon({ kind, className }: { kind: SystemViewKind; className?: string }) {
55
+ const Icon = SYSTEM_VIEW_ICONS[kind];
56
+ return (
57
+ <span aria-hidden className={cn('flex size-5 shrink-0 items-center justify-center', className)}>
58
+ <Icon className="size-4" strokeWidth={1.75} />
59
+ </span>
60
+ );
61
+ }
62
+
36
63
  export function FolderIconChip({ icon, className }: { icon: FolderIcon; className?: string }) {
37
64
  if (icon.type === 'emoji') {
38
65
  return (
@@ -126,16 +153,12 @@ export function FolderItem({
126
153
  onDropSlide(slideId);
127
154
  };
128
155
 
129
- const icon: FolderIcon =
130
- row.kind === 'all'
131
- ? { type: 'emoji', value: '🎞️' }
132
- : row.kind === 'draft'
133
- ? { type: 'emoji', value: '📝' }
134
- : row.kind === 'themes'
135
- ? { type: 'emoji', value: '🎨' }
136
- : row.kind === 'assets'
137
- ? { type: 'emoji', value: '🗂️' }
138
- : row.folder.icon;
156
+ const chip =
157
+ row.kind === 'folder' ? (
158
+ <FolderIconChip icon={row.folder.icon} />
159
+ ) : (
160
+ <SystemViewIcon kind={row.kind} className={cn(!selected && 'text-muted-foreground')} />
161
+ );
139
162
  const label =
140
163
  row.kind === 'all'
141
164
  ? t.home.slides
@@ -158,13 +181,13 @@ export function FolderItem({
158
181
  // biome-ignore lint/a11y/noStaticElementInteractions: drag-and-drop target wraps interactive children
159
182
  <div
160
183
  className={cn(
161
- 'group relative flex items-center gap-2.5 rounded-[5px] px-2 py-[5px] text-[12.5px] transition-colors',
184
+ '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
185
  selected
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'
186
+ ? 'bg-background font-medium text-foreground shadow-edge ring-1 ring-foreground/[0.06]'
164
187
  : 'text-foreground/70 hover:bg-muted/60 hover:text-foreground',
165
188
  slideDragActive && acceptsSlideDrop && !dragOver && 'ring-1 ring-foreground/10',
166
189
  dragOver &&
167
- 'bg-brand/10 text-foreground ring-1 ring-brand ring-offset-1 ring-offset-sidebar motion-safe:scale-[1.01] motion-safe:transition-transform',
190
+ 'bg-brand/10 text-foreground ring-1 ring-brand ring-offset-1 ring-offset-sidebar motion-safe:scale-[1.01]',
168
191
  )}
169
192
  onDragEnter={handleDragEnter}
170
193
  onDragOver={handleDragOver}
@@ -177,11 +200,11 @@ export function FolderItem({
177
200
  render={
178
201
  <button
179
202
  type="button"
180
- className="flex size-5 shrink-0 items-center justify-center rounded transition-transform hover:scale-110"
203
+ 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
204
  aria-label={t.home.changeIcon}
182
205
  onClick={(e) => e.stopPropagation()}
183
206
  >
184
- <FolderIconChip icon={icon} />
207
+ {chip}
185
208
  </button>
186
209
  }
187
210
  />
@@ -196,7 +219,7 @@ export function FolderItem({
196
219
  aria-label={label}
197
220
  className="flex size-5 shrink-0 items-center justify-center"
198
221
  >
199
- <FolderIconChip icon={icon} />
222
+ {chip}
200
223
  </button>
201
224
  )}
202
225
 
@@ -217,7 +240,11 @@ export function FolderItem({
217
240
  className="min-w-0 flex-1 rounded-[3px] bg-card px-1 text-[12.5px] outline-none ring-1 ring-foreground/20"
218
241
  />
219
242
  ) : (
220
- <button type="button" onClick={onSelect} className="min-w-0 flex-1 truncate text-left">
243
+ <button
244
+ type="button"
245
+ onClick={onSelect}
246
+ className="min-w-0 flex-1 truncate rounded-[3px] text-left outline-none focus-visible:ring-1 focus-visible:ring-brand"
247
+ >
221
248
  {label}
222
249
  </button>
223
250
  )}
@@ -230,7 +257,7 @@ export function FolderItem({
230
257
  'group-hover:opacity-0 group-has-[[aria-expanded=true]]:opacity-0',
231
258
  )}
232
259
  >
233
- {count.toString().padStart(2, '0')}
260
+ {pad2(count)}
234
261
  </span>
235
262
 
236
263
  {row.kind === 'folder' && import.meta.env.DEV && (
@@ -240,7 +267,7 @@ export function FolderItem({
240
267
  <button
241
268
  type="button"
242
269
  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"
270
+ 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
271
  aria-label={t.home.folderActions}
245
272
  >
246
273
  <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
  />