Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Uploads become WebP images with a maximum long edge of 1920 pixels, without enla

Items are sorted by latest update by default.

The background moves subtly as you scroll, and item cards slide into view on their first entrance. The first screen appears immediately. Both effects respect the system's reduced-motion preference.

The first visit downloads the interface. If a module fails to load after login, the page reloads once to fetch the current application; if it fails again, use Reload to try again.

Click the app name at the top-left to unlock the private area. Locking or refreshing hides it again.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ docker compose up -d

物品默认按最近更新排列。

滚动时背景轻微视差移动,物品卡片首次滚入视野时滑入显示。首屏内容直接显示,系统开启“减少动态效果”时关闭这两种动效。

首次打开会下载界面程序。若文件加载失败,登录后会自动重新加载最新页面一次;仍失败可点击“重新加载”重试。

点击左上角“物品管理”输入隐私区密码;解锁后可设置隐私物品、分类和位置;物品的隐私开关位于“标签”右侧。锁定或刷新后重新隐藏。
Expand Down
2 changes: 1 addition & 1 deletion desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@itemmanager/desktop",
"version": "26.7.1",
"version": "26.8.0",
"private": true,
"description": "物品管理桌面客户端",
"author": "MCJ",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "itemmanager-workspace",
"version": "26.7.1",
"version": "26.8.0",
"private": true,
"license": "MIT",
"packageManager": "pnpm@11.7.0",
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@itemmanager/web",
"version": "26.7.1",
"version": "26.8.0",
"private": true,
"license": "MIT",
"packageManager": "pnpm@11.7.0",
Expand Down
10 changes: 9 additions & 1 deletion web/src/renderer/features/items/ItemGalleryGrid.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { useEffect, useRef } from 'react';

import ItemGalleryCard from './ItemGalleryCard';
import { observeScrollReveal } from './scroll-reveal';
import './scroll-reveal.css';

