UNPKG

@nent/core

Version:

Functional elements to add routing, data-binding, dynamic HTML, declarative actions, audio, video, and so much more. Supercharge static HTML files into web apps without script or builds.

4 lines 1.4 kB
/*! * NENT 2022 */ import{r as s,f as t,h as i,H as a,a as o}from"./index-916ca544.js";import{R as n}from"./interfaces-3b78db83.js";import{s as h}from"./state-adf07580.js";import"./index-4bfabbbd.js";const l=class{constructor(t){s(this,t),this.pageTitle="Not Found",this.scrollTopOffset=0}async setPageTags(s){s.hasExactRoute()||(await s.setPageTags({title:this.pageTitle,robots:"nofollow"}),s.scrollTo(this.scrollTopOffset))}componentWillLoad(){const{router:s}=h;s&&(this.transition=this.transition||(null==s?void 0:s.transition),this.routeChangeStartSubscription=s.eventBus.on(n.RouteChanged,(async()=>{t(this),await this.setPageTags(s)})),this.routeMatchedSubscription=s.eventBus.on(n.RouteMatchedExact,(async()=>{t(this),await this.setPageTags(s)})),this.routeFinalizeSubscription=s.eventBus.on(n.RouteChangeFinish,(async()=>{await this.setPageTags(s),t(this)})))}render(){var s;const t=(null===(s=h.router)||void 0===s?void 0:s.hasExactRoute())||!1;return i(a,{hidden:t,class:this.transition},i("slot",null))}async componentDidLoad(){await this.setPageTags(h.router)}disconnectedCallback(){var s,t,i;null===(s=this.routeChangeStartSubscription)||void 0===s||s.call(this),null===(t=this.routeMatchedSubscription)||void 0===t||t.call(this),null===(i=this.routeFinalizeSubscription)||void 0===i||i.call(this)}get el(){return o(this)}};l.style=":host { display: block; }";export{l as n_view_not_found}