chrome-devtools-frontend 1.0.941095 → 1.0.941208

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/config/gni/all_devtools_files.gni +0 -7
  2. package/config/gni/devtools_grd_files.gni +7 -1
  3. package/config/gni/devtools_image_files.gni +1 -0
  4. package/front_end/.eslintrc.js +1 -0
  5. package/front_end/Images/src/feedback_button_icon.svg +3 -0
  6. package/front_end/core/i18n/locales/en-US.json +3 -0
  7. package/front_end/core/i18n/locales/en-XL.json +3 -0
  8. package/front_end/entrypoints/shell/shell.json +0 -1
  9. package/front_end/global_typings/global_defs.d.ts +5 -0
  10. package/front_end/legacy_test_runner/console_test_runner/console_test_runner.js +14 -2
  11. package/front_end/legacy_test_runner/test_runner/TestRunner.js +9 -0
  12. package/front_end/panels/application/module.json +0 -1
  13. package/front_end/panels/layer_viewer/module.json +1 -2
  14. package/front_end/panels/media/module.json +1 -2
  15. package/front_end/panels/network/module.json +0 -1
  16. package/front_end/panels/profiler/module.json +1 -2
  17. package/front_end/panels/timeline/module.json +0 -1
  18. package/front_end/ui/components/docs/panel_feedback/button.html +25 -0
  19. package/front_end/ui/components/docs/panel_feedback/button.ts +18 -0
  20. package/front_end/ui/components/panel_feedback/FeedbackButton.ts +67 -0
  21. package/front_end/ui/components/panel_feedback/panel_feedback.ts +1 -0
  22. package/front_end/ui/legacy/Widget.ts +1 -1
  23. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +2 -1
  24. package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +3 -1
  25. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +2 -1
  26. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +2 -1
  27. package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +3 -1
  28. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +2 -1
  29. package/front_end/ui/legacy/utils/append-style.ts +9 -4
  30. package/package.json +1 -1
  31. package/scripts/build/generate_css_js_files.js +23 -9
  32. package/scripts/build/ninja/generate_css.gni +10 -1
  33. package/scripts/eslint_rules/lib/check_css_import.js +2 -2
  34. package/scripts/eslint_rules/tests/check_css_import_test.js +12 -0
  35. package/front_end/ui/legacy/components/perf_ui/module.json +0 -13
