worked on GarageApp stuff
This commit is contained in:
parent
60aaf17af3
commit
eb606572b0
51919 changed files with 2168177 additions and 18 deletions
36
node_modules/stylis/src/Serializer.js
generated
vendored
Normal file
36
node_modules/stylis/src/Serializer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'
|
||||
import {strlen, sizeof} from './Utility.js'
|
||||
|
||||
/**
|
||||
* @param {object[]} children
|
||||
* @param {function} callback
|
||||
* @return {string}
|
||||
*/
|
||||
export function serialize (children, callback) {
|
||||
var output = ''
|
||||
var length = sizeof(children)
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
output += callback(children[i], i, children, callback) || ''
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} element
|
||||
* @param {number} index
|
||||
* @param {object[]} children
|
||||
* @param {function} callback
|
||||
* @return {string}
|
||||
*/
|
||||
export function stringify (element, index, children, callback) {
|
||||
switch (element.type) {
|
||||
case LAYER: if (element.children.length) break
|
||||
case IMPORT: case DECLARATION: return element.return = element.return || element.value
|
||||
case COMMENT: return ''
|
||||
case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
|
||||
case RULESET: element.value = element.props.join(',')
|
||||
}
|
||||
|
||||
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue