chrome-devtools-frontend 1.0.940255 → 1.0.942095

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 (133) hide show
  1. package/config/gni/all_devtools_files.gni +0 -13
  2. package/config/gni/devtools_grd_files.gni +13 -13
  3. package/config/gni/devtools_image_files.gni +1 -2
  4. package/front_end/.eslintrc.js +1 -0
  5. package/front_end/Images/src/feedback_button_icon.svg +3 -0
  6. package/front_end/Tests.js +15 -0
  7. package/front_end/core/common/Color.ts +5 -0
  8. package/front_end/core/i18n/locales/en-US.json +39 -30
  9. package/front_end/core/i18n/locales/en-XL.json +39 -30
  10. package/front_end/core/sdk/DOMDebuggerModel.ts +18 -1
  11. package/front_end/core/sdk/sdk-meta.ts +17 -3
  12. package/front_end/entrypoints/devtools_app/devtools_app.json +1 -7
  13. package/front_end/entrypoints/main/MainImpl.ts +26 -0
  14. package/front_end/entrypoints/shell/shell.js +0 -11
  15. package/front_end/entrypoints/shell/shell.json +0 -1
  16. package/front_end/entrypoints/worker_app/worker_app.json +0 -4
  17. package/front_end/generated/InspectorBackendCommands.js +1 -0
  18. package/front_end/generated/protocol.d.ts +2 -0
  19. package/front_end/global_typings/global_defs.d.ts +5 -0
  20. package/front_end/legacy_test_runner/console_test_runner/console_test_runner.js +14 -2
  21. package/front_end/legacy_test_runner/legacy_test_runner.ts +10 -1
  22. package/front_end/legacy_test_runner/test_runner/TestRunner.js +9 -0
  23. package/front_end/models/formatter/SourceFormatter.ts +0 -10
  24. package/front_end/models/workspace/UISourceCode.ts +9 -42
  25. package/front_end/panels/animation/AnimationTimeline.ts +3 -3
  26. package/front_end/panels/application/ApplicationPanelSidebar.ts +3 -3
  27. package/front_end/panels/application/application-meta.ts +0 -3
  28. package/front_end/panels/console/ConsolePinPane.ts +21 -26
  29. package/front_end/panels/coverage/CoverageDecorationManager.ts +4 -5
  30. package/front_end/panels/coverage/CoverageView.ts +2 -105
  31. package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +11 -56
  32. package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -8
  33. package/front_end/panels/elements/ElementsTreeElement.ts +4 -9
  34. package/front_end/panels/elements/components/adornerSettingsPane.css +0 -4
  35. package/front_end/panels/emulation/emulation-meta.ts +2 -2
  36. package/front_end/panels/issues/IssueKindView.ts +22 -4
  37. package/front_end/panels/issues/issues-meta.ts +0 -2
  38. package/front_end/panels/layers/module.json +0 -1
  39. package/front_end/panels/lighthouse/lighthouseStartView.css +4 -0
  40. package/front_end/panels/media/media-meta.ts +0 -3
  41. package/front_end/panels/network/NetworkLogView.ts +3 -0
  42. package/front_end/panels/network/ResourceWebSocketFrameView.ts +2 -1
  43. package/front_end/panels/network/network-meta.ts +0 -3
  44. package/front_end/panels/profiler/module.json +1 -2
  45. package/front_end/panels/security/security-meta.ts +0 -3
  46. package/front_end/panels/sources/BreakpointEditDialog.ts +16 -30
  47. package/front_end/panels/sources/CSSPlugin.ts +310 -331
  48. package/front_end/panels/sources/CallStackSidebarPane.ts +28 -34
  49. package/front_end/panels/sources/CoveragePlugin.ts +121 -6
  50. package/front_end/panels/sources/DebuggerPlugin.ts +1166 -1243
  51. package/front_end/panels/sources/EditingLocationHistoryManager.ts +71 -101
  52. package/front_end/panels/sources/GoToLineQuickOpen.ts +4 -3
  53. package/front_end/panels/sources/InplaceFormatterEditorAction.ts +3 -3
  54. package/front_end/panels/sources/JavaScriptCompilerPlugin.ts +26 -23
  55. package/front_end/panels/sources/Plugin.ts +20 -4
  56. package/front_end/panels/sources/ProfilePlugin.ts +185 -0
  57. package/front_end/panels/sources/ScriptFormatterEditorAction.ts +3 -3
  58. package/front_end/panels/sources/ScriptOriginPlugin.ts +0 -10
  59. package/front_end/panels/sources/SnippetsPlugin.ts +1 -10
  60. package/front_end/panels/sources/SourcesPanel.ts +15 -10
  61. package/front_end/panels/sources/SourcesView.ts +10 -8
  62. package/front_end/panels/sources/TabbedEditorContainer.ts +31 -27
  63. package/front_end/panels/sources/UISourceCodeFrame.ts +335 -470
  64. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -2
  65. package/front_end/panels/sources/sources-legacy.ts +0 -6
  66. package/front_end/panels/sources/sources.ts +0 -2
  67. package/front_end/panels/timeline/module.json +0 -2
  68. package/front_end/third_party/codemirror.next/bundle.ts +9 -13
  69. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  70. package/front_end/third_party/codemirror.next/chunk/javascript.js +2 -2
  71. package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -6
  72. package/front_end/third_party/codemirror.next/chunk/php.js +2 -6
  73. package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
  74. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
  75. package/front_end/third_party/codemirror.next/chunk/xml.js +2 -2
  76. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +279 -198
  77. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  78. package/front_end/third_party/codemirror.next/package.json +13 -11
  79. package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +60 -68
  80. package/front_end/ui/components/data_grid/dataGrid.css +12 -10
  81. package/front_end/ui/components/docs/css_overview/start_view.html +25 -0
  82. package/front_end/ui/components/docs/css_overview/start_view.ts +14 -0
  83. package/front_end/ui/components/docs/panel_feedback/basic.html +25 -0
  84. package/front_end/ui/components/docs/panel_feedback/basic.ts +20 -0
  85. package/front_end/ui/components/docs/panel_feedback/button.html +25 -0
  86. package/front_end/ui/components/docs/panel_feedback/button.ts +18 -0
  87. package/front_end/ui/components/helpers/get-stylesheet.ts +1 -0
  88. package/front_end/ui/components/panel_feedback/FeedbackButton.ts +67 -0
  89. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +100 -0
  90. package/front_end/ui/components/panel_feedback/panelFeedback.css +76 -0
  91. package/front_end/ui/components/panel_feedback/panel_feedback.ts +6 -0
  92. package/front_end/ui/components/report_view/reportValue.css +1 -0
  93. package/front_end/ui/components/text_editor/TextEditor.ts +79 -36
  94. package/front_end/ui/components/text_editor/config.ts +42 -26
  95. package/front_end/ui/components/text_editor/javascript.ts +2 -3
  96. package/front_end/ui/components/text_editor/position.ts +17 -0
  97. package/front_end/ui/components/text_editor/text_editor.ts +1 -0
  98. package/front_end/ui/components/text_editor/theme.ts +5 -1
  99. package/front_end/ui/legacy/Infobar.ts +2 -6
  100. package/front_end/ui/legacy/ShortcutRegistry.ts +11 -7
  101. package/front_end/ui/legacy/Widget.ts +1 -1
  102. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +2 -1
  103. package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +3 -1
  104. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +2 -1
  105. package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +35 -131
  106. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +2 -1
  107. package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +3 -1
  108. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +2 -1
  109. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +3 -6
  110. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +18 -14
  111. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +502 -252
  112. package/front_end/ui/legacy/components/source_frame/source_frame-legacy.ts +0 -11
  113. package/front_end/ui/legacy/components/source_frame/source_frame.ts +0 -2
  114. package/front_end/ui/legacy/components/text_editor/cmdevtools.css +3 -1
  115. package/front_end/ui/legacy/radioButton.css +1 -13
  116. package/front_end/ui/legacy/softContextMenu.css +1 -0
  117. package/front_end/ui/legacy/themeColors.css +36 -0
  118. package/front_end/ui/legacy/utils/append-style.ts +9 -4
  119. package/package.json +1 -1
  120. package/scripts/build/generate_css_js_files.js +23 -9
  121. package/scripts/build/ninja/generate_css.gni +10 -1
  122. package/scripts/eslint_rules/lib/check_css_import.js +2 -2
  123. package/scripts/eslint_rules/tests/check_css_import_test.js +12 -0
  124. package/front_end/Images/radioDot-dark-theme.png +0 -0
  125. package/front_end/Images/radioDot.png +0 -0
  126. package/front_end/panels/application/module.json +0 -7
  127. package/front_end/panels/issues/module.json +0 -6
  128. package/front_end/panels/layer_viewer/module.json +0 -6
  129. package/front_end/panels/media/module.json +0 -6
  130. package/front_end/panels/network/module.json +0 -6
  131. package/front_end/panels/security/module.json +0 -5
  132. package/front_end/ui/legacy/components/perf_ui/module.json +0 -13
  133. package/front_end/ui/legacy/components/source_frame/SourcesTextEditor.ts +0 -1030
