Comparing version 1.2.0 to 1.2.1
import { IFunction } from 'herb-core-include'; | ||
export * from './proxy'; | ||
export * from './builder'; | ||
export * from './init'; | ||
export * from './parser'; | ||
export declare function tryCatchForEach<T extends any>(arr: T[], cb: IFunction<[Error | null, T?]>): void; | ||
//# sourceMappingURL=index.d.ts.map |
import { IFunction } from 'herb-core-include'; | ||
declare type IProxyFunctionResponse<T> = T | void | never; | ||
export declare function proxyState<T>(state: T): IProxyFunctionResponse<T>; | ||
export declare function proxyGetters<T>(getters: T, buildParams: IFunction<[keyof T]>): IProxyFunctionResponse<T>; | ||
export declare function proxyGetters<T>( | ||
getters: T, | ||
buildParams: IFunction<[keyof T]> | ||
): IProxyFunctionResponse<T>; | ||
export declare function proxyMutations<T>(mutations: T): IProxyFunctionResponse<T>; | ||
export declare function proxyActions<T>(actions: T): IProxyFunctionResponse<T>; | ||
export declare function initActions<T>(actions: T): IProxyFunctionResponse<T>; | ||
export {}; | ||
//# sourceMappingURL=proxy.d.ts.map | ||
//# sourceMappingURL=proxy.d.ts.map |
@@ -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,c=t[Symbol.iterator]();!(r=(u=c.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.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=n(3),i=n.n(o),u=n(0),c=n.n(u),a=n(1),s=n.n(a),f=n(2),l=n.n(f);function m(t,e){return Object.prototype.toString.call(t)===r[e]}function p(t){return null==t}function d(t){return Array.isArray?Array.isArray(t):m(t,"array")}function y(t){return!!t&&"object"===l()(t)}function b(t){return m(t,"object")}function h(t){return m(t,"string")}function g(t){return m(t,"symbol")}function v(t){return!!t&&"function"==typeof t.then}function $(t){return"function"==typeof t}!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={}));var x=n(4),S=n.n(x);function j(t,e){for(var n=S()(e,2),r=n[0],o=n[1],i=0;i<t.length;i++)if(t[i][r]===o)return t[i]}function O(t,e){return t.indexOf(e)}function P(t,e){for(var n=Object.keys(t),r=0;r<n.length;r++){var o=n[r];e(t[o],o)}}function w(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 T(t,e){var n=O(t,e);n>-1&&t.splice(n,1)}function A(){}function k(t,e){if(!t)throw new Error("[Herbx] "+e)}function E(t,e,n){0}function C(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(null===t||"object"!==l()(t))return t;var n=j(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=t.map((function(t){return C(t,e)}))):o===r.set?(i.copy=new Set,t.forEach((function(t){i.copy.add(C(t,e))}))):o===r.map?(i.copy=new Map,t.forEach((function(t,n){i.copy.set(n,C(t,e))}))):o===r.date?i.copy=new Date(t):(i.copy={},Object.keys(t).forEach((function(n){i.copy[n]=C(t[n],e)}))),i.copy}function M(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function F(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 D(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 N(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:A},enumerable:!0},commitRoot:{get:function(){return n?e.root.commit:A},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)}function H(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 H(t.substr(o+e.length),i.$namespaceSep,i.modules)}}function _(t,e,n){var r=function(t,e){var n=w(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:H(o,e,n),method:i}}}function q(t,e){if(d(t))try{t.forEach((function(t){e(null,t)}))}catch(t){e(t)}}var I={},G=function(){function t(e){c()(this,t),this.queue=[],this.flushing=!1;var n=e.uid;this.uid=n,this.afterCreate()}return s()(t,[{key:"afterCreate",value:function(){M(I,this.uid)||(I[this.uid]=this)}},{key:"beforeDestroy",value:function(){M(I,this.uid)&&delete I[this.uid]}},{key:"setTimer",value:function(t,e){return setTimeout(t,e)}},{key:"clearTimer",value:function(t){return clearTimeout(t)}},{key:"addTask",value:function(t){this.queue.push(t)}},{key:"removeTask",value:function(t){T(this.queue,t)}},{key:"flush",value:function(t){var e=this;this.flushing=!0,this.clearTimer(this.timer);var n=this.queue.length;this.timer=this.setTimer((function(){e&&(q(e.queue.splice(0,n),(function(t,e){t?console.warn("[Herbx Flush Error] ",t):e()})),e.flushing=!1,$(t)&&t())}),0)}}]),t}(),J=0,R=function(){function t(e){var n=this;c()(this,t),this.$namespaceSep="/",this.$namespaced=!1,this.$mutationFunctionContext=null,this.$actionFunctionContext=null,this.$uid=J++,this.$subscribers={mutation:[],action:[]},this.$modules={},this.afterCreate=function(){n.$namespaced||(n.$scheduler=new G({uid:n.$uid}),n.resetScheduler())},this.beforeDestory=function(){n.$scheduler&&n.$scheduler.beforeDestroy()},this.resetScheduler=function(){n.$scheduler.addTask((function(){n.broadcast(),$(n.$listener)&&n.$listener(n)}))},this.broadcast=function(){P(n.$modules,(function(t,e){n&&!t.$namespaced&&t.notify()}))},this.notify=function(){n&&(n.$namespaced?n.root.notify():n.$scheduler.flush(n.resetScheduler))},this.subscribe=function(t,e){return n.$subscribers[t]?(O(n.$subscribers[t],e)<0&&n.$subscribers[t].push(e),function(){T(n.$subscribers[t],e)}):A},this.registerModule=function(e,r){M(n.$modules,e)&&k(!1,"namespace is exists: "+e),b(r)||k(!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&&(M(n.$state,e)&&k(!1,"module state namespace is exists: "+e),M(n.$getters,e)&&k(!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){M(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],u=n.$actions[o];if("function"==typeof u){n.execSubcribers("action",e);var c=N.apply(n,e),a=u.apply(n.$actionFunctionContext,"function"==typeof n.$actionParamsTransformer?n.$actionParamsTransformer.apply(null,c):c);return a}var s,f=_(o,n.$namespaceSep,n.$modules);if(f&&f.module)return(s=f.module).dispatch.apply(s,[f.method].concat(i()(e.slice(1))));E()},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(b(o)){var u=Object.assign(n.state,o);return n.execSubcribers("mutation",e),n.notify(),u}var c=n.$mutations[o];if("function"==typeof c){var a=D.apply(n,e),s=c.apply(n.$mutationFunctionContext,"function"==typeof n.$mutationParamsTransformer?n.$mutationParamsTransformer.apply(null,a.concat(o)):a);return n.execSubcribers("mutation",e),n.notify(),s}var f,l=_(o,n.$namespaceSep,n.$modules);if(l&&l.module)return(f=l.module).commit.apply(f,[l.method].concat(i()(e.slice(1))));E()};var r=e.state,o=e.getters,u=e.mutations,a=e.actions,s=e.plugins,f=e.namespace,l=e.actionParamsTransformer,m=e.getterParamsTransformer,d=e.mutationParamsTransformer,y=e.root,h=e.listener,g=e.modules,v=e.namespaced,x=void 0!==v&&v;this.$state=function(t){if(!p(t)){var e=b(t);if(e)return C(t);E()}}(r)||{},this.$getters=function(t,e){if(!p(t)){var n=b(t);if(n){var r={};return P(t,(function(t,n){"function"==typeof t?(r[n]=t,Object.defineProperty(r,n,{enumerable:!0,get:function(){var r=e(n);return t.call(null,r)}})):E()})),r}E()}}(o,(function(t){var e=F.call(n,t);return"function"==typeof n.$getterParamsTransformer?n.$getterParamsTransformer.call(null,e):e}))||{},this.$mutations=function(t){if(!p(t)){var e=b(t);if(e)return t;E()}}(u)||{},this.$actions=function(t){if(!p(t)){var e=b(t);if(e)return t;E()}}(a)||{},this.$namespace=f,this.$namespaced=!!x,this.$getterParamsTransformer=m,this.$actionParamsTransformer=l,this.$mutationParamsTransformer=d,this.$listener=h,y&&y instanceof t&&(this.$root=y),b(g)&&P(g,(function(t,e){n.registerModule(e,t)})),q(s,(function(t,e){if(t)return E(0,t.message);$(e)&&e(n)})),this.afterCreate()}return s()(t,[{key:"execSubcribers",value:function(t,e){var n=this;q(this.$subscribers[t],(function(t,r){if(t)return E(0,t.message);$(r)&&r.apply(void 0,[n].concat(i()(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 B(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t){var e=C(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),c=2;c<i;c++)u[c-2]=arguments[c];var a=u;"string"!=typeof r&&(o="Empty Mutation Name",a.unshift(r));var s=C(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",a),n("%c [Herbx] Next State: ","color: #4CAF50; font-weight: bold",s),e=s}))}}function K(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t){}}n.d(e,"Types",(function(){return r})),n.d(e,"is",(function(){return m})),n.d(e,"isNil",(function(){return p})),n.d(e,"isArray",(function(){return d})),n.d(e,"isObject",(function(){return y})),n.d(e,"isPlainObject",(function(){return b})),n.d(e,"isString",(function(){return h})),n.d(e,"isSymbol",(function(){return g})),n.d(e,"isPromise",(function(){return v})),n.d(e,"isFunction",(function(){return $})),n.d(e,"findByKey",(function(){return j})),n.d(e,"findIndex",(function(){return O})),n.d(e,"eachObject",(function(){return P})),n.d(e,"lastIndexOf",(function(){return w})),n.d(e,"remove",(function(){return T})),n.d(e,"noop",(function(){return A})),n.d(e,"assert",(function(){return k})),n.d(e,"log",(function(){return E})),n.d(e,"deepCopy",(function(){return C})),n.d(e,"hasOwnProperty",(function(){return M})),n.d(e,"LoggerPlugin",(function(){return B})),n.d(e,"DevToolPlugin",(function(){return K})),n.d(e,"Store",(function(){return R}));e.default=R}])})); | ||
!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,c=t[Symbol.iterator]();!(r=(u=c.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==c.return||c.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=n(3),i=n.n(o),u=n(0),c=n.n(u),a=n(1),s=n.n(a),f=n(2),l=n.n(f);function m(t,e){return Object.prototype.toString.call(t)===r[e]}function p(t){return null==t}function y(t){return Array.isArray?Array.isArray(t):m(t,"array")}function d(t){return!!t&&"object"===l()(t)}function b(t){return m(t,"object")}function h(t){return m(t,"string")}function g(t){return m(t,"symbol")}function v(t){return!!t&&"function"==typeof t.then}function $(t){return"function"==typeof t}!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={}));var j=n(4),x=n.n(j);function S(t,e){for(var n=x()(e,2),r=n[0],o=n[1],i=0;i<t.length;i++)if(t[i][r]===o)return t[i]}function O(t,e){return t.indexOf(e)}function P(t,e){for(var n=Object.keys(t),r=0;r<n.length;r++){var o=n[r];e(t[o],o)}}function w(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 T(t,e){var n=O(t,e);n>-1&&t.splice(n,1)}function A(){}function k(t,e){if(!t)throw new Error("[Herbx] "+e)}function E(t,e,n){0}function C(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(null===t||"object"!==l()(t))return t;var n=S(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=t.map((function(t){return C(t,e)}))):o===r.set?(i.copy=new Set,t.forEach((function(t){i.copy.add(C(t,e))}))):o===r.map?(i.copy=new Map,t.forEach((function(t,n){i.copy.set(n,C(t,e))}))):o===r.date?i.copy=new Date(t):(i.copy={},Object.keys(t).forEach((function(n){i.copy[n]=C(t[n],e)}))),i.copy}function M(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function D(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 F(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 N(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:A},enumerable:!0},commitRoot:{get:function(){return n?e.root.commit:A},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)}function H(t,e){if(d(t)){var n=Object.prototype.toString.call(t);n===r.object?P(t,(function(n,r){!function(t,e,n,r){var o=Object.getOwnPropertyDescriptor(t,e);if(o&&!1===o.configurable)return;var i=o&&o.get,u=o&&o.set;H(n,r),Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){return i?i.call(t):n},set:function(o){o!==(i?i.call(t):n)&&(i&&!u||(u?u.call(t,o):n=o,r(e,o,t),H(o,r)))}})}(t,r,n,e)})):n===r.array&&t.forEach((function(t){H(t,e)}))}}function _(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 _(t.substr(o+e.length),i.$namespaceSep,i.modules)}}function q(t,e,n){var r=function(t,e){var n=w(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:_(o,e,n),method:i}}}function I(t,e){if(y(t))try{t.forEach((function(t){e(null,t)}))}catch(t){e(t)}}var G={},J=function(){function t(e){c()(this,t),this.queue=[],this.flushing=!1;var n=e.uid;this.uid=n,this.afterCreate()}return s()(t,[{key:"afterCreate",value:function(){M(G,this.uid)||(G[this.uid]=this)}},{key:"beforeDestroy",value:function(){M(G,this.uid)&&delete G[this.uid]}},{key:"setTimer",value:function(t,e){return setTimeout(t,e)}},{key:"clearTimer",value:function(t){return clearTimeout(t)}},{key:"addTask",value:function(t){this.queue.push(t)}},{key:"removeTask",value:function(t){T(this.queue,t)}},{key:"flush",value:function(t){var e=this;this.flushing=!0,this.clearTimer(this.timer);var n=this.queue.length;this.timer=this.setTimer((function(){e&&(I(e.queue.splice(0,n),(function(t,e){t?console.warn("[Herbx Flush Error] ",t):e()})),e.flushing=!1,$(t)&&t())}),0)}}]),t}(),R=0,B=function(){function t(e){var n=this;c()(this,t),this.$namespaceSep="/",this.$namespaced=!1,this.$mutationFunctionContext=null,this.$actionFunctionContext=null,this.$uid=R++,this.$subscribers={mutation:[],action:[]},this.$modules={},this.afterCreate=function(){n.$namespaced||(n.$scheduler=new J({uid:n.$uid}),n.resetScheduler())},this.beforeDestory=function(){n.$scheduler&&n.$scheduler.beforeDestroy()},this.resetScheduler=function(){n.$scheduler.addTask((function(){n.broadcast(),$(n.$listener)&&n.$listener(n)}))},this.broadcast=function(){P(n.$modules,(function(t,e){n&&!t.$namespaced&&t.notify()}))},this.notify=function(){n&&(n.$namespaced?n.root.notify():n.$scheduler.flush(n.resetScheduler))},this.subscribe=function(t,e){return n.$subscribers[t]?(O(n.$subscribers[t],e)<0&&n.$subscribers[t].push(e),function(){T(n.$subscribers[t],e)}):A},this.registerModule=function(e,r){M(n.$modules,e)&&k(!1,"namespace is exists: "+e),b(r)||k(!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&&(M(n.$state,e)&&k(!1,"module state namespace is exists: "+e),M(n.$getters,e)&&k(!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){M(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],u=n.$actions[o];if("function"==typeof u){n.execSubcribers("action",e);var c=N.apply(n,e),a=u.apply(n.$actionFunctionContext,"function"==typeof n.$actionParamsTransformer?n.$actionParamsTransformer.apply(null,c):c);return a}var s,f=q(o,n.$namespaceSep,n.$modules);if(f&&f.module)return(s=f.module).dispatch.apply(s,[f.method].concat(i()(e.slice(1))));E()},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(b(o)){var u=Object.assign(n.state,o);return n.execSubcribers("mutation",e),n.notify(),u}var c=n.$mutations[o];if("function"==typeof c){var a=F.apply(n,e),s=c.apply(n.$mutationFunctionContext,"function"==typeof n.$mutationParamsTransformer?n.$mutationParamsTransformer.apply(null,a.concat(o)):a);return n.execSubcribers("mutation",e),n.notify(),s}var f,l=q(o,n.$namespaceSep,n.$modules);if(l&&l.module)return(f=l.module).commit.apply(f,[l.method].concat(i()(e.slice(1))));E()};var r=e.state,o=e.getters,u=e.mutations,a=e.actions,s=e.plugins,f=e.namespace,l=e.actionParamsTransformer,m=e.getterParamsTransformer,y=e.mutationParamsTransformer,d=e.root,h=e.listener,g=e.modules,v=e.namespaced,j=void 0!==v&&v;this.$state=function(t,e){if(!p(t)){var n=b(t);if(n){var r=C(t);return H(r,e),r}E()}}(r,this.notify)||{},this.$getters=function(t,e){if(!p(t)){var n=b(t);if(n){var r={};return P(t,(function(t,n){"function"==typeof t?(r[n]=t,Object.defineProperty(r,n,{enumerable:!0,get:function(){var r=e(n);return t.call(null,r)}})):E()})),r}E()}}(o,(function(t){var e=D.call(n,t);return"function"==typeof n.$getterParamsTransformer?n.$getterParamsTransformer.call(null,e):e}))||{},this.$mutations=function(t){if(!p(t)){var e=b(t);if(e)return t;E()}}(u)||{},this.$actions=function(t){if(!p(t)){var e=b(t);if(e)return t;E()}}(a)||{},this.$namespace=f,this.$namespaced=!!j,this.$getterParamsTransformer=m,this.$actionParamsTransformer=l,this.$mutationParamsTransformer=y,this.$listener=h,d&&d instanceof t&&(this.$root=d),b(g)&&P(g,(function(t,e){n.registerModule(e,t)})),I(s,(function(t,e){if(t)return E(0,t.message);$(e)&&e(n)})),this.afterCreate()}return s()(t,[{key:"execSubcribers",value:function(t,e){var n=this;I(this.$subscribers[t],(function(t,r){if(t)return E(0,t.message);$(r)&&r.apply(void 0,[n].concat(i()(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 K(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t){var e=C(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),c=2;c<i;c++)u[c-2]=arguments[c];var a=u;"string"!=typeof r&&(o="Empty Mutation Name",a.unshift(r));var s=C(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",a),n("%c [Herbx] Next State: ","color: #4CAF50; font-weight: bold",s),e=s}))}}function L(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return function(t){}}n.d(e,"Types",(function(){return r})),n.d(e,"is",(function(){return m})),n.d(e,"isNil",(function(){return p})),n.d(e,"isArray",(function(){return y})),n.d(e,"isObject",(function(){return d})),n.d(e,"isPlainObject",(function(){return b})),n.d(e,"isString",(function(){return h})),n.d(e,"isSymbol",(function(){return g})),n.d(e,"isPromise",(function(){return v})),n.d(e,"isFunction",(function(){return $})),n.d(e,"findByKey",(function(){return S})),n.d(e,"findIndex",(function(){return O})),n.d(e,"eachObject",(function(){return P})),n.d(e,"lastIndexOf",(function(){return w})),n.d(e,"remove",(function(){return T})),n.d(e,"noop",(function(){return A})),n.d(e,"assert",(function(){return k})),n.d(e,"log",(function(){return E})),n.d(e,"deepCopy",(function(){return C})),n.d(e,"hasOwnProperty",(function(){return M})),n.d(e,"LoggerPlugin",(function(){return K})),n.d(e,"DevToolPlugin",(function(){return L})),n.d(e,"Store",(function(){return B}));e.default=B}])})); |
{ | ||
"name": "herbx", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"main": "lib/index.js", | ||
@@ -18,5 +18,5 @@ "files": [ | ||
"dependencies": { | ||
"herb-core-include": "^1.0.9" | ||
"herb-core-include": "^1.0.10" | ||
}, | ||
"gitHead": "02f4ab8fe0b8ade8f24c5769614e4143ffcbe8b7" | ||
"gitHead": "464e9be629a7481d5812a43b444981d8d98603d2" | ||
} |
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
87994
36
155
Updatedherb-core-include@^1.0.10