vue-radial-progress
Advanced tools
Comparing version 0.0.3 to 0.1.0
@@ -0,0 +0,0 @@ module.exports = { |
@@ -1,2 +0,633 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.RadialStepLoader=e():t.RadialStepLoader=e()}(this,function(){return function(t){function e(i){if(r[i])return r[i].exports;var n=r[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){(function(t){"use strict";function e(t){return t&&t.__esModule?t:{"default":t}}var i=r(5),n=e(i);t["export"]=n["default"]}).call(e,r(8)(t))},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={props:{diameter:{type:Number,required:!1,"default":180},totalSteps:{type:Number,required:!0,"default":10},completedSteps:{type:Number,required:!0,"default":2}},data:function(){return{gradient:{fx:.99,fy:.5,cx:.5,cy:.5,r:.65},dashOffset:0,progressStyle:{strokeDashoffset:0},circle:{center:{x:.5,y:.5}},gradientAnimation:null,currentAngle:0}},computed:{radius:function(){return this.diameter/2},stepSize:function(){return 100/this.totalSteps},finishedPercentage:function(){return this.stepSize*this.completedSteps},circleSlice:function(){return 2*Math.PI/this.totalSteps}},methods:{changeProgress:function(){var t=!(arguments.length<=0||void 0===arguments[0])&&arguments[0],e=this.finishedPercentage;isNaN(e)&&(e=100);var r=Math.PI*this.diameter;e<0&&(e=0),e>100&&(e=100);var i=(100-e)/100*r;this.animateGradient(50,1e3,t),this.progressStyle.strokeDashoffset=i},getStopPointsOfCircle:function(t){for(var e=[],r=0;r<t;r++){var i=this.circleSlice*r;e.push(this.getPointOfCircle(i))}return e},getPointOfCircle:function(t){var e=.5,r=e+e*Math.cos(t),i=e+e*Math.sin(t);return{x:r,y:i}},animateGradient:function(t,e){var r=this,i=arguments.length<=2||void 0===arguments[2]||arguments[2];if(0===this.completedSteps||!i){this.currentAngle=this.completedSteps*this.circleSlice;var n=this.getPointOfCircle(this.currentAngle);return this.gradient.fx=n.x,void(this.gradient.fy=n.y)}var o=e/t,s=this.circleSlice/o,a=(this.completedSteps-1)*this.circleSlice;if(this.gradientAnimation){clearInterval(this.gradientAnimation);var c=a+this.circleSlice,f=c-this.currentAngle;s=f/o,a=this.currentAngle}var l=0;this.gradientAnimation=setInterval(function(){if(l===o)return void clearInterval(r.gradientAnimation);r.currentAngle=a+s*l;var t=r.getPointOfCircle(r.currentAngle);r.gradient.fx=t.x,r.gradient.fy=t.y,l++},t)}},ready:function(){var t=this;this.progressStyle.strokeDashoffset=565.48,this.changeProgress(),this.$watch("totalSteps",function(){t.changeProgress(!0)}),this.$watch("completedSteps",function(){t.changeProgress(!0)})}}},function(t,e,r){e=t.exports=r(3)(),e.push([t.id,".progress-container[_v-23fc30b0]{width:200px;height:200px;position:relative}.progress-text[_v-23fc30b0]{position:absolute;width:180px;top:55px;left:10px}.progress-text p[_v-23fc30b0]{margin:0}#svg circle[_v-23fc30b0]{stroke-dashoffset:0;-webkit-transition:stroke-dashoffset 1s linear;transition:stroke-dashoffset 1s linear;stroke-width:12px}#cont[_v-23fc30b0]{display:block;height:200px;width:200px;margin:2em auto;border-radius:100%;position:relative}#cont[_v-23fc30b0]:after{position:absolute;display:block;height:160px;width:160px;left:50%;top:50%;margin-top:-80px;margin-left:-80px;border-radius:100%;line-height:160px;font-size:2em;text-shadow:0 0 .5em #000}.do-search[_v-23fc30b0]{text-decoration:underline;display:block;margin:0 auto}",""])},function(t,e){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e];r[2]?t.push("@media "+r[2]+"{"+r[1]+"}"):t.push(r[1])}return t.join("")},t.i=function(e,r){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},n=0;n<this.length;n++){var o=this[n][0];"number"==typeof o&&(i[o]=!0)}for(n=0;n<e.length;n++){var s=e[n];"number"==typeof s[0]&&i[s[0]]||(r&&!s[2]?s[2]=r:r&&(s[2]="("+s[2]+") and ("+r+")"),t.push(s))}},t}},function(t,e){t.exports=' <div _v-23fc30b0=""> <div class="progress-container spc-med-s" _v-23fc30b0=""> <slot _v-23fc30b0=""></slot> <svg id=svg width=200 height=200 viewport="0 0 100 100" version=1.1 xmlns=http://www.w3.org/2000/svg _v-23fc30b0=""> <defs _v-23fc30b0=""> <linearGradient id=linear x1=0% y1=0% x2=100% y2=0% _v-23fc30b0=""> <stop offset=0% stop-color=#05a _v-23fc30b0=""></stop> <stop offset=100% stop-color=#0a5 _v-23fc30b0=""></stop> </linearGradient> <radialGradient id=MyGradient :fx=gradient.fx :fy=gradient.fy :cx=gradient.cx :cy=gradient.cy :r=gradient.r _v-23fc30b0=""> <stop offset=30% stop-color=#bbff42 _v-23fc30b0=""></stop> <stop offset=100% stop-color=#429321 _v-23fc30b0=""></stop> </radialGradient> </defs> <circle r=90 cx=100 cy=100 fill=transparent stroke="rgba(32, 32, 32, .5)" stroke-dasharray=565.48 stroke-dashoffset=0 stroke-linecap=round _v-23fc30b0=""></circle> <circle id=bar transform=rotate(270,100,100) :r=radius cx=100 cy=100 fill=transparent stroke=url(#MyGradient) stroke-dasharray=565.48 stroke-dashoffset=565.48 stroke-linecap=round :style=progressStyle _v-23fc30b0=""></circle> </svg> </div> </div> '},function(t,e,r){var i,n;r(7),i=r(1),n=r(4),t.exports=i||{},t.exports.__esModule&&(t.exports=t.exports["default"]),n&&(("function"==typeof t.exports?t.exports.options||(t.exports.options={}):t.exports).template=n)},function(t,e,r){function i(t,e){for(var r=0;r<t.length;r++){var i=t[r],n=p[i.id];if(n){n.refs++;for(var o=0;o<n.parts.length;o++)n.parts[o](i.parts[o]);for(;o<i.parts.length;o++)n.parts.push(c(i.parts[o],e))}else{for(var s=[],o=0;o<i.parts.length;o++)s.push(c(i.parts[o],e));p[i.id]={id:i.id,refs:1,parts:s}}}}function n(t){for(var e=[],r={},i=0;i<t.length;i++){var n=t[i],o=n[0],s=n[1],a=n[2],c=n[3],f={css:s,media:a,sourceMap:c};r[o]?r[o].parts.push(f):e.push(r[o]={id:o,parts:[f]})}return e}function o(t,e){var r=h(),i=x[x.length-1];if("top"===t.insertAt)i?i.nextSibling?r.insertBefore(e,i.nextSibling):r.appendChild(e):r.insertBefore(e,r.firstChild),x.push(e);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");r.appendChild(e)}}function s(t){t.parentNode.removeChild(t);var e=x.indexOf(t);e>=0&&x.splice(e,1)}function a(t){var e=document.createElement("style");return e.type="text/css",o(t,e),e}function c(t,e){var r,i,n;if(e.singleton){var o=g++;r=v||(v=a(e)),i=f.bind(null,r,o,!1),n=f.bind(null,r,o,!0)}else r=a(e),i=l.bind(null,r),n=function(){s(r)};return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else n()}}function f(t,e,r,i){var n=r?"":i.css;if(t.styleSheet)t.styleSheet.cssText=m(e,n);else{var o=document.createTextNode(n),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(o,s[e]):t.appendChild(o)}}function l(t,e){var r=e.css,i=e.media,n=e.sourceMap;if(i&&t.setAttribute("media",i),n&&(r+="\n/*# sourceURL="+n.sources[0]+" */",r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"),t.styleSheet)t.styleSheet.cssText=r;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}var p={},d=function(t){var e;return function(){return"undefined"==typeof e&&(e=t.apply(this,arguments)),e}},u=d(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),h=d(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,g=0,x=[];t.exports=function(t,e){e=e||{},"undefined"==typeof e.singleton&&(e.singleton=u()),"undefined"==typeof e.insertAt&&(e.insertAt="bottom");var r=n(t);return i(r,e),function(t){for(var o=[],s=0;s<r.length;s++){var a=r[s],c=p[a.id];c.refs--,o.push(c)}if(t){var f=n(t);i(f,e)}for(var s=0;s<o.length;s++){var c=o[s];if(0===c.refs){for(var l=0;l<c.parts.length;l++)c.parts[l]();delete p[c.id]}}}};var m=function(){var t=[];return function(e,r){return t[e]=r,t.filter(Boolean).join("\n")}}()},function(t,e,r){var i=r(2);"string"==typeof i&&(i=[[t.id,i,""]]);r(6)(i,{});i.locals&&(t.exports=i.locals)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}}])}); | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define("RadialProgressBar", [], factory); | ||
else if(typeof exports === 'object') | ||
exports["RadialProgressBar"] = factory(); | ||
else | ||
root["RadialProgressBar"] = factory(); | ||
})(this, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ exports: {}, | ||
/******/ id: moduleId, | ||
/******/ loaded: false | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.loaded = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
module.exports = __webpack_require__(5); | ||
/***/ }, | ||
/* 1 */ | ||
/***/ function(module, exports) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = { | ||
props: { | ||
diameter: { | ||
type: Number, | ||
required: false, | ||
default: 200 | ||
}, | ||
totalSteps: { | ||
type: Number, | ||
required: true, | ||
default: 10 | ||
}, | ||
completedSteps: { | ||
type: Number, | ||
required: true, | ||
default: 0 | ||
}, | ||
startColor: { | ||
type: String, | ||
required: false, | ||
default: '#bbff42' | ||
}, | ||
stopColor: { | ||
type: String, | ||
required: false, | ||
default: '#429321' | ||
}, | ||
strokeWidth: { | ||
type: Number, | ||
required: false, | ||
default: 10 | ||
}, | ||
animateSpeed: { | ||
type: Number, | ||
required: false, | ||
default: 1000 | ||
} | ||
}, | ||
data: function data() { | ||
return { | ||
gradient: { | ||
fx: 0.99, | ||
fy: 0.5, | ||
cx: 0.5, | ||
cy: 0.5, | ||
r: 0.65 | ||
}, | ||
gradientAnimation: null, | ||
currentAngle: 0, | ||
strokeDashoffset: 0 | ||
}; | ||
}, | ||
computed: { | ||
radius: function radius() { | ||
return this.diameter / 2; | ||
}, | ||
circumference: function circumference() { | ||
return Math.PI * this.innerCircleDiameter; | ||
}, | ||
stepSize: function stepSize() { | ||
return 100 / this.totalSteps; | ||
}, | ||
finishedPercentage: function finishedPercentage() { | ||
return this.stepSize * this.completedSteps; | ||
}, | ||
circleSlice: function circleSlice() { | ||
return 2 * Math.PI / this.totalSteps; | ||
}, | ||
innerCircleDiameter: function innerCircleDiameter() { | ||
return this.diameter - this.strokeWidth * 2; | ||
}, | ||
innerCircleRadius: function innerCircleRadius() { | ||
return this.innerCircleDiameter / 2; | ||
}, | ||
animationIncrements: function animationIncrements() { | ||
return this.animateSpeed / 20; | ||
}, | ||
containerStyle: function containerStyle() { | ||
return { | ||
height: this.diameter + 'px', | ||
width: this.diameter + 'px' | ||
}; | ||
}, | ||
progressStyle: function progressStyle() { | ||
return { | ||
height: this.diameter + 'px', | ||
width: this.diameter + 'px', | ||
strokeWidth: this.strokeWidth + 'px', | ||
strokeDashoffset: this.strokeDashoffset, | ||
transition: 'stroke-dashoffset ' + this.animateSpeed + 'ms linear' | ||
}; | ||
}, | ||
strokeStyle: function strokeStyle() { | ||
return { | ||
height: this.diameter + 'px', | ||
width: this.diameter + 'px', | ||
strokeWidth: this.strokeWidth + 'px' | ||
}; | ||
}, | ||
innerCircleStyle: function innerCircleStyle() { | ||
return { | ||
width: this.innerCircleDiameter + 'px' | ||
}; | ||
} | ||
}, | ||
methods: { | ||
changeProgress: function changeProgress() { | ||
var animateGradient = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; | ||
var finishedPercentage = this.finishedPercentage; | ||
if (isNaN(finishedPercentage)) { | ||
finishedPercentage = 100; | ||
} | ||
if (finishedPercentage < 0) { | ||
finishedPercentage = 0; | ||
} | ||
if (finishedPercentage > 100) { | ||
finishedPercentage = 100; | ||
} | ||
var pct = (100 - finishedPercentage) / 100 * this.circumference; | ||
this.animateGradient(animateGradient); | ||
this.strokeDashoffset = pct; | ||
}, | ||
getStopPointsOfCircle: function getStopPointsOfCircle(steps) { | ||
var points = []; | ||
for (var i = 0; i < steps; i++) { | ||
var angle = this.circleSlice * i; | ||
points.push(this.getPointOfCircle(angle)); | ||
} | ||
return points; | ||
}, | ||
getPointOfCircle: function getPointOfCircle(angle) { | ||
var radius = 0.5; | ||
var x = radius + radius * Math.cos(angle); | ||
var y = radius + radius * Math.sin(angle); | ||
return { x: x, y: y }; | ||
}, | ||
animateGradient: function animateGradient() { | ||
var _this = this; | ||
var isAnimate = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; | ||
if (this.completedSteps === 0 || !isAnimate) { | ||
this.currentAngle = this.completedSteps * this.circleSlice; | ||
var point = this.getPointOfCircle(this.currentAngle); | ||
this.gradient.fx = point.x; | ||
this.gradient.fy = point.y; | ||
return; | ||
} | ||
var totalPoints = 20; | ||
var slice = this.circleSlice / totalPoints; | ||
var angleOffset = (this.completedSteps - 1) * this.circleSlice; | ||
if (this.gradientAnimation) { | ||
clearInterval(this.gradientAnimation); | ||
var endAngle = angleOffset + this.circleSlice; | ||
var totalSize = endAngle - this.currentAngle; | ||
slice = totalSize / totalPoints; | ||
angleOffset = this.currentAngle; | ||
} | ||
var i = 0; | ||
this.gradientAnimation = setInterval(function () { | ||
if (i >= totalPoints) { | ||
clearInterval(_this.gradientAnimation); | ||
return; | ||
} | ||
_this.currentAngle = angleOffset + slice * i; | ||
var point = _this.getPointOfCircle(_this.currentAngle); | ||
_this.gradient.fx = point.x; | ||
_this.gradient.fy = point.y; | ||
i++; | ||
}, this.animationIncrements); | ||
} | ||
}, | ||
ready: function ready() { | ||
var _this2 = this; | ||
this.changeProgress(); | ||
this.$watch('totalSteps', function () { | ||
_this2.changeProgress(true); | ||
}); | ||
this.$watch('completedSteps', function () { | ||
_this2.changeProgress(true); | ||
}); | ||
} | ||
}; | ||
/***/ }, | ||
/* 2 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
exports = module.exports = __webpack_require__(3)(); | ||
// imports | ||
// module | ||
exports.push([module.id, ".radial-progress-container[_v-8d6abd44] {\n position: relative;\n}\n.radial-progress-inner[_v-8d6abd44] {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n position: absolute;\n border-radius: 50%;\n z-index: -1;\n margin: 0 auto;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n", ""]); | ||
// exports | ||
/***/ }, | ||
/* 3 */ | ||
/***/ function(module, exports) { | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
*/ | ||
// css base code, injected by the css-loader | ||
module.exports = function() { | ||
var list = []; | ||
// return the list of modules as css string | ||
list.toString = function toString() { | ||
var result = []; | ||
for(var i = 0; i < this.length; i++) { | ||
var item = this[i]; | ||
if(item[2]) { | ||
result.push("@media " + item[2] + "{" + item[1] + "}"); | ||
} else { | ||
result.push(item[1]); | ||
} | ||
} | ||
return result.join(""); | ||
}; | ||
// import a list of modules into the list | ||
list.i = function(modules, mediaQuery) { | ||
if(typeof modules === "string") | ||
modules = [[null, modules, ""]]; | ||
var alreadyImportedModules = {}; | ||
for(var i = 0; i < this.length; i++) { | ||
var id = this[i][0]; | ||
if(typeof id === "number") | ||
alreadyImportedModules[id] = true; | ||
} | ||
for(i = 0; i < modules.length; i++) { | ||
var item = modules[i]; | ||
// skip already imported module | ||
// this implementation is not 100% perfect for weird media query combinations | ||
// when a module is imported multiple times with different media queries. | ||
// I hope this will never occur (Hey this way we have smaller bundles) | ||
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { | ||
if(mediaQuery && !item[2]) { | ||
item[2] = mediaQuery; | ||
} else if(mediaQuery) { | ||
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; | ||
} | ||
list.push(item); | ||
} | ||
} | ||
}; | ||
return list; | ||
}; | ||
/***/ }, | ||
/* 4 */ | ||
/***/ function(module, exports) { | ||
module.exports = "\n<div class=\"radial-progress-container\" :style=\"containerStyle\" _v-8d6abd44=\"\">\n <div class=\"radial-progress-inner\" :style=\"innerCircleStyle\" _v-8d6abd44=\"\">\n <slot _v-8d6abd44=\"\"></slot>\n </div>\n <svg class=\"radial-progress-bar\" :width=\"diameter\" :height=\"diameter\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" _v-8d6abd44=\"\">\n <defs _v-8d6abd44=\"\">\n <radialGradient id=\"radial-gradient\" :fx=\"gradient.fx\" :fy=\"gradient.fy\" :cx=\"gradient.cx\" :cy=\"gradient.cy\" :r=\"gradient.r\" _v-8d6abd44=\"\">\n <stop offset=\"30%\" :stop-color=\"startColor\" _v-8d6abd44=\"\"></stop>\n <stop offset=\"100%\" :stop-color=\"stopColor\" _v-8d6abd44=\"\"></stop>\n </radialGradient>\n </defs>\n <circle :r=\"innerCircleRadius\" :cx=\"radius\" :cy=\"radius\" fill=\"transparent\" stroke=\"rgba(32, 32, 32, .5)\" :stroke-dasharray=\"circumference\" stroke-dashoffset=\"0\" stroke-linecap=\"round\" :style=\"strokeStyle\" _v-8d6abd44=\"\"></circle>\n <circle transform=\"rotate(270, {{ radius }}, {{ radius }})\" :r=\"innerCircleRadius\" :cx=\"radius\" :cy=\"radius\" fill=\"transparent\" stroke=\"url(#radial-gradient)\" :stroke-dasharray=\"circumference\" :stroke-dashoffset=\"circumference\" stroke-linecap=\"round\" :style=\"progressStyle\" _v-8d6abd44=\"\"></circle>\n </svg>\n</div>\n"; | ||
/***/ }, | ||
/* 5 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __vue_script__, __vue_template__ | ||
__webpack_require__(7) | ||
__vue_script__ = __webpack_require__(1) | ||
if (__vue_script__ && | ||
__vue_script__.__esModule && | ||
Object.keys(__vue_script__).length > 1) { | ||
console.warn("[vue-loader] src/RadialProgressBar.vue: named exports in *.vue files are ignored.")} | ||
__vue_template__ = __webpack_require__(4) | ||
module.exports = __vue_script__ || {} | ||
if (module.exports.__esModule) module.exports = module.exports.default | ||
if (__vue_template__) { | ||
(typeof module.exports === "function" ? (module.exports.options || (module.exports.options = {})) : module.exports).template = __vue_template__ | ||
} | ||
/***/ }, | ||
/* 6 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
*/ | ||
var stylesInDom = {}, | ||
memoize = function(fn) { | ||
var memo; | ||
return function () { | ||
if (typeof memo === "undefined") memo = fn.apply(this, arguments); | ||
return memo; | ||
}; | ||
}, | ||
isOldIE = memoize(function() { | ||
return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase()); | ||
}), | ||
getHeadElement = memoize(function () { | ||
return document.head || document.getElementsByTagName("head")[0]; | ||
}), | ||
singletonElement = null, | ||
singletonCounter = 0, | ||
styleElementsInsertedAtTop = []; | ||
module.exports = function(list, options) { | ||
if(false) { | ||
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); | ||
} | ||
options = options || {}; | ||
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style> | ||
// tags it will allow on a page | ||
if (typeof options.singleton === "undefined") options.singleton = isOldIE(); | ||
// By default, add <style> tags to the bottom of <head>. | ||
if (typeof options.insertAt === "undefined") options.insertAt = "bottom"; | ||
var styles = listToStyles(list); | ||
addStylesToDom(styles, options); | ||
return function update(newList) { | ||
var mayRemove = []; | ||
for(var i = 0; i < styles.length; i++) { | ||
var item = styles[i]; | ||
var domStyle = stylesInDom[item.id]; | ||
domStyle.refs--; | ||
mayRemove.push(domStyle); | ||
} | ||
if(newList) { | ||
var newStyles = listToStyles(newList); | ||
addStylesToDom(newStyles, options); | ||
} | ||
for(var i = 0; i < mayRemove.length; i++) { | ||
var domStyle = mayRemove[i]; | ||
if(domStyle.refs === 0) { | ||
for(var j = 0; j < domStyle.parts.length; j++) | ||
domStyle.parts[j](); | ||
delete stylesInDom[domStyle.id]; | ||
} | ||
} | ||
}; | ||
} | ||
function addStylesToDom(styles, options) { | ||
for(var i = 0; i < styles.length; i++) { | ||
var item = styles[i]; | ||
var domStyle = stylesInDom[item.id]; | ||
if(domStyle) { | ||
domStyle.refs++; | ||
for(var j = 0; j < domStyle.parts.length; j++) { | ||
domStyle.parts[j](item.parts[j]); | ||
} | ||
for(; j < item.parts.length; j++) { | ||
domStyle.parts.push(addStyle(item.parts[j], options)); | ||
} | ||
} else { | ||
var parts = []; | ||
for(var j = 0; j < item.parts.length; j++) { | ||
parts.push(addStyle(item.parts[j], options)); | ||
} | ||
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; | ||
} | ||
} | ||
} | ||
function listToStyles(list) { | ||
var styles = []; | ||
var newStyles = {}; | ||
for(var i = 0; i < list.length; i++) { | ||
var item = list[i]; | ||
var id = item[0]; | ||
var css = item[1]; | ||
var media = item[2]; | ||
var sourceMap = item[3]; | ||
var part = {css: css, media: media, sourceMap: sourceMap}; | ||
if(!newStyles[id]) | ||
styles.push(newStyles[id] = {id: id, parts: [part]}); | ||
else | ||
newStyles[id].parts.push(part); | ||
} | ||
return styles; | ||
} | ||
function insertStyleElement(options, styleElement) { | ||
var head = getHeadElement(); | ||
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1]; | ||
if (options.insertAt === "top") { | ||
if(!lastStyleElementInsertedAtTop) { | ||
head.insertBefore(styleElement, head.firstChild); | ||
} else if(lastStyleElementInsertedAtTop.nextSibling) { | ||
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling); | ||
} else { | ||
head.appendChild(styleElement); | ||
} | ||
styleElementsInsertedAtTop.push(styleElement); | ||
} else if (options.insertAt === "bottom") { | ||
head.appendChild(styleElement); | ||
} else { | ||
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'."); | ||
} | ||
} | ||
function removeStyleElement(styleElement) { | ||
styleElement.parentNode.removeChild(styleElement); | ||
var idx = styleElementsInsertedAtTop.indexOf(styleElement); | ||
if(idx >= 0) { | ||
styleElementsInsertedAtTop.splice(idx, 1); | ||
} | ||
} | ||
function createStyleElement(options) { | ||
var styleElement = document.createElement("style"); | ||
styleElement.type = "text/css"; | ||
insertStyleElement(options, styleElement); | ||
return styleElement; | ||
} | ||
function addStyle(obj, options) { | ||
var styleElement, update, remove; | ||
if (options.singleton) { | ||
var styleIndex = singletonCounter++; | ||
styleElement = singletonElement || (singletonElement = createStyleElement(options)); | ||
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false); | ||
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true); | ||
} else { | ||
styleElement = createStyleElement(options); | ||
update = applyToTag.bind(null, styleElement); | ||
remove = function() { | ||
removeStyleElement(styleElement); | ||
}; | ||
} | ||
update(obj); | ||
return function updateStyle(newObj) { | ||
if(newObj) { | ||
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) | ||
return; | ||
update(obj = newObj); | ||
} else { | ||
remove(); | ||
} | ||
}; | ||
} | ||
var replaceText = (function () { | ||
var textStore = []; | ||
return function (index, replacement) { | ||
textStore[index] = replacement; | ||
return textStore.filter(Boolean).join('\n'); | ||
}; | ||
})(); | ||
function applyToSingletonTag(styleElement, index, remove, obj) { | ||
var css = remove ? "" : obj.css; | ||
if (styleElement.styleSheet) { | ||
styleElement.styleSheet.cssText = replaceText(index, css); | ||
} else { | ||
var cssNode = document.createTextNode(css); | ||
var childNodes = styleElement.childNodes; | ||
if (childNodes[index]) styleElement.removeChild(childNodes[index]); | ||
if (childNodes.length) { | ||
styleElement.insertBefore(cssNode, childNodes[index]); | ||
} else { | ||
styleElement.appendChild(cssNode); | ||
} | ||
} | ||
} | ||
function applyToTag(styleElement, obj) { | ||
var css = obj.css; | ||
var media = obj.media; | ||
var sourceMap = obj.sourceMap; | ||
if (media) { | ||
styleElement.setAttribute("media", media); | ||
} | ||
if (sourceMap) { | ||
// https://developer.chrome.com/devtools/docs/javascript-debugging | ||
// this makes source maps inside style tags work properly in Chrome | ||
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'; | ||
// http://stackoverflow.com/a/26603875 | ||
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; | ||
} | ||
if (styleElement.styleSheet) { | ||
styleElement.styleSheet.cssText = css; | ||
} else { | ||
while(styleElement.firstChild) { | ||
styleElement.removeChild(styleElement.firstChild); | ||
} | ||
styleElement.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
/***/ }, | ||
/* 7 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// style-loader: Adds some css to the DOM by adding a <style> tag | ||
// load the styles | ||
var content = __webpack_require__(2); | ||
if(typeof content === 'string') content = [[module.id, content, '']]; | ||
// add the styles to the DOM | ||
var update = __webpack_require__(6)(content, {}); | ||
if(content.locals) module.exports = content.locals; | ||
// Hot Module Replacement | ||
if(false) { | ||
// When the styles change, update the <style> tags | ||
if(!content.locals) { | ||
module.hot.accept("!!./../node_modules/css-loader/index.js!./../node_modules/vue-loader/lib/style-rewriter.js?id=_v-8d6abd44&scoped=true!./../node_modules/less-loader/index.js!./../node_modules/vue-loader/lib/selector.js?type=style&index=0!./RadialProgressBar.vue", function() { | ||
var newContent = require("!!./../node_modules/css-loader/index.js!./../node_modules/vue-loader/lib/style-rewriter.js?id=_v-8d6abd44&scoped=true!./../node_modules/less-loader/index.js!./../node_modules/vue-loader/lib/selector.js?type=style&index=0!./RadialProgressBar.vue"); | ||
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; | ||
update(newContent); | ||
}); | ||
} | ||
// When the module is disposed, remove the <style> tags | ||
module.hot.dispose(function() { update(); }); | ||
} | ||
/***/ } | ||
/******/ ]) | ||
}); | ||
; | ||
//# sourceMappingURL=build.min.js.map |
{ | ||
"name": "vue-radial-progress", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"description": "A radial progress bar component for VueJS", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -0,0 +0,0 @@ # vue-radial-progress [![npm package](https://img.shields.io/npm/v/vue-radial-progress.svg)](https://www.npmjs.com/package/vue-radial-progress) |
var config = require('./webpack.config.js'); | ||
var path = require('path'); | ||
config.entry = './src/index.js'; | ||
config.entry = './src/main.js'; | ||
config.output = { | ||
path: path.resolve(__dirname, './dist'), | ||
filename: 'build.min.js', | ||
filename: './dist/build.min.js', | ||
library: 'RadialProgressBar', | ||
libraryTarget: 'umd' | ||
libraryTarget: 'umd', | ||
umdNamedDefine: true | ||
} | ||
module.exports = config |
@@ -11,5 +11,3 @@ var path = require('path') | ||
}, | ||
resolveLoader: { | ||
root: path.join(__dirname, 'node_modules'), | ||
}, | ||
module: { | ||
@@ -40,9 +38,9 @@ loaders: [ | ||
}), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
} | ||
}), | ||
// new webpack.optimize.UglifyJsPlugin({ | ||
// compress: { | ||
// warnings: false | ||
// } | ||
// }), | ||
new webpack.optimize.OccurenceOrderPlugin() | ||
]) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
629
169301
15
2
1