xref: /aosp_15_r20/external/perfetto/ui/src/assets/common.scss (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15@import "widgets/theme";
16@import "typefaces";
17@import "fonts";
18
19:root {
20  --sidebar-width: 230px;
21  --topbar-height: 44px;
22  --monospace-font: "Roboto Mono", monospace;
23  --track-shell-width: 250px;
24  --track-border-color: #00000025;
25  --anim-easing: cubic-bezier(0.4, 0, 0.2, 1);
26  --selection-stroke-color: #00344596;
27  --selection-fill-color: #8398e64d;
28  --overview-timeline-non-visible-color: #c8c8c8cc;
29  --details-content-height: 280px;
30}
31
32@mixin transition($time: 0.1s) {
33  transition:
34    opacity $time ease,
35    color $time ease,
36    background-color $time ease,
37    border-color $time ease,
38    width $time ease,
39    height $time ease,
40    max-width $time ease,
41    max-height $time ease,
42    margin $time ease,
43    transform $time ease,
44    box-shadow $time ease,
45    border-radius $time ease;
46}
47
48@mixin material-icon($content) {
49  @include icon;
50  content: $content;
51}
52
53* {
54  box-sizing: border-box;
55  -webkit-tap-highlight-color: transparent;
56  touch-action: none;
57}
58
59html {
60  font-family: Roboto, verdana, sans-serif;
61  height: 100%;
62  width: 100%;
63}
64
65html,
66body,
67body > main {
68  height: 100%;
69  width: 100%;
70  padding: 0;
71  margin: 0;
72  overscroll-behavior: none;
73  overflow: hidden;
74}
75
76pre,
77code {
78  font-family: var(--monospace-font);
79}
80
81// This is to minimize Mac vs Linux Chrome Headless rendering differences
82// when running UI intergrationtests via puppeteer.
83body.testing {
84  -webkit-font-smoothing: antialiased !important;
85  font-kerning: none !important;
86}
87
88h1,
89h2,
90h3 {
91  font-family: inherit;
92  font-size: inherit;
93  font-weight: inherit;
94  padding: 0;
95  margin: 0;
96}
97table {
98  user-select: text;
99}
100
101body > main {
102  display: grid;
103  grid-template-areas:
104    "sidebar topbar"
105    "sidebar alerts"
106    "sidebar page";
107  grid-template-rows: auto auto 1fr;
108  grid-template-columns: auto 1fr;
109  color: #121212;
110  overflow: hidden;
111}
112
113body.filedrag::after {
114  content: "Drop the trace file to open it";
115  position: fixed;
116  z-index: 99;
117  top: 0;
118  left: 0;
119  right: 0;
120  bottom: 0;
121  border: 10px dashed #404854;
122  text-align: center;
123  font-size: 3rem;
124  line-height: 100vh;
125  color: #333;
126  background: rgba(255, 255, 255, 0.5);
127}
128
129button {
130  background: none;
131  color: inherit;
132  border: none;
133  padding: 0;
134  font: inherit;
135  cursor: pointer;
136  outline: inherit;
137}
138
139button.close {
140  font-family: var(--monospace-font);
141}
142
143.full-page-loading-screen {
144  position: absolute;
145  width: 100%;
146  height: 100%;
147  display: flex;
148  justify-content: center;
149  align-items: center;
150  flex-direction: row;
151  background: #3e4a5a url("assets/logo-3d.png") no-repeat fixed center;
152}
153
154.page {
155  grid-area: page;
156}
157
158@mixin table-font-size {
159  font-size: 14px;
160  line-height: 18px;
161}
162
163$table-hover-color: hsl(214, 22%, 90%);
164
165$table-border-color: rgba(60, 76, 92, 0.4);
166
167$bottom-tab-padding: 10px;
168
169@mixin table-component {
170  @include bottom-panel-font;
171  @include table-font-size;
172
173  width: 100%;
174  border-collapse: collapse;
175
176  thead {
177    font-weight: normal;
178
179    td.reorderable-cell {
180      cursor: grab;
181    }
182  }
183
184  tr:hover td {
185    background-color: $table-hover-color;
186  }
187
188  tr.header {
189    border-bottom: 1px solid $table-border-color;
190    text-align: center;
191  }
192
193  td {
194    padding: 3px 5px;
195    white-space: nowrap;
196
197    i.material-icons {
198      // Shrink the icons inside the table cells to increase the information
199      // density a little bit.
200      font-size: 16px;
201    }
202
203    has-left-border {
204      border-left: 1px solid rgba(60, 76, 92, 0.4);
205    }
206  }
207}
208
209.generic-table {
210  @include table-component;
211}
212
213.pivot-table {
214  @include table-component;
215
216  thead,
217  i {
218    cursor: pointer;
219  }
220  td.first {
221    border-left: 1px solid $table-border-color;
222    padding-left: 6px;
223  }
224  .disabled {
225    cursor: default;
226  }
227  .indent {
228    display: inline-block;
229    // 16px is the width of expand_more/expand_less icon to pad out cells
230    // without the button
231    width: 16px;
232  }
233  strong {
234    font-weight: 400;
235  }
236}
237
238.pf-query-panel {
239  display: contents;
240  .pf-query-warning {
241    padding: 4px;
242    position: sticky;
243    left: 0;
244  }
245}
246
247.pf-query-table {
248  min-width: 100%;
249  font-size: 14px;
250  border: 0;
251  thead td {
252    position: sticky;
253    top: 0;
254    background-color: hsl(214, 22%, 90%);
255    color: #262f3c;
256    text-align: center;
257    padding: 1px 3px;
258    border-style: solid;
259    border-color: #fff;
260    border-right-width: 1px;
261    border-left-width: 1px;
262  }
263  tbody tr {
264    @include transition();
265    background-color: hsl(214, 22%, 100%);
266    font-family: var(--monospace-font);
267    &:nth-child(even) {
268      background-color: hsl(214, 22%, 95%);
269    }
270    td:first-child {
271      padding-left: 5px;
272    }
273    td:last-child {
274      padding-right: 5px;
275    }
276    &:hover {
277      background-color: hsl(214, 22%, 90%);
278    }
279    &[clickable] {
280      cursor: pointer;
281      &:active {
282        background-color: hsl(206, 19%, 75%);
283        box-shadow: inset 1px 1px 4px #00000040;
284        transition: none;
285      }
286    }
287  }
288}
289
290.query-error {
291  padding: 20px 10px;
292  color: hsl(-10, 50%, 50%);
293  font-family: "Roboto Mono", sans-serif;
294  font-size: 12px;
295  font-weight: 300;
296  white-space: pre;
297}
298
299.dropdown {
300  display: inline-block;
301  position: relative;
302}
303
304.dropdown-button {
305  cursor: pointer;
306}
307
308.popup-menu {
309  position: absolute;
310  background-color: white;
311  right: 0;
312  box-shadow: 0 0 4px 0 #999;
313  /* TODO(hjd): Reduce and make z-index use sensible. */
314  z-index: 1000;
315
316  &.closed {
317    display: none;
318  }
319
320  &.opened {
321    display: block;
322  }
323
324  button.open-menu {
325    border-radius: 0;
326    margin: 0;
327    height: auto;
328    background: transparent;
329    color: #111;
330    font-size: 12px;
331    padding: 0.4em 1em;
332    white-space: nowrap;
333    width: 100%;
334    text-align: right;
335    line-height: 1;
336    display: block; // Required in order for inherited white-space property not
337    // to screw up vertical rendering of the popup menu items.
338
339    &:hover {
340      background: #c7d0db;
341    }
342  }
343
344  .nested-menu {
345    padding-right: 1em;
346  }
347}
348
349.x-scrollable {
350  overflow-x: auto;
351}
352
353header.overview {
354  position: sticky;
355  top: 0;
356  left: 0;
357  display: flex;
358  align-content: baseline;
359  background-color: hsl(213, 22%, 82%);
360  color: hsl(213, 22%, 20%);
361  font-family: "Roboto Condensed", sans-serif;
362  font-size: 15px;
363  font-weight: 400;
364  padding: 4px 10px;
365  vertical-align: middle;
366  border-color: hsl(213, 22%, 75%);
367  border-style: solid;
368  border-width: 1px 0;
369  .code {
370    font-family: var(--monospace-font);
371    font-size: 12px;
372    margin-left: 10px;
373    color: hsl(213, 22%, 40%);
374  }
375  span {
376    white-space: nowrap;
377  }
378  span.code {
379    text-overflow: ellipsis;
380    max-width: 50vw;
381    overflow: hidden;
382  }
383  span.spacer {
384    flex-grow: 1;
385  }
386}
387
388.text-select {
389  user-select: text;
390}
391
392button.query-ctrl {
393  background: #262f3c;
394  color: white;
395  border-radius: 10px;
396  font-size: 10px;
397  height: 18px;
398  line-height: 18px;
399  min-width: 7em;
400  margin: auto 0 auto 1rem;
401}
402
403.perf-stats {
404  --stroke-color: hsl(217, 39%, 94%);
405  position: fixed;
406  bottom: 0;
407  left: 0;
408  width: 600px;
409  color: var(--stroke-color);
410  font-family: var(--monospace-font);
411  padding: 10px 24px;
412  z-index: 100;
413  background-color: rgba(27, 28, 29, 0.9);
414  button {
415    text-decoration: underline;
416    color: hsl(45, 100%, 48%);
417    &:hover {
418      color: hsl(6, 70%, 53%);
419    }
420  }
421  .close-button {
422    position: absolute;
423    right: 20px;
424    top: 10px;
425    width: 20px;
426    height: 20px;
427    color: var(--stroke-color);
428  }
429  & > section {
430    padding: 5px;
431    border-bottom: 1px solid var(--stroke-color);
432  }
433  div {
434    margin: 2px 0;
435  }
436  table,
437  td,
438  th {
439    border: 1px solid var(--stroke-color);
440    text-align: center;
441    padding: 4px;
442    margin: 4px 0;
443  }
444  table {
445    border-collapse: collapse;
446  }
447}
448
449.cookie-consent {
450  position: absolute;
451  z-index: 10;
452  left: 10px;
453  bottom: 10px;
454  width: 550px;
455  background-color: #19212b;
456  font-size: 14px;
457  color: rgb(180, 183, 186);
458  border-radius: 5px;
459  padding: 20px;
460
461  .buttons {
462    display: flex;
463    justify-content: flex-end;
464    margin-top: 10px;
465    font-size: 15px;
466  }
467
468  button {
469    padding: 10px;
470    border-radius: 3px;
471    color: #fff;
472    margin-left: 5px;
473    a {
474      text-decoration: none;
475      color: #fff;
476    }
477  }
478  button:hover {
479    background-color: #373f4b;
480    cursor: pointer;
481  }
482}
483
484.disallow-selection {
485  user-select: none;
486}
487
488.pivot-table {
489  user-select: text;
490  padding: $bottom-tab-padding;
491
492  button.mode-button {
493    border-radius: 10px;
494    padding: 7px;
495    margin: 5px;
496    background-color: #c7d0db;
497  }
498
499  &.query-error {
500    color: red;
501  }
502
503  .total-values {
504    text-align: right;
505    padding-right: 10px;
506  }
507
508  .empty-result {
509    padding: 10px;
510  }
511
512  td.menu {
513    text-align: left;
514  }
515
516  td {
517    // In context menu icon to go on a separate line.
518    // In regular pivot table cells, avoids wrapping the icon spacer to go on
519    // a separate line.
520    white-space: pre;
521  }
522}
523
524.name-completion {
525  input {
526    width: 90%;
527  }
528  min-height: 20vh;
529  min-width: 30vw;
530
531  .arguments-popup-sizer {
532    color: transparent;
533    user-select: none;
534    height: 0;
535  }
536}
537
538.reorderable-cell {
539  &.dragged {
540    color: gray;
541  }
542
543  &.highlight-left {
544    background: linear-gradient(90deg, $table-border-color, transparent 20%);
545  }
546
547  &.highlight-right {
548    background: linear-gradient(270deg, $table-border-color, transparent 20%);
549  }
550}
551
552.history-item {
553  border-bottom: 1px solid hsl(213, 22%, 75%);
554  padding: 0.25em 0.5em;
555  max-height: 150px;
556  overflow-y: auto;
557  position: relative;
558
559  pre {
560    font-size: 10pt;
561    margin: 0;
562    overflow-x: auto;
563    overflow-y: hidden;
564    white-space: pre-wrap;
565    position: relative;
566    cursor: pointer;
567
568    &:hover::after {
569      content: "Doubleclick to re-run";
570      font-size: 12px;
571      color: rgba(0, 0, 0, 20%);
572      position: absolute;
573      top: 0;
574      margin: auto;
575      right: 0;
576    }
577  }
578
579  &:hover {
580    background-color: hsl(213, 22%, 94%);
581    .history-item-buttons {
582      visibility: visible;
583    }
584  }
585}
586
587.history-item-buttons {
588  position: sticky;
589  float: right;
590  top: 0;
591  visibility: hidden;
592
593  button {
594    margin: 0 0.5rem;
595
596    i.material-icons,
597    i.material-icons-filled {
598      font-size: 18px;
599    }
600  }
601}
602
603.context-wrapper {
604  white-space: nowrap;
605
606  i.material-icons {
607    margin-left: 0;
608  }
609}
610