@lwrjs/router 0.10.0-alpha.12 → 0.10.0-alpha.13

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 (124) hide show
  1. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextProvider/contextProvider.d.ts +14 -0
  2. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/contextInfo.d.ts +60 -0
  3. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/contextUtils.d.ts +24 -0
  4. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/navigationApiStore.d.ts +45 -0
  5. package/build/bundle/prod/lwr/navigation/es/modules/lwr/currentPageReference/currentPageReference.d.ts +9 -0
  6. package/build/bundle/prod/lwr/navigation/es/modules/lwr/currentView/currentView.d.ts +3 -2
  7. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouter/domRouter.d.ts +192 -0
  8. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +4 -0
  9. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/historyUtils.d.ts +21 -0
  10. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/types.d.ts +16 -0
  11. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/uriUtils.d.ts +30 -0
  12. package/build/bundle/prod/lwr/navigation/es/modules/lwr/historyRouter/historyRouter.d.ts +48 -0
  13. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigation.d.ts +16 -0
  14. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigationApi.d.ts +22 -0
  15. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigationMixin.d.ts +15 -0
  16. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigationContext/navigationContext.d.ts +5 -0
  17. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +7 -0
  18. package/build/bundle/prod/lwr/navigation/es/modules/lwr/observable/observable.d.ts +14 -0
  19. package/build/bundle/prod/lwr/navigation/es/modules/lwr/outlet/outlet.d.ts +19 -0
  20. package/build/bundle/prod/lwr/navigation/es/modules/lwr/router/router.d.ts +11 -0
  21. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerBridge/routerBridge.d.ts +13 -0
  22. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerContainer/routerContainer.d.ts +51 -0
  23. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerContainer/utils.d.ts +32 -0
  24. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerErrors/routerErrors.d.ts +13 -0
  25. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/domUtils.d.ts +2 -0
  26. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/filterUtils.d.ts +19 -0
  27. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/parseUtils.d.ts +42 -0
  28. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/pathToRegexp.d.ts +128 -0
  29. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routeDefUtils.d.ts +43 -0
  30. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routeUtils.d.ts +39 -0
  31. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routerUtils.d.ts +22 -0
  32. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/typeUtils.d.ts +38 -0
  33. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/types.d.ts +133 -0
  34. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/uriUtils.d.ts +66 -0
  35. package/build/bundle/prod/lwr/navigation/es/services/index.d.ts +28 -0
  36. package/build/bundle/prod/lwr/navigation/es/services/module-provider/index.d.ts +22 -0
  37. package/build/bundle/prod/lwr/navigation/es/services/module-provider/utils.d.ts +27 -0
  38. package/build/bundle/prod/lwr/navigation/navigation.js +1 -0
  39. package/build/bundle/prod/lwr/router/es/modules/lwr/contextProvider/contextProvider.d.ts +14 -0
  40. package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/contextInfo.d.ts +60 -0
  41. package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/contextUtils.d.ts +24 -0
  42. package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/navigationApiStore.d.ts +45 -0
  43. package/build/bundle/prod/lwr/router/es/modules/lwr/currentPageReference/currentPageReference.d.ts +9 -0
  44. package/build/bundle/prod/lwr/router/es/modules/lwr/currentView/currentView.d.ts +3 -2
  45. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouter/domRouter.d.ts +192 -0
  46. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +4 -0
  47. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/historyUtils.d.ts +21 -0
  48. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/types.d.ts +16 -0
  49. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/uriUtils.d.ts +30 -0
  50. package/build/bundle/prod/lwr/router/es/modules/lwr/historyRouter/historyRouter.d.ts +48 -0
  51. package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigation.d.ts +16 -0
  52. package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigationApi.d.ts +22 -0
  53. package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigationMixin.d.ts +15 -0
  54. package/build/bundle/prod/lwr/router/es/modules/lwr/navigationContext/navigationContext.d.ts +5 -0
  55. package/build/bundle/prod/lwr/router/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +7 -0
  56. package/build/bundle/prod/lwr/router/es/modules/lwr/observable/observable.d.ts +14 -0
  57. package/build/bundle/prod/lwr/router/es/modules/lwr/outlet/outlet.d.ts +19 -0
  58. package/build/bundle/prod/lwr/router/es/modules/lwr/router/router.d.ts +11 -0
  59. package/build/bundle/prod/lwr/router/es/modules/lwr/routerBridge/routerBridge.d.ts +13 -0
  60. package/build/bundle/prod/lwr/router/es/modules/lwr/routerContainer/routerContainer.d.ts +51 -0
  61. package/build/bundle/prod/lwr/router/es/modules/lwr/routerContainer/utils.d.ts +32 -0
  62. package/build/bundle/prod/lwr/router/es/modules/lwr/routerErrors/routerErrors.d.ts +13 -0
  63. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/domUtils.d.ts +2 -0
  64. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/filterUtils.d.ts +19 -0
  65. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/parseUtils.d.ts +42 -0
  66. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/pathToRegexp.d.ts +128 -0
  67. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routeDefUtils.d.ts +43 -0
  68. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routeUtils.d.ts +39 -0
  69. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routerUtils.d.ts +22 -0
  70. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/typeUtils.d.ts +38 -0
  71. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/types.d.ts +133 -0
  72. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/uriUtils.d.ts +66 -0
  73. package/build/bundle/prod/lwr/router/es/services/index.d.ts +28 -0
  74. package/build/bundle/prod/lwr/router/es/services/module-provider/index.d.ts +22 -0
  75. package/build/bundle/prod/lwr/router/es/services/module-provider/utils.d.ts +27 -0
  76. package/build/bundle/prod/lwr/router/router.js +1 -0
  77. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextProvider/contextProvider.d.ts +14 -0
  78. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/contextInfo.d.ts +60 -0
  79. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/contextUtils.d.ts +24 -0
  80. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/navigationApiStore.d.ts +45 -0
  81. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/currentPageReference/currentPageReference.d.ts +9 -0
  82. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/currentView/currentView.d.ts +3 -2
  83. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouter/domRouter.d.ts +192 -0
  84. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +4 -0
  85. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/historyUtils.d.ts +21 -0
  86. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/types.d.ts +16 -0
  87. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/uriUtils.d.ts +30 -0
  88. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/historyRouter/historyRouter.d.ts +48 -0
  89. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigation.d.ts +16 -0
  90. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigationApi.d.ts +22 -0
  91. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigationMixin.d.ts +15 -0
  92. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigationContext/navigationContext.d.ts +5 -0
  93. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +7 -0
  94. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/observable/observable.d.ts +14 -0
  95. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/outlet/outlet.d.ts +19 -0
  96. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/router/router.d.ts +11 -0
  97. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerBridge/routerBridge.d.ts +13 -0
  98. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerContainer/routerContainer.d.ts +51 -0
  99. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerContainer/utils.d.ts +32 -0
  100. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerErrors/routerErrors.d.ts +13 -0
  101. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/domUtils.d.ts +2 -0
  102. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/filterUtils.d.ts +19 -0
  103. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/parseUtils.d.ts +42 -0
  104. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/pathToRegexp.d.ts +128 -0
  105. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routeDefUtils.d.ts +43 -0
  106. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routeUtils.d.ts +39 -0
  107. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routerUtils.d.ts +22 -0
  108. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/typeUtils.d.ts +38 -0
  109. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/types.d.ts +133 -0
  110. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/uriUtils.d.ts +66 -0
  111. package/build/bundle/prod/lwr/routerContainer/es/services/index.d.ts +28 -0
  112. package/build/bundle/prod/lwr/routerContainer/es/services/module-provider/index.d.ts +22 -0
  113. package/build/bundle/prod/lwr/routerContainer/es/services/module-provider/utils.d.ts +27 -0
  114. package/build/bundle/prod/lwr/routerContainer/routerContainer.js +1 -0
  115. package/build/es/modules/lwr/currentPageReference/currentPageReference.d.ts +1 -1
  116. package/build/es/modules/lwr/currentView/currentView.d.ts +2 -2
  117. package/build/es/modules/lwr/domRouter/domRouter.d.ts +2 -2
  118. package/build/es/modules/lwr/domRouterUtils/types.d.ts +1 -1
  119. package/build/es/modules/lwr/navigationContext/navigationContext.d.ts +2 -2
  120. package/build/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +2 -2
  121. package/build/es/modules/lwr/routerUtils/filterUtils.d.ts +1 -1
  122. package/build/es/modules/lwr/routerUtils/pathToRegexp.d.ts +5 -5
  123. package/build/es/modules/lwr/routerUtils/types.d.ts +23 -23
  124. package/package.json +7 -7
