mockaton 8.21.1 → 8.21.3
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/Dashboard.css +24 -90
- package/src/Dashboard.html +0 -2
- package/src/Dashboard.js +26 -8
package/package.json
CHANGED
package/src/Dashboard.css
CHANGED
|
@@ -21,6 +21,18 @@
|
|
|
21
21
|
--colorRed: #da0f00;
|
|
22
22
|
--colorText: #000;
|
|
23
23
|
}
|
|
24
|
+
.SyntaxHighlight {
|
|
25
|
+
color: var(--colorSecondaryAction);
|
|
26
|
+
.key {
|
|
27
|
+
color: #ed206a
|
|
28
|
+
}
|
|
29
|
+
.val {
|
|
30
|
+
color: #9b71e8
|
|
31
|
+
}
|
|
32
|
+
.string {
|
|
33
|
+
color: #3e8300
|
|
34
|
+
}
|
|
35
|
+
}
|
|
24
36
|
}
|
|
25
37
|
@media (prefers-color-scheme: dark) {
|
|
26
38
|
:root {
|
|
@@ -40,6 +52,18 @@
|
|
|
40
52
|
--colorRed: #f41606;
|
|
41
53
|
--colorText: #fff;
|
|
42
54
|
}
|
|
55
|
+
.SyntaxHighlight {
|
|
56
|
+
color: var(--colorSecondaryAction);
|
|
57
|
+
.key {
|
|
58
|
+
color: #f92672
|
|
59
|
+
}
|
|
60
|
+
.val {
|
|
61
|
+
color: #ae81ff
|
|
62
|
+
}
|
|
63
|
+
.string {
|
|
64
|
+
color: #a6e22e
|
|
65
|
+
}
|
|
66
|
+
}
|
|
43
67
|
}
|
|
44
68
|
|
|
45
69
|
html,
|
|
@@ -590,93 +614,3 @@ table {
|
|
|
590
614
|
transform: translateY(0);
|
|
591
615
|
}
|
|
592
616
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
/*
|
|
596
|
-
* Prism
|
|
597
|
-
*/
|
|
598
|
-
|
|
599
|
-
@media (prefers-color-scheme: dark) {
|
|
600
|
-
.token.cdata, .token.comment, .token.doctype, .token.prolog {
|
|
601
|
-
color: #8292a2
|
|
602
|
-
}
|
|
603
|
-
.token.punctuation {
|
|
604
|
-
color: #f8f8f2
|
|
605
|
-
}
|
|
606
|
-
.token.namespace {
|
|
607
|
-
opacity: .7
|
|
608
|
-
}
|
|
609
|
-
.token.constant, .token.deleted, .token.property, .token.symbol, .token.tag {
|
|
610
|
-
color: #f92672
|
|
611
|
-
}
|
|
612
|
-
.token.boolean, .token.number {
|
|
613
|
-
color: #ae81ff
|
|
614
|
-
}
|
|
615
|
-
.token.attr-name, .token.builtin, .token.char, .token.inserted, .token.selector, .token.string {
|
|
616
|
-
color: #a6e22e
|
|
617
|
-
}
|
|
618
|
-
.language-css .token.string, .style .token.string, .token.entity, .token.operator, .token.url, .token.variable {
|
|
619
|
-
color: #f8f8f2
|
|
620
|
-
}
|
|
621
|
-
.token.atrule, .token.attr-value, .token.class-name, .token.function {
|
|
622
|
-
color: #e6db74
|
|
623
|
-
}
|
|
624
|
-
.token.keyword {
|
|
625
|
-
color: #66d9ef
|
|
626
|
-
}
|
|
627
|
-
.token.important, .token.regex {
|
|
628
|
-
color: #fd971f
|
|
629
|
-
}
|
|
630
|
-
.token.bold, .token.important {
|
|
631
|
-
font-weight: 700
|
|
632
|
-
}
|
|
633
|
-
.token.italic {
|
|
634
|
-
font-style: italic
|
|
635
|
-
}
|
|
636
|
-
.token.entity {
|
|
637
|
-
cursor: help
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
@media (prefers-color-scheme: light) {
|
|
642
|
-
.token.cdata, .token.comment, .token.doctype, .token.prolog {
|
|
643
|
-
color: #708090
|
|
644
|
-
}
|
|
645
|
-
.token.punctuation {
|
|
646
|
-
color: #999
|
|
647
|
-
}
|
|
648
|
-
.token.namespace {
|
|
649
|
-
opacity: .7
|
|
650
|
-
}
|
|
651
|
-
.token.constant, .token.deleted, .token.property, .token.symbol, .token.tag {
|
|
652
|
-
color: #ed206a
|
|
653
|
-
}
|
|
654
|
-
.token.boolean, .token.number {
|
|
655
|
-
color: #9b71e8
|
|
656
|
-
}
|
|
657
|
-
.token.attr-name, .token.builtin, .token.char, .token.inserted, .token.selector, .token.string {
|
|
658
|
-
color: #3e8300
|
|
659
|
-
}
|
|
660
|
-
.language-css .token.string, .style .token.string, .token.entity, .token.operator, .token.url {
|
|
661
|
-
color: #9a6e3a;
|
|
662
|
-
background: hsla(0, 0%, 100%, .5)
|
|
663
|
-
}
|
|
664
|
-
.token.atrule, .token.attr-value, .token.keyword {
|
|
665
|
-
color: #07a
|
|
666
|
-
}
|
|
667
|
-
.token.class-name, .token.function {
|
|
668
|
-
color: #dd4a68
|
|
669
|
-
}
|
|
670
|
-
.token.important, .token.regex, .token.variable {
|
|
671
|
-
color: #e90
|
|
672
|
-
}
|
|
673
|
-
.token.bold, .token.important {
|
|
674
|
-
font-weight: 700
|
|
675
|
-
}
|
|
676
|
-
.token.italic {
|
|
677
|
-
font-style: italic
|
|
678
|
-
}
|
|
679
|
-
.token.entity {
|
|
680
|
-
cursor: help
|
|
681
|
-
}
|
|
682
|
-
}
|
package/src/Dashboard.html
CHANGED
|
@@ -10,7 +10,5 @@
|
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<script src="./mockaton/Dashboard.js" type="module"></script>
|
|
13
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js" data-manual integrity="sha512-7Z9J3l1+EYfeaPKcGXu3MS/7T+w19WtKQY/n+xzmw4hZhJ9tyYmcUS+4QqAlzhicE5LAfMQSF3iFTK9bQdTxXg==" crossorigin="anonymous" referrerpolicy="no-referrer" defer></script>
|
|
14
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-json.min.js" integrity="sha512-QXFMVAusM85vUYDaNgcYeU3rzSlc+bTV4JvkfJhjxSHlQEo+ig53BtnGkvFTiNJh8D+wv6uWAQ2vJaVmxe8d3w==" crossorigin="anonymous" referrerpolicy="no-referrer" defer></script>
|
|
15
13
|
</body>
|
|
16
14
|
</html>
|
package/src/Dashboard.js
CHANGED
|
@@ -3,13 +3,6 @@ import { parseFilename } from './Filename.js'
|
|
|
3
3
|
import { Commander } from './Commander.js'
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
function syntaxHighlightJson(textBody) {
|
|
7
|
-
const prism = window.Prism
|
|
8
|
-
return prism?.highlight && prism?.languages?.json
|
|
9
|
-
? prism.highlight(textBody, prism.languages.json, 'json')
|
|
10
|
-
: false
|
|
11
|
-
}
|
|
12
|
-
|
|
13
6
|
const Strings = {
|
|
14
7
|
bulk_select: 'Bulk Select',
|
|
15
8
|
bulk_select_disabled_title: 'No mock files have comments, which are anything within parentheses on the filename.',
|
|
@@ -56,6 +49,7 @@ const CSS = {
|
|
|
56
49
|
ResetButton: null,
|
|
57
50
|
SaveProxiedCheckbox: null,
|
|
58
51
|
StaticFilesList: null,
|
|
52
|
+
SyntaxHighlight: null,
|
|
59
53
|
|
|
60
54
|
chosen: null,
|
|
61
55
|
dittoDir: null,
|
|
@@ -566,7 +560,7 @@ function PayloadViewer() {
|
|
|
566
560
|
r('div', className(CSS.PayloadViewer),
|
|
567
561
|
r('h2', { ref: payloadViewerTitleRef }, Strings.preview),
|
|
568
562
|
r('pre', null,
|
|
569
|
-
r('code', { ref: payloadViewerRef }, Strings.click_link_to_preview))))
|
|
563
|
+
r('code', { ref: payloadViewerRef, className: CSS.SyntaxHighlight }, Strings.click_link_to_preview))))
|
|
570
564
|
}
|
|
571
565
|
|
|
572
566
|
function PayloadViewerProgressBar() {
|
|
@@ -846,3 +840,27 @@ function dittoSplitPaths(paths) {
|
|
|
846
840
|
]
|
|
847
841
|
console.assert(JSON.stringify(dittoSplitPaths(input)) === JSON.stringify(expected))
|
|
848
842
|
}())
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
function syntaxHighlightJson(textBody) {
|
|
847
|
+
return textBody.replace(
|
|
848
|
+
/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(\.\d+)?)/g,
|
|
849
|
+
match => {
|
|
850
|
+
if (/^".*":$/.test(match))
|
|
851
|
+
return `<span class="key">${escapeHTML(match.slice(0, -1))}</span>:`
|
|
852
|
+
|
|
853
|
+
return /^"/.test(match)
|
|
854
|
+
? `<span class="string">${escapeHTML(match)}</span>`
|
|
855
|
+
: `<span class="val">${match}</span>`
|
|
856
|
+
}
|
|
857
|
+
)
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function escapeHTML(str) {
|
|
861
|
+
return str.replace(/&/g, '&')
|
|
862
|
+
.replace(/</g, '<')
|
|
863
|
+
.replace(/>/g, '>')
|
|
864
|
+
.replace(/"/g, '"')
|
|
865
|
+
.replace(/'/g, ''')
|
|
866
|
+
}
|