@nativescript/angular 21.0.1-alpha.9 → 21.2.0-alpha.0

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,14 +1,14 @@
1
1
  import * as _nativescript_core from '@nativescript/core';
2
2
  import { View, ContentView, LayoutBase, IDevice, Page, Device, GridLayout, Color, Frame, ActionItem, NavigationButton, ListView, ObservableArray, Template, CoreTypes, ItemEventData, TabView, NavigatedData, ViewBase, RootLayout, ShowModalOptions, NavigationTransition, Folder, File, Switch, DatePicker, TimePicker, Slider, KeyframeAnimation } from '@nativescript/core';
3
3
  import * as i0 from '@angular/core';
4
- import { InjectionToken, EmbeddedViewRef, ComponentRef, NgModuleRef, ApplicationRef, Provider, EnvironmentProviders, PlatformRef, ɵNgModuleFactory as _NgModuleFactory, Type, CompilerOptions, NgZone, Injector, NgModuleFactory, StaticProvider, Sanitizer, ApplicationConfig as ApplicationConfig$1, ViewContainerRef, ComponentFactoryResolver, TemplateRef, ElementRef, OnInit, OnDestroy, Renderer2, EventEmitter, ChangeDetectorRef, ComponentFactory, AfterViewInit, OnChanges, SimpleChanges, DoCheck, AfterContentInit, IterableDiffer, IterableDiffers, ErrorHandler, RendererStyleFlags2, RendererType2, RendererFactory2, QueryList, EnvironmentInjector, ModuleWithProviders, NgZoneOptions } from '@angular/core';
4
+ import { InjectionToken, EmbeddedViewRef, ComponentRef, NgModuleRef, ApplicationRef, Provider, EnvironmentProviders, PlatformRef, ɵNgModuleFactory as _NgModuleFactory, Type, CompilerOptions, NgZone, Injector, NgModuleFactory, StaticProvider, Sanitizer, ApplicationConfig as ApplicationConfig$1, ViewContainerRef, ComponentFactoryResolver, TemplateRef, ElementRef, OnInit, OnDestroy, Renderer2, EventEmitter, ChangeDetectorRef, ComponentFactory, AfterViewInit, OnChanges, SimpleChanges, DoCheck, AfterContentInit, IterableDiffer, IterableDiffers, ErrorHandler, RendererStyleFlags2, RendererType2, RendererFactory2, EnvironmentInjector, QueryList, ModuleWithProviders, NgZoneOptions } from '@angular/core';
5
5
  import * as _nativescript_angular from '@nativescript/angular';
6
6
  import * as rxjs from 'rxjs';
7
7
  import { Observable, ReplaySubject, Subject, BehaviorSubject } from 'rxjs';
8
8
  import * as i1 from '@angular/common';
9
9
  import { LocationStrategy, XhrFactory } from '@angular/common';
10
10
  import * as i1$2 from '@angular/router';
11
- import { Params, UrlSegmentGroup, ActivatedRouteSnapshot, RouteReuseStrategy, DetachedRouteHandle, Router, NavigationExtras, UrlTree, NavigationBehaviorOptions, ActivatedRoute, RouterOutletContract, Data, Routes, ExtraOptions, RouterFeatures } from '@angular/router';
11
+ import { Params, UrlSegmentGroup, ActivatedRouteSnapshot, RouteReuseStrategy, DetachedRouteHandle, RouterOutletContract, ActivatedRoute, Data, QueryParamsHandling, UrlTree, IsActiveMatchOptions, Router, NavigationExtras, NavigationBehaviorOptions, Routes, ExtraOptions, RouterFeatures } from '@angular/router';
12
12
  import * as i1$1 from '@angular/forms';
13
13
  import { ControlValueAccessor } from '@angular/forms';
14
14
  import { AnimationDriver, ɵAnimationEngine as _AnimationEngine, ɵAnimationStyleNormalizer as _AnimationStyleNormalizer, ɵWebAnimationsStyleNormalizer as _WebAnimationsStyleNormalizer } from '@angular/animations/browser';
@@ -307,7 +307,11 @@ declare class NativeScriptDocument {
307
307
  }
308
308
  declare const COMMON_PROVIDERS: StaticProvider[];
309
309
  declare const platformNativeScript: (extraProviders?: StaticProvider[]) => PlatformRef;
310
+ interface BootstrapContext {
311
+ platformRef?: PlatformRef;
312
+ }
310
313
  declare function bootstrapApplication(rootComponent: Type<any>, options?: ApplicationConfig$1): Promise<i0.ApplicationRef>;
