Latest updates from IceHrmPro
This commit is contained in:
18
web/node_modules/insert-css/LICENSE
generated
vendored
Normal file
18
web/node_modules/insert-css/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
This software is released under the MIT license:
|
||||
|
||||
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.
|
||||
12
web/node_modules/insert-css/example.js
generated
vendored
Normal file
12
web/node_modules/insert-css/example.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var on = require('dom-event');
|
||||
var insertCss = require('./');
|
||||
|
||||
document.querySelector('body').innerHTML = '<h1>insert-css example</h1><button id="blue">blue</button><button id="red">red</button>';
|
||||
|
||||
on(document.querySelector('#blue'), 'click', function() {
|
||||
insertCss('body{background: blue}');
|
||||
});
|
||||
|
||||
on(document.querySelector('#red'), 'click', function() {
|
||||
insertCss('body{background: red}');
|
||||
});
|
||||
58
web/node_modules/insert-css/index.js
generated
vendored
Normal file
58
web/node_modules/insert-css/index.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
var containers = []; // will store container HTMLElement references
|
||||
var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
|
||||
|
||||
var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
|
||||
|
||||
function insertCss(css, options) {
|
||||
options = options || {};
|
||||
|
||||
if (css === undefined) {
|
||||
throw new Error(usage);
|
||||
}
|
||||
|
||||
var position = options.prepend === true ? 'prepend' : 'append';
|
||||
var container = options.container !== undefined ? options.container : document.querySelector('head');
|
||||
var containerId = containers.indexOf(container);
|
||||
|
||||
// first time we see this container, create the necessary entries
|
||||
if (containerId === -1) {
|
||||
containerId = containers.push(container) - 1;
|
||||
styleElements[containerId] = {};
|
||||
}
|
||||
|
||||
// try to get the correponding container + position styleElement, create it otherwise
|
||||
var styleElement;
|
||||
|
||||
if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
|
||||
styleElement = styleElements[containerId][position];
|
||||
} else {
|
||||
styleElement = styleElements[containerId][position] = createStyleElement();
|
||||
|
||||
if (position === 'prepend') {
|
||||
container.insertBefore(styleElement, container.childNodes[0]);
|
||||
} else {
|
||||
container.appendChild(styleElement);
|
||||
}
|
||||
}
|
||||
|
||||
// strip potential UTF-8 BOM if css was read from a file
|
||||
if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }
|
||||
|
||||
// actually add the stylesheet
|
||||
if (styleElement.styleSheet) {
|
||||
styleElement.styleSheet.cssText += css
|
||||
} else {
|
||||
styleElement.textContent += css;
|
||||
}
|
||||
|
||||
return styleElement;
|
||||
};
|
||||
|
||||
function createStyleElement() {
|
||||
var styleElement = document.createElement('style');
|
||||
styleElement.setAttribute('type', 'text/css');
|
||||
return styleElement;
|
||||
}
|
||||
|
||||
module.exports = insertCss;
|
||||
module.exports.insertCss = insertCss;
|
||||
84
web/node_modules/insert-css/package.json
generated
vendored
Normal file
84
web/node_modules/insert-css/package.json
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"_from": "insert-css@^2.0.0",
|
||||
"_id": "insert-css@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-610Ql7dUL0x56jBg067gfQU4gPQ=",
|
||||
"_location": "/insert-css",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "insert-css@^2.0.0",
|
||||
"name": "insert-css",
|
||||
"escapedName": "insert-css",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@ant-design/icons"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/insert-css/-/insert-css-2.0.0.tgz",
|
||||
"_shasum": "eb5d1097b7542f4c79ea3060d3aee07d053880f4",
|
||||
"_spec": "insert-css@^2.0.0",
|
||||
"_where": "/Users/thilina/TestProjects/icehrm-pro/web/node_modules/@ant-design/icons",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/insert-css/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "insert a string of css into the <head>",
|
||||
"devDependencies": {
|
||||
"browserify": "^13.0.1",
|
||||
"budo": "^8.3.0",
|
||||
"computed-style": "^0.3.0",
|
||||
"dom-event": "^1.0.0",
|
||||
"tape": "^4.6.0",
|
||||
"tape-run": "^2.1.4"
|
||||
},
|
||||
"homepage": "https://github.com/substack/insert-css",
|
||||
"keywords": [
|
||||
"css",
|
||||
"insert",
|
||||
"dom",
|
||||
"browser",
|
||||
"browserify",
|
||||
"inject",
|
||||
"styles",
|
||||
"stylesheet",
|
||||
"style",
|
||||
"html",
|
||||
"head",
|
||||
"link"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "insert-css",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/insert-css.git"
|
||||
},
|
||||
"scripts": {
|
||||
"example": "budo example.js",
|
||||
"test": "browserify test.js | tape-run"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test.js",
|
||||
"browsers": [
|
||||
"ie/6..latest",
|
||||
"chrome/20..latest",
|
||||
"firefox/10..latest",
|
||||
"safari/latest",
|
||||
"opera/11.0..latest",
|
||||
"iphone/6",
|
||||
"ipad/6"
|
||||
]
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
||||
44
web/node_modules/insert-css/readme.markdown
generated
vendored
Normal file
44
web/node_modules/insert-css/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# insert-css
|
||||
|
||||
insert a string of css into the `<head>`
|
||||
|
||||
[](https://ci.testling.com/substack/insert-css)
|
||||
|
||||
# example
|
||||
|
||||
``` js
|
||||
var insertCss = require('insert-css');
|
||||
var styleElement = insertCss('body { background:blue; }');
|
||||
```
|
||||
|
||||
# api
|
||||
|
||||
``` js
|
||||
var insertCss = require('insert-css');
|
||||
```
|
||||
|
||||
## var styleElement = insertCss(css, opts);
|
||||
|
||||
Insert some CSS into the page.
|
||||
|
||||
* `opts.container` - Which HTMLElement to use as the base mounting point, defaults to
|
||||
`document.querySelector('head')`.
|
||||
|
||||
* `opts.prepend` - Add the CSS at the top level of the container instead of at the bottom level (default).
|
||||
|
||||
This is particullary useful for library creators where you may want your default CSS to be prepended so it
|
||||
can be easily overriden by user styles.
|
||||
|
||||
# development
|
||||
|
||||
## example
|
||||
|
||||
``` sh
|
||||
npm run example
|
||||
```
|
||||
|
||||
## test
|
||||
|
||||
``` sh
|
||||
npm test
|
||||
```
|
||||
78
web/node_modules/insert-css/test.js
generated
vendored
Normal file
78
web/node_modules/insert-css/test.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
var test = require('tape');
|
||||
|
||||
test(function (t) {
|
||||
var insertCss = require('./');
|
||||
var initialNbStyleTags = nbStyleTags();
|
||||
|
||||
// basic usage
|
||||
var baseStyle = 'body{position:relative;text-decoration:overline}';
|
||||
insertCss(baseStyle);
|
||||
t.equal(position(), 'relative', 'initial position is `relative`');
|
||||
|
||||
// adds one style tag
|
||||
t.equal(nbStyleTags(), initialNbStyleTags + 1, 'we added one style tag');
|
||||
|
||||
// default to appending style
|
||||
var appendStyle = 'body{position:absolute}';
|
||||
var appendStyleTag = insertCss(appendStyle);
|
||||
t.equal(position(), 'absolute', 'new position is `absolute`');
|
||||
|
||||
// reuse same style tag
|
||||
t.equal(nbStyleTags(), initialNbStyleTags + 1, 'we kept using the same style tag');
|
||||
|
||||
// prepend should add a new style tag before the append one
|
||||
t.equal(textDecoration(), 'overline', 'text-decoration is overline by default');
|
||||
var prependStyleTag = insertCss('body{text-decoration:underline !important}', {prepend: true});
|
||||
t.equal(nbStyleTags(), initialNbStyleTags + 2, 'we added a new style tag');
|
||||
t.equal(textDecoration(), 'underline', 'text-decoration is now underline');
|
||||
var tag = prependStyleTag;
|
||||
while (tag !== appendStyleTag) {
|
||||
tag = tag.nextSibling;
|
||||
}
|
||||
t.equal(tag, appendStyleTag, 'prepend mode should add a style tag before the append one');
|
||||
|
||||
// uses old school styleSheet prop when present (IE)
|
||||
if (!appendStyleTag.styleSheet) {
|
||||
appendStyleTag.styleSheet = {cssText: 'a'};
|
||||
insertCss('p{color:blue}');
|
||||
t.equal(appendStyleTag.styleSheet.cssText, 'ap{color:blue}', 'we use old school styleSheet prop');
|
||||
delete appendStyleTag.styleSheet;
|
||||
}
|
||||
|
||||
// allow re-adding added style
|
||||
insertCss(baseStyle);
|
||||
t.equal(position(), 'relative', 'position is again `relative`');
|
||||
|
||||
// allow using a custom container
|
||||
var customContainer = document.createElement('div');
|
||||
document.querySelector('body').appendChild(customContainer);
|
||||
t.equal(nbStyleTags(customContainer), 0, 'no style tag in custom container');
|
||||
insertCss('body{position:absolute}', {container: customContainer});
|
||||
t.equal(nbStyleTags(customContainer), 1, 'new style tag added in custom container');
|
||||
t.equal(position(), 'absolute', 'position is absolute again');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test(function testEmpty(t) {
|
||||
var insertCss = require('./');
|
||||
|
||||
t.equal(insertCss(), false, 'insertCss() with no arguments returns `false`');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
function position() {
|
||||
var getStyle = require('computed-style');
|
||||
return getStyle(document.querySelector('body'), 'position');
|
||||
}
|
||||
|
||||
function textDecoration() {
|
||||
var getStyle = require('computed-style');
|
||||
return getStyle(document.querySelector('body'), 'text-decoration');
|
||||
}
|
||||
|
||||
function nbStyleTags(container) {
|
||||
if (!container) container = document;
|
||||
return container.querySelectorAll('style').length
|
||||
}
|
||||
Reference in New Issue
Block a user