* fix(deps): patch tauri-plugin-shell CVE (GHSA-c9pr-q8gx-3mgp) @tauri-apps/plugin-shell (npm) 与 tauri-plugin-shell (crate) 的声明下限 ——npm `^2.0.1`、crate `"2"`——都落在 GHSA-c9pr-q8gx-3mgp 影响范围 (`< 2.2.1`,CRITICAL:`open` 端点作用域校验绕过,可致 RCE)。本项目 src/lib/ipc/utils.ts 正是通过该 `open` 端点打开外链,属受影响用法。 两个 lockfile 实际已解析到 2.3.5,但清单声明的下限仍是漏洞版本,供应链 扫描(SkillSpector SC4)因此读取到 2.0.1 报警。此处仅把两侧声明下限抬到 最新安全版 2.3.5,使清单与锁定版本一致、扫描不再命中;解析版本不变,无 运行时行为变化。 Closes #668 * fix(audit): 1.3.14 审计修复一批(Apple Speech 取消/IME 保存锁死/侧向键卡死/火山429 等) - CRIT Apple Speech 取消/超时不终止 SFSpeechRecognitionTask(SendableTask+cancel_flag+[task cancel]+100ms 轮询) - HIGH windows_ime 未安装分支反致设置保存事务锁死(抽纯函数 keyboard_list_pref_short_circuit) - HIGH 侧向键 Released 卡死自愈 + macOS flags 类位竞态 + Linux 显式拒绝 - HIGH coordinator/hotkey_loops unused_assignments clippy 回归 - MED 火山 429 限流不重试(RateLimited)/ Heatmap clamp / 授权失败反馈 / SendInput 分类单一真相 / SendInputOptions 收敛 - 清理 删死码 ?? '重启' / side_aware 死字段 / 孤儿 MarketplaceModal cargo test 552-0 / npm build 绿。windows cfg 部分需 CI 四平台验证。 * feat(chat): 统一聊天面板组件库——官方 shadcn base 组件按 CLI 规则内嵌 @shadcn/react 官方 primitive + base-rhea registry 原文内嵌 components/chat/ui/ (message-scroller/marker/bubble/message/card/empty/input-group/button/input/ textarea/spinner,仅按 CLI 规则改 import 路径;button 保留 3 行 React18 inert 归一)。Tailwind v4 作用域隔离:utilities source(none) + @source 只扫聊天文件、 无层导入压过 global.css;官方主题 shadcn/tailwind.css + tw-animate-css。 胶囊同款思考动画(orbFeed 单 GL 源镜像多头像)、GitHub 头像(CSP img-src 放行)、 出现/消失生命周期 hook。平台门控:非 darwin 构建 DCE 掉 Less Computer chunk。 删除旧自制 Marker/MessageScroller 组件。 * feat(panels): QA/LC 浮窗重写为官方 message-scroller-demo 同款骨架 Card + Empty + InputGroup + MessageScroller 官方组合;QA=Message 带头像形态 (右 GitHub / 左旋转 orb),LC=Marker 工具行形态(无头像)。 语音状态只在输入区:录音红光/转译黑光绕输入组跑圈,问题落定即停; 思考头像行门控在用户消息落定之后(修「AI 头像先出现、动画抽搐」)。 LC 事件空轮自愈 + mount 后 less_computer_sync 重放(webview 冷加载丢 user 事件导致「后端在跑前端空白/用户的话不显示」)。纯白背景、官方 24px 圆角、出现/消失动画(chat-panel:shown/closing)。 * fix(backend): 聊天面板后端配套——命令注册/非激活面板/事件缓冲/生命周期 - 恢复桌面 invoke_handler 的 qa_submit_text / qa_toggle_recording(此前删 qa_window_pin 时误删相邻项,真机报 Command qa_submit_text not found) - QA/LC 窗口转非激活 NSPanel(胶囊同管线:NonactivatingPanelMask + CanJoinAllSpaces|FullScreenAuxiliary),chat_panel_focus_keyboard 改主线程 makeKeyAndOrderFront:打字不激活 app、主窗口不再被带出、frontmost 保持 用户原 app(划词选区在多轮期间仍可读) - Less Computer 事件按全局单调 seq 写入环形缓冲(fresh user 清空、cap 2048 丢最旧),新命令 less_computer_sync 供前端 mount 重放(仅 less-computer 窗口可调);附 2 个单测 - show/hide 生命周期:show 发 chat-panel:shown 并作废挂起 hide;hide 先发 chat-panel:closing、240ms 后真正隐藏(AtomicU64 世代防快速关-开竞态) - QA/LC 窗口统一固定 420×540;删除 qa_window_pin / less_computer_window_resize 整链(无消费方) --------- Co-authored-by: sim <sim@local>
156 lines
4.9 KiB
TypeScript
156 lines
4.9 KiB
TypeScript
import * as React from "react"
|
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
|
|
import { cn } from "../lib/utils"
|
|
import { Button } from "./button"
|
|
import { Input } from "./input"
|
|
import { Textarea } from "./textarea"
|
|
|
|
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="input-group"
|
|
role="group"
|
|
className={cn(
|
|
"group/input-group relative flex h-8 w-full min-w-0 items-center rounded-2xl border border-transparent bg-input/50 transition-[color,box-shadow] duration-200 outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
const inputGroupAddonVariants = cva(
|
|
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-2xl **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1.5 [&>svg:not([class*='size-'])]:size-4",
|
|
{
|
|
variants: {
|
|
align: {
|
|
"inline-start":
|
|
"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]",
|
|
"inline-end":
|
|
"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]",
|
|
"block-start":
|
|
"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
|
|
"block-end":
|
|
"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
align: "inline-start",
|
|
},
|
|
}
|
|
)
|
|
|
|
function InputGroupAddon({
|
|
className,
|
|
align = "inline-start",
|
|
...props
|
|
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
|
|
return (
|
|
<div
|
|
role="group"
|
|
data-slot="input-group-addon"
|
|
data-align={align}
|
|
className={cn(inputGroupAddonVariants({ align }), className)}
|
|
onClick={(e) => {
|
|
if ((e.target as HTMLElement).closest("button")) {
|
|
return
|
|
}
|
|
e.currentTarget.parentElement?.querySelector("input")?.focus()
|
|
}}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
const inputGroupButtonVariants = cva(
|
|
"flex items-center gap-2 rounded-2xl text-sm shadow-none",
|
|
{
|
|
variants: {
|
|
size: {
|
|
xs: "h-6 gap-1 rounded-xl px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
sm: "",
|
|
"icon-xs": "size-6 rounded-xl p-0 has-[>svg]:p-0",
|
|
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
size: "xs",
|
|
},
|
|
}
|
|
)
|
|
|
|
function InputGroupButton({
|
|
className,
|
|
type = "button",
|
|
variant = "ghost",
|
|
size = "xs",
|
|
...props
|
|
}: Omit<React.ComponentProps<typeof Button>, "size" | "type"> &
|
|
VariantProps<typeof inputGroupButtonVariants> & {
|
|
type?: "button" | "submit" | "reset"
|
|
}) {
|
|
return (
|
|
<Button
|
|
type={type}
|
|
data-size={size}
|
|
variant={variant}
|
|
className={cn(inputGroupButtonVariants({ size }), className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
|
|
return (
|
|
<span
|
|
className={cn(
|
|
"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function InputGroupInput({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<"input">) {
|
|
return (
|
|
<Input
|
|
data-slot="input-group-control"
|
|
className={cn(
|
|
"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function InputGroupTextarea({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<"textarea">) {
|
|
return (
|
|
<Textarea
|
|
data-slot="input-group-control"
|
|
className={cn(
|
|
"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export {
|
|
InputGroup,
|
|
InputGroupAddon,
|
|
InputGroupButton,
|
|
InputGroupText,
|
|
InputGroupInput,
|
|
InputGroupTextarea,
|
|
}
|