first commit

This commit is contained in:
monjack
2025-06-20 18:01:48 +08:00
commit 6daa6d65c1
24611 changed files with 2512443 additions and 0 deletions

View File

@ -0,0 +1,297 @@
var cmpChar = require('../../tokenizer').cmpChar;
var isDigit = require('../../tokenizer').isDigit;
var TYPE = require('../../tokenizer').TYPE;
var WHITESPACE = TYPE.WhiteSpace;
var COMMENT = TYPE.Comment;
var IDENT = TYPE.Ident;
var NUMBER = TYPE.Number;
var DIMENSION = TYPE.Dimension;
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
var N = 0x006E; // U+006E LATIN SMALL LETTER N (n)
var DISALLOW_SIGN = true;
var ALLOW_SIGN = false;
function checkInteger(offset, disallowSign) {
var pos = this.scanner.tokenStart + offset;
var code = this.scanner.source.charCodeAt(pos);
if (code === PLUSSIGN || code === HYPHENMINUS) {
if (disallowSign) {
this.error('Number sign is not allowed');
}
pos++;
}
for (; pos < this.scanner.tokenEnd; pos++) {
if (!isDigit(this.scanner.source.charCodeAt(pos))) {
this.error('Integer is expected', pos);
}
}
}
function checkTokenIsInteger(disallowSign) {
return checkInteger.call(this, 0, disallowSign);
}
function expectCharCode(offset, code) {
if (!cmpChar(this.scanner.source, this.scanner.tokenStart + offset, code)) {
var msg = '';
switch (code) {
case N:
msg = 'N is expected';
break;
case HYPHENMINUS:
msg = 'HyphenMinus is expected';
break;
}
this.error(msg, this.scanner.tokenStart + offset);
}
}
// ... <signed-integer>
// ... ['+' | '-'] <signless-integer>
function consumeB() {
var offset = 0;
var sign = 0;
var type = this.scanner.tokenType;
while (type === WHITESPACE || type === COMMENT) {
type = this.scanner.lookupType(++offset);
}
if (type !== NUMBER) {
if (this.scanner.isDelim(PLUSSIGN, offset) ||
this.scanner.isDelim(HYPHENMINUS, offset)) {
sign = this.scanner.isDelim(PLUSSIGN, offset) ? PLUSSIGN : HYPHENMINUS;
do {
type = this.scanner.lookupType(++offset);
} while (type === WHITESPACE || type === COMMENT);
if (type !== NUMBER) {
this.scanner.skip(offset);
checkTokenIsInteger.call(this, DISALLOW_SIGN);
}
} else {
return null;
}
}
if (offset > 0) {
this.scanner.skip(offset);
}
if (sign === 0) {
type = this.scanner.source.charCodeAt(this.scanner.tokenStart);
if (type !== PLUSSIGN && type !== HYPHENMINUS) {
this.error('Number sign is expected');
}
}
checkTokenIsInteger.call(this, sign !== 0);
return sign === HYPHENMINUS ? '-' + this.consume(NUMBER) : this.consume(NUMBER);
}
// An+B microsyntax https://www.w3.org/TR/css-syntax-3/#anb
module.exports = {
name: 'AnPlusB',
structure: {
a: [String, null],
b: [String, null]
},
parse: function() {
/* eslint-disable brace-style*/
var start = this.scanner.tokenStart;
var a = null;
var b = null;
// <integer>
if (this.scanner.tokenType === NUMBER) {
checkTokenIsInteger.call(this, ALLOW_SIGN);
b = this.consume(NUMBER);
}
// -n
// -n <signed-integer>
// -n ['+' | '-'] <signless-integer>
// -n- <signless-integer>
// <dashndashdigit-ident>
else if (this.scanner.tokenType === IDENT && cmpChar(this.scanner.source, this.scanner.tokenStart, HYPHENMINUS)) {
a = '-1';
expectCharCode.call(this, 1, N);
switch (this.scanner.getTokenLength()) {
// -n
// -n <signed-integer>
// -n ['+' | '-'] <signless-integer>
case 2:
this.scanner.next();
b = consumeB.call(this);
break;
// -n- <signless-integer>
case 3:
expectCharCode.call(this, 2, HYPHENMINUS);
this.scanner.next();
this.scanner.skipSC();
checkTokenIsInteger.call(this, DISALLOW_SIGN);
b = '-' + this.consume(NUMBER);
break;
// <dashndashdigit-ident>
default:
expectCharCode.call(this, 2, HYPHENMINUS);
checkInteger.call(this, 3, DISALLOW_SIGN);
this.scanner.next();
b = this.scanner.substrToCursor(start + 2);
}
}
// '+'? n
// '+'? n <signed-integer>
// '+'? n ['+' | '-'] <signless-integer>
// '+'? n- <signless-integer>
// '+'? <ndashdigit-ident>
else if (this.scanner.tokenType === IDENT || (this.scanner.isDelim(PLUSSIGN) && this.scanner.lookupType(1) === IDENT)) {
var sign = 0;
a = '1';
// just ignore a plus
if (this.scanner.isDelim(PLUSSIGN)) {
sign = 1;
this.scanner.next();
}
expectCharCode.call(this, 0, N);
switch (this.scanner.getTokenLength()) {
// '+'? n
// '+'? n <signed-integer>
// '+'? n ['+' | '-'] <signless-integer>
case 1:
this.scanner.next();
b = consumeB.call(this);
break;
// '+'? n- <signless-integer>
case 2:
expectCharCode.call(this, 1, HYPHENMINUS);
this.scanner.next();
this.scanner.skipSC();
checkTokenIsInteger.call(this, DISALLOW_SIGN);
b = '-' + this.consume(NUMBER);
break;
// '+'? <ndashdigit-ident>
default:
expectCharCode.call(this, 1, HYPHENMINUS);
checkInteger.call(this, 2, DISALLOW_SIGN);
this.scanner.next();
b = this.scanner.substrToCursor(start + sign + 1);
}
}
// <ndashdigit-dimension>
// <ndash-dimension> <signless-integer>
// <n-dimension>
// <n-dimension> <signed-integer>
// <n-dimension> ['+' | '-'] <signless-integer>
else if (this.scanner.tokenType === DIMENSION) {
var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
var sign = code === PLUSSIGN || code === HYPHENMINUS;
for (var i = this.scanner.tokenStart + sign; i < this.scanner.tokenEnd; i++) {
if (!isDigit(this.scanner.source.charCodeAt(i))) {
break;
}
}
if (i === this.scanner.tokenStart + sign) {
this.error('Integer is expected', this.scanner.tokenStart + sign);
}
expectCharCode.call(this, i - this.scanner.tokenStart, N);
a = this.scanner.source.substring(start, i);
// <n-dimension>
// <n-dimension> <signed-integer>
// <n-dimension> ['+' | '-'] <signless-integer>
if (i + 1 === this.scanner.tokenEnd) {
this.scanner.next();
b = consumeB.call(this);
} else {
expectCharCode.call(this, i - this.scanner.tokenStart + 1, HYPHENMINUS);
// <ndash-dimension> <signless-integer>
if (i + 2 === this.scanner.tokenEnd) {
this.scanner.next();
this.scanner.skipSC();
checkTokenIsInteger.call(this, DISALLOW_SIGN);
b = '-' + this.consume(NUMBER);
}
// <ndashdigit-dimension>
else {
checkInteger.call(this, i - this.scanner.tokenStart + 2, DISALLOW_SIGN);
this.scanner.next();
b = this.scanner.substrToCursor(i + 1);
}
}
} else {
this.error();
}
if (a !== null && a.charCodeAt(0) === PLUSSIGN) {
a = a.substr(1);
}
if (b !== null && b.charCodeAt(0) === PLUSSIGN) {
b = b.substr(1);
}
return {
type: 'AnPlusB',
loc: this.getLocation(start, this.scanner.tokenStart),
a: a,
b: b
};
},
generate: function(node) {
var a = node.a !== null && node.a !== undefined;
var b = node.b !== null && node.b !== undefined;
if (a) {
this.chunk(
node.a === '+1' ? '+n' : // eslint-disable-line operator-linebreak, indent
node.a === '1' ? 'n' : // eslint-disable-line operator-linebreak, indent
node.a === '-1' ? '-n' : // eslint-disable-line operator-linebreak, indent
node.a + 'n' // eslint-disable-line operator-linebreak, indent
);
if (b) {
b = String(node.b);
if (b.charAt(0) === '-' || b.charAt(0) === '+') {
this.chunk(b.charAt(0));
this.chunk(b.substr(1));
} else {
this.chunk('+');
this.chunk(b);
}
}
} else {
this.chunk(String(node.b));
}
}
};

