Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

Refactor mobile UI primitives to shadcn components

tianma57618dbed70a
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index 6f316395..2008c26a 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -20,6 +20,20 @@ import {
CheckSquare,
} from "lucide-react";
import { Button } from "@/components/ui/button";
+import {
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/components/ui/command";
+import {
+ Drawer,
+ DrawerContent,
+ DrawerHeader,
+ DrawerTitle,
+} from "@/components/ui/drawer";
import {
DropdownMenu,
DropdownMenuContent,
@@ -44,16 +58,6 @@ import {
shouldQueueMemoSaveError,
queueMemoUpdate,
} from "@/lib/app-helpers";
-import { useDismissableLayer, useFloatingMenuControls, useBottomSheetSwipeToClose, useModalLayerControls } from "@/lib/app-hooks";
-
-const MobileSheetGrabber = ({ onPointerDown }: { onPointerDown?: (event: React.PointerEvent<HTMLDivElement>) => void }) => (
- <div
- className={cn("flex justify-center py-2 sm:hidden", onPointerDown && "cursor-grab touch-none active:cursor-grabbing")}
- onPointerDown={onPointerDown}
- >
- <div className="h-1 w-10 rounded-full bg-slate-300" />
- </div>
-);
const SUPPORTED_PASTE_IMAGE_TYPES = new Set(["image/png", "image/jpeg", "image/gif", "image/webp", "image/avif"]);
@@ -95,88 +99,6 @@ class MemoSaveRequestError extends Error {
}
}
-const MobileEditorActionsSheet = ({
- readOnly,
- onClose,
- onDelete,
- onOpenHistory,
- onPermanentDelete,
- onRestore,
-}: {
- readOnly: boolean;
- onClose: () => void;
- onDelete: () => void;
- onOpenHistory: () => void;
- onPermanentDelete: () => void;
- onRestore: () => void;
-}) => {
- const dialogRef = useRef<HTMLElement | null>(null);
- const handleSheetSwipePointerDown = useBottomSheetSwipeToClose(dialogRef, onClose);
- useModalLayerControls(dialogRef, onClose, { closeOnBrowserBack: true });
-
- return (
- <div className="fixed inset-0 z-50 bg-slate-950/25 lg:hidden" onClick={onClose}>
- <section
- ref={dialogRef}
- className="absolute inset-x-0 bottom-0 overflow-hidden rounded-t-md border-t border-slate-200 bg-white pb-[env(safe-area-inset-bottom)] shadow-[0_-16px_40px_rgba(15,23,42,0.16)]"
- role="dialog"
- aria-modal="true"
- aria-labelledby="mobile-editor-actions-title"
- onClick={(event) => event.stopPropagation()}
- >
- <MobileSheetGrabber onPointerDown={handleSheetSwipePointerDown} />
- <header className="flex h-12 items-center justify-between border-b border-slate-200 px-4">
- <div id="mobile-editor-actions-title" className="text-base font-semibold text-slate-950">
- 笔记操作
- </div>
- <Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
- <X className="h-4 w-4" />
- </Button>
- </header>
- <div className="p-2">
- <button
- className="flex h-12 w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium text-slate-800 transition hover:bg-slate-50"
- type="button"
- onClick={onOpenHistory}
- >
- <History className="h-5 w-5 text-slate-500" />
- <span className="min-w-0 flex-1 truncate text-base">版本历史</span>
- </button>
- {readOnly ? (
- <>
- <button
- className="flex h-12 w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium text-slate-800 transition hover:bg-slate-50"
- type="button"
- onClick={onRestore}
- >
- <RotateCcw className="h-5 w-5 text-slate-500" />
- <span className="min-w-0 flex-1 truncate text-base">恢复笔记</span>
- </button>
- <button
- className="flex h-12 w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium text-rose-700 transition hover:bg-rose-50"
- type="button"
- onClick={onPermanentDelete}
- >
- <Trash2 className="h-5 w-5" />
- <span className="min-w-0 flex-1 truncate text-base">彻底删除</span>
- </button>
- </>
- ) : (
- <button
- className="flex h-12 w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium text-rose-700 transition hover:bg-rose-50"
- type="button"
- onClick={onDelete}
- >
- <Trash2 className="h-5 w-5" />
- <span className="min-w-0 flex-1 truncate text-base">删除笔记</span>
- </button>
- )}
- </div>
- </section>
- </div>
- );
-};
-
const MobileNotebookSelectSheet = ({
isUpdating,
options,
@@ -190,10 +112,7 @@ const MobileNotebookSelectSheet = ({
onClose: () => void;
onSelect: (notebookId: string) => void;
}) => {
- const dialogRef = useRef<HTMLElement | null>(null);
const listRef = useRef<HTMLDivElement | null>(null);
- const handleSheetSwipePointerDown = useBottomSheetSwipeToClose(dialogRef, onClose);
- useModalLayerControls(dialogRef, onClose, { closeOnBrowserBack: true });
useEffect(() => {
window.setTimeout(() => {
@@ -205,49 +124,48 @@ const MobileNotebookSelectSheet = ({
}, [selectedNotebookId]);
return (
- <div className="fixed inset-0 z-50 bg-slate-950/25 lg:hidden" onClick={onClose}>
- <section
- ref={dialogRef}
- className="absolute inset-x-0 bottom-0 max-h-[62dvh] overflow-hidden rounded-t-md border-t border-slate-200 bg-white pb-[env(safe-area-inset-bottom)] shadow-[0_-16px_40px_rgba(15,23,42,0.16)]"
- role="dialog"
- aria-modal="true"
- aria-labelledby="mobile-notebook-select-title"
- onClick={(event) => event.stopPropagation()}
- >
- <MobileSheetGrabber onPointerDown={handleSheetSwipePointerDown} />
+ <Drawer open={true} onOpenChange={(open) => { if (!open) onClose(); }}>
+ <DrawerContent className="inset-x-0 max-h-[62dvh] overflow-hidden border-x-0 border-b-0 pb-[env(safe-area-inset-bottom)] lg:hidden">
<header className="flex h-12 items-center justify-between border-b border-slate-200 px-4">
- <div id="mobile-notebook-select-title" className="text-base font-semibold text-slate-950">
- 所在笔记本
- </div>
+ <DrawerHeader className="min-w-0 p-0">
+ <DrawerTitle className="text-base">所在笔记本</DrawerTitle>
+ </DrawerHeader>
<Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
<X className="h-4 w-4" />
</Button>
</header>
- <div ref={listRef} className="max-h-[calc(62dvh-3.75rem-env(safe-area-inset-bottom))] overflow-y-auto p-2">
- {options.map((option) => {
- const selected = option.id === selectedNotebookId;
- return (
- <button
- key={option.id}
- className={cn(
- "flex h-12 w-full items-center gap-2 rounded-md px-3 text-left text-sm transition",
- selected ? "bg-[#f3f7f1] font-semibold text-[#526d49]" : "text-slate-700 hover:bg-slate-50"
- )}
- style={{ paddingLeft: `${12 + option.depth * 18}px` }}
- type="button"
- data-mobile-notebook-select-id={option.id}
- aria-label={selected ? `当前所在笔记本:${option.name}` : `切换到 ${option.name}`}
- aria-current={selected ? "page" : undefined}
- disabled={isUpdating}
- onClick={() => onSelect(option.id)}
- >
- <span className="min-w-0 flex-1 truncate text-base">{option.name}</span>
- </button>
- );
- })}
- </div>
- </section>
- </div>
+ <Command className="min-h-0 flex-1">
+ <CommandInput placeholder="搜索笔记本" />
+ <CommandList ref={listRef} className="max-h-[calc(62dvh-6.25rem-env(safe-area-inset-bottom))] p-2">
+ <CommandEmpty>没有找到笔记本</CommandEmpty>
+ <CommandGroup>
+ {options.map((option) => {
+ const selected = option.id === selectedNotebookId;
+ return (
+ <CommandItem
+ key={option.id}
+ className={cn(
+ "h-12 px-3 text-base",
+ selected ? "bg-[#f3f7f1] font-semibold text-[#526d49] data-[selected=true]:bg-[#f3f7f1]" : "text-slate-700"
+ )}
+ style={{ paddingLeft: `${12 + option.depth * 18}px` }}
+ value={option.id}
+ keywords={[option.name, option.selectLabel, option.slug ?? ""]}
+ data-mobile-notebook-select-id={option.id}
+ aria-label={selected ? `当前所在笔记本:${option.name}` : `切换到 ${option.name}`}
+ aria-current={selected ? "page" : undefined}
+ disabled={isUpdating}
+ onSelect={() => onSelect(option.id)}
+ >
+ <span className="min-w-0 flex-1 truncate">{option.name}</span>
+ </CommandItem>
+ );
+ })}
+ </CommandGroup>
+ </CommandList>
+ </Command>
+ </DrawerContent>
+ </Drawer>
);
};
diff --git a/apps/web/src/components/LoginScreen.tsx b/apps/web/src/components/LoginScreen.tsx
index a2681245..29cdcb71 100644
--- a/apps/web/src/components/LoginScreen.tsx
+++ b/apps/web/src/components/LoginScreen.tsx
@@ -2,6 +2,7 @@ import { useState, type FormEvent } from "react";
import { LockKeyhole } from "lucide-react";
import { Button } from "@/components/ui/button";
import { GitHubRepositoryLink } from "@/components/GitHubRepositoryLink";
+import { Input } from "@/components/ui/input";
interface LoginScreenProps {
error: string | null;
@@ -43,9 +44,9 @@ export const LoginScreen = ({ error, isSubmitting, onSubmit }: LoginScreenProps)
<form className="space-y-5" onSubmit={handleSubmit}>
<label className="block">
<span className="mb-2 block text-sm font-semibold text-slate-700">账号</span>
- <input
+ <Input
autoComplete="username"
- className="h-11 w-full rounded-lg border border-slate-200 bg-slate-50/50 px-3.5 text-sm outline-none transition-all duration-200 focus:border-[#627f58] focus:bg-white focus:ring-4 focus:ring-[#627f58]/10"
+ className="h-11 rounded-lg bg-slate-50/50 px-3.5 focus-visible:bg-white focus-visible:ring-4 focus-visible:ring-[#627f58]/10"
value={username}
onChange={(event) => setUsername(event.target.value)}
/>
@@ -53,9 +54,9 @@ export const LoginScreen = ({ error, isSubmitting, onSubmit }: LoginScreenProps)
<label className="block">
<span className="mb-2 block text-sm font-semibold text-slate-700">密码</span>
- <input
+ <Input
autoComplete="current-password"
- className="h-11 w-full rounded-lg border border-slate-200 bg-slate-50/50 px-3.5 text-sm outline-none transition-all duration-200 focus:border-[#627f58] focus:bg-white focus:ring-4 focus:ring-[#627f58]/10"
+ className="h-11 rounded-lg bg-slate-50/50 px-3.5 focus-visible:bg-white focus-visible:ring-4 focus-visible:ring-[#627f58]/10"
type="password"
value={password}
onChange={(event) => setPassword(event.target.value)}
diff --git a/apps/web/src/components/MemoListPane.tsx b/apps/web/src/components/MemoListPane.tsx
index db617af0..2de9095a 100644
--- a/apps/web/src/components/MemoListPane.tsx
+++ b/apps/web/src/components/MemoListPane.tsx
@@ -38,7 +38,23 @@ import {
TagX,
} from "lucide-react";
import { Button } from "@/components/ui/button";
+import {
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/components/ui/command";
+import {
+ Drawer,
+ DrawerContent,
+ DrawerDescription,
+ DrawerHeader,
+ DrawerTitle,
+} from "@/components/ui/drawer";
import { GitHubRepositoryLink } from "@/components/GitHubRepositoryLink";
+import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import {
DropdownMenu,
DropdownMenuContent,
@@ -68,19 +84,9 @@ import {
readMemoListDensityPreference,
writeMemoListDensityPreference,
} from "@/lib/app-helpers";
-import { useDismissableLayer, useFloatingMenuControls, useBottomSheetSwipeToClose, useModalLayerControls } from "@/lib/app-hooks";
const isDesktopViewport = () => window.matchMedia("(min-width: 1024px)").matches;
-const MobileSheetGrabber = ({ onPointerDown }: { onPointerDown?: (event: React.PointerEvent<HTMLDivElement>) => void }) => (
- <div
- className={cn("flex justify-center py-2 sm:hidden", onPointerDown && "cursor-grab touch-none active:cursor-grabbing")}
- onPointerDown={onPointerDown}
- >
- <div className="h-1 w-10 rounded-full bg-slate-300" />
- </div>
-);
-
const getSelectionCountLabel = (count: number) => (count > 0 ? `已选择 ${count} 条` : "选择笔记");
const getMobileFilterIcon = (filterMode: MemoFilterMode) => {
@@ -155,31 +161,16 @@ const MobileListActionsSheet = ({
onOpenTrash: () => void;
onListDensityChange: (value: MemoListDensity) => void;
onSortModeChange: (value: MemoSortMode) => void;
-}) => {
- const dialogRef = useRef<HTMLElement | null>(null);
- const handleSheetSwipePointerDown = useBottomSheetSwipeToClose(dialogRef, onClose);
- useModalLayerControls(dialogRef, onClose, { closeOnBrowserBack: true });
-
- return (
- <div className="fixed inset-0 z-50 bg-slate-950/25 px-3 pb-[calc(5.25rem+env(safe-area-inset-bottom))] lg:hidden" onClick={onClose}>
- <section
- ref={dialogRef}
- className="absolute inset-x-3 bottom-[calc(5.25rem+env(safe-area-inset-bottom))] max-h-[calc(100dvh_-_6.75rem_-_env(safe-area-inset-bottom))] overflow-hidden rounded-md border border-slate-200 bg-white shadow-panel"
- role="dialog"
- aria-modal="true"
- aria-labelledby="mobile-list-actions-title"
- onClick={(event) => event.stopPropagation()}
- >
- <MobileSheetGrabber onPointerDown={handleSheetSwipePointerDown} />
+}) => (
+ <Drawer open={true} onOpenChange={(open) => { if (!open) onClose(); }}>
+ <DrawerContent className="bottom-[calc(5.25rem+env(safe-area-inset-bottom))] max-h-[calc(100dvh_-_6.75rem_-_env(safe-area-inset-bottom))] overflow-hidden rounded-md lg:hidden">
<header className="flex h-12 items-center justify-between border-b border-slate-200 px-4">
- <div className="min-w-0">
- <div id="mobile-list-actions-title" className="truncate text-sm font-semibold text-slate-950">
- 列表选项
- </div>
- <div className="truncate text-xs text-slate-500">
+ <DrawerHeader className="min-w-0 p-0">
+ <DrawerTitle className="truncate">列表选项</DrawerTitle>
+ <DrawerDescription className="truncate">
{listTitle} · {listDescription}
- </div>
- </div>
+ </DrawerDescription>
+ </DrawerHeader>
<Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
<X className="h-4 w-4" />
</Button>
@@ -198,22 +189,30 @@ const MobileListActionsSheet = ({
)}
<div className="px-3 py-2 text-xs font-semibold text-slate-400">显示方式</div>
- {memoListDensityOptions.map((option) => (
- <button
- key={option.value}
- className={cn(
- "flex h-11 w-full items-center gap-3 rounded-md px-3 text-left text-sm font-medium transition",
- listDensity === option.value ? "bg-[#f3f7f1] text-[#526d49]" : "text-slate-800 hover:bg-slate-50"
- )}
- type="button"
- aria-pressed={listDensity === option.value}
- onClick={() => onListDensityChange(option.value)}
- >
- <span className={listDensity === option.value ? "text-[#627f58]" : "text-slate-500"}>{option.icon}</span>
- <span className="min-w-0 flex-1 truncate">{option.label}</span>
- <CheckCircleCheck className={cn("h-4 w-4 shrink-0", listDensity === option.value ? "text-[#627f58]" : "text-transparent")} />
- </button>
- ))}
+ <ToggleGroup
+ className="flex-col items-stretch"
+ type="single"
+ value={listDensity}
+ onValueChange={(value) => {
+ if (value) {
+ onListDensityChange(value as MemoListDensity);
+ }
+ }}
+ >
+ {memoListDensityOptions.map((option) => (
+ <ToggleGroupItem
+ key={option.value}
+ className="h-11 w-full justify-start gap-3 rounded-md px-3 text-left text-sm data-[state=on]:bg-[#f3f7f1] data-[state=on]:text-[#526d49]"
+ size="default"
+ value={option.value}
+ aria-label={option.label}
+ >
+ <span className={listDensity === option.value ? "text-[#627f58]" : "text-slate-500"}>{option.icon}</span>
+ <span className="min-w-0 flex-1 truncate">{option.label}</span>
+ <CheckCircleCheck className={cn("h-4 w-4 shrink-0", listDensity === option.value ? "text-[#627f58]" : "text-transparent")} />
+ </ToggleGroupItem>
+ ))}
+ </ToggleGroup>
<div className="my-2 h-px bg-slate-100" />
@@ -241,10 +240,9 @@ const MobileListActionsSheet = ({
<MobileListActionButton icon={<Trash2 className="h-4 w-4" />} label="回收站" onClick={onOpenTrash} />
<MobileListActionButton icon={<KeyRound className="h-4 w-4" />} label="MCP Token" onClick={onOpenSettings} />
</div>
- </section>
- </div>
- );
-};
+ </DrawerContent>
+ </Drawer>
+);
const MobileSelectionActionButton = ({
disabled = false,
@@ -330,122 +328,65 @@ const MobileMoveSheet = ({
onClose: () => void;
onMove: (notebookId: string) => void;
}) => {
- const dialogRef = useRef<HTMLElement | null>(null);
const listRef = useRef<HTMLDivElement | null>(null);
- const handleSheetSwipePointerDown = useBottomSheetSwipeToClose(dialogRef, onClose);
- const [notebookSearch, setNotebookSearch] = useState("");
const options = useMemo(() => getNotebookMoveOptions(notebooks), [notebooks]);
const selectedCountLabel = getSelectionCountLabel(selectedCount);
- const moveSearchQuery = notebookSearch.trim().toLocaleLowerCase("zh-CN");
-
- const filteredOptions = useMemo(() => {
- if (!moveSearchQuery) {
- return options;
- }
- return options.filter((option) =>
- [option.name, option.selectLabel, option.slug ?? ""].some((value) =>
- value.toLocaleLowerCase("zh-CN").includes(moveSearchQuery)
- )
- );
- }, [moveSearchQuery, options]);
-
- useModalLayerControls(dialogRef, onClose, { closeOnBrowserBack: true });
useEffect(() => {
- if (moveSearchQuery) {
- return;
- }
window.setTimeout(() => {
const selectedNode = listRef.current?.querySelector<HTMLElement>(
`[data-mobile-move-notebook-id="${CSS.escape(selectedNotebookId)}"]`
);
selectedNode?.scrollIntoView({ block: "center" });
}, 0);
- }, [moveSearchQuery, selectedNotebookId]);
+ }, [selectedNotebookId]);
return (
- <div className="fixed inset-0 z-50 bg-slate-950/25 px-3 pb-[calc(5.25rem+env(safe-area-inset-bottom))] lg:hidden" onClick={onClose}>
- <section
- ref={dialogRef}
- className="absolute inset-x-3 bottom-[calc(5.25rem+env(safe-area-inset-bottom))] max-h-[calc(100dvh_-_6.75rem_-_env(safe-area-inset-bottom))] overflow-hidden rounded-md border border-slate-200 bg-white shadow-panel"
- role="dialog"
- aria-modal="true"
- aria-labelledby="mobile-move-sheet-title"
- onClick={(event) => event.stopPropagation()}
- >
- <MobileSheetGrabber onPointerDown={handleSheetSwipePointerDown} />
+ <Drawer open={true} onOpenChange={(open) => { if (!open) onClose(); }}>
+ <DrawerContent className="bottom-[calc(5.25rem+env(safe-area-inset-bottom))] max-h-[calc(100dvh_-_6.75rem_-_env(safe-area-inset-bottom))] overflow-hidden rounded-md lg:hidden">
<header className="flex h-12 items-center justify-between border-b border-slate-200 px-4">
- <div className="min-w-0">
- <div id="mobile-move-sheet-title" className="truncate text-sm font-semibold text-slate-950">
- 移动到笔记本
- </div>
- <div className="truncate text-xs text-slate-500">{selectedCountLabel}</div>
- </div>
+ <DrawerHeader className="min-w-0 p-0">
+ <DrawerTitle className="truncate">移动到笔记本</DrawerTitle>
+ <DrawerDescription className="truncate">{selectedCountLabel}</DrawerDescription>
+ </DrawerHeader>
<Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
<X className="h-4 w-4" />
</Button>
</header>
- <div className="border-b border-slate-100 px-3 py-2">
- <div className="flex h-9 items-center gap-2 rounded-md bg-slate-100 px-3 text-sm text-slate-500">
- <Search className="h-4 w-4" />
- <input
- className="min-w-0 flex-1 bg-transparent text-slate-900 outline-none placeholder:text-slate-400"
- value={notebookSearch}
- placeholder="搜索笔记本"
- aria-label="搜索笔记本"
- onChange={(event) => setNotebookSearch(event.target.value)}
- onKeyDown={(event) => {
- if (event.key === "Escape" && notebookSearch) {
- event.preventDefault();
- setNotebookSearch("");
- }
- }}
- />
- {notebookSearch && (
- <button
- className="flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-slate-400 transition hover:bg-white hover:text-slate-700"
- type="button"
- title="清空搜索"
- aria-label="清空搜索"
- onMouseDown={(event) => event.preventDefault()}
- onClick={() => setNotebookSearch("")}
- >
- <X className="h-3.5 w-3.5" />
- </button>
- )}
- </div>
- </div>
- <div ref={listRef} className="max-h-[calc(100dvh_-_13.75rem_-_env(safe-area-inset-bottom))] overflow-y-auto p-2">
- {filteredOptions.length > 0 ? (
- filteredOptions.map((option: any) => {
- const selected = option.id === selectedNotebookId;
- return (
- <button
- key={option.id}
- className={cn(
- "flex h-11 w-full items-center gap-2 rounded-md px-3 text-left text-sm transition",
- selected ? "bg-[#f3f7f1] font-semibold text-[#526d49]" : "text-slate-700 hover:bg-slate-50"
- )}
- style={{ paddingLeft: `${12 + option.depth * 18}px` }}
- type="button"
- data-mobile-move-notebook-id={option.id}
- aria-label={selected ? `当前目标:${option.name}` : `移动到 ${option.name}`}
- aria-pressed={selected}
- disabled={isMoving}
- onClick={() => onMove(option.id)}
- >
- <NotebookIcon className={cn("h-4 w-4 shrink-0", selected ? "text-[#627f58]" : "text-slate-600")} />
- <span className="min-w-0 flex-1 truncate">{option.name}</span>
- {selected ? <CheckCircleCheck className="h-4 w-4 shrink-0 text-[#627f58]" /> : null}
- </button>
- );
- })
- ) : (
- <div className="px-3 py-8 text-center text-sm font-medium text-slate-500">没有找到笔记本</div>
- )}
- </div>
- </section>
- </div>
+ <Command className="min-h-0 flex-1">
+ <CommandInput placeholder="搜索笔记本" />
+ <CommandList ref={listRef} className="max-h-[calc(100dvh_-_13.75rem_-_env(safe-area-inset-bottom))] p-2">
+ <CommandEmpty>没有找到笔记本</CommandEmpty>
+ <CommandGroup>
+ {options.map((option: any) => {
+ const selected = option.id === selectedNotebookId;
+ return (
+ <CommandItem
+ key={option.id}
+ className={cn(
+ "h-11 gap-2 px-3",
+ selected ? "bg-[#f3f7f1] font-semibold text-[#526d49] data-[selected=true]:bg-[#f3f7f1]" : "text-slate-700"
+ )}
+ style={{ paddingLeft: `${12 + option.depth * 18}px` }}
+ value={option.id}
+ keywords={[option.name, option.selectLabel, option.slug ?? ""]}
+ data-mobile-move-notebook-id={option.id}
+ aria-label={selected ? `当前目标:${option.name}` : `移动到 ${option.name}`}
+ aria-current={selected ? "page" : undefined}
+ disabled={isMoving}
+ onSelect={() => onMove(option.id)}
+ >
+ <NotebookIcon className={cn("h-4 w-4 shrink-0", selected ? "text-[#627f58]" : "text-slate-600")} />
+ <span className="min-w-0 flex-1 truncate">{option.name}</span>
+ {selected ? <CheckCircleCheck className="h-4 w-4 shrink-0 text-[#627f58]" /> : null}
+ </CommandItem>
+ );
+ })}
+ </CommandGroup>
+ </CommandList>
+ </Command>
+ </DrawerContent>
+ </Drawer>
);
};
@@ -479,29 +420,14 @@ const MobileSelectionMoreSheet = ({
onMerge: () => void;
onPin: () => void;
onToggleVisibleSelection: () => void;
-}) => {
- const dialogRef = useRef<HTMLElement | null>(null);
- const handleSheetSwipePointerDown = useBottomSheetSwipeToClose(dialogRef, onClose);
- useModalLayerControls(dialogRef, onClose, { closeOnBrowserBack: true });
-
- return (
- <div className="fixed inset-0 z-50 bg-slate-950/25 px-3 pb-[calc(5.25rem+env(safe-area-inset-bottom))] lg:hidden" onClick={onClose}>
- <section
- ref={dialogRef}
- className="absolute inset-x-3 bottom-[calc(5.25rem+env(safe-area-inset-bottom))] max-h-[calc(100dvh_-_6.75rem_-_env(safe-area-inset-bottom))] overflow-hidden rounded-md border border-slate-200 bg-white shadow-panel"
- role="dialog"
- aria-modal="true"
- aria-labelledby="mobile-selection-more-title"
- onClick={(event) => event.stopPropagation()}
- >
- <MobileSheetGrabber onPointerDown={handleSheetSwipePointerDown} />
+}) => (
+ <Drawer open={true} onOpenChange={(open) => { if (!open) onClose(); }}>
+ <DrawerContent className="bottom-[calc(5.25rem+env(safe-area-inset-bottom))] max-h-[calc(100dvh_-_6.75rem_-_env(safe-area-inset-bottom))] overflow-hidden rounded-md lg:hidden">
<header className="flex h-12 items-center justify-between border-b border-slate-200 px-4">
- <div className="min-w-0">
- <div id="mobile-selection-more-title" className="truncate text-sm font-semibold text-slate-950">
- 批量操作
- </div>
- <div className="truncate text-xs text-slate-500">{getSelectionCountLabel(selectedCount)}</div>
- </div>
+ <DrawerHeader className="min-w-0 p-0">
+ <DrawerTitle className="truncate">批量操作</DrawerTitle>
+ <DrawerDescription className="truncate">{getSelectionCountLabel(selectedCount)}</DrawerDescription>
+ </DrawerHeader>
<Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
<X className="h-4 w-4" />
</Button>
@@ -546,10 +472,9 @@ const MobileSelectionMoreSheet = ({
<X className="h-4 w-4" />
取消选择
</button>
- </section>
- </div>
- );
-};
+ </DrawerContent>
+ </Drawer>
+);
const CheckCircleCheck = ({ className }: { className?: string }) => (
<svg
@@ -1368,34 +1293,35 @@ export const MemoListPane = ({
</DropdownMenuContent>
</DropdownMenu>
- <div className="flex h-8 shrink-0 overflow-hidden rounded-md border border-slate-200 bg-white">
- <button
- className={cn(
- "flex h-8 w-8 shrink-0 items-center justify-center transition",
- listDensity === "preview" ? "bg-emerald-50 text-emerald-800" : "text-slate-500 hover:bg-slate-50 hover:text-slate-900"
- )}
- type="button"
+ <ToggleGroup
+ className="h-8 shrink-0 overflow-hidden rounded-md border border-slate-200 bg-white"
+ type="single"
+ value={listDensity}
+ onValueChange={(value) => {
+ if (value) {
+ handleListDensityChange(value as MemoListDensity);
+ }
+ }}
+ >
+ <ToggleGroupItem
+ className="rounded-none border-0"
+ size="icon"
title="预览列表"
+ value="preview"
aria-label="预览列表"
- aria-pressed={listDensity === "preview"}
- onClick={() => handleListDensityChange("preview")}
>
<LayoutList className="h-4 w-4" />
- </button>
- <button
- className={cn(
- "flex h-8 w-8 shrink-0 items-center justify-center border-l border-slate-200 transition",
- listDensity === "compact" ? "bg-emerald-50 text-emerald-800" : "text-slate-500 hover:bg-slate-50 hover:text-slate-900"
- )}
- type="button"
+ </ToggleGroupItem>
+ <ToggleGroupItem
+ className="rounded-none border-0 border-l border-slate-200"
+ size="icon"
title="紧凑列表"
+ value="compact"
aria-label="紧凑列表"
- aria-pressed={listDensity === "compact"}
- onClick={() => handleListDensityChange("compact")}
>
<List className="h-4 w-4" />
- </button>
- </div>
+ </ToggleGroupItem>
+ </ToggleGroup>
</div>
<div className="flex shrink-0 items-center gap-1">
<DropdownMenu>
diff --git a/apps/web/src/components/SettingsPane.tsx b/apps/web/src/components/SettingsPane.tsx
index d98afc01..51a45b9d 100644
--- a/apps/web/src/components/SettingsPane.tsx
+++ b/apps/web/src/components/SettingsPane.tsx
@@ -2,6 +2,8 @@ import { useState, type FormEvent } from "react";
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { KeyRound, ShieldCheck, Trash2, ChevronLeft, Plus, User, Image, LogOut } from "lucide-react";
import { Button } from "@/components/ui/button";
+import { Checkbox } from "@/components/ui/checkbox";
+import { Input } from "@/components/ui/input";
import { Switch } from "@/components/ui/switch";
import { api } from "@/lib/api";
import { cn, formatDateTime } from "@/lib/utils";
@@ -168,8 +170,8 @@ export const SettingsPane = ({
API Token 已成功生成
</div>
<div className="flex gap-2">
- <input
- className="h-10 min-w-0 flex-1 rounded-lg border border-emerald-200 bg-white px-3.5 font-mono text-xs text-slate-900 outline-none focus:ring-2 focus:ring-emerald-500/20"
+ <Input
+ className="min-w-0 flex-1 rounded-lg border-emerald-200 font-mono text-xs focus-visible:ring-emerald-500/20"
readOnly
value={createdToken.token}
/>
@@ -191,8 +193,8 @@ export const SettingsPane = ({
<form className="space-y-4 rounded-lg bg-slate-50/60 border border-slate-100 p-4" onSubmit={handleSubmit}>
<div className="flex flex-col gap-3 sm:flex-row">
- <input
- className="h-10 min-w-0 flex-1 rounded-lg border border-slate-200 bg-white px-3.5 text-sm outline-none transition duration-150 focus:border-[#627f58] focus:ring-4 focus:ring-[#627f58]/10"
+ <Input
+ className="min-w-0 flex-1 rounded-lg focus-visible:ring-4 focus-visible:ring-[#627f58]/10"
value={name}
onChange={(event) => setName(event.target.value)}
placeholder="Token 用途描述,例如: Cline Agent"
@@ -222,11 +224,10 @@ export const SettingsPane = ({
: "border-slate-200 bg-white text-slate-600 hover:bg-slate-50/50"
)}
>
- <input
- type="checkbox"
+ <Checkbox
checked={selectedScopes.has(scope)}
- onChange={() => toggleScope(scope)}
- className="h-4 w-4 shrink-0 rounded border-emerald-300 text-[#627f58] focus:ring-[#627f58]"
+ onCheckedChange={() => toggleScope(scope)}
+ className="border-emerald-300"
/>
<span className="min-w-0 truncate font-mono text-[11px] font-semibold">{scope}</span>
</label>
diff --git a/apps/web/src/components/WorkspaceApp.tsx b/apps/web/src/components/WorkspaceApp.tsx
index 4b4b441d..9fba27a5 100644
--- a/apps/web/src/components/WorkspaceApp.tsx
+++ b/apps/web/src/components/WorkspaceApp.tsx
@@ -13,6 +13,13 @@ import {
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { Home, Search, KeyRound, Plus, ChevronDown, ChevronRight, X } from "lucide-react";
import { Button } from "@/components/ui/button";
+import {
+ Drawer,
+ DrawerContent,
+ DrawerDescription,
+ DrawerHeader,
+ DrawerTitle,
+} from "@/components/ui/drawer";
import { NotebookPane } from "./NotebookPane";
import { MemoListPane } from "./MemoListPane";
import { EditorPane } from "./EditorPane";
@@ -60,19 +67,10 @@ import {
syncQueuedChanges,
observeSyncQueue,
} from "@/lib/app-helpers";
-import { useBrowserBackLayer, useBottomSheetSwipeToClose, useModalLayerControls } from "@/lib/app-hooks";
+import { useBrowserBackLayer } from "@/lib/app-hooks";
const isDesktopViewport = () => window.matchMedia("(min-width: 1024px)").matches;
-const MobileSheetGrabber = ({ onPointerDown }: { onPointerDown?: (event: React.PointerEvent<HTMLDivElement>) => void }) => (
- <div
- className={cn("flex justify-center py-2 sm:hidden", onPointerDown && "cursor-grab touch-none active:cursor-grabbing")}
- onPointerDown={onPointerDown}
- >
- <div className="h-1 w-10 rounded-full bg-slate-300" />
- </div>
-);
-
const MobileBottomNavButton = ({
active = false,
icon,
@@ -151,9 +149,7 @@ const MobileNotebookPicker = ({
onSelectAll: () => void;
onSelect: (notebookId: string) => void;
}) => {
- const dialogRef = useRef<HTMLElement | null>(null);
const listRef = useRef<HTMLDivElement | null>(null);
- const handleSheetSwipePointerDown = useBottomSheetSwipeToClose(dialogRef, onClose);
const [notebookSearch, setNotebookSearch] = useState("");
const tree = useMemo(() => buildNotebookTree(notebooks), [notebooks]);
const filteredTree = useMemo(() => filterNotebookTree(tree, notebookSearch), [notebookSearch, tree]);
@@ -171,8 +167,6 @@ const MobileNotebookPicker = ({
const allNotebookBranchesExpanded =
expandableNotebookIds.length > 0 && expandableNotebookIds.every((notebookId) => expandedNotebookIds.has(notebookId));
- useModalLayerControls(dialogRef, onClose, { closeOnBrowserBack: true });
-
useEffect(() => {
if (selectedAncestorIds.length === 0) {
return;
@@ -215,23 +209,13 @@ const MobileNotebookPicker = ({
};
return (
- <div className="fixed inset-0 z-50 bg-slate-950/30 lg:hidden" onClick={onClose}>
- <section
- ref={dialogRef}
- className="absolute inset-x-0 bottom-0 max-h-[82dvh] overflow-hidden rounded-t-md border-t border-slate-200 bg-white pb-[env(safe-area-inset-bottom)] shadow-[0_-16px_40px_rgba(15,23,42,0.16)]"
- role="dialog"
- aria-modal="true"
- aria-labelledby="mobile-notebook-picker-title"
- onClick={(event) => event.stopPropagation()}
- >
- <MobileSheetGrabber onPointerDown={handleSheetSwipePointerDown} />
+ <Drawer open={true} onOpenChange={(open) => { if (!open) onClose(); }}>
+ <DrawerContent className="inset-x-0 max-h-[82dvh] overflow-hidden border-x-0 border-b-0 pb-[env(safe-area-inset-bottom)] lg:hidden">
<header className="flex h-14 items-center justify-between border-b border-slate-200 px-4">
- <div className="min-w-0">
- <div id="mobile-notebook-picker-title" className="text-base font-semibold text-slate-950">
- 切换笔记本
- </div>
- <div className="truncate text-xs text-slate-500">当前:{selectedNotebookName}</div>
- </div>
+ <DrawerHeader className="min-w-0 p-0">
+ <DrawerTitle className="text-base">切换笔记本</DrawerTitle>
+ <DrawerDescription className="truncate">当前:{selectedNotebookName}</DrawerDescription>
+ </DrawerHeader>
<Button size="icon" variant="ghost" title="关闭" aria-label="关闭" onClick={onClose}>
<X className="h-4 w-4" />
</Button>
@@ -326,8 +310,8 @@ const MobileNotebookPicker = ({
</div>
)}
</div>
- </section>
- </div>
+ </DrawerContent>
+ </Drawer>
);
};
@@ -497,10 +481,13 @@ export const WorkspaceApp = ({
const workspaceBackTargetActive = Boolean(
appNoticeDialog ||
notebookDeleteConfirmation ||
- notebookNameDialog ||
- memoDeleteConfirmation ||
- mobileNotebookPickerOpen ||
- mobileSearchActive ||
+ notebookNameDialog ||
+ memoDeleteConfirmation ||
+ mobileNotebookPickerOpen ||
+ mobileListActionsOpen ||
+ mobileMoveOpen ||
+ mobileMoreOpen ||
+ mobileSearchActive ||
templatesOpen ||
rightView !== "editor" ||
tagsOpen ||
@@ -1130,13 +1117,28 @@ export const WorkspaceApp = ({
return true;
}
- if (mobileNotebookPickerOpen) {
- setMobileNotebookPickerOpen(false);
- return true;
- }
+ if (mobileNotebookPickerOpen) {
+ setMobileNotebookPickerOpen(false);
+ return true;
+ }
+
+ if (mobileListActionsOpen) {
+ setMobileListActionsOpen(false);
+ return true;
+ }
- if (mobileSearchActive) {
- handleCancelMobileSearch();
+ if (mobileMoveOpen) {
+ setMobileMoveOpen(false);
+ return true;
+ }
+
+ if (mobileMoreOpen) {
+ setMobileMoreOpen(false);
+ return true;
+ }
+
+ if (mobileSearchActive) {
+ handleCancelMobileSearch();
return true;
}
@@ -1184,10 +1186,13 @@ export const WorkspaceApp = ({
handleCloseSettings,
handleCloseTemplates,
handleCancelMobileSearch,
- memoDeleteConfirmation,
- memoSelectionModeActive,
- mobileNotebookPickerOpen,
- mobileSearchActive,
+ memoDeleteConfirmation,
+ memoSelectionModeActive,
+ mobileListActionsOpen,
+ mobileNotebookPickerOpen,
+ mobileMoveOpen,
+ mobileMoreOpen,
+ mobileSearchActive,
notebookDeleteConfirmation,
notebookNameDialog,
tagsOpen,
diff --git a/apps/web/src/components/dialogs/ConfirmDialogs.tsx b/apps/web/src/components/dialogs/ConfirmDialogs.tsx
index ed206030..7a7c14a6 100644
--- a/apps/web/src/components/dialogs/ConfirmDialogs.tsx
+++ b/apps/web/src/components/dialogs/ConfirmDialogs.tsx
@@ -2,6 +2,7 @@ import { useState, useEffect, useRef } from "react";
import { AlertTriangle, ShieldCheck, X } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from "@/components/ui/dialog";
+import { Input } from "@/components/ui/input";
import { cn } from "@/lib/utils";
import type { Notebook } from "@edgeever/shared";
@@ -160,10 +161,10 @@ export const NotebookNameDialog = ({
<label className="block text-xs font-semibold uppercase text-slate-500" htmlFor="notebook-name-input">
名称
</label>
- <input
+ <Input
id="notebook-name-input"
ref={inputRef}
- className="mt-2 h-11 w-full rounded-md border border-slate-200 bg-white px-3 text-base text-slate-950 outline-none transition placeholder:text-slate-400 focus:border-emerald-300 focus:ring-2 focus:ring-emerald-500/20"
+ className="mt-2 h-11 text-base focus-visible:border-emerald-300 focus-visible:ring-emerald-500/20"
value={name}
disabled={isSaving}
maxLength={80}
diff --git a/apps/web/src/components/dialogs/TagsDialog.tsx b/apps/web/src/components/dialogs/TagsDialog.tsx
index fd4946f9..0c14fc20 100644
--- a/apps/web/src/components/dialogs/TagsDialog.tsx
+++ b/apps/web/src/components/dialogs/TagsDialog.tsx
@@ -3,6 +3,7 @@ import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { Tags, X, Pencil, Trash2 } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "@/components/ui/dialog";
+import { Input } from "@/components/ui/input";
import { api } from "@/lib/api";
import { cn, formatDateTime } from "@/lib/utils";
import { AppConfirmDialog } from "./ConfirmDialogs";
@@ -117,9 +118,9 @@ export const TagsDialog = ({ onClose }: { onClose: () => void }) => {
<label className="sr-only" htmlFor={`tag-rename-${tag.name}`}>
标签名称
</label>
- <input
+ <Input
id={`tag-rename-${tag.name}`}
- className="h-9 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-3 text-sm text-slate-950 outline-none transition focus:border-emerald-300 focus:ring-2 focus:ring-emerald-500/20"
+ className="h-9 min-w-0 flex-1 focus-visible:border-emerald-300 focus-visible:ring-emerald-500/20"
value={editingTagValue}
autoFocus
disabled={renameMutation.isPending}
diff --git a/apps/web/src/components/ui/checkbox.tsx b/apps/web/src/components/ui/checkbox.tsx
new file mode 100644
index 00000000..0c427088
--- /dev/null
+++ b/apps/web/src/components/ui/checkbox.tsx
@@ -0,0 +1,25 @@
+import * as React from "react";
+import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
+import { Check } from "lucide-react";
+import { cn } from "@/lib/utils";
+
+const Checkbox = React.forwardRef<
+ React.ElementRef<typeof CheckboxPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
+>(({ className, ...props }, ref) => (
+ <CheckboxPrimitive.Root
+ ref={ref}
+ className={cn(
+ "peer h-4 w-4 shrink-0 rounded border border-slate-300 bg-white text-white shadow-sm outline-none transition focus-visible:ring-2 focus-visible:ring-[#627f58]/70 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-[#627f58] data-[state=checked]:bg-[#627f58]",
+ className
+ )}
+ {...props}
+ >
+ <CheckboxPrimitive.Indicator className="flex items-center justify-center text-current">
+ <Check className="h-3.5 w-3.5 stroke-[3]" />
+ </CheckboxPrimitive.Indicator>
+ </CheckboxPrimitive.Root>
+));
+Checkbox.displayName = CheckboxPrimitive.Root.displayName;
+
+export { Checkbox };
diff --git a/apps/web/src/components/ui/command.tsx b/apps/web/src/components/ui/command.tsx
new file mode 100644
index 00000000..c56a865c
--- /dev/null
+++ b/apps/web/src/components/ui/command.tsx
@@ -0,0 +1,111 @@
+import * as React from "react";
+import { Command as CommandPrimitive } from "cmdk";
+import { Search } from "lucide-react";
+import { cn } from "@/lib/utils";
+
+const Command = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive
+ ref={ref}
+ className={cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-white text-slate-950", className)}
+ {...props}
+ />
+));
+Command.displayName = CommandPrimitive.displayName;
+
+const CommandInput = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Input>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
+>(({ className, ...props }, ref) => (
+ <div className="flex h-10 items-center gap-2 border-b border-slate-100 px-3" cmdk-input-wrapper="">
+ <Search className="h-4 w-4 shrink-0 text-slate-400" />
+ <CommandPrimitive.Input
+ ref={ref}
+ className={cn(
+ "flex h-10 w-full rounded-md bg-transparent py-2 text-sm text-slate-950 outline-none placeholder:text-slate-400 disabled:cursor-not-allowed disabled:opacity-50",
+ className
+ )}
+ {...props}
+ />
+ </div>
+));
+CommandInput.displayName = CommandPrimitive.Input.displayName;
+
+const CommandList = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.List>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.List
+ ref={ref}
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
+ {...props}
+ />
+));
+CommandList.displayName = CommandPrimitive.List.displayName;
+
+const CommandEmpty = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Empty>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
+>((props, ref) => (
+ <CommandPrimitive.Empty ref={ref} className="py-8 text-center text-sm text-slate-500" {...props} />
+));
+CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
+
+const CommandGroup = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Group>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.Group
+ ref={ref}
+ className={cn(
+ "overflow-hidden p-1 text-slate-950 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:text-slate-400",
+ className
+ )}
+ {...props}
+ />
+));
+CommandGroup.displayName = CommandPrimitive.Group.displayName;
+
+const CommandSeparator = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Separator>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.Separator ref={ref} className={cn("-mx-1 h-px bg-slate-100", className)} {...props} />
+));
+CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
+
+const CommandItem = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.Item
+ ref={ref}
+ className={cn(
+ "relative flex min-h-10 cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-slate-100 data-[selected=true]:text-slate-950 data-[disabled=true]:opacity-50",
+ className
+ )}
+ {...props}
+ />
+));
+CommandItem.displayName = CommandPrimitive.Item.displayName;
+
+const CommandShortcut = ({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLSpanElement>) => (
+ <span className={cn("ml-auto text-xs tracking-widest text-slate-500", className)} {...props} />
+);
+CommandShortcut.displayName = "CommandShortcut";
+
+export {
+ Command,
+ CommandInput,
+ CommandList,
+ CommandEmpty,
+ CommandGroup,
+ CommandItem,
+ CommandSeparator,
+ CommandShortcut,
+};
diff --git a/apps/web/src/components/ui/drawer.tsx b/apps/web/src/components/ui/drawer.tsx
new file mode 100644
index 00000000..9205e01d
--- /dev/null
+++ b/apps/web/src/components/ui/drawer.tsx
@@ -0,0 +1,101 @@
+import * as React from "react";
+import { Drawer as DrawerPrimitive } from "vaul";
+import { cn } from "@/lib/utils";
+
+const Drawer = ({
+ shouldScaleBackground = true,
+ ...props
+}: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
+ <DrawerPrimitive.Root shouldScaleBackground={shouldScaleBackground} {...props} />
+);
+Drawer.displayName = "Drawer";
+
+const DrawerTrigger = DrawerPrimitive.Trigger;
+const DrawerPortal = DrawerPrimitive.Portal;
+const DrawerClose = DrawerPrimitive.Close;
+
+const DrawerOverlay = React.forwardRef<
+ React.ElementRef<typeof DrawerPrimitive.Overlay>,
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
+>(({ className, ...props }, ref) => (
+ <DrawerPrimitive.Overlay
+ ref={ref}
+ className={cn("fixed inset-0 z-50 bg-slate-950/25", className)}
+ {...props}
+ />
+));
+DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
+
+const DrawerContent = React.forwardRef<
+ React.ElementRef<typeof DrawerPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
+>(({ className, children, ...props }, ref) => (
+ <DrawerPortal>
+ <DrawerOverlay />
+ <DrawerPrimitive.Content
+ ref={ref}
+ className={cn(
+ "fixed inset-x-3 bottom-0 z-50 mt-24 flex max-h-[calc(100dvh_-_1rem_-_env(safe-area-inset-bottom))] flex-col rounded-t-md border border-slate-200 bg-white shadow-panel outline-none",
+ className
+ )}
+ {...props}
+ >
+ <div className="mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-slate-300" />
+ {children}
+ </DrawerPrimitive.Content>
+ </DrawerPortal>
+));
+DrawerContent.displayName = "DrawerContent";
+
+const DrawerHeader = ({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLDivElement>) => (
+ <div className={cn("grid gap-1.5 px-4 py-3 text-left", className)} {...props} />
+);
+DrawerHeader.displayName = "DrawerHeader";
+
+const DrawerFooter = ({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLDivElement>) => (
+ <div className={cn("mt-auto flex flex-col gap-2 p-4", className)} {...props} />
+);
+DrawerFooter.displayName = "DrawerFooter";
+
+const DrawerTitle = React.forwardRef<
+ React.ElementRef<typeof DrawerPrimitive.Title>,
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
+>(({ className, ...props }, ref) => (
+ <DrawerPrimitive.Title
+ ref={ref}
+ className={cn("text-sm font-semibold leading-none text-slate-950", className)}
+ {...props}
+ />
+));
+DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
+
+const DrawerDescription = React.forwardRef<
+ React.ElementRef<typeof DrawerPrimitive.Description>,
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
+>(({ className, ...props }, ref) => (
+ <DrawerPrimitive.Description
+ ref={ref}
+ className={cn("text-xs text-slate-500", className)}
+ {...props}
+ />
+));
+DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
+
+export {
+ Drawer,
+ DrawerPortal,
+ DrawerOverlay,
+ DrawerTrigger,
+ DrawerClose,
+ DrawerContent,
+ DrawerHeader,
+ DrawerFooter,
+ DrawerTitle,
+ DrawerDescription,
+};
diff --git a/apps/web/src/components/ui/input.tsx b/apps/web/src/components/ui/input.tsx
new file mode 100644
index 00000000..a06292f3
--- /dev/null
+++ b/apps/web/src/components/ui/input.tsx
@@ -0,0 +1,19 @@
+import * as React from "react";
+import { cn } from "@/lib/utils";
+
+export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
+
+const Input = React.forwardRef<HTMLInputElement, InputProps>(({ className, type, ...props }, ref) => (
+ <input
+ ref={ref}
+ type={type}
+ className={cn(
+ "flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 text-sm text-slate-950 outline-none transition placeholder:text-slate-400 focus-visible:border-[#627f58] focus-visible:ring-2 focus-visible:ring-[#627f58]/20 disabled:cursor-not-allowed disabled:opacity-50",
+ className
+ )}
+ {...props}
+ />
+));
+Input.displayName = "Input";
+
+export { Input };
diff --git a/apps/web/src/components/ui/toggle-group.tsx b/apps/web/src/components/ui/toggle-group.tsx
new file mode 100644
index 00000000..55038098
--- /dev/null
+++ b/apps/web/src/components/ui/toggle-group.tsx
@@ -0,0 +1,47 @@
+import * as React from "react";
+import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
+import { cva, type VariantProps } from "class-variance-authority";
+import { cn } from "@/lib/utils";
+
+const toggleGroupVariants = cva(
+ "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#627f58]/70 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-emerald-50 data-[state=on]:text-emerald-800",
+ {
+ variants: {
+ variant: {
+ default: "bg-transparent text-slate-500 hover:bg-slate-50 hover:text-slate-900",
+ outline: "border border-slate-200 bg-white text-slate-600 hover:bg-slate-50 hover:text-slate-900",
+ },
+ size: {
+ default: "h-9 px-3",
+ sm: "h-8 px-2.5 text-xs",
+ icon: "h-8 w-8 p-0",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ size: "default",
+ },
+ }
+);
+
+const ToggleGroup = React.forwardRef<
+ React.ElementRef<typeof ToggleGroupPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>
+>(({ className, ...props }, ref) => (
+ <ToggleGroupPrimitive.Root ref={ref} className={cn("flex items-center", className)} {...props} />
+));
+ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
+
+const ToggleGroupItem = React.forwardRef<
+ React.ElementRef<typeof ToggleGroupPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleGroupVariants>
+>(({ className, variant, size, ...props }, ref) => (
+ <ToggleGroupPrimitive.Item
+ ref={ref}
+ className={cn(toggleGroupVariants({ variant, size }), className)}
+ {...props}
+ />
+));
+ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
+
+export { ToggleGroup, ToggleGroupItem, toggleGroupVariants };
diff --git a/apps/web/src/lib/app-hooks.ts b/apps/web/src/lib/app-hooks.ts
index 89dae042..8ac7d32f 100644
--- a/apps/web/src/lib/app-hooks.ts
+++ b/apps/web/src/lib/app-hooks.ts
@@ -1,70 +1,11 @@
-import { useEffect, useRef, useCallback, type RefObject, type PointerEvent as ReactPointerEvent } from "react";
+import { useEffect, useRef } from "react";
const APP_BACK_HISTORY_MARKER = "__edgeever_app_back__";
-const BOTTOM_SHEET_DISMISS_DISTANCE_PX = 72;
-const BOTTOM_SHEET_DISMISS_VELOCITY_PX_PER_MS = 0.55;
-
-export const DIALOG_FOCUSABLE_SELECTOR = [
- "a[href]",
- "button:not([disabled])",
- "input:not([disabled])",
- "select:not([disabled])",
- "textarea:not([disabled])",
- "[tabindex]:not([tabindex='-1'])",
-].join(",");
-
-export const getFocusableElements = (node: HTMLElement | null) => {
- if (!node) {
- return [];
- }
-
- return Array.from(node.querySelectorAll<HTMLElement>(DIALOG_FOCUSABLE_SELECTOR)).filter((element) => {
- const isVisible = element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;
-
- return isVisible && !element.hasAttribute("disabled") && element.getAttribute("aria-hidden") !== "true";
- });
-};
export const isTextEntryTarget = (target: EventTarget | null) =>
target instanceof HTMLElement &&
Boolean(target.closest("input, textarea, select, [contenteditable='true'], [role='textbox'], .ProseMirror"));
-export const useDismissableLayer = <T extends HTMLElement>(open: boolean, onClose: () => void) => {
- const ref = useRef<T | null>(null);
-
- useEffect(() => {
- if (!open) {
- return;
- }
-
- const handlePointerDown = (event: PointerEvent) => {
- const node = ref.current;
-
- if (!node || node.contains(event.target as Node)) {
- return;
- }
-
- onClose();
- };
-
- const handleKeyDown = (event: KeyboardEvent) => {
- if (event.key === "Escape") {
- onClose();
- }
- };
-
- window.addEventListener("pointerdown", handlePointerDown);
- window.addEventListener("keydown", handleKeyDown);
-
- return () => {
- window.removeEventListener("pointerdown", handlePointerDown);
- window.removeEventListener("keydown", handleKeyDown);
- };
- }, [onClose, open]);
-
- return ref;
-};
-
export type BrowserBackLayer = {
id: string;
onBack: () => void;
@@ -165,343 +106,3 @@ export const useBrowserBackLayer = (active: boolean, onBack: () => void) => {
};
}, [active]);
};
-
-export const useFloatingMenuControls = <T extends HTMLElement>(ref: RefObject<T | null>, open: boolean, onClose: () => void) => {
- useEffect(() => {
- if (!open) {
- return;
- }
-
- const node = ref.current;
-
- if (!node) {
- return;
- }
-
- const previouslyFocusedElement = document.activeElement instanceof HTMLElement ? document.activeElement : null;
- const getMenuItems = () => {
- const menuNode = node.querySelector<HTMLElement>("[role='menu']") ?? node;
-
- return getFocusableElements(menuNode).filter((element) => element.getAttribute("role") === "menuitem" || element.tagName === "BUTTON");
- };
- const restoreFocusToTrigger = () => {
- if (!previouslyFocusedElement?.isConnected) {
- return;
- }
-
- window.setTimeout(() => {
- const activeElement = document.activeElement;
- const hasExternalFocus =
- activeElement instanceof HTMLElement && activeElement !== document.body && !node.contains(activeElement);
-
- if (hasExternalFocus) {
- return;
- }
-
- previouslyFocusedElement.focus();
- }, 0);
- };
- const focusTimer = window.setTimeout(() => getMenuItems()[0]?.focus(), 0);
- const handleKeyDown = (event: KeyboardEvent) => {
- if (event.key === "Escape") {
- event.preventDefault();
- event.stopPropagation();
- onClose();
- restoreFocusToTrigger();
- return;
- }
-
- if (event.key !== "ArrowDown" && event.key !== "ArrowUp" && event.key !== "Home" && event.key !== "End") {
- return;
- }
-
- const menuItems = getMenuItems();
-
- if (menuItems.length === 0) {
- return;
- }
-
- event.preventDefault();
- event.stopPropagation();
-
- const currentIndex = menuItems.findIndex((element) => element === document.activeElement);
- const nextIndex =
- event.key === "Home"
- ? 0
- : event.key === "End"
- ? menuItems.length - 1
- : event.key === "ArrowDown"
- ? (Math.max(currentIndex, 0) + 1) % menuItems.length
- : (currentIndex <= 0 ? menuItems.length : currentIndex) - 1;
-
- menuItems[nextIndex]?.focus();
- };
-
- node.addEventListener("keydown", handleKeyDown);
-
- return () => {
- window.clearTimeout(focusTimer);
- node.removeEventListener("keydown", handleKeyDown);
- };
- }, [onClose, open, ref]);
-};
-
-export const useFocusTrap = <T extends HTMLElement>(ref: RefObject<T | null>, active = true) => {
- useEffect(() => {
- if (!active) {
- return;
- }
-
- const node = ref.current;
-
- if (!node) {
- return;
- }
-
- const handleKeyDown = (event: KeyboardEvent) => {
- if (event.key !== "Tab") {
- return;
- }
-
- const focusableElements = getFocusableElements(node);
-
- if (focusableElements.length === 0) {
- event.preventDefault();
- return;
- }
-
- const firstElement = focusableElements[0];
- const lastElement = focusableElements[focusableElements.length - 1];
-
- if (event.shiftKey) {
- if (document.activeElement === firstElement || !node.contains(document.activeElement)) {
- event.preventDefault();
- lastElement.focus();
- }
-
- return;
- }
-
- if (document.activeElement === lastElement) {
- event.preventDefault();
- firstElement.focus();
- }
- };
-
- node.addEventListener("keydown", handleKeyDown);
-
- return () => node.removeEventListener("keydown", handleKeyDown);
- }, [active, ref]);
-};
-
-export const useModalLayerControls = <T extends HTMLElement>(
- ref: RefObject<T | null>,
- onClose: () => void,
- {
- active = true,
- closeOnEscape = true,
- closeOnBrowserBack = false,
- initialFocus = true,
- restoreFocus = true,
- }: {
- active?: boolean;
- closeOnEscape?: boolean;
- closeOnBrowserBack?: boolean;
- initialFocus?: boolean;
- restoreFocus?: boolean;
- } = {}
-) => {
- useFocusTrap(ref, active);
- useBrowserBackLayer(active && closeOnBrowserBack, onClose);
-
- useEffect(() => {
- if (!active) {
- return;
- }
-
- const previouslyFocusedElement = document.activeElement instanceof HTMLElement ? document.activeElement : null;
- const focusTimer = initialFocus
- ? window.setTimeout(() => {
- const node = ref.current;
-
- if (!node || node.contains(document.activeElement)) {
- return;
- }
-
- getFocusableElements(node)[0]?.focus();
- }, 0)
- : null;
-
- const node = ref.current;
-
- if (!node) {
- return () => {
- if (focusTimer !== null) {
- window.clearTimeout(focusTimer);
- }
- };
- }
-
- const handleKeyDown = (event: KeyboardEvent) => {
- event.stopPropagation();
-
- if (!closeOnEscape || event.key !== "Escape" || event.defaultPrevented) {
- return;
- }
-
- if (isTextEntryTarget(event.target)) {
- const target = event.target;
-
- if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
- if (target.value) {
- return;
- }
- }
- }
-
- event.preventDefault();
- onClose();
- };
-
- node.addEventListener("keydown", handleKeyDown);
-
- return () => {
- if (focusTimer !== null) {
- window.clearTimeout(focusTimer);
- }
-
- node.removeEventListener("keydown", handleKeyDown);
-
- if (restoreFocus && previouslyFocusedElement?.isConnected) {
- previouslyFocusedElement.focus({ preventScroll: true });
- }
- };
- }, [active, closeOnEscape, initialFocus, onClose, ref, restoreFocus]);
-};
-
-export const useBottomSheetSwipeToClose = <T extends HTMLElement>(sheetRef: RefObject<T | null>, onClose: () => void) => {
- const cleanupDragRef = useRef<(() => void) | null>(null);
- const onCloseRef = useRef(onClose);
-
- useEffect(() => {
- onCloseRef.current = onClose;
- }, [onClose]);
-
- const cleanupDrag = useCallback(() => {
- cleanupDragRef.current?.();
- cleanupDragRef.current = null;
- }, []);
-
- const resetSheetPosition = useCallback(() => {
- const sheet = sheetRef.current;
-
- if (!sheet) {
- return;
- }
-
- sheet.style.transition = "transform 180ms cubic-bezier(0.2, 0, 0, 1)";
- sheet.style.transform = "";
- sheet.style.willChange = "";
-
- window.setTimeout(() => {
- if (sheetRef.current === sheet) {
- sheet.style.transition = "";
- }
- }, 190);
- }, [sheetRef]);
-
- const handlePointerDown = useCallback(
- (event: ReactPointerEvent<HTMLElement>) => {
- if (!event.isPrimary) {
- return;
- }
-
- const sheet = sheetRef.current;
-
- if (!sheet) {
- return;
- }
-
- event.preventDefault();
- event.stopPropagation();
- cleanupDrag();
-
- const pointerId = event.pointerId;
- const startX = event.clientX;
- const startY = event.clientY;
- const startTime = performance.now();
- let latestY = startY;
- let dragging = false;
-
- const handlePointerMove = (moveEvent: PointerEvent) => {
- if (moveEvent.pointerId !== pointerId) {
- return;
- }
-
- const deltaY = Math.max(0, moveEvent.clientY - startY);
- const deltaX = Math.abs(moveEvent.clientX - startX);
-
- if (!dragging && deltaX > deltaY * 1.4 && deltaX > 18) {
- return;
- }
-
- if (deltaY <= 0) {
- return;
- }
-
- latestY = moveEvent.clientY;
- dragging = true;
- moveEvent.preventDefault();
- sheet.style.transition = "none";
- sheet.style.transform = `translate3d(0, ${deltaY}px, 0)`;
- sheet.style.willChange = "transform";
- };
-
- const handlePointerEnd = (endEvent: PointerEvent) => {
- if (endEvent.pointerId !== pointerId) {
- return;
- }
-
- const deltaY = Math.max(0, latestY - startY);
- const elapsedMs = Math.max(performance.now() - startTime, 1);
- const velocity = deltaY / elapsedMs;
-
- cleanupDrag();
-
- if (deltaY >= BOTTOM_SHEET_DISMISS_DISTANCE_PX || velocity >= BOTTOM_SHEET_DISMISS_VELOCITY_PX_PER_MS) {
- sheet.style.transition = "transform 160ms cubic-bezier(0.32, 0.72, 0, 1)";
- sheet.style.transform = "translate3d(0, 110%, 0)";
- sheet.style.willChange = "transform";
- window.setTimeout(() => onCloseRef.current(), 120);
- return;
- }
-
- resetSheetPosition();
- };
-
- const handlePointerCancel = (cancelEvent: PointerEvent) => {
- if (cancelEvent.pointerId !== pointerId) {
- return;
- }
-
- cleanupDrag();
- resetSheetPosition();
- };
-
- window.addEventListener("pointermove", handlePointerMove, { passive: false });
- window.addEventListener("pointerup", handlePointerEnd);
- window.addEventListener("pointercancel", handlePointerCancel);
-
- cleanupDragRef.current = () => {
- window.removeEventListener("pointermove", handlePointerMove);
- window.removeEventListener("pointerup", handlePointerEnd);
- window.removeEventListener("pointercancel", handlePointerCancel);
- };
- },
- [cleanupDrag, resetSheetPosition, sheetRef]
- );
-
- useEffect(() => cleanupDrag, [cleanupDrag]);
-
- return handlePointerDown;
-};
diff --git a/bun.lock b/bun.lock
index bfbab907..1e73d755 100644
--- a/bun.lock
+++ b/bun.lock
@@ -7,12 +7,14 @@
"dependencies": {
"@edgeever/shared": "workspace:*",
"@hono/zod-validator": "latest",
+ "@radix-ui/react-checkbox": "^1.3.5",
"@radix-ui/react-context-menu": "^2.3.1",
"@radix-ui/react-dialog": "^1.1.17",
"@radix-ui/react-dropdown-menu": "^2.1.18",
"@radix-ui/react-select": "^2.3.1",
"@radix-ui/react-slot": "^1.3.0",
"@radix-ui/react-switch": "^1.3.1",
+ "@radix-ui/react-toggle-group": "^1.1.13",
"@radix-ui/react-tooltip": "^1.2.10",
"@tanstack/react-query": "latest",
"@tiptap/extension-image": "^3.27.1",
@@ -21,6 +23,7 @@
"@tiptap/starter-kit": "latest",
"class-variance-authority": "latest",
"clsx": "latest",
+ "cmdk": "^1.1.1",
"dexie": "latest",
"gifuct-js": "^2.1.2",
"hono": "latest",
@@ -29,6 +32,7 @@
"react-dom": "latest",
"tailwind-merge": "latest",
"tailwindcss-animate": "^1.0.7",
+ "vaul": "^1.1.2",
"wasm-webp": "^0.1.0",
"workbox-window": "^7.4.1",
"zod": "latest",
@@ -427,6 +431,8 @@
"@radix-ui/react-arrow": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.6" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-j2VTDz1vgCsmuG0k5lBfOcM8n5JPFqZBcMryasFjHYMhwxYL5SRUV5lMSUpRdNtw3D/Sv8pzJtrlAgkssYSsQQ=="],
+ "@radix-ui/react-checkbox": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.4", "@radix-ui/react-compose-refs": "1.1.3", "@radix-ui/react-context": "1.1.4", "@radix-ui/react-presence": "1.1.6", "@radix-ui/react-primitive": "2.1.6", "@radix-ui/react-use-controllable-state": "1.2.3", "@radix-ui/react-use-previous": "1.1.2", "@radix-ui/react-use-size": "1.1.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-pREzrmNnVwGvYaBoM64huTRK7B3lrTRuwj8A9nwhPiEtMb+yudiWh6zWAqEtP0Dzd5+iBa1Ki7V1pCxV8ExMdA=="],
+
"@radix-ui/react-collection": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.3", "@radix-ui/react-context": "1.1.4", "@radix-ui/react-primitive": "2.1.6", "@radix-ui/react-slot": "1.3.0" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-IVVz4EvBcKjrzKgof714qDnz/SzQAkLA2Emh5edlHbgcE6fNd3Un6CJLlaYcnm8N4JmAtzQgse4dOKxcD2yc9g=="],
"@radix-ui/react-compose-refs": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-rYOP8OMnuuPMQF1uhPVlGNcCDlkokKqGFE3JcxFViIkAXP7EvFWUliJAstrapypaBLJNHbZL6jGhbVDGTwmVhA=="],
@@ -467,6 +473,10 @@
"@radix-ui/react-switch": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.4", "@radix-ui/react-compose-refs": "1.1.3", "@radix-ui/react-context": "1.1.4", "@radix-ui/react-primitive": "2.1.6", "@radix-ui/react-use-controllable-state": "1.2.3", "@radix-ui/react-use-previous": "1.1.2", "@radix-ui/react-use-size": "1.1.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-55bQtCnOB0BohomSHi6qvQXpJEEqUGDm6hRrM0Bph5OXwhSegqkd8IqgBAQkM1IlgUlWZIxpxRcpOEfRIgimyw=="],
+ "@radix-ui/react-toggle": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.4", "@radix-ui/react-primitive": "2.1.6", "@radix-ui/react-use-controllable-state": "1.2.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-AsAVsYNZIlRBsci7BhE+QyQeKd1h6TffJYt+lF0QQkd5OpQ3klfIByPsCb4G0h/Fq6PJwh1FYNluzBFYzhk4+w=="],
+
+ "@radix-ui/react-toggle-group": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.4", "@radix-ui/react-context": "1.1.4", "@radix-ui/react-direction": "1.1.2", "@radix-ui/react-primitive": "2.1.6", "@radix-ui/react-roving-focus": "1.1.13", "@radix-ui/react-toggle": "1.1.12", "@radix-ui/react-use-controllable-state": "1.2.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-Xb9PLtlvU66F36LiKba6dFswu6V2mDkgidO4fNSbQHQwmZ9ObxMIO17MN/LJ4aWJecVuSVLAHPZjyeMzJrgeiA=="],
+
"@radix-ui/react-tooltip": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.4", "@radix-ui/react-compose-refs": "1.1.3", "@radix-ui/react-context": "1.1.4", "@radix-ui/react-dismissable-layer": "1.1.13", "@radix-ui/react-id": "1.1.2", "@radix-ui/react-popper": "1.3.1", "@radix-ui/react-portal": "1.1.12", "@radix-ui/react-presence": "1.1.6", "@radix-ui/react-primitive": "2.1.6", "@radix-ui/react-slot": "1.3.0", "@radix-ui/react-use-controllable-state": "1.2.3", "@radix-ui/react-visually-hidden": "1.2.6" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-NlNe8D0dWEpVfXFli90IO6X07Josx/b1iu98tDnx9Xv0HT4wLIL+m2VOheMHhK7qbp2HoTBqALEFzGyZs/levw=="],
"@radix-ui/react-use-callback-ref": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-xCso9j1/u8sEgP1RNHjFrXJLApL8LiqOkI1R4ywuN00rxWdYg4oQXuwKLS3i0j5NWLromUD27/4nlxj2UFVvIw=="],
@@ -741,6 +751,8 @@
"clsx": ["[email protected]", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="],
+ "cmdk": ["[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "^1.1.1", "@radix-ui/react-dialog": "^1.1.6", "@radix-ui/react-id": "^1.1.0", "@radix-ui/react-primitive": "^2.0.2" }, "peerDependencies": { "react": "^18 || ^19 || ^19.0.0-rc", "react-dom": "^18 || ^19 || ^19.0.0-rc" } }, "sha512-Vsv7kFaXm+ptHDMZ7izaRsP70GgrW9NBNGswt9OZaVBLlE0SNpDq8eu/VGXyF9r7M0azK3Wy7OlYXsuyYLFzHg=="],
+
"commander": ["[email protected]", "", {}, "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA=="],
"common-tags": ["[email protected]", "", {}, "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA=="],
@@ -1319,6 +1331,8 @@
"util-deprecate": ["[email protected]", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
+ "vaul": ["[email protected]", "", { "dependencies": { "@radix-ui/react-dialog": "^1.1.1" }, "peerDependencies": { "react": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc" } }, "sha512-ZFkClGpWyI2WUQjdLJ/BaGuV6AVQiJ3uELGk3OYtP+B6yCO7Cmn9vPFXVJkRaGkOJu3m8bQMgtyzNHixULceQA=="],
+
"vite": ["[email protected]", "", { "dependencies": { "lightningcss": "^1.32.0", "picomatch": "^4.0.4", "postcss": "^8.5.15", "rolldown": "~1.1.2", "tinyglobby": "^0.2.17" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.3.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-BuJcQK/56NQTWDGn4ABea3q4SSBdNPWwNZKTkkUpcMPnLoquSYH8llRtSUIgoL1KSCpHt5eghLShn50mH36y7Q=="],
"vite-plugin-pwa": ["[email protected]", "", { "dependencies": { "debug": "^4.3.6", "pretty-bytes": "^6.1.1", "tinyglobby": "^0.2.10", "workbox-build": "^7.4.1", "workbox-window": "^7.4.1" }, "peerDependencies": { "@vite-pwa/assets-generator": "^1.0.0", "vite": "^3.1.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "optionalPeers": ["@vite-pwa/assets-generator"] }, "sha512-c5kMgN+ITrOtHXp8PAtk2uOIEea6XjP/unCGxOWWBzQ6qa65qj/awHg0wf+QF9E/2u9vh86LqxPwzEPNbM2r5A=="],
diff --git a/package.json b/package.json
index 45aa9ee6..f2c778b9 100644
--- a/package.json
+++ b/package.json
@@ -42,12 +42,14 @@
"dependencies": {
"@edgeever/shared": "workspace:*",
"@hono/zod-validator": "latest",
+ "@radix-ui/react-checkbox": "^1.3.5",
"@radix-ui/react-context-menu": "^2.3.1",
"@radix-ui/react-dialog": "^1.1.17",
"@radix-ui/react-dropdown-menu": "^2.1.18",
"@radix-ui/react-select": "^2.3.1",
"@radix-ui/react-slot": "^1.3.0",
"@radix-ui/react-switch": "^1.3.1",
+ "@radix-ui/react-toggle-group": "^1.1.13",
"@radix-ui/react-tooltip": "^1.2.10",
"@tanstack/react-query": "latest",
"@tiptap/extension-image": "^3.27.1",
@@ -56,6 +58,7 @@
"@tiptap/starter-kit": "latest",
"class-variance-authority": "latest",
"clsx": "latest",
+ "cmdk": "^1.1.1",
"dexie": "latest",
"gifuct-js": "^2.1.2",
"hono": "latest",
@@ -64,6 +67,7 @@
"react-dom": "latest",
"tailwind-merge": "latest",
"tailwindcss-animate": "^1.0.7",
+ "vaul": "^1.1.2",
"wasm-webp": "^0.1.0",
"workbox-window": "^7.4.1",
"zod": "latest"