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.7.1 to 0.7.2

2

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

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

@@ -35,2 +35,4 @@ ## 0.6.17

## 0.7.2
- only call getInitialState on ViewModels once

@@ -315,3 +315,3 @@ !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){

if(domain.hasOwnProperty(dataContext)){
appState.state[dataContext] = new dataContexts[dataContext](appState.state[dataContext], true);
appState.state[dataContext] = new dataContexts[dataContext](appState.state[dataContext]);
}

@@ -318,0 +318,0 @@ }

@@ -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/imvvm.js");g.exports=e},{"./src/imvvm.js":3}],2:[function(h,g,f){var e=h("./utils");var i=e.extend;f.getInitialState=function(m,n,w,l){if(typeof w!=="function"){throw new TypeError("stateChangedHandler must be a function!")}l===void (0)?true:l;var B,v={},s={},C,k={},z={},u,r={},p={},y,x,A,t,q,j=false;var o=function(F,K,M,R){var T={},P=void (0),H=void (0),N,I,G,E,J,L=[],Q,O,D,S;if(typeof M==="function"){R=M;M={}}K=K||{};N=Object.keys(K);if(Object.getPrototypeOf(K).constructor.classType==="DomainViewModel"){T=i(K);P=K.previousState;H=M;for(E in C){T[E]=new s[E](T[E])}for(E in C){if(C.hasOwnProperty(E)){for(J in k[E]){if(k[E].hasOwnProperty(J)){T[E].state[k[E][J]]=(J in C)?i(T[J].state):T[J]}}}}if(typeof R==="function"){v=new B(T,P,H,l);R(v);return}}else{if(!!N.length){if(F===m){T=i(K)}else{T[F]=i(K)}}r=i(T,r,M);transientStateKeys=Object.keys(r);if(transientStateKeys.length===0){return}G=transientStateKeys.length-1;for(I=G;I>=0;I--){if(transientStateKeys[I] in C){T[transientStateKeys[I]]=i(v[transientStateKeys[I]],r[transientStateKeys[I]]);T[transientStateKeys[I]]=new s[transientStateKeys[I]](T[transientStateKeys[I]])}else{T[transientStateKeys[I]]=r[transientStateKeys[I]]}}p=i(p,T);T=i(v,p);r={};for(I=G;I>=0;I--){if(transientStateKeys[I] in z){for(O in z[transientStateKeys[I]]){if(z[transientStateKeys[I]].hasOwnProperty(O)){if(N.indexOf(O)!==-1){D=z[transientStateKeys[I]][O];for(S in D){if(D.hasOwnProperty(S)){if(S in k){for(E in k[S]){if(k[S].hasOwnProperty(E)){T[S].state[k[S][E]]=(E in C)?i(T[E].state):T[E]}if(E in k){for(dataContext2 in k[E]){if(k[E].hasOwnProperty(dataContext2)){T[E].state[k[E][dataContext2]]=(dataContext2 in C)?i(T[dataContext2].state):T[dataContext2]}}}}}r=i(r,D[S].call(v[S],T[transientStateKeys[I]][O],v[transientStateKeys[I]][O],O,transientStateKeys[I]))}}}}}}}if(!!Object.keys(r).length){o(void (0),{},r);return}L=Object.keys(p);Q=L.length-1;for(I=Q;I>=0;I--){if(F===m){if(L[I] in k[m]){for(E in k[m][L[I]]){if(k[m][L[I]].hasOwnProperty(E)){T[E].state[k[m][L[I]][E]]=T[L[I]]}if(E in k){for(dataContext2 in k[E]){if(k[E].hasOwnProperty(dataContext2)){T[E].state[k[E][dataContext2]]=(dataContext2 in C)?i(T[dataContext2].state):T[dataContext2]}}}}}}else{if(L[I] in k){for(E in k[L[I]]){if(k[L[I]].hasOwnProperty(E)){T[L[I]].state[k[L[I]][E]]=(E in C)?i(T[E].state):T[E]}if(E in k){for(dataContext2 in k[E]){if(k[E].hasOwnProperty(dataContext2)){T[E].state[k[E][dataContext2]]=(dataContext2 in C)?i(T[dataContext2].state):T[dataContext2]}}}}}}}P=j?v.previousState:v}if(!!P){Object.freeze(P)}v=new B(T,P,H,l);Object.freeze(v);Object.freeze(v.state);if(typeof R==="function"){j=true;R(v);return}w(v);j=false;r={};p={}};B=n.call(this,o.bind(this,m));v=new B(void (0),void (0),void (0),l);v.state=v.state||{};C=v.constructor.originalSpec.getDomainDataContext();delete v.constructor.originalSpec.getDomainDataContext;for(u in C){if(C.hasOwnProperty(u)){s[u]=C[u].call(this,o.bind(this,u));v.state[u]=new s[u](v.state[u],true)}}for(u in C){if(C.hasOwnProperty(u)){if("getWatchedState" in v[u].constructor.originalSpec){y=v[u].constructor.originalSpec.getWatchedState();for(x in y){if(y.hasOwnProperty(x)){if(x in C||x in v.state){if("alias" in y[x]){if(!(u in k)){k[u]={}}k[u][x]=y[x].alias;if(!(x in C)){if(!(m in k)){k[m]={}}if(!(u in k[m])){k[m][x]={}}k[m][x][u]=y[x].alias}}for(A in y[x].fields){if(y[x].fields.hasOwnProperty(A)){if(x in C){t={};if(!(x in z)){z[x]={}}t[A]={};t[A][u]=y[x].fields[A];z[x]=t}}}}}}}}}for(u in C){if(C.hasOwnProperty(u)){for(q in k[u]){if(k[u].hasOwnProperty(q)){v[u].state[k[u][q]]=(q in C)?i(v[q].state):v[q]}}}}for(u in C){if(C.hasOwnProperty(u)){v.state[u]=new s[u](v.state[u],true)}}v=new B(v,void (0),void (0),l);Object.freeze(v.state);Object.freeze(v);return v}},{"./utils":8}],3:[function(f,g,j){var k=f("./imvvmModel");var p=f("./imvvmViewModel");var i=f("./imvvmDomainViewModel");var r=f("./mixin");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,p.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={},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{throw new TypeError('"'+this.originalSpec[C].kind+'" is not a valid "kind" value. Valid values are "pseudo","instance" and "array". Please review field "'+C+'".')}}delete this.originalSpec[C].kind}}E[C]=this.originalSpec[C]}else{if(C!=="getInitialState"&&C!=="getWatchedState"){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};return this.originalSpec.__processedSpec__};return w}};var s={createModel:e.createClass.bind(this,l,"Model"),createViewModel:e.createClass.bind(this,h,"ViewModel"),createDomainViewModel:e.createClass.bind(this,n,"DomainViewModel"),mixin:r,extend:o};g.exports=s},{"./imvvmDomainViewModel":4,"./imvvmModel":5,"./imvvmViewModel":6,"./mixin":7,"./utils":8}],4:[function(i,h,g){var f=i("./utils");var j=f.extend;var e={Mixin:{construct:function(l){var m=this.getDescriptor();m.proto.setState=l;m.proto.revert=function(){this.setState(this.previousState,!!this.previousState?this:void (0))};m.proto.advance=function(){if(this.canAdvance){this.setState(this.nextState,this.nextState.nextState)}};var k=function(p,t,o,s){var r=m.freezeFields,q=Object.create(m.proto,m.descriptor),n;if(!!s){if(!!t){Object.defineProperty(q,"previousState",{configurable:false,enumerable:false,writable:false,value:t});Object.defineProperty(q,"canRevert",{configurable:false,enumerable:false,writable:false,value:true})}else{Object.defineProperty(q,"canRevert",{configurable:false,enumerable:false,writable:false,value:false})}if(!!o&&"state" in o){Object.defineProperty(q,"nextState",{configurable:false,enumerable:false,writable:false,value:o});Object.defineProperty(q,"canAdvance",{configurable:false,enumerable:false,writable:false,value:true})}else{Object.defineProperty(q,"canAdvance",{configurable:false,enumerable:false,writable:false,value:false})}}if(p===void (0)){p=("getInitialState" in m.originalSpec)?m.originalSpec.getInitialState.call(q):{}}else{if("state" in p){delete p.state;Object.defineProperty(q,"state",{configurable:true,enumerable:false,writable:true,value:p});p=j(p,q)}}for(n=r.length-1;n>=0;n--){if(r[n].kind==="array"){p[r[n].fieldName]=p[r[n].fieldName]||[];Object.freeze(p[r[n].fieldName])}else{throw new TypeError('kind:"instance" can only be specified in a ViewModel.')}}Object.defineProperty(q,"state",{configurable:false,enumerable:false,writable:false,value:p});return q};return k}}};h.exports=e},{"./utils":8}],5:[function(h,g,f){var e=h("./utils");var j=e.extend;var i={Mixin:{construct:function(l){var m=this.getDescriptor();var k=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]}}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.__stateChangedHandler=(function(){return l})();return Object.freeze(o)};return k}}};g.exports=i},{"./utils":8}],6:[function(i,h,g){var f=i("./utils");var j=f.extend;var e={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.__stateChangedHandler=(function(u){return p[u].__stateChangedHandler})(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.__stateChangedHandler.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=e},{"./utils":8}],7:[function(j,i,h){var f=j("./core");var e="__IMVVM__";var g={stateChangedHandler:function(k){this.setState({domainDataContext:k})},getInitialState:function(){var k=f.getInitialState(e,this.props.domainModel,this.stateChangedHandler,this.props.enableUndo);return{domainDataContext:k}}};i.exports=g},{"./core":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},mixInto:function(j,k){var i;for(i in k){if(!k.hasOwnProperty(i)){continue}j.prototype[i]=k[i]}}};g.exports=e},{}]},{},[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/imvvm.js");g.exports=e},{"./src/imvvm.js":3}],2:[function(h,g,f){var e=h("./utils");var i=e.extend;f.getInitialState=function(m,n,w,l){if(typeof w!=="function"){throw new TypeError("stateChangedHandler must be a function!")}l===void (0)?true:l;var B,v={},s={},C,k={},z={},u,r={},p={},y,x,A,t,q,j=false;var o=function(F,K,M,R){var T={},P=void (0),H=void (0),N,I,G,E,J,L=[],Q,O,D,S;if(typeof M==="function"){R=M;M={}}K=K||{};N=Object.keys(K);if(Object.getPrototypeOf(K).constructor.classType==="DomainViewModel"){T=i(K);P=K.previousState;H=M;for(E in C){T[E]=new s[E](T[E])}for(E in C){if(C.hasOwnProperty(E)){for(J in k[E]){if(k[E].hasOwnProperty(J)){T[E].state[k[E][J]]=(J in C)?i(T[J].state):T[J]}}}}if(typeof R==="function"){v=new B(T,P,H,l);R(v);return}}else{if(!!N.length){if(F===m){T=i(K)}else{T[F]=i(K)}}r=i(T,r,M);transientStateKeys=Object.keys(r);if(transientStateKeys.length===0){return}G=transientStateKeys.length-1;for(I=G;I>=0;I--){if(transientStateKeys[I] in C){T[transientStateKeys[I]]=i(v[transientStateKeys[I]],r[transientStateKeys[I]]);T[transientStateKeys[I]]=new s[transientStateKeys[I]](T[transientStateKeys[I]])}else{T[transientStateKeys[I]]=r[transientStateKeys[I]]}}p=i(p,T);T=i(v,p);r={};for(I=G;I>=0;I--){if(transientStateKeys[I] in z){for(O in z[transientStateKeys[I]]){if(z[transientStateKeys[I]].hasOwnProperty(O)){if(N.indexOf(O)!==-1){D=z[transientStateKeys[I]][O];for(S in D){if(D.hasOwnProperty(S)){if(S in k){for(E in k[S]){if(k[S].hasOwnProperty(E)){T[S].state[k[S][E]]=(E in C)?i(T[E].state):T[E]}if(E in k){for(dataContext2 in k[E]){if(k[E].hasOwnProperty(dataContext2)){T[E].state[k[E][dataContext2]]=(dataContext2 in C)?i(T[dataContext2].state):T[dataContext2]}}}}}r=i(r,D[S].call(v[S],T[transientStateKeys[I]][O],v[transientStateKeys[I]][O],O,transientStateKeys[I]))}}}}}}}if(!!Object.keys(r).length){o(void (0),{},r);return}L=Object.keys(p);Q=L.length-1;for(I=Q;I>=0;I--){if(F===m){if(L[I] in k[m]){for(E in k[m][L[I]]){if(k[m][L[I]].hasOwnProperty(E)){T[E].state[k[m][L[I]][E]]=T[L[I]]}if(E in k){for(dataContext2 in k[E]){if(k[E].hasOwnProperty(dataContext2)){T[E].state[k[E][dataContext2]]=(dataContext2 in C)?i(T[dataContext2].state):T[dataContext2]}}}}}}else{if(L[I] in k){for(E in k[L[I]]){if(k[L[I]].hasOwnProperty(E)){T[L[I]].state[k[L[I]][E]]=(E in C)?i(T[E].state):T[E]}if(E in k){for(dataContext2 in k[E]){if(k[E].hasOwnProperty(dataContext2)){T[E].state[k[E][dataContext2]]=(dataContext2 in C)?i(T[dataContext2].state):T[dataContext2]}}}}}}}P=j?v.previousState:v}if(!!P){Object.freeze(P)}v=new B(T,P,H,l);Object.freeze(v);Object.freeze(v.state);if(typeof R==="function"){j=true;R(v);return}w(v);j=false;r={};p={}};B=n.call(this,o.bind(this,m));v=new B(void (0),void (0),void (0),l);v.state=v.state||{};C=v.constructor.originalSpec.getDomainDataContext();delete v.constructor.originalSpec.getDomainDataContext;for(u in C){if(C.hasOwnProperty(u)){s[u]=C[u].call(this,o.bind(this,u));v.state[u]=new s[u](v.state[u],true)}}for(u in C){if(C.hasOwnProperty(u)){if("getWatchedState" in v[u].constructor.originalSpec){y=v[u].constructor.originalSpec.getWatchedState();for(x in y){if(y.hasOwnProperty(x)){if(x in C||x in v.state){if("alias" in y[x]){if(!(u in k)){k[u]={}}k[u][x]=y[x].alias;if(!(x in C)){if(!(m in k)){k[m]={}}if(!(u in k[m])){k[m][x]={}}k[m][x][u]=y[x].alias}}for(A in y[x].fields){if(y[x].fields.hasOwnProperty(A)){if(x in C){t={};if(!(x in z)){z[x]={}}t[A]={};t[A][u]=y[x].fields[A];z[x]=t}}}}}}}}}for(u in C){if(C.hasOwnProperty(u)){for(q in k[u]){if(k[u].hasOwnProperty(q)){v[u].state[k[u][q]]=(q in C)?i(v[q].state):v[q]}}}}for(u in C){if(C.hasOwnProperty(u)){v.state[u]=new s[u](v.state[u])}}v=new B(v,void (0),void (0),l);Object.freeze(v.state);Object.freeze(v);return v}},{"./utils":8}],3:[function(f,g,j){var k=f("./imvvmModel");var p=f("./imvvmViewModel");var i=f("./imvvmDomainViewModel");var r=f("./mixin");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,p.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={},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{throw new TypeError('"'+this.originalSpec[C].kind+'" is not a valid "kind" value. Valid values are "pseudo","instance" and "array". Please review field "'+C+'".')}}delete this.originalSpec[C].kind}}E[C]=this.originalSpec[C]}else{if(C!=="getInitialState"&&C!=="getWatchedState"){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};return this.originalSpec.__processedSpec__};return w}};var s={createModel:e.createClass.bind(this,l,"Model"),createViewModel:e.createClass.bind(this,h,"ViewModel"),createDomainViewModel:e.createClass.bind(this,n,"DomainViewModel"),mixin:r,extend:o};g.exports=s},{"./imvvmDomainViewModel":4,"./imvvmModel":5,"./imvvmViewModel":6,"./mixin":7,"./utils":8}],4:[function(i,h,g){var f=i("./utils");var j=f.extend;var e={Mixin:{construct:function(l){var m=this.getDescriptor();m.proto.setState=l;m.proto.revert=function(){this.setState(this.previousState,!!this.previousState?this:void (0))};m.proto.advance=function(){if(this.canAdvance){this.setState(this.nextState,this.nextState.nextState)}};var k=function(p,t,o,s){var r=m.freezeFields,q=Object.create(m.proto,m.descriptor),n;if(!!s){if(!!t){Object.defineProperty(q,"previousState",{configurable:false,enumerable:false,writable:false,value:t});Object.defineProperty(q,"canRevert",{configurable:false,enumerable:false,writable:false,value:true})}else{Object.defineProperty(q,"canRevert",{configurable:false,enumerable:false,writable:false,value:false})}if(!!o&&"state" in o){Object.defineProperty(q,"nextState",{configurable:false,enumerable:false,writable:false,value:o});Object.defineProperty(q,"canAdvance",{configurable:false,enumerable:false,writable:false,value:true})}else{Object.defineProperty(q,"canAdvance",{configurable:false,enumerable:false,writable:false,value:false})}}if(p===void (0)){p=("getInitialState" in m.originalSpec)?m.originalSpec.getInitialState.call(q):{}}else{if("state" in p){delete p.state;Object.defineProperty(q,"state",{configurable:true,enumerable:false,writable:true,value:p});p=j(p,q)}}for(n=r.length-1;n>=0;n--){if(r[n].kind==="array"){p[r[n].fieldName]=p[r[n].fieldName]||[];Object.freeze(p[r[n].fieldName])}else{throw new TypeError('kind:"instance" can only be specified in a ViewModel.')}}Object.defineProperty(q,"state",{configurable:false,enumerable:false,writable:false,value:p});return q};return k}}};h.exports=e},{"./utils":8}],5:[function(h,g,f){var e=h("./utils");var j=e.extend;var i={Mixin:{construct:function(l){var m=this.getDescriptor();var k=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]}}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.__stateChangedHandler=(function(){return l})();return Object.freeze(o)};return k}}};g.exports=i},{"./utils":8}],6:[function(i,h,g){var f=i("./utils");var j=f.extend;var e={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.__stateChangedHandler=(function(u){return p[u].__stateChangedHandler})(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.__stateChangedHandler.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=e},{"./utils":8}],7:[function(j,i,h){var f=j("./core");var e="__IMVVM__";var g={stateChangedHandler:function(k){this.setState({domainDataContext:k})},getInitialState:function(){var k=f.getInitialState(e,this.props.domainModel,this.stateChangedHandler,this.props.enableUndo);return{domainDataContext:k}}};i.exports=g},{"./core":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},mixInto:function(j,k){var i;for(i in k){if(!k.hasOwnProperty(i)){continue}j.prototype[i]=k[i]}}};g.exports=e},{}]},{},[1])(1)});
{
"name": "imvvm",
"description": "Immutable MVVM for React",
"version": "0.7.1",
"version": "0.7.2",
"keywords": [

@@ -6,0 +6,0 @@ "mvvm",

@@ -308,3 +308,3 @@

if(domain.hasOwnProperty(dataContext)){
appState.state[dataContext] = new dataContexts[dataContext](appState.state[dataContext], true);
appState.state[dataContext] = new dataContexts[dataContext](appState.state[dataContext]);
}

@@ -311,0 +311,0 @@ }

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