314
+ declare function createApplication(options?: ApplicationConfig$1, context?: BootstrapContext): Promise<i0.ApplicationRef>;
311
315
  interface HmrOptions {
312
316
  /**
313
317
  * A factory function that returns either Module type or NgModuleFactory type.
@@ -1077,6 +1081,11 @@ declare class NativeDialogConfig<D = any> {
1077
1081
  * content will be rendered.
1078
1082
  */
1079
1083
  viewContainerRef?: ViewContainerRef;
1084
+ /**
1085
+ * Injector used for the instantiation of the component to be attached. If provided,
1086
+ * takes precedence over the injector indirectly provided by `ViewContainerRef`.
1087
+ */
1088
+ injector?: Injector;
1080
1089
  /** Where to render the actual dialog in. By default it renders using the native view of the ViewContainerRef */
1081
1090
  renderIn?: 'root' | 'viewContainerRef' | View;
1082
1091
  /** ID for the dialog. If omitted, a unique one will be generated. */
@@ -1093,7 +1102,9 @@ declare class NativeDialogConfig<D = any> {
1093
1102
  * the `HashLocationStrategy`).
1094
1103
  */
1095
1104
  closeOnNavigation?: boolean;
1096
- /** Alternate `ComponentFactoryResolver` to use when resolving the associated component. */
1105
+ /** Alternate `ComponentFactoryResolver` to use when resolving the associated component.
1106
+ * @deprecated
1107
+ */
1097
1108
  componentFactoryResolver?: ComponentFactoryResolver;
1098
1109
  nativeOptions?: NativeShowModalOptions;
1099
1110
  /**
@@ -2390,96 +2401,295 @@ declare class NSRouteReuseStrategy implements RouteReuseStrategy, OnDestroy {
2390
2401
  static ɵprov: i0.ɵɵInjectableDeclaration<NSRouteReuseStrategy>;
2391
2402
  }
2392
2403
 
2393
- type ExtendedNavigationExtras = NavigationExtras & NavigationOptions;
2394
- type ExtendedNavigationBehaviorOptions = NavigationBehaviorOptions & NavigationOptions;
2395
- interface BackNavigationOptions {
2396
- outlets?: Array<string>;
2397
- relativeTo?: ActivatedRoute | null;
2404
+ declare class PageRoute {
2405
+ activatedRoute: BehaviorSubject<ActivatedRoute>;
2406
+ constructor(startRoute: ActivatedRoute);
2398
2407
  }
2399
- declare class RouterExtensions {
2400
- router: Router;
2401
- locationStrategy: NSLocationStrategy;
2402
- frameService: FrameService;
2403
- constructor(router: Router, locationStrategy: NSLocationStrategy, frameService: FrameService);
2404
- navigate(commands: any[], extras?: ExtendedNavigationExtras): Promise<boolean>;
2405
- navigateByUrl(url: string | UrlTree, options?: ExtendedNavigationBehaviorOptions): Promise<boolean>;
2406
- back(backNavigationOptions?: BackNavigationOptions): void;
2407
- canGoBack(backNavigationOptions?: BackNavigationOptions): boolean;
2408
- backToPreviousPage(): void;
2409
- canGoBackToPreviousPage(): boolean;
2410
- private backOutlets;
2411
- private findOutletsToBack;
2412
- private findOutletsRecursive;
2413
- private findOutletByRoute;
2414
- static ɵfac: i0.ɵɵFactoryDeclaration<RouterExtensions, never>;
2415
- static ɵprov: i0.ɵɵInjectableDeclaration<RouterExtensions>;
2408
+ declare class PageRouterOutlet implements OnDestroy, RouterOutletContract {
2409
+ private parentContexts;
2410
+ private location;
2411
+ private locationStrategy;
2412
+ private resolver;
2413
+ private changeDetector;
2414
+ private pageFactory;
2415
+ private routeReuseStrategy;
2416
+ private ngZone;
2417
+ private router;
2418
+ private environmentInjector;
2419
+ private inputBinder;
2420
+ private activated;
2421
+ private _activatedRoute;
2422
+ private detachedLoaderFactory;
2423
+ private outlet;
2424
+ private name;
2425
+ private isEmptyOutlet;
2426
+ private viewUtil;
2427
+ private frame;
2428
+ private postNavFunction;
2429
+ attachEvents: EventEmitter<unknown>;
2430
+ detachEvents: EventEmitter<unknown>;
2431
+ activateEvents: EventEmitter<any>;
2432
+ deactivateEvents: EventEmitter<any>;
2433
+ get isActivated(): boolean;
2434
+ get activatedComponentRef(): ComponentRef<any> | null;
2435
+ get component(): unknown;
2436
+ get activatedRoute(): ActivatedRoute;
2437
+ get activatedRouteData(): Data;
2438
+ constructor();
2439
+ setActionBarVisibility(actionBarVisibility: string): void;
2440
+ ngOnDestroy(): void;
2441
+ deactivate(): void;
2442
+ /**
2443
+ * Called when the `RouteReuseStrategy` instructs to detach the subtree
2444
+ */
2445
+ detach(): ComponentRef<any>;
2446
+ /**
2447
+ * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
2448
+ */
2449
+ attach(ref: ComponentRef<any>, activatedRoute: ActivatedRoute): void;
2450
+ private isFinalPageRouterOutlet;
2451
+ /**
2452
+ * Called by the Router to instantiate a new component during the commit phase of a navigation.
2453
+ * This method in turn is responsible for calling the `routerOnActivate` hook of its child.
2454
+ */
2455
+ activateWith(activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver | EnvironmentInjector | null): void;
2456
+ private activateOnGoForward;
2457
+ private loadComponentInPage;
2458
+ private markActivatedRoute;
2459
+ private getComponentType;
2460
+ private getOutlet;
2461
+ static ɵfac: i0.ɵɵFactoryDeclaration<PageRouterOutlet, never>;
2462
+ static ɵdir: i0.ɵɵDirectiveDeclaration<PageRouterOutlet, "page-router-outlet", never, {}, { "activateEvents": "activate"; "deactivateEvents": "deactivate"; }, never, never, true, never>;
2463
+ }
2464
+
2465
+ interface ComponentInputBindingOptions {
2466
+ queryParams?: boolean;
2467
+ unmatchedInputBehavior?: 'alwaysUndefined' | 'undefinedIfStale';
2416
2468
  }
2417
2469
 
