|
1 | 1 | @import "colors.less"; |
2 | 2 |
|
3 | | -@group-outline-radius: ~"calc(var(--editor-line-height) / 2)"; |
4 | | -@group-outline-radius: ~"calc(var(--editor-line-height) * 1em / 2)"; |
| 3 | +@half-line-height: ~"calc(var(--editor-line-height) * 1em / 2)"; |
| 4 | +@half-line-padding: ~"calc((var(--editor-line-height) * 1em - 1em) / 2)"; |
5 | 5 |
|
6 | 6 |
|
7 | | -.syntax--source.syntax--js .syntax--string.syntax--regexp { |
| 7 | +.syntax--source.syntax--js .syntax--string.syntax--regexp > .syntax--meta.syntax--pattern { |
8 | 8 |
|
9 | | - //the pattern |
10 | | - .syntax--meta.syntax--pattern { |
| 9 | + //groups (including lookaround assertions) |
| 10 | + > .syntax--meta.syntax--group, |
| 11 | + :not(.syntax--invalid):not(.syntax--punctuation) > .syntax--meta.syntax--group:first-child, |
| 12 | + :not(.syntax--invalid) > :not(.syntax--punctuation):first-child + .syntax--meta.syntax--group, |
| 13 | + :not(.syntax--invalid) > :not(.syntax--definition):first-child + .syntax--meta.syntax--group, |
| 14 | + :not(.syntax--invalid) > :not(.syntax--group):first-child + .syntax--meta.syntax--group, |
| 15 | + :not(.syntax--invalid) > :not(.syntax--begin):first-child + .syntax--meta.syntax--group, |
| 16 | + :not(.syntax--invalid) > .syntax--meta.syntax--group:nth-child(n+3) { |
| 17 | + background-color: @group-bg; |
| 18 | + padding: 1px 0; |
| 19 | + position: relative; |
11 | 20 |
|
12 | | - //groups (including lookaround assertions) |
13 | | - .syntax--meta.syntax--group { |
14 | | - background-color: @group-bg; |
15 | | - border-radius: @group-outline-radius; |
16 | | - padding: 1px 0; |
17 | | - position: relative; |
| 21 | + //lines above and below group content |
| 22 | + &::before { |
| 23 | + content: ""; |
| 24 | + position: absolute; |
| 25 | + display: block; |
| 26 | + border: 1px solid @group-delimiter; |
| 27 | + border-width: 1px 0; |
| 28 | + inset: -1px @half-line-height; |
| 29 | + } |
| 30 | + &.syntax--capturing::before { |
| 31 | + border-color: @group-delimiter-capturing; |
| 32 | + } |
| 33 | + |
| 34 | + //delimiters '(' and ')' |
| 35 | + .syntax--punctuation.syntax--definition.syntax--group.syntax--begin .syntax--punctuation.syntax--definition.syntax--group.syntax--begin, |
| 36 | + .syntax--punctuation.syntax--definition.syntax--group.syntax--end .syntax--punctuation.syntax--definition.syntax--group.syntax--end { |
| 37 | + color: transparent; //hide the parenthesis |
| 38 | + } |
| 39 | + > .syntax--punctuation.syntax--definition.syntax--group, |
| 40 | + > .syntax--meta.syntax--group > .syntax--punctuation.syntax--definition.syntax--group { |
18 | 41 |
|
19 | | - /*&:first-child { |
20 | | - border-top-left-radius: 0; |
21 | | - border-bottom-left-radius: 0; |
| 42 | + &.syntax--begin, |
| 43 | + &.syntax--end { |
| 44 | + display: inline-block; |
| 45 | + position: relative; |
| 46 | + color: transparent; //hide the parenthesis |
22 | 47 | } |
23 | | - &:last-child { |
24 | | - border-top-right-radius: 0; |
25 | | - border-bottom-right-radius: 0; |
26 | | - }*/ |
27 | 48 |
|
28 | | - //lines above and below group content |
29 | | - &.syntax--non-capturing, |
30 | | - &.syntax--assertion { |
31 | | - box-shadow: |
32 | | - 0 -6px 0 -5px @group-delimiter, |
33 | | - 0 6px 0 -5px @group-delimiter; |
| 49 | + &.syntax--begin::before, |
| 50 | + &.syntax--end::after { |
| 51 | + content: ""; |
| 52 | + position: absolute; |
| 53 | + width: @half-line-height; |
34 | 54 | } |
35 | | - &.syntax--capturing { |
| 55 | + |
| 56 | + &.syntax--begin::before { |
| 57 | + inset: 1px auto 2px @half-line-padding; |
| 58 | + border-top-left-radius: 100% 50%; |
| 59 | + border-bottom-left-radius: 100% 50%; |
36 | 60 | box-shadow: |
37 | | - 0 -6px 0 -5px @group-delimiter-capturing, |
38 | | - 0 6px 0 -5px @group-delimiter-capturing; |
| 61 | + -1px -1px 0 0 @group-delimiter, |
| 62 | + -1px 1px 0 0 @group-delimiter; |
| 63 | + border-left: 1px solid @group-delimiter; |
39 | 64 | } |
40 | 65 |
|
41 | | - //delimiters '(' and ')' |
42 | | - > .syntax--punctuation.syntax--definition.syntax--group, |
43 | | - > .syntax--punctuation.syntax--definition.syntax--group > .syntax--punctuation.syntax--definition.syntax--group { |
44 | | - |
45 | | - &.syntax--begin, |
46 | | - &.syntax--end { |
47 | | - display: inline-block; |
48 | | - } |
49 | | - |
50 | | - &.syntax--begin::before, |
51 | | - &.syntax--end::after { |
52 | | - content: ""; |
53 | | - position: absolute; |
54 | | - width: ~"calc(2 * @{group-outline-radius})"; |
55 | | - border-radius: @group-outline-radius; |
56 | | - } |
57 | | - |
58 | | - &.syntax--begin::before { |
59 | | - inset: 0 auto 0 3px; |
60 | | - } |
61 | | - |
62 | | - &.syntax--end::after { |
63 | | - inset: 0 3px 0 auto; |
64 | | - } |
| 66 | + &.syntax--end::after { |
| 67 | + inset: 1px @half-line-padding 2px auto; |
| 68 | + border-top-right-radius: 100% 50%; |
| 69 | + border-bottom-right-radius: 100% 50%; |
| 70 | + box-shadow: |
| 71 | + 1px -1px 0 0 @group-delimiter, |
| 72 | + 1px 1px 0 0 @group-delimiter; |
| 73 | + border-right: 1px solid @group-delimiter; |
65 | 74 | } |
66 | | - &.syntax--non-capturing > .syntax--punctuation.syntax--definition.syntax--group, |
67 | | - &.syntax--non-capturing > .syntax--punctuation.syntax--definition.syntax--group > .syntax--punctuation.syntax--definition.syntax--group, |
68 | | - &.syntax--assertion > .syntax--punctuation.syntax--definition.syntax--group, |
69 | | - &.syntax--assertion > .syntax--punctuation.syntax--definition.syntax--group > .syntax--punctuation.syntax--definition.syntax--group { |
70 | | - |
71 | | - &.syntax--begin::before { |
72 | | - box-shadow: |
73 | | - -2px -2px 0 -1px @group-delimiter, |
74 | | - -2px 2px 0 -1px @group-delimiter; |
75 | | - } |
76 | | - |
77 | | - &.syntax--end::after { |
78 | | - box-shadow: |
79 | | - 2px -2px 0 -1px @group-delimiter, |
80 | | - 2px 2px 0 -1px @group-delimiter; |
81 | | - } |
| 75 | + } |
| 76 | + &.syntax--capturing > .syntax--punctuation.syntax--definition.syntax--group, |
| 77 | + > .syntax--meta.syntax--group.syntax--capturing > .syntax--punctuation.syntax--definition.syntax--group { |
| 78 | + |
| 79 | + &.syntax--begin::before { |
| 80 | + box-shadow: |
| 81 | + -1px -1px 0 0 @group-delimiter-capturing, |
| 82 | + -1px 1px 0 0 @group-delimiter-capturing; |
| 83 | + border-left-color: @group-delimiter-capturing; |
82 | 84 | } |
83 | | - &.syntax--capturing > .syntax--punctuation.syntax--definition.syntax--group, |
84 | | - &.syntax--capturing > .syntax--punctuation.syntax--definition.syntax--group > .syntax--punctuation.syntax--definition.syntax--group { |
85 | | - |
86 | | - &.syntax--begin::before { |
87 | | - box-shadow: |
88 | | - -2px -2px 0 -1px @group-delimiter-capturing, |
89 | | - -2px 2px 0 -1px @group-delimiter-capturing; |
90 | | - } |
91 | | - |
92 | | - &.syntax--end::after { |
93 | | - box-shadow: |
94 | | - 2px -2px 0 -1px @group-delimiter-capturing, |
95 | | - 2px 2px 0 -1px @group-delimiter-capturing; |
96 | | - } |
| 85 | + |
| 86 | + &.syntax--end::after { |
| 87 | + box-shadow: |
| 88 | + 1px -1px 0 0 @group-delimiter-capturing, |
| 89 | + 1px 1px 0 0 @group-delimiter-capturing; |
| 90 | + border-right-color: @group-delimiter-capturing; |
97 | 91 | } |
98 | 92 | } |
99 | 93 | } |
100 | 94 | } |
| 95 | + |
| 96 | +//adjustments for breaks in a wrapped line |
| 97 | +.line .syntax--source.syntax--js .syntax--string.syntax--regexp > .syntax--meta.syntax--pattern { |
| 98 | + |
| 99 | + > .syntax--meta.syntax--group:first-child, |
| 100 | + :not(.syntax--invalid) > .syntax--meta.syntax--group:first-child { |
| 101 | + |
| 102 | + &::before { |
| 103 | + left: 0; |
| 104 | + } |
| 105 | + } |
| 106 | + :not(.syntax--invalid):not(:first-child) .syntax--meta.syntax--group:first-child { |
| 107 | + |
| 108 | + &::before { |
| 109 | + left: @half-line-height; |
| 110 | + } |
| 111 | + } |
| 112 | +} |
| 113 | +.line .syntax--source.syntax--js .syntax--string.syntax--regexp > .syntax--meta.syntax--pattern { |
| 114 | + |
| 115 | + > .syntax--meta.syntax--group:last-child, |
| 116 | + :not(.syntax--invalid) > .syntax--meta.syntax--group:last-child { |
| 117 | + |
| 118 | + &::before { |
| 119 | + right: 0; |
| 120 | + } |
| 121 | + } |
| 122 | + :not(.syntax--invalid):not(:last-child) .syntax--meta.syntax--group:last-child { |
| 123 | + |
| 124 | + &::before { |
| 125 | + right: @half-line-height; |
| 126 | + } |
| 127 | + } |
| 128 | +} |
0 commit comments