更新前端静态网页获取方式,放弃使用后端获取api

This commit is contained in:
2025-09-09 10:47:51 +08:00
parent 6889ca37e5
commit 44a4f1bae1
25558 changed files with 2463152 additions and 153 deletions

421
frontend/node_modules/csso/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,421 @@
## 4.2.0 (November 26, 2020)
- Trim Custom Property values when possible (#393)
- Fixed removing unit for zero-length dimentions in `min()`, `max()` and `clamp()` functions (#426)
- Fixed crash on bad value in TRBL declaration value (#412)
## 4.1.1 (November 15, 2020)
- Fixed build setup to exclude full `mdn/data` that reduced the lib size:
* dist/csso.js: 794.5Kb -> 255.2Kb
* dist/csso.min.js: 394.4Kb -> 194.2Kb
* package size: 237.8 kB -> 156.1 kB
* package unpacked size: 1.3 MB -> 586.8 kB
## 4.1.0 (October 27, 2020)
- Bumped [CSSTree](https://github.com/csstree/csstree) to `^1.0.0`
- Fixed wrongly merging of TRBL values when one of them contains `var()` (#420)
- Fixed wrongly merging of pseudo class and element with the same name, e.g. `:-ms-input-placeholder` and `::-ms-input-placeholder` (#383, #416)
- Fixed wrongly merging of `overflow` fallback (#415)
## 4.0.3 (March 24, 2020)
- Prevented percent sign removal in `flex`/`-ms-flex` (#410)
- Fixed restructuring optimisation in some cases (@charlessuh & @chsuh, #358, #411)
- Bumped dependencies (@AviVahl, #409)
## 4.0.2 (October 28, 2019)
- Fixed clean stage to avoid exceptions when source has unparsed or bad parts (#380)
- Fixed wrong percentage sign removal for zero values (#395)
## 4.0.1 (October 22, 2019)
- Bumped CSSTree to [`1.0.0-alpha.37`](https://github.com/csstree/csstree/releases/tag/v1.0.0-alpha.37) to avoid source map generation inconsistency across Node.js versions
## 4.0.0 (October 21, 2019)
- Dropped support for Node.js < 8
- Refreshed dev dependencies and scripts
- Bumped [CSSTree](https://github.com/csstree/csstree) to `1.0.0-alpha.36` (#399)
- Changed bundle files: `dist/csso.js` and `dist/csso.min.js` instead single `dist/csso-browser.js` (min version)
- Expose `compress()` as `syntax.compress()`
## 3.5.1 (June 7, 2018)
- Bumped [CSSTree](https://github.com/csstree/csstree) to `1.0.0-alpha.29` (fixes some issues)
## 3.5.0 (January 14, 2018)
- Migrated to [CSSTree](https://github.com/csstree/csstree) `1.0.0-alpha.27`
## 3.4.0 (November 3, 2017)
- Added percent sign removal for zero percentages for some properties that is safe (@RubaXa, #286)
- Removed unit removal for zero values in `-ms-flex` due it breaks flex in IE10/11 (#362)
- Improved performance of selectors comparison (@smelukov, #343)
## 3.3.1 (October 17, 2017)
- Fixed merge of `position` declarations when `sticky` fallback is using (@gruzzilkin, #356)
## 3.3.0 (October 12, 2017)
- Migrated to [CSSTree](https://github.com/csstree/csstree) `1.0.0-alpha25`
- Changed AST format (see [CSSTree change log](https://github.com/csstree/csstree/blob/master/HISTORY.md) for details)
- Fixed performance issue when generate CSS with source map (quadratic increase in time depending on the size of the CSS)
## 3.2.0 (September 10, 2017)
- Fixed named color compression to apply only when an identifier is guaranteed to be a color
- Added lifting of `@keyframes` to the beginning of style sheet (chunk), but after `@charset` and `@import` rules
- Added removal of `@keyframes`, `@media` and `@supports` with no prelude
- Added removal of duplicate `@keyframes` (#202)
- Added new option `forceMediaMerge` to force media rules merging. It's unsafe in general, but works fine in many cases. Use it on your own risk (#350)
- Bumped `CSSTree` to `1.0.0-alpha23`
## 3.1.1 (April 25, 2017)
- Fixed crash on a number processing when it used not in a list (#335)
## 3.1.0 (April 24, 2017)
- Implemented optimisation for `none` keyword in `border` and `outline` properties (@zoobestik, #41)
- Implemented replacing `rgba(x, x, x, 0)` to `transparent`
- Fixed plus sign omitting for numbers following identifier, hex color, number or unicode range, since it can change the meaning of CSS (e.g. `calc(1px+2px)` has been optimized to `calc(1px2px)` before, now it stays the same)
- Improved usage filtering for nested selectors (i.e. for `:nth-*()`, `:has()`, `:matches` and other pseudos)
- Implemented `blacklist` filtering in usage (#334, see [Black list filtering](https://github.com/css/csso#black-list-filtering))
- Improved white space removing, now white spaces are removing in the beginning and at the ending of sequences, and between stylesheet and block nodes
- Bumped `CSSTree` to `1.0.0-alpha19`
## 3.0.1 (March 14, 2017)
- Fixed declaration merging when declaration contains an `!important`
## 3.0.0 (March 13, 2017)
- Migrated to [CSSTree](https://github.com/csstree/csstree) as AST backend and exposed its API behind `syntax` property
- Extracted CLI into standalone package [css/csso-cli](https://github.com/css/csso-cli)
## 2.3.1 (January 6, 2017)
- Added `\0` IE hack support (#320)
## 2.3.0 (October 25, 2016)
- Added `beforeCompress` and `afterCompress` options support (#316)
- Fixed crash on empty argument in function (#317)
## 2.2.1 (July 25, 2016)
- Fixed shorthand optimisation issue when value has a color value or something unknown (#311)
- Fixed `cursor` broken fallback (#306)
## 2.2.0 (June 23, 2016)
- Implement AST cloning by adding `clone()` [function](https://github.com/css/csso#cloneast) and `clone` [option](https://github.com/css/csso#compressast-options) for `compress()` function (#296)
- Fix parse and translate attribute selector with flags but w/o operator (i.e. `[attrName i]`)
- Don't merge rules with flagged attribute selectors with others (#291)
- Take in account functions when merge TRBL-properties (#297, thanks to @ArturAralin)
- Improve partial merge (#304)
- Tweak scanner, reduce code deoptimizations and other small improvements
## 2.1.1 (May 11, 2016)
- Fix wrong declaration with `\9` hack merge (#295)
## 2.1.0 (May 8, 2016)
- New option `comments` to specify what comments to left: `exclamation`, `first-exclamation` and `none`
- Add `offset` to CSS parse error details
- Fix token `offset` computation
## 2.0.0 (April 5, 2016)
- No more `gonzales` AST format and related code
- `minify()` and `minifyBlock()` is always return an object as result now (i.e. `{ css: String, map: SourceMapGenerator or null }`)
- `parse()`
- Returns AST in new format (so called `internal`)
- Dynamic scanner implemented
- New AST format + dynamic scanner = performance boost and less memory consumption
- No more `context` argument, context should be specified via `options`
- Supported contexts now: `stylesheet`, `atrule`, `atruleExpression`, `ruleset`, `selector`, `simpleSelector`, `block`, `declaration` and `value`
- Drop `needPositions` option, `positions` option should be used instead
- Drop `needInfo` option, `info` object is attaching to nodes when some information is requested by `options`
- `options` should be an object, otherwise it treats as empty object
- `compress()`
- No more AST converting (performance boost and less memory consumption)
- Drop `outputAst` option
- Returns an object as result instead of AST (i.e. `{ ast: Object }`)
- Drop methods: `justDoIt()`, `stringify()`, `cleanInfo()`
## 1.8.1 (March 30, 2016)
- Don't remove spaces after function/braces/urls since unsafe (#289)
## 1.8.0 (March 24, 2016)
- Usage data support:
- Filter rulesets by tag names, class names and ids white lists.
- More aggressive ruleset moving using class name scopes information.
- New CLI option `--usage` to pass usage data file.
- Improve initial ruleset merge
- Change order of ruleset processing, now it's left to right. Previously unmerged rulesets may prevent lookup and other rulesets merge.
- Difference in pseudo signature just prevents ruleset merging, but don't stop lookup.
- Simplify block comparison (performance).
- New method `csso.minifyBlock()` for css block compression (e.g. `style` attribute content).
- Ruleset merge improvement: at-rules with block (like `@media` or `@supports`) now can be skipped during ruleset merge lookup if doesn't contain something prevents it.
- FIX: Add negation (`:not()`) to pseudo signature to avoid unsafe merge (old browsers doesn't support it).
- FIX: Check nested parts of value when compute compatibility. It fixes unsafe property merging.
## 1.7.1 (March 16, 2016)
- pass block mode to tokenizer for correct parsing of declarations properties with `//` hack
- fix wrongly `@import` and `@charset` removal on double exclamation comment
## 1.7.0 (March 10, 2016)
- support for [CSS Custom Properties](https://www.w3.org/TR/css-variables/) (#279)
- rework RTBL properties merge better merge for values with special units and don't merge values with CSS-wide keywords (#255)
- remove redundant universal selectors (#178)
- take in account `!important` when check for property overriding (#280)
- don't merge `text-align` declarations with some values (#281)
- add spaces around `/deep/` combinator on translate, since it together with universal selector can produce a comment
- better keyword and property name resolving (tolerant to hacks and so on)
- integration improvements
- compression log function could be customized by `logger` option for `compress()` and `minify()`
- make possible to set initial line and column for parser
## 1.6.4 (March 1, 2016)
- `npm` publish issue (#276)
## 1.6.3 (February 29, 2016)
- add `file` to generated source map since other tools can relay on it in source map transform chain
## 1.6.2 (February 29, 2016)
- tweak some parse error messages and their positions
- fix `:not()` parsing and selector groups in `:not()` is supported now (#215)
- `needPosition` parser option is deprecated, `positions` option should be used instead (`needPosition` is used still if `positions` option omitted)
- expose internal AST API as `csso.internal.*`
- `minify()` adds `sourcesContent` by default when source map is generated
- bring back support for node.js `0.10` until major release (#275)
## 1.6.1 (February 28, 2016)
- fix exception on zero length dimension compress outside declaration (#273)
## 1.6.0 (February 27, 2016)
- **source maps support**
- parser remake:
- various parsing issues fixed
- fix unicode sequence processing in ident (#191)
- support for flags in attribute selector (#270)
- position (line and column) of parse error (#109)
- 4x performance boost, less memory consumption
- compressor refactoring
- internal AST is using doubly linked lists (with safe transformation support during iteration) instead of arrays
- rename `restructuring` to `restructure` option for `minify()`/`compress()` (`restructuring` is alias for `restructure` now, with lower priority)
- unquote urls when possible (#141, #60)
- setup code coverage and a number of related fixes
- add eslint to check unused things
## 1.5.4 (January 27, 2016)
- one more fix (in `restructRuleset` this time) with merge of rulesets when a ruleset with same specificity places between them (#264)
- disable partial merge of rulesets in `@keyframes` rulesets (until sure it's correct)
## 1.5.3 (January 25, 2016)
- don't override display values with different browser support (#259)
- fix publish issue (one of modules leak in development state)
## 1.5.2 (January 24, 2016)
- don't merge rulesets if between them a ruleset with same specificity (#264)
## 1.5.1 (January 14, 2016)
- ensure `-` is not used as an identifier in attribute selectors (thanks to @mathiasbynens)
- fix broken `justDoIt()` function
- various small fixes
## 1.5.0 (January 14, 2016)
### Parser
- attach minus to number
### Compressor
- split code base into small modules and related refactoring
- introduce internal AST format for compressor (`gonzales``internal` and `internal``gonzales` convertors, walkers, translator)
- various optimizations: no snapshots, using caches and indexes
- sort selectors, merge selectors in alphabet order
- compute selector's specificity
- better ruleset restructuring, improve compression of partially equal blocks
- better ruleset merge not only closest but also disjoined by other rulesets when safe
- join `@media` with same query
- `outputAst` new option to specify output AST format (`gonzales` by default for backward compatibility)
- remove quotes surrounding attribute values in attribute selectors when possible (#73)
- replace `from``0%` and `100%``to` at `@keyframes` (#205)
- prevent partial merge of rulesets at `@keyframes` (#80, #197)
### API
- walker for `gonzales` AST was implemented
### CLI
- new option `--stat` (output stat in `stderr`)
- new optional parameter `level` for `--debug` option
## 1.4.4 (December 10, 2015)
- prevent removal of spaces after braces that before identifier that breaking at-rules expressions (#258)
## 1.4.3 (December 4, 2015)
- fix unicode-range parsing that cause to wrong function detection (#250)
## 1.4.2 (November 9, 2015)
- allow spaces between `progid:` and rest part of value for IE's `filter` property as `autoprefixer` generates this kind of code (#249)
- fixes for Windows:
- correct processing new lines
- normalize file content in test suite
- fixes to work in strict mode (#252)
- init compressor dictionaries for every css block (#248, #251)
- bump uglify-js version
## 1.4.1 (October 20, 2015)
- allow merge for `display` property (#167, #244)
- more accurate `rect` (`clip` property value) merge
- fix typo when specifying options in cli (thanks to @Taritsyn)
- fix safe unit values merge with keyword values (#244)
- fix wrong descendant combinator removal (#246)
- build browser version on `prepublish` (thanks to @silentroach)
- parser: store whitespaces as single token (performance and reduce memory consumption)
- rearrange compress tests layout
## 1.4 (October 16, 2015)
Bringing project back to life. Changed files structure, cleaned up and refactored most of sources.
### Common
- single code base (no more `src` folder)
- build browser version with `browserify` (no more `make`, and `web` folder), browser version is available at `dist/csso-browser.js`
- main file is `lib/index.js` now
- minimal `node.js` version is `0.12` now
- restrict file list to publish on npm (no more useless folders and files in package)
- add `jscs` to control code style
- automate `gh-pages` update
- util functions reworked
- translator reworked
- test suite reworked
- compressor refactored
- initial parser refactoring
### API
- new method `minify(src, options)`, options:
- `restructuring` if set to `false`, disable structure optimisations (`true` by default)
- `debug` - outputs intermediate state of CSS during compression (`false` by default)
- deprecate `justDoIt()` method (use `minify` instead)
- rename `treeToString()` method to `stringify()`
- drop `printTree()` method
- AST node info
- `column` and `offset` added
- `ln` renamed to `line`
- fix line counting across multiple files and input with CR LF (#147)
### CLI
- completely reworked, use [clap](https://github.com/lahmatiy/clap) to parse argv
- add support for input from stdin (#128)
- drop undocumented and obsoleted options `--rule` and `--parser` (suppose nobody use it)
- drop `-off` alias for `--restructure-off` as incorrect (only one letter options should starts with single `-`)
- new option `--debug` that reflecting to `options.debug` for `minify`
### Parsing and optimizations
- keep all exclamation comments (#194)
- add `/deep/` combinator support (#209)
- attribute selector
- allow colon in attribute name (#237)
- support for namespaces (#233)
- color
- support all css/html colors
- convert `hsla` to `rgba` and `hls` to `rgb`
- convert `rgba` with 1 as alpha value to `rgb` (#122)
- interpolate `rgb` and `rgba` percentage values to absolute values
- replace percentage values in `rgba` for normalized/interpolated values
- lowercase hex colors and color names (#169)
- fix color minification when hex value replaced for color name (#176)
- fit rgb values to 0..255 range (#181)
- calc
- remove spaces for multiple operator in calc
- don't remove units inside calc (#222)
- fix wrong white space removal around `+` and `-` (#228)
- don't remove units in `flex` property as it could change value meaning (#200)
- don't merge `\9` hack values (#231)
- merge property values only if they have the same functions (#150, #227)
- don't merge property values with some sort of units (#140, #161)
- fix `!important` issue for `top-right-bottom-left` properties (#189)
- fix `top-right-bottom-left` properties merge (#139, #175)
- support for unicode-range (#148)
- don't crash on ruleset with no selector (#135)
- tolerant to class names that starts with digit (#99, #105)
- fix background compressing (#170)
## 1.3.12 (October 8, 2015)
- Case insensitive check for `!important` (#187)
- Fix problems with using `csso` as cli command on Windows (#83, #136, #142 and others)
- Remove byte order marker (the UTF-8 BOM) from input
- Don't strip space between funktion-funktion and funktion-vhash (#134)
- Don't merge TRBL values having \9 (hack for IE8 in bootstrap) (#159, #214, #230, #231 and others)
- Don't strip units off dimensions of non-length (#226, #229 and others)
## 1.3.7 (February 11, 2013)
- Gonzales 1.0.7.
## 1.3.6 (November 26, 2012)
- Gonzales 1.0.6.
## 1.3.5 (October 28, 2012)
- Gonzales 1.0.5.
- Protecting copyright notices in CSS: https://github.com/css/csso/issues/92
- Zero CSS throws an error: https://github.com/css/csso/issues/96
- Don't minify the second `0s` in Firefox for animations: https://github.com/css/csso/issues/100
- Japan manual
- BEM ready documentation
## 1.3.4 (October 10, 2012)
- @page inside @media Causes Error: https://github.com/css/csso/issues/90
## 1.3.3 (October 9, 2012)
- CSSO 1.3.2 compresses ".t-1" and ".t-01" as identical classes: https://github.com/css/csso/issues/88
## 1.3.2 (October 8, 2012)
- filter + important breaks CSSO v1.3.1: https://github.com/css/csso/issues/87
## 1.3.1 (October 8, 2012)
- "filter" IE property breaks CSSO v1.3.0: https://github.com/css/csso/issues/86
## 1.3.0 (October 4, 2012)
- PeCode CSS parser replaced by Gonzales CSS parser

20
frontend/node_modules/csso/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
Copyright (C) 2015-2019 by Roman Dvornov
Copyright (C) 2011-2015 by Sergey Kryzhanovsky
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

372
frontend/node_modules/csso/README.md generated vendored Normal file
View File

@@ -0,0 +1,372 @@
[![NPM version](https://img.shields.io/npm/v/csso.svg)](https://www.npmjs.com/package/csso)
[![Build Status](https://travis-ci.org/css/csso.svg?branch=master)](https://travis-ci.org/css/csso)
[![Coverage Status](https://coveralls.io/repos/github/css/csso/badge.svg?branch=master)](https://coveralls.io/github/css/csso?branch=master)
[![NPM Downloads](https://img.shields.io/npm/dm/csso.svg)](https://www.npmjs.com/package/csso)
[![Twitter](https://img.shields.io/badge/Twitter-@cssoptimizer-blue.svg)](https://twitter.com/cssoptimizer)
CSSO (CSS Optimizer) is a CSS minifier. It performs three sort of transformations: cleaning (removing redundant), compression (replacement for shorter form) and restructuring (merge of declarations, rulesets and so on). As a result your CSS becomes much smaller.
[![Originated by Yandex](https://cdn.rawgit.com/css/csso/8d1b89211ac425909f735e7d5df87ee16c2feec6/docs/yandex.svg)](https://www.yandex.com/)
[![Sponsored by Avito](https://cdn.rawgit.com/css/csso/8d1b89211ac425909f735e7d5df87ee16c2feec6/docs/avito.svg)](https://www.avito.ru/)
## Ready to use
- [Web interface](http://css.github.io/csso/csso.html)
- [csso-cli](https://github.com/css/csso-cli) command line interface
- [gulp-csso](https://github.com/ben-eb/gulp-csso) `Gulp` plugin
- [grunt-csso](https://github.com/t32k/grunt-csso) `Grunt` plugin
- [broccoli-csso](https://github.com/sindresorhus/broccoli-csso) `Broccoli` plugin
- [postcss-csso](https://github.com/lahmatiy/postcss-csso) `PostCSS` plugin
- [csso-loader](https://github.com/sandark7/csso-loader) `webpack` loader
- [csso-webpack-plugin](https://github.com/zoobestik/csso-webpack-plugin) `webpack` plugin
- [CSSO Visual Studio Code plugin](https://marketplace.visualstudio.com/items?itemName=Aneryu.csso)
## Install
```
npm install csso
```
## API
<!-- TOC depthfrom:3 -->
- [minify(source[, options])](#minifysource-options)
- [minifyBlock(source[, options])](#minifyblocksource-options)
- [syntax.compress(ast[, options])](#syntaxcompressast-options)
- [Source maps](#source-maps)
- [Usage data](#usage-data)
- [White list filtering](#white-list-filtering)
- [Black list filtering](#black-list-filtering)
- [Scopes](#scopes)
<!-- /TOC -->
Basic usage:
```js
var csso = require('csso');
var minifiedCss = csso.minify('.test { color: #ff0000; }').css;
console.log(minifiedCss);
// .test{color:red}
```
CSSO is based on [CSSTree](https://github.com/csstree/csstree) to parse CSS into AST, AST traversal and to generate AST back to CSS. All `CSSTree` API is available behind `syntax` field. You may minify CSS step by step:
```js
var csso = require('csso');
var ast = csso.syntax.parse('.test { color: #ff0000; }');
var compressedAst = csso.syntax.compress(ast).ast;
var minifiedCss = csso.syntax.generate(compressedAst);
console.log(minifiedCss);
// .test{color:red}
```
> Warning: CSSO uses early versions of CSSTree that still in active development. CSSO doesn't guarantee API behind `syntax` field or AST format will not change in future releases of CSSO, since it's subject to change in CSSTree. Be careful with CSSO updates if you use `syntax` API until this warning removal.
### minify(source[, options])
Minify `source` CSS passed as `String`.
```js
var result = csso.minify('.test { color: #ff0000; }', {
restructure: false, // don't change CSS structure, i.e. don't merge declarations, rulesets etc
debug: true // show additional debug information:
// true or number from 1 to 3 (greater number - more details)
});
console.log(result.css);
// > .test{color:red}
```
Returns an object with properties:
- css `String` resulting CSS
- map `Object` instance of [`SourceMapGenerator`](https://github.com/mozilla/source-map#sourcemapgenerator) or `null`
Options:
- sourceMap
Type: `Boolean`
Default: `false`
Generate a source map when `true`.
- filename
Type: `String`
Default: `'<unknown>'`
Filename of input CSS, uses for source map generation.
- debug
Type: `Boolean`
Default: `false`
Output debug information to `stderr`.
- beforeCompress
Type: `function(ast, options)` or `Array<function(ast, options)>` or `null`
Default: `null`
Called right after parse is run.
- afterCompress
Type: `function(compressResult, options)` or `Array<function(compressResult, options)>` or `null`
Default: `null`
Called right after [`syntax.compress()`](#syntaxcompressast-options) is run.
- Other options are the same as for [`syntax.compress()`](#syntaxcompressast-options) function.
### minifyBlock(source[, options])
The same as `minify()` but for list of declarations. Usually it's a `style` attribute value.
```js
var result = csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000');
console.log(result.css);
// > color:red
```
### syntax.compress(ast[, options])
Does the main task compress an AST. This is CSSO's extension in CSSTree syntax API.
> NOTE: `syntax.compress()` performs AST compression by transforming input AST by default (since AST cloning is expensive and needed in rare cases). Use `clone` option with truthy value in case you want to keep input AST untouched.
Returns an object with properties:
- ast `Object` resulting AST
Options:
- restructure
Type: `Boolean`
Default: `true`
Disable or enable a structure optimisations.
- forceMediaMerge
Type: `Boolean`
Default: `false`
Enables merging of `@media` rules with the same media query by splitted by other rules. The optimisation is unsafe in general, but should work fine in most cases. Use it on your own risk.
- clone
Type: `Boolean`
Default: `false`
Transform a copy of input AST if `true`. Useful in case of AST reuse.
- comments
Type: `String` or `Boolean`
Default: `true`
Specify what comments to leave:
- `'exclamation'` or `true` leave all exclamation comments (i.e. `/*! .. */`)
- `'first-exclamation'` remove every comment except first one
- `false` remove all comments
- usage
Type: `Object` or `null`
Default: `null`
Usage data for advanced optimisations (see [Usage data](#usage-data) for details)
- logger
Type: `Function` or `null`
Default: `null`
Function to track every step of transformation.
### Source maps
To get a source map set `true` for `sourceMap` option. Additianaly `filename` option can be passed to specify source file. When `sourceMap` option is `true`, `map` field of result object will contain a [`SourceMapGenerator`](https://github.com/mozilla/source-map#sourcemapgenerator) instance. This object can be mixed with another source map or translated to string.
```js
var csso = require('csso');
var css = fs.readFileSync('path/to/my.css', 'utf8');
var result = csso.minify(css, {
filename: 'path/to/my.css', // will be added to source map as reference to source file
sourceMap: true // generate source map
});
console.log(result);
// { css: '...minified...', map: SourceMapGenerator {} }
console.log(result.map.toString());
// '{ .. source map content .. }'
```
Example of generating source map with respect of source map from input CSS:
```js
var require('source-map');
var csso = require('csso');
var inputFile = 'path/to/my.css';
var input = fs.readFileSync(inputFile, 'utf8');
var inputMap = input.match(/\/\*# sourceMappingURL=(\S+)\s*\*\/\s*$/);
var output = csso.minify(input, {
filename: inputFile,
sourceMap: true
});
// apply input source map to output
if (inputMap) {
output.map.applySourceMap(
new SourceMapConsumer(inputMap[1]),
inputFile
)
}
// result CSS with source map
console.log(
output.css +
'/*# sourceMappingURL=data:application/json;base64,' +
new Buffer(output.map.toString()).toString('base64') +
' */'
);
```
### Usage data
`CSSO` can use data about how `CSS` is used in a markup for better compression. File with this data (`JSON`) can be set using `usage` option. Usage data may contain following sections:
- `blacklist` a set of black lists (see [Black list filtering](#black-list-filtering))
- `tags` white list of tags
- `ids` white list of ids
- `classes` white list of classes
- `scopes` groups of classes which never used with classes from other groups on the same element
All sections are optional. Value of `tags`, `ids` and `classes` should be an array of a string, value of `scopes` should be an array of arrays of strings. Other values are ignoring.
#### White list filtering
`tags`, `ids` and `classes` are using on clean stage to filter selectors that contain something not in the lists. Selectors are filtering only by those kind of simple selector which white list is specified. For example, if only `tags` list is specified then type selectors are checking, and if all type selectors in selector present in list or selector has no any type selector it isn't filter.
> `ids` and `classes` are case sensitive, `tags` is not.
Input CSS:
```css
* { color: green; }
ul, ol, li { color: blue; }
UL.foo, span.bar { color: red; }
```
Usage data:
```json
{
"tags": ["ul", "LI"]
}
```
Resulting CSS:
```css
*{color:green}ul,li{color:blue}ul.foo{color:red}
```
Filtering performs for nested selectors too. `:not()` pseudos content is ignoring since the result of matching is unpredictable. Example for the same usage data as above:
```css
:nth-child(2n of ul, ol) { color: red }
:nth-child(3n + 1 of img) { color: yellow }
:not(div, ol, ul) { color: green }
:has(:matches(ul, ol), ul, ol) { color: blue }
```
Turns into:
```css
:nth-child(2n of ul){color:red}:not(div,ol,ul){color:green}:has(:matches(ul),ul){color:blue}
```
#### Black list filtering
Black list filtering performs the same as white list filtering, but filters things that mentioned in the lists. `blacklist` can contain the lists `tags`, `ids` and `classes`.
Black list has a higher priority, so when something mentioned in the white list and in the black list then white list occurrence is ignoring. The `:not()` pseudos content ignoring as well.
```css
* { color: green; }
ul, ol, li { color: blue; }
UL.foo, li.bar { color: red; }
```
Usage data:
```json
{
"blacklist": {
"tags": ["ul"]
},
"tags": ["ul", "LI"]
}
```
Resulting CSS:
```css
*{color:green}li{color:blue}li.bar{color:red}
```
#### Scopes
Scopes is designed for CSS scope isolation solutions such as [css-modules](https://github.com/css-modules/css-modules). Scopes are similar to namespaces and define lists of class names that exclusively used on some markup. This information allows the optimizer to move rules more agressive. Since it assumes selectors from different scopes don't match for the same element. This can improve rule merging.
Suppose we have a file:
```css
.module1-foo { color: red; }
.module1-bar { font-size: 1.5em; background: yellow; }
.module2-baz { color: red; }
.module2-qux { font-size: 1.5em; background: yellow; width: 50px; }
```
It can be assumed that first two rules are never used with the second two on the same markup. But we can't say that for sure without a markup review. The optimizer doesn't know it either and will perform safe transformations only. The result will be the same as input but with no spaces and some semicolons:
```css
.module1-foo{color:red}.module1-bar{font-size:1.5em;background:#ff0}.module2-baz{color:red}.module2-qux{font-size:1.5em;background:#ff0;width:50px}
```
With usage data `CSSO` can produce better output. If follow usage data is provided:
```json
{
"scopes": [
["module1-foo", "module1-bar"],
["module2-baz", "module2-qux"]
]
}
```
The result will be (29 bytes extra saving):
```css
.module1-foo,.module2-baz{color:red}.module1-bar,.module2-qux{font-size:1.5em;background:#ff0}.module2-qux{width:50px}
```
If class name isn't mentioned in the `scopes` it belongs to default scope. `scopes` data doesn't affect `classes` whitelist. If class name mentioned in `scopes` but missed in `classes` (both sections are specified) it will be filtered.
Note that class name can't be set for several scopes. Also a selector can't have class names from different scopes. In both cases an exception will thrown.
Currently the optimizer doesn't care about changing order safety for out-of-bounds selectors (i.e. selectors that match to elements without class name, e.g. `.scope div` or `.scope ~ :last-child`). It assumes that scoped CSS modules doesn't relay on it's order. It may be fix in future if to be an issue.

View File

@@ -0,0 +1,590 @@
## 1.1.3 (March 31, 2021)
- Fixed matching on CSS wide keywords for at-rule's prelude and descriptors
- Added `fit-content` to `width` property patch as browsers are supported it as a keyword (nonstandard), but spec defines it as a function
- Fixed parsing a value contains parentheses or brackets and `parseValue` option is set to `false`, in that case `!important` was included into a value but must not (#155)
## 1.1.2 (November 26, 2020)
- Rolled back to use spread syntax in object literals since it not supported by nodejs < 8.3 (#145)
## 1.1.1 (November 18, 2020)
- Fixed edge cases in mismatch location computation for `SyntaxMatchError`
## 1.1.0 (November 17, 2020)
- Bumped `mdn-data` to 2.0.14
- Extended `fork()` method to allow append syntax instead of overriding for `types`, `properties` and `atrules`, e.g. `csstree.fork({ types: { color: '| foo | bar' } })`
- Extended lexer API for validation
- Added `Lexer#checkAtruleName(atruleName)`, `Lexer#checkAtrulePrelude(atruleName, prelude)`, `Lexer#checkAtruleDescriptorName(atruleName, descriptorName)` and `Lexer#checkPropertyName(propertyName)`
- Added `Lexer#getAtrule(atruleName, fallbackBasename)` method
- Extended `Lexer#getAtrulePrelude()` and `Lexer#getProperty()` methods to take `fallbackBasename` parameter
- Improved `SyntaxMatchError` location details
- Changed error messages
## 1.0.1 (November 11, 2020)
- Fixed edge cases for parsing of custom property value with a single whitespace when `parseCustomProperty:true`
## 1.0.0 (October 27, 2020)
- Added `onComment` option to parser config
- Added support for `break` and `skip` values in `walk()` to control traversal
- Added `List#reduce()` and `List#reduceRight()` methods
- Bumped `mdn-data` to 2.0.12
- Exposed version of the lib (i.e. `import { version } from 'css-tree'`)
- Fixed `Lexer#dump()` to dump atrules syntaxes as well
- Fixed matching comma separated `<urange>` list (#135)
- Renamed `HexColor` node type into `Hash`
- Removed `element()` specific parsing rules
- Removed `dist/default-syntax.json` from package
## 1.0.0-alpha.39 (December 5, 2019)
- Fixed walker with `visit: "Declaration"` to iterate `DeclarationList` (#114)
## 1.0.0-alpha.38 (November 25, 2019)
- Bumped `mdn-data` to `2.0.6`
- Added initial implmentation for at-rule matching via `Lexer#matchAtrulePrelude()` and `Lexer#matchAtruleDescriptor()` methods
- Added `-moz-control-character-visibility`, `-ms-grid-columns`, `-ms-grid-rows` and `-ms-hyphenate-limit-last` properties to patch (#111)
- Added `flow`, `flow-root` and `table-caption` values to patched `display` (#112)
## 1.0.0-alpha.37 (October 22, 2019)
- Bumped `source-map` version to `^0.6.1` to fix source map generation inconsistency across node.js versions due to mappings sorting bug and v8 moving to [a stable Array#sort](https://v8.dev/blog/array-sort) ([fix commit](https://github.com/mozilla/source-map/commit/f35a2e4212dd025cb5e1fc219e7ac8a4b96c2cc9) in `source-map`)
## 1.0.0-alpha.36 (October 13, 2019)
- Dropped support for Node < 8
- Updated dev deps (fixed `npm audit` issues)
- Reworked build pipeline
- Package provides `dist/csstree.js` and `dist/csstree.min.js` now (instead of single `dist/csstree.js` that was a min version)
- Bundle size (min version) reduced from 191Kb to 158Kb due to some optimisations
- Definition syntax
- Renamed `grammar` into `definitionSyntax` (named per spec)
- Added `compact` option to `generate()` method to avoid formatting (spaces) when possible
- Lexer
- Changed `dump()` method to produce syntaxes in compact form by default
## 1.0.0-alpha.35 (October 7, 2019)
- Walker
- Changed implementation to avoid runtime compilation due to CSP issues (see #91, #109)
- Added `find()`, `findLast()` and `findAll()` methods (e.g. `csstree.find(ast, node => node.type === 'ClassSelector')`)
## 1.0.0-alpha.34 (July 27, 2019)
- Tokenizer
- Added `isBOM()` function
- Added `charCodeCategory()` function
- Removed `firstCharOffset()` function (use `isBOM()` instead)
- Removed `CHARCODE` dictionary
- Removed `INPUT_STREAM_CODE*` dictionaries
- Lexer
- Allowed comments in matching value (just ignore them like whitespaces)
- Increased iteration count in value matching from 10k up to 15k
- Fixed missed `debugger` (#104)
## 1.0.0-alpha.33 (July 11, 2019)
- Lexer
- Fixed low priority productions matching by changing an approach for robust one (#103)
## 1.0.0-alpha.32 (July 11, 2019)
- Lexer
- Fixed low priority productions matching in long `||-` and `&&-` groups (#103)
## 1.0.0-alpha.31 (July 11, 2019)
- Bumped `mdn/data` to `2.0.4` (#99)
- Lexer
- Added [bracketed range notation](https://drafts.csswg.org/css-values-4/#numeric-ranges) support and related refactoring
- Removed `<number-zero-one>`, `<number-one-or-greater>` and `<positive-integer>` from generic types. In fact, types moved to patch, because those types can be expressed in a regular grammar due to bracketed range notation implemented
- Added support for multiple token string matching
- Improved `<custom-ident>` production matching to claim the keyword only if no other unfulfilled production can claim it (#101)
- Improved `<length>` production matching to claim "unitless zero" only if no other unfulfilled production can claim it
- Changed lexer's constructor to prevent generic types override when used
- Fixed large `||`- and `&&`-group matching, matching continues from the beginning on term match (#85)
- Fixed checking that value has `var()` occurrences when value is a string (such values can't be matched on syntax currently and fail with specific error that can be used for ignorance in validation tools)
- Fixed `<declaration-value>` and `<any-value>` matching when a value contains a function, parentheses or braces
## 1.0.0-alpha.30 (July 3, 2019)
- Bumped `mdn/data` to `~2.0.3`
- Removed type removals from `mdn/data` due to lack of some generic types and specific lexer restictions (since lexer was reworked, see below)
- Reduced and updated patches
- Tokenizer
- Reworked tokenizer itself to compliment [CSS Syntax Module Level 3](https://drafts.csswg.org/css-syntax/#tokenization)
- `Tokenizer` class splitted into several abstractions:
- Added `TokenStream` class
- Added `OffsetToLocation` class
- Added `tokenize()` function that creates `TokenStream` instance for given string or updates a `TokenStream` instance passed as second parameter
- Removed `Tokenizer` class
- Removed `Raw` token type
- Renamed `Identifier` token type to `Ident`
- Added token types: `Hash`, `BadString`, `BadUrl`, `Delim`, `Percentage`, `Dimension`, `Colon`, `Semicolon`, `Comma`, `LeftSquareBracket`, `RightSquareBracket`, `LeftParenthesis`, `RightParenthesis`, `LeftCurlyBracket`, `RightCurlyBracket`
- Replaced `Punctuator` with `Delim` token type, that excludes specific characters with its own token type like `Colon`, `Semicolon` etc
- Removed `findCommentEnd`, `findStringEnd`, `findDecimalNumberEnd`, `findNumberEnd`, `findEscapeEnd`, `findIdentifierEnd` and `findUrlRawEnd` helper function
- Removed `SYMBOL_TYPE`, `PUNCTUATION` and `STOP_URL_RAW` dictionaries
- Added `isDigit`, `isHexDigit`, `isUppercaseLetter`, `isLowercaseLetter`, `isLetter`, `isNonAscii`, `isNameStart`, `isName`, `isNonPrintable`, `isNewline`, `isWhiteSpace`, `isValidEscape`, `isIdentifierStart`, `isNumberStart`, `consumeEscaped`, `consumeName`, `consumeNumber` and `consumeBadUrlRemnants` helper functions
- Parser
- Changed parsing algorithms to work with new token type set
- Changed `HexColor` consumption in way to relax checking a value, i.e. now `value` is a sequence of one or more name chars
- Added `&` as a property hack
- Relaxed `var()` parsing to only check that a first arguments is an identifier (not a custom property name as before)
- Lexer
- Reworked syntax matching to relay on token set only (having AST is optional now)
- Extended `Lexer#match()`, `Lexer#matchType()` and `Lexer#matchProperty()` methods to take a string as value, beside AST as a value
- Extended `Lexer#match()` method to take a string as a syntax, beside of syntax descriptor
- Reworked generic types:
- Removed `<attr()>`, `<url>` (moved to patch) and `<progid>` types
- Added types:
- Related to token types: `<ident-token>`, `<function-token>`, `<at-keyword-token>`, `<hash-token>`, `<string-token>`, `<bad-string-token>`, `<url-token>`, `<bad-url-token>`, `<delim-token>`, `<number-token>`, `<percentage-token>`, `<dimension-token>`, `<whitespace-token>`, `<CDO-token>`, `<CDC-token>`, `<colon-token>`, `<semicolon-token>`, `<comma-token>`, `<[-token>`, `<]-token>`, `<(-token>`, `<)-token>`, `<{-token>` and `<}-token>`
- Complex types: `<an-plus-b>`, `<urange>`, `<custom-property-name>`, `<declaration-value>`, `<any-value>` and `<zero>`
- Renamed `<unicode-range>` to `<urange>` as per spec
- Renamed `<expression>` (IE legacy extension) to `<-ms-legacy-expression>` and may to be removed in next releases
## 1.0.0-alpha.29 (May 30, 2018)
- Lexer
- Syntax matching was completely reworked. Now it's token-based and uses state machine. Public API has not changed. However, some internal data structures have changed. Most significal change in syntax match result tree structure, it's became token-based instead of node-based.
- Grammar
- Changed grammar tree format:
- Added `Token` node type to represent a single code point (`<delim-token>`)
- Added `Multiplier` that wraps a single node (`term` property)
- Added `AtKeyword` to represent `<at-keyword-token>`
- Removed `Slash` and `Percent` node types, they are replaced for a node with `Token` type
- Changed `Function` to represent `<function-token>` with no children
- Removed `multiplier` property from `Group`
- Changed `generate()` method:
- Method takes an `options` as second argument now (`generate(node, forceBraces, decorator)` -> `generate(node, options)`). Two options are supported: `forceBraces` and `decorator`
- When a second parameter is a function it treats as `decorate` option value, i.e. `generate(node, fn)` -> `generate(node, { decorate: fn })`
- Decorate function invokes with additional parameter a reference to a node
- Tokenizer
- Renamed `Atrule` const to `AtKeyword`
## 1.0.0-alpha.28 (February 19, 2018)
- Renamed `lexer.grammar.translate()` method into `generate()`
- Fixed `<'-webkit-font-smoothing'>` and `<'-moz-osx-font-smoothing'>` syntaxes (#75)
- Added vendor keywords for `<'overflow'>` property syntax (#76)
- Pinned `mdn-data` to `~1.1.0` and fixed issues with some updated property syntaxes
## 1.0.0-alpha.27 (January 14, 2018)
- Generator
- Changed node's `generate()` methods invocation, methods now take a node as a single argument and context (i.e. `this`) that have methods: `chunk()`, `node()` and `children()`
- Renamed `translate()` to `generate()` and changed to take `options` argument
- Removed `translateMarkup(ast, enter, leave)` method, use `generate(ast, { decorator: (handlers) => { ... }})` instead
- Removed `translateWithSourceMap(ast)`, use `generate(ast, { sourceMap: true })` instead
- Changed to support for children as an array
- Walker
- Changed `walk()` to take an `options` argument instead of handler, with `enter`, `leave`, `visit` and `reverse` options (`walk(ast, fn)` is still works and equivalent to `walk(ast, { enter: fn })`)
- Removed `walkUp(ast, fn)`, use `walk(ast, { leave: fn })`
- Removed `walkRules(ast, fn)`, use `walk(ast, { visit: 'Rule', enter: fn })` instead
- Removed `walkRulesRight(ast, fn)`, use `walk(ast, { visit: 'Rule', reverse: true, enter: fn })` instead
- Removed `walkDeclarations(ast, fn)`, use `walk(ast, { visit: 'Declaration', enter: fn })` instead
- Changed to support for children as array in most cases (`reverse: true` will fail on arrays since they have no `forEachRight()` method)
- Misc
- List
- Added `List#forEach()` method
- Added `List#forEachRight()` method
- Added `List#filter()` method
- Changed `List#map()` method to return a `List` instance instead of `Array`
- Added `List#push()` method, similar to `List#appendData()` but returns nothing
- Added `List#pop()` method
- Added `List#unshift()` method, similar to `List#prependData()` but returns nothing
- Added `List#shift()` method
- Added `List#prependList()` method
- Changed `List#insert()`, `List#insertData()`, `List#appendList()` and `List#insertList()` methods to return a list that performed an operation
- Changed `keyword()` method
- Changed `name` field to include a vendor prefix
- Added `basename` field to contain a name without a vendor prefix
- Added `custom` field that contain a `true` when keyword is a custom property reference
- Changed `property()` method
- Changed `name` field to include a vendor prefix
- Added `basename` field to contain a name without any prefixes, i.e. a hack and a vendor prefix
- Added `vendorPrefix()` method
- Added `isCustomProperty()` method
## 1.0.0-alpha.26 (November 9, 2017)
- Tokenizer
- Added `Tokenizer#isBalanceEdge()` method
- Removed `Tokenizer.endsWith()` method
- Parser
- Made the parser tolerant to errors by default
- Removed `tolerant` parser option (no parsing modes anymore)
- Removed `property` parser option (a value parsing does not depend on property name anymore)
- Canceled error for a handing semicolon in a block
- Canceled error for unclosed `Brackets`, `Function` and `Parentheses` when EOF is reached
- Fixed error when prelude ends with a comment for at-rules with custom prelude consumer
- Relaxed at-rule parsing:
- Canceled error when EOF is reached after a prelude
- Canceled error for an at-rule with custom block consumer when at-rule has no block (just don't apply consumer in that case)
- Canceled error on at-rule parsing when it occurs outside prelude or block (at-rule is converting to `Raw` node)
- Allowed for any at-rule to have a prelude and a block, even if it's invalid per at-rule syntax (the responsibility for this check is moved to lexer, since it's possible to construct a AST with such errors)
- Made a declaration value a safe parsing point (i.e. error on value parsing lead to a value is turning into `Raw` node, not a declaration as before)
- Excluded surrounding white spaces and comments from a `Raw` node that represents a declaration value
- Changed `Value` parse handler to return a node only with type `Value` (previously it returned a `Raw` node in some cases)
- Fixed issue with `onParseError()` is not invoked for errors occured on selector or declaration value parsing in some cases
- Changed using of `onParseError()` to stop parsing if handler throws an exception
- Lexer
- Changed `grammar.walk()` to invoke passed handler on entering to node rather than on leaving the node
- Improved `grammar.walk()` to take a walk handler pair as an object, i.e. `walk(node, { enter: fn, leave: fn })`
- Changed `Lexer#match*()` methods to take a node of any type, but with a `children` field
- Added `Lexer#match(syntax, node)` method
- Fixed `Lexer#matchType()` method to stop return a positive result for the CSS wide keywords
## 1.0.0-alpha25 (October 9, 2017)
- Parser
- Added fallback node as argument to `onParseError()` handler
- Fixed raw consuming in tolerant mode when selector is invalid (greedy consuming and redundant warnings)
- Fixed exception in tolerant mode caused by unknown at-rule with unclosed block
- Changed handling of semicolons:
- Hanging semicolon inside declaration blocks raise an error or turns into a `Raw` node in tolerant mode instead of being ignored
- Semicolon outside of declaration blocks opens a `Rule` node as part of selector instead of being ignored
- Aligned `parseAtrulePrelude` behaviour to `parseRulePrelude`
- Removed `Raw` node wraping into `AtrulePrelude` when `parseAtrulePrelude` is disabled
- Removed error emitting when at-rule has a custom prelude customer but no prelude is found (it should be validated by a lexer later)
- Generator
- Fixed performance issue with `translateWithSourceMap()`, flattening the string (because of mixing building string and indexing into it) turned it into a quadratic algorithm (approximate numbers can be found in [the quiz created by this case](https://gist.github.com/lahmatiy/ea25d0e623d88ca9848384b5707d52d9))
- Added support for a single solidus hack for `property()`
- Minor fixes for custom errors
## 1.0.0-alpha24 (September 14, 2017)
- Improved CSSTree to be stable for standart build-in objects extension (#58)
- Parser
- Renamed rule's `selector` to `prelude`. The reasons: [spec names this part so](https://www.w3.org/TR/css-syntax-3/#qualified-rule), and this branch can contain not only a selector (`SelectorList`) but also a raw payload (`Raw`). What's changed:
- Renamed `Rule.selector` to `Rule.prelude`
- Renamed `parseSelector` parser option to `parseRulePrelude`
- Removed option for selector parse in `SelectorList`
- Lexer
- Fixed undefined positions in a error when match a syntax to empty or white space only value
- Improved `Lexer#checkStructure()`
- Return a warning as an object with node reference and message
- No exception on unknown node type, return a warning instead
## 1.0.0-alpha23 (September 10, 2017)
- Fixed `Tokenizer#getRawLength()`'s false positive balance match to the end of input in some cases (#56)
- Rename walker's entry point methods to be the same as CSSTree exposed methods (i.e. `walk()`, `walkUp()` etc)
- Rename at-rule's `expression` to `prelude` (since [spec names it so](https://www.w3.org/TR/css-syntax-3/#at-rule))
- `AtruleExpression` node type → `AtrulePrelude`
- `Atrule.expression` field → `Atrule.prelude`
- `parseAtruleExpression` parser's option → `parseAtrulePrelude`
- `atruleExpression` parse context → `atrulePrelude`
- `atruleExpression` walk context reference → `atrulePrelude`
## 1.0.0-alpha22 (September 8, 2017)
- Parser
- Fixed exception on parsing of unclosed `{}-block` in tolerant mode
- Added tolerant mode support for `DeclarationList`
- Added standalone entry point, i.e. default parser can be used via `require('css-tree/lib/parser')` (#47)
- Generator
- Changed generator to produce `+n` when `AnPlusB.a` is `+1` to be "round-trip" with parser
- Added standalone entry point, i.e. default generators can be used via `require('css-tree/lib/generator')`
- Walker
- Added standalone entry point, i.e. default walkers can be used via `require('css-tree/lib/walker')` (#47)
- Lexer
- Added `default` keyword to the list of invalid values for `<custom-ident>` (since it reversed per [spec](https://www.w3.org/TR/css-values/#custom-idents))
- Convertors (`toPlainObject()` and `fromPlainObject()`) moved to `lib/convertor` (entry point is `require('css-tree/lib/convertor')`)
## 1.0.0-alpha21 (September 5, 2017)
- Tokenizer
- Added `Raw` token type
- Improved tokenization of `url()` with raw as url to be more spec complient
- Added `Tokenizer#balance` array computation on token layout
- Added `Tokenizer#getRawLength()` to compute a raw length with respect of block balance
- Added `Tokenizer#getTokenStart(offset)` method to get token start offset by token index
- Added `idx` and `balance` fields to each token of `Tokenizer#dump()` method result
- Parser
- Added `onParseError` option
- Reworked node parsers that consume a `Raw` node to use a new approach. Since now a `Raw` node builds in `parser#Raw()` function only
- Changed semantic of `parser#Raw()`, it takes 5 parameters now (it might to be changed in future)
- Changed `parser#tolerantParse()` to pass a start token index to fallback function instead of source offset
- Fixed `AtruleExpression` consuming in tolerant mode
- Atrule handler to convert an empty `AtruleExpression` node into `null`
- Changed `AtruleExpression` handler to always return a node (before it could return a `null` in some cases)
- Lexer
- Fixed comma match node for `#` multiplier
- Added reference name to `SyntaxReferenceError`
- Additional fixes on custom errors
- Reduced possible corruption of base config by `syntax.fork()`
## 1.0.0-alpha20 (August 28, 2017)
- Tokenizer
- Added `Atrule` token type (`<at-rule-token>` per spec)
- Added `Function` token type (`<function-token>` per spec)
- Added `Url` token type
- Replaced `Tokenizer#getTypes()` method with `Tokenizer#dump()` to get all tokens as an array
- Renamed `Tokenizer.TYPE.Whitespace` to `Tokenizer.TYPE.WhiteSpace`
- Renamed `Tokenizer.findWhitespaceEnd()` to `Tokenizer.findWhiteSpaceEnd()`
- Parser
- Added initial implementation of tollerant mode (turn on by passing `tolerant: true` option). In this mode parse errors are never occour and any invalid part of CSS turns into a `Raw` node. Current safe points: `Atrule`, `AtruleExpression`, `Rule`, `Selector` and `Declaration`. Feature is experimental and further improvements are planned.
- Changed `Atrule.expression` to contain a `AtruleExpression` node or `null` only (other node types is wrapping into a `AtruleExpression` node)
- Renamed `AttributeSelector.operator` to `AttributeSelector.matcher`
- Generator
- `translate()` method is now can take a function as second argument, that recieves every generated chunk. When no function is passed, default handler is used, it concats all the chunks and method returns a string.
- Lexer
- Used [mdn/data](https://github.com/mdn/data) package as source of lexer's grammar instead of local dictionaries
- Added `x` unit to `<resolution>` generic type
- Improved match tree:
- Omited Group (sequences) match nodes
- Omited empty match nodes (for terms with `zero or more` multipliers)
- Added `ASTNode` node type to contain a reference to AST node
- Fixed node duplication (uncompleted match were added to tree)
- Added AST node reference in match nodes
- Added comma match node by `#` multiplier
- Grammar
- Changed `translate()` function to get a handler as third argument (optional). That handler recieves result of node traslation and can be used for decoration purposes. See [example](https://github.com/csstree/docs/blob/04c65af44477b5ea05feb373482898122b2a4528/docs/syntax.html#L619-L627)
- Added `SyntaxParseError` to grammar export
- Reworked group and multipliers representation in syntax tree:
- Replaced `Sequence` for `Group` node type (`Sequence` node type removed)
- Added `explicit` boolean property for `Group`
- Only groups can have a multiplier now (other node types is wrapping into a single term implicit group when multiplier is applied)
- Renamed `nonEmpty` Group's property to `disallowEmpty`
- Added optimisation for syntax tree by dropping redundant root `Group` when it contains a single `Group` term (return this `Group` as a result)
- Changed lexer's match functionality
- Changed `Lexer#matchProperty()` and `Lexer#matchType()` to return an object instead of match tree. A match tree stores in `matched` field when AST is matched to grammar successfully, otherwise an error in `error` field. The result object also has some methods to test AST node against a match tree: `getTrace()`, `isType()`, `isProperty()` and `isKeyword()`
- Added `Lexer#matchDeclaration()` method
- Removed `Lexer#lastMatchError` (error stores in match result object in `error` field)
- Added initial implementation of search for AST segments (new lexer methods: `Lexer#findValueSegments()`, `Lexer#findDeclarationValueSegments()` and `Lexer#findAllSegments`)
- Implemented `SyntaxReferenceError` for unknown property and type references
- Renamed field in resulting object of `property()` function: `variable``custom`
- Fixed issue with readonly properties (e.g. `line` and `column`) of `Error` and exception on attempt to write in iOS Safari
## 1.0.0-alpha19 (April 24, 2017)
- Extended `List` class with new methods:
- `List#prepend(item)`
- `List#prependData(data)`
- `List#insertData(data)`
- `List#insertList(list)`
- `List#replace(item, itemOrList)`
## 1.0.0-alpha18 (April 3, 2017)
- Added `atrule` walk context (#39)
- Changed a result of generate method for `AnPlusB`, `AttributeSelector`, `Function`, `MediaFeature` and `Ratio` ([1e95877](https://github.com/csstree/csstree/commit/1e9587710efa8e9338bcf0bc794b4b45f286231d))
- Fixed typo in `List` exception messages (@strarsis, #42)
- Improved tokenizer to convert an input to a string
## 1.0.0-alpha17 (March 13, 2017)
- Implemented new concept of `syntax`
- Changed main `exports` to expose a default syntax
- Defined initial [CSS syntax](lib/syntax/default.js)
- Implemented `createSyntax()` method to create a new syntax from scratch
- Implemented `fork()` method to create a new syntax based on given via extension
- Parser
- Implemented `mediaQueryList` and `mediaQuery` parsing contexts
- Implemented `CDO` and `CDC` node types
- Implemented additional declaration property prefix hacks (`#` and `+`)
- Added support for UTF-16LE BOM
- Added support for `@font-face` at-rule
- Added `chroma()` to legacy IE filter functions
- Improved `HexColor` to consume hex only
- Improved support for `\0` and `\9` hacks (#2)
- Relaxed number check for `Ratio` terms
- Allowed fractal values as a `Ratio` term
- Disallowed zero number as a `Ratio` term
- Changed important clause parsing
- Allowed any identifier for important (to support hacks like `!ie`)
- Store `true` for `important` field in case identifier equals to `important` and string otherwise
- Fixed parse error formatted message rendering to take into account tabs
- Removed exposing of `Parser` class
- Removed `readSelectorSequence()`, `readSequenceFallback()` and `readSelectorSequenceFallback` methods
- Used single universal sequence consumer for `AtruleExpression`, `Selector` and `Value`
- Generator
- Reworked generator to use auto-generated functions based on syntax definition (additional work to be done in next releases)
- Implemented `translateMarkup(ast, before, after)` method for complex cases
- Reworked `translateWithSourceMap` to be more flexible (based on `translateMarkup`, additional work to be done in next releases)
- Walker
- Reworked walker to use auto-generated function based on syntax definition (additional work to be done in next releases)
- Lexer
- Prepared for better extensibility (additional work to be done in next releases)
- Implemented `checkStructure(ast)` method to check AST structure based on syntax definition
- Update syntax dictionaries to latest `mdn/data`
- Add missing `<'offset-position'>` syntax
- Extended `<position>` property with `-webkit-sticky` (@sergejmueller, #37)
- Improved mismatch error position
- Implemented script (`gen:syntax`) to generate AST format reference page (`docs/ast.md`) using syntax definition
## 1.0.0-alpha16 (February 12, 2017)
- Exposed `Parser` class
- Added `startOffset` option to `Tokenizer` (constructor and `setSource()` method)
- Added fallback functions for default (`readSequenceFallback`) and selector (`readSelectorSequenceFallback`) sequence readers
- Fixed edge cases for `AnPlusB`
- Fixed wrong whitespace ignoring in `Selector` consumer
## 1.0.0-alpha15 (February 8, 2017)
- Fixed broken `atruleExpression` context
- Fixed vendor prefix detection in `keyword()` and `property()`
- Fixed `property()` to not lowercase custom property names
- Added `variable` boolean flag in `property()` result
- Renamed `scanner` into `tokenizer`
- Ranamed `syntax` into `lexer`
- Moved `docs/*.html` files to [csstree/docs](https://github.com/csstree/docs) repo
- Added `element()` function for `Value` context (`-moz-element()` supported as well)
- Merged `Universal` node type into `Type`
- Renamed node types:
- `Id` -> `IdSelector`
- `Class` -> `ClassSelector`
- `Type` -> `TypeSelector`
- `Attribute` -> `AttributeSelector`
- `PseudoClass` -> `PseudoClassSelector`
- `PseudoElement` -> `PseudoElementSelector`
- `Hash` -> `HexColor`
- `Space` -> `WhiteSpace`
- `An+B` -> `AnPlusB`
- Removed `Progid` node type
- Relaxed `MediaQuery` consumer to not validate syntax on parse and to include whitespaces in children sequence as is
- Added `WhiteSpace.value` property to store whitespace sequence
- Implemented parser options to specify what should be parsed in details (when option is `false` some part of CSS represents as balanced `Raw`):
- `parseAtruleExpression` to parse at-rule expressions (`true` by default)
- `parseSelector` to parse rule's selector (`true` by default)
- `parseValue` - to parse declaration's value (`true` by default)
- `parseCustomProperty` to parse value and fallback of custom property (`false` by default)
- Changed tokenization to stick leading hyphen minus to identifier token
- Changed selector parsing:
- Don't convert spaces into descendant combinator
- Don't validate selector structure on parsing (selectors may be checked by lexer later)
- Initial refactoring of [docs](https://github.com/csstree/csstree/blob/master/docs)
- Various improvements and fixes
## 1.0.0-alpha14 (February 3, 2017)
- Implemented `DeclarationList`, `MediaQueryList`, `MediaQuery`, `MediaFeature` and `Ratio` node types
- Implemented `declarationList` context (useful to parse HTML `style` attribute content)
- Implemented custom consumers for `@import`, `@media`, `@page` and `@supports` at-rules
- Implemented `atrule` option for `parse()` config, is used for `atruleExpession` context to specify custom consumer for at-rule if any
- Added `Scanner#skipWS()`, `Scanner#eatNonWS()`, `Scanner#consume()` and `Scanner#consumeNonWS()` helper methods
- Added custom consumers for known functional-pseudos, consume unknown functional-pseudo content as balanced `Raw`
- Allowed any `PseudoElement` to be a functional-pseudo (#33)
- Improved walker implementations to reduce GC thrashing by reusing cursors
- Changed `Atrule.block` to contain a `Block` node type only if any
- Changed `Block.loc` positions to include curly brackets
- Changed `Atrule.expression` to store a `null` if no expression
- Changed parser to use `StyleSheet` node type only for top level node (when context is `stylesheet`, that's by default)
- Changed `Parentheses`, `Brackets` and `Function` consumers to use passed sequence reader instead of its own
- Changed `Value` and `AtruleExpression` consumers to use common sequence reader (that reader was used by `Value` consumer before)
- Changed default sequence reader to exclude storage of spaces around `Comma`
- Changed processing of custom properties:
- Consume declaration value as balanced `Raw`
- Consume `var()` fallback value as balanced `Raw`
- Validate first argument of `var()` starts with double dash
- Custom property's value and fallback includes spaces around
- Fixed `Nth` to have a `loc` property
- Fixed `SelectorList.loc` and `Selector.loc` positions to exclude spaces
- Fixed issue Browserify build fail with `default-syntax.json` is not found error (#32, @philschatz)
- Disallowed `Type` selector starting with dash (parser throws an error in this case now)
- Disallowed empty selectors for `Rule` (not sure if it's correct but looks reasonable)
- Removed `>>` combinator support until any browser support (no signals about that yet)
- Removed `PseudoElement.legacy` property
- Removed special case for `:before`, `:after`, `:first-letter` and `:first-line` to represent them as `PseudoElement`, now those pseudos are represented as `PseudoClass` nodes
- Removed deprecated `Syntax#match()` method
- Parser was splitted into modules and related changes, one step closer to an extensible parser
- Various fixes and improvements, all changes have negligible impact on performance
## 1.0.0-alpha13 (January 19, 2017)
- Changed location storing in `SyntaxMatchError`
- Changed property to store mismatch offset to `mismatchOffset`
- Changed `offset` property to store bad node offset in source CSS if any
- Added `loc` property that stores bad node `loc` if any
## 1.0.0-alpha12 (January 19, 2017)
- Fixed `Syntax#matchProperty()` method to always return a positive result for custom properties since syntax is never defined for them (#31)
- Implemented `fromPlainObject()` and `toPlainObject()` to convert plain object to AST or AST to plain object (currently converts `List` <-> `Array`)
## 1.0.0-alpha11 (January 18, 2017)
- Added support for `:matches(<selector-list>)` (#28)
- Added support for `:has(<relative-selector-list>)`
- Added support for `::slotted(<compound-selector>)`
- Implemented `Brackets` node type
- Implemented basic support for at-rule inside rule block (#24)
- Renamed `Selector` node type to `SelectorList`
- Renamed `SimpleSelector` node type to `Selector`
- Renamed `UnicodeRange.name` property to `UnicodeRange.value`
- Replaced `Negation` node type for regular `PseudoClass`
- Unified name of node property to store nested nodes, it always `children` now:
- `StyleSheet.rules` -> `StyleSheet.children`
- `SelectorList.selectors` -> `SelectorList.children`
- `Block.declarations` -> `Block.children`
- `*.sequence` -> `*.children`
- Fixed edge cases in parsing `Hex` and `UnicodeRange` when number not an integer
- Changed `nth-` pseudos parsing
- Implemented `An+B` node type to represent expressions like `2n + 1` or `-3n`
- Fixed edge cases when `a` or `b` is not an integer
- Changed `odd` and `even` keywords processing, keywords are storing as `Identifier` node type now
- Changed `Nth` node type format to store a `nth`-query and an optional `selector`
- Implemented `of` clause for `nth-` pseudos (a.e. `:nth-child(2n + 1 of li, img)`)
- Limited `Nth` parsing rules to `:nth-child()`, `:nth-last-child()`, `:nth-of-type()` and `:nth-last-of-type()` pseudos
- Changed the way to store locations
- Renamed `info` node property to `loc`
- Changed format of `loc` to store `start` and `end` positions
## 1.0.0-alpha10 (January 11, 2017)
- Reworked `Scanner` to be a single point to its functionality
- Exposed `Scanner` class to be useful for external projects
- Changed `walk()` function behaviour to traverse AST nodes in natural order
- Implemented `walkUp()` function to traverse AST nodes from deepest to parent (behaves as `walk()` before)
## 1.0.0-alpha9 (December 21, 2016)
- Fixed `<angle>` generic according to specs that allow a `<number>` equals to zero to be used as valid value (#30)
## 1.0.0-alpha8 (November 11, 2016)
- Fixed `Scanner#skip()` issue method when cursor is moving to the end of source
- Simplified `Progid` node
- Changed behaviour for bad selector processing, now parsing fails instead of selector ignoring
- Fixed `<id-selector>` generic syntax
- Added `q` unit for `<length>` generic syntax
- Refactored syntax parser (performance)
- Reduced startup time by implementing lazy syntax parsing (default syntax doesn't parse on module load)
- Updated syntax dictionaries and used [`mdn/data`](https://github.com/mdn/data) instead of `Template:CSSData`
- Renamed `syntax.stringify()` method to `syntax.translate()`
- Simplified generic syntax functions, those functions receive a single AST node for checking and should return `true` or `false`
- Added exception for values that contains `var()`, those values are always valid for now
- Added more tests and increase code coverage to `98.5%`
## 1.0.0-alpha7 (October 7, 2016)
- Added support for explicit descendant combinator (`>>`)
- Implemented `Type` and `Universal` type nodes
- Improved `Number` parsing by including sign and exponent (#26)
- Parse `before`, `after`, `first-letter` and `first-line` pseudos with single colon as `PseudoElement`
- Changed `FunctionalPseudo` node type to `PseudoClass`
- Fixed attribute selector name parsing (namespace edge cases)
- Fixed location calculation for specified offset when `eof` is reached
- Added more non-standard colors (#25)
- Removed obsolete `Syntax#getAll()` method
- Fixed various edge cases, code clean up and performance improvements
## 1.0.0-alpha6 (September 23, 2016)
- More accurate positions for syntax mismatch errors
- Added [`apple`](https://webkit.org/blog/3709/using-the-system-font-in-web-content/) specific font keywords (#20)
- Changed `Property` node stucture from object to string
- Renamed `Ruleset` node type to `Rule`
- Removed `Argument` node type
- Fixed `Dimension` and `Percentage` position computation
- Fixed bad selector parsing (temporary solution)
- Fixed location computation for CSS with very long lines that may lead to really long parsing with `positions:true` (even freeze)
- Fixed `line` and `column` computation for `SyntaxMatch` error
- Improved performance of parsing and translation. Now CSSTree is under 10ms in [PostCSS benchmark](https://github.com/postcss/benchmark).

View File

@@ -0,0 +1,19 @@
Copyright (C) 2016-2019 by Roman Dvornov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,130 @@
<img align="right" width="111" height="111"
alt="CSSTree logo"
src="https://cloud.githubusercontent.com/assets/270491/19243723/6f9136c6-8f21-11e6-82ac-eeeee4c6c452.png"/>
# CSSTree
[![NPM version](https://img.shields.io/npm/v/css-tree.svg)](https://www.npmjs.com/package/css-tree)
[![Build Status](https://travis-ci.org/csstree/csstree.svg?branch=master)](https://travis-ci.org/csstree/csstree)
[![Coverage Status](https://coveralls.io/repos/github/csstree/csstree/badge.svg?branch=master)](https://coveralls.io/github/csstree/csstree?branch=master)
[![NPM Downloads](https://img.shields.io/npm/dm/css-tree.svg)](https://www.npmjs.com/package/css-tree)
[![Twitter](https://img.shields.io/badge/Twitter-@csstree-blue.svg)](https://twitter.com/csstree)
CSSTree is a tool set for CSS: [fast](https://github.com/postcss/benchmark) detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations. The main goal is to be efficient and W3C specs compliant, with focus on CSS analyzing and source-to-source transforming tasks.
> NOTE: The library isn't in final shape and needs further improvements (e.g. AST format and API are subjects to change in next major versions). However it's stable enough and used by projects like [CSSO](https://github.com/css/csso) (CSS minifier) and [SVGO](https://github.com/svg/svgo) (SVG optimizer) in production.
## Features
- **Detailed parsing with an adjustable level of detail**
By default CSSTree parses CSS as detailed as possible, i.e. each single logical part is representing with its own AST node (see [AST format](docs/ast.md) for all possible node types). The parsing detail level can be changed through [parser options](docs/parsing.md#parsesource-options), for example, you can disable parsing of selectors or declaration values for component parts.
- **Tolerant to errors by design**
Parser behaves as [spec says](https://www.w3.org/TR/css-syntax-3/#error-handling): "When errors occur in CSS, the parser attempts to recover gracefully, throwing away only the minimum amount of content before returning to parsing as normal". The only thing the parser departs from the specification is that it doesn't throw away bad content, but wraps it in a special node type (`Raw`) that allows processing it later.
- **Fast and efficient**
CSSTree is created with focus on performance and effective memory consumption. Therefore it's [one of the fastest CSS parsers](https://github.com/postcss/benchmark) at the moment.
- **Syntax validation**
The build-in lexer can test CSS against syntaxes defined by W3C. CSSTree uses [mdn/data](https://github.com/mdn/data/) as a basis for lexer's dictionaries and extends it with vendor specific and legacy syntaxes. Lexer can only check the declaration values currently, but this feature will be extended to other parts of the CSS in the future.
## Documentation
- [AST format](docs/ast.md)
- [Parsing CSS → AST](docs/parsing.md)
- [parse(source[, options])](docs/parsing.md#parsesource-options)
- [Serialization AST → CSS](docs/generate.md)
- [generate(ast[, options])](docs/generate.md#generateast-options)
- [AST traversal](docs/traversal.md)
- [walk(ast, options)](docs/traversal.md#walkast-options)
- [find(ast, fn)](docs/traversal.md#findast-fn)
- [findLast(ast, fn)](docs/traversal.md#findlastast-fn)
- [findAll(ast, fn)](docs/traversal.md#findallast-fn)
- [Utils for AST](docs/utils.md)
- [property(name)](docs/utils.md#propertyname)
- [keyword(name)](docs/utils.md#keywordname)
- [clone(ast)](docs/utils.md#cloneast)
- [fromPlainObject(object)](docs/utils.md#fromplainobjectobject)
- [toPlainObject(ast)](docs/utils.md#toplainobjectast)
- [Value Definition Syntax](docs/definition-syntax.md)
- [parse(source)](docs/definition-syntax.md#parsesource)
- [walk(node, options, context)](docs/definition-syntax.md#walknode-options-context)
- [generate(node, options)](docs/definition-syntax.md#generatenode-options)
- [AST format](docs/definition-syntax.md#ast-format)
## Tools
* [AST Explorer](https://astexplorer.net/#/gist/244e2fb4da940df52bf0f4b94277db44/e79aff44611020b22cfd9708f3a99ce09b7d67a8) explore CSSTree AST format with zero setup
* [CSS syntax reference](https://csstree.github.io/docs/syntax.html)
* [CSS syntax validator](https://csstree.github.io/docs/validator.html)
## Related projects
* [csstree-validator](https://github.com/csstree/validator)  NPM package to validate CSS
* [stylelint-csstree-validator](https://github.com/csstree/stylelint-validator) plugin for stylelint to validate CSS
* [Grunt plugin](https://github.com/sergejmueller/grunt-csstree-validator)
* [Gulp plugin](https://github.com/csstree/gulp-csstree)
* [Sublime plugin](https://github.com/csstree/SublimeLinter-contrib-csstree)
* [VS Code plugin](https://github.com/csstree/vscode-plugin)
* [Atom plugin](https://github.com/csstree/atom-plugin)
## Usage
Install with npm:
```
> npm install css-tree
```
Basic usage:
```js
var csstree = require('css-tree');
// parse CSS to AST
var ast = csstree.parse('.example { world: "!" }');
// traverse AST and modify it
csstree.walk(ast, function(node) {
if (node.type === 'ClassSelector' && node.name === 'example') {
node.name = 'hello';
}
});
// generate CSS from AST
console.log(csstree.generate(ast));
// .hello{world:"!"}
```
Syntax matching:
```js
// parse CSS to AST as a declaration value
var ast = csstree.parse('red 1px solid', { context: 'value' });
// match to syntax of `border` property
var matchResult = csstree.lexer.matchProperty('border', ast);
// check first value node is a <color>
console.log(matchResult.isType(ast.children.first(), 'color'));
// true
// get a type list matched to a node
console.log(matchResult.getTrace(ast.children.first()));
// [ { type: 'Property', name: 'border' },
// { type: 'Type', name: 'color' },
// { type: 'Type', name: 'named-color' },
// { type: 'Keyword', name: 'red' } ]
```
## Top level API
![API map](https://cdn.rawgit.com/csstree/csstree/1.0/docs/api-map.svg)
## License
MIT

View File

@@ -0,0 +1,103 @@
const mdnAtrules = require('mdn-data/css/at-rules.json');
const mdnProperties = require('mdn-data/css/properties.json');
const mdnSyntaxes = require('mdn-data/css/syntaxes.json');
const patch = require('./patch.json');
const extendSyntax = /^\s*\|\s*/;
function preprocessAtrules(dict) {
const result = Object.create(null);
for (const atruleName in dict) {
const atrule = dict[atruleName];
let descriptors = null;
if (atrule.descriptors) {
descriptors = Object.create(null);
for (const descriptor in atrule.descriptors) {
descriptors[descriptor] = atrule.descriptors[descriptor].syntax;
}
}
result[atruleName.substr(1)] = {
prelude: atrule.syntax.trim().match(/^@\S+\s+([^;\{]*)/)[1].trim() || null,
descriptors
};
}
return result;
}
function patchDictionary(dict, patchDict) {
const result = {};
// copy all syntaxes for an original dict
for (const key in dict) {
result[key] = dict[key].syntax || dict[key];
}
// apply a patch
for (const key in patchDict) {
if (key in dict) {
if (patchDict[key].syntax) {
result[key] = extendSyntax.test(patchDict[key].syntax)
? result[key] + ' ' + patchDict[key].syntax.trim()
: patchDict[key].syntax;
} else {
delete result[key];
}
} else {
if (patchDict[key].syntax) {
result[key] = patchDict[key].syntax.replace(extendSyntax, '');
}
}
}
return result;
}
function unpackSyntaxes(dict) {
const result = {};
for (const key in dict) {
result[key] = dict[key].syntax;
}
return result;
}
function patchAtrules(dict, patchDict) {
const result = {};
// copy all syntaxes for an original dict
for (const key in dict) {
const patchDescriptors = (patchDict[key] && patchDict[key].descriptors) || null;
result[key] = {
prelude: key in patchDict && 'prelude' in patchDict[key]
? patchDict[key].prelude
: dict[key].prelude || null,
descriptors: dict[key].descriptors
? patchDictionary(dict[key].descriptors, patchDescriptors || {})
: patchDescriptors && unpackSyntaxes(patchDescriptors)
};
}
// apply a patch
for (const key in patchDict) {
if (!hasOwnProperty.call(dict, key)) {
result[key] = {
prelude: patchDict[key].prelude || null,
descriptors: patchDict[key].descriptors && unpackSyntaxes(patchDict[key].descriptors)
};
}
}
return result;
}
module.exports = {
types: patchDictionary(mdnSyntaxes, patch.syntaxes),
atrules: patchAtrules(preprocessAtrules(mdnAtrules), patch.atrules),
properties: patchDictionary(mdnProperties, patch.properties)
};

View File

@@ -0,0 +1,721 @@
{
"atrules": {
"charset": {
"prelude": "<string>"
},
"font-face": {
"descriptors": {
"unicode-range": {
"comment": "replaces <unicode-range>, an old production name",
"syntax": "<urange>#"
}
}
}
},
"properties": {
"-moz-background-clip": {
"comment": "deprecated syntax in old Firefox, https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
"syntax": "padding | border"
},
"-moz-border-radius-bottomleft": {
"comment": "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-left-radius",
"syntax": "<'border-bottom-left-radius'>"
},
"-moz-border-radius-bottomright": {
"comment": "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
"syntax": "<'border-bottom-right-radius'>"
},
"-moz-border-radius-topleft": {
"comment": "https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-left-radius",
"syntax": "<'border-top-left-radius'>"
},
"-moz-border-radius-topright": {
"comment": "https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",
"syntax": "<'border-bottom-right-radius'>"
},
"-moz-control-character-visibility": {
"comment": "firefox specific keywords, https://bugzilla.mozilla.org/show_bug.cgi?id=947588",
"syntax": "visible | hidden"
},
"-moz-osx-font-smoothing": {
"comment": "misssed old syntax https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
"syntax": "auto | grayscale"
},
"-moz-user-select": {
"comment": "https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
"syntax": "none | text | all | -moz-none"
},
"-ms-flex-align": {
"comment": "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
"syntax": "start | end | center | baseline | stretch"
},
"-ms-flex-item-align": {
"comment": "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",
"syntax": "auto | start | end | center | baseline | stretch"
},
"-ms-flex-line-pack": {
"comment": "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-line-pack",
"syntax": "start | end | center | justify | distribute | stretch"
},
"-ms-flex-negative": {
"comment": "misssed old syntax implemented in IE; TODO: find references for comfirmation",
"syntax": "<'flex-shrink'>"
},
"-ms-flex-pack": {
"comment": "misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-pack",
"syntax": "start | end | center | justify | distribute"
},
"-ms-flex-order": {
"comment": "misssed old syntax implemented in IE; https://msdn.microsoft.com/en-us/library/jj127303(v=vs.85).aspx",
"syntax": "<integer>"
},
"-ms-flex-positive": {
"comment": "misssed old syntax implemented in IE; TODO: find references for comfirmation",
"syntax": "<'flex-grow'>"
},
"-ms-flex-preferred-size": {
"comment": "misssed old syntax implemented in IE; TODO: find references for comfirmation",
"syntax": "<'flex-basis'>"
},
"-ms-interpolation-mode": {
"comment": "https://msdn.microsoft.com/en-us/library/ff521095(v=vs.85).aspx",
"syntax": "nearest-neighbor | bicubic"
},
"-ms-grid-column-align": {
"comment": "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466338.aspx",
"syntax": "start | end | center | stretch"
},
"-ms-grid-row-align": {
"comment": "add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466348.aspx",
"syntax": "start | end | center | stretch"
},
"-ms-hyphenate-limit-last": {
"comment": "misssed old syntax implemented in IE; https://www.w3.org/TR/css-text-4/#hyphenate-line-limits",
"syntax": "none | always | column | page | spread"
},
"-webkit-appearance": {
"comment": "webkit specific keywords",
"references": [
"http://css-infos.net/property/-webkit-appearance"
],
"syntax": "none | button | button-bevel | caps-lock-indicator | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbargripper-horizontal | scrollbargripper-vertical | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button"
},
"-webkit-background-clip": {
"comment": "https://developer.mozilla.org/en/docs/Web/CSS/background-clip",
"syntax": "[ <box> | border | padding | content | text ]#"
},
"-webkit-column-break-after": {
"comment": "added, http://help.dottoro.com/lcrthhhv.php",
"syntax": "always | auto | avoid"
},
"-webkit-column-break-before": {
"comment": "added, http://help.dottoro.com/lcxquvkf.php",
"syntax": "always | auto | avoid"
},
"-webkit-column-break-inside": {
"comment": "added, http://help.dottoro.com/lclhnthl.php",
"syntax": "always | auto | avoid"
},
"-webkit-font-smoothing": {
"comment": "https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",
"syntax": "auto | none | antialiased | subpixel-antialiased"
},
"-webkit-mask-box-image": {
"comment": "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
"syntax": "[ <url> | <gradient> | none ] [ <length-percentage>{4} <-webkit-mask-box-repeat>{2} ]?"
},
"-webkit-print-color-adjust": {
"comment": "missed",
"references": [
"https://developer.mozilla.org/en/docs/Web/CSS/-webkit-print-color-adjust"
],
"syntax": "economy | exact"
},
"-webkit-text-security": {
"comment": "missed; http://help.dottoro.com/lcbkewgt.php",
"syntax": "none | circle | disc | square"
},
"-webkit-user-drag": {
"comment": "missed; http://help.dottoro.com/lcbixvwm.php",
"syntax": "none | element | auto"
},
"-webkit-user-select": {
"comment": "auto is supported by old webkit, https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",
"syntax": "auto | none | text | all"
},
"alignment-baseline": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/text.html#AlignmentBaselineProperty"
],
"syntax": "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical"
},
"baseline-shift": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/text.html#BaselineShiftProperty"
],
"syntax": "baseline | sub | super | <svg-length>"
},
"behavior": {
"comment": "added old IE property https://msdn.microsoft.com/en-us/library/ms530723(v=vs.85).aspx",
"syntax": "<url>+"
},
"clip-rule": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/masking.html#ClipRuleProperty"
],
"syntax": "nonzero | evenodd"
},
"cue": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<'cue-before'> <'cue-after'>?"
},
"cue-after": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<url> <decibel>? | none"
},
"cue-before": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<url> <decibel>? | none"
},
"cursor": {
"comment": "added legacy keywords: hand, -webkit-grab. -webkit-grabbing, -webkit-zoom-in, -webkit-zoom-out, -moz-grab, -moz-grabbing, -moz-zoom-in, -moz-zoom-out",
"references": [
"https://www.sitepoint.com/css3-cursor-styles/"
],
"syntax": "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing | hand | -webkit-grab | -webkit-grabbing | -webkit-zoom-in | -webkit-zoom-out | -moz-grab | -moz-grabbing | -moz-zoom-in | -moz-zoom-out ] ]"
},
"display": {
"comment": "extended with -ms-flexbox",
"syntax": "| <-non-standard-display>"
},
"position": {
"comment": "extended with -webkit-sticky",
"syntax": "| -webkit-sticky"
},
"dominant-baseline": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/text.html#DominantBaselineProperty"
],
"syntax": "auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge"
},
"image-rendering": {
"comment": "extended with <-non-standard-image-rendering>, added SVG keywords optimizeSpeed and optimizeQuality",
"references": [
"https://developer.mozilla.org/en/docs/Web/CSS/image-rendering",
"https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty"
],
"syntax": "| optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"
},
"fill": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#FillProperty"
],
"syntax": "<paint>"
},
"fill-opacity": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#FillProperty"
],
"syntax": "<number-zero-one>"
},
"fill-rule": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#FillProperty"
],
"syntax": "nonzero | evenodd"
},
"filter": {
"comment": "extend with IE legacy syntaxes",
"syntax": "| <-ms-filter-function-list>"
},
"glyph-orientation-horizontal": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/text.html#GlyphOrientationHorizontalProperty"
],
"syntax": "<angle>"
},
"glyph-orientation-vertical": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/text.html#GlyphOrientationVerticalProperty"
],
"syntax": "<angle>"
},
"kerning": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/text.html#KerningProperty"
],
"syntax": "auto | <svg-length>"
},
"letter-spacing": {
"comment": "fix syntax <length> -> <length-percentage>",
"references": [
"https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing"
],
"syntax": "normal | <length-percentage>"
},
"marker": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
],
"syntax": "none | <url>"
},
"marker-end": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
],
"syntax": "none | <url>"
},
"marker-mid": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
],
"syntax": "none | <url>"
},
"marker-start": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#MarkerProperties"
],
"syntax": "none | <url>"
},
"max-width": {
"comment": "fix auto -> none (https://github.com/mdn/data/pull/431); extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/max-width",
"syntax": "none | <length-percentage> | min-content | max-content | fit-content(<length-percentage>) | <-non-standard-width>"
},
"width": {
"comment": "per spec fit-content should be a function, however browsers are supporting it as a keyword (https://github.com/csstree/stylelint-validator/issues/29)",
"syntax": "| fit-content | -moz-fit-content | -webkit-fit-content"
},
"min-width": {
"comment": "extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
"syntax": "auto | <length-percentage> | min-content | max-content | fit-content(<length-percentage>) | <-non-standard-width>"
},
"overflow": {
"comment": "extend by vendor keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
"syntax": "| <-non-standard-overflow>"
},
"pause": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<'pause-before'> <'pause-after'>?"
},
"pause-after": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<time> | none | x-weak | weak | medium | strong | x-strong"
},
"pause-before": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<time> | none | x-weak | weak | medium | strong | x-strong"
},
"rest": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<'rest-before'> <'rest-after'>?"
},
"rest-after": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<time> | none | x-weak | weak | medium | strong | x-strong"
},
"rest-before": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<time> | none | x-weak | weak | medium | strong | x-strong"
},
"shape-rendering": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#ShapeRenderingPropert"
],
"syntax": "auto | optimizeSpeed | crispEdges | geometricPrecision"
},
"src": {
"comment": "added @font-face's src property https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src",
"syntax": "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#"
},
"speak": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "auto | none | normal"
},
"speak-as": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "normal | spell-out || digits || [ literal-punctuation | no-punctuation ]"
},
"stroke": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
],
"syntax": "<paint>"
},
"stroke-dasharray": {
"comment": "added SVG property; a list of comma and/or white space separated <length>s and <percentage>s",
"references": [
"https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
],
"syntax": "none | [ <svg-length>+ ]#"
},
"stroke-dashoffset": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
],
"syntax": "<svg-length>"
},
"stroke-linecap": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
],
"syntax": "butt | round | square"
},
"stroke-linejoin": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
],
"syntax": "miter | round | bevel"
},
"stroke-miterlimit": {
"comment": "added SVG property (<miterlimit> = <number-one-or-greater>) ",
"references": [
"https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
],
"syntax": "<number-one-or-greater>"
},
"stroke-opacity": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
],
"syntax": "<number-zero-one>"
},
"stroke-width": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/painting.html#StrokeProperties"
],
"syntax": "<svg-length>"
},
"text-anchor": {
"comment": "added SVG property",
"references": [
"https://www.w3.org/TR/SVG/text.html#TextAlignmentProperties"
],
"syntax": "start | middle | end"
},
"unicode-bidi": {
"comment": "added prefixed keywords https://developer.mozilla.org/en-US/docs/Web/CSS/unicode-bidi",
"syntax": "| -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate | -webkit-isolate-override | -webkit-plaintext"
},
"unicode-range": {
"comment": "added missed property https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face/unicode-range",
"syntax": "<urange>#"
},
"voice-balance": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<number> | left | center | right | leftwards | rightwards"
},
"voice-duration": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "auto | <time>"
},
"voice-family": {
"comment": "<name> -> <family-name>, https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "[ [ <family-name> | <generic-voice> ] , ]* [ <family-name> | <generic-voice> ] | preserve"
},
"voice-pitch": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
},
"voice-range": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "<frequency> && absolute | [ [ x-low | low | medium | high | x-high ] || [ <frequency> | <semitones> | <percentage> ] ]"
},
"voice-rate": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "[ normal | x-slow | slow | medium | fast | x-fast ] || <percentage>"
},
"voice-stress": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "normal | strong | moderate | none | reduced"
},
"voice-volume": {
"comment": "https://www.w3.org/TR/css3-speech/#property-index",
"syntax": "silent | [ [ x-soft | soft | medium | loud | x-loud ] || <decibel> ]"
},
"writing-mode": {
"comment": "extend with SVG keywords",
"syntax": "| <svg-writing-mode>"
}
},
"syntaxes": {
"-legacy-gradient": {
"comment": "added collection of legacy gradient syntaxes",
"syntax": "<-webkit-gradient()> | <-legacy-linear-gradient> | <-legacy-repeating-linear-gradient> | <-legacy-radial-gradient> | <-legacy-repeating-radial-gradient>"
},
"-legacy-linear-gradient": {
"comment": "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
"syntax": "-moz-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-linear-gradient( <-legacy-linear-gradient-arguments> )"
},
"-legacy-repeating-linear-gradient": {
"comment": "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
"syntax": "-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> ) | -o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )"
},
"-legacy-linear-gradient-arguments": {
"comment": "like standard syntax but w/o `to` keyword https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient",
"syntax": "[ <angle> | <side-or-corner> ]? , <color-stop-list>"
},
"-legacy-radial-gradient": {
"comment": "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
"syntax": "-moz-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-radial-gradient( <-legacy-radial-gradient-arguments> )"
},
"-legacy-repeating-radial-gradient": {
"comment": "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
"syntax": "-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> ) | -o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )"
},
"-legacy-radial-gradient-arguments": {
"comment": "deprecated syntax that implemented by some browsers https://www.w3.org/TR/2011/WD-css3-images-20110908/#radial-gradients",
"syntax": "[ <position> , ]? [ [ [ <-legacy-radial-gradient-shape> || <-legacy-radial-gradient-size> ] | [ <length> | <percentage> ]{2} ] , ]? <color-stop-list>"
},
"-legacy-radial-gradient-size": {
"comment": "before a standard it contains 2 extra keywords (`contain` and `cover`) https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltsize",
"syntax": "closest-side | closest-corner | farthest-side | farthest-corner | contain | cover"
},
"-legacy-radial-gradient-shape": {
"comment": "define to double sure it doesn't extends in future https://www.w3.org/TR/2011/WD-css3-images-20110908/#ltshape",
"syntax": "circle | ellipse"
},
"-non-standard-font": {
"comment": "non standard fonts",
"references": [
"https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
],
"syntax": "-apple-system-body | -apple-system-headline | -apple-system-subheadline | -apple-system-caption1 | -apple-system-caption2 | -apple-system-footnote | -apple-system-short-body | -apple-system-short-headline | -apple-system-short-subheadline | -apple-system-short-caption1 | -apple-system-short-footnote | -apple-system-tall-body"
},
"-non-standard-color": {
"comment": "non standard colors",
"references": [
"http://cssdot.ru/%D0%A1%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D1%87%D0%BD%D0%B8%D0%BA_CSS/color-i305.html",
"https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Mozilla_Color_Preference_Extensions"
],
"syntax": "-moz-ButtonDefault | -moz-ButtonHoverFace | -moz-ButtonHoverText | -moz-CellHighlight | -moz-CellHighlightText | -moz-Combobox | -moz-ComboboxText | -moz-Dialog | -moz-DialogText | -moz-dragtargetzone | -moz-EvenTreeRow | -moz-Field | -moz-FieldText | -moz-html-CellHighlight | -moz-html-CellHighlightText | -moz-mac-accentdarkestshadow | -moz-mac-accentdarkshadow | -moz-mac-accentface | -moz-mac-accentlightesthighlight | -moz-mac-accentlightshadow | -moz-mac-accentregularhighlight | -moz-mac-accentregularshadow | -moz-mac-chrome-active | -moz-mac-chrome-inactive | -moz-mac-focusring | -moz-mac-menuselect | -moz-mac-menushadow | -moz-mac-menutextselect | -moz-MenuHover | -moz-MenuHoverText | -moz-MenuBarText | -moz-MenuBarHoverText | -moz-nativehyperlinktext | -moz-OddTreeRow | -moz-win-communicationstext | -moz-win-mediatext | -moz-activehyperlinktext | -moz-default-background-color | -moz-default-color | -moz-hyperlinktext | -moz-visitedhyperlinktext | -webkit-activelink | -webkit-focus-ring-color | -webkit-link | -webkit-text"
},
"-non-standard-image-rendering": {
"comment": "non-standard keywords http://phrogz.net/tmp/canvas_image_zoom.html",
"syntax": "optimize-contrast | -moz-crisp-edges | -o-crisp-edges | -webkit-optimize-contrast"
},
"-non-standard-overflow": {
"comment": "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",
"syntax": "-moz-scrollbars-none | -moz-scrollbars-horizontal | -moz-scrollbars-vertical | -moz-hidden-unscrollable"
},
"-non-standard-width": {
"comment": "non-standard keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",
"syntax": "fill-available | min-intrinsic | intrinsic | -moz-available | -moz-fit-content | -moz-min-content | -moz-max-content | -webkit-min-content | -webkit-max-content"
},
"-webkit-gradient()": {
"comment": "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/ - TODO: simplify when after match algorithm improvement ( [, point, radius | , point] -> [, radius]? , point )",
"syntax": "-webkit-gradient( <-webkit-gradient-type>, <-webkit-gradient-point> [, <-webkit-gradient-point> | , <-webkit-gradient-radius>, <-webkit-gradient-point> ] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )"
},
"-webkit-gradient-color-stop": {
"comment": "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
"syntax": "from( <color> ) | color-stop( [ <number-zero-one> | <percentage> ] , <color> ) | to( <color> )"
},
"-webkit-gradient-point": {
"comment": "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
"syntax": "[ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]"
},
"-webkit-gradient-radius": {
"comment": "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
"syntax": "<length> | <percentage>"
},
"-webkit-gradient-type": {
"comment": "first Apple proposal gradient syntax https://webkit.org/blog/175/introducing-css-gradients/",
"syntax": "linear | radial"
},
"-webkit-mask-box-repeat": {
"comment": "missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",
"syntax": "repeat | stretch | round"
},
"-webkit-mask-clip-style": {
"comment": "missed; there is no enough information about `-webkit-mask-clip` property, but looks like all those keywords are working",
"syntax": "border | border-box | padding | padding-box | content | content-box | text"
},
"-ms-filter-function-list": {
"comment": "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
"syntax": "<-ms-filter-function>+"
},
"-ms-filter-function": {
"comment": "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
"syntax": "<-ms-filter-function-progid> | <-ms-filter-function-legacy>"
},
"-ms-filter-function-progid": {
"comment": "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
"syntax": "'progid:' [ <ident-token> '.' ]* [ <ident-token> | <function-token> <any-value>? ) ]"
},
"-ms-filter-function-legacy": {
"comment": "https://developer.mozilla.org/en-US/docs/Web/CSS/-ms-filter",
"syntax": "<ident-token> | <function-token> <any-value>? )"
},
"-ms-filter": {
"syntax": "<string>"
},
"age": {
"comment": "https://www.w3.org/TR/css3-speech/#voice-family",
"syntax": "child | young | old"
},
"attr-name": {
"syntax": "<wq-name>"
},
"attr-fallback": {
"syntax": "<any-value>"
},
"border-radius": {
"comment": "missed, https://drafts.csswg.org/css-backgrounds-3/#the-border-radius",
"syntax": "<length-percentage>{1,2}"
},
"bottom": {
"comment": "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
"syntax": "<length> | auto"
},
"content-list": {
"comment": "missed -> https://drafts.csswg.org/css-content/#typedef-content-list (document-url, <target> and leader() is omitted util stabilization)",
"syntax": "[ <string> | contents | <image> | <quote> | <target> | <leader()> | <attr()> | counter( <ident>, <'list-style-type'>? ) ]+"
},
"element()": {
"comment": "https://drafts.csswg.org/css-gcpm/#element-syntax & https://drafts.csswg.org/css-images-4/#element-notation",
"syntax": "element( <custom-ident> , [ first | start | last | first-except ]? ) | element( <id-selector> )"
},
"generic-voice": {
"comment": "https://www.w3.org/TR/css3-speech/#voice-family",
"syntax": "[ <age>? <gender> <integer>? ]"
},
"gender": {
"comment": "https://www.w3.org/TR/css3-speech/#voice-family",
"syntax": "male | female | neutral"
},
"generic-family": {
"comment": "added -apple-system",
"references": [
"https://webkit.org/blog/3709/using-the-system-font-in-web-content/"
],
"syntax": "| -apple-system"
},
"gradient": {
"comment": "added legacy syntaxes support",
"syntax": "| <-legacy-gradient>"
},
"left": {
"comment": "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
"syntax": "<length> | auto"
},
"mask-image": {
"comment": "missed; https://drafts.fxtf.org/css-masking-1/#the-mask-image",
"syntax": "<mask-reference>#"
},
"name-repeat": {
"comment": "missed, and looks like obsolete, keep it as is since other property syntaxes should be changed too; https://www.w3.org/TR/2015/WD-css-grid-1-20150917/#typedef-name-repeat",
"syntax": "repeat( [ <positive-integer> | auto-fill ], <line-names>+)"
},
"named-color": {
"comment": "added non standard color names",
"syntax": "| <-non-standard-color>"
},
"paint": {
"comment": "used by SVG https://www.w3.org/TR/SVG/painting.html#SpecifyingPaint",
"syntax": "none | <color> | <url> [ none | <color> ]? | context-fill | context-stroke"
},
"page-size": {
"comment": "https://www.w3.org/TR/css-page-3/#typedef-page-size-page-size",
"syntax": "A5 | A4 | A3 | B5 | B4 | JIS-B5 | JIS-B4 | letter | legal | ledger"
},
"ratio": {
"comment": "missed, https://drafts.csswg.org/mediaqueries-4/#typedef-ratio",
"syntax": "<integer> / <integer>"
},
"right": {
"comment": "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
"syntax": "<length> | auto"
},
"shape": {
"comment": "missed spaces in function body and add backwards compatible syntax",
"syntax": "rect( <top>, <right>, <bottom>, <left> ) | rect( <top> <right> <bottom> <left> )"
},
"svg-length": {
"comment": "All coordinates and lengths in SVG can be specified with or without a unit identifier",
"references": [
"https://www.w3.org/TR/SVG11/coords.html#Units"
],
"syntax": "<percentage> | <length> | <number>"
},
"svg-writing-mode": {
"comment": "SVG specific keywords (deprecated for CSS)",
"references": [
"https://developer.mozilla.org/en/docs/Web/CSS/writing-mode",
"https://www.w3.org/TR/SVG/text.html#WritingModeProperty"
],
"syntax": "lr-tb | rl-tb | tb-rl | lr | rl | tb"
},
"top": {
"comment": "missed; not sure we should add it, but no others except `shape` is using it so it's ok for now; https://drafts.fxtf.org/css-masking-1/#funcdef-clip-rect",
"syntax": "<length> | auto"
},
"track-group": {
"comment": "used by old grid-columns and grid-rows syntax v0",
"syntax": "'(' [ <string>* <track-minmax> <string>* ]+ ')' [ '[' <positive-integer> ']' ]? | <track-minmax>"
},
"track-list-v0": {
"comment": "used by old grid-columns and grid-rows syntax v0",
"syntax": "[ <string>* <track-group> <string>* ]+ | none"
},
"track-minmax": {
"comment": "used by old grid-columns and grid-rows syntax v0",
"syntax": "minmax( <track-breadth> , <track-breadth> ) | auto | <track-breadth> | fit-content"
},
"x": {
"comment": "missed; not sure we should add it, but no others except `cursor` is using it so it's ok for now; https://drafts.csswg.org/css-ui-3/#cursor",
"syntax": "<number>"
},
"y": {
"comment": "missed; not sure we should add it, but no others except `cursor` is using so it's ok for now; https://drafts.csswg.org/css-ui-3/#cursor",
"syntax": "<number>"
},
"declaration": {
"comment": "missed, restored by https://drafts.csswg.org/css-syntax",
"syntax": "<ident-token> : <declaration-value>? [ '!' important ]?"
},
"declaration-list": {
"comment": "missed, restored by https://drafts.csswg.org/css-syntax",
"syntax": "[ <declaration>? ';' ]* <declaration>?"
},
"url": {
"comment": "https://drafts.csswg.org/css-values-4/#urls",
"syntax": "url( <string> <url-modifier>* ) | <url-token>"
},
"url-modifier": {
"comment": "https://drafts.csswg.org/css-values-4/#typedef-url-modifier",
"syntax": "<ident> | <function-token> <any-value> )"
},
"number-zero-one": {
"syntax": "<number [0,1]>"
},
"number-one-or-greater": {
"syntax": "<number [1,∞]>"
},
"positive-integer": {
"syntax": "<integer [0,∞]>"
},
"-non-standard-display": {
"syntax": "-ms-inline-flexbox | -ms-grid | -ms-inline-grid | -webkit-flex | -webkit-inline-flex | -webkit-box | -webkit-inline-box | -moz-inline-stack | -moz-box | -moz-inline-box"
}
}
}

View File

@@ -0,0 +1,60 @@
{
"name": "css-tree",
"version": "1.1.3",
"description": "A tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and matching) based on specs and browser implementations",
"author": "Roman Dvornov <rdvornov@gmail.com> (https://github.com/lahmatiy)",
"license": "MIT",
"repository": "csstree/csstree",
"keywords": [
"css",
"ast",
"tokenizer",
"parser",
"walker",
"lexer",
"generator",
"utils",
"syntax",
"validation"
],
"main": "lib/index.js",
"unpkg": "dist/csstree.min.js",
"jsdelivr": "dist/csstree.min.js",
"scripts": {
"build": "rollup --config",
"lint": "eslint data lib scripts test && node scripts/review-syntax-patch --lint && node scripts/update-docs --lint",
"lint-and-test": "npm run lint && npm test",
"update:docs": "node scripts/update-docs",
"review:syntax-patch": "node scripts/review-syntax-patch",
"test": "mocha --reporter progress",
"coverage": "nyc npm test",
"travis": "nyc npm run lint-and-test && npm run coveralls",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"prepublishOnly": "npm run build",
"hydrogen": "node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --trace_hydrogen_file=code.cfg --print-opt-code bin/parse --stat -o /dev/null"
},
"dependencies": {
"mdn-data": "2.0.14",
"source-map": "^0.6.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"coveralls": "^3.0.9",
"eslint": "^6.8.0",
"json-to-ast": "^2.1.0",
"mocha": "^6.2.3",
"nyc": "^14.1.1",
"rollup": "^1.32.1",
"rollup-plugin-terser": "^5.3.0"
},
"engines": {
"node": ">=8.0.0"
},
"files": [
"data",
"dist",
"lib"
]
}

View File

@@ -0,0 +1,116 @@
CC0 1.0 Universal
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific
works ("Commons") that the public can reliably and without fear of later
claims of infringement build upon, modify, incorporate in other works, reuse
and redistribute as freely as possible in any form whatsoever and for any
purposes, including without limitation commercial purposes. These owners may
contribute to the Commons to promote the ideal of a free culture and the
further production of creative, cultural and scientific works, or to gain
reputation or greater distribution for their Work in part through the use and
efforts of others.
For these and/or other purposes and motivations, and without any expectation
of additional consideration or compensation, the person associating CC0 with a
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
and publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not limited
to, the following:
i. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or likeness
depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
vii. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
the Waiver for the benefit of each member of the public at large and to the
detriment of Affirmer's heirs and successors, fully intending that such Waiver
shall not be subject to revocation, rescission, cancellation, termination, or
any other legal or equitable action to disrupt the quiet enjoyment of the Work
by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
is so judged Affirmer hereby grants to each affected person a royalty-free,
non transferable, non sublicensable, non exclusive, irrevocable and
unconditional license to exercise Affirmer's Copyright and Related Rights in
the Work (i) in all territories worldwide, (ii) for the maximum duration
provided by applicable law or treaty (including future time extensions), (iii)
in any current or future medium and for any number of copies, and (iv) for any
purpose whatsoever, including without limitation commercial, advertising or
promotional purposes (the "License"). The License shall be deemed effective as
of the date CC0 was applied by Affirmer to the Work. Should any part of the
License for any reason be judged legally invalid or ineffective under
applicable law, such partial invalidity or ineffectiveness shall not
invalidate the remainder of the License, and in such case Affirmer hereby
affirms that he or she will not (i) exercise any of his or her remaining
Copyright and Related Rights in the Work or (ii) assert any associated claims
and causes of action with respect to the Work, in either case contrary to
Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or otherwise,
including without limitation warranties of title, merchantability, fitness
for a particular purpose, non infringement, or the absence of latent or
other defects, accuracy, or the present or absence of errors, whether or not
discoverable, all to the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without limitation
any person's Copyright and Related Rights in the Work. Further, Affirmer
disclaims responsibility for obtaining any necessary consents, permissions
or other rights required for any use of the Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
<http://creativecommons.org/publicdomain/zero/1.0/>

View File

@@ -0,0 +1,56 @@
# MDN data
[https://github.com/mdn/data](https://github.com/mdn/data)
Maintained by the [MDN team at Mozilla](https://wiki.mozilla.org/MDN).
This repository contains general data for Web technologies.
This data is used in MDN documentation, to build
[information boxes](https://developer.mozilla.org/en-US/docs/Web/CSS/background)
or [sidebar navigation](https://developer.mozilla.org/en-US/docs/Web/API/Window).
External tools have started to make use of this data as well.
For example, the [CSSTree](https://github.com/csstree/csstree/) CSS parser.
[![NPM version](https://img.shields.io/npm/v/mdn-data.svg)](https://www.npmjs.com/package/mdn-data)
[![Build Status](https://travis-ci.org/mdn/data.svg?branch=master)](https://travis-ci.org/mdn/data)
## Repository contents
There's a top-level directory for each broad area covered: for example, "api",
"css", "svg". Inside each of these directories is one or more
JSON files containing the data.
### api
Contains data about Web APIs:
* API inheritance (interface inheritance and mixin implementations)
### css
Contains data about:
* CSS at-rules
* CSS properties
* CSS selectors
* CSS syntaxes
* CSS types
* CSS units
Read more about [CSS data](https://github.com/mdn/data/blob/master/css/readme.md) and the format of the files.
### l10n
The l10n folder contains localization strings that are used in the various
json files throughout this repository.
## Problems?
If you find a problem, please [file an issue](https://github.com/mdn/data/issues/new).
## Contributing
We're very happy to accept contributions to this data. Please familiarize yourself
with the schema for the data you're editing, and send us a pull request. See also the [Contributing file](https://github.com/mdn/data/blob/master/CONTRIBUTING.md) for more information.
## See also
* [https://github.com/mdn/browser-compat-data](https://github.com/mdn/browser-compat-data)
for compatibility data for Web technologies.

View File

@@ -0,0 +1,3 @@
module.exports = {
inheritance: require('./inheritance'),
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
{
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"inherits": {
"oneOf": [
{
"type": "null"
},
{
"type": "string",
"minLength": 1
}
]
},
"implements": {
"minItems": 0,
"uniqueItems": true,
"items": {
"type": "string"
}
}
},
"required": [
"inherits",
"implements"
]
}
}

View File

@@ -0,0 +1,560 @@
{
"@charset": {
"syntax": "@charset \"<charset>\";",
"groups": [
"CSS Charsets"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@charset"
},
"@counter-style": {
"syntax": "@counter-style <counter-style-name> {\n [ system: <counter-system>; ] ||\n [ symbols: <counter-symbols>; ] ||\n [ additive-symbols: <additive-symbols>; ] ||\n [ negative: <negative-symbol>; ] ||\n [ prefix: <prefix>; ] ||\n [ suffix: <suffix>; ] ||\n [ range: <range>; ] ||\n [ pad: <padding>; ] ||\n [ speak-as: <speak-as>; ] ||\n [ fallback: <counter-style-name>; ]\n}",
"interfaces": [
"CSSCounterStyleRule"
],
"groups": [
"CSS Counter Styles"
],
"descriptors": {
"additive-symbols": {
"syntax": "[ <integer> && <symbol> ]#",
"media": "all",
"initial": "n/a (required)",
"percentages": "no",
"computed": "asSpecified",
"order": "orderOfAppearance",
"status": "standard"
},
"fallback": {
"syntax": "<counter-style-name>",
"media": "all",
"initial": "decimal",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"negative": {
"syntax": "<symbol> <symbol>?",
"media": "all",
"initial": "\"-\" hyphen-minus",
"percentages": "no",
"computed": "asSpecified",
"order": "orderOfAppearance",
"status": "standard"
},
"pad": {
"syntax": "<integer> && <symbol>",
"media": "all",
"initial": "0 \"\"",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"prefix": {
"syntax": "<symbol>",
"media": "all",
"initial": "\"\"",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"range": {
"syntax": "[ [ <integer> | infinite ]{2} ]# | auto",
"media": "all",
"initial": "auto",
"percentages": "no",
"computed": "asSpecified",
"order": "orderOfAppearance",
"status": "standard"
},
"speak-as": {
"syntax": "auto | bullets | numbers | words | spell-out | <counter-style-name>",
"media": "all",
"initial": "auto",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"suffix": {
"syntax": "<symbol>",
"media": "all",
"initial": "\". \"",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"symbols": {
"syntax": "<symbol>+",
"media": "all",
"initial": "n/a (required)",
"percentages": "no",
"computed": "asSpecified",
"order": "orderOfAppearance",
"status": "standard"
},
"system": {
"syntax": "cyclic | numeric | alphabetic | symbolic | additive | [ fixed <integer>? ] | [ extends <counter-style-name> ]",
"media": "all",
"initial": "symbolic",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
}
},
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@counter-style"
},
"@document": {
"syntax": "@document [ <url> | url-prefix(<string>) | domain(<string>) | media-document(<string>) | regexp(<string>) ]# {\n <group-rule-body>\n}",
"interfaces": [
"CSSGroupingRule",
"CSSConditionRule"
],
"groups": [
"CSS Conditional Rules"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@document"
},
"@font-face": {
"syntax": "@font-face {\n [ font-family: <family-name>; ] ||\n [ src: <src>; ] ||\n [ unicode-range: <unicode-range>; ] ||\n [ font-variant: <font-variant>; ] ||\n [ font-feature-settings: <font-feature-settings>; ] ||\n [ font-variation-settings: <font-variation-settings>; ] ||\n [ font-stretch: <font-stretch>; ] ||\n [ font-weight: <font-weight>; ] ||\n [ font-style: <font-style>; ]\n}",
"interfaces": [
"CSSFontFaceRule"
],
"groups": [
"CSS Fonts"
],
"descriptors": {
"font-display": {
"syntax": "[ auto | block | swap | fallback | optional ]",
"media": "visual",
"percentages": "no",
"initial": "auto",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "experimental"
},
"font-family": {
"syntax": "<family-name>",
"media": "all",
"initial": "n/a (required)",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"font-feature-settings": {
"syntax": "normal | <feature-tag-value>#",
"media": "all",
"initial": "normal",
"percentages": "no",
"computed": "asSpecified",
"order": "orderOfAppearance",
"status": "standard"
},
"font-variation-settings": {
"syntax": "normal | [ <string> <number> ]#",
"media": "all",
"initial": "normal",
"percentages": "no",
"computed": "asSpecified",
"order": "orderOfAppearance",
"status": "standard"
},
"font-stretch": {
"syntax": "<font-stretch-absolute>{1,2}",
"media": "all",
"initial": "normal",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"font-style": {
"syntax": "normal | italic | oblique <angle>{0,2}",
"media": "all",
"initial": "normal",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"font-weight": {
"syntax": "<font-weight-absolute>{1,2}",
"media": "all",
"initial": "normal",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"font-variant": {
"syntax": "normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> || stylistic(<feature-value-name>) || historical-forms || styleset(<feature-value-name>#) || character-variant(<feature-value-name>#) || swash(<feature-value-name>) || ornaments(<feature-value-name>) || annotation(<feature-value-name>) || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || <numeric-figure-values> || <numeric-spacing-values> || <numeric-fraction-values> || ordinal || slashed-zero || <east-asian-variant-values> || <east-asian-width-values> || ruby ]",
"media": "all",
"initial": "normal",
"percentages": "no",
"computed": "asSpecified",
"order": "orderOfAppearance",
"status": "standard"
},
"src": {
"syntax": "[ <url> [ format( <string># ) ]? | local( <family-name> ) ]#",
"media": "all",
"initial": "n/a (required)",
"percentages": "no",
"computed": "asSpecified",
"order": "orderOfAppearance",
"status": "standard"
},
"unicode-range": {
"syntax": "<unicode-range>#",
"media": "all",
"initial": "U+0-10FFFF",
"percentages": "no",
"computed": "asSpecified",
"order": "orderOfAppearance",
"status": "standard"
}
},
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@font-face"
},
"@font-feature-values": {
"syntax": "@font-feature-values <family-name># {\n <feature-value-block-list>\n}",
"interfaces": [
"CSSFontFeatureValuesRule"
],
"groups": [
"CSS Fonts"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@font-feature-values"
},
"@import": {
"syntax": "@import [ <string> | <url> ] [ <media-query-list> ]?;",
"groups": [
"Media Queries"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@import"
},
"@keyframes": {
"syntax": "@keyframes <keyframes-name> {\n <keyframe-block-list>\n}",
"interfaces": [
"CSSKeyframeRule",
"CSSKeyframesRule"
],
"groups": [
"CSS Animations"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@keyframes"
},
"@media": {
"syntax": "@media <media-query-list> {\n <group-rule-body>\n}",
"interfaces": [
"CSSGroupingRule",
"CSSConditionRule",
"CSSMediaRule",
"CSSCustomMediaRule"
],
"groups": [
"CSS Conditional Rules",
"Media Queries"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@media"
},
"@namespace": {
"syntax": "@namespace <namespace-prefix>? [ <string> | <url> ];",
"groups": [
"CSS Namespaces"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@namespace"
},
"@page": {
"syntax": "@page <page-selector-list> {\n <page-body>\n}",
"interfaces": [
"CSSPageRule"
],
"groups": [
"CSS Pages"
],
"descriptors": {
"bleed": {
"syntax": "auto | <length>",
"media": [
"visual",
"paged"
],
"initial": "auto",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"marks": {
"syntax": "none | [ crop || cross ]",
"media": [
"visual",
"paged"
],
"initial": "none",
"percentages": "no",
"computed": "asSpecified",
"order": "orderOfAppearance",
"status": "standard"
},
"size": {
"syntax": "<length>{1,2} | auto | [ <page-size> || [ portrait | landscape ] ]",
"media": [
"visual",
"paged"
],
"initial": "auto",
"percentages": "no",
"computed": "asSpecifiedRelativeToAbsoluteLengths",
"order": "orderOfAppearance",
"status": "standard"
}
},
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@page"
},
"@property": {
"syntax": "@property <custom-property-name> {\n <declaration-list>\n}",
"interfaces": [
"CSS",
"CSSPropertyRule"
],
"groups": [
"CSS Houdini"
],
"descriptors": {
"syntax": {
"syntax": "<string>",
"media": "all",
"percentages": "no",
"initial": "n/a (required)",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "experimental"
},
"inherits": {
"syntax": "true | false",
"media": "all",
"percentages": "no",
"initial": "auto",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "experimental"
},
"initial-value": {
"syntax": "<string>",
"media": "all",
"initial": "n/a (required)",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "experimental"
}
},
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@property"
},
"@supports": {
"syntax": "@supports <supports-condition> {\n <group-rule-body>\n}",
"interfaces": [
"CSSGroupingRule",
"CSSConditionRule",
"CSSSupportsRule"
],
"groups": [
"CSS Conditional Rules"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@supports"
},
"@viewport": {
"syntax": "@viewport {\n <group-rule-body>\n}",
"interfaces": [
"CSSViewportRule"
],
"groups": [
"CSS Device Adaptation"
],
"descriptors": {
"height": {
"syntax": "<viewport-length>{1,2}",
"media": [
"visual",
"continuous"
],
"initial": [
"min-height",
"max-height"
],
"percentages": [
"min-height",
"max-height"
],
"computed": [
"min-height",
"max-height"
],
"order": "orderOfAppearance",
"status": "standard"
},
"max-height": {
"syntax": "<viewport-length>",
"media": [
"visual",
"continuous"
],
"initial": "auto",
"percentages": "referToHeightOfInitialViewport",
"computed": "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
"order": "uniqueOrder",
"status": "standard"
},
"max-width": {
"syntax": "<viewport-length>",
"media": [
"visual",
"continuous"
],
"initial": "auto",
"percentages": "referToWidthOfInitialViewport",
"computed": "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
"order": "uniqueOrder",
"status": "standard"
},
"max-zoom": {
"syntax": "auto | <number> | <percentage>",
"media": [
"visual",
"continuous"
],
"initial": "auto",
"percentages": "the zoom factor itself",
"computed": "autoNonNegativeOrPercentage",
"order": "uniqueOrder",
"status": "standard"
},
"min-height": {
"syntax": "<viewport-length>",
"media": [
"visual",
"continuous"
],
"initial": "auto",
"percentages": "referToHeightOfInitialViewport",
"computed": "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
"order": "uniqueOrder",
"status": "standard"
},
"min-width": {
"syntax": "<viewport-length>",
"media": [
"visual",
"continuous"
],
"initial": "auto",
"percentages": "referToWidthOfInitialViewport",
"computed": "lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
"order": "uniqueOrder",
"status": "standard"
},
"min-zoom": {
"syntax": "auto | <number> | <percentage>",
"media": [
"visual",
"continuous"
],
"initial": "auto",
"percentages": "the zoom factor itself",
"computed": "autoNonNegativeOrPercentage",
"order": "uniqueOrder",
"status": "standard"
},
"orientation": {
"syntax": "auto | portrait | landscape",
"media": [
"visual",
"continuous"
],
"initial": "auto",
"percentages": "referToSizeOfBoundingBox",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"user-zoom": {
"syntax": "zoom | fixed",
"media": [
"visual",
"continuous"
],
"initial": "zoom",
"percentages": "referToSizeOfBoundingBox",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"viewport-fit": {
"syntax": "auto | contain | cover",
"media": [
"visual",
"continuous"
],
"initial": "auto",
"percentages": "no",
"computed": "asSpecified",
"order": "uniqueOrder",
"status": "standard"
},
"width": {
"syntax": "<viewport-length>{1,2}",
"media": [
"visual",
"continuous"
],
"initial": [
"min-width",
"max-width"
],
"percentages": [
"min-width",
"max-width"
],
"computed": [
"min-width",
"max-width"
],
"order": "orderOfAppearance",
"status": "standard"
},
"zoom": {
"syntax": "auto | <number> | <percentage>",
"media": [
"visual",
"continuous"
],
"initial": "auto",
"percentages": "the zoom factor itself",
"computed": "autoNonNegativeOrPercentage",
"order": "uniqueOrder",
"status": "standard"
}
},
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/@viewport"
}
}

View File

@@ -0,0 +1,132 @@
{
"definitions": {
"stringOrPropertyList": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "string",
"property-reference": {
"comment": "property-reference is an extension to the JSON schema validator. Here it jumps 3 levels up in the hierarchy and tests if a value is an existing key in descriptors. See test/validate-schema.js for implementation details.",
"$data": "3"
}
}
}
]
}
},
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"syntax": {
"type": "string"
},
"interfaces": {
"type": "array",
"items": {
"type": "string"
}
},
"groups": {
"type": "array",
"minitems": 1,
"uniqueItems": true,
"items": {
"$ref": "definitions.json#/groupList"
}
},
"descriptors": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"syntax": {
"type": "string"
},
"media": {
"oneOf": [
{
"type": "string",
"enum": [
"all",
"continuous",
"paged",
"visual"
]
},
{
"type": "array",
"minItems": 2,
"uniqueItems": true,
"items": {
"type": "string",
"enum": [
"continuous",
"paged",
"visual"
]
}
}
]
},
"initial": {
"$ref": "#/definitions/stringOrPropertyList"
},
"percentages": {
"$ref": "#/definitions/stringOrPropertyList"
},
"computed": {
"$ref": "#/definitions/stringOrPropertyList"
},
"order": {
"enum": [
"orderOfAppearance",
"uniqueOrder"
]
},
"status": {
"enum": [
"standard",
"nonstandard",
"experimental"
]
}
},
"required": [
"syntax",
"media",
"initial",
"percentages",
"computed",
"order",
"status"
]
}
},
"status": {
"enum": [
"standard",
"nonstandard",
"experimental"
]
},
"mdn_url": {
"type": "string",
"pattern": "^https://developer.mozilla.org/docs/Web/CSS/"
}
},
"required": [
"syntax",
"groups",
"status"
]
}
}

View File

@@ -0,0 +1,77 @@
{
"groupList": {
"enum": [
"Basic Selectors",
"Combinators",
"Compositing and Blending",
"CSS Angles",
"CSS Animations",
"CSS Backgrounds and Borders",
"CSS Box Model",
"CSS Box Alignment",
"CSS Break",
"CSS Charsets",
"CSS Color",
"CSS Columns",
"CSS Conditional Rules",
"CSS Containment",
"CSS Counter Styles",
"CSS Device Adaptation",
"CSS Display",
"CSS Flexible Box Layout",
"CSS Flexible Lengths",
"CSS Fonts",
"CSS Fragmentation",
"CSS Frequencies",
"CSS Generated Content",
"CSS Grid Layout",
"CSS Houdini",
"CSS Images",
"CSS Inline",
"CSS Lengths",
"CSS Lists and Counters",
"CSS Logical Properties",
"CSS Masking",
"CSS Miscellaneous",
"CSS Motion Path",
"CSS Namespaces",
"CSS Overflow",
"CSS Pages",
"CSS Positioning",
"CSS Regions",
"CSS Resolutions",
"CSS Ruby",
"CSS Scroll Anchoring",
"CSS Scrollbars",
"CSS Scroll Snap",
"CSS Shadow Parts",
"CSS Shapes",
"CSS Speech",
"CSS Table",
"CSS Text",
"CSS Text Decoration",
"CSS Times",
"CSS Transforms",
"CSS Transitions",
"CSS Types",
"CSS Units",
"CSS Basic User Interface",
"CSS Variables",
"CSS Will Change",
"CSS Writing Modes",
"CSSOM View",
"Filter Effects",
"Grouping Selectors",
"MathML",
"Media Queries",
"Microsoft Extensions",
"Mozilla Extensions",
"Pointer Events",
"Pseudo",
"Pseudo-classes",
"Pseudo-elements",
"Selectors",
"WebKit Extensions"
]
}
}

View File

@@ -0,0 +1,8 @@
module.exports = {
atRules: require('./at-rules'),
selectors: require('./selectors'),
types: require('./types'),
properties: require('./properties'),
syntaxes: require('./syntaxes'),
units: require('./units'),
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,402 @@
{
"definitions": {
"propertyList": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "string",
"property-reference": {
"comment": "property-reference is an extension to the JSON schema validator. Here it jumps to the root level of the hierarchy and tests if a value is an existing key there (i.e a defined property). See test/validate-schema.js for implementation details.",
"$data": "/"
}
}
},
"animationType": {
"enum": [
"angleBasicShapeOrPath",
"angleOrBasicShapeOrPath",
"basicShapeOtherwiseNo",
"byComputedValueType",
"color",
"discrete",
"eachOfShorthandPropertiesExceptUnicodeBiDiAndDirection",
"filterList",
"fontStretch",
"fontWeight",
"integer",
"length",
"lpc",
"notAnimatable",
"numberOrLength",
"number",
"position",
"rectangle",
"repeatableListOfSimpleListOfLpc",
"shadowList",
"simpleListOfLpc",
"simpleListOfLpcDifferenceLpc",
"transform",
"visibility"
]
},
"percentages": {
"enum": [
"blockSizeOfContainingBlock",
"dependsOnLayoutModel",
"inlineSizeOfContainingBlock",
"lengthsAsPercentages",
"logicalHeightOfContainingBlock",
"logicalWidthOfContainingBlock",
"maxZoomFactor",
"minZoomFactor",
"no",
"referToBorderBox",
"referToContainingBlockHeight",
"referToDimensionOfBorderBox",
"referToDimensionOfContentArea",
"referToElementFontSize",
"referToFlexContainersInnerMainSize",
"referToHeightOfBackgroundPositioningAreaMinusBackgroundImageHeight",
"referToLineBoxWidth",
"referToLineHeight",
"referToParentElementsFontSize",
"referToSizeOfBackgroundPositioningAreaMinusBackgroundImageSize",
"referToSizeOfBorderImage",
"referToSizeOfBoundingBox",
"referToSizeOfContainingBlock",
"referToSizeOfElement",
"referToSizeOfFont",
"referToSizeOfMaskBorderImage",
"referToSizeOfMaskPaintingArea",
"referToTotalPathLength",
"referToWidthAndHeightOfElement",
"referToWidthOfAffectedGlyph",
"referToWidthOfBackgroundPositioningAreaMinusBackgroundImageHeight",
"referToWidthOfContainingBlock",
"referToWidthOrHeightOfBorderImageArea",
"referToReferenceBoxWhenSpecifiedOtherwiseBorderBox",
"regardingHeightOfGeneratedBoxContainingBlockPercentages0",
"regardingHeightOfGeneratedBoxContainingBlockPercentagesNone",
"regardingHeightOfGeneratedBoxContainingBlockPercentagesRelativeToContainingBlock",
"relativeToBackgroundPositioningArea",
"relativeToMaskBorderImageArea",
"relativeToScrollContainerPaddingBoxAxis",
"relativeToTheScrollContainersScrollport",
"relativeToWidthAndHeight"
]
},
"computed": {
"enum": [
"absoluteLength",
"absoluteLength0ForNone",
"absoluteLength0IfColumnRuleStyleNoneOrHidden",
"absoluteLengthOr0IfBorderBottomStyleNoneOrHidden",
"absoluteLengthOr0IfBorderLeftStyleNoneOrHidden",
"absoluteLengthOr0IfBorderRightStyleNoneOrHidden",
"absoluteLengthOr0IfBorderTopStyleNoneOrHidden",
"absoluteLengthOrAsSpecified",
"absoluteLengthOrKeyword",
"absoluteLengthOrNone",
"absoluteLengthOrNormal",
"absoluteLengthOrPercentage",
"absoluteLengthsSpecifiedColorAsSpecified",
"absoluteLengthZeroIfBorderStyleNoneOrHidden",
"absoluteLengthZeroOrLarger",
"absoluteURIOrNone",
"angleRoundedToNextQuarter",
"asAutoOrColor",
"asDefinedForBasicShapeWithAbsoluteURIOtherwiseAsSpecified",
"asLength",
"asSpecified",
"asSpecifiedAppliesToEachProperty",
"asSpecifiedButVisibleOrClipReplacedToAutoOrHiddenIfOtherValueDifferent",
"asSpecifiedExceptMatchParent",
"asSpecifiedExceptPositionedFloatingAndRootElementsKeywordMaybeDifferent",
"asSpecifiedRelativeToAbsoluteLengths",
"asSpecifiedURLsAbsolute",
"asSpecifiedWithExceptionOfResolution",
"asSpecifiedWithLengthsAbsoluteAndNormalComputingToZeroExceptMultiColumn",
"asSpecifiedWithVarsSubstituted",
"autoOnAbsolutelyPositionedElementsValueOfAlignItemsOnParent",
"autoOrRectangle",
"colorPlusThreeAbsoluteLengths",
"computedColor",
"consistsOfTwoDimensionKeywords",
"consistsOfTwoKeywordsForOriginAndOffsets",
"forLengthAbsoluteValueOtherwisePercentage",
"invertForTranslucentColorRGBAOtherwiseRGB",
"keywordOrNumericalValueBolderLighterTransformedToRealValue",
"keywordPlusIntegerIfDigits",
"lengthAbsolutePercentageAsSpecifiedOtherwiseAuto",
"listEachItemConsistingOfAbsoluteLengthPercentageAndOrigin",
"listEachItemHasTwoKeywordsOnePerDimension",
"listEachItemTwoKeywordsOriginOffsets",
"noneOrImageWithAbsoluteURI",
"normalizedAngle",
"normalOnElementsForPseudosNoneAbsoluteURIStringOrAsSpecified",
"oneToFourPercentagesOrAbsoluteLengthsPlusFill",
"optimumMinAndMaxValueOfAbsoluteLengthPercentageOrNormal",
"optimumValueOfAbsoluteLengthOrNormal",
"percentageAsSpecifiedAbsoluteLengthOrNone",
"percentageAsSpecifiedOrAbsoluteLength",
"percentageAutoOrAbsoluteLength",
"percentageOrAbsoluteLengthPlusKeywords",
"sameAsBoxOffsets",
"sameAsMaxWidthAndMaxHeight",
"sameAsMinWidthAndMinHeight",
"sameAsWidthAndHeight",
"specifiedIntegerOrAbsoluteLength",
"specifiedValueClipped0To1",
"specifiedValueNumberClipped0To1",
"translucentValuesRGBAOtherwiseRGB",
"twoAbsoluteLengthOrPercentages",
"twoAbsoluteLengths"
]
},
"appliesto": {
"enum": [
"absolutelyPositionedElements",
"allElements",
"allElementsAcceptingWidthOrHeight",
"allElementsAndPseudos",
"allElementsButNonReplacedAndTableColumns",
"allElementsButNonReplacedAndTableRows",
"allElementsCreatingNativeWindows",
"allElementsExceptGeneratedContentOrPseudoElements",
"allElementsExceptInlineBoxesAndInternalRubyOrTableBoxes",
"allElementsExceptInternalTableDisplayTypes",
"allElementsExceptNonReplacedInlineElementsTableRowsColumnsRowColumnGroups",
"allElementsExceptTableDisplayTypes",
"allElementsExceptTableElementsWhenCollapse",
"allElementsExceptTableRowColumnGroupsTableRowsColumns",
"allElementsExceptTableRowGroupsRowsColumnGroupsAndColumns",
"allElementsNoEffectIfDisplayNone",
"allElementsSomeValuesNoEffectOnNonInlineElements",
"allElementsSVGContainerElements",
"allElementsSVGContainerGraphicsAndGraphicsReferencingElements",
"allElementsThatCanReferenceImages",
"allElementsUAsNotRequiredWhenCollapse",
"anyElementEffectOnProgressAndMeter",
"beforeAndAfterPseudos",
"blockContainerElements",
"blockContainers",
"blockContainersAndMultiColumnContainers",
"blockContainersExceptMultiColumnContainers",
"blockContainersExceptTableWrappers",
"blockContainersFlexContainersGridContainers",
"blockElementsInNormalFlow",
"blockLevelElements",
"blockLevelBoxesAndAbsolutelyPositionedBoxesAndGridItems",
"boxElements",
"childrenOfBoxElements",
"directChildrenOfElementsWithDisplayMozBoxMozInlineBox",
"elementsWithDisplayBoxOrInlineBox",
"elementsWithDisplayMarker",
"elementsWithDisplayMozBoxMozInlineBox",
"elementsWithOverflowNotVisibleAndReplacedElements",
"exclusionElements",
"firstLetterPseudoElementsAndInlineLevelFirstChildren",
"flexContainers",
"flexItemsAndAbsolutelyPositionedFlexContainerChildren",
"flexItemsAndInFlowPseudos",
"flexItemsGridItemsAbsolutelyPositionedContainerChildren",
"flexItemsGridItemsAndAbsolutelyPositionedBoxes",
"floats",
"gridContainers",
"gridContainersWithMasonryLayout",
"gridContainersWithMasonryLayoutInTheirBlockAxis",
"gridContainersWithMasonryLayoutInTheirInlineAxis",
"gridItemsAndBoxesWithinGridContainer",
"iframeElements",
"images",
"inFlowBlockLevelElements",
"inFlowChildrenOfBoxElements",
"inlineLevelAndTableCellElements",
"listItems",
"maskElements",
"multicolElements",
"multiColumnElementsFlexContainersGridContainers",
"multilineFlexContainers",
"nonReplacedBlockAndInlineBlockElements",
"nonReplacedBlockElements",
"nonReplacedElements",
"nonReplacedInlineElements",
"positionedElements",
"replacedElements",
"rubyAnnotationsContainers",
"rubyBasesAnnotationsBaseAnnotationContainers",
"sameAsMargin",
"sameAsWidthAndHeight",
"scrollContainers",
"scrollingBoxes",
"tableCaptionElements",
"tableCellElements",
"tableElements",
"textElements",
"textFields",
"transformableElements",
"xulImageElements"
]
},
"alsoApplyTo": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"enum": [
"::first-letter",
"::first-line",
"::placeholder"
]
}
},
"order": {
"enum": [
"canonicalOrder",
"lengthOrPercentageBeforeKeywordIfBothPresent",
"lengthOrPercentageBeforeKeywords",
"oneOrTwoValuesLengthAbsoluteKeywordsPercentages",
"orderOfAppearance",
"percentagesOrLengthsFollowedByFill",
"perGrammar",
"uniqueOrder"
]
},
"status": {
"enum": [
"standard",
"nonstandard",
"experimental",
"obsolete"
]
},
"mdn_url": {
"type": "string",
"pattern": "^https://developer.mozilla.org/docs/"
}
},
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"required": [
"syntax",
"media",
"inherited",
"animationType",
"percentages",
"groups",
"initial",
"appliesto",
"computed",
"order",
"status"
],
"properties": {
"syntax": {
"type": "string"
},
"media": {
"oneOf": [
{
"type": "string",
"enum": [
"all",
"aural",
"continuous",
"interactive",
"none",
"noPracticalMedia",
"paged",
"visual",
"visualInContinuousMediaNoEffectInOverflowColumns"
]
},
{
"type": "array",
"minItems": 2,
"uniqueItems": true,
"items": {
"type": "string",
"enum": [
"interactive",
"paged",
"visual"
]
}
}
]
},
"inherited": {
"type": "boolean"
},
"animationType": {
"oneOf": [
{
"$ref": "#/definitions/animationType"
},
{
"$ref": "#/definitions/propertyList"
}
]
},
"percentages": {
"oneOf": [
{
"$ref": "#/definitions/percentages"
},
{
"$ref": "#/definitions/propertyList"
}
]
},
"groups": {
"type": "array",
"minitems": 1,
"uniqueItems": true,
"items": {
"$ref": "definitions.json#/groupList"
}
},
"initial": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/propertyList"
}
]
},
"appliesto": {
"$ref": "#/definitions/appliesto"
},
"alsoAppliesTo": {
"$ref": "#/definitions/alsoApplyTo"
},
"computed": {
"oneOf": [
{
"$ref": "#/definitions/computed"
},
{
"$ref": "#/definitions/propertyList"
}
]
},
"order": {
"$ref": "#/definitions/order"
},
"stacking": {
"type": "boolean"
},
"status": {
"$ref": "#/definitions/status"
},
"mdn_url": {
"$ref": "#/definitions/mdn_url"
}
}
}
}

View File

@@ -0,0 +1,927 @@
{
"Type selectors": {
"syntax": "element",
"groups": [
"Basic Selectors",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Type_selectors"
},
"Class selectors": {
"syntax": ".class",
"groups": [
"Basic Selectors",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Class_selectors"
},
"ID selectors": {
"syntax": "#id",
"groups": [
"Basic Selectors",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/ID_selectors"
},
"Universal selectors": {
"syntax": "*",
"groups": [
"Basic Selectors",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Universal_selectors"
},
"Attribute selectors": {
"syntax": "[attr=value]",
"groups": [
"Basic Selectors",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Attribute_selectors"
},
"Selector list": {
"syntax": ",",
"groups": [
"Grouping Selectors",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Selector_list"
},
"Adjacent sibling combinator": {
"syntax": "A + B",
"groups": [
"Combinators",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Adjacent_sibling_combinator"
},
"General sibling combinator": {
"syntax": "A ~ B",
"groups": [
"Combinators",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/General_sibling_combinator"
},
"Child combinator": {
"syntax": "A > B",
"groups": [
"Combinators",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Child_combinator"
},
"Descendant combinator": {
"syntax": "A B",
"groups": [
"Combinators",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Descendant_combinator"
},
"Column combinator": {
"syntax": "A || B",
"groups": [
"Combinators",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Column_combinator"
},
"Pseudo-classes": {
"syntax": ":",
"groups": [
"Pseudo",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Pseudo-classes"
},
"Pseudo-elements": {
"syntax": "::",
"groups": [
"Pseudo",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/Pseudo-elements"
},
":active": {
"syntax": ":active",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:active"
},
":any-link": {
"syntax": ":any-link",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:any-link"
},
":checked": {
"syntax": ":checked",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:checked"
},
":blank": {
"syntax": ":blank",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:blank"
},
":default": {
"syntax": ":default",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:default"
},
":defined": {
"syntax": ":defined",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:defined"
},
":dir": {
"syntax": ":dir( ltr | rtl )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:dir"
},
":disabled": {
"syntax": ":disabled",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:disabled"
},
":empty": {
"syntax": ":empty",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:empty"
},
":enabled": {
"syntax": ":enabled",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:enabled"
},
":first": {
"syntax": ":first",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:first"
},
":first-child": {
"syntax": ":first-child",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:first-child"
},
":first-of-type": {
"syntax": ":first-of-type",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:first-of-type"
},
":fullscreen": {
"syntax": ":fullscreen",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:fullscreen"
},
":focus": {
"syntax": ":focus",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:focus"
},
":focus-visible": {
"syntax": ":focus-visible",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:focus-visible"
},
":focus-within": {
"syntax": ":focus-within",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:focus-within"
},
":has": {
"syntax": ":has( <relative-selector-list> )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:has"
},
":host()": {
"syntax": ":host( <compound-selector-list> )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:host()"
},
":host-context()": {
"syntax": ":host-context( <compound-selector-list> )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:host-context()"
},
":hover": {
"syntax": ":hover",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:hover"
},
":indeterminate": {
"syntax": ":indeterminate",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:indeterminate"
},
":in-range": {
"syntax": ":in-range",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:in-range"
},
":invalid": {
"syntax": ":invalid",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:invalid"
},
":is": {
"syntax": ":is( <complex-selector-list> )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:is"
},
":lang": {
"syntax": ":lang( <language-code> )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:lang"
},
":last-child": {
"syntax": ":last-child",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:last-child"
},
":last-of-type": {
"syntax": ":last-of-type",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:last-of-type"
},
":left": {
"syntax": ":left",
"groups": [
"Pseudo-classes",
"Selectors",
"CSS Pages"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:left"
},
":link": {
"syntax": ":link",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:link"
},
":not": {
"syntax": ":not( <complex-selector-list> )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:not"
},
":nth-child": {
"syntax": ":nth-child( <nth> [ of <complex-selector-list> ]? )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:nth-child"
},
":nth-last-child": {
"syntax": ":nth-last-child( <nth> [ of <complex-selector-list> ]? )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:nth-last-child"
},
":nth-last-of-type": {
"syntax": ":nth-last-of-type( <nth> )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:nth-last-of-type"
},
":nth-of-type": {
"syntax": ":nth-of-type( <nth> )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:nth-of-type"
},
":only-child": {
"syntax": ":only-child",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:only-child"
},
":only-of-type": {
"syntax": ":only-of-type",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:only-of-type"
},
":optional": {
"syntax": ":optional",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:optional"
},
":out-of-range": {
"syntax": ":out-of-range",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:out-of-range"
},
":placeholder-shown": {
"syntax": ":placeholder-shown",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:placeholder-shown"
},
":read-only": {
"syntax": ":read-only",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:read-only"
},
":read-write": {
"syntax": ":read-write",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:read-write"
},
":required": {
"syntax": ":required",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:required"
},
":right": {
"syntax": ":right",
"groups": [
"Pseudo-classes",
"Selectors",
"CSS Pages"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:right"
},
":root": {
"syntax": ":root",
"groups": [
"Pseudo-classes",
"Selectors",
"CSS Pages"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:root"
},
":scope": {
"syntax": ":scope",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:scope"
},
":target": {
"syntax": ":target",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:target"
},
":valid": {
"syntax": ":valid",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:valid"
},
":visited": {
"syntax": ":visited",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:visited"
},
":where": {
"syntax": ":where( <complex-selector-list> )",
"groups": [
"Pseudo-classes",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/:where"
},
"::-moz-progress-bar": {
"syntax": "::-moz-progress-bar",
"groups": [
"Pseudo-elements",
"Selectors",
"Mozilla Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-moz-progress-bar"
},
"::-moz-range-progress": {
"syntax": "::-moz-range-progress",
"groups": [
"Pseudo-elements",
"Selectors",
"Mozilla Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-moz-range-progress"
},
"::-moz-range-thumb": {
"syntax": "::-moz-range-thumb",
"groups": [
"Pseudo-elements",
"Selectors",
"Mozilla Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-moz-range-thumb"
},
"::-moz-range-track": {
"syntax": "::-moz-range-track",
"groups": [
"Pseudo-elements",
"Selectors",
"Mozilla Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-moz-range-track"
},
"::-ms-browse": {
"syntax": "::-ms-browse",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-browse"
},
"::-ms-check": {
"syntax": "::-ms-check",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-check"
},
"::-ms-clear": {
"syntax": "::-ms-clear",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-clear"
},
"::-ms-expand": {
"syntax": "::-ms-clear",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-expand"
},
"::-ms-fill": {
"syntax": "::-ms-fill",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-fill"
},
"::-ms-fill-lower": {
"syntax": "::-ms-fill-lower",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-fill-lower"
},
"::-ms-fill-upper": {
"syntax": "::-ms-fill-upper",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-fill-upper"
},
"::-ms-reveal": {
"syntax": "::-ms-reveal",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-reveal"
},
"::-ms-thumb": {
"syntax": "::-ms-thumb",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-thumb"
},
"::-ms-ticks-after": {
"syntax": "::-ms-ticks-after",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-ticks-after"
},
"::-ms-ticks-before": {
"syntax": "::-ms-ticks-before",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-ticks-before"
},
"::-ms-tooltip": {
"syntax": "::-ms-tooltip",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-tooltip"
},
"::-ms-track": {
"syntax": "::-ms-track",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-track"
},
"::-ms-value": {
"syntax": "::-ms-value",
"groups": [
"Pseudo-elements",
"Selectors",
"Microsoft Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-ms-value"
},
"::-webkit-progress-bar": {
"syntax": "::-webkit-progress-bar",
"groups": [
"Pseudo-elements",
"Selectors",
"WebKit Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-progress-bar"
},
"::-webkit-progress-inner-value": {
"syntax": "::-webkit-progress-inner-value",
"groups": [
"Pseudo-elements",
"Selectors",
"WebKit Extensions"
],
"status": "nonstandard"
},
"::-webkit-progress-value": {
"syntax": "::-webkit-progress-value",
"groups": [
"Pseudo-elements",
"Selectors",
"WebKit Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-progress-value"
},
"::-webkit-slider-runnable-track": {
"syntax": "::-webkit-slider-runnable-track",
"groups": [
"Pseudo-elements",
"Selectors",
"WebKit Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-slider-runnable-track"
},
"::-webkit-slider-thumb": {
"syntax": "::-webkit-slider-thumb",
"groups": [
"Pseudo-elements",
"Selectors",
"WebKit Extensions"
],
"status": "nonstandard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::-webkit-slider-thumb"
},
"::after": {
"syntax": "/* CSS3 syntax */\n::after\n\n/* CSS2 syntax */\n:after",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::after"
},
"::backdrop": {
"syntax": "::backdrop",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::backdrop"
},
"::before": {
"syntax": "/* CSS3 syntax */\n::before\n\n/* CSS2 syntax */\n:before",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::before"
},
"::cue": {
"syntax": "::cue | ::cue( <selector> )",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::cue"
},
"::cue-region": {
"syntax": "::cue-region | ::cue-region( <selector> )",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::cue-region"
},
"::first-letter": {
"syntax": "/* CSS3 syntax */\n::first-letter\n\n/* CSS2 syntax */\n:first-letter",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::first-letter"
},
"::first-line": {
"syntax": "/* CSS3 syntax */\n::first-line\n\n/* CSS2 syntax */\n:first-line",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::first-line"
},
"::grammar-error": {
"syntax": "::grammar-error",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::grammar-error"
},
"::marker": {
"syntax": "::marker",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::marker"
},
"::part": {
"syntax": "::part( <ident>+ )",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::part"
},
"::placeholder": {
"syntax": "::placeholder",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::placeholder"
},
"::selection": {
"syntax": "::selection",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::selection"
},
"::slotted": {
"syntax": "::slotted( <compound-selector-list> )",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::slotted"
},
"::spelling-error": {
"syntax": "::spelling-error",
"groups": [
"Pseudo-elements",
"Selectors"
],
"status": "experimental",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/::spelling-error"
}
}

View File

@@ -0,0 +1,36 @@
{
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"syntax": {
"type": "string"
},
"groups": {
"type": "array",
"minitems": 1,
"uniqueItems": true,
"items": {
"$ref": "definitions.json#/groupList"
}
},
"status": {
"enum": [
"standard",
"nonstandard",
"experimental"
]
},
"mdn_url": {
"type": "string",
"pattern": "^https://developer.mozilla.org/docs/Web/CSS/"
}
},
"required": [
"syntax",
"groups",
"status"
]
}
}

View File

@@ -0,0 +1,761 @@
{
"absolute-size": {
"syntax": "xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large"
},
"alpha-value": {
"syntax": "<number> | <percentage>"
},
"angle-percentage": {
"syntax": "<angle> | <percentage>"
},
"angular-color-hint": {
"syntax": "<angle-percentage>"
},
"angular-color-stop": {
"syntax": "<color> && <color-stop-angle>?"
},
"angular-color-stop-list": {
"syntax": "[ <angular-color-stop> [, <angular-color-hint>]? ]# , <angular-color-stop>"
},
"animateable-feature": {
"syntax": "scroll-position | contents | <custom-ident>"
},
"attachment": {
"syntax": "scroll | fixed | local"
},
"attr()": {
"syntax": "attr( <attr-name> <type-or-unit>? [, <attr-fallback> ]? )"
},
"attr-matcher": {
"syntax": "[ '~' | '|' | '^' | '$' | '*' ]? '='"
},
"attr-modifier": {
"syntax": "i | s"
},
"attribute-selector": {
"syntax": "'[' <wq-name> ']' | '[' <wq-name> <attr-matcher> [ <string-token> | <ident-token> ] <attr-modifier>? ']'"
},
"auto-repeat": {
"syntax": "repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
},
"auto-track-list": {
"syntax": "[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>? <auto-repeat>\n[ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?"
},
"baseline-position": {
"syntax": "[ first | last ]? baseline"
},
"basic-shape": {
"syntax": "<inset()> | <circle()> | <ellipse()> | <polygon()> | <path()>"
},
"bg-image": {
"syntax": "none | <image>"
},
"bg-layer": {
"syntax": "<bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
},
"bg-position": {
"syntax": "[ [ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] | [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ] ]"
},
"bg-size": {
"syntax": "[ <length-percentage> | auto ]{1,2} | cover | contain"
},
"blur()": {
"syntax": "blur( <length> )"
},
"blend-mode": {
"syntax": "normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity"
},
"box": {
"syntax": "border-box | padding-box | content-box"
},
"brightness()": {
"syntax": "brightness( <number-percentage> )"
},
"calc()": {
"syntax": "calc( <calc-sum> )"
},
"calc-sum": {
"syntax": "<calc-product> [ [ '+' | '-' ] <calc-product> ]*"
},
"calc-product": {
"syntax": "<calc-value> [ '*' <calc-value> | '/' <number> ]*"
},
"calc-value": {
"syntax": "<number> | <dimension> | <percentage> | ( <calc-sum> )"
},
"cf-final-image": {
"syntax": "<image> | <color>"
},
"cf-mixing-image": {
"syntax": "<percentage>? && <image>"
},
"circle()": {
"syntax": "circle( [ <shape-radius> ]? [ at <position> ]? )"
},
"clamp()": {
"syntax": "clamp( <calc-sum>#{3} )"
},
"class-selector": {
"syntax": "'.' <ident-token>"
},
"clip-source": {
"syntax": "<url>"
},
"color": {
"syntax": "<rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>"
},
"color-stop": {
"syntax": "<color-stop-length> | <color-stop-angle>"
},
"color-stop-angle": {
"syntax": "<angle-percentage>{1,2}"
},
"color-stop-length": {
"syntax": "<length-percentage>{1,2}"
},
"color-stop-list": {
"syntax": "[ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop>"
},
"combinator": {
"syntax": "'>' | '+' | '~' | [ '||' ]"
},
"common-lig-values": {
"syntax": "[ common-ligatures | no-common-ligatures ]"
},
"compat-auto": {
"syntax": "searchfield | textarea | push-button | slider-horizontal | checkbox | radio | square-button | menulist | listbox | meter | progress-bar | button"
},
"composite-style": {
"syntax": "clear | copy | source-over | source-in | source-out | source-atop | destination-over | destination-in | destination-out | destination-atop | xor"
},
"compositing-operator": {
"syntax": "add | subtract | intersect | exclude"
},
"compound-selector": {
"syntax": "[ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!"
},
"compound-selector-list": {
"syntax": "<compound-selector>#"
},
"complex-selector": {
"syntax": "<compound-selector> [ <combinator>? <compound-selector> ]*"
},
"complex-selector-list": {
"syntax": "<complex-selector>#"
},
"conic-gradient()": {
"syntax": "conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )"
},
"contextual-alt-values": {
"syntax": "[ contextual | no-contextual ]"
},
"content-distribution": {
"syntax": "space-between | space-around | space-evenly | stretch"
},
"content-list": {
"syntax": "[ <string> | contents | <image> | <quote> | <target> | <leader()> ]+"
},
"content-position": {
"syntax": "center | start | end | flex-start | flex-end"
},
"content-replacement": {
"syntax": "<image>"
},
"contrast()": {
"syntax": "contrast( [ <number-percentage> ] )"
},
"counter()": {
"syntax": "counter( <custom-ident>, <counter-style>? )"
},
"counter-style": {
"syntax": "<counter-style-name> | symbols()"
},
"counter-style-name": {
"syntax": "<custom-ident>"
},
"counters()": {
"syntax": "counters( <custom-ident>, <string>, <counter-style>? )"
},
"cross-fade()": {
"syntax": "cross-fade( <cf-mixing-image> , <cf-final-image>? )"
},
"cubic-bezier-timing-function": {
"syntax": "ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number [0,1]>, <number>, <number [0,1]>, <number>)"
},
"deprecated-system-color": {
"syntax": "ActiveBorder | ActiveCaption | AppWorkspace | Background | ButtonFace | ButtonHighlight | ButtonShadow | ButtonText | CaptionText | GrayText | Highlight | HighlightText | InactiveBorder | InactiveCaption | InactiveCaptionText | InfoBackground | InfoText | Menu | MenuText | Scrollbar | ThreeDDarkShadow | ThreeDFace | ThreeDHighlight | ThreeDLightShadow | ThreeDShadow | Window | WindowFrame | WindowText"
},
"discretionary-lig-values": {
"syntax": "[ discretionary-ligatures | no-discretionary-ligatures ]"
},
"display-box": {
"syntax": "contents | none"
},
"display-inside": {
"syntax": "flow | flow-root | table | flex | grid | ruby"
},
"display-internal": {
"syntax": "table-row-group | table-header-group | table-footer-group | table-row | table-cell | table-column-group | table-column | table-caption | ruby-base | ruby-text | ruby-base-container | ruby-text-container"
},
"display-legacy": {
"syntax": "inline-block | inline-list-item | inline-table | inline-flex | inline-grid"
},
"display-listitem": {
"syntax": "<display-outside>? && [ flow | flow-root ]? && list-item"
},
"display-outside": {
"syntax": "block | inline | run-in"
},
"drop-shadow()": {
"syntax": "drop-shadow( <length>{2,3} <color>? )"
},
"east-asian-variant-values": {
"syntax": "[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]"
},
"east-asian-width-values": {
"syntax": "[ full-width | proportional-width ]"
},
"element()": {
"syntax": "element( <id-selector> )"
},
"ellipse()": {
"syntax": "ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )"
},
"ending-shape": {
"syntax": "circle | ellipse"
},
"env()": {
"syntax": "env( <custom-ident> , <declaration-value>? )"
},
"explicit-track-list": {
"syntax": "[ <line-names>? <track-size> ]+ <line-names>?"
},
"family-name": {
"syntax": "<string> | <custom-ident>+"
},
"feature-tag-value": {
"syntax": "<string> [ <integer> | on | off ]?"
},
"feature-type": {
"syntax": "@stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation"
},
"feature-value-block": {
"syntax": "<feature-type> '{' <feature-value-declaration-list> '}'"
},
"feature-value-block-list": {
"syntax": "<feature-value-block>+"
},
"feature-value-declaration": {
"syntax": "<custom-ident>: <integer>+;"
},
"feature-value-declaration-list": {
"syntax": "<feature-value-declaration>"
},
"feature-value-name": {
"syntax": "<custom-ident>"
},
"fill-rule": {
"syntax": "nonzero | evenodd"
},
"filter-function": {
"syntax": "<blur()> | <brightness()> | <contrast()> | <drop-shadow()> | <grayscale()> | <hue-rotate()> | <invert()> | <opacity()> | <saturate()> | <sepia()>"
},
"filter-function-list": {
"syntax": "[ <filter-function> | <url> ]+"
},
"final-bg-layer": {
"syntax": "<'background-color'> || <bg-image> || <bg-position> [ / <bg-size> ]? || <repeat-style> || <attachment> || <box> || <box>"
},
"fit-content()": {
"syntax": "fit-content( [ <length> | <percentage> ] )"
},
"fixed-breadth": {
"syntax": "<length-percentage>"
},
"fixed-repeat": {
"syntax": "repeat( [ <positive-integer> ] , [ <line-names>? <fixed-size> ]+ <line-names>? )"
},
"fixed-size": {
"syntax": "<fixed-breadth> | minmax( <fixed-breadth> , <track-breadth> ) | minmax( <inflexible-breadth> , <fixed-breadth> )"
},
"font-stretch-absolute": {
"syntax": "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <percentage>"
},
"font-variant-css21": {
"syntax": "[ normal | small-caps ]"
},
"font-weight-absolute": {
"syntax": "normal | bold | <number [1,1000]>"
},
"frequency-percentage": {
"syntax": "<frequency> | <percentage>"
},
"general-enclosed": {
"syntax": "[ <function-token> <any-value> ) ] | ( <ident> <any-value> )"
},
"generic-family": {
"syntax": "serif | sans-serif | cursive | fantasy | monospace"
},
"generic-name": {
"syntax": "serif | sans-serif | cursive | fantasy | monospace"
},
"geometry-box": {
"syntax": "<shape-box> | fill-box | stroke-box | view-box"
},
"gradient": {
"syntax": "<linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()> | <conic-gradient()>"
},
"grayscale()": {
"syntax": "grayscale( <number-percentage> )"
},
"grid-line": {
"syntax": "auto | <custom-ident> | [ <integer> && <custom-ident>? ] | [ span && [ <integer> || <custom-ident> ] ]"
},
"historical-lig-values": {
"syntax": "[ historical-ligatures | no-historical-ligatures ]"
},
"hsl()": {
"syntax": "hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )"
},
"hsla()": {
"syntax": "hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )"
},
"hue": {
"syntax": "<number> | <angle>"
},
"hue-rotate()": {
"syntax": "hue-rotate( <angle> )"
},
"id-selector": {
"syntax": "<hash-token>"
},
"image": {
"syntax": "<url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>"
},
"image()": {
"syntax": "image( <image-tags>? [ <image-src>? , <color>? ]! )"
},
"image-set()": {
"syntax": "image-set( <image-set-option># )"
},
"image-set-option": {
"syntax": "[ <image> | <string> ] <resolution>"
},
"image-src": {
"syntax": "<url> | <string>"
},
"image-tags": {
"syntax": "ltr | rtl"
},
"inflexible-breadth": {
"syntax": "<length> | <percentage> | min-content | max-content | auto"
},
"inset()": {
"syntax": "inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )"
},
"invert()": {
"syntax": "invert( <number-percentage> )"
},
"keyframes-name": {
"syntax": "<custom-ident> | <string>"
},
"keyframe-block": {
"syntax": "<keyframe-selector># {\n <declaration-list>\n}"
},
"keyframe-block-list": {
"syntax": "<keyframe-block>+"
},
"keyframe-selector": {
"syntax": "from | to | <percentage>"
},
"leader()": {
"syntax": "leader( <leader-type> )"
},
"leader-type": {
"syntax": "dotted | solid | space | <string>"
},
"length-percentage": {
"syntax": "<length> | <percentage>"
},
"line-names": {
"syntax": "'[' <custom-ident>* ']'"
},
"line-name-list": {
"syntax": "[ <line-names> | <name-repeat> ]+"
},
"line-style": {
"syntax": "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset"
},
"line-width": {
"syntax": "<length> | thin | medium | thick"
},
"linear-color-hint": {
"syntax": "<length-percentage>"
},
"linear-color-stop": {
"syntax": "<color> <color-stop-length>?"
},
"linear-gradient()": {
"syntax": "linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
},
"mask-layer": {
"syntax": "<mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode>"
},
"mask-position": {
"syntax": "[ <length-percentage> | left | center | right ] [ <length-percentage> | top | center | bottom ]?"
},
"mask-reference": {
"syntax": "none | <image> | <mask-source>"
},
"mask-source": {
"syntax": "<url>"
},
"masking-mode": {
"syntax": "alpha | luminance | match-source"
},
"matrix()": {
"syntax": "matrix( <number>#{6} )"
},
"matrix3d()": {
"syntax": "matrix3d( <number>#{16} )"
},
"max()": {
"syntax": "max( <calc-sum># )"
},
"media-and": {
"syntax": "<media-in-parens> [ and <media-in-parens> ]+"
},
"media-condition": {
"syntax": "<media-not> | <media-and> | <media-or> | <media-in-parens>"
},
"media-condition-without-or": {
"syntax": "<media-not> | <media-and> | <media-in-parens>"
},
"media-feature": {
"syntax": "( [ <mf-plain> | <mf-boolean> | <mf-range> ] )"
},
"media-in-parens": {
"syntax": "( <media-condition> ) | <media-feature> | <general-enclosed>"
},
"media-not": {
"syntax": "not <media-in-parens>"
},
"media-or": {
"syntax": "<media-in-parens> [ or <media-in-parens> ]+"
},
"media-query": {
"syntax": "<media-condition> | [ not | only ]? <media-type> [ and <media-condition-without-or> ]?"
},
"media-query-list": {
"syntax": "<media-query>#"
},
"media-type": {
"syntax": "<ident>"
},
"mf-boolean": {
"syntax": "<mf-name>"
},
"mf-name": {
"syntax": "<ident>"
},
"mf-plain": {
"syntax": "<mf-name> : <mf-value>"
},
"mf-range": {
"syntax": "<mf-name> [ '<' | '>' ]? '='? <mf-value>\n| <mf-value> [ '<' | '>' ]? '='? <mf-name>\n| <mf-value> '<' '='? <mf-name> '<' '='? <mf-value>\n| <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>"
},
"mf-value": {
"syntax": "<number> | <dimension> | <ident> | <ratio>"
},
"min()": {
"syntax": "min( <calc-sum># )"
},
"minmax()": {
"syntax": "minmax( [ <length> | <percentage> | min-content | max-content | auto ] , [ <length> | <percentage> | <flex> | min-content | max-content | auto ] )"
},
"named-color": {
"syntax": "transparent | aliceblue | antiquewhite | aqua | aquamarine | azure | beige | bisque | black | blanchedalmond | blue | blueviolet | brown | burlywood | cadetblue | chartreuse | chocolate | coral | cornflowerblue | cornsilk | crimson | cyan | darkblue | darkcyan | darkgoldenrod | darkgray | darkgreen | darkgrey | darkkhaki | darkmagenta | darkolivegreen | darkorange | darkorchid | darkred | darksalmon | darkseagreen | darkslateblue | darkslategray | darkslategrey | darkturquoise | darkviolet | deeppink | deepskyblue | dimgray | dimgrey | dodgerblue | firebrick | floralwhite | forestgreen | fuchsia | gainsboro | ghostwhite | gold | goldenrod | gray | green | greenyellow | grey | honeydew | hotpink | indianred | indigo | ivory | khaki | lavender | lavenderblush | lawngreen | lemonchiffon | lightblue | lightcoral | lightcyan | lightgoldenrodyellow | lightgray | lightgreen | lightgrey | lightpink | lightsalmon | lightseagreen | lightskyblue | lightslategray | lightslategrey | lightsteelblue | lightyellow | lime | limegreen | linen | magenta | maroon | mediumaquamarine | mediumblue | mediumorchid | mediumpurple | mediumseagreen | mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred | midnightblue | mintcream | mistyrose | moccasin | navajowhite | navy | oldlace | olive | olivedrab | orange | orangered | orchid | palegoldenrod | palegreen | paleturquoise | palevioletred | papayawhip | peachpuff | peru | pink | plum | powderblue | purple | rebeccapurple | red | rosybrown | royalblue | saddlebrown | salmon | sandybrown | seagreen | seashell | sienna | silver | skyblue | slateblue | slategray | slategrey | snow | springgreen | steelblue | tan | teal | thistle | tomato | turquoise | violet | wheat | white | whitesmoke | yellow | yellowgreen"
},
"namespace-prefix": {
"syntax": "<ident>"
},
"ns-prefix": {
"syntax": "[ <ident-token> | '*' ]? '|'"
},
"number-percentage": {
"syntax": "<number> | <percentage>"
},
"numeric-figure-values": {
"syntax": "[ lining-nums | oldstyle-nums ]"
},
"numeric-fraction-values": {
"syntax": "[ diagonal-fractions | stacked-fractions ]"
},
"numeric-spacing-values": {
"syntax": "[ proportional-nums | tabular-nums ]"
},
"nth": {
"syntax": "<an-plus-b> | even | odd"
},
"opacity()": {
"syntax": "opacity( [ <number-percentage> ] )"
},
"overflow-position": {
"syntax": "unsafe | safe"
},
"outline-radius": {
"syntax": "<length> | <percentage>"
},
"page-body": {
"syntax": "<declaration>? [ ; <page-body> ]? | <page-margin-box> <page-body>"
},
"page-margin-box": {
"syntax": "<page-margin-box-type> '{' <declaration-list> '}'"
},
"page-margin-box-type": {
"syntax": "@top-left-corner | @top-left | @top-center | @top-right | @top-right-corner | @bottom-left-corner | @bottom-left | @bottom-center | @bottom-right | @bottom-right-corner | @left-top | @left-middle | @left-bottom | @right-top | @right-middle | @right-bottom"
},
"page-selector-list": {
"syntax": "[ <page-selector># ]?"
},
"page-selector": {
"syntax": "<pseudo-page>+ | <ident> <pseudo-page>*"
},
"path()": {
"syntax": "path( [ <fill-rule>, ]? <string> )"
},
"paint()": {
"syntax": "paint( <ident>, <declaration-value>? )"
},
"perspective()": {
"syntax": "perspective( <length> )"
},
"polygon()": {
"syntax": "polygon( <fill-rule>? , [ <length-percentage> <length-percentage> ]# )"
},
"position": {
"syntax": "[ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]"
},
"pseudo-class-selector": {
"syntax": "':' <ident-token> | ':' <function-token> <any-value> ')'"
},
"pseudo-element-selector": {
"syntax": "':' <pseudo-class-selector>"
},
"pseudo-page": {
"syntax": ": [ left | right | first | blank ]"
},
"quote": {
"syntax": "open-quote | close-quote | no-open-quote | no-close-quote"
},
"radial-gradient()": {
"syntax": "radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
},
"relative-selector": {
"syntax": "<combinator>? <complex-selector>"
},
"relative-selector-list": {
"syntax": "<relative-selector>#"
},
"relative-size": {
"syntax": "larger | smaller"
},
"repeat-style": {
"syntax": "repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2}"
},
"repeating-linear-gradient()": {
"syntax": "repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )"
},
"repeating-radial-gradient()": {
"syntax": "repeating-radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )"
},
"rgb()": {
"syntax": "rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )"
},
"rgba()": {
"syntax": "rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )"
},
"rotate()": {
"syntax": "rotate( [ <angle> | <zero> ] )"
},
"rotate3d()": {
"syntax": "rotate3d( <number> , <number> , <number> , [ <angle> | <zero> ] )"
},
"rotateX()": {
"syntax": "rotateX( [ <angle> | <zero> ] )"
},
"rotateY()": {
"syntax": "rotateY( [ <angle> | <zero> ] )"
},
"rotateZ()": {
"syntax": "rotateZ( [ <angle> | <zero> ] )"
},
"saturate()": {
"syntax": "saturate( <number-percentage> )"
},
"scale()": {
"syntax": "scale( <number> , <number>? )"
},
"scale3d()": {
"syntax": "scale3d( <number> , <number> , <number> )"
},
"scaleX()": {
"syntax": "scaleX( <number> )"
},
"scaleY()": {
"syntax": "scaleY( <number> )"
},
"scaleZ()": {
"syntax": "scaleZ( <number> )"
},
"self-position": {
"syntax": "center | start | end | self-start | self-end | flex-start | flex-end"
},
"shape-radius": {
"syntax": "<length-percentage> | closest-side | farthest-side"
},
"skew()": {
"syntax": "skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? )"
},
"skewX()": {
"syntax": "skewX( [ <angle> | <zero> ] )"
},
"skewY()": {
"syntax": "skewY( [ <angle> | <zero> ] )"
},
"sepia()": {
"syntax": "sepia( <number-percentage> )"
},
"shadow": {
"syntax": "inset? && <length>{2,4} && <color>?"
},
"shadow-t": {
"syntax": "[ <length>{2,3} && <color>? ]"
},
"shape": {
"syntax": "rect(<top>, <right>, <bottom>, <left>)"
},
"shape-box": {
"syntax": "<box> | margin-box"
},
"side-or-corner": {
"syntax": "[ left | right ] || [ top | bottom ]"
},
"single-animation": {
"syntax": "<time> || <timing-function> || <time> || <single-animation-iteration-count> || <single-animation-direction> || <single-animation-fill-mode> || <single-animation-play-state> || [ none | <keyframes-name> ]"
},
"single-animation-direction": {
"syntax": "normal | reverse | alternate | alternate-reverse"
},
"single-animation-fill-mode": {
"syntax": "none | forwards | backwards | both"
},
"single-animation-iteration-count": {
"syntax": "infinite | <number>"
},
"single-animation-play-state": {
"syntax": "running | paused"
},
"single-transition": {
"syntax": "[ none | <single-transition-property> ] || <time> || <timing-function> || <time>"
},
"single-transition-property": {
"syntax": "all | <custom-ident>"
},
"size": {
"syntax": "closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}"
},
"step-position": {
"syntax": "jump-start | jump-end | jump-none | jump-both | start | end"
},
"step-timing-function": {
"syntax": "step-start | step-end | steps(<integer>[, <step-position>]?)"
},
"subclass-selector": {
"syntax": "<id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector>"
},
"supports-condition": {
"syntax": "not <supports-in-parens> | <supports-in-parens> [ and <supports-in-parens> ]* | <supports-in-parens> [ or <supports-in-parens> ]*"
},
"supports-in-parens": {
"syntax": "( <supports-condition> ) | <supports-feature> | <general-enclosed>"
},
"supports-feature": {
"syntax": "<supports-decl> | <supports-selector-fn>"
},
"supports-decl": {
"syntax": "( <declaration> )"
},
"supports-selector-fn": {
"syntax": "selector( <complex-selector> )"
},
"symbol": {
"syntax": "<string> | <image> | <custom-ident>"
},
"target": {
"syntax": "<target-counter()> | <target-counters()> | <target-text()>"
},
"target-counter()": {
"syntax": "target-counter( [ <string> | <url> ] , <custom-ident> , <counter-style>? )"
},
"target-counters()": {
"syntax": "target-counters( [ <string> | <url> ] , <custom-ident> , <string> , <counter-style>? )"
},
"target-text()": {
"syntax": "target-text( [ <string> | <url> ] , [ content | before | after | first-letter ]? )"
},
"time-percentage": {
"syntax": "<time> | <percentage>"
},
"timing-function": {
"syntax": "linear | <cubic-bezier-timing-function> | <step-timing-function>"
},
"track-breadth": {
"syntax": "<length-percentage> | <flex> | min-content | max-content | auto"
},
"track-list": {
"syntax": "[ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?"
},
"track-repeat": {
"syntax": "repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )"
},
"track-size": {
"syntax": "<track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )"
},
"transform-function": {
"syntax": "<matrix()> | <translate()> | <translateX()> | <translateY()> | <scale()> | <scaleX()> | <scaleY()> | <rotate()> | <skew()> | <skewX()> | <skewY()> | <matrix3d()> | <translate3d()> | <translateZ()> | <scale3d()> | <scaleZ()> | <rotate3d()> | <rotateX()> | <rotateY()> | <rotateZ()> | <perspective()>"
},
"transform-list": {
"syntax": "<transform-function>+"
},
"translate()": {
"syntax": "translate( <length-percentage> , <length-percentage>? )"
},
"translate3d()": {
"syntax": "translate3d( <length-percentage> , <length-percentage> , <length> )"
},
"translateX()": {
"syntax": "translateX( <length-percentage> )"
},
"translateY()": {
"syntax": "translateY( <length-percentage> )"
},
"translateZ()": {
"syntax": "translateZ( <length> )"
},
"type-or-unit": {
"syntax": "string | color | url | integer | number | length | angle | time | frequency | cap | ch | em | ex | ic | lh | rlh | rem | vb | vi | vw | vh | vmin | vmax | mm | Q | cm | in | pt | pc | px | deg | grad | rad | turn | ms | s | Hz | kHz | %"
},
"type-selector": {
"syntax": "<wq-name> | <ns-prefix>? '*'"
},
"var()": {
"syntax": "var( <custom-property-name> , <declaration-value>? )"
},
"viewport-length": {
"syntax": "auto | <length-percentage>"
},
"wq-name": {
"syntax": "<ns-prefix>? <ident-token>"
}
}

View File

@@ -0,0 +1,15 @@
{
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"required": [
"syntax"
],
"properties": {
"syntax": {
"type": "string"
}
}
}
}

View File

@@ -0,0 +1,265 @@
{
"an-plus-b": {
"groups": [
"Selectors"
],
"status": "standard"
},
"angle": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/angle"
},
"angle-percentage": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/angle-percentage"
},
"basic-shape": {
"groups": [
"CSS Shapes",
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/basic-shape"
},
"blend-mode": {
"groups": [
"Compositing and Blending",
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/blend-mode"
},
"color": {
"groups": [
"CSS Color",
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/color_value"
},
"custom-ident": {
"groups": [
"CSS Will Change",
"CSS Counter Styles",
"CSS Lists and Counters",
"CSS Animations",
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/custom-ident"
},
"dimension": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/dimension"
},
"display-outside": {
"groups": [
"CSS Display"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/display-outside"
},
"display-inside": {
"groups": [
"CSS Display"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/display-inside"
},
"display-listitem": {
"groups": [
"CSS Display"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/display-listitem"
},
"display-internal": {
"groups": [
"CSS Display"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/display-internal"
},
"display-box": {
"groups": [
"CSS Display"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/display-box"
},
"display-legacy": {
"groups": [
"CSS Display"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/display-legacy"
},
"filter-function": {
"groups": [
"Filter Effects"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/filter-function"
},
"flex": {
"groups": [
"CSS Grid Layout",
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/flex_value"
},
"frequency": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/frequency"
},
"frequency-percentage": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/frequency-percentage"
},
"gradient": {
"groups": [
"CSS Images",
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/gradient"
},
"ident": {
"groups": [
"CSS Types"
],
"status": "standard"
},
"image": {
"groups": [
"CSS Images",
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/image"
},
"integer": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/integer"
},
"length": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/length"
},
"length-percentage": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/length-percentage"
},
"number": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/number"
},
"percentage": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/percentage"
},
"position": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/position_value"
},
"ratio": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/ratio"
},
"resolution": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/resolution"
},
"shape": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/shape"
},
"string": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/string"
},
"time": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/time"
},
"time-percentage": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/time-percentage"
},
"timing-function": {
"groups": [
"CSS Animations",
"CSS Transitions",
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/timing-function"
},
"transform-function": {
"groups": [
"CSS Transforms",
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/transform-function"
},
"url": {
"groups": [
"CSS Types"
],
"status": "standard",
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/url"
}
}

View File

@@ -0,0 +1,32 @@
{
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"groups": {
"type": "array",
"minitems": 1,
"uniqueItems": true,
"items": {
"$ref": "definitions.json#/groupList"
}
},
"status": {
"enum": [
"standard",
"nonstandard",
"experimental"
]
},
"mdn_url": {
"type": "string",
"pattern": "^https://developer.mozilla.org/docs/Web/CSS/"
}
},
"required": [
"groups",
"status"
]
}
}

View File

@@ -0,0 +1,199 @@
{
"ch": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"cm": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"deg": {
"groups": [
"CSS Units",
"CSS Angles"
],
"status": "standard"
},
"dpcm": {
"groups": [
"CSS Units",
"CSS Resolutions"
],
"status": "standard"
},
"dpi": {
"groups": [
"CSS Units",
"CSS Resolutions"
],
"status": "standard"
},
"dppx": {
"groups": [
"CSS Units",
"CSS Resolutions"
],
"status": "standard"
},
"em": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"ex": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"fr": {
"groups": [
"CSS Units",
"CSS Flexible Lengths",
"CSS Grid Layout"
],
"status": "standard"
},
"grad": {
"groups": [
"CSS Units",
"CSS Angles"
],
"status": "standard"
},
"Hz": {
"groups": [
"CSS Units",
"CSS Frequencies"
],
"status": "standard"
},
"in": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"kHz": {
"groups": [
"CSS Units",
"CSS Frequencies"
],
"status": "standard"
},
"mm": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"ms": {
"groups": [
"CSS Units",
"CSS Times"
],
"status": "standard"
},
"pc": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"pt": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"px": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"Q": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"rad": {
"groups": [
"CSS Units",
"CSS Angles"
],
"status": "standard"
},
"rem": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"s": {
"groups": [
"CSS Units",
"CSS Times"
],
"status": "standard"
},
"turn": {
"groups": [
"CSS Units",
"CSS Angles"
],
"status": "standard"
},
"vh": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"vmax": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"vmin": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"vw": {
"groups": [
"CSS Units",
"CSS Lengths"
],
"status": "standard"
},
"x": {
"groups": [
"CSS Units",
"CSS Resolutions"
],
"status": "standard"
}
}

View File

@@ -0,0 +1,28 @@
{
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"groups": {
"type": "array",
"minitems": 1,
"uniqueItems": true,
"items": {
"$ref": "definitions.json#/groupList"
}
},
"status": {
"enum": [
"standard",
"nonstandard",
"experimental"
]
}
},
"required": [
"groups",
"status"
]
}
}

View File

@@ -0,0 +1,5 @@
module.exports = {
api: require('./api'),
css: require('./css'),
l10n: require('./l10n'),
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
module.exports = {
css: require('./css'),
}

View File

@@ -0,0 +1,39 @@
{
"name": "mdn-data",
"version": "2.0.14",
"description": "Open Web data by the Mozilla Developer Network",
"main": "index.js",
"files": [
"api/index.js",
"api/*.json",
"css/index.js",
"css/*.json",
"l10n/index.js",
"l10n/*.json"
],
"repository": {
"type": "git",
"url": "https://github.com/mdn/data.git"
},
"keywords": [
"data",
"mdn",
"mozilla",
"css"
],
"author": "Mozilla Developer Network",
"license": "CC0-1.0",
"bugs": {
"url": "https://github.com/mdn/data/issues"
},
"homepage": "https://developer.mozilla.org",
"devDependencies": {
"ajv": "^5.0.1",
"better-ajv-errors": "^0.5.1"
},
"scripts": {
"lint": "node test/lint",
"travis": "npm test",
"test": "npm run lint"
}
}

View File

@@ -0,0 +1,301 @@
# Change Log
## 0.5.6
* Fix for regression when people were using numbers as names in source maps. See
#236.
## 0.5.5
* Fix "regression" of unsupported, implementation behavior that half the world
happens to have come to depend on. See #235.
* Fix regression involving function hoisting in SpiderMonkey. See #233.
## 0.5.4
* Large performance improvements to source-map serialization. See #228 and #229.
## 0.5.3
* Do not include unnecessary distribution files. See
commit ef7006f8d1647e0a83fdc60f04f5a7ca54886f86.
## 0.5.2
* Include browser distributions of the library in package.json's `files`. See
issue #212.
## 0.5.1
* Fix latent bugs in IndexedSourceMapConsumer.prototype._parseMappings. See
ff05274becc9e6e1295ed60f3ea090d31d843379.
## 0.5.0
* Node 0.8 is no longer supported.
* Use webpack instead of dryice for bundling.
* Big speedups serializing source maps. See pull request #203.
* Fix a bug with `SourceMapConsumer.prototype.sourceContentFor` and sources that
explicitly start with the source root. See issue #199.
## 0.4.4
* Fix an issue where using a `SourceMapGenerator` after having created a
`SourceMapConsumer` from it via `SourceMapConsumer.fromSourceMap` failed. See
issue #191.
* Fix an issue with where `SourceMapGenerator` would mistakenly consider
different mappings as duplicates of each other and avoid generating them. See
issue #192.
## 0.4.3
* A very large number of performance improvements, particularly when parsing
source maps. Collectively about 75% of time shaved off of the source map
parsing benchmark!
* Fix a bug in `SourceMapConsumer.prototype.allGeneratedPositionsFor` and fuzzy
searching in the presence of a column option. See issue #177.
* Fix a bug with joining a source and its source root when the source is above
the root. See issue #182.
* Add the `SourceMapConsumer.prototype.hasContentsOfAllSources` method to
determine when all sources' contents are inlined into the source map. See
issue #190.
## 0.4.2
* Add an `.npmignore` file so that the benchmarks aren't pulled down by
dependent projects. Issue #169.
* Add an optional `column` argument to
`SourceMapConsumer.prototype.allGeneratedPositionsFor` and better handle lines
with no mappings. Issues #172 and #173.
## 0.4.1
* Fix accidentally defining a global variable. #170.
## 0.4.0
* The default direction for fuzzy searching was changed back to its original
direction. See #164.
* There is now a `bias` option you can supply to `SourceMapConsumer` to control
the fuzzy searching direction. See #167.
* About an 8% speed up in parsing source maps. See #159.
* Added a benchmark for parsing and generating source maps.
## 0.3.0
* Change the default direction that searching for positions fuzzes when there is
not an exact match. See #154.
* Support for environments using json2.js for JSON serialization. See #156.
## 0.2.0
* Support for consuming "indexed" source maps which do not have any remote
sections. See pull request #127. This introduces a minor backwards
incompatibility if you are monkey patching `SourceMapConsumer.prototype`
methods.
## 0.1.43
* Performance improvements for `SourceMapGenerator` and `SourceNode`. See issue
#148 for some discussion and issues #150, #151, and #152 for implementations.
## 0.1.42
* Fix an issue where `SourceNode`s from different versions of the source-map
library couldn't be used in conjunction with each other. See issue #142.
## 0.1.41
* Fix a bug with getting the source content of relative sources with a "./"
prefix. See issue #145 and [Bug 1090768](bugzil.la/1090768).
* Add the `SourceMapConsumer.prototype.computeColumnSpans` method to compute the
column span of each mapping.
* Add the `SourceMapConsumer.prototype.allGeneratedPositionsFor` method to find
all generated positions associated with a given original source and line.
## 0.1.40
* Performance improvements for parsing source maps in SourceMapConsumer.
## 0.1.39
* Fix a bug where setting a source's contents to null before any source content
had been set before threw a TypeError. See issue #131.
## 0.1.38
* Fix a bug where finding relative paths from an empty path were creating
absolute paths. See issue #129.
## 0.1.37
* Fix a bug where if the source root was an empty string, relative source paths
would turn into absolute source paths. Issue #124.
## 0.1.36
* Allow the `names` mapping property to be an empty string. Issue #121.
## 0.1.35
* A third optional parameter was added to `SourceNode.fromStringWithSourceMap`
to specify a path that relative sources in the second parameter should be
relative to. Issue #105.
* If no file property is given to a `SourceMapGenerator`, then the resulting
source map will no longer have a `null` file property. The property will
simply not exist. Issue #104.
* Fixed a bug where consecutive newlines were ignored in `SourceNode`s.
Issue #116.
## 0.1.34
* Make `SourceNode` work with windows style ("\r\n") newlines. Issue #103.
* Fix bug involving source contents and the
`SourceMapGenerator.prototype.applySourceMap`. Issue #100.
## 0.1.33
* Fix some edge cases surrounding path joining and URL resolution.
* Add a third parameter for relative path to
`SourceMapGenerator.prototype.applySourceMap`.
* Fix issues with mappings and EOLs.
## 0.1.32
* Fixed a bug where SourceMapConsumer couldn't handle negative relative columns
(issue 92).
* Fixed test runner to actually report number of failed tests as its process
exit code.
* Fixed a typo when reporting bad mappings (issue 87).
## 0.1.31
* Delay parsing the mappings in SourceMapConsumer until queried for a source
location.
* Support Sass source maps (which at the time of writing deviate from the spec
in small ways) in SourceMapConsumer.
## 0.1.30
* Do not join source root with a source, when the source is a data URI.
* Extend the test runner to allow running single specific test files at a time.
* Performance improvements in `SourceNode.prototype.walk` and
`SourceMapConsumer.prototype.eachMapping`.
* Source map browser builds will now work inside Workers.
* Better error messages when attempting to add an invalid mapping to a
`SourceMapGenerator`.
## 0.1.29
* Allow duplicate entries in the `names` and `sources` arrays of source maps
(usually from TypeScript) we are parsing. Fixes github issue 72.
## 0.1.28
* Skip duplicate mappings when creating source maps from SourceNode; github
issue 75.
## 0.1.27
* Don't throw an error when the `file` property is missing in SourceMapConsumer,
we don't use it anyway.
## 0.1.26
* Fix SourceNode.fromStringWithSourceMap for empty maps. Fixes github issue 70.
## 0.1.25
* Make compatible with browserify
## 0.1.24
* Fix issue with absolute paths and `file://` URIs. See
https://bugzilla.mozilla.org/show_bug.cgi?id=885597
## 0.1.23
* Fix issue with absolute paths and sourcesContent, github issue 64.
## 0.1.22
* Ignore duplicate mappings in SourceMapGenerator. Fixes github issue 21.
## 0.1.21
* Fixed handling of sources that start with a slash so that they are relative to
the source root's host.
## 0.1.20
* Fixed github issue #43: absolute URLs aren't joined with the source root
anymore.
## 0.1.19
* Using Travis CI to run tests.
## 0.1.18
* Fixed a bug in the handling of sourceRoot.
## 0.1.17
* Added SourceNode.fromStringWithSourceMap.
## 0.1.16
* Added missing documentation.
* Fixed the generating of empty mappings in SourceNode.
## 0.1.15
* Added SourceMapGenerator.applySourceMap.
## 0.1.14
* The sourceRoot is now handled consistently.
## 0.1.13
* Added SourceMapGenerator.fromSourceMap.
## 0.1.12
* SourceNode now generates empty mappings too.
## 0.1.11
* Added name support to SourceNode.
## 0.1.10
* Added sourcesContent support to the customer and generator.

View File

@@ -0,0 +1,28 @@
Copyright (c) 2009-2011, Mozilla Foundation and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the names of the Mozilla Foundation nor the names of project
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,742 @@
# Source Map
[![Build Status](https://travis-ci.org/mozilla/source-map.png?branch=master)](https://travis-ci.org/mozilla/source-map)
[![NPM](https://nodei.co/npm/source-map.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map)
This is a library to generate and consume the source map format
[described here][format].
[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
## Use with Node
$ npm install source-map
## Use on the Web
<script src="https://raw.githubusercontent.com/mozilla/source-map/master/dist/source-map.min.js" defer></script>
--------------------------------------------------------------------------------
<!-- `npm run toc` to regenerate the Table of Contents -->
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [Examples](#examples)
- [Consuming a source map](#consuming-a-source-map)
- [Generating a source map](#generating-a-source-map)
- [With SourceNode (high level API)](#with-sourcenode-high-level-api)
- [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api)
- [API](#api)
- [SourceMapConsumer](#sourcemapconsumer)
- [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap)
- [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans)
- [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition)
- [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition)
- [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition)
- [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources)
- [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing)
- [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order)
- [SourceMapGenerator](#sourcemapgenerator)
- [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap)
- [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer)
- [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping)
- [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent)
- [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath)
- [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring)
- [SourceNode](#sourcenode)
- [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name)
- [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath)
- [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk)
- [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk)
- [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent)
- [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn)
- [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn)
- [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep)
- [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement)
- [SourceNode.prototype.toString()](#sourcenodeprototypetostring)
- [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Examples
### Consuming a source map
```js
var rawSourceMap = {
version: 3,
file: 'min.js',
names: ['bar', 'baz', 'n'],
sources: ['one.js', 'two.js'],
sourceRoot: 'http://example.com/www/js/',
mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA'
};
var smc = new SourceMapConsumer(rawSourceMap);
console.log(smc.sources);
// [ 'http://example.com/www/js/one.js',
// 'http://example.com/www/js/two.js' ]
console.log(smc.originalPositionFor({
line: 2,
column: 28
}));
// { source: 'http://example.com/www/js/two.js',
// line: 2,
// column: 10,
// name: 'n' }
console.log(smc.generatedPositionFor({
source: 'http://example.com/www/js/two.js',
line: 2,
column: 10
}));
// { line: 2, column: 28 }
smc.eachMapping(function (m) {
// ...
});
```
### Generating a source map
In depth guide:
[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/)
#### With SourceNode (high level API)
```js
function compile(ast) {
switch (ast.type) {
case 'BinaryExpression':
return new SourceNode(
ast.location.line,
ast.location.column,
ast.location.source,
[compile(ast.left), " + ", compile(ast.right)]
);
case 'Literal':
return new SourceNode(
ast.location.line,
ast.location.column,
ast.location.source,
String(ast.value)
);
// ...
default:
throw new Error("Bad AST");
}
}
var ast = parse("40 + 2", "add.js");
console.log(compile(ast).toStringWithSourceMap({
file: 'add.js'
}));
// { code: '40 + 2',
// map: [object SourceMapGenerator] }
```
#### With SourceMapGenerator (low level API)
```js
var map = new SourceMapGenerator({
file: "source-mapped.js"
});
map.addMapping({
generated: {
line: 10,
column: 35
},
source: "foo.js",
original: {
line: 33,
column: 2
},
name: "christopher"
});
console.log(map.toString());
// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}'
```
## API
Get a reference to the module:
```js
// Node.js
var sourceMap = require('source-map');
// Browser builds
var sourceMap = window.sourceMap;
// Inside Firefox
const sourceMap = require("devtools/toolkit/sourcemap/source-map.js");
```
### SourceMapConsumer
A SourceMapConsumer instance represents a parsed source map which we can query
for information about the original file positions by giving it a file position
in the generated source.
#### new SourceMapConsumer(rawSourceMap)
The only parameter is the raw source map (either as a string which can be
`JSON.parse`'d, or an object). According to the spec, source maps have the
following attributes:
* `version`: Which version of the source map spec this map is following.
* `sources`: An array of URLs to the original source files.
* `names`: An array of identifiers which can be referenced by individual
mappings.
* `sourceRoot`: Optional. The URL root from which all sources are relative.
* `sourcesContent`: Optional. An array of contents of the original source files.
* `mappings`: A string of base64 VLQs which contain the actual mappings.
* `file`: Optional. The generated filename this source map is associated with.
```js
var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData);
```
#### SourceMapConsumer.prototype.computeColumnSpans()
Compute the last column for each generated mapping. The last column is
inclusive.
```js
// Before:
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
// [ { line: 2,
// column: 1 },
// { line: 2,
// column: 10 },
// { line: 2,
// column: 20 } ]
consumer.computeColumnSpans();
// After:
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
// [ { line: 2,
// column: 1,
// lastColumn: 9 },
// { line: 2,
// column: 10,
// lastColumn: 19 },
// { line: 2,
// column: 20,
// lastColumn: Infinity } ]
```
#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
Returns the original source, line, and column information for the generated
source's line and column positions provided. The only argument is an object with
the following properties:
* `line`: The line number in the generated source. Line numbers in
this library are 1-based (note that the underlying source map
specification uses 0-based line numbers -- this library handles the
translation).
* `column`: The column number in the generated source. Column numbers
in this library are 0-based.
* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or
`SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest
element that is smaller than or greater than the one we are searching for,
respectively, if the exact element cannot be found. Defaults to
`SourceMapConsumer.GREATEST_LOWER_BOUND`.
and an object is returned with the following properties:
* `source`: The original source file, or null if this information is not
available.
* `line`: The line number in the original source, or null if this information is
not available. The line number is 1-based.
* `column`: The column number in the original source, or null if this
information is not available. The column number is 0-based.
* `name`: The original identifier, or null if this information is not available.
```js
consumer.originalPositionFor({ line: 2, column: 10 })
// { source: 'foo.coffee',
// line: 2,
// column: 2,
// name: null }
consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 })
// { source: null,
// line: null,
// column: null,
// name: null }
```
#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition)
Returns the generated line and column information for the original source,
line, and column positions provided. The only argument is an object with
the following properties:
* `source`: The filename of the original source.
* `line`: The line number in the original source. The line number is
1-based.
* `column`: The column number in the original source. The column
number is 0-based.
and an object is returned with the following properties:
* `line`: The line number in the generated source, or null. The line
number is 1-based.
* `column`: The column number in the generated source, or null. The
column number is 0-based.
```js
consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 })
// { line: 1,
// column: 56 }
```
#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)
Returns all generated line and column information for the original source, line,
and column provided. If no column is provided, returns all mappings
corresponding to a either the line we are searching for or the next closest line
that has any mappings. Otherwise, returns all mappings corresponding to the
given line and either the column we are searching for or the next closest column
that has any offsets.
The only argument is an object with the following properties:
* `source`: The filename of the original source.
* `line`: The line number in the original source. The line number is
1-based.
* `column`: Optional. The column number in the original source. The
column number is 0-based.
and an array of objects is returned, each with the following properties:
* `line`: The line number in the generated source, or null. The line
number is 1-based.
* `column`: The column number in the generated source, or null. The
column number is 0-based.
```js
consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" })
// [ { line: 2,
// column: 1 },
// { line: 2,
// column: 10 },
// { line: 2,
// column: 20 } ]
```
#### SourceMapConsumer.prototype.hasContentsOfAllSources()
Return true if we have the embedded source content for every source listed in
the source map, false otherwise.
In other words, if this method returns `true`, then
`consumer.sourceContentFor(s)` will succeed for every source `s` in
`consumer.sources`.
```js
// ...
if (consumer.hasContentsOfAllSources()) {
consumerReadyCallback(consumer);
} else {
fetchSources(consumer, consumerReadyCallback);
}
// ...
```
#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])
Returns the original source content for the source provided. The only
argument is the URL of the original source file.
If the source content for the given source is not found, then an error is
thrown. Optionally, pass `true` as the second param to have `null` returned
instead.
```js
consumer.sources
// [ "my-cool-lib.clj" ]
consumer.sourceContentFor("my-cool-lib.clj")
// "..."
consumer.sourceContentFor("this is not in the source map");
// Error: "this is not in the source map" is not in the source map
consumer.sourceContentFor("this is not in the source map", true);
// null
```
#### SourceMapConsumer.prototype.eachMapping(callback, context, order)
Iterate over each mapping between an original source/line/column and a
generated line/column in this source map.
* `callback`: The function that is called with each mapping. Mappings have the
form `{ source, generatedLine, generatedColumn, originalLine, originalColumn,
name }`
* `context`: Optional. If specified, this object will be the value of `this`
every time that `callback` is called.
* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or
`SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over
the mappings sorted by the generated file's line/column order or the
original's source/line/column order, respectively. Defaults to
`SourceMapConsumer.GENERATED_ORDER`.
```js
consumer.eachMapping(function (m) { console.log(m); })
// ...
// { source: 'illmatic.js',
// generatedLine: 1,
// generatedColumn: 0,
// originalLine: 1,
// originalColumn: 0,
// name: null }
// { source: 'illmatic.js',
// generatedLine: 2,
// generatedColumn: 0,
// originalLine: 2,
// originalColumn: 0,
// name: null }
// ...
```
### SourceMapGenerator
An instance of the SourceMapGenerator represents a source map which is being
built incrementally.
#### new SourceMapGenerator([startOfSourceMap])
You may pass an object with the following properties:
* `file`: The filename of the generated source that this source map is
associated with.
* `sourceRoot`: A root for all relative URLs in this source map.
* `skipValidation`: Optional. When `true`, disables validation of mappings as
they are added. This can improve performance but should be used with
discretion, as a last resort. Even then, one should avoid using this flag when
running tests, if possible.
```js
var generator = new sourceMap.SourceMapGenerator({
file: "my-generated-javascript-file.js",
sourceRoot: "http://example.com/app/js/"
});
```
#### SourceMapGenerator.fromSourceMap(sourceMapConsumer)
Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance.
* `sourceMapConsumer` The SourceMap.
```js
var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer);
```
#### SourceMapGenerator.prototype.addMapping(mapping)
Add a single mapping from original source line and column to the generated
source's line and column for this source map being created. The mapping object
should have the following properties:
* `generated`: An object with the generated line and column positions.
* `original`: An object with the original line and column positions.
* `source`: The original source file (relative to the sourceRoot).
* `name`: An optional original token name for this mapping.
```js
generator.addMapping({
source: "module-one.scm",
original: { line: 128, column: 0 },
generated: { line: 3, column: 456 }
})
```
#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
Set the source content for an original source file.
* `sourceFile` the URL of the original source file.
* `sourceContent` the content of the source file.
```js
generator.setSourceContent("module-one.scm",
fs.readFileSync("path/to/module-one.scm"))
```
#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])
Applies a SourceMap for a source file to the SourceMap.
Each mapping to the supplied source file is rewritten using the
supplied SourceMap. Note: The resolution for the resulting mappings
is the minimum of this map and the supplied map.
* `sourceMapConsumer`: The SourceMap to be applied.
* `sourceFile`: Optional. The filename of the source file.
If omitted, sourceMapConsumer.file will be used, if it exists.
Otherwise an error will be thrown.
* `sourceMapPath`: Optional. The dirname of the path to the SourceMap
to be applied. If relative, it is relative to the SourceMap.
This parameter is needed when the two SourceMaps aren't in the same
directory, and the SourceMap to be applied contains relative source
paths. If so, those relative source paths need to be rewritten
relative to the SourceMap.
If omitted, it is assumed that both SourceMaps are in the same directory,
thus not needing any rewriting. (Supplying `'.'` has the same effect.)
#### SourceMapGenerator.prototype.toString()
Renders the source map being generated to a string.
```js
generator.toString()
// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}'
```
### SourceNode
SourceNodes provide a way to abstract over interpolating and/or concatenating
snippets of generated JavaScript source code, while maintaining the line and
column information associated between those snippets and the original source
code. This is useful as the final intermediate representation a compiler might
use before outputting the generated JS and source map.
#### new SourceNode([line, column, source[, chunk[, name]]])
* `line`: The original line number associated with this source node, or null if
it isn't associated with an original line. The line number is 1-based.
* `column`: The original column number associated with this source node, or null
if it isn't associated with an original column. The column number
is 0-based.
* `source`: The original source's filename; null if no filename is provided.
* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see
below.
* `name`: Optional. The original identifier.
```js
var node = new SourceNode(1, 2, "a.cpp", [
new SourceNode(3, 4, "b.cpp", "extern int status;\n"),
new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"),
new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"),
]);
```
#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])
Creates a SourceNode from generated code and a SourceMapConsumer.
* `code`: The generated code
* `sourceMapConsumer` The SourceMap for the generated code
* `relativePath` The optional path that relative sources in `sourceMapConsumer`
should be relative to.
```js
var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8"));
var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"),
consumer);
```
#### SourceNode.prototype.add(chunk)
Add a chunk of generated JS to this source node.
* `chunk`: A string snippet of generated JS code, another instance of
`SourceNode`, or an array where each member is one of those things.
```js
node.add(" + ");
node.add(otherNode);
node.add([leftHandOperandNode, " + ", rightHandOperandNode]);
```
#### SourceNode.prototype.prepend(chunk)
Prepend a chunk of generated JS to this source node.
* `chunk`: A string snippet of generated JS code, another instance of
`SourceNode`, or an array where each member is one of those things.
```js
node.prepend("/** Build Id: f783haef86324gf **/\n\n");
```
#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent)
Set the source content for a source file. This will be added to the
`SourceMap` in the `sourcesContent` field.
* `sourceFile`: The filename of the source file
* `sourceContent`: The content of the source file
```js
node.setSourceContent("module-one.scm",
fs.readFileSync("path/to/module-one.scm"))
```
#### SourceNode.prototype.walk(fn)
Walk over the tree of JS snippets in this node and its children. The walking
function is called once for each snippet of JS and is passed that snippet and
the its original associated source's line/column location.
* `fn`: The traversal function.
```js
var node = new SourceNode(1, 2, "a.js", [
new SourceNode(3, 4, "b.js", "uno"),
"dos",
[
"tres",
new SourceNode(5, 6, "c.js", "quatro")
]
]);
node.walk(function (code, loc) { console.log("WALK:", code, loc); })
// WALK: uno { source: 'b.js', line: 3, column: 4, name: null }
// WALK: dos { source: 'a.js', line: 1, column: 2, name: null }
// WALK: tres { source: 'a.js', line: 1, column: 2, name: null }
// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null }
```
#### SourceNode.prototype.walkSourceContents(fn)
Walk over the tree of SourceNodes. The walking function is called for each
source file content and is passed the filename and source content.
* `fn`: The traversal function.
```js
var a = new SourceNode(1, 2, "a.js", "generated from a");
a.setSourceContent("a.js", "original a");
var b = new SourceNode(1, 2, "b.js", "generated from b");
b.setSourceContent("b.js", "original b");
var c = new SourceNode(1, 2, "c.js", "generated from c");
c.setSourceContent("c.js", "original c");
var node = new SourceNode(null, null, null, [a, b, c]);
node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); })
// WALK: a.js : original a
// WALK: b.js : original b
// WALK: c.js : original c
```
#### SourceNode.prototype.join(sep)
Like `Array.prototype.join` except for SourceNodes. Inserts the separator
between each of this source node's children.
* `sep`: The separator.
```js
var lhs = new SourceNode(1, 2, "a.rs", "my_copy");
var operand = new SourceNode(3, 4, "a.rs", "=");
var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()");
var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]);
var joinedNode = node.join(" ");
```
#### SourceNode.prototype.replaceRight(pattern, replacement)
Call `String.prototype.replace` on the very right-most source snippet. Useful
for trimming white space from the end of a source node, etc.
* `pattern`: The pattern to replace.
* `replacement`: The thing to replace the pattern with.
```js
// Trim trailing white space.
node.replaceRight(/\s*$/, "");
```
#### SourceNode.prototype.toString()
Return the string representation of this source node. Walks over the tree and
concatenates all the various snippets together to one string.
```js
var node = new SourceNode(1, 2, "a.js", [
new SourceNode(3, 4, "b.js", "uno"),
"dos",
[
"tres",
new SourceNode(5, 6, "c.js", "quatro")
]
]);
node.toString()
// 'unodostresquatro'
```
#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])
Returns the string representation of this tree of source nodes, plus a
SourceMapGenerator which contains all the mappings between the generated and
original sources.
The arguments are the same as those to `new SourceMapGenerator`.
```js
var node = new SourceNode(1, 2, "a.js", [
new SourceNode(3, 4, "b.js", "uno"),
"dos",
[
"tres",
new SourceNode(5, 6, "c.js", "quatro")
]
]);
node.toStringWithSourceMap({ file: "my-output-file.js" })
// { code: 'unodostresquatro',
// map: [object SourceMapGenerator] }
```

View File

@@ -0,0 +1,73 @@
{
"name": "source-map",
"description": "Generates and consumes source maps",
"version": "0.6.1",
"homepage": "https://github.com/mozilla/source-map",
"author": "Nick Fitzgerald <nfitzgerald@mozilla.com>",
"contributors": [
"Tobias Koppers <tobias.koppers@googlemail.com>",
"Duncan Beevers <duncan@dweebd.com>",
"Stephen Crane <scrane@mozilla.com>",
"Ryan Seddon <seddon.ryan@gmail.com>",
"Miles Elam <miles.elam@deem.com>",
"Mihai Bazon <mihai.bazon@gmail.com>",
"Michael Ficarra <github.public.email@michael.ficarra.me>",
"Todd Wolfson <todd@twolfson.com>",
"Alexander Solovyov <alexander@solovyov.net>",
"Felix Gnass <fgnass@gmail.com>",
"Conrad Irwin <conrad.irwin@gmail.com>",
"usrbincc <usrbincc@yahoo.com>",
"David Glasser <glasser@davidglasser.net>",
"Chase Douglas <chase@newrelic.com>",
"Evan Wallace <evan.exe@gmail.com>",
"Heather Arthur <fayearthur@gmail.com>",
"Hugh Kennedy <hughskennedy@gmail.com>",
"David Glasser <glasser@davidglasser.net>",
"Simon Lydell <simon.lydell@gmail.com>",
"Jmeas Smith <jellyes2@gmail.com>",
"Michael Z Goddard <mzgoddard@gmail.com>",
"azu <azu@users.noreply.github.com>",
"John Gozde <john@gozde.ca>",
"Adam Kirkton <akirkton@truefitinnovation.com>",
"Chris Montgomery <christopher.montgomery@dowjones.com>",
"J. Ryan Stinnett <jryans@gmail.com>",
"Jack Herrington <jherrington@walmartlabs.com>",
"Chris Truter <jeffpalentine@gmail.com>",
"Daniel Espeset <daniel@danielespeset.com>",
"Jamie Wong <jamie.lf.wong@gmail.com>",
"Eddy Bruël <ejpbruel@mozilla.com>",
"Hawken Rives <hawkrives@gmail.com>",
"Gilad Peleg <giladp007@gmail.com>",
"djchie <djchie.dev@gmail.com>",
"Gary Ye <garysye@gmail.com>",
"Nicolas Lalevée <nicolas.lalevee@hibnet.org>"
],
"repository": {
"type": "git",
"url": "http://github.com/mozilla/source-map.git"
},
"main": "./source-map.js",
"files": [
"source-map.js",
"source-map.d.ts",
"lib/",
"dist/source-map.debug.js",
"dist/source-map.js",
"dist/source-map.min.js",
"dist/source-map.min.js.map"
],
"engines": {
"node": ">=0.10.0"
},
"license": "BSD-3-Clause",
"scripts": {
"test": "npm run build && node test/run-tests.js",
"build": "webpack --color",
"toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
},
"devDependencies": {
"doctoc": "^0.15.0",
"webpack": "^1.12.0"
},
"typings": "source-map"
}

View File

@@ -0,0 +1,98 @@
export interface StartOfSourceMap {
file?: string;
sourceRoot?: string;
}
export interface RawSourceMap extends StartOfSourceMap {
version: string;
sources: string[];
names: string[];
sourcesContent?: string[];
mappings: string;
}
export interface Position {
line: number;
column: number;
}
export interface LineRange extends Position {
lastColumn: number;
}
export interface FindPosition extends Position {
// SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND
bias?: number;
}
export interface SourceFindPosition extends FindPosition {
source: string;
}
export interface MappedPosition extends Position {
source: string;
name?: string;
}
export interface MappingItem {
source: string;
generatedLine: number;
generatedColumn: number;
originalLine: number;
originalColumn: number;
name: string;
}
export class SourceMapConsumer {
static GENERATED_ORDER: number;
static ORIGINAL_ORDER: number;
static GREATEST_LOWER_BOUND: number;
static LEAST_UPPER_BOUND: number;
constructor(rawSourceMap: RawSourceMap);
computeColumnSpans(): void;
originalPositionFor(generatedPosition: FindPosition): MappedPosition;
generatedPositionFor(originalPosition: SourceFindPosition): LineRange;
allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
hasContentsOfAllSources(): boolean;
sourceContentFor(source: string, returnNullOnMissing?: boolean): string;
eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
}
export interface Mapping {
generated: Position;
original: Position;
source: string;
name?: string;
}
export class SourceMapGenerator {
constructor(startOfSourceMap?: StartOfSourceMap);
static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
addMapping(mapping: Mapping): void;
setSourceContent(sourceFile: string, sourceContent: string): void;
applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
toString(): string;
}
export interface CodeWithSourceMap {
code: string;
map: SourceMapGenerator;
}
export class SourceNode {
constructor();
constructor(line: number, column: number, source: string);
constructor(line: number, column: number, source: string, chunk?: string, name?: string);
static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
add(chunk: string): void;
prepend(chunk: string): void;
setSourceContent(sourceFile: string, sourceContent: string): void;
walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
walkSourceContents(fn: (file: string, content: string) => void): void;
join(sep: string): SourceNode;
replaceRight(pattern: string, replacement: string): SourceNode;
toString(): string;
toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
}

View File

@@ -0,0 +1,8 @@
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
exports.SourceNode = require('./lib/source-node').SourceNode;

65
frontend/node_modules/csso/package.json generated vendored Normal file
View File

@@ -0,0 +1,65 @@
{
"name": "csso",
"version": "4.2.0",
"description": "CSS minifier with structural optimisations",
"homepage": "https://github.com/css/csso",
"author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (https://github.com/afelix)",
"maintainers": [
{
"name": "Roman Dvornov",
"email": "rdvornov@gmail.com",
"github-username": "lahmatiy"
}
],
"license": "MIT",
"repository": "css/csso",
"bugs": {
"url": "https://github.com/css/csso/issues"
},
"keywords": [
"css",
"compress",
"minifier",
"minify",
"optimise",
"optimisation",
"csstree"
],
"main": "./lib/index",
"scripts": {
"test": "mocha --reporter dot",
"lint": "eslint lib test",
"lint-and-test": "npm run lint && npm test",
"build": "rollup --config && terser dist/csso.js --compress --mangle -o dist/csso.min.js",
"coverage": "nyc npm test",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"travis": "nyc npm run lint-and-test && npm run coveralls",
"hydrogen": "node --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --trace_hydrogen_file=code.cfg --print-opt-code bin/csso --stat -o /dev/null",
"prepublishOnly": "npm run build"
},
"dependencies": {
"css-tree": "^1.1.2"
},
"browser": {
"css-tree": "css-tree/dist/csstree.min.js"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.1",
"@rollup/plugin-json": "^4.0.1",
"@rollup/plugin-node-resolve": "^7.0.0",
"coveralls": "^3.0.11",
"eslint": "^6.8.0",
"mocha": "^7.1.1",
"nyc": "^15.0.0",
"rollup": "^1.29.0",
"source-map": "^0.6.1",
"terser": "^4.6.3"
},
"engines": {
"node": ">=8.0.0"
},
"files": [
"dist",
"lib"
]
}