@lwrjs/router 0.10.0-alpha.16 → 0.10.0-alpha.18

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.
Files changed (123) hide show
  1. package/build/bundle/prod/lwr/navigation/es/modules/lwr/currentView/currentView.d.ts +2 -3
  2. package/build/bundle/prod/lwr/router/es/modules/lwr/currentView/currentView.d.ts +2 -3
  3. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/currentView/currentView.d.ts +2 -3
  4. package/build/es/modules/lwr/currentPageReference/currentPageReference.d.ts +1 -1
  5. package/build/es/modules/lwr/currentView/currentView.d.ts +2 -2
  6. package/build/es/modules/lwr/domRouter/domRouter.d.ts +2 -2
  7. package/build/es/modules/lwr/domRouterUtils/historyUtils.d.ts +1 -1
  8. package/build/es/modules/lwr/domRouterUtils/types.d.ts +1 -1
  9. package/build/es/modules/lwr/navigationContext/navigationContext.d.ts +2 -2
  10. package/build/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +2 -2
  11. package/build/es/modules/lwr/routerUtils/filterUtils.d.ts +1 -1
  12. package/build/es/modules/lwr/routerUtils/pathToRegexp.d.ts +5 -5
  13. package/build/es/modules/lwr/routerUtils/types.d.ts +24 -24
  14. package/build/modules/lwr/outlet/outlet.html +1 -1
  15. package/package.json +5 -6
  16. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextProvider/contextProvider.d.ts +0 -14
  17. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/contextInfo.d.ts +0 -60
  18. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/contextUtils.d.ts +0 -24
  19. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/navigationApiStore.d.ts +0 -45
  20. package/build/bundle/prod/lwr/navigation/es/modules/lwr/currentPageReference/currentPageReference.d.ts +0 -9
  21. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouter/domRouter.d.ts +0 -192
  22. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +0 -4
  23. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/historyUtils.d.ts +0 -21
  24. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/types.d.ts +0 -16
  25. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/uriUtils.d.ts +0 -30
  26. package/build/bundle/prod/lwr/navigation/es/modules/lwr/historyRouter/historyRouter.d.ts +0 -48
  27. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigation.d.ts +0 -16
  28. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigationApi.d.ts +0 -22
  29. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigationMixin.d.ts +0 -15
  30. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigationContext/navigationContext.d.ts +0 -5
  31. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +0 -7
  32. package/build/bundle/prod/lwr/navigation/es/modules/lwr/observable/observable.d.ts +0 -14
  33. package/build/bundle/prod/lwr/navigation/es/modules/lwr/outlet/outlet.d.ts +0 -19
  34. package/build/bundle/prod/lwr/navigation/es/modules/lwr/router/router.d.ts +0 -11
  35. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerBridge/routerBridge.d.ts +0 -13
  36. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerContainer/routerContainer.d.ts +0 -51
  37. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerContainer/utils.d.ts +0 -32
  38. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerErrors/routerErrors.d.ts +0 -13
  39. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/domUtils.d.ts +0 -2
  40. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/filterUtils.d.ts +0 -19
  41. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/parseUtils.d.ts +0 -42
  42. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/pathToRegexp.d.ts +0 -128
  43. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routeDefUtils.d.ts +0 -43
  44. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routeUtils.d.ts +0 -39
  45. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routerUtils.d.ts +0 -22
  46. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/typeUtils.d.ts +0 -38
  47. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/types.d.ts +0 -133
  48. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/uriUtils.d.ts +0 -66
  49. package/build/bundle/prod/lwr/navigation/es/services/index.d.ts +0 -28
  50. package/build/bundle/prod/lwr/navigation/es/services/module-provider/index.d.ts +0 -22
  51. package/build/bundle/prod/lwr/navigation/es/services/module-provider/utils.d.ts +0 -27
  52. package/build/bundle/prod/lwr/router/es/modules/lwr/contextProvider/contextProvider.d.ts +0 -14
  53. package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/contextInfo.d.ts +0 -60
  54. package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/contextUtils.d.ts +0 -24
  55. package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/navigationApiStore.d.ts +0 -45
  56. package/build/bundle/prod/lwr/router/es/modules/lwr/currentPageReference/currentPageReference.d.ts +0 -9
  57. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouter/domRouter.d.ts +0 -192
  58. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +0 -4
  59. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/historyUtils.d.ts +0 -21
  60. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/types.d.ts +0 -16
  61. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/uriUtils.d.ts +0 -30
  62. package/build/bundle/prod/lwr/router/es/modules/lwr/historyRouter/historyRouter.d.ts +0 -48
  63. package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigation.d.ts +0 -16
  64. package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigationApi.d.ts +0 -22
  65. package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigationMixin.d.ts +0 -15
  66. package/build/bundle/prod/lwr/router/es/modules/lwr/navigationContext/navigationContext.d.ts +0 -5
  67. package/build/bundle/prod/lwr/router/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +0 -7
  68. package/build/bundle/prod/lwr/router/es/modules/lwr/observable/observable.d.ts +0 -14
  69. package/build/bundle/prod/lwr/router/es/modules/lwr/outlet/outlet.d.ts +0 -19
  70. package/build/bundle/prod/lwr/router/es/modules/lwr/router/router.d.ts +0 -11
  71. package/build/bundle/prod/lwr/router/es/modules/lwr/routerBridge/routerBridge.d.ts +0 -13
  72. package/build/bundle/prod/lwr/router/es/modules/lwr/routerContainer/routerContainer.d.ts +0 -51
  73. package/build/bundle/prod/lwr/router/es/modules/lwr/routerContainer/utils.d.ts +0 -32
  74. package/build/bundle/prod/lwr/router/es/modules/lwr/routerErrors/routerErrors.d.ts +0 -13
  75. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/domUtils.d.ts +0 -2
  76. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/filterUtils.d.ts +0 -19
  77. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/parseUtils.d.ts +0 -42
  78. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/pathToRegexp.d.ts +0 -128
  79. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routeDefUtils.d.ts +0 -43
  80. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routeUtils.d.ts +0 -39
  81. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routerUtils.d.ts +0 -22
  82. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/typeUtils.d.ts +0 -38
  83. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/types.d.ts +0 -133
  84. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/uriUtils.d.ts +0 -66
  85. package/build/bundle/prod/lwr/router/es/services/index.d.ts +0 -28
  86. package/build/bundle/prod/lwr/router/es/services/module-provider/index.d.ts +0 -22
  87. package/build/bundle/prod/lwr/router/es/services/module-provider/utils.d.ts +0 -27
  88. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextProvider/contextProvider.d.ts +0 -14
  89. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/contextInfo.d.ts +0 -60
  90. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/contextUtils.d.ts +0 -24
  91. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/navigationApiStore.d.ts +0 -45
  92. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/currentPageReference/currentPageReference.d.ts +0 -9
  93. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouter/domRouter.d.ts +0 -192
  94. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +0 -4
  95. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/historyUtils.d.ts +0 -21
  96. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/types.d.ts +0 -16
  97. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/uriUtils.d.ts +0 -30
  98. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/historyRouter/historyRouter.d.ts +0 -48
  99. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigation.d.ts +0 -16
  100. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigationApi.d.ts +0 -22
  101. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigationMixin.d.ts +0 -15
  102. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigationContext/navigationContext.d.ts +0 -5
  103. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +0 -7
  104. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/observable/observable.d.ts +0 -14
  105. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/outlet/outlet.d.ts +0 -19
  106. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/router/router.d.ts +0 -11
  107. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerBridge/routerBridge.d.ts +0 -13
  108. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerContainer/routerContainer.d.ts +0 -51
  109. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerContainer/utils.d.ts +0 -32
  110. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerErrors/routerErrors.d.ts +0 -13
  111. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/domUtils.d.ts +0 -2
  112. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/filterUtils.d.ts +0 -19
  113. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/parseUtils.d.ts +0 -42
  114. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/pathToRegexp.d.ts +0 -128
  115. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routeDefUtils.d.ts +0 -43
  116. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routeUtils.d.ts +0 -39
  117. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routerUtils.d.ts +0 -22
  118. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/typeUtils.d.ts +0 -38
  119. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/types.d.ts +0 -133
  120. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/uriUtils.d.ts +0 -66
  121. package/build/bundle/prod/lwr/routerContainer/es/services/index.d.ts +0 -28
  122. package/build/bundle/prod/lwr/routerContainer/es/services/module-provider/index.d.ts +0 -22
  123. package/build/bundle/prod/lwr/routerContainer/es/services/module-provider/utils.d.ts +0 -27
