@open-slide/core 2.1.0 → 2.3.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-COxfoC_P.js → build-8lRsgsO4.js} +1 -1
- package/dist/cli/bin.js +4 -4
- package/dist/{config-DHPbCCnt.d.ts → config-CDrYgaEj.d.ts} +6 -2
- package/dist/{config-CNhYSo4C.js → config-D2Mq1vSW.js} +2162 -368
- package/dist/{dev-CujpTS3T.js → dev-BvefEp1Q.js} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{preview-kU5R6QXJ.js → preview-D8ognobz.js} +1 -1
- package/dist/{types-BGUi9COY.d.ts → types-DFK02XVv.d.ts} +119 -4
- package/dist/{update-CPBitJQq.js → update-BivdNgL3.js} +128 -7
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-BbFb4PZW.js → zh-tw-B1pkKQsc.js} +570 -20
- package/package.json +5 -5
- package/skills/apply-comments/SKILL.md +9 -6
- package/src/app/components/agent/agent-dock.tsx +35 -0
- package/src/app/components/agent/agent-markdown.tsx +45 -0
- package/src/app/components/agent/agent-panel.tsx +692 -0
- package/src/app/components/agent/agent-presence.tsx +74 -0
- package/src/app/components/agent/composer.tsx +120 -0
- package/src/app/components/agent/connect-view.tsx +184 -0
- package/src/app/components/agent/history-view.tsx +135 -0
- package/src/app/components/agent/provider-logo.tsx +34 -0
- package/src/app/components/agent/transcript.tsx +609 -0
- package/src/app/components/command/slide-command-menu.tsx +10 -0
- package/src/app/components/icon-switcher-indicator.tsx +1 -1
- package/src/app/components/inspector/comment-layer.tsx +1011 -0
- package/src/app/components/inspector/image-crop-dialog.tsx +1 -5
- package/src/app/components/inspector/inspect-overlay.tsx +2 -39
- package/src/app/components/inspector/inspector-panel.tsx +10 -93
- package/src/app/components/inspector/inspector-provider.tsx +120 -46
- package/src/app/components/panel/editor-sidebar.tsx +85 -16
- package/src/app/components/panel/panel-shell.tsx +2 -2
- package/src/app/components/panel/resize-handle.tsx +129 -0
- package/src/app/components/player.tsx +0 -1
- package/src/app/components/thumbnail-rail.tsx +39 -1
- package/src/app/lib/agent/use-agent.ts +543 -0
- package/src/app/lib/inspector/freeze-motion.ts +61 -0
- package/src/app/lib/inspector/use-comments.ts +32 -3
- package/src/app/lib/use-auto-grow.ts +15 -0
- package/src/app/lib/utils.ts +4 -0
- package/src/app/routes/home.tsx +43 -7
- package/src/app/routes/slide.tsx +109 -109
- package/src/app/styles.css +234 -80
- package/src/locale/en.ts +113 -4
- package/src/locale/es.ts +115 -5
- package/src/locale/ja.ts +106 -5
- package/src/locale/types.ts +118 -4
- package/src/locale/zh-cn.ts +103 -4
- package/src/locale/zh-tw.ts +103 -4
- package/src/app/components/inspector/comment-widget.tsx +0 -119
package/src/app/routes/home.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
MoreHorizontal,
|
|
9
9
|
Palette,
|
|
10
10
|
Pencil,
|
|
11
|
+
Plus,
|
|
11
12
|
Search,
|
|
12
13
|
Trash2,
|
|
13
14
|
X,
|
|
@@ -30,8 +31,10 @@ import {
|
|
|
30
31
|
DropdownMenuItem,
|
|
31
32
|
DropdownMenuTrigger,
|
|
32
33
|
} from '@/components/ui/dropdown-menu';
|
|
34
|
+
import { useAgentStatus, useCreateDeck } from '@/lib/agent/use-agent';
|
|
33
35
|
import { format, useLocale } from '@/lib/use-locale';
|
|
34
36
|
import { cn, pad2 } from '@/lib/utils';
|
|
37
|
+
import { ProviderLogo } from '../components/agent/provider-logo';
|
|
35
38
|
import { FolderIconChip, SLIDE_DND_MIME, SystemViewIcon } from '../components/sidebar/folder-item';
|
|
36
39
|
import { ALL_SLIDES_ID, DRAFT_ID } from '../components/sidebar/sidebar';
|
|
37
40
|
import { SlideCanvas } from '../components/slide-canvas';
|
|
@@ -193,6 +196,7 @@ export function Home() {
|
|
|
193
196
|
<div className="ml-auto flex w-full items-center gap-2 md:w-auto">
|
|
194
197
|
<SortControl value={sortKey} onChange={setSortKey} />
|
|
195
198
|
<SearchInput value={query} onChange={setQuery} />
|
|
199
|
+
{import.meta.env.DEV && <NewDeckButton />}
|
|
196
200
|
</div>
|
|
197
201
|
</div>
|
|
198
202
|
</header>
|
|
@@ -319,6 +323,30 @@ function SortControl({ value, onChange }: { value: SortKey; onChange: (next: Sor
|
|
|
319
323
|
);
|
|
320
324
|
}
|
|
321
325
|
|
|
326
|
+
function useCreateDeckWithAgent() {
|
|
327
|
+
const { provider } = useAgentStatus();
|
|
328
|
+
const start = useCreateDeck();
|
|
329
|
+
if (!provider) return null;
|
|
330
|
+
return { provider, start };
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function NewDeckButton() {
|
|
334
|
+
const t = useLocale();
|
|
335
|
+
const agent = useCreateDeckWithAgent();
|
|
336
|
+
if (!agent) return null;
|
|
337
|
+
return (
|
|
338
|
+
<Button
|
|
339
|
+
size="sm"
|
|
340
|
+
className="h-8 shrink-0"
|
|
341
|
+
onClick={agent.start}
|
|
342
|
+
title={format(t.agent.createDeckWith, { provider: agent.provider.name })}
|
|
343
|
+
>
|
|
344
|
+
<Plus />
|
|
345
|
+
{t.agent.createDeck}
|
|
346
|
+
</Button>
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
322
350
|
function HomeLoading() {
|
|
323
351
|
const t = useLocale();
|
|
324
352
|
return (
|
|
@@ -360,6 +388,7 @@ function NoResultsState({ query, onClear }: { query: string; onClear: () => void
|
|
|
360
388
|
|
|
361
389
|
function EmptyState({ isDraft, folderName }: { isDraft: boolean; folderName?: string }) {
|
|
362
390
|
const t = useLocale();
|
|
391
|
+
const agent = useCreateDeckWithAgent();
|
|
363
392
|
const folderEmptyTitle = t.home.folderEmptyTitle.replace(
|
|
364
393
|
'{name}',
|
|
365
394
|
folderName ?? t.home.folderEmptyTitle,
|
|
@@ -373,13 +402,20 @@ function EmptyState({ isDraft, folderName }: { isDraft: boolean; folderName?: st
|
|
|
373
402
|
<p className="mt-4 font-heading text-[14px] font-semibold tracking-tight">
|
|
374
403
|
{t.home.noSlidesYet}
|
|
375
404
|
</p>
|
|
376
|
-
|
|
377
|
-
{
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
</
|
|
381
|
-
|
|
382
|
-
|
|
405
|
+
{agent ? (
|
|
406
|
+
<Button size="sm" className="mt-4" onClick={agent.start}>
|
|
407
|
+
<ProviderLogo provider={agent.provider.id} />
|
|
408
|
+
{format(t.agent.createDeckWith, { provider: agent.provider.name })}
|
|
409
|
+
</Button>
|
|
410
|
+
) : (
|
|
411
|
+
<p className="mt-1.5 text-[13px] leading-relaxed text-muted-foreground">
|
|
412
|
+
{t.home.createSlideHintPrefix}
|
|
413
|
+
<code className="rounded-[4px] bg-muted px-1.5 py-0.5 font-mono text-[11.5px] text-foreground">
|
|
414
|
+
/create-slide
|
|
415
|
+
</code>
|
|
416
|
+
{t.home.createSlideHintSuffix}
|
|
417
|
+
</p>
|
|
418
|
+
)}
|
|
383
419
|
</>
|
|
384
420
|
) : (
|
|
385
421
|
<>
|
package/src/app/routes/slide.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
MoreHorizontal,
|
|
15
15
|
Play,
|
|
16
16
|
Presentation,
|
|
17
|
+
Sparkles,
|
|
17
18
|
Terminal,
|
|
18
19
|
} from 'lucide-react';
|
|
19
20
|
import {
|
|
@@ -21,15 +22,19 @@ import {
|
|
|
21
22
|
type RefObject,
|
|
22
23
|
useCallback,
|
|
23
24
|
useEffect,
|
|
25
|
+
useLayoutEffect,
|
|
24
26
|
useMemo,
|
|
25
27
|
useRef,
|
|
26
28
|
useState,
|
|
27
29
|
} from 'react';
|
|
28
30
|
import { Link, useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
|
29
31
|
import { toast } from 'sonner';
|
|
32
|
+
import { AgentToggleButton } from '@/components/agent/agent-dock';
|
|
33
|
+
import { AgentPanel } from '@/components/agent/agent-panel';
|
|
34
|
+
import { AgentPresence } from '@/components/agent/agent-presence';
|
|
30
35
|
import { AssetView } from '@/components/asset-view';
|
|
31
36
|
import { HistoryProvider } from '@/components/history-provider';
|
|
32
|
-
import {
|
|
37
|
+
import { CommentLayer } from '@/components/inspector/comment-layer';
|
|
33
38
|
import { InlineEditLayer } from '@/components/inspector/inline-text-editor';
|
|
34
39
|
import { InspectOverlay } from '@/components/inspector/inspect-overlay';
|
|
35
40
|
import {
|
|
@@ -40,6 +45,7 @@ import {
|
|
|
40
45
|
} from '@/components/inspector/inspector-provider';
|
|
41
46
|
import { SaveBar } from '@/components/inspector/save-bar';
|
|
42
47
|
import { EditorSidebar } from '@/components/panel/editor-sidebar';
|
|
48
|
+
import { ResizeHandle, useStoredWidth } from '@/components/panel/resize-handle';
|
|
43
49
|
import { DesignProvider } from '@/components/style-panel/design-provider';
|
|
44
50
|
import { DesignToggleButton } from '@/components/style-panel/style-panel';
|
|
45
51
|
import { Button, buttonVariants } from '@/components/ui/button';
|
|
@@ -57,6 +63,7 @@ import {
|
|
|
57
63
|
} from '@/components/ui/dropdown-menu';
|
|
58
64
|
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
59
65
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
|
66
|
+
import { setDockOpen, useAgentActivity, useAgentDock } from '@/lib/agent/use-agent';
|
|
60
67
|
import { useFolders } from '@/lib/folders';
|
|
61
68
|
import {
|
|
62
69
|
hasModifier,
|
|
@@ -74,6 +81,7 @@ import { format, useLocale } from '@/lib/use-locale';
|
|
|
74
81
|
import { useMediaQuery } from '@/lib/use-media-query';
|
|
75
82
|
import { useWheelPageNavigation } from '@/lib/use-wheel-page-navigation';
|
|
76
83
|
import { cn } from '@/lib/utils';
|
|
84
|
+
import type { AgentTurnContext } from '../../agent/types';
|
|
77
85
|
import { SlideCommandMenu } from '../components/command/slide-command-menu';
|
|
78
86
|
import { PdfProgressToast, PptxProgressToast } from '../components/export-progress-toast';
|
|
79
87
|
import { NotesDrawer } from '../components/notes-drawer';
|
|
@@ -132,6 +140,13 @@ export function Slide() {
|
|
|
132
140
|
const [designOpen, setDesignOpen] = useState(false);
|
|
133
141
|
const [overviewOpen, setOverviewOpen] = useState(false);
|
|
134
142
|
const [commandOpen, setCommandOpen] = useState(false);
|
|
143
|
+
const { open: agentOpen, toggle: toggleAgent } = useAgentDock();
|
|
144
|
+
useLayoutEffect(() => {
|
|
145
|
+
if (agentOpen) setDesignOpen(false);
|
|
146
|
+
}, [agentOpen]);
|
|
147
|
+
useLayoutEffect(() => {
|
|
148
|
+
if (designOpen) setDockOpen(false);
|
|
149
|
+
}, [designOpen]);
|
|
135
150
|
const [, setWarmedTick] = useState(0);
|
|
136
151
|
const handleAssetsWarmed = useCallback(() => {
|
|
137
152
|
markDeckWarmed(slideId);
|
|
@@ -195,6 +210,16 @@ export function Slide() {
|
|
|
195
210
|
[pageCount, setSearchParams],
|
|
196
211
|
);
|
|
197
212
|
|
|
213
|
+
// While an agent writes this deck page by page, jump to each page as it
|
|
214
|
+
// lands so the user can follow along.
|
|
215
|
+
const agentActivity = useAgentActivity(slideId);
|
|
216
|
+
const agentWriting = agentActivity !== null;
|
|
217
|
+
const seenPageCount = useRef(pageCount);
|
|
218
|
+
useEffect(() => {
|
|
219
|
+
if (agentWriting && pageCount > seenPageCount.current) goTo(pageCount - 1);
|
|
220
|
+
seenPageCount.current = pageCount;
|
|
221
|
+
}, [agentWriting, pageCount, goTo]);
|
|
222
|
+
|
|
198
223
|
const reorderPage = useCallback(
|
|
199
224
|
async (from: number, to: number) => {
|
|
200
225
|
if (from === to) return;
|
|
@@ -351,11 +376,13 @@ export function Slide() {
|
|
|
351
376
|
setPlayMode('window');
|
|
352
377
|
} else if (import.meta.env.DEV && (e.key === 'd' || e.key === 'D')) {
|
|
353
378
|
setDesignOpen((v) => !v);
|
|
379
|
+
} else if (import.meta.env.DEV && (e.key === 'a' || e.key === 'A')) {
|
|
380
|
+
toggleAgent();
|
|
354
381
|
}
|
|
355
382
|
};
|
|
356
383
|
window.addEventListener('keydown', onKey);
|
|
357
384
|
return () => window.removeEventListener('keydown', onKey);
|
|
358
|
-
}, [index, goTo, playMode, slideId, overviewOpen]);
|
|
385
|
+
}, [index, goTo, playMode, slideId, overviewOpen, toggleAgent]);
|
|
359
386
|
|
|
360
387
|
if (error) {
|
|
361
388
|
return (
|
|
@@ -619,8 +646,11 @@ export function Slide() {
|
|
|
619
646
|
<InspectorProvider
|
|
620
647
|
slideId={slideId}
|
|
621
648
|
pageIndex={index}
|
|
622
|
-
panelHidden={designOpen}
|
|
623
|
-
onPanelOpen={() =>
|
|
649
|
+
panelHidden={designOpen || agentOpen}
|
|
650
|
+
onPanelOpen={() => {
|
|
651
|
+
setDesignOpen(false);
|
|
652
|
+
setDockOpen(false);
|
|
653
|
+
}}
|
|
624
654
|
>
|
|
625
655
|
<SelectionReporter />
|
|
626
656
|
<div className="flex h-dvh flex-col overflow-hidden bg-sidebar text-foreground">
|
|
@@ -739,6 +769,12 @@ export function Slide() {
|
|
|
739
769
|
/>
|
|
740
770
|
)}
|
|
741
771
|
<DropdownMenuGroup>
|
|
772
|
+
{narrowToolbar && import.meta.env.DEV && (
|
|
773
|
+
<DropdownMenuItem onClick={toggleAgent}>
|
|
774
|
+
<Sparkles />
|
|
775
|
+
{t.agent.openTitle}
|
|
776
|
+
</DropdownMenuItem>
|
|
777
|
+
)}
|
|
742
778
|
<DropdownMenuItem onClick={() => setCommandOpen(true)}>
|
|
743
779
|
<Terminal />
|
|
744
780
|
{t.commandMenu.trigger}
|
|
@@ -753,6 +789,7 @@ export function Slide() {
|
|
|
753
789
|
</DropdownMenuContent>
|
|
754
790
|
</DropdownMenu>
|
|
755
791
|
)}
|
|
792
|
+
{import.meta.env.DEV && view === 'slides' && !narrowToolbar && <AgentToggleButton />}
|
|
756
793
|
{view === 'slides' && !narrowToolbar && (
|
|
757
794
|
<DesignToggleButton active={designOpen} onToggle={() => setDesignOpen((v) => !v)} />
|
|
758
795
|
)}
|
|
@@ -834,6 +871,7 @@ export function Slide() {
|
|
|
834
871
|
ref={slideViewportRef}
|
|
835
872
|
data-inspector-root
|
|
836
873
|
data-slide-id={slideId}
|
|
874
|
+
data-agent-provider={agentActivity?.provider}
|
|
837
875
|
className="relative min-h-0 min-w-0 flex-1 bg-background p-2 md:mx-2 md:mb-2 md:rounded-[10px] md:p-10 md:shadow-edge md:ring-1 md:ring-foreground/[0.06]"
|
|
838
876
|
>
|
|
839
877
|
<SlideViewportNavigation
|
|
@@ -855,7 +893,8 @@ export function Slide() {
|
|
|
855
893
|
<InspectOverlay />
|
|
856
894
|
<InlineEditLayer />
|
|
857
895
|
<SaveBar />
|
|
858
|
-
{import.meta.env.DEV && <
|
|
896
|
+
{import.meta.env.DEV && <CommentLayer />}
|
|
897
|
+
{agentActivity && <AgentPresence activity={agentActivity} revision={pages} />}
|
|
859
898
|
</main>
|
|
860
899
|
{/* Mobile-only horizontal rail. Sits below the canvas and
|
|
861
900
|
pads its bottom for the iOS home indicator / Safari URL bar. */}
|
|
@@ -875,6 +914,17 @@ export function Slide() {
|
|
|
875
914
|
<EditorSidebar
|
|
876
915
|
designOpen={designOpen}
|
|
877
916
|
onCloseDesign={() => setDesignOpen(false)}
|
|
917
|
+
agentOpen={agentOpen}
|
|
918
|
+
agent={
|
|
919
|
+
import.meta.env.DEV && (
|
|
920
|
+
<SlideAgentDock
|
|
921
|
+
slideId={slideId}
|
|
922
|
+
slideTitle={title}
|
|
923
|
+
pageNumber={index + 1}
|
|
924
|
+
totalPages={pageCount}
|
|
925
|
+
/>
|
|
926
|
+
)
|
|
927
|
+
}
|
|
878
928
|
/>
|
|
879
929
|
</div>
|
|
880
930
|
{import.meta.env.DEV && (
|
|
@@ -916,6 +966,7 @@ export function Slide() {
|
|
|
916
966
|
onCopyLink: copyLink,
|
|
917
967
|
onOverview: () => setOverviewOpen(true),
|
|
918
968
|
onToggleDesignPanel: () => setDesignOpen((v) => !v),
|
|
969
|
+
onToggleAgentPanel: toggleAgent,
|
|
919
970
|
onExportHtml: exportHtml,
|
|
920
971
|
onExportPdf: exportPdf,
|
|
921
972
|
onExportPptx: exportPptx,
|
|
@@ -935,14 +986,6 @@ const DEFAULT_RAIL_WIDTH = 264;
|
|
|
935
986
|
const MIN_RAIL_WIDTH = 200;
|
|
936
987
|
const MAX_RAIL_WIDTH = 480;
|
|
937
988
|
|
|
938
|
-
function readStoredRailWidth(): number {
|
|
939
|
-
if (typeof window === 'undefined') return DEFAULT_RAIL_WIDTH;
|
|
940
|
-
const raw = window.localStorage.getItem(RAIL_WIDTH_STORAGE_KEY);
|
|
941
|
-
const parsed = raw == null ? Number.NaN : Number(raw);
|
|
942
|
-
if (!Number.isFinite(parsed)) return DEFAULT_RAIL_WIDTH;
|
|
943
|
-
return Math.min(MAX_RAIL_WIDTH, Math.max(MIN_RAIL_WIDTH, parsed));
|
|
944
|
-
}
|
|
945
|
-
|
|
946
989
|
function ResizableRail(props: {
|
|
947
990
|
pages: SlideModule['default'];
|
|
948
991
|
design?: SlideModule['design'];
|
|
@@ -954,103 +997,26 @@ function ResizableRail(props: {
|
|
|
954
997
|
onOverview?: () => void;
|
|
955
998
|
}) {
|
|
956
999
|
const t = useLocale();
|
|
957
|
-
const [width, setWidth] =
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
window.localStorage.setItem(RAIL_WIDTH_STORAGE_KEY, String(width));
|
|
964
|
-
}, [width]);
|
|
965
|
-
|
|
966
|
-
useEffect(() => {
|
|
967
|
-
if (!resizing) return;
|
|
968
|
-
const prev = {
|
|
969
|
-
cursor: document.body.style.cursor,
|
|
970
|
-
userSelect: document.body.style.userSelect,
|
|
971
|
-
};
|
|
972
|
-
document.body.style.cursor = 'col-resize';
|
|
973
|
-
document.body.style.userSelect = 'none';
|
|
974
|
-
return () => {
|
|
975
|
-
document.body.style.cursor = prev.cursor;
|
|
976
|
-
document.body.style.userSelect = prev.userSelect;
|
|
977
|
-
};
|
|
978
|
-
}, [resizing]);
|
|
979
|
-
|
|
980
|
-
const onPointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
981
|
-
e.preventDefault();
|
|
982
|
-
e.currentTarget.setPointerCapture(e.pointerId);
|
|
983
|
-
dragRef.current = { startX: e.clientX, startWidth: width };
|
|
984
|
-
setResizing(true);
|
|
985
|
-
};
|
|
986
|
-
|
|
987
|
-
const onPointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
988
|
-
if (!dragRef.current) return;
|
|
989
|
-
const delta = e.clientX - dragRef.current.startX;
|
|
990
|
-
const next = Math.min(
|
|
991
|
-
MAX_RAIL_WIDTH,
|
|
992
|
-
Math.max(MIN_RAIL_WIDTH, dragRef.current.startWidth + delta),
|
|
993
|
-
);
|
|
994
|
-
setWidth(next);
|
|
995
|
-
};
|
|
996
|
-
|
|
997
|
-
const onPointerUp = (e: React.PointerEvent<HTMLDivElement>) => {
|
|
998
|
-
if (e.currentTarget.hasPointerCapture(e.pointerId)) {
|
|
999
|
-
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
1000
|
-
}
|
|
1001
|
-
dragRef.current = null;
|
|
1002
|
-
setResizing(false);
|
|
1003
|
-
};
|
|
1004
|
-
|
|
1005
|
-
const onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
1006
|
-
const step = e.shiftKey ? 32 : 8;
|
|
1007
|
-
if (e.key === 'ArrowLeft') {
|
|
1008
|
-
e.preventDefault();
|
|
1009
|
-
e.stopPropagation();
|
|
1010
|
-
setWidth((w) => Math.max(MIN_RAIL_WIDTH, w - step));
|
|
1011
|
-
} else if (e.key === 'ArrowRight') {
|
|
1012
|
-
e.preventDefault();
|
|
1013
|
-
e.stopPropagation();
|
|
1014
|
-
setWidth((w) => Math.min(MAX_RAIL_WIDTH, w + step));
|
|
1015
|
-
} else if (e.key === 'Home') {
|
|
1016
|
-
e.preventDefault();
|
|
1017
|
-
e.stopPropagation();
|
|
1018
|
-
setWidth(DEFAULT_RAIL_WIDTH);
|
|
1019
|
-
}
|
|
1020
|
-
};
|
|
1000
|
+
const [width, setWidth] = useStoredWidth(
|
|
1001
|
+
RAIL_WIDTH_STORAGE_KEY,
|
|
1002
|
+
DEFAULT_RAIL_WIDTH,
|
|
1003
|
+
MIN_RAIL_WIDTH,
|
|
1004
|
+
MAX_RAIL_WIDTH,
|
|
1005
|
+
);
|
|
1021
1006
|
|
|
1022
1007
|
return (
|
|
1023
1008
|
<div className="relative hidden shrink-0 md:block" style={{ width }}>
|
|
1024
1009
|
<ThumbnailRail width={width} {...props} />
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
onPointerMove={onPointerMove}
|
|
1036
|
-
onPointerUp={onPointerUp}
|
|
1037
|
-
onPointerCancel={onPointerUp}
|
|
1038
|
-
onKeyDown={onKeyDown}
|
|
1039
|
-
onDoubleClick={() => setWidth(DEFAULT_RAIL_WIDTH)}
|
|
1040
|
-
className={cn(
|
|
1041
|
-
'group/resize absolute inset-y-0 right-0 z-20 w-1.5 translate-x-1/2 cursor-col-resize touch-none outline-none',
|
|
1042
|
-
'focus-visible:bg-brand/20',
|
|
1043
|
-
)}
|
|
1044
|
-
>
|
|
1045
|
-
<span
|
|
1046
|
-
aria-hidden
|
|
1047
|
-
className={cn(
|
|
1048
|
-
'pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-brand opacity-0 transition-opacity duration-150',
|
|
1049
|
-
'group-hover/resize:opacity-100 group-focus-visible/resize:opacity-100',
|
|
1050
|
-
resizing && 'opacity-100',
|
|
1051
|
-
)}
|
|
1052
|
-
/>
|
|
1053
|
-
</div>
|
|
1010
|
+
<ResizeHandle
|
|
1011
|
+
width={width}
|
|
1012
|
+
min={MIN_RAIL_WIDTH}
|
|
1013
|
+
max={MAX_RAIL_WIDTH}
|
|
1014
|
+
defaultWidth={DEFAULT_RAIL_WIDTH}
|
|
1015
|
+
edge="right"
|
|
1016
|
+
label={t.thumbnailRail.resizeRail}
|
|
1017
|
+
onResize={setWidth}
|
|
1018
|
+
className="right-0 translate-x-1/2"
|
|
1019
|
+
/>
|
|
1054
1020
|
</div>
|
|
1055
1021
|
);
|
|
1056
1022
|
}
|
|
@@ -1096,6 +1062,39 @@ function EditorMenuItems({
|
|
|
1096
1062
|
);
|
|
1097
1063
|
}
|
|
1098
1064
|
|
|
1065
|
+
function SlideAgentDock({
|
|
1066
|
+
slideId,
|
|
1067
|
+
slideTitle,
|
|
1068
|
+
pageNumber,
|
|
1069
|
+
totalPages,
|
|
1070
|
+
}: {
|
|
1071
|
+
slideId: string;
|
|
1072
|
+
slideTitle: string;
|
|
1073
|
+
pageNumber: number;
|
|
1074
|
+
totalPages: number;
|
|
1075
|
+
}) {
|
|
1076
|
+
const { selected, comments } = useInspector();
|
|
1077
|
+
const context = useMemo<AgentTurnContext>(
|
|
1078
|
+
() => ({
|
|
1079
|
+
slideId,
|
|
1080
|
+
slideTitle,
|
|
1081
|
+
pageNumber,
|
|
1082
|
+
totalPages,
|
|
1083
|
+
pendingComments: comments.length,
|
|
1084
|
+
selection: selected
|
|
1085
|
+
? {
|
|
1086
|
+
line: selected.line,
|
|
1087
|
+
column: selected.column,
|
|
1088
|
+
tagName: selected.anchor.tagName.toLowerCase(),
|
|
1089
|
+
text: (selected.anchor.textContent ?? '').replace(/\s+/g, ' ').trim().slice(0, 120),
|
|
1090
|
+
}
|
|
1091
|
+
: null,
|
|
1092
|
+
}),
|
|
1093
|
+
[slideId, slideTitle, pageNumber, totalPages, comments.length, selected],
|
|
1094
|
+
);
|
|
1095
|
+
return <AgentPanel context={context} onClose={() => setDockOpen(false)} />;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1099
1098
|
function AgentConnectedBadge() {
|
|
1100
1099
|
const t = useLocale();
|
|
1101
1100
|
const connected = useAgentSocketConnected();
|
|
@@ -1167,13 +1166,14 @@ function SlideViewportNavigation({
|
|
|
1167
1166
|
canPrev: boolean;
|
|
1168
1167
|
canNext: boolean;
|
|
1169
1168
|
}) {
|
|
1170
|
-
const {
|
|
1169
|
+
const { mode, inlineEdit } = useInspector();
|
|
1171
1170
|
const isMobile = useIsMobile();
|
|
1172
1171
|
const editing = !!inlineEdit;
|
|
1172
|
+
const browsing = mode === 'preview';
|
|
1173
1173
|
|
|
1174
1174
|
useWheelPageNavigation({
|
|
1175
1175
|
ref: targetRef,
|
|
1176
|
-
enabled:
|
|
1176
|
+
enabled: browsing && !editing,
|
|
1177
1177
|
canPrev,
|
|
1178
1178
|
canNext,
|
|
1179
1179
|
onPrev,
|
|
@@ -1185,7 +1185,7 @@ function SlideViewportNavigation({
|
|
|
1185
1185
|
// zones). Interactive slide content keeps its tap via the hook's passthrough.
|
|
1186
1186
|
useClickPageNavigation({
|
|
1187
1187
|
ref: targetRef,
|
|
1188
|
-
enabled: isMobile &&
|
|
1188
|
+
enabled: isMobile && browsing && !editing,
|
|
1189
1189
|
edgeRatio: 0.18,
|
|
1190
1190
|
canPrev,
|
|
1191
1191
|
canNext,
|