{"version":3,"file":"ui-router-sticky-states.js","sources":["../src/stickyStates.ts"],"sourcesContent":["import {\n UIRouter, PathUtils, StateOrName, StateObject, StateDeclaration, PathNode, TreeChanges, Transition, UIRouterPluginBase,\n TransitionHookPhase, TransitionHookScope, TransitionServicePluginAPI, HookMatchCriteria, TransitionStateHookFn,\n HookRegOptions, PathType, find, tail, isString, isArray, inArray, removeFrom, pushTo, identity, anyTrueR, assertMap,\n uniqR, defaultTransOpts, HookMatchCriterion\n} from \"@uirouter/core\";\n\ndeclare module \"@uirouter/core/lib/state/interface\" {\n interface StateDeclaration {\n sticky?: boolean;\n onInactivate?: TransitionStateHookFn;\n onReactivate?: TransitionStateHookFn;\n }\n}\n\ndeclare module \"@uirouter/core/lib/state/stateObject\" {\n interface StateObject {\n sticky?: boolean;\n onInactivate?: TransitionStateHookFn;\n onReactivate?: TransitionStateHookFn;\n }\n}\n\ndeclare module \"@uirouter/core/lib/transition/transitionService\" {\n interface TransitionService {\n onInactivate: (criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions) => Function;\n onReactivate: (criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions) => Function;\n }\n}\n\ndeclare module \"@uirouter/core/lib/transition/interface\" {\n interface TransitionOptions {\n exitSticky: StateOrName[]|StateOrName;\n }\n\n interface TreeChanges {\n inactivating?: PathNode[];\n reactivating?: PathNode[];\n }\n\n export interface IMatchingNodes {\n inactivating: PathNode[];\n reactivating: PathNode[];\n }\n\n export interface PathTypes {\n inactivating: PathType;\n reactivating: PathType;\n }\n\n export interface HookMatchCriteria {\n /** A [[HookMatchCriterion]] to match any state that would be inactivating */\n inactivating?: HookMatchCriterion;\n /** A [[HookMatchCriterion]] to match any state that would be reactivating */\n reactivating?: HookMatchCriterion;\n }\n}\n\nconst notInArray = (arr: any[]) => (item) => !inArray(arr, item);\n\nconst isChildOf = (parent: PathNode) =>\n (node: PathNode) =>\n node.state.parent === parent.state;\n\nconst isChildOfAny = (_parents: PathNode[]) => {\n return (node: PathNode) =>\n _parents.map(parent => isChildOf(parent)(node)).reduce(anyTrueR, false);\n};\n\nconst ancestorPath = (state: StateObject) =>\n state.parent ? ancestorPath(state.parent).concat(state) : [state];\n\nconst isDescendantOf = (_ancestor: PathNode) => {\n let ancestor = _ancestor.state;\n return (node: PathNode) =>\n ancestorPath(node.state).indexOf(ancestor) !== -1;\n};\n\nconst isDescendantOfAny = (ancestors: PathNode[]) =>\n (node: PathNode) =>\n ancestors.map(ancestor => isDescendantOf(ancestor)(node))\n .reduce(anyTrueR, false);\n\nfunction findStickyAncestor(state: StateObject) {\n return state.sticky ? state : findStickyAncestor(state.parent);\n}\n\n\n\n/**\n * Sorts fn that sorts by:\n * 1) node depth (how deep a state is nested)\n * 2) the order in which the state was inactivated (later in wins)\n */\nfunction nodeDepthThenInactivateOrder(inactives: PathNode[]) {\n return function(l: PathNode, r: PathNode): number {\n let depthDelta = (l.state.path.length - r.state.path.length);\n return depthDelta !== 0 ? depthDelta : inactives.indexOf(r) - inactives.indexOf(l);\n };\n}\nexport class StickyStatesPlugin extends UIRouterPluginBase {\n name = \"sticky-states\";\n private _inactives: PathNode[] = [];\n private pluginAPI: TransitionServicePluginAPI;\n\n constructor(public router: UIRouter) {\n super();\n\n this.pluginAPI = router.transitionService._pluginapi;\n\n this._defineStickyPaths();\n this._defineStickyEvents();\n this._addCreateHook();\n this._addStateCallbacks();\n this._addDefaultTransitionOption();\n }\n\n inactives(): StateDeclaration[] {\n return this._inactives.map(node => node.state.self);\n }\n\n private _addCreateHook() {\n this.router.transitionService.onCreate({}, (trans) => {\n trans['_treeChanges'] = this._calculateStickyTreeChanges(trans);\n }, { priority: 100 });\n }\n\n private _defineStickyPaths() {\n // let paths = this.pluginAPI._getPathTypes();\n this.pluginAPI._definePathType(\"inactivating\", TransitionHookScope.STATE);\n this.pluginAPI._definePathType(\"reactivating\", TransitionHookScope.STATE);\n }\n\n private _defineStickyEvents() {\n let paths = this.pluginAPI._getPathTypes();\n this.pluginAPI._defineEvent(\"onInactivate\", TransitionHookPhase.RUN, 5, paths.inactivating, true);\n this.pluginAPI._defineEvent(\"onReactivate\", TransitionHookPhase.RUN, 35, paths.reactivating);\n }\n\n // Process state.onInactivate or state.onReactivate callbacks\n private _addStateCallbacks() {\n let inactivateCriteria = { inactivating: state => !!state.onInactivate };\n this.router.transitionService.onInactivate(inactivateCriteria, (trans: Transition, state: StateDeclaration) =>\n state.onInactivate(trans, state));\n\n let reactivateCriteria = { reactivating: state => !!state.onReactivate };\n this.router.transitionService.onReactivate(reactivateCriteria, (trans: Transition, state: StateDeclaration) =>\n state.onReactivate(trans, state));\n }\n\n\n private _calculateExitSticky(tc: TreeChanges, trans: Transition) {\n // Process the inactive states that are going to exit due to $stickyState.reset()\n let exitSticky = trans.options().exitSticky || [];\n if (!isArray(exitSticky)) exitSticky = [exitSticky];\n\n let $state = trans.router.stateService;\n\n let states: StateObject[] = (exitSticky as any[])\n .map(assertMap((stateOrName) => $state.get(stateOrName), (state) => \"State not found: \" + state))\n .map(state => state.$$state());\n\n let potentialExitingStickies = this._inactives.concat(tc.inactivating).reduce(uniqR, []) as PathNode[];\n\n let findInactive = state => potentialExitingStickies.find(node => node.state === state);\n const notInactiveMsg = (state) => \"State not inactive: \" + state;\n let exitingInactives = states.map(assertMap(findInactive, notInactiveMsg));\n let exiting = potentialExitingStickies.filter(isDescendantOfAny(exitingInactives));\n\n let inToPathMsg = (node) => \"Can not exit a sticky state that is currently active/activating: \" + node.state.name;\n exiting.map(assertMap(node => !inArray(tc.to, node), inToPathMsg));\n\n return exiting;\n }\n\n private _calculateStickyTreeChanges(trans: Transition): TreeChanges {\n let tc: TreeChanges = trans.treeChanges();\n tc.inactivating = [];\n tc.reactivating = [];\n\n /****************\n * Process states that are about to be inactivated\n ****************/\n\n if (tc.entering.length && tc.exiting[0] && tc.exiting[0].state.sticky) {\n tc.inactivating = tc.exiting;\n tc.exiting = [];\n }\n\n /****************\n * Determine which states are about to be reactivated\n ****************/\n\n // Simulate a transition where the fromPath is a clone of the toPath, but use the inactivated nodes\n // This will calculate which inactive nodes that need to be exited/entered due to param changes\n let inactiveFromPath = tc.retained.concat(tc.entering.map(node => this._getInactive(node) || null)).filter(identity);\n let simulatedTC = PathUtils.treeChanges(inactiveFromPath, tc.to, trans.options().reloadState);\n\n let shouldRewritePaths = ['retained', 'entering', 'exiting'].some(path => !!simulatedTC[path].length);\n\n if (shouldRewritePaths) {\n // The 'retained' nodes from the simulated transition's TreeChanges are the ones that will be reactivated.\n // (excluding the nodes that are in the original retained path)\n tc.reactivating = simulatedTC.retained.slice(tc.retained.length);\n\n // Entering nodes are the same as the simulated transition's entering\n tc.entering = simulatedTC.entering;\n\n // The simulatedTC 'exiting' nodes are inactives that are being exited because:\n // - The inactive state's params changed\n // - The inactive state is being reloaded\n // - The inactive state is a child of the to state\n tc.exiting = tc.exiting.concat(simulatedTC.exiting);\n\n // Rewrite the to path\n tc.to = tc.retained.concat(tc.reactivating).concat(tc.entering);\n }\n\n /****************\n * Determine which additional inactive states should be exited\n ****************/\n\n let inactives = this._inactives;\n\n // Any inactive state whose parent state is exactly activated will be exited\n let childrenOfToState = inactives.filter(isChildOf(tail(tc.to)));\n\n // Any inactive non-sticky state whose parent state is activated (and is itself not activated) will be exited\n let childrenOfToPath = inactives.filter(isChildOfAny(tc.to))\n .filter(notInArray(tc.to))\n .filter(node => !node.state.sticky);\n\n let exitingChildren = childrenOfToState.concat(childrenOfToPath).filter(notInArray(tc.exiting));\n\n let exitingRoots = tc.exiting.concat(exitingChildren);\n\n // Any inactive descendant of an exiting state will be exited\n let orphans = inactives.filter(isDescendantOfAny(exitingRoots))\n .filter(notInArray(exitingRoots))\n .concat(exitingChildren)\n .reduce(uniqR, [])\n .sort(nodeDepthThenInactivateOrder(inactives));\n\n tc.exiting = orphans.concat(tc.exiting);\n\n // commit all changes to inactives after transition is successful\n trans.onSuccess({}, () => {\n tc.exiting.forEach(removeFrom(this._inactives));\n tc.entering.forEach(removeFrom(this._inactives));\n tc.reactivating.forEach(removeFrom(this._inactives));\n tc.inactivating.forEach(pushTo(this._inactives));\n });\n\n // console.log('inactives will be:', inactives.map(x => x.state.name));\n\n // let tcCopy: any = Object.assign({}, tc);\n // Object.keys(tcCopy).forEach(key => tcCopy[key] = tcCopy[key].map(x => x.state.name));\n // console.table(tcCopy);\n\n // Process the inactive sticky states that should be exited\n let exitSticky = this._calculateExitSticky(tc, trans);\n exitSticky.filter(notInArray(tc.exiting)).forEach(pushTo(tc.exiting));\n\n // Also process the active sticky states that are about to be inactivated, but should be exited\n exitSticky.filter(inArray(tc.inactivating)).forEach(removeFrom(tc.inactivating));\n\n return tc;\n }\n\n\n private _addDefaultTransitionOption() {\n defaultTransOpts.exitSticky = [];\n }\n\n /**\n * Exits inactive sticky state(s)\n *\n * #### Example:\n * ```js\n * $stickyState.exitSticky('inactivestate');\n * ```\n *\n * ```js\n * $stickyState.exitSticky([ 'inactivestate1', 'inactivestate2' ]);\n * ```\n *\n * ```js\n * // exit all inactive stickies\n * $stickyState.exitSticky();\n * ```\n *\n * ```js\n * // exit all inactive stickies\n * $stickyState.exitSticky($stickyState.inactives());\n * ```\n * @param states The state name, or an array of state names\n */\n exitSticky();\n exitSticky(states: StateOrName);\n exitSticky(states: StateOrName[]);\n exitSticky(states?: any) {\n let $state = this.router.stateService;\n if (states === undefined) states = this._inactives.map(node => node.state.name);\n if (isString(states)) states = [states];\n\n return $state.go($state.current, {}, {\n inherit: true,\n exitSticky: states\n });\n }\n\n _getInactive = (node) =>\n node && find(this._inactives, n => n.state === node.state);\n}\n\n\n"],"names":["inArray","anyTrueR","find","TransitionHookScope","TransitionHookPhase","isArray","assertMap","uniqR","identity","PathUtils","tail","removeFrom","pushTo","defaultTransOpts","isString","UIRouterPluginBase"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,AA0DA,IAAM,UAAU,GAAG,UAAC,GAAU,IAAK,OAAA,UAAC,IAAI,IAAK,OAAA,CAACA,sBAAO,CA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