@open-slide/core 1.18.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-DaL4Gjn-.js → build-CaV_vhIw.js} +1 -1
- package/dist/cli/bin.js +3 -3
- package/dist/{config-CYs4WJfL.d.ts → config-CDHB8Oow.d.ts} +2 -1
- package/dist/{config-CCHio3pk.js → config-GA6NMgs_.js} +1 -0
- package/dist/{dev-DLRQoCkT.js → dev-D57ui2yV.js} +1 -1
- package/dist/{format-CxPnpVRu.js → format-74A3B6zu.js} +16 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{preview-D3qVGc0S.js → preview-D40Zw_o0.js} +1 -1
- package/dist/{types-Wz88-Fe1.d.ts → types-8HghULIe.d.ts} +3 -0
- package/dist/vite/index.d.ts +2 -2
- package/dist/vite/index.js +1 -1
- package/package.json +2 -2
- package/src/app/app.tsx +20 -15
- package/src/app/components/asset-view.tsx +38 -23
- package/src/app/components/command/command-menu.tsx +5 -1
- package/src/app/components/command/command.tsx +4 -2
- package/src/app/components/icon-tooltip.tsx +24 -15
- package/src/app/components/inspector/asset-picker-dialog.tsx +18 -16
- package/src/app/components/inspector/comment-widget.tsx +33 -7
- package/src/app/components/inspector/image-crop-dialog.tsx +8 -2
- package/src/app/components/inspector/inspect-overlay.tsx +5 -4
- package/src/app/components/inspector/inspector-panel.tsx +15 -5
- package/src/app/components/language-toggle.tsx +2 -3
- package/src/app/components/notes-drawer.tsx +3 -3
- package/src/app/components/overview-grid.tsx +10 -4
- package/src/app/components/panel/panel-shell.tsx +1 -1
- package/src/app/components/panel/save-card.tsx +12 -3
- package/src/app/components/pdf-progress-toast.tsx +7 -3
- package/src/app/components/player.tsx +8 -1
- package/src/app/components/pptx-progress-toast.tsx +7 -3
- package/src/app/components/present/blackout-overlay.tsx +16 -3
- package/src/app/components/present/control-bar.tsx +17 -9
- package/src/app/components/present/jump-input.tsx +24 -3
- package/src/app/components/present/laser-pointer.tsx +34 -11
- package/src/app/components/present/progress-bar.tsx +1 -1
- package/src/app/components/present/use-presenter-channel.ts +2 -1
- package/src/app/components/present/use-touch-swipe.ts +9 -2
- package/src/app/components/sidebar/folder-item.tsx +9 -5
- package/src/app/components/sidebar/icon-picker.tsx +1 -1
- package/src/app/components/sidebar/sidebar-footer.tsx +13 -6
- package/src/app/components/sidebar/sidebar.tsx +2 -2
- package/src/app/components/style-panel/style-panel.tsx +16 -12
- package/src/app/components/theme-toggle.tsx +4 -5
- package/src/app/components/themes/theme-detail.tsx +8 -5
- package/src/app/components/themes/themes-gallery.tsx +3 -3
- package/src/app/components/thumbnail-rail.tsx +7 -3
- package/src/app/index.html +21 -0
- package/src/app/lib/export-html.ts +15 -2
- package/src/app/routes/home-shell.tsx +1 -1
- package/src/app/routes/home.tsx +10 -7
- package/src/app/routes/presenter.tsx +216 -9
- package/src/app/routes/slide.tsx +66 -23
- package/src/app/styles.css +7 -0
- package/src/locale/en.ts +3 -0
- package/src/locale/ja.ts +3 -0
- package/src/locale/types.ts +3 -0
- package/src/locale/zh-cn.ts +3 -0
- package/src/locale/zh-tw.ts +3 -0
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AArrowDown,
|
|
3
3
|
AArrowUp,
|
|
4
|
+
Check,
|
|
5
|
+
ChevronDown,
|
|
4
6
|
ChevronLeft,
|
|
5
7
|
ChevronRight,
|
|
6
8
|
RotateCcw,
|
|
7
9
|
Square,
|
|
8
10
|
Sun,
|
|
9
11
|
} from 'lucide-react';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
+
import {
|
|
13
|
+
type KeyboardEvent as ReactKeyboardEvent,
|
|
14
|
+
type ReactNode,
|
|
15
|
+
useCallback,
|
|
16
|
+
useEffect,
|
|
17
|
+
useRef,
|
|
18
|
+
useState,
|
|
19
|
+
} from 'react';
|
|
20
|
+
import { useNavigate, useParams } from 'react-router-dom';
|
|
12
21
|
import { Button } from '@/components/ui/button';
|
|
22
|
+
import { Dialog, DialogContent, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
|
|
13
23
|
import { format, useLocale } from '@/lib/use-locale';
|
|
14
24
|
import { cn } from '@/lib/utils';
|
|
15
25
|
import {
|
|
@@ -19,7 +29,8 @@ import {
|
|
|
19
29
|
import { SlideCanvas } from '../components/slide-canvas';
|
|
20
30
|
import { isDeckWarmed, markDeckWarmed, SlidePreloadLayer } from '../components/slide-preload-layer';
|
|
21
31
|
import { SlidePageProvider } from '../lib/page-context';
|
|
22
|
-
import { CANVAS_HEIGHT, CANVAS_WIDTH } from '../lib/sdk';
|
|
32
|
+
import { CANVAS_HEIGHT, CANVAS_WIDTH, type SlideModule } from '../lib/sdk';
|
|
33
|
+
import { loadSlide, slideIds } from '../lib/slides';
|
|
23
34
|
import { type StepController, StepHost } from '../lib/step-context';
|
|
24
35
|
import { useSlideModule } from '../lib/use-slide-module';
|
|
25
36
|
|
|
@@ -50,7 +61,19 @@ export function Presenter() {
|
|
|
50
61
|
}
|
|
51
62
|
});
|
|
52
63
|
|
|
64
|
+
// A deck switch reuses this route instance, so the handshake state from
|
|
65
|
+
// the previous deck must be dropped before rejoining on the new channel.
|
|
66
|
+
// Render-phase reset so the new deck never renders with the old state.
|
|
67
|
+
const prevSlideIdRef = useRef(slideId);
|
|
68
|
+
if (prevSlideIdRef.current !== slideId) {
|
|
69
|
+
prevSlideIdRef.current = slideId;
|
|
70
|
+
setState(null);
|
|
71
|
+
setHasProjection(false);
|
|
72
|
+
requestedRef.current = false;
|
|
73
|
+
}
|
|
74
|
+
|
|
53
75
|
// Hydrate from the projection window once.
|
|
76
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: slideId re-fires the handshake on a deck switch even when the channel memo keeps its identity (available toggling false→true in one commit nets to no change)
|
|
54
77
|
useEffect(() => {
|
|
55
78
|
if (!channel.available || requestedRef.current) return;
|
|
56
79
|
requestedRef.current = true;
|
|
@@ -58,9 +81,18 @@ export function Presenter() {
|
|
|
58
81
|
// If nothing answers within a beat, surface the "no projection" hint.
|
|
59
82
|
const t = setTimeout(() => setHasProjection((v) => v), 600);
|
|
60
83
|
return () => clearTimeout(t);
|
|
61
|
-
}, [channel]);
|
|
84
|
+
}, [channel, slideId]);
|
|
62
85
|
|
|
86
|
+
const navigate = useNavigate();
|
|
63
87
|
const send = channel.send;
|
|
88
|
+
const switchDeck = useCallback(
|
|
89
|
+
(id: string) => {
|
|
90
|
+
if (id === slideId) return;
|
|
91
|
+
send({ type: 'switch-slide', slideId: id });
|
|
92
|
+
navigate(`/s/${encodeURIComponent(id)}/presenter`, { replace: true });
|
|
93
|
+
},
|
|
94
|
+
[slideId, send, navigate],
|
|
95
|
+
);
|
|
64
96
|
const goPrev = useCallback(() => send({ type: 'prev' }), [send]);
|
|
65
97
|
const goNext = useCallback(() => send({ type: 'next' }), [send]);
|
|
66
98
|
const goTo = useCallback((i: number) => send({ type: 'goto', index: i }), [send]);
|
|
@@ -71,6 +103,8 @@ export function Presenter() {
|
|
|
71
103
|
// presenter can drive without the mouse.
|
|
72
104
|
useEffect(() => {
|
|
73
105
|
const onKey = (e: KeyboardEvent) => {
|
|
106
|
+
// The deck-switcher menu owns its own arrow-key navigation.
|
|
107
|
+
if (e.defaultPrevented) return;
|
|
74
108
|
if (e.target instanceof HTMLElement && e.target.matches('input, textarea')) return;
|
|
75
109
|
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
76
110
|
if (
|
|
@@ -175,8 +209,10 @@ export function Presenter() {
|
|
|
175
209
|
index={index}
|
|
176
210
|
total={total}
|
|
177
211
|
startedAt={startedAt}
|
|
212
|
+
slideId={slideId}
|
|
178
213
|
slideTitle={slide.meta?.title ?? slideId}
|
|
179
214
|
connected={hasProjection}
|
|
215
|
+
onSwitchDeck={switchDeck}
|
|
180
216
|
/>
|
|
181
217
|
|
|
182
218
|
<div className="grid min-h-0 flex-1 grid-cols-1 gap-6 px-6 pb-4 lg:grid-cols-[2fr_1fr]">
|
|
@@ -196,6 +232,7 @@ export function Presenter() {
|
|
|
196
232
|
aria-hidden
|
|
197
233
|
className={cn(
|
|
198
234
|
'pointer-events-none absolute inset-0 grid place-items-center text-[11px] tracking-[0.08em] uppercase',
|
|
235
|
+
'motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150',
|
|
199
236
|
blackout === 'black' ? 'bg-black text-white/35' : 'bg-white text-black/35',
|
|
200
237
|
)}
|
|
201
238
|
>
|
|
@@ -252,23 +289,31 @@ function PresenterTopBar({
|
|
|
252
289
|
index,
|
|
253
290
|
total,
|
|
254
291
|
startedAt,
|
|
292
|
+
slideId,
|
|
255
293
|
slideTitle,
|
|
256
294
|
connected,
|
|
295
|
+
onSwitchDeck,
|
|
257
296
|
}: {
|
|
258
297
|
index: number;
|
|
259
298
|
total: number;
|
|
260
299
|
startedAt: number;
|
|
300
|
+
slideId: string;
|
|
261
301
|
slideTitle: string;
|
|
262
302
|
connected: boolean;
|
|
303
|
+
onSwitchDeck: (slideId: string) => void;
|
|
263
304
|
}) {
|
|
264
305
|
const t = useLocale();
|
|
265
306
|
return (
|
|
266
307
|
<header className="flex h-12 shrink-0 items-center justify-between border-b border-hairline px-6">
|
|
267
|
-
<div className="flex items-
|
|
308
|
+
<div className="flex min-w-0 items-center gap-3">
|
|
268
309
|
<span className="eyebrow text-white/45">{t.presenter.eyebrow}</span>
|
|
269
|
-
|
|
270
|
-
{slideTitle}
|
|
271
|
-
|
|
310
|
+
{slideIds.length > 1 ? (
|
|
311
|
+
<DeckSwitcher slideId={slideId} slideTitle={slideTitle} onSwitchDeck={onSwitchDeck} />
|
|
312
|
+
) : (
|
|
313
|
+
<span className="truncate font-heading text-[14px] font-semibold tracking-tight">
|
|
314
|
+
{slideTitle}
|
|
315
|
+
</span>
|
|
316
|
+
)}
|
|
272
317
|
{!connected && (
|
|
273
318
|
<span className="rounded-[3px] border border-amber-300/30 bg-amber-300/10 px-1.5 py-0.5 font-mono text-[10px] tracking-[0.06em] uppercase text-amber-200/85">
|
|
274
319
|
{t.presenter.notLinked}
|
|
@@ -288,6 +333,168 @@ function PresenterTopBar({
|
|
|
288
333
|
);
|
|
289
334
|
}
|
|
290
335
|
|
|
336
|
+
// Listing decks means importing every deck's chunk for its meta and pages.
|
|
337
|
+
// That warms the module cache for switches; assets only load on render, so
|
|
338
|
+
// this stays cheap.
|
|
339
|
+
function useDeckModules(): Record<string, SlideModule> {
|
|
340
|
+
const [modules, setModules] = useState<Record<string, SlideModule>>({});
|
|
341
|
+
useEffect(() => {
|
|
342
|
+
let cancelled = false;
|
|
343
|
+
for (const id of slideIds) {
|
|
344
|
+
loadSlide(id)
|
|
345
|
+
.then((mod) => {
|
|
346
|
+
if (cancelled) return;
|
|
347
|
+
setModules((cur) => (cur[id] === mod ? cur : { ...cur, [id]: mod }));
|
|
348
|
+
})
|
|
349
|
+
.catch(() => {});
|
|
350
|
+
}
|
|
351
|
+
return () => {
|
|
352
|
+
cancelled = true;
|
|
353
|
+
};
|
|
354
|
+
}, []);
|
|
355
|
+
return modules;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function DeckSwitcher({
|
|
359
|
+
slideId,
|
|
360
|
+
slideTitle,
|
|
361
|
+
onSwitchDeck,
|
|
362
|
+
}: {
|
|
363
|
+
slideId: string;
|
|
364
|
+
slideTitle: string;
|
|
365
|
+
onSwitchDeck: (slideId: string) => void;
|
|
366
|
+
}) {
|
|
367
|
+
const t = useLocale();
|
|
368
|
+
const modules = useDeckModules();
|
|
369
|
+
const [open, setOpen] = useState(false);
|
|
370
|
+
const [query, setQuery] = useState('');
|
|
371
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
372
|
+
const listRef = useRef<HTMLDivElement | null>(null);
|
|
373
|
+
|
|
374
|
+
const trimmed = query.trim().toLowerCase();
|
|
375
|
+
const filtered = slideIds.filter((id) => {
|
|
376
|
+
if (!trimmed) return true;
|
|
377
|
+
const title = modules[id]?.meta?.title;
|
|
378
|
+
return id.toLowerCase().includes(trimmed) || title?.toLowerCase().includes(trimmed);
|
|
379
|
+
});
|
|
380
|
+
const active = Math.min(activeIndex, Math.max(0, filtered.length - 1));
|
|
381
|
+
|
|
382
|
+
const handleOpenChange = (next: boolean) => {
|
|
383
|
+
setOpen(next);
|
|
384
|
+
if (next) {
|
|
385
|
+
setQuery('');
|
|
386
|
+
setActiveIndex(0);
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
const select = (id: string) => {
|
|
391
|
+
setOpen(false);
|
|
392
|
+
onSwitchDeck(id);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
useEffect(() => {
|
|
396
|
+
listRef.current
|
|
397
|
+
?.querySelector(`[data-index="${active}"]`)
|
|
398
|
+
?.scrollIntoView({ block: 'nearest' });
|
|
399
|
+
}, [active]);
|
|
400
|
+
|
|
401
|
+
const onSearchKeyDown = (e: ReactKeyboardEvent<HTMLInputElement>) => {
|
|
402
|
+
if (e.nativeEvent.isComposing) return;
|
|
403
|
+
if (e.key === 'ArrowDown') {
|
|
404
|
+
e.preventDefault();
|
|
405
|
+
setActiveIndex(Math.min(filtered.length - 1, active + 1));
|
|
406
|
+
} else if (e.key === 'ArrowUp') {
|
|
407
|
+
e.preventDefault();
|
|
408
|
+
setActiveIndex(Math.max(0, active - 1));
|
|
409
|
+
} else if (e.key === 'Enter') {
|
|
410
|
+
e.preventDefault();
|
|
411
|
+
const id = filtered[active];
|
|
412
|
+
if (id) select(id);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
return (
|
|
417
|
+
<Dialog open={open} onOpenChange={handleOpenChange}>
|
|
418
|
+
<DialogTrigger
|
|
419
|
+
aria-label={t.presenter.switchDeck}
|
|
420
|
+
title={t.presenter.switchDeck}
|
|
421
|
+
className="group -mx-1.5 flex min-w-0 items-center gap-1 rounded-[5px] px-1.5 py-0.5 outline-none hover:bg-card focus-visible:ring-2 focus-visible:ring-ring/30"
|
|
422
|
+
>
|
|
423
|
+
<span className="truncate font-heading text-[14px] font-semibold tracking-tight">
|
|
424
|
+
{slideTitle}
|
|
425
|
+
</span>
|
|
426
|
+
<ChevronDown className="size-3.5 shrink-0 text-muted-foreground" />
|
|
427
|
+
</DialogTrigger>
|
|
428
|
+
<DialogContent
|
|
429
|
+
showCloseButton={false}
|
|
430
|
+
className="dark top-[16%] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-lg"
|
|
431
|
+
>
|
|
432
|
+
<DialogTitle className="sr-only">{t.presenter.switchDeck}</DialogTitle>
|
|
433
|
+
<input
|
|
434
|
+
value={query}
|
|
435
|
+
onChange={(e) => {
|
|
436
|
+
setQuery(e.target.value);
|
|
437
|
+
setActiveIndex(0);
|
|
438
|
+
}}
|
|
439
|
+
onKeyDown={onSearchKeyDown}
|
|
440
|
+
placeholder={t.presenter.searchDecks}
|
|
441
|
+
className="w-full border-b border-hairline bg-transparent px-4 py-3 text-[13px] text-foreground outline-none placeholder:text-muted-foreground"
|
|
442
|
+
/>
|
|
443
|
+
<div ref={listRef} className="max-h-[55vh] overflow-y-auto p-1.5">
|
|
444
|
+
{filtered.length === 0 ? (
|
|
445
|
+
<div className="px-3 py-8 text-center text-[12px] text-muted-foreground">
|
|
446
|
+
{t.presenter.noDecksFound}
|
|
447
|
+
</div>
|
|
448
|
+
) : (
|
|
449
|
+
filtered.map((id, i) => {
|
|
450
|
+
const mod = modules[id];
|
|
451
|
+
const FirstPage = mod?.default[0];
|
|
452
|
+
return (
|
|
453
|
+
<button
|
|
454
|
+
type="button"
|
|
455
|
+
key={id}
|
|
456
|
+
data-index={i}
|
|
457
|
+
onClick={() => select(id)}
|
|
458
|
+
onMouseMove={() => setActiveIndex(i)}
|
|
459
|
+
className={cn(
|
|
460
|
+
'flex w-full items-center gap-3 rounded-[6px] p-2 text-left outline-none transition-[background-color,scale] duration-100 active:scale-[0.99] focus-visible:ring-1 focus-visible:ring-ring/40',
|
|
461
|
+
i === active && 'bg-muted',
|
|
462
|
+
)}
|
|
463
|
+
>
|
|
464
|
+
<div
|
|
465
|
+
className="w-24 shrink-0 overflow-hidden rounded-[4px] bg-black ring-1 ring-border"
|
|
466
|
+
style={{ aspectRatio: `${CANVAS_WIDTH}/${CANVAS_HEIGHT}` }}
|
|
467
|
+
>
|
|
468
|
+
{FirstPage && (
|
|
469
|
+
<SlideCanvas flat freezeMotion design={mod.design}>
|
|
470
|
+
<SlidePageProvider index={0} total={mod.default.length}>
|
|
471
|
+
<PreviewStepHost revealed={0}>
|
|
472
|
+
<FirstPage />
|
|
473
|
+
</PreviewStepHost>
|
|
474
|
+
</SlidePageProvider>
|
|
475
|
+
</SlideCanvas>
|
|
476
|
+
)}
|
|
477
|
+
</div>
|
|
478
|
+
<div className="min-w-0 flex-1">
|
|
479
|
+
<div className="truncate text-[13px] font-medium text-foreground">
|
|
480
|
+
{mod?.meta?.title ?? id}
|
|
481
|
+
</div>
|
|
482
|
+
<div className="mt-0.5 truncate font-mono text-[10.5px] tabular-nums text-muted-foreground">
|
|
483
|
+
{id}
|
|
484
|
+
{mod && ` · ${mod.default.length.toString().padStart(2, '0')}`}
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
{id === slideId && <Check className="size-3.5 shrink-0 text-muted-foreground" />}
|
|
488
|
+
</button>
|
|
489
|
+
);
|
|
490
|
+
})
|
|
491
|
+
)}
|
|
492
|
+
</div>
|
|
493
|
+
</DialogContent>
|
|
494
|
+
</Dialog>
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
|
|
291
498
|
function PresenterBottomBar({
|
|
292
499
|
index,
|
|
293
500
|
total,
|
|
@@ -441,7 +648,7 @@ function PresenterJumpControl({
|
|
|
441
648
|
placeholder={(current + 1).toString()}
|
|
442
649
|
className="h-8 w-20 rounded-[5px] border border-border bg-card px-2 font-mono text-[12px] tabular-nums outline-none focus-visible:border-foreground/30"
|
|
443
650
|
/>
|
|
444
|
-
<span className="font-mono text-[11px] text-muted-foreground">/ {total}</span>
|
|
651
|
+
<span className="font-mono text-[11px] tabular-nums text-muted-foreground">/ {total}</span>
|
|
445
652
|
</form>
|
|
446
653
|
);
|
|
447
654
|
}
|
package/src/app/routes/slide.tsx
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
Terminal,
|
|
18
18
|
} from 'lucide-react';
|
|
19
19
|
import { type RefObject, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20
|
-
import { Link, useParams, useSearchParams } from 'react-router-dom';
|
|
20
|
+
import { Link, useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
|
21
21
|
import { toast } from 'sonner';
|
|
22
22
|
import { AssetView } from '@/components/asset-view';
|
|
23
23
|
import { HistoryProvider } from '@/components/history-provider';
|
|
@@ -70,11 +70,24 @@ import { useSlideModule } from '../lib/use-slide-module';
|
|
|
70
70
|
|
|
71
71
|
const { showSlideUi, showSlideBrowser, allowHtmlDownload } = config.build;
|
|
72
72
|
|
|
73
|
+
const noop = () => {};
|
|
74
|
+
|
|
73
75
|
export function Slide() {
|
|
74
76
|
const { slideId = '' } = useParams();
|
|
75
77
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
78
|
+
const navigate = useNavigate();
|
|
76
79
|
const { slide, error } = useSlideModule(slideId);
|
|
77
80
|
const [playMode, setPlayMode] = useState<'window' | 'fullscreen' | null>(null);
|
|
81
|
+
// Last deck the Player showed. During a presenter-driven deck switch the
|
|
82
|
+
// route's slideId changes while the new module loads and warms; rendering
|
|
83
|
+
// from this cache keeps the Player mounted, which preserves fullscreen
|
|
84
|
+
// (re-entry needs a user gesture) and the elapsed timer.
|
|
85
|
+
const lastPresentedRef = useRef<{
|
|
86
|
+
slideId: string;
|
|
87
|
+
slide: SlideModule;
|
|
88
|
+
pages: SlideModule['default'];
|
|
89
|
+
index: number;
|
|
90
|
+
} | null>(null);
|
|
78
91
|
const [exporting, setExporting] = useState(false);
|
|
79
92
|
const [linkCopied, setLinkCopied] = useState(false);
|
|
80
93
|
const linkCopiedTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
@@ -120,6 +133,13 @@ export function Slide() {
|
|
|
120
133
|
});
|
|
121
134
|
}, [slideId, index, pageCount, slide, view]);
|
|
122
135
|
|
|
136
|
+
const switchPresentedSlide = useCallback(
|
|
137
|
+
(id: string) => {
|
|
138
|
+
navigate(`/s/${encodeURIComponent(id)}`, { replace: true });
|
|
139
|
+
},
|
|
140
|
+
[navigate],
|
|
141
|
+
);
|
|
142
|
+
|
|
123
143
|
const goTo = useCallback(
|
|
124
144
|
(i: number) => {
|
|
125
145
|
const clamped = Math.max(0, Math.min(pageCount - 1, i));
|
|
@@ -314,6 +334,45 @@ export function Slide() {
|
|
|
314
334
|
);
|
|
315
335
|
}
|
|
316
336
|
|
|
337
|
+
const presentReady = Boolean(slide) && pageCount > 0 && isDeckWarmed(slideId);
|
|
338
|
+
if (playMode && slide && presentReady) {
|
|
339
|
+
lastPresentedRef.current = { slideId, slide, pages, index };
|
|
340
|
+
}
|
|
341
|
+
const presented = playMode
|
|
342
|
+
? slide && presentReady
|
|
343
|
+
? { slideId, slide, pages, index }
|
|
344
|
+
: (lastPresentedRef.current ??
|
|
345
|
+
(slide && pageCount > 0 ? { slideId, slide, pages, index } : null))
|
|
346
|
+
: null;
|
|
347
|
+
|
|
348
|
+
if (playMode && presented) {
|
|
349
|
+
return (
|
|
350
|
+
<>
|
|
351
|
+
<Player
|
|
352
|
+
pages={presented.pages}
|
|
353
|
+
design={presented.slide.design}
|
|
354
|
+
transition={presented.slide.transition}
|
|
355
|
+
index={presented.index}
|
|
356
|
+
onIndexChange={presentReady ? goTo : noop}
|
|
357
|
+
onExit={() => setPlayMode(null)}
|
|
358
|
+
controls
|
|
359
|
+
slideId={presented.slideId}
|
|
360
|
+
onSwitchSlide={switchPresentedSlide}
|
|
361
|
+
fullscreen={playMode === 'fullscreen'}
|
|
362
|
+
/>
|
|
363
|
+
{!presentReady && slide && pageCount > 0 && (
|
|
364
|
+
<SlidePreloadLayer
|
|
365
|
+
pages={pages}
|
|
366
|
+
index={index}
|
|
367
|
+
design={slide.design}
|
|
368
|
+
includeCurrent
|
|
369
|
+
onDone={handleAssetsWarmed}
|
|
370
|
+
/>
|
|
371
|
+
)}
|
|
372
|
+
</>
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
|
|
317
376
|
if (!slide) {
|
|
318
377
|
return (
|
|
319
378
|
<div className="grid min-h-dvh place-items-center px-8 text-muted-foreground">
|
|
@@ -401,22 +460,6 @@ export function Slide() {
|
|
|
401
460
|
);
|
|
402
461
|
}
|
|
403
462
|
|
|
404
|
-
if (playMode) {
|
|
405
|
-
return (
|
|
406
|
-
<Player
|
|
407
|
-
pages={pages}
|
|
408
|
-
design={slide.design}
|
|
409
|
-
transition={slide.transition}
|
|
410
|
-
index={index}
|
|
411
|
-
onIndexChange={goTo}
|
|
412
|
-
onExit={() => setPlayMode(null)}
|
|
413
|
-
controls
|
|
414
|
-
slideId={slideId}
|
|
415
|
-
fullscreen={playMode === 'fullscreen'}
|
|
416
|
-
/>
|
|
417
|
-
);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
463
|
const title = slide.meta?.title ?? slideId;
|
|
421
464
|
|
|
422
465
|
const copyLink = async () => {
|
|
@@ -635,7 +678,7 @@ export function Slide() {
|
|
|
635
678
|
)}
|
|
636
679
|
>
|
|
637
680
|
{exporting ? (
|
|
638
|
-
<Loader2 className="size-4 animate-spin" />
|
|
681
|
+
<Loader2 className="size-4 animate-spin motion-reduce:animate-none" />
|
|
639
682
|
) : (
|
|
640
683
|
<Download className="size-4" />
|
|
641
684
|
)}
|
|
@@ -658,7 +701,7 @@ export function Slide() {
|
|
|
658
701
|
)}
|
|
659
702
|
>
|
|
660
703
|
{exporting ? (
|
|
661
|
-
<Loader2 className="size-4 animate-spin" />
|
|
704
|
+
<Loader2 className="size-4 animate-spin motion-reduce:animate-none" />
|
|
662
705
|
) : (
|
|
663
706
|
<MoreHorizontal className="size-4" />
|
|
664
707
|
)}
|
|
@@ -965,7 +1008,7 @@ function ResizableRail(props: {
|
|
|
965
1008
|
<span
|
|
966
1009
|
aria-hidden
|
|
967
1010
|
className={cn(
|
|
968
|
-
'pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-brand opacity-0 transition-opacity',
|
|
1011
|
+
'pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-brand opacity-0 transition-opacity duration-150',
|
|
969
1012
|
'group-hover/resize:opacity-100 group-focus-visible/resize:opacity-100',
|
|
970
1013
|
resizing && 'opacity-100',
|
|
971
1014
|
)}
|
|
@@ -985,12 +1028,12 @@ function AgentConnectedBadge() {
|
|
|
985
1028
|
render={
|
|
986
1029
|
<button
|
|
987
1030
|
type="button"
|
|
988
|
-
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 focus-visible:ring-2 focus-visible:ring-ring/30"
|
|
1031
|
+
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"
|
|
989
1032
|
>
|
|
990
1033
|
<span aria-hidden className="relative flex size-1.5 items-center justify-center">
|
|
991
1034
|
{connected ? (
|
|
992
1035
|
<>
|
|
993
|
-
<span className="absolute inline-flex size-full
|
|
1036
|
+
<span className="absolute inline-flex size-full rounded-full bg-emerald-500 opacity-60 motion-safe:animate-ping" />
|
|
994
1037
|
<span className="relative inline-flex size-1.5 rounded-full bg-emerald-500" />
|
|
995
1038
|
</>
|
|
996
1039
|
) : (
|
|
@@ -1172,7 +1215,7 @@ function InlineTitleEditor({
|
|
|
1172
1215
|
onClick={() => setEditing(true)}
|
|
1173
1216
|
aria-label={t.slide.renameSlide}
|
|
1174
1217
|
className={cn(
|
|
1175
|
-
'min-w-0 max-w-full cursor-text rounded-[5px] border border-transparent px-2 py-0.5 transition-colors',
|
|
1218
|
+
'min-w-0 max-w-full cursor-text rounded-[5px] border border-transparent px-2 py-0.5 transition-colors duration-100',
|
|
1176
1219
|
'hover:border-foreground/30 hover:bg-card focus-visible:border-foreground/30 focus-visible:bg-card focus-visible:outline-none',
|
|
1177
1220
|
)}
|
|
1178
1221
|
>
|
package/src/app/styles.css
CHANGED
|
@@ -58,6 +58,10 @@
|
|
|
58
58
|
--radius-3xl: calc(var(--radius) * 2.2);
|
|
59
59
|
--radius-4xl: calc(var(--radius) * 2.6);
|
|
60
60
|
|
|
61
|
+
/* House motion curve — one strong ease-out for every chrome entrance,
|
|
62
|
+
instead of per-file cubic-bezier literals. */
|
|
63
|
+
--ease-swift: cubic-bezier(0.22, 1, 0.36, 1);
|
|
64
|
+
|
|
61
65
|
--shadow-edge: 0 0 0 0.5px oklch(0 0 0 / 0.06), 0 1px 0 oklch(0 0 0 / 0.025);
|
|
62
66
|
--shadow-floating:
|
|
63
67
|
0 0 0 0.5px oklch(0 0 0 / 0.08), 0 1px 1px oklch(0 0 0 / 0.04),
|
|
@@ -68,6 +72,9 @@
|
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
:root {
|
|
75
|
+
/* Runtime copy of the @theme token for inline style/JS consumers. */
|
|
76
|
+
--ease-swift: cubic-bezier(0.22, 1, 0.36, 1);
|
|
77
|
+
|
|
71
78
|
/* Pure neutral ramp — zero chroma, flat surfaces, hairline borders.
|
|
72
79
|
Near-white background with white cards floating on a slightly
|
|
73
80
|
recessed canvas. */
|
package/src/locale/en.ts
CHANGED
|
@@ -167,6 +167,9 @@ export const en: Locale = {
|
|
|
167
167
|
jump: 'Jump',
|
|
168
168
|
loadingSlide: 'Loading {slideId}…',
|
|
169
169
|
loadingAssets: 'Loading assets…',
|
|
170
|
+
switchDeck: 'Switch presentation',
|
|
171
|
+
searchDecks: 'Search presentations…',
|
|
172
|
+
noDecksFound: 'No presentations match',
|
|
170
173
|
},
|
|
171
174
|
|
|
172
175
|
present: {
|
package/src/locale/ja.ts
CHANGED
package/src/locale/types.ts
CHANGED
package/src/locale/zh-cn.ts
CHANGED
package/src/locale/zh-tw.ts
CHANGED