@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
@@ -15,16 +15,11 @@ const en = {
15
15
  loadFailed: "Load failed",
16
16
  failedToLoadSlide: "Failed to load slide",
17
17
  home: "Home",
18
- backToHome: "Back to home",
19
- preview: "Preview",
20
18
  add: "Add",
21
19
  done: "Done",
22
20
  tryAgain: "Try again",
23
21
  undo: "Undo",
24
22
  redo: "Redo",
25
- light: "Light",
26
- dark: "Dark",
27
- system: "System",
28
23
  selected: "Selected"
29
24
  },
30
25
  notFound: {
@@ -128,7 +123,6 @@ const en = {
128
123
  loadingAssetsEyebrow: "Loading assets",
129
124
  emptyEyebrow: "Empty",
130
125
  nothingToShow: "Nothing to show.",
131
- emptyHintPrefix: "",
132
126
  emptyHintMust: " must ",
133
127
  emptyHintSuffix: " a non-empty array of components."
134
128
  },
@@ -234,7 +228,6 @@ const en = {
234
228
  cropFitCover: "Fill",
235
229
  cropFitContain: "Fit",
236
230
  cropApply: "Apply",
237
- cropResetAria: "Reset crop",
238
231
  leaveComment: "Leave a comment",
239
232
  commentPlaceholder: "Describe a change for the agent…",
240
233
  commentShortcutHint: "⌘/ to focus · ⌘↵ to add",
@@ -252,7 +245,9 @@ const en = {
252
245
  commentsApplyHintPrefix: "Run ",
253
246
  commentsApplyHintSuffix: " in your agent to apply these.",
254
247
  commentDeleteAria: "Delete",
255
- saveFailed: "Couldn't save:"
248
+ saveFailed: "Couldn't save:",
249
+ decreaseFontSize: "Decrease font size",
250
+ increaseFontSize: "Increase font size"
256
251
  },
257
252
  stylePanel: {
258
253
  designTokens: "Design tokens",
@@ -462,7 +457,6 @@ const en = {
462
457
  collapsePromptAria: "Collapse prompt"
463
458
  }
464
459
  };
465
-
466
460
  //#endregion
467
461
  //#region src/locale/ja.ts
468
462
  const ja = {
@@ -481,16 +475,11 @@ const ja = {
481
475
  loadFailed: "読み込みに失敗",
482
476
  failedToLoadSlide: "スライドの読み込みに失敗しました",
483
477
  home: "ホーム",
484
- backToHome: "ホームへ戻る",
485
- preview: "プレビュー",
486
478
  add: "追加",
487
479
  done: "完了",
488
480
  tryAgain: "再試行",
489
481
  undo: "元に戻す",
490
482
  redo: "やり直す",
491
- light: "ライト",
492
- dark: "ダーク",
493
- system: "システム",
494
483
  selected: "選択中"
495
484
  },
496
485
  notFound: {
@@ -594,7 +583,6 @@ const ja = {
594
583
  loadingAssetsEyebrow: "アセットを読み込み中",
595
584
  emptyEyebrow: "空",
596
585
  nothingToShow: "表示する内容がありません。",
597
- emptyHintPrefix: "",
598
586
  emptyHintMust: " は ",
599
587
  emptyHintSuffix: " で空でないコンポーネント配列をエクスポートする必要があります。"
600
588
  },
@@ -696,7 +684,6 @@ const ja = {
696
684
  cropFitCover: "塗りつぶす",
697
685
  cropFitContain: "全体表示",
698
686
  cropApply: "適用",
699
- cropResetAria: "トリミングをリセット",
700
687
  agentWatching: "エージェント監視中",
701
688
  agentWatchingTooltip: "選択中の要素はエージェントにリアルタイムで同期されています。",
702
689
  agentNotWatching: "エージェント未接続",
@@ -718,7 +705,9 @@ const ja = {
718
705
  commentsApplyHintPrefix: "エージェントで ",
719
706
  commentsApplyHintSuffix: " を実行して適用してください。",
720
707
  commentDeleteAria: "削除",
721
- saveFailed: "保存に失敗しました:"
708
+ saveFailed: "保存に失敗しました:",
709
+ decreaseFontSize: "フォントサイズを縮小",
710
+ increaseFontSize: "フォントサイズを拡大"
722
711
  },
723
712
  stylePanel: {
724
713
  designTokens: "デザイントークン",
@@ -928,7 +917,6 @@ const ja = {
928
917
  collapsePromptAria: "プロンプトを折りたたむ"
929
918
  }
930
919
  };
931
-
932
920
  //#endregion
933
921
  //#region src/locale/zh-cn.ts
934
922
  const zhCN = {
@@ -947,16 +935,11 @@ const zhCN = {
947
935
  loadFailed: "加载失败",
948
936
  failedToLoadSlide: "无法加载幻灯片",
949
937
  home: "首页",
950
- backToHome: "返回首页",
951
- preview: "预览",
952
938
  add: "添加",
953
939
  done: "完成",
954
940
  tryAgain: "重试",
955
941
  undo: "撤销",
956
942
  redo: "重做",
957
- light: "浅色",
958
- dark: "深色",
959
- system: "系统",
960
943
  selected: "已选中"
961
944
  },
962
945
  notFound: {
@@ -1060,7 +1043,6 @@ const zhCN = {
1060
1043
  loadingAssetsEyebrow: "加载资源中",
1061
1044
  emptyEyebrow: "空白",
1062
1045
  nothingToShow: "没有可显示的内容。",
1063
- emptyHintPrefix: "",
1064
1046
  emptyHintMust: " 必须 ",
1065
1047
  emptyHintSuffix: " 一个非空的组件数组。"
1066
1048
  },
@@ -1162,7 +1144,6 @@ const zhCN = {
1162
1144
  cropFitCover: "填满",
1163
1145
  cropFitContain: "完整显示",
1164
1146
  cropApply: "应用",
1165
- cropResetAria: "重置裁剪",
1166
1147
  agentWatching: "Agent 正在关注",
1167
1148
  agentWatchingTooltip: "选取的元素会即时同步给 agent。",
1168
1149
  agentNotWatching: "Agent 没在关注",
@@ -1184,7 +1165,9 @@ const zhCN = {
1184
1165
  commentsApplyHintPrefix: "在你的代理中运行 ",
1185
1166
  commentsApplyHintSuffix: " 以应用这些更改。",
1186
1167
  commentDeleteAria: "删除",
1187
- saveFailed: "保存失败:"
1168
+ saveFailed: "保存失败:",
1169
+ decreaseFontSize: "缩小字号",
1170
+ increaseFontSize: "放大字号"
1188
1171
  },
1189
1172
  stylePanel: {
1190
1173
  designTokens: "设计样式",
@@ -1394,7 +1377,6 @@ const zhCN = {
1394
1377
  collapsePromptAria: "收起 prompt"
1395
1378
  }
1396
1379
  };
1397
-
1398
1380
  //#endregion
1399
1381
  //#region src/locale/zh-tw.ts
1400
1382
  const zhTW = {
@@ -1413,16 +1395,11 @@ const zhTW = {
1413
1395
  loadFailed: "載入失敗",
1414
1396
  failedToLoadSlide: "無法載入投影片",
1415
1397
  home: "首頁",
1416
- backToHome: "返回首頁",
1417
- preview: "預覽",
1418
1398
  add: "新增",
1419
1399
  done: "完成",
1420
1400
  tryAgain: "重試",
1421
1401
  undo: "復原",
1422
1402
  redo: "重做",
1423
- light: "淺色",
1424
- dark: "深色",
1425
- system: "系統",
1426
1403
  selected: "已選取"
1427
1404
  },
1428
1405
  notFound: {
@@ -1526,7 +1503,6 @@ const zhTW = {
1526
1503
  loadingAssetsEyebrow: "載入資源中",
1527
1504
  emptyEyebrow: "空白",
1528
1505
  nothingToShow: "沒有可顯示的內容。",
1529
- emptyHintPrefix: "",
1530
1506
  emptyHintMust: " 必須 ",
1531
1507
  emptyHintSuffix: " 一個非空的元件陣列。"
1532
1508
  },
@@ -1628,7 +1604,6 @@ const zhTW = {
1628
1604
  cropFitCover: "填滿",
1629
1605
  cropFitContain: "完整顯示",
1630
1606
  cropApply: "套用",
1631
- cropResetAria: "重設裁切",
1632
1607
  agentWatching: "Agent 正在關注",
1633
1608
  agentWatchingTooltip: "選取的元素會即時同步給 agent。",
1634
1609
  agentNotWatching: "Agent 沒在關注",
@@ -1650,7 +1625,9 @@ const zhTW = {
1650
1625
  commentsApplyHintPrefix: "在你的代理中執行 ",
1651
1626
  commentsApplyHintSuffix: " 以套用這些變更。",
1652
1627
  commentDeleteAria: "刪除",
1653
- saveFailed: "儲存失敗:"
1628
+ saveFailed: "儲存失敗:",
1629
+ decreaseFontSize: "縮小字級",
1630
+ increaseFontSize: "放大字級"
1654
1631
  },
1655
1632
  stylePanel: {
1656
1633
  designTokens: "設計樣式",
@@ -1860,18 +1837,5 @@ const zhTW = {
1860
1837
  collapsePromptAria: "收合 prompt"
1861
1838
  }
1862
1839
  };
1863
-
1864
- //#endregion
1865
- //#region src/locale/format.ts
1866
- function format(template, vars) {
1867
- return template.replace(/\{(\w+)\}/g, (m, key) => {
1868
- const v = vars[key];
1869
- return v === void 0 ? m : String(v);
1870
- });
1871
- }
1872
- function plural(count, forms) {
1873
- return count === 1 ? forms.one : forms.other;
1874
- }
1875
-
1876
1840
  //#endregion
1877
- export { en, format, ja, plural, zhCN, zhTW };
1841
+ export { en as i, zhCN as n, ja as r, zhTW as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-slide/core",
3
- "version": "1.19.0",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "Runtime and CLI for open-slide — write slides in slides/, we handle the rest.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -33,7 +33,7 @@
33
33
  "README.md"
34
34
  ],
35
35
  "engines": {
36
- "node": ">=18"
36
+ "node": "^20.19.0 || >=22.12.0"
37
37
  },
38
38
  "keywords": [
39
39
  "slides",
@@ -67,7 +67,7 @@
67
67
  "@dnd-kit/utilities": "^3.2.2",
68
68
  "@fontsource-variable/geist": "^5.2.8",
69
69
  "@tailwindcss/vite": "^4.3.3",
70
- "@vitejs/plugin-react": "^4.3.3",
70
+ "@vitejs/plugin-react": "^6.1.0",
71
71
  "chalk": "^6.0.0",
72
72
  "class-variance-authority": "^0.7.1",
73
73
  "clsx": "^2.1.1",
@@ -79,25 +79,25 @@
79
79
  "html-to-image": "^1.11.13",
80
80
  "lucide-react": "^1.25.0",
81
81
  "next-themes": "^0.4.6",
82
- "react": "^18.3.1",
83
- "react-dom": "^18.3.1",
82
+ "react": "^19.2.8",
83
+ "react-dom": "^19.2.8",
84
84
  "react-image-crop": "^11.0.10",
85
85
  "react-router-dom": "^7.18.1",
86
86
  "shadcn": "^4.12.0",
87
87
  "sonner": "^2.0.7",
88
88
  "tailwind-merge": "^3.5.0",
89
- "tailwindcss": "^4.2.2",
89
+ "tailwindcss": "^4.3.3",
90
90
  "tw-animate-css": "^1.4.0",
91
91
  "use-sync-external-store": "^1.6.0",
92
- "vite": "^5.4.10"
92
+ "vite": "^8.2.2"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@playwright/test": "~1.62.1",
96
- "@types/node": "^22.19.17",
97
- "@types/react": "^18.3.12",
98
- "@types/react-dom": "^18.3.1",
99
- "tsdown": "^0.9.9",
100
- "typescript": "^5.9.3"
96
+ "@types/node": "^26.2.0",
97
+ "@types/react": "^19.2.18",
98
+ "@types/react-dom": "^19.2.5",
99
+ "tsdown": "^0.22.14",
100
+ "typescript": "^7.0.2"
101
101
  },
102
102
  "scripts": {
103
103
  "build": "tsdown",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: create-slide
3
- description: Use this skill when the user wants to create, draft, author, or generate new slides / a presentation in this open-slide repo. Triggers on phrases like "make slides about X", "make a deck about X", "create a presentation", "draft slides for", "new slide", or when the user asks to add content under `slides/`. Do NOT use for editing the framework itself — only for authoring content inside `slides/<id>/`.
3
+ description: Use this skill when the user wants to create, draft, author, or generate new slides / a presentation in this open-slide repo. Triggers on phrases like "make slides about X", "make a deck about X", "create a presentation", "draft slides for", "new slide", "a deck with speaker notes / a script", or when the user asks to add content under `slides/`. Do NOT use for editing the framework itself — only for authoring content inside `slides/<id>/`.
4
4
  ---
5
5
 
6
6
  # Create a slide in open-slide
@@ -76,6 +76,8 @@ If the `frontend-design` skill is available, consult it for deeper aesthetic gui
76
76
 
77
77
  Read the **`slide-authoring`** skill before writing — it covers the file contract, canvas rules, type scale, spacing, and asset imports, and it includes a starter template you can copy. Don't duplicate that knowledge here; use it.
78
78
 
79
+ If the user asked for a speech script / speaker notes (in the initial request or at any point after), write it into the slide's `export const notes` array — the framework's built-in speaker-notes feature, shown in the presenter view. See **Speaker notes** in `slide-authoring` for the contract. Never deliver a script as a markdown or text file.
80
+
79
81
  ## Step 7 — Self-review
80
82
 
81
83
  Run the checklist in `slide-authoring` ("Self-review before finishing"). It covers structural correctness, layout discipline, and asset existence.
@@ -86,6 +88,7 @@ Tell the user:
86
88
 
87
89
  - The slide id and file path you created.
88
90
  - That the dev server will hot-reload — they can open `http://localhost:5173/s/<id>` (or refresh the home page).
91
+ - If you wrote speaker notes: that they live in the slide's `notes` export and show up in the viewer's notes drawer and the presenter view in present mode.
89
92
  - If dev isn't running: run the project's `dev` script from the project root with its package manager (`npm run dev`, `pnpm dev`, … — match the lockfile).
90
93
 
91
94
  Don't run the dev server yourself unless asked.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: slide-authoring
3
- description: Technical reference for writing or editing open-slide pages — file contract, 1920×1080 canvas, type scale, layout, palette/visual direction, assets, stepped reveals, page transitions, and morph transitions. Consult this whenever you are about to write or modify any file under `slides/<id>/`, including from inside the `create-slide` or `apply-comments` workflows, or for any ad-hoc slide edit. Triggers on phrases like "edit slide", "tweak this page", "fix the layout", "change the palette", "reveal one by one", "add a transition", "morph transition", "investigate the slide framework", "how do slides work here".
3
+ description: Technical reference for writing or editing open-slide pages — file contract, 1920×1080 canvas, type scale, layout, palette/visual direction, assets, speaker notes, stepped reveals, page transitions, and morph transitions. Consult this whenever you are about to write or modify any file under `slides/<id>/`, including from inside the `create-slide` or `apply-comments` workflows, or for any ad-hoc slide edit. Triggers on phrases like "edit slide", "tweak this page", "fix the layout", "change the palette", "reveal one by one", "add a transition", "morph transition", "write the speaker notes", "generate the script / talk track", "investigate the slide framework", "how do slides work here".
4
4
  ---
5
5
 
6
6
  # Authoring open-slide pages
@@ -34,7 +34,7 @@ Each framework primitive has a full reference file under `references/` in this s
34
34
  - Entry is `slides/<id>/index.tsx`. Images/videos/fonts go under `slides/<id>/assets/`.
35
35
  - Do **not** touch `package.json`, `open-slide.config.ts`, or other slides.
36
36
  - Do not add dependencies. Only `react`, `@open-slide/core`, and standard web APIs are available.
37
- - A slide is **one `index.tsx` plus `assets/`** — nothing else. Do not create sibling `.tsx`/`.ts` files (`Card.tsx`, `components/`, `helpers.ts`, etc.); helper components and constants go inside `index.tsx`. Do not create `README.md` or other prose files either.
37
+ - A slide is **one `index.tsx` plus `assets/`** — nothing else. Do not create sibling `.tsx`/`.ts` files (`Card.tsx`, `components/`, `helpers.ts`, etc.); helper components and constants go inside `index.tsx`. Do not create `README.md` or other prose files either — speaker notes / a talk script belong in the `notes` export (see **Speaker notes** below), not in a markdown file.
38
38
 
39
39
  ## File contract
40
40
 
@@ -58,6 +58,27 @@ export default [Cover, Body] satisfies Page[];
58
58
  - `meta.theme` (optional) marks the slide as built from a theme under `themes/`. The id must match a `<id>.md` basename. Surfaces a back-link chip on the slide card and lists the slide on `/themes/<id>`. Omit if the slide isn't derived from a registered theme.
59
59
  - `meta.createdAt` is an **ISO 8601 string literal** (e.g. `'2026-05-16T12:00:00Z'`) set once when the slide is scaffolded. The home page uses it for the default "newest first" sort. Always include it on new slides — **immediately before writing the file, run `node -e "console.log(new Date().toISOString())"` via Bash and paste the exact output** as the value. Don't type a timestamp from memory — you will get the date or time wrong. Must be a plain string literal (no `new Date(...)` or imports in the slide itself) — the framework reads it via a regex at build time, not by evaluating the module.
60
60
 
61
+ ## Speaker notes (`notes` export)
62
+
63
+ The framework has **built-in speaker notes**: an optional `notes` export in `index.tsx`, index-aligned with the default page array. The viewer shows them in the notes drawer and present mode shows them in the presenter view next to the timer.
64
+
65
+ **When the user asks for a speech script, talk track, or presenter notes — in any language — write it into this export, never into a markdown/text file.** A `script.md` or `notes.md` is invisible to the runtime; the `notes` export is the only place the presenter view reads.
66
+
67
+ ```tsx
68
+ export const notes: (string | undefined)[] = [
69
+ 'Open with the analyst quote, then introduce yourself.',
70
+ undefined,
71
+ `Walk through the three pillars, one beat each.
72
+ Pause for questions before moving on.`,
73
+ ];
74
+ ```
75
+
76
+ - One entry per page, same order as the `export default` array. `notes[0]` belongs to the first page.
77
+ - Entries are **plain text** — line breaks are preserved, markdown is not rendered. Use a template literal for multi-line notes, a normal string for one-liners.
78
+ - Use `undefined` for a page with no notes; trailing `undefined` entries can be dropped.
79
+ - When you add, remove, or reorder pages, re-align `notes` in the same edit — a shifted index silently attaches the wrong script to every page after it.
80
+ - Write notes as something to *say*, not a summary of what's on screen: openers, transitions, numbers to cite, timing cues.
81
+
61
82
  ## Editing an existing slide
62
83
 
63
84
  A finished slide commonly runs 1000–1800 lines. When you only need to touch one page, **don't read the whole file** — locate the page first, then read just that range:
@@ -331,6 +352,7 @@ This applies whenever the *visual element* repeats, not whenever the *data* does
331
352
  - [ ] If a page uses `<Steps>`/`<Step>`, every `<Step>` is a direct child of a `<Steps>`, and the page still reads as complete when jumped to via the overview grid (entering forward builds up; jumping in shows it fully revealed).
332
353
  - [ ] If a `SlideTransition` is declared, every page sits in one family — same duration band (140–280 ms), same easing pair, same out-then-in stagger, magnitude under 12 px / 3%. No six-different-vocabularies decks. When in doubt, omit transitions entirely. (Pages that opt into `morph` may exceed the band to match the morph — see `references/morph.md`.)
333
354
  - [ ] If a transition opts into `morph`: every morph `id` is unique per page and stable across the pair, morph geometry is pixel-constant (never measured after mount), no `transform` sits on the morph node, and entrance animations are gated behind `useIsActivePage()`.
355
+ - [ ] If the user asked for a speech script / speaker notes, it lives in `export const notes` (index-aligned with the page array) — not in a markdown or text file.
334
356
  - [ ] Nothing outside `slides/<id>/` was edited.
335
357
 
336
358
  ## Anti-patterns
@@ -346,5 +368,6 @@ This applies whenever the *visual element* repeats, not whenever the *data* does
346
368
  - ❌ Installing packages. Only `react`, `@open-slide/core`, and standard web APIs are available.
347
369
  - ❌ Writing CSS to a shared file. Inline styles or scoped classnames only.
348
370
  - ❌ Creating `README.md` or other prose files inside the slide folder.
371
+ - ❌ Delivering a speech script as a markdown or text file. The runtime only surfaces the `notes` export — anything else never reaches the presenter view.
349
372
  - ❌ Editing `package.json`, `open-slide.config.ts`, or other slides.
350
373
  - ❌ Using a primitive without reading its reference file — each `references/*.md` carries the primitive's own anti-pattern list (placeholder misuse, transition vocabulary, `<Step>` nesting, morph geometry).
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,23 @@ 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="/s/:slideId" element={<Slide />} />
29
+ <Route path="/s/:slideId/presenter" element={<Presenter />} />
30
+ <Route path="*" element={<NotFound />} />
31
+ </Routes>
32
+ </TooltipProvider>
30
33
  <Toaster />
31
34
  </BrowserRouter>
32
35
  );
Binary file
@@ -60,6 +60,7 @@ import {
60
60
  type AssetEntry,
61
61
  type AssetUsage,
62
62
  fetchSvgAsFile,
63
+ GLOBAL_ASSET_SCOPE,
63
64
  listAssetUsages,
64
65
  renamedCopy,
65
66
  revertAssetUsage,
@@ -67,15 +68,15 @@ import {
67
68
  searchSvgl,
68
69
  useAssets,
69
70
  } from '@/lib/assets';
71
+ import { dragHasFiles } from '@/lib/dom';
70
72
  import { format, useLocale } from '@/lib/use-locale';
71
- import { cn } from '@/lib/utils';
73
+ import { cn, pad2 } from '@/lib/utils';
72
74
 
73
75
  type Props = { slideId: string | null };
74
76
 
75
77
  type Scope = 'slide' | 'global';
76
78
  type ViewMode = 'grid' | 'list';
77
79
 
78
- const GLOBAL_SLIDE_ID = '@global';
79
80
  const VIEW_MODE_STORAGE_KEY = 'open-slide:asset-view-mode';
80
81
  const SORT_STORAGE_KEY = 'open-slide:asset-sort-v1';
81
82
  const GRID_COLUMNS_STORAGE_KEY = 'open-slide:asset-grid-columns-v1';
@@ -164,7 +165,7 @@ type ConflictState = {
164
165
  export function AssetView({ slideId }: Props) {
165
166
  const lockedToGlobal = slideId === null;
166
167
  const [scope, setScope] = useState<Scope>(lockedToGlobal ? 'global' : 'slide');
167
- const effectiveSlideId = scope === 'global' || slideId === null ? GLOBAL_SLIDE_ID : slideId;
168
+ const effectiveSlideId = scope === 'global' || slideId === null ? GLOBAL_ASSET_SCOPE : slideId;
168
169
  const { assets, loading, available, upload, rename, remove } = useAssets(effectiveSlideId);
169
170
  const [dragActive, setDragActive] = useState(false);
170
171
  const [conflict, setConflict] = useState<ConflictState | null>(null);
@@ -296,13 +297,13 @@ export function AssetView({ slideId }: Props) {
296
297
  aria-label={t.asset.sectionAria}
297
298
  className={cn('relative flex h-full flex-col bg-background')}
298
299
  onDragEnter={(e) => {
299
- if (!hasFiles(e)) return;
300
+ if (!dragHasFiles(e)) return;
300
301
  e.preventDefault();
301
302
  dragDepth.current += 1;
302
303
  setDragActive(true);
303
304
  }}
304
305
  onDragOver={(e) => {
305
- if (!hasFiles(e)) return;
306
+ if (!dragHasFiles(e)) return;
306
307
  e.preventDefault();
307
308
  e.dataTransfer.dropEffect = 'copy';
308
309
  }}
@@ -311,7 +312,7 @@ export function AssetView({ slideId }: Props) {
311
312
  if (dragDepth.current === 0) setDragActive(false);
312
313
  }}
313
314
  onDrop={(e) => {
314
- if (!hasFiles(e)) return;
315
+ if (!dragHasFiles(e)) return;
315
316
  e.preventDefault();
316
317
  dragDepth.current = 0;
317
318
  setDragActive(false);
@@ -341,7 +342,7 @@ export function AssetView({ slideId }: Props) {
341
342
  <span className="mx-2 opacity-50">·</span>
342
343
  <span className="folio">
343
344
  {format(assets.length === 1 ? t.asset.fileCount.one : t.asset.fileCount.other, {
344
- count: assets.length.toString().padStart(2, '0'),
345
+ count: pad2(assets.length),
345
346
  })}
346
347
  </span>
347
348
  </>
@@ -547,21 +548,28 @@ export function AssetView({ slideId }: Props) {
547
548
  )}
548
549
  </div>
549
550
 
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>
551
+ <div
552
+ className={cn(
553
+ 'pointer-events-none absolute inset-0 z-30 motion-safe:transition-opacity motion-safe:duration-150',
554
+ dragActive ? 'opacity-100' : 'opacity-0',
555
+ )}
556
+ aria-hidden="true"
557
+ >
558
+ <div className="absolute inset-0 bg-brand/5" />
559
+ <div className="absolute inset-2 rounded-[10px] border border-dashed border-brand/40" />
560
+ <div className="absolute inset-x-0 bottom-8 flex justify-center">
561
+ <div
562
+ className={cn(
563
+ 'flex items-center gap-2 rounded-[6px] border border-border bg-card px-3 py-1.5 text-[12px] font-medium shadow-floating',
564
+ 'ease-swift motion-safe:transition-[opacity,translate] motion-safe:duration-200',
565
+ dragActive ? 'translate-y-0 opacity-100' : 'translate-y-1 opacity-0',
566
+ )}
567
+ >
568
+ <ArrowDownToLine className="size-3.5 text-brand" />
569
+ <span>{t.asset.dropToUpload}</span>
562
570
  </div>
563
571
  </div>
564
- )}
572
+ </div>
565
573
 
566
574
  {conflict && (
567
575
  <ConflictDialog
@@ -708,15 +716,6 @@ function GridColumnsControl({
708
716
  );
709
717
  }
710
718
 
711
- function hasFiles(e: React.DragEvent): boolean {
712
- const types = e.dataTransfer?.types;
713
- if (!types) return false;
714
- for (let i = 0; i < types.length; i++) {
715
- if (types[i] === 'Files') return true;
716
- }
717
- return false;
718
- }
719
-
720
719
  function AssetSortControl({
721
720
  sort,
722
721
  onKeyChange,
@@ -806,7 +805,7 @@ function SortableColumnHeader({
806
805
  <DirectionIcon className="size-2.5 shrink-0" aria-hidden />
807
806
  ) : (
808
807
  <ArrowUpDown
809
- className="size-2.5 shrink-0 opacity-0 transition-opacity group-hover:opacity-60 group-focus-visible:opacity-60"
808
+ 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
809
  aria-hidden
811
810
  />
812
811
  )}
@@ -872,7 +871,7 @@ function AssetCard({
872
871
  const isImage = asset.mime.startsWith('image/');
873
872
  const t = useLocale();
874
873
  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">
874
+ <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
875
  <button
877
876
  type="button"
878
877
  onClick={onPreview}
@@ -934,7 +933,7 @@ function AssetListItem({
934
933
  const isImage = asset.mime.startsWith('image/');
935
934
  const t = useLocale();
936
935
  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">
936
+ <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
937
  <button
939
938
  type="button"
940
939
  onClick={onPreview}
@@ -1012,7 +1011,7 @@ function AssetActions({
1012
1011
  aria-label={format(t.asset.actionsAria, { name: asset.name })}
1013
1012
  className={cn(
1014
1013
  buttonVariants({ variant: 'ghost', size: 'icon-xs' }),
1015
- 'opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100',
1014
+ 'opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100 [@media(hover:none)]:opacity-100',
1016
1015
  )}
1017
1016
  >
1018
1017
  <MoreVertical />
@@ -1457,7 +1456,7 @@ function LogoSearchDialog({
1457
1456
  {SKELETON_SLOTS.map((slot) => (
1458
1457
  <div
1459
1458
  key={slot}
1460
- className="aspect-square animate-pulse rounded-lg border bg-muted/40"
1459
+ className="aspect-square animate-pulse rounded-lg border bg-muted/40 motion-reduce:animate-none"
1461
1460
  />
1462
1461
  ))}
1463
1462
  </div>
@@ -1581,8 +1580,10 @@ function LogoResultCard({
1581
1580
  type="button"
1582
1581
  onClick={() => setVariant('light')}
1583
1582
  className={cn(
1584
- 'px-1.5 py-0.5 transition-colors',
1585
- variant === 'light' ? 'bg-foreground text-background' : 'hover:bg-muted',
1583
+ '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',
1584
+ variant === 'light'
1585
+ ? 'bg-foreground text-background'
1586
+ : 'hover:bg-muted active:bg-muted',
1586
1587
  )}
1587
1588
  >
1588
1589
  {t.asset.logoVariantLight}
@@ -1591,8 +1592,10 @@ function LogoResultCard({
1591
1592
  type="button"
1592
1593
  onClick={() => setVariant('dark')}
1593
1594
  className={cn(
1594
- 'border-l px-1.5 py-0.5 transition-colors',
1595
- variant === 'dark' ? 'bg-foreground text-background' : 'hover:bg-muted',
1595
+ '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',
1596
+ variant === 'dark'
1597
+ ? 'bg-foreground text-background'
1598
+ : 'hover:bg-muted active:bg-muted',
1596
1599
  )}
1597
1600
  >
1598
1601
  {t.asset.logoVariantDark}
@@ -1613,7 +1616,11 @@ function LogoResultCard({
1613
1616
  }}
1614
1617
  className="ml-auto h-6 px-2 text-[11px]"
1615
1618
  >
1616
- {pending ? <Loader2 className="size-3 animate-spin" /> : t.common.add}
1619
+ {pending ? (
1620
+ <Loader2 className="size-3 animate-spin motion-reduce:animate-none" />
1621
+ ) : (
1622
+ t.common.add
1623
+ )}
1617
1624
  </Button>
1618
1625
  </div>
1619
1626
  </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,