immerslides 1.0.0-beta-6 → 1.0.0-beta-8

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 (72) hide show
  1. package/README.md +164 -106
  2. package/README.zh-TW.md +191 -74
  3. package/bin/immerslides.mjs +15 -5
  4. package/dist/code/HighlightedCode.d.ts +1 -0
  5. package/dist/code/HighlightedCode.js +11 -2
  6. package/dist/code/highlighting.js +3 -2
  7. package/dist/code/languages.d.ts +11 -0
  8. package/dist/code/languages.js +167 -0
  9. package/dist/i18n/messages.d.ts +7 -0
  10. package/dist/i18n/messages.js +14 -0
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +1 -0
  13. package/dist/player/index.d.ts +8 -0
  14. package/dist/player/index.js +8 -0
  15. package/dist/presentation/Player.js +41 -3
  16. package/dist/presentation/PlayerToolbar.d.ts +6 -2
  17. package/dist/presentation/PlayerToolbar.js +3 -3
  18. package/dist/presentation/Presenter.js +8 -50
  19. package/dist/presentation/PresenterPanels.d.ts +23 -0
  20. package/dist/presentation/PresenterPanels.js +27 -0
  21. package/dist/presentation/Stage.js +1 -1
  22. package/dist/presentation/types.d.ts +9 -0
  23. package/dist/presentation/useTimer.d.ts +7 -0
  24. package/dist/presentation/useTimer.js +40 -0
  25. package/dist/presenter-console/Clock.d.ts +4 -0
  26. package/dist/presenter-console/Clock.js +7 -0
  27. package/dist/presenter-console/ConsoleHeader.d.ts +10 -0
  28. package/dist/presenter-console/ConsoleHeader.js +8 -0
  29. package/dist/presenter-console/ConsoleLayout.d.ts +15 -0
  30. package/dist/presenter-console/ConsoleLayout.js +9 -0
  31. package/dist/presenter-console/ConsoleNavigation.d.ts +12 -0
  32. package/dist/presenter-console/ConsoleNavigation.js +8 -0
  33. package/dist/presenter-console/JumpSelect.d.ts +6 -0
  34. package/dist/presenter-console/JumpSelect.js +11 -0
  35. package/dist/presenter-console/PresenterConsole.d.ts +14 -0
  36. package/dist/presenter-console/PresenterConsole.js +26 -0
  37. package/dist/presenter-console/channel.d.ts +27 -0
  38. package/dist/presenter-console/channel.js +31 -0
  39. package/dist/presenter-console/index.d.ts +3 -0
  40. package/dist/presenter-console/index.js +5 -0
  41. package/dist/presenter-console/sync.d.ts +7 -0
  42. package/dist/presenter-console/sync.js +31 -0
  43. package/dist/presenter-console/usePresenterConsole.d.ts +19 -0
  44. package/dist/presenter-console/usePresenterConsole.js +70 -0
  45. package/dist/site/Site.js +10 -175
  46. package/dist/site/SitePage.d.ts +16 -0
  47. package/dist/site/SitePage.js +51 -0
  48. package/dist/site/hooks.d.ts +8 -0
  49. package/dist/site/hooks.js +137 -0
  50. package/dist/site/model.d.ts +22 -0
  51. package/dist/site/model.js +8 -0
  52. package/dist/slides/ChapterRail.js +3 -1
  53. package/dist/slides/SlideFrame.d.ts +7 -3
  54. package/dist/slides/SlideFrame.js +4 -2
  55. package/dist/styles/base.css +1208 -0
  56. package/dist/styles/presenter.css +260 -0
  57. package/dist/styles/site.css +239 -0
  58. package/dist/styles.css +61 -1
  59. package/package.json +18 -3
  60. package/skills/immerslides/SKILL.md +44 -34
  61. package/skills/immerslides/references/authoring.md +4 -2
  62. package/skills/immerslides/references/composition.md +18 -26
  63. package/skills/immerslides/references/features.md +31 -28
  64. package/skills/immerslides/references/presenter.md +28 -0
  65. package/skills/immerslides/references/site.md +1 -1
  66. package/skills/immerslides-en/SKILL.md +40 -30
  67. package/skills/immerslides-en/references/authoring.md +4 -2
  68. package/skills/immerslides-en/references/composition.md +18 -26
  69. package/skills/immerslides-en/references/features.md +31 -28
  70. package/skills/immerslides-en/references/presenter.md +28 -0
  71. package/skills/immerslides-en/references/site.md +1 -1
  72. package/starter/package.json +1 -1
