@temmo/cli 0.0.0 → 0.19.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/.claude-plugin/marketplace.json +14 -0
- package/.claude-plugin/plugin.json +16 -0
- package/.codex-plugin/plugin.json +30 -0
- package/.cursor-plugin/plugin.json +22 -0
- package/.mcp.json +18 -0
- package/LICENSE +202 -0
- package/README.md +82 -2
- package/THIRD_PARTY_NOTICES +32 -0
- package/commands/afk.md +17 -0
- package/deploy/build-ui.mjs +65 -0
- package/deploy/claude/README.md +16 -0
- package/deploy/claude/auto-mode.json +31 -0
- package/deploy/postgres/compose.yaml +26 -0
- package/deploy/temmo-runner.service +24 -0
- package/deploy/verify-ui.mjs +15 -0
- package/harness-core/README.md +27 -0
- package/harness-core/bin/harness.mjs +17 -0
- package/harness-core/package.json +10 -0
- package/harness-core/stage.mjs +108 -0
- package/harness-core/stages/commit.md +7 -0
- package/harness-core/stages/pr.md +7 -0
- package/harness-core/stages/push.md +7 -0
- package/hooks/codex-hooks.json +14 -0
- package/hooks/cursor-hooks.json +17 -0
- package/hooks/hooks.json +27 -0
- package/lib/acp/permission.js +72 -0
- package/lib/acp/sessionConfig.js +109 -0
- package/lib/activity.js +244 -0
- package/lib/agent-guard.js +72 -0
- package/lib/agents-route.js +55 -0
- package/lib/agents.js +213 -0
- package/lib/agui.js +255 -0
- package/lib/alerts.js +36 -0
- package/lib/analyze-otlp.js +46 -0
- package/lib/analyze-run-code.js +397 -0
- package/lib/analyze-sources.js +372 -0
- package/lib/approval-card.js +54 -0
- package/lib/approval-cli.js +53 -0
- package/lib/approval-request.js +81 -0
- package/lib/approval-signer.js +48 -0
- package/lib/approvals.js +295 -0
- package/lib/attachment-cache.js +236 -0
- package/lib/attachment.js +63 -0
- package/lib/blocked.js +20 -0
- package/lib/build-review.js +90 -0
- package/lib/builder/cli.js +90 -0
- package/lib/builder/policy.js +176 -0
- package/lib/builder/recover.js +189 -0
- package/lib/builder/run.js +240 -0
- package/lib/builder/settle.js +198 -0
- package/lib/builder/stage.js +240 -0
- package/lib/builder/state.js +73 -0
- package/lib/builder/supervisor.js +289 -0
- package/lib/builder-clean.js +223 -0
- package/lib/builder-code.cjs +67 -0
- package/lib/builder.js +9 -0
- package/lib/bus-postgres.js +281 -0
- package/lib/bus.js +349 -0
- package/lib/catalog/author.js +278 -0
- package/lib/catalog/dot.js +426 -0
- package/lib/catalog/pattern-model.js +193 -0
- package/lib/catalog/patterns.js +324 -0
- package/lib/catalog/projects.js +83 -0
- package/lib/catalog/records.js +2 -0
- package/lib/catalog/roster.js +70 -0
- package/lib/catalog/team-files.js +49 -0
- package/lib/catalog/teams.js +109 -0
- package/lib/claude-socket.js +333 -0
- package/lib/cli.js +741 -0
- package/lib/code-mode.js +45 -0
- package/lib/code-read-policy.yaml +9 -0
- package/lib/code-run.js +461 -0
- package/lib/codex-compact.js +141 -0
- package/lib/compaction.js +21 -0
- package/lib/config.js +424 -0
- package/lib/cursor-trace.js +248 -0
- package/lib/deep-link.js +20 -0
- package/lib/deliver-push.js +120 -0
- package/lib/delivery.js +28 -0
- package/lib/deploy-tree.js +227 -0
- package/lib/durable.js +404 -0
- package/lib/factory-tick.js +32 -0
- package/lib/family.js +63 -0
- package/lib/fetch-origin.js +53 -0
- package/lib/format.js +133 -0
- package/lib/harness-surface-cli.js +153 -0
- package/lib/harness-surface.js +486 -0
- package/lib/harness.js +271 -0
- package/lib/hook.mjs +291 -0
- package/lib/idle.js +40 -0
- package/lib/install-cursor.js +115 -0
- package/lib/install-opencode.js +105 -0
- package/lib/job.js +82 -0
- package/lib/land-cli.js +319 -0
- package/lib/land-member.js +64 -0
- package/lib/land.js +320 -0
- package/lib/lessons.js +223 -0
- package/lib/limit-alert.js +423 -0
- package/lib/limits.js +284 -0
- package/lib/machine-prompt.js +19 -0
- package/lib/merge-sweep.js +149 -0
- package/lib/messaging.js +1002 -0
- package/lib/mission-cli.js +103 -0
- package/lib/mission.js +241 -0
- package/lib/mode.js +215 -0
- package/lib/models.js +114 -0
- package/lib/names.js +86 -0
- package/lib/opencode-api.js +57 -0
- package/lib/opencode-plugin.mjs +313 -0
- package/lib/operator-token.js +78 -0
- package/lib/operator.js +187 -0
- package/lib/pad-activity.js +143 -0
- package/lib/pad-fresh.js +44 -0
- package/lib/pad.js +198 -0
- package/lib/pattern-cli.js +120 -0
- package/lib/pattern-compiler.js +68 -0
- package/lib/pattern-runs.js +795 -0
- package/lib/pattern-stall.js +58 -0
- package/lib/pattern-tick.js +45 -0
- package/lib/pattern-workflow.js +69 -0
- package/lib/pi-extension.mjs +98 -0
- package/lib/pi.js +57 -0
- package/lib/plugin-copy.js +76 -0
- package/lib/pm-review.js +32 -0
- package/lib/pm-workspace.js +87 -0
- package/lib/postgres.js +115 -0
- package/lib/pr-card.js +34 -0
- package/lib/probe.js +295 -0
- package/lib/process.js +67 -0
- package/lib/project-pause.js +23 -0
- package/lib/prune.js +793 -0
- package/lib/questions.js +250 -0
- package/lib/receipts.js +63 -0
- package/lib/reflect.js +962 -0
- package/lib/rename-migration.js +118 -0
- package/lib/run-terminal.js +437 -0
- package/lib/runner-request.js +33 -0
- package/lib/sandbox-app.js +120 -0
- package/lib/sandbox-claims.js +258 -0
- package/lib/sandbox-cli.js +188 -0
- package/lib/sandbox-hosts-cli.js +68 -0
- package/lib/sandbox-hosts.js +94 -0
- package/lib/sandbox-pr.js +102 -0
- package/lib/sandbox-proposal.js +367 -0
- package/lib/sandbox-tools.js +143 -0
- package/lib/sandbox.js +501 -0
- package/lib/schedule-session.js +68 -0
- package/lib/session-activity.js +67 -0
- package/lib/session-events.js +94 -0
- package/lib/sessions/control.js +244 -0
- package/lib/sessions/git-refs.js +265 -0
- package/lib/sessions/launch.js +359 -0
- package/lib/sessions/registry.js +450 -0
- package/lib/sessions/scope.js +111 -0
- package/lib/setup.js +377 -0
- package/lib/signed-approval.js +225 -0
- package/lib/slash.js +167 -0
- package/lib/spawn-cli.js +45 -0
- package/lib/spawn.js +107 -0
- package/lib/start-limit.js +58 -0
- package/lib/state.js +24 -0
- package/lib/stop.js +308 -0
- package/lib/store-read.js +62 -0
- package/lib/store.js +252 -0
- package/lib/subagent-guard.js +240 -0
- package/lib/surfaces/channel-post.js +43 -0
- package/lib/surfaces/instructions.js +15 -0
- package/lib/surfaces/mcp-reload.js +144 -0
- package/lib/surfaces/ops.js +629 -0
- package/lib/surfaces/render-mcp.js +33 -0
- package/lib/surfaces/run-terminal-ops.js +40 -0
- package/lib/surfaces/sandbox-ops.js +36 -0
- package/lib/surfaces/schema.js +7 -0
- package/lib/surfaces/task-view.js +90 -0
- package/lib/surfaces/types.js +4 -0
- package/lib/task-cli.js +274 -0
- package/lib/task-order.js +34 -0
- package/lib/task-order.mjs +2 -0
- package/lib/task-route.js +125 -0
- package/lib/tasks.js +631 -0
- package/lib/team-permission.js +34 -0
- package/lib/team-templates/blitz/team.dot +9 -0
- package/lib/team-templates/factory/team.dot +26 -0
- package/lib/team-templates/feature/team.dot +14 -0
- package/lib/team-templates/fix-and-review/team.dot +12 -0
- package/lib/team-templates/product/team.dot +16 -0
- package/lib/team-templates/release/team.dot +7 -0
- package/lib/team-templates/review/team.dot +6 -0
- package/lib/terminal-draft.js +42 -0
- package/lib/thread-branch.js +82 -0
- package/lib/thread-channel-store.js +181 -0
- package/lib/thread-channels.js +116 -0
- package/lib/thread-listening.js +20 -0
- package/lib/thread-routes.js +91 -0
- package/lib/threads.js +441 -0
- package/lib/tool-api.js +33 -0
- package/lib/transcript.js +98 -0
- package/lib/ui-build-output.js +19 -0
- package/lib/ui-capabilities.js +90 -0
- package/lib/usage.js +182 -0
- package/lib/vendor/mcp-sdk.d.mts +4 -0
- package/lib/vendor/mcp-sdk.mjs +17046 -0
- package/lib/waiter.js +127 -0
- package/lib/workflows.js +546 -0
- package/lib/worktree-setup.js +86 -0
- package/package.json +112 -1
- package/runner/adapters/claude.js +465 -0
- package/runner/adapters/cli-sandbox.js +277 -0
- package/runner/adapters/codex.js +675 -0
- package/runner/adapters/cursor.mjs +937 -0
- package/runner/adapters/fake.js +119 -0
- package/runner/adapters/opencode-sandbox.js +370 -0
- package/runner/adapters/opencode.js +486 -0
- package/runner/adapters/pi-sandbox.js +134 -0
- package/runner/adapters/pi.js +364 -0
- package/runner/client.js +40 -0
- package/runner/contract.js +129 -0
- package/runner/control.js +178 -0
- package/runner/delivery.js +184 -0
- package/runner/factory-tick.mjs +10 -0
- package/runner/lock.js +41 -0
- package/runner/main.mjs +118 -0
- package/runner/pattern-tick.mjs +16 -0
- package/runner/publish.js +113 -0
- package/runner/runner.js +2612 -0
- package/runner/sandbox-run.mjs +239 -0
- package/runner/schedules.js +294 -0
- package/runner/task-wake.js +59 -0
- package/scripts/ai-collab +3 -0
- package/scripts/ai-collab-bus.mjs +4 -0
- package/scripts/ai-collab-code-mcp.mjs +3 -0
- package/scripts/ai-collab-hook +3 -0
- package/scripts/ai-collab-hook.mjs +3 -0
- package/scripts/ai-collab-mcp-tools.mjs +2 -0
- package/scripts/ai-collab-mcp.mjs +3 -0
- package/scripts/ai-collab.mjs +3 -0
- package/scripts/install-cursor.mjs +11 -0
- package/scripts/install-opencode.mjs +10 -0
- package/scripts/temmo +3 -0
- package/scripts/temmo-bus.mjs +151 -0
- package/scripts/temmo-code-mcp.mjs +63 -0
- package/scripts/temmo-hook +3 -0
- package/scripts/temmo-hook.mjs +201 -0
- package/scripts/temmo-mcp-tools.mjs +22 -0
- package/scripts/temmo-mcp.mjs +27 -0
- package/scripts/temmo.mjs +4 -0
- package/skills/antislop/SKILL.md +701 -0
- package/skills/antislop/VERSION +1 -0
- package/skills/antislop-code/SKILL.md +128 -0
- package/skills/antislop-human/LICENSE-web-quality-skills +21 -0
- package/skills/antislop-human/SKILL.md +204 -0
- package/skills/antislop-human/contrast-check.py +168 -0
- package/skills/antislop-human/contrast-mcp.py +125 -0
- package/skills/antislop-human/references/A11Y-PATTERNS.md +249 -0
- package/skills/antislop-human/references/WCAG.md +127 -0
- package/skills/antislop-layoutmobile/SKILL.md +170 -0
- package/skills/antislop-ui/LICENSE-web-quality-skills +21 -0
- package/skills/antislop-ui/SKILL.md +351 -0
- package/skills/antislop-ui/references/CORE-WEB-VITALS.md +181 -0
- package/skills/antislop-ui/references/WEB-BASELINE.md +28 -0
- package/skills/harness-surface/SKILL.md +42 -0
- package/skills/land/SKILL.md +32 -0
- package/skills/memory-file/SKILL.md +39 -0
- package/skills/temmo/SKILL.md +101 -0
- package/skills/temmo/references/role-programs.md +47 -0
- package/skills/ui-sdk/SKILL.md +56 -0
- package/skills/ui-sdk/references/agent-ready.md +136 -0
- package/skills/ui-sdk/references/build-interface.md +187 -0
- package/skills/ui-sdk/references/create-component.md +88 -0
- package/skills/ui-sdk/references/patterns.md +246 -0
- package/skills/ui-sdk/references/styles.md +66 -0
- package/skills/ui-sdk/references/testing.md +172 -0
- package/skills/ui-sdk/references/web-components.md +78 -0
- package/tools/screen-state.mjs +119 -0
- package/tools/smoke-ui.mjs +540 -0
- package/web/app/activity.jsx +251 -0
- package/web/app/agent-mark.tsx +43 -0
- package/web/app/alert-level.jsx +16 -0
- package/web/app/api/[action]/route.js +8 -0
- package/web/app/api/auth/[step]/route.js +12 -0
- package/web/app/api/events/route.js +8 -0
- package/web/app/api/file/[name]/route.js +8 -0
- package/web/app/api/land/route.js +12 -0
- package/web/app/api/lessons/route.js +8 -0
- package/web/app/api/push/key/route.js +8 -0
- package/web/app/api/push/subscribe/route.js +12 -0
- package/web/app/api/push/test/route.js +8 -0
- package/web/app/api/refs/route.js +8 -0
- package/web/app/api/review-diff/route.js +8 -0
- package/web/app/api/schedules/route.js +8 -0
- package/web/app/api/thread-diff/route.js +8 -0
- package/web/app/api/version/route.js +6 -0
- package/web/app/cards.jsx +189 -0
- package/web/app/chat-api.js +82 -0
- package/web/app/chat-composer.jsx +313 -0
- package/web/app/chat-console.jsx +691 -0
- package/web/app/chat-image.tsx +61 -0
- package/web/app/chat-message.jsx +122 -0
- package/web/app/chat-shared.jsx +59 -0
- package/web/app/chat-sidebar.jsx +25 -0
- package/web/app/chat-stream.js +127 -0
- package/web/app/chat.jsx +31 -0
- package/web/app/compactions.jsx +57 -0
- package/web/app/composer-actions.tsx +87 -0
- package/web/app/decisions.jsx +53 -0
- package/web/app/fonts/OFL-hanken-grotesk.txt +93 -0
- package/web/app/fonts/OFL-ibm-plex-mono.txt +93 -0
- package/web/app/fonts/hanken-grotesk-latin-wght-normal.woff2 +0 -0
- package/web/app/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
- package/web/app/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
- package/web/app/globals.css +199 -0
- package/web/app/home.jsx +246 -0
- package/web/app/icon.svg +1 -0
- package/web/app/land-panel.jsx +63 -0
- package/web/app/land-reviews.jsx +20 -0
- package/web/app/layout.jsx +17 -0
- package/web/app/lessons.tsx +76 -0
- package/web/app/logo.tsx +13 -0
- package/web/app/logos.jsx +16 -0
- package/web/app/manifest.js +8 -0
- package/web/app/mode-menu.tsx +46 -0
- package/web/app/new-session.jsx +275 -0
- package/web/app/notify.jsx +180 -0
- package/web/app/outcomes.tsx +94 -0
- package/web/app/page.jsx +9 -0
- package/web/app/pattern-graph.jsx +75 -0
- package/web/app/patterns-page.jsx +293 -0
- package/web/app/phone-nav.tsx +36 -0
- package/web/app/progress-feed.tsx +33 -0
- package/web/app/providers.tsx +27 -0
- package/web/app/quote.jsx +15 -0
- package/web/app/run-card.tsx +200 -0
- package/web/app/run-requests.tsx +148 -0
- package/web/app/scheduled.jsx +105 -0
- package/web/app/session-panel.tsx +174 -0
- package/web/app/session-toolbar.tsx +180 -0
- package/web/app/shadcn.css +638 -0
- package/web/app/shipped.jsx +49 -0
- package/web/app/subagent-runs.jsx +31 -0
- package/web/app/task-graph.jsx +67 -0
- package/web/app/tasks-strip.tsx +36 -0
- package/web/app/tasks.jsx +375 -0
- package/web/app/team-author.jsx +145 -0
- package/web/app/team-editor.jsx +88 -0
- package/web/app/thread-agents.tsx +32 -0
- package/web/app/thread-place.tsx +9 -0
- package/web/app/thread-sessions.tsx +149 -0
- package/web/app/thread-sidebar.tsx +418 -0
- package/web/app/thread-switcher.tsx +27 -0
- package/web/app/tool-diff.jsx +94 -0
- package/web/components/a2ui/controls.jsx +36 -0
- package/web/components/a2ui/option-picker.jsx +23 -0
- package/web/components/a2ui/script.tsx +121 -0
- package/web/components/a2ui/surface.jsx +81 -0
- package/web/components/chat/thread.jsx +50 -0
- package/web/components/script-text.tsx +42 -0
- package/web/components/ui/avatar.jsx +115 -0
- package/web/components/ui/badge.jsx +47 -0
- package/web/components/ui/button.jsx +63 -0
- package/web/components/ui/chat-container.jsx +52 -0
- package/web/components/ui/choice-list.tsx +72 -0
- package/web/components/ui/code-block.jsx +60 -0
- package/web/components/ui/copy-button.tsx +41 -0
- package/web/components/ui/dropdown-menu.jsx +257 -0
- package/web/components/ui/markdown.jsx +84 -0
- package/web/components/ui/message.jsx +28 -0
- package/web/components/ui/popover.jsx +33 -0
- package/web/components/ui/scroll-button.jsx +34 -0
- package/web/components/ui/select.jsx +189 -0
- package/web/components/ui/sheet.jsx +152 -0
- package/web/components/ui/sonner.jsx +10 -0
- package/web/components/ui/tabs.jsx +88 -0
- package/web/components/ui/textarea.jsx +20 -0
- package/web/components/ui/tooltip.jsx +56 -0
- package/web/components.json +24 -0
- package/web/instrumentation.js +8 -0
- package/web/lib/a2ui-catalog.js +34 -0
- package/web/lib/a2ui-pr.js +76 -0
- package/web/lib/a2ui-run-catalog.js +18 -0
- package/web/lib/a2ui-run.js +93 -0
- package/web/lib/a2ui.js +262 -0
- package/web/lib/activity-rows.js +275 -0
- package/web/lib/agent-detail.js +5 -0
- package/web/lib/alert-level.js +44 -0
- package/web/lib/approval-mode.js +22 -0
- package/web/lib/chat-turns.js +174 -0
- package/web/lib/child-subagents.js +16 -0
- package/web/lib/compaction-view.js +48 -0
- package/web/lib/composer-actions.js +40 -0
- package/web/lib/context-view.js +57 -0
- package/web/lib/fuzzy.js +26 -0
- package/web/lib/highlight.js +44 -0
- package/web/lib/lessons-view.js +23 -0
- package/web/lib/mentions.js +16 -0
- package/web/lib/message-routing.js +105 -0
- package/web/lib/new-session.js +85 -0
- package/web/lib/operator-messages.js +28 -0
- package/web/lib/pattern-graph.js +165 -0
- package/web/lib/pattern-view.js +33 -0
- package/web/lib/pending-summary.js +18 -0
- package/web/lib/permission-modes.js +30 -0
- package/web/lib/project-feed.js +107 -0
- package/web/lib/quote.js +7 -0
- package/web/lib/reply-quote.js +31 -0
- package/web/lib/scheduled.js +79 -0
- package/web/lib/selection.js +110 -0
- package/web/lib/send-confirmation.js +22 -0
- package/web/lib/session-dead.js +10 -0
- package/web/lib/session-state.js +132 -0
- package/web/lib/sidebar.js +15 -0
- package/web/lib/slash-commands.js +164 -0
- package/web/lib/start-default.js +35 -0
- package/web/lib/start-mode.js +35 -0
- package/web/lib/stream-views.js +49 -0
- package/web/lib/subagent-state.js +20 -0
- package/web/lib/task-board.js +54 -0
- package/web/lib/task-graph.js +183 -0
- package/web/lib/task-tags.js +41 -0
- package/web/lib/team-editor.js +10 -0
- package/web/lib/thread-groups.js +86 -0
- package/web/lib/threads.js +28 -0
- package/web/lib/tool-diff.js +273 -0
- package/web/lib/ui-events.js +58 -0
- package/web/lib/utils.js +5 -0
- package/web/lib/view-memory.js +25 -0
- package/web/next.config.mjs +37 -0
- package/web/postcss.config.mjs +1 -0
- package/web/proxy.js +25 -0
- package/web/public/sw.js +39 -0
- package/web/server/auth.js +178 -0
- package/web/server/dispatch.js +293 -0
- package/web/server/history.js +56 -0
- package/web/server/hosted.js +58 -0
- package/web/server/hub.js +126 -0
- package/web/server/instance.js +5 -0
- package/web/server/land-reviews.js +64 -0
- package/web/server/push.js +148 -0
- package/web/server/run-terminal.js +79 -0
- package/web/server/schedules.js +38 -0
- package/web/server/shipped.js +51 -0
- package/web/server/task-board.js +71 -0
- package/web/server/threads.js +209 -0
- package/web/server/ui.js +2937 -0
- package/web/tsconfig.base.json +16 -0
- package/web/tsconfig.json +9 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react"
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
import { highlight } from "@/lib/highlight"
|
|
5
|
+
|
|
6
|
+
function CodeBlock({
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
className={cn(
|
|
14
|
+
"not-prose flex w-full flex-col overflow-clip border",
|
|
15
|
+
"border-border bg-card text-card-foreground rounded-xl",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// prompt-kit's CodeBlockCode with a lazy shiki core (JavaScript regex engine, dual light/dark themes); plain text until it loads.
|
|
26
|
+
function CodeBlockCode({
|
|
27
|
+
code,
|
|
28
|
+
language,
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}) {
|
|
32
|
+
const [html, setHtml] = useState(null)
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
let live = true
|
|
35
|
+
setHtml(null)
|
|
36
|
+
highlight(code, language).then((result) => { if (live) setHtml(result) })
|
|
37
|
+
return () => { live = false }
|
|
38
|
+
}, [code, language])
|
|
39
|
+
const classes = cn("w-full overflow-x-auto text-sm [&>pre]:px-4 [&>pre]:py-4", className)
|
|
40
|
+
return html
|
|
41
|
+
? <div className={classes} data-language={language} data-highlighted="" dangerouslySetInnerHTML={{ __html: html }} {...props}/>
|
|
42
|
+
: <div className={classes} data-language={language} {...props}><pre><code>{code}</code></pre></div>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function CodeBlockGroup({
|
|
46
|
+
children,
|
|
47
|
+
className,
|
|
48
|
+
...props
|
|
49
|
+
}) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
className={cn("flex items-center justify-between", className)}
|
|
53
|
+
{...props}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</div>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { CodeBlockGroup, CodeBlockCode, CodeBlock }
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useState } from "react"
|
|
4
|
+
import { Button } from "@ui-sdk/react/button"
|
|
5
|
+
import { CheckIcon, CopyIcon } from "lucide-react"
|
|
6
|
+
import { buttonVariants } from "@/components/ui/button"
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import { copyText } from "@/lib/copy-text"
|
|
9
|
+
|
|
10
|
+
const COPIED_MS = 1500
|
|
11
|
+
|
|
12
|
+
export function CopyButton({ text, className }: { text: string; className?: string }) {
|
|
13
|
+
const timer = useRef<ReturnType<typeof setTimeout>>(undefined)
|
|
14
|
+
const [copied, setCopied] = useState(false)
|
|
15
|
+
|
|
16
|
+
useEffect(() => () => clearTimeout(timer.current), [])
|
|
17
|
+
|
|
18
|
+
async function copy() {
|
|
19
|
+
if (!(await copyText(text))) return
|
|
20
|
+
clearTimeout(timer.current)
|
|
21
|
+
setCopied(true)
|
|
22
|
+
timer.current = setTimeout(() => setCopied(false), COPIED_MS)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={cn("flex items-center gap-1", className)}>
|
|
27
|
+
{/* Reserved width keeps the row still while the word comes and goes. */}
|
|
28
|
+
<span role="status" aria-live="polite" className="w-12 text-right text-xs text-muted-foreground">
|
|
29
|
+
{copied ? "Copied" : ""}
|
|
30
|
+
</span>
|
|
31
|
+
<Button
|
|
32
|
+
aria-label="Copy code"
|
|
33
|
+
pendingAnnouncement=""
|
|
34
|
+
className={cn(buttonVariants({ variant: "ghost", size: "icon-sm" }), "text-muted-foreground pointer-coarse:size-9")}
|
|
35
|
+
onClick={copy}
|
|
36
|
+
>
|
|
37
|
+
{copied ? <CheckIcon className="size-3.5" aria-hidden="true" /> : <CopyIcon className="size-3.5" aria-hidden="true" />}
|
|
38
|
+
</Button>
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"
|
|
6
|
+
import { CheckIcon, ChevronRightIcon } from "lucide-react"
|
|
7
|
+
|
|
8
|
+
function DropdownMenu({
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
11
|
+
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function DropdownMenuPortal({
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function DropdownMenuTrigger({
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
25
|
+
return (
|
|
26
|
+
<DropdownMenuPrimitive.Trigger
|
|
27
|
+
data-slot="dropdown-menu-trigger"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function DropdownMenuContent({
|
|
34
|
+
className,
|
|
35
|
+
align = "start",
|
|
36
|
+
sideOffset = 4,
|
|
37
|
+
...props
|
|
38
|
+
}) {
|
|
39
|
+
return (
|
|
40
|
+
<DropdownMenuPrimitive.Portal>
|
|
41
|
+
<DropdownMenuPrimitive.Content
|
|
42
|
+
data-slot="dropdown-menu-content"
|
|
43
|
+
sideOffset={sideOffset}
|
|
44
|
+
align={align}
|
|
45
|
+
className={cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
</DropdownMenuPrimitive.Portal>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function DropdownMenuGroup({
|
|
53
|
+
...props
|
|
54
|
+
}) {
|
|
55
|
+
return (
|
|
56
|
+
<DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function DropdownMenuItem({
|
|
61
|
+
className,
|
|
62
|
+
inset,
|
|
63
|
+
variant = "default",
|
|
64
|
+
...props
|
|
65
|
+
}) {
|
|
66
|
+
return (
|
|
67
|
+
<DropdownMenuPrimitive.Item
|
|
68
|
+
data-slot="dropdown-menu-item"
|
|
69
|
+
data-inset={inset}
|
|
70
|
+
data-variant={variant}
|
|
71
|
+
className={cn(
|
|
72
|
+
"group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
73
|
+
className
|
|
74
|
+
)}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function DropdownMenuCheckboxItem({
|
|
81
|
+
className,
|
|
82
|
+
children,
|
|
83
|
+
checked,
|
|
84
|
+
inset,
|
|
85
|
+
...props
|
|
86
|
+
}) {
|
|
87
|
+
return (
|
|
88
|
+
<DropdownMenuPrimitive.CheckboxItem
|
|
89
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
90
|
+
data-inset={inset}
|
|
91
|
+
className={cn(
|
|
92
|
+
"relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
93
|
+
className
|
|
94
|
+
)}
|
|
95
|
+
checked={checked}
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
<span
|
|
99
|
+
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
100
|
+
data-slot="dropdown-menu-checkbox-item-indicator"
|
|
101
|
+
>
|
|
102
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
103
|
+
<CheckIcon
|
|
104
|
+
/>
|
|
105
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
106
|
+
</span>
|
|
107
|
+
{children}
|
|
108
|
+
</DropdownMenuPrimitive.CheckboxItem>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function DropdownMenuRadioGroup({
|
|
113
|
+
...props
|
|
114
|
+
}) {
|
|
115
|
+
return (
|
|
116
|
+
<DropdownMenuPrimitive.RadioGroup
|
|
117
|
+
data-slot="dropdown-menu-radio-group"
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function DropdownMenuRadioItem({
|
|
124
|
+
className,
|
|
125
|
+
children,
|
|
126
|
+
inset,
|
|
127
|
+
...props
|
|
128
|
+
}) {
|
|
129
|
+
return (
|
|
130
|
+
<DropdownMenuPrimitive.RadioItem
|
|
131
|
+
data-slot="dropdown-menu-radio-item"
|
|
132
|
+
data-inset={inset}
|
|
133
|
+
className={cn(
|
|
134
|
+
"relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
135
|
+
className
|
|
136
|
+
)}
|
|
137
|
+
{...props}
|
|
138
|
+
>
|
|
139
|
+
<span
|
|
140
|
+
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
141
|
+
data-slot="dropdown-menu-radio-item-indicator"
|
|
142
|
+
>
|
|
143
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
144
|
+
<CheckIcon
|
|
145
|
+
/>
|
|
146
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
147
|
+
</span>
|
|
148
|
+
{children}
|
|
149
|
+
</DropdownMenuPrimitive.RadioItem>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function DropdownMenuLabel({
|
|
154
|
+
className,
|
|
155
|
+
inset,
|
|
156
|
+
...props
|
|
157
|
+
}) {
|
|
158
|
+
return (
|
|
159
|
+
<DropdownMenuPrimitive.Label
|
|
160
|
+
data-slot="dropdown-menu-label"
|
|
161
|
+
data-inset={inset}
|
|
162
|
+
className={cn(
|
|
163
|
+
"px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",
|
|
164
|
+
className
|
|
165
|
+
)}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function DropdownMenuSeparator({
|
|
172
|
+
className,
|
|
173
|
+
...props
|
|
174
|
+
}) {
|
|
175
|
+
return (
|
|
176
|
+
<DropdownMenuPrimitive.Separator
|
|
177
|
+
data-slot="dropdown-menu-separator"
|
|
178
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
179
|
+
{...props}
|
|
180
|
+
/>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function DropdownMenuShortcut({
|
|
185
|
+
className,
|
|
186
|
+
...props
|
|
187
|
+
}) {
|
|
188
|
+
return (
|
|
189
|
+
<span
|
|
190
|
+
data-slot="dropdown-menu-shortcut"
|
|
191
|
+
className={cn(
|
|
192
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
|
|
193
|
+
className
|
|
194
|
+
)}
|
|
195
|
+
{...props}
|
|
196
|
+
/>
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function DropdownMenuSub({
|
|
201
|
+
...props
|
|
202
|
+
}) {
|
|
203
|
+
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function DropdownMenuSubTrigger({
|
|
207
|
+
className,
|
|
208
|
+
inset,
|
|
209
|
+
children,
|
|
210
|
+
...props
|
|
211
|
+
}) {
|
|
212
|
+
return (
|
|
213
|
+
<DropdownMenuPrimitive.SubTrigger
|
|
214
|
+
data-slot="dropdown-menu-sub-trigger"
|
|
215
|
+
data-inset={inset}
|
|
216
|
+
className={cn(
|
|
217
|
+
"flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
218
|
+
className
|
|
219
|
+
)}
|
|
220
|
+
{...props}
|
|
221
|
+
>
|
|
222
|
+
{children}
|
|
223
|
+
<ChevronRightIcon className="ml-auto" />
|
|
224
|
+
</DropdownMenuPrimitive.SubTrigger>
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function DropdownMenuSubContent({
|
|
229
|
+
className,
|
|
230
|
+
...props
|
|
231
|
+
}) {
|
|
232
|
+
return (
|
|
233
|
+
<DropdownMenuPrimitive.SubContent
|
|
234
|
+
data-slot="dropdown-menu-sub-content"
|
|
235
|
+
className={cn("z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
|
|
236
|
+
{...props}
|
|
237
|
+
/>
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export {
|
|
242
|
+
DropdownMenu,
|
|
243
|
+
DropdownMenuPortal,
|
|
244
|
+
DropdownMenuTrigger,
|
|
245
|
+
DropdownMenuContent,
|
|
246
|
+
DropdownMenuGroup,
|
|
247
|
+
DropdownMenuLabel,
|
|
248
|
+
DropdownMenuItem,
|
|
249
|
+
DropdownMenuCheckboxItem,
|
|
250
|
+
DropdownMenuRadioGroup,
|
|
251
|
+
DropdownMenuRadioItem,
|
|
252
|
+
DropdownMenuSeparator,
|
|
253
|
+
DropdownMenuShortcut,
|
|
254
|
+
DropdownMenuSub,
|
|
255
|
+
DropdownMenuSubTrigger,
|
|
256
|
+
DropdownMenuSubContent,
|
|
257
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils"
|
|
2
|
+
import { remarkTaskLinks } from "@/lib/task-tags"
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
|
+
import ReactMarkdown from "react-markdown";
|
|
5
|
+
import remarkBreaks from "remark-breaks"
|
|
6
|
+
import remarkGfm from "remark-gfm"
|
|
7
|
+
import { CodeBlock, CodeBlockCode, CodeBlockGroup } from "./code-block"
|
|
8
|
+
import { CopyButton } from "./copy-button"
|
|
9
|
+
import { codeText } from "@/lib/copy-text"
|
|
10
|
+
|
|
11
|
+
function extractLanguage(className) {
|
|
12
|
+
if (!className) return "plaintext"
|
|
13
|
+
const match = className.match(/language-(\w+)/)
|
|
14
|
+
return match ? match[1] : "plaintext"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// One markdown config for the whole console: chat bubbles render it through assistant-ui's
|
|
18
|
+
// MarkdownTextPrimitive (web/components/chat/thread.jsx), everything outside a message context
|
|
19
|
+
// renders it through the Markdown component below. The primitive reads its text from the message
|
|
20
|
+
// part context and takes no text prop, so it cannot serve cards and activity rows directly;
|
|
21
|
+
// both paths must keep using THIS list so the two renderers cannot drift.
|
|
22
|
+
const INITIAL_COMPONENTS = {
|
|
23
|
+
// "#mention" links come from @tags in chat bodies; only the tag is coloured.
|
|
24
|
+
a: function LinkComponent({ href, children, ...props }) {
|
|
25
|
+
// A button: the chat opens the tagged session (or harness) on tap through event delegation on data-mention.
|
|
26
|
+
if (href === "#mention") return <button type="button" data-mention className="mention rounded-md bg-primary/15 px-1 font-medium text-primary hover:bg-primary/25">{children}</button>
|
|
27
|
+
if (href?.startsWith("#project=") && href.includes("&level=tasks&task=")) return <a href={href} className="font-medium text-primary underline underline-offset-2">{children}</a>
|
|
28
|
+
return <a href={href} target="_blank" rel="noreferrer" className="underline underline-offset-2" {...props}>{children}</a>
|
|
29
|
+
},
|
|
30
|
+
code: function CodeComponent({ className, children, ...props }) {
|
|
31
|
+
const isInline =
|
|
32
|
+
!props.node?.position?.start.line ||
|
|
33
|
+
props.node?.position?.start.line === props.node?.position?.end.line
|
|
34
|
+
|
|
35
|
+
if (isInline) {
|
|
36
|
+
return (
|
|
37
|
+
<span
|
|
38
|
+
className={cn(
|
|
39
|
+
"bg-primary-foreground rounded-sm px-1 font-mono text-sm",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</span>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const language = extractLanguage(className)
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<CodeBlock className={className}>
|
|
53
|
+
<CodeBlockGroup className="border-b border-border py-0.5 pr-1 pl-3">
|
|
54
|
+
<div className="font-mono text-xs text-muted-foreground">{language === "plaintext" ? "" : language}</div>
|
|
55
|
+
<CopyButton text={codeText(children)} />
|
|
56
|
+
</CodeBlockGroup>
|
|
57
|
+
<CodeBlockCode code={children} language={language} />
|
|
58
|
+
</CodeBlock>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
pre: function PreComponent({ children }) {
|
|
62
|
+
return <>{children}</>
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const Markdown = memo(function Markdown({ children, className, taskLinks }) {
|
|
67
|
+
const plugins = useMemo(() => remarkPluginsFor(taskLinks), [taskLinks])
|
|
68
|
+
return (
|
|
69
|
+
<div className={className}>
|
|
70
|
+
<ReactMarkdown remarkPlugins={plugins} components={INITIAL_COMPONENTS}>
|
|
71
|
+
{children || ""}
|
|
72
|
+
</ReactMarkdown>
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}, function propsAreEqual(prev, next) {
|
|
76
|
+
return prev.children === next.children && prev.taskLinks === next.taskLinks && prev.className === next.className
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
/** The remark plugin list for a task-link map, shared with the assistant-ui bubble renderer. */
|
|
80
|
+
export function remarkPluginsFor(taskLinks) {
|
|
81
|
+
return taskLinks ? [remarkGfm, remarkBreaks, [remarkTaskLinks, taskLinks]] : [remarkGfm, remarkBreaks]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { Markdown, INITIAL_COMPONENTS as MARKDOWN_COMPONENTS }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils"
|
|
2
|
+
import { Markdown } from "./markdown"
|
|
3
|
+
|
|
4
|
+
// The markdown bubble the cards and the activity rows render outside a chat message context.
|
|
5
|
+
// Chat bubbles render through assistant-ui's MessagePrimitive instead (web/components/chat/thread.jsx).
|
|
6
|
+
const MessageContent = ({
|
|
7
|
+
children,
|
|
8
|
+
markdown = false,
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}) => {
|
|
12
|
+
const classNames = cn(
|
|
13
|
+
"rounded-lg p-2 text-foreground bg-secondary prose break-words whitespace-normal",
|
|
14
|
+
className
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
return markdown ? (
|
|
18
|
+
<Markdown className={classNames} {...props}>
|
|
19
|
+
{children}
|
|
20
|
+
</Markdown>
|
|
21
|
+
) : (
|
|
22
|
+
<div className={classNames} {...props}>
|
|
23
|
+
{children}
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { MessageContent }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
import { Popover as PopoverPrimitive } from "radix-ui"
|
|
6
|
+
|
|
7
|
+
function Popover({ ...props }) {
|
|
8
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function PopoverTrigger({ ...props }) {
|
|
12
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function PopoverContent({ className, align = "start", sideOffset = 6, collisionPadding = 8, ...props }) {
|
|
16
|
+
return (
|
|
17
|
+
<PopoverPrimitive.Portal>
|
|
18
|
+
<PopoverPrimitive.Content
|
|
19
|
+
data-slot="popover-content"
|
|
20
|
+
align={align}
|
|
21
|
+
sideOffset={sideOffset}
|
|
22
|
+
collisionPadding={collisionPadding}
|
|
23
|
+
className={cn(
|
|
24
|
+
"z-50 w-72 max-w-[var(--radix-popover-content-available-width)] origin-(--radix-popover-content-transform-origin) rounded-xl bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 outline-hidden data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
</PopoverPrimitive.Portal>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { Popover, PopoverTrigger, PopoverContent }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "@/components/ui/button";
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
import { ChevronDown } from "lucide-react"
|
|
5
|
+
import { useStickToBottomContext } from "use-stick-to-bottom"
|
|
6
|
+
|
|
7
|
+
function ScrollButton({
|
|
8
|
+
className,
|
|
9
|
+
variant = "outline",
|
|
10
|
+
size = "sm",
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
const { isAtBottom, scrollToBottom } = useStickToBottomContext()
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Button
|
|
17
|
+
variant={variant}
|
|
18
|
+
size={size}
|
|
19
|
+
className={cn(
|
|
20
|
+
"h-10 w-10 rounded-md transition-all duration-150 ease-out",
|
|
21
|
+
!isAtBottom
|
|
22
|
+
? "translate-y-0 scale-100 opacity-100"
|
|
23
|
+
: "pointer-events-none translate-y-4 scale-95 opacity-0",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
onClick={() => scrollToBottom()}
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
<ChevronDown className="h-5 w-5" />
|
|
30
|
+
</Button>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { ScrollButton }
|