chrome-devtools-frontend 1.0.978673 → 1.0.980166
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/front_end/.eslintrc.js +1 -0
- package/front_end/core/common/Color.ts +95 -29
- package/front_end/core/common/ColorUtils.ts +18 -2
- package/front_end/core/common/Settings.ts +2 -0
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +21 -9
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +1 -0
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +2 -2
- package/front_end/entrypoints/formatter_worker/Substitute.ts +8 -3
- package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +7 -1
- package/front_end/models/formatter/FormatterWorkerPool.ts +11 -3
- package/front_end/models/persistence/PersistenceUtils.ts +1 -2
- package/front_end/panels/console/ConsolePrompt.ts +8 -6
- package/front_end/panels/elements/StylesSidebarPane.ts +7 -11
- package/front_end/panels/elements/components/computedStyleProperty.css +1 -0
- package/front_end/panels/elements/components/computedStyleTrace.css +1 -0
- package/front_end/panels/media/playerMessagesView.css +0 -7
- package/front_end/panels/sources/components/HeadersView.css +3 -6
- package/front_end/panels/webauthn/webauthnPane.css +6 -2
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/README.md +11 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js +8 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js +13 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js +0 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js +9 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.js +13 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js +0 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/package.json +14 -7
- package/front_end/ui/components/text_editor/config.ts +1 -0
- package/front_end/ui/legacy/InspectorView.ts +1 -1
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +23 -9
- package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +5 -0
- package/front_end/ui/legacy/inspectorCommon.css +9 -0
- package/inspector_overlay/highlight_common.ts +10 -3
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/no_importing_images_from_src.js +61 -0
- package/scripts/eslint_rules/tests/no_importing_images_from_src_test.js +40 -0
@@ -224,7 +224,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
224
224
|
this.alphaElementBackground = this.alphaElement.createChild('div', 'spectrum-alpha-background');
|
225
225
|
this.alphaSlider = this.alphaElement.createChild('div', 'spectrum-slider');
|
226
226
|
|
227
|
-
// RGBA/HSLA display.
|
227
|
+
// RGBA/HSLA/HWBA display.
|
228
228
|
this.displayContainer = toolsContainer.createChild('div', 'spectrum-text source-code');
|
229
229
|
UI.ARIAUtils.markAsPoliteLiveRegion(this.displayContainer, true);
|
230
230
|
this.textValues = [];
|
@@ -937,6 +937,8 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
937
937
|
colorFormat = cf.RGB;
|
938
938
|
} else if (colorFormat === cf.HSLA) {
|
939
939
|
colorFormat = cf.HSL;
|
940
|
+
} else if (colorFormat === cf.HWBA) {
|
941
|
+
colorFormat = cf.HWB;
|
940
942
|
} else if (colorFormat === cf.HEXA) {
|
941
943
|
colorFormat = cf.HEX;
|
942
944
|
} else if (colorFormat === cf.ShortHEXA) {
|
@@ -988,6 +990,8 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
988
990
|
colorString = color.asString(cf.HEXA);
|
989
991
|
} else if (this.colorFormat === cf.HSL) {
|
990
992
|
colorString = color.asString(cf.HSLA);
|
993
|
+
} else if (this.colorFormat === cf.HWB) {
|
994
|
+
colorString = color.asString(cf.HWBA);
|
991
995
|
} else {
|
992
996
|
colorString = color.asString(cf.RGBA);
|
993
997
|
}
|
@@ -1033,12 +1037,21 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1033
1037
|
this.hexValue.value = String(this.color().asString(this.color().hasAlpha() ? cf.HEXA : cf.HEX));
|
1034
1038
|
}
|
1035
1039
|
} else {
|
1036
|
-
// RGBA, HSLA display.
|
1040
|
+
// RGBA, HSLA, HWBA display.
|
1037
1041
|
this.hexContainer.hidden = true;
|
1038
1042
|
this.displayContainer.hidden = false;
|
1039
|
-
|
1040
|
-
this.
|
1041
|
-
|
1043
|
+
let colorValues;
|
1044
|
+
if (this.colorFormat === cf.RGB) {
|
1045
|
+
this.textLabels.textContent = 'RGBA';
|
1046
|
+
colorValues = this.color().canonicalRGBA();
|
1047
|
+
} else if (this.colorFormat === cf.HSL) {
|
1048
|
+
this.textLabels.textContent = 'HSLA';
|
1049
|
+
colorValues = this.color().canonicalHSLA();
|
1050
|
+
} else {
|
1051
|
+
this.textLabels.textContent = 'HWBA';
|
1052
|
+
colorValues = this.color().canonicalHWBA();
|
1053
|
+
}
|
1054
|
+
|
1042
1055
|
for (let i = 0; i < 3; ++i) {
|
1043
1056
|
UI.ARIAUtils.setAccessibleName(
|
1044
1057
|
this.textValues[i],
|
@@ -1047,7 +1060,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1047
1060
|
PH2: this.textLabels.textContent,
|
1048
1061
|
}));
|
1049
1062
|
this.textValues[i].value = String(colorValues[i]);
|
1050
|
-
if (
|
1063
|
+
if (this.colorFormat !== cf.RGB && (i === 1 || i === 2)) {
|
1051
1064
|
this.textValues[i].value += '%';
|
1052
1065
|
}
|
1053
1066
|
}
|
@@ -1081,6 +1094,8 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1081
1094
|
if (this.colorFormat === cf.RGB) {
|
1082
1095
|
format = cf.HSL;
|
1083
1096
|
} else if (this.colorFormat === cf.HSL) {
|
1097
|
+
format = cf.HWB;
|
1098
|
+
} else if (this.colorFormat === cf.HWB) {
|
1084
1099
|
format = (this.originalFormat === cf.ShortHEX || this.originalFormat === cf.ShortHEXA) ? cf.ShortHEX : cf.HEX;
|
1085
1100
|
}
|
1086
1101
|
this.innerSetColor(undefined, '', undefined /* colorName */, format, ChangeSource.Other);
|
@@ -1121,10 +1136,9 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
1121
1136
|
if (this.colorFormat === cf.Nickname || this.colorFormat === cf.HEX || this.colorFormat === cf.ShortHEX) {
|
1122
1137
|
colorString = this.hexValue.value;
|
1123
1138
|
} else {
|
1124
|
-
const format = this.colorFormat === cf.RGB ? 'rgb' : 'hsl';
|
1125
1139
|
const values = this.textValues.slice(0, -1).map(elementValue).join(' ');
|
1126
1140
|
const alpha = this.textValues.slice(-1).map(elementValue).join(' ');
|
1127
|
-
colorString = Platform.StringUtilities.sprintf('%s(%s)',
|
1141
|
+
colorString = Platform.StringUtilities.sprintf('%s(%s)', this.colorFormat, [values, alpha].join(' / '));
|
1128
1142
|
}
|
1129
1143
|
|
1130
1144
|
const color = Common.Color.Color.parse(colorString);
|
@@ -1291,7 +1305,7 @@ export class PaletteGenerator {
|
|
1291
1305
|
private async processStylesheet(stylesheet: SDK.CSSStyleSheetHeader.CSSStyleSheetHeader): Promise<void> {
|
1292
1306
|
let text: string = (await stylesheet.requestContent()).content || '';
|
1293
1307
|
text = text.toLowerCase();
|
1294
|
-
const regexResult = text.match(/((?:rgb|hsl)a?\([^)]+\)|#[0-9a-f]{6}|#[0-9a-f]{3})/g) || [];
|
1308
|
+
const regexResult = text.match(/((?:rgb|hsl|hwb)a?\([^)]+\)|#[0-9a-f]{6}|#[0-9a-f]{3})/g) || [];
|
1295
1309
|
for (const c of regexResult) {
|
1296
1310
|
let frequency = this.frequencyMap.get(c) || 0;
|
1297
1311
|
this.frequencyMap.set(c, ++frequency);
|
@@ -180,6 +180,7 @@ function nextColorFormat(color: Common.Color.Color, curFormat: string): string {
|
|
180
180
|
// * original
|
181
181
|
// * rgb(a)
|
182
182
|
// * hsl(a)
|
183
|
+
// * hwb(a)
|
183
184
|
// * nickname (if the color has a nickname)
|
184
185
|
// * shorthex (if has short hex)
|
185
186
|
// * hex
|
@@ -195,6 +196,10 @@ function nextColorFormat(color: Common.Color.Color, curFormat: string): string {
|
|
195
196
|
|
196
197
|
case cf.HSL:
|
197
198
|
case cf.HSLA:
|
199
|
+
return !color.hasAlpha() ? cf.HWB : cf.HWBA;
|
200
|
+
|
201
|
+
case cf.HWB:
|
202
|
+
case cf.HWBA:
|
198
203
|
if (color.nickname()) {
|
199
204
|
return cf.Nickname;
|
200
205
|
}
|
@@ -550,6 +550,15 @@ span[is="dt-icon-label"] {
|
|
550
550
|
background: var(--override-force-white-icons-background) !important; /* stylelint-disable-line declaration-no-important */
|
551
551
|
}
|
552
552
|
|
553
|
+
.mediumicon-file-sync.purple-dot {
|
554
|
+
filter: hue-rotate(160deg);
|
555
|
+
}
|
556
|
+
|
557
|
+
.-theme-with-dark-background [is="ui-icon"].icon-invert.mediumicon-file-sync.purple-dot,
|
558
|
+
:host-context(.-theme-with-dark-background) [is="ui-icon"].icon-invert.mediumicon-file-sync.purple-dot {
|
559
|
+
filter: invert(80%) hue-rotate(350deg);
|
560
|
+
}
|
561
|
+
|
553
562
|
.expandable-inline-button {
|
554
563
|
background-color: var(--color-background-elevation-2);
|
555
564
|
color: var(--color-text-primary);
|
@@ -28,7 +28,7 @@
|
|
28
28
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
29
29
|
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
30
|
|
31
|
-
import {rgbaToHsla} from '../front_end/core/common/ColorUtils.js'; // eslint-disable-line rulesdir/es_modules_import
|
31
|
+
import {rgbaToHsla, rgbaToHwba} from '../front_end/core/common/ColorUtils.js'; // eslint-disable-line rulesdir/es_modules_import
|
32
32
|
|
33
33
|
import type {Bounds, PathCommands, Quad} from './common.js';
|
34
34
|
|
@@ -258,7 +258,7 @@ export function parseHexa(hexa: string): Array<number> {
|
|
258
258
|
return (hexa.match(/#(\w\w)(\w\w)(\w\w)(\w\w)/) || []).slice(1).map(c => parseInt(c, 16) / 255);
|
259
259
|
}
|
260
260
|
|
261
|
-
export function formatRgba(rgba: number[], colorFormat: 'rgb'|'hsl'): string {
|
261
|
+
export function formatRgba(rgba: number[], colorFormat: 'rgb'|'hsl'|'hwb'): string {
|
262
262
|
if (colorFormat === 'rgb') {
|
263
263
|
const [r, g, b, a] = rgba;
|
264
264
|
// rgb(r g b [ / a])
|
@@ -273,11 +273,18 @@ export function formatRgba(rgba: number[], colorFormat: 'rgb'|'hsl'): string {
|
|
273
273
|
a === 1 ? '' : ' / ' + Math.round(a * 100) / 100})`;
|
274
274
|
}
|
275
275
|
|
276
|
+
if (colorFormat === 'hwb') {
|
277
|
+
const [h, w, b, a] = rgbaToHwba(rgba);
|
278
|
+
// hwb(hdeg w b [ / a])
|
279
|
+
return `hwb(${Math.round(h * 360)}deg ${Math.round(w * 100)} ${Math.round(b * 100)}${
|
280
|
+
a === 1 ? '' : ' / ' + Math.round(a * 100) / 100})`;
|
281
|
+
}
|
282
|
+
|
276
283
|
throw new Error('NOT_REACHED');
|
277
284
|
}
|
278
285
|
|
279
286
|
export function formatColor(hexa: string, colorFormat: string): string {
|
280
|
-
if (colorFormat === 'rgb' || colorFormat === 'hsl') {
|
287
|
+
if (colorFormat === 'rgb' || colorFormat === 'hsl' || colorFormat === 'hwb') {
|
281
288
|
return formatRgba(parseHexa(hexa), colorFormat);
|
282
289
|
}
|
283
290
|
|
package/package.json
CHANGED
@@ -0,0 +1,61 @@
|
|
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
|
+
'use strict';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @fileoverview Prevent importing SVG urls from the `src` directory, and
|
8
|
+
* ensure they are read from `Images/foo.svg`.
|
9
|
+
* Images in the `src/` directory are minified and put into `Images/` as part
|
10
|
+
* of the build process, so we should never import from 'src'.
|
11
|
+
*/
|
12
|
+
|
13
|
+
// ------------------------------------------------------------------------------
|
14
|
+
// Rule Definition
|
15
|
+
// ------------------------------------------------------------------------------
|
16
|
+
|
17
|
+
const SRC_DIRECTORY_PATH_TO_MATCH = 'Images/src/';
|
18
|
+
|
19
|
+
module.exports = {
|
20
|
+
meta: {
|
21
|
+
type: 'problem',
|
22
|
+
|
23
|
+
docs: {
|
24
|
+
description: 'ensure image imports do not include the src/ directory',
|
25
|
+
category: 'Possible Errors',
|
26
|
+
},
|
27
|
+
fixable: 'code',
|
28
|
+
schema: [],
|
29
|
+
messages: {
|
30
|
+
imageImportUsingSrc:
|
31
|
+
'Found an image import containing the `src/` directory. You should always import `Images/foo.svg`.',
|
32
|
+
},
|
33
|
+
},
|
34
|
+
create: function(context) {
|
35
|
+
return {
|
36
|
+
// Matches new URL(...)
|
37
|
+
'NewExpression[callee.name=\'URL\']'(node) {
|
38
|
+
if (!node.arguments || node.arguments.length < 1) {
|
39
|
+
// Invalid code: user is probably mid-way through typing! Just leave
|
40
|
+
// it; TypeScript will error if it ends up being invalid.
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
/** @type {String} */
|
44
|
+
const filePath = node.arguments[0].value;
|
45
|
+
if (!filePath) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
if (filePath.includes(SRC_DIRECTORY_PATH_TO_MATCH)) {
|
49
|
+
context.report({
|
50
|
+
node: node.arguments[0],
|
51
|
+
messageId: 'imageImportUsingSrc',
|
52
|
+
fix(fixer) {
|
53
|
+
return fixer.replaceText(
|
54
|
+
node.arguments[0], `'${filePath.replace(SRC_DIRECTORY_PATH_TO_MATCH, 'Images/')}'`);
|
55
|
+
}
|
56
|
+
});
|
57
|
+
}
|
58
|
+
}
|
59
|
+
};
|
60
|
+
}
|
61
|
+
};
|
@@ -0,0 +1,40 @@
|
|
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
|
+
'use strict';
|
5
|
+
|
6
|
+
const rule = require('../lib/no_importing_images_from_src.js');
|
7
|
+
const ruleTester = new (require('eslint').RuleTester)({
|
8
|
+
parser: require.resolve('@typescript-eslint/parser'),
|
9
|
+
parserOptions: {ecmaVersion: 9, sourceType: 'module'},
|
10
|
+
});
|
11
|
+
|
12
|
+
ruleTester.run('no_importing_images_from_src', rule, {
|
13
|
+
valid: [
|
14
|
+
{
|
15
|
+
code: 'const someIcon = new URL(\'../../../Images/test_icon.svg\', import.meta.url).toString()',
|
16
|
+
filename: 'front_end/ui/components/component/file.ts',
|
17
|
+
},
|
18
|
+
],
|
19
|
+
|
20
|
+
invalid: [
|
21
|
+
{
|
22
|
+
code: 'const someIcon = new URL(\'../../../Images/src/test_icon.svg\', import.meta.url).toString()',
|
23
|
+
filename: 'front_end/ui/components/component/file.ts',
|
24
|
+
output: 'const someIcon = new URL(\'../../../Images/test_icon.svg\', import.meta.url).toString()',
|
25
|
+
errors: [{
|
26
|
+
messageId: 'imageImportUsingSrc',
|
27
|
+
}],
|
28
|
+
},
|
29
|
+
{
|
30
|
+
code:
|
31
|
+
'const someIcon = new URL(\'../../../devtools-frontend/front_end/Images/src/test_icon.svg\', import.meta.url).toString()',
|
32
|
+
filename: 'front_end/ui/components/component/file.ts',
|
33
|
+
output:
|
34
|
+
'const someIcon = new URL(\'../../../devtools-frontend/front_end/Images/test_icon.svg\', import.meta.url).toString()',
|
35
|
+
errors: [{
|
36
|
+
messageId: 'imageImportUsingSrc',
|
37
|
+
}],
|
38
|
+
},
|
39
|
+
],
|
40
|
+
});
|