mockaton 13.3.1 → 13.3.2
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/package.json +1 -1
- package/src/client/app-store.js +1 -1
- package/src/client/app.css +24 -13
- package/src/client/app.js +4 -8
- package/src/server/Api.js +1 -0
- package/src/server/mockBrokersCollection.js +2 -6
package/package.json
CHANGED
package/src/client/app-store.js
CHANGED
package/src/client/app.css
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
--colorText: light-dark(#000, #fff);
|
|
14
14
|
|
|
15
15
|
--colorAccent: light-dark(#0059dd, #2495ff);
|
|
16
|
-
--colorHover: light-dark(#
|
|
16
|
+
--colorHover: light-dark(#c1e2ff, #062d59);
|
|
17
17
|
|
|
18
18
|
--colorRed: light-dark(#da0f00, #f41606);
|
|
19
19
|
--colorPink: light-dark(#ed206a, #f92672);
|
|
@@ -50,6 +50,11 @@ body {
|
|
|
50
50
|
corner-shape: squircle;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
label,
|
|
54
|
+
button {
|
|
55
|
+
user-select: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
a:focus-visible,
|
|
54
59
|
input:focus-visible,
|
|
55
60
|
select:focus-visible,
|
|
@@ -449,6 +454,7 @@ main {
|
|
|
449
454
|
|
|
450
455
|
.FolderGroup {
|
|
451
456
|
position: relative;
|
|
457
|
+
border-radius: var(--radius);
|
|
452
458
|
|
|
453
459
|
> summary {
|
|
454
460
|
left: 0;
|
|
@@ -465,7 +471,6 @@ main {
|
|
|
465
471
|
text-overflow: ellipsis;
|
|
466
472
|
border-radius: var(--radius);
|
|
467
473
|
|
|
468
|
-
|
|
469
474
|
&:active {
|
|
470
475
|
cursor: grabbing;
|
|
471
476
|
}
|
|
@@ -475,7 +480,7 @@ main {
|
|
|
475
480
|
}
|
|
476
481
|
|
|
477
482
|
&:hover {
|
|
478
|
-
|
|
483
|
+
background: var(--colorHover);
|
|
479
484
|
}
|
|
480
485
|
|
|
481
486
|
.FolderName {
|
|
@@ -510,17 +515,23 @@ main {
|
|
|
510
515
|
}
|
|
511
516
|
}
|
|
512
517
|
|
|
513
|
-
&[open]
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
left: 0;
|
|
517
|
-
width: 16px;
|
|
518
|
-
|
|
519
|
-
.FolderChevron {
|
|
520
|
-
transform: rotate(0deg);
|
|
518
|
+
&[open] {
|
|
519
|
+
&:has(summary:hover) {
|
|
520
|
+
background: linear-gradient(90deg, var(--colorHover), var(--colorBg));
|
|
521
521
|
}
|
|
522
|
-
|
|
523
|
-
|
|
522
|
+
|
|
523
|
+
> summary {
|
|
524
|
+
position: absolute;
|
|
525
|
+
top: 0;
|
|
526
|
+
left: 0;
|
|
527
|
+
width: 16px;
|
|
528
|
+
|
|
529
|
+
.FolderChevron {
|
|
530
|
+
transform: rotate(0deg);
|
|
531
|
+
}
|
|
532
|
+
.FolderName {
|
|
533
|
+
display: none;
|
|
534
|
+
}
|
|
524
535
|
}
|
|
525
536
|
}
|
|
526
537
|
}
|
package/src/client/app.js
CHANGED
|
@@ -106,15 +106,12 @@ function MockList() {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
function FolderGroups(groups) {
|
|
109
|
-
return groups.map(({ folder, children }) =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return r('details', {
|
|
109
|
+
return groups.map(({ folder, children }) => children.length === 1
|
|
110
|
+
? Row(children[0], 0)
|
|
111
|
+
: r('details', {
|
|
114
112
|
className: CSS.FolderGroup,
|
|
115
113
|
open: !store.collapsedFolders.has(folder),
|
|
116
114
|
onToggle() {
|
|
117
|
-
// TODO alt+click exclusive open
|
|
118
115
|
store.setFolderCollapsed(folder, !this.open)
|
|
119
116
|
}
|
|
120
117
|
},
|
|
@@ -127,8 +124,7 @@ function FolderGroups(groups) {
|
|
|
127
124
|
store.canProxy && CSS.canProxy)
|
|
128
125
|
},
|
|
129
126
|
folder + '…')),
|
|
130
|
-
children.map(Row))
|
|
131
|
-
})
|
|
127
|
+
children.map(Row)))
|
|
132
128
|
}
|
|
133
129
|
|
|
134
130
|
/**
|
package/src/server/Api.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { basename } from 'node:path'
|
|
2
2
|
|
|
3
|
-
import { cookie } from './cookie.js'
|
|
4
3
|
import { MockBroker } from './MockBroker.js'
|
|
5
4
|
import { parseFilename } from '../client/Filename.js'
|
|
6
5
|
import { listFilesRecursively } from './utils/fs.js'
|
|
@@ -28,19 +27,16 @@ export const all = () => collection
|
|
|
28
27
|
|
|
29
28
|
export function init() {
|
|
30
29
|
collection = {}
|
|
31
|
-
cookie.init(config.cookies)
|
|
32
|
-
|
|
33
30
|
listFilesRecursively(config.mocksDir)
|
|
34
31
|
.sort()
|
|
35
32
|
.forEach(f => registerMock(f))
|
|
36
|
-
|
|
37
33
|
forEachBroker(b => b.selectDefaultFile())
|
|
38
34
|
}
|
|
39
35
|
|
|
40
36
|
/** @returns {boolean} registered */
|
|
41
37
|
export function registerMock(file, isFromWatcher = false) {
|
|
42
|
-
if (brokerByFilename(file)?.hasMock(file)
|
|
43
|
-
|
|
38
|
+
if (brokerByFilename(file)?.hasMock(file) ||
|
|
39
|
+
!isFileAllowed(basename(file)))
|
|
44
40
|
return false
|
|
45
41
|
|
|
46
42
|
const { method, urlMask } = parseFilename(file)
|