@aimeloic/monkey-tester 2.0.4 → 2.0.5
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/htmlTemplate.js +22 -15
- package/package.json +1 -1
package/htmlTemplate.js
CHANGED
|
@@ -33,7 +33,7 @@ export function getHtmlTemplate(endpoints) {
|
|
|
33
33
|
font-family: 'DM Sans', sans-serif;
|
|
34
34
|
font-size: 14px;
|
|
35
35
|
height: 100vh;
|
|
36
|
-
overflow: hidden;
|
|
36
|
+
overflow: hidden; /* Prevents whole-page scrolling */
|
|
37
37
|
background-image: radial-gradient(ellipse 80% 60% at 50% -20%, #3a2a0a22 0%, transparent 70%);
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -59,6 +59,7 @@ export function getHtmlTemplate(endpoints) {
|
|
|
59
59
|
font-family: 'DM Mono', monospace; font-size: 12px; padding: 6px 12px; border-radius: var(--radius); width: 220px; outline: none;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/* Fixed view height viewport matrix layout grid rules */
|
|
62
63
|
.layout {
|
|
63
64
|
display: grid;
|
|
64
65
|
grid-template-columns: 280px 1fr 450px;
|
|
@@ -115,6 +116,7 @@ export function getHtmlTemplate(endpoints) {
|
|
|
115
116
|
.btn-secondary { background: var(--surface2); color: var(--text-dim); border: 1px solid var(--border); }
|
|
116
117
|
.btn-secondary:hover { color: var(--text); background: var(--surface); }
|
|
117
118
|
|
|
119
|
+
/* FIXED: Response block scroll logic layout rules */
|
|
118
120
|
.response-panel {
|
|
119
121
|
border-left: 1px solid var(--border);
|
|
120
122
|
display: flex;
|
|
@@ -129,6 +131,7 @@ export function getHtmlTemplate(endpoints) {
|
|
|
129
131
|
.status-err { background: #3a1a14; color: #d45c3c; }
|
|
130
132
|
.status-idle { background: var(--surface2); color: var(--text-dim); }
|
|
131
133
|
|
|
134
|
+
/* FIXED: Body panel scrolls y natively, inner token element handles x scrolling */
|
|
132
135
|
.response-body {
|
|
133
136
|
flex: 1;
|
|
134
137
|
overflow-y: auto;
|
|
@@ -146,6 +149,7 @@ export function getHtmlTemplate(endpoints) {
|
|
|
146
149
|
font-size: 13px;
|
|
147
150
|
}
|
|
148
151
|
|
|
152
|
+
/* FIXED: Token code output container handles micro horizontal data flows elegantly */
|
|
149
153
|
.json-render-block {
|
|
150
154
|
display: block;
|
|
151
155
|
padding: 20px;
|
|
@@ -236,30 +240,34 @@ function buildSidebar() {
|
|
|
236
240
|
if (keys.length > 0) renderPanel(keys[0]);
|
|
237
241
|
}
|
|
238
242
|
|
|
243
|
+
function makeInputString(type, id, placeholder) {
|
|
244
|
+
const pAttr = placeholder ? ' placeholder="' + placeholder + '"' : '';
|
|
245
|
+
return '<input type="' + type + '" id="' + id + '"' + pAttr + ' />';
|
|
246
|
+
}
|
|
247
|
+
|
|
239
248
|
function renderPanel(epKey) {
|
|
240
249
|
currentEp = epKey;
|
|
241
250
|
const ep = ENDPOINTS[epKey];
|
|
242
251
|
const main = document.getElementById('main-panel');
|
|
243
252
|
if (!ep) return;
|
|
244
253
|
|
|
245
|
-
// Escaping using triple backslashes ensures client variables evaluate properly at runtime
|
|
246
254
|
let html = \`
|
|
247
|
-
<div class="endpoint-title"
|
|
255
|
+
<div class="endpoint-title">\${ep.title}</div>
|
|
248
256
|
<div class="endpoint-path">
|
|
249
|
-
<span class="method-badge
|
|
250
|
-
<span
|
|
257
|
+
<span class="method-badge \${ep.method}">\${ep.method}</span>
|
|
258
|
+
<span>\${ep.path}</span>
|
|
251
259
|
</div>
|
|
252
|
-
<div class="endpoint-desc"
|
|
260
|
+
<div class="endpoint-desc">\${ep.desc}</div>
|
|
253
261
|
\`;
|
|
254
262
|
|
|
255
263
|
if (ep.params && ep.params.length) {
|
|
256
264
|
html += \`<div class="form-section"><div class="form-section-title">Path Parameters</div>\`;
|
|
257
265
|
ep.params.forEach(function(p) {
|
|
258
|
-
const
|
|
266
|
+
const inputHtml = makeInputString('text', 'param-' + p.name, p.placeholder);
|
|
259
267
|
html += \`
|
|
260
268
|
<div class="field-row">
|
|
261
|
-
<label class="field-label"
|
|
262
|
-
|
|
269
|
+
<label class="field-label">\${p.label}</label>
|
|
270
|
+
\${inputHtml}
|
|
263
271
|
</div>
|
|
264
272
|
\`;
|
|
265
273
|
});
|
|
@@ -269,12 +277,11 @@ function renderPanel(epKey) {
|
|
|
269
277
|
if (ep.fields && ep.fields.length) {
|
|
270
278
|
html += \`<div class="form-section"><div class="form-section-title">HTTP JSON Request Payload Parameters</div>\`;
|
|
271
279
|
ep.fields.forEach(function(f) {
|
|
272
|
-
const
|
|
273
|
-
const ph = f.placeholder ? ' placeholder="' + f.placeholder + '"' : '';
|
|
280
|
+
const inputHtml = makeInputString(f.type || 'text', 'field-' + f.name, f.placeholder || '');
|
|
274
281
|
html += \`
|
|
275
282
|
<div class="field-row">
|
|
276
|
-
<label class="field-label"
|
|
277
|
-
|
|
283
|
+
<label class="field-label">\${f.label}</label>
|
|
284
|
+
\${inputHtml}
|
|
278
285
|
</div>
|
|
279
286
|
\`;
|
|
280
287
|
});
|
|
@@ -357,6 +364,7 @@ function setResponse(data, state, status, ms) {
|
|
|
357
364
|
badge.textContent = status + ' · ' + ms + 'ms';
|
|
358
365
|
body.className = 'response-body';
|
|
359
366
|
|
|
367
|
+
// FIXED: Nested rendering inside dedicated horizontal scrolling code tag block wrapper elements
|
|
360
368
|
const outputString = typeof data === 'string' ? data : JSON.stringify(data, null, 2);
|
|
361
369
|
body.innerHTML = '<pre class="json-render-block">' + highlightJson(outputString) + '</pre>';
|
|
362
370
|
}
|
|
@@ -370,11 +378,10 @@ function clearResponse() {
|
|
|
370
378
|
body.textContent = 'Execute a request row to generate feedback data';
|
|
371
379
|
}
|
|
372
380
|
|
|
373
|
-
// Full syntax highlighting for JSON blocks
|
|
374
381
|
function highlightJson(str) {
|
|
375
382
|
return str
|
|
376
383
|
.replace(/&/g, '&').replace(/[<]/g, '<').replace(/[>]/g, '>')
|
|
377
|
-
.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)
|
|
384
|
+
.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function(match) {
|
|
378
385
|
if (/^"/.test(match)) {
|
|
379
386
|
if (/:$/.test(match)) return '<span class="json-key">' + match + '</span>';
|
|
380
387
|
return '<span class="json-str">' + match + '</span>';
|