add lisp packages
This commit is contained in:
7
lisp/emacs-application-framework/app/mermaid/node_modules/scope-css/.travis.yml
generated
vendored
Normal file
7
lisp/emacs-application-framework/app/mermaid/node_modules/scope-css/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- 'node'
|
||||
- '6'
|
||||
- '5'
|
||||
- '4'
|
||||
74
lisp/emacs-application-framework/app/mermaid/node_modules/scope-css/index.js
generated
vendored
Normal file
74
lisp/emacs-application-framework/app/mermaid/node_modules/scope-css/index.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
'use strict'
|
||||
|
||||
var slugify = require('slugify')
|
||||
var escaper = require('escaper')
|
||||
var stripComments = require('strip-css-comments')
|
||||
|
||||
module.exports = scope
|
||||
scope.replace = replace
|
||||
|
||||
function scope (css, parent, o) {
|
||||
if (!css) return css
|
||||
|
||||
if (!parent) return css
|
||||
|
||||
if (typeof o === 'string') o = {keyframes: o}
|
||||
if (!o) o = {keyframes: false}
|
||||
|
||||
css = replace(css, parent + ' $1$2')
|
||||
|
||||
//regexp.escape
|
||||
var parentRe = parent.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
|
||||
|
||||
//replace self-selectors
|
||||
css = css.replace(new RegExp('(' + parentRe + ')\\s*\\1(?=[\\s\\r\\n,{])', 'g'), '$1')
|
||||
|
||||
//replace `:host` with parent
|
||||
css = css.replace(new RegExp('(' + parentRe + ')\\s*:host', 'g'), '$1')
|
||||
|
||||
//revoke wrongly replaced @ statements, like @supports, @import, @media etc.
|
||||
css = css.replace(new RegExp('(' + parentRe + ')\\s*@', 'g'), '@')
|
||||
|
||||
//revoke wrongly replaced :root blocks
|
||||
css = css.replace(new RegExp('(' + parentRe + ')\\s*:root', 'g'), ':root')
|
||||
|
||||
//animations: prefix animation anmes
|
||||
var animations = [],
|
||||
animationNameRe = /@keyframes\s+([a-zA-Z0-9_-]+)\s*{/g,
|
||||
match
|
||||
while ((match = animationNameRe.exec(css)) !== null) {
|
||||
if (animations.indexOf(match[1]) < 0)
|
||||
animations.push(match[1])
|
||||
}
|
||||
|
||||
var slug = slugify(parent)
|
||||
|
||||
animations.forEach(function (name) {
|
||||
var newName = (o.keyframes === true ? slug + '-' : typeof o.keyframes === 'string' ? o.keyframes : '') + name
|
||||
css = css.replace(new RegExp('(@keyframes\\s+)' + name + '(\\s*{)', 'g'),
|
||||
'$1' + newName + '$2')
|
||||
css = css.replace(new RegExp('(animation(?:-name)?\\s*:[^;]*\\s*)' + name + '([\\s;}])', 'g'),
|
||||
'$1' + newName + '$2')
|
||||
})
|
||||
//animation: revoke wrongly replaced keyframes
|
||||
css = css.replace(new RegExp('(' + parentRe + ' )(\\s*(?:to|from|[+-]?(?:(?:\\.\\d+)|(?:\\d+(?:\\.\\d*)?))%))(?=[\\s\\r\\n,{])', 'g'), '$2')
|
||||
|
||||
return css
|
||||
}
|
||||
|
||||
function replace (css, replacer) {
|
||||
var arr = []
|
||||
|
||||
css = stripComments(css)
|
||||
|
||||
// escape strings etc.
|
||||
css = escaper.replace(css, true, arr)
|
||||
|
||||
css = css.replace(/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g, replacer)
|
||||
|
||||
// insert comments, strings etc. back
|
||||
css = escaper.paste(css, arr)
|
||||
|
||||
return css
|
||||
}
|
||||
|
||||
39
lisp/emacs-application-framework/app/mermaid/node_modules/scope-css/package.json
generated
vendored
Normal file
39
lisp/emacs-application-framework/app/mermaid/node_modules/scope-css/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "scope-css",
|
||||
"version": "1.2.1",
|
||||
"description": "Scope each css rule with a selector, ie. nest into parent",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/dy/scope-css.git"
|
||||
},
|
||||
"keywords": [
|
||||
"css",
|
||||
"style",
|
||||
"insert-css",
|
||||
"nesting",
|
||||
"scope",
|
||||
"nest",
|
||||
"parent",
|
||||
"selector",
|
||||
"sheetify"
|
||||
],
|
||||
"author": "ΔY <df.creative@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/dy/scope-css/issues"
|
||||
},
|
||||
"homepage": "https://github.com/dy/scope-css#readme",
|
||||
"devDependencies": {
|
||||
"cln": "^1.1.0",
|
||||
"tape": "^4.9.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"escaper": "^2.5.3",
|
||||
"slugify": "^1.3.1",
|
||||
"strip-css-comments": "^3.0.0"
|
||||
}
|
||||
}
|
||||
92
lisp/emacs-application-framework/app/mermaid/node_modules/scope-css/readme.md
generated
vendored
Normal file
92
lisp/emacs-application-framework/app/mermaid/node_modules/scope-css/readme.md
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
# scope-css [](http://github.com/badges/stability-badges) [](https://travis-ci.org/dy/scope-css)
|
||||
|
||||
Prefix or nest each style selector in a css string. Useful to create namespaced css for components, themes, applications, modular css etc. Also it is tiny.
|
||||
|
||||
## Usage
|
||||
|
||||
[](https://npmjs.org/package/scope-css/)
|
||||
|
||||
```js
|
||||
const scope = require('scope-css');
|
||||
|
||||
scope(`
|
||||
.my-component {}
|
||||
.my-component-element {}
|
||||
`, '.parent');
|
||||
|
||||
/*
|
||||
`
|
||||
.parent .my-component {}
|
||||
.parent .my-component-element {}
|
||||
`
|
||||
*/
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
## css = scope(css, parent, options?)
|
||||
|
||||
Return css string with each rule prefixed with the parent selector. Note that `parent` selector itself will be ignored. Also each `:host` keyword will be replaced with `parent` value. Example:
|
||||
|
||||
```js
|
||||
scope(`
|
||||
.panel {}
|
||||
:host {}
|
||||
:host .my-element {}
|
||||
.panel .my-element {}
|
||||
.my-element {}
|
||||
`, '.panel');
|
||||
|
||||
/*
|
||||
`
|
||||
.panel {}
|
||||
.panel {}
|
||||
.panel .my-element {}
|
||||
.panel .my-element {}
|
||||
.panel .my-element {}
|
||||
`
|
||||
*/
|
||||
```
|
||||
|
||||
Options can scope keyframes via `{ keyframes: bool|prefixStr }` option, eg.
|
||||
|
||||
```js
|
||||
scope(`
|
||||
.panel {
|
||||
animation: infinite loading 4s;
|
||||
}
|
||||
@keyframes loading {
|
||||
from { top: 0; }
|
||||
to { top: 100px; }
|
||||
}
|
||||
`, '.panel', { keyframes: true })
|
||||
|
||||
/*
|
||||
`
|
||||
.panel {
|
||||
animation: infinite panel-loading 4s;
|
||||
}
|
||||
@keyframes panel-loading {
|
||||
from { top: 0; }
|
||||
to { top: 100px; }
|
||||
`)
|
||||
*/
|
||||
```
|
||||
|
||||
## css = scope.replace(css, 'replacement $1$2')
|
||||
|
||||
Apply replace to css, where `$1` is matched selectors and `$2` is rules for the selectors. It does not do any self/host detection, so use it for more flexible replacements.
|
||||
|
||||
```js
|
||||
scope.replace(`
|
||||
.my-component, .my-other-component {
|
||||
padding: 0;
|
||||
}
|
||||
`, '$1');
|
||||
|
||||
// `.my-component, my-other-component`
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
Based on [this question](http://stackoverflow.com/questions/12575845/what-is-the-regex-of-a-css-selector).
|
||||
Reference in New Issue
Block a user