UNPKG

2.3 kBPlain TextView Raw
1import { Container } from 'aurelia-dependency-injection';
2import { Router, RouteConfig, NavigationInstruction } from 'aurelia-router';
3import { Controller } from 'aurelia-templating';
4
5export type Constructable<T = any> = new (...args: any[]) => T;
6
7export interface IFrameworkConfiguration {
8 container: Container;
9 singleton(...args: any[]): this;
10 globalResources(...args: any[]): this;
11}
12
13/**@internal */
14declare module 'aurelia-dependency-injection' {
15
16 interface Container {
17 viewModel?: any;
18 getChildRouter(): Router;
19 }
20}
21
22/**@internal */
23declare module 'aurelia-templating' {
24 interface CompositionContext {
25 router?: Router;
26 }
27
28 interface View {
29 // not correct but works fine enough
30 children: View[];
31
32 slots: Record<string, any>;
33 }
34
35 interface CompositionTransaction {
36 initialComposition?: boolean;
37 }
38
39 interface ResourceDescription {
40 value: Function;
41 metadata: HtmlBehaviorResource;
42 }
43
44 interface Controller {
45 slots: Record<string, any>;
46 }
47
48 interface ViewStrategy {
49 makeRelativeTo(moduleId: string): void;
50 }
51}
52
53
54/**
55 * The component responsible for routing
56 */
57export interface ViewPortComponent {
58 viewModel: any;
59 childContainer?: Container;
60 router: Router;
61 config?: RouteConfig;
62 childRouter?: Router;
63 /**
64 * This is for backward compat, when moving from any to a more strongly typed interface
65 */
66 [key: string]: any;
67}
68
69
70export interface ViewPortInstruction {
71
72 name?: string;
73
74 strategy: 'no-change' | 'invoke-lifecycle' | 'replace';
75
76 childNavigationInstruction?: NavigationInstruction;
77
78 moduleId: string;
79
80 component: ViewPortComponent;
81
82 childRouter?: Router;
83
84 lifecycleArgs: [Record<string, string>, RouteConfig, NavigationInstruction];
85
86 prevComponent?: ViewPortComponent;
87}
88
89export interface ViewPort {
90 /**@internal */
91 container: Container;
92 swap(viewportInstruction: ViewPortInstruction): void;
93 process(viewportInstruction: ViewPortInstruction, waitToSwap?: boolean): Promise<void>;
94}
95
96export interface IRouterViewViewPortInstruction extends ViewPortInstruction {
97 controller?: Controller;
98 layoutInstruction?: {
99 viewModel: any;
100 model: any;
101 view: any;
102 };
103}