feat: migrate to turborepo and separate canvas as package (#573)
* feat: migrate to turborepo and separate canvas as package * refactor: improve code formatting and linting scripts in react-jsoncrack package * fix: update lint task dependencies and outputs in turbo.json * feat: refactor project structure to use 'jsoncrack' package * feat: rename react-jsoncrack to jsoncrack * feat: add vscode app * feat: enhance spinner and overlay styles for better theming support * feat: update build scripts and fix import path for Turborepo integration * feat: update README files to enhance project documentation and usage instructions * fix: correct lint:fix script and update package manager version * feat: move files to root * feat: update version to 1.0.0 in package.json * feat: add .npm-cache to .gitignore * refactor: rename jsoncrack to jsoncrack-react and update imports - Updated package.json files in apps/vscode and apps/www to replace "jsoncrack" with "jsoncrack-react" and added license information. - Refactored imports in various components and utilities to use "jsoncrack-react" instead of "jsoncrack". - Added ESLint and Prettier configuration files to the jsoncrack package for improved code quality. - Adjusted code formatting across multiple files for consistency and readability. * refactor: jsoncrack-react build with vite * fix: update license in package.json to Apache-2.0 * refactor: remove TOML support from various components and update documentation * chore: rename package folder to jsoncrack-react * fix: update license field in package.json to Apache-2.0 and add LICENSE.md * fix: react peer deps * fix: adjust height of StyledEditorWrapper to 100% for better responsiveness * fix: restore cursor style for jsoncrack-space in GraphView * fix: update npm package link from `jsoncrack` to `jsoncrack-react` in README.md * feat: add .npmrc for engine strictness and update package.json engine requirements
@@ -32,7 +32,7 @@ jobs:
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 10.10.0
|
||||
version: 10.20.0
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
@@ -48,20 +48,21 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Restore cache
|
||||
- name: Restore Turbo and Next.js cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
.next/cache
|
||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
||||
.turbo
|
||||
apps/www/.next/cache
|
||||
key: ${{ runner.os }}-turbo-next-${{ hashFiles('pnpm-lock.yaml', 'turbo.json') }}-${{ hashFiles('apps/www/**.[jt]s', 'apps/www/**.[jt]sx', 'packages/**.[jt]s', 'packages/**.[jt]sx') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/pnpm-lock.yaml') }}-
|
||||
${{ runner.os }}-turbo-next-${{ hashFiles('pnpm-lock.yaml', 'turbo.json') }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build with Next.js
|
||||
run: pnpm next build
|
||||
- name: Build with Turborepo
|
||||
run: pnpm run build:www
|
||||
env:
|
||||
NEXT_PUBLIC_GA_MEASUREMENT_ID: ${{ vars.NEXT_PUBLIC_GA_MEASUREMENT_ID }}
|
||||
|
||||
@@ -69,12 +70,12 @@ jobs:
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: build-files
|
||||
path: ./out/_next/static/chunks
|
||||
path: ./apps/www/out/_next/static/chunks
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v4
|
||||
with:
|
||||
path: './out'
|
||||
path: './apps/www/out'
|
||||
|
||||
# Deployment job
|
||||
deploy:
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 10.10.0
|
||||
version: 10.20.0
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
@@ -36,22 +36,23 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Restore Next.js cache
|
||||
uses: actions/cache@v4
|
||||
- name: Restore Turbo and Next.js cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
.next/cache
|
||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
||||
.turbo
|
||||
apps/www/.next/cache
|
||||
key: ${{ runner.os }}-turbo-next-${{ hashFiles('pnpm-lock.yaml', 'turbo.json') }}-${{ hashFiles('apps/www/**.[jt]s', 'apps/www/**.[jt]sx', 'packages/**.[jt]s', 'packages/**.[jt]sx') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
|
||||
${{ runner.os }}-turbo-next-${{ hashFiles('pnpm-lock.yaml', 'turbo.json') }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Lint
|
||||
run: pnpm run lint
|
||||
run: pnpm turbo run lint
|
||||
|
||||
- name: Build
|
||||
run: pnpm run build
|
||||
run: pnpm turbo run build
|
||||
|
||||
|
||||
|
||||
@@ -1,41 +1,26 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
# Agent tooling
|
||||
.agents
|
||||
.claude
|
||||
.codex
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
# Package manager
|
||||
node_modules/
|
||||
.npm-cache/
|
||||
.pnpm-store/
|
||||
.pnp*
|
||||
npm-debug.log*
|
||||
pnpm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
# Turborepo
|
||||
.turbo/
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
|
||||
# PWA workers
|
||||
**/public/workbox-*.js
|
||||
**/public/sw.js
|
||||
**/public/fallback-*.js
|
||||
# Build outputs and caches (all workspaces)
|
||||
**/.next/
|
||||
**/out/
|
||||
**/coverage/
|
||||
**/*.tsbuildinfo
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Run VSCode Extension (apps/vscode)",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}/apps/vscode"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/apps/vscode/build/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "build vscode extension"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build vscode extension",
|
||||
"type": "shell",
|
||||
"command": "pnpm run build:vscode",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "watch vscode extension",
|
||||
"type": "shell",
|
||||
"command": "pnpm run dev:vscode",
|
||||
"isBackground": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- PROJECT LOGO -->
|
||||
<p align="center">
|
||||
<a href="https://github.com/AykutSarac/jsoncrack.com">
|
||||
<img src="./public/assets/192.png" height="50" alt="Logo">
|
||||
<img src="./apps/www/public/assets/192.png" height="50" alt="Logo">
|
||||
</a>
|
||||
|
||||
<h1 align="center">JSON Crack</h1>
|
||||
@@ -28,13 +28,13 @@
|
||||
|
||||
## About the Project
|
||||
|
||||
<img width="100%" alt="booking-screen" src="./public/assets/editor.webp">
|
||||
<img width="100%" alt="booking-screen" src="./apps/www/public/assets/editor.webp">
|
||||
|
||||
## Visualize JSON into interactive graphs
|
||||
|
||||
JSON Crack is a tool for visualizing JSON data in a structured, interactive graphs, making it easier to explore, format, and validate JSON. It offers features like converting JSON to other formats (CSV, YAML), generating JSON Schema, executing queries, and exporting visualizations as images. Designed for both readability and usability.
|
||||
|
||||
* **Visualizer**: Instantly convert JSON, YAML, CSV, XML, and TOML into interactive graphs or trees in dark or light mode.
|
||||
* **Visualizer**: Instantly convert JSON, YAML, CSV, and XML into interactive graphs or trees in dark or light mode.
|
||||
* **Convert**: Seamlessly transform data formats, like JSON to CSV or XML to JSON, for easy sharing.
|
||||
* **Format & Validate**: Beautify and validate JSON, YAML, and CSV for clear and accurate data.
|
||||
* **Code Generation**: Generate TypeScript interfaces, Golang structs, and JSON Schema.
|
||||
@@ -55,12 +55,19 @@ JSON Crack is a tool for visualizing JSON data in a structured, interactive grap
|
||||
|
||||
<a href="https://producthunt.com/posts/JSON-Crack?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-jsoncrack" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=332281&theme=light" alt="JSON Crack | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
||||
|
||||
### Built With
|
||||
## Integrations
|
||||
|
||||
- [Next.js](https://nextjs.org/?ref=jsoncrack.com)
|
||||
- [React.js](https://reactjs.org/?ref=jsoncrack.com)
|
||||
- [Reaflow](https://reaflow.dev/?ref=jsoncrack.com)
|
||||
- [Monaco Editor](https://github.com/suren-atoyan/monaco-react)
|
||||
- [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=AykutSarac.jsoncrack-vscode)
|
||||
- [npm Package (`jsoncrack-react`)](https://www.npmjs.com/package/jsoncrack-react)
|
||||
|
||||
## Contributing
|
||||
|
||||
- Found a bug or missing feature? Open an issue on [GitHub Issues](https://github.com/AykutSarac/jsoncrack.com/issues).
|
||||
- Want to contribute code or docs? Start with our [contribution guide](./CONTRIBUTING.md).
|
||||
|
||||
## Sponsors & Support
|
||||
|
||||
If you find JSON Crack useful, you can support the project by using [ToDiagram](https://todiagram.com).
|
||||
|
||||
## Stay Up-to-Date
|
||||
|
||||
@@ -78,8 +85,8 @@ To get a local copy up and running, please follow these simple steps.
|
||||
|
||||
Here is what you need to be able to run JSON Crack.
|
||||
|
||||
- Node.js (Version: >=18.x)
|
||||
- Pnpm _(recommended)_
|
||||
- Node.js (Version: >=24.x)
|
||||
- pnpm (Version: >=10)
|
||||
|
||||
|
||||
## Development
|
||||
@@ -104,20 +111,53 @@ Here is what you need to be able to run JSON Crack.
|
||||
pnpm install
|
||||
```
|
||||
|
||||
4. Run the project
|
||||
4. Run the web app
|
||||
|
||||
```sh
|
||||
pnpm dev
|
||||
pnpm dev:www
|
||||
|
||||
# Running on http://localhost:3000/
|
||||
```
|
||||
|
||||
### Useful Commands
|
||||
|
||||
From repository root:
|
||||
|
||||
```sh
|
||||
# Web app
|
||||
pnpm dev:www
|
||||
pnpm build:www
|
||||
|
||||
# VS Code extension
|
||||
pnpm dev:vscode
|
||||
pnpm build:vscode
|
||||
pnpm lint:vscode
|
||||
pnpm lint:fix:vscode
|
||||
|
||||
# All workspaces
|
||||
pnpm dev
|
||||
pnpm build
|
||||
pnpm lint
|
||||
```
|
||||
|
||||
`pnpm build:www` is the production build command used in GitHub Actions deployment.
|
||||
|
||||
### Debug VS Code Extension
|
||||
|
||||
1. Open repository root in VS Code.
|
||||
2. Press `F5`.
|
||||
3. Select `Run VSCode Extension (apps/vscode)` when prompted.
|
||||
4. In the Extension Development Host window, open a `.json` file and run:
|
||||
`JSON Crack: Enable JSON Crack visualization`.
|
||||
|
||||
### Docker
|
||||
|
||||
🐳 A [`Dockerfile`](Dockerfile) is provided in the root of the repository.
|
||||
🐳 Docker assets are in `apps/www`.
|
||||
If you want to run JSON Crack locally:
|
||||
|
||||
```console
|
||||
cd apps/www
|
||||
|
||||
# Build a Docker image with:
|
||||
docker compose build
|
||||
|
||||
@@ -129,7 +169,7 @@ docker compose up
|
||||
|
||||
## Configuration
|
||||
|
||||
The supported node limit can be changed by editing the `NEXT_PUBLIC_NODE_LIMIT` value in the `.env` file at the project root.
|
||||
The supported node limit can be changed by editing `NEXT_PUBLIC_NODE_LIMIT` in `apps/www/.env`.
|
||||
|
||||
<!-- LICENSE -->
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
PUBLIC_URL=./
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint",
|
||||
"unused-imports",
|
||||
"prettier"
|
||||
],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"prettier",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
|
||||
"rules": {
|
||||
"@typescript-eslint/consistent-type-imports": "error",
|
||||
"unused-imports/no-unused-imports": "error",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"prettier/prettier": "error",
|
||||
"space-in-parens": "error",
|
||||
"no-empty": "error",
|
||||
"no-multiple-empty-lines": "error",
|
||||
"no-irregular-whitespace": "error",
|
||||
"strict": ["error", "never"],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"quotes": ["error", "double", { "avoidEscape": true }],
|
||||
"semi": ["error", "always"],
|
||||
"prefer-const": "error",
|
||||
"space-before-function-paren": [
|
||||
"error",
|
||||
{
|
||||
"anonymous": "always",
|
||||
"named": "never",
|
||||
"asyncArrow": "always"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ignorePatterns": ["build", "public", "scripts", "node_modules", "webpack.config.js"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
build/
|
||||
*.vsix
|
||||
@@ -0,0 +1,9 @@
|
||||
.github
|
||||
.next
|
||||
node_modules/
|
||||
out
|
||||
public
|
||||
*-lock.json
|
||||
tsconfig.json
|
||||
build
|
||||
jsoncrack
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// A launch configuration that compiles the extension and then opens it inside a new window
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Run Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/build/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "build extension"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"files.exclude": {
|
||||
"build": false
|
||||
},
|
||||
"search.exclude": {
|
||||
"build": true
|
||||
},
|
||||
"typescript.tsc.autoDetect": "off"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build extension",
|
||||
"type": "shell",
|
||||
"command": "pnpm run build",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "watch extension",
|
||||
"type": "shell",
|
||||
"command": "pnpm run watch"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
.vscode/**
|
||||
.vscode-test/**
|
||||
.github/**
|
||||
.turbo/**
|
||||
node_modules/**
|
||||
scripts/**
|
||||
src/**
|
||||
.gitignore
|
||||
.env
|
||||
.prettierignore
|
||||
.prettierrc
|
||||
.pnpm-lock.yaml
|
||||
webpack.config.js
|
||||
tsconfig.extension.json
|
||||
vsc-extension-quickstart.md
|
||||
yarn.lock
|
||||
**/tsconfig.json
|
||||
**/.eslintrc.json
|
||||
**/*.map
|
||||
**/*.ts
|
||||
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Aykut Saraç
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,33 @@
|
||||
<img src="https://github.com/AykutSarac/jsoncrack-vscode/assets/47941171/23b26537-7c4a-4029-af78-456dea0d0b04" width="300" alt="JSON Crack" />
|
||||
|
||||
<hr />
|
||||
|
||||
[JSON Crack](https://jsoncrack.com?utm_source=jsoncrack-vscode&utm_medium=readme)'s Official Visual Studio Code Extension that visualizes JSON data as an interactive diagram. The extension parses the open JSON file and displays its structure as a connected graph where nodes represent objects, arrays, and values.
|
||||
|
||||
## How to use?
|
||||
|
||||
1. Install the JSON Crack extension from the [VS Code marketplace](https://marketplace.visualstudio.com/items?itemName=AykutSarac.jsoncrack-vscode).
|
||||
2. Open a JSON file.
|
||||
3. Click on the JSON Crack icon in the menubar at top right.
|
||||
|
||||
<img width="600" alt="image" src="https://github.com/AykutSarac/jsoncrack-vscode/assets/47941171/06715ac1-2403-402f-b3fa-3d91e1c9196a">
|
||||
|
||||
## Privacy
|
||||
|
||||
The extension works **fully offline**. No data is sent to any server. All JSON parsing and visualization happens locally in your editor.
|
||||
|
||||
## Debugging
|
||||
|
||||
This extension lives in `apps/vscode` inside the [jsoncrack.com](https://github.com/AykutSarac/jsoncrack.com) monorepo.
|
||||
|
||||
**Prerequisites:** Node.js `>=24`, pnpm `>=10`
|
||||
|
||||
```sh
|
||||
# Install dependencies from repo root
|
||||
pnpm install
|
||||
|
||||
# Watch mode — rebuilds on every change
|
||||
pnpm dev:vscode
|
||||
```
|
||||
|
||||
Then press **F5** in VS Code to launch the Extension Development Host. Keep the watch process running for live iteration.
|
||||
@@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" color="#7d8590" viewBox="0 0 600 600" version="1.0">
|
||||
<defs>
|
||||
<clipPath id="a">
|
||||
<path d="M300 0C134.316 0 0 134.316 0 300s134.316 300 300 300 300-134.316 300-300S465.684 0 300 0Zm0 0"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g clip-path="url(#a)">
|
||||
<path fill="none" d="M300 0C134.316 0 0 134.316 0 300s134.316 300 300 300 300-134.316 300-300S465.684 0 300 0Zm0 0" stroke="currentColor" stroke-width="60"/>
|
||||
</g>
|
||||
<path d="M150.071 174.797c-.449-.218-.34-.379.328-.484.664-.113 2.438-.172 5.313-.172h70.062v98.61l-.328 98.968-1.328 5.64c-2.656 9.962-7.586 18.813-14.781 26.563-7.188 7.75-15.766 13.285-25.734 16.61-3.98 1.539-8.184 2.535-12.61 2.984-2.219.219-5.875.328-10.969.328h-47.812v-52.469h15.281l15.266-.328 3.984-1.656c4.656-2.437 8.086-6.086 10.297-10.953l1.656-3.328V182.438l-1.656-2.328c-1.773-2.656-4.094-4.426-6.969-5.313ZM380.852 172.141h5.313c10.844 0 21.36 1.496 31.547 4.484 10.187 2.993 19.484 7.368 27.89 13.125 8.414 5.75 15.723 12.836 21.922 21.25 6.196 8.407 10.735 18.04 13.61 28.891.882 3.762 1.546 6.918 1.984 9.469.445 2.543.672 4.586.672 6.125v2h-65.75l-1.328-3.328c-1.324-4.426-3.371-8.961-6.14-13.61-2.774-4.644-5.704-7.968-8.798-9.968-4.648-3.977-10.953-6.41-18.922-7.297l-2-.328Zm-14.937.328c.437-.219 1.765-.328 3.984-.328h2.313v49.813l-3.313 1.328c-6.418 2.437-12.172 6.922-17.265 13.453-5.094 6.531-9.188 14.777-12.282 24.734-1.773 5.531-2.992 11.899-3.656 19.094-.668 7.2-.777 15-.328 23.406.219 5.313.77 11.403 1.656 18.266a122.09 122.09 0 0 0 4.313 20.094c1.988 6.53 4.695 12.511 8.125 17.937 3.437 5.418 7.922 9.453 13.453 12.11a31.7 31.7 0 0 0 3.484 1.171c1.219.325 2.383.711 3.5 1.157l2.985.656v50.484l-5.313-.344c-30.105-1.773-53.683-11.12-70.734-28.046-17.043-16.938-27.559-39.688-31.547-68.25-.219-2.207-.438-4.973-.656-8.297-.22-3.32-.329-7.414-.329-12.282-.449-9.968-.449-17.492 0-22.578 2.875-30.55 12.942-55.843 30.204-75.875 17.27-20.039 41.07-32.61 71.406-37.703Zm51.14 169.688.985-2.328h33.875c22.351-.438 33.531-.32 33.531.343 0 .438-.328 2.871-.984 7.297-2.219 12.399-6.153 23.414-11.797 33.047-5.649 9.625-12.68 17.758-21.094 24.39-8.406 6.645-17.98 11.739-28.719 15.282-10.73 3.539-22.293 5.426-34.687 5.656l-7.313.328V376.36l2.657-.328c8.632-1.102 15.609-4.094 20.921-8.97 5.977-6.194 10.188-14.5 12.625-24.905Zm0 0" fill="currentColor"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" color="#424242" viewBox="0 0 600 600" version="1.0">
|
||||
<defs>
|
||||
<clipPath id="a">
|
||||
<path d="M300 0C134.316 0 0 134.316 0 300s134.316 300 300 300 300-134.316 300-300S465.684 0 300 0Zm0 0"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g clip-path="url(#a)">
|
||||
<path fill="none" d="M300 0C134.316 0 0 134.316 0 300s134.316 300 300 300 300-134.316 300-300S465.684 0 300 0Zm0 0" stroke="currentColor" stroke-width="60"/>
|
||||
</g>
|
||||
<path d="M150.071 174.797c-.449-.218-.34-.379.328-.484.664-.113 2.438-.172 5.313-.172h70.062v98.61l-.328 98.968-1.328 5.64c-2.656 9.962-7.586 18.813-14.781 26.563-7.188 7.75-15.766 13.285-25.734 16.61-3.98 1.539-8.184 2.535-12.61 2.984-2.219.219-5.875.328-10.969.328h-47.812v-52.469h15.281l15.266-.328 3.984-1.656c4.656-2.437 8.086-6.086 10.297-10.953l1.656-3.328V182.438l-1.656-2.328c-1.773-2.656-4.094-4.426-6.969-5.313ZM380.852 172.141h5.313c10.844 0 21.36 1.496 31.547 4.484 10.187 2.993 19.484 7.368 27.89 13.125 8.414 5.75 15.723 12.836 21.922 21.25 6.196 8.407 10.735 18.04 13.61 28.891.882 3.762 1.546 6.918 1.984 9.469.445 2.543.672 4.586.672 6.125v2h-65.75l-1.328-3.328c-1.324-4.426-3.371-8.961-6.14-13.61-2.774-4.644-5.704-7.968-8.798-9.968-4.648-3.977-10.953-6.41-18.922-7.297l-2-.328Zm-14.937.328c.437-.219 1.765-.328 3.984-.328h2.313v49.813l-3.313 1.328c-6.418 2.437-12.172 6.922-17.265 13.453-5.094 6.531-9.188 14.777-12.282 24.734-1.773 5.531-2.992 11.899-3.656 19.094-.668 7.2-.777 15-.328 23.406.219 5.313.77 11.403 1.656 18.266a122.09 122.09 0 0 0 4.313 20.094c1.988 6.53 4.695 12.511 8.125 17.937 3.437 5.418 7.922 9.453 13.453 12.11a31.7 31.7 0 0 0 3.484 1.171c1.219.325 2.383.711 3.5 1.157l2.985.656v50.484l-5.313-.344c-30.105-1.773-53.683-11.12-70.734-28.046-17.043-16.938-27.559-39.688-31.547-68.25-.219-2.207-.438-4.973-.656-8.297-.22-3.32-.329-7.414-.329-12.282-.449-9.968-.449-17.492 0-22.578 2.875-30.55 12.942-55.843 30.204-75.875 17.27-20.039 41.07-32.61 71.406-37.703Zm51.14 169.688.985-2.328h33.875c22.351-.438 33.531-.32 33.531.343 0 .438-.328 2.871-.984 7.297-2.219 12.399-6.153 23.414-11.797 33.047-5.649 9.625-12.68 17.758-21.094 24.39-8.406 6.645-17.98 11.739-28.719 15.282-10.73 3.539-22.293 5.426-34.687 5.656l-7.313.328V376.36l2.657-.328c8.632-1.102 15.609-4.094 20.921-8.97 5.977-6.194 10.188-14.5 12.625-24.905Zm0 0" fill="currentColor"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 66 KiB |
@@ -0,0 +1,114 @@
|
||||
import * as path from "path";
|
||||
import * as vscode from "vscode";
|
||||
import { createWebviewPanel } from "./webview";
|
||||
|
||||
function getPanelTitle(document?: vscode.TextDocument) {
|
||||
if (!document) return "JSON Crack";
|
||||
|
||||
const fileName = path.basename(document.fileName);
|
||||
return fileName || "JSON Crack";
|
||||
}
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand("jsoncrack-vscode.start", () =>
|
||||
createWebviewForActiveEditor(context)
|
||||
),
|
||||
vscode.commands.registerCommand("jsoncrack-vscode.start.specific", (content?: string) =>
|
||||
createWebviewForContent(context, content)
|
||||
),
|
||||
vscode.commands.registerCommand("jsoncrack-vscode.start.selected", () =>
|
||||
createWebviewForSelectedText(context)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// create webview for selected text
|
||||
async function createWebviewForSelectedText(context: vscode.ExtensionContext) {
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
|
||||
if (editor && editor.selection.isEmpty) {
|
||||
vscode.window.showInformationMessage("Please select some text first!");
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedText = editor?.document.getText(editor.selection);
|
||||
|
||||
// Create the webview panel and send the selected JSON content
|
||||
const panel = createWebviewPanel(context, getPanelTitle(editor?.document));
|
||||
panel.webview.postMessage({
|
||||
json: selectedText,
|
||||
});
|
||||
|
||||
const onReceiveMessage = panel.webview.onDidReceiveMessage(e => {
|
||||
if (e === "ready") {
|
||||
panel.webview.postMessage({
|
||||
json: selectedText,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const onTextChange = vscode.workspace.onDidChangeTextDocument(changeEvent => {
|
||||
if (changeEvent.document === editor?.document) {
|
||||
panel.webview.postMessage({
|
||||
json: changeEvent.document.getText(editor?.selection),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const disposer = () => {
|
||||
onTextChange.dispose();
|
||||
onReceiveMessage.dispose();
|
||||
};
|
||||
|
||||
panel.onDidDispose(disposer, null, context.subscriptions);
|
||||
}
|
||||
|
||||
async function createWebviewForActiveEditor(context: vscode.ExtensionContext) {
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
const panel = createWebviewPanel(context, getPanelTitle(editor?.document));
|
||||
|
||||
const onReceiveMessage = panel.webview.onDidReceiveMessage(e => {
|
||||
if (e === "ready") {
|
||||
panel.webview.postMessage({
|
||||
json: editor?.document.getText(),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const onTextChange = vscode.workspace.onDidChangeTextDocument(changeEvent => {
|
||||
if (changeEvent.document === editor?.document) {
|
||||
panel.webview.postMessage({
|
||||
json: changeEvent.document.getText(),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const disposer = () => {
|
||||
onTextChange.dispose();
|
||||
onReceiveMessage.dispose();
|
||||
};
|
||||
|
||||
panel.onDidDispose(disposer, null, context.subscriptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a readonly diagram from a string
|
||||
* @param context ExtensionContext
|
||||
* @param content JSON content as a string
|
||||
*/
|
||||
function createWebviewForContent(context?: vscode.ExtensionContext, content?: string): any {
|
||||
if (context && content) {
|
||||
const panel = createWebviewPanel(
|
||||
context,
|
||||
getPanelTitle(vscode.window.activeTextEditor?.document)
|
||||
);
|
||||
panel.webview.postMessage({
|
||||
json: content,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// This method is called when your extension is deactivated
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
export function deactivate() {}
|
||||
@@ -0,0 +1,73 @@
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as vscode from "vscode";
|
||||
|
||||
export function createWebviewPanel(context: vscode.ExtensionContext, title = "JSON Crack") {
|
||||
const extPath = context.extensionPath;
|
||||
|
||||
const panel = vscode.window.createWebviewPanel(
|
||||
"liveHTMLPreviewer",
|
||||
title,
|
||||
vscode.ViewColumn.Beside,
|
||||
{
|
||||
enableScripts: true,
|
||||
retainContextWhenHidden: true,
|
||||
localResourceRoots: [
|
||||
vscode.Uri.file(path.join(extPath, "build")),
|
||||
vscode.Uri.file(path.join(extPath, "build", "static")),
|
||||
vscode.Uri.file(path.join(extPath, "build", "static", "js")),
|
||||
vscode.Uri.file(path.join(extPath, "build", "static", "css")),
|
||||
vscode.Uri.file(path.join(extPath, "assets")),
|
||||
],
|
||||
}
|
||||
);
|
||||
panel.iconPath = vscode.Uri.file(path.join(extPath, "build", "assets", "favicon.ico"));
|
||||
|
||||
const manifest = JSON.parse(
|
||||
fs.readFileSync(path.join(extPath, "build", "asset-manifest.json"), "utf-8")
|
||||
);
|
||||
|
||||
const mainScript = manifest.files["main.js"];
|
||||
const mainStyle = manifest.files["main.css"];
|
||||
|
||||
const scriptPathOnDisk = vscode.Uri.file(path.join(extPath, "build", mainScript));
|
||||
const stylePathOnDisk = vscode.Uri.file(path.join(extPath, "build", mainStyle));
|
||||
|
||||
const stylesMainUri = panel.webview.asWebviewUri(stylePathOnDisk);
|
||||
const scriptUri = panel.webview.asWebviewUri(scriptPathOnDisk);
|
||||
|
||||
const nonce = getNonce();
|
||||
const csp = [
|
||||
`default-src 'self' ${panel.webview.cspSource} blob:`,
|
||||
`connect-src ${panel.webview.cspSource} blob:`,
|
||||
`script-src 'unsafe-eval' 'unsafe-inline' ${panel.webview.cspSource}`,
|
||||
`style-src ${panel.webview.cspSource} 'unsafe-inline'`,
|
||||
`worker-src ${panel.webview.cspSource} blob: data:`,
|
||||
].join("; ");
|
||||
|
||||
panel.webview.html = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<base href="${panel.webview.asWebviewUri(vscode.Uri.file(path.join(extPath, "build")))}/">
|
||||
<meta http-equiv="Content-Security-Policy" content="${csp}">
|
||||
<link href="${stylesMainUri}" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<script nonce="${nonce}" src="${scriptUri}"></script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
function getNonce() {
|
||||
let text = "";
|
||||
const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
for (let i = 0; i < 32; i++) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
return text;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
{
|
||||
"name": "vscode",
|
||||
"version": "3.0.0",
|
||||
"displayName": "JSON Crack",
|
||||
"description": "Seamlessly visualize your JSON data instantly into graphs.",
|
||||
"publisher": "AykutSarac",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"email": "aykutsarac0@gmail.com",
|
||||
"name": "Aykut Saraç"
|
||||
},
|
||||
"homepage": "https://jsoncrack.com",
|
||||
"icon": "assets/jsoncrack.png",
|
||||
"galleryBanner": {
|
||||
"color": "#202225",
|
||||
"theme": "dark"
|
||||
},
|
||||
"categories": [
|
||||
"Visualization"
|
||||
],
|
||||
"keywords": [
|
||||
"json",
|
||||
"visualizer",
|
||||
"jsoncrack",
|
||||
"data",
|
||||
"yaml",
|
||||
"livepreview"
|
||||
],
|
||||
"activationEvents": [
|
||||
"workspaceContains:**/*.{json}"
|
||||
],
|
||||
"main": "./build/ext-src/extension.js",
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "jsoncrack-vscode.start",
|
||||
"title": "Enable JSON Crack visualization",
|
||||
"category": "menubar",
|
||||
"icon": {
|
||||
"light": "./assets/icon-light.svg",
|
||||
"dark": "./assets/icon-dark.svg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command": "jsoncrack-vscode.start.specific",
|
||||
"title": "Enable JSON Crack visualization for specific file",
|
||||
"category": "menubar"
|
||||
},
|
||||
{
|
||||
"command": "jsoncrack-vscode.start.selected",
|
||||
"title": "Open with JSON Crack",
|
||||
"category": "Navigation"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
"editor/context": [
|
||||
{
|
||||
"command": "jsoncrack-vscode.start.selected",
|
||||
"when": "editorHasSelection",
|
||||
"group": "navigation"
|
||||
}
|
||||
],
|
||||
"commandPalette": [
|
||||
{
|
||||
"command": "jsoncrack-vscode.start",
|
||||
"when": "never"
|
||||
}
|
||||
],
|
||||
"editor/title": [
|
||||
{
|
||||
"command": "jsoncrack-vscode.start",
|
||||
"when": "resourceExtname == .json || editorLangId == json",
|
||||
"group": "navigation"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "pnpm run build",
|
||||
"dev": "react-scripts start",
|
||||
"start": "react-scripts start",
|
||||
"compile": "webpack --mode development",
|
||||
"watch": "webpack --mode development --watch",
|
||||
"package": "webpack --mode production --devtool hidden-source-map",
|
||||
"analyze": "ANALYZE=true pnpm run build",
|
||||
"lint": "eslint src ext-src && prettier --check src ext-src",
|
||||
"lint:fix": "eslint --fix src ext-src && prettier --write src ext-src",
|
||||
"build": "node ./scripts/build-non-split.js && tsc -p tsconfig.extension.json",
|
||||
"clean": "rm -rf build",
|
||||
"watch-build": "nodemon --watch src --watch ext-src --watch scripts --ext js,tsx,ts --exec \"pnpm run build\"",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
||||
"@mantine/code-highlight": "^7.16.2",
|
||||
"@mantine/core": "^7.16.2",
|
||||
"@mantine/hooks": "^7.16.2",
|
||||
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
||||
"@types/node": "16.x",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"@types/vscode": "^1.86.0",
|
||||
"@types/webpack-env": "^1.18.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
||||
"@typescript-eslint/parser": "^5.31.0",
|
||||
"eslint": "^8.20.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-unused-imports": "^4.1.4",
|
||||
"nodemon": "^2.0.20",
|
||||
"prettier": "^3.3.3",
|
||||
"react-scripts": "^5.0.1",
|
||||
"rewire": "^7.0.0",
|
||||
"ts-loader": "^9.5.1",
|
||||
"typescript": "^5.6.3",
|
||||
"vsce": "^2.15.0",
|
||||
"webpack": "^5.95.0",
|
||||
"webpack-cli": "^5.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"jsoncrack-react": "workspace:*",
|
||||
"react": "19.2.4",
|
||||
"react-dom": "19.2.4"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/AykutSarac/jsoncrack-vscode"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/AykutSarac/jsoncrack-vscode/issues"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.86.0"
|
||||
},
|
||||
"packageManager": "pnpm@10.20.0"
|
||||
}
|
||||
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="#000000">
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
You need to enable JavaScript to run this app.
|
||||
</noscript>
|
||||
<div id="root"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const path = require("path");
|
||||
const rewire = require("rewire");
|
||||
const defaults = rewire("react-scripts/scripts/build.js");
|
||||
let config = defaults.__get__("config");
|
||||
|
||||
// Disable source maps
|
||||
config.devtool = false;
|
||||
|
||||
// Disable code splitting
|
||||
config.optimization.splitChunks = {
|
||||
cacheGroups: {
|
||||
default: false
|
||||
}
|
||||
};
|
||||
|
||||
config.optimization.runtimeChunk = false;
|
||||
|
||||
// Enable tree shaking
|
||||
config.optimization.usedExports = true;
|
||||
|
||||
// Force a single React instance in the bundle. Without this, workspace-linked
|
||||
// packages can resolve a different React version and break hooks at runtime.
|
||||
config.resolve.alias = {
|
||||
...(config.resolve.alias || {}),
|
||||
react: path.resolve(__dirname, "../node_modules/react"),
|
||||
"react-dom": path.resolve(__dirname, "../node_modules/react-dom")
|
||||
};
|
||||
|
||||
config.resolve.plugins = (config.resolve.plugins || []).filter(
|
||||
(plugin) => plugin.constructor.name !== "ModuleScopePlugin"
|
||||
);
|
||||
|
||||
// Ensure production optimizations are enabled
|
||||
config.mode = 'production';
|
||||
config.optimization.minimize = true;
|
||||
|
||||
// Allow extensionless imports from ESM dependencies.
|
||||
config.module.rules.push({
|
||||
test: /\.m?js$/,
|
||||
resolve: {
|
||||
fullySpecified: false
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Anchor, Box, MantineProvider, Text } from "@mantine/core";
|
||||
import type { NodeData } from "jsoncrack-react";
|
||||
import { JsonCrack } from "jsoncrack-react";
|
||||
import { NodeModal } from "./components/NodeModal";
|
||||
|
||||
function getTheme() {
|
||||
const theme = document.body.getAttribute("data-vscode-theme-kind");
|
||||
if (theme?.includes("light")) return "light" as const;
|
||||
return "dark";
|
||||
}
|
||||
|
||||
const App: React.FC = () => {
|
||||
const [json, setJson] = useState("{}");
|
||||
const [selectedNode, setSelectedNode] = useState<NodeData | null>(null);
|
||||
const theme = getTheme();
|
||||
|
||||
useEffect(() => {
|
||||
const vscode = window?.acquireVsCodeApi?.();
|
||||
vscode?.postMessage("ready");
|
||||
|
||||
const onMessage = (event: MessageEvent<{ json?: string }>) => {
|
||||
const jsonData = event.data?.json;
|
||||
if (typeof jsonData === "string") {
|
||||
setJson(jsonData);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("message", onMessage);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("message", onMessage);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const handleNodeClick = useCallback((node: NodeData) => {
|
||||
setSelectedNode(node);
|
||||
}, []);
|
||||
|
||||
const closeNodeModal = useCallback(() => {
|
||||
setSelectedNode(null);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<MantineProvider forceColorScheme={theme}>
|
||||
<Box h="100vh" w="100vw">
|
||||
<JsonCrack json={json} theme={theme} showControls={false} onNodeClick={handleNodeClick} />
|
||||
{selectedNode && (
|
||||
<NodeModal opened={!!selectedNode} onClose={closeNodeModal} nodeData={selectedNode} />
|
||||
)}
|
||||
<Anchor
|
||||
pos="fixed"
|
||||
bottom={0}
|
||||
left={0}
|
||||
href="https://jsoncrack.com/editor?utm_source=vscode&utm_campaign=attribute"
|
||||
target="_blank"
|
||||
>
|
||||
<Box px="12" py="4" bg="dark">
|
||||
<Text fz="sm" c="white">
|
||||
Powered by JSON Crack
|
||||
</Text>
|
||||
</Box>
|
||||
</Anchor>
|
||||
</Box>
|
||||
</MantineProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
acquireVsCodeApi?: () => any;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import React from "react";
|
||||
import type { ModalProps } from "@mantine/core";
|
||||
import { Modal, Stack, Text, ScrollArea } from "@mantine/core";
|
||||
import { CodeHighlight } from "@mantine/code-highlight";
|
||||
import type { NodeData } from "jsoncrack-react";
|
||||
|
||||
interface NodeModalProps extends ModalProps {
|
||||
nodeData: NodeData | null;
|
||||
}
|
||||
|
||||
const normalizeNodeData = (nodeRows: NodeData["text"]) => {
|
||||
if (!nodeRows || nodeRows.length === 0) return "{}";
|
||||
if (nodeRows.length === 1 && !nodeRows[0].key) return `${nodeRows[0].value}`;
|
||||
|
||||
const obj: Record<string, unknown> = {};
|
||||
nodeRows.forEach(row => {
|
||||
if (row.type !== "array" && row.type !== "object" && row.key) {
|
||||
obj[row.key] = row.value;
|
||||
}
|
||||
});
|
||||
|
||||
return JSON.stringify(obj, null, 2);
|
||||
};
|
||||
|
||||
const jsonPathToString = (path?: NodeData["path"]) => {
|
||||
if (!path || path.length === 0) return "$";
|
||||
const segments = path.map(seg => (typeof seg === "number" ? seg : `"${seg}"`));
|
||||
return `$[${segments.join("][")}]`;
|
||||
};
|
||||
|
||||
export const NodeModal = ({ opened, onClose, nodeData }: NodeModalProps) => {
|
||||
const nodeContent = normalizeNodeData(nodeData?.text ?? []);
|
||||
const jsonPath = jsonPathToString(nodeData?.path);
|
||||
|
||||
return (
|
||||
<Modal title="Node Content" size="auto" opened={opened} onClose={onClose} centered>
|
||||
<Stack py="sm" gap="sm">
|
||||
<Stack gap="xs">
|
||||
<Text fz="xs" fw={500}>
|
||||
Content
|
||||
</Text>
|
||||
<ScrollArea.Autosize mah={250} maw={600}>
|
||||
<CodeHighlight code={nodeContent} miw={350} maw={600} language="json" withCopyButton />
|
||||
</ScrollArea.Autosize>
|
||||
</Stack>
|
||||
<Text fz="xs" fw={500}>
|
||||
JSON Path
|
||||
</Text>
|
||||
<ScrollArea.Autosize maw={600}>
|
||||
<CodeHighlight
|
||||
code={jsonPath}
|
||||
miw={350}
|
||||
mah={250}
|
||||
language="json"
|
||||
copyLabel="Copy to clipboard"
|
||||
copiedLabel="Copied to clipboard"
|
||||
withCopyButton
|
||||
/>
|
||||
</ScrollArea.Autosize>
|
||||
</Stack>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
html,
|
||||
body,
|
||||
#root {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import "@mantine/core/styles.css";
|
||||
import "@mantine/code-highlight/styles.css";
|
||||
import "jsoncrack-react/style.css";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import App from "./App";
|
||||
import "./global.css";
|
||||
|
||||
const container = document.getElementById("root") as HTMLElement;
|
||||
const root = createRoot(container);
|
||||
root.render(<App />);
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference types="react-scripts" />
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
acquireVsCodeApi?: () => any;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"outDir": "build",
|
||||
"lib": ["es6", "dom"],
|
||||
"sourceMap": true,
|
||||
"rootDir": ".",
|
||||
"strict": true
|
||||
},
|
||||
"include": ["ext-src"],
|
||||
"exclude": ["node_modules", ".vscode-test"]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"target": "ES6",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": false,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"noImplicitAny": false
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/** @typedef {import('webpack').Configuration} WebpackConfig **/
|
||||
|
||||
const webpack = require("webpack");
|
||||
const path = require("path");
|
||||
|
||||
/** @type WebpackConfig */
|
||||
const extensionConfig = {
|
||||
target: "node",
|
||||
mode: "none",
|
||||
entry: "./ext-src/extension.ts",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "build"),
|
||||
filename: "extension.js",
|
||||
libraryTarget: "commonjs2",
|
||||
},
|
||||
externals: {
|
||||
vscode: "commonjs vscode",
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.ts$/,
|
||||
exclude: [/node_modules/],
|
||||
use: [{
|
||||
loader: 'ts-loader'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.LimitChunkCountPlugin({
|
||||
maxChunks: 1, // disable chunks by default since web extensions must be a single bundle
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
process: "process/browser", // provide a shim for the global `process` variable
|
||||
}),
|
||||
],
|
||||
devtool: "nosources-source-map",
|
||||
performance: {
|
||||
hints: false
|
||||
},
|
||||
infrastructureLogging: {
|
||||
level: "log",
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = extensionConfig;
|
||||
@@ -0,0 +1,31 @@
|
||||
# App dependencies
|
||||
node_modules/
|
||||
|
||||
# Next.js
|
||||
.next/
|
||||
out/
|
||||
|
||||
# Turborepo task cache
|
||||
.turbo/
|
||||
|
||||
# Test/build artifacts
|
||||
coverage/
|
||||
build/
|
||||
*.tsbuildinfo
|
||||
|
||||
# Local environment files
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# Deployment
|
||||
.vercel
|
||||
|
||||
# Workspace migration artifact (root lockfile is authoritative)
|
||||
pnpm-lock.yaml
|
||||
|
||||
# PWA workers
|
||||
public/workbox-*.js
|
||||
public/sw.js
|
||||
public/fallback-*.js
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"trailingComma": "es5",
|
||||
"singleQuote": false,
|
||||
"semi": true,
|
||||
"printWidth": 100,
|
||||
"arrowParens": "avoid",
|
||||
"importOrder": [
|
||||
"^(react/(.*)$)|^(react$)",
|
||||
"^(next/(.*)$)|^(next$)",
|
||||
"^@mantine/core",
|
||||
"^@mantine",
|
||||
"styled",
|
||||
"<THIRD_PARTY_MODULES>",
|
||||
"^src/(.*)$",
|
||||
"^[./]"
|
||||
],
|
||||
"importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy"],
|
||||
"plugins": ["@trivago/prettier-plugin-sort-imports"]
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2025 Aykut Saraç
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/types/routes.d.ts";
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
|
||||
@@ -7,6 +7,7 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
|
||||
*/
|
||||
const config = {
|
||||
output: "export",
|
||||
transpilePackages: ["jsoncrack"],
|
||||
reactStrictMode: false,
|
||||
productionBrowserSourceMaps: true,
|
||||
compiler: {
|
||||
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"name": "www",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"dev": "next dev --webpack",
|
||||
"build": "next build --webpack",
|
||||
"postbuild": "next-sitemap --config next-sitemap.config.js",
|
||||
"start": "next start",
|
||||
"lint": "tsc --project tsconfig.json && eslint src && prettier --check src",
|
||||
"lint:fix": "eslint --fix src && prettier --write src",
|
||||
"analyze": "ANALYZE=true npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"jsoncrack-react": "workspace:*",
|
||||
"@mantine/code-highlight": "^8.3.14",
|
||||
"@mantine/core": "^8.3.14",
|
||||
"@mantine/dropzone": "^8.3.14",
|
||||
"@mantine/hooks": "^8.3.14",
|
||||
"@monaco-editor/react": "^4.7.0",
|
||||
"allotment": "^1.20.5",
|
||||
"fast-xml-parser": "5.3.4",
|
||||
"gofmt.js": "0.0.2",
|
||||
"html-to-image": "1.11.11",
|
||||
"jq-web": "0.5.1",
|
||||
"js-yaml": "4.1.1",
|
||||
"json-2-csv": "5.5.10",
|
||||
"json-schema-faker": "0.5.9",
|
||||
"json_typegen_wasm": "0.7.0",
|
||||
"jsonc-parser": "3.3.1",
|
||||
"jsonpath-plus": "10.3.0",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"next": "16.1.6",
|
||||
"next-seo": "^7.1.0",
|
||||
"next-sitemap": "^4.2.3",
|
||||
"nextjs-google-analytics": "^2.3.7",
|
||||
"react": "19.2.4",
|
||||
"react-dom": "19.2.4",
|
||||
"react-hot-toast": "^2.6.0",
|
||||
"react-icons": "^5.5.0",
|
||||
"react-json-tree": "^0.20.0",
|
||||
"react-linkify-it": "^2.0.0",
|
||||
"react-zoomable-ui": "^0.11.0",
|
||||
"reaflow": "5.4.1",
|
||||
"shiki": "^3.22.0",
|
||||
"styled-components": "^6.3.8",
|
||||
"use-sync-external-store": "^1.6.0",
|
||||
"use-long-press": "^3.3.0",
|
||||
"zustand": "^5.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3.2.0",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@next/bundle-analyzer": "16.1.6",
|
||||
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^25.2.0",
|
||||
"@types/react": "19.2.11",
|
||||
"@types/react-dom": "19.2.3",
|
||||
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-config-next": "16.1.6",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-prettier": "^5.5.5",
|
||||
"eslint-plugin-unused-imports": "^4.3.0",
|
||||
"prettier": "^3.8.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "5.9.3"
|
||||
},
|
||||
"packageManager": "pnpm@10.20.0"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 620 B After Width: | Height: | Size: 620 B |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 613 KiB After Width: | Height: | Size: 613 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 394 KiB After Width: | Height: | Size: 394 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -21,7 +21,7 @@
|
||||
},
|
||||
{
|
||||
"title": "What kind of data formats are supported?",
|
||||
"content": "A wide range of data formats are supported including JSON, YAML, XML, CSV, and TOML."
|
||||
"content": "A wide range of data formats are supported including JSON, YAML, XML, and CSV."
|
||||
},
|
||||
{
|
||||
"title": "What size of data can I visualize?",
|
||||
@@ -12,13 +12,7 @@ export const FullscreenDropzone = () => {
|
||||
return (
|
||||
<Dropzone.FullScreen
|
||||
maxFiles={1}
|
||||
accept={[
|
||||
"application/json",
|
||||
"application/x-yaml",
|
||||
"text/csv",
|
||||
"application/xml",
|
||||
"application/toml",
|
||||
]}
|
||||
accept={["application/json", "application/x-yaml", "text/csv", "application/xml"]}
|
||||
onReject={files => toast.error(`Unable to load file ${files[0].file.name}`)}
|
||||
onDrop={async e => {
|
||||
try {
|
||||
@@ -55,7 +49,7 @@ export const FullscreenDropzone = () => {
|
||||
Invalid file
|
||||
</Text>
|
||||
<Text fz="lg" c="dimmed" mt="sm">
|
||||
Allowed formats are JSON, YAML, CSV, XML, TOML
|
||||
Allowed formats are JSON, YAML, CSV, XML
|
||||
</Text>
|
||||
</Dropzone.Reject>
|
||||
</Group>
|
||||
@@ -10,7 +10,6 @@ const StyledLiveEditor = styled.div`
|
||||
height: 100%;
|
||||
background: ${({ theme }) => theme.GRID_BG_COLOR};
|
||||
overflow: auto;
|
||||
cursor: url("/assets/cursor.svg"), auto;
|
||||
|
||||
& > ul {
|
||||
margin-top: 0 !important;
|
||||
@@ -29,9 +29,14 @@ const TextEditor = () => {
|
||||
const getHasChanges = useFile(state => state.getHasChanges);
|
||||
const theme = useConfig(state => (state.darkmodeEnabled ? "vs-dark" : "light"));
|
||||
const fileType = useFile(state => state.format);
|
||||
const jsonDefaults = (monaco?.languages as any)?.json?.jsonDefaults as
|
||||
| { setDiagnosticsOptions: (options: unknown) => void }
|
||||
| undefined;
|
||||
|
||||
React.useEffect(() => {
|
||||
monaco?.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||
if (!jsonDefaults) return;
|
||||
|
||||
jsonDefaults.setDiagnosticsOptions({
|
||||
validate: true,
|
||||
allowComments: true,
|
||||
enableSchemaRequest: true,
|
||||
@@ -45,7 +50,7 @@ const TextEditor = () => {
|
||||
],
|
||||
}),
|
||||
});
|
||||
}, [jsonSchema, monaco?.languages.json.jsonDefaults]);
|
||||
}, [jsonDefaults, jsonSchema]);
|
||||
|
||||
React.useEffect(() => {
|
||||
const beforeunload = (e: BeforeUnloadEvent) => {
|
||||