Skip to content

Commit 5138279

Browse files
committed
Merge remote-tracking branch 'origin/testmode' into theme-fixes
2 parents 8ce803e + eb5ff66 commit 5138279

File tree

23 files changed

+762
-113
lines changed

23 files changed

+762
-113
lines changed

assets/themes/dark.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/workers/RegExWorker.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,30 @@
22
// in plain JS for now:
33
onmessage = function (evt) {
44
postMessage("onload");
5-
var regex = new RegExp(evt.data.pattern, evt.data.flags), text = evt.data.text;
5+
var data = evt.data, text = data.text, tests = data.tests, mode = data.mode;
6+
var regex = new RegExp(data.pattern, data.flags);
67

78
// shared between BrowserSolver & RegExWorker
89
var matches = [], match, index, error;
9-
while (match = regex.exec(text)) {
10-
if (index === regex.lastIndex) { error = {id:"infinite", warning:true}; ++regex.lastIndex; }
11-
index = regex.lastIndex;
12-
var groups = match.reduce(function (arr, s, i) { return (i===0 || arr.push({s:s})) && arr },[]);
13-
matches.push({i:match.index, l:match[0].length, groups:groups});
14-
if (!regex.global) { break; } // or it will become infinite.
10+
if (mode === "tests") {
11+
for (var i=0, l=tests.length; i<l; i++) {
12+
let test = tests[i];
13+
text = test.text;
14+
regex.lastIndex = 0;
15+
match = regex.exec(text);
16+
matches[i] = match ? {i:match.index, l:match[0].length, id:test.id} : {id:test.id};
17+
}
18+
} else {
19+
while (match = regex.exec(text)) {
20+
if (index === regex.lastIndex) { error = {id:"infinite", warning:true}; ++regex.lastIndex; }
21+
index = regex.lastIndex;
22+
var groups = match.reduce(function (arr, s, i) { return (i===0 || arr.push({s:s})) && arr },[]);
23+
matches.push({i:match.index, l:match[0].length, groups:groups});
24+
if (!regex.global) { break; } // or it will become infinite.
25+
}
1526
}
1627
// end share
1728

18-
postMessage({error: error, matches: matches});
29+
postMessage({error: error, matches: matches, mode: mode});
1930
self.close();
2031
};

dev/icons/add.svg

Lines changed: 1 addition & 0 deletions
Loading

dev/inject/icons.svg

Lines changed: 1 addition & 1 deletion
Loading

dev/sass/colors_dark.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $doc-dark: mix($doc-black, $base-color, 50%);
1616
$doc-mid: $mid;
1717

1818
$doc-white: mix($black, $darkest, 30%);
19-
$doc-lightest: mix($doc-white, $base-color, 92%);
19+
$doc-lightest: mix($doc-white, $base-color, 92%);
2020
$doc-lighter: mix($doc-white, $base-color, 80%);
2121
$doc-light: mix($doc-white, $base-color, 60%);
2222

dev/sass/controls.scss

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,41 @@ svg.icon {
219219
order: 1;
220220
}
221221
}
222+
223+
224+
.list {
225+
li {
226+
@extend %link;
227+
228+
color: $doc-light;
229+
230+
+ li {
231+
margin-top: 0.5em;
232+
}
233+
234+
.check.icon {
235+
color: $doc-dark;
236+
margin-right: 0.25em;
237+
}
238+
239+
&.selected .check.icon {
240+
color: $theme-color;
241+
}
242+
243+
&:not(.inactive):hover {
244+
color: $doc-lightest;
245+
}
246+
247+
em {
248+
font-style: normal;
249+
font-weight: bold;
250+
color: $doc-white;
251+
padding: 0 0.15em;
252+
background: rgba($doc-mid, 0.3);
253+
border-radius: $control-radius;
254+
}
255+
}
256+
}
222257
}
223258

224259
.example {

dev/sass/views/doc.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
min-height: 0; // fix for Chrome 72+
3737
}
3838

39-
4039
&.closed {
4140
flex: 0 $title-height;
4241

@@ -54,6 +53,12 @@
5453
}
5554
}
5655

56+
&.tests-mode {
57+
section.tools {
58+
display: none;
59+
}
60+
}
61+
5762
// overwrite colors:
5863
input, textarea {
5964
background: rgba($doc-white, $input-opacity);
@@ -75,4 +80,4 @@
7580
background: $doc-white;
7681
}
7782
}
78-
}
83+
}

dev/sass/views/expression.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,4 @@
158158
border-bottom: solid 3px $doc-lighter;
159159
}
160160

161-
.exp-special { color: $special-color; }
161+
.exp-special { color: $special-color; }

dev/sass/views/text.scss

