{"name":"css-selector-parser","version":"1.4.0","description":"Just a CSS selector parser.","keywords":["css","css selector","css selector parser"],"author":{"name":"Marat Dulin","email":"mdevils@yandex.ru"},"dependencies":{},"devDependencies":{"@types/colors":"^1.2.1","colors":"*","ts-node":"^8.8.2","typescript":"^3.8.3"},"repository":{"type":"git","url":"https://github.com/mdevils/css-selector-parser.git"},"main":"./lib/index.js","typings":"./lib/index","types":"./lib/index","license":"MIT","scripts":{"build":"tsc","test":"ts-node test/test.ts","benchmark":"ts-node benchmark/benchmark.ts","prepublishOnly":"yarn build"},"licenseText":"Copyright (c) 2013 Dulin Marat\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.","_id":"css-selector-parser@1.4.0","dist":{"shasum":"b843d6bedb9a4abe192a96116818ee8609f4cf73","integrity":"sha512-ZWuSgXiA4EzKv7Wb3QGeEF79vNFANrK1S/oVpR7j18drS7svk/ZFzQtMQ9RZsbJ+MVpnUjRBeOg0tJHWRH3+7A==","tarball":"http://registry-npm.ywwl.com/css-selector-parser/download/css-selector-parser-1.4.0.tgz","fileCount":27,"unpackedSize":38892,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJekcl2CRA9TVsSAnZWagAARJEQAKOPlDOpkIewpn3ovkDF\n0RbK7TfAbAGbrBYNEZ3fRdmDbEXCsvyWQy37OE3PLg3828moOVb+LCnFcBTB\n3tCFDFBC2ndejxAps0IWj/Og9dJi03Lnfch4neRrHHAlr2r2YDgencfhR+sF\nhJRlu+mN3PspZnX+o5PnbcZMPQz1dkrbavKt14VcbQ8aFN5P9s5U7JvQx48g\nEBDvFnq7Khd+4CSbcpKpxgBnTL2nQEFnKtTotAbwkvi9neuxCsHeZUCtChUD\nhFU3E7S7S6IcWhERcSlKKBYDpTzBn/5OaZveVKdm3ZFVXgVkfTVlPQUzPhjF\nwffOZt37E0+vCkQIhbetxT/sx2WARlTgwzy5CpnZgTDfbeTv5V2XHo0ZCPQa\nAnpnpx8+OnVkie/W54fuRxiiyWSGdg0NGh/VneqeUXvcWPzjnrAhPyeQ/exe\nyOh09Cvi+TNNvft1PnK92EORHySAEbG4tmevy3qF7CAF4RvoioJ4sCKJdqq5\nTBzG81DrdmLdW2MKs/fIhYdiCRhvaTEzTIpz0Z89edABG6VKRNQiZQq0vBEV\npJCwtMAa0O9I1rypvbjpkT4MX6V7j3/0Of9fspNhhoJsVcafp0VRAw+EJPq+\nbIhg/nz9eWjrwCF6ZJnoaQw6aqUIQasOhx8MHGyhD6NaMo7QwgGNyTqGH4F/\nGKHP\r\n=XvgW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDsAKhhP7x/lujrHwajPzKq7DdrLP4HZrlWDcN2iJ1/jAiEAlNY7NNy7CjDKk78fb5us4YY/iO3NbGOPhdoA1VL46hc="}],"size":9020,"noattachment":false,"key":"/css-selector-parser/-/css-selector-parser-1.4.0.tgz"},"maintainers":[{"name":"mdevils","email":"mdevils@yandex.ru"}],"_npmUser":{"name":"mdevils","email":"mdevils@yandex.ru"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/css-selector-parser_1.4.0_1586612598289_0.633976988328824"},"_hasShrinkwrap":false,"readme":"css-selector-parser\n===================\n\n* Fast and low memory CSS selector parser.\n* Parses CSS selector into object-model (AST).\n* Compliant with all historical and modern CSS specs.\n* Covered with tests.\n* Documented.\n* Supported CSS selector standards:\n    * `css1`: https://www.w3.org/TR/CSS1/\n    * `css2`: https://www.w3.org/TR/CSS2/\n    * `css3`/`selectors-3`: https://www.w3.org/TR/selectors-3/\n    * `selectors-4`: https://www.w3.org/TR/selectors-4/\n    * `latest`: refers to `selectors-4`\n    * `progressive`: `latest` + accepts unknown psudo-classes, psudo-elements and attribute case sensitivity modifiers\n\n**Important:**\n * [Migrating from 1.x to 3.x](CHANGELOG.md#migrating-from-1x-to-3x).\n * [Migrating from 2.x to 3.x](CHANGELOG.md#migrating-from-2x-to-3x).\n * [Migrating from 1.x to 2.x](CHANGELOG.md#220).\n\nLatest releases: [Changelog](CHANGELOG.md).\n\nInstallation\n------------\n\n```\nnpm install css-selector-parser\n```\n\nUsage\n-----\n\n### Parsing\n\n```javascript\nimport {createParser} from 'css-selector-parser';\n\nconst parse = createParser();\nconst selector = parse('a[href^=\"/\"], .container:has(nav) > a[href]:nth-child(2)::before');\n\nconsole.log(selector);\n```\n\nProduces:\n\n```javascript\n({\n    type: 'Selector',\n    rules: [\n        {\n            type: 'Rule',\n            items: [\n                { type: 'TagName', name: 'a' },\n                {\n                    type: 'Attribute',\n                    name: 'href',\n                    operator: '^=',\n                    value: { type: 'String', value: '/' }\n                }\n            ]\n        },\n        {\n            type: 'Rule',\n            items: [\n                { type: 'ClassName', name: 'container' },\n                {\n                    type: 'PseudoClass',\n                    name: 'has',\n                    argument: {\n                        type: 'Selector',\n                        rules: [\n                            {\n                                type: 'Rule',\n                                items: [ { type: 'TagName', name: 'nav' } ]\n                            }\n                        ]\n                    }\n                }\n            ],\n            nestedRule: {\n                type: 'Rule',\n                items: [\n                    { type: 'TagName', name: 'a' },\n                    { type: 'Attribute', name: 'href' },\n                    {\n                        type: 'PseudoClass',\n                        name: 'nth-child',\n                        argument: { type: 'Formula', a: 0, b: 2 }\n                    },\n                    {\n                        type: 'PseudoElement',\n                        name: 'before'\n                    }\n                ],\n                combinator: '>'\n            }\n        }\n    ]\n})\n```\n\n### Constructing AST and rendering\n\n```javascript\nimport {ast, render} from 'css-selector-parser';\n\nconst selector = ast.selector({\n    rules: [\n        ast.rule({\n            items: [\n                ast.tagName({name: 'a'}),\n                ast.attribute({name: 'href', operator: '^=', value: ast.string({value: '/'})})\n            ]\n        }),\n        ast.rule({\n            items: [\n                ast.className({name: 'container'}),\n                ast.pseudoClass({\n                    name: 'has',\n                    argument: ast.selector({\n                        rules: [ast.rule({items: [ast.tagName({name: 'nav'})]})]\n                    })\n                })\n            ],\n            nestedRule: ast.rule({\n                combinator: '>',\n                items: [\n                    ast.tagName({name: 'a'}),\n                    ast.attribute({name: 'href'}),\n                    ast.pseudoClass({\n                        name: 'nth-child',\n                        argument: ast.formula({a: 0, b: 2})\n                    }),\n                    ast.pseudoElement({name: 'before'})\n                ]\n            })\n        })\n    ]\n});\n\nconsole.log(render(selector)); // a[href^=\"/\"], .container:has(nav) > a[href]:nth-child(2)::before\n```\n\nAPI\n---\n\n* [Full API Documentation](docs/modules.md)\n* [Parsing CSS selectors](docs/modules.md#createParser)\n* [Constructing CSS AST](docs/modules.md#ast)\n* [Rendering CSS AST](docs/modules.md#render)\n\nLICENSE\n-------\n\nMIT\n\n## Security contact information\n\nTo report a security vulnerability, please use the\n[Tidelift security contact](https://tidelift.com/security).\nTidelift will coordinate the fix and disclosure.\n","publish_time":1586612598438,"_cnpm_publish_time":1586612598438,"dist-tags":{"latest":"3.3.0"}}