107
app_vue/node_modules/css-tree/lib/syntax/node/Atrule.js generated vendored Normal file
View File

@ -0,0 +1,107 @@
var TYPE = require('../../tokenizer').TYPE;
var rawMode = require('./Raw').mode;
var ATKEYWORD = TYPE.AtKeyword;
var SEMICOLON = TYPE.Semicolon;
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
var RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;
function consumeRaw(startToken) {
return this.Raw(startToken, rawMode.leftCurlyBracketOrSemicolon, true);
}
function isDeclarationBlockAtrule() {
for (var offset = 1, type; type = this.scanner.lookupType(offset); offset++) {
if (type === RIGHTCURLYBRACKET) {
return true;
}
if (type === LEFTCURLYBRACKET ||
type === ATKEYWORD) {
return false;
}
}
return false;
}
module.exports = {
name: 'Atrule',
structure: {
name: String,
prelude: ['AtrulePrelude', 'Raw', null],
block: ['Block', null]
},
parse: function() {
var start = this.scanner.tokenStart;
var name;
var nameLowerCase;
var prelude = null;
var block = null;
this.eat(ATKEYWORD);
name = this.scanner.substrToCursor(start + 1);
nameLowerCase = name.toLowerCase();
this.scanner.skipSC();
// parse prelude
if (this.scanner.eof === false &&
this.scanner.tokenType !== LEFTCURLYBRACKET &&
this.scanner.tokenType !== SEMICOLON) {
if (this.parseAtrulePrelude) {
prelude = this.parseWithFallback(this.AtrulePrelude.bind(this, name), consumeRaw);
// turn empty AtrulePrelude into null
if (prelude.type === 'AtrulePrelude' && prelude.children.head === null) {
prelude = null;
}
} else {
prelude = consumeRaw.call(this, this.scanner.tokenIndex);
}
this.scanner.skipSC();
}
switch (this.scanner.tokenType) {
case SEMICOLON:
this.scanner.next();
break;
case LEFTCURLYBRACKET:
if (this.atrule.hasOwnProperty(nameLowerCase) &&
typeof this.atrule[nameLowerCase].block === 'function') {
block = this.atrule[nameLowerCase].block.call(this);
} else {
// TODO: should consume block content as Raw?
block = this.Block(isDeclarationBlockAtrule.call(this));
}
break;
}
return {
type: 'Atrule',
loc: this.getLocation(start, this.scanner.tokenStart),
name: name,
prelude: prelude,
block: block
};
},
generate: function(node) {
this.chunk('@');
this.chunk(node.name);
if (node.prelude !== null) {
this.chunk(' ');
this.node(node.prelude);
}
if (node.block) {
this.node(node.block);
} else {
this.chunk(';');
}
},
walkContext: 'atrule'
};

View File

@ -0,0 +1,51 @@
var TYPE = require('../../tokenizer').TYPE;
var SEMICOLON = TYPE.Semicolon;
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
module.exports = {
name: 'AtrulePrelude',
structure: {
children: [[]]
},
parse: function(name) {
var children = null;
if (name !== null) {
name = name.toLowerCase();
}
this.scanner.skipSC();
if (this.atrule.hasOwnProperty(name) &&
typeof this.atrule[name].prelude === 'function') {
// custom consumer
children = this.atrule[name].prelude.call(this);
} else {
// default consumer
children = this.readSequence(this.scope.AtrulePrelude);
}
this.scanner.skipSC();
if (this.scanner.eof !== true &&
this.scanner.tokenType !== LEFTCURLYBRACKET &&
this.scanner.tokenType !== SEMICOLON) {
this.error('Semicolon or block is expected');
}
if (children === null) {
children = this.createList();
}
return {
type: 'AtrulePrelude',
loc: this.getLocationFromList(children),
children: children
};
},
generate: function(node) {
this.children(node);
},
walkContext: 'atrulePrelude'
};

View File

@ -0,0 +1,165 @@
var TYPE = require('../../tokenizer').TYPE;
var IDENT = TYPE.Ident;
var STRING = TYPE.String;
var COLON = TYPE.Colon;
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
var RIGHTSQUAREBRACKET = TYPE.RightSquareBracket;
var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
var ASTERISK = 0x002A; // U+002A ASTERISK (*)
var EQUALSSIGN = 0x003D; // U+003D EQUALS SIGN (=)
var CIRCUMFLEXACCENT = 0x005E; // U+005E (^)
var VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
var TILDE = 0x007E; // U+007E TILDE (~)
function getAttributeName() {
if (this.scanner.eof) {
this.error('Unexpected end of input');
}
var start = this.scanner.tokenStart;
var expectIdent = false;
var checkColon = true;
if (this.scanner.isDelim(ASTERISK)) {
expectIdent = true;
checkColon = false;
this.scanner.next();
} else if (!this.scanner.isDelim(VERTICALLINE)) {
this.eat(IDENT);
}
if (this.scanner.isDelim(VERTICALLINE)) {
if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 1) !== EQUALSSIGN) {
this.scanner.next();
this.eat(IDENT);
} else if (expectIdent) {
this.error('Identifier is expected', this.scanner.tokenEnd);
}
} else if (expectIdent) {
this.error('Vertical line is expected');
}
if (checkColon && this.scanner.tokenType === COLON) {
this.scanner.next();
this.eat(IDENT);
}
return {
type: 'Identifier',
loc: this.getLocation(start, this.scanner.tokenStart),
name: this.scanner.substrToCursor(start)
};
}
function getOperator() {
var start = this.scanner.tokenStart;
var code = this.scanner.source.charCodeAt(start);
if (code !== EQUALSSIGN && // =
code !== TILDE && // ~=
code !== CIRCUMFLEXACCENT && // ^=
code !== DOLLARSIGN && // $=
code !== ASTERISK && // *=
code !== VERTICALLINE // |=
) {
this.error('Attribute selector (=, ~=, ^=, $=, *=, |=) is expected');
}
this.scanner.next();
if (code !== EQUALSSIGN) {
if (!this.scanner.isDelim(EQUALSSIGN)) {
this.error('Equal sign is expected');
}
this.scanner.next();
}
return this.scanner.substrToCursor(start);
}
// '[' <wq-name> ']'
// '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'
module.exports = {
name: 'AttributeSelector',
structure: {
name: 'Identifier',
matcher: [String, null],
value: ['String', 'Identifier', null],
flags: [String, null]
},
parse: function() {
var start = this.scanner.tokenStart;
var name;
var matcher = null;
var value = null;
var flags = null;
this.eat(LEFTSQUAREBRACKET);
this.scanner.skipSC();
name = getAttributeName.call(this);
this.scanner.skipSC();
if (this.scanner.tokenType !== RIGHTSQUAREBRACKET) {
// avoid case `[name i]`
if (this.scanner.tokenType !== IDENT) {
matcher = getOperator.call(this);
this.scanner.skipSC();
value = this.scanner.tokenType === STRING
? this.String()
: this.Identifier();
this.scanner.skipSC();
}
// attribute flags
if (this.scanner.tokenType === IDENT) {
flags = this.scanner.getTokenValue();
this.scanner.next();
this.scanner.skipSC();
}
}
this.eat(RIGHTSQUAREBRACKET);
return {
type: 'AttributeSelector',
loc: this.getLocation(start, this.scanner.tokenStart),
name: name,
matcher: matcher,
value: value,
flags: flags
};
},
generate: function(node) {
var flagsPrefix = ' ';
this.chunk('[');
this.node(node.name);
if (node.matcher !== null) {
this.chunk(node.matcher);
if (node.value !== null) {
this.node(node.value);
// space between string and flags is not required
if (node.value.type === 'String') {
flagsPrefix = '';
}
}
}
if (node.flags !== null) {
this.chunk(flagsPrefix);
this.chunk(node.flags);
}
this.chunk(']');
}
};

