mockaton 9.3.0 → 9.4.1
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/README.md +20 -16
- package/lcov.info +753 -731
- package/package.json +1 -4
- package/src/Dashboard.css +63 -16
- package/src/Dashboard.js +52 -9
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mockaton",
|
|
3
3
|
"description": "HTTP Mock Server",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "9.
|
|
5
|
+
"version": "9.4.1",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
8
|
"license": "MIT",
|
|
@@ -28,8 +28,5 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"pixaton": "1.1.3",
|
|
30
30
|
"puppeteer": "24.19.0"
|
|
31
|
-
},
|
|
32
|
-
"optionalDependencies": {
|
|
33
|
-
"open": "10.2.0"
|
|
34
31
|
}
|
|
35
32
|
}
|
package/src/Dashboard.css
CHANGED
|
@@ -100,6 +100,14 @@ select, a, input, button {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
a {
|
|
104
|
+
text-decoration: none;
|
|
105
|
+
|
|
106
|
+
&:hover {
|
|
107
|
+
text-decoration: underline;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
103
111
|
input[type="checkbox"] {
|
|
104
112
|
&:focus {
|
|
105
113
|
outline: 0;
|
|
@@ -144,7 +152,7 @@ select {
|
|
|
144
152
|
|
|
145
153
|
header {
|
|
146
154
|
display: flex;
|
|
147
|
-
width:
|
|
155
|
+
width: 100vw;
|
|
148
156
|
padding: 16px;
|
|
149
157
|
border-bottom: 1px solid var(--colorSecondaryActionBorder);
|
|
150
158
|
background: var(--colorHeaderBackground);
|
|
@@ -193,7 +201,6 @@ header {
|
|
|
193
201
|
width: 100%;
|
|
194
202
|
height: 28px;
|
|
195
203
|
padding: 4px 8px;
|
|
196
|
-
border: 0;
|
|
197
204
|
border: 1px solid var(--colorSecondaryActionBorder);
|
|
198
205
|
border-right: 3px solid transparent;
|
|
199
206
|
margin-top: 4px;
|
|
@@ -206,7 +213,7 @@ header {
|
|
|
206
213
|
select:enabled:hover {
|
|
207
214
|
background: var(--colorHover);
|
|
208
215
|
}
|
|
209
|
-
|
|
216
|
+
|
|
210
217
|
&.GlobalDelayField {
|
|
211
218
|
width: 84px;
|
|
212
219
|
|
|
@@ -284,9 +291,14 @@ header {
|
|
|
284
291
|
left: auto;
|
|
285
292
|
padding: 20px;
|
|
286
293
|
border: 1px solid var(--colorSecondaryActionBorder);
|
|
294
|
+
color: var(--colorText);
|
|
287
295
|
border-radius: var(--radius);
|
|
288
296
|
box-shadow: var(--boxShadow1);
|
|
289
297
|
background: var(--colorHeaderBackground);
|
|
298
|
+
|
|
299
|
+
a {
|
|
300
|
+
color: var(--colorAccent);
|
|
301
|
+
}
|
|
290
302
|
|
|
291
303
|
.GroupByMethod {
|
|
292
304
|
display: flex;
|
|
@@ -298,25 +310,54 @@ header {
|
|
|
298
310
|
|
|
299
311
|
|
|
300
312
|
main {
|
|
301
|
-
display:
|
|
313
|
+
display: flex;
|
|
314
|
+
min-width: 0;
|
|
302
315
|
min-height: 0;
|
|
303
|
-
grid-template-columns: minmax(min-content, max-content) 1fr;
|
|
304
316
|
|
|
305
317
|
@media (max-width: 800px) {
|
|
306
|
-
|
|
307
|
-
|
|
318
|
+
flex-direction: column;
|
|
319
|
+
|
|
320
|
+
.Resizer {
|
|
321
|
+
display: none;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.leftSide {
|
|
325
|
+
min-width: 100%;
|
|
326
|
+
min-height: 50%;
|
|
327
|
+
max-height: 50%;
|
|
328
|
+
border: 0;
|
|
329
|
+
}
|
|
308
330
|
}
|
|
309
331
|
|
|
310
332
|
.leftSide {
|
|
333
|
+
width: max-content;
|
|
311
334
|
padding: 16px;
|
|
312
335
|
padding-bottom: 0;
|
|
336
|
+
border-right: 1px solid var(--colorSecondaryActionBorder);
|
|
313
337
|
overflow-y: auto;
|
|
314
338
|
box-shadow: var(--boxShadow1);
|
|
315
339
|
}
|
|
316
340
|
|
|
317
341
|
.rightSide {
|
|
318
|
-
|
|
319
|
-
|
|
342
|
+
position: relative;
|
|
343
|
+
min-width: 100px;
|
|
344
|
+
min-height: 0;
|
|
345
|
+
flex: 1;
|
|
346
|
+
|
|
347
|
+
.Resizer {
|
|
348
|
+
position: absolute;
|
|
349
|
+
top: 0;
|
|
350
|
+
left: 0;
|
|
351
|
+
width: 8px;
|
|
352
|
+
height: 100%;
|
|
353
|
+
border-left: 3px solid transparent;
|
|
354
|
+
cursor: col-resize;
|
|
355
|
+
|
|
356
|
+
&:active {
|
|
357
|
+
border-color: var(--colorSecondaryActionBorder);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
320
361
|
}
|
|
321
362
|
}
|
|
322
363
|
|
|
@@ -352,11 +393,11 @@ table {
|
|
|
352
393
|
margin-left: 4px;
|
|
353
394
|
border-radius: var(--radius);
|
|
354
395
|
color: var(--colorAccent);
|
|
355
|
-
text-decoration: none;
|
|
356
396
|
word-break: break-word;
|
|
357
397
|
|
|
358
398
|
&:hover {
|
|
359
399
|
background: var(--colorHover);
|
|
400
|
+
text-decoration: none;
|
|
360
401
|
}
|
|
361
402
|
&.chosen {
|
|
362
403
|
color: white;
|
|
@@ -534,18 +575,24 @@ table {
|
|
|
534
575
|
margin-left: 4px;
|
|
535
576
|
border-radius: var(--radius);
|
|
536
577
|
color: var(--colorAccent);
|
|
537
|
-
text-decoration: none;
|
|
538
|
-
|
|
539
|
-
&:hover {
|
|
540
|
-
text-decoration: underline;
|
|
541
|
-
}
|
|
542
578
|
}
|
|
543
579
|
}
|
|
544
580
|
|
|
545
581
|
|
|
546
582
|
.PayloadViewer {
|
|
583
|
+
display: flex;
|
|
584
|
+
height: 100%;
|
|
585
|
+
flex-direction: column;
|
|
586
|
+
padding-top: 16px;
|
|
587
|
+
|
|
588
|
+
h2 {
|
|
589
|
+
padding-left: 16px;
|
|
590
|
+
}
|
|
591
|
+
|
|
547
592
|
pre {
|
|
548
|
-
|
|
593
|
+
overflow: auto;
|
|
594
|
+
height: 100%;
|
|
595
|
+
padding: 16px;
|
|
549
596
|
font-family: monospace;
|
|
550
597
|
|
|
551
598
|
code {
|
package/src/Dashboard.js
CHANGED
|
@@ -49,6 +49,7 @@ const CSS = {
|
|
|
49
49
|
ProgressBar: null,
|
|
50
50
|
ProxyToggler: null,
|
|
51
51
|
ResetButton: null,
|
|
52
|
+
Resizer: null,
|
|
52
53
|
SaveProxiedCheckbox: null,
|
|
53
54
|
StaticFilesList: null,
|
|
54
55
|
|
|
@@ -87,12 +88,12 @@ const state = {
|
|
|
87
88
|
delay: 0,
|
|
88
89
|
collectProxied: false,
|
|
89
90
|
proxyFallback: '',
|
|
90
|
-
|
|
91
|
-
groupByMethod: true, // TODO read from localstorage
|
|
92
|
-
|
|
93
91
|
get canProxy() {
|
|
94
92
|
return Boolean(this.proxyFallback)
|
|
95
|
-
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
groupByMethod: true, // TODO read from localstorage
|
|
96
|
+
leftSideWidth: undefined
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
const mockaton = new Commander(window.location.origin)
|
|
@@ -115,15 +116,23 @@ async function updateState() {
|
|
|
115
116
|
const r = createElement
|
|
116
117
|
const s = createSvgElement
|
|
117
118
|
|
|
119
|
+
const leftSideRef = useRef()
|
|
120
|
+
|
|
118
121
|
function App() {
|
|
122
|
+
const { leftSideWidth } = state
|
|
119
123
|
return [
|
|
120
124
|
r(Header),
|
|
121
125
|
r(Menu),
|
|
122
126
|
r('main', null,
|
|
123
|
-
r('div',
|
|
127
|
+
r('div', {
|
|
128
|
+
ref: leftSideRef,
|
|
129
|
+
style: { width: leftSideWidth + 'px' },
|
|
130
|
+
className: CSS.leftSide
|
|
131
|
+
},
|
|
124
132
|
r(MockList),
|
|
125
133
|
r(StaticFilesList)),
|
|
126
|
-
r('div', className
|
|
134
|
+
r('div', { className: CSS.rightSide },
|
|
135
|
+
r(Resizer),
|
|
127
136
|
r(PayloadViewer)))
|
|
128
137
|
]
|
|
129
138
|
}
|
|
@@ -146,7 +155,7 @@ function Header() {
|
|
|
146
155
|
r('button', {
|
|
147
156
|
className: CSS.MenuTrigger,
|
|
148
157
|
popovertarget: 'Menu'
|
|
149
|
-
}, r(
|
|
158
|
+
}, r(SettingsIcon))
|
|
150
159
|
))
|
|
151
160
|
}
|
|
152
161
|
|
|
@@ -606,6 +615,40 @@ function ProxyStaticToggler({}) { // TODO
|
|
|
606
615
|
}
|
|
607
616
|
|
|
608
617
|
|
|
618
|
+
function Resizer() {
|
|
619
|
+
return (
|
|
620
|
+
r('div', {
|
|
621
|
+
className: CSS.Resizer,
|
|
622
|
+
onPointerDown: Resizer.onPointerDown
|
|
623
|
+
}))
|
|
624
|
+
}
|
|
625
|
+
Resizer.raf = 0
|
|
626
|
+
Resizer.initialX = 0
|
|
627
|
+
Resizer.panelWidth = 0
|
|
628
|
+
Resizer.onPointerDown = function (event) {
|
|
629
|
+
Resizer.initialX = event.clientX
|
|
630
|
+
Resizer.panelWidth = leftSideRef.current.clientWidth
|
|
631
|
+
window.addEventListener('pointerup', Resizer.onUp)
|
|
632
|
+
window.addEventListener('pointermove', Resizer.onMove)
|
|
633
|
+
document.body.style.userSelect = 'none'
|
|
634
|
+
document.body.style.cursor = 'col-resize'
|
|
635
|
+
}
|
|
636
|
+
Resizer.onMove = function (event) {
|
|
637
|
+
const MIN_LEFT_WIDTH = 380
|
|
638
|
+
Resizer.raf = Resizer.raf || requestAnimationFrame(() => {
|
|
639
|
+
state.leftSideWidth = Math.max(Resizer.panelWidth - (Resizer.initialX - event.clientX), MIN_LEFT_WIDTH)
|
|
640
|
+
leftSideRef.current.style.width = state.leftSideWidth + 'px'
|
|
641
|
+
Resizer.raf = 0
|
|
642
|
+
})
|
|
643
|
+
}
|
|
644
|
+
Resizer.onUp = function () {
|
|
645
|
+
window.removeEventListener('pointermove', Resizer.onMove)
|
|
646
|
+
window.removeEventListener('pointerup', Resizer.onUp)
|
|
647
|
+
cancelAnimationFrame(Resizer.raf)
|
|
648
|
+
document.body.style.userSelect = 'auto'
|
|
649
|
+
document.body.style.cursor = 'auto'
|
|
650
|
+
}
|
|
651
|
+
|
|
609
652
|
|
|
610
653
|
/** # Payload Preview */
|
|
611
654
|
|
|
@@ -761,10 +804,10 @@ function CloudIcon() {
|
|
|
761
804
|
s('path', { d: 'm6.1 9.1c2.8 0 5 2.3 5 5' })))
|
|
762
805
|
}
|
|
763
806
|
|
|
764
|
-
function
|
|
807
|
+
function SettingsIcon() {
|
|
765
808
|
return (
|
|
766
809
|
s('svg', { viewBox: '0 0 24 24' },
|
|
767
|
-
s('path', { d: '
|
|
810
|
+
s('path', { d: 'M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6' })))
|
|
768
811
|
}
|
|
769
812
|
|
|
770
813
|
/**
|