Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5659c67f4b | ||
|
|
8cecb8019a | ||
|
|
27743986cc | ||
|
|
2d8c416975 | ||
|
|
194050eb7b | ||
|
|
018151711c | ||
|
|
2fbf4cb463 | ||
|
|
5fae62e122 | ||
|
|
8a27c5c969 |
No files matched your search
@@ -52,7 +52,7 @@ jobs:
|
||||
run: npm run build
|
||||
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: dist
|
||||
path: dist
|
||||
|
||||
@@ -41,10 +41,10 @@ jobs:
|
||||
run: cp dist/index.html dist/404.html
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
uses: actions/configure-pages@v6
|
||||
|
||||
- name: Upload Pages artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
uses: actions/upload-pages-artifact@v5
|
||||
with:
|
||||
path: dist
|
||||
|
||||
@@ -58,4 +58,4 @@ jobs:
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
uses: actions/deploy-pages@v5
|
||||
+46
-1
@@ -8,11 +8,56 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
||||
|
||||
No unreleased changes at this time. Future work tracked in `docs/ROADMAP.md` under "Beyond Phase 3".
|
||||
|
||||
## [1.4.0] — 2026-05-14
|
||||
|
||||
### Added — Đợt UI/UX polish: dynamic placeholders, social, reverse highlight expansion, mobile
|
||||
|
||||
- **Dynamic input/output placeholders** in reverse mode. `Paste your JSON here…` and `Output will appear here once you provide valid JSON.` now interpolate the source/target extension: e.g. `Paste your CSV here…`, `Output will appear here once you provide valid YAML.` New i18n keys `home.input_placeholder_format` and `home.output_empty_format` carry `{{ext}}`; the panels resolve `converter.meta.extension.toUpperCase()`. Forward mode keeps the JSON-specific copy.
|
||||
- **"Multi-target formats" slogan** replaces "Eight target formats" in `app.description` across en/vi/ja/zh-CN — copy no longer hard-codes a stale count as new formats land.
|
||||
- **Reverse-mode syntax highlight** widened: Markdown, SQL, TOML, and JSONL now render with proper tokens in the input editor (previously plain text). Adds `@codemirror/lang-markdown`, `@codemirror/lang-sql`, and `@codemirror/legacy-modes` (the latter for TOML via `StreamLanguage.define`). CSV/TSV stay plain — no fitting CodeMirror grammar. All new packs flow into the existing `codemirror` manualChunk; no initial-bundle regression.
|
||||
- **Social links UI**. New `src/components/common/SocialIcons.tsx` houses six inline-SVG brand icons (Discord, X, Bluesky, Mastodon, Telegram, YouTube) since `lucide-react` has no brand glyphs. Footer surfaces the three dev-relevant ones (Discord dev community, X, Bluesky) between app meta and the maintainer credit. About page gains a `Community` section between Donate and Third-party listing all six. New i18n keys `about.community.*` and `social.*` across en/vi/ja/zh-CN.
|
||||
- **Mobile responsiveness polish**. Header's Convert/About nav links no longer hidden below `md:` — always visible, with tighter padding and a smaller brand wordmark on small viewports. Toolbar buttons in `InputPanel` / `OutputPanel` collapse to icon-only on mobile (label moves to `aria-label` / `title`). Workspace input/output panels keep a `min-h-[40vh]` floor on mobile so the stacked layout stays usable. `Home` hero stacks on mobile; `About` page shrinks outer padding; `FormatPicker` chips compact down. No hamburger menu — only two nav links, the drawer pattern wasn't worth its bundle cost.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Input editor mousewheel scroll requiring a click-to-focus**. `.cm-scroller` was set to `scrollbarWidth: 'none'` plus `::-webkit-scrollbar { display: none }`. On at least some Chromium builds, this disengaged the scroll target until the editor was focused — keyboard PageDown also did nothing without focus. Switched to `scrollbarWidth: 'thin'`, an explicit `overflow: 'auto'`, and a themed `::-webkit-scrollbar` thumb. Wheel and PageDown both work without a prior click.
|
||||
|
||||
### Changed
|
||||
|
||||
- **README EN + VI refreshed**. Sync slogan with the in-app copy ("Multi-target formats" / "Đa định dạng đích"). VI README format table catches up with EN: includes BSON / CBOR / MessagePack (Phase 4) and the `Reverse (→ JSON)` column. Tech-stack line bumped from `Vite 6` to `Vite 8` in both files (package.json has been on `^8.0.0`; the About page already reflected this). Both READMEs gain a `Community` section mirroring the in-app links.
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Added `@codemirror/lang-markdown`, `@codemirror/lang-sql`, and `@codemirror/legacy-modes` (all MIT, all `@codemirror/*` so they auto-route into the `codemirror` manualChunk via `vite.config.ts`).
|
||||
|
||||
### Tests
|
||||
|
||||
- No new tests for this UI-polish round. The 193 existing unit tests still pass; the new behaviour is editor/CSS/i18n surface that's better verified manually (DevTools mobile viewport, wheel-scroll without click, per-format placeholder, reverse-mode highlight). Total tests: **193**.
|
||||
|
||||
## [1.3.3] — 2026-05-13
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Tauri native drag-drop / file picker bypassed batch dedup**. v1.3.0–v1.3.2 desktop bundles let users drop the same file into the queue repeatedly without surfacing the `duplicate` toast. Root cause: `fileFromNativePath` constructed `new File([text], name, { type })` without `lastModified`, so the File API defaulted to `Date.now()` on every call; `batchStore`'s dedup key (`name|size|lastModified`) differed across re-drops of the same on-disk file. Fix: stat the file via `@tauri-apps/plugin-fs` and use the real `mtime`, falling back to an FNV-1a hash of the path if `stat()` throws. Bonus: infer `type` from the file extension instead of hard-coding `application/json`. Added the `fs:allow-stat` permission to the default capability.
|
||||
|
||||
### Tests
|
||||
|
||||
- 3 new unit tests for `pathHashAsMillis` in `src/lib/__tests__/tauri.test.ts`. Total tests: **193**.
|
||||
|
||||
### Verified
|
||||
|
||||
- Windows Sandbox (Windows 11): manual smoke test passed — re-dropping the same `.json` file surfaces the `duplicate` toast and keeps the queue at one entry.
|
||||
- Ubuntu 22.04 LTS on a Hyper-V VM: full smoke test passed at 100% (drag-drop dedup, extension filter, batch processing).
|
||||
|
||||
## [1.3.2] — 2026-05-13
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Tauri native drag-drop bypassed the batch extension filter**. v1.3.0/v1.3.1 desktop bundles accepted any file dropped from File Explorer / Finder / Nautilus into the workspace, because `ConverterWorkspace.handleMultiFileDrop` called `batchStore.addFiles` directly — skipping the `direction × format` extension whitelist that the web `react-dropzone` path enforced. Files like `.cs`/`.py` leaked into the queue with no warning. Extracted `src/lib/file-filter.ts` (`getAllowedExtensions` + `extOf` + `filterByExtension`) and routed the Tauri callback, `BatchPanel`, and `InputPanel` through it so the wrong-format toast surfaces in all three entry points.
|
||||
- **Tauri native drag-drop bypassed the batch extension filter** *(misdiagnosis — see note below)*. v1.3.0/v1.3.1 desktop bundles accepted any file dropped from File Explorer / Finder / Nautilus into the workspace, because `ConverterWorkspace.handleMultiFileDrop` called `batchStore.addFiles` directly — skipping the `direction × format` extension whitelist that the web `react-dropzone` path enforced. Files like `.cs`/`.py` leaked into the queue with no warning. Extracted `src/lib/file-filter.ts` (`getAllowedExtensions` + `extOf` + `filterByExtension`) and routed the Tauri callback, `BatchPanel`, and `InputPanel` through it so the wrong-format toast surfaces in all three entry points.
|
||||
|
||||
### Note on root cause
|
||||
|
||||
This release shipped on a misdiagnosis. The user-visible bug they were investigating turned out to be **batch dedup not working under Tauri** (fixed in v1.3.3), not the missing extension filter on the native drag-drop path. The fix in this release is still correct on its own — the Tauri code path *was* missing the wrong-format filter — but it did not change the behaviour the user was actually seeing. Treat v1.3.2 as a defensive hardening that closes a real-but-cosmetic gap; functional impact for end users is negligible.
|
||||
|
||||
### Tests
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
**Disperse JSON into many formats.**
|
||||
|
||||
One JSON input. Eight target formats. Fully in your browser.
|
||||
One JSON input. Multi-target formats. Fully in your browser.
|
||||
|
||||
[](https://github.com/poli0981/jsonPrism/actions/workflows/ci.yml)
|
||||
[](https://github.com/poli0981/jsonPrism/actions/workflows/deploy.yml)
|
||||
@@ -47,7 +47,7 @@ JSONPrism is a refracting tool for developers. It takes a single JSON input and
|
||||
|
||||
## Tech stack
|
||||
|
||||
- **Vite 6** + **React 19** + **TypeScript 5.7**
|
||||
- **Vite 8** + **React 19** + **TypeScript 5.7**
|
||||
- **Tailwind CSS v4** + **shadcn/ui** (New York style, neutral base)
|
||||
- **CodeMirror 6** for the input editor (Phase 1 polish)
|
||||
- **PapaParse**, **js-yaml**, **smol-toml**, **fast-xml-parser** for parsing/serialization
|
||||
@@ -205,6 +205,17 @@ For bug reports and feature requests, use [GitHub Issues](https://github.com/pol
|
||||
| [`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. |
|
||||
|
||||
## Community
|
||||
|
||||
Hang out, ask questions, or follow updates:
|
||||
|
||||
- [Discord — dev community](https://discord.gg/2aNR3aVt)
|
||||
- [X (Twitter) — @SkullMute0011](https://twitter.com/SkullMute0011)
|
||||
- [Bluesky — @skullmute0011.bsky.social](https://bsky.app/profile/skullmute0011.bsky.social)
|
||||
- [Mastodon — @skullmute1122@mastodon.social](https://mastodon.social/@skullmute1122)
|
||||
- [Telegram — @SkullMute0011](https://t.me/SkullMute0011)
|
||||
- [YouTube — @SkullMute](https://youtube.com/@SkullMute)
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Substantial parts of JSONPrism's code, tests, translations, and docs
|
||||
|
||||
+27
-13
@@ -4,7 +4,7 @@
|
||||
|
||||
**Tán sắc JSON ra nhiều định dạng.**
|
||||
|
||||
Một JSON đầu vào. Tám định dạng đích. Chạy hoàn toàn trong trình duyệt.
|
||||
Một JSON đầu vào. Đa định dạng đích. Chạy hoàn toàn trong trình duyệt.
|
||||
|
||||
[](https://github.com/poli0981/jsonPrism/actions/workflows/ci.yml)
|
||||
[](https://github.com/poli0981/jsonPrism/actions/workflows/deploy.yml)
|
||||
@@ -20,17 +20,20 @@ JSONPrism là công cụ "tán sắc" cho developer. Nhận một JSON đầu v
|
||||
|
||||
## Định dạng hỗ trợ
|
||||
|
||||
| Định dạng | Phần mở rộng | Trạng thái |
|
||||
| ----------------- | ------------ | -------------- |
|
||||
| JSONL | `.jsonl` | ✅ Phase 1 |
|
||||
| CSV | `.csv` | ✅ Phase 1 |
|
||||
| TSV | `.tsv` | ✅ Phase 1 |
|
||||
| YAML | `.yaml` | ✅ Phase 1 |
|
||||
| XML | `.xml` | ✅ Phase 2 |
|
||||
| TOML | `.toml` | ✅ Phase 2 |
|
||||
| Bảng Markdown | `.md` | ✅ Phase 2 |
|
||||
| SQL `INSERT` | `.sql` | ✅ Phase 2 |
|
||||
| RESX (.NET) | `.resx` | ✅ Phase 3 |
|
||||
| Định dạng | Phần mở rộng | Trạng thái | Đảo (→ JSON) |
|
||||
| ----------------- | ------------ | -------------- | ------------ |
|
||||
| JSONL | `.jsonl` | ✅ Phase 1 | ✅ |
|
||||
| CSV | `.csv` | ✅ Phase 1 | ✅ |
|
||||
| TSV | `.tsv` | ✅ Phase 1 | ✅ |
|
||||
| YAML | `.yaml` | ✅ Phase 1 | ✅ |
|
||||
| XML | `.xml` | ✅ Phase 2 | — |
|
||||
| TOML | `.toml` | ✅ Phase 2 | ✅ |
|
||||
| Bảng Markdown | `.md` | ✅ Phase 2 | — |
|
||||
| SQL `INSERT` | `.sql` | ✅ Phase 2 | — |
|
||||
| RESX (.NET) | `.resx` | ✅ Phase 3 | ✅ |
|
||||
| BSON | `.bson` | ✅ Phase 4 | — |
|
||||
| CBOR | `.cbor` | ✅ Phase 4 | — |
|
||||
| MessagePack | `.msgpack` | ✅ Phase 4 | — |
|
||||
|
||||
## Tính năng
|
||||
|
||||
@@ -44,7 +47,7 @@ JSONPrism là công cụ "tán sắc" cho developer. Nhận một JSON đầu v
|
||||
|
||||
## Tech stack
|
||||
|
||||
- **Vite 6** + **React 19** + **TypeScript 5.7**
|
||||
- **Vite 8** + **React 19** + **TypeScript 5.7**
|
||||
- **Tailwind CSS v4** + **shadcn/ui** (style New York, base neutral)
|
||||
- **CodeMirror 6** cho editor đầu vào (Phase 1 polish)
|
||||
- **PapaParse**, **js-yaml**, **smol-toml**, **fast-xml-parser** để parse/serialize
|
||||
@@ -202,6 +205,17 @@ Báo bug hoặc đề xuất tính năng tại [GitHub Issues](https://github.co
|
||||
| [`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. |
|
||||
|
||||
## Cộng đồng
|
||||
|
||||
Trò chuyện, hỏi đáp, hoặc theo dõi cập nhật:
|
||||
|
||||
- [Discord — cộng đồng dev](https://discord.gg/2aNR3aVt)
|
||||
- [X (Twitter) — @SkullMute0011](https://twitter.com/SkullMute0011)
|
||||
- [Bluesky — @skullmute0011.bsky.social](https://bsky.app/profile/skullmute0011.bsky.social)
|
||||
- [Mastodon — @skullmute1122@mastodon.social](https://mastodon.social/@skullmute1122)
|
||||
- [Telegram — @SkullMute0011](https://t.me/SkullMute0011)
|
||||
- [YouTube — @SkullMute](https://youtube.com/@SkullMute)
|
||||
|
||||
## 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
|
||||
|
||||
Generated
+131
-2
@@ -1,18 +1,21 @@
|
||||
{
|
||||
"name": "jsonprism",
|
||||
"version": "1.3.2",
|
||||
"version": "1.4.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "jsonprism",
|
||||
"version": "1.3.2",
|
||||
"version": "1.4.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@codemirror/lang-json": "^6.0.0",
|
||||
"@codemirror/lang-markdown": "^6.5.0",
|
||||
"@codemirror/lang-sql": "^6.10.0",
|
||||
"@codemirror/lang-xml": "^6.1.0",
|
||||
"@codemirror/lang-yaml": "^6.1.3",
|
||||
"@codemirror/language": "^6.10.0",
|
||||
"@codemirror/legacy-modes": "^6.5.2",
|
||||
"@codemirror/lint": "^6.8.0",
|
||||
"@codemirror/state": "^6.4.0",
|
||||
"@codemirror/view": "^6.34.0",
|
||||
@@ -337,6 +340,51 @@
|
||||
"@lezer/common": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-css": {
|
||||
"version": "6.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-css/-/lang-css-6.3.1.tgz",
|
||||
"integrity": "sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.0.0",
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@lezer/common": "^1.0.2",
|
||||
"@lezer/css": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-html": {
|
||||
"version": "6.4.11",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-html/-/lang-html-6.4.11.tgz",
|
||||
"integrity": "sha512-9NsXp7Nwp891pQchI7gPdTwBuSuT3K65NGTHWHNJ55HjYcHLllr0rbIZNdOzas9ztc1EUVBlHou85FFZS4BNnw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.0.0",
|
||||
"@codemirror/lang-css": "^6.0.0",
|
||||
"@codemirror/lang-javascript": "^6.0.0",
|
||||
"@codemirror/language": "^6.4.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.17.0",
|
||||
"@lezer/common": "^1.0.0",
|
||||
"@lezer/css": "^1.1.0",
|
||||
"@lezer/html": "^1.3.12"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-javascript": {
|
||||
"version": "6.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.2.5.tgz",
|
||||
"integrity": "sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.0.0",
|
||||
"@codemirror/language": "^6.6.0",
|
||||
"@codemirror/lint": "^6.0.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.17.0",
|
||||
"@lezer/common": "^1.0.0",
|
||||
"@lezer/javascript": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-json": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-json/-/lang-json-6.0.2.tgz",
|
||||
@@ -347,6 +395,35 @@
|
||||
"@lezer/json": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-markdown": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-markdown/-/lang-markdown-6.5.0.tgz",
|
||||
"integrity": "sha512-0K40bZ35jpHya6FriukbgaleaqzBLZfOh7HuzqbMxBXkbYMJDxfF39c23xOgxFezR+3G+tR2/Mup+Xk865OMvw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.7.1",
|
||||
"@codemirror/lang-html": "^6.0.0",
|
||||
"@codemirror/language": "^6.3.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.0.0",
|
||||
"@lezer/common": "^1.2.1",
|
||||
"@lezer/markdown": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-sql": {
|
||||
"version": "6.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-sql/-/lang-sql-6.10.0.tgz",
|
||||
"integrity": "sha512-6ayPkEd/yRw0XKBx5uAiToSgGECo/GY2NoJIHXIIQh1EVwLuKoU8BP/qK0qH5NLXAbtJRLuT73hx7P9X34iO4w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.0.0",
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@lezer/common": "^1.2.0",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-xml": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-xml/-/lang-xml-6.1.0.tgz",
|
||||
@@ -390,6 +467,15 @@
|
||||
"style-mod": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/legacy-modes": {
|
||||
"version": "6.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/legacy-modes/-/legacy-modes-6.5.2.tgz",
|
||||
"integrity": "sha512-/jJbwSTazlQEDOQw2FJ8LEEKVS72pU0lx6oM54kGpL8t/NJ2Jda3CZ4pcltiKTdqYSRk3ug1B3pil1gsjA6+8Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lint": {
|
||||
"version": "6.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.9.6.tgz",
|
||||
@@ -903,6 +989,17 @@
|
||||
"integrity": "sha512-sxQE460fPZyU3sdc8lafxiPwJHBzZRy/udNFynGQky1SePYBdhkBl1kOagA9uT3pxR8K09bOrmTUqA9wb/PjSQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@lezer/css": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/css/-/css-1.3.3.tgz",
|
||||
"integrity": "sha512-RzBo8r+/6QJeow7aPHIpGVIH59xTcJXp399820gZoMo9noQDRVpJLheIBUicYwKcsbOYoBRoLZlf2720dG/4Tg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@lezer/common": "^1.2.0",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/highlight": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.3.tgz",
|
||||
@@ -912,6 +1009,28 @@
|
||||
"@lezer/common": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/html": {
|
||||
"version": "1.3.13",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/html/-/html-1.3.13.tgz",
|
||||
"integrity": "sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@lezer/common": "^1.2.0",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/javascript": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.5.4.tgz",
|
||||
"integrity": "sha512-vvYx3MhWqeZtGPwDStM2dwgljd5smolYD2lR2UyFcHfxbBQebqx8yjmFmxtJ/E6nN6u1D9srOiVWm3Rb4tmcUA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@lezer/common": "^1.2.0",
|
||||
"@lezer/highlight": "^1.1.3",
|
||||
"@lezer/lr": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/json": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/json/-/json-1.0.3.tgz",
|
||||
@@ -932,6 +1051,16 @@
|
||||
"@lezer/common": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/markdown": {
|
||||
"version": "1.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/markdown/-/markdown-1.6.3.tgz",
|
||||
"integrity": "sha512-jpGm5Ps+XErS+xA4urw7ogEGkeZOahVQF21Z6oECF0sj+2liwZopd2+I8uH5I/vZsRuuze3OxBREIANLf6KKUw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@lezer/common": "^1.5.0",
|
||||
"@lezer/highlight": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/xml": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/xml/-/xml-1.0.6.tgz",
|
||||
|
||||
+4
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jsonprism",
|
||||
"private": true,
|
||||
"version": "1.3.2",
|
||||
"version": "1.4.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>",
|
||||
@@ -34,9 +34,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@codemirror/lang-json": "^6.0.0",
|
||||
"@codemirror/lang-markdown": "^6.5.0",
|
||||
"@codemirror/lang-sql": "^6.10.0",
|
||||
"@codemirror/lang-xml": "^6.1.0",
|
||||
"@codemirror/lang-yaml": "^6.1.3",
|
||||
"@codemirror/language": "^6.10.0",
|
||||
"@codemirror/legacy-modes": "^6.5.2",
|
||||
"@codemirror/lint": "^6.8.0",
|
||||
"@codemirror/state": "^6.4.0",
|
||||
"@codemirror/view": "^6.34.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "jsonprism"
|
||||
version = "1.3.2"
|
||||
version = "1.4.0"
|
||||
description = "Disperse JSON into many formats."
|
||||
authors = ["poli0981 <https://github.com/poli0981>"]
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"fs:allow-read-text-file",
|
||||
"fs:allow-write-text-file",
|
||||
"fs:allow-write-file",
|
||||
"fs:allow-stat",
|
||||
{
|
||||
"identifier": "fs:scope",
|
||||
"allow": ["$HOME/**", "$DOCUMENT/**", "$DOWNLOAD/**", "$DESKTOP/**"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "JSONPrism",
|
||||
"version": "1.3.2",
|
||||
"version": "1.4.0",
|
||||
"identifier": "com.poli0981.jsonprism",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
interface IconProps {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function DiscordIcon({ className }: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" className={className} aria-hidden>
|
||||
<path d="M20.317 4.369A19.79 19.79 0 0 0 16.558 3.2a.074.074 0 0 0-.079.037c-.34.6-.719 1.385-.984 2.001a18.27 18.27 0 0 0-5.487 0 12.5 12.5 0 0 0-.997-2.001.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 5.18 4.369a.07.07 0 0 0-.032.027C2.39 8.523 1.64 12.572 2.005 16.573a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.077.077 0 0 0 .084-.028c.462-.63.873-1.295 1.226-1.994a.076.076 0 0 0-.041-.105 13.1 13.1 0 0 1-1.872-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.371-.291a.074.074 0 0 1 .078-.01c3.927 1.793 8.18 1.793 12.061 0a.074.074 0 0 1 .079.009c.12.099.245.198.372.292a.077.077 0 0 1-.006.128 12.3 12.3 0 0 1-1.873.891.077.077 0 0 0-.041.106c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.029 19.84 19.84 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-4.79-.838-8.806-3.548-12.179a.061.061 0 0 0-.031-.028zM8.02 14.331c-1.182 0-2.157-1.085-2.157-2.42 0-1.333.956-2.418 2.157-2.418 1.21 0 2.176 1.094 2.157 2.419 0 1.334-.956 2.42-2.157 2.42zm7.974 0c-1.182 0-2.157-1.085-2.157-2.42 0-1.333.955-2.418 2.157-2.418 1.21 0 2.176 1.094 2.157 2.419 0 1.334-.946 2.42-2.157 2.42z" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export function XIcon({ className }: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" className={className} aria-hidden>
|
||||
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export function BlueskyIcon({ className }: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" className={className} aria-hidden>
|
||||
<path
|
||||
d="M5.918 4.55C8.93 6.84 12.171 11.482 13.36 13.97c1.187-2.488 4.43-7.13 7.44-9.42 2.173-1.652 5.696-2.93 5.696 1.116 0 .808-.46 6.788-.732 7.76-.94 3.379-4.358 4.24-7.4 3.717 5.318.918 6.671 3.94 3.748 6.96-5.55 5.74-7.974-1.44-8.596-3.281-.114-.337-.167-.495-.167-.361 0-.134-.053.024-.167.361-.621 1.841-3.046 9.022-8.595 3.281-2.923-3.02-1.571-6.042 3.748-6.96-3.043.523-6.46-.338-7.4-3.717C.265 12.454-.196 6.474-.196 5.666c0-4.046 3.523-2.768 5.696-1.116l.418.001-.001.001z"
|
||||
transform="translate(0.196 0)"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export function MastodonIcon({ className }: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" className={className} aria-hidden>
|
||||
<path d="M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.673-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054c1.517.363 3.072.546 4.632.546.376 0 .75 0 1.125-.01 1.57-.044 3.224-.124 4.768-.422.038-.008.077-.015.11-.024 2.435-.464 4.753-1.92 4.989-5.604.008-.145.03-1.52.03-1.67.002-.512.167-3.63-.024-5.545zm-3.748 9.195h-2.561V8.29c0-1.309-.55-1.976-1.67-1.976-1.23 0-1.846.79-1.846 2.35v3.403h-2.546V8.663c0-1.56-.617-2.35-1.848-2.35-1.112 0-1.668.668-1.67 1.977v6.218H4.822V8.102c0-1.31.337-2.35 1.011-3.12.696-.77 1.608-1.164 2.74-1.164 1.311 0 2.302.5 2.962 1.498l.638 1.06.638-1.06c.66-.999 1.65-1.498 2.96-1.498 1.13 0 2.043.395 2.74 1.164.675.77 1.012 1.81 1.012 3.12z" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export function TelegramIcon({ className }: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" className={className} aria-hidden>
|
||||
<path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export function YoutubeIcon({ className }: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" className={className} aria-hidden>
|
||||
<path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -3,13 +3,16 @@ import CodeMirror, { type ReactCodeMirrorRef, EditorView } from '@uiw/react-code
|
||||
import { json, jsonParseLinter } from '@codemirror/lang-json';
|
||||
import { yaml } from '@codemirror/lang-yaml';
|
||||
import { xml } from '@codemirror/lang-xml';
|
||||
import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
||||
import { markdown } from '@codemirror/lang-markdown';
|
||||
import { sql } from '@codemirror/lang-sql';
|
||||
import { HighlightStyle, StreamLanguage, syntaxHighlighting } from '@codemirror/language';
|
||||
import { toml } from '@codemirror/legacy-modes/mode/toml';
|
||||
import { lintGutter, linter } from '@codemirror/lint';
|
||||
import { tags as t } from '@lezer/highlight';
|
||||
import { useTheme } from '@/lib/theme';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
export type EditorLanguage = 'json' | 'plain' | 'yaml' | 'xml';
|
||||
export type EditorLanguage = 'json' | 'plain' | 'yaml' | 'xml' | 'markdown' | 'sql' | 'toml';
|
||||
|
||||
interface CodeEditorProps {
|
||||
value: string;
|
||||
@@ -57,6 +60,12 @@ export function CodeEditor({
|
||||
exts.push(yaml());
|
||||
} else if (language === 'xml') {
|
||||
exts.push(xml());
|
||||
} else if (language === 'markdown') {
|
||||
exts.push(markdown());
|
||||
} else if (language === 'sql') {
|
||||
exts.push(sql());
|
||||
} else if (language === 'toml') {
|
||||
exts.push(StreamLanguage.define(toml));
|
||||
}
|
||||
exts.push(syntaxHighlighting(prismHighlightStyle));
|
||||
exts.push(EditorView.lineWrapping);
|
||||
@@ -76,11 +85,18 @@ export function CodeEditor({
|
||||
'.cm-scroller': {
|
||||
fontFamily: 'var(--font-mono)',
|
||||
lineHeight: '1.6',
|
||||
// Hide native scrollbar while keeping wheel/keyboard scroll.
|
||||
scrollbarWidth: 'none',
|
||||
overflow: 'auto',
|
||||
// Show a thin native scrollbar — `scrollbarWidth: 'none'` made wheel
|
||||
// scroll require a click-to-focus first on some browsers.
|
||||
scrollbarWidth: 'thin',
|
||||
},
|
||||
'.cm-scroller::-webkit-scrollbar': {
|
||||
display: 'none',
|
||||
width: '8px',
|
||||
height: '8px',
|
||||
},
|
||||
'.cm-scroller::-webkit-scrollbar-thumb': {
|
||||
backgroundColor: 'color-mix(in oklch, var(--muted-foreground) 30%, transparent)',
|
||||
borderRadius: '4px',
|
||||
},
|
||||
'.cm-content': {
|
||||
padding: '16px 0',
|
||||
|
||||
@@ -216,7 +216,7 @@ export function ConverterWorkspace() {
|
||||
|
||||
<div className="border-border bg-card/40 flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border">
|
||||
<div className="grid min-h-0 flex-1 md:grid-cols-2">
|
||||
<div className="md:border-border/60 min-h-0 border-b md:border-r md:border-b-0">
|
||||
<div className="md:border-border/60 min-h-[40vh] border-b md:min-h-0 md:border-r md:border-b-0">
|
||||
<InputPanel
|
||||
value={input}
|
||||
onChange={setInput}
|
||||
@@ -226,7 +226,7 @@ export function ConverterWorkspace() {
|
||||
onMultiFileDrop={handleMultiFileDrop}
|
||||
/>
|
||||
</div>
|
||||
<div className="min-h-0">
|
||||
<div className="min-h-[40vh] md:min-h-0">
|
||||
<OutputPanel
|
||||
format={format}
|
||||
content={output}
|
||||
|
||||
@@ -35,7 +35,7 @@ export function FormatPicker({ value, onChange, shape, direction = 'forward' }:
|
||||
onClick={() => onChange(id)}
|
||||
disabled={!enabled}
|
||||
className={cn(
|
||||
'group relative inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition',
|
||||
'group relative inline-flex items-center gap-1.5 rounded-md border px-2 py-0.5 text-[11px] font-medium transition sm:px-2.5 sm:py-1 sm:text-xs',
|
||||
active
|
||||
? 'border-primary/60 bg-primary/10 text-foreground'
|
||||
: 'border-border bg-card/40 text-muted-foreground hover:text-foreground hover:border-border',
|
||||
|
||||
@@ -65,6 +65,10 @@ export function InputPanel({
|
||||
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]);
|
||||
|
||||
@@ -218,7 +222,13 @@ export function InputPanel({
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
language={editorLanguage}
|
||||
placeholder={t('home.input_placeholder')}
|
||||
placeholder={
|
||||
isReverse
|
||||
? t('home.input_placeholder_format', {
|
||||
ext: converter.meta.extension.toUpperCase(),
|
||||
})
|
||||
: t('home.input_placeholder')
|
||||
}
|
||||
/>
|
||||
{showOverlay && (
|
||||
<div className="bg-background/80 pointer-events-none absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm">
|
||||
@@ -257,10 +267,12 @@ function ToolbarButton({ onClick, label, icon, disabled }: ToolbarButtonProps) {
|
||||
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>{label}</span>
|
||||
<span className="hidden sm:inline">{label}</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -109,7 +109,11 @@ export function OutputPanel({
|
||||
</pre>
|
||||
) : (
|
||||
<div className="text-muted-foreground/60 p-4 text-sm italic">
|
||||
{t('home.output_empty')}
|
||||
{isReverse
|
||||
? t('home.output_empty_format', {
|
||||
ext: converter.meta.extension.toUpperCase(),
|
||||
})
|
||||
: t('home.output_empty')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -130,10 +134,12 @@ function ToolbarButton({ onClick, label, icon, disabled }: ToolbarButtonProps) {
|
||||
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>{label}</span>
|
||||
<span className="hidden sm:inline">{label}</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,32 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { BlueskyIcon, DiscordIcon, XIcon } from '@/components/common/SocialIcons';
|
||||
|
||||
export function Footer() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<footer className="border-border/60 text-muted-foreground border-t px-6 py-6 text-xs">
|
||||
<div className="mx-auto flex max-w-screen-2xl flex-col items-center justify-between gap-2 sm:flex-row">
|
||||
<div className="mx-auto flex max-w-screen-2xl flex-col items-center justify-between gap-3 sm:flex-row sm:gap-2">
|
||||
<div>
|
||||
<span className="font-mono">JSONPrism</span> · v{__APP_VERSION__} · Apache-2.0
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<SocialLink
|
||||
href="https://discord.gg/2aNR3aVt"
|
||||
label={t('social.discord')}
|
||||
icon={<DiscordIcon className="h-3.5 w-3.5" />}
|
||||
/>
|
||||
<SocialLink
|
||||
href="https://twitter.com/SkullMute0011"
|
||||
label={t('social.x')}
|
||||
icon={<XIcon className="h-3.5 w-3.5" />}
|
||||
/>
|
||||
<SocialLink
|
||||
href="https://bsky.app/profile/skullmute0011.bsky.social"
|
||||
label={t('social.bluesky')}
|
||||
icon={<BlueskyIcon className="h-3.5 w-3.5" />}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span>Built by</span>
|
||||
<a
|
||||
@@ -20,3 +42,24 @@ export function Footer() {
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
interface SocialLinkProps {
|
||||
href: string;
|
||||
label: string;
|
||||
icon: React.ReactNode;
|
||||
}
|
||||
|
||||
function SocialLink({ href, label, icon }: SocialLinkProps) {
|
||||
return (
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
aria-label={label}
|
||||
title={label}
|
||||
className="hover:text-foreground inline-flex h-7 w-7 items-center justify-center rounded transition"
|
||||
>
|
||||
{icon}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
@@ -10,15 +10,15 @@ export function Header() {
|
||||
|
||||
return (
|
||||
<header className="border-border/60 bg-background/80 sticky top-0 z-40 border-b backdrop-blur-md">
|
||||
<div className="mx-auto flex h-14 max-w-screen-2xl items-center gap-6 px-6">
|
||||
<Link to="/" className="group flex items-center gap-2.5">
|
||||
<BrandMark className="h-7 w-7" />
|
||||
<span className="font-display text-xl leading-none tracking-tight">
|
||||
<div className="mx-auto flex h-14 max-w-screen-2xl items-center gap-2 px-3 sm:gap-6 sm:px-6">
|
||||
<Link to="/" className="group flex items-center gap-2 sm:gap-2.5">
|
||||
<BrandMark className="h-6 w-6 sm:h-7 sm:w-7" />
|
||||
<span className="font-display text-base leading-none tracking-tight sm:text-xl">
|
||||
JSON<span className="text-spectrum italic">Prism</span>
|
||||
</span>
|
||||
</Link>
|
||||
|
||||
<nav className="ml-6 hidden gap-1 md:flex">
|
||||
<nav className="flex gap-0.5 md:ml-6 md:gap-1">
|
||||
<NavItem to="/" end>
|
||||
{t('nav.home')}
|
||||
</NavItem>
|
||||
@@ -56,7 +56,7 @@ function NavItem({ to, end, children }: NavItemProps) {
|
||||
{...(end !== undefined ? { end } : {})}
|
||||
className={({ isActive }) =>
|
||||
cn(
|
||||
'inline-flex h-9 items-center rounded-md px-3 text-sm font-medium transition',
|
||||
'inline-flex h-9 items-center rounded-md px-2 text-sm font-medium transition sm:px-3',
|
||||
isActive
|
||||
? 'text-foreground bg-muted/60'
|
||||
: 'text-muted-foreground hover:text-foreground hover:bg-muted/40',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"app": {
|
||||
"name": "JSONPrism",
|
||||
"tagline": "Disperse JSON into many formats",
|
||||
"description": "One JSON input. Eight target formats. Fully in your browser."
|
||||
"description": "One JSON input. Multi-target formats. Fully in your browser."
|
||||
},
|
||||
"nav": {
|
||||
"home": "Convert",
|
||||
@@ -13,8 +13,10 @@
|
||||
"input_label": "Input JSON",
|
||||
"input_label_format": "Input {{format}}",
|
||||
"input_placeholder": "Paste your JSON here, drop files, or load a sample…",
|
||||
"input_placeholder_format": "Paste your {{ext}} here, drop files, or load a sample…",
|
||||
"output_label": "Output",
|
||||
"output_empty": "Output will appear here once you provide valid JSON.",
|
||||
"output_empty_format": "Output will appear here once you provide valid {{ext}}.",
|
||||
"drop_zone": "Drop JSON files here",
|
||||
"drop_zone_active": "Drop to load",
|
||||
"drop_zone_hint": "Up to 500 files. Everything runs in your browser — nothing leaves your device.",
|
||||
@@ -244,6 +246,16 @@
|
||||
"patreon": "Patreon",
|
||||
"paypal": "PayPal"
|
||||
},
|
||||
"community": {
|
||||
"title": "Community & maintainer",
|
||||
"lead": "Follow Kokone or join the JSONPrism dev community:",
|
||||
"discord": "Discord (dev community)",
|
||||
"x": "X (Twitter)",
|
||||
"bluesky": "Bluesky",
|
||||
"mastodon": "Mastodon",
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube"
|
||||
},
|
||||
"third_party": {
|
||||
"title": "Built on open source",
|
||||
"lead": "JSONPrism stands on the shoulders of many great projects:",
|
||||
@@ -281,5 +293,13 @@
|
||||
},
|
||||
"disclaimer": {
|
||||
"translation": "Non-English translations are AI-generated. Accuracy is not guaranteed."
|
||||
},
|
||||
"social": {
|
||||
"discord": "Discord",
|
||||
"x": "X (Twitter)",
|
||||
"bluesky": "Bluesky",
|
||||
"mastodon": "Mastodon",
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube"
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"app": {
|
||||
"name": "JSONPrism",
|
||||
"tagline": "JSON を様々な形式に分散",
|
||||
"description": "JSON 入力ひとつ。ターゲット形式は 8 種類以上。ブラウザ内で完結。"
|
||||
"description": "JSON 入力ひとつ。マルチターゲット形式。ブラウザ内で完結。"
|
||||
},
|
||||
"nav": {
|
||||
"home": "変換",
|
||||
@@ -13,8 +13,10 @@
|
||||
"input_label": "JSON 入力",
|
||||
"input_label_format": "{{format}} 入力",
|
||||
"input_placeholder": "ここに JSON を貼り付け、ファイルをドロップ、またはサンプルを読み込み…",
|
||||
"input_placeholder_format": "ここに {{ext}} を貼り付け、ファイルをドロップ、またはサンプルを読み込み…",
|
||||
"output_label": "出力",
|
||||
"output_empty": "有効な JSON を入力すると、ここに出力が表示されます。",
|
||||
"output_empty_format": "有効な {{ext}} を入力すると、ここに出力が表示されます。",
|
||||
"drop_zone": "JSON ファイルをここにドロップ",
|
||||
"drop_zone_active": "ドロップして読み込み",
|
||||
"drop_zone_hint": "最大 500 ファイル。すべてブラウザ内で処理 — データは端末から外に出ません。",
|
||||
@@ -244,6 +246,16 @@
|
||||
"patreon": "Patreon",
|
||||
"paypal": "PayPal"
|
||||
},
|
||||
"community": {
|
||||
"title": "コミュニティ & メンテナー",
|
||||
"lead": "Kokone をフォローするか、JSONPrism の開発者コミュニティに参加:",
|
||||
"discord": "Discord (開発者コミュニティ)",
|
||||
"x": "X (Twitter)",
|
||||
"bluesky": "Bluesky",
|
||||
"mastodon": "Mastodon",
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube"
|
||||
},
|
||||
"third_party": {
|
||||
"title": "オープンソースの上に構築",
|
||||
"lead": "JSONPrism は多くの優れたプロジェクトの上に成り立っています:",
|
||||
@@ -281,5 +293,13 @@
|
||||
},
|
||||
"disclaimer": {
|
||||
"translation": "このページの翻訳は AI 生成です。100% の正確性は保証されません。"
|
||||
},
|
||||
"social": {
|
||||
"discord": "Discord",
|
||||
"x": "X (Twitter)",
|
||||
"bluesky": "Bluesky",
|
||||
"mastodon": "Mastodon",
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube"
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"app": {
|
||||
"name": "JSONPrism",
|
||||
"tagline": "Tán sắc JSON ra nhiều định dạng",
|
||||
"description": "Một JSON đầu vào. Tám định dạng đích. Chạy hoàn toàn trong trình duyệt."
|
||||
"description": "Một JSON đầu vào. Đa định dạng đích. Chạy hoàn toàn trong trình duyệt."
|
||||
},
|
||||
"nav": {
|
||||
"home": "Chuyển đổi",
|
||||
@@ -13,8 +13,10 @@
|
||||
"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…",
|
||||
"input_placeholder_format": "Dán {{ext}} 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ệ.",
|
||||
"output_empty_format": "Kết quả sẽ hiện ở đây khi bạn cung cấp {{ext}} hợp lệ.",
|
||||
"drop_zone": "Thả file JSON vào đây",
|
||||
"drop_zone_active": "Thả ra để nạp",
|
||||
"drop_zone_hint": "Tối đa 500 file. Mọi thứ chạy trong trình duyệt — không có dữ liệu nào rời khỏi máy của bạn.",
|
||||
@@ -244,6 +246,16 @@
|
||||
"patreon": "Patreon",
|
||||
"paypal": "PayPal"
|
||||
},
|
||||
"community": {
|
||||
"title": "Cộng đồng & maintainer",
|
||||
"lead": "Theo dõi Kokone hoặc tham gia cộng đồng dev JSONPrism:",
|
||||
"discord": "Discord (cộng đồng dev)",
|
||||
"x": "X (Twitter)",
|
||||
"bluesky": "Bluesky",
|
||||
"mastodon": "Mastodon",
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube"
|
||||
},
|
||||
"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:",
|
||||
@@ -281,5 +293,13 @@
|
||||
},
|
||||
"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%."
|
||||
},
|
||||
"social": {
|
||||
"discord": "Discord",
|
||||
"x": "X (Twitter)",
|
||||
"bluesky": "Bluesky",
|
||||
"mastodon": "Mastodon",
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube"
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"app": {
|
||||
"name": "JSONPrism",
|
||||
"tagline": "将 JSON 分散为多种格式",
|
||||
"description": "一份 JSON 输入,八种以上目标格式,全程在浏览器中完成。"
|
||||
"description": "一份 JSON 输入,多目标格式,全程在浏览器中完成。"
|
||||
},
|
||||
"nav": {
|
||||
"home": "转换",
|
||||
@@ -13,8 +13,10 @@
|
||||
"input_label": "JSON 输入",
|
||||
"input_label_format": "{{format}} 输入",
|
||||
"input_placeholder": "在此处粘贴 JSON、拖入文件或加载示例…",
|
||||
"input_placeholder_format": "在此处粘贴 {{ext}}、拖入文件或加载示例…",
|
||||
"output_label": "输出",
|
||||
"output_empty": "提供有效的 JSON 后,输出将显示在此处。",
|
||||
"output_empty_format": "提供有效的 {{ext}} 后,输出将显示在此处。",
|
||||
"drop_zone": "将 JSON 文件拖到此处",
|
||||
"drop_zone_active": "释放即可加载",
|
||||
"drop_zone_hint": "最多 500 个文件。全部在浏览器中运行 — 数据不会离开你的设备。",
|
||||
@@ -244,6 +246,16 @@
|
||||
"patreon": "Patreon",
|
||||
"paypal": "PayPal"
|
||||
},
|
||||
"community": {
|
||||
"title": "社区与维护者",
|
||||
"lead": "关注 Kokone 或加入 JSONPrism 开发者社区:",
|
||||
"discord": "Discord(开发者社区)",
|
||||
"x": "X (Twitter)",
|
||||
"bluesky": "Bluesky",
|
||||
"mastodon": "Mastodon",
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube"
|
||||
},
|
||||
"third_party": {
|
||||
"title": "构建于开源之上",
|
||||
"lead": "JSONPrism 站在众多优秀项目的肩膀上:",
|
||||
@@ -281,5 +293,13 @@
|
||||
},
|
||||
"disclaimer": {
|
||||
"translation": "本页面译文由 AI 生成,不保证 100% 准确。"
|
||||
},
|
||||
"social": {
|
||||
"discord": "Discord",
|
||||
"x": "X (Twitter)",
|
||||
"bluesky": "Bluesky",
|
||||
"mastodon": "Mastodon",
|
||||
"telegram": "Telegram",
|
||||
"youtube": "YouTube"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { pathHashAsMillis } from '../tauri';
|
||||
|
||||
describe('pathHashAsMillis', () => {
|
||||
it('is deterministic for the same input', () => {
|
||||
const a = pathHashAsMillis('C:/Users/me/data.json');
|
||||
const b = pathHashAsMillis('C:/Users/me/data.json');
|
||||
expect(a).toBe(b);
|
||||
});
|
||||
|
||||
it('produces different hashes for different paths', () => {
|
||||
expect(pathHashAsMillis('/a/foo.json')).not.toBe(pathHashAsMillis('/a/bar.json'));
|
||||
expect(pathHashAsMillis('/a/foo.json')).not.toBe(pathHashAsMillis('/b/foo.json'));
|
||||
});
|
||||
|
||||
it('returns a non-negative integer (unsigned 32-bit) even for empty input', () => {
|
||||
const h = pathHashAsMillis('');
|
||||
expect(Number.isInteger(h)).toBe(true);
|
||||
expect(h).toBeGreaterThanOrEqual(0);
|
||||
expect(h).toBeLessThanOrEqual(0xffffffff);
|
||||
});
|
||||
});
|
||||
+49
-1
@@ -70,14 +70,62 @@ export async function nativeReadText(path: string): Promise<string> {
|
||||
return readTextFile(path);
|
||||
}
|
||||
|
||||
// MIME type per extension. Used so File objects created from native paths
|
||||
// carry a sensible `type` instead of being hard-coded to `application/json`.
|
||||
const TYPE_BY_EXT: Record<string, string> = {
|
||||
json: 'application/json',
|
||||
yaml: 'application/x-yaml',
|
||||
yml: 'application/x-yaml',
|
||||
toml: 'application/toml',
|
||||
xml: 'application/xml',
|
||||
csv: 'text/csv',
|
||||
tsv: 'text/tab-separated-values',
|
||||
resx: 'application/xml',
|
||||
txt: 'text/plain',
|
||||
};
|
||||
|
||||
/**
|
||||
* FNV-1a 32-bit hash of a path, returned as an unsigned 32-bit integer.
|
||||
* Used as a stable `lastModified` for File objects when `stat()` is
|
||||
* unavailable — `batchStore` dedups on `(name, size, lastModified)`,
|
||||
* so the value must be deterministic across repeated drops of the same path.
|
||||
*/
|
||||
export function pathHashAsMillis(path: string): number {
|
||||
let h = 0x811c9dc5;
|
||||
for (let i = 0; i < path.length; i += 1) {
|
||||
h ^= path.charCodeAt(i);
|
||||
h = Math.imul(h, 0x01000193);
|
||||
}
|
||||
return h >>> 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a native file path to a browser-style File so the
|
||||
* existing batch store and editor flows can consume it unchanged.
|
||||
*
|
||||
* `lastModified` is read from the file's real mtime via `stat()` so that
|
||||
* re-dropping the same file dedups correctly (batchStore keys on
|
||||
* name|size|lastModified). Falling back to `Date.now()` would break dedup
|
||||
* because every drop produces a fresh timestamp.
|
||||
*/
|
||||
export async function fileFromNativePath(path: string): Promise<File> {
|
||||
const text = await nativeReadText(path);
|
||||
const name = path.replace(/^.*[\\/]/, ''); // basename
|
||||
return new File([text], name, { type: 'application/json' });
|
||||
const ext = (name.split('.').pop() ?? '').toLowerCase();
|
||||
const type = TYPE_BY_EXT[ext] ?? 'application/octet-stream';
|
||||
|
||||
let lastModified: number;
|
||||
try {
|
||||
const { stat } = await import('@tauri-apps/plugin-fs');
|
||||
const info = await stat(path);
|
||||
lastModified = info.mtime ? info.mtime.getTime() : pathHashAsMillis(path);
|
||||
} catch {
|
||||
// Capability missing or file vanished between read + stat — fall back
|
||||
// to a deterministic hash so repeat drops still dedup.
|
||||
lastModified = pathHashAsMillis(path);
|
||||
}
|
||||
|
||||
return new File([text], name, { type, lastModified });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+80
-2
@@ -1,9 +1,56 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ExternalLink, Heart } from 'lucide-react';
|
||||
import { ExternalLink, Heart, Users } from 'lucide-react';
|
||||
import {
|
||||
BlueskyIcon,
|
||||
DiscordIcon,
|
||||
MastodonIcon,
|
||||
TelegramIcon,
|
||||
XIcon,
|
||||
YoutubeIcon,
|
||||
} from '@/components/common/SocialIcons';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const REPO_URL = 'https://github.com/poli0981/jsonPrism';
|
||||
|
||||
interface CommunityPlatform {
|
||||
key: 'discord' | 'x' | 'bluesky' | 'mastodon' | 'telegram' | 'youtube';
|
||||
url: string;
|
||||
icon: React.ReactNode;
|
||||
}
|
||||
|
||||
const COMMUNITY: CommunityPlatform[] = [
|
||||
{
|
||||
key: 'discord',
|
||||
url: 'https://discord.gg/2aNR3aVt',
|
||||
icon: <DiscordIcon className="h-4 w-4" />,
|
||||
},
|
||||
{
|
||||
key: 'x',
|
||||
url: 'https://twitter.com/SkullMute0011',
|
||||
icon: <XIcon className="h-4 w-4" />,
|
||||
},
|
||||
{
|
||||
key: 'bluesky',
|
||||
url: 'https://bsky.app/profile/skullmute0011.bsky.social',
|
||||
icon: <BlueskyIcon className="h-4 w-4" />,
|
||||
},
|
||||
{
|
||||
key: 'mastodon',
|
||||
url: 'https://mastodon.social/@skullmute1122',
|
||||
icon: <MastodonIcon className="h-4 w-4" />,
|
||||
},
|
||||
{
|
||||
key: 'telegram',
|
||||
url: 'https://t.me/SkullMute0011',
|
||||
icon: <TelegramIcon className="h-4 w-4" />,
|
||||
},
|
||||
{
|
||||
key: 'youtube',
|
||||
url: 'https://youtube.com/@SkullMute',
|
||||
icon: <YoutubeIcon className="h-4 w-4" />,
|
||||
},
|
||||
];
|
||||
|
||||
interface DonatePlatform {
|
||||
key: 'github' | 'ko_fi' | 'buy_me_a_coffee' | 'patreon' | 'paypal';
|
||||
url: string;
|
||||
@@ -94,7 +141,7 @@ export function About() {
|
||||
// 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-6 py-16">
|
||||
<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>
|
||||
@@ -132,6 +179,37 @@ export function About() {
|
||||
</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">
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ export function Home() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex min-h-0 w-full max-w-screen-2xl flex-1 flex-col gap-6 px-6 py-6">
|
||||
<header className="flex items-end justify-between gap-6">
|
||||
<div className="mx-auto flex min-h-0 w-full max-w-screen-2xl flex-1 flex-col gap-4 px-4 py-4 sm:gap-6 sm:px-6 sm:py-6">
|
||||
<header className="flex flex-col gap-2 md:flex-row md:items-end md:justify-between md:gap-6">
|
||||
<div>
|
||||
<h1 className="font-display text-4xl leading-none tracking-tight md:text-5xl">
|
||||
<span className="text-spectrum italic">Disperse</span> JSON.
|
||||
|
||||
Reference in new issue
Block a user