mockaton 10.6.0 → 10.6.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/package.json +2 -2
- package/src/Dashboard.css +1 -1
- package/src/Dashboard.js +15 -12
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mockaton",
|
|
3
3
|
"description": "HTTP Mock Server",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "10.6.
|
|
5
|
+
"version": "10.6.1",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
8
|
"license": "MIT",
|
|
@@ -27,6 +27,6 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"pixaton": "1.1.3",
|
|
30
|
-
"puppeteer": "24.
|
|
30
|
+
"puppeteer": "24.24.1"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/Dashboard.css
CHANGED
package/src/Dashboard.js
CHANGED
|
@@ -76,12 +76,10 @@ const state = /** @type {State} */ {
|
|
|
76
76
|
updateState()
|
|
77
77
|
},
|
|
78
78
|
|
|
79
|
-
leftSideWidth:
|
|
79
|
+
leftSideWidth: window.innerWidth / 2,
|
|
80
80
|
|
|
81
81
|
chosenLink: { method: '', urlMask: '' },
|
|
82
|
-
clearChosenLink() {
|
|
83
|
-
state.chosenLink = { method: '', urlMask: '' }
|
|
84
|
-
},
|
|
82
|
+
clearChosenLink() { state.setChosenLink('', '') },
|
|
85
83
|
setChosenLink(method, urlMask) {
|
|
86
84
|
state.chosenLink = { method, urlMask }
|
|
87
85
|
}
|
|
@@ -100,6 +98,7 @@ async function updateState() {
|
|
|
100
98
|
throw response.status
|
|
101
99
|
Object.assign(state, await response.json())
|
|
102
100
|
document.body.replaceChildren(...App())
|
|
101
|
+
|
|
103
102
|
findChosenLink()?.focus()
|
|
104
103
|
const { method, urlMask } = state.chosenLink
|
|
105
104
|
if (method && urlMask)
|
|
@@ -168,18 +167,25 @@ function SettingsMenuTrigger() {
|
|
|
168
167
|
|
|
169
168
|
function SettingsMenu(id) {
|
|
170
169
|
const { groupByMethod, toggleGroupByMethod } = state
|
|
170
|
+
|
|
171
|
+
const firstInputRef = useRef()
|
|
172
|
+
function onToggle(event) {
|
|
173
|
+
if (event.newState === 'open')
|
|
174
|
+
firstInputRef.current.focus()
|
|
175
|
+
}
|
|
171
176
|
return (
|
|
172
177
|
r('menu', {
|
|
173
178
|
id,
|
|
174
179
|
popover: '',
|
|
175
|
-
className: CSS.SettingsMenu
|
|
180
|
+
className: CSS.SettingsMenu,
|
|
181
|
+
onToggle
|
|
176
182
|
},
|
|
177
183
|
|
|
178
184
|
r('label', className(CSS.GroupByMethod),
|
|
179
185
|
r('input', {
|
|
186
|
+
ref: firstInputRef,
|
|
180
187
|
type: 'checkbox',
|
|
181
188
|
checked: groupByMethod,
|
|
182
|
-
// autofocus: true, // TODO
|
|
183
189
|
onChange: toggleGroupByMethod
|
|
184
190
|
}),
|
|
185
191
|
r('span', null, t`Group by Method`)),
|
|
@@ -789,15 +795,12 @@ function isXML(mime) {
|
|
|
789
795
|
}
|
|
790
796
|
|
|
791
797
|
|
|
792
|
-
function trFor(method, urlMask) {
|
|
793
|
-
return document.querySelector(`tr[data-method="${method}"][data-urlMask="${urlMask}"]`)
|
|
794
|
-
}
|
|
795
|
-
function linkFor(method, urlMask) {
|
|
796
|
-
return trFor(method, urlMask)?.querySelector(`a.${CSS.PreviewLink}`)
|
|
797
|
-
}
|
|
798
798
|
function mockSelectorFor(method, urlMask) {
|
|
799
799
|
return trFor(method, urlMask)?.querySelector(`select.${CSS.MockSelector}`)
|
|
800
800
|
}
|
|
801
|
+
function trFor(method, urlMask) {
|
|
802
|
+
return document.querySelector(`tr[data-method="${method}"][data-urlMask="${urlMask}"]`)
|
|
803
|
+
}
|
|
801
804
|
|
|
802
805
|
function focus(selector) {
|
|
803
806
|
document.querySelector(selector)?.focus()
|