91
app_vue/node_modules/css-tree/lib/syntax/node/Block.js generated vendored Normal file
View File

@ -0,0 +1,91 @@
var TYPE = require('../../tokenizer').TYPE;
var rawMode = require('./Raw').mode;
var WHITESPACE = TYPE.WhiteSpace;
var COMMENT = TYPE.Comment;
var SEMICOLON = TYPE.Semicolon;
var ATKEYWORD = TYPE.AtKeyword;
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
var RIGHTCURLYBRACKET = TYPE.RightCurlyBracket;
function consumeRaw(startToken) {
return this.Raw(startToken, null, true);
}
function consumeRule() {
return this.parseWithFallback(this.Rule, consumeRaw);
}
function consumeRawDeclaration(startToken) {
return this.Raw(startToken, rawMode.semicolonIncluded, true);
}
function consumeDeclaration() {
if (this.scanner.tokenType === SEMICOLON) {
return consumeRawDeclaration.call(this, this.scanner.tokenIndex);
}
var node = this.parseWithFallback(this.Declaration, consumeRawDeclaration);
if (this.scanner.tokenType === SEMICOLON) {
this.scanner.next();
}
return node;
}
module.exports = {
name: 'Block',
structure: {
children: [[
'Atrule',
'Rule',
'Declaration'
]]
},
parse: function(isDeclaration) {
var consumer = isDeclaration ? consumeDeclaration : consumeRule;
var start = this.scanner.tokenStart;
var children = this.createList();
this.eat(LEFTCURLYBRACKET);
scan:
while (!this.scanner.eof) {
switch (this.scanner.tokenType) {
case RIGHTCURLYBRACKET:
break scan;
case WHITESPACE:
case COMMENT:
this.scanner.next();
break;
case ATKEYWORD:
children.push(this.parseWithFallback(this.Atrule, consumeRaw));
break;
default:
children.push(consumer.call(this));
}
}
if (!this.scanner.eof) {
this.eat(RIGHTCURLYBRACKET);
}
return {
type: 'Block',
loc: this.getLocation(start, this.scanner.tokenStart),
children: children
};
},
generate: function(node) {
this.chunk('{');
this.children(node, function(prev) {
if (prev.type === 'Declaration') {
this.chunk(';');
}
});
this.chunk('}');
},
walkContext: 'block'
};

View File

@ -0,0 +1,34 @@
var TYPE = require('../../tokenizer').TYPE;
var LEFTSQUAREBRACKET = TYPE.LeftSquareBracket;
var RIGHTSQUAREBRACKET = TYPE.RightSquareBracket;
module.exports = {
name: 'Brackets',
structure: {
children: [[]]
},
parse: function(readSequence, recognizer) {
var start = this.scanner.tokenStart;
var children = null;
this.eat(LEFTSQUAREBRACKET);
children = readSequence.call(this, recognizer);
if (!this.scanner.eof) {
this.eat(RIGHTSQUAREBRACKET);
}
return {
type: 'Brackets',
loc: this.getLocation(start, this.scanner.tokenStart),
children: children
};
},
generate: function(node) {
this.chunk('[');
this.children(node);
this.chunk(']');
}
};

19
app_vue/node_modules/css-tree/lib/syntax/node/CDC.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
var CDC = require('../../tokenizer').TYPE.CDC;
module.exports = {
name: 'CDC',
structure: [],
parse: function() {
var start = this.scanner.tokenStart;
this.eat(CDC); // -->
return {
type: 'CDC',
loc: this.getLocation(start, this.scanner.tokenStart)
};
},
generate: function() {
this.chunk('-->');
}
};

19
app_vue/node_modules/css-tree/lib/syntax/node/CDO.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
var CDO = require('../../tokenizer').TYPE.CDO;
module.exports = {
name: 'CDO',
structure: [],
parse: function() {
var start = this.scanner.tokenStart;
this.eat(CDO); // <!--
return {
type: 'CDO',
loc: this.getLocation(start, this.scanner.tokenStart)
};
},
generate: function() {
this.chunk('<!--');
}
};

View File

@ -0,0 +1,29 @@
var TYPE = require('../../tokenizer').TYPE;
var IDENT = TYPE.Ident;
var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
// '.' ident
module.exports = {
name: 'ClassSelector',
structure: {
name: String
},
parse: function() {
if (!this.scanner.isDelim(FULLSTOP)) {
this.error('Full stop is expected');
}
this.scanner.next();
return {
type: 'ClassSelector',
loc: this.getLocation(this.scanner.tokenStart - 1, this.scanner.tokenEnd),
name: this.consume(IDENT)
};
},
generate: function(node) {
this.chunk('.');
this.chunk(node.name);
}
};

View File

@ -0,0 +1,55 @@
var TYPE = require('../../tokenizer').TYPE;
var IDENT = TYPE.Ident;
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
var GREATERTHANSIGN = 0x003E; // U+003E GREATER-THAN SIGN (>)
var TILDE = 0x007E; // U+007E TILDE (~)
// + | > | ~ | /deep/
module.exports = {
name: 'Combinator',
structure: {
name: String
},
parse: function() {
var start = this.scanner.tokenStart;
var code = this.scanner.source.charCodeAt(this.scanner.tokenStart);
switch (code) {
case GREATERTHANSIGN:
case PLUSSIGN:
case TILDE:
this.scanner.next();
break;
case SOLIDUS:
this.scanner.next();
if (this.scanner.tokenType !== IDENT || this.scanner.lookupValue(0, 'deep') === false) {
this.error('Identifier `deep` is expected');
}
this.scanner.next();
if (!this.scanner.isDelim(SOLIDUS)) {
this.error('Solidus is expected');
}
this.scanner.next();
break;
default:
this.error('Combinator is expected');
}
return {
type: 'Combinator',
loc: this.getLocation(start, this.scanner.tokenStart),
name: this.scanner.substrToCursor(start)
};
},
generate: function(node) {
this.chunk(node.name);
}
};

View File

@ -0,0 +1,36 @@
var TYPE = require('../../tokenizer').TYPE;
var COMMENT = TYPE.Comment;
var ASTERISK = 0x002A; // U+002A ASTERISK (*)
var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
// '/*' .* '*/'
module.exports = {
name: 'Comment',
structure: {
value: String
},
parse: function() {
var start = this.scanner.tokenStart;
var end = this.scanner.tokenEnd;
this.eat(COMMENT);
if ((end - start + 2) >= 2 &&
this.scanner.source.charCodeAt(end - 2) === ASTERISK &&
this.scanner.source.charCodeAt(end - 1) === SOLIDUS) {
end -= 2;
}
return {
type: 'Comment',
loc: this.getLocation(start, this.scanner.tokenStart),
value: this.scanner.source.substring(start + 2, end)
};
},
generate: function(node) {
this.chunk('/*');
this.chunk(node.value);
this.chunk('*/');
}
};

