|
| 1 | +<p align="right"> |
| 2 | + <a href="./README_zh-CN.md">简体中文</a> |
| 3 | +</p> |
| 4 | + |
| 5 | +<p align="center"> |
| 6 | + <img src="./assets/readme/hero.svg" width="100%" alt="CozyTag"> |
| 7 | +</p> |
| 8 | + |
| 9 | +<p align="center"> |
| 10 | + <img src="https://img.shields.io/badge/Astro-7-0d9488?style=flat-square" alt="Astro 7"> |
| 11 | + <img src="https://img.shields.io/badge/TypeScript-5.9-0d9488?style=flat-square" alt="TypeScript 5.9"> |
| 12 | + <img src="https://img.shields.io/badge/storage-IndexedDB-0d9488?style=flat-square" alt="IndexedDB"> |
| 13 | + <img src="https://img.shields.io/badge/build-single--file%20HTML-14b8a6?style=flat-square" alt="Single-file HTML"> |
| 14 | +</p> |
| 15 | + |
| 16 | +CozyTag is a bookmark manager that runs entirely in your own browser. No backend, no login, no data collection — bookmarks, folders, icons, and preferences all stay in your browser's IndexedDB. The build output is a single HTML file you can double-click to open and use offline. |
| 17 | + |
| 18 | +## Why |
| 19 | + |
| 20 | +Most bookmark tools fall into two camps: browser built-ins tied to cloud accounts (Chrome/Edge), or third-party services that require you to trust a server (Raindrop/Pinboard). CozyTag sits in between — **you keep the organizing power, and your data stays local**: |
| 21 | + |
| 22 | +- **Your data, your machine** — Import once and everything lands in IndexedDB. Close the tab, data stays. Clear browser storage, it's gone. No server ever sees it. |
| 23 | +- **Take it anywhere** — `npm run build` produces one HTML file with all JS/CSS inlined. Put it on a USB drive, email it, host it on an intranet server. Works offline. |
| 24 | +- **Smooth with thousands** — Virtual grid rendering with absolute positioning and DOM node pooling keeps ~40 cards in the DOM even with 1700+ bookmarks. Zero layout jank. |
| 25 | +- **Import and export, lossless** — Reads Chrome/Edge/Firefox bookmark files, de-duplicates and merges folders on import. Export back to standard Netscape HTML, re-import with no loss. |
| 26 | + |
| 27 | +<p align="center"> |
| 28 | + <img src="./assets/readme/workflow.svg" width="100%" alt="Workflow"> |
| 29 | +</p> |
| 30 | + |
| 31 | +<p align="center"> |
| 32 | + <img src="./assets/readme/section-features.svg" width="100%" alt="Features"> |
| 33 | +</p> |
| 34 | + |
| 35 | +| Feature | What it does | |
| 36 | +|---|---| |
| 37 | +| Offline-first | IndexedDB storage, zero network requests, works in private mode | |
| 38 | +| Single file | Build output is one HTML file, no external dependencies | |
| 39 | +| Virtual scroll | Node pooling keeps thousands of bookmarks scrolling smoothly | |
| 40 | +| Views | Grid / list / compact, with scroll position preserved | |
| 41 | +| Smart folders | Recent / starred / uncategorized / duplicates, one click away | |
| 42 | +| Import wizard | Parse, preview, de-duplicate, merge, then import in bulk | |
| 43 | +| Lossless export | Standard Netscape HTML, re-importable | |
| 44 | +| Command palette | `Ctrl / ⌘ + K` for keyboard-first navigation | |
| 45 | +| Edit mode | Card actions stay visible; click selects instead of opening | |
| 46 | +| Custom background | Image / GIF / video ≤10MB, adjustable opacity and position | |
| 47 | +| Themes | 8-color palette, derived colors generated live with `color-mix` | |
| 48 | +| Dark mode | Layered surfaces and four-step grays for clear hierarchy | |
| 49 | +| Keyboard | Palette / search / undo / import / export / arrow navigation | |
| 50 | +| Undo | Delete, move, and bulk actions can all be rolled back | |
| 51 | + |
| 52 | +## Getting started |
| 53 | + |
| 54 | +```bash |
| 55 | +npm install # install dependencies |
| 56 | +npm run dev # local dev server |
| 57 | +npm run check # type check |
| 58 | +npm run build # build → dist/CozyTag.html (single file) |
| 59 | +``` |
| 60 | + |
| 61 | +After building, double-click `dist/CozyTag.html` to use it offline in any modern browser. On first open, click **Import** in the top-right and drop in the `.html` bookmark file your browser exports. |
| 62 | + |
| 63 | +End-to-end tests (build first): |
| 64 | + |
| 65 | +```bash |
| 66 | +node scripts/e2e.mjs # headless |
| 67 | +node scripts/e2e.mjs --headed # with browser UI |
| 68 | +``` |
| 69 | + |
| 70 | +## Tech stack |
| 71 | + |
| 72 | +- **Framework** — Astro 7 (build only, zero runtime hydration) |
| 73 | +- **Language** — TypeScript 5.9 |
| 74 | +- **Styles** — SCSS + CSS custom properties (design tokens) |
| 75 | +- **Storage** — IndexedDB (folders / bookmarks / icons / meta) |
| 76 | +- **Tests** — Playwright (44-assertion e2e suite) |
| 77 | +- **Bundling** — `scripts/bundle-single-file.mjs` inlines the Astro output into one HTML file |
| 78 | + |
| 79 | +## Project structure |
| 80 | + |
| 81 | +``` |
| 82 | +CozyTag/ |
| 83 | +├── src/ |
| 84 | +│ ├── lib/ |
| 85 | +│ │ ├── app.ts # entry: wire up views, shortcuts, background layer |
| 86 | +│ │ ├── db.ts # IndexedDB layer (four stores + batch transactions) |
| 87 | +│ │ ├── state.ts # in-memory index + event bus + undo stack |
| 88 | +│ │ ├── netscape.ts # Netscape bookmark parser |
| 89 | +│ │ ├── virtual.ts # virtual grid: absolute positioning + node pool |
| 90 | +│ │ └── ui/ # topbar / sidebar / list / import / export / palette |
| 91 | +│ ├── pages/index.astro # single page + skeleton |
| 92 | +│ └── styles/ # design tokens + layered styles |
| 93 | +├── scripts/ |
| 94 | +│ ├── bundle-single-file.mjs |
| 95 | +│ └── e2e.mjs |
| 96 | +└── package.json |
| 97 | +``` |
| 98 | + |
| 99 | +## Design notes |
| 100 | + |
| 101 | +Three principles: a neutral base with switchable accent color, a dark mode with real hierarchy, and animations that never touch layout. |
| 102 | + |
| 103 | +- **Color** — Clean neutral gray in light mode, slightly muted (not pure black) in dark mode so surfaces can float. Default accent is teal (`#0d9488`), with 7 more to switch between; all derived colors come from `color-mix`. |
| 104 | +- **Motion** — Only `transform` and `opacity`, never layout. The topbar hides with an absolute-positioned `translateY` on the compositor; the sidebar transitions via `grid-template-columns`; the virtual grid uses `translate3d`. Respects `prefers-reduced-motion`. |
| 105 | +- **Interaction** — Card action buttons stay hidden by default to avoid mis-clicks; in edit mode they stay visible and a click selects. Hover feedback uses a border and glow. |
| 106 | + |
| 107 | +## License |
| 108 | + |
| 109 | +Internal project. For development or issues, contact the maintainer. |
| 110 | + |
0 commit comments