@@ -0,0 +1,14 @@
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
@@ -0,0 +1,60 @@
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
@@ -0,0 +1,24 @@
1
+ import type { ContextConsumer } from 'lwc';
2
+ import { ContextInfo } from './contextInfo';
3
+ export { ContextInfo };
4
+ export type { NavigationHelm } from './navigationApiStore';
5
+ export { getNavigationHelm, registerNavigationHelm } from './navigationApiStore';
6
+ export interface WireAdapter<TContext, TConfig, TEmit> {
7
+ _callback(value: TEmit): void;
8
+ update(config: TConfig, context: TContext): void;
9
+ connect(): void;
10
+ disconnect(): void;
11
+ }
12
+ /**
13
+ * Interface for contextual wire adapters to subscribe to context changes
14
+ */
15
+ export interface ContextualWireAdapter<TContext, TConfig, TEmit> {
16
+ new (callback: (value: TEmit) => void): WireAdapter<TContext, TConfig, TEmit>;
17
+ setContext: (targetProvider: globalThis.EventTarget, contextValue: TContext) => void;
18
+ getContext: (targetProvider: globalThis.EventTarget) => TContext;
19
+ clearContext: (targetProvider: globalThis.EventTarget) => void;
20
+ subscribeContext: (targetProvider: globalThis.EventTarget, consumer: ContextConsumer) => void;
21
+ unsubscribeContext: (targetProvider: globalThis.EventTarget, consumer: ContextConsumer) => void;
22
+ }
23
+ export declare function generateContextualWireAdapter<TContext, TConfig = unknown, TEmit = TContext>(contextInstance: ContextInfo<TContext>): ContextualWireAdapter<TContext, TConfig, TEmit>;
24
+ //# sourceMappingURL=contextUtils.d.ts.map
@@ -0,0 +1,45 @@
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 { RouteCallback, PageReference } from 'lwr/router';
8
+ import type { Unsubscriber } from 'lwr/observable';
9
+ import type { ContextId } from 'lwr/navigationContext';
10
+ /**
11
+ * Provides the ability for a given context provider to find its NavigationHelm
12
+ * provider by just an ID. Having access to the NavigationHelm allows the consumer
13
+ * to direct navigation. Generally, the Helm is more powerful than the exposed APIs.
14
+ */
15
+ export interface NavigationHelm {
16
+ navigate: (address: PageReference, replace?: boolean) => void;
17
+ generateUrl: (address: PageReference) => string | null;
18
+ subscribe: (callback: RouteCallback, replay?: boolean) => Unsubscriber;
19
+ }
20
+ interface NavigationContextData {
21
+ id: ContextId;
22
+ value: NavigationHelm;
23
+ update: (newValue: NavigationHelm) => void;
24
+ }
25
+ /**
26
+ * Return a navigation context by ID.
27
+ * Exported API.
28
+ *
29
+ * @param {*} id - The ID of a navigation context.
30
+ *
31
+ * @return {object} - { navigate(), generateUrl(), subscribe() }
32
+ */
33
+ export declare function getNavigationHelm(id: ContextId): NavigationHelm;
34
+ /**
35
+ * Create and return the metadata for this context provider.
36
+ * Cache the metadata by ID.
37
+ *
38
+ * @param {object} contextValue - Context API object
39
+ * @param {RouteDefinition[]} data - Route data for this context
40
+ *
41
+ * @return {object} - The metadata object
42
+ */
43
+ export declare function registerNavigationHelm(contextId: ContextId, contextValue: NavigationHelm): NavigationContextData;
44
+ export {};
45
+ //# sourceMappingURL=navigationApiStore.d.ts.map
@@ -0,0 +1,9 @@
1
+ import type { PageReference } from 'lwr/router';
2
+ declare type PageReferenceContext = PageReference | undefined;
3
+ /**
4
+ * Services @wire(CurrentPageReference) requests.
5
+ * Hooks up to an Observable from the current navigation context.
6
+ */
7
+ export declare const CurrentPageReference: import("lwr/contextUtils").ContextualWireAdapter<PageReferenceContext, unknown, PageReferenceContext>;
8
+ export {};
9
+ //# sourceMappingURL=currentPageReference.d.ts.map
@@ -1,10 +1,11 @@
1
+ /// <reference types="lwc" />
1
2
  import type { ViewSet } from 'lwr/router';