View File

@ -0,0 +1,169 @@
var isCustomProperty = require('../../utils/names').isCustomProperty;
var TYPE = require('../../tokenizer').TYPE;
var rawMode = require('./Raw').mode;
var IDENT = TYPE.Ident;
var HASH = TYPE.Hash;
var COLON = TYPE.Colon;
var SEMICOLON = TYPE.Semicolon;
var DELIM = TYPE.Delim;
var WHITESPACE = TYPE.WhiteSpace;
var EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
var NUMBERSIGN = 0x0023; // U+0023 NUMBER SIGN (#)
var DOLLARSIGN = 0x0024; // U+0024 DOLLAR SIGN ($)
var AMPERSAND = 0x0026; // U+0026 ANPERSAND (&)
var ASTERISK = 0x002A; // U+002A ASTERISK (*)
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
function consumeValueRaw(startToken) {
return this.Raw(startToken, rawMode.exclamationMarkOrSemicolon, true);
}
function consumeCustomPropertyRaw(startToken) {
return this.Raw(startToken, rawMode.exclamationMarkOrSemicolon, false);
}
function consumeValue() {
var startValueToken = this.scanner.tokenIndex;
var value = this.Value();
if (value.type !== 'Raw' &&
this.scanner.eof === false &&
this.scanner.tokenType !== SEMICOLON &&
this.scanner.isDelim(EXCLAMATIONMARK) === false &&
this.scanner.isBalanceEdge(startValueToken) === false) {
this.error();
}
return value;
}
module.exports = {
name: 'Declaration',
structure: {
important: [Boolean, String],
property: String,
value: ['Value', 'Raw']
},
parse: function() {
var start = this.scanner.tokenStart;
var startToken = this.scanner.tokenIndex;
var property = readProperty.call(this);
var customProperty = isCustomProperty(property);
var parseValue = customProperty ? this.parseCustomProperty : this.parseValue;
var consumeRaw = customProperty ? consumeCustomPropertyRaw : consumeValueRaw;
var important = false;
var value;
this.scanner.skipSC();
this.eat(COLON);
const valueStart = this.scanner.tokenIndex;
if (!customProperty) {
this.scanner.skipSC();
}
if (parseValue) {
value = this.parseWithFallback(consumeValue, consumeRaw);
} else {
value = consumeRaw.call(this, this.scanner.tokenIndex);
}
if (customProperty && value.type === 'Value' && value.children.isEmpty()) {
for (let offset = valueStart - this.scanner.tokenIndex; offset <= 0; offset++) {
if (this.scanner.lookupType(offset) === WHITESPACE) {
value.children.appendData({
type: 'WhiteSpace',
loc: null,
value: ' '
});
break;
}
}
}
if (this.scanner.isDelim(EXCLAMATIONMARK)) {
important = getImportant.call(this);
this.scanner.skipSC();
}
// Do not include semicolon to range per spec
// https://drafts.csswg.org/css-syntax/#declaration-diagram
if (this.scanner.eof === false &&
this.scanner.tokenType !== SEMICOLON &&
this.scanner.isBalanceEdge(startToken) === false) {
this.error();
}
return {
type: 'Declaration',
loc: this.getLocation(start, this.scanner.tokenStart),
important: important,
property: property,
value: value
};
},
generate: function(node) {
this.chunk(node.property);
this.chunk(':');
this.node(node.value);
if (node.important) {
this.chunk(node.important === true ? '!important' : '!' + node.important);
}
},
walkContext: 'declaration'
};
function readProperty() {
var start = this.scanner.tokenStart;
var prefix = 0;
// hacks
if (this.scanner.tokenType === DELIM) {
switch (this.scanner.source.charCodeAt(this.scanner.tokenStart)) {
case ASTERISK:
case DOLLARSIGN:
case PLUSSIGN:
case NUMBERSIGN:
case AMPERSAND:
this.scanner.next();
break;
// TODO: not sure we should support this hack
case SOLIDUS:
this.scanner.next();
if (this.scanner.isDelim(SOLIDUS)) {
this.scanner.next();
}
break;
}
}
if (prefix) {
this.scanner.skip(prefix);
}
if (this.scanner.tokenType === HASH) {
this.eat(HASH);
} else {
this.eat(IDENT);
}
return this.scanner.substrToCursor(start);
}
// ! ws* important
function getImportant() {
this.eat(DELIM);
this.scanner.skipSC();
var important = this.consume(IDENT);
// store original value in case it differ from `important`
// for better original source restoring and hacks like `!ie` support
return important === 'important' ? true : important;
}

View File

@ -0,0 +1,49 @@
var TYPE = require('../../tokenizer').TYPE;
var rawMode = require('./Raw').mode;
var WHITESPACE = TYPE.WhiteSpace;
var COMMENT = TYPE.Comment;
var SEMICOLON = TYPE.Semicolon;
function consumeRaw(startToken) {
return this.Raw(startToken, rawMode.semicolonIncluded, true);
}
module.exports = {
name: 'DeclarationList',
structure: {
children: [[
'Declaration'
]]
},
parse: function() {
var children = this.createList();
scan:
while (!this.scanner.eof) {
switch (this.scanner.tokenType) {
case WHITESPACE:
case COMMENT:
case SEMICOLON:
this.scanner.next();
break;
default:
children.push(this.parseWithFallback(this.Declaration, consumeRaw));
}
}
return {
type: 'DeclarationList',
loc: this.getLocationFromList(children),
children: children
};
},
generate: function(node) {
this.children(node, function(prev) {
if (prev.type === 'Declaration') {
this.chunk(';');
}
});
}
};

View File

@ -0,0 +1,29 @@
var consumeNumber = require('../../tokenizer/utils').consumeNumber;
var TYPE = require('../../tokenizer').TYPE;
var DIMENSION = TYPE.Dimension;
module.exports = {
name: 'Dimension',
structure: {
value: String,
unit: String
},
parse: function() {
var start = this.scanner.tokenStart;
var numberEnd = consumeNumber(this.scanner.source, start);
this.eat(DIMENSION);
return {
type: 'Dimension',
loc: this.getLocation(start, this.scanner.tokenStart),
value: this.scanner.source.substring(start, numberEnd),
unit: this.scanner.source.substring(numberEnd, this.scanner.tokenStart)
};
},
generate: function(node) {
this.chunk(node.value);
this.chunk(node.unit);
}
};

View File

@ -0,0 +1,40 @@
var TYPE = require('../../tokenizer').TYPE;
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
// <function-token> <sequence> )
module.exports = {
name: 'Function',
structure: {
name: String,
children: [[]]
},
parse: function(readSequence, recognizer) {
var start = this.scanner.tokenStart;
var name = this.consumeFunctionName();
var nameLowerCase = name.toLowerCase();
var children;
children = recognizer.hasOwnProperty(nameLowerCase)
? recognizer[nameLowerCase].call(this, recognizer)
: readSequence.call(this, recognizer);
if (!this.scanner.eof) {
this.eat(RIGHTPARENTHESIS);
}
return {
type: 'Function',
loc: this.getLocation(start, this.scanner.tokenStart),
name: name,
children: children
};
},
generate: function(node) {
this.chunk(node.name);
this.chunk('(');
this.children(node);
this.chunk(')');
},
walkContext: 'function'
};

26
app_vue/node_modules/css-tree/lib/syntax/node/Hash.js generated vendored Normal file
View File

@ -0,0 +1,26 @@
var TYPE = require('../../tokenizer').TYPE;
var HASH = TYPE.Hash;
// '#' ident
module.exports = {
name: 'Hash',
structure: {
value: String
},
parse: function() {
var start = this.scanner.tokenStart;
this.eat(HASH);
return {
type: 'Hash',
loc: this.getLocation(start, this.scanner.tokenStart),
value: this.scanner.substrToCursor(start + 1)
};
},
generate: function(node) {
this.chunk('#');
this.chunk(node.value);
}
};

