@coolon/angular-ui-powerups 16.1.0-alpha.272 → 16.1.0-alpha.274

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.
@@ -1,5 +1,5 @@
1
1
  import { TrackByFunction } from '@angular/core';
2
- import { Command, Constructable, DelegatingValueModel, ListModel, ListModelChain, ValueModel } from '@coolon/pectin';
2
+ import { BooleanValueModelChain, Command, Constructable, DelegatingValueModel, ListModel, ListModelChain, ValueModel } from '@coolon/pectin';
3
3
  import type { CommandFace } from '../../components/commands/command-face';
4
4
  import { DisposableComponent } from '../../components/disposable-component';
5
5
  import { PlaceComponent } from '../place-component';
@@ -17,8 +17,17 @@ export declare class AbstractPlaceNavigationComponent extends DisposableComponen
17
17
  accessor places$: ListModel<Constructable<PlaceComponent>>;
18
18
  accessor placeOutlet: PlaceOutletComponent;
19
19
  accessor placeOutlet$: ValueModel<PlaceOutletComponent>;
20
+ accessor hideWhenSinglePlace$: ValueModel<boolean>;
21
+ /**
22
+ * Hide the whole bar when it would render a single item: one tab is not a choice, so it reads as
23
+ * chrome rather than navigation. Off by default - a bar that has always shown one item keeps
24
+ * doing so until its consumer opts in.
25
+ */
26
+ accessor hideWhenSinglePlace: boolean;
20
27
  private readonly placeDefinitions;
21
28
  readonly menuItems: ListModelChain<MenuItem>;
29
+ /** Whether the bar should render nothing at all - see {@link hideWhenSinglePlace}. */
30
+ readonly hidden$: BooleanValueModelChain;
22
31
  readonly commandFactory: Command.Factory<PlaceDefinition, void>;
23
32
  readonly _activePlaceComponent: DelegatingValueModel<PlaceComponent>;
24
33
  private activePlaceDefinition;
@@ -30,6 +39,6 @@ export declare class AbstractPlaceNavigationComponent extends DisposableComponen
30
39
  getNavigationFace(placeDef: PlaceDefinition): CommandFace;
31
40
  private createCommandFaceFor;
32
41
  static ɵfac: i0.ɵɵFactoryDeclaration<AbstractPlaceNavigationComponent, never>;
33
- static ɵcmp: i0.ɵɵComponentDeclaration<AbstractPlaceNavigationComponent, "ng-component", never, { "places": { "alias": "places"; "required": false; }; "places$": { "alias": "places$"; "required": false; }; "placeOutlet": { "alias": "placeOutlet"; "required": false; }; "placeOutlet$": { "alias": "placeOutlet$"; "required": false; }; }, {}, never, never, false, never>;
42
+ static ɵcmp: i0.ɵɵComponentDeclaration<AbstractPlaceNavigationComponent, "ng-component", never, { "places": { "alias": "places"; "required": false; }; "places$": { "alias": "places$"; "required": false; }; "placeOutlet": { "alias": "placeOutlet"; "required": false; }; "placeOutlet$": { "alias": "placeOutlet$"; "required": false; }; "hideWhenSinglePlace$": { "alias": "hideWhenSinglePlace$"; "required": false; }; "hideWhenSinglePlace": { "alias": "hideWhenSinglePlace"; "required": false; }; }, {}, never, never, false, never>;
34
43
  }
35
44
  export {};
