• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2024 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@use "sass:math";
16
17@mixin track_shell_title() {
18  font-size: 14px;
19  max-height: 30px;
20  overflow: hidden;
21  text-align: left;
22  overflow-wrap: break-word;
23  font-family: "Roboto Condensed", sans-serif;
24  font-weight: 300;
25  line-break: anywhere;
26}
27
28.track-content.pf-track-content-error {
29  // Necessary trig because we have a 45deg stripes
30  $pattern-density: 1px * math.sqrt(2);
31  $pattern-col: #ddd;
32
33  // box-shadow: inset 0 0 0 5px red;
34  background: repeating-linear-gradient(
35    -45deg,
36    $pattern-col,
37    $pattern-col $pattern-density,
38    white $pattern-density,
39    white $pattern-density * 2
40  );
41}
42
43.track {
44  display: grid;
45  grid-template-columns: auto 1fr;
46  grid-template-rows: 1fr 0;
47  container-type: size;
48
49  &::after {
50    display: block;
51    content: "";
52    grid-column: 1 / span 2;
53    border-top: 1px solid var(--track-border-color);
54    margin-top: -1px;
55    z-index: 2;
56  }
57
58  .track-shell {
59    @include transition();
60    cursor: grab;
61    width: var(--track-shell-width);
62    border-right: 1px solid #c7d0db;
63
64    .track-menubar {
65      position: sticky;
66      top: 0;
67      display: grid;
68      padding-block: 6px;
69      padding-left: 10px;
70      padding-right: 2px;
71      grid-template-areas: "title buttons";
72      grid-template-columns: 1fr auto;
73    }
74
75    .pf-visible-on-hover {
76      visibility: hidden;
77    }
78
79    &:hover .pf-visible-on-hover {
80      visibility: visible;
81    }
82
83    &.drag {
84      background-color: #eee;
85      box-shadow: 0 4px 12px -4px #999 inset;
86    }
87    &.drop-before {
88      box-shadow: 0 4px 2px -1px hsl(213, 40%, 50%) inset;
89    }
90    &.drop-after {
91      box-shadow: 0 -4px 2px -1px hsl(213, 40%, 50%) inset;
92    }
93
94    &.selected {
95      background-color: #ebeef9;
96    }
97
98    .chip {
99      background-color: #bed6ff;
100      border-radius: $pf-border-radius;
101      font-size: smaller;
102      padding: 0 0.1rem;
103      margin-left: 1ch;
104      white-space: nowrap;
105    }
106
107    h1 {
108      grid-area: title;
109      color: hsl(213, 22%, 30%);
110      @include track_shell_title();
111    }
112    .track-buttons {
113      grid-area: buttons;
114      display: flex;
115      height: 100%;
116      align-items: center;
117      font-size: 18px;
118    }
119
120    &.flash {
121      background-color: #ffe263;
122    }
123  }
124}
125
126.track-group-panel {
127  display: grid;
128  grid-template-columns: auto 1fr;
129  grid-template-rows: 1fr;
130  height: 40px;
131
132  .shell {
133    border-right: 1px solid transparent;
134    padding-right: 2px;
135  }
136
137  &::after {
138    display: block;
139    content: "";
140    grid-column: 1 / span 2;
141    border-top: 1px solid var(--track-border-color);
142    margin-top: -1px;
143  }
144  &[collapsed="true"] {
145    background-color: var(--collapsed-background);
146    .shell {
147      border-right: 1px solid #c7d0db;
148    }
149    .track-button {
150      color: rgb(60, 86, 136);
151    }
152  }
153  &[collapsed="false"] {
154    background-color: var(--expanded-background);
155    color: white;
156    font-weight: bold;
157    .shell.flash {
158      color: #121212;
159    }
160    .track-button {
161      color: white;
162    }
163    span.chip {
164      color: #121212;
165    }
166  }
167  .shell {
168    padding-left: 10px;
169    display: grid;
170    grid-template-areas: "fold-button title buttons";
171    grid-template-columns: 28px 1fr auto;
172    align-items: center;
173    line-height: 1;
174    width: var(--track-shell-width);
175    min-height: 40px;
176
177    .track-title {
178      user-select: text;
179    }
180
181    .track-subtitle {
182      font-size: 0.6rem;
183      font-weight: normal;
184      overflow: hidden;
185      white-space: nowrap;
186      text-overflow: ellipsis;
187      // Maximum width according to grid-template-columns value for .shell
188      width: calc(var(--track-shell-width) - 56px);
189    }
190
191    .chip {
192      background-color: #bed6ff;
193      border-radius: $pf-border-radius;
194      font-size: smaller;
195      padding: 0 0.1rem;
196      margin-left: 1ch;
197      white-space: nowrap;
198    }
199
200    .title-wrapper {
201      grid-area: title;
202      overflow: hidden;
203    }
204    h1 {
205      @include track_shell_title();
206    }
207    .fold-button {
208      grid-area: fold-button;
209    }
210
211    .track-buttons {
212      grid-area: buttons;
213      display: flex;
214      height: 100%;
215      align-items: center;
216      font-size: 18px;
217    }
218
219    &:hover {
220      cursor: pointer;
221      .fold-button {
222        color: hsl(45, 100%, 48%);
223      }
224    }
225    &.flash {
226      background-color: #ffe263;
227    }
228    &.selected {
229      background-color: #ebeef9;
230    }
231  }
232  .track-content {
233    display: grid;
234    span {
235      @include track_shell_title();
236      align-self: center;
237    }
238  }
239}
240
241.pf-panel-group {
242  .track-shell {
243    .track-menubar {
244      top: 40px;
245    }
246  }
247}
248
249// If the track is short, center the track titlebar vertically
250@container (height < 26px) {
251  .track {
252    .track-shell {
253      display: flex;
254      flex-direction: column;
255      align-items: stretch;
256      justify-content: center;
257
258      .track-menubar {
259        padding-block: 0px;
260      }
261    }
262  }
263}
264