View File

@ -0,0 +1,27 @@
var TYPE = require('../../tokenizer').TYPE;
var HASH = TYPE.Hash;
// <hash-token>
module.exports = {
name: 'IdSelector',
structure: {
name: String
},
parse: function() {
var start = this.scanner.tokenStart;
// TODO: check value is an ident
this.eat(HASH);
return {
type: 'IdSelector',
loc: this.getLocation(start, this.scanner.tokenStart),
name: this.scanner.substrToCursor(start + 1)
};
},
generate: function(node) {
this.chunk('#');
this.chunk(node.name);
}
};

View File

@ -0,0 +1,20 @@
var TYPE = require('../../tokenizer').TYPE;
var IDENT = TYPE.Ident;
module.exports = {
name: 'Identifier',
structure: {
name: String
},
parse: function() {
return {
type: 'Identifier',
loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
name: this.consume(IDENT)
};
},
generate: function(node) {
this.chunk(node.name);
}
};

View File

@ -0,0 +1,76 @@
var TYPE = require('../../tokenizer').TYPE;
var IDENT = TYPE.Ident;
var NUMBER = TYPE.Number;
var DIMENSION = TYPE.Dimension;
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
var COLON = TYPE.Colon;
var DELIM = TYPE.Delim;
module.exports = {
name: 'MediaFeature',
structure: {
name: String,
value: ['Identifier', 'Number', 'Dimension', 'Ratio', null]
},
parse: function() {
var start = this.scanner.tokenStart;
var name;
var value = null;
this.eat(LEFTPARENTHESIS);
this.scanner.skipSC();
name = this.consume(IDENT);
this.scanner.skipSC();
if (this.scanner.tokenType !== RIGHTPARENTHESIS) {
this.eat(COLON);
this.scanner.skipSC();
switch (this.scanner.tokenType) {
case NUMBER:
if (this.lookupNonWSType(1) === DELIM) {
value = this.Ratio();
} else {
value = this.Number();
}
break;
case DIMENSION:
value = this.Dimension();
break;
case IDENT:
value = this.Identifier();
break;
default:
this.error('Number, dimension, ratio or identifier is expected');
}
this.scanner.skipSC();
}
this.eat(RIGHTPARENTHESIS);
return {
type: 'MediaFeature',
loc: this.getLocation(start, this.scanner.tokenStart),
name: name,
value: value
};
},
generate: function(node) {
this.chunk('(');
this.chunk(node.name);
if (node.value !== null) {
this.chunk(':');
this.node(node.value);
}
this.chunk(')');
}
};

View File

@ -0,0 +1,68 @@
var TYPE = require('../../tokenizer').TYPE;
var WHITESPACE = TYPE.WhiteSpace;
var COMMENT = TYPE.Comment;
var IDENT = TYPE.Ident;
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
module.exports = {
name: 'MediaQuery',
structure: {
children: [[
'Identifier',
'MediaFeature',
'WhiteSpace'
]]
},
parse: function() {
this.scanner.skipSC();
var children = this.createList();
var child = null;
var space = null;
scan:
while (!this.scanner.eof) {
switch (this.scanner.tokenType) {
case COMMENT:
this.scanner.next();
continue;
case WHITESPACE:
space = this.WhiteSpace();
continue;
case IDENT:
child = this.Identifier();
break;
case LEFTPARENTHESIS:
child = this.MediaFeature();
break;
default:
break scan;
}
if (space !== null) {
children.push(space);
space = null;
}
children.push(child);
}
if (child === null) {
this.error('Identifier or parenthesis is expected');
}
return {
type: 'MediaQuery',
loc: this.getLocationFromList(children),
children: children
};
},
generate: function(node) {
this.children(node);
}
};

View File

@ -0,0 +1,36 @@
var COMMA = require('../../tokenizer').TYPE.Comma;
module.exports = {
name: 'MediaQueryList',
structure: {
children: [[
'MediaQuery'
]]
},
parse: function(relative) {
var children = this.createList();
this.scanner.skipSC();
while (!this.scanner.eof) {
children.push(this.MediaQuery(relative));
if (this.scanner.tokenType !== COMMA) {
break;
}
this.scanner.next();
}
return {
type: 'MediaQueryList',
loc: this.getLocationFromList(children),
children: children
};
},
generate: function(node) {
this.children(node, function() {
this.chunk(',');
});
}
};

51
app_vue/node_modules/css-tree/lib/syntax/node/Nth.js generated vendored Normal file
View File

@ -0,0 +1,51 @@
module.exports = {
name: 'Nth',
structure: {
nth: ['AnPlusB', 'Identifier'],
selector: ['SelectorList', null]
},
parse: function(allowOfClause) {
this.scanner.skipSC();
var start = this.scanner.tokenStart;
var end = start;
var selector = null;
var query;
if (this.scanner.lookupValue(0, 'odd') || this.scanner.lookupValue(0, 'even')) {
query = this.Identifier();
} else {
query = this.AnPlusB();
}
this.scanner.skipSC();
if (allowOfClause && this.scanner.lookupValue(0, 'of')) {
this.scanner.next();
selector = this.SelectorList();
if (this.needPositions) {
end = this.getLastListNode(selector.children).loc.end.offset;
}
} else {
if (this.needPositions) {
end = query.loc.end.offset;
}
}
return {
type: 'Nth',
loc: this.getLocation(start, end),
nth: query,
selector: selector
};
},
generate: function(node) {
this.node(node.nth);
if (node.selector !== null) {
this.chunk(' of ');
this.node(node.selector);
}
}
};

View File

@ -0,0 +1,18 @@
var NUMBER = require('../../tokenizer').TYPE.Number;
module.exports = {
name: 'Number',
structure: {
value: String
},
parse: function() {
return {
type: 'Number',
loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
value: this.consume(NUMBER)
};
},
generate: function(node) {
this.chunk(node.value);
}
};

View File

@ -0,0 +1,21 @@
// '/' | '*' | ',' | ':' | '+' | '-'
module.exports = {
name: 'Operator',
structure: {
value: String
},
parse: function() {
var start = this.scanner.tokenStart;
this.scanner.next();
return {
type: 'Operator',
loc: this.getLocation(start, this.scanner.tokenStart),
value: this.scanner.substrToCursor(start)
};
},
generate: function(node) {
this.chunk(node.value);
}
};

View File

@ -0,0 +1,34 @@
var TYPE = require('../../tokenizer').TYPE;
var LEFTPARENTHESIS = TYPE.LeftParenthesis;
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
module.exports = {
name: 'Parentheses',
structure: {
children: [[]]
},
parse: function(readSequence, recognizer) {
var start = this.scanner.tokenStart;
var children = null;
this.eat(LEFTPARENTHESIS);
children = readSequence.call(this, recognizer);
if (!this.scanner.eof) {
this.eat(RIGHTPARENTHESIS);
}
return {
type: 'Parentheses',
loc: this.getLocation(start, this.scanner.tokenStart),
children: children
};
},
generate: function(node) {
this.chunk('(');
this.children(node);
this.chunk(')');
}
};

View File

@ -0,0 +1,27 @@
var consumeNumber = require('../../tokenizer/utils').consumeNumber;
var TYPE = require('../../tokenizer').TYPE;
var PERCENTAGE = TYPE.Percentage;
module.exports = {
name: 'Percentage',
structure: {
value: String
},
parse: function() {
var start = this.scanner.tokenStart;
var numberEnd = consumeNumber(this.scanner.source, start);
this.eat(PERCENTAGE);
return {
type: 'Percentage',
loc: this.getLocation(start, this.scanner.tokenStart),
value: this.scanner.source.substring(start, numberEnd)
};
},
generate: function(node) {
this.chunk(node.value);
this.chunk('%');
}
};

