@coolon/angular-ui-powerups 0.0.119 → 0.0.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +72 -168
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.metadata.json +1 -1
  6. package/esm2015/lib/place/guards/navigation-state.js +43 -85
  7. package/esm2015/lib/place/guards/navigation-state.js.map +1 -1
  8. package/esm2015/lib/place/guards/navigation-state.metadata.json +1 -1
  9. package/esm2015/lib/place/place-component.js +2 -2
  10. package/esm2015/lib/place/place-component.js.map +1 -1
  11. package/esm2015/lib/place/place-router.js +9 -2
  12. package/esm2015/lib/place/place-router.js.map +1 -1
  13. package/esm2015/lib/place/place-router.metadata.json +1 -1
  14. package/esm2015/lib/place/route/parameter-decorators.js +6 -6
  15. package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
  16. package/esm5/lib/place/guards/navigation-state.js +52 -159
  17. package/esm5/lib/place/guards/navigation-state.js.map +1 -1
  18. package/esm5/lib/place/place-component.js +2 -2
  19. package/esm5/lib/place/place-component.js.map +1 -1
  20. package/esm5/lib/place/place-router.js +13 -2
  21. package/esm5/lib/place/place-router.js.map +1 -1
  22. package/esm5/lib/place/route/parameter-decorators.js +6 -6
  23. package/esm5/lib/place/route/parameter-decorators.js.map +1 -1
  24. package/fesm2015/coolon-angular-ui-powerups.js +60 -95
  25. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  26. package/fesm5/coolon-angular-ui-powerups.js +73 -169
  27. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  28. package/lib/place/guards/navigation-state.d.ts +4 -1
  29. package/lib/place/place-router.d.ts +4 -1
  30. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"place-component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EACL,MAAM,EACN,OAAO,EAIP,IAAI,EAGL,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;;;AAKrD,MAAM,KAAO,wBAAwB,GAAG,0BAA0B;;;AAElE,MAAM,KAAO,wBAAwB,GAAG,MAAM,CAAC,wBAAwB,CAAC;AAExE;IAAoC,0CAAmB;IASrD;eACE,iBAAO;IACT,CAAC;;;;;IAEM,2CAAkB;;;;IAAzB,UAA0B,KAAwB;QAAlD,iBAOC;QANC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,oFAAoF;QACpF,IAAI,CAAC,eAAe,CAAC,qBAAqB,EAAE,CAAC,OAAO;;;;QAAC,UAAA,YAAY;YAC/D,KAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QACpC,CAAC,EAAC,CAAC;IACL,CAAC;;;;;;;IAEO,uCAAc;;;;;;IAAtB,UAA6B,YAAuC;;YAC5D,KAAK,GAAG,mBAAA,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAuB;QACpE,sDAAsD;QACtD,IAAI,CAAC,kBAAkB,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE;YACrD,OAAO;;;;YAAP,UAAQ,KAAY;;oBACZ,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC;gBACnD,4EAA4E;gBA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C,KAAoC;QAChE,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;IAFe,4BAAa,gBAE5B,CAAA;;;;;;IAED,SAAgB,gBAAgB,CAAC,KAAoC,EAAE,UAA2B;QAChG,OAAO,CAAC,cAAc,CAAC,wBAAwB,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAFe,+BAAgB,mBAE/B,CAAA;AAEH,CAAC,EAlBgB,cAAc,KAAd,cAAc,QAkB9B","sourcesContent":["import {\n assert,\n Binding,\n Constructable,\n // DebugContext,\n IMutableHasValue,\n lang,\n TransactionObserver,\n ValueModel\n} from '@coolon/pectin';\nimport { Klass } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator';\nimport 'reflect-metadata';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from '../interaction/interaction-context';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition.class';\nimport { Visit } from './visit';\n\n// RAKE: making this Symbol(...) broke things.\nexport const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';\n// this one seems ok.\nexport const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');\n\nexport class PlaceComponent extends DisposableComponent {\n\n private visit: ValueModel<Visit>;\n // private _inDeactivationGuard = new MutableValueModel<boolean>(false);\n\n interactionContext?: InteractionContext;\n\n canDeactivate?(interactionContext: InteractionContext): boolean | Promise<boolean>;\n\n constructor() {\n super();\n }\n\n public initialiseBindings(visit: ValueModel<Visit>) {\n assert.isNil(this.visit);\n this.visit = visit;\n // DebugContext.get(this.visit).tag(`${this.placeDefinition.component.name}.visit`);\n this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => {\n this.installBinding(parameterDef);\n });\n }\n\n private installBinding<T, S>(parameterDef: ParameterDefinition<T, S>) {\n const model = this[parameterDef.propertyName] as IMutableHasValue<S>;\n // this.txo.observe(parameterDef.propertyName, model);\n this.registerDisposable(new Binding(this.visit, model, {\n toRight(visit: Visit): S {\n const value = visit.getParameter(parameterDef.name);\n // console.log('push to component', {name:parameterDef.name, value, visit});\n return value;\n },\n toLeft(value: S, currentVisit?: Visit): Visit {\n console.log('push to route', { name: parameterDef.name, value, currentVisit });\n return currentVisit.replace(parameterDef, value);\n }\n }));\n }\n\n @Memoize()\n get placeDefinition(): PlaceDefinition {\n return PlaceComponent.getDefinition(this.constructor as any as Constructable<PlaceComponent>);\n }\n\n get childPlaces(): Constructable<PlaceComponent>[] {\n return this.placeDefinition.children.map(d => d.component);\n }\n\n onPlaceReady() {\n }\n\n}\n\nexport namespace PlaceComponent {\n\n export function isPlaceComponentConstructor(target: any): target is Constructable<PlaceComponent> {\n return lang.constructorChain(target as Constructable<any>).includes(PlaceComponent);\n }\n\n export function getRouteParameters(klass: Constructable<PlaceComponent>): ParameterDefinition<any>[] {\n return Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY);\n }\n\n export function getDefinition(klass: Constructable<PlaceComponent>): PlaceDefinition {\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);\n }\n\n export function injectDefinition(klass: Constructable<PlaceComponent>, definition: PlaceDefinition) {\n Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);\n }\n\n}\n"]}
