summaryrefslogtreecommitdiffstats
path: root/devtools/client/themes/changes.css
blob: fa16cd04b1a5d076601b9c499db7991c24d4d0a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* CSS Variables specific to the Changes panel that aren't defined by the themes */
:root {
  --diff-add-background-color: #f1feec;
  --diff-add-text-color: #54983f;
  --diff-remove-background-color: #fbf2f5;
  --diff-remove-text-color: #bf7173;
  --diff-source-background: var(--theme-toolbar-background);
  --diff-level: 0;
  --diff-level-offset: 10px;
  /*
    Minimum padding so content on the first level (zero) isn't touching the edge. Added
    and removed lines will re-declare this to add extra padding to clear the +/- icons.
  */
  --diff-level-min-offset: 5px;
}

:root.theme-dark {
  --diff-add-background-color: rgba(18, 188, 0, 0.15);
  --diff-add-text-color: #12BC00;
  --diff-remove-background-color: rgba(255, 0, 57, 0.15);
  --diff-remove-text-color: #FF0039;
  --diff-source-background: #222225;
}

:root[dir="rtl"] {
  /* Increase minimum offset on right-to-left layout to clear the floating scrollbar. */
  --diff-level-min-offset: 15px;
}

:root[dir="rtl"] #sidebar-panel-changes .source {
  /* Enforce left-to-right code rendering on right-to-left layout. */
  direction: ltr;
}

#sidebar-panel-changes {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: var(--theme-sidebar-background);
}

#sidebar-panel-changes .href {
  display: flex;
  align-items: center;
  color: var(--theme-toolbar-color);
  background: var(--diff-source-background);
  border-top: 1px solid var(--theme-splitter-color);
  border-bottom: 1px solid var(--theme-splitter-color);
  padding: 4px;
  padding-inline-start: var(--diff-level-min-offset);
  font-size: 12px;
}

#sidebar-panel-changes .source:first-child .href {
  border-top: unset;
}

#sidebar-panel-changes .href span {
  /* Allows trimming of flex item with overflow ellipsis within the flex container */
  min-width: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

#sidebar-panel-changes .level {
  padding-top: 3px;
  padding-right: 5px;
  padding-bottom: 3px;
  padding-left: calc(var(--diff-level-min-offset) +
                     var(--diff-level-offset) * var(--diff-level));
}

#sidebar-panel-changes .changes__toolbar {
  background: var(--theme-sidebar-background);
  border-bottom: 1px solid var(--theme-splitter-color);
  padding: 2px 5px;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Remove the top border of the first source to avoid double border from sticky toolbar */
#sidebar-panel-changes .changes__toolbar + .source .href {
  border-top: none;
}

.changes__copy-all-changes-button {
  -moz-context-properties: fill;
  /* Use the Firefox copy icon (16px) instead of the smaller DevTools one (12px) */
  background: url(chrome://global/skin/icons/edit-copy.svg) no-repeat;
  background-position: 4px 3px;
  background-size: 16px;
  border: none;
  border-radius: 3px;
  color: var(--theme-body-color);
  fill: currentColor;
  padding-block: 4px;
  padding-inline: 25px 5px;
}

.changes__copy-all-changes-button:dir(rtl) {
  background-position-x: right 4px;
}

.changes__copy-all-changes-button:hover,
.changes__copy-all-changes-button:focus {
  background-color: var(--theme-button-background);
}

.changes__copy-all-changes-button:active {
  background-color: var(--theme-button-active-background);
}

/* Hide the Copy Rule button by default. */
.changes__copy-rule-button {
  /**
   * The rgba() format of the background colors makes the button see-through and it looks
   * bad when stacked on top of long selectors.
   *
   * To solve this and not change the color format which is inherited from the Photon
   * color guide in `client/themes/variables.css`, we use a blending trick to overlay the
   * rgba() color value onto a solid color used for the panel background (achieved with
   * a linear gradient with no transition). This keeps the rgba() color, but prevents the
   * see-through effect.
   */
  background-blend-mode: overlay;
  background-color: var(--theme-button-background);
  background-image:
    linear-gradient(var(--theme-sidebar-background), var(--theme-sidebar-background));
  border-radius: 8px;
  border: none;
  color: var(--theme-body-color);
  display: none;
  padding: 1px 7px;
  position: absolute;
  right: 5px;
  top: 2px;
}

.changes__copy-rule-button:active {
  background-color: var(--theme-button-active-background);
}

.changes__rule {
  position: relative;
}

.changes__selector {
  word-wrap: break-word;
}

/* Show the Copy Rule button when hovering over the rule's selector elements */
.changes__selector:hover + .changes__copy-rule-button,
.changes__selector:hover + .changes__selector + .changes__copy-rule-button,
.changes__copy-rule-button:hover {
  display: block;
}

.changes__declaration {
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.changes__declaration-name {
  margin-left: 10px;
}

.diff-add,
.diff-remove {
  --diff-level-min-offset: 15px;
  position: relative;
}

.diff-add::before,
.diff-remove::before {
  position: absolute;
  left: 5px;
}

.diff-add {
  background-color: var(--diff-add-background-color);
}

.diff-add::before {
  content: "+";
  color: var(--diff-add-text-color);
}

.diff-remove {
  background-color: var(--diff-remove-background-color);
}

.diff-remove::before {
  content: "-";
  color: var(--diff-remove-text-color);
}

#sidebar-panel-changes .devtools-sidepanel-no-result :not(:first-child) {
  font-style: normal;
}

#sidebar-panel-changes.inspector-tabpanel {
  min-width: 0;
}