@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
@@ -1,5 +1,5 @@
1
1
  import "./design-cpzS8aud.js";
2
- import { createViteConfig } from "./config-CCHio3pk.js";
2
+ import { createViteConfig } from "./config-GA6NMgs_.js";
3
3
  import path from "node:path";
4
4
  import { build as build$1, mergeConfig } from "vite";
5
5
 
package/dist/cli/bin.js CHANGED
@@ -57,15 +57,15 @@ async function run(argv) {
57
57
  program.name("open-slide").description("Author slides — we handle the Vite/React stack.").version(version, "-v, --version", "print version").helpOption("-h, --help", "show help").showHelpAfterError(chalk.dim("(run `open-slide --help` for usage)"));
58
58
  program.command("dev").description("Start the dev server").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").option("--no-skills-check", "skip the built-in skills drift check").action(async (flags) => {
59
59
  if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
60
- const { dev } = await import("../dev-DLRQoCkT.js");
60
+ const { dev } = await import("../dev-D57ui2yV.js");
61
61
  await dev(flags);
62
62
  });
63
63
  program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
64
- const { build } = await import("../build-DaL4Gjn-.js");
64
+ const { build } = await import("../build-CaV_vhIw.js");
65
65
  await build(flags);
66
66
  });
67
67
  program.command("preview").description("Preview the production build").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").action(async (flags) => {
68
- const { preview } = await import("../preview-D3qVGc0S.js");
68
+ const { preview } = await import("../preview-D40Zw_o0.js");
69
69
  await preview(flags);
70
70
  });
