immerslides 1.0.0-beta-9 → 1.0.0-beta-10
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.
- package/README.md +1 -1
- package/README.zh-TW.md +1 -0
- package/dist/i18n/messages.d.ts +4 -0
- package/dist/i18n/messages.js +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/player/index.d.ts +2 -0
- package/dist/player/index.js +1 -0
- package/dist/presentation/SlideMarks.d.ts +16 -0
- package/dist/presentation/SlideMarks.js +44 -0
- package/dist/styles/base.css +37 -0
- package/dist/styles.css +37 -0
- package/package.json +2 -1
- package/skills/immerslides/references/features.md +31 -31
- package/skills/immerslides-en/references/features.md +31 -31
- package/starter/package.json +1 -1
- package/starter/presenter/index.html +5 -0
- package/starter/src/config.ts +3 -0
- package/starter/src/deck.tsx +26 -68
- package/starter/src/presenter.tsx +16 -0
- package/starter/src/styles.css +0 -36
- package/starter/vite.config.ts +1 -1
package/README.md
CHANGED
|
@@ -219,7 +219,7 @@ import { Site } from 'immerslides/site';
|
|
|
219
219
|
|
|
220
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.
|
|
221
221
|
|
|
222
|
-
Marks made with the star in the navigator last for the current playback. Reloading or restarting clears them.
|
|
222
|
+
Marks made with the star in the navigator last for the current playback. Reloading or restarting clears them. To add the same marks to your own deck, use `SlideMarksProvider`, `SlideMarkControls`, and `SlideMarkNavigator` as the deck's `Provider`, `Controls`, and `Navigator`.
|
|
223
223
|
|
|
224
224
|
## Presenter console (optional)
|
|
225
225
|
|
package/README.zh-TW.md
CHANGED
|
@@ -178,6 +178,7 @@ export const deck = defineDeck({
|
|
|
178
178
|
- **撰寫講稿。** 在投影片加入 `notes`。講稿只出現在簡報者視窗,不會顯示在觀眾畫面。
|
|
179
179
|
- **分享連結。** 需要穩定連結的投影片設定 `slug`,內容中的連結使用 `getSlideHref(deck, id, step)`。
|
|
180
180
|
- **翻譯。** 使用 `defineDeck` 的 `translations`,見[多語言](#多語言)。
|
|
181
|
+
- **標記重點。** 把 `SlideMarksProvider`、`SlideMarkControls`、`SlideMarkNavigator` 分別放進 `Provider`、`Controls`、`Navigator`,工具列會出現 ☆ 與已標記數量,導覽列會出現星星與「已標記」篩選。標記只存在本次播放中。
|
|
181
182
|
|
|
182
183
|
其他指南:
|
|
183
184
|
|
package/dist/i18n/messages.d.ts
CHANGED
|
@@ -33,6 +33,10 @@ declare const zhHant: {
|
|
|
33
33
|
readonly 'navigator.empty': '還沒有標記頁面。';
|
|
34
34
|
readonly 'navigator.mark': '標記頁面:{title}(第 {page} 頁)';
|
|
35
35
|
readonly 'navigator.unmark': '取消標記頁面:{title}(第 {page} 頁)';
|
|
36
|
+
readonly 'marks.toggle': '標記本頁重點';
|
|
37
|
+
readonly 'marks.toggleTitle': '標記本頁重點,從頭開始時清除';
|
|
38
|
+
readonly 'marks.count': '查看已標記頁面({count})';
|
|
39
|
+
readonly 'marks.countTitle': '查看已標記頁面';
|
|
36
40
|
readonly 'help.title': '放映操作';
|
|
37
41
|
readonly 'help.nextDescription': '下一頁;有分段時前進一步';
|
|
38
42
|
readonly 'help.previousDescription': '上一頁;有分段時退回一步';
|
package/dist/i18n/messages.js
CHANGED
|
@@ -32,6 +32,10 @@ const zhHant = {
|
|
|
32
32
|
'navigator.empty': '還沒有標記頁面。',
|
|
33
33
|
'navigator.mark': '標記頁面:{title}(第 {page} 頁)',
|
|
34
34
|
'navigator.unmark': '取消標記頁面:{title}(第 {page} 頁)',
|
|
35
|
+
'marks.toggle': '標記本頁重點',
|
|
36
|
+
'marks.toggleTitle': '標記本頁重點,從頭開始時清除',
|
|
37
|
+
'marks.count': '查看已標記頁面({count})',
|
|
38
|
+
'marks.countTitle': '查看已標記頁面',
|
|
35
39
|
'help.title': '放映操作',
|
|
36
40
|
'help.nextDescription': '下一頁;有分段時前進一步',
|
|
37
41
|
'help.previousDescription': '上一頁;有分段時退回一步',
|
|
@@ -107,6 +111,10 @@ const en = {
|
|
|
107
111
|
'navigator.empty': 'No slides are marked yet.',
|
|
108
112
|
'navigator.mark': 'Mark slide: {title} (slide {page})',
|
|
109
113
|
'navigator.unmark': 'Unmark slide: {title} (slide {page})',
|
|
114
|
+
'marks.toggle': 'Mark this slide',
|
|
115
|
+
'marks.toggleTitle': 'Mark this slide. Marks clear on restart.',
|
|
116
|
+
'marks.count': 'Show marked slides ({count})',
|
|
117
|
+
'marks.countTitle': 'Show marked slides',
|
|
110
118
|
'help.title': 'Presentation controls',
|
|
111
119
|
'help.nextDescription': 'Next slide; moves one step when the slide has steps',
|
|
112
120
|
'help.previousDescription': 'Previous slide; goes back one step when the slide has steps',
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export { defaultLocale, locales } from './i18n/messages.js';
|
|
|
18
18
|
export { usePlayback } from './presentation/context.js';
|
|
19
19
|
export { Player } from './presentation/Player.js';
|
|
20
20
|
export { getSlideHref } from './presentation/routing.js';
|
|
21
|
+
export type { SlideMarkState } from './presentation/SlideMarks.js';
|
|
22
|
+
export { SlideMarkControls, SlideMarkNavigator, SlideMarksProvider, useSlideMarks, } from './presentation/SlideMarks.js';
|
|
21
23
|
export { SlideNavigator } from './presentation/SlideNavigator.js';
|
|
22
24
|
export type { SlidePreviewProps } from './presentation/SlidePreview.js';
|
|
23
25
|
export { SlidePreview } from './presentation/SlidePreview.js';
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { defaultLocale, locales } from './i18n/messages.js';
|
|
|
10
10
|
export { usePlayback } from './presentation/context.js';
|
|
11
11
|
export { Player } from './presentation/Player.js';
|
|
12
12
|
export { getSlideHref } from './presentation/routing.js';
|
|
13
|
+
export { SlideMarkControls, SlideMarkNavigator, SlideMarksProvider, useSlideMarks, } from './presentation/SlideMarks.js';
|
|
13
14
|
export { SlideNavigator } from './presentation/SlideNavigator.js';
|
|
14
15
|
export { SlidePreview } from './presentation/SlidePreview.js';
|
|
15
16
|
export { fadeTransition } from './presentation/transitions.js';
|
package/dist/player/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { usePlayback } from '../presentation/context.js';
|
|
2
2
|
export { Player } from '../presentation/Player.js';
|
|
3
3
|
export { getSlideHref } from '../presentation/routing.js';
|
|
4
|
+
export type { SlideMarkState } from '../presentation/SlideMarks.js';
|
|
5
|
+
export { SlideMarkControls, SlideMarkNavigator, SlideMarksProvider, useSlideMarks, } from '../presentation/SlideMarks.js';
|
|
4
6
|
export { SlideNavigator } from '../presentation/SlideNavigator.js';
|
|
5
7
|
export type { SlidePreviewProps } from '../presentation/SlidePreview.js';
|
|
6
8
|
export { SlidePreview } from '../presentation/SlidePreview.js';
|
package/dist/player/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export { usePlayback } from '../presentation/context.js';
|
|
4
4
|
export { Player } from '../presentation/Player.js';
|
|
5
5
|
export { getSlideHref } from '../presentation/routing.js';
|
|
6
|
+
export { SlideMarkControls, SlideMarkNavigator, SlideMarksProvider, useSlideMarks, } from '../presentation/SlideMarks.js';
|
|
6
7
|
export { SlideNavigator } from '../presentation/SlideNavigator.js';
|
|
7
8
|
export { SlidePreview } from '../presentation/SlidePreview.js';
|
|
8
9
|
export { fadeTransition } from '../presentation/transitions.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { PlayerControlsProps, SlideId, SlideNavigatorProps } from './types.js';
|
|
3
|
+
export type SlideMarkState = {
|
|
4
|
+
marked: ReadonlySet<SlideId>;
|
|
5
|
+
toggle: (id: SlideId) => void;
|
|
6
|
+
};
|
|
7
|
+
/** The marks of the nearest SlideMarksProvider, for custom controls. */
|
|
8
|
+
export declare function useSlideMarks(): SlideMarkState;
|
|
9
|
+
/** Use as the deck's `Provider`. It holds the marks for one playback. */
|
|
10
|
+
export declare function SlideMarksProvider({ children }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
/** Use as the deck's `Controls`, or render it inside your own controls. */
|
|
14
|
+
export declare function SlideMarkControls({ slide, openNavigator, }: PlayerControlsProps): import("react").JSX.Element;
|
|
15
|
+
/** Use as the deck's `Navigator`. It is SlideNavigator wired to the marks. */
|
|
16
|
+
export declare function SlideMarkNavigator(props: SlideNavigatorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
|
|
3
|
+
import { useI18n } from '../i18n/context.js';
|
|
4
|
+
import { usePlayback } from './context.js';
|
|
5
|
+
import { SlideNavigator } from './SlideNavigator.js';
|
|
6
|
+
const SlideMarksContext = createContext(null);
|
|
7
|
+
/** The marks of the nearest SlideMarksProvider, for custom controls. */
|
|
8
|
+
export function useSlideMarks() {
|
|
9
|
+
const marks = useContext(SlideMarksContext);
|
|
10
|
+
if (!marks) {
|
|
11
|
+
throw new Error('useSlideMarks must be used inside SlideMarksProvider.');
|
|
12
|
+
}
|
|
13
|
+
return marks;
|
|
14
|
+
}
|
|
15
|
+
/** Use as the deck's `Provider`. It holds the marks for one playback. */
|
|
16
|
+
export function SlideMarksProvider({ children }) {
|
|
17
|
+
const { state } = usePlayback();
|
|
18
|
+
const [marked, setMarked] = useState(() => new Set());
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setMarked(new Set());
|
|
21
|
+
}, [state.generation]);
|
|
22
|
+
const toggle = useCallback((id) => setMarked((previous) => {
|
|
23
|
+
const next = new Set(previous);
|
|
24
|
+
if (next.has(id))
|
|
25
|
+
next.delete(id);
|
|
26
|
+
else
|
|
27
|
+
next.add(id);
|
|
28
|
+
return next;
|
|
29
|
+
}), []);
|
|
30
|
+
const value = useMemo(() => ({ marked, toggle }), [marked, toggle]);
|
|
31
|
+
return (_jsx(SlideMarksContext.Provider, { value: value, children: children }));
|
|
32
|
+
}
|
|
33
|
+
/** Use as the deck's `Controls`, or render it inside your own controls. */
|
|
34
|
+
export function SlideMarkControls({ slide, openNavigator, }) {
|
|
35
|
+
const { t } = useI18n();
|
|
36
|
+
const { marked, toggle } = useSlideMarks();
|
|
37
|
+
const isMarked = marked.has(slide.id);
|
|
38
|
+
return (_jsxs("div", { className: "immerslides-mark-controls", children: [_jsx("button", { type: "button", className: "immerslides-mark-toggle", "aria-label": t('marks.toggle'), "aria-pressed": isMarked, title: t('marks.toggleTitle'), onClick: () => toggle(slide.id), children: _jsx("span", { "aria-hidden": true, children: isMarked ? '★' : '☆' }) }), _jsx("button", { type: "button", className: "immerslides-mark-count", "aria-label": t('marks.count', { count: marked.size }), title: t('marks.countTitle'), "aria-haspopup": "dialog", onClick: () => openNavigator('marked'), children: marked.size })] }));
|
|
39
|
+
}
|
|
40
|
+
/** Use as the deck's `Navigator`. It is SlideNavigator wired to the marks. */
|
|
41
|
+
export function SlideMarkNavigator(props) {
|
|
42
|
+
const { marked, toggle } = useSlideMarks();
|
|
43
|
+
return (_jsx(SlideNavigator, { ...props, markedSlides: marked, onToggleMark: toggle }));
|
|
44
|
+
}
|
package/dist/styles/base.css
CHANGED
|
@@ -91,6 +91,43 @@
|
|
|
91
91
|
outline: 2px solid var(--player-accent);
|
|
92
92
|
outline-offset: 2px;
|
|
93
93
|
}
|
|
94
|
+
/* Slide marks (SlideMarkControls): the star and the count share one bordered group. */
|
|
95
|
+
.immerslides-mark-controls {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
margin-left: 4px;
|
|
99
|
+
border: 1px solid #d2d2d7;
|
|
100
|
+
border-radius: 8px;
|
|
101
|
+
}
|
|
102
|
+
.immerslides-mark-controls > button {
|
|
103
|
+
min-width: 26px;
|
|
104
|
+
padding: 6px 4px;
|
|
105
|
+
border: 0;
|
|
106
|
+
border-radius: 7px;
|
|
107
|
+
background: none;
|
|
108
|
+
color: #0071e3;
|
|
109
|
+
font: inherit;
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
}
|
|
112
|
+
.immerslides-mark-controls > .immerslides-mark-toggle {
|
|
113
|
+
display: inline-flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
padding-inline: 2px;
|
|
117
|
+
font-size: 21px;
|
|
118
|
+
line-height: 24px;
|
|
119
|
+
}
|
|
120
|
+
.immerslides-mark-controls > .immerslides-mark-count {
|
|
121
|
+
border-left: 1px solid #e8e8ed;
|
|
122
|
+
border-radius: 0 7px 7px 0;
|
|
123
|
+
}
|
|
124
|
+
.immerslides-mark-controls > button:hover {
|
|
125
|
+
background: #e8f2ff;
|
|
126
|
+
}
|
|
127
|
+
.immerslides-mark-controls button:focus-visible {
|
|
128
|
+
outline: 2px solid #0071e3;
|
|
129
|
+
outline-offset: 2px;
|
|
130
|
+
}
|
|
94
131
|
.presentation-player .control-divider {
|
|
95
132
|
height: 21px;
|
|
96
133
|
width: 1px;
|
package/dist/styles.css
CHANGED
|
@@ -91,6 +91,43 @@
|
|
|
91
91
|
outline: 2px solid var(--player-accent);
|
|
92
92
|
outline-offset: 2px;
|
|
93
93
|
}
|
|
94
|
+
/* Slide marks (SlideMarkControls): the star and the count share one bordered group. */
|
|
95
|
+
.immerslides-mark-controls {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
margin-left: 4px;
|
|
99
|
+
border: 1px solid #d2d2d7;
|
|
100
|
+
border-radius: 8px;
|
|
101
|
+
}
|
|
102
|
+
.immerslides-mark-controls > button {
|
|
103
|
+
min-width: 26px;
|
|
104
|
+
padding: 6px 4px;
|
|
105
|
+
border: 0;
|
|
106
|
+
border-radius: 7px;
|
|
107
|
+
background: none;
|
|
108
|
+
color: #0071e3;
|
|
109
|
+
font: inherit;
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
}
|
|
112
|
+
.immerslides-mark-controls > .immerslides-mark-toggle {
|
|
113
|
+
display: inline-flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
padding-inline: 2px;
|
|
117
|
+
font-size: 21px;
|
|
118
|
+
line-height: 24px;
|
|
119
|
+
}
|
|
120
|
+
.immerslides-mark-controls > .immerslides-mark-count {
|
|
121
|
+
border-left: 1px solid #e8e8ed;
|
|
122
|
+
border-radius: 0 7px 7px 0;
|
|
123
|
+
}
|
|
124
|
+
.immerslides-mark-controls > button:hover {
|
|
125
|
+
background: #e8f2ff;
|
|
126
|
+
}
|
|
127
|
+
.immerslides-mark-controls button:focus-visible {
|
|
128
|
+
outline: 2px solid #0071e3;
|
|
129
|
+
outline-offset: 2px;
|
|
130
|
+
}
|
|
94
131
|
.presentation-player .control-divider {
|
|
95
132
|
height: 21px;
|
|
96
133
|
width: 1px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "immerslides",
|
|
3
|
-
"version": "1.0.0-beta-
|
|
3
|
+
"version": "1.0.0-beta-10",
|
|
4
4
|
"description": "React presentations with immersive code and flow walkthroughs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
"bin",
|
|
101
101
|
"starter/.nvmrc",
|
|
102
102
|
"starter/index.html",
|
|
103
|
+
"starter/presenter",
|
|
103
104
|
"starter/package.json",
|
|
104
105
|
"starter/public",
|
|
105
106
|
"starter/site",
|
|
@@ -2,37 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
下列功能屬於 immerslides 的公開能力。Starter 的功能導覽展示常用能力。依使用者的教材選擇,不要求每份正式簡報都包含全部功能。
|
|
4
4
|
|
|
5
|
-
| 功能 | 適合使用時機 | 入口與限制
|
|
6
|
-
| ------------------------ | -------------------------------- |
|
|
7
|
-
| 封面、內容頁、結尾 | 建立一致的 presentation 版型 | `SlideFrame` 的 `layout`。固定 1600 × 900,縮放符合視窗。
|
|
8
|
-
| 分欄、標籤與註記 | 比較兩個觀點或強調補充說明 | `immerslides-columns`、`immerslides-label`、`immerslides-note`。
|
|
9
|
-
| 完整流程圖 | 一頁解釋一段有順序的流程 | `Timeline`,每列一至三個節點。支援 focus、good、warn、bad 狀態。
|
|
10
|
-
| 深色程式碼視窗與語法上色 | 呈現短程式或協定訊息 | `CodeBlock` 接收原始字串、可選檔名與 `language`。支援常用語言與別名,保留換行及縮排,安全呈現文字。
|
|
11
|
-
| 程式碼逐段聚焦 | 分段說明一個演算法或設定 | `CodeBlock.steps` 定義行範圍及說明,`step` 指定目前段落。保留語法色彩,淡化其他行並將焦點帶入可見範圍。
|
|
12
|
-
| 流程逐段聚焦 | 沉浸式解說資料或操作流程 | `Timeline.steps` 以節點 ID 定義段落,隨 `step` 強調目前節點與連線。
|
|
13
|
-
| 自由組合 | 說明、程式碼與流程需要不同版面 | `CodeWindow`、`HighlightedCode`、`StepDescription`、`FlowNode`、`FlowConnector`。與現成版型共用實作。
|
|
14
|
-
| 平滑章節導覽 | 長簡報中辨識目前位置 | 設定 `chapters` 與 `Overlay: ChapterGuide`。章節由同一份頁面順序推導。
|
|
15
|
-
| 網址、slug 與歷史記錄 | 分享某一頁或指定講解段落 | 每頁可設定 `slug`,預設由標題產生。支援章節別名、`#/15` 頁數跳轉、重新整理與瀏覽器前後導覽。連結使用 `getSlideHref`。
|
|
16
|
-
| 整頁與少量分段 | 依講解需要安排點擊節奏 | 預設 `steps: 1`。額外分段由 `step` 驅動 JSX,不逐行強制揭露。
|
|
17
|
-
| 鍵盤與控制列 | 現場播放 | 方向鍵、Space、Page Up、Page Down。可直接鍵入頁數,或編輯下方目前頁數,Enter 跳頁、Esc 取消。控制列閒置後隱藏,指標移動或鍵盤聚焦時顯示。
|
|
18
|
-
| 章節與縮圖選單 | 依大綱或畫面尋找投影片 | O 開啟。文字大綱以章節、投影片的樹狀結構呈現,可收合;縮圖預覽依章節分組。點選頁面跳轉並更新網址。
|
|
19
|
-
| 說明與全螢幕 | 現場展示 | ? 開啟說明,F 切換全螢幕。Esc 關閉選單。全螢幕依瀏覽器與宿主權限。
|
|
20
|
-
| 簡報者模式 | 自己看講稿,觀眾看投影 | P 開啟獨立視窗。顯示目前與下一個畫面、逐頁 notes、計時及播放控制,和觀眾畫面同步。
|
|
21
|
-
| 自動保存與從頭開始 | 重新整理後接續講解 | 同一分頁的 sessionStorage。使用 `version` 處理內容修訂,使用 `fresh` 或 `actions.restart()` 重設。
|
|
22
|
-
| 靜態預覽 | 展示縮圖、比較頁面設計 | `SlidePreview` 不啟動播放 provider。可指定頁面與步驟。
|
|
23
|
-
| 淡出與自訂轉場 | 讓完整頁面平順銜接 | `fadeTransition` 或自訂 `TransitionDefinition`。回傳有限時間的 Web Animations API 動畫。
|
|
24
|
-
| 轉場快照與步內轉場 | 跨頁或分段接續同一個圖形 | 自訂 `capture` 取得變更前狀態,`animateStep` 處理步內變化。可用 `freezeEntranceOnNavigation` 在導覽時直接呈現頁面的指定狀態。
|
|
25
|
-
| 全幅圖片頁 | 展示一張圖、截圖或示意圖 | `SlideFrame` 的 `layout="image"`。不顯示章節列、標題與頁尾。
|
|
26
|
-
| 章節列選項 | 讓觀眾收合章節列,或讓章節不編號 | `chapterRail: { toggle: true }` 讓觀眾收合。章節設定 `numbered: false` 即列出但不加序號。
|
|
27
|
-
| 簡報者主控台(可選) | 在獨立頁面用控制台主講 | `immerslides/presenter` 匯出 `PresenterConsole` 與 `PresenterSync`。路由與登入等由宿主 app 提供,說明見 [presenter.md](presenter.md)。
|
|
28
|
-
| 減少動態效果 | 使用者偏好降低動畫 | 播放器、ChapterGuide、內建樣式尊重系統設定。自訂內容使用 `still`、`reducedMotion` 或 `useReducedMotion()`。
|
|
29
|
-
| 自訂投影片內容 | 原生 JSX、SVG、互動按鈕 | `RenderSlide` 接收 `SlideRenderProps`。動畫與操作不能影響靜態預覽。
|
|
30
|
-
| 額外控制與說明 | 課程專屬操作或教學輔助 | `Controls` 接收播放狀態與 actions。`Help` 補充說明選單。
|
|
31
|
-
| 範例重點標記 | 記下稍後要回看的頁面 |
|
|
32
|
-
| 播放專屬狀態 | 計時或跨頁活動 | `Provider` 接收 `children` 與 `fresh`。在其內使用 `usePlayback()`。預覽不掛載它。
|
|
33
|
-
| 自訂畫面覆層 | 跨頁保持穩定的指引 | `Overlay` 接收播放狀態、視窗與 scale。`reserveWidth` 可為覆層預留寬度。
|
|
34
|
-
| 返回入口與講義 | 與既有教材或網站整合 | `Player.homeHref` 顯示返回連結。`handout` 顯示說明中的教材連結。
|
|
35
|
-
| 新專案與 project skill | 重用相同技術與風格 | `pnpm dlx immerslides@beta create <directory>` 複製 starter 與 skill,其他執行方式見 README。使用 pnpm 安裝及建置。
|
|
5
|
+
| 功能 | 適合使用時機 | 入口與限制 |
|
|
6
|
+
| ------------------------ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| 封面、內容頁、結尾 | 建立一致的 presentation 版型 | `SlideFrame` 的 `layout`。固定 1600 × 900,縮放符合視窗。 |
|
|
8
|
+
| 分欄、標籤與註記 | 比較兩個觀點或強調補充說明 | `immerslides-columns`、`immerslides-label`、`immerslides-note`。 |
|
|
9
|
+
| 完整流程圖 | 一頁解釋一段有順序的流程 | `Timeline`,每列一至三個節點。支援 focus、good、warn、bad 狀態。 |
|
|
10
|
+
| 深色程式碼視窗與語法上色 | 呈現短程式或協定訊息 | `CodeBlock` 接收原始字串、可選檔名與 `language`。支援常用語言與別名,保留換行及縮排,安全呈現文字。 |
|
|
11
|
+
| 程式碼逐段聚焦 | 分段說明一個演算法或設定 | `CodeBlock.steps` 定義行範圍及說明,`step` 指定目前段落。保留語法色彩,淡化其他行並將焦點帶入可見範圍。 |
|
|
12
|
+
| 流程逐段聚焦 | 沉浸式解說資料或操作流程 | `Timeline.steps` 以節點 ID 定義段落,隨 `step` 強調目前節點與連線。 |
|
|
13
|
+
| 自由組合 | 說明、程式碼與流程需要不同版面 | `CodeWindow`、`HighlightedCode`、`StepDescription`、`FlowNode`、`FlowConnector`。與現成版型共用實作。 |
|
|
14
|
+
| 平滑章節導覽 | 長簡報中辨識目前位置 | 設定 `chapters` 與 `Overlay: ChapterGuide`。章節由同一份頁面順序推導。 |
|
|
15
|
+
| 網址、slug 與歷史記錄 | 分享某一頁或指定講解段落 | 每頁可設定 `slug`,預設由標題產生。支援章節別名、`#/15` 頁數跳轉、重新整理與瀏覽器前後導覽。連結使用 `getSlideHref`。 |
|
|
16
|
+
| 整頁與少量分段 | 依講解需要安排點擊節奏 | 預設 `steps: 1`。額外分段由 `step` 驅動 JSX,不逐行強制揭露。 |
|
|
17
|
+
| 鍵盤與控制列 | 現場播放 | 方向鍵、Space、Page Up、Page Down。可直接鍵入頁數,或編輯下方目前頁數,Enter 跳頁、Esc 取消。控制列閒置後隱藏,指標移動或鍵盤聚焦時顯示。 |
|
|
18
|
+
| 章節與縮圖選單 | 依大綱或畫面尋找投影片 | O 開啟。文字大綱以章節、投影片的樹狀結構呈現,可收合;縮圖預覽依章節分組。點選頁面跳轉並更新網址。 |
|
|
19
|
+
| 說明與全螢幕 | 現場展示 | ? 開啟說明,F 切換全螢幕。Esc 關閉選單。全螢幕依瀏覽器與宿主權限。 |
|
|
20
|
+
| 簡報者模式 | 自己看講稿,觀眾看投影 | P 開啟獨立視窗。顯示目前與下一個畫面、逐頁 notes、計時及播放控制,和觀眾畫面同步。 |
|
|
21
|
+
| 自動保存與從頭開始 | 重新整理後接續講解 | 同一分頁的 sessionStorage。使用 `version` 處理內容修訂,使用 `fresh` 或 `actions.restart()` 重設。 |
|
|
22
|
+
| 靜態預覽 | 展示縮圖、比較頁面設計 | `SlidePreview` 不啟動播放 provider。可指定頁面與步驟。 |
|
|
23
|
+
| 淡出與自訂轉場 | 讓完整頁面平順銜接 | `fadeTransition` 或自訂 `TransitionDefinition`。回傳有限時間的 Web Animations API 動畫。 |
|
|
24
|
+
| 轉場快照與步內轉場 | 跨頁或分段接續同一個圖形 | 自訂 `capture` 取得變更前狀態,`animateStep` 處理步內變化。可用 `freezeEntranceOnNavigation` 在導覽時直接呈現頁面的指定狀態。 |
|
|
25
|
+
| 全幅圖片頁 | 展示一張圖、截圖或示意圖 | `SlideFrame` 的 `layout="image"`。不顯示章節列、標題與頁尾。 |
|
|
26
|
+
| 章節列選項 | 讓觀眾收合章節列,或讓章節不編號 | `chapterRail: { toggle: true }` 讓觀眾收合。章節設定 `numbered: false` 即列出但不加序號。 |
|
|
27
|
+
| 簡報者主控台(可選) | 在獨立頁面用控制台主講 | `immerslides/presenter` 匯出 `PresenterConsole` 與 `PresenterSync`。路由與登入等由宿主 app 提供,說明見 [presenter.md](presenter.md)。 |
|
|
28
|
+
| 減少動態效果 | 使用者偏好降低動畫 | 播放器、ChapterGuide、內建樣式尊重系統設定。自訂內容使用 `still`、`reducedMotion` 或 `useReducedMotion()`。 |
|
|
29
|
+
| 自訂投影片內容 | 原生 JSX、SVG、互動按鈕 | `RenderSlide` 接收 `SlideRenderProps`。動畫與操作不能影響靜態預覽。 |
|
|
30
|
+
| 額外控制與說明 | 課程專屬操作或教學輔助 | `Controls` 接收播放狀態與 actions。`Help` 補充說明選單。 |
|
|
31
|
+
| 範例重點標記 | 記下稍後要回看的頁面 | 工具列的 ☆ 標記本頁,旁邊的數量開啟共用選單並套用「已標記」篩選。文字與縮圖保留原始頁碼,空章節隱藏;每頁右上星星可標記或取消,點頁面查看。重新整理或從頭開始會清除標記。由 `SlideMarksProvider`、`SlideMarkControls`、`SlideMarkNavigator` 提供。 |
|
|
32
|
+
| 播放專屬狀態 | 計時或跨頁活動 | `Provider` 接收 `children` 與 `fresh`。在其內使用 `usePlayback()`。預覽不掛載它。 |
|
|
33
|
+
| 自訂畫面覆層 | 跨頁保持穩定的指引 | `Overlay` 接收播放狀態、視窗與 scale。`reserveWidth` 可為覆層預留寬度。 |
|
|
34
|
+
| 返回入口與講義 | 與既有教材或網站整合 | `Player.homeHref` 顯示返回連結。`handout` 顯示說明中的教材連結。 |
|
|
35
|
+
| 新專案與 project skill | 重用相同技術與風格 | `pnpm dlx immerslides@beta create <directory>` 複製 starter 與 skill,其他執行方式見 README。使用 pnpm 安裝及建置。 |
|
|
36
36
|
|
|
37
37
|
## 自訂播放功能
|
|
38
38
|
|
|
@@ -2,37 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
The features below are part of the public capabilities of immerslides. The starter's feature tour shows the most common ones. Choose them to fit the material. A formal deck does not need to include all of them.
|
|
4
4
|
|
|
5
|
-
| Feature | When to use it | Entry point and limits
|
|
6
|
-
| -------------------------------------------- | ------------------------------------------------------------- |
|
|
7
|
-
| Cover, content, and ending | Build a consistent presentation layout | `layout` on `SlideFrame`. Fixed at 1600 × 900, scaled to fit the window.
|
|
8
|
-
| Columns, labels, and notes | Compare two views or highlight a detail | `immerslides-columns`, `immerslides-label`, `immerslides-note`.
|
|
9
|
-
| Complete flow diagrams | Explain an ordered process on one page | `Timeline`, with one to three nodes per row. Supports the focus, good, warn, and bad states.
|
|
10
|
-
| Dark code window and highlighting | Show a short program or protocol message | `CodeBlock` takes the raw string, an optional file name, and a `language`. Supports common languages and aliases, keeps line breaks and indentation, and renders the text safely.
|
|
11
|
-
| Line-by-line code focus | Explain an algorithm or configuration in sections | `CodeBlock.steps` defines line ranges and descriptions, and `step` selects the current section. Keeps syntax colors, dims the other lines, and brings the focus into view.
|
|
12
|
-
| Step-by-step flow focus | Explain data or an operational flow immersively | `Timeline.steps` defines sections by node ID. The current node and its connectors are emphasized as `step` changes.
|
|
13
|
-
| Free composition | Use different layouts for text, code, and flows | `CodeWindow`, `HighlightedCode`, `StepDescription`, `FlowNode`, and `FlowConnector`. They share the implementation with the ready-made layouts.
|
|
14
|
-
| Smooth chapter navigation | Keep your place in a long talk | Set `chapters` and `Overlay: ChapterGuide`. Chapters are derived from the same slide order.
|
|
15
|
-
| URLs, slugs, and history | Share one page or a specific step | Each slide can set a `slug`, which is otherwise generated from its title. Supports chapter aliases, `#/15` page jumps, reloads, and browser back and forward. Build links with `getSlideHref`.
|
|
16
|
-
| Whole pages and a few steps | Set the click rhythm to fit the talk | `steps: 1` by default. Extra steps are driven by `step` in your JSX, and content is not forced to reveal line by line.
|
|
17
|
-
| Keyboard and control bar | Present live | Arrow keys, Space, Page Up, and Page Down. You can type a slide number, or edit the current number below, then press Enter to jump or Esc to cancel. The control bar hides when idle and appears on pointer movement or keyboard focus.
|
|
18
|
-
| Chapter and thumbnail menu | Find a slide by outline or by look | Press O to open. The text outline is a collapsible tree of chapters and slides. The thumbnail view groups slides by chapter. Clicking a slide jumps to it and updates the URL.
|
|
19
|
-
| Help and full screen | Present on stage | Press ? for help and F to toggle full screen. Esc closes menus. Full screen depends on the browser and the host's permissions.
|
|
20
|
-
| Presenter view | Read your notes while the audience watches the slides | Press P to open a separate window. It shows the current and next views, the notes for each slide, a timer, and playback controls, all in sync with the audience view.
|
|
21
|
-
| Auto-save and start over | Continue the talk after a reload | sessionStorage for the same tab. Use `version` to handle content revisions, and `fresh` or `actions.restart()` to reset.
|
|
22
|
-
| Static previews | Show thumbnails and compare page designs | `SlidePreview` does not start a playback provider. You can choose the slide and the step.
|
|
23
|
-
| Fade and custom transitions | Connect whole pages smoothly | `fadeTransition`, or a custom `TransitionDefinition`. Returns Web Animations API animations with a finite duration.
|
|
24
|
-
| Transition snapshots and in-step transitions | Carry the same graphic across pages or steps | A custom `capture` reads the state before a change, and `animateStep` handles changes within a step. `freezeEntranceOnNavigation` shows a page's specified state directly when navigating.
|
|
25
|
-
| Full-bleed image page | Show one picture, screenshot, or diagram | `SlideFrame` with `layout="image"`. No chapter rail, heading, or footer.
|
|
26
|
-
| Chapter rail options | Hide the rail for the audience, or leave a chapter unnumbered | `chapterRail: { toggle: true }` lets the audience collapse it. `numbered: false` on a chapter lists it without a number.
|
|
27
|
-
| Presenter console (optional) | Run a talk from a separate page, with its own controls | `immerslides/presenter` exports `PresenterConsole` and `PresenterSync`. The host supplies the routes and any sign-in. See [presenter.md](presenter.md).
|
|
28
|
-
| Reduced motion | Respect the user's preference for less animation | The player, ChapterGuide, and the built-in styles respect the system setting. Custom content uses `still`, `reducedMotion`, or `useReducedMotion()`.
|
|
29
|
-
| Custom slide content | Native JSX, SVG, and interactive buttons | `RenderSlide` receives `SlideRenderProps`. Animations and actions must not affect static previews.
|
|
30
|
-
| Extra controls and help | Course-specific actions or teaching aids | `Controls` receives the playback state and actions. `Help` adds content to the help menu.
|
|
31
|
-
| Marks for example highlights | Remember slides to revisit later | In the
|
|
32
|
-
| Playback-only state | Timers or activity that spans slides | `Provider` receives `children` and `fresh`. Use `usePlayback()` inside it. Previews do not mount it.
|
|
33
|
-
| Custom slide overlays | Persistent guidance across slides | `Overlay` receives the playback state, the viewport, and the scale. `reserveWidth` reserves width for the overlay.
|
|
34
|
-
| Return links and handouts | Integrate with existing material or a site | `Player.homeHref` shows a link back. `handout` shows a link to course material in the help menu.
|
|
35
|
-
| New projects and project skills | Reuse the same technology and style | `pnpm dlx immerslides@beta create <directory>` copies the starter and the skill. Other ways to run it are in the README. Install and build with pnpm.
|
|
5
|
+
| Feature | When to use it | Entry point and limits |
|
|
6
|
+
| -------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| Cover, content, and ending | Build a consistent presentation layout | `layout` on `SlideFrame`. Fixed at 1600 × 900, scaled to fit the window. |
|
|
8
|
+
| Columns, labels, and notes | Compare two views or highlight a detail | `immerslides-columns`, `immerslides-label`, `immerslides-note`. |
|
|
9
|
+
| Complete flow diagrams | Explain an ordered process on one page | `Timeline`, with one to three nodes per row. Supports the focus, good, warn, and bad states. |
|
|
10
|
+
| Dark code window and highlighting | Show a short program or protocol message | `CodeBlock` takes the raw string, an optional file name, and a `language`. Supports common languages and aliases, keeps line breaks and indentation, and renders the text safely. |
|
|
11
|
+
| Line-by-line code focus | Explain an algorithm or configuration in sections | `CodeBlock.steps` defines line ranges and descriptions, and `step` selects the current section. Keeps syntax colors, dims the other lines, and brings the focus into view. |
|
|
12
|
+
| Step-by-step flow focus | Explain data or an operational flow immersively | `Timeline.steps` defines sections by node ID. The current node and its connectors are emphasized as `step` changes. |
|
|
13
|
+
| Free composition | Use different layouts for text, code, and flows | `CodeWindow`, `HighlightedCode`, `StepDescription`, `FlowNode`, and `FlowConnector`. They share the implementation with the ready-made layouts. |
|
|
14
|
+
| Smooth chapter navigation | Keep your place in a long talk | Set `chapters` and `Overlay: ChapterGuide`. Chapters are derived from the same slide order. |
|
|
15
|
+
| URLs, slugs, and history | Share one page or a specific step | Each slide can set a `slug`, which is otherwise generated from its title. Supports chapter aliases, `#/15` page jumps, reloads, and browser back and forward. Build links with `getSlideHref`. |
|
|
16
|
+
| Whole pages and a few steps | Set the click rhythm to fit the talk | `steps: 1` by default. Extra steps are driven by `step` in your JSX, and content is not forced to reveal line by line. |
|
|
17
|
+
| Keyboard and control bar | Present live | Arrow keys, Space, Page Up, and Page Down. You can type a slide number, or edit the current number below, then press Enter to jump or Esc to cancel. The control bar hides when idle and appears on pointer movement or keyboard focus. |
|
|
18
|
+
| Chapter and thumbnail menu | Find a slide by outline or by look | Press O to open. The text outline is a collapsible tree of chapters and slides. The thumbnail view groups slides by chapter. Clicking a slide jumps to it and updates the URL. |
|
|
19
|
+
| Help and full screen | Present on stage | Press ? for help and F to toggle full screen. Esc closes menus. Full screen depends on the browser and the host's permissions. |
|
|
20
|
+
| Presenter view | Read your notes while the audience watches the slides | Press P to open a separate window. It shows the current and next views, the notes for each slide, a timer, and playback controls, all in sync with the audience view. |
|
|
21
|
+
| Auto-save and start over | Continue the talk after a reload | sessionStorage for the same tab. Use `version` to handle content revisions, and `fresh` or `actions.restart()` to reset. |
|
|
22
|
+
| Static previews | Show thumbnails and compare page designs | `SlidePreview` does not start a playback provider. You can choose the slide and the step. |
|
|
23
|
+
| Fade and custom transitions | Connect whole pages smoothly | `fadeTransition`, or a custom `TransitionDefinition`. Returns Web Animations API animations with a finite duration. |
|
|
24
|
+
| Transition snapshots and in-step transitions | Carry the same graphic across pages or steps | A custom `capture` reads the state before a change, and `animateStep` handles changes within a step. `freezeEntranceOnNavigation` shows a page's specified state directly when navigating. |
|
|
25
|
+
| Full-bleed image page | Show one picture, screenshot, or diagram | `SlideFrame` with `layout="image"`. No chapter rail, heading, or footer. |
|
|
26
|
+
| Chapter rail options | Hide the rail for the audience, or leave a chapter unnumbered | `chapterRail: { toggle: true }` lets the audience collapse it. `numbered: false` on a chapter lists it without a number. |
|
|
27
|
+
| Presenter console (optional) | Run a talk from a separate page, with its own controls | `immerslides/presenter` exports `PresenterConsole` and `PresenterSync`. The host supplies the routes and any sign-in. See [presenter.md](presenter.md). |
|
|
28
|
+
| Reduced motion | Respect the user's preference for less animation | The player, ChapterGuide, and the built-in styles respect the system setting. Custom content uses `still`, `reducedMotion`, or `useReducedMotion()`. |
|
|
29
|
+
| Custom slide content | Native JSX, SVG, and interactive buttons | `RenderSlide` receives `SlideRenderProps`. Animations and actions must not affect static previews. |
|
|
30
|
+
| Extra controls and help | Course-specific actions or teaching aids | `Controls` receives the playback state and actions. `Help` adds content to the help menu. |
|
|
31
|
+
| Marks for example highlights | Remember slides to revisit later | In the toolbar, ☆ marks the current slide. They come from `SlideMarksProvider`, `SlideMarkControls`, and `SlideMarkNavigator`. The count next to it opens the shared menu with the "Marked" filter applied. Text and thumbnails keep the original slide numbers, and empty chapters are hidden. Each slide has a star in its top-right corner to mark or unmark it, and clicking the slide views it. Reloading or starting over clears the marks. |
|
|
32
|
+
| Playback-only state | Timers or activity that spans slides | `Provider` receives `children` and `fresh`. Use `usePlayback()` inside it. Previews do not mount it. |
|
|
33
|
+
| Custom slide overlays | Persistent guidance across slides | `Overlay` receives the playback state, the viewport, and the scale. `reserveWidth` reserves width for the overlay. |
|
|
34
|
+
| Return links and handouts | Integrate with existing material or a site | `Player.homeHref` shows a link back. `handout` shows a link to course material in the help menu. |
|
|
35
|
+
| New projects and project skills | Reuse the same technology and style | `pnpm dlx immerslides@beta create <directory>` copies the starter and the skill. Other ways to run it are in the README. Install and build with pnpm. |
|
|
36
36
|
|
|
37
37
|
## Custom playback features
|
|
38
38
|
|
package/starter/package.json
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-Hant">
|
|
3
|
+
<head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="icon" type="image/svg+xml" href="/favicon.svg"/><title>講者主控台</title></head>
|
|
4
|
+
<body><div id="root"></div><script type="module" src="/src/presenter.tsx"></script></body>
|
|
5
|
+
</html>
|
package/starter/src/config.ts
CHANGED
|
@@ -5,3 +5,6 @@ export const defaultView: 'slides' | 'site' = 'slides';
|
|
|
5
5
|
|
|
6
6
|
/** Interface language for the player and site: `zh-Hant` or `en`. Slide text lives in `deck.tsx`. */
|
|
7
7
|
export const locale: Locale = 'zh-Hant';
|
|
8
|
+
|
|
9
|
+
/** Channel that links the audience page (/slides/) to the presenter console (/presenter/). */
|
|
10
|
+
export const presenterChannel = 'immerslides-starter';
|
package/starter/src/deck.tsx
CHANGED
|
@@ -13,24 +13,19 @@ import {
|
|
|
13
13
|
SlideFrame,
|
|
14
14
|
type SlideFrameProps,
|
|
15
15
|
type SlideId,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
SlideMarkControls,
|
|
17
|
+
SlideMarkNavigator,
|
|
18
|
+
SlideMarksProvider,
|
|
18
19
|
SlidePreview,
|
|
19
20
|
type SlideRenderProps,
|
|
20
21
|
type StageOverlayProps,
|
|
21
22
|
StepDescription,
|
|
22
23
|
Timeline,
|
|
23
|
-
usePlayback,
|
|
24
24
|
useReducedMotion,
|
|
25
25
|
} from 'immerslides';
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
type ReactNode,
|
|
30
|
-
useContext,
|
|
31
|
-
useEffect,
|
|
32
|
-
useState,
|
|
33
|
-
} from 'react';
|
|
26
|
+
import { PresenterSync } from 'immerslides/presenter';
|
|
27
|
+
import type { ComponentType } from 'react';
|
|
28
|
+
import { presenterChannel } from './config';
|
|
34
29
|
import {
|
|
35
30
|
codeSteps,
|
|
36
31
|
flowItems,
|
|
@@ -39,57 +34,18 @@ import {
|
|
|
39
34
|
syntaxSamples,
|
|
40
35
|
} from './examples';
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
toggle: (id: SlideId) => void;
|
|
45
|
-
} | null>(null);
|
|
46
|
-
|
|
47
|
-
function DemoProvider({ children }: { children: ReactNode; fresh: boolean }) {
|
|
48
|
-
const { state } = usePlayback();
|
|
49
|
-
const [marked, setMarked] = useState<Set<SlideId>>(new Set());
|
|
50
|
-
useEffect(() => setMarked(new Set()), [state.generation]);
|
|
51
|
-
const toggle = (id: SlideId) =>
|
|
52
|
-
setMarked((previous) => {
|
|
53
|
-
const next = new Set(previous);
|
|
54
|
-
if (next.has(id)) next.delete(id);
|
|
55
|
-
else next.add(id);
|
|
56
|
-
return next;
|
|
57
|
-
});
|
|
58
|
-
return <Marks.Provider value={{ marked, toggle }}>{children}</Marks.Provider>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function DemoControls({ slide, openNavigator }: PlayerControlsProps) {
|
|
62
|
-
const { marked, toggle } = useContext(Marks)!;
|
|
37
|
+
/* The star, its count, the navigator stars, and the "Marked" filter all come from the package. */
|
|
38
|
+
function DemoControls(props: PlayerControlsProps) {
|
|
63
39
|
return (
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<span aria-hidden>{marked.has(slide.id) ? '★' : '☆'}</span>
|
|
74
|
-
</button>
|
|
75
|
-
<button
|
|
76
|
-
type="button"
|
|
77
|
-
className="demo-mark-count"
|
|
78
|
-
aria-label={`查看已標記頁面(${marked.size})`}
|
|
79
|
-
title="查看已標記頁面"
|
|
80
|
-
aria-haspopup="dialog"
|
|
81
|
-
onClick={() => openNavigator('marked')}
|
|
82
|
-
>
|
|
83
|
-
{marked.size}
|
|
84
|
-
</button>
|
|
85
|
-
</div>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function DemoNavigator(props: SlideNavigatorProps) {
|
|
90
|
-
const { marked, toggle } = useContext(Marks)!;
|
|
91
|
-
return (
|
|
92
|
-
<SlideNavigator {...props} markedSlides={marked} onToggleMark={toggle} />
|
|
40
|
+
<>
|
|
41
|
+
<PresenterSync
|
|
42
|
+
deck={props.deck}
|
|
43
|
+
channel={presenterChannel}
|
|
44
|
+
slideId={props.slide.id}
|
|
45
|
+
step={props.state.step}
|
|
46
|
+
/>
|
|
47
|
+
<SlideMarkControls {...props} />
|
|
48
|
+
</>
|
|
93
49
|
);
|
|
94
50
|
}
|
|
95
51
|
|
|
@@ -429,9 +385,9 @@ function Extensions() {
|
|
|
429
385
|
filename="自訂播放器介面 · js"
|
|
430
386
|
language="js"
|
|
431
387
|
>{`const extensions = {
|
|
432
|
-
Provider:
|
|
388
|
+
Provider: SlideMarksProvider,
|
|
433
389
|
Controls: DemoControls,
|
|
434
|
-
Navigator:
|
|
390
|
+
Navigator: SlideMarkNavigator,
|
|
435
391
|
Help: DemoHelp,
|
|
436
392
|
Overlay: DemoOverlay,
|
|
437
393
|
reserveWidth: (slide, viewport) =>
|
|
@@ -732,6 +688,7 @@ export const deck = defineDeck({
|
|
|
732
688
|
slug,
|
|
733
689
|
})),
|
|
734
690
|
chapters: [
|
|
691
|
+
{ id: 'start', title: '開始之前', slideId: 'cover', numbered: false },
|
|
735
692
|
{ id: 'basics', title: '版型與內容', slug: 'content', slideId: 'overview' },
|
|
736
693
|
{ id: 'playback', title: '播放與動態', slideId: 'steps' },
|
|
737
694
|
{ id: 'extend', title: '擴充與重用', slideId: 'extensions' },
|
|
@@ -742,9 +699,10 @@ export const deck = defineDeck({
|
|
|
742
699
|
Overlay: DemoOverlay,
|
|
743
700
|
reserveWidth: (slide, viewport) =>
|
|
744
701
|
hasReservedNote(slide, viewport) ? 320 : 0,
|
|
745
|
-
Provider:
|
|
702
|
+
Provider: SlideMarksProvider,
|
|
746
703
|
Controls: DemoControls,
|
|
747
|
-
Navigator:
|
|
704
|
+
Navigator: SlideMarkNavigator,
|
|
705
|
+
chapterRail: { toggle: true },
|
|
748
706
|
handout: {
|
|
749
707
|
title: '功能速查講義',
|
|
750
708
|
href: new URL(/* @vite-ignore */ '../handout.html', import.meta.url).href,
|
|
@@ -752,9 +710,9 @@ export const deck = defineDeck({
|
|
|
752
710
|
Help: () => (
|
|
753
711
|
<p className="help-copy">
|
|
754
712
|
工具列的 ☆
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
713
|
+
可以標記目前頁面。點星號旁的數字,會在章節與投影片選單開啟「已標記」篩選,可切換文字與縮圖查看。標記由
|
|
714
|
+
SlideMarksProvider
|
|
715
|
+
保存在記憶體,重新整理或從頭開始會清除。播放進度則由播放器獨立保存在本分頁。章節列可以從工具列收合,選擇會記在這個瀏覽器。
|
|
758
716
|
</p>
|
|
759
717
|
),
|
|
760
718
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PresenterConsole } from 'immerslides/presenter';
|
|
2
|
+
import { locale, presenterChannel } from './config';
|
|
3
|
+
import { deck } from './deck';
|
|
4
|
+
import { mount } from './mount';
|
|
5
|
+
|
|
6
|
+
/* The presenter console has its own route. It drives the audience page (/slides/) in another
|
|
7
|
+
window of this browser. The starter has no sign-in: before you deploy, check that the visitor
|
|
8
|
+
is the presenter (the package does not provide sign-in). */
|
|
9
|
+
mount(
|
|
10
|
+
<PresenterConsole
|
|
11
|
+
deck={deck}
|
|
12
|
+
channel={presenterChannel}
|
|
13
|
+
audienceHref="../slides/"
|
|
14
|
+
locale={locale}
|
|
15
|
+
/>,
|
|
16
|
+
);
|
package/starter/src/styles.css
CHANGED
|
@@ -179,42 +179,6 @@ body {
|
|
|
179
179
|
background: #0071e3;
|
|
180
180
|
animation: demo-travel 3s ease-in-out infinite;
|
|
181
181
|
}
|
|
182
|
-
.immerslides-player .demo-mark-controls {
|
|
183
|
-
display: flex;
|
|
184
|
-
flex-shrink: 0;
|
|
185
|
-
margin-left: 4px;
|
|
186
|
-
border: 1px solid #d2d2d7;
|
|
187
|
-
border-radius: 8px;
|
|
188
|
-
}
|
|
189
|
-
.immerslides-player .demo-mark-controls > button {
|
|
190
|
-
min-width: 26px;
|
|
191
|
-
padding: 6px 4px;
|
|
192
|
-
border: 0;
|
|
193
|
-
border-radius: 7px;
|
|
194
|
-
background: none;
|
|
195
|
-
color: #0071e3;
|
|
196
|
-
font: inherit;
|
|
197
|
-
cursor: pointer;
|
|
198
|
-
}
|
|
199
|
-
.immerslides-player .demo-mark-controls > .demo-mark {
|
|
200
|
-
display: inline-flex;
|
|
201
|
-
align-items: center;
|
|
202
|
-
justify-content: center;
|
|
203
|
-
padding-inline: 2px;
|
|
204
|
-
font-size: 21px;
|
|
205
|
-
line-height: 24px;
|
|
206
|
-
}
|
|
207
|
-
.immerslides-player .demo-mark-controls > .demo-mark-count {
|
|
208
|
-
border-left: 1px solid #e8e8ed;
|
|
209
|
-
border-radius: 0 7px 7px 0;
|
|
210
|
-
}
|
|
211
|
-
.immerslides-player .demo-mark-controls > button:hover {
|
|
212
|
-
background: #e8f2ff;
|
|
213
|
-
}
|
|
214
|
-
.immerslides-player .demo-mark-controls button:focus-visible {
|
|
215
|
-
outline: 2px solid #0071e3;
|
|
216
|
-
outline-offset: 2px;
|
|
217
|
-
}
|
|
218
182
|
.demo-reserved-note {
|
|
219
183
|
box-sizing: border-box;
|
|
220
184
|
position: absolute;
|
package/starter/vite.config.ts
CHANGED
|
@@ -3,7 +3,7 @@ import react from '@vitejs/plugin-react';
|
|
|
3
3
|
import { type Connect, defineConfig, type Plugin } from 'vite';
|
|
4
4
|
|
|
5
5
|
const entry = (path: string) => fileURLToPath(new URL(path, import.meta.url));
|
|
6
|
-
const pages = ['slides', 'site'];
|
|
6
|
+
const pages = ['slides', 'site', 'presenter'];
|
|
7
7
|
|
|
8
8
|
/** Sends `/slides` to `/slides/` so the page and its relative URLs load from its own directory. */
|
|
9
9
|
export const pageRedirects = (): Plugin => {
|