@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.
Files changed (40) hide show
  1. package/dist/index.d.ts +6 -6
  2. package/package.json +1 -1
  3. package/src/app/app.tsx +20 -15
  4. package/src/app/components/asset-view.tsx +38 -23
  5. package/src/app/components/command/command-menu.tsx +5 -1
  6. package/src/app/components/command/command.tsx +4 -2
  7. package/src/app/components/icon-tooltip.tsx +24 -15
  8. package/src/app/components/inspector/asset-picker-dialog.tsx +18 -16
  9. package/src/app/components/inspector/comment-widget.tsx +33 -7
  10. package/src/app/components/inspector/image-crop-dialog.tsx +8 -2
  11. package/src/app/components/inspector/inspect-overlay.tsx +5 -4
  12. package/src/app/components/inspector/inspector-panel.tsx +15 -5
  13. package/src/app/components/language-toggle.tsx +2 -3
  14. package/src/app/components/notes-drawer.tsx +3 -3
  15. package/src/app/components/overview-grid.tsx +10 -4
  16. package/src/app/components/panel/panel-shell.tsx +1 -1
  17. package/src/app/components/panel/save-card.tsx +12 -3
  18. package/src/app/components/pdf-progress-toast.tsx +7 -3
  19. package/src/app/components/pptx-progress-toast.tsx +7 -3
  20. package/src/app/components/present/blackout-overlay.tsx +16 -3
  21. package/src/app/components/present/control-bar.tsx +17 -9
  22. package/src/app/components/present/jump-input.tsx +24 -3
  23. package/src/app/components/present/laser-pointer.tsx +34 -11
  24. package/src/app/components/present/progress-bar.tsx +1 -1
  25. package/src/app/components/present/use-touch-swipe.ts +9 -2
  26. package/src/app/components/sidebar/folder-item.tsx +9 -5
  27. package/src/app/components/sidebar/icon-picker.tsx +1 -1
  28. package/src/app/components/sidebar/sidebar-footer.tsx +13 -6
  29. package/src/app/components/sidebar/sidebar.tsx +2 -2
  30. package/src/app/components/style-panel/style-panel.tsx +16 -12
  31. package/src/app/components/theme-toggle.tsx +4 -5
  32. package/src/app/components/themes/theme-detail.tsx +8 -5
  33. package/src/app/components/themes/themes-gallery.tsx +3 -3
  34. package/src/app/components/thumbnail-rail.tsx +7 -3
  35. package/src/app/index.html +21 -0
  36. package/src/app/routes/home-shell.tsx +1 -1
  37. package/src/app/routes/home.tsx +10 -7
  38. package/src/app/routes/presenter.tsx +4 -3
  39. package/src/app/routes/slide.tsx +6 -6
  40. package/src/app/styles.css +7 -0
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { Locale, Plural } from "./types-8HghULIe.js";
2
2
  import { OpenSlideConfig } from "./config-CDHB8Oow.js";
3
3
  import { CSSProperties, ComponentType, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
4
- import * as react_jsx_runtime1 from "react/jsx-runtime";
5
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
6
- import * as react_jsx_runtime3 from "react/jsx-runtime";
5
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
7
6
  import * as react_jsx_runtime4 from "react/jsx-runtime";
7
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
8
8
 
9
9
  //#region src/app/components/image-placeholder.d.ts
10
10
  type ImagePlaceholderProps = {
@@ -21,7 +21,7 @@ declare function ImagePlaceholder({
21
21
  style,
22
22
  className,
23
23
  ...rest
24
- }: ImagePlaceholderProps): react_jsx_runtime1.JSX.Element;
24
+ }: ImagePlaceholderProps): react_jsx_runtime0.JSX.Element;
25
25
 
26
26
  //#endregion
27
27
  //#region src/app/components/morph-element.d.ts
@@ -36,7 +36,7 @@ declare function MorphElement({
36
36
  children,
37
37
  className,
38
38
  style
39
- }: MorphElementProps): react_jsx_runtime0.JSX.Element;
39
+ }: MorphElementProps): react_jsx_runtime1.JSX.Element;
40
40
 