71
71
  program.command("sync:skills").description("Sync built-in skills from @open-slide/core into this workspace").option("--dry-run", "show what would change without writing").action(async (flags) => {
@@ -1,4 +1,4 @@
1
- import { Locale } from "./types-Wz88-Fe1.js";
1
+ import { Locale } from "./types-8HghULIe.js";
2
2
 
3
3
  //#region src/config.d.ts
4
4
  type OpenSlideBuildConfig = {
@@ -12,6 +12,7 @@ type OpenSlideConfig = {
12
12
  themesDir?: string;
13
13
  assetsDir?: string;
14
14
  port?: number;
15
+ allowedHosts?: string[] | true;
15
16
  /**
16
17
  * @deprecated Pick the UI language from the language switcher in the slide UI
17
18
  * instead. When set, this only seeds the initial language until the user
@@ -4326,6 +4326,7 @@ async function createViteConfig(opts) {
4326
4326
  },
4327
4327
  server: {
4328
4328
  port: config.port ?? 5173,
4329
+ ...config.allowedHosts !== void 0 ? { allowedHosts: config.allowedHosts } : {},
4329
4330
  fs: { allow: [
4330
4331
  APP_ROOT,
4331
4332
  userCwd,
@@ -1,5 +1,5 @@
1
1
  import "./design-cpzS8aud.js";
2
- import { DEV_SUPERVISED_ENV, RESTART_EXIT_CODE, createViteConfig } from "./config-CCHio3pk.js";
2
+ import { DEV_SUPERVISED_ENV, RESTART_EXIT_CODE, createViteConfig } from "./config-GA6NMgs_.js";
3
3
  import chalk from "chalk";
4
4
  import path from "node:path";
5
5
  import { existsSync } from "node:fs";
@@ -156,7 +156,10 @@ const en = {
156
156
  elapsed: "Elapsed",
157
157
  jump: "Jump",
158
158
  loadingSlide: "Loading {slideId}…",
159
- loadingAssets: "Loading assets…"
159
+ loadingAssets: "Loading assets…",
160
+ switchDeck: "Switch presentation",
161
+ searchDecks: "Search presentations…",
162
+ noDecksFound: "No presentations match"
160
163
  },
161
164
  present: {
162
165
  prevSlideAria: "Previous slide (←)",
@@ -619,7 +622,10 @@ const ja = {
619
622
  elapsed: "経過時間",
620
623
  jump: "ジャンプ",
621
624
  loadingSlide: "{slideId} を読み込み中…",
622
- loadingAssets: "アセットを読み込み中…"
625
+ loadingAssets: "アセットを読み込み中…",
626
+ switchDeck: "デッキを切り替え",
627
+ searchDecks: "デッキを検索…",
628
+ noDecksFound: "一致するデッキがありません"
623
629
  },
624
630
  present: {
625
631
  prevSlideAria: "前のスライド (←)",
@@ -1082,7 +1088,10 @@ const zhCN = {
1082
1088
  elapsed: "已用时",
1083
1089
  jump: "跳至",
1084
1090
  loadingSlide: "正在加载 {slideId}…",
1085
- loadingAssets: "正在加载资源…"
1091
+ loadingAssets: "正在加载资源…",
1092
+ switchDeck: "切换演示文稿",
1093
+ searchDecks: "搜索演示文稿…",
1094
+ noDecksFound: "没有匹配的演示文稿"
1086
1095
  },
1087
1096
  present: {
1088
1097
  prevSlideAria: "上一张幻灯片 (←)",
@@ -1545,7 +1554,10 @@ const zhTW = {
1545
1554
  elapsed: "已耗時",
1546
1555
  jump: "跳至",
1547
1556
  loadingSlide: "正在載入 {slideId}…",
1548
- loadingAssets: "正在載入資源…"
1557
+ loadingAssets: "正在載入資源…",
1558
+ switchDeck: "切換簡報",
1559
+ searchDecks: "搜尋簡報…",
1560
+ noDecksFound: "沒有符合的簡報"
1549
1561
  },
1550
1562
  present: {
1551
1563
  prevSlideAria: "上一張投影片 (←)",
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Locale, Plural } from "./types-Wz88-Fe1.js";
2
- import { OpenSlideConfig } from "./config-CYs4WJfL.js";
1
+ import { Locale, Plural } from "./types-8HghULIe.js";
2
+ import { OpenSlideConfig } from "./config-CDHB8Oow.js";
3
3
  import { CSSProperties, ComponentType, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
  import * as react_jsx_runtime1 from "react/jsx-runtime";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { en, ja, zhCN, zhTW } from "./format-CxPnpVRu.js";
1
+ import { en, ja, zhCN, zhTW } from "./format-74A3B6zu.js";
2
2
  import { cssVarsToString, defaultDesign, designToCssVars } from "./design-cpzS8aud.js";
3
3
  import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
4
4
  import { toast } from "sonner";
@@ -1,4 +1,4 @@
1
- import { Locale, Plural } from "../types-Wz88-Fe1.js";
1
+ import { Locale, Plural } from "../types-8HghULIe.js";
2
2
 
3
3
  //#region src/locale/en.d.ts
4
4
  declare const en: Locale;
@@ -1,3 +1,3 @@
1
- import { en, format, ja, plural, zhCN, zhTW } from "../format-CxPnpVRu.js";
1
+ import { en, format, ja, plural, zhCN, zhTW } from "../format-74A3B6zu.js";
2
2
 
3
3
  export { en, format, ja, plural, zhCN, zhTW };
@@ -1,5 +1,5 @@
1
1
  import "./design-cpzS8aud.js";
2
- import { createViteConfig } from "./config-CCHio3pk.js";
2
+ import { createViteConfig } from "./config-GA6NMgs_.js";
3
3
  import { mergeConfig, preview as preview$1 } from "vite";
4
4
 
5
5
  //#region src/cli/preview.ts
@@ -166,6 +166,9 @@ type Locale = {
166
166
  /** template: "Loading {slideId}…" */
167
167
  loadingSlide: string;
168
168
  loadingAssets: string;
169
+ switchDeck: string;
170
+ searchDecks: string;
171
+ noDecksFound: string;
169
172
  };
170
173
  present: {
171
174
  prevSlideAria: string;
@@ -1,5 +1,5 @@
1
- import "../types-Wz88-Fe1.js";
2
- import { OpenSlideConfig } from "../config-CYs4WJfL.js";
1
+ import "../types-8HghULIe.js";
2
+ import { OpenSlideConfig } from "../config-CDHB8Oow.js";
3
3
  import { InlineConfig } from "vite";
4
4
 
5
5
  //#region src/vite/config.d.ts
@@ -1,4 +1,4 @@
1
1
  import "../design-cpzS8aud.js";
2
- import { createViteConfig } from "../config-CCHio3pk.js";
2
+ import { createViteConfig } from "../config-GA6NMgs_.js";
3
3
 
4
4
  export { createViteConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-slide/core",
3
- "version": "1.18.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": {
@@ -92,7 +92,7 @@
92
92
  "vite": "^5.4.10"
93
93
  },
94
94
  "devDependencies": {
95
- "@playwright/test": "~1.56.1",
95
+ "@playwright/test": "~1.62.1",
96
96
  "@types/node": "^22.19.17",
97
97
  "@types/react": "^18.3.12",
98
98
  "@types/react-dom": "^18.3.1",
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
  );