chrome-devtools-frontend 1.0.967135 → 1.0.967596
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/devtools_grd_files.gni +1 -0
- package/front_end/core/i18n/locales/en-US.json +3 -0
- package/front_end/core/i18n/locales/en-XL.json +3 -0
- package/front_end/core/sdk/CSSQuery.ts +1 -1
- package/front_end/core/sdk/CSSRule.ts +6 -6
- package/front_end/core/sdk/CSSSupports.ts +30 -0
- package/front_end/core/sdk/sdk.ts +2 -0
- package/front_end/panels/application/components/InterestGroupAccessGrid.ts +10 -2
- package/front_end/panels/application/components/interestGroupAccessGrid.css +1 -1
- package/front_end/panels/application/interestGroupStorageView.css +4 -0
- package/front_end/panels/elements/StylesSidebarPane.ts +33 -8
- package/front_end/ui/components/text_editor/config.ts +1 -0
- package/package.json +2 -1
- package/scripts/build/tests/plugins_test.js +30 -0
@@ -576,6 +576,7 @@ grd_files_debug_sources = [
|
|
576
576
|
"front_end/core/sdk/CSSRule.js",
|
577
577
|
"front_end/core/sdk/CSSStyleDeclaration.js",
|
578
578
|
"front_end/core/sdk/CSSStyleSheetHeader.js",
|
579
|
+
"front_end/core/sdk/CSSSupports.js",
|
579
580
|
"front_end/core/sdk/CategorizedBreakpoint.js",
|
580
581
|
"front_end/core/sdk/ChildTargetManager.js",
|
581
582
|
"front_end/core/sdk/CompilerSourceMappingContentProvider.js",
|
@@ -2966,6 +2966,9 @@
|
|
2966
2966
|
"panels/application/components/InterestGroupAccessGrid.ts | groupOwner": {
|
2967
2967
|
"message": "Owner"
|
2968
2968
|
},
|
2969
|
+
"panels/application/components/InterestGroupAccessGrid.ts | noEvents": {
|
2970
|
+
"message": "No interest group events recorded."
|
2971
|
+
},
|
2969
2972
|
"panels/application/components/OriginTrialTreeView.ts | expiryTime": {
|
2970
2973
|
"message": "Expiry Time"
|
2971
2974
|
},
|
@@ -2966,6 +2966,9 @@
|
|
2966
2966
|
"panels/application/components/InterestGroupAccessGrid.ts | groupOwner": {
|
2967
2967
|
"message": "Ôẃn̂ér̂"
|
2968
2968
|
},
|
2969
|
+
"panels/application/components/InterestGroupAccessGrid.ts | noEvents": {
|
2970
|
+
"message": "N̂ó îńt̂ér̂éŝt́ ĝŕôúp̂ év̂én̂t́ŝ ŕêćôŕd̂éd̂."
|
2971
|
+
},
|
2969
2972
|
"panels/application/components/OriginTrialTreeView.ts | expiryTime": {
|
2970
2973
|
"message": "Êx́p̂ír̂ý T̂ím̂é"
|
2971
2974
|
},
|
@@ -9,7 +9,7 @@ import type {CSSModel, Edit} from './CSSModel.js';
|
|
9
9
|
import {CSSLocation} from './CSSModel.js';
|
10
10
|
import type {CSSStyleSheetHeader} from './CSSStyleSheetHeader.js';
|
11
11
|
|
12
|
-
type CSSQueryPayload = Protocol.CSS.CSSMedia|Protocol.CSS.CSSContainerQuery;
|
12
|
+
type CSSQueryPayload = Protocol.CSS.CSSMedia|Protocol.CSS.CSSContainerQuery|Protocol.CSS.CSSSupports;
|
13
13
|
|
14
14
|
export abstract class CSSQuery {
|
15
15
|
text = '';
|
@@ -7,6 +7,7 @@ import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
7
7
|
|
8
8
|
import {CSSContainerQuery} from './CSSContainerQuery.js';
|
9
9
|
import {CSSMedia} from './CSSMedia.js';
|
10
|
+
import {CSSSupports} from './CSSSupports.js';
|
10
11
|
|
11
12
|
import type {CSSModel, Edit} from './CSSModel.js';
|
12
13
|
import {CSSStyleDeclaration, Type} from './CSSStyleDeclaration.js';
|
@@ -99,6 +100,7 @@ export class CSSStyleRule extends CSSRule {
|
|
99
100
|
selectors!: CSSValue[];
|
100
101
|
media: CSSMedia[];
|
101
102
|
containerQueries: CSSContainerQuery[];
|
103
|
+
supports: CSSSupports[];
|
102
104
|
wasUsed: boolean;
|
103
105
|
constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSRule, wasUsed?: boolean) {
|
104
106
|
// TODO(crbug.com/1011811): Replace with spread operator or better types once Closure is gone.
|
@@ -108,6 +110,7 @@ export class CSSStyleRule extends CSSRule {
|
|
108
110
|
this.containerQueries = payload.containerQueries ?
|
109
111
|
CSSContainerQuery.parseContainerQueriesPayload(cssModel, payload.containerQueries) :
|
110
112
|
[];
|
113
|
+
this.supports = payload.supports ? CSSSupports.parseSupportsPayload(cssModel, payload.supports) : [];
|
111
114
|
this.wasUsed = wasUsed || false;
|
112
115
|
}
|
113
116
|
|
@@ -191,12 +194,9 @@ export class CSSStyleRule extends CSSRule {
|
|
191
194
|
this.selectors[i].rebase(edit);
|
192
195
|
}
|
193
196
|
}
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
for (const containerQuery of this.containerQueries) {
|
198
|
-
containerQuery.rebase(edit);
|
199
|
-
}
|
197
|
+
this.media.forEach(media => media.rebase(edit));
|
198
|
+
this.containerQueries.forEach(cq => cq.rebase(edit));
|
199
|
+
this.supports.forEach(supports => supports.rebase(edit));
|
200
200
|
|
201
201
|
super.rebase(edit);
|
202
202
|
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// Copyright 2022 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 TextUtils from '../../models/text_utils/text_utils.js';
|
6
|
+
import type * as Protocol from '../../generated/protocol.js';
|
7
|
+
|
8
|
+
import type {CSSModel} from './CSSModel.js';
|
9
|
+
import {CSSQuery} from './CSSQuery.js';
|
10
|
+
|
11
|
+
export class CSSSupports extends CSSQuery {
|
12
|
+
static parseSupportsPayload(cssModel: CSSModel, payload: Protocol.CSS.CSSSupports[]): CSSSupports[] {
|
13
|
+
return payload.map(supports => new CSSSupports(cssModel, supports));
|
14
|
+
}
|
15
|
+
|
16
|
+
constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSSupports) {
|
17
|
+
super(cssModel);
|
18
|
+
this.reinitialize(payload);
|
19
|
+
}
|
20
|
+
|
21
|
+
reinitialize(payload: Protocol.CSS.CSSSupports): void {
|
22
|
+
this.text = payload.text;
|
23
|
+
this.range = payload.range ? TextUtils.TextRange.TextRange.fromObject(payload.range) : null;
|
24
|
+
this.styleSheetId = payload.styleSheetId;
|
25
|
+
}
|
26
|
+
|
27
|
+
active(): boolean {
|
28
|
+
return true;
|
29
|
+
}
|
30
|
+
}
|
@@ -34,6 +34,7 @@ import * as CSSQuery from './CSSQuery.js';
|
|
34
34
|
import * as CSSRule from './CSSRule.js';
|
35
35
|
import * as CSSStyleDeclaration from './CSSStyleDeclaration.js';
|
36
36
|
import * as CSSStyleSheetHeader from './CSSStyleSheetHeader.js';
|
37
|
+
import * as CSSSupports from './CSSSupports.js';
|
37
38
|
import * as DebuggerModel from './DebuggerModel.js';
|
38
39
|
import * as DOMDebuggerModel from './DOMDebuggerModel.js';
|
39
40
|
import * as DOMModel from './DOMModel.js';
|
@@ -101,6 +102,7 @@ export {
|
|
101
102
|
CSSRule,
|
102
103
|
CSSStyleDeclaration,
|
103
104
|
CSSStyleSheetHeader,
|
105
|
+
CSSSupports,
|
104
106
|
DebuggerModel,
|
105
107
|
DOMDebuggerModel,
|
106
108
|
DOMModel,
|
@@ -32,6 +32,10 @@ const UIStrings = {
|
|
32
32
|
*@description Text in InterestGroupStorage Items View of the Application panel
|
33
33
|
*/
|
34
34
|
groupName: 'Name',
|
35
|
+
/**
|
36
|
+
*@description Text shown instead of a table when the table would be empty.
|
37
|
+
*/
|
38
|
+
noEvents: 'No interest group events recorded.',
|
35
39
|
};
|
36
40
|
const str_ = i18n.i18n.registerUIStrings('panels/application/components/InterestGroupAccessGrid.ts', UIStrings);
|
37
41
|
export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
@@ -62,13 +66,17 @@ export class InterestGroupAccessGrid extends HTMLElement {
|
|
62
66
|
{iconName: 'ic_info_black_18dp', color: 'var(--color-link)', width: '14px'} as
|
63
67
|
IconButton.Icon.IconWithName}>
|
64
68
|
</${IconButton.Icon.Icon.litTagName}>
|
65
|
-
${this.#
|
69
|
+
${this.#renderGridOrNoDataMessage()}
|
66
70
|
</div>
|
67
71
|
`, this.#shadow, {host: this});
|
68
72
|
// clang-format on
|
69
73
|
}
|
70
74
|
|
71
|
-
#
|
75
|
+
#renderGridOrNoDataMessage(): LitHtml.TemplateResult {
|
76
|
+
if (this.#datastores.length === 0) {
|
77
|
+
return LitHtml.html`<div class="no-events-message">${i18nString(UIStrings.noEvents)}</div>`;
|
78
|
+
}
|
79
|
+
|
72
80
|
const gridData: DataGrid.DataGridController.DataGridControllerData = {
|
73
81
|
columns: [
|
74
82
|
{
|
@@ -1840,6 +1840,12 @@ export class StylePropertiesSection {
|
|
1840
1840
|
this.updateRuleOrigin();
|
1841
1841
|
}
|
1842
1842
|
|
1843
|
+
protected createAtRuleLists(rule: SDK.CSSRule.CSSStyleRule): void {
|
1844
|
+
this.createMediaList(rule.media);
|
1845
|
+
this.createContainerQueryList(rule.containerQueries);
|
1846
|
+
this.createSupportsList(rule.supports);
|
1847
|
+
}
|
1848
|
+
|
1843
1849
|
protected createMediaList(mediaRules: SDK.CSSMedia.CSSMedia[]): void {
|
1844
1850
|
for (let i = mediaRules.length - 1; i >= 0; --i) {
|
1845
1851
|
const media = mediaRules[i];
|
@@ -1907,6 +1913,28 @@ export class StylePropertiesSection {
|
|
1907
1913
|
}
|
1908
1914
|
}
|
1909
1915
|
|
1916
|
+
protected createSupportsList(supportsList: SDK.CSSSupports.CSSSupports[]): void {
|
1917
|
+
for (let i = supportsList.length - 1; i >= 0; --i) {
|
1918
|
+
const supports = supportsList[i];
|
1919
|
+
if (!supports.text) {
|
1920
|
+
continue;
|
1921
|
+
}
|
1922
|
+
|
1923
|
+
let onQueryTextClick;
|
1924
|
+
if (supports.styleSheetId) {
|
1925
|
+
onQueryTextClick = this.handleQueryRuleClick.bind(this, supports);
|
1926
|
+
}
|
1927
|
+
|
1928
|
+
const supportsElement = new ElementsComponents.CSSQuery.CSSQuery();
|
1929
|
+
supportsElement.data = {
|
1930
|
+
queryPrefix: '@supports',
|
1931
|
+
queryText: supports.text,
|
1932
|
+
onQueryTextClick,
|
1933
|
+
};
|
1934
|
+
this.queryListElement.append(supportsElement);
|
1935
|
+
}
|
1936
|
+
}
|
1937
|
+
|
1910
1938
|
private async addContainerForContainerQuery(containerQuery: SDK.CSSContainerQuery.CSSContainerQuery): Promise<void> {
|
1911
1939
|
const container = await containerQuery.getContainerForNode(this.matchedStyles.node().id);
|
1912
1940
|
if (!container) {
|
@@ -1937,8 +1965,7 @@ export class StylePropertiesSection {
|
|
1937
1965
|
private updateQueryList(): void {
|
1938
1966
|
this.queryListElement.removeChildren();
|
1939
1967
|
if (this.styleInternal.parentRule && this.styleInternal.parentRule instanceof SDK.CSSRule.CSSStyleRule) {
|
1940
|
-
this.
|
1941
|
-
this.createContainerQueryList(this.styleInternal.parentRule.containerQueries);
|
1968
|
+
this.createAtRuleLists(this.styleInternal.parentRule);
|
1942
1969
|
}
|
1943
1970
|
}
|
1944
1971
|
|
@@ -2210,8 +2237,7 @@ export class StylePropertiesSection {
|
|
2210
2237
|
event.consume(true);
|
2211
2238
|
}
|
2212
2239
|
|
2213
|
-
private handleQueryRuleClick(query: SDK.
|
2214
|
-
void {
|
2240
|
+
private handleQueryRuleClick(query: SDK.CSSQuery.CSSQuery, event: Event): void {
|
2215
2241
|
const element = event.currentTarget as Element;
|
2216
2242
|
if (UI.UIUtils.isBeingEdited(element)) {
|
2217
2243
|
return;
|
@@ -2273,8 +2299,8 @@ export class StylePropertiesSection {
|
|
2273
2299
|
}
|
2274
2300
|
|
2275
2301
|
private editingMediaCommitted(
|
2276
|
-
query: SDK.
|
2277
|
-
|
2302
|
+
query: SDK.CSSQuery.CSSQuery, element: Element, newContent: string, _oldContent: string,
|
2303
|
+
_context: Context|undefined, _moveDirection: string): void {
|
2278
2304
|
this.parentPane.setEditingStyle(false);
|
2279
2305
|
this.editingMediaFinished(element);
|
2280
2306
|
|
@@ -2560,8 +2586,7 @@ export class BlankStylePropertiesSection extends StylePropertiesSection {
|
|
2560
2586
|
cssModel, this.parentPane.linkifier, styleSheetId, this.actualRuleLocation()));
|
2561
2587
|
if (insertAfterStyle && insertAfterStyle.parentRule &&
|
2562
2588
|
insertAfterStyle.parentRule instanceof SDK.CSSRule.CSSStyleRule) {
|
2563
|
-
this.
|
2564
|
-
this.createContainerQueryList(insertAfterStyle.parentRule.containerQueries);
|
2589
|
+
this.createAtRuleLists(insertAfterStyle.parentRule);
|
2565
2590
|
}
|
2566
2591
|
this.element.classList.add('blank-section');
|
2567
2592
|
}
|
@@ -188,6 +188,7 @@ function detectLineSeparator(text: string): CM.Extension {
|
|
188
188
|
|
189
189
|
const baseKeymap = CM.keymap.of([
|
190
190
|
{key: 'Tab', run: CM.acceptCompletion},
|
191
|
+
{key: 'End', run: CM.acceptCompletion},
|
191
192
|
{key: 'Ctrl-m', run: CM.cursorMatchingBracket, shift: CM.selectMatchingBracket},
|
192
193
|
{key: 'Mod-/', run: CM.toggleComment},
|
193
194
|
{key: 'Mod-d', run: CM.selectNextOccurrence},
|
package/package.json
CHANGED
@@ -39,6 +39,7 @@
|
|
39
39
|
"debug-unittest": "DEBUG_TEST=1 npm run unittest",
|
40
40
|
"e2etest": "third_party/node/node.py --output scripts/test/run_test_suite.js --config=test/e2e/test-runner-config.json",
|
41
41
|
"eslint-test": "third_party/node/node.py --output node_modules/mocha/bin/mocha \"./scripts/eslint_rules/tests/*_test.js\"",
|
42
|
+
"build-test": "third_party/node/node.py --output node_modules/mocha/bin/mocha \"./scripts/build/tests/*_test.js\"",
|
42
43
|
"generate-dark-mode-styles": "third_party/node/node.py --output scripts/dark_mode/generate_dark_theme_sheet.js",
|
43
44
|
"generate-protocol-resources": "scripts/deps/generate_protocol_resources.py && git cl format --js",
|
44
45
|
"install-deps": "scripts/deps/manage_node_deps.py",
|
@@ -53,5 +54,5 @@
|
|
53
54
|
"unittest": "scripts/test/run_unittests.py --no-text-coverage",
|
54
55
|
"watch": "third_party/node/node.py --output scripts/watch_build.js"
|
55
56
|
},
|
56
|
-
"version": "1.0.
|
57
|
+
"version": "1.0.967596"
|
57
58
|
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// Copyright 2022 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
|
+
const {assert} = require('chai');
|
6
|
+
const path = require('path');
|
7
|
+
|
8
|
+
const {devtoolsPlugin} = require('../devtools_plugin.js');
|
9
|
+
|
10
|
+
describe('devtools_plugin can compute paths with', () => {
|
11
|
+
it('same directory import', () => {
|
12
|
+
assert.deepEqual(
|
13
|
+
devtoolsPlugin('./AnotherFile.js', 'front_end/core/sdk/FirstFile.js'),
|
14
|
+
{id: path.join('front_end', 'core', 'sdk', 'AnotherFile.js'), external: false});
|
15
|
+
});
|
16
|
+
|
17
|
+
it('different directory import', () => {
|
18
|
+
assert.deepEqual(
|
19
|
+
devtoolsPlugin('../common/common.js', 'front_end/core/sdk/FirstFile.js'),
|
20
|
+
{id: path.join('front_end', 'core', 'common', 'common.js'), external: true});
|
21
|
+
});
|
22
|
+
|
23
|
+
it('node built-in modules', () => {
|
24
|
+
assert.deepEqual(devtoolsPlugin('fs', 'scripts/some-script.js'), {id: 'fs', external: true});
|
25
|
+
});
|
26
|
+
|
27
|
+
it('importing generated files', () => {
|
28
|
+
assert.strictEqual(devtoolsPlugin('../../generated/Protocol.js', 'front_end/core/sdk/FirstFile.js'), null);
|
29
|
+
});
|
30
|
+
});
|