ui-router-extras
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -0,1 +1,16 @@ | ||
<a name="0.1.3"></a> | ||
### 0.1.3 (2016-10-05) | ||
#### Bug Fixes | ||
* **dsr:** Cannot read property 'ignoreDsr' of undefined ([3e23a4ac](https://github.com/christopherthielen/ui-router-extras/commit/3e23a4acc11449bef017758a4fc69cc1660539f6)) | ||
* **sticky:** fix inactive child state targeting a named ui-view that inactive parent also tar ([122d5842](https://github.com/christopherthielen/ui-router-extras/commit/122d584223d864f696d8f37751bdfd218b29e5d4), closes [#272](https://github.com/christopherthielen/ui-router-extras/issues/272), [#343](https://github.com/christopherthielen/ui-router-extras/issues/343)) | ||
#### Features | ||
* **sticky:** Improve view debugging output using console.table() ([26058304](https://github.com/christopherthielen/ui-router-extras/commit/26058304353b01e454d1aabd08d7b2f310526e1f)) | ||
<a name="0.1.1"></a> | ||
@@ -2,0 +17,0 @@ ### 0.1.1 (2016-03-14) |
{ | ||
"author": "Christopher Thielen", | ||
"name": "ui-router-extras", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "UI-Router Extras: Sticky states, Future States, Deep State Redirect, Transition promise", | ||
@@ -6,0 +6,0 @@ "homepage": "http://christopherthielen.github.io/ui-router-extras/", |
@@ -1,2 +0,2 @@ | ||
/** UI-Router Extras v.0.1.2 Monolithic build (all modules) http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(t,e){"use strict";"function"==typeof define&&define.amd?define(["angular"],function(t){e(t)}):e("object"==typeof exports?require("angular"):t.angular)}(this,function(t,e){function r(t,e){var r=[];for(var n in t.path){if(t.path[n]!==e.path[n])break;r.push(t.path[n])}return r}function n(e){if(Object.keys)return Object.keys(e);var r=[];return t.forEach(e,function(t,e){r.push(e)}),r}function a(t,e){var r=[];for(var n in t)e&&-1!==e.indexOf(n)||r.push(n);return r}function o(t,e){if(Array.prototype.indexOf)return t.indexOf(e,Number(arguments[2])||0);var r=t.length>>>0,n=Number(arguments[2])||0;for(n=0>n?Math.ceil(n):Math.floor(n),0>n&&(n+=r);r>n;n++)if(n in t&&t[n]===e)return n;return-1}function i(t,e,a,i){var u,s=r(a,i),c={},f=[];for(var l in s)if(s[l].params&&(u=$(s[l].params)?s[l].params:n(s[l].params),u.length))for(var p in u)o(f,u[p])>=0||(f.push(u[p]),c[u[p]]=t[u[p]]);return h({},c,e)}function u(t,e){return h(new(h(function(){},{prototype:t})),e)}function s(t){d.push(t)}function c(){b=e}function f(e,r){var n=r,a=n.inheritParams,o=(n.objectKeys,n.protoKeys),i=n.forEach,u=n.map,s={},c={},f=!1;this.registerStickyState=function(t){c[t.name]=t},this.enableDebug=this.debugMode=function(e){return t.isDefined(e)&&(f=e),f},this.$get=["$rootScope","$state","$stateParams","$injector","$log",function(e,r,n,c,l){function p(){var e={};return t.forEach(s,function(t,r){for(var n=d(t),a=0;a<n.length;a++){var o=n[a].parent;e[o.name]=e[o.name]||[],e[o.name].push(t)}e[""]&&(e.__inactives=e[""])}),e}function v(){var t={};return i(s,function(e){i(e.path,function(r){r!==e&&(t[r.name]=t[r.name]||[],t[r.name].push(e))})}),t}function d(t){var e=[];if(!t)return e;do t.sticky&&e.push(t),t=t.parent;while(t);return e.reverse(),e}function m(t,e,r,n){if(n)return"reload";var a=s[t.self.name];if(!a)return"enter";if(t.self===r)return"reload";var o=$(t.ownParams,e,a.locals.globals.$stateParams);return o?"reactivate":"reload"}function h(t,e){var r=s[t.name];if(!r)return null;if(!e)return r;var n=$(t.ownParams,e,r.locals.globals.$stateParams);return n?r:null}function $(t,e,r){return"function"==typeof t.$$equals?t.$$equals(e,r):g(e,r,t)}function g(e,r,n){if(!t.isArray(n)&&t.isObject(n)&&(n=o(n,["$$keys","$$values","$$equals","$$validates","$$new","$$parent"])),!n){n=[];for(var a in e)n.push(a)}for(var i=0;i<n.length;i++){var u=n[i];if(e[u]!=r[u])return!1}return!0}function x(t){var e=t.fromState.path,o=t.toState.path,i=t.toParams,u=0,s=o[u];for(t.options&&t.options.inherit&&(i=t.toParams=a(n,i||{},r.$current,t.toState));s&&s===e[u]&&$(s.ownParams,i,t.fromParams);)s=o[++u];return{keep:u,retained:e.slice(0,u),exiting:e.slice(u),entering:o.slice(u)}}var y={getInactiveStates:function(){return u(s,t.identity)},getInactiveStatesByParent:function(){return p()},processTransition:function(e){function r(t){return function(e){return-1===t.indexOf(e)}}function n(t,e){return t.concat(e)}function a(t){return function(e){return e[t]}}function o(t){return function(e){return e.type===t}}function i(t){return function(e){return e.parent===t}}function c(t){return!t.sticky}var f,l,p,d=x(e),h=u(s,t.identity),$=d.keep,g=r(d.entering),y=d.exiting[0]&&d.exiting[0].sticky&&d.entering.length>0;l=d.exiting.map(function(t){var e=-1!==d.entering.indexOf(t),r=y&&!e?"inactivate":"exit";return{type:r,state:t}});var S=e.options&&!!e.options.reload;p=d.entering.map(function(t){var r=m(t,e.toParams,e.reloadStateTree,S);return S=S||"reload"===r,{type:r,state:t}});var b=d.entering.map(function(t){return h.filter(i(t.parent))}).reduce(n,[]).filter(g).filter(c).concat(h.filter(i(e.toState))),E=v(),k=b.map(function(t){return E[t.name]}).filter(t.isDefined).reduce(n,[]).concat(b).sort(function(t,e){return t.name.split(".").length-e.name.split(".").length}),P=l.filter(o("exit")).map(a("state")).concat(k);return f=h.filter(r(P)).filter(r(d.entering)).concat(l.filter(o("inactivate")).map(a("state"))),{keep:$,enter:new Array($).concat(p.map(a("type"))),exit:new Array($).concat(l.map(a("type"))),inactives:f,reactivatingStates:p.filter(o("reactivate")).map(a("state")),orphans:k}},stateInactivated:function(t){s[t.self.name]=t,t.self.status="inactive",t.self.onInactivate&&c.invoke(t.self.onInactivate,t.self,t.locals.globals)},stateReactivated:function(t){s[t.self.name]&&delete s[t.self.name],t.self.status="entered",t.self.onReactivate&&c.invoke(t.self.onReactivate,t.self,t.locals.globals)},stateExiting:function(e,r,n){var a={};t.forEach(r,function(t){a[t.self.name]=!0}),t.forEach(s,function(r,n){!a[n]&&r.includes[e.name]&&(f&&l.debug("Exiting "+n+" because it's a substate of "+e.name+" and wasn't found in ",a),r.self.onExit&&c.invoke(r.self.onExit,r.self,r.locals.globals),t.forEach(r.locals,function(t,e){delete j.locals[e]}),r.locals=null,r.self.status="exited",delete s[n])}),n&&c.invoke(n,e.self,e.locals.globals),e.locals=null,e.self.status="exited",delete s[e.self.name]},stateEntering:function(t,e,r,n){var a=h(t);if(a&&(n||!h(t,e))){var o=t.locals;this.stateExiting(a),t.locals=o}t.self.status="entered",r&&c.invoke(r,t.self,t.locals.globals)},reset:function(n,a){function o(t){y.reset(t)}if("*"===n)return t.forEach(y.getInactiveStates(),o),!0;var i=r.get(n);if(!i)return!1;var u=h(i,a);return u?(y.stateExiting(u),e.$broadcast("$viewContentLoading"),!0):!1}};return y}]}function l(t){return{resolve:{},locals:{globals:P&&P.locals&&P.locals.globals},views:{},self:{},params:{},ownParams:A.hasParamSet?{$$equals:function(){return!0}}:[],surrogateType:t}}var p=t.module("ct.ui.router.extras.core",["ui.router"]),v={},d=[];p.config(["$stateProvider","$injector",function(e,r){e.decorator("parent",function(e,r){return v[e.self.name]=e,e.self.$$state=function(){return v[e.self.name]},t.forEach(d,function(t){t(e)}),r(e)})}]);var m=t.forEach,h=t.extend,$=t.isArray,g=function(t,e){"use strict";var r=[];return m(t,function(t,n){r.push(e(t,n))}),r},x=function(t){"use strict";return g(t,function(t,e){return e})},y=function(t,e){"use strict";var r=[];return m(t,function(t,n){e(t,n)&&r.push(t)}),r},S=function(t,e){"use strict";var r={};return m(t,function(t,n){e(t,n)&&(r[n]=t)}),r};p.provider("uirextras_core",function(){var e={internalStates:v,onStateRegistered:s,forEach:m,extend:h,isArray:$,map:g,keys:x,filter:y,filterObj:S,ancestors:r,objectKeys:n,protoKeys:a,arraySearch:o,inheritParams:i,inherit:u};t.extend(this,e),this.$get=function(){return e}});var b;t.module("ct.ui.router.extras.dsr",["ct.ui.router.extras.core"]).config(["$provide",function(t){var e;t.decorator("$state",["$delegate","$q",function(t,r){return e=t.transitionTo,t.transitionTo=function(n,a,o){return o.ignoreDsr&&(b=o.ignoreDsr),e.apply(t,arguments).then(function(t){return c(),t},function(t){return c(),r.reject(t)})},t}])}]),t.module("ct.ui.router.extras.dsr").service("$deepStateRedirect",["$rootScope","$state","$injector",function(r,n,a){function o(t){var e=t.name;return l.hasOwnProperty(e)?l[e]:void u(e)}function i(e){var r=e.deepStateRedirect||e.dsr;if(!r)return{dsr:!1};var n={dsr:!0};return t.isFunction(r)?n.fn=r:t.isObject(r)&&(n=t.extend(n,r)),t.isString(n["default"])&&(n["default"]={state:n["default"]}),n.fn||(n.fn=["$dsr$",function(t){return t.redirect.state!=t.to.state}]),n}function u(t){var r=n.get(t);if(!r)return!1;var a=i(r);a.dsr&&(l[r.name]=p,f[t]===e&&(f[t]={}));var o=r.$$state&&r.$$state().parent;if(o){var s=u(o.self.name);s&&l[r.name]===e&&(l[r.name]=v)}return l[r.name]||!1}function s(r,n){n===!0&&(n=Object.keys(r)),null!==n&&n!==e||(n=[]);var a={};return t.forEach(n.sort(),function(t){a[t]=r[t]}),a}function c(e,r){function n(t){return t?t.toString():t}var a=s(e,r),o={};return t.forEach(a,function(t,e){o[e]=n(t)}),t.toJson(o)}var f={},l={},p="Redirect",v="AncestorRedirect";return r.$on("$stateChangeStart",function(e,r,u,l,v){var d=i(r);if(!b&&(o(r)===p||d["default"])){var m=c(u,d.params),h=f[r.name][m]||d["default"];if(h){var $={redirect:{state:h.state,params:h.params},to:{state:r.name,params:u}},g=a.invoke(d.fn,r,{$dsr$:$});if(g){g.state&&(h=g),e.preventDefault();var x=s(u,d.params);n.go(h.state,t.extend(x,h.params))}}}}),r.$on("$stateChangeSuccess",function(e,r,a,u,s){var l=o(r);if(l){var p=r.name;t.forEach(f,function(e,o){var u=i(n.get(o)),s=c(a,u.params);r.$$state().includes[o]&&(f[o][s]={state:p,params:t.copy(a)})})}}),{getRedirect:function(t,e){var r=n.get(t);o(r);var a=i(r),u=c(e,a.params),s=f[r.name][u]||a["default"];return s},reset:function(e,r){if(e){var a=n.get(e);if(!a)throw new Error("Unknown state: "+e);if(f[a.name])if(r){var o=c(r,i(a).params);delete f[a.name][o]}else f[a.name]={}}else t.forEach(f,function(t,e){f[e]={}})}}}]),t.module("ct.ui.router.extras.dsr").run(["$deepStateRedirect",function(t){}]),t.module("ct.ui.router.extras.sticky",["ct.ui.router.extras.core"]);var E=t.module("ct.ui.router.extras.sticky");f.$inject=["$stateProvider","uirextras_coreProvider"],E.provider("$stickyState",f);var k,P,w,j,v={},R=[],F={},A={hasParamSet:!1};t.module("ct.ui.router.extras.sticky").run(["$stickyState",function(t){k=t}]),t.module("ct.ui.router.extras.sticky").config(["$provide","$stateProvider","$stickyStateProvider","$urlMatcherFactoryProvider","uirextras_coreProvider",function(r,n,a,o,i){function u(e,r,n){function a(t,e,r){return t[e]?t[e].toUpperCase()+": "+r.self.name:"("+r.self.name+")"}var o=d(n.inactives,function(t){return t.self.name}),i=d(r.toState.path,function(t,e){return a(n.enter,e,t)}),u=d(r.fromState.path,function(t,e){return a(n.exit,e,t)}),s=r.fromState.self.name+": "+t.toJson(r.fromParams)+": -> "+r.toState.self.name+": "+t.toJson(r.toParams);e.debug("------------------------------------------------------"),e.debug(" Current transition: ",s),e.debug("Before transition, inactives are: : ",d(k.getInactiveStates(),function(t){return t.self.name})),e.debug("After transition, inactives will be: ",o),e.debug("Transition will exit: ",u),e.debug("Transition will enter: ",i)}function s(t,e,r){t.debug("Current state: "+e.self.name+", inactive states: ",d(k.getInactiveStates(),function(t){return t.self.name}));for(var n=function(t,e){return"'"+e+"' ("+t.$$state.name+")"},a=function(t,e){return"globals"!=e&&"resolve"!=e},o=function(t){var e=d(m(t.locals,a),n).join(", ");return"("+(t.self.name?t.self.name:"root")+".locals"+(e.length?": "+e:"")+")"},i=o(e),u=e.parent;u&&u!==e;)""===u.self.name&&(i=o(r.$current.path[0])+" / "+i),i=o(u)+" / "+i,e=u,u=e.parent;t.debug("Views: "+i)}var c=i,f=c.internalStates,p=c.inherit,v=(c.inheritParams,c.forEach),d=c.map,m=c.filterObj;A.hasParamSet=!!o.ParamSet,j=t.extend(new l("__inactives"),{self:{name:"__inactives"}}),P=w=e,R=[],i.onStateRegistered(function(t){t.self.sticky===!0&&a.registerStickyState(t.self)});var h;r.decorator("$state",["$delegate","$log","$q",function(r,n,i){return P=r.$current,f[""]=P,P.parent=j,j.parent=e,j.locals=p(F,j.locals),P.locals=p(j.locals,P.locals),delete j.locals.globals,h=r.transitionTo,r.transitionTo=function(e,c,p){function m(e){var r=t.extend(new l("reactivate_phase1"),{locals:e.locals});return r.self=t.extend({},e.self),r}function $(e){var r=t.extend(new l("reactivate_phase2"),e),n=r.self.onEnter;return r.resolve={},r.views={},r.self.onEnter=function(){r.locals=e.locals,k.stateReactivated(e)},J.addRestoreFunction(function(){e.self.onEnter=n}),r}function g(t){var e=new l("inactivate");e.self=t.self;var r=t.self.onExit;return e.self.onExit=function(){k.stateInactivated(t)},J.addRestoreFunction(function(){t.self.onExit=r}),e}function x(t,e){var r=t.self.onEnter;return t.self.onEnter=function(){k.stateEntering(t,e,r)},J.addRestoreFunction(function(){t.self.onEnter=r}),t}function y(t,e){var r=t.self.onEnter;return t.self.onEnter=function(){k.stateEntering(t,e,r,!0)},J.addRestoreFunction(function(){t.self.onEnter=r}),t}function S(t){var e=t.self.onExit;return t.self.onExit=function(){k.stateExiting(t,K,e)},J.addRestoreFunction(function(){t.self.onExit=e}),t}var b=a.debugMode();j.locals||(j.locals=P.locals);var E=R.length;w&&(w(),b&&n.debug("Restored paths from pending transition"));var O,T,_,q,I=r.$current,M=r.params,C=p&&p.relative||r.$current,D=r.get(e,C),N=[],K=[];c=c||{},arguments[1]=c;var z=function(){},J=function(){O&&(L.path=O,O=null),T&&(I.path=T,T=null),t.forEach(J.restoreFunctions,function(t){t()}),J=z,w=null,R.splice(E,1)};if(J.restoreFunctions=[],J.addRestoreFunction=function(t){this.restoreFunctions.push(t)},D){var L=f[D.name];if(L){O=L.path,T=I.path;var B=p&&p.reload||!1,H=B&&(B===!0?O[0].self:r.get(B,C));p&&B&&B!==!0&&delete p.reload;var U={toState:L,toParams:c||{},fromState:I,fromParams:M||{},options:p,reloadStateTree:H};if(R.push(U),w=J,H){U.toParams.$$uirouterextrasreload=Math.random();var V=H.$$state().params,W=H.$$state().ownParams;if(A.hasParamSet){var Y=new o.Param("$$uirouterextrasreload");V.$$uirouterextrasreload=W.$$uirouterextrasreload=Y,J.restoreFunctions.push(function(){delete V.$$uirouterextrasreload,delete W.$$uirouterextrasreload})}else V.push("$$uirouterextrasreload"),W.push("$$uirouterextrasreload"),J.restoreFunctions.push(function(){V.length=V.length-1,W.length=W.length-1})}_=k.processTransition(U),b&&u(n,U,_);var G=L.path.slice(0,_.keep),Q=I.path.slice(0,_.keep);t.forEach(j.locals,function(t,e){-1!=e.indexOf("@")&&delete j.locals[e]});var X=function(t){return function(e,r){-1!==r.indexOf("@")&&(t[r]=e)}};v(_.inactives,function(t){v(t.locals,X(j.locals))}),v(_.reactivatingStates,function(t){v(t.locals,X(F))}),J.addRestoreFunction(function(){v(F,function(t,e){delete F[e]})}),t.forEach(_.enter,function(t,e){var r,n=L.path[e];"reactivate"===t?(r=m(n),G.push(r),Q.push(r),N.push($(n)),q=n):"reload"===t?(G.push(y(n)),q=n):"enter"===t&&G.push(x(n))}),t.forEach(_.exit,function(t,e){var r=I.path[e];"inactivate"===t?(Q.push(g(r)),K.push(r)):"exit"===t&&(Q.push(S(r)),K.push(r))}),N.length&&t.forEach(N,function(t){G.push(t)});var Z=_.orphans;Q=Q.concat(d(Z,function(t){return S(t)})),K=K.concat(Z),I.path=Q,L.path=G;var tt=function(t){return(t.surrogateType?t.surrogateType+":":"")+t.self.name};b&&n.debug("SurrogateFromPath: ",d(Q,tt)),b&&n.debug("SurrogateToPath: ",d(G,tt))}}var et=h.apply(r,arguments);return et.then(function(t){return J(),b&&s(n,f[t.name],r),t.status="active",t},function(t){return J(),b&&"transition prevented"!==t.message&&"transition aborted"!==t.message&&"transition superseded"!==t.message&&(n.debug("transition failed",t),n.debug(t.stack)),i.reject(t)})},r}])}]),function(t,e){function r(e,r,n,a){function o(e,r){var n=t.isObject(e)?e.name:e;return r?v[n]:l[n]}function i(t,e){if(e.name){var r=e.name.split(/\./);for("."===e.name.charAt(0)&&(r[0]=t.current.name);r.length;){var n=r.join(".");if(t.get(n,{relative:t.current}))return null;if(v[n])return v[n];r.pop()}}if(e.url){var a=[];for(var o in v){var i=v[o].urlMatcher;i&&i.exec(e.url)&&a.push(v[o])}for(var u=a.slice(0),s=a.length-1;s>=0;s--)for(var c=0;c<u.length;c++)a[s]===u[c].parentFutureState&&a.splice(s,1);return a[0]}}function u(t,e){function r(){delete v[e.name]}function n(t){return"remove"===l&&r(),a.reject(t)}d=!0;var a=t.get("$q");if(!e){var o=a.defer();return o.reject("No lazyState passed in "+e),o.promise}var i=a.when([]),s=e.parentFutureState;s&&v[s.name]&&(i=u(t,v[s.name]));var c=e.type,f=p[c];if(!f)throw Error("No state factory for futureState.type: "+(e&&e.type));var l=f.$options&&f.$options.failedLazyLoadPolicy||"remove";return i.then(function(n){var a=t.invoke(f,f,{futureState:e});return a.then(function(t){return r(),t&&n.push(t),n})})["catch"](n)}function s(t,r){var n=!1,a=["$rootScope","$urlRouter","$state",function(a,o,s){function f(){n=!0,o.sync(),n=!1}if(!h)return c().then(f),void(h=!0);var l=i(s,{url:r.path()});return l?void u(t,l).then(function(t){t.forEach(function(t){t&&(!s.get(t)||t.name&&!s.get(t.name))&&e.state(t)}),d=!1,f()},function(){d=!1,f()}):t.invoke(g)}];if(!d){var o=n?g:a;return t.invoke(o)}}var c,f=a,l=f.internalStates,p={},v={},d=!1,m=[],h=!1,$=this;this.addResolve=function(t){m.push(t)},this.stateFactory=function(t,e){p[t]=e},this.futureState=function(e){e.stateName&&(e.name=e.stateName),e.urlPrefix&&(e.url="^"+e.urlPrefix),v[e.name]=e;var r,a=e.name.split(/\./).slice(0,-1).join("."),i=o(e.parent||a);if(i)r=i.url||i.navigable&&i.navigable.url;else if(""===a)r=n.compile("");else{var u=o(e.parent||a,!0);if(!u)throw new Error("Couldn't determine parent state of future state. FutureState:"+t.toJson(e));var s;s=u.urlMatcher?u.urlMatcher.source.replace(/\*rest$/,""):"",r=n.compile(s),e.parentFutureState=u}e.url&&(e.urlMatcher="^"===e.url.charAt(0)?n.compile(e.url.substring(1)+"*rest"):r.concat(e.url+"*rest"))},this.get=function(){return t.extend({},v)};var g=["$log","$location",function(t,e){}];r.otherwise(s),r.otherwise=function(e){if(t.isString(e)){var n=e;e=function(){return n}}else if(!t.isFunction(e))throw new Error("'rule' must be a function");return g=["$injector","$location",e],r};var x={getResolvePromise:function(){return c()}};this.$get=["$injector","$state","$q","$rootScope","$urlRouter","$timeout","$log",function(r,n,a,o,s,f,l){function p(){if(o.$on("$stateNotFound",function(t,a,o,s){if(!d){var c=i(n,{name:a.to});if(c){t.preventDefault();var f=u(r,c);f.then(function(t){t.forEach(function(t){t&&(!n.get(t)||t.name&&!n.get(t.name))&&e.state(t)}),n.go(a.to,a.toParams,a.options),d=!1},function(t){console.log("failed to lazy load state ",t),o.name&&n.go(o,s),d=!1})}}}),!c){var l=[];t.forEach(m,function(t){l.push(r.invoke(t))}),c=function(){return a.all(l)}}c().then(function p(){f(function(){n.transition?n.transition.then(p,p):s.sync()})})}return p(),x.state=e.state,x.futureState=$.futureState,x.get=$.get,x}]}var n=t.module("ct.ui.router.extras.future",["ct.ui.router.extras.core"]);r.$inject=["$stateProvider","$urlRouterProvider","$urlMatcherFactoryProvider","uirextras_coreProvider"],n.provider("$futureState",r);var a={state:function(t){a.$rootScope&&a.$rootScope.$broadcast("$stateAdded",t)},itsNowRuntimeOhWhatAHappyDay:function(t){a.$rootScope=t},$rootScope:e};n.config(["$stateProvider",function(e){var r=e.state;e.state=function(){var n=r.apply(e,arguments),o=t.isObject(arguments[0])?arguments[0]:arguments[1];return a.state(o),n}}]),n.run(["$futureState",function(t,e){a.itsNowRuntimeOhWhatAHappyDay(e)}])}(t),t.module("ct.ui.router.extras.previous",["ct.ui.router.extras.core","ct.ui.router.extras.transition"]).service("$previousState",["$rootScope","$state","$q",function(t,r,n){var a=null,o=null,i={};t.$on("$transitionStart",function(t,e){function r(){o=null}function n(){a=o}var i=e.from,u=i.state&&i.state.$$state&&i.state.$$state();u&&(o=a,a=e.from,e.promise.then(r)["catch"](n))});var u={get:function(t){return t?i[t]:a},set:function(t,e,n){i[t]={state:r.get(e),params:n}},go:function(t,e){var a=u.get(t);return a?r.go(a.state,a.params,e):n.reject(new Error("no previous state "+(t?"for memo: "+t:"")))},memo:function(t,e,n){i[t]=a||{state:r.get(e),params:n}},forget:function(t){t?delete i[t]:a=e}};return u}]),t.module("ct.ui.router.extras.previous").run(["$previousState",function(t){}]),t.module("ct.ui.router.extras.transition",["ct.ui.router.extras.core"]).config(["$provide",function(e){e.decorator("$state",["$delegate","$rootScope","$q","$injector",function(e,r,n,a){function o(e){var r=a.invoke,n=a.instantiate;return a.invoke=function(n,a,o){return r(n,a,t.extend({$transition$:e},o))},a.instantiate=function(r,a){return n(r,t.extend({$transition$:e},a))},function(){a.invoke=r,a.instantiate=n}}function i(){p.pop()(),l.pop(),f--}function u(t,e){return function(n){return i(),r.$broadcast("$transitionSuccess",e),t.resolve(n),n}}function s(t,e){return function(a){return i(),r.$broadcast("$transitionError",e,a),t.reject(a),n.reject(a)}}var c=e.transitionTo,f=-1,l=[],p=[];return e.transitionTo=function(t,r,a){var o=n.defer(),i=l[++f]={promise:o.promise};p[f]=function(){};var v=c.apply(e,arguments);return v.then(u(o,i),s(o,i))},r.$on("$stateChangeStart",function(e,n,a,i,u){if(!(f>=l.length)){var s=f,c=t.extend(l[s],{to:{state:n,params:a},from:{state:i,params:u}}),v=o(c);p[s]=v,r.$broadcast("$transitionStart",c)}}),e}])}]),function(){"use strict";function e(e,r,n){return{scope:{width:"@",height:"@"},restrict:"AE",template:"<svg></svg>",link:function(r,a,o){function i(e){e=e.map(function(e){return""===e.name?p:t.copy(e)}),t.extend(s,e.reduce(function(t,e){return t[e.name]=e,t},{})),e.forEach(function(t){var e=t.name.split(/\./).slice(0,-1).join("."),r=t.name!=e&&s[e];r&&((r.children||(r.children=[])).push(t),t.px=r.px,t.py=r.py,v.push(t))})}function u(){function t(t){var e=t.name.split(".").pop();return t.sticky&&(e+=" (STICKY)"),t.deepStateRedirect&&(e+=" (DSR)"),e}$=$.data(l.nodes(p),function(t){return t.name}),g=g.data(l.links(v),function(t){return t.target.name}),x=x.data(d),v.forEach(function(t){t.y=70*t.depth});var e=$.enter();x.enter().append("circle").attr("class","active").attr("r",13).attr("cx",function(t){return t.parent.px||100}).attr("cy",function(t){return t.parent.py||100}),e.append("circle").attr("class","node").attr("r",9).attr("cx",function(t){return t.parent.px}).attr("cy",function(t){return t.parent.py}),e.append("text").attr("class","label").attr("x",function(t){return t.parent.px}).attr("y",function(t){return t.parent.py}).attr("text-anchor",function(t){return"middle"}).text(t).style("fill-opacity",1),g.enter().insert("path",".node").attr("class","link").attr("d",function(t){var e={x:t.source.px,y:t.source.py};return m({source:e,target:e})});var r=h.transition().duration(S);r.selectAll(".link").attr("d",m);var n={entered:"#AF0",exited:"#777",active:"#0f0",inactive:"#55F",future:"#009"};r.selectAll(".node").attr("cx",function(t){return t.px=t.x}).attr("cy",function(t){return t.py=t.y}).attr("r",function(t){return"active"===t.status?15:10}).style("fill",function(t){return n[t.status]||"#FFF"}),r.selectAll(".label").attr("x",function(t){return t.px=t.x}).attr("y",function(t){return t.py=t.y-15}).attr("transform",function(t){return"rotate(-25 "+t.x+" "+t.y+")"}),r.selectAll(".active").attr("x",function(t){return t.px=t.x}).attr("y",function(t){return t.py=t.y-15})}var s={},c=r.width||400,f=r.height||400,l=d3.layout.tree().size([c-20,f-20]).separation(function(t,e){return t.parent==e.parent?10:25}),p=e.get().filter(function(t){return""===t.name})[0],v=l(p);p.parent=p,p.px=p.x=c/2,p.py=p.y=f/2;var d={};d.px=d.x=p.px,d.py=d.y=p.py;var m=d3.svg.diagonal(),h=d3.select(a.find("svg")[0]).attr("width",c).attr("height",f).append("g").attr("transform","translate(10, 10)"),$=h.selectAll(".node"),g=h.selectAll(".link"),x=h.selectAll(".active"),y=200,S=200;setInterval(u,y);n(function(){r.states=e.get(),t.forEach(v,function(t){var r=e.get(t.name);r&&(t.status=r.status||"exited")})},250),r.$watchCollection("states",function(t,e){var r=(e||[]).map(function(t){return t.name});i((t||[]).filter(function(t){return-1==r.indexOf(t.name)}))}),u(y)}}}var r=t.module("ct.ui.router.extras.statevis",["ct.ui.router.extras.core","ct.ui.router.extras.sticky"]);r.directive("stateVis",["$state","$timeout","$interval",e])}(),t.module("ct.ui.router.extras",["ct.ui.router.extras.core","ct.ui.router.extras.dsr","ct.ui.router.extras.future","ct.ui.router.extras.previous","ct.ui.router.extras.statevis","ct.ui.router.extras.sticky","ct.ui.router.extras.transition"])}); | ||
/** UI-Router Extras v.0.1.3 Monolithic build (all modules) http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(t,e){"use strict";"function"==typeof define&&define.amd?define(["angular"],function(t){e(t)}):e("object"==typeof exports?require("angular"):t.angular)}(this,function(t,e){function r(t,e){var r=[];for(var n in t.path){if(t.path[n]!==e.path[n])break;r.push(t.path[n])}return r}function n(e){if(Object.keys)return Object.keys(e);var r=[];return t.forEach(e,function(t,e){r.push(e)}),r}function a(t,e){var r=[];for(var n in t)e&&-1!==e.indexOf(n)||r.push(n);return r}function o(t,e){if(Array.prototype.indexOf)return t.indexOf(e,Number(arguments[2])||0);var r=t.length>>>0,n=Number(arguments[2])||0;for(n=0>n?Math.ceil(n):Math.floor(n),0>n&&(n+=r);r>n;n++)if(n in t&&t[n]===e)return n;return-1}function i(t,e,a,i){var u,s=r(a,i),c={},f=[];for(var l in s)if(s[l].params&&(u=$(s[l].params)?s[l].params:n(s[l].params),u.length))for(var p in u)o(f,u[p])>=0||(f.push(u[p]),c[u[p]]=t[u[p]]);return h({},c,e)}function u(t,e){return h(new(h(function(){},{prototype:t})),e)}function s(t){d.push(t)}function c(){b=e}function f(e,r){var n=r,a=n.inheritParams,o=(n.objectKeys,n.protoKeys),i=n.forEach,u=n.map,s={},c={},f=!1;this.registerStickyState=function(t){c[t.name]=t},this.enableDebug=this.debugMode=function(e){return t.isDefined(e)&&(f=e),f},this.$get=["$rootScope","$state","$stateParams","$injector","$log",function(e,r,n,c,l){function p(){var e={};return t.forEach(s,function(t,r){for(var n=d(t),a=0;a<n.length;a++){var o=n[a].parent;e[o.name]=e[o.name]||[],e[o.name].push(t)}e[""]&&(e.__inactives=e[""])}),e}function v(){var t={};return i(s,function(e){i(e.path,function(r){r!==e&&(t[r.name]=t[r.name]||[],t[r.name].push(e))})}),t}function d(t){var e=[];if(!t)return e;do t.sticky&&e.push(t),t=t.parent;while(t);return e.reverse(),e}function m(t,e,r,n){if(n)return"reload";var a=s[t.self.name];if(!a)return"enter";if(t.self===r)return"reload";var o=$(t.ownParams,e,a.locals.globals.$stateParams);return o?"reactivate":"reload"}function h(t,e){var r=s[t.name];if(!r)return null;if(!e)return r;var n=$(t.ownParams,e,r.locals.globals.$stateParams);return n?r:null}function $(t,e,r){return"function"==typeof t.$$equals?t.$$equals(e,r):g(e,r,t)}function g(e,r,n){if(!t.isArray(n)&&t.isObject(n)&&(n=o(n,["$$keys","$$values","$$equals","$$validates","$$new","$$parent"])),!n){n=[];for(var a in e)n.push(a)}for(var i=0;i<n.length;i++){var u=n[i];if(e[u]!=r[u])return!1}return!0}function x(t){var e=t.fromState.path,o=t.toState.path,i=t.toParams,u=0,s=o[u];for(t.options&&t.options.inherit&&(i=t.toParams=a(n,i||{},r.$current,t.toState));s&&s===e[u]&&$(s.ownParams,i,t.fromParams);)s=o[++u];return{keep:u,retained:e.slice(0,u),exiting:e.slice(u),entering:o.slice(u)}}function y(t,e){return t.name.split(".").length-e.name.split(".").length}var S={getInactiveStates:function(){return u(s,t.identity).sort(y)},getInactiveStatesByParent:function(){return p()},processTransition:function(e){function r(t){return function(e){return-1===t.indexOf(e)}}function n(t,e){return t.concat(e)}function a(t){return function(e){return e[t]}}function o(t){return function(e){return e.type===t}}function i(t){return function(e){return e.parent===t}}function u(t){return!t.sticky}var s,c,f,l=x(e),p=S.getInactiveStates(),d=l.keep,h=r(l.entering),$=l.exiting[0]&&l.exiting[0].sticky&&l.entering.length>0;c=l.exiting.map(function(t){var e=-1!==l.entering.indexOf(t),r=$&&!e?"inactivate":"exit";return{type:r,state:t}});var g=e.options&&!!e.options.reload;f=l.entering.map(function(t){var r=m(t,e.toParams,e.reloadStateTree,g);return g=g||"reload"===r,{type:r,state:t}});var b=l.entering.map(function(t){return p.filter(i(t.parent))}).reduce(n,[]).filter(h).filter(u).concat(p.filter(i(e.toState))),E=v(),k=b.map(function(t){return E[t.name]}).filter(t.isDefined).reduce(n,[]).concat(b).sort(y),P=c.filter(o("exit")).map(a("state")).concat(k);return s=p.filter(r(P)).filter(r(l.entering)).concat(c.filter(o("inactivate")).map(a("state"))).sort(y),{keep:d,enter:new Array(d).concat(f.map(a("type"))),exit:new Array(d).concat(c.map(a("type"))),inactives:s,reactivatingStates:f.filter(o("reactivate")).map(a("state")),orphans:k}},stateInactivated:function(t){s[t.self.name]=t,t.self.status="inactive",t.self.onInactivate&&c.invoke(t.self.onInactivate,t.self,t.locals.globals)},stateReactivated:function(t){s[t.self.name]&&delete s[t.self.name],t.self.status="entered",t.self.onReactivate&&c.invoke(t.self.onReactivate,t.self,t.locals.globals)},stateExiting:function(e,r,n){var a={};t.forEach(r,function(t){a[t.self.name]=!0}),t.forEach(s,function(r,n){!a[n]&&r.includes[e.name]&&(f&&l.debug("Exiting "+n+" because it's a substate of "+e.name+" and wasn't found in ",a),r.self.onExit&&c.invoke(r.self.onExit,r.self,r.locals.globals),t.forEach(r.locals,function(t,e){delete j.locals[e]}),r.locals=null,r.self.status="exited",delete s[n])}),n&&c.invoke(n,e.self,e.locals.globals),e.locals=null,e.self.status="exited",delete s[e.self.name]},stateEntering:function(t,e,r,n){var a=h(t);if(a&&(n||!h(t,e))){var o=t.locals;this.stateExiting(a),t.locals=o}t.self.status="entered",r&&c.invoke(r,t.self,t.locals.globals)},reset:function(n,a){function o(t){S.reset(t)}if("*"===n)return t.forEach(S.getInactiveStates(),o),!0;var i=r.get(n);if(!i)return!1;var u=h(i,a);return u?(S.stateExiting(u),e.$broadcast("$viewContentLoading"),!0):!1}};return S}]}function l(t){return{resolve:{},locals:{globals:P&&P.locals&&P.locals.globals},views:{},self:{},params:{},ownParams:A.hasParamSet?{$$equals:function(){return!0}}:[],surrogateType:t}}var p=t.module("ct.ui.router.extras.core",["ui.router"]),v={},d=[];p.config(["$stateProvider","$injector",function(e,r){e.decorator("parent",function(e,r){return v[e.self.name]=e,e.self.$$state=function(){return v[e.self.name]},t.forEach(d,function(t){t(e)}),r(e)})}]);var m=t.forEach,h=t.extend,$=t.isArray,g=function(t,e){"use strict";var r=[];return m(t,function(t,n){r.push(e(t,n))}),r},x=function(t){"use strict";return g(t,function(t,e){return e})},y=function(t,e){"use strict";var r=[];return m(t,function(t,n){e(t,n)&&r.push(t)}),r},S=function(t,e){"use strict";var r={};return m(t,function(t,n){e(t,n)&&(r[n]=t)}),r};p.provider("uirextras_core",function(){var e={internalStates:v,onStateRegistered:s,forEach:m,extend:h,isArray:$,map:g,keys:x,filter:y,filterObj:S,ancestors:r,objectKeys:n,protoKeys:a,arraySearch:o,inheritParams:i,inherit:u};t.extend(this,e),this.$get=function(){return e}});var b;t.module("ct.ui.router.extras.dsr",["ct.ui.router.extras.core"]).config(["$provide",function(t){var e;t.decorator("$state",["$delegate","$q",function(t,r){return e=t.transitionTo,t.transitionTo=function(n,a,o){return o&&o.ignoreDsr&&(b=o.ignoreDsr),e.apply(t,arguments).then(function(t){return c(),t},function(t){return c(),r.reject(t)})},t}])}]),t.module("ct.ui.router.extras.dsr").service("$deepStateRedirect",["$rootScope","$state","$injector",function(r,n,a){function o(t){var e=t.name;return l.hasOwnProperty(e)?l[e]:void u(e)}function i(e){var r=e.deepStateRedirect||e.dsr;if(!r)return{dsr:!1};var n={dsr:!0};return t.isFunction(r)?n.fn=r:t.isObject(r)&&(n=t.extend(n,r)),t.isString(n["default"])&&(n["default"]={state:n["default"]}),n.fn||(n.fn=["$dsr$",function(t){return t.redirect.state!=t.to.state}]),n}function u(t){var r=n.get(t);if(!r)return!1;var a=i(r);a.dsr&&(l[r.name]=p,f[t]===e&&(f[t]={}));var o=r.$$state&&r.$$state().parent;if(o){var s=u(o.self.name);s&&l[r.name]===e&&(l[r.name]=v)}return l[r.name]||!1}function s(r,n){n===!0&&(n=Object.keys(r)),null!==n&&n!==e||(n=[]);var a={};return t.forEach(n.sort(),function(t){a[t]=r[t]}),a}function c(e,r){function n(t){return t?t.toString():t}var a=s(e,r),o={};return t.forEach(a,function(t,e){o[e]=n(t)}),t.toJson(o)}var f={},l={},p="Redirect",v="AncestorRedirect";return r.$on("$stateChangeStart",function(e,r,u,l,v){var d=i(r);if(!b&&(o(r)===p||d["default"])){var m=c(u,d.params),h=f[r.name][m]||d["default"];if(h){var $={redirect:{state:h.state,params:h.params},to:{state:r.name,params:u}},g=a.invoke(d.fn,r,{$dsr$:$});if(g){g.state&&(h=g),e.preventDefault();var x=s(u,d.params);n.go(h.state,t.extend(x,h.params))}}}}),r.$on("$stateChangeSuccess",function(e,r,a,u,s){var l=o(r);if(l){var p=r.name;t.forEach(f,function(e,o){var u=i(n.get(o)),s=c(a,u.params);r.$$state().includes[o]&&(f[o][s]={state:p,params:t.copy(a)})})}}),{getRedirect:function(t,e){var r=n.get(t);o(r);var a=i(r),u=c(e,a.params),s=f[r.name];return s=s&&s[u]?s[u]:a["default"]},reset:function(e,r){if(e){var a=n.get(e);if(!a)throw new Error("Unknown state: "+e);if(f[a.name])if(r){var o=c(r,i(a).params);delete f[a.name][o]}else f[a.name]={}}else t.forEach(f,function(t,e){f[e]={}})}}}]),t.module("ct.ui.router.extras.dsr").run(["$deepStateRedirect",function(t){}]),t.module("ct.ui.router.extras.sticky",["ct.ui.router.extras.core"]);var E=t.module("ct.ui.router.extras.sticky");f.$inject=["$stateProvider","uirextras_coreProvider"],E.provider("$stickyState",f);var k,P,w,j,v={},F=[],R={},A={hasParamSet:!1};t.module("ct.ui.router.extras.sticky").run(["$stickyState",function(t){k=t}]),t.module("ct.ui.router.extras.sticky").config(["$provide","$stateProvider","$stickyStateProvider","$urlMatcherFactoryProvider","uirextras_coreProvider",function(r,n,a,o,i){function u(e,r,n){function a(t,e,r){return t[e]?t[e].toUpperCase()+": "+r.self.name:"("+r.self.name+")"}var o=d(n.inactives,function(t){return t.self.name}),i=d(r.toState.path,function(t,e){return a(n.enter,e,t)}),u=d(r.fromState.path,function(t,e){return a(n.exit,e,t)}),s=r.fromState.self.name+": "+t.toJson(r.fromParams)+": -> "+r.toState.self.name+": "+t.toJson(r.toParams);e.debug("------------------------------------------------------"),e.debug(" Current transition: ",s),e.debug("Before transition, inactives are: : ",d(k.getInactiveStates(),function(t){return t.self.name})),e.debug("After transition, inactives will be: ",o),e.debug("Transition will exit: ",u),e.debug("Transition will enter: ",i)}function s(t,e,r){t.debug("Current state: "+e.self.name+", inactive states: ",d(k.getInactiveStates(),function(t){return t.self.name}));for(var n=function(t,e){return"globals"!=e&&"resolve"!=e},a=function(t){var e=m(t.locals,n);return Object.keys(e).length||(e[""]={$$state:{name:null}}),d(e,function(e,r){return{localsFor:t.self.name?t.self.name:"(root)",uiViewName:r||null,filledByState:e.$$state.name}})},o=a(e),i=e.parent;i&&i!==e;)o=o.concat(a(i)),e=i,i=e.parent;t.debug("Views active on each state:"),console.table(o.reverse())}var c=i,f=c.internalStates,p=c.inherit,v=(c.inheritParams,c.forEach),d=c.map,m=c.filterObj;A.hasParamSet=!!o.ParamSet,j=t.extend(new l("__inactives"),{self:{name:"__inactives"}}),P=w=e,F=[],i.onStateRegistered(function(t){t.self.sticky===!0&&a.registerStickyState(t.self)});var h;r.decorator("$state",["$delegate","$log","$q",function(r,n,i){return P=r.$current,f[""]=P,P.parent=j,j.parent=e,j.locals=p(R,j.locals),P.locals=p(j.locals,P.locals),delete j.locals.globals,h=r.transitionTo,r.transitionTo=function(e,c,p){function m(e){var r=t.extend(new l("reactivate_phase1"),{locals:e.locals});return r.self=t.extend({},e.self),r}function $(e){var r=t.extend(new l("reactivate_phase2"),e),n=r.self.onEnter;return r.resolve={},r.views={},r.self.onEnter=function(){r.locals=e.locals,k.stateReactivated(e)},J.addRestoreFunction(function(){e.self.onEnter=n}),r}function g(t){var e=new l("inactivate");e.self=t.self;var r=t.self.onExit;return e.self.onExit=function(){k.stateInactivated(t)},J.addRestoreFunction(function(){t.self.onExit=r}),e}function x(t,e){var r=t.self.onEnter;return t.self.onEnter=function(){k.stateEntering(t,e,r)},J.addRestoreFunction(function(){t.self.onEnter=r}),t}function y(t,e){var r=t.self.onEnter;return t.self.onEnter=function(){k.stateEntering(t,e,r,!0)},J.addRestoreFunction(function(){t.self.onEnter=r}),t}function S(t){var e=t.self.onExit;return t.self.onExit=function(){k.stateExiting(t,K,e)},J.addRestoreFunction(function(){t.self.onExit=e}),t}var b=a.debugMode();j.locals||(j.locals=P.locals);var E=F.length;w&&(w(),b&&n.debug("Restored paths from pending transition"));var O,T,I,_,q=r.$current,M=r.params,C=p&&p.relative||r.$current,D=r.get(e,C),N=[],K=[];c=c||{},arguments[1]=c;var z=function(){},J=function(){O&&(B.path=O,O=null),T&&(q.path=T,T=null),t.forEach(J.restoreFunctions,function(t){t()}),J=z,w=null,F.splice(E,1)};if(J.restoreFunctions=[],J.addRestoreFunction=function(t){this.restoreFunctions.push(t)},D){var B=f[D.name];if(B){O=B.path,T=q.path;var L=p&&p.reload||!1,V=L&&(L===!0?O[0].self:r.get(L,C));p&&L&&L!==!0&&delete p.reload;var H={toState:B,toParams:c||{},fromState:q,fromParams:M||{},options:p,reloadStateTree:V};if(F.push(H),w=J,V){H.toParams.$$uirouterextrasreload=Math.random();var U=V.$$state().params,W=V.$$state().ownParams;if(A.hasParamSet){var Y=new o.Param("$$uirouterextrasreload");U.$$uirouterextrasreload=W.$$uirouterextrasreload=Y,J.restoreFunctions.push(function(){delete U.$$uirouterextrasreload,delete W.$$uirouterextrasreload})}else U.push("$$uirouterextrasreload"),W.push("$$uirouterextrasreload"),J.restoreFunctions.push(function(){U.length=U.length-1,W.length=W.length-1})}I=k.processTransition(H),b&&u(n,H,I);var G=B.path.slice(0,I.keep),Q=q.path.slice(0,I.keep);t.forEach(j.locals,function(t,e){-1!=e.indexOf("@")&&delete j.locals[e]});var X=function(t){return function(e,r){-1!==r.indexOf("@")&&(t[r]=e)}};v(I.inactives,function(t){v(t.locals,X(j.locals))}),v(I.reactivatingStates,function(t){v(t.locals,X(R))}),J.addRestoreFunction(function(){v(R,function(t,e){delete R[e]})}),t.forEach(I.enter,function(t,e){var r,n=B.path[e];"reactivate"===t?(r=m(n),G.push(r),Q.push(r),N.push($(n)),_=n):"reload"===t?(G.push(y(n)),_=n):"enter"===t&&G.push(x(n))}),t.forEach(I.exit,function(t,e){var r=q.path[e];"inactivate"===t?(Q.push(g(r)),K.push(r)):"exit"===t&&(Q.push(S(r)),K.push(r))}),N.length&&t.forEach(N,function(t){G.push(t)});var Z=I.orphans;Q=Q.concat(d(Z,function(t){return S(t)})),K=K.concat(Z),q.path=Q,B.path=G;var tt=function(t){return(t.surrogateType?t.surrogateType+":":"")+t.self.name};b&&n.debug("SurrogateFromPath: ",d(Q,tt)),b&&n.debug("SurrogateToPath: ",d(G,tt))}}var et=h.apply(r,arguments);return et.then(function(t){return J(),b&&s(n,f[t.name],r),t.status="active",t},function(t){return J(),b&&"transition prevented"!==t.message&&"transition aborted"!==t.message&&"transition superseded"!==t.message&&(n.debug("transition failed",t),n.debug(t.stack)),i.reject(t)})},r}])}]),function(t,e){function r(e,r,n,a){function o(e,r){var n=t.isObject(e)?e.name:e;return r?v[n]:l[n]}function i(t,e){if(e.name){var r=e.name.split(/\./);for("."===e.name.charAt(0)&&(r[0]=t.current.name);r.length;){var n=r.join(".");if(t.get(n,{relative:t.current}))return null;if(v[n])return v[n];r.pop()}}if(e.url){var a=[];for(var o in v){var i=v[o].urlMatcher;i&&i.exec(e.url)&&a.push(v[o])}for(var u=a.slice(0),s=a.length-1;s>=0;s--)for(var c=0;c<u.length;c++)a[s]===u[c].parentFutureState&&a.splice(s,1);return a[0]}}function u(t,e){function r(){delete v[e.name]}function n(t){return"remove"===l&&r(),a.reject(t)}d=!0;var a=t.get("$q");if(!e){var o=a.defer();return o.reject("No lazyState passed in "+e),o.promise}var i=a.when([]),s=e.parentFutureState;s&&v[s.name]&&(i=u(t,v[s.name]));var c=e.type,f=p[c];if(!f)throw Error("No state factory for futureState.type: "+(e&&e.type));var l=f.$options&&f.$options.failedLazyLoadPolicy||"remove";return i.then(function(n){var a=t.invoke(f,f,{futureState:e});return a.then(function(t){return r(),t&&n.push(t),n})})["catch"](n)}function s(t,r){var n=!1,a=["$rootScope","$urlRouter","$state",function(a,o,s){function f(){n=!0,o.sync(),n=!1}if(!h)return c().then(f),void(h=!0);var l=i(s,{url:r.path()});return l?void u(t,l).then(function(t){t.forEach(function(t){t&&(!s.get(t)||t.name&&!s.get(t.name))&&e.state(t)}),d=!1,f()},function(){d=!1,f()}):t.invoke(g)}];if(!d){var o=n?g:a;return t.invoke(o)}}var c,f=a,l=f.internalStates,p={},v={},d=!1,m=[],h=!1,$=this;this.addResolve=function(t){m.push(t)},this.stateFactory=function(t,e){p[t]=e},this.futureState=function(e){e.stateName&&(e.name=e.stateName),e.urlPrefix&&(e.url="^"+e.urlPrefix),v[e.name]=e;var r,a=e.name.split(/\./).slice(0,-1).join("."),i=o(e.parent||a);if(i)r=i.url||i.navigable&&i.navigable.url;else if(""===a)r=n.compile("");else{var u=o(e.parent||a,!0);if(!u)throw new Error("Couldn't determine parent state of future state. FutureState:"+t.toJson(e));var s;s=u.urlMatcher?u.urlMatcher.source.replace(/\*rest$/,""):"",r=n.compile(s),e.parentFutureState=u}e.url&&(e.urlMatcher="^"===e.url.charAt(0)?n.compile(e.url.substring(1)+"*rest"):r.concat(e.url+"*rest"))},this.get=function(){return t.extend({},v)};var g=["$log","$location",function(t,e){}];r.otherwise(s),r.otherwise=function(e){if(t.isString(e)){var n=e;e=function(){return n}}else if(!t.isFunction(e))throw new Error("'rule' must be a function");return g=["$injector","$location",e],r};var x={getResolvePromise:function(){return c()}};this.$get=["$injector","$state","$q","$rootScope","$urlRouter","$timeout","$log",function(r,n,a,o,s,f,l){function p(){if(o.$on("$stateNotFound",function(t,a,o,s){if(!d){var c=i(n,{name:a.to});if(c){t.preventDefault();var f=u(r,c);f.then(function(t){t.forEach(function(t){t&&(!n.get(t)||t.name&&!n.get(t.name))&&e.state(t)}),n.go(a.to,a.toParams,a.options),d=!1},function(t){console.log("failed to lazy load state ",t),o.name&&n.go(o,s),d=!1})}}}),!c){var l=[];t.forEach(m,function(t){l.push(r.invoke(t))}),c=function(){return a.all(l)}}c().then(function p(){f(function(){n.transition?n.transition.then(p,p):s.sync()})})}return p(),x.state=e.state,x.futureState=$.futureState,x.get=$.get,x}]}var n=t.module("ct.ui.router.extras.future",["ct.ui.router.extras.core"]);r.$inject=["$stateProvider","$urlRouterProvider","$urlMatcherFactoryProvider","uirextras_coreProvider"],n.provider("$futureState",r);var a={state:function(t){a.$rootScope&&a.$rootScope.$broadcast("$stateAdded",t)},itsNowRuntimeOhWhatAHappyDay:function(t){a.$rootScope=t},$rootScope:e};n.config(["$stateProvider",function(e){var r=e.state;e.state=function(){var n=r.apply(e,arguments),o=t.isObject(arguments[0])?arguments[0]:arguments[1];return a.state(o),n}}]),n.run(["$futureState",function(t,e){a.itsNowRuntimeOhWhatAHappyDay(e)}])}(t),t.module("ct.ui.router.extras.previous",["ct.ui.router.extras.core","ct.ui.router.extras.transition"]).service("$previousState",["$rootScope","$state","$q",function(t,r,n){var a=null,o=null,i={};t.$on("$transitionStart",function(t,e){function r(){o=null}function n(){a=o}var i=e.from,u=i.state&&i.state.$$state&&i.state.$$state();u&&(o=a,a=e.from,e.promise.then(r)["catch"](n))});var u={get:function(t){return t?i[t]:a},set:function(t,e,n){i[t]={state:r.get(e),params:n}},go:function(t,e){var a=u.get(t);return a?r.go(a.state,a.params,e):n.reject(new Error("no previous state "+(t?"for memo: "+t:"")))},memo:function(t,e,n){i[t]=a||{state:r.get(e),params:n}},forget:function(t){t?delete i[t]:a=e}};return u}]),t.module("ct.ui.router.extras.previous").run(["$previousState",function(t){}]),t.module("ct.ui.router.extras.transition",["ct.ui.router.extras.core"]).config(["$provide",function(e){e.decorator("$state",["$delegate","$rootScope","$q","$injector",function(e,r,n,a){function o(e){var r=a.invoke,n=a.instantiate;return a.invoke=function(n,a,o){return r(n,a,t.extend({$transition$:e},o))},a.instantiate=function(r,a){return n(r,t.extend({$transition$:e},a))},function(){a.invoke=r,a.instantiate=n}}function i(){p.pop()(),l.pop(),f--}function u(t,e){return function(n){return i(),r.$broadcast("$transitionSuccess",e),t.resolve(n),n}}function s(t,e){return function(a){return i(),r.$broadcast("$transitionError",e,a),t.reject(a),n.reject(a)}}var c=e.transitionTo,f=-1,l=[],p=[];return e.transitionTo=function(t,r,a){var o=n.defer(),i=l[++f]={promise:o.promise};p[f]=function(){};var v=c.apply(e,arguments);return v.then(u(o,i),s(o,i))},r.$on("$stateChangeStart",function(e,n,a,i,u){if(!(f>=l.length)){var s=f,c=t.extend(l[s],{to:{state:n,params:a},from:{state:i,params:u}}),v=o(c);p[s]=v,r.$broadcast("$transitionStart",c)}}),e}])}]),function(){"use strict";function e(e,r,n){return{scope:{width:"@",height:"@"},restrict:"AE",template:"<svg></svg>",link:function(r,a,o){function i(e){e=e.map(function(e){return""===e.name?p:t.copy(e)}),t.extend(s,e.reduce(function(t,e){return t[e.name]=e,t},{})),e.forEach(function(t){var e=t.name.split(/\./).slice(0,-1).join("."),r=t.name!=e&&s[e];r&&((r.children||(r.children=[])).push(t),t.px=r.px,t.py=r.py,v.push(t))})}function u(){function t(t){var e=t.name.split(".").pop();return t.sticky&&(e+=" (STICKY)"),t.deepStateRedirect&&(e+=" (DSR)"),e}$=$.data(l.nodes(p),function(t){return t.name}),g=g.data(l.links(v),function(t){return t.target.name}),x=x.data(d),v.forEach(function(t){t.y=70*t.depth});var e=$.enter();x.enter().append("circle").attr("class","active").attr("r",13).attr("cx",function(t){return t.parent.px||100}).attr("cy",function(t){return t.parent.py||100}),e.append("circle").attr("class","node").attr("r",9).attr("cx",function(t){return t.parent.px}).attr("cy",function(t){return t.parent.py}),e.append("text").attr("class","label").attr("x",function(t){return t.parent.px}).attr("y",function(t){return t.parent.py}).attr("text-anchor",function(t){return"middle"}).text(t).style("fill-opacity",1),g.enter().insert("path",".node").attr("class","link").attr("d",function(t){var e={x:t.source.px,y:t.source.py};return m({source:e,target:e})});var r=h.transition().duration(S);r.selectAll(".link").attr("d",m);var n={entered:"#AF0",exited:"#777",active:"#0f0",inactive:"#55F",future:"#009"};r.selectAll(".node").attr("cx",function(t){return t.px=t.x}).attr("cy",function(t){return t.py=t.y}).attr("r",function(t){return"active"===t.status?15:10}).style("fill",function(t){return n[t.status]||"#FFF"}),r.selectAll(".label").attr("x",function(t){return t.px=t.x}).attr("y",function(t){return t.py=t.y-15}).attr("transform",function(t){return"rotate(-25 "+t.x+" "+t.y+")"}),r.selectAll(".active").attr("x",function(t){return t.px=t.x}).attr("y",function(t){return t.py=t.y-15})}var s={},c=r.width||400,f=r.height||400,l=d3.layout.tree().size([c-20,f-20]).separation(function(t,e){return t.parent==e.parent?10:25}),p=e.get().filter(function(t){return""===t.name})[0],v=l(p);p.parent=p,p.px=p.x=c/2,p.py=p.y=f/2;var d={};d.px=d.x=p.px,d.py=d.y=p.py;var m=d3.svg.diagonal(),h=d3.select(a.find("svg")[0]).attr("width",c).attr("height",f).append("g").attr("transform","translate(10, 10)"),$=h.selectAll(".node"),g=h.selectAll(".link"),x=h.selectAll(".active"),y=200,S=200;setInterval(u,y);n(function(){r.states=e.get(),t.forEach(v,function(t){var r=e.get(t.name);r&&(t.status=r.status||"exited")})},250),r.$watchCollection("states",function(t,e){var r=(e||[]).map(function(t){return t.name});i((t||[]).filter(function(t){return-1==r.indexOf(t.name)}))}),u(y)}}}var r=t.module("ct.ui.router.extras.statevis",["ct.ui.router.extras.core","ct.ui.router.extras.sticky"]);r.directive("stateVis",["$state","$timeout","$interval",e])}(),t.module("ct.ui.router.extras",["ct.ui.router.extras.core","ct.ui.router.extras.dsr","ct.ui.router.extras.future","ct.ui.router.extras.previous","ct.ui.router.extras.statevis","ct.ui.router.extras.sticky","ct.ui.router.extras.transition"])}); |
/** | ||
* UI-Router Extras: Sticky states, Future States, Deep State Redirect, Transition promise | ||
* Module: core | ||
* @version 0.1.2 | ||
* @version 0.1.3 | ||
* @link http://christopherthielen.github.io/ui-router-extras/ | ||
@@ -6,0 +6,0 @@ * @license MIT License, http://www.opensource.org/licenses/MIT |
@@ -1,2 +0,2 @@ | ||
/** UI-Router Extras v.0.1.2 Module: core http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
/** UI-Router Extras v.0.1.3 Module: core http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(r,n){"use strict";function t(r,n){var t=[];for(var e in r.path){if(r.path[e]!==n.path[e])break;t.push(r.path[e])}return t}function e(n){if(Object.keys)return Object.keys(n);var t=[];return r.forEach(n,function(r,n){t.push(n)}),t}function i(r,n){var t=[];for(var e in r)n&&-1!==n.indexOf(e)||t.push(e);return t}function u(r,n){if(Array.prototype.indexOf)return r.indexOf(n,Number(arguments[2])||0);var t=r.length>>>0,e=Number(arguments[2])||0;for(e=0>e?Math.ceil(e):Math.floor(e),0>e&&(e+=t);t>e;e++)if(e in r&&r[e]===n)return e;return-1}function a(r,n,i,a){var o,f=t(i,a),c={},s=[];for(var h in f)if(f[h].params&&(o=l(f[h].params)?f[h].params:e(f[h].params),o.length))for(var p in o)u(s,o[p])>=0||(s.push(o[p]),c[o[p]]=r[o[p]]);return v({},c,n)}function o(r,n){return v(new(v(function(){},{prototype:r})),n)}function f(r){h.push(r)}var c=r.module("ct.ui.router.extras.core",["ui.router"]),s={},h=[];c.config(["$stateProvider","$injector",function(n,t){n.decorator("parent",function(n,t){return s[n.self.name]=n,n.self.$$state=function(){return s[n.self.name]},r.forEach(h,function(r){r(n)}),t(n)})}]);var p=r.forEach,v=r.extend,l=r.isArray,d=function(r,n){var t=[];return p(r,function(r,e){t.push(n(r,e))}),t},m=function(r){return d(r,function(r,n){return n})},y=function(r,n){var t=[];return p(r,function(r,e){n(r,e)&&t.push(r)}),t},x=function(r,n){var t={};return p(r,function(r,e){n(r,e)&&(t[e]=r)}),t};c.provider("uirextras_core",function(){var n={internalStates:s,onStateRegistered:f,forEach:p,extend:v,isArray:l,map:d,keys:m,filter:y,filterObj:x,ancestors:t,objectKeys:e,protoKeys:i,arraySearch:u,inheritParams:a,inherit:o};r.extend(this,n),this.$get=function(){return n}})}(angular); |
/** | ||
* UI-Router Extras: Sticky states, Future States, Deep State Redirect, Transition promise | ||
* Module: dsr | ||
* @version 0.1.2 | ||
* @version 0.1.3 | ||
* @link http://christopherthielen.github.io/ui-router-extras/ | ||
@@ -22,3 +22,3 @@ * @license MIT License, http://www.opensource.org/licenses/MIT | ||
$state.transitionTo = function (to, toParams, options) { | ||
if (options.ignoreDsr) { | ||
if (options && options.ignoreDsr) { | ||
ignoreDsr = options.ignoreDsr; | ||
@@ -155,3 +155,8 @@ } | ||
var key = getParamsString(params, cfg.params); | ||
var redirect = lastSubstate[state.name][key] || cfg['default']; | ||
var redirect = lastSubstate[state.name]; | ||
if (redirect && redirect[key]) { | ||
redirect = redirect[key]; | ||
} else { | ||
redirect = cfg['default']; | ||
} | ||
return redirect; | ||
@@ -158,0 +163,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
/** UI-Router Extras v.0.1.2 Module: dsr http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(t,e){"use strict";function r(){n=e}var n;t.module("ct.ui.router.extras.dsr",["ct.ui.router.extras.core"]).config(["$provide",function(t){var e;t.decorator("$state",["$delegate","$q",function(t,a){return e=t.transitionTo,t.transitionTo=function(o,i,u){return u.ignoreDsr&&(n=u.ignoreDsr),e.apply(t,arguments).then(function(t){return r(),t},function(t){return r(),a.reject(t)})},t}])}]),t.module("ct.ui.router.extras.dsr").service("$deepStateRedirect",["$rootScope","$state","$injector",function(r,a,o){function i(t){var e=t.name;return v.hasOwnProperty(e)?v[e]:void s(e)}function u(e){var r=e.deepStateRedirect||e.dsr;if(!r)return{dsr:!1};var n={dsr:!0};return t.isFunction(r)?n.fn=r:t.isObject(r)&&(n=t.extend(n,r)),t.isString(n["default"])&&(n["default"]={state:n["default"]}),n.fn||(n.fn=["$dsr$",function(t){return t.redirect.state!=t.to.state}]),n}function s(t){var r=a.get(t);if(!r)return!1;var n=u(r);n.dsr&&(v[r.name]=m,d[t]===e&&(d[t]={}));var o=r.$$state&&r.$$state().parent;if(o){var i=s(o.self.name);i&&v[r.name]===e&&(v[r.name]=$)}return v[r.name]||!1}function c(r,n){n===!0&&(n=Object.keys(r)),null!==n&&n!==e||(n=[]);var a={};return t.forEach(n.sort(),function(t){a[t]=r[t]}),a}function f(e,r){function n(t){return t?t.toString():t}var a=c(e,r),o={};return t.forEach(a,function(t,e){o[e]=n(t)}),t.toJson(o)}var d={},v={},m="Redirect",$="AncestorRedirect";return r.$on("$stateChangeStart",function(e,r,s,v,$){var p=u(r);if(!n&&(i(r)===m||p["default"])){var l=f(s,p.params),g=d[r.name][l]||p["default"];if(g){var h={redirect:{state:g.state,params:g.params},to:{state:r.name,params:s}},S=o.invoke(p.fn,r,{$dsr$:h});if(S){S.state&&(g=S),e.preventDefault();var x=c(s,p.params);a.go(g.state,t.extend(x,g.params))}}}}),r.$on("$stateChangeSuccess",function(e,r,n,o,s){var c=i(r);if(c){var v=r.name;t.forEach(d,function(e,o){var i=u(a.get(o)),s=f(n,i.params);r.$$state().includes[o]&&(d[o][s]={state:v,params:t.copy(n)})})}}),{getRedirect:function(t,e){var r=a.get(t);i(r);var n=u(r),o=f(e,n.params),s=d[r.name][o]||n["default"];return s},reset:function(e,r){if(e){var n=a.get(e);if(!n)throw new Error("Unknown state: "+e);if(d[n.name])if(r){var o=f(r,u(n).params);delete d[n.name][o]}else d[n.name]={}}else t.forEach(d,function(t,e){d[e]={}})}}}]),t.module("ct.ui.router.extras.dsr").run(["$deepStateRedirect",function(t){}])}(angular); | ||
/** UI-Router Extras v.0.1.3 Module: dsr http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(t,e){"use strict";function r(){n=e}var n;t.module("ct.ui.router.extras.dsr",["ct.ui.router.extras.core"]).config(["$provide",function(t){var e;t.decorator("$state",["$delegate","$q",function(t,a){return e=t.transitionTo,t.transitionTo=function(o,i,u){return u&&u.ignoreDsr&&(n=u.ignoreDsr),e.apply(t,arguments).then(function(t){return r(),t},function(t){return r(),a.reject(t)})},t}])}]),t.module("ct.ui.router.extras.dsr").service("$deepStateRedirect",["$rootScope","$state","$injector",function(r,a,o){function i(t){var e=t.name;return v.hasOwnProperty(e)?v[e]:void s(e)}function u(e){var r=e.deepStateRedirect||e.dsr;if(!r)return{dsr:!1};var n={dsr:!0};return t.isFunction(r)?n.fn=r:t.isObject(r)&&(n=t.extend(n,r)),t.isString(n["default"])&&(n["default"]={state:n["default"]}),n.fn||(n.fn=["$dsr$",function(t){return t.redirect.state!=t.to.state}]),n}function s(t){var r=a.get(t);if(!r)return!1;var n=u(r);n.dsr&&(v[r.name]=m,d[t]===e&&(d[t]={}));var o=r.$$state&&r.$$state().parent;if(o){var i=s(o.self.name);i&&v[r.name]===e&&(v[r.name]=$)}return v[r.name]||!1}function c(r,n){n===!0&&(n=Object.keys(r)),null!==n&&n!==e||(n=[]);var a={};return t.forEach(n.sort(),function(t){a[t]=r[t]}),a}function f(e,r){function n(t){return t?t.toString():t}var a=c(e,r),o={};return t.forEach(a,function(t,e){o[e]=n(t)}),t.toJson(o)}var d={},v={},m="Redirect",$="AncestorRedirect";return r.$on("$stateChangeStart",function(e,r,s,v,$){var p=u(r);if(!n&&(i(r)===m||p["default"])){var l=f(s,p.params),g=d[r.name][l]||p["default"];if(g){var h={redirect:{state:g.state,params:g.params},to:{state:r.name,params:s}},S=o.invoke(p.fn,r,{$dsr$:h});if(S){S.state&&(g=S),e.preventDefault();var x=c(s,p.params);a.go(g.state,t.extend(x,g.params))}}}}),r.$on("$stateChangeSuccess",function(e,r,n,o,s){var c=i(r);if(c){var v=r.name;t.forEach(d,function(e,o){var i=u(a.get(o)),s=f(n,i.params);r.$$state().includes[o]&&(d[o][s]={state:v,params:t.copy(n)})})}}),{getRedirect:function(t,e){var r=a.get(t);i(r);var n=u(r),o=f(e,n.params),s=d[r.name];return s=s&&s[o]?s[o]:n["default"]},reset:function(e,r){if(e){var n=a.get(e);if(!n)throw new Error("Unknown state: "+e);if(d[n.name])if(r){var o=f(r,u(n).params);delete d[n.name][o]}else d[n.name]={}}else t.forEach(d,function(t,e){d[e]={}})}}}]),t.module("ct.ui.router.extras.dsr").run(["$deepStateRedirect",function(t){}])}(angular); |
/** | ||
* UI-Router Extras: Sticky states, Future States, Deep State Redirect, Transition promise | ||
* Module: future | ||
* @version 0.1.2 | ||
* @version 0.1.3 | ||
* @link http://christopherthielen.github.io/ui-router-extras/ | ||
@@ -6,0 +6,0 @@ * @license MIT License, http://www.opensource.org/licenses/MIT |
@@ -1,2 +0,2 @@ | ||
/** UI-Router Extras v.0.1.2 Module: future http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
/** UI-Router Extras v.0.1.3 Module: future http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(t,e){"use strict";!function(t,e){function r(e,r,n,o){function a(e,r){var n=t.isObject(e)?e.name:e;return r?h[n]:l[n]}function u(t,e){if(e.name){var r=e.name.split(/\./);for("."===e.name.charAt(0)&&(r[0]=t.current.name);r.length;){var n=r.join(".");if(t.get(n,{relative:t.current}))return null;if(h[n])return h[n];r.pop()}}if(e.url){var o=[];for(var a in h){var u=h[a].urlMatcher;u&&u.exec(e.url)&&o.push(h[a])}for(var i=o.slice(0),c=o.length-1;c>=0;c--)for(var f=0;f<i.length;f++)o[c]===i[f].parentFutureState&&o.splice(c,1);return o[0]}}function i(t,e){function r(){delete h[e.name]}function n(t){return"remove"===l&&r(),o.reject(t)}p=!0;var o=t.get("$q");if(!e){var a=o.defer();return a.reject("No lazyState passed in "+e),a.promise}var u=o.when([]),c=e.parentFutureState;c&&h[c.name]&&(u=i(t,h[c.name]));var f=e.type,s=v[f];if(!s)throw Error("No state factory for futureState.type: "+(e&&e.type));var l=s.$options&&s.$options.failedLazyLoadPolicy||"remove";return u.then(function(n){var o=t.invoke(s,s,{futureState:e});return o.then(function(t){return r(),t&&n.push(t),n})})["catch"](n)}function c(t,r){var n=!1,o=["$rootScope","$urlRouter","$state",function(o,a,c){function s(){n=!0,a.sync(),n=!1}if(!m)return f().then(s),void(m=!0);var l=u(c,{url:r.path()});return l?void i(t,l).then(function(t){t.forEach(function(t){t&&(!c.get(t)||t.name&&!c.get(t.name))&&e.state(t)}),p=!1,s()},function(){p=!1,s()}):t.invoke(g)}];if(!p){var a=n?g:o;return t.invoke(a)}}var f,s=o,l=s.internalStates,v={},h={},p=!1,$=[],m=!1,d=this;this.addResolve=function(t){$.push(t)},this.stateFactory=function(t,e){v[t]=e},this.futureState=function(e){e.stateName&&(e.name=e.stateName),e.urlPrefix&&(e.url="^"+e.urlPrefix),h[e.name]=e;var r,o=e.name.split(/\./).slice(0,-1).join("."),u=a(e.parent||o);if(u)r=u.url||u.navigable&&u.navigable.url;else if(""===o)r=n.compile("");else{var i=a(e.parent||o,!0);if(!i)throw new Error("Couldn't determine parent state of future state. FutureState:"+t.toJson(e));var c;c=i.urlMatcher?i.urlMatcher.source.replace(/\*rest$/,""):"",r=n.compile(c),e.parentFutureState=i}e.url&&(e.urlMatcher="^"===e.url.charAt(0)?n.compile(e.url.substring(1)+"*rest"):r.concat(e.url+"*rest"))},this.get=function(){return t.extend({},h)};var g=["$log","$location",function(t,e){}];r.otherwise(c),r.otherwise=function(e){if(t.isString(e)){var n=e;e=function(){return n}}else if(!t.isFunction(e))throw new Error("'rule' must be a function");return g=["$injector","$location",e],r};var S={getResolvePromise:function(){return f()}};this.$get=["$injector","$state","$q","$rootScope","$urlRouter","$timeout","$log",function(r,n,o,a,c,s,l){function v(){if(a.$on("$stateNotFound",function(t,o,a,c){if(!p){var f=u(n,{name:o.to});if(f){t.preventDefault();var s=i(r,f);s.then(function(t){t.forEach(function(t){t&&(!n.get(t)||t.name&&!n.get(t.name))&&e.state(t)}),n.go(o.to,o.toParams,o.options),p=!1},function(t){console.log("failed to lazy load state ",t),a.name&&n.go(a,c),p=!1})}}}),!f){var l=[];t.forEach($,function(t){l.push(r.invoke(t))}),f=function(){return o.all(l)}}f().then(function v(){s(function(){n.transition?n.transition.then(v,v):c.sync()})})}return v(),S.state=e.state,S.futureState=d.futureState,S.get=d.get,S}]}var n=t.module("ct.ui.router.extras.future",["ct.ui.router.extras.core"]);r.$inject=["$stateProvider","$urlRouterProvider","$urlMatcherFactoryProvider","uirextras_coreProvider"],n.provider("$futureState",r);var o={state:function(t){o.$rootScope&&o.$rootScope.$broadcast("$stateAdded",t)},itsNowRuntimeOhWhatAHappyDay:function(t){o.$rootScope=t},$rootScope:e};n.config(["$stateProvider",function(e){var r=e.state;e.state=function(){var n=r.apply(e,arguments),a=t.isObject(arguments[0])?arguments[0]:arguments[1];return o.state(a),n}}]),n.run(["$futureState",function(t,e){o.itsNowRuntimeOhWhatAHappyDay(e)}])}(t)}(angular); |
/** | ||
* UI-Router Extras: Sticky states, Future States, Deep State Redirect, Transition promise | ||
* Module: previous | ||
* @version 0.1.2 | ||
* @version 0.1.3 | ||
* @link http://christopherthielen.github.io/ui-router-extras/ | ||
@@ -6,0 +6,0 @@ * @license MIT License, http://www.opensource.org/licenses/MIT |
@@ -1,2 +0,2 @@ | ||
/** UI-Router Extras v.0.1.2 Module: previous http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
/** UI-Router Extras v.0.1.3 Module: previous http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(t,e){"use strict";t.module("ct.ui.router.extras.previous",["ct.ui.router.extras.core","ct.ui.router.extras.transition"]).service("$previousState",["$rootScope","$state","$q",function(t,r,o){var n=null,u=null,a={};t.$on("$transitionStart",function(t,e){function r(){u=null}function o(){n=u}var a=e.from,s=a.state&&a.state.$$state&&a.state.$$state();s&&(u=n,n=e.from,e.promise.then(r)["catch"](o))});var s={get:function(t){return t?a[t]:n},set:function(t,e,o){a[t]={state:r.get(e),params:o}},go:function(t,e){var n=s.get(t);return n?r.go(n.state,n.params,e):o.reject(new Error("no previous state "+(t?"for memo: "+t:"")))},memo:function(t,e,o){a[t]=n||{state:r.get(e),params:o}},forget:function(t){t?delete a[t]:n=e}};return s}]),t.module("ct.ui.router.extras.previous").run(["$previousState",function(t){}])}(angular); |
/** | ||
* UI-Router Extras: Sticky states, Future States, Deep State Redirect, Transition promise | ||
* Module: statevis | ||
* @version 0.1.2 | ||
* @version 0.1.3 | ||
* @link http://christopherthielen.github.io/ui-router-extras/ | ||
@@ -6,0 +6,0 @@ * @license MIT License, http://www.opensource.org/licenses/MIT |
@@ -1,2 +0,2 @@ | ||
/** UI-Router Extras v.0.1.2 Module: statevis http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
/** UI-Router Extras v.0.1.3 Module: statevis http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(t,e){"use strict";!function(){function e(e,n,r){return{scope:{width:"@",height:"@"},restrict:"AE",template:"<svg></svg>",link:function(n,a,i){function c(e){e=e.map(function(e){return""===e.name?f:t.copy(e)}),t.extend(o,e.reduce(function(t,e){return t[e.name]=e,t},{})),e.forEach(function(t){var e=t.name.split(/\./).slice(0,-1).join("."),n=t.name!=e&&o[e];n&&((n.children||(n.children=[])).push(t),t.px=n.px,t.py=n.py,d.push(t))})}function u(){function t(t){var e=t.name.split(".").pop();return t.sticky&&(e+=" (STICKY)"),t.deepStateRedirect&&(e+=" (DSR)"),e}h=h.data(p.nodes(f),function(t){return t.name}),m=m.data(p.links(d),function(t){return t.target.name}),g=g.data(x),d.forEach(function(t){t.y=70*t.depth});var e=h.enter();g.enter().append("circle").attr("class","active").attr("r",13).attr("cx",function(t){return t.parent.px||100}).attr("cy",function(t){return t.parent.py||100}),e.append("circle").attr("class","node").attr("r",9).attr("cx",function(t){return t.parent.px}).attr("cy",function(t){return t.parent.py}),e.append("text").attr("class","label").attr("x",function(t){return t.parent.px}).attr("y",function(t){return t.parent.py}).attr("text-anchor",function(t){return"middle"}).text(t).style("fill-opacity",1),m.enter().insert("path",".node").attr("class","link").attr("d",function(t){var e={x:t.source.px,y:t.source.py};return y({source:e,target:e})});var n=v.transition().duration(k);n.selectAll(".link").attr("d",y);var r={entered:"#AF0",exited:"#777",active:"#0f0",inactive:"#55F",future:"#009"};n.selectAll(".node").attr("cx",function(t){return t.px=t.x}).attr("cy",function(t){return t.py=t.y}).attr("r",function(t){return"active"===t.status?15:10}).style("fill",function(t){return r[t.status]||"#FFF"}),n.selectAll(".label").attr("x",function(t){return t.px=t.x}).attr("y",function(t){return t.py=t.y-15}).attr("transform",function(t){return"rotate(-25 "+t.x+" "+t.y+")"}),n.selectAll(".active").attr("x",function(t){return t.px=t.x}).attr("y",function(t){return t.py=t.y-15})}var o={},s=n.width||400,l=n.height||400,p=d3.layout.tree().size([s-20,l-20]).separation(function(t,e){return t.parent==e.parent?10:25}),f=e.get().filter(function(t){return""===t.name})[0],d=p(f);f.parent=f,f.px=f.x=s/2,f.py=f.y=l/2;var x={};x.px=x.x=f.px,x.py=x.y=f.py;var y=d3.svg.diagonal(),v=d3.select(a.find("svg")[0]).attr("width",s).attr("height",l).append("g").attr("transform","translate(10, 10)"),h=v.selectAll(".node"),m=v.selectAll(".link"),g=v.selectAll(".active"),A=200,k=200;setInterval(u,A);r(function(){n.states=e.get(),t.forEach(d,function(t){var n=e.get(t.name);n&&(t.status=n.status||"exited")})},250),n.$watchCollection("states",function(t,e){var n=(e||[]).map(function(t){return t.name});c((t||[]).filter(function(t){return-1==n.indexOf(t.name)}))}),u(A)}}}var n=t.module("ct.ui.router.extras.statevis",["ct.ui.router.extras.core","ct.ui.router.extras.sticky"]);n.directive("stateVis",["$state","$timeout","$interval",e])}()}(angular); |
/** | ||
* UI-Router Extras: Sticky states, Future States, Deep State Redirect, Transition promise | ||
* Module: sticky | ||
* @version 0.1.2 | ||
* @version 0.1.3 | ||
* @link http://christopherthielen.github.io/ui-router-extras/ | ||
@@ -162,6 +162,9 @@ * @license MIT License, http://www.opensource.org/licenses/MIT | ||
function sortByStateDepth(a,b) { | ||
return a.name.split(".").length - b.name.split(".").length; | ||
} | ||
var stickySupport = { | ||
getInactiveStates: function () { | ||
return map(inactiveStates, angular.identity); | ||
return map(inactiveStates, angular.identity).sort(sortByStateDepth); | ||
}, | ||
@@ -184,3 +187,3 @@ getInactiveStatesByParent: function () { | ||
var treeChanges = calcTreeChanges(transition); | ||
var currentInactives = map(inactiveStates, angular.identity); | ||
var currentInactives = stickySupport.getInactiveStates(); | ||
var futureInactives, exitingTypes, enteringTypes; | ||
@@ -273,3 +276,3 @@ var keep = treeChanges.keep; | ||
// Sort by depth to exit orphans in proper order | ||
.sort(function (a,b) { return a.name.split(".").length - b.name.split(".").length; }); | ||
.sort(sortByStateDepth); | ||
@@ -288,3 +291,4 @@ // Add them to the list of states being exited. | ||
.filter(notIn(treeChanges.entering)) | ||
.concat(exitingTypes.filter(typeIs("inactivate")).map(prop("state"))); | ||
.concat(exitingTypes.filter(typeIs("inactivate")).map(prop("state"))) | ||
.sort(sortByStateDepth); | ||
@@ -909,21 +913,26 @@ return { | ||
var viewMsg = function (local, name) { | ||
return "'" + name + "' (" + local.$$state.name + ")"; | ||
}; | ||
var statesOnly = function (local, name) { | ||
return name != 'globals' && name != 'resolve'; | ||
}; | ||
var viewsForState = function (state) { | ||
var views = map(filterObj(state.locals, statesOnly), viewMsg).join(", "); | ||
return "(" + (state.self.name ? state.self.name : "root") + ".locals" + (views.length ? ": " + views : "") + ")"; | ||
var viewLocals = filterObj(state.locals, statesOnly); | ||
if (!Object.keys(viewLocals).length) { | ||
viewLocals[''] = { $$state: { name: null } }; | ||
} | ||
return map(viewLocals, function(local, name) { | ||
return { | ||
localsFor: state.self.name ? state.self.name : "(root)", | ||
uiViewName: name || null, | ||
filledByState: local.$$state.name | ||
}; | ||
}); | ||
}; | ||
var message = viewsForState(currentState); | ||
var viewsByState = viewsForState(currentState); | ||
var parent = currentState.parent; | ||
while (parent && parent !== currentState) { | ||
if (parent.self.name === "") { | ||
// Show the __inactives before showing root state. | ||
message = viewsForState($state.$current.path[0]) + " / " + message; | ||
} | ||
message = viewsForState(parent) + " / " + message; | ||
viewsByState = viewsByState.concat(viewsForState(parent)); | ||
currentState = parent; | ||
@@ -933,3 +942,4 @@ parent = currentState.parent; | ||
$log.debug("Views: " + message); | ||
$log.debug("Views active on each state:"); | ||
console.table(viewsByState.reverse()); | ||
} | ||
@@ -936,0 +946,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/** UI-Router Extras v.0.1.2 Module: sticky http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(e,t){"use strict";function n(t,n){var r=n,a=r.inheritParams,i=(r.objectKeys,r.protoKeys),o=r.forEach,s=r.map,c={},l={},f=!1;this.registerStickyState=function(e){l[e.name]=e},this.enableDebug=this.debugMode=function(t){return e.isDefined(t)&&(f=t),f},this.$get=["$rootScope","$state","$stateParams","$injector","$log",function(t,n,r,l,v){function d(){var t={};return e.forEach(c,function(e,n){for(var r=m(e),a=0;a<r.length;a++){var i=r[a].parent;t[i.name]=t[i.name]||[],t[i.name].push(e)}t[""]&&(t.__inactives=t[""])}),t}function p(){var e={};return o(c,function(t){o(t.path,function(n){n!==t&&(e[n.name]=e[n.name]||[],e[n.name].push(t))})}),e}function m(e){var t=[];if(!e)return t;do e.sticky&&t.push(e),e=e.parent;while(e);return t.reverse(),t}function g(e,t,n,r){if(r)return"reload";var a=c[e.self.name];if(!a)return"enter";if(e.self===n)return"reload";var i=$(e.ownParams,t,a.locals.globals.$stateParams);return i?"reactivate":"reload"}function h(e,t){var n=c[e.name];if(!n)return null;if(!t)return n;var r=$(e.ownParams,t,n.locals.globals.$stateParams);return r?n:null}function $(e,t,n){return"function"==typeof e.$$equals?e.$$equals(t,n):x(t,n,e)}function x(t,n,r){if(!e.isArray(r)&&e.isObject(r)&&(r=i(r,["$$keys","$$values","$$equals","$$validates","$$new","$$parent"])),!r){r=[];for(var a in t)r.push(a)}for(var o=0;o<r.length;o++){var s=r[o];if(t[s]!=n[s])return!1}return!0}function b(e){var t=e.fromState.path,i=e.toState.path,o=e.toParams,s=0,u=i[s];for(e.options&&e.options.inherit&&(o=e.toParams=a(r,o||{},n.$current,e.toState));u&&u===t[s]&&$(u.ownParams,o,e.fromParams);)u=i[++s];return{keep:s,retained:t.slice(0,s),exiting:t.slice(s),entering:i.slice(s)}}var E={getInactiveStates:function(){return s(c,e.identity)},getInactiveStatesByParent:function(){return d()},processTransition:function(t){function n(e){return function(t){return-1===e.indexOf(t)}}function r(e,t){return e.concat(t)}function a(e){return function(t){return t[e]}}function i(e){return function(t){return t.type===e}}function o(e){return function(t){return t.parent===e}}function u(e){return!e.sticky}var l,f,v,d=b(t),m=s(c,e.identity),h=d.keep,$=n(d.entering),x=d.exiting[0]&&d.exiting[0].sticky&&d.entering.length>0;f=d.exiting.map(function(e){var t=-1!==d.entering.indexOf(e),n=x&&!t?"inactivate":"exit";return{type:n,state:e}});var E=t.options&&!!t.options.reload;v=d.entering.map(function(e){var n=g(e,t.toParams,t.reloadStateTree,E);return E=E||"reload"===n,{type:n,state:e}});var S=d.entering.map(function(e){return m.filter(o(e.parent))}).reduce(r,[]).filter($).filter(u).concat(m.filter(o(t.toState))),P=p(),y=S.map(function(e){return P[e.name]}).filter(e.isDefined).reduce(r,[]).concat(S).sort(function(e,t){return e.name.split(".").length-t.name.split(".").length}),k=f.filter(i("exit")).map(a("state")).concat(y);return l=m.filter(n(k)).filter(n(d.entering)).concat(f.filter(i("inactivate")).map(a("state"))),{keep:h,enter:new Array(h).concat(v.map(a("type"))),exit:new Array(h).concat(f.map(a("type"))),inactives:l,reactivatingStates:v.filter(i("reactivate")).map(a("state")),orphans:y}},stateInactivated:function(e){c[e.self.name]=e,e.self.status="inactive",e.self.onInactivate&&l.invoke(e.self.onInactivate,e.self,e.locals.globals)},stateReactivated:function(e){c[e.self.name]&&delete c[e.self.name],e.self.status="entered",e.self.onReactivate&&l.invoke(e.self.onReactivate,e.self,e.locals.globals)},stateExiting:function(t,n,r){var a={};e.forEach(n,function(e){a[e.self.name]=!0}),e.forEach(c,function(n,r){!a[r]&&n.includes[t.name]&&(f&&v.debug("Exiting "+r+" because it's a substate of "+t.name+" and wasn't found in ",a),n.self.onExit&&l.invoke(n.self.onExit,n.self,n.locals.globals),e.forEach(n.locals,function(e,t){delete u.locals[t]}),n.locals=null,n.self.status="exited",delete c[r])}),r&&l.invoke(r,t.self,t.locals.globals),t.locals=null,t.self.status="exited",delete c[t.self.name]},stateEntering:function(e,t,n,r){var a=h(e);if(a&&(r||!h(e,t))){var i=e.locals;this.stateExiting(a),e.locals=i}e.self.status="entered",n&&l.invoke(n,e.self,e.locals.globals)},reset:function(r,a){function i(e){E.reset(e)}if("*"===r)return e.forEach(E.getInactiveStates(),i),!0;var o=n.get(r);if(!o)return!1;var s=h(o,a);return s?(E.stateExiting(s),t.$broadcast("$viewContentLoading"),!0):!1}};return E}]}function r(e){return{resolve:{},locals:{globals:o&&o.locals&&o.locals.globals},views:{},self:{},params:{},ownParams:f.hasParamSet?{$$equals:function(){return!0}}:[],surrogateType:e}}e.module("ct.ui.router.extras.sticky",["ct.ui.router.extras.core"]);var a=e.module("ct.ui.router.extras.sticky");n.$inject=["$stateProvider","uirextras_coreProvider"],a.provider("$stickyState",n);var i,o,s,u,c=[],l={},f={hasParamSet:!1};e.module("ct.ui.router.extras.sticky").run(["$stickyState",function(e){i=e}]),e.module("ct.ui.router.extras.sticky").config(["$provide","$stateProvider","$stickyStateProvider","$urlMatcherFactoryProvider","uirextras_coreProvider",function(n,a,v,d,p){function m(t,n,r){function a(e,t,n){return e[t]?e[t].toUpperCase()+": "+n.self.name:"("+n.self.name+")"}var o=E(r.inactives,function(e){return e.self.name}),s=E(n.toState.path,function(e,t){return a(r.enter,t,e)}),u=E(n.fromState.path,function(e,t){return a(r.exit,t,e)}),c=n.fromState.self.name+": "+e.toJson(n.fromParams)+": -> "+n.toState.self.name+": "+e.toJson(n.toParams);t.debug("------------------------------------------------------"),t.debug(" Current transition: ",c),t.debug("Before transition, inactives are: : ",E(i.getInactiveStates(),function(e){return e.self.name})),t.debug("After transition, inactives will be: ",o),t.debug("Transition will exit: ",u),t.debug("Transition will enter: ",s)}function g(e,t,n){e.debug("Current state: "+t.self.name+", inactive states: ",E(i.getInactiveStates(),function(e){return e.self.name}));for(var r=function(e,t){return"'"+t+"' ("+e.$$state.name+")"},a=function(e,t){return"globals"!=t&&"resolve"!=t},o=function(e){var t=E(S(e.locals,a),r).join(", ");return"("+(e.self.name?e.self.name:"root")+".locals"+(t.length?": "+t:"")+")"},s=o(t),u=t.parent;u&&u!==t;)""===u.self.name&&(s=o(n.$current.path[0])+" / "+s),s=o(u)+" / "+s,t=u,u=t.parent;e.debug("Views: "+s)}var h=p,$=h.internalStates,x=h.inherit,b=(h.inheritParams,h.forEach),E=h.map,S=h.filterObj;f.hasParamSet=!!d.ParamSet,u=e.extend(new r("__inactives"),{self:{name:"__inactives"}}),o=s=t,c=[],p.onStateRegistered(function(e){e.self.sticky===!0&&v.registerStickyState(e.self)});var P;n.decorator("$state",["$delegate","$log","$q",function(n,a,p){return o=n.$current,$[""]=o,o.parent=u,u.parent=t,u.locals=x(l,u.locals),o.locals=x(u.locals,o.locals),delete u.locals.globals,P=n.transitionTo,n.transitionTo=function(t,h,x){function S(t){var n=e.extend(new r("reactivate_phase1"),{locals:t.locals});return n.self=e.extend({},t.self),n}function y(t){var n=e.extend(new r("reactivate_phase2"),t),a=n.self.onEnter;return n.resolve={},n.views={},n.self.onEnter=function(){n.locals=t.locals,i.stateReactivated(t)},L.addRestoreFunction(function(){t.self.onEnter=a}),n}function k(e){var t=new r("inactivate");t.self=e.self;var n=e.self.onExit;return t.self.onExit=function(){i.stateInactivated(e)},L.addRestoreFunction(function(){e.self.onExit=n}),t}function w(e,t){var n=e.self.onEnter;return e.self.onEnter=function(){i.stateEntering(e,t,n)},L.addRestoreFunction(function(){e.self.onEnter=n}),e}function F(e,t){var n=e.self.onEnter;return e.self.onEnter=function(){i.stateEntering(e,t,n,!0)},L.addRestoreFunction(function(){e.self.onEnter=n}),e}function R(e){var t=e.self.onExit;return e.self.onExit=function(){i.stateExiting(e,J,t)},L.addRestoreFunction(function(){e.self.onExit=t}),e}var T=v.debugMode();u.locals||(u.locals=o.locals);var _=c.length;s&&(s(),T&&a.debug("Restored paths from pending transition"));var I,j,O,q,A=n.$current,C=n.params,M=x&&x.relative||n.$current,D=n.get(t,M),B=[],J=[];h=h||{},arguments[1]=h;var K=function(){},L=function(){I&&(U.path=I,I=null),j&&(A.path=j,j=null),e.forEach(L.restoreFunctions,function(e){e()}),L=K,s=null,c.splice(_,1)};if(L.restoreFunctions=[],L.addRestoreFunction=function(e){this.restoreFunctions.push(e)},D){var U=$[D.name];if(U){I=U.path,j=A.path;var V=x&&x.reload||!1,z=V&&(V===!0?I[0].self:n.get(V,M));x&&V&&V!==!0&&delete x.reload;var G={toState:U,toParams:h||{},fromState:A,fromParams:C||{},options:x,reloadStateTree:z};if(c.push(G),s=L,z){G.toParams.$$uirouterextrasreload=Math.random();var H=z.$$state().params,N=z.$$state().ownParams;if(f.hasParamSet){var Q=new d.Param("$$uirouterextrasreload");H.$$uirouterextrasreload=N.$$uirouterextrasreload=Q,L.restoreFunctions.push(function(){delete H.$$uirouterextrasreload,delete N.$$uirouterextrasreload})}else H.push("$$uirouterextrasreload"),N.push("$$uirouterextrasreload"),L.restoreFunctions.push(function(){H.length=H.length-1,N.length=N.length-1})}O=i.processTransition(G),T&&m(a,G,O);var W=U.path.slice(0,O.keep),X=A.path.slice(0,O.keep);e.forEach(u.locals,function(e,t){-1!=t.indexOf("@")&&delete u.locals[t]});var Y=function(e){return function(t,n){-1!==n.indexOf("@")&&(e[n]=t)}};b(O.inactives,function(e){b(e.locals,Y(u.locals))}),b(O.reactivatingStates,function(e){b(e.locals,Y(l))}),L.addRestoreFunction(function(){b(l,function(e,t){delete l[t]})}),e.forEach(O.enter,function(e,t){var n,r=U.path[t];"reactivate"===e?(n=S(r),W.push(n),X.push(n),B.push(y(r)),q=r):"reload"===e?(W.push(F(r)),q=r):"enter"===e&&W.push(w(r))}),e.forEach(O.exit,function(e,t){var n=A.path[t];"inactivate"===e?(X.push(k(n)),J.push(n)):"exit"===e&&(X.push(R(n)),J.push(n))}),B.length&&e.forEach(B,function(e){W.push(e)});var Z=O.orphans;X=X.concat(E(Z,function(e){return R(e)})),J=J.concat(Z),A.path=X,U.path=W;var ee=function(e){return(e.surrogateType?e.surrogateType+":":"")+e.self.name};T&&a.debug("SurrogateFromPath: ",E(X,ee)),T&&a.debug("SurrogateToPath: ",E(W,ee))}}var te=P.apply(n,arguments);return te.then(function(e){return L(),T&&g(a,$[e.name],n),e.status="active",e},function(e){return L(),T&&"transition prevented"!==e.message&&"transition aborted"!==e.message&&"transition superseded"!==e.message&&(a.debug("transition failed",e),a.debug(e.stack)),p.reject(e)})},n}])}])}(angular); | ||
/** UI-Router Extras v.0.1.3 Module: sticky http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(e,t){"use strict";function n(t,n){var a=n,r=a.inheritParams,o=(a.objectKeys,a.protoKeys),i=a.forEach,s=a.map,c={},l={},f=!1;this.registerStickyState=function(e){l[e.name]=e},this.enableDebug=this.debugMode=function(t){return e.isDefined(t)&&(f=t),f},this.$get=["$rootScope","$state","$stateParams","$injector","$log",function(t,n,a,l,v){function d(){var t={};return e.forEach(c,function(e,n){for(var a=m(e),r=0;r<a.length;r++){var o=a[r].parent;t[o.name]=t[o.name]||[],t[o.name].push(e)}t[""]&&(t.__inactives=t[""])}),t}function p(){var e={};return i(c,function(t){i(t.path,function(n){n!==t&&(e[n.name]=e[n.name]||[],e[n.name].push(t))})}),e}function m(e){var t=[];if(!e)return t;do e.sticky&&t.push(e),e=e.parent;while(e);return t.reverse(),t}function g(e,t,n,a){if(a)return"reload";var r=c[e.self.name];if(!r)return"enter";if(e.self===n)return"reload";var o=$(e.ownParams,t,r.locals.globals.$stateParams);return o?"reactivate":"reload"}function h(e,t){var n=c[e.name];if(!n)return null;if(!t)return n;var a=$(e.ownParams,t,n.locals.globals.$stateParams);return a?n:null}function $(e,t,n){return"function"==typeof e.$$equals?e.$$equals(t,n):x(t,n,e)}function x(t,n,a){if(!e.isArray(a)&&e.isObject(a)&&(a=o(a,["$$keys","$$values","$$equals","$$validates","$$new","$$parent"])),!a){a=[];for(var r in t)a.push(r)}for(var i=0;i<a.length;i++){var s=a[i];if(t[s]!=n[s])return!1}return!0}function b(e){var t=e.fromState.path,o=e.toState.path,i=e.toParams,s=0,u=o[s];for(e.options&&e.options.inherit&&(i=e.toParams=r(a,i||{},n.$current,e.toState));u&&u===t[s]&&$(u.ownParams,i,e.fromParams);)u=o[++s];return{keep:s,retained:t.slice(0,s),exiting:t.slice(s),entering:o.slice(s)}}function S(e,t){return e.name.split(".").length-t.name.split(".").length}var E={getInactiveStates:function(){return s(c,e.identity).sort(S)},getInactiveStatesByParent:function(){return d()},processTransition:function(t){function n(e){return function(t){return-1===e.indexOf(t)}}function a(e,t){return e.concat(t)}function r(e){return function(t){return t[e]}}function o(e){return function(t){return t.type===e}}function i(e){return function(t){return t.parent===e}}function s(e){return!e.sticky}var u,c,l,f=b(t),v=E.getInactiveStates(),d=f.keep,m=n(f.entering),h=f.exiting[0]&&f.exiting[0].sticky&&f.entering.length>0;c=f.exiting.map(function(e){var t=-1!==f.entering.indexOf(e),n=h&&!t?"inactivate":"exit";return{type:n,state:e}});var $=t.options&&!!t.options.reload;l=f.entering.map(function(e){var n=g(e,t.toParams,t.reloadStateTree,$);return $=$||"reload"===n,{type:n,state:e}});var x=f.entering.map(function(e){return v.filter(i(e.parent))}).reduce(a,[]).filter(m).filter(s).concat(v.filter(i(t.toState))),y=p(),P=x.map(function(e){return y[e.name]}).filter(e.isDefined).reduce(a,[]).concat(x).sort(S),k=c.filter(o("exit")).map(r("state")).concat(P);return u=v.filter(n(k)).filter(n(f.entering)).concat(c.filter(o("inactivate")).map(r("state"))).sort(S),{keep:d,enter:new Array(d).concat(l.map(r("type"))),exit:new Array(d).concat(c.map(r("type"))),inactives:u,reactivatingStates:l.filter(o("reactivate")).map(r("state")),orphans:P}},stateInactivated:function(e){c[e.self.name]=e,e.self.status="inactive",e.self.onInactivate&&l.invoke(e.self.onInactivate,e.self,e.locals.globals)},stateReactivated:function(e){c[e.self.name]&&delete c[e.self.name],e.self.status="entered",e.self.onReactivate&&l.invoke(e.self.onReactivate,e.self,e.locals.globals)},stateExiting:function(t,n,a){var r={};e.forEach(n,function(e){r[e.self.name]=!0}),e.forEach(c,function(n,a){!r[a]&&n.includes[t.name]&&(f&&v.debug("Exiting "+a+" because it's a substate of "+t.name+" and wasn't found in ",r),n.self.onExit&&l.invoke(n.self.onExit,n.self,n.locals.globals),e.forEach(n.locals,function(e,t){delete u.locals[t]}),n.locals=null,n.self.status="exited",delete c[a])}),a&&l.invoke(a,t.self,t.locals.globals),t.locals=null,t.self.status="exited",delete c[t.self.name]},stateEntering:function(e,t,n,a){var r=h(e);if(r&&(a||!h(e,t))){var o=e.locals;this.stateExiting(r),e.locals=o}e.self.status="entered",n&&l.invoke(n,e.self,e.locals.globals)},reset:function(a,r){function o(e){E.reset(e)}if("*"===a)return e.forEach(E.getInactiveStates(),o),!0;var i=n.get(a);if(!i)return!1;var s=h(i,r);return s?(E.stateExiting(s),t.$broadcast("$viewContentLoading"),!0):!1}};return E}]}function a(e){return{resolve:{},locals:{globals:i&&i.locals&&i.locals.globals},views:{},self:{},params:{},ownParams:f.hasParamSet?{$$equals:function(){return!0}}:[],surrogateType:e}}e.module("ct.ui.router.extras.sticky",["ct.ui.router.extras.core"]);var r=e.module("ct.ui.router.extras.sticky");n.$inject=["$stateProvider","uirextras_coreProvider"],r.provider("$stickyState",n);var o,i,s,u,c=[],l={},f={hasParamSet:!1};e.module("ct.ui.router.extras.sticky").run(["$stickyState",function(e){o=e}]),e.module("ct.ui.router.extras.sticky").config(["$provide","$stateProvider","$stickyStateProvider","$urlMatcherFactoryProvider","uirextras_coreProvider",function(n,r,v,d,p){function m(t,n,a){function r(e,t,n){return e[t]?e[t].toUpperCase()+": "+n.self.name:"("+n.self.name+")"}var i=S(a.inactives,function(e){return e.self.name}),s=S(n.toState.path,function(e,t){return r(a.enter,t,e)}),u=S(n.fromState.path,function(e,t){return r(a.exit,t,e)}),c=n.fromState.self.name+": "+e.toJson(n.fromParams)+": -> "+n.toState.self.name+": "+e.toJson(n.toParams);t.debug("------------------------------------------------------"),t.debug(" Current transition: ",c),t.debug("Before transition, inactives are: : ",S(o.getInactiveStates(),function(e){return e.self.name})),t.debug("After transition, inactives will be: ",i),t.debug("Transition will exit: ",u),t.debug("Transition will enter: ",s)}function g(e,t,n){e.debug("Current state: "+t.self.name+", inactive states: ",S(o.getInactiveStates(),function(e){return e.self.name}));for(var a=function(e,t){return"globals"!=t&&"resolve"!=t},r=function(e){var t=E(e.locals,a);return Object.keys(t).length||(t[""]={$$state:{name:null}}),S(t,function(t,n){return{localsFor:e.self.name?e.self.name:"(root)",uiViewName:n||null,filledByState:t.$$state.name}})},i=r(t),s=t.parent;s&&s!==t;)i=i.concat(r(s)),t=s,s=t.parent;e.debug("Views active on each state:"),console.table(i.reverse())}var h=p,$=h.internalStates,x=h.inherit,b=(h.inheritParams,h.forEach),S=h.map,E=h.filterObj;f.hasParamSet=!!d.ParamSet,u=e.extend(new a("__inactives"),{self:{name:"__inactives"}}),i=s=t,c=[],p.onStateRegistered(function(e){e.self.sticky===!0&&v.registerStickyState(e.self)});var y;n.decorator("$state",["$delegate","$log","$q",function(n,r,p){return i=n.$current,$[""]=i,i.parent=u,u.parent=t,u.locals=x(l,u.locals),i.locals=x(u.locals,i.locals),delete u.locals.globals,y=n.transitionTo,n.transitionTo=function(t,h,x){function E(t){var n=e.extend(new a("reactivate_phase1"),{locals:t.locals});return n.self=e.extend({},t.self),n}function P(t){var n=e.extend(new a("reactivate_phase2"),t),r=n.self.onEnter;return n.resolve={},n.views={},n.self.onEnter=function(){n.locals=t.locals,o.stateReactivated(t)},V.addRestoreFunction(function(){t.self.onEnter=r}),n}function k(e){var t=new a("inactivate");t.self=e.self;var n=e.self.onExit;return t.self.onExit=function(){o.stateInactivated(e)},V.addRestoreFunction(function(){e.self.onExit=n}),t}function w(e,t){var n=e.self.onEnter;return e.self.onEnter=function(){o.stateEntering(e,t,n)},V.addRestoreFunction(function(){e.self.onEnter=n}),e}function F(e,t){var n=e.self.onEnter;return e.self.onEnter=function(){o.stateEntering(e,t,n,!0)},V.addRestoreFunction(function(){e.self.onEnter=n}),e}function R(e){var t=e.self.onExit;return e.self.onExit=function(){o.stateExiting(e,J,t)},V.addRestoreFunction(function(){e.self.onExit=t}),e}var T=v.debugMode();u.locals||(u.locals=i.locals);var I=c.length;s&&(s(),T&&r.debug("Restored paths from pending transition"));var _,j,O,q,A=n.$current,C=n.params,M=x&&x.relative||n.$current,B=n.get(t,M),D=[],J=[];h=h||{},arguments[1]=h;var K=function(){},V=function(){_&&(L.path=_,_=null),j&&(A.path=j,j=null),e.forEach(V.restoreFunctions,function(e){e()}),V=K,s=null,c.splice(I,1)};if(V.restoreFunctions=[],V.addRestoreFunction=function(e){this.restoreFunctions.push(e)},B){var L=$[B.name];if(L){_=L.path,j=A.path;var N=x&&x.reload||!1,U=N&&(N===!0?_[0].self:n.get(N,M));x&&N&&N!==!0&&delete x.reload;var z={toState:L,toParams:h||{},fromState:A,fromParams:C||{},options:x,reloadStateTree:U};if(c.push(z),s=V,U){z.toParams.$$uirouterextrasreload=Math.random();var G=U.$$state().params,H=U.$$state().ownParams;if(f.hasParamSet){var Q=new d.Param("$$uirouterextrasreload");G.$$uirouterextrasreload=H.$$uirouterextrasreload=Q,V.restoreFunctions.push(function(){delete G.$$uirouterextrasreload,delete H.$$uirouterextrasreload})}else G.push("$$uirouterextrasreload"),H.push("$$uirouterextrasreload"),V.restoreFunctions.push(function(){G.length=G.length-1,H.length=H.length-1})}O=o.processTransition(z),T&&m(r,z,O);var W=L.path.slice(0,O.keep),X=A.path.slice(0,O.keep);e.forEach(u.locals,function(e,t){-1!=t.indexOf("@")&&delete u.locals[t]});var Y=function(e){return function(t,n){-1!==n.indexOf("@")&&(e[n]=t)}};b(O.inactives,function(e){b(e.locals,Y(u.locals))}),b(O.reactivatingStates,function(e){b(e.locals,Y(l))}),V.addRestoreFunction(function(){b(l,function(e,t){delete l[t]})}),e.forEach(O.enter,function(e,t){var n,a=L.path[t];"reactivate"===e?(n=E(a),W.push(n),X.push(n),D.push(P(a)),q=a):"reload"===e?(W.push(F(a)),q=a):"enter"===e&&W.push(w(a))}),e.forEach(O.exit,function(e,t){var n=A.path[t];"inactivate"===e?(X.push(k(n)),J.push(n)):"exit"===e&&(X.push(R(n)),J.push(n))}),D.length&&e.forEach(D,function(e){W.push(e)});var Z=O.orphans;X=X.concat(S(Z,function(e){return R(e)})),J=J.concat(Z),A.path=X,L.path=W;var ee=function(e){return(e.surrogateType?e.surrogateType+":":"")+e.self.name};T&&r.debug("SurrogateFromPath: ",S(X,ee)),T&&r.debug("SurrogateToPath: ",S(W,ee))}}var te=y.apply(n,arguments);return te.then(function(e){return V(),T&&g(r,$[e.name],n),e.status="active",e},function(e){return V(),T&&"transition prevented"!==e.message&&"transition aborted"!==e.message&&"transition superseded"!==e.message&&(r.debug("transition failed",e),r.debug(e.stack)),p.reject(e)})},n}])}])}(angular); |
/** | ||
* UI-Router Extras: Sticky states, Future States, Deep State Redirect, Transition promise | ||
* Module: transition | ||
* @version 0.1.2 | ||
* @version 0.1.3 | ||
* @link http://christopherthielen.github.io/ui-router-extras/ | ||
@@ -6,0 +6,0 @@ * @license MIT License, http://www.opensource.org/licenses/MIT |
@@ -1,2 +0,2 @@ | ||
/** UI-Router Extras v.0.1.2 Module: transition http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
/** UI-Router Extras v.0.1.3 Module: transition http://christopherthielen.github.io/ui-router-extras/ - MIT License */ | ||
!function(t,n){"use strict";t.module("ct.ui.router.extras.transition",["ct.ui.router.extras.core"]).config(["$provide",function(n){n.decorator("$state",["$delegate","$rootScope","$q","$injector",function(n,r,e,o){function i(n){var r=o.invoke,e=o.instantiate;return o.invoke=function(e,o,i){return r(e,o,t.extend({$transition$:n},i))},o.instantiate=function(r,o){return e(r,t.extend({$transition$:n},o))},function(){o.invoke=r,o.instantiate=e}}function a(){p.pop()(),$.pop(),f--}function u(t,n){return function(e){return a(),r.$broadcast("$transitionSuccess",n),t.resolve(e),e}}function c(t,n){return function(o){return a(),r.$broadcast("$transitionError",n,o),t.reject(o),e.reject(o)}}var s=n.transitionTo,f=-1,$=[],p=[];return n.transitionTo=function(t,r,o){var i=e.defer(),a=$[++f]={promise:i.promise};p[f]=function(){};var d=s.apply(n,arguments);return d.then(u(i,a),c(i,a))},r.$on("$stateChangeStart",function(n,e,o,a,u){if(!(f>=$.length)){var c=f,s=t.extend($[c],{to:{state:e,params:o},from:{state:a,params:u}}),d=i(s);p[c]=d,r.$broadcast("$transitionStart",s)}}),n}])}])}(angular); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
246127
3474