Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30f10cfc36 | ||
|
|
a6caa88d9c | ||
|
|
25cac76373 | ||
|
|
e91af0f676 | ||
|
|
71b7ba2837 | ||
|
|
14f41c3775 |
No files matched your search
@@ -8,6 +8,54 @@ 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.3] — 2026-05-14
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Toast close button (`×`) did nothing on click/tap** on both desktop and mobile. `sonner@1.7.4`'s toast root attached `r.target.setPointerCapture(r.pointerId)` unconditionally on `pointerdown`, and combined with React 19's new container-root event delegation, the pointer-capture quirk swallowed the synthetic click event on the close button — so the bundled `dismiss()` handler never ran. The bug fired on both mouse and touch because the PointerEvent API is unified. Upgraded `sonner` `^1.7.0` → `^2.0.7`, which rewrote pointer/swipe handling and ships first-class React 19 support. `<Toaster>` props (`position`, `theme`, `richColors`, `closeButton`, `toastOptions.classNames`) and the `toast.success/warning/error/info` call sites are API-compatible — no code changes needed beyond the version bump.
|
||||
|
||||
### Added
|
||||
|
||||
- **`docs/tested-viewports.md`** — the maintainer's manual device test matrix (BlackBerry Z30 / Galaxy S9+ / Pixel 3/4/7 / iPhone SE/12/14 Pro/XR/Pro Max / iPad / BlackBerry PlayBook). Documents Nokia Lumia 520 (320×533) as a known limitation below the recommended `360×640` minimum. README EN + VI link to it.
|
||||
- **Touch hit-area expansion on the toast close button.** A `::after` pseudo gives an effective ~36–40px tap target (visible size stays at sonner's 20px default), plus `touch-action: manipulation` to drop the 300ms tap delay on touch devices. Defensive — sonner v2 already fixes the underlying click — but a free mobile UX win.
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bumped `sonner` `^1.7.0` → `^2.0.7` (MIT). THIRD-PARTY.md updated.
|
||||
|
||||
## [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
|
||||
|
||||
@@ -42,6 +42,7 @@ 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. See [`docs/tested-viewports.md`](docs/tested-viewports.md) for the full device test matrix.
|
||||
- **EN + VI** — bilingual interface out of the box. More languages welcome.
|
||||
- **Tauri desktop build** — drag-and-drop file workflow, offline-first (Phase 2 milestone).
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ 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. Xem [`docs/tested-viewports.md`](docs/tested-viewports.md) cho ma trận thiết bị đã kiểm thử.
|
||||
- **Đ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).
|
||||
|
||||
|
||||
+7
-1
@@ -29,8 +29,9 @@ 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/) |
|
||||
| `sonner` | ^2.0.7 | MIT | [sonner.emilkowal.ski](https://sonner.emilkowal.ski/) |
|
||||
| `react-dropzone` | ^14.3.0 | MIT | [react-dropzone.js.org](https://react-dropzone.js.org/) |
|
||||
|
||||
The component patterns under `src/components/ui/` are generated from
|
||||
@@ -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/) |
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
# Tested viewports
|
||||
|
||||
JSONPrism's mobile and tablet rendering is verified across the devices below.
|
||||
|
||||
Status legend:
|
||||
|
||||
- ✅ Works as expected
|
||||
- ⚠️ Cramped but functional
|
||||
- ❌ Known limitation (typically below recommended minimum)
|
||||
|
||||
Recommended minimum viewport: **360 × 640**. Phones in landscape orientation are best-effort — see [recommendation](#recommendation).
|
||||
|
||||
## Test results (last verified 2026-05-14)
|
||||
|
||||
### Phones (portrait)
|
||||
|
||||
| Device | Viewport | Status | Notes |
|
||||
| ------------------------------------------------ | --------- | ------ | ------------------------------ |
|
||||
| BlackBerry Z30 / Samsung Galaxy Note 3 / Nexus 5 | 360 × 640 | ✅ | Minimum recommended viewport |
|
||||
| Samsung Galaxy S9+ | 320 × 658 | ✅ | Below recommended width, works |
|
||||
| Pixel 4 | 353 × 745 | ✅ | |
|
||||
| Pixel 3 | 393 × 786 | ✅ | |
|
||||
| iPhone SE (2nd/3rd gen) | 375 × 667 | ✅ | |
|
||||
| iPhone 12 Pro | 390 × 844 | ✅ | |
|
||||
| iPhone 14 Pro | 393 × 852 | ✅ | Verified on real device |
|
||||
| iPhone XR | 414 × 896 | ✅ | |
|
||||
| Pixel 7 | 412 × 915 | ✅ | |
|
||||
| iPhone 14 Pro Max | 420 × 932 | ✅ | |
|
||||
|
||||
### Tablets
|
||||
|
||||
| Device | Viewport | Status | Notes |
|
||||
| ------------------- | ---------- | ------ | -------------------------------------------------- |
|
||||
| BlackBerry PlayBook | 600 × 1024 | ✅ | |
|
||||
| iPad | 768 × 1024 | ✅ | Side-by-side input/output kicks in at `md` (768px) |
|
||||
|
||||
### Known limitations
|
||||
|
||||
| Device | Viewport | Status | Notes |
|
||||
| -------------- | --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| Nokia Lumia 520 | 320 × 533 | ❌ | Code editor disappears — viewport is below the recommended minimum height (640). Worth revisiting in a future round if demand surfaces. |
|
||||
|
||||
## Recommendation
|
||||
|
||||
- **Portrait orientation only on phones.** Landscape on phones (height < width) compresses each tab's content area to ~150–200px after chrome and is best-effort.
|
||||
- **Below recommended minimum (360 × 640)**: layout is functional but the code editor may collapse on very short heights (< 600px).
|
||||
|
||||
## How to retest
|
||||
|
||||
1. Open Chrome DevTools → "Toggle device toolbar" (Ctrl+Shift+M).
|
||||
2. Pick a device from the dropdown or set a custom viewport.
|
||||
3. Verify on the Home page: Header navigation visible, Input/Output Tabs accessible, FormatPicker trigger fits, no horizontal scroll on `<body>`.
|
||||
|
||||
Test results contributed by the maintainer. PRs welcome to expand the matrix.
|
||||
Generated
+127
-6
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "jsonprism",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "jsonprism",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.3",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@codemirror/lang-json": "^6.0.0",
|
||||
@@ -24,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",
|
||||
@@ -47,7 +48,7 @@
|
||||
"react-i18next": "^15.0.0",
|
||||
"react-router-dom": "^7.0.0",
|
||||
"smol-toml": "^1.3.0",
|
||||
"sonner": "^1.7.0",
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^2.5.0",
|
||||
"zustand": "^5.0.0"
|
||||
},
|
||||
@@ -1145,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",
|
||||
@@ -1229,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",
|
||||
@@ -1403,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",
|
||||
@@ -1450,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",
|
||||
@@ -5482,9 +5603,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/sonner": {
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/sonner/-/sonner-1.7.4.tgz",
|
||||
"integrity": "sha512-DIS8z4PfJRbIyfVFDVnK9rO3eYDtse4Omcm6bt0oEr5/jtLgysmjuBl1frJ9E/EQZrFmKx2A8m/s5s9CRXIzhw==",
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.7.tgz",
|
||||
"integrity": "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
||||
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jsonprism",
|
||||
"private": true,
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.3",
|
||||
"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>",
|
||||
@@ -48,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",
|
||||
@@ -71,7 +72,7 @@
|
||||
"react-i18next": "^15.0.0",
|
||||
"react-router-dom": "^7.0.0",
|
||||
"smol-toml": "^1.3.0",
|
||||
"sonner": "^1.7.0",
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^2.5.0",
|
||||
"zustand": "^5.0.0"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "jsonprism"
|
||||
version = "1.4.0"
|
||||
version = "1.4.3"
|
||||
description = "Disperse JSON into many formats."
|
||||
authors = ["poli0981 <https://github.com/poli0981>"]
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "JSONPrism",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.3",
|
||||
"identifier": "com.poli0981.jsonprism",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@@ -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-[40vh] border-b md:min-h-0 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}
|
||||
@@ -226,7 +293,7 @@ export function ConverterWorkspace() {
|
||||
onMultiFileDrop={handleMultiFileDrop}
|
||||
/>
|
||||
</div>
|
||||
<div className="min-h-[40vh] md:min-h-0">
|
||||
<div className="min-h-0">
|
||||
<OutputPanel
|
||||
format={format}
|
||||
content={output}
|
||||
@@ -239,6 +306,7 @@ export function ConverterWorkspace() {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<StatusBar inputBytes={inputBytes} outputBytes={outputBytes} parseMs={parseMs} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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 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',
|
||||
!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>
|
||||
);
|
||||
}
|
||||
@@ -13,7 +13,7 @@ export function Header() {
|
||||
<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">
|
||||
<span className="font-display hidden text-xl leading-none tracking-tight sm:inline">
|
||||
JSON<span className="text-spectrum italic">Prism</span>
|
||||
</span>
|
||||
</Link>
|
||||
|
||||
@@ -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 />
|
||||
|
||||
@@ -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 };
|
||||
@@ -14,6 +14,8 @@
|
||||
"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}}.",
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
"input_label_format": "{{format}} 入力",
|
||||
"input_placeholder": "ここに JSON を貼り付け、ファイルをドロップ、またはサンプルを読み込み…",
|
||||
"input_placeholder_format": "ここに {{ext}} を貼り付け、ファイルをドロップ、またはサンプルを読み込み…",
|
||||
"tab_input": "入力",
|
||||
"tab_output": "出力",
|
||||
"output_label": "出力",
|
||||
"output_empty": "有効な JSON を入力すると、ここに出力が表示されます。",
|
||||
"output_empty_format": "有効な {{ext}} を入力すると、ここに出力が表示されます。",
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
"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ệ.",
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
"input_label_format": "{{format}} 输入",
|
||||
"input_placeholder": "在此处粘贴 JSON、拖入文件或加载示例…",
|
||||
"input_placeholder_format": "在此处粘贴 {{ext}}、拖入文件或加载示例…",
|
||||
"tab_input": "输入",
|
||||
"tab_output": "输出",
|
||||
"output_label": "输出",
|
||||
"output_empty": "提供有效的 JSON 后,输出将显示在此处。",
|
||||
"output_empty_format": "提供有效的 {{ext}} 后,输出将显示在此处。",
|
||||
|
||||
@@ -198,4 +198,16 @@
|
||||
)
|
||||
1;
|
||||
}
|
||||
|
||||
/* Expand the Sonner close-button hit-test radius for touch.
|
||||
Visible size stays at sonner's 20px default; the ::after pseudo
|
||||
gives an effective ~36–40px tap target without changing layout. */
|
||||
[data-sonner-toaster] [data-close-button] {
|
||||
touch-action: manipulation;
|
||||
}
|
||||
[data-sonner-toaster] [data-close-button]::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: -8px;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user