Skip to content

Commit 42191cb

Browse files
committed
Merge branch 'testmode'
2 parents 80403cd + 24c7957 commit 42191cb

29 files changed

+930
-168
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/themes/light.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.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// base colors:
2-
$theme-color: #70B0E0; /* #66CCFF */
2+
$theme-color: #70B0E0; // #66CCFF
33
$base-color: mix(#808080, $theme-color, 85);
44

55
// core colors:

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: 226 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
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+
&:last-child::after {
13+
transition: opacity 1s;
14+
font-size: 0.625rem;
15+
padding: 0.25em 0.5em;
16+
display: inline-block;
17+
position: absolute;
18+
color: $doc-white;
19+
background: $theme-color;
20+
letter-spacing: 0.075em;
21+
transform: translate(0.25rem, -0.125rem);
22+
content: "NEW";
23+
}
24+
}
25+
26+
.button.add {
27+
display: none !important; // hiding this all the time for now.
28+
}
29+
330
.result {
431
font-weight: bold;
532

6-
&.matches {
7-
//background: $theme-color;
8-
}
933
&.error {
1034
background: $error-color;
1135
color: $doc-lightest;
@@ -15,6 +39,16 @@
1539
}
1640
}
1741

42+
&.pass {
43+
background: $pass-color;
44+
color: $doc-lightest;
45+
}
46+
47+
&.fail {
48+
background: $fail-color;
49+
color: $doc-lightest;
50+
}
51+
1852
em {
1953
font-style: normal;
2054
font-weight: normal;
@@ -23,7 +57,11 @@
2357
}
2458
}
2559

26-
> .editor {
60+
&.tests-viewed > header .modelist li:last-child::after {
61+
opacity: 0;
62+
}
63+
64+
.editor {
2765
position: relative;
2866
box-sizing: border-box;
2967
display: flex;
@@ -59,6 +97,190 @@
5997

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

64286
#tooltip .texthover {

0 commit comments

Comments
 (0)