@@ -63,13 +63,6 @@ all_devtools_files = [
63
63
  "front_end/legacy_test_runner/network_test_runner/network_test_runner.js",
64
64
  "front_end/panels/network/module.json",
65
65
  "front_end/entrypoints/node_main/nodeConnectionsPanel.css",
66
- "front_end/ui/legacy/components/perf_ui/chartViewport.css",
67
- "front_end/ui/legacy/components/perf_ui/filmStripView.css",
68
- "front_end/ui/legacy/components/perf_ui/flameChart.css",
69
- "front_end/ui/legacy/components/perf_ui/module.json",
70
- "front_end/ui/legacy/components/perf_ui/overviewGrid.css",
71
- "front_end/ui/legacy/components/perf_ui/timelineGrid.css",
72
- "front_end/ui/legacy/components/perf_ui/timelineOverviewInfo.css",
73
66
  "front_end/legacy_test_runner/performance_test_runner/performance_test_runner.js",
74
67
  "front_end/legacy_test_runner/performance_test_runner/TimelineDataTestRunner.js",
75
68
  "front_end/legacy_test_runner/performance_test_runner/TimelineTestRunner.js",
@@ -52,6 +52,7 @@ grd_files_release_sources = [
52
52
  "front_end/Images/elements_panel_icon.svg",
53
53
  "front_end/Images/errorWave.svg",
54
54
  "front_end/Images/error_icon.svg",
55
+ "front_end/Images/feedback_button_icon.svg",
55
56
  "front_end/Images/feedback_thin_16x16_icon.svg",
56
57
  "front_end/Images/flex-direction-icon.svg",
57
58
  "front_end/Images/flex-nowrap-icon.svg",
@@ -504,7 +505,6 @@ grd_files_release_sources = [
504
505
  "front_end/ui/legacy/components/perf_ui/perf_ui-legacy.js",
505
506
  "front_end/ui/legacy/components/perf_ui/perf_ui-meta.js",
506
507
  "front_end/ui/legacy/components/perf_ui/perf_ui.js",
507
- "front_end/ui/legacy/components/perf_ui/perf_ui_module.js",
508
508
  "front_end/ui/legacy/components/quick_open/quick_open-legacy.js",
509
509
  "front_end/ui/legacy/components/quick_open/quick_open-meta.js",
510
510
  "front_end/ui/legacy/components/quick_open/quick_open.js",
@@ -1537,7 +1537,13 @@ grd_files_debug_sources = [
1537
1537
  "front_end/ui/legacy/components/perf_ui/PieChart.js",
1538
1538
  "front_end/ui/legacy/components/perf_ui/TimelineGrid.js",
1539
1539
  "front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.js",
1540
+ "front_end/ui/legacy/components/perf_ui/chartViewport.css.legacy.js",
1541
+ "front_end/ui/legacy/components/perf_ui/filmStripView.css.legacy.js",
1542
+ "front_end/ui/legacy/components/perf_ui/flameChart.css.legacy.js",
1543
+ "front_end/ui/legacy/components/perf_ui/overviewGrid.css.legacy.js",
1540
1544
  "front_end/ui/legacy/components/perf_ui/pieChart.css.js",
1545
+ "front_end/ui/legacy/components/perf_ui/timelineGrid.css.legacy.js",
1546
+ "front_end/ui/legacy/components/perf_ui/timelineOverviewInfo.css.js",
1541
1547
  "front_end/ui/legacy/components/quick_open/CommandMenu.js",
1542
1548
  "front_end/ui/legacy/components/quick_open/FilteredListWidget.js",
1543
1549
  "front_end/ui/legacy/components/quick_open/HelpQuickOpen.js",
@@ -64,6 +64,7 @@ devtools_svg_sources = [
64
64
  "elements_panel_icon.svg",
65
65
  "errorWave.svg",
66
66
  "error_icon.svg",
67
+ "feedback_button_icon.svg",
67
68
  "feedback_thin_16x16_icon.svg",
68
69
  "flex-direction-icon.svg",
69
70
  "flex-nowrap-icon.svg",
@@ -32,6 +32,7 @@ module.exports = {
32
32
  'rulesdir/ban_style_tags_in_lit_html': 2,
33
33
  'rulesdir/ban_a_tags_in_lit_html': 2,
34
34
  'rulesdir/check_component_naming': 2,
35
+ 'rulesdir/check_css_import': 2,
35
36
  'rulesdir/check_was_shown_methods': 2,
36
37
  'rulesdir/static_custom_event_names': 2,
37
38
  'rulesdir/lit_html_host_this': 2,
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M17.3335 5.83325H6.66683C5.9335 5.83325 5.34016 6.43325 5.34016 7.16659L5.3335 19.1666L8.00016 16.4999H17.3335C18.0668 16.4999 18.6668 15.8999 18.6668 15.1666V7.16659C18.6668 6.43325 18.0668 5.83325 17.3335 5.83325ZM17.3335 15.1666H7.44683L7.0535 15.5599L6.66683 15.9466V7.16659H17.3335V15.1666ZM11.3335 12.4999H12.6668V13.8333H11.3335V12.4999ZM11.3335 8.49992H12.6668V11.1666H11.3335V8.49992Z" fill="black"/>
3
+ </svg>
@@ -11453,6 +11453,9 @@
11453
11453
  "ui/components/linear_memory_inspector/ValueInterpreterSettings.ts | otherGroup": {
11454
11454
  "message": "Other"
11455
11455
  },
11456
+ "ui/components/panel_feedback/FeedbackButton.ts | feedback": {
11457
+ "message": "Feedback"
11458
+ },
11456
11459
  "ui/components/panel_feedback/PanelFeedback.ts | previewFeature": {
11457
11460
  "message": "Preview feature"
11458
11461
  },
@@ -11453,6 +11453,9 @@
11453
11453
  "ui/components/linear_memory_inspector/ValueInterpreterSettings.ts | otherGroup": {
11454
11454
  "message": "Ôt́ĥér̂"
11455
11455
  },
11456
+ "ui/components/panel_feedback/FeedbackButton.ts | feedback": {
11457
+ "message": "F̂éêd́b̂áĉḱ"
11458
+ },
11456
11459
  "ui/components/panel_feedback/PanelFeedback.ts | previewFeature": {
11457
11460
  "message": "P̂ŕêv́îéŵ f́êát̂úr̂é"
11458
11461
  },
@@ -4,7 +4,6 @@
4
4
  { "name": "ui/legacy/components/text_editor", "type": "autostart" },
5
5
  { "name": "ui/legacy/components/source_frame", "type": "autostart" },
6
6
 
7
- { "name": "ui/legacy/components/perf_ui" },
8
7
  { "name": "panels/profiler" }
9
8
  ]
10
9
  }
@@ -25,3 +25,8 @@ declare module '*.css.js' {
25
25
  const styles: CSSStyleSheet;
26
26
  export default styles;
27
27
  }
28
+
29
+ declare module '*.css.legacy.js' {
30
+ const styles: {cssContent: string};
31
+ export default styles;
32
+ }
@@ -113,6 +113,14 @@ ConsoleTestRunner.prepareConsoleMessageText = function(messageElement) {
113
113
  return messageText;
114
114
  };
115
115
 
116
+ /**
117
+ * @param {!Element} messageElement
118
+ * @return {string}
119
+ */
120
+ ConsoleTestRunner.prepareConsoleMessageTextTrimmed = function(messageElement) {
121
+ return ConsoleTestRunner.prepareConsoleMessageText(messageElement).replace(/[ ]+/g, ' ');
122
+ };
123
+
116
124
  /**
117
125
  * @param {!Console.ConsoleViewMessage} viewMessage
118
126
  * @param {boolean} forceInvalidate
@@ -334,15 +342,19 @@ ConsoleTestRunner.dumpConsoleMessagesWithStyles = function() {
334
342
 
335
343
  /**
336
344
  * @param {boolean=} sortMessages
345
+ * @param {boolean=} trimMessages
337
346
  */
338
- ConsoleTestRunner.dumpConsoleMessagesWithClasses = async function(sortMessages) {
347
+ ConsoleTestRunner.dumpConsoleMessagesWithClasses = async function(sortMessages, trimMessages) {
339
348
  const result = [];
340
349
  const messageViews = Console.ConsoleView.instance().visibleViewMessages;
341
350
  for (let i = 0; i < messageViews.length; ++i) {
342
351
  const element = messageViews[i].element();
343
352
  const contentElement = messageViews[i].contentElement();
344
353
  await TestRunner.waitForPendingLiveLocationUpdates();
345
- const messageText = ConsoleTestRunner.prepareConsoleMessageText(element);
354
+ let messageText = ConsoleTestRunner.prepareConsoleMessageText(element);
355
+ if (trimMessages) {
356
+ messageText = messageText.replace(/[ ]+/g, ' ');
357
+ }
346
358
  result.push(messageText + ' ' + element.getAttribute('class') + ' > ' + contentElement.getAttribute('class'));
347
359
  }
348
360
  if (sortMessages) {
@@ -393,6 +393,14 @@ export function textContentWithLineBreaks(node) {
393
393
  return buffer;
394
394
  }
395
395
 
396
+ /**
397
+ * @param {!Node} node
398
+ * @return {string}
399
+ */
400
+ export function textContentWithLineBreaksTrimmed(node) {
401
+ return textContentWithLineBreaks(node).replace(/[ ]+/g, ' ');
402
+ }
403
+
396
404
  /**
397
405
  * @param {!Node} node
398
406
  * @return {string}
@@ -1459,6 +1467,7 @@ TestRunner.showPanel = showPanel;
1459
1467
  TestRunner.createKeyEvent = createKeyEvent;
1460
1468
  TestRunner.safeWrap = safeWrap;
1461
1469
  TestRunner.textContentWithLineBreaks = textContentWithLineBreaks;
1470
+ TestRunner.textContentWithLineBreaksTrimmed = textContentWithLineBreaksTrimmed;
1462
1471
  TestRunner.textContentWithoutStyles = textContentWithoutStyles;
1463
1472
  TestRunner.evaluateInPagePromise = evaluateInPagePromise;
1464
1473
  TestRunner.callFunctionInPageAsync = callFunctionInPageAsync;
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "dependencies": [
3
3
  "ui/legacy",
4
- "ui/legacy/components/perf_ui",
5
4
  "panels/network"
6
5
  ]
7
6
  }
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "dependencies": [
3
- "ui/legacy",
4
- "ui/legacy/components/perf_ui"
3
+ "ui/legacy"
5
4
  ]
6
5
  }
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "dependencies": [
3
- "ui/legacy",
4
- "ui/legacy/components/perf_ui"
3
+ "ui/legacy"
5
4
  ]
6
5
  }
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "dependencies": [
3
- "ui/legacy/components/perf_ui",
4
3
  "ui/legacy"
5
4
  ]
6
5
  }
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "dependencies": [
3
- "ui/legacy",
4
- "ui/legacy/components/perf_ui"
3
+ "ui/legacy"
5
4
  ]
6
5
  }
@@ -2,7 +2,6 @@
2
2
  "dependencies": [
3
3
  "ui/legacy",
4
4
  "panels/layer_viewer",
5
- "ui/legacy/components/perf_ui",
6
5
  "panels/profiler"
7
6
  ]
8
7
  }
@@ -0,0 +1,25 @@
1
+ <!--
2
+ Copyright 2021 The Chromium Authors. All rights reserved.
3
+ Use of this source code is governed by a BSD-style license that can be
4
+ found in the LICENSE file.
5
+ -->
6
+ <!DOCTYPE html>
7
+ <html>
8
+ <head>
9
+ <meta charset="UTF-8" />
10
+ <meta name="viewport" content="width=device-width" />
11
+ <title>Feedback button</title>
12
+ <style>
13
+ #container {
14
+ width: 80%;
15
+ border: 1px solid black;
16
+ padding: 10px;
17
+ }
18
+ </style>
19
+ </head>
20
+ <body>
21
+ <div id="container">
22
+ </div>
23
+ <script type="module" src="./button.js"></script>
24
+ </body>
25
+ </html>
@@ -0,0 +1,18 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as FrontendHelpers from '../../../../../test/unittests/front_end/helpers/EnvironmentHelpers.js';
6
+ import * as PanelFeedback from '../../../components/panel_feedback/panel_feedback.js';
7
+ import * as ComponentHelpers from '../../helpers/helpers.js';
8
+
9
+ await ComponentHelpers.ComponentServerSetup.setup();
10
+ await FrontendHelpers.initializeGlobalVars();
11
+
12
+ const component = new PanelFeedback.FeedbackButton.FeedbackButton();
13
+
14
+ component.data = {
15
+ feedbackUrl: 'https://www.example.com',
16
+ };
17
+
18
+ document.getElementById('container')?.appendChild(component);
@@ -0,0 +1,67 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as Host from '../../../core/host/host.js';
6
+ import * as i18n from '../../../core/i18n/i18n.js';
7
+ import * as ComponentHelpers from '../../components/helpers/helpers.js';
8
+ import * as LitHtml from '../../lit-html/lit-html.js';
9
+ import * as Buttons from '../buttons/buttons.js';
10
+
11
+ const UIStrings = {
12
+ /**
13
+ * @description The title of the button that leads to the feedback form.
14
+ */
15
+ feedback: 'Feedback',
16
+ };
17
+
18
+ const str_ = i18n.i18n.registerUIStrings('ui/components/panel_feedback/FeedbackButton.ts', UIStrings);
19
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
20
+
21
+ const feedbackIconUrl = new URL('../../../Images/feedback_button_icon.svg', import.meta.url).toString();
22
+
23
+ export interface FeedbackButtonData {
24
+ feedbackUrl: string;
25
+ }
26
+ export class FeedbackButton extends HTMLElement {
27
+ static readonly litTagName = LitHtml.literal`devtools-feedback-button`;
28
+ readonly #shadow = this.attachShadow({mode: 'open'});
29
+ readonly #boundRender = this.render.bind(this);
30
+
31
+ #props: FeedbackButtonData = {
32
+ feedbackUrl: '',
33
+ };
34
+
35
+ set data(data: FeedbackButtonData) {
36
+ this.#props = data;
37
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
38
+ }
39
+
40
+ #onFeedbackClick(): void {
41
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(this.#props.feedbackUrl);
42
+ }
43
+
44
+ private render(): void {
45
+ if (!ComponentHelpers.ScheduledRender.isScheduledRender(this)) {
46
+ throw new Error('FeedbackButton render was not scheduled');
47
+ }
48
+
49
+ // clang-format off
50
+ LitHtml.render(LitHtml.html`
51
+ <${Buttons.Button.Button.litTagName}
52
+ @click=${this.#onFeedbackClick}
53
+ .iconUrl=${feedbackIconUrl}
54
+ .variant=${Buttons.Button.Variant.SECONDARY}
55
+ >${i18nString(UIStrings.feedback)}</${Buttons.Button.Button.litTagName}>
56
+ `, this.#shadow, {host: this});
57
+ // clang-format on
58
+ }
59
+ }
60
+
61
+ ComponentHelpers.CustomElements.defineComponent('devtools-feedback-button', FeedbackButton);
62
+
63
+ declare global {
64
+ interface HTMLElementTagNameMap {
65
+ 'devtools-feedback-button': FeedbackButton;
66
+ }
67
+ }
@@ -2,4 +2,5 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ export * as FeedbackButton from './FeedbackButton.js';
5
6
  export * as PanelFeedback from './PanelFeedback.js';
@@ -458,7 +458,7 @@ export class Widget {
458
458
  this.doResize();
459
459
  }
460
460
 
461
- registerRequiredCSS(cssFile: string): void {
461
+ registerRequiredCSS(cssFile: string|{cssContent: string}): void {
462
462
  if (this.isWebComponent) {
463
463
  Utils.appendStyle((this.shadowRoot as DocumentFragment), cssFile);
464
464
  } else {
@@ -7,6 +7,7 @@ import * as i18n from '../../../../core/i18n/i18n.js';
7
7
  import * as Platform from '../../../../core/platform/platform.js';
8
8
  import * as UI from '../../legacy.js';
9
9
 
10
+ import chartViewPortStyles from './chartViewport.css.legacy.js';
10
11
  import {MinimalTimeWindowMs} from './FlameChart.js';
11
12
 
12
13
  export interface ChartViewportDelegate {
@@ -51,7 +52,7 @@ export class ChartViewport extends UI.Widget.VBox {
51
52
 
52
53
  constructor(delegate: ChartViewportDelegate) {
53
54
  super();
54
- this.registerRequiredCSS('ui/legacy/components/perf_ui/chartViewport.css');
55
+ this.registerRequiredCSS(chartViewPortStyles);
55
56
 
56
57
  this.delegate = delegate;
57
58
 
@@ -9,6 +9,8 @@ import * as Platform from '../../../../core/platform/platform.js';
9
9
  import type * as SDK from '../../../../core/sdk/sdk.js';
10
10
  import * as UI from '../../legacy.js';
11
11
 
12
+ import filmStripViewStyles from './filmStripView.css.legacy.js';
13
+
12
14
  const UIStrings = {
13
15
  /**
14
16
  *@description Element title in Film Strip View of the Performance panel
@@ -43,7 +45,7 @@ export class FilmStripView extends Common.ObjectWrapper.eventMixin<EventTypes, t
43
45
 
44
46
  constructor() {
45
47
  super(true);
46
- this.registerRequiredCSS('ui/legacy/components/perf_ui/filmStripView.css');
48
+ this.registerRequiredCSS(filmStripViewStyles);
47
49
  this.contentElement.classList.add('film-strip-view');
48
50
  this.statusLabel = this.contentElement.createChild('div', 'label');
49
51
  this.reset();
@@ -42,6 +42,7 @@ import type {ChartViewportDelegate} from './ChartViewport.js';
42
42
  import {ChartViewport} from './ChartViewport.js';
43
43
  import type {Calculator} from './TimelineGrid.js';
44
44
  import {TimelineGrid} from './TimelineGrid.js';
45
+ import flameChartStyles from './flameChart.css.legacy.js';
45
46
 
46
47
  const UIStrings = {
47
48
  /**
@@ -157,7 +158,7 @@ export class FlameChart extends Common.ObjectWrapper.eventMixin<EventTypes, type
157
158
  dataProvider: FlameChartDataProvider, flameChartDelegate: FlameChartDelegate,
158
159
  groupExpansionSetting?: Common.Settings.Setting<GroupExpansionState>) {
159
160
  super(true);
160
- this.registerRequiredCSS('ui/legacy/components/perf_ui/flameChart.css');
161
+ this.registerRequiredCSS(flameChartStyles);
161
162
  this.contentElement.classList.add('flame-chart-main-pane');
162
163
  this.groupExpansionSetting = groupExpansionSetting;
163
164
  this.groupExpansionState = groupExpansionSetting && groupExpansionSetting.get() || {};
@@ -35,6 +35,7 @@ import * as UI from '../../legacy.js';
35
35
 
36
36
  import type {Calculator} from './TimelineGrid.js';
37
37
  import {TimelineGrid} from './TimelineGrid.js';
38
+ import overviewGridStyles from './overviewGrid.css.legacy.js';
38
39
 
39
40
  const UIStrings = {
40
41
  /**
@@ -161,7 +162,7 @@ export class Window extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
161
162
 
162
163
  this.parentElement.addEventListener('wheel', this.onMouseWheel.bind(this), true);
163
164
  this.parentElement.addEventListener('dblclick', this.resizeWindowMaximum.bind(this), true);
164
- UI.Utils.appendStyle(this.parentElement, 'ui/legacy/components/perf_ui/overviewGrid.css');
165
+ UI.Utils.appendStyle(this.parentElement, overviewGridStyles);
165
166
 
166
167
  this.leftResizeElement = parentElement.createChild('div', 'overview-grid-window-resizer') as HTMLElement;
167
168
  UI.UIUtils.installDragHandle(
@@ -36,6 +36,8 @@ import * as Host from '../../../../core/host/host.js';
36
36
  import * as UI from '../../legacy.js';
37
37
  import * as ThemeSupport from '../../theme_support/theme_support.js';
38
38
 
39
+ import timelineGridStyles from './timelineGrid.css.legacy.js';
40
+
39
41
  const labelMap = new Map<HTMLDivElement|HTMLElement, HTMLDivElement>();
40
42
 
41
43
  export class TimelineGrid {
@@ -47,7 +49,7 @@ export class TimelineGrid {
47
49
 
48
50
  constructor() {
49
51
  this.element = document.createElement('div');
50
- UI.Utils.appendStyle(this.element, 'ui/legacy/components/perf_ui/timelineGrid.css');
52
+ UI.Utils.appendStyle(this.element, timelineGridStyles);
51
53
 
52
54
  this.dividersElementInternal = this.element.createChild('div', 'resources-dividers');
53
55
 
@@ -36,6 +36,7 @@ import * as i18n from '../../../../core/i18n/i18n.js';
36
36
  import type {WindowChangedWithPositionEvent} from './OverviewGrid.js';
37
37
  import {Events as OverviewGridEvents, OverviewGrid} from './OverviewGrid.js';
38
38
  import type {Calculator} from './TimelineGrid.js';
39
+ import timelineOverviewInfoStyles from './timelineOverviewInfo.css.js';
39
40
 
40
41
  export class TimelineOverviewPane extends Common.ObjectWrapper.eventMixin<EventTypes, typeof UI.Widget.VBox>(
41
42
  UI.Widget.VBox) {
@@ -426,7 +427,7 @@ export class OverviewInfo {
426
427
  this.visible = false;
427
428
  this.element = UI.Utils
428
429
  .createShadowRootWithCoreStyles(this.glassPane.contentElement, {
429
- cssFile: 'ui/legacy/components/perf_ui/timelineOverviewInfo.css',
430
+ cssFile: [timelineOverviewInfoStyles],
430
431
  delegatesFocus: undefined,
431
432
  })
432
433
  .createChild('div', 'overview-info');
@@ -4,10 +4,15 @@
4
4
 
5
5
  import * as Root from '../../../core/root/root.js';
6
6
 
7
- export function appendStyle(node: Node, cssFile: string): void {
8
- const content = Root.Runtime.cachedResources.get(cssFile) || '';
9
- if (!content) {
10
- console.error(cssFile + ' not preloaded. Check module.json');
7
+ export function appendStyle(node: Node, cssReference: string|{cssContent: string}): void {
8
+ let content: string;
9
+ if (typeof cssReference === 'string') {
10
+ content = Root.Runtime.cachedResources.get(cssReference) || '';
11
+ if (!content) {
12
+ console.error(cssReference + ' not preloaded. Check module.json');
13
+ }
14
+ } else {
15
+ content = cssReference.cssContent;
11
16
  }
12
17
  const styleElement = document.createElement('style');
13
18
  styleElement.textContent = content;
package/package.json CHANGED
@@ -55,5 +55,5 @@
55
55
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
56
56
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
57
57
  },
58
- "version": "1.0.941095"
58
+ "version": "1.0.941208"
59
59
  }
@@ -4,34 +4,48 @@
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
6
  const CleanCSS = require('clean-css');
7
- const [, , isDebugString, targetName, srcDir, targetGenDir, files] = process.argv;
7
+ const [, , isDebugString, legacyString, targetName, srcDir, targetGenDir, files] = process.argv;
8
8
 
9
9
  const filenames = files.split(',');
10
10
  const configFiles = [];
11
11
  const cleanCSS = new CleanCSS();
12
12
  const isDebug = isDebugString === 'true';
13
+ const isLegacy = legacyString === 'true';
13
14
 
14
15
  for (const fileName of filenames) {
15
16
  let output = fs.readFileSync(path.join(srcDir, fileName), {encoding: 'utf8', flag: 'r'});
16
17
  output = output.replace(/\`/g, '\\\'');
17
18
  output = output.replace(/\\/g, '\\\\');
18
19
 
20
+ const stylesheetContents = isDebug ? output : cleanCSS.minify(output).styles;
21
+
22
+ let exportStatement;
23
+ if (isLegacy) {
24
+ exportStatement = `export default {
25
+ cssContent: \`${stylesheetContents}\`
26
+ };`;
27
+ } else {
28
+ exportStatement = `const styles = new CSSStyleSheet();
29
+ styles.replaceSync(
30
+ \`${stylesheetContents}
31
+ /*# sourceURL=${fileName} */
32
+ \`);
33
+ export default styles;`;
34
+ }
35
+
36
+ const generatedFileName = `${fileName}${isLegacy ? '.legacy' : ''}.js`;
37
+
19
38
  fs.writeFileSync(
20
- path.join(targetGenDir, fileName + '.js'),
39
+ path.join(targetGenDir, generatedFileName),
21
40
  `// Copyright ${new Date().getFullYear()} The Chromium Authors. All rights reserved.
22
41
  // Use of this source code is governed by a BSD-style license that can be
23
42
  // found in the LICENSE file.
24
43
  // IMPORTANT: this file is auto generated. Please do not edit this file.
25
44
  /* istanbul ignore file */
26
- const styles = new CSSStyleSheet();
27
- styles.replaceSync(
28
- \`${isDebug ? output : cleanCSS.minify(output).styles}
29
- /*# sourceURL=${fileName} */
30
- \`);
31
- export default styles;
45
+ ${exportStatement}
32
46
  `);
33
47
 
34
- configFiles.push(`\"${fileName}.js\"`);
48
+ configFiles.push(`\"${generatedFileName}\"`);
35
49
  }
36
50
 
37
51
  fs.writeFileSync(path.join(targetGenDir, `${targetName}-tsconfig.json`), `{
@@ -18,6 +18,7 @@ template("generate_css") {
18
18
 
19
19
  args = [
20
20
  "$is_debug",
21
+ "${invoker.legacy}",
21
22
  target_name,
22
23
  _src,
23
24
  _dest,
@@ -26,7 +27,11 @@ template("generate_css") {
26
27
 
27
28
  outputs = []
28
29
  foreach(_input, sources) {
29
- outputs += [ "$target_gen_dir/$_input.js" ]
30
+ _file_name = _input
31
+ if (invoker.legacy) {
32
+ _file_name = "$_file_name.legacy"
33
+ }
34
+ outputs += [ "$target_gen_dir/$_file_name.js" ]
30
35
  }
31
36
 
32
37
  data = outputs
@@ -38,3 +43,7 @@ template("generate_css") {
38
43
  }
39
44
  }
40
45
  }
46
+
47
+ set_defaults("generate_css") {
48
+ legacy = false
49
+ }
@@ -31,10 +31,10 @@ module.exports = {
31
31
  ImportDeclaration(node) {
32
32
  const importPath = path.normalize(node.source.value);
33
33
 
34
- if (importPath.endsWith('.css.js')) {
34
+ if (importPath.endsWith('.css.js') || importPath.endsWith('.css.legacy.js')) {
35
35
  const importingFileName = path.resolve(context.getFilename());
36
36
  const exportingFileName = path.resolve(path.dirname(importingFileName), importPath);
37
- const importedCSS = exportingFileName.replace(/\.js$/, '');
37
+ const importedCSS = exportingFileName.replace(/(\.legacy)?\.js$/, '');
38
38
 
39
39
  if (!fs.existsSync(importedCSS)) {
40
40
  context.report({
@@ -14,6 +14,10 @@ ruleTester.run('check_css_import', rule, {
14
14
  code: 'import styles from \'./check_css_import_test_file.css.js\';',
15
15
  filename: 'scripts/eslint_rules/tests/file.ts',
16
16
  },
17
+ {
18
+ code: 'import styles from \'./check_css_import_test_file.css.legacy.js\';',
19
+ filename: 'scripts/eslint_rules/tests/file.ts',
20
+ },
17
21
  {
18
22
  code: 'import styles from \'../../../scripts/eslint_rules/tests/check_css_import_test_file.css.js\';',
19
23
  filename: 'front_end/ui/components/file.ts',
@@ -29,6 +33,14 @@ ruleTester.run('check_css_import', rule, {
29
33
  message: 'File styles.css does not exist. Check you are importing the correct file.',
30
34
  }],
31
35
  },
36
+ {
37
+ // Files that do not exist are caught
38
+ code: 'import styles from \'styles.css.legacy.js\';',
39
+ filename: 'front_end/ui/components/component/file.ts',
40
+ errors: [{
41
+ message: 'File styles.css does not exist. Check you are importing the correct file.',
42
+ }],
43
+ },
32
44
  {
33
45
  // Filename typos are caught
34
46
  code: 'import styles from \'../../../scripts/eslint_rules/test/check_css_import_tests_file.css.js\';',
@@ -1,13 +0,0 @@
1
- {
2
- "dependencies": [
3
- "ui/legacy"
4
- ],
5
- "resources": [
6
- "chartViewport.css",
7
- "filmStripView.css",
8
- "flameChart.css",
9
- "overviewGrid.css",
10
- "timelineGrid.css",
11
- "timelineOverviewInfo.css"
12
- ]
13
- }