UNPKG

d2-ui

Version:
109 lines (108 loc) 9.25 kB
{ "_args": [ [ "cssesc@^0.1.0", "/Users/nico/Documents/dhis/webapps/d2-ui/node_modules/css-selector-tokenizer" ] ], "_from": "cssesc@>=0.1.0 <0.2.0", "_id": "cssesc@0.1.0", "_inCache": true, "_installable": true, "_location": "/cssesc", "_npmUser": { "email": "mathias@qiwi.be", "name": "mathias" }, "_npmVersion": "1.2.32", "_phantomChildren": {}, "_requested": { "name": "cssesc", "raw": "cssesc@^0.1.0", "rawSpec": "^0.1.0", "scope": null, "spec": ">=0.1.0 <0.2.0", "type": "range" }, "_requiredBy": [ "/css-selector-tokenizer", "/postcss-modules-local-by-default/css-selector-tokenizer", "/postcss-modules-scope/css-selector-tokenizer" ], "_resolved": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz", "_shasum": "c814903e45623371a0477b40109aaafbeeaddbb4", "_shrinkwrap": null, "_spec": "cssesc@^0.1.0", "_where": "/Users/nico/Documents/dhis/webapps/d2-ui/node_modules/css-selector-tokenizer", "author": { "name": "Mathias Bynens", "url": "http://mathiasbynens.be/" }, "bin": { "cssesc": "bin/cssesc" }, "bugs": { "url": "https://github.com/mathiasbynens/cssesc/issues" }, "dependencies": {}, "description": "A JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output.", "devDependencies": { "grunt": "~0.4.1", "grunt-shell": "~0.3.1", "grunt-template": "~0.2.0", "istanbul": "~0.1.42", "qunit-clib": "~1.3.0", "qunitjs": "~1.11.0", "regenerate": "~0.5.2", "requirejs": "~2.1.8" }, "directories": { "test": "tests" }, "dist": { "shasum": "c814903e45623371a0477b40109aaafbeeaddbb4", "tarball": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz" }, "files": [ "LICENSE-MIT.txt", "cssesc.js", "bin/", "man/" ], "homepage": "http://mths.be/cssesc", "keywords": [ "css", "escape", "identifier", "string", "tool" ], "licenses": [ { "type": "MIT", "url": "http://mths.be/mit" } ], "main": "cssesc.js", "maintainers": [ { "email": "mathias@qiwi.be", "name": "mathias" } ], "man": [ "man/cssesc.1" ], "name": "cssesc", "optionalDependencies": {}, "readme": "# cssesc [![Build status](https://travis-ci.org/mathiasbynens/cssesc.png?branch=master)](https://travis-ci.org/mathiasbynens/cssesc) [![Dependency status](https://gemnasium.com/mathiasbynens/cssesc.png)](https://gemnasium.com/mathiasbynens/cssesc)\n\nA JavaScript library for escaping CSS strings and identifiers while generating the shortest possible ASCII-only output.\n\nThis is a JavaScript library for [escaping text for use in CSS strings or identifiers](http://mathiasbynens.be/notes/css-escapes) while generating the shortest possible valid ASCII-only output. [Here’s an online demo.](http://mothereff.in/css-escapes)\n\nFeel free to fork if you see possible improvements!\n\n## Installation\n\nVia [Bower](http://bower.io/):\n\n```bash\nbower install cssesc\n```\n\nVia [Component](https://github.com/component/component):\n\n```bash\ncomponent install mathiasbynens/cssesc\n```\n\nVia [npm](http://npmjs.org/):\n\n```bash\nnpm install cssesc\n```\n\nIn a browser:\n\n```html\n<script src=\"cssesc.js\"></script>\n```\n\nIn [Node.js](http://nodejs.org/) and [RingoJS](http://ringojs.org/):\n\n```js\nvar cssesc = require('cssesc');\n```\n\nIn [Narwhal](http://narwhaljs.org/):\n\n```js\nvar cssesc = require('cssesc').cssesc;\n```\n\nIn [Rhino](http://www.mozilla.org/rhino/):\n\n```js\nload('cssesc.js');\n```\n\nUsing an AMD loader like [RequireJS](http://requirejs.org/):\n\n```js\nrequire(\n {\n 'paths': {\n 'cssesc': 'path/to/cssesc'\n }\n },\n ['cssesc'],\n function(cssesc) {\n console.log(cssesc);\n }\n);\n```\n\n## API\n\n### `cssesc(value, options)`\n\nThis function takes a value and returns an escaped version of the value where any characters that are not printable ASCII symbols are escaped using the shortest possible (but valid) [escape sequences for use in CSS strings or identifiers](http://mathiasbynens.be/notes/css-escapes).\n\n```js\ncssesc('Ich ♥ Bücher');\n// → 'Ich \\\\2665 B\\\\FC cher'\n\ncssesc('foo 𝌆 bar');\n// → 'foo \\\\1D306 bar'\n```\n\nBy default, `cssesc` returns a string that can be used as part of a CSS string. If the target is a CSS identifier rather than a CSS string, use the `isIdentifier: true` setting (see below).\n\nThe optional `options` argument accepts an object with the following options:\n\n#### `isIdentifier`\n\nThe default value for the `isIdentifier` option is `false`. This means that the input text will be escaped for use in a CSS string literal. If you want to use the result as a CSS identifier instead (in a selector, for example), set this option to `true`.\n\n```js\ncssesc('123a2b');\n// → '123a2b'\n\ncssesc('123a2b', {\n 'isIdentifier': true\n});\n// → '\\\\31 23a2b'\n```\n\n#### `quotes`\n\nThe default value for the `quotes` option is `'single'`. This means that any occurences of `'` in the input text will be escaped as `\\'`, so that the output can be used in a CSS string literal wrapped in single quotes.\n\n```js\ncssesc('Lorem ipsum \"dolor\" sit \\'amet\\' etc.');\n// → 'Lorem ipsum \"dolor\" sit \\\\\\'amet\\\\\\' etc.'\n// → \"Lorem ipsum \\\"dolor\\\" sit \\\\'amet\\\\' etc.\"\n\ncssesc('Lorem ipsum \"dolor\" sit \\'amet\\' etc.', {\n 'quotes': 'single'\n});\n// → 'Lorem ipsum \"dolor\" sit \\\\\\'amet\\\\\\' etc.'\n// → \"Lorem ipsum \\\"dolor\\\" sit \\\\'amet\\\\' etc.\"\n```\n\nIf you want to use the output as part of a CSS string literal wrapped in double quotes, set the `quotes` option to `'double'`.\n\n```js\ncssesc('Lorem ipsum \"dolor\" sit \\'amet\\' etc.', {\n 'quotes': 'double'\n});\n// → 'Lorem ipsum \\\\\"dolor\\\\\" sit \\'amet\\' etc.'\n// → \"Lorem ipsum \\\\\\\"dolor\\\\\\\" sit 'amet' etc.\"\n```\n\n#### `wrap`\n\nThe `wrap` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output will be a valid CSS string literal wrapped in quotes. The type of quotes can be specified through the `quotes` setting.\n\n```js\ncssesc('Lorem ipsum \"dolor\" sit \\'amet\\' etc.', {\n 'quotes': 'single',\n 'wrap': true\n});\n// → '\\'Lorem ipsum \"dolor\" sit \\\\\\'amet\\\\\\' etc.\\''\n// → \"\\'Lorem ipsum \\\"dolor\\\" sit \\\\\\'amet\\\\\\' etc.\\'\"\n\ncssesc('Lorem ipsum \"dolor\" sit \\'amet\\' etc.', {\n 'quotes': 'double',\n 'wrap': true\n});\n// → '\"Lorem ipsum \\\\\"dolor\\\\\" sit \\'amet\\' etc.\"'\n// → \"\\\"Lorem ipsum \\\\\\\"dolor\\\\\\\" sit \\'amet\\' etc.\\\"\"\n```\n\n#### `escapeEverything`\n\nThe `escapeEverything` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, all the symbols in the output will be escaped, even printable ASCII symbols.\n\n```js\ncssesc('lolwat\"foo\\'bar', {\n 'escapeEverything': true\n});\n// → '\\\\6C\\\\6F\\\\6C\\\\77\\\\61\\\\74\\\\\"\\\\66\\\\6F\\\\6F\\\\\\'\\\\62\\\\61\\\\72'\n// → \"\\\\6C\\\\6F\\\\6C\\\\77\\\\61\\\\74\\\\\\\"\\\\66\\\\6F\\\\6F\\\\'\\\\62\\\\61\\\\72\"\n```\n\n### `cssesc.version`\n\nA string representing the semantic version number.\n\n### Using the `cssesc` binary\n\nTo use the `cssesc` binary in your shell, simply install cssesc globally using npm:\n\n```bash\nnpm install -g cssesc\n```\n\nAfter that you will be able to escape text for use in CSS strings or identifiers from the command line:\n\n```bash\n$ cssesc 'föo ♥ bår 𝌆 baz'\nf\\F6o \\2665 b\\E5r \\1D306 baz\n```\n\nIf the output needs to be a CSS identifier rather than part of a string literal, use the `-i`/`--identifier` option:\n\n```bash\n$ cssesc --identifier 'föo ♥ bår 𝌆 baz'\nf\\F6o\\ \\2665\\ b\\E5r\\ \\1D306\\ baz\n```\n\nSee `cssesc --help` for the full list of options.\n\n## Support\n\nThis library has been tested in at least Chrome 28-30, Firefox 3-23, Safari 4-6, Opera 10-15, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, and Rhino 1.7RC4.\n\n## Unit tests & code coverage\n\nAfter cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.\n\nOnce that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`.\n\nTo generate [the code coverage report](http://rawgithub.com/mathiasbynens/cssesc/master/coverage/cssesc/cssesc.js.html), use `grunt cover`.\n\n## Author\n\n| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias \"Follow @mathias on Twitter\") |\n|---|\n| [Mathias Bynens](http://mathiasbynens.be/) |\n\n## License\n\nThis library is available under the [MIT](http://mths.be/mit) license.\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/mathiasbynens/cssesc.git" }, "scripts": { "test": "node tests/tests.js" }, "version": "0.1.0" }