1
+ {"version":3,"file":"place-component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EACL,MAAM,EACN,OAAO,EAEP,YAAY,EAEZ,IAAI,EAGL,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,oB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+BAAgB,mBAE/B,CAAA;AAEH,CAAC,EAlBgB,cAAc,KAAd,cAAc,QAkB9B","sourcesContent":["import {\n assert,\n Binding,\n Constructable,\n DebugContext,\n IMutableHasValue,\n lang,\n TransactionObserver,\n ValueModel\n} from '@coolon/pectin';\nimport { Klass } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator';\nimport 'reflect-metadata';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from '../interaction/interaction-context';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition.class';\nimport { Visit } from './visit';\n\n// RAKE: making this Symbol(...) broke things.\nexport const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';\n// this one seems ok.\nexport const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');\n\nexport class PlaceComponent extends DisposableComponent {\n\n private visit: ValueModel<Visit>;\n // private _inDeactivationGuard = new MutableValueModel<boolean>(false);\n\n interactionContext?: InteractionContext;\n\n canDeactivate?(interactionContext: InteractionContext): boolean | Promise<boolean>;\n\n constructor() {\n super();\n }\n\n public initialiseBindings(visit: ValueModel<Visit>) {\n assert.isNil(this.visit);\n this.visit = visit;\n DebugContext.get(this.visit).tag(`${this.placeDefinition.component.name}.visit`);\n this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => {\n this.installBinding(parameterDef);\n });\n }\n\n private installBinding<T, S>(parameterDef: ParameterDefinition<T, S>) {\n const model = this[parameterDef.propertyName] as IMutableHasValue<S>;\n // this.txo.observe(parameterDef.propertyName, model);\n this.registerDisposable(new Binding(this.visit, model, {\n toRight(visit: Visit): S {\n const value = visit.getParameter(parameterDef.name);\n // console.log('push to component', {name:parameterDef.name, value, visit});\n return value;\n },\n toLeft(value: S, currentVisit?: Visit): Visit {\n console.log('push to route', { name: parameterDef.name, value, currentVisit });\n return currentVisit.replace(parameterDef, value);\n }\n }));\n }\n\n @Memoize()\n get placeDefinition(): PlaceDefinition {\n return PlaceComponent.getDefinition(this.constructor as any as Constructable<PlaceComponent>);\n }\n\n get childPlaces(): Constructable<PlaceComponent>[] {\n return this.placeDefinition.children.map(d => d.component);\n }\n\n onPlaceReady() {\n }\n\n}\n\nexport namespace PlaceComponent {\n\n export function isPlaceComponentConstructor(target: any): target is Constructable<PlaceComponent> {\n return lang.constructorChain(target as Constructable<any>).includes(PlaceComponent);\n }\n\n export function getRouteParameters(klass: Constructable<PlaceComponent>): ParameterDefinition<any>[] {\n return Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY);\n }\n\n export function getDefinition(klass: Constructable<PlaceComponent>): PlaceDefinition {\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);\n }\n\n export function injectDefinition(klass: Constructable<PlaceComponent>, definition: PlaceDefinition) {\n Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);\n }\n\n}\n"]}
@@ -399,14 +399,25 @@ var PlaceRouter = /** @class */ (function (_super) {
399
399
  };
400
400
  /**
401
401
  * @param {?} url
402
+ * @param {?} options
402
403
  * @return {?}
403
404
  */
404
405
  PlaceRouter.prototype.resetBrowserLocation = /**
405
406
  * @param {?} url
407
+ * @param {?} options
406
408
  * @return {?}
407
409
  */
408
- function (url) {
409
- this.angularLocation.go(url);
410
+ function (url, options) {
411
+ options.replaceCurrent ? this.angularLocation.replaceState(url) : this.angularLocation.go(url);
412
+ };
413
+ /**
414
+ * @return {?}
415
+ */
416
+ PlaceRouter.prototype.forward = /**
417
+ * @return {?}
418
+ */
419
+ function () {
420
+ this.angularLocation.forward();
410
421
  };
411
422
  /**
412
423
  * @param {...?} visits
@@ -1 +1 @@
1
- {"version":3,"file":"place-router.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-router.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,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AE,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE;oBAClF,UAAU,EAAE,CAAC,eAAe,CAAC,mCAAmC;iBACjE,CAAC,CAAC;aACJ;iBAAM;;oBACC,WAAW,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC,oBAAoB,CAAC,UAAU,CAAC;gBACnF,IAAI,oBAAoB,EAAE;oBACxB,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE;wBAC9B,UAAU,EAAE,IAAI;qBACjB,CAAC,CAAC,IAAI;;;oBAAC;wBACN,iFAAiF;wBACjF,yBAAyB;wBACzB,KAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;oBAC9B,CAAC,EAAC,CAAC;iBACJ;qBAAM;oBACL,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE;wBAC9B,UAAU,EAAE,IAAI;qBACjB,CAAC,CAAC;iBACJ;aACF;SACF;IACH,CAAC;;gBA/PF,UAAU,SAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;;gBA7BC,MAAM;gBACN,aAAa;gBAXN,QAAQ;gBAgCR,YAAY;gBAFZ,kBAAkB;;;sBA9B3B;CAqSC,AAhQD,CAGiC,gBAAgB,GA6PhD;SA7PY,WAAW;;;;;;IAEtB,4CAAkF;;;;;IAClF,oCAA+D;;IAE/D,2CAAmD;;IACnD,uCAAsE;;;;;IACtE,gDAA2D;;;;;IAC3D,gDAAmF;;;;;IAEvE,6BAA+B;;;;;IAC/B,oCAA6C;;;;;IAC7C,sCAA0C;;;;;IAC1C,mCAA2C;;;;;IAC3C,yCAAuD","sourcesContent":["import { Location } from '@angular/common';\nimport { Injectable } from '@angular/core';\nimport {\n ActivatedRoute,\n ActivatedRouteSnapshot,\n NavigationCancel,\n NavigationEnd,\n NavigationError,\n NavigationExtras,\n NavigationStart,\n Router,\n UrlSerializer\n} from '@angular/router';\nimport {\n assert,\n Constructable,\n Dsl,\n GarbageCollector,\n HasOneIndexChain,\n lang,\n ListModel,\n Logger,\n MutableListModel,\n MutableStream,\n MutableValueModel,\n Trace,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport _ from 'lodash';\nimport { InteractionService } from '../interaction/services/interaction.service';\nimport { NavigationState } from './guards/navigation-state';\nimport { PlaceHistory } from './place-history';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PlaceRouter extends GarbageCollector {\n\n private readonly _navigationStateModel = new MutableValueModel<NavigationState>();\n private readonly _activeVisits = new MutableListModel<Visit>();\n\n readonly navigationInProgress: ValueModel<boolean>;\n readonly activeVisitIndex: HasOneIndexChain<'placeDefinition', Visit>;\n private _navigationSessionContext: NavigationState.Context;\n private _navigationStateTypeModel: ValueModelChain<Constructable<NavigationState>>;\n\n constructor(private readonly router: Router,\n private readonly urlSerializer: UrlSerializer,\n private readonly angularLocation: Location,\n private readonly placeHistory: PlaceHistory,\n private readonly interactionService: InteractionService) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');\n this.navigationInProgress = chain(this.navigationStateModel).pluck('isTransitional');\n this._navigationSessionContext = new NavigationState.Context(this, this.interactionService, session => {\n this.processNavigationSuccess(session);\n });\n this._navigationStateModel.value = new NavigationState.Idle(this._navigationSessionContext);\n this._navigationStateTypeModel = chain(this._navigationStateModel).map(state => state.constructor as Constructable<NavigationState>);\n\n // TODO: make setup the callbacks in during module initiation to make this testable.\n this.router.events.subscribe(event => {\n // Routing event sequence\n // ======================\n // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session\n // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.\n // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.\n // =======================\n if (event instanceof NavigationStart) {\n if (event.navigationTrigger === 'popstate') {\n this.runStateTransition(state => state.onPopState(event));\n } else {\n this.runStateTransition(state => state.onRouterStarted(event));\n }\n }\n if (event instanceof NavigationEnd) {\n console.log(event);\n this.runStateTransition(state => state.onRouterEnd(event));\n }\n if (event instanceof NavigationError) {\n console.log(event);\n this.runStateTransition(state => state.onRouterError(event));\n }\n if (event instanceof NavigationCancel) {\n console.log(event);\n this.runStateTransition(state => state.onRouterCancelled(event));\n }\n });\n\n // Push dialog state to the url so we can capture the back button.\n when.listOf(this.interactionService.activeInteractionContextIds).changes((ids, previous) => {\n this.syncInteractionIdsWithRouter(ids, previous);\n }, { unless: this.navigationInProgress }); // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.\n\n const urlChanges = new MutableStream<{ url: string, state: NavigationState }>();\n\n // The angular router doesn't always fire router events when the back button is pushed while a navigation\n // session is in progress. Sometimes we only know about it from the url change.\n // IMPORTANT ORDER DEPENDENCY\n // This only works because we're notified of the change after the router has started reacting to it. This\n // we can can use our navigationState to determine things.\n angularLocation.onUrlChange(url => {\n const navigationState = this._navigationStateModel.value;\n console.log(`URLChange -> ${url}`, { state: navigationState });\n urlChanges.publish({ url, state: navigationState });\n\n // The url has changed while we're in a transitional state\n if (navigationState.isTransitional) {\n const navigationInteraction = this.navigationState.interactionContext;\n if (navigationInteraction && navigationInteraction.isActive()) {\n this.runStateTransition(state => state.onBackClickedDuringNavigationInteraction(url));\n }\n }\n });\n }\n\n private processNavigationSuccess(session: NavigationState) {\n // We need to update the visits before the session finishes. This allows the placeOutets to ignore visit\n // changes that occur while routerNavigationActive is true.\n assert.isTruthy(this.navigationInProgress.value);\n const visits = session.getVisits();\n visits.forEach(v => this.placeHistory.add(v));\n this._activeVisits.value = visits;\n }\n\n get navigationState(): NavigationState {\n return this._navigationStateModel.value;\n }\n\n get navigationStateModel(): ValueModel<NavigationState> {\n return this._navigationStateModel.readonly;\n }\n\n get activeVisits(): ListModel<Visit> {\n return this._activeVisits.readonly;\n }\n\n /**\n * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));\n * @param visit\n */\n async navigate(visit: Visit, options?: { relativeTo: ActivatedRoute }) {\n this.doNavigation(visit, async router => {\n const commands = [\n visit.placeDefinition.path,\n ...this.createRouteParameters(visit)\n ];\n await this.router.navigate(commands, {\n relativeTo: options ? options.relativeTo : null\n });\n });\n }\n\n // @Trace()\n async pushVisitChangesToRoute(activatedRoute: ActivatedRoute, previous: Visit, next: Visit) {\n // we have to push to history so our remember sanitisers don't pick up the previous value\n // when it's been cleared by the user.\n this.placeHistory.add(next);\n\n // FIXME: no route id -> route id duplicates route parameters\n if (next.hasRoutingChangedFrom(previous)) {\n return this.doNavigation(next, router => {\n const urlSnapshot = this.parseUrl(this.router.routerState.snapshot.url).updateVisitSegments(next);\n console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });\n return this.navigateByUrl(urlSnapshot);\n });\n }\n }\n\n async doNavigation(visit: Visit, runNavigationCommands: (router: Router) => any) {\n if (this.navigationInProgress.value) {\n lang.illegalState('Navigation already in progress');\n }\n this.runStateTransition(current => {\n const session = this.navigationState.onPlaceNavigationStart(visit, this.getCurrentRouterUrl());\n session.storeVisit(visit);\n return session;\n });\n try {\n await runNavigationCommands(this.router);\n } finally {\n // Router has finished (since there was no router change required) so we\n // need to end the navigation session.\n if (this.navigationState.isTransitional && !this.router.getCurrentNavigation()) {\n this.runStateTransition(session => session.onRouterEnd(new NavigationEnd(-1, '', '')));\n }\n }\n }\n\n // @Trace()\n protected runStateTransition(transition: (navigationSession: NavigationState) => NavigationState) {\n const previous = this._navigationStateModel.value;\n const next = transition(this.navigationState);\n this._navigationStateModel.value = next;\n if (next !== previous) {\n previous.dispose();\n Logger.get(this).info(`Router State Transition: ${previous.toString()} -> ${next.toString()}`);\n }\n }\n\n private createRouteParameters(visit: Visit) {\n const def = visit.placeDefinition;\n return visit.hasRouteId() ?\n [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :\n [def.getFormattedRouteParameters(visit)];\n }\n\n extractChildPath(activatedRoute: ActivatedRouteSnapshot): any[] {\n return _.flatten(activatedRoute.children.map(child => child.url));\n }\n\n parseUrl(url: string): UrlSnapshot {\n return new UrlSnapshot(this.urlSerializer, url);\n }\n\n resetBrowserLocation(url: string) {\n this.angularLocation.go(url);\n }\n\n createUrlSnapshot(...visits: Visit[]): UrlSnapshot {\n const bits = [];\n visits.forEach(v => {\n bits.push(this.parseUrl(`${v.placeDefinition.path}`).updateVisitSegments(v).url);\n });\n return this.parseUrl(bits.join(''));\n }\n\n getCurrentRouterUrl(): string {\n return this.router.routerState ? this.router.routerState.snapshot.url : null;\n }\n\n getCurrentRouteSnapshot(): UrlSnapshot {\n return this.parseUrl(this.getCurrentRouterUrl());\n }\n\n getActiveInteractionIdsFromUrl(url: string): string[] {\n return this.parseUrl(url).getInteractionIds();\n }\n\n\n // @Trace()\n hasActiveInteractionIds(url: string) {\n return this.getActiveInteractionIdsFromUrl(url).length > 0;\n }\n\n // @Trace()\n navigateByUrl(urlSnapshot: UrlSnapshot, navigationExtras?: NavigationExtras): Promise<boolean> {\n return this.router.navigateByUrl(urlSnapshot.urlTree, navigationExtras);\n }\n\n // TODO: Should this be moved to the navigation states?\n syncInteractionIdsWithRouter(currentIds: string[], previous: string[]) {\n assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.\n console.log({\n startingActivity: currentIds.length > previous.length,\n wasBackButton: this.navigationState.isPopState\n });\n\n if (_.isEqual(currentIds, previous)) {\n console.log('activity ids were the same, skipping');\n } else {\n // OMG, this is nuts.\n const addingActivity = currentIds.length > previous.length;\n const isFirstActivity = addingActivity && previous.length < 1;\n const removingLastActivity = currentIds.length < 1;\n if (addingActivity) {// we're starting a new activity, push the change to the history and update the url\n console.log('adding activity');\n this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds), {\n replaceUrl: !isFirstActivity // we don't let the history pile up\n });\n } else {\n const urlSnapshot = this.getCurrentRouteSnapshot().updateInteractionIds(currentIds);\n if (removingLastActivity) {\n this.navigateByUrl(urlSnapshot, {\n replaceUrl: true\n }).then(() => {\n // for some reason we need to pop the last history off the stack when leaving the\n // active activity state.\n this.angularLocation.back();\n });\n } else {\n this.navigateByUrl(urlSnapshot, {\n replaceUrl: true\n });\n }\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"place-router.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-router.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAGL,gBAAgB,EAChB,aAAa,EACb,eAAe,EAEf,eAAe,EACf,MAAM,EACN,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EAEN,GAAG,EACH,gBAAgB,EAEhB,IAAI,EAEJ,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EAGlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;;;;;;AAI7C;IAGiC,uCAAgB;IAU/C,qBAA6B,MAAc,EACd,aAA4B,EAC5B,eAAyB,EACzB,YAA0B,EAC1B,kBAAsC;QAJnE,YAKE,iBAAO,SAgER;QArE4B,YAAM,GAAN,MAAM,CAAQ;QACd,mBAAa,GAAb,aAAa,CAAe;QAC5B,qBAAe,GAAf,eAAe,CAAU;QACzB,kBAAY,GAAZ,YAAY,CAAc;QAC1B,wBAAkB,GAAlB,kBAAkB,CAAoB;QAZlD,2BAAqB,GAAG,IAAI,iBAAiB,EAAmB,CAAC;QACjE,mBAAa,GAAG,IAAI,gBAAgB,EAAS,CAAC;QAavD,IAAA,2BAAkF,EAAhF,gBA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,AApQD,CAGiC,gBAAgB,GAiQhD;SAjQY,WAAW;;;;;;IAEtB,4CAAkF;;;;;IAClF,oCAA+D;;IAE/D,2CAAmD;;IACnD,uCAAsE;;;;;IACtE,gDAA2D;;;;;IAC3D,gDAAmF;;;;;IAEvE,6BAA+B;;;;;IAC/B,oCAA6C;;;;;IAC7C,sCAA0C;;;;;IAC1C,mCAA2C;;;;;IAC3C,yCAAuD","sourcesContent":["import { Location } from '@angular/common';\nimport { Injectable } from '@angular/core';\nimport {\n ActivatedRoute,\n ActivatedRouteSnapshot,\n NavigationCancel,\n NavigationEnd,\n NavigationError,\n NavigationExtras,\n NavigationStart,\n Router,\n UrlSerializer\n} from '@angular/router';\nimport {\n assert,\n Constructable,\n Dsl,\n GarbageCollector,\n HasOneIndexChain,\n lang,\n ListModel,\n Logger,\n MutableListModel,\n MutableStream,\n MutableValueModel,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport _ from 'lodash';\nimport { InteractionService } from '../interaction/services/interaction.service';\nimport { NavigationState } from './guards/navigation-state';\nimport { PlaceHistory } from './place-history';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\n\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PlaceRouter extends GarbageCollector {\n\n private readonly _navigationStateModel = new MutableValueModel<NavigationState>();\n private readonly _activeVisits = new MutableListModel<Visit>();\n\n readonly navigationInProgress: ValueModel<boolean>;\n readonly activeVisitIndex: HasOneIndexChain<'placeDefinition', Visit>;\n private _navigationSessionContext: NavigationState.Context;\n private _navigationStateTypeModel: ValueModelChain<Constructable<NavigationState>>;\n\n constructor(private readonly router: Router,\n private readonly urlSerializer: UrlSerializer,\n private readonly angularLocation: Location,\n private readonly placeHistory: PlaceHistory,\n private readonly interactionService: InteractionService) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');\n this.navigationInProgress = chain(this.navigationStateModel).pluck('isTransitional');\n this._navigationSessionContext = new NavigationState.Context(this, this.interactionService, session => {\n this.processNavigationSuccess(session);\n });\n this._navigationStateModel.value = new NavigationState.Idle(this._navigationSessionContext);\n this._navigationStateTypeModel = chain(this._navigationStateModel).map(state => state.constructor as Constructable<NavigationState>);\n\n // TODO: make setup the callbacks in during module initiation to make this testable.\n this.router.events.subscribe(event => {\n // Routing event sequence\n // ======================\n // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session\n // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.\n // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.\n // =======================\n if (event instanceof NavigationStart) {\n if (event.navigationTrigger === 'popstate') {\n this.runStateTransition(state => state.onPopState(event));\n } else {\n this.runStateTransition(state => state.onRouterStarted(event));\n }\n }\n if (event instanceof NavigationEnd) {\n console.log(event);\n this.runStateTransition(state => state.onRouterEnd(event));\n }\n if (event instanceof NavigationError) {\n console.log(event);\n this.runStateTransition(state => state.onRouterError(event));\n }\n if (event instanceof NavigationCancel) {\n console.log(event);\n this.runStateTransition(state => state.onRouterCancelled(event));\n }\n });\n\n // Push dialog state to the url so we can capture the back button.\n when.listOf(this.interactionService.activeInteractionContextIds).changes((ids, previous) => {\n this.syncInteractionIdsWithRouter(ids, previous);\n }, { unless: this.navigationInProgress }); // TODO: I think the exclusive interaction prevents interactions starting while it's active so we might not need this.\n\n const urlChanges = new MutableStream<{ url: string, state: NavigationState }>();\n\n // The angular router doesn't always fire router events when the back button is pushed while a navigation\n // session is in progress. Sometimes we only know about it from the url change.\n // IMPORTANT ORDER DEPENDENCY\n // This only works because we're notified of the change after the router has started reacting to it. This\n // we can can use our navigationState to determine things.\n angularLocation.onUrlChange(url => {\n const navigationState = this._navigationStateModel.value;\n console.log(`URLChange -> ${url}`, { state: navigationState });\n urlChanges.publish({ url, state: navigationState });\n\n // The url has changed while we're in a transitional state\n if (navigationState.isTransitional) {\n const navigationInteraction = this.navigationState.interactionContext;\n if (navigationInteraction && navigationInteraction.isActive()) {\n this.runStateTransition(state => state.onBackClickedDuringNavigationInteraction(url));\n }\n }\n });\n }\n\n private processNavigationSuccess(session: NavigationState) {\n // We need to update the visits before the session finishes. This allows the placeOutets to ignore visit\n // changes that occur while routerNavigationActive is true.\n assert.isTruthy(this.navigationInProgress.value);\n const visits = session.getVisits();\n visits.forEach(v => this.placeHistory.add(v));\n this._activeVisits.value = visits;\n }\n\n get navigationState(): NavigationState {\n return this._navigationStateModel.value;\n }\n\n get navigationStateModel(): ValueModel<NavigationState> {\n return this._navigationStateModel.readonly;\n }\n\n get activeVisits(): ListModel<Visit> {\n return this._activeVisits.readonly;\n }\n\n /**\n * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));\n * @param visit\n */\n async navigate(visit: Visit, options?: { relativeTo: ActivatedRoute }) {\n this.doNavigation(visit, async router => {\n const commands = [\n visit.placeDefinition.path,\n ...this.createRouteParameters(visit)\n ];\n await this.router.navigate(commands, {\n relativeTo: options ? options.relativeTo : null\n });\n });\n }\n\n // @Trace()\n async pushVisitChangesToRoute(activatedRoute: ActivatedRoute, previous: Visit, next: Visit) {\n // we have to push to history so our remember sanitisers don't pick up the previous value\n // when it's been cleared by the user.\n this.placeHistory.add(next);\n\n // FIXME: no route id -> route id duplicates route parameters\n if (next.hasRoutingChangedFrom(previous)) {\n return this.doNavigation(next, router => {\n const urlSnapshot = this.parseUrl(this.router.routerState.snapshot.url).updateVisitSegments(next);\n console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });\n return this.navigateByUrl(urlSnapshot);\n });\n }\n }\n\n async doNavigation(visit: Visit, runNavigationCommands: (router: Router) => any) {\n if (this.navigationInProgress.value) {\n lang.illegalState('Navigation already in progress');\n }\n this.runStateTransition(current => {\n const session = this.navigationState.onPlaceNavigationStart(visit, this.getCurrentRouterUrl());\n session.storeVisit(visit);\n return session;\n });\n try {\n await runNavigationCommands(this.router);\n } finally {\n // Router has finished (since there was no router change required) so we\n // need to end the navigation session.\n if (this.navigationState.isTransitional && !this.router.getCurrentNavigation()) {\n this.runStateTransition(session => session.onRouterEnd(new NavigationEnd(-1, '', '')));\n }\n }\n }\n\n // @Trace()\n protected runStateTransition(transition: (navigationSession: NavigationState) => NavigationState) {\n const previous = this._navigationStateModel.value;\n const next = transition(this.navigationState);\n this._navigationStateModel.value = next;\n if (next !== previous) {\n previous.dispose();\n Logger.get(this).info(`Router State Transition: ${previous.toString()} -> ${next.toString()}`);\n }\n }\n\n private createRouteParameters(visit: Visit) {\n const def = visit.placeDefinition;\n return visit.hasRouteId() ?\n [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :\n [def.getFormattedRouteParameters(visit)];\n }\n\n extractChildPath(activatedRoute: ActivatedRouteSnapshot): any[] {\n return _.flatten(activatedRoute.children.map(child => child.url));\n }\n\n parseUrl(url: string): UrlSnapshot {\n return new UrlSnapshot(this.urlSerializer, url);\n }\n\n resetBrowserLocation(url: string, options: { replaceCurrent: boolean }) {\n options.replaceCurrent ? this.angularLocation.replaceState(url) : this.angularLocation.go(url);\n }\n\n forward() {\n this.angularLocation.forward();\n }\n\n createUrlSnapshot(...visits: Visit[]): UrlSnapshot {\n const bits = [];\n visits.forEach(v => {\n bits.push(this.parseUrl(`${v.placeDefinition.path}`).updateVisitSegments(v).url);\n });\n return this.parseUrl(bits.join(''));\n }\n\n getCurrentRouterUrl(): string {\n return this.router.routerState ? this.router.routerState.snapshot.url : null;\n }\n\n getCurrentRouteSnapshot(): UrlSnapshot {\n return this.parseUrl(this.getCurrentRouterUrl());\n }\n\n getActiveInteractionIdsFromUrl(url: string): string[] {\n return this.parseUrl(url).getInteractionIds();\n }\n\n\n // @Trace()\n hasActiveInteractionIds(url: string) {\n return this.getActiveInteractionIdsFromUrl(url).length > 0;\n }\n\n // @Trace()\n navigateByUrl(urlSnapshot: UrlSnapshot, navigationExtras?: NavigationExtras): Promise<boolean> {\n return this.router.navigateByUrl(urlSnapshot.urlTree, navigationExtras);\n }\n\n // TODO: Should this be moved to the navigation states?\n syncInteractionIdsWithRouter(currentIds: string[], previous: string[]) {\n assert.isFalsey(this.navigationInProgress.value); // Updating interaction routes during an existing navigation breaks all the things.\n console.log({\n startingActivity: currentIds.length > previous.length,\n wasBackButton: this.navigationState.isPopState\n });\n\n if (_.isEqual(currentIds, previous)) {\n console.log('activity ids were the same, skipping');\n } else {\n // OMG, this is nuts.\n const addingActivity = currentIds.length > previous.length;\n const isFirstActivity = addingActivity && previous.length < 1;\n const removingLastActivity = currentIds.length < 1;\n if (addingActivity) {// we're starting a new activity, push the change to the history and update the url\n console.log('adding activity');\n this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds), {\n replaceUrl: !isFirstActivity // we don't let the history pile up\n });\n } else {\n const urlSnapshot = this.getCurrentRouteSnapshot().updateInteractionIds(currentIds);\n if (removingLastActivity) {\n this.navigateByUrl(urlSnapshot, {\n replaceUrl: true\n }).then(() => {\n // for some reason we need to pop the last history off the stack when leaving the\n // active activity state.\n this.angularLocation.back();\n });\n } else {\n this.navigateByUrl(urlSnapshot, {\n replaceUrl: true\n });\n }\n }\n }\n }\n}\n"]}
@@ -71,8 +71,8 @@ export function RouteId(type, options) {
71
71
  /** @type {?} */
72
72
  var param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
73
73
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
74
- // UseDelegate({tag: `@RouteId(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);
75
- UseDelegate()(prototype, propertyKey);
74
+ UseDelegate({ tag: "@RouteId(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
75
+ // UseDelegate()(prototype, propertyKey);
76
76
  });
77
77
  }
78
78
  /**
@@ -92,8 +92,8 @@ export function VisitParameter(options) {
92
92
  /** @type {?} */
93
93
  var param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
94
94
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
95
- // UseDelegate({tag: `@VisitParameter(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);
96
- UseDelegate()(prototype, propertyKey);
95
+ UseDelegate({ tag: "@VisitParameter(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
96
+ // UseDelegate()(prototype, propertyKey);
97
97
  });
98
98
  }
99
99
  /**
@@ -112,8 +112,8 @@ export function VisitParameterList(options) {
112
112
  function (prototype, propertyKey) {
113
113
  /** @type {?} */
114
114
  var param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
115
- // UseDelegate({tag: `@VisitParameterList(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);
116
- UseDelegate()(prototype, propertyKey);
115
+ UseDelegate({ tag: "@VisitParameterList(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
116
+ // UseDelegate()(prototype, propertyKey);
117
117
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
118
118
  });
119
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parameter-decorators.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/route/parameter-decorators.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;;;;;AAInE,oCAMC;;;IALC,4BAAY;;IACZ,kCAAmB;;IACnB,kCAAmB;;IACnB,sCAAiB;;;;;;AAInB,2CAOC;;;IANC,mCAAY;;IACZ,yCAAmB;;IACnB,yCAAmB;;IACnB,6CAAiB;;IACjB,2CAAyB;;;;;;AAI3B,+C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,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAC3H,8HAA8H;QAC9H,WAAW,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACtC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC,EAAC;AACJ,CAAC","sourcesContent":["import { UseDelegate } from '@coolon/pectin';\nimport { Klass, Opts } from '@coolon/typescript-utilities';\nimport { ROUTE_PARAMETER_LIST_KEY } from '../place-component';\nimport { ParameterDefinition } from './parameter-definition.class';\nimport { Formatter } from './formatter';\n\n\nexport interface RouteIdOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T;\n // sanitiser?: Constructable<ParameterSanitiser<T>> | ParameterSanitiser<T>;\n}\n\nexport interface RouteParameterOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T;\n storeInUrl?: Formatter<T>\n // sanitiser?: Constructable<ParameterSanitiser<T>> | ParameterSanitiser<T>;\n}\n\nexport interface RouteListParameterOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T[];\n storeInUrl?: Formatter<T>\n // sanitiser?: Constructable<ParameterSanitiser<T[]>> | ParameterSanitiser<T[]>;\n}\n\nexport function RouteId<T extends string | number>(type: Formatter<T>, options?: RouteIdOptions<T>): PropertyDecorator {\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n // UseDelegate({tag: `@RouteId(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);\n UseDelegate()(prototype, propertyKey);\n };\n}\n\nexport function VisitParameter<T>(options?: RouteParameterOptions<T>): PropertyDecorator {\n const opts = Opts.get(options);\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional(\"storeInUrl\", null));\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n // UseDelegate({tag: `@VisitParameter(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);\n UseDelegate()(prototype, propertyKey);\n };\n}\n\nexport function VisitParameterList<E>(options?: RouteListParameterOptions<E>): PropertyDecorator {\n const opts = Opts.get(options);\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional(\"storeInUrl\", null));\n // UseDelegate({tag: `@VisitParameterList(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);\n UseDelegate()(prototype, propertyKey);\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n };\n}\n\n// export function RouteParameter<T>(type: ParameterType<T>, options?: RouteParameterOptions<T>): PropertyDecorator {\n// return (prototype: Object, propertyKey: string | symbol) => {\n// const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, type);\n// Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n// UseDelegate()(prototype, propertyKey);\n// };\n// }\n//\n// export function RouteParameterList<E>(elementType: ParameterType<E>, options?: RouteListParameterOptions<E>): PropertyDecorator {\n// return (prototype: Object, propertyKey: string | symbol) => {\n// const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, elementType);\n// Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n// UseDelegate()(prototype, propertyKey);\n// };\n// }\n"]}
1
+ {"version":3,"file":"parameter-decorators.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/route/parameter-decorators.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAA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B,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC3E,WAAW,CAAC,EAAC,GAAG,EAAE,qBAAmB,SAAS,CAAC,WAAW,CAAC,IAAI,SAAI,WAAW,CAAC,QAAQ,EAAE,MAAG,EAAC,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACvH,yCAAyC;IAC3C,CAAC,EAAC;AACJ,CAAC;;;;;;AAED,MAAM,UAAU,kBAAkB,CAAI,OAAsC;;QACpE,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;IAC9B;;;;;IAAO,UAAC,SAAiB,EAAE,WAA4B;;YAC/C,KAAK,GAAG,IAAI,mBAAmB,CAAC,cAAc,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAC3H,WAAW,CAAC,EAAC,GAAG,EAAE,yBAAuB,SAAS,CAAC,WAAW,CAAC,IAAI,SAAI,WAAW,CAAC,QAAQ,EAAE,MAAG,EAAC,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC3H,yCAAyC;QACzC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC,EAAC;AACJ,CAAC","sourcesContent":["import { UseDelegate } from '@coolon/pectin';\nimport { Klass, Opts } from '@coolon/typescript-utilities';\nimport { ROUTE_PARAMETER_LIST_KEY } from '../place-component';\nimport { ParameterDefinition } from './parameter-definition.class';\nimport { Formatter } from './formatter';\n\n\nexport interface RouteIdOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T;\n // sanitiser?: Constructable<ParameterSanitiser<T>> | ParameterSanitiser<T>;\n}\n\nexport interface RouteParameterOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T;\n storeInUrl?: Formatter<T>\n // sanitiser?: Constructable<ParameterSanitiser<T>> | ParameterSanitiser<T>;\n}\n\nexport interface RouteListParameterOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T[];\n storeInUrl?: Formatter<T>\n // sanitiser?: Constructable<ParameterSanitiser<T[]>> | ParameterSanitiser<T[]>;\n}\n\nexport function RouteId<T extends string | number>(type: Formatter<T>, options?: RouteIdOptions<T>): PropertyDecorator {\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n UseDelegate({tag: `@RouteId(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);\n // UseDelegate()(prototype, propertyKey);\n };\n}\n\nexport function VisitParameter<T>(options?: RouteParameterOptions<T>): PropertyDecorator {\n const opts = Opts.get(options);\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional(\"storeInUrl\", null));\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n UseDelegate({tag: `@VisitParameter(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);\n // UseDelegate()(prototype, propertyKey);\n };\n}\n\nexport function VisitParameterList<E>(options?: RouteListParameterOptions<E>): PropertyDecorator {\n const opts = Opts.get(options);\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional(\"storeInUrl\", null));\n UseDelegate({tag: `@VisitParameterList(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);\n // UseDelegate()(prototype, propertyKey);\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n };\n}\n\n// export function RouteParameter<T>(type: ParameterType<T>, options?: RouteParameterOptions<T>): PropertyDecorator {\n// return (prototype: Object, propertyKey: string | symbol) => {\n// const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, type);\n// Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n// UseDelegate()(prototype, propertyKey);\n// };\n// }\n//\n// export function RouteParameterList<E>(elementType: ParameterType<E>, options?: RouteListParameterOptions<E>): PropertyDecorator {\n// return (prototype: Object, propertyKey: string | symbol) => {\n// const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, elementType);\n// Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n// UseDelegate()(prototype, propertyKey);\n// };\n// }\n"]}
@@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
4
4
  import { MatInputModule, MatFormFieldModule, MatSelectModule, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule, MatDialog } from '@angular/material';
5
5
  import { MatTabsModule } from '@angular/material/tabs';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
- import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, Binding, Guard, StoreInValueModel, Command, ValueHolder } from '@coolon/pectin';
7
+ import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, DebugContext, Binding, Guard, StoreInValueModel, Command, ValueHolder } from '@coolon/pectin';
8
8
  import { __decorate, __metadata, __awaiter } from 'tslib';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