View File

@ -0,0 +1,61 @@
var TYPE = require('../../tokenizer').TYPE;
var IDENT = TYPE.Ident;
var FUNCTION = TYPE.Function;
var COLON = TYPE.Colon;
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
// : [ <ident> | <function-token> <any-value>? ) ]
module.exports = {
name: 'PseudoClassSelector',
structure: {
name: String,
children: [['Raw'], null]
},
parse: function() {
var start = this.scanner.tokenStart;
var children = null;
var name;
var nameLowerCase;
this.eat(COLON);
if (this.scanner.tokenType === FUNCTION) {
name = this.consumeFunctionName();
nameLowerCase = name.toLowerCase();
if (this.pseudo.hasOwnProperty(nameLowerCase)) {
this.scanner.skipSC();
children = this.pseudo[nameLowerCase].call(this);
this.scanner.skipSC();
} else {
children = this.createList();
children.push(
this.Raw(this.scanner.tokenIndex, null, false)
);
}
this.eat(RIGHTPARENTHESIS);
} else {
name = this.consume(IDENT);
}
return {
type: 'PseudoClassSelector',
loc: this.getLocation(start, this.scanner.tokenStart),
name: name,
children: children
};
},
generate: function(node) {
this.chunk(':');
this.chunk(node.name);
if (node.children !== null) {
this.chunk('(');
this.children(node);
this.chunk(')');
}
},
walkContext: 'function'
};

View File

@ -0,0 +1,62 @@
var TYPE = require('../../tokenizer').TYPE;
var IDENT = TYPE.Ident;
var FUNCTION = TYPE.Function;
var COLON = TYPE.Colon;
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
// :: [ <ident> | <function-token> <any-value>? ) ]
module.exports = {
name: 'PseudoElementSelector',
structure: {
name: String,
children: [['Raw'], null]
},
parse: function() {
var start = this.scanner.tokenStart;
var children = null;
var name;
var nameLowerCase;
this.eat(COLON);
this.eat(COLON);
if (this.scanner.tokenType === FUNCTION) {
name = this.consumeFunctionName();
nameLowerCase = name.toLowerCase();
if (this.pseudo.hasOwnProperty(nameLowerCase)) {
this.scanner.skipSC();
children = this.pseudo[nameLowerCase].call(this);
this.scanner.skipSC();
} else {
children = this.createList();
children.push(
this.Raw(this.scanner.tokenIndex, null, false)
);
}
this.eat(RIGHTPARENTHESIS);
} else {
name = this.consume(IDENT);
}
return {
type: 'PseudoElementSelector',
loc: this.getLocation(start, this.scanner.tokenStart),
name: name,
children: children
};
},
generate: function(node) {
this.chunk('::');
this.chunk(node.name);
if (node.children !== null) {
this.chunk('(');
this.children(node);
this.chunk(')');
}
},
walkContext: 'function'
};

66
app_vue/node_modules/css-tree/lib/syntax/node/Ratio.js generated vendored Normal file
View File

@ -0,0 +1,66 @@
var isDigit = require('../../tokenizer').isDigit;
var TYPE = require('../../tokenizer').TYPE;
var NUMBER = TYPE.Number;
var DELIM = TYPE.Delim;
var SOLIDUS = 0x002F; // U+002F SOLIDUS (/)
var FULLSTOP = 0x002E; // U+002E FULL STOP (.)
// Terms of <ratio> should be a positive numbers (not zero or negative)
// (see https://drafts.csswg.org/mediaqueries-3/#values)
// However, -o-min-device-pixel-ratio takes fractional values as a ratio's term
// and this is using by various sites. Therefore we relax checking on parse
// to test a term is unsigned number without an exponent part.
// Additional checking may be applied on lexer validation.
function consumeNumber() {
this.scanner.skipWS();
var value = this.consume(NUMBER);
for (var i = 0; i < value.length; i++) {
var code = value.charCodeAt(i);
if (!isDigit(code) && code !== FULLSTOP) {
this.error('Unsigned number is expected', this.scanner.tokenStart - value.length + i);
}
}
if (Number(value) === 0) {
this.error('Zero number is not allowed', this.scanner.tokenStart - value.length);
}
return value;
}
// <positive-integer> S* '/' S* <positive-integer>
module.exports = {
name: 'Ratio',
structure: {
left: String,
right: String
},
parse: function() {
var start = this.scanner.tokenStart;
var left = consumeNumber.call(this);
var right;
this.scanner.skipWS();
if (!this.scanner.isDelim(SOLIDUS)) {
this.error('Solidus is expected');
}
this.eat(DELIM);
right = consumeNumber.call(this);
return {
type: 'Ratio',
loc: this.getLocation(start, this.scanner.tokenStart),
left: left,
right: right
};
},
generate: function(node) {
this.chunk(node.left);
this.chunk('/');
this.chunk(node.right);
}
};

87
app_vue/node_modules/css-tree/lib/syntax/node/Raw.js generated vendored Normal file
View File

@ -0,0 +1,87 @@
var tokenizer = require('../../tokenizer');
var TYPE = tokenizer.TYPE;
var WhiteSpace = TYPE.WhiteSpace;
var Semicolon = TYPE.Semicolon;
var LeftCurlyBracket = TYPE.LeftCurlyBracket;
var Delim = TYPE.Delim;
var EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
function getOffsetExcludeWS() {
if (this.scanner.tokenIndex > 0) {
if (this.scanner.lookupType(-1) === WhiteSpace) {
return this.scanner.tokenIndex > 1
? this.scanner.getTokenStart(this.scanner.tokenIndex - 1)
: this.scanner.firstCharOffset;
}
}
return this.scanner.tokenStart;
}
// 0, 0, false
function balanceEnd() {
return 0;
}
// LEFTCURLYBRACKET, 0, false
function leftCurlyBracket(tokenType) {
return tokenType === LeftCurlyBracket ? 1 : 0;
}
// LEFTCURLYBRACKET, SEMICOLON, false
function leftCurlyBracketOrSemicolon(tokenType) {
return tokenType === LeftCurlyBracket || tokenType === Semicolon ? 1 : 0;
}
// EXCLAMATIONMARK, SEMICOLON, false
function exclamationMarkOrSemicolon(tokenType, source, offset) {
if (tokenType === Delim && source.charCodeAt(offset) === EXCLAMATIONMARK) {
return 1;
}
return tokenType === Semicolon ? 1 : 0;
}
// 0, SEMICOLON, true
function semicolonIncluded(tokenType) {
return tokenType === Semicolon ? 2 : 0;
}
module.exports = {
name: 'Raw',
structure: {
value: String
},
parse: function(startToken, mode, excludeWhiteSpace) {
var startOffset = this.scanner.getTokenStart(startToken);
var endOffset;
this.scanner.skip(
this.scanner.getRawLength(startToken, mode || balanceEnd)
);
if (excludeWhiteSpace && this.scanner.tokenStart > startOffset) {
endOffset = getOffsetExcludeWS.call(this);
} else {
endOffset = this.scanner.tokenStart;
}
return {
type: 'Raw',
loc: this.getLocation(startOffset, endOffset),
value: this.scanner.source.substring(startOffset, endOffset)
};
},
generate: function(node) {
this.chunk(node.value);
},
mode: {
default: balanceEnd,
leftCurlyBracket: leftCurlyBracket,
leftCurlyBracketOrSemicolon: leftCurlyBracketOrSemicolon,
exclamationMarkOrSemicolon: exclamationMarkOrSemicolon,
semicolonIncluded: semicolonIncluded
}
};

54
app_vue/node_modules/css-tree/lib/syntax/node/Rule.js generated vendored Normal file
View File

