moi-computer 0.0.2 → 0.1.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/bin/moi.mjs +3 -1
- package/bunfig.toml +4 -0
- package/client/api/workspaces.ts +277 -6
- package/client/assets/mcp/agentation.png +0 -0
- package/client/assets/mcp/airtable.png +0 -0
- package/client/assets/mcp/apollo.png +0 -0
- package/client/assets/mcp/asana.png +0 -0
- package/client/assets/mcp/box.png +0 -0
- package/client/assets/mcp/chrome.svg +33 -0
- package/client/assets/mcp/clickup.png +0 -0
- package/client/assets/mcp/cloudflare.png +0 -0
- package/client/assets/mcp/context7.png +0 -0
- package/client/assets/mcp/datadog.png +0 -0
- package/client/assets/mcp/dropbox.png +0 -0
- package/client/assets/mcp/elevenlabs.png +0 -0
- package/client/assets/mcp/exa.png +0 -0
- package/client/assets/mcp/firecrawl.png +0 -0
- package/client/assets/mcp/gmail.png +0 -0
- package/client/assets/mcp/googlecalendar.png +0 -0
- package/client/assets/mcp/googledrive.png +0 -0
- package/client/assets/mcp/grafana.png +0 -0
- package/client/assets/mcp/huggingface.png +0 -0
- package/client/assets/mcp/intercom.png +0 -0
- package/client/assets/mcp/monday.png +0 -0
- package/client/assets/mcp/mongodb.png +0 -0
- package/client/assets/mcp/paper.png +0 -0
- package/client/assets/mcp/paypal.png +0 -0
- package/client/assets/mcp/perplexity.png +0 -0
- package/client/assets/mcp/postgresql.png +0 -0
- package/client/assets/mcp/posthog.png +0 -0
- package/client/assets/mcp/puppeteer.png +0 -0
- package/client/assets/mcp/railway.png +0 -0
- package/client/assets/mcp/redis.png +0 -0
- package/client/assets/mcp/salesforce.png +0 -0
- package/client/assets/mcp/shopify.png +0 -0
- package/client/assets/mcp/snowflake.png +0 -0
- package/client/assets/mcp/telegram.png +0 -0
- package/client/assets/mcp/twilio.png +0 -0
- package/client/assets/mcp/zapier.png +0 -0
- package/client/components/App.tsx +7 -1
- package/client/components/BottomPanel.tsx +2 -2
- package/client/components/ChatInput.tsx +195 -14
- package/client/components/ChatPanel.tsx +118 -49
- package/client/components/ChatPopup.tsx +2 -2
- package/client/components/CustomizePanel.tsx +8 -8
- package/client/components/HiddenPanel.tsx +1 -1
- package/client/components/HomePage.tsx +1 -1
- package/client/components/IconMcp.tsx +21 -0
- package/client/components/MarkdownContent.tsx +2 -2
- package/client/components/McpMenu.tsx +125 -0
- package/client/components/ModelPicker.tsx +147 -0
- package/client/components/Scratchpad.tsx +775 -0
- package/client/components/ShimmerText.tsx +20 -0
- package/client/components/ThreadSelector.tsx +2 -2
- package/client/components/TurnView.tsx +114 -534
- package/client/components/WidgetErrorBoundary.tsx +2 -2
- package/client/components/WidgetFrame.tsx +1 -1
- package/client/components/WidgetShell.tsx +2 -2
- package/client/components/Widgets.tsx +2 -2
- package/client/components/WorkspacePreview.tsx +3 -3
- package/client/components/WorkspacesPage.tsx +28 -20
- package/client/components/layout/SidebarLayout.tsx +24 -15
- package/client/components/playground/PixelPainter.tsx +2 -2
- package/client/components/playground/PlaygroundPage.tsx +1 -1
- package/client/components/playground/ToolCallsPage.tsx +81 -0
- package/client/components/routes/workspace/[id].tsx +534 -141
- package/client/components/routes/workspace/create.tsx +155 -0
- package/client/components/settings/IconPicker.tsx +590 -0
- package/client/components/settings/SettingsPages.tsx +307 -0
- package/client/components/settings/WorkspaceSettings.tsx +92 -0
- package/client/components/tool-group/CodeBlock.tsx +41 -0
- package/client/components/tool-group/Collapse.tsx +28 -0
- package/client/components/tool-group/ReadImagePreview.tsx +46 -0
- package/client/components/tool-group/SubagentCard.tsx +135 -0
- package/client/components/tool-group/TimelineRow.tsx +147 -0
- package/client/components/tool-group/ToolCallGroup.tsx +231 -0
- package/client/components/tool-group/ToolOutput.tsx +139 -0
- package/client/components/tool-group/detect.ts +93 -0
- package/client/components/tool-group/fixtures.ts +315 -0
- package/client/components/tool-group/format.ts +211 -0
- package/client/components/tool-group/index.ts +9 -0
- package/client/components/ui/button.tsx +4 -4
- package/client/components/ui/dialog.tsx +58 -0
- package/client/components/ui/dropdown-menu.tsx +9 -9
- package/client/components/ui/hover-card.tsx +44 -0
- package/client/components/ui/popover.tsx +1 -1
- package/client/components/ui/switch.tsx +23 -0
- package/client/components/ui/tooltip.tsx +54 -0
- package/client/externalize-react.ts +11 -5
- package/client/hooks/useApplet.ts +117 -0
- package/client/hooks/useChat.ts +162 -62
- package/client/hooks/useMeiEvents.ts +9 -2
- package/client/hooks/useStickToBottom.ts +86 -0
- package/client/hooks/useWorkspaceTheme.ts +8 -2
- package/client/index.css +49 -3
- package/client/index.html +22 -18
- package/client/index.tsx +29 -2
- package/client/lib/WorkspaceContext.tsx +5 -8
- package/client/lib/WorkspaceLayoutContext.tsx +30 -10
- package/client/lib/applet-cache.ts +54 -0
- package/client/lib/connection.ts +237 -0
- package/client/lib/flags.ts +10 -0
- package/client/lib/mcp-icons.ts +142 -10
- package/client/lib/preview-turn.ts +37 -0
- package/client/lib/render-icon.ts +173 -0
- package/client/lib/scratch-executor.ts +20 -0
- package/client/lib/uploads.ts +18 -0
- package/client/main.tsx +5 -0
- package/client/store/live.ts +282 -0
- package/client/structured-clone-shim.ts +14 -0
- package/client/theme.css +2 -2
- package/client/vendor/emojibase/en/data.json +1 -0
- package/client/vendor/emojibase/en/messages.json +1 -0
- package/client/vendor/react/development/_impl/react-dom-client.js +15871 -0
- package/client/vendor/react/development/_impl/react-dom.js +223 -0
- package/client/vendor/react/development/_impl/react-jsx-dev-runtime.js +256 -0
- package/client/vendor/react/development/_impl/react-jsx-runtime.js +260 -0
- package/client/vendor/react/development/_impl/react.js +863 -0
- package/client/vendor/react/development/react-dom-client.js +6 -0
- package/client/vendor/react/development/react-dom.js +17 -0
- package/client/vendor/react/development/react-jsx-dev-runtime.js +5 -0
- package/client/vendor/react/development/react-jsx-runtime.js +6 -0
- package/client/vendor/react/development/react.js +47 -0
- package/client/vendor/react/production/_impl/react-dom-client.js +10361 -0
- package/client/vendor/react/production/_impl/react-dom.js +184 -0
- package/client/vendor/react/production/_impl/react-jsx-dev-runtime.js +37 -0
- package/client/vendor/react/production/_impl/react-jsx-runtime.js +60 -0
- package/client/vendor/react/production/_impl/react.js +428 -0
- package/client/vendor/react/production/react-dom-client.js +6 -0
- package/client/vendor/react/production/react-dom.js +17 -0
- package/client/vendor/react/production/react-jsx-dev-runtime.js +5 -0
- package/client/vendor/react/production/react-jsx-runtime.js +6 -0
- package/client/vendor/react/production/react.js +47 -0
- package/dist/agentation-4s0nn45p.png +0 -0
- package/dist/airtable-hsa66v6q.png +0 -0
- package/dist/apollo-2ed5dy2d.png +0 -0
- package/dist/asana-tvgtwbx2.png +0 -0
- package/dist/atlassian-b3tq39hs.png +0 -0
- package/dist/box-w3n36t5g.png +0 -0
- package/dist/chrome-tspm94rw.svg +33 -0
- package/dist/chunk-kc6e9nd4.css +1 -0
- package/dist/chunk-yf3p7qg7.js +673 -0
- package/dist/claude-z2xnay0d.svg +3 -0
- package/dist/clickup-qqrqqvqb.png +0 -0
- package/dist/cloudflare-j9p931v6.png +0 -0
- package/dist/context7-8ht0xjfy.png +0 -0
- package/dist/datadog-70ne3yzt.png +0 -0
- package/dist/discord-vejhptwx.png +0 -0
- package/dist/dropbox-4m5s9mgr.png +0 -0
- package/dist/elevenlabs-2nzzej1t.png +0 -0
- package/dist/exa-qqj3vr0x.png +0 -0
- package/dist/favicon-nbmyjfjh.png +0 -0
- package/dist/figma-y9898rry.png +0 -0
- package/dist/firecrawl-w2t8nehx.png +0 -0
- package/dist/github-av5r5y3e.png +0 -0
- package/dist/gitlab-4pv5vm6b.png +0 -0
- package/dist/gmail-sg6a5v3x.png +0 -0
- package/dist/googlecalendar-nqhh2v7r.png +0 -0
- package/dist/googledrive-6s8xyab7.png +0 -0
- package/dist/grafana-1yfsnwr6.png +0 -0
- package/dist/granola-7j3b0nk2.png +0 -0
- package/dist/hermes-nous-pznd63x9.png +0 -0
- package/dist/hubspot-hghcmc2t.png +0 -0
- package/dist/huggingface-kxzaxj83.png +0 -0
- package/dist/index.html +47 -0
- package/dist/intercom-td763jt8.png +0 -0
- package/dist/linear-v9s3az2d.png +0 -0
- package/dist/monday-jdbs4wwf.png +0 -0
- package/dist/mongodb-emzxvhd5.png +0 -0
- package/dist/neon-zj4qar44.png +0 -0
- package/dist/notion-w034c0b8.png +0 -0
- package/dist/openclaw-a2pyfhpn.svg +22 -0
- package/dist/paper-zbt34fab.png +0 -0
- package/dist/paypal-kwwf7xsc.png +0 -0
- package/dist/perplexity-4y63rxvj.png +0 -0
- package/dist/postgresql-qsspbsr1.png +0 -0
- package/dist/posthog-sphppc4w.png +0 -0
- package/dist/puppeteer-2xjt1a9b.png +0 -0
- package/dist/railway-834de8d2.png +0 -0
- package/dist/redis-spm6w2m1.png +0 -0
- package/dist/salesforce-1mk56v4z.png +0 -0
- package/dist/sentry-hdwpmvek.png +0 -0
- package/dist/shopify-90dadaav.png +0 -0
- package/dist/slack-1c1wj62s.png +0 -0
- package/dist/snowflake-hfpykpgy.png +0 -0
- package/dist/stripe-zrfaqbj3.png +0 -0
- package/dist/supabase-4vg33zf2.png +0 -0
- package/dist/telegram-v6tjyrs7.png +0 -0
- package/dist/twilio-dpyjdwpj.png +0 -0
- package/dist/vercel-7d0ssw28.png +0 -0
- package/dist/zapier-p67qfch0.png +0 -0
- package/lib/attachment-note.ts +48 -0
- package/lib/claude-adapter.ts +219 -29
- package/lib/format.ts +32 -0
- package/lib/types.ts +314 -6
- package/package.json +21 -31
- package/server/CLAUDE.md +3 -0
- package/server/agent.ts +25 -118
- package/server/api.ts +593 -0
- package/server/applets.ts +396 -0
- package/server/build-applet.ts +580 -0
- package/server/cc-session.ts +611 -0
- package/server/cli-colors.ts +17 -0
- package/server/cli-ui.ts +52 -0
- package/server/cli.ts +970 -72
- package/server/control.ts +166 -19
- package/server/debug.ts +10 -0
- package/server/events.ts +24 -0
- package/server/functions-worker.ts +18 -2
- package/server/functions.ts +59 -12
- package/server/icon.ts +13 -0
- package/server/layout.ts +25 -3
- package/server/mcp.ts +125 -0
- package/server/moi-scaffold.ts +85 -0
- package/server/openclaw-session.ts +41 -10
- package/server/openclaw.ts +22 -0
- package/server/preview.ts +70 -0
- package/server/registry.ts +32 -2
- package/server/scratchpad-executor.ts +380 -0
- package/server/scratchpad-relay.ts +45 -0
- package/server/scratchpad.ts +171 -0
- package/server/skill-version.ts +146 -0
- package/server/skills-template.ts +6 -1
- package/server/state.ts +22 -36
- package/server/static.ts +23 -0
- package/server/status.ts +94 -0
- package/server/thread-config.ts +125 -0
- package/server/uploads.ts +0 -0
- package/server/vendor.ts +63 -0
- package/server/views.ts +0 -0
- package/server/web.ts +113 -223
- package/server/widgets.ts +52 -142
- package/server/workspace-config.ts +37 -0
- package/server/workspace-env.ts +407 -0
- package/server/workspace-init.ts +66 -0
- package/workspace/.claude/skills/moi-workspace/DESIGN.md +109 -0
- package/workspace/.claude/skills/moi-workspace/SCRATCHPAD.md +57 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +252 -0
- package/workspace/.claude/skills/moi-workspace/VIEW-DESIGN.md +22 -0
- package/client/hooks/useWidget.ts +0 -72
- package/client/hooks/useWidgetList.ts +0 -30
- package/client/lib/ws.ts +0 -129
- package/client/store/chat.tsx +0 -162
- package/server/build-widget.ts +0 -343
- package/workspace/.claude/skills/widgets/DESIGN.md +0 -630
- package/workspace/.claude/skills/widgets/SKILL.md +0 -176
|
@@ -1,33 +1,134 @@
|
|
|
1
|
-
import { useRef } from 'react'
|
|
1
|
+
import { useRef, useState } from 'react'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
IconArrowUp,
|
|
5
|
+
IconFile,
|
|
6
|
+
IconLoader2,
|
|
7
|
+
IconPaperclip,
|
|
8
|
+
IconPlayerStop,
|
|
9
|
+
IconX
|
|
10
|
+
} from '@tabler/icons-react'
|
|
4
11
|
|
|
12
|
+
import { cn } from '@/client/lib/cn'
|
|
13
|
+
import { useWorkspaceId } from '@/client/lib/WorkspaceContext'
|
|
14
|
+
import { uploadFiles } from '@/client/lib/uploads'
|
|
15
|
+
import { type ChatAttachment, draftKey, liveStore, useLive } from '@/client/store/live'
|
|
16
|
+
|
|
17
|
+
import { ModelPicker } from './ModelPicker'
|
|
5
18
|
import { Button } from './ui/button'
|
|
6
19
|
|
|
7
20
|
type ChatInputProps = {
|
|
8
|
-
|
|
9
|
-
onChange: (value: string) => void
|
|
10
|
-
onSend: () => void
|
|
21
|
+
onSend: (text: string) => void
|
|
11
22
|
onStop: () => void
|
|
12
23
|
processing: boolean
|
|
13
24
|
}
|
|
14
25
|
|
|
15
|
-
|
|
26
|
+
// The composer owns the draft: it reads/writes the per-thread draft in the live
|
|
27
|
+
// store directly, so a keystroke re-renders only this component — not the chat
|
|
28
|
+
// panel, message list, or surrounding workspace. The draft is keyed by the
|
|
29
|
+
// active thread, so switching threads swaps the unsent text with you. Attachments
|
|
30
|
+
// (drag/drop, paste, attach button) are tracked the same way and cleared on send.
|
|
31
|
+
export function ChatInput({ onSend, onStop, processing }: ChatInputProps) {
|
|
16
32
|
const ref = useRef<HTMLTextAreaElement>(null)
|
|
33
|
+
const fileRef = useRef<HTMLInputElement>(null)
|
|
34
|
+
const workspaceId = useWorkspaceId()
|
|
35
|
+
const sessionId = useLive(s => s.activeByWorkspace[workspaceId] ?? null)
|
|
36
|
+
const value = useLive(s => s.drafts[draftKey(workspaceId, sessionId)] ?? '')
|
|
37
|
+
const attachments = useLive(s => s.attachments[draftKey(workspaceId, sessionId)] ?? EMPTY)
|
|
38
|
+
const [dragOver, setDragOver] = useState(false)
|
|
39
|
+
|
|
40
|
+
const uploading = attachments.some(a => a.status === 'uploading')
|
|
41
|
+
const hasReady = attachments.some(a => a.status === 'ready')
|
|
42
|
+
const canSend = (value.trim().length > 0 || hasReady) && !uploading
|
|
43
|
+
|
|
44
|
+
const onChange = (next: string) => liveStore.getState().setDraft(workspaceId, sessionId, next)
|
|
45
|
+
|
|
46
|
+
// Upload each picked file immediately, tracking its in-flight status so the
|
|
47
|
+
// thumbnail row can show a spinner / error per file.
|
|
48
|
+
const addFiles = (files: File[]) => {
|
|
49
|
+
if (files.length === 0) return
|
|
50
|
+
const store = liveStore.getState()
|
|
51
|
+
const items: ChatAttachment[] = files.map(f => ({
|
|
52
|
+
localId: crypto.randomUUID(),
|
|
53
|
+
name: f.name || 'file',
|
|
54
|
+
mediaType: f.type || 'application/octet-stream',
|
|
55
|
+
previewUrl: f.type.startsWith('image/') ? URL.createObjectURL(f) : undefined,
|
|
56
|
+
status: 'uploading'
|
|
57
|
+
}))
|
|
58
|
+
store.addAttachments(workspaceId, sessionId, items)
|
|
59
|
+
items.forEach((item, i) => {
|
|
60
|
+
uploadFiles(workspaceId, [files[i]])
|
|
61
|
+
.then(([info]) =>
|
|
62
|
+
liveStore.getState().updateAttachment(workspaceId, sessionId, item.localId, {
|
|
63
|
+
status: 'ready',
|
|
64
|
+
upload: info,
|
|
65
|
+
mediaType: info.mediaType
|
|
66
|
+
})
|
|
67
|
+
)
|
|
68
|
+
.catch((err: unknown) =>
|
|
69
|
+
liveStore.getState().updateAttachment(workspaceId, sessionId, item.localId, {
|
|
70
|
+
status: 'error',
|
|
71
|
+
error: err instanceof Error ? err.message : 'Upload failed'
|
|
72
|
+
})
|
|
73
|
+
)
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const send = () => {
|
|
78
|
+
if (!canSend) return
|
|
79
|
+
onSend(value)
|
|
80
|
+
// Clear under the current key. On a new chat `sessionId` is still null, so
|
|
81
|
+
// this clears the `'new'` draft; `send` then mints the real id and the input
|
|
82
|
+
// re-renders empty under the new key. (Attachments are cleared by `send`.)
|
|
83
|
+
liveStore.getState().setDraft(workspaceId, sessionId, '')
|
|
84
|
+
}
|
|
17
85
|
|
|
18
86
|
return (
|
|
19
87
|
<form
|
|
20
88
|
onSubmit={e => {
|
|
21
89
|
e.preventDefault()
|
|
22
|
-
|
|
90
|
+
send()
|
|
23
91
|
}}
|
|
24
92
|
onMouseDown={e => {
|
|
25
93
|
if (e.target instanceof HTMLElement && e.target.closest('button')) return
|
|
26
94
|
e.preventDefault()
|
|
27
95
|
ref.current?.focus()
|
|
28
96
|
}}
|
|
29
|
-
|
|
97
|
+
onDragOver={e => {
|
|
98
|
+
if (!e.dataTransfer.types.includes('Files')) return
|
|
99
|
+
e.preventDefault()
|
|
100
|
+
setDragOver(true)
|
|
101
|
+
}}
|
|
102
|
+
onDragLeave={e => {
|
|
103
|
+
// Ignore leaves into child elements — only reset when leaving the form.
|
|
104
|
+
if (e.currentTarget.contains(e.relatedTarget as Node | null)) return
|
|
105
|
+
setDragOver(false)
|
|
106
|
+
}}
|
|
107
|
+
onDrop={e => {
|
|
108
|
+
if (!e.dataTransfer.types.includes('Files')) return
|
|
109
|
+
e.preventDefault()
|
|
110
|
+
setDragOver(false)
|
|
111
|
+
addFiles(Array.from(e.dataTransfer.files))
|
|
112
|
+
}}
|
|
113
|
+
className={cn(
|
|
114
|
+
'flex w-full cursor-text flex-col gap-1 rounded-lg bg-white p-2 shadow-xs transition-[color,box-shadow] outline-none focus-within:shadow-sm',
|
|
115
|
+
dragOver && 'ring-2 ring-ring/60'
|
|
116
|
+
)}
|
|
30
117
|
>
|
|
118
|
+
{attachments.length > 0 && (
|
|
119
|
+
<div className="flex flex-wrap gap-2 px-1 pt-1 pb-0.5">
|
|
120
|
+
{attachments.map(a => (
|
|
121
|
+
<AttachmentChip
|
|
122
|
+
key={a.localId}
|
|
123
|
+
attachment={a}
|
|
124
|
+
onRemove={() =>
|
|
125
|
+
liveStore.getState().removeAttachment(workspaceId, sessionId, a.localId)
|
|
126
|
+
}
|
|
127
|
+
/>
|
|
128
|
+
))}
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
131
|
+
|
|
31
132
|
<textarea
|
|
32
133
|
ref={ref}
|
|
33
134
|
id="chat-input"
|
|
@@ -37,22 +138,48 @@ export function ChatInput({ value, onChange, onSend, onStop, processing }: ChatI
|
|
|
37
138
|
onKeyDown={e => {
|
|
38
139
|
if (e.key === 'Enter' && !e.shiftKey) {
|
|
39
140
|
e.preventDefault()
|
|
40
|
-
|
|
141
|
+
send()
|
|
41
142
|
}
|
|
42
143
|
}}
|
|
43
|
-
|
|
44
|
-
|
|
144
|
+
onPaste={e => {
|
|
145
|
+
const files = Array.from(e.clipboardData?.files ?? [])
|
|
146
|
+
if (files.length === 0) return
|
|
147
|
+
e.preventDefault()
|
|
148
|
+
addFiles(files)
|
|
149
|
+
}}
|
|
150
|
+
placeholder={processing ? 'Queue a follow-up...' : 'Ask anything...'}
|
|
45
151
|
autoFocus
|
|
46
152
|
rows={1}
|
|
47
|
-
className="field-sizing-content
|
|
153
|
+
className="field-sizing-content max-h-40 w-full resize-none bg-transparent px-2 py-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground disabled:opacity-50"
|
|
48
154
|
/>
|
|
49
|
-
<div className="flex justify-end">
|
|
155
|
+
<div className="flex items-center justify-end gap-1.5">
|
|
156
|
+
<input
|
|
157
|
+
ref={fileRef}
|
|
158
|
+
type="file"
|
|
159
|
+
multiple
|
|
160
|
+
hidden
|
|
161
|
+
onChange={e => {
|
|
162
|
+
addFiles(Array.from(e.target.files ?? []))
|
|
163
|
+
e.target.value = ''
|
|
164
|
+
}}
|
|
165
|
+
/>
|
|
166
|
+
<Button
|
|
167
|
+
type="button"
|
|
168
|
+
variant="ghost"
|
|
169
|
+
size="icon"
|
|
170
|
+
className="mr-auto"
|
|
171
|
+
onClick={() => fileRef.current?.click()}
|
|
172
|
+
aria-label="Attach files"
|
|
173
|
+
>
|
|
174
|
+
<IconPaperclip stroke={1.5} />
|
|
175
|
+
</Button>
|
|
176
|
+
<ModelPicker />
|
|
50
177
|
{processing ? (
|
|
51
178
|
<Button type="button" size="icon" onClick={onStop} aria-label="Stop agent">
|
|
52
179
|
<IconPlayerStop stroke={1.5} />
|
|
53
180
|
</Button>
|
|
54
181
|
) : (
|
|
55
|
-
<Button type="submit" size="icon" disabled={!
|
|
182
|
+
<Button type="submit" size="icon" disabled={!canSend} aria-label="Send message">
|
|
56
183
|
<IconArrowUp stroke={1.5} />
|
|
57
184
|
</Button>
|
|
58
185
|
)}
|
|
@@ -60,3 +187,57 @@ export function ChatInput({ value, onChange, onSend, onStop, processing }: ChatI
|
|
|
60
187
|
</form>
|
|
61
188
|
)
|
|
62
189
|
}
|
|
190
|
+
|
|
191
|
+
const EMPTY: ChatAttachment[] = []
|
|
192
|
+
|
|
193
|
+
type AttachmentChipProps = {
|
|
194
|
+
attachment: ChatAttachment
|
|
195
|
+
onRemove: () => void
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// A composer attachment preview: an image thumbnail or a labelled file chip,
|
|
199
|
+
// with an upload spinner / error overlay and a remove button.
|
|
200
|
+
function AttachmentChip({ attachment, onRemove }: AttachmentChipProps) {
|
|
201
|
+
const { name, previewUrl, status, error } = attachment
|
|
202
|
+
const isImage = !!previewUrl
|
|
203
|
+
|
|
204
|
+
return (
|
|
205
|
+
<div
|
|
206
|
+
className={cn(
|
|
207
|
+
'group relative flex items-center gap-2 overflow-hidden rounded-md border border-black/10 bg-black/[0.03]',
|
|
208
|
+
isImage ? 'size-14' : 'h-10 max-w-52 pr-2 pl-2',
|
|
209
|
+
status === 'error' && 'border-red-300'
|
|
210
|
+
)}
|
|
211
|
+
title={error ?? name}
|
|
212
|
+
>
|
|
213
|
+
{isImage ? (
|
|
214
|
+
<img src={previewUrl} alt={name} className="size-full object-cover" />
|
|
215
|
+
) : (
|
|
216
|
+
<>
|
|
217
|
+
<IconFile size={16} stroke={1.5} className="shrink-0 text-muted-foreground" />
|
|
218
|
+
<span className="truncate text-xs text-foreground/80">{name}</span>
|
|
219
|
+
</>
|
|
220
|
+
)}
|
|
221
|
+
|
|
222
|
+
{status === 'uploading' && (
|
|
223
|
+
<div className="absolute inset-0 flex items-center justify-center bg-white/60">
|
|
224
|
+
<IconLoader2 size={16} stroke={1.5} className="animate-spin text-muted-foreground" />
|
|
225
|
+
</div>
|
|
226
|
+
)}
|
|
227
|
+
{status === 'error' && (
|
|
228
|
+
<div className="absolute inset-0 flex items-center justify-center bg-red-50/80 text-[10px] text-red-700">
|
|
229
|
+
Failed
|
|
230
|
+
</div>
|
|
231
|
+
)}
|
|
232
|
+
|
|
233
|
+
<button
|
|
234
|
+
type="button"
|
|
235
|
+
onClick={onRemove}
|
|
236
|
+
aria-label={`Remove ${name}`}
|
|
237
|
+
className="absolute top-0.5 right-0.5 flex size-4 items-center justify-center rounded-full bg-black/60 text-white opacity-0 transition-opacity group-hover:opacity-100"
|
|
238
|
+
>
|
|
239
|
+
<IconX size={10} stroke={2} />
|
|
240
|
+
</button>
|
|
241
|
+
</div>
|
|
242
|
+
)
|
|
243
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback, useMemo } from 'react'
|
|
2
2
|
|
|
3
|
-
import { IconChevronsRight, IconSelector, IconX } from '@tabler/icons-react'
|
|
3
|
+
import { IconChevronDown, IconChevronsRight, IconSelector, IconX } from '@tabler/icons-react'
|
|
4
4
|
|
|
5
5
|
import { useScrollFade } from '@/client/hooks/useScrollFade'
|
|
6
|
+
import { useStickToBottom } from '@/client/hooks/useStickToBottom'
|
|
6
7
|
import { cn } from '@/client/lib/cn'
|
|
7
8
|
import { groupTurns } from '@/client/lib/group-turns'
|
|
8
|
-
import type { ViewState } from '@/lib/types'
|
|
9
|
+
import type { ChatDisplay, Turn, ViewState } from '@/lib/types'
|
|
9
10
|
|
|
10
11
|
import { ChatInput } from './ChatInput'
|
|
11
12
|
import { ThreadSelector } from './ThreadSelector'
|
|
@@ -19,8 +20,6 @@ import {
|
|
|
19
20
|
DropdownMenuTrigger
|
|
20
21
|
} from './ui/dropdown-menu'
|
|
21
22
|
|
|
22
|
-
export type ChatMode = 'sidebar' | 'floating'
|
|
23
|
-
|
|
24
23
|
type ChatModeIconProps = {
|
|
25
24
|
className?: string
|
|
26
25
|
}
|
|
@@ -59,40 +58,67 @@ function ChatModeIconFloating({ className }: ChatModeIconProps) {
|
|
|
59
58
|
)
|
|
60
59
|
}
|
|
61
60
|
|
|
61
|
+
function ChatModeIconFullscreen({ className }: ChatModeIconProps) {
|
|
62
|
+
return (
|
|
63
|
+
<svg
|
|
64
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
65
|
+
width="24"
|
|
66
|
+
height="24"
|
|
67
|
+
viewBox="0 0 24 24"
|
|
68
|
+
fill="none"
|
|
69
|
+
strokeWidth="1.5"
|
|
70
|
+
className={className}
|
|
71
|
+
>
|
|
72
|
+
<rect x="1.75" y="3.75" width="20.5" height="16.5" rx="2.25" stroke="currentColor" />
|
|
73
|
+
<rect x="4.5" y="6.5" width="15" height="11" rx="1" fill="currentColor" />
|
|
74
|
+
</svg>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
62
78
|
type ChatPanelProps = {
|
|
63
79
|
view: ViewState
|
|
64
|
-
|
|
65
|
-
|
|
80
|
+
// The live streaming preview as a synthetic assistant turn (or null). Merged
|
|
81
|
+
// into the transcript through the same groupTurns pipeline so a thinking-only
|
|
82
|
+
// preview folds into the current tool group. See client/lib/preview-turn.ts.
|
|
83
|
+
previewTurn?: Turn | null
|
|
84
|
+
// Active thread id — used only as the scroll reset key (jump to bottom on
|
|
85
|
+
// thread switch).
|
|
86
|
+
sessionId?: string | null
|
|
66
87
|
processing: boolean
|
|
67
88
|
error?: string | null
|
|
68
89
|
onDismissError?: () => void
|
|
69
|
-
send: () => void
|
|
90
|
+
send: (text: string) => void
|
|
70
91
|
stop: () => void
|
|
71
|
-
|
|
92
|
+
// How the chat is shown right now (position, or fullscreen). The mode switch
|
|
93
|
+
// and collapse/close affordances key off this; fullscreen shows neither.
|
|
94
|
+
chatMode: ChatDisplay
|
|
95
|
+
// Constrain the scrollable history and the composer to a centered max-width
|
|
96
|
+
// column (var --chat-max-container) while the header still spans full width.
|
|
97
|
+
// Always on for now; will be toggled per layout mode later.
|
|
98
|
+
contained?: boolean
|
|
72
99
|
onSwitchThread: (sessionId: string | null) => void
|
|
73
|
-
|
|
100
|
+
// The chat display picker — sidebar / floating (position) and fullscreen (the
|
|
101
|
+
// transient view). The parent routes each to the right state.
|
|
102
|
+
onModeChange?: (mode: ChatDisplay) => void
|
|
74
103
|
onCollapse?: () => void
|
|
75
104
|
onClose?: () => void
|
|
76
|
-
// Rendered at the start of the chat header. Solo mode passes the sidebar
|
|
77
|
-
// toggle here since there's no separate workspace header beside the chat.
|
|
78
|
-
leading?: ReactNode
|
|
79
105
|
}
|
|
80
106
|
|
|
81
107
|
export function ChatPanel({
|
|
82
108
|
view,
|
|
83
|
-
|
|
84
|
-
|
|
109
|
+
previewTurn,
|
|
110
|
+
sessionId,
|
|
85
111
|
processing,
|
|
86
112
|
error,
|
|
87
113
|
onDismissError,
|
|
88
114
|
send,
|
|
89
115
|
stop,
|
|
90
116
|
chatMode,
|
|
117
|
+
contained = true,
|
|
91
118
|
onSwitchThread,
|
|
92
119
|
onModeChange,
|
|
93
120
|
onCollapse,
|
|
94
|
-
onClose
|
|
95
|
-
leading
|
|
121
|
+
onClose
|
|
96
122
|
}: ChatPanelProps) {
|
|
97
123
|
const { ref: scrollRef, showTopFade, showBottomFade } = useScrollFade()
|
|
98
124
|
const turns = view.turns
|
|
@@ -100,20 +126,37 @@ export function ChatPanel({
|
|
|
100
126
|
// synthetic turn so OpenAI Codex–style traces (which serialize one
|
|
101
127
|
// assistant message per agent step) don't render with the wider
|
|
102
128
|
// inter-turn gap between every tool call. See `dev/turn-spacing.md`.
|
|
103
|
-
|
|
129
|
+
// The live preview turn is appended before grouping, so a thinking-only
|
|
130
|
+
// preview merges into the trailing tool group exactly like its finalized form.
|
|
131
|
+
const groupedTurns = useMemo(
|
|
132
|
+
() => groupTurns(previewTurn ? [...turns, previewTurn] : turns),
|
|
133
|
+
[turns, previewTurn]
|
|
134
|
+
)
|
|
104
135
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
el?.scrollTo({ top: el.scrollHeight, behavior: 'instant' })
|
|
108
|
-
}, [scrollRef, turns])
|
|
136
|
+
// Stick to the bottom while pinned; respect scroll-up; jump on thread switch.
|
|
137
|
+
const { atBottom, scrollToBottom } = useStickToBottom(scrollRef, sessionId)
|
|
109
138
|
|
|
110
|
-
|
|
139
|
+
// Sending always returns the user to the bottom, even if they'd scrolled up —
|
|
140
|
+
// they expect to see their message and the reply.
|
|
141
|
+
const handleSend = useCallback(
|
|
142
|
+
(text: string) => {
|
|
143
|
+
send(text)
|
|
144
|
+
scrollToBottom()
|
|
145
|
+
},
|
|
146
|
+
[send, scrollToBottom]
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
const TriggerIcon =
|
|
150
|
+
chatMode === 'sidebar'
|
|
151
|
+
? ChatModeIconSidebar
|
|
152
|
+
: chatMode === 'floating'
|
|
153
|
+
? ChatModeIconFloating
|
|
154
|
+
: ChatModeIconFullscreen
|
|
111
155
|
|
|
112
156
|
return (
|
|
113
|
-
<div className="flex h-full flex-col">
|
|
114
|
-
<header className="flex items-center justify-between pb-2 pl-
|
|
157
|
+
<div className="flex h-full flex-col pt-2 pb-4">
|
|
158
|
+
<header className="flex items-center justify-between pr-2 pb-2 pl-5">
|
|
115
159
|
<div className="flex min-w-0 items-center gap-2.5">
|
|
116
|
-
{leading}
|
|
117
160
|
<ThreadSelector onSwitch={onSwitchThread} />
|
|
118
161
|
</div>
|
|
119
162
|
<div className="flex items-center gap-0.5">
|
|
@@ -122,7 +165,7 @@ export function ChatPanel({
|
|
|
122
165
|
<DropdownMenuTrigger
|
|
123
166
|
render={
|
|
124
167
|
<Button
|
|
125
|
-
className="
|
|
168
|
+
className="gap-0 pr-1! pl-2!"
|
|
126
169
|
variant="ghost"
|
|
127
170
|
aria-label="Switch chat mode"
|
|
128
171
|
>
|
|
@@ -143,6 +186,10 @@ export function ChatPanel({
|
|
|
143
186
|
<ChatModeIconFloating />
|
|
144
187
|
Floating
|
|
145
188
|
</DropdownMenuRadioItem>
|
|
189
|
+
<DropdownMenuRadioItem value="fullscreen" closeOnClick>
|
|
190
|
+
<ChatModeIconFullscreen />
|
|
191
|
+
Fullscreen
|
|
192
|
+
</DropdownMenuRadioItem>
|
|
146
193
|
</DropdownMenuRadioGroup>
|
|
147
194
|
</DropdownMenuContent>
|
|
148
195
|
</DropdownMenu>
|
|
@@ -150,7 +197,7 @@ export function ChatPanel({
|
|
|
150
197
|
{chatMode === 'sidebar' && onCollapse && (
|
|
151
198
|
<Button variant="ghost" size="icon" onClick={onCollapse} aria-label="Collapse chat">
|
|
152
199
|
{/* Tabler icon with double chevrons has a really weird optical size, hence the adjustments */}
|
|
153
|
-
<IconChevronsRight className="text-muted-foreground
|
|
200
|
+
<IconChevronsRight className="size-6! text-muted-foreground" stroke={1.5} />
|
|
154
201
|
</Button>
|
|
155
202
|
)}
|
|
156
203
|
{chatMode === 'floating' && onClose && (
|
|
@@ -161,23 +208,51 @@ export function ChatPanel({
|
|
|
161
208
|
</div>
|
|
162
209
|
</header>
|
|
163
210
|
|
|
164
|
-
<div
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
211
|
+
<div className="relative flex min-h-0 flex-1 flex-col">
|
|
212
|
+
<div
|
|
213
|
+
ref={scrollRef}
|
|
214
|
+
className={cn(
|
|
215
|
+
'flex scrollbar-thin flex-1 flex-col overflow-y-auto overscroll-contain px-5 pt-4 pb-12',
|
|
216
|
+
showTopFade && showBottomFade && 'mask-fade-y',
|
|
217
|
+
showTopFade && !showBottomFade && 'mask-fade-top',
|
|
218
|
+
!showTopFade && showBottomFade && 'mask-fade-bottom'
|
|
219
|
+
)}
|
|
220
|
+
>
|
|
221
|
+
<div
|
|
222
|
+
className={cn(
|
|
223
|
+
'flex flex-1 flex-col gap-6',
|
|
224
|
+
contained && 'mx-auto w-full max-w-[var(--chat-max-container)]'
|
|
225
|
+
)}
|
|
226
|
+
>
|
|
227
|
+
{turns.length === 0 && !processing && <EmptyState />}
|
|
228
|
+
{groupedTurns.map((turn, i) => (
|
|
229
|
+
<TurnView
|
|
230
|
+
key={turn.id}
|
|
231
|
+
turn={turn}
|
|
232
|
+
processing={processing && i === groupedTurns.length - 1}
|
|
233
|
+
/>
|
|
234
|
+
))}
|
|
235
|
+
{/* Pulsing dots only before the first token — once the preview has
|
|
236
|
+
visible content it renders as a (possibly merged) grouped turn. */}
|
|
237
|
+
{processing && !previewTurn && <ThinkingIndicator />}
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
{/* Jump to latest — shown only when scrolled up, so following the tail
|
|
242
|
+
never yanks the user while they read history. */}
|
|
243
|
+
{!atBottom && turns.length > 0 && (
|
|
244
|
+
<button
|
|
245
|
+
type="button"
|
|
246
|
+
onClick={() => scrollToBottom('smooth')}
|
|
247
|
+
aria-label="Jump to latest"
|
|
248
|
+
className="absolute bottom-3 left-1/2 flex size-8 -translate-x-1/2 animate-in items-center justify-center rounded-full border border-border bg-background text-muted-foreground shadow-md transition-colors duration-150 fade-in slide-in-from-bottom-1 hover:text-foreground"
|
|
249
|
+
>
|
|
250
|
+
<IconChevronDown size={18} stroke={1.5} />
|
|
251
|
+
</button>
|
|
171
252
|
)}
|
|
172
|
-
>
|
|
173
|
-
{turns.length === 0 && !processing && <EmptyState />}
|
|
174
|
-
{groupedTurns.map(turn => (
|
|
175
|
-
<TurnView key={turn.id} turn={turn} />
|
|
176
|
-
))}
|
|
177
|
-
{processing && <ThinkingIndicator />}
|
|
178
253
|
</div>
|
|
179
254
|
|
|
180
|
-
<div>
|
|
255
|
+
<div className={cn(contained && 'mx-auto w-full max-w-[var(--chat-max-container)] px-3')}>
|
|
181
256
|
{error && (
|
|
182
257
|
<div className="mb-2 flex items-start gap-2 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-800">
|
|
183
258
|
<span className="flex-1 break-words">{error}</span>
|
|
@@ -193,13 +268,7 @@ export function ChatPanel({
|
|
|
193
268
|
)}
|
|
194
269
|
</div>
|
|
195
270
|
)}
|
|
196
|
-
<ChatInput
|
|
197
|
-
value={input}
|
|
198
|
-
onChange={setInput}
|
|
199
|
-
onSend={send}
|
|
200
|
-
onStop={stop}
|
|
201
|
-
processing={processing}
|
|
202
|
-
/>
|
|
271
|
+
<ChatInput onSend={handleSend} onStop={stop} processing={processing} />
|
|
203
272
|
</div>
|
|
204
273
|
</div>
|
|
205
274
|
)
|
|
@@ -24,7 +24,7 @@ export function ChatPopup({ defaultOpen = false, container, children }: ChatPopu
|
|
|
24
24
|
<Popover open={open} onOpenChange={o => setOpen(o)}>
|
|
25
25
|
<PopoverTrigger
|
|
26
26
|
render={
|
|
27
|
-
<div className="fixed
|
|
27
|
+
<div className="fixed right-4 bottom-4 sm:right-6 sm:bottom-6">
|
|
28
28
|
<motion.div
|
|
29
29
|
variants={{
|
|
30
30
|
from: { opacity: 0, scale: 0.8, filter: 'blur(4px)' },
|
|
@@ -49,7 +49,7 @@ export function ChatPopup({ defaultOpen = false, container, children }: ChatPopu
|
|
|
49
49
|
sideOffset={-48}
|
|
50
50
|
align="end"
|
|
51
51
|
alignOffset={-8}
|
|
52
|
-
className="flex h-[calc(100vh-2rem)] w-[min(440px,calc(100vw-1rem))] flex-col gap-0 rounded-3xl p-
|
|
52
|
+
className="flex h-[calc(100vh-2rem)] w-[min(440px,calc(100vw-1rem))] flex-col gap-0 rounded-3xl p-0 sm:h-[calc(100vh-8rem)] sm:w-[min(440px,calc(100vw-2rem))] sm:p-1"
|
|
53
53
|
keepMounted
|
|
54
54
|
container={container}
|
|
55
55
|
>
|
|
@@ -52,7 +52,7 @@ export function CustomizePanel({ ref }: CustomizePanelProps) {
|
|
|
52
52
|
<div className="flex flex-col gap-6">
|
|
53
53
|
{/* Font picker */}
|
|
54
54
|
<div className="flex flex-col gap-2">
|
|
55
|
-
<p className="text-
|
|
55
|
+
<p className="text-xs font-medium text-muted-foreground">Font</p>
|
|
56
56
|
<div className="grid grid-cols-3 gap-2">
|
|
57
57
|
{FONT_OPTIONS.map(([key, config]) => (
|
|
58
58
|
<button
|
|
@@ -62,13 +62,13 @@ export function CustomizePanel({ ref }: CustomizePanelProps) {
|
|
|
62
62
|
className={cn(
|
|
63
63
|
'flex flex-col items-start rounded-md px-3 py-2 text-left transition-colors',
|
|
64
64
|
key === currentFont
|
|
65
|
-
? '
|
|
66
|
-
: 'hover:bg-muted
|
|
65
|
+
? 'bg-primary/5 ring-2 ring-primary'
|
|
66
|
+
: 'border-transparent hover:bg-muted'
|
|
67
67
|
)}
|
|
68
68
|
style={{ fontFamily: config.sans }}
|
|
69
69
|
>
|
|
70
70
|
<span className="text-sm font-medium">{config.label}</span>
|
|
71
|
-
<span className="text-muted-foreground
|
|
71
|
+
<span className="text-xs text-muted-foreground">{config.feel}</span>
|
|
72
72
|
</button>
|
|
73
73
|
))}
|
|
74
74
|
</div>
|
|
@@ -76,7 +76,7 @@ export function CustomizePanel({ ref }: CustomizePanelProps) {
|
|
|
76
76
|
|
|
77
77
|
{/* Color palette */}
|
|
78
78
|
<div className="flex flex-col gap-2">
|
|
79
|
-
<p className="text-
|
|
79
|
+
<p className="text-xs font-medium text-muted-foreground">Colors</p>
|
|
80
80
|
<div className="grid grid-cols-3 gap-2">
|
|
81
81
|
{COLOR_OPTIONS.map(([key, preset]) => {
|
|
82
82
|
const active = presetMatches(preset, currentBg, currentFg)
|
|
@@ -90,8 +90,8 @@ export function CustomizePanel({ ref }: CustomizePanelProps) {
|
|
|
90
90
|
className={cn(
|
|
91
91
|
'flex items-center gap-2 rounded-md border px-3 py-2 transition-colors',
|
|
92
92
|
active
|
|
93
|
-
? '
|
|
94
|
-
: 'hover:bg-muted
|
|
93
|
+
? 'bg-primary/5 ring-2 ring-primary'
|
|
94
|
+
: 'border-transparent hover:bg-muted'
|
|
95
95
|
)}
|
|
96
96
|
>
|
|
97
97
|
<span
|
|
@@ -99,7 +99,7 @@ export function CustomizePanel({ ref }: CustomizePanelProps) {
|
|
|
99
99
|
style={{ backgroundColor: preset.background ?? 'oklch(1 0 0)' }}
|
|
100
100
|
>
|
|
101
101
|
<span
|
|
102
|
-
className="flex size-full items-center justify-center text-[9px] font-bold
|
|
102
|
+
className="flex size-full items-center justify-center text-[9px] leading-none font-bold"
|
|
103
103
|
style={{ color: preset.foreground ?? 'oklch(0.145 0 0)' }}
|
|
104
104
|
>
|
|
105
105
|
A
|
|
@@ -53,7 +53,7 @@ export function HiddenPanel({ items, renderItem, onRestore, ref }: HiddenPanelPr
|
|
|
53
53
|
return (
|
|
54
54
|
<BottomPanel ref={ref} title="Hidden">
|
|
55
55
|
{/* gap-2 + grid-cols-4 + [grid-auto-rows:160px] matches RGL's margin/rowHeight exactly */}
|
|
56
|
-
<div className="grid grid-cols-4 gap-2
|
|
56
|
+
<div className="grid [grid-auto-rows:160px] grid-cols-4 gap-2">
|
|
57
57
|
<AnimatePresence>
|
|
58
58
|
{layout.map(item => (
|
|
59
59
|
<motion.div
|
|
@@ -7,7 +7,7 @@ export function HomePage() {
|
|
|
7
7
|
<SidebarLayout>
|
|
8
8
|
<PanelHeader>
|
|
9
9
|
<SidebarToggle />
|
|
10
|
-
<span className="text-
|
|
10
|
+
<span className="text-sm font-medium text-foreground">Home</span>
|
|
11
11
|
</PanelHeader>
|
|
12
12
|
<div className="min-h-0 flex-1 overflow-y-auto">
|
|
13
13
|
<WorkspacesPage />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// MCP icon — supplied by design (not a Tabler glyph). Stroke inherits the
|
|
2
|
+
// current text color; size via `className`. Shared by the workspace-header MCP
|
|
3
|
+
// menu and the tool-call timeline's fallback node for unknown servers.
|
|
4
|
+
export function IconMcp({ className }: { className?: string }) {
|
|
5
|
+
return (
|
|
6
|
+
<svg
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
viewBox="0 0 24 24"
|
|
9
|
+
fill="none"
|
|
10
|
+
stroke="currentColor"
|
|
11
|
+
strokeWidth={1.5}
|
|
12
|
+
strokeLinecap="round"
|
|
13
|
+
strokeLinejoin="round"
|
|
14
|
+
className={className}
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
>
|
|
17
|
+
<path d="M3.49994 11.7501L11.6717 3.57855C12.7762 2.47398 14.5672 2.47398 15.6717 3.57855C16.7762 4.68312 16.7762 6.47398 15.6717 7.57855M15.6717 7.57855L9.49994 13.7501M15.6717 7.57855C16.7762 6.47398 18.5672 6.47398 19.6717 7.57855C20.7762 8.68312 20.7762 10.474 19.6717 11.5785L12.7072 18.543C12.3167 18.9335 12.3167 19.5667 12.7072 19.9572L13.9999 21.2499" />
|
|
18
|
+
<path d="M17.4999 9.74921L11.3282 15.921C10.2238 17.0255 8.43275 17.0255 7.32825 15.921C6.22376 14.8164 6.22376 13.0255 7.32825 11.921L13.4999 5.74939" />
|
|
19
|
+
</svg>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
@@ -12,8 +12,8 @@ const rehypePlugins = [rehypeHighlight]
|
|
|
12
12
|
const components = {
|
|
13
13
|
pre({ children }: ComponentProps<'pre'>) {
|
|
14
14
|
return (
|
|
15
|
-
<div className="not-prose
|
|
16
|
-
<pre className="
|
|
15
|
+
<div className="not-prose my-2 rounded-md border border-border bg-muted px-3 py-2.5">
|
|
16
|
+
<pre className="max-h-[300px] overflow-auto font-mono text-xs leading-relaxed whitespace-pre text-foreground/80">
|
|
17
17
|
{children}
|
|
18
18
|
</pre>
|
|
19
19
|
</div>
|