41
41
  //#endregion
42
42
  //#region src/app/lib/design.d.ts
@@ -118,7 +118,7 @@ declare function useIsActivePage(): boolean;
118
118
  type StepsProps = PropsWithChildren;
119
119
  declare function Steps({
120
120
  children
121
- }: StepsProps): react_jsx_runtime3.JSX.Element;
121
+ }: StepsProps): react_jsx_runtime4.JSX.Element;
122
122
  type StepProps = PropsWithChildren<{
123
123
  duration?: number;
124
124
  }>;
@@ -129,7 +129,7 @@ declare function Step({
129
129
  children,
130
130
  duration,
131
131
  _revealed
132
- }: InternalStepProps): react_jsx_runtime4.JSX.Element;
132
+ }: InternalStepProps): react_jsx_runtime5.JSX.Element;
133
133
 
134
134
  //#endregion
135
135
  export { CANVAS_HEIGHT, CANVAS_WIDTH, DesignFonts, DesignPalette, DesignSystem, DesignTypeScale, ImagePlaceholder, ImagePlaceholderProps, Locale, MorphElement, MorphElementProps, MorphTransition, OpenSlideConfig, Page, Plural, SlideMeta, SlideModule, SlideTransition, Step, StepProps, Steps, StepsProps, TransitionPhase, cssVarsToString, defaultDesign, designToCssVars, useIsActivePage, useSlidePageNumber };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-slide/core",
3
- "version": "1.19.0",
3
+ "version": "1.19.1",
4
4
  "description": "Runtime and CLI for open-slide — write slides in slides/, we handle the rest.",
5
5
  "type": "module",