@ -0,0 +1,54 @@
var TYPE = require('../../tokenizer').TYPE;
var rawMode = require('./Raw').mode;
var LEFTCURLYBRACKET = TYPE.LeftCurlyBracket;
function consumeRaw(startToken) {
return this.Raw(startToken, rawMode.leftCurlyBracket, true);
}
function consumePrelude() {
var prelude = this.SelectorList();
if (prelude.type !== 'Raw' &&
this.scanner.eof === false &&
this.scanner.tokenType !== LEFTCURLYBRACKET) {
this.error();
}
return prelude;
}
module.exports = {
name: 'Rule',
structure: {
prelude: ['SelectorList', 'Raw'],
block: ['Block']
},
parse: function() {
var startToken = this.scanner.tokenIndex;
var startOffset = this.scanner.tokenStart;
var prelude;
var block;
if (this.parseRulePrelude) {
prelude = this.parseWithFallback(consumePrelude, consumeRaw);
} else {
prelude = consumeRaw.call(this, startToken);
}
block = this.Block(true);
return {
type: 'Rule',
loc: this.getLocation(startOffset, this.scanner.tokenStart),
prelude: prelude,
block: block
};
},
generate: function(node) {
this.node(node.prelude);
this.node(node.block);
},
walkContext: 'rule'
};

View File

@ -0,0 +1,32 @@
module.exports = {
name: 'Selector',
structure: {
children: [[
'TypeSelector',
'IdSelector',
'ClassSelector',
'AttributeSelector',
'PseudoClassSelector',
'PseudoElementSelector',
'Combinator',
'WhiteSpace'
]]
},
parse: function() {
var children = this.readSequence(this.scope.Selector);
// nothing were consumed
if (this.getFirstListNode(children) === null) {
this.error('Selector is expected');
}
return {
type: 'Selector',
loc: this.getLocationFromList(children),
children: children
};
},
generate: function(node) {
this.children(node);
}
};

View File

@ -0,0 +1,39 @@
var TYPE = require('../../tokenizer').TYPE;
var COMMA = TYPE.Comma;
module.exports = {
name: 'SelectorList',
structure: {
children: [[
'Selector',
'Raw'
]]
},
parse: function() {
var children = this.createList();
while (!this.scanner.eof) {
children.push(this.Selector());
if (this.scanner.tokenType === COMMA) {
this.scanner.next();
continue;
}
break;
}
return {
type: 'SelectorList',
loc: this.getLocationFromList(children),
children: children
};
},
generate: function(node) {
this.children(node, function() {
this.chunk(',');
});
},
walkContext: 'selector'
};

View File

@ -0,0 +1,18 @@
var STRING = require('../../tokenizer').TYPE.String;
module.exports = {
name: 'String',
structure: {
value: String
},
parse: function() {
return {
type: 'String',
loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
value: this.consume(STRING)
};
},
generate: function(node) {
this.chunk(node.value);
}
};

View File

@ -0,0 +1,81 @@
var TYPE = require('../../tokenizer').TYPE;
var WHITESPACE = TYPE.WhiteSpace;
var COMMENT = TYPE.Comment;
var ATKEYWORD = TYPE.AtKeyword;
var CDO = TYPE.CDO;
var CDC = TYPE.CDC;
var EXCLAMATIONMARK = 0x0021; // U+0021 EXCLAMATION MARK (!)
function consumeRaw(startToken) {
return this.Raw(startToken, null, false);
}
module.exports = {
name: 'StyleSheet',
structure: {
children: [[
'Comment',
'CDO',
'CDC',
'Atrule',
'Rule',
'Raw'
]]
},
parse: function() {
var start = this.scanner.tokenStart;
var children = this.createList();
var child;
scan:
while (!this.scanner.eof) {
switch (this.scanner.tokenType) {
case WHITESPACE:
this.scanner.next();
continue;
case COMMENT:
// ignore comments except exclamation comments (i.e. /*! .. */) on top level
if (this.scanner.source.charCodeAt(this.scanner.tokenStart + 2) !== EXCLAMATIONMARK) {
this.scanner.next();
continue;
}
child = this.Comment();
break;
case CDO: // <!--
child = this.CDO();
break;
case CDC: // -->
child = this.CDC();
break;
// CSS Syntax Module Level 3
// §2.2 Error handling
// At the "top level" of a stylesheet, an <at-keyword-token> starts an at-rule.
case ATKEYWORD:
child = this.parseWithFallback(this.Atrule, consumeRaw);
break;
// Anything else starts a qualified rule ...
default:
child = this.parseWithFallback(this.Rule, consumeRaw);
}
children.push(child);
}
return {
type: 'StyleSheet',
loc: this.getLocation(start, this.scanner.tokenStart),
children: children
};
},
generate: function(node) {
this.children(node);
},
walkContext: 'stylesheet'
};

View File

@ -0,0 +1,53 @@
var TYPE = require('../../tokenizer').TYPE;
var IDENT = TYPE.Ident;
var ASTERISK = 0x002A; // U+002A ASTERISK (*)
var VERTICALLINE = 0x007C; // U+007C VERTICAL LINE (|)
function eatIdentifierOrAsterisk() {
if (this.scanner.tokenType !== IDENT &&
this.scanner.isDelim(ASTERISK) === false) {
this.error('Identifier or asterisk is expected');
}
this.scanner.next();
}
// ident
// ident|ident
// ident|*
// *
// *|ident
// *|*
// |ident
// |*
module.exports = {
name: 'TypeSelector',
structure: {
name: String
},
parse: function() {
var start = this.scanner.tokenStart;
if (this.scanner.isDelim(VERTICALLINE)) {
this.scanner.next();
eatIdentifierOrAsterisk.call(this);
} else {
eatIdentifierOrAsterisk.call(this);
if (this.scanner.isDelim(VERTICALLINE)) {
this.scanner.next();
eatIdentifierOrAsterisk.call(this);
}
}
return {
type: 'TypeSelector',
loc: this.getLocation(start, this.scanner.tokenStart),
name: this.scanner.substrToCursor(start)
};
},
generate: function(node) {
this.chunk(node.name);
}
};

View File

