Comparing version 1.8.1 to 1.9.0
@@ -111,2 +111,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
methods = _ref2$methods === undefined ? {} : _ref2$methods, | ||
_ref2$aliases = _ref2.aliases, | ||
aliases = _ref2$aliases === undefined ? {} : _ref2$aliases, | ||
_ref2$init = _ref2.init, | ||
@@ -186,2 +188,11 @@ initFn = _ref2$init === undefined ? function () {} : _ref2$init, | ||
// Link aliases | ||
Object.entries(aliases).forEach(function (_ref3) { | ||
var _ref4 = _slicedToArray(_ref3, 2), | ||
alias = _ref4[0], | ||
target = _ref4[1]; | ||
return comp[alias] = comp[target]; | ||
}); | ||
// Reset all component props to their default value | ||
@@ -212,2 +223,40 @@ comp.resetProps = function () { | ||
var _slicedToArray = function () { | ||
function sliceIterator(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"]) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
return function (arr, i) { | ||
if (Array.isArray(arr)) { | ||
return arr; | ||
} else if (Symbol.iterator in Object(arr)) { | ||
return sliceIterator(arr, i); | ||
} else { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
} | ||
}; | ||
}(); | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -214,0 +263,0 @@ if (!(instance instanceof Constructor)) { |
@@ -1,1 +0,1 @@ | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Kapsule=t():n.Kapsule=t()}("undefined"!=typeof self?self:this,function(){return function(n){var t={};function e(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return n[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=n,e.c=t,e.d=function(n,t,o){e.o(n,t)||Object.defineProperty(n,t,{configurable:!1,enumerable:!0,get:o})},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.p="",e(e.s=0)}([function(n,t,e){var o,r,i;u=function(n,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(n){var t=n.stateInit,e=void 0===t?function(){return{}}:t,o=n.props,u=void 0===o?{}:o,a=n.methods,f=void 0===a?{}:a,l=n.init,c=void 0===l?function(){}:l,s=n.update,p=void 0===s?function(){}:s,d=Object.keys(u).map(function(n){return new i(n,u[n])});return function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},e instanceof Function?e():e,{initialised:!1});function o(t){return i(t,n),u(),o}var i=function(n,e){c.call(o,n,t,e),t.initialised=!0},u=(0,r.default)(function(){t.initialised&&p.call(o,t)},1);return d.forEach(function(n){o[n.name]=function(n){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(n,t){};return function(i){return arguments.length?(t[n]=i,r.call(o,i,t),e&&u(),o):t[n]}}(n.name,n.triggerUpdate,n.onChange)}),Object.keys(f).forEach(function(n){o[n]=function(){for(var e,r=arguments.length,i=Array(r),u=0;u<r;u++)i[u]=arguments[u];return(e=f[n]).call.apply(e,[o,t].concat(i))}}),o.resetProps=function(){return d.forEach(function(n){o[n.name](n.defaultVal)}),o},o.resetProps(),t._rerender=u,o}};var o,r=(o=e,o&&o.__esModule?o:{default:o});var i=function n(t,e){var o=e.default,r=void 0===o?null:o,i=e.triggerUpdate,u=void 0===i||i,a=e.onChange,f=void 0===a?function(n,t){}:a;!function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.name=t,this.defaultVal=r,this.triggerUpdate=u,this.onChange=f};n.exports=t.default},r=[n,t,e(1)],void 0===(i="function"==typeof(o=u)?o.apply(t,r):o)||(n.exports=i);var u},function(n,t){n.exports=function(n,t,e){var o,r,i,u,a;null==t&&(t=100);function f(){var l=Date.now()-u;l<t&&l>=0?o=setTimeout(f,t-l):(o=null,e||(a=n.apply(i,r),i=r=null))}var l=function(){i=this,r=arguments,u=Date.now();var l=e&&!o;return o||(o=setTimeout(f,t)),l&&(a=n.apply(i,r),i=r=null),a};return l.clear=function(){o&&(clearTimeout(o),o=null)},l.flush=function(){o&&(a=n.apply(i,r),i=r=null,clearTimeout(o),o=null)},l}}])}); | ||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Kapsule=t():n.Kapsule=t()}("undefined"!=typeof self?self:this,function(){return function(n){var t={};function e(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=n,e.c=t,e.d=function(n,t,r){e.o(n,t)||Object.defineProperty(n,t,{configurable:!1,enumerable:!0,get:r})},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.p="",e(e.s=0)}([function(n,t,e){var r,o,i;u=function(n,t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(n){var t=n.stateInit,e=void 0===t?function(){return{}}:t,r=n.props,a=void 0===r?{}:r,f=n.methods,l=void 0===f?{}:f,c=n.aliases,s=void 0===c?{}:c,d=n.init,p=void 0===d?function(){}:d,v=n.update,h=void 0===v?function(){}:v,y=Object.keys(a).map(function(n){return new u(n,a[n])});return function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},e instanceof Function?e():e,{initialised:!1});function r(t){return u(t,n),a(),r}var u=function(n,e){p.call(r,n,t,e),t.initialised=!0},a=(0,o.default)(function(){t.initialised&&h.call(r,t)},1);return y.forEach(function(n){r[n.name]=function(n){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(n,t){};return function(i){return arguments.length?(t[n]=i,o.call(r,i,t),e&&a(),r):t[n]}}(n.name,n.triggerUpdate,n.onChange)}),Object.keys(l).forEach(function(n){r[n]=function(){for(var e,o=arguments.length,i=Array(o),u=0;u<o;u++)i[u]=arguments[u];return(e=l[n]).call.apply(e,[r,t].concat(i))}}),Object.entries(s).forEach(function(n){var t=i(n,2),e=t[0],o=t[1];return r[e]=r[o]}),r.resetProps=function(){return y.forEach(function(n){r[n.name](n.defaultVal)}),r},r.resetProps(),t._rerender=a,r}};var r,o=(r=e,r&&r.__esModule?r:{default:r});var i=function(){return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return function(n,t){var e=[],r=!0,o=!1,i=void 0;try{for(var u,a=n[Symbol.iterator]();!(r=(u=a.next()).done)&&(e.push(u.value),!t||e.length!==t);r=!0);}catch(n){o=!0,i=n}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return e}(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();var u=function n(t,e){var r=e.default,o=void 0===r?null:r,i=e.triggerUpdate,u=void 0===i||i,a=e.onChange,f=void 0===a?function(n,t){}:a;!function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.name=t,this.defaultVal=o,this.triggerUpdate=u,this.onChange=f};n.exports=t.default},o=[n,t,e(1)],void 0===(i="function"==typeof(r=u)?r.apply(t,o):r)||(n.exports=i);var u},function(n,t){n.exports=function(n,t,e){var r,o,i,u,a;null==t&&(t=100);function f(){var l=Date.now()-u;l<t&&l>=0?r=setTimeout(f,t-l):(r=null,e||(a=n.apply(i,o),i=o=null))}var l=function(){i=this,o=arguments,u=Date.now();var l=e&&!r;return r||(r=setTimeout(f,t)),l&&(a=n.apply(i,o),i=o=null),a};return l.clear=function(){r&&(clearTimeout(r),r=null)},l.flush=function(){r&&(a=n.apply(i,o),i=o=null,clearTimeout(r),r=null)},l}}])}); |
@@ -20,2 +20,3 @@ import debounce from 'debounce'; | ||
methods = {}, | ||
aliases = {}, | ||
init: initFn = (() => {}), | ||
@@ -76,2 +77,5 @@ update: updateFn = (() => {}) | ||
// Link aliases | ||
Object.entries(aliases).forEach(([alias, target]) => comp[alias] = comp[target]); | ||
// Reset all component props to their default value | ||
@@ -78,0 +82,0 @@ comp.resetProps = function() { |
{ | ||
"name": "kapsule", | ||
"version": "1.8.1", | ||
"version": "1.9.0", | ||
"description": "A Simple Web Component library", | ||
@@ -5,0 +5,0 @@ "main": "dist/kapsule.min.js", |
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
220615
412