@@ -3,21 +3,21 @@
3
3
  "version": "0.0.1",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@codemirror/autocomplete": "0.19.3",
6
+ "@codemirror/autocomplete": "0.19.5",
7
7
  "@codemirror/closebrackets": "0.19.0",
8
- "@codemirror/commands": "0.19.4",
8
+ "@codemirror/commands": "0.19.5",
9
9
  "@codemirror/comment": "0.19.0",
10
- "@codemirror/fold": "0.19.0",
11
- "@codemirror/gutter": "0.19.2",
10
+ "@codemirror/fold": "0.19.1",
11
+ "@codemirror/gutter": "0.19.3",
12
12
  "@codemirror/highlight": "0.19.6",
13
13
  "@codemirror/history": "0.19.0",
14
14
  "@codemirror/lang-cpp": "0.19.1",
15
15
  "@codemirror/lang-css": "0.19.3",
16
16
  "@codemirror/lang-html": "0.19.3",
17
17
  "@codemirror/lang-java": "0.19.1",
18
- "@codemirror/lang-javascript": "0.19.2",
18
+ "@codemirror/lang-javascript": "0.19.3",
19
19
  "@codemirror/lang-json": "0.19.1",
20
- "@codemirror/lang-markdown": "0.19.1",
20
+ "@codemirror/lang-markdown": "0.19.2",
21
21
  "@codemirror/lang-php": "0.19.1",
