mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-03 06:32:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
59
web/node_modules/jss/src/plugins/simpleRule.js
generated
vendored
Normal file
59
web/node_modules/jss/src/plugins/simpleRule.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
// @flow
|
||||
import type {
|
||||
CSSCharsetRule,
|
||||
CSSImportRule,
|
||||
CSSNamespaceRule,
|
||||
RuleOptions,
|
||||
JssStyle,
|
||||
ToCssOptions,
|
||||
BaseRule
|
||||
} from '../types'
|
||||
|
||||
export class SimpleRule implements BaseRule {
|
||||
type: string = 'simple'
|
||||
|
||||
key: string
|
||||
|
||||
value: string | Array<string>
|
||||
|
||||
options: RuleOptions
|
||||
|
||||
isProcessed: boolean = false
|
||||
|
||||
renderable: ?CSSCharsetRule | CSSImportRule | CSSNamespaceRule
|
||||
|
||||
constructor(key: string, value: string, options: RuleOptions) {
|
||||
this.key = key
|
||||
this.value = value
|
||||
this.options = options
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a CSS string.
|
||||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
toString(options?: ToCssOptions): string {
|
||||
if (Array.isArray(this.value)) {
|
||||
let str = ''
|
||||
for (let index = 0; index < this.value.length; index++) {
|
||||
str += `${this.key} ${this.value[index]};`
|
||||
if (this.value[index + 1]) str += '\n'
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
return `${this.key} ${this.value};`
|
||||
}
|
||||
}
|
||||
|
||||
const keysMap = {
|
||||
'@charset': true,
|
||||
'@import': true,
|
||||
'@namespace': true
|
||||
}
|
||||
|
||||
export default {
|
||||
onCreateRule(key: string, value: JssStyle, options: RuleOptions): SimpleRule | null {
|
||||
return key in keysMap ? new SimpleRule(key, value, options) : null
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue