Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

imvvm

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imvvm - npm Package Compare versions

Comparing version 0.8.6 to 0.8.7

2

bower.json
{
"name": "imvvm",
"version": "0.8.6",
"version": "0.8.7",
"homepage": "https://github.com/entrendipity/imvvm",

@@ -5,0 +5,0 @@ "authors": [

@@ -107,1 +107,6 @@ ## 0.6.17

## 0.8.7
- Make Model `__stateChangeHanlder` property `enumerable` = `false`.
- Fix `dataContextWillUpdate` bug: Undo\Redo did not show any state

@@ -978,6 +978,11 @@ !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.IMVVM=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){

});
model.__stateChangeHandler = (function(){
Object.defineProperty(model, '__stateChangeHandler', {
configurable: false,
enumerable: false,
writable: false,
value: (function(){
return stateChangeHandler;
})();
})()
});

@@ -1048,3 +1053,4 @@ return Object.freeze(model);

subscriber,
pushStateChanged = false;
pushStateChanged = false,
willUndo = false;

@@ -1077,3 +1083,3 @@ if(arguments.length < 2){

if(Object.getPrototypeOf(newState).constructor.classType === "DomainViewModel") {
willUndo = true;
nextState = extend(newState, staticState);

@@ -1118,3 +1124,2 @@ prevState = newState.previousState;

}
} else {

@@ -1264,4 +1269,8 @@

try {
//Add the state that will update
nextState = extend(nextState, {dataContextWillUpdate: processedState});
//Add dataContextWillUpdate
if(willUndo){
nextState = extend(nextState, {dataContextWillUpdate: newState.state.dataContextWillUpdate});
} else {
nextState = extend(nextState, {dataContextWillUpdate: processedState});
}

@@ -1570,5 +1579,10 @@ appState = new ApplicationDataContext(nextState, prevState, redoState,

tempModel.__stateChangeHandler = (function(fld){
return viewModel[fld].__stateChangeHandler;
})(freezeFields[fld].fieldName);
Object.defineProperty(tempModel, '__stateChangeHandler', {
configurable: false,
enumerable: false,
writable: false,
value: (function(fld){
return viewModel[fld].__stateChangeHandler;
})(freezeFields[fld].fieldName)
});

@@ -1575,0 +1589,0 @@ Object.defineProperty(tempModel, 'state', {

@@ -1,1 +0,1 @@

!function(b){if("object"==typeof exports){module.exports=b()}else{if("function"==typeof define&&define.amd){define(b)}else{var a;"undefined"!=typeof window?a=window:"undefined"!=typeof global?a=global:"undefined"!=typeof self&&(a=self),a.IMVVM=b()}}}(function(){var d,b,a;return(function c(f,k,h){function g(n,l){if(!k[n]){if(!f[n]){var i=typeof require=="function"&&require;if(!l&&i){return i(n,!0)}if(e){return e(n,!0)}throw new Error("Cannot find module '"+n+"'")}var m=k[n]={exports:{}};f[n][0].call(m.exports,function(o){var p=f[n][1][o];return g(p?p:o)},m,m.exports,c,f,k,h)}return k[n].exports}var e=typeof require=="function"&&require;for(var j=0;j<h.length;j++){g(h[j])}return g})({1:[function(h,g,f){var e=h("./src/core.js");g.exports=e},{"./src/core.js":3}],2:[function(g,f,e){(function(){var o=true;var h="";var l;function p(w,v){if("function"==typeof w){return p("*",w)}if("function"==typeof v){var t=new m(w);for(var u=1;u<arguments.length;++u){p.callbacks.push(t.middleware(arguments[u]))}}else{if("string"==typeof w){p.show(w,v)}else{p.start(w)}}}p.callbacks=[];p.base=function(t){if(0==arguments.length){return h}h=t};p.start=function(u){u=u||{};if(l){return}l=true;if(false===u.dispatch){o=false}if(false!==u.popstate){window.addEventListener("popstate",q,false)}if(false!==u.click){window.addEventListener("click",s,false)}if(!o){return}var t=location.pathname+location.search+location.hash;p.replace(t,null,true,o)};p.stop=function(){l=false;removeEventListener("click",s,false);removeEventListener("popstate",q,false)};p.show=function(w,v,u){var t=new r(w,v);if(false!==u){p.dispatch(t)}if(!t.unhandled){t.pushState()}return t};p.replace=function(w,v,x,u){var t=new r(w,v);t.init=x;if(null==u){u=true}if(u){p.dispatch(t)}t.save();return t};p.dispatch=function(t){var u=0;function v(){var w=p.callbacks[u++];if(!w){return j(t)}w(t,v)}v()};function j(t){var u=window.location.pathname+window.location.search;if(u==t.canonicalPath){return}p.stop();t.unhandled=true;window.location=t.canonicalPath}function r(w,u){if("/"==w[0]&&0!=w.indexOf(h)){w=h+w}var t=w.indexOf("?");this.canonicalPath=w;this.path=w.replace(h,"")||"/";this.title=document.title;this.state=u||{};this.state.path=w;this.querystring=~t?w.slice(t+1):"";this.pathname=~t?w.slice(0,t):w;this.params=[];this.hash="";if(!~this.path.indexOf("#")){return}var v=this.path.split("#");this.path=v[0];this.hash=v[1]||"";this.querystring=this.querystring.split("#")[0]}p.Context=r;r.prototype.pushState=function(){history.pushState(this.state,this.title,this.canonicalPath)};r.prototype.save=function(){history.replaceState(this.state,this.title,this.canonicalPath)};function m(u,t){t=t||{};this.path=u;this.method="GET";this.regexp=n(u,this.keys=[],t.sensitive,t.strict)}p.Route=m;m.prototype.middleware=function(u){var t=this;return function(v,w){if(t.match(v.path,v.params)){return u(v,w)}w()}};m.prototype.match=function(B,w){var A=this.keys,C=B.indexOf("?"),t=~C?B.slice(0,C):B,v=this.regexp.exec(t);if(!v){return false}for(var x=1,y=v.length;x<y;++x){var z=A[x-1];var u="string"==typeof v[x]?decodeURIComponent(v[x]):v[x];if(z){w[z.name]=undefined!==w[z.name]?w[z.name]:u}else{w.push(u)}}return true};function n(w,v,u,t){if(w instanceof RegExp){return w}if(w instanceof Array){w="("+w.join("|")+")"}w=w.concat(t?"":"/?").replace(/\/\(/g,"(?:/").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,function(z,B,C,A,x,y){v.push({name:A,optional:!!y});B=B||"";return""+(y?"":B)+"(?:"+(y?B:"")+(C||"")+(x||(C&&"([^/.]+?)"||"([^/]+?)"))+")"+(y||"")}).replace(/([\/.])/g,"\\$1").replace(/\*/g,"(.*)");return new RegExp("^"+w+"$",u?"":"i")}function q(u){if(u.state){var t=u.state.path;p.replace(t,u.state)}}function s(w){if(1!=i(w)){return}if(w.metaKey||w.ctrlKey||w.shiftKey){return}if(w.defaultPrevented){return}var t=w.target;while(t&&"A"!=t.nodeName){t=t.parentNode}if(!t||"A"!=t.nodeName){return}var u=t.getAttribute("href");if(t.pathname==location.pathname&&(t.hash||"#"==u)){return}if(t.target){return}if(!k(t.href)){return}var v=t.pathname+t.search+(t.hash||"");var x=v+t.hash;v=v.replace(h,"");if(h&&x==v){return}w.preventDefault();p.show(x)}function i(t){t=t||window.event;return null==t.which?t.button:t.which}function k(u){var t=location.protocol+"//"+location.hostname;if(location.port){t+=":"+location.port}return 0==u.indexOf(t)}if("undefined"==typeof f){window.page=p}else{f.exports=p}})()},{}],3:[function(f,g,j){var k=f("./model");var r=f("./viewModel");var i=f("./domainViewModel");var s=f("./mixin");var p=f("page");var q=f("./utils");var o=q.extend;var m=q.mixInto;var l=function(){};var h=function(){};var n=function(){};m(l,k.Mixin);m(h,r.Mixin);m(n,i.Mixin);var e={createClass:function(u,v,t){var y=function(){};y.prototype=new u();y.prototype.constructor=y;var x=y;var w=function(z){var A=new x();return A.construct.apply(w,arguments)};w.componentConstructor=y;y.ConvenienceConstructor=w;w.originalSpec=t;w.type=y;y.prototype.type=y;w.classType=v;y.prototype.classType=v;w.getDescriptor=function(){var E={},D=this.prototype,B={},z=[],A={},F={},G=false,C;if("__processedSpec__" in this.originalSpec){return this.originalSpec.__processedSpec__}for(C in this.originalSpec){if(this.originalSpec.hasOwnProperty(C)){if("get" in this.originalSpec[C]||"set" in this.originalSpec[C]){this.originalSpec[C].enumerable=true;if("viewModel" in this.originalSpec[C]){B[C]=this.originalSpec[C].viewModel;delete this.originalSpec[C].viewModel;delete this.originalSpec[C].set}else{if("aliasFor" in this.originalSpec[C]){A[this.originalSpec[C].aliasFor]=C;delete this.originalSpec[C].aliasFor}if("kind" in this.originalSpec[C]){if(this.originalSpec[C].kind==="pseudo"){this.originalSpec[C].enumerable=false}else{if(this.originalSpec[C].kind==="instance"||this.originalSpec[C].kind==="array"){z.push({fieldName:C,kind:this.originalSpec[C].kind})}else{if(this.originalSpec[C].kind==="static"){G=true;F[C]=void (0)}else{if(this.originalSpec[C].kind==="uid"){}else{throw new TypeError('"'+this.originalSpec[C].kind+'" is not a valid "kind" value. Please review field "'+C+'".')}}}}delete this.originalSpec[C].kind}}E[C]=this.originalSpec[C]}else{if(C!=="getInitialState"&&C!=="getWatchedState"&&C!=="getRoutes"){D[C]=this.originalSpec[C]}}}}if(!!Object.keys(B).length){this.originalSpec.getDomainDataContext=function(){return B}}this.originalSpec.__processedSpec__={descriptor:E,proto:D,originalSpec:this.originalSpec||{},freezeFields:z,aliases:A,statics:F,hasStatic:G};return this.originalSpec.__processedSpec__};return w}};g.exports={createModel:e.createClass.bind(this,l,"Model"),createViewModel:e.createClass.bind(this,h,"ViewModel"),createDomainViewModel:e.createClass.bind(this,n,"DomainViewModel"),mixin:s,extend:o,page:p}},{"./domainViewModel":4,"./mixin":5,"./model":6,"./utils":8,"./viewModel":9,page:2}],4:[function(i,h,g){var f=i("./utils");var j=f.extend;var e={Mixin:{construct:function(l){var n=false;var k=false;var o=this.getDescriptor();o.proto.setState=l;o.proto.revert=function(){this.setState(this.previousState,!!this.previousState?this:void (0))};o.proto.advance=function(){if(this.canAdvance){this.setState(this.nextState,this.nextState.nextState)}};var m=function(D,B,v,r,E,w,x,q){var u=o.freezeFields,A=Object.create(o.proto,o.descriptor),t,C=D===void (0),p,y,z,s;w=E?w:false;if(!C){if(E){y=D.forceReplace===void (0)?false:D.forceReplace;z=D.pushState===void (0)?true:D.pushState;s=D.pageNotFound===void (0)?false:D.pageNotFound;Object.defineProperty(A,"pageNotFound",{configurable:false,enumerable:false,writable:false,value:s});Object.defineProperty(A,"forceReplace",{configurable:false,enumerable:true,writable:false,value:y});Object.defineProperty(A,"pushState",{configurable:false,enumerable:true,writable:false,value:z});if(!("path" in A)&&("path" in D)){Object.defineProperty(A,"path",{configurable:false,enumerable:true,writable:false,value:D.path})}}if(D.enableUndo===void (0)){p=false}else{r=D.enableUndo;p=D.enableUndo;if(!D.enableUndo){E=false}}}if(r||E){if(!!B&&(!w||p||s)&&!previousAdhoc&&x&&!q){previousAdhoc=p;k=s;Object.defineProperty(A,"previousState",{configurable:false,enumerable:false,writable:false,value:B});Object.defineProperty(A,"canRevert",{configurable:false,enumerable:false,writable:false,value:true})}else{Object.defineProperty(A,"canRevert",{configurable:false,enumerable:false,writable:false,value:false})}if(!!v&&("state" in v)&&!previousAdhoc&&!k){Object.defineProperty(A,"nextState",{configurable:false,enumerable:false,writable:false,value:v});Object.defineProperty(A,"canAdvance",{configurable:false,enumerable:false,writable:false,value:true})}else{previousAdhoc=p;k=s;Object.defineProperty(A,"canAdvance",{configurable:false,enumerable:false,writable:false,value:false})}}if(C){D=("getInitialState" in o.originalSpec)?o.originalSpec.getInitialState.call(A):{};if("path" in D){Object.defineProperty(A,"path",{configurable:false,enumerable:true,writable:false,value:D.path})}}else{if("state" in D){delete D.state;Object.defineProperty(A,"state",{configurable:true,enumerable:false,writable:true,value:D});D=j(D,A)}}for(t=u.length-1;t>=0;t--){if(u[t].kind==="array"){D[u[t].fieldName]=D[u[t].fieldName]||[];Object.freeze(D[u[t].fieldName])}else{throw new TypeError('kind:"instance" can only be specified in a ViewModel.')}}Object.defineProperty(A,"state",{configurable:false,enumerable:false,writable:false,value:D});return A};return m}}};h.exports=e},{"./utils":8}],5:[function(j,i,h){var f=j("./stateController");var e="__IMVVM__";var g={main:{stateChangeHandler:function(k){this.setState({domainDataContext:k})},getInitialState:function(){var k=f.getInitialState(e,this.props.domainModel,this.stateChangeHandler,this.props.enableUndo);return{domainDataContext:k}}},pushState:{componentDidMount:function(){this.getDOMNode().addEventListener("click",this.onclick)},componentWillUnmount:function(){this.getDOMNode().removeEventListener("click")},which:function(k){k=k||window.event;return null==k.which?k.button:k.which},sameOrigin:function(l){var k=location.protocol+"//"+location.hostname;if(location.port){k+=":"+location.port}return 0==l.indexOf(k)},onclick:function(n){if(1!=this.which(n)){return}if(n.metaKey||n.ctrlKey||n.shiftKey){return}if(n.defaultPrevented){return}var k=n.target;while(k&&"A"!=k.nodeName){k=k.parentNode}if(!k||"A"!=k.nodeName){return}var l=k.getAttribute("href");if(k.pathname==location.pathname&&(k.hash||"#"==l)){return}if(k.target){return}if(!this.sameOrigin(k.href)){return}var m=k.pathname+k.search+(k.hash||"");var o=m+k.hash;n.preventDefault();m=m.replace(IMVVM.page.base(),"");if(IMVVM.page.base()&&o==m||k.href===k.baseURI+k.search+(k.hash||"")){return}IMVVM.page.show(o)}},mediaQuery:{closureFunc:function(m,k,l){(function(){this.state.domainDataContext.mediaChangeHandler.call(this.state.domainDataContext,m,k,l)}.bind(this))()},componentDidMount:function(){var p=document.styleSheets;var l=p.length;var o=true;var r,s,q,k;for(var n=0;n<l;n+=1){r=p[n].cssRules;s=r.length;for(var m=0;m<s;m+=1){if(r[m].constructor===CSSMediaRule){if(!!r[m].cssRules.length){k=r[m].cssRules[0].selectorText.split("#");if(k.length===2&&k[0]===".media"){q=window.matchMedia(r[m].media.mediaText);q.addListener(this.closureFunc.bind(this,k[1]));if(o){this.closureFunc(k[1],q,o)}else{this.closureFunc(q)}}}}}}}}};i.exports=g},{"./stateController":7}],6:[function(h,g,f){var e=h("./utils");var j=e.extend;var i={Mixin:{construct:function(k){var m=this.getDescriptor();var l=function(r,p,n){var s=m.freezeFields,q,o=Object.create(m.proto,m.descriptor);if(r===void (0)){n=true}else{if(typeof r==="boolean"){n=r;r=void (0)}else{if(typeof p==="boolean"){n=p;p=void (0)}}}r=j(r,p);Object.defineProperty(o,"state",{configurable:true,enumerable:false,writable:true,value:r});r=j(r,o);if(n){for(var t in m.aliases){if(m.aliases.hasOwnProperty(t)&&t in r){r[m.aliases[t]]=r[t];delete r[t]}}Object.defineProperty(o,"state",{configurable:true,enumerable:false,writable:true,value:r});r=j(r,o);if("getInitialState" in m.originalSpec){r=j(r,m.originalSpec.getInitialState.call(o))}}for(q=s.length-1;q>=0;q--){if(s[q].kind==="array"){r[s[q].fieldName]=r[s[q].fieldName]||[];Object.freeze(r[s[q].fieldName])}else{throw new TypeError('kind:"instance" can only be specified in a ViewModel.')}}Object.defineProperty(o,"state",{configurable:false,enumerable:false,writable:false,value:r});o.__stateChangeHandler=(function(){return k})();return Object.freeze(o)};return l}}};g.exports=i},{"./utils":8}],7:[function(i,h,f){var j=i("page");var e=i("./utils");var k=e.extend;var g=e.updateStatic;f.getInitialState=function(p,q,F,o){if(typeof F!=="function"){throw new TypeError("stateChangeHandler must be a function.")}if(o===void (0)){o=false}var L,B={},w={},C=false,x={},M,n={},H={},z,v={},t={},G,E,I,y,u,m=false,K=false,D={},J={},l,s=false,A=false;var r=function(ac,N,O,ad,S){var V={},T=void (0),ag=void (0),X,U,Q,W,Y,af=[],aa,ab,R,Z,P=false;if(arguments.length<2){N=B}if(typeof ad==="function"){S=ad;ad=false}else{if(typeof O==="function"){S=O;O={}}else{if(typeof O==="boolean"){ad=O;O={}}}}if(ad===void (0)){ad=false}N=N||{};X=Object.keys(N);if(Object.getPrototypeOf(N).constructor.classType==="DomainViewModel"){V=k(N,w);T=N.previousState;ag=O;for(W in M){V[W]=new x[W](V[W])}for(W in M){if(M.hasOwnProperty(W)){for(Y in n[W]){if(n[W].hasOwnProperty(Y)){V[W].state[n[W][Y]]=(Y in M)?k(V[Y].state):V[Y]}}}}if(typeof S==="function"){try{B=new L(V,T,ag,o,K,V.path!==B.path,!s||V.pageNotFound,ad);m=true;S(void (0),B)}catch(ae){S(ae)}return}}else{if(C){w=g(w,N)}if(!!X.length){if(ac===p){V=k(N)}else{V[ac]=k(N)}}v=k(V,v,O);transientStateKeys=Object.keys(v);if(transientStateKeys.length===0){return}Q=transientStateKeys.length-1;for(U=Q;U>=0;U--){if(transientStateKeys[U] in M){V[transientStateKeys[U]]=k(B[transientStateKeys[U]],v[transientStateKeys[U]]);V[transientStateKeys[U]]=new x[transientStateKeys[U]](V[transientStateKeys[U]])}else{V[transientStateKeys[U]]=v[transientStateKeys[U]]}}t=k(t,V);V=k(B,t);v={};for(U=Q;U>=0;U--){if(transientStateKeys[U] in H){for(ab in H[transientStateKeys[U]]){if(H[transientStateKeys[U]].hasOwnProperty(ab)){if(X.indexOf(ab)!==-1){R=H[transientStateKeys[U]][ab];for(Z in R){if(R.hasOwnProperty(Z)){if(Z in n){for(W in n[Z]){if(n[Z].hasOwnProperty(W)){V[Z].state[n[Z][W]]=(W in M)?k(V[W].state):V[W]}if(W in n){for(dataContext2 in n[W]){if(n[W].hasOwnProperty(dataContext2)){V[W].state[n[W][dataContext2]]=(dataContext2 in M)?k(V[dataContext2].state):V[dataContext2]}}}}}v=k(v,R[Z].call(B[Z],V[transientStateKeys[U]][ab],B[transientStateKeys[U]][ab],ab,transientStateKeys[U],V.path,B.path))}}}}}}}if(!!Object.keys(v).length){r(void (0),{},v,ad,S);return}af=Object.keys(t);aa=af.length-1;for(U=aa;U>=0;U--){if(ac===p&&(p in n)){if(af[U] in n[p]){for(W in n[p][af[U]]){if(n[p][af[U]].hasOwnProperty(W)){V[W].state[n[p][af[U]][W]]=V[af[U]]}if(W in n){for(dataContext2 in n[W]){if(n[W].hasOwnProperty(dataContext2)){V[W].state[n[W][dataContext2]]=(dataContext2 in M)?k(V[dataContext2].state):V[dataContext2]}}}}}}else{if(af[U] in n){for(W in n[af[U]]){if(n[af[U]].hasOwnProperty(W)){V[af[U]].state[n[af[U]][W]]=V[W]}if(W in n){for(dataContext2 in n[W]){if(n[W].hasOwnProperty(dataContext2)){V[W].state[n[W][dataContext2]]=V[dataContext2]}}}}}}}if(B.canRevert&&m){T=B.previousState}else{if(C&&w._staticUpdated&&w._onlyStatic){if(B.canRevert){T=B.previousState}if(B.canAdvance){ag=B.nextState}}else{T=B}}}if(!!T){Object.freeze(T)}P=V.path!==B.path;try{V=k(V,{dataContextWillUpdate:t});B=new L(V,T,ag,o,K,P,!s||V.pageNotFound,ad);Object.freeze(B);Object.freeze(B.state);if(typeof S==="function"){m=true;S(void (0),B);return}}catch(ae){if(typeof S==="function"){S(ae);return}}m=false;v={};t={};F(B);if(K&&B.pushState){if(("path" in B)&&!s){A=true;if(P&&!B.forceReplace){j(B.path)}else{j.replace(B.path)}}s=false}};L=q.call(this,r.bind(this,p));B=new L(void (0),void (0),void (0),o,K);B.state=B.state||{};M=B.constructor.originalSpec.getDomainDataContext();delete B.constructor.originalSpec.getDomainDataContext;for(z in M){if(M.hasOwnProperty(z)){x[z]=M[z].call(this,r.bind(this,z));B.state[z]=new x[z](B.state[z],true)}}for(z in M){if(M.hasOwnProperty(z)){if("getWatchedState" in B[z].constructor.originalSpec){G=B[z].constructor.originalSpec.getWatchedState();for(E in G){if(G.hasOwnProperty(E)){if(E in M||E in B){if("alias" in G[E]){if(!(z in n)){n[z]={}}n[z][E]=G[E].alias;if(!(E in M)){if(!(p in n)){n[p]={}}if(!(z in n[p])){n[p][E]={}}n[p][E][z]=G[E].alias}}for(I in G[E].fields){if(G[E].fields.hasOwnProperty(I)){if(E in M){y={};if(!(E in H)){H[E]={}}y[I]={};y[I][z]=G[E].fields[I];H[E]=y}}}}}}}}}for(z in M){if(M.hasOwnProperty(z)){for(u in n[z]){if(n[z].hasOwnProperty(u)){B[z].state[n[z][u]]=B[u]}}}}for(z in M){if(M.hasOwnProperty(z)){B.state[z]=new x[z](B.state[z]);if("getRoutes" in B[z].constructor.originalSpec){K=true;D=B[z].constructor.originalSpec.getRoutes();for(l in D){if(D.hasOwnProperty(l)){J[D[l].path]=D[l].handler;j(D[l].path,function(Q,P,N,O){s=true;if(!A){if(B.canRevert&&B.pageNotFound){O.rollbackRequest=true;O.revert=function(){this.revert.bind(this);this.setState({},{path:O.path})}.bind(B)}J[P].call(B[Q],O.params,O.path,N,O)}A=false}.bind(this,z,D[l].path,l))}}delete B[z].constructor.originalSpec.getRoutes}}}B=new L(B,void (0),void (0),o,K);if(K){j(function(N){s=true;B.setState({pageNotFound:true});A=false});A=true;j.replace(B.path);j.start({click:false,dispatch:false});s=false}C=B.constructor.originalSpec.__processedSpec__.hasStatic;if(C){w=g(B.constructor.originalSpec.__processedSpec__.statics,B.state)}if("dataContextWillInitialize" in B.constructor.originalSpec){B.constructor.originalSpec.dataContextWillInitialize.call(B);delete B.constructor.originalSpec.dataContextWillInitialize}for(z in M){if(M.hasOwnProperty(z)){if("dataContextWillInitialize" in B[z].constructor.originalSpec){B[z].constructor.originalSpec.dataContextWillInitialize.call(B[z]);delete B[z].constructor.originalSpec.dataContextWillInitialize}}}Object.freeze(B.state);Object.freeze(B);return B}},{"./utils":8,page:2}],8:[function(h,g,f){var e={extend:function(){var j={};for(var l=0;l<arguments.length;l++){var m=arguments[l];for(var k in m){if(m.hasOwnProperty(k)){j[k]=m[k]}}}return j},updateStatic:function(){var j={};Object.defineProperty(j,"_onlyStatic",{configurable:false,enumerable:false,writable:true,value:true});Object.defineProperty(j,"_staticUpdated",{configurable:false,enumerable:false,writable:true,value:false});for(var l=0;l<arguments.length;l++){var m=arguments[l];for(var k in m){if(m.hasOwnProperty(k)&&k in arguments[0]){if(k in arguments[0]){j[k]=m[k];if(l>0){j._staticUpdated=true}}else{j._onlyStatic=false}}}}return j},mixInto:function(j,k){var i;for(i in k){if(!k.hasOwnProperty(i)){continue}j.prototype[i]=k[i]}}};g.exports=e},{}],9:[function(i,h,f){var e=i("./utils");var j=e.extend;var g={Mixin:{construct:function(l){var m=this.getDescriptor(this);m.proto.setState=l;var k=function(r,n){r=r||{};r=("state" in r?r.state:r);var s=m.freezeFields,q,p=Object.create(m.proto,m.descriptor),t,o;Object.defineProperty(p,"state",{configurable:true,enumerable:false,writable:true,value:r});if(n){r=("getInitialState" in m.originalSpec)?j(r,m.originalSpec.getInitialState.call(p)):r;Object.defineProperty(p,"state",{configurable:true,enumerable:false,writable:true,value:r})}for(q=s.length-1;q>=0;q--){if(s[q].kind==="instance"){if(p[s[q].fieldName]){t=p[s[q].fieldName].constructor.originalSpec.__processedSpec__;o=Object.create(t.proto,t.descriptor);o.__stateChangeHandler=(function(u){return p[u].__stateChangeHandler})(s[q].fieldName);Object.defineProperty(o,"state",{configurable:true,enumerable:false,writable:true,value:p[s[q].fieldName].state});o.__proto__.setState=function(u,v){this.__stateChangeHandler.call(p,j(this.state,u),v)};Object.freeze(p[s[q].fieldName])}}else{r[s[q].fieldName]=r[s[q].fieldName]||[];Object.freeze(r[s[q].fieldName])}}Object.defineProperty(p,"state",{configurable:false,enumerable:false,writable:false,value:r});return Object.freeze(p)};return k}}};h.exports=g},{"./utils":8}]},{},[1])(1)});
!function(b){if("object"==typeof exports){module.exports=b()}else{if("function"==typeof define&&define.amd){define(b)}else{var a;"undefined"!=typeof window?a=window:"undefined"!=typeof global?a=global:"undefined"!=typeof self&&(a=self),a.IMVVM=b()}}}(function(){var d,b,a;return(function c(f,k,h){function g(n,l){if(!k[n]){if(!f[n]){var i=typeof require=="function"&&require;if(!l&&i){return i(n,!0)}if(e){return e(n,!0)}throw new Error("Cannot find module '"+n+"'")}var m=k[n]={exports:{}};f[n][0].call(m.exports,function(o){var p=f[n][1][o];return g(p?p:o)},m,m.exports,c,f,k,h)}return k[n].exports}var e=typeof require=="function"&&require;for(var j=0;j<h.length;j++){g(h[j])}return g})({1:[function(h,g,f){var e=h("./src/core.js");g.exports=e},{"./src/core.js":3}],2:[function(g,f,e){(function(){var o=true;var h="";var l;function p(w,v){if("function"==typeof w){return p("*",w)}if("function"==typeof v){var t=new m(w);for(var u=1;u<arguments.length;++u){p.callbacks.push(t.middleware(arguments[u]))}}else{if("string"==typeof w){p.show(w,v)}else{p.start(w)}}}p.callbacks=[];p.base=function(t){if(0==arguments.length){return h}h=t};p.start=function(u){u=u||{};if(l){return}l=true;if(false===u.dispatch){o=false}if(false!==u.popstate){window.addEventListener("popstate",q,false)}if(false!==u.click){window.addEventListener("click",s,false)}if(!o){return}var t=location.pathname+location.search+location.hash;p.replace(t,null,true,o)};p.stop=function(){l=false;removeEventListener("click",s,false);removeEventListener("popstate",q,false)};p.show=function(w,v,u){var t=new r(w,v);if(false!==u){p.dispatch(t)}if(!t.unhandled){t.pushState()}return t};p.replace=function(w,v,x,u){var t=new r(w,v);t.init=x;if(null==u){u=true}if(u){p.dispatch(t)}t.save();return t};p.dispatch=function(t){var u=0;function v(){var w=p.callbacks[u++];if(!w){return j(t)}w(t,v)}v()};function j(t){var u=window.location.pathname+window.location.search;if(u==t.canonicalPath){return}p.stop();t.unhandled=true;window.location=t.canonicalPath}function r(w,u){if("/"==w[0]&&0!=w.indexOf(h)){w=h+w}var t=w.indexOf("?");this.canonicalPath=w;this.path=w.replace(h,"")||"/";this.title=document.title;this.state=u||{};this.state.path=w;this.querystring=~t?w.slice(t+1):"";this.pathname=~t?w.slice(0,t):w;this.params=[];this.hash="";if(!~this.path.indexOf("#")){return}var v=this.path.split("#");this.path=v[0];this.hash=v[1]||"";this.querystring=this.querystring.split("#")[0]}p.Context=r;r.prototype.pushState=function(){history.pushState(this.state,this.title,this.canonicalPath)};r.prototype.save=function(){history.replaceState(this.state,this.title,this.canonicalPath)};function m(u,t){t=t||{};this.path=u;this.method="GET";this.regexp=n(u,this.keys=[],t.sensitive,t.strict)}p.Route=m;m.prototype.middleware=function(u){var t=this;return function(v,w){if(t.match(v.path,v.params)){return u(v,w)}w()}};m.prototype.match=function(B,w){var A=this.keys,C=B.indexOf("?"),t=~C?B.slice(0,C):B,v=this.regexp.exec(t);if(!v){return false}for(var x=1,y=v.length;x<y;++x){var z=A[x-1];var u="string"==typeof v[x]?decodeURIComponent(v[x]):v[x];if(z){w[z.name]=undefined!==w[z.name]?w[z.name]:u}else{w.push(u)}}return true};function n(w,v,u,t){if(w instanceof RegExp){return w}if(w instanceof Array){w="("+w.join("|")+")"}w=w.concat(t?"":"/?").replace(/\/\(/g,"(?:/").replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g,function(z,B,C,A,x,y){v.push({name:A,optional:!!y});B=B||"";return""+(y?"":B)+"(?:"+(y?B:"")+(C||"")+(x||(C&&"([^/.]+?)"||"([^/]+?)"))+")"+(y||"")}).replace(/([\/.])/g,"\\$1").replace(/\*/g,"(.*)");return new RegExp("^"+w+"$",u?"":"i")}function q(u){if(u.state){var t=u.state.path;p.replace(t,u.state)}}function s(w){if(1!=i(w)){return}if(w.metaKey||w.ctrlKey||w.shiftKey){return}if(w.defaultPrevented){return}var t=w.target;while(t&&"A"!=t.nodeName){t=t.parentNode}if(!t||"A"!=t.nodeName){return}var u=t.getAttribute("href");if(t.pathname==location.pathname&&(t.hash||"#"==u)){return}if(t.target){return}if(!k(t.href)){return}var v=t.pathname+t.search+(t.hash||"");var x=v+t.hash;v=v.replace(h,"");if(h&&x==v){return}w.preventDefault();p.show(x)}function i(t){t=t||window.event;return null==t.which?t.button:t.which}function k(u){var t=location.protocol+"//"+location.hostname;if(location.port){t+=":"+location.port}return 0==u.indexOf(t)}if("undefined"==typeof f){window.page=p}else{f.exports=p}})()},{}],3:[function(f,g,j){var k=f("./model");var r=f("./viewModel");var i=f("./domainViewModel");var s=f("./mixin");var p=f("page");var q=f("./utils");var o=q.extend;var m=q.mixInto;var l=function(){};var h=function(){};var n=function(){};m(l,k.Mixin);m(h,r.Mixin);m(n,i.Mixin);var e={createClass:function(u,v,t){var y=function(){};y.prototype=new u();y.prototype.constructor=y;var x=y;var w=function(z){var A=new x();return A.construct.apply(w,arguments)};w.componentConstructor=y;y.ConvenienceConstructor=w;w.originalSpec=t;w.type=y;y.prototype.type=y;w.classType=v;y.prototype.classType=v;w.getDescriptor=function(){var E={},D=this.prototype,B={},z=[],A={},F={},G=false,C;if("__processedSpec__" in this.originalSpec){return this.originalSpec.__processedSpec__}for(C in this.originalSpec){if(this.originalSpec.hasOwnProperty(C)){if("get" in this.originalSpec[C]||"set" in this.originalSpec[C]){this.originalSpec[C].enumerable=true;if("viewModel" in this.originalSpec[C]){B[C]=this.originalSpec[C].viewModel;delete this.originalSpec[C].viewModel;delete this.originalSpec[C].set}else{if("aliasFor" in this.originalSpec[C]){A[this.originalSpec[C].aliasFor]=C;delete this.originalSpec[C].aliasFor}if("kind" in this.originalSpec[C]){if(this.originalSpec[C].kind==="pseudo"){this.originalSpec[C].enumerable=false}else{if(this.originalSpec[C].kind==="instance"||this.originalSpec[C].kind==="array"){z.push({fieldName:C,kind:this.originalSpec[C].kind})}else{if(this.originalSpec[C].kind==="static"){G=true;F[C]=void (0)}else{if(this.originalSpec[C].kind==="uid"){}else{throw new TypeError('"'+this.originalSpec[C].kind+'" is not a valid "kind" value. Please review field "'+C+'".')}}}}delete this.originalSpec[C].kind}}E[C]=this.originalSpec[C]}else{if(C!=="getInitialState"&&C!=="getWatchedState"&&C!=="getRoutes"){D[C]=this.originalSpec[C]}}}}if(!!Object.keys(B).length){this.originalSpec.getDomainDataContext=function(){return B}}this.originalSpec.__processedSpec__={descriptor:E,proto:D,originalSpec:this.originalSpec||{},freezeFields:z,aliases:A,statics:F,hasStatic:G};return this.originalSpec.__processedSpec__};return w}};g.exports={createModel:e.createClass.bind(this,l,"Model"),createViewModel:e.createClass.bind(this,h,"ViewModel"),createDomainViewModel:e.createClass.bind(this,n,"DomainViewModel"),mixin:s,extend:o,page:p}},{"./domainViewModel":4,"./mixin":5,"./model":6,"./utils":8,"./viewModel":9,page:2}],4:[function(i,h,g){var f=i("./utils");var j=f.extend;var e={Mixin:{construct:function(l){var n=false;var k=false;var o=this.getDescriptor();o.proto.setState=l;o.proto.revert=function(){this.setState(this.previousState,!!this.previousState?this:void (0))};o.proto.advance=function(){if(this.canAdvance){this.setState(this.nextState,this.nextState.nextState)}};var m=function(D,B,v,r,E,w,x,q){var u=o.freezeFields,A=Object.create(o.proto,o.descriptor),t,C=D===void (0),p,y,z,s;w=E?w:false;if(!C){if(E){y=D.forceReplace===void (0)?false:D.forceReplace;z=D.pushState===void (0)?true:D.pushState;s=D.pageNotFound===void (0)?false:D.pageNotFound;Object.defineProperty(A,"pageNotFound",{configurable:false,enumerable:false,writable:false,value:s});Object.defineProperty(A,"forceReplace",{configurable:false,enumerable:true,writable:false,value:y});Object.defineProperty(A,"pushState",{configurable:false,enumerable:true,writable:false,value:z});if(!("path" in A)&&("path" in D)){Object.defineProperty(A,"path",{configurable:false,enumerable:true,writable:false,value:D.path})}}if(D.enableUndo===void (0)){p=false}else{r=D.enableUndo;p=D.enableUndo;if(!D.enableUndo){E=false}}}if(r||E){if(!!B&&(!w||p||s)&&!previousAdhoc&&x&&!q){previousAdhoc=p;k=s;Object.defineProperty(A,"previousState",{configurable:false,enumerable:false,writable:false,value:B});Object.defineProperty(A,"canRevert",{configurable:false,enumerable:false,writable:false,value:true})}else{Object.defineProperty(A,"canRevert",{configurable:false,enumerable:false,writable:false,value:false})}if(!!v&&("state" in v)&&!previousAdhoc&&!k){Object.defineProperty(A,"nextState",{configurable:false,enumerable:false,writable:false,value:v});Object.defineProperty(A,"canAdvance",{configurable:false,enumerable:false,writable:false,value:true})}else{previousAdhoc=p;k=s;Object.defineProperty(A,"canAdvance",{configurable:false,enumerable:false,writable:false,value:false})}}if(C){D=("getInitialState" in o.originalSpec)?o.originalSpec.getInitialState.call(A):{};if("path" in D){Object.defineProperty(A,"path",{configurable:false,enumerable:true,writable:false,value:D.path})}}else{if("state" in D){delete D.state;Object.defineProperty(A,"state",{configurable:true,enumerable:false,writable:true,value:D});D=j(D,A)}}for(t=u.length-1;t>=0;t--){if(u[t].kind==="array"){D[u[t].fieldName]=D[u[t].fieldName]||[];Object.freeze(D[u[t].fieldName])}else{throw new TypeError('kind:"instance" can only be specified in a ViewModel.')}}Object.defineProperty(A,"state",{configurable:false,enumerable:false,writable:false,value:D});return A};return m}}};h.exports=e},{"./utils":8}],5:[function(j,i,h){var f=j("./stateController");var e="__IMVVM__";var g={main:{stateChangeHandler:function(k){this.setState({domainDataContext:k})},getInitialState:function(){var k=f.getInitialState(e,this.props.domainModel,this.stateChangeHandler,this.props.enableUndo);return{domainDataContext:k}}},pushState:{componentDidMount:function(){this.getDOMNode().addEventListener("click",this.onclick)},componentWillUnmount:function(){this.getDOMNode().removeEventListener("click")},which:function(k){k=k||window.event;return null==k.which?k.button:k.which},sameOrigin:function(l){var k=location.protocol+"//"+location.hostname;if(location.port){k+=":"+location.port}return 0==l.indexOf(k)},onclick:function(n){if(1!=this.which(n)){return}if(n.metaKey||n.ctrlKey||n.shiftKey){return}if(n.defaultPrevented){return}var k=n.target;while(k&&"A"!=k.nodeName){k=k.parentNode}if(!k||"A"!=k.nodeName){return}var l=k.getAttribute("href");if(k.pathname==location.pathname&&(k.hash||"#"==l)){return}if(k.target){return}if(!this.sameOrigin(k.href)){return}var m=k.pathname+k.search+(k.hash||"");var o=m+k.hash;n.preventDefault();m=m.replace(IMVVM.page.base(),"");if(IMVVM.page.base()&&o==m||k.href===k.baseURI+k.search+(k.hash||"")){return}IMVVM.page.show(o)}},mediaQuery:{closureFunc:function(m,k,l){(function(){this.state.domainDataContext.mediaChangeHandler.call(this.state.domainDataContext,m,k,l)}.bind(this))()},componentDidMount:function(){var p=document.styleSheets;var l=p.length;var o=true;var r,s,q,k;for(var n=0;n<l;n+=1){r=p[n].cssRules;s=r.length;for(var m=0;m<s;m+=1){if(r[m].constructor===CSSMediaRule){if(!!r[m].cssRules.length){k=r[m].cssRules[0].selectorText.split("#");if(k.length===2&&k[0]===".media"){q=window.matchMedia(r[m].media.mediaText);q.addListener(this.closureFunc.bind(this,k[1]));if(o){this.closureFunc(k[1],q,o)}else{this.closureFunc(q)}}}}}}}}};i.exports=g},{"./stateController":7}],6:[function(h,g,f){var e=h("./utils");var j=e.extend;var i={Mixin:{construct:function(k){var m=this.getDescriptor();var l=function(r,p,n){var s=m.freezeFields,q,o=Object.create(m.proto,m.descriptor);if(r===void (0)){n=true}else{if(typeof r==="boolean"){n=r;r=void (0)}else{if(typeof p==="boolean"){n=p;p=void (0)}}}r=j(r,p);Object.defineProperty(o,"state",{configurable:true,enumerable:false,writable:true,value:r});r=j(r,o);if(n){for(var t in m.aliases){if(m.aliases.hasOwnProperty(t)&&t in r){r[m.aliases[t]]=r[t];delete r[t]}}Object.defineProperty(o,"state",{configurable:true,enumerable:false,writable:true,value:r});r=j(r,o);if("getInitialState" in m.originalSpec){r=j(r,m.originalSpec.getInitialState.call(o))}}for(q=s.length-1;q>=0;q--){if(s[q].kind==="array"){r[s[q].fieldName]=r[s[q].fieldName]||[];Object.freeze(r[s[q].fieldName])}else{throw new TypeError('kind:"instance" can only be specified in a ViewModel.')}}Object.defineProperty(o,"state",{configurable:false,enumerable:false,writable:false,value:r});Object.defineProperty(o,"__stateChangeHandler",{configurable:false,enumerable:false,writable:false,value:(function(){return k})()});return Object.freeze(o)};return l}}};g.exports=i},{"./utils":8}],7:[function(i,h,f){var j=i("page");var e=i("./utils");var k=e.extend;var g=e.updateStatic;f.getInitialState=function(p,q,F,o){if(typeof F!=="function"){throw new TypeError("stateChangeHandler must be a function.")}if(o===void (0)){o=false}var L,B={},w={},C=false,x={},M,n={},H={},z,v={},t={},G,E,I,y,u,m=false,K=false,D={},J={},l,s=false,A=false;var r=function(ad,N,O,ae,T){var W={},U=void (0),ah=void (0),Y,V,Q,X,Z,ag=[],ab,ac,R,aa,P=false,S=false;if(arguments.length<2){N=B}if(typeof ae==="function"){T=ae;ae=false}else{if(typeof O==="function"){T=O;O={}}else{if(typeof O==="boolean"){ae=O;O={}}}}if(ae===void (0)){ae=false}N=N||{};Y=Object.keys(N);if(Object.getPrototypeOf(N).constructor.classType==="DomainViewModel"){S=true;W=k(N,w);U=N.previousState;ah=O;for(X in M){W[X]=new x[X](W[X])}for(X in M){if(M.hasOwnProperty(X)){for(Z in n[X]){if(n[X].hasOwnProperty(Z)){W[X].state[n[X][Z]]=(Z in M)?k(W[Z].state):W[Z]}}}}if(typeof T==="function"){try{B=new L(W,U,ah,o,K,W.path!==B.path,!s||W.pageNotFound,ae);m=true;T(void (0),B)}catch(af){T(af)}return}}else{if(C){w=g(w,N)}if(!!Y.length){if(ad===p){W=k(N)}else{W[ad]=k(N)}}v=k(W,v,O);transientStateKeys=Object.keys(v);if(transientStateKeys.length===0){return}Q=transientStateKeys.length-1;for(V=Q;V>=0;V--){if(transientStateKeys[V] in M){W[transientStateKeys[V]]=k(B[transientStateKeys[V]],v[transientStateKeys[V]]);W[transientStateKeys[V]]=new x[transientStateKeys[V]](W[transientStateKeys[V]])}else{W[transientStateKeys[V]]=v[transientStateKeys[V]]}}t=k(t,W);W=k(B,t);v={};for(V=Q;V>=0;V--){if(transientStateKeys[V] in H){for(ac in H[transientStateKeys[V]]){if(H[transientStateKeys[V]].hasOwnProperty(ac)){if(Y.indexOf(ac)!==-1){R=H[transientStateKeys[V]][ac];for(aa in R){if(R.hasOwnProperty(aa)){if(aa in n){for(X in n[aa]){if(n[aa].hasOwnProperty(X)){W[aa].state[n[aa][X]]=(X in M)?k(W[X].state):W[X]}if(X in n){for(dataContext2 in n[X]){if(n[X].hasOwnProperty(dataContext2)){W[X].state[n[X][dataContext2]]=(dataContext2 in M)?k(W[dataContext2].state):W[dataContext2]}}}}}v=k(v,R[aa].call(B[aa],W[transientStateKeys[V]][ac],B[transientStateKeys[V]][ac],ac,transientStateKeys[V],W.path,B.path))}}}}}}}if(!!Object.keys(v).length){r(void (0),{},v,ae,T);return}ag=Object.keys(t);ab=ag.length-1;for(V=ab;V>=0;V--){if(ad===p&&(p in n)){if(ag[V] in n[p]){for(X in n[p][ag[V]]){if(n[p][ag[V]].hasOwnProperty(X)){W[X].state[n[p][ag[V]][X]]=W[ag[V]]}if(X in n){for(dataContext2 in n[X]){if(n[X].hasOwnProperty(dataContext2)){W[X].state[n[X][dataContext2]]=(dataContext2 in M)?k(W[dataContext2].state):W[dataContext2]}}}}}}else{if(ag[V] in n){for(X in n[ag[V]]){if(n[ag[V]].hasOwnProperty(X)){W[ag[V]].state[n[ag[V]][X]]=W[X]}if(X in n){for(dataContext2 in n[X]){if(n[X].hasOwnProperty(dataContext2)){W[X].state[n[X][dataContext2]]=W[dataContext2]}}}}}}}if(B.canRevert&&m){U=B.previousState}else{if(C&&w._staticUpdated&&w._onlyStatic){if(B.canRevert){U=B.previousState}if(B.canAdvance){ah=B.nextState}}else{U=B}}}if(!!U){Object.freeze(U)}P=W.path!==B.path;try{if(S){W=k(W,{dataContextWillUpdate:N.state.dataContextWillUpdate})}else{W=k(W,{dataContextWillUpdate:t})}B=new L(W,U,ah,o,K,P,!s||W.pageNotFound,ae);Object.freeze(B);Object.freeze(B.state);if(typeof T==="function"){m=true;T(void (0),B);return}}catch(af){if(typeof T==="function"){T(af);return}}m=false;v={};t={};F(B);if(K&&B.pushState){if(("path" in B)&&!s){A=true;if(P&&!B.forceReplace){j(B.path)}else{j.replace(B.path)}}s=false}};L=q.call(this,r.bind(this,p));B=new L(void (0),void (0),void (0),o,K);B.state=B.state||{};M=B.constructor.originalSpec.getDomainDataContext();delete B.constructor.originalSpec.getDomainDataContext;for(z in M){if(M.hasOwnProperty(z)){x[z]=M[z].call(this,r.bind(this,z));B.state[z]=new x[z](B.state[z],true)}}for(z in M){if(M.hasOwnProperty(z)){if("getWatchedState" in B[z].constructor.originalSpec){G=B[z].constructor.originalSpec.getWatchedState();for(E in G){if(G.hasOwnProperty(E)){if(E in M||E in B){if("alias" in G[E]){if(!(z in n)){n[z]={}}n[z][E]=G[E].alias;if(!(E in M)){if(!(p in n)){n[p]={}}if(!(z in n[p])){n[p][E]={}}n[p][E][z]=G[E].alias}}for(I in G[E].fields){if(G[E].fields.hasOwnProperty(I)){if(E in M){y={};if(!(E in H)){H[E]={}}y[I]={};y[I][z]=G[E].fields[I];H[E]=y}}}}}}}}}for(z in M){if(M.hasOwnProperty(z)){for(u in n[z]){if(n[z].hasOwnProperty(u)){B[z].state[n[z][u]]=B[u]}}}}for(z in M){if(M.hasOwnProperty(z)){B.state[z]=new x[z](B.state[z]);if("getRoutes" in B[z].constructor.originalSpec){K=true;D=B[z].constructor.originalSpec.getRoutes();for(l in D){if(D.hasOwnProperty(l)){J[D[l].path]=D[l].handler;j(D[l].path,function(Q,P,N,O){s=true;if(!A){if(B.canRevert&&B.pageNotFound){O.rollbackRequest=true;O.revert=function(){this.revert.bind(this);this.setState({},{path:O.path})}.bind(B)}J[P].call(B[Q],O.params,O.path,N,O)}A=false}.bind(this,z,D[l].path,l))}}delete B[z].constructor.originalSpec.getRoutes}}}B=new L(B,void (0),void (0),o,K);if(K){j(function(N){s=true;B.setState({pageNotFound:true});A=false});A=true;j.replace(B.path);j.start({click:false,dispatch:false});s=false}C=B.constructor.originalSpec.__processedSpec__.hasStatic;if(C){w=g(B.constructor.originalSpec.__processedSpec__.statics,B.state)}if("dataContextWillInitialize" in B.constructor.originalSpec){B.constructor.originalSpec.dataContextWillInitialize.call(B);delete B.constructor.originalSpec.dataContextWillInitialize}for(z in M){if(M.hasOwnProperty(z)){if("dataContextWillInitialize" in B[z].constructor.originalSpec){B[z].constructor.originalSpec.dataContextWillInitialize.call(B[z]);delete B[z].constructor.originalSpec.dataContextWillInitialize}}}Object.freeze(B.state);Object.freeze(B);return B}},{"./utils":8,page:2}],8:[function(h,g,f){var e={extend:function(){var j={};for(var l=0;l<arguments.length;l++){var m=arguments[l];for(var k in m){if(m.hasOwnProperty(k)){j[k]=m[k]}}}return j},updateStatic:function(){var j={};Object.defineProperty(j,"_onlyStatic",{configurable:false,enumerable:false,writable:true,value:true});Object.defineProperty(j,"_staticUpdated",{configurable:false,enumerable:false,writable:true,value:false});for(var l=0;l<arguments.length;l++){var m=arguments[l];for(var k in m){if(m.hasOwnProperty(k)&&k in arguments[0]){if(k in arguments[0]){j[k]=m[k];if(l>0){j._staticUpdated=true}}else{j._onlyStatic=false}}}}return j},mixInto:function(j,k){var i;for(i in k){if(!k.hasOwnProperty(i)){continue}j.prototype[i]=k[i]}}};g.exports=e},{}],9:[function(i,h,f){var e=i("./utils");var j=e.extend;var g={Mixin:{construct:function(l){var m=this.getDescriptor(this);m.proto.setState=l;var k=function(r,n){r=r||{};r=("state" in r?r.state:r);var s=m.freezeFields,q,p=Object.create(m.proto,m.descriptor),t,o;Object.defineProperty(p,"state",{configurable:true,enumerable:false,writable:true,value:r});if(n){r=("getInitialState" in m.originalSpec)?j(r,m.originalSpec.getInitialState.call(p)):r;Object.defineProperty(p,"state",{configurable:true,enumerable:false,writable:true,value:r})}for(q=s.length-1;q>=0;q--){if(s[q].kind==="instance"){if(p[s[q].fieldName]){t=p[s[q].fieldName].constructor.originalSpec.__processedSpec__;o=Object.create(t.proto,t.descriptor);Object.defineProperty(o,"__stateChangeHandler",{configurable:false,enumerable:false,writable:false,value:(function(u){return p[u].__stateChangeHandler})(s[q].fieldName)});Object.defineProperty(o,"state",{configurable:true,enumerable:false,writable:true,value:p[s[q].fieldName].state});o.__proto__.setState=function(u,v){this.__stateChangeHandler.call(p,j(this.state,u),v)};Object.freeze(p[s[q].fieldName])}}else{r[s[q].fieldName]=r[s[q].fieldName]||[];Object.freeze(r[s[q].fieldName])}}Object.defineProperty(p,"state",{configurable:false,enumerable:false,writable:false,value:r});return Object.freeze(p)};return k}}};h.exports=g},{"./utils":8}]},{},[1])(1)});
{
"name": "imvvm",
"description": "Immutable MVVM for React",
"version": "0.8.6",
"version": "0.8.7",
"keywords": [

@@ -6,0 +6,0 @@ "react",

@@ -74,6 +74,11 @@

});
model.__stateChangeHandler = (function(){
Object.defineProperty(model, '__stateChangeHandler', {
configurable: false,
enumerable: false,
writable: false,
value: (function(){
return stateChangeHandler;
})();
})()
});

@@ -80,0 +85,0 @@ return Object.freeze(model);

@@ -55,3 +55,4 @@ var page = require('page');

subscriber,
pushStateChanged = false;
pushStateChanged = false,
willUndo = false;

@@ -84,3 +85,3 @@ if(arguments.length < 2){

if(Object.getPrototypeOf(newState).constructor.classType === "DomainViewModel") {
willUndo = true;
nextState = extend(newState, staticState);

@@ -125,3 +126,2 @@ prevState = newState.previousState;

}
} else {

@@ -271,4 +271,8 @@

try {
//Add the state that will update
nextState = extend(nextState, {dataContextWillUpdate: processedState});
//Add dataContextWillUpdate
if(willUndo){
nextState = extend(nextState, {dataContextWillUpdate: newState.state.dataContextWillUpdate});
} else {
nextState = extend(nextState, {dataContextWillUpdate: processedState});
}

@@ -275,0 +279,0 @@ appState = new ApplicationDataContext(nextState, prevState, redoState,

@@ -50,5 +50,10 @@

tempModel.__stateChangeHandler = (function(fld){
return viewModel[fld].__stateChangeHandler;
})(freezeFields[fld].fieldName);
Object.defineProperty(tempModel, '__stateChangeHandler', {
configurable: false,
enumerable: false,
writable: false,
value: (function(fld){
return viewModel[fld].__stateChangeHandler;
})(freezeFields[fld].fieldName)
});

@@ -55,0 +60,0 @@ Object.defineProperty(tempModel, 'state', {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc