Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea34e9e

Browse files
committed
chore: run fmt
1 parentd5d0fef commitea34e9e

File tree

6 files changed

+62
-29
lines changed

6 files changed

+62
-29
lines changed

‎panda.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ export default defineConfig({
2424
jsxFramework:"react",
2525
// importMap: "styled-system",
2626
hooks:{
27-
'parser:before':({ configure})=>{
27+
"parser:before":({ configure})=>{
2828
configure({
2929
// ignore the <Tooltip /> entirely,
3030
// prevents: `🐼 error [sheet:process] > 1 | .content_Hide_\`\*\,_\:before\,_\:after\`_styles {content: Hide `*, :before, :after` styles;`
31-
matchTag:tag=>tag!=='Tooltip',
32-
})
33-
}
34-
}
31+
matchTag:(tag)=>tag!=="Tooltip",
32+
});
33+
},
34+
},
3535
});

‎src/inspect-api.ts

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ export class InspectAPI {
588588
returncached;
589589
}
590590

591-
if(asserts.isCSSStyleRule(rule)||rule.type===rule.STYLE_RULE){
591+
if(asserts.isCSSStyleRule(rule)){
592592
constmatched:MatchedStyleRule={
593593
type:"style",
594594
source:this.getRuleSource(rule),
@@ -732,23 +732,38 @@ export class InspectAPI {
732732
*/
733733
privatefilterStyleDeclarations(rule:CSSStyleRule){
734734
conststyles={}asRecord<string,string>;
735-
for(constpropertyinrule.style){
736-
if(
737-
isNaN(propertyasany)&&
738-
(property.startsWith("--")
739-
?true
740-
:rule.style.hasOwnProperty(property)&&rule.style[property])
741-
){
742-
constimportant=rule.style.getPropertyPriority(property);
743-
styles[property]=
744-
rule.style[property]+(important ?" !"+important :"");
735+
736+
// Firefox needs a special treatment 🤷
737+
if(import.meta.env.FIREFOX){
738+
for(constpropertyofObject.keys(Object.getPrototypeOf(rule.style))){
739+
if(rule.style.getPropertyValue(property)!==""){
740+
constimportant=rule.style.getPropertyPriority(property);
741+
styles[property]=
742+
rule.style.getPropertyValue(property)+
743+
(important ?" !"+important :"");
744+
}
745+
}
746+
}else{
747+
for(constpropertyofrule.style){
748+
if(
749+
// This is chrome, property will be a CSS property name here
750+
isNaN(propertyasany)&&property.startsWith("--")
751+
?true
752+
:rule.style.hasOwnProperty(property)&&rule.style[property]
753+
){
754+
constimportant=rule.style.getPropertyPriority(property);
755+
styles[property]=
756+
rule.style.getPropertyValue(property)+
757+
(important ?" !"+important :"");
758+
}
745759
}
746760
}
747761

748762
// TODO empty css vars ?
749763
// if (Object.keys(styles).length === 0) {
750764
// console.log(rule);
751765
// }
766+
// console.log(rule, styles)
752767
returnstyles;
753768
}
754769
}

‎src/lib/rules.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,28 @@ export interface StyleRuleWithProp extends MatchedStyleRule {
8989
interfaceComputeStylesOptions{
9090
sortImplicitFirst?:boolean;
9191
filter?:string;
92-
hideResetStyles?:boolean
92+
hideResetStyles?:boolean;
9393
}
9494

95-
constresetSelectors=['*, ::after, ::before','*, :after, :before']
95+
constresetSelectors=["*, ::after, ::before","*, :after, :before"];
9696
constisMatchingSelector=(selector:string,patterns:string[])=>{
97-
constshortcut=patterns.includes(selector)
97+
constshortcut=patterns.includes(selector);
9898
if(shortcut)returntrue;
9999

100-
consttrimmedPatterns=patterns.map(p=>p.split(',').map(s=>s.trim()));
101-
constselectorTrimmedParts=selector.split(',').map(s=>s.trim());
100+
consttrimmedPatterns=patterns.map((p)=>
101+
p.split(",").map((s)=>s.trim()),
102+
);
103+
constselectorTrimmedParts=selector.split(",").map((s)=>s.trim());
102104

103-
if(trimmedPatterns.some(patternParts=>patternParts.every(part=>selectorTrimmedParts.includes(part))))returntrue;
105+
if(
106+
trimmedPatterns.some((patternParts)=>
107+
patternParts.every((part)=>selectorTrimmedParts.includes(part)),
108+
)
109+
)
110+
returntrue;
104111

105112
returnfalse;
106-
}
113+
};
107114

108115
/**
109116
* Computes the final applied styles for a set of CSS rules
@@ -138,7 +145,7 @@ export const computeStyles = (
138145
rules.forEach((rule)=>{
139146
if(rule.type!=="style")return;
140147
if(hideResetStyles&&isMatchingSelector(rule.selector,resetSelectors)){
141-
return
148+
return;
142149
}
143150

144151
Object.keys(rule.style).forEach((key)=>{
@@ -229,6 +236,7 @@ export const computeStyles = (
229236
});
230237

231238
// console.log({
239+
// insertOrder, order,
232240
// appliedRuleOrProp,
233241
// appliedStyles,
234242
// visibleStyles,

‎src/sidebar-pane.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export function SidebarPane() {
234234
{Array.from(computed.rulesByLayerInMedia.entries())
235235
.filter(([layer])=>availableLayers.includes(layer))
236236
.map(([layer,mediaMap])=>{
237-
constmediaKeys=Array.from((mediaMap).keys());
237+
constmediaKeys=Array.from(mediaMap.keys());
238238
return(
239239
<DeclarationGroup
240240
key={layer}

‎src/store.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ export const store = createStore(
6060
...ctx.env,
6161
});
6262

63-
constcomputed=computeStyles(rules,{filter:ctx.filter,hideResetStyles:ctx.hideResetStyles});
63+
constcomputed=computeStyles(rules,{
64+
filter:ctx.filter,
65+
hideResetStyles:ctx.hideResetStyles,
66+
});
6467
constavailableLayers=Array.from(computed.rulesByLayer.keys());
6568
constsortedAvailableLayers=ctx.inspected?.layersOrder.length
6669
?sortArrayByOrder(availableLayers,ctx.inspected?.layersOrder)
@@ -102,7 +105,10 @@ export const store = createStore(
102105
...ctx,
103106
env:event.env,
104107
rules,
105-
computed:computeStyles(rules,{filter:ctx.filter,hideResetStyles:ctx.hideResetStyles}),
108+
computed:computeStyles(rules,{
109+
filter:ctx.filter,
110+
hideResetStyles:ctx.hideResetStyles,
111+
}),
106112
};
107113
},
108114
},

‎src/toolbar.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,14 @@ export const Toolbar = (props: ToolbarProps) => {
139139
type:"setHideResetStyles",
140140
hideResetStyles:!hideResetStyles,
141141
});
142-
refresh()
142+
refresh();
143143
}}
144144
>
145-
{hideResetStyles ?<EyeOffIconclassName={toolbarIcon}/> :<EyeIconclassName={toolbarIcon}/>}
145+
{hideResetStyles ?(
146+
<EyeOffIconclassName={toolbarIcon}/>
147+
) :(
148+
<EyeIconclassName={toolbarIcon}/>
149+
)}
146150
</ToolbarButton>
147151
</Collapsible.Trigger>
148152
</Tooltip>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp