@microsoft/fast-router 1.0.0-alpha.2 → 1.0.0-alpha.20

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/CHANGELOG.json CHANGED
@@ -1,6 +1,314 @@
1
1
  {
2
2
  "name": "@microsoft/fast-router",
3
3
  "entries": [
4
+ {
5
+ "date": "Wed, 11 Jan 2023 22:07:44 GMT",
6
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.20",
7
+ "version": "1.0.0-alpha.20",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "roeisenb@microsoft.com",
12
+ "package": "@microsoft/fast-router",
13
+ "commit": "26fdb6b0dd0eafab1c4cb2769b7e7aaa24c673c9",
14
+ "comment": "fix: router cannot render component and has missing types"
15
+ },
16
+ {
17
+ "author": "roeisenb@microsoft.com",
18
+ "package": "@microsoft/fast-router",
19
+ "commit": "5c3b2f0431ae8f840d3dc778ff93be73b585c6e2",
20
+ "comment": "fix(fast-router): update to use html.partial"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@microsoft/fast-router",
25
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.20",
26
+ "commit": "2bb85c931a84d4de3a8b61d6f26f89f2d9a525f6"
27
+ }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "date": "Fri, 02 Dec 2022 01:18:22 GMT",
33
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.19",
34
+ "version": "1.0.0-alpha.19",
35
+ "comments": {
36
+ "prerelease": [
37
+ {
38
+ "author": "beachball",
39
+ "package": "@microsoft/fast-router",
40
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.19",
41
+ "commit": "040867e9a2a9e0ae25b78dfb3265fbe8f60fe023"
42
+ }
43
+ ]
44
+ }
45
+ },
46
+ {
47
+ "date": "Tue, 15 Nov 2022 02:40:35 GMT",
48
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.18",
49
+ "version": "1.0.0-alpha.18",
50
+ "comments": {
51
+ "prerelease": [
52
+ {
53
+ "author": "roeisenb@microsoft.com",
54
+ "package": "@microsoft/fast-router",
55
+ "commit": "3c14603089495a7af8ed5b55122c418b47c45fd5",
56
+ "comment": "feat: add new DOM Policy protection throughout"
57
+ },
58
+ {
59
+ "author": "beachball",
60
+ "package": "@microsoft/fast-router",
61
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.18",
62
+ "commit": "416dc9167e9d41e6ffe11d87ed79b2f455357923"
63
+ }
64
+ ]
65
+ }
66
+ },
67
+ {
68
+ "date": "Tue, 01 Nov 2022 23:26:26 GMT",
69
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.17",
70
+ "version": "1.0.0-alpha.17",
71
+ "comments": {
72
+ "prerelease": [
73
+ {
74
+ "author": "beachball",
75
+ "package": "@microsoft/fast-router",
76
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.17",
77
+ "commit": "32d18d0900047899d1dadfe94f7923b6164b0cf3"
78
+ }
79
+ ]
80
+ }
81
+ },
82
+ {
83
+ "date": "Fri, 28 Oct 2022 20:44:44 GMT",
84
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.16",
85
+ "version": "1.0.0-alpha.16",
86
+ "comments": {
87
+ "prerelease": [
88
+ {
89
+ "author": "beachball",
90
+ "package": "@microsoft/fast-router",
91
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.16",
92
+ "commit": "5b745b1fb3bf249a7a2d172b7fb69cb08694aadd"
93
+ }
94
+ ]
95
+ }
96
+ },
97
+ {
98
+ "date": "Tue, 25 Oct 2022 20:24:32 GMT",
99
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.15",
100
+ "version": "1.0.0-alpha.15",
101
+ "comments": {
102
+ "prerelease": [
103
+ {
104
+ "author": "beachball",
105
+ "package": "@microsoft/fast-router",
106
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.15",
107
+ "commit": "220cc7e0e0de490e51cc8b6f42ff46b03228beaa"
108
+ }
109
+ ]
110
+ }
111
+ },
112
+ {
113
+ "date": "Fri, 14 Oct 2022 18:26:11 GMT",
114
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.14",
115
+ "version": "1.0.0-alpha.14",
116
+ "comments": {
117
+ "prerelease": [
118
+ {
119
+ "author": "beachball",
120
+ "package": "@microsoft/fast-router",
121
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.14",
122
+ "commit": "bcfbcb5be4433fb1fb0fab1697f13d345980db87"
123
+ }
124
+ ]
125
+ }
126
+ },
127
+ {
128
+ "date": "Mon, 10 Oct 2022 20:28:02 GMT",
129
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.13",
130
+ "version": "1.0.0-alpha.13",
131
+ "comments": {
132
+ "prerelease": [
133
+ {
134
+ "author": "beachball",
135
+ "package": "@microsoft/fast-router",
136
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.13",
137
+ "commit": "ed2977ef6556964e68ea3ab0e4951320a1527baf"
138
+ }
139
+ ]
140
+ }
141
+ },
142
+ {
143
+ "date": "Thu, 06 Oct 2022 23:21:20 GMT",
144
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.12",
145
+ "version": "1.0.0-alpha.12",
146
+ "comments": {
147
+ "none": [
148
+ {
149
+ "author": "863023+radium-v@users.noreply.github.com",
150
+ "package": "@microsoft/fast-router",
151
+ "commit": "c06e32d72d518bf5c3152efe4e666f233190b445",
152
+ "comment": "upgrade karma to ^6.4.1"
153
+ }
154
+ ],
155
+ "prerelease": [
156
+ {
157
+ "author": "beachball",
158
+ "package": "@microsoft/fast-router",
159
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.12",
160
+ "commit": "a69c2e3c0700918fef5ba934909781cc8ab71384"
161
+ }
162
+ ]
163
+ }
164
+ },
165
+ {
166
+ "date": "Wed, 05 Oct 2022 23:26:01 GMT",
167
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.11",
168
+ "version": "1.0.0-alpha.11",
169
+ "comments": {
170
+ "prerelease": [
171
+ {
172
+ "author": "beachball",
173
+ "package": "@microsoft/fast-router",
174
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.11",
175
+ "commit": "21d1de94be2b9399ddc43a2b93c6483fa7304591"
176
+ }
177
+ ]
178
+ }
179
+ },
180
+ {
181
+ "date": "Mon, 03 Oct 2022 23:44:38 GMT",
182
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.10",
183
+ "version": "1.0.0-alpha.10",
184
+ "comments": {
185
+ "prerelease": [
186
+ {
187
+ "author": "beachball",
188
+ "package": "@microsoft/fast-router",
189
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.10",
190
+ "commit": "e23f4375f183f0672f9aeafd0e58411adb66ae90"
191
+ }
192
+ ]
193
+ }
194
+ },
195
+ {
196
+ "date": "Wed, 28 Sep 2022 20:45:51 GMT",
197
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.9",
198
+ "version": "1.0.0-alpha.9",
199
+ "comments": {
200
+ "prerelease": [
201
+ {
202
+ "author": "beachball",
203
+ "package": "@microsoft/fast-router",
204
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.9",
205
+ "commit": "08fab33015853b7f820fdfdac2aecddfeb31843f"
206
+ }
207
+ ]
208
+ }
209
+ },
210
+ {
211
+ "date": "Tue, 27 Sep 2022 22:31:52 GMT",
212
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.8",
213
+ "version": "1.0.0-alpha.8",
214
+ "comments": {
215
+ "prerelease": [
216
+ {
217
+ "author": "beachball",
218
+ "package": "@microsoft/fast-router",
219
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.8",
220
+ "commit": "8834c6732c727d39f92f72b197388453a9c17f9b"
221
+ }
222
+ ]
223
+ }
224
+ },
225
+ {
226
+ "date": "Fri, 23 Sep 2022 22:53:27 GMT",
227
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.7",
228
+ "version": "1.0.0-alpha.7",
229
+ "comments": {
230
+ "prerelease": [
231
+ {
232
+ "author": "roeisenb@microsoft.com",
233
+ "package": "@microsoft/fast-router",
234
+ "commit": "2edd63a8abe24c68cfc7c76d773c912c6f2d6543",
235
+ "comment": "fix: update router to use the new behavior API"
236
+ },
237
+ {
238
+ "author": "beachball",
239
+ "package": "@microsoft/fast-router",
240
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.7",
241
+ "commit": "1646b26450a08a77c8bd6302560fe12cc6989ae1"
242
+ }
243
+ ]
244
+ }
245
+ },
246
+ {
247
+ "date": "Thu, 01 Sep 2022 21:53:34 GMT",
248
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.6",
249
+ "version": "1.0.0-alpha.6",
250
+ "comments": {
251
+ "prerelease": [
252
+ {
253
+ "author": "beachball",
254
+ "package": "@microsoft/fast-router",
255
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.6",
256
+ "commit": "6b0f08574475d8b28cc2df67bf72b9041c2ad285"
257
+ }
258
+ ]
259
+ }
260
+ },
261
+ {
262
+ "date": "Thu, 18 Aug 2022 20:46:10 GMT",
263
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.5",
264
+ "version": "1.0.0-alpha.5",
265
+ "comments": {
266
+ "prerelease": [
267
+ {
268
+ "author": "beachball",
269
+ "package": "@microsoft/fast-router",
270
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.5",
271
+ "commit": "0b57f1bc812e8e6371b7d27bb625f99a25bfaa66"
272
+ }
273
+ ]
274
+ }
275
+ },
276
+ {
277
+ "date": "Mon, 18 Jul 2022 21:10:01 GMT",
278
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.4",
279
+ "version": "1.0.0-alpha.4",
280
+ "comments": {
281
+ "prerelease": [
282
+ {
283
+ "author": "roeisenb@microsoft.com",
284
+ "package": "@microsoft/fast-router",
285
+ "commit": "f164aa75e62ed71c9386902051c021f1fdfba364",
286
+ "comment": "refactor: reduce duplication in style normalization code scenarios"
287
+ },
288
+ {
289
+ "author": "beachball",
290
+ "package": "@microsoft/fast-router",
291
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.4",
292
+ "commit": "2ff46a32cdd9af12b236d0e2f3436a4de782e8ee"
293
+ }
294
+ ]
295
+ }
296
+ },
297
+ {
298
+ "date": "Wed, 22 Jun 2022 20:17:50 GMT",
299
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.3",
300
+ "version": "1.0.0-alpha.3",
301
+ "comments": {
302
+ "prerelease": [
303
+ {
304
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.3",
305
+ "author": "nicholasrice@users.noreply.github.com",
306
+ "commit": "f28cdb9fdba9cb27904acfad7444de82d447f39e",
307
+ "package": "@microsoft/fast-router"
308
+ }
309
+ ]
310
+ }
311
+ },
4
312
  {
5
313
  "date": "Wed, 15 Jun 2022 17:41:10 GMT",
6
314
  "tag": "@microsoft/fast-router_v1.0.0-alpha.2",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,158 @@
1
1
  # Change Log - @microsoft/fast-router
2
2
 
3
- This log was last generated on Wed, 15 Jun 2022 17:41:10 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 11 Jan 2023 22:07:44 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.0.0-alpha.20
8
+
9
+ Wed, 11 Jan 2023 22:07:44 GMT
10
+
11
+ ### Changes
12
+
13
+ - fix: router cannot render component and has missing types (roeisenb@microsoft.com)
14
+ - fix(fast-router): update to use html.partial (roeisenb@microsoft.com)
15
+ - Bump @microsoft/fast-element to v2.0.0-beta.20
16
+
17
+ ## 1.0.0-alpha.19
18
+
19
+ Fri, 02 Dec 2022 01:18:22 GMT
20
+
21
+ ### Changes
22
+
23
+ - Bump @microsoft/fast-element to v2.0.0-beta.19
24
+
25
+ ## 1.0.0-alpha.18
26
+
27
+ Tue, 15 Nov 2022 02:40:35 GMT
28
+
29
+ ### Changes
30
+
31
+ - feat: add new DOM Policy protection throughout (roeisenb@microsoft.com)
32
+ - Bump @microsoft/fast-element to v2.0.0-beta.18
33
+
34
+ ## 1.0.0-alpha.17
35
+
36
+ Tue, 01 Nov 2022 23:26:26 GMT
37
+
38
+ ### Changes
39
+
40
+ - Bump @microsoft/fast-element to v2.0.0-beta.17
41
+
42
+ ## 1.0.0-alpha.16
43
+
44
+ Fri, 28 Oct 2022 20:44:44 GMT
45
+
46
+ ### Changes
47
+
48
+ - Bump @microsoft/fast-element to v2.0.0-beta.16
49
+
50
+ ## 1.0.0-alpha.15
51
+
52
+ Tue, 25 Oct 2022 20:24:32 GMT
53
+
54
+ ### Changes
55
+
56
+ - Bump @microsoft/fast-element to v2.0.0-beta.15
57
+
58
+ ## 1.0.0-alpha.14
59
+
60
+ Fri, 14 Oct 2022 18:26:11 GMT
61
+
62
+ ### Changes
63
+
64
+ - Bump @microsoft/fast-element to v2.0.0-beta.14
65
+
66
+ ## 1.0.0-alpha.13
67
+
68
+ Mon, 10 Oct 2022 20:28:02 GMT
69
+
70
+ ### Changes
71
+
72
+ - Bump @microsoft/fast-element to v2.0.0-beta.13
73
+
74
+ ## 1.0.0-alpha.12
75
+
76
+ Thu, 06 Oct 2022 23:21:20 GMT
77
+
78
+ ### Changes
79
+
80
+ - Bump @microsoft/fast-element to v2.0.0-beta.12
81
+
82
+ ## 1.0.0-alpha.11
83
+
84
+ Wed, 05 Oct 2022 23:26:01 GMT
85
+
86
+ ### Changes
87
+
88
+ - Bump @microsoft/fast-element to v2.0.0-beta.11
89
+
90
+ ## 1.0.0-alpha.10
91
+
92
+ Mon, 03 Oct 2022 23:44:38 GMT
93
+
94
+ ### Changes
95
+
96
+ - Bump @microsoft/fast-element to v2.0.0-beta.10
97
+
98
+ ## 1.0.0-alpha.9
99
+
100
+ Wed, 28 Sep 2022 20:45:51 GMT
101
+
102
+ ### Changes
103
+
104
+ - Bump @microsoft/fast-element to v2.0.0-beta.9
105
+
106
+ ## 1.0.0-alpha.8
107
+
108
+ Tue, 27 Sep 2022 22:31:52 GMT
109
+
110
+ ### Changes
111
+
112
+ - Bump @microsoft/fast-element to v2.0.0-beta.8
113
+
114
+ ## 1.0.0-alpha.7
115
+
116
+ Fri, 23 Sep 2022 22:53:27 GMT
117
+
118
+ ### Changes
119
+
120
+ - fix: update router to use the new behavior API (roeisenb@microsoft.com)
121
+ - Bump @microsoft/fast-element to v2.0.0-beta.7
122
+
123
+ ## 1.0.0-alpha.6
124
+
125
+ Thu, 01 Sep 2022 21:53:34 GMT
126
+
127
+ ### Changes
128
+
129
+ - Bump @microsoft/fast-element to v2.0.0-beta.6
130
+
131
+ ## 1.0.0-alpha.5
132
+
133
+ Thu, 18 Aug 2022 20:46:10 GMT
134
+
135
+ ### Changes
136
+
137
+ - Bump @microsoft/fast-element to v2.0.0-beta.5
138
+
139
+ ## 1.0.0-alpha.4
140
+
141
+ Mon, 18 Jul 2022 21:10:01 GMT
142
+
143
+ ### Changes
144
+
145
+ - refactor: reduce duplication in style normalization code scenarios (roeisenb@microsoft.com)
146
+ - Bump @microsoft/fast-element to v2.0.0-beta.4
147
+
148
+ ## 1.0.0-alpha.3
149
+
150
+ Wed, 22 Jun 2022 20:17:50 GMT
151
+
152
+ ### Changes
153
+
154
+ - Bump @microsoft/fast-element to v2.0.0-beta.3 (nicholasrice@users.noreply.github.com)
155
+
7
156
  ## 1.0.0-alpha.2
8
157
 
9
158
  Wed, 15 Jun 2022 17:41:10 GMT
@@ -1,6 +1,5 @@
1
- import { AddViewBehaviorFactory, Behavior, HTMLDirective, ViewBehaviorTargets } from "@microsoft/fast-element";
1
+ import { AddViewBehaviorFactory, ViewBehavior, ViewBehaviorFactory, ViewController } from "@microsoft/fast-element";
2
2
  import { NavigationCommitPhaseHook, NavigationPhaseHook, NavigationPhaseName } from "./phases.js";
3
- import { RouterExecutionContext } from "./view.js";
4
3
  /**
5
4
  * @beta
6
5
  */
@@ -18,20 +17,19 @@ export declare type ContributorOptions = {
18
17
  lifecycle?: boolean;
19
18
  parameters?: boolean;
20
19
  };
21
- declare class NavigationContributorDirective implements HTMLDirective {
22
- private options;
23
- id: string;
24
- nodeId: string;
20
+ declare class NavigationContributorDirective implements ViewBehaviorFactory {
21
+ readonly options: Required<ContributorOptions>;
22
+ targetNodeId: string;
25
23
  constructor(options: Required<ContributorOptions>);
26
24
  createHTML(add: AddViewBehaviorFactory): string;
27
- createBehavior(targets: ViewBehaviorTargets): NavigationContributorBehavior;
25
+ createBehavior(): NavigationContributorBehavior;
28
26
  }
29
- declare class NavigationContributorBehavior implements Behavior {
30
- private contributor;
31
- private options;
27
+ declare class NavigationContributorBehavior implements ViewBehavior {
28
+ private directive;
32
29
  private router;
33
- constructor(contributor: HTMLElement & NavigationContributor, options: Required<ContributorOptions>);
34
- bind(source: unknown, context: RouterExecutionContext): void;
30
+ private contributor;
31
+ constructor(directive: NavigationContributorDirective);
32
+ bind(controller: ViewController): void;
35
33
  unbind(source: unknown): void;
36
34
  }
37
35
  /**
@@ -33,5 +33,5 @@ export interface NavigationPhase<TSettings = any> {
33
33
  * @beta
34
34
  */
35
35
  export interface NavigationCommitPhase<TSettings = any> extends Omit<NavigationPhase<TSettings>, "cancel" | "canceled" | "onCancel"> {
36
- setTitle(title: string): any;
36
+ setTitle(title: string): void;
37
37
  }
@@ -10,7 +10,7 @@ export declare const QueryString: Readonly<{
10
10
  * @param traditional - Boolean Use the old URI template standard (RFC6570)
11
11
  * @returns The generated query string, excluding leading '?'.
12
12
  */
13
- build(params: Object, traditional?: boolean): string;
13
+ build(params: Record<string, string>, traditional?: boolean): string;
14
14
  /**
15
15
  * Separate the query string from the path and returns the two parts.
16
16
  * @param path - The path to separate.
@@ -2,7 +2,16 @@ import { Route } from "./navigation.js";
2
2
  /**
3
3
  * @beta
4
4
  */
5
- export declare type RouteParameterConverter = (value: string | undefined) => any | Promise<any>;
5
+ export interface RouteParameterConverterContext<TSettings = any> {
6
+ readonly endpoint: Endpoint<TSettings>;
7
+ readonly params: Readonly<Record<string, string | undefined>>;
8
+ readonly typedParams: Record<string, any>;
9
+ readonly queryParams: Record<string, string>;
10
+ }
11
+ /**
12
+ * @beta
13
+ */
14
+ export declare type RouteParameterConverter = (name: string, value: string | undefined, context: RouteParameterConverterContext) => any | Promise<any>;
6
15
  /**
7
16
  * @beta
8
17
  */
@@ -32,8 +32,8 @@ declare const routerProperty = "$router";
32
32
  export interface RouterElement extends HTMLElement {
33
33
  readonly [routerProperty]: Router;
34
34
  config: RouterConfiguration | null;
35
- connectedCallback(): any;
36
- disconnectedCallback(): any;
35
+ connectedCallback(): void;
36
+ disconnectedCallback(): void;
37
37
  }
38
38
  /**
39
39
  * @beta
@@ -125,13 +125,13 @@ export declare type RouteMatch<TSettings = any> = {
125
125
  /**
126
126
  * @beta
127
127
  */
128
- export declare type ConverterObject = {
128
+ export declare type RouteParameterConverterObject = {
129
129
  convert: RouteParameterConverter;
130
130
  };
131
131
  /**
132
132
  * @beta
133
133
  */
134
- export declare type ParameterConverter = RouteParameterConverter | ConverterObject | Constructable<ConverterObject>;
134
+ export declare type ParameterConverter = RouteParameterConverter | RouteParameterConverterObject | Constructable<RouteParameterConverterObject>;
135
135
  /**
136
136
  * @beta
137
137
  */
@@ -4,19 +4,14 @@ import { Router } from "./router.js";
4
4
  * @beta
5
5
  */
6
6
  export declare type RouterExecutionContext = ExecutionContext & {
7
- router: Router;
7
+ router?: Router;
8
8
  };
9
- /**
10
- * @beta
11
- */
12
- export declare const RouterExecutionContext: Readonly<{
13
- create(router: Router): any;
14
- }>;
15
9
  /**
16
10
  * @beta
17
11
  */
18
12
  export interface RouteView {
19
- bind(allTypedParams: Readonly<Record<string, any>>, context: RouterExecutionContext): void;
13
+ context: RouterExecutionContext;
14
+ bind(allTypedParams: Readonly<Record<string, any>>): void;
20
15
  appendTo(host: HTMLElement): void;
21
16
  dispose(): void;
22
17
  }
@@ -48,7 +43,7 @@ export declare class FASTElementLayout implements Layout {
48
43
  private readonly template;
49
44
  private runBeforeCommit;
50
45
  private styles;
51
- constructor(template?: ViewTemplate | null, styles?: ComposableStyles | ComposableStyles[] | null, runBeforeCommit?: boolean);
46
+ constructor(template?: ViewTemplate | null, styles?: ComposableStyles | ComposableStyles[] | undefined, runBeforeCommit?: boolean);
52
47
  beforeCommit(routerElement: HTMLElement): Promise<void>;
53
48
  afterCommit(routerElement: HTMLElement): Promise<void>;
54
49
  private apply;
@@ -45,16 +45,17 @@ export class Redirect {
45
45
  });
46
46
  }
47
47
  }
48
- function factoryFromElementName(name) {
49
- return html `<${name} ${navigationContributor()}></${name}>`;
48
+ function factoryFromElementName(tagName) {
49
+ const tag = html.partial(tagName);
50
+ return html `<${tag} ${navigationContributor()}></${tag}>`;
50
51
  }
51
52
  function factoryFromElementInstance(element) {
52
53
  const fragment = document.createDocumentFragment();
53
54
  fragment.appendChild(element);
54
55
  const factory = navigationContributor();
55
- factory.nodeId = "h";
56
+ factory.targetNodeId = "h";
56
57
  const view = new HTMLView(fragment, [factory], {
57
- [factory.nodeId]: element,
58
+ [factory.targetNodeId]: element,
58
59
  });
59
60
  return {
60
61
  create() {
@@ -17,34 +17,38 @@ class NavigationContributorDirective {
17
17
  createHTML(add) {
18
18
  return Markup.attribute(add(this));
19
19
  }
20
- createBehavior(targets) {
21
- return new NavigationContributorBehavior(targets[this.nodeId], this.options);
20
+ createBehavior() {
21
+ return new NavigationContributorBehavior(this);
22
22
  }
23
23
  }
24
24
  HTMLDirective.define(NavigationContributorDirective);
25
25
  class NavigationContributorBehavior {
26
- constructor(contributor, options) {
27
- this.contributor = contributor;
28
- this.options = options;
26
+ constructor(directive) {
27
+ this.directive = directive;
29
28
  this.router = null;
30
29
  }
31
- bind(source, context) {
32
- if (this.options.lifecycle) {
33
- this.router = context.router || Router.find(this.contributor);
34
- this.router.addContributor(this.contributor);
30
+ bind(controller) {
31
+ var _a;
32
+ const context = controller.context;
33
+ const options = this.directive.options;
34
+ this.contributor = controller.targets[this.directive.targetNodeId];
35
+ if (options.lifecycle) {
36
+ this.router = (_a = context.router) !== null && _a !== void 0 ? _a : Router.find(this.contributor);
37
+ if (this.router) {
38
+ this.router.addContributor(this.contributor);
39
+ controller.onUnbind(this);
40
+ }
35
41
  }
36
- if (this.options.parameters) {
42
+ if (options.parameters) {
37
43
  const contributor = this.contributor;
38
- const routeParams = source;
44
+ const routeParams = controller.source;
39
45
  for (const key in routeParams) {
40
46
  contributor[key] = routeParams[key];
41
47
  }
42
48
  }
43
49
  }
44
50
  unbind(source) {
45
- if (this.router !== null) {
46
- this.router.removeContributor(this.contributor);
47
- }
51
+ this.router.removeContributor(this.contributor);
48
52
  }
49
53
  }
50
54
  /**