2418
- type QueryParamsHandling = 'merge' | 'preserve' | '';
2419
2470
  /**
2420
2471
  * The nsRouterLink directive lets you link to specific parts of your app.
2421
2472
  *
2422
2473
  * Consider the following route configuration:
2423
2474
  * ```
2424
- * [{ path: "/user", component: UserCmp }]
2475
+ * [{ path: 'user/:name', component: UserCmp }]
2425
2476
  * ```
2426
2477
  *
2427
2478
  * When linking to this `User` route, you can write:
2428
2479
  *
2429
2480
  * ```
2430
- * <a [nsRouterLink]="["/user"]">link to user component</a>
2481
+ * <Label [nsRouterLink]="['/user/bob']" text="link to user component"></Label>
2431
2482
  * ```
2432
2483
  *
2433
- * NSRouterLink expects the value to be an array of path segments, followed by the params
2434
- * for that level of routing. For instance `["/team", {teamId: 1}, "user", {userId: 2}]`
2435
- * means that we want to generate a link to `/team;teamId=1/user;userId=2`.
2484
+ * You can use dynamic values to generate the link.
2485
+ * For a dynamic link, pass an array of path segments,
2486
+ * followed by the params for each segment.
2487
+ * For example, `['/team', teamId, 'user', userName, {details: true}]`
2488
+ * generates a link to `/team/11/user/bob;details=true`.
2489
+ *
2490
+ * Multiple static segments can be merged into one term and combined with
2491
+ * dynamic segments. For example, `['/team/11/user', userName, {details: true}]`
2492
+ *
2493
+ * The input that you provide to the link is treated as a delta to the current
2494
+ * URL. For instance, suppose the current URL is `/user/(box//aux:team)`. The
2495
+ * link `<Label [nsRouterLink]="['/user/jim']">Jim</Label>` creates the URL
2496
+ * `/user/(jim//aux:team)`.
2497
+ * See {@link Router#createUrlTree} for more information.
2498
+ *
2499
+ * @usageNotes
2500
+ *
2501
+ * You can use absolute or relative paths in a link, set query parameters,
2502
+ * control how parameters are handled, and keep a history of navigation states.
2503
+ *
2504
+ * ### Relative link paths
2436
2505
  *
2437
2506
  * The first segment name can be prepended with `/`, `./`, or `../`.
2438
- * If the segment begins with `/`, the router will look up the route from the root of the app.
2439
- * If the segment begins with `./`, or doesn"t begin with a slash, the router will
2440
- * instead look in the current component"s children for the route.
2441
- * And if the segment begins with `../`, the router will go up one level.
2507
+ * * If the first segment begins with `/`, the router looks up the route from
2508
+ * the root of the app.
2509
+ * * If the first segment begins with `./`, or doesn't begin with a slash, the
2510
+ * router looks in the children of the current activated route.
2511
+ * * If the first segment begins with `../`, the router goes up one level in the
2512
+ * route tree.
2513
+ *
2514
+ * ### Setting and handling query params and fragments
2515
+ *
2516
+ * The following link adds a query parameter and a fragment to the generated URL:
2517
+ *
2518
+ * ```html
2519
+ * <Label [nsRouterLink]="['/user/bob']" [queryParams]="{debug: true}"
2520
+ * fragment="education" text="link to user component"></Label>
2521
+ * ```
2522
+ *
2523
+ * By default, the directive constructs the new URL using the given query
2524
+ * parameters. The example generates the link: `/user/bob?debug=true#education`.
2525
+ *
2526
+ * You can instruct the directive to handle query parameters differently
2527
+ * by specifying the `queryParamsHandling` option in the link.
2528
+ * Allowed values are:
2529
+ *
2530
+ * - `'merge'`: Merge the given `queryParams` into the current query params.
2531
+ * - `'preserve'`: Preserve the current query params.
2532
+ *
2533
+ * For example:
2534
+ *
2535
+ * ```html
2536
+ * <Label [nsRouterLink]="['/user/bob']" [queryParams]="{debug: true}"
2537
+ * queryParamsHandling="merge" text="link to user component"></Label>
2538
+ * ```
2539
+ *
2540
+ * `queryParams`, `fragment`, `queryParamsHandling`, `preserveFragment`, and
2541
+ * `relativeTo` cannot be used when the `nsRouterLink` input is a `UrlTree`.
2542
+ *
2543
+ * ### NativeScript-specific options
2544
+ *
2545
+ * NativeScript adds support for page transitions and history clearing:
2546
+ *
2547
+ * ```html
2548
+ * <Label [nsRouterLink]="['/user/bob']" [clearHistory]="true"
2549
+ * pageTransition="slide" [pageTransitionDuration]="200"
2550
+ * text="link to user component"></Label>
2551
+ * ```
2442
2552
  */