2
3
  import type { Constructable } from 'lwr/routerUtils';
3
- type ViewContext = {
4
+ declare type ViewContext = {
4
5
  viewset: ViewSet;
5
6
  onComplete?: Function;
6
7
  } | undefined;
7
- type CurrentViewConfig = {
8
+ declare type CurrentViewConfig = {
8
9
  viewName?: string;
9
10
  };
10
11
  /**
@@ -0,0 +1,192 @@
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 { RouteChange, DomRouterConfig } from 'lwr/domRouterUtils';
8
+ import type { ContextId } from 'lwr/navigationContext';
9
+ import type { Filter, MessageObject } from 'lwr/routerUtils';
10
+ import type { PageReference, Router, RouteCallback, RoutingMatch, RoutingResult } from 'lwr/router';
11
+ import type { Observable, Unsubscriber } from 'lwr/observable';
12
+ export declare const NAV_EVENT: string;
13
+ export declare const PARENT_EVENT: string;
14
+ interface RouterParent {
15
+ addChild(child: DomRouter): Promise<void>;
16
+ }
17
+ export declare type ParentRouterEvent = CustomEvent<(router: RouterParent) => void>;
18
+ declare type DomRoutingMatch = RoutingMatch & {
19
+ url: string;
20
+ };
21
+ interface DomRouterNode extends RouterParent {
22
+ root: DomRouter;
23
+ parent?: DomRouter;
24
+ child?: DomRouter;
25
+ connected: boolean;
26
+ process(url: string, replace?: boolean): Promise<boolean>;
27
+ processError(messageObject: MessageObject): void;
28
+ preProcess(url: string): Promise<boolean>;
29
+ }
30
+ export interface DomRouter extends DomRouterNode {
31
+ router: Router<PageReference>;
32
+ pendingRoute: DomRoutingMatch | null;
33
+ committedRoute: DomRoutingMatch | null;
34
+ contextId: ContextId;
35
+ historyDisabled?: boolean;
36
+ connect(): void;
37
+ disconnect(): void;
38
+ addPreNavigate(filters: Filter<RouteChange> | Filter<RouteChange>[]): void;
39
+ addErrorNavigate(filters: Filter<MessageObject> | Filter<MessageObject>[]): void;
40
+ navigate(address: PageReference, replace?: boolean): void;
41
+ generateUrl(address: PageReference): string | null;
42
+ subscribe(callback: RouteCallback, replay?: boolean): Unsubscriber;
43
+ }
44
+ export declare class DomRouterImpl implements DomRouter {
45
+ config: Required<DomRouterConfig>;
46
+ target: EventTarget;
47
+ router: Router<PageReference>;
48
+ pendingRoute: DomRoutingMatch | null;
49
+ committedRoute: DomRoutingMatch | null;
50
+ routeObservable: Observable<RoutingResult>;
51
+ eventId?: string;
52
+ contextId: ContextId;
53
+ connected: boolean;
54
+ parent?: DomRouter;
55
+ child?: DomRouter;
56
+ preNavFilters: import("lwr/routerUtils").FilterChain<RouteChange>;
57
+ errorNavFilters: import("lwr/routerUtils").FilterChain<MessageObject>;
58
+ /**
59
+ * Create and configure the Router.
60
+ *
61
+ * @param {object} config - The domRouter config object, all properties are optional
62
+ * @param {object} router - an optional Router
63
+ * @param {HTMLElement} target - DOM node to attach to
64
+ */
65
+ constructor(config: DomRouterConfig, router: Router<PageReference>, target?: EventTarget);
66
+ /**
67
+ * Search up the node chain until the root node is hit
68
+ */
69
+ get root(): DomRouter;
70
+ /**
71
+ * Informs an wire listeners of routing changes/errors
72
+ *
73
+ * @param {RoutingResult} result - result object from navigation event
74
+ * @param {string} url - url from the page reference that triggered the navigation event
75
+ * @param {MessageObject} error - if an error occurred during the navigation
76
+ */
77
+ updateWires(result: RoutingResult, url: string, error?: MessageObject): void;
78
+ /**
79
+ * Override to provide this router as a navigation context
80
+ */
81
+ connect(): void;
82
+ disconnect(): void;
83
+ /**
84
+ * Add listeners to this router hook which run BEFORE a new URL is processed (root -> leaf).
85
+ *
86
+ * @param {object | object[]} filters
87
+ */
88
+ addPreNavigate(filters: Filter<RouteChange> | Filter<RouteChange>[]): void;
89
+ /**
90
+ * Add listeners to this router hook which run when there is an error navigating.
91
+ *
92
+ * @param {object | object[]} filters
93
+ */
94
+ addErrorNavigate(filters: Filter<MessageObject> | Filter<MessageObject>[]): void;
95
+ /**
96
+ * Override parent implementation.
97
+ * Pass the current state down to a new child.
98
+ *
99
+ * @param {child} child - Child router
100
+ */
101
+ addChild(child: DomRouter): Promise<void>;
102
+ /**
103
+ * Process the current URL passed down by the parent router.
104
+ * Stop propagation of the navigation event if a preNavigate filter returns false.
105
+ *
106
+ * Update the current path and route matches.
107
+ * Update the observable to hold the new route.
108
+ *
109
+ * After processing, delegate to a child router, if it exists.
110
+ *
111
+ * @param {string} url - Relative URL string to process
112
+ * @returns {boolean} - True if the processing was NOT blocked by a preNavigate listener
113
+ */
114
+ process(url: string, replace?: boolean): Promise<boolean>;
115
+ /**
116
+ * Run the preNavigate filters for this router.
117
+ * After processing, delegate to a child router, if it exists.
118
+ *
119
+ * @param {string} url - Relative URL string to process,
120
+ * cannot use a route since the processing is done in context
121
+ *
122
+ * @returns {Promise<boolean>} - Resolves to true if successful
123
+ */
124
+ preProcess(url: string): Promise<boolean>;
125
+ /**
126
+ * Run the errorNavigate filters for this router.
127
+ * After processing, delegate to a child router, if it exists.
128
+ *
129
+ * @param {object} e - An error object to pass into the error hook listeners.
130
+ */
131
+ processError(messageObject: MessageObject): void;
132
+ /**
133
+ * lightning/navigation
134
+ * Fire an event to send the navigation event up the DOM.
135
+ * The root router will be the last to catch the event if it is not stopped.
136
+ *
137
+ * @param {object} address - Address to navigate to
138
+ * @param {*} options - Usually a boolean; when true the previous browser history
139
+ * entry should be replaced by this one
140
+ */
141
+ navigate(address: PageReference, replace?: boolean): void;
142
+ /**
143
+ * lightning/navigation
144
+ * Generate a URL based on the given route.
145
+ * Return a Promise containing the URL string.
146
+ *
147
+ * @param {object} route - Route to generate a url for
148
+ *
149
+ * @returns {Promise<string>}
150
+ */
151
+ generateUrl(address: PageReference): string | null;
152
+ /**
153
+ * lightning/navigation
154
+ * Subscribe a callback to the Observable on the current route of this router.
155
+ *
156
+ * @param {function} callback - A callback function invoked when the navigation state changes
157
+ * callback(route, routeDef)
158
+ * @param {boolean} replay - Flag to determine if callback should be called with current route and data immediately
159
+ */
160
+ subscribe(callback: RouteCallback, replay?: boolean): Unsubscriber;
161
+ /**
162
+ * Inspect a navigation event bubbling up from a descendent component.
163
+ * This node can choose to stop the event by returning false.
164
+ * If propagation is not stopped, and this node is the root (no parent),
165
+ * then begin the root -> leaf processing of this new route.
166
+ * This will update the navigation event subscribers in each DomRouter, top down.
167
+ *
168
+ * @param {Event} event - With detail: { url, options }
169
+ */
170
+ private _handleNavigationEvent;
171
+ /**
172
+ * Be discovered as a parent for descendent components.
173
+ * Stop immediate propagation because we only want 1 parent to be found.
174
+ *
175
+ * @param {Event} event - With detail: callback
176
+ */
177
+ private _handleParentEvent;
178
+ private _sendEvent;
179
+ private _stripUrlForChild;
180
+ }
181
+ /**
182
+ * Create a new root Router, attach to the Window.
183
+ * This is the public, programmatic API for root router creation.
184
+ * An application can only have ONE root router.
185
+ *
186
+ * @param {object} config - The router config object
187
+ *
188
+ * @returns {object} - { addPreNavigate, addErrorNavigate, connect, disconnect }
189
+ */
190
+ export declare function createDomRouter(config: DomRouterConfig, router: Router<PageReference>, target?: EventTarget): DomRouter;
191
+ export {};
192
+ //# sourceMappingURL=domRouter.d.ts.map
@@ -0,0 +1,4 @@
1
+ export { getRelativeUrl } from './uriUtils';
2
+ export { set, replace } from './historyUtils';
3
+ export type { DomRouterConfig, NavigationHandler, RouteChange } from './types';
4
+ //# sourceMappingURL=domRouterUtils.d.ts.map
@@ -0,0 +1,21 @@
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 { RouteInstance } from '../routerUtils/types';
8
+ /**
9
+ * Sets a history state.
10
+
11
+ * @param {string} path - query to set
12
+ * @param {object} route - history state object
13
+ */
14
+ export declare function set(path: string, route?: RouteInstance): void;
15
+ /**
16
+ * Replaces the current history state.
17
+ * @param {string} path - query to use as a replacement
18
+ * @param {object} route - history state object
19
+ */
20
+ export declare function replace(path: string, route?: RouteInstance): void;
21
+ //# sourceMappingURL=historyUtils.d.ts.map
@@ -0,0 +1,16 @@
1
+ import type { RoutingMatch, PageReference, StringAttributes } from 'lwr/router';
2
+ export interface RouteChange {
3
+ current?: RoutingMatch;
4
+ next: RoutingMatch;
5
+ }
6
+ export declare type NavigationHandler = (address: PageReference, replace?: boolean) => boolean;
7
+ export interface DomRouterConfig {
8
+ handleNavigation?: NavigationHandler;
9
+ }
10
+ export interface UrlObject {
11
+ href: string;
12
+ origin: string;
13
+ pathname: string;
14
+ searchParams: StringAttributes;
15
+ }
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,30 @@
1
+ import type { UrlObject } from './types';
2
+ /**
3
+ * helper: f(url) -> new URL
4
+ * Query parameter values are URI decoded.
5
+
6
+ * @param {string} url - URL string to turn into a URL object
7
+
8
+ * @returns {object} { href, pathname, searchParams }
9
+
10
+ * @example
11
+ * {
12
+ * href: 'http://localhost:3001/products?lwr.mode=prod&lwr.locale=es#section',
13
+ * origin: 'http://localhost:3001',
14
+ * pathname: '/products',
15
+ * searchParams: {
16
+ * 'lwr.mode': 'prod',
17
+ * 'lwr.locale': 'es'
18
+ * }
19
+ * }
20
+ */
21
+ export declare function getUrlObject(url?: string): UrlObject;
22
+ /**
23
+ * f(url) -> "/some/relative/path?param1=one&param2=two&param3"
24
+
25
+ * @param {string} url - URL string to make relative, may be a no-op
26
+
27
+ * @return {string}
28
+ */
29
+ export declare function getRelativeUrl(url: string): string;
30
+ //# sourceMappingURL=uriUtils.d.ts.map
@@ -0,0 +1,48 @@
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 { DomRouterImpl } from 'lwr/domRouter';
8
+ import type { Router, PageReference } from 'lwr/router';
9
+ import type { DomRouterConfig } from 'lwr/domRouterUtils';
10
+ export declare class HistoryRouter extends DomRouterImpl {
11
+ historyDisabled: boolean;
12
+ /**
13
+ * Override.
14
+ * Initialize with the current route and listen to the popstate event for future changes.
15
+ */
16
+ connect(): void;
17
+ onpopstate(): void;
18
+ disconnect(): void;
19
+ /**
20
+ * Override.
21
+ * Update the browser history if the preNavigate hooks.
22
+ *
23
+ * @param {string} url - The URL to go to
24
+ * @param {boolean} shouldReplace - True if the current history state should be replaced
25
+ * @param {boolean} updateHistory - True if the browser history should be updated with the new URL
26
+ *
27
+ * @returns {boolean} - True if the processing was NOT blocked by a preNavigate listener
28
+ */
29
+ process(url: string, shouldReplace: boolean, updateHistory?: boolean): Promise<boolean>;
30
+ /**
31
+ * Update the root route, and trickle down the router tree.
32
+ * Redirect to use the base path, if it is missing.
33
+ *
34
+ * @param {string} url - The URL to go to
35
+ */
36
+ catchBrowserUpdate(url: string): void;
37
+ }
38
+ /**
39
+ * Create a new root Router, attach to the Window.
40
+ * This is the public, programmitic API for root router creation.
41
+ * An application can only have ONE root router.
42
+ *
43
+ * @param {object} config - The router config object
44
+ *
45
+ * @returns {object} - { addPreNavigate, addPostNavigate, addErrorNavigate, connect, disconnect }
46
+ */
47
+ export declare function createHistoryRouter(config: DomRouterConfig, router: Router<PageReference>, target?: EventTarget): HistoryRouter;
48
+ //# sourceMappingURL=historyRouter.d.ts.map
@@ -0,0 +1,16 @@
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 { NavigationContext } from 'lwr/navigationContext';
8
+ export { CurrentPageReference } from 'lwr/currentPageReference';
9
+ export { CurrentView } from 'lwr/currentView';
10
+ export type { ContextId } from 'lwr/navigationContext';
11
+ export type { PageReference, RouteInstance } from 'lwr/router';
12
+ export type { Constructable } from 'lwr/routerUtils';
13
+ export { ContextInfo, getNavigationHelm, registerNavigationHelm, generateContextualWireAdapter, } from 'lwr/contextUtils';
14
+ export { navigate, generateUrl } from './navigationApi';
15
+ export { NavigationMixin } from './navigationMixin';
16
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1,22 @@
1
+ import type { ContextId } from 'lwr/navigationContext';
2
+ import type { PageReference } from 'lwr/router';
3
+ /**
4
+ * Navigate programmatically.
5
+ * The Promise used within is deliberately not returned.
6
+ *
7
+ * @param {HTMLElement} context - The navigation context
8
+ * @param {object | string} loc - A route or URL for navigating
9
+ * @param {*} options - Usually a boolean; when true the previous browser history
10
+ * entry should be replaced by this one
11
+ */
12
+ export declare function navigate(context: ContextId, pageReference: PageReference, replace?: boolean): void;
13
+ /**
14
+ * Generate a URL for the given route.
15
+ *
16
+ * @param {HTMLElement} context - The navigation context
17
+ * @param {object} route - A route
18
+ *
19
+ * @returns {Promise<string>}
20
+ */
21
+ export declare function generateUrl(context: ContextId, pageReference: PageReference): string | null;
22
+ //# sourceMappingURL=navigationApi.d.ts.map
@@ -0,0 +1,15 @@
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 { Constructor } from 'lwr/routerUtils';
8
+ declare function NavigationMixin<TBase extends Constructor>(Base: TBase): TBase;
9
+ declare namespace NavigationMixin {
10
+ var Navigate: unique symbol;
11
+ var GenerateUrl: unique symbol;
12
+ var NavContext: unique symbol;
13
+ }
14
+ export { NavigationMixin };
15
+ //# sourceMappingURL=navigationMixin.d.ts.map
@@ -0,0 +1,5 @@
1
+ export declare type ContextId = () => void;
2
+ declare type NavigationContextType = ContextId | undefined;
3
+ export declare const NavigationContext: import("lwr/contextUtils").ContextualWireAdapter<NavigationContextType, unknown, NavigationContextType>;
4
+ export {};
5
+ //# sourceMappingURL=navigationContext.d.ts.map
@@ -0,0 +1,7 @@
1
+ export declare const CONTEXT_ID_BACKDOOR: string;
2
+ export declare type NavigationContextBackdoorEvent = globalThis.CustomEvent<NavigationContextBackdoorEventPayload>;
3
+ import type { ContextId } from 'lwr/navigation';
4
+ export declare type NavigationContextBackdoorEventPayload = {
5
+ callback: (contextId: ContextId) => void;
6
+ };
7
+ //# sourceMappingURL=navigationMixinHacks.d.ts.map
@@ -0,0 +1,14 @@
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 { Observer, Observable, Unsubscriber } from '@lwrjs/types';
8
+ /**
9
+ * Creates a simple observable object, which can have any number of observers.
10
+ * @returns {object}
11
+ */
12
+ export declare function createObservable<V>(): Observable<V>;
13
+ export type { Observer, Observable, Unsubscriber };
14
+ //# sourceMappingURL=observable.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { LightningElement } from 'lwc';
2
+ import type { Constructable } from 'lwr/routerUtils';
3
+ export interface OutletErrorCallback {
4
+ (error: Error, stack: string): void;
5
+ }
6
+ export default class Outlet extends LightningElement {
7
+ static renderMode: string;
8
+ refocusOff: boolean;
9
+ outletErrorCallback?: OutletErrorCallback;
10
+ viewName: string;
11
+ viewCtor?: Constructable;
12
+ previousViewCtor?: Constructable;
13
+ hasError: boolean;
14
+ setView(currentView: Constructable): void;
15
+ renderedCallback(): void;
16
+ errorCallback(e: Error, stack: string): void;
17
+ refocus(): void;
18
+ }
19
+ //# sourceMappingURL=outlet.d.ts.map
@@ -0,0 +1,11 @@
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 { PageReference, RouteCallback, RouteDefinition, RouteHandler, RouteHandlerClass, Router, RouterConfig, RouteDestination, RoutingMatch, RoutingResult, ViewSet, ViewInfo } from 'lwr/routerUtils';
8
+ export declare function createRouter(config?: RouterConfig): Router<PageReference>;
9
+ export type { PageReference, Router, RouterConfig, RouteCallback, RouteDefinition, RouteDestination, RouteHandler, RouteHandlerClass, RoutingMatch, RoutingResult, ViewSet, ViewInfo, };
10
+ export type { Module, RouteHandlerCallback, RouteHandlerModule, RouteInstance, StringAttributes, } from 'lwr/routerUtils';
11
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1,13 @@
1
+ import type { PageReference } from 'lwr/router';
2
+ import type { MessageObject } from 'lwr/routerUtils';
3
+ export interface RouterBridgeApi {
4
+ navigate: (pageRef: PageReference) => boolean;
5
+ }
6
+ export interface RouterBridgeConfig {
7
+ historyDisabled?: boolean;
8
+ onReady?: () => void;
9
+ onPostNavigate?: (pageRef: PageReference | undefined) => void;
10
+ onError?: (error: MessageObject) => boolean;
11
+ }
12
+ export declare function createBridge(config?: RouterBridgeConfig, target?: globalThis.EventTarget): RouterBridgeApi;
13
+ //# sourceMappingURL=routerBridge.d.ts.map