@microsoft/fast-router 1.0.0-alpha.3 → 1.0.0-alpha.30

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.md CHANGED
@@ -1,9 +1,234 @@
1
1
  # Change Log - @microsoft/fast-router
2
2
 
3
- This log was last generated on Wed, 22 Jun 2022 20:17:50 GMT and should not be manually modified.
3
+ <!-- This log was last generated on Tue, 27 Jan 2026 17:28:54 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.0.0-alpha.30
8
+
9
+ Tue, 27 Jan 2026 17:28:54 GMT
10
+
11
+ ### Changes
12
+
13
+ - chore: hoist devDependencies (863023+radium-v@users.noreply.github.com)
14
+ - Bump @microsoft/fast-element to v2.9.2
15
+
16
+ ## 1.0.0-alpha.29
17
+
18
+ Wed, 11 Dec 2024 19:53:31 GMT
19
+
20
+ ### Changes
21
+
22
+ - Change the router to use peerDependency for fast-element (7559015+janechu@users.noreply.github.com)
23
+ - Bump @microsoft/fast-element to v2.0.1
24
+
25
+ ## 1.0.0-alpha.28
26
+
27
+ Mon, 19 Aug 2024 22:04:19 GMT
28
+
29
+ ### Changes
30
+
31
+ - Fix CodeQL issues (7559015+janechu@users.noreply.github.com)
32
+ - Bump @microsoft/fast-element to v2.0.0
33
+
34
+ ## 1.0.0-alpha.27
35
+
36
+ Thu, 20 Jun 2024 17:00:56 GMT
37
+
38
+ ### Changes
39
+
40
+ - fix: remove link handler in disconnect (1222863+xuwaters@users.noreply.github.com)
41
+
42
+ ## 1.0.0-alpha.26
43
+
44
+ Fri, 18 Aug 2023 00:04:39 GMT
45
+
46
+ ### Changes
47
+
48
+ - update fast-element export paths to include extensions (chhol@microsoft.com)
49
+ - Bump @microsoft/fast-element to v2.0.0-beta.26
50
+
51
+ ## 1.0.0-alpha.25
52
+
53
+ Sat, 12 Aug 2023 00:26:36 GMT
54
+
55
+ ### Changes
56
+
57
+ - Bump @microsoft/fast-element to v2.0.0-beta.25
58
+
59
+ ## 1.0.0-alpha.24
60
+
61
+ Fri, 16 Jun 2023 18:17:13 GMT
62
+
63
+ ### Changes
64
+
65
+ - Bump @microsoft/fast-element to v2.0.0-beta.24
66
+
67
+ ## 1.0.0-alpha.23
68
+
69
+ Tue, 28 Mar 2023 22:14:10 GMT
70
+
71
+ ### Changes
72
+
73
+ - Bump @microsoft/fast-element to v2.0.0-beta.23
74
+
75
+ ## 1.0.0-alpha.22
76
+
77
+ Sat, 11 Mar 2023 00:09:49 GMT
78
+
79
+ ### Changes
80
+
81
+ - Bump @microsoft/fast-element to v2.0.0-beta.22
82
+
83
+ ## 1.0.0-alpha.21
84
+
85
+ Tue, 14 Feb 2023 04:02:36 GMT
86
+
87
+ ### Changes
88
+
89
+ - Bump @microsoft/fast-element to v2.0.0-beta.21
90
+
91
+ ## 1.0.0-alpha.20
92
+
93
+ Wed, 11 Jan 2023 22:07:44 GMT
94
+
95
+ ### Changes
96
+
97
+ - fix: router cannot render component and has missing types (roeisenb@microsoft.com)
98
+ - fix(fast-router): update to use html.partial (roeisenb@microsoft.com)
99
+ - Bump @microsoft/fast-element to v2.0.0-beta.20
100
+
101
+ ## 1.0.0-alpha.19
102
+
103
+ Fri, 02 Dec 2022 01:18:22 GMT
104
+
105
+ ### Changes
106
+
107
+ - Bump @microsoft/fast-element to v2.0.0-beta.19
108
+
109
+ ## 1.0.0-alpha.18
110
+
111
+ Tue, 15 Nov 2022 02:40:35 GMT
112
+
113
+ ### Changes
114
+
115
+ - feat: add new DOM Policy protection throughout (roeisenb@microsoft.com)
116
+ - Bump @microsoft/fast-element to v2.0.0-beta.18
117
+
118
+ ## 1.0.0-alpha.17
119
+
120
+ Tue, 01 Nov 2022 23:26:26 GMT
121
+
122
+ ### Changes
123
+
124
+ - Bump @microsoft/fast-element to v2.0.0-beta.17
125
+
126
+ ## 1.0.0-alpha.16
127
+
128
+ Fri, 28 Oct 2022 20:44:44 GMT
129
+
130
+ ### Changes
131
+
132
+ - Bump @microsoft/fast-element to v2.0.0-beta.16
133
+
134
+ ## 1.0.0-alpha.15
135
+
136
+ Tue, 25 Oct 2022 20:24:32 GMT
137
+
138
+ ### Changes
139
+
140
+ - Bump @microsoft/fast-element to v2.0.0-beta.15
141
+
142
+ ## 1.0.0-alpha.14
143
+
144
+ Fri, 14 Oct 2022 18:26:11 GMT
145
+
146
+ ### Changes
147
+
148
+ - Bump @microsoft/fast-element to v2.0.0-beta.14
149
+
150
+ ## 1.0.0-alpha.13
151
+
152
+ Mon, 10 Oct 2022 20:28:02 GMT
153
+
154
+ ### Changes
155
+
156
+ - Bump @microsoft/fast-element to v2.0.0-beta.13
157
+
158
+ ## 1.0.0-alpha.12
159
+
160
+ Thu, 06 Oct 2022 23:21:20 GMT
161
+
162
+ ### Changes
163
+
164
+ - Bump @microsoft/fast-element to v2.0.0-beta.12
165
+
166
+ ## 1.0.0-alpha.11
167
+
168
+ Wed, 05 Oct 2022 23:26:01 GMT
169
+
170
+ ### Changes
171
+
172
+ - Bump @microsoft/fast-element to v2.0.0-beta.11
173
+
174
+ ## 1.0.0-alpha.10
175
+
176
+ Mon, 03 Oct 2022 23:44:38 GMT
177
+
178
+ ### Changes
179
+
180
+ - Bump @microsoft/fast-element to v2.0.0-beta.10
181
+
182
+ ## 1.0.0-alpha.9
183
+
184
+ Wed, 28 Sep 2022 20:45:51 GMT
185
+
186
+ ### Changes
187
+
188
+ - Bump @microsoft/fast-element to v2.0.0-beta.9
189
+
190
+ ## 1.0.0-alpha.8
191
+
192
+ Tue, 27 Sep 2022 22:31:52 GMT
193
+
194
+ ### Changes
195
+
196
+ - Bump @microsoft/fast-element to v2.0.0-beta.8
197
+
198
+ ## 1.0.0-alpha.7
199
+
200
+ Fri, 23 Sep 2022 22:53:27 GMT
201
+
202
+ ### Changes
203
+
204
+ - fix: update router to use the new behavior API (roeisenb@microsoft.com)
205
+ - Bump @microsoft/fast-element to v2.0.0-beta.7
206
+
207
+ ## 1.0.0-alpha.6
208
+
209
+ Thu, 01 Sep 2022 21:53:34 GMT
210
+
211
+ ### Changes
212
+
213
+ - Bump @microsoft/fast-element to v2.0.0-beta.6
214
+
215
+ ## 1.0.0-alpha.5
216
+
217
+ Thu, 18 Aug 2022 20:46:10 GMT
218
+
219
+ ### Changes
220
+
221
+ - Bump @microsoft/fast-element to v2.0.0-beta.5
222
+
223
+ ## 1.0.0-alpha.4
224
+
225
+ Mon, 18 Jul 2022 21:10:01 GMT
226
+
227
+ ### Changes
228
+
229
+ - refactor: reduce duplication in style normalization code scenarios (roeisenb@microsoft.com)
230
+ - Bump @microsoft/fast-element to v2.0.0-beta.4
231
+
7
232
  ## 1.0.0-alpha.3