2443
- declare class NSRouterLink implements AfterViewInit {
2444
- private ngZone;
2445
- private router;
2446
- private navigator;
2447
- private route;
2448
- private el;
2449
- target: string;
2450
- queryParams: {
2553
+ declare class NSRouterLink implements OnChanges, OnDestroy {
2554
+ private readonly ngZone;
2555
+ private readonly router;
2556
+ private readonly navigator;
2557
+ private readonly route;
2558
+ private readonly el;
2559
+ /**
2560
+ * Passed to {@link Router#createUrlTree} as part of the
2561
+ * `UrlCreationOptions`.
2562
+ * @see {@link UrlCreationOptions#queryParams}
2563
+ * @see {@link Router#createUrlTree}
2564
+ */
2565
+ set queryParams(value: {
2451
2566
  [k: string]: any;
2452
- };
2453
- fragment: string;
2454
- queryParamsHandling: QueryParamsHandling;
2455
- preserveQueryParams: boolean;
2456
- preserveFragment: boolean;
2457
- skipLocationChange: boolean;
2458
- replaceUrl: boolean;
2567
+ } | null | undefined);
2568
+ get queryParams(): {
2569
+ [k: string]: any;
2570
+ } | null | undefined;
2571
+ private _queryParams;
2572
+ /**
2573
+ * Passed to {@link Router#createUrlTree} as part of the
2574
+ * `UrlCreationOptions`.
2575
+ * @see {@link UrlCreationOptions#fragment}
2576
+ * @see {@link Router#createUrlTree}
2577
+ */
2578
+ set fragment(value: string | undefined);
2579
+ get fragment(): string | undefined;
2580
+ private _fragment;
2581
+ /**
2582
+ * Passed to {@link Router#createUrlTree} as part of the
2583
+ * `UrlCreationOptions`.
2584
+ * @see {@link UrlCreationOptions#queryParamsHandling}
2585
+ * @see {@link Router#createUrlTree}
2586
+ */
2587
+ set queryParamsHandling(value: QueryParamsHandling | null | undefined);
2588
+ get queryParamsHandling(): QueryParamsHandling | null | undefined;
2589
+ private _queryParamsHandling;
2590
+ /**
2591
+ * Passed to {@link Router#navigateByUrl} as part of the
2592
+ * `NavigationBehaviorOptions`.
2593
+ * @see {@link NavigationBehaviorOptions#state}
2594
+ * @see {@link Router#navigateByUrl}
2595
+ */
2596
+ set state(value: {
2597
+ [k: string]: any;
2598
+ } | undefined);
2599
+ get state(): {
2600
+ [k: string]: any;
2601
+ } | undefined;
2602
+ private _state;
2603
+ /**
2604
+ * Passed to {@link Router#navigateByUrl} as part of the
2605
+ * `NavigationBehaviorOptions`.
2606
+ * @see {@link NavigationBehaviorOptions#info}
2607
+ * @see {@link Router#navigateByUrl}
2608
+ */
2609
+ set info(value: unknown);
2610
+ get info(): unknown;
2611
+ private _info;
2612
+ /**
2613
+ * Passed to {@link Router#createUrlTree} as part of the
2614
+ * `UrlCreationOptions`.
2615
+ * Specify a value here when you do not want to use the default value
2616
+ * for `nsRouterLink`, which is the current activated route.
2617
+ * Note that a value of `undefined` here will use the `nsRouterLink` default.
2618
+ * @see {@link UrlCreationOptions#relativeTo}
2619
+ * @see {@link Router#createUrlTree}
2620
+ */
2621
+ set relativeTo(value: ActivatedRoute | null | undefined);
2622
+ get relativeTo(): ActivatedRoute | null | undefined;
2623
+ private _relativeTo;
2624
+ /**
2625
+ * Passed to {@link Router#createUrlTree} as part of the
2626
+ * `UrlCreationOptions`.
2627
+ * @see {@link UrlCreationOptions#preserveFragment}
2628
+ * @see {@link Router#createUrlTree}
2629
+ */
2630
+ set preserveFragment(value: boolean);
2631
+ get preserveFragment(): boolean;
2632
+ private _preserveFragment;
2633
+ /**
2634
+ * Passed to {@link Router#navigateByUrl} as part of the
2635
+ * `NavigationBehaviorOptions`.
2636
+ * @see {@link NavigationBehaviorOptions#skipLocationChange}
2637
+ * @see {@link Router#navigateByUrl}
2638
+ */
2639
+ set skipLocationChange(value: boolean);
2640
+ get skipLocationChange(): boolean;
2641
+ private _skipLocationChange;
2642
+ /**
2643
+ * Passed to {@link Router#navigateByUrl} as part of the
2644
+ * `NavigationBehaviorOptions`.
2645
+ * @see {@link NavigationBehaviorOptions#replaceUrl}
2646
+ * @see {@link Router#navigateByUrl}
2647
+ */
2648
+ set replaceUrl(value: boolean);
2649
+ get replaceUrl(): boolean;
2650
+ private _replaceUrl;
2459
2651
  clearHistory: boolean;
2460
2652
  pageTransition: boolean | string | NavigationTransition;
2461
2653
  pageTransitionDuration: any;
2462
- private commands;
2463
- constructor(ngZone: NgZone, router: Router, navigator: RouterExtensions, route: ActivatedRoute, el: ElementRef);
2464
- ngAfterViewInit(): void;
2465
- set params(data: any[] | string);
2466
- onTap(): void;
2654
+ /** @internal */
2655
+ onChanges: Subject<NSRouterLink>;
2656
+ private routerLinkInput;
2657
+ private tapHandler;
2658
+ constructor();
2659
+ /**
2660
+ * Commands to pass to {@link Router#createUrlTree} or a `UrlTree`.
2661
+ * - **array**: commands to pass to {@link Router#createUrlTree}.
2662
+ * - **string**: shorthand for array of commands with just the string, i.e. `['/route']`
2663
+ * - **UrlTree**: a `UrlTree` for this link rather than creating one from
2664
+ * the commands and other inputs that correspond to properties of `UrlCreationOptions`.
2665
+ * - **null|undefined**: effectively disables the `nsRouterLink`
2666
+ * @see {@link Router#createUrlTree}
2667
+ */
2668
+ set nsRouterLink(commandsOrUrlTree: readonly any[] | string | UrlTree | null | undefined);
2669
+ ngOnChanges(_changes?: SimpleChanges): void;
2670
+ ngOnDestroy(): void;
2671
+ /** @internal */
2672
+ _urlTree: i0.Signal<UrlTree>;
2673
+ get urlTree(): UrlTree | null;
2674
+ private onTap;
2467
2675
  private getExtras;
2468
- get urlTree(): UrlTree;
2469
2676
  private convertClearHistory;
2470
2677
  private getTransition;
2471
2678
  static ɵfac: i0.ɵɵFactoryDeclaration<NSRouterLink, never>;
2472
- static ɵdir: i0.ɵɵDirectiveDeclaration<NSRouterLink, "[nsRouterLink]", never, { "target": { "alias": "target"; "required": false; }; "queryParams": { "alias": "queryParams"; "required": false; }; "fragment": { "alias": "fragment"; "required": false; }; "queryParamsHandling": { "alias": "queryParamsHandling"; "required": false; }; "preserveQueryParams": { "alias": "preserveQueryParams"; "required": false; }; "preserveFragment": { "alias": "preserveFragment"; "required": false; }; "skipLocationChange": { "alias": "skipLocationChange"; "required": false; }; "replaceUrl": { "alias": "replaceUrl"; "required": false; }; "clearHistory": { "alias": "clearHistory"; "required": false; }; "pageTransition": { "alias": "pageTransition"; "required": false; }; "pageTransitionDuration": { "alias": "pageTransitionDuration"; "required": false; }; "params": { "alias": "nsRouterLink"; "required": false; }; }, {}, never, never, true, never>;
2679
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NSRouterLink, "[nsRouterLink]", never, { "queryParams": { "alias": "queryParams"; "required": false; }; "fragment": { "alias": "fragment"; "required": false; }; "queryParamsHandling": { "alias": "queryParamsHandling"; "required": false; }; "state": { "alias": "state"; "required": false; }; "info": { "alias": "info"; "required": false; }; "relativeTo": { "alias": "relativeTo"; "required": false; }; "preserveFragment": { "alias": "preserveFragment"; "required": false; }; "skipLocationChange": { "alias": "skipLocationChange"; "required": false; }; "replaceUrl": { "alias": "replaceUrl"; "required": false; }; "clearHistory": { "alias": "clearHistory"; "required": false; }; "pageTransition": { "alias": "pageTransition"; "required": false; }; "pageTransitionDuration": { "alias": "pageTransitionDuration"; "required": false; }; "nsRouterLink": { "alias": "nsRouterLink"; "required": false; }; }, {}, never, never, true, never>;
2680
+ static ngAcceptInputType_preserveFragment: unknown;
2681
+ static ngAcceptInputType_skipLocationChange: unknown;
2682
+ static ngAcceptInputType_replaceUrl: unknown;
2473
2683
  }
2474
2684
 
2475
2685
  /**
2476
- * The NSRouterLinkActive directive lets you add a CSS class to an element when the link"s route
2686
+ * The NSRouterLinkActive directive lets you add a CSS class to an element when the link's route
2477
2687
  * becomes active.
2478
2688
  *
2479
2689
  * Consider the following example:
2480
2690
  *
2481
2691
  * ```
2482
- * <a [nsRouterLink]="/user/bob" [nsRouterLinkActive]="active-link">Bob</a>
2692
+ * <Label [nsRouterLink]="/user/bob" [nsRouterLinkActive]="'active-link'" text="Bob"></Label>
2483
2693
  * ```
2484
2694
  *
2485
2695
  * When the url is either "/user" or "/user/bob", the active-link class will
@@ -2488,114 +2698,107 @@ declare class NSRouterLink implements AfterViewInit {
2488
2698
  * You can set more than one class, as follows:
2489
2699
  *
2490
2700
  * ```
2491
- * <a [nsRouterLink]="/user/bob" [nsRouterLinkActive]="class1 class2">Bob</a>
2492
- * <a [nsRouterLink]="/user/bob" [nsRouterLinkActive]="["class1", "class2"]">Bob</a>
2701
+ * <Label [nsRouterLink]="/user/bob" [nsRouterLinkActive]="'class1 class2'" text="Bob"></Label>
2702
+ * <Label [nsRouterLink]="/user/bob" [nsRouterLinkActive]="['class1', 'class2']" text="Bob"></Label>
2493
2703
  * ```
2494
2704
  *
2495
2705
  * You can configure NSRouterLinkActive by passing `exact: true`. This will add the
2496
2706
  * classes only when the url matches the link exactly.
2497
2707
  *
2498
2708
  * ```
2499
- * <a [nsRouterLink]="/user/bob" [nsRouterLinkActive]="active-link"
2500
- * [nsRouterLinkActiveOptions]="{exact: true}">Bob</a>
2709
+ * <Label [nsRouterLink]="/user/bob" [nsRouterLinkActive]="'active-link'"
2710
+ * [nsRouterLinkActiveOptions]="{exact: true}" text="Bob"></Label>
2501
2711
  * ```
2502
2712
  *
2503
- * Finally, you can apply the NSRouterLinkActive directive to an ancestor of a RouterLink.
2713
+ * To directly check the `isActive` status of the link, assign the `NSRouterLinkActive`
2714
+ * instance to a template variable.
2715
+ * For example, the following checks the status without assigning any CSS classes:
2504
2716
  *
2505
2717
  * ```
2506
- * <div [nsRouterLinkActive]="active-link" [nsRouterLinkActiveOptions]="{exact: true}">
2507
- * <a [nsRouterLink]="/user/jim">Jim</a>
2508
- * <a [nsRouterLink]="/user/bob">Bob</a>
2509
- * </div>
2718
+ * <Label [nsRouterLink]="/user/bob" nsRouterLinkActive #rla="routerLinkActive"
2719
+ * [text]="'Bob ' + (rla.isActive ? '(already open)' : '')"></Label>
2510
2720
  * ```
2511
2721
  *
2512
- * This will set the active-link class on the div tag if the url is either "/user/jim" or
2722
+ * You can apply the NSRouterLinkActive directive to an ancestor of a RouterLink.
2723
+ *
2724
+ * ```
2725
+ * <StackLayout [nsRouterLinkActive]="'active-link'" [nsRouterLinkActiveOptions]="{exact: true}">
2726
+ * <Label [nsRouterLink]="/user/jim" text="Jim"></Label>
2727
+ * <Label [nsRouterLink]="/user/bob" text="Bob"></Label>
2728
+ * </StackLayout>
2729
+ * ```
2730
+ *
2731
+ * This will set the active-link class on the StackLayout if the url is either "/user/jim" or
2513
2732
  * "/user/bob".
2514
2733
  *
2515
- * @stable
2734
+ * The `NSRouterLinkActive` directive can also be used to set the aria-current attribute
2735
+ * to provide an alternative distinction for active elements to visually impaired users.
2736
+ *
2737
+ * For example, the following code adds the 'active' class to the Home Page link when it is
2738
+ * indeed active and in such case also sets its aria-current attribute to 'page':
2739
+ *
2740
+ * ```
2741
+ * <Label nsRouterLink="/" [nsRouterLinkActive]="'active'" ariaCurrentWhenActive="page" text="Home Page"></Label>
2742
+ * ```
2516
2743
  */
2517
2744
  declare class NSRouterLinkActive implements OnChanges, OnDestroy, AfterContentInit {
2518
- private router;
2519
- private element;
2520
- private renderer;
2521
2745
  links: QueryList<NSRouterLink>;
2522
2746
  private classes;
2523
- private subscription;
2524
- private active;
2747
+ private routerEventsSubscription;
2748
+ private linkInputChangesSubscription?;
2749
+ private _isActive;
2750
+ get isActive(): boolean;
2751
+ /**
2752
+ * Options to configure how to determine if the router link is active.
2753
+ *
2754
+ * These options are passed to the `isActive()` function.
2755
+ *
2756
+ * @see {@link isActive}
2757
+ */
2525
2758
  nsRouterLinkActiveOptions: {
2526
2759
  exact: boolean;
2527
- };
2528
- constructor(router: Router, element: ElementRef, renderer: Renderer2);
2529
- get isActive(): boolean;
2760
+ } | Partial<IsActiveMatchOptions>;
2761
+ /**
2762
+ * Aria-current attribute to apply when the router link is active.
2763
+ *
2764
+ * Possible values: `'page'` | `'step'` | `'location'` | `'date'` | `'time'` | `true` | `false`.
2765
+ *
2766
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current}
2767
+ */
2768
+ ariaCurrentWhenActive?: 'page' | 'step' | 'location' | 'date' | 'time' | true | false;
2769
+ /**
2770
+ *
2771
+ * You can use the output `isActiveChange` to get notified each time the link becomes
2772
+ * active or inactive.
2773
+ *
2774
+ * Emits:
2775
+ * true -> Route is active
2776
+ * false -> Route is inactive
2777
+ *
2778
+ * ```html
2779
+ * <Label
2780
+ * [nsRouterLink]="/user/bob"
2781
+ * [nsRouterLinkActive]="'active-link'"
2782
+ * (isActiveChange)="this.onRouterLinkActive($event)" text="Bob"></Label>
2783
+ * ```
2784
+ */
2785
+ readonly isActiveChange: EventEmitter<boolean>;
2786
+ private readonly link;
2787
+ private readonly router;
2788
+ private readonly element;
2789
+ private readonly renderer;
2790
+ private readonly cdr;
2791
+ constructor();
2530
2792
  ngAfterContentInit(): void;
2793
+ private subscribeToEachLinkOnChanges;
2531
2794
  set nsRouterLinkActive(data: string[] | string);
2532
- ngOnChanges(): void;
2795
+ ngOnChanges(_changes: SimpleChanges): void;
2533
2796
  ngOnDestroy(): void;
2534
2797
  private update;
2535
- private reduceList;
2536
2798
  private isLinkActive;
2537
2799
  private hasActiveLinks;
2538
2800
  static ɵfac: i0.ɵɵFactoryDeclaration<NSRouterLinkActive, never>;
2539
- static ɵdir: i0.ɵɵDirectiveDeclaration<NSRouterLinkActive, "[nsRouterLinkActive]", ["routerLinkActive"], { "nsRouterLinkActiveOptions": { "alias": "nsRouterLinkActiveOptions"; "required": false; }; "nsRouterLinkActive": { "alias": "nsRouterLinkActive"; "required": false; }; }, {}, ["links"], never, true, never>;
2540
- }
2541
-
2542
- declare class PageRoute {
2543
- activatedRoute: BehaviorSubject<ActivatedRoute>;
2544
- constructor(startRoute: ActivatedRoute);
2545
- }
2546
- declare class PageRouterOutlet implements OnDestroy, RouterOutletContract {
2547
- private parentContexts;
2548
- private location;
2549
- private locationStrategy;
2550
- private resolver;
2551
- private changeDetector;
2552
- private pageFactory;
2553
- private routeReuseStrategy;
2554
- private ngZone;
2555
- private router;
2556
- private environmentInjector;
2557
- private activated;
2558
- private _activatedRoute;
2559
- private detachedLoaderFactory;
2560
- private outlet;
2561
- private name;
2562
- private isEmptyOutlet;
2563
- private viewUtil;
2564
- private frame;
2565
- private postNavFunction;
2566
- attachEvents: EventEmitter<unknown>;
2567
- detachEvents: EventEmitter<unknown>;
2568
- activateEvents: EventEmitter<any>;
2569
- deactivateEvents: EventEmitter<any>;
2570
- get isActivated(): boolean;
2571
- get component(): unknown;
2572
- get activatedRoute(): ActivatedRoute;
2573
- get activatedRouteData(): Data;
2574
- constructor();
2575
- setActionBarVisibility(actionBarVisibility: string): void;
2576
- ngOnDestroy(): void;
2577
- deactivate(): void;
2578
- /**
2579
- * Called when the `RouteReuseStrategy` instructs to detach the subtree
2580
- */
2581
- detach(): ComponentRef<any>;
2582
- /**
2583
- * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
2584
- */
2585
- attach(ref: ComponentRef<any>, activatedRoute: ActivatedRoute): void;
2586
- private isFinalPageRouterOutlet;
2587
- /**
2588
- * Called by the Router to instantiate a new component during the commit phase of a navigation.
2589
- * This method in turn is responsible for calling the `routerOnActivate` hook of its child.
2590
- */
2591
- activateWith(activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver | EnvironmentInjector | null): void;
2592
- private activateOnGoForward;
2593
- private loadComponentInPage;
2594
- private markActivatedRoute;
2595
- private getComponentType;
2596
- private getOutlet;
2597
- static ɵfac: i0.ɵɵFactoryDeclaration<PageRouterOutlet, never>;
2598
- static ɵdir: i0.ɵɵDirectiveDeclaration<PageRouterOutlet, "page-router-outlet", never, {}, { "activateEvents": "activate"; "deactivateEvents": "deactivate"; }, never, never, true, never>;
2801
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NSRouterLinkActive, "[nsRouterLinkActive]", ["routerLinkActive"], { "nsRouterLinkActiveOptions": { "alias": "nsRouterLinkActiveOptions"; "required": false; }; "ariaCurrentWhenActive": { "alias": "ariaCurrentWhenActive"; "required": false; }; "nsRouterLinkActive": { "alias": "nsRouterLinkActive"; "required": false; }; }, { "isActiveChange": "isActiveChange"; }, ["links"], never, true, never>;
2599
2802
  }
