@microsoft/fast-router 1.0.0-alpha.1 → 1.0.0-alpha.10

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,153 @@
1
1
  {
2
2
  "name": "@microsoft/fast-router",
3
3
  "entries": [
4
+ {
5
+ "date": "Mon, 03 Oct 2022 23:44:38 GMT",
6
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.10",
7
+ "version": "1.0.0-alpha.10",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "beachball",
12
+ "package": "@microsoft/fast-router",
13
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.10",
14
+ "commit": "e23f4375f183f0672f9aeafd0e58411adb66ae90"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Wed, 28 Sep 2022 20:45:51 GMT",
21
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.9",
22
+ "version": "1.0.0-alpha.9",
23
+ "comments": {
24
+ "prerelease": [
25
+ {
26
+ "author": "beachball",
27
+ "package": "@microsoft/fast-router",
28
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.9",
29
+ "commit": "08fab33015853b7f820fdfdac2aecddfeb31843f"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Tue, 27 Sep 2022 22:31:52 GMT",
36
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.8",
37
+ "version": "1.0.0-alpha.8",
38
+ "comments": {
39
+ "prerelease": [
40
+ {
41
+ "author": "beachball",
42
+ "package": "@microsoft/fast-router",
43
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.8",
44
+ "commit": "8834c6732c727d39f92f72b197388453a9c17f9b"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Fri, 23 Sep 2022 22:53:27 GMT",
51
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.7",
52
+ "version": "1.0.0-alpha.7",
53
+ "comments": {
54
+ "prerelease": [
55
+ {
56
+ "author": "roeisenb@microsoft.com",
57
+ "package": "@microsoft/fast-router",
58
+ "commit": "2edd63a8abe24c68cfc7c76d773c912c6f2d6543",
59
+ "comment": "fix: update router to use the new behavior API"
60
+ },
61
+ {
62
+ "author": "beachball",
63
+ "package": "@microsoft/fast-router",
64
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.7",
65
+ "commit": "1646b26450a08a77c8bd6302560fe12cc6989ae1"
66
+ }
67
+ ]
68
+ }
69
+ },
70
+ {
71
+ "date": "Thu, 01 Sep 2022 21:53:34 GMT",
72
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.6",
73
+ "version": "1.0.0-alpha.6",
74
+ "comments": {
75
+ "prerelease": [
76
+ {
77
+ "author": "beachball",
78
+ "package": "@microsoft/fast-router",
79
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.6",
80
+ "commit": "6b0f08574475d8b28cc2df67bf72b9041c2ad285"
81
+ }
82
+ ]
83
+ }
84
+ },
85
+ {
86
+ "date": "Thu, 18 Aug 2022 20:46:10 GMT",
87
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.5",
88
+ "version": "1.0.0-alpha.5",
89
+ "comments": {
90
+ "prerelease": [
91
+ {
92
+ "author": "beachball",
93
+ "package": "@microsoft/fast-router",
94
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.5",
95
+ "commit": "0b57f1bc812e8e6371b7d27bb625f99a25bfaa66"
96
+ }
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ "date": "Mon, 18 Jul 2022 21:10:01 GMT",
102
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.4",
103
+ "version": "1.0.0-alpha.4",
104
+ "comments": {
105
+ "prerelease": [
106
+ {
107
+ "author": "roeisenb@microsoft.com",
108
+ "package": "@microsoft/fast-router",
109
+ "commit": "f164aa75e62ed71c9386902051c021f1fdfba364",
110
+ "comment": "refactor: reduce duplication in style normalization code scenarios"
111
+ },
112
+ {
113
+ "author": "beachball",
114
+ "package": "@microsoft/fast-router",
115
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.4",
116
+ "commit": "2ff46a32cdd9af12b236d0e2f3436a4de782e8ee"
117
+ }
118
+ ]
119
+ }
120
+ },
121
+ {
122
+ "date": "Wed, 22 Jun 2022 20:17:50 GMT",
123
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.3",
124
+ "version": "1.0.0-alpha.3",
125
+ "comments": {
126
+ "prerelease": [
127
+ {
128
+ "comment": "Bump @microsoft/fast-element to v2.0.0-beta.3",
129
+ "author": "nicholasrice@users.noreply.github.com",
130
+ "commit": "f28cdb9fdba9cb27904acfad7444de82d447f39e",
131
+ "package": "@microsoft/fast-router"
132
+ }
133
+ ]
134
+ }
135
+ },
136
+ {
137
+ "date": "Wed, 15 Jun 2022 17:41:10 GMT",
138
+ "tag": "@microsoft/fast-router_v1.0.0-alpha.2",
139
+ "version": "1.0.0-alpha.2",
140
+ "comments": {
141
+ "prerelease": [
142
+ {
143
+ "comment": "chore: fix package.json type fields",
144
+ "author": "roeisenb@microsoft.com",
145
+ "commit": "e86a638b9e84cbf36d950025889742944e68e512",
146
+ "package": "@microsoft/fast-router"
147
+ }
148
+ ]
149
+ }
150
+ },
4
151
  {
5
152
  "date": "Wed, 01 Jun 2022 17:53:14 GMT",
6
153
  "tag": "@microsoft/fast-router_v1.0.0-alpha.1",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,83 @@
1
1
  # Change Log - @microsoft/fast-router
2
2
 
3
- This log was last generated on Wed, 01 Jun 2022 17:53:14 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 03 Oct 2022 23:44:38 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.0.0-alpha.10
8
+
9
+ Mon, 03 Oct 2022 23:44:38 GMT
10
+
11
+ ### Changes
12
+
13
+ - Bump @microsoft/fast-element to v2.0.0-beta.10
14
+
15
+ ## 1.0.0-alpha.9
16
+
17
+ Wed, 28 Sep 2022 20:45:51 GMT
18
+
19
+ ### Changes
20
+
21
+ - Bump @microsoft/fast-element to v2.0.0-beta.9
22
+
23
+ ## 1.0.0-alpha.8
24
+
25
+ Tue, 27 Sep 2022 22:31:52 GMT
26
+
27
+ ### Changes
28
+
29
+ - Bump @microsoft/fast-element to v2.0.0-beta.8
30
+
31
+ ## 1.0.0-alpha.7
32
+
33
+ Fri, 23 Sep 2022 22:53:27 GMT
34
+
35
+ ### Changes
36
+
37
+ - fix: update router to use the new behavior API (roeisenb@microsoft.com)
38
+ - Bump @microsoft/fast-element to v2.0.0-beta.7
39
+
40
+ ## 1.0.0-alpha.6
41
+
42
+ Thu, 01 Sep 2022 21:53:34 GMT
43
+
44
+ ### Changes
45
+
46
+ - Bump @microsoft/fast-element to v2.0.0-beta.6
47
+
48
+ ## 1.0.0-alpha.5
49
+
50
+ Thu, 18 Aug 2022 20:46:10 GMT
51
+
52
+ ### Changes
53
+
54
+ - Bump @microsoft/fast-element to v2.0.0-beta.5
55
+
56
+ ## 1.0.0-alpha.4
57
+
58
+ Mon, 18 Jul 2022 21:10:01 GMT
59
+
60
+ ### Changes
61
+
62
+ - refactor: reduce duplication in style normalization code scenarios (roeisenb@microsoft.com)
63
+ - Bump @microsoft/fast-element to v2.0.0-beta.4
64
+
65
+ ## 1.0.0-alpha.3
66
+
67
+ Wed, 22 Jun 2022 20:17:50 GMT
68
+
69
+ ### Changes
70
+
71
+ - Bump @microsoft/fast-element to v2.0.0-beta.3 (nicholasrice@users.noreply.github.com)
72
+
73
+ ## 1.0.0-alpha.2
74
+
75
+ Wed, 15 Jun 2022 17:41:10 GMT
76
+
77
+ ### Changes
78
+
79
+ - chore: fix package.json type fields (roeisenb@microsoft.com)
80
+
7
81
  ## 1.0.0-alpha.1
8
82
 
9
83
  Wed, 01 Jun 2022 17:53:14 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,20 @@ export declare type ContributorOptions = {
18
17
  lifecycle?: boolean;
19
18
  parameters?: boolean;
20
19
  };
21
- declare class NavigationContributorDirective implements HTMLDirective {
22
- private options;
20
+ declare class NavigationContributorDirective implements ViewBehaviorFactory {
21
+ readonly options: Required<ContributorOptions>;
23
22
  id: string;
24
23
  nodeId: string;
25
24
  constructor(options: Required<ContributorOptions>);
26
25
  createHTML(add: AddViewBehaviorFactory): string;
27
- createBehavior(targets: ViewBehaviorTargets): NavigationContributorBehavior;
26
+ createBehavior(): NavigationContributorBehavior;
28
27
  }
29
- declare class NavigationContributorBehavior implements Behavior {
30
- private contributor;
31
- private options;
28
+ declare class NavigationContributorBehavior implements ViewBehavior {
29
+ private directive;
32
30
  private router;
33
- constructor(contributor: HTMLElement & NavigationContributor, options: Required<ContributorOptions>);
34
- bind(source: unknown, context: RouterExecutionContext): void;
31
+ private contributor;
32
+ constructor(directive: NavigationContributorDirective);
33
+ bind(controller: ViewController): void;
35
34
  unbind(source: unknown): void;
36
35
  }
37
36
  /**
@@ -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;
@@ -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.nodeId];
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
  /**
@@ -3,7 +3,6 @@ import { FASTElement } from "@microsoft/fast-element";
3
3
  import { composedParent } from "@microsoft/fast-element/utilities";
4
4
  import { NavigationMessage } from "./navigation.js";
5
5
  import { childRouteParameter } from "./routes.js";
6
- import { RouterExecutionContext } from "./view.js";
7
6
  const routerProperty = "$router";
8
7
  function findParentRouterForElement(element) {
9
8
  let parent = element;
@@ -137,7 +136,8 @@ export class DefaultRouter {
137
136
  return __awaiter(this, void 0, void 0, function* () {
138
137
  this.newRoute = route;
139
138
  this.newView = yield command.createView();
140
- this.newView.bind(route.allTypedParams, RouterExecutionContext.create(this));
139
+ this.newView.context.router = this;
140
+ this.newView.bind(route.allTypedParams);
141
141
  this.newView.appendTo(this.host);
142
142
  yield command.transition.begin(this.host, this.view, this.newView);
143
143
  return {
package/dist/esm/view.js CHANGED
@@ -1,18 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
- import { ElementStyles, ExecutionContext, html, } from "@microsoft/fast-element";
2
+ import { ElementStyles, html, } from "@microsoft/fast-element";
3
3
  import { isFASTElementHost } from "./router.js";
4
- /**
5
- * @beta
6
- */
7
- export const RouterExecutionContext = Object.freeze({
8
- create(router) {
9
- return Object.create(ExecutionContext.default, {
10
- router: {
11
- value: router,
12
- },
13
- });
14
- },
15
- });
16
4
  /**
17
5
  * @beta
18
6
  */
@@ -33,17 +21,11 @@ export const Transition = Object.freeze({
33
21
  * @beta
34
22
  */
35
23
  export class FASTElementLayout {
36
- constructor(template = null, styles = null, runBeforeCommit = true) {
24
+ constructor(template = null, styles = undefined, runBeforeCommit = true) {
25
+ var _a;
37
26
  this.template = template;
38
27
  this.runBeforeCommit = runBeforeCommit;
39
- this.styles =
40
- styles === void 0 || styles === null
41
- ? null
42
- : Array.isArray(styles)
43
- ? new ElementStyles(styles)
44
- : styles instanceof ElementStyles
45
- ? styles
46
- : new ElementStyles([styles]);
28
+ this.styles = (_a = ElementStyles.normalize(styles)) !== null && _a !== void 0 ? _a : null;
47
29
  }
48
30
  beforeCommit(routerElement) {
49
31
  return __awaiter(this, void 0, void 0, function* () {
@@ -64,8 +46,8 @@ export class FASTElementLayout {
64
46
  if (routerElement.$fastController.template !== this.template) {
65
47
  routerElement.$fastController.template = this.template;
66
48
  }
67
- if (routerElement.$fastController.styles !== this.styles) {
68
- routerElement.$fastController.styles = this.styles;
49
+ if (routerElement.$fastController.mainStyles !== this.styles) {
50
+ routerElement.$fastController.mainStyles = this.styles;
69
51
  }
70
52
  }
71
53
  }
@@ -2410,7 +2410,7 @@
2410
2410
  },
2411
2411
  {
2412
2412
  "kind": "Content",
2413
- "text": "[] | null"
2413
+ "text": "[] | undefined"
2414
2414
  },
2415
2415
  {
2416
2416
  "kind": "Content",
@@ -9097,11 +9097,11 @@
9097
9097
  {
9098
9098
  "kind": "Reference",
9099
9099
  "text": "ExecutionContext",
9100
- "canonicalReference": "@microsoft/fast-element!ExecutionContext:type"
9100
+ "canonicalReference": "@microsoft/fast-element!ExecutionContext:interface"
9101
9101
  },
9102
9102
  {
9103
9103
  "kind": "Content",
9104
- "text": " & {\n router: "
9104
+ "text": " & {\n router?: "
9105
9105
  },
9106
9106
  {
9107
9107
  "kind": "Reference",
@@ -9124,41 +9124,6 @@
9124
9124
  "endIndex": 5
9125
9125
  }
9126
9126
  },
9127
- {
9128
- "kind": "Variable",
9129
- "canonicalReference": "@microsoft/fast-router!RouterExecutionContext:var",
9130
- "docComment": "/**\n * @beta\n */\n",
9131
- "excerptTokens": [
9132
- {
9133
- "kind": "Content",
9134
- "text": "RouterExecutionContext: "
9135
- },
9136
- {
9137
- "kind": "Reference",
9138
- "text": "Readonly",
9139
- "canonicalReference": "!Readonly:type"
9140
- },
9141
- {
9142
- "kind": "Content",
9143
- "text": "<{\n create(router: "
9144
- },
9145
- {
9146
- "kind": "Reference",
9147
- "text": "Router",
9148
- "canonicalReference": "@microsoft/fast-router!Router:interface"
9149
- },
9150
- {
9151
- "kind": "Content",
9152
- "text": "): any;\n}>"
9153
- }
9154
- ],
9155
- "releaseTag": "Beta",
9156
- "name": "RouterExecutionContext",
9157
- "variableTypeTokenRange": {
9158
- "startIndex": 1,
9159
- "endIndex": 5
9160
- }
9161
- },
9162
9127
  {
9163
9128
  "kind": "Interface",
9164
9129
  "canonicalReference": "@microsoft/fast-router!RouteView:interface",
@@ -9245,15 +9210,6 @@
9245
9210
  "kind": "Content",
9246
9211
  "text": "<string, any>>"
9247
9212
  },
9248
- {
9249
- "kind": "Content",
9250
- "text": ", context: "
9251
- },
9252
- {
9253
- "kind": "Reference",
9254
- "text": "RouterExecutionContext",
9255
- "canonicalReference": "@microsoft/fast-router!RouterExecutionContext:type"
9256
- },
9257
9213
  {
9258
9214
  "kind": "Content",
9259
9215
  "text": "): "
@@ -9269,8 +9225,8 @@
9269
9225
  ],
9270
9226
  "isOptional": false,
9271
9227
  "returnTypeTokenRange": {
9272
- "startIndex": 8,
9273
- "endIndex": 9
9228
+ "startIndex": 6,
9229
+ "endIndex": 7
9274
9230
  },
9275
9231
  "releaseTag": "Beta",
9276
9232
  "overloadIndex": 1,
@@ -9282,17 +9238,36 @@
9282
9238
  "endIndex": 5
9283
9239
  },
9284
9240
  "isOptional": false
9241
+ }
9242
+ ],
9243
+ "name": "bind"
9244
+ },
9245
+ {
9246
+ "kind": "PropertySignature",
9247
+ "canonicalReference": "@microsoft/fast-router!RouteView#context:member",
9248
+ "docComment": "",
9249
+ "excerptTokens": [
9250
+ {
9251
+ "kind": "Content",
9252
+ "text": "context: "
9285
9253
  },
9286
9254
  {
9287
- "parameterName": "context",
9288
- "parameterTypeTokenRange": {
9289
- "startIndex": 6,
9290
- "endIndex": 7
9291
- },
9292
- "isOptional": false
9255
+ "kind": "Reference",
9256
+ "text": "RouterExecutionContext",
9257
+ "canonicalReference": "@microsoft/fast-router!RouterExecutionContext:type"
9258
+ },
9259
+ {
9260
+ "kind": "Content",
9261
+ "text": ";"
9293
9262
  }
9294
9263
  ],
9295
- "name": "bind"
9264
+ "isOptional": false,
9265
+ "releaseTag": "Beta",
9266
+ "name": "context",
9267
+ "propertyTypeTokenRange": {
9268
+ "startIndex": 1,
9269
+ "endIndex": 2
9270
+ }
9296
9271
  },
9297
9272
  {
9298
9273
  "kind": "MethodSignature",
@@ -1,11 +1,11 @@
1
1
  import { AddViewBehaviorFactory } from '@microsoft/fast-element';
2
- import { Behavior } from '@microsoft/fast-element';
3
2
  import { ComposableStyles } from '@microsoft/fast-element';
4
3
  import { Constructable } from '@microsoft/fast-element';
5
4
  import { ExecutionContext } from '@microsoft/fast-element';
6
5
  import { FASTElement } from '@microsoft/fast-element';
7
- import { HTMLDirective } from '@microsoft/fast-element';
8
- import { ViewBehaviorTargets } from '@microsoft/fast-element';
6
+ import { ViewBehavior } from '@microsoft/fast-element';
7
+ import { ViewBehaviorFactory } from '@microsoft/fast-element';
8
+ import { ViewController } from '@microsoft/fast-element';
9
9
  import { ViewTemplate } from '@microsoft/fast-element';
10
10
 
11
11
  /* Excluded from this release type: childRouteParameter */
@@ -199,7 +199,7 @@ export declare class FASTElementLayout implements Layout {
199
199
  private readonly template;
200
200
  private runBeforeCommit;
201
201
  private styles;
202
- constructor(template?: ViewTemplate | null, styles?: ComposableStyles | ComposableStyles[] | null, runBeforeCommit?: boolean);
202
+ constructor(template?: ViewTemplate | null, styles?: ComposableStyles | ComposableStyles[] | undefined, runBeforeCommit?: boolean);
203
203
  beforeCommit(routerElement: HTMLElement): Promise<void>;
204
204
  afterCommit(routerElement: HTMLElement): Promise<void>;
205
205
  private apply;
@@ -339,22 +339,22 @@ export declare type NavigationContributor<TSettings = any> = Partial<Record<Excl
339
339
  */
340
340
  export declare function navigationContributor(options?: ContributorOptions): NavigationContributorDirective;
341
341
 
342
- declare class NavigationContributorBehavior implements Behavior {
343
- private contributor;
344
- private options;
342
+ declare class NavigationContributorBehavior implements ViewBehavior {
343
+ private directive;
345
344
  private router;
346
- constructor(contributor: HTMLElement & NavigationContributor, options: Required<ContributorOptions>);
347
- bind(source: unknown, context: RouterExecutionContext): void;
345
+ private contributor;
346
+ constructor(directive: NavigationContributorDirective);
347
+ bind(controller: ViewController): void;
348
348
  unbind(source: unknown): void;
349
349
  }
350
350
 
351
- declare class NavigationContributorDirective implements HTMLDirective {
352
- private options;
351
+ declare class NavigationContributorDirective implements ViewBehaviorFactory {
352
+ readonly options: Required<ContributorOptions>;
353
353
  id: string;
354
354
  nodeId: string;
355
355
  constructor(options: Required<ContributorOptions>);
356
356
  createHTML(add: AddViewBehaviorFactory): string;
357
- createBehavior(targets: ViewBehaviorTargets): NavigationContributorBehavior;
357
+ createBehavior(): NavigationContributorBehavior;
358
358
  }
359
359
 
360
360
  /**
@@ -746,23 +746,17 @@ export declare interface RouterElement extends HTMLElement {
746
746
  * @beta
747
747
  */
748
748
  export declare type RouterExecutionContext = ExecutionContext & {
749
- router: Router;
749
+ router?: Router;
750
750
  };
751
751
 
752
- /**
753
- * @beta
754
- */
755
- export declare const RouterExecutionContext: Readonly<{
756
- create(router: Router): any;
757
- }>;
758
-
759
752
  declare const routerProperty = "$router";
760
753
 
761
754
  /**
762
755
  * @beta
763
756
  */
764
757
  export declare interface RouteView {
765
- bind(allTypedParams: Readonly<Record<string, any>>, context: RouterExecutionContext): void;
758
+ context: RouterExecutionContext;
759
+ bind(allTypedParams: Readonly<Record<string, any>>): void;
766
760
  appendTo(host: HTMLElement): void;
767
761
  dispose(): void;
768
762
  }
@@ -1,11 +1,11 @@
1
1
  import { AddViewBehaviorFactory } from '@microsoft/fast-element';
2
- import { Behavior } from '@microsoft/fast-element';
3
2
  import { ComposableStyles } from '@microsoft/fast-element';
4
3
  import { Constructable } from '@microsoft/fast-element';
5
4
  import { ExecutionContext } from '@microsoft/fast-element';
6
5
  import { FASTElement } from '@microsoft/fast-element';
7
- import { HTMLDirective } from '@microsoft/fast-element';
8
- import { ViewBehaviorTargets } from '@microsoft/fast-element';
6
+ import { ViewBehavior } from '@microsoft/fast-element';
7
+ import { ViewBehaviorFactory } from '@microsoft/fast-element';
8
+ import { ViewController } from '@microsoft/fast-element';
9
9
  import { ViewTemplate } from '@microsoft/fast-element';
10
10
 
11
11
  /**
@@ -202,7 +202,7 @@ export declare class FASTElementLayout implements Layout {
202
202
  private readonly template;
203
203
  private runBeforeCommit;
204
204
  private styles;
205
- constructor(template?: ViewTemplate | null, styles?: ComposableStyles | ComposableStyles[] | null, runBeforeCommit?: boolean);
205
+ constructor(template?: ViewTemplate | null, styles?: ComposableStyles | ComposableStyles[] | undefined, runBeforeCommit?: boolean);
206
206
  beforeCommit(routerElement: HTMLElement): Promise<void>;
207
207
  afterCommit(routerElement: HTMLElement): Promise<void>;
208
208
  private apply;
@@ -342,22 +342,22 @@ export declare type NavigationContributor<TSettings = any> = Partial<Record<Excl
342
342
  */
343
343
  export declare function navigationContributor(options?: ContributorOptions): NavigationContributorDirective;
344
344
 
345
- declare class NavigationContributorBehavior implements Behavior {
346
- private contributor;
347
- private options;
345
+ declare class NavigationContributorBehavior implements ViewBehavior {
346
+ private directive;
348
347
  private router;
349
- constructor(contributor: HTMLElement & NavigationContributor, options: Required<ContributorOptions>);
350
- bind(source: unknown, context: RouterExecutionContext): void;
348
+ private contributor;
349
+ constructor(directive: NavigationContributorDirective);
350
+ bind(controller: ViewController): void;
351
351
  unbind(source: unknown): void;
352
352
  }
353
353
 
354
- declare class NavigationContributorDirective implements HTMLDirective {
355
- private options;
354
+ declare class NavigationContributorDirective implements ViewBehaviorFactory {
355
+ readonly options: Required<ContributorOptions>;
356
356
  id: string;
357
357
  nodeId: string;
358
358
  constructor(options: Required<ContributorOptions>);
359
359
  createHTML(add: AddViewBehaviorFactory): string;
360
- createBehavior(targets: ViewBehaviorTargets): NavigationContributorBehavior;
360
+ createBehavior(): NavigationContributorBehavior;
361
361
  }
362
362
 
363
363
  /**
@@ -749,23 +749,17 @@ export declare interface RouterElement extends HTMLElement {
749
749
  * @beta
750
750
  */
751
751
  export declare type RouterExecutionContext = ExecutionContext & {
752
- router: Router;
752
+ router?: Router;
753
753
  };
754
754
 
755
- /**
756
- * @beta
757
- */
758
- export declare const RouterExecutionContext: Readonly<{
759
- create(router: Router): any;
760
- }>;
761
-
762
755
  declare const routerProperty = "$router";
763
756
 
764
757
  /**
765
758
  * @beta
766
759
  */
767
760
  export declare interface RouteView {
768
- bind(allTypedParams: Readonly<Record<string, any>>, context: RouterExecutionContext): void;
761
+ context: RouterExecutionContext;
762
+ bind(allTypedParams: Readonly<Record<string, any>>): void;
769
763
  appendTo(host: HTMLElement): void;
770
764
  dispose(): void;
771
765
  }
@@ -5,13 +5,13 @@
5
5
  ```ts
6
6
 
7
7
  import { AddViewBehaviorFactory } from '@microsoft/fast-element';
8
- import { Behavior } from '@microsoft/fast-element';
9
8
  import { ComposableStyles } from '@microsoft/fast-element';
10
9
  import { Constructable } from '@microsoft/fast-element';
11
10
  import { ExecutionContext } from '@microsoft/fast-element';
12
11
  import { FASTElement } from '@microsoft/fast-element';
13
- import { HTMLDirective } from '@microsoft/fast-element';
14
- import { ViewBehaviorTargets } from '@microsoft/fast-element';
12
+ import { ViewBehavior } from '@microsoft/fast-element';
13
+ import { ViewBehaviorFactory } from '@microsoft/fast-element';
14
+ import { ViewController } from '@microsoft/fast-element';
15
15
  import { ViewTemplate } from '@microsoft/fast-element';
16
16
 
17
17
  // Warning: (ae-internal-missing-underscore) The name "childRouteParameter" should be prefixed with an underscore because the declaration is marked as @internal
@@ -152,7 +152,7 @@ export type FASTElementConstructor = new () => FASTElement;
152
152
 
153
153
  // @beta (undocumented)
154
154
  export class FASTElementLayout implements Layout {
155
- constructor(template?: ViewTemplate | null, styles?: ComposableStyles | ComposableStyles[] | null, runBeforeCommit?: boolean);
155
+ constructor(template?: ViewTemplate | null, styles?: ComposableStyles | ComposableStyles[] | undefined, runBeforeCommit?: boolean);
156
156
  // (undocumented)
157
157
  afterCommit(routerElement: HTMLElement): Promise<void>;
158
158
  // (undocumented)
@@ -582,20 +582,17 @@ export interface RouterElement extends HTMLElement {
582
582
 
583
583
  // @beta (undocumented)
584
584
  export type RouterExecutionContext = ExecutionContext & {
585
- router: Router;
585
+ router?: Router;
586
586
  };
587
587
 
588
- // @beta (undocumented)
589
- export const RouterExecutionContext: Readonly<{
590
- create(router: Router): any;
591
- }>;
592
-
593
588
  // @beta (undocumented)
594
589
  export interface RouteView {
595
590
  // (undocumented)
596
591
  appendTo(host: HTMLElement): void;
597
592
  // (undocumented)
598
- bind(allTypedParams: Readonly<Record<string, any>>, context: RouterExecutionContext): void;
593
+ bind(allTypedParams: Readonly<Record<string, any>>): void;
594
+ // (undocumented)
595
+ context: RouterExecutionContext;
599
596
  // (undocumented)
600
597
  dispose(): void;
601
598
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@microsoft/fast-router",
3
3
  "description": "A web-components-based router.",
4
4
  "sideEffects": false,
5
- "version": "1.0.0-alpha.1",
5
+ "version": "1.0.0-alpha.10",
6
6
  "author": {
7
7
  "name": "Microsoft",
8
8
  "url": "https://discord.gg/FcSNfg4"
@@ -18,7 +18,7 @@
18
18
  "url": "https://github.com/Microsoft/fast/issues/new/choose"
19
19
  },
20
20
  "main": "dist/esm/index.js",
21
- "types": "dist/fast-router.d.ts",
21
+ "types": "dist/dts/index.d.ts",
22
22
  "type": "module",
23
23
  "unpkg": "dist/fast-router.min.js",
24
24
  "scripts": {
@@ -80,6 +80,6 @@
80
80
  "webpack-cli": "^4.9.2"
81
81
  },
82
82
  "dependencies": {
83
- "@microsoft/fast-element": "^2.0.0-beta.1"
83
+ "@microsoft/fast-element": "^2.0.0-beta.10"
84
84
  }
85
85
  }