@microsoft/fast-router 1.0.0-alpha.19 → 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,33 @@
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
+ },
4
31
  {
5
32
  "date": "Fri, 02 Dec 2022 01:18:22 GMT",
6
33
  "tag": "@microsoft/fast-router_v1.0.0-alpha.19",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,19 @@
1
1
  # Change Log - @microsoft/fast-router
2
2
 
3
- This log was last generated on Fri, 02 Dec 2022 01:18:22 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
+
7
17
  ## 1.0.0-alpha.19
8
18
 
9
19
  Fri, 02 Dec 2022 01:18:22 GMT
@@ -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
  */
@@ -45,8 +45,9 @@ 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();
@@ -1,6 +1,8 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { QueryString } from "./query-string.js";
3
- const defaultParameterConverter = (value) => value;
3
+ const defaultParameterConverter = (name, value, context) => {
4
+ return value;
5
+ };
4
6
  /**
5
7
  * @beta
6
8
  */
@@ -35,7 +37,7 @@ export class RecognizedRoute {
35
37
  this.typedParams = typedParams;
36
38
  this.queryParams = queryParams;
37
39
  this.allParams = Object.assign(Object.assign({}, params), queryParams);
38
- this.allTypedParams = Object.assign(Object.assign({}, typedParams), queryParams);
40
+ this.allTypedParams = Object.assign(Object.assign({}, queryParams), typedParams);
39
41
  }
40
42
  get settings() {
41
43
  return this.endpoint.settings;
@@ -386,12 +388,17 @@ export class DefaultRouteRecognizer {
386
388
  const paramTypes = endpoint.paramTypes;
387
389
  const params = candidate.getParams();
388
390
  const typedParams = {};
391
+ const converterContext = {
392
+ endpoint,
393
+ params,
394
+ typedParams,
395
+ queryParams,
396
+ };
389
397
  for (let i = 0, ii = paramNames.length; i < ii; ++i) {
390
- const name = paramNames[i];
398
+ const paramName = paramNames[i];
399
+ const paramValue = params[paramName];
391
400
  const convert = converters[paramTypes[i]] || defaultParameterConverter;
392
- const untypedValue = params[name];
393
- const typedValue = yield convert(untypedValue);
394
- typedParams[name] = typedValue;
401
+ typedParams[paramName] = yield convert(paramName, paramValue, converterContext);
395
402
  }
396
403
  return new RecognizedRoute(endpoint, params, typedParams, queryParams);
397
404
  });
@@ -31,13 +31,20 @@ export const Router = Object.freeze({
31
31
  class RouterBase extends BaseType {
32
32
  constructor() {
33
33
  super();
34
- Router.getOrCreateFor(this);
35
- }
36
- get config() {
37
- return this[routerProperty].config;
38
- }
39
- set config(value) {
40
- this[routerProperty].config = value;
34
+ const router = Router.getOrCreateFor(this);
35
+ const config = this.config || null;
36
+ delete this.config;
37
+ Reflect.defineProperty(this, "config", {
38
+ get() {
39
+ return router.config;
40
+ },
41
+ set(value) {
42
+ router.config = value;
43
+ },
44
+ });
45
+ if (config !== null) {
46
+ router.config = config;
47
+ }
41
48
  }
42
49
  }
43
50
  const proto = RouterBase.prototype;
@@ -113,7 +120,7 @@ export class DefaultRouter {
113
120
  }
114
121
  this.parentRouter = findParentRouterForElement(this.host);
115
122
  }
116
- return this.parentRouter || null;
123
+ return this.parentRouter;
117
124
  }
118
125
  get level() {
119
126
  if (this.parent === null) {
@@ -17,7 +17,7 @@ function getFallbackCommand(config, definition) {
17
17
  return Render.fromDefinition(config, definition);
18
18
  }
19
19
  }
20
- const booleanConverter = value => {
20
+ const booleanConverter = (name, value) => {
21
21
  if (value === void 0 || value === null) {
22
22
  return false;
23
23
  }
@@ -31,11 +31,11 @@ const booleanConverter = value => {
31
31
  }
32
32
  };
33
33
  const defaultConverters = {
34
- number: value => (value === void 0 ? NaN : parseFloat(value)),
35
- float: value => (value === void 0 ? NaN : parseFloat(value)),
36
- int: value => (value === void 0 ? NaN : parseInt(value)),
37
- integer: value => (value === void 0 ? NaN : parseInt(value)),
38
- Date: value => (value === void 0 ? new Date(Date.now()) : new Date(value)),
34
+ number: (name, value) => (value === void 0 ? NaN : parseFloat(value)),
35
+ float: (name, value) => (value === void 0 ? NaN : parseFloat(value)),
36
+ int: (name, value) => (value === void 0 ? NaN : parseInt(value)),
37
+ integer: (name, value) => (value === void 0 ? NaN : parseInt(value)),
38
+ Date: (name, value) => value === void 0 ? new Date(Date.now()) : new Date(value),
39
39
  boolean: booleanConverter,
40
40
  bool: booleanConverter,
41
41
  };
@@ -129,9 +129,9 @@ export class RouteCollection {
129
129
  normalizedConverter = converter.convert.bind(converter);
130
130
  }
131
131
  else if (converter.prototype && "convert" in converter.prototype) {
132
- normalizedConverter = (value) => {
132
+ normalizedConverter = (name, value, context) => {
133
133
  const obj = this.owner.construct(converter);
134
- return obj.convert(value);
134
+ return obj.convert(name, value, context);
135
135
  };
136
136
  }
137
137
  else {
@@ -461,40 +461,6 @@
461
461
  "endIndex": 2
462
462
  }
463
463
  },
464
- {
465
- "kind": "TypeAlias",
466
- "canonicalReference": "@microsoft/fast-router!ConverterObject:type",
467
- "docComment": "/**\n * @beta\n */\n",
468
- "excerptTokens": [
469
- {
470
- "kind": "Content",
471
- "text": "export declare type ConverterObject = "
472
- },
473
- {
474
- "kind": "Content",
475
- "text": "{\n convert: "
476
- },
477
- {
478
- "kind": "Reference",
479
- "text": "RouteParameterConverter",
480
- "canonicalReference": "@microsoft/fast-router!RouteParameterConverter:type"
481
- },
482
- {
483
- "kind": "Content",
484
- "text": ";\n}"
485
- },
486
- {
487
- "kind": "Content",
488
- "text": ";"
489
- }
490
- ],
491
- "releaseTag": "Beta",
492
- "name": "ConverterObject",
493
- "typeTokenRange": {
494
- "startIndex": 1,
495
- "endIndex": 4
496
- }
497
- },
498
464
  {
499
465
  "kind": "Class",
500
466
  "canonicalReference": "@microsoft/fast-router!DefaultLinkHandler:class",
@@ -3674,7 +3640,7 @@
3674
3640
  },
3675
3641
  {
3676
3642
  "kind": "Content",
3677
- "text": "any"
3643
+ "text": "void"
3678
3644
  },
3679
3645
  {
3680
3646
  "kind": "Content",
@@ -4817,8 +4783,8 @@
4817
4783
  },
4818
4784
  {
4819
4785
  "kind": "Reference",
4820
- "text": "ConverterObject",
4821
- "canonicalReference": "@microsoft/fast-router!ConverterObject:type"
4786
+ "text": "RouteParameterConverterObject",
4787
+ "canonicalReference": "@microsoft/fast-router!RouteParameterConverterObject:type"
4822
4788
  },
4823
4789
  {
4824
4790
  "kind": "Content",
@@ -4835,8 +4801,8 @@
4835
4801
  },
4836
4802
  {
4837
4803
  "kind": "Reference",
4838
- "text": "ConverterObject",
4839
- "canonicalReference": "@microsoft/fast-router!ConverterObject:type"
4804
+ "text": "RouteParameterConverterObject",
4805
+ "canonicalReference": "@microsoft/fast-router!RouteParameterConverterObject:type"
4840
4806
  },
4841
4807
  {
4842
4808
  "kind": "Content",
@@ -4999,12 +4965,12 @@
4999
4965
  },
5000
4966
  {
5001
4967
  "kind": "Reference",
5002
- "text": "Object",
5003
- "canonicalReference": "!Object:interface"
4968
+ "text": "Record",
4969
+ "canonicalReference": "!Record:type"
5004
4970
  },
5005
4971
  {
5006
4972
  "kind": "Content",
5007
- "text": ", traditional?: boolean): string;\n separate(path: string): "
4973
+ "text": "<string, string>, traditional?: boolean): string;\n separate(path: string): "
5008
4974
  },
5009
4975
  {
5010
4976
  "kind": "Reference",
@@ -7187,7 +7153,16 @@
7187
7153
  },
7188
7154
  {
7189
7155
  "kind": "Content",
7190
- "text": "(value: string | undefined) => any | "
7156
+ "text": "(name: string, value: string | undefined, context: "
7157
+ },
7158
+ {
7159
+ "kind": "Reference",
7160
+ "text": "RouteParameterConverterContext",
7161
+ "canonicalReference": "@microsoft/fast-router!RouteParameterConverterContext:interface"
7162
+ },
7163
+ {
7164
+ "kind": "Content",
7165
+ "text": ") => any | "
7191
7166
  },
7192
7167
  {
7193
7168
  "kind": "Reference",
@@ -7205,6 +7180,210 @@
7205
7180
  ],
7206
7181
  "releaseTag": "Beta",
7207
7182
  "name": "RouteParameterConverter",
7183
+ "typeTokenRange": {
7184
+ "startIndex": 1,
7185
+ "endIndex": 6
7186
+ }
7187
+ },
7188
+ {
7189
+ "kind": "Interface",
7190
+ "canonicalReference": "@microsoft/fast-router!RouteParameterConverterContext:interface",
7191
+ "docComment": "/**\n * @beta\n */\n",
7192
+ "excerptTokens": [
7193
+ {
7194
+ "kind": "Content",
7195
+ "text": "export interface RouteParameterConverterContext<TSettings = "
7196
+ },
7197
+ {
7198
+ "kind": "Content",
7199
+ "text": "any"
7200
+ },
7201
+ {
7202
+ "kind": "Content",
7203
+ "text": "> "
7204
+ }
7205
+ ],
7206
+ "releaseTag": "Beta",
7207
+ "typeParameters": [
7208
+ {
7209
+ "typeParameterName": "TSettings",
7210
+ "constraintTokenRange": {
7211
+ "startIndex": 0,
7212
+ "endIndex": 0
7213
+ },
7214
+ "defaultTypeTokenRange": {
7215
+ "startIndex": 1,
7216
+ "endIndex": 2
7217
+ }
7218
+ }
7219
+ ],
7220
+ "name": "RouteParameterConverterContext",
7221
+ "members": [
7222
+ {
7223
+ "kind": "PropertySignature",
7224
+ "canonicalReference": "@microsoft/fast-router!RouteParameterConverterContext#endpoint:member",
7225
+ "docComment": "",
7226
+ "excerptTokens": [
7227
+ {
7228
+ "kind": "Content",
7229
+ "text": "readonly endpoint: "
7230
+ },
7231
+ {
7232
+ "kind": "Reference",
7233
+ "text": "Endpoint",
7234
+ "canonicalReference": "@microsoft/fast-router!Endpoint:class"
7235
+ },
7236
+ {
7237
+ "kind": "Content",
7238
+ "text": "<TSettings>"
7239
+ },
7240
+ {
7241
+ "kind": "Content",
7242
+ "text": ";"
7243
+ }
7244
+ ],
7245
+ "isOptional": false,
7246
+ "releaseTag": "Beta",
7247
+ "name": "endpoint",
7248
+ "propertyTypeTokenRange": {
7249
+ "startIndex": 1,
7250
+ "endIndex": 3
7251
+ }
7252
+ },
7253
+ {
7254
+ "kind": "PropertySignature",
7255
+ "canonicalReference": "@microsoft/fast-router!RouteParameterConverterContext#params:member",
7256
+ "docComment": "",
7257
+ "excerptTokens": [
7258
+ {
7259
+ "kind": "Content",
7260
+ "text": "readonly params: "
7261
+ },
7262
+ {
7263
+ "kind": "Reference",
7264
+ "text": "Readonly",
7265
+ "canonicalReference": "!Readonly:type"
7266
+ },
7267
+ {
7268
+ "kind": "Content",
7269
+ "text": "<"
7270
+ },
7271
+ {
7272
+ "kind": "Reference",
7273
+ "text": "Record",
7274
+ "canonicalReference": "!Record:type"
7275
+ },
7276
+ {
7277
+ "kind": "Content",
7278
+ "text": "<string, string | undefined>>"
7279
+ },
7280
+ {
7281
+ "kind": "Content",
7282
+ "text": ";"
7283
+ }
7284
+ ],
7285
+ "isOptional": false,
7286
+ "releaseTag": "Beta",
7287
+ "name": "params",
7288
+ "propertyTypeTokenRange": {
7289
+ "startIndex": 1,
7290
+ "endIndex": 5
7291
+ }
7292
+ },
7293
+ {
7294
+ "kind": "PropertySignature",
7295
+ "canonicalReference": "@microsoft/fast-router!RouteParameterConverterContext#queryParams:member",
7296
+ "docComment": "",
7297
+ "excerptTokens": [
7298
+ {
7299
+ "kind": "Content",
7300
+ "text": "readonly queryParams: "
7301
+ },
7302
+ {
7303
+ "kind": "Reference",
7304
+ "text": "Record",
7305
+ "canonicalReference": "!Record:type"
7306
+ },
7307
+ {
7308
+ "kind": "Content",
7309
+ "text": "<string, string>"
7310
+ },
7311
+ {
7312
+ "kind": "Content",
7313
+ "text": ";"
7314
+ }
7315
+ ],
7316
+ "isOptional": false,
7317
+ "releaseTag": "Beta",
7318
+ "name": "queryParams",
7319
+ "propertyTypeTokenRange": {
7320
+ "startIndex": 1,
7321
+ "endIndex": 3
7322
+ }
7323
+ },
7324
+ {
7325
+ "kind": "PropertySignature",
7326
+ "canonicalReference": "@microsoft/fast-router!RouteParameterConverterContext#typedParams:member",
7327
+ "docComment": "",
7328
+ "excerptTokens": [
7329
+ {
7330
+ "kind": "Content",
7331
+ "text": "readonly typedParams: "
7332
+ },
7333
+ {
7334
+ "kind": "Reference",
7335
+ "text": "Record",
7336
+ "canonicalReference": "!Record:type"
7337
+ },
7338
+ {
7339
+ "kind": "Content",
7340
+ "text": "<string, any>"
7341
+ },
7342
+ {
7343
+ "kind": "Content",
7344
+ "text": ";"
7345
+ }
7346
+ ],
7347
+ "isOptional": false,
7348
+ "releaseTag": "Beta",
7349
+ "name": "typedParams",
7350
+ "propertyTypeTokenRange": {
7351
+ "startIndex": 1,
7352
+ "endIndex": 3
7353
+ }
7354
+ }
7355
+ ],
7356
+ "extendsTokenRanges": []
7357
+ },
7358
+ {
7359
+ "kind": "TypeAlias",
7360
+ "canonicalReference": "@microsoft/fast-router!RouteParameterConverterObject:type",
7361
+ "docComment": "/**\n * @beta\n */\n",
7362
+ "excerptTokens": [
7363
+ {
7364
+ "kind": "Content",
7365
+ "text": "export declare type RouteParameterConverterObject = "
7366
+ },
7367
+ {
7368
+ "kind": "Content",
7369
+ "text": "{\n convert: "
7370
+ },
7371
+ {
7372
+ "kind": "Reference",
7373
+ "text": "RouteParameterConverter",
7374
+ "canonicalReference": "@microsoft/fast-router!RouteParameterConverter:type"
7375
+ },
7376
+ {
7377
+ "kind": "Content",
7378
+ "text": ";\n}"
7379
+ },
7380
+ {
7381
+ "kind": "Content",
7382
+ "text": ";"
7383
+ }
7384
+ ],
7385
+ "releaseTag": "Beta",
7386
+ "name": "RouteParameterConverterObject",
7208
7387
  "typeTokenRange": {
7209
7388
  "startIndex": 1,
7210
7389
  "endIndex": 4
@@ -9032,7 +9211,7 @@
9032
9211
  },
9033
9212
  {
9034
9213
  "kind": "Content",
9035
- "text": "any"
9214
+ "text": "void"
9036
9215
  },
9037
9216
  {
9038
9217
  "kind": "Content",
@@ -9060,7 +9239,7 @@
9060
9239
  },
9061
9240
  {
9062
9241
  "kind": "Content",
9063
- "text": "any"
9242
+ "text": "void"
9064
9243
  },
9065
9244
  {
9066
9245
  "kind": "Content",
@@ -38,13 +38,6 @@ export declare type ContributorOptions = {
38
38
  parameters?: boolean;
39
39
  };
40
40
 
41
- /**
42
- * @beta
43
- */
44
- export declare type ConverterObject = {
45
- convert: RouteParameterConverter;
46
- };
47
-
48
41
  /**
49
42
  * @beta
50
43
  */
@@ -319,7 +312,7 @@ export declare interface NavigationCommand {
319
312
  * @beta
320
313
  */
321
314
  export declare interface NavigationCommitPhase<TSettings = any> extends Omit<NavigationPhase<TSettings>, "cancel" | "canceled" | "onCancel"> {
322
- setTitle(title: string): any;
315
+ setTitle(title: string): void;
323
316
  }
324
317
 
325
318
  /**
@@ -445,7 +438,7 @@ export declare interface NavigationQueue {
445
438
  /**
446
439
  * @beta
447
440
  */
448
- export declare type ParameterConverter = RouteParameterConverter | ConverterObject | Constructable<ConverterObject>;
441
+ export declare type ParameterConverter = RouteParameterConverter | RouteParameterConverterObject | Constructable<RouteParameterConverterObject>;
449
442
 
450
443
  /**
451
444
  * @beta
@@ -471,7 +464,7 @@ export declare const QueryString: Readonly<{
471
464
  * @param traditional - Boolean Use the old URI template standard (RFC6570)
472
465
  * @returns The generated query string, excluding leading '?'.
473
466
  */
474
- build(params: Object, traditional?: boolean): string;
467
+ build(params: Record<string, string>, traditional?: boolean): string;
475
468
  /**
476
469
  * Separate the query string from the path and returns the two parts.
477
470
  * @param path - The path to separate.
@@ -648,7 +641,24 @@ export declare type RouteMatch<TSettings = any> = {
648
641
  /**
649
642
  * @beta
650
643
  */
651
- export declare type RouteParameterConverter = (value: string | undefined) => any | Promise<any>;
644
+ export declare type RouteParameterConverter = (name: string, value: string | undefined, context: RouteParameterConverterContext) => any | Promise<any>;
645
+
646
+ /**
647
+ * @beta
648
+ */
649
+ export declare interface RouteParameterConverterContext<TSettings = any> {
650
+ readonly endpoint: Endpoint<TSettings>;
651
+ readonly params: Readonly<Record<string, string | undefined>>;
652
+ readonly typedParams: Record<string, any>;
653
+ readonly queryParams: Record<string, string>;
654
+ }
655
+
656
+ /**
657
+ * @beta
658
+ */
659
+ export declare type RouteParameterConverterObject = {
660
+ convert: RouteParameterConverter;
661
+ };
652
662
 
653
663
  /**
654
664
  * @beta
@@ -737,8 +747,8 @@ export declare interface RouteRecognizer<TSettings> {
737
747
  export declare interface RouterElement extends HTMLElement {
738
748
  readonly [routerProperty]: Router;
739
749
  config: RouterConfiguration | null;
740
- connectedCallback(): any;
741
- disconnectedCallback(): any;
750
+ connectedCallback(): void;
751
+ disconnectedCallback(): void;
742
752
  }
743
753
 
744
754
  /**
@@ -41,13 +41,6 @@ export declare type ContributorOptions = {
41
41
  parameters?: boolean;
42
42
  };
43
43
 
44
- /**
45
- * @beta
46
- */
47
- export declare type ConverterObject = {
48
- convert: RouteParameterConverter;
49
- };
50
-
51
44
  /**
52
45
  * @beta
53
46
  */
@@ -322,7 +315,7 @@ export declare interface NavigationCommand {
322
315
  * @beta
323
316
  */
324
317
  export declare interface NavigationCommitPhase<TSettings = any> extends Omit<NavigationPhase<TSettings>, "cancel" | "canceled" | "onCancel"> {
325
- setTitle(title: string): any;
318
+ setTitle(title: string): void;
326
319
  }
327
320
 
328
321
  /**
@@ -448,7 +441,7 @@ export declare interface NavigationQueue {
448
441
  /**
449
442
  * @beta
450
443
  */
451
- export declare type ParameterConverter = RouteParameterConverter | ConverterObject | Constructable<ConverterObject>;
444
+ export declare type ParameterConverter = RouteParameterConverter | RouteParameterConverterObject | Constructable<RouteParameterConverterObject>;
452
445
 
453
446
  /**
454
447
  * @beta
@@ -474,7 +467,7 @@ export declare const QueryString: Readonly<{
474
467
  * @param traditional - Boolean Use the old URI template standard (RFC6570)
475
468
  * @returns The generated query string, excluding leading '?'.
476
469
  */
477
- build(params: Object, traditional?: boolean): string;
470
+ build(params: Record<string, string>, traditional?: boolean): string;
478
471
  /**
479
472
  * Separate the query string from the path and returns the two parts.
480
473
  * @param path - The path to separate.
@@ -651,7 +644,24 @@ export declare type RouteMatch<TSettings = any> = {
651
644
  /**
652
645
  * @beta
653
646
  */
654
- export declare type RouteParameterConverter = (value: string | undefined) => any | Promise<any>;
647
+ export declare type RouteParameterConverter = (name: string, value: string | undefined, context: RouteParameterConverterContext) => any | Promise<any>;
648
+
649
+ /**
650
+ * @beta
651
+ */
652
+ export declare interface RouteParameterConverterContext<TSettings = any> {
653
+ readonly endpoint: Endpoint<TSettings>;
654
+ readonly params: Readonly<Record<string, string | undefined>>;
655
+ readonly typedParams: Record<string, any>;
656
+ readonly queryParams: Record<string, string>;
657
+ }
658
+
659
+ /**
660
+ * @beta
661
+ */
662
+ export declare type RouteParameterConverterObject = {
663
+ convert: RouteParameterConverter;
664
+ };
655
665
 
656
666
  /**
657
667
  * @beta
@@ -740,8 +750,8 @@ export declare interface RouteRecognizer<TSettings> {
740
750
  export declare interface RouterElement extends HTMLElement {
741
751
  readonly [routerProperty]: Router;
742
752
  config: RouterConfiguration | null;
743
- connectedCallback(): any;
744
- disconnectedCallback(): any;
753
+ connectedCallback(): void;
754
+ disconnectedCallback(): void;
745
755
  }
746
756
 
747
757
  /**
@@ -42,11 +42,6 @@ export type ContributorOptions = {
42
42
  parameters?: boolean;
43
43
  };
44
44
 
45
- // @beta (undocumented)
46
- export type ConverterObject = {
47
- convert: RouteParameterConverter;
48
- };
49
-
50
45
  // @beta (undocumented)
51
46
  export class DefaultLinkHandler implements LinkHandler {
52
47
  // (undocumented)
@@ -246,7 +241,7 @@ export interface NavigationCommand {
246
241
  // @beta (undocumented)
247
242
  export interface NavigationCommitPhase<TSettings = any> extends Omit<NavigationPhase<TSettings>, "cancel" | "canceled" | "onCancel"> {
248
243
  // (undocumented)
249
- setTitle(title: string): any;
244
+ setTitle(title: string): void;
250
245
  }
251
246
 
252
247
  // @beta (undocumented)
@@ -327,7 +322,7 @@ export interface NavigationQueue {
327
322
  }
328
323
 
329
324
  // @beta (undocumented)
330
- export type ParameterConverter = RouteParameterConverter | ConverterObject | Constructable<ConverterObject>;
325
+ export type ParameterConverter = RouteParameterConverter | RouteParameterConverterObject | Constructable<RouteParameterConverterObject>;
331
326
 
332
327
  // @beta (undocumented)
333
328
  export type ParentRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & LayoutAndTransitionRouteDefinition & {
@@ -340,7 +335,7 @@ export type PathedRouteDefinition<TSettings = any> = SupportsSettings<TSettings>
340
335
  // @beta (undocumented)
341
336
  export const QueryString: Readonly<{
342
337
  readonly current: string;
343
- build(params: Object, traditional?: boolean): string;
338
+ build(params: Record<string, string>, traditional?: boolean): string;
344
339
  separate(path: string): Readonly<{
345
340
  path: string;
346
341
  queryString: string;
@@ -474,7 +469,24 @@ export type RouteMatch<TSettings = any> = {
474
469
  };
475
470
 
476
471
  // @beta (undocumented)
477
- export type RouteParameterConverter = (value: string | undefined) => any | Promise<any>;
472
+ export type RouteParameterConverter = (name: string, value: string | undefined, context: RouteParameterConverterContext) => any | Promise<any>;
473
+
474
+ // @beta (undocumented)
475
+ export interface RouteParameterConverterContext<TSettings = any> {
476
+ // (undocumented)
477
+ readonly endpoint: Endpoint<TSettings>;
478
+ // (undocumented)
479
+ readonly params: Readonly<Record<string, string | undefined>>;
480
+ // (undocumented)
481
+ readonly queryParams: Record<string, string>;
482
+ // (undocumented)
483
+ readonly typedParams: Record<string, any>;
484
+ }
485
+
486
+ // @beta (undocumented)
487
+ export type RouteParameterConverterObject = {
488
+ convert: RouteParameterConverter;
489
+ };
478
490
 
479
491
  // @beta (undocumented)
480
492
  export interface Router<TSettings = any> {
@@ -575,9 +587,9 @@ export interface RouterElement extends HTMLElement {
575
587
  // (undocumented)
576
588
  config: RouterConfiguration | null;
577
589
  // (undocumented)
578
- connectedCallback(): any;
590
+ connectedCallback(): void;
579
591
  // (undocumented)
580
- disconnectedCallback(): any;
592
+ disconnectedCallback(): void;
581
593
  }
582
594
 
583
595
  // @beta (undocumented)
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.19",
5
+ "version": "1.0.0-alpha.20",
6
6
  "author": {
7
7
  "name": "Microsoft",
8
8
  "url": "https://discord.gg/FcSNfg4"
@@ -80,6 +80,6 @@
80
80
  "webpack-cli": "^4.9.2"
81
81
  },
82
82
  "dependencies": {
83
- "@microsoft/fast-element": "^2.0.0-beta.19"
83
+ "@microsoft/fast-element": "^2.0.0-beta.20"
84
84
  }
85
85
  }