6
6
  "exports": {
package/src/app/app.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import config from 'virtual:open-slide/config';
2
2
  import { BrowserRouter, Route, Routes } from 'react-router-dom';
3
3
  import { Toaster } from './components/ui/sonner';
4
+ import { TooltipProvider } from './components/ui/tooltip';
4
5
  import { useLocale } from './lib/use-locale';
5
6
  import { AssetsPage } from './routes/assets';
6
7
  import { Home } from './routes/home';
@@ -12,21 +13,25 @@ import { ThemeDetailPage, ThemesGalleryPage } from './routes/themes';
12
13
  export function App() {
13
14
  return (
14
15
  <BrowserRouter basename={import.meta.env.BASE_URL}>
15
- <Routes>
16
- {config.build.showSlideBrowser ? (
17
- <Route element={<HomeShell />}>
18
- <Route path="/" element={<Home />} />
19
- <Route path="/themes" element={<ThemesGalleryPage />} />
20
- <Route path="/themes/:themeId" element={<ThemeDetailPage />} />
21
- <Route path="/assets" element={<AssetsPage />} />
22
- </Route>
23
- ) : (
24
- <Route path="/" element={<NotFound />} />
25
- )}
26
- <Route path="/s/:slideId" element={<Slide />} />
27
- <Route path="/s/:slideId/presenter" element={<Presenter />} />
28
- <Route path="*" element={<NotFound />} />
29
- </Routes>
16
+ {/* One app-wide provider so adjacent tooltips group: after the first
17
+ opens, moving along a toolbar shows the rest instantly. */}
18
+ <TooltipProvider delay={200}>
19
+ <Routes>
20
+ {config.build.showSlideBrowser ? (
21
+ <Route element={<HomeShell />}>
22
+ <Route path="/" element={<Home />} />
23
+ <Route path="/themes" element={<ThemesGalleryPage />} />
24
+ <Route path="/themes/:themeId" element={<ThemeDetailPage />} />
25
+ <Route path="/assets" element={<AssetsPage />} />
26
+ </Route>
27
+ ) : (
28
+ <Route path="/" element={<NotFound />} />
29
+ )}
30
+ <Route path="/s/:slideId" element={<Slide />} />
31
+ <Route path="/s/:slideId/presenter" element={<Presenter />} />
32
+ <Route path="*" element={<NotFound />} />
33
+ </Routes>
34
+ </TooltipProvider>
30
35
  <Toaster />
31
36
  </BrowserRouter>
32
37
  );
@@ -547,21 +547,28 @@ export function AssetView({ slideId }: Props) {
547
547
  )}
548
548
  </div>
549
549
 
550
- {dragActive && (
551
- <div
552
- className="pointer-events-none absolute inset-0 z-30 animate-in fade-in-0 duration-200"
553
- aria-hidden="true"
554
- >
555
- <div className="absolute inset-0 bg-brand/5" />
556
- <div className="absolute inset-2 rounded-[10px] border border-dashed border-brand/40" />
557
- <div className="absolute inset-x-0 bottom-8 flex justify-center">
558
- <div className="flex animate-in items-center gap-2 rounded-[6px] border border-border bg-card px-3 py-1.5 text-[12px] font-medium shadow-floating fade-in-0 slide-in-from-bottom-1 duration-300">
559
- <ArrowDownToLine className="size-3.5 text-brand" />
560
- <span>{t.asset.dropToUpload}</span>
561
- </div>
550
+ <div
551
+ className={cn(
552
+ 'pointer-events-none absolute inset-0 z-30 motion-safe:transition-opacity motion-safe:duration-150',
553
+ dragActive ? 'opacity-100' : 'opacity-0',
554
+ )}
555
+ aria-hidden="true"
556
+ >
557
+ <div className="absolute inset-0 bg-brand/5" />
558
+ <div className="absolute inset-2 rounded-[10px] border border-dashed border-brand/40" />
559
+ <div className="absolute inset-x-0 bottom-8 flex justify-center">
560
+ <div
561
+ className={cn(
562
+ 'flex items-center gap-2 rounded-[6px] border border-border bg-card px-3 py-1.5 text-[12px] font-medium shadow-floating',
563
+ 'ease-swift motion-safe:transition-[opacity,translate] motion-safe:duration-200',
564
+ dragActive ? 'translate-y-0 opacity-100' : 'translate-y-1 opacity-0',
565
+ )}
566
+ >
567
+ <ArrowDownToLine className="size-3.5 text-brand" />
568
+ <span>{t.asset.dropToUpload}</span>
562
569
  </div>
563
570
  </div>
564
- )}
571
+ </div>
565
572
 
566
573
  {conflict && (
567
574
  <ConflictDialog
@@ -806,7 +813,7 @@ function SortableColumnHeader({
806
813
  <DirectionIcon className="size-2.5 shrink-0" aria-hidden />
807
814
  ) : (
808
815
  <ArrowUpDown
809
- className="size-2.5 shrink-0 opacity-0 transition-opacity group-hover:opacity-60 group-focus-visible:opacity-60"
816
+ className="size-2.5 shrink-0 opacity-0 transition-opacity duration-150 group-hover:opacity-60 group-focus-visible:opacity-60 [@media(hover:none)]:opacity-40"
810
817
  aria-hidden
811
818
  />
812
819
  )}
@@ -872,7 +879,7 @@ function AssetCard({
872
879
  const isImage = asset.mime.startsWith('image/');
873
880
  const t = useLocale();
874
881
  return (
875
- <div className="group relative flex flex-col overflow-hidden rounded-[6px] border border-border bg-card shadow-edge transition-shadow hover:shadow-floating focus-within:ring-2 focus-within:ring-ring/30">
882
+ <div className="group relative flex flex-col overflow-hidden rounded-[6px] border border-border bg-card shadow-edge transition-[box-shadow,scale] duration-150 hover:shadow-floating motion-safe:active:scale-[0.99] focus-within:ring-2 focus-within:ring-ring/30">
876
883
  <button
877
884
  type="button"
878
885
  onClick={onPreview}
@@ -934,7 +941,7 @@ function AssetListItem({
934
941
  const isImage = asset.mime.startsWith('image/');
935
942
  const t = useLocale();
936
943
  return (
937
- <div className="group flex min-h-14 items-center gap-3 rounded-[6px] border border-border bg-card p-2 shadow-edge transition-shadow hover:shadow-floating focus-within:ring-2 focus-within:ring-ring/30">
944
+ <div className="group flex min-h-14 items-center gap-3 rounded-[6px] border border-border bg-card p-2 shadow-edge transition-[box-shadow,scale] duration-150 hover:shadow-floating motion-safe:active:scale-[0.995] focus-within:ring-2 focus-within:ring-ring/30">
938
945
  <button
939
946
  type="button"
940
947
  onClick={onPreview}
@@ -1012,7 +1019,7 @@ function AssetActions({
1012
1019
  aria-label={format(t.asset.actionsAria, { name: asset.name })}
1013
1020
  className={cn(
1014
1021
  buttonVariants({ variant: 'ghost', size: 'icon-xs' }),
1015
- 'opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100',
1022
+ 'opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100 [@media(hover:none)]:opacity-100',
1016
1023
  )}
1017
1024
  >
1018
1025
  <MoreVertical />
@@ -1457,7 +1464,7 @@ function LogoSearchDialog({
1457
1464
  {SKELETON_SLOTS.map((slot) => (
1458
1465
  <div
1459
1466
  key={slot}
1460
- className="aspect-square animate-pulse rounded-lg border bg-muted/40"
1467
+ className="aspect-square animate-pulse rounded-lg border bg-muted/40 motion-reduce:animate-none"
1461
1468
  />
1462
1469
  ))}
1463
1470
  </div>
@@ -1581,8 +1588,10 @@ function LogoResultCard({
1581
1588
  type="button"
1582
1589
  onClick={() => setVariant('light')}
1583
1590
  className={cn(
1584
- 'px-1.5 py-0.5 transition-colors',
1585
- variant === 'light' ? 'bg-foreground text-background' : 'hover:bg-muted',
1591
+ 'px-1.5 py-0.5 outline-none transition-colors duration-100 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring/40',
1592
+ variant === 'light'
1593
+ ? 'bg-foreground text-background'
1594
+ : 'hover:bg-muted active:bg-muted',
1586
1595
  )}
1587
1596
  >
1588
1597
  {t.asset.logoVariantLight}
@@ -1591,8 +1600,10 @@ function LogoResultCard({
1591
1600
  type="button"
1592
1601
  onClick={() => setVariant('dark')}
1593
1602
  className={cn(
1594
- 'border-l px-1.5 py-0.5 transition-colors',
1595
- variant === 'dark' ? 'bg-foreground text-background' : 'hover:bg-muted',
1603
+ 'border-l px-1.5 py-0.5 outline-none transition-colors duration-100 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring/40',
1604
+ variant === 'dark'
1605
+ ? 'bg-foreground text-background'
1606
+ : 'hover:bg-muted active:bg-muted',
1596
1607
  )}
1597
1608
  >
1598
1609
  {t.asset.logoVariantDark}
@@ -1613,7 +1624,11 @@ function LogoResultCard({
1613
1624
  }}
1614
1625
  className="ml-auto h-6 px-2 text-[11px]"
1615
1626
  >
1616
- {pending ? <Loader2 className="size-3 animate-spin" /> : t.common.add}
1627
+ {pending ? (
1628
+ <Loader2 className="size-3 animate-spin motion-reduce:animate-none" />
1629
+ ) : (
1630
+ t.common.add
1631
+ )}
1617
1632
  </Button>
1618
1633
  </div>
1619
1634
  </div>
@@ -211,7 +211,11 @@ function useSharedCommandGroups(): CommandGroupSpec[] {
211
211
  {
212
212
  id: 'restart-dev-server',
213
213
  label: restarting ? t.home.restartingServer : t.home.restartServer,
214
- icon: restarting ? <Loader2 className="animate-spin" /> : <RotateCw />,
214
+ icon: restarting ? (
215
+ <Loader2 className="animate-spin motion-reduce:animate-none" />
216
+ ) : (
217
+ <RotateCw />
218
+ ),
215
219
  keywords: ['restart', 'dev', 'server', 'reload'],
216
220
  disabled: restarting,
217
221
  run: restartServer,
@@ -31,7 +31,9 @@ function CommandDialog({
31
31
  <Dialog open={open} onOpenChange={onOpenChange}>
32
32
  <DialogContent
33
33
  showCloseButton={false}
34
- className="top-[14vh] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-[560px]"
34
+ // ⌘K fires dozens of times a day — opacity-only and fast, no scale
35
+ // theater on a keyboard-triggered surface.
36
+ className="top-[14vh] translate-y-0 gap-0 overflow-hidden p-0 duration-100 data-starting-style:scale-100 data-ending-style:scale-100 sm:max-w-[560px]"
35
37
  >
36
38
  <DialogTitle className="sr-only">{title}</DialogTitle>
37
39
  <DialogDescription className="sr-only">{description}</DialogDescription>
@@ -107,7 +109,7 @@ function CommandItem({ className, ...props }: React.ComponentProps<typeof Comman
107
109
  data-slot="command-item"
108
110
  className={cn(
109
111
  'relative flex cursor-default select-none items-center gap-2 rounded-[5px] px-2 py-1.5 text-[12.5px] outline-none',
110
- 'data-[selected=true]:bg-muted data-[selected=true]:text-foreground',
112
+ 'data-[selected=true]:bg-muted data-[selected=true]:text-foreground active:bg-muted/80',
111
113
  'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-45',
112
114
  "[&_svg]:size-3.5 [&_svg]:shrink-0 [&_svg]:text-muted-foreground [&_svg:not([class*='opacity'])]:opacity-80",
113
115
  className,
@@ -1,10 +1,19 @@
1
+ import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';
1
2
  import type { ReactNode } from 'react';
2
- import { Tooltip, TooltipContent, TooltipProvider } from '@/components/ui/tooltip';
3
+ import { Tooltip, TooltipContent } from '@/components/ui/tooltip';
4
+
5
+ /**
6
+ * Tooltip trigger for a button that also opens a menu. The `ui/tooltip` wrapper
7
+ * is a plain function component, so on React 18 it swallows the ref that
8
+ * `DropdownMenuTrigger` hands to its `render` element and the menu never opens —
9
+ * the primitive forwards it.
10
+ */
11
+ export const MenuTooltipTrigger = TooltipPrimitive.Trigger;
3
12
 
4
13
  /**
5
14
  * Shared hover label for the toolbar icon buttons. `children` supplies the
6
15
  * `TooltipTrigger`; a button that also opens a menu has to compose it inward
7
- * (`<DropdownMenuTrigger render={<TooltipTrigger />}>`) — the other nesting
16
+ * (`<DropdownMenuTrigger render={<MenuTooltipTrigger />}>`) — the other nesting
8
17
  * order swallows the trigger ref and the tooltip never opens.
9
18
  */
10
19
  export function IconTooltip({
@@ -16,19 +25,19 @@ export function IconTooltip({
16
25
  shortcut?: string;
17
26
  children: ReactNode;
18
27
  }) {
28
+ // No local provider — tooltips join the app-level group so adjacent
29
+ // toolbar buttons open instantly once one tooltip is showing.
19
30
  return (
20
- <TooltipProvider delay={200}>
21
- <Tooltip>
22
- {children}
23
- <TooltipContent side="bottom" sideOffset={6} className="flex items-center gap-1.5">
24
- {label}
25
- {shortcut && (
26
- <kbd className="rounded-[3px] bg-background/18 px-1 py-0.5 font-mono text-[9.5px] tracking-[0.04em] text-background/85">
27
- {shortcut}
28
- </kbd>
29
- )}
30
- </TooltipContent>
31
- </Tooltip>
32
- </TooltipProvider>
31
+ <Tooltip>
32
+ {children}
33
+ <TooltipContent side="bottom" sideOffset={6} className="flex items-center gap-1.5">
34
+ {label}
35
+ {shortcut && (
36
+ <kbd className="rounded-[3px] bg-background/18 px-1 py-0.5 font-mono text-[9.5px] tracking-[0.04em] text-background/85">
37
+ {shortcut}
38
+ </kbd>
39
+ )}
40
+ </TooltipContent>
41
+ </Tooltip>
33
42
  );
34
43
  }
@@ -83,7 +83,7 @@ export function AssetPickerDialog({
83
83
  )}
84
84
  >
85
85
  {uploading ? (
86
- <Loader2 className="size-3.5 animate-spin" />
86
+ <Loader2 className="size-3.5 animate-spin motion-reduce:animate-none" />
87
87
  ) : (
88
88
  <Upload className="size-3.5" />
89
89
  )}
@@ -144,8 +144,9 @@ export function AssetPickerDialog({
144
144
  type="button"
145
145
  onClick={() => onPick(asset, scope)}
146
146
  className={cn(
147
- 'group flex flex-col overflow-hidden rounded-lg border bg-card text-left shadow-sm transition-all',
148
- 'hover:-translate-y-0.5 hover:shadow-md focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none',
147
+ 'group flex flex-col overflow-hidden rounded-[8px] border bg-card text-left shadow-edge transition-[translate,scale,box-shadow,border-color] duration-150 ease-swift',
148
+ 'motion-safe:hover:-translate-y-0.5 hover:shadow-floating focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none',
149
+ 'motion-safe:active:translate-y-0 motion-safe:active:scale-[0.98]',
149
150
  )}
150
151
  >
151
152
  <div className="flex aspect-square w-full items-center justify-center overflow-hidden bg-[repeating-conic-gradient(theme(colors.muted)_0_25%,transparent_0_50%)] bg-[length:12px_12px]">
@@ -165,21 +166,22 @@ export function AssetPickerDialog({
165
166
  ))}
166
167
  </div>
167
168
  )}
168
- {dragActive && (
169
- <div
170
- className="pointer-events-none absolute inset-0 z-10 animate-in fade-in-0 duration-200"
171
- aria-hidden
172
- >
173
- <div className="absolute inset-0 bg-brand/5" />
174
- <div className="absolute inset-1 rounded-[8px] border border-dashed border-brand/40" />
175
- <div className="absolute inset-x-0 bottom-4 flex justify-center">
176
- <div className="flex items-center gap-2 rounded-[6px] border border-border bg-card px-3 py-1.5 text-[12px] font-medium shadow-floating">
177
- <ArrowDownToLine className="size-3.5 text-brand" />
178
- <span>{t.asset.dropToUpload}</span>
179
- </div>
169
+ <div
170
+ className={cn(
171
+ 'pointer-events-none absolute inset-0 z-10 motion-safe:transition-opacity motion-safe:duration-150',
172
+ dragActive ? 'opacity-100' : 'opacity-0',
173
+ )}
174
+ aria-hidden
175
+ >
176
+ <div className="absolute inset-0 bg-brand/5" />
177
+ <div className="absolute inset-1 rounded-[8px] border border-dashed border-brand/40" />
178
+ <div className="absolute inset-x-0 bottom-4 flex justify-center">
179
+ <div className="flex items-center gap-2 rounded-[6px] border border-border bg-card px-3 py-1.5 text-[12px] font-medium shadow-floating">
180
+ <ArrowDownToLine className="size-3.5 text-brand" />
181
+ <span>{t.asset.dropToUpload}</span>
180
182
  </div>
181
183
  </div>
182
- )}
184
+ </div>
183
185
  </section>
184
186
  </DialogContent>
185
187
  </Dialog>
@@ -1,6 +1,8 @@
1
1
  import { MessageSquare, Trash2, X } from 'lucide-react';
2
2
  import { useEffect, useRef, useState } from 'react';
3
+ import { usePanelMount } from '@/components/panel/panel-shell';
3
4
  import { format, plural, useLocale } from '@/lib/use-locale';
5
+ import { cn } from '@/lib/utils';
4
6
  import { useInspector } from './inspector-provider';
5
7
 
6
8
  export function CommentWidget() {
@@ -9,6 +11,9 @@ export function CommentWidget() {
9
11
  const [open, setOpen] = useState(false);
10
12
  const count = comments.length;
11
13
  const ref = useRef<HTMLDivElement>(null);
14
+ const panelRef = useRef<HTMLDivElement>(null);
15
+ const fabRef = useRef<HTMLButtonElement>(null);
16
+ const { mounted, animVisible } = usePanelMount(open);
12
17
 
13
18
  useEffect(() => {
14
19
  if (!open) return;
@@ -19,27 +24,45 @@ export function CommentWidget() {
19
24
  return () => document.removeEventListener('pointerdown', onPointerDown);
20
25
  }, [open]);
21
26
 
27
+ // The panel stays mounted through its close fade; hand focus back to the
28
+ // toggle so it doesn't sit on a control that's about to unmount.
29
+ useEffect(() => {
30
+ if (open) return;
31
+ if (panelRef.current?.contains(document.activeElement)) fabRef.current?.focus();
32
+ }, [open]);
33
+
22
34
  return (
23
35
  <div
24
36
  ref={ref}
25
37
  data-inspector-ui
26
38
  className="absolute right-4 bottom-4 z-20 flex flex-col items-end gap-2"
27
39
  >
28
- {open && (
29
- <div className="w-80 rounded-md border bg-card shadow-xl animate-in fade-in-0 slide-in-from-bottom-2 duration-200">
40
+ {mounted && (
41
+ <div
42
+ ref={panelRef}
43
+ aria-hidden={!animVisible}
44
+ className={cn(
45
+ 'w-80 origin-bottom-right rounded-[8px] border bg-card shadow-overlay',
46
+ 'motion-safe:transition-[opacity,translate,scale] motion-safe:duration-200 motion-safe:ease-swift',
47
+ animVisible
48
+ ? 'translate-y-0 scale-100 opacity-100'
49
+ : 'pointer-events-none translate-y-1.5 scale-95 opacity-0',
50
+ )}
51
+ >
30
52
  <div className="flex items-center justify-between border-b px-3 py-2">
31
53
  <span className="text-xs font-semibold">
32
54
  {format(plural(count, t.inspector.commentsCount), { count })}
33
55
  </span>
34
56
  <button
35
57
  type="button"
36
- className="text-muted-foreground hover:text-foreground"
58
+ aria-label={t.common.close}
59
+ className="-m-1 rounded-[5px] p-1 text-muted-foreground transition-[color,scale] duration-150 hover:text-foreground active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
37
60
  onClick={() => setOpen(false)}
38
61
  >
39
62
  <X className="size-3.5" />
40
63
  </button>
41
64
  </div>
42
- {error && <p className="px-3 py-2 text-xs text-red-600">{error}</p>}
65
+ {error && <p className="px-3 py-2 text-xs text-destructive">{error}</p>}
43
66
  {count === 0 ? (
44
67
  <p className="px-3 py-6 text-center text-xs text-muted-foreground">
45
68
  {t.inspector.commentsEmpty}
@@ -61,7 +84,8 @@ export function CommentWidget() {
61
84
  <button
62
85
  type="button"
63
86
  onClick={() => remove(c.id)}
64
- className="shrink-0 rounded p-1 text-muted-foreground hover:bg-muted hover:text-red-600"
87
+ className="shrink-0 rounded-[5px] p-1 text-muted-foreground transition-[color,background-color,scale] duration-150 hover:bg-muted hover:text-destructive active:scale-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
88
+ aria-label={t.inspector.commentDeleteAria}
65
89
  title={t.inspector.commentDeleteAria}
66
90
  >
67
91
  <Trash2 className="size-3.5" />
@@ -81,12 +105,14 @@ export function CommentWidget() {
81
105
  </div>
82
106
  )}
83
107
  <button
108
+ ref={fabRef}
84
109
  type="button"
85
110
  onClick={() => setOpen((o) => !o)}
86
- className="flex items-center gap-2 rounded-full border bg-card px-3 py-2 text-xs font-medium shadow-lg hover:bg-muted"
111
+ className="flex items-center gap-2 rounded-full border bg-card px-3 py-2 text-xs font-medium shadow-floating transition-[background-color,scale] duration-150 hover:bg-muted active:scale-[0.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40"
112
+ aria-expanded={open}
87
113
  >
88
114
  <MessageSquare className="size-4" />
89
- {count}
115
+ <span className="nums">{count}</span>
90
116
  </button>
91
117
  </div>
92
118
  );
@@ -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' }))}