10
  import { RouterModule, UrlSegment, NavigationStart, NavigationEnd, NavigationError, NavigationCancel, Router, UrlSerializer } from '@angular/router';
@@ -2676,7 +2676,7 @@ class PlaceComponent extends DisposableComponent {
2676
2676
  initialiseBindings(visit) {
2677
2677
  assert.isNil(this.visit);
2678
2678
  this.visit = visit;
2679
- // DebugContext.get(this.visit).tag(`${this.placeDefinition.component.name}.visit`);
2679
+ DebugContext.get(this.visit).tag(`${this.placeDefinition.component.name}.visit`);
2680
2680
  this.placeDefinition.getVisitParameterDefs().forEach((/**
2681
2681
  * @param {?} parameterDef
2682
2682
  * @return {?}
@@ -3220,13 +3220,13 @@ class NavigationState extends GarbageCollector {
3220
3220
  new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :
3221
3221
  new NavigationState.Idle(this.context);
3222
3222
  }
3223
- //
3224
3223
  /**
3225
3224
  * @param {?} url
3225
+ * @param {?=} options
3226
3226
  * @return {?}
3227
3227
  */
3228
- resetBrowserLocation(url) {
3229
- this.placeRouter.resetBrowserLocation(url);
3228
+ resetBrowserLocation(url, options = { replaceCurrent: false }) {
3229
+ this.placeRouter.resetBrowserLocation(url, options);
3230
3230
  }
3231
3231
  /**
3232
3232
  * @param {?} event
@@ -3258,6 +3258,20 @@ class NavigationState extends GarbageCollector {
3258
3258
  return `${p}: ${this[p]}`;
3259
3259
  })).join(', ');
3260
3260
  }
3261
+ /**
3262
+ * @protected
3263
+ * @param {?} url
3264
+ * @return {?}
3265
+ */
3266
+ replaceBuggeredUrlAfterAngularRouterCancelled(url) {
3267
+ // Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.
3268
+ // So this means that the top of the stack is the url we want to go back to, and not the one that was on
3269
+ // it before the cancel event fired.
3270
+ // So we need to:
3271
+ // - replace the just inserted url with the one that used to be there.
3272
+ // - push our actual url back onto the top of the stack.
3273
+ this.resetBrowserLocation(url, { replaceCurrent: true });
3274
+ }
3261
3275
  }
3262
3276
  if (false) {
3263
3277
  /**
@@ -3536,11 +3550,11 @@ if (false) {
3536
3550
  * @return {?}
3537
3551
  */
3538
3552
  onRouterCancelled(event) {
3553
+ this.replaceBuggeredUrlAfterAngularRouterCancelled(this.poppedHistoryUrl);
3539
3554
  // Angular doesn't preserve the url when a guard cancels the back button.
3540
3555
  // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
3541
3556
  Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
3542
- this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.
3543
- this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
3557
+ this.resetBrowserLocation(this.startingUrl);
3544
3558
  return new Idle(this.context);
3545
3559
  }
3546
3560
  /**
@@ -3548,15 +3562,18 @@ if (false) {
3548
3562
  * @return {?}
3549
3563
  */
3550
3564
  onRouterError(event) {
3551
- // navigation was aborted.
3552
- if (this.currentRouterUrl() !== this.startingUrl) {
3553
- // Angular doesn't preserve the url when a guard cancels the back button.
3554
- // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
3555
- Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
3556
- this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.
3557
- this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
3558
- }
3559
- return new Idle(this.context);
3565
+ // // navigation was aborted.
3566
+ // if (this.currentRouterUrl() !== this.startingUrl) {
3567
+ // // Angular doesn't preserve the url when a guard cancels the back button.
3568
+ // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
3569
+ // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
3570
+ // this.restoreHistory([
3571
+ // this.poppedHistoryUrl,
3572
+ // this.startingUrl
3573
+ // ]);
3574
+ // }
3575
+ // return new Idle(this.context);
3576
+ return this.illegalTransition("when do I get this???");
3560
3577
  }
3561
3578
  /**
3562
3579
  * @param {?} locationTriggerUrl
@@ -3668,6 +3685,7 @@ if (false) {
3668
3685
  * @return {?}
3669
3686
  */
3670
3687
  onRouterCancelled(event) {
3688
+ // TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???
3671
3689
  if (this.context.interactionService.isActive()) {
3672
3690
  /** @type {?} */
3673
3691
  const interactionIds = this.interactionService.activeInteractionContextIds.value;
@@ -3760,6 +3778,7 @@ if (false) {
3760
3778
  this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
3761
3779
  }
3762
3780
  else {
3781
+ // this.replaceBuggeredUrlAfterAngularRouterCancells(this.start)
3763
3782
  this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
3764
3783
  }
3765
3784
  return this.createIdleState();
@@ -3834,6 +3853,7 @@ if (false) {
3834
3853
  * @return {?}
3835
3854
  */
3836
3855
  onRouterCancelled(event) {
3856
+ // TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???
3837
3857
  if (this.interactionService.isActive()) {
3838
3858
  /** @type {?} */
3839
3859
  const interactionIds = this.interactionService.activeInteractionContextIds.value;
@@ -3861,7 +3881,7 @@ if (false) {
3861
3881
  * @return {?}
3862
3882
  */
3863
3883
  createNavigationInteractionCancelledState(newUrl) {
3864
- return this.illegalTransition("Leaving interaction after pop-state should't block so should never see a back button click");
3884
+ return this.illegalTransition('Leaving interaction after pop-state should\'t block so should never see a back button click');
3865
3885
  }
3866
3886
  }
3867
3887
  NavigationState.LeavingInteractionAfterPopStateTransition = LeavingInteractionAfterPopStateTransition;
@@ -3871,74 +3891,6 @@ if (false) {
3871
3891
  /** @type {?} */
3872
3892
  LeavingInteractionAfterPopStateTransition.prototype.poppedHistoryUrl;
3873
3893
  }
3874
- // See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
3875
- //
3876
- // export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
3877
- //
3878
- // readonly isPopState = false;
3879
- // firstCancelHandled = false;
3880
- // popStateHandled = false;
3881
- // popStateEventUrl: string;
3882
- // debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
3883
- //
3884
- // constructor(context: Context,
3885
- // readonly startingUrl: string,
3886
- // readonly locationChangeTriggerUrl: string,
3887
- // readonly poppedHistoryUrl: string) {
3888
- // super(context);
3889
- // }
3890
- //
3891
- // get isTransitional() {
3892
- // return true;
3893
- // }
3894
- //
3895
- // onRouterStarted(event: NavigationStart): NavigationState {
3896
- // return this.ignore(event);
3897
- // }
3898
- //
3899
- //
3900
- // onRouterCancelled(event: NavigationCancel): NavigationState {
3901
- //
3902
- // // if (this.firstCancelHandled && this.popStateHandled) {
3903
- // // // Angular doesn't preserve the url when a guard cancels the back button.
3904
- // // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
3905
- // // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
3906
- // // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
3907
- // // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
3908
- // // if (this.interactionService.isActive()) {
3909
- // // const interactionIds = this.interactionService.activeInteractionContextIds.value;
3910
- // // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
3911
- // // } else {
3912
- // // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
3913
- // // }
3914
- // // return this.createIdleState();
3915
- // // } else {
3916
- // // this.firstCancelHandled = true;
3917
- // return this.ignore(event);
3918
- // // }
3919
- // }
3920
- //
3921
- //
3922
- // onRouterEnd(event: NavigationEnd): NavigationState {
3923
- // return this.ignore(event);
3924
- // }
3925
- //
3926
- //
3927
- // onRouterError(event: NavigationError): NavigationState {
3928
- // return this.ignore(event);
3929
- // }
3930
- //
3931
- //
3932
- // onPopState(event: NavigationStart): NavigationState {
3933
- // // this.popStateHandled = true;
3934
- // // this.popStateEventUrl = event.url;
3935
- // return this.ignore(event);
3936
- // }
3937
- //
3938
- // async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
3939
- // return false;
3940
- // }
3941
- // }
3942
3894
  /**
3943
3895
  * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
3944
3896
  * The routing event sequence is different depending on the link that was clicked.
@@ -4038,7 +3990,7 @@ if (false) {
4038
3990
  */
4039
3991
  finaliseRouting() {
4040
3992
  Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4041
- this.resetBrowserLocation(this.clickedLinkUrl); // put the back click one back in.
3993
+ this.replaceBuggeredUrlAfterAngularRouterCancelled(this.clickedLinkUrl); // put the back click one back in.
4042
3994
  if (this.interactionService.isActive()) {
4043
3995
  /** @type {?} */
4044
3996
  const interactionIds = this.interactionService.activeInteractionContextIds.value;
@@ -4130,7 +4082,13 @@ if (false) {
4130
4082
  // Angular doesn't preserve the url when a guard cancels the back button.
4131
4083
  // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4132
4084
  Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
4133
- // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
4085
+ // Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.
4086
+ // So this means that the top of the stack is the url we want to go back to, and not the one that was on
4087
+ // it before the cancel event fired.
4088
+ // So we need to:
4089
+ // - replace the just inserted url with the one that used to be there.
4090
+ // - push our actual url back onto the top of the stack.
4091
+ this.replaceBuggeredUrlAfterAngularRouterCancelled(this.locationChangeTriggerUrl);
4134
4092
  this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
4135
4093
  if (this.interactionService.isActive()) {
4136
4094
  /** @type {?} */
@@ -4730,10 +4688,17 @@ class PlaceRouter extends GarbageCollector {
4730
4688
  }
4731
4689
  /**
4732
4690
  * @param {?} url
4691
+ * @param {?} options
4692
+ * @return {?}
4693
+ */
4694
+ resetBrowserLocation(url, options) {
4695
+ options.replaceCurrent ? this.angularLocation.replaceState(url) : this.angularLocation.go(url);
4696
+ }
4697
+ /**
4733
4698
  * @return {?}
4734
4699
  */
4735
- resetBrowserLocation(url) {
4736
- this.angularLocation.go(url);
4700
+ forward() {
4701
+ this.angularLocation.forward();
4737
4702
  }
4738
4703
  /**
4739
4704
  * @param {...?} visits
@@ -6850,8 +6815,8 @@ function RouteId(type, options) {
6850
6815
  /** @type {?} */
6851
6816
  const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
6852
6817
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
6853
- // UseDelegate({tag: `@RouteId(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);
6854
- UseDelegate()(prototype, propertyKey);
6818
+ UseDelegate({ tag: `@RouteId(${prototype.constructor.name}.${propertyKey.toString()})` })(prototype, propertyKey);
6819
+ // UseDelegate()(prototype, propertyKey);
6855
6820
  });
6856
6821
  }
6857
6822
  /**
@@ -6871,8 +6836,8 @@ function VisitParameter(options) {
6871
6836
  /** @type {?} */
6872
6837
  const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
6873
6838
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
6874
- // UseDelegate({tag: `@VisitParameter(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);
6875
- UseDelegate()(prototype, propertyKey);
6839
+ UseDelegate({ tag: `@VisitParameter(${prototype.constructor.name}.${propertyKey.toString()})` })(prototype, propertyKey);
6840
+ // UseDelegate()(prototype, propertyKey);
6876
6841
  });
6877
6842
  }
6878
6843
  /**
@@ -6891,8 +6856,8 @@ function VisitParameterList(options) {
6891
6856
  (prototype, propertyKey) => {
6892
6857
  /** @type {?} */
6893
6858
  const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
6894
- // UseDelegate({tag: `@VisitParameterList(${prototype.constructor.name}.${propertyKey.toString()})`})(prototype, propertyKey);
6895
- UseDelegate()(prototype, propertyKey);
6859
+ UseDelegate({ tag: `@VisitParameterList(${prototype.constructor.name}.${propertyKey.toString()})` })(prototype, propertyKey);
6860
+ // UseDelegate()(prototype, propertyKey);
6896
6861
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
6897
6862
  });
6898
6863
  }