Skip to content

Commit 4cc1d67

Browse files
authored
Display matched selector priority (#10609)
* Display matched selector priority * Include priority as a separate property of `MatchedSelectorState` * fixed things
1 parent d6f9492 commit 4cc1d67

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

src/devtools/client/inspector/computed/actions/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export async function createComputedProperties(
108108
selectors.push({
109109
value: property.value,
110110
parsedValue,
111+
priority: property.priority,
111112
selector,
112113
stylesheet,
113114
stylesheetURL,

src/devtools/client/inspector/computed/components/MatchedSelector.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default function MatchedSelector(props: MatchedSelectorProps) {
3030
colorSpanClassName="computed-color"
3131
colorSwatchClassName="computed-colorswatch"
3232
fontFamilySpanClassName="computed-font-family"
33+
priority={selector.priority}
3334
values={selector.parsedValue}
3435
/>
3536
</div>

src/devtools/client/inspector/computed/state/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Priority } from "../../rules/models/text-property";
2+
13
export interface ComputedPropertyState {
24
name: string;
35
value: string;
@@ -9,6 +11,7 @@ export interface MatchedSelectorState {
911
selector: string;
1012
value: string;
1113
parsedValue: any[];
14+
priority: Priority;
1215
overridden: boolean;
1316
stylesheet: string;
1417
stylesheetURL: string;

src/devtools/client/inspector/rules/components/DeclarationValue.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from "react";
22

33
import { COLOR, FONT_FAMILY, URI } from "third-party/css/output-parser";
44

5+
import { Priority } from "../models/text-property";
56
import Color from "./value/Color";
67
import FontFamily from "./value/FontFamily";
78
import Url from "./value/Url";
@@ -10,12 +11,13 @@ interface DeclarationValueProps {
1011
colorSpanClassName: string;
1112
colorSwatchClassName: string;
1213
fontFamilySpanClassName: string;
14+
priority?: Priority;
1315
values: (string | Record<string, string>)[];
1416
}
1517

1618
class DeclarationValue extends React.PureComponent<DeclarationValueProps> {
1719
render() {
18-
return this.props.values.map(v => {
20+
const values = this.props.values.map(v => {
1921
if (typeof v === "string") {
2022
return v;
2123
}
@@ -46,6 +48,13 @@ class DeclarationValue extends React.PureComponent<DeclarationValueProps> {
4648

4749
return value;
4850
});
51+
52+
return (
53+
<>
54+
{values}
55+
{this.props.priority ? ` !${this.props.priority}` : null}
56+
</>
57+
);
4958
}
5059
}
5160

0 commit comments

Comments
 (0)