Comparing version 1.2.14 to 1.2.15
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("herbx",[],e):"object"==typeof exports?exports.herbx=e():t.herbx=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=r=function(t){return n(t)}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(e)}t.exports=r},function(t,e,n){var r=n(6),o=n(7),i=n(8);t.exports=function(t){return r(t)||o(t)||i()}},function(t,e,n){var r=n(9),o=n(10),i=n(11);t.exports=function(t,e){return r(t)||o(t,e)||i()}},function(t,e,n){t.exports=n(12)},function(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}},function(t,e){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e,n){"use strict";n.r(e);var r,o,i=n(3),u=n.n(i),a=n(0),s=n.n(a),c=n(1),f=n.n(c),l=n(4),h=n.n(l),d=n(2),p=n.n(d);function y(t,e){return Object.prototype.toString.call(t)===r[e]}function b(t){return null==t}function v(t){return Array.isArray?Array.isArray(t):y(t,"array")}function m(t){return null!==t&&"object"===p()(t)}function g(t){return y(t,"object")}function w(t){return y(t,"string")}function $(t){return y(t,"symbol")}function S(t){return!!t&&"function"==typeof t.then}function x(t){return"function"==typeof t}function j(t){return"function"==typeof t&&/native code/.test(t.toString())}function O(){}function P(t,e){if(!t)throw new Error("[Herbx] "+e)}function k(t,e,n){0}function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(null===t||"object"!==p()(t))return t;var n=T(e,["origin",t]);if(n)return n.copy;var o=Object.prototype.toString.call(t),i={origin:t,copy:void 0};return e.push(i),o===r.array?(i.copy=[],i.copy=W(t,(function(t){return A(t,e)}))):o===r.set?(i.copy=new Set,t.forEach((function(t){i.copy.add(A(t,e))}))):o===r.map?(i.copy=new Map,t.forEach((function(t,n){i.copy.set(n,A(t,e))}))):o===r.date?i.copy=new Date(t):(i.copy={},F(t,(function(t,n){i.copy[n]=A(t,e)}))),i.copy}function D(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _(t,e,n,r){Object.defineProperty(t,e,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function T(t,e){for(var n=h()(e,2),r=n[0],o=n[1],i=0,u=t.length;i<u;i++)if(t[i][r]===o)return t[i]}function E(t,e){return t.indexOf(e)}function F(t,e){for(var n=Object.keys(t),r=0,o=n.length;r<o;r++){var i=n[r];e(t[i],i)}}function I(t,e){if("string"==typeof t){for(var n=t.length;n>=0;){var r=n-e.length;if(r<0)return-1;if(t.substr(r,e.length)===e)return r;n-=1}return-1}return-1}function C(t,e){if(t.length){var n=E(t,e);n>-1&&t.splice(n,1)}}function M(t,e,n){for(var r=0,o=n.length;r<o;r++){var i=n[r];_(t,i,e[i])}}function N(t,e){t.__proto__=e}function H(t){for(var e=[],n=0,r=t.length;n<r;n++)e[n]=t[n];return e}function W(t,e){for(var n=[],r=0,o=t.length;r<o;r++)n[r]=e(t[r]);return n}!function(t){t.array="[object Array]",t.date="[object Date]",t.set="[object Set]",t.map="[object Map]",t.object="[object Object]",t.string="[object String]",t.symbol="[object Symbol]"}(r||(r={})),o="undefined"!=typeof Set&&j(Set)?Set:function(){function t(){s()(this,t),this.set=Object.create(null)}return f()(t,[{key:"has",value:function(t){return!0===this.set[t]}},{key:"add",value:function(t){this.set[t]=!0}},{key:"clear",value:function(){this.set=Object.create(null)}}]),t}();var z="__proto__"in{};function q(t){var e=this,n=!!e.root,r={};return Object.defineProperties(r,{state:{get:function(){return e.state},enumerable:!0},getters:{get:function(){return e.getters},enumerable:!0},rootState:{get:function(){return n?e.root.state:void 0},enumerable:!0},rootGetters:{get:function(){return n?e.root.getters:void 0},enumerable:!0}}),r}function G(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return[this.state].concat(n)}function J(t){var e=this,n=!!e.root,r={};Object.defineProperties(r,{commit:{get:function(){return e.commit},enumerable:!0},dispatch:{get:function(){return e.dispatch},enumerable:!0},state:{get:function(){return e.state},enumerable:!0},rootState:{get:function(){return n?e.root.state:void 0},enumerable:!0},getters:{get:function(){return e.getters},enumerable:!0},rootGetters:{get:function(){return n?e.root.getters:void 0},enumerable:!0},dispatchRoot:{get:function(){return n?e.root.dispatch:O},enumerable:!0},commitRoot:{get:function(){return n?e.root.commit:O},enumerable:!0}});for(var o=arguments.length,i=new Array(o>1?o-1:0),u=1;u<o;u++)i[u-1]=arguments[u];return[r].concat(i)}var R="__gw__",U="__ob__",B=0,K=function(){function t(){s()(this,t),this.id=B++,this.subs=[]}return f()(t,[{key:"addSub",value:function(t){this.subs.push(t)}},{key:"removeSub",value:function(t){C(this.subs,t)}},{key:"depend",value:function(){t.target&&t.target.addDep(this)}},{key:"notify",value:function(){for(var t=this.subs.slice(),e=0,n=t.length;e<n;e++)t[e].update()}}]),t}();K.target=null;var L=[];var Q=["push","pop","shift","unshift","splice","sort","reverse"],V=Array.prototype,X=Object.create(V);function Y(t,e,n){var r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=new K,i=r&&r.get,u=r&&r.set,a=Z(n);Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){var e=i?i.call(t):n;return K.target&&(o.depend(),a&&(a.dep.depend(),v(e)&&function t(e){for(var n,r=0,o=e.length;r<o;r++)(n=e[r])&&n[U]&&n[U].dep.depend(),v(n)&&t(n)}(e))),e},set:function(e){e!==(i?i.call(t):n)&&(i&&!u||(u?u.call(t,e):n=e,a=Z(e),o.notify()))}})}}function Z(t){var e;if(m(t))return D(t,U)&&t[U]instanceof tt?e=t[U]:(v(t)||g(t))&&Object.isExtensible(t)&&(e=new tt(t)),e}Q.forEach((function(t){var e=V[t];_(X,t,(function(){var n,r=H(arguments),o=e.apply(this,r),i=this[U];switch(t){case"push":case"unshift":n=r;break;case"splice":n=r.slice(2)}return n&&i.observeArray(n),i.dep.notify(),o}))}));var tt=function(){function t(e){s()(this,t),this.value=e,this.dep=new K,_(e,U,this,!1),v(e)?(!function(t){z?N(t,X):M(t,X,Q)}(e),this.observeArray(e)):this.walk(e)}return f()(t,[{key:"walk",value:function(t){for(var e=Object.keys(t),n=0;n<e.length;n++)Y(t,e[n],t[e[n]])}},{key:"observeArray",value:function(t){for(var e=0,n=t.length;e<n;e++)Z(t[e])}}]),t}(),et=new(function(){function t(){s()(this,t),this.ids={},this.queue=[],this.flushing=!1}return f()(t,[{key:"addWatcher",value:function(t){var e=t.id;this.ids[e]||(this.ids[e]=!0,this.queue.push(t))}},{key:"resetState",value:function(){this.queue.length=0,this.ids={},this.flushing=!1}},{key:"flush",value:function(){var t=this;this.flushing||(clearTimeout(this.timer),this.timer=setTimeout((function(){if(t){t.flushing=!0;for(var e=0;e<t.queue.length;e++)try{var n=t.queue[e];t.ids[n.id]=null,n.run()}catch(t){console.warn("[Herbx Flush Error] ",t)}t.resetState()}}),0))}}]),t}()),nt=new o;function rt(t){!function t(e,n){var r,o,i=v(e);if(!i&&!m(e)||Object.isFrozen(e))return;if(e[U]){var u=e[U].dep.id;if(n.has(u))return;n.add(u)}if(i)for(r=e.length;r--;)t(e[r],n);else for(o=Object.keys(e),r=o.length;r--;)t(e[o[r]],n)}(t,nt),nt.clear()}var ot=0,it=function(){function t(e){s()(this,t),this.active=!0,this.deps=[],this.depIds=new Set,this.newDeps=[],this.newDepIds=new Set;var n=e.getter,r=e.notify,o=e.deep,i=e.sync,u=e.lazy;this.id=++ot,this.notify=r,this.getter="function"==typeof n?n:O,this.dirty=this.lazy=!!u,this.deep=!!o,this.sync=!!i,this.value=this.lazy?void 0:this.get()}return f()(t,[{key:"get",value:function(){var t,e;t=this,L.push(t),K.target=t;try{e=this.getter()}catch(t){throw t}finally{this.deep&&rt(e),L.pop(),K.target=L[L.length-1],this.cleanUpDeps()}return e}},{key:"evaluate",value:function(){this.value=this.get(),this.dirty=!this.deps||!this.deps.length}},{key:"addDep",value:function(t){var e=t.id;this.newDepIds.has(e)||(this.newDepIds.add(e),this.newDeps.push(t),this.depIds.has(e)||t.addSub(this))}},{key:"cleanUpDeps",value:function(){for(var t=this.deps.length;t--;){var e=this.deps[t];this.newDepIds.has(e.id)||e.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0}},{key:"update",value:function(){this.lazy?this.dirty=!0:this.sync?this.run():(et.addWatcher(this),et.flush())}},{key:"run",value:function(){if(this.active){var t=this.get();if(t!==this.value||m(t)||this.deep){var e=this.value;this.value=t;try{this.notify&&this.notify(t,e)}catch(t){console.error(t)}}}}},{key:"depend",value:function(){for(var t=this.deps.length;t--;)this.deps[t].depend()}},{key:"teardown",value:function(){if(this.active){for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}}}]),t}();function ut(t,e,n){var r=n[t];if(r)return r;var o=t.indexOf(e);if(o>-1){var i=n[t.substr(0,o)];if(i)return ut(t.substr(o+e.length),i.$namespaceSep,i.modules)}}function at(t,e,n){var r=function(t,e){var n=I(t,e);if(!(n<0))return{moduleName:t.substr(0,n),method:t.substr(n+e.length)}}(t,e);if(r){var o=r.moduleName,i=r.method;return{module:ut(o,e,n),method:i}}}var st=/[^\w.$]/;function ct(t,e){if(!st.test(t)&&e){var n,r=t.split(".");if(r[0])if(D(e.state,r[0])?n=e.state:D(e.getters,r[0])&&(n=e.getters),n)return function(){for(var t=0;t<r.length;t++){if(!n)return;n=n[r[t]]}return n}}}function ft(t,e){if(!b(e)){var n=g(e);if(n){var r={},o={};return _(r,R,o,!1),F(e,(function(e,n){"function"==typeof e?(o[n]=new it({getter:function(){return function(t,e,n){var r=q.call(t,e);"function"==typeof t.$getterParamsTransformer&&(r=t.$getterParamsTransformer.call(null,r));return n.call(null,r)}(t,n,e)},lazy:!0}),Object.defineProperty(r,n,{enumerable:!0,get:lt(n)})):k()})),r}k()}}function lt(t){return function(){var e=this[R]&&this[R][t];if(e)return e.dirty&&e.evaluate(),K.target&&e.depend(),e.value}}function ht(t,e,n){if("function"==typeof n)return new it({getter:ct(e,t),notify:function(e,r){return n.call(t.$actionFunctionContext||t,e,r)}});if("string"==typeof n)return new it({getter:ct(e,t),notify:function(n,r){return t.dispatch(e,n,r)}});if(g(n)){var r=n.sync,o=n.immediate,i=n.deep,u=n.handler;if("function"==typeof u){var a=new it({notify:function(e,n){return u.call(t.$actionFunctionContext||t,e,n)},deep:i,sync:r,getter:ct(e,t)});return o&&u.call(t.$actionFunctionContext||t,a.value),a}}}function dt(t,e){v(t)&&t.forEach((function(t){try{e(null,t)}catch(t){console.error("[Herbx] ForEach Call Function Error: ",t)}}))}var pt=0,yt=function(){function t(e){var n=this;s()(this,t),this.$namespaceSep="/",this.$namespaced=!1,this.$uid=pt++,this.$subscribers={mutation:[],action:[]},this.$modules={},this.beforeDestory=function(){!function(t,e){t[R]&&(F(t[R],(function(t){t.teardown()})),F(e,(function(t){v(t)?t.forEach((function(t){return t.teardown()})):t.teardown()})))}(n.$getters,n.$watchers),F(n.$modules,(function(t){t.beforeDestory()}))},this.notify=function(){n&&(n.$namespaced?n.root&&n.root.notify():(n.broadcast(),n.$renderWatcher&&n.$renderWatcher.update()))},this.broadcast=function(){F(n.$modules,(function(t,e){n&&!t.$namespaced&&t.notify()}))},this.subscribe=function(t,e){return n.$subscribers[t]?(E(n.$subscribers[t],e)<0&&n.$subscribers[t].push(e),function(){C(n.$subscribers[t],e)}):O},this.registerModule=function(e,r){D(n.$modules,e)&&P(!1,"namespace is exists: "+e),g(r)||P(!1,"options must be object: "+e);var o=Object.assign({},r,{root:n,namespace:e}),i=new t(o);return n.$modules[e]=i,o.namespaced&&(D(n.$state,e)&&P(!1,"module state namespace is exists: "+e),D(n.$getters,e)&&P(!1,"module getters namespace is exists: "+e),Object.defineProperty(n.state,e,{get:function(){return i.$state},enumerable:!0}),Object.defineProperty(n.getters,e,{get:function(){return i.$getters},enumerable:!0})),i},this.unregisterModule=function(t){D(n.$modules,t)&&(n.$modules[t].beforeDestory(),delete n.$modules[t])},this.dispatch=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var o=e[0],i=n.$actions[o];if("function"==typeof i){n.execSubcribers("action",e);var a=J.apply(n,e),s=i.apply(n.$actionFunctionContext,"function"==typeof n.$actionParamsTransformer?n.$actionParamsTransformer.apply(null,a):a);return s}var c,f=at(o,n.$namespaceSep,n.$modules);if(f&&f.module)return(c=f.module).dispatch.apply(c,[f.method].concat(u()(e.slice(1))));k()},this.commit=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var o=e[0];if(g(o)){var i=Object.assign(n.state,o);return n.execSubcribers("mutation",e),n.notify(),i}var a=n.$mutations[o];if("function"==typeof a){var s=G.apply(n,e),c=a.apply(n.$mutationFunctionContext,"function"==typeof n.$mutationParamsTransformer?n.$mutationParamsTransformer.apply(null,s.concat(o)):s);return n.execSubcribers("mutation",e),n.notify(),c}var f,l=at(o,n.$namespaceSep,n.$modules);if(l&&l.module)return(f=l.module).commit.apply(f,[l.method].concat(u()(e.slice(1))));k()};var r=e.state,o=e.getters,i=e.mutations,a=e.actions,c=e.watch,f=e.plugins,l=e.namespace,h=e.actionFunctionContext,d=e.mutationFunctionContext,p=e.actionParamsTransformer,y=e.getterParamsTransformer,m=e.mutationParamsTransformer,w=e.root,$=e.modules,S=e.namespaced,j=void 0!==S&&S,_=e.renderWatcher;this.$getterParamsTransformer=y,this.$actionParamsTransformer=p,this.$mutationParamsTransformer=m,this.$actionFunctionContext=h||null,this.$mutationFunctionContext=d||null,w&&w instanceof t&&(this.$root=w),this.$renderWatcher=_,this.$namespace=l,this.$namespaced=!!j,this.$state=function(t){if(!b(t)){var e=g(t);if(e)return Z(A(t)).value;k()}}(r)||{},this.$getters=ft(this,o)||{},this.$mutations=function(t){if(!b(t)){var e=g(t);if(e)return t;k()}}(i)||{},this.$actions=function(t){if(!b(t)){var e=g(t);if(e)return t;k()}}(a)||{},this.$watchers=function(t,e){if(!b(e)){var n=g(e);if(n){var r={};return F(e,(function(e,n){if(v(e)){r[n]=[];for(var o=0;o<e.length;o++){var i=ht(t,n,e[o]);i&&(r[n][o]=i)}}else{var u=ht(t,n,e);u&&(r[n]=u)}})),r}k()}}(this,c)||{},g($)&&F($,(function(t,e){n.registerModule(e,t)})),dt(f,(function(t,e){if(t)return k(0,t.message);x(e)&&e(n)}))}return f()(t,[{key:"execSubcribers",value:function(t,e){var n=this;dt(this.$subscribers[t],(function(t,r){if(t)return k(0,t.message);x(r)&&r.apply(void 0,[n].concat(u()(e)))}))}},{key:"state",get:function(){return this.$state}},{key:"getters",get:function(){return this.$getters}},{key:"root",get:function(){return this.$root}},{key:"modules",get:function(){return this.$modules}}]),t}();function bt(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t){var e=A(t.state),n=console.info;t.subscribe("action",(function(t,e){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];n("%c [Herbx] Action: ".concat(JSON.stringify(e),", Payload: "),"color: #9E9E9E; font-weight: bold",o)}));t.subscribe("mutation",(function(t,r){for(var o=r,i=arguments.length,u=new Array(i>2?i-2:0),a=2;a<i;a++)u[a-2]=arguments[a];var s=u;"string"!=typeof r&&(o="Empty Mutation Name",s.unshift(r));var c=A(t.state);n("%c [Herbx] Prev State: ","color: #9E9E9E; font-weight: bold",e),n("%c [Herbx] Mutation: ".concat(JSON.stringify(o),", Payload: "),"color: #03A9F4; font-weight: bold",s),n("%c [Herbx] Next State: ","color: #4CAF50; font-weight: bold",c),e=c}))}}function vt(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t){}}n.d(e,"findByKey",(function(){return T})),n.d(e,"findIndex",(function(){return E})),n.d(e,"eachObject",(function(){return F})),n.d(e,"lastIndexOf",(function(){return I})),n.d(e,"remove",(function(){return C})),n.d(e,"copyAugment",(function(){return M})),n.d(e,"protoAugment",(function(){return N})),n.d(e,"copyArrayFast",(function(){return H})),n.d(e,"mapArrayFast",(function(){return W})),n.d(e,"_Set",(function(){return o})),n.d(e,"hasProto",(function(){return z})),n.d(e,"Types",(function(){return r})),n.d(e,"is",(function(){return y})),n.d(e,"isNil",(function(){return b})),n.d(e,"isArray",(function(){return v})),n.d(e,"isObject",(function(){return m})),n.d(e,"isPlainObject",(function(){return g})),n.d(e,"isString",(function(){return w})),n.d(e,"isSymbol",(function(){return $})),n.d(e,"isPromise",(function(){return S})),n.d(e,"isFunction",(function(){return x})),n.d(e,"isNative",(function(){return j})),n.d(e,"noop",(function(){return O})),n.d(e,"assert",(function(){return P})),n.d(e,"log",(function(){return k})),n.d(e,"deepCopy",(function(){return A})),n.d(e,"hasOwnProperty",(function(){return D})),n.d(e,"def",(function(){return _})),n.d(e,"LoggerPlugin",(function(){return bt})),n.d(e,"DevToolPlugin",(function(){return vt})),n.d(e,"Store",(function(){return yt})),n.d(e,"Watcher",(function(){return it}));e.default=yt}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("herbx",[],e):"object"==typeof exports?exports.herbx=e():t.herbx=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(e){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?t.exports=r=function(t){return n(t)}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},r(e)}t.exports=r},function(t,e,n){var r=n(6),o=n(7),i=n(8);t.exports=function(t){return r(t)||o(t)||i()}},function(t,e,n){var r=n(9),o=n(10),i=n(11);t.exports=function(t,e){return r(t)||o(t,e)||i()}},function(t,e,n){t.exports=n(12)},function(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}},function(t,e){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e,n){"use strict";n.r(e);var r,o,i=n(3),u=n.n(i),a=n(0),s=n.n(a),c=n(1),f=n.n(c),l=n(4),h=n.n(l),d=n(2),p=n.n(d);function y(t,e){return Object.prototype.toString.call(t)===r[e]}function b(t){return null==t}function v(t){return Array.isArray?Array.isArray(t):y(t,"array")}function m(t){return null!==t&&"object"===p()(t)}function g(t){return y(t,"object")}function w(t){return y(t,"string")}function $(t){return y(t,"symbol")}function S(t){return!!t&&"function"==typeof t.then}function x(t){return"function"==typeof t}function j(t){return"function"==typeof t&&/native code/.test(t.toString())}function O(){}function P(t,e){if(!t)throw new Error("[Herbx] "+e)}function k(t,e,n){0}function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(null===t||"object"!==p()(t))return t;var n=T(e,["origin",t]);if(n)return n.copy;var o=Object.prototype.toString.call(t),i={origin:t,copy:void 0};return e.push(i),o===r.array?(i.copy=[],i.copy=W(t,(function(t){return A(t,e)}))):o===r.set?(i.copy=new Set,t.forEach((function(t){i.copy.add(A(t,e))}))):o===r.map?(i.copy=new Map,t.forEach((function(t,n){i.copy.set(n,A(t,e))}))):o===r.date?i.copy=new Date(t):(i.copy={},F(t,(function(t,n){i.copy[n]=A(t,e)}))),i.copy}function D(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function _(t,e,n,r){Object.defineProperty(t,e,{value:n,enumerable:!!r,writable:!0,configurable:!0})}function T(t,e){for(var n=h()(e,2),r=n[0],o=n[1],i=0,u=t.length;i<u;i++)if(t[i][r]===o)return t[i]}function E(t,e){return t.indexOf(e)}function F(t,e){for(var n=Object.keys(t),r=0,o=n.length;r<o;r++){var i=n[r];e(t[i],i)}}function I(t,e){if("string"==typeof t){for(var n=t.length;n>=0;){var r=n-e.length;if(r<0)return-1;if(t.substr(r,e.length)===e)return r;n-=1}return-1}return-1}function C(t,e){if(t.length){var n=E(t,e);n>-1&&t.splice(n,1)}}function M(t,e,n){for(var r=0,o=n.length;r<o;r++){var i=n[r];_(t,i,e[i])}}function N(t,e){t.__proto__=e}function H(t){for(var e=[],n=0,r=t.length;n<r;n++)e[n]=t[n];return e}function W(t,e){for(var n=[],r=0,o=t.length;r<o;r++)n[r]=e(t[r]);return n}!function(t){t.array="[object Array]",t.date="[object Date]",t.set="[object Set]",t.map="[object Map]",t.object="[object Object]",t.string="[object String]",t.symbol="[object Symbol]"}(r||(r={})),o="undefined"!=typeof Set&&j(Set)?Set:function(){function t(){s()(this,t),this.set=Object.create(null)}return f()(t,[{key:"has",value:function(t){return!0===this.set[t]}},{key:"add",value:function(t){this.set[t]=!0}},{key:"clear",value:function(){this.set=Object.create(null)}}]),t}();var z="__proto__"in{};function q(t){var e=this,n=!!e.root,r={};return Object.defineProperties(r,{state:{get:function(){return e.state},enumerable:!0},getters:{get:function(){return e.getters},enumerable:!0},rootState:{get:function(){return n?e.root.state:void 0},enumerable:!0},rootGetters:{get:function(){return n?e.root.getters:void 0},enumerable:!0}}),r}function G(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return[this.state].concat(n)}function J(t){var e=this,n=!!e.root,r={};Object.defineProperties(r,{commit:{get:function(){return e.commit},enumerable:!0},dispatch:{get:function(){return e.dispatch},enumerable:!0},state:{get:function(){return e.state},enumerable:!0},rootState:{get:function(){return n?e.root.state:void 0},enumerable:!0},getters:{get:function(){return e.getters},enumerable:!0},rootGetters:{get:function(){return n?e.root.getters:void 0},enumerable:!0},dispatchRoot:{get:function(){return n?e.root.dispatch:O},enumerable:!0},commitRoot:{get:function(){return n?e.root.commit:O},enumerable:!0}});for(var o=arguments.length,i=new Array(o>1?o-1:0),u=1;u<o;u++)i[u-1]=arguments[u];return[r].concat(i)}var R="__gw__",U="__ob__",B=0,K=function(){function t(){s()(this,t),this.id=B++,this.subs=[]}return f()(t,[{key:"addSub",value:function(t){this.subs.push(t)}},{key:"removeSub",value:function(t){C(this.subs,t)}},{key:"depend",value:function(){t.target&&t.target.addDep(this)}},{key:"notify",value:function(){for(var t=this.subs.slice(),e=0,n=t.length;e<n;e++)t[e].update()}}]),t}();K.target=null;var L=[];var Q=["push","pop","shift","unshift","splice","sort","reverse"],V=Array.prototype,X=Object.create(V);function Y(t,e,n){var r=Object.getOwnPropertyDescriptor(t,e);if(!r||!1!==r.configurable){var o=new K,i=r&&r.get,u=r&&r.set,a=Z(n);Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){var e=i?i.call(t):n;return K.target&&(o.depend(),a&&(a.dep.depend(),v(e)&&function t(e){for(var n,r=0,o=e.length;r<o;r++)(n=e[r])&&n[U]&&n[U].dep.depend(),v(n)&&t(n)}(e))),e},set:function(e){e!==(i?i.call(t):n)&&(i&&!u||(u?u.call(t,e):n=e,a=Z(e),o.notify()))}})}}function Z(t){var e;if(m(t))return D(t,U)&&t[U]instanceof tt?e=t[U]:(v(t)||g(t))&&Object.isExtensible(t)&&(e=new tt(t)),e}Q.forEach((function(t){var e=V[t];_(X,t,(function(){var n,r=H(arguments),o=e.apply(this,r),i=this[U];switch(t){case"push":case"unshift":n=r;break;case"splice":n=r.slice(2)}return n&&i.observeArray(n),i.dep.notify(),o}))}));var tt=function(){function t(e){s()(this,t),this.value=e,this.dep=new K,_(e,U,this,!1),v(e)?(!function(t){z?N(t,X):M(t,X,Q)}(e),this.observeArray(e)):this.walk(e)}return f()(t,[{key:"walk",value:function(t){for(var e=Object.keys(t),n=0;n<e.length;n++)Y(t,e[n],t[e[n]])}},{key:"observeArray",value:function(t){for(var e=0,n=t.length;e<n;e++)Z(t[e])}}]),t}(),et=new(function(){function t(){s()(this,t),this.ids={},this.queue=[],this.flushing=!1}return f()(t,[{key:"addWatcher",value:function(t){var e=t.id;this.ids[e]||(this.ids[e]=!0,this.queue.push(t))}},{key:"resetState",value:function(){this.queue.length=0,this.ids={},this.flushing=!1}},{key:"flush",value:function(){var t=this;this.flushing||(clearTimeout(this.timer),this.timer=setTimeout((function(){if(t){t.flushing=!0;for(var e=0;e<t.queue.length;e++)try{var n=t.queue[e];t.ids[n.id]=null,n.run()}catch(t){console.warn("[Herbx Flush Error] ",t)}t.resetState()}}),0))}}]),t}()),nt=new o;function rt(t){!function t(e,n){var r,o,i=v(e);if(!i&&!m(e)||Object.isFrozen(e))return;if(e[U]){var u=e[U].dep.id;if(n.has(u))return;n.add(u)}if(i)for(r=e.length;r--;)t(e[r],n);else for(o=Object.keys(e),r=o.length;r--;)t(e[o[r]],n)}(t,nt),nt.clear()}var ot=0,it=function(){function t(e){s()(this,t),this.active=!0,this.deps=[],this.depIds=new Set,this.newDeps=[],this.newDepIds=new Set;var n=e.getter,r=e.notify,o=e.deep,i=e.sync,u=e.lazy;this.id=++ot,this.notify=r,this.getter="function"==typeof n?n:O,this.dirty=this.lazy=!!u,this.deep=!!o,this.sync=!!i,this.value=this.lazy?void 0:this.get()}return f()(t,[{key:"get",value:function(){var t,e;t=this,L.push(t),K.target=t;try{e=this.getter()}catch(t){throw t}finally{this.deep&&rt(e),L.pop(),K.target=L[L.length-1],this.cleanUpDeps()}return e}},{key:"evaluate",value:function(){this.value=this.get(),this.dirty=!this.deps||!this.deps.length}},{key:"addDep",value:function(t){var e=t.id;this.newDepIds.has(e)||(this.newDepIds.add(e),this.newDeps.push(t),this.depIds.has(e)||t.addSub(this))}},{key:"cleanUpDeps",value:function(){for(var t=this.deps.length;t--;){var e=this.deps[t];this.newDepIds.has(e.id)||e.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0}},{key:"update",value:function(){this.lazy?this.dirty=!0:this.sync?this.run():(et.addWatcher(this),et.flush())}},{key:"run",value:function(){if(this.active){var t=this.get();if(t!==this.value||m(t)||this.deep){var e=this.value;this.value=t;try{this.notify&&this.notify(t,e)}catch(t){console.error(t)}}}}},{key:"depend",value:function(){for(var t=this.deps.length;t--;)this.deps[t].depend()}},{key:"teardown",value:function(){if(this.active){for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}}}]),t}();function ut(t,e,n){var r=n[t];if(r)return r;var o=t.indexOf(e);if(o>-1){var i=n[t.substr(0,o)];if(i)return ut(t.substr(o+e.length),i.$namespaceSep,i.modules)}}function at(t,e,n){var r=function(t,e){var n=I(t,e);if(!(n<0))return{moduleName:t.substr(0,n),method:t.substr(n+e.length)}}(t,e);if(r){var o=r.moduleName,i=r.method;return{module:ut(o,e,n),method:i}}}var st=/[^\w.$]/;function ct(t,e){if(!st.test(t)&&e){var n,r=t.split(".");if(r[0])if(D(e.state,r[0])?n=e.state:D(e.getters,r[0])&&(n=e.getters),n)return function(){for(var t=n,e=0;e<r.length;e++){if(!t)return;t=n[r[e]]}return t}}}function ft(t,e){if(!b(e)){var n=g(e);if(n){var r={},o={};return _(r,R,o,!1),F(e,(function(e,n){"function"==typeof e?(o[n]=new it({getter:function(){return function(t,e,n){var r=q.call(t,e);"function"==typeof t.$getterParamsTransformer&&(r=t.$getterParamsTransformer.call(null,r));return n.call(null,r)}(t,n,e)},lazy:!0}),Object.defineProperty(r,n,{enumerable:!0,get:lt(n)})):k()})),r}k()}}function lt(t){return function(){var e=this[R]&&this[R][t];if(e)return e.dirty&&e.evaluate(),K.target&&e.depend(),e.value}}function ht(t,e,n){if("function"==typeof n)return new it({getter:ct(e,t),notify:function(e,r){return n.call(t.$actionFunctionContext||t,e,r)}});if("string"==typeof n)return new it({getter:ct(e,t),notify:function(n,r){return t.dispatch(e,n,r)}});if(g(n)){var r=n.sync,o=n.immediate,i=n.deep,u=n.handler;if("function"==typeof u){var a=new it({getter:ct(e,t),notify:function(e,n){return u.call(t.$actionFunctionContext||t,e,n)},deep:i,sync:r});return o&&u.call(t.$actionFunctionContext||t,a.value),a}}}function dt(t,e){v(t)&&t.forEach((function(t){try{e(null,t)}catch(t){console.error("[Herbx] ForEach Call Function Error: ",t)}}))}var pt=0,yt=function(){function t(e){var n=this;s()(this,t),this.$namespaceSep="/",this.$namespaced=!1,this.$uid=pt++,this.$subscribers={mutation:[],action:[]},this.$modules={},this.beforeDestory=function(){!function(t,e){t[R]&&(F(t[R],(function(t){t.teardown()})),F(e,(function(t){v(t)?t.forEach((function(t){return t.teardown()})):t.teardown()})))}(n.$getters,n.$watchers),F(n.$modules,(function(t){t.beforeDestory()}))},this.notify=function(){n&&(n.$namespaced?n.root&&n.root.notify():(n.broadcast(),n.$renderWatcher&&n.$renderWatcher.update()))},this.broadcast=function(){F(n.$modules,(function(t,e){n&&!t.$namespaced&&t.notify()}))},this.subscribe=function(t,e){return n.$subscribers[t]?(E(n.$subscribers[t],e)<0&&n.$subscribers[t].push(e),function(){C(n.$subscribers[t],e)}):O},this.registerModule=function(e,r){D(n.$modules,e)&&P(!1,"namespace is exists: "+e),g(r)||P(!1,"options must be object: "+e);var o=Object.assign({},r,{root:n,namespace:e}),i=new t(o);return n.$modules[e]=i,o.namespaced&&(D(n.$state,e)&&P(!1,"module state namespace is exists: "+e),D(n.$getters,e)&&P(!1,"module getters namespace is exists: "+e),Object.defineProperty(n.state,e,{get:function(){return i.$state},enumerable:!0}),Object.defineProperty(n.getters,e,{get:function(){return i.$getters},enumerable:!0})),i},this.unregisterModule=function(t){D(n.$modules,t)&&(n.$modules[t].beforeDestory(),delete n.$modules[t])},this.dispatch=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var o=e[0],i=n.$actions[o];if("function"==typeof i){n.execSubcribers("action",e);var a=J.apply(n,e),s=i.apply(n.$actionFunctionContext,"function"==typeof n.$actionParamsTransformer?n.$actionParamsTransformer.apply(null,a):a);return s}var c,f=at(o,n.$namespaceSep,n.$modules);if(f&&f.module)return(c=f.module).dispatch.apply(c,[f.method].concat(u()(e.slice(1))));k()},this.commit=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var o=e[0];if(g(o)){var i=Object.assign(n.state,o);return n.execSubcribers("mutation",e),n.notify(),i}var a=n.$mutations[o];if("function"==typeof a){var s=G.apply(n,e),c=a.apply(n.$mutationFunctionContext,"function"==typeof n.$mutationParamsTransformer?n.$mutationParamsTransformer.apply(null,s.concat(o)):s);return n.execSubcribers("mutation",e),n.notify(),c}var f,l=at(o,n.$namespaceSep,n.$modules);if(l&&l.module)return(f=l.module).commit.apply(f,[l.method].concat(u()(e.slice(1))));k()};var r=e.state,o=e.getters,i=e.mutations,a=e.actions,c=e.watch,f=e.plugins,l=e.namespace,h=e.actionFunctionContext,d=e.mutationFunctionContext,p=e.actionParamsTransformer,y=e.getterParamsTransformer,m=e.mutationParamsTransformer,w=e.root,$=e.modules,S=e.namespaced,j=void 0!==S&&S,_=e.renderWatcher;this.$getterParamsTransformer=y,this.$actionParamsTransformer=p,this.$mutationParamsTransformer=m,this.$actionFunctionContext=h||null,this.$mutationFunctionContext=d||null,w&&w instanceof t&&(this.$root=w),this.$renderWatcher=_,this.$namespace=l,this.$namespaced=!!j,this.$state=function(t){if(!b(t)){var e=g(t);if(e)return Z(A(t)).value;k()}}(r)||{},this.$getters=ft(this,o)||{},this.$mutations=function(t){if(!b(t)){var e=g(t);if(e)return t;k()}}(i)||{},this.$actions=function(t){if(!b(t)){var e=g(t);if(e)return t;k()}}(a)||{},this.$watchers=function(t,e){if(!b(e)){var n=g(e);if(n){var r={};return F(e,(function(e,n){if(v(e)){r[n]=[];for(var o=0;o<e.length;o++){var i=ht(t,n,e[o]);i&&(r[n][o]=i)}}else{var u=ht(t,n,e);u&&(r[n]=u)}})),r}k()}}(this,c)||{},g($)&&F($,(function(t,e){n.registerModule(e,t)})),dt(f,(function(t,e){if(t)return k(0,t.message);x(e)&&e(n)}))}return f()(t,[{key:"execSubcribers",value:function(t,e){var n=this;dt(this.$subscribers[t],(function(t,r){if(t)return k(0,t.message);x(r)&&r.apply(void 0,[n].concat(u()(e)))}))}},{key:"state",get:function(){return this.$state}},{key:"getters",get:function(){return this.$getters}},{key:"root",get:function(){return this.$root}},{key:"modules",get:function(){return this.$modules}}]),t}();function bt(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t){var e=A(t.state),n=console.info;t.subscribe("action",(function(t,e){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];n("%c [Herbx] Action: ".concat(JSON.stringify(e),", Payload: "),"color: #9E9E9E; font-weight: bold",o)}));t.subscribe("mutation",(function(t,r){for(var o=r,i=arguments.length,u=new Array(i>2?i-2:0),a=2;a<i;a++)u[a-2]=arguments[a];var s=u;"string"!=typeof r&&(o="Empty Mutation Name",s.unshift(r));var c=A(t.state);n("%c [Herbx] Prev State: ","color: #9E9E9E; font-weight: bold",e),n("%c [Herbx] Mutation: ".concat(JSON.stringify(o),", Payload: "),"color: #03A9F4; font-weight: bold",s),n("%c [Herbx] Next State: ","color: #4CAF50; font-weight: bold",c),e=c}))}}function vt(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t){}}n.d(e,"findByKey",(function(){return T})),n.d(e,"findIndex",(function(){return E})),n.d(e,"eachObject",(function(){return F})),n.d(e,"lastIndexOf",(function(){return I})),n.d(e,"remove",(function(){return C})),n.d(e,"copyAugment",(function(){return M})),n.d(e,"protoAugment",(function(){return N})),n.d(e,"copyArrayFast",(function(){return H})),n.d(e,"mapArrayFast",(function(){return W})),n.d(e,"_Set",(function(){return o})),n.d(e,"hasProto",(function(){return z})),n.d(e,"Types",(function(){return r})),n.d(e,"is",(function(){return y})),n.d(e,"isNil",(function(){return b})),n.d(e,"isArray",(function(){return v})),n.d(e,"isObject",(function(){return m})),n.d(e,"isPlainObject",(function(){return g})),n.d(e,"isString",(function(){return w})),n.d(e,"isSymbol",(function(){return $})),n.d(e,"isPromise",(function(){return S})),n.d(e,"isFunction",(function(){return x})),n.d(e,"isNative",(function(){return j})),n.d(e,"noop",(function(){return O})),n.d(e,"assert",(function(){return P})),n.d(e,"log",(function(){return k})),n.d(e,"deepCopy",(function(){return A})),n.d(e,"hasOwnProperty",(function(){return D})),n.d(e,"def",(function(){return _})),n.d(e,"LoggerPlugin",(function(){return bt})),n.d(e,"DevToolPlugin",(function(){return vt})),n.d(e,"Store",(function(){return yt})),n.d(e,"Watcher",(function(){return it}));e.default=yt}])})); |
{ | ||
"name": "herbx", | ||
"version": "1.2.14", | ||
"version": "1.2.15", | ||
"main": "lib/index.js", | ||
@@ -20,3 +20,3 @@ "files": [ | ||
}, | ||
"gitHead": "fc37baa8c055c0b2ca8affe2a40436c94b3184fa" | ||
"gitHead": "15b53430b9281aea94f45c35c22e01a3fce2578e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
126715