aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/css-tree/cjs/syntax/atrule
diff options
context:
space:
mode:
Diffstat (limited to 'vanilla/node_modules/css-tree/cjs/syntax/atrule')
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/container.cjs32
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/font-face.cjs12
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/import.cjs101
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/index.cjs27
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/layer.cjs16
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/media.cjs16
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/nest.cjs16
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/page.cjs16
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/scope.cjs16
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/starting-style.cjs12
-rw-r--r--vanilla/node_modules/css-tree/cjs/syntax/atrule/supports.cjs16
11 files changed, 280 insertions, 0 deletions
diff --git a/vanilla/node_modules/css-tree/cjs/syntax/atrule/container.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/container.cjs
new file mode 100644
index 0000000..7413f45
--- /dev/null
+++ b/vanilla/node_modules/css-tree/cjs/syntax/atrule/container.cjs
@@ -0,0 +1,32 @@
+'use strict';
+
+const types = require('../../tokenizer/types.cjs');
+
+// https://drafts.csswg.org/css-contain-3/#container-rule
+// The keywords `none`, `and`, `not`, and `or` are excluded from the <custom-ident> above.
+const nonContainerNameKeywords = new Set(['none', 'and', 'not', 'or']);
+
+const container = {
+ parse: {
+ prelude() {
+ const children = this.createList();
+
+ if (this.tokenType === types.Ident) {
+ const name = this.substring(this.tokenStart, this.tokenEnd);
+
+ if (!nonContainerNameKeywords.has(name.toLowerCase())) {
+ children.push(this.Identifier());
+ }
+ }
+
+ children.push(this.Condition('container'));
+
+ return children;
+ },
+ block(nested = false) {
+ return this.Block(nested);
+ }
+ }
+};
+
+module.exports = container;
diff --git a/vanilla/node_modules/css-tree/cjs/syntax/atrule/font-face.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/font-face.cjs
new file mode 100644
index 0000000..fc7f64a
--- /dev/null
+++ b/vanilla/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/vanilla/node_modules/css-tree/cjs/syntax/atrule/import.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/import.cjs
new file mode 100644
index 0000000..09fc11c
--- /dev/null
+++ b/vanilla/node_modules/css-tree/cjs/syntax/atrule/import.cjs
@@ -0,0 +1,101 @@
+'use strict';
+
+const types = require('../../tokenizer/types.cjs');
+
+function parseWithFallback(parse, fallback) {
+ return this.parseWithFallback(
+ () => {
+ try {
+ return parse.call(this);
+ } finally {
+ this.skipSC();
+ if (this.lookupNonWSType(0) !== types.RightParenthesis) {
+ this.error();
+ }
+ }
+ },
+ fallback || (() => this.Raw(null, true))
+ );
+}
+
+const parseFunctions = {
+ layer() {
+ this.skipSC();
+
+ const children = this.createList();
+ const node = parseWithFallback.call(this, this.Layer);
+
+ if (node.type !== 'Raw' || node.value !== '') {
+ children.push(node);
+ }
+
+ return children;
+ },
+ supports() {
+ this.skipSC();
+
+ const children = this.createList();
+ const node = parseWithFallback.call(
+ this,
+ this.Declaration,
+ () => parseWithFallback.call(this, () => this.Condition('supports'))
+ );
+
+ if (node.type !== 'Raw' || node.value !== '') {
+ children.push(node);
+ }
+
+ return children;
+ }
+};
+
+const importAtrule = {
+ parse: {
+ prelude() {
+ const children = this.createList();
+
+ 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');
+ }
+
+ this.skipSC();
+
+ if (this.tokenType === types.Ident &&
+ this.cmpStr(this.tokenStart, this.tokenEnd, 'layer')) {
+ children.push(this.Identifier());
+ } else if (
+ this.tokenType === types.Function &&
+ this.cmpStr(this.tokenStart, this.tokenEnd, 'layer(')
+ ) {
+ children.push(this.Function(null, parseFunctions));
+ }
+
+ this.skipSC();
+
+ if (this.tokenType === types.Function &&
+ this.cmpStr(this.tokenStart, this.tokenEnd, 'supports(')) {
+ children.push(this.Function(null, parseFunctions));
+ }
+
+ 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/vanilla/node_modules/css-tree/cjs/syntax/atrule/index.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/index.cjs
new file mode 100644
index 0000000..143f21f
--- /dev/null
+++ b/vanilla/node_modules/css-tree/cjs/syntax/atrule/index.cjs
@@ -0,0 +1,27 @@
+'use strict';
+
+const container = require('./container.cjs');
+const fontFace = require('./font-face.cjs');
+const _import = require('./import.cjs');
+const layer = require('./layer.cjs');
+const media = require('./media.cjs');
+const nest = require('./nest.cjs');
+const page = require('./page.cjs');
+const scope = require('./scope.cjs');
+const startingStyle = require('./starting-style.cjs');
+const supports = require('./supports.cjs');
+
+const atrule = {
+ container,
+ 'font-face': fontFace,
+ import: _import,
+ layer,
+ media,
+ nest,
+ page,
+ scope,
+ 'starting-style': startingStyle,
+ supports
+};
+
+module.exports = atrule;
diff --git a/vanilla/node_modules/css-tree/cjs/syntax/atrule/layer.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/layer.cjs
new file mode 100644
index 0000000..5a9ac26
--- /dev/null
+++ b/vanilla/node_modules/css-tree/cjs/syntax/atrule/layer.cjs
@@ -0,0 +1,16 @@
+'use strict';
+
+const layer = {
+ parse: {
+ prelude() {
+ return this.createSingleNodeList(
+ this.LayerList()
+ );
+ },
+ block() {
+ return this.Block(false);
+ }
+ }
+};
+
+module.exports = layer;
diff --git a/vanilla/node_modules/css-tree/cjs/syntax/atrule/media.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/media.cjs
new file mode 100644
index 0000000..5db3439
--- /dev/null
+++ b/vanilla/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(nested = false) {
+ return this.Block(nested);
+ }
+ }
+};
+
+module.exports = media;
diff --git a/vanilla/node_modules/css-tree/cjs/syntax/atrule/nest.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/nest.cjs
new file mode 100644
index 0000000..5cd6672
--- /dev/null
+++ b/vanilla/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/vanilla/node_modules/css-tree/cjs/syntax/atrule/page.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/page.cjs
new file mode 100644
index 0000000..ffef0d1
--- /dev/null
+++ b/vanilla/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/vanilla/node_modules/css-tree/cjs/syntax/atrule/scope.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/scope.cjs
new file mode 100644
index 0000000..e5ffba2
--- /dev/null
+++ b/vanilla/node_modules/css-tree/cjs/syntax/atrule/scope.cjs
@@ -0,0 +1,16 @@
+'use strict';
+
+const scope = {
+ parse: {
+ prelude() {
+ return this.createSingleNodeList(
+ this.Scope()
+ );
+ },
+ block(nested = false) {
+ return this.Block(nested);
+ }
+ }
+};
+
+module.exports = scope;
diff --git a/vanilla/node_modules/css-tree/cjs/syntax/atrule/starting-style.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/starting-style.cjs
new file mode 100644
index 0000000..8c9814d
--- /dev/null
+++ b/vanilla/node_modules/css-tree/cjs/syntax/atrule/starting-style.cjs
@@ -0,0 +1,12 @@
+'use strict';
+
+const startingStyle = {
+ parse: {
+ prelude: null,
+ block(nested = false) {
+ return this.Block(nested);
+ }
+ }
+};
+
+module.exports = startingStyle;
diff --git a/vanilla/node_modules/css-tree/cjs/syntax/atrule/supports.cjs b/vanilla/node_modules/css-tree/cjs/syntax/atrule/supports.cjs
new file mode 100644
index 0000000..b03d864
--- /dev/null
+++ b/vanilla/node_modules/css-tree/cjs/syntax/atrule/supports.cjs
@@ -0,0 +1,16 @@
+'use strict';
+
+const supports = {
+ parse: {
+ prelude() {
+ return this.createSingleNodeList(
+ this.Condition('supports')
+ );
+ },
+ block(nested = false) {
+ return this.Block(nested);
+ }
+ }
+};
+
+module.exports = supports;