@ -0,0 +1,173 @@
var isHexDigit = require('../../tokenizer').isHexDigit;
var cmpChar = require('../../tokenizer').cmpChar;
var TYPE = require('../../tokenizer').TYPE;
var NAME = require('../../tokenizer').NAME;
var IDENT = TYPE.Ident;
var NUMBER = TYPE.Number;
var DIMENSION = TYPE.Dimension;
var PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
var HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
var QUESTIONMARK = 0x003F; // U+003F QUESTION MARK (?)
var U = 0x0075; // U+0075 LATIN SMALL LETTER U (u)
function eatHexSequence(offset, allowDash) {
for (var pos = this.scanner.tokenStart + offset, len = 0; pos < this.scanner.tokenEnd; pos++) {
var code = this.scanner.source.charCodeAt(pos);
if (code === HYPHENMINUS && allowDash && len !== 0) {
if (eatHexSequence.call(this, offset + len + 1, false) === 0) {
this.error();
}
return -1;
}
if (!isHexDigit(code)) {
this.error(
allowDash && len !== 0
? 'HyphenMinus' + (len < 6 ? ' or hex digit' : '') + ' is expected'
: (len < 6 ? 'Hex digit is expected' : 'Unexpected input'),
pos
);
}
if (++len > 6) {
this.error('Too many hex digits', pos);
};
}
this.scanner.next();
return len;
}
function eatQuestionMarkSequence(max) {
var count = 0;
while (this.scanner.isDelim(QUESTIONMARK)) {
if (++count > max) {
this.error('Too many question marks');
}
this.scanner.next();
}
}
function startsWith(code) {
if (this.scanner.source.charCodeAt(this.scanner.tokenStart) !== code) {
this.error(NAME[code] + ' is expected');
}
}
// https://drafts.csswg.org/css-syntax/#urange
// Informally, the <urange> production has three forms:
// U+0001
// Defines a range consisting of a single code point, in this case the code point "1".
// U+0001-00ff
// Defines a range of codepoints between the first and the second value, in this case
// the range between "1" and "ff" (255 in decimal) inclusive.
// U+00??
// Defines a range of codepoints where the "?" characters range over all hex digits,
// in this case defining the same as the value U+0000-00ff.
// In each form, a maximum of 6 digits is allowed for each hexadecimal number (if you treat "?" as a hexadecimal digit).
//
// <urange> =
// u '+' <ident-token> '?'* |
// u <dimension-token> '?'* |
// u <number-token> '?'* |
// u <number-token> <dimension-token> |
// u <number-token> <number-token> |
// u '+' '?'+
function scanUnicodeRange() {
var hexLength = 0;
// u '+' <ident-token> '?'*
// u '+' '?'+
if (this.scanner.isDelim(PLUSSIGN)) {
this.scanner.next();
if (this.scanner.tokenType === IDENT) {
hexLength = eatHexSequence.call(this, 0, true);
if (hexLength > 0) {
eatQuestionMarkSequence.call(this, 6 - hexLength);
}
return;
}
if (this.scanner.isDelim(QUESTIONMARK)) {
this.scanner.next();
eatQuestionMarkSequence.call(this, 5);
return;
}
this.error('Hex digit or question mark is expected');
return;
}
// u <number-token> '?'*
// u <number-token> <dimension-token>
// u <number-token> <number-token>
if (this.scanner.tokenType === NUMBER) {
startsWith.call(this, PLUSSIGN);
hexLength = eatHexSequence.call(this, 1, true);
if (this.scanner.isDelim(QUESTIONMARK)) {
eatQuestionMarkSequence.call(this, 6 - hexLength);
return;
}
if (this.scanner.tokenType === DIMENSION ||
this.scanner.tokenType === NUMBER) {
startsWith.call(this, HYPHENMINUS);
eatHexSequence.call(this, 1, false);
return;
}
return;
}
// u <dimension-token> '?'*
if (this.scanner.tokenType === DIMENSION) {
startsWith.call(this, PLUSSIGN);
hexLength = eatHexSequence.call(this, 1, true);
if (hexLength > 0) {
eatQuestionMarkSequence.call(this, 6 - hexLength);
}
return;
}
this.error();
}
module.exports = {
name: 'UnicodeRange',
structure: {
value: String
},
parse: function() {
var start = this.scanner.tokenStart;
// U or u
if (!cmpChar(this.scanner.source, start, U)) {
this.error('U is expected');
}
if (!cmpChar(this.scanner.source, start + 1, PLUSSIGN)) {
this.error('Plus sign is expected');
}
this.scanner.next();
scanUnicodeRange.call(this);
return {
type: 'UnicodeRange',
loc: this.getLocation(start, this.scanner.tokenStart),
value: this.scanner.substrToCursor(start)
};
},
generate: function(node) {
this.chunk(node.value);
}
};

69
app_vue/node_modules/css-tree/lib/syntax/node/Url.js generated vendored Normal file
View File

@ -0,0 +1,69 @@
var isWhiteSpace = require('../../tokenizer').isWhiteSpace;
var cmpStr = require('../../tokenizer').cmpStr;
var TYPE = require('../../tokenizer').TYPE;
var FUNCTION = TYPE.Function;
var URL = TYPE.Url;
var RIGHTPARENTHESIS = TYPE.RightParenthesis;
// <url-token> | <function-token> <string> )
module.exports = {
name: 'Url',
structure: {
value: ['String', 'Raw']
},
parse: function() {
var start = this.scanner.tokenStart;
var value;
switch (this.scanner.tokenType) {
case URL:
var rawStart = start + 4;
var rawEnd = this.scanner.tokenEnd - 1;
while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawStart))) {
rawStart++;
}
while (rawStart < rawEnd && isWhiteSpace(this.scanner.source.charCodeAt(rawEnd - 1))) {
rawEnd--;
}
value = {
type: 'Raw',
loc: this.getLocation(rawStart, rawEnd),
value: this.scanner.source.substring(rawStart, rawEnd)
};
this.eat(URL);
break;
case FUNCTION:
if (!cmpStr(this.scanner.source, this.scanner.tokenStart, this.scanner.tokenEnd, 'url(')) {
this.error('Function name must be `url`');
}
this.eat(FUNCTION);
this.scanner.skipSC();
value = this.String();
this.scanner.skipSC();
this.eat(RIGHTPARENTHESIS);
break;
default:
this.error('Url or Function is expected');
}
return {
type: 'Url',
loc: this.getLocation(start, this.scanner.tokenStart),
value: value
};
},
generate: function(node) {
this.chunk('url');
this.chunk('(');
this.node(node.value);
this.chunk(')');
}
};

19
app_vue/node_modules/css-tree/lib/syntax/node/Value.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
module.exports = {
name: 'Value',
structure: {
children: [[]]
},
parse: function() {
var start = this.scanner.tokenStart;
var children = this.readSequence(this.scope.Value);
return {
type: 'Value',
loc: this.getLocation(start, this.scanner.tokenStart),
children: children
};
},
generate: function(node) {
this.children(node);
}
};

View File

@ -0,0 +1,26 @@
var WHITESPACE = require('../../tokenizer').TYPE.WhiteSpace;
var SPACE = Object.freeze({
type: 'WhiteSpace',
loc: null,
value: ' '
});
module.exports = {
name: 'WhiteSpace',
structure: {
value: String
},
parse: function() {
this.eat(WHITESPACE);
return SPACE;
// return {
// type: 'WhiteSpace',
// loc: this.getLocation(this.scanner.tokenStart, this.scanner.tokenEnd),
// value: this.consume(WHITESPACE)
// };
},
generate: function(node) {
this.chunk(node.value);
}
};

42
app_vue/node_modules/css-tree/lib/syntax/node/index.js generated vendored Normal file
View File

@ -0,0 +1,42 @@
module.exports = {
AnPlusB: require('./AnPlusB'),
Atrule: require('./Atrule'),
AtrulePrelude: require('./AtrulePrelude'),
AttributeSelector: require('./AttributeSelector'),
Block: require('./Block'),
Brackets: require('./Brackets'),
CDC: require('./CDC'),
CDO: require('./CDO'),
ClassSelector: require('./ClassSelector'),
Combinator: require('./Combinator'),
Comment: require('./Comment'),
Declaration: require('./Declaration'),
DeclarationList: require('./DeclarationList'),
Dimension: require('./Dimension'),
Function: require('./Function'),
Hash: require('./Hash'),
Identifier: require('./Identifier'),
IdSelector: require('./IdSelector'),
MediaFeature: require('./MediaFeature'),
MediaQuery: require('./MediaQuery'),
MediaQueryList: require('./MediaQueryList'),
Nth: require('./Nth'),
Number: require('./Number'),
Operator: require('./Operator'),
Parentheses: require('./Parentheses'),
Percentage: require('./Percentage'),
PseudoClassSelector: require('./PseudoClassSelector'),
PseudoElementSelector: require('./PseudoElementSelector'),
Ratio: require('./Ratio'),
Raw: require('./Raw'),
Rule: require('./Rule'),
Selector: require('./Selector'),
SelectorList: require('./SelectorList'),
String: require('./String'),
StyleSheet: require('./StyleSheet'),
TypeSelector: require('./TypeSelector'),
UnicodeRange: require('./UnicodeRange'),
Url: require('./Url'),
Value: require('./Value'),
WhiteSpace: require('./WhiteSpace')
};