2600
2803
 
2601
2804
  declare class NSEmptyOutletComponent {
@@ -2606,6 +2809,32 @@ declare class NSEmptyOutletComponent {
2606
2809
  static ɵcmp: i0.ɵɵComponentDeclaration<NSEmptyOutletComponent, "ns-empty-outlet", never, {}, {}, never, never, true, never>;
2607
2810
  }
2608
2811
 
2812
+ type ExtendedNavigationExtras = NavigationExtras & NavigationOptions;
2813
+ type ExtendedNavigationBehaviorOptions = NavigationBehaviorOptions & NavigationOptions;
2814
+ interface BackNavigationOptions {
2815
+ outlets?: Array<string>;
2816
+ relativeTo?: ActivatedRoute | null;
2817
+ }
2818
+ declare class RouterExtensions {
2819
+ router: Router;
2820
+ locationStrategy: NSLocationStrategy;
2821
+ frameService: FrameService;
2822
+ constructor(router: Router, locationStrategy: NSLocationStrategy, frameService: FrameService);
2823
+ navigate(commands: any[], extras?: ExtendedNavigationExtras): Promise<boolean>;
2824
+ navigateByUrl(url: string | UrlTree, options?: ExtendedNavigationBehaviorOptions): Promise<boolean>;
2825
+ back(backNavigationOptions?: BackNavigationOptions): void;
2826
+ canGoBack(backNavigationOptions?: BackNavigationOptions): boolean;
2827
+ backToPreviousPage(): void;
2828
+ canGoBackToPreviousPage(): boolean;
2829
+ private backOutlets;
2830
+ private findOutletsToBack;
2831
+ private findOutletsRecursive;
2832
+ private findOutletByRoute;
2833
+ static ɵfac: i0.ɵɵFactoryDeclaration<RouterExtensions, never>;
2834
+ static ɵprov: i0.ɵɵInjectableDeclaration<RouterExtensions>;
2835
+ }
2836
+
2837
+ declare function provideComponentInputBinding(options?: ComponentInputBindingOptions): Provider[];
2609
2838
  declare function provideLocationStrategy(locationStrategy: NSLocationStrategy, frameService: FrameService, startPath: string): NSLocationStrategy;
2610
2839
  declare class NativeScriptRouterModule {
2611
2840
  static forRoot(routes: Routes, config?: ExtraOptions): ModuleWithProviders<NativeScriptRouterModule>;
@@ -2830,5 +3059,5 @@ declare class NativeScriptNgZone implements NgZone {
2830
3059
  }
2831
3060
  declare function provideNativeScriptNgZone(options?: NgZoneOptions): i0.StaticProvider[];
2832
3061
 
2833
- export { APP_ROOT_VIEW, ActionBarComponent, ActionBarScope, ActionItemDirective, AndroidFilterComponent, AppHostAsyncView, AppHostView, AppleFilterComponent, BasePortalOutlet, BaseValueAccessor, COMMON_PROVIDERS, CdkPortal, CdkPortalOutlet, CheckedValueAccessor, CommentNode, ComponentPortal, DEVICE, DISABLE_ROOT_VIEW_HANDLING, DateValueAccessor, DetachedLoader, DomPortal, ENABLE_REUSABE_VIEWS, EmulatedRenderer, FrameDirective, FramePageComponent, FramePageModule, FrameService, HmrCacheService, HmrCacheStore, IOSFilterComponent, InjectableAnimationEngine, InvisibleNode, ItemContext, ListViewComponent, ModalDialogParams, ModalDialogService, NAMESPACE_FILTERS, NATIVESCRIPT_MODULE_PROVIDERS, NATIVESCRIPT_MODULE_STATIC_PROVIDERS, NATIVESCRIPT_ROOT_MODULE_ID, NATIVE_DIALOG_DATA, NATIVE_DIALOG_DEFAULT_OPTIONS, NSEmptyOutletComponent, NSFileSystem, NSLocationStrategy, NSRouteReuseStrategy, NSRouterLink, NSRouterLinkActive, NativeDialog, NativeDialogCloseDirective, NativeDialogConfig, NativeDialogModule, NativeDialogRef, NativeDialog as NativeDialogService, NativeDialogState, NativeModalRef, NativeScriptAnimationDriver, NativeScriptAnimationPlayer, NativeScriptAnimationsModule, NativeScriptCommonModule, NativeScriptDocument, NativeScriptDomPortalOutlet, NativeScriptFormsModule, NativeScriptHttpClientModule, NativeScriptLoadingService, NativeScriptModule, NativeScriptNgSafeEvent, NativeScriptNgZone, NativeScriptRendererFactory, NativeScriptRendererHelperService, NativeScriptRouterModule, NativeScriptSanitizer, NativescriptXhrFactory, NavigationButtonDirective, NgViewRef, NsHttpBackEnd, NsTemplatedItem, NumberValueAccessor, Outlet, PAGE_FACTORY, PREVENT_CHANGE_EVENTS_DURING_CD, PREVENT_SPECIFIC_EVENTS_DURING_CD, PageDirective, PageRoute, PageRouterOutlet, PageService, PlatformNamespaceFilter, Portal, PortalModule, RootCompositeModule, RootViewProxy, RouterExtensions, START_PATH, SelectedIndexValueAccessor, TEMPLATED_ITEMS_COMPONENT, TabViewDirective, TabViewItemDirective, TemplateKeyDirective, TemplatePortal, TextNode, TextValueAccessor, TimeValueAccessor, VisionOSFilterComponent, bootstrapApplication, configureHmrCache, createDefaultHmrCacheStore, createKeyframeAnimation, customFrameComponentFactory, customFrameDirectiveFactory, customPageFactory, customPageFactoryFromFrame, dashCaseToCamelCase, defaultNavOptions, defaultPageFactory, defaultPageFactoryProvider, detachViewFromParent, disableRootViewHanding, errorHandler, extractSingleViewRecursive, frameMeta, generateDetachedLoader, generateFallbackRootView, generateNativeScriptView, generateRandomId, generateRootLayoutAndProxy, getAngularHmrRestoringRoute, getFirstNativeLikeView, getHmrCacheStore, getItemViewRoot, getSingleViewRecursive, getViewClass, getViewMeta, instantiateDefaultStyleNormalizer, instantiateSupportedAnimationDriver, isAngularHmrRestoringRoute, isBlank, isContentView, isDetachedElement, isInvisibleNode, isJsObject, isKnownView, isLayout, isListLikeIterable, isPresent, isView, onAfterLivesync, onBeforeLivesync, once, platformNativeScript, platformNativeScriptDynamic, postAngularBootstrap$, preAngularDisposal$, provideLocationStrategy, provideNativeScriptHttpClient, provideNativeScriptNgZone, provideNativeScriptRouter, registerElement, registerNativeScriptViewComponents, rootRoute, runNativeScriptAngularApp, throwIfAlreadyLoaded, throwNoPortalAttachedError, throwNullPortalError, throwNullPortalOutletError, throwPortalAlreadyAttachedError, throwPortalOutletAlreadyDisposedError, throwUnknownPortalTypeError, COMPONENT_VARIABLE as ɵCOMPONENT_VARIABLE, CONTENT_ATTR as ɵCONTENT_ATTR, HOST_ATTR as ɵHOST_ATTR, NativeScriptDebug as ɵNativeScriptAngularDebug, viewUtil_d as ɵViewUtil, actionBarMeta as ɵactionBarMeta, elementMap as ɵelementMap, isActionItem as ɵisActionItem, isNavigationButton as ɵisNavigationButton };
2834
- export type { AppLaunchView, AppOptions, AppRunOptions, ApplicationConfig, BaseShowModalOptions, CdkPortalOutletAttachedRef, ComponentType, HmrCacheScope, HmrCacheStoreOptions, HmrOptions, Keyframe, LocationState, ModalDialogOptions, NamespaceFilter, NativeShowModalOptions, NavigationOptions, NgModuleEvent, NgModuleReason, NgView, NgViewTemplate, PageFactory, PageFactoryOptions, PortalOutlet, RootLocator, SelectableView, SetupItemViewArgs, ShowDialogOptions, TabViewItemDef, TemplatedItemsHost, TextView, ViewClass, ViewClassMeta, ViewExtensions, ViewResolver };
3062
+ export { APP_ROOT_VIEW, ActionBarComponent, ActionBarScope, ActionItemDirective, AndroidFilterComponent, AppHostAsyncView, AppHostView, AppleFilterComponent, BasePortalOutlet, BaseValueAccessor, COMMON_PROVIDERS, CdkPortal, CdkPortalOutlet, CheckedValueAccessor, CommentNode, ComponentPortal, DEVICE, DISABLE_ROOT_VIEW_HANDLING, DateValueAccessor, DetachedLoader, DomPortal, ENABLE_REUSABE_VIEWS, EmulatedRenderer, FrameDirective, FramePageComponent, FramePageModule, FrameService, HmrCacheService, HmrCacheStore, IOSFilterComponent, InjectableAnimationEngine, InvisibleNode, ItemContext, ListViewComponent, ModalDialogParams, ModalDialogService, NAMESPACE_FILTERS, NATIVESCRIPT_MODULE_PROVIDERS, NATIVESCRIPT_MODULE_STATIC_PROVIDERS, NATIVESCRIPT_ROOT_MODULE_ID, NATIVE_DIALOG_DATA, NATIVE_DIALOG_DEFAULT_OPTIONS, NSEmptyOutletComponent, NSFileSystem, NSLocationStrategy, NSRouteReuseStrategy, NSRouterLink, NSRouterLinkActive, NativeDialog, NativeDialogCloseDirective, NativeDialogConfig, NativeDialogModule, NativeDialogRef, NativeDialog as NativeDialogService, NativeDialogState, NativeModalRef, NativeScriptAnimationDriver, NativeScriptAnimationPlayer, NativeScriptAnimationsModule, NativeScriptCommonModule, NativeScriptDocument, NativeScriptDomPortalOutlet, NativeScriptFormsModule, NativeScriptHttpClientModule, NativeScriptLoadingService, NativeScriptModule, NativeScriptNgSafeEvent, NativeScriptNgZone, NativeScriptRendererFactory, NativeScriptRendererHelperService, NativeScriptRouterModule, NativeScriptSanitizer, NativescriptXhrFactory, NavigationButtonDirective, NgViewRef, NsHttpBackEnd, NsTemplatedItem, NumberValueAccessor, Outlet, PAGE_FACTORY, PREVENT_CHANGE_EVENTS_DURING_CD, PREVENT_SPECIFIC_EVENTS_DURING_CD, PageDirective, PageRoute, PageRouterOutlet, PageService, PlatformNamespaceFilter, Portal, PortalModule, RootCompositeModule, RootViewProxy, RouterExtensions, START_PATH, SelectedIndexValueAccessor, TEMPLATED_ITEMS_COMPONENT, TabViewDirective, TabViewItemDirective, TemplateKeyDirective, TemplatePortal, TextNode, TextValueAccessor, TimeValueAccessor, VisionOSFilterComponent, bootstrapApplication, configureHmrCache, createApplication, createDefaultHmrCacheStore, createKeyframeAnimation, customFrameComponentFactory, customFrameDirectiveFactory, customPageFactory, customPageFactoryFromFrame, dashCaseToCamelCase, defaultNavOptions, defaultPageFactory, defaultPageFactoryProvider, detachViewFromParent, disableRootViewHanding, errorHandler, extractSingleViewRecursive, frameMeta, generateDetachedLoader, generateFallbackRootView, generateNativeScriptView, generateRandomId, generateRootLayoutAndProxy, getAngularHmrRestoringRoute, getFirstNativeLikeView, getHmrCacheStore, getItemViewRoot, getSingleViewRecursive, getViewClass, getViewMeta, instantiateDefaultStyleNormalizer, instantiateSupportedAnimationDriver, isAngularHmrRestoringRoute, isBlank, isContentView, isDetachedElement, isInvisibleNode, isJsObject, isKnownView, isLayout, isListLikeIterable, isPresent, isView, onAfterLivesync, onBeforeLivesync, once, platformNativeScript, platformNativeScriptDynamic, postAngularBootstrap$, preAngularDisposal$, provideComponentInputBinding, provideLocationStrategy, provideNativeScriptHttpClient, provideNativeScriptNgZone, provideNativeScriptRouter, registerElement, registerNativeScriptViewComponents, rootRoute, runNativeScriptAngularApp, throwIfAlreadyLoaded, throwNoPortalAttachedError, throwNullPortalError, throwNullPortalOutletError, throwPortalAlreadyAttachedError, throwPortalOutletAlreadyDisposedError, throwUnknownPortalTypeError, COMPONENT_VARIABLE as ɵCOMPONENT_VARIABLE, CONTENT_ATTR as ɵCONTENT_ATTR, HOST_ATTR as ɵHOST_ATTR, NativeScriptDebug as ɵNativeScriptAngularDebug, viewUtil_d as ɵViewUtil, actionBarMeta as ɵactionBarMeta, elementMap as ɵelementMap, isActionItem as ɵisActionItem, isNavigationButton as ɵisNavigationButton };
3063
+ export type { AppLaunchView, AppOptions, AppRunOptions, ApplicationConfig, BaseShowModalOptions, BootstrapContext, CdkPortalOutletAttachedRef, ComponentInputBindingOptions, ComponentType, HmrCacheScope, HmrCacheStoreOptions, HmrOptions, Keyframe, LocationState, ModalDialogOptions, NamespaceFilter, NativeShowModalOptions, NavigationOptions, NgModuleEvent, NgModuleReason, NgView, NgViewTemplate, PageFactory, PageFactoryOptions, PortalOutlet, RootLocator, SelectableView, SetupItemViewArgs, ShowDialogOptions, TabViewItemDef, TemplatedItemsHost, TextView, ViewClass, ViewClassMeta, ViewExtensions, ViewResolver };