graphdb-workbench 4.0.0-RC1 → 4.0.0-RC2

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 (132) hide show
  1. package/dist/10027.05870e3f5f1276be0609.bundle.js +2 -0
  2. package/dist/10027.05870e3f5f1276be0609.bundle.js.map +1 -0
  3. package/dist/43239.143cfe87c9635f5a618a.bundle.js +2 -0
  4. package/dist/43239.143cfe87c9635f5a618a.bundle.js.map +1 -0
  5. package/dist/{49771.75949fd69454e4b2c35c.bundle.js → 49771.e1b5f6312e839e802227.bundle.js} +2 -2
  6. package/dist/49771.e1b5f6312e839e802227.bundle.js.map +1 -0
  7. package/dist/{64709.67552296e3eba61b8f2a.bundle.js → 64709.44c3b845e1c56524a33b.bundle.js} +2 -2
  8. package/dist/{64709.67552296e3eba61b8f2a.bundle.js.map → 64709.44c3b845e1c56524a33b.bundle.js.map} +1 -1
  9. package/dist/65677.b20a7ba3bfea9896d893.bundle.js +2 -0
  10. package/dist/65677.b20a7ba3bfea9896d893.bundle.js.map +1 -0
  11. package/dist/{80933.d0e4a4df57a9ad083d4b.bundle.js → 80933.58506508af6d8a0bf9a8.bundle.js} +2 -2
  12. package/dist/{80933.d0e4a4df57a9ad083d4b.bundle.js.map → 80933.58506508af6d8a0bf9a8.bundle.js.map} +1 -1
  13. package/dist/{82917.764d8d2bd851d0744445.bundle.js → 82917.795572b0c0dee28e1cef.bundle.js} +2 -2
  14. package/dist/{82917.764d8d2bd851d0744445.bundle.js.map → 82917.795572b0c0dee28e1cef.bundle.js.map} +1 -1
  15. package/dist/{86099.e7831890b2b82c8bad04.bundle.js → 86099.1a17cb5538b171ff09a0.bundle.js} +2 -2
  16. package/dist/{86099.e7831890b2b82c8bad04.bundle.js.map → 86099.1a17cb5538b171ff09a0.bundle.js.map} +1 -1
  17. package/dist/9923.1066d5bd24b8a217e613.bundle.js +2 -0
  18. package/dist/9923.1066d5bd24b8a217e613.bundle.js.map +1 -0
  19. package/dist/api/ontotext-workbench-api.js +1 -1
  20. package/dist/api/ontotext-workbench-api.js.map +1 -1
  21. package/dist/api/services/domain/security/auth-strategies/openid-auth-strategy.d.ts +1 -1
  22. package/dist/api/services/domain/security/authentication-storage.service.d.ts +8 -0
  23. package/dist/api/services/domain/security/openid/index.d.ts +2 -2
  24. package/dist/api/services/domain/security/openid/openid-auth-flow-handler.d.ts +1 -1
  25. package/dist/api/services/domain/security/openid/{openid-storage.service.d.ts → openid-local-storage.service.d.ts} +3 -15
  26. package/dist/api/services/domain/security/openid/openid-service.d.ts +2 -1
  27. package/dist/api/services/domain/security/openid/openid-session-storage.service.d.ts +66 -0
  28. package/dist/api/services/domain/security/openid/openid-token-refresh-manager.d.ts +1 -1
  29. package/dist/api/services/domain/security/openid/openid-token-utils.d.ts +2 -1
  30. package/dist/api/services/storage/browser-storage.service.d.ts +63 -0
  31. package/dist/api/services/storage/index.d.ts +1 -0
  32. package/dist/api/services/storage/local-storage.service.d.ts +4 -53
  33. package/dist/api/services/storage/session-storage.service.d.ts +14 -0
  34. package/dist/api/services/storage/test/session-storage.service.spec.d.ts +1 -0
  35. package/dist/assets/i18n/language-config.json +1 -1
  36. package/dist/i18n/locale-en.json +1 -0
  37. package/dist/i18n/locale-fr.json +1 -0
  38. package/dist/index.html +9 -9
  39. package/dist/js/angular/clustermanagement/templates/cluster-configuration/cluster-configuration.html +1 -1
  40. package/dist/js/angular/clustermanagement/templates/cluster-configuration/multi-region.html +1 -1
  41. package/dist/js/angular/clustermanagement/templates/cluster-nodes-configuration.html +1 -1
  42. package/dist/js/angular/core/directives/autocomplete/templates/autocomplete.html +1 -1
  43. package/dist/js/angular/core/directives/dynamic-form/templates/dynamic-form.html +1 -1
  44. package/dist/js/angular/core/directives/operations-statuses-monitor/templates/operations-statuses-monitor.html +1 -1
  45. package/dist/js/angular/core/directives/rdfresourcesearch/templates/rdfResourceSearchTemplate.html +1 -1
  46. package/dist/js/angular/core/directives/shuttle-multiselect/templates/shuttle-multiselect.html +1 -1
  47. package/dist/js/angular/core/directives/yasgui-component/templates/yasgui-component.html +7 -7
  48. package/dist/js/angular/core/templates/cookie-policy/cookie-consent.html +1 -1
  49. package/dist/js/angular/core/templates/cookie-policy/cookie-policy.html +1 -1
  50. package/dist/js/angular/core/templates/core-errors.html +1 -1
  51. package/dist/js/angular/core/templates/editable-content/editable-content.html +1 -1
  52. package/dist/js/angular/core/templates/markdown-content/markdown-content.html +1 -1
  53. package/dist/js/angular/core/templates/search-resource-input.html +1 -1
  54. package/dist/js/angular/graphql/templates/create-graphql-endpoint.html +2 -2
  55. package/dist/js/angular/graphql/templates/graphql-endpoint-management.html +1 -1
  56. package/dist/js/angular/graphql/templates/graphql-playground.html +2 -2
  57. package/dist/js/angular/graphql/templates/modal/endpoint-configuration-modal.html +1 -1
  58. package/dist/js/angular/graphql/templates/modal/endpoint-generation-failure-result-modal.html +1 -1
  59. package/dist/js/angular/graphql/templates/modal/import-endpoint-definition-modal.html +1 -1
  60. package/dist/js/angular/security/templates/user.html +2 -2
  61. package/dist/js/angular/security/templates/users.html +1 -1
  62. package/dist/js/angular/templates/repositorySize.html +1 -1
  63. package/dist/js/angular/ttyg/templates/agent-list.html +1 -1
  64. package/dist/js/angular/ttyg/templates/agent-select-menu.html +1 -1
  65. package/dist/js/angular/ttyg/templates/chat-item-detail.html +1 -1
  66. package/dist/js/angular/ttyg/templates/chat-list.html +1 -1
  67. package/dist/js/angular/ttyg/templates/chat-panel.html +1 -1
  68. package/dist/js/angular/ttyg/templates/modal/agent-instructions-explain-modal.html +1 -1
  69. package/dist/js/angular/ttyg/templates/modal/agent-settings-modal.html +3 -3
  70. package/dist/js/angular/ttyg/templates/modal/external-integration-configuration-modal.html +1 -1
  71. package/dist/js/angular/ttyg/templates/no-agents-view.html +1 -1
  72. package/dist/js/angular/ttyg/templates/ttyg.html +1 -1
  73. package/dist/{legacyWorkbench.2c1399d4d4593717e6da.js → legacyWorkbench.3fcfc1f854dc1b7c2d8c.js} +3 -3
  74. package/dist/{legacyWorkbench.2c1399d4d4593717e6da.js.map → legacyWorkbench.3fcfc1f854dc1b7c2d8c.js.map} +1 -1
  75. package/dist/license-checker.json +41 -1358
  76. package/dist/{main.ae5ef2a30e968308898a.js → main.96208465fa22f8a3a038.js} +3 -3
  77. package/dist/{main.ae5ef2a30e968308898a.js.map → main.96208465fa22f8a3a038.js.map} +1 -1
  78. package/dist/pages/aclmanagement.html +1 -1
  79. package/dist/pages/autocomplete.html +1 -1
  80. package/dist/pages/choose-repository-type.html +1 -1
  81. package/dist/pages/cluster-management/clusterInfo.html +2 -2
  82. package/dist/pages/create-index.html +1 -1
  83. package/dist/pages/dependencies.html +1 -1
  84. package/dist/pages/domainRangeInfo.html +2 -2
  85. package/dist/pages/edit.html +6 -5
  86. package/dist/pages/explore.html +1 -1
  87. package/dist/pages/export.html +1 -1
  88. package/dist/pages/graph-config/saveGraphConfig.html +8 -8
  89. package/dist/pages/graphs-visualizations.html +7 -7
  90. package/dist/pages/guides.html +1 -1
  91. package/dist/pages/home.html +1 -1
  92. package/dist/pages/import.html +2 -2
  93. package/dist/pages/jdbc-create.html +1 -1
  94. package/dist/pages/jdbc.html +1 -1
  95. package/dist/pages/monitor/backup-and-restore.html +1 -1
  96. package/dist/pages/monitor/queries.html +1 -1
  97. package/dist/pages/monitor/resources.html +1 -1
  98. package/dist/pages/namespaces.html +2 -2
  99. package/dist/pages/plugins.html +1 -1
  100. package/dist/pages/rdfClassHierarchyInfo.html +8 -8
  101. package/dist/pages/rdfrank.html +2 -2
  102. package/dist/pages/repositories.html +1 -1
  103. package/dist/pages/repository.html +1 -1
  104. package/dist/pages/similarity-indexes.html +1 -1
  105. package/dist/pages/sparql-editor.html +1 -1
  106. package/dist/pages/sparql-template-create.html +1 -1
  107. package/dist/pages/sparql-templates.html +1 -1
  108. package/dist/pages/ux-test1.html +2 -2
  109. package/dist/res/swagger5/index.html +8 -8
  110. package/dist/sbom.cdx.json +2379 -8267
  111. package/dist/shared-components/cjs/onto-layout.cjs.entry.js +1 -1
  112. package/dist/shared-components/collection/components/onto-layout/onto-layout.js +1 -1
  113. package/dist/shared-components/esm/onto-layout.entry.js +1 -1
  114. package/dist/shared-components/shared-components/p-474b4bf3.entry.js +1 -0
  115. package/dist/shared-components/shared-components/shared-components.esm.js +1 -1
  116. package/dist/shared-components/types/components/onto-layout/onto-layout.d.ts +2 -3
  117. package/dist/workbench/workbench/697.0331f4fea7f04707.js +1 -0
  118. package/dist/workbench/workbench/workbenchApp.js +1 -1
  119. package/package.json +1 -1
  120. package/dist/10027.209fde0e712bf6c356d3.bundle.js +0 -2
  121. package/dist/10027.209fde0e712bf6c356d3.bundle.js.map +0 -1
  122. package/dist/43239.c76fc77febaf50657b13.bundle.js +0 -2
  123. package/dist/43239.c76fc77febaf50657b13.bundle.js.map +0 -1
  124. package/dist/49771.75949fd69454e4b2c35c.bundle.js.map +0 -1
  125. package/dist/65677.9c399bbb23b8b4478225.bundle.js +0 -2
  126. package/dist/65677.9c399bbb23b8b4478225.bundle.js.map +0 -1
  127. package/dist/9923.b1935ab381c7e60a9898.bundle.js +0 -2
  128. package/dist/9923.b1935ab381c7e60a9898.bundle.js.map +0 -1
  129. package/dist/shared-components/shared-components/p-6fd8a7ef.entry.js +0 -1
  130. package/dist/workbench/workbench/697.8c546098c3e91234.js +0 -1
  131. /package/dist/{legacyWorkbench.2c1399d4d4593717e6da.js.LICENSE.txt → legacyWorkbench.3fcfc1f854dc1b7c2d8c.js.LICENSE.txt} +0 -0
  132. /package/dist/{main.ae5ef2a30e968308898a.js.LICENSE.txt → main.96208465fa22f8a3a038.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- "use strict";var index=require("./index-CTK5NoJt.js"),functionUtils=require("./function-utils-WB47AWpR.js"),workbenchApi=require("@ontotext/workbench-api"),translation_service=require("./translation.service-U_N3G2Ni.js");require("./logger-provider-DmxeCVVR.js");const RESPONSIVE_BREAKPOINTS={MD:768},WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR=RESPONSIVE_BREAKPOINTS.MD,ontoLayoutCss=':host{display:block;height:100%}.wb-layout{display:grid;grid-template:"header header" auto "nav main" 1fr "nav footer" auto/15rem minmax(200px, 1fr);min-height:100vh;margin:0;}.wb-layout.expanded{grid-template-columns:4.375rem 1fr}.wb-layout.is-embedded{grid-template-columns:1fr;grid-template-areas:"main";padding-top:1rem}.wb-layout.hide-navbar{grid-template:"header" auto "main" 1fr "footer" auto/1fr;}.wb-layout.hide-navbar.expanded{grid-template-columns:1fr}.wb-layout main .main-container{margin-left:0}.wb-layout main{grid-area:main}.wb-layout main:focus{outline:none}.wb-layout.loading main{position:relative;visibility:hidden}.wb-layout .default-slot-wrapper{display:none}.wb-layout .wb-header{grid-area:header;position:sticky;top:0;z-index:999}.wb-layout nav{grid-area:nav}.wb-layout footer{grid-area:footer}.wb-layout .skip-link:not(:focus){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.wb-layout .skip-link:focus{position:fixed;top:0.5rem;left:0.5rem;z-index:1000;display:inline-flex;align-items:center;gap:var(--gw-button-gap);padding:var(--gw-button-padding-y) var(--gw-button-padding-x);border:1px solid var(--gw-button-secondary-border-color);border-radius:var(--gw-button-border-radius);background:var(--gw-background-elevated);color:var(--gw-button-secondary-color);font-family:var(--gw-button-label-typography-font-family);font-size:var(--gw-button-label-typography-font-size);font-weight:var(--gw-button-label-typography-font-weight);line-height:var(--gw-button-label-typography-line-height);text-decoration:none;white-space:nowrap;outline:var(--gw-button-focus-ring-width) var(--gw-button-focus-ring-style) var(--gw-button-secondary-focus-ring-color);outline-offset:var(--gw-button-focus-ring-offset)}.wb-layout .skip-link:focus:hover{border-color:var(--gw-button-secondary-hover-border-color);color:var(--gw-button-secondary-hover-color)}.wb-layout .skip-link:focus:active{border-color:var(--gw-button-secondary-active-border-color);color:var(--gw-button-secondary-active-color)}',MAIN_CONTENT_ID="main-content",NAVBAR_ID="navbar",POINTER_TYPES={MOUSE:"mouse",TOUCH:"touch",PEN:"pen"},OntoLayout=class{constructor(e){index.registerInstance(this,e),this.authenticationService=workbenchApi.service(workbenchApi.AuthenticationService),this.authorizationService=workbenchApi.service(workbenchApi.AuthorizationService),this.navigationContextService=workbenchApi.service(workbenchApi.NavigationContextService),this.authStorageService=workbenchApi.service(workbenchApi.AuthenticationStorageService),this.runtimeConfigurationContextService=workbenchApi.service(workbenchApi.RuntimeConfigurationContextService),this.eventService=workbenchApi.service(workbenchApi.EventService),this.applicationLifecycleContextService=workbenchApi.service(workbenchApi.ApplicationLifecycleContextService),this.fullJwtKey=`${workbenchApi.StorageKey.GLOBAL_NAMESPACE}.${this.authStorageService.NAMESPACE}.${this.authStorageService.jwtKey}`,this.fullAuthenticatedKey=`${workbenchApi.StorageKey.GLOBAL_NAMESPACE}.${this.authStorageService.NAMESPACE}.${this.authStorageService.authenticatedKey}`,this.authEvents=[this.fullJwtKey,this.fullAuthenticatedKey],this.isLowResolution=!1,this.showHeader=this.isAuthenticatedFully(),this.showNavbar=!1,this.isEmbedded=!1,this.loading=!0,this.subscriptions=new workbenchApi.SubscriptionList,this.isNavbarCollapsed=!1,this.shouldFocusMainContentAfterLoading=!1,this.isPageChanging=!1,this.onSkipLinkClick=e=>{e.preventDefault(),this.focusMainContent()},this.handleStorageChange=e=>{workbenchApi.service(workbenchApi.LocalStorageSubscriptionHandlerService).handleStorageChange(e),this.handleAuthChange(e.key)},this.windowResizeObserver=functionUtils.debounce(()=>this.windowResizeHandler(),50),workbenchApi.WindowService.getWindow().addEventListener("storage",this.handleStorageChange)}componentWillLoad(){this.applicationLifecycleContextService.getApplicationsState()&&(this.loading=!1),this.keepMainContentInPlace()}componentDidRender(){this.windowResizeHandler(),this.shouldFocusMainContentAfterLoading&&!this.loading&&(this.shouldFocusMainContentAfterLoading=!1,(translation_service.isFocusLost()||this.isFocusInNavbar())&&this.focusMainContent())}connectedCallback(){this.subscribeToSecurityChanges(),this.updateVisibility(),this.subscribeToNavigationEnd(),this.subscribeToRuntimeConfigurationChanges(),this.subscribeToNavigationStart(),this.subscribeToBeforeMountRouting()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}render(){return index.h(index.Host,{key:"cf3499ffab935630b1a6f5418707e125d49bea64",class:{"wb-layout":!0,"is-embedded":this.isEmbedded,"hide-navbar":!this.showNavbar,loading:this.loading}},!this.isEmbedded&&this.showNavbar&&index.h("a",{key:"b5cbb0f69e2a7684c96a28be6f0b33cf0ce92f1e",class:"skip-link",href:"#main-content",onClick:this.onSkipLinkClick},index.h("translate-label",{key:"48bc88ceb3d26c655a057df035494c8c73c1525a",labelKey:"layout.skip_to_main_content"})),index.h("div",{key:"a9324c1ac2c5ae522e0790a6628c9adc881b4442",class:"default-slot-wrapper"},index.h("slot",{key:"fb79a12af9f53ecc5a3760638e65e1b7bd362542",name:"default"})),!this.isEmbedded&&index.h("div",{key:"53d252627426b22677b512c169c55615b00fc8af",class:"wb-header"},index.h("header",{key:"7878ea9d5a00c19c83020b0a13fa79d493fc21f9"},this.showHeader&&index.h("onto-header",{key:"57aef16e9fb847c90c5e9a8b600327e0537caed5"}))),!this.isEmbedded&&this.showNavbar&&index.h("nav",{key:"5e3611d14501c19396d493e16a3539f5cd31bf88",class:"wb-navbar"},index.h("onto-navbar",{key:"23477f1077adf3a45cc2271351b247450e405041",ref:this.assignNavbarRef(),"navbar-collapsed":this.isLowResolution})),index.h("slot",{key:"2d33a33a7ede92666a935d8c2a5ca39f52f9cb9b",name:"main"},index.h("onto-loader",{key:"61910e13a38677899006f35bc4ef41c3c93b4a49",loading:this.loading,targetSelector:"main",size:96,messageText:translation_service.TranslationService.translate("common.loading")})),!this.isEmbedded&&index.h("footer",{key:"3f25bad884d021a76a22ffe028a15e24960974c2",class:"wb-footer"},index.h("onto-footer",{key:"fa4818df751564c12e0df2a52810286e42c3415b"})))}onNavbarToggled(e){this.isNavbarCollapsed=e.detail.payload,this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}onResize(){this.windowResizeObserver()}handleDocumentKeydown(e){if("Tab"===e.key&&e.shiftKey){const t=document.querySelector('[data-backward-focus-target="true"]');t&&(e.preventDefault(),this.focusBackwardTargetInNav(t))}}handleGlobalFocus(e){const t=document.querySelector('[data-backward-focus-target="true"]');t&&"main-content"!==e.target.getAttribute("id")&&delete t.dataset.backwardFocusTarget}focusMainContent(){var e;null===(e=document.getElementById("main-content"))||void 0===e||e.focus()}windowResizeHandler(){var e,t,i,n,a;this.isLowResolution=workbenchApi.WindowService.getWindow().innerWidth<=WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR;const o=document.querySelector(".navbar-component"),s=null!==(i=null===(t=null===(e=document.querySelector(".wb-header"))||void 0===e?void 0:e.getBoundingClientRect())||void 0===t?void 0:t.height)&&void 0!==i?i:0;if(document.documentElement.style.setProperty("--wb-header-height",`${s}px`),o){const e=document.querySelector(".cookie-consent-banner"),t=null!==(a=null===(n=null==e?void 0:e.getBoundingClientRect())||void 0===n?void 0:n.height)&&void 0!==a?a:0;o.style.height=`calc(100% - ${s}px - ${t}px)`}this.isLowResolution||this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}handleAuthChange(e){var t;e&&this.authEvents.includes(e)&&(this.authStorageService.isAuthenticated()?workbenchApi.navigate(null!==(t=this.navigationContextService.getPreviousRoute())&&void 0!==t?t:"./"):workbenchApi.isLoginPage()||workbenchApi.navigateToLoginPage(),workbenchApi.WindowService.getWindow().location.reload())}focusBackwardTargetInNav(e){var t,i;if(null==e?void 0:e.classList.contains("sub-menu-link")){const n=null===(i=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement)||void 0===i?void 0:i.previousElementSibling;"false"===(null==n?void 0:n.getAttribute("aria-expanded"))&&n.click()}setTimeout(()=>{e.focus(),delete e.dataset.backwardFocusTarget},10)}keepMainContentInPlace(){const e=this.hostElement,t=e.insertBefore.bind(e);e.insertBefore=(i,n)=>i.parentNode===e&&"MAIN"===i.nodeName&&n===e.firstChild?i:t(i,n)}subscribeToSecurityChanges(){const e=workbenchApi.service(workbenchApi.SecurityContextService);this.subscriptions.add(e.onAuthenticatedUserChanged(e=>{this.authenticatedUser=e,this.updateVisibility()})),this.subscriptions.add(e.onSecurityConfigChanged(e=>{this.securityConfig=e,this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(workbenchApi.EventName.LOGIN,()=>{this.setNavbarItemVisibility(),this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(workbenchApi.EventName.LOGGED_OUT,()=>{this.setNavbarItemVisibility(),this.updateVisibility(),workbenchApi.navigateToLoginPage()}))}subscribeToRuntimeConfigurationChanges(){this.subscriptions.add(this.runtimeConfigurationContextService.onRuntimeConfigurationChanged(e=>{var t;this.isEmbedded=null!==(t=null==e?void 0:e.isEmbedded)&&void 0!==t&&t}))}updateVisibility(){this.authenticationService.isSecurityEnabled()?(this.showHeader=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess(),this.showNavbar=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()):(this.showNavbar=!0,this.showHeader=!0)}isAuthenticatedFully(){return!this.authenticationService.isSecurityEnabled()||this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()}shouldShowMenu(e){return this.isAuthenticatedFully()&&this.authorizationService.hasRole(e)}assignNavbarRef(){return e=>{this.navbarRef=e,this.navbarRef&&(this.navbarRef.menuItems=workbenchApi.WindowService.getPluginRegistry().get(workbenchApi.MainMenuExtensionPoint.NAME),this.setNavbarItemVisibility())}}setNavbarItemVisibility(){var e,t,i;if(!(null===(e=this.navbarRef)||void 0===e?void 0:e.menuItems))return;const n=e=>{var t;e.shouldShow=this.shouldShowMenu(e.role),(null===(t=e.children)||void 0===t?void 0:t.length)&&e.children.forEach(n)};null===(i=null===(t=this.navbarRef)||void 0===t?void 0:t.menuItems)||void 0===i||i.forEach(e=>{e.items.forEach(n)}),this.navbarRef.menuItems=[...this.navbarRef.menuItems]}subscribeToNavigationEnd(){this.subscriptions.add(this.eventService.subscribe(workbenchApi.EventName.NAVIGATION_END,e=>{this.navigationContextService.updatePreviousRoute(e.oldUrl),this.focusMainContentOnPageChange(e),setTimeout(()=>{this.loading=!1})}))}focusMainContentOnPageChange({oldUrl:e,newUrl:t}){!e||workbenchApi.isSamePage(e,t)||!this.isFocusInNavbar()&&!this.isFocusLostOrInMainContent()||this.isFocusInNavbar()&&this.isPointerNavigation()||(this.loading?this.shouldFocusMainContentAfterLoading=!0:this.focusMainContent())}isFocusLostOrInMainContent(){var e;return translation_service.isFocusLost()||!!(null===(e=document.getElementById("main-content"))||void 0===e?void 0:e.contains(document.activeElement))}isFocusInNavbar(){var e;return!!(null===(e=document.getElementById("navbar"))||void 0===e?void 0:e.contains(document.activeElement))}isPointerNavigation(){var e,t;const i=null===(e=document.activeElement)||void 0===e?void 0:e.dataset.pointerType;return null===(t=document.activeElement)||void 0===t||delete t.dataset.pointerType,i===POINTER_TYPES.MOUSE||i===POINTER_TYPES.TOUCH||i===POINTER_TYPES.PEN}subscribeToNavigationStart(){this.subscriptions.add(this.eventService.subscribe(workbenchApi.EventName.NAVIGATION_START,({oldUrl:e,newUrl:t})=>{this.isPageChanging=!e||!t||!workbenchApi.isSamePage(e,t);const i=document.querySelector('[data-backward-focus-target="true"]');this.isPageChanging&&"page"===(null==i?void 0:i.dataset.ariaCurrent)&&delete i.dataset.backwardFocusTarget}))}subscribeToBeforeMountRouting(){this.subscriptions.add(this.eventService.subscribe(workbenchApi.EventName.BEFORE_MOUNT_ROUTING_EVENT,()=>{this.isPageChanging&&(this.loading=!0)}))}get hostElement(){return index.getElement(this)}};OntoLayout.style=ontoLayoutCss,exports.onto_layout=OntoLayout;
1
+ "use strict";var index=require("./index-CTK5NoJt.js"),functionUtils=require("./function-utils-WB47AWpR.js"),workbenchApi=require("@ontotext/workbench-api"),translation_service=require("./translation.service-U_N3G2Ni.js");require("./logger-provider-DmxeCVVR.js");const RESPONSIVE_BREAKPOINTS={MD:768},WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR=RESPONSIVE_BREAKPOINTS.MD,ontoLayoutCss=':host{display:block;height:100%}.wb-layout{display:grid;grid-template:"header header" auto "nav main" 1fr "nav footer" auto/15rem minmax(200px, 1fr);min-height:100vh;margin:0;}.wb-layout.expanded{grid-template-columns:4.375rem 1fr}.wb-layout.is-embedded{grid-template-columns:1fr;grid-template-areas:"main";padding-top:1rem}.wb-layout.hide-navbar{grid-template:"header" auto "main" 1fr "footer" auto/1fr;}.wb-layout.hide-navbar.expanded{grid-template-columns:1fr}.wb-layout main .main-container{margin-left:0}.wb-layout main{grid-area:main}.wb-layout main:focus{outline:none}.wb-layout.loading main{position:relative;visibility:hidden}.wb-layout .default-slot-wrapper{display:none}.wb-layout .wb-header{grid-area:header;position:sticky;top:0;z-index:999}.wb-layout nav{grid-area:nav}.wb-layout footer{grid-area:footer}.wb-layout .skip-link:not(:focus){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.wb-layout .skip-link:focus{position:fixed;top:0.5rem;left:0.5rem;z-index:1000;display:inline-flex;align-items:center;gap:var(--gw-button-gap);padding:var(--gw-button-padding-y) var(--gw-button-padding-x);border:1px solid var(--gw-button-secondary-border-color);border-radius:var(--gw-button-border-radius);background:var(--gw-background-elevated);color:var(--gw-button-secondary-color);font-family:var(--gw-button-label-typography-font-family);font-size:var(--gw-button-label-typography-font-size);font-weight:var(--gw-button-label-typography-font-weight);line-height:var(--gw-button-label-typography-line-height);text-decoration:none;white-space:nowrap;outline:var(--gw-button-focus-ring-width) var(--gw-button-focus-ring-style) var(--gw-button-secondary-focus-ring-color);outline-offset:var(--gw-button-focus-ring-offset)}.wb-layout .skip-link:focus:hover{border-color:var(--gw-button-secondary-hover-border-color);color:var(--gw-button-secondary-hover-color)}.wb-layout .skip-link:focus:active{border-color:var(--gw-button-secondary-active-border-color);color:var(--gw-button-secondary-active-color)}',MAIN_CONTENT_ID="main-content",NAVBAR_ID="navbar",POINTER_TYPES={MOUSE:"mouse",TOUCH:"touch",PEN:"pen"},OntoLayout=class{constructor(e){index.registerInstance(this,e),this.authenticationService=workbenchApi.service(workbenchApi.AuthenticationService),this.authorizationService=workbenchApi.service(workbenchApi.AuthorizationService),this.navigationContextService=workbenchApi.service(workbenchApi.NavigationContextService),this.authStorageService=workbenchApi.service(workbenchApi.AuthenticationStorageService),this.runtimeConfigurationContextService=workbenchApi.service(workbenchApi.RuntimeConfigurationContextService),this.eventService=workbenchApi.service(workbenchApi.EventService),this.applicationLifecycleContextService=workbenchApi.service(workbenchApi.ApplicationLifecycleContextService),this.isLowResolution=!1,this.showHeader=this.isAuthenticatedFully(),this.showNavbar=!1,this.isEmbedded=!1,this.loading=!0,this.subscriptions=new workbenchApi.SubscriptionList,this.isNavbarCollapsed=!1,this.shouldFocusMainContentAfterLoading=!1,this.isPageChanging=!1,this.onSkipLinkClick=e=>{e.preventDefault(),this.focusMainContent()},this.handleStorageChange=e=>{workbenchApi.service(workbenchApi.LocalStorageSubscriptionHandlerService).handleStorageChange(e),this.handleAuthChange(e)},this.windowResizeObserver=functionUtils.debounce(()=>this.windowResizeHandler(),50),workbenchApi.WindowService.getWindow().addEventListener("storage",this.handleStorageChange)}componentWillLoad(){this.applicationLifecycleContextService.getApplicationsState()&&(this.loading=!1),this.keepMainContentInPlace()}componentDidRender(){this.windowResizeHandler(),this.shouldFocusMainContentAfterLoading&&!this.loading&&(this.shouldFocusMainContentAfterLoading=!1,(translation_service.isFocusLost()||this.isFocusInNavbar())&&this.focusMainContent())}connectedCallback(){this.subscribeToSecurityChanges(),this.updateVisibility(),this.subscribeToNavigationEnd(),this.subscribeToRuntimeConfigurationChanges(),this.subscribeToNavigationStart(),this.subscribeToBeforeMountRouting()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}render(){return index.h(index.Host,{key:"f7f6a6693d18706500b4fe2c673b73b98b2f00e5",class:{"wb-layout":!0,"is-embedded":this.isEmbedded,"hide-navbar":!this.showNavbar,loading:this.loading}},!this.isEmbedded&&this.showNavbar&&index.h("a",{key:"2ea3be35ef8760f274d111c7905e5eec77d7c223",class:"skip-link",href:"#main-content",onClick:this.onSkipLinkClick},index.h("translate-label",{key:"9180fb5679ba2217e90ae82ecb7b5a846701e869",labelKey:"layout.skip_to_main_content"})),index.h("div",{key:"ca67fad66bf841788559949a14ef6f42824ef1b4",class:"default-slot-wrapper"},index.h("slot",{key:"53fdd44af4a62c34c62aaaa21ead722b2d0779d9",name:"default"})),!this.isEmbedded&&index.h("div",{key:"3151e880de91936c4f03e4a95b644c8a69d54802",class:"wb-header"},index.h("header",{key:"cc5bc9fadd30ce7d84fc1ca1023581fca4e33fb8"},this.showHeader&&index.h("onto-header",{key:"a662796027e6123bc6a6812f834ee09482b2fafd"}))),!this.isEmbedded&&this.showNavbar&&index.h("nav",{key:"2387a8895fbcb79038b3a34a6bb53cf38832a2fb",class:"wb-navbar"},index.h("onto-navbar",{key:"2046abd26597b1b7dc8a3e89e48174cd539975b4",ref:this.assignNavbarRef(),"navbar-collapsed":this.isLowResolution})),index.h("slot",{key:"c930ad38ffb03603e9bd5925e19894f0982e903d",name:"main"},index.h("onto-loader",{key:"2b4bebbd3d939cdf8945eac6ba18bb98cb42b5c9",loading:this.loading,targetSelector:"main",size:96,messageText:translation_service.TranslationService.translate("common.loading")})),!this.isEmbedded&&index.h("footer",{key:"54e1e902d788fcd3915d3cd064770ff4b23044c0",class:"wb-footer"},index.h("onto-footer",{key:"af31f0fbe1e9bbc427ad0471a1092baa08f797ce"})))}onNavbarToggled(e){this.isNavbarCollapsed=e.detail.payload,this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}onResize(){this.windowResizeObserver()}handleDocumentKeydown(e){if("Tab"===e.key&&e.shiftKey){const t=document.querySelector('[data-backward-focus-target="true"]');t&&(e.preventDefault(),this.focusBackwardTargetInNav(t))}}handleGlobalFocus(e){const t=document.querySelector('[data-backward-focus-target="true"]');t&&"main-content"!==e.target.getAttribute("id")&&delete t.dataset.backwardFocusTarget}focusMainContent(){var e;null===(e=document.getElementById("main-content"))||void 0===e||e.focus()}windowResizeHandler(){var e,t,i,n,a;this.isLowResolution=workbenchApi.WindowService.getWindow().innerWidth<=WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR;const o=document.querySelector(".navbar-component"),s=null!==(i=null===(t=null===(e=document.querySelector(".wb-header"))||void 0===e?void 0:e.getBoundingClientRect())||void 0===t?void 0:t.height)&&void 0!==i?i:0;if(document.documentElement.style.setProperty("--wb-header-height",`${s}px`),o){const e=document.querySelector(".cookie-consent-banner"),t=null!==(a=null===(n=null==e?void 0:e.getBoundingClientRect())||void 0===n?void 0:n.height)&&void 0!==a?a:0;o.style.height=`calc(100% - ${s}px - ${t}px)`}this.isLowResolution||this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}handleAuthChange(e){var t;if(!this.authStorageService.isLoginOrLogout(e))return;const i=this.authStorageService.isAuthenticated();i!==this.lastAuthenticatedState&&(this.lastAuthenticatedState=i,i?workbenchApi.navigate(null!==(t=this.navigationContextService.getPreviousRoute())&&void 0!==t?t:"./"):workbenchApi.isLoginPage()||workbenchApi.navigateToLoginPage(),workbenchApi.WindowService.getWindow().location.reload())}focusBackwardTargetInNav(e){var t,i;if(null==e?void 0:e.classList.contains("sub-menu-link")){const n=null===(i=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement)||void 0===i?void 0:i.previousElementSibling;"false"===(null==n?void 0:n.getAttribute("aria-expanded"))&&n.click()}setTimeout(()=>{e.focus(),delete e.dataset.backwardFocusTarget},10)}keepMainContentInPlace(){const e=this.hostElement,t=e.insertBefore.bind(e);e.insertBefore=(i,n)=>i.parentNode===e&&"MAIN"===i.nodeName&&n===e.firstChild?i:t(i,n)}subscribeToSecurityChanges(){const e=workbenchApi.service(workbenchApi.SecurityContextService);this.subscriptions.add(e.onAuthenticatedUserChanged(e=>{this.authenticatedUser=e,this.updateVisibility()})),this.subscriptions.add(e.onSecurityConfigChanged(e=>{this.securityConfig=e,this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(workbenchApi.EventName.LOGIN,()=>{this.setNavbarItemVisibility(),this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(workbenchApi.EventName.LOGGED_OUT,()=>{this.setNavbarItemVisibility(),this.updateVisibility(),workbenchApi.navigateToLoginPage()}))}subscribeToRuntimeConfigurationChanges(){this.subscriptions.add(this.runtimeConfigurationContextService.onRuntimeConfigurationChanged(e=>{var t;this.isEmbedded=null!==(t=null==e?void 0:e.isEmbedded)&&void 0!==t&&t}))}updateVisibility(){this.authenticationService.isSecurityEnabled()?(this.showHeader=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess(),this.showNavbar=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()):(this.showNavbar=!0,this.showHeader=!0)}isAuthenticatedFully(){return!this.authenticationService.isSecurityEnabled()||this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()}shouldShowMenu(e){return this.isAuthenticatedFully()&&this.authorizationService.hasRole(e)}assignNavbarRef(){return e=>{this.navbarRef=e,this.navbarRef&&(this.navbarRef.menuItems=workbenchApi.WindowService.getPluginRegistry().get(workbenchApi.MainMenuExtensionPoint.NAME),this.setNavbarItemVisibility())}}setNavbarItemVisibility(){var e,t,i;if(!(null===(e=this.navbarRef)||void 0===e?void 0:e.menuItems))return;const n=e=>{var t;e.shouldShow=this.shouldShowMenu(e.role),(null===(t=e.children)||void 0===t?void 0:t.length)&&e.children.forEach(n)};null===(i=null===(t=this.navbarRef)||void 0===t?void 0:t.menuItems)||void 0===i||i.forEach(e=>{e.items.forEach(n)}),this.navbarRef.menuItems=[...this.navbarRef.menuItems]}subscribeToNavigationEnd(){this.subscriptions.add(this.eventService.subscribe(workbenchApi.EventName.NAVIGATION_END,e=>{this.navigationContextService.updatePreviousRoute(e.oldUrl),this.focusMainContentOnPageChange(e),setTimeout(()=>{this.loading=!1})}))}focusMainContentOnPageChange({oldUrl:e,newUrl:t}){!e||workbenchApi.isSamePage(e,t)||!this.isFocusInNavbar()&&!this.isFocusLostOrInMainContent()||this.isFocusInNavbar()&&this.isPointerNavigation()||(this.loading?this.shouldFocusMainContentAfterLoading=!0:this.focusMainContent())}isFocusLostOrInMainContent(){var e;return translation_service.isFocusLost()||!!(null===(e=document.getElementById("main-content"))||void 0===e?void 0:e.contains(document.activeElement))}isFocusInNavbar(){var e;return!!(null===(e=document.getElementById("navbar"))||void 0===e?void 0:e.contains(document.activeElement))}isPointerNavigation(){var e,t;const i=null===(e=document.activeElement)||void 0===e?void 0:e.dataset.pointerType;return null===(t=document.activeElement)||void 0===t||delete t.dataset.pointerType,i===POINTER_TYPES.MOUSE||i===POINTER_TYPES.TOUCH||i===POINTER_TYPES.PEN}subscribeToNavigationStart(){this.subscriptions.add(this.eventService.subscribe(workbenchApi.EventName.NAVIGATION_START,({oldUrl:e,newUrl:t})=>{this.isPageChanging=!e||!t||!workbenchApi.isSamePage(e,t);const i=document.querySelector('[data-backward-focus-target="true"]');this.isPageChanging&&"page"===(null==i?void 0:i.dataset.ariaCurrent)&&delete i.dataset.backwardFocusTarget}))}subscribeToBeforeMountRouting(){this.subscriptions.add(this.eventService.subscribe(workbenchApi.EventName.BEFORE_MOUNT_ROUTING_EVENT,()=>{this.isPageChanging&&(this.loading=!0)}))}get hostElement(){return index.getElement(this)}};OntoLayout.style=ontoLayoutCss,exports.onto_layout=OntoLayout;
@@ -1 +1 @@
1
- import{h,Host}from"@stencil/core";import{debounce}from"../../utils/function-utils";import{WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR}from"../../models/constants";import{ApplicationLifecycleContextService,AuthenticationService,AuthenticationStorageService,AuthorizationService,EventName,EventService,isSamePage,LocalStorageSubscriptionHandlerService,navigate,NavigationContextService,RuntimeConfigurationContextService,SecurityContextService,service,StorageKey,SubscriptionList,WindowService,MainMenuExtensionPoint,navigateToLoginPage,isLoginPage}from"../../../../../api/dist/ontotext-workbench-api";import{TranslationService}from"../../services/translation.service";import{isFocusLost}from"../../utils/html-utils";const MAIN_CONTENT_ID="main-content",NAVBAR_ID="navbar",POINTER_TYPES={MOUSE:"mouse",TOUCH:"touch",PEN:"pen"};export class OntoLayout{constructor(){this.authenticationService=service(AuthenticationService),this.authorizationService=service(AuthorizationService),this.navigationContextService=service(NavigationContextService),this.authStorageService=service(AuthenticationStorageService),this.runtimeConfigurationContextService=service(RuntimeConfigurationContextService),this.eventService=service(EventService),this.applicationLifecycleContextService=service(ApplicationLifecycleContextService),this.fullJwtKey=`${StorageKey.GLOBAL_NAMESPACE}.${this.authStorageService.NAMESPACE}.${this.authStorageService.jwtKey}`,this.fullAuthenticatedKey=`${StorageKey.GLOBAL_NAMESPACE}.${this.authStorageService.NAMESPACE}.${this.authStorageService.authenticatedKey}`,this.authEvents=[this.fullJwtKey,this.fullAuthenticatedKey],this.isLowResolution=!1,this.showHeader=this.isAuthenticatedFully(),this.showNavbar=!1,this.isEmbedded=!1,this.loading=!0,this.subscriptions=new SubscriptionList,this.isNavbarCollapsed=!1,this.shouldFocusMainContentAfterLoading=!1,this.isPageChanging=!1,this.onSkipLinkClick=e=>{e.preventDefault(),this.focusMainContent()},this.handleStorageChange=e=>{service(LocalStorageSubscriptionHandlerService).handleStorageChange(e),this.handleAuthChange(e.key)},this.windowResizeObserver=debounce(()=>this.windowResizeHandler(),50),WindowService.getWindow().addEventListener("storage",this.handleStorageChange)}componentWillLoad(){this.applicationLifecycleContextService.getApplicationsState()&&(this.loading=!1),this.keepMainContentInPlace()}componentDidRender(){this.windowResizeHandler(),this.shouldFocusMainContentAfterLoading&&!this.loading&&(this.shouldFocusMainContentAfterLoading=!1,(isFocusLost()||this.isFocusInNavbar())&&this.focusMainContent())}connectedCallback(){this.subscribeToSecurityChanges(),this.updateVisibility(),this.subscribeToNavigationEnd(),this.subscribeToRuntimeConfigurationChanges(),this.subscribeToNavigationStart(),this.subscribeToBeforeMountRouting()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}render(){return h(Host,{key:"cf3499ffab935630b1a6f5418707e125d49bea64",class:{"wb-layout":!0,"is-embedded":this.isEmbedded,"hide-navbar":!this.showNavbar,loading:this.loading}},!this.isEmbedded&&this.showNavbar&&h("a",{key:"b5cbb0f69e2a7684c96a28be6f0b33cf0ce92f1e",class:"skip-link",href:"#main-content",onClick:this.onSkipLinkClick},h("translate-label",{key:"48bc88ceb3d26c655a057df035494c8c73c1525a",labelKey:"layout.skip_to_main_content"})),h("div",{key:"a9324c1ac2c5ae522e0790a6628c9adc881b4442",class:"default-slot-wrapper"},h("slot",{key:"fb79a12af9f53ecc5a3760638e65e1b7bd362542",name:"default"})),!this.isEmbedded&&h("div",{key:"53d252627426b22677b512c169c55615b00fc8af",class:"wb-header"},h("header",{key:"7878ea9d5a00c19c83020b0a13fa79d493fc21f9"},this.showHeader&&h("onto-header",{key:"57aef16e9fb847c90c5e9a8b600327e0537caed5"}))),!this.isEmbedded&&this.showNavbar&&h("nav",{key:"5e3611d14501c19396d493e16a3539f5cd31bf88",class:"wb-navbar"},h("onto-navbar",{key:"23477f1077adf3a45cc2271351b247450e405041",ref:this.assignNavbarRef(),"navbar-collapsed":this.isLowResolution})),h("slot",{key:"2d33a33a7ede92666a935d8c2a5ca39f52f9cb9b",name:"main"},h("onto-loader",{key:"61910e13a38677899006f35bc4ef41c3c93b4a49",loading:this.loading,targetSelector:"main",size:96,messageText:TranslationService.translate("common.loading")})),!this.isEmbedded&&h("footer",{key:"3f25bad884d021a76a22ffe028a15e24960974c2",class:"wb-footer"},h("onto-footer",{key:"fa4818df751564c12e0df2a52810286e42c3415b"})))}onNavbarToggled(e){this.isNavbarCollapsed=e.detail.payload,this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}onResize(){this.windowResizeObserver()}handleDocumentKeydown(e){if("Tab"===e.key&&e.shiftKey){const t=document.querySelector('[data-backward-focus-target="true"]');t&&(e.preventDefault(),this.focusBackwardTargetInNav(t))}}handleGlobalFocus(e){const t=document.querySelector('[data-backward-focus-target="true"]');t&&"main-content"!==e.target.getAttribute("id")&&delete t.dataset.backwardFocusTarget}focusMainContent(){var e;null===(e=document.getElementById("main-content"))||void 0===e||e.focus()}windowResizeHandler(){var e,t,i,a,n;this.isLowResolution=WindowService.getWindow().innerWidth<=WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR;const s=document.querySelector(".navbar-component"),o=null!==(i=null===(t=null===(e=document.querySelector(".wb-header"))||void 0===e?void 0:e.getBoundingClientRect())||void 0===t?void 0:t.height)&&void 0!==i?i:0;if(document.documentElement.style.setProperty("--wb-header-height",`${o}px`),s){const e=document.querySelector(".cookie-consent-banner"),t=null!==(n=null===(a=null==e?void 0:e.getBoundingClientRect())||void 0===a?void 0:a.height)&&void 0!==n?n:0;s.style.height=`calc(100% - ${o}px - ${t}px)`}this.isLowResolution||this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}handleAuthChange(e){var t;e&&this.authEvents.includes(e)&&(this.authStorageService.isAuthenticated()?navigate(null!==(t=this.navigationContextService.getPreviousRoute())&&void 0!==t?t:"./"):isLoginPage()||navigateToLoginPage(),WindowService.getWindow().location.reload())}focusBackwardTargetInNav(e){var t,i;if(null==e?void 0:e.classList.contains("sub-menu-link")){const a=null===(i=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement)||void 0===i?void 0:i.previousElementSibling;"false"===(null==a?void 0:a.getAttribute("aria-expanded"))&&a.click()}setTimeout(()=>{e.focus(),delete e.dataset.backwardFocusTarget},10)}keepMainContentInPlace(){const e=this.hostElement,t=e.insertBefore.bind(e);e.insertBefore=(i,a)=>i.parentNode===e&&"MAIN"===i.nodeName&&a===e.firstChild?i:t(i,a)}subscribeToSecurityChanges(){const e=service(SecurityContextService);this.subscriptions.add(e.onAuthenticatedUserChanged(e=>{this.authenticatedUser=e,this.updateVisibility()})),this.subscriptions.add(e.onSecurityConfigChanged(e=>{this.securityConfig=e,this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(EventName.LOGIN,()=>{this.setNavbarItemVisibility(),this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(EventName.LOGGED_OUT,()=>{this.setNavbarItemVisibility(),this.updateVisibility(),navigateToLoginPage()}))}subscribeToRuntimeConfigurationChanges(){this.subscriptions.add(this.runtimeConfigurationContextService.onRuntimeConfigurationChanged(e=>{var t;this.isEmbedded=null!==(t=null==e?void 0:e.isEmbedded)&&void 0!==t&&t}))}updateVisibility(){this.authenticationService.isSecurityEnabled()?(this.showHeader=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess(),this.showNavbar=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()):(this.showNavbar=!0,this.showHeader=!0)}isAuthenticatedFully(){return!this.authenticationService.isSecurityEnabled()||this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()}shouldShowMenu(e){return this.isAuthenticatedFully()&&this.authorizationService.hasRole(e)}assignNavbarRef(){return e=>{this.navbarRef=e,this.navbarRef&&(this.navbarRef.menuItems=WindowService.getPluginRegistry().get(MainMenuExtensionPoint.NAME),this.setNavbarItemVisibility())}}setNavbarItemVisibility(){var e,t,i;if(!(null===(e=this.navbarRef)||void 0===e?void 0:e.menuItems))return;const a=e=>{var t;e.shouldShow=this.shouldShowMenu(e.role),(null===(t=e.children)||void 0===t?void 0:t.length)&&e.children.forEach(a)};null===(i=null===(t=this.navbarRef)||void 0===t?void 0:t.menuItems)||void 0===i||i.forEach(e=>{e.items.forEach(a)}),this.navbarRef.menuItems=[...this.navbarRef.menuItems]}subscribeToNavigationEnd(){this.subscriptions.add(this.eventService.subscribe(EventName.NAVIGATION_END,e=>{this.navigationContextService.updatePreviousRoute(e.oldUrl),this.focusMainContentOnPageChange(e),setTimeout(()=>{this.loading=!1})}))}focusMainContentOnPageChange({oldUrl:e,newUrl:t}){!e||isSamePage(e,t)||!this.isFocusInNavbar()&&!this.isFocusLostOrInMainContent()||this.isFocusInNavbar()&&this.isPointerNavigation()||(this.loading?this.shouldFocusMainContentAfterLoading=!0:this.focusMainContent())}isFocusLostOrInMainContent(){var e;return isFocusLost()||!!(null===(e=document.getElementById("main-content"))||void 0===e?void 0:e.contains(document.activeElement))}isFocusInNavbar(){var e;return!!(null===(e=document.getElementById("navbar"))||void 0===e?void 0:e.contains(document.activeElement))}isPointerNavigation(){var e,t;const i=null===(e=document.activeElement)||void 0===e?void 0:e.dataset.pointerType;return null===(t=document.activeElement)||void 0===t||delete t.dataset.pointerType,i===POINTER_TYPES.MOUSE||i===POINTER_TYPES.TOUCH||i===POINTER_TYPES.PEN}subscribeToNavigationStart(){this.subscriptions.add(this.eventService.subscribe(EventName.NAVIGATION_START,({oldUrl:e,newUrl:t})=>{this.isPageChanging=!e||!t||!isSamePage(e,t);const i=document.querySelector('[data-backward-focus-target="true"]');this.isPageChanging&&"page"===(null==i?void 0:i.dataset.ariaCurrent)&&delete i.dataset.backwardFocusTarget}))}subscribeToBeforeMountRouting(){this.subscriptions.add(this.eventService.subscribe(EventName.BEFORE_MOUNT_ROUTING_EVENT,()=>{this.isPageChanging&&(this.loading=!0)}))}static get is(){return"onto-layout"}static get originalStyleUrls(){return{$:["onto-layout.scss"]}}static get styleUrls(){return{$:["onto-layout.css"]}}static get states(){return{authenticatedUser:{},authToken:{},securityConfig:{},isLowResolution:{},showHeader:{},showNavbar:{},isEmbedded:{},loading:{}}}static get elementRef(){return"hostElement"}static get listeners(){return[{name:"navbarToggled",method:"onNavbarToggled",target:void 0,capture:!1,passive:!1},{name:"resize",method:"onResize",target:"window",capture:!1,passive:!0},{name:"keydown",method:"handleDocumentKeydown",target:"document",capture:!1,passive:!1},{name:"focusin",method:"handleGlobalFocus",target:"document",capture:!1,passive:!1}]}}
1
+ import{h,Host}from"@stencil/core";import{debounce}from"../../utils/function-utils";import{WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR}from"../../models/constants";import{ApplicationLifecycleContextService,AuthenticationService,AuthenticationStorageService,AuthorizationService,EventName,EventService,isSamePage,LocalStorageSubscriptionHandlerService,navigate,NavigationContextService,RuntimeConfigurationContextService,SecurityContextService,service,SubscriptionList,WindowService,MainMenuExtensionPoint,navigateToLoginPage,isLoginPage}from"../../../../../api/dist/ontotext-workbench-api";import{TranslationService}from"../../services/translation.service";import{isFocusLost}from"../../utils/html-utils";const MAIN_CONTENT_ID="main-content",NAVBAR_ID="navbar",POINTER_TYPES={MOUSE:"mouse",TOUCH:"touch",PEN:"pen"};export class OntoLayout{constructor(){this.authenticationService=service(AuthenticationService),this.authorizationService=service(AuthorizationService),this.navigationContextService=service(NavigationContextService),this.authStorageService=service(AuthenticationStorageService),this.runtimeConfigurationContextService=service(RuntimeConfigurationContextService),this.eventService=service(EventService),this.applicationLifecycleContextService=service(ApplicationLifecycleContextService),this.isLowResolution=!1,this.showHeader=this.isAuthenticatedFully(),this.showNavbar=!1,this.isEmbedded=!1,this.loading=!0,this.subscriptions=new SubscriptionList,this.isNavbarCollapsed=!1,this.shouldFocusMainContentAfterLoading=!1,this.isPageChanging=!1,this.onSkipLinkClick=e=>{e.preventDefault(),this.focusMainContent()},this.handleStorageChange=e=>{service(LocalStorageSubscriptionHandlerService).handleStorageChange(e),this.handleAuthChange(e)},this.windowResizeObserver=debounce(()=>this.windowResizeHandler(),50),WindowService.getWindow().addEventListener("storage",this.handleStorageChange)}componentWillLoad(){this.applicationLifecycleContextService.getApplicationsState()&&(this.loading=!1),this.keepMainContentInPlace()}componentDidRender(){this.windowResizeHandler(),this.shouldFocusMainContentAfterLoading&&!this.loading&&(this.shouldFocusMainContentAfterLoading=!1,(isFocusLost()||this.isFocusInNavbar())&&this.focusMainContent())}connectedCallback(){this.subscribeToSecurityChanges(),this.updateVisibility(),this.subscribeToNavigationEnd(),this.subscribeToRuntimeConfigurationChanges(),this.subscribeToNavigationStart(),this.subscribeToBeforeMountRouting()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}render(){return h(Host,{key:"f7f6a6693d18706500b4fe2c673b73b98b2f00e5",class:{"wb-layout":!0,"is-embedded":this.isEmbedded,"hide-navbar":!this.showNavbar,loading:this.loading}},!this.isEmbedded&&this.showNavbar&&h("a",{key:"2ea3be35ef8760f274d111c7905e5eec77d7c223",class:"skip-link",href:"#main-content",onClick:this.onSkipLinkClick},h("translate-label",{key:"9180fb5679ba2217e90ae82ecb7b5a846701e869",labelKey:"layout.skip_to_main_content"})),h("div",{key:"ca67fad66bf841788559949a14ef6f42824ef1b4",class:"default-slot-wrapper"},h("slot",{key:"53fdd44af4a62c34c62aaaa21ead722b2d0779d9",name:"default"})),!this.isEmbedded&&h("div",{key:"3151e880de91936c4f03e4a95b644c8a69d54802",class:"wb-header"},h("header",{key:"cc5bc9fadd30ce7d84fc1ca1023581fca4e33fb8"},this.showHeader&&h("onto-header",{key:"a662796027e6123bc6a6812f834ee09482b2fafd"}))),!this.isEmbedded&&this.showNavbar&&h("nav",{key:"2387a8895fbcb79038b3a34a6bb53cf38832a2fb",class:"wb-navbar"},h("onto-navbar",{key:"2046abd26597b1b7dc8a3e89e48174cd539975b4",ref:this.assignNavbarRef(),"navbar-collapsed":this.isLowResolution})),h("slot",{key:"c930ad38ffb03603e9bd5925e19894f0982e903d",name:"main"},h("onto-loader",{key:"2b4bebbd3d939cdf8945eac6ba18bb98cb42b5c9",loading:this.loading,targetSelector:"main",size:96,messageText:TranslationService.translate("common.loading")})),!this.isEmbedded&&h("footer",{key:"54e1e902d788fcd3915d3cd064770ff4b23044c0",class:"wb-footer"},h("onto-footer",{key:"af31f0fbe1e9bbc427ad0471a1092baa08f797ce"})))}onNavbarToggled(e){this.isNavbarCollapsed=e.detail.payload,this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}onResize(){this.windowResizeObserver()}handleDocumentKeydown(e){if("Tab"===e.key&&e.shiftKey){const t=document.querySelector('[data-backward-focus-target="true"]');t&&(e.preventDefault(),this.focusBackwardTargetInNav(t))}}handleGlobalFocus(e){const t=document.querySelector('[data-backward-focus-target="true"]');t&&"main-content"!==e.target.getAttribute("id")&&delete t.dataset.backwardFocusTarget}focusMainContent(){var e;null===(e=document.getElementById("main-content"))||void 0===e||e.focus()}windowResizeHandler(){var e,t,i,n,a;this.isLowResolution=WindowService.getWindow().innerWidth<=WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR;const s=document.querySelector(".navbar-component"),o=null!==(i=null===(t=null===(e=document.querySelector(".wb-header"))||void 0===e?void 0:e.getBoundingClientRect())||void 0===t?void 0:t.height)&&void 0!==i?i:0;if(document.documentElement.style.setProperty("--wb-header-height",`${o}px`),s){const e=document.querySelector(".cookie-consent-banner"),t=null!==(a=null===(n=null==e?void 0:e.getBoundingClientRect())||void 0===n?void 0:n.height)&&void 0!==a?a:0;s.style.height=`calc(100% - ${o}px - ${t}px)`}this.isLowResolution||this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}handleAuthChange(e){var t;if(!this.authStorageService.isLoginOrLogout(e))return;const i=this.authStorageService.isAuthenticated();i!==this.lastAuthenticatedState&&(this.lastAuthenticatedState=i,i?navigate(null!==(t=this.navigationContextService.getPreviousRoute())&&void 0!==t?t:"./"):isLoginPage()||navigateToLoginPage(),WindowService.getWindow().location.reload())}focusBackwardTargetInNav(e){var t,i;if(null==e?void 0:e.classList.contains("sub-menu-link")){const n=null===(i=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement)||void 0===i?void 0:i.previousElementSibling;"false"===(null==n?void 0:n.getAttribute("aria-expanded"))&&n.click()}setTimeout(()=>{e.focus(),delete e.dataset.backwardFocusTarget},10)}keepMainContentInPlace(){const e=this.hostElement,t=e.insertBefore.bind(e);e.insertBefore=(i,n)=>i.parentNode===e&&"MAIN"===i.nodeName&&n===e.firstChild?i:t(i,n)}subscribeToSecurityChanges(){const e=service(SecurityContextService);this.subscriptions.add(e.onAuthenticatedUserChanged(e=>{this.authenticatedUser=e,this.updateVisibility()})),this.subscriptions.add(e.onSecurityConfigChanged(e=>{this.securityConfig=e,this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(EventName.LOGIN,()=>{this.setNavbarItemVisibility(),this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(EventName.LOGGED_OUT,()=>{this.setNavbarItemVisibility(),this.updateVisibility(),navigateToLoginPage()}))}subscribeToRuntimeConfigurationChanges(){this.subscriptions.add(this.runtimeConfigurationContextService.onRuntimeConfigurationChanged(e=>{var t;this.isEmbedded=null!==(t=null==e?void 0:e.isEmbedded)&&void 0!==t&&t}))}updateVisibility(){this.authenticationService.isSecurityEnabled()?(this.showHeader=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess(),this.showNavbar=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()):(this.showNavbar=!0,this.showHeader=!0)}isAuthenticatedFully(){return!this.authenticationService.isSecurityEnabled()||this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()}shouldShowMenu(e){return this.isAuthenticatedFully()&&this.authorizationService.hasRole(e)}assignNavbarRef(){return e=>{this.navbarRef=e,this.navbarRef&&(this.navbarRef.menuItems=WindowService.getPluginRegistry().get(MainMenuExtensionPoint.NAME),this.setNavbarItemVisibility())}}setNavbarItemVisibility(){var e,t,i;if(!(null===(e=this.navbarRef)||void 0===e?void 0:e.menuItems))return;const n=e=>{var t;e.shouldShow=this.shouldShowMenu(e.role),(null===(t=e.children)||void 0===t?void 0:t.length)&&e.children.forEach(n)};null===(i=null===(t=this.navbarRef)||void 0===t?void 0:t.menuItems)||void 0===i||i.forEach(e=>{e.items.forEach(n)}),this.navbarRef.menuItems=[...this.navbarRef.menuItems]}subscribeToNavigationEnd(){this.subscriptions.add(this.eventService.subscribe(EventName.NAVIGATION_END,e=>{this.navigationContextService.updatePreviousRoute(e.oldUrl),this.focusMainContentOnPageChange(e),setTimeout(()=>{this.loading=!1})}))}focusMainContentOnPageChange({oldUrl:e,newUrl:t}){!e||isSamePage(e,t)||!this.isFocusInNavbar()&&!this.isFocusLostOrInMainContent()||this.isFocusInNavbar()&&this.isPointerNavigation()||(this.loading?this.shouldFocusMainContentAfterLoading=!0:this.focusMainContent())}isFocusLostOrInMainContent(){var e;return isFocusLost()||!!(null===(e=document.getElementById("main-content"))||void 0===e?void 0:e.contains(document.activeElement))}isFocusInNavbar(){var e;return!!(null===(e=document.getElementById("navbar"))||void 0===e?void 0:e.contains(document.activeElement))}isPointerNavigation(){var e,t;const i=null===(e=document.activeElement)||void 0===e?void 0:e.dataset.pointerType;return null===(t=document.activeElement)||void 0===t||delete t.dataset.pointerType,i===POINTER_TYPES.MOUSE||i===POINTER_TYPES.TOUCH||i===POINTER_TYPES.PEN}subscribeToNavigationStart(){this.subscriptions.add(this.eventService.subscribe(EventName.NAVIGATION_START,({oldUrl:e,newUrl:t})=>{this.isPageChanging=!e||!t||!isSamePage(e,t);const i=document.querySelector('[data-backward-focus-target="true"]');this.isPageChanging&&"page"===(null==i?void 0:i.dataset.ariaCurrent)&&delete i.dataset.backwardFocusTarget}))}subscribeToBeforeMountRouting(){this.subscriptions.add(this.eventService.subscribe(EventName.BEFORE_MOUNT_ROUTING_EVENT,()=>{this.isPageChanging&&(this.loading=!0)}))}static get is(){return"onto-layout"}static get originalStyleUrls(){return{$:["onto-layout.scss"]}}static get styleUrls(){return{$:["onto-layout.css"]}}static get states(){return{authenticatedUser:{},authToken:{},securityConfig:{},isLowResolution:{},showHeader:{},showNavbar:{},isEmbedded:{},loading:{}}}static get elementRef(){return"hostElement"}static get listeners(){return[{name:"navbarToggled",method:"onNavbarToggled",target:void 0,capture:!1,passive:!1},{name:"resize",method:"onResize",target:"window",capture:!1,passive:!0},{name:"keydown",method:"handleDocumentKeydown",target:"document",capture:!1,passive:!1},{name:"focusin",method:"handleGlobalFocus",target:"document",capture:!1,passive:!1}]}}
@@ -1 +1 @@
1
- import{r as registerInstance,h,a as Host,d as getElement}from"./index-BntG-4Sv.js";import{d as debounce}from"./function-utils-D1ZpXQQS.js";import{service,AuthenticationService,AuthorizationService,NavigationContextService,AuthenticationStorageService,RuntimeConfigurationContextService,EventService,ApplicationLifecycleContextService,StorageKey,SubscriptionList,LocalStorageSubscriptionHandlerService,WindowService,navigate,isLoginPage,navigateToLoginPage,SecurityContextService,EventName,MainMenuExtensionPoint,isSamePage}from"@ontotext/workbench-api";import{i as isFocusLost,T as TranslationService}from"./translation.service-BIRn4Afp.js";import"./logger-provider-BIkLC5Zf.js";const RESPONSIVE_BREAKPOINTS={MD:768},WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR=RESPONSIVE_BREAKPOINTS.MD,ontoLayoutCss=':host{display:block;height:100%}.wb-layout{display:grid;grid-template:"header header" auto "nav main" 1fr "nav footer" auto/15rem minmax(200px, 1fr);min-height:100vh;margin:0;}.wb-layout.expanded{grid-template-columns:4.375rem 1fr}.wb-layout.is-embedded{grid-template-columns:1fr;grid-template-areas:"main";padding-top:1rem}.wb-layout.hide-navbar{grid-template:"header" auto "main" 1fr "footer" auto/1fr;}.wb-layout.hide-navbar.expanded{grid-template-columns:1fr}.wb-layout main .main-container{margin-left:0}.wb-layout main{grid-area:main}.wb-layout main:focus{outline:none}.wb-layout.loading main{position:relative;visibility:hidden}.wb-layout .default-slot-wrapper{display:none}.wb-layout .wb-header{grid-area:header;position:sticky;top:0;z-index:999}.wb-layout nav{grid-area:nav}.wb-layout footer{grid-area:footer}.wb-layout .skip-link:not(:focus){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.wb-layout .skip-link:focus{position:fixed;top:0.5rem;left:0.5rem;z-index:1000;display:inline-flex;align-items:center;gap:var(--gw-button-gap);padding:var(--gw-button-padding-y) var(--gw-button-padding-x);border:1px solid var(--gw-button-secondary-border-color);border-radius:var(--gw-button-border-radius);background:var(--gw-background-elevated);color:var(--gw-button-secondary-color);font-family:var(--gw-button-label-typography-font-family);font-size:var(--gw-button-label-typography-font-size);font-weight:var(--gw-button-label-typography-font-weight);line-height:var(--gw-button-label-typography-line-height);text-decoration:none;white-space:nowrap;outline:var(--gw-button-focus-ring-width) var(--gw-button-focus-ring-style) var(--gw-button-secondary-focus-ring-color);outline-offset:var(--gw-button-focus-ring-offset)}.wb-layout .skip-link:focus:hover{border-color:var(--gw-button-secondary-hover-border-color);color:var(--gw-button-secondary-hover-color)}.wb-layout .skip-link:focus:active{border-color:var(--gw-button-secondary-active-border-color);color:var(--gw-button-secondary-active-color)}',MAIN_CONTENT_ID="main-content",NAVBAR_ID="navbar",POINTER_TYPES={MOUSE:"mouse",TOUCH:"touch",PEN:"pen"},OntoLayout=class{constructor(e){registerInstance(this,e),this.authenticationService=service(AuthenticationService),this.authorizationService=service(AuthorizationService),this.navigationContextService=service(NavigationContextService),this.authStorageService=service(AuthenticationStorageService),this.runtimeConfigurationContextService=service(RuntimeConfigurationContextService),this.eventService=service(EventService),this.applicationLifecycleContextService=service(ApplicationLifecycleContextService),this.fullJwtKey=`${StorageKey.GLOBAL_NAMESPACE}.${this.authStorageService.NAMESPACE}.${this.authStorageService.jwtKey}`,this.fullAuthenticatedKey=`${StorageKey.GLOBAL_NAMESPACE}.${this.authStorageService.NAMESPACE}.${this.authStorageService.authenticatedKey}`,this.authEvents=[this.fullJwtKey,this.fullAuthenticatedKey],this.isLowResolution=!1,this.showHeader=this.isAuthenticatedFully(),this.showNavbar=!1,this.isEmbedded=!1,this.loading=!0,this.subscriptions=new SubscriptionList,this.isNavbarCollapsed=!1,this.shouldFocusMainContentAfterLoading=!1,this.isPageChanging=!1,this.onSkipLinkClick=e=>{e.preventDefault(),this.focusMainContent()},this.handleStorageChange=e=>{service(LocalStorageSubscriptionHandlerService).handleStorageChange(e),this.handleAuthChange(e.key)},this.windowResizeObserver=debounce(()=>this.windowResizeHandler(),50),WindowService.getWindow().addEventListener("storage",this.handleStorageChange)}componentWillLoad(){this.applicationLifecycleContextService.getApplicationsState()&&(this.loading=!1),this.keepMainContentInPlace()}componentDidRender(){this.windowResizeHandler(),this.shouldFocusMainContentAfterLoading&&!this.loading&&(this.shouldFocusMainContentAfterLoading=!1,(isFocusLost()||this.isFocusInNavbar())&&this.focusMainContent())}connectedCallback(){this.subscribeToSecurityChanges(),this.updateVisibility(),this.subscribeToNavigationEnd(),this.subscribeToRuntimeConfigurationChanges(),this.subscribeToNavigationStart(),this.subscribeToBeforeMountRouting()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}render(){return h(Host,{key:"cf3499ffab935630b1a6f5418707e125d49bea64",class:{"wb-layout":!0,"is-embedded":this.isEmbedded,"hide-navbar":!this.showNavbar,loading:this.loading}},!this.isEmbedded&&this.showNavbar&&h("a",{key:"b5cbb0f69e2a7684c96a28be6f0b33cf0ce92f1e",class:"skip-link",href:"#main-content",onClick:this.onSkipLinkClick},h("translate-label",{key:"48bc88ceb3d26c655a057df035494c8c73c1525a",labelKey:"layout.skip_to_main_content"})),h("div",{key:"a9324c1ac2c5ae522e0790a6628c9adc881b4442",class:"default-slot-wrapper"},h("slot",{key:"fb79a12af9f53ecc5a3760638e65e1b7bd362542",name:"default"})),!this.isEmbedded&&h("div",{key:"53d252627426b22677b512c169c55615b00fc8af",class:"wb-header"},h("header",{key:"7878ea9d5a00c19c83020b0a13fa79d493fc21f9"},this.showHeader&&h("onto-header",{key:"57aef16e9fb847c90c5e9a8b600327e0537caed5"}))),!this.isEmbedded&&this.showNavbar&&h("nav",{key:"5e3611d14501c19396d493e16a3539f5cd31bf88",class:"wb-navbar"},h("onto-navbar",{key:"23477f1077adf3a45cc2271351b247450e405041",ref:this.assignNavbarRef(),"navbar-collapsed":this.isLowResolution})),h("slot",{key:"2d33a33a7ede92666a935d8c2a5ca39f52f9cb9b",name:"main"},h("onto-loader",{key:"61910e13a38677899006f35bc4ef41c3c93b4a49",loading:this.loading,targetSelector:"main",size:96,messageText:TranslationService.translate("common.loading")})),!this.isEmbedded&&h("footer",{key:"3f25bad884d021a76a22ffe028a15e24960974c2",class:"wb-footer"},h("onto-footer",{key:"fa4818df751564c12e0df2a52810286e42c3415b"})))}onNavbarToggled(e){this.isNavbarCollapsed=e.detail.payload,this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}onResize(){this.windowResizeObserver()}handleDocumentKeydown(e){if("Tab"===e.key&&e.shiftKey){const t=document.querySelector('[data-backward-focus-target="true"]');t&&(e.preventDefault(),this.focusBackwardTargetInNav(t))}}handleGlobalFocus(e){const t=document.querySelector('[data-backward-focus-target="true"]');t&&"main-content"!==e.target.getAttribute("id")&&delete t.dataset.backwardFocusTarget}focusMainContent(){var e;null===(e=document.getElementById("main-content"))||void 0===e||e.focus()}windowResizeHandler(){var e,t,i,a,n;this.isLowResolution=WindowService.getWindow().innerWidth<=WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR;const o=document.querySelector(".navbar-component"),s=null!==(i=null===(t=null===(e=document.querySelector(".wb-header"))||void 0===e?void 0:e.getBoundingClientRect())||void 0===t?void 0:t.height)&&void 0!==i?i:0;if(document.documentElement.style.setProperty("--wb-header-height",`${s}px`),o){const e=document.querySelector(".cookie-consent-banner"),t=null!==(n=null===(a=null==e?void 0:e.getBoundingClientRect())||void 0===a?void 0:a.height)&&void 0!==n?n:0;o.style.height=`calc(100% - ${s}px - ${t}px)`}this.isLowResolution||this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}handleAuthChange(e){var t;e&&this.authEvents.includes(e)&&(this.authStorageService.isAuthenticated()?navigate(null!==(t=this.navigationContextService.getPreviousRoute())&&void 0!==t?t:"./"):isLoginPage()||navigateToLoginPage(),WindowService.getWindow().location.reload())}focusBackwardTargetInNav(e){var t,i;if(null==e?void 0:e.classList.contains("sub-menu-link")){const a=null===(i=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement)||void 0===i?void 0:i.previousElementSibling;"false"===(null==a?void 0:a.getAttribute("aria-expanded"))&&a.click()}setTimeout(()=>{e.focus(),delete e.dataset.backwardFocusTarget},10)}keepMainContentInPlace(){const e=this.hostElement,t=e.insertBefore.bind(e);e.insertBefore=(i,a)=>i.parentNode===e&&"MAIN"===i.nodeName&&a===e.firstChild?i:t(i,a)}subscribeToSecurityChanges(){const e=service(SecurityContextService);this.subscriptions.add(e.onAuthenticatedUserChanged(e=>{this.authenticatedUser=e,this.updateVisibility()})),this.subscriptions.add(e.onSecurityConfigChanged(e=>{this.securityConfig=e,this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(EventName.LOGIN,()=>{this.setNavbarItemVisibility(),this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(EventName.LOGGED_OUT,()=>{this.setNavbarItemVisibility(),this.updateVisibility(),navigateToLoginPage()}))}subscribeToRuntimeConfigurationChanges(){this.subscriptions.add(this.runtimeConfigurationContextService.onRuntimeConfigurationChanged(e=>{var t;this.isEmbedded=null!==(t=null==e?void 0:e.isEmbedded)&&void 0!==t&&t}))}updateVisibility(){this.authenticationService.isSecurityEnabled()?(this.showHeader=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess(),this.showNavbar=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()):(this.showNavbar=!0,this.showHeader=!0)}isAuthenticatedFully(){return!this.authenticationService.isSecurityEnabled()||this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()}shouldShowMenu(e){return this.isAuthenticatedFully()&&this.authorizationService.hasRole(e)}assignNavbarRef(){return e=>{this.navbarRef=e,this.navbarRef&&(this.navbarRef.menuItems=WindowService.getPluginRegistry().get(MainMenuExtensionPoint.NAME),this.setNavbarItemVisibility())}}setNavbarItemVisibility(){var e,t,i;if(!(null===(e=this.navbarRef)||void 0===e?void 0:e.menuItems))return;const a=e=>{var t;e.shouldShow=this.shouldShowMenu(e.role),(null===(t=e.children)||void 0===t?void 0:t.length)&&e.children.forEach(a)};null===(i=null===(t=this.navbarRef)||void 0===t?void 0:t.menuItems)||void 0===i||i.forEach(e=>{e.items.forEach(a)}),this.navbarRef.menuItems=[...this.navbarRef.menuItems]}subscribeToNavigationEnd(){this.subscriptions.add(this.eventService.subscribe(EventName.NAVIGATION_END,e=>{this.navigationContextService.updatePreviousRoute(e.oldUrl),this.focusMainContentOnPageChange(e),setTimeout(()=>{this.loading=!1})}))}focusMainContentOnPageChange({oldUrl:e,newUrl:t}){!e||isSamePage(e,t)||!this.isFocusInNavbar()&&!this.isFocusLostOrInMainContent()||this.isFocusInNavbar()&&this.isPointerNavigation()||(this.loading?this.shouldFocusMainContentAfterLoading=!0:this.focusMainContent())}isFocusLostOrInMainContent(){var e;return isFocusLost()||!!(null===(e=document.getElementById("main-content"))||void 0===e?void 0:e.contains(document.activeElement))}isFocusInNavbar(){var e;return!!(null===(e=document.getElementById("navbar"))||void 0===e?void 0:e.contains(document.activeElement))}isPointerNavigation(){var e,t;const i=null===(e=document.activeElement)||void 0===e?void 0:e.dataset.pointerType;return null===(t=document.activeElement)||void 0===t||delete t.dataset.pointerType,i===POINTER_TYPES.MOUSE||i===POINTER_TYPES.TOUCH||i===POINTER_TYPES.PEN}subscribeToNavigationStart(){this.subscriptions.add(this.eventService.subscribe(EventName.NAVIGATION_START,({oldUrl:e,newUrl:t})=>{this.isPageChanging=!e||!t||!isSamePage(e,t);const i=document.querySelector('[data-backward-focus-target="true"]');this.isPageChanging&&"page"===(null==i?void 0:i.dataset.ariaCurrent)&&delete i.dataset.backwardFocusTarget}))}subscribeToBeforeMountRouting(){this.subscriptions.add(this.eventService.subscribe(EventName.BEFORE_MOUNT_ROUTING_EVENT,()=>{this.isPageChanging&&(this.loading=!0)}))}get hostElement(){return getElement(this)}};OntoLayout.style=ontoLayoutCss;export{OntoLayout as onto_layout};
1
+ import{r as registerInstance,h,a as Host,d as getElement}from"./index-BntG-4Sv.js";import{d as debounce}from"./function-utils-D1ZpXQQS.js";import{service,AuthenticationService,AuthorizationService,NavigationContextService,AuthenticationStorageService,RuntimeConfigurationContextService,EventService,ApplicationLifecycleContextService,SubscriptionList,LocalStorageSubscriptionHandlerService,WindowService,navigate,isLoginPage,navigateToLoginPage,SecurityContextService,EventName,MainMenuExtensionPoint,isSamePage}from"@ontotext/workbench-api";import{i as isFocusLost,T as TranslationService}from"./translation.service-BIRn4Afp.js";import"./logger-provider-BIkLC5Zf.js";const RESPONSIVE_BREAKPOINTS={MD:768},WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR=RESPONSIVE_BREAKPOINTS.MD,ontoLayoutCss=':host{display:block;height:100%}.wb-layout{display:grid;grid-template:"header header" auto "nav main" 1fr "nav footer" auto/15rem minmax(200px, 1fr);min-height:100vh;margin:0;}.wb-layout.expanded{grid-template-columns:4.375rem 1fr}.wb-layout.is-embedded{grid-template-columns:1fr;grid-template-areas:"main";padding-top:1rem}.wb-layout.hide-navbar{grid-template:"header" auto "main" 1fr "footer" auto/1fr;}.wb-layout.hide-navbar.expanded{grid-template-columns:1fr}.wb-layout main .main-container{margin-left:0}.wb-layout main{grid-area:main}.wb-layout main:focus{outline:none}.wb-layout.loading main{position:relative;visibility:hidden}.wb-layout .default-slot-wrapper{display:none}.wb-layout .wb-header{grid-area:header;position:sticky;top:0;z-index:999}.wb-layout nav{grid-area:nav}.wb-layout footer{grid-area:footer}.wb-layout .skip-link:not(:focus){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.wb-layout .skip-link:focus{position:fixed;top:0.5rem;left:0.5rem;z-index:1000;display:inline-flex;align-items:center;gap:var(--gw-button-gap);padding:var(--gw-button-padding-y) var(--gw-button-padding-x);border:1px solid var(--gw-button-secondary-border-color);border-radius:var(--gw-button-border-radius);background:var(--gw-background-elevated);color:var(--gw-button-secondary-color);font-family:var(--gw-button-label-typography-font-family);font-size:var(--gw-button-label-typography-font-size);font-weight:var(--gw-button-label-typography-font-weight);line-height:var(--gw-button-label-typography-line-height);text-decoration:none;white-space:nowrap;outline:var(--gw-button-focus-ring-width) var(--gw-button-focus-ring-style) var(--gw-button-secondary-focus-ring-color);outline-offset:var(--gw-button-focus-ring-offset)}.wb-layout .skip-link:focus:hover{border-color:var(--gw-button-secondary-hover-border-color);color:var(--gw-button-secondary-hover-color)}.wb-layout .skip-link:focus:active{border-color:var(--gw-button-secondary-active-border-color);color:var(--gw-button-secondary-active-color)}',MAIN_CONTENT_ID="main-content",NAVBAR_ID="navbar",POINTER_TYPES={MOUSE:"mouse",TOUCH:"touch",PEN:"pen"},OntoLayout=class{constructor(e){registerInstance(this,e),this.authenticationService=service(AuthenticationService),this.authorizationService=service(AuthorizationService),this.navigationContextService=service(NavigationContextService),this.authStorageService=service(AuthenticationStorageService),this.runtimeConfigurationContextService=service(RuntimeConfigurationContextService),this.eventService=service(EventService),this.applicationLifecycleContextService=service(ApplicationLifecycleContextService),this.isLowResolution=!1,this.showHeader=this.isAuthenticatedFully(),this.showNavbar=!1,this.isEmbedded=!1,this.loading=!0,this.subscriptions=new SubscriptionList,this.isNavbarCollapsed=!1,this.shouldFocusMainContentAfterLoading=!1,this.isPageChanging=!1,this.onSkipLinkClick=e=>{e.preventDefault(),this.focusMainContent()},this.handleStorageChange=e=>{service(LocalStorageSubscriptionHandlerService).handleStorageChange(e),this.handleAuthChange(e)},this.windowResizeObserver=debounce(()=>this.windowResizeHandler(),50),WindowService.getWindow().addEventListener("storage",this.handleStorageChange)}componentWillLoad(){this.applicationLifecycleContextService.getApplicationsState()&&(this.loading=!1),this.keepMainContentInPlace()}componentDidRender(){this.windowResizeHandler(),this.shouldFocusMainContentAfterLoading&&!this.loading&&(this.shouldFocusMainContentAfterLoading=!1,(isFocusLost()||this.isFocusInNavbar())&&this.focusMainContent())}connectedCallback(){this.subscribeToSecurityChanges(),this.updateVisibility(),this.subscribeToNavigationEnd(),this.subscribeToRuntimeConfigurationChanges(),this.subscribeToNavigationStart(),this.subscribeToBeforeMountRouting()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}render(){return h(Host,{key:"f7f6a6693d18706500b4fe2c673b73b98b2f00e5",class:{"wb-layout":!0,"is-embedded":this.isEmbedded,"hide-navbar":!this.showNavbar,loading:this.loading}},!this.isEmbedded&&this.showNavbar&&h("a",{key:"2ea3be35ef8760f274d111c7905e5eec77d7c223",class:"skip-link",href:"#main-content",onClick:this.onSkipLinkClick},h("translate-label",{key:"9180fb5679ba2217e90ae82ecb7b5a846701e869",labelKey:"layout.skip_to_main_content"})),h("div",{key:"ca67fad66bf841788559949a14ef6f42824ef1b4",class:"default-slot-wrapper"},h("slot",{key:"53fdd44af4a62c34c62aaaa21ead722b2d0779d9",name:"default"})),!this.isEmbedded&&h("div",{key:"3151e880de91936c4f03e4a95b644c8a69d54802",class:"wb-header"},h("header",{key:"cc5bc9fadd30ce7d84fc1ca1023581fca4e33fb8"},this.showHeader&&h("onto-header",{key:"a662796027e6123bc6a6812f834ee09482b2fafd"}))),!this.isEmbedded&&this.showNavbar&&h("nav",{key:"2387a8895fbcb79038b3a34a6bb53cf38832a2fb",class:"wb-navbar"},h("onto-navbar",{key:"2046abd26597b1b7dc8a3e89e48174cd539975b4",ref:this.assignNavbarRef(),"navbar-collapsed":this.isLowResolution})),h("slot",{key:"c930ad38ffb03603e9bd5925e19894f0982e903d",name:"main"},h("onto-loader",{key:"2b4bebbd3d939cdf8945eac6ba18bb98cb42b5c9",loading:this.loading,targetSelector:"main",size:96,messageText:TranslationService.translate("common.loading")})),!this.isEmbedded&&h("footer",{key:"54e1e902d788fcd3915d3cd064770ff4b23044c0",class:"wb-footer"},h("onto-footer",{key:"af31f0fbe1e9bbc427ad0471a1092baa08f797ce"})))}onNavbarToggled(e){this.isNavbarCollapsed=e.detail.payload,this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}onResize(){this.windowResizeObserver()}handleDocumentKeydown(e){if("Tab"===e.key&&e.shiftKey){const t=document.querySelector('[data-backward-focus-target="true"]');t&&(e.preventDefault(),this.focusBackwardTargetInNav(t))}}handleGlobalFocus(e){const t=document.querySelector('[data-backward-focus-target="true"]');t&&"main-content"!==e.target.getAttribute("id")&&delete t.dataset.backwardFocusTarget}focusMainContent(){var e;null===(e=document.getElementById("main-content"))||void 0===e||e.focus()}windowResizeHandler(){var e,t,i,a,n;this.isLowResolution=WindowService.getWindow().innerWidth<=WINDOW_WIDTH_FOR_COLLAPSED_NAVBAR;const o=document.querySelector(".navbar-component"),s=null!==(i=null===(t=null===(e=document.querySelector(".wb-header"))||void 0===e?void 0:e.getBoundingClientRect())||void 0===t?void 0:t.height)&&void 0!==i?i:0;if(document.documentElement.style.setProperty("--wb-header-height",`${s}px`),o){const e=document.querySelector(".cookie-consent-banner"),t=null!==(n=null===(a=null==e?void 0:e.getBoundingClientRect())||void 0===a?void 0:a.height)&&void 0!==n?n:0;o.style.height=`calc(100% - ${s}px - ${t}px)`}this.isLowResolution||this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}handleAuthChange(e){var t;if(!this.authStorageService.isLoginOrLogout(e))return;const i=this.authStorageService.isAuthenticated();i!==this.lastAuthenticatedState&&(this.lastAuthenticatedState=i,i?navigate(null!==(t=this.navigationContextService.getPreviousRoute())&&void 0!==t?t:"./"):isLoginPage()||navigateToLoginPage(),WindowService.getWindow().location.reload())}focusBackwardTargetInNav(e){var t,i;if(null==e?void 0:e.classList.contains("sub-menu-link")){const a=null===(i=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement)||void 0===i?void 0:i.previousElementSibling;"false"===(null==a?void 0:a.getAttribute("aria-expanded"))&&a.click()}setTimeout(()=>{e.focus(),delete e.dataset.backwardFocusTarget},10)}keepMainContentInPlace(){const e=this.hostElement,t=e.insertBefore.bind(e);e.insertBefore=(i,a)=>i.parentNode===e&&"MAIN"===i.nodeName&&a===e.firstChild?i:t(i,a)}subscribeToSecurityChanges(){const e=service(SecurityContextService);this.subscriptions.add(e.onAuthenticatedUserChanged(e=>{this.authenticatedUser=e,this.updateVisibility()})),this.subscriptions.add(e.onSecurityConfigChanged(e=>{this.securityConfig=e,this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(EventName.LOGIN,()=>{this.setNavbarItemVisibility(),this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(EventName.LOGGED_OUT,()=>{this.setNavbarItemVisibility(),this.updateVisibility(),navigateToLoginPage()}))}subscribeToRuntimeConfigurationChanges(){this.subscriptions.add(this.runtimeConfigurationContextService.onRuntimeConfigurationChanged(e=>{var t;this.isEmbedded=null!==(t=null==e?void 0:e.isEmbedded)&&void 0!==t&&t}))}updateVisibility(){this.authenticationService.isSecurityEnabled()?(this.showHeader=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess(),this.showNavbar=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()):(this.showNavbar=!0,this.showHeader=!0)}isAuthenticatedFully(){return!this.authenticationService.isSecurityEnabled()||this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()}shouldShowMenu(e){return this.isAuthenticatedFully()&&this.authorizationService.hasRole(e)}assignNavbarRef(){return e=>{this.navbarRef=e,this.navbarRef&&(this.navbarRef.menuItems=WindowService.getPluginRegistry().get(MainMenuExtensionPoint.NAME),this.setNavbarItemVisibility())}}setNavbarItemVisibility(){var e,t,i;if(!(null===(e=this.navbarRef)||void 0===e?void 0:e.menuItems))return;const a=e=>{var t;e.shouldShow=this.shouldShowMenu(e.role),(null===(t=e.children)||void 0===t?void 0:t.length)&&e.children.forEach(a)};null===(i=null===(t=this.navbarRef)||void 0===t?void 0:t.menuItems)||void 0===i||i.forEach(e=>{e.items.forEach(a)}),this.navbarRef.menuItems=[...this.navbarRef.menuItems]}subscribeToNavigationEnd(){this.subscriptions.add(this.eventService.subscribe(EventName.NAVIGATION_END,e=>{this.navigationContextService.updatePreviousRoute(e.oldUrl),this.focusMainContentOnPageChange(e),setTimeout(()=>{this.loading=!1})}))}focusMainContentOnPageChange({oldUrl:e,newUrl:t}){!e||isSamePage(e,t)||!this.isFocusInNavbar()&&!this.isFocusLostOrInMainContent()||this.isFocusInNavbar()&&this.isPointerNavigation()||(this.loading?this.shouldFocusMainContentAfterLoading=!0:this.focusMainContent())}isFocusLostOrInMainContent(){var e;return isFocusLost()||!!(null===(e=document.getElementById("main-content"))||void 0===e?void 0:e.contains(document.activeElement))}isFocusInNavbar(){var e;return!!(null===(e=document.getElementById("navbar"))||void 0===e?void 0:e.contains(document.activeElement))}isPointerNavigation(){var e,t;const i=null===(e=document.activeElement)||void 0===e?void 0:e.dataset.pointerType;return null===(t=document.activeElement)||void 0===t||delete t.dataset.pointerType,i===POINTER_TYPES.MOUSE||i===POINTER_TYPES.TOUCH||i===POINTER_TYPES.PEN}subscribeToNavigationStart(){this.subscriptions.add(this.eventService.subscribe(EventName.NAVIGATION_START,({oldUrl:e,newUrl:t})=>{this.isPageChanging=!e||!t||!isSamePage(e,t);const i=document.querySelector('[data-backward-focus-target="true"]');this.isPageChanging&&"page"===(null==i?void 0:i.dataset.ariaCurrent)&&delete i.dataset.backwardFocusTarget}))}subscribeToBeforeMountRouting(){this.subscriptions.add(this.eventService.subscribe(EventName.BEFORE_MOUNT_ROUTING_EVENT,()=>{this.isPageChanging&&(this.loading=!0)}))}get hostElement(){return getElement(this)}};OntoLayout.style=ontoLayoutCss;export{OntoLayout as onto_layout};
@@ -0,0 +1 @@
1
+ import{r as t,h as i,a as e,d as o}from"./p-BntG-4Sv.js";import{d as a}from"./p-D1ZpXQQS.js";import{service as s,AuthenticationService as n,AuthorizationService as r,NavigationContextService as d,AuthenticationStorageService as h,RuntimeConfigurationContextService as l,EventService as c,ApplicationLifecycleContextService as u,SubscriptionList as b,LocalStorageSubscriptionHandlerService as f,WindowService as v,navigate as g,isLoginPage as p,navigateToLoginPage as m,SecurityContextService as w,EventName as y,MainMenuExtensionPoint as k,isSamePage as x}from"@ontotext/workbench-api";import{i as T,T as C}from"./p-DSYXTTde.js";import"./p-BIkLC5Zf.js";const N="main-content",z=class{constructor(e){t(this,e),this.authenticationService=s(n),this.authorizationService=s(r),this.navigationContextService=s(d),this.authStorageService=s(h),this.runtimeConfigurationContextService=s(l),this.eventService=s(c),this.applicationLifecycleContextService=s(u),this.isLowResolution=!1,this.showHeader=this.isAuthenticatedFully(),this.showNavbar=!1,this.isEmbedded=!1,this.loading=!0,this.subscriptions=new b,this.isNavbarCollapsed=!1,this.shouldFocusMainContentAfterLoading=!1,this.isPageChanging=!1,this.onSkipLinkClick=e=>{e.preventDefault(),this.focusMainContent()},this.handleStorageChange=e=>{s(f).handleStorageChange(e),this.handleAuthChange(e)},this.windowResizeObserver=a(()=>this.windowResizeHandler(),50),v.getWindow().addEventListener("storage",this.handleStorageChange)}componentWillLoad(){this.applicationLifecycleContextService.getApplicationsState()&&(this.loading=!1),this.keepMainContentInPlace()}componentDidRender(){this.windowResizeHandler(),this.shouldFocusMainContentAfterLoading&&!this.loading&&(this.shouldFocusMainContentAfterLoading=!1,(T()||this.isFocusInNavbar())&&this.focusMainContent())}connectedCallback(){this.subscribeToSecurityChanges(),this.updateVisibility(),this.subscribeToNavigationEnd(),this.subscribeToRuntimeConfigurationChanges(),this.subscribeToNavigationStart(),this.subscribeToBeforeMountRouting()}disconnectedCallback(){this.subscriptions.unsubscribeAll()}render(){return i(e,{key:"f7f6a6693d18706500b4fe2c673b73b98b2f00e5",class:{"wb-layout":!0,"is-embedded":this.isEmbedded,"hide-navbar":!this.showNavbar,loading:this.loading}},!this.isEmbedded&&this.showNavbar&&i("a",{key:"2ea3be35ef8760f274d111c7905e5eec77d7c223",class:"skip-link",href:`#${N}`,onClick:this.onSkipLinkClick},i("translate-label",{key:"9180fb5679ba2217e90ae82ecb7b5a846701e869",labelKey:"layout.skip_to_main_content"})),i("div",{key:"ca67fad66bf841788559949a14ef6f42824ef1b4",class:"default-slot-wrapper"},i("slot",{key:"53fdd44af4a62c34c62aaaa21ead722b2d0779d9",name:"default"})),!this.isEmbedded&&i("div",{key:"3151e880de91936c4f03e4a95b644c8a69d54802",class:"wb-header"},i("header",{key:"cc5bc9fadd30ce7d84fc1ca1023581fca4e33fb8"},this.showHeader&&i("onto-header",{key:"a662796027e6123bc6a6812f834ee09482b2fafd"}))),!this.isEmbedded&&this.showNavbar&&i("nav",{key:"2387a8895fbcb79038b3a34a6bb53cf38832a2fb",class:"wb-navbar"},i("onto-navbar",{key:"2046abd26597b1b7dc8a3e89e48174cd539975b4",ref:this.assignNavbarRef(),"navbar-collapsed":this.isLowResolution})),i("slot",{key:"c930ad38ffb03603e9bd5925e19894f0982e903d",name:"main"},i("onto-loader",{key:"2b4bebbd3d939cdf8945eac6ba18bb98cb42b5c9",loading:this.loading,targetSelector:"main",size:96,messageText:C.translate("common.loading")})),!this.isEmbedded&&i("footer",{key:"54e1e902d788fcd3915d3cd064770ff4b23044c0",class:"wb-footer"},i("onto-footer",{key:"af31f0fbe1e9bbc427ad0471a1092baa08f797ce"})))}onNavbarToggled(e){this.isNavbarCollapsed=e.detail.payload,this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}onResize(){this.windowResizeObserver()}handleDocumentKeydown(e){if("Tab"===e.key&&e.shiftKey){const t=document.querySelector('[data-backward-focus-target="true"]');t&&(e.preventDefault(),this.focusBackwardTargetInNav(t))}}handleGlobalFocus(e){const t=document.querySelector('[data-backward-focus-target="true"]');t&&e.target.getAttribute("id")!==N&&delete t.dataset.backwardFocusTarget}focusMainContent(){var e;null===(e=document.getElementById(N))||void 0===e||e.focus()}windowResizeHandler(){var e,t,i,a,n;this.isLowResolution=v.getWindow().innerWidth<=768;const o=document.querySelector(".navbar-component"),s=null!==(i=null===(t=null===(e=document.querySelector(".wb-header"))||void 0===e?void 0:e.getBoundingClientRect())||void 0===t?void 0:t.height)&&void 0!==i?i:0;if(document.documentElement.style.setProperty("--wb-header-height",`${s}px`),o){const e=document.querySelector(".cookie-consent-banner"),t=null!==(n=null===(a=null==e?void 0:e.getBoundingClientRect())||void 0===a?void 0:a.height)&&void 0!==n?n:0;o.style.height=`calc(100% - ${s}px - ${t}px)`}this.isLowResolution||this.isNavbarCollapsed?this.hostElement.classList.add("expanded"):this.hostElement.classList.remove("expanded")}handleAuthChange(e){var t;if(!this.authStorageService.isLoginOrLogout(e))return;const i=this.authStorageService.isAuthenticated();i!==this.lastAuthenticatedState&&(this.lastAuthenticatedState=i,i?g(null!==(t=this.navigationContextService.getPreviousRoute())&&void 0!==t?t:"./"):p()||m(),v.getWindow().location.reload())}focusBackwardTargetInNav(e){var t,i;if(null==e?void 0:e.classList.contains("sub-menu-link")){const a=null===(i=null===(t=e.parentElement)||void 0===t?void 0:t.parentElement)||void 0===i?void 0:i.previousElementSibling;"false"===(null==a?void 0:a.getAttribute("aria-expanded"))&&a.click()}setTimeout(()=>{e.focus(),delete e.dataset.backwardFocusTarget},10)}keepMainContentInPlace(){const e=this.hostElement,t=e.insertBefore.bind(e);e.insertBefore=(i,a)=>i.parentNode===e&&"MAIN"===i.nodeName&&a===e.firstChild?i:t(i,a)}subscribeToSecurityChanges(){const e=s(w);this.subscriptions.add(e.onAuthenticatedUserChanged(e=>{this.authenticatedUser=e,this.updateVisibility()})),this.subscriptions.add(e.onSecurityConfigChanged(e=>{this.securityConfig=e,this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(y.LOGIN,()=>{this.setNavbarItemVisibility(),this.updateVisibility()})),this.subscriptions.add(this.eventService.subscribe(y.LOGGED_OUT,()=>{this.setNavbarItemVisibility(),this.updateVisibility(),m()}))}subscribeToRuntimeConfigurationChanges(){this.subscriptions.add(this.runtimeConfigurationContextService.onRuntimeConfigurationChanged(e=>{var t;this.isEmbedded=null!==(t=null==e?void 0:e.isEmbedded)&&void 0!==t&&t}))}updateVisibility(){this.authenticationService.isSecurityEnabled()?(this.showHeader=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess(),this.showNavbar=this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()):(this.showNavbar=!0,this.showHeader=!0)}isAuthenticatedFully(){return!this.authenticationService.isSecurityEnabled()||this.authenticationService.isAuthenticated()||this.authorizationService.hasFreeAccess()}shouldShowMenu(e){return this.isAuthenticatedFully()&&this.authorizationService.hasRole(e)}assignNavbarRef(){return e=>{this.navbarRef=e,this.navbarRef&&(this.navbarRef.menuItems=v.getPluginRegistry().get(k.NAME),this.setNavbarItemVisibility())}}setNavbarItemVisibility(){var e,t,i;if(!(null===(e=this.navbarRef)||void 0===e?void 0:e.menuItems))return;const a=e=>{var t;e.shouldShow=this.shouldShowMenu(e.role),(null===(t=e.children)||void 0===t?void 0:t.length)&&e.children.forEach(a)};null===(i=null===(t=this.navbarRef)||void 0===t?void 0:t.menuItems)||void 0===i||i.forEach(e=>{e.items.forEach(a)}),this.navbarRef.menuItems=[...this.navbarRef.menuItems]}subscribeToNavigationEnd(){this.subscriptions.add(this.eventService.subscribe(y.NAVIGATION_END,e=>{this.navigationContextService.updatePreviousRoute(e.oldUrl),this.focusMainContentOnPageChange(e),setTimeout(()=>{this.loading=!1})}))}focusMainContentOnPageChange({oldUrl:e,newUrl:t}){!e||x(e,t)||!this.isFocusInNavbar()&&!this.isFocusLostOrInMainContent()||this.isFocusInNavbar()&&this.isPointerNavigation()||(this.loading?this.shouldFocusMainContentAfterLoading=!0:this.focusMainContent())}isFocusLostOrInMainContent(){var e;return T()||!!(null===(e=document.getElementById(N))||void 0===e?void 0:e.contains(document.activeElement))}isFocusInNavbar(){var e;return!!(null===(e=document.getElementById("navbar"))||void 0===e?void 0:e.contains(document.activeElement))}isPointerNavigation(){var e,t;const i=null===(e=document.activeElement)||void 0===e?void 0:e.dataset.pointerType;return null===(t=document.activeElement)||void 0===t||delete t.dataset.pointerType,"mouse"===i||"touch"===i||"pen"===i}subscribeToNavigationStart(){this.subscriptions.add(this.eventService.subscribe(y.NAVIGATION_START,({oldUrl:e,newUrl:t})=>{this.isPageChanging=!e||!t||!x(e,t);const i=document.querySelector('[data-backward-focus-target="true"]');this.isPageChanging&&"page"===(null==i?void 0:i.dataset.ariaCurrent)&&delete i.dataset.backwardFocusTarget}))}subscribeToBeforeMountRouting(){this.subscriptions.add(this.eventService.subscribe(y.BEFORE_MOUNT_ROUTING_EVENT,()=>{this.isPageChanging&&(this.loading=!0)}))}get hostElement(){return o(this)}};z.style=':host{display:block;height:100%}.wb-layout{display:grid;grid-template:"header header" auto "nav main" 1fr "nav footer" auto/15rem minmax(200px, 1fr);min-height:100vh;margin:0;}.wb-layout.expanded{grid-template-columns:4.375rem 1fr}.wb-layout.is-embedded{grid-template-columns:1fr;grid-template-areas:"main";padding-top:1rem}.wb-layout.hide-navbar{grid-template:"header" auto "main" 1fr "footer" auto/1fr;}.wb-layout.hide-navbar.expanded{grid-template-columns:1fr}.wb-layout main .main-container{margin-left:0}.wb-layout main{grid-area:main}.wb-layout main:focus{outline:none}.wb-layout.loading main{position:relative;visibility:hidden}.wb-layout .default-slot-wrapper{display:none}.wb-layout .wb-header{grid-area:header;position:sticky;top:0;z-index:999}.wb-layout nav{grid-area:nav}.wb-layout footer{grid-area:footer}.wb-layout .skip-link:not(:focus){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.wb-layout .skip-link:focus{position:fixed;top:0.5rem;left:0.5rem;z-index:1000;display:inline-flex;align-items:center;gap:var(--gw-button-gap);padding:var(--gw-button-padding-y) var(--gw-button-padding-x);border:1px solid var(--gw-button-secondary-border-color);border-radius:var(--gw-button-border-radius);background:var(--gw-background-elevated);color:var(--gw-button-secondary-color);font-family:var(--gw-button-label-typography-font-family);font-size:var(--gw-button-label-typography-font-size);font-weight:var(--gw-button-label-typography-font-weight);line-height:var(--gw-button-label-typography-line-height);text-decoration:none;white-space:nowrap;outline:var(--gw-button-focus-ring-width) var(--gw-button-focus-ring-style) var(--gw-button-secondary-focus-ring-color);outline-offset:var(--gw-button-focus-ring-offset)}.wb-layout .skip-link:focus:hover{border-color:var(--gw-button-secondary-hover-border-color);color:var(--gw-button-secondary-hover-color)}.wb-layout .skip-link:focus:active{border-color:var(--gw-button-secondary-active-border-color);color:var(--gw-button-secondary-active-color)}';export{z as onto_layout};
@@ -1 +1 @@
1
- import{p as o,H as e,g as t,b as n}from"./p-BntG-4Sv.js";export{s as setNonce}from"./p-BntG-4Sv.js";var i=o=>{const e=o.cloneNode;o.cloneNode=function(o){if("TEMPLATE"===this.nodeName)return e.call(this,o);const t=e.call(this,!1),n=this.childNodes;if(o)for(let o=0;o<n.length;o++)2!==n[o].nodeType&&t.appendChild(n[o].cloneNode(!0));return t}};(()=>{i(e.prototype);const t=import.meta.url,n={};return""!==t&&(n.resourcesUrl=new URL(".",t).href),o(n)})().then(async o=>(await t(),n([["p-6fd8a7ef",[[4,"onto-layout",{authenticatedUser:[32],authToken:[32],securityConfig:[32],isLowResolution:[32],showHeader:[32],showNavbar:[32],isEmbedded:[32],loading:[32]},[[0,"navbarToggled","onNavbarToggled"],[9,"resize","onResize"],[4,"keydown","handleDocumentKeydown"],[4,"focusin","handleGlobalFocus"]]]]],["p-c93c1bb7",[[0,"onto-confirm-cancel-dialog",{isOpen:[32],hasDontShowAgain:[32]},[[16,"confirm-cancel-event","onConfirmCancelEvent"]]]]],["p-c0b9a2c2",[[0,"onto-graph-explore-split-button",{label:[1],disabled:[4],fetchGraphConfigs:[16,"fetch-graph-configs"],items:[32],isDropdownOpen:[32]}]]],["p-e07c6668",[[0,"onto-repository-info",{repository:[1],permission:[1],loading:[4],sizeInfo:[1,"size-info"],totalStatementsFormatter:[32],expansionRatioFormatter:[32]}]]],["p-44155ad6",[[0,"onto-permission-banner"]]],["p-19776e6a",[[4,"onto-deprecation-banner"]]],["p-b3e34efa",[[0,"onto-test-context",{initConfigurationContext:[64],updateLicense:[64],updateProductInfo:[64],loadRepositories:[64],setAuthenticatedUser:[64],setSecurityConfig:[64],login:[64],changeLanguage:[64],emitNavigateEndEvent:[64],updateSelectedRepository:[64],updateIsLoadingActiveRepositoryLocation:[64],openConfirmCancel:[64],addToastr:[64],addNotification:[64],setAutocomplete:[64],updateNamespaces:[64]}]]],["p-c48f7c3b",[[0,"onto-toastr",{toasts:[32]},[[16,"create-toast-event","handleToastCreate"]]]]],["p-6626ceec",[[0,"onto-tooltip",null,[[5,"mouseover","onMouseover"],[5,"mouseout","onMouseout"]]]]],["p-cb199b80",[[1,"onto-loader",{size:[2],loading:[4],messageText:[1,"message-text"],targetSelector:[1,"target-selector"]}]]],["p-2afd3908",[[0,"translate-label",{labelKey:[1,"label-key"],translationParameters:[16,"translation-parameters"],translatedLabel:[32]}]]],["p-28ac6173",[[0,"onto-toggle-switch",{checked:[1028],labelKey:[1,"label-key"],tooltipTranslationKey:[1,"tooltip-translation-key"],context:[1],tooltipLabel:[32]}],[4,"onto-dialog",{config:[16]}]]],["p-af742bb0",[[0,"onto-cookie-consent",{showModal:[32]},[[0,"closeDialog","onDialogClose"]]],[0,"onto-cookie-policy-dialog",null,[[0,"toggleChanged","toggleChangeHandler"]]]]],["p-96d4fef6",[[0,"onto-dropdown",{dropdownButtonName:[1,"dropdown-button-name"],dropdownButtonNameLabelKey:[1,"dropdown-button-name-label-key"],dropdownButtonGuideSelector:[1,"dropdown-button-guide-selector"],dropdownButtonTooltip:[1,"dropdown-button-tooltip"],dropdownButtonTooltipLabelKey:[1,"dropdown-button-tooltip-label-key"],iconClass:[1,"icon-class"],iconImage:[1,"icon-image"],items:[16],tooltipTheme:[1,"tooltip-theme"],itemTooltipTheme:[1,"item-tooltip-theme"],tooltipClass:[1,"tooltip-class"],tooltipPlacement:[1,"tooltip-placement"],dropdownAlignment:[1,"dropdown-alignment"],autoClose:[4,"auto-close"],disabled:[4],open:[32],buttonTooltipContent:[32],refreshButtonTooltip:[64]},[[8,"keydown","keydownListener"],[8,"click","mouseClickListener"]],{dropdownButtonTooltip:["onTooltipSourceChanged"],items:["onTooltipSourceChanged"]}]]],["p-3201c16d",[[0,"onto-rdf-search",{isOpen:[32],buttonConfig:[32]},[[8,"click","handleClick"]]],[0,"onto-language-selector",{dropdownAlignment:[1,"dropdown-alignment"],currentLanguage:[32]}],[0,"onto-license-alert",{license:[16]}],[0,"onto-operations-notification",{activeOperations:[16,"active-operations"],isOpen:[32]},[[8,"click","handleOutsideClick"],[0,"keydown","onKeyDown"]]],[0,"onto-repository-selector",{currentRepository:[16,"current-repository"],items:[16],repositorySizeInfoFetcher:[16,"repository-size-info-fetcher"],getRepositoryPermission:[16,"get-repository-permission"],defaultToggleButtonName:[32],noRepositoriesButtonMessage:[32],dropdownItems:[32]},null,{items:["onItemsChanged"]}],[0,"onto-user-login"],[0,"onto-user-menu",{user:[16],securityConfig:[16,"security-config"],isOpen:[32]},[[0,"keydown","onKeyDown"]]],[0,"onto-search-icon",{tooltipLabel:[32]}],[0,"onto-search-resource-input",{context:[1],skipValidation:[4,"skip-validation"],preserveSearch:[4,"preserve-search"],isHidden:[4,"is-hidden"],buttonConfig:[16,"button-config"],inputValue:[32],searchResult:[32],isAutocompleteEnabled:[32]},null,{isHidden:["onVisibilityChange"]}]]],["p-0b5b6ae2",[[0,"onto-header",{activeOperations:[32],license:[32],isFreeAccessEnabled:[32],shouldShowSearch:[32],isHomePage:[32],repositoryList:[32],repositoryItems:[32],currentRoute:[32],currentRepository:[32],securityConfig:[32],user:[32],showUserMenu:[32],showLoginButton:[32],applicationLogoPath:[32]}],[0,"onto-footer",{productInfo:[32],shouldShowCookieConsent:[32]},[[0,"consentGiven","handleConsentGiven"]]],[0,"onto-navbar",{navbarCollapsed:[4,"navbar-collapsed"],menuItems:[16,"menu-items"],menuModel:[32],isCollapsed:[32]},[[0,"keydown","onKeyDown"],[0,"focusout","onFocusOut"]],{navbarCollapsed:["navbarCollapsedChange"],menuItems:["menuItemsChanged"]}]]]],o)));
1
+ import{p as o,H as e,g as t,b as n}from"./p-BntG-4Sv.js";export{s as setNonce}from"./p-BntG-4Sv.js";var i=o=>{const e=o.cloneNode;o.cloneNode=function(o){if("TEMPLATE"===this.nodeName)return e.call(this,o);const t=e.call(this,!1),n=this.childNodes;if(o)for(let o=0;o<n.length;o++)2!==n[o].nodeType&&t.appendChild(n[o].cloneNode(!0));return t}};(()=>{i(e.prototype);const t=import.meta.url,n={};return""!==t&&(n.resourcesUrl=new URL(".",t).href),o(n)})().then(async o=>(await t(),n([["p-474b4bf3",[[4,"onto-layout",{authenticatedUser:[32],authToken:[32],securityConfig:[32],isLowResolution:[32],showHeader:[32],showNavbar:[32],isEmbedded:[32],loading:[32]},[[0,"navbarToggled","onNavbarToggled"],[9,"resize","onResize"],[4,"keydown","handleDocumentKeydown"],[4,"focusin","handleGlobalFocus"]]]]],["p-c93c1bb7",[[0,"onto-confirm-cancel-dialog",{isOpen:[32],hasDontShowAgain:[32]},[[16,"confirm-cancel-event","onConfirmCancelEvent"]]]]],["p-c0b9a2c2",[[0,"onto-graph-explore-split-button",{label:[1],disabled:[4],fetchGraphConfigs:[16,"fetch-graph-configs"],items:[32],isDropdownOpen:[32]}]]],["p-e07c6668",[[0,"onto-repository-info",{repository:[1],permission:[1],loading:[4],sizeInfo:[1,"size-info"],totalStatementsFormatter:[32],expansionRatioFormatter:[32]}]]],["p-44155ad6",[[0,"onto-permission-banner"]]],["p-19776e6a",[[4,"onto-deprecation-banner"]]],["p-b3e34efa",[[0,"onto-test-context",{initConfigurationContext:[64],updateLicense:[64],updateProductInfo:[64],loadRepositories:[64],setAuthenticatedUser:[64],setSecurityConfig:[64],login:[64],changeLanguage:[64],emitNavigateEndEvent:[64],updateSelectedRepository:[64],updateIsLoadingActiveRepositoryLocation:[64],openConfirmCancel:[64],addToastr:[64],addNotification:[64],setAutocomplete:[64],updateNamespaces:[64]}]]],["p-c48f7c3b",[[0,"onto-toastr",{toasts:[32]},[[16,"create-toast-event","handleToastCreate"]]]]],["p-6626ceec",[[0,"onto-tooltip",null,[[5,"mouseover","onMouseover"],[5,"mouseout","onMouseout"]]]]],["p-cb199b80",[[1,"onto-loader",{size:[2],loading:[4],messageText:[1,"message-text"],targetSelector:[1,"target-selector"]}]]],["p-2afd3908",[[0,"translate-label",{labelKey:[1,"label-key"],translationParameters:[16,"translation-parameters"],translatedLabel:[32]}]]],["p-28ac6173",[[0,"onto-toggle-switch",{checked:[1028],labelKey:[1,"label-key"],tooltipTranslationKey:[1,"tooltip-translation-key"],context:[1],tooltipLabel:[32]}],[4,"onto-dialog",{config:[16]}]]],["p-af742bb0",[[0,"onto-cookie-consent",{showModal:[32]},[[0,"closeDialog","onDialogClose"]]],[0,"onto-cookie-policy-dialog",null,[[0,"toggleChanged","toggleChangeHandler"]]]]],["p-96d4fef6",[[0,"onto-dropdown",{dropdownButtonName:[1,"dropdown-button-name"],dropdownButtonNameLabelKey:[1,"dropdown-button-name-label-key"],dropdownButtonGuideSelector:[1,"dropdown-button-guide-selector"],dropdownButtonTooltip:[1,"dropdown-button-tooltip"],dropdownButtonTooltipLabelKey:[1,"dropdown-button-tooltip-label-key"],iconClass:[1,"icon-class"],iconImage:[1,"icon-image"],items:[16],tooltipTheme:[1,"tooltip-theme"],itemTooltipTheme:[1,"item-tooltip-theme"],tooltipClass:[1,"tooltip-class"],tooltipPlacement:[1,"tooltip-placement"],dropdownAlignment:[1,"dropdown-alignment"],autoClose:[4,"auto-close"],disabled:[4],open:[32],buttonTooltipContent:[32],refreshButtonTooltip:[64]},[[8,"keydown","keydownListener"],[8,"click","mouseClickListener"]],{dropdownButtonTooltip:["onTooltipSourceChanged"],items:["onTooltipSourceChanged"]}]]],["p-3201c16d",[[0,"onto-rdf-search",{isOpen:[32],buttonConfig:[32]},[[8,"click","handleClick"]]],[0,"onto-language-selector",{dropdownAlignment:[1,"dropdown-alignment"],currentLanguage:[32]}],[0,"onto-license-alert",{license:[16]}],[0,"onto-operations-notification",{activeOperations:[16,"active-operations"],isOpen:[32]},[[8,"click","handleOutsideClick"],[0,"keydown","onKeyDown"]]],[0,"onto-repository-selector",{currentRepository:[16,"current-repository"],items:[16],repositorySizeInfoFetcher:[16,"repository-size-info-fetcher"],getRepositoryPermission:[16,"get-repository-permission"],defaultToggleButtonName:[32],noRepositoriesButtonMessage:[32],dropdownItems:[32]},null,{items:["onItemsChanged"]}],[0,"onto-user-login"],[0,"onto-user-menu",{user:[16],securityConfig:[16,"security-config"],isOpen:[32]},[[0,"keydown","onKeyDown"]]],[0,"onto-search-icon",{tooltipLabel:[32]}],[0,"onto-search-resource-input",{context:[1],skipValidation:[4,"skip-validation"],preserveSearch:[4,"preserve-search"],isHidden:[4,"is-hidden"],buttonConfig:[16,"button-config"],inputValue:[32],searchResult:[32],isAutocompleteEnabled:[32]},null,{isHidden:["onVisibilityChange"]}]]],["p-0b5b6ae2",[[0,"onto-header",{activeOperations:[32],license:[32],isFreeAccessEnabled:[32],shouldShowSearch:[32],isHomePage:[32],repositoryList:[32],repositoryItems:[32],currentRoute:[32],currentRepository:[32],securityConfig:[32],user:[32],showUserMenu:[32],showLoginButton:[32],applicationLogoPath:[32]}],[0,"onto-footer",{productInfo:[32],shouldShowCookieConsent:[32]},[[0,"consentGiven","handleConsentGiven"]]],[0,"onto-navbar",{navbarCollapsed:[4,"navbar-collapsed"],menuItems:[16,"menu-items"],menuModel:[32],isCollapsed:[32]},[[0,"keydown","onKeyDown"],[0,"focusout","onFocusOut"]],{navbarCollapsed:["navbarCollapsedChange"],menuItems:["menuItemsChanged"]}]]]],o)));
@@ -8,9 +8,6 @@ export declare class OntoLayout {
8
8
  private readonly runtimeConfigurationContextService;
9
9
  private readonly eventService;
10
10
  private readonly applicationLifecycleContextService;
11
- private readonly fullJwtKey;
12
- private readonly fullAuthenticatedKey;
13
- private readonly authEvents;
14
11
  hostElement: HTMLOntoLayoutElement;
15
12
  private navbarRef;
16
13
  authenticatedUser: AuthenticatedUser;
@@ -35,6 +32,8 @@ export declare class OntoLayout {
35
32
  * Whether the ongoing navigation changes the page. Query and hash changes keep the page, so the loader is not shown.
36
33
  */
37
34
  private isPageChanging;
35
+ /** The authentication state this page last reacted to, for changes from other tabs. */
36
+ private lastAuthenticatedState?;
38
37
  constructor();
39
38
  componentWillLoad(): void;
40
39
  componentDidRender(): void;
@@ -0,0 +1 @@
1
+ (self.webpackJsonpworkbench=self.webpackJsonpworkbench||[]).push([[697],{4697(n,t,o){o.d(t,{LoginPageComponent:()=>C});var e=o(5802),r=o(9417),i=o(3702),s=o(7830),a=o(7154),l=o(177),g=o(9769),c=o(5547);const u=n=>({"openid-login":n}),p=n=>({"has-error":n});function h(n,t){if(1&n&&(c.j41(0,"h2",8),c.EFF(1),c.nI1(2,"transloco"),c.k0s(),c.j41(3,"div",9)(4,"label",10),c.EFF(5),c.nI1(6,"transloco"),c.k0s(),c.j41(7,"div",11)(8,"span",12),c.nrm(9,"i",13),c.k0s(),c.nrm(10,"input",14),c.nI1(11,"transloco"),c.k0s()(),c.j41(12,"div",9)(13,"label",15),c.EFF(14),c.nI1(15,"transloco"),c.k0s(),c.j41(16,"div",11)(17,"span",12),c.nrm(18,"i",16),c.k0s(),c.nrm(19,"input",17),c.nI1(20,"transloco"),c.k0s()()),2&n){const n=c.XpG().loginForm.hasError("wrongCredentials");c.R7$(),c.JRh(c.bMT(2,9,"login.title")),c.R7$(4),c.JRh(c.bMT(6,11,"login.username")),c.R7$(5),c.Y8G("placeholder",c.mNQ(c.bMT(11,13,"login.username_placeholder")))("ngClass",c.eq3(19,p,n)),c.R7$(4),c.JRh(c.bMT(15,15,"login.password")),c.R7$(5),c.Y8G("placeholder",c.mNQ(c.bMT(20,17,"login.password_placeholder")))("ngClass",c.eq3(21,p,n))}}function d(n,t){1&n&&(c.j41(0,"button",6),c.EFF(1),c.nI1(2,"transloco"),c.k0s()),2&n&&(c.R7$(),c.SpI(" ",c.bMT(2,1,"login.sign_in")," "))}function m(n,t){if(1&n){const n=c.RV6();c.j41(0,"button",18),c.bIt("click",function(){e.eBV(n);const t=c.XpG();return e.Njj(t.login(!0))}),c.EFF(1),c.nI1(2,"transloco"),c.k0s()}2&n&&(c.R7$(),c.SpI(" ",c.bMT(2,1,"login.sign_in_openid")," "))}let C=(()=>{class n{constructor(){this.toastrService=(0,a.service)(a.OntoToastrService),this.securityService=(0,a.service)(a.SecurityService),this.authenticationService=(0,a.service)(a.AuthenticationService),this.openidSessionStorageService=(0,a.service)(a.OpenidSessionStorageService),this.configurationContextService=(0,a.service)(a.ConfigurationContextService),this.runtimeConfigurationContextService=(0,a.service)(a.RuntimeConfigurationContextService),this.fb=(0,e.WQX)(r.ok),this.route=(0,e.WQX)(i.nX),this.router=(0,e.WQX)(i.Ix),this.translocoService=(0,e.WQX)(s.JO),this.subscriptions=new Array,this.error=!1,this.logoPath=(0,e.vPA)(this.configurationContextService.getApplicationConfiguration().applicationLogoPath),this.loginForm=this.fb.group({username:["",r.k0.required],password:["",r.k0.required]}),this.returnUrl="./"}ngOnInit(){this.handleQueryParams(),this.subscribeToThemeModeChange()}ngOnDestroy(){this.subscriptions.forEach(n=>n())}handleQueryParams(){const n=this.route.snapshot.queryParamMap,t=n.get(a.UrlPathParams.RETURN_URL);this.returnUrl=t||"./",n.has(a.UrlPathParams.NO_ACCESS)?this.toastrService.error(this.translocoService.translate("login.errors.no_rights"),this.translocoService.translate("login.error")):n.has(a.UrlPathParams.EXPIRED)&&this.toastrService.error(this.translocoService.translate("login.errors.auth_token_expired"),this.translocoService.translate("login.error"))}isGDBLoginEnabled(){return this.securityService.isPasswordLoginEnabled()}isOpenIDEnabled(){return this.securityService.isOpenIDEnabled()}login(n=!1){let t;if(this.loginForm.setErrors(null),n)this.openidSessionStorageService.setReturnUrl(this.returnUrl);else{if(!this.isFormValid())return;t=this.loginForm.value}this.authenticationService.login(t).then(()=>{this.router.navigateByUrl(this.returnUrl)}).catch(n=>{401===n.status?(this.toastrService.error(this.translocoService.translate("login.errors.wrong_credentials"),this.translocoService.translate("login.error")),this.loginForm.setErrors({wrongCredentials:!0})):this.toastrService.error(n.message,n.status)})}subscribeToThemeModeChange(){this.subscriptions.push(this.runtimeConfigurationContextService.onThemeModeChanged(n=>{this.logoPath.set(this.configurationContextService.getApplicationLogoPath(n))}))}isFormValid(n=!0){return n&&this.loginForm.markAllAsTouched(),!this.loginForm.invalid}static{this.ɵfac=function(t){return new(t||n)}}static{this.ɵcmp=c.VBU({type:n,selectors:[["app-login"]],hostAttrs:[1,"login-page-route"],decls:10,vars:13,consts:[[1,"login-form"],[1,"login-card",3,"ngClass"],[1,"application-logo"],[1,"graphdb-logo",3,"ngSrc","width","height","alt"],["novalidate","",3,"ngSubmit","formGroup"],[1,"actions"],["type","submit","data-test","submit-btn",1,"onto-btn","onto-btn-primary","onto-lg"],["type","button",1,"onto-btn","onto-btn-primary","onto-lg"],[1,"login-title"],[1,"group"],["for","username",1,"label-base-regular"],[1,"input-wrapper"],[1,"icon-wrapper"],[1,"ri-user-line"],["id","username","formControlName","username","autocomplete","username","type","text","data-test","username-input",1,"input-field",3,"ngClass","placeholder"],["for","password",1,"label-base-regular"],[1,"ri-lock-line"],["id","password","formControlName","password","autocomplete","current-password","type","password","data-test","password-input",1,"input-field",3,"ngClass","placeholder"],["type","button",1,"onto-btn","onto-btn-primary","onto-lg",3,"click"]],template:function(n,t){1&n&&(c.j41(0,"div",0)(1,"div",1)(2,"div",2),c.nrm(3,"img",3),c.nI1(4,"transloco"),c.k0s(),c.j41(5,"form",4),c.bIt("ngSubmit",function(){return t.login()}),c.nVh(6,h,21,23),c.j41(7,"div",5),c.nVh(8,d,3,3,"button",6),c.nVh(9,m,3,3,"button",7),c.k0s()()()()),2&n&&(c.R7$(),c.Y8G("ngClass",c.eq3(11,u,t.isOpenIDEnabled())),c.R7$(2),c.Y8G("ngSrc",t.logoPath())("width",200)("height",53)("alt",c.bMT(4,9,"login.logo_alt")),c.R7$(2),c.Y8G("formGroup",t.loginForm),c.R7$(),c.vxM(t.isGDBLoginEnabled()?6:-1),c.R7$(2),c.vxM(t.isGDBLoginEnabled()?8:-1),c.R7$(),c.vxM(t.isOpenIDEnabled()?9:-1))},dependencies:[r.X1,r.qT,r.me,r.BC,r.cb,r.j4,r.JD,g.MD,g.YU,l.kt,r.YN,s.Kj],styles:["[_nghost-%COMP%]{display:flex;align-items:center;justify-content:center;height:100%}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%]{width:600px;max-width:60%;margin:auto}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .application-logo[_ngcontent-%COMP%]{display:flex;justify-content:center}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .login-title[_ngcontent-%COMP%]{text-align:center;margin-top:2rem;margin-bottom:2rem}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .login-card[_ngcontent-%COMP%]{border:1px solid var(--gw-panel-border-color);border-radius:4px;box-shadow:0 3px 6px #0000001a;padding:1.6rem}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-bottom:1.5rem}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{margin-bottom:.5rem}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;width:100%}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-wrapper[_ngcontent-%COMP%] .icon-wrapper[_ngcontent-%COMP%]{position:absolute;left:0;top:50%;transform:translateY(-50%);padding:0 .75rem;color:var(--gw-text-muted-color);pointer-events:none;z-index:1}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-wrapper[_ngcontent-%COMP%] .icon-wrapper[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:1.5rem}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-field[_ngcontent-%COMP%]{width:100%;border:1px solid var(--gw-form-field-border-color);border-radius:0;padding:.75rem 1.5rem .75rem 3rem;font-size:1.125rem;line-height:var(--gw-sm-line-height);background-clip:padding-box;outline:none;box-sizing:border-box;color:var(--gw-form-field-color);background-color:var(--gw-form-field-background)}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-field[_ngcontent-%COMP%]:focus{box-shadow:none;border-color:var(--gw-form-field-focus-border-color)}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-field[_ngcontent-%COMP%]{color-scheme:light dark}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-field[_ngcontent-%COMP%]:-webkit-autofill, [_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-field[_ngcontent-%COMP%]:-webkit-autofill:focus, [_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-field[_ngcontent-%COMP%]:-webkit-autofill:hover, [_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-field[_ngcontent-%COMP%]:-webkit-autofill:active{-webkit-text-fill-color:var(--gw-form-field-color);box-shadow:0 0 0 1000px var(--gw-form-field-background) inset;caret-color:var(--gw-form-field-color);-webkit-transition:background-color 5000s ease-in-out 0s;transition:background-color 5000s ease-in-out 0s}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-field.ng-invalid.ng-touched[_ngcontent-%COMP%]{border:1px solid var(--gw-inputtext-invalid-border-color)}[_nghost-%COMP%] .login-form[_ngcontent-%COMP%] .group[_ngcontent-%COMP%] .input-field.has-error[_ngcontent-%COMP%]{border:1px solid var(--gw-inputtext-invalid-border-color)}[_nghost-%COMP%] .actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:stretch;gap:1rem;margin:2rem auto 0;width:fit-content}[_nghost-%COMP%] .actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:160px}"]})}}return n})()}}]);