@@ -1,42 +0,0 @@
1
- import type { CompiledRouteDefinition, RouterSerializationConfig } from 'lwr/routerUtils';
2
- import type { QueryObject, CompiledQuery, QueryMatcher } from './types';
3
- /**
4
- * Parse the route definitions with path-to-regex functionality for paths, and
5
- * query parameter validation
6
- *
7
- * @example
8
- * {
9
- * original: the user-defined route definition
10
- * regex: regular expression based on the route definition path
11
- * toPath: function which takes an object of parameters and creates a path
12
- * params: an array of objects with info on each path parameter
13
- * compiledQuery: an object that represents defined routeDefintion query params
14
- * queryMatcher: a function that can be used to see if this route defintion
15
- * mataches against a given input QueryObject
16
- * }
17
- */
18
- export declare function parseRoutes<TAddress>(config: RouterSerializationConfig<TAddress>): CompiledRouteDefinition[];
19
- /**
20
- * Converts a QueryObject create from the routeDefintion.uri, and converts it into a
21
- * CompiledQuery object that represents the defined 1) queryStringKeys, 2) routeParameter name,
22
- * and 3) and what input is valid for this query. e.g.,
23
- *
24
- * Given the following uri: /path?someKey=:qParam, then "someKey" is the queryStringKey, ":qParam"
25
- * is the route parameter name, and any input would be valid.
26
- *
27
- * @param {QueryObject} queryObject - queryObject retrieved from the routeDefinition uri
28
- * @returns {CompiledQuery} - CompiledQuery
29
- */
30
- export declare function compileQueryObject(queryObject: QueryObject): CompiledQuery;
31
- /**
32
- * Takes a CompiledQuery a returns a QueryMatcher function that will match a QueryObject
33
- * against the CompiledQuery and returns either a MatchedQuery, representing all the
34
- * input values that match the CompiledQuery, or null if any input query parameter
35
- * doesn't match the CompiledQuery.
36
- *
37
- * @param compiledQuery - CompiledQuery object to use to create the matcher
38
- * @param {boolean} caseSensitive - true if this should case-sensitive match query values
39
- * @returns {QueryMatcher} - The queryMatcher function
40
- */
41
- export declare function getQueryMatcher(compiledQuery: CompiledQuery, caseSensitive?: boolean): QueryMatcher;
42
- //# sourceMappingURL=parseUtils.d.ts.map
@@ -1,128 +0,0 @@
1
- export interface ParseOptions {
2
- /**
3
- * Set the default delimiter for repeat parameters. (default: `'/'`)
4
- */
5
- delimiter?: string;
6
- /**
7
- * List of characters to automatically consider prefixes when parsing.
8
- */
9
- prefixes?: string;
10
- }
11
- /**
12
- * Parse a string for the raw tokens.
13
- */
14
- export declare function parse(str: string, options?: ParseOptions): Token[];
15
- export interface TokensToFunctionOptions {
16
- /**
17
- * When `true` the regexp will be case sensitive. (default: `false`)
18
- */
19
- sensitive?: boolean;
20
- /**
21
- * Function for encoding input strings for output.
22
- */
23
- encode?: (value: string, token: Key) => string;
24
- /**
25
- * When `false` the function can produce an invalid (unmatched) path. (default: `true`)
26
- */
27
- validate?: boolean;
28
- }
29
- export declare type PathFunction<P extends object = object> = (data?: P) => string;
30
- /**
31
- * Expose a method for transforming tokens into the path function.
32
- */
33
- export declare function tokensToFunction<P extends object = object>(tokens: Token[], options?: TokensToFunctionOptions): PathFunction<P>;
34
- /**
35
- * Compile a string to a template function for the path.
36
- */
37
- export declare function compile<P extends object = object>(str: string, options?: ParseOptions & TokensToFunctionOptions): PathFunction<P>;
38
- export interface RegexpToFunctionOptions {
39
- /**
40
- * Function for decoding strings for params.
41
- */
42
- decode?: (value: string, token: Key) => string;
43
- }
44
- /**
45
- * A match result contains data about the path match.
46
- */
47
- export interface MatchResult<P extends object = object> {
48
- path: string;
49
- index: number;
50
- params: P;
51
- }
52
- /**
53
- * A match is either `false` (no match) or a match result.
54
- */
55
- export declare type Match<P extends object = object> = false | MatchResult<P>;
56
- /**
57
- * The match function takes a string and returns whether it matched the path.
58
- */
59
- export declare type MatchFunction<P extends object = object> = (path: string) => Match<P>;
60
- /**
61
- * Create a path match function from `path-to-regexp` output.
62
- */
63
- export declare function regexpToFunction<P extends object = object>(re: RegExp, keys: Key[], options?: RegexpToFunctionOptions): MatchFunction<P>;
64
- /**
65
- * Metadata about a key.
66
- */
67
- export interface Key {
68
- name: string | number;
69
- prefix: string;
70
- suffix: string;
71
- pattern: string;
72
- modifier: string;
73
- }
74
- /**
75
- * A token is a string (nothing special) or key metadata (capture group).
76
- */
77
- export declare type Token = string | Key;
78
- export interface TokensToRegexpOptions {
79
- /**
80
- * When `true` the regexp will be case sensitive. (default: `false`)
81
- */
82
- sensitive?: boolean;
83
- /**
84
- * When `true` the regexp won't allow an optional trailing delimiter to match. (default: `false`)
85
- */
86
- strict?: boolean;
87
- /**
88
- * When `true` the regexp will match to the end of the string. (default: `true`)
89
- */
90
- end?: boolean;
91
- /**
92
- * When `true` the regexp will match from the beginning of the string. (default: `true`)
93
- */
94
- start?: boolean;
95
- /**
96
- * Sets the final character for non-ending optimistic matches. (default: `/`)
97
- */
98
- delimiter?: string;
99
- /**
100
- * List of characters that can also be "end" characters.
101
- */
102
- endsWith?: string;
103
- /**
104
- * Encode path tokens for use in the `RegExp`.
105
- */
106
- encode?: (value: string) => string;
107
- }
108
- /**
109
- * Expose a function for taking tokens and returning a RegExp.
110
- */
111
- export declare function tokensToRegexp(tokens: Token[], keys?: Key[], options?: TokensToRegexpOptions): RegExp;
112
- /**
113
- * Supported `path-to-regexp` input types.
114
- */
115
- export declare type Path = string | RegExp | Array<string | RegExp>;
116
- /**
117
- * Normalize the given path string, returning a regular expression.
118
- *
119
- * An empty array can be passed in for the keys, which will hold the
120
- * placeholder key descriptions. For example, using `/user/:id`, `keys` will
121
- * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
122
- */
123
- export declare function pathToRegexp(path: Path, keys?: Key[], options?: TokensToRegexpOptions & ParseOptions): RegExp;
124
- /**
125
- * Create path match function from `path-to-regexp` spec.
126
- */
127
- export declare function match<P extends object = object>(str: Path, options?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions): MatchFunction<P>;
128
- //# sourceMappingURL=pathToRegexp.d.ts.map
@@ -1,43 +0,0 @@
1
- /**
2
- * Copyright (c) 2019, salesforce.com, inc.
3
- * All rights reserved.
4
- * SPDX-License-Identifier: MIT
5
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
- */
7
- import type { CompiledRouteDefinition, PageReference, StringAttributes, QueryObject, NullableStringAttributes } from './types';
8
- /**
9
- * f(route, routes[]) -> RouteDef
10
- * Match a route's id to a Route Definition id from the given list.
11
- *
12
- * @param {object} route - Route to match to a Route Definition
13
- * @param {array[object]} routeDefs - List of Route Definitions to match to the url
14
- *
15
- * @returns {object | null}
16
- */
17
- export declare function matchRouteDefinitionByPageReference(pageReference: PageReference, routeDefs: CompiledRouteDefinition[]): CompiledRouteDefinition | null;
18
- /**
19
- * Returns an object of paramName->pathValue pairs based on the given path string
20
- * and the params defined within the routeDef uri
21
- * @param path
22
- * @param routeDef
23
- */
24
- export declare function getPathParams(path: string, routeDef: CompiledRouteDefinition): StringAttributes | null;
25
- /**
26
- * Returns an object of paramName->queryValue pairs based on the given queryObject
27
- * and bindings defined within the routeDef uri
28
- * @param queryObj
29
- * @param routeDef
30
- */
31
- export declare function getQueryParams(queryObj: QueryObject, routeDef: CompiledRouteDefinition): NullableStringAttributes | null;
32
- /**
33
- * f(path, routeDef) -> { "attr1": "one", "attr2": "two" }
34
- * Parse a path into an object of attributes based on the Route Definition's parameterized path.
35
- * URI decode the path parts that are parsed as attributes.
36
- *
37
- * @param {string} path - A path (hopefully) matching the Route Definition
38
- * @param {object} routeDef - Route Definition containing the path to parameterize
39
- *
40
- * @returns {object}
41
- */
42
- export declare function getPageReferenceFromUriAndRouteDef(uri: string, routeDef: CompiledRouteDefinition): PageReference | null;
43
- //# sourceMappingURL=routeDefUtils.d.ts.map
@@ -1,39 +0,0 @@
1
- /**
2
- * Copyright (c) 2019, salesforce.com, inc.
3
- * All rights reserved.
4
- * SPDX-License-Identifier: MIT
5
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
- */
7
- import type { CompiledRouteDefinition, CompiledRoutingMatch, PageReference } from './types';
8
- /**
9
- * f(URL, routes[]?) -> route
10
- * Match a URL's path to a Route Definition, use these to build a route.
11
- *
12
- * @param {string} url - URL string to turn into a route
13
- * @param {array[object]} routeDefs - List of Route Definitions to match to the url
14
- * @param {string} basePath - Optional: if provided, remove the base path before conversion.
15
- *
16
- * @returns {object}
17
- */
18
- export declare function matchRouteByUrl(url: string, routeDefs: CompiledRouteDefinition[], basePath?: string): CompiledRoutingMatch | null;
19
- /**
20
- * Serializes the given pageReference into a url based on the first route definition
21
- * with a binding the pageReference matches against.
22
- * @param pageReference pageReference to serialize into url
23
- * @param routeDefs RouteDefs to match pageReference against
24
- * @param basePath Base path for the url
25
- * @returns the url or null if no match
26
- */
27
- export declare function getUrlFromPageReference(pageReference: PageReference, routeDefs: CompiledRouteDefinition[], basePath?: string): string | null;
28
- /**
29
- * Generates a url for the given pageReference using the given routeDef
30
- * @param pageReference pageReference to serialize
31
- * @param routeDef routeDef to that defines how serialize the given pageReference
32
- * @returns url for the given pageReference
33
- */
34
- export declare function getUrlFromPageReferenceAndRouteDef(pageReference: PageReference, routeDef: CompiledRouteDefinition, basePath?: string): string;
35
- /**
36
- * Obtains the pageReference for the given URL
37
- */
38
- export declare function getPageReferenceFromUrl(url: string, routeDefs: CompiledRouteDefinition[], basePath?: string): PageReference | null;
39
- //# sourceMappingURL=routeUtils.d.ts.map
@@ -1,22 +0,0 @@
1
- /**
2
- * Copyright (c) 2019, salesforce.com, inc.
3
- * All rights reserved.
4
- * SPDX-License-Identifier: MIT
5
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
- */
7
- export { createFilterChain } from './filterUtils';
8
- export { getPageReferenceFromUriAndRouteDef } from './routeDefUtils';
9
- export { getUrlFromPageReference, getPageReferenceFromUrl, matchRouteByUrl, getUrlFromPageReferenceAndRouteDef, } from './routeUtils';
10
- export { isObject, freeze, guid, isValidRoute } from './typeUtils';
11
- export { parseRoutes } from './parseUtils';
12
- import { pathToRegexp as ptr, compile as ptrCompile } from './pathToRegexp';
13
- export declare const pathToRegexp: {
14
- pathToRegexp: typeof ptr;
15
- compile: typeof ptrCompile;
16
- };
17
- export { getPathFromUrl, getQueryFromUrl, getQueryString, encode, decode } from './uriUtils';
18
- export { hasDocument } from './domUtils';
19
- export type { Key } from './pathToRegexp';
20
- export type { Filter, FilterChain } from './filterUtils';
21
- export type { CompiledRouteDefinition, CompiledRoutingMatch, Constructor, Constructable, MessageObject, Module, PageReference, RouteCallback, RouteDefinition, RouteHandler, RouteHandlerCallback, RouteHandlerClass, RouteHandlerModule, Router, RouterConfig, RouteDestination, RouteInstance, RoutingMatch, RoutingResult, StringAttributes, UrlMapper, ViewSet, ViewInfo, RouterSerializationConfig, } from './types';
22
- //# sourceMappingURL=routerUtils.d.ts.map
@@ -1,38 +0,0 @@
1
- /**
2
- * Copyright (c) 2019, salesforce.com, inc.
3
- * All rights reserved.
4
- * SPDX-License-Identifier: MIT
5
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
- */
7
- /**
8
- * @param {*} o - Item to check if it's an object
9
- * @returns {boolean}
10
- */
11
- export declare function isObject(o: unknown): boolean;
12
- /**
13
- * true if input is string
14
- * @param o
15
- */
16
- export declare function isString(o: unknown): boolean;
17
- /**
18
- * @param {*} o - Object to freeze N layers deep (e.g. { prop: 'p', o: { one: 1, two: 2 } })
19
- */
20
- export declare function freeze(o: object, depthLimit?: number): object;
21
- /**
22
- * Return a 4 character identifier.
23
- */
24
- export declare function guid(): string;
25
- /**
26
- * f(route) -> true/false
27
- *
28
- * @param {*} route - Item to check if it's a valid route
29
- *
30
- * @returns {boolean}
31
- */
32
- export declare function isValidRoute(object: unknown): boolean;
33
- /**
34
- * Returns true if the given object is a valid pageReference.
35
- * @param object
36
- */
37
- export declare function isValidPageReference(object: unknown): boolean;
38
- //# sourceMappingURL=typeUtils.d.ts.map
@@ -1,133 +0,0 @@
1
- import type { Key, PathFunction } from './pathToRegexp';
2
- import type { ContextId } from 'lwr/navigationContext';
3
- import { Unsubscriber } from 'lwr/observable';
4
- export declare type Module = Record<string | symbol | number, unknown>;
5
- export declare type Constructor<T = object> = new (...args: any[]) => T;
6
- export interface Constructable<T = object> {
7
- constructor: Constructor<T>;
8
- }
9
- export declare type UrlMapper<TAddress> = {
10
- generateUrl(address: TAddress): string | null;
11
- parseUrl(url: string): TAddress | null;
12
- };
13
- export declare type RouteMatcher<TAddress> = {
14
- matchRoute(address: TAddress): RoutingMatch | null;
15
- };
16
- export declare type ViewMapper<TAddress> = {
17
- navigate(address: TAddress): void;
18
- subscribe(callback: RouteCallback, replay?: boolean): Unsubscriber;
19
- resolveView(address: TAddress): Promise<RouteDestination>;
20
- contextId?: ContextId;
21
- };
22
- export declare type Router<TAddress = string> = ViewMapper<TAddress> & UrlMapper<TAddress> & RouteMatcher<TAddress>;
23
- export interface DEPRECATED_getRouteFromUrl {
24
- <TAddress>(url: string, defaultImpl: Function): TAddress | null;
25
- }
26
- export interface DEPRECATED_getUrlFromRoute {
27
- <TAddress>(route: TAddress, defaultImpl: Function): string | null;
28
- }
29
- export declare type RouterConfig = {
30
- basePath?: string;
31
- routes?: RouteDefinition[];
32
- caseSensitive?: boolean;
33
- DEPRECATED_getRouteFromUrl?: DEPRECATED_getRouteFromUrl;
34
- DEPRECATED_getUrlFromRoute?: DEPRECATED_getUrlFromRoute;
35
- };
36
- export declare type RouterSerializationConfig<TAddress> = Required<Omit<RouterConfig, 'DEPRECATED_getRouteFromUrl' | 'DEPRECATED_getUrlFromRoute'> & UrlMapper<TAddress>>;
37
- export declare type RouteParameterPatterns = {
38
- [paramName: string]: string;
39
- };
40
- export interface RouteDefinition<TMetadata = Record<string, any>> {
41
- id: string;
42
- uri: string;
43
- patterns?: RouteParameterPatterns;
44
- exact?: boolean;
45
- page: Partial<PageReference>;
46
- handler: () => Promise<RouteHandlerModule>;
47
- metadata?: TMetadata;
48
- }
49
- export declare type PageBindings = {
50
- attributeBindings: NullableStringAttributes;
51
- stateBindings: NullableStringAttributes;
52
- };
53
- declare type CompiledQueryResult = {
54
- literalValue?: string | null;
55
- routeParamName?: string;
56
- };
57
- export declare type CompiledQuery = Record<string, CompiledQueryResult>;
58
- declare type MatchedQueryResult = {
59
- value: string | null;
60
- routeParamName?: string;
61
- };
62
- export declare type MatchedQuery = Record<string, MatchedQueryResult>;
63
- export declare type QueryMatcher = (queryObject: QueryObject) => MatchedQuery | null;
64
- export interface CompiledRouteDefinition {
65
- original: RouteDefinition;
66
- regex: RegExp;
67
- params: Key[];
68
- toPath: PathFunction<object>;
69
- compiledQuery: CompiledQuery;
70
- queryMatcher: QueryMatcher;
71
- }
72
- export declare type RouteHandlerCallback = (routeDestination: RouteDestination) => void;
73
- export declare type RouteHandlerClass = {
74
- new (callback: RouteHandlerCallback): RouteHandler;
75
- };
76
- export declare type RouteHandlerModule = {
77
- default: RouteHandlerClass;
78
- };
79
- export interface RouteInstance {
80
- id: string;
81
- attributes: NullableStringAttributes;
82
- state: NullableStringAttributes;
83
- pageReference: PageReference;
84
- }
85
- export declare type RouteDestination = {
86
- status?: 200 | 404 | 500;
87
- viewset: ViewSet;
88
- error?: Error;
89
- };
90
- export declare type RoutingMatch = {
91
- pathMatch: string;
92
- route: RouteInstance;
93
- routeDefinition: RouteDefinition;
94
- };
95
- export interface CompiledRoutingMatch {
96
- route: RouteInstance;
97
- routeDefinition: CompiledRouteDefinition;
98
- }
99
- export declare type RoutingResult = RoutingMatch & RouteDestination;
100
- export interface ViewSet {
101
- [viewName: string]: (() => Promise<Module>) | ViewInfo;
102
- }
103
- export interface ViewInfo {
104
- module: () => Promise<Module>;
105
- specifier: string;
106
- }
107
- export declare type RouteCallback = (result: RoutingResult) => void;
108
- export interface RouteHandler {
109
- dispose(): void;
110
- update(routeInfo: RouteInstance): void;
111
- }
112
- export interface PageReference {
113
- type: string;
114
- attributes: NullableStringAttributes;
115
- state: NullableStringAttributes;
116
- }
117
- export interface MessageObject {
118
- code: string | number;
119
- message: string;
120
- level: number;
121
- stack?: string;
122
- url?: string;
123
- address?: string;
124
- }
125
- export declare type QueryObject = NullableStringAttributes;
126
- export interface StringAttributes {
127
- [key: string]: string;
128
- }
129
- export interface NullableStringAttributes {
130
- [key: string]: string | null;
131
- }
132
- export {};
133
- //# sourceMappingURL=types.d.ts.map
@@ -1,66 +0,0 @@
1
- /**
2
- * Copyright (c) 2019, salesforce.com, inc.
3
- * All rights reserved.
4
- * SPDX-License-Identifier: MIT
5
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
- */
7
- import type { QueryObject, CompiledQuery } from './types';
8
- /**
9
- * f("one two &") -> "one%20two%20%26"
10
- *
11
- * @param str - String to URI encode
12
- *
13
- * @returns {string}
14
- */
15
- export declare function encode(str?: string): string;
16
- /**
17
- * f("one%20two%20%26") -> "one two &"
18
- *
19
- * @param str - String to URI decode
20
- *
21
- * @returns {string}
22
- */
23
- export declare function decode(str?: string): string;
24
- /**
25
- * f(url) -> "/some/relative/path"
26
- * Output will...
27
- * - always start with '/'
28
- * - not contain query params or fragment
29
- * - akin to window.location.pathname
30
- *
31
- * @param {string} url - URL string to parse for a path
32
- *
33
- * @returns {string}
34
- */
35
- export declare function getPathFromUrl(url: string): string;
36
- /**
37
- * f(url) -> { "param1": "one", "param2": "two", param3: "" }
38
- * Parameters without values get set to an empty string.
39
- *
40
- * @param {string} url - URL string to parse for a query object
41
- *
42
- * @returns {object}
43
- */
44
- export declare function getQueryFromUrl(url: string): QueryObject;
45
- /**
46
- * f({ "param1": "one", "param2": "two", param3: "" }) -> "?param1=one&param2=two&param3"
47
- * Query parameter values, but not keys, get URI encoded.
48
- *
49
- * @param {object} queryObject - Query object to turn into a string
50
- *
51
- * @returns {string}
52
- */
53
- export declare function getQueryString(queryObj?: QueryObject): string;
54
- /**
55
- * Determines if the given string is a paramter name (":paramName")
56
- * @param str string to test
57
- * @returns true if string starts with ":"
58
- */
59
- export declare function isParam(str: string | null | undefined): boolean;
60
- /**
61
- * @param routeParamName - routeParamName from CompiledQueryResult
62
- * @returns the paramName without prefix; or undefined
63
- */
64
- export declare function getParamName(routeParamName: string | undefined | null): string | false;
65
- export declare function getQueryNames(compiledQuery: CompiledQuery): string[];
66
- //# sourceMappingURL=uriUtils.d.ts.map
@@ -1,28 +0,0 @@
1
- export declare const DEFAULT_SCHEMA = "pageReference_v1";
2
- export interface LwrRouterConfig {
3
- basePath?: string;
4
- caseSensitive?: boolean;
5
- routes: LwrConfigRouteDefinition[];
6
- }
7
- export interface LwrConfigRouteDefinition {
8
- id: string;
9
- uri: string;
10
- patterns?: Record<string, string>;
11
- exact?: boolean;
12
- page: Partial<PageReference>;
13
- metadata?: Record<string, any>;
14
- handler?: string;
15
- component?: string;
16
- }
17
- export interface PageReference {
18
- type: string;
19
- attributes: Record<string, string | null>;
20
- state: Record<string, string | null>;
21
- }
22
- export declare function deleteRouterConfigJsonCacheEntry(path: string): void;
23
- /**
24
- * Given a Routes Config path, return the array of Config Route Definitions
25
- * @param path - A path to a Route Config files
26
- */
27
- export declare function getClientRoutes(path: string): LwrRouterConfig | undefined;
28
- //# sourceMappingURL=index.d.ts.map
@@ -1,22 +0,0 @@
1
- import type { AbstractModuleId, ModuleCompiled, ModuleEntry, ModuleProvider, ProviderContext } from '@lwrjs/types';
2
- interface RouterProviderOptions {
3
- routesDir?: string;
4
- }
5
- export default class RouterModuleProvider implements ModuleProvider {
6
- name: string;
7
- version: string;
8
- routesDir: string;
9
- appBasePath?: string;
10
- private routerEmitter;
11
- private routerWatcher?;
12
- private watchedFileMap;
13
- private routerModuleCache;
14
- constructor({ routesDir }: RouterProviderOptions, context: ProviderContext);
15
- onRouterModuleChange(configPath: string, deleted?: boolean): Promise<void>;
16
- private watchConfigs;
17
- private getRouterConfig;
18
- getModuleEntry({ specifier }: AbstractModuleId): Promise<ModuleEntry | undefined>;
19
- getModule(moduleId: AbstractModuleId): Promise<ModuleCompiled | undefined>;
20
- }
21
- export {};
22
- //# sourceMappingURL=index.d.ts.map
@@ -1,27 +0,0 @@
1
- import type { Watcher } from '@lwrjs/types';
2
- import type { LwrRouterConfig } from '../index.js';
3
- import type { WatcherFactory } from '@lwrjs/types';
4
- export declare const SPECIFIER_PREFIX = "@lwrjs/router/";
5
- /**
6
- * Parse a specifier into its Router Config ID
7
- * Return undefined if the specifier is invalid
8
- * @param specifier - The raw specifier to parse
9
- */
10
- export declare function parseSpecifier(specifier: string): string | undefined;
11
- /**
12
- * Given a Router Config ID and directory, return the file path to the router metadata
13
- * @param dir - Path to directory containing Router Config files
14
- * @param specifier - Specifier for the Router Config module
15
- */
16
- export declare function getRouterConfigPath(dir: string, specifier: string): string;
17
- /**
18
- * Set up a file system watcher; used to spy on Router Config file changes
19
- * @param onModuleChange - File change callback function
20
- */
21
- export declare function setUpWatcher(factory: WatcherFactory, onModuleChange: (file: string, deleted?: boolean) => void): Watcher;
22
- /**
23
- * Generate a module string which fulfills a router request
24
- * @param routes - The array of route definitions
25
- */
26
- export declare function generateModule(config?: LwrRouterConfig): string;
27
- //# sourceMappingURL=utils.d.ts.map
@@ -1,14 +0,0 @@
1
- import { Contextualizer } from 'lwc';
2
- import type { ContextualWireAdapter } from 'lwr/contextUtils';
3
- export declare const currentPageReferenceContextualizer: Contextualizer | undefined;
4
- export declare const currentViewContextualizer: Contextualizer | undefined;
5
- export declare const navigationContextContextualizer: Contextualizer | undefined;
6
- /**
7
- *
8
- * @param {TContext} contextValue - Context API object
9
- * @param {EventTarget} providerNode - Context DOM element
10
- * @param {Contextualizer} contextualizer - Function for providing this context to subtree nodes wired to a specific adapter
11
- * @param {ContextualWireAdapter<TContext, TEmit, TConfig>} contextualAdapter - Contextual wire adapter capable of subscribing to context changes
12
- */
13
- export declare function provideContext<TContext, TEmit, TConfig>(contextValue: TContext, providerNode: EventTarget, contextualizer?: Contextualizer, contextualAdapter?: ContextualWireAdapter<TContext, TEmit, TConfig>): void;
14
- //# sourceMappingURL=contextProvider.d.ts.map
@@ -1,60 +0,0 @@
1
- import type { ContextConsumer } from 'lwc';
2
- /**
3
- * Manages context for various providers
4
- */
5
- export declare class ContextInfo<TContext> {
6
- private infoMap;
7
- /**
8
- * The default value to be returned in the absence of a defined context
9
- */
10
- private defaultValue;
11
- constructor(defaultValue: TContext);
12
- /**
13
- * Gets the stored info for a context provider
14
- * @param targetProvider the context provider
15
- */
16
- getInfo(targetProvider: object): {
17
- consumers: Set<ContextConsumer>;
18
- contextValue: TContext;
19
- };
20
- /**
21
- * Set the context value directly associated with the target as a context provider.
22
- *
23
- * @param {Object} targetProvider
24
- * @param {FeatureContext} contextValue
25
- */
26
- setContext(targetProvider: object, contextValue: TContext): void;
27
- /**
28
- * Get the context value directly associated with the target as a context provider.
29
- *
30
- * @param {Object} targetProvider
31
- */
32
- getContext(targetProvider: object): TContext;
33
- /**
34
- * Clear the context value and registered subscribers directly associated with the
35
- * target as a context provider.
36
- *
37
- * @param {Object} targetProvider
38
- */
39
- clearContext(targetProvider: object): void;
40
- /**
41
- * Subscribe a consumer to the context value directly associated with the target as
42
- * a context provider. Calls to #set(targetProvider, contextValue) with the same
43
- * target will invoke the consumer.provide(contextValue) function.
44
- *
45
- * NOTE: Mutations to the contextValue directly do not result in calls to
46
- * consumer.provide(contextValue).
47
- *
48
- * @param {Object} targetProvider
49
- * @param {ContextConsumer} consumer object with a provide(context) function property.
50
- */
51
- subscribeContext(targetProvider: object, consumer: ContextConsumer): void;
52
- /**
53
- * Unsubscribe a previously subscribed consumer from listening to changes on the
54
- * target
55
- * @param {Object} targetProvider
56
- * @param {ContextConsumer} consumer
57
- */
58
- unsubscribeContext(targetProvider: object, consumer: ContextConsumer): void;
59
- }
60
- //# sourceMappingURL=contextInfo.d.ts.map