@@ -42,6 +42,28 @@ export declare class PlaceGuard {
42
42
  */
43
43
  private selectRedirectChild;
44
44
  private findBestAuthenticatedAlternative;
45
+ /**
46
+ * A visit to the alternative place, carrying its ancestors' RESOLVED route parameters.
47
+ *
48
+ * `Visit.goto` builds a single, parameterless segment, and the url is then assembled from the
49
+ * destination's ancestorsAndSelf — so an ancestor holding a route id contributes an EMPTY id
50
+ * slot. That url is not merely wrong, it is unrepresentable: `groups//devices` collapses, and
51
+ * `groups/devices` binds the child's path into the id slot, navigating to a "group" called
52
+ * `devices` and eventually failing in `UrlSnapshot.appendSegment`. The user lands on `#/` with
53
+ * nothing explaining why. (`Visit.getRouterCommands` guards this case explicitly; the
54
+ * `createUrlSnapshot` path used for redirects does not, which is why it surfaced here.)
55
+ *
56
+ * The ancestors' ids are already resolved by the time we need them: guards run parent-first, so
57
+ * each ancestor's own pass has already sanitised its segment into the navigation session. Any
58
+ * ancestor without a stored segment falls back to a bare one, which is the pre-existing
59
+ * behaviour for a parameterless chain.
60
+ *
61
+ * Reached whenever a place is refused while a parameterised ancestor stays authorised — most
62
+ * often a DISABLED (`enablePlace`) child of a route-id parent, e.g. a feature-flagged tab
63
+ * reached by a stale deep link. Pure role gating rarely hits it, because a role usually gates a
64
+ * whole subtree rather than one child of a parameterised parent.
65
+ */
66
+ private visitToAlternative;
45
67
  canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree>;
46
68
  private getPlaceDefinition;
47
69
  private createUrlTree;
@@ -7,6 +7,13 @@ export interface NavigationContext {
7
7
  readonly urlService: UrlService;
8
8
  readonly routerInteractionAdapter: InteractionServiceRoutingAdapter;
9
9
  finishRoutingSession(visit?: Visit): any;
10
+ /**
11
+ * Records a completed navigation's visit (active visit + place history) WITHOUT finishing the
12
+ * session — for sessions that hand over to housekeeping (e.g. the interaction-id sync) whose own
13
+ * finish is deliberately visitless. Dropping the visit instead leaves activeVisit$ stale, and a
14
+ * later navigate() then builds its url from stale (possibly id-less) segments.
15
+ */
16
+ recordVisit(visit: Visit): any;
10
17
  transitionTo(newState: NavigationSession): any;
11
18
  navigateByUrl(urlSnapshot: UrlSnapshot, options: {
12
19
  replaceUrl: boolean;
@@ -21,8 +28,9 @@ export declare namespace NavigationContext {
21
28
  }) => Promise<boolean>;
22
29
  readonly transitionTo: (newState: NavigationSession) => void;
23
30
  readonly finishRoutingSession: (visit?: Visit) => void;
31
+ readonly recordVisit: (visit: Visit) => void;
24
32
  constructor(urlService: UrlService, routerInteractionAdapter: InteractionServiceRoutingAdapter, navigateByUrl: (urlSnapshot: UrlSnapshot, options: {
25
33
  replaceUrl: boolean;
26
- }) => Promise<boolean>, transitionTo: (newState: NavigationSession) => void, finishRoutingSession: (visit?: Visit) => void);
34
+ }) => Promise<boolean>, transitionTo: (newState: NavigationSession) => void, finishRoutingSession: (visit?: Visit) => void, recordVisit: (visit: Visit) => void);
27
35
  }
28
36
  }
@@ -84,6 +84,12 @@ export declare class PlaceRouter extends GarbageCollector {
84
84
  private createNavigationSession;
85
85
  protected transitionTo(next: NavigationSession): void;
86
86
  private routingSessionFinished;
87
+ /**
88
+ * Records a completed navigation's visit without finishing the session. Shared by the normal
89
+ * finish path and sessions that hand over to visitless housekeeping (see
90
+ * NavigationContext.recordVisit).
91
+ */
92
+ private recordFinishedVisit;
87
93
  /**
88
94
  * Runs `func` when the NEXT navigation session finishes — which may be a session that hasn't
89
95
  * started yet (the interaction-id sync registers its completion job before starting the sync
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "16.1.0-alpha.272",
3
+ "version": "16.1.0-alpha.274",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^16.2.9",
6
6
  "@angular/common": "^16.2.9",