UNPKG

pbar

Version:

Tiny progress bar widget in css and js es5

7 lines (6 loc) 2.61 kB
require=function e$$0(g,f,h){function d(c,b){if(!f[c]){if(!g[c]){var e="function"==typeof require&&require;if(!b&&e)return e(c,!0);if(a)return a(c,!0);e=Error("Cannot find module '"+c+"'");throw e.code="MODULE_NOT_FOUND",e;}e=f[c]={exports:{}};g[c][0].call(e.exports,function(a){var b=g[c][1][a];return d(b?b:a)},e,e.exports,e$$0,g,f,h)}return f[c].exports}for(var a="function"==typeof require&&require,b=0;b<h.length;b++)d(h[b]);return d}({pbar:[function(k,g,f){Object.defineProperty(f,"__esModule",{value:!0}); var h=function(){function d(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(a,b,c){b&&d(a.prototype,b);c&&d(a,c);return a}}();k=function(){function d(a){var b=this;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");a=a||{};var c={color:"#40B3CC",background:"transparent",border:"0 solid transparent",height:"4px",position:a.target?"absolute":"fixed", target:document.body,transition:"0.35s",value:"50%"};this.opts={};Object.keys(c).map(function(e){return b.opts[e]=a[e]||c[e]});"string"===typeof this.opts.target&&(this.opts.target=document.getElementById(this.opts.target));this.frame=document.createElement("div");this.bar=document.createElement("div");this.frame.appendChild(this.bar);var f={left:"0",right:"0",top:"0",position:this.opts.position};Object.keys(f).map(function(a){return b.fs(a,f[a])});this.bs("height","100%");"height border color background transition value".split(" ").map(function(a){return b[a]= b.opts[a]});this.opts.target.appendChild(this.frame)}h(d,[{key:"fs",value:function(a,b){this.frame.style[a]=b}},{key:"bs",value:function(a,b){this.bar.style[a]=b}},{key:"color",get:function(){return this.opts.color},set:function(a){this.opts.color=a;this.bs("backgroundColor",a)}},{key:"background",get:function(){return this.opts.background},set:function(a){this.opts.background=a;this.fs("backgroundColor",a)}},{key:"border",get:function(){return this.opts.border},set:function(a){this.opts.border=a; this.fs("border",a)}},{key:"height",get:function(){return this.opts.height},set:function(a){this.opts.height=a;this.fs("height",a)}},{key:"value",get:function(){return this.opts.value},set:function(a){this.opts.value=a;this.bs("width",a)}},{key:"position",get:function(){return this.opts.position}},{key:"target",get:function(){return this.opts.target}},{key:"transition",get:function(){return this.opts.height},set:function(a){this.opts.transition=a;this.bs("transition","width "+a)}}]);return d}();f.pbar= k},{}]},{},[]);