package/README.md CHANGED
@@ -10,86 +10,89 @@
10
10
  ![pnpm 12.20.0](https://img.shields.io/badge/pnpm-12.20.0-F69220?logo=pnpm&logoColor=white)
11
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
12
12
 
13
- React presentations with immersive code and flow walkthroughs. Build slides from composable React components, step through code and flows one focus at a time, and publish the same deck as a scrolling reading site.
13
+ React presentations with immersive code and flow walkthroughs. Write slides as React components, reveal code and flows one focus at a time, and publish the same deck as a scrolling reading site.
14
14
 
15
15
  **English** | [繁體中文](README.zh-TW.md)
16
16
 
17
17
  ## Features
18
18
 
19
- - **Full-page clicks.** One click advances to the next complete slide. Extra steps are added only where a talk needs them.
20
- - **Immersive code walkthroughs.** `CodeBlock` shows highlighted code, and `CodeWindow` provides the window frame. Syntax highlighting covers languages such as TypeScript, Python, Java, SQL, JSON, YAML, Bash, HTML, and CSS.
21
- - **Flow timelines.** `Timeline`, `FlowNode`, and `FlowConnector` show processes and their steps.
22
- - **Presenter mode.** Press `P` to open a window with the current slide, the next slide, speaker notes, and a timer.
23
- - **Slide navigator.** Press `O` to browse chapters and slides as an outline or as thumbnails, and filter by marked slides.
24
- - **Shareable URLs.** Every slide and step has a hash URL, such as `/#/code-walkthrough?step=2`. URLs survive reloads and work with browser history.
25
- - **Scrolling site view.** `Site` and `SiteStory` render the same deck as a long-form reading page.
26
- - **Reduced motion.** When the user prefers reduced motion, transitions are disabled and all content stays visible.
19
+ - **Full-page clicks.** One click advances to the next complete slide. Add extra steps only where the talk needs them.
20
+ - **Code walkthroughs.** `CodeBlock` highlights code in TypeScript, Python, Java, SQL, JSON, YAML, Bash, HTML, CSS, and more, and steps through it one focus at a time.
21
+ - **Flow timelines.** `Timeline`, `FlowNode`, and `FlowConnector` show a process and its steps.
22
+ - **Presenter mode.** Press `P` for a window with the current slide, the next slide, speaker notes, and a timer.
23
+ - **Navigator.** Press `O` to browse chapters and slides as an outline or thumbnails, and filter the slides you marked.
24
+ - **Shareable URLs.** Every slide and step has a link, such as `/#/code-walkthrough?step=2`.
25
+ - **Reading version.** `Site` publishes the same deck as a scrolling page.
26
+ - **Reduced motion.** Transitions turn off for people who prefer less motion, and all content stays visible.
27
27
  - **Agent skill.** A bundled skill helps AI coding agents write and revise decks.
28
28
 
29
- ## Requirements
29
+ ## Quick start
30
30
 
31
- - Node.js 26 or later (see [`.nvmrc`](.nvmrc))
32
- - pnpm 12.20.0 (pinned by the `packageManager` field)
31
+ ### Try the demo
32
+
33
+ You need Node.js 26 or later and pnpm 12.20.0. The repository pins pnpm in its `packageManager` field, and `.nvmrc` pins Node.
33
34
 
34
35
  ```sh
35
- nvm install
36
- nvm use
37
- npm install --global pnpm@12.20.0
38
36
  pnpm install
37
+ pnpm dev
39
38
  ```
40
39
 
41
- ## Quick start: run the demo
40
+ Open the URL Vite prints, usually `http://127.0.0.1:5173/`. The demo covers layouts, flow diagrams, code highlighting, step-by-step focus, presenter mode, and playback. Three routes are fixed: `/` shows the view set in `starter/src/config.ts`, `/slides/` shows the presentation, and `/site/` shows the scrolling reading view.
42
41
 
43
- ```sh
44
- pnpm dev
45
- ```
42
+ ### Create your own presentation
46
43
 
47
- Open the URL that Vite prints. By default this is `http://127.0.0.1:5173/`. The demo is a feature tour that covers layouts, flow diagrams, syntax highlighting, step-by-step focus, composition, presenter mode, and playback. Most slides advance with one click, and slides with extra steps are labeled.
44
+ Run the `create` command in any one of three ways:
48
45
 
49
- The demo lives in [`starter/`](starter/):
46
+ 1. **Without installing anything**, for a one-off project:
50
47
 
51
- - `/` shows the view set by `defaultView` in `starter/src/config.ts`.
52
- - `/slides/` always shows the presentation.
53
- - `/site/` always shows the scrolling site.
48
+ ```sh
49
+ pnpm dlx immerslides@beta create my-presentation
50
+ ```
54
51
 
55
- ## Create a new presentation
52
+ 2. **Install once, then use it anywhere**:
56
53
 
57
- The package is not yet published to npm. For now, pack this repository and create a project from the tarball:
54
+ ```sh
55
+ pnpm add -g immerslides@beta
56
+ immerslides create my-presentation
57
+ ```
58
58
 
59
- ```sh
60
- pnpm pack --out immerslides.tgz
61
- TARBALL="$PWD/immerslides.tgz"
62
- node bin/immerslides.mjs create ../my-presentation
63
- cd ../my-presentation
64
- pnpm add "$TARBALL"
65
- pnpm dev
66
- ```
59
+ If `immerslides` is not found after the install, run `pnpm setup` once, then open a new terminal.
60
+
61
+ 3. **From a project that already depends on immerslides**:
67
62
 
68
- The `create` command copies the starter project and the agent skill into a new directory. It refuses to write into a non-empty directory and does not install dependencies.
63
+ ```sh
64
+ pnpm exec immerslides create ../my-presentation
65
+ ```
69
66
 
70
- After the package is published, you will be able to run:
67
+ This works only inside a project where `immerslides` is installed, such as a project you created earlier. In any other folder, `pnpm exec` reports that the command is not found. To add the dependency first, run `pnpm add -D immerslides@beta`.
68
+
69
+ Then open the new project:
71
70
 
72
71
  ```sh
73
- pnpm dlx immerslides create my-presentation
74
72
  cd my-presentation
75
73
  pnpm install
76
74
  pnpm dev
77
75
  ```
78
76
 
79
- ## Use with an AI agent
77
+ The `create` command copies the starter project and the two agent skills into the new directory. It refuses to write into a non-empty directory and does not install dependencies, so run `pnpm install` first.
80
78
 
81
- New projects include two skills under `.agents/skills/`: `immerslides` (Chinese) and `immerslides-en` (English). In an agent that supports project skills, invoke one of them with a prompt such as:
79
+ `@beta` selects the current pre-release. The `latest` tag still points to an older version, so without `@beta` you get that older CLI. pnpm does not resolve a tag to a version published less than 24 hours earlier, so right after a release `@beta` can still point to the previous version. Until then, use the exact version, for example `immerslides@1.0.0-beta-8`.
82
80
 
83
- ```text
84
- $immerslides-en Turn this material into a CI talk.
85
- One click should advance one full slide. Do not split a flow into one click per node.
86
- ```
81
+ To install from GitHub Packages instead, set the registry for the `@<repository-owner>` scope and log in with a token that has `read:packages`. Projects created by the CLI map the scoped package to `immerslides` with an npm alias, so the import paths stay the same.
87
82
 
88
- The sources are [`skills/immerslides/`](skills/immerslides/) (Chinese) and [`skills/immerslides-en/`](skills/immerslides-en/) (English). Each folder contains a `SKILL.md` and a `references/` directory. Keep the two versions in sync when you change one. To add a skill to an existing project, copy the matching folder to `.agents/skills/` in that project.
83
+ Start with these files:
89
84
 
90
- ## Use in a React project
85
+ | File | What to change |
86
+ | ----------------- | --------------------------------------------------------------------------------------------- |
87
+ | `src/deck.tsx` | Your slides, their order, the chapters, and the speaker notes. It holds the demo content now. |
88
+ | `src/config.ts` | `defaultView` (what `/` shows) and `locale` (`zh-Hant` or `en`). |
89
+ | `src/site.tsx` | The reading view. Usually no change is needed. |
90
+ | `src/styles.css` | Styles for the demo only. Replace them with your own, or delete them. |
91
+ | `src/examples.ts` | Sample code and timeline data for the demo. Delete it when your deck no longer uses it. |
91
92
 
92
- Import the player and the styles once, then pass a deck to `Player`:
93
+ ## Use in your React project
94
+
95
+ Import the styles once, in the entry file, and pass a deck to `Player`:
93
96
 
94
97
  ```tsx
95
98
  import { Player } from 'immerslides/player';
@@ -101,7 +104,9 @@ export function App() {
101
104
  }
102
105
  ```
103
106
 
104
- Define the deck with `defineDeck`. It sets the slide order, chapters, and a `RenderSlide` component:
107
+ The stylesheet is required. Without it the player renders with no layout.
108
+
109
+ Define the deck with `defineDeck`. It sets the slides, their order, the chapters, and a `RenderSlide` component that draws each slide:
105
110
 
106
111
  ```tsx
107
112
  import { defineDeck, SlideFrame, type SlideRenderProps } from 'immerslides';
@@ -128,48 +133,77 @@ export const deck = defineDeck({
128
133
  });
129
134
  ```
130
135
 
131
- Use `steps: 1` for a normal slide, which advances with one click. Set a larger `steps` value only when a slide needs focus states. `steps` counts the initial state, so `steps: 2` gives the values `0` and `1`.
136
+ Each slide advances with one click by default, which is `steps: 1`. Set a larger `steps` only when a slide needs focus states. `steps` counts the initial state, so `steps: 2` gives the values `0` and `1`.
137
+
138
+ Slide and deck options:
139
+
140
+ - `SlideFrame` takes `layout="image"` for a full-slide picture with no chapter rail, heading, or footer. Use `header={false}` to hide the heading and `footer={false}` to hide the footer.
141
+ - `presenter: false` removes the presenter button and the `P` shortcut from a deck that does not need them.
142
+ - `chapterRail: { toggle: true }` lets the audience collapse the chapter rail. A chapter with `numbered: false` is listed without a number, and the other chapters still count from 01.
143
+
144
+ ### Choosing an entry point
145
+
146
+ The main entry exports everything: the authoring components, the player, and the site view. Bundlers remove the parts you do not use, so `import { CodeWindow } from 'immerslides'` adds only the code window to your bundle. When a file needs only one job, use the entry for that job:
147
+
148
+ | Import | Provides | Use it for |
149
+ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- | --------------------------------- |
150
+ | `immerslides` | Everything: `defineDeck`, `SlideFrame`, the code and flow components, `Player`, `Site`, and hooks | Most code |
151
+ | `immerslides/player` | `Player`, `SlideNavigator`, `SlidePreview`, `usePlayback`, `getSlideHref`, `fadeTransition` | Files that only play a deck |
152
+ | `immerslides/site` | `Site`, `SiteStory`, `getSiteHref` | The reading view |
153
+ | `immerslides/presenter` | `PresenterConsole`, `PresenterSync`, `stepCue` (optional, see below) | The console and the audience sync |
154
+ | `immerslides/styles.css` | All global styles. Import once. | Styles |
155
+ | `immerslides/styles/base.css`, `immerslides/styles/presenter.css`, `immerslides/styles/site.css` | The style parts. Import `base.css` first, then the parts you use. | Shipping less CSS |
156
+
157
+ #### Deprecated entries
158
+
159
+ These entries still work, but they will be removed in a future release. Move to the entry in the right column:
160
+
161
+ | Deprecated | Use instead |
162
+ | ------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
163
+ | `immerslides/deck` | `immerslides` |
164
+ | `immerslides/slide-frame`, `immerslides/chapter-guide` | `immerslides` |
165
+ | `immerslides/slide-navigator`, `immerslides/slide-preview` | `immerslides/player`, or `immerslides` |
166
+ | `immerslides/code-block`, `immerslides/code-window`, `immerslides/highlighted-code` | `immerslides` |
167
+ | `immerslides/timeline`, `immerslides/flow-node`, `immerslides/flow-connector`, `immerslides/step-description` | `immerslides` |
168
+ | `immerslides/presenter-console`, `immerslides/presenter-sync` | `immerslides/presenter` |
169
+
170
+ To ship less CSS, import `immerslides/styles/base.css` first and then only the parts you use. `styles.css` is the three parts together.
132
171
 
133
- Each component has its own entry point, so you can import only what you need:
172
+ Syntax highlighting loads the language the first time a code block needs it, so the main entry does not include highlight.js. Until then, code shows as plain text with the same layout.
134
173
 
135
- | Import | Provides |
136
- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------- |
137
- | `immerslides` | Everything below, plus `usePlayback` and `useReducedMotion` |
138
- | `immerslides/player` | `Player` |
139
- | `immerslides/deck` | `defineDeck` and the deck types |
140
- | `immerslides/site` | `Site`, `SiteStory`, `getSiteHref` |
141
- | `immerslides/slide-frame`, `immerslides/chapter-guide` | `SlideFrame`, `ChapterGuide` |
142
- | `immerslides/slide-navigator`, `immerslides/slide-preview` | `SlideNavigator`, `SlidePreview` |
143
- | `immerslides/code-block`, `immerslides/code-window`, `immerslides/highlighted-code` | `CodeBlock`, `CodeWindow`, `HighlightedCode` |
144
- | `immerslides/timeline`, `immerslides/flow-node`, `immerslides/flow-connector` | `Timeline`, `FlowNode`, `FlowConnector` |
145
- | `immerslides/step-description` | `StepDescription` |
146
- | `immerslides/styles.css` | Global styles. Import once. |
174
+ ## Writing slides
147
175
 
148
- Standalone components such as `CodeWindow` and `FlowNode` work without the player. For full guides, see:
176
+ - **Keep the click rhythm.** Advance whole slides by default. A flow slide shows at most three nodes; carry a longer flow onto a continuation slide.
177
+ - **Walk through code and flows.** `CodeBlock` and `Timeline` take `steps`, which focus one section at a time. See [immersive walkthroughs](skills/immerslides-en/references/immersive.md).
178
+ - **Write speaker notes.** Add `notes` to a slide. The notes appear only in the presenter window, never on the audience slide.
179
+ - **Share links.** Give a slide a `slug` for a stable link, and build links inside the content with `getSlideHref(deck, id, step)`.
180
+ - **Translate.** Use `translations` in `defineDeck`. See [Localization](#localization).
181
+
182
+ The guides cover the rest:
149
183
 
150
184
  - [Authoring guide](skills/immerslides-en/references/authoring.md): deck definitions and the public API
151
185
  - [Features](skills/immerslides-en/references/features.md): what each feature is for
152
186
  - [Immersive walkthroughs](skills/immerslides-en/references/immersive.md): step-by-step code and flow focus
153
187
  - [Composition](skills/immerslides-en/references/composition.md): custom layouts with the standalone components
154
- - [Presenter mode](skills/immerslides-en/references/presenter.md): notes, next-slide preview, and timer
188
+ - [Presenter mode](skills/immerslides-en/references/presenter.md): notes, next-slide preview, timer, and the console
155
189
  - [Slide URLs](skills/immerslides-en/references/urls.md): slugs, hash URLs, and `getSlideHref`
156
190
  - [Site view](skills/immerslides-en/references/site.md): publishing the deck as a reading page
157
191
 
158
- The Chinese versions of these guides are in [`skills/immerslides/references/`](skills/immerslides/references/).
192
+ The Chinese versions are in [`skills/immerslides/references/`](skills/immerslides/references/).
159
193
 
160
- ## Localization
194
+ ## Reading view
161
195
 
162
- The player, presenter view, navigator, and site support `zh-Hant` (the default) and `en`. Pass `locale` to `Player` or `Site`:
196
+ `Site` from `immerslides/site` renders the same deck as a scrolling page. The starter's `src/site.tsx` shows the usage:
163
197
 
164
198
  ```tsx
165
- export function App() {
166
- return <Player deck={deck} locale="en" />;
167
- }
199
+ import { Site } from 'immerslides/site';
200
+
201
+ <Site deck={deck} presentationHref="./slides/" locale="en" />;
168
202
  ```
169
203
 
170
- Translate slide titles, notes, chapter titles, and the handout with `translations` in `defineDeck`, keyed by locale. Text without a translation falls back to the authored text. Links are built from the authored titles, so they are the same in every language. Slide renderers receive `locale`, and `useI18n()` gives your own components the current `locale` and a translator `t` for the built-in interface text.
204
+ `presentationHref` is the address of the presentation, so readers can switch to it.
171
205
 
172
- ## Playback controls
206
+ ## Playing and sharing
173
207
 
174
208
  | Key | Action |
175
209
  | ------------------- | -------------------------------------------------------- |
@@ -180,58 +214,82 @@ Translate slide titles, notes, chapter titles, and the handout with `translation
180
214
  | `O` | Open the chapter and slide navigator. |
181
215
  | `F` | Toggle fullscreen. |
182
216
  | `P` | Open or focus the presenter window. |
183
- | `?` | Open the help dialog. |
217
+ | `?` | Open the help dialog, which also restarts the deck. |
184
218
  | Esc | Close menus. |
185
219
 
186
- Reloading restores the slide and step from the URL. If the URL does not name a slide, the player restores the progress saved in the same tab. Pass `fresh` to `Player` (`<Player deck={deck} fresh />`) to start from the beginning instead.
220
+ Reloading restores the slide and step from the URL. If the URL does not name a slide, the player restores the progress saved in the same tab. Start from the beginning with `<Player deck={deck} fresh />`, or restart from the help dialog.
187
221
 
188
- ## Deploy
222
+ Marks made with the star in the navigator last for the current playback. Reloading or restarting clears them.
189
223
 
190
- The production build is a static site with a page for the player (`/`, `/slides/`) and the reading view (`/site/`). Deploy the entire build output directory to any static host, and keep the subfolders intact.
224
+ ## Presenter console (optional)
191
225
 
192
- ## Development
226
+ The presenter console is a separate page for the speaker. It drives an audience page in another window of the same browser over a `BroadcastChannel`. It is not part of `Player`, and a deck works without it.
193
227
 
194
- Run these commands from the repository root:
228
+ Put `PresenterSync` in the deck's `Controls` on the audience page, and mount `PresenterConsole` on its own route. Both sides use the same channel name:
195
229
 
196
- | Command | Purpose |
197
- | ----------------------- | -------------------------------------------------------------------- |
198
- | `pnpm dev` | Run the demo deck |
199
- | `pnpm build` | Build the library into `dist/` |
200
- | `pnpm typecheck` | Run the TypeScript compiler without emitting files |
201
- | `pnpm lint` | Run Biome checks for code, React rules, formatting, and import order |
202
- | `pnpm lint:fix` | Apply the Biome fixes that are safe to apply automatically |
203
- | `pnpm test` | Run unit tests with Vitest |
204
- | `pnpm test:browser` | Run end-to-end tests with Playwright |
205
- | `pnpm test:package` | Build the package and verify the installed result |
206
- | `pnpm generate:favicon` | Regenerate the favicon |
230
+ ```tsx
231
+ import { PresenterConsole, PresenterSync } from 'immerslides/presenter';
232
+
233
+ const Controls = (props) => (
234
+ <>
235
+ <PresenterSync
236
+ deck={deck}
237
+ channel="my-deck"
238
+ slideId={props.state.slideId}
239
+ step={props.state.step}
240
+ />
241
+ </>
242
+ );
243
+
244
+ <PresenterConsole
245
+ deck={deck}
246
+ channel="my-deck"
247
+ audienceHref="../"
248
+ header={<SignOut />}
249
+ />;
250
+ ```
207
251
 
208
- Browser tests need a Chromium build for Playwright. Install it once with `pnpm exec playwright install --with-deps chromium`.
252
+ The console has no sign-in of its own. Pass anything your app needs, such as a sign-out form, as `header`.
209
253
 
210
- Project layout:
254
+ ## Localization
211
255
 
212
- - `src/`: the library source (components, player, presenter, and site view)
213
- - `bin/`: the `immerslides` CLI, which provides `create`
214
- - `starter/`: the project template that the CLI copies, and the demo app for `pnpm dev`
215
- - `skills/immerslides/`: the agent skill and its reference documents
216
- - `tests/`: Vitest unit tests and Playwright browser tests
217
- - `scripts/`: build, package smoke test, and favicon generation
256
+ The player, presenter view, navigator, and site support `zh-Hant` (the default) and `en`. Pass `locale` to `Player` or `Site`:
218
257
 
219
- ## Continuous integration
258
+ ```tsx
259
+ export function App() {
260
+ return <Player deck={deck} locale="en" />;
261
+ }
262
+ ```
263
+
264
+ Translate slide titles, notes, chapter titles, and the handout with `translations` in `defineDeck`, keyed by locale. Text without a translation falls back to the authored text. Links are built from the authored titles, so they are the same in every language. Slide renderers receive `locale`, and `useI18n()` gives your own components the current `locale` and a translator `t` for the built-in interface text.
265
+
266
+ ## Use with an AI agent
220
267
 
221
- Pull requests and pushes to `main` run [`verify.yml`](.github/workflows/verify.yml). It runs lint, type checks, unit tests, package verification, and the Chromium browser tests. CodeQL analyzes JavaScript and TypeScript. For private repositories, GitHub Code Security must be enabled first. Dependabot checks the root project, the starter, and GitHub Actions every week.
268
+ New projects include two skills under `.agents/skills/`: `immerslides` (Chinese) and `immerslides-en` (English). In an agent that supports project skills, invoke one of them with a prompt such as:
269
+
270
+ ```text
271
+ $immerslides-en Turn this material into a CI talk.
272
+ One click should advance one full slide. Do not split a flow into one click per node.
273
+ ```
222
274
 
223
- ## Releasing
275
+ The skills are written for the agent: they say which reference to read for each task and which mistakes to avoid. The sources are [`skills/immerslides/`](skills/immerslides/) (Chinese) and [`skills/immerslides-en/`](skills/immerslides-en/) (English). Keep the two versions in sync when you change one. To add a skill to an existing project, copy the matching folder to `.agents/skills/` in that project.
224
276
 
225
- The **Release** workflow is started manually from `main`. It runs the shared verification, publishes to npm and GitHub Packages, and creates a GitHub Release.
277
+ ## Troubleshooting
226
278
 
227
- Before the first release:
279
+ | Symptom | What to check |
280
+ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
281
+ | The slides have no layout or colors. | The entry file must import `immerslides/styles.css`. |
282
+ | Code appears as plain text for a moment. | Highlighting loads a language the first time it is needed. This is expected. For server rendering, await `preloadCodeLanguages([...])` before rendering, and call it with the same languages on the client before hydrating. |
283
+ | The presenter window does not open. | Allow pop-ups for the site. The player shows a message when the browser blocks the window. |
284
+ | The console does not follow the audience. | Both pages must use the same `channel` name, and both must be open in the same browser. |
285
+ | Saved progress lands on the wrong step after you edit slides. | Increase `version` when you change slides or steps. Start over with `fresh`, or restart from the help dialog. |
286
+ | Install or dev server fails with a Node version error. | Use Node.js 26 or later (see `.nvmrc`). |
287
+ | `pnpm build` fails with `Unable to resolve @typescript/typescript-darwin-arm64` on an Apple Silicon Mac. | The pnpm binary is x64, running under Rosetta, so it installs only the x64 TypeScript compiler. Projects created with `1.0.0-beta-8` or later include a `pnpm-workspace.yaml` that fixes this. For an older project, add a `pnpm-workspace.yaml` with `supportedArchitectures` listing `x64` and `arm64` under `cpu`, or delete `node_modules` and install with an arm64 pnpm. |
288
+ | `@beta` installs an older version than the one npm lists. | pnpm skips versions published less than 24 hours ago when it resolves a tag. Install the exact version, for example `pnpm dlx immerslides@1.0.0-beta-8 create my-presentation`, or wait a day. To skip the check for one command, add `--config.minimumReleaseAge=0`. |
228
289
 
229
- 1. Create an `npm` environment in the GitHub repository that allows deployments only from `main`. Add required reviewers if you want a manual approval step.
230
- 2. Add an `NPM_TOKEN` secret to that environment. The token must be allowed to publish `immerslides`.
231
- 3. Make sure the repository's `GITHUB_TOKEN` can write packages, and that the organization allows packages under the scope.
232
- 4. Commit the version you want to release in `package.json`. The release creates the tag `v<version>`.
290
+ ## Contributing
233
291
 
234
- On GitHub Packages, the package is published as `@<repository-owner>/immerslides`. The scope uses the lowercase name of the repository owner. Both registries receive the same build.
292
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for local development, the tests, the pull request workflow, and the release process.
235
293
 
236
294
  ## License
237
295