@lwrjs/router 0.10.0-alpha.15 → 0.10.0-alpha.17

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 (129) hide show
  1. package/build/bundle/prod/lwr/navigation/es/modules/lwr/currentView/currentView.d.ts +2 -3
  2. package/build/bundle/prod/lwr/navigation/navigation.js +1 -1
  3. package/build/bundle/prod/lwr/router/es/modules/lwr/currentView/currentView.d.ts +2 -3
  4. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/currentView/currentView.d.ts +2 -3
  5. package/build/cjs/modules/lwr/navigation/navigationMixin.cjs +11 -4
  6. package/build/es/modules/lwr/currentPageReference/currentPageReference.d.ts +1 -1
  7. package/build/es/modules/lwr/currentView/currentView.d.ts +2 -2
  8. package/build/es/modules/lwr/domRouter/domRouter.d.ts +2 -2
  9. package/build/es/modules/lwr/domRouterUtils/historyUtils.d.ts +1 -1
  10. package/build/es/modules/lwr/domRouterUtils/types.d.ts +1 -1
  11. package/build/es/modules/lwr/navigation/navigationMixin.js +13 -4
  12. package/build/es/modules/lwr/navigationContext/navigationContext.d.ts +2 -2
  13. package/build/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +2 -2
  14. package/build/es/modules/lwr/routerUtils/filterUtils.d.ts +1 -1
  15. package/build/es/modules/lwr/routerUtils/pathToRegexp.d.ts +5 -5
  16. package/build/es/modules/lwr/routerUtils/types.d.ts +24 -24
  17. package/build/modules/lwr/navigation/navigationMixin.js +12 -4
  18. package/build/modules/lwr/outlet/outlet.html +1 -1
  19. package/package.json +18 -7
  20. package/pageObjects/outlet.cjs +2 -2
  21. package/pageObjects/outlet.js +2 -2
  22. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextProvider/contextProvider.d.ts +0 -14
  23. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/contextInfo.d.ts +0 -60
  24. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/contextUtils.d.ts +0 -24
  25. package/build/bundle/prod/lwr/navigation/es/modules/lwr/contextUtils/navigationApiStore.d.ts +0 -45
  26. package/build/bundle/prod/lwr/navigation/es/modules/lwr/currentPageReference/currentPageReference.d.ts +0 -9
  27. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouter/domRouter.d.ts +0 -192
  28. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +0 -4
  29. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/historyUtils.d.ts +0 -21
  30. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/types.d.ts +0 -16
  31. package/build/bundle/prod/lwr/navigation/es/modules/lwr/domRouterUtils/uriUtils.d.ts +0 -30
  32. package/build/bundle/prod/lwr/navigation/es/modules/lwr/historyRouter/historyRouter.d.ts +0 -48
  33. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigation.d.ts +0 -16
  34. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigationApi.d.ts +0 -22
  35. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigation/navigationMixin.d.ts +0 -15
  36. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigationContext/navigationContext.d.ts +0 -5
  37. package/build/bundle/prod/lwr/navigation/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +0 -7
  38. package/build/bundle/prod/lwr/navigation/es/modules/lwr/observable/observable.d.ts +0 -14
  39. package/build/bundle/prod/lwr/navigation/es/modules/lwr/outlet/outlet.d.ts +0 -19
  40. package/build/bundle/prod/lwr/navigation/es/modules/lwr/router/router.d.ts +0 -11
  41. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerBridge/routerBridge.d.ts +0 -13
  42. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerContainer/routerContainer.d.ts +0 -51
  43. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerContainer/utils.d.ts +0 -32
  44. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerErrors/routerErrors.d.ts +0 -13
  45. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/domUtils.d.ts +0 -2
  46. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/filterUtils.d.ts +0 -19
  47. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/parseUtils.d.ts +0 -42
  48. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/pathToRegexp.d.ts +0 -128
  49. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routeDefUtils.d.ts +0 -43
  50. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routeUtils.d.ts +0 -39
  51. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/routerUtils.d.ts +0 -22
  52. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/typeUtils.d.ts +0 -38
  53. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/types.d.ts +0 -133
  54. package/build/bundle/prod/lwr/navigation/es/modules/lwr/routerUtils/uriUtils.d.ts +0 -66
  55. package/build/bundle/prod/lwr/navigation/es/services/index.d.ts +0 -28
  56. package/build/bundle/prod/lwr/navigation/es/services/module-provider/index.d.ts +0 -22
  57. package/build/bundle/prod/lwr/navigation/es/services/module-provider/utils.d.ts +0 -27
  58. package/build/bundle/prod/lwr/router/es/modules/lwr/contextProvider/contextProvider.d.ts +0 -14
  59. package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/contextInfo.d.ts +0 -60
  60. package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/contextUtils.d.ts +0 -24
  61. package/build/bundle/prod/lwr/router/es/modules/lwr/contextUtils/navigationApiStore.d.ts +0 -45
  62. package/build/bundle/prod/lwr/router/es/modules/lwr/currentPageReference/currentPageReference.d.ts +0 -9
  63. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouter/domRouter.d.ts +0 -192
  64. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +0 -4
  65. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/historyUtils.d.ts +0 -21
  66. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/types.d.ts +0 -16
  67. package/build/bundle/prod/lwr/router/es/modules/lwr/domRouterUtils/uriUtils.d.ts +0 -30
  68. package/build/bundle/prod/lwr/router/es/modules/lwr/historyRouter/historyRouter.d.ts +0 -48
  69. package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigation.d.ts +0 -16
  70. package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigationApi.d.ts +0 -22
  71. package/build/bundle/prod/lwr/router/es/modules/lwr/navigation/navigationMixin.d.ts +0 -15
  72. package/build/bundle/prod/lwr/router/es/modules/lwr/navigationContext/navigationContext.d.ts +0 -5
  73. package/build/bundle/prod/lwr/router/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +0 -7
  74. package/build/bundle/prod/lwr/router/es/modules/lwr/observable/observable.d.ts +0 -14
  75. package/build/bundle/prod/lwr/router/es/modules/lwr/outlet/outlet.d.ts +0 -19
  76. package/build/bundle/prod/lwr/router/es/modules/lwr/router/router.d.ts +0 -11
  77. package/build/bundle/prod/lwr/router/es/modules/lwr/routerBridge/routerBridge.d.ts +0 -13
  78. package/build/bundle/prod/lwr/router/es/modules/lwr/routerContainer/routerContainer.d.ts +0 -51
  79. package/build/bundle/prod/lwr/router/es/modules/lwr/routerContainer/utils.d.ts +0 -32
  80. package/build/bundle/prod/lwr/router/es/modules/lwr/routerErrors/routerErrors.d.ts +0 -13
  81. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/domUtils.d.ts +0 -2
  82. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/filterUtils.d.ts +0 -19
  83. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/parseUtils.d.ts +0 -42
  84. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/pathToRegexp.d.ts +0 -128
  85. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routeDefUtils.d.ts +0 -43
  86. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routeUtils.d.ts +0 -39
  87. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/routerUtils.d.ts +0 -22
  88. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/typeUtils.d.ts +0 -38
  89. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/types.d.ts +0 -133
  90. package/build/bundle/prod/lwr/router/es/modules/lwr/routerUtils/uriUtils.d.ts +0 -66
  91. package/build/bundle/prod/lwr/router/es/services/index.d.ts +0 -28
  92. package/build/bundle/prod/lwr/router/es/services/module-provider/index.d.ts +0 -22
  93. package/build/bundle/prod/lwr/router/es/services/module-provider/utils.d.ts +0 -27
  94. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextProvider/contextProvider.d.ts +0 -14
  95. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/contextInfo.d.ts +0 -60
  96. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/contextUtils.d.ts +0 -24
  97. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/contextUtils/navigationApiStore.d.ts +0 -45
  98. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/currentPageReference/currentPageReference.d.ts +0 -9
  99. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouter/domRouter.d.ts +0 -192
  100. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/domRouterUtils.d.ts +0 -4
  101. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/historyUtils.d.ts +0 -21
  102. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/types.d.ts +0 -16
  103. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/domRouterUtils/uriUtils.d.ts +0 -30
  104. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/historyRouter/historyRouter.d.ts +0 -48
  105. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigation.d.ts +0 -16
  106. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigationApi.d.ts +0 -22
  107. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigation/navigationMixin.d.ts +0 -15
  108. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigationContext/navigationContext.d.ts +0 -5
  109. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/navigationMixinHacks/navigationMixinHacks.d.ts +0 -7
  110. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/observable/observable.d.ts +0 -14
  111. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/outlet/outlet.d.ts +0 -19
  112. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/router/router.d.ts +0 -11
  113. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerBridge/routerBridge.d.ts +0 -13
  114. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerContainer/routerContainer.d.ts +0 -51
  115. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerContainer/utils.d.ts +0 -32
  116. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerErrors/routerErrors.d.ts +0 -13
  117. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/domUtils.d.ts +0 -2
  118. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/filterUtils.d.ts +0 -19
  119. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/parseUtils.d.ts +0 -42
  120. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/pathToRegexp.d.ts +0 -128
  121. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routeDefUtils.d.ts +0 -43
  122. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routeUtils.d.ts +0 -39
  123. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/routerUtils.d.ts +0 -22
  124. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/typeUtils.d.ts +0 -38
  125. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/types.d.ts +0 -133
  126. package/build/bundle/prod/lwr/routerContainer/es/modules/lwr/routerUtils/uriUtils.d.ts +0 -66
  127. package/build/bundle/prod/lwr/routerContainer/es/services/index.d.ts +0 -28
  128. package/build/bundle/prod/lwr/routerContainer/es/services/module-provider/index.d.ts +0 -22
  129. package/build/bundle/prod/lwr/routerContainer/es/services/module-provider/utils.d.ts +0 -27
