13 Commits
Author SHA1 Message Date
poli0981andClaude Opus 4.7 25cac76373 chore(release): v1.4.2 (#49)
Patch release for the mobile-viewport overlap reported after v1.4.1 (#47):
- Tabs UI for Input/Output on mobile (<md); side-by-side grid stays on md+
- Unread-output dot on the Output tab
- Compact FormatPicker — bottom Sheet on mobile instead of 12 chips inline
- README EN + VI disclose minimum viewport (360×640)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 12:50:13 +07:00
poli0981andClaude Opus 4.7 e91af0f676 fix(mobile): Tabs UI for Input/Output + compact FormatPicker on small viewports (#47)
After v1.4.1 user retested and reported the UI still breaks below ~400x700:
panels overlap below 600h, become nearly invisible below 500h. Root cause is
the grid-rows-2 mobile stack still gives each panel only half the available
height, and when the workspace toolbar wraps 2-3 rows (FormatPicker's 12 chips)
plus header / Home hero / Footer / StatusBar chrome, each row drops below
CodeMirror's minimum rendered content height and the two panels visually overlap.

Tabs UI on mobile (<md)
- Add shadcn Tabs primitive (@radix-ui/react-tabs, MIT)
- ConverterWorkspace renders Tabs on mobile (Input | Output, full-height active
  tab) and the side-by-side grid on md+. Both layouts render in parallel so
  CodeMirror state survives viewport resize without a remount.
- Output tab shows a 6px dot when output changes while the user is on the Input
  tab; the dot clears when they switch over. No auto-switch — user controls.

Compact FormatPicker on mobile
- Mobile: a single "Target format: CSV" button opens a bottom Sheet listing all
  12 chips in a 2-3 column grid (reuses the Sheet primitive already shipped
  with BatchPanel / SettingsPanel). Saves ~50-80px of toolbar height that
  would otherwise be eaten by the chip flex-wrap.
- Desktop: unchanged — 12 chips inline.

Minimum viewport documented
- README EN + VI now state "designed for viewports ≥ 360 × 640; smaller
  screens still work but may feel cramped".

THIRD-PARTY.md adds @radix-ui/react-tabs.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 12:48:42 +07:00
poli0981andClaude Opus 4.7 71b7ba2837 chore(release): v1.4.1 (#44)
Patch release for the mobile regressions reported on iPhone 14 Pro (#42):
- Header no longer overflows the viewport on phones (brand wordmark hidden below sm)
- Workspace panels stay visible on short and landscape phones (grid-rows-2 mobile split + h-dvh)
- THIRD-PARTY.md catches up with the CodeMirror lang packs (yaml/xml/markdown/sql/legacy-modes)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 11:55:42 +07:00
poli0981andClaude Opus 4.7 14f41c3775 fix(mobile): header overflow on small viewports + workspace panels disappearing on short/landscape phones (#42)
Three viewport regressions reported on iPhone 14 Pro (393 portrait, 852x393 landscape) and shorter phones; iPad and tablets were unaffected.

Header overflow
- iPhone 14 Pro is 393px wide; the header's brand wordmark + nav + lang switcher + theme + GitHub icon row summed to ~460px, forcing horizontal page scroll. Hide the "JSONPrism" wordmark below sm (640px) and rely on the BrandMark SVG alone on phones — saves ~90px and the row now fits.

Workspace panels collapsing
- "Output trên một số mẫu điện thoại có chiều dài ngắn không có" + "Khi xoay ngang -> Toàn bộ trường Input và output bị biến mất". Root causes:
  1. min-h-[40vh] on each stacked panel (added in 1.4.0 for usable mobile heights) summed to 80vh, which exceeded the available height after the header / Home padding / workspace toolbar / status bar / footer chrome on short phones. The workspace container's overflow-hidden then clipped the lower panel off-screen.
  2. h-screen (= 100vh) on the Layout root doesn't account for iOS Safari's dynamic toolbar — the computed height could exceed the actual visible area on rotation.
- Swap min-h-[40vh] for grid-rows-2 (mobile) / md:grid-rows-1 (desktop). Each panel now takes exactly half the workspace height share — always visible, no overflow.
- Swap h-screen for h-dvh (Tailwind v4 dynamic viewport height) so iOS Safari's actual visible area drives the layout.

THIRD-PARTY.md
- Add the five CodeMirror language packs that landed across 1.3.0 + 1.4.0 but weren't listed: lang-yaml, lang-xml, lang-markdown, lang-sql, legacy-modes. All MIT, all @codemirror/*.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 11:54:12 +07:00
poli0981andClaude Opus 4.7 5659c67f4b chore(release): v1.4.0 (#39)
Bumps package.json, src-tauri/Cargo.toml, and src-tauri/tauri.conf.json to 1.4.0 and adds the CHANGELOG entry for the UI/UX polish round (#35, #37):
- Dynamic input/output placeholders in reverse mode
- "Multi-target formats" slogan
- Reverse-mode highlight expanded to Markdown / SQL / TOML / JSONL
- Social links UI: Footer icons + About Community section
- Mobile responsiveness polish
- Mousewheel scroll on input editor no longer requires click-to-focus
- README EN + VI refreshed

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 10:37:47 +07:00
poli0981andClaude Opus 4.7 8cecb8019a style: prettier-format SocialIcons.tsx (#37)
The BlueskyIcon's `<path>` was a single long line exceeding the print
width, which slipped through local lint/build but failed CI's
`format:check`. Wraps the d/transform attributes across lines —
identical output, no SVG change.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 10:29:56 +07:00
poli0981andClaude Opus 4.7 27743986cc feat: UI/UX polish — Multi-target slogan, dynamic placeholders, social, reverse highlight, mobile (#35)
* feat(i18n): dynamic placeholders + Multi-target slogan

- Replace "Eight target formats" with "Multi-target formats" in app.description across en/vi/ja/zh-CN
- Add input_placeholder_format and output_empty_format keys with {{ext}} interpolation
- InputPanel and OutputPanel render extension-aware placeholders in reverse mode (e.g. "Paste your CSV here...", "Output will appear here once you provide valid YAML.")
- Forward mode keeps the original JSON-specific copy

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(ui): social links in Footer + About Community section

- Add SocialIcons component with 6 inline-SVG brand icons (Discord, X, Bluesky, Mastodon, Telegram, YouTube), since lucide-react has no brand icons
- Footer now exposes Discord (dev community) / X / Bluesky as a centered icon row, sandwiched between app meta and the maintainer credit
- About page gains a "Community" section between Donate and Third-party, listing all six platforms with icon + label
- Add i18n keys: about.community.* (titled section) and social.* (aria-labels) across en/vi/ja/zh-CN
- Curated based on username.txt: includes dev-relevant + maintainer's public socials; excludes Steam, Discord game server, email, and the Telegram bot (off-topic for the project)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(editor): scroll polish + reverse highlight for md/sql/toml/jsonl

Scroll fix
- .cm-scroller switched from scrollbarWidth: 'none' to 'thin' and explicit overflow: 'auto'. Hiding the native scrollbar was making wheel scroll require a click-to-focus before it engaged on some Chromium builds. Thin themed scrollbar reads fine on both light and dark theme.

Reverse-mode highlight
- Add @codemirror/lang-markdown, @codemirror/lang-sql, @codemirror/legacy-modes
- CodeEditor's EditorLanguage union now covers markdown, sql, and toml
- InputPanel maps jsonl -> json, markdown -> markdown, sql -> sql, toml -> toml; csv/tsv stay plain (no good CodeMirror grammar)
- All extensions go through the existing prismHighlightStyle, so colors stay consistent with forward JSON highlighting

Bundle impact: the three new packs are routed into the existing 'codemirror' manualChunk; no initial-bundle regression.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(ui): mobile responsiveness polish

- Header: nav links Convert/About now always visible (previously hidden md:flex), brand mark + wordmark scale down on small screens, padding tightened to 12px so the 360px viewport fits brand + nav + lang + theme + GitHub icon
- InputPanel/OutputPanel toolbar buttons: icon-only on mobile (label hidden below sm); aria-label and title now carry the text for a11y/tooltips
- ConverterWorkspace panels: min-h-[40vh] on mobile so the stacked Input/Output each keep a usable height instead of collapsing
- Home hero: stack the title and the drop-zone hint on mobile (flex-col), reduce outer padding
- About page: reduce outer padding on mobile (px-4 py-10) to claw back horizontal space
- FormatPicker chips: smaller padding + 11px font on mobile so the 12-format wrap stays compact

Skipped hamburger menu by design — Header only has 2 nav links, the drawer pattern adds bundle and complexity without payoff.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs: refresh README EN + VI for Multi-target slogan, full format table, Community section

- Replace "Eight target formats" tagline with "Multi-target formats" (EN) / "Đa định dạng đích" (VI), matching the in-app app.description copy
- VI README format table now mirrors EN: includes BSON / CBOR / MessagePack (Phase 4) and the "Reverse (→ JSON)" column that the VI side was missing
- Bump tech-stack line from Vite 6 to Vite 8 in both files (package.json has been on ^8.0.0 for a while; the About page already reflected this)
- Add a Community section listing Discord (dev community), X, Bluesky, Mastodon, Telegram, and YouTube — same set as the in-app Community section, sourced from the maintainer's public socials

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 10:27:04 +07:00
poli0981andClaude Opus 4.7 2d8c416975 docs(changelog): clarify v1.3.2 misdiagnosis, translate v1.3.3 to English, add verified env (#33)
- Translate the v1.3.3 entry to English to match the rest of CHANGELOG.
- Annotate v1.3.2 as a misdiagnosis: the fix is correct on its own
  (the Tauri callback really did miss the extension filter) but it is
  not the bug the user reported. The actual user-visible bug was
  batch dedup, which v1.3.3 addresses.
- Add a "Verified" section under v1.3.3 listing the manual smoke
  environments: Windows Sandbox and Ubuntu 22.04 (Hyper-V VM).

No code changes. Tests / lint / typecheck unaffected.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 21:50:13 +07:00
dependabot[bot] 194050eb7b build(deps): Bump actions/upload-artifact from 4 to 7 (#6)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-13 21:05:40 +07:00
dependabot[bot] 018151711c build(deps): Bump actions/deploy-pages from 4 to 5 (#5)
Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 4 to 5.
- [Release notes](https://github.com/actions/deploy-pages/releases)
- [Commits](https://github.com/actions/deploy-pages/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/deploy-pages
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-13 21:05:23 +07:00
dependabot[bot] 2fbf4cb463 build(deps): Bump actions/configure-pages from 5 to 6 (#4)
Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 5 to 6.
- [Release notes](https://github.com/actions/configure-pages/releases)
- [Commits](https://github.com/actions/configure-pages/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/configure-pages
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-13 21:05:00 +07:00
dependabot[bot] 5fae62e122 build(deps): Bump actions/upload-pages-artifact from 3 to 5 (#3)
Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3 to 5.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](https://github.com/actions/upload-pages-artifact/compare/v3...v5)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-13 21:03:10 +07:00
poli0981andClaude Opus 4.7 8a27c5c969 fix(tauri): set File.lastModified from stat() so batch dedup works (v1.3.3) (#27)
`fileFromNativePath` was calling `new File([text], name, { type })`
without `lastModified`. The File API defaults `lastModified` to
`Date.now()` at construction time, so reading the same path twice
produced two File objects with different timestamps — and `batchStore`
dedups on `(name, size, lastModified)`, so dropping the same file
twice through Tauri native drag-drop / native picker added both
copies to the queue with no `duplicate` toast. Web wasn't affected
because `<input type="file">` and `react-dropzone` build File objects
from the OS mtime.

Fix: call `stat()` from `@tauri-apps/plugin-fs` and pass
`mtime.getTime()` into the File constructor. Fall back to an FNV-1a
hash of the path if stat throws (capability missing, file vanished
between read and stat) so repeat drops still dedup.

Also infer `type` from the extension instead of hard-coding
`application/json`. Add `fs:allow-stat` to the default capability.

3 new unit tests for `pathHashAsMillis`. Total: 193.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 20:33:12 +07:00
29 changed files with 1018 additions and 94 deletions

No files matched your search

+1 -1
View File
@@ -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
+3 -3
View File
@@ -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
+79 -1
View File
@@ -8,11 +8,89 @@ 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.2] — 2026-05-14
### Added
- **Tabs UI for Input/Output on mobile (`<md`).** New shadcn `Tabs` primitive (`src/components/ui/tabs.tsx`, wrapping `@radix-ui/react-tabs`). The workspace now renders Tabs on mobile so each active panel takes the full available height; desktop continues to use the side-by-side grid. Both layouts render in parallel so CodeMirror state (selection, scroll, cursor) survives a viewport resize without remounting.
- **"Unread output" dot** on the Output tab. When `output` changes while the user is on the Input tab, a small primary-colored dot appears on the Output tab label; it clears the next time the user switches over. No auto-switch — the user controls the flow.
- **Compact mobile FormatPicker.** On `<md`, the 12 format chips collapse into a single `Target format: <current>` trigger that opens a bottom Sheet with all chips in a 2-3 column grid (reusing the existing Sheet primitive shipped with BatchPanel / SettingsPanel). Saves ~50–80px of toolbar height that the chip flex-wrap was eating on narrow viewports — that vertical space was the underlying cause of the previous "panels overlap" regression below 600px height.
### Fixed
- **Workspace panels still overlapping on viewports <400×700.** v1.4.1's `grid-rows-2 md:grid-rows-1` mobile split allotted each panel half the workspace height, but when the workspace top toolbar wrapped 2–3 rows (the 12 FormatPicker chips on narrow viewports) plus header / Home hero / Footer / StatusBar chrome, each row fell below CodeMirror's minimum rendered content height and the two panels visually overlapped. The Tabs swap above resolves this by giving the active panel the full workspace height instead of half.
### Changed
- **README EN + VI** now disclose: *"designed for viewports ≥ 360 × 640; smaller screens still work but may feel cramped"*. Galaxy S / Pixel-class portrait is the minimum well-supported viewport.
### Dependencies
- Added `@radix-ui/react-tabs` (MIT). Also listed in `THIRD-PARTY.md`.
## [1.4.1] — 2026-05-14
### Fixed
- **Header overflowed the viewport on iPhone 14 Pro and other ≤sm phones**. The brand wordmark + nav links + language switcher + theme toggle + GitHub icon summed to ~460px and didn't fit the 393px iPhone viewport, forcing horizontal page scroll to reach the right-edge buttons. Hide the `JSONPrism` wordmark below `sm` (640px) — the brand SVG mark alone identifies the app on phones, and the row fits cleanly.
- **Workspace input/output panels disappearing on short / landscape phones**. Two compounding causes:
- `min-h-[40vh]` on each stacked panel (introduced in 1.4.0 to make mobile heights usable) summed to 80vh, exceeding the available height after header / Home padding / workspace toolbar / status bar / footer chrome on short phones. The workspace container's `overflow-hidden` then clipped the lower (output) panel off-screen. Replaced with `grid-rows-2 md:grid-rows-1` so each panel takes exactly half the workspace height share on mobile — always visible, no overflow.
- `h-screen` (= `100vh`) on the Layout root didn't account for iOS Safari's dynamic toolbar — the computed height could exceed the actual visible area, especially after rotating to landscape. Swapped for `h-dvh` (Tailwind v4 dynamic viewport height).
### Docs
- **`THIRD-PARTY.md`** now lists the five CodeMirror language packs that landed across 1.3.0 + 1.4.0 (`@codemirror/lang-yaml`, `@codemirror/lang-xml`, `@codemirror/lang-markdown`, `@codemirror/lang-sql`, `@codemirror/legacy-modes` — all MIT). The file was lagging behind the actual install set.
## [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
+14 -2
View File
@@ -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.
[![CI](https://github.com/poli0981/jsonPrism/actions/workflows/ci.yml/badge.svg)](https://github.com/poli0981/jsonPrism/actions/workflows/ci.yml)
[![Deploy](https://github.com/poli0981/jsonPrism/actions/workflows/deploy.yml/badge.svg)](https://github.com/poli0981/jsonPrism/actions/workflows/deploy.yml)
@@ -42,12 +42,13 @@ JSONPrism is a refracting tool for developers. It takes a single JSON input and
- **Smart shape detection** — recognizes flat objects, arrays of objects, scalars; suggests the best target format.
- **Per-format options** — pretty-print, indentation, dialect (for SQL), alignment (for Markdown), and more.
- **Dark + light themes** — Prism Spectrum palette with violet / cyan / amber / rose accents.
- **Responsive — designed for viewports ≥ 360 × 640.** Smaller screens still work but may feel cramped; on mobile, Input and Output use a Tabs UI to give each panel full height.
- **EN + VI** — bilingual interface out of the box. More languages welcome.
- **Tauri desktop build** — drag-and-drop file workflow, offline-first (Phase 2 milestone).
## 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 +206,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
+28 -13
View File
@@ -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.
[![CI](https://github.com/poli0981/jsonPrism/actions/workflows/ci.yml/badge.svg)](https://github.com/poli0981/jsonPrism/actions/workflows/ci.yml)
[![Deploy](https://github.com/poli0981/jsonPrism/actions/workflows/deploy.yml/badge.svg)](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
@@ -39,12 +42,13 @@ JSONPrism là công cụ "tán sắc" cho developer. Nhận một JSON đầu v
- **Phát hiện shape thông minh** — nhận diện flat object, mảng object, scalar; gợi ý format đích phù hợp.
- **Tuỳ chọn theo từng format** — pretty-print, indentation, dialect (SQL), alignment (Markdown), v.v.
- **Theme sáng/tối** — bảng màu Prism Spectrum với violet / cyan / amber / rose.
- **Responsive — tối ưu cho viewport ≥ 360 × 640.** Màn hình nhỏ hơn vẫn dùng được nhưng có thể chật; trên mobile, Input và Output dùng Tabs UI để mỗi panel có toàn bộ chiều cao.
- **Đa ngôn ngữ EN + VI** — sẵn sàng từ ngày đầu. Hoan nghênh thêm ngôn ngữ khác.
- **Bản desktop Tauri** — drag-and-drop file, hoạt động offline (mốc Phase 2).
## 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 +206,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
+6
View File
@@ -29,6 +29,7 @@ the relevant notices. This file is a starting point.
| `@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/) |
| `@radix-ui/react-tabs` | ^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/) |
@@ -46,6 +47,11 @@ installed as a runtime dependency.
| `@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/lang-yaml` | ^6.1.3 | MIT | [codemirror.net](https://codemirror.net/) |
| `@codemirror/lang-xml` | ^6.1.0 | MIT | [codemirror.net](https://codemirror.net/) |
| `@codemirror/lang-markdown` | ^6.5.0 | MIT | [codemirror.net](https://codemirror.net/) |
| `@codemirror/lang-sql` | ^6.10.0 | MIT | [codemirror.net](https://codemirror.net/) |
| `@codemirror/legacy-modes` | ^6.5.2 | 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/) |
+252 -2
View File
@@ -1,18 +1,21 @@
{
"name": "jsonprism",
"version": "1.3.2",
"version": "1.4.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "jsonprism",
"version": "1.3.2",
"version": "1.4.2",
"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",
@@ -21,6 +24,7 @@
"@radix-ui/react-dialog": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.13",
"@tauri-apps/api": "^2.0.0",
"@tauri-apps/plugin-dialog": "^2.0.0",
"@tauri-apps/plugin-fs": "^2.0.0",
@@ -337,6 +341,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 +396,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 +468,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 +990,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 +1010,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 +1052,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",
@@ -1016,6 +1146,50 @@
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==",
"license": "MIT"
},
"node_modules/@radix-ui/react-collection": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.7.tgz",
"integrity": "sha512-Fh9rGN0MoI4ZFUNyfFVNU4y9LUz93u9/0K+yLgA2bwRojxM8JU1DyvvMBabnZPBgMWREAJvU2jjVzq+LrFUglw==",
"license": "MIT",
"dependencies": {
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-context": "1.1.2",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-slot": "1.2.3"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.3.tgz",
"integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==",
"license": "MIT",
"dependencies": {
"@radix-ui/react-compose-refs": "1.1.2"
},
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-compose-refs": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.2.tgz",
@@ -1100,6 +1274,21 @@
}
}
},
"node_modules/@radix-ui/react-direction": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.1.1.tgz",
"integrity": "sha512-1UEWRX6jnOA2y4H5WczZ44gOOjTEmlqv1uNW4GAJEO5+bauCBhv8snY65Iw5/VOS/ghKN9gr2KjnLKxrsvoMVw==",
"license": "MIT",
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-dismissable-layer": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.11.tgz",
@@ -1274,6 +1463,37 @@
}
}
},
"node_modules/@radix-ui/react-roving-focus": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.11.tgz",
"integrity": "sha512-7A6S9jSgm/S+7MdtNDSb+IU859vQqJ/QAtcYQcfFC6W8RS4IxIZDldLR0xqCFZ6DCyrQLjLPsxtTNch5jVA4lA==",
"license": "MIT",
"dependencies": {
"@radix-ui/primitive": "1.1.3",
"@radix-ui/react-collection": "1.1.7",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-context": "1.1.2",
"@radix-ui/react-direction": "1.1.1",
"@radix-ui/react-id": "1.1.1",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-use-callback-ref": "1.1.1",
"@radix-ui/react-use-controllable-state": "1.2.2"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-slot": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.2.4.tgz",
@@ -1321,6 +1541,36 @@
}
}
},
"node_modules/@radix-ui/react-tabs": {
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/@radix-ui/react-tabs/-/react-tabs-1.1.13.tgz",
"integrity": "sha512-7xdcatg7/U+7+Udyoj2zodtI9H/IIopqo+YOIcZOq1nJwXWBZ9p8xiu5llXlekDbZkca79a/fozEYQXIA4sW6A==",
"license": "MIT",
"dependencies": {
"@radix-ui/primitive": "1.1.3",
"@radix-ui/react-context": "1.1.2",
"@radix-ui/react-direction": "1.1.1",
"@radix-ui/react-id": "1.1.1",
"@radix-ui/react-presence": "1.1.5",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-roving-focus": "1.1.11",
"@radix-ui/react-use-controllable-state": "1.2.2"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-use-callback-ref": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.1.tgz",
+5 -1
View File
@@ -1,7 +1,7 @@
{
"name": "jsonprism",
"private": true,
"version": "1.3.2",
"version": "1.4.2",
"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",
@@ -45,6 +48,7 @@
"@radix-ui/react-dialog": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.13",
"@tauri-apps/api": "^2.0.0",
"@tauri-apps/plugin-dialog": "^2.0.0",
"@tauri-apps/plugin-fs": "^2.0.0",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "jsonprism"
version = "1.3.2"
version = "1.4.2"
description = "Disperse JSON into many formats."
authors = ["poli0981 <https://github.com/poli0981>"]
license = "Apache-2.0"
+1
View File
@@ -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 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "JSONPrism",
"version": "1.3.2",
"version": "1.4.2",
"identifier": "com.poli0981.jsonprism",
"build": {
"beforeDevCommand": "npm run dev",
+54
View File
@@ -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>
);
}
+21 -5
View File
@@ -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',
@@ -1,6 +1,7 @@
import { useCallback, useMemo, useRef, useState } from 'react';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { toast } from '@/components/ui/sonner';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { getConverter } from '@/converters/registry';
import type { FormatId } from '@/converters/types';
import { parseJsonInput } from '@/lib/detect';
@@ -36,6 +37,11 @@ export function ConverterWorkspace() {
const actionsRef = useRef<{ copy: () => void; download: () => void } | null>(null);
const [batchOpen, setBatchOpen] = useState(false);
const [settingsOpen, setSettingsOpen] = useState(false);
// Mobile tab state — desktop ignores this and renders both panels side-by-side.
const [activeTab, setActiveTab] = useState<'input' | 'output'>('input');
// Badge dot on Output tab when output changes while user is on Input tab.
const [hasUnreadOutput, setHasUnreadOutput] = useState(false);
const prevOutputRef = useRef('');
const addBatchFiles = useBatchStore((s) => s.addFiles);
const handleMultiFileDrop = useCallback(
@@ -179,6 +185,21 @@ export function ConverterWorkspace() {
{ key: ',', mod: true, handler: () => setSettingsOpen((v) => !v) },
]);
// Flip the badge dot on the Output tab whenever output changes while the
// user is on the Input tab. Clearing happens once the user navigates over.
useEffect(() => {
if (output !== prevOutputRef.current) {
prevOutputRef.current = output;
if (output && activeTab !== 'output') {
setHasUnreadOutput(true);
}
}
}, [output, activeTab]);
useEffect(() => {
if (activeTab === 'output') setHasUnreadOutput(false);
}, [activeTab]);
const inputBytes = useMemo(() => new TextEncoder().encode(input).length, [input]);
const outputBytes = useMemo(() => new TextEncoder().encode(output).length, [output]);
@@ -215,8 +236,54 @@ export function ConverterWorkspace() {
</div>
<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">
{/* Mobile: Tabs UI — each tab gets the full workspace height so panels
never overlap on short viewports. */}
<Tabs
value={activeTab}
onValueChange={(v) => setActiveTab(v as 'input' | 'output')}
className="flex min-h-0 flex-1 flex-col md:hidden"
>
<TabsList className="border-border/60 w-full justify-start gap-0 rounded-none border-b px-2">
<TabsTrigger value="input">{t('home.tab_input')}</TabsTrigger>
<TabsTrigger value="output" className="relative">
{t('home.tab_output')}
{hasUnreadOutput && (
<span
aria-hidden
className="bg-primary absolute top-1 right-1 h-1.5 w-1.5 rounded-full"
/>
)}
</TabsTrigger>
</TabsList>
<TabsContent value="input" className="min-h-0 flex-1">
<InputPanel
value={input}
onChange={setInput}
error={inputError}
format={format}
direction={direction}
onMultiFileDrop={handleMultiFileDrop}
/>
</TabsContent>
<TabsContent value="output" className="min-h-0 flex-1">
<OutputPanel
format={format}
content={output}
error={outputError}
options={currentOptions}
direction={direction}
registerActions={(a) => {
actionsRef.current = a;
}}
/>
</TabsContent>
</Tabs>
{/* Desktop: side-by-side grid (≥ md). Rendered in parallel with the
Tabs above so neither remounts on viewport resize and CodeMirror
state survives the swap. */}
<div className="hidden min-h-0 flex-1 md:grid md:grid-cols-2">
<div className="border-border/60 min-h-0 border-r">
<InputPanel
value={input}
onChange={setInput}
@@ -239,6 +306,7 @@ export function ConverterWorkspace() {
/>
</div>
</div>
<StatusBar inputBytes={inputBytes} outputBytes={outputBytes} parseMs={parseMs} />
</div>
</div>
+113 -40
View File
@@ -1,4 +1,7 @@
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { ChevronDown } from 'lucide-react';
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/components/ui/sheet';
import { ALL_FORMATS, getConverter } from '@/converters/registry';
import type { FormatId } from '@/converters/types';
import type { JsonShape } from '@/lib/detect';
@@ -17,51 +20,121 @@ interface FormatPickerProps {
export function FormatPicker({ value, onChange, shape, direction = 'forward' }: FormatPickerProps) {
const { t } = useTranslation();
const [sheetOpen, setSheetOpen] = useState(false);
const current = getConverter(value);
const handlePick = (id: FormatId) => {
onChange(id);
setSheetOpen(false);
};
return (
<div className="flex flex-wrap gap-1.5">
{ALL_FORMATS.map((id) => {
const c = getConverter(id);
const active = value === id;
const suggested = direction === 'forward' && shape ? isFormatSuggested(id, shape) : false;
const noReverse = direction === 'reverse' && typeof c.reverse !== 'function';
const enabled = c.meta.ready && !noReverse;
const dimmed = direction === 'forward' && shape && !suggested && c.meta.ready;
return (
<>
{/* Mobile: compact Sheet trigger — saves ~50-80px of toolbar height when
the 12 chip grid would otherwise wrap to 2-3 rows on narrow viewports. */}
<Sheet open={sheetOpen} onOpenChange={setSheetOpen}>
<SheetTrigger asChild>
<button
key={id}
type="button"
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',
active
? 'border-primary/60 bg-primary/10 text-foreground'
: 'border-border bg-card/40 text-muted-foreground hover:text-foreground hover:border-border',
!enabled && 'cursor-not-allowed opacity-50',
dimmed && !active && 'opacity-50',
suggested && !active && 'ring-primary/30 ring-offset-background ring-1 ring-offset-1',
)}
title={
!c.meta.ready
? t('format_status.planned', { phase: c.meta.phase })
: noReverse
? t('format_status.no_reverse')
: suggested
? t('format_status.suggested')
: t('format_status.ready')
}
className="border-border bg-card/40 text-muted-foreground hover:border-primary/40 hover:text-foreground inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition md:hidden"
aria-label={t('home.format_picker_label')}
>
<span className="font-mono">{t(c.meta.labelKey)}</span>
{!c.meta.ready && (
<span className="border-border text-muted-foreground rounded border px-1 text-[10px] tracking-wide">
P{c.meta.phase}
</span>
)}
<span className="tracking-wider uppercase opacity-70">
{t('home.format_picker_label')}
</span>
<span className="text-foreground font-mono">{t(current.meta.labelKey)}</span>
<ChevronDown className="h-3 w-3" />
</button>
);
})}
</div>
</SheetTrigger>
<SheetContent side="bottom" className="max-h-[80vh] w-full overflow-y-auto">
<SheetHeader>
<SheetTitle>{t('home.format_picker_label')}</SheetTitle>
</SheetHeader>
<div className="grid grid-cols-2 gap-1.5 p-4 pt-2 sm:grid-cols-3">
{ALL_FORMATS.map((id) => (
<FormatChip
key={id}
id={id}
value={value}
onChange={handlePick}
shape={shape}
direction={direction}
expanded
/>
))}
</div>
</SheetContent>
</Sheet>
{/* Desktop: 12 chips inline. */}
<div className="hidden flex-wrap gap-1.5 md:flex">
{ALL_FORMATS.map((id) => (
<FormatChip
key={id}
id={id}
value={value}
onChange={onChange}
shape={shape}
direction={direction}
/>
))}
</div>
</>
);
}
interface FormatChipProps {
id: FormatId;
value: FormatId;
onChange: (id: FormatId) => void;
shape: JsonShape | null | undefined;
direction: Direction;
/** Expanded layout (fills the Sheet grid cell), vs the compact inline chip. */
expanded?: boolean;
}
function FormatChip({ id, value, onChange, shape, direction, expanded }: FormatChipProps) {
const { t } = useTranslation();
const c = getConverter(id);
const active = value === id;
const suggested = direction === 'forward' && shape ? isFormatSuggested(id, shape) : false;
const noReverse = direction === 'reverse' && typeof c.reverse !== 'function';
const enabled = c.meta.ready && !noReverse;
const dimmed = direction === 'forward' && shape && !suggested && c.meta.ready;
return (
<button
type="button"
onClick={() => onChange(id)}
disabled={!enabled}
className={cn(
'group relative inline-flex items-center gap-1.5 rounded-md border font-medium transition',
expanded
? 'justify-between px-3 py-2 text-sm'
: 'px-2 py-0.5 text-[11px] 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',
!enabled && 'cursor-not-allowed opacity-50',
dimmed && !active && 'opacity-50',
suggested && !active && 'ring-primary/30 ring-offset-background ring-1 ring-offset-1',
)}
title={
!c.meta.ready
? t('format_status.planned', { phase: c.meta.phase })
: noReverse
? t('format_status.no_reverse')
: suggested
? t('format_status.suggested')
: t('format_status.ready')
}
>
<span className="font-mono">{t(c.meta.labelKey)}</span>
{!c.meta.ready && (
<span className="border-border text-muted-foreground rounded border px-1 text-[10px] tracking-wide">
P{c.meta.phase}
</span>
)}
</button>
);
}
+14 -2
View File
@@ -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>
);
}
+8 -2
View File
@@ -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>
);
}
+44 -1
View File
@@ -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>
);
}
+6 -6
View File
@@ -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 hidden text-xl leading-none tracking-tight sm:inline">
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',
+1 -1
View File
@@ -4,7 +4,7 @@ import { Footer } from './Footer';
export function Layout() {
return (
<div className="flex h-screen flex-col">
<div className="flex h-dvh flex-col">
<Header />
<main className="flex min-h-0 flex-1 flex-col">
<Outlet />
+50
View File
@@ -0,0 +1,50 @@
import * as React from 'react';
import * as TabsPrimitive from '@radix-ui/react-tabs';
import { cn } from '@/lib/utils';
const Tabs = TabsPrimitive.Root;
const TabsList = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.List>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
>(({ className, ...props }, ref) => (
<TabsPrimitive.List
ref={ref}
className={cn(
'text-muted-foreground inline-flex items-center justify-center gap-1',
className,
)}
{...props}
/>
));
TabsList.displayName = TabsPrimitive.List.displayName;
const TabsTrigger = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Trigger
ref={ref}
className={cn(
'text-muted-foreground hover:text-foreground data-[state=active]:text-foreground data-[state=active]:border-primary inline-flex items-center justify-center gap-1.5 border-b-2 border-transparent px-3 py-1.5 text-xs font-medium tracking-wider uppercase transition focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50',
className,
)}
{...props}
/>
));
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
const TabsContent = React.forwardRef<
React.ElementRef<typeof TabsPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Content
ref={ref}
className={cn('focus-visible:outline-none', className)}
{...props}
/>
));
TabsContent.displayName = TabsPrimitive.Content.displayName;
export { Tabs, TabsList, TabsTrigger, TabsContent };
+23 -1
View File
@@ -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,12 @@
"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…",
"tab_input": "Input",
"tab_output": "Output",
"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 +248,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 +295,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"
}
}
+23 -1
View File
@@ -2,7 +2,7 @@
"app": {
"name": "JSONPrism",
"tagline": "JSON を様々な形式に分散",
"description": "JSON 入力ひとつ。ターゲット形式は 8 種類以上。ブラウザ内で完結。"
"description": "JSON 入力ひとつ。マルチターゲット形式。ブラウザ内で完結。"
},
"nav": {
"home": "変換",
@@ -13,8 +13,12 @@
"input_label": "JSON 入力",
"input_label_format": "{{format}} 入力",
"input_placeholder": "ここに JSON を貼り付け、ファイルをドロップ、またはサンプルを読み込み…",
"input_placeholder_format": "ここに {{ext}} を貼り付け、ファイルをドロップ、またはサンプルを読み込み…",
"tab_input": "入力",
"tab_output": "出力",
"output_label": "出力",
"output_empty": "有効な JSON を入力すると、ここに出力が表示されます。",
"output_empty_format": "有効な {{ext}} を入力すると、ここに出力が表示されます。",
"drop_zone": "JSON ファイルをここにドロップ",
"drop_zone_active": "ドロップして読み込み",
"drop_zone_hint": "最大 500 ファイル。すべてブラウザ内で処理 — データは端末から外に出ません。",
@@ -244,6 +248,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 +295,13 @@
},
"disclaimer": {
"translation": "このページの翻訳は AI 生成です。100% の正確性は保証されません。"
},
"social": {
"discord": "Discord",
"x": "X (Twitter)",
"bluesky": "Bluesky",
"mastodon": "Mastodon",
"telegram": "Telegram",
"youtube": "YouTube"
}
}
+23 -1
View File
@@ -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,12 @@
"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…",
"tab_input": "Đầu vào",
"tab_output": "Kết quả",
"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 +248,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 +295,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"
}
}
+23 -1
View File
@@ -2,7 +2,7 @@
"app": {
"name": "JSONPrism",
"tagline": "将 JSON 分散为多种格式",
"description": "一份 JSON 输入,八种以上目标格式,全程在浏览器中完成。"
"description": "一份 JSON 输入,多目标格式,全程在浏览器中完成。"
},
"nav": {
"home": "转换",
@@ -13,8 +13,12 @@
"input_label": "JSON 输入",
"input_label_format": "{{format}} 输入",
"input_placeholder": "在此处粘贴 JSON、拖入文件或加载示例…",
"input_placeholder_format": "在此处粘贴 {{ext}}、拖入文件或加载示例…",
"tab_input": "输入",
"tab_output": "输出",
"output_label": "输出",
"output_empty": "提供有效的 JSON 后,输出将显示在此处。",
"output_empty_format": "提供有效的 {{ext}} 后,输出将显示在此处。",
"drop_zone": "将 JSON 文件拖到此处",
"drop_zone_active": "释放即可加载",
"drop_zone_hint": "最多 500 个文件。全部在浏览器中运行 — 数据不会离开你的设备。",
@@ -244,6 +248,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 +295,13 @@
},
"disclaimer": {
"translation": "本页面译文由 AI 生成,不保证 100% 准确。"
},
"social": {
"discord": "Discord",
"x": "X (Twitter)",
"bluesky": "Bluesky",
"mastodon": "Mastodon",
"telegram": "Telegram",
"youtube": "YouTube"
}
}
+22
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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.