Lines changed: 205 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
.doc > section.text {
2+
article {
3+
display: flex;
4+
}
5+
26
> header {
7+
.modelist li {
8+
font-size: 1rem;
9+
padding-top: $pad*0.275;
10+
padding-bottom: $pad*0.275;
11+
}
12+
13+
.button.add {
14+
display: none !important; // hiding this all the time for now.
15+
}
16+
317
.result {
418
font-weight: bold;
519

6-
&.matches {
7-
//background: $theme-color;
8-
}
920
&.error {
1021
background: $error-color;
1122
color: $doc-lightest;
@@ -15,6 +26,16 @@
1526
}
1627
}
1728

29+
&.pass {
30+
background: $pass-color;
31+
color: $doc-lightest;
32+
}
33+
34+
&.fail {
35+
background: $fail-color;
36+
color: $doc-lightest;
37+
}
38+
1839
em {
1940
font-style: normal;
2041
font-weight: normal;
@@ -23,7 +44,7 @@
2344
}
2445
}
2546

26-
> .editor {
47+
.editor {
2748
position: relative;
2849
box-sizing: border-box;
2950
display: flex;
@@ -59,6 +80,186 @@
5980

6081
}
6182
}
83+
84+
.tests {
85+
display: none;
86+
width: 100%;
87+
background: $doc-lighter;
88+
padding: $pad;
89+
box-sizing: border-box;
90+
overflow: auto;
91+
92+
.default {
93+
display: none;
94+
padding: $pad $pad * 0.5;
95+
color: $doc-dark;
96+
}
97+
98+
.list:empty ~ .default {
99+
display: block;
100+
}
101+
102+
.add.button {
103+
box-sizing: border-box;
104+
width: 100%;
105+
box-shadow: none;
106+
opacity: 0.5;
107+
background: rgba($doc-light, 0.75);
108+
color: $doc-black;
109+
padding: $pad * 0.75 $pad*0.625;
110+
margin-top: $pad * 0.125;
111+
font-weight: bold;
112+
border-radius: $control-radius;
113+
114+
&:hover {
115+
opacity: 1.0;
116+
}
117+
}
118+
119+
.list {
120+
li {
121+
background: $doc-lightest;
122+
box-shadow: 0 1px 2px $light-shadow;
123+
transition: margin $transition-t*0.5 linear;
124+
margin: $pad*0.125 0;
125+
display: inline-block;
126+
width: 100%;
127+
128+
&:first-child {
129+
margin-top: 0;
130+
}
131+
132+
&:hover {
133+
outline: $selected-stroke;
134+
}
135+
136+
header {
137+
@extend %title;
138+
padding: $pad*0.5 $pad*0.75;
139+
140+
input.name {
141+
color: $doc-darker;
142+
font-weight: bold;
143+
padding: 0;
144+
margin: 0 $pad * 0.5;
145+
background: transparent;
146+
border: none;
147+
}
148+
149+
.icon.delete {
150+
@extend %link;
151+
color: $doc-light;
152+
153+
&:hover {
154+
color: $error-color !important;
155+
}
156+
}
157+
158+
.icon.fail {
159+
display: none;
160+
color: $error-color;
161+
}
162+
163+
.icon.pass {
164+
color: $pass-color;
165+
}
166+
167+
.type {
168+
background: transparent;
169+
text-transform: uppercase;
170+
font-size: 0.75em;
171+
color: $doc-light;
172+
font-weight: bold;
173+
box-shadow: none;
174+
}
175+
}
176+
177+
article {
178+
border-top: solid 1px $doc-lighter;
179+
padding: $pad*0.5 0 $pad*0.5 $pad*0.75;
180+
display: none;
181+
height: 6em;
182+
align-items: stretch;
183+
184+
.bar {
185+
background: $pass-color;
186+
width: 0px;
187+
outline: solid 1px $pass-color;
188+
margin: $pad*0.25 $pad*0.875 $pad*0.25 $pad*0.375;
189+
}
190+
191+
.editor {
192+
padding: 0;
193+
}
194+
}
195+
196+
&:not(.selected) {
197+
cursor: pointer;
198+
199+
.type .icon.dropdown {
200+
opacity: 0;
201+
}
202+
203+
* {
204+
pointer-events: none;
205+
}
206+
}
207+
208+
&.selected {
209+
outline: $selected-stroke;
210+
background: $doc-white;
211+
box-shadow: 0 2px 3px $dark-shadow;
212+
margin: $pad*0.75 0;
213+
214+
&:first-child {
215+
margin-top: 0;
216+
}
217+
218+
article {
219+
display: flex;
220+
}
221+
222+
.type {
223+
color: $doc-dark;
224+
225+
&:hover {
226+
color: $doc-darkest;
227+
}
228+
}
229+
}
230+
231+
&.fail {
232+
.icon.fail {
233+
display: block;
234+
}
235+
236+
.icon.pass {
237+
display: none;
238+
}
239+
240+
.bar {
241+
outline: solid 1px $error-color;
242+
}
243+
}
244+
245+
}
246+
}
247+
}
248+
}
249+
250+
.doc.tests-mode > section.text {
251+
> header .button.add {
252+
display:inline-block;
253+
}
254+
255+
256+
> article > .editor {
257+
display: none;
258+
}
259+
260+
.tests {
261+
display: block;
262+
}
62263
}
63264

64265
#tooltip .texthover {

0 commit comments

Comments
 (0)