Files
react-native-devtools-frontend/node_modules/postcss-media-query-parser/dist/index.js
T
Mathias Bynens 79e2cf0633 Add stylelint dependency
This also adds CC-BY-4.0 to the list of accepted licenses.

DISABLE_THIRD_PARTY_CHECK=update dependencies

Bug: chromium:1083142
Change-Id: I8612de2fba52dae32eeb71af79d5aacfde52142b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220097
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-06-11 06:20:04 +00:00

43 lines
1.5 KiB
JavaScript

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = parseMedia;
var _Container = require('./nodes/Container');
var _Container2 = _interopRequireDefault(_Container);
var _parsers = require('./parsers');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Parses a media query list into an array of nodes. A typical node signature:
* {string} node.type -- one of: 'media-query', 'media-type', 'keyword',
* 'media-feature-expression', 'media-feature', 'colon', 'value'
* {string} node.value -- the contents of a particular element, trimmed
* e.g.: `screen`, `max-width`, `1024px`
* {string} node.after -- whitespaces that follow the element
* {string} node.before -- whitespaces that precede the element
* {string} node.sourceIndex -- the index of the element in a source media
* query list, 0-based
* {object} node.parent -- a link to the parent node (a container)
*
* Some nodes (media queries, media feature expressions) contain other nodes.
* They additionally have:
* {array} node.nodes -- an array of nodes of the type described here
* {funciton} node.each -- traverses direct children of the node, calling
* a callback for each one
* {funciton} node.walk -- traverses ALL descendants of the node, calling
* a callback for each one
*/
function parseMedia(value) {
return new _Container2.default({
nodes: (0, _parsers.parseMediaList)(value),
type: 'media-query-list',
value: value.trim()
});
}