22
22
  "@codemirror/lang-python": "0.19.2",
23
23
  "@codemirror/lang-wast": "0.19.0",
@@ -25,13 +25,15 @@
25
25
  "@codemirror/language": "0.19.3",
26
26
  "@codemirror/legacy-modes": "0.19.0",
27
27
  "@codemirror/matchbrackets": "0.19.3",
28
+ "@codemirror/panel": "0.19.0",
29
+ "@codemirror/rangeset": "0.19.2",
28
30
  "@codemirror/search": "0.19.2",
29
- "@codemirror/state": "0.19.2",
31
+ "@codemirror/state": "0.19.5",
30
32
  "@codemirror/stream-parser": "0.19.2",
31
- "@codemirror/text": "0.19.4",
32
- "@codemirror/tooltip": "0.19.4",
33
- "@codemirror/view": "0.19.9",
34
- "@lezer/common": "0.15.7",
33
+ "@codemirror/text": "0.19.5",
34
+ "@codemirror/tooltip": "0.19.6",
35
+ "@codemirror/view": "0.19.16",
36
+ "@lezer/common": "0.15.8",
35
37
  "@rollup/plugin-node-resolve": "^13.0.4",
36
38
  "rollup-plugin-dts": "^4.0.0",
37
39
  "rollup-plugin-terser": "^7.0.2",
@@ -2,56 +2,50 @@
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
- import type * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
6
-
7
- let highlightStyle: CodeMirror.HighlightStyle|null = null;
8
-
9
- function importCM(): Promise<typeof CodeMirror> {
10
- return import('../../../third_party/codemirror.next/codemirror.next.js');
11
- }
12
-
13
- export function getHighlightStyle(modCM: typeof CodeMirror): CodeMirror.HighlightStyle {
14
- if (!highlightStyle) {
15
- const t = modCM.tags;
16
- highlightStyle = modCM.HighlightStyle.define([
17
- {tag: t.variableName, class: 'token-variable'},
18
- {tag: t.propertyName, class: 'token-property'},
19
- {tag: [t.typeName, t.className, t.namespace, t.macroName], class: 'token-type'},
20
- {tag: [t.special(t.name), t.constant(t.className)], class: 'token-variable-special'},
21
- {tag: t.definition(t.name), class: 'token-definition'},
22
- {tag: t.standard(t.variableName), class: 'token-builtin'},
23
-
24
- {tag: [t.number, t.literal, t.unit], class: 'token-number'},
25
- {tag: t.string, class: 'token-string'},
26
- {tag: [t.special(t.string), t.regexp, t.escape], class: 'token-string-special'},
27
- {tag: [t.atom, t.labelName, t.bool], class: 'token-atom'},
28
-
29
- {tag: t.keyword, class: 'token-keyword'},
30
- {tag: [t.comment, t.quote], class: 'token-comment'},
31
- {tag: t.meta, class: 'token-meta'},
32
- {tag: t.invalid, class: 'token-invalid'},
33
-
34
- {tag: t.tagName, class: 'token-tag'},
35
- {tag: t.attributeName, class: 'token-attribute'},
36
- {tag: t.attributeValue, class: 'token-attribute-value'},
37
-
38
- {tag: t.inserted, class: 'token-inserted'},
39
- {tag: t.deleted, class: 'token-deleted'},
40
- {tag: t.heading, class: 'token-heading'},
41
- {tag: t.link, class: 'token-link'},
42
- {tag: t.strikethrough, class: 'token-strikethrough'},
43
- {tag: t.strong, class: 'token-strong'},
44
- {tag: t.emphasis, class: 'token-emphasis'},
45
- ]);
46
- }
47
- return highlightStyle;
48
- }
5
+ import * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
6
+
7
+ const t = CodeMirror.tags;
8
+
9
+ export const highlightStyle: CodeMirror.HighlightStyle = CodeMirror.HighlightStyle.define([
10
+ {tag: t.variableName, class: 'token-variable'},
11
+ {tag: t.propertyName, class: 'token-property'},
12
+ {tag: [t.typeName, t.className, t.namespace, t.macroName], class: 'token-type'},
13
+ {tag: [t.special(t.name), t.constant(t.className)], class: 'token-variable-special'},
14
+ {tag: t.definition(t.name), class: 'token-definition'},
15
+ {tag: t.standard(t.variableName), class: 'token-builtin'},
16
+
17
+ {tag: [t.number, t.literal, t.unit], class: 'token-number'},
18
+ {tag: t.string, class: 'token-string'},
19
+ {tag: [t.special(t.string), t.regexp, t.escape], class: 'token-string-special'},
20
+ {tag: [t.atom, t.labelName, t.bool], class: 'token-atom'},
21
+
22
+ {tag: t.keyword, class: 'token-keyword'},
23
+ {tag: [t.comment, t.quote], class: 'token-comment'},
24
+ {tag: t.meta, class: 'token-meta'},
25
+ {tag: t.invalid, class: 'token-invalid'},
26
+
27
+ {tag: t.tagName, class: 'token-tag'},
28
+ {tag: t.attributeName, class: 'token-attribute'},
29
+ {tag: t.attributeValue, class: 'token-attribute-value'},
30
+
31
+ {tag: t.inserted, class: 'token-inserted'},
32
+ {tag: t.deleted, class: 'token-deleted'},
33
+ {tag: t.heading, class: 'token-heading'},
34
+ {tag: t.link, class: 'token-link'},
35
+ {tag: t.strikethrough, class: 'token-strikethrough'},
36
+ {tag: t.strong, class: 'token-strong'},
37
+ {tag: t.emphasis, class: 'token-emphasis'},
38
+ ]);
49
39
 
50
40
  export async function create(code: string, mimeType: string): Promise<CodeHighlighter> {
51
- const CM = await importCM();
52
41
  const language = await languageFromMIME(mimeType);
53
- const tree = language ? language.language.parser.parse(code) : new CM.Tree(CM.NodeType.none, [], [], code.length);
54
- return new CodeHighlighter(code, tree, CM);
42
+ let tree: CodeMirror.Tree;
43
+ if (language) {
44
+ tree = language.language.parser.parse(code);
45
+ } else {
46
+ tree = new CodeMirror.Tree(CodeMirror.NodeType.none, [], [], code.length);
47
+ }
48
+ return new CodeHighlighter(code, tree);
55
49
  }
56
50
 
57
51
  export async function highlightNode(node: Element, mimeType: string): Promise<void> {
@@ -71,57 +65,55 @@ export async function highlightNode(node: Element, mimeType: string): Promise<vo
71
65
  }
72
66
 
