@open-slide/core 2.3.1 → 2.4.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.
- package/dist/{build-8lRsgsO4.js → build-D7GwYl8d.js} +1 -1
- package/dist/cli/bin.js +4 -4
- package/dist/{config-CDrYgaEj.d.ts → config-CfhtJxQH.d.ts} +1 -1
- package/dist/{config-D2Mq1vSW.js → config-D4uPk_tM.js} +383 -138
- package/dist/{dev-BvefEp1Q.js → dev-DyCDMbHB.js} +10 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{preview-D8ognobz.js → preview-DjIFvt0K.js} +1 -1
- package/dist/{types-DFK02XVv.d.ts → types-ZfArJF0d.d.ts} +21 -13
- package/dist/{update-BivdNgL3.js → update-BKhRM7o4.js} +30 -3
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-B1pkKQsc.js → zh-tw-D7LfGVmA.js} +220 -65
- package/package.json +5 -6
- package/src/agent/provider.ts +8 -1
- package/src/agent/types.ts +17 -2
- package/src/app/app.tsx +2 -0
- package/src/app/components/agent/agent-markdown.tsx +3 -6
- package/src/app/components/agent/agent-panel.tsx +36 -258
- package/src/app/components/agent/agent-presence.tsx +1 -1
- package/src/app/components/agent/composer.tsx +52 -24
- package/src/app/components/agent/effort-slider.tsx +172 -0
- package/src/app/components/agent/model-menu.tsx +170 -0
- package/src/app/components/agent/permission-menu.tsx +88 -0
- package/src/app/components/agent/transcript.tsx +23 -31
- package/src/app/components/command/home-command-menu.tsx +4 -1
- package/src/app/components/command/slide-command-menu.tsx +4 -1
- package/src/app/components/export-progress-toast.tsx +3 -1
- package/src/app/components/inspector/asset-picker-dialog.tsx +1 -1
- package/src/app/components/inspector/comment-layer.tsx +3 -3
- package/src/app/components/inspector/inline-text-editor.tsx +1 -12
- package/src/app/components/inspector/inspect-overlay.tsx +9 -1
- package/src/app/components/inspector/inspector-panel.tsx +8 -35
- package/src/app/components/inspector/inspector-provider.tsx +177 -36
- package/src/app/components/inspector/page-panel.tsx +270 -0
- package/src/app/components/language-toggle.tsx +13 -11
- package/src/app/components/note-markdown.test.tsx +12 -6
- package/src/app/components/note-markdown.tsx +16 -21
- package/src/app/components/overview-grid.tsx +3 -3
- package/src/app/components/panel/editor-sidebar.tsx +43 -8
- package/src/app/components/panel/panel-shell.tsx +9 -5
- package/src/app/components/panel/save-card.tsx +1 -1
- package/src/app/components/player.tsx +105 -23
- package/src/app/components/present/curtain.tsx +52 -0
- package/src/app/components/present/last-slide-hint.tsx +36 -0
- package/src/app/components/sidebar/folder-item.tsx +4 -1
- package/src/app/components/sidebar/sidebar.tsx +11 -8
- package/src/app/components/slide-canvas.tsx +1 -1
- package/src/app/components/style-panel/design-provider.tsx +48 -11
- package/src/app/components/style-panel/use-design.ts +6 -1
- package/src/app/components/theme-toggle.tsx +16 -22
- package/src/app/components/thumbnail-rail.tsx +69 -50
- package/src/app/components/ui/context-menu.tsx +9 -10
- package/src/app/components/ui/dialog.tsx +2 -4
- package/src/app/components/ui/dropdown-menu.tsx +9 -10
- package/src/app/components/ui/popover.tsx +1 -1
- package/src/app/components/ui/select.tsx +2 -2
- package/src/app/components/ui/sonner.tsx +2 -2
- package/src/app/index.html +7 -0
- package/src/app/lib/agent/use-agent.ts +131 -37
- package/src/app/lib/desktop-host.ts +31 -0
- package/src/app/lib/desktop-routes.test.ts +54 -0
- package/src/app/lib/desktop-routes.ts +22 -0
- package/src/app/lib/desktop.ts +106 -0
- package/src/app/lib/export-pdf.ts +15 -7
- package/src/app/lib/inspector/color.ts +51 -0
- package/src/app/lib/inspector/fiber.ts +6 -0
- package/src/app/lib/inspector/use-editor.ts +2 -1
- package/src/app/lib/inspector/use-notes.test.ts +209 -0
- package/src/app/lib/inspector/use-notes.ts +331 -57
- package/src/app/lib/inspector/use-visual-editor.ts +9 -1
- package/src/app/lib/locale-store.ts +14 -2
- package/src/app/lib/note-markdown.test.ts +69 -5
- package/src/app/lib/note-markdown.ts +97 -22
- package/src/app/lib/transition.test.ts +84 -1
- package/src/app/lib/transition.ts +43 -0
- package/src/app/lib/unsaved.test.ts +253 -0
- package/src/app/lib/unsaved.ts +155 -0
- package/src/app/routes/home.tsx +14 -6
- package/src/app/routes/slide.tsx +184 -130
- package/src/app/styles.css +421 -1
- package/src/locale/en.ts +41 -15
- package/src/locale/es.ts +41 -17
- package/src/locale/ja.ts +41 -15
- package/src/locale/types.ts +20 -14
- package/src/locale/zh-cn.ts +41 -14
- package/src/locale/zh-tw.ts +41 -14
package/src/app/routes/slide.tsx
CHANGED
|
@@ -62,8 +62,13 @@ import {
|
|
|
62
62
|
DropdownMenuTrigger,
|
|
63
63
|
} from '@/components/ui/dropdown-menu';
|
|
64
64
|
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
65
|
-
import {
|
|
66
|
-
|
|
65
|
+
import {
|
|
66
|
+
setDockOpen,
|
|
67
|
+
useAgentActivity,
|
|
68
|
+
useAgentDock,
|
|
69
|
+
useSessionHandoff,
|
|
70
|
+
} from '@/lib/agent/use-agent';
|
|
71
|
+
import { openHomeInHost } from '@/lib/desktop';
|
|
67
72
|
import { useFolders } from '@/lib/folders';
|
|
68
73
|
import {
|
|
69
74
|
hasModifier,
|
|
@@ -73,7 +78,6 @@ import {
|
|
|
73
78
|
isTypingTarget,
|
|
74
79
|
} from '@/lib/keys';
|
|
75
80
|
import { readLastHomeLocation } from '@/lib/last-home-location';
|
|
76
|
-
import { useAgentSocketConnected } from '@/lib/use-agent-socket';
|
|
77
81
|
import { useClickPageNavigation } from '@/lib/use-click-page-navigation';
|
|
78
82
|
import { useDocumentTitle } from '@/lib/use-document-title';
|
|
79
83
|
import { useIsMobile } from '@/lib/use-is-mobile';
|
|
@@ -87,6 +91,12 @@ import { PdfProgressToast, PptxProgressToast } from '../components/export-progre
|
|
|
87
91
|
import { NotesDrawer } from '../components/notes-drawer';
|
|
88
92
|
import { OverviewGrid } from '../components/overview-grid';
|
|
89
93
|
import { openPresenterWindow, Player } from '../components/player';
|
|
94
|
+
import {
|
|
95
|
+
afterPaint,
|
|
96
|
+
CURTAIN_FADE_MS,
|
|
97
|
+
PresentCurtain,
|
|
98
|
+
whenFullscreenSettled,
|
|
99
|
+
} from '../components/present/curtain';
|
|
90
100
|
import { SlideCanvas } from '../components/slide-canvas';
|
|
91
101
|
import { isDeckWarmed, markDeckWarmed, SlidePreloadLayer } from '../components/slide-preload-layer';
|
|
92
102
|
import { SlideTransitionLayer } from '../components/slide-transition-layer';
|
|
@@ -98,7 +108,7 @@ import {
|
|
|
98
108
|
exportSlideAsPptx,
|
|
99
109
|
type PptxExportProgress,
|
|
100
110
|
} from '../lib/export-pptx';
|
|
101
|
-
import {
|
|
111
|
+
import { changeNotesPages } from '../lib/inspector/use-notes';
|
|
102
112
|
import type { SlideModule } from '../lib/sdk';
|
|
103
113
|
import { usePrefersReducedMotion } from '../lib/use-prefers-reduced-motion';
|
|
104
114
|
import { useSlideModule } from '../lib/use-slide-module';
|
|
@@ -107,6 +117,12 @@ const { showSlideUi, showSlideBrowser, allowHtmlDownload } = config.build;
|
|
|
107
117
|
|
|
108
118
|
const noop = () => {};
|
|
109
119
|
|
|
120
|
+
type PagePlan = {
|
|
121
|
+
order: number[];
|
|
122
|
+
request: string;
|
|
123
|
+
init: RequestInit;
|
|
124
|
+
};
|
|
125
|
+
|
|
110
126
|
export function Slide() {
|
|
111
127
|
const { slideId = '' } = useParams();
|
|
112
128
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
@@ -114,6 +130,7 @@ export function Slide() {
|
|
|
114
130
|
// react-router records its entry index in history.state; going back is only
|
|
115
131
|
// safe when we actually pushed an entry, otherwise land on the last home view.
|
|
116
132
|
const goBack = useCallback(() => {
|
|
133
|
+
if (openHomeInHost()) return;
|
|
117
134
|
const idx = (window.history.state as { idx?: number } | null)?.idx ?? 0;
|
|
118
135
|
if (idx > 0) {
|
|
119
136
|
navigate(-1);
|
|
@@ -141,6 +158,7 @@ export function Slide() {
|
|
|
141
158
|
const [overviewOpen, setOverviewOpen] = useState(false);
|
|
142
159
|
const [commandOpen, setCommandOpen] = useState(false);
|
|
143
160
|
const { open: agentOpen, toggle: toggleAgent } = useAgentDock();
|
|
161
|
+
useSessionHandoff(slideId);
|
|
144
162
|
useLayoutEffect(() => {
|
|
145
163
|
if (agentOpen) setDesignOpen(false);
|
|
146
164
|
}, [agentOpen]);
|
|
@@ -166,11 +184,65 @@ export function Slide() {
|
|
|
166
184
|
const narrowToolbar = useMediaQuery('(max-width: 639.98px)');
|
|
167
185
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
168
186
|
|
|
187
|
+
// 'entering' darkens the editor before the Player mounts; 'leaving' keeps
|
|
188
|
+
// the editor dark after the Player unmounts, then fades it back in.
|
|
189
|
+
const [curtain, setCurtain] = useState<'entering' | 'leaving' | null>(null);
|
|
190
|
+
const curtainTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
191
|
+
useEffect(
|
|
192
|
+
() => () => {
|
|
193
|
+
if (curtainTimerRef.current) clearTimeout(curtainTimerRef.current);
|
|
194
|
+
},
|
|
195
|
+
[],
|
|
196
|
+
);
|
|
197
|
+
const present = useCallback(
|
|
198
|
+
(mode: 'window' | 'fullscreen') => {
|
|
199
|
+
if (prefersReducedMotion) {
|
|
200
|
+
setPlayMode(mode);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (curtainTimerRef.current) return;
|
|
204
|
+
setCurtain('entering');
|
|
205
|
+
// Fullscreen is requested when the Player mounts; the delay stays well
|
|
206
|
+
// inside the browser's transient user-activation window.
|
|
207
|
+
curtainTimerRef.current = setTimeout(() => {
|
|
208
|
+
curtainTimerRef.current = null;
|
|
209
|
+
setCurtain(null);
|
|
210
|
+
setPlayMode(mode);
|
|
211
|
+
}, CURTAIN_FADE_MS);
|
|
212
|
+
},
|
|
213
|
+
[prefersReducedMotion],
|
|
214
|
+
);
|
|
215
|
+
const exitPresent = useCallback(() => {
|
|
216
|
+
setPlayMode(null);
|
|
217
|
+
if (!prefersReducedMotion) setCurtain('leaving');
|
|
218
|
+
}, [prefersReducedMotion]);
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
if (curtain !== 'leaving' || playMode) return;
|
|
221
|
+
let cancelPaint = () => {};
|
|
222
|
+
const reveal = () => {
|
|
223
|
+
cancelPaint = afterPaint(() => setCurtain(null));
|
|
224
|
+
};
|
|
225
|
+
if (!document.fullscreenElement) {
|
|
226
|
+
reveal();
|
|
227
|
+
return () => cancelPaint();
|
|
228
|
+
}
|
|
229
|
+
const cancelWait = whenFullscreenSettled(reveal);
|
|
230
|
+
return () => {
|
|
231
|
+
cancelWait();
|
|
232
|
+
cancelPaint();
|
|
233
|
+
};
|
|
234
|
+
}, [curtain, playMode]);
|
|
235
|
+
|
|
236
|
+
const routedRef = useRef(slideId);
|
|
237
|
+
routedRef.current = slideId;
|
|
169
238
|
const modulePages = useMemo(() => slide?.default ?? [], [slide]);
|
|
170
|
-
|
|
239
|
+
// Tagged with its deck: right after a route change the old deck's module is
|
|
240
|
+
// still loaded under the new slideId.
|
|
241
|
+
const [deck, setDeck] = useState({ slideId, pages: modulePages });
|
|
171
242
|
useEffect(() => {
|
|
172
|
-
|
|
243
|
+
setDeck({ slideId: routedRef.current, pages: modulePages });
|
|
173
244
|
}, [modulePages]);
|
|
245
|
+
const pages = deck.pages;
|
|
174
246
|
const pageCount = pages.length;
|
|
175
247
|
const rawIndex = Number(searchParams.get('p') ?? '1') - 1;
|
|
176
248
|
const index = Number.isFinite(rawIndex) ? Math.max(0, Math.min(pageCount - 1, rawIndex)) : 0;
|
|
@@ -195,19 +267,23 @@ export function Slide() {
|
|
|
195
267
|
[navigate],
|
|
196
268
|
);
|
|
197
269
|
|
|
198
|
-
const
|
|
270
|
+
const showPage = useCallback(
|
|
199
271
|
(i: number) => {
|
|
200
|
-
const clamped = Math.max(0, Math.min(pageCount - 1, i));
|
|
201
272
|
setSearchParams(
|
|
202
273
|
(prev) => {
|
|
203
274
|
const next = new URLSearchParams(prev);
|
|
204
|
-
next.set('p', String(
|
|
275
|
+
next.set('p', String(i + 1));
|
|
205
276
|
return next;
|
|
206
277
|
},
|
|
207
278
|
{ replace: true },
|
|
208
279
|
);
|
|
209
280
|
},
|
|
210
|
-
[
|
|
281
|
+
[setSearchParams],
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
const goTo = useCallback(
|
|
285
|
+
(i: number) => showPage(Math.max(0, Math.min(pageCount - 1, i))),
|
|
286
|
+
[pageCount, showPage],
|
|
211
287
|
);
|
|
212
288
|
|
|
213
289
|
// While an agent writes this deck page by page, jump to each page as it
|
|
@@ -220,104 +296,114 @@ export function Slide() {
|
|
|
220
296
|
seenPageCount.current = pageCount;
|
|
221
297
|
}, [agentWriting, pageCount, goTo]);
|
|
222
298
|
|
|
299
|
+
const deckRef = useRef(deck);
|
|
300
|
+
deckRef.current = deck;
|
|
301
|
+
const indexRef = useRef(index);
|
|
302
|
+
indexRef.current = index;
|
|
303
|
+
|
|
304
|
+
// Notes can be mid-save when a page op is asked for, so the op is planned from
|
|
305
|
+
// the pages and position current once those writes settle, and dropped if the
|
|
306
|
+
// route has moved to another deck by then.
|
|
307
|
+
const changePages = useCallback(
|
|
308
|
+
(plan: (order: number[]) => PagePlan | null) =>
|
|
309
|
+
changeNotesPages(slideId, () => {
|
|
310
|
+
const { slideId: owner, pages: before } = deckRef.current;
|
|
311
|
+
if (routedRef.current !== slideId || owner !== slideId) return null;
|
|
312
|
+
const at = indexRef.current;
|
|
313
|
+
const next = plan(before.map((_, i) => i));
|
|
314
|
+
if (!next) return null;
|
|
315
|
+
const moved = next.order.map((i) => before[i]);
|
|
316
|
+
const position = next.order.indexOf(at);
|
|
317
|
+
const nextIndex = position < 0 ? Math.min(at, next.order.length - 1) : position;
|
|
318
|
+
return {
|
|
319
|
+
order: next.order,
|
|
320
|
+
apply: async () => {
|
|
321
|
+
setDeck({ slideId, pages: moved });
|
|
322
|
+
if (nextIndex !== at) showPage(nextIndex);
|
|
323
|
+
const res = await fetch(next.request, next.init);
|
|
324
|
+
const body = (await res.json().catch(() => ({ error: res.statusText }))) as {
|
|
325
|
+
error?: string;
|
|
326
|
+
layout?: string;
|
|
327
|
+
};
|
|
328
|
+
if (!res.ok) throw new Error(body.error ?? `HTTP ${res.status}`);
|
|
329
|
+
return body.layout;
|
|
330
|
+
},
|
|
331
|
+
revert: () => {
|
|
332
|
+
setDeck((current) => (current.pages === moved ? { slideId, pages: before } : current));
|
|
333
|
+
if (nextIndex !== at && routedRef.current === slideId) showPage(at);
|
|
334
|
+
},
|
|
335
|
+
};
|
|
336
|
+
}),
|
|
337
|
+
[slideId, showPage],
|
|
338
|
+
);
|
|
339
|
+
|
|
223
340
|
const reorderPage = useCallback(
|
|
224
341
|
async (from: number, to: number) => {
|
|
225
342
|
if (from === to) return;
|
|
226
|
-
const before = pages;
|
|
227
|
-
const nextPages = [...before];
|
|
228
|
-
const [moved] = nextPages.splice(from, 1);
|
|
229
|
-
nextPages.splice(to, 0, moved);
|
|
230
|
-
setPages(nextPages);
|
|
231
|
-
|
|
232
|
-
const order = before.map((_, i) => i);
|
|
233
|
-
const [movedIdx] = order.splice(from, 1);
|
|
234
|
-
order.splice(to, 0, movedIdx);
|
|
235
|
-
|
|
236
|
-
remapNotesSessionCacheAfterReorder(slideId, order);
|
|
237
|
-
|
|
238
|
-
// Keep the user looking at the same page they were on before the drag.
|
|
239
|
-
let nextIndex = index;
|
|
240
|
-
if (index === from) nextIndex = to;
|
|
241
|
-
else if (from < index && to >= index) nextIndex = index - 1;
|
|
242
|
-
else if (from > index && to <= index) nextIndex = index + 1;
|
|
243
|
-
if (nextIndex !== index) goTo(nextIndex);
|
|
244
|
-
|
|
245
343
|
try {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
344
|
+
await changePages((order) => {
|
|
345
|
+
if (from < 0 || to < 0 || from >= order.length || to >= order.length) return null;
|
|
346
|
+
const [moved] = order.splice(from, 1);
|
|
347
|
+
order.splice(to, 0, moved);
|
|
348
|
+
return {
|
|
349
|
+
order,
|
|
350
|
+
request: `/__slides/${encodeURIComponent(slideId)}/reorder`,
|
|
351
|
+
init: {
|
|
352
|
+
method: 'PUT',
|
|
353
|
+
headers: { 'content-type': 'application/json' },
|
|
354
|
+
body: JSON.stringify({ order }),
|
|
355
|
+
},
|
|
356
|
+
};
|
|
250
357
|
});
|
|
251
|
-
if (!res.ok) {
|
|
252
|
-
const detail = await res.json().catch(() => ({ error: res.statusText }));
|
|
253
|
-
throw new Error(detail.error ?? `HTTP ${res.status}`);
|
|
254
|
-
}
|
|
255
358
|
} catch (err) {
|
|
256
|
-
setPages(before);
|
|
257
|
-
const inverse = order.map((_, i) => order.indexOf(i));
|
|
258
|
-
remapNotesSessionCacheAfterReorder(slideId, inverse);
|
|
259
359
|
toast.error(`Reorder failed: ${String((err as Error).message ?? err)}`);
|
|
260
360
|
}
|
|
261
361
|
},
|
|
262
|
-
[
|
|
362
|
+
[slideId, changePages],
|
|
263
363
|
);
|
|
264
364
|
|
|
265
365
|
const duplicatePage = useCallback(
|
|
266
366
|
async (i: number) => {
|
|
267
|
-
const before = pages;
|
|
268
|
-
if (i < 0 || i >= before.length) return;
|
|
269
|
-
const nextPages = [...before];
|
|
270
|
-
nextPages.splice(i + 1, 0, before[i]);
|
|
271
|
-
setPages(nextPages);
|
|
272
|
-
if (index > i) goTo(index + 1);
|
|
273
|
-
|
|
274
367
|
try {
|
|
275
|
-
const
|
|
276
|
-
|
|
368
|
+
const changed = await changePages((order) => {
|
|
369
|
+
if (i < 0 || i >= order.length) return null;
|
|
370
|
+
order.splice(i + 1, 0, i);
|
|
371
|
+
return {
|
|
372
|
+
order,
|
|
373
|
+
request: `/__slides/${encodeURIComponent(slideId)}/pages/${i}/duplicate`,
|
|
374
|
+
init: { method: 'POST' },
|
|
375
|
+
};
|
|
277
376
|
});
|
|
278
|
-
if (
|
|
279
|
-
const detail = await res.json().catch(() => ({ error: res.statusText }));
|
|
280
|
-
throw new Error(detail.error ?? `HTTP ${res.status}`);
|
|
281
|
-
}
|
|
282
|
-
toast.success(format(t.thumbnailRail.toastDuplicated, { n: i + 1 }));
|
|
377
|
+
if (changed) toast.success(format(t.thumbnailRail.toastDuplicated, { n: i + 1 }));
|
|
283
378
|
} catch (err) {
|
|
284
|
-
setPages(before);
|
|
285
379
|
toast.error(
|
|
286
380
|
`${t.thumbnailRail.toastDuplicateFailed}: ${String((err as Error).message ?? err)}`,
|
|
287
381
|
);
|
|
288
382
|
}
|
|
289
383
|
},
|
|
290
|
-
[
|
|
384
|
+
[slideId, changePages, t.thumbnailRail],
|
|
291
385
|
);
|
|
292
386
|
|
|
293
387
|
const deletePage = useCallback(
|
|
294
388
|
async (i: number) => {
|
|
295
|
-
const before = pages;
|
|
296
|
-
if (i < 0 || i >= before.length || before.length <= 1) return;
|
|
297
|
-
const nextPages = before.slice(0, i).concat(before.slice(i + 1));
|
|
298
|
-
setPages(nextPages);
|
|
299
|
-
if (index >= i && index > 0) {
|
|
300
|
-
const target = index === i ? Math.min(index, nextPages.length - 1) : index - 1;
|
|
301
|
-
goTo(target);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
389
|
try {
|
|
305
|
-
const
|
|
306
|
-
|
|
390
|
+
const changed = await changePages((order) => {
|
|
391
|
+
if (i < 0 || i >= order.length || order.length <= 1) return null;
|
|
392
|
+
order.splice(i, 1);
|
|
393
|
+
return {
|
|
394
|
+
order,
|
|
395
|
+
request: `/__slides/${encodeURIComponent(slideId)}/pages/${i}`,
|
|
396
|
+
init: { method: 'DELETE' },
|
|
397
|
+
};
|
|
307
398
|
});
|
|
308
|
-
if (
|
|
309
|
-
const detail = await res.json().catch(() => ({ error: res.statusText }));
|
|
310
|
-
throw new Error(detail.error ?? `HTTP ${res.status}`);
|
|
311
|
-
}
|
|
312
|
-
toast.success(format(t.thumbnailRail.toastDeleted, { n: i + 1 }));
|
|
399
|
+
if (changed) toast.success(format(t.thumbnailRail.toastDeleted, { n: i + 1 }));
|
|
313
400
|
} catch (err) {
|
|
314
|
-
setPages(before);
|
|
315
401
|
toast.error(
|
|
316
402
|
`${t.thumbnailRail.toastDeleteFailed}: ${String((err as Error).message ?? err)}`,
|
|
317
403
|
);
|
|
318
404
|
}
|
|
319
405
|
},
|
|
320
|
-
[
|
|
406
|
+
[slideId, changePages, t.thumbnailRail],
|
|
321
407
|
);
|
|
322
408
|
|
|
323
409
|
const thumbnailActions = useMemo<ThumbnailActions | undefined>(
|
|
@@ -335,7 +421,7 @@ export function Slide() {
|
|
|
335
421
|
// When showSlideUi is false the read-only <Player> is rendered and owns
|
|
336
422
|
// keyboard navigation (including step-aware advance/retreat). Attaching this
|
|
337
423
|
// page-nav handler too would race it and skip <Steps> reveals, so bail out.
|
|
338
|
-
if (playMode || !showSlideUi) return;
|
|
424
|
+
if (playMode || curtain || !showSlideUi) return;
|
|
339
425
|
const onKey = (e: KeyboardEvent) => {
|
|
340
426
|
if (
|
|
341
427
|
isTypingTarget(e.target) ||
|
|
@@ -368,12 +454,12 @@ export function Slide() {
|
|
|
368
454
|
return;
|
|
369
455
|
}
|
|
370
456
|
if (e.key === 'f' || e.key === 'F') {
|
|
371
|
-
|
|
457
|
+
present('fullscreen');
|
|
372
458
|
} else if (e.key === 'Enter') {
|
|
373
|
-
|
|
459
|
+
present('window');
|
|
374
460
|
} else if (e.key === 'p' || e.key === 'P') {
|
|
375
461
|
if (slideId) openPresenterWindow(slideId);
|
|
376
|
-
|
|
462
|
+
present('window');
|
|
377
463
|
} else if (import.meta.env.DEV && (e.key === 'd' || e.key === 'D')) {
|
|
378
464
|
setDesignOpen((v) => !v);
|
|
379
465
|
} else if (import.meta.env.DEV && (e.key === 'a' || e.key === 'A')) {
|
|
@@ -382,7 +468,7 @@ export function Slide() {
|
|
|
382
468
|
};
|
|
383
469
|
window.addEventListener('keydown', onKey);
|
|
384
470
|
return () => window.removeEventListener('keydown', onKey);
|
|
385
|
-
}, [index, goTo, playMode, slideId, overviewOpen, toggleAgent]);
|
|
471
|
+
}, [index, goTo, playMode, curtain, slideId, overviewOpen, toggleAgent, present]);
|
|
386
472
|
|
|
387
473
|
if (error) {
|
|
388
474
|
return (
|
|
@@ -423,8 +509,9 @@ export function Slide() {
|
|
|
423
509
|
transition={presented.slide.transition}
|
|
424
510
|
index={presented.index}
|
|
425
511
|
onIndexChange={presentReady ? goTo : noop}
|
|
426
|
-
onExit={
|
|
512
|
+
onExit={exitPresent}
|
|
427
513
|
controls
|
|
514
|
+
curtain={!prefersReducedMotion}
|
|
428
515
|
slideId={presented.slideId}
|
|
429
516
|
onSwitchSlide={switchPresentedSlide}
|
|
430
517
|
fullscreen={playMode === 'fullscreen'}
|
|
@@ -689,7 +776,6 @@ export function Slide() {
|
|
|
689
776
|
</TabsList>
|
|
690
777
|
</Tabs>
|
|
691
778
|
)}
|
|
692
|
-
{import.meta.env.DEV && <AgentConnectedBadge />}
|
|
693
779
|
</div>
|
|
694
780
|
|
|
695
781
|
<div className="col-span-3 row-start-2 flex min-w-0 justify-center sm:col-span-1 sm:col-start-2 sm:row-start-1">
|
|
@@ -801,7 +887,7 @@ export function Slide() {
|
|
|
801
887
|
size="sm"
|
|
802
888
|
variant="brand"
|
|
803
889
|
aria-label={t.slide.present}
|
|
804
|
-
onClick={() =>
|
|
890
|
+
onClick={() => present(isMobile ? 'window' : 'fullscreen')}
|
|
805
891
|
className="rounded-r-none px-2.5 lg:px-3"
|
|
806
892
|
>
|
|
807
893
|
<Play className="size-3.5 fill-current" />
|
|
@@ -821,12 +907,12 @@ export function Slide() {
|
|
|
821
907
|
</DropdownMenuTrigger>
|
|
822
908
|
<DropdownMenuContent align="end" className="min-w-[200px]">
|
|
823
909
|
<DropdownMenuGroup>
|
|
824
|
-
<DropdownMenuItem onClick={() =>
|
|
910
|
+
<DropdownMenuItem onClick={() => present('window')}>
|
|
825
911
|
<Play />
|
|
826
912
|
{t.slide.presentInWindow}
|
|
827
913
|
<DropdownMenuShortcut>↵</DropdownMenuShortcut>
|
|
828
914
|
</DropdownMenuItem>
|
|
829
|
-
<DropdownMenuItem onClick={() =>
|
|
915
|
+
<DropdownMenuItem onClick={() => present('fullscreen')}>
|
|
830
916
|
<Maximize />
|
|
831
917
|
{t.slide.presentFullscreen}
|
|
832
918
|
<DropdownMenuShortcut>F</DropdownMenuShortcut>
|
|
@@ -834,7 +920,7 @@ export function Slide() {
|
|
|
834
920
|
<DropdownMenuItem
|
|
835
921
|
onClick={() => {
|
|
836
922
|
if (slideId) openPresenterWindow(slideId);
|
|
837
|
-
|
|
923
|
+
present('window');
|
|
838
924
|
}}
|
|
839
925
|
>
|
|
840
926
|
<MonitorSpeaker />
|
|
@@ -915,6 +1001,14 @@ export function Slide() {
|
|
|
915
1001
|
designOpen={designOpen}
|
|
916
1002
|
onCloseDesign={() => setDesignOpen(false)}
|
|
917
1003
|
agentOpen={agentOpen}
|
|
1004
|
+
page={{
|
|
1005
|
+
index,
|
|
1006
|
+
total: pageCount,
|
|
1007
|
+
component: pages[index],
|
|
1008
|
+
transition: pages[index]?.transition ?? slide.transition,
|
|
1009
|
+
inheritedTransition: !pages[index]?.transition && Boolean(slide.transition),
|
|
1010
|
+
themed: Boolean(slide.design),
|
|
1011
|
+
}}
|
|
918
1012
|
agent={
|
|
919
1013
|
import.meta.env.DEV && (
|
|
920
1014
|
<SlideAgentDock
|
|
@@ -957,11 +1051,11 @@ export function Slide() {
|
|
|
957
1051
|
currentIndex={index}
|
|
958
1052
|
exporting={exporting}
|
|
959
1053
|
handlers={{
|
|
960
|
-
onPresentWindow: () =>
|
|
961
|
-
onPresentFullscreen: () =>
|
|
1054
|
+
onPresentWindow: () => present('window'),
|
|
1055
|
+
onPresentFullscreen: () => present('fullscreen'),
|
|
962
1056
|
onPresenterView: () => {
|
|
963
1057
|
if (slideId) openPresenterWindow(slideId);
|
|
964
|
-
|
|
1058
|
+
present('window');
|
|
965
1059
|
},
|
|
966
1060
|
onCopyLink: copyLink,
|
|
967
1061
|
onOverview: () => setOverviewOpen(true),
|
|
@@ -976,6 +1070,7 @@ export function Slide() {
|
|
|
976
1070
|
/>
|
|
977
1071
|
)}
|
|
978
1072
|
</div>
|
|
1073
|
+
<PresentCurtain opaque={curtain !== null} className="fixed z-[1000]" />
|
|
979
1074
|
</InspectorProvider>
|
|
980
1075
|
</HistoryProvider>
|
|
981
1076
|
);
|
|
@@ -1095,47 +1190,6 @@ function SlideAgentDock({
|
|
|
1095
1190
|
return <AgentPanel context={context} onClose={() => setDockOpen(false)} />;
|
|
1096
1191
|
}
|
|
1097
1192
|
|
|
1098
|
-
function AgentConnectedBadge() {
|
|
1099
|
-
const t = useLocale();
|
|
1100
|
-
const connected = useAgentSocketConnected();
|
|
1101
|
-
return (
|
|
1102
|
-
<TooltipProvider delay={200}>
|
|
1103
|
-
<Tooltip>
|
|
1104
|
-
<TooltipTrigger
|
|
1105
|
-
render={
|
|
1106
|
-
<button
|
|
1107
|
-
type="button"
|
|
1108
|
-
aria-label={connected ? t.slide.agentConnected : t.slide.agentDisconnected}
|
|
1109
|
-
className="ml-1 flex shrink-0 cursor-help items-center gap-1.5 rounded-[3px] border border-hairline bg-card px-1.5 py-0.5 text-[10.5px] text-foreground/85 outline-none transition-colors duration-150 hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring/30"
|
|
1110
|
-
>
|
|
1111
|
-
<span aria-hidden className="relative flex size-1.5 items-center justify-center">
|
|
1112
|
-
{connected ? (
|
|
1113
|
-
<>
|
|
1114
|
-
<span className="absolute inline-flex size-full rounded-full bg-emerald-500 opacity-60 motion-safe:animate-ping" />
|
|
1115
|
-
<span className="relative inline-flex size-1.5 rounded-full bg-emerald-500" />
|
|
1116
|
-
</>
|
|
1117
|
-
) : (
|
|
1118
|
-
<span className="relative inline-flex size-1.5 rounded-full bg-rose-500" />
|
|
1119
|
-
)}
|
|
1120
|
-
</span>
|
|
1121
|
-
<span className="hidden xl:inline">
|
|
1122
|
-
{connected ? t.slide.agentConnected : t.slide.agentDisconnected}
|
|
1123
|
-
</span>
|
|
1124
|
-
</button>
|
|
1125
|
-
}
|
|
1126
|
-
/>
|
|
1127
|
-
<TooltipContent
|
|
1128
|
-
side="bottom"
|
|
1129
|
-
align="start"
|
|
1130
|
-
className="w-max max-w-[min(520px,calc(100vw-2rem))] text-center leading-relaxed"
|
|
1131
|
-
>
|
|
1132
|
-
{connected ? t.slide.agentConnectedTooltip : t.slide.agentDisconnectedTooltip}
|
|
1133
|
-
</TooltipContent>
|
|
1134
|
-
</Tooltip>
|
|
1135
|
-
</TooltipProvider>
|
|
1136
|
-
);
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
1193
|
function SelectionReporter() {
|
|
1140
1194
|
const { selected } = useInspector();
|
|
1141
1195
|
useEffect(() => {
|