chrome-devtools-frontend 1.0.935974 → 1.0.937244
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.
- package/config/gni/all_devtools_files.gni +0 -13
- package/config/gni/devtools_grd_files.gni +6 -4
- package/front_end/.eslintrc.js +1 -0
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/entrypoints/devtools_app/devtools_app.json +0 -3
- package/front_end/entrypoints/inspector_main/module.json +1 -2
- package/front_end/entrypoints/main/MainImpl.ts +10 -3
- package/front_end/entrypoints/node_app/node_app.json +0 -1
- package/front_end/entrypoints/node_main/node_main-meta.ts +0 -3
- package/front_end/entrypoints/shell/shell.json +0 -2
- package/front_end/entrypoints/worker_app/worker_app.json +0 -2
- package/front_end/panels/application/module.json +0 -2
- package/front_end/panels/console/ConsolePinPane.ts +1 -0
- package/front_end/panels/coverage/CoverageListView.ts +13 -4
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +1 -0
- package/front_end/panels/css_overview/css_overview-meta.ts +0 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +1 -0
- package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -0
- package/front_end/panels/elements/components/QueryContainer.ts +1 -0
- package/front_end/panels/elements/module.json +0 -2
- package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +18 -2
- package/front_end/panels/emulation/module.json +1 -2
- package/front_end/panels/event_listeners/EventListenersView.ts +2 -0
- package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +0 -3
- package/front_end/panels/network/module.json +0 -1
- package/front_end/panels/performance_monitor/performance_monitor-meta.ts +0 -3
- package/front_end/panels/sources/BreakpointEditDialog.ts +1 -0
- package/front_end/panels/sources/module.json +0 -2
- package/front_end/panels/timeline/module.json +1 -2
- package/front_end/ui/components/docs/create_breadcrumbs.ts +1 -0
- package/front_end/ui/components/helpers/get-stylesheet.ts +0 -1
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -0
- package/front_end/ui/components/text_editor/config.ts +3 -1
- package/front_end/ui/legacy/UIUtils.ts +1 -1
- package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +2 -1
- package/front_end/ui/legacy/components/inline_editor/CSSShadowEditor.ts +2 -1
- package/front_end/ui/legacy/components/inline_editor/FontEditor.ts +5 -1
- package/front_end/ui/legacy/components/inline_editor/SwatchPopoverHelper.ts +2 -1
- package/front_end/ui/legacy/components/inline_editor/Swatches.ts +4 -2
- package/front_end/ui/legacy/inspectorCommon.css +2 -12
- package/front_end/ui/legacy/softDropDownButton.css +0 -11
- package/front_end/ui/legacy/themeColors.css +2 -2
- package/package.json +1 -1
- package/scripts/build/rollup.config.js +3 -0
- package/scripts/eslint_rules/lib/ban_a_tags_in_lit_html.js +47 -0
- package/scripts/eslint_rules/tests/ban_a_tags_in_lit_html_test.js +60 -0
- package/front_end/entrypoints/node_main/module.json +0 -8
- package/front_end/panels/css_overview/module.json +0 -4
- package/front_end/panels/event_listeners/module.json +0 -5
- package/front_end/panels/mobile_throttling/module.json +0 -5
- package/front_end/panels/performance_monitor/module.json +0 -5
- package/front_end/ui/legacy/components/inline_editor/module.json +0 -14
|
@@ -46,7 +46,6 @@ all_devtools_files = [
|
|
|
46
46
|
"front_end/legacy_test_runner/coverage_test_runner/coverage_test_runner.js",
|
|
47
47
|
"front_end/panels/coverage/module.json",
|
|
48
48
|
"front_end/legacy_test_runner/cpu_profiler_test_runner/cpu_profiler_test_runner.js",
|
|
49
|
-
"front_end/panels/css_overview/module.json",
|
|
50
49
|
"front_end/legacy_test_runner/data_grid_test_runner/data_grid_test_runner.js",
|
|
51
50
|
"front_end/legacy_test_runner/device_mode_test_runner/device_mode_test_runner.js",
|
|
52
51
|
"front_end/legacy_test_runner/elements_test_runner/elements_test_runner.js",
|
|
@@ -62,19 +61,10 @@ all_devtools_files = [
|
|
|
62
61
|
"front_end/panels/emulation/inspectedPagePlaceholder.css",
|
|
63
62
|
"front_end/panels/emulation/mediaQueryInspector.css",
|
|
64
63
|
"front_end/panels/emulation/module.json",
|
|
65
|
-
"front_end/panels/event_listeners/module.json",
|
|
66
64
|
"front_end/legacy_test_runner/extensions_test_runner/extensions_test_runner.js",
|
|
67
65
|
"front_end/legacy_test_runner/extensions_test_runner/ExtensionsNetworkTestRunner.js",
|
|
68
66
|
"front_end/legacy_test_runner/extensions_test_runner/ExtensionsTestRunner.js",
|
|
69
67
|
"front_end/legacy_test_runner/heap_profiler_test_runner/heap_profiler_test_runner.js",
|
|
70
|
-
"front_end/ui/legacy/components/inline_editor/bezierEditor.css",
|
|
71
|
-
"front_end/ui/legacy/components/inline_editor/bezierSwatch.css",
|
|
72
|
-
"front_end/ui/legacy/components/inline_editor/colorSwatch.css",
|
|
73
|
-
"front_end/ui/legacy/components/inline_editor/cssShadowEditor.css",
|
|
74
|
-
"front_end/ui/legacy/components/inline_editor/cssShadowSwatch.css",
|
|
75
|
-
"front_end/ui/legacy/components/inline_editor/fontEditor.css",
|
|
76
|
-
"front_end/ui/legacy/components/inline_editor/module.json",
|
|
77
|
-
"front_end/ui/legacy/components/inline_editor/swatchPopover.css",
|
|
78
68
|
"front_end/entrypoints/inspector_main/module.json",
|
|
79
69
|
"front_end/entrypoints/inspector_main/nodeIcon.css",
|
|
80
70
|
"front_end/entrypoints/inspector_main/renderingOptions.css",
|
|
@@ -86,11 +76,9 @@ all_devtools_files = [
|
|
|
86
76
|
"front_end/panels/layers/module.json",
|
|
87
77
|
"front_end/entrypoints/main/module.json",
|
|
88
78
|
"front_end/panels/media/module.json",
|
|
89
|
-
"front_end/panels/mobile_throttling/module.json",
|
|
90
79
|
"front_end/entrypoints/ndb_app/ndb_app.json",
|
|
91
80
|
"front_end/legacy_test_runner/network_test_runner/network_test_runner.js",
|
|
92
81
|
"front_end/panels/network/module.json",
|
|
93
|
-
"front_end/entrypoints/node_main/module.json",
|
|
94
82
|
"front_end/entrypoints/node_main/nodeConnectionsPanel.css",
|
|
95
83
|
"front_end/ui/legacy/components/perf_ui/chartViewport.css",
|
|
96
84
|
"front_end/ui/legacy/components/perf_ui/filmStripView.css",
|
|
@@ -99,7 +87,6 @@ all_devtools_files = [
|
|
|
99
87
|
"front_end/ui/legacy/components/perf_ui/overviewGrid.css",
|
|
100
88
|
"front_end/ui/legacy/components/perf_ui/timelineGrid.css",
|
|
101
89
|
"front_end/ui/legacy/components/perf_ui/timelineOverviewInfo.css",
|
|
102
|
-
"front_end/panels/performance_monitor/module.json",
|
|
103
90
|
"front_end/panels/protocol_monitor/module.json",
|
|
104
91
|
"front_end/legacy_test_runner/performance_test_runner/performance_test_runner.js",
|
|
105
92
|
"front_end/legacy_test_runner/performance_test_runner/TimelineDataTestRunner.js",
|
|
@@ -357,7 +357,6 @@ grd_files_release_sources = [
|
|
|
357
357
|
"front_end/panels/css_overview/components/components.js",
|
|
358
358
|
"front_end/panels/css_overview/css_overview-meta.js",
|
|
359
359
|
"front_end/panels/css_overview/css_overview.js",
|
|
360
|
-
"front_end/panels/css_overview/css_overview_module.js",
|
|
361
360
|
"front_end/panels/developer_resources/developer_resources-meta.js",
|
|
362
361
|
"front_end/panels/developer_resources/developer_resources.js",
|
|
363
362
|
"front_end/panels/elements/components/components.js",
|
|
@@ -370,7 +369,6 @@ grd_files_release_sources = [
|
|
|
370
369
|
"front_end/panels/emulation/emulation-meta.js",
|
|
371
370
|
"front_end/panels/emulation/emulation.js",
|
|
372
371
|
"front_end/panels/event_listeners/event_listeners.js",
|
|
373
|
-
"front_end/panels/event_listeners/event_listeners_module.js",
|
|
374
372
|
"front_end/panels/help/help-meta.js",
|
|
375
373
|
"front_end/panels/help/help.js",
|
|
376
374
|
"front_end/panels/input/input-meta.js",
|
|
@@ -407,7 +405,6 @@ grd_files_release_sources = [
|
|
|
407
405
|
"front_end/panels/network/network_module.js",
|
|
408
406
|
"front_end/panels/performance_monitor/performance_monitor-meta.js",
|
|
409
407
|
"front_end/panels/performance_monitor/performance_monitor.js",
|
|
410
|
-
"front_end/panels/performance_monitor/performance_monitor_module.js",
|
|
411
408
|
"front_end/panels/profiler/profiler-legacy.js",
|
|
412
409
|
"front_end/panels/profiler/profiler-meta.js",
|
|
413
410
|
"front_end/panels/profiler/profiler.js",
|
|
@@ -507,7 +504,6 @@ grd_files_release_sources = [
|
|
|
507
504
|
"front_end/ui/legacy/components/data_grid/data_grid.js",
|
|
508
505
|
"front_end/ui/legacy/components/inline_editor/inline_editor-legacy.js",
|
|
509
506
|
"front_end/ui/legacy/components/inline_editor/inline_editor.js",
|
|
510
|
-
"front_end/ui/legacy/components/inline_editor/inline_editor_module.js",
|
|
511
507
|
"front_end/ui/legacy/components/object_ui/object_ui-legacy.js",
|
|
512
508
|
"front_end/ui/legacy/components/object_ui/object_ui-meta.js",
|
|
513
509
|
"front_end/ui/legacy/components/object_ui/object_ui.js",
|
|
@@ -1513,12 +1509,18 @@ grd_files_debug_sources = [
|
|
|
1513
1509
|
"front_end/ui/legacy/components/inline_editor/InlineEditorUtils.js",
|
|
1514
1510
|
"front_end/ui/legacy/components/inline_editor/SwatchPopoverHelper.js",
|
|
1515
1511
|
"front_end/ui/legacy/components/inline_editor/Swatches.js",
|
|
1512
|
+
"front_end/ui/legacy/components/inline_editor/bezierEditor.css.js",
|
|
1513
|
+
"front_end/ui/legacy/components/inline_editor/bezierSwatch.css.js",
|
|
1516
1514
|
"front_end/ui/legacy/components/inline_editor/colorSwatch.css.js",
|
|
1517
1515
|
"front_end/ui/legacy/components/inline_editor/cssAngle.css.js",
|
|
1518
1516
|
"front_end/ui/legacy/components/inline_editor/cssAngleEditor.css.js",
|
|
1519
1517
|
"front_end/ui/legacy/components/inline_editor/cssAngleSwatch.css.js",
|
|
1520
1518
|
"front_end/ui/legacy/components/inline_editor/cssLength.css.js",
|
|
1519
|
+
"front_end/ui/legacy/components/inline_editor/cssShadowEditor.css.js",
|
|
1520
|
+
"front_end/ui/legacy/components/inline_editor/cssShadowSwatch.css.js",
|
|
1521
1521
|
"front_end/ui/legacy/components/inline_editor/cssVarSwatch.css.js",
|
|
1522
|
+
"front_end/ui/legacy/components/inline_editor/fontEditor.css.js",
|
|
1523
|
+
"front_end/ui/legacy/components/inline_editor/swatchPopover.css.js",
|
|
1522
1524
|
"front_end/ui/legacy/components/object_ui/CustomPreviewComponent.js",
|
|
1523
1525
|
"front_end/ui/legacy/components/object_ui/JavaScriptAutocomplete.js",
|
|
1524
1526
|
"front_end/ui/legacy/components/object_ui/JavaScriptREPL.js",
|
package/front_end/.eslintrc.js
CHANGED
|
@@ -30,6 +30,7 @@ module.exports = {
|
|
|
30
30
|
'rulesdir/ban_literal_devtools_component_tag_names': 2,
|
|
31
31
|
'rulesdir/ban_self_closing_custom_element_tagnames': 2,
|
|
32
32
|
'rulesdir/ban_style_tags_in_lit_html': 2,
|
|
33
|
+
'rulesdir/ban_a_tags_in_lit_html': 2,
|
|
33
34
|
'rulesdir/check_component_naming': 2,
|
|
34
35
|
'rulesdir/check_was_shown_methods': 2,
|
|
35
36
|
'rulesdir/static_custom_event_names': 2,
|
|
@@ -574,7 +574,8 @@ export const DevtoolsExperiments: {
|
|
|
574
574
|
'reportingApiDebugging': 49,
|
|
575
575
|
'syncSettings': 50,
|
|
576
576
|
'groupAndHideIssuesByKind': 51,
|
|
577
|
-
'
|
|
577
|
+
'cssTypeComponentLength': 52,
|
|
578
|
+
'__lastValidEnumPosition': 52,
|
|
578
579
|
};
|
|
579
580
|
|
|
580
581
|
export const IssueExpanded: {
|
|
@@ -2,19 +2,16 @@
|
|
|
2
2
|
"modules" : [
|
|
3
3
|
{ "name": "panels/emulation", "type": "autostart" },
|
|
4
4
|
{ "name": "entrypoints/inspector_main", "type": "autostart" },
|
|
5
|
-
{ "name": "panels/mobile_throttling", "type": "autostart" },
|
|
6
5
|
|
|
7
6
|
{ "name": "panels/accessibility" },
|
|
8
7
|
{ "name": "panels/lighthouse" },
|
|
9
8
|
{ "name": "panels/browser_debugger" },
|
|
10
|
-
{ "name": "panels/css_overview" },
|
|
11
9
|
{ "name": "panels/elements" },
|
|
12
10
|
{ "name": "emulated_devices" },
|
|
13
11
|
{ "name": "panels/issues" },
|
|
14
12
|
{ "name": "panels/layers" },
|
|
15
13
|
{ "name": "panels/layer_viewer" },
|
|
16
14
|
{ "name": "panels/network" },
|
|
17
|
-
{ "name": "panels/performance_monitor" },
|
|
18
15
|
{ "name": "panels/application" },
|
|
19
16
|
{ "name": "panels/security" },
|
|
20
17
|
{ "name": "panels/timeline" },
|
|
@@ -323,15 +323,22 @@ export class MainImpl {
|
|
|
323
323
|
Root.Runtime.experiments.register(
|
|
324
324
|
Root.Runtime.ExperimentName.SYNC_SETTINGS, 'Sync DevTools settings with Chrome Sync');
|
|
325
325
|
|
|
326
|
+
// Debugging of Reporting API
|
|
327
|
+
Root.Runtime.experiments.register('reportingApiDebugging', 'Enable Reporting API panel in the Application panel');
|
|
328
|
+
|
|
329
|
+
// CSS <length> authoring tool.
|
|
330
|
+
Root.Runtime.experiments.register(
|
|
331
|
+
'cssTypeComponentLength',
|
|
332
|
+
'Enable CSS <length> authoring tool in the Styles pane (https://goo.gle/length-feedback)', undefined,
|
|
333
|
+
'https://developer.chrome.com/blog/new-in-devtools-96/#length');
|
|
334
|
+
|
|
326
335
|
Root.Runtime.experiments.enableExperimentsByDefault([
|
|
327
336
|
'sourceOrderViewer',
|
|
328
337
|
'hideIssuesFeature',
|
|
329
338
|
'bfcacheDebugging',
|
|
339
|
+
'cssTypeComponentLength',
|
|
330
340
|
]);
|
|
331
341
|
|
|
332
|
-
// Debugging of Reporting API
|
|
333
|
-
Root.Runtime.experiments.register('reportingApiDebugging', 'Enable Reporting API panel in the Application panel');
|
|
334
|
-
|
|
335
342
|
Root.Runtime.experiments.cleanUpStaleExperiments();
|
|
336
343
|
const enabledExperiments = Root.Runtime.Runtime.queryParam('enabledExperiments');
|
|
337
344
|
if (enabledExperiments) {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
6
|
-
import * as Root from '../../core/root/root.js';
|
|
7
6
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
8
7
|
|
|
9
8
|
// eslint-disable-next-line rulesdir/es_modules_import
|
|
@@ -31,8 +30,6 @@ let loadedNodeMainModule: (typeof NodeMain|undefined);
|
|
|
31
30
|
|
|
32
31
|
async function loadNodeMainModule(): Promise<typeof NodeMain> {
|
|
33
32
|
if (!loadedNodeMainModule) {
|
|
34
|
-
// Side-effect import resources in module.json
|
|
35
|
-
await Root.Runtime.Runtime.instance().loadModulePromise('entrypoints/node_main');
|
|
36
33
|
loadedNodeMainModule = await import('./node_main.js');
|
|
37
34
|
}
|
|
38
35
|
return loadedNodeMainModule;
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
{ "name": "panels/console" },
|
|
7
7
|
{ "name": "panels/coverage" },
|
|
8
|
-
{ "name": "panels/event_listeners" },
|
|
9
|
-
{ "name": "ui/legacy/components/inline_editor" },
|
|
10
8
|
{ "name": "ui/legacy/components/perf_ui" },
|
|
11
9
|
{ "name": "panels/profiler" },
|
|
12
10
|
{ "name": "panels/protocol_monitor"},
|
|
@@ -138,8 +138,8 @@ export class CoverageListView extends UI.Widget.VBox {
|
|
|
138
138
|
this.highlightRegExp = null;
|
|
139
139
|
|
|
140
140
|
const columns: DataGrid.DataGrid.ColumnDescriptor[] = [
|
|
141
|
-
{id: 'url', title: i18nString(UIStrings.url), width: '250px', fixedWidth: false, sortable: true},
|
|
142
|
-
{id: 'type', title: i18nString(UIStrings.type), width: '45px', fixedWidth: true, sortable: true},
|
|
141
|
+
{id: 'url', title: i18nString(UIStrings.url), width: '250px', weight: 3, fixedWidth: false, sortable: true},
|
|
142
|
+
{id: 'type', title: i18nString(UIStrings.type), width: '45px', weight: 1, fixedWidth: true, sortable: true},
|
|
143
143
|
{
|
|
144
144
|
id: 'size',
|
|
145
145
|
title: i18nString(UIStrings.totalBytes),
|
|
@@ -147,6 +147,7 @@ export class CoverageListView extends UI.Widget.VBox {
|
|
|
147
147
|
fixedWidth: true,
|
|
148
148
|
sortable: true,
|
|
149
149
|
align: DataGrid.DataGrid.Align.Right,
|
|
150
|
+
weight: 1,
|
|
150
151
|
},
|
|
151
152
|
{
|
|
152
153
|
id: 'unusedSize',
|
|
@@ -156,9 +157,17 @@ export class CoverageListView extends UI.Widget.VBox {
|
|
|
156
157
|
sortable: true,
|
|
157
158
|
align: DataGrid.DataGrid.Align.Right,
|
|
158
159
|
sort: DataGrid.DataGrid.Order.Descending,
|
|
160
|
+
weight: 1,
|
|
159
161
|
},
|
|
160
|
-
{
|
|
161
|
-
|
|
162
|
+
{
|
|
163
|
+
id: 'bars',
|
|
164
|
+
title: i18nString(UIStrings.usageVisualization),
|
|
165
|
+
width: '250px',
|
|
166
|
+
fixedWidth: false,
|
|
167
|
+
sortable: true,
|
|
168
|
+
weight: 1,
|
|
169
|
+
},
|
|
170
|
+
];
|
|
162
171
|
this.dataGrid = new DataGrid.SortableDataGrid.SortableDataGrid<GridNode>({
|
|
163
172
|
displayName: i18nString(UIStrings.codeCoverage),
|
|
164
173
|
columns,
|
|
@@ -106,6 +106,7 @@ export class CSSOverviewStartView extends HTMLElement {
|
|
|
106
106
|
private render(): void {
|
|
107
107
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
108
108
|
// clang-format off
|
|
109
|
+
// eslint-disable-next-line rulesdir/ban_a_tags_in_lit_html
|
|
109
110
|
render(html`
|
|
110
111
|
<div class="css-overview-start-view">
|
|
111
112
|
<h1 class="summary-header">${i18nString(UIStrings.identifyCSSImprovements)}</h1>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
6
|
-
import * as Root from '../../core/root/root.js';
|
|
7
6
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
8
7
|
|
|
9
8
|
// eslint-disable-next-line rulesdir/es_modules_import
|
|
@@ -27,8 +26,6 @@ let loadedCSSOverviewModule: (typeof CSSOverview|undefined);
|
|
|
27
26
|
|
|
28
27
|
async function loadCSSOverviewModule(): Promise<typeof CSSOverview> {
|
|
29
28
|
if (!loadedCSSOverviewModule) {
|
|
30
|
-
// Side-effect import resources in module.json
|
|
31
|
-
await Root.Runtime.Runtime.instance().loadModulePromise('panels/css_overview');
|
|
32
29
|
loadedCSSOverviewModule = await import('./css_overview.js');
|
|
33
30
|
}
|
|
34
31
|
return loadedCSSOverviewModule;
|
|
@@ -1049,6 +1049,7 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1049
1049
|
},
|
|
1050
1050
|
]),
|
|
1051
1051
|
TextEditor.Config.baseConfiguration(initialValue),
|
|
1052
|
+
TextEditor.Config.autocompletion,
|
|
1052
1053
|
html(),
|
|
1053
1054
|
TextEditor.Config.domWordWrap,
|
|
1054
1055
|
CodeMirror.EditorView.theme({
|
|
@@ -3055,7 +3055,7 @@ export class StylesSidebarPropertyRenderer {
|
|
|
3055
3055
|
}
|
|
3056
3056
|
processors.push(this.fontHandler);
|
|
3057
3057
|
}
|
|
3058
|
-
if (this.lengthHandler) {
|
|
3058
|
+
if (Root.Runtime.experiments.isEnabled('cssTypeComponentLength') && this.lengthHandler) {
|
|
3059
3059
|
// TODO(changhaohan): crbug.com/1138628 refactor this to handle unitless 0 cases
|
|
3060
3060
|
regexes.push(InlineEditor.CSSLengthUtils.CSSLengthRegex);
|
|
3061
3061
|
processors.push(this.lengthHandler);
|
|
@@ -286,6 +286,7 @@ export class ElementsBreadcrumbs extends HTMLElement {
|
|
|
286
286
|
crumb: true,
|
|
287
287
|
selected: crumb.selected,
|
|
288
288
|
};
|
|
289
|
+
// eslint-disable-next-line rulesdir/ban_a_tags_in_lit_html
|
|
289
290
|
return LitHtml.html`
|
|
290
291
|
<li class=${LitHtml.Directives.classMap(crumbClasses)}
|
|
291
292
|
data-node-id=${crumb.node.id}
|
|
@@ -6,6 +6,7 @@ import type * as Platform from '../../../core/platform/platform.js';
|
|
|
6
6
|
import * as EmulationModel from '../../../models/emulation/emulation.js';
|
|
7
7
|
import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
|
|
8
8
|
import * as LitHtml from '../../../ui/lit-html/lit-html.js';
|
|
9
|
+
import * as UILegacy from '../../../ui/legacy/legacy.js';
|
|
9
10
|
|
|
10
11
|
class SizeChangedEvent extends Event {
|
|
11
12
|
static readonly eventName = 'sizechanged';
|
|
@@ -14,6 +15,10 @@ class SizeChangedEvent extends Event {
|
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
function getInputValue(event: Event): number {
|
|
19
|
+
return Number((event.target as HTMLInputElement).value);
|
|
20
|
+
}
|
|
21
|
+
|
|
17
22
|
export class SizeInputElement extends HTMLElement {
|
|
18
23
|
#root = this.attachShadow({mode: 'open'});
|
|
19
24
|
#disabled = false;
|
|
@@ -86,13 +91,24 @@ export class SizeInputElement extends HTMLElement {
|
|
|
86
91
|
placeholder=${this.#placeholder}
|
|
87
92
|
?disabled=${this.#disabled}
|
|
88
93
|
.value=${this.#size}
|
|
89
|
-
@change=${this.fireSizeChange}
|
|
94
|
+
@change=${this.fireSizeChange}
|
|
95
|
+
@keydown=${this.handleModifierKeys} />
|
|
90
96
|
`,
|
|
91
97
|
this.#root, {host: this});
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
private fireSizeChange(event: Event): void {
|
|
95
|
-
this.dispatchEvent(new SizeChangedEvent(
|
|
101
|
+
this.dispatchEvent(new SizeChangedEvent(getInputValue(event)));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private handleModifierKeys(event: Event): void {
|
|
105
|
+
const modifiedValue = UILegacy.UIUtils.modifiedFloatNumber(getInputValue(event), event);
|
|
106
|
+
if (modifiedValue === null) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
(event.target as HTMLInputElement).value = String(modifiedValue);
|
|
96
112
|
}
|
|
97
113
|
}
|
|
98
114
|
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
|
-
import * as Root from '../../core/root/root.js';
|
|
8
7
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
9
8
|
|
|
10
9
|
// eslint-disable-next-line rulesdir/es_modules_import
|
|
@@ -53,8 +52,6 @@ let loadedMobileThrottlingModule: (typeof MobileThrottling|undefined);
|
|
|
53
52
|
|
|
54
53
|
async function loadMobileThrottlingModule(): Promise<typeof MobileThrottling> {
|
|
55
54
|
if (!loadedMobileThrottlingModule) {
|
|
56
|
-
// Side-effect import resources in module.json
|
|
57
|
-
await Root.Runtime.Runtime.instance().loadModulePromise('panels/mobile_throttling');
|
|
58
55
|
loadedMobileThrottlingModule = await import('./mobile_throttling.js');
|
|
59
56
|
}
|
|
60
57
|
return loadedMobileThrottlingModule;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
6
|
-
import * as Root from '../../core/root/root.js';
|
|
7
6
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
8
7
|
|
|
9
8
|
// eslint-disable-next-line rulesdir/es_modules_import
|
|
@@ -47,8 +46,6 @@ let loadedPerformanceMonitorModule: (typeof PerformanceMonitor|undefined);
|
|
|
47
46
|
|
|
48
47
|
async function loadPerformanceMonitorModule(): Promise<typeof PerformanceMonitor> {
|
|
49
48
|
if (!loadedPerformanceMonitorModule) {
|
|
50
|
-
// Side-effect import resources in module.json
|
|
51
|
-
await Root.Runtime.Runtime.instance().loadModulePromise('panels/performance_monitor');
|
|
52
49
|
loadedPerformanceMonitorModule = await import('./performance_monitor.js');
|
|
53
50
|
}
|
|
54
51
|
return loadedPerformanceMonitorModule;
|
|
@@ -71,6 +71,7 @@ export class BreakpointEditDialog extends UI.Widget.Widget {
|
|
|
71
71
|
const editorConfig = [
|
|
72
72
|
(await CodeMirror.javascript()).javascriptLanguage,
|
|
73
73
|
TextEditor.Config.baseConfiguration(oldCondition || ''),
|
|
74
|
+
TextEditor.Config.autocompletion,
|
|
74
75
|
CodeMirror.EditorView.lineWrapping,
|
|
75
76
|
TextEditor.Config.showCompletionHint,
|
|
76
77
|
await TextEditor.JavaScript.completion(),
|
|
@@ -48,7 +48,6 @@ export const CSS_RESOURCES_TO_LOAD_INTO_RUNTIME = [
|
|
|
48
48
|
'ui/legacy/progressIndicator.css',
|
|
49
49
|
'panels/application/serviceWorkerUpdateCycleView.css',
|
|
50
50
|
'ui/legacy/tabbedPane.css',
|
|
51
|
-
'ui/legacy/components/inline_editor/colorSwatch.css',
|
|
52
51
|
'ui/legacy/glassPane.css',
|
|
53
52
|
'ui/legacy/suggestBox.css',
|
|
54
53
|
'ui/legacy/treeoutline.css',
|
|
@@ -66,6 +66,7 @@ export class Linkifier extends HTMLElement {
|
|
|
66
66
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
67
67
|
await coordinator.write(() => {
|
|
68
68
|
// clang-format off
|
|
69
|
+
// eslint-disable-next-line rulesdir/ban_a_tags_in_lit_html
|
|
69
70
|
LitHtml.render(LitHtml.html`<a class="link" href=${this.#url} @click=${this.onLinkActivation}><slot>${LinkifierUtils.linkText(this.#url, this.#lineNumber)}</slot></a>`, this.#shadow, { host: this});
|
|
70
71
|
// clang-format on
|
|
71
72
|
});
|
|
@@ -57,7 +57,9 @@ export const tabMovesFocus = DynamicSetting.bool('textEditorTabMovesFocus', CM.k
|
|
|
57
57
|
shift: (view: CM.EditorView): boolean => view.state.doc.length ? CM.indentLess(view) : false,
|
|
58
58
|
}]));
|
|
59
59
|
|
|
60
|
-
export const autocompletion =
|
|
60
|
+
export const autocompletion = CM.autocompletion({icons: false});
|
|
61
|
+
|
|
62
|
+
export const sourcesAutocompletion = DynamicSetting.bool('textEditorAutocompletion', autocompletion);
|
|
61
63
|
|
|
62
64
|
export const bracketMatching = DynamicSetting.bool('textEditorBracketMatching', CM.bracketMatching());
|
|
63
65
|
|
|
@@ -450,7 +450,7 @@ function modifiedHexValue(hexString: string, event: Event): string|null {
|
|
|
450
450
|
return resultString;
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
-
function modifiedFloatNumber(number: number, event: Event, modifierMultiplier?: number): number|null {
|
|
453
|
+
export function modifiedFloatNumber(number: number, event: Event, modifierMultiplier?: number): number|null {
|
|
454
454
|
const direction = getValueModificationDirection(event);
|
|
455
455
|
if (!direction) {
|
|
456
456
|
return null;
|
|
@@ -6,6 +6,7 @@ import * as Common from '../../../../core/common/common.js';
|
|
|
6
6
|
import * as Platform from '../../../../core/platform/platform.js';
|
|
7
7
|
import * as UI from '../../legacy.js';
|
|
8
8
|
|
|
9
|
+
import bezierEditorStyles from './bezierEditor.css.js';
|
|
9
10
|
import {BezierUI} from './BezierUI.js';
|
|
10
11
|
|
|
11
12
|
export class BezierEditor extends Common.ObjectWrapper.eventMixin<EventTypes, typeof UI.Widget.VBox>(UI.Widget.VBox) {
|
|
@@ -29,7 +30,6 @@ export class BezierEditor extends Common.ObjectWrapper.eventMixin<EventTypes, ty
|
|
|
29
30
|
constructor(bezier: UI.Geometry.CubicBezier) {
|
|
30
31
|
super(true);
|
|
31
32
|
this.bezierInternal = bezier;
|
|
32
|
-
this.registerRequiredCSS('ui/legacy/components/inline_editor/bezierEditor.css');
|
|
33
33
|
this.contentElement.tabIndex = 0;
|
|
34
34
|
this.setDefaultFocusedElement(this.contentElement);
|
|
35
35
|
|
|
@@ -79,6 +79,7 @@ export class BezierEditor extends Common.ObjectWrapper.eventMixin<EventTypes, ty
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
wasShown(): void {
|
|
82
|
+
this.registerCSSFiles([bezierEditorStyles]);
|
|
82
83
|
this.unselectPresets();
|
|
83
84
|
// Check if bezier matches a preset
|
|
84
85
|
for (const category of this.presetCategories) {
|
|
@@ -9,6 +9,7 @@ import * as UI from '../../legacy.js';
|
|
|
9
9
|
|
|
10
10
|
import type {CSSShadowModel} from './CSSShadowModel.js';
|
|
11
11
|
import {CSSLength} from './CSSShadowModel.js';
|
|
12
|
+
import cssShadowEditorStyles from './cssShadowEditor.css.js';
|
|
12
13
|
|
|
13
14
|
const UIStrings = {
|
|
14
15
|
/**
|
|
@@ -61,7 +62,6 @@ export class CSSShadowEditor extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
|
61
62
|
private changedElement?: HTMLInputElement|null;
|
|
62
63
|
constructor() {
|
|
63
64
|
super(true);
|
|
64
|
-
this.registerRequiredCSS('ui/legacy/components/inline_editor/cssShadowEditor.css');
|
|
65
65
|
this.contentElement.tabIndex = 0;
|
|
66
66
|
this.setDefaultFocusedElement(this.contentElement);
|
|
67
67
|
|
|
@@ -120,6 +120,7 @@ export class CSSShadowEditor extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
wasShown(): void {
|
|
123
|
+
this.registerCSSFiles([cssShadowEditorStyles]);
|
|
123
124
|
this.updateUI();
|
|
124
125
|
}
|
|
125
126
|
|
|
@@ -8,6 +8,7 @@ import * as SDK from '../../../../core/sdk/sdk.js';
|
|
|
8
8
|
import * as IconButton from '../../../components/icon_button/icon_button.js';
|
|
9
9
|
import * as UI from '../../legacy.js';
|
|
10
10
|
|
|
11
|
+
import fontEditorStyles from './fontEditor.css.js';
|
|
11
12
|
import * as FontEditorUnitConverter from './FontEditorUnitConverter.js';
|
|
12
13
|
import * as FontEditorUtils from './FontEditorUtils.js';
|
|
13
14
|
|
|
@@ -123,7 +124,6 @@ export class FontEditor extends Common.ObjectWrapper.eventMixin<EventTypes, type
|
|
|
123
124
|
|
|
124
125
|
constructor(propertyMap: Map<string, string>) {
|
|
125
126
|
super(true);
|
|
126
|
-
this.registerRequiredCSS('ui/legacy/components/inline_editor/fontEditor.css');
|
|
127
127
|
this.selectedNode = UI.Context.Context.instance().flavor(SDK.DOMModel.DOMNode);
|
|
128
128
|
|
|
129
129
|
this.propertyMap = propertyMap;
|
|
@@ -174,6 +174,10 @@ export class FontEditor extends Common.ObjectWrapper.eventMixin<EventTypes, type
|
|
|
174
174
|
/** hasUnits= */ true);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
wasShown(): void {
|
|
178
|
+
this.registerCSSFiles([fontEditorStyles]);
|
|
179
|
+
}
|
|
180
|
+
|
|
177
181
|
private async createFontSelectorSection(propertyValue?: string): Promise<void> {
|
|
178
182
|
if (propertyValue) {
|
|
179
183
|
// FIXME(crbug.com/1148434): propertyValue will not be split correctly for font family names that contain commas.
|
|
@@ -7,6 +7,7 @@ import * as Platform from '../../../../core/platform/platform.js';
|
|
|
7
7
|
import * as UI from '../../legacy.js';
|
|
8
8
|
|
|
9
9
|
import {ColorSwatch} from './ColorSwatch.js';
|
|
10
|
+
import swatchPopoverStyles from './swatchPopover.css.js';
|
|
10
11
|
|
|
11
12
|
export class SwatchPopoverHelper extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
12
13
|
private readonly popover: UI.GlassPane.GlassPane;
|
|
@@ -22,7 +23,6 @@ export class SwatchPopoverHelper extends Common.ObjectWrapper.ObjectWrapper<Even
|
|
|
22
23
|
constructor() {
|
|
23
24
|
super();
|
|
24
25
|
this.popover = new UI.GlassPane.GlassPane();
|
|
25
|
-
this.popover.registerRequiredCSS('ui/legacy/components/inline_editor/swatchPopover.css');
|
|
26
26
|
this.popover.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent);
|
|
27
27
|
this.popover.setMarginBehavior(UI.GlassPane.MarginBehavior.Arrow);
|
|
28
28
|
this.popover.element.addEventListener('mousedown', e => e.consume(), false);
|
|
@@ -60,6 +60,7 @@ export class SwatchPopoverHelper extends Common.ObjectWrapper.ObjectWrapper<Even
|
|
|
60
60
|
this.hide(true);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
this.popover.registerCSSFiles([swatchPopoverStyles]);
|
|
63
64
|
this.dispatchEventToListeners(Events.WillShowPopover);
|
|
64
65
|
|
|
65
66
|
this.isHidden = false;
|
|
@@ -8,6 +8,8 @@ import * as UI from '../../legacy.js';
|
|
|
8
8
|
|
|
9
9
|
import {ColorSwatch, FormatChangedEvent} from './ColorSwatch.js';
|
|
10
10
|
import type {CSSShadowModel} from './CSSShadowModel.js';
|
|
11
|
+
import bezierSwatchStyles from './bezierSwatch.css.js';
|
|
12
|
+
import cssShadowSwatchStyles from './cssShadowSwatch.css.js';
|
|
11
13
|
|
|
12
14
|
export class BezierSwatch extends HTMLSpanElement {
|
|
13
15
|
private readonly iconElementInternal: UI.Icon.Icon;
|
|
@@ -16,7 +18,7 @@ export class BezierSwatch extends HTMLSpanElement {
|
|
|
16
18
|
constructor() {
|
|
17
19
|
super();
|
|
18
20
|
const root = UI.Utils.createShadowRootWithCoreStyles(this, {
|
|
19
|
-
cssFile:
|
|
21
|
+
cssFile: [bezierSwatchStyles],
|
|
20
22
|
delegatesFocus: undefined,
|
|
21
23
|
});
|
|
22
24
|
this.iconElementInternal = UI.Icon.Icon.create('smallicon-bezier', 'bezier-swatch-icon');
|
|
@@ -63,7 +65,7 @@ export class CSSShadowSwatch extends HTMLSpanElement {
|
|
|
63
65
|
constructor() {
|
|
64
66
|
super();
|
|
65
67
|
const root = UI.Utils.createShadowRootWithCoreStyles(this, {
|
|
66
|
-
cssFile:
|
|
68
|
+
cssFile: [cssShadowSwatchStyles],
|
|
67
69
|
delegatesFocus: undefined,
|
|
68
70
|
});
|
|
69
71
|
this.iconElementInternal = UI.Icon.Icon.create('smallicon-shadow', 'shadow-swatch-icon');
|
|
@@ -390,7 +390,7 @@ input::placeholder {
|
|
|
390
390
|
.chrome-select:enabled:active,
|
|
391
391
|
.chrome-select:enabled:focus,
|
|
392
392
|
.chrome-select:enabled:hover {
|
|
393
|
-
--override-select-box-shadow: 0
|
|
393
|
+
--override-select-box-shadow: 0 0 0 2px var(--color-button-outline-focus);
|
|
394
394
|
|
|
395
395
|
background-color: var(--color-background-elevation-1);
|
|
396
396
|
box-shadow: var(--override-select-box-shadow);
|
|
@@ -401,10 +401,7 @@ input::placeholder {
|
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
.chrome-select:enabled:focus {
|
|
404
|
-
--override-extra-box-shadow-focus: 0 0 0 2px rgb(66 133 244 / 40%);
|
|
405
|
-
|
|
406
404
|
border-color: transparent;
|
|
407
|
-
box-shadow: var(--override-select-box-shadow), var(--override-extra-box-shadow-focus);
|
|
408
405
|
}
|
|
409
406
|
|
|
410
407
|
.-theme-with-dark-background .chrome-select:enabled:active,
|
|
@@ -413,14 +410,7 @@ input::placeholder {
|
|
|
413
410
|
:host-context(.-theme-with-dark-background) .chrome-select:enabled:active,
|
|
414
411
|
:host-context(.-theme-with-dark-background) .chrome-select:enabled:focus,
|
|
415
412
|
:host-context(.-theme-with-dark-background) .chrome-select:enabled:hover {
|
|
416
|
-
--override-select-box-shadow: 0
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
/* Disabled so we can keep all the selectors above in one block */
|
|
420
|
-
/* stylelint-disable-next-line no-descending-specificity */
|
|
421
|
-
.-theme-with-dark-background .chrome-select:enabled:focus,
|
|
422
|
-
:host-context(.-theme-with-dark-background) .chrome-select:enabled:focus {
|
|
423
|
-
--override-extra-box-shadow-focus: 0 0 0 2px rgb(11 78 189 / 40%);
|
|
413
|
+
--override-select-box-shadow: 0 0 0 2px var(--color-button-outline-focus);
|
|
424
414
|
}
|
|
425
415
|
|
|
426
416
|
.chrome-select-label {
|
|
@@ -23,17 +23,6 @@ button.soft-dropdown > .title {
|
|
|
23
23
|
text-overflow: ellipsis;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
button.soft-dropdown:focus-visible::before {
|
|
27
|
-
content: "";
|
|
28
|
-
position: absolute;
|
|
29
|
-
top: 2px;
|
|
30
|
-
left: 2px;
|
|
31
|
-
right: 2px;
|
|
32
|
-
bottom: 2px;
|
|
33
|
-
border-radius: 2px;
|
|
34
|
-
background: var(--divider-line);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
26
|
@media (forced-colors: active) {
|
|
38
27
|
button.soft-dropdown {
|
|
39
28
|
border: 1px solid ButtonText;
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
--color-input-outline-disabled: rgba(189 193 198 / 20%);
|
|
241
241
|
--color-input-text-disabled: rgba(128 134 139 / 70%);
|
|
242
242
|
/* Colors for styling buttons */
|
|
243
|
-
--color-button-outline-focus: rgb(138 180 248 /
|
|
243
|
+
--color-button-outline-focus: rgb(138 180 248 / 75%);
|
|
244
244
|
--color-button-primary-background-hovering: rgb(174 203 250 / 100%);
|
|
245
245
|
--color-button-primary-background-pressed: rgb(210 227 252 / 100%);
|
|
246
246
|
--color-button-primary-text: rgb(0 0 0);
|
|
@@ -265,10 +265,10 @@
|
|
|
265
265
|
--color-token-builtin: rgb(159 180 214);
|
|
266
266
|
--color-token-variable-special: rgb(0 85 170);
|
|
267
267
|
--color-token-keyword: rgb(154 127 213);
|
|
268
|
-
--color-token-number: var(--color-token-number);
|
|
269
268
|
--color-token-string: rgb(242 139 84);
|
|
270
269
|
--color-token-string-special: var(--color-token-string);
|
|
271
270
|
--color-token-atom: rgb(161 247 181);
|
|
271
|
+
--color-token-number: var(--color-token-atom);
|
|
272
272
|
--color-token-comment: rgb(137 137 137);
|
|
273
273
|
--color-token-tag: rgb(93 176 215);
|
|
274
274
|
--color-token-attribute: rgb(155 187 220);
|
package/package.json
CHANGED
|
@@ -75,6 +75,9 @@ export default commandLineArgs => ({
|
|
|
75
75
|
options: {
|
|
76
76
|
strategy: minifyHTMLStrategy,
|
|
77
77
|
minifyOptions: {
|
|
78
|
+
collapseInlineTagWhitespace: false,
|
|
79
|
+
collapseWhitespace: true,
|
|
80
|
+
conservativeCollapse: true,
|
|
78
81
|
minifyCSS: false,
|
|
79
82
|
removeOptionalTags: true,
|
|
80
83
|
},
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
function isLitHtmlTemplateCall(taggedTemplateExpression) {
|
|
7
|
+
if (taggedTemplateExpression.name) {
|
|
8
|
+
// Call to html`` and we assume that html = LitHtml's html function.
|
|
9
|
+
return taggedTemplateExpression.name === 'html';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Match calls to LitHtml.html``
|
|
13
|
+
return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
|
|
14
|
+
taggedTemplateExpression.property.name === 'html';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
meta: {
|
|
19
|
+
type: 'problem',
|
|
20
|
+
docs: {
|
|
21
|
+
description: 'Check for <a> and </a> in Lit templates instead of using x-link.',
|
|
22
|
+
category: 'Possible Errors',
|
|
23
|
+
},
|
|
24
|
+
fixable: 'code',
|
|
25
|
+
schema: [] // no options
|
|
26
|
+
},
|
|
27
|
+
create: function(context) {
|
|
28
|
+
return {
|
|
29
|
+
TaggedTemplateExpression(node) {
|
|
30
|
+
const isLitHtmlCall = isLitHtmlTemplateCall(node.tag);
|
|
31
|
+
if (!isLitHtmlCall) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// node.quasi.quasis are all the static parts of the template literal.
|
|
36
|
+
for (const templatePart of node.quasi.quasis) {
|
|
37
|
+
if (templatePart.value.raw.includes('<a') || templatePart.value.raw.includes('</a>')) {
|
|
38
|
+
context.report({
|
|
39
|
+
node,
|
|
40
|
+
message: 'Adding links to a component should be done using `front_end/ui/legacy/XLink.ts`',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
const rule = require('../lib/ban_a_tags_in_lit_html.js');
|
|
7
|
+
const ruleTester = new (require('eslint').RuleTester)({
|
|
8
|
+
parserOptions: {ecmaVersion: 9, sourceType: 'module'},
|
|
9
|
+
parser: require.resolve('@typescript-eslint/parser'),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const EXPECTED_ERROR_MESSAGE = 'Adding links to a component should be done using `front_end/ui/legacy/XLink.ts`';
|
|
13
|
+
|
|
14
|
+
ruleTester.run('ban_a_tags_in_lit_html', rule, {
|
|
15
|
+
valid: [
|
|
16
|
+
{
|
|
17
|
+
code: 'LitHtml.html`<p></p>`',
|
|
18
|
+
filename: 'front_end/components/test.ts',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
code: 'LitHtml.html`<input />`',
|
|
22
|
+
filename: 'front_end/components/test.ts',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
code: 'LitHtml.html`<${DataGrid.litTagName}></${DataGrid.litTagName}>`',
|
|
26
|
+
filename: 'front_end/components/test.ts',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
code: 'LitHtml.html`<p><${DataGrid.litTagName}></${DataGrid.litTagName}></p>`',
|
|
30
|
+
filename: 'front_end/components/test.ts',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
code:
|
|
34
|
+
'LitHtml.html`<${DataGrid1.litTagName}><${DataGrid2.litTagName}></${DataGrid2.litTagName}></${DataGrid1.litTagName}>`',
|
|
35
|
+
filename: 'front_end/components/test.ts',
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
invalid: [
|
|
39
|
+
{
|
|
40
|
+
code: 'LitHtml.html`<a />`',
|
|
41
|
+
filename: 'front_end/components/test.ts',
|
|
42
|
+
errors: [{message: EXPECTED_ERROR_MESSAGE}]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
code: 'LitHtml.html`<a></a>`',
|
|
46
|
+
filename: 'front_end/components/test.ts',
|
|
47
|
+
errors: [{message: EXPECTED_ERROR_MESSAGE}]
|
|
48
|
+
},
|
|
49
|
+
{code: 'LitHtml.html`</a>`', filename: 'front_end/components/test.ts', errors: [{message: EXPECTED_ERROR_MESSAGE}]},
|
|
50
|
+
{code: 'LitHtml.html`<a >`', filename: 'front_end/components/test.ts', errors: [{message: EXPECTED_ERROR_MESSAGE}]},
|
|
51
|
+
{
|
|
52
|
+
code: 'LitHtml.html`<p><${DataGrid.litTagName}></${DataGrid.litTagName}><a></a></p>`',
|
|
53
|
+
errors: [{message: EXPECTED_ERROR_MESSAGE}]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
code: 'LitHtml.html`<${DataGrid.litTagName}><a /></${DataGrid.litTagName}>`',
|
|
57
|
+
errors: [{message: EXPECTED_ERROR_MESSAGE}]
|
|
58
|
+
},
|
|
59
|
+
]
|
|
60
|
+
});
|