Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mantine-json-view

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mantine-json-view - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

2

./dist/index.umd.js

@@ -1,1 +0,1 @@

(function(o,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("@mantine/core"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@mantine/core","react"],n):(o=typeof globalThis<"u"?globalThis:o||self,n(o.index={},o["react/jsx-runtime"],o["@mantine/core"],o.React))})(this,function(o,n,t,i){"use strict";const d=i.createContext({collapseIcons:()=>null,copyToClipboard:()=>null});function f({literal:e}){const{copyToClipboard:r}=i.useContext(d),s=i.useMemo(()=>{switch(e.type){case"null":return"null";case"undefined":return"undefined";case"string":return`"${e.value}"`;default:return e.value.toString()}},[e.type,e.value]);return n.jsxs(t.Flex,{sx:{alignItems:"center",gap:8},px:"xs",children:[n.jsxs(t.Text,{fz:"md",children:['"',e.key,'": ',s]}),r({value:s})]})}function p({object:e}){const{collapseIcons:r}=i.useContext(d),[s,l]=i.useState(!1);return n.jsxs(t.Flex,{direction:s?"row":"column",children:[n.jsxs(t.Flex,{sx:{gap:4,alignItems:"center"},children:[r({collapsed:s,setCollapsed:l}),n.jsxs(t.Flex,{sx:{alignItems:"center"},gap:"xs",children:[n.jsx(t.Text,{fz:"md",children:'"object": {'}),n.jsxs(t.Text,{c:"dimmed",children:[e.children.length," ",e.children.length!==1?"items":"item"]})]})]}),!s&&n.jsx(t.Flex,{direction:"column",px:"xs",children:e.children.map((c,a)=>{switch(c.type){case"array":return n.jsx(u,{array:c},a);case"object":return n.jsx(p,{object:c},a);default:return n.jsx(f,{literal:c},a)}})}),n.jsx(t.Text,{fz:"md",children:"}"})]})}function u({array:e}){const{collapseIcons:r}=i.useContext(d),[s,l]=i.useState(!1);return n.jsxs(t.Flex,{direction:s?"row":"column",px:"xs",children:[n.jsxs(t.Flex,{sx:{gap:4,alignItems:"center"},children:[r({collapsed:s,setCollapsed:l}),n.jsxs(t.Flex,{sx:{alignItems:"center"},gap:"xs",children:[n.jsx(t.Text,{fz:"md",children:'"array": ['}),n.jsxs(t.Text,{c:"dimmed",children:[e.children.length," ",e.children.length!==1?"items":"item"]})]})]}),!s&&n.jsx(t.Flex,{direction:"column",px:"xs",children:e.children.map((c,a)=>{switch(c.type){case"array":return n.jsx(u,{array:c},a);case"object":return n.jsx(p,{object:c},a);default:return n.jsx(f,{literal:c},a)}})}),n.jsx(t.Text,{fz:"md",children:"]"})]})}function x(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}function b(e){try{const r=JSON.parse(e);if(Array.isArray(r))return y(r);if(x(r))return h(r);throw new Error("Invalid json")}catch{throw new Error("Error parsing json")}}function h(e){return{type:"object",children:Object.entries(e).map(([r,s])=>g(r,s))}}function y(e){return{type:"array",children:Object.entries(e).map(([r,s])=>g(r,s))}}function g(e,r){if(x(r))return h(r);if(Array.isArray(r))return y(r);if(typeof r=="boolean")return{type:"boolean",key:e,value:r};if(typeof r=="number")return{type:"number",key:e,value:r};if(typeof r=="string")return{type:"string",key:e,value:r};if(r===void 0)return{type:"undefined",key:e,value:r};if(r===null)return{type:"null",key:e,value:r};throw new Error(`Unable to parse value: ${r}`)}const j={parse:b};function T(e){return{ast:i.useMemo(()=>j.parse(e),[e]),json:e}}function w({collapseIcons:e,copyToClipboard:r,json:s}){const{ast:l}=T(s);return n.jsx(d.Provider,{value:{collapseIcons:e,copyToClipboard:r},children:n.jsx(t.Code,{block:!0,children:l.type==="object"?n.jsx(p,{object:l}):n.jsx(u,{array:l})})})}o.JsonView=w,o.useJsonParser=T,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
(function(o,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("react/jsx-runtime"),require("@mantine/core"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@mantine/core","react"],r):(o=typeof globalThis<"u"?globalThis:o||self,r(o.index={},o["react/jsx-runtime"],o["@mantine/core"],o.React))})(this,function(o,r,t,c){"use strict";const a=c.createContext({collapseComponent:void 0,clipboardComponent:void 0});function u({literal:n}){const{clipboardComponent:e}=c.useContext(a),s=c.useMemo(()=>{switch(n.type){case"null":return"null";case"undefined":return"undefined";case"string":return`"${n.value}"`;default:return n.value.toString()}},[n.type,n.value]);return r.jsxs(t.Flex,{sx:{alignItems:"center",gap:8},px:"xs",children:[r.jsxs(t.Text,{fz:"md",children:['"',n.key,'": ',s]}),e!==void 0&&r.jsx(e,{value:s})]})}function p({object:n}){const{collapseComponent:e}=c.useContext(a),[s,l]=c.useState(!1);return r.jsxs(t.Flex,{direction:s?"row":"column",children:[r.jsxs(t.Flex,{sx:{gap:4,alignItems:"center"},children:[e!==void 0&&r.jsx(e,{collapsed:s,setCollapsed:l}),r.jsxs(t.Flex,{sx:{alignItems:"center"},gap:"xs",children:[r.jsx(t.Text,{fz:"md",children:'"object": {'}),r.jsxs(t.Text,{c:"dimmed",children:[n.children.length," ",n.children.length!==1?"items":"item"]})]})]}),!s&&r.jsx(t.Flex,{direction:"column",px:"xs",children:n.children.map((i,d)=>{switch(i.type){case"array":return r.jsx(f,{array:i},d);case"object":return r.jsx(p,{object:i},d);default:return r.jsx(u,{literal:i},d)}})}),r.jsx(t.Text,{fz:"md",children:"}"})]})}function f({array:n}){const{collapseComponent:e}=c.useContext(a),[s,l]=c.useState(!1);return r.jsxs(t.Flex,{direction:s?"row":"column",px:"xs",children:[r.jsxs(t.Flex,{sx:{gap:4,alignItems:"center"},children:[e!==void 0&&r.jsx(e,{collapsed:s,setCollapsed:l}),r.jsxs(t.Flex,{sx:{alignItems:"center"},gap:"xs",children:[r.jsx(t.Text,{fz:"md",children:'"array": ['}),r.jsxs(t.Text,{c:"dimmed",children:[n.children.length," ",n.children.length!==1?"items":"item"]})]})]}),!s&&r.jsx(t.Flex,{direction:"column",px:"xs",children:n.children.map((i,d)=>{switch(i.type){case"array":return r.jsx(f,{array:i},d);case"object":return r.jsx(p,{object:i},d);default:return r.jsx(u,{literal:i},d)}})}),r.jsx(t.Text,{fz:"md",children:"]"})]})}function x(n){return typeof n=="object"&&!Array.isArray(n)&&n!==null}function b(n){try{const e=JSON.parse(n);if(Array.isArray(e))return y(e);if(x(e))return h(e);throw new Error("Invalid json")}catch{throw new Error("Error parsing json")}}function h(n){return{type:"object",children:Object.entries(n).map(([e,s])=>C(e,s))}}function y(n){return{type:"array",children:Object.entries(n).map(([e,s])=>C(e,s))}}function C(n,e){if(x(e))return h(e);if(Array.isArray(e))return y(e);if(typeof e=="boolean")return{type:"boolean",key:n,value:e};if(typeof e=="number")return{type:"number",key:n,value:e};if(typeof e=="string")return{type:"string",key:n,value:e};if(e===void 0)return{type:"undefined",key:n,value:e};if(e===null)return{type:"null",key:n,value:e};throw new Error(`Unable to parse value: ${e}`)}const m={parse:b};function g(n){return{ast:c.useMemo(()=>m.parse(n),[n]),json:n}}function j({collapseComponent:n,clipboardComponent:e,json:s}){const{ast:l}=g(s);return r.jsx(a.Provider,{value:{collapseComponent:n,clipboardComponent:e},children:r.jsx(t.Code,{block:!0,children:l.type==="object"?r.jsx(p,{object:l}):r.jsx(f,{array:l})})})}o.JsonView=j,o.useJsonParser=g,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
import type { Props } from './JsonView.types';
declare function JsonView({ collapseIcons, copyToClipboard, json }: Props): import("react/jsx-runtime").JSX.Element;
declare function JsonView({ collapseComponent, clipboardComponent, json }: Props): import("react/jsx-runtime").JSX.Element;
export { JsonView };
import type { Context } from '../../context';
export interface Props {
copyToClipboard: Context['copyToClipboard'];
collapseIcons: Context['collapseIcons'];
clipboardComponent?: Context['clipboardComponent'];
collapseComponent?: Context['collapseComponent'];
json: string;
}

@@ -1,14 +0,14 @@

/// <reference types="react" />
interface CollapseIcons {
import type { FC } from 'react';
interface CollapseProps {
collapsed: boolean;
setCollapsed: (collapsed: boolean) => void;
}
interface CopyToClipboard {
interface ClipboardProps {
value: string;
}
export interface Context {
collapseIcons: (options: CollapseIcons) => JSX.Element | null;
copyToClipboard: (options: CopyToClipboard) => JSX.Element | null;
collapseComponent: FC<CollapseProps> | undefined;
clipboardComponent: FC<ClipboardProps> | undefined;
}
declare const JsonViewContext: import("react").Context<Context>;
export { JsonViewContext };

@@ -1,10 +0,10 @@

import { jsxs as o, jsx as t } from "react/jsx-runtime";
import { Flex as s, Text as a, Code as j } from "@mantine/core";
import { createContext as A, useContext as p, useMemo as m, useState as h } from "react";
const u = A({
collapseIcons: () => null,
copyToClipboard: () => null
import { jsxs as o, jsx as n } from "react/jsx-runtime";
import { Flex as s, Text as l, Code as w } from "@mantine/core";
import { createContext as j, useContext as d, useMemo as f, useState as h } from "react";
const p = j({
collapseComponent: void 0,
clipboardComponent: void 0
});
function y({ literal: r }) {
const { copyToClipboard: e } = p(u), n = m(() => {
const { clipboardComponent: e } = d(p), t = f(() => {
switch (r.type) {

@@ -30,9 +30,9 @@ case "null":

children: [
/* @__PURE__ */ o(a, { fz: "md", children: [
/* @__PURE__ */ o(l, { fz: "md", children: [
'"',
r.key,
'": ',
n
t
] }),
e({ value: n })
e !== void 0 && /* @__PURE__ */ n(e, { value: t })
]

@@ -42,10 +42,16 @@ }

}
function d({ object: r }) {
const { collapseIcons: e } = p(u), [n, i] = h(!1);
return /* @__PURE__ */ o(s, { direction: n ? "row" : "column", children: [
function u({ object: r }) {
const { collapseComponent: e } = d(p), [t, i] = h(!1);
return /* @__PURE__ */ o(s, { direction: t ? "row" : "column", children: [
/* @__PURE__ */ o(s, { sx: { gap: 4, alignItems: "center" }, children: [
e({ collapsed: n, setCollapsed: i }),
e !== void 0 && /* @__PURE__ */ n(
e,
{
collapsed: t,
setCollapsed: i
}
),
/* @__PURE__ */ o(s, { sx: { alignItems: "center" }, gap: "xs", children: [
/* @__PURE__ */ t(a, { fz: "md", children: '"object": {' }),
/* @__PURE__ */ o(a, { c: "dimmed", children: [
/* @__PURE__ */ n(l, { fz: "md", children: '"object": {' }),
/* @__PURE__ */ o(l, { c: "dimmed", children: [
r.children.length,

@@ -57,23 +63,29 @@ " ",

] }),
!n && /* @__PURE__ */ t(s, { direction: "column", px: "xs", children: r.children.map((c, l) => {
!t && /* @__PURE__ */ n(s, { direction: "column", px: "xs", children: r.children.map((c, a) => {
switch (c.type) {
case "array":
return /* @__PURE__ */ t(f, { array: c }, l);
return /* @__PURE__ */ n(m, { array: c }, a);
case "object":
return /* @__PURE__ */ t(d, { object: c }, l);
return /* @__PURE__ */ n(u, { object: c }, a);
default:
return /* @__PURE__ */ t(y, { literal: c }, l);
return /* @__PURE__ */ n(y, { literal: c }, a);
}
}) }),
/* @__PURE__ */ t(a, { fz: "md", children: "}" })
/* @__PURE__ */ n(l, { fz: "md", children: "}" })
] });
}
function f({ array: r }) {
const { collapseIcons: e } = p(u), [n, i] = h(!1);
return /* @__PURE__ */ o(s, { direction: n ? "row" : "column", px: "xs", children: [
function m({ array: r }) {
const { collapseComponent: e } = d(p), [t, i] = h(!1);
return /* @__PURE__ */ o(s, { direction: t ? "row" : "column", px: "xs", children: [
/* @__PURE__ */ o(s, { sx: { gap: 4, alignItems: "center" }, children: [
e({ collapsed: n, setCollapsed: i }),
e !== void 0 && /* @__PURE__ */ n(
e,
{
collapsed: t,
setCollapsed: i
}
),
/* @__PURE__ */ o(s, { sx: { alignItems: "center" }, gap: "xs", children: [
/* @__PURE__ */ t(a, { fz: "md", children: '"array": [' }),
/* @__PURE__ */ o(a, { c: "dimmed", children: [
/* @__PURE__ */ n(l, { fz: "md", children: '"array": [' }),
/* @__PURE__ */ o(l, { c: "dimmed", children: [
r.children.length,

@@ -85,13 +97,13 @@ " ",

] }),
!n && /* @__PURE__ */ t(s, { direction: "column", px: "xs", children: r.children.map((c, l) => {
!t && /* @__PURE__ */ n(s, { direction: "column", px: "xs", children: r.children.map((c, a) => {
switch (c.type) {
case "array":
return /* @__PURE__ */ t(f, { array: c }, l);
return /* @__PURE__ */ n(m, { array: c }, a);
case "object":
return /* @__PURE__ */ t(d, { object: c }, l);
return /* @__PURE__ */ n(u, { object: c }, a);
default:
return /* @__PURE__ */ t(y, { literal: c }, l);
return /* @__PURE__ */ n(y, { literal: c }, a);
}
}) }),
/* @__PURE__ */ t(a, { fz: "md", children: "]" })
/* @__PURE__ */ n(l, { fz: "md", children: "]" })
] });

@@ -102,3 +114,3 @@ }

}
function I(r) {
function A(r) {
try {

@@ -119,3 +131,3 @@ const e = JSON.parse(r);

children: Object.entries(r).map(
([e, n]) => w(e, n)
([e, t]) => C(e, t)
)

@@ -128,7 +140,7 @@ };

children: Object.entries(r).map(
([e, n]) => w(e, n)
([e, t]) => C(e, t)
)
};
}
function w(r, e) {
function C(r, e) {
if (g(e))

@@ -170,18 +182,18 @@ return x(e);

}
const T = {
parse: I
const J = {
parse: A
};
function C(r) {
function T(r) {
return {
ast: m(() => T.parse(r), [r]),
ast: f(() => J.parse(r), [r]),
json: r
};
}
function E({ collapseIcons: r, copyToClipboard: e, json: n }) {
const { ast: i } = C(n);
return /* @__PURE__ */ t(u.Provider, { value: { collapseIcons: r, copyToClipboard: e }, children: /* @__PURE__ */ t(j, { block: !0, children: i.type === "object" ? /* @__PURE__ */ t(d, { object: i }) : /* @__PURE__ */ t(f, { array: i }) }) });
function E({ collapseComponent: r, clipboardComponent: e, json: t }) {
const { ast: i } = T(t);
return /* @__PURE__ */ n(p.Provider, { value: { collapseComponent: r, clipboardComponent: e }, children: /* @__PURE__ */ n(w, { block: !0, children: i.type === "object" ? /* @__PURE__ */ n(u, { object: i }) : /* @__PURE__ */ n(m, { array: i }) }) });
}
export {
E as JsonView,
C as useJsonParser
T as useJsonParser
};

@@ -1,1 +0,1 @@

(function(o,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("@mantine/core"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@mantine/core","react"],n):(o=typeof globalThis<"u"?globalThis:o||self,n(o.index={},o["react/jsx-runtime"],o["@mantine/core"],o.React))})(this,function(o,n,t,i){"use strict";const d=i.createContext({collapseIcons:()=>null,copyToClipboard:()=>null});function f({literal:e}){const{copyToClipboard:r}=i.useContext(d),s=i.useMemo(()=>{switch(e.type){case"null":return"null";case"undefined":return"undefined";case"string":return`"${e.value}"`;default:return e.value.toString()}},[e.type,e.value]);return n.jsxs(t.Flex,{sx:{alignItems:"center",gap:8},px:"xs",children:[n.jsxs(t.Text,{fz:"md",children:['"',e.key,'": ',s]}),r({value:s})]})}function p({object:e}){const{collapseIcons:r}=i.useContext(d),[s,l]=i.useState(!1);return n.jsxs(t.Flex,{direction:s?"row":"column",children:[n.jsxs(t.Flex,{sx:{gap:4,alignItems:"center"},children:[r({collapsed:s,setCollapsed:l}),n.jsxs(t.Flex,{sx:{alignItems:"center"},gap:"xs",children:[n.jsx(t.Text,{fz:"md",children:'"object": {'}),n.jsxs(t.Text,{c:"dimmed",children:[e.children.length," ",e.children.length!==1?"items":"item"]})]})]}),!s&&n.jsx(t.Flex,{direction:"column",px:"xs",children:e.children.map((c,a)=>{switch(c.type){case"array":return n.jsx(u,{array:c},a);case"object":return n.jsx(p,{object:c},a);default:return n.jsx(f,{literal:c},a)}})}),n.jsx(t.Text,{fz:"md",children:"}"})]})}function u({array:e}){const{collapseIcons:r}=i.useContext(d),[s,l]=i.useState(!1);return n.jsxs(t.Flex,{direction:s?"row":"column",px:"xs",children:[n.jsxs(t.Flex,{sx:{gap:4,alignItems:"center"},children:[r({collapsed:s,setCollapsed:l}),n.jsxs(t.Flex,{sx:{alignItems:"center"},gap:"xs",children:[n.jsx(t.Text,{fz:"md",children:'"array": ['}),n.jsxs(t.Text,{c:"dimmed",children:[e.children.length," ",e.children.length!==1?"items":"item"]})]})]}),!s&&n.jsx(t.Flex,{direction:"column",px:"xs",children:e.children.map((c,a)=>{switch(c.type){case"array":return n.jsx(u,{array:c},a);case"object":return n.jsx(p,{object:c},a);default:return n.jsx(f,{literal:c},a)}})}),n.jsx(t.Text,{fz:"md",children:"]"})]})}function x(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null}function b(e){try{const r=JSON.parse(e);if(Array.isArray(r))return y(r);if(x(r))return h(r);throw new Error("Invalid json")}catch{throw new Error("Error parsing json")}}function h(e){return{type:"object",children:Object.entries(e).map(([r,s])=>g(r,s))}}function y(e){return{type:"array",children:Object.entries(e).map(([r,s])=>g(r,s))}}function g(e,r){if(x(r))return h(r);if(Array.isArray(r))return y(r);if(typeof r=="boolean")return{type:"boolean",key:e,value:r};if(typeof r=="number")return{type:"number",key:e,value:r};if(typeof r=="string")return{type:"string",key:e,value:r};if(r===void 0)return{type:"undefined",key:e,value:r};if(r===null)return{type:"null",key:e,value:r};throw new Error(`Unable to parse value: ${r}`)}const j={parse:b};function T(e){return{ast:i.useMemo(()=>j.parse(e),[e]),json:e}}function w({collapseIcons:e,copyToClipboard:r,json:s}){const{ast:l}=T(s);return n.jsx(d.Provider,{value:{collapseIcons:e,copyToClipboard:r},children:n.jsx(t.Code,{block:!0,children:l.type==="object"?n.jsx(p,{object:l}):n.jsx(u,{array:l})})})}o.JsonView=w,o.useJsonParser=T,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
(function(o,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("react/jsx-runtime"),require("@mantine/core"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@mantine/core","react"],r):(o=typeof globalThis<"u"?globalThis:o||self,r(o.index={},o["react/jsx-runtime"],o["@mantine/core"],o.React))})(this,function(o,r,t,c){"use strict";const a=c.createContext({collapseComponent:void 0,clipboardComponent:void 0});function u({literal:n}){const{clipboardComponent:e}=c.useContext(a),s=c.useMemo(()=>{switch(n.type){case"null":return"null";case"undefined":return"undefined";case"string":return`"${n.value}"`;default:return n.value.toString()}},[n.type,n.value]);return r.jsxs(t.Flex,{sx:{alignItems:"center",gap:8},px:"xs",children:[r.jsxs(t.Text,{fz:"md",children:['"',n.key,'": ',s]}),e!==void 0&&r.jsx(e,{value:s})]})}function p({object:n}){const{collapseComponent:e}=c.useContext(a),[s,l]=c.useState(!1);return r.jsxs(t.Flex,{direction:s?"row":"column",children:[r.jsxs(t.Flex,{sx:{gap:4,alignItems:"center"},children:[e!==void 0&&r.jsx(e,{collapsed:s,setCollapsed:l}),r.jsxs(t.Flex,{sx:{alignItems:"center"},gap:"xs",children:[r.jsx(t.Text,{fz:"md",children:'"object": {'}),r.jsxs(t.Text,{c:"dimmed",children:[n.children.length," ",n.children.length!==1?"items":"item"]})]})]}),!s&&r.jsx(t.Flex,{direction:"column",px:"xs",children:n.children.map((i,d)=>{switch(i.type){case"array":return r.jsx(f,{array:i},d);case"object":return r.jsx(p,{object:i},d);default:return r.jsx(u,{literal:i},d)}})}),r.jsx(t.Text,{fz:"md",children:"}"})]})}function f({array:n}){const{collapseComponent:e}=c.useContext(a),[s,l]=c.useState(!1);return r.jsxs(t.Flex,{direction:s?"row":"column",px:"xs",children:[r.jsxs(t.Flex,{sx:{gap:4,alignItems:"center"},children:[e!==void 0&&r.jsx(e,{collapsed:s,setCollapsed:l}),r.jsxs(t.Flex,{sx:{alignItems:"center"},gap:"xs",children:[r.jsx(t.Text,{fz:"md",children:'"array": ['}),r.jsxs(t.Text,{c:"dimmed",children:[n.children.length," ",n.children.length!==1?"items":"item"]})]})]}),!s&&r.jsx(t.Flex,{direction:"column",px:"xs",children:n.children.map((i,d)=>{switch(i.type){case"array":return r.jsx(f,{array:i},d);case"object":return r.jsx(p,{object:i},d);default:return r.jsx(u,{literal:i},d)}})}),r.jsx(t.Text,{fz:"md",children:"]"})]})}function x(n){return typeof n=="object"&&!Array.isArray(n)&&n!==null}function b(n){try{const e=JSON.parse(n);if(Array.isArray(e))return y(e);if(x(e))return h(e);throw new Error("Invalid json")}catch{throw new Error("Error parsing json")}}function h(n){return{type:"object",children:Object.entries(n).map(([e,s])=>C(e,s))}}function y(n){return{type:"array",children:Object.entries(n).map(([e,s])=>C(e,s))}}function C(n,e){if(x(e))return h(e);if(Array.isArray(e))return y(e);if(typeof e=="boolean")return{type:"boolean",key:n,value:e};if(typeof e=="number")return{type:"number",key:n,value:e};if(typeof e=="string")return{type:"string",key:n,value:e};if(e===void 0)return{type:"undefined",key:n,value:e};if(e===null)return{type:"null",key:n,value:e};throw new Error(`Unable to parse value: ${e}`)}const m={parse:b};function g(n){return{ast:c.useMemo(()=>m.parse(n),[n]),json:n}}function j({collapseComponent:n,clipboardComponent:e,json:s}){const{ast:l}=g(s);return r.jsx(a.Provider,{value:{collapseComponent:n,clipboardComponent:e},children:r.jsx(t.Code,{block:!0,children:l.type==="object"?r.jsx(p,{object:l}):r.jsx(f,{array:l})})})}o.JsonView=j,o.useJsonParser=g,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
{
"name": "mantine-json-view",
"version": "0.0.3",
"version": "0.0.4",
"engines": {

@@ -5,0 +5,0 @@ "node": "18",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc