33 < head >
44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6- < title > JSONP - Multi tab JSON toolkit</ title >
7- < link rel ="icon " type ="image/svg+xml " href ="json.svg ">
6+ < title > JSONP - Multi tab JSON toolkit</ title >
7+ < link rel ="icon " type ="image/svg+xml " href ="json.svg " / >
88 < link rel ="stylesheet " href ="index.css " />
99 < link
1010 rel ="stylesheet "
1111 href ="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css "
1212 />
13+ < script
14+ src ="https://cdn.jsdelivr.net/npm/@faker-js/faker@8.4.0/+esm "
15+ type ="module "
16+ > </ script >
17+ < script type ="module ">
18+ import { faker } from "https://cdn.jsdelivr.net/npm/@faker-js/faker@8.4.0/+esm" ;
19+ window . faker = faker ;
20+ </ script >
21+ < script src ="https://cdn.jsdelivr.net/npm/marked/marked.min.js "> </ script >
1322 </ head >
1423 < body >
1524 < div class ="container ">
@@ -34,7 +43,10 @@ <h1>JSONP - Multi tab JSON toolkit</h1>
3443 JSON to Code
3544 </ button >
3645 < button id ="mode-convert-btn " onclick ="switchMode('convert') ">
37- Dict ⇄ JSON
46+ Dict ↔ JSON
47+ </ button >
48+ < button id ="mode-mockgen-btn " onclick ="switchMode('mockgen') ">
49+ Mock Data
3850 </ button >
3951 </ div >
4052 <!-- Formatter Section -->
@@ -101,6 +113,88 @@ <h1>JSONP - Multi tab JSON toolkit</h1>
101113 style ="margin-top: 10px "
102114 > </ pre >
103115 </ div >
116+ <!-- Mock Data Generator -->
117+ < div id ="mockgen-section " style ="display: none ">
118+ < h2 > Mock Data Generator</ h2 >
119+
120+ <!-- Tab Buttons -->
121+ < div style ="margin-bottom: 10px ">
122+ < button
123+ onclick ="switchMockTab('schema') "
124+ id ="mock-tab-schema "
125+ class ="active "
126+ >
127+ Schema Editor
128+ </ button >
129+ < button onclick ="switchMockTab('docs') " id ="mock-tab-docs ">
130+ Docs
131+ </ button >
132+ </ div >
133+
134+ <!-- Schema Panel -->
135+ < div id ="mockgen-schema-panel ">
136+ < label for ="mockgen-count "> Number of Records:</ label >
137+ < input
138+ type ="number "
139+ id ="mockgen-count "
140+ value ="1 "
141+ min ="1 "
142+ max ="1000 "
143+ style ="width: 60px "
144+ />
145+
146+ < select onchange ="loadMockPreset(this.value) ">
147+ < option value =""> -- Preset --</ option >
148+ < option value ="User "> User</ option >
149+ < option value ="Product "> Product</ option >
150+ </ select >
151+
152+ < div style ="margin-top: 10px ">
153+ < textarea
154+ id ="mock-schema-input "
155+ class ="json-input "
156+ placeholder ="Enter schema here... "
157+ > </ textarea >
158+ </ div >
159+
160+ < div style ="margin-top: 10px ">
161+ < button onclick ="generateMockData() "> Generate</ button >
162+ < button onclick ="copyMockOutput('json') "> Copy JSON</ button >
163+ < button onclick ="copyMockOutput('csv') "> Copy CSV</ button >
164+
165+ < label style ="margin-left: 20px ">
166+ < input
167+ type ="radio "
168+ name ="mock-view-mode "
169+ value ="json "
170+ checked
171+ onchange ="updateMockView() "
172+ />
173+ JSON
174+ </ label >
175+ < label >
176+ < input
177+ type ="radio "
178+ name ="mock-view-mode "
179+ value ="table "
180+ onchange ="updateMockView() "
181+ />
182+ Table
183+ </ label >
184+ </ div >
185+
186+ < p id ="mock-stats " style ="margin-top: 10px "> </ p >
187+
188+ < div id ="mock-output-container " style ="margin-top: 10px ">
189+ < pre id ="mock-output " class ="code-output "> </ pre >
190+ </ div >
191+ </ div >
192+
193+ <!-- Docs Panel -->
194+ < div id ="mockgen-docs-panel " style ="display: none; margin-top: 20px ">
195+ < div id ="mockgen-docs-preview " class ="markdown-preview "> </ div >
196+ </ div >
197+ </ div >
104198 </ div >
105199 <!-- Shortcut Modal -->
106200 < div id ="shortcut-modal " class ="modal ">
0 commit comments