summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/components/App.css
blob: 15dfa06f5e0f7a4ab6bcb67fdb790becf68ce057 (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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
/* 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/. */

html,
body {
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#app-wrapper {
  height: 100vh;
  max-height: 100vh;
}

.webconsole-output {
  direction: ltr;
  overflow: auto;
  overflow-anchor: none;
  user-select: text;
  position: relative;
  container-name: console-output;
  container-type: inline-size;
}

.webconsole-app {
  --object-inspector-hover-background: transparent;
  --attachment-margin-block-end: 3px;
  --primary-toolbar-height: 29px;
  display: grid;
  /*
    * Here's the design we want in in-line mode
    * +----------------------------------------------+
    * |            [ChromeDebugToolbar]              |
    * +----------------------------------------------+
    * |    Filter bar primary      ↔                 |
    * +----------------------------↔                 |
    * |   [Filter bar secondary]   ↔                 |
    * +----------------------------↔                 |
    * |                            ↔                 |
    * +  +----------------------+  ↔                 |
    * |  |                      |  ↔                 |
    * |  |        Output        |  ↔    [sidebar]    |
    * |  |                      |  ↔                 |
    * |  +----------------------+  ↔                 |
    * |  |   [NotificationBox]  |  ↔                 |
    * |  +----------------------+  ↔                 |
    * |  |                      |  ↔                 |
    * |  |        JSTerm        |  ↔                 |
    * |  |                      |  ↔                 |
    * |  +----------------------+  ↔                 |
    * |  |  [EagerEvaluation]   |  ↔                 |
    * |  +----------------------+  ↔                 |
    * |  |  [EvalNotification]  |  ↔                 |
    * |  +----------------------+  ↔                 |
    * +----------------------------↔                 |
    * |  [Reverse search input]    ↔                 |
    * +----------------------------------------------+
    *
     * - ↔ are width resizers
     * - Elements inside brackets may not be visible, so we set
     *   rows/columns to "auto" to make them collapse when the element
     *   they contain is hidden.
    */
  grid-template-areas: "chrome-debug-toolbar     chrome-debug-toolbar"
                       "filter-toolbar           sidebar"
                       "filter-toolbar-secondary sidebar"
                       "output-input             sidebar"
                       "eval-notification        sidebar"
                       "reverse-search           sidebar";
  grid-template-rows: auto var(--primary-toolbar-height) auto 1fr auto auto;
  grid-template-columns: minmax(200px, 1fr) minmax(0, auto);
  max-height: 100vh !important;
  height: 100vh !important;
  width: 100vw;
  overflow: hidden;
  color: var(--console-output-color);
  -moz-user-focus: normal;
}

.chrome-debug-toolbar {
  grid-column: chrome-debug-toolbar;
  grid-row: chrome-debug-toolbar;
}

.webconsole-filteringbar-wrapper {
  grid-column: filter-toolbar;
  grid-row: filter-toolbar / filter-toolbar-secondary;
  grid-template-rows: subgrid;
}

.webconsole-filterbar-primary {
  grid-row: filter-toolbar;
}

/* Only put the filter buttons toolbar on its own row in narrow filterbar layout  */
.narrow .devtools-toolbar.webconsole-filterbar-secondary {
  grid-row: filter-toolbar-secondary;
}

.flexible-output-input {
  display: flex;
  flex-direction: column;
  grid-area: output-input;
  /* Don't take more height than the grid allows to */
  max-height: 100%;
  overflow: hidden;
}

.flexible-output-input .webconsole-output {
  flex-shrink: 100000;
  overflow-x: hidden;
}

.flexible-output-input > .webconsole-output:not(:empty) {
  min-height: var(--console-row-height);
}

/* webconsole.css | chrome://devtools/skin/webconsole.css */
.webconsole-filteringbar-wrapper .devtools-toolbar {
  padding-inline-end: 0;
}

.devtools-button.webconsole-console-settings-menu-button {
  /* adjust outline offset so it's not clipped */
  --theme-outline-offset: -2px;
  height: 100%;
  margin: 0;
}

.webconsole-console-settings-menu-button::before {
  background-image: url("chrome://devtools/skin/images/settings.svg");
}

.webconsole-app .jsterm-input-container {
  overflow-y: auto;
  overflow-x: hidden;
  /* We display the open editor button at the end of the input */
  display: grid;
  grid-template-columns: 1fr auto;
  /* This allows us to not define a column for the CodeMirror container */
  grid-auto-flow: column;
  /* This element has tabindex="-1" and can briefly show a focus outline when
   * clicked, before we move the focus to CodeMirror. */
  outline: none;
}

.webconsole-app:not(.jsterm-editor) .jsterm-input-container {
  direction: ltr;
  /* Define the border width and padding as variables so that we can keep
   * border-top-width, padding and min-height in sync. */
  --jsterm-border-width: 0;
  --jsterm-padding-top: 0;
  --jsterm-padding-bottom: 0;
  min-height: calc(
    var(--console-row-height) +
    var(--jsterm-border-width) +
    var(--jsterm-padding-top) +
    var(--jsterm-padding-bottom)
  );
  padding-top: var(--jsterm-padding-top);
  padding-bottom: var(--jsterm-padding-bottom);
  border-top-color: var(--theme-splitter-color);
  border-top-width: var(--jsterm-border-width);
  border-top-style: solid;
}

.webconsole-app .webconsole-output:not(:empty) ~ .jsterm-input-container {
  --jsterm-border-width: 1px;
}

.webconsole-app:not(.jsterm-editor, .eager-evaluation) .jsterm-input-container {
  /* The input should be full-height when eager evaluation is disabled. */
  flex-grow: 1;
  --jsterm-padding-top: var(--console-input-extra-padding);
  --jsterm-padding-bottom: var(--console-input-extra-padding);
}

.webconsole-app:not(.jsterm-editor).eager-evaluation .jsterm-input-container {
  --jsterm-padding-top: var(--console-input-extra-padding);
}

.webconsole-input-openEditorButton {
    /* adjust outline offset so it's not clipped */
  --theme-outline-offset: -2px;
  height: var(--console-row-height);
  margin: 0;
  padding-block: 0;
}

.webconsole-input-buttons {
  grid-column: -1 / -2;
  display: flex;
  align-items: flex-start;
}

:root:dir(rtl) .webconsole-input-openEditorButton {
  transform: scaleX(-1);
}

.webconsole-input-openEditorButton::before {
  background-image: url("chrome://devtools/skin/images/webconsole/editor.svg");
}

.webconsole-app .reverse-search {
  grid-area: reverse-search;
  /* Those 2 next lines make it so the element isn't impacting the grid column size, but
     will still take the whole available space. */
  width: 0;
  min-width: 100%;
  /* Let the reverse search buttons wrap to the next line */
  flex-wrap: wrap;
  justify-content: end;
}

.sidebar {
  display: grid;
  grid-area: sidebar;
  grid-template-rows: subgrid;
  border-inline-start: 1px solid var(--theme-splitter-color);
  background-color: var(--theme-sidebar-background);
  width: 200px;
  min-width: 150px;
  max-width: 100%;
}

.sidebar-resizer {
  grid-row: 1 / -1;
  grid-column: -1 / -2;
}

.webconsole-sidebar-toolbar {
  grid-row: 1 / 2;
  min-height: 100%;
  display: flex;
  justify-content: end;
  margin: 0;
  padding: 0;
}

.sidebar-contents {
  grid-row: 2 / -1;
  overflow: auto;
  direction: ltr;
}

.webconsole-sidebar-toolbar .sidebar-close-button {
  margin: 0;
}

.sidebar-close-button::before {
  background-image: url("chrome://devtools/skin/images/close.svg");
}

.sidebar-contents .object-inspector {
  min-width: 100%;
}

/** EDITOR MODE */
.webconsole-app.jsterm-editor {
  display: grid;
  /*
     * Here's the design we want in editor mode
     * +-----------------------------------------------------------------------+
     * |                 [ChromeDebugToolbar]                 |
     * +-----------------------------------------------------------------------+
     * |                 [Notification Box (self XSS warning)]                 |
     * +--------------------------+--------------------------+-----------------+
     * |    Editor Toolbar        ↔    Filter bar primary    ↔                 |
     * +--------------------------↔--------------------------↔                 |
     * |                          ↔  [Filter bar secondary]  ↔                 |
     * |                          ↔--------------------------↔                 |
     * |                          ↔                          ↔                 |
     * |         Editor           ↔        output            ↔    [sidebar]    |
     * |                          ↔                          ↔                 |
     * |                          ↔                          ↔                 |
     * |                          ↔                          ↔                 |
     * |                          ↔                          ↔                 |
     * +--------------------------↔                          ↔                 |
     * |    [Eager evaluation]    ↔                          ↔                 |
     * +--------------------------↔                          ↔                 |
     * |   [Eval Notification]    ↔                          ↔                 |
     * +--------------------------↔                          ↔                 |
     * |  [Reverse search input]  ↔                          ↔                 |
     * +-----------------------------------------------------+-----------------+
     *
     * - ↔ are width resizers
     * - Elements inside brackets may not be visible, so we set
     *   rows/columns to "auto" to make them collapse when the element
     *   they contain is hidden.
     */
  grid-template-areas: "chrome-debug-toolbar  chrome-debug-toolbar      chrome-debug-toolbar"
                       "notification          notification              notification"
                       "editor-toolbar        filter-toolbar            sidebar"
                       "editor                filter-toolbar-secondary  sidebar"
                       "editor                output                    sidebar"
                       "eager-evaluation      output                    sidebar"
                       "eval-notification     output                    sidebar"
                       "reverse-search        output                    sidebar";
  grid-template-rows:
    auto
    auto
    var(--primary-toolbar-height)
    auto
    1fr
    auto
    auto
    auto;
  grid-template-columns: minmax(150px, auto) minmax(200px, 1fr) minmax(0, auto);
}

.jsterm-editor .flexible-output-input {
  /* This allow us to place the div children (jsterm, output, notification) on the grid */
  display: contents;
}

.jsterm-editor .webconsole-editor-toolbar {
  grid-area: editor-toolbar;
  border-inline-end: 1px solid var(--theme-splitter-color);
  display: grid;
  align-items: center;
  /*
     * The following elements are going to be present in the toolbar:
     *   - The run button
     *   - The evaluation selector button
     *   - The pretty print button
     *   - A separator
     *   - The history nav
     *   - A separator
     *   - The close button
     *
     * +-------------------------------------------+
     * | ▶︎ Run  Top↕               {} | ˄ ˅ 🔍 | ✕ |
     * +-------------------------------------------+
     *
     */
  grid-template-columns: auto auto 1fr auto auto auto auto auto auto auto;
  height: unset;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-executeButton {
  padding-inline: 4px 8px;
  height: 20px;
  margin-inline-start: 5px;
  display: flex;
  align-items: center;
}


.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-executeButton::before {
  content: url("chrome://devtools/skin/images/webconsole/run.svg");
  height: 16px;
  width: 16px;
  -moz-context-properties: fill;
  fill: currentColor;
  margin-inline-end: 2px;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-prettyPrintButton {
  grid-column: -7 / -8;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-prettyPrintSeparator {
  grid-column: -6 / -7;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-history-prevExpressionButton {
  grid-column: -5 / -6;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-history-nextExpressionButton {
  grid-column: -4 / -5;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-reverseSearchButton {
  grid-column: -3 / -4;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-historyNavSeparator {
  grid-column: -2 / -3;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-closeButton {
  grid-column: -1 / -2;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-prettyPrintButton::before {
  mask-image: url("chrome://devtools/content/debugger/images/prettyPrint.svg");
  background-size: 16px;
  background-color: var(--theme-icon-color);
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-history-prevExpressionButton::before {
  background-image: url("chrome://devtools/skin/images/arrowhead-up.svg");
  background-size: 16px;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-history-nextExpressionButton::before {
  background-image: url("chrome://devtools/skin/images/arrowhead-down.svg");
  background-size: 16px;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-reverseSearchButton::before {
  background-image: url("chrome://devtools/skin/images/webconsole/reverse-search.svg");
  background-size: 14px;
}

.jsterm-editor .webconsole-editor-toolbar .webconsole-editor-toolbar-closeButton::before {
  background-image: url("chrome://devtools/skin/images/close.svg");
}

.jsterm-editor .webconsole-input-openEditorButton {
  display: none;
}

.jsterm-editor .webconsole-output {
  grid-area: output;
}

.jsterm-editor .jsterm-input-container {
  grid-area: editor;
  width: 30vw;
  /* Don't allow the input to be narrower than the grid-column it's in  */
  min-width: 100%;
  border-top: none;
  border-inline-end: 1px solid var(--theme-splitter-color);
  padding: 0;
  /* Needed as we might have the onboarding UI displayed */
  display: flex;
  flex-direction: column;
  background-color: var(--theme-sidebar-background);
}

.jsterm-editor #webconsole-notificationbox {
  grid-area: notification;
}

.jsterm-editor .jsterm-input-container > .CodeMirror {
  flex: 1;
  padding-inline-start: 0;
  font-size: var(--theme-code-font-size);
  line-height: var(--theme-code-line-height);
  background-image: none;
}

.jsterm-editor .eager-evaluation-result {
  grid-area: eager-evaluation;
  /* The next 2 lines make it so the element isn't impacting the grid column size, but
    will still take the whole available space. */
  min-width: 100%;
  width: 0;
}

.evaluation-notification {
  grid-area: eval-notification;
  /* The next 2 lines make it so the element isn't impacting the grid column size, but
    will still take the whole available space. */
  min-width: 100%;
  width: 0;
  border: 1px solid;
  display: flex;
  padding: 0.5em;
}

.jsterm-editor .editor-resizer {
  grid-column: editor;
  /* We want the splitter to cover the whole column (minus self-xss message) */
  grid-row: editor / reverse-search;
}

.editor-onboarding {
  display: none;
}

.jsterm-editor .editor-onboarding {
  display: grid;
  /**
   * Here's the design we want:
   * ┌──────┬────────────────────────┐
   * │ Icon │    Onboarding text     │
   * ├──────┼────────────────────────┤
   * │      │                 Got it!│
   * └──────┴────────────────────────┘
   **/
  grid-template-columns: 22px 1fr;
  border-bottom: 1px solid var(--theme-splitter-color);
  padding: 8px 16px;
  background-color: var(--theme-body-alternate-emphasized-background);
  grid-gap: 0 14px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  line-height: 1.5;
}

.editor-onboarding-fox {
  width: 22px;
  height: 22px;
  align-self: center;
}

.jsterm-editor .editor-onboarding p {
  padding: 0;
  margin: 0;
}

.jsterm-editor .editor-onboarding .editor-onboarding-shortcut {
  font-weight: bold;
}

.editor-onboarding-dismiss-button {
  grid-row: 2 / 3;
  grid-column: 2 / 3;
  justify-self: end;
  padding: 2px;
  background: transparent;
  border: none;
  color: var(--theme-link-color);
  font-family: inherit;
  cursor: pointer;
  font-size: inherit;
}