@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.
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextProvider/contextProvider.d.ts +14 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/contextInfo.d.ts +60 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/contextUtils.d.ts +24 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/navigationApiStore.d.ts +45 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/currentPageReference/currentPageReference.d.ts +9 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/currentView/currentView.d.ts +3 -2
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouter/domRouter.d.ts +192 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +4 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/historyUtils.d.ts +21 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/types.d.ts +16 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/uriUtils.d.ts +30 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/historyRouter/historyRouter.d.ts +48 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigation.d.ts +16 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigationApi.d.ts +22 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigationMixin.d.ts +15 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigationContext/navigationContext.d.ts +5 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +7 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/observable/observable.d.ts +14 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/outlet/outlet.d.ts +19 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/router/router.d.ts +11 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerBridge/routerBridge.d.ts +13 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerContainer/routerContainer.d.ts +51 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerContainer/utils.d.ts +32 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerErrors/routerErrors.d.ts +13 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/domUtils.d.ts +2 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/filterUtils.d.ts +19 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/parseUtils.d.ts +42 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/pathToRegexp.d.ts +128 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routeDefUtils.d.ts +43 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routeUtils.d.ts +39 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routerUtils.d.ts +22 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/typeUtils.d.ts +38 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/types.d.ts +133 -0
- package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/uriUtils.d.ts +66 -0
- package/build/bundle/prod/lwr/navigation/es/services/index.d.ts +28 -0
- package/build/bundle/prod/lwr/navigation/es/services/module-provider/index.d.ts +22 -0
- package/build/bundle/prod/lwr/navigation/es/services/module-provider/utils.d.ts +27 -0
- package/build/bundle/prod/lwr/navigation/navigation.js +1 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/contextProvider/contextProvider.d.ts +14 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/contextInfo.d.ts +60 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/contextUtils.d.ts +24 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/navigationApiStore.d.ts +45 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/currentPageReference/currentPageReference.d.ts +9 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/currentView/currentView.d.ts +3 -2
- package/build/bundle/prod/lwr/router/es/modules/lwr/domRouter/domRouter.d.ts +192 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +4 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/historyUtils.d.ts +21 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/types.d.ts +16 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/uriUtils.d.ts +30 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/historyRouter/historyRouter.d.ts +48 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigation.d.ts +16 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigationApi.d.ts +22 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigationMixin.d.ts +15 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/navigationContext/navigationContext.d.ts +5 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +7 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/observable/observable.d.ts +14 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/outlet/outlet.d.ts +19 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/router/router.d.ts +11 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerBridge/routerBridge.d.ts +13 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerContainer/routerContainer.d.ts +51 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerContainer/utils.d.ts +32 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerErrors/routerErrors.d.ts +13 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/domUtils.d.ts +2 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/filterUtils.d.ts +19 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/parseUtils.d.ts +42 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/pathToRegexp.d.ts +128 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routeDefUtils.d.ts +43 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routeUtils.d.ts +39 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routerUtils.d.ts +22 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/typeUtils.d.ts +38 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/types.d.ts +133 -0
- package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/uriUtils.d.ts +66 -0
- package/build/bundle/prod/lwr/router/es/services/index.d.ts +28 -0
- package/build/bundle/prod/lwr/router/es/services/module-provider/index.d.ts +22 -0
- package/build/bundle/prod/lwr/router/es/services/module-provider/utils.d.ts +27 -0
- package/build/bundle/prod/lwr/router/router.js +1 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextProvider/contextProvider.d.ts +14 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/contextInfo.d.ts +60 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/contextUtils.d.ts +24 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/navigationApiStore.d.ts +45 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/currentPageReference/currentPageReference.d.ts +9 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/currentView/currentView.d.ts +3 -2
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouter/domRouter.d.ts +192 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +4 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/historyUtils.d.ts +21 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/types.d.ts +16 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/uriUtils.d.ts +30 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/historyRouter/historyRouter.d.ts +48 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigation.d.ts +16 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigationApi.d.ts +22 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigationMixin.d.ts +15 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigationContext/navigationContext.d.ts +5 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +7 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/observable/observable.d.ts +14 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/outlet/outlet.d.ts +19 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/router/router.d.ts +11 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerBridge/routerBridge.d.ts +13 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerContainer/routerContainer.d.ts +51 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerContainer/utils.d.ts +32 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerErrors/routerErrors.d.ts +13 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/domUtils.d.ts +2 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/filterUtils.d.ts +19 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/parseUtils.d.ts +42 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/pathToRegexp.d.ts +128 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routeDefUtils.d.ts +43 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routeUtils.d.ts +39 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routerUtils.d.ts +22 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/typeUtils.d.ts +38 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/types.d.ts +133 -0
- package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/uriUtils.d.ts +66 -0
- package/build/bundle/prod/lwr/routerContainer/es/services/index.d.ts +28 -0
- package/build/bundle/prod/lwr/routerContainer/es/services/module-provider/index.d.ts +22 -0
- package/build/bundle/prod/lwr/routerContainer/es/services/module-provider/utils.d.ts +27 -0
- package/build/bundle/prod/lwr/routerContainer/routerContainer.js +1 -0
- package/build/es/modules/lwr/currentPageReference/currentPageReference.d.ts +1 -1
- package/build/es/modules/lwr/currentView/currentView.d.ts +2 -2
- package/build/es/modules/lwr/domRouter/domRouter.d.ts +2 -2
- package/build/es/modules/lwr/domRouterUtils/types.d.ts +1 -1
- package/build/es/modules/lwr/navigationContext/navigationContext.d.ts +2 -2
- package/build/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +2 -2
- package/build/es/modules/lwr/routerUtils/filterUtils.d.ts +1 -1
- package/build/es/modules/lwr/routerUtils/pathToRegexp.d.ts +5 -5
- package/build/es/modules/lwr/routerUtils/types.d.ts +23 -23
- package/package.json +7 -7
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -0,0 +1,27 @@
|
|
|
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 +1,2 @@
|
|
|
1
1
|
function e(e){if(null==e)throw new TypeError("Provider must be defined.")}class t{constructor(e){this.infoMap=new WeakMap,this.defaultValue=e}getInfo(e){let t=this.infoMap.get(e);return void 0===t&&(t={consumers:new Set},this.infoMap.set(e,t)),t}setContext(t,n){e(t);const o=n,r=this.getInfo(t);r.contextValue=n,r.consumers.forEach((e=>e.provide(o))),0===r.consumers.size&&o?.onComplete&&o.onComplete()}getContext(t){e(t);const{contextValue:n}=this.getInfo(t);return void 0!==n?n:this.defaultValue}clearContext(t){e(t),this.infoMap.delete(t)}subscribeContext(t,n){e(t);const{consumers:o,contextValue:r}=this.getInfo(t);o.has(n)||(o.add(n),n.provide(r))}unsubscribeContext(t,n){e(t),this.getInfo(t).consumers.delete(n)}}function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function r(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const a="LWR",i=1;function s(e,t){return Array.isArray(t)?e.replace(/\{([0-9]+)\}/g,((e,n)=>t[n])):e}function c(e,t){return`${e.code}: ${s(e.message,t)}`}function l(e,t){const n=o(o({},e),{},{message:s(e.message,t)});return e.address&&(n.address=s(e.address,t)),e.stack&&(n.stack=s(e.stack,t)),n}const u={INVALID_MIXIN_CMP:{code:`${a}4001`,message:"{0} must be an Element type",level:i},MISSING_CONTEXT:{code:`${a}4002`,message:"Could not find context to perform navigation action.",level:i},INVALID_CONTEXT:{code:`${a}4003`,message:"Cannot register navigation context; it must have this shape: { navigate, generateUrl, subscribe }",level:i},MULTIPLE_ROOTS:{code:`${a}4004`,message:"Router connection failed. There can only be one root router.",level:i},MULTIPLE_CHILDREN:{code:`${a}4005`,message:"Could not add to the navigation hierarchy. There can only be one child per navigation node.",level:i},MISSING_ROUTE:{code:`${a}4006`,message:'A route cannot be created to navigate to URL "{0}"',level:i,address:"{0}"},MISSING_URL:{code:`${a}4007`,message:'A URL cannot be created to navigate to route "{0}"',level:i,address:"{0}"},PRENAV_FAILED:{code:`${a}4008`,message:'A preNavigate hook listener blocked routing to "{0}"',level:2,address:"{0}"},MISSING_ROUTE_TEMPLATE:{code:`${a}4009`,message:'A route definition must contain a "uri" property.',level:i},MISSING_ROUTE_CMP:{code:`${a}4016`,message:"Expected a route view component with a default export.",level:i},MISSING_DATA_CONTEXT:{code:`${a}4018`,message:"Could not find context to retrieve navigation data.",level:i},INVALID_ROUTE_QUERY:{code:`${a}4019`,message:"Invalid query param in route definition.",level:i},MISSING_PAGE_BINDING:{code:`${a}4020`,message:"Route definition must provide page binding",level:i},INVALID_PAGE_BINDING:{code:`${a}4021`,message:"Invalid page binding in route definition",level:i},INVALID_URI_SYNTAX:{code:`${a}4022`,message:"Invalid uri syntax. URI cannot contain *, +, (, ), ",level:i},VIEW_IMPORT_FAILED:{code:`${a}4023`,message:'Error importing view with name "{0}", failure was: {1}',level:i,stack:"{2}"},VIEW_MISSING:{code:`${a}4024`,message:'Expected a view with name "{0}" in the viewset',level:i},VIEW_IMPORT_FAILED_WITH_SPECIFIER:{code:`${a}4025`,message:'Error importing module "{0}" from view with name "{1}", failure was: {2}',level:i,stack:"{3}"},NO_ROUTE_MATCH:{code:`${a}4026`,message:"A routing match cannot be found for: {0}",level:i},INVALID_ROUTE_HANDLER:{code:`${a}4027`,message:'Route definition "{0}" does not have a valid route handler module',level:i},DESTINATION_NOT_FOUND:{code:`${a}4028`,message:"Route handler returned 404: Not Found",level:i},DESTINATION_ERROR:{code:`${a}4029`,message:"Route handler returned error status {0}: {1}",level:i,stack:"{2}"}},d=new WeakMap;function v(e){const t=d.get(e);if(!t||!t.value)throw new Error(c(u.MISSING_CONTEXT));return t.value}function I(e,t){const n={id:e,value:t,update:e=>{n.value=e}};return d.set(n.id,n),n}function g(e){var t;return(t=class{constructor(e){this._callback=e}connect(){}disconnect(){}update(e,t){t&&this._callback(t)}static setContext(t,n){e.setContext(t,n)}static getContext(t){return e.getContext(t)}static clearContext(t){e.clearContext(t)}static subscribeContext(t,n){e.subscribeContext(t,n)}static unsubscribeContext(t,n){e.unsubscribeContext(t,n)}}).contextSchema={value:"required"},t}const f=g(new t(void 0)),m=g(new t(void 0)),p=new t(void 0),h=class extends(g(p)){async update(e,t){if(t){const n=e&&e.viewName?e.viewName:"default",o=t.viewset[n],r=o,a=r&&r.module||o;let i;if(a)try{const e=await a(),t=e&&e.default;if(!t||void 0===t.constructor)throw new Error("error occurred with view import");this._callback(t)}catch(e){const t=e;i=r.specifier?l(u.VIEW_IMPORT_FAILED_WITH_SPECIFIER,[r.specifier,n,t.message,t.stack||""]):l(u.VIEW_IMPORT_FAILED,[n,t.message,t.stack||""])}else i=l(u.VIEW_MISSING,[n]);t.onComplete&&t.onComplete(i)}}};function b(e,t,n){v(e).navigate(t,n)}function E(e,t){return v(e).generateUrl(t)}const _=`universalcontainergetnavigationcontext${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}`,N=Symbol("Navigate"),w=Symbol("GenerateUrl"),O=Symbol("NavContext"),S=Symbol("NavContext");function C(e){!function(e,t,n){if(!e)throw new Error(c(t,n))}("function"==typeof e.prototype.dispatchEvent,u.INVALID_MIXIN_CMP,[e.toString()]);return class extends e{[S](){if(!this[O]&&(this.dispatchEvent(new CustomEvent(_,{bubbles:!0,composed:!0,detail:{callback:e=>{this[O]=e}}})),!this[O]))throw new Error(c(u.MISSING_CONTEXT))}[N](e,t){this[S](),b(this[O],e,t)}async[w](e){return this[S](),E(this[O],e)}}}C.Navigate=N,C.GenerateUrl=w,C.NavContext=O;export{t as ContextInfo,m as CurrentPageReference,h as CurrentView,f as NavigationContext,C as NavigationMixin,g as generateContextualWireAdapter,E as generateUrl,v as getNavigationHelm,b as navigate,I as registerNavigationHelm};
|
|
2
|
+
//# sourceMappingURL=navigation.js.map
|
|
@@ -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
|
package/build/bundle/prod/lwr/router/es/modules/lwr/currentPageReference/currentPageReference.d.ts
ADDED
|
@@ -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,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¶m2=two¶m3"
|
|
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
|
package/build/bundle/prod/lwr/router/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts
ADDED
|
@@ -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
|