@miman/json-schema-viewer-react 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +10 -13
- package/dist/index.js +9 -12
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),j=require("react");function q(){return`
|
|
2
|
-
|
|
2
|
+
.schema-container {
|
|
3
3
|
--bg-color: #1e1e1e;
|
|
4
4
|
--text-color: #d4d4d4;
|
|
5
5
|
--border-color: #3c3c3c;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
@media (prefers-color-scheme: light) {
|
|
22
|
-
|
|
22
|
+
.schema-container {
|
|
23
23
|
--bg-color: #ffffff;
|
|
24
24
|
--text-color: #333333;
|
|
25
25
|
--border-color: #e0e0e0;
|
|
@@ -39,24 +39,21 @@
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
margin: 0;
|
|
45
|
-
padding: 0;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
body {
|
|
42
|
+
.schema-container {
|
|
43
|
+
max-width: 1200px;
|
|
44
|
+
margin: 0 auto;
|
|
49
45
|
font-family: var(--vscode-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif);
|
|
50
46
|
font-size: 13px;
|
|
51
47
|
line-height: 1.5;
|
|
52
48
|
color: var(--text-color);
|
|
53
49
|
background-color: var(--bg-color);
|
|
54
50
|
padding: 16px;
|
|
51
|
+
box-sizing: border-box;
|
|
52
|
+
text-align: left;
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
.schema-container {
|
|
58
|
-
|
|
59
|
-
margin: 0 auto;
|
|
55
|
+
.schema-container * {
|
|
56
|
+
box-sizing: border-box;
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
.schema-header {
|
|
@@ -413,7 +410,7 @@
|
|
|
413
410
|
${f?`<div class="schema-meta-item"><span class="schema-meta-label">ID:</span><span class="schema-meta-value">${p(f)}</span></div>`:""}
|
|
414
411
|
</div>
|
|
415
412
|
${a.type?`<div class="root-type-badge type-${p(a.type)}">${p(a.type)}</div>`:""}
|
|
416
|
-
`,e.appendChild(i),a.properties){const o=document.createElement("div");o.innerHTML='<div class="section-title">Properties</div>';const u=a.required||[];E(o,a.properties,u,a,s),e.appendChild(o)}const m=a.definitions||a.$defs||{};if(Object.keys(m).length>0){const o=document.createElement("div");o.className="definitions-section",o.innerHTML='<div class="section-title">Definitions</div>';for(const[u,b]of Object.entries(m)){const
|
|
413
|
+
`,e.appendChild(i),a.properties){const o=document.createElement("div");o.innerHTML='<div class="section-title">Properties</div>';const u=a.required||[];E(o,a.properties,u,a,s),e.appendChild(o)}const m=a.definitions||a.$defs||{};if(Object.keys(m).length>0){const o=document.createElement("div");o.className="definitions-section",o.innerHTML='<div class="section-title">Definitions</div>';for(const[u,b]of Object.entries(m)){const x=z(String(u),b,a,s);o.appendChild(x)}e.appendChild(o)}if(d.length>0){const o=document.createElement("h2");o.className="section-title",o.textContent="Imported files",e.appendChild(o);const u=document.createElement("div");u.className="imported-files-container";const b=document.createElement("ul");d.forEach(x=>{const y=document.createElement("li");if(y.textContent=x,n.includes(x)){const $=document.createElement("span");$.className="missing-badge",$.textContent="file not found",y.appendChild(document.createTextNode(" ")),y.appendChild($)}b.appendChild(y)}),u.appendChild(b),e.appendChild(u)}}function E(e,t,a,s,d){for(const[n,i]of Object.entries(t)){const r=a.includes(n),l=I(n,i,r,s,d);e.appendChild(l)}}function I(e,t,a,s,d){const n=document.createElement("div");n.className="schema-object";const i=v(t,s,d),r=w(i),l=C(i),c=i.description||"",f=i.__isImported||h(t),m=i.__isMissing,o=document.createElement("div");if(o.className="schema-object-header",o.innerHTML=`
|
|
417
414
|
${l?'<svg class="expand-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>':'<div style="width: 24px;"></div>'}
|
|
418
415
|
<span class="property-name">${p(e)}</span>
|
|
419
416
|
<span class="property-type type-${p(r)}">${r==="missing"?"file not found":p(r)}</span>
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as M } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef as I, useMemo as S, useEffect as _ } from "react";
|
|
3
3
|
function T() {
|
|
4
4
|
return `
|
|
5
|
-
|
|
5
|
+
.schema-container {
|
|
6
6
|
--bg-color: #1e1e1e;
|
|
7
7
|
--text-color: #d4d4d4;
|
|
8
8
|
--border-color: #3c3c3c;
|
|
@@ -22,7 +22,7 @@ function T() {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
@media (prefers-color-scheme: light) {
|
|
25
|
-
|
|
25
|
+
.schema-container {
|
|
26
26
|
--bg-color: #ffffff;
|
|
27
27
|
--text-color: #333333;
|
|
28
28
|
--border-color: #e0e0e0;
|
|
@@ -42,24 +42,21 @@ function T() {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
margin: 0;
|
|
48
|
-
padding: 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
body {
|
|
45
|
+
.schema-container {
|
|
46
|
+
max-width: 1200px;
|
|
47
|
+
margin: 0 auto;
|
|
52
48
|
font-family: var(--vscode-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif);
|
|
53
49
|
font-size: 13px;
|
|
54
50
|
line-height: 1.5;
|
|
55
51
|
color: var(--text-color);
|
|
56
52
|
background-color: var(--bg-color);
|
|
57
53
|
padding: 16px;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
text-align: left;
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
.schema-container {
|
|
61
|
-
|
|
62
|
-
margin: 0 auto;
|
|
58
|
+
.schema-container * {
|
|
59
|
+
box-sizing: border-box;
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
.schema-header {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miman/json-schema-viewer-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "React component for visualizing JSON Schema files",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"react": "^18.0.0
|
|
24
|
-
"react-dom": "^18.0.0
|
|
23
|
+
"react": "^18.0.0",
|
|
24
|
+
"react-dom": "^18.0.0"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|