chore(release): v1.5.0 — component refactor, knip, scroll-to-top (#58)

- Refactor: decompose BatchPanel (515→289), ConverterWorkspace (314→206),
  and InputPanel (278→216) into pure utilities, leaf components, and hooks.
  Behavior-preserving; all 193 unit tests still pass.
- Tooling: integrate knip for dead-code analysis (knip.json + npm script +
  CI step). Remove orphaned useLocalStorage.ts; declare the previously
  phantom `globals` devDependency.
- Feature: scroll-to-top button on the About page (prefers-reduced-motion
  aware, i18n across all four locales).
- Docs: bump to 1.5.0; update CHANGELOG, THIRD-PARTY, ROADMAP (Phase 4 + 5),
  CONTRIBUTING.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Opus 4.7 authored and GitHub committed 2026-05-21 20:06:51 +07:00
1 parent 30f10cfc36
commit 6197334326
32 files changed
+1759 -687

No files matched your search

+3
View File
@@ -42,6 +42,9 @@ jobs:
- name: Lint
run: npm run lint
- name: Knip
run: npm run knip
- name: Typecheck
run: npm run typecheck
+27 -1
View File
@@ -6,7 +6,33 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
## [Unreleased]
No unreleased changes at this time. Future work tracked in `docs/ROADMAP.md` under "Beyond Phase 3".
No unreleased changes at this time. Future work tracked in `docs/ROADMAP.md` under "Beyond".
## [1.5.0] — 2026-05-21
### Added
- **Scroll-to-top button on the About page.** A floating up-arrow button (`src/components/common/ScrollToTop.tsx`) fades in at the bottom-right once the About page is scrolled past ~320px, and smoothly returns to the top on click. The About page hides its scrollbar (`.scrollbar-hide`), so there was previously no quick way back up. Respects `prefers-reduced-motion` (jumps instead of animating) and stays out of the keyboard tab order / accessibility tree while hidden. New i18n key `common.scroll_to_top` across all four locales (en/vi/ja/zh-CN). The button is About-only by design — the converter workspace uses a fixed `h-dvh` layout that never page-scrolls.
### Changed
- **Internal refactor — three oversized components decomposed (behavior-preserving).** `BatchPanel.tsx` (515 lines), `ConverterWorkspace.tsx` (314), and `InputPanel.tsx` (278) were split into focused, reusable units: pure utilities (`lib/format-bytes.ts`, `lib/editor-language.ts`, `lib/read-file.ts`), leaf components (`common/ToolbarButton.tsx` — de-duplicated from InputPanel + OutputPanel — plus `converter/BatchItemRow.tsx` and `converter/BatchSummaryChips.tsx`), and hooks (`useFileAccept`, `useBatchActions`, `useConversionResult`, `useOutputBadge`, `useBatchFileRouter`). No converter or UI behavior changed; all 193 unit tests still pass.
### Tooling
- **`knip` integrated for dead-code analysis.** New `knip.json` config, an `npm run knip` script, and a `Knip` step in CI (`.github/workflows/ci.yml`) — unused files and dependencies are now caught on every push. The initial sweep deleted the orphaned `src/hooks/useLocalStorage.ts` (superseded by `lib/options-storage.ts`), dropped the unused `i18n` default export and the unused `BatchPanel` prop `onAddExternalFiles`, and un-exported the internally-used `nativeReadText`. knip's export-level `types` check is disabled — the converter-contract types in `converters/types.ts` are intentional public vocabulary, not dead code.
### Fixed
- **`globals` was a phantom (undeclared) devDependency.** `eslint.config.js` imports `globals`, but it was never listed in `package.json` — linting only worked because ESLint pulls `globals` in transitively. Now declared explicitly so a stricter or deduped install can't break `npm run lint`. Surfaced by the new `knip` check.
### Dependencies
- Added `knip` `^6.14.1` (ISC, dead-code analyzer, devDep) and `globals` `^14.0.0` (MIT, explicit devDep — previously resolved transitively). `THIRD-PARTY.md` updated.
### Tests
- No new tests this round — the refactor is behavior-preserving and the scroll button is editor/CSS/i18n surface best verified manually. The **193** existing unit tests still pass; typecheck, lint, `knip`, and `prettier --check` are all green.
## [1.4.3] — 2026-05-14
+2 -1
View File
@@ -20,11 +20,12 @@ Open <http://localhost:5173>.
```bash
npm run format
npm run lint
npm run knip
npm run typecheck
npm run build
```
CI runs all four. If any fails, your PR can't be merged.
CI runs all of these. If any fails, your PR can't be merged.
2. **Match the project style.** Read [`CLAUDE.md`](CLAUDE.md) for non-negotiable conventions (converter shape, error handling, i18n requirements).
+2
View File
@@ -122,6 +122,8 @@ installed as a runtime dependency.
| `@testing-library/jest-dom` | ^6.6.0 | MIT | [testing-library.com](https://testing-library.com/) |
| `@testing-library/user-event` | ^14.5.0 | MIT | [testing-library.com](https://testing-library.com/) |
| `jsdom` | ^29.0.0 | MIT | [github.com/jsdom/jsdom](https://github.com/jsdom/jsdom) |
| `knip` | ^6.14.1 | ISC | [knip.dev](https://knip.dev/) |
| `globals` | ^14.0.0 | MIT | [github.com/sindresorhus/globals](https://github.com/sindresorhus/globals) |
## Fonts
+28 -2
View File
@@ -219,7 +219,33 @@ Goal: ship the .NET RESX converter and integrate with existing AutoClickForge /
---
## Beyond Phase 3 — Ideas (no commitment)
## Phase 4 — Binary formats & reverse conversion ✅
**Status**: complete (shipped in v1.1.0)
Post-1.0 expansion: three binary target formats and bidirectional conversion.
- [x] **BSON / CBOR / MessagePack** converters — output rendered as base64 (default) or hex; downloads decode back to raw bytes. New `ConverterMeta.binary` flag.
- [x] **Reverse conversion** — optional `Converter<T>.reverse()` interface method; JSONL, CSV/TSV, YAML, TOML, RESX → JSON. New `DirectionToggle` component, direction persisted to localStorage.
- [x] Reverse batch processing — drop non-JSON files, get a `.zip` of `.json` outputs back.
**12/12 formats production-ready.**
---
## Phase 5 — Maintenance & refactor ✅
**Status**: complete (shipped in v1.5.0)
Codebase hygiene plus a small UX addition — no converter behavior changed.
- [x] Decomposed three oversized components (`BatchPanel`, `ConverterWorkspace`, `InputPanel`) into focused pure utilities, leaf components, and hooks — behavior-preserving, all 193 tests still green.
- [x] Integrated `knip` for dead-code analysis: `knip.json` config, `npm run knip` script, and a CI step. Initial sweep removed orphaned code and a phantom dependency.
- [x] Scroll-to-top button on the long, scrollbar-hidden About page (respects `prefers-reduced-motion`).
---
## Beyond — Ideas (no commitment)
- **JSON → Excel (.xlsx)** via SheetJS — possible if Markdown/CSV doesn't cover the use case
- **Reverse direction** (other format → JSON): different mental model; might warrant a sibling app
@@ -228,7 +254,7 @@ Goal: ship the .NET RESX converter and integrate with existing AutoClickForge /
- **VS Code extension**: surface the converters in the editor command palette
- **Sharing**: hash-based shareable URLs (`#data=...`) for sample inputs (privacy: opt-in only)
These are deliberately deferred — Phase 1–3 first.
These are deliberately deferred — Phase 1–5 first.
---
+15
View File
@@ -0,0 +1,15 @@
{
"project": ["src/**/*.{ts,tsx}"],
"ignore": ["src/components/ui/**"],
"ignoreDependencies": [
"@radix-ui/react-slot",
"tailwindcss",
"tw-animate-css",
"@tauri-apps/plugin-os",
"@tauri-apps/plugin-shell",
"@testing-library/user-event"
],
"rules": {
"types": "off"
}
}
+913
View File
@@ -69,7 +69,9 @@
"eslint": "^9.15.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.0",
"globals": "^14.0.0",
"jsdom": "^29.0.0",
"knip": "^6.14.1",
"prettier": "^3.4.0",
"prettier-plugin-tailwindcss": "^0.6.0",
"tailwindcss": "^4.0.0",
@@ -1130,6 +1132,372 @@
],
"license": "MIT"
},
"node_modules/@oxc-parser/binding-android-arm-eabi": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.130.0.tgz",
"integrity": "sha512-h/xYU8/7ADWzVSf5I+YalLpj33LOy9CI/zgbJNIZ5eunRBG+Czqa3lZsvuPHHf3rOt6z1c5+UzoxjbAzAvhwVw==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-android-arm64": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm64/-/binding-android-arm64-0.130.0.tgz",
"integrity": "sha512-oFWFJrsGv9siFM4HjMqKNB7IuIZD/SMmZdCXl8xyx7lDplGvPKyewpOo272rSWgMXe2Wx7bWI0Yj+gkHv4qbeg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-darwin-arm64": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-arm64/-/binding-darwin-arm64-0.130.0.tgz",
"integrity": "sha512-sGUzupdTplK9jQg7eJZ878HfEgQjJNBc6dAYVWJ9W5aU+J8rLfRJhTVsKThiu1pNwm6Y1qKCcbC6WhNWSXR3Ig==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-darwin-x64": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-x64/-/binding-darwin-x64-0.130.0.tgz",
"integrity": "sha512-PsB4cdCISbC00Uy8eiD8bc2AkGWjZqrSrJnkBFuG2ptrrf6mZ2F5gLFSjOAVMMgZPg8B1D7OydJwLWSfyI2Plg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-freebsd-x64": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-freebsd-x64/-/binding-freebsd-x64-0.130.0.tgz",
"integrity": "sha512-DgABp3l38hS77JbXCV4qk1+n6DPym5u8zzwuweokezm2tX194nDSJDENbDRECxVsiNbprKATLbk+Z5wlHT0OHw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-linux-arm-gnueabihf": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.130.0.tgz",
"integrity": "sha512-4Kn3CTEmwFrzhTSC/JuUW16qovmaMdX7jeSKbL8w0pLtLww7To1a2XJi9Z5uD8QWUkfUHhqfV+VD6dVzBnWzoA==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-linux-arm-musleabihf": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.130.0.tgz",
"integrity": "sha512-D35KZM3F4rRu1uAFKyBlg3Gaf/ybCjyaPR1hfgvk5ex8NtcTmRgc0JgSighEyNg96TPrFhemFba68SZuxaha8w==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-linux-arm64-gnu": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.130.0.tgz",
"integrity": "sha512-Q9o7oVlo955KHwS8l1u0bCzIx+JsZUA3XToLXC+MsMhye/9LeBQbt84nh120cl2XLy+TEzvugYDiHShg5yaX6Q==",
"cpu": [
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-linux-arm64-musl": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.130.0.tgz",
"integrity": "sha512-EiJ/gC0ljbcwVpycC8YWw6ggMbtsPX8XMOt0mPx0aqWeMsNR+L9m05Flbvd5T+GlivG+GkSWQL7tM9SRFpM/dw==",
"cpu": [
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-linux-ppc64-gnu": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.130.0.tgz",
"integrity": "sha512-b+h/lsLLurp756dMGizNs5uPaJfyEdWrTcV5t8M609jWm1DEHB1StpRXCkyvwtkJx3m+qL5BNQ0dEKan/4yGFA==",
"cpu": [
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-linux-riscv64-gnu": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.130.0.tgz",
"integrity": "sha512-O19Cil83XAyjEFfo8WhkMwY58ALqZ7ckjGL+25mjMIuF84urWBeANH0FC8B8BsSSygWU3/1aY3ADdDbp+wlBnw==",
"cpu": [
"riscv64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-linux-riscv64-musl": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.130.0.tgz",
"integrity": "sha512-BgXRVC0+83n3YzCscLQjj6nbyeBIVeZYPTI4fFMAE4WNm2+4RXhWp03IVizL7esIz36kgmT48aebk1iM+cs8sw==",
"cpu": [
"riscv64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-linux-s390x-gnu": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.130.0.tgz",
"integrity": "sha512-6tJz0xvnGhsokE7N1WlUSBXibpYmT9xSJFS1Ce41Km/+8gQvdlW8MLhRv8PD0L7ix8vRG0FDDepp3jdOFzdVdw==",
"cpu": [
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-linux-x64-gnu": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.130.0.tgz",
"integrity": "sha512-9aCWj83dp3heTQGmGnZGdIWgxjZrr/7VQ0TGFHH5PKByxJKF2Hcr4qvaSUHhhGEa3MSsDjTL1YDP8RAgdL5/Cg==",
"cpu": [
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-linux-x64-musl": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-musl/-/binding-linux-x64-musl-0.130.0.tgz",
"integrity": "sha512-afXt87aZBqrUVli8TB/I8H1G50RDWcwirjWtXGXYqJ2ZqWEiErH7V72j3LUSDZaivmtu2OLX0KQ/mbhP81mr7A==",
"cpu": [
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-openharmony-arm64": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-openharmony-arm64/-/binding-openharmony-arm64-0.130.0.tgz",
"integrity": "sha512-I0NCrZV/YZuCGWgqwNN/GO/iXlLF2z+Wgc7u+Aa9N4P51oYeIa0XT+zVBUne4csO9GqxskXgI4g8JzzWGRpfOw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-wasm32-wasi": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-wasm32-wasi/-/binding-wasm32-wasi-0.130.0.tgz",
"integrity": "sha512-sJgQkGaBX0WJvPUDfwciex6IcTk5O5NLQ1bhEb6f3nBruh1GshKMRSMt2bxZlYrgBzjyBbJzsnO+InPG0bg+fA==",
"cpu": [
"wasm32"
],
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/core": "1.10.0",
"@emnapi/runtime": "1.10.0",
"@napi-rs/wasm-runtime": "^1.1.4"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-win32-arm64-msvc": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.130.0.tgz",
"integrity": "sha512-bjcma99sQrNh6RY4mPO9yTkfxql6TDFoN3HWdK31RCKXwNhcDgJXW/l8PUtzKNiQ+9vpKJfJtQq+LklBuxSOBA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-win32-ia32-msvc": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.130.0.tgz",
"integrity": "sha512-hRYbv6HhpSTzT4xTiIkadLI7upLQxuOdLPR/9nL1fTjwhgutBTPXrwaAPb/jTFVx6/8C7Jb5HcUKhmNwloTbFA==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-parser/binding-win32-x64-msvc": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.130.0.tgz",
"integrity": "sha512-RBpA9TsRucJq6HNVNCFF1iKg+QeTkLdZf7hi4xaOGCPvMZWvDHjQgSOEZMUpuW4JNciHbxNhLEYmz5CVygjVGQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxc-project/types": {
"version": "0.129.0",
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.129.0.tgz",
@@ -1140,6 +1508,313 @@
"url": "https://github.com/sponsors/Boshen"
}
},
"node_modules/@oxc-resolver/binding-android-arm-eabi": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-android-arm-eabi/-/binding-android-arm-eabi-11.19.1.tgz",
"integrity": "sha512-aUs47y+xyXHUKlbhqHUjBABjvycq6YSD7bpxSW7vplUmdzAlJ93yXY6ZR0c1o1x5A/QKbENCvs3+NlY8IpIVzg==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
]
},
"node_modules/@oxc-resolver/binding-android-arm64": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-android-arm64/-/binding-android-arm64-11.19.1.tgz",
"integrity": "sha512-oolbkRX+m7Pq2LNjr/kKgYeC7bRDMVTWPgxBGMjSpZi/+UskVo4jsMU3MLheZV55jL6c3rNelPl4oD60ggYmqA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
]
},
"node_modules/@oxc-resolver/binding-darwin-arm64": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-darwin-arm64/-/binding-darwin-arm64-11.19.1.tgz",
"integrity": "sha512-nUC6d2i3R5B12sUW4O646qD5cnMXf2oBGPLIIeaRfU9doJRORAbE2SGv4eW6rMqhD+G7nf2Y8TTJTLiiO3Q/dQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@oxc-resolver/binding-darwin-x64": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-darwin-x64/-/binding-darwin-x64-11.19.1.tgz",
"integrity": "sha512-cV50vE5+uAgNcFa3QY1JOeKDSkM/9ReIcc/9wn4TavhW/itkDGrXhw9jaKnkQnGbjJ198Yh5nbX/Gr2mr4Z5jQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@oxc-resolver/binding-freebsd-x64": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-freebsd-x64/-/binding-freebsd-x64-11.19.1.tgz",
"integrity": "sha512-xZOQiYGFxtk48PBKff+Zwoym7ScPAIVp4c14lfLxizO2LTTTJe5sx9vQNGrBymrf/vatSPNMD4FgsaaRigPkqw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
]
},
"node_modules/@oxc-resolver/binding-linux-arm-gnueabihf": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-11.19.1.tgz",
"integrity": "sha512-lXZYWAC6kaGe/ky2su94e9jN9t6M0/6c+GrSlCqL//XO1cxi5lpAhnJYdyrKfm0ZEr/c7RNyAx3P7FSBcBd5+A==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-arm-musleabihf": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-11.19.1.tgz",
"integrity": "sha512-veG1kKsuK5+t2IsO9q0DErYVSw2azvCVvWHnfTOS73WE0STdLLB7Q1bB9WR+yHPQM76ASkFyRbogWo1GR1+WbQ==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-arm64-gnu": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-11.19.1.tgz",
"integrity": "sha512-heV2+jmXyYnUrpUXSPugqWDRpnsQcDm2AX4wzTuvgdlZfoNYO0O3W2AVpJYaDn9AG4JdM6Kxom8+foE7/BcSig==",
"cpu": [
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-arm64-musl": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm64-musl/-/binding-linux-arm64-musl-11.19.1.tgz",
"integrity": "sha512-jvo2Pjs1c9KPxMuMPIeQsgu0mOJF9rEb3y3TdpsrqwxRM+AN6/nDDwv45n5ZrUnQMsdBy5gIabioMKnQfWo9ew==",
"cpu": [
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-ppc64-gnu": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-11.19.1.tgz",
"integrity": "sha512-vLmdNxWCdN7Uo5suays6A/+ywBby2PWBBPXctWPg5V0+eVuzsJxgAn6MMB4mPlshskYbppjpN2Zg83ArHze9gQ==",
"cpu": [
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-riscv64-gnu": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-11.19.1.tgz",
"integrity": "sha512-/b+WgR+VTSBxzgOhDO7TlMXC1ufPIMR6Vj1zN+/x+MnyXGW7prTLzU9eW85Aj7Th7CCEG9ArCbTeqxCzFWdg2w==",
"cpu": [
"riscv64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-riscv64-musl": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-11.19.1.tgz",
"integrity": "sha512-YlRdeWb9j42p29ROh+h4eg/OQ3dTJlpHSa+84pUM9+p6i3djtPz1q55yLJhgW9XfDch7FN1pQ/Vd6YP+xfRIuw==",
"cpu": [
"riscv64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-s390x-gnu": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-11.19.1.tgz",
"integrity": "sha512-EDpafVOQWF8/MJynsjOGFThcqhRHy417sRyLfQmeiamJ8qVhSKAn2Dn2VVKUGCjVB9C46VGjhNo7nOPUi1x6uA==",
"cpu": [
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-x64-gnu": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-x64-gnu/-/binding-linux-x64-gnu-11.19.1.tgz",
"integrity": "sha512-NxjZe+rqWhr+RT8/Ik+5ptA3oz7tUw361Wa5RWQXKnfqwSSHdHyrw6IdcTfYuml9dM856AlKWZIUXDmA9kkiBQ==",
"cpu": [
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-linux-x64-musl": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-x64-musl/-/binding-linux-x64-musl-11.19.1.tgz",
"integrity": "sha512-cM/hQwsO3ReJg5kR+SpI69DMfvNCp+A/eVR4b4YClE5bVZwz8rh2Nh05InhwI5HR/9cArbEkzMjcKgTHS6UaNw==",
"cpu": [
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxc-resolver/binding-openharmony-arm64": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-openharmony-arm64/-/binding-openharmony-arm64-11.19.1.tgz",
"integrity": "sha512-QF080IowFB0+9Rh6RcD19bdgh49BpQHUW5TajG1qvWHvmrQznTZZjYlgE2ltLXyKY+qs4F/v5xuX1XS7Is+3qA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
]
},
"node_modules/@oxc-resolver/binding-wasm32-wasi": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-wasm32-wasi/-/binding-wasm32-wasi-11.19.1.tgz",
"integrity": "sha512-w8UCKhX826cP/ZLokXDS6+milN8y4X7zidsAttEdWlVoamTNf6lhBJldaWr3ukTDiye7s4HRcuPEPOXNC432Vg==",
"cpu": [
"wasm32"
],
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@napi-rs/wasm-runtime": "^1.1.1"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@oxc-resolver/binding-win32-arm64-msvc": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-11.19.1.tgz",
"integrity": "sha512-nJ4AsUVZrVKwnU/QRdzPCCrO0TrabBqgJ8pJhXITdZGYOV28TIYystV1VFLbQ7DtAcaBHpocT5/ZJnF78YJPtQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@oxc-resolver/binding-win32-ia32-msvc": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-11.19.1.tgz",
"integrity": "sha512-EW+ND5q2Tl+a3pH81l1QbfgbF3HmqgwLfDfVithRFheac8OTcnbXt/JxqD2GbDkb7xYEqy1zNaVFRr3oeG8npA==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@oxc-resolver/binding-win32-x64-msvc": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-x64-msvc/-/binding-win32-x64-msvc-11.19.1.tgz",
"integrity": "sha512-6hIU3RQu45B+VNTY4Ru8ppFwjVS/S5qwYyGhBotmjxfEKk41I2DlGtRfGJndZ5+6lneE2pwloqunlOyZuX/XAw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@radix-ui/primitive": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz",
@@ -3999,6 +4674,16 @@
"fxparser": "src/cli/cli.js"
}
},
"node_modules/fd-package-json": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fd-package-json/-/fd-package-json-2.0.0.tgz",
"integrity": "sha512-jKmm9YtsNXN789RS/0mSzOC1NUq9mkVd65vbSSVsKdjGvYXBuE4oWe2QOEoFeRmJg+lPuZxpmrfFclNhoRMneQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"walk-up-path": "^4.0.0"
}
},
"node_modules/fdir": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
@@ -4086,6 +4771,22 @@
"dev": true,
"license": "ISC"
},
"node_modules/formatly": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/formatly/-/formatly-0.3.0.tgz",
"integrity": "sha512-9XNj/o4wrRFyhSMJOvsuyMwy8aUfBaZ1VrqHVfohyXf0Sw0e+yfKG+xZaY3arGCOMdwFsqObtzVOc1gU9KiT9w==",
"dev": true,
"license": "MIT",
"dependencies": {
"fd-package-json": "^2.0.0"
},
"bin": {
"formatly": "bin/index.mjs"
},
"engines": {
"node": ">=18.3.0"
}
},
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
@@ -4110,6 +4811,19 @@
"node": ">=6"
}
},
"node_modules/get-tsconfig": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.14.0.tgz",
"integrity": "sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==",
"dev": true,
"license": "MIT",
"dependencies": {
"resolve-pkg-maps": "^1.0.0"
},
"funding": {
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
"node_modules/glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
@@ -4447,6 +5161,59 @@
"json-buffer": "3.0.1"
}
},
"node_modules/knip": {
"version": "6.14.1",
"resolved": "https://registry.npmjs.org/knip/-/knip-6.14.1.tgz",
"integrity": "sha512-SN3Ly0ixzj5CQkY/rc4OPHpWrCC0XRIIjgdP76G9Cni5k72ur5jBYOyvJuF5oPTM14v8eHcMUgPbElHa+lnR0g==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/webpro"
},
{
"type": "opencollective",
"url": "https://opencollective.com/knip"
}
],
"license": "ISC",
"dependencies": {
"fdir": "^6.5.0",
"formatly": "^0.3.0",
"get-tsconfig": "4.14.0",
"jiti": "^2.7.0",
"minimist": "^1.2.8",
"oxc-parser": "^0.130.0",
"oxc-resolver": "^11.19.1",
"picomatch": "^4.0.4",
"smol-toml": "^1.6.1",
"strip-json-comments": "5.0.3",
"tinyglobby": "^0.2.16",
"unbash": "^3.0.0",
"yaml": "^2.9.0",
"zod": "^4.1.11"
},
"bin": {
"knip": "bin/knip.js",
"knip-bun": "bin/knip-bun.js"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/knip/node_modules/strip-json-comments": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.0.3.tgz",
"integrity": "sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14.16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/levn": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
@@ -4870,6 +5637,16 @@
"node": "*"
}
},
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@@ -4956,6 +5733,86 @@
"node": ">= 0.8.0"
}
},
"node_modules/oxc-parser": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.130.0.tgz",
"integrity": "sha512-X0PJ+NmOok8qP3vK9uaW431ngkdM9UPEK7KG466urtIL2+EYTEgbZK2yqe2MWKJKBjRlFweP/pJPx0x9muMEVw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@oxc-project/types": "^0.130.0"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"funding": {
"url": "https://github.com/sponsors/Boshen"
},
"optionalDependencies": {
"@oxc-parser/binding-android-arm-eabi": "0.130.0",
"@oxc-parser/binding-android-arm64": "0.130.0",
"@oxc-parser/binding-darwin-arm64": "0.130.0",
"@oxc-parser/binding-darwin-x64": "0.130.0",
"@oxc-parser/binding-freebsd-x64": "0.130.0",
"@oxc-parser/binding-linux-arm-gnueabihf": "0.130.0",
"@oxc-parser/binding-linux-arm-musleabihf": "0.130.0",
"@oxc-parser/binding-linux-arm64-gnu": "0.130.0",
"@oxc-parser/binding-linux-arm64-musl": "0.130.0",
"@oxc-parser/binding-linux-ppc64-gnu": "0.130.0",
"@oxc-parser/binding-linux-riscv64-gnu": "0.130.0",
"@oxc-parser/binding-linux-riscv64-musl": "0.130.0",
"@oxc-parser/binding-linux-s390x-gnu": "0.130.0",
"@oxc-parser/binding-linux-x64-gnu": "0.130.0",
"@oxc-parser/binding-linux-x64-musl": "0.130.0",
"@oxc-parser/binding-openharmony-arm64": "0.130.0",
"@oxc-parser/binding-wasm32-wasi": "0.130.0",
"@oxc-parser/binding-win32-arm64-msvc": "0.130.0",
"@oxc-parser/binding-win32-ia32-msvc": "0.130.0",
"@oxc-parser/binding-win32-x64-msvc": "0.130.0"
}
},
"node_modules/oxc-parser/node_modules/@oxc-project/types": {
"version": "0.130.0",
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.130.0.tgz",
"integrity": "sha512-ibD2usx9JRu7f5pu2tMKMI4cpA4NgXJQoYRP4pQ7Pxmn1l6k/53qWtQWZayhYy3X4QZkt90Ot+mJEaeXouio6Q==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/Boshen"
}
},
"node_modules/oxc-resolver": {
"version": "11.19.1",
"resolved": "https://registry.npmjs.org/oxc-resolver/-/oxc-resolver-11.19.1.tgz",
"integrity": "sha512-qE/CIg/spwrTBFt5aKmwe3ifeDdLfA2NESN30E42X/lII5ClF8V7Wt6WIJhcGZjp0/Q+nQ+9vgxGk//xZNX2hg==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/Boshen"
},
"optionalDependencies": {
"@oxc-resolver/binding-android-arm-eabi": "11.19.1",
"@oxc-resolver/binding-android-arm64": "11.19.1",
"@oxc-resolver/binding-darwin-arm64": "11.19.1",
"@oxc-resolver/binding-darwin-x64": "11.19.1",
"@oxc-resolver/binding-freebsd-x64": "11.19.1",
"@oxc-resolver/binding-linux-arm-gnueabihf": "11.19.1",
"@oxc-resolver/binding-linux-arm-musleabihf": "11.19.1",
"@oxc-resolver/binding-linux-arm64-gnu": "11.19.1",
"@oxc-resolver/binding-linux-arm64-musl": "11.19.1",
"@oxc-resolver/binding-linux-ppc64-gnu": "11.19.1",
"@oxc-resolver/binding-linux-riscv64-gnu": "11.19.1",
"@oxc-resolver/binding-linux-riscv64-musl": "11.19.1",
"@oxc-resolver/binding-linux-s390x-gnu": "11.19.1",
"@oxc-resolver/binding-linux-x64-gnu": "11.19.1",
"@oxc-resolver/binding-linux-x64-musl": "11.19.1",
"@oxc-resolver/binding-openharmony-arm64": "11.19.1",
"@oxc-resolver/binding-wasm32-wasi": "11.19.1",
"@oxc-resolver/binding-win32-arm64-msvc": "11.19.1",
"@oxc-resolver/binding-win32-ia32-msvc": "11.19.1",
"@oxc-resolver/binding-win32-x64-msvc": "11.19.1"
}
},
"node_modules/p-limit": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
@@ -5494,6 +6351,16 @@
"node": ">=4"
}
},
"node_modules/resolve-pkg-maps": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",
"integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
}
},
"node_modules/rolldown": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.0.tgz",
@@ -5901,6 +6768,16 @@
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/unbash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/unbash/-/unbash-3.0.0.tgz",
"integrity": "sha512-FeFPZ/WFT0mbRCuydiZzpPFlrYN8ZUpphQKoq4EeElVIYjYyGzPMxQR/simUwCOJIyVhpFk4RbtyO7RuMpMnHA==",
"dev": true,
"license": "ISC",
"engines": {
"node": ">=14"
}
},
"node_modules/undici": {
"version": "7.25.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.25.0.tgz",
@@ -6167,6 +7044,16 @@
"node": ">=18"
}
},
"node_modules/walk-up-path": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-4.0.0.tgz",
"integrity": "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A==",
"dev": true,
"license": "ISC",
"engines": {
"node": "20 || >=22"
}
},
"node_modules/webidl-conversions": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz",
@@ -6277,6 +7164,22 @@
"dev": true,
"license": "MIT"
},
"node_modules/yaml": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
"integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
"dev": true,
"license": "ISC",
"bin": {
"yaml": "bin.mjs"
},
"engines": {
"node": ">= 14.6"
},
"funding": {
"url": "https://github.com/sponsors/eemeli"
}
},
"node_modules/yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
@@ -6290,6 +7193,16 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/zod": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
"integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
},
"node_modules/zustand": {
"version": "5.0.13",
"resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.13.tgz",
+4 -1
View File
@@ -1,7 +1,7 @@
{
"name": "jsonprism",
"private": true,
"version": "1.4.3",
"version": "1.5.0",
"type": "module",
"description": "Disperse JSON into many formats — JSONL, CSV, YAML, XML, TOML, RESX, Markdown, SQL — fully client-side.",
"author": "poli0981 <https://github.com/poli0981>",
@@ -20,6 +20,7 @@
"preview": "vite preview",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"knip": "knip",
"format": "prettier --write \"src/**/*.{ts,tsx,css,md,json}\"",
"format:check": "prettier --check \"src/**/*.{ts,tsx,css,md,json}\"",
"typecheck": "tsc -b --noEmit",
@@ -93,7 +94,9 @@
"eslint": "^9.15.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.0",
"globals": "^14.0.0",
"jsdom": "^29.0.0",
"knip": "^6.14.1",
"prettier": "^3.4.0",
"prettier-plugin-tailwindcss": "^0.6.0",
"tailwindcss": "^4.0.0",
+51
View File
@@ -0,0 +1,51 @@
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { ArrowUp } from 'lucide-react';
import { cn } from '@/lib/utils';
interface ScrollToTopProps {
/** The scroll container to watch and scroll back to top. */
scrollRef: React.RefObject<HTMLDivElement | null>;
/** Reveal the button once the container is scrolled past this many pixels. */
threshold?: number;
}
export function ScrollToTop({ scrollRef, threshold = 320 }: ScrollToTopProps) {
const { t } = useTranslation();
const [visible, setVisible] = useState(false);
useEffect(() => {
const el = scrollRef.current;
if (!el) return;
const onScroll = () => setVisible(el.scrollTop > threshold);
onScroll();
el.addEventListener('scroll', onScroll, { passive: true });
return () => el.removeEventListener('scroll', onScroll);
}, [scrollRef, threshold]);
const handleClick = () => {
const el = scrollRef.current;
if (!el) return;
const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
el.scrollTo({ top: 0, behavior: reduceMotion ? 'auto' : 'smooth' });
};
return (
<button
type="button"
onClick={handleClick}
aria-label={t('common.scroll_to_top')}
title={t('common.scroll_to_top')}
aria-hidden={!visible}
tabIndex={visible ? 0 : -1}
className={cn(
'absolute right-4 bottom-4 z-20 inline-flex h-10 w-10 items-center justify-center',
'border-border/60 bg-card/90 text-muted-foreground rounded-full border shadow-sm',
'hover:border-primary/40 hover:bg-card hover:text-foreground backdrop-blur-sm transition',
visible ? 'opacity-100' : 'pointer-events-none opacity-0',
)}
>
<ArrowUp className="h-4 w-4" />
</button>
);
}
+22
View File
@@ -0,0 +1,22 @@
interface ToolbarButtonProps {
onClick: () => void;
label: string;
icon: React.ReactNode;
disabled?: boolean;
}
export function ToolbarButton({ onClick, label, icon, disabled }: ToolbarButtonProps) {
return (
<button
type="button"
onClick={onClick}
disabled={disabled}
aria-label={label}
title={label}
className="text-muted-foreground hover:bg-muted hover:text-foreground inline-flex items-center gap-1.5 rounded px-2 py-1 text-xs transition disabled:cursor-not-allowed disabled:opacity-40"
>
{icon}
<span className="hidden sm:inline">{label}</span>
</button>
);
}
+114
View File
@@ -0,0 +1,114 @@
import { useTranslation } from 'react-i18next';
import { Loader2, Trash2 } from 'lucide-react';
import { cn } from '@/lib/utils';
import { formatBytes } from '@/lib/format-bytes';
import type { BatchItem } from '@/stores/batchStore';
interface BatchItemRowProps {
item: BatchItem;
outputExt: string;
onRemove: () => void;
disabled: boolean;
}
export function BatchItemRow({ item, outputExt, onRemove, disabled }: BatchItemRowProps) {
const { t } = useTranslation();
const Icon = statusIcon(item.status);
const tone = statusTone(item.status);
return (
<li className="flex items-start gap-2 py-2.5">
<Icon className={cn('mt-0.5 h-4 w-4 shrink-0', tone)} />
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
<span className="text-foreground truncate font-mono text-xs">{item.filename}</span>
<span className="text-muted-foreground/60 font-mono text-[10px]">→ .{outputExt}</span>
</div>
<div className="text-muted-foreground mt-0.5 flex items-center gap-2 font-mono text-[10px]">
<span>{formatBytes(item.size)}</span>
{item.outputSize !== undefined && (
<>
<span>·</span>
<span>
{t('batch.row.out')}: {formatBytes(item.outputSize)}
</span>
</>
)}
</div>
{item.error && (
<p className="text-destructive mt-1 font-mono text-[10px] break-words">{item.error}</p>
)}
</div>
<button
type="button"
onClick={onRemove}
disabled={disabled}
aria-label={t('batch.row.remove')}
className="text-muted-foreground hover:bg-muted hover:text-foreground rounded p-1 transition disabled:cursor-not-allowed disabled:opacity-40"
>
<Trash2 className="h-3 w-3" />
</button>
</li>
);
}
function statusIcon(status: BatchItem['status']) {
switch (status) {
case 'queued':
return CircleIcon;
case 'processing':
return ProcessingIcon;
case 'done':
return CheckIcon;
case 'error':
return ErrorIcon;
}
}
function statusTone(status: BatchItem['status']): string {
switch (status) {
case 'done':
return 'text-primary';
case 'error':
return 'text-destructive';
case 'processing':
return 'text-foreground';
case 'queued':
default:
return 'text-muted-foreground/60';
}
}
function CircleIcon({ className }: { className?: string }) {
return (
<svg viewBox="0 0 16 16" fill="none" className={className} aria-hidden>
<circle cx="8" cy="8" r="6" stroke="currentColor" strokeWidth="1.5" />
</svg>
);
}
function ProcessingIcon({ className }: { className?: string }) {
return <Loader2 className={cn(className, 'animate-spin')} />;
}
function CheckIcon({ className }: { className?: string }) {
return (
<svg viewBox="0 0 16 16" fill="none" className={className} aria-hidden>
<path
d="M3 8.5L6.5 12L13 5"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
}
function ErrorIcon({ className }: { className?: string }) {
return (
<svg viewBox="0 0 16 16" fill="none" className={className} aria-hidden>
<path d="M4 4L12 12M12 4L4 12" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
</svg>
);
}
+22 -248
View File
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useMemo, useRef } from 'react';
import { useCallback, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { useDropzone } from 'react-dropzone';
import { Download, FileStack, FolderOpen, Loader2, Play, StopCircle, Trash2 } from 'lucide-react';
import { Download, FileStack, FolderOpen, Play, StopCircle, Trash2 } from 'lucide-react';
import {
Sheet,
SheetContent,
@@ -11,14 +11,16 @@ import {
SheetTrigger,
} from '@/components/ui/sheet';
import { toast } from '@/components/ui/sonner';
import { useBatchStore, BATCH_MAX_FILES, type BatchItem } from '@/stores/batchStore';
import { processBatch, zipOutputs, downloadBlob } from '@/lib/batch-processor';
import { filterByExtension, getAllowedExtensions } from '@/lib/file-filter';
import { isTauri, nativeOpenFiles, nativeSaveBlob, fileFromNativePath } from '@/lib/tauri';
import { getConverter } from '@/converters/registry';
import type { FormatId } from '@/converters/types';
import { useBatchActions } from '@/hooks/useBatchActions';
import { useFileAccept } from '@/hooks/useFileAccept';
import { filterByExtension } from '@/lib/file-filter';
import { isTauri, nativeOpenFiles, fileFromNativePath } from '@/lib/tauri';
import { cn } from '@/lib/utils';
import { useBatchStore, BATCH_MAX_FILES } from '@/stores/batchStore';
import type { FormatId } from '@/converters/types';
import type { Direction } from './DirectionToggle';
import { BatchItemRow } from './BatchItemRow';
import { BatchSummaryChips } from './BatchSummaryChips';
interface BatchPanelProps {
format: FormatId;
@@ -26,8 +28,6 @@ interface BatchPanelProps {
options: Record<string, unknown>;
open: boolean;
onOpenChange: (open: boolean) => void;
/** Filenames added via this trigger button are also routed into the queue. */
onAddExternalFiles?: (files: File[]) => void;
}
export function BatchPanel({ format, direction, options, open, onOpenChange }: BatchPanelProps) {
@@ -38,9 +38,6 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
const addFiles = useBatchStore((s) => s.addFiles);
const removeItem = useBatchStore((s) => s.removeItem);
const clear = useBatchStore((s) => s.clear);
const setProcessing = useBatchStore((s) => s.setProcessing);
const setAbortController = useBatchStore((s) => s.setAbortController);
const updateItem = useBatchStore((s) => s.updateItem);
const resetStatuses = useBatchStore((s) => s.resetStatuses);
const fileInputRef = useRef<HTMLInputElement>(null);
@@ -50,29 +47,11 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
const errorCount = itemOrder.filter((id) => items[id]?.status === 'error').length;
const queuedCount = itemOrder.filter((id) => items[id]?.status === 'queued').length;
const isReverse = direction === 'reverse';
const converter = getConverter(format);
const accept = useMemo(() => {
if (isReverse) {
return {
[converter.meta.mimeType]: [`.${converter.meta.extension}`],
'text/plain': ['.txt'],
};
}
return { 'application/json': ['.json'], 'text/plain': ['.txt'] };
}, [isReverse, converter.meta.mimeType, converter.meta.extension]);
const fileInputAccept = isReverse
? `.${converter.meta.extension},.txt,${converter.meta.mimeType}`
: '.json,.txt,application/json';
// Whitelist of file extensions that match the current direction × format.
// The browser's native `<input accept>` is only a hint, so we re-validate
// in JS to reject files chosen via "Browse" with "All files" filter.
const allowedExtensions = useMemo(
() => getAllowedExtensions(isReverse ? 'reverse' : 'forward', converter.meta.extension),
[isReverse, converter.meta.extension],
const { converter, isReverse, accept, fileInputAccept, allowedExtensions } = useFileAccept(
format,
direction,
);
const { start, cancel, downloadZip } = useBatchActions(format, direction, options);
const handleAddFiles = useCallback(
(files: File[]) => {
@@ -124,78 +103,6 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
noKeyboard: true,
});
const handleStart = useCallback(async () => {
const queued = itemOrder
.map((id) => items[id])
.filter((it): it is BatchItem => !!it && it.status !== 'done' && it.status !== 'processing');
if (queued.length === 0) {
toast.info(t('batch.toast.nothing_to_process'));
return;
}
const controller = new AbortController();
setAbortController(controller);
setProcessing(true);
toast.success(t('batch.toast.started', { count: queued.length }));
try {
await processBatch(
queued,
format,
options,
{
onUpdate: (id, patch) => updateItem(id, patch),
},
controller.signal,
direction,
);
if (!controller.signal.aborted) {
toast.success(t('batch.toast.finished'));
}
} catch (err) {
toast.error(t('batch.toast.failed', { message: (err as Error).message }));
} finally {
setProcessing(false);
setAbortController(null);
}
}, [
direction,
format,
items,
itemOrder,
options,
setAbortController,
setProcessing,
t,
updateItem,
]);
const handleCancel = useCallback(() => {
useBatchStore.getState().abortController?.abort();
toast.info(t('batch.toast.cancelled'));
}, [t]);
const handleDownloadZip = useCallback(async () => {
const done = itemOrder.map((id) => items[id]).filter((it): it is BatchItem => !!it);
try {
const { blob, fileCount } = await zipOutputs(done, format, direction);
const ts = new Date().toISOString().slice(0, 10);
const filename = `jsonprism-batch-${ts}.zip`;
if (isTauri()) {
const saved = await nativeSaveBlob(blob, filename);
if (saved) {
toast.success(t('batch.toast.zipped', { count: fileCount }));
}
} else {
downloadBlob(blob, filename);
toast.success(t('batch.toast.zipped', { count: fileCount }));
}
} catch (err) {
toast.error(t('batch.toast.zip_failed', { message: (err as Error).message }));
}
}, [direction, format, items, itemOrder, t]);
const handleOpenFiles = async () => {
if (isTauri()) {
const paths = await nativeOpenFiles({ multiple: true });
@@ -296,13 +203,11 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
{/* Summary chips */}
{totalCount > 0 && (
<div className="text-muted-foreground flex flex-wrap items-center gap-2 px-6 pb-3 font-mono text-[11px]">
<Chip label={t('batch.stat.queued')} value={queuedCount} />
<Chip label={t('batch.stat.done')} value={doneCount} tone="ok" />
{errorCount > 0 && (
<Chip label={t('batch.stat.failed')} value={errorCount} tone="err" />
)}
</div>
<BatchSummaryChips
queuedCount={queuedCount}
doneCount={doneCount}
errorCount={errorCount}
/>
)}
{/* Queue list */}
@@ -346,7 +251,7 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
{processing ? (
<button
type="button"
onClick={handleCancel}
onClick={cancel}
className="bg-destructive/10 text-destructive hover:bg-destructive/20 inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition"
>
<StopCircle className="h-3.5 w-3.5" />
@@ -357,7 +262,7 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
type="button"
onClick={() => {
resetStatuses();
void handleStart();
void start();
}}
disabled={totalCount === 0}
className="bg-primary/15 text-primary hover:bg-primary/25 inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition disabled:cursor-not-allowed disabled:opacity-40"
@@ -369,7 +274,7 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
<button
type="button"
onClick={() => void handleDownloadZip()}
onClick={() => void downloadZip()}
disabled={doneCount === 0 || processing}
className="bg-foreground/90 text-background hover:bg-foreground inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition disabled:cursor-not-allowed disabled:opacity-40"
>
@@ -382,134 +287,3 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
</Sheet>
);
}
function Chip({ label, value, tone }: { label: string; value: number; tone?: 'ok' | 'err' }) {
return (
<span
className={cn(
'inline-flex items-center gap-1 rounded px-1.5 py-0.5',
tone === 'ok' && 'bg-primary/10 text-primary',
tone === 'err' && 'bg-destructive/10 text-destructive',
!tone && 'bg-muted/40',
)}
>
<span className="opacity-70">{label}:</span>
<span>{value}</span>
</span>
);
}
interface BatchItemRowProps {
item: BatchItem;
outputExt: string;
onRemove: () => void;
disabled: boolean;
}
function BatchItemRow({ item, outputExt, onRemove, disabled }: BatchItemRowProps) {
const { t } = useTranslation();
const Icon = statusIcon(item.status);
const tone = statusTone(item.status);
return (
<li className="flex items-start gap-2 py-2.5">
<Icon className={cn('mt-0.5 h-4 w-4 shrink-0', tone)} />
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
<span className="text-foreground truncate font-mono text-xs">{item.filename}</span>
<span className="text-muted-foreground/60 font-mono text-[10px]">→ .{outputExt}</span>
</div>
<div className="text-muted-foreground mt-0.5 flex items-center gap-2 font-mono text-[10px]">
<span>{formatBytes(item.size)}</span>
{item.outputSize !== undefined && (
<>
<span>·</span>
<span>
{t('batch.row.out')}: {formatBytes(item.outputSize)}
</span>
</>
)}
</div>
{item.error && (
<p className="text-destructive mt-1 font-mono text-[10px] break-words">{item.error}</p>
)}
</div>
<button
type="button"
onClick={onRemove}
disabled={disabled}
aria-label={t('batch.row.remove')}
className="text-muted-foreground hover:bg-muted hover:text-foreground rounded p-1 transition disabled:cursor-not-allowed disabled:opacity-40"
>
<Trash2 className="h-3 w-3" />
</button>
</li>
);
}
function statusIcon(status: BatchItem['status']) {
switch (status) {
case 'queued':
return CircleIcon;
case 'processing':
return ProcessingIcon;
case 'done':
return CheckIcon;
case 'error':
return ErrorIcon;
}
}
function statusTone(status: BatchItem['status']): string {
switch (status) {
case 'done':
return 'text-primary';
case 'error':
return 'text-destructive';
case 'processing':
return 'text-foreground';
case 'queued':
default:
return 'text-muted-foreground/60';
}
}
function CircleIcon({ className }: { className?: string }) {
return (
<svg viewBox="0 0 16 16" fill="none" className={className} aria-hidden>
<circle cx="8" cy="8" r="6" stroke="currentColor" strokeWidth="1.5" />
</svg>
);
}
function ProcessingIcon({ className }: { className?: string }) {
return <Loader2 className={cn(className, 'animate-spin')} />;
}
function CheckIcon({ className }: { className?: string }) {
return (
<svg viewBox="0 0 16 16" fill="none" className={className} aria-hidden>
<path
d="M3 8.5L6.5 12L13 5"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
}
function ErrorIcon({ className }: { className?: string }) {
return (
<svg viewBox="0 0 16 16" fill="none" className={className} aria-hidden>
<path d="M4 4L12 12M12 4L4 12" stroke="currentColor" strokeWidth="2" strokeLinecap="round" />
</svg>
);
}
function formatBytes(bytes: number): string {
if (bytes < 1024) return `${bytes} B`;
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
return `${(bytes / 1024 / 1024).toFixed(2)} MB`;
}
@@ -0,0 +1,35 @@
import { useTranslation } from 'react-i18next';
import { cn } from '@/lib/utils';
interface BatchSummaryChipsProps {
queuedCount: number;
doneCount: number;
errorCount: number;
}
export function BatchSummaryChips({ queuedCount, doneCount, errorCount }: BatchSummaryChipsProps) {
const { t } = useTranslation();
return (
<div className="text-muted-foreground flex flex-wrap items-center gap-2 px-6 pb-3 font-mono text-[11px]">
<Chip label={t('batch.stat.queued')} value={queuedCount} />
<Chip label={t('batch.stat.done')} value={doneCount} tone="ok" />
{errorCount > 0 && <Chip label={t('batch.stat.failed')} value={errorCount} tone="err" />}
</div>
);
}
function Chip({ label, value, tone }: { label: string; value: number; tone?: 'ok' | 'err' }) {
return (
<span
className={cn(
'inline-flex items-center gap-1 rounded px-1.5 py-0.5',
tone === 'ok' && 'bg-primary/10 text-primary',
tone === 'err' && 'bg-destructive/10 text-destructive',
!tone && 'bg-muted/40',
)}
>
<span className="opacity-70">{label}:</span>
<span>{value}</span>
</span>
);
}
+14 -122
View File
@@ -1,14 +1,13 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useCallback, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { toast } from '@/components/ui/sonner';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { useBatchFileRouter } from '@/hooks/useBatchFileRouter';
import { useConversionResult } from '@/hooks/useConversionResult';
import { useKeyboardShortcuts } from '@/hooks/useKeyboardShortcuts';
import { useOutputBadge } from '@/hooks/useOutputBadge';
import { getConverter } from '@/converters/registry';
import type { FormatId } from '@/converters/types';
import { parseJsonInput } from '@/lib/detect';
import { filterByExtension, getAllowedExtensions } from '@/lib/file-filter';
import { useKeyboardShortcuts } from '@/hooks/useKeyboardShortcuts';
import { useTauriDragDrop } from '@/hooks/useTauriDragDrop';
import { useBatchStore } from '@/stores/batchStore';
import { useWorkspaceStore } from '@/stores/workspaceStore';
import { DirectionToggle, type Direction } from './DirectionToggle';
import { FormatPicker } from './FormatPicker';
@@ -39,40 +38,9 @@ export function ConverterWorkspace() {
const [settingsOpen, setSettingsOpen] = useState(false);
// Mobile tab state — desktop ignores this and renders both panels side-by-side.
const [activeTab, setActiveTab] = useState<'input' | 'output'>('input');
// Badge dot on Output tab when output changes while user is on Input tab.
const [hasUnreadOutput, setHasUnreadOutput] = useState(false);
const prevOutputRef = useRef('');
const addBatchFiles = useBatchStore((s) => s.addFiles);
const handleMultiFileDrop = useCallback(
(files: File[]) => {
const allowed = getAllowedExtensions(
direction === 'reverse' ? 'reverse' : 'forward',
getConverter(format).meta.extension,
);
const { valid, wrongFormat } = filterByExtension(files, allowed);
if (wrongFormat > 0) {
toast.warning(t('batch.toast.wrong_format', { count: wrongFormat }));
}
if (valid.length === 0) return;
const result = addBatchFiles(valid);
if (result.added > 0) {
toast.success(t('batch.toast.added', { count: result.added }));
setBatchOpen(true);
}
if (result.skipped > 0) {
if (result.reason === 'duplicate') {
toast.warning(t('batch.toast.duplicate', { count: result.skipped }));
} else {
toast.warning(t('batch.toast.skipped', { count: result.skipped, max: 500 }));
}
}
},
[addBatchFiles, direction, format, t],
);
// Native OS drag-drop bridge (no-op outside Tauri).
useTauriDragDrop(handleMultiFileDrop);
const openBatch = useCallback(() => setBatchOpen(true), []);
const handleMultiFileDrop = useBatchFileRouter(format, direction, openBatch);
const switchFormat = useCallback(
(next: FormatId) => {
@@ -109,75 +77,12 @@ export function ConverterWorkspace() {
toast.success(t('toast.options_reset'));
}, [format, resetOptionsForFormat, t]);
const { output, inputError, outputError, shape, parseMs } = useMemo(() => {
const start = performance.now();
if (!input.trim()) {
return { output: '', inputError: null, outputError: null, shape: null, parseMs: null };
}
const converter = getConverter(format);
if (!converter.meta.ready) {
return {
output: '',
inputError: null,
outputError: t('errors.converter_not_ready_phase', { phase: converter.meta.phase }),
shape: null,
parseMs: performance.now() - start,
};
}
if (direction === 'reverse') {
if (typeof converter.reverse !== 'function') {
return {
output: '',
inputError: null,
outputError: t('format_status.no_reverse'),
shape: null,
parseMs: performance.now() - start,
};
}
const result = converter.reverse(
{ text: input },
currentOptions as Parameters<typeof converter.reverse>[1],
);
const ms = performance.now() - start;
return result.ok
? { output: result.output, inputError: null, outputError: null, shape: null, parseMs: ms }
: { output: '', inputError: result.error, outputError: null, shape: null, parseMs: ms };
}
const parsed = parseJsonInput(input);
if (!parsed.ok) {
const msg = parsed.error === 'empty' ? null : parsed.error;
return {
output: '',
inputError: msg,
outputError: null,
shape: null,
parseMs: performance.now() - start,
};
}
const result = converter.convert(
{ data: parsed.value, rawText: input },
currentOptions as Parameters<typeof converter.convert>[1],
);
const ms = performance.now() - start;
if (result.ok) {
return {
output: result.output,
inputError: null,
outputError: null,
shape: parsed.shape,
parseMs: ms,
};
}
return {
output: '',
inputError: null,
outputError: result.error,
shape: parsed.shape,
parseMs: ms,
};
}, [input, format, currentOptions, direction, t]);
const { output, inputError, outputError, shape, parseMs } = useConversionResult(
input,
format,
direction,
currentOptions,
);
useKeyboardShortcuts([
{ key: 'k', mod: true, handler: () => setInput('') },
@@ -185,20 +90,7 @@ export function ConverterWorkspace() {
{ key: ',', mod: true, handler: () => setSettingsOpen((v) => !v) },
]);
// Flip the badge dot on the Output tab whenever output changes while the
// user is on the Input tab. Clearing happens once the user navigates over.
useEffect(() => {
if (output !== prevOutputRef.current) {
prevOutputRef.current = output;
if (output && activeTab !== 'output') {
setHasUnreadOutput(true);
}
}
}, [output, activeTab]);
useEffect(() => {
if (activeTab === 'output') setHasUnreadOutput(false);
}, [activeTab]);
const hasUnreadOutput = useOutputBadge(output, activeTab);
const inputBytes = useMemo(() => new TextEncoder().encode(input).length, [input]);
const outputBytes = useMemo(() => new TextEncoder().encode(output).length, [output]);
+14 -76
View File
@@ -1,14 +1,17 @@
import { useCallback, useMemo, useRef, useState } from 'react';
import { useCallback, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDropzone } from 'react-dropzone';
import { Eraser, FileText, FolderOpen } from 'lucide-react';
import { ToolbarButton } from '@/components/common/ToolbarButton';
import { toast } from '@/components/ui/sonner';
import { extOf, getAllowedExtensions } from '@/lib/file-filter';
import { useFileAccept } from '@/hooks/useFileAccept';
import { editorLanguageFor } from '@/lib/editor-language';
import { extOf } from '@/lib/file-filter';
import { readFileText } from '@/lib/read-file';
import { SAMPLE_JSON } from '@/lib/sample';
import { isTauri, nativeOpenFiles, fileFromNativePath } from '@/lib/tauri';
import { getConverter } from '@/converters/registry';
import type { FormatId } from '@/converters/types';
import { CodeEditor, type EditorLanguage } from './CodeEditor';
import { CodeEditor } from './CodeEditor';
import type { Direction } from './DirectionToggle';
interface InputPanelProps {
@@ -35,49 +38,16 @@ export function InputPanel({
const fileInputRef = useRef<HTMLInputElement>(null);
const [dragActive, setDragActive] = useState(false);
const isReverse = direction === 'reverse';
const converter = getConverter(format);
// In reverse mode the dropzone + file picker accept the format's native
// extension; in forward mode JSON is the only useful input.
const accept = useMemo(() => {
if (isReverse) {
const ext = converter.meta.extension;
return {
[converter.meta.mimeType]: [`.${ext}`],
'text/plain': ['.txt'],
};
}
return { 'application/json': ['.json'], 'text/plain': ['.txt'] };
}, [isReverse, converter.meta.mimeType, converter.meta.extension]);
const fileInputAccept = isReverse
? `.${converter.meta.extension},.txt,${converter.meta.mimeType}`
: '.json,.txt,application/json';
const { converter, isReverse, accept, fileInputAccept, allowedExtensions } = useFileAccept(
format,
direction,
);
const inputLabel = isReverse
? t('home.input_label_format', { format: t(converter.meta.labelKey) })
: t('home.input_label');
// CodeMirror language pack to use for the input. In forward mode the input
// is always JSON. In reverse, pick the closest available pack — formats
// without an official CodeMirror grammar fall back to plain text.
const editorLanguage: EditorLanguage = useMemo(() => {
if (!isReverse) return 'json';
if (format === 'yaml') return 'yaml';
if (format === 'xml' || format === 'resx') return 'xml';
if (format === 'jsonl') return 'json';
if (format === 'markdown') return 'markdown';
if (format === 'sql') return 'sql';
if (format === 'toml') return 'toml';
return 'plain';
}, [isReverse, format]);
// Allowed extensions for the single-file "Open" / drag-drop path.
// `<input accept>` is only a hint to the OS picker — re-validate in JS.
const allowedExtensions = useMemo(
() => getAllowedExtensions(isReverse ? 'reverse' : 'forward', converter.meta.extension),
[isReverse, converter.meta.extension],
);
const editorLanguage = editorLanguageFor(format, direction);
const hasAllowedExt = useCallback(
(name: string) => allowedExtensions.includes(extOf(name)),
@@ -97,7 +67,7 @@ export function InputPanel({
toast.warning(t('batch.toast.wrong_format', { count: 1 }));
return;
}
void readFile(file).then(
void readFileText(file).then(
(text) => {
onChange(text);
toast.success(t('toast.file_loaded', { name: file.name }));
@@ -159,7 +129,7 @@ export function InputPanel({
e.target.value = '';
return;
}
void readFile(file).then(
void readFileText(file).then(
(text) => {
onChange(text);
toast.success(t('toast.file_loaded', { name: file.name }));
@@ -244,35 +214,3 @@ export function InputPanel({
</div>
);
}
async function readFile(file: File): Promise<string> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => resolve(String(reader.result ?? ''));
reader.onerror = () => reject(new Error(`Cannot read file: ${file.name}`));
reader.readAsText(file);
});
}
interface ToolbarButtonProps {
onClick: () => void;
label: string;
icon: React.ReactNode;
disabled?: boolean;
}
function ToolbarButton({ onClick, label, icon, disabled }: ToolbarButtonProps) {
return (
<button
type="button"
onClick={onClick}
disabled={disabled}
aria-label={label}
title={label}
className="text-muted-foreground hover:bg-muted hover:text-foreground inline-flex items-center gap-1.5 rounded px-2 py-1 text-xs transition disabled:cursor-not-allowed disabled:opacity-40"
>
{icon}
<span className="hidden sm:inline">{label}</span>
</button>
);
}
+1 -23
View File
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Check, Copy, Download } from 'lucide-react';
import { toast } from '@/components/ui/sonner';
import { ToolbarButton } from '@/components/common/ToolbarButton';
import type { FormatId } from '@/converters/types';
import { getConverter } from '@/converters/registry';
import { decodeBytes } from '@/converters/bson';
@@ -120,26 +121,3 @@ export function OutputPanel({
</div>
);
}
interface ToolbarButtonProps {
onClick: () => void;
label: string;
icon: React.ReactNode;
disabled?: boolean;
}
function ToolbarButton({ onClick, label, icon, disabled }: ToolbarButtonProps) {
return (
<button
type="button"
onClick={onClick}
disabled={disabled}
aria-label={label}
title={label}
className="text-muted-foreground hover:bg-muted hover:text-foreground inline-flex items-center gap-1.5 rounded px-2 py-1 text-xs transition disabled:cursor-not-allowed disabled:opacity-40"
>
{icon}
<span className="hidden sm:inline">{label}</span>
</button>
);
}
+95
View File
@@ -0,0 +1,95 @@
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { toast } from '@/components/ui/sonner';
import type { Direction } from '@/components/converter/DirectionToggle';
import type { FormatId } from '@/converters/types';
import { downloadBlob, processBatch, zipOutputs } from '@/lib/batch-processor';
import { isTauri, nativeSaveBlob } from '@/lib/tauri';
import { useBatchStore, type BatchItem } from '@/stores/batchStore';
export function useBatchActions(
format: FormatId,
direction: Direction,
options: Record<string, unknown>,
) {
const { t } = useTranslation();
const items = useBatchStore((s) => s.items);
const itemOrder = useBatchStore((s) => s.itemOrder);
const setProcessing = useBatchStore((s) => s.setProcessing);
const setAbortController = useBatchStore((s) => s.setAbortController);
const updateItem = useBatchStore((s) => s.updateItem);
const start = useCallback(async () => {
const queued = itemOrder
.map((id) => items[id])
.filter((it): it is BatchItem => !!it && it.status !== 'done' && it.status !== 'processing');
if (queued.length === 0) {
toast.info(t('batch.toast.nothing_to_process'));
return;
}
const controller = new AbortController();
setAbortController(controller);
setProcessing(true);
toast.success(t('batch.toast.started', { count: queued.length }));
try {
await processBatch(
queued,
format,
options,
{
onUpdate: (id, patch) => updateItem(id, patch),
},
controller.signal,
direction,
);
if (!controller.signal.aborted) {
toast.success(t('batch.toast.finished'));
}
} catch (err) {
toast.error(t('batch.toast.failed', { message: (err as Error).message }));
} finally {
setProcessing(false);
setAbortController(null);
}
}, [
direction,
format,
items,
itemOrder,
options,
setAbortController,
setProcessing,
t,
updateItem,
]);
const cancel = useCallback(() => {
useBatchStore.getState().abortController?.abort();
toast.info(t('batch.toast.cancelled'));
}, [t]);
const downloadZip = useCallback(async () => {
const done = itemOrder.map((id) => items[id]).filter((it): it is BatchItem => !!it);
try {
const { blob, fileCount } = await zipOutputs(done, format, direction);
const ts = new Date().toISOString().slice(0, 10);
const filename = `jsonprism-batch-${ts}.zip`;
if (isTauri()) {
const saved = await nativeSaveBlob(blob, filename);
if (saved) {
toast.success(t('batch.toast.zipped', { count: fileCount }));
}
} else {
downloadBlob(blob, filename);
toast.success(t('batch.toast.zipped', { count: fileCount }));
}
} catch (err) {
toast.error(t('batch.toast.zip_failed', { message: (err as Error).message }));
}
}, [direction, format, items, itemOrder, t]);
return { start, cancel, downloadZip };
}
+52
View File
@@ -0,0 +1,52 @@
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { toast } from '@/components/ui/sonner';
import type { Direction } from '@/components/converter/DirectionToggle';
import { getConverter } from '@/converters/registry';
import type { FormatId } from '@/converters/types';
import { filterByExtension, getAllowedExtensions } from '@/lib/file-filter';
import { useTauriDragDrop } from '@/hooks/useTauriDragDrop';
import { useBatchStore } from '@/stores/batchStore';
// Routes a multi-file drop into the batch queue (with format filtering and
// toasts) and wires the native Tauri drag-drop bridge to the same handler.
export function useBatchFileRouter(
format: FormatId,
direction: Direction,
onFilesAdded?: () => void,
): (files: File[]) => void {
const { t } = useTranslation();
const addBatchFiles = useBatchStore((s) => s.addFiles);
const handleMultiFileDrop = useCallback(
(files: File[]) => {
const allowed = getAllowedExtensions(
direction === 'reverse' ? 'reverse' : 'forward',
getConverter(format).meta.extension,
);
const { valid, wrongFormat } = filterByExtension(files, allowed);
if (wrongFormat > 0) {
toast.warning(t('batch.toast.wrong_format', { count: wrongFormat }));
}
if (valid.length === 0) return;
const result = addBatchFiles(valid);
if (result.added > 0) {
toast.success(t('batch.toast.added', { count: result.added }));
onFilesAdded?.();
}
if (result.skipped > 0) {
if (result.reason === 'duplicate') {
toast.warning(t('batch.toast.duplicate', { count: result.skipped }));
} else {
toast.warning(t('batch.toast.skipped', { count: result.skipped, max: 500 }));
}
}
},
[addBatchFiles, direction, format, t, onFilesAdded],
);
// Native OS drag-drop bridge (no-op outside Tauri).
useTauriDragDrop(handleMultiFileDrop);
return handleMultiFileDrop;
}
+85
View File
@@ -0,0 +1,85 @@
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import type { Direction } from '@/components/converter/DirectionToggle';
import { getConverter } from '@/converters/registry';
import type { FormatId } from '@/converters/types';
import { parseJsonInput } from '@/lib/detect';
export function useConversionResult(
input: string,
format: FormatId,
direction: Direction,
options: Record<string, unknown>,
) {
const { t } = useTranslation();
return useMemo(() => {
const start = performance.now();
if (!input.trim()) {
return { output: '', inputError: null, outputError: null, shape: null, parseMs: null };
}
const converter = getConverter(format);
if (!converter.meta.ready) {
return {
output: '',
inputError: null,
outputError: t('errors.converter_not_ready_phase', { phase: converter.meta.phase }),
shape: null,
parseMs: performance.now() - start,
};
}
if (direction === 'reverse') {
if (typeof converter.reverse !== 'function') {
return {
output: '',
inputError: null,
outputError: t('format_status.no_reverse'),
shape: null,
parseMs: performance.now() - start,
};
}
const result = converter.reverse(
{ text: input },
options as Parameters<typeof converter.reverse>[1],
);
const ms = performance.now() - start;
return result.ok
? { output: result.output, inputError: null, outputError: null, shape: null, parseMs: ms }
: { output: '', inputError: result.error, outputError: null, shape: null, parseMs: ms };
}
const parsed = parseJsonInput(input);
if (!parsed.ok) {
const msg = parsed.error === 'empty' ? null : parsed.error;
return {
output: '',
inputError: msg,
outputError: null,
shape: null,
parseMs: performance.now() - start,
};
}
const result = converter.convert(
{ data: parsed.value, rawText: input },
options as Parameters<typeof converter.convert>[1],
);
const ms = performance.now() - start;
if (result.ok) {
return {
output: result.output,
inputError: null,
outputError: null,
shape: parsed.shape,
parseMs: ms,
};
}
return {
output: '',
inputError: null,
outputError: result.error,
shape: parsed.shape,
parseMs: ms,
};
}, [input, format, options, direction, t]);
}
+42
View File
@@ -0,0 +1,42 @@
import { useMemo } from 'react';
import type { Direction } from '@/components/converter/DirectionToggle';
import { getConverter } from '@/converters/registry';
import type { FormatId } from '@/converters/types';
import { getAllowedExtensions } from '@/lib/file-filter';
export interface FileAccept {
converter: ReturnType<typeof getConverter>;
isReverse: boolean;
/** react-dropzone `accept` map: MIME type → extensions. */
accept: Record<string, string[]>;
/** Native `<input accept>` hint string. */
fileInputAccept: string;
/** Whitelist for JS-side re-validation — `<input accept>` is only a hint. */
allowedExtensions: string[];
}
export function useFileAccept(format: FormatId, direction: Direction): FileAccept {
const isReverse = direction === 'reverse';
const converter = getConverter(format);
const accept = useMemo<Record<string, string[]>>(() => {
if (isReverse) {
return {
[converter.meta.mimeType]: [`.${converter.meta.extension}`],
'text/plain': ['.txt'],
};
}
return { 'application/json': ['.json'], 'text/plain': ['.txt'] };
}, [isReverse, converter.meta.mimeType, converter.meta.extension]);
const fileInputAccept = isReverse
? `.${converter.meta.extension},.txt,${converter.meta.mimeType}`
: '.json,.txt,application/json';
const allowedExtensions = useMemo(
() => getAllowedExtensions(isReverse ? 'reverse' : 'forward', converter.meta.extension),
[isReverse, converter.meta.extension],
);
return { converter, isReverse, accept, fileInputAccept, allowedExtensions };
}
-58
View File
@@ -1,58 +0,0 @@
import { useCallback, useEffect, useState } from 'react';
/**
* React hook for persistent state in localStorage.
* Survives reload; synced across tabs via `storage` event.
*/
export function useLocalStorage<T>(
key: string,
initialValue: T,
): [T, (value: T | ((prev: T) => T)) => void] {
const read = useCallback((): T => {
if (typeof window === 'undefined') return initialValue;
try {
const raw = window.localStorage.getItem(key);
if (raw === null) return initialValue;
return JSON.parse(raw) as T;
} catch {
return initialValue;
}
}, [key, initialValue]);
const [stored, setStored] = useState<T>(read);
const setValue = useCallback(
(value: T | ((prev: T) => T)) => {
setStored((prev) => {
const next = typeof value === 'function' ? (value as (p: T) => T)(prev) : value;
try {
window.localStorage.setItem(key, JSON.stringify(next));
} catch {
/* quota errors are non-fatal */
}
return next;
});
},
[key],
);
// Cross-tab sync
useEffect(() => {
const handler = (e: StorageEvent) => {
if (e.key !== key) return;
if (e.newValue === null) {
setStored(initialValue);
return;
}
try {
setStored(JSON.parse(e.newValue) as T);
} catch {
/* ignore malformed */
}
};
window.addEventListener('storage', handler);
return () => window.removeEventListener('storage', handler);
}, [key, initialValue]);
return [stored, setValue];
}
+23
View File
@@ -0,0 +1,23 @@
import { useEffect, useRef, useState } from 'react';
// Tracks an "unread output" badge for the mobile Output tab: set when output
// changes while the user is on a different tab, cleared once they navigate over.
export function useOutputBadge(output: string, activeTab: 'input' | 'output'): boolean {
const [hasUnreadOutput, setHasUnreadOutput] = useState(false);
const prevOutputRef = useRef('');
useEffect(() => {
if (output !== prevOutputRef.current) {
prevOutputRef.current = output;
if (output && activeTab !== 'output') {
setHasUnreadOutput(true);
}
}
}, [output, activeTab]);
useEffect(() => {
if (activeTab === 'output') setHasUnreadOutput(false);
}, [activeTab]);
return hasUnreadOutput;
}
-2
View File
@@ -26,5 +26,3 @@ void i18n
lookupLocalStorage: 'jsonprism.lang',
},
});
export default i18n;
+2 -1
View File
@@ -291,7 +291,8 @@
"common": {
"loading": "Loading…",
"error": "Error",
"retry": "Retry"
"retry": "Retry",
"scroll_to_top": "Back to top"
},
"disclaimer": {
"translation": "Non-English translations are AI-generated. Accuracy is not guaranteed."
+2 -1
View File
@@ -291,7 +291,8 @@
"common": {
"loading": "読み込み中…",
"error": "エラー",
"retry": "再試行"
"retry": "再試行",
"scroll_to_top": "トップへ戻る"
},
"disclaimer": {
"translation": "このページの翻訳は AI 生成です。100% の正確性は保証されません。"
+2 -1
View File
@@ -291,7 +291,8 @@
"common": {
"loading": "Đang tải…",
"error": "Lỗi",
"retry": "Thử lại"
"retry": "Thử lại",
"scroll_to_top": "Về đầu trang"
},
"disclaimer": {
"translation": "Các bản dịch không phải tiếng Anh do AI tạo, không đảm bảo chính xác 100%."
+2 -1
View File
@@ -291,7 +291,8 @@
"common": {
"loading": "加载中…",
"error": "错误",
"retry": "重试"
"retry": "重试",
"scroll_to_top": "回到顶部"
},
"disclaimer": {
"translation": "本页面译文由 AI 生成,不保证 100% 准确。"
+17
View File
@@ -0,0 +1,17 @@
import type { EditorLanguage } from '@/components/converter/CodeEditor';
import type { Direction } from '@/components/converter/DirectionToggle';
import type { FormatId } from '@/converters/types';
// CodeMirror language pack for the input editor. Forward mode is always JSON.
// In reverse mode, pick the closest available pack — formats without an
// official CodeMirror grammar fall back to plain text.
export function editorLanguageFor(format: FormatId, direction: Direction): EditorLanguage {
if (direction !== 'reverse') return 'json';
if (format === 'yaml') return 'yaml';
if (format === 'xml' || format === 'resx') return 'xml';
if (format === 'jsonl') return 'json';
if (format === 'markdown') return 'markdown';
if (format === 'sql') return 'sql';
if (format === 'toml') return 'toml';
return 'plain';
}
+5
View File
@@ -0,0 +1,5 @@
export function formatBytes(bytes: number): string {
if (bytes < 1024) return `${bytes} B`;
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
return `${(bytes / 1024 / 1024).toFixed(2)} MB`;
}
+8
View File
@@ -0,0 +1,8 @@
export function readFileText(file: File): Promise<string> {
return new Promise<string>((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => resolve(String(reader.result ?? ''));
reader.onerror = () => reject(new Error(`Cannot read file: ${file.name}`));
reader.readAsText(file);
});
}
+2 -1
View File
@@ -62,7 +62,7 @@ export async function nativeSaveBlob(blob: Blob, suggestedName: string): Promise
/**
* Read a file at the given native path as a UTF-8 string.
*/
export async function nativeReadText(path: string): Promise<string> {
async function nativeReadText(path: string): Promise<string> {
if (!isTauri()) {
throw new Error('nativeReadText is only available inside Tauri.');
}
@@ -131,6 +131,7 @@ export async function fileFromNativePath(path: string): Promise<File> {
/**
* Diagnostic info from the Rust side (OS, arch, app version).
* Not currently shown in the UI but useful for bug reports.
* @public
*/
export async function tauriHostInfo(): Promise<{
os: string;
+155 -148
View File
@@ -1,5 +1,7 @@
import { useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { ExternalLink, Heart, Users } from 'lucide-react';
import { ScrollToTop } from '@/components/common/ScrollToTop';
import {
BlueskyIcon,
DiscordIcon,
@@ -135,170 +137,175 @@ const DEPS: DepCategory[] = [
export function About() {
const { t } = useTranslation();
const scrollRef = useRef<HTMLDivElement>(null);
return (
// Layout's <main> is `flex flex-1 min-h-0 flex-col` (height-bounded). The
// About page has many sections, so it needs its own scroll container —
// otherwise content overflows past the Footer at the bottom.
<div className="scrollbar-hide min-h-0 flex-1 overflow-y-auto">
<div className="mx-auto max-w-3xl px-4 py-10 sm:px-6 sm:py-16">
<h1 className="font-display text-spectrum mb-4 text-5xl tracking-tight italic">
{t('about.title')}
</h1>
<p className="font-display text-foreground/90 mb-8 text-2xl italic">{t('about.lead')}</p>
<div className="text-muted-foreground space-y-4 text-sm leading-relaxed">
<p>{t('about.p1')}</p>
<p>{t('about.p2')}</p>
</div>
{/* Donate */}
<section className="mt-14">
<h2 className="font-display mb-1 text-2xl tracking-tight">
<Heart className="mr-2 inline-block h-5 w-5 text-rose-400" />
{t('about.donate.title')}
</h2>
<p className="text-muted-foreground mb-4 text-sm">{t('about.donate.lead')}</p>
<ul className="grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3">
{DONATE.map((platform) => (
<li key={platform.key}>
<a
href={platform.url}
target="_blank"
rel="noreferrer"
className={cn(
'border-border/60 bg-card/40 hover:border-primary/40 hover:bg-card/80 inline-flex w-full items-center justify-between rounded-md border px-3 py-2 text-sm transition',
)}
>
<span className="text-foreground font-medium">
{t(`about.donate.${platform.key}`)}
</span>
<ExternalLink className="text-muted-foreground h-3.5 w-3.5" />
</a>
</li>
))}
</ul>
</section>
{/* Community */}
<section className="mt-14">
<h2 className="font-display mb-1 text-2xl tracking-tight">
<Users className="text-primary mr-2 inline-block h-5 w-5" />
{t('about.community.title')}
</h2>
<p className="text-muted-foreground mb-4 text-sm">{t('about.community.lead')}</p>
<ul className="grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3">
{COMMUNITY.map((platform) => (
<li key={platform.key}>
<a
href={platform.url}
target="_blank"
rel="noreferrer"
className={cn(
'border-border/60 bg-card/40 hover:border-primary/40 hover:bg-card/80 inline-flex w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm transition',
)}
>
<span className="text-muted-foreground inline-flex items-center gap-2">
{platform.icon}
<span className="text-foreground font-medium">
{t(`about.community.${platform.key}`)}
</span>
</span>
<ExternalLink className="text-muted-foreground h-3.5 w-3.5" />
</a>
</li>
))}
</ul>
</section>
{/* Third-party */}
<section className="mt-14">
<h2 className="font-display mb-1 text-2xl tracking-tight">
{t('about.third_party.title')}
</h2>
<p className="text-muted-foreground mb-4 text-sm">{t('about.third_party.lead')}</p>
<div className="space-y-4">
{DEPS.map((cat) => (
<div key={cat.key}>
<h3 className="text-foreground/80 mb-1 text-xs font-medium tracking-wider uppercase">
{t(`about.third_party.${cat.key}`)}
</h3>
<ul className="flex flex-wrap gap-1.5">
{cat.deps.map((dep) => (
<li key={dep.name}>
<a
href={dep.url}
target="_blank"
rel="noreferrer"
className="border-border/60 bg-card/40 hover:border-primary/40 hover:text-foreground text-muted-foreground inline-flex items-center gap-1 rounded border px-2 py-0.5 font-mono text-xs transition"
>
{dep.name}
</a>
</li>
))}
</ul>
</div>
))}
// otherwise content overflows past the Footer. The relative wrapper anchors
// the floating scroll-to-top button above the Footer.
<div className="relative flex min-h-0 flex-1 flex-col">
<div ref={scrollRef} className="scrollbar-hide min-h-0 flex-1 overflow-y-auto">
<div className="mx-auto max-w-3xl px-4 py-10 sm:px-6 sm:py-16">
<h1 className="font-display text-spectrum mb-4 text-5xl tracking-tight italic">
{t('about.title')}
</h1>
<p className="font-display text-foreground/90 mb-8 text-2xl italic">{t('about.lead')}</p>
<div className="text-muted-foreground space-y-4 text-sm leading-relaxed">
<p>{t('about.p1')}</p>
<p>{t('about.p2')}</p>
</div>
<p className="mt-4 text-sm">
<a
href={`${REPO_URL}/blob/main/THIRD-PARTY.md`}
target="_blank"
rel="noreferrer"
className="text-primary hover:underline"
>
{t('about.third_party.see_full_list')}
</a>
</p>
</section>
{/* Build info */}
<section className="mt-14">
<h2 className="font-display mb-3 text-2xl tracking-tight">{t('about.build.title')}</h2>
<dl className="border-border/60 grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1 border-t pt-4 font-mono text-sm">
<dt className="text-muted-foreground">{t('about.build.version')}</dt>
<dd className="text-foreground">{__APP_VERSION__}</dd>
<dt className="text-muted-foreground">{t('about.build.commit')}</dt>
<dd className="text-foreground">
{/* Donate */}
<section className="mt-14">
<h2 className="font-display mb-1 text-2xl tracking-tight">
<Heart className="mr-2 inline-block h-5 w-5 text-rose-400" />
{t('about.donate.title')}
</h2>
<p className="text-muted-foreground mb-4 text-sm">{t('about.donate.lead')}</p>
<ul className="grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3">
{DONATE.map((platform) => (
<li key={platform.key}>
<a
href={platform.url}
target="_blank"
rel="noreferrer"
className={cn(
'border-border/60 bg-card/40 hover:border-primary/40 hover:bg-card/80 inline-flex w-full items-center justify-between rounded-md border px-3 py-2 text-sm transition',
)}
>
<span className="text-foreground font-medium">
{t(`about.donate.${platform.key}`)}
</span>
<ExternalLink className="text-muted-foreground h-3.5 w-3.5" />
</a>
</li>
))}
</ul>
</section>
{/* Community */}
<section className="mt-14">
<h2 className="font-display mb-1 text-2xl tracking-tight">
<Users className="text-primary mr-2 inline-block h-5 w-5" />
{t('about.community.title')}
</h2>
<p className="text-muted-foreground mb-4 text-sm">{t('about.community.lead')}</p>
<ul className="grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3">
{COMMUNITY.map((platform) => (
<li key={platform.key}>
<a
href={platform.url}
target="_blank"
rel="noreferrer"
className={cn(
'border-border/60 bg-card/40 hover:border-primary/40 hover:bg-card/80 inline-flex w-full items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm transition',
)}
>
<span className="text-muted-foreground inline-flex items-center gap-2">
{platform.icon}
<span className="text-foreground font-medium">
{t(`about.community.${platform.key}`)}
</span>
</span>
<ExternalLink className="text-muted-foreground h-3.5 w-3.5" />
</a>
</li>
))}
</ul>
</section>
{/* Third-party */}
<section className="mt-14">
<h2 className="font-display mb-1 text-2xl tracking-tight">
{t('about.third_party.title')}
</h2>
<p className="text-muted-foreground mb-4 text-sm">{t('about.third_party.lead')}</p>
<div className="space-y-4">
{DEPS.map((cat) => (
<div key={cat.key}>
<h3 className="text-foreground/80 mb-1 text-xs font-medium tracking-wider uppercase">
{t(`about.third_party.${cat.key}`)}
</h3>
<ul className="flex flex-wrap gap-1.5">
{cat.deps.map((dep) => (
<li key={dep.name}>
<a
href={dep.url}
target="_blank"
rel="noreferrer"
className="border-border/60 bg-card/40 hover:border-primary/40 hover:text-foreground text-muted-foreground inline-flex items-center gap-1 rounded border px-2 py-0.5 font-mono text-xs transition"
>
{dep.name}
</a>
</li>
))}
</ul>
</div>
))}
</div>
<p className="mt-4 text-sm">
<a
href={`${REPO_URL}/commit/${__APP_COMMIT__}`}
href={`${REPO_URL}/blob/main/THIRD-PARTY.md`}
target="_blank"
rel="noreferrer"
className="hover:underline"
className="text-primary hover:underline"
>
{__APP_COMMIT__}
{t('about.third_party.see_full_list')}
</a>
</dd>
<dt className="text-muted-foreground">{t('about.build.date')}</dt>
<dd className="text-foreground">{__APP_BUILD_DATE__}</dd>
</dl>
</section>
</p>
</section>
{/* Links */}
<section className="mt-14">
<h2 className="font-display mb-3 text-2xl tracking-tight">{t('about.links.title')}</h2>
<ul className="grid grid-cols-1 gap-1 text-sm sm:grid-cols-2">
<LinkRow href={REPO_URL} label={t('about.links.repo')} />
<LinkRow href={`${REPO_URL}/issues`} label={t('about.links.issues')} />
<LinkRow href={`${REPO_URL}/discussions`} label={t('about.links.discussions')} />
<LinkRow href="https://poli0981.github.io/jsonPrism/" label={t('about.links.demo')} />
<LinkRow href={`${REPO_URL}/blob/main/LICENSE`} label={t('about.links.license')} />
</ul>
</section>
{/* Build info */}
<section className="mt-14">
<h2 className="font-display mb-3 text-2xl tracking-tight">{t('about.build.title')}</h2>
<dl className="border-border/60 grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1 border-t pt-4 font-mono text-sm">
<dt className="text-muted-foreground">{t('about.build.version')}</dt>
<dd className="text-foreground">{__APP_VERSION__}</dd>
<dt className="text-muted-foreground">{t('about.build.commit')}</dt>
<dd className="text-foreground">
<a
href={`${REPO_URL}/commit/${__APP_COMMIT__}`}
target="_blank"
rel="noreferrer"
className="hover:underline"
>
{__APP_COMMIT__}
</a>
</dd>
<dt className="text-muted-foreground">{t('about.build.date')}</dt>
<dd className="text-foreground">{__APP_BUILD_DATE__}</dd>
</dl>
</section>
{/* Disclaimer */}
<section className="mt-14">
<h2 className="font-display mb-2 text-xl tracking-tight">
{t('about.disclaimer.title')}
</h2>
<p className="text-muted-foreground text-sm leading-relaxed">
{t('about.disclaimer.body')}
</p>
</section>
{/* Links */}
<section className="mt-14">
<h2 className="font-display mb-3 text-2xl tracking-tight">{t('about.links.title')}</h2>
<ul className="grid grid-cols-1 gap-1 text-sm sm:grid-cols-2">
<LinkRow href={REPO_URL} label={t('about.links.repo')} />
<LinkRow href={`${REPO_URL}/issues`} label={t('about.links.issues')} />
<LinkRow href={`${REPO_URL}/discussions`} label={t('about.links.discussions')} />
<LinkRow href="https://poli0981.github.io/jsonPrism/" label={t('about.links.demo')} />
<LinkRow href={`${REPO_URL}/blob/main/LICENSE`} label={t('about.links.license')} />
</ul>
</section>
<div className="border-border/60 text-muted-foreground mt-12 border-t pt-6 font-mono text-xs">
{t('about.version', { version: __APP_VERSION__ })}
{/* Disclaimer */}
<section className="mt-14">
<h2 className="font-display mb-2 text-xl tracking-tight">
{t('about.disclaimer.title')}
</h2>
<p className="text-muted-foreground text-sm leading-relaxed">
{t('about.disclaimer.body')}
</p>
</section>
<div className="border-border/60 text-muted-foreground mt-12 border-t pt-6 font-mono text-xs">
{t('about.version', { version: __APP_VERSION__ })}
</div>
</div>
</div>
<ScrollToTop scrollRef={scrollRef} />
</div>
);
}