feat: reverse UX batch + docs suite + expanded About page (#15)
Đợt sửa lỗi 3 — PR-B (features).
Reverse UX:
- InputPanel accept list + file picker + editor label are now driven by
the active format when direction='reverse'. Label switches from
"Input JSON" to "Input <Format>". Loads-sample button hidden in
reverse (the sample is JSON).
- BatchPanel mirrors the dynamic accept + filename suffix. Per-row
shows `→ .json` in reverse mode.
- batch-processor gained a `direction` parameter. Reverse mode skips
parseJsonInput entirely and routes through converter.reverse(); zip
outputs use `.json` extension regardless of source format.
Docs suite (root):
- PRIVACY.md — offline-first, localStorage inventory.
- SECURITY.md — vulnerability reporting + supported versions.
- DISCLAIMER.md — 1-person + AI-assisted, translation disclaimer.
- MAINTAINERS.md — single-maintainer indie project notes.
- THIRD-PARTY.md — categorized canonical dep list with version/license/link.
- CODE_OF_CONDUCT.md — Contributor Covenant v2.1 by reference.
Docs suite (operational):
- docs/pc_spec.md + docs/dev_env.md — maintainer hardware + toolchain.
- docs/i18n/vi/{pc_spec,dev_env}.md — VI mirrors.
CONTRIBUTING + README updates:
- README + README.vi: new "Project docs" table, Acknowledgements,
Sponsorship sections.
- CONTRIBUTING: "Auto-ignored cases" rules (suspicious code, off-topic
preamble, etc.). Updated translation section to list all four locales
and disclose AI-translation.
About page expansion:
- Donate grid (5 channels from .github/FUNDING.yml).
- Third-party categorized summary (UI / Editor / Parsers / Build / Tauri / i18n)
linking to THIRD-PARTY.md.
- Build info: version, commit SHA (linked to commit), build date —
injected via Vite define from git rev-parse.
- Links: repo, issues, discussions, demo, license.
- Disclaimer footer with translation note.
- All sections wired with new about.* i18n keys in en/vi/ja/zh-CN.
Verification:
- typecheck / lint / 175 tests pass / build OK.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
bb7ee3c53b
commit
1f5c4e092d
25 files changed
+1218
-48
No files matched your search
@@ -0,0 +1,22 @@
|
||||
# Code of Conduct
|
||||
|
||||
This project adopts the **[Contributor Covenant, v2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/)** verbatim.
|
||||
|
||||
In short:
|
||||
|
||||
- Be respectful. Disagreement is fine; harassment and personal attacks
|
||||
are not.
|
||||
- Assume good intent, but don't tolerate bad behavior.
|
||||
- Keep discussion focused on the project.
|
||||
|
||||
The maintainer ([@poli0981](https://github.com/poli0981)) is responsible
|
||||
for enforcement. Reports of misconduct can be sent through:
|
||||
|
||||
- A [private Discussion](https://github.com/poli0981/jsonprism/discussions) addressed to the maintainer, or
|
||||
- Email via the address on the GitHub profile.
|
||||
|
||||
Reports are handled confidentially. Possible outcomes include: a warning,
|
||||
a temporary ban, or a permanent ban from the repository.
|
||||
|
||||
For the full text — definitions, scope, enforcement guidelines — see the
|
||||
[Contributor Covenant 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
|
||||
+35
-3
@@ -53,7 +53,12 @@ Use the [Feature Request](https://github.com/poli0981/jsonprism/issues/new?templ
|
||||
|
||||
### 🌍 Translations
|
||||
|
||||
Currently bundled: **English** and **Tiếng Việt**. To add a new language:
|
||||
Currently bundled: **English**, **Tiếng Việt**, **日本語**, **简体中文**.
|
||||
Non-English locales are AI-generated and not professionally reviewed —
|
||||
see [DISCLAIMER.md](DISCLAIMER.md). Native-speaker corrections are very
|
||||
welcome.
|
||||
|
||||
To add a new language:
|
||||
|
||||
1. Copy `src/i18n/locales/en.json` to `src/i18n/locales/<your-locale>.json`
|
||||
2. Translate every value
|
||||
@@ -87,11 +92,38 @@ chore(deps): bump react to 19.1
|
||||
|
||||
Prefixes: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `style`.
|
||||
|
||||
## Auto-ignored contributions
|
||||
|
||||
To keep the maintainer's review queue manageable, the following are
|
||||
closed without review:
|
||||
|
||||
- **PRs with suspicious code.** If a diff looks like obfuscated/minified
|
||||
code, hidden network calls, or subtly tampered third-party files, it
|
||||
will be flagged. If CodeQL or Dependabot also flag it, the contributor
|
||||
will be **banned** without exception. The maintainer may also verify
|
||||
suspect sections by hand.
|
||||
- **PRs / issues posting unknown / random links** (especially shortened
|
||||
URLs to "demos", "fixes", etc. with no clear source).
|
||||
- **Behavior / language violating GitHub's policy** — harassment, hate
|
||||
speech, doxxing, NSFW content, etc.
|
||||
- **Off-topic preamble**, e.g. "Chào buổi sáng, hôm nay là 1 ngày trời
|
||||
đẹp…" or any greeting/filler that doesn't immediately address the
|
||||
issue. Get to the point: what's wrong, what's the expected behavior,
|
||||
what reproduces it.
|
||||
- **PRs without a meaningful description** or test plan. See the PR
|
||||
template — sections marked required are required.
|
||||
|
||||
These rules exist because this is a one-person + AI-assisted project
|
||||
(see [DISCLAIMER.md](DISCLAIMER.md)); time spent triaging low-effort
|
||||
contributions takes away from real work.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
Be kind. Assume good faith. Disagreements about technical choices are fine; personal attacks are not.
|
||||
This project adopts the [Contributor Covenant v2.1](CODE_OF_CONDUCT.md).
|
||||
Be kind. Assume good faith. Disagreements about technical choices are
|
||||
fine; personal attacks and harassment are not.
|
||||
|
||||
Reports to the maintainer via GitHub (DM or email on profile).
|
||||
Reports to the maintainer via the [private Security Advisory flow](https://github.com/poli0981/jsonprism/security/advisories/new) for sensitive matters, or a private GitHub Discussion otherwise.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
# Disclaimer
|
||||
|
||||
**Last updated**: 2026-05-13
|
||||
|
||||
## Project status
|
||||
|
||||
JSONPrism is a **one-person open-source project** maintained by
|
||||
[@poli0981](https://github.com/poli0981) (Kokone), written with substantial
|
||||
AI assistance. It is published under the Apache 2.0 License and the source
|
||||
is available on GitHub.
|
||||
|
||||
It is **not** a commercial product. There is no SLA, no support contract,
|
||||
and no warranty. See the `LICENSE` file for the exact legal text — the
|
||||
Apache 2.0 disclaimer-of-warranty clause applies in full.
|
||||
|
||||
## Quality expectations
|
||||
|
||||
- The maintainer aims for production-grade quality but does not guarantee
|
||||
bug-free behavior, performance, or correctness for any particular input.
|
||||
- Each conversion is implemented to a reasonable interpretation of the
|
||||
target spec, but edge cases (especially around lossy formats like XML
|
||||
and Markdown) may differ from other tools you've used.
|
||||
- If you rely on JSONPrism for a critical workflow, please verify the
|
||||
output yourself.
|
||||
|
||||
## AI-assisted code & translations
|
||||
|
||||
This project openly uses AI tools during development:
|
||||
|
||||
- **Claude Chat** + **Claude Code (Opus 4.7, 1M context)** — used for
|
||||
drafting code, refactoring, writing tests, generating translations,
|
||||
and reviewing PRs.
|
||||
- All AI-generated code is reviewed by the maintainer before being
|
||||
merged. Errors that slip through are bugs — please report them via
|
||||
[GitHub Issues](https://github.com/poli0981/jsonprism/issues).
|
||||
|
||||
### Translations
|
||||
|
||||
Non-English locales (currently Vietnamese, Japanese, Simplified Chinese)
|
||||
are produced primarily by AI translation. They are **not professionally
|
||||
reviewed**. Subtle wording, technical jargon, or idiomatic phrasings may
|
||||
be inaccurate.
|
||||
|
||||
If you are a native speaker and spot a translation issue, a PR or a
|
||||
Discussion post is very welcome. See the `disclaimer.translation` i18n
|
||||
key — it surfaces this disclaimer to users at runtime.
|
||||
|
||||
## What this means in practice
|
||||
|
||||
- Do not feed JSONPrism sensitive data and then ship the output to
|
||||
production without checking it.
|
||||
- Do not assume that round-tripping JSON → format → JSON is byte-perfect
|
||||
for lossy formats (XML, SQL, Markdown — the app marks these by not
|
||||
exposing a reverse converter).
|
||||
- Pin a specific JSONPrism version if you depend on its behavior; future
|
||||
releases may change defaults.
|
||||
|
||||
## Reporting concerns
|
||||
|
||||
- Bugs: [GitHub Issues](https://github.com/poli0981/jsonprism/issues)
|
||||
- Security: [Private Security Advisory](https://github.com/poli0981/jsonprism/security/advisories/new)
|
||||
- Translation accuracy: GitHub Discussions
|
||||
@@ -0,0 +1,26 @@
|
||||
# Maintainers
|
||||
|
||||
| Name | GitHub | Scope |
|
||||
|---|---|---|
|
||||
| Kokone | [@poli0981](https://github.com/poli0981) | Solo maintainer — code review, releases, translations review, community |
|
||||
|
||||
JSONPrism is co-authored with AI tooling — see [DISCLAIMER.md](DISCLAIMER.md)
|
||||
for details. The maintainer is the single point of human review for every
|
||||
merged PR.
|
||||
|
||||
## Contact
|
||||
|
||||
- Bug reports & feature requests: [GitHub Issues](https://github.com/poli0981/jsonprism/issues)
|
||||
- Discussion / Q&A: [GitHub Discussions](https://github.com/poli0981/jsonprism/discussions)
|
||||
- Security: [Private Security Advisory](https://github.com/poli0981/jsonprism/security/advisories/new)
|
||||
|
||||
## Becoming a maintainer
|
||||
|
||||
JSONPrism is small-by-design. Additional maintainers may be added when a
|
||||
contributor has demonstrated:
|
||||
|
||||
- Multiple high-quality merged PRs.
|
||||
- Familiarity with the conventions in [CLAUDE.md](CLAUDE.md).
|
||||
- Willingness to review others' PRs and respond to issues.
|
||||
|
||||
Until then, the project runs as a single-maintainer indie project.
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
# Privacy policy
|
||||
|
||||
**Last updated**: 2026-05-13
|
||||
|
||||
## Short version
|
||||
|
||||
**JSONPrism does not collect, transmit, or store your data on any server.**
|
||||
Everything happens in your browser (or inside the Tauri desktop bundle).
|
||||
There is no analytics, no telemetry, no tracking, no account system, no
|
||||
"cloud sync." This page exists to explain what *does* happen locally and
|
||||
why.
|
||||
|
||||
## What we run on
|
||||
|
||||
| Surface | Hosting | What it can see |
|
||||
|---|---|---|
|
||||
| Web app | [GitHub Pages](https://pages.github.com/) (static hosting only) | Standard request logs at the GitHub layer — IP, user-agent, requested asset. JSONPrism has no server code with access to those. |
|
||||
| Desktop app | Tauri 2 bundle, runs locally | No network calls from app code. Only the OS file dialogs you trigger. |
|
||||
|
||||
Neither surface phones home about how you use the app.
|
||||
|
||||
## What we store locally
|
||||
|
||||
The app uses `localStorage` to remember your preferences across reloads.
|
||||
These keys are written by JSONPrism:
|
||||
|
||||
| Key | What it stores |
|
||||
|---|---|
|
||||
| `jsonprism.theme` | `light` / `dark` / `system` |
|
||||
| `jsonprism.lang` | UI language code (`en` / `vi` / `ja` / `zh-CN`) |
|
||||
| `jsonprism.selected_format` | The target format chip you last selected |
|
||||
| `jsonprism.direction` | Conversion direction (`forward` / `reverse`) |
|
||||
| `jsonprism.options.<format>` | Per-format options (e.g. CSV header on/off) |
|
||||
|
||||
That is the entire on-disk footprint. Clearing your browser's site data
|
||||
removes everything. Nothing leaves your device.
|
||||
|
||||
## What JSONPrism never does
|
||||
|
||||
- No analytics SDK (no Google Analytics, no Plausible, no PostHog, etc.).
|
||||
- No remote error reporting (no Sentry, no Rollbar).
|
||||
- No CDN that proxies your content — assets are served directly from
|
||||
GitHub Pages.
|
||||
- No login or account.
|
||||
- No "cloud" backup, no clipboard upload, no diff-sharing.
|
||||
|
||||
## Tauri desktop specifics
|
||||
|
||||
- The Tauri bundle has filesystem access scoped to `$HOME`, `$DOCUMENT`,
|
||||
`$DOWNLOAD`, `$DESKTOP` only (see [`src-tauri/capabilities/default.json`](src-tauri/capabilities/default.json)).
|
||||
- Drag-and-drop files come from the OS — JSONPrism reads their contents
|
||||
in-process and never writes them anywhere unless you explicitly hit
|
||||
"Download .zip" or "Save".
|
||||
- The OS may write window-position / window-size metadata on shutdown
|
||||
(handled by Tauri, not by JSONPrism code).
|
||||
|
||||
## Third-party fonts
|
||||
|
||||
The web build loads three fonts from Google Fonts via `<link rel="preconnect">`:
|
||||
|
||||
- Geist (body)
|
||||
- Instrument Serif (display)
|
||||
- JetBrains Mono (code)
|
||||
|
||||
Google Fonts can see your IP when your browser fetches the font files.
|
||||
The Tauri build inlines these fonts and never makes the request.
|
||||
|
||||
## Questions
|
||||
|
||||
Open a [GitHub Discussion](https://github.com/poli0981/jsonprism/discussions) if anything here is unclear.
|
||||
For security-relevant reports, use the [private Security Advisory flow](https://github.com/poli0981/jsonprism/security/advisories/new).
|
||||
@@ -185,10 +185,39 @@ See [`docs/ROADMAP.md`](docs/ROADMAP.md) for the full phase plan.
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests welcome — please read [`CONTRIBUTING.md`](CONTRIBUTING.md) first.
|
||||
Pull requests welcome — please read [`CONTRIBUTING.md`](CONTRIBUTING.md) first. PRs that match the **auto-ignored** patterns described there (suspicious code, off-topic preamble, no description, etc.) get closed without review.
|
||||
|
||||
For bug reports and feature requests, use [GitHub Issues](https://github.com/poli0981/jsonprism/issues).
|
||||
For bug reports and feature requests, use [GitHub Issues](https://github.com/poli0981/jsonprism/issues). For security vulnerabilities, use the [private Security Advisory flow](https://github.com/poli0981/jsonprism/security/advisories/new).
|
||||
|
||||
## Project docs
|
||||
|
||||
| Doc | What's in it |
|
||||
|---|---|
|
||||
| [`PRIVACY.md`](PRIVACY.md) | Offline-first, localStorage-only, no telemetry. |
|
||||
| [`SECURITY.md`](SECURITY.md) | How to report vulnerabilities; response SLAs. |
|
||||
| [`DISCLAIMER.md`](DISCLAIMER.md) | One-person + AI-assisted project; no warranty. |
|
||||
| [`THIRD-PARTY.md`](THIRD-PARTY.md) | Every dependency: version, license, link. |
|
||||
| [`MAINTAINERS.md`](MAINTAINERS.md) | Who's responsible for what. |
|
||||
| [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md) | Contributor Covenant v2.1. |
|
||||
| [`docs/ROADMAP.md`](docs/ROADMAP.md) | Phase plan, current status. |
|
||||
| [`docs/pc_spec.md`](docs/pc_spec.md) · [`docs/dev_env.md`](docs/dev_env.md) | Maintainer's hardware + toolchain. |
|
||||
| [`docs/TAURI-NOTES.md`](docs/TAURI-NOTES.md) | Tauri build / process notes. |
|
||||
| [`docs/RESX-MIGRATION.md`](docs/RESX-MIGRATION.md) | i18next JSON → .NET RESX tutorial. |
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Substantial parts of JSONPrism's code, tests, translations, and docs
|
||||
were drafted with **Claude Chat** and **Claude Code (Opus 4.7, 1M
|
||||
context)**. See [DISCLAIMER.md](DISCLAIMER.md) for the full AI-assist
|
||||
disclosure. Translation quality for non-English locales is best-effort
|
||||
and contributions from native speakers are welcomed.
|
||||
|
||||
## Sponsorship
|
||||
|
||||
If JSONPrism is useful to you, consider sponsoring the maintainer via
|
||||
any of the channels in [`.github/FUNDING.yml`](.github/FUNDING.yml):
|
||||
GitHub Sponsors, Ko-fi, Buy Me a Coffee, Patreon, or PayPal.
|
||||
|
||||
## License
|
||||
|
||||
[Apache License 2.0](LICENSE) — © 2026 Kokone.
|
||||
[Apache License 2.0](LICENSE) — © 2026 Kokone ([@poli0981](https://github.com/poli0981)).
|
||||
+32
-3
@@ -182,10 +182,39 @@ Xem [`docs/ROADMAP.md`](docs/ROADMAP.md) để biết kế hoạch phase đầy
|
||||
|
||||
## Đóng góp
|
||||
|
||||
Welcome pull request — vui lòng đọc [`CONTRIBUTING.md`](CONTRIBUTING.md) trước.
|
||||
Welcome pull request — vui lòng đọc [`CONTRIBUTING.md`](CONTRIBUTING.md) trước. PR thuộc nhóm **auto-ignored** (code đáng ngờ, lan man không vào vấn đề, không mô tả…) sẽ bị đóng không review.
|
||||
|
||||
Báo bug hoặc đề xuất tính năng tại [GitHub Issues](https://github.com/poli0981/jsonprism/issues).
|
||||
Báo bug hoặc đề xuất tính năng tại [GitHub Issues](https://github.com/poli0981/jsonprism/issues). Vấn đề bảo mật vui lòng dùng [Security Advisory riêng tư](https://github.com/poli0981/jsonprism/security/advisories/new).
|
||||
|
||||
## Tài liệu project
|
||||
|
||||
| Doc | Nội dung |
|
||||
|---|---|
|
||||
| [`PRIVACY.md`](PRIVACY.md) | Offline-first, chỉ localStorage, không telemetry. |
|
||||
| [`SECURITY.md`](SECURITY.md) | Cách report vulnerability, SLA. |
|
||||
| [`DISCLAIMER.md`](DISCLAIMER.md) | Project 1 người + AI-assisted, không bảo hành. |
|
||||
| [`THIRD-PARTY.md`](THIRD-PARTY.md) | Mỗi dependency: version, giấy phép, link. |
|
||||
| [`MAINTAINERS.md`](MAINTAINERS.md) | Ai chịu trách nhiệm gì. |
|
||||
| [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md) | Contributor Covenant v2.1. |
|
||||
| [`docs/ROADMAP.md`](docs/ROADMAP.md) | Phase plan, trạng thái hiện tại. |
|
||||
| [`docs/i18n/vi/pc_spec.md`](docs/i18n/vi/pc_spec.md) · [`docs/i18n/vi/dev_env.md`](docs/i18n/vi/dev_env.md) | Phần cứng + toolchain của maintainer. |
|
||||
| [`docs/TAURI-NOTES.md`](docs/TAURI-NOTES.md) | Ghi chú Tauri build / process. |
|
||||
| [`docs/RESX-MIGRATION.md`](docs/RESX-MIGRATION.md) | Hướng dẫn i18next JSON → .NET RESX. |
|
||||
|
||||
## Ghi nhận
|
||||
|
||||
Phần lớn code, test, bản dịch và tài liệu của JSONPrism được draft với
|
||||
**Claude Chat** và **Claude Code (Opus 4.7, 1M context)**. Xem
|
||||
[DISCLAIMER.md](DISCLAIMER.md) để biết chi tiết về AI-assist. Chất lượng
|
||||
bản dịch ngôn ngữ ngoài tiếng Anh là best-effort — rất hoan nghênh
|
||||
đóng góp từ người bản ngữ.
|
||||
|
||||
## Tài trợ
|
||||
|
||||
Nếu JSONPrism hữu ích cho bạn, hãy cân nhắc tài trợ maintainer qua một
|
||||
trong các kên trong [`.github/FUNDING.yml`](.github/FUNDING.yml):
|
||||
GitHub Sponsors, Ko-fi, Buy Me a Coffee, Patreon hoặc PayPal.
|
||||
|
||||
## Giấy phép
|
||||
|
||||
[Apache License 2.0](LICENSE) — © 2026 Kokone.
|
||||
[Apache License 2.0](LICENSE) — © 2026 Kokone ([@poli0981](https://github.com/poli0981)).
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
# Security policy
|
||||
|
||||
## Supported versions
|
||||
|
||||
JSONPrism follows [Semantic Versioning](https://semver.org/). Only the
|
||||
latest minor of the current major receives security fixes.
|
||||
|
||||
| Version | Supported |
|
||||
|---|---|
|
||||
| 1.x | ✅ |
|
||||
| < 1.0 | ❌ |
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
**Please do not open a public GitHub Issue for security reports.**
|
||||
|
||||
Use GitHub's private vulnerability reporting:
|
||||
|
||||
→ <https://github.com/poli0981/jsonprism/security/advisories/new>
|
||||
|
||||
This routes the report directly to the maintainer through a private
|
||||
channel. You can include a proof-of-concept, suggested fix, and your
|
||||
disclosure timeline preference.
|
||||
|
||||
If GitHub's private reporting is unavailable for any reason, contact
|
||||
[@poli0981](https://github.com/poli0981) via the email listed on the
|
||||
GitHub profile.
|
||||
|
||||
## Response expectations
|
||||
|
||||
JSONPrism is a one-person open-source project (see
|
||||
[DISCLAIMER.md](DISCLAIMER.md)). Response times are best-effort:
|
||||
|
||||
| Severity | Initial response | Fix released |
|
||||
|---|---|---|
|
||||
| Critical (RCE, data exfil, auth bypass) | within 48h | best-effort patch ASAP |
|
||||
| High (information disclosure, persistent XSS) | within 7 days | next release |
|
||||
| Medium / Low | within 30 days | next minor release |
|
||||
|
||||
For the **client-side, no-server** nature of JSONPrism, "critical" issues
|
||||
are realistically: malicious-input parsing crashes that lead to RCE
|
||||
inside the Tauri WebView, supply-chain compromise of a dependency, or
|
||||
prototype-pollution-style flaws in a converter that affects downstream
|
||||
consumers of the output.
|
||||
|
||||
## Scope
|
||||
|
||||
In scope:
|
||||
- Vulnerabilities in `src/` (React app, converters, batch processor).
|
||||
- Vulnerabilities in `src-tauri/` (Rust shell, plugin config, CSP).
|
||||
- Vulnerabilities introduced by build tooling that end up in the
|
||||
published bundle (`dist/` on GitHub Pages, Tauri release artifacts).
|
||||
- Auth/identity vulnerabilities — not applicable; the app has no
|
||||
accounts, no server, no telemetry.
|
||||
|
||||
Out of scope:
|
||||
- GitHub Pages or GitHub Actions platform issues — report to GitHub.
|
||||
- WebView2 / WebKitGTK / WKWebView host bugs — report to Microsoft /
|
||||
the GTK / Apple WebKit teams. JSONPrism inherits whatever is on the
|
||||
user's system.
|
||||
- Issues that require an attacker to already have local code execution
|
||||
on the user's machine.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Reporters are credited in the published advisory unless they request
|
||||
otherwise. Contributors of accepted fixes are credited in the release
|
||||
notes.
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
# Third-party notice
|
||||
|
||||
JSONPrism is built on top of open-source libraries. This page lists each
|
||||
direct dependency, the version pinned in [`package.json`](package.json) and
|
||||
[`src-tauri/Cargo.toml`](src-tauri/Cargo.toml), the upstream license, and a
|
||||
link to the project.
|
||||
|
||||
Versions reflect the `^` semver range — exact installed versions appear
|
||||
in [`package-lock.json`](package-lock.json) and `src-tauri/Cargo.lock`.
|
||||
|
||||
If you are bundling JSONPrism into a derived work, the Apache 2.0
|
||||
license inherited from the upstream packages requires that you reproduce
|
||||
the relevant notices. This file is a starting point.
|
||||
|
||||
---
|
||||
|
||||
## UI framework
|
||||
|
||||
| Package | Version | License | Link |
|
||||
|---|---|---|---|
|
||||
| `react` | ^19.0.0 | MIT | [react.dev](https://react.dev/) |
|
||||
| `react-dom` | ^19.0.0 | MIT | [react.dev](https://react.dev/) |
|
||||
| `react-router-dom` | ^7.0.0 | MIT | [reactrouter.com](https://reactrouter.com/) |
|
||||
| `tailwindcss` | ^4.0.0 | MIT | [tailwindcss.com](https://tailwindcss.com/) |
|
||||
| `tw-animate-css` | ^1.2.0 | MIT | [github.com/Wombosvideo/tw-animate-css](https://github.com/Wombosvideo/tw-animate-css) |
|
||||
| `tailwind-merge` | ^2.5.0 | MIT | [github.com/dcastil/tailwind-merge](https://github.com/dcastil/tailwind-merge) |
|
||||
| `class-variance-authority` | ^0.7.0 | Apache-2.0 | [cva.style](https://cva.style/) |
|
||||
| `clsx` | ^2.1.0 | MIT | [github.com/lukeed/clsx](https://github.com/lukeed/clsx) |
|
||||
| `@radix-ui/react-dialog` | ^1.1.0 | MIT | [radix-ui.com](https://www.radix-ui.com/) |
|
||||
| `@radix-ui/react-slot` | ^1.1.0 | MIT | [radix-ui.com](https://www.radix-ui.com/) |
|
||||
| `@radix-ui/react-switch` | ^1.1.0 | MIT | [radix-ui.com](https://www.radix-ui.com/) |
|
||||
| `lucide-react` | ^0.460.0 | ISC | [lucide.dev](https://lucide.dev/) |
|
||||
| `sonner` | ^1.7.0 | MIT | [sonner.emilkowal.ski](https://sonner.emilkowal.ski/) |
|
||||
| `react-dropzone` | ^14.3.0 | MIT | [react-dropzone.js.org](https://react-dropzone.js.org/) |
|
||||
|
||||
The component patterns under `src/components/ui/` are generated from
|
||||
**[shadcn/ui](https://ui.shadcn.com/)** (MIT) — copied into the repo, not
|
||||
installed as a runtime dependency.
|
||||
|
||||
## Code editor
|
||||
|
||||
| Package | Version | License | Link |
|
||||
|---|---|---|---|
|
||||
| `@uiw/react-codemirror` | ^4.23.0 | MIT | [uiwjs.github.io/react-codemirror](https://uiwjs.github.io/react-codemirror/) |
|
||||
| `@codemirror/state` | ^6.4.0 | MIT | [codemirror.net](https://codemirror.net/) |
|
||||
| `@codemirror/view` | ^6.34.0 | MIT | [codemirror.net](https://codemirror.net/) |
|
||||
| `@codemirror/language` | ^6.10.0 | MIT | [codemirror.net](https://codemirror.net/) |
|
||||
| `@codemirror/lang-json` | ^6.0.0 | MIT | [codemirror.net](https://codemirror.net/) |
|
||||
| `@codemirror/lint` | ^6.8.0 | MIT | [codemirror.net](https://codemirror.net/) |
|
||||
| `@lezer/highlight` | ^1.2.0 | MIT | [lezer.codemirror.net](https://lezer.codemirror.net/) |
|
||||
|
||||
## Parsers / serialization
|
||||
|
||||
| Package | Version | License | Link |
|
||||
|---|---|---|---|
|
||||
| `papaparse` | ^5.4.0 | MIT | [papaparse.com](https://www.papaparse.com/) |
|
||||
| `js-yaml` | ^4.1.0 | MIT | [github.com/nodeca/js-yaml](https://github.com/nodeca/js-yaml) |
|
||||
| `smol-toml` | ^1.3.0 | BSD-3-Clause | [github.com/squirrelchat/smol-toml](https://github.com/squirrelchat/smol-toml) |
|
||||
| `fast-xml-parser` | ^5.8.0 | MIT | [github.com/NaturalIntelligence/fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) |
|
||||
| `bson` | ^7.2.0 | Apache-2.0 | [github.com/mongodb/js-bson](https://github.com/mongodb/js-bson) |
|
||||
| `cbor-x` | ^1.6.4 | MIT | [github.com/kriszyp/cbor-x](https://github.com/kriszyp/cbor-x) |
|
||||
| `@msgpack/msgpack` | ^3.1.3 | ISC | [msgpack.org/javascript](https://msgpack.org/) |
|
||||
| `fflate` | ^0.8.2 | MIT | [github.com/101arrowz/fflate](https://github.com/101arrowz/fflate) |
|
||||
|
||||
## State & i18n
|
||||
|
||||
| Package | Version | License | Link |
|
||||
|---|---|---|---|
|
||||
| `zustand` | ^5.0.0 | MIT | [github.com/pmndrs/zustand](https://github.com/pmndrs/zustand) |
|
||||
| `i18next` | ^23.0.0 | MIT | [i18next.com](https://www.i18next.com/) |
|
||||
| `react-i18next` | ^15.0.0 | MIT | [react.i18next.com](https://react.i18next.com/) |
|
||||
| `i18next-browser-languagedetector` | ^8.0.0 | MIT | [github.com/i18next/i18next-browser-languageDetector](https://github.com/i18next/i18next-browser-languageDetector) |
|
||||
|
||||
## Tauri (desktop)
|
||||
|
||||
| Package | Version | License | Link |
|
||||
|---|---|---|---|
|
||||
| `@tauri-apps/api` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
|
||||
| `@tauri-apps/plugin-dialog` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
|
||||
| `@tauri-apps/plugin-fs` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
|
||||
| `@tauri-apps/plugin-os` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
|
||||
| `@tauri-apps/plugin-shell` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
|
||||
| `@tauri-apps/cli` (devDep) | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
|
||||
|
||||
### Rust crates (`src-tauri/Cargo.toml`)
|
||||
|
||||
| Crate | Version | License | Link |
|
||||
|---|---|---|---|
|
||||
| `tauri` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri](https://crates.io/crates/tauri) |
|
||||
| `tauri-build` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-build](https://crates.io/crates/tauri-build) |
|
||||
| `tauri-plugin-dialog` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-dialog](https://crates.io/crates/tauri-plugin-dialog) |
|
||||
| `tauri-plugin-fs` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-fs](https://crates.io/crates/tauri-plugin-fs) |
|
||||
| `tauri-plugin-os` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-os](https://crates.io/crates/tauri-plugin-os) |
|
||||
| `tauri-plugin-shell` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-shell](https://crates.io/crates/tauri-plugin-shell) |
|
||||
| `tauri-plugin-single-instance` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-single-instance](https://crates.io/crates/tauri-plugin-single-instance) |
|
||||
| `serde` | 1 | Apache-2.0 OR MIT | [serde.rs](https://serde.rs/) |
|
||||
| `serde_json` | 1 | Apache-2.0 OR MIT | [github.com/serde-rs/json](https://github.com/serde-rs/json) |
|
||||
|
||||
## Build tooling
|
||||
|
||||
| Package | Version | License | Link |
|
||||
|---|---|---|---|
|
||||
| `vite` | ^8.0.0 | MIT | [vite.dev](https://vite.dev/) |
|
||||
| `@vitejs/plugin-react` | ^6.0.0 | MIT | [github.com/vitejs/vite-plugin-react](https://github.com/vitejs/vite-plugin-react) |
|
||||
| `@tailwindcss/vite` | ^4.0.0 | MIT | [tailwindcss.com](https://tailwindcss.com/) |
|
||||
| `typescript` | ^5.7.0 | Apache-2.0 | [typescriptlang.org](https://www.typescriptlang.org/) |
|
||||
| `eslint` | ^9.15.0 | MIT | [eslint.org](https://eslint.org/) |
|
||||
| `typescript-eslint` | ^8.15.0 | MIT, BSD-2-Clause | [typescript-eslint.io](https://typescript-eslint.io/) |
|
||||
| `eslint-plugin-react-hooks` | ^5.0.0 | MIT | [github.com/facebook/react](https://github.com/facebook/react) |
|
||||
| `eslint-plugin-react-refresh` | ^0.4.0 | MIT | [github.com/ArnaudBarre/eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) |
|
||||
| `prettier` | ^3.4.0 | MIT | [prettier.io](https://prettier.io/) |
|
||||
| `prettier-plugin-tailwindcss` | ^0.6.0 | MIT | [github.com/tailwindlabs/prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss) |
|
||||
| `vitest` | ^4.1.6 | MIT | [vitest.dev](https://vitest.dev/) |
|
||||
| `@vitest/coverage-v8` | ^4.1.6 | MIT | [vitest.dev](https://vitest.dev/) |
|
||||
| `@testing-library/react` | ^16.1.0 | MIT | [testing-library.com](https://testing-library.com/) |
|
||||
| `@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) |
|
||||
|
||||
## Fonts
|
||||
|
||||
Served via Google Fonts on the web build, inlined into Tauri build:
|
||||
|
||||
- **Geist** — SIL Open Font License 1.1 — [vercel.com/font](https://vercel.com/font)
|
||||
- **Instrument Serif** — SIL Open Font License 1.1 — [github.com/Instrument/instrument-serif](https://github.com/Instrument/instrument-serif)
|
||||
- **JetBrains Mono** — SIL Open Font License 1.1 — [jetbrains.com/lp/mono](https://www.jetbrains.com/lp/mono/)
|
||||
|
||||
## Icon
|
||||
|
||||
The JSONPrism brand icon at `src-tauri/icons/icon.svg` is original
|
||||
artwork by Kokone, licensed under the same Apache 2.0 terms as the rest
|
||||
of the project.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Substantial portions of JSONPrism's code, tests, translations, and docs
|
||||
were drafted with **Claude Chat** + **Claude Code (Opus 4.7, 1M
|
||||
context)** from Anthropic. See [DISCLAIMER.md](DISCLAIMER.md).
|
||||
@@ -0,0 +1,62 @@
|
||||
# Developer environment
|
||||
|
||||
This is the toolchain the maintainer keeps installed for JSONPrism +
|
||||
sibling projects. It is **not** a strict requirement for contributing —
|
||||
most contributors only need the **Web app** column.
|
||||
|
||||
## Required for the web app
|
||||
|
||||
| Tool | Minimum | Latest exercised | Notes |
|
||||
|---|---|---|---|
|
||||
| **Node.js** | 22.11.0 LTS | 25.8.1 | Set in [package.json](../package.json) `engines.node`. |
|
||||
| **npm** | bundled with Node | — | `npm ci` is what CI runs. |
|
||||
| **Git** | recent (≥ 2.40) | — | Commit signing (`commit.gpgsign=true`) recommended. |
|
||||
|
||||
## Required for the Tauri desktop build
|
||||
|
||||
In addition to the web app deps:
|
||||
|
||||
| Tool | Minimum | Notes |
|
||||
|---|---|---|
|
||||
| **Rust** | 1.77 (per `Cargo.toml`) | Install via `rustup`; stable channel. |
|
||||
| **Platform build deps** | OS-specific | See `README.md` § Desktop app for the full list. |
|
||||
|
||||
## Other tooling on the maintainer's machine
|
||||
|
||||
These are unrelated to JSONPrism but documented so anyone reproducing
|
||||
the broader dev environment knows what's around:
|
||||
|
||||
- **Python**: 3.12.x, 3.14.x (used for adjacent scripting projects).
|
||||
- **.NET**: 8.x, 9.x, 10.x, 11.x (preview) — for sibling AutoClickForge / PhantomMAC projects.
|
||||
- **GPG**: commit signing enabled (`commit.gpgsign=true`).
|
||||
|
||||
## IDEs
|
||||
|
||||
- **JetBrains** WebStorm (2026.x) — primary IDE; runs Prettier + ESLint on save.
|
||||
- **Visual Studio Code** — secondary; useful for the Tauri/Rust side via `rust-analyzer`.
|
||||
|
||||
## Recommended workflow
|
||||
|
||||
```bash
|
||||
# One-time
|
||||
git clone https://github.com/poli0981/jsonprism.git
|
||||
cd jsonprism
|
||||
npm install
|
||||
|
||||
# Daily
|
||||
npm run dev # web dev server, http://localhost:5173
|
||||
|
||||
# Before pushing
|
||||
npm run format
|
||||
npm run typecheck
|
||||
npm run lint
|
||||
npm test
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Related docs
|
||||
|
||||
- [docs/pc_spec.md](pc_spec.md) — hardware reference.
|
||||
- [docs/TAURI-NOTES.md](TAURI-NOTES.md) — Tauri-specific notes.
|
||||
- [README.md](../README.md) — project overview + quick start.
|
||||
- [Tiếng Việt](i18n/vi/dev_env.md)
|
||||
@@ -0,0 +1,62 @@
|
||||
# Môi trường phát triển
|
||||
|
||||
Đây là toolchain mà maintainer giữ cài đặt cho JSONPrism + các project
|
||||
anh em. **Không** phải yêu cầu bắt buộc để đóng góp — phần lớn
|
||||
contributor chỉ cần cột **App web**.
|
||||
|
||||
## Bắt buộc cho app web
|
||||
|
||||
| Tool | Tối thiểu | Đã test | Ghi chú |
|
||||
|---|---|---|---|
|
||||
| **Node.js** | 22.11.0 LTS | 25.8.1 | Set trong [package.json](../../../package.json) `engines.node`. |
|
||||
| **npm** | đi kèm Node | — | `npm ci` là cái CI chạy. |
|
||||
| **Git** | gần (≥ 2.40) | — | Khuyến nghị commit signing (`commit.gpgsign=true`). |
|
||||
|
||||
## Bắt buộc cho bản desktop Tauri
|
||||
|
||||
Ngoài deps của app web:
|
||||
|
||||
| Tool | Tối thiểu | Ghi chú |
|
||||
|---|---|---|
|
||||
| **Rust** | 1.77 (theo `Cargo.toml`) | Cài qua `rustup`; channel stable. |
|
||||
| **Build deps theo platform** | tuỳ OS | Xem `README.md` § Desktop app để biết list đầy đủ. |
|
||||
|
||||
## Tool khác có trên máy maintainer
|
||||
|
||||
Không liên quan trực tiếp JSONPrism nhưng ghi lại để ai muốn dựng môi
|
||||
trường tương đương:
|
||||
|
||||
- **Python**: 3.12.x, 3.14.x (cho các project script khác).
|
||||
- **.NET**: 8.x, 9.x, 10.x, 11.x (preview) — cho project anh em AutoClickForge / PhantomMAC.
|
||||
- **GPG**: bật commit signing (`commit.gpgsign=true`).
|
||||
|
||||
## IDE
|
||||
|
||||
- **JetBrains** WebStorm (2026.x) — IDE chính; chạy Prettier + ESLint khi save.
|
||||
- **Visual Studio Code** — phụ; tiện cho phần Tauri/Rust qua `rust-analyzer`.
|
||||
|
||||
## Workflow khuyến nghị
|
||||
|
||||
```bash
|
||||
# Một lần
|
||||
git clone https://github.com/poli0981/jsonprism.git
|
||||
cd jsonprism
|
||||
npm install
|
||||
|
||||
# Hằng ngày
|
||||
npm run dev # dev server web, http://localhost:5173
|
||||
|
||||
# Trước khi push
|
||||
npm run format
|
||||
npm run typecheck
|
||||
npm run lint
|
||||
npm test
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Tài liệu liên quan
|
||||
|
||||
- [docs/pc_spec.md (VI)](pc_spec.md) — phần cứng.
|
||||
- [docs/TAURI-NOTES.md](../../TAURI-NOTES.md) — ghi chú Tauri.
|
||||
- [README.vi.md](../../../README.vi.md) — giới thiệu project + quick start.
|
||||
- [English](../../dev_env.md)
|
||||
@@ -0,0 +1,35 @@
|
||||
# Cấu hình máy của developer
|
||||
|
||||
Cấu hình phần cứng mà maintainer sử dụng để build và test JSONPrism.
|
||||
Tài liệu hoá để contributor biết những gì đã được kiểm chứng — **không**
|
||||
phải là yêu cầu hệ thống để chạy JSONPrism (bản web chạy trên mọi trình
|
||||
duyệt hiện đại; bản Tauri chạy trên Windows / macOS / Linux trong phạm
|
||||
vi hỗ trợ chung của Tauri).
|
||||
|
||||
## Máy chính
|
||||
|
||||
| Thành phần | Chi tiết |
|
||||
|---|---|
|
||||
| **OS** | Windows 11 Pro 25H2 Insider Preview (Dev Channel) |
|
||||
| **Build** | 26300.8376 |
|
||||
| **CPU** | Intel Core i7-14700KF |
|
||||
| **GPU** | NVIDIA GeForce RTX 5080 (16 GB VRAM) |
|
||||
| **RAM** | 32 GB DDR5 |
|
||||
| **Lưu trữ** | 1 TB SSD |
|
||||
| **IDE** | JetBrains IDEs (bản trả phí, 2026.x) + Visual Studio Code |
|
||||
|
||||
## Thiết bị di động / kiểm tra web
|
||||
|
||||
Dùng để kiểm tra bản web (chủ yếu là deploy lên GitHub Pages) trên thiết bị cảm ứng:
|
||||
|
||||
- iPhone 14 Pro — iOS 26.x — Chrome, Brave
|
||||
- iPhone 13 Pro Max — iOS 26.x — Chrome, Brave
|
||||
|
||||
Test Android là cơ hội (không có thiết bị chuyên dụng); bản web vẫn nên
|
||||
chạy được với các phiên bản WebView phổ thông.
|
||||
|
||||
## Tài liệu liên quan
|
||||
|
||||
- [docs/dev_env.md (VI)](dev_env.md) — toolchain + workflow phát triển.
|
||||
- [docs/TAURI-NOTES.md](../../TAURI-NOTES.md) — ghi chú riêng cho Tauri.
|
||||
- [English](../../pc_spec.md)
|
||||
@@ -0,0 +1,36 @@
|
||||
# Developer hardware
|
||||
|
||||
Reference hardware used by the maintainer to build and test JSONPrism.
|
||||
This is documented so contributors know what's been exercised — it is
|
||||
**not** a system requirement for running JSONPrism (the web build runs
|
||||
in any modern browser; the Tauri build runs on Windows / macOS / Linux
|
||||
within Tauri's general support matrix).
|
||||
|
||||
## Primary workstation
|
||||
|
||||
| Component | Detail |
|
||||
|---|---|
|
||||
| **OS** | Windows 11 Pro 25H2 Insider Preview (Dev Channel) |
|
||||
| **Build** | 26300.8376 |
|
||||
| **CPU** | Intel Core i7-14700KF |
|
||||
| **GPU** | NVIDIA GeForce RTX 5080 (16 GB VRAM) |
|
||||
| **RAM** | 32 GB DDR5 |
|
||||
| **Storage** | 1 TB SSD |
|
||||
| **IDE** | JetBrains IDEs (paid, 2026.x) + Visual Studio Code |
|
||||
|
||||
## Mobile / web-test devices
|
||||
|
||||
Used to verify the web build (mainly the GitHub Pages deploy) on touch
|
||||
form factors:
|
||||
|
||||
- iPhone 14 Pro — iOS 26.x — Chrome, Brave
|
||||
- iPhone 13 Pro Max — iOS 26.x — Chrome, Brave
|
||||
|
||||
Android testing is opportunistic (no dedicated device); the web build
|
||||
should still work given mainstream WebView versions.
|
||||
|
||||
## Related docs
|
||||
|
||||
- [docs/dev_env.md](dev_env.md) — toolchain + dev workflow.
|
||||
- [docs/TAURI-NOTES.md](TAURI-NOTES.md) — Tauri-specific build notes.
|
||||
- [Tiếng Việt](i18n/vi/pc_spec.md)
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useDropzone } from 'react-dropzone';
|
||||
import { Download, FileStack, FolderOpen, Loader2, Play, StopCircle, Trash2 } from 'lucide-react';
|
||||
@@ -17,9 +17,11 @@ import { isTauri, nativeOpenFiles, nativeSaveBlob, fileFromNativePath } from '@/
|
||||
import { getConverter } from '@/converters/registry';
|
||||
import type { FormatId } from '@/converters/types';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { Direction } from './DirectionToggle';
|
||||
|
||||
interface BatchPanelProps {
|
||||
format: FormatId;
|
||||
direction: Direction;
|
||||
options: Record<string, unknown>;
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
@@ -27,7 +29,7 @@ interface BatchPanelProps {
|
||||
onAddExternalFiles?: (files: File[]) => void;
|
||||
}
|
||||
|
||||
export function BatchPanel({ format, options, open, onOpenChange }: BatchPanelProps) {
|
||||
export function BatchPanel({ format, direction, options, open, onOpenChange }: BatchPanelProps) {
|
||||
const { t } = useTranslation();
|
||||
const items = useBatchStore((s) => s.items);
|
||||
const itemOrder = useBatchStore((s) => s.itemOrder);
|
||||
@@ -68,9 +70,25 @@ export function BatchPanel({ format, options, open, onOpenChange }: BatchPanelPr
|
||||
[handleAddFiles],
|
||||
);
|
||||
|
||||
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';
|
||||
|
||||
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
||||
onDrop,
|
||||
accept: { 'application/json': ['.json'], 'text/plain': ['.txt'] },
|
||||
accept,
|
||||
multiple: true,
|
||||
noClick: true,
|
||||
noKeyboard: true,
|
||||
@@ -100,6 +118,7 @@ export function BatchPanel({ format, options, open, onOpenChange }: BatchPanelPr
|
||||
onUpdate: (id, patch) => updateItem(id, patch),
|
||||
},
|
||||
controller.signal,
|
||||
direction,
|
||||
);
|
||||
if (!controller.signal.aborted) {
|
||||
toast.success(t('batch.toast.finished'));
|
||||
@@ -110,7 +129,17 @@ export function BatchPanel({ format, options, open, onOpenChange }: BatchPanelPr
|
||||
setProcessing(false);
|
||||
setAbortController(null);
|
||||
}
|
||||
}, [format, items, itemOrder, options, setAbortController, setProcessing, t, updateItem]);
|
||||
}, [
|
||||
direction,
|
||||
format,
|
||||
items,
|
||||
itemOrder,
|
||||
options,
|
||||
setAbortController,
|
||||
setProcessing,
|
||||
t,
|
||||
updateItem,
|
||||
]);
|
||||
|
||||
const handleCancel = useCallback(() => {
|
||||
useBatchStore.getState().abortController?.abort();
|
||||
@@ -120,7 +149,7 @@ export function BatchPanel({ format, options, open, onOpenChange }: BatchPanelPr
|
||||
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);
|
||||
const { blob, fileCount } = await zipOutputs(done, format, direction);
|
||||
const ts = new Date().toISOString().slice(0, 10);
|
||||
const filename = `jsonprism-batch-${ts}.zip`;
|
||||
if (isTauri()) {
|
||||
@@ -135,7 +164,7 @@ export function BatchPanel({ format, options, open, onOpenChange }: BatchPanelPr
|
||||
} catch (err) {
|
||||
toast.error(t('batch.toast.zip_failed', { message: (err as Error).message }));
|
||||
}
|
||||
}, [format, items, itemOrder, t]);
|
||||
}, [direction, format, items, itemOrder, t]);
|
||||
|
||||
const handleOpenFiles = async () => {
|
||||
if (isTauri()) {
|
||||
@@ -200,7 +229,7 @@ export function BatchPanel({ format, options, open, onOpenChange }: BatchPanelPr
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept=".json,.txt,application/json"
|
||||
accept={fileInputAccept}
|
||||
multiple
|
||||
className="hidden"
|
||||
onChange={onFileInputChange}
|
||||
@@ -253,7 +282,7 @@ export function BatchPanel({ format, options, open, onOpenChange }: BatchPanelPr
|
||||
<BatchItemRow
|
||||
key={id}
|
||||
item={item}
|
||||
outputExt={getConverter(format).meta.extension}
|
||||
outputExt={isReverse ? 'json' : converter.meta.extension}
|
||||
onRemove={() => removeItem(id)}
|
||||
disabled={processing}
|
||||
/>
|
||||
|
||||
@@ -201,6 +201,7 @@ export function ConverterWorkspace() {
|
||||
<ShapeHint shape={shape} />
|
||||
<BatchPanel
|
||||
format={format}
|
||||
direction={direction}
|
||||
options={currentOptions}
|
||||
open={batchOpen}
|
||||
onOpenChange={setBatchOpen}
|
||||
@@ -223,6 +224,8 @@ export function ConverterWorkspace() {
|
||||
value={input}
|
||||
onChange={setInput}
|
||||
error={inputError}
|
||||
format={format}
|
||||
direction={direction}
|
||||
onMultiFileDrop={handleMultiFileDrop}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,25 +1,62 @@
|
||||
import { useCallback, useRef, useState } from 'react';
|
||||
import { useCallback, useMemo, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useDropzone } from 'react-dropzone';
|
||||
import { Eraser, FileText, FolderOpen } from 'lucide-react';
|
||||
import { toast } from '@/components/ui/sonner';
|
||||
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 } from './CodeEditor';
|
||||
import type { Direction } from './DirectionToggle';
|
||||
|
||||
interface InputPanelProps {
|
||||
value: string;
|
||||
onChange: (v: string) => void;
|
||||
error?: string | null;
|
||||
/** Drives accept list, file picker filter, and editor label. */
|
||||
format: FormatId;
|
||||
/** Forward = JSON-only; reverse = the format's native extension. */
|
||||
direction: Direction;
|
||||
/** Called when 2+ files are dropped — workspace routes them into batch. */
|
||||
onMultiFileDrop?: (files: File[]) => void;
|
||||
}
|
||||
|
||||
export function InputPanel({ value, onChange, error, onMultiFileDrop }: InputPanelProps) {
|
||||
export function InputPanel({
|
||||
value,
|
||||
onChange,
|
||||
error,
|
||||
format,
|
||||
direction,
|
||||
onMultiFileDrop,
|
||||
}: InputPanelProps) {
|
||||
const { t } = useTranslation();
|
||||
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 inputLabel = isReverse
|
||||
? t('home.input_label_format', { format: t(converter.meta.labelKey) })
|
||||
: t('home.input_label');
|
||||
|
||||
const onDrop = useCallback(
|
||||
(acceptedFiles: File[]) => {
|
||||
setDragActive(false);
|
||||
@@ -46,7 +83,7 @@ export function InputPanel({ value, onChange, error, onMultiFileDrop }: InputPan
|
||||
onDrop,
|
||||
onDragEnter: () => setDragActive(true),
|
||||
onDragLeave: () => setDragActive(false),
|
||||
accept: { 'application/json': ['.json'], 'text/plain': ['.txt'] },
|
||||
accept,
|
||||
multiple: true,
|
||||
noClick: true,
|
||||
noKeyboard: true,
|
||||
@@ -92,7 +129,7 @@ export function InputPanel({ value, onChange, error, onMultiFileDrop }: InputPan
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept=".json,.txt,application/json"
|
||||
accept={fileInputAccept}
|
||||
className="hidden"
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
@@ -100,7 +137,7 @@ export function InputPanel({ value, onChange, error, onMultiFileDrop }: InputPan
|
||||
<div className="border-border/60 flex items-center justify-between border-b px-3 py-2">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<span className="text-muted-foreground text-xs font-medium tracking-wider uppercase">
|
||||
{t('home.input_label')}
|
||||
{inputLabel}
|
||||
</span>
|
||||
{error && (
|
||||
<span className="text-destructive max-w-md truncate text-xs" title={error}>
|
||||
@@ -114,11 +151,13 @@ export function InputPanel({ value, onChange, error, onMultiFileDrop }: InputPan
|
||||
label={t('home.open_file')}
|
||||
icon={<FolderOpen className="h-3.5 w-3.5" />}
|
||||
/>
|
||||
<ToolbarButton
|
||||
onClick={() => onChange(SAMPLE_JSON)}
|
||||
label={t('home.load_sample')}
|
||||
icon={<FileText className="h-3.5 w-3.5" />}
|
||||
/>
|
||||
{!isReverse && (
|
||||
<ToolbarButton
|
||||
onClick={() => onChange(SAMPLE_JSON)}
|
||||
label={t('home.load_sample')}
|
||||
icon={<FileText className="h-3.5 w-3.5" />}
|
||||
/>
|
||||
)}
|
||||
<ToolbarButton
|
||||
onClick={() => onChange('')}
|
||||
label={t('home.clear')}
|
||||
@@ -132,7 +171,7 @@ export function InputPanel({ value, onChange, error, onMultiFileDrop }: InputPan
|
||||
<CodeEditor
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
language="json"
|
||||
language={isReverse ? 'plain' : 'json'}
|
||||
placeholder={t('home.input_placeholder')}
|
||||
/>
|
||||
{showOverlay && (
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"home": {
|
||||
"input_label": "Input JSON",
|
||||
"input_label_format": "Input {{format}}",
|
||||
"input_placeholder": "Paste your JSON here, drop files, or load a sample…",
|
||||
"output_label": "Output",
|
||||
"output_empty": "Output will appear here once you provide valid JSON.",
|
||||
@@ -226,8 +227,46 @@
|
||||
"title": "About JSONPrism",
|
||||
"lead": "A refracting tool for developers.",
|
||||
"p1": "JSONPrism takes a single JSON input and disperses it into many target formats — like white light through a prism. Everything runs client-side, so your data never leaves your device.",
|
||||
"p2": "Built with React 19, Vite 6, Tailwind CSS v4, and shadcn/ui. Source on GitHub.",
|
||||
"version": "Version {{version}}"
|
||||
"p2": "Built with React 19, Vite 8, Tailwind CSS v4, and shadcn/ui. Source on GitHub.",
|
||||
"version": "Version {{version}}",
|
||||
"donate": {
|
||||
"title": "Support the project",
|
||||
"lead": "JSONPrism is free and open-source. If it saved you time, consider sponsoring the maintainer.",
|
||||
"github": "GitHub Sponsors",
|
||||
"ko_fi": "Ko-fi",
|
||||
"buy_me_a_coffee": "Buy Me a Coffee",
|
||||
"patreon": "Patreon",
|
||||
"paypal": "PayPal"
|
||||
},
|
||||
"third_party": {
|
||||
"title": "Built on open source",
|
||||
"lead": "JSONPrism stands on the shoulders of many great projects:",
|
||||
"ui": "UI framework",
|
||||
"editor": "Code editor",
|
||||
"parsers": "Parsers & serializers",
|
||||
"build": "Build & tooling",
|
||||
"tauri": "Desktop (Tauri)",
|
||||
"i18n": "Internationalization",
|
||||
"see_full_list": "See the full list →"
|
||||
},
|
||||
"build": {
|
||||
"title": "Build info",
|
||||
"version": "Version",
|
||||
"commit": "Commit",
|
||||
"date": "Built on"
|
||||
},
|
||||
"links": {
|
||||
"title": "Links",
|
||||
"repo": "Source code",
|
||||
"issues": "Report a bug",
|
||||
"discussions": "Discussions",
|
||||
"demo": "Live demo",
|
||||
"license": "License (Apache 2.0)"
|
||||
},
|
||||
"disclaimer": {
|
||||
"title": "Disclaimer",
|
||||
"body": "JSONPrism is a one-person, AI-assisted project. No warranty. Translations are AI-generated. See DISCLAIMER.md for details."
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
"loading": "Loading…",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"home": {
|
||||
"input_label": "JSON 入力",
|
||||
"input_label_format": "{{format}} 入力",
|
||||
"input_placeholder": "ここに JSON を貼り付け、ファイルをドロップ、またはサンプルを読み込み…",
|
||||
"output_label": "出力",
|
||||
"output_empty": "有効な JSON を入力すると、ここに出力が表示されます。",
|
||||
@@ -226,8 +227,46 @@
|
||||
"title": "JSONPrism について",
|
||||
"lead": "開発者のための分光ツール。",
|
||||
"p1": "JSONPrism は単一の JSON 入力を受け取り、プリズムを通る白色光のように様々なターゲット形式に分散します。すべての処理はクライアントサイドで行われ、データは端末から外に出ません。",
|
||||
"p2": "React 19、Vite 6、Tailwind CSS v4、shadcn/ui で構築。ソースコードは GitHub で公開しています。",
|
||||
"version": "バージョン {{version}}"
|
||||
"p2": "React 19、Vite 8、Tailwind CSS v4、shadcn/ui で構築。ソースコードは GitHub で公開しています。",
|
||||
"version": "バージョン {{version}}",
|
||||
"donate": {
|
||||
"title": "プロジェクトを支援",
|
||||
"lead": "JSONPrism は無料のオープンソースです。役に立った場合はメンテナーをスポンサーすることをご検討ください。",
|
||||
"github": "GitHub Sponsors",
|
||||
"ko_fi": "Ko-fi",
|
||||
"buy_me_a_coffee": "Buy Me a Coffee",
|
||||
"patreon": "Patreon",
|
||||
"paypal": "PayPal"
|
||||
},
|
||||
"third_party": {
|
||||
"title": "オープンソースの上に構築",
|
||||
"lead": "JSONPrism は多くの優れたプロジェクトの上に成り立っています:",
|
||||
"ui": "UI フレームワーク",
|
||||
"editor": "コードエディタ",
|
||||
"parsers": "パーサーとシリアライザ",
|
||||
"build": "ビルドとツール",
|
||||
"tauri": "デスクトップ (Tauri)",
|
||||
"i18n": "国際化",
|
||||
"see_full_list": "完全なリストを見る →"
|
||||
},
|
||||
"build": {
|
||||
"title": "ビルド情報",
|
||||
"version": "バージョン",
|
||||
"commit": "コミット",
|
||||
"date": "ビルド日"
|
||||
},
|
||||
"links": {
|
||||
"title": "リンク",
|
||||
"repo": "ソースコード",
|
||||
"issues": "バグ報告",
|
||||
"discussions": "ディスカッション",
|
||||
"demo": "ライブデモ",
|
||||
"license": "ライセンス (Apache 2.0)"
|
||||
},
|
||||
"disclaimer": {
|
||||
"title": "免責事項",
|
||||
"body": "JSONPrism は AI 支援による 1 人プロジェクトです。保証はありません。翻訳は AI 生成です。詳細は DISCLAIMER.md を参照してください。"
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
"loading": "読み込み中…",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"home": {
|
||||
"input_label": "JSON đầu vào",
|
||||
"input_label_format": "Đầu vào {{format}}",
|
||||
"input_placeholder": "Dán JSON vào đây, thả file, hoặc nạp mẫu…",
|
||||
"output_label": "Kết quả",
|
||||
"output_empty": "Kết quả sẽ hiện ở đây khi bạn cung cấp JSON hợp lệ.",
|
||||
@@ -226,8 +227,46 @@
|
||||
"title": "Về JSONPrism",
|
||||
"lead": "Một công cụ tán sắc cho developer.",
|
||||
"p1": "JSONPrism nhận một JSON đầu vào và tán sắc nó ra nhiều định dạng đích — như ánh sáng trắng đi qua lăng kính. Mọi thứ chạy client-side, nên dữ liệu của bạn không bao giờ rời khỏi máy.",
|
||||
"p2": "Xây dựng với React 19, Vite 6, Tailwind CSS v4 và shadcn/ui. Mã nguồn trên GitHub.",
|
||||
"version": "Phiên bản {{version}}"
|
||||
"p2": "Xây dựng với React 19, Vite 8, Tailwind CSS v4 và shadcn/ui. Mã nguồn trên GitHub.",
|
||||
"version": "Phiên bản {{version}}",
|
||||
"donate": {
|
||||
"title": "Ủng hộ project",
|
||||
"lead": "JSONPrism miễn phí và open-source. Nếu nó giúp ích cho bạn, hãy cân nhắc tài trợ maintainer.",
|
||||
"github": "GitHub Sponsors",
|
||||
"ko_fi": "Ko-fi",
|
||||
"buy_me_a_coffee": "Buy Me a Coffee",
|
||||
"patreon": "Patreon",
|
||||
"paypal": "PayPal"
|
||||
},
|
||||
"third_party": {
|
||||
"title": "Đứng trên vai open source",
|
||||
"lead": "JSONPrism được xây dựng trên nhiều project tuyệt vời:",
|
||||
"ui": "UI framework",
|
||||
"editor": "Code editor",
|
||||
"parsers": "Parser & serializer",
|
||||
"build": "Build & tooling",
|
||||
"tauri": "Desktop (Tauri)",
|
||||
"i18n": "Đa ngôn ngữ",
|
||||
"see_full_list": "Xem danh sách đầy đủ →"
|
||||
},
|
||||
"build": {
|
||||
"title": "Thông tin build",
|
||||
"version": "Phiên bản",
|
||||
"commit": "Commit",
|
||||
"date": "Build ngày"
|
||||
},
|
||||
"links": {
|
||||
"title": "Liên kết",
|
||||
"repo": "Mã nguồn",
|
||||
"issues": "Báo bug",
|
||||
"discussions": "Thảo luận",
|
||||
"demo": "Demo trực tuyến",
|
||||
"license": "Giấy phép (Apache 2.0)"
|
||||
},
|
||||
"disclaimer": {
|
||||
"title": "Lưu ý",
|
||||
"body": "JSONPrism là project 1 người, có AI-assisted. Không bảo hành. Bản dịch do AI sinh ra. Xem DISCLAIMER.md để biết thêm chi tiết."
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
"loading": "Đang tải…",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"home": {
|
||||
"input_label": "JSON 输入",
|
||||
"input_label_format": "{{format}} 输入",
|
||||
"input_placeholder": "在此处粘贴 JSON、拖入文件或加载示例…",
|
||||
"output_label": "输出",
|
||||
"output_empty": "提供有效的 JSON 后,输出将显示在此处。",
|
||||
@@ -226,8 +227,46 @@
|
||||
"title": "关于 JSONPrism",
|
||||
"lead": "为开发者打造的分光工具。",
|
||||
"p1": "JSONPrism 接收单份 JSON 输入,并像白光穿过棱镜一样将其分散为多种目标格式。一切都在客户端完成,数据不会离开你的设备。",
|
||||
"p2": "使用 React 19、Vite 6、Tailwind CSS v4 与 shadcn/ui 构建。源码在 GitHub。",
|
||||
"version": "版本 {{version}}"
|
||||
"p2": "使用 React 19、Vite 8、Tailwind CSS v4 与 shadcn/ui 构建。源码在 GitHub。",
|
||||
"version": "版本 {{version}}",
|
||||
"donate": {
|
||||
"title": "支持本项目",
|
||||
"lead": "JSONPrism 免费且开源。如果它为你节省了时间,欢迎赞助维护者。",
|
||||
"github": "GitHub Sponsors",
|
||||
"ko_fi": "Ko-fi",
|
||||
"buy_me_a_coffee": "Buy Me a Coffee",
|
||||
"patreon": "Patreon",
|
||||
"paypal": "PayPal"
|
||||
},
|
||||
"third_party": {
|
||||
"title": "构建于开源之上",
|
||||
"lead": "JSONPrism 站在众多优秀项目的肩膀上:",
|
||||
"ui": "UI 框架",
|
||||
"editor": "代码编辑器",
|
||||
"parsers": "解析与序列化",
|
||||
"build": "构建与工具链",
|
||||
"tauri": "桌面端 (Tauri)",
|
||||
"i18n": "国际化",
|
||||
"see_full_list": "查看完整列表 →"
|
||||
},
|
||||
"build": {
|
||||
"title": "构建信息",
|
||||
"version": "版本",
|
||||
"commit": "Commit",
|
||||
"date": "构建日期"
|
||||
},
|
||||
"links": {
|
||||
"title": "链接",
|
||||
"repo": "源代码",
|
||||
"issues": "反馈 bug",
|
||||
"discussions": "讨论区",
|
||||
"demo": "在线演示",
|
||||
"license": "许可证 (Apache 2.0)"
|
||||
},
|
||||
"disclaimer": {
|
||||
"title": "免责声明",
|
||||
"body": "JSONPrism 是 1 人 + AI 协助的项目。不提供任何保证。译文由 AI 生成。详情参见 DISCLAIMER.md。"
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
"loading": "加载中…",
|
||||
|
||||
+47
-11
@@ -3,6 +3,7 @@ import { getConverter } from '@/converters/registry';
|
||||
import type { FormatId } from '@/converters/types';
|
||||
import { parseJsonInput } from './detect';
|
||||
import type { BatchItem } from '@/stores/batchStore';
|
||||
import type { Direction } from '@/components/converter/DirectionToggle';
|
||||
|
||||
export interface ProcessingCallbacks {
|
||||
onUpdate(id: string, patch: Partial<BatchItem>): void;
|
||||
@@ -44,6 +45,7 @@ export async function processBatch(
|
||||
options: unknown,
|
||||
callbacks: ProcessingCallbacks,
|
||||
signal: AbortSignal,
|
||||
direction: Direction = 'forward',
|
||||
): Promise<void> {
|
||||
const converter = getConverter(format);
|
||||
if (!converter.meta.ready) {
|
||||
@@ -56,6 +58,17 @@ export async function processBatch(
|
||||
return;
|
||||
}
|
||||
|
||||
const isReverse = direction === 'reverse';
|
||||
if (isReverse && typeof converter.reverse !== 'function') {
|
||||
for (const item of items) {
|
||||
callbacks.onUpdate(item.id, {
|
||||
status: 'error',
|
||||
error: `Converter "${format}" does not support reverse parsing.`,
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let processed = 0;
|
||||
|
||||
for (const item of items) {
|
||||
@@ -67,16 +80,12 @@ export async function processBatch(
|
||||
const text = await readFileText(item.file);
|
||||
if (signal.aborted) return;
|
||||
|
||||
const parsed = parseJsonInput(text);
|
||||
if (!parsed.ok) {
|
||||
callbacks.onUpdate(item.id, {
|
||||
status: 'error',
|
||||
error: parsed.error === 'empty' ? 'Empty file.' : parsed.error,
|
||||
});
|
||||
} else {
|
||||
const result = converter.convert(
|
||||
{ data: parsed.value, rawText: text, sourceName: item.filename },
|
||||
options as Parameters<typeof converter.convert>[1],
|
||||
if (isReverse) {
|
||||
// Reverse mode: skip JSON parsing entirely — feed the raw text into
|
||||
// the format's parser.
|
||||
const result = converter.reverse!(
|
||||
{ text, sourceName: item.filename },
|
||||
options as Parameters<NonNullable<typeof converter.reverse>>[1],
|
||||
);
|
||||
if (result.ok) {
|
||||
const outputSize = new TextEncoder().encode(result.output).length;
|
||||
@@ -88,6 +97,29 @@ export async function processBatch(
|
||||
} else {
|
||||
callbacks.onUpdate(item.id, { status: 'error', error: result.error });
|
||||
}
|
||||
} else {
|
||||
const parsed = parseJsonInput(text);
|
||||
if (!parsed.ok) {
|
||||
callbacks.onUpdate(item.id, {
|
||||
status: 'error',
|
||||
error: parsed.error === 'empty' ? 'Empty file.' : parsed.error,
|
||||
});
|
||||
} else {
|
||||
const result = converter.convert(
|
||||
{ data: parsed.value, rawText: text, sourceName: item.filename },
|
||||
options as Parameters<typeof converter.convert>[1],
|
||||
);
|
||||
if (result.ok) {
|
||||
const outputSize = new TextEncoder().encode(result.output).length;
|
||||
callbacks.onUpdate(item.id, {
|
||||
status: 'done',
|
||||
output: result.output,
|
||||
outputSize,
|
||||
});
|
||||
} else {
|
||||
callbacks.onUpdate(item.id, { status: 'error', error: result.error });
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
callbacks.onUpdate(item.id, { status: 'error', error: (err as Error).message });
|
||||
@@ -134,10 +166,14 @@ export function uniquifyFilenames(names: string[]): string[] {
|
||||
export async function zipOutputs(
|
||||
items: BatchItem[],
|
||||
format: FormatId,
|
||||
direction: Direction = 'forward',
|
||||
): Promise<{ blob: Blob; fileCount: number }> {
|
||||
const converter = getConverter(format);
|
||||
// In reverse mode the outputs are JSON, so they get the .json extension
|
||||
// regardless of which source format the user dropped in.
|
||||
const outputExt = direction === 'reverse' ? 'json' : converter.meta.extension;
|
||||
const done = items.filter((i) => i.status === 'done' && i.output !== undefined);
|
||||
const rawNames = done.map((i) => outputFilename(i.filename, converter.meta.extension));
|
||||
const rawNames = done.map((i) => outputFilename(i.filename, outputExt));
|
||||
const uniqueNames = uniquifyFilenames(rawNames);
|
||||
|
||||
const filesForZip: Record<string, Uint8Array> = {};
|
||||
|
||||
+215
-1
@@ -1,10 +1,96 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ExternalLink, Heart } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const REPO_URL = 'https://github.com/poli0981/jsonprism';
|
||||
|
||||
interface DonatePlatform {
|
||||
key: 'github' | 'ko_fi' | 'buy_me_a_coffee' | 'patreon' | 'paypal';
|
||||
url: string;
|
||||
}
|
||||
|
||||
// Driven by .github/FUNDING.yml — keep in sync with that file.
|
||||
const DONATE: DonatePlatform[] = [
|
||||
{ key: 'github', url: 'https://github.com/sponsors/poli0981' },
|
||||
{ key: 'ko_fi', url: 'https://ko-fi.com/skullmute' },
|
||||
{ key: 'buy_me_a_coffee', url: 'https://www.buymeacoffee.com/skullmute' },
|
||||
{ key: 'patreon', url: 'https://patreon.com/skullmute' },
|
||||
{ key: 'paypal', url: 'https://paypal.me/DungDang212' },
|
||||
];
|
||||
|
||||
interface DepCategory {
|
||||
key: 'ui' | 'editor' | 'parsers' | 'build' | 'tauri' | 'i18n';
|
||||
deps: { name: string; url: string }[];
|
||||
}
|
||||
|
||||
const DEPS: DepCategory[] = [
|
||||
{
|
||||
key: 'ui',
|
||||
deps: [
|
||||
{ name: 'React 19', url: 'https://react.dev/' },
|
||||
{ name: 'Tailwind CSS v4', url: 'https://tailwindcss.com/' },
|
||||
{ name: 'shadcn/ui', url: 'https://ui.shadcn.com/' },
|
||||
{ name: 'Radix UI', url: 'https://www.radix-ui.com/' },
|
||||
{ name: 'lucide-react', url: 'https://lucide.dev/' },
|
||||
{ name: 'sonner', url: 'https://sonner.emilkowal.ski/' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'editor',
|
||||
deps: [
|
||||
{ name: 'CodeMirror 6', url: 'https://codemirror.net/' },
|
||||
{ name: '@uiw/react-codemirror', url: 'https://uiwjs.github.io/react-codemirror/' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'parsers',
|
||||
deps: [
|
||||
{ name: 'PapaParse', url: 'https://www.papaparse.com/' },
|
||||
{ name: 'js-yaml', url: 'https://github.com/nodeca/js-yaml' },
|
||||
{ name: 'smol-toml', url: 'https://github.com/squirrelchat/smol-toml' },
|
||||
{ name: 'fast-xml-parser', url: 'https://github.com/NaturalIntelligence/fast-xml-parser' },
|
||||
{ name: 'bson', url: 'https://github.com/mongodb/js-bson' },
|
||||
{ name: 'cbor-x', url: 'https://github.com/kriszyp/cbor-x' },
|
||||
{ name: '@msgpack/msgpack', url: 'https://msgpack.org/' },
|
||||
{ name: 'fflate', url: 'https://github.com/101arrowz/fflate' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'build',
|
||||
deps: [
|
||||
{ name: 'Vite 8', url: 'https://vite.dev/' },
|
||||
{ name: 'TypeScript', url: 'https://www.typescriptlang.org/' },
|
||||
{ name: 'Vitest', url: 'https://vitest.dev/' },
|
||||
{ name: 'ESLint', url: 'https://eslint.org/' },
|
||||
{ name: 'Prettier', url: 'https://prettier.io/' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'tauri',
|
||||
deps: [
|
||||
{ name: 'Tauri 2', url: 'https://tauri.app/' },
|
||||
{ name: '@tauri-apps/plugin-dialog', url: 'https://tauri.app/' },
|
||||
{ name: '@tauri-apps/plugin-fs', url: 'https://tauri.app/' },
|
||||
{
|
||||
name: 'tauri-plugin-single-instance',
|
||||
url: 'https://crates.io/crates/tauri-plugin-single-instance',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'i18n',
|
||||
deps: [
|
||||
{ name: 'i18next', url: 'https://www.i18next.com/' },
|
||||
{ name: 'react-i18next', url: 'https://react.i18next.com/' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export function About() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-2xl px-6 py-16">
|
||||
<div className="mx-auto max-w-3xl px-6 py-16">
|
||||
<h1 className="font-display text-spectrum mb-4 text-5xl tracking-tight italic">
|
||||
{t('about.title')}
|
||||
</h1>
|
||||
@@ -13,9 +99,137 @@ export function About() {
|
||||
<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>
|
||||
|
||||
{/* 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}/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">
|
||||
<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>
|
||||
|
||||
{/* 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>
|
||||
|
||||
{/* 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>
|
||||
);
|
||||
}
|
||||
|
||||
function LinkRow({ href, label }: { href: string; label: string }) {
|
||||
return (
|
||||
<li>
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="text-muted-foreground hover:text-foreground inline-flex items-center gap-1.5 transition"
|
||||
>
|
||||
<ExternalLink className="h-3.5 w-3.5" />
|
||||
<span>{label}</span>
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
Vendored
+2
@@ -2,3 +2,5 @@
|
||||
|
||||
declare const __APP_VERSION__: string;
|
||||
declare const __IS_TAURI_BUILD__: boolean;
|
||||
declare const __APP_COMMIT__: string;
|
||||
declare const __APP_BUILD_DATE__: string;
|
||||
@@ -1,6 +1,7 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { execSync } from 'node:child_process';
|
||||
import path from 'node:path';
|
||||
import pkg from './package.json';
|
||||
|
||||
@@ -8,6 +9,20 @@ import pkg from './package.json';
|
||||
const isTauriContext = !!process.env.TAURI_ENV_PLATFORM;
|
||||
const tauriHost = process.env.TAURI_DEV_HOST;
|
||||
|
||||
// Resolve commit SHA + build date once per Vite config load. The About page
|
||||
// surfaces these so a deployed build can be traced back to its source.
|
||||
function safeGitSha(): string {
|
||||
try {
|
||||
return execSync('git rev-parse --short HEAD', { stdio: ['ignore', 'pipe', 'ignore'] })
|
||||
.toString()
|
||||
.trim();
|
||||
} catch {
|
||||
return 'dev';
|
||||
}
|
||||
}
|
||||
const appCommit = safeGitSha();
|
||||
const appBuildDate = new Date().toISOString().slice(0, 10);
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig(({ mode }) => ({
|
||||
// Web prod build deploys to /jsonprism/. Tauri bundles serve from '/'.
|
||||
@@ -16,6 +31,8 @@ export default defineConfig(({ mode }) => ({
|
||||
define: {
|
||||
__APP_VERSION__: JSON.stringify(pkg.version),
|
||||
__IS_TAURI_BUILD__: JSON.stringify(isTauriContext),
|
||||
__APP_COMMIT__: JSON.stringify(appCommit),
|
||||
__APP_BUILD_DATE__: JSON.stringify(appBuildDate),
|
||||
},
|
||||
|
||||
plugins: [react(), tailwindcss()],
|
||||
|
||||
@@ -8,6 +8,8 @@ export default defineConfig({
|
||||
define: {
|
||||
__APP_VERSION__: JSON.stringify(pkg.version),
|
||||
__IS_TAURI_BUILD__: 'false',
|
||||
__APP_COMMIT__: '"test"',
|
||||
__APP_BUILD_DATE__: '"1970-01-01"',
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in new issue
Block a user