@kasko/fe-loading-indicator 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/loader.js CHANGED
@@ -1,13 +1,18 @@
1
1
  module.exports = function (config = {}) {
2
- let result = '<style title="li-loader">@keyframes spinner-loader{0%{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(360deg)}}.hidden{display:none}#loader-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1500}#loader-wrapper:not(.li-loaded){background:#222;opacity:.9}#loader,#loader::after,#loader::before{border-radius:50%;border:3px solid transparent}#loader{display:block;width:150px;height:150px;margin:-75px 0 0 -75px;z-index:1501;position:relative;left:50%;top:50%;border-top-color:"@color1";animation:spin 2s linear infinite}#loader::after,#loader::before{content:"";position:absolute;top:5px;left:5px;right:5px;bottom:5px;border-top-color:"@color2";animation:spin 3s linear infinite}#loader::after{top:15px;left:15px;right:15px;bottom:15px;border-top-color:"@color3";animation:spin 1.5s linear infinite}#loader-wrapper .loader-section{position:fixed;top:0;width:50%;height:100%;z-index:1500;transform:translateX(0)}.li-loaded .loader-section{background:#222;opacity:.9}#loader-wrapper .loader-section.section-left{left:0}#loader-wrapper .loader-section.section-right{right:0}#loader-wrapper.li-loaded .loader-section.section-left{transform:translateX(-100%);transition:all .7s .3s cubic-bezier(.645,.045,.355,1)}#loader-wrapper.li-loaded .loader-section.section-right{transform:translateX(100%);transition:all .7s .3s cubic-bezier(.645,.045,.355,1)}.li-loaded #loader{opacity:0;transition:all .3s ease-out}#loader-wrapper.li-loaded{visibility:hidden}.spinner-loader:not(:requigray){animation:spinner-loader 1500ms infinite linear;border-radius:.5em;box-shadow:#025983 1.5em 0 0 0,#025983 1.1em 1.1em 0 0,#025983 0 1.5em 0 0,#025983 -1.1em 1.1em 0 0,#025983 -1.5em 0 0 0,#025983 -1.1em -1.1em 0 0,#025983 0 -1.5em 0 0,#025983 1.1em -1.1em 0 0;display:inline-block;font-size:10px;width:1em;height:1em;margin:1.5em;overflow:hidden;text-indent:100%}</style> <div id="loader-wrapper" class="hidden"> <div id="loader"></div> <div class="loader-section section-left"></div> <div class="loader-section section-right"></div> </div> <script>function LoadingIndicator(){this.init=function(){var o=document.getElementById("loader-wrapper");o&&o.classList.remove("hidden")},this.hide=function(){const o=document.getElementById("loader-wrapper");o&&o.classList.add("li-loaded")},this.setColors=function(o){for(var t,e=0;e<document.styleSheets.length;e++){var n=document.styleSheets.item(e);if("li-loader"===n.title){t=n;break}}t&&(t.insertRule("#loader { border-top-color:"+o[0]+"!important;}"),t.insertRule("#loader::before { border-top-color:"+o[1]+"!important;}"),t.insertRule("#loader::after { border-top-color:"+o[2]+"!important;}"))}}const loadingIndicator=new LoadingIndicator;window.LoadingIndicator=loadingIndicator,window.LoadingIndicator.init();</script> ';
2
+ let result = '<style title="li-loader">@keyframes spinner-loader{0%{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(360deg)}}.hidden{display:none}#loader-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1500}#loader-wrapper:not(.li-loaded){background:"@overlaycolor";opacity:.9}#loader,#loader::after,#loader::before{border-radius:50%;border:3px solid transparent}#loader{display:block;width:150px;height:150px;margin:-75px 0 0 -75px;z-index:1501;position:relative;left:50%;top:50%;border-top-color:"@color1";animation:spin 2s linear infinite}#loader::after,#loader::before{content:"";position:absolute;top:5px;left:5px;right:5px;bottom:5px;border-top-color:"@color2";animation:spin 3s linear infinite}#loader::after{top:15px;left:15px;right:15px;bottom:15px;border-top-color:"@color3";animation:spin 1.5s linear infinite}#loader-wrapper .loader-section{position:fixed;top:0;width:50%;height:100%;z-index:1500;transform:translateX(0)}.li-loaded .loader-section{background:"@overlaycolor";opacity:.9}#loader-wrapper .loader-section.section-left{left:0}#loader-wrapper .loader-section.section-right{right:0}#loader-wrapper.li-loaded .loader-section.section-left{transform:translateX(-100%);transition:all .7s .3s cubic-bezier(.645,.045,.355,1)}#loader-wrapper.li-loaded .loader-section.section-right{transform:translateX(100%);transition:all .7s .3s cubic-bezier(.645,.045,.355,1)}.li-loaded #loader{opacity:0;transition:all .3s ease-out}#loader-wrapper.li-loaded{visibility:hidden}.spinner-loader:not(:requigray){animation:spinner-loader 1500ms infinite linear;border-radius:.5em;box-shadow:#025983 1.5em 0 0 0,#025983 1.1em 1.1em 0 0,#025983 0 1.5em 0 0,#025983 -1.1em 1.1em 0 0,#025983 -1.5em 0 0 0,#025983 -1.1em -1.1em 0 0,#025983 0 -1.5em 0 0,#025983 1.1em -1.1em 0 0;display:inline-block;font-size:10px;width:1em;height:1em;margin:1.5em;overflow:hidden;text-indent:100%}</style> <div id="loader-wrapper" class="hidden"> <div id="loader"></div> <div class="loader-section section-left"></div> <div class="loader-section section-right"></div> </div> <script>function LoadingIndicator(){this.init=function(){var o=document.getElementById("loader-wrapper");o&&o.classList.remove("hidden")},this.hide=function(){const o=document.getElementById("loader-wrapper");o&&o.classList.add("li-loaded")},this.setColors=function(o){for(var t,e=0;e<document.styleSheets.length;e++){var n=document.styleSheets.item(e);if("li-loader"===n.title){t=n;break}}t&&(t.insertRule("#loader { border-top-color:"+o[0]+"!important;}"),t.insertRule("#loader::before { border-top-color:"+o[1]+"!important;}"),t.insertRule("#loader::after { border-top-color:"+o[2]+"!important;}"))}}const loadingIndicator=new LoadingIndicator;window.LoadingIndicator=loadingIndicator,window.LoadingIndicator.init();</script> ';
3
3
 
4
4
  if (!config.colors) {
5
- config.colors = ['#ebbb2a', '#fff', '#a07c0f']
5
+ config.colors = ['#ebbb2a', '#fff', '#a07c0f'];
6
+ }
7
+
8
+ if (!config.overlayColor) {
9
+ config.overlayColor = '#222';
6
10
  }
7
11
 
8
12
  config.colors.forEach((color, index) => {
9
13
  result = result.replace('\"@color' + (index + 1) + '\"', color);
10
14
  });
11
15
 
16
+ result = result.replace(/\"@overlaycolor\"/g, config.overlayColor);
12
17
  return result;
13
18
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kasko/fe-loading-indicator",
3
3
  "shortname": "fe-loading-indicator",
4
- "version": "1.1.2",
4
+ "version": "1.2.0",
5
5
  "description": "Kasko frontend loading indicator",
6
6
  "license": "UNLICENSED",
7
7
  "main": "index.js",
@@ -16,10 +16,10 @@
16
16
  "dependencies": {},
17
17
  "devDependencies": {
18
18
  "gulp": "^3.9.1",
19
- "gulp-clean": "^0.3.2",
19
+ "gulp-clean": "^0.4.0",
20
20
  "gulp-csso": "^3.0.0",
21
21
  "gulp-less": "^3.3.2",
22
- "gulp-minify": "^1.0.0",
22
+ "gulp-minify": "^2.1.0",
23
23
  "gulp-replace": "^0.6.1",
24
24
  "run-sequence": "^2.2.0"
25
25
  },
package/src/loader.less CHANGED
@@ -22,7 +22,7 @@
22
22
  }
23
23
 
24
24
  #loader-wrapper:not(.li-loaded) {
25
- background: #222;
25
+ background: "@overlaycolor";
26
26
  opacity: .9;
27
27
  }
28
28
 
@@ -87,7 +87,7 @@
87
87
  }
88
88
 
89
89
  .li-loaded .loader-section {
90
- background: #222;
90
+ background: "@overlaycolor";
91
91
  opacity: .9;
92
92
  }
93
93