diff options
Diffstat (limited to 'node_modules/css-tree/cjs/syntax/atrule')
| -rw-r--r-- | node_modules/css-tree/cjs/syntax/atrule/font-face.cjs | 12 | ||||
| -rw-r--r-- | node_modules/css-tree/cjs/syntax/atrule/import.cjs | 37 | ||||
| -rw-r--r-- | node_modules/css-tree/cjs/syntax/atrule/index.cjs | 19 | ||||
| -rw-r--r-- | node_modules/css-tree/cjs/syntax/atrule/media.cjs | 16 | ||||
| -rw-r--r-- | node_modules/css-tree/cjs/syntax/atrule/nest.cjs | 16 | ||||
| -rw-r--r-- | node_modules/css-tree/cjs/syntax/atrule/page.cjs | 16 | ||||
| -rw-r--r-- | node_modules/css-tree/cjs/syntax/atrule/supports.cjs | 77 |
7 files changed, 193 insertions, 0 deletions
diff --git a/node_modules/css-tree/cjs/syntax/atrule/font-face.cjs b/node_modules/css-tree/cjs/syntax/atrule/font-face.cjs new file mode 100644 index 00000000..fc7f64a6 --- /dev/null +++ b/node_modules/css-tree/cjs/syntax/atrule/font-face.cjs @@ -0,0 +1,12 @@ +'use strict'; + +const fontFace = { + parse: { + prelude: null, + block() { + return this.Block(true); + } + } +}; + +module.exports = fontFace; diff --git a/node_modules/css-tree/cjs/syntax/atrule/import.cjs b/node_modules/css-tree/cjs/syntax/atrule/import.cjs new file mode 100644 index 00000000..bb4402b4 --- /dev/null +++ b/node_modules/css-tree/cjs/syntax/atrule/import.cjs @@ -0,0 +1,37 @@ +'use strict'; + +const types = require('../../tokenizer/types.cjs'); + +const importAtrule = { + parse: { + prelude() { + const children = this.createList(); + + this.skipSC(); + + switch (this.tokenType) { + case types.String: + children.push(this.String()); + break; + + case types.Url: + case types.Function: + children.push(this.Url()); + break; + + default: + this.error('String or url() is expected'); + } + + if (this.lookupNonWSType(0) === types.Ident || + this.lookupNonWSType(0) === types.LeftParenthesis) { + children.push(this.MediaQueryList()); + } + + return children; + }, + block: null + } +}; + +module.exports = importAtrule; diff --git a/node_modules/css-tree/cjs/syntax/atrule/index.cjs b/node_modules/css-tree/cjs/syntax/atrule/index.cjs new file mode 100644 index 00000000..0cfe83d1 --- /dev/null +++ b/node_modules/css-tree/cjs/syntax/atrule/index.cjs @@ -0,0 +1,19 @@ +'use strict'; + +const fontFace = require('./font-face.cjs'); +const _import = require('./import.cjs'); +const media = require('./media.cjs'); +const nest = require('./nest.cjs'); +const page = require('./page.cjs'); +const supports = require('./supports.cjs'); + +const atrule = { + 'font-face': fontFace, + 'import': _import, + media, + nest, + page, + supports +}; + +module.exports = atrule; diff --git a/node_modules/css-tree/cjs/syntax/atrule/media.cjs b/node_modules/css-tree/cjs/syntax/atrule/media.cjs new file mode 100644 index 00000000..77214d1c --- /dev/null +++ b/node_modules/css-tree/cjs/syntax/atrule/media.cjs @@ -0,0 +1,16 @@ +'use strict'; + +const media = { + parse: { + prelude() { + return this.createSingleNodeList( + this.MediaQueryList() + ); + }, + block(isStyleBlock = false) { + return this.Block(isStyleBlock); + } + } +}; + +module.exports = media; diff --git a/node_modules/css-tree/cjs/syntax/atrule/nest.cjs b/node_modules/css-tree/cjs/syntax/atrule/nest.cjs new file mode 100644 index 00000000..5cd66720 --- /dev/null +++ b/node_modules/css-tree/cjs/syntax/atrule/nest.cjs @@ -0,0 +1,16 @@ +'use strict'; + +const nest = { + parse: { + prelude() { + return this.createSingleNodeList( + this.SelectorList() + ); + }, + block() { + return this.Block(true); + } + } +}; + +module.exports = nest; diff --git a/node_modules/css-tree/cjs/syntax/atrule/page.cjs b/node_modules/css-tree/cjs/syntax/atrule/page.cjs new file mode 100644 index 00000000..ffef0d17 --- /dev/null +++ b/node_modules/css-tree/cjs/syntax/atrule/page.cjs @@ -0,0 +1,16 @@ +'use strict'; + +const page = { + parse: { + prelude() { + return this.createSingleNodeList( + this.SelectorList() + ); + }, + block() { + return this.Block(true); + } + } +}; + +module.exports = page; diff --git a/node_modules/css-tree/cjs/syntax/atrule/supports.cjs b/node_modules/css-tree/cjs/syntax/atrule/supports.cjs new file mode 100644 index 00000000..bf30f034 --- /dev/null +++ b/node_modules/css-tree/cjs/syntax/atrule/supports.cjs @@ -0,0 +1,77 @@ +'use strict'; + +const types = require('../../tokenizer/types.cjs'); + +function consumeRaw() { + return this.createSingleNodeList( + this.Raw(this.tokenIndex, null, false) + ); +} + +function parentheses() { + this.skipSC(); + + if (this.tokenType === types.Ident && + this.lookupNonWSType(1) === types.Colon) { + return this.createSingleNodeList( + this.Declaration() + ); + } + + return readSequence.call(this); +} + +function readSequence() { + const children = this.createList(); + let child; + + this.skipSC(); + + scan: + while (!this.eof) { + switch (this.tokenType) { + case types.Comment: + case types.WhiteSpace: + this.next(); + continue; + + case types.Function: + child = this.Function(consumeRaw, this.scope.AtrulePrelude); + break; + + case types.Ident: + child = this.Identifier(); + break; + + case types.LeftParenthesis: + child = this.Parentheses(parentheses, this.scope.AtrulePrelude); + break; + + default: + break scan; + } + + children.push(child); + } + + return children; +} + +const supports = { + parse: { + prelude() { + const children = readSequence.call(this); + + if (this.getFirstListNode(children) === null) { + this.error('Condition is expected'); + } + + return children; + }, + block(isStyleBlock = false) { + return this.Block(isStyleBlock); + } + } +}; + +module.exports = supports; |