8
233
 
9
234
  Wed, 22 Jun 2022 20:17:50 GMT
package/README.md CHANGED
@@ -6,16 +6,12 @@ The `@microsoft/fast-router` package contains a history-based navigation and rou
6
6
 
7
7
  ### From NPM
8
8
 
9
- To install the `fast-router` library, use either `npm` or `yarn` as follows:
9
+ To install the `fast-router` library using `npm`:
10
10
 
11
11
  ```shell
12
12
  npm install --save @microsoft/fast-router
13
13
  ```
14
14
 
15
- ```shell
16
- yarn add @microsoft/fast-router
17
- ```
18
-
19
15
  Within your JavaScript or TypeScript code, you can then import library APIs like this:
20
16
 
21
17
  ```ts
@@ -1,10 +1,9 @@
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
  */
7
- export declare type NavigationContributor<TSettings = any> = Partial<Record<Exclude<NavigationPhaseName, "commit">, NavigationPhaseHook<TSettings>>> & {
6
+ export type NavigationContributor<TSettings = any> = Partial<Record<Exclude<NavigationPhaseName, "commit">, NavigationPhaseHook<TSettings>>> & {
8
7
  commit?: NavigationCommitPhaseHook<TSettings>;
9
8
  };
10
9
  /**
@@ -14,24 +13,23 @@ export declare function isNavigationPhaseContributor<T extends NavigationPhaseNa
14
13
  /**
15
14
  * @beta
16
15
  */
17
- export declare type ContributorOptions = {
16
+ export 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
  /**
@@ -3,19 +3,19 @@ import { Router } from "./router.js";
3
3
  /**
4
4
  * @beta
5
5
  */
6
- export declare type NavigationPhaseName = "navigate" | "leave" | "construct" | "enter" | "commit";
6
+ export type NavigationPhaseName = "navigate" | "leave" | "construct" | "enter" | "commit";
7
7
  /**
8
8
  * @beta
9
9
  */
10
- export declare type NavigationPhaseHook<TSettings = any> = (phase: NavigationPhase<TSettings>) => Promise<any> | any;
10
+ export type NavigationPhaseHook<TSettings = any> = (phase: NavigationPhase<TSettings>) => Promise<any> | any;
11
11
  /**
12
12
  * @beta
13
13
  */
14
- export declare type NavigationCommitPhaseHook<TSettings = any> = (phase: NavigationCommitPhase<TSettings>) => Promise<any> | any;
14
+ export type NavigationCommitPhaseHook<TSettings = any> = (phase: NavigationCommitPhase<TSettings>) => Promise<any> | any;
15
15
  /**
16
16
  * @beta
17
17
  */
18
- export declare type NavigationPhaseFollowupAction = () => Promise<any> | any;
18
+ export type NavigationPhaseFollowupAction = () => Promise<any> | any;
19
19
  /**
20
20
  * @beta
21
21
  */
@@ -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 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
@@ -11,127 +11,127 @@ export declare const childRouteParameter = "fast-child-route";
11
11
  /**
12
12
  * @beta
13
13
  */
14
- export declare type SupportsSettings<TSettings = any> = {
14
+ export type SupportsSettings<TSettings = any> = {
15
15
  settings?: TSettings;
16
16
  };
17
17
  /**
18
18
  * @beta
19
19
  */
20
- export declare type PathedRouteDefinition<TSettings = any> = SupportsSettings<TSettings> & Route;
20
+ export type PathedRouteDefinition<TSettings = any> = SupportsSettings<TSettings> & Route;
21
21
  /**
22
22
  * @beta
23
23
  */
24
- export declare type IgnorableRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings>;
24
+ export type IgnorableRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings>;
25
25
  /**
26
26
  * @beta
27
27
  */
28
- export declare type LayoutAndTransitionRouteDefinition = {
28
+ export type LayoutAndTransitionRouteDefinition = {
29
29
  layout?: Layout | ViewTemplate;
30
30
  transition?: Transition;
31
31
  };
32
32
  /**
33
33
  * @beta
34
34
  */
35
- export declare type RedirectRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & {
35
+ export type RedirectRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & {
36
36
  redirect: string;
37
37
  };
38
38
  /**
39
39
  * @beta
40
40
  */
41
- export declare type HasTitle = {
41
+ export type HasTitle = {
42
42
  title?: string;
43
43
  };
44
44
  /**
45
45
  * @beta
46
46
  */
47
- export declare type NavigableRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & LayoutAndTransitionRouteDefinition & HasTitle & {
47
+ export type NavigableRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & LayoutAndTransitionRouteDefinition & HasTitle & {
48
48
  childRouters?: boolean;
49
49
  };
50
50
  /**
51
51
  * @beta
52
52
  */
53
- export declare type FASTElementConstructor = new () => FASTElement;
53
+ export type FASTElementConstructor = new () => FASTElement;
54
54
  /**
55
55
  * @beta
56
56
  */
57
- export declare type HasElement = {
57
+ export type HasElement = {
58
58
  element: string | FASTElementConstructor | HTMLElement | (() => Promise<string | FASTElementConstructor | HTMLElement>);
59
59
  };
60
60
  /**
61
61
  * @beta
62
62
  */
63
- export declare type ElementFallbackRouteDefinition<TSettings = any> = LayoutAndTransitionRouteDefinition & HasElement & SupportsSettings<TSettings> & HasTitle;
63
+ export type ElementFallbackRouteDefinition<TSettings = any> = LayoutAndTransitionRouteDefinition & HasElement & SupportsSettings<TSettings> & HasTitle;
64
64
  /**
65
65
  * @beta
66
66
  */
67
- export declare type ElementRouteDefinition<TSettings = any> = NavigableRouteDefinition<TSettings> & HasElement;
67
+ export type ElementRouteDefinition<TSettings = any> = NavigableRouteDefinition<TSettings> & HasElement;
68
68
  /**
69
69
  * @beta
70
70
  */
71
- export declare type HasTemplate = {
71
+ export type HasTemplate = {
72
72
  template: ViewTemplate | (() => Promise<ViewTemplate>);
73
73
  };
74
74
  /**
75
75
  * @beta
76
76
  */
77
- export declare type TemplateFallbackRouteDefinition<TSettings = any> = LayoutAndTransitionRouteDefinition & HasTemplate & SupportsSettings<TSettings> & HasTitle;
77
+ export type TemplateFallbackRouteDefinition<TSettings = any> = LayoutAndTransitionRouteDefinition & HasTemplate & SupportsSettings<TSettings> & HasTitle;
78
78
  /**
79
79
  * @beta
80
80
  */
81
- export declare type TemplateRouteDefinition<TSettings = any> = NavigableRouteDefinition<TSettings> & HasTemplate;
81
+ export type TemplateRouteDefinition<TSettings = any> = NavigableRouteDefinition<TSettings> & HasTemplate;
82
82
  /**
83
83
  * @beta
84
84
  */
85
- export declare type HasCommand = {
85
+ export type HasCommand = {
86
86
  command: NavigationCommand;
87
87
  };
88
88
  /**
89
89
  * @beta
90
90
  */
91
- export declare type CommandRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & HasCommand & HasTitle;
91
+ export type CommandRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & HasCommand & HasTitle;
92
92
  /**
93
93
  * @beta
94
94
  */
95
- export declare type CommandFallbackRouteDefinition<TSettings = any> = HasCommand & SupportsSettings<TSettings> & HasTitle;
95
+ export type CommandFallbackRouteDefinition<TSettings = any> = HasCommand & SupportsSettings<TSettings> & HasTitle;
96
96
  /**
97
97
  * @beta
98
98
  */
99
- export declare type FallbackRouteDefinition<TSettings = any> = ElementFallbackRouteDefinition<TSettings> | TemplateFallbackRouteDefinition<TSettings> | Pick<RedirectRouteDefinition<TSettings>, "redirect"> | CommandFallbackRouteDefinition<TSettings>;
99
+ export type FallbackRouteDefinition<TSettings = any> = ElementFallbackRouteDefinition<TSettings> | TemplateFallbackRouteDefinition<TSettings> | Pick<RedirectRouteDefinition<TSettings>, "redirect"> | CommandFallbackRouteDefinition<TSettings>;
100
100
  /**
101
101
  * @beta
102
102
  */
103
- export declare type DefinitionCallback = () => Promise<FallbackRouteDefinition> | FallbackRouteDefinition;
103
+ export type DefinitionCallback = () => Promise<FallbackRouteDefinition> | FallbackRouteDefinition;
104
104
  /**
105
105
  * @beta
106
106
  */
107
- export declare type RenderableRouteDefinition<TSettings = any> = ElementRouteDefinition<TSettings> | TemplateRouteDefinition<TSettings>;
107
+ export type RenderableRouteDefinition<TSettings = any> = ElementRouteDefinition<TSettings> | TemplateRouteDefinition<TSettings>;
108
108
  /**
109
109
  * @beta
110
110
  */
111
- export declare type MappableRouteDefinition<TSettings = any> = RenderableRouteDefinition<TSettings> | RedirectRouteDefinition<TSettings> | CommandRouteDefinition<TSettings> | ParentRouteDefinition<TSettings>;
111
+ export type MappableRouteDefinition<TSettings = any> = RenderableRouteDefinition<TSettings> | RedirectRouteDefinition<TSettings> | CommandRouteDefinition<TSettings> | ParentRouteDefinition<TSettings>;
112
112
  /**
113
113
  * @beta
114
114
  */
115
- export declare type ParentRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & LayoutAndTransitionRouteDefinition & {
115
+ export type ParentRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & LayoutAndTransitionRouteDefinition & {
116
116
  children: MappableRouteDefinition<TSettings>[];
117
117
  };
118
118
  /**
119
119
  * @beta
120
120
  */
121
- export declare type RouteMatch<TSettings = any> = {
121
+ export type RouteMatch<TSettings = any> = {
122
122
  route: RecognizedRoute<TSettings>;
123
123
  command: NavigationCommand;
124
124
  };
125
125
  /**
126
126
  * @beta
127
127
  */
128
- export declare type ConverterObject = {
128
+ export 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 type ParameterConverter = RouteParameterConverter | RouteParameterConverterObject | Constructable<RouteParameterConverterObject>;
135
135
  /**
136
136
  * @beta
137
137
  */
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.24.2"
8
+ "packageVersion": "7.47.0"
9
9
  }
10
10
  ]
11
11
  }
@@ -3,20 +3,15 @@ import { Router } from "./router.js";
3
3
  /**
4
4
  * @beta
5
5
  */
6
- export declare type RouterExecutionContext = ExecutionContext & {
7
- router: Router;
6
+ export type RouterExecutionContext = ExecutionContext & {
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() {
@@ -160,10 +161,12 @@ export class Render {
160
161
  }
161
162
  }
162
163
  else if (element instanceof HTMLElement) {
163
- definition.factory = factory = factoryFromElementInstance(element);
164
+ definition.factory = factory =
165
+ factoryFromElementInstance(element);
164
166
  }
165
167
  else {
166
- definition.factory = factory = factoryFromElementName(element);
168
+ definition.factory = factory =
169
+ factoryFromElementName(element);
167
170
  }
168
171
  return factory.create();
169
172
  });
@@ -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
  /**
package/dist/esm/links.js CHANGED
@@ -16,7 +16,7 @@ export class DefaultLinkHandler {
16
16
  window.addEventListener("click", this.handler, true);
17
17
  }
18
18
  disconnect() {
19
- window.removeEventListener("click", this.handler);
19
+ window.removeEventListener("click", this.handler, true);
20
20
  }
21
21
  getEventInfo(event) {
22
22
  const info = {