@open-document/core 0.13.3 → 0.14.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-CvsOak5B.js → build-I0cgoERP.js} +1 -1
- package/dist/{check-CbUBwYmf.js → check-Dys96QSL.js} +3 -3
- package/dist/cli/bin.js +10 -21
- package/dist/{config-BWtOZ1jc.d.ts → config-cAV1OCuY.d.ts} +9 -1
- package/dist/{context-CWgfsHoE.js → context-C-osJW5f.js} +1 -1
- package/dist/{dev-B8H2qT6G.js → dev-CC4PrIOC.js} +1 -1
- package/dist/{diff-BvIjjgnc.js → diff-DhutD4TJ.js} +2 -2
- package/dist/{export-DX30_s2q.js → export-KrajVJO7.js} +3 -3
- package/dist/{import-DgsdJT5e.js → import-Yv34za3L.js} +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/ops/index.d.ts +3 -1
- package/dist/ops/index.js +2 -2
- package/dist/ops-Dux5HlkH.js +401 -0
- package/dist/{preview-DYMUNjXL.js → preview-7eqn9Wzf.js} +1 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/{config-CltJJVsw.js → session-BSbrC5gK.js} +3268 -385
- package/dist/{templates-B5Tz0AKb.js → templates-s-VLTSRc.js} +3 -3
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/skills/create-doc/SKILL.md +1 -1
- package/skills/doc-authoring/SKILL.md +6 -0
- package/src/app/app.tsx +2 -0
- package/src/app/components/agent/agent-dock.tsx +75 -0
- package/src/app/components/agent/agent-markdown.tsx +45 -0
- package/src/app/components/agent/agent-panel.tsx +695 -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 +183 -0
- package/src/app/components/agent/history-view.tsx +134 -0
- package/src/app/components/agent/provider-logo.tsx +23 -0
- package/src/app/components/agent/transcript.tsx +717 -0
- package/src/app/components/comments/comments-panel.tsx +26 -2
- package/src/app/components/inspector/inspector.tsx +17 -0
- package/src/app/components/note-markdown.tsx +85 -0
- package/src/app/components/page-error-boundary.tsx +84 -0
- package/src/app/components/page-frame.tsx +2 -1
- package/src/app/components/panel/resize-handle.tsx +129 -0
- package/src/app/components/ui/button.tsx +97 -0
- package/src/app/components/ui/popover.tsx +144 -0
- package/src/app/components/ui/tooltip.tsx +123 -0
- package/src/app/lib/agent/use-agent.ts +543 -0
- package/src/app/lib/diagnostics.ts +13 -0
- package/src/app/lib/export-dom.ts +2 -1
- package/src/app/lib/export-pdf.ts +2 -1
- package/src/app/lib/i18n-ja/agent-panel.ts +115 -0
- package/src/app/lib/i18n-ja/agent.ts +9 -0
- package/src/app/lib/i18n-ja/index.ts +9 -1
- package/src/app/lib/i18n-ko/agent-panel.ts +114 -0
- package/src/app/lib/i18n-ko/agent.ts +9 -0
- package/src/app/lib/i18n-ko/index.ts +9 -1
- package/src/app/lib/i18n-zh-cn/agent-panel.ts +113 -0
- package/src/app/lib/i18n-zh-cn/agent.ts +9 -0
- package/src/app/lib/i18n-zh-cn/index.ts +9 -1
- package/src/app/lib/i18n-zh-tw/agent-panel.ts +113 -0
- package/src/app/lib/i18n-zh-tw/agent.ts +9 -0
- package/src/app/lib/i18n-zh-tw/index.ts +9 -1
- package/src/app/lib/note-markdown.ts +116 -0
- package/src/app/lib/toast.ts +50 -0
- package/src/app/lib/use-auto-grow.ts +15 -0
- package/src/app/lib/use-doc-titles.ts +28 -0
- package/src/app/lib/use-locale.ts +151 -0
- package/src/app/lib/utils.ts +4 -0
- package/src/app/routes/doc-preview.tsx +103 -0
- package/src/app/routes/doc.tsx +118 -11
- package/src/app/routes/home.tsx +43 -8
- package/src/app/styles.css +193 -0
- package/dist/ops-CSR5RlrE.js +0 -1673
package/src/app/routes/doc.tsx
CHANGED
|
@@ -27,10 +27,16 @@ import {
|
|
|
27
27
|
Pencil,
|
|
28
28
|
Plus,
|
|
29
29
|
Rows3,
|
|
30
|
+
Sparkles,
|
|
30
31
|
} from 'lucide-react';
|
|
31
32
|
import { useTheme } from 'next-themes';
|
|
32
33
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
33
34
|
import { Link, useNavigate, useParams } from 'react-router-dom';
|
|
35
|
+
import { applyCommentsPrompt } from '../../agent/prompt';
|
|
36
|
+
import type { AgentTurnContext } from '../../agent/types';
|
|
37
|
+
import { AgentDockFrame } from '../components/agent/agent-dock';
|
|
38
|
+
import { AgentPanel } from '../components/agent/agent-panel';
|
|
39
|
+
import { AgentPresence } from '../components/agent/agent-presence';
|
|
34
40
|
import { ChangesOverlay, elementsOf } from '../components/changes/changes-overlay';
|
|
35
41
|
import { ChangesPanel } from '../components/changes/changes-panel';
|
|
36
42
|
import { type ChangeItem, itemsOf, useChanges } from '../components/changes/use-changes';
|
|
@@ -51,6 +57,13 @@ import { EditSaveCard } from '../components/panel/edit-save-card';
|
|
|
51
57
|
import { RecordPicker } from '../components/record-picker';
|
|
52
58
|
import { ThemeToggle } from '../components/theme-toggle';
|
|
53
59
|
import { Menu, MenuItem } from '../components/ui/menu';
|
|
60
|
+
import {
|
|
61
|
+
requestAgent,
|
|
62
|
+
setDockOpen as setAgentDockOpen,
|
|
63
|
+
useAgentActivity,
|
|
64
|
+
useAgentDock,
|
|
65
|
+
useAgentStatus,
|
|
66
|
+
} from '../lib/agent/use-agent';
|
|
54
67
|
import { useAgentBridge } from '../lib/agent-bridge';
|
|
55
68
|
import { exportDocAsDocx } from '../lib/export-docx';
|
|
56
69
|
import { exportDocAsHtml } from '../lib/export-html';
|
|
@@ -79,6 +92,8 @@ import {
|
|
|
79
92
|
writeViewMode,
|
|
80
93
|
} from '../lib/view-mode';
|
|
81
94
|
|
|
95
|
+
type PickedElement = { loc: string; tag: string; text?: string };
|
|
96
|
+
|
|
82
97
|
type DownloadFormat = 'pdf' | 'html' | 'png' | 'svg' | 'docx';
|
|
83
98
|
|
|
84
99
|
const DOWNLOAD_LABEL: Record<DownloadFormat, string> = {
|
|
@@ -216,16 +231,23 @@ export function Doc() {
|
|
|
216
231
|
const [customRange, setCustomRange] = useState('');
|
|
217
232
|
// One dock on the right, one panel in it at a time; the element panel takes
|
|
218
233
|
// it back whenever an element is picked.
|
|
219
|
-
|
|
234
|
+
// The agent's half of it is app-wide, as in open-slide: the comments panel,
|
|
235
|
+
// a new document and a reload all open it from outside this route.
|
|
236
|
+
const [panel, setPanel] = useState<'design' | 'changes' | 'comments' | null>(null);
|
|
237
|
+
const { open: agentOpen } = useAgentDock();
|
|
238
|
+
const dock = agentOpen ? 'agent' : panel;
|
|
220
239
|
const designOpen = dock === 'design';
|
|
221
240
|
const changesOpen = dock === 'changes';
|
|
222
241
|
const commentsOpen = dock === 'comments';
|
|
242
|
+
const setDock = useCallback((next: 'design' | 'changes' | 'comments' | 'agent' | null) => {
|
|
243
|
+
setAgentDockOpen(next === 'agent');
|
|
244
|
+
setPanel(next === 'agent' ? null : next);
|
|
245
|
+
}, []);
|
|
223
246
|
const toggleDock = useCallback(
|
|
224
|
-
(
|
|
225
|
-
|
|
226
|
-
[],
|
|
247
|
+
(next: 'design' | 'changes' | 'comments' | 'agent') => setDock(dock === next ? null : next),
|
|
248
|
+
[dock, setDock],
|
|
227
249
|
);
|
|
228
|
-
const closeDock = useCallback(() => setDock(null), []);
|
|
250
|
+
const closeDock = useCallback(() => setDock(null), [setDock]);
|
|
229
251
|
const [editing, setEditingState] = useState(readEditing);
|
|
230
252
|
// The dev server reloads every open viewer when a document is added or
|
|
231
253
|
// removed anywhere in the workspace. Edit mode is per tab and survives that.
|
|
@@ -291,6 +313,34 @@ export function Doc() {
|
|
|
291
313
|
() => new Set([...commentPlacement.values()].flat()),
|
|
292
314
|
[commentPlacement],
|
|
293
315
|
);
|
|
316
|
+
// The agent's dock exists whenever the dev server answers for it; until an
|
|
317
|
+
// agent is connected it explains how to connect one.
|
|
318
|
+
const agentStatus = useAgentStatus();
|
|
319
|
+
const agentAvailable = agentStatus.enabled;
|
|
320
|
+
const [pickedElement, setPickedElement] = useState<PickedElement | null>(null);
|
|
321
|
+
const agentContext = useMemo<AgentTurnContext>(() => {
|
|
322
|
+
const [line, column] = (pickedElement?.loc ?? '').split(':').map(Number);
|
|
323
|
+
return {
|
|
324
|
+
...(docId ? { docId } : {}),
|
|
325
|
+
...(doc?.meta?.title ? { docTitle: doc.meta.title } : {}),
|
|
326
|
+
...(pages.length > 0 ? { pageNumber: currentPage, totalPages: pages.length } : {}),
|
|
327
|
+
pendingComments: commentList.length,
|
|
328
|
+
selection:
|
|
329
|
+
pickedElement && line && column !== undefined && !Number.isNaN(column)
|
|
330
|
+
? { line, column, tagName: pickedElement.tag, text: pickedElement.text ?? '' }
|
|
331
|
+
: null,
|
|
332
|
+
};
|
|
333
|
+
}, [docId, doc?.meta?.title, pages.length, currentPage, commentList.length, pickedElement]);
|
|
334
|
+
// While an agent writes this document section by section, follow the pages
|
|
335
|
+
// as they appear so the reader watches it grow.
|
|
336
|
+
const scrollToPageRef = useRef<(page: number) => void>(() => {});
|
|
337
|
+
const agentActivity = useAgentActivity(docId ?? '');
|
|
338
|
+
const agentWriting = agentActivity !== null;
|
|
339
|
+
const seenPageCount = useRef(pages.length);
|
|
340
|
+
useEffect(() => {
|
|
341
|
+
if (agentWriting && pages.length > seenPageCount.current) scrollToPageRef.current(pages.length);
|
|
342
|
+
seenPageCount.current = pages.length;
|
|
343
|
+
}, [agentWriting, pages.length]);
|
|
294
344
|
const [activeComment, setActiveComment] = useState<string | null>(null);
|
|
295
345
|
const selectComment = useCallback((comment: DocComment) => {
|
|
296
346
|
setActiveComment(comment.id);
|
|
@@ -315,7 +365,7 @@ export function Doc() {
|
|
|
315
365
|
const pickElement = useCallback(() => {
|
|
316
366
|
setDock(null);
|
|
317
367
|
setPicking(false);
|
|
318
|
-
}, []);
|
|
368
|
+
}, [setDock]);
|
|
319
369
|
const cancelPick = useCallback(() => setPicking(false), []);
|
|
320
370
|
useEffect(() => {
|
|
321
371
|
if (!editing) {
|
|
@@ -460,6 +510,7 @@ export function Doc() {
|
|
|
460
510
|
const frame = pagesRef.current?.children[page - 1];
|
|
461
511
|
frame?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
462
512
|
}, []);
|
|
513
|
+
scrollToPageRef.current = scrollToPage;
|
|
463
514
|
|
|
464
515
|
// Land the heading near the top of the reading pane, not centred — the reader
|
|
465
516
|
// wants what follows the heading, and centring buries half of it.
|
|
@@ -670,6 +721,19 @@ export function Doc() {
|
|
|
670
721
|
icon: MessageSquare,
|
|
671
722
|
run: () => toggleDock('comments'),
|
|
672
723
|
},
|
|
724
|
+
...(agentAvailable
|
|
725
|
+
? [
|
|
726
|
+
{
|
|
727
|
+
id: 'agent',
|
|
728
|
+
group: t('Actions'),
|
|
729
|
+
label: agentOpen ? t('Close the agent panel') : t('Ask the agent'),
|
|
730
|
+
hint: 'A',
|
|
731
|
+
keywords: 'agent codex ai chat',
|
|
732
|
+
icon: Sparkles,
|
|
733
|
+
run: () => toggleDock('agent'),
|
|
734
|
+
},
|
|
735
|
+
]
|
|
736
|
+
: []),
|
|
673
737
|
);
|
|
674
738
|
}
|
|
675
739
|
return [
|
|
@@ -716,11 +780,14 @@ export function Doc() {
|
|
|
716
780
|
} else if (import.meta.env.DEV && (e.key === 'm' || e.key === 'M')) {
|
|
717
781
|
e.preventDefault();
|
|
718
782
|
toggleDock('comments');
|
|
783
|
+
} else if (agentAvailable && (e.key === 'a' || e.key === 'A')) {
|
|
784
|
+
e.preventDefault();
|
|
785
|
+
toggleDock('agent');
|
|
719
786
|
}
|
|
720
787
|
};
|
|
721
788
|
window.addEventListener('keydown', onKeyDown);
|
|
722
789
|
return () => window.removeEventListener('keydown', onKeyDown);
|
|
723
|
-
}, [toggleFullscreen, toggleDock]);
|
|
790
|
+
}, [toggleFullscreen, toggleDock, agentAvailable]);
|
|
724
791
|
|
|
725
792
|
if (state.status === 'error') {
|
|
726
793
|
return (
|
|
@@ -840,7 +907,7 @@ export function Doc() {
|
|
|
840
907
|
title={t('Design tokens (D)')}
|
|
841
908
|
onClick={() => toggleDock('design')}
|
|
842
909
|
className={cn(
|
|
843
|
-
'flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
|
|
910
|
+
'flex flex-none items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
|
|
844
911
|
designOpen && 'bg-accent',
|
|
845
912
|
)}
|
|
846
913
|
>
|
|
@@ -867,7 +934,7 @@ export function Doc() {
|
|
|
867
934
|
title={`${t('Changes since the last commit')} (C)`}
|
|
868
935
|
onClick={() => toggleDock('changes')}
|
|
869
936
|
className={cn(
|
|
870
|
-
'flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
|
|
937
|
+
'flex flex-none items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
|
|
871
938
|
changesOpen && 'bg-accent',
|
|
872
939
|
)}
|
|
873
940
|
>
|
|
@@ -897,7 +964,7 @@ export function Doc() {
|
|
|
897
964
|
title={`${t('Comments')} (M)`}
|
|
898
965
|
onClick={() => toggleDock('comments')}
|
|
899
966
|
className={cn(
|
|
900
|
-
'flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
|
|
967
|
+
'flex flex-none items-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2.5 py-1.5 text-xs transition-colors hover:bg-accent',
|
|
901
968
|
commentsOpen && 'bg-accent',
|
|
902
969
|
)}
|
|
903
970
|
>
|
|
@@ -914,6 +981,24 @@ export function Doc() {
|
|
|
914
981
|
)}
|
|
915
982
|
</button>
|
|
916
983
|
)}
|
|
984
|
+
{agentAvailable && (
|
|
985
|
+
<button
|
|
986
|
+
type="button"
|
|
987
|
+
aria-pressed={agentOpen}
|
|
988
|
+
aria-label={t('Agent')}
|
|
989
|
+
aria-keyshortcuts="A"
|
|
990
|
+
title={`${t('Agent')} (A)`}
|
|
991
|
+
onClick={() => toggleDock('agent')}
|
|
992
|
+
className="flex size-8 flex-none items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground aria-pressed:bg-accent aria-pressed:text-foreground"
|
|
993
|
+
>
|
|
994
|
+
<Sparkles
|
|
995
|
+
className={cn(
|
|
996
|
+
'size-4',
|
|
997
|
+
agentWriting && 'animate-pulse motion-reduce:animate-none',
|
|
998
|
+
)}
|
|
999
|
+
/>
|
|
1000
|
+
</button>
|
|
1001
|
+
)}
|
|
917
1002
|
|
|
918
1003
|
<CopyLink />
|
|
919
1004
|
|
|
@@ -928,7 +1013,7 @@ export function Doc() {
|
|
|
928
1013
|
<button
|
|
929
1014
|
type="button"
|
|
930
1015
|
disabled={download !== null}
|
|
931
|
-
className="flex items-center gap-1.5 rounded-md bg-primary px-2.5 py-1.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 disabled:opacity-70 aria-expanded:opacity-90"
|
|
1016
|
+
className="flex flex-none items-center gap-1.5 whitespace-nowrap rounded-md bg-primary px-2.5 py-1.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 disabled:opacity-70 aria-expanded:opacity-90"
|
|
932
1017
|
{...props}
|
|
933
1018
|
>
|
|
934
1019
|
{download ? (
|
|
@@ -1069,6 +1154,16 @@ export function Doc() {
|
|
|
1069
1154
|
onShownChange={setCardShown}
|
|
1070
1155
|
/>
|
|
1071
1156
|
)}
|
|
1157
|
+
{agentActivity && (
|
|
1158
|
+
// Over the pages, not in their scroll: the ring and the pill stay put
|
|
1159
|
+
// while the reader scrolls through what the agent writes.
|
|
1160
|
+
<div
|
|
1161
|
+
data-agent-provider={agentActivity.provider}
|
|
1162
|
+
className="pointer-events-none absolute inset-0 md:my-2 md:mr-2 md:rounded-xl [&_button]:pointer-events-auto"
|
|
1163
|
+
>
|
|
1164
|
+
<AgentPresence activity={agentActivity} revision={pages} />
|
|
1165
|
+
</div>
|
|
1166
|
+
)}
|
|
1072
1167
|
</div>
|
|
1073
1168
|
{editing && docId && (
|
|
1074
1169
|
// Keyed by document: a selection, or an editor carried across a
|
|
@@ -1088,9 +1183,15 @@ export function Doc() {
|
|
|
1088
1183
|
exitRef={leaveEditRef}
|
|
1089
1184
|
controlsRef={editControlsRef}
|
|
1090
1185
|
onPendingChange={setTextPending}
|
|
1186
|
+
onSelectionChange={setPickedElement}
|
|
1091
1187
|
/>
|
|
1092
1188
|
)}
|
|
1093
1189
|
{designOpen && <DesignPanel onClose={closeDock} />}
|
|
1190
|
+
{agentOpen && (
|
|
1191
|
+
<AgentDockFrame>
|
|
1192
|
+
<AgentPanel context={agentContext} onClose={closeDock} />
|
|
1193
|
+
</AgentDockFrame>
|
|
1194
|
+
)}
|
|
1094
1195
|
{commentsOpen && docId && (
|
|
1095
1196
|
<CommentsPanel
|
|
1096
1197
|
docId={docId}
|
|
@@ -1114,6 +1215,12 @@ export function Doc() {
|
|
|
1114
1215
|
onNew={startComment}
|
|
1115
1216
|
picking={picking}
|
|
1116
1217
|
onClose={closeDock}
|
|
1218
|
+
{...(agentStatus.connected && agentStatus.providerName
|
|
1219
|
+
? {
|
|
1220
|
+
agentName: agentStatus.providerName,
|
|
1221
|
+
onApplyWithAgent: () => requestAgent({ text: applyCommentsPrompt(docId) }),
|
|
1222
|
+
}
|
|
1223
|
+
: {})}
|
|
1117
1224
|
/>
|
|
1118
1225
|
)}
|
|
1119
1226
|
{changesOpen && (
|
package/src/app/routes/home.tsx
CHANGED
|
@@ -14,10 +14,12 @@ import {
|
|
|
14
14
|
PencilLine,
|
|
15
15
|
Plus,
|
|
16
16
|
Search,
|
|
17
|
+
Sparkles,
|
|
17
18
|
Trash2,
|
|
18
19
|
} from 'lucide-react';
|
|
19
20
|
import { useMemo, useState } from 'react';
|
|
20
21
|
import { Link, useNavigate, useOutletContext } from 'react-router-dom';
|
|
22
|
+
import { ProviderLogo } from '../components/agent/provider-logo';
|
|
21
23
|
import {
|
|
22
24
|
CARD_GRID,
|
|
23
25
|
CardText,
|
|
@@ -31,12 +33,14 @@ import { PageFrame } from '../components/page-frame';
|
|
|
31
33
|
import { DOC_DND_MIME } from '../components/sidebar/folder-item';
|
|
32
34
|
import { ALL_DOCS_ID, DRAFT_ID } from '../components/sidebar/sidebar';
|
|
33
35
|
import { Menu, MenuItem, MenuSeparator } from '../components/ui/menu';
|
|
36
|
+
import { useAgentStatus, useCreateDoc } from '../lib/agent/use-agent';
|
|
34
37
|
import { coverContent } from '../lib/doc-preview';
|
|
35
38
|
import { docCreatedAt, docIds, docThemes, docTitles } from '../lib/docs';
|
|
36
39
|
import { type Translate, useLocale, useT } from '../lib/i18n';
|
|
37
40
|
import { pageLang, resolvePageGeometry } from '../lib/sdk';
|
|
38
41
|
import { findTheme } from '../lib/themes';
|
|
39
42
|
import { useDocModule } from '../lib/use-doc-module';
|
|
43
|
+
import { format, useLocale as useAgentLocale } from '../lib/use-locale';
|
|
40
44
|
import type { HomeOutletContext } from './home-shell';
|
|
41
45
|
|
|
42
46
|
/** Sheet and date, the two facts that tell documents apart at a glance. */
|
|
@@ -99,14 +103,17 @@ export function Home() {
|
|
|
99
103
|
const inFolder =
|
|
100
104
|
ctx.selectedId !== ALL_DOCS_ID && ctx.selectedId !== DRAFT_ID ? ctx.selectedId : null;
|
|
101
105
|
const newButton = import.meta.env.DEV && (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
<>
|
|
107
|
+
<DraftWithAgentButton />
|
|
108
|
+
<button
|
|
109
|
+
type="button"
|
|
110
|
+
onClick={() => setCreating(true)}
|
|
111
|
+
className="flex h-8 items-center gap-1.5 rounded-md bg-primary px-2.5 text-primary-foreground text-xs transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
|
|
112
|
+
>
|
|
113
|
+
<Plus className="size-3.5" />
|
|
114
|
+
{t('New document')}
|
|
115
|
+
</button>
|
|
116
|
+
</>
|
|
110
117
|
);
|
|
111
118
|
|
|
112
119
|
const setSort = (next: SortKey) => {
|
|
@@ -425,3 +432,31 @@ function DocCard({
|
|
|
425
432
|
</div>
|
|
426
433
|
);
|
|
427
434
|
}
|
|
435
|
+
|
|
436
|
+
// Offered even before an agent is connected: the blank document opens the
|
|
437
|
+
// agent panel, which walks a first-time user through connecting one.
|
|
438
|
+
function DraftWithAgentButton() {
|
|
439
|
+
const t = useAgentLocale();
|
|
440
|
+
const { enabled, provider } = useAgentStatus();
|
|
441
|
+
const start = useCreateDoc();
|
|
442
|
+
if (!enabled) return null;
|
|
443
|
+
return (
|
|
444
|
+
<button
|
|
445
|
+
type="button"
|
|
446
|
+
onClick={() => void start()}
|
|
447
|
+
title={
|
|
448
|
+
provider
|
|
449
|
+
? format(t.agent.createDocWith, { provider: provider.name })
|
|
450
|
+
: t.agent.quickCreateHint
|
|
451
|
+
}
|
|
452
|
+
className="flex h-8 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs transition-colors hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground/60"
|
|
453
|
+
>
|
|
454
|
+
{provider ? (
|
|
455
|
+
<ProviderLogo provider={provider.id} className="size-3.5" />
|
|
456
|
+
) : (
|
|
457
|
+
<Sparkles className="size-3.5" />
|
|
458
|
+
)}
|
|
459
|
+
{t.agent.createDoc}
|
|
460
|
+
</button>
|
|
461
|
+
);
|
|
462
|
+
}
|
package/src/app/styles.css
CHANGED
|
@@ -19,6 +19,27 @@
|
|
|
19
19
|
--color-border: var(--border);
|
|
20
20
|
|
|
21
21
|
--radius-md: 6px;
|
|
22
|
+
|
|
23
|
+
/* The agent panel is open-slide's, and reads its token names; here they
|
|
24
|
+
resolve to open-doc's own neutral palette. */
|
|
25
|
+
--color-card: var(--background);
|
|
26
|
+
--color-card-foreground: var(--foreground);
|
|
27
|
+
--color-popover: var(--background);
|
|
28
|
+
--color-popover-foreground: var(--foreground);
|
|
29
|
+
--color-secondary: var(--muted);
|
|
30
|
+
--color-secondary-foreground: var(--foreground);
|
|
31
|
+
--color-hairline: var(--border);
|
|
32
|
+
--color-ring: var(--comment-pin);
|
|
33
|
+
--color-destructive: var(--change-removed);
|
|
34
|
+
--color-brand: var(--comment-pin);
|
|
35
|
+
--color-brand-foreground: oklch(0.985 0 0);
|
|
36
|
+
--color-sidebar: var(--background);
|
|
37
|
+
--color-sidebar-foreground: var(--foreground);
|
|
38
|
+
--ease-swift: cubic-bezier(0.22, 1, 0.36, 1);
|
|
39
|
+
--shadow-edge: 0 0 0 0.5px oklch(0 0 0 / 0.06), 0 1px 0 oklch(0 0 0 / 0.025);
|
|
40
|
+
--shadow-floating:
|
|
41
|
+
0 0 0 0.5px oklch(0 0 0 / 0.08), 0 1px 1px oklch(0 0 0 / 0.04),
|
|
42
|
+
0 4px 16px -2px oklch(0 0 0 / 0.08);
|
|
22
43
|
}
|
|
23
44
|
|
|
24
45
|
:root {
|
|
@@ -258,3 +279,175 @@
|
|
|
258
279
|
background-color: rgb(255 138 0 / 0.62);
|
|
259
280
|
color: inherit;
|
|
260
281
|
}
|
|
282
|
+
|
|
283
|
+
@keyframes island-enter {
|
|
284
|
+
from {
|
|
285
|
+
opacity: 0;
|
|
286
|
+
filter: blur(6px);
|
|
287
|
+
transform: translateY(6px) scale(0.9);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.island-enter {
|
|
292
|
+
animation: island-enter 420ms cubic-bezier(0.32, 0.72, 0, 1) both;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/* Agent presence: ring, write sweep and shimmer shown while an agent edits a deck. */
|
|
296
|
+
@property --agent-angle {
|
|
297
|
+
syntax: "<angle>";
|
|
298
|
+
inherits: false;
|
|
299
|
+
initial-value: 0deg;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
[data-agent-provider] {
|
|
303
|
+
--agent-a: oklch(0.68 0.14 42);
|
|
304
|
+
--agent-b: oklch(0.82 0.12 75);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
[data-agent-provider="codex"] {
|
|
308
|
+
--agent-a: oklch(0.64 0.13 170);
|
|
309
|
+
--agent-b: oklch(0.7 0.14 240);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
@keyframes agent-spin {
|
|
313
|
+
to {
|
|
314
|
+
--agent-angle: 360deg;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
@keyframes agent-fade-in {
|
|
319
|
+
from {
|
|
320
|
+
opacity: 0;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.agent-ring {
|
|
325
|
+
pointer-events: none;
|
|
326
|
+
position: absolute;
|
|
327
|
+
inset: 0;
|
|
328
|
+
border-radius: inherit;
|
|
329
|
+
padding: 1.5px;
|
|
330
|
+
background: conic-gradient(
|
|
331
|
+
from var(--agent-angle),
|
|
332
|
+
transparent 0deg,
|
|
333
|
+
var(--agent-a) 70deg,
|
|
334
|
+
var(--agent-b) 140deg,
|
|
335
|
+
transparent 210deg,
|
|
336
|
+
transparent 360deg
|
|
337
|
+
);
|
|
338
|
+
mask:
|
|
339
|
+
linear-gradient(#000 0 0) content-box exclude,
|
|
340
|
+
linear-gradient(#000 0 0);
|
|
341
|
+
animation:
|
|
342
|
+
agent-spin 3.6s linear infinite,
|
|
343
|
+
agent-fade-in 400ms var(--ease-swift) both;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.agent-glow {
|
|
347
|
+
pointer-events: none;
|
|
348
|
+
position: absolute;
|
|
349
|
+
inset: 0;
|
|
350
|
+
border-radius: inherit;
|
|
351
|
+
box-shadow:
|
|
352
|
+
inset 0 0 0 1px color-mix(in oklch, var(--agent-a) 35%, transparent),
|
|
353
|
+
inset 0 0 48px -12px color-mix(in oklch, var(--agent-a) 45%, transparent);
|
|
354
|
+
animation: agent-fade-in 400ms var(--ease-swift) both;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
@keyframes agent-sweep {
|
|
358
|
+
from {
|
|
359
|
+
background-position: 120% 0;
|
|
360
|
+
opacity: 1;
|
|
361
|
+
}
|
|
362
|
+
to {
|
|
363
|
+
background-position: -20% 0;
|
|
364
|
+
opacity: 0;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.agent-sweep {
|
|
369
|
+
pointer-events: none;
|
|
370
|
+
position: absolute;
|
|
371
|
+
inset: 0;
|
|
372
|
+
border-radius: inherit;
|
|
373
|
+
background: linear-gradient(
|
|
374
|
+
105deg,
|
|
375
|
+
transparent 35%,
|
|
376
|
+
color-mix(in oklch, var(--agent-b) 22%, transparent) 50%,
|
|
377
|
+
transparent 65%
|
|
378
|
+
);
|
|
379
|
+
background-size: 250% 100%;
|
|
380
|
+
animation: agent-sweep 900ms var(--ease-swift) both;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
@keyframes agent-shimmer {
|
|
384
|
+
from {
|
|
385
|
+
background-position: 100% 0;
|
|
386
|
+
}
|
|
387
|
+
to {
|
|
388
|
+
background-position: 0% 0;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.agent-shimmer {
|
|
393
|
+
background: linear-gradient(
|
|
394
|
+
90deg,
|
|
395
|
+
var(--muted-foreground) 35%,
|
|
396
|
+
var(--foreground) 50%,
|
|
397
|
+
var(--muted-foreground) 65%
|
|
398
|
+
);
|
|
399
|
+
background-size: 300% 100%;
|
|
400
|
+
background-clip: text;
|
|
401
|
+
color: transparent;
|
|
402
|
+
animation: agent-shimmer 1.8s linear infinite;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
@keyframes agent-progress {
|
|
406
|
+
from {
|
|
407
|
+
transform: translateX(-100%);
|
|
408
|
+
}
|
|
409
|
+
to {
|
|
410
|
+
transform: translateX(250%);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.agent-progress {
|
|
415
|
+
pointer-events: none;
|
|
416
|
+
position: absolute;
|
|
417
|
+
inset-inline: 0;
|
|
418
|
+
top: 0;
|
|
419
|
+
height: 1.5px;
|
|
420
|
+
overflow: hidden;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.agent-progress::after {
|
|
424
|
+
content: "";
|
|
425
|
+
position: absolute;
|
|
426
|
+
inset-block: 0;
|
|
427
|
+
width: 40%;
|
|
428
|
+
background: linear-gradient(90deg, transparent, var(--agent-a), var(--agent-b), transparent);
|
|
429
|
+
animation: agent-progress 1.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
@media (prefers-reduced-motion: reduce) {
|
|
433
|
+
.agent-ring {
|
|
434
|
+
animation: agent-fade-in 160ms ease-out both;
|
|
435
|
+
--agent-angle: 120deg;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.agent-sweep {
|
|
439
|
+
display: none;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.agent-shimmer {
|
|
443
|
+
animation: none;
|
|
444
|
+
color: var(--foreground);
|
|
445
|
+
background: none;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.agent-progress::after {
|
|
449
|
+
animation: none;
|
|
450
|
+
width: 100%;
|
|
451
|
+
opacity: 0.6;
|
|
452
|
+
}
|
|
453
|
+
}
|