@@ -9,16 +9,16 @@ import extendConfig from './utils/extend-config'
9
9
import { type PropertiesHyphen } from 'csstype'
10
10
import './types/global' // fix: ../css/src/core.ts:1205:16 - error TS7017: Element implicitly has an 'any' type because type 'typeof globalThis' has no index signature.
11
11
12
- type VariableCommon = {
12
+ interface VariableCommon {
13
13
usage ?: number ,
14
14
group ?: string ,
15
15
name : string ,
16
16
key : string ,
17
- modes ?: { [ mode : string ] : TypeVariable }
17
+ modes ?: Record < string , TypeVariable >
18
18
}
19
- export type StringVariable = { type : 'string' , value : string }
20
- export type NumberVariable = { type : 'number' , value : number }
21
- export type ColorVariable = { type : 'color' , value : string , space : 'rgb' | 'hsl' }
19
+ export interface StringVariable { type : 'string' , value : string }
20
+ export interface NumberVariable { type : 'number' , value : number }
21
+ export interface ColorVariable { type : 'color' , value : string , space : 'rgb' | 'hsl' }
22
22
export type TypeVariable = StringVariable | NumberVariable | ColorVariable
23
23
export type Variable = TypeVariable & VariableCommon
24
24
@@ -88,9 +88,9 @@ export default class MasterCSS {
88
88
}
89
89
90
90
if ( variables ) {
91
- const unexecutedAliasVariable : Record < string , { [ mode : string ] : ( ) => void } > = { }
91
+ const unexecutedAliasVariable : Record < string , Record < string , ( ) => void > > = { }
92
92
const resolveVariable = ( variableDefinition : VariableDefinition , name : string [ ] , mode ?: string ) => {
93
- if ( ! variableDefinition === undefined || variableDefinition === null ) return
93
+ if ( variableDefinition === undefined || variableDefinition === null ) return
94
94
const addVariable = (
95
95
name : string [ ] ,
96
96
variable : any ,
@@ -577,7 +577,7 @@ export default class MasterCSS {
577
577
for ( let index = 0 ; index < sheet . cssRules . length ; index ++ ) {
578
578
const eachCSSRule = sheet . cssRules [ index ]
579
579
if ( eachCSSRule === firstNative . cssRule ) {
580
- for ( let i = 0 ; i < rule . natives . length ; i ++ ) {
580
+ for ( const native of rule . natives ) {
581
581
sheet . deleteRule ( index )
582
582
}
583
583
break
@@ -1036,12 +1036,8 @@ export default class MasterCSS {
1036
1036
if ( sheet ) {
1037
1037
let cssRule : CSSRule | undefined
1038
1038
if ( initializing ) {
1039
- for ( let i = 0 ; i < sheet . cssRules . length ; i ++ ) {
1040
- const eachCSSRule = sheet . cssRules [ i ]
1041
- if (
1042
- eachCSSRule . constructor . name === 'CSSKeyframesRule'
1043
- && ( eachCSSRule as CSSKeyframesRule ) . name === eachKeyframeName
1044
- ) {
1039
+ for ( const eachCSSRule of sheet . cssRules ) {
1040
+ if ( eachCSSRule . constructor . name === 'CSSKeyframesRule' && ( eachCSSRule as CSSKeyframesRule ) . name === eachKeyframeName ) {
1045
1041
cssRule = eachCSSRule
1046
1042
break
1047
1043
}
@@ -1207,8 +1203,7 @@ export default class MasterCSS {
1207
1203
cssRule : variableCSSRule ,
1208
1204
get text ( ) {
1209
1205
const properties : string [ ] = [ ]
1210
- for ( let i = 0 ; i < variableCSSRule . style . length ; i ++ ) {
1211
- const property = variableCSSRule . style [ i ]
1206
+ for ( const property of variableCSSRule . style ) {
1212
1207
properties . push ( property + ':' + ( variableCSSRule as CSSStyleRule ) . style . getPropertyValue ( property ) )
1213
1208
}
1214
1209
return prefix + properties . join ( ';' ) + suffix
0 commit comments