Skip to content

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

feat: refine desktop motion feedback

tianma-ifce7339f688ca
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index aa739611..5056f9cb 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -2302,10 +2302,29 @@ const RichEditorPane = ({
: t("editor.uploadState.fileUploading")}
</span>
)}
- <span className={cn("hidden rounded-md px-2 py-1 text-xs font-medium sm:inline-flex", saveStateClassName)}>
+ <span
+ key={`${saveState}-${String(hasUnsavedChanges)}`}
+ className={cn("edgeever-status-settle hidden items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium sm:inline-flex", saveStateClassName)}
+ role="status"
+ aria-live="polite"
+ >
+ {saveState === "saving" ? (
+ <LoaderCircle className="h-3 w-3 animate-spin" aria-hidden="true" />
+ ) : saveState === "error" || saveState === "conflict" || saveState === "queued" ? (
+ <CircleAlert className="h-3 w-3" aria-hidden="true" />
+ ) : hasUnsavedChanges ? (
+ <Pencil className="h-3 w-3" aria-hidden="true" />
+ ) : (
+ <Check className="h-3 w-3" aria-hidden="true" />
+ )}
{saveLabel}
</span>
- <span className={cn("inline-flex max-w-[5.5rem] truncate rounded-full px-2 py-1 text-[11px] font-medium sm:hidden", mobileStatusClassName)}>
+ <span
+ key={`${imageUploadState}-${saveState}-${String(hasUnsavedChanges)}`}
+ className={cn("edgeever-status-settle inline-flex max-w-[5.5rem] truncate rounded-full px-2 py-1 text-[11px] font-medium sm:hidden", mobileStatusClassName)}
+ role="status"
+ aria-live="polite"
+ >
{mobileStatusLabel}
</span>
{mobileEditingActive && !readOnly && (
diff --git a/apps/web/src/components/MemoCard.tsx b/apps/web/src/components/MemoCard.tsx
index b592b3a1..d7fc2ab5 100644
--- a/apps/web/src/components/MemoCard.tsx
+++ b/apps/web/src/components/MemoCard.tsx
@@ -310,7 +310,7 @@ export const MemoCard = ({
draggable={!isTrashView}
onDragStart={handleDragStart}
className={cn(
- "group overflow-hidden border border-slate-100 bg-white transition lg:rounded-none lg:border-x-0 lg:border-t-0 lg:border-slate-200 lg:shadow-none lg:last:border-b-0 dark:lg:border-slate-300/70 transition-all duration-200 select-none",
+ "group relative overflow-hidden border border-slate-100 bg-white transition lg:rounded-none lg:border-x-0 lg:border-t-0 lg:border-slate-200 lg:shadow-none lg:last:border-b-0 dark:lg:border-slate-300/70 transition-all duration-200 select-none",
listDensity === "compact" ? "rounded-md shadow-none" : "rounded-lg shadow-[0_4px_16px_rgba(15,23,42,0.045)]",
!selectionMode && selected
? "lg:bg-slate-100"
@@ -319,6 +319,12 @@ export const MemoCard = ({
: "active:bg-slate-50 lg:hover:bg-slate-50"
)}
>
+ {!selectionMode && selected ? (
+ <span
+ className="edgeever-selection-settle pointer-events-none absolute inset-y-3 left-0 z-10 hidden w-[3px] rounded-r-full bg-emerald-500 lg:block"
+ aria-hidden="true"
+ />
+ ) : null}
<div className={cn("flex min-h-[132px] items-center", listDensity === "compact" && "min-h-[84px] lg:min-h-[76px]")}>
{showSelectionControl && (
<button
diff --git a/apps/web/src/components/MemoListPane.tsx b/apps/web/src/components/MemoListPane.tsx
index 630318e9..df3e752c 100644
--- a/apps/web/src/components/MemoListPane.tsx
+++ b/apps/web/src/components/MemoListPane.tsx
@@ -132,7 +132,7 @@ export const MemoSelectionActionBar = ({
return (
<div className="hidden h-full min-h-0 flex-1 items-center justify-start bg-white px-16 py-10 lg:flex lg:pl-44 xl:px-24 xl:pl-44">
- <div className="w-72 overflow-hidden rounded-md border border-slate-200 bg-white py-1 shadow-lg">
+ <div className="edgeever-pane-enter w-72 overflow-hidden rounded-md border border-slate-200 bg-white py-1 shadow-lg">
<div className="flex h-9 items-center gap-2 px-3 text-xs font-semibold text-slate-400">
<CheckSquare className="h-4 w-4" />
{getSelectionCountLabel(selectedCount, t)}
@@ -1286,7 +1286,7 @@ export const MemoListPane = ({
{hasListConstraint && (
<div
className={cn(
- "mt-3 flex min-h-8 items-center gap-2 rounded-md border px-3 py-1.5 text-xs",
+ "edgeever-content-enter mt-3 flex min-h-8 items-center gap-2 rounded-md border px-3 py-1.5 text-xs",
searchActive
? "border-emerald-200 bg-emerald-50 text-emerald-800 shadow-[inset_3px_0_0_#10b981]"
: "border-slate-200 bg-white text-slate-500"
diff --git a/apps/web/src/components/NotebookPane.tsx b/apps/web/src/components/NotebookPane.tsx
index fa74deff..08b4454e 100644
--- a/apps/web/src/components/NotebookPane.tsx
+++ b/apps/web/src/components/NotebookPane.tsx
@@ -207,16 +207,22 @@ const SyncStatusBar = ({
: "border-slate-200 bg-white text-slate-500";
return (
- <div className={cn("mb-3 flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 transition-all duration-200", statusClassName)}>
- {!isOnline ? (
- <CloudOff className="h-4 w-4 shrink-0" />
- ) : summary.conflict > 0 ? (
- <AlertTriangle className="h-4 w-4 shrink-0" />
- ) : hasQueuedWork || isSyncing ? (
- <RefreshCw className={cn("h-4 w-4 shrink-0", isSyncing && "animate-spin")} />
- ) : (
- <CheckCircle2 className="h-4 w-4 shrink-0" />
- )}
+ <div
+ className={cn("mb-3 flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 transition-all duration-200", statusClassName)}
+ role="status"
+ aria-live="polite"
+ >
+ <span key={label} className="edgeever-status-settle flex h-4 w-4 shrink-0 items-center justify-center" aria-hidden="true">
+ {!isOnline ? (
+ <CloudOff className="h-4 w-4" />
+ ) : summary.conflict > 0 ? (
+ <AlertTriangle className="h-4 w-4" />
+ ) : hasQueuedWork || isSyncing ? (
+ <RefreshCw className={cn("h-4 w-4", isSyncing && "animate-spin")} />
+ ) : (
+ <CheckCircle2 className="h-4 w-4" />
+ )}
+ </span>
<span className="min-w-0 flex-1 truncate text-xs font-medium">{label}</span>
{summary.conflict > 0 && (
<button
diff --git a/apps/web/src/components/NotebookTreeItem.tsx b/apps/web/src/components/NotebookTreeItem.tsx
index 94b148bc..556184a6 100644
--- a/apps/web/src/components/NotebookTreeItem.tsx
+++ b/apps/web/src/components/NotebookTreeItem.tsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useRef, type DragEvent } from "react";
import { useTranslation } from "react-i18next";
-import { ChevronDown, ChevronRight, MoreHorizontal, Notebook as NotebookIcon, Plus, Pencil, Trash2 } from "lucide-react";
+import { ChevronDown, MoreHorizontal, Notebook as NotebookIcon, Plus, Pencil, Trash2 } from "lucide-react";
import type { NotebookNode, NotebookDropPosition } from "@/lib/app-helpers";
import {
hasMemoDragData,
@@ -206,7 +206,13 @@ export const NotebookTreeItem = ({
aria-label={open ? t("notebookTree.collapse", { name: node.name }) : t("notebookTree.expand", { name: node.name })}
aria-expanded={open}
>
- {open ? <ChevronDown className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />}
+ <ChevronDown
+ className={cn(
+ "h-4 w-4 transition-transform duration-150 ease-out",
+ open ? "rotate-0" : "-rotate-90"
+ )}
+ aria-hidden="true"
+ />
</button>
) : (
<span className="h-6 w-5 shrink-0" aria-hidden="true" />
@@ -291,7 +297,7 @@ export const NotebookTreeItem = ({
<MoreHorizontal className="h-3.5 w-3.5" />
</button>
{actionsOpen && (
- <div className="absolute right-0 top-8 z-50 w-44 overflow-hidden rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-lg">
+ <div className="edgeever-popover-enter absolute right-0 top-8 z-50 w-44 overflow-hidden rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-lg">
<button
className="flex h-9 w-full items-center gap-2 rounded-sm px-2 text-left text-sm outline-none hover:bg-slate-100"
type="button"
@@ -375,7 +381,7 @@ export const NotebookTreeItem = ({
</ContextMenu>
{hasChildren && open ? (
- <div className="mt-1 space-y-1">
+ <div className="edgeever-tree-enter mt-1 space-y-1">
{node.children.map((child) => (
<NotebookTreeItem
key={child.id}
diff --git a/apps/web/src/components/SettingsPane.tsx b/apps/web/src/components/SettingsPane.tsx
index cfc03b97..87a63a64 100644
--- a/apps/web/src/components/SettingsPane.tsx
+++ b/apps/web/src/components/SettingsPane.tsx
@@ -276,7 +276,7 @@ export const SettingsPane = ({
{/* 右侧设置内容区 */}
<main className="flex-1 min-w-0 overflow-y-auto pr-2">
- <div className="grid gap-4">
+ <div key={activeTab} className="edgeever-content-enter grid gap-4">
{renderTabContent(activeTab)}
</div>
</main>
@@ -345,7 +345,7 @@ export const SettingsPane = ({
</div>
) : (
/* 详情页面 */
- <div className="grid gap-4">
+ <div key={activeMobileTab} className="edgeever-content-enter grid gap-4">
{renderTabContent(activeMobileTab)}
</div>
)}
diff --git a/apps/web/src/components/WorkspaceApp.tsx b/apps/web/src/components/WorkspaceApp.tsx
index 6bd97773..8e6ac33b 100644
--- a/apps/web/src/components/WorkspaceApp.tsx
+++ b/apps/web/src/components/WorkspaceApp.tsx
@@ -105,6 +105,24 @@ const isDesktopViewport = () => window.matchMedia("(min-width: 1024px)").matches
const PULL_TO_REFRESH_TRIGGER_PX = 72;
const PULL_TO_REFRESH_MAX_PX = 96;
+type ViewTransitionDocument = Document & {
+ startViewTransition?: (update: () => void) => unknown;
+};
+
+const runWorkspaceViewTransition = (update: () => void) => {
+ const viewTransitionDocument = document as ViewTransitionDocument;
+
+ if (
+ !viewTransitionDocument.startViewTransition ||
+ window.matchMedia("(prefers-reduced-motion: reduce)").matches
+ ) {
+ update();
+ return;
+ }
+
+ viewTransitionDocument.startViewTransition(update);
+};
+
const isStandaloneApp = () =>
window.matchMedia("(display-mode: standalone)").matches ||
window.matchMedia("(display-mode: fullscreen)").matches ||
@@ -2330,8 +2348,10 @@ export const WorkspaceApp = ({
};
const updateDesktopFocusMode = useCallback((enabled: boolean) => {
- setDesktopFocusMode(enabled);
- writeDesktopFocusModePreference(enabled);
+ runWorkspaceViewTransition(() => {
+ setDesktopFocusMode(enabled);
+ writeDesktopFocusModePreference(enabled);
+ });
}, []);
const toggleDesktopFocusMode = useCallback(() => {
@@ -2939,8 +2959,9 @@ export const WorkspaceApp = ({
<section className={cn("min-h-0 min-w-0 bg-white lg:block", visibleActivePane === "editor" ? "block" : "hidden")}>
{shouldRenderRightPane && (
<Suspense fallback={<PaneLoadingFallback label={rightPaneLoadingLabel} />}>
- {rightView === "settings" ? (
- <SettingsPane
+ <div key={rightView} className="edgeever-pane-enter h-full min-h-0 min-w-0">
+ {rightView === "settings" ? (
+ <SettingsPane
onClose={handleCloseSettings}
onOpenTemplates={handleOpenTemplates}
imageCompressionEnabled={imageCompressionEnabled}
@@ -2956,12 +2977,12 @@ export const WorkspaceApp = ({
isOwner={authRequired && user?.role === "owner"}
user={user}
/>
- ) : rightView === "assets" ? (
- <AssetsPane onClose={handleCloseAssets} activeMemo={selectedMemo} repository={repository} />
- ) : rightView === "tags" ? (
- <TagsPane onClose={handleCloseAssets} repository={repository} />
- ) : rightView === "templates" ? (
- <TemplatesPane
+ ) : rightView === "assets" ? (
+ <AssetsPane onClose={handleCloseAssets} activeMemo={selectedMemo} repository={repository} />
+ ) : rightView === "tags" ? (
+ <TagsPane onClose={handleCloseAssets} repository={repository} />
+ ) : rightView === "templates" ? (
+ <TemplatesPane
canCreateMemo={canCreateMemo}
isCreating={createMemoMutation.isPending || createTemplateMutation.isPending}
onClose={handleCloseTemplates}
@@ -2976,10 +2997,10 @@ export const WorkspaceApp = ({
await updateTemplateMutation.mutateAsync({ templateId, payload });
}}
/>
- ) : rightView === "evernote-migration" ? (
- <EvernoteImportGuidePane onClose={() => setRightView("settings")} />
- ) : (
- <EditorPane
+ ) : rightView === "evernote-migration" ? (
+ <EvernoteImportGuidePane onClose={() => setRightView("settings")} />
+ ) : (
+ <EditorPane
memo={selectedMemo}
repository={repository}
desktopFocusMode={desktopFocusModeActive}
@@ -3057,8 +3078,9 @@ export const WorkspaceApp = ({
}}
onMobileDefaultEditConsumed={handleMobileDefaultEditConsumed}
onSaveAsTemplate={handleSaveAsTemplate}
- />
- )}
+ />
+ )}
+ </div>
</Suspense>
)}
</section>
diff --git a/apps/web/src/components/ui/button.tsx b/apps/web/src/components/ui/button.tsx
index 2e5fe821..6b0547d3 100644
--- a/apps/web/src/components/ui/button.tsx
+++ b/apps/web/src/components/ui/button.tsx
@@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react";
const buttonVariants = cva(
- "inline-flex shrink-0 items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/70 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
+ "inline-flex shrink-0 items-center justify-center rounded-md font-medium transition-[color,background-color,border-color,box-shadow,transform] duration-150 active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/70 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css
index bb1be78e..6b8f1701 100644
--- a/apps/web/src/styles/globals.css
+++ b/apps/web/src/styles/globals.css
@@ -80,6 +80,8 @@
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
+ --motion-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
+ --motion-ease-soft: cubic-bezier(0.2, 0.8, 0.2, 1);
}
:root.dark {
@@ -159,6 +161,87 @@ body {
overscroll-behavior-y: auto;
}
+@keyframes edgeever-pane-enter {
+ from {
+ opacity: 0;
+ transform: translate3d(0, 5px, 0);
+ }
+
+ to {
+ opacity: 1;
+ transform: translate3d(0, 0, 0);
+ }
+}
+
+@keyframes edgeever-tree-enter {
+ from {
+ opacity: 0;
+ transform: translate3d(0, -3px, 0);
+ }
+
+ to {
+ opacity: 1;
+ transform: translate3d(0, 0, 0);
+ }
+}
+
+@keyframes edgeever-status-settle {
+ from {
+ opacity: 0.35;
+ transform: scale3d(0.88, 0.88, 1);
+ }
+
+ to {
+ opacity: 1;
+ transform: scale3d(1, 1, 1);
+ }
+}
+
+@keyframes edgeever-selection-settle {
+ from {
+ opacity: 0;
+ transform: scaleY(0.35);
+ }
+
+ to {
+ opacity: 1;
+ transform: scaleY(1);
+ }
+}
+
+.edgeever-pane-enter {
+ animation: edgeever-pane-enter 180ms var(--motion-ease-out) backwards;
+}
+
+.edgeever-content-enter {
+ animation: edgeever-pane-enter 150ms var(--motion-ease-out) backwards;
+}
+
+.edgeever-tree-enter {
+ animation: edgeever-tree-enter 160ms var(--motion-ease-soft) backwards;
+ transform-origin: top;
+}
+
+.edgeever-popover-enter {
+ animation: edgeever-pane-enter 140ms var(--motion-ease-out) backwards;
+ transform-origin: top right;
+}
+
+.edgeever-status-settle {
+ animation: edgeever-status-settle 200ms var(--motion-ease-out) backwards;
+}
+
+.edgeever-selection-settle {
+ animation: edgeever-selection-settle 180ms var(--motion-ease-out) backwards;
+ transform-origin: center;
+}
+
+::view-transition-old(root),
+::view-transition-new(root) {
+ animation-duration: 180ms;
+ animation-timing-function: var(--motion-ease-out);
+}
+
/* Keep the three-pane desktop workspace usable on compact laptop screens.
* The notebook and memo columns may shrink, while the editor always keeps
* the remaining width instead of being clipped by fixed tracks.
@@ -1227,9 +1310,18 @@ textarea {
}
@media (prefers-reduced-motion: reduce) {
- .edgeever-mermaid-viewer * {
+ *,
+ *::before,
+ *::after {
+ scroll-behavior: auto !important;
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
+ animation-iteration-count: 1 !important;
+ }
+
+ ::view-transition-old(root),
+ ::view-transition-new(root) {
+ animation-duration: 0.01ms !important;
}
}