@nstudio/nativescript-compiler-angular 9.2.0-alpha.10 → 9.2.0-alpha.11
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.
- package/dist/angular-libraries.js +225 -12
- package/dist/angular.js +1453 -202
- package/dist/component-bases.js +144 -37
- package/dist/entry.js +32 -2
- package/dist/index.js +93 -25
- package/dist/kotlin.js +9 -7
- package/dist/modules.js +100 -20
- package/dist/refusals.js +0 -1
- package/dist/semantics.js +16 -4
- package/dist/swift.js +9 -9
- package/kit-android/fromcore/AngularAPI.kt +3 -1
- package/kit-android/fromcore/AngularRouter.kt +105 -2
- package/kit-android/main/AngularCore.kt +121 -8
- package/kit-android/main/AngularRx.kt +4 -0
- package/kit-apple/AngularAPI.swift +6 -2
- package/kit-apple/AngularCore.swift +119 -5
- package/kit-apple/AngularRouter.swift +105 -0
- package/kit-apple/AngularRx.swift +4 -0
- package/kit-apple/kit-index.json +103 -5
- package/package.json +2 -2
- package/runtime/angular-cdk.ts +673 -0
- package/runtime/angular-rx.ts +38 -2
package/dist/modules.js
CHANGED
|
@@ -7,6 +7,8 @@ import { RUNTIME } from "./package.js";
|
|
|
7
7
|
const RX_FILE = join(RUNTIME, 'angular-rx.ts');
|
|
8
8
|
/** @angular/forms, ported: compiled as a package's source is, its classes' type parameters erased. */
|
|
9
9
|
const FORMS_FILE = join(RUNTIME, 'angular-forms.ts');
|
|
10
|
+
/** @angular/cdk, ported: compiled as a package's source is, providing native-safe CDK services and directives. */
|
|
11
|
+
const CDK_FILE = join(RUNTIME, 'angular-cdk.ts');
|
|
10
12
|
const SHIMS = {
|
|
11
13
|
/** The kit's Angular API: its Rx, router, HTTP and DI types, which the Angular shims and the runtime ports build on. */
|
|
12
14
|
'@angular#kit': `
|
|
@@ -237,7 +239,7 @@ const SHIMS = {
|
|
|
237
239
|
export declare class KitNativeDialogRef { static readonly current: KitNativeDialogRef; readonly data: any; close(result?: any): void; afterClosed(): RxObservable<any> }
|
|
238
240
|
export declare class KitNativeDialogService { static readonly shared: KitNativeDialogService; open(component: any, config?: any): KitNativeDialogRef }
|
|
239
241
|
/** A component's own injector, from its @Component providers: classes, and { provide, useClass | useValue | useFactory | useExisting }. */
|
|
240
|
-
export declare class NodeInjector { static enter(providers: any[]): NodeInjector; leave(): void }
|
|
242
|
+
export declare class NodeInjector { static enter(providers: any[]): NodeInjector; provideSelf(instance: any): void; leave(): void }
|
|
241
243
|
/** A template's \`@let\`, read once on each check of its view; \`of\` only types a template method's parameter. */
|
|
242
244
|
export declare class LetSlot<T> { static of<T>(value: T): LetSlot<T>; readonly value: T }
|
|
243
245
|
/** A pure Angular pipe at one binding site: \`transform\` runs when an argument is no longer \`Object.is\` the last one. */
|
|
@@ -261,7 +263,8 @@ const SHIMS = {
|
|
|
261
263
|
}
|
|
262
264
|
export declare function isPlatformBrowser(platformId: Object): boolean;
|
|
263
265
|
export declare function isPlatformServer(platformId: Object): boolean;
|
|
264
|
-
export declare const DOCUMENT: import('@angular/core').InjectionToken<any>;
|
|
266
|
+
export declare const DOCUMENT: import('@angular/core').InjectionToken<typeof globalThis extends { document: infer D } ? D : any>;
|
|
267
|
+
export declare const IMAGE_CONFIG: import('@angular/core').InjectionToken<any>;
|
|
265
268
|
export declare const CommonModule: any;
|
|
266
269
|
export declare const NgIf: any;
|
|
267
270
|
export declare const NgFor: any;
|
|
@@ -272,6 +275,7 @@ const SHIMS = {
|
|
|
272
275
|
export declare const NgSwitchCase: any;
|
|
273
276
|
export declare const NgSwitchDefault: any;
|
|
274
277
|
export declare const NgTemplateOutlet: any;
|
|
278
|
+
export declare const NgComponentOutlet: any;
|
|
275
279
|
export declare const AsyncPipe: any;
|
|
276
280
|
export declare const DatePipe: any;
|
|
277
281
|
export declare const DecimalPipe: any;
|
|
@@ -336,6 +340,7 @@ const SHIMS = {
|
|
|
336
340
|
}
|
|
337
341
|
`,
|
|
338
342
|
'@angular/core': `
|
|
343
|
+
import type { Subject } from 'rxjs';
|
|
339
344
|
import { TeardownHandle } from '@angular#kit';
|
|
340
345
|
export type ValueEqualityFn<T> = (a: T, b: T) => boolean;
|
|
341
346
|
export interface CreateComputedOptions<T> { equal?: ValueEqualityFn<T> }
|
|
@@ -344,6 +349,7 @@ const SHIMS = {
|
|
|
344
349
|
export interface Signal<T> { (): T }
|
|
345
350
|
/** \`$assign\`: a decorated input the component writes itself (\`this.x = v\`), until its parent's binding changes. */
|
|
346
351
|
export interface InputSignal<T> { (): T; $assign(value: T): void }
|
|
352
|
+
export interface InputSignalWithTransform<T, TransformT> extends InputSignal<T> {}
|
|
347
353
|
export interface ModelSignal<T> extends WritableSignal<T> { $assign(value: T): void; subscribe(fn: (value: T) => void): TeardownHandle }
|
|
348
354
|
export interface OutputEmitterRef<T> { emit(value: T): void; subscribe(fn: (value: T) => void): TeardownHandle }
|
|
349
355
|
export interface OutputRef<T> { subscribe(fn: (value: T) => void): TeardownHandle }
|
|
@@ -355,22 +361,63 @@ const SHIMS = {
|
|
|
355
361
|
export declare function isDevMode(): boolean;
|
|
356
362
|
export declare function enableProdMode(): void;
|
|
357
363
|
export type Provider = any;
|
|
364
|
+
export type StaticProvider = any;
|
|
365
|
+
export type ExistingProvider = { provide: any; useExisting: any; multi?: boolean };
|
|
366
|
+
export type ValueProvider = { provide: any; useValue: any; multi?: boolean };
|
|
367
|
+
export type ClassProvider = { provide: any; useClass: any; multi?: boolean };
|
|
368
|
+
export type FactoryProvider = { provide: any; useFactory: (...args: any[]) => any; deps?: any[]; multi?: boolean };
|
|
369
|
+
export type InjectOptions = { optional?: boolean; skipSelf?: boolean; self?: boolean; host?: boolean };
|
|
358
370
|
export type EnvironmentProviders = any;
|
|
359
371
|
export type ModuleWithProviders<T = any> = any;
|
|
360
|
-
export
|
|
372
|
+
export interface Type<T = any> extends Function { new (...args: any[]): T }
|
|
361
373
|
export declare function makeEnvironmentProviders(providers: any[]): EnvironmentProviders;
|
|
362
374
|
export declare function provideEnvironmentInitializer(fn: () => void): EnvironmentProviders;
|
|
363
375
|
export declare function provideAppInitializer(fn: () => any): EnvironmentProviders;
|
|
364
376
|
export declare function importProvidersFrom(...modules: any[]): EnvironmentProviders;
|
|
365
377
|
export declare class ErrorHandler { handleError(error: any): void }
|
|
366
|
-
export declare function input<T>(value:
|
|
367
|
-
export declare function input<T>():
|
|
368
|
-
export declare
|
|
378
|
+
export declare function input<T, TransformT = T>(value: undefined, options?: { alias?: string; debugName?: string; transform?: (v: TransformT) => T | undefined }): InputSignalWithTransform<T | undefined, TransformT>;
|
|
379
|
+
export declare function input<T, TransformT = T>(value: T, options?: { alias?: string; debugName?: string; transform?: (v: TransformT) => T }): InputSignalWithTransform<T, TransformT>;
|
|
380
|
+
export declare function input<T, TransformT = T>(): InputSignalWithTransform<T | undefined, TransformT>;
|
|
381
|
+
export declare namespace input { function required<T, TransformT = T>(options?: { alias?: string; debugName?: string; transform?: (v: TransformT) => T }): InputSignalWithTransform<T, TransformT>; }
|
|
382
|
+
export declare function booleanAttribute(value: unknown): boolean;
|
|
383
|
+
export declare function numberAttribute(value: unknown, fallbackValue?: number): number;
|
|
369
384
|
export declare function model<T>(value: T, options?: any): ModelSignal<T>;
|
|
370
385
|
export declare function model<T>(): ModelSignal<T | undefined>;
|
|
371
386
|
export declare namespace model { function required<T>(options?: any): ModelSignal<T>; }
|
|
372
387
|
export declare function output<T = void>(options?: any): OutputEmitterRef<T>;
|
|
373
388
|
export declare class InjectionToken<T = any> { readonly _desc: string; readonly _type?: T; constructor(description: string, options?: { providedIn?: 'root' | 'platform' | 'any' | null; factory: () => T }) }
|
|
389
|
+
export declare class HostAttributeToken { constructor(attributeName: string) }
|
|
390
|
+
export declare const DOCUMENT: InjectionToken<typeof globalThis extends { document: infer D } ? D : any>;
|
|
391
|
+
export declare const HOST_TAG_NAME: InjectionToken<string | null>;
|
|
392
|
+
export declare const ANIMATION_MODULE_TYPE: InjectionToken<string>;
|
|
393
|
+
export declare function afterNextRender(callback: any, options?: any): EffectRef;
|
|
394
|
+
export declare function afterRenderEffect(callback: ((onCleanup: (cleanupFn: () => void) => void) => void) | Record<string, any>, options?: any): EffectRef;
|
|
395
|
+
export declare function createComponent<C>(component: Type<C>, options: { environmentInjector: EnvironmentInjector; hostElement?: any; elementInjector?: Injector; projectableNodes?: any[][]; bindings?: any[]; directives?: any[] }): ComponentRef<C>;
|
|
396
|
+
export declare abstract class Renderer2 {
|
|
397
|
+
readonly data: { [key: string]: any };
|
|
398
|
+
destroy(): void;
|
|
399
|
+
createElement(name: string, namespace?: string | null): any;
|
|
400
|
+
createComment(value: string): any;
|
|
401
|
+
createText(value: string): any;
|
|
402
|
+
appendChild(parent: any, newChild: any): void;
|
|
403
|
+
insertBefore(parent: any, newChild: any, refChild: any, isMove?: boolean): void;
|
|
404
|
+
removeChild(parent: any, oldChild: any, isHostElement?: boolean): void;
|
|
405
|
+
selectRootElement(selectorOrNode: string | any, preserveContent?: boolean): any;
|
|
406
|
+
parentNode(node: any): any;
|
|
407
|
+
nextSibling(node: any): any;
|
|
408
|
+
setAttribute(el: any, name: string, value: string, namespace?: string | null): void;
|
|
409
|
+
removeAttribute(el: any, name: string, namespace?: string | null): void;
|
|
410
|
+
addClass(el: any, name: string): void;
|
|
411
|
+
removeClass(el: any, name: string): void;
|
|
412
|
+
setStyle(el: any, style: string, value: any, flags?: any): void;
|
|
413
|
+
removeStyle(el: any, style: string, flags?: any): void;
|
|
414
|
+
setProperty(el: any, name: string, value: any): void;
|
|
415
|
+
setValue(node: any, value: string): void;
|
|
416
|
+
listen(target: any, eventName: string, callback: (event: any) => boolean | void): () => void;
|
|
417
|
+
}
|
|
418
|
+
export interface RendererType2 { id: string; encapsulation: ViewEncapsulation; styles: any[]; data: { [key: string]: any } }
|
|
419
|
+
export declare abstract class RendererFactory2 { createRenderer(hostElement: any, type: RendererType2 | null): Renderer2 }
|
|
420
|
+
export declare class ViewRef { readonly destroyed: boolean; destroy(): void; onDestroy(callback: () => void): void; markForCheck(): void; detach(): void; detectChanges(): void; checkNoChanges(): void; reattach(): void }
|
|
374
421
|
export declare function inject<T>(token: InjectionToken<T>): T;
|
|
375
422
|
export declare function inject<T>(token: { prototype: T }): T;
|
|
376
423
|
export declare function inject<T>(token: InjectionToken<T>, options: { optional: true; self?: boolean; skipSelf?: boolean; host?: boolean }): T | null;
|
|
@@ -388,12 +435,13 @@ const SHIMS = {
|
|
|
388
435
|
export declare function NgModule(meta: any): <C>(c: C) => C;
|
|
389
436
|
export declare function Input(options?: any): any;
|
|
390
437
|
export declare function Output(options?: any): any;
|
|
391
|
-
export declare class EventEmitter<T = any> {
|
|
438
|
+
export declare class EventEmitter<T = any> extends Subject<T> {
|
|
392
439
|
constructor(isAsync?: boolean);
|
|
393
440
|
emit(value?: T): void;
|
|
394
441
|
next(value?: T): void;
|
|
395
|
-
subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null):
|
|
396
|
-
subscribe(observer?: { next?: (value: T) => void; error?: (e: any) => void; complete?: () => void } | null):
|
|
442
|
+
subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): any;
|
|
443
|
+
subscribe(observer?: { next?: (value: T) => void; error?: (e: any) => void; complete?: () => void } | null): any;
|
|
444
|
+
subscribe(generatorOrNext?: any, error?: any, complete?: any): any;
|
|
397
445
|
}
|
|
398
446
|
export declare enum ChangeDetectionStrategy { OnPush = 0, Eager = 1, Default = 1 }
|
|
399
447
|
export declare enum ViewEncapsulation { Emulated = 0, None = 2, ShadowDom = 3, ExperimentalIsolatedShadowDom = 4 }
|
|
@@ -413,11 +461,21 @@ const SHIMS = {
|
|
|
413
461
|
export declare function ViewChildren(selector: any, options?: any): any;
|
|
414
462
|
export declare function ContentChild(selector: any, options?: any): any;
|
|
415
463
|
export declare function ContentChildren(selector: any, options?: any): any;
|
|
464
|
+
export declare function viewChild<T>(locator: { prototype: T }, options?: any): Signal<T | undefined>;
|
|
416
465
|
export declare function viewChild<T = any>(locator: any, options?: any): Signal<T | undefined>;
|
|
417
|
-
export declare namespace viewChild {
|
|
466
|
+
export declare namespace viewChild {
|
|
467
|
+
function required<T>(locator: { prototype: T }, options?: any): Signal<T>;
|
|
468
|
+
function required<T = any>(locator: any, options?: any): Signal<T>;
|
|
469
|
+
}
|
|
470
|
+
export declare function viewChildren<T>(locator: { prototype: T }, options?: any): Signal<readonly T[]>;
|
|
418
471
|
export declare function viewChildren<T = any>(locator: any, options?: any): Signal<readonly T[]>;
|
|
472
|
+
export declare function contentChild<T>(locator: { prototype: T }, options?: any): Signal<T | undefined>;
|
|
419
473
|
export declare function contentChild<T = any>(locator: any, options?: any): Signal<T | undefined>;
|
|
420
|
-
export declare namespace contentChild {
|
|
474
|
+
export declare namespace contentChild {
|
|
475
|
+
function required<T>(locator: { prototype: T }, options?: any): Signal<T>;
|
|
476
|
+
function required<T = any>(locator: any, options?: any): Signal<T>;
|
|
477
|
+
}
|
|
478
|
+
export declare function contentChildren<T>(locator: { prototype: T }, options?: any): Signal<readonly T[]>;
|
|
421
479
|
export declare function contentChildren<T = any>(locator: any, options?: any): Signal<readonly T[]>;
|
|
422
480
|
export declare function Pipe(meta: { name: string; pure?: boolean; standalone?: boolean }): <C>(c: C) => C;
|
|
423
481
|
export interface PipeTransform { transform(value: any, ...args: any[]): any }
|
|
@@ -434,10 +492,10 @@ const SHIMS = {
|
|
|
434
492
|
export declare const ENVIRONMENT_INITIALIZER: InjectionToken<readonly (() => void)[]>;
|
|
435
493
|
export declare abstract class ChangeDetectorRef { markForCheck(): void; detectChanges(): void; detach(): void; reattach(): void; checkNoChanges(): void }
|
|
436
494
|
/** A template's view: what a native element is to Angular, read untyped (its type argument is the app's claim). */
|
|
437
|
-
export declare class ElementRef<T = any> { constructor(nativeElement?: any); readonly nativeElement:
|
|
438
|
-
export declare class TemplateRef<C = any> { readonly elementRef: ElementRef; constructor(elementRef?: ElementRef) }
|
|
439
|
-
export declare class EmbeddedViewRef<C = any> { context: C; readonly rootNodes: any[]
|
|
440
|
-
export declare class ComponentRef<C = any> { readonly instance: C; readonly location: ElementRef; readonly injector: Injector; readonly hostView: EmbeddedViewRef<C>; setInput(name: string, value: unknown): void; destroy(): void }
|
|
495
|
+
export declare class ElementRef<T = any> { constructor(nativeElement?: any); readonly nativeElement: T }
|
|
496
|
+
export declare class TemplateRef<C = any> { readonly elementRef: ElementRef; constructor(elementRef?: ElementRef); createEmbeddedView(context?: C, injector?: Injector): EmbeddedViewRef<C> }
|
|
497
|
+
export declare class EmbeddedViewRef<C = any> extends ViewRef { context: C; readonly rootNodes: any[] }
|
|
498
|
+
export declare class ComponentRef<C = any> { readonly instance: C; readonly location: ElementRef; readonly injector: Injector; readonly hostView: EmbeddedViewRef<C>; readonly changeDetectorRef: ChangeDetectorRef; setInput(name: string, value: unknown): void; destroy(): void; onDestroy(callback: () => void): void }
|
|
441
499
|
export declare class ViewContainerRef {
|
|
442
500
|
readonly element: ElementRef;
|
|
443
501
|
readonly injector: Injector;
|
|
@@ -447,7 +505,7 @@ const SHIMS = {
|
|
|
447
505
|
createComponent<C = any>(componentType: Type<C>, options?: any): ComponentRef<C>;
|
|
448
506
|
remove(index?: number): void;
|
|
449
507
|
}
|
|
450
|
-
export declare class ApplicationRef { readonly isStable: any; tick(): void; destroy(): void }
|
|
508
|
+
export declare class ApplicationRef { readonly isStable: any; tick(): void; attachView(viewRef: any): void; detachView(viewRef: any): void; destroy(): void }
|
|
451
509
|
export declare class SimpleChange { constructor(previousValue: any, currentValue: any, firstChange: boolean); previousValue: any; currentValue: any; firstChange: boolean; isFirstChange(): boolean }
|
|
452
510
|
export type SimpleChanges<T = any> = { [propName: string]: SimpleChange };
|
|
453
511
|
export interface OnChanges { ngOnChanges(changes: SimpleChanges): void }
|
|
@@ -466,7 +524,16 @@ const SHIMS = {
|
|
|
466
524
|
notifyOnChanges(): void;
|
|
467
525
|
readonly changes: { subscribe(observerOrNext?: ((value: QueryList<T>) => void) | { next?: (value: QueryList<T>) => void; error?: (e: any) => void; complete?: () => void } | null): { unsubscribe(): void } };
|
|
468
526
|
}
|
|
469
|
-
export declare class DestroyRef { onDestroy(callback: () => void): () => void }
|
|
527
|
+
export declare class DestroyRef { readonly destroyed: boolean; onDestroy(callback: () => void): () => void }
|
|
528
|
+
export declare class PendingTasks { add(): () => void; run<T>(task: () => Promise<T>): Promise<T> }
|
|
529
|
+
export declare enum ɵɵFactoryTarget { Directive = 0, Component = 1, Injectable = 2, Pipe = 3, NgModule = 4 }
|
|
530
|
+
export declare function ɵɵngDeclareFactory(meta: any): any;
|
|
531
|
+
export declare function ɵɵngDeclareInjectable(meta: any): any;
|
|
532
|
+
export declare function ɵɵngDeclarePipe(meta: any): any;
|
|
533
|
+
export declare function ɵɵngDeclareNgModule(meta: any): any;
|
|
534
|
+
export declare function ɵɵngDeclareDirective(meta: any): any;
|
|
535
|
+
export declare function ɵɵngDeclareComponent(meta: any): any;
|
|
536
|
+
export declare function ɵɵngDeclareClassMetadata(meta: any): any;
|
|
470
537
|
export declare class NgZone {
|
|
471
538
|
static isInAngularZone(): boolean;
|
|
472
539
|
readonly onStable: EventEmitter<any>;
|
|
@@ -495,6 +562,8 @@ const SHIMS = {
|
|
|
495
562
|
export declare function toSignal<T>(source: Observable<T>, options?: { injector?: any; requireSync?: boolean; manualCleanup?: boolean; equal?: any }): Signal<T | undefined>;
|
|
496
563
|
export declare function toObservable<T>(source: Signal<T>, options?: { injector?: any }): Observable<T>;
|
|
497
564
|
export declare function takeUntilDestroyed<T>(destroyRef?: DestroyRef): OperatorFunction<T, T>;
|
|
565
|
+
export declare function outputToObservable<T>(ref: import('@angular/core').OutputRef<T>): Observable<T>;
|
|
566
|
+
export declare function outputFromObservable<T>(observable: Observable<T>, opts?: any): import('@angular/core').OutputRef<T>;
|
|
498
567
|
`,
|
|
499
568
|
'@angular/router': `
|
|
500
569
|
import type { Observable } from 'rxjs';
|
|
@@ -564,10 +633,12 @@ const SHIMS = {
|
|
|
564
633
|
navigate(commands: any[], extras?: NavigationExtras): Promise<boolean>;
|
|
565
634
|
navigateByUrl(url: string | UrlTree, extras?: NavigationExtras): Promise<boolean>;
|
|
566
635
|
}
|
|
636
|
+
export type RedirectFunction = (redirectData: { params: Params; queryParams: Params; [key: string]: any }) => string | UrlTree;
|
|
637
|
+
export type RouterFeatures = any;
|
|
567
638
|
export interface Route {
|
|
568
639
|
path?: string;
|
|
569
640
|
component?: any;
|
|
570
|
-
redirectTo?: string;
|
|
641
|
+
redirectTo?: string | RedirectFunction;
|
|
571
642
|
pathMatch?: string;
|
|
572
643
|
outlet?: string;
|
|
573
644
|
data?: Record<string, any>;
|
|
@@ -598,7 +669,7 @@ const SHIMS = {
|
|
|
598
669
|
export declare const RouterModule: { forRoot(routes: Routes, config?: any): any; forChild(routes: Routes): any };
|
|
599
670
|
export declare function provideRouter(routes?: any, ...features: any[]): any;
|
|
600
671
|
export declare const RouterOutlet: any;
|
|
601
|
-
export declare
|
|
672
|
+
export declare class RouterLink { [key: string]: any }
|
|
602
673
|
export declare const RouterLinkActive: any;
|
|
603
674
|
`,
|
|
604
675
|
// What an app implements of @angular/forms (runtime/angular-forms.ts re-exports them): declarations, no classes.
|
|
@@ -637,6 +708,11 @@ const SHIMS = {
|
|
|
637
708
|
export declare const NativeDialogModule: any;
|
|
638
709
|
export declare const NATIVE_DIALOG_DATA: import('@angular/core').InjectionToken<any>;
|
|
639
710
|
export declare function registerElement(name: string, resolver: () => any, meta?: any): void;
|
|
711
|
+
export declare function getViewClass(elementName: string): any;
|
|
712
|
+
export declare function getViewMeta(nodeName: string): any;
|
|
713
|
+
export declare function isKnownView(elementName: string): boolean;
|
|
714
|
+
export declare class ModalDialogParams { context: any; closeCallback: (...args: any[]) => any; constructor(context: any, closeCallback: (...args: any[]) => any) }
|
|
715
|
+
export declare class ModalDialogService { showModal(type: any, options: any): Promise<any> }
|
|
640
716
|
export declare function isAngularHmrRestoringRoute(): boolean;
|
|
641
717
|
export declare const ActionBarComponent: any;
|
|
642
718
|
export declare const ActionItemDirective: any;
|
|
@@ -675,7 +751,7 @@ const RXJS = `
|
|
|
675
751
|
pipe<A, B>(a: OperatorFunction<T, A>, b: OperatorFunction<A, B>): Observable<B>;
|
|
676
752
|
pipe<A, B, C>(a: OperatorFunction<T, A>, b: OperatorFunction<A, B>, c: OperatorFunction<B, C>): Observable<C>;
|
|
677
753
|
}
|
|
678
|
-
export declare class Subject<T> extends Observable<T> { next(value: T): void; asObservable(): Observable<T> }
|
|
754
|
+
export declare class Subject<T> extends Observable<T> { next(value: T): void; complete(): void; asObservable(): Observable<T> }
|
|
679
755
|
export declare class BehaviorSubject<T> extends Subject<T> { constructor(value: T); readonly value: T; getValue(): T }
|
|
680
756
|
export declare class ReplaySubject<T> extends Subject<T> { constructor(bufferSize?: number) }
|
|
681
757
|
export declare function map<T, R>(project: (value: T, index: number) => R): OperatorFunction<T, R>;
|
|
@@ -692,6 +768,10 @@ export const modules = {
|
|
|
692
768
|
'@angular#rx': { file: RX_FILE, sourcesOnly: true, otherwise: '@angular#kit' },
|
|
693
769
|
// Its controls are read untyped as often as typed (`form.get('name').value`).
|
|
694
770
|
'@angular/forms': { file: FORMS_FILE, membersByName: true },
|
|
771
|
+
...Object.fromEntries(['@angular/cdk/a11y', '@angular/cdk/bidi', '@angular/cdk/coercion', '@angular/cdk/dialog', '@angular/cdk/keycodes', '@angular/cdk/menu', '@angular/cdk/observers', '@angular/cdk/observers/private', '@angular/cdk/overlay', '@angular/cdk/platform', '@angular/cdk/portal', '@angular/cdk/scrolling'].map((m) => [
|
|
772
|
+
m,
|
|
773
|
+
{ file: CDK_FILE, membersByName: true },
|
|
774
|
+
])),
|
|
695
775
|
},
|
|
696
776
|
// `<package>/angular`, whose components `angularLibraries` compiles with the app's.
|
|
697
777
|
isLibraryEntry: (specifier, source, virtual) => specifier === `${core.packageOf(specifier)}/angular` && virtual.some((f) => f.endsWith('.release.ts') && f.startsWith(dirname(source) + '/')),
|
package/dist/refusals.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const ISOLATE = 'move the code into a plain function of its own with typed parameters and result, so the rest of the module translates; the refusal then names only that function';
|
|
2
2
|
export const refusals = {
|
|
3
3
|
'library-injectable': { class: 'gap', title: "an injected class only a library's typings declare", suggestion: ISOLATE },
|
|
4
|
-
'view-container-ref': { class: 'gap', title: 'an injected ViewContainerRef', suggestion: ISOLATE },
|
|
5
4
|
};
|
package/dist/semantics.js
CHANGED
|
@@ -2,7 +2,7 @@ import { core, ts } from "./core-api.js";
|
|
|
2
2
|
export const isStatic = (m) => ts.canHaveModifiers(m) && !!ts.getModifiers(m)?.some((x) => x.kind === ts.SyntaxKind.StaticKeyword);
|
|
3
3
|
export const hasModifier = (n, kind) => ts.canHaveModifiers(n) && !!ts.getModifiers(n)?.some((m) => m.kind === kind);
|
|
4
4
|
/** Tokens the kit provides an instance of (`inject(Router)`); any other is the app's service or the injector's. */
|
|
5
|
-
export const KIT_TOKENS = ['RouterExtensions', 'ActivatedRoute', 'Page', 'DestroyRef', 'ChangeDetectorRef', 'ElementRef', 'NativeDialogRef', 'NativeDialogService', 'Router', 'HttpClient', 'Injector', 'EnvironmentInjector', 'NgZone', 'ErrorHandler', 'Location', 'ViewContainerRef', 'ApplicationRef'];
|
|
5
|
+
export const KIT_TOKENS = ['RouterExtensions', 'ActivatedRoute', 'Page', 'DestroyRef', 'ChangeDetectorRef', 'ElementRef', 'NativeDialogRef', 'NativeDialogService', 'Router', 'HttpClient', 'Injector', 'EnvironmentInjector', 'NgZone', 'ErrorHandler', 'Location', 'ViewContainerRef', 'TemplateRef', 'ApplicationRef', 'PendingTasks', 'Renderer2', 'RendererFactory2'];
|
|
6
6
|
/** The code giving a kit token's instance where it is not the token class's own `shared`, per back end. */
|
|
7
7
|
export const INJECTION_TOKENS = {
|
|
8
8
|
RouterExtensions: { swift: 'Router.shared', kotlin: 'Router.shared' },
|
|
@@ -13,7 +13,11 @@ export const INJECTION_TOKENS = {
|
|
|
13
13
|
DestroyRef: { swift: 'DestroyRef.current()', kotlin: 'DestroyRef.current()' },
|
|
14
14
|
ChangeDetectorRef: { swift: 'ChangeDetectorRef.current()', kotlin: 'ChangeDetectorRef.current()' },
|
|
15
15
|
ElementRef: { swift: 'ElementRef.current()', kotlin: 'ElementRef.current()' },
|
|
16
|
+
TemplateRef: { swift: 'TemplateRef.current()', kotlin: 'TemplateRef.current()' },
|
|
17
|
+
ViewContainerRef: { swift: 'ViewContainerRef.current()', kotlin: 'ViewContainerRef.current()' },
|
|
16
18
|
NativeDialogRef: { swift: 'NativeDialogRef.current', kotlin: 'NativeDialogRef.current' },
|
|
19
|
+
Renderer2: { swift: 'Renderer2.current', kotlin: 'Renderer2.current' },
|
|
20
|
+
RendererFactory2: { swift: 'RendererFactory2.current', kotlin: 'RendererFactory2.current' },
|
|
17
21
|
};
|
|
18
22
|
/**
|
|
19
23
|
* What `inject(token)` at `at` gives: the kit's instance for a framework token, else the app's service.
|
|
@@ -71,8 +75,8 @@ export function isInjectableClass(decl, pluginFiles) {
|
|
|
71
75
|
const fn = decl.getSourceFile().fileName;
|
|
72
76
|
if (core.adapterRuntimeFile(fn) === 'runtime/angular-rx.ts' || core.adapterRuntimeFile(fn) === 'runtime/angular.ts')
|
|
73
77
|
return true;
|
|
74
|
-
// @angular/forms'
|
|
75
|
-
if (core.adapterRuntimeFile(fn) === 'runtime/angular-forms.ts')
|
|
78
|
+
// @angular/forms' and @angular/cdk's services: root instances via static `shared`.
|
|
79
|
+
if (core.adapterRuntimeFile(fn) === 'runtime/angular-forms.ts' || core.adapterRuntimeFile(fn) === 'runtime/angular-cdk.ts')
|
|
76
80
|
return decl.members.some((m) => (ts.isPropertyDeclaration(m) || ts.isGetAccessorDeclaration(m)) && isStatic(m) && m.name.getText() === 'shared');
|
|
77
81
|
if (pluginFiles.has(fn))
|
|
78
82
|
return injectableRole(decl, pluginFiles) === 'root';
|
|
@@ -183,7 +187,7 @@ const NG0952 = 'NG0952: Model is required but no value is available yet.';
|
|
|
183
187
|
export const model = {
|
|
184
188
|
plainFields: true,
|
|
185
189
|
wrapsRootViews: true,
|
|
186
|
-
signalTypes: { InputSignal: 'input', ModelSignal: 'model', Signal: 'computed' },
|
|
190
|
+
signalTypes: { InputSignal: 'input', InputSignalWithTransform: 'input', ModelSignal: 'model', Signal: 'computed' },
|
|
187
191
|
// `input()` outside a component (a directive's): a signal the template sets.
|
|
188
192
|
signalConstructors: { signal: { equality: 'identity', options: 1 }, model: 'identity', input: { equality: 'identity', typed: true }, linkedSignal: { equality: 'identity', linked: true } },
|
|
189
193
|
memos: { computed: '@angular/core' },
|
|
@@ -225,6 +229,14 @@ export const model = {
|
|
|
225
229
|
return LIFECYCLE_HOOKS.has(m.name.getText()) || !(ts.isPrivateIdentifier(m.name) || ts.getCombinedModifierFlags(m) & ts.ModifierFlags.Private);
|
|
226
230
|
},
|
|
227
231
|
unsetMembers: isLinkedSignalPreviousSource,
|
|
232
|
+
erasesGenericClass(cls) {
|
|
233
|
+
if (!cls.typeParameters?.length)
|
|
234
|
+
return false;
|
|
235
|
+
if (ts.getDecorators(cls)?.some((d) => /^(Component|Directive|Injectable|Pipe)\b/.test(d.expression.getText())))
|
|
236
|
+
return true;
|
|
237
|
+
const sf = cls.getSourceFile();
|
|
238
|
+
return sf.text.slice(cls.pos, cls.getStart(sf)).includes('@ng-declarable');
|
|
239
|
+
},
|
|
228
240
|
};
|
|
229
241
|
/** Whether `d` is `previous.source` of Angular's `linkedSignal({ source, computation })` (shim, package typings, or inline callback annotation). */
|
|
230
242
|
export function isLinkedSignalPreviousSource(d, checker) {
|
package/dist/swift.js
CHANGED
|
@@ -9,10 +9,8 @@ function tokenName(t, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return e.getText();
|
|
11
11
|
}
|
|
12
|
-
/** What `inject(token)` gives at `at
|
|
12
|
+
/** What `inject(token)` gives at `at`. */
|
|
13
13
|
function injectedToken(t, token, at, decl) {
|
|
14
|
-
if (token === 'ViewContainerRef')
|
|
15
|
-
throw t.error(at, 'an injected ViewContainerRef', 'view-container-ref');
|
|
16
14
|
return injected('swift', token, at, decl && ts.isClassDeclaration(decl) ? injectableShared(decl, t.pluginFiles, t.checker) : undefined);
|
|
17
15
|
}
|
|
18
16
|
/** A class only a library's typings declare has no instance in a release build: the library's JavaScript provides it. */
|
|
@@ -200,8 +198,11 @@ function globalCall(t, name, e, decl, lib) {
|
|
|
200
198
|
}
|
|
201
199
|
if (name === 'firstValueFrom' && lib)
|
|
202
200
|
return `rxFirstValueFrom(${t.expr(arg(0))})`;
|
|
203
|
-
if (name === 'registerElement' && (lib || core.adapterRuntimeFile(decl?.getSourceFile().fileName) === 'runtime/angular-rx.ts'))
|
|
204
|
-
return
|
|
201
|
+
if (name === 'registerElement' && (lib || core.adapterRuntimeFile(decl?.getSourceFile().fileName) === 'runtime/angular-rx.ts')) {
|
|
202
|
+
return e.arguments.length >= 3 && arg(2)
|
|
203
|
+
? `kitRegisterViewMeta(${t.str(arg(0))}, ${t.coerce(arg(1), 'Any?')}, ${t.coerce(arg(2), 'Any?')})`
|
|
204
|
+
: '()';
|
|
205
|
+
}
|
|
205
206
|
return undefined;
|
|
206
207
|
}
|
|
207
208
|
function methodCall(t, owner, method, e) {
|
|
@@ -215,8 +216,6 @@ function methodCall(t, owner, method, e) {
|
|
|
215
216
|
const rawArg0 = forwardRefTarget(e.arguments[0]);
|
|
216
217
|
const tokTarget = ts.isExpressionWithTypeArguments(rawArg0) ? rawArg0.expression : rawArg0;
|
|
217
218
|
const token = tokenName(t, tokTarget);
|
|
218
|
-
if (token === 'ViewContainerRef')
|
|
219
|
-
throw t.error(e, 'an injected ViewContainerRef', 'view-container-ref');
|
|
220
219
|
const tokenDecl = t.resolve(tokTarget)?.declarations?.[0];
|
|
221
220
|
if ((KIT_TOKENS.includes(token) || isInjectableClass(tokenDecl, t.pluginFiles)) && e.arguments.length === 1 && t.throwsInfo.expr(e))
|
|
222
221
|
return injectedToken(t, token, e, tokenDecl);
|
|
@@ -290,7 +289,7 @@ export const swiftHooks = {
|
|
|
290
289
|
'KitHttpClient', 'KitActivatedRoute', 'KitRouter', 'KitNativeDialogRef', 'KitNativeDialogService',
|
|
291
290
|
'HttpParams', 'HttpHeaders', 'HttpResponse', 'HttpErrorResponse', 'HttpRequest', 'HttpContext', 'HttpContextToken',
|
|
292
291
|
'ParamMap', 'UrlSegment', 'UrlTree', 'DefaultUrlSerializer', 'ActivatedRouteSnapshot',
|
|
293
|
-
'ViewContainerRef', 'TemplateRef', 'ComponentRef', 'EmbeddedViewRef', 'ApplicationRef', 'Location'].map((n) => [n, { type: n, shim: true, metatype: true }])),
|
|
292
|
+
'ViewContainerRef', 'TemplateRef', 'ComponentRef', 'EmbeddedViewRef', 'ApplicationRef', 'Location', 'PendingTasks', 'Renderer2', 'RendererFactory2'].map((n) => [n, { type: n, shim: true, metatype: true }])),
|
|
294
293
|
},
|
|
295
294
|
globalCall,
|
|
296
295
|
methodCall,
|
|
@@ -310,7 +309,7 @@ export const swiftHooks = {
|
|
|
310
309
|
const ngImports = standaloneImports(cls, t.checker, t.compiles);
|
|
311
310
|
return ngImports ? [` static let jsNgImports: Any? = JSArray<Any?>([${ngImports.map((e) => t.coerce(e, 'Any?')).join(', ')}])`] : [];
|
|
312
311
|
},
|
|
313
|
-
componentAsValue: (t, cls, type) => `ComponentFactory { ${t.rootView(cls, type, `try AngularView.construct { ${t.throwsInfo.initThrows(cls) ? 'try ' : ''}${type}() }.${t.components.get(cls.name.text)
|
|
312
|
+
componentAsValue: (t, cls, type) => `ComponentFactory(${type}.self) { ${t.rootView(cls, type, `try AngularView.construct { ${t.throwsInfo.initThrows(cls) ? 'try ' : ''}${type}() }.${t.components.get(cls.name.text)?.members?.render ?? 'render'}()`)} }`,
|
|
314
313
|
/** A component created as a root view (bootstrap, route, dialog): made and rendered in its standalone injector. */
|
|
315
314
|
wrapRootView: (t, cls, type, make) => (standaloneImports(cls, t.checker, t.compiles) ? `try Injector.standalone(${type}.self, ${type}.jsNgImports) { ${make} }` : make),
|
|
316
315
|
serviceClass(t, cls, name) {
|
|
@@ -330,6 +329,7 @@ export const swiftHooks = {
|
|
|
330
329
|
];
|
|
331
330
|
return [`final class ${name}: JSInjectableType {`, core.swift.NONISOLATED_DEINIT, ...shared, '', ...members, '}'].join('\n');
|
|
332
331
|
},
|
|
332
|
+
dynamicImport: (specifier) => specifier === '@angular/compiler' ? 'JSPromise<Any?>.reject(JSError("Dynamic import(\'@angular/compiler\') is not available in AOT release builds"))' : undefined,
|
|
333
333
|
// An app's @Injectable class extending another class: translated as any class is, and made by the injector as a service is.
|
|
334
334
|
afterClass: (t, cls, code) => (injectableRole(cls, t.pluginFiles) === 'based' && !injectableBase(t, cls) ? injectableStatics(t, cls, code, 'extension').join('\n') : undefined),
|
|
335
335
|
classExtras(t, cls, name, code) {
|
|
@@ -4,7 +4,9 @@ package org.nativescript.kit
|
|
|
4
4
|
// services compiled to classes with a `shared` instance (`providedIn: 'root'`), as kit-apple's AngularAPI.swift.
|
|
5
5
|
|
|
6
6
|
/** A component class used as a value (`dialog.open(SheetComponent)`): what creating and rendering it gives. */
|
|
7
|
-
class ComponentFactory(internal val make: () -> View)
|
|
7
|
+
class ComponentFactory(override val jsTokenKey: Class<*>?, internal val make: () -> View) : JSTokenKeyed {
|
|
8
|
+
constructor(make: () -> View) : this(null, make)
|
|
9
|
+
}
|
|
8
10
|
|
|
9
11
|
/** `NativeDialogRef`: the open dialog a component was created in. */
|
|
10
12
|
class NativeDialogRef {
|
|
@@ -613,5 +613,108 @@ private fun routeOf(value: Any?): ActivatedRoute? = value as? ActivatedRoute ?:
|
|
|
613
613
|
/** A key of an options object script passes, null when absent. */
|
|
614
614
|
private fun field(target: Any?, key: String): Any? = if (jsIsNullish(target)) null else jsBox(jsGet(target, key)).let { if (it === JSNull) null else it }
|
|
615
615
|
|
|
616
|
-
/** `registerElement(tag, () => Class)`: compiled templates name each view's class
|
|
617
|
-
fun registerElement(
|
|
616
|
+
/** `registerElement(tag, () => Class, meta?)`: compiled templates name each view's class; a meta registers its child hooks. */
|
|
617
|
+
fun registerElement(tag: String, type: Any?, meta: Any? = null) {
|
|
618
|
+
if (meta != null) kitRegisterViewMeta(tag, type, meta)
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/** Runtime registry and mount helper for Angular's `[ngComponentOutlet]` / `*ngComponentOutlet`. */
|
|
622
|
+
object ComponentOutlet {
|
|
623
|
+
private val factories = HashMap<Class<*>, (Region, Any?) -> Unit>()
|
|
624
|
+
|
|
625
|
+
fun register(type: Class<*>, render: (Region, Any?) -> Unit) {
|
|
626
|
+
factories[type] = render
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
fun mount(region: Region, component: () -> Any?, injector: (() -> Any?)? = null, inputs: (() -> Any?)? = null) {
|
|
630
|
+
var currentType: Class<*>? = null
|
|
631
|
+
var branchOwner: Owner? = null
|
|
632
|
+
Owner.current?.onCleanup { branchOwner?.dispose() }
|
|
633
|
+
Effect {
|
|
634
|
+
val raw = try { component() } catch (e: Throwable) { jsReportUncaught(jsCaught(e)); null }
|
|
635
|
+
val cls = jsBox(raw) as? Class<*>
|
|
636
|
+
if (cls == currentType) return@Effect
|
|
637
|
+
currentType = cls
|
|
638
|
+
val inj = try { injector?.invoke()?.let { jsBox(it) as? Injector } } catch (_: Throwable) { null }
|
|
639
|
+
val inp = try { inputs?.invoke() } catch (_: Throwable) { null }
|
|
640
|
+
untrack {
|
|
641
|
+
branchOwner?.dispose()
|
|
642
|
+
branchOwner = null
|
|
643
|
+
val factory = cls?.let { factories[it] }
|
|
644
|
+
if (factory == null) {
|
|
645
|
+
region.set(emptyList())
|
|
646
|
+
return@untrack
|
|
647
|
+
}
|
|
648
|
+
val owner = Owner(null)
|
|
649
|
+
branchOwner = owner
|
|
650
|
+
jsReport {
|
|
651
|
+
if (inj != null) Injector.runInContext(inj) { owner.run { factory(region, inp) } }
|
|
652
|
+
else owner.run { factory(region, inp) }
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/** Runtime helper for dynamic/recursive `[ngTemplateOutlet]` / `*ngTemplateOutlet` and `TemplateRef` closures. */
|
|
660
|
+
object TemplateOutlet {
|
|
661
|
+
fun bind(ref: TemplateRef, render: (Region, Any?) -> Unit) {
|
|
662
|
+
ref._render = { anyRegion, ctx ->
|
|
663
|
+
val region = anyRegion as? Region
|
|
664
|
+
if (region != null) render(region, ctx)
|
|
665
|
+
}
|
|
666
|
+
ref._detached = { ctx, injector ->
|
|
667
|
+
val owner = Owner(null)
|
|
668
|
+
val region = Region(null)
|
|
669
|
+
val run = { owner.run { render(region, ctx) } }
|
|
670
|
+
jsReport {
|
|
671
|
+
val inj = jsBox(injector) as? Injector
|
|
672
|
+
if (inj != null) Injector.runInContext(inj, run)
|
|
673
|
+
else run()
|
|
674
|
+
}
|
|
675
|
+
EmbeddedViewRef(ctx) { owner.dispose() }
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
fun make(render: (Region, Any?) -> Unit): TemplateRef = TemplateRef().also { bind(it, render) }
|
|
680
|
+
|
|
681
|
+
fun mount(region: Region, template: () -> Any?, context: (() -> Any?)? = null) {
|
|
682
|
+
var branchOwner: Owner? = null
|
|
683
|
+
Owner.current?.onCleanup { branchOwner?.dispose() }
|
|
684
|
+
Effect {
|
|
685
|
+
val tpl = jsBox(try { template() } catch (_: Throwable) { null }) as? TemplateRef
|
|
686
|
+
val ctx = try { context?.invoke() } catch (_: Throwable) { null }
|
|
687
|
+
untrack {
|
|
688
|
+
branchOwner?.dispose()
|
|
689
|
+
branchOwner = null
|
|
690
|
+
val render = tpl?._render
|
|
691
|
+
if (render == null) {
|
|
692
|
+
region.set(emptyList())
|
|
693
|
+
return@untrack
|
|
694
|
+
}
|
|
695
|
+
val owner = Owner(null)
|
|
696
|
+
branchOwner = owner
|
|
697
|
+
jsReport { owner.run { render(region, ctx) } }
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/** Scopes `TemplateRef.current()` and `ViewContainerRef.current()` for custom structural directives (`*myDir`). */
|
|
704
|
+
object StructuralDirective {
|
|
705
|
+
fun <T> scope(region: Region, template: TemplateRef, body: () -> T): T {
|
|
706
|
+
val vcr = ViewContainerRef()
|
|
707
|
+
vcr._clear = { region.set(emptyList()) }
|
|
708
|
+
vcr._mount = { tpl, ctx ->
|
|
709
|
+
val owner = Owner(null)
|
|
710
|
+
jsReport { owner.run { tpl._render?.invoke(region, ctx) } }
|
|
711
|
+
EmbeddedViewRef(ctx) {
|
|
712
|
+
owner.dispose()
|
|
713
|
+
region.set(emptyList())
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
return TemplateRef.with(template) {
|
|
717
|
+
ViewContainerRef.with(vcr, body)
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|