mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 13:57:10 -04:00
1 line
3 KiB
JavaScript
1 line
3 KiB
JavaScript
import{_ as k}from"./chunk-6deddc2e.js";import{l as y}from"./chunk-231c3e11.js";import{a9 as _,d as J,r as S,g as f,c as O,j,D as N,E as w,m as r,l as m,q as a,S as c,F as V,_ as E}from"./chunk-449c23a2.js";import{w as z}from"./chunk-4d6daddf.js";import{u as C}from"./chunk-340feaf0.js";import{T as B}from"./chunk-f1ca2155.js";import{_ as P}from"./chunk-3ef38193.js";import{_ as U}from"./chunk-4515d3e7.js";import{_ as A}from"./chunk-aa4619b6.js";import"./chunk-9a43cce8.js";import"./chunk-a740628f.js";import"./chunk-767079b6.js";import"./chunk-55ba3dae.js";import"../entries/src_pages_Home.page.16dc467b.js";import"./chunk-cf010ec4.js";import"./chunk-ee54c1e8.js";import"./chunk-baa77311.js";import"./chunk-78769b89.js";import"./chunk-f823181b.js";import"./chunk-6222e43f.js";import"./chunk-2749dac9.js";import"./chunk-567e13ca.js";import"./chunk-1d5b5526.js";import"./chunk-416dc92c.js";import"./chunk-6d336811.js";import"./chunk-66ac4853.js";import"./chunk-015e5c20.js";import"./chunk-26a03a7a.js";import"./chunk-9519e52e.js";import"./chunk-f94e2689.js";import"./chunk-fc34c9a6.js";import"./chunk-af6e0163.js";import"./chunk-b0332f36.js";import"./chunk-f206ee20.js";import"./chunk-05af1949.js";function d(t){return typeof t!="object"||t===null?t:Array.isArray(t)?t.map(d):Object.keys(t).sort((o,e)=>o.localeCompare(e)).reduce((o,e)=>(o[e]=d(t[e]),o),{})}function D({rawJson:t,sortKeys:o=!0,indentSize:e=3}){const n=y.parse(_(t));return JSON.stringify(_(o)?d(n):n,null,_(e))}const F={style:{flex:"0 0 100%"}},I={style:{margin:"0 auto","max-width":"600px"},flex:"","justify-center":"","gap-3":""},K=J({__name:"json-viewer",setup(t){const o=S(),e=f("json-prettify:raw-json",'{"hello": "world", "foo": "bar"}'),n=f("json-prettify:indent-size",3),i=f("json-prettify:sort-keys",!0),g=O(()=>z(()=>D({rawJson:e,indentSize:n,sortKeys:i}),"")),v=C({source:e,rules:[{validator:u=>u===""||y.parse(u),message:"Provided JSON is not valid."}]});return(u,s)=>{const b=P,p=U,h=A,x=k;return j(),N(V,null,[w("div",F,[w("div",I,[r(p,{label:"Sort keys :","label-placement":"left","label-width":"100"},{default:m(()=>[r(b,{value:a(i),"onUpdate:value":s[0]||(s[0]=l=>c(i)?i.value=l:null)},null,8,["value"])]),_:1}),r(p,{label:"Indent size :","label-placement":"left","label-width":"100","show-feedback":!1},{default:m(()=>[r(h,{value:a(n),"onUpdate:value":s[1]||(s[1]=l=>c(n)?n.value=l:null),min:"0",max:"10",style:{width:"100px"}},null,8,["value"])]),_:1})])]),r(p,{label:"Your raw JSON",feedback:a(v).message,"validation-status":a(v).status},{default:m(()=>[r(x,{ref_key:"inputElement",ref:o,value:a(e),"onUpdate:value":s[2]||(s[2]=l=>c(e)?e.value=l:null),placeholder:"Paste your raw JSON here...",rows:"20",multiline:"",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",monospace:""},null,8,["value"])]),_:1},8,["feedback","validation-status"]),r(p,{label:"Prettified version of your JSON"},{default:m(()=>[r(B,{value:a(g),language:"json","follow-height-of":a(o)},null,8,["value","follow-height-of"])]),_:1})],64)}}});const xe=E(K,[["__scopeId","data-v-2c415be6"]]);export{xe as default};
|