Debian Codegraph @

extensions/VisualEditor/lib/ve/src/ui/styles/elements/ve.ui.DiffElement.less

raw
1 /*!
2 * VisualEditor UserInterface DiffElement styles.
3 *
4 * @copyright See AUTHORS.txt
5 * @license The MIT License (MIT); see LICENSE.txt
6 */
7
8 /* stylelint-disable-next-line selector-class-pattern */
9 .solidToOpacity( @property, @color, @opacity, @before: '', @after: '' ) {
10 @{property}: ~'@{before}' fade( ( ( @color - ( 1 - @opacity ) * ( #fff ) ) / @opacity ), @opacity * 100 ) ~'@{after}';
11 }
12
13 .ve-ui-diffElement {
14 position: relative;
15
16 &::after {
17 content: '';
18 clear: both;
19 display: block;
20 }
21
22 &-content {
23 overflow-x: auto;
24 position: relative;
25 /* Render 5px padding so highlight outlines are visible */
26 margin-left: -5px;
27 padding-left: 5px;
28
29 .ve-ui-diffElement-hasDescriptions & {
30 margin-right: 16em;
31 padding-right: 1em;
32 border-right: 1px solid #c8ccd1;
33
34 @media ( max-width: 640px ) {
35 padding-right: 0;
36 margin-right: 5.5em;
37 border-right: 0;
38 }
39 }
40 }
41
42 &-sidebar {
43 .ve-ui-diffElement-hasDescriptions & {
44 position: absolute;
45 top: 0;
46 right: 0;
47 width: 15em;
48
49 @media ( max-width: 640px ) {
50 width: 5em;
51 }
52 }
53 }
54
55 &-overlays {
56 position: absolute;
57 opacity: 0.5;
58 z-index: 2;
59 pointer-events: none;
60 }
61
62 &-highlight {
63 position: absolute;
64 /* background: #6da9f7; */
65 outline: 3px solid #6da9f7;
66 padding: 2px;
67 margin: -2px 0 0 -2px;
68 pointer-events: none;
69 }
70
71 &-attributeChange {
72 color: #72777d;
73
74 del {
75 background-color: #f2c2bf;
76 box-shadow: 0 0 0 1px #f2c2bf;
77 text-decoration: line-through;
78
79 &:hover {
80 background-color: #f2c2bf;
81 box-shadow: 0 0 0 1px #f2c2bf;
82 text-decoration: none;
83 }
84 }
85
86 ins {
87 background-color: #c4ede4;
88 box-shadow: 0 0 0 1px #c4ede4;
89 text-decoration: none;
90 }
91
92 &.oo-ui-labelElement .oo-ui-labelElement-label {
93 /* Respect line breaks and prevent collapsing added/removed spaces */
94 white-space: pre-wrap;
95 word-break: break-word;
96 word-wrap: break-word;
97 overflow-wrap: break-word;
98
99 ol,
100 ul {
101 margin-left: 1.8em;
102 }
103 }
104 }
105 }
106
107 .ve-ui-changeDescriptionsSelectWidget {
108 > .oo-ui-optionWidget {
109 cursor: default;
110 font-size: 0.92857143em; /* 13/14px */
111
112 &-highlighted {
113 background: fade( #6da9f7, 50% );
114 }
115 }
116 }
117
118 [ data-diff-action='insert' ],
119 [ data-diff-action='remove' ],
120 [ data-diff-action='change-insert' ],
121 [ data-diff-action='change-remove' ] {
122 text-decoration: inherit;
123 }
124
125 /* Prevent collapsing added/removed spaces (T170114), but only inline (T300444) */
126 ins[ data-diff-action='insert' ],
127 del[ data-diff-action='remove' ] {
128 /* Support: Chrome<76, Firefox<69 */
129 /* Fallback for browsers which don't support break-spaces */
130 white-space: pre-wrap;
131 /* T348006 - ensure all removed/inserted spaces are shown, even at the end of a line */
132 white-space: break-spaces;
133 }
134
135 [ data-diff-action='insert' ] {
136 &,
137 /* elements using display:table-caption need separate backgrounds as they render outside the parent's bounding box */
138 & > caption,
139 & > figcaption {
140 .solidToOpacity( background-color, #7fd7c4, 0.5, '', '!important' );
141 .solidToOpacity( box-shadow, #7fd7c4, 0.5, '0 0 0 1px' );
142 }
143 }
144
145 [ data-diff-action='remove' ] {
146 &,
147 /* elements using display:table-caption need separate backgrounds as they render outside the parent's bounding box */
148 & > caption,
149 & > figcaption {
150 .solidToOpacity( background-color, #e88e89, 0.5, '', '!important' );
151 .solidToOpacity( box-shadow, #e88e89, 0.5, '0 0 0 1px' );
152 }
153 }
154
155 [ data-diff-action='change' ],
156 [ data-diff-action='change-insert' ] {
157 .solidToOpacity( background-color, #b6d4fb, 0.5, '', '!important' );
158 .solidToOpacity( box-shadow, #b6d4fb, 0.5, '0 0 0 1px' );
159 }
160
161 [ data-diff-move ] {
162 &,
163 /* elements using display:table-caption need separate backgrounds as they render outside the parent's bounding box */
164 & > caption,
165 & > figcaption {
166 .solidToOpacity( background, #eaecf0, 0.5 );
167 .solidToOpacity( outline, #eaecf0, 0.5, '5px solid' );
168 }
169 }
170
171 [ data-diff-action='change-remove' ] {
172 display: none;
173 }
174
175 [ data-diff-action='remove' ] { /* stylelint-disable-line no-duplicate-selectors */
176 text-decoration: line-through;
177
178 &:hover {
179 text-decoration: none;
180 }
181 }
182
183 /* Add some space to separate insertions from removals (inline only) */
184 /* TODO: These sibling selectors still match when there is a text node in-between, should be fixed in JS */
185 del[ data-diff-action='remove' ] + ins[ data-diff-action='insert' ],
186 ins[ data-diff-action='insert' ] + del[ data-diff-action='remove' ],
187 del[ data-diff-action='remove' ] + span[ data-diff-action='change-insert' ],
188 ins[ data-diff-action='insert' ] + span[ data-diff-action='change-remove' ] {
189 margin-left: 4px;
190 }
191
192 [ data-diff-action='none' ]:not( [ data-diff-move ] ) {
193 opacity: 0.4;
194
195 /* List items only apply this style to the marker. The contents
196 is styled separately to avoid styling nested lists. */
197 li& {
198 opacity: 1;
199
200 &::marker {
201 color: #72777d;
202 }
203 }
204 }
205
206 [ data-diff-action='insert' ],
207 [ data-diff-action='remove' ],
208 [ data-diff-action='change' ],
209 [ data-diff-action='change-insert' ],
210 [ data-diff-action='change-remove' ],
211 [ data-diff-move ] {
212 /* Create new stacking context to match one created by opacity on data-diff-action=none (T190916) */
213 position: relative;
214 z-index: 1;
215
216 /* Blend contents into the background (I7a7e27b1218) */
217 & > * {
218 mix-blend-mode: darken;
219 }
220 }
221
222 .ve-ui-diffElement-moved-up,
223 .ve-ui-diffElement-moved-down {
224 position: relative;
225 padding-left: 1em;
226
227 &::before {
228 position: absolute;
229 left: 0;
230 line-height: 1;
231 }
232 }
233
234 .ve-ui-diffElement-moved-down::before {
235 content: '↓';
236 }
237
238 .ve-ui-diffElement-moved-up::before {
239 content: '↑';
240 }
241
242 [ data-diff-action='insert' ],
243 [ data-diff-action='remove' ],
244 [ data-diff-move ] {
245 &:empty::before,
246 *:empty::before {
247 content: url( data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 );
248 }
249 }
250
251 .ve-ui-diffElement-no-changes {
252 color: #72777d;
253 font-style: italic;
254 }
255
256 .ve-ui-diffElement-spacer {
257 color: #72777d;
258 clear: both;
259 }
260
261 [ data-diff-list-spacer ],
262 .ve-ui-diffElement-internalListSpacer {
263 list-style-type: none !important; /* stylelint-disable-line declaration-no-important */
264 list-style-image: none;
265 }
266
267 [ data-diff-list-none ]::marker {
268 /* Approximate 40% opacity, but we can't style the list marker with opacity */
269 color: #fff * 0.6;
270 }