@@ -1,11 +1,10 @@
1
- /// <reference types="lwc" />
2
1
  import type { ViewSet } from 'lwr/router';
3
2
  import type { Constructable } from 'lwr/routerUtils';
4
- declare type ViewContext = {
3
+ type ViewContext = {
5
4
  viewset: ViewSet;
6
5
  onComplete?: Function;
7
6
  } | undefined;
8
- declare type CurrentViewConfig = {
7
+ type CurrentViewConfig = {
9
8
  viewName?: string;
10
9
  };
11
10
  /**
@@ -1,2 +1,2 @@
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};
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 i="LWR",a=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:`${i}4001`,message:"{0} must be an Element type",level:a},MISSING_CONTEXT:{code:`${i}4002`,message:"Could not find context to perform navigation action.",level:a},INVALID_CONTEXT:{code:`${i}4003`,message:"Cannot register navigation context; it must have this shape: { navigate, generateUrl, subscribe }",level:a},MULTIPLE_ROOTS:{code:`${i}4004`,message:"Router connection failed. There can only be one root router.",level:a},MULTIPLE_CHILDREN:{code:`${i}4005`,message:"Could not add to the navigation hierarchy. There can only be one child per navigation node.",level:a},MISSING_ROUTE:{code:`${i}4006`,message:'A route cannot be created to navigate to URL "{0}"',level:a,address:"{0}"},MISSING_URL:{code:`${i}4007`,message:'A URL cannot be created to navigate to route "{0}"',level:a,address:"{0}"},PRENAV_FAILED:{code:`${i}4008`,message:'A preNavigate hook listener blocked routing to "{0}"',level:2,address:"{0}"},MISSING_ROUTE_TEMPLATE:{code:`${i}4009`,message:'A route definition must contain a "uri" property.',level:a},MISSING_ROUTE_CMP:{code:`${i}4016`,message:"Expected a route view component with a default export.",level:a},MISSING_DATA_CONTEXT:{code:`${i}4018`,message:"Could not find context to retrieve navigation data.",level:a},INVALID_ROUTE_QUERY:{code:`${i}4019`,message:"Invalid query param in route definition.",level:a},MISSING_PAGE_BINDING:{code:`${i}4020`,message:"Route definition must provide page binding",level:a},INVALID_PAGE_BINDING:{code:`${i}4021`,message:"Invalid page binding in route definition",level:a},INVALID_URI_SYNTAX:{code:`${i}4022`,message:"Invalid uri syntax. URI cannot contain *, +, (, ), ",level:a},VIEW_IMPORT_FAILED:{code:`${i}4023`,message:'Error importing view with name "{0}", failure was: {1}',level:a,stack:"{2}"},VIEW_MISSING:{code:`${i}4024`,message:'Expected a view with name "{0}" in the viewset',level:a},VIEW_IMPORT_FAILED_WITH_SPECIFIER:{code:`${i}4025`,message:'Error importing module "{0}" from view with name "{1}", failure was: {2}',level:a,stack:"{3}"},NO_ROUTE_MATCH:{code:`${i}4026`,message:"A routing match cannot be found for: {0}",level:a},INVALID_ROUTE_HANDLER:{code:`${i}4027`,message:'Route definition "{0}" does not have a valid route handler module',level:a},DESTINATION_NOT_FOUND:{code:`${i}4028`,message:"Route handler returned 404: Not Found",level:a},DESTINATION_ERROR:{code:`${i}4029`,message:"Route handler returned error status {0}: {1}",level:a,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 f(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 g=f(new t(void 0)),m=f(new t(void 0)),p=new t(void 0),h=class extends(f(p)){async update(e,t){if(t){const n=e&&e.viewName?e.viewName:"default",o=t.viewset[n],r=o,i=r&&r.module||o;let a;if(i)try{const e=await i(),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;a=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 a=l(u.VIEW_MISSING,[n]);t.onComplete&&t.onComplete(a)}}};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="undefined"==typeof window,w=Symbol("Navigate"),O=Symbol("GenerateUrl"),S=Symbol("NavContext"),C=Symbol("NavContext");function T(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{[C](){if(!this[S]&&(this.dispatchEvent(new CustomEvent(_,{bubbles:!0,composed:!0,detail:{callback:e=>{this[S]=e}}})),!this[S]))throw new Error(c(u.MISSING_CONTEXT))}[w](e,t){N||(this[C](),b(this[S],e,t))}async[O](e){return N?null:(this[C](),E(this[S],e))}}}T.Navigate=w,T.GenerateUrl=O,T.NavContext=S;export{t as ContextInfo,m as CurrentPageReference,h as CurrentView,g as NavigationContext,T as NavigationMixin,f as generateContextualWireAdapter,E as generateUrl,v as getNavigationHelm,b as navigate,I as registerNavigationHelm};
2
2
  //# sourceMappingURL=navigation.js.map
@@ -1,11 +1,10 @@
1
- /// <reference types="lwc" />
2
1
  import type { ViewSet } from 'lwr/router';
3
2
  import type { Constructable } from 'lwr/routerUtils';
4
- declare type ViewContext = {
3
+ type ViewContext = {
5
4
  viewset: ViewSet;
6
5
  onComplete?: Function;
7
6
  } | undefined;
8
- declare type CurrentViewConfig = {
7
+ type CurrentViewConfig = {
9
8
  viewName?: string;
10
9
  };
11
10
  /**
@@ -1,11 +1,10 @@
1
- /// <reference types="lwc" />
2
1
  import type { ViewSet } from 'lwr/router';
3
2
  import type { Constructable } from 'lwr/routerUtils';
4
- declare type ViewContext = {
3
+ type ViewContext = {
5
4
  viewset: ViewSet;
6
5
  onComplete?: Function;
7
6
  } | undefined;
8
- declare type CurrentViewConfig = {
7
+ type CurrentViewConfig = {
9
8
  viewName?: string;
10
9
  };
11
10
  /**
@@ -29,6 +29,7 @@ __export(exports, {
29
29
  var import_routerErrors = __toModule(require("lwr/routerErrors"));
30
30
  var import_navigationApi = __toModule(require("./navigationApi"));
31
31
  var import_navigationMixinHacks = __toModule(require("lwr/navigationMixinHacks"));
32
+ var isSSR = typeof window === "undefined";
32
33
  var Navigate = Symbol("Navigate");
33
34
  var GenerateUrl = Symbol("GenerateUrl");
34
35
  var NavContext = Symbol("NavContext");
@@ -55,12 +56,18 @@ function NavigationMixin(Base) {
55
56
  }
56
57
  }
57
58
  [Navigate](pageRef, replace) {
58
- this[GetContext]();
59
- (0, import_navigationApi.navigate)(this[NavContext], pageRef, replace);
59
+ if (!isSSR) {
60
+ this[GetContext]();
61
+ (0, import_navigationApi.navigate)(this[NavContext], pageRef, replace);
62
+ }
60
63
  }
61
64
  async [GenerateUrl](pageRef) {
62
- this[GetContext]();
63
- return (0, import_navigationApi.generateUrl)(this[NavContext], pageRef);
65
+ if (!isSSR) {
66
+ this[GetContext]();
67
+ return (0, import_navigationApi.generateUrl)(this[NavContext], pageRef);
68
+ } else {
69
+ return null;
70
+ }
64
71
  }
65
72
  }
66
73
  return Mixin;
@@ -1,5 +1,5 @@
1
1
  import type { PageReference } from 'lwr/router';
2
- declare type PageReferenceContext = PageReference | undefined;
2
+ type PageReferenceContext = PageReference | undefined;
3
3
  /**
4
4
  * Services @wire(CurrentPageReference) requests.
5
5
  * Hooks up to an Observable from the current navigation context.
@@ -1,11 +1,11 @@
1
1
  /// <reference types="lwc" />
2
2
  import type { ViewSet } from 'lwr/router';
3
3
  import type { Constructable } from 'lwr/routerUtils';
4
- declare type ViewContext = {
4
+ type ViewContext = {
5
5
  viewset: ViewSet;
6
6
  onComplete?: Function;
7
7
  } | undefined;
8
- declare type CurrentViewConfig = {
8
+ type CurrentViewConfig = {
9
9
  viewName?: string;
10
10
  };
11
11
  /**
@@ -14,8 +14,8 @@ export declare const PARENT_EVENT: string;
14
14
  interface RouterParent {
15
15
  addChild(child: DomRouter): Promise<void>;
16
16
  }
17
- export declare type ParentRouterEvent = CustomEvent<(router: RouterParent) => void>;
18
- declare type DomRoutingMatch = RoutingMatch & {
17
+ export type ParentRouterEvent = CustomEvent<(router: RouterParent) => void>;
18
+ type DomRoutingMatch = RoutingMatch & {
19
19
  url: string;
20
20
  };
21
21
  interface DomRouterNode extends RouterParent {
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- import { RouteInstance } from '../routerUtils/types';
7
+ import type { RouteInstance } from '../routerUtils/types';
8
8
  /**
9
9
  * Sets a history state.
10
10
 
@@ -3,7 +3,7 @@ export interface RouteChange {
3
3
  current?: RoutingMatch;
4
4
  next: RoutingMatch;
5
5
  }
6
- export declare type NavigationHandler = (address: PageReference, replace?: boolean) => boolean;
6
+ export type NavigationHandler = (address: PageReference, replace?: boolean) => boolean;
7
7
  export interface DomRouterConfig {
8
8
  handleNavigation?: NavigationHandler;
9
9
  }
@@ -10,6 +10,8 @@
10
10
  import { invariant, generateMessage, messages } from 'lwr/routerErrors';
11
11
  import { generateUrl, navigate } from './navigationApi';
12
12
  import { CONTEXT_ID_BACKDOOR } from 'lwr/navigationMixinHacks';
13
+ // eslint-disable-next-line lwr/no-unguarded-apis
14
+ const isSSR = typeof window === 'undefined';
13
15
  /*
14
16
  * Exports the NavigationMixin and CurrentPageReference wire adapter.
15
17
  * Uses the NavigationContext wire to retrieve the current navigation context/node.
@@ -59,12 +61,19 @@ function NavigationMixin(Base) {
59
61
  }
60
62
  }
61
63
  [Navigate](pageRef, replace) {
62
- this[GetContext]();
63
- navigate(this[NavContext], pageRef, replace);
64
+ if (!isSSR) {
65
+ this[GetContext]();
66
+ navigate(this[NavContext], pageRef, replace);
67
+ }
64
68
  }
65
69
  async [GenerateUrl](pageRef) {
66
- this[GetContext]();
67
- return generateUrl(this[NavContext], pageRef);
70
+ if (!isSSR) {
71
+ this[GetContext]();
72
+ return generateUrl(this[NavContext], pageRef);
73
+ }
74
+ else {
75
+ return null;
76
+ }
68
77
  }
69
78
  }
70
79
  return Mixin;
@@ -1,5 +1,5 @@
1
- export declare type ContextId = () => void;
2
- declare type NavigationContextType = ContextId | undefined;
1
+ export type ContextId = () => void;
2
+ type NavigationContextType = ContextId | undefined;
3
3
  export declare const NavigationContext: import("lwr/contextUtils").ContextualWireAdapter<NavigationContextType, unknown, NavigationContextType>;
4
4
  export {};
5
5
  //# sourceMappingURL=navigationContext.d.ts.map
@@ -1,7 +1,7 @@
1
1
  export declare const CONTEXT_ID_BACKDOOR: string;
2
- export declare type NavigationContextBackdoorEvent = globalThis.CustomEvent<NavigationContextBackdoorEventPayload>;
2
+ export type NavigationContextBackdoorEvent = globalThis.CustomEvent<NavigationContextBackdoorEventPayload>;
3
3
  import type { ContextId } from 'lwr/navigation';
4
- export declare type NavigationContextBackdoorEventPayload = {
4
+ export type NavigationContextBackdoorEventPayload = {
5
5
  callback: (contextId: ContextId) => void;
6
6
  };
7
7
  //# sourceMappingURL=navigationMixinHacks.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6
6
  */
7
- export declare type Filter<V> = (v: V) => Promise<boolean> | boolean;
7
+ export type Filter<V> = (v: V) => Promise<boolean> | boolean;
8
8
  export interface FilterChain<V> {
9
9
  add: (f: Filter<V>[] | Filter<V>) => void;
10
10
  compile: (arg: V) => Promise<boolean>;
@@ -26,7 +26,7 @@ export interface TokensToFunctionOptions {
26
26
  */
27
27
  validate?: boolean;
28
28
  }
29
- export declare type PathFunction<P extends object = object> = (data?: P) => string;
29
+ export type PathFunction<P extends object = object> = (data?: P) => string;
30
30
  /**
31
31
  * Expose a method for transforming tokens into the path function.
32
32
  */
@@ -52,11 +52,11 @@ export interface MatchResult<P extends object = object> {
52
52
  /**
53
53
  * A match is either `false` (no match) or a match result.
54
54
  */
55
- export declare type Match<P extends object = object> = false | MatchResult<P>;
55
+ export type Match<P extends object = object> = false | MatchResult<P>;
56
56
  /**
57
57
  * The match function takes a string and returns whether it matched the path.
58
58
  */
59
- export declare type MatchFunction<P extends object = object> = (path: string) => Match<P>;
59
+ export type MatchFunction<P extends object = object> = (path: string) => Match<P>;
60
60
  /**
61
61
  * Create a path match function from `path-to-regexp` output.
62
62
  */
@@ -74,7 +74,7 @@ export interface Key {
74
74
  /**
75
75
  * A token is a string (nothing special) or key metadata (capture group).
76
76
  */
77
- export declare type Token = string | Key;
77
+ export type Token = string | Key;
78
78
  export interface TokensToRegexpOptions {
79
79
  /**
80
80
  * When `true` the regexp will be case sensitive. (default: `false`)
@@ -112,7 +112,7 @@ export declare function tokensToRegexp(tokens: Token[], keys?: Key[], options?:
112
112
  /**
113
113
  * Supported `path-to-regexp` input types.
114
114
  */
115
- export declare type Path = string | RegExp | Array<string | RegExp>;
115
+ export type Path = string | RegExp | Array<string | RegExp>;
116
116
  /**
117
117
  * Normalize the given path string, returning a regular expression.
118
118
  *
@@ -1,40 +1,40 @@
1
1
  import type { Key, PathFunction } from './pathToRegexp';
2
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;
3
+ import type { Unsubscriber } from 'lwr/observable';
4
+ export type Module = Record<string | symbol | number, unknown>;
5
+ export type Constructor<T = object> = new (...args: any[]) => T;
6
6
  export interface Constructable<T = object> {
7
7
  constructor: Constructor<T>;
8
8
  }
9
- export declare type UrlMapper<TAddress> = {
9
+ export type UrlMapper<TAddress> = {
10
10
  generateUrl(address: TAddress): string | null;
11
11
  parseUrl(url: string): TAddress | null;
12
12
  };
13
- export declare type RouteMatcher<TAddress> = {
13
+ export type RouteMatcher<TAddress> = {
14
14
  matchRoute(address: TAddress): RoutingMatch | null;
15
15
  };
16
- export declare type ViewMapper<TAddress> = {
16
+ export type ViewMapper<TAddress> = {
17
17
  navigate(address: TAddress): void;
18
18
  subscribe(callback: RouteCallback, replay?: boolean): Unsubscriber;
19
19
  resolveView(address: TAddress): Promise<RouteDestination>;
20
20
  contextId?: ContextId;
21
21
  };
22
- export declare type Router<TAddress = string> = ViewMapper<TAddress> & UrlMapper<TAddress> & RouteMatcher<TAddress>;
22
+ export type Router<TAddress = string> = ViewMapper<TAddress> & UrlMapper<TAddress> & RouteMatcher<TAddress>;
23
23
  export interface DEPRECATED_getRouteFromUrl {
24
24
  <TAddress>(url: string, defaultImpl: Function): TAddress | null;
25
25
  }
26
26
  export interface DEPRECATED_getUrlFromRoute {
27
27
  <TAddress>(route: TAddress, defaultImpl: Function): string | null;
28
28
  }
29
- export declare type RouterConfig = {
29
+ export type RouterConfig = {
30
30
  basePath?: string;
31
31
  routes?: RouteDefinition[];
32
32
  caseSensitive?: boolean;
33
33
  DEPRECATED_getRouteFromUrl?: DEPRECATED_getRouteFromUrl;
34
34
  DEPRECATED_getUrlFromRoute?: DEPRECATED_getUrlFromRoute;
35
35
  };
36
- export declare type RouterSerializationConfig<TAddress> = Required<Omit<RouterConfig, 'DEPRECATED_getRouteFromUrl' | 'DEPRECATED_getUrlFromRoute'> & UrlMapper<TAddress>>;
37
- export declare type RouteParameterPatterns = {
36
+ export type RouterSerializationConfig<TAddress> = Required<Omit<RouterConfig, 'DEPRECATED_getRouteFromUrl' | 'DEPRECATED_getUrlFromRoute'> & UrlMapper<TAddress>>;
37
+ export type RouteParameterPatterns = {
38
38
  [paramName: string]: string;
39
39
  };
40
40
  export interface RouteDefinition<TMetadata = Record<string, any>> {
@@ -46,21 +46,21 @@ export interface RouteDefinition<TMetadata = Record<string, any>> {
46
46
  handler: () => Promise<RouteHandlerModule>;
47
47
  metadata?: TMetadata;
48
48
  }
49
- export declare type PageBindings = {
49
+ export type PageBindings = {
50
50
  attributeBindings: NullableStringAttributes;
51
51
  stateBindings: NullableStringAttributes;
52
52
  };
53
- declare type CompiledQueryResult = {
53
+ type CompiledQueryResult = {
54
54
  literalValue?: string | null;
55
55
  routeParamName?: string;
56
56
  };
57
- export declare type CompiledQuery = Record<string, CompiledQueryResult>;
58
- declare type MatchedQueryResult = {
57
+ export type CompiledQuery = Record<string, CompiledQueryResult>;
58
+ type MatchedQueryResult = {
59
59
  value: string | null;
60
60
  routeParamName?: string;
61
61
  };
62
- export declare type MatchedQuery = Record<string, MatchedQueryResult>;
63
- export declare type QueryMatcher = (queryObject: QueryObject) => MatchedQuery | null;
62
+ export type MatchedQuery = Record<string, MatchedQueryResult>;
63
+ export type QueryMatcher = (queryObject: QueryObject) => MatchedQuery | null;
64
64
  export interface CompiledRouteDefinition {
65
65
  original: RouteDefinition;
66
66
  regex: RegExp;
@@ -69,11 +69,11 @@ export interface CompiledRouteDefinition {
69
69
  compiledQuery: CompiledQuery;
70
70
  queryMatcher: QueryMatcher;
71
71
  }
72
- export declare type RouteHandlerCallback = (routeDestination: RouteDestination) => void;
73
- export declare type RouteHandlerClass = {
72
+ export type RouteHandlerCallback = (routeDestination: RouteDestination) => void;
73
+ export type RouteHandlerClass = {
74
74
  new (callback: RouteHandlerCallback): RouteHandler;
75
75
  };
76
- export declare type RouteHandlerModule = {
76
+ export type RouteHandlerModule = {
77
77
  default: RouteHandlerClass;
78
78
  };
79
79
  export interface RouteInstance {
@@ -82,12 +82,12 @@ export interface RouteInstance {
82
82
  state: NullableStringAttributes;
83
83
  pageReference: PageReference;
84
84
  }
85
- export declare type RouteDestination = {
85
+ export type RouteDestination = {
86
86
  status?: 200 | 404 | 500;
87
87
  viewset: ViewSet;
88
88
  error?: Error;
89
89
  };
90
- export declare type RoutingMatch = {
90
+ export type RoutingMatch = {
91
91
  pathMatch: string;
92
92
  route: RouteInstance;
93
93
  routeDefinition: RouteDefinition;
@@ -96,7 +96,7 @@ export interface CompiledRoutingMatch {
96
96
  route: RouteInstance;
97
97
  routeDefinition: CompiledRouteDefinition;
98
98
  }
99
- export declare type RoutingResult = RoutingMatch & RouteDestination;
99
+ export type RoutingResult = RoutingMatch & RouteDestination;
100
100
  export interface ViewSet {
101
101
  [viewName: string]: (() => Promise<Module>) | ViewInfo;
102
102
  }
@@ -104,7 +104,7 @@ export interface ViewInfo {
104
104
  module: () => Promise<Module>;
105
105
  specifier: string;
106
106
  }
107
- export declare type RouteCallback = (result: RoutingResult) => void;
107
+ export type RouteCallback = (result: RoutingResult) => void;
108
108
  export interface RouteHandler {
109
109
  dispose(): void;
110
110
  update(routeInfo: RouteInstance): void;
@@ -122,7 +122,7 @@ export interface MessageObject {
122
122
  url?: string;
123
123
  address?: string;
124
124
  }
125
- export declare type QueryObject = NullableStringAttributes;
125
+ export type QueryObject = NullableStringAttributes;
126
126
  export interface StringAttributes {
127
127
  [key: string]: string;
128
128
  }
@@ -12,6 +12,8 @@
12
12
  import { invariant, generateMessage, messages } from 'lwr/routerErrors';
13
13
  import { generateUrl, navigate } from './navigationApi';
14
14
  import { CONTEXT_ID_BACKDOOR } from 'lwr/navigationMixinHacks';
15
+ // eslint-disable-next-line lwr/no-unguarded-apis
16
+ const isSSR = typeof window === 'undefined';
15
17
 
16
18
  /*
17
19
  * Exports the NavigationMixin and CurrentPageReference wire adapter.
@@ -61,12 +63,18 @@ function NavigationMixin(Base) {
61
63
  }
62
64
  }
63
65
  [Navigate](pageRef, replace) {
64
- this[GetContext]();
65
- navigate(this[NavContext], pageRef, replace);
66
+ if (!isSSR) {
67
+ this[GetContext]();
68
+ navigate(this[NavContext], pageRef, replace);
69
+ }
66
70
  }
67
71
  async [GenerateUrl](pageRef) {
68
- this[GetContext]();
69
- return generateUrl(this[NavContext], pageRef);
72
+ if (!isSSR) {
73
+ this[GetContext]();
74
+ return generateUrl(this[NavContext], pageRef);
75
+ } else {
76
+ return null;
77
+ }
70
78
  }
71
79
  }
72
80
  return Mixin;
@@ -5,6 +5,6 @@
5
5
  </template>
6
6
  </div>
7
7
  <div class="outlet" role="region" tabindex="-1">
8
- <lwr-dynamic lwc:dynamic={viewCtor}></lwr-dynamic>
8
+ <lwr-dynamic lwc:dynamic={viewCtor} class="lwr-dynamic"></lwr-dynamic>
9
9
  </div>
10
10
  </template>
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "0.10.0-alpha.15",
8
+ "version": "0.10.0-alpha.17",
9
9
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
10
10
  "repository": {
11
11
  "type": "git",
@@ -43,21 +43,32 @@
43
43
  "pageObjects"
44
44
  ],
45
45
  "scripts": {
46
- "build": "node ../../../bin/pack-lwc --dir src/modules build/modules && yarn utam:compile && yarn build:bundle",
46
+ "build:ts": "tsc -b",
47
+ "build": "yarn build:ts && node ../../../bin/pack-lwc --dir src/modules build/modules && yarn utam:compile && yarn build:bundle",
47
48
  "build:bundle": "rollup --config scripts/rollup.moduleBundle.config.cjs",
48
- "utam:compile": "utam -c utam.config.cjs"
49
+ "utam:compile": "utam -c utam.config.cjs",
50
+ "clean": "rm -rf build",
51
+ "test": "yarn test:client && yarn test:server",
52
+ "test:client": "jest --config ./jest.config.cjs",
53
+ "test:server": "jest --config ./jest.server.config.cjs"
49
54
  },
50
55
  "dependencies": {
51
- "@lwrjs/client-modules": "0.10.0-alpha.15",
52
- "@lwrjs/diagnostics": "0.10.0-alpha.15",
53
- "@lwrjs/shared-utils": "0.10.0-alpha.15",
56
+ "@lwrjs/client-modules": "0.10.0-alpha.17",
57
+ "@lwrjs/diagnostics": "0.10.0-alpha.17",
58
+ "@lwrjs/shared-utils": "0.10.0-alpha.17",
54
59
  "ajv": "6.12.6"
55
60
  },
56
61
  "devDependencies": {
62
+ "@lwc/jest-preset": "^11.8.0",
57
63
  "@rollup/plugin-typescript": "^11.1.0",
64
+ "jest": "^26.6.3",
58
65
  "rollup": "^2.78.0",
66
+ "ts-jest": "^26.5.6",
59
67
  "utam": "^2.0.2"
60
68
  },
69
+ "peerDependencies": {
70
+ "lwc": "~2.46.0"
71
+ },
61
72
  "lwc": {
62
73
  "modules": [
63
74
  {
@@ -84,5 +95,5 @@
84
95
  "volta": {
85
96
  "extends": "../../../package.json"
86
97
  },
87
- "gitHead": "70557f63a46167c40cf1415f12af69f78ae402d6"
98
+ "gitHead": "36cfce3a18bf3dc71a7d5203bbaa9aa752ccce06"
88
99
  }
@@ -5,7 +5,7 @@ var core = require('@utam/core');
5
5
 
6
6
  async function _utam_get_content(driver, root) {
7
7
  let _element = root;
8
- const _locator = core.By.css("lwr-dynamic");
8
+ const _locator = core.By.css(".lwr-dynamic");
9
9
  return _element.findElement(_locator);
10
10
  }
11
11
 
@@ -41,7 +41,7 @@ class Outlet extends core.UtamBaseRootPageObject {
41
41
  async waitForOutletContent() {
42
42
  await this.waitFor(async () => {
43
43
  const _statement0 = await this.__getRoot();
44
- const _result0 = await _statement0.containsElement(core.By.css("lwr-dynamic"), false);
44
+ const _result0 = await _statement0.containsElement(core.By.css(".lwr-dynamic"), false);
45
45
  return _result0;
46
46
  });
47
47
  return this;
@@ -3,7 +3,7 @@ import { By as _By, createUtamMixinCtor as _createUtamMixinCtor, UtamBaseRootPag
3
3
 
4
4
  async function _utam_get_content(driver, root) {
5
5
  let _element = root;
6
- const _locator = _By.css("lwr-dynamic");
6
+ const _locator = _By.css(".lwr-dynamic");
7
7
  return _element.findElement(_locator);
8
8
  }
9
9
 
@@ -39,7 +39,7 @@ export default class Outlet extends _UtamBaseRootPageObject {
39
39
  async waitForOutletContent() {
40
40
  await this.waitFor(async () => {
41
41
  const _statement0 = await this.__getRoot();
42
- const _result0 = await _statement0.containsElement(_By.css("lwr-dynamic"), false);
42
+ const _result0 = await _statement0.containsElement(_By.css(".lwr-dynamic"), false);
43
43
  return _result0;
44
44
  });
45
45
  return this;
@@ -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
@@ -1,24 +0,0 @@
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