export default function ItemGalleryGrid({ items, bulkMode = false, bulkSelectedIds = new Set(), onSelect }) {
const gridRef = useRef(null);
const seenRef = useRef(new WeakSet());
useEffect(() => observeScrollReveal(gridRef.current, seenRef.current), [items]);

if (!items.length) {
return (
<div className="item-gallery-empty">
Expand All @@ -11,7 +19,7 @@ export default function ItemGalleryGrid({ items, bulkMode = false, bulkSelectedI
}

return (
<div className="item-gallery-grid item-gallery-grid--showcase">
<div ref={gridRef} className="item-gallery-grid item-gallery-grid--showcase">
{items.map((item) => (
<ItemGalleryCard
key={item.id}
Expand Down
20 changes: 20 additions & 0 deletions web/src/renderer/features/items/scroll-reveal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@media (prefers-reduced-motion: no-preference) {
.item-gallery-card.scroll-reveal-enter {
animation: storage-card-reveal 360ms cubic-bezier(0.2, 0.65, 0.3, 1);
}

@keyframes storage-card-reveal {
from { opacity: 0.35; translate: 0 var(--reveal-distance, 20px); }
to { opacity: 1; translate: 0 0; }
}
}

@media (max-width: 1024px), (pointer: coarse) {
.item-gallery-card { --reveal-distance: 12px; }
}

@media (prefers-reduced-motion: reduce) {
.item-gallery-card.scroll-reveal-enter { animation: none; }
}

.item-gallery-card.scroll-reveal-enter:focus-visible { animation: none; }
64 changes: 64 additions & 0 deletions web/src/renderer/features/items/scroll-reveal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Content stays visible by default; observation only adds a brief entrance.
export function observeScrollReveal(container, seen) {
if (!container) return undefined;
const preference = window.matchMedia?.('(prefers-reduced-motion: reduce)');
let observer;
let active = true;

function clearMotion() {
container.querySelectorAll('.scroll-reveal-enter').forEach(element => element.classList.remove('scroll-reveal-enter'));
}

function configure() {
observer?.disconnect();
observer = null;
clearMotion();
if (preference?.matches || typeof IntersectionObserver !== 'function') return;
const waiting = new WeakSet();
try {
const next = new IntersectionObserver(entries => {
if (!active || observer !== next || preference?.matches) return;
for (const { target, isIntersecting } of entries) {
if (!container.contains(target) || seen.has(target)) continue;
if (!isIntersecting) {
waiting.add(target);
continue;
}
seen.add(target);
next.unobserve(target);
// The initial visible cards never wait for an animation.
if (waiting.has(target)) target.classList.add('scroll-reveal-enter');
}
}, { threshold: 0.05 });
observer = next;
container.querySelectorAll('.item-gallery-card').forEach(element => {
if (!seen.has(element)) next.observe(element);
});
} catch {
observer?.disconnect();
observer = null;
}
}

function finish(event) {
if (event.target.matches?.('.item-gallery-card')) event.target.classList.remove('scroll-reveal-enter');
}

configure();
if (preference?.addEventListener) preference.addEventListener('change', configure);
else preference?.addListener?.(configure);
container.addEventListener('animationend', finish);
container.addEventListener('animationcancel', finish);
container.addEventListener('focusin', finish);

return () => {
active = false;
observer?.disconnect();
if (preference?.removeEventListener) preference.removeEventListener('change', configure);
else preference?.removeListener?.(configure);
container.removeEventListener('animationend', finish);
container.removeEventListener('animationcancel', finish);
container.removeEventListener('focusin', finish);
clearMotion();
};
}
2 changes: 2 additions & 0 deletions web/src/renderer/features/layout/AppShell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import CatalogWorkspace from '../catalog/CatalogWorkspace';
import ItemsGalleryPage from '../items/ItemsGalleryPage';
import TagManager from '../tags/TagManager';
import Toolbar from './Toolbar';
import PageBackground from './PageBackground';

const CATALOG_CONTEXT_TITLES = {
category: '分类管理',
Expand Down Expand Up @@ -55,6 +56,7 @@ export default function AppShell({

return (
<div className="app-shell" inert={interactionDisabled}>
<PageBackground />
<Toolbar
selectedSection={visibleSection}
selectedCatalogMode={selectedCatalogMode}
Expand Down
88 changes: 88 additions & 0 deletions web/src/renderer/features/layout/PageBackground.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { useEffect, useRef } from 'react';
import './page-motion.css';

const SCROLL_SURFACES = '.item-gallery-grid, .catalog-tree-panel, .editor-pane';

export default function PageBackground() {
const layerRef = useRef(null);

useEffect(() => {
const layer = layerRef.current;
const shell = layer?.parentElement;
if (!shell || typeof window.requestAnimationFrame !== 'function') return;

const preference = window.matchMedia?.('(prefers-reduced-motion: reduce)');
let stopped = false;
let frame = null;
let pendingSource = null;

function documentSource() {
return document.scrollingElement || document.documentElement;
}

function defaultSource() {
const page = documentSource();
if (page.scrollHeight > page.clientHeight) return page;
return [...shell.querySelectorAll(SCROLL_SURFACES)].find(surface => surface.scrollHeight > surface.clientHeight) || page;
}

function draw() {
frame = null;
if (stopped || preference?.matches) return;
const source = pendingSource?.isConnected ? pendingSource : defaultSource();
pendingSource = null;
const range = Math.max(0, source.scrollHeight - source.clientHeight);
const progress = range ? Math.min(1, Math.max(0, source.scrollTop / range)) : 0;
layer.style.setProperty('--page-parallax-y', `${Math.round(-56 * progress * 100) / 100}px`);
}

function schedule(source) {
if (stopped || preference?.matches) return;
pendingSource = source;
if (frame === null) frame = window.requestAnimationFrame(draw);
}

function onScroll(event) {
const target = event.target;
if (target === document || target === window) {
schedule(documentSource());
} else if (target instanceof Element && shell.contains(target) && target.matches(SCROLL_SURFACES)
&& !target.closest('[role="dialog"], .dialog-backdrop') && target.scrollHeight > target.clientHeight) {
schedule(target);
}
}

function cancelPending() {
if (frame !== null) window.cancelAnimationFrame?.(frame);
frame = null;
pendingSource = null;
}

function onPreferenceChange() {
cancelPending();
if (preference?.matches) layer.style.setProperty('--page-parallax-y', '0px');
else schedule(defaultSource());
}

function onResize() {
schedule(defaultSource());
}

window.addEventListener('scroll', onScroll, { capture: true, passive: true });
window.addEventListener('resize', onResize, { passive: true });
if (preference?.addEventListener) preference.addEventListener('change', onPreferenceChange);
else preference?.addListener?.(onPreferenceChange);
onPreferenceChange();

return () => {
stopped = true;
cancelPending();
window.removeEventListener('scroll', onScroll, true);
window.removeEventListener('resize', onResize);
if (preference?.removeEventListener) preference.removeEventListener('change', onPreferenceChange);
else preference?.removeListener?.(onPreferenceChange);
};
}, []);

return <div ref={layerRef} className="page-background" aria-hidden="true" />;
}
25 changes: 25 additions & 0 deletions web/src/renderer/features/layout/page-motion.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.page-background {
position: fixed;
z-index: -1;
inset: -64px;
pointer-events: none;
background:
radial-gradient(ellipse at 8% 18%, rgb(15 118 110 / 11%), transparent 52%),
radial-gradient(ellipse at 88% 62%, rgb(47 111 159 / 10%), transparent 54%),
radial-gradient(ellipse at 42% 100%, rgb(217 119 6 / 4%), transparent 42%);
transform: translate3d(0, var(--page-parallax-y, 0px), 0);
will-change: transform;
}

@media (max-width: 1024px), (pointer: coarse) {
.page-background {
transform: translate3d(0, calc(var(--page-parallax-y, 0px) * 0.45), 0);
}
}

@media (prefers-reduced-motion: reduce) {
.page-background {
transform: none;
will-change: auto;
}
}
Loading
Loading