73
67
  export async function languageFromMIME(mimeType: string): Promise<CodeMirror.LanguageSupport|null> {
74
- const CM = await importCM();
75
-
76
68
  switch (mimeType) {
77
69
  case 'text/javascript':
78
- return (await CM.javascript()).javascript();
70
+ return CodeMirror.javascript.javascript();
79
71
  case 'text/jsx':
80
- return (await CM.javascript()).javascript({jsx: true});
72
+ return CodeMirror.javascript.javascript({jsx: true});
81
73
  case 'text/typescript':
82
- return (await CM.javascript()).javascript({typescript: true});
74
+ return CodeMirror.javascript.javascript({typescript: true});
83
75
  case 'text/typescript-jsx':
84
- return (await CM.javascript()).javascript({typescript: true, jsx: true});
76
+ return CodeMirror.javascript.javascript({typescript: true, jsx: true});
85
77
 
86
78
  case 'text/css':
87
79
  case 'text/x-scss':
88
- return (await CM.css()).css();
80
+ return CodeMirror.css.css();
89
81
 
90
82
  case 'text/html':
91
- return (await CM.html()).html();
83
+ return CodeMirror.html.html();
92
84
 
93
85
  case 'application/xml':
94
- return (await CM.xml()).xml();
86
+ return (await CodeMirror.xml()).xml();
95
87
 
96
88
  case 'text/webassembly':
97
- return (await CM.wast()).wast();
89
+ return (await CodeMirror.wast()).wast();
98
90
 
99
91
  case 'text/x-c++src':
100
- return (await CM.cpp()).cpp();
92
+ return (await CodeMirror.cpp()).cpp();
101
93
 
102
94
  case 'text/x-java':
103
- return (await CM.java()).java();
95
+ return (await CodeMirror.java()).java();
104
96
 
105
97
  case 'application/json':
106
- return (await CM.json()).json();
98
+ return (await CodeMirror.json()).json();
107
99
 
108
100
  case 'application/x-httpd-php':
109
- return (await CM.php()).php();
101
+ return (await CodeMirror.php()).php();
110
102
 
111
103
  case 'text/x-python':
112
- return (await CM.python()).python();
104
+ return (await CodeMirror.python()).python();
113
105
 
114
106
  case 'text/markdown':
115
- return (await CM.markdown()).markdown();
107
+ return (await CodeMirror.markdown()).markdown();
116
108
 
117
109
  case 'text/x-sh':
118
- return new CM.LanguageSupport(await CM.shell());
110
+ return new CodeMirror.LanguageSupport(await CodeMirror.shell());
119
111
 
120
112
  case 'text/x-coffeescript':
121
- return new CM.LanguageSupport(await CM.coffeescript());
113
+ return new CodeMirror.LanguageSupport(await CodeMirror.coffeescript());
122
114
 
123
115
  case 'text/x-clojure':
124
- return new CM.LanguageSupport(await CM.clojure());
116
+ return new CodeMirror.LanguageSupport(await CodeMirror.clojure());
125
117
 
126
118
  default:
127
119
  return null;
@@ -129,7 +121,7 @@ export async function languageFromMIME(mimeType: string): Promise<CodeMirror.Lan
129
121
  }
130
122
 
131
123
  export class CodeHighlighter {
132
- constructor(readonly code: string, readonly tree: CodeMirror.Tree, private readonly modCM: typeof CodeMirror) {
124
+ constructor(readonly code: string, readonly tree: CodeMirror.Tree) {
133
125
  }
134
126
 
135
127
  highlight(token: (text: string, style: string) => void): void {
@@ -144,7 +136,7 @@ export class CodeHighlighter {
144
136
  pos = to;
145
137
  }
146
138
  };
147
- this.modCM.highlightTree(this.tree, getHighlightStyle(this.modCM).match, (from, to, style) => {
139
+ CodeMirror.highlightTree(this.tree, highlightStyle.match, (from, to, style) => {
148
140
  flush(from, '');
149
141
  flush(to, style);
150
142
  }, from, to);
@@ -120,21 +120,23 @@ th.firstVisibleColumn {
120
120
  }
121
121
 
122
122
  [aria-sort="descending"]::after {
123
- content: " ";
124
- border-left: 0.3em solid transparent;
125
- border-right: 0.3em solid transparent;
126
- border-top: 0.3em solid var(--color-text-primary);
123
+ content: "";
124
+ width: 0;
125
+ border-left: 0.4em solid transparent;
126
+ border-right: 0.4em solid transparent;
127
+ border-top: 0.4em solid var(--color-text-secondary);
127
128
  position: absolute;
128
129
  right: 0.5em;
129
- top: 0.6em;
130
+ top: 0.85em;
130
131
  }
131
132
 
132
133
  [aria-sort="ascending"]::after {
133
- content: " ";
134
- border-bottom: 0.3em solid var(--color-text-primary);
135
- border-left: 0.3em solid transparent;
136
- border-right: 0.3em solid transparent;
134
+ content: "";
135
+ width: 0;
136
+ border-bottom: 0.4em solid var(--color-text-secondary);
137
+ border-left: 0.4em solid transparent;
138
+ border-right: 0.4em solid transparent;
137
139
  position: absolute;
138
140
  right: 0.5em;
139
- top: 0.6em;
141
+ top: 0.7em;
140
142
  }
@@ -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>CSS Overview Start View</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="./start_view.js"></script>
24
+ </body>
25
+ </html>
@@ -0,0 +1,14 @@
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 CSSOverviewComponents from '../../../../panels/css_overview/components/components.js';
7
+ import * as ComponentHelpers from '../../helpers/helpers.js';
8
+
9
+ await ComponentHelpers.ComponentServerSetup.setup();
10
+ await FrontendHelpers.initializeGlobalVars();
11
+
12
+ const component = new CSSOverviewComponents.CSSOverviewStartView.CSSOverviewStartView();
13
+
14
+ document.getElementById('container')?.appendChild(component);
@@ -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>Panel Feedback</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="./basic.js"></script>
24
+ </body>
25
+ </html>
@@ -0,0 +1,20 @@
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.PanelFeedback.PanelFeedback();
13
+
14
+ component.data = {
15
+ feedbackUrl: 'https://www.example.com',
16
+ quickStartUrl: 'https://www.example.com',
17
+ quickStartLinkText: 'Quick start: get started with the Recorder',
18
+ };
19
+
20
+ document.getElementById('container')?.appendChild(component);
@@ -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);
@@ -56,4 +56,5 @@ export const CSS_RESOURCES_TO_LOAD_INTO_RUNTIME = [
56
56
  'ui/legacy/components/source_frame/jsonView.css',
57
57
  'ui/legacy/searchableView.css',
58
58
  'ui/legacy/toolbar.css',
59
+ 'ui/legacy/inspectorViewTabbedPane.css',
59
60
  ];
@@ -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
+ }
@@ -0,0 +1,100 @@
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 i18n from '../../../core/i18n/i18n.js';
6
+ import * as ComponentHelpers from '../../components/helpers/helpers.js';
7
+ import * as LitHtml from '../../lit-html/lit-html.js';
8
+ import * as IconButton from '../icon_button/icon_button.js';
9
+
10
+ import panelFeedbackStyles from './panelFeedback.css.js';
11
+
12
+ const UIStrings = {
13
+ /**
14
+ *@description Introduction sentence to convey the feature is being actively worked on and we are looking for feedback.
15
+ */
16
+ previewText: 'Our team is actively working on this feature and we would love to know what you think.',
17
+ /**
18
+ *@description Link text the user can click to provide feedback to the team.
19
+ */
20
+ previewTextFeedbackLink: 'Send us your feedback.',
21
+ /**
22
+ *@description Title of the UI section that shows the user that this feature is in preview. Used as the main heading. Not a verb.
23
+ */
24
+ previewFeature: 'Preview feature',
25
+ /**
26
+ *@description Title of the section to the quick start video and documentation on experimental panels.
27
+ */
28
+ videoAndDocumentation: 'Video and documentation',
29
+ };
30
+
31
+ const str_ = i18n.i18n.registerUIStrings('ui/components/panel_feedback/PanelFeedback.ts', UIStrings);
32
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
33
+
34
+ const previewFeatureUrl = new URL('../../../Images/ic_preview_feature.svg', import.meta.url).toString();
35
+ const videoThumbnailUrl = new URL('../../../Images/preview_feature_video_thumbnail.svg', import.meta.url).toString();
36
+
37
+ export interface PanelFeedbackData {
38
+ feedbackUrl: string;
39
+ quickStartUrl: string;
40
+ quickStartLinkText: string;
41
+ }
42
+ export class PanelFeedback extends HTMLElement {
43
+ static readonly litTagName = LitHtml.literal`devtools-panel-feedback`;
44
+ readonly #shadow = this.attachShadow({mode: 'open'});
45
+ readonly #boundRender = this.render.bind(this);
46
+
47
+ #props: PanelFeedbackData = {
48
+ feedbackUrl: '',
49
+ quickStartUrl: '',
50
+ quickStartLinkText: '',
51
+ };
52
+
53
+ connectedCallback(): void {
54
+ this.#shadow.adoptedStyleSheets = [panelFeedbackStyles];
55
+ }
56
+
57
+ set data(data: PanelFeedbackData) {
58
+ this.#props = data;
59
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.#boundRender);
60
+ }
61
+
62
+ private render(): void {
63
+ if (!ComponentHelpers.ScheduledRender.isScheduledRender(this)) {
64
+ throw new Error('PanelFeedback render was not scheduled');
65
+ }
66
+
67
+ // clang-format off
68
+ LitHtml.render(LitHtml.html`
69
+ <div class="preview">
70
+ <h2 class="flex">
71
+ <${IconButton.Icon.Icon.litTagName} .data=${{
72
+ iconPath: previewFeatureUrl,
73
+ width: '24px',
74
+ height: '24px',
75
+ color: 'var(--color-primary)',
76
+ } as IconButton.Icon.IconData}></${IconButton.Icon.Icon.litTagName}> ${i18nString(UIStrings.previewFeature)}
77
+ </h2>
78
+ <p>${i18nString(UIStrings.previewText)} <x-link href=${this.#props.feedbackUrl}>${i18nString(UIStrings.previewTextFeedbackLink)}</x-link></p>
79
+ <div class="video">
80
+ <div class="thumbnail">
81
+ <img src=${videoThumbnailUrl} role="presentation" />
82
+ </div>
83
+ <div class="video-description">
84
+ <h3>${i18nString(UIStrings.videoAndDocumentation)}</h3>
85
+ <x-link class="quick-start-link" href=${this.#props.quickStartUrl}>${this.#props.quickStartLinkText}</x-link>
86
+ </div>
87
+ </div>
88
+ </div>
89
+ `, this.#shadow, {host: this});
90
+ // clang-format on
91
+ }
92
+ }
93
+
94
+ ComponentHelpers.CustomElements.defineComponent('devtools-panel-feedback', PanelFeedback);
95
+
96
+ declare global {
97
+ interface HTMLElementTagNameMap {
98
+ 'devtools-panel-feedback': PanelFeedback;
99
+ }
100
+ }
@@ -0,0 +1,76 @@
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
+
7
+ /**
8
+ * Copyright 2021 Google LLC. All rights reserved.
9
+ */
10
+
11
+ :host {
12
+ display: block;
13
+ }
14
+
15
+ .preview {
16
+ padding: 12px 16px;
17
+ border: 1px solid var(--color-details-hairline);
18
+ color: var(--color-text-primary);
19
+ font-size: 13px;
20
+ line-height: 20px;
21
+ border-radius: 12px;
22
+ margin: 42px 0;
23
+ letter-spacing: 0.01em;
24
+ }
25
+
26
+ h2 {
27
+ color: var(--color-primary);
28
+ font-size: 13px;
29
+ line-height: 20px;
30
+ letter-spacing: 0.01em;
31
+ margin: 9px 0 14px;
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 5px;
35
+ font-weight: normal;
36
+ }
37
+
38
+ h3 {
39
+ font-size: 13px;
40
+ line-height: 20px;
41
+ letter-spacing: 0.04em;
42
+ color: var(--color-text-primary);
43
+ margin-bottom: 2px;
44
+ font-weight: normal;
45
+ }
46
+
47
+ .preview p {
48
+ margin-bottom: 24px;
49
+ }
50
+
51
+ .thumbnail {
52
+ height: 92px;
53
+ }
54
+
55
+ .video {
56
+ display: flex;
57
+ flex-flow: row wrap;
58
+ gap: 20px;
59
+ }
60
+
61
+ x-link { /* stylelint-disable-line selector-type-no-unknown */
62
+ color: var(--color-primary);
63
+ text-decoration-line: underline;
64
+ }
65
+
66
+ x-link.quick-start-link { /* stylelint-disable-line selector-type-no-unknown */
67
+ font-size: 14px;
68
+ line-height: 22px;
69
+ letter-spacing: 0.04em;
70
+ }
71
+
72
+ .video-description {
73
+ min-width: min-content;
74
+ flex-basis: min-